@lacneu/atrium 0.91.0 → 0.91.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AccessTab-Cwu9fJwI.js +1 -0
- package/dist/assets/AdvancedFilter-DWYTua7e.js +1 -0
- package/dist/assets/AgentFilesTab-DaYXJcuZ.js +3 -0
- package/dist/assets/AnomaliesTab-RKY5LYNV.js +1 -0
- package/dist/assets/AuditTab-CqLksOpr.js +1 -0
- package/dist/assets/BridgeTab-1RNCxXv2.js +1 -0
- package/dist/assets/ChatDefaultsTab-BuS1Ihhq.js +1 -0
- package/dist/assets/{DataTableShell-BVsQymbm.js → DataTableShell-Dc3I5mkG.js} +1 -1
- package/dist/assets/{DetailChips-DUBteg4d.js → DetailChips-Cj0X9b5z.js} +1 -1
- package/dist/assets/FeedbacksTab-CmhVA188.js +1 -0
- package/dist/assets/{FieldLabel-DZpFEnBR.js → FieldLabel-BVUMb8MI.js} +1 -1
- package/dist/assets/FilesTab-Bs-qAb6x.js +1 -0
- package/dist/assets/{FilterBar-DCZ44bwb.js → FilterBar-Bfu-khK5.js} +1 -1
- package/dist/assets/GroupsTab-BblkD-Mw.js +1 -0
- package/dist/assets/InstancesTab-CykKru2n.js +1 -0
- package/dist/assets/IntegrationsTab-BGvWPcJJ.js +1 -0
- package/dist/assets/KpiTab-0-fYoy76.js +1 -0
- package/dist/assets/PreferencesTab-B7rx5jxG.js +1 -0
- package/dist/assets/ProjectPage-DeOofCgG.js +1 -0
- package/dist/assets/PromptInjectionsTab-iKx77mc6.js +4 -0
- package/dist/assets/RolesTab-CdpxcL32.js +1 -0
- package/dist/assets/ScheduledTab-mr_m7UIj.js +1 -0
- package/dist/assets/ServiceAccountsTab-Do5kRXXv.js +1 -0
- package/dist/assets/SubAgentReportsTab-DjKyJxXi.js +1 -0
- package/dist/assets/ThemeShowroom-wAQ75k0V.js +1 -0
- package/dist/assets/{TimeRangePicker-CwwVCrCQ.js → TimeRangePicker-BqClp5BN.js} +1 -1
- package/dist/assets/{TimezoneCombobox-BjAmc3Wa.js → TimezoneCombobox-yZPA1ePa.js} +1 -1
- package/dist/assets/TracesTab-n_5fNBHX.js +1 -0
- package/dist/assets/TrashPage-DKaJKpYI.js +1 -0
- package/dist/assets/TrashTab-C5EAGQ-A.js +1 -0
- package/dist/assets/UsersTab-DIGrBmUm.js +1 -0
- package/dist/assets/VoiceTab-CaHc9iZY.js +1 -0
- package/dist/assets/{api-SPJl6tGH.js → api-IF2KQFNF.js} +5 -5
- package/dist/assets/{button-B9I_tCoR.js → button-DDPt-po9.js} +1 -1
- package/dist/assets/{card-D68xlO9_.js → card-K4Zt5gfO.js} +1 -1
- package/dist/assets/chevrons-up-down-8nG-pF3_.js +1 -0
- package/dist/assets/{compatView-BC00J9O8.js → compatView-CVibrgBK.js} +1 -1
- package/dist/assets/dispatchErrorInfo-CO5iC4yd.js +1 -0
- package/dist/assets/{dist-C-0CeQxS.js → dist-821wRD_K.js} +1 -1
- package/dist/assets/{dist-HD-m_yy6.js → dist-BblNQdHV.js} +1 -1
- package/dist/assets/{dist-C_PXYFE6.js → dist-CRdE-dec.js} +1 -1
- package/dist/assets/{dist-BvIuNswV.js → dist-Cwenjp6w.js} +1 -1
- package/dist/assets/{highlighted-body-OFNGDK62-CNk37LmM.js → highlighted-body-OFNGDK62-rit1TAaB.js} +1 -1
- package/dist/assets/{index-Bp1ZTrP6.css → index-CkNmrzkS.css} +1 -1
- package/dist/assets/index-DaLXKABQ.js +446 -0
- package/dist/assets/{list-DFwigdtc.js → list-9tuUpKq3.js} +1 -1
- package/dist/assets/mermaid-GHXKKRXX-BOZxTT7y.js +1 -0
- package/dist/assets/{pdf-oRfJl3qk.js → pdf-BZkOsg6N.js} +1 -1
- package/dist/assets/roleDescriptions-DBJFh3-K.js +1 -0
- package/dist/assets/{table-ptMxv3sZ.js → table-CnU0GqDN.js} +1 -1
- package/dist/assets/{use_paginated_query-1UXiZTQo.js → use_paginated_query-DHl8KBoi.js} +1 -1
- package/dist/assets/x-F4mR_Xu3.js +1 -0
- package/dist/index.html +9 -9
- package/package.json +1 -1
- package/dist/assets/AccessTab-CuteYrFI.js +0 -1
- package/dist/assets/AdvancedFilter-Cl3dN0Cw.js +0 -1
- package/dist/assets/AgentFilesTab-CNcjp97h.js +0 -3
- package/dist/assets/AnomaliesTab-DS9aXP4r.js +0 -1
- package/dist/assets/AuditTab-uzM3zQUz.js +0 -1
- package/dist/assets/BridgeTab-DcYnj3ym.js +0 -1
- package/dist/assets/ChatDefaultsTab-Dhz6L-YO.js +0 -1
- package/dist/assets/FeedbacksTab-Dmxc4Zz2.js +0 -1
- package/dist/assets/FilesTab-Bjr8gzCL.js +0 -1
- package/dist/assets/GroupsTab-p-5DtKBn.js +0 -1
- package/dist/assets/InstancesTab-Cc-leb5e.js +0 -1
- package/dist/assets/IntegrationsTab-DH09KFFH.js +0 -1
- package/dist/assets/KpiTab-BOkyyq6m.js +0 -1
- package/dist/assets/PreferencesTab-BQSMi_rD.js +0 -1
- package/dist/assets/ProjectPage-DF9M9TLb.js +0 -1
- package/dist/assets/PromptInjectionsTab-DvD6riV0.js +0 -4
- package/dist/assets/RolesTab-Xmag3NV8.js +0 -1
- package/dist/assets/ScheduledTab-CO7OQKNu.js +0 -1
- package/dist/assets/ServiceAccountsTab-BL3wKxUd.js +0 -1
- package/dist/assets/SubAgentReportsTab-B9RoYUua.js +0 -1
- package/dist/assets/ThemeShowroom-DIydN8pO.js +0 -1
- package/dist/assets/TracesTab-BRilumz0.js +0 -1
- package/dist/assets/TrashPage-Czcs7Qpt.js +0 -1
- package/dist/assets/TrashTab-CK18lL1F.js +0 -1
- package/dist/assets/UsersTab-DoinSwYk.js +0 -1
- package/dist/assets/VoiceTab-CUDXOYcW.js +0 -1
- package/dist/assets/chevrons-up-down-BeOvUMHJ.js +0 -1
- package/dist/assets/dispatchErrorInfo-DaOp9su4.js +0 -1
- package/dist/assets/index-YN-yUUHf.js +0 -446
- package/dist/assets/mermaid-GHXKKRXX-BZ9VMyyv.js +0 -1
- package/dist/assets/roleDescriptions-BzUMHBek.js +0 -1
- package/dist/assets/x-Cx_O87S_.js +0 -1
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlighted-body-OFNGDK62-rit1TAaB.js","assets/bundle-mjs-C73ZY4La.js","assets/RolesTab-CdpxcL32.js","assets/api-IF2KQFNF.js","assets/roleDescriptions-DBJFh3-K.js","assets/button-DDPt-po9.js","assets/InstancesTab-CykKru2n.js","assets/FieldLabel-BVUMb8MI.js","assets/curation-CQksaIbm.js","assets/locales-CPjguROj.js","assets/BridgeTab-1RNCxXv2.js","assets/compatView-CVibrgBK.js","assets/dist-821wRD_K.js","assets/chevrons-up-down-8nG-pF3_.js","assets/FilterBar-Bfu-khK5.js","assets/TimeRangePicker-BqClp5BN.js","assets/table-CnU0GqDN.js","assets/dispatchErrorInfo-CO5iC4yd.js","assets/DataTableShell-Dc3I5mkG.js","assets/PromptInjectionsTab-iKx77mc6.js","assets/localePickerView-C2RmOS86.js","assets/confTabs-CCBW5ofF.css","assets/GroupsTab-BblkD-Mw.js","assets/x-F4mR_Xu3.js","assets/DetailChips-Cj0X9b5z.js","assets/IntegrationsTab-BGvWPcJJ.js","assets/FeedbacksTab-CmhVA188.js","assets/SubAgentReportsTab-DjKyJxXi.js","assets/TrashTab-C5EAGQ-A.js","assets/use_paginated_query-DHl8KBoi.js","assets/TrashPage-DKaJKpYI.js","assets/TrashPage-DBE3OVMc.css","assets/FilesTab-Bs-qAb6x.js","assets/ScheduledTab-mr_m7UIj.js","assets/list-9tuUpKq3.js","assets/TimezoneCombobox-yZPA1ePa.js","assets/AgentFilesTab-DaYXJcuZ.js","assets/PreferencesTab-B7rx5jxG.js","assets/ChatDefaultsTab-BuS1Ihhq.js","assets/AccessTab-Cwu9fJwI.js","assets/ThemeShowroom-wAQ75k0V.js","assets/AdvancedFilter-DWYTua7e.js","assets/card-K4Zt5gfO.js","assets/ProjectPage-DeOofCgG.js","assets/ProjectPage-BXsrYrrF.css","assets/TracesTab-n_5fNBHX.js","assets/VoiceTab-CaHc9iZY.js","assets/AuditTab-CqLksOpr.js","assets/AnomaliesTab-RKY5LYNV.js","assets/KpiTab-0-fYoy76.js","assets/ServiceAccountsTab-Do5kRXXv.js","assets/UsersTab-DIGrBmUm.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"./bundle-mjs-C73ZY4La.js";import{$ as l,$B as u,$C as d,$E as f,$K as p,$R as m,$S as h,$T as g,$V as _,$_ as v,$c as y,$f as b,$h as x,$i as S,$k as C,$n as w,$o as T,$r as E,$t as D,$u as O,$w as k,$x as ee,$z as A,AB as j,AC as te,AE as ne,AL as M,AR as N,AV as re,Aa as ie,Af as ae,Ah as oe,Ai as se,An as ce,Ao as le,Ap as ue,Aq as de,Ar as fe,As as pe,At as me,Av as he,Aw as ge,Ax as _e,Ay as ve,Az as ye,B as be,BB as xe,BC as Se,BE as Ce,BG as we,BR as Te,BV as Ee,B_ as De,Ba as Oe,Bc as ke,Bf as Ae,Bh as je,Bi as Me,Bm as Ne,Bn as Pe,Bo as Fe,Br as Ie,Bs as Le,Bt as Re,Bu as ze,Bv as Be,Bw as Ve,Bx as He,Bz as Ue,C as We,CB as Ge,CL as Ke,CV as qe,CY as P,Ca as Je,Cg as Ye,Ch as Xe,Ci as Ze,Cj as Qe,Cn as $e,Co as et,Cp as tt,Cq as nt,Cr as rt,Cs as it,Cv as at,Cw as ot,Cx as st,Cz as ct,DB as lt,DE as ut,DL as dt,DR as ft,DV as pt,DY as mt,Da as ht,Dc as gt,Dg as _t,Dh as vt,Di as yt,Dn as bt,Do as xt,Dp as St,Dq as Ct,Dr as wt,Ds as Tt,Dt as Et,Dv as Dt,Dw as Ot,Dx as kt,Dz as At,E as F,EB as jt,EE as Mt,EL as Nt,ER as Pt,EV as Ft,EY as It,Ea as Lt,Ec as Rt,Eg as zt,Eh as Bt,Ei as Vt,Ej as Ht,En as Ut,Eo as Wt,Ep as Gt,Eq as Kt,Er as qt,Es as Jt,Et as Yt,Ev as Xt,Ew as Zt,Ex as Qt,Ez as $t,FB as en,FC as tn,FJ as nn,FR as rn,FV as an,Fc as on,Ff as sn,Fh as cn,Fi as ln,Fm as un,Fn as dn,Fo as fn,Fq as pn,Fr as mn,Fs as hn,Ft as gn,Fu as _n,Fw as vn,Fx as yn,Fz as bn,G as xn,GB as Sn,GC as Cn,GE as wn,GG as Tn,GR as En,GS as Dn,GV as On,G_ as kn,Gc as An,Gd as jn,Gf as Mn,Gh as Nn,Gi as Pn,Gk as Fn,Gl as In,Gm as Ln,Gn as Rn,Go as zn,Gr as Bn,Gs as Vn,Gt as Hn,Gu as Un,Gw as Wn,Gx as Gn,Gz as Kn,H as qn,HB as Jn,HC as Yn,HE as Xn,HG as Zn,HR as Qn,HV as $n,H_ as er,Hc as tr,Hd as nr,Hf as rr,Hh as ir,Hi as ar,Hk as or,Hm as sr,Hn as cr,Ho as lr,Hr as ur,Hs as dr,Ht as fr,Hu as pr,Hv as mr,Hw as hr,Hx as gr,Hz as _r,I as vr,IB as yr,IC as br,IE as xr,IR as Sr,IV as Cr,I_ as wr,Ic as Tr,If as Er,Ih as Dr,Ii as Or,Im as kr,In as Ar,Io as jr,Ir as Mr,Is as Nr,It as Pr,Iu as Fr,Iw as Ir,Ix as Lr,Iz as Rr,J as zr,JB as Br,JC as Vr,JE as Hr,JG as Ur,JR as Wr,JS as Gr,JT as Kr,JV as qr,J_ as Jr,Ja as Yr,Jc as Xr,Jf as Zr,Jh as Qr,Ji as $r,Jk as ei,Jm as ti,Jn as ni,Jo as ri,Jr as ii,Js as ai,Jt as oi,Ju as si,Jw as ci,Jx as li,Jz as ui,K as di,KB as fi,KC as pi,KE as mi,KG as hi,KO as gi,KR as _i,KS as vi,KT as yi,KV as bi,K_ as xi,Kc as Si,Kd as Ci,Kf as wi,Kh as Ti,Ki as Ei,Kk as Di,Kl as Oi,Km as ki,Kn as Ai,Ko as ji,Kr as Mi,Ks as Ni,Kt as Pi,Ku as Fi,Kw as Ii,Kx as Li,Kz as Ri,L as zi,LB as Bi,LC as Vi,LE as Hi,LR as Ui,LV as Wi,L_ as Gi,La as Ki,Lc as qi,Lf as Ji,Lh as Yi,Li as Xi,Lm as Zi,Ln as Qi,Lo as $i,Lq as ea,Lr as ta,Ls as na,Lt as ra,Lu as ia,Lw as aa,Lx as oa,Lz as sa,MB as ca,MC as la,ML as ua,MR as da,MV as fa,MY as pa,Mc as ma,Mf as ha,Mh as ga,Mi as _a,Mm as va,Mn as ya,Mo as ba,Mp as xa,Mq as Sa,Mr as Ca,Ms as wa,Mt as Ta,Mu as Ea,Mv as Da,Mw as Oa,Mx as ka,Mz as Aa,NB as ja,NC as Ma,NL as Na,NR as Pa,NV as Fa,NY as Ia,Nc as La,Nf as Ra,Nh as za,Ni as Ba,Nm as Va,Nn as Ha,No as Ua,Np as Wa,Nq as Ga,Nr as Ka,Ns as qa,Nt as Ja,Nu as Ya,Nw as Xa,Nx as Za,Nz as Qa,OB as $a,OL as eo,OR as to,OV as no,OY as ro,Oa as io,Oc as ao,Of as oo,Og as so,Oh as co,Oi as lo,On as uo,Oo as fo,Op as po,Oq as mo,Or as ho,Os as go,Ot as _o,Ov as vo,Ow as yo,Ox as bo,Oz as xo,PB as So,PC as Co,PL as wo,PR as To,PV as Eo,PY as Do,Pa as Oo,Pc as ko,Pf as Ao,Ph as jo,Pi as Mo,Pm as No,Pn as Po,Po as Fo,Pq as Io,Pr as Lo,Ps as Ro,Pt as zo,Pu as Bo,Pw as Vo,Px as Ho,Pz as Uo,Q as Wo,QB as Go,QC as Ko,QE as qo,QK as Jo,QR as Yo,QS as Xo,QT as Zo,QV as Qo,Q_ as $o,Qc as es,Qf as ts,Qh as ns,Qi as rs,Qk as is,Ql as as,Qn as os,Qo as ss,Qq as cs,Qr as ls,Qt as us,Qu as ds,Qw as fs,Qx as ps,Qz as ms,R as hs,RB as gs,RC as _s,RE as vs,RR as ys,RV as bs,R_ as xs,Rc as Ss,Rf as Cs,Rh as ws,Ri as Ts,Rm as Es,Rn as Ds,Ro as Os,Rq as ks,Rr as As,Rs as js,Rt as Ms,Ru as Ns,Rw as Ps,Rx as Fs,Rz as Is,S as Ls,SB as Rs,SC as zs,SL as Bs,SV as Vs,SY as I,Sa as Hs,Sf as Us,Sg as Ws,Sh as Gs,Si as Ks,Sj as qs,Sn as Js,So as Ys,Sp as Xs,Sq as Zs,Sr as Qs,Ss as $s,Su as ec,Sv as tc,Sw as nc,Sx as rc,Sz as ic,T as ac,TB as oc,TL as sc,TR as cc,TV as lc,TY as uc,Ta as dc,Tc as fc,Tf as pc,Tg as mc,Th as hc,Ti as gc,Tj as _c,Tn as vc,Tp as yc,Tq as bc,Tr as xc,Ts as Sc,Tv as Cc,Tw as wc,Tx as Tc,Tz as Ec,U as Dc,UB as Oc,UC as kc,UE as Ac,UR as jc,UV as Mc,U_ as Nc,Uc as Pc,Ud as Fc,Uf as Ic,Uh as Lc,Ui as Rc,Uk as zc,Um as Bc,Un as Vc,Uo as Hc,Ur as Uc,Us as Wc,Ut as Gc,Uu as Kc,Uv as qc,Uw as Jc,Ux as Yc,Uz as Xc,V as Zc,VB as Qc,VC as $c,VE as el,VG as tl,VR as nl,VV as rl,V_ as il,Vc as al,Vd as ol,Vf as sl,Vh as cl,Vi as ll,Vk as ul,Vm as dl,Vn as fl,Vo as pl,Vr as ml,Vs as hl,Vt as gl,Vu as _l,Vv as vl,Vw as yl,Vx as bl,Vz as xl,W as Sl,WB as Cl,WC as wl,WE as Tl,WG as El,WR as Dl,WS as Ol,WV as kl,W_ as Al,Wc as jl,Wd as Ml,Wf as Nl,Wh as Pl,Wi as Fl,Wk as Il,Wl as Ll,Wm as Rl,Wn as zl,Wo as Bl,Wr as Vl,Ws as Hl,Wt as Ul,Wu as Wl,Wv as Gl,Ww as Kl,Wx as ql,Wz as Jl,X as Yl,XB as Xl,XC as Zl,XE as Ql,XR as $l,XS as eu,XT as tu,XV as nu,X_ as ru,Xa as iu,Xc as au,Xf as ou,Xh as su,Xi as cu,Xk as lu,Xn as uu,Xo as du,Xr as fu,Xt as pu,Xu as mu,Xw as hu,Xx as gu,Xz as _u,Y as vu,YB as yu,YC as bu,YE as xu,YR as Su,YS as Cu,YT as wu,YV as Tu,Y_ as Eu,Ya as Du,Yc as Ou,Yf as ku,Yh as Au,Yi as ju,Yk as Mu,Ym as Nu,Yn as Pu,Yo as Fu,Yr as Iu,Ys as Lu,Yt as Ru,Yu as zu,Yw as Bu,Yx as Vu,Yz as Hu,Z as Uu,ZB as Wu,ZC as Gu,ZE as Ku,ZR as qu,ZS as Ju,ZT as Yu,ZV as Xu,Z_ as Zu,Zc as Qu,Zf as $u,Zh as ed,Zi as td,Zk as nd,Zn as rd,Zo as id,Zr as ad,Zt as od,Zu as sd,Zw as cd,Zx as ld,Zz as ud,_ as dd,_B as fd,_C as pd,_D as md,_K as hd,_L as gd,_V as _d,_a as vd,_d as yd,_g as bd,_h as xd,_i as Sd,_j as Cd,_l as wd,_n as Td,_o as Ed,_q as Dd,_r as Od,_s as kd,_u as Ad,_v as jd,_w as Md,_x as Nd,_z as Pd,a as Fd,aA as Id,aB as Ld,aC as Rd,aD as zd,aE as Bd,aH as Vd,aT as Hd,aV as Ud,a_ as Wd,aa as Gd,ac as Kd,ad as qd,ag as Jd,ah as Yd,ai as Xd,aj as Zd,al as Qd,an as $d,ap as ef,aq as tf,ar as nf,as as rf,av as af,aw as of,az as sf,b as cf,bB as lf,bC as uf,bK as df,bL as ff,bV as pf,bY as mf,ba as hf,bd as gf,bg as _f,bh as vf,bi as yf,bj as bf,bn as xf,bo as Sf,bp as Cf,bq as wf,br as Tf,bs as Ef,bu as Df,bv as Of,bw as kf,bx as Af,bz as jf,c as Mf,cA as Nf,cB as Pf,cC as Ff,cD as If,cE as Lf,cH as Rf,cT as zf,cV as Bf,cY as Vf,ca as Hf,cd as Uf,cg as Wf,ch as Gf,ci as Kf,cj as qf,cl as Jf,cp as Yf,cq as Xf,cr as Zf,cu as Qf,cv as $f,cw as ep,cz as tp,d as np,dA as rp,dB as ip,dC as ap,dD as op,dE as sp,dT as cp,dV as lp,dY as up,da as dp,dd as fp,dg as pp,dh as mp,di as hp,dj as gp,dl as _p,dq as vp,dr as yp,ds as bp,du as xp,dv as Sp,dw as Cp,dx as wp,dz as Tp,eA as Ep,eB as Dp,eC as Op,eD as kp,eE as Ap,eH as jp,eT as Mp,eV as Np,ea as Pp,ed as Fp,eg as Ip,ei as Lp,ej as Rp,el as zp,en as Bp,ep as Vp,eq as Hp,er as Up,es as Wp,ev as Gp,ew as Kp,ez as qp,f as Jp,fA as Yp,fB as Xp,fC as Zp,fD as Qp,fE as $p,fT as em,fV as tm,fY as eee,fa as nm,fd as tee,fg as nee,fh as ree,fi as iee,fj as aee,fl as oee,fq as see,fr as cee,fs as rm,fu as lee,fv as uee,fw as dee,fx as fee,fz as pee,g as im,gB as mee,gC as hee,gD as gee,gK as _ee,gL as am,gO as om,gV as sm,gY as cm,ga as lm,gb as um,gd as dm,gg as fm,gh as pm,gi as mm,gj as hm,gl as gm,go as _m,gq as vm,gr as ym,gs as bm,gu as xm,gv as Sm,gw as Cm,gx as wm,gz as Tm,h as Em,hA as Dm,hB as Om,hC as km,hD as Am,hK as jm,hV as Mm,hY as Nm,ha as Pm,hb as Fm,hd as Im,hg as Lm,hh as Rm,hi as zm,hj as Bm,hl as Vm,ho as Hm,hq as Um,hr as Wm,hs as Gm,hu as Km,hv as qm,hw as Jm,hx as Ym,hz as Xm,i as Zm,iA as Qm,iB as $m,iC as eh,iD as th,iH as nh,iP as rh,iT as ih,iV as ah,ia as oh,id as sh,ig as ch,ii as lh,ij as uh,il as dh,in as fh,ip as ph,iq as mh,ir as hh,is as gh,iv as _h,iw as vh,iz as yh,jB as bh,jC as xh,jL as Sh,jR as Ch,jT as wh,jV as Th,jY as Eh,ja as Dh,jc as Oh,jf as kh,jh as Ah,ji as jh,jn as Mh,jo as Nh,jp as Ph,jq as Fh,jr as Ih,js as Lh,jt as Rh,jv as zh,jw as Bh,jx as Vh,jy as Hh,jz as Uh,kB as Wh,kL as Gh,kR as Kh,kV as qh,kY as Jh,ka as Yh,kc as Xh,kf as Zh,kg as Qh,kh as $h,ki as eg,kn as tg,ko as ng,kp as rg,kq as ig,kr as ag,ks as og,kt as sg,kv as cg,kw as lg,kx as ug,ky as dg,kz as fg,l as pg,lA as mg,lB as vee,lC as yee,lD as bee,lE as xee,lH as See,lT as Cee,lV as wee,lY as Tee,la as hg,ld as Eee,lg as Dee,lh as Oee,li as kee,lj as Aee,ll as gg,lp as jee,lq as Mee,lr as Nee,lu as _g,lv as Pee,lw as Fee,lz as vg,mA as Iee,mB as Lee,mC as Ree,mD as zee,mK as Bee,mV as Vee,mY as Hee,ma as Uee,mb as Wee,md as Gee,mg as yg,mh as Kee,mi as qee,mj as Jee,ml as Yee,mo as Xee,mq as Zee,mr as Qee,ms as $ee,mu as ete,mv as tte,mw as nte,mx as rte,mz as ite,n as bg,nA as ate,nB as ote,nC as ste,nD as cte,nE as xg,nH as lte,nT as ute,nV as Sg,na as dte,nd as fte,ng as Cg,ni as wg,nj as pte,nl as Tg,nn as Eg,np as mte,nq as hte,nr as gte,ns as _te,nv as vte,nw as yte,nz as bte,o as Dg,oA as xte,oB as Ste,oC as Cte,oD as wte,oE as Tte,oH as Ete,oT as Dte,oV as Ote,oY as kte,oa as Ate,oc as jte,od as Mte,og as Og,oh as Nte,oi as kg,oj as Pte,ol as Fte,on as Ite,op as Ag,oq as Lte,or as Rte,os as zte,ov as Bte,ow as Vte,oz as Hte,p as jg,pA as Ute,pB as Wte,pC as Gte,pD as Kte,pE as qte,pK as Jte,pT as Yte,pV as Mg,pY as Ng,pa as Xte,pd as Zte,pg as Pg,ph as Qte,pi as $te,pj as ene,pl as tne,pq as nne,pr as Fg,ps as Ig,pu as rne,pv as ine,pw as ane,px as one,pz as sne,q as cne,qB as lne,qC as une,qE as dne,qG as fne,qR as Lg,qS as Rg,qT as pne,qV as mne,q_ as hne,qc as zg,qf as gne,qh as _ne,qi as vne,qk as yne,qm as bne,qn as xne,qo as Sne,qr as Cne,qs as Bg,qt as wne,qu as Tne,qw as Vg,qx as Hg,qz as Ug,r as Wg,rA as Ene,rB as Dne,rC as One,rD as Gg,rE as kne,rH as Ane,rT as jne,rV as Mne,ra as Nne,rd as Pne,rg as Kg,ri as Fne,rj as Ine,rl as qg,rn as Lne,rp as Rne,rq as zne,rr as Bne,rs as Vne,rv as Hne,rw as Une,rz as Wne,s as Jg,sA as Gne,sB as Kne,sC as qne,sD as Jne,sE as Yne,sH as Xne,sT as Zne,sV as Qne,sY as Yg,sa as $ne,sc as ere,sd as Xg,sg as tre,sh as nre,si as Zg,sj as rre,sl as Qg,sp as ire,sq as are,sr as ore,sv as sre,sw as cre,sz as lre,t as L,tA as ure,tB as $g,tC as dre,tD as fre,tE as e_,tH as pre,tT as mre,tV as hre,ta as gre,td as _re,tg as t_,ti as vre,tj as yre,tl as n_,tn as r_,tp as bre,tq as xre,tr as Sre,ts as Cre,tv as wre,tw as Tre,tz as Ere,u as i_,uA as Dre,uB as Ore,uC as kre,uD as Are,uE as jre,uT as Mre,uV as a_,uY as Nre,ua as Pre,ud as Fre,ug as Ire,uh as Lre,ui as Rre,uj as zre,ul as o_,uq as Bre,ur as Vre,uu as Hre,uv as Ure,uw as s_,uz as c_,v as R,vB as Wre,vC as Gre,vD as Kre,vK as qre,vL as Jre,vV as Yre,vY as Xre,va as Zre,vd as l_,vf as u_,vg as d_,vh as f_,vi as p_,vj as m_,vl as h_,vn as g_,vo as __,vq as Qre,vr as $re,vs as eie,vu as tie,vv as v_,vw as nie,vx as rie,vz as iie,w as y_,wB as b_,wL as aie,wV as oie,wY as x_,wa as S_,wc as C_,wf as w_,wg as T_,wh as E_,wi as D_,wj as O_,wn as k_,wp as A_,wq as j_,wr as M_,ws as N_,wv as P_,ww as F_,wx as I_,wz as L_,x as R_,xB as z_,xC as B_,xK as V_,xL as sie,xV as cie,xY as H_,xa as lie,xd as U_,xg as uie,xh as die,xi as W_,xj as fie,xn as G_,xp as pie,xq as mie,xr as hie,xs as gie,xu as _ie,xv as K_,xw as q_,xx as vie,xz as yie,y as J_,yB as bie,yC as xie,yK as Sie,yL as Cie,yV as wie,yY as Tie,ya as Eie,yd as Die,yf as Y_,yg as Oie,yh as kie,yi as X_,yj as Aie,yn as jie,yo as Z_,yq as Mie,yr as Nie,ys as Pie,yu as Fie,yv as Q_,yw as Iie,yx as Lie,yz as Rie,z as zie,zB as Bie,zC as Vie,zE as Hie,zR as Uie,zV as Wie,z_ as $_,zc as Gie,zf as Kie,zh as qie,zi as Jie,zm as Yie,zn as ev,zo as Xie,zr as Zie,zs as tv,zt as nv,zu as rv,zw as iv,zx as av,zz as ov}from"./api-IF2KQFNF.js";import{n as sv,r as cv,t as lv}from"./dist-821wRD_K.js";import{t as uv}from"./x-F4mR_Xu3.js";import{a as dv,c as fv,i as pv,l as mv,n as hv,o as gv,r as _v,s as vv,t as yv,u as bv}from"./dist-BblNQdHV.js";import{t as xv}from"./dist-CRdE-dec.js";import{a as Sv,i as Cv,n as wv,r as Tv,t as Ev}from"./dist-Cwenjp6w.js";import{n as Dv,t as Ov}from"./button-DDPt-po9.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var kv=a((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&A(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&A(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,ee=k.port2;k.port1.onmessage=D,O=function(){ee.postMessage(null)}}else O=function(){_(D,0)};function A(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,A(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Av=a(((e,t)=>{t.exports=kv()})),jv=a((t=>{var r=Av(),i=e(),a=n();function o(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function s(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function l(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(c(e)!==e)throw Error(o(188))}function f(e){var t=e.alternate;if(!t){if(t=c(e),t===null)throw Error(o(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return d(i),e;if(a===r)return d(i),t;a=a.sibling}throw Error(o(188))}if(n.return!==r.return)n=i,r=a;else{for(var s=!1,l=i.child;l;){if(l===n){s=!0,n=i,r=a;break}if(l===r){s=!0,r=i,n=a;break}l=l.sibling}if(!s){for(l=a.child;l;){if(l===n){s=!0,n=a,r=i;break}if(l===r){s=!0,r=a,n=i;break}l=l.sibling}if(!s)throw Error(o(189))}}if(n.alternate!==r)throw Error(o(190))}if(n.tag!==3)throw Error(o(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}var m=Object.assign,h=Symbol.for(`react.element`),g=Symbol.for(`react.transitional.element`),_=Symbol.for(`react.portal`),v=Symbol.for(`react.fragment`),y=Symbol.for(`react.strict_mode`),b=Symbol.for(`react.profiler`),x=Symbol.for(`react.consumer`),S=Symbol.for(`react.context`),C=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),E=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),O=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),ee=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=ee&&e[ee]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function te(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case v:return`Fragment`;case b:return`Profiler`;case y:return`StrictMode`;case w:return`Suspense`;case T:return`SuspenseList`;case O:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case _:return`Portal`;case S:return e.displayName||`Context`;case x:return(e._context.displayName||`Context`)+`.Consumer`;case C:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case E:return t=e.displayName||null,t===null?te(e.type)||`Memo`:t;case D:t=e._payload,e=e._init;try{return te(e(t))}catch{}}return null}var ne=Array.isArray,M=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re={pending:!1,data:null,method:null,action:null},ie=[],ae=-1;function oe(e){return{current:e}}function se(e){0>ae||(e.current=ie[ae],ie[ae]=null,ae--)}function ce(e,t){ae++,ie[ae]=e.current,e.current=t}var le=oe(null),ue=oe(null),de=oe(null),fe=oe(null);function pe(e,t){switch(ce(de,t),ce(ue,e),ce(le,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?rf(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=rf(t),e=af(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}se(le),ce(le,e)}function me(){se(le),se(ue),se(de)}function he(e){e.memoizedState!==null&&ce(fe,e);var t=le.current,n=af(t,e.type);t!==n&&(ce(ue,e),ce(le,n))}function ge(e){ue.current===e&&(se(le),se(ue)),fe.current===e&&(se(fe),mp._currentValue=re)}var _e,ve;function ye(e){if(_e===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);_e=t&&t[1]||``,ve=-1<e.stack.indexOf(`
|
|
3
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
|
+
`+_e+e+ve}var be=!1;function xe(e,t){if(!e||be)return``;be=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
5
|
+
`),l=s.split(`
|
|
6
|
+
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
7
|
+
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{be=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?ye(n):``}function Se(e,t){switch(e.tag){case 26:case 27:case 5:return ye(e.type);case 16:return ye(`Lazy`);case 13:return e.child!==t&&t!==null?ye(`Suspense Fallback`):ye(`Suspense`);case 19:return ye(`SuspenseList`);case 0:case 15:return xe(e.type,!1);case 11:return xe(e.type.render,!1);case 1:return xe(e.type,!0);case 31:return ye(`Activity`);default:return``}}function Ce(e){try{var t=``,n=null;do t+=Se(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
8
|
+
Error generating stack: `+e.message+`
|
|
9
|
+
`+e.stack}}var we=Object.prototype.hasOwnProperty,Te=r.unstable_scheduleCallback,Ee=r.unstable_cancelCallback,De=r.unstable_shouldYield,Oe=r.unstable_requestPaint,ke=r.unstable_now,Ae=r.unstable_getCurrentPriorityLevel,je=r.unstable_ImmediatePriority,Me=r.unstable_UserBlockingPriority,Ne=r.unstable_NormalPriority,Pe=r.unstable_LowPriority,Fe=r.unstable_IdlePriority,Ie=r.log,Le=r.unstable_setDisableYieldValue,Re=null,ze=null;function Be(e){if(typeof Ie==`function`&&Le(e),ze&&typeof ze.setStrictMode==`function`)try{ze.setStrictMode(Re,e)}catch{}}var Ve=Math.clz32?Math.clz32:We,He=Math.log,Ue=Math.LN2;function We(e){return e>>>=0,e===0?32:31-(He(e)/Ue|0)|0}var Ge=256,Ke=262144,qe=4194304;function P(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Je(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=P(n))):i=P(o):i=P(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=P(n))):i=P(o)):i=P(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ye(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Xe(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ze(){var e=qe;return qe<<=1,!(qe&62914560)&&(qe=4194304),e}function Qe(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function $e(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function et(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Ve(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&tt(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function tt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ve(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function nt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ve(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function rt(e,t){var n=t&-t;return n=n&42?1:it(n),(n&(e.suspendedLanes|t))===0?n:0}function it(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function at(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function ot(){var e=N.p;return e===0?(e=window.event,e===void 0?32:Ap(e.type)):e}function st(e,t){var n=N.p;try{return N.p=e,t()}finally{N.p=n}}var ct=Math.random().toString(36).slice(2),lt=`__reactFiber$`+ct,ut=`__reactProps$`+ct,dt=`__reactContainer$`+ct,ft=`__reactEvents$`+ct,pt=`__reactListeners$`+ct,mt=`__reactHandles$`+ct,ht=`__reactResources$`+ct,gt=`__reactMarker$`+ct;function _t(e){delete e[lt],delete e[ut],delete e[ft],delete e[pt],delete e[mt]}function vt(e){var t=e[lt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[dt]||n[lt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Df(e);e!==null;){if(n=e[lt])return n;e=Df(e)}return t}e=n,n=e.parentNode}return null}function yt(e){if(e=e[lt]||e[dt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function bt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function xt(e){var t=e[ht];return t||=e[ht]={hoistableStyles:new Map,hoistableScripts:new Map},t}function St(e){e[gt]=!0}var Ct=new Set,wt={};function Tt(e,t){Et(e,t),Et(e+`Capture`,t)}function Et(e,t){for(wt[e]=t,e=0;e<t.length;e++)Ct.add(t[e])}var Dt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),Ot={},kt={};function At(e){return we.call(kt,e)?!0:we.call(Ot,e)?!1:Dt.test(e)?kt[e]=!0:(Ot[e]=!0,!1)}function F(e,t,n){if(At(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function jt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function Mt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Nt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Pt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Ft(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function It(e){if(!e._valueTracker){var t=Pt(e)?`checked`:`value`;e._valueTracker=Ft(e,t,``+e[t])}}function Lt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Pt(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Rt(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var zt=/[\n"\\]/g;function Bt(e){return e.replace(zt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Vt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Nt(t)):e.value!==``+Nt(t)&&(e.value=``+Nt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Ut(e,o,Nt(n)):Ut(e,o,Nt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Nt(s):e.removeAttribute(`name`)}function Ht(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){It(e);return}n=n==null?``:``+Nt(n),t=t==null?n:``+Nt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),It(e)}function Ut(e,t,n){t===`number`&&Rt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Wt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Nt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Gt(e,t,n){if(t!=null&&(t=``+Nt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Nt(n)}function Kt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(o(92));if(ne(r)){if(1<r.length)throw Error(o(93));r=r[0]}n=r}n??=``,t=n}n=Nt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),It(e)}function qt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Jt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Yt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Jt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Xt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(o(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&Yt(e,i,r)}else for(var a in t)t.hasOwnProperty(a)&&Yt(e,a,t[a])}function Zt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Qt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),$t=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function en(e){return $t.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function tn(){}var nn=null;function rn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var an=null,on=null;function sn(e){var t=yt(e);if(t&&(e=t.stateNode)){var n=e[ut]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Vt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Bt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[ut]||null;if(!i)throw Error(o(90));Vt(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Lt(r)}break a;case`textarea`:Gt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Wt(e,!!n.multiple,t,!1)}}}var cn=!1;function ln(e,t,n){if(cn)return e(t,n);cn=!0;try{return e(t)}finally{if(cn=!1,(an!==null||on!==null)&&(Nu(),an&&(t=an,e=on,on=an=null,sn(t),e)))for(t=0;t<e.length;t++)sn(e[t])}}function un(e,t){var n=e.stateNode;if(n===null)return null;var r=n[ut]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(o(231,t,typeof n));return n}var dn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),fn=!1;if(dn)try{var pn={};Object.defineProperty(pn,"passive",{get:function(){fn=!0}}),window.addEventListener(`test`,pn,pn),window.removeEventListener(`test`,pn,pn)}catch{fn=!1}var mn=null,hn=null,gn=null;function _n(){if(gn)return gn;var e,t=hn,n=t.length,r,i=`value`in mn?mn.value:mn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return gn=i.slice(e,1<r?1-r:void 0)}function vn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function yn(){return!0}function bn(){return!1}function xn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?yn:bn,this.isPropagationStopped=bn,this}return m(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=yn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=yn)},persist:function(){},isPersistent:yn}),t}var Sn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Cn=xn(Sn),wn=m({},Sn,{view:0,detail:0}),Tn=xn(wn),En,Dn,On,kn=m({},wn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Bn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==On&&(On&&e.type===`mousemove`?(En=e.screenX-On.screenX,Dn=e.screenY-On.screenY):Dn=En=0,On=e),En)},movementY:function(e){return`movementY`in e?e.movementY:Dn}}),An=xn(kn),jn=xn(m({},kn,{dataTransfer:0})),Mn=xn(m({},wn,{relatedTarget:0})),Nn=xn(m({},Sn,{animationName:0,elapsedTime:0,pseudoElement:0})),Pn=xn(m({},Sn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Fn=xn(m({},Sn,{data:0})),In={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Ln={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Rn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function zn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Rn[e])?!!t[e]:!1}function Bn(){return zn}var Vn=xn(m({},wn,{key:function(e){if(e.key){var t=In[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=vn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Ln[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Bn,charCode:function(e){return e.type===`keypress`?vn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?vn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Hn=xn(m({},kn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Un=xn(m({},wn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Bn})),Wn=xn(m({},Sn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Gn=xn(m({},kn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Kn=xn(m({},Sn,{newState:0,oldState:0})),qn=[9,13,27,32],Jn=dn&&`CompositionEvent`in window,Yn=null;dn&&`documentMode`in document&&(Yn=document.documentMode);var Xn=dn&&`TextEvent`in window&&!Yn,Zn=dn&&(!Jn||Yn&&8<Yn&&11>=Yn),Qn=` `,$n=!1;function er(e,t){switch(e){case`keyup`:return qn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function tr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var nr=!1;function rr(e,t){switch(e){case`compositionend`:return tr(t);case`keypress`:return t.which===32?($n=!0,Qn):null;case`textInput`:return e=t.data,e===Qn&&$n?null:e;default:return null}}function ir(e,t){if(nr)return e===`compositionend`||!Jn&&er(e,t)?(e=_n(),gn=hn=mn=null,nr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Zn&&t.locale!==`ko`?null:t.data;default:return null}}var ar={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function or(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!ar[e.type]:t===`textarea`}function sr(e,t,n,r){an?on?on.push(r):on=[r]:an=r,t=Vd(t,`onChange`),0<t.length&&(n=new Cn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var cr=null,lr=null;function ur(e){Nd(e,0)}function dr(e){if(Lt(bt(e)))return e}function fr(e,t){if(e===`change`)return t}var pr=!1;if(dn){var mr;if(dn){var hr=`oninput`in document;if(!hr){var gr=document.createElement(`div`);gr.setAttribute(`oninput`,`return;`),hr=typeof gr.oninput==`function`}mr=hr}else mr=!1;pr=mr&&(!document.documentMode||9<document.documentMode)}function _r(){cr&&(cr.detachEvent(`onpropertychange`,vr),lr=cr=null)}function vr(e){if(e.propertyName===`value`&&dr(lr)){var t=[];sr(t,lr,e,rn(e)),ln(ur,t)}}function yr(e,t,n){e===`focusin`?(_r(),cr=t,lr=n,cr.attachEvent(`onpropertychange`,vr)):e===`focusout`&&_r()}function br(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return dr(lr)}function xr(e,t){if(e===`click`)return dr(t)}function Sr(e,t){if(e===`input`||e===`change`)return dr(t)}function Cr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var wr=typeof Object.is==`function`?Object.is:Cr;function Tr(e,t){if(wr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!we.call(t,i)||!wr(e[i],t[i]))return!1}return!0}function Er(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Dr(e,t){var n=Er(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Er(n)}}function Or(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Or(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function kr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Rt(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Rt(e.document)}return t}function Ar(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var jr=dn&&`documentMode`in document&&11>=document.documentMode,Mr=null,Nr=null,Pr=null,Fr=!1;function Ir(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Fr||Mr==null||Mr!==Rt(r)||(r=Mr,`selectionStart`in r&&Ar(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Pr&&Tr(Pr,r)||(Pr=r,r=Vd(Nr,`onSelect`),0<r.length&&(t=new Cn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Mr)))}function Lr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Rr={animationend:Lr(`Animation`,`AnimationEnd`),animationiteration:Lr(`Animation`,`AnimationIteration`),animationstart:Lr(`Animation`,`AnimationStart`),transitionrun:Lr(`Transition`,`TransitionRun`),transitionstart:Lr(`Transition`,`TransitionStart`),transitioncancel:Lr(`Transition`,`TransitionCancel`),transitionend:Lr(`Transition`,`TransitionEnd`)},zr={},Br={};dn&&(Br=document.createElement(`div`).style,`AnimationEvent`in window||(delete Rr.animationend.animation,delete Rr.animationiteration.animation,delete Rr.animationstart.animation),`TransitionEvent`in window||delete Rr.transitionend.transition);function Vr(e){if(zr[e])return zr[e];if(!Rr[e])return e;var t=Rr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Br)return zr[e]=t[n];return e}var Hr=Vr(`animationend`),Ur=Vr(`animationiteration`),Wr=Vr(`animationstart`),Gr=Vr(`transitionrun`),Kr=Vr(`transitionstart`),qr=Vr(`transitioncancel`),Jr=Vr(`transitionend`),Yr=new Map,Xr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Xr.push(`scrollEnd`);function Zr(e,t){Yr.set(e,t),Tt(t,[e])}var Qr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},$r=[],ei=0,ti=0;function ni(){for(var e=ei,t=ti=ei=0;t<e;){var n=$r[t];$r[t++]=null;var r=$r[t];$r[t++]=null;var i=$r[t];$r[t++]=null;var a=$r[t];if($r[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&oi(n,i,a)}}function ri(e,t,n,r){$r[ei++]=e,$r[ei++]=t,$r[ei++]=n,$r[ei++]=r,ti|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ii(e,t,n,r){return ri(e,t,n,r),si(e)}function ai(e,t){return ri(e,null,null,t),si(e)}function oi(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Ve(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function si(e){if(50<wu)throw wu=0,Tu=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ci={};function li(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ui(e,t,n,r){return new li(e,t,n,r)}function di(e){return e=e.prototype,!(!e||!e.isReactComponent)}function fi(e,t){var n=e.alternate;return n===null?(n=ui(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function pi(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function mi(e,t,n,r,i,a){var s=0;if(r=e,typeof e==`function`)di(e)&&(s=1);else if(typeof e==`string`)s=ap(e,n,le.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case O:return e=ui(31,n,t,i),e.elementType=O,e.lanes=a,e;case v:return hi(n.children,i,a,t);case y:s=8,i|=24;break;case b:return e=ui(12,n,t,i|2),e.elementType=b,e.lanes=a,e;case w:return e=ui(13,n,t,i),e.elementType=w,e.lanes=a,e;case T:return e=ui(19,n,t,i),e.elementType=T,e.lanes=a,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case S:s=10;break a;case x:s=9;break a;case C:s=11;break a;case E:s=14;break a;case D:s=16,r=null;break a}s=29,n=Error(o(130,e===null?`null`:typeof e,``)),r=null}return t=ui(s,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function hi(e,t,n,r){return e=ui(7,e,r,t),e.lanes=n,e}function gi(e,t,n){return e=ui(6,e,null,t),e.lanes=n,e}function _i(e){var t=ui(18,null,null,0);return t.stateNode=e,t}function vi(e,t,n){return t=ui(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var yi=new WeakMap;function bi(e,t){if(typeof e==`object`&&e){var n=yi.get(e);return n===void 0?(t={value:e,source:t,stack:Ce(t)},yi.set(e,t),t):n}return{value:e,source:t,stack:Ce(t)}}var xi=[],Si=0,Ci=null,wi=0,Ti=[],Ei=0,Di=null,Oi=1,ki=``;function Ai(e,t){xi[Si++]=wi,xi[Si++]=Ci,Ci=e,wi=t}function ji(e,t,n){Ti[Ei++]=Oi,Ti[Ei++]=ki,Ti[Ei++]=Di,Di=e;var r=Oi;e=ki;var i=32-Ve(r)-1;r&=~(1<<i),n+=1;var a=32-Ve(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Oi=1<<32-Ve(t)+i|n<<i|r,ki=a+e}else Oi=1<<a|n<<i|r,ki=e}function Mi(e){e.return!==null&&(Ai(e,1),ji(e,1,0))}function Ni(e){for(;e===Ci;)Ci=xi[--Si],xi[Si]=null,wi=xi[--Si],xi[Si]=null;for(;e===Di;)Di=Ti[--Ei],Ti[Ei]=null,ki=Ti[--Ei],Ti[Ei]=null,Oi=Ti[--Ei],Ti[Ei]=null}function Pi(e,t){Ti[Ei++]=Oi,Ti[Ei++]=ki,Ti[Ei++]=Di,Oi=t.id,ki=t.overflow,Di=e}var Fi=null,Ii=null,Li=!1,Ri=null,zi=!1,Bi=Error(o(519));function Vi(e){throw qi(bi(Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Bi}function Hi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[lt]=e,t[ut]=r,n){case`dialog`:Pd(`cancel`,t),Pd(`close`,t);break;case`iframe`:case`object`:case`embed`:Pd(`load`,t);break;case`video`:case`audio`:for(n=0;n<jd.length;n++)Pd(jd[n],t);break;case`source`:Pd(`error`,t);break;case`img`:case`image`:case`link`:Pd(`error`,t),Pd(`load`,t);break;case`details`:Pd(`toggle`,t);break;case`input`:Pd(`invalid`,t),Ht(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Pd(`invalid`,t);break;case`textarea`:Pd(`invalid`,t),Kt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||qd(t.textContent,n)?(r.popover!=null&&(Pd(`beforetoggle`,t),Pd(`toggle`,t)),r.onScroll!=null&&Pd(`scroll`,t),r.onScrollEnd!=null&&Pd(`scrollend`,t),r.onClick!=null&&(t.onclick=tn),t=!0):t=!1,t||Vi(e,!0)}function Ui(e){for(Fi=e.return;Fi;)switch(Fi.tag){case 5:case 31:case 13:zi=!1;return;case 27:case 3:zi=!0;return;default:Fi=Fi.return}}function Wi(e){if(e!==Fi)return!1;if(!Li)return Ui(e),Li=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||of(e.type,e.memoizedProps)),n=!n),n&&Ii&&Vi(e),Ui(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(317));Ii=Ef(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(317));Ii=Ef(e)}else t===27?(t=Ii,mf(e.type)?(e=Tf,Tf=null,Ii=e):Ii=t):Ii=Fi?wf(e.stateNode.nextSibling):null;return!0}function Gi(){Ii=Fi=null,Li=!1}function Ki(){var e=Ri;return e!==null&&(uu===null?uu=e:uu.push.apply(uu,e),Ri=null),e}function qi(e){Ri===null?Ri=[e]:Ri.push(e)}var Ji=oe(null),Yi=null,Xi=null;function Zi(e,t,n){ce(Ji,t._currentValue),t._currentValue=n}function Qi(e){e._currentValue=Ji.current,se(Ji)}function $i(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function ea(e,t,n,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){var s=i.child;a=a.firstContext;a:for(;a!==null;){var c=a;a=i;for(var l=0;l<t.length;l++)if(c.context===t[l]){a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),$i(a.return,n,e),r||(s=null);break a}a=c.next}}else if(i.tag===18){if(s=i.return,s===null)throw Error(o(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),$i(s,n,e),s=null}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===e){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}}function ta(e,t,n,r){e=null;for(var i=t,a=!1;i!==null;){if(!a){if(i.flags&524288)a=!0;else if(i.flags&262144)break}if(i.tag===10){var s=i.alternate;if(s===null)throw Error(o(387));if(s=s.memoizedProps,s!==null){var c=i.type;wr(i.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(i===fe.current){if(s=i.alternate,s===null)throw Error(o(387));s.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e===null?e=[mp]:e.push(mp))}i=i.return}e!==null&&ea(t,e,n,r),t.flags|=262144}function na(e){for(e=e.firstContext;e!==null;){if(!wr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ra(e){Yi=e,Xi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ia(e){return oa(Yi,e)}function aa(e,t){return Yi===null&&ra(e),oa(e,t)}function oa(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Xi===null){if(e===null)throw Error(o(308));Xi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Xi=Xi.next=t;return n}var sa=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},ca=r.unstable_scheduleCallback,la=r.unstable_NormalPriority,ua={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function da(){return{controller:new sa,data:new Map,refCount:0}}function fa(e){e.refCount--,e.refCount===0&&ca(la,function(){e.controller.abort()})}var pa=null,ma=0,ha=0,ga=null;function _a(e,t){if(pa===null){var n=pa=[];ma=0,ha=Td(),ga={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ma++,t.then(va,va),t}function va(){if(--ma===0&&pa!==null){ga!==null&&(ga.status=`fulfilled`);var e=pa;pa=null,ha=0,ga=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ya(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var ba=M.S;M.S=function(e,t){pu=ke(),typeof t==`object`&&t&&typeof t.then==`function`&&_a(e,t),ba!==null&&ba(e,t)};var xa=oe(null);function Sa(){var e=xa.current;return e===null?Jl.pooledCache:e}function Ca(e,t){t===null?ce(xa,xa.current):ce(xa,t.pool)}function wa(){var e=Sa();return e===null?null:{parent:ua._currentValue,pool:e}}var Ta=Error(o(460)),Ea=Error(o(474)),Da=Error(o(542)),Oa={then:function(){}};function ka(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Aa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(tn,tn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Pa(e),e;default:if(typeof t.status==`string`)t.then(tn,tn);else{if(e=Jl,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Pa(e),e}throw Ma=t,Ta}}function ja(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Ma=e,Ta):e}}var Ma=null;function Na(){if(Ma===null)throw Error(o(459));var e=Ma;return Ma=null,e}function Pa(e){if(e===Ta||e===Da)throw Error(o(483))}var Fa=null,Ia=0;function La(e){var t=Ia;return Ia+=1,Fa===null&&(Fa=[]),Aa(Fa,e,t)}function Ra(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function za(e,t){throw t.$$typeof===h?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Ba(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function i(e,t){return e=fi(e,t),e.index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=gi(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function l(e,t,n,r){var a=n.type;return a===v?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===D&&ja(a)===t.type)?(t=i(t,n.props),Ra(t,n),t.return=e,t):(t=mi(n.type,n.key,n.props,null,e.mode,r),Ra(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=vi(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,a){return t===null||t.tag!==7?(t=hi(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=gi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case g:return n=mi(t.type,t.key,t.props,null,e.mode,n),Ra(n,t),n.return=e,n;case _:return t=vi(t,e.mode,n),t.return=e,t;case D:return t=ja(t),f(e,t,n)}if(ne(t)||A(t))return t=hi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,La(t),n);if(t.$$typeof===S)return f(e,aa(e,t),n);za(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case g:return n.key===i?l(e,t,n,r):null;case _:return n.key===i?u(e,t,n,r):null;case D:return n=ja(n),p(e,t,n,r)}if(ne(n)||A(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,La(n),r);if(n.$$typeof===S)return p(e,t,aa(e,n),r);za(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case g:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case _:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case D:return r=ja(r),m(e,t,n,r,i)}if(ne(r)||A(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,La(r),i);if(r.$$typeof===S)return m(e,t,n,aa(t,r),i);za(t,r)}return null}function h(i,o,s,c){for(var l=null,u=null,d=o,h=o=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),o=a(_,o,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Li&&Ai(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(o=a(d,o,h),u===null?l=d:u.sibling=d,u=d);return Li&&Ai(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),o=a(g,o,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Li&&Ai(i,h),l}function y(i,s,c,l){if(c==null)throw Error(o(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=a(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),Li&&Ai(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=a(v,s,g),d===null?u=v:d.sibling=v,d=v);return Li&&Ai(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=a(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),Li&&Ai(i,g),u}function b(e,r,a,c){if(typeof a==`object`&&a&&a.type===v&&a.key===null&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case g:a:{for(var l=a.key;r!==null;){if(r.key===l){if(l=a.type,l===v){if(r.tag===7){n(e,r.sibling),c=i(r,a.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===D&&ja(l)===r.type){n(e,r.sibling),c=i(r,a.props),Ra(c,a),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}a.type===v?(c=hi(a.props.children,e.mode,c,a.key),c.return=e,e=c):(c=mi(a.type,a.key,a.props,null,e.mode,c),Ra(c,a),c.return=e,e=c)}return s(e);case _:a:{for(l=a.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),c=i(r,a.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=vi(a,e.mode,c),c.return=e,e=c}return s(e);case D:return a=ja(a),b(e,r,a,c)}if(ne(a))return h(e,r,a,c);if(A(a)){if(l=A(a),typeof l!=`function`)throw Error(o(150));return a=l.call(a),y(e,r,a,c)}if(typeof a.then==`function`)return b(e,r,La(a),c);if(a.$$typeof===S)return b(e,r,aa(e,a),c);za(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,a),c.return=e,e=c):(n(e,r),c=gi(a,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ia=0;var i=b(e,t,n,r);return Fa=null,i}catch(t){if(t===Ta||t===Da)throw t;var a=ui(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Va=Ba(!0),Ha=Ba(!1),Ua=!1;function Wa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ga(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ka(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function qa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,ql&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=si(e),oi(e,null,n),t}return ri(e,r,t,n),si(e)}function Ja(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,nt(e,n)}}function Ya(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Xa=!1;function Za(){if(Xa){var e=ga;if(e!==null)throw e}}function Qa(e,t,n,r){Xa=!1;var i=e.updateQueue;Ua=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Xl&f)===f:(r&f)===f){f!==0&&f===ha&&(Xa=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=m({},d,f);break a;case 2:Ua=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),iu|=o,e.lanes=o,e.memoizedState=d}}function $a(e,t){if(typeof e!=`function`)throw Error(o(191,e));e.call(t)}function eo(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)$a(n[e],t)}var to=oe(null),no=oe(0);function ro(e,t){e=nu,ce(no,e),ce(to,t),nu=e|t.baseLanes}function io(){ce(no,nu),ce(to,to.current)}function ao(){nu=no.current,se(to),se(no)}var oo=oe(null),so=null;function co(e){var t=e.alternate;ce(mo,mo.current&1),ce(oo,e),so===null&&(t===null||to.current!==null||t.memoizedState!==null)&&(so=e)}function lo(e){ce(mo,mo.current),ce(oo,e),so===null&&(so=e)}function uo(e){e.tag===22?(ce(mo,mo.current),ce(oo,e),so===null&&(so=e)):fo(e)}function fo(){ce(mo,mo.current),ce(oo,oo.current)}function po(e){se(oo),so===e&&(so=null),se(mo)}var mo=oe(0);function ho(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||xf(n)||Sf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var go=0,_o=null,vo=null,yo=null,bo=!1,xo=!1,So=!1,Co=0,wo=0,To=null,Eo=0;function Do(){throw Error(o(321))}function Oo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!wr(e[n],t[n]))return!1;return!0}function ko(e,t,n,r,i,a){return go=a,_o=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,M.H=e===null||e.memoizedState===null?Gs:Ks,So=!1,a=n(r,i),So=!1,xo&&(a=jo(t,n,r,i)),Ao(e),a}function Ao(e){M.H=Ws;var t=vo!==null&&vo.next!==null;if(go=0,yo=vo=_o=null,bo=!1,wo=0,To=null,t)throw Error(o(300));e===null||lc||(e=e.dependencies,e!==null&&na(e)&&(lc=!0))}function jo(e,t,n,r){_o=e;var i=0;do{if(xo&&(To=null),wo=0,xo=!1,25<=i)throw Error(o(301));if(i+=1,yo=vo=null,e.updateQueue!=null){var a=e.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,a.memoCache!=null&&(a.memoCache.index=0)}M.H=qs,a=t(n,r)}while(xo);return a}function Mo(){var e=M.H,t=e.useState()[0];return t=typeof t.then==`function`?zo(t):t,e=e.useState()[0],(vo===null?null:vo.memoizedState)!==e&&(_o.flags|=1024),t}function No(){var e=Co!==0;return Co=0,e}function Po(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Fo(e){if(bo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}bo=!1}go=0,yo=vo=_o=null,xo=!1,wo=Co=0,To=null}function Io(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return yo===null?_o.memoizedState=yo=e:yo=yo.next=e,yo}function Lo(){if(vo===null){var e=_o.alternate;e=e===null?null:e.memoizedState}else e=vo.next;var t=yo===null?_o.memoizedState:yo.next;if(t!==null)yo=t,vo=e;else{if(e===null)throw _o.alternate===null?Error(o(467)):Error(o(310));vo=e,e={memoizedState:vo.memoizedState,baseState:vo.baseState,baseQueue:vo.baseQueue,queue:vo.queue,next:null},yo===null?_o.memoizedState=yo=e:yo=yo.next=e}return yo}function Ro(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function zo(e){var t=wo;return wo+=1,To===null&&(To=[]),e=Aa(To,e,t),t=_o,(yo===null?t.memoizedState:yo.next)===null&&(t=t.alternate,M.H=t===null||t.memoizedState===null?Gs:Ks),e}function Bo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return zo(e);if(e.$$typeof===S)return ia(e)}throw Error(o(438,String(e)))}function Vo(e){var t=null,n=_o.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=_o.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Ro(),_o.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=k;return t.index++,n}function Ho(e,t){return typeof t==`function`?t(e):t}function Uo(e){return Wo(Lo(),vo,e)}function Wo(e,t,n){var r=e.queue;if(r===null)throw Error(o(311));r.lastRenderedReducer=n;var i=e.baseQueue,a=r.pending;if(a!==null){if(i!==null){var s=i.next;i.next=a.next,a.next=s}t.baseQueue=i=a,r.pending=null}if(a=e.baseState,i===null)e.memoizedState=a;else{t=i.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(go&f)===f:(Xl&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===ha&&(d=!0);else if((go&p)===p){u=u.next,p===ha&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=a):l=l.next=f,_o.lanes|=p,iu|=p;f=u.action,So&&n(a,f),a=u.hasEagerState?u.eagerState:n(a,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=a):l=l.next=p,_o.lanes|=f,iu|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=a:l.next=c,!wr(a,e.memoizedState)&&(lc=!0,d&&(n=ga,n!==null)))throw n;e.memoizedState=a,e.baseState=s,e.baseQueue=l,r.lastRenderedState=a}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Go(e){var t=Lo(),n=t.queue;if(n===null)throw Error(o(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,a=t.memoizedState;if(i!==null){n.pending=null;var s=i=i.next;do a=e(a,s.action),s=s.next;while(s!==i);wr(a,t.memoizedState)||(lc=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function Ko(e,t,n){var r=_o,i=Lo(),a=Li;if(a){if(n===void 0)throw Error(o(407));n=n()}else n=t();var s=!wr((vo||i).memoizedState,n);if(s&&(i.memoizedState=n,lc=!0),i=i.queue,_s(Yo.bind(null,r,i,e),[e]),i.getSnapshot!==t||s||yo!==null&&yo.memoizedState.tag&1){if(r.flags|=2048,fs(9,{destroy:void 0},Jo.bind(null,r,i,n,t),null),Jl===null)throw Error(o(349));a||go&127||qo(r,t,n)}return n}function qo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=_o.updateQueue,t===null?(t=Ro(),_o.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Jo(e,t,n,r){t.value=n,t.getSnapshot=r,Xo(t)&&Zo(e)}function Yo(e,t,n){return n(function(){Xo(t)&&Zo(e)})}function Xo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!wr(e,n)}catch{return!0}}function Zo(e){var t=ai(e,2);t!==null&&Ou(t,e,2)}function Qo(e){var t=Io();if(typeof e==`function`){var n=e;if(e=n(),So){Be(!0);try{n()}finally{Be(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ho,lastRenderedState:e},t}function $o(e,t,n,r){return e.baseState=n,Wo(e,vo,typeof r==`function`?r:Ho)}function es(e,t,n,r,i){if(I(e))throw Error(o(485));if(e=t.action,e!==null){var a={payload:i,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){a.listeners.push(e)}};M.T===null?a.isTransition=!1:n(!0),r(a),n=t.pending,n===null?(a.next=t.pending=a,ts(t,a)):(a.next=n.next,t.pending=n.next=a)}}function ts(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=M.T,o={};M.T=o;try{var s=n(i,r),c=M.S;c!==null&&c(o,s),ns(e,t,s)}catch(n){is(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),M.T=a}}else try{a=n(i,r),ns(e,t,a)}catch(n){is(e,t,n)}}function ns(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){rs(e,t,n)},function(n){return is(e,t,n)}):rs(e,t,n)}function rs(e,t,n){t.status=`fulfilled`,t.value=n,as(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,ts(e,n)))}function is(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,as(t),t=t.next;while(t!==r)}e.action=null}function as(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function os(e,t){return t}function ss(e,t){if(Li){var n=Jl.formState;if(n!==null){a:{var r=_o;if(Li){if(Ii){b:{for(var i=Ii,a=zi;i.nodeType!==8;){if(!a){i=null;break b}if(i=wf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Ii=wf(i.nextSibling),r=i.data===`F!`;break a}}Vi(r)}r=!1}r&&(t=n[0])}}return n=Io(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:os,lastRenderedState:t},n.queue=r,n=zs.bind(null,_o,r),r.dispatch=n,r=Qo(!1),a=Vs.bind(null,_o,!1,r.queue),r=Io(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=es.bind(null,_o,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function cs(e){return ls(Lo(),vo,e)}function ls(e,t,n){if(t=Wo(e,t,os)[0],e=Uo(Ho)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=zo(t)}catch(e){throw e===Ta?Da:e}else r=t;t=Lo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(_o.flags|=2048,fs(9,{destroy:void 0},us.bind(null,i,n),null)),[r,a,e]}function us(e,t){e.action=t}function ds(e){var t=Lo(),n=vo;if(n!==null)return ls(t,n,e);Lo(),t=t.memoizedState,n=Lo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function fs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=_o.updateQueue,t===null&&(t=Ro(),_o.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ps(){return Lo().memoizedState}function ms(e,t,n,r){var i=Io();_o.flags|=e,i.memoizedState=fs(1|t,{destroy:void 0},n,r===void 0?null:r)}function hs(e,t,n,r){var i=Lo();r=r===void 0?null:r;var a=i.memoizedState.inst;vo!==null&&r!==null&&Oo(r,vo.memoizedState.deps)?i.memoizedState=fs(t,a,n,r):(_o.flags|=e,i.memoizedState=fs(1|t,a,n,r))}function gs(e,t){ms(8390656,8,e,t)}function _s(e,t){hs(2048,8,e,t)}function vs(e){_o.flags|=4;var t=_o.updateQueue;if(t===null)t=Ro(),_o.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ys(e){var t=Lo().memoizedState;return vs({ref:t,nextImpl:e}),function(){if(ql&2)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function bs(e,t){return hs(4,2,e,t)}function xs(e,t){return hs(4,4,e,t)}function Ss(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Cs(e,t,n){n=n==null?null:n.concat([e]),hs(4,4,Ss.bind(null,t,e),n)}function ws(){}function Ts(e,t){var n=Lo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Oo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Es(e,t){var n=Lo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Oo(t,r[1]))return r[0];if(r=e(),So){Be(!0);try{e()}finally{Be(!1)}}return n.memoizedState=[r,t],r}function Ds(e,t,n){return n===void 0||go&1073741824&&!(Xl&261930)?e.memoizedState=t:(e.memoizedState=n,e=Du(),_o.lanes|=e,iu|=e,n)}function Os(e,t,n,r){return wr(n,t)?n:to.current===null?!(go&42)||go&1073741824&&!(Xl&261930)?(lc=!0,e.memoizedState=n):(e=Du(),_o.lanes|=e,iu|=e,t):(e=Ds(e,n,r),wr(e,t)||(lc=!0),e)}function ks(e,t,n,r,i){var a=N.p;N.p=a!==0&&8>a?a:8;var o=M.T,s={};M.T=s,Vs(e,!1,t,n);try{var c=i(),l=M.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Bs(e,t,ya(c,r),Eu(e)):Bs(e,t,r,Eu(e))}catch(n){Bs(e,t,{then:function(){},status:`rejected`,reason:n},Eu())}finally{N.p=a,o!==null&&s.types!==null&&(o.types=s.types),M.T=o}}function As(){}function js(e,t,n,r){if(e.tag!==5)throw Error(o(476));var i=Ms(e).queue;ks(e,i,t,re,n===null?As:function(){return Ns(e),n(r)})}function Ms(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ho,lastRenderedState:re},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ho,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ns(e){var t=Ms(e);t.next===null&&(t=e.alternate.memoizedState),Bs(e,t.next.queue,{},Eu())}function Ps(){return ia(mp)}function Fs(){return Lo().memoizedState}function Is(){return Lo().memoizedState}function Ls(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Eu();e=Ka(n);var r=qa(t,e,n);r!==null&&(Ou(r,t,n),Ja(r,t,n)),t={cache:da()},e.payload=t;return}t=t.return}}function Rs(e,t,n){var r=Eu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},I(e)?Hs(t,n):(n=ii(e,t,n,r),n!==null&&(Ou(n,e,r),Us(n,t,r)))}function zs(e,t,n){Bs(e,t,n,Eu())}function Bs(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(I(e))Hs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,wr(s,o))return ri(e,t,i,0),Jl===null&&ni(),!1}catch{}if(n=ii(e,t,i,r),n!==null)return Ou(n,e,r),Us(n,t,r),!0}return!1}function Vs(e,t,n,r){if(r={lane:2,revertLane:Td(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},I(e)){if(t)throw Error(o(479))}else t=ii(e,n,r,2),t!==null&&Ou(t,e,2)}function I(e){var t=e.alternate;return e===_o||t!==null&&t===_o}function Hs(e,t){xo=bo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Us(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,nt(e,n)}}var Ws={readContext:ia,use:Bo,useCallback:Do,useContext:Do,useEffect:Do,useImperativeHandle:Do,useLayoutEffect:Do,useInsertionEffect:Do,useMemo:Do,useReducer:Do,useRef:Do,useState:Do,useDebugValue:Do,useDeferredValue:Do,useTransition:Do,useSyncExternalStore:Do,useId:Do,useHostTransitionStatus:Do,useFormState:Do,useActionState:Do,useOptimistic:Do,useMemoCache:Do,useCacheRefresh:Do};Ws.useEffectEvent=Do;var Gs={readContext:ia,use:Bo,useCallback:function(e,t){return Io().memoizedState=[e,t===void 0?null:t],e},useContext:ia,useEffect:gs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ms(4194308,4,Ss.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ms(4194308,4,e,t)},useInsertionEffect:function(e,t){ms(4,2,e,t)},useMemo:function(e,t){var n=Io();t=t===void 0?null:t;var r=e();if(So){Be(!0);try{e()}finally{Be(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Io();if(n!==void 0){var i=n(t);if(So){Be(!0);try{n(t)}finally{Be(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Rs.bind(null,_o,e),[r.memoizedState,e]},useRef:function(e){var t=Io();return e={current:e},t.memoizedState=e},useState:function(e){e=Qo(e);var t=e.queue,n=zs.bind(null,_o,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:ws,useDeferredValue:function(e,t){return Ds(Io(),e,t)},useTransition:function(){var e=Qo(!1);return e=ks.bind(null,_o,e.queue,!0,!1),Io().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=_o,i=Io();if(Li){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),Jl===null)throw Error(o(349));Xl&127||qo(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,gs(Yo.bind(null,r,a,e),[e]),r.flags|=2048,fs(9,{destroy:void 0},Jo.bind(null,r,a,n,t),null),n},useId:function(){var e=Io(),t=Jl.identifierPrefix;if(Li){var n=ki,r=Oi;n=(r&~(1<<32-Ve(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Co++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Eo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Ps,useFormState:ss,useActionState:ss,useOptimistic:function(e){var t=Io();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Vs.bind(null,_o,!0,n),n.dispatch=t,[e,t]},useMemoCache:Vo,useCacheRefresh:function(){return Io().memoizedState=Ls.bind(null,_o)},useEffectEvent:function(e){var t=Io(),n={impl:e};return t.memoizedState=n,function(){if(ql&2)throw Error(o(440));return n.impl.apply(void 0,arguments)}}},Ks={readContext:ia,use:Bo,useCallback:Ts,useContext:ia,useEffect:_s,useImperativeHandle:Cs,useInsertionEffect:bs,useLayoutEffect:xs,useMemo:Es,useReducer:Uo,useRef:ps,useState:function(){return Uo(Ho)},useDebugValue:ws,useDeferredValue:function(e,t){return Os(Lo(),vo.memoizedState,e,t)},useTransition:function(){var e=Uo(Ho)[0],t=Lo().memoizedState;return[typeof e==`boolean`?e:zo(e),t]},useSyncExternalStore:Ko,useId:Fs,useHostTransitionStatus:Ps,useFormState:cs,useActionState:cs,useOptimistic:function(e,t){return $o(Lo(),vo,e,t)},useMemoCache:Vo,useCacheRefresh:Is};Ks.useEffectEvent=ys;var qs={readContext:ia,use:Bo,useCallback:Ts,useContext:ia,useEffect:_s,useImperativeHandle:Cs,useInsertionEffect:bs,useLayoutEffect:xs,useMemo:Es,useReducer:Go,useRef:ps,useState:function(){return Go(Ho)},useDebugValue:ws,useDeferredValue:function(e,t){var n=Lo();return vo===null?Ds(n,e,t):Os(n,vo.memoizedState,e,t)},useTransition:function(){var e=Go(Ho)[0],t=Lo().memoizedState;return[typeof e==`boolean`?e:zo(e),t]},useSyncExternalStore:Ko,useId:Fs,useHostTransitionStatus:Ps,useFormState:ds,useActionState:ds,useOptimistic:function(e,t){var n=Lo();return vo===null?(n.baseState=e,[e,n.queue.dispatch]):$o(n,vo,e,t)},useMemoCache:Vo,useCacheRefresh:Is};qs.useEffectEvent=ys;function Js(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:m({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ys={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Eu(),i=Ka(r);i.payload=t,n!=null&&(i.callback=n),t=qa(e,i,r),t!==null&&(Ou(t,e,r),Ja(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Eu(),i=Ka(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=qa(e,i,r),t!==null&&(Ou(t,e,r),Ja(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Eu(),r=Ka(n);r.tag=2,t!=null&&(r.callback=t),t=qa(e,r,n),t!==null&&(Ou(t,e,n),Ja(t,e,n))}};function Xs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Tr(n,r)||!Tr(i,a):!0}function Zs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Ys.enqueueReplaceState(t,t.state,null)}function Qs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=m({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function $s(e){Qr(e)}function ec(e){console.error(e)}function tc(e){Qr(e)}function nc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function rc(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function ic(e,t,n){return n=Ka(n),n.tag=3,n.payload={element:null},n.callback=function(){nc(e,t)},n}function ac(e){return e=Ka(e),e.tag=3,e}function oc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){rc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){rc(t,n,r),typeof i!=`function`&&(gu===null?gu=new Set([this]):gu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function sc(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&ta(t,n,i,!0),n=oo.current,n!==null){switch(n.tag){case 31:case 13:return so===null?Bu():n.alternate===null&&ru===0&&(ru=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===Oa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),ad(e,r,i)),!1;case 22:return n.flags|=65536,r===Oa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),ad(e,r,i)),!1}throw Error(o(435,n.tag))}return ad(e,r,i),Bu(),!1}if(Li)return t=oo.current,t===null?(r!==Bi&&(t=Error(o(423),{cause:r}),qi(bi(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=bi(r,n),i=ic(e.stateNode,r,i),Ya(e,i),ru!==4&&(ru=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==Bi&&(e=Error(o(422),{cause:r}),qi(bi(e,n)))),!1;var a=Error(o(520),{cause:r});if(a=bi(a,n),lu===null?lu=[a]:lu.push(a),ru!==4&&(ru=2),t===null)return!0;r=bi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=ic(n.stateNode,r,e),Ya(n,e),!1;case 1:if(t=n.type,a=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||a!==null&&typeof a.componentDidCatch==`function`&&(gu===null||!gu.has(a))))return n.flags|=65536,i&=-i,n.lanes|=i,i=ac(i),oc(i,e,n,r),Ya(n,i),!1}n=n.return}while(n!==null);return!1}var cc=Error(o(461)),lc=!1;function uc(e,t,n,r){t.child=e===null?Ha(t,null,n,r):Va(t,e.child,n,r)}function dc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return ra(t),r=ko(e,t,n,o,a,i),s=No(),e!==null&&!lc?(Po(e,t,i),Fc(e,t,i)):(Li&&s&&Mi(t),t.flags|=1,uc(e,t,r,i),t.child)}function fc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!di(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,pc(e,t,a,r,i)):(e=mi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Ic(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Tr:n,n(o,r)&&e.ref===t.ref)return Fc(e,t,i)}return t.flags|=1,e=fi(a,r),e.ref=t.ref,e.return=t,t.child=e}function pc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Tr(a,r)&&e.ref===t.ref)if(lc=!1,t.pendingProps=r=a,Ic(e,i))e.flags&131072&&(lc=!0);else return t.lanes=e.lanes,Fc(e,t,i)}return xc(e,t,n,r,i)}function mc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return gc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ca(t,a===null?null:a.cachePool),a===null?io():ro(t,a),uo(t);else return r=t.lanes=536870912,gc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Ca(t,null),io(),fo(t)):(Ca(t,a.cachePool),ro(t,a),fo(t),t.memoizedState=null);return uc(e,t,i,n),t.child}function hc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function gc(e,t,n,r,i){var a=Sa();return a=a===null?null:{parent:ua._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Ca(t,null),io(),uo(t),e!==null&&ta(e,t,r,!0),t.childLanes=i,null}function _c(e,t){return t=Ac({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function vc(e,t,n){return Va(t,e.child,null,n),e=_c(t,t.pendingProps),e.flags|=2,po(t),t.memoizedState=null,e}function yc(e,t,n){var r=t.pendingProps,i=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(Li){if(r.mode===`hidden`)return e=_c(t,r),t.lanes=536870912,hc(null,e);if(lo(t),(e=Ii)?(e=bf(e,zi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Di===null?null:{id:Oi,overflow:ki},retryLane:536870912,hydrationErrors:null},n=_i(e),n.return=t,t.child=n,Fi=t,Ii=null)):e=null,e===null)throw Vi(t);return t.lanes=536870912,null}return _c(t,r)}var a=e.memoizedState;if(a!==null){var s=a.dehydrated;if(lo(t),i)if(t.flags&256)t.flags&=-257,t=vc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(lc||ta(e,t,n,!1),i=(n&e.childLanes)!==0,lc||i){if(r=Jl,r!==null&&(s=rt(r,n),s!==0&&s!==a.retryLane))throw a.retryLane=s,ai(e,s),Ou(r,e,s),cc;Bu(),t=vc(e,t,n)}else e=a.treeContext,Ii=wf(s.nextSibling),Fi=t,Li=!0,Ri=null,zi=!1,e!==null&&Pi(t,e),t=_c(t,r),t.flags|=4096;return t}return e=fi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function bc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(o(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function xc(e,t,n,r,i){return ra(t),n=ko(e,t,n,r,void 0,i),r=No(),e!==null&&!lc?(Po(e,t,i),Fc(e,t,i)):(Li&&r&&Mi(t),t.flags|=1,uc(e,t,n,i),t.child)}function Sc(e,t,n,r,i,a){return ra(t),t.updateQueue=null,n=jo(t,r,n,i),Ao(e),r=No(),e!==null&&!lc?(Po(e,t,a),Fc(e,t,a)):(Li&&r&&Mi(t),t.flags|=1,uc(e,t,n,a),t.child)}function Cc(e,t,n,r,i){if(ra(t),t.stateNode===null){var a=ci,o=n.contextType;typeof o==`object`&&o&&(a=ia(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Ys,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Wa(t),o=n.contextType,a.context=typeof o==`object`&&o?ia(o):ci,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Js(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Ys.enqueueReplaceState(a,a.state,null),Qa(t,r,a,i),Za(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Qs(n,s);a.props=c;var l=a.context,u=n.contextType;o=ci,typeof u==`object`&&u&&(o=ia(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Zs(t,a,r,o),Ua=!1;var f=t.memoizedState;a.state=f,Qa(t,r,a,i),Za(),l=t.memoizedState,s||f!==l||Ua?(typeof d==`function`&&(Js(t,n,d,r),l=t.memoizedState),(c=Ua||Xs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Ga(e,t),o=t.memoizedProps,u=Qs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ci,typeof l==`object`&&l&&(c=ia(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Zs(t,a,r,c),Ua=!1,f=t.memoizedState,a.state=f,Qa(t,r,a,i),Za();var p=t.memoizedState;o!==d||f!==p||Ua||e!==null&&e.dependencies!==null&&na(e.dependencies)?(typeof s==`function`&&(Js(t,n,s,r),p=t.memoizedState),(u=Ua||Xs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&na(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,bc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Va(t,e.child,null,i),t.child=Va(t,null,n,i)):uc(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Fc(e,t,i),e}function wc(e,t,n,r){return Gi(),t.flags|=256,uc(e,t,n,r),t.child}var Tc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ec(e){return{baseLanes:e,cachePool:wa()}}function Dc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=su),e}function Oc(e,t,n){var r=t.pendingProps,i=!1,a=(t.flags&128)!=0,s;if((s=a)||(s=e!==null&&e.memoizedState===null?!1:(mo.current&2)!=0),s&&(i=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(Li){if(i?co(t):fo(t),(e=Ii)?(e=bf(e,zi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Di===null?null:{id:Oi,overflow:ki},retryLane:536870912,hydrationErrors:null},n=_i(e),n.return=t,t.child=n,Fi=t,Ii=null)):e=null,e===null)throw Vi(t);return Sf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,i?(fo(t),i=t.mode,c=Ac({mode:`hidden`,children:c},i),r=hi(r,i,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=Ec(n),r.childLanes=Dc(e,s,n),t.memoizedState=Tc,hc(null,r)):(co(t),kc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(a)t.flags&256?(co(t),t.flags&=-257,t=jc(e,t,n)):t.memoizedState===null?(fo(t),c=r.fallback,i=t.mode,r=Ac({mode:`visible`,children:r.children},i),c=hi(c,i,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Va(t,e.child,null,n),r=t.child,r.memoizedState=Ec(n),r.childLanes=Dc(e,s,n),t.memoizedState=Tc,t=hc(null,r)):(fo(t),t.child=e.child,t.flags|=128,t=null);else if(co(t),Sf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(o(419)),r.stack=``,r.digest=s,qi({value:r,source:null,stack:null}),t=jc(e,t,n)}else if(lc||ta(e,t,n,!1),s=(n&e.childLanes)!==0,lc||s){if(s=Jl,s!==null&&(r=rt(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ai(e,r),Ou(s,e,r),cc;xf(c)||Bu(),t=jc(e,t,n)}else xf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ii=wf(c.nextSibling),Fi=t,Li=!0,Ri=null,zi=!1,e!==null&&Pi(t,e),t=kc(t,r.children),t.flags|=4096);return t}return i?(fo(t),c=r.fallback,i=t.mode,l=e.child,u=l.sibling,r=fi(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=hi(c,i,n,null),c.flags|=2):c=fi(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,hc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=Ec(n):(i=c.cachePool,i===null?i=wa():(l=ua._currentValue,i=i.parent===l?i:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:i}),r.memoizedState=c,r.childLanes=Dc(e,s,n),t.memoizedState=Tc,hc(e.child,r)):(co(t),n=e.child,e=n.sibling,n=fi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function kc(e,t){return t=Ac({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Ac(e,t){return e=ui(22,e,null,t),e.lanes=0,e}function jc(e,t,n){return Va(t,e.child,null,n),e=kc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Mc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),$i(e.return,t,n)}function Nc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Pc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=mo.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,ce(mo,o),uc(e,t,r,n),r=Li?wi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Mc(e,n,t);else if(e.tag===19)Mc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&ho(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Nc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&ho(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Nc(t,!0,n,null,a,r);break;case`together`:Nc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Fc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),iu|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(ta(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,n=fi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=fi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Ic(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&na(e))):!0}function Lc(e,t,n){switch(t.tag){case 3:pe(t,t.stateNode.containerInfo),Zi(t,ua,e.memoizedState.cache),Gi();break;case 27:case 5:he(t);break;case 4:pe(t,t.stateNode.containerInfo);break;case 10:Zi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,lo(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(co(t),e=Fc(e,t,n),e===null?null:e.sibling):Oc(e,t,n):(co(t),t.flags|=128,null);co(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(ta(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Pc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ce(mo,mo.current),r)break;return null;case 22:return t.lanes=0,mc(e,t,n,t.pendingProps);case 24:Zi(t,ua,e.memoizedState.cache)}return Fc(e,t,n)}function Rc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)lc=!0;else{if(!Ic(e,n)&&!(t.flags&128))return lc=!1,Lc(e,t,n);lc=!!(e.flags&131072)}else lc=!1,Li&&t.flags&1048576&&ji(t,wi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=ja(t.elementType),t.type=e,typeof e==`function`)di(e)?(r=Qs(e,r),t.tag=1,t=Cc(null,t,e,r,n)):(t.tag=0,t=xc(null,t,e,r,n));else{if(e!=null){var i=e.$$typeof;if(i===C){t.tag=11,t=dc(null,t,e,r,n);break a}else if(i===E){t.tag=14,t=fc(null,t,e,r,n);break a}}throw t=te(e)||e,Error(o(306,t,``))}}return t;case 0:return xc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,i=Qs(r,t.pendingProps),Cc(e,t,r,i,n);case 3:a:{if(pe(t,t.stateNode.containerInfo),e===null)throw Error(o(387));r=t.pendingProps;var a=t.memoizedState;i=a.element,Ga(e,t),Qa(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Zi(t,ua,r),r!==a.cache&&ea(t,[ua],n,!0),Za(),r=s.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=wc(e,t,r,n);break a}else if(r!==i){i=bi(Error(o(424)),t),qi(i),t=wc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Ii=wf(e.firstChild),Fi=t,Li=!0,Ri=null,zi=!0,n=Ha(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Gi(),r===i){t=Fc(e,t,n);break a}uc(e,t,r,n)}t=t.child}return t;case 26:return bc(e,t),e===null?(n=Gf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Li||(n=t.type,e=t.pendingProps,r=nf(de.current).createElement(n),r[lt]=t,r[ut]=e,Xd(r,n,e),St(r),t.stateNode=r):t.memoizedState=Gf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return he(t),e===null&&Li&&(r=t.stateNode=Of(t.type,t.pendingProps,de.current),Fi=t,zi=!0,i=Ii,mf(t.type)?(Tf=i,Ii=wf(r.firstChild)):Ii=i),uc(e,t,t.pendingProps.children,n),bc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Li&&((i=r=Ii)&&(r=vf(r,t.type,t.pendingProps,zi),r===null?i=!1:(t.stateNode=r,Fi=t,Ii=wf(r.firstChild),zi=!1,i=!0)),i||Vi(t)),he(t),i=t.type,a=t.pendingProps,s=e===null?null:e.memoizedProps,r=a.children,of(i,a)?r=null:s!==null&&of(i,s)&&(t.flags|=32),t.memoizedState!==null&&(i=ko(e,t,Mo,null,null,n),mp._currentValue=i),bc(e,t),uc(e,t,r,n),t.child;case 6:return e===null&&Li&&((e=n=Ii)&&(n=yf(n,t.pendingProps,zi),n===null?e=!1:(t.stateNode=n,Fi=t,Ii=null,e=!0)),e||Vi(t)),null;case 13:return Oc(e,t,n);case 4:return pe(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Va(t,null,r,n):uc(e,t,r,n),t.child;case 11:return dc(e,t,t.type,t.pendingProps,n);case 7:return uc(e,t,t.pendingProps,n),t.child;case 8:return uc(e,t,t.pendingProps.children,n),t.child;case 12:return uc(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Zi(t,t.type,r.value),uc(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,ra(t),i=ia(i),r=r(i),t.flags|=1,uc(e,t,r,n),t.child;case 14:return fc(e,t,t.type,t.pendingProps,n);case 15:return pc(e,t,t.type,t.pendingProps,n);case 19:return Pc(e,t,n);case 31:return yc(e,t,n);case 22:return mc(e,t,n,t.pendingProps);case 24:return ra(t),r=ia(ua),e===null?(i=Sa(),i===null&&(i=Jl,a=da(),i.pooledCache=a,a.refCount++,a!==null&&(i.pooledCacheLanes|=n),i=a),t.memoizedState={parent:r,cache:i},Wa(t),Zi(t,ua,i)):((e.lanes&n)!==0&&(Ga(e,t),Qa(t,null,null,n),Za()),i=e.memoizedState,a=t.memoizedState,i.parent===r?(r=a.cache,Zi(t,ua,r),r!==i.cache&&ea(t,[ua],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),Zi(t,ua,r))),uc(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function zc(e){e.flags|=4}function Bc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Lu())e.flags|=8192;else throw Ma=Oa,Ea}else e.flags&=-16777217}function Vc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!op(t))if(Lu())e.flags|=8192;else throw Ma=Oa,Ea}function Hc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ze(),e.lanes|=t,cu|=t)}function Uc(e,t){if(!Li)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Wc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Gc(e,t,n){var r=t.pendingProps;switch(Ni(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wc(t),null;case 1:return Wc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Qi(ua),me(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Wi(t)?zc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ki())),Wc(t),null;case 26:var i=t.type,a=t.memoizedState;return e===null?(zc(t),a===null?(Wc(t),Bc(t,i,null,r,n)):(Wc(t),Vc(t,a))):a?a===e.memoizedState?(Wc(t),t.flags&=-16777217):(zc(t),Wc(t),Vc(t,a)):(e=e.memoizedProps,e!==r&&zc(t),Wc(t),Bc(t,i,e,r,n)),null;case 27:if(ge(t),n=de.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&zc(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return Wc(t),null}e=le.current,Wi(t)?Hi(t,e):(e=Of(i,r,n),t.stateNode=e,zc(t))}return Wc(t),null;case 5:if(ge(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&zc(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return Wc(t),null}if(a=le.current,Wi(t))Hi(t,a);else{var s=nf(de.current);switch(a){case 1:a=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case 2:a=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;default:switch(i){case`svg`:a=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case`math`:a=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;case`script`:a=s.createElement(`div`),a.innerHTML=`<script><\/script>`,a=a.removeChild(a.firstChild);break;case`select`:a=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}a[lt]=t,a[ut]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)a.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=a;a:switch(Xd(a,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&zc(t)}}return Wc(t),Bc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&zc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(o(166));if(e=de.current,Wi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Fi,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[lt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||qd(e.nodeValue,n)),e||Vi(t,!0)}else e=nf(e).createTextNode(r),e[lt]=t,t.stateNode=e}return Wc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Wi(t),n!==null){if(e===null){if(!r)throw Error(o(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(557));e[lt]=t}else Gi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Wc(t),e=!1}else n=Ki(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(po(t),t):(po(t),null);if(t.flags&128)throw Error(o(558))}return Wc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Wi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(o(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(o(317));i[lt]=t}else Gi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Wc(t),i=!1}else i=Ki(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(po(t),t):(po(t),null)}return po(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Hc(t,t.updateQueue),Wc(t),null);case 4:return me(),e===null&&Ld(t.stateNode.containerInfo),Wc(t),null;case 10:return Qi(t.type),Wc(t),null;case 19:if(se(mo),r=t.memoizedState,r===null)return Wc(t),null;if(i=(t.flags&128)!=0,a=r.rendering,a===null)if(i)Uc(r,!1);else{if(ru!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=ho(e),a!==null){for(t.flags|=128,Uc(r,!1),e=a.updateQueue,t.updateQueue=e,Hc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)pi(n,e),n=n.sibling;return ce(mo,mo.current&1|2),Li&&Ai(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ke()>mu&&(t.flags|=128,i=!0,Uc(r,!1),t.lanes=4194304)}else{if(!i)if(e=ho(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Hc(t,e),Uc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!a.alternate&&!Li)return Wc(t),null}else 2*ke()-r.renderingStartTime>mu&&n!==536870912&&(t.flags|=128,i=!0,Uc(r,!1),t.lanes=4194304);r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e===null?t.child=a:e.sibling=a,r.last=a)}return r.tail===null?(Wc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ke(),e.sibling=null,n=mo.current,ce(mo,i?n&1|2:n&1),Li&&Ai(t,r.treeForkCount),e);case 22:case 23:return po(t),ao(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Wc(t),t.subtreeFlags&6&&(t.flags|=8192)):Wc(t),n=t.updateQueue,n!==null&&Hc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&se(xa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Qi(ua),Wc(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function Kc(e,t){switch(Ni(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Qi(ua),me(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ge(t),null;case 31:if(t.memoizedState!==null){if(po(t),t.alternate===null)throw Error(o(340));Gi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(po(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Gi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return se(mo),null;case 4:return me(),null;case 10:return Qi(t.type),null;case 22:case 23:return po(t),ao(),e!==null&&se(xa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Qi(ua),null;case 25:return null;default:return null}}function qc(e,t){switch(Ni(t),t.tag){case 3:Qi(ua),me();break;case 26:case 27:case 5:ge(t);break;case 4:me();break;case 31:t.memoizedState!==null&&po(t);break;case 13:po(t);break;case 19:se(mo);break;case 10:Qi(t.type);break;case 22:case 23:po(t),ao(),e!==null&&se(xa);break;case 24:Qi(ua)}}function Jc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){id(t,t.return,e)}}function Yc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){id(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){id(t,t.return,e)}}function Xc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{eo(t,n)}catch(t){id(e,e.return,t)}}}function Zc(e,t,n){n.props=Qs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){id(e,t,n)}}function Qc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){id(e,t,n)}}function $c(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){id(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){id(e,t,n)}else n.current=null}function el(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){id(e,e.return,t)}}function tl(e,t,n){try{var r=e.stateNode;Zd(r,e.type,n,t),r[ut]=t}catch(t){id(e,e.return,t)}}function nl(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&mf(e.type)||e.tag===4}function rl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||nl(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&mf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function il(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=tn));else if(r!==4&&(r===27&&mf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(il(e,t,n),e=e.sibling;e!==null;)il(e,t,n),e=e.sibling}function al(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&mf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(al(e,t,n),e=e.sibling;e!==null;)al(e,t,n),e=e.sibling}function ol(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Xd(t,r,n),t[lt]=e,t[ut]=n}catch(t){id(e,e.return,t)}}var sl=!1,cl=!1,ll=!1,ul=typeof WeakSet==`function`?WeakSet:Set,dl=null;function fl(e,t){if(e=e.containerInfo,ef=Cp,e=kr(e),Ar(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=s+i),f!==a||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=s),p===a&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(tf={focusedElem:e,selectionRange:n},Cp=!1,dl=t;dl!==null;)if(t=dl,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,dl=e;else for(;dl!==null;){switch(t=dl,a=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)i=e[n],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&a!==null){e=void 0,n=t,i=a.memoizedProps,a=a.memoizedState,r=n.stateNode;try{var h=Qs(n.type,i);e=r.getSnapshotBeforeUpdate(h,a),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){id(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)_f(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:_f(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,dl=e;break}dl=t.return}}function pl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Ol(e,n),r&4&&Jc(5,n);break;case 1:if(Ol(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){id(n,n.return,e)}else{var i=Qs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){id(n,n.return,e)}}r&64&&Xc(n),r&512&&Qc(n,n.return);break;case 3:if(Ol(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{eo(e,t)}catch(e){id(n,n.return,e)}}break;case 27:t===null&&r&4&&ol(n);case 26:case 5:Ol(e,n),t===null&&r&4&&el(n),r&512&&Qc(n,n.return);break;case 12:Ol(e,n);break;case 31:Ol(e,n),r&4&&yl(e,n);break;case 13:Ol(e,n),r&4&&bl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=cd.bind(null,n),Cf(e,n))));break;case 22:if(r=n.memoizedState!==null||sl,!r){t=t!==null&&t.memoizedState!==null||cl,i=sl;var a=cl;sl=r,(cl=t)&&!a?Al(e,n,(n.subtreeFlags&8772)!=0):Ol(e,n),sl=i,cl=a}break;case 30:break;default:Ol(e,n)}}function ml(e){var t=e.alternate;t!==null&&(e.alternate=null,ml(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&_t(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var hl=null,gl=!1;function _l(e,t,n){for(n=n.child;n!==null;)vl(e,t,n),n=n.sibling}function vl(e,t,n){if(ze&&typeof ze.onCommitFiberUnmount==`function`)try{ze.onCommitFiberUnmount(Re,n)}catch{}switch(n.tag){case 26:cl||$c(n,t),_l(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:cl||$c(n,t);var r=hl,i=gl;mf(n.type)&&(hl=n.stateNode,gl=!1),_l(e,t,n),kf(n.stateNode),hl=r,gl=i;break;case 5:cl||$c(n,t);case 6:if(r=hl,i=gl,hl=null,_l(e,t,n),hl=r,gl=i,hl!==null)if(gl)try{(hl.nodeType===9?hl.body:hl.nodeName===`HTML`?hl.ownerDocument.body:hl).removeChild(n.stateNode)}catch(e){id(n,t,e)}else try{hl.removeChild(n.stateNode)}catch(e){id(n,t,e)}break;case 18:hl!==null&&(gl?(e=hl,hf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Yp(e)):hf(hl,n.stateNode));break;case 4:r=hl,i=gl,hl=n.stateNode.containerInfo,gl=!0,_l(e,t,n),hl=r,gl=i;break;case 0:case 11:case 14:case 15:Yc(2,n,t),cl||Yc(4,n,t),_l(e,t,n);break;case 1:cl||($c(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Zc(n,t,r)),_l(e,t,n);break;case 21:_l(e,t,n);break;case 22:cl=(r=cl)||n.memoizedState!==null,_l(e,t,n),cl=r;break;default:_l(e,t,n)}}function yl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Yp(e)}catch(e){id(t,t.return,e)}}}function bl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Yp(e)}catch(e){id(t,t.return,e)}}function xl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new ul),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new ul),t;default:throw Error(o(435,e.tag))}}function Sl(e,t){var n=xl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=ld.bind(null,e,t);t.then(r,r)}})}function Cl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r],a=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(mf(c.type)){hl=c.stateNode,gl=!1;break a}break;case 5:hl=c.stateNode,gl=!1;break a;case 3:case 4:hl=c.stateNode.containerInfo,gl=!0;break a}c=c.return}if(hl===null)throw Error(o(160));vl(a,s,i),hl=null,gl=!1,a=i.alternate,a!==null&&(a.return=null),i.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Tl(t,e),t=t.sibling}var wl=null;function Tl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Cl(t,e),El(e),r&4&&(Yc(3,e,e.return),Jc(3,e),Yc(5,e,e.return));break;case 1:Cl(t,e),El(e),r&512&&(cl||n===null||$c(n,n.return)),r&64&&sl&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var i=wl;if(Cl(t,e),El(e),r&512&&(cl||n===null||$c(n,n.return)),r&4){var a=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,i=i.ownerDocument||i;b:switch(r){case`title`:a=i.getElementsByTagName(`title`)[0],(!a||a[gt]||a[lt]||a.namespaceURI===`http://www.w3.org/2000/svg`||a.hasAttribute(`itemprop`))&&(a=i.createElement(r),i.head.insertBefore(a,i.querySelector(`head > title`))),Xd(a,r,n),a[lt]=e,St(a),r=a;break a;case`link`:var s=rp(`link`,`href`,i).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(a=s[c],a.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&a.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&a.getAttribute(`title`)===(n.title==null?null:n.title)&&a.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}a=i.createElement(r),Xd(a,r,n),i.head.appendChild(a);break;case`meta`:if(s=rp(`meta`,`content`,i).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(a=s[c],a.getAttribute(`content`)===(n.content==null?null:``+n.content)&&a.getAttribute(`name`)===(n.name==null?null:n.name)&&a.getAttribute(`property`)===(n.property==null?null:n.property)&&a.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&a.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}a=i.createElement(r),Xd(a,r,n),i.head.appendChild(a);break;default:throw Error(o(468,r))}a[lt]=e,St(a),r=a}e.stateNode=r}else ip(i,e.type,e.stateNode);else e.stateNode=Qf(i,r,e.memoizedProps);else a===r?r===null&&e.stateNode!==null&&tl(e,e.memoizedProps,n.memoizedProps):(a===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):a.count--,r===null?ip(i,e.type,e.stateNode):Qf(i,r,e.memoizedProps))}break;case 27:Cl(t,e),El(e),r&512&&(cl||n===null||$c(n,n.return)),n!==null&&r&4&&tl(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Cl(t,e),El(e),r&512&&(cl||n===null||$c(n,n.return)),e.flags&32){i=e.stateNode;try{qt(i,``)}catch(t){id(e,e.return,t)}}r&4&&e.stateNode!=null&&(i=e.memoizedProps,tl(e,i,n===null?i:n.memoizedProps)),r&1024&&(ll=!0);break;case 6:if(Cl(t,e),El(e),r&4){if(e.stateNode===null)throw Error(o(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){id(e,e.return,t)}}break;case 3:if(np=null,i=wl,wl=Mf(t.containerInfo),Cl(t,e),wl=i,El(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Yp(t.containerInfo)}catch(t){id(e,e.return,t)}ll&&(ll=!1,Dl(e));break;case 4:r=wl,wl=Mf(e.stateNode.containerInfo),Cl(t,e),El(e),wl=r;break;case 12:Cl(t,e),El(e);break;case 31:Cl(t,e),El(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Sl(e,r)));break;case 13:Cl(t,e),El(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(fu=ke()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Sl(e,r)));break;case 22:i=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=sl,d=cl;if(sl=u||i,cl=d||l,Cl(t,e),cl=d,sl=u,El(e),r&8192)a:for(t=e.stateNode,t._visibility=i?t._visibility&-2:t._visibility|1,i&&(n===null||l||sl||cl||kl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(a=l.stateNode,i)s=a.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){id(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=i?``:l.memoizedProps}catch(e){id(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;i?gf(m,!0):gf(l.stateNode,!1)}catch(e){id(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,Sl(e,n))));break;case 19:Cl(t,e),El(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,Sl(e,r)));break;case 30:break;case 21:break;default:Cl(t,e),El(e)}}function El(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(nl(r)){n=r;break}r=r.return}if(n==null)throw Error(o(160));switch(n.tag){case 27:var i=n.stateNode;al(e,rl(e),i);break;case 5:var a=n.stateNode;n.flags&32&&(qt(a,``),n.flags&=-33),al(e,rl(e),a);break;case 3:case 4:var s=n.stateNode.containerInfo;il(e,rl(e),s);break;default:throw Error(o(161))}}catch(t){id(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Dl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Dl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Ol(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)pl(e,t.alternate,t),t=t.sibling}function kl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Yc(4,t,t.return),kl(t);break;case 1:$c(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Zc(t,t.return,n),kl(t);break;case 27:kf(t.stateNode);case 26:case 5:$c(t,t.return),kl(t);break;case 22:t.memoizedState===null&&kl(t);break;case 30:kl(t);break;default:kl(t)}e=e.sibling}}function Al(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:Al(i,a,n),Jc(4,a);break;case 1:if(Al(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){id(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)$a(c[i],s)}catch(e){id(r,r.return,e)}}n&&o&64&&Xc(a),Qc(a,a.return);break;case 27:ol(a);case 26:case 5:Al(i,a,n),n&&r===null&&o&4&&el(a),Qc(a,a.return);break;case 12:Al(i,a,n);break;case 31:Al(i,a,n),n&&o&4&&yl(i,a);break;case 13:Al(i,a,n),n&&o&4&&bl(i,a);break;case 22:a.memoizedState===null&&Al(i,a,n),Qc(a,a.return);break;case 30:break;default:Al(i,a,n)}t=t.sibling}}function jl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&fa(n))}function Ml(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&fa(e))}function Nl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Pl(e,t,n,r),t=t.sibling}function Pl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Nl(e,t,n,r),i&2048&&Jc(9,t);break;case 1:Nl(e,t,n,r);break;case 3:Nl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&fa(e)));break;case 12:if(i&2048){Nl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){id(t,t.return,e)}}else Nl(e,t,n,r);break;case 31:Nl(e,t,n,r);break;case 13:Nl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Nl(e,t,n,r):(a._visibility|=2,Fl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Nl(e,t,n,r):Il(e,t),i&2048&&jl(o,t);break;case 24:Nl(e,t,n,r),i&2048&&Ml(t.alternate,t);break;default:Nl(e,t,n,r)}}function Fl(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Fl(a,o,s,c,i),Jc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Fl(a,o,s,c,i)):u._visibility&2?Fl(a,o,s,c,i):Il(a,o),i&&l&2048&&jl(o.alternate,o);break;case 24:Fl(a,o,s,c,i),i&&l&2048&&Ml(o.alternate,o);break;default:Fl(a,o,s,c,i)}t=t.sibling}}function Il(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Il(n,r),i&2048&&jl(r.alternate,r);break;case 24:Il(n,r),i&2048&&Ml(r.alternate,r);break;default:Il(n,r)}t=t.sibling}}var Ll=8192;function Rl(e,t,n){if(e.subtreeFlags&Ll)for(e=e.child;e!==null;)zl(e,t,n),e=e.sibling}function zl(e,t,n){switch(e.tag){case 26:Rl(e,t,n),e.flags&Ll&&e.memoizedState!==null&&sp(n,wl,e.memoizedState,e.memoizedProps);break;case 5:Rl(e,t,n);break;case 3:case 4:var r=wl;wl=Mf(e.stateNode.containerInfo),Rl(e,t,n),wl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Ll,Ll=16777216,Rl(e,t,n),Ll=r):Rl(e,t,n));break;default:Rl(e,t,n)}}function Bl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Vl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];dl=r,Wl(r,e)}Bl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Hl(e),e=e.sibling}function Hl(e){switch(e.tag){case 0:case 11:case 15:Vl(e),e.flags&2048&&Yc(9,e,e.return);break;case 3:Vl(e);break;case 12:Vl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ul(e)):Vl(e);break;default:Vl(e)}}function Ul(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];dl=r,Wl(r,e)}Bl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Yc(8,t,t.return),Ul(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ul(t));break;default:Ul(t)}e=e.sibling}}function Wl(e,t){for(;dl!==null;){var n=dl;switch(n.tag){case 0:case 11:case 15:Yc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:fa(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,dl=r;else a:for(n=e;dl!==null;){r=dl;var i=r.sibling,a=r.return;if(ml(r),r===n){dl=null;break a}if(i!==null){i.return=a,dl=i;break a}dl=a}}}var Gl={getCacheForType:function(e){var t=ia(ua),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ia(ua).controller.signal}},Kl=typeof WeakMap==`function`?WeakMap:Map,ql=0,Jl=null,Yl=null,Xl=0,Zl=0,Ql=null,$l=!1,eu=!1,tu=!1,nu=0,ru=0,iu=0,au=0,ou=0,su=0,cu=0,lu=null,uu=null,du=!1,fu=0,pu=0,mu=1/0,hu=null,gu=null,_u=0,vu=null,yu=null,bu=0,xu=0,Su=null,Cu=null,wu=0,Tu=null;function Eu(){return ql&2&&Xl!==0?Xl&-Xl:M.T===null?ot():Td()}function Du(){if(su===0)if(!(Xl&536870912)||Li){var e=Ke;Ke<<=1,!(Ke&3932160)&&(Ke=262144),su=e}else su=536870912;return e=oo.current,e!==null&&(e.flags|=32),su}function Ou(e,t,n){(e===Jl&&(Zl===2||Zl===9)||e.cancelPendingCommit!==null)&&(Fu(e,0),Mu(e,Xl,su,!1)),$e(e,n),(!(ql&2)||e!==Jl)&&(e===Jl&&(!(ql&2)&&(au|=n),ru===4&&Mu(e,Xl,su,!1)),_d(e))}function ku(e,t,n){if(ql&6)throw Error(o(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Ye(e,t),i=r?Uu(e,t):Vu(e,t,!0),a=r;do{if(i===0){eu&&!r&&Mu(e,t,0,!1);break}else{if(n=e.current.alternate,a&&!ju(n)){i=Vu(e,t,!1),a=!1;continue}if(i===2){if(a=t,e.errorRecoveryDisabledLanes&a)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;i=lu;var l=c.current.memoizedState.isDehydrated;if(l&&(Fu(c,s).flags|=256),s=Vu(c,s,!1),s!==2){if(tu&&!l){c.errorRecoveryDisabledLanes|=a,au|=a,i=4;break a}a=uu,uu=i,a!==null&&(uu===null?uu=a:uu.push.apply(uu,a))}i=s}if(a=!1,i!==2)continue}}if(i===1){Fu(e,0),Mu(e,t,0,!0);break}a:{switch(r=e,a=i,a){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:Mu(r,t,su,!$l);break a;case 2:uu=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(i=fu+300-ke(),10<i)){if(Mu(r,t,su,!$l),Je(r,0,!0)!==0)break a;bu=t,r.timeoutHandle=lf(Au.bind(null,r,n,uu,hu,du,t,su,au,cu,$l,a,`Throttled`,-0,0),i);break a}Au(r,n,uu,hu,du,t,su,au,cu,$l,a,null,-0,0)}}break}while(1);_d(e)}function Au(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:tn},zl(t,a,d);var m=(a&62914560)===a?fu-ke():(a&4194048)===a?pu-ke():0;if(m=lp(d,m),m!==null){bu=a,e.cancelPendingCommit=m(Xu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),Mu(e,a,o,!l);return}}Xu(e,t,a,n,r,i,o,s,c)}function ju(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!wr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Mu(e,t,n,r){t&=~ou,t&=~au,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ve(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&tt(e,n,t)}function Nu(){return ql&6?!0:(vd(0,!1),!1)}function Pu(){if(Yl!==null){if(Zl===0)var e=Yl.return;else e=Yl,Xi=Yi=null,Fo(e),Fa=null,Ia=0,e=Yl;for(;e!==null;)qc(e.alternate,e),e=e.return;Yl=null}}function Fu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,uf(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),bu=0,Pu(),Jl=e,Yl=n=fi(e.current,null),Xl=t,Zl=0,Ql=null,$l=!1,eu=Ye(e,t),tu=!1,cu=su=ou=au=iu=ru=0,uu=lu=null,du=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Ve(r),a=1<<i;t|=e[i],r&=~a}return nu=t,ni(),n}function Iu(e,t){_o=null,M.H=Ws,t===Ta||t===Da?(t=Na(),Zl=3):t===Ea?(t=Na(),Zl=4):Zl=t===cc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Ql=t,Yl===null&&(ru=1,nc(e,bi(t,e.current)))}function Lu(){var e=oo.current;return e===null?!0:(Xl&4194048)===Xl?so===null:(Xl&62914560)===Xl||Xl&536870912?e===so:!1}function Ru(){var e=M.H;return M.H=Ws,e===null?Ws:e}function zu(){var e=M.A;return M.A=Gl,e}function Bu(){ru=4,$l||(Xl&4194048)!==Xl&&oo.current!==null||(eu=!0),!(iu&134217727)&&!(au&134217727)||Jl===null||Mu(Jl,Xl,su,!1)}function Vu(e,t,n){var r=ql;ql|=2;var i=Ru(),a=zu();(Jl!==e||Xl!==t)&&(hu=null,Fu(e,t)),t=!1;var o=ru;a:do try{if(Zl!==0&&Yl!==null){var s=Yl,c=Ql;switch(Zl){case 8:Pu(),o=6;break a;case 3:case 2:case 9:case 6:oo.current===null&&(t=!0);var l=Zl;if(Zl=0,Ql=null,qu(e,s,c,l),n&&eu){o=0;break a}break;default:l=Zl,Zl=0,Ql=null,qu(e,s,c,l)}}Hu(),o=ru;break}catch(t){Iu(e,t)}while(1);return t&&e.shellSuspendCounter++,Xi=Yi=null,ql=r,M.H=i,M.A=a,Yl===null&&(Jl=null,Xl=0,ni()),o}function Hu(){for(;Yl!==null;)Gu(Yl)}function Uu(e,t){var n=ql;ql|=2;var r=Ru(),i=zu();Jl!==e||Xl!==t?(hu=null,mu=ke()+500,Fu(e,t)):eu=Ye(e,t);a:do try{if(Zl!==0&&Yl!==null){t=Yl;var a=Ql;b:switch(Zl){case 1:Zl=0,Ql=null,qu(e,t,a,1);break;case 2:case 9:if(ka(a)){Zl=0,Ql=null,Ku(t);break}t=function(){Zl!==2&&Zl!==9||Jl!==e||(Zl=7),_d(e)},a.then(t,t);break a;case 3:Zl=7;break a;case 4:Zl=5;break a;case 7:ka(a)?(Zl=0,Ql=null,Ku(t)):(Zl=0,Ql=null,qu(e,t,a,7));break;case 5:var s=null;switch(Yl.tag){case 26:s=Yl.memoizedState;case 5:case 27:var c=Yl;if(s?op(s):c.stateNode.complete){Zl=0,Ql=null;var l=c.sibling;if(l!==null)Yl=l;else{var u=c.return;u===null?Yl=null:(Yl=u,Ju(u))}break b}}Zl=0,Ql=null,qu(e,t,a,5);break;case 6:Zl=0,Ql=null,qu(e,t,a,6);break;case 8:Pu(),ru=6;break a;default:throw Error(o(462))}}Wu();break}catch(t){Iu(e,t)}while(1);return Xi=Yi=null,M.H=r,M.A=i,ql=n,Yl===null?(Jl=null,Xl=0,ni(),ru):0}function Wu(){for(;Yl!==null&&!De();)Gu(Yl)}function Gu(e){var t=Rc(e.alternate,e,nu);e.memoizedProps=e.pendingProps,t===null?Ju(e):Yl=t}function Ku(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Sc(n,t,t.pendingProps,t.type,void 0,Xl);break;case 11:t=Sc(n,t,t.pendingProps,t.type.render,t.ref,Xl);break;case 5:Fo(t);default:qc(n,t),t=Yl=pi(t,nu),t=Rc(n,t,nu)}e.memoizedProps=e.pendingProps,t===null?Ju(e):Yl=t}function qu(e,t,n,r){Xi=Yi=null,Fo(t),Fa=null,Ia=0;var i=t.return;try{if(sc(e,i,t,n,Xl)){ru=1,nc(e,bi(n,e.current)),Yl=null;return}}catch(t){if(i!==null)throw Yl=i,t;ru=1,nc(e,bi(n,e.current)),Yl=null;return}t.flags&32768?(Li||r===1?e=!0:eu||Xl&536870912?e=!1:($l=e=!0,(r===2||r===9||r===3||r===6)&&(r=oo.current,r!==null&&r.tag===13&&(r.flags|=16384))),Yu(t,e)):Ju(t)}function Ju(e){var t=e;do{if(t.flags&32768){Yu(t,$l);return}e=t.return;var n=Gc(t.alternate,t,nu);if(n!==null){Yl=n;return}if(t=t.sibling,t!==null){Yl=t;return}Yl=t=e}while(t!==null);ru===0&&(ru=5)}function Yu(e,t){do{var n=Kc(e.alternate,e);if(n!==null){n.flags&=32767,Yl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Yl=e;return}Yl=e=n}while(e!==null);ru=6,Yl=null}function Xu(e,t,n,r,i,a,s,c,l){e.cancelPendingCommit=null;do td();while(_u!==0);if(ql&6)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(a=t.lanes|t.childLanes,a|=ti,et(e,n,a,s,c,l),e===Jl&&(Yl=Jl=null,Xl=0),yu=t,vu=e,bu=n,xu=a,Su=i,Cu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,ud(Ne,function(){return nd(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=M.T,M.T=null,i=N.p,N.p=2,s=ql,ql|=4;try{fl(e,t,n)}finally{ql=s,N.p=i,M.T=r}}_u=1,Zu(),Qu(),$u()}}function Zu(){if(_u===1){_u=0;var e=vu,t=yu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=M.T,M.T=null;var r=N.p;N.p=2;var i=ql;ql|=4;try{Tl(t,e);var a=tf,o=kr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Or(s.ownerDocument.documentElement,s)){if(c!==null&&Ar(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Dr(s,h),v=Dr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}Cp=!!ef,tf=ef=null}finally{ql=i,N.p=r,M.T=n}}e.current=t,_u=2}}function Qu(){if(_u===2){_u=0;var e=vu,t=yu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=M.T,M.T=null;var r=N.p;N.p=2;var i=ql;ql|=4;try{pl(e,t.alternate,t)}finally{ql=i,N.p=r,M.T=n}}_u=3}}function $u(){if(_u===4||_u===3){_u=0,Oe();var e=vu,t=yu,n=bu,r=Cu;t.subtreeFlags&10256||t.flags&10256?_u=5:(_u=0,yu=vu=null,ed(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(gu=null),at(n),t=t.stateNode,ze&&typeof ze.onCommitFiberRoot==`function`)try{ze.onCommitFiberRoot(Re,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=M.T,i=N.p,N.p=2,M.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{M.T=t,N.p=i}}bu&3&&td(),_d(e),i=e.pendingLanes,n&261930&&i&42?e===Tu?wu++:(wu=0,Tu=e):wu=0,vd(0,!1)}}function ed(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,fa(t)))}function td(){return Zu(),Qu(),$u(),nd()}function nd(){if(_u!==5)return!1;var e=vu,t=xu;xu=0;var n=at(bu),r=M.T,i=N.p;try{N.p=32>n?32:n,M.T=null,n=Su,Su=null;var a=vu,s=bu;if(_u=0,yu=vu=null,bu=0,ql&6)throw Error(o(331));var c=ql;if(ql|=4,Hl(a.current),Pl(a,a.current,s,n),ql=c,vd(0,!1),ze&&typeof ze.onPostCommitFiberRoot==`function`)try{ze.onPostCommitFiberRoot(Re,a)}catch{}return!0}finally{N.p=i,M.T=r,ed(e,t)}}function rd(e,t,n){t=bi(n,t),t=ic(e.stateNode,t,2),e=qa(e,t,2),e!==null&&($e(e,2),_d(e))}function id(e,t,n){if(e.tag===3)rd(e,e,n);else for(;t!==null;){if(t.tag===3){rd(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(gu===null||!gu.has(r))){e=bi(n,e),n=ac(2),r=qa(t,n,2),r!==null&&(oc(n,r,t,e),$e(r,2),_d(r));break}}t=t.return}}function ad(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Kl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(tu=!0,i.add(n),e=od.bind(null,e,t,n),t.then(e,e))}function od(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Jl===e&&(Xl&n)===n&&(ru===4||ru===3&&(Xl&62914560)===Xl&&300>ke()-fu?!(ql&2)&&Fu(e,0):ou|=n,cu===Xl&&(cu=0)),_d(e)}function sd(e,t){t===0&&(t=Ze()),e=ai(e,t),e!==null&&($e(e,t),_d(e))}function cd(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),sd(e,n)}function ld(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(o(314))}r!==null&&r.delete(t),sd(e,n)}function ud(e,t){return Te(e,t)}var dd=null,fd=null,pd=!1,md=!1,hd=!1,gd=0;function _d(e){e!==fd&&e.next===null&&(fd===null?dd=fd=e:fd=fd.next=e),md=!0,pd||(pd=!0,wd())}function vd(e,t){if(!hd&&md){hd=!0;do for(var n=!1,r=dd;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ve(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Cd(r,a))}else a=Xl,a=Je(r,r===Jl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ye(r,a)||(n=!0,Cd(r,a));r=r.next}while(n);hd=!1}}function yd(){bd()}function bd(){md=pd=!1;var e=0;gd!==0&&cf()&&(e=gd);for(var t=ke(),n=null,r=dd;r!==null;){var i=r.next,a=xd(r,t);a===0?(r.next=null,n===null?dd=i:n.next=i,i===null&&(fd=n)):(n=r,(e!==0||a&3)&&(md=!0)),r=i}_u!==0&&_u!==5||vd(e,!1),gd!==0&&(gd=0)}function xd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ve(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Xe(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Jl,n=Xl,n=Je(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Zl===2||Zl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ee(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ye(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Ee(r),at(n)){case 2:case 8:n=Me;break;case 32:n=Ne;break;case 268435456:n=Fe;break;default:n=Ne}return r=Sd.bind(null,e),n=Te(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Ee(r),e.callbackPriority=2,e.callbackNode=null,2}function Sd(e,t){if(_u!==0&&_u!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(td()&&e.callbackNode!==n)return null;var r=Xl;return r=Je(e,e===Jl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(ku(e,r,t),xd(e,ke()),e.callbackNode!=null&&e.callbackNode===n?Sd.bind(null,e):null)}function Cd(e,t){if(td())return null;ku(e,t,!0)}function wd(){ff(function(){ql&6?Te(je,yd):bd()})}function Td(){if(gd===0){var e=ha;e===0&&(e=Ge,Ge<<=1,!(Ge&261888)&&(Ge=256)),gd=e}return gd}function Ed(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:en(``+e)}function Dd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function Od(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Ed((i[ut]||null).action),o=r.submitter;o&&(t=(t=o[ut]||null)?Ed(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Cn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(gd!==0){var e=o?Dd(i,o):new FormData(i);js(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?Dd(i,o):new FormData(i),js(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var kd=0;kd<Xr.length;kd++){var Ad=Xr[kd];Zr(Ad.toLowerCase(),`on`+(Ad[0].toUpperCase()+Ad.slice(1)))}Zr(Hr,`onAnimationEnd`),Zr(Ur,`onAnimationIteration`),Zr(Wr,`onAnimationStart`),Zr(`dblclick`,`onDoubleClick`),Zr(`focusin`,`onFocus`),Zr(`focusout`,`onBlur`),Zr(Gr,`onTransitionRun`),Zr(Kr,`onTransitionStart`),Zr(qr,`onTransitionCancel`),Zr(Jr,`onTransitionEnd`),Et(`onMouseEnter`,[`mouseout`,`mouseover`]),Et(`onMouseLeave`,[`mouseout`,`mouseover`]),Et(`onPointerEnter`,[`pointerout`,`pointerover`]),Et(`onPointerLeave`,[`pointerout`,`pointerover`]),Tt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Tt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Tt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Tt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Tt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Tt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var jd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),Md=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(jd));function Nd(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Qr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Qr(e)}i.currentTarget=null,a=c}}}}function Pd(e,t){var n=t[ft];n===void 0&&(n=t[ft]=new Set);var r=e+`__bubble`;n.has(r)||(Rd(t,e,2,!1),n.add(r))}function Fd(e,t,n){var r=0;t&&(r|=4),Rd(n,e,r,t)}var Id=`_reactListening`+Math.random().toString(36).slice(2);function Ld(e){if(!e[Id]){e[Id]=!0,Ct.forEach(function(t){t!==`selectionchange`&&(Md.has(t)||Fd(t,!1,e),Fd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Id]||(t[Id]=!0,Fd(`selectionchange`,!1,t))}}function Rd(e,t,n,r){switch(Ap(t)){case 2:var i=wp;break;case 8:i=Tp;break;default:i=Ep}n=i.bind(null,t,n,e),i=void 0,!fn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function zd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;s!==null;){if(o=vt(s),o===null)return;if(l=o.tag,l===5||l===6||l===26||l===27){r=a=o;continue a}s=s.parentNode}}r=r.return}ln(function(){var r=a,i=rn(n),o=[];a:{var s=Yr.get(e);if(s!==void 0){var l=Cn,u=e;switch(e){case`keypress`:if(vn(n)===0)break a;case`keydown`:case`keyup`:l=Vn;break;case`focusin`:u=`focus`,l=Mn;break;case`focusout`:u=`blur`,l=Mn;break;case`beforeblur`:case`afterblur`:l=Mn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=An;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=jn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Un;break;case Hr:case Ur:case Wr:l=Nn;break;case Jr:l=Wn;break;case`scroll`:case`scrollend`:l=Tn;break;case`wheel`:l=Gn;break;case`copy`:case`cut`:case`paste`:l=Pn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Hn;break;case`toggle`:case`beforetoggle`:l=Kn}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?s===null?null:s+`Capture`:s;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=un(m,p),g!=null&&d.push(Bd(m,g,h))),f)break;m=m.return}0<d.length&&(s=new l(s,u,null,n,i),o.push({event:s,listeners:d}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,s&&n!==nn&&(u=n.relatedTarget||n.fromElement)&&(vt(u)||u[dt]))break a;if((l||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?vt(u):null,u!==null&&(f=c(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=An,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Hn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?s:bt(l),h=u==null?s:bt(u),s=new d(g,m+`leave`,l,n,i),s.target=f,s.relatedTarget=h,g=null,vt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Hd,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Ud(o,s,l,d,!1),u!==null&&f!==null&&Ud(o,f,u,d,!0)}}a:{if(s=r?bt(r):window,l=s.nodeName&&s.nodeName.toLowerCase(),l===`select`||l===`input`&&s.type===`file`)var v=fr;else if(or(s))if(pr)v=Sr;else{v=br;var y=yr}else l=s.nodeName,!l||l.toLowerCase()!==`input`||s.type!==`checkbox`&&s.type!==`radio`?r&&Zt(r.elementType)&&(v=fr):v=xr;if(v&&=v(e,r)){sr(o,v,n,i);break a}y&&y(e,s,r),e===`focusout`&&r&&s.type===`number`&&r.memoizedProps.value!=null&&Ut(s,`number`,s.value)}switch(y=r?bt(r):window,e){case`focusin`:(or(y)||y.contentEditable===`true`)&&(Mr=y,Nr=r,Pr=null);break;case`focusout`:Pr=Nr=Mr=null;break;case`mousedown`:Fr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Fr=!1,Ir(o,n,i);break;case`selectionchange`:if(jr)break;case`keydown`:case`keyup`:Ir(o,n,i)}var b;if(Jn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else nr?er(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Zn&&n.locale!==`ko`&&(nr||x!==`onCompositionStart`?x===`onCompositionEnd`&&nr&&(b=_n()):(mn=i,hn=`value`in mn?mn.value:mn.textContent,nr=!0)),y=Vd(r,x),0<y.length&&(x=new Fn(x,e,null,n,i),o.push({event:x,listeners:y}),b?x.data=b:(b=tr(n),b!==null&&(x.data=b)))),(b=Xn?rr(e,n):ir(e,n))&&(x=Vd(r,`onBeforeInput`),0<x.length&&(y=new Fn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:y,listeners:x}),y.data=b)),Od(o,e,r,n,i)}Nd(o,t)})}function Bd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Vd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=un(e,n),i!=null&&r.unshift(Bd(e,i,a)),i=un(e,t),i!=null&&r.push(Bd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Hd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Ud(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=un(n,a),l!=null&&o.unshift(Bd(n,l,c))):i||(l=un(n,a),l!=null&&o.push(Bd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Wd=/\r\n?/g,Gd=/\u0000|\uFFFD/g;function Kd(e){return(typeof e==`string`?e:``+e).replace(Wd,`
|
|
10
|
+
`).replace(Gd,``)}function qd(e,t){return t=Kd(t),Kd(e)===t}function Jd(e,t,n,r,i,a){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||qt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&qt(e,``+r);break;case`className`:jt(e,`class`,r);break;case`tabIndex`:jt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:jt(e,n,r);break;case`style`:Xt(e,r,a);break;case`data`:if(t!==`object`){jt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=en(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof a==`function`&&(n===`formAction`?(t!==`input`&&Jd(e,t,`name`,i.name,i,null),Jd(e,t,`formEncType`,i.formEncType,i,null),Jd(e,t,`formMethod`,i.formMethod,i,null),Jd(e,t,`formTarget`,i.formTarget,i,null)):(Jd(e,t,`encType`,i.encType,i,null),Jd(e,t,`method`,i.method,i,null),Jd(e,t,`target`,i.target,i,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=en(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=tn);break;case`onScroll`:r!=null&&Pd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Pd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(o(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(o(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=en(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Pd(`beforetoggle`,e),Pd(`toggle`,e),F(e,`popover`,r);break;case`xlinkActuate`:Mt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Mt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Mt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Mt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Mt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Mt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Mt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Mt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Mt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:F(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Qt.get(n)||n,F(e,n,r))}}function Yd(e,t,n,r,i,a){switch(n){case`style`:Xt(e,r,a);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(o(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(o(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?qt(e,r):(typeof r==`number`||typeof r==`bigint`)&&qt(e,``+r);break;case`onScroll`:r!=null&&Pd(`scroll`,e);break;case`onScrollEnd`:r!=null&&Pd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=tn);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!wt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),t=n.slice(2,i?n.length-7:void 0),a=e[ut]||null,a=a==null?null:a[n],typeof a==`function`&&e.removeEventListener(t,a,i),typeof r==`function`)){typeof a!=`function`&&a!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,i);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):F(e,n,r)}}}function Xd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Pd(`error`,e),Pd(`load`,e);var r=!1,i=!1,a;for(a in n)if(n.hasOwnProperty(a)){var s=n[a];if(s!=null)switch(a){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(o(137,t));default:Jd(e,t,a,s,n,null)}}i&&Jd(e,t,`srcSet`,n.srcSet,n,null),r&&Jd(e,t,`src`,n.src,n,null);return;case`input`:Pd(`invalid`,e);var c=a=s=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:a=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(o(137,t));break;default:Jd(e,t,r,d,n,null)}}Ht(e,a,c,l,u,s,i,!1);return;case`select`:for(i in Pd(`invalid`,e),r=s=a=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:a=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Jd(e,t,i,c,n,null)}t=a,n=s,e.multiple=!!r,t==null?n!=null&&Wt(e,!!r,n,!0):Wt(e,!!r,t,!1);return;case`textarea`:for(s in Pd(`invalid`,e),a=i=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:a=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(o(91));break;default:Jd(e,t,s,c,n,null)}Kt(e,r,i,a);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Jd(e,t,l,r,n,null)}return;case`dialog`:Pd(`beforetoggle`,e),Pd(`toggle`,e),Pd(`cancel`,e),Pd(`close`,e);break;case`iframe`:case`object`:Pd(`load`,e);break;case`video`:case`audio`:for(r=0;r<jd.length;r++)Pd(jd[r],e);break;case`image`:Pd(`error`,e),Pd(`load`,e);break;case`details`:Pd(`toggle`,e);break;case`embed`:case`source`:case`link`:Pd(`error`,e),Pd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(o(137,t));default:Jd(e,t,u,r,n,null)}return;default:if(Zt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Yd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Jd(e,t,c,r,n,null))}function Zd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,a=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Jd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:a=m;break;case`name`:i=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(o(137,t));break;default:m!==f&&Jd(e,t,p,m,r,f)}}Vt(e,s,c,l,u,d,a,i);return;case`select`:for(a in m=s=c=p=null,n)if(l=n[a],n.hasOwnProperty(a)&&l!=null)switch(a){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(a)||Jd(e,t,a,null,r,l)}for(i in r)if(a=r[i],l=n[i],r.hasOwnProperty(i)&&(a!=null||l!=null))switch(i){case`value`:p=a;break;case`defaultValue`:c=a;break;case`multiple`:s=a;default:a!==l&&Jd(e,t,i,a,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Wt(e,!!n,n?[]:``,!1):Wt(e,!!n,t,!0)):Wt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Jd(e,t,c,null,r,i)}for(s in r)if(i=r[s],a=n[s],r.hasOwnProperty(s)&&(i!=null||a!=null))switch(s){case`value`:p=i;break;case`defaultValue`:m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(o(91));break;default:i!==a&&Jd(e,t,s,i,r,a)}Gt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Jd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Jd(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Jd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(o(137,t));break;default:Jd(e,t,u,p,r,m)}return;default:if(Zt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Yd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Yd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Jd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Jd(e,t,f,p,r,m)}function Qd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function $d(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Qd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Qd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var ef=null,tf=null;function nf(e){return e.nodeType===9?e:e.ownerDocument}function rf(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function af(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function of(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var sf=null;function cf(){var e=window.event;return e&&e.type===`popstate`?e===sf?!1:(sf=e,!0):(sf=null,!1)}var lf=typeof setTimeout==`function`?setTimeout:void 0,uf=typeof clearTimeout==`function`?clearTimeout:void 0,df=typeof Promise==`function`?Promise:void 0,ff=typeof queueMicrotask==`function`?queueMicrotask:df===void 0?lf:function(e){return df.resolve(null).then(e).catch(pf)};function pf(e){setTimeout(function(){throw e})}function mf(e){return e===`head`}function hf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Yp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)kf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,kf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[gt]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&kf(e.ownerDocument.body);n=i}while(n);Yp(t)}function gf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function _f(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:_f(n),_t(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function vf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[gt])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=wf(e.nextSibling),e===null)break}return null}function yf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=wf(e.nextSibling),e===null))return null;return e}function bf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=wf(e.nextSibling),e===null))return null;return e}function xf(e){return e.data===`$?`||e.data===`$~`}function Sf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function Cf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function wf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var Tf=null;function Ef(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return wf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function Df(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function Of(e,t,n){switch(t=nf(n),e){case`html`:if(e=t.documentElement,!e)throw Error(o(452));return e;case`head`:if(e=t.head,!e)throw Error(o(453));return e;case`body`:if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function kf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);_t(e)}var Af=new Map,jf=new Set;function Mf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Nf=N.d;N.d={f:Pf,r:Ff,D:Rf,C:zf,L:Bf,m:Vf,X:Uf,S:Hf,M:Wf};function Pf(){var e=Nf.f(),t=Nu();return e||t}function Ff(e){var t=yt(e);t!==null&&t.tag===5&&t.type===`form`?Ns(t):Nf.r(e)}var If=typeof document>`u`?null:document;function Lf(e,t,n){var r=If;if(r&&typeof t==`string`&&t){var i=Bt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),jf.has(i)||(jf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Xd(t,`link`,e),St(t),r.head.appendChild(t)))}}function Rf(e){Nf.D(e),Lf(`dns-prefetch`,e,null)}function zf(e,t){Nf.C(e,t),Lf(`preconnect`,e,t)}function Bf(e,t,n){Nf.L(e,t,n);var r=If;if(r&&e&&t){var i=`link[rel="preload"][as="`+Bt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Bt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Bt(n.imageSizes)+`"]`)):i+=`[href="`+Bt(e)+`"]`;var a=i;switch(t){case`style`:a=Kf(e);break;case`script`:a=Xf(e)}Af.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Af.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(qf(a))||t===`script`&&r.querySelector(Zf(a))||(t=r.createElement(`link`),Xd(t,`link`,e),St(t),r.head.appendChild(t)))}}function Vf(e,t){Nf.m(e,t);var n=If;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Bt(r)+`"][href="`+Bt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Xf(e)}if(!Af.has(a)&&(e=m({rel:`modulepreload`,href:e},t),Af.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Zf(a)))return}r=n.createElement(`link`),Xd(r,`link`,e),St(r),n.head.appendChild(r)}}}function Hf(e,t,n){Nf.S(e,t,n);var r=If;if(r&&e){var i=xt(r).hoistableStyles,a=Kf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(qf(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Af.get(a))&&ep(e,n);var c=o=r.createElement(`link`);St(c),Xd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,$f(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Uf(e,t){Nf.X(e,t);var n=If;if(n&&e){var r=xt(n).hoistableScripts,i=Xf(e),a=r.get(i);a||(a=n.querySelector(Zf(i)),a||(e=m({src:e,async:!0},t),(t=Af.get(i))&&tp(e,t),a=n.createElement(`script`),St(a),Xd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Wf(e,t){Nf.M(e,t);var n=If;if(n&&e){var r=xt(n).hoistableScripts,i=Xf(e),a=r.get(i);a||(a=n.querySelector(Zf(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=Af.get(i))&&tp(e,t),a=n.createElement(`script`),St(a),Xd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Gf(e,t,n,r){var i=(i=de.current)?Mf(i):null;if(!i)throw Error(o(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Kf(n.href),n=xt(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Kf(n.href);var a=xt(i).hoistableStyles,s=a.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,s),(a=i.querySelector(qf(e)))&&!a._p&&(s.instance=a,s.state.loading=5),Af.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Af.set(e,n),a||Yf(i,e,n,s.state))),t&&r===null)throw Error(o(528,``));return s}if(t&&r!==null)throw Error(o(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Xf(n),n=xt(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Kf(e){return`href="`+Bt(e)+`"`}function qf(e){return`link[rel="stylesheet"][`+e+`]`}function Jf(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Yf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Xd(t,`link`,n),St(t),e.head.appendChild(t))}function Xf(e){return`[src="`+Bt(e)+`"]`}function Zf(e){return`script[async]`+e}function Qf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Bt(n.href)+`"]`);if(r)return t.instance=r,St(r),r;var i=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),St(r),Xd(r,`style`,i),$f(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Kf(n.href);var a=e.querySelector(qf(i));if(a)return t.state.loading|=4,t.instance=a,St(a),a;r=Jf(n),(i=Af.get(i))&&ep(r,i),a=(e.ownerDocument||e).createElement(`link`),St(a);var s=a;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Xd(a,`link`,r),t.state.loading|=4,$f(a,n.precedence,e),t.instance=a;case`script`:return a=Xf(n.src),(i=e.querySelector(Zf(a)))?(t.instance=i,St(i),i):(r=n,(i=Af.get(a))&&(r=m({},n),tp(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),St(i),Xd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(o(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,$f(r,n.precedence,e));return t.instance}function $f(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function ep(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function tp(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var np=null;function rp(e,t,n){if(np===null){var r=new Map,i=np=new Map;i.set(n,r)}else i=np,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[gt]||a[lt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function ip(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function ap(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function op(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function sp(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Kf(r.href),a=t.querySelector(qf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=up.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,St(a);return}a=t.ownerDocument||t,r=Jf(r),(i=Af.get(i))&&ep(r,i),a=a.createElement(`link`),St(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Xd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=up.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var cp=0;function lp(e,t){return e.stylesheets&&e.count===0&&fp(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&fp(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&cp===0&&(cp=62500*$d());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&fp(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>cp?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function up(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)fp(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var dp=null;function fp(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,dp=new Map,t.forEach(pp,e),dp=null,up.call(e))}function pp(e,t){if(!(t.state.loading&4)){var n=dp.get(e);if(n)var r=n.get(null);else{n=new Map,dp.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=up.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var mp={$$typeof:S,Provider:null,Consumer:null,_currentValue:re,_currentValue2:re,_threadCount:0};function hp(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Qe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qe(0),this.hiddenUpdates=Qe(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function gp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new hp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ui(3,null,null,t),e.current=a,a.stateNode=e,t=da(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Wa(a),e}function _p(e){return e?(e=ci,e):ci}function vp(e,t,n,r,i,a){i=_p(i),r.context===null?r.context=i:r.pendingContext=i,r=Ka(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=qa(e,r,t),n!==null&&(Ou(n,e,t),Ja(n,e,t))}function yp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function bp(e,t){yp(e,t),(e=e.alternate)&&yp(e,t)}function xp(e){if(e.tag===13||e.tag===31){var t=ai(e,67108864);t!==null&&Ou(t,e,67108864),bp(e,67108864)}}function Sp(e){if(e.tag===13||e.tag===31){var t=Eu();t=it(t);var n=ai(e,t);n!==null&&Ou(n,e,t),bp(e,t)}}var Cp=!0;function wp(e,t,n,r){var i=M.T;M.T=null;var a=N.p;try{N.p=2,Ep(e,t,n,r)}finally{N.p=a,M.T=i}}function Tp(e,t,n,r){var i=M.T;M.T=null;var a=N.p;try{N.p=8,Ep(e,t,n,r)}finally{N.p=a,M.T=i}}function Ep(e,t,n,r){if(Cp){var i=Dp(r);if(i===null)zd(e,t,r,Op,n),zp(e,r);else if(Vp(i,e,t,n,r))r.stopPropagation();else if(zp(e,r),t&4&&-1<Rp.indexOf(e)){for(;i!==null;){var a=yt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=P(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ve(o);s.entanglements[1]|=c,o&=~c}_d(a),!(ql&6)&&(mu=ke()+500,vd(0,!1))}}break;case 31:case 13:s=ai(a,2),s!==null&&Ou(s,a,2),Nu(),bp(a,2)}if(a=Dp(r),a===null&&zd(e,t,r,Op,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else zd(e,t,r,null,n)}}function Dp(e){return e=rn(e),kp(e)}var Op=null;function kp(e){if(Op=null,e=vt(e),e!==null){var t=c(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=l(t),e!==null)return e;e=null}else if(n===31){if(e=u(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Op=e,null}function Ap(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Ae()){case je:return 2;case Me:return 8;case Ne:case Pe:return 32;case Fe:return 268435456;default:return 32}default:return 32}}var jp=!1,Mp=null,Np=null,Pp=null,Fp=new Map,Ip=new Map,Lp=[],Rp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function zp(e,t){switch(e){case`focusin`:case`focusout`:Mp=null;break;case`dragenter`:case`dragleave`:Np=null;break;case`mouseover`:case`mouseout`:Pp=null;break;case`pointerover`:case`pointerout`:Fp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Ip.delete(t.pointerId)}}function Bp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=yt(t),t!==null&&xp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Vp(e,t,n,r,i){switch(t){case`focusin`:return Mp=Bp(Mp,e,t,n,r,i),!0;case`dragenter`:return Np=Bp(Np,e,t,n,r,i),!0;case`mouseover`:return Pp=Bp(Pp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Fp.set(a,Bp(Fp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Ip.set(a,Bp(Ip.get(a)||null,e,t,n,r,i)),!0}return!1}function Hp(e){var t=vt(e.target);if(t!==null){var n=c(t);if(n!==null){if(t=n.tag,t===13){if(t=l(n),t!==null){e.blockedOn=t,st(e.priority,function(){Sp(n)});return}}else if(t===31){if(t=u(n),t!==null){e.blockedOn=t,st(e.priority,function(){Sp(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Up(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);nn=r,n.target.dispatchEvent(r),nn=null}else return t=yt(n),t!==null&&xp(t),e.blockedOn=n,!1;t.shift()}return!0}function Wp(e,t,n){Up(e)&&n.delete(t)}function Gp(){jp=!1,Mp!==null&&Up(Mp)&&(Mp=null),Np!==null&&Up(Np)&&(Np=null),Pp!==null&&Up(Pp)&&(Pp=null),Fp.forEach(Wp),Ip.forEach(Wp)}function Kp(e,t){e.blockedOn===t&&(e.blockedOn=null,jp||(jp=!0,r.unstable_scheduleCallback(r.unstable_NormalPriority,Gp)))}var qp=null;function Jp(e){qp!==e&&(qp=e,r.unstable_scheduleCallback(r.unstable_NormalPriority,function(){qp===e&&(qp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(kp(r||n)===null)continue;break}var a=yt(n);a!==null&&(e.splice(t,3),t-=3,js(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Yp(e){function t(t){return Kp(t,e)}Mp!==null&&Kp(Mp,e),Np!==null&&Kp(Np,e),Pp!==null&&Kp(Pp,e),Fp.forEach(t),Ip.forEach(t);for(var n=0;n<Lp.length;n++){var r=Lp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Lp.length&&(n=Lp[0],n.blockedOn===null);)Hp(n),n.blockedOn===null&&Lp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[ut]||null;if(typeof a==`function`)o||Jp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[ut]||null)s=o.formAction;else if(kp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Jp(n)}}}function Xp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Zp(e){this._internalRoot=e}Qp.prototype.render=Zp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var n=t.current;vp(n,Eu(),e,t,null,null)},Qp.prototype.unmount=Zp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;vp(e.current,2,null,e,null,null),Nu(),t[dt]=null}};function Qp(e){this._internalRoot=e}Qp.prototype.unstable_scheduleHydration=function(e){if(e){var t=ot();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Lp.length&&t!==0&&t<Lp[n].priority;n++);Lp.splice(n,0,e),n===0&&Hp(e)}};var $p=i.version;if($p!==`19.2.7`)throw Error(o(527,$p,`19.2.7`));N.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(o(188)):(e=Object.keys(e).join(`,`),Error(o(268,e)));return e=f(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var em={bundleType:0,version:`19.2.7`,rendererPackageName:`react-dom`,currentDispatcherRef:M,reconcilerVersion:`19.2.7`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var tm=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!tm.isDisabled&&tm.supportsFiber)try{Re=tm.inject(em),ze=tm}catch{}}t.createRoot=function(e,t){if(!s(e))throw Error(o(299));var n=!1,r=``,i=$s,a=ec,c=tc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(a=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=gp(e,1,!1,null,null,n,r,null,i,a,c,Xp),e[dt]=t.current,Ld(e),new Zp(t)}})),Mv=a(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=jv()})),Qie=Object.defineProperty,$ie=(e,t,n)=>t in e?Qie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nv=(e,t,n)=>$ie(e,typeof t==`symbol`?t:t+``,n),Pv=void 0,eae=class{constructor(e,t){if(Nv(this,`address`),Nv(this,`auth`),Nv(this,`adminAuth`),Nv(this,`encodedTsPromise`),Nv(this,`debug`),Nv(this,`fetchOptions`),Nv(this,`fetch`),Nv(this,`logger`),Nv(this,`mutationQueue`,[]),Nv(this,`isProcessingQueue`,!1),typeof t==`boolean`)throw Error("skipConvexDeploymentUrlCheck as the second argument is no longer supported. Please pass an options object, `{ skipConvexDeploymentUrlCheck: true }`.");(t??{}).skipConvexDeploymentUrlCheck!==!0&&Do(e),this.logger=t?.logger===!1?It({verbose:!1}):t?.logger!==!0&&t?.logger?t.logger:uc({verbose:!1}),this.address=e,this.debug=!0,this.auth=void 0,this.adminAuth=void 0,this.fetch=t?.fetch,t?.auth&&this.setAuth(t.auth)}backendUrl(){return`${this.address}/api`}get url(){return this.address}setAuth(e){this.clearAuth(),this.auth=e}setAdminAuth(e,t){if(this.clearAuth(),t!==void 0){let n=new TextEncoder().encode(JSON.stringify(t)),r=btoa(String.fromCodePoint(...n));this.adminAuth=`${e}:${r}`}else this.adminAuth=e}clearAuth(){this.auth=void 0,this.adminAuth=void 0}setDebug(e){this.debug=e}setFetchOptions(e){this.fetchOptions=e}async consistentQuery(e,...t){let n=Ia(t[0]),r=this.getTimestamp();return await this.queryInner(e,n,{timestampPromise:r})}async getTimestamp(){return this.encodedTsPromise?this.encodedTsPromise:this.encodedTsPromise=this.getTimestampInner()}async getTimestampInner(){let e=this.fetch||Pv||fetch,t={"Content-Type":`application/json`,"Convex-Client":`npm-${ro}`},n=await e(`${this.address}/api/query_ts`,{...this.fetchOptions,method:`POST`,headers:t});if(!n.ok)throw Error(await n.text());let{ts:r}=await n.json();return r}async query(e,...t){let n=Ia(t[0]);return await this.queryInner(e,n,{})}async queryInner(e,t,n){let r=x_(e),i=[Eh(t)],a={"Content-Type":`application/json`,"Convex-Client":`npm-${ro}`};this.adminAuth?a.Authorization=`Convex ${this.adminAuth}`:this.auth&&(a.Authorization=`Bearer ${this.auth}`);let o=this.fetch||Pv||fetch,s=n.timestampPromise?await n.timestampPromise:void 0,c=JSON.stringify({path:r,format:`convex_encoded_json`,args:i,...s?{ts:s}:{}}),l=await o(s?`${this.address}/api/query_at_ts`:`${this.address}/api/query`,{...this.fetchOptions,body:c,method:`POST`,headers:a});if(!l.ok&&l.status!==560)throw Error(await l.text());let u=await l.json();if(this.debug)for(let e of u.logLines??[])mt(this.logger,`info`,`query`,r,e);switch(u.status){case`success`:return pa(u.value);case`error`:throw u.errorData===void 0?Error(u.errorMessage):Fv(u.errorData,new Jh(u.errorMessage));default:throw Error(`Invalid response: ${JSON.stringify(u)}`)}}async mutationInner(e,t){let n=x_(e),r=JSON.stringify({path:n,format:`convex_encoded_json`,args:[Eh(t)]}),i={"Content-Type":`application/json`,"Convex-Client":`npm-${ro}`};this.adminAuth?i.Authorization=`Convex ${this.adminAuth}`:this.auth&&(i.Authorization=`Bearer ${this.auth}`);let a=await(this.fetch||Pv||fetch)(`${this.address}/api/mutation`,{...this.fetchOptions,body:r,method:`POST`,headers:i});if(!a.ok&&a.status!==560)throw Error(await a.text());let o=await a.json();if(this.debug)for(let e of o.logLines??[])mt(this.logger,`info`,`mutation`,n,e);switch(o.status){case`success`:return pa(o.value);case`error`:throw o.errorData===void 0?Error(o.errorMessage):Fv(o.errorData,new Jh(o.errorMessage));default:throw Error(`Invalid response: ${JSON.stringify(o)}`)}}async processMutationQueue(){if(!this.isProcessingQueue){for(this.isProcessingQueue=!0;this.mutationQueue.length>0;){let{mutation:e,args:t,resolve:n,reject:r}=this.mutationQueue.shift();try{n(await this.mutationInner(e,t))}catch(e){r(e)}}this.isProcessingQueue=!1}}enqueueMutation(e,t){return new Promise((n,r)=>{this.mutationQueue.push({mutation:e,args:t,resolve:n,reject:r}),this.processMutationQueue()})}async mutation(e,...t){let[n,r]=t,i=Ia(n);return r?.skipQueue?await this.mutationInner(e,i):await this.enqueueMutation(e,i)}async action(e,...t){let n=Ia(t[0]),r=x_(e),i=JSON.stringify({path:r,format:`convex_encoded_json`,args:[Eh(n)]}),a={"Content-Type":`application/json`,"Convex-Client":`npm-${ro}`};this.adminAuth?a.Authorization=`Convex ${this.adminAuth}`:this.auth&&(a.Authorization=`Bearer ${this.auth}`);let o=await(this.fetch||Pv||fetch)(`${this.address}/api/action`,{...this.fetchOptions,body:i,method:`POST`,headers:a});if(!o.ok&&o.status!==560)throw Error(await o.text());let s=await o.json();if(this.debug)for(let e of s.logLines??[])mt(this.logger,`info`,`action`,r,e);switch(s.status){case`success`:return pa(s.value);case`error`:throw s.errorData===void 0?Error(s.errorMessage):Fv(s.errorData,new Jh(s.errorMessage));default:throw Error(`Invalid response: ${JSON.stringify(s)}`)}}async function(e,t,...n){let r=Ia(n[0]),i=typeof e==`string`?e:x_(e),a=JSON.stringify({componentPath:t,path:i,format:`convex_encoded_json`,args:Eh(r)}),o={"Content-Type":`application/json`,"Convex-Client":`npm-${ro}`};this.adminAuth?o.Authorization=`Convex ${this.adminAuth}`:this.auth&&(o.Authorization=`Bearer ${this.auth}`);let s=await(this.fetch||Pv||fetch)(`${this.address}/api/function`,{...this.fetchOptions,body:a,method:`POST`,headers:o});if(!s.ok&&s.status!==560)throw Error(await s.text());let c=await s.json();if(this.debug)for(let e of c.logLines??[])mt(this.logger,`info`,`any`,i,e);switch(c.status){case`success`:return pa(c.value);case`error`:throw c.errorData===void 0?Error(c.errorMessage):Fv(c.errorData,new Jh(c.errorMessage));default:throw Error(`Invalid response: ${JSON.stringify(c)}`)}}};function Fv(e,t){return t.data=pa(e),t}var z=r(e(),1),Iv=(0,z.createContext)(void 0);function Lv(){let e=(0,z.useContext)(Iv);if(e===void 0)throw Error("Could not find `ConvexProviderWithAuth` (or `ConvexProviderWithClerk` or `ConvexProviderWithAuth0`) as an ancestor component. This component may be missing, or you might have two instances of the `convex/react` module loaded in your project.");return e}function tae({children:e,client:t,useAuth:n}){let{isLoading:r,isAuthenticated:i,fetchAccessToken:a}=n(),[o,s]=(0,z.useState)(null),[c,l]=(0,z.useState)(!1);r&&o!==null&&(s(null),l(!1)),!r&&!i&&o!==!1&&(s(!1),l(!1));let u=i&&(o??!1);return z.createElement(Iv.Provider,{value:{isLoading:o===null,isAuthenticated:u,isRefreshing:c&&u}},z.createElement(nae,{authProviderAuthenticated:i,fetchAccessToken:a,authProviderLoading:r,client:t,setIsConvexAuthenticated:s,setIsRefreshing:l}),z.createElement(Xre,{client:t},e),z.createElement(rae,{authProviderAuthenticated:i,fetchAccessToken:a,authProviderLoading:r,client:t,setIsConvexAuthenticated:s,setIsRefreshing:l}))}function nae({authProviderAuthenticated:e,fetchAccessToken:t,authProviderLoading:n,client:r,setIsConvexAuthenticated:i,setIsRefreshing:a}){return(0,z.useEffect)(()=>{let n=!0;if(e)return r.setAuth(t,e=>{n&&i(()=>e)},e=>{n&&a(e)}),()=>{n=!1,i(e=>e?!1:null),a(!1)}},[e,t,n,r,i,a]),null}function rae({authProviderAuthenticated:e,fetchAccessToken:t,authProviderLoading:n,client:r,setIsConvexAuthenticated:i,setIsRefreshing:a}){return(0,z.useEffect)(()=>{if(e)return()=>{r.clearAuth(),i(()=>null),a(!1)}},[e,t,n,r,i,a]),null}function iae({children:e}){let{isLoading:t,isAuthenticated:n}=Lv();return t||!n?null:z.createElement(z.Fragment,null,e)}function aae({children:e}){let{isLoading:t,isAuthenticated:n}=Lv();return t||n?null:z.createElement(z.Fragment,null,e)}function oae({children:e}){let{isLoading:t}=Lv();return t?z.createElement(z.Fragment,null,e):null}var sae=r(Mv(),1),B=o(),cae=Object.prototype.toString,lae=e=>cae.call(e)===`[object Error]`,uae=new Set([`network error`,`NetworkError when attempting to fetch resource.`,`The Internet connection appears to be offline.`,`Network request failed`,`fetch failed`,`terminated`,` A network error occurred.`,`Network connection lost`]);function dae(e){if(!(e&&lae(e)&&e.name===`TypeError`&&typeof e.message==`string`))return!1;let{message:t,stack:n}=e;return t===`Load failed`||t.startsWith(`Load failed (`)&&t.endsWith(`)`)?n===void 0||`__sentry_captured__`in e:t.startsWith(`error sending request for url`)||t===`Failed to fetch`||t.startsWith(`Failed to fetch (`)&&t.endsWith(`)`)?!0:uae.has(t)}var Rv=[500,2e3],fae=100,zv=(0,z.createContext)(void 0),Bv=(0,z.createContext)(void 0);function pae(){return(0,z.useContext)(Bv)}var Vv=(0,z.createContext)(null),Hv=`__convexAuthOAuthVerifier`,Uv=`__convexAuthJWT`,Wv=`__convexAuthRefreshToken`,Gv=`__convexAuthServerStateFetchTime`;function mae({client:e,serverState:t,onChange:n,shouldHandleCode:r,storage:i,storageNamespace:a,replaceURL:o,children:s}){let c=(0,z.useRef)(t?._state.token??null),[l,u]=(0,z.useState)(c.current===null),[d,f]=(0,z.useState)(c.current),p=e.verbose??!1,m=(0,z.useCallback)(t=>{p&&(console.debug(`${new Date().toISOString()} ${t}`),e.logger?.logVerbose(t))},[p]),{storageSet:h,storageGet:g,storageRemove:_,storageKey:v}=hae(i,a),[y,b]=(0,z.useState)(!1),x=(0,z.useCallback)(async e=>{let t=c.current!==null,r;if(e.tokens===null)c.current=null,e.shouldStore&&(await _(Uv),await _(Wv)),r=null;else{let{token:t}=e.tokens;if(c.current=t,e.shouldStore){let{refreshToken:n}=e.tokens;await h(Uv,t),await h(Wv,n)}r=t}t!==(r!==null)&&await n?.(),f(r),u(!1)},[h,_]);(0,z.useEffect)(()=>{let e=async e=>{if(y)return e.preventDefault(),e.returnValue=!0,`Are you sure you want to leave? Your changes may not be saved.`};return Yv(`beforeunload`,e),()=>{Xv(`beforeunload`,e)}}),(0,z.useEffect)(()=>{let e=e=>{(async()=>{if(e.storageArea===i&&e.key===v(Uv)){let t=e.newValue;m(`synced access token, is null: ${t===null}`),await x({shouldStore:!1,tokens:t===null?null:{token:t}})}})()};return Yv(`storage`,e),()=>Xv(`storage`,e)},[x]);let S=(0,z.useCallback)(async t=>{let n,r=0;for(;r<Rv.length;)try{return await e.unauthenticatedCall(`auth:signIn`,`code`in t?{params:{code:t.code},verifier:t.verifier}:t)}catch(e){if(n=e,!dae(e))break;let t=Rv[r]+fae*Math.random();r++,m(`verifyCode failed with network error, retry ${r} of ${Rv.length} in ${t}ms`),await new Promise(e=>setTimeout(e,t))}throw n},[e]),C=(0,z.useCallback)(async e=>{let{tokens:t}=await S(e);return m(`retrieved tokens, is null: ${t===null}`),await x({shouldStore:!0,tokens:t??null}),t!==null},[e,x]),w=(0,z.useCallback)(async(t,n)=>{let r=n instanceof FormData?Array.from(n.entries()).reduce((e,[t,n])=>(e[t]=n,e),{}):n??{},i=await g(Hv)??void 0;await _(Hv);let a=await e.authenticatedCall(`auth:signIn`,{provider:t,params:r,verifier:i});if(a.redirect!==void 0){let e=new URL(a.redirect);return await h(Hv,a.verifier),navigator.product!==`ReactNative`&&(window.location.href=e.toString()),{signingIn:!1,redirect:e}}else if(a.tokens!==void 0){let{tokens:e}=a;return m(`signed in and got tokens, is null: ${e===null}`),await x({shouldStore:!0,tokens:e}),{signingIn:a.tokens!==null}}return{signingIn:!1}},[e,x,g]),T=(0,z.useCallback)(async()=>{try{await e.authenticatedCall(`auth:signOut`)}catch{}m(`signed out, erasing tokens`),await x({shouldStore:!0,tokens:null})},[x,e]),E=(0,z.useCallback)(async({forceRefreshToken:e})=>{if(e){let e=c.current;return await _ae(Wv,async()=>{let t=c.current;if(t!==e)return m(`returning synced token, is null: ${t===null}`),t;let n=await g(Wv)??null;return n===null?(b(!1),m(`returning null, there is no refresh token`),null):(b(!0),await C({refreshToken:n}).finally(()=>{b(!1)}),m(`returning retrieved token, is null: ${t===null}`),c.current)})}return c.current},[C,T,g]),D=(0,z.useRef)(!1);(0,z.useEffect)(()=>{if(i===void 0)throw Error("`localStorage` is not available in this environment, set the `storage` prop on `ConvexAuthProvider`!");let e=async()=>{let e=await g(Uv)??null;m(`retrieved token from storage, is null: ${e===null}`),await x({shouldStore:!1,tokens:e===null?null:{token:e}})};if(t!==void 0){let n=g(Gv),r=n=>{if(!n||t._timeFetched>+n){let{token:e,refreshToken:n}=t._state,r=e===null||n===null?null:{token:e,refreshToken:n};h(Gv,t._timeFetched.toString()),x({tokens:r,shouldStore:!0})}else e()};n instanceof Promise?n.then(r):r(n);return}let n=window?.location?.search===void 0?null:new URLSearchParams(window.location.search).get(`code`);if(!D.current)if(n&&(r===void 0||(typeof r==`function`?r():r))){D.current=!0;let e=new URL(window.location.href);e.searchParams.delete(`code`),(async()=>{await o(e.pathname+e.search+e.hash),await w(void 0,{code:n}),D.current=!1})()}else e()},[e,g]);let O=(0,z.useMemo)(()=>({signIn:w,signOut:T}),[w,T]),k=d!==null,ee=(0,z.useMemo)(()=>({isLoading:l,isAuthenticated:k,fetchAccessToken:E}),[E,l,k]);return(0,B.jsx)(Bv.Provider,{value:ee,children:(0,B.jsx)(zv.Provider,{value:O,children:(0,B.jsx)(Vv.Provider,{value:d,children:s})})})}function hae(e,t){let n=gae(),r=(0,z.useMemo)(()=>e??n(),[e]),i=t.replace(/[^a-zA-Z0-9]/g,``),a=(0,z.useCallback)(e=>`${e}_${i}`,[t]);return{storageSet:(0,z.useCallback)((e,t)=>r.setItem(a(e),t),[r,a]),storageGet:(0,z.useCallback)(e=>r.getItem(a(e)),[r,a]),storageRemove:(0,z.useCallback)(e=>r.removeItem(a(e)),[r,a]),storageKey:a}}function gae(){let[e,t]=(0,z.useState)({});return()=>({getItem:t=>e[t],setItem:(e,n)=>{t(t=>({...t,[e]:n}))},removeItem:e=>{t(t=>{let{[e]:n,...r}=t;return r})}})}async function _ae(e,t){let n=window?.navigator?.locks;return n===void 0?await vae(e,t):await n.request(e,t)}function Kv(e){globalThis.__convexAuthMutexes===void 0&&(globalThis.__convexAuthMutexes={});let t=globalThis.__convexAuthMutexes[e];return t===void 0&&(globalThis.__convexAuthMutexes[e]={currentlyRunning:null,waiting:[]}),t=globalThis.__convexAuthMutexes[e],t}function qv(e,t){globalThis.__convexAuthMutexes[e]=t}async function Jv(e,t){let n=Kv(e);n.currentlyRunning===null?qv(e,{currentlyRunning:t().finally(()=>{let t=Kv(e).waiting.shift();Kv(e).currentlyRunning=null,qv(e,{...Kv(e),currentlyRunning:t===void 0?null:Jv(e,t)})}),waiting:[]}):qv(e,{...n,waiting:[...n.waiting,t]})}async function vae(e,t){return new Promise((n,r)=>{Jv(e,()=>t().then(e=>n(e)).catch(e=>r(e)))})}function Yv(e,t,n){typeof window>`u`||window.addEventListener?.(e,t,n)}function Xv(e,t,n){typeof window>`u`||window.removeEventListener?.(e,t,n)}function Zv(){return(0,z.useContext)(zv)}function yae(e){let{client:t,storage:n,storageNamespace:r,replaceURL:i,shouldHandleCode:a,children:o}=e;return(0,B.jsx)(mae,{client:(0,z.useMemo)(()=>({authenticatedCall(e,n){return t.action(e,n)},unauthenticatedCall(e,n){return new eae(t.address,{logger:t.logger}).action(e,n)},verbose:t.options?.verbose,logger:t.logger}),[t]),storage:n??(typeof window>`u`?void 0:window?.localStorage),storageNamespace:r??t.address,replaceURL:i??(e=>{window.history.replaceState({},``,e)}),shouldHandleCode:a,children:(0,B.jsx)(tae,{client:t,useAuth:pae,children:o})})}function Qv(){return(0,z.useContext)(Vv)}var $v=z.use,ey=typeof window<`u`?z.useLayoutEffect:z.useEffect;function ty(e){let t=z.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function bae(e,t,n={},r={}){z.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!=`function`)return;let i=new IntersectionObserver(([e])=>{t(e)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,n,r.disabled,e])}function xae(e){let t=z.useRef(null);return z.useImperativeHandle(e,()=>t.current,[]),t}function ny(e){return e[e.length-1]}function Sae(e){return typeof e==`function`}function ry(e,t){return Sae(e)?e(t):e}var iy=Object.prototype.hasOwnProperty,ay=Object.prototype.propertyIsEnumerable;function oy(e){for(let t in e)if(iy.call(e,t))return!0;return!1}var Cae=()=>Object.create(null),sy=(e,t)=>cy(e,t,Cae);function cy(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=fy(e)&&fy(i);if(!a&&!(uy(e)&&uy(i)))return i;let o=a?e:ly(e);if(!o)return i;let s=a?i:ly(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:iy.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=cy(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function ly(e){let t=Object.getOwnPropertyNames(e);for(let n of t)if(!ay.call(e,n))return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;let r=t;for(let t of n){if(!ay.call(e,t))return!1;r.push(t)}return r}function uy(e){if(!dy(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!dy(n)||!n.hasOwnProperty(`isPrototypeOf`))}function dy(e){return Object.prototype.toString.call(e)===`[object Object]`}function fy(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function py(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!py(e[r],t[r],n))return!1;return!0}if(uy(e)&&uy(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!py(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!py(e[o],t[o],n)))return!1;return i===a}return!1}function my(e){let t,n,r=new Promise((e,r)=>{t=e,n=r});return r.status=`pending`,r.resolve=n=>{r.status=`resolved`,r.value=n,t(n),e?.(n)},r.reject=e=>{r.status=`rejected`,n(e)},r}function wae(e){return typeof e?.message==`string`?e.message.startsWith(`Failed to fetch dynamically imported module`)||e.message.startsWith(`error loading dynamically imported module`)||e.message.startsWith(`Importing a module script failed`):!1}function hy(e){return!!(e&&typeof e==`object`&&typeof e.then==`function`)}function Tae(e){return e.replace(/[\x00-\x1f\x7f]/g,``)}function gy(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return Tae(t)}var Eae=[`http:`,`https:`,`mailto:`,`tel:`];function _y(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function vy(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=gy(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=gy(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function Dae(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Oae(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function yy(){throw Error(`Invariant failed`)}function by(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var xy=4,Sy=5;function kae(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);return n===-1||t+1>=e.length?null:[t,n]}function Cy(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=kae(a);if(o){let[r,s]=o,c=a.charCodeAt(r+1);if(c===45){if(r+2<a.length&&a.charCodeAt(r+2)===36){let e=r+3,a=s;if(e<a)return n[0]=3,n[1]=t+r,n[2]=t+e,n[3]=t+a,n[4]=t+s+1,n[5]=i,n}}else if(c===36){let a=r+1,o=r+2;return o===s?(n[0]=2,n[1]=t+r,n[2]=t+a,n[3]=t+o,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+r,n[2]=t+o,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function wy(e,t,n,r,i,a,o){o?.(n);let s=r;{let r=n.fullPath??n.from,o=r.length,c=n.options?.caseSensitive??e,l=n.options?.params?.parse??n.options?.parseParams;for(;s<o;){let e=Cy(r,s,t),o,u=s,d=e[5];switch(s=d+1,a++,e[0]){case 0:{let t=r.substring(e[2],e[3]);if(c){let e=i.static?.get(t);if(e)o=e;else{i.static??=new Map;let e=Dy(n.fullPath??n.from);e.parent=i,e.depth=a,o=e,i.static.set(t,e)}}else{let e=t.toLowerCase(),r=i.staticInsensitive?.get(e);if(r)o=r;else{i.staticInsensitive??=new Map;let t=Dy(n.fullPath??n.from);t.parent=i,t.depth=a,o=t,i.staticInsensitive.set(e,t)}}break}case 1:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.dynamic?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=Oy(1,n.fullPath??n.from,f,p,m);o=e,e.depth=a,e.parent=i,i.dynamic??=[],i.dynamic.push(e)}break}case 3:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),f=c&&!!(t||s),p=t?f?t:t.toLowerCase():void 0,m=s?f?s:s.toLowerCase():void 0,h=!l&&i.optional?.find(e=>!e.parse&&e.caseSensitive===f&&e.prefix===p&&e.suffix===m);if(h)o=h;else{let e=Oy(3,n.fullPath??n.from,f,p,m);o=e,e.parent=i,e.depth=a,i.optional??=[],i.optional.push(e)}break}case 2:{let t=r.substring(u,e[1]),s=r.substring(e[4],d),l=c&&!!(t||s),f=t?l?t:t.toLowerCase():void 0,p=s?l?s:s.toLowerCase():void 0,m=Oy(2,n.fullPath??n.from,l,f,p);o=m,m.parent=i,m.depth=a,i.wildcard??=[],i.wildcard.push(m)}}i=o}if(l&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=Dy(n.fullPath??n.from);e.kind=Sy,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let u=(n.path||!n.children)&&!n.isRoot;if(u&&r.endsWith(`/`)){let e=Dy(n.fullPath??n.from);e.kind=xy,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=l??null,i.priority=n.options?.params?.priority??0,u&&!i.route&&(i.route=n,i.fullPath=n.fullPath??n.from)}if(n.children)for(let r of n.children)wy(e,t,r,s,i,a,o)}function Ty(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Ey(e){if(e.pathless)for(let t of e.pathless)Ey(t);if(e.static)for(let t of e.static.values())Ey(t);if(e.staticInsensitive)for(let t of e.staticInsensitive.values())Ey(t);if(e.dynamic?.length){e.dynamic.sort(Ty);for(let t of e.dynamic)Ey(t)}if(e.optional?.length){e.optional.sort(Ty);for(let t of e.optional)Ey(t)}if(e.wildcard?.length){e.wildcard.sort(Ty);for(let t of e.wildcard)Ey(t)}}function Dy(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function Oy(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function Aae(e,t){let n=Dy(`/`),r=new Uint16Array(6);for(let t of e)wy(!1,r,t,1,n,0);Ey(n),t.masksTree=n,t.flatCache=by(1e3)}function jae(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=ky(e,t.masksTree);return t.flatCache.set(e,r),r}function Mae(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=Dy(`/`),wy(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),ky(r,o,n)}function Nae(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=ky(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=jy(a.route)),t.matchCache.set(r,a),a}function Pae(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function Fae(e,t=!1,n){let r=Dy(e.fullPath),i=new Uint16Array(6),a={},o={},s=0;return wy(t,i,e,1,r,0,e=>{if(n?.(e,s),e.id in a&&yy(),a[e.id]=e,s!==0&&e.path){let t=Pae(e.fullPath);(!o[t]||e.fullPath.endsWith(`/`))&&(o[t]=e)}s++}),Ey(r),{processedTree:{segmentTree:r,singleCache:by(1e3),matchCache:by(1e3),flatCache:null,masksTree:null},routesById:a,routesByPath:o}}function ky(e,t,n=!1){let r=e.split(`/`),i=Lae(e,r,t,n);if(!i)return null;let[a]=Ay(e,r,i);return{route:i.node.route,rawParams:a}}function Ay(e,t,n){let r=Iae(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===xy)break;if(u.kind===Sy){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0;if(e.charCodeAt(t)===123){let n=u.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0,r=u.suffix?.length??0,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function jy(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Iae(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Lae(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!ny(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,depth:1,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,depth:f,statics:p,dynamics:m,optionals:h}=n,{extract:g,rawParams:_}=n;if(i.kind===2&&i.route&&!Py(l,n))continue;if(i.parse){if(!Ny(e,t,n))continue;_=n.rawParams,g=n.extract}r&&i.route&&i.kind!==xy&&Py(c,n)&&(c=n);let v=u===o;if(v&&(i.route&&(!a||i.kind===xy||i.kind===2)&&Py(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let y=v?void 0:t[u],b;if(v&&i.index){let n={node:i.index,index:u,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_},r=!0;if(i.index.parse&&(Ny(e,t,n)||(r=!1)),r){if(!m&&!h&&!d&&Rae(p,o))return n;Py(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!(r&&(v||!(n.caseSensitive?y:b??=y.toLowerCase()).startsWith(r)))){if(a){if(v)continue;let e=t.slice(u).join(`/`).slice(-a.length);if((n.caseSensitive?e:e.toLowerCase())!==a)continue}s.push({node:n,index:o,skipped:d,depth:f+1,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}if(i.optional){let e=d|1<<f,t=f+1;for(let n=i.optional.length-1;n>=0;n--){let r=i.optional[n];s.push({node:r,index:u,skipped:e,depth:t,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v)for(let e=i.optional.length-1;e>=0;e--){let n=i.optional[e],{prefix:r,suffix:a}=n;if(r||a){let e=n.caseSensitive?y:b??=y.toLowerCase();if(r&&!e.startsWith(r)||a&&!e.endsWith(a))continue}s.push({node:n,index:u+1,skipped:d,depth:t,statics:p,dynamics:m,optionals:h+My(o,u),extract:g,rawParams:_})}}if(!v&&i.dynamic&&y)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?y:b??=y.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,depth:f+1,statics:p,dynamics:m+My(o,u),optionals:h,extract:g,rawParams:_})}if(!v&&i.staticInsensitive){let e=i.staticInsensitive.get(b??=y.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+My(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(!v&&i.static){let e=i.static.get(y);e&&s.push({node:e,index:u+1,skipped:d,depth:f+1,statics:p+My(o,u),dynamics:m,optionals:h,extract:g,rawParams:_})}if(i.pathless){let e=f+1;for(let t=i.pathless.length-1;t>=0;t--){let n=i.pathless[t];s.push({node:n,index:u,skipped:d,depth:e,statics:p,dynamics:m,optionals:h,extract:g,rawParams:_})}}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function My(e,t){return 2**(e-t-1)}function Rae(e,t){return e===2**(t-1)-1}function Ny(e,t,n){let r,i;try{[r,i]=Ay(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function Py(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===xy)>(e.node.kind===xy)||t.node.kind===xy==(e.node.kind===xy)&&t.depth>e.depth))):!0}function Fy(e){return Iy(e.filter(e=>e!==void 0).join(`/`))}function Iy(e){return e.replace(/\/{2,}/g,`/`)}function Ly(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function Ry(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function zy(e){return Ry(Ly(e))}function By(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function Vy(e,t,n){return By(e,n)===By(t,n)}function Hy({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t.startsWith(`/`),a=!i&&t===`.`,o;if(r){o=i?t:a?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(a)s=e.split(`/`);else if(i)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&&ny(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.pop():r===`.`||s.push(r)}}s.length>1&&(ny(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=Iy(s.join(`/`))||`/`;return o&&r&&r.set(o,c),c}function Uy(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function Wy(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>Ky(e,n)).join(`/`):Ky(r,n):r}function Gy({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=Cy(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=Wy(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=Wy(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=Wy(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function Ky(e,t){let n=encodeURIComponent(e);return t?.(n)??n}function qy(e){return e?.isNotFound===!0}function Jy(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function Yy(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function Xy(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=Yy(r):Array.isArray(t)?t.push(Yy(r)):n[e]=[t,Yy(r)]}return n}var Zy=$y(JSON.parse),Qy=eb(JSON.stringify,JSON.parse);function $y(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=Xy(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function eb(e,t){let n=typeof t==`function`;function r(r){if(typeof r==`object`&&r)try{return e(r)}catch{}else if(n&&typeof r==`string`)try{return t(r),e(r)}catch{}return r}return e=>{let t=Jy(e,r);return t?`?${t}`:``}}var tb=`__root__`;function nb(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function rb(e){return e instanceof Response&&!!e.options}var ib=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},ab=e=>e.stores.matchesId.get().some(t=>e.stores.matchStores.get(t)?.get()._forcePending),ob=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),sb=(e,t,n=!0)=>{let r={...e.router.options.context??{}},i=n?t:t-1;for(let t=0;t<=i;t++){let n=e.matches[t];if(!n)continue;let i=e.router.getMatch(n.id);i&&Object.assign(r,i.__routeContext,i.__beforeLoadContext)}return r},cb=(e,t)=>{if(!e.matches.length)return;let n=t.routeId,r=e.matches.findIndex(t=>t.routeId===e.router.routeTree.id),i=r>=0?r:0,a=n?e.matches.findIndex(e=>e.routeId===n):e.firstBadMatchIndex??e.matches.length-1;a<0&&(a=i);for(let t=a;t>=0;t--){let n=e.matches[t];if(e.router.looseRoutesById[n.routeId].options.notFoundComponent)return t}return n?a:i},lb=(e,t,n)=>{if(!(!rb(n)&&!qy(n)))throw rb(n)&&n.redirectHandled&&!n.options.reloadDocument?n:(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,r=>({...r,status:rb(n)?`redirected`:qy(n)?`notFound`:r.status===`pending`?`success`:r.status,context:sb(e,t.index),isFetching:!1,error:n})),qy(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),rb(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n)),n)},ub=(e,t)=>{let n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},db=(e,t,n)=>{let r=sb(e,n);e.updateMatch(t,e=>({...e,context:r}))},fb=(e,t,n)=>{let{id:r,routeId:i}=e.matches[t],a=e.router.looseRoutesById[i];if(n instanceof Promise)throw n;e.firstBadMatchIndex??=t,lb(e,e.router.getMatch(r),n);try{a.options.onError?.(n)}catch(t){n=t,lb(e,e.router.getMatch(r),n)}e.updateMatch(r,e=>(e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loadPromise?.resolve(),{...e,error:n,status:`error`,isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!rb(n)&&!qy(n)&&(e.serialError??=n)},pb=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;let i=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!ob(e,t)&&(n.options.loader||n.options.beforeLoad||wb(n))&&typeof i==`number`&&i!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){let t=setTimeout(()=>{ib(e)},i);r._nonReactive.pendingTimeout=t}},mb=(e,t,n)=>{let r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;pb(e,t,n,r);let i=()=>{let n=e.router.getMatch(t);n.preload&&(n.status===`redirected`||n.status===`notFound`)&&lb(e,n,n.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(i):i()},hb=(e,t,n,r)=>{let i=e.router.getMatch(t),a=i._nonReactive.loadPromise;i._nonReactive.loadPromise=my(()=>{a?.resolve(),a=void 0});let{paramsError:o,searchError:s}=i;o&&fb(e,n,o),s&&fb(e,n,s),pb(e,t,r,i);let c=new AbortController,l=!1,u=()=>{l||(l=!0,e.updateMatch(t,e=>({...e,isFetching:`beforeLoad`,fetchCount:e.fetchCount+1,abortController:c})))},d=()=>{i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,e=>({...e,isFetching:!1}))};if(!r.options.beforeLoad){e.router.batch(()=>{u(),d()});return}i._nonReactive.beforeLoadPromise=my();let f={...sb(e,n,!1),...i.__routeContext},{search:p,params:m,cause:h}=i,g=ob(e,t),_={search:p,abortController:c,params:m,preload:g,context:f,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:g?`preload`:h,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},v=r=>{if(r===void 0){e.router.batch(()=>{u(),d()});return}(rb(r)||qy(r))&&(u(),fb(e,n,r)),e.router.batch(()=>{u(),e.updateMatch(t,e=>({...e,__beforeLoadContext:r})),d()})},y;try{if(y=r.options.beforeLoad(_),hy(y))return u(),y.catch(t=>{fb(e,n,t)}).then(v)}catch(t){u(),fb(e,n,t)}v(y)},gb=(e,t)=>{let{id:n,routeId:r}=e.matches[t],i=e.router.looseRoutesById[r],a=()=>s(),o=()=>hb(e,n,t,i),s=()=>{if(ub(e,n))return;let t=mb(e,n,i);return hy(t)?t.then(o):o()};return a()},_b=(e,t,n)=>{let r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;let i={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(i),n.options.scripts?.(i),n.options.headers?.(i)]).then(([e,t,n])=>({meta:e?.meta,links:e?.links,headScripts:e?.scripts,headers:n,scripts:t,styles:e?.styles}))},vb=(e,t,n,r,i)=>{let a=t[r-1],{params:o,loaderDeps:s,abortController:c,cause:l}=e.router.getMatch(n),u=sb(e,r),d=ob(e,n);return{params:o,deps:s,preload:!!d,parentMatchPromise:a,abortController:c,context:u,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),cause:d?`preload`:l,route:i,...e.router.options.additionalContext}},yb=async(e,t,n,r,i)=>{try{let a=e.router.getMatch(n);try{Cb(i);let o=i.options.loader,s=typeof o==`function`?o:o?.handler,c=s?.(vb(e,t,n,r,i)),l=!!s&&hy(c);if((l||i._lazyPromise||i._componentsPromise||i.options.head||i.options.scripts||i.options.headers||a._nonReactive.minPendingPromise)&&e.updateMatch(n,e=>({...e,isFetching:`loader`})),s){let t=l?await c:c;lb(e,e.router.getMatch(n),t),t!==void 0&&e.updateMatch(n,e=>({...e,loaderData:t}))}i._lazyPromise&&await i._lazyPromise;let u=a._nonReactive.minPendingPromise;u&&await u,i._componentsPromise&&await i._componentsPromise,e.updateMatch(n,t=>({...t,error:void 0,context:sb(e,r),status:`success`,isFetching:!1,updatedAt:Date.now()}))}catch(t){let o=t;if(o?.name===`AbortError`){if(a.abortController.signal.aborted){a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,t=>({...t,status:t.status===`pending`?`success`:t.status,isFetching:!1,context:sb(e,r)}));return}let s=a._nonReactive.minPendingPromise;s&&await s,qy(t)&&await i.options.notFoundComponent?.preload?.(),lb(e,e.router.getMatch(n),t);try{i.options.onError?.(t)}catch(t){o=t,lb(e,e.router.getMatch(n),t)}!rb(o)&&!qy(o)&&await Cb(i,[`errorComponent`]),e.updateMatch(n,t=>({...t,error:o,context:sb(e,r),status:`error`,isFetching:!1}))}}catch(t){let r=e.router.getMatch(n);r&&(r._nonReactive.loaderPromise=void 0),lb(e,r,t)}},bb=async(e,t,n)=>{async function r(r,a,c,l,d){let f=Date.now()-a.updatedAt,p=r?d.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:d.options.staleTime??e.router.options.defaultStaleTime??0,m=d.options.shouldReload,h=typeof m==`function`?m(vb(e,t,i,n,d)):m,{status:g,invalid:_}=l,v=f>=p&&(!!e.forceStaleReload||l.cause===`enter`||c!==void 0&&c!==l.id);o=g===`success`&&(_||(h??v)),r&&d.options.preload===!1||(o&&!e.sync&&u?(s=!0,(async()=>{try{await yb(e,t,i,n,d);let r=e.router.getMatch(i);r._nonReactive.loaderPromise?.resolve(),r._nonReactive.loadPromise?.resolve(),r._nonReactive.loaderPromise=void 0,r._nonReactive.loadPromise=void 0}catch(t){rb(t)&&await e.router.navigate(t.options)}})()):g!==`success`||o?await yb(e,t,i,n,d):db(e,i,n))}let{id:i,routeId:a}=e.matches[n],o=!1,s=!1,c=e.router.looseRoutesById[a],l=c.options.loader,u=((typeof l==`function`?void 0:l?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!==`blocking`;if(ub(e,i)){if(!e.router.getMatch(i))return e.matches[n];db(e,i,n)}else{let t=e.router.getMatch(i),o=e.router.stores.matchesId.get()[n],s=(o&&e.router.stores.matchStores.get(o)||null)?.routeId===a?o:e.router.stores.matches.get().find(e=>e.routeId===a)?.id,l=ob(e,i);if(t._nonReactive.loaderPromise){if(t.status===`success`&&!e.sync&&!t.preload&&u)return t;await t._nonReactive.loaderPromise;let n=e.router.getMatch(i),a=n._nonReactive.error||n.error;a&&lb(e,n,a),n.status===`pending`&&await r(l,t,s,n,c)}else{let n=l&&!e.router.stores.matchStores.has(i),a=e.router.getMatch(i);a._nonReactive.loaderPromise=my(),n!==a.preload&&e.updateMatch(i,e=>({...e,preload:n})),await r(l,t,s,a,c)}}let d=e.router.getMatch(i);s||(d._nonReactive.loaderPromise?.resolve(),d._nonReactive.loadPromise?.resolve(),d._nonReactive.loadPromise=void 0),clearTimeout(d._nonReactive.pendingTimeout),d._nonReactive.pendingTimeout=void 0,s||(d._nonReactive.loaderPromise=void 0),d._nonReactive.dehydrated=void 0;let f=s?d.isFetching:!1;return f!==d.isFetching||d.invalid!==!1?(e.updateMatch(i,e=>({...e,isFetching:f,invalid:!1})),e.router.getMatch(i)):d};async function xb(e){let t=e,n=[];ab(t.router)&&ib(t);let r;for(let e=0;e<t.matches.length;e++){try{let n=gb(t,e);hy(n)&&await n}catch(e){if(rb(e))throw e;if(qy(e))r=e;else if(!t.preload)throw e;break}if(t.serialError||t.firstBadMatchIndex!=null)break}let i=t.firstBadMatchIndex??t.matches.length,a=r&&!t.preload?cb(t,r):void 0,o=r&&t.preload?0:a===void 0?i:Math.min(a+1,i),s,c;for(let e=0;e<o;e++)n.push(bb(t,n,e));try{await Promise.all(n)}catch{let e=await Promise.allSettled(n);for(let t of e){if(t.status!==`rejected`)continue;let e=t.reason;if(rb(e))throw e;qy(e)?s??=e:c??=e}if(c!==void 0)throw c}let l=s??(r&&!t.preload?r:void 0),u=t.firstBadMatchIndex===void 0?t.matches.length-1:t.firstBadMatchIndex;if(!l&&r&&t.preload)return t.matches;if(l){let e=cb(t,l);e===void 0&&yy();let n=t.matches[e],r=t.router.looseRoutesById[n.routeId],i=t.router.options?.defaultNotFoundComponent;!r.options.notFoundComponent&&i&&(r.options.notFoundComponent=i),l.routeId=n.routeId;let a=n.routeId===t.router.routeTree.id;t.updateMatch(n.id,e=>({...e,...a?{status:`success`,globalNotFound:!0,error:void 0}:{status:`notFound`,error:l},isFetching:!1})),u=e,await Cb(r,[`notFoundComponent`])}else if(!t.preload){let e=t.matches[0];e.globalNotFound||t.router.getMatch(e.id)?.globalNotFound&&t.updateMatch(e.id,e=>({...e,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){let e=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await Cb(e,[`errorComponent`])}for(let e=0;e<=u;e++){let{id:n,routeId:r}=t.matches[e],i=t.router.looseRoutesById[r];try{let e=_b(t,n,i);if(e){let r=await e;t.updateMatch(n,e=>({...e,...r}))}}catch(e){console.error(`Error executing head for route ${r}:`,e)}}let d=ib(t);if(hy(d)&&await d,l)throw l;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function Sb(e,t){let n=t.map(t=>e.options[t]?.preload?.()).filter(Boolean);if(n.length!==0)return Promise.all(n)}function Cb(e,t=Tb){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);let n=()=>e._componentsLoaded?void 0:t===Tb?(()=>{if(e._componentsPromise===void 0){let t=Sb(e,Tb);t?e._componentsPromise=t.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():Sb(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function wb(e){for(let t of Tb)if(e.options[t]?.preload)return!0;return!1}var Tb=[`component`,`errorComponent`,`pendingComponent`,`notFoundComponent`];function Eb(e){return{input:({url:t})=>{for(let n of e)t=Ob(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=kb(e[n],t);return t}}}function Db(e){let t=zy(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),i=`${r}/`;return{input:({url:t})=>{let a=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return a===r?t.pathname=`/`:a.startsWith(i)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=Fy([`/`,t,e.pathname]),e)}}function Ob(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function kb(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Ab(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i,init:a}=t,o=new Map,s=new Map,c=new Map,l=n(e.status),u=n(e.loadedAt),d=n(e.isLoading),f=n(e.isTransitioning),p=n(e.location),m=n(e.resolvedLocation),h=n(e.statusCode),g=n(e.redirect),_=n([]),v=n([]),y=n([]),b=r(()=>jb(o,_.get())),x=r(()=>jb(s,v.get())),S=r(()=>jb(c,y.get())),C=r(()=>_.get()[0]),w=r(()=>_.get().some(e=>o.get(e)?.get().status===`pending`)),T=r(()=>({locationHref:p.get().href,resolvedLocationHref:m.get()?.href,status:l.get()})),E=r(()=>({status:l.get(),loadedAt:u.get(),isLoading:d.get(),isTransitioning:f.get(),matches:b.get(),location:p.get(),resolvedLocation:m.get(),statusCode:h.get(),redirect:g.get()})),D=by(64);function O(e){let t=D.get(e);return t||(t=r(()=>{let t=_.get();for(let n of t){let t=o.get(n);if(t&&t.routeId===e)return t.get()}}),D.set(e,t)),t}let k={status:l,loadedAt:u,isLoading:d,isTransitioning:f,location:p,resolvedLocation:m,statusCode:h,redirect:g,matchesId:_,pendingIds:v,cachedIds:y,matches:b,pendingMatches:x,cachedMatches:S,firstId:C,hasPending:w,matchRouteDeps:T,matchStores:o,pendingMatchStores:s,cachedMatchStores:c,__store:E,getRouteMatchStore:O,setMatches:ee,setPending:A,setCached:j};ee(e.matches),a?.(k);function ee(e){Mb(e,o,_,n,i)}function A(e){Mb(e,s,v,n,i)}function j(e){Mb(e,c,y,n,i)}return k}function jb(e,t){let n=[];for(let r of t){let t=e.get(r);t&&n.push(t.get())}return n}function Mb(e,t,n,r,i){let a=e.map(e=>e.id),o=new Set(a);i(()=>{for(let e of t.keys())o.has(e)||t.delete(e);for(let n of e){let e=t.get(n.id);if(!e){let e=r(n);e.routeId=n.routeId,t.set(n.id,e);continue}e.routeId=n.routeId,e.get()!==n&&e.set(n)}Oae(n.get(),a)||n.set(a)})}var Nb=`__TSR_index`,Pb=`popstate`,Fb=`beforeunload`;function zae(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=Lb(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[Nb];i=Ib(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[Nb];i=Ib(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[Nb]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function Ib(e,t){t||={};let n=Rb();return{...t,key:n,__TSR_key:n,[Nb]:e}}function Bae(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>Lb(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=Rb();t.history.replaceState({[Nb]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_,v=()=>{g&&(C._ignoreSubscribers=!0,(g.isPush?t.history.pushState:t.history.replaceState)(g.state,``,g.href),C._ignoreSubscribers=!1,g=void 0,_=void 0,u=void 0)},y=(e,t,n)=>{let r=s(t);_||(u=l),l=Lb(t,n),g={href:r,state:n,isPush:g?.isPush||e===`push`},_||=Promise.resolve().then(()=>v())},b=e=>{l=c(),C.notify({type:e})},x=async()=>{if(f){f=!1;return}let e=c(),n=e.state[Nb]-l.state[Nb],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),C.notify(u);return}}}l=c(),C.notify(u)},S=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},C=zae({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>y(`push`,e,t),replaceState:(e,t)=>y(`replace`,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Fb,S,{capture:!0}),t.removeEventListener(Pb,x)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(Fb,S,{capture:!0}),t.addEventListener(Pb,x),t.history.pushState=function(...e){let r=n.apply(t.history,e);return C._ignoreSubscribers||b(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return C._ignoreSubscribers||b(`REPLACE`),n},C}function Vae(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function Lb(e,t){let n=Vae(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=Rb();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[Nb]:0,key:a,__TSR_key:a}}}function Rb(){return(Math.random()+1).toString(36).substring(7)}function zb(e,t){let n=t,r=e;return{fromLocation:n,toLocation:r,pathChanged:n?.pathname!==r.pathname,hrefChanged:n?.href!==r.href,hashChanged:n?.hash!==r.hash}}var Bb=new WeakMap,Hae=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.routeBranchCache=new WeakMap,this.startTransition=e=>e(),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=Uy(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=Bae()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!==`null`?this.origin=window.origin:this.origin=`http://localhost`),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=by(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=Ab(Wae(this.latestLocation),e),toe(this)}let a=!1,o=this.options.basepath??`/`,s=this.options.rewrite;if(r||n!==o||i!==s){this.basepath=o;let e=[],t=zy(o);t&&t!==`/`&&e.push(Db({basepath:o})),s&&e.push(s),this.rewrite=e.length===0?void 0:e.length===1?e[0]:Eb(e),this.history&&this.updateLatestLocation(),a=!0}a&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<`u`&&`CSS`in window&&typeof window.CSS?.supports==`function`&&(this.isViewTransitionTypesSupported=window.CSS.supports(`selector(:active-view-transition-type(a))`))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=Fae(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&Aae(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{this.subscribers.forEach(t=>{t.eventType===e.type&&t.fn(e)})},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:i,state:a})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let i=this.options.parseSearch(n),o=this.options.stringifySearch(i);return{href:e+o+r,publicHref:e+o+r,pathname:vy(e).path,external:!1,searchStr:o,search:sy(t?.search,i),hash:vy(r.slice(1)).path,state:cy(t?.state,a)}}let o=new URL(i,this.origin),s=Ob(this.rewrite,o),c=this.options.parseSearch(s.search),l=this.options.stringifySearch(c);return s.search=l,{href:s.href.replace(s.origin,``),publicHref:i,pathname:vy(s.pathname).path,external:!!this.rewrite&&s.origin!==this.origin,searchStr:l,search:sy(t?.search,c),hash:vy(s.hash.slice(1)).path,state:cy(t?.state,a)}},r=n(e),{__tempLocation:i,__tempKey:a}=r.state;if(i&&(!a||a===this.tempLocationKey)){let e=n(i);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>Hy({base:e,to:t.includes(`//`)?Iy(t):t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>Gae({pathname:e,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=e=>{let t=this.getMatch(e);t&&(t.abortController.abort(),clearTimeout(t._nonReactive.pendingTimeout),t._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(e=>{this.cancelMatch(e)}),this.stores.matchesId.get().forEach(e=>{if(this.stores.pendingMatchStores.has(e))return;let t=this.stores.matchStores.get(e)?.get();t&&(t.status===`pending`||t.isFetching===`loader`)&&this.cancelMatch(e)})},this.buildLocation=e=>{let t=(t={})=>{let n=t._fromLocation||this.pendingBuiltLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let i=t.unsafeRelative===`path`?n.pathname:t.from??r.fullPath,a=t.to?`${t.to}`:void 0,o=r.search,s=Object.assign(Object.create(null),r.params),c=a?.charCodeAt(0)===47?`/`:this.resolvePathWithBase(i,`.`),l=a?this.resolvePathWithBase(c,a):c,u=t.params===!1||t.params===null?Object.create(null):(t.params??!0)===!0?s:Object.assign(s,ry(t.params,s)),d=this.routesByPath[Ry(l)],f;if(d)f=this.getRouteBranch(d);else if(l.includes(`$`))f=[];else{let e=this.getMatchedRoutes(l);f=e.matchedRoutes,this.options.notFoundRoute&&(!e.foundRoute||e.foundRoute.path!==`/`&&e.routeParams[`**`])&&(f=[...f,this.options.notFoundRoute])}if(f.length&&oy(u))for(let e of f){let t=e.options.params?.stringify??e.options.stringifyParams;if(t)try{Object.assign(u,t(u))}catch{}}let p=e.leaveParams?l:vy(Gy({path:l,params:u,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,m=o;if(e._includeValidateSearch&&this.options.search?.strict){let e={};f.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,Hb(t.options.validateSearch,{...e,...m}))}catch{}}),m=e}m=Kae({search:m,dest:t,destRoutes:f,_includeValidateSearch:e._includeValidateSearch}),m=sy(o,m);let h=this.options.stringifySearch(m),g=t.hash===!0?n.hash:t.hash?ry(t.hash,n.hash):void 0,_=g?`#${g}`:``,v=t.state===!0?n.state:t.state?ry(t.state,n.state):{};v=cy(n.state,v);let y=`${p}${h}${_}`,b,x,S=!1;if(this.rewrite){let e=new URL(y,this.origin),t=kb(this.rewrite,e);b=e.href.replace(e.origin,``),t.origin===this.origin?x=t.pathname+t.search+t.hash:(x=t.href,S=!0)}else b=Dae(y),x=b;return{publicHref:x,href:b,pathname:p,search:m,searchStr:h,state:v,hash:g??``,external:S,unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{let i=t(n),a=r?t(r):void 0;if(!a){let n=Object.create(null);if(this.options.routeMasks){let o=jae(i.pathname,this.processedTree);if(o){Object.assign(n,o.rawParams);let{from:i,params:s,...c}=o.route,l=s===!1||s===null?Object.create(null):(s??!0)===!0?n:Object.assign(n,ry(s,n));r={from:e.from,...c,params:l},a=t(r)}}}return a&&(i.maskedLocation=a),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=()=>{let e=[`key`,`__TSR_key`,`__TSR_index`,`__hashScrollIntoViewOptions`];e.forEach(e=>{n.state[e]=this.latestLocation.state[e]});let t=py(n.state,this.latestLocation.state);return e.forEach(e=>{delete n.state[e]}),t},a=Ry(this.latestLocation.href)===Ry(n.href),o=this.commitLocationPromise;if(this.commitLocationPromise=my(()=>{o?.resolve(),o=void 0}),a&&i())this.load();else{let{maskedLocation:i,hashScrollIntoView:a,...o}=n;i&&(o={...i,state:{...i.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,r=n.replace?`REPLACE`:`PUSH`,this.history[r===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t})}return this._scroll.next=n.resetScroll??!0,this.history.subscribers.size||this.load(r?{action:{type:r}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,href:a,...o}={})=>{if(a){let t=this.history.location.state.__TSR_index,n=Lb(a,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);o.to=Ob(this.rewrite,r).pathname,o.search=this.options.parseSearch(n.search),o.hash=n.hash.slice(1)}let s=this.buildLocation({...o,_includeValidateSearch:!0});this.pendingBuiltLocation=s;let c=this.commitLocation({...s,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return Promise.resolve().then(()=>{this.pendingBuiltLocation===s&&(this.pendingBuiltLocation=void 0)}),c},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(_y(t,this.protocolAllowlist))return Promise.resolve();if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return Promise.resolve()}return i.replace?window.location.replace(t):window.location.href=t,Promise.resolve()}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();let e=this.matchRoutes(this.latestLocation),t=this.stores.cachedMatches.get().filter(t=>!e.some(e=>e.id===t.id));this.batch(()=>{this.stores.status.set(`pending`),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(e),this.stores.setCached(t)})},this.load=async e=>{let t=e?.action?.type,n,r,i,a=this.stores.resolvedLocation.get()??this.stores.location.get();for(i=new Promise(o=>{this.startTransition(async()=>{try{this.beforeLoad(),t?Bb.set(this.latestLocation,t):Bb.delete(this.latestLocation);let n=this.latestLocation,r=zb(n,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:`onBeforeNavigate`,...r}),this.emit({type:`onBeforeLoad`,...r}),await xb({router:this,sync:e?.sync,forceStaleReload:a.href===n.href,matches:this.stores.pendingMatches.get(),location:n,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let e=null,t=null,n=null,r=null;this.batch(()=>{let i=this.stores.pendingMatches.get(),a=i.length,o=this.stores.matches.get();e=a?o.filter(e=>!this.stores.pendingMatchStores.has(e.id)):null;let s=new Set;for(let e of this.stores.pendingMatchStores.values())e.routeId&&s.add(e.routeId);let c=new Set;for(let e of this.stores.matchStores.values())e.routeId&&c.add(e.routeId);t=a?o.filter(e=>!s.has(e.routeId)):null,n=a?i.filter(e=>!c.has(e.routeId)):null,r=a?i.filter(e=>c.has(e.routeId)):o,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),a&&(this.stores.setMatches(i),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...e.filter(e=>e.status!==`error`&&e.status!==`notFound`&&e.status!==`redirected`)]),this.clearExpiredCache())});for(let[e,i]of[[t,`onLeave`],[n,`onEnter`],[r,`onStay`]])if(e)for(let t of e)this.looseRoutesById[t.routeId].options[i]?.(t)})})}})}catch(e){rb(e)?(n=e,this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):qy(e)&&(r=e);let t=n?n.status:r?404:this.stores.matches.get().some(e=>e.status===`error`)?500:200;this.batch(()=>{this.stores.statusCode.set(t),this.stores.redirect.set(n)})}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),o()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let o;this.hasNotFoundMatch()?o=404:this.stores.matches.get().some(e=>e.status===`error`)&&(o=500),o!==void 0&&this.stores.statusCode.set(o)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document<`u`&&`startViewTransition`in document&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&this.isViewTransitionTypesSupported){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(zb(r,i)):t.types;if(a===!1){e();return}n={update:e,types:a}}else n=e;document.startViewTransition(n)}else e()},this.updateMatch=(e,t)=>{this.startTransition(()=>{let n=this.stores.pendingMatchStores.get(e);if(n){n.set(t);return}let r=this.stores.matchStores.get(e);if(r){r.set(t);return}let i=this.stores.cachedMatchStores.get(e);if(i){let n=t(i.get());n.status===`redirected`?this.stores.cachedMatchStores.delete(e)&&this.stores.cachedIds.set(t=>t.filter(t=>t!==e)):i.set(n)}})},this.getMatch=e=>this.stores.cachedMatchStores.get(e)?.get()??this.stores.pendingMatchStores.get(e)?.get()??this.stores.matchStores.get(e)?.get(),this.invalidate=e=>{let t=t=>e?.filter?.(t)??!0?{...t,invalid:!0,...e?.forcePending||t.status===`error`||t.status===`notFound`?{status:`pending`,error:void 0}:void 0}:t;return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(t)),this.stores.setCached(this.stores.cachedMatches.get().map(t)),this.stores.setPending(this.stores.pendingMatches.get().map(t))}),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.getParsedLocationHref=e=>e.publicHref||`/`,this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href||e.options._builtLocation){let t=e.options._builtLocation??this.buildLocation(e.options),n=this.getParsedLocationHref(t);e.options.href=n,e.headers.set(`Location`,n)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&!e.options._builtLocation&&_y(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=e?.filter;t===void 0?this.stores.setCached([]):this.stores.setCached(this.stores.cachedMatches.get().filter(e=>!t(e)))},this.clearExpiredCache=()=>{let e=Date.now();this.clearCache({filter:t=>{let n=this.looseRoutesById[t.routeId];if(!n.options.loader)return!0;let r=(t.preload?n.options.preloadGcTime??this.options.defaultPreloadGcTime:n.options.gcTime??this.options.defaultGcTime)??300*1e3;return t.status===`error`?!0:e-t.updatedAt>=r}})},this.loadRouteChunk=Cb,this.preloadRoute=async e=>{let t=e._builtLocation??this.buildLocation(e),n=this.matchRoutes(t,{throwOnError:!0,preload:!0,dest:e}),r=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),i=new Set([...r,...this.stores.cachedIds.get()]),a=n.filter(e=>!i.has(e.id));if(a.length){let e=this.stores.cachedMatches.get();this.stores.setCached([...e,...a])}try{return n=await xb({router:this,matches:n,location:t,preload:!0,updateMatch:(e,t)=>{r.has(e)?n=n.map(n=>n.id===e?t(n):n):this.updateMatch(e,t)}}),n}catch(e){if(rb(e))return e.options.reloadDocument?void 0:await this.preloadRoute({...e.options,_fromLocation:t});qy(e)||console.error(e);return}},this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n);if(t?.pending&&this.stores.status.get()!==`pending`)return!1;let i=(t?.pending===void 0?!this.stores.isLoading.get():t.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),a=Mae(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,i.pathname,this.processedTree);return!a||e.params&&!py(a.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?py(i.search,r.search,{partial:!0})?a.rawParams:!1:a.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(e=>e.status===`notFound`||e.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??Qy,parseSearch:e.parseSearch??Zy,protocolAllowlist:e.protocolAllowlist??Eae}),typeof document<`u`&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=jy(e),this.routeBranchCache.set(e,t)),t}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){let n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:i}=n,{matchedRoutes:a}=n,o=!1;(r?r.path!==`/`&&i[`**`]:Ry(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:o=!0);let s=o?Jae(this.options.notFoundMode,a):void 0,c=Array(a.length),l=new Map;for(let e of this.stores.matchStores.values())e.routeId&&l.set(e.routeId,e.get());for(let n=0;n<a.length;n++){let r=a[n],o=c[n-1],u,d,f;{let n=o?.search??e.search,i=o?._strictSearch??void 0;try{let e=Hb(r.options.validateSearch,{...n})??void 0;u={...n,...e},d={...i,...e},f=void 0}catch(e){let r=e;if(e instanceof Vb||(r=new Vb(e.message,{cause:e})),t?.throwOnError)throw r;u=n,d={},f=r}}let p=r.options.loaderDeps?.({search:u})??``,m=p?JSON.stringify(p):``,{interpolatedPath:h,usedParams:g}=Gy({path:r.fullPath,params:i,decoder:this.pathParamsDecoder,server:this.isServer}),_=r.id+h+m,v=this.getMatch(_),y=l.get(r.id),b=v?._strictParams??g,x;if(!v)try{Ub(r,b)}catch(e){if(x=qy(e)||rb(e)?e:new Uae(e.message,{cause:e}),t?.throwOnError)throw x}Object.assign(i,b);let S=y?`stay`:`enter`,C;if(v)C={...v,cause:S,params:y?.params??i,_strictParams:b,search:sy(y?y.search:v.search,u),_strictSearch:d};else{let e=r.options.loader||r.options.beforeLoad||r.lazyFn||wb(r)?`pending`:`success`;C={id:_,ssr:r.options.ssr,index:n,routeId:r.id,params:y?.params??i,_strictParams:b,pathname:h,updatedAt:Date.now(),search:y?sy(y.search,u):u,_strictSearch:d,searchError:void 0,status:e,isFetching:!1,error:void 0,paramsError:x,__routeContext:void 0,_nonReactive:{loadPromise:my()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:S,loaderDeps:y?cy(y.loaderDeps,p):p,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:r.options.staticData||{},fullPath:r.fullPath}}t?.preload||(C.globalNotFound=s===r.id),C.searchError=f;let w=this.getParentContext(o);C.context={...w,...C.__routeContext,...C.__beforeLoadContext},c[n]=C}for(let t=0;t<c.length;t++){let n=c[t],r=this.looseRoutesById[n.routeId],a=this.getMatch(n.id),o=l.get(n.routeId);if(n.params=o?sy(o.params,i):i,!a){let i=c[t-1],a=this.getParentContext(i);if(r.options.context){let t={deps:n.loaderDeps,params:n.params,context:a??{},location:e,navigate:t=>this.navigate({...t,_fromLocation:e}),buildLocation:this.buildLocation,cause:n.cause,abortController:n.abortController,preload:!!n.preload,matches:c,routeId:r.id};n.__routeContext=r.options.context(t)??void 0}n.context={...a,...n.__routeContext,...n.__beforeLoadContext}}}return c}matchRoutesLightweight(e){let{matchedRoutes:t,routeParams:n}=this.getMatchedRoutes(e.pathname),r=ny(t),i={...e.search};for(let e of t)try{Object.assign(i,Hb(e.options.validateSearch,i))}catch{}let a=ny(this.stores.matchesId.get()),o=a&&this.stores.matchStores.get(a)?.get(),s=o&&o.routeId===r.id&&o.pathname===e.pathname,c;if(s)c=o.params;else{let e=Object.assign(Object.create(null),n);for(let n of t)try{Ub(n,e)}catch{}c=e}return{matchedRoutes:t,fullPath:r.fullPath,search:i,params:c}}},Vb=class extends Error{},Uae=class extends Error{};function Wae(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:`idle`,resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function Hb(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new Vb(`Async validation not supported`);if(n.issues)throw new Vb(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function Gae({pathname:e,routesById:t,processedTree:n}){let r=Object.create(null),i=Ry(e),a,o=Nae(i,n,!0);return o&&(a=o.route,Object.assign(r,o.rawParams)),{matchedRoutes:o?.branch||[t.__root__],routeParams:r,foundRoute:a}}function Kae({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return qae(n)(e,t,r??!1)}function qae(e){let t,n,r=[];for(let t of e){let e=t.options;`search`in e?e.search?.middlewares&&r.push(...e.search.middlewares):(e.preSearchFilters||e.postSearchFilters)&&r.push(({search:t,next:n})=>{let r=n(e.preSearchFilters?e.preSearchFilters.reduce((e,t)=>t(e),t):t);return e.postSearchFilters?e.postSearchFilters.reduce((e,t)=>t(e),r):r});let i=e.validateSearch;i&&r.push(({search:e,next:t,meta:r})=>{let a=t(e);if(n)try{let e=Hb(i,a);if(r&&e)for(let t in e)t in a||(r.defaulted||=new Map).set(t,e[t]);return{...a,...e}}catch{}return a})}let i=(e,n,a)=>{if(e>=r.length){if(!t.search)return{};if(t.search===!0)return n;let e=ry(t.search,n);return a&&(a.explicit=e),e}return r[e]({search:n,next:(t,n)=>{if(n){let n=a||{};return{search:i(e+1,t,n),meta:n}}return i(e+1,t,a)},meta:a})};return function(e,r,a){return t=r,n=a,i(0,e)}}function Jae(e,t){if(e!==`root`)for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.children)return n.id}return tb}function Ub(e,t){let n=e.options.params?.parse??e.options.parseParams;if(n){let e=n(t);if(e===!1)throw Error(`Route params.parse returned false for a matched route`);Object.assign(t,e)}}function Yae(){try{return sessionStorage}catch{return}}var Xae=`tsr-scroll-restoration-v1_3`,Wb=Yae();function Zae(){try{return JSON.parse(Wb?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function Qae(){try{Wb?.setItem(Xae,JSON.stringify(Gb))}catch{}}var Gb=Zae(),Kb=`data-scroll-restoration-id`,$ae=e=>e.state.__TSR_key||e.href;function eoe(e){let t=e.getAttribute(Kb);if(t)return`[${Kb}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var qb=!1,Jb=`window`;function Yb(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function Xb(e){let t=[];for(let n of e){if(n===Jb)continue;let e=Yb(n);e&&t.push(e)}return t}function toe(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||$ae,a=new Map,o=(e,t,n)=>{let r=a.get(e)||{};r.scrollX=t,r.scrollY=n,a.set(e,r)},s=e=>{if(!(qb||!r.restoring))if(e.target===document)o(Jb,scrollX,scrollY);else{let t=e.target;o(t,t.scrollLeft,t.scrollTop)}},c=e=>{if(!r.restoring)return;let t=Gb[e]||={};for(let[e,n]of a)e===Jb?t[Jb]=n:e.isConnected&&(t[eoe(e)]=n)};n&&!r.restoration&&(r.restoration=!0,qb=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,s,!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&c(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{c(i(e.stores.resolvedLocation.get()??e.stores.location.get())),Qae()})),!r.reset&&(r.reset=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.next,c;if(a.clear(),s||(r.next=!0),typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let l=i(t.toLocation),u=t.fromLocation&&i(t.fromLocation);if(r.restoring&&u&&u!==l){let e=Gb[u];if(e){let t=Gb[l];for(let n in e){if(n===Jb){if(s)continue}else{let e=Yb(n);if(!e||s&&o&&(c??=Xb(o),c.includes(e)))continue}t||=Gb[l]={},t[n]??=e[n]}}}qb=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){let s=Bb.get(t.toLocation),u=e&&i&&(s===`PUSH`||s===`REPLACE`),d=r.restoring?Gb[l]:void 0;if(d)for(let e in d){let{scrollX:t,scrollY:r}=d[e];if(e===Jb){if(u)continue;scrollTo({top:r,left:t,behavior:n}),a=!0}else{let n=Yb(e);n&&(n.scrollLeft=t,n.scrollTop=r)}}if(!a&&!e){let e={top:0,left:0,behavior:n};if(scrollTo(e),o){c??=Xb(o);for(let t of c)t.scrollTo(e)}}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{qb=!1}}))}var noe=`Error preloading route! ☝️`,Zb=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=tb:this.parentRoute||yy();let r=n?tb:t?.path;r&&r!==`/`&&(r=Ly(r));let i=t?.id||r,a=n?tb:Fy([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=Fy([`/`,a]));let o=a===`__root__`?`/`:Fy([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=o,this._to=Ry(o)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>nb({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},roe=class extends Zb{constructor(e){super(e)}};function Qb(e){let t=e.errorComponent??$b;return(0,B.jsx)(ioe,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?z.createElement(t,{error:n,reset:r}):e.children})}var ioe=class extends z.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function $b({error:e}){let[t,n]=z.useState(!1);return(0,B.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,B.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,B.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,B.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,B.jsx)(`div`,{children:(0,B.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,B.jsx)(`code`,{children:e.message}):null})}):null]})}function aoe({children:e,fallback:t=null}){return ex()?(0,B.jsx)(z.Fragment,{children:e}):(0,B.jsx)(z.Fragment,{children:t})}function ex(){return z.useSyncExternalStore(ooe,()=>!0,()=>!1)}function ooe(){return()=>{}}var tx=z.createContext(null);function nx(e){return z.useContext(tx)}var rx=z.createContext(void 0),soe=z.createContext(void 0),ix=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(ix||{});function coe({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(!0)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(!0)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function loe(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var ax=[],ox=0,{link:sx,unlink:uoe,propagate:doe,checkDirty:cx,shallowPropagate:lx}=coe({update(e){return e._update()},notify(e){ax[dx++]=e,e.flags&=~ix.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=ix.Mutable|ix.Dirty,hx(e))}}),ux=0,dx=0,fx,px=0;function mx(e){try{++px,e()}finally{--px||gx()}}function hx(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=uoe(n,e)}function gx(){if(!(px>0)){for(;ux<dx;){let e=ax[ux];ax[ux++]=void 0,e.notify()}ux=0,dx=0}}function _x(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?ix.None:ix.Mutable,get(){return fx!==void 0&&sx(i,fx,ox),i._snapshot},subscribe(e){let t=loe(e),n={current:!1},r=foe(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=fx,o=t?.compare??Object.is;if(n)fx=i,++ox,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=ix.Mutable|ix.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{fx=a,n&&(i.flags&=~ix.RecursedCheck),hx(i)}}};return n?(i.flags=ix.Mutable|ix.Dirty,i.get=function(){let e=i.flags;if(e&ix.Dirty||e&ix.Pending&&cx(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&lx(e)}}else e&ix.Pending&&(i.flags=e&~ix.Pending);return fx!==void 0&&sx(i,fx,ox),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(doe(e),lx(e),gx())}},i}function foe(e){let t=()=>{let t=fx;fx=n,++ox,n.depsTail=void 0,n.flags=ix.Watching|ix.RecursedCheck;try{return e()}finally{fx=t,n.flags&=~ix.RecursedCheck,hx(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:ix.Watching|ix.RecursedCheck,notify(){let e=this.flags;e&ix.Dirty||e&ix.Pending&&cx(this.deps,this)?t():this.flags=ix.Watching},stop(){this.flags=ix.None,this.depsTail=void 0,hx(this)}};return t(),n}var poe=a((t=>{var n=e();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useState,o=n.useEffect,s=n.useLayoutEffect,c=n.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;t.useSyncExternalStore=n.useSyncExternalStore===void 0?f:n.useSyncExternalStore})),moe=a(((e,t)=>{t.exports=poe()})),hoe=a((t=>{var n=e(),r=moe();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=r.useSyncExternalStore,s=n.useRef,c=n.useEffect,l=n.useMemo,u=n.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),goe=a(((e,t)=>{t.exports=hoe()}))();function _oe(e,t){return e===t}function vx(e,t,n=_oe){let r=(0,z.useCallback)(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=(0,z.useCallback)(()=>e?.get(),[e]);return(0,goe.useSyncExternalStoreWithSelector)(r,i,i,t,n)}var voe={get:()=>void 0,subscribe:()=>({unsubscribe:()=>{}})};function yx(e){let t=nx(),n=z.useContext(e.from?soe:rx),r=e.from??n,i=r?e.from?t.stores.getRouteMatchStore(r):t.stores.matchStores.get(r):void 0,a=z.useRef(void 0);return vx(i??voe,n=>{if((e.shouldThrow??!0)&&!n&&yy(),n===void 0)return;let r=e.select?e.select(n):n;if(e.structuralSharing??t.options.defaultStructuralSharing){let e=cy(a.current,r);return a.current=e,e}return r})}function bx(e){return yx({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function xx(e){let{select:t,...n}=e;return yx({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function Sx(e){return yx({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Cx(e){return yx({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function wx(e){let t=nx();return z.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Tx(e){return yx({...e,select:t=>e.select?e.select(t.context):t.context})}var Ex=r(n(),1);function yoe(e,t){let n=nx(),r=xae(t),{activeProps:i,inactiveProps:a,activeOptions:o,to:s,preload:c,preloadDelay:l,preloadIntentProximity:u,hashScrollIntoView:d,replace:f,startTransition:p,resetScroll:m,viewTransition:h,children:g,target:_,disabled:v,style:y,className:b,onClick:x,onBlur:S,onFocus:C,onMouseEnter:w,onMouseLeave:T,onTouchStart:E,ignoreBlocker:D,params:O,search:k,hash:ee,state:A,mask:j,reloadDocument:te,unsafeRelative:ne,from:M,_fromLocation:N,...re}=e,ie=ex(),ae=z.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),oe=vx(n.stores.location,e=>e,(e,t)=>e.href===t.href),se=z.useMemo(()=>{let e={_fromLocation:oe,...ae};return n.buildLocation(e)},[n,oe,ae]),ce=se.maskedLocation?se.maskedLocation.publicHref:se.publicHref,le=se.maskedLocation?se.maskedLocation.external:se.external,ue=z.useMemo(()=>Toe(ce,le,n.history,v),[v,le,ce,n.history]),de=z.useMemo(()=>{if(ue?.external)return _y(ue.href,n.protocolAllowlist)?void 0:ue.href;if(!Eoe(s)&&!(typeof s!=`string`||s.indexOf(`:`)===-1))try{return new URL(s),_y(s,n.protocolAllowlist)?void 0:s}catch{}},[s,ue,n.protocolAllowlist]),fe=z.useMemo(()=>{if(de)return!1;if(o?.exact){if(!Vy(oe.pathname,se.pathname,n.basepath))return!1}else{let e=By(oe.pathname,n.basepath),t=By(se.pathname,n.basepath);if(!(e.startsWith(t)&&(e.length===t.length||e[t.length]===`/`)))return!1}return(o?.includeSearch??!0)&&!py(oe.search,se.search,{partial:!o?.exact,ignoreUndefined:!o?.explicitUndefined})?!1:o?.includeHash?ie&&oe.hash===se.hash:!0},[o?.exact,o?.explicitUndefined,o?.includeHash,o?.includeSearch,oe,de,ie,se.hash,se.pathname,se.search,n.basepath]),pe=fe?ry(i,{})??boe:Dx,me=fe?Dx:ry(a,{})??Dx,he=[b,pe.className,me.className].filter(Boolean).join(` `),ge=(y||pe.style||me.style)&&{...y,...pe.style,...me.style},[_e,ve]=z.useState(!1),ye=z.useRef(!1),be=e.reloadDocument||de?!1:c??n.options.defaultPreload,xe=l??n.options.defaultPreloadDelay??0,Se=z.useCallback(()=>{n.preloadRoute({...ae,_builtLocation:se}).catch(e=>{console.warn(e),console.warn(noe)})},[n,ae,se]);bae(r,z.useCallback(e=>{e?.isIntersecting&&Se()},[Se]),woe,{disabled:!!v||be!==`viewport`}),z.useEffect(()=>{ye.current||!v&&be===`render`&&(Se(),ye.current=!0)},[v,Se,be]);let Ce=e=>{let t=e.currentTarget.getAttribute(`target`),r=_===void 0?t:_;if(!v&&!Doe(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0){e.preventDefault(),(0,Ex.flushSync)(()=>{ve(!0)});let t=n.subscribe(`onResolved`,()=>{t(),ve(!1)});n.navigate({...ae,replace:f,resetScroll:m,hashScrollIntoView:d,startTransition:p,viewTransition:h,ignoreBlocker:D})}};if(de)return{...re,ref:r,href:de,...g&&{children:g},..._&&{target:_},...v&&{disabled:v},...y&&{style:y},...b&&{className:b},...x&&{onClick:x},...S&&{onBlur:S},...C&&{onFocus:C},...w&&{onMouseEnter:w},...T&&{onMouseLeave:T},...E&&{onTouchStart:E}};let we=e=>{if(v||be!==`intent`)return;if(!xe){Se();return}let t=e.currentTarget;if(Ox.has(t))return;let n=setTimeout(()=>{Ox.delete(t),Se()},xe);Ox.set(t,n)},Te=e=>{v||be!==`intent`||Se()},Ee=e=>{if(v||!be||!xe)return;let t=e.currentTarget,n=Ox.get(t);n&&(clearTimeout(n),Ox.delete(t))};return{...re,...pe,...me,href:ue?.href,ref:r,onClick:kx([x,Ce]),onBlur:kx([S,Ee]),onFocus:kx([C,we]),onMouseEnter:kx([w,we]),onMouseLeave:kx([T,Ee]),onTouchStart:kx([E,Te]),disabled:!!v,target:_,...ge&&{style:ge},...he&&{className:he},...v&&xoe,...fe&&Soe,...ie&&_e&&Coe}}var Dx={},boe={className:`active`},xoe={role:`link`,"aria-disabled":!0},Soe={"data-status":`active`,"aria-current":`page`},Coe={"data-transitioning":`transitioning`},Ox=new WeakMap,woe={rootMargin:`100px`},kx=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function Toe(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function Eoe(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var Ax=z.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=yoe(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return z.createElement(`a`,t,o)}return z.createElement(n,a,o)});function Doe(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var Ooe=class extends Zb{constructor(e){super(e),this.useMatch=e=>yx({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Tx({...e,from:this.id}),this.useSearch=e=>Cx({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Sx({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>xx({...e,from:this.id}),this.useLoaderData=e=>bx({...e,from:this.id}),this.useNavigate=()=>wx({from:this.fullPath}),this.Link=z.forwardRef((e,t)=>(0,B.jsx)(Ax,{ref:t,from:this.fullPath,...e}))}};function jx(e){return new Ooe(e)}var koe=class extends roe{constructor(e){super(e),this.useMatch=e=>yx({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>Tx({...e,from:this.id}),this.useSearch=e=>Cx({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>Sx({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>xx({...e,from:this.id}),this.useLoaderData=e=>bx({...e,from:this.id}),this.useNavigate=()=>wx({from:this.fullPath}),this.Link=z.forwardRef((e,t)=>(0,B.jsx)(Ax,{ref:t,from:this.fullPath,...e}))}};function Aoe(e){return new koe(e)}function Mx(e,t){let n,r,i,a,o=()=>(n||=e().then(e=>{n=void 0,r=e[t??`default`]}).catch(e=>{if(i=e,wae(i)&&i instanceof Error&&typeof window<`u`&&typeof sessionStorage<`u`){let e=`tanstack_router_reload:${i.message}`;sessionStorage.getItem(e)||(sessionStorage.setItem(e,`1`),a=!0)}}),n),s=function(e){if(a)throw window.location.reload(),new Promise(()=>{});if(i)throw i;if(!r)if($v)$v(o());else throw o();return z.createElement(r,e)};return s.preload=o,s}function joe(e){let t=nx(),n=`not-found-${vx(t.stores.location,e=>e.pathname)}-${vx(t.stores.status,e=>e)}`;return(0,B.jsx)(Qb,{getResetKey:()=>n,onCatch:(t,n)=>{if(qy(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(qy(t))return e.fallback?.(t);throw t},children:e.children})}function Moe(){return(0,B.jsx)(`p`,{children:`Not Found`})}function Nx(e){return(0,B.jsx)(B.Fragment,{children:e.children})}function Px(e,t,n){return t.options.notFoundComponent?(0,B.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,B.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,B.jsx)(Moe,{})}var Fx=z.memo(function({matchId:e}){let t=nx(),n=t.stores.matchStores.get(e);n||yy();let r=vx(t.stores.loadedAt,e=>e),i=vx(n,e=>e);return(0,B.jsx)(Noe,{router:t,matchId:e,resetKey:r,matchState:z.useMemo(()=>{let e=i.routeId,n=t.routesById[e].parentRoute?.id;return{routeId:e,ssr:i.ssr,_displayPending:i._displayPending,parentRouteId:n}},[i._displayPending,i.routeId,i.ssr,t.routesById])})});function Noe({router:e,matchId:t,resetKey:n,matchState:r}){let i=e.routesById[r.routeId],a=i.options.pendingComponent??e.options.defaultPendingComponent,o=a?(0,B.jsx)(a,{}):null,s=i.options.errorComponent??e.options.defaultErrorComponent,c=i.options.onCatch??e.options.defaultOnCatch,l=i.isRoot?i.options.notFoundComponent??e.options.notFoundRoute?.options.component:i.options.notFoundComponent,u=r.ssr===!1||r.ssr===`data-only`,d=(!i.isRoot||i.options.wrapInSuspense||u)&&(i.options.wrapInSuspense??a??(i.options.errorComponent?.preload||u))?z.Suspense:Nx,f=s?Qb:Nx,p=l?joe:Nx;return(0,B.jsxs)(i.isRoot?i.options.shellComponent??Nx:Nx,{children:[(0,B.jsx)(rx.Provider,{value:t,children:(0,B.jsx)(d,{fallback:o,children:(0,B.jsx)(f,{getResetKey:()=>n,errorComponent:s||$b,onCatch:(e,t)=>{if(qy(e))throw e.routeId??=r.routeId,e;c?.(e,t)},children:(0,B.jsx)(p,{fallback:e=>{if(e.routeId??=r.routeId,!l||e.routeId&&e.routeId!==r.routeId||!e.routeId&&!i.isRoot)throw e;return z.createElement(l,e)},children:u||r._displayPending?(0,B.jsx)(aoe,{fallback:o,children:(0,B.jsx)(Ix,{matchId:t})}):(0,B.jsx)(Ix,{matchId:t})})})})}),r.parentRouteId===`__root__`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Poe,{resetKey:n}),(e.options.scrollRestoration,null)]}):null]})}function Poe({resetKey:e}){let t=nx(),n=z.useRef(void 0);return ey(()=>{let e=t.latestLocation.href;(n.current===void 0||n.current!==e)&&(t.emit({type:`onRendered`,...zb(t.stores.location.get(),t.stores.resolvedLocation.get())}),n.current=e)},[t.latestLocation.state.__TSR_key,e,t]),null}var Ix=z.memo(function({matchId:e}){let t=nx(),n=(e,n)=>t.getMatch(e.id)?._nonReactive[n]??e._nonReactive[n],r=t.stores.matchStores.get(e);r||yy();let i=vx(r,e=>e),a=i.routeId,o=t.routesById[a],s=z.useMemo(()=>{let e=(t.routesById[a].options.remountDeps??t.options.defaultRemountDeps)?.({routeId:a,loaderDeps:i.loaderDeps,params:i._strictParams,search:i._strictSearch});return e?JSON.stringify(e):void 0},[a,i.loaderDeps,i._strictParams,i._strictSearch,t.options.defaultRemountDeps,t.routesById]),c=z.useMemo(()=>{let e=o.options.component??t.options.defaultComponent;return e?(0,B.jsx)(e,{},s):(0,B.jsx)(Lx,{})},[s,o.options.component,t.options.defaultComponent]);if(i._displayPending)throw n(i,`displayPendingPromise`);if(i._forcePending)throw n(i,`minPendingPromise`);if(i.status===`pending`){let e=o.options.pendingMinMs??t.options.defaultPendingMinMs;if(e){let n=t.getMatch(i.id);if(n&&!n._nonReactive.minPendingPromise){let t=my();n._nonReactive.minPendingPromise=t,setTimeout(()=>{t.resolve(),n._nonReactive.minPendingPromise=void 0},e)}}throw n(i,`loadPromise`)}if(i.status===`notFound`)return qy(i.error)||yy(),Px(t,o,i.error);if(i.status===`redirected`)throw rb(i.error)||yy(),n(i,`loadPromise`);if(i.status===`error`)throw i.error;return c}),Lx=z.memo(function(){let e=nx(),t=z.useContext(rx),n,r=!1,i;{let a=t?e.stores.matchStores.get(t):void 0;[n,r]=vx(a,e=>[e?.routeId,e?.globalNotFound??!1]),i=vx(e.stores.matchesId,e=>e[e.findIndex(e=>e===t)+1])}let a=n?e.routesById[n]:void 0,o=e.options.defaultPendingComponent?(0,B.jsx)(e.options.defaultPendingComponent,{}):null;if(r)return a||yy(),Px(e,a,void 0);if(!i)return null;let s=(0,B.jsx)(Fx,{matchId:i});return n===`__root__`?(0,B.jsx)(z.Suspense,{fallback:o,children:s}):s});function Foe(){let e=nx(),t=z.useRef({router:e,mounted:!1}),[n,r]=z.useState(!1),i=vx(e.stores.isLoading,e=>e),a=vx(e.stores.hasPending,e=>e),o=ty(i),s=i||n||a,c=ty(s),l=i||a,u=ty(l);return e.startTransition=e=>{r(!0),z.startTransition(()=>{e(),r(!1)})},z.useEffect(()=>{let t=e.history.subscribe(e.load),n=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Ry(e.latestLocation.publicHref)!==Ry(n.publicHref)&&e.commitLocation({...n,replace:!0}),()=>{t()}},[e,e.history]),ey(()=>{typeof window<`u`&&e.ssr||t.current.router===e&&t.current.mounted||(t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(e){console.error(e)}})())},[e]),ey(()=>{o&&!i&&e.emit({type:`onLoad`,...zb(e.stores.location.get(),e.stores.resolvedLocation.get())})},[o,e,i]),ey(()=>{u&&!l&&e.emit({type:`onBeforeRouteMount`,...zb(e.stores.location.get(),e.stores.resolvedLocation.get())})},[l,u,e]),ey(()=>{if(c&&!s){let t=zb(e.stores.location.get(),e.stores.resolvedLocation.get());e.emit({type:`onResolved`,...t}),mx(()=>{e.stores.status.set(`idle`),e.stores.resolvedLocation.set(e.stores.location.get())})}},[s,c,e]),null}function Ioe(){let e=nx(),t=e.routesById.__root__.options.pendingComponent??e.options.defaultPendingComponent,n=t?(0,B.jsx)(t,{}):null,r=(0,B.jsxs)(typeof document<`u`&&e.ssr?Nx:z.Suspense,{fallback:n,children:[(0,B.jsx)(Foe,{}),(0,B.jsx)(Loe,{})]});return e.options.InnerWrap?(0,B.jsx)(e.options.InnerWrap,{children:r}):r}function Loe(){let e=nx(),t=vx(e.stores.firstId,e=>e),n=vx(e.stores.loadedAt,e=>e),r=t?(0,B.jsx)(Fx,{matchId:t}):null;return(0,B.jsx)(rx.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:(0,B.jsx)(Qb,{getResetKey:()=>n,errorComponent:$b,onCatch:void 0,children:r})})}function Roe(){let e=nx();return vx(e.stores.matchRouteDeps,e=>e),z.useCallback(t=>{let{pending:n,caseSensitive:r,fuzzy:i,includeSearch:a,...o}=t;return e.matchRoute(o,{pending:n,caseSensitive:r,fuzzy:i,includeSearch:a})},[e])}var zoe=e=>({createMutableStore:_x,createReadonlyStore:_x,batch:mx}),Boe=e=>new Voe(e),Voe=class extends Hae{constructor(e){super(e,zoe)}};function Hoe({router:e,children:t,...n}){oy(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,B.jsx)(tx.Provider,{value:e,children:t});return e.options.Wrap?(0,B.jsx)(e.options.Wrap,{children:r}):r}function Uoe({router:e,...t}){return(0,B.jsx)(Hoe,{router:e,...t,children:(0,B.jsx)(Ioe,{})})}function Rx(e){let t=nx(),n=(0,z.useRef)(void 0);return vx(t.stores.location,r=>{let i=e?.select?e.select(r):r;if(e?.structuralSharing??t.options.defaultStructuralSharing){let e=cy(n.current,i);return n.current=e,e}return i})}var Woe=F(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Goe=F(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),zx=F(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Bx=F(`at-sign`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8`,key:`7n84p3`}]]),Vx=F(`audio-lines`,[[`path`,{d:`M2 10v3`,key:`1fnikh`}],[`path`,{d:`M6 6v11`,key:`11sgs0`}],[`path`,{d:`M10 3v18`,key:`yhl04a`}],[`path`,{d:`M14 8v7`,key:`3a1oy3`}],[`path`,{d:`M18 5v13`,key:`123xd1`}],[`path`,{d:`M22 10v3`,key:`154ddg`}]]),Hx=F(`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`}]]),Koe=F(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),Ux=F(`bookmark`,[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]),Wx=F(`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`}]]),Gx=F(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),Kx=F(`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`}]]),qx=F(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Jx=F(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Yx=F(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Xx=F(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Zx=F(`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`}]]),Qx=F(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),$x=F(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),eS=F(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),tS=F(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),nS=F(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),qoe=F(`compass`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]),rS=F(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),iS=F(`corner-down-right`,[[`path`,{d:`m15 10 5 5-5 5`,key:`qqa56n`}],[`path`,{d:`M4 4v7a4 4 0 0 0 4 4h12`,key:`z08zvw`}]]),Joe=F(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),Yoe=F(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),aS=F(`crown`,[[`path`,{d:`M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z`,key:`1vdc57`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),oS=F(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),sS=F(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),cS=F(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),lS=F(`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`}]]),uS=F(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),dS=F(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Xoe=F(`feather`,[[`path`,{d:`M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z`,key:`18jl4k`}],[`path`,{d:`M16 8 2 22`,key:`vp34q`}],[`path`,{d:`M17.5 15H9`,key:`1oz8nu`}]]),fS=F(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Zoe=F(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),pS=F(`flag`,[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]),Qoe=F(`fold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3-3-3 3`,key:`e37ymu`}],[`path`,{d:`m15 5-3 3-3-3`,key:`19d6lf`}]]),mS=F(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),hS=F(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`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`}]]),$oe=F(`folder-search`,[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),gS=F(`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`}]]),_S=F(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),ese=F(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),tse=F(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),vS=F(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),nse=F(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),rse=F(`image-plus`,[[`path`,{d:`M16 5h6`,key:`1vod17`}],[`path`,{d:`M19 2v6`,key:`4bpg5p`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`,key:`1ue2ih`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]),ise=F(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),yS=F(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),ase=F(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),bS=F(`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`}]]),xS=F(`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`}]]),ose=F(`library-big`,[[`rect`,{width:`8`,height:`18`,x:`3`,y:`3`,rx:`1`,key:`oynpb5`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z`,key:`1qboyk`}]]),SS=F(`link-2`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),CS=F(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),wS=F(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),TS=F(`locate-fixed`,[[`line`,{x1:`2`,x2:`5`,y1:`12`,y2:`12`,key:`bvdh0s`}],[`line`,{x1:`19`,x2:`22`,y1:`12`,y2:`12`,key:`1tbv5k`}],[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`5`,key:`11lu5j`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}],[`circle`,{cx:`12`,cy:`12`,r:`7`,key:`fim9np`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ES=F(`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`}]]),DS=F(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),OS=F(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),kS=F(`megaphone`,[[`path`,{d:`M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z`,key:`q8bfy3`}],[`path`,{d:`M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14`,key:`1853fq`}],[`path`,{d:`M8 6v8`,key:`15ugcq`}]]),AS=F(`message-circle-question-mark`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),jS=F(`message-square-plus`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]),MS=F(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),NS=F(`mic-off`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M15 9.34V5a3 3 0 0 0-5.68-1.33`,key:`1gzdoj`}],[`path`,{d:`M16.95 16.95A7 7 0 0 1 5 12v-2`,key:`cqa7eg`}],[`path`,{d:`M18.89 13.23A7 7 0 0 0 19 12v-2`,key:`16hl24`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v3a3 3 0 0 0 5.12 2.12`,key:`r2i35w`}]]),PS=F(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),FS=F(`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`}]]),IS=F(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),LS=F(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),RS=F(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),zS=F(`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`}]]),BS=F(`panel-left-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),VS=F(`panel-left-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),HS=F(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),US=F(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),WS=F(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),GS=F(`phone-off`,[[`path`,{d:`M10.1 13.9a14 14 0 0 0 3.732 2.668 1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2 18 18 0 0 1-12.728-5.272`,key:`1wngk7`}],[`path`,{d:`M22 2 2 22`,key:`y4kqgn`}],[`path`,{d:`M4.76 13.582A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 .244.473`,key:`10hv5p`}]]),KS=F(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),qS=F(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),JS=F(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),YS=F(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),XS=F(`reply`,[[`path`,{d:`M20 18v-2a4 4 0 0 0-4-4H4`,key:`5vmcpk`}],[`path`,{d:`m9 17-5-5 5-5`,key:`nvlc11`}]]),ZS=F(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),QS=F(`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`}]]),$S=F(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),eC=F(`send-horizontal`,[[`path`,{d:`M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z`,key:`117uat`}],[`path`,{d:`M6 12h16`,key:`s4cdu5`}]]),tC=F(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),nC=F(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),rC=F(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),iC=F(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),aC=F(`shield-alert`,[[`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:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),oC=F(`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`}]]),sC=F(`shield-ellipsis`,[[`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:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]),cC=F(`shield-cog`,[[`path`,{d:`m10.929 14.467-.383.924`,key:`hdyevy`}],[`path`,{d:`M10.929 8.923 10.546 8`,key:`1nr44d`}],[`path`,{d:`M13.225 8.923 13.608 8`,key:`aewley`}],[`path`,{d:`m13.607 15.391-.382-.924`,key:`m37gf1`}],[`path`,{d:`m14.849 10.547.923-.383`,key:`1d3c4q`}],[`path`,{d:`m14.849 12.843.923.383`,key:`lmvhy3`}],[`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.305 10.547-.923-.383`,key:`1d13ox`}],[`path`,{d:`m9.305 12.843-.923.383`,key:`7wxwh5`}],[`circle`,{cx:`12.077`,cy:`11.695`,r:`3`,key:`fse9k8`}]]),lC=F(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),uC=F(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),dC=F(`split`,[[`path`,{d:`M16 3h5v5`,key:`1806ms`}],[`path`,{d:`M8 3H3v5`,key:`15dfkv`}],[`path`,{d:`M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3`,key:`1qrqzj`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}]]),fC=F(`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`}]]),pC=F(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),mC=F(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),hC=F(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),gC=F(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),_C=F(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),vC=F(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),yC=F(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),bC=F(`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`}]]),xC=F(`user-plus`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}],[`line`,{x1:`19`,x2:`19`,y1:`8`,y2:`14`,key:`1bvyxn`}],[`line`,{x1:`22`,x2:`16`,y1:`11`,y2:`11`,key:`1shjgl`}]]),SC=F(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),CC=F(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),wC=F(`volume-2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),TC=F(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),EC=F(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),DC=F(`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`}]]),OC=F(`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`}]]),kC=`oc.detachedComposer.geom`,AC=300,jC=200,MC=null,NC=0,PC=0,FC=null,IC=0,LC=new Set;function RC(){for(let e of LC)e()}function zC(e){return LC.add(e),()=>LC.delete(e)}function BC(){return MC}function VC(e,t){let n=Math.min(Math.max(AC,Math.min(e.w,t.w)),t.w),r=Math.min(Math.max(jC,Math.min(e.h,t.h)),t.h);return{x:Math.max(0,Math.min(e.x,t.w-n)),y:Math.max(0,Math.min(e.y,t.h-r)),w:n,h:r}}function sse(){let e=typeof window<`u`?window.innerWidth:1200,t=typeof window<`u`?window.innerHeight:800,n=Math.min(720,Math.round(e*.72)),r=Math.min(300,Math.round(t*.42));return{x:Math.round((e-n)/2),y:t-r-28,w:n,h:r}}function cse(){let e=null;try{let t=typeof localStorage<`u`?localStorage.getItem(kC):null;if(t!==null){let n=JSON.parse(t);typeof n.x==`number`&&typeof n.y==`number`&&typeof n.w==`number`&&typeof n.h==`number`&&(e={x:n.x,y:n.y,w:n.w,h:n.h})}}catch{}return e===null&&(e=sse()),typeof window<`u`&&window.innerWidth&&window.innerHeight&&(e=VC(e,{w:window.innerWidth,h:window.innerHeight})),e}function lse(e){try{localStorage?.setItem(kC,JSON.stringify(e))}catch{}}function use(e){return MC===null?(NC+=1,MC={holdId:NC,sending:!1,targetChatId:e.targetChatId,targetLabel:e.targetLabel,text:e.text,interim:``,recording:e.recording??!1,geom:cse(),pendingSend:null,pendingSendId:0,pendingRestore:null,voiceEnabled:e.voiceEnabled,voiceLang:e.voiceLang},FC=e.stop??null,IC++,RC(),!0):!1}function HC(e){MC!==null&&(FC=e,IC++,MC.recording||(MC={...MC,recording:!0},RC()))}function UC(){return IC}function WC(e,t){MC!==null&&(MC={...MC,text:ZC(MC.text,e,t)},RC())}function GC(e){MC===null||MC.interim===e||(MC={...MC,interim:e},RC())}function dse(e){MC===null||MC.text===e||(MC={...MC,text:e},RC())}function KC(e){if(MC===null)return;let t=VC(e,{w:typeof window<`u`&&window.innerWidth?window.innerWidth:e.w,h:typeof window<`u`&&window.innerHeight?window.innerHeight:e.h});MC={...MC,geom:t},lse(t),RC()}function fse(e){MC!==null&&(PC+=1,MC={...MC,pendingSend:e,pendingSendId:PC,sending:!0},RC())}function pse(){MC===null||MC.pendingSend===null||(MC={...MC,pendingSend:null},RC())}function qC(e){MC===null||MC.holdId!==e||!MC.sending||(MC={...MC,sending:!1},RC())}function mse(e){return MC===null||MC.holdId!==e?``:XC()}function JC(){MC!==null&&(MC={...MC,pendingRestore:MC.text},RC())}function hse(){MC===null||MC.pendingRestore===null||(MC={...MC,pendingRestore:null},RC())}function YC(e){MC===null||!MC.recording||e!==void 0&&e!==IC||(MC={...MC,recording:!1,interim:``},RC())}function gse(){try{FC?.()}catch{}FC=null}function XC(){let e=MC?.text??``;try{FC?.()}catch{}return FC=null,MC=null,RC(),e}function ZC(e,t,n){let r=t.trim();if(r===``)return e;if(e===``)return r;let i=e.replace(/\s+$/,``);return n?`${i}\n\n${r}`:`${i} ${r}`}function QC(e,t){return e&&e!==`auto`?e:t.startsWith(`fr`)?`fr-FR`:t.startsWith(`en`)?`en-US`:t||`fr-FR`}function $C(e){let t=e;return t=t.replace(/```[\s\S]*?```/g,` (bloc de code) `),t=t.replace(/`([^`]+)`/g,`$1`),t=t.replace(/!\[[^\]]*\]\([^)]*\)/g,` `),t=t.replace(/\[([^\]]+)\]\([^)]*\)/g,`$1`),t=t.replace(/^#{1,6}\s+/gm,``),t=t.replace(/^\s*>\s?/gm,``),t=t.replace(/^\s*[-*+]\s+/gm,``),t=t.replace(/^\s*\d+\.\s+/gm,``),t=t.replace(/^\s*([-_*]\s*){3,}$/gm,` `),t=t.replace(/^\s*\|(.+)\|\s*$/gm,(e,t)=>t.split(`|`).map(e=>e.trim()).filter(e=>e&&!/^:?-{2,}:?$/.test(e)).join(`, `)),t=t.replace(/(\*\*|__|\*|_|~~)/g,``),t=t.replace(/[ \t]+/g,` `).replace(/\n{2,}/g,`. `).replace(/\n/g,` `),t.trim()}function ew(){return typeof window<`u`&&`speechSynthesis`in window}function tw(e,t){if(!ew())return!1;let n=window.speechSynthesis,r=new SpeechSynthesisUtterance(e);return r.lang=t.lang,r.rate=Math.min(2,Math.max(.5,t.rate||1)),t.onEnd&&(r.onend=t.onEnd,r.onerror=t.onEnd),n.speaking||n.pending?(n.cancel(),window.setTimeout(()=>n.speak(r),60)):n.speak(r),!0}function nw(){ew()&&window.speechSynthesis.cancel()}function rw(){if(typeof window>`u`)return null;let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition??null}function iw(){return rw()!==null}var _se=2500;function aw(e){let t=rw();if(!t)return null;let n=new t;n.lang=e.lang,n.interimResults=e.onInterim!==void 0,n.continuous=!0;let r=0,i=null;n.onresult=t=>{let n=t,a=Date.now(),o=``;for(let t=n.resultIndex;t<n.results.length;t++){let s=n.results[t];if(s?.[0]?.transcript)if(s.isFinal){let t=r!==0&&(i??a)-r>_se;r=a,i=null,e.onText(s[0].transcript,{paragraph:t})}else o+=s[0].transcript}o!==``&&i===null&&(i=a),e.onInterim?.(o)},n.onend=()=>{e.onInterim?.(``),e.onEnd()},n.onerror=t=>{let n=String(t.error??`unknown`);e.onError(n)};try{n.start()}catch{return null}return{stop:()=>n.stop()}}var ow=null;function sw(e,t,n){try{cw();let r=new Audio(`data:${t};base64,${e}`);return r.playbackRate=Math.min(2,Math.max(.5,n?.rate??1)),ow=r,n?.onEnd&&(r.onended=n.onEnd,r.onerror=n.onEnd),r.play().catch(()=>n?.onEnd?.()),!0}catch{return!1}}function cw(){ow&&=(ow.pause(),ow.onended=null,ow.onerror=null,null)}var lw={media_delivery:{key:`media_delivery`,appliedIn:`bridge`,togglable:!0,placeholders:[`outboundDir`],defaultTemplate:{fr:`[LIVRAISON]
|
|
11
|
+
Pour qu'un fichier que tu génères soit téléchargeable par l'utilisateur dans ce webchat : écris-le sous {outboundDir}/ puis ajoute, dans ta réponse finale, une ligne dédiée EXACTEMENT au format MEDIA:<chemin absolu du fichier>. N'utilise PAS de lien markdown vers un chemin local — il ne serait pas cliquable.`,en:`[DELIVERY]
|
|
12
|
+
To make a file you generate downloadable by the user in this webchat: write it under {outboundDir}/ then add, in your final reply, a dedicated line EXACTLY in the format MEDIA:<absolute file path>. Do NOT use a markdown link to a local path — it would not be clickable.`}},documentary_fetch:{key:`documentary_fetch`,appliedIn:`convex`,togglable:!0,placeholders:[`references`],defaultTemplate:{fr:`Fournis les fichiers source téléchargeables correspondant EXACTEMENT à ces références de documents (un fichier par référence, nommé d'après la référence). Réponds uniquement avec les fichiers, sans commentaire :
|
|
13
|
+
{references}`,en:`Provide the downloadable source files matching EXACTLY these document references (one file per reference, named after the reference). Reply only with the files, no commentary:
|
|
14
|
+
{references}`},disabledTemplate:{fr:`{references}`,en:`{references}`}},inbound_files:{key:`inbound_files`,appliedIn:`bridge`,togglable:!0,placeholders:[`files`],defaultTemplate:{fr:`[FICHIERS REÇUS]
|
|
15
|
+
{files}`,en:`[RECEIVED FILES]
|
|
16
|
+
{files}`}},history_summary:{key:`history_summary`,appliedIn:`convex`,togglable:!0,placeholders:[`previous_summary`,`new_messages`,`max_chars`],defaultTemplate:{fr:`[SYNTHÈSE DE CONVERSATION]
|
|
17
|
+
Tu maintiens le résumé cumulatif d'une conversation entre un utilisateur et un assistant. Mets à jour le résumé existant en y intégrant les nouveaux messages. Conserve : décisions, faits, chiffres, engagements, préférences exprimées, questions ouvertes. Style : factuel, compact, même langue que la conversation. Réponds UNIQUEMENT avec le résumé mis à jour, sans commentaire, en {max_chars} caractères au maximum.
|
|
18
|
+
|
|
19
|
+
[RÉSUMÉ EXISTANT]
|
|
20
|
+
{previous_summary}
|
|
21
|
+
|
|
22
|
+
[NOUVEAUX MESSAGES]
|
|
23
|
+
{new_messages}`,en:`[CONVERSATION SUMMARY]
|
|
24
|
+
You maintain the cumulative summary of a conversation between a user and an assistant. Update the existing summary by folding in the new messages. Keep: decisions, facts, figures, commitments, stated preferences, open questions. Style: factual, compact, same language as the conversation. Reply ONLY with the updated summary, no commentary, in at most {max_chars} characters.
|
|
25
|
+
|
|
26
|
+
[EXISTING SUMMARY]
|
|
27
|
+
{previous_summary}
|
|
28
|
+
|
|
29
|
+
[NEW MESSAGES]
|
|
30
|
+
{new_messages}`},disabledTemplate:{fr:`[RÉSUMÉ EXISTANT]
|
|
31
|
+
{previous_summary}
|
|
32
|
+
|
|
33
|
+
[NOUVEAUX MESSAGES]
|
|
34
|
+
{new_messages}`,en:`[EXISTING SUMMARY]
|
|
35
|
+
{previous_summary}
|
|
36
|
+
|
|
37
|
+
[NEW MESSAGES]
|
|
38
|
+
{new_messages}`}},quote_reply:{key:`quote_reply`,appliedIn:`convex`,togglable:!0,placeholders:[`excerpt`],defaultTemplate:{fr:`[EN RÉPONSE À]
|
|
39
|
+
L'utilisateur répond à ce passage précis d'une réponse précédente de l'assistant :
|
|
40
|
+
> {excerpt}
|
|
41
|
+
Traite sa consigne comme portant spécifiquement sur ce passage.`,en:`[IN REPLY TO]
|
|
42
|
+
The user is replying to this specific passage of a previous assistant answer:
|
|
43
|
+
> {excerpt}
|
|
44
|
+
Treat their instruction as targeting that passage specifically.`},pluralDefaultTemplate:{fr:`[EN RÉPONSE À]
|
|
45
|
+
L'utilisateur répond à ces passages précis de réponses précédentes de l'assistant :
|
|
46
|
+
> {excerpt}
|
|
47
|
+
Traite sa consigne comme portant spécifiquement sur ces passages.`,en:`[IN REPLY TO]
|
|
48
|
+
The user is replying to these specific passages of previous assistant answers:
|
|
49
|
+
> {excerpt}
|
|
50
|
+
Treat their instruction as targeting those passages specifically.`},disabledTemplate:{fr:`> {excerpt}`,en:`> {excerpt}`}},file_curation:{key:`file_curation`,appliedIn:`convex`,togglable:!0,placeholders:[`file_name`,`budget_chars`,`feedback`,`content`],defaultTemplate:{fr:`[CURATION DE FICHIER D'AGENT]
|
|
51
|
+
Tu es le CURATEUR des fichiers d'agent de cette passerelle. Rationalise le fichier {file_name} ci-dessous pour le ramener SOUS {budget_chars} caractères en PRÉSERVANT toutes les informations pertinentes : supprime les redondances et les doublons, fusionne les entrées équivalentes, condense sans perdre un fait porteur, restructure pour la clarté. La QUALITÉ prime sur la quantité. N'invente rien, ne suppose rien.
|
|
52
|
+
|
|
53
|
+
Rôle du fichier (adapte la curation à ce rôle) :
|
|
54
|
+
- MEMORY.md : index de la mémoire durable de l'agent — chaque entrée pointe vers un souvenir ; conserve les références et leur sens, fusionne les doublons.
|
|
55
|
+
- AGENTS.md : règles et consignes de travail — conserve chaque règle distincte ; condense les explications, jamais les interdictions.
|
|
56
|
+
- SOUL.md : personnalité et ton — conserve l'intention, condense les exemples.
|
|
57
|
+
- IDENTITY.md : identité (nom, rôle, langue) — quasi incompressible, ne retire que les répétitions.
|
|
58
|
+
- TOOLS.md : notes d'usage des outils — conserve chaque outil et ses pièges connus.
|
|
59
|
+
- USER.md : contexte sur l'utilisateur — conserve les faits et préférences, fusionne les redites.
|
|
60
|
+
|
|
61
|
+
[RETOUR DE L'ADMINISTRATEUR SUR LA PROPOSITION PRÉCÉDENTE]
|
|
62
|
+
{feedback}
|
|
63
|
+
|
|
64
|
+
RÈGLES DE SORTIE STRICTES :
|
|
65
|
+
- Réponds UNIQUEMENT avec le contenu réécrit du fichier (markdown brut).
|
|
66
|
+
- AUCUN préambule, AUCUN commentaire, AUCUNE ligne MEDIA:, AUCUN bloc de code englobant.
|
|
67
|
+
|
|
68
|
+
--- CONTENU ACTUEL DE {file_name} ---
|
|
69
|
+
{content}`,en:`[AGENT-FILE CURATION]
|
|
70
|
+
You are the CURATOR of this gateway's agent files. Rationalize the file {file_name} below to bring it UNDER {budget_chars} characters while PRESERVING all relevant information: remove redundancies and duplicates, merge equivalent entries, condense without losing a load-bearing fact, restructure for clarity. QUALITY over quantity. Never invent, never assume.
|
|
71
|
+
|
|
72
|
+
Role of the file (adapt the curation to it):
|
|
73
|
+
- MEMORY.md: the agent's durable memory index — each entry points to a memory; keep the references and their meaning, merge duplicates.
|
|
74
|
+
- AGENTS.md: working rules and instructions — keep every distinct rule; condense explanations, never prohibitions.
|
|
75
|
+
- SOUL.md: personality and tone — keep the intent, condense the examples.
|
|
76
|
+
- IDENTITY.md: identity (name, role, language) — nearly incompressible, only remove repetitions.
|
|
77
|
+
- TOOLS.md: tool-usage notes — keep every tool and its known pitfalls.
|
|
78
|
+
- USER.md: context about the user — keep facts and preferences, merge restatements.
|
|
79
|
+
|
|
80
|
+
[ADMINISTRATOR FEEDBACK ON THE PREVIOUS PROPOSAL]
|
|
81
|
+
{feedback}
|
|
82
|
+
|
|
83
|
+
STRICT OUTPUT RULES:
|
|
84
|
+
- Reply ONLY with the rewritten file content (raw markdown).
|
|
85
|
+
- NO preamble, NO commentary, NO MEDIA: line, NO wrapping code fence.
|
|
86
|
+
|
|
87
|
+
--- CURRENT CONTENT OF {file_name} ---
|
|
88
|
+
{content}`},disabledTemplate:{fr:`[FICHIER {file_name} — budget {budget_chars} caractères]
|
|
89
|
+
[RETOUR ADMIN]
|
|
90
|
+
{feedback}
|
|
91
|
+
|
|
92
|
+
{content}`,en:`[FILE {file_name} — budget {budget_chars} characters]
|
|
93
|
+
[ADMIN FEEDBACK]
|
|
94
|
+
{feedback}
|
|
95
|
+
|
|
96
|
+
{content}`}}},vse=Object.keys(lw);function yse(e,t,n){return t.enabled?t.template:lw[e].disabledTemplate?.[n]??``}function bse(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>{let r=t[n];return r===void 0?e:r})}var uw=[],dw=new Map,fw=new Set;function pw(){for(let e of fw)e()}function mw(e){return`${e.messageId}:${e.blockIndex??`all`}`}function xse(e,t){let n=dw.get(e)??uw;return n.some(e=>mw(e)===mw(t))?`ok`:n.length>=10?`too-many`:n.reduce((e,t)=>e+t.excerpt.length,0)+t.excerpt.length>1500?`too-long`:(dw.set(e,[...n,t]),pw(),`ok`)}function hw(e,t){let n=dw.get(e);if(n===void 0)return;let r=n.filter(e=>mw(e)!==t);r.length!==n.length&&(r.length===0?dw.delete(e):dw.set(e,r),pw())}var gw=mw;function Sse(e){dw.delete(e)&&pw()}function _w(e){let t=dw.get(e)??uw;return t.length>0&&(dw.delete(e),pw()),t}function Cse(e,t){if(t.length===0)return{restored:0,dropped:0};let n=dw.get(e)??uw,r=new Set,i=0;for(let e of n)r.add(mw(e)),i+=e.excerpt.length;let a=[],o=0;for(let e of t)if(!r.has(mw(e))){if(n.length+a.length>=10||i+e.excerpt.length>1500){o+=1;continue}r.add(mw(e)),i+=e.excerpt.length,a.push(e)}let s=[...a,...n];return s.length===0?dw.delete(e):dw.set(e,s),pw(),{restored:a.length,dropped:o}}function vw(e,t,n){let r=t.filter(e=>!n.has(e.messageId)),{restored:i,dropped:a}=Cse(e,r);return{restored:i,gone:t.length-r.length,dropped:a}}function yw(e){return(0,z.useSyncExternalStore)(e=>(fw.add(e),()=>fw.delete(e)),()=>e===null?uw:dw.get(e)??uw)}var bw=null;function wse(e,t){e.currentIndex=0,e.wipContextDeps=null,e.wipCommitCallbacks=[];let n=bw;bw=e;try{if(t(),e.isFirstRender=!1,e.cells.length!==e.currentIndex)throw Error(`Rendered ${e.currentIndex} hooks but expected ${e.cells.length}. Hooks must be called in the exact same order in every render.`)}finally{bw=n}}function xw(){if(!bw)throw Error(`No resource fiber available`);return bw}function Sw(){return bw}var Cw=Symbol(`tap.Context.defaultValue`),Tse=e=>e,ww=new Map,Tw=new Set,Ew=()=>new Map(ww),Dw=(e,t)=>{let n=ww;ww=e;try{return t()}finally{ww=n}},Ow=(e,t)=>{e[Cw]=t},kw=e=>typeof e==`object`&&!!e&&Cw in e,Aw=e=>typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===Symbol.for(`react.context`),jw=e=>kw(e)||Aw(e),Mw=e=>{if(!kw(e)){if(Aw(e)){Ow(e,e._currentValue??e._currentValue2);return}throw Error("A tap resource's `use()` only accepts a tap context.")}},Nw=(e,t,n)=>{if(typeof e!=`object`||!e)throw Error(`useContextProvider only accepts a React context.`);Mw(e);let r=e,i=xw(),a=fT(void 0),o=a.current===void 0||!Object.is(a.current.value,t);hT(()=>{a.current={value:t}},[t]);let s=ww.get(r),c=s!==void 0||ww.has(r);ww.set(r,{value:t,source:i});try{return Ese(r,o,n)}finally{c?ww.set(r,s):ww.delete(r)}},Ese=(e,t,n)=>{let r=Tw.has(e);t?Tw.add(e):Tw.delete(e);try{return n()}finally{r?Tw.add(e):Tw.delete(e)}},Dse=e=>{Mw(e);let t=e,n=Ose(t,e),r=xw();return(r.wipContextDeps??=new Map).set(t,n.source),n.value},Ose=(e,t)=>ww.get(e)??{value:Tse(t)[Cw],source:null},kse=(e,t,n,r)=>{if(!r)return n;let i=n;for(let[n,a]of r)a===t||a===e||(i??=new Map).set(n,a);return i},Pw=(e,t=e.wipContextDeps)=>{let n=Sw();!n||!t||(n.wipContextDeps=kse(n,e,n.wipContextDeps,t))},Fw=()=>Tw.size>0,Iw=e=>{if(!e.contextDeps||!Fw())return!1;for(let t of Tw.keys())if(e.contextDeps.has(t))return!0;return!1},Ase=[0,1,2,3];function Lw(e){let t=[];for(let n of Ase){let r=e[n];if(r!==void 0)for(let e=0;e<r.length;e++)try{r[e]()}catch(e){t.push(e)}}if(t.length>0){if(t.length===1)throw t[0];for(let e of t)console.error(e);throw AggregateError(t,`Errors during commit`)}}function Rw(e){let t=[];for(let n of e.cells)if(n?.type===`effect`&&(n.deps=null,n.cleanup))try{n.cleanup?.()}catch(e){t.push(e)}finally{n.cleanup=void 0}if(t.length>0){if(t.length===1)throw t[0];for(let e of t)console.error(e);throw AggregateError(t,`Errors during cleanup`)}}var zw=typeof process<`u`&&!1,Bw=e=>({version:0,committedVersion:0,context:Ew(),dispatchUpdate:e,changelog:[],rollbackCallbacks:[]}),Vw=e=>{e.committedVersion=e.version,e.changelog.length=0,e.rollbackCallbacks.length=0},Hw=(e,t)=>{let n=e.version>t;if(e.version=t,n){for(let t=0;t<e.rollbackCallbacks.length;t++)e.rollbackCallbacks[t]();if(e.rollbackCallbacks.length=0,t===e.committedVersion)e.changelog.length=0;else{if(e.committedVersion>t)throw Error(`Version is less than committed version`);for(;e.committedVersion+e.changelog.length>t;)e.changelog.pop();for(let t=0;t<e.changelog.length;t++)Uw(e.changelog[t]);Vw(e)}}},Uw=e=>{Kw(e.fiber,e.cell),e.queued||(e.queued=!0,(e.cell.queue??=[]).push(e))},Ww=(e,t,n)=>{let r=e.wipCommitCallbacks;(r[t]??=[]).push(n)},Gw=(e,t)=>{e.rollbackCallbacks.push(t)},Kw=(e,t)=>{t.isDirty||(t.isDirty=!0,e.markDirty?.(),Gw(e.root,()=>{if(t.queue!==null){for(let e of t.queue)e.queued=!1;t.queue=null}t.workInProgress=t.current,t.isDirty=!1}))},qw=()=>{throw Error(`Rendered more hooks than during the previous render. Hooks must be called in the exact same order in every render.`)},Jw=()=>{throw Error(`Hook order changed between renders`)},jse=(e,t,n)=>{if(e.isNeverMounted)throw Error(`Resource updated before mount`);let r=!1,i=!0;e.root.dispatchUpdate(()=>r?i:(r=!0,n&&e.root.changelog.length===0&&!t.cell.isDirty&&!t.hasEagerState&&(t.eagerState=n(t.cell.workInProgress,t.action),t.hasEagerState=!0,i=!Object.is(t.cell.current,t.eagerState)),i),()=>(r=!0,i=!0,Uw(t),e.root.changelog.push(t),!0))},Mse=(e,t,n,r,i)=>{let a=r?r(n):n;zw&&e.devStrictMode&&r&&r(n);let o={type:`reducer`,workInProgress:a,current:a,isDirty:!1,queue:null,renderQueue:null,reducer:t,dispatch:n=>{let r=Sw();if(r!==null){if(r!==e)throw Error(`Cannot update a resource while rendering a different resource.`);(e.renderPendingCells??=new Set).add(o),(o.renderQueue??=[]).push(n)}else jse(e,{fiber:e,cell:o,action:n,hasEagerState:!1,eagerState:void 0,queued:!1},i?t:void 0)}};return o};function Yw(e,t,n,r){let i=xw(),a=i.currentIndex++,o=i.cells[a],s=(()=>{if(o!==void 0)return o.type===`reducer`?o:Jw();!i.isFirstRender&&a>=i.cells.length&&qw();let s=Mse(i,e,t,n,r);return i.cells[a]=s,s})(),c=s.queue;if(c!==null){let t=e===s.reducer;for(let n=0;n<c.length;n++){let r=c[n];!r.hasEagerState||!t?(r.eagerState=e(s.workInProgress,r.action),r.hasEagerState=!0,zw&&i.devStrictMode&&(r.eagerState=e(s.workInProgress,r.action))):zw&&i.devStrictMode&&e(s.workInProgress,r.action),r.queued=!1,s.workInProgress=r.eagerState}s.queue=null}if(s.reducer=e,s.renderQueue!==null){let t=s.workInProgress;for(let n of s.renderQueue)t=e(t,n);s.renderQueue=null,i.renderPendingCells?.delete(s),Object.is(t,s.workInProgress)||(Kw(i,s),s.workInProgress=t)}return s.isDirty&&Ww(i,0,()=>{s.current=s.workInProgress,s.isDirty=!1}),[s.workInProgress,s.dispatch]}function Xw(e,t,n){return Yw(e,t,n,!1)}var Nse=(e,t)=>typeof t==`function`?t(e):t,Pse=e=>e===void 0?void 0:typeof e==`function`?e():e;function Zw(e){return Yw(Nse,e,Pse,!0)}var Qw=(e,t)=>{zw&&e.length!==t.length&&console.error(`The final argument passed to a hook changed size between renders. The order and size of this array must remain constant.
|
|
97
|
+
|
|
98
|
+
Previous: [${e.join(`, `)}]\nIncoming: [${t.join(`, `)}]`);for(let n=0;n<e.length&&n<t.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0},$w=(e,t)=>{Ww(e,0,()=>{t.current=t.wip,t.currentDeps=t.wipDeps,t.isDirty=!1})},eT=(e,t)=>{let n=xw(),r=n.currentIndex++,i=n.cells[r];if(i===void 0){!n.isFirstRender&&r>=n.cells.length&&qw();let a=e();return zw&&n.devStrictMode&&e(),i={type:`memo`,current:a,currentDeps:t,wip:a,wipDeps:t,isDirty:!1},n.cells[r]=i,a}i.type!==`memo`&&Jw();let a=i;if(Qw(a.wipDeps,t))return a.isDirty&&$w(n,a),a.wip;let o=e();return zw&&n.devStrictMode&&e(),a.wip=o,a.wipDeps=t,a.isDirty||(a.isDirty=!0,Gw(n.root,()=>{a.wip=a.current,a.wipDeps=a.currentDeps,a.isDirty=!1})),$w(n,a),o};function tT(e){return eT(()=>({current:e}),[])}var nT=(e,t)=>eT(()=>e,t),Fse=()=>({type:`effect`,cleanup:void 0,deps:null});function rT(e,t){let n=xw(),r=n.currentIndex++,i=n.cells[r],a=i===void 0?Fse():i.type===`effect`?i:Jw();if(i===void 0&&(!n.isFirstRender&&r>=n.cells.length&&qw(),n.cells[r]=a),!(t&&a.deps&&Qw(a.deps,t))){if(a.deps!==null&&!!t!=!!a.deps)throw Error(`useEffect called with and without dependencies across re-renders`);Ww(n,2,()=>{try{a.cleanup?.()}finally{a.cleanup=void 0}}),Ww(n,3,()=>{try{let t=e();if(t!==void 0&&typeof t!=`function`)throw Error(`An effect function must either return a cleanup function or nothing. Received: ${typeof t}`);a.cleanup=t}finally{a.deps=t}})}}function iT(e){let t=xw(),n=tT(e);return n.current!==e&&Ww(t,1,()=>{n.current=e}),nT(((...e)=>{if(zw&&Sw())throw Error(`useEffectEvent cannot be called during render`);return n.current(...e)}),[])}var aT=e=>{if(!jw(e))throw Error("A tap resource's `use()` only accepts a tap context.");return Dse(e)},oT=(e,t,n=t)=>{let r=tT(!0),i=r.current?n():t();r.current=!1;let[,a]=Zw(0),o=iT(()=>{Object.is(i,t())||a(e=>e+1)});return rT(()=>(o(),e(o)),[e]),i},Ise=(e,t)=>{},Lse=z.default;function Rse(e){let t=(0,z.useRef)(e);return(0,z.useInsertionEffect)(()=>{t.current=e}),(0,z.useCallback)(((...e)=>t.current(...e)),[])}var zse=Lse.useEffectEvent??Rse,sT=s({createContext:()=>bT,default:()=>z.default,use:()=>xT,useCallback:()=>mT,useContext:()=>ST,useDebugValue:()=>yT,useEffect:()=>hT,useEffectEvent:()=>_T,useLayoutEffect:()=>gT,useMemo:()=>pT,useReducer:()=>dT,useRef:()=>fT,useState:()=>uT,useSyncExternalStore:()=>vT});t(sT,r(e(),1));var cT=()=>Sw()!==null,lT=z.default,uT=e=>cT()?Zw(e):lT.useState(e),dT=(e,t,n)=>cT()?Xw(e,t,n):lT.useReducer(e,t,n),fT=e=>cT()?tT(e):lT.useRef(e),pT=(e,t)=>cT()?eT(e,t):lT.useMemo(e,t),mT=(e,t)=>cT()?nT(e,t):lT.useCallback(e,t),hT=(e,t)=>cT()?rT(e,t):lT.useEffect(e,t),gT=(e,t)=>cT()?rT(e,t):lT.useLayoutEffect(e,t),_T=e=>cT()?iT(e):zse(e),vT=(e,t,n)=>cT()?oT(e,t,n):lT.useSyncExternalStore(e,t,n),yT=(e,t)=>cT()?void 0:lT.useDebugValue(e,t),bT=e=>{let t=lT.createContext(e);return Ow(t,e),t},xT=e=>cT()&&jw(e)?aT(e):lT.use(e),ST=e=>cT()&&jw(e)?aT(e):lT.useContext(e),CT=z.default,wT=Symbol.for(`react.memo_cache_sentinel`),TT=e=>Array(e).fill(wT),Bse=e=>CT.useMemo(()=>{let t=TT(e);return t[wT]=!0,t},[]),V=e=>{let t=Sw();if(t===null)return(CT.__COMPILER_RUNTIME?.c??Bse)(e);let n=t.memoCache,r=n.workInProgress;if(r===null){let e=n.current;r=e===null?[]:e.map(e=>e.slice()),n.workInProgress=r}let i=n.index++,a=r[i];return a===void 0?(a=TT(e),r[i]=a):zw&&a.length!==e&&console.error(`Expected a constant size argument for each invocation of c(). The previous cache was allocated with size ${a.length} but size ${e} was requested.`),a};function ET(e){return(...t)=>({hook:e,args:t})}function DT(e,t,n){return n?{...t,key:e,deps:n}:{...t,key:e}}var Vse=50,OT={schedulers:new Set([]),isScheduled:!1},Hse=class{_task;_isDirty=!1;constructor(e){this._task=e}get isDirty(){return this._isDirty}markDirty(){this._isDirty=!0,OT.schedulers.add(this),Use()}runTask(){this._isDirty=!1,this._task()}},Use=()=>{OT.isScheduled||(OT.isScheduled=!0,Wse())},kT=()=>{try{let e=[],t=0;for(let n of OT.schedulers)if(OT.schedulers.delete(n),n.isDirty){if(t++,t>Vse)throw Error(`Maximum update depth exceeded. This can happen when a resource repeatedly calls setState inside useEffect.`);try{n.runTask()}catch(t){e.push(t)}}if(e.length>0){if(e.length===1)throw e[0];for(let t of e)console.error(t);throw AggregateError(e,`Errors occurred during flushSync`)}}finally{OT.schedulers.clear(),OT.isScheduled=!1}},Wse=(()=>{if(typeof MessageChannel<`u`){let e=new MessageChannel;return e.port1.onmessage=kT,()=>e.port2.postMessage(null)}return()=>setTimeout(kT,0)})(),AT=e=>{let t=OT;OT={schedulers:new Set([]),isScheduled:!0};try{let t=e();return kT(),t}finally{OT=t}},Gse={useState:Zw,useReducer:Xw,useRef:tT,useMemo:eT,useCallback:nT,useEffect:rT,useLayoutEffect:rT,useInsertionEffect:rT,useEffectEvent:iT,useContext:aT,use:aT,useSyncExternalStore:oT,useDebugValue:Ise},jT=z.default,MT=jT.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE??jT.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,NT=MT==null?null:`H`in MT?{get current(){return MT.H},set current(e){MT.H=e}}:`ReactCurrentDispatcher`in MT?{get current(){return MT.ReactCurrentDispatcher.current},set current(e){MT.ReactCurrentDispatcher.current=e}}:null;function Kse(e){if(!NT)return e();let t=NT.current;NT.current=Gse;try{return e()}finally{NT.current=t}}function PT(e,t,n=void 0,r){return{hook:e,root:t,markDirty:n,devStrictMode:r,cells:[],contextDeps:null,wipContextDeps:null,commitCallbacks:null,wipCommitCallbacks:null,memoCache:{current:null,workInProgress:null,index:0},renderPendingCells:null,currentIndex:0,isFirstRender:!0,isMounted:!1,isNeverMounted:!0}}function FT(e){if(!e.isMounted)throw Error(`Tried to unmount a fiber that is already unmounted`);e.isMounted=!1,Rw(e)}function IT(e,t){if(e.memoCache.workInProgress=null,e.renderPendingCells!==null){for(let t of e.renderPendingCells)t.renderQueue=null;e.renderPendingCells.clear()}let n=0,r;do{if(++n>25)throw Error(`Too many re-renders. tap limits the number of renders to prevent an infinite loop.`);e.memoCache.index=0,wse(e,()=>{r=Kse(()=>e.hook(...t))})}while((e.renderPendingCells?.size??0)>0);return Pw(e),r}function LT(e){let t=e.wipCommitCallbacks??e.commitCallbacks??[];e.wipCommitCallbacks=null,e.commitCallbacks=t,e.isMounted=!0,e.contextDeps=e.wipContextDeps,Vw(e.root),e.memoCache.workInProgress!==null&&(e.memoCache.current=e.memoCache.workInProgress,e.memoCache.workInProgress=null),zw&&e.isNeverMounted&&e.devStrictMode===`root`&&(e.isNeverMounted=!1,Lw(t),Rw(e)),e.isNeverMounted=!1,Lw(t)}var qse=()=>{let e=xw();return e.devStrictMode?e.isFirstRender?`child`:`root`:null},Jse=()=>`child`,RT=()=>null,Yse=()=>{if(!zw)return RT;let e=fT(0);return uT(()=>e.current++),e.current===2?Jse:RT},zT=()=>Sw()?qse:Yse(),Xse=e=>e(),Zse=e=>{let t=pT(()=>new Hse(()=>p()),[]),n=pT(()=>[],[]),r=zT(),i=pT(()=>{let e=Bw((r,i)=>{if(!t.isDirty){if(!r())return;i()}Hw(e,e.committedVersion+e.changelog.length),n.push(i),t.markDirty()});return PT(Xse,e,void 0,r())},[n,t,r]),a=Ew(),o=i.root.version-i.root.committedVersion,s=Dw(a,()=>IT(i,[e])),c=fT(!1),l=fT([e]),u=fT(s),d=pT(()=>new Set,[]),f=e=>{t.isDirty||u.current===e||(u.current=e,d.forEach(e=>e()))},p=_T(()=>{Hw(i.root,i.root.committedVersion),n.forEach(e=>{zw&&i.devStrictMode&&e(),e()}),Hw(i.root,i.root.committedVersion+i.root.changelog.length),zw&&i.devStrictMode&&Dw(i.root.context,()=>IT(i,l.current));let e=Dw(i.root.context,()=>IT(i,l.current));if(t.isDirty)throw Error(`Scheduler is dirty, this should never happen`);Vw(i.root),n.length=0,c.current&<(i),f(e)});return hT(()=>(c.current=!0,()=>{c.current=!1,FT(i)}),[i]),hT(()=>{l.current=[e],Vw(i.root),n.splice(0,o),i.root.context=a,LT(i),f(s)}),pT(()=>({getValue:()=>u.current,subscribe:e=>(d.add(e),()=>d.delete(e))}),[d])},Qse=()=>{let e=fT(0),t=e.current,n=xw();return{version:t,markDirty:pT(()=>()=>{e.current++,n?.markDirty?.()},[n]),root:n.root}},$se=()=>{let e=pT(()=>Bw((e,t)=>{let i=!1;r(t=>(i=!e(),i?t:t+1)),i||n(t)}),[]),[t,n]=dT((t,n)=>(Hw(e,t),t+ +!!n()),0),[,r]=uT(0);return Hw(e,t),{root:e,version:t,markDirty:void 0}},BT=()=>{let e=zT(),{root:t,version:n,markDirty:r}=Sw()?Qse():$se();return{version:n,createFiber:mT((n,i,a)=>PT(n,t,a?()=>{a(),r?.()}:r,e()),[])}},VT=(e,t,n)=>{let r=fT(null),i=r.current??={wipDeps:null,wip:null,currentDeps:null,current:null};return i.wipDeps=i.currentDeps,i.wip=i.current,hT(()=>{i.currentDeps=i.wipDeps,i.current=i.wip}),!n&&i.currentDeps&&Qw(i.currentDeps,t)?i.current:(i.wipDeps=t,i.wip=e(),i.wip)};function HT(e){let{version:t,createFiber:n}=BT(),r=pT(()=>n(e.hook,e.key),[e.hook,e.key,n]),i=VT(()=>({value:IT(r,e.args)}),[r,t,e.args],Iw(r));return hT(()=>()=>FT(r),[r]),hT(()=>{LT(r)},[r,i]),i.value}var UT=(e,t)=>{let n=e.get(t);n&&(n.isDirty=!0)},ece=(e,t)=>!e.isDirty&&!Iw(e.fiber)&&t!==void 0&&e.committedDeps!==void 0&&Qw(e.committedDeps,t),tce=e=>{if(!Fw())return!1;for(let{fiber:t}of e.values())if(Iw(t))return!0;return!1};function WT(e){let t=pT(()=>new Map,[]),{version:n,createFiber:r}=BT(),i=tce(t),a=VT(()=>{let n=new Set,i=[],a=0;for(let o=0;o<e.length;o++){let s=e[o],c=s.key;if(c===void 0)throw Error(`useResources did not provide a key for array at index ${o}`);if(n.has(c))throw Error(`Duplicate key ${c} in useResources`);n.add(c);let l=t.get(c);if(!l){let e=r(s.hook,s.key,()=>UT(t,c));l={fiber:e,next:{value:IT(e,s.args),deps:s.deps},isDirty:!1,committedDeps:void 0,committedValue:void 0},a++,t.set(c,l)}else if(l.fiber.hook!==s.hook){let e=r(s.hook,s.key,()=>UT(t,c)),n=IT(e,s.args);l.next={value:n,deps:s.deps,remount:e}}else if(ece(l,s.deps))l.fiber.contextDeps&&Pw(l.fiber,l.fiber.contextDeps),l.next=`skip`;else{let e=IT(l.fiber,s.args);l.next={value:e,deps:s.deps}}i.push(typeof l.next==`object`?l.next.value:l.committedValue)}if(t.size>i.length-a)for(let e of t.keys())n.has(e)||(t.get(e).next=`delete`);return i},[e,t,r,n],i);return hT(()=>()=>{for(let e of t.keys()){let n=t.get(e).fiber;FT(n)}},[t]),hT(()=>{for(let[e,n]of t.entries()){let r=n.next;r===`delete`?(n.fiber.isMounted&&FT(n.fiber),t.delete(e)):r===`skip`||(r.remount&&(FT(n.fiber),n.fiber=r.remount),LT(n.fiber),n.committedDeps=r.deps,n.committedValue=r.value,n.isDirty=!1)}},[a,t]),a}var nce=e=>e(),rce=e=>{let{createFiber:t}=BT(),n=pT(()=>t(nce,void 0),[t]),r=IT(n,[e]);hT(()=>()=>{FT(n)},[n]);let i=!1,a=()=>{i&&n.isMounted||(i=!0,LT(n))};return hT(a),{value:r,effects:a}},ice=ET(()=>{let e=V(4),[t,n]=uT(ace),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(e,t)=>(n(n=>({...n,renderers:{...n.renderers,[e]:[...n.renderers[e]??[],t]}})),()=>{n(n=>({...n,renderers:{...n.renderers,[e]:n.renderers[e]?.filter(e=>e!==t)??[]}}))}),e[0]=r):r=e[0];let i=r,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=e=>(n(t=>({...t,fallbacks:[...t.fallbacks,e]})),()=>{n(t=>({...t,fallbacks:t.fallbacks.filter(t=>t!==e)}))}),e[1]=a):a=e[1];let o=a,s;return e[2]===t?s=e[3]:(s={getState:()=>t,setDataUI:i,setFallbackDataUI:o},e[2]=t,e[3]=s),s});function ace(){return{renderers:{},fallbacks:[]}}var oce=e=>{let t=Array.from(e).map(e=>e.getModelContext()).sort((e,t)=>(t.priority??0)-(e.priority??0)),n={};return t.reduce((e,t)=>{let r=t.priority??0;if(t.system&&(e.system?e.system+=`\n\n${t.system}`:e.system=t.system),t.tools)for(let[i,a]of Object.entries(t.tools)){let t=e.tools?.[i];if(t&&t!==a){let o=n[i];if(o===r)throw Error(`You tried to define a tool with the name ${i}, but it already exists.`);let s=o>r?t:a,c=o>r?a:t;e.tools[i]={...c,...s},n[i]=Math.max(o,r);continue}e.tools||={},e.tools[i]=a,n[i]??=r}return t.config&&(e.config={...e.config,...t.config}),t.callSettings&&(e.callSettings={...e.callSettings,...t.callSettings}),e},{})},GT=class{_providers=new Set;getModelContext(){return oce(this._providers)}registerModelContextProvider(e){this._providers.add(e);let t=e.subscribe?.(()=>{this.notifySubscribers()});return this.notifySubscribers(),()=>{this._providers.delete(e),t?.(),this.notifySubscribers()}}_subscribers=new Set;notifySubscribers(){for(let e of this._subscribers)e()}subscribe(e){return this._subscribers.add(e),()=>{this._subscribers.delete(e)}}},KT=[],sce={modelName:void 0,toolNames:KT},cce=(e,t)=>e===t||e.length===t.length&&e.every((e,n)=>e===t[n]),qT=(e,t)=>{let n=e.getModelContext(),r=n.config?.modelName,i=n.tools?Object.keys(n.tools).sort():KT,a=i.length?i:KT;return r===t.modelName&&cce(a,t.toolNames)?t:{modelName:r,toolNames:a}},JT=ET(()=>{let e=V(11),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=new GT,e[0]=t):t=e[0];let n=t,r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>qT(n,sce),e[1]=r):r=e[1];let[i,a]=uT(r),o,s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>(a(e=>qT(n,e)),n.subscribe(()=>{a(e=>qT(n,e))})),s=[n],e[2]=o,e[3]=s):(o=e[2],s=e[3]),hT(o,s);let c;e[4]===i?c=e[5]:(c=()=>qT(n,i),e[4]=i,e[5]=c);let l,u,d;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>n.getModelContext(),u=e=>n.subscribe(e),d=e=>n.registerModelContextProvider(e),e[6]=l,e[7]=u,e[8]=d):(l=e[6],u=e[7],d=e[8]);let f;return e[9]===c?f=e[10]:(f={getState:c,getModelContext:l,subscribe:u,register:d},e[9]=c,e[10]=f),f}),lce=e=>e.display===void 0?e.type===`human`:e.display===`standalone`,uce=(e,t)=>{if(!(t.status?.type===`running`||t.status?.type===`requires-action`)){let n=e.complete;return typeof n==`function`?n({args:t.args,result:t.result}):n??null}let n=e.running;return typeof n==`function`?n({args:t.args}):n??null},dce=e=>function(t){return uce(e,t)},YT=Symbol(`assistant-ui.store.clientIndex`),fce=e=>e[YT],XT=bT([]),ZT=()=>xT(XT),pce=(e,t)=>{let n=V(3),r=ZT(),i;return n[0]!==e||n[1]!==r?(i=[...r,e],n[0]=e,n[1]=r,n[2]=i):i=n[2],Nw(XT,i,t)},mce=new Set([`$$typeof`,`nodeType`,`then`]),QT=(e,t)=>{if(e===Symbol.toStringTag)return t;if(typeof e!=`symbol`){if(e===`toJSON`)return()=>t;if(!mce.has(e))return!1}},$T=class{getOwnPropertyDescriptor(e,t){let n=this.get(e,t);if(n!==void 0)return{value:n,writable:!1,enumerable:!0,configurable:!1}}set(){return!1}setPrototypeOf(){return!1}defineProperty(){return!1}deleteProperty(){return!1}preventExtensions(){return!1}},eE=Symbol(`assistant-ui.store.getValue`),hce=e=>{let t=e[eE];if(!t)throw Error(`Client scope contains a non-client resource. Ensure your Derived get() returns a client created with useClientResource(), not a plain resource.`);return t.getState?.()},tE=new Map;function gce(e){let t=tE.get(e);return t||(t=function(...t){if(!this||typeof this!=`object`)throw Error(`Method "${String(e)}" called without proper context. This may indicate the function was called incorrectly.`);let n=this[eE];if(!n)throw Error(`Method "${String(e)}" called on invalid client proxy. Ensure you are calling this method on a valid client instance.`);let r=n[e];if(!r)throw Error(`Method "${String(e)}" is not implemented.`);if(typeof r!=`function`)throw Error(`"${String(e)}" is not a function.`);return r(...t)},tE.set(e,t)),t}var _ce=class extends $T{outputRef;index;boundFns;cachedReceiver;constructor(e,t){super(),this.outputRef=e,this.index=t}get(e,t,n){if(t===eE)return this.outputRef.current;if(t===YT)return this.index;let r=QT(t,`ClientProxy`);if(r!==!1)return r;let i=this.outputRef.current[t];if(typeof i==`function`){this.cachedReceiver!==n&&(this.boundFns=new Map,this.cachedReceiver=n);let e=this.boundFns.get(t);return e||(e=gce(t).bind(n),this.boundFns.set(t,e)),e}return i}ownKeys(){return Object.keys(this.outputRef.current)}has(e,t){return t===eE||t===YT?!0:t in this.outputRef.current}},nE=e=>{let t=fT(null),n=ZT().length,r=pT(()=>new Proxy({},new _ce(t,n)),[n]),i=pce(r,function(){return HT(e)});return t.current||=i,hT(()=>{t.current=i}),{methods:r,state:i.getState?.(),key:e.key}},vce=ET(nE),rE=Symbol(`assistant-ui.store.proxiedAssistantState`),iE=e=>e===`on`||e===`subscribe`||typeof e==`symbol`,aE=e=>{class t extends $T{get(t,n){let r=QT(n,`AssistantState`);if(r!==!1)return r;let i=n;if(!iE(i))return hce(e[i]())}ownKeys(){return Object.keys(e).filter(e=>!iE(e))}has(t,n){return!iE(n)&&n in e}}return new Proxy({},new t)},yce=e=>e[rE],bce=()=>()=>{},oE=e=>{let t=(()=>{throw Error(e)});return t.source=null,t.query=null,t},sE=new Proxy({},new class extends $T{get(e,t){if(t===`subscribe`||t===`on`)return bce;if(t===rE)return xce;let n=QT(t,`DefaultAssistantClient`);return n===!1?oE(`You are using a component or hook that requires an AuiProvider. Wrap your component in an <AuiProvider> component.`):n}ownKeys(){return[`subscribe`,`on`,rE]}has(e,t){return t===`subscribe`||t===`on`||t===rE}}),xce=aE(sE),Sce=()=>new Proxy({},{get(e,t){let n=QT(t,`AssistantClient`);return n===!1?oE(`The current scope does not have a "${String(t)}" property.`):n}}),cE=bT(sE),lE=Symbol(`assistant-ui.store.useEffects`),Cce=()=>{},wce=e=>e[lE]??Cce,Tce=()=>{"use no memo";return hT(wce(uE())),null},uE=()=>ST(cE),dE=({value:e,children:t})=>{"use no memo";return(0,B.jsxs)(cE.Provider,{value:e,children:[(0,B.jsx)(Tce,{}),t]})},fE=e=>null,pE=ET(fE),mE=Symbol(`assistant-ui.transform-scopes`);function hE(e,t){let n=e;if(n[mE])throw Error(`transformScopes is already attached to this resource`);n[mE]=t}function Ece(e){return e[mE]}var gE=e=>typeof e==`string`?{scope:e.split(`.`)[0],event:e}:{scope:e.scope,event:e.event},_E=bT(null),Dce=(e,t)=>Nw(_E,e,t),vE=()=>{let e=xT(_E);if(!e)throw Error(`AssistantTapContext is not available`);return e},yE=()=>vE().clientRef,bE=()=>{let e=V(3),{emit:t}=vE(),n=ZT(),r;return e[0]!==n||e[1]!==t?(r=(e,r)=>{t(e,r,n)},e[0]=n,e[1]=t,e[2]=r):r=e[2],_T(r)};function Oce(e,t){let n={...e},r=new Set,i=!0;for(;i;){i=!1;for(let e of Object.values(n)){if(e.hook===fE||r.has(e.hook))continue;r.add(e.hook);let a=Ece(e.hook);if(a){a(n,t),i=!0;break}}}let a={},o={};for(let[e,t]of Object.entries(n))t.hook===fE?o[e]=t:a[e]=t;return{rootClients:a,derivedClients:o}}var xE=e=>pT(()=>e,[...Object.entries(e).flat()]),kce=(e,t)=>{let n=V(6),r;n[0]!==t||n[1]!==e?(r=Oce(e,t),n[0]=t,n[1]=e,n[2]=r):r=n[2];let{rootClients:i,derivedClients:a}=r,o=xE(i),s=xE(a),c;return n[3]!==o||n[4]!==s?(c={rootClients:o,derivedClients:s},n[3]=o,n[4]=s,n[5]=c):c=n[5],c},Ace=ET(()=>{let e=V(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=new Map,e[0]=t):t=e[0];let n=t,r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=new Set,e[1]=r):r=e[1];let i=r,a;if(e[2]===Symbol.for(`react.memo_cache_sentinel`)){let t=new Set;a={on(e,t){let r=t;if(e===`*`)return i.add(r),()=>i.delete(r);let a=n.get(e);return a||(a=new Set,n.set(e,a)),a.add(r),()=>{a.delete(r),a.size===0&&n.delete(e)}},emit(e,t,r){let a=n.get(e);!a&&i.size===0||queueMicrotask(()=>{let n=[];if(a)for(let e of a)try{e(t,r)}catch(e){let t=e;n.push(t)}if(i.size>0){let a={event:e,payload:t};for(let e of i)try{e(a,r)}catch(e){let t=e;n.push(t)}}if(n.length>0){if(n.length===1)throw n[0];for(let e of n)console.error(e);throw AggregateError(n,`Errors occurred during event emission`)}})},subscribe(e){return t.add(e),()=>t.delete(e)},notifySubscribers(){for(let e of t)try{e()}catch(e){console.error(`NotificationManager: subscriber callback error`,e)}}},e[2]=a}else a=e[2];return a}),SE=e=>pT(()=>e,e),jce=({element:e,emit:t,clientRef:n})=>{let{methods:r,state:i}=Dce({clientRef:n,emit:t},function(){return nE(e)});return pT(()=>({state:i,methods:r}),[r,i])},Mce=ET(({element:e,notifications:t,clientRef:n,name:r})=>{let i=Zse(function(){return jce({element:e,emit:t.emit,clientRef:n})});return hT(()=>i.subscribe(t.notifySubscribers),[i,t]),pT(()=>{let e=()=>i.getValue().methods;return Object.defineProperties(e,{source:{value:`root`,writable:!1},query:{value:{},writable:!1},name:{value:r,configurable:!0}}),e},[i,r])}),Nce=ET(()=>{let e=V(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n={clients:t,subscribe:void 0,on:void 0},e[1]=n):n=e[1],n}),Pce=e=>{let t=V(14),{clients:n,clientRef:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=Ace(),t[0]=i):i=t[0];let a=HT(i),o;t[1]!==r.parent||t[2]!==a.notifySubscribers?(o=()=>r.parent.subscribe(a.notifySubscribers),t[1]=r.parent,t[2]=a.notifySubscribers,t[3]=o):o=t[3];let s;t[4]!==r||t[5]!==a?(s=[r,a],t[4]=r,t[5]=a,t[6]=s):s=t[6],hT(o,s);let c;t[7]!==r||t[8]!==n||t[9]!==a?(c=Object.keys(n).map(e=>DT(e,Mce({element:n[e],notifications:a,clientRef:r,name:e}))),t[7]=r,t[8]=n,t[9]=a,t[10]=c):c=t[10];let l=SE(WT(c)),u;return t[11]!==a||t[12]!==l?(u={notifications:a,results:l},t[11]=a,t[12]=l,t[13]=u):u=t[13],u},Fce=ET(e=>{let{clientRef:t}=e,{notifications:n,results:r}=Pce(e);return pT(()=>({clients:r,subscribe:n.subscribe,on:function(e,r){if(!this)throw Error(`const { on } = useAui() is not supported. Use aui.on() instead.`);let{scope:i,event:a}=gE(e);if(i!==`*`&&this[i].source===null)throw Error(`Scope "${i}" is not available. Use { scope: "*", event: "${a}" } to listen globally.`);let o=n.on(a,(e,t)=>{if(i===`*`){r(e);return}let n=this[i]();n===t[fce(n)]&&r(e)});if(i!==`*`&&t.parent[i].source===null)return o;let s=t.parent.on(e,r);return()=>{o(),s()}}}),[r,n,t])}),Ice=ET(({element:e,clientRef:t,name:n})=>{let r=fT(e.args[0]);return r.current=e.args[0],pT(()=>{let e=()=>r.current.get(t.current);return Object.defineProperties(e,{source:{value:r.current.source},query:{value:r.current.query},name:{value:n,configurable:!0}}),e},[t,n])}),Lce=(e,t)=>{let n;try{let e={};for(let n of Object.keys(t.query).sort())e[n]=t.query[n];n=JSON.stringify(e)}catch{n=String(t.query)}return`${e}::${t.source}::${n}`},Rce=e=>{let t=V(3),{clients:n,clientRef:r}=e,i;return t[0]!==r||t[1]!==n?(i=Object.keys(n).map(e=>{let t=e,i=n[t];return DT(Lce(t,i.args[0]),Ice({element:i,clientRef:r,name:t}))}),t[0]=r,t[1]=n,t[2]=i):i=t[2],SE(WT(i))},zce=e=>{let t=V(3),{rootClients:n,clientRef:r}=e,i;return t[0]!==r||t[1]!==n?(i=Object.keys(n).length>0?Fce({clients:n,clientRef:r}):Nce(),t[0]=r,t[1]=n,t[2]=i):i=t[2],HT(i)},Bce=({parent:e,clients:t})=>{let{rootClients:n,derivedClients:r}=kce(t,e),i=fT({parent:e,current:null}).current;hT(()=>{i.current=s});let a=zce({rootClients:n,clientRef:i}),o=Rce({clients:r,clientRef:i}),s=pT(()=>{let t=e===sE?Sce():e,n=Object.create(t);Object.assign(n,{subscribe:a.subscribe??e.subscribe,on:a.on??e.on,[rE]:aE(n)});for(let e of a.clients)n[e.name]=e;for(let e of o)n[e.name]=e;return n},[e,a,o]);return i.current===null&&(i.current=s),s},Vce=e=>{let{value:t,effects:n}=rce(function(){return Bce(e)});return t[lE]=n,t};function CE(e,{parent:t}={parent:uE()}){if(e)return Vce({parent:t??sE,clients:e});if(t===null)throw Error(`received null parent, this usage is not allowed`);return t}var H=e=>{let t=V(6),n=CE(),r;t[0]===n?r=t[1]:(r=yce(n),t[0]=n,t[1]=r);let i=r,a,o;t[2]!==i||t[3]!==e?(a=()=>e(i),o=()=>e(i),t[2]=i,t[3]=e,t[4]=a,t[5]=o):(a=t[4],o=t[5]);let s=vT(n.subscribe,a,o);if(s===i)throw Error(`You tried to return the entire AssistantState. This is not supported due to technical limitations.`);return yT(s),s},Hce=e=>{let t=CE(),n=fT(!1),r=n.current?null:e(t);return H(()=>n.current?e(t):r),()=>(n.current=!0,e(t))},Uce=Object.freeze({});function wE(e){let t=V(3),{getItemState:n,children:r}=e,i=Hce(n),a;return t[0]!==r||t[1]!==i?(a=r(i),t[0]=r,t[1]=i,t[2]=a):a=t[2],Wce(a)}var Wce=e=>{let t=typeof e==`object`&&e&&`type`in e?e:null,n=t?.type,r=t?.key;return pT(()=>t,[n,r,typeof t?.props==`object`&&t.props!=null&&Object.entries(t.props).length===0?Uce:t?.props])??e},Gce=z.createContext(!0);function TE(){throw Error(`A function wrapped in useEffectEvent can't be called during rendering.`)}var Kce=`use`in z.default?()=>{try{return z.use(Gce)}catch{return!1}}:()=>!1;function qce(e){let t=z.useRef(TE);return z.useInsertionEffect(()=>{t.current=e},[e]),(...e)=>{Kce()&&TE();let n=t.current;return n(...e)}}var EE=(e,t)=>{let n=V(11),r=CE(),i=qce(t),a;n[0]===e?a=n[1]:(a=gE(e),n[0]=e,n[1]=a);let{scope:o,event:s}=a,c;n[2]!==r||n[3]!==i||n[4]!==s||n[5]!==o?(c=()=>r.on({scope:o,event:s},i),n[2]=r,n[3]=i,n[4]=s,n[5]=o,n[6]=c):c=n[6];let l;n[7]!==r||n[8]!==s||n[9]!==o?(l=[r,o,s],n[7]=r,n[8]=s,n[9]=o,n[10]=l):l=n[10],hT(c,l)},Jce=e=>{if(e.key===void 0)throw Error(`useClientLookup: Element has no key`);return e.key};function DE(e){let t=V(15),n;t[0]===e?n=t[1]:(n=e.map(Zce),t[0]=e,t[1]=n);let r=WT(n),i;t[2]===r?i=t[3]:(i=Object.keys(r),t[2]=r,t[3]=i);let a=i,o;t[4]===r?o=t[5]:(o=r.reduce(Xce,{}),t[4]=r,t[5]=o);let s=o,c;t[6]===r?c=t[7]:(c=r.map(Yce),t[6]=r,t[7]=c);let l=c,u;t[8]!==s||t[9]!==a||t[10]!==r?(u=e=>{if(`index`in e){if(e.index<0||e.index>=a.length)throw Error(`useClientLookup: Index ${e.index} out of bounds (length: ${a.length})`);return r[e.index].methods}let t=s[e.key];if(t===void 0)throw Error(`useClientLookup: Key "${e.key}" not found`);return r[t].methods},t[8]=s,t[9]=a,t[10]=r,t[11]=u):u=t[11];let d;return t[12]!==l||t[13]!==u?(d={state:l,get:u},t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function Yce(e){return e.state}function Xce(e,t,n){return e[t.key]=n,e}function Zce(e){return DT(Jce(e),vce(e),e.deps)}var OE=e=>{let t=V(15),{toolkit:n,mcpApp:r}=e,i;t[0]===r?i=t[1]:(i=r?[DT(`mcpApp`,r)]:[],t[0]=r,t[1]=i);let a=WT(i)[0],[o,s]=uT($ce),c;t[2]===o?c=t[3]:(c=Object.fromEntries(Object.entries(o).map(tle)),t[2]=o,t[3]=c);let l;t[4]!==a||t[5]!==c||t[6]!==o?(l={toolUIs:o,mcpApp:a,tools:c},t[4]=a,t[5]=c,t[6]=o,t[7]=l):l=t[7];let u=l,d=yE(),f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=(e,t,n)=>{let r={render:t,standalone:n?.standalone??!1};return s(t=>({...t,[e]:[...t[e]??[],r]})),()=>{s(t=>{let n=t[e]?.filter(e=>e!==r)??[];if(n.length>0)return{...t,[e]:n};let i={...t};return delete i[e],i})}},t[8]=f):f=t[8];let p=f,m,h;t[9]!==d||t[10]!==n?(m=()=>{if(!n)return;let e=[];for(let[t,r]of Object.entries(n)){let n=`render`in r?r.render:void 0,i=`renderText`in r?r.renderText:void 0,a=n??(i?dce(i):void 0);a&&e.push(p(t,a,{standalone:lce(r)}))}let t=Object.entries(n).reduce(nle,{});return e.push(d.current.modelContext().register({getModelContext:()=>({tools:t})})),()=>{e.forEach(rle)}},h=[n,p,d],t[9]=d,t[10]=n,t[11]=m,t[12]=h):(m=t[11],h=t[12]),hT(m,h);let g;return t[13]===u?g=t[14]:(g={getState:()=>u,setToolUI:p},t[13]=u,t[14]=g),g},Qce=ET(OE);hE(OE,(e,t)=>{!e.modelContext&&t.modelContext.source===null&&(e.modelContext=JT())});function $ce(){return{}}function ele(e){return e.render}function tle(e){let[t,n]=e;return[t,n.map(ele)]}function nle(e,t){let[n,r]=t;if(r.type===`mcp`)return e;let{display:i,render:a,renderText:o,...s}=r;return e[n]=s,e}function rle(e){return e()}var kE=e=>vT(e.subscribe,e.getState),AE=ET(e=>{let t=V(8),{runtime:n}=e,r=kE(n),i;t[0]===r?i=t[1]:(i=()=>r,t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=()=>n,t[2]=n,t[3]=a);let o;return t[4]!==n.remove||t[5]!==i||t[6]!==a?(o={getState:i,remove:n.remove,__internal_getRuntime:a},t[4]=n.remove,t[5]=i,t[6]=a,t[7]=o):o=t[7],o}),ile=ET(e=>{let t=V(5),{runtime:n,index:r}=e,i;t[0]!==r||t[1]!==n?(i=n.getAttachmentByIndex(r),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;return t[3]===a?o=t[4]:(o=AE({runtime:a}),t[3]=a,t[4]=o),HT(o)}),ale=ET(({item:e,onSteer:t,onRemove:n})=>({getState:()=>e,steer:t,remove:n})),jE=ET(e=>{let t=V(55),{threadIdRef:n,messageIdRef:r,runtime:i}=e,a=kE(i),o=bE(),s,c;t[0]!==o||t[1]!==r||t[2]!==i||t[3]!==n?(s=()=>{let e=[];for(let t of[`send`,`attachmentAdd`]){let a=i.unstable_on(t,()=>{o(`composer.${t}`,{threadId:n.current,...r&&{messageId:r.current}})});e.push(a)}return e.push(i.unstable_on(`attachmentAddError`,e=>{o(`composer.attachmentAddError`,{threadId:n.current,...r&&{messageId:r.current},...e.attachmentId&&{attachmentId:e.attachmentId},reason:e.reason,message:e.message})})),()=>{for(let t of e)t()}},c=[i,o,n,r],t[0]=o,t[1]=r,t[2]=i,t[3]=n,t[4]=s,t[5]=c):(s=t[4],c=t[5]),hT(s,c);let l;if(t[6]!==i||t[7]!==a.attachments){let e;t[9]===i?e=t[10]:(e=(e,t)=>DT(e.id,ile({runtime:i,index:t}),[i,t]),t[9]=i,t[10]=e),l=a.attachments.map(e),t[6]=i,t[7]=a.attachments,t[8]=l}else l=t[8];let u=DE(l),d=a.queue,f;if(t[11]!==d||t[12]!==i){let e;t[14]===i?e=t[15]:(e=e=>DT(e.id,ale({item:e,onSteer:()=>i.steerQueueItem(e.id),onRemove:()=>i.removeQueueItem(e.id)})),t[14]=i,t[15]=e),f=d.map(e),t[11]=d,t[12]=i,t[13]=f}else f=t[13];let p=DE(f),m=a.type??`thread`,h;t[16]!==u.state||t[17]!==d||t[18]!==a.attachmentAccept||t[19]!==a.canCancel||t[20]!==a.canSend||t[21]!==a.dictation||t[22]!==a.isEditing||t[23]!==a.isEmpty||t[24]!==a.quote||t[25]!==a.role||t[26]!==a.runConfig||t[27]!==a.text||t[28]!==m?(h={text:a.text,role:a.role,attachments:u.state,runConfig:a.runConfig,isEditing:a.isEditing,canCancel:a.canCancel,canSend:a.canSend,attachmentAccept:a.attachmentAccept,isEmpty:a.isEmpty,type:m,dictation:a.dictation,quote:a.quote,queue:d},t[16]=u.state,t[17]=d,t[18]=a.attachmentAccept,t[19]=a.canCancel,t[20]=a.canSend,t[21]=a.dictation,t[22]=a.isEditing,t[23]=a.isEmpty,t[24]=a.quote,t[25]=a.role,t[26]=a.runConfig,t[27]=a.text,t[28]=m,t[29]=h):h=t[29];let g=h,_;t[30]===g?_=t[31]:(_=()=>g,t[30]=g,t[31]=_);let v=i.beginEdit??ole,y;t[32]===u?y=t[33]:(y=e=>`id`in e?u.get({key:e.id}):u.get(e),t[32]=u,t[33]=y);let b;t[34]===p?b=t[35]:(b=e=>p.get(e),t[34]=p,t[35]=b);let x;t[36]===i?x=t[37]:(x=()=>i,t[36]=i,t[37]=x);let S;return t[38]!==i.addAttachment||t[39]!==i.cancel||t[40]!==i.clearAttachments||t[41]!==i.reset||t[42]!==i.send||t[43]!==i.setQuote||t[44]!==i.setRole||t[45]!==i.setRunConfig||t[46]!==i.setText||t[47]!==i.startDictation||t[48]!==i.stopDictation||t[49]!==b||t[50]!==x||t[51]!==_||t[52]!==v||t[53]!==y?(S={getState:_,setText:i.setText,setRole:i.setRole,setRunConfig:i.setRunConfig,addAttachment:i.addAttachment,reset:i.reset,clearAttachments:i.clearAttachments,send:i.send,cancel:i.cancel,beginEdit:v,startDictation:i.startDictation,stopDictation:i.stopDictation,setQuote:i.setQuote,attachment:y,queueItem:b,__internal_getRuntime:x},t[38]=i.addAttachment,t[39]=i.cancel,t[40]=i.clearAttachments,t[41]=i.reset,t[42]=i.send,t[43]=i.setQuote,t[44]=i.setRole,t[45]=i.setRunConfig,t[46]=i.setText,t[47]=i.startDictation,t[48]=i.stopDictation,t[49]=b,t[50]=x,t[51]=_,t[52]=v,t[53]=y,t[54]=S):S=t[54],S});function ole(){throw Error(`beginEdit is not supported in this runtime`)}var ME=e=>({get current(){return e()}}),sle=ET(e=>{let t=V(13),{runtime:n}=e,r=kE(n),i;t[0]===r?i=t[1]:(i=()=>r,t[0]=r,t[1]=i);let a,o,s,c;t[2]===n?(a=t[3],o=t[4],s=t[5],c=t[6]):(a=e=>n.addToolResult(e),o=e=>n.resumeToolCall(e),s=e=>n.respondToToolApproval(e),c=()=>n,t[2]=n,t[3]=a,t[4]=o,t[5]=s,t[6]=c);let l;return t[7]!==i||t[8]!==a||t[9]!==o||t[10]!==s||t[11]!==c?(l={getState:i,addToolResult:a,resumeToolCall:o,respondToToolApproval:s,__internal_getRuntime:c},t[7]=i,t[8]=a,t[9]=o,t[10]=s,t[11]=c,t[12]=l):l=t[12],l}),cle=ET(e=>{let t=V(5),{runtime:n,index:r}=e,i;t[0]!==r||t[1]!==n?(i=n.getAttachmentByIndex(r),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;return t[3]===a?o=t[4]:(o=AE({runtime:a}),t[3]=a,t[4]=o),HT(o)}),lle=ET(e=>{let t=V(5),{runtime:n,index:r}=e,i;t[0]!==r||t[1]!==n?(i=n.getMessagePartByIndex(r),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;return t[3]===a?o=t[4]:(o=sle({runtime:a}),t[3]=a,t[4]=o),HT(o)}),ule=ET(e=>{let t=V(55),{runtime:n,threadIdRef:r}=e,i=kE(n),[a,o]=uT(!1),[s,c]=uT(!1),l;t[0]===n?l=t[1]:(l=ME(()=>n.getState().id),t[0]=n,t[1]=l);let u=l,d;t[2]!==u||t[3]!==n.composer||t[4]!==r?(d=jE({runtime:n.composer,threadIdRef:r,messageIdRef:u}),t[2]=u,t[3]=n.composer,t[4]=r,t[5]=d):d=t[5];let f=nE(d),p;if(t[6]!==n||t[7]!==i.content){let e;t[9]===n?e=t[10]:(e=(e,t)=>DT(`toolCallId`in e&&e.toolCallId!=null?`toolCallId-${e.toolCallId}`:`index-${t}`,lle({runtime:n,index:t}),[n,t]),t[9]=n,t[10]=e),p=i.content.map(e),t[6]=n,t[7]=i.content,t[8]=p}else p=t[8];let m=DE(p),h;t[11]===i.attachments?h=t[12]:(h=i.attachments??[],t[11]=i.attachments,t[12]=h);let g;if(t[13]!==n||t[14]!==h){let e;t[16]===n?e=t[17]:(e=(e,t)=>DT(e.id,cle({runtime:n,index:t}),[n,t]),t[16]=n,t[17]=e),g=h.map(e),t[13]=n,t[14]=h,t[15]=g}else g=t[15];let _=DE(g),v=i,y;t[18]!==f.state||t[19]!==a||t[20]!==s||t[21]!==m.state||t[22]!==v?(y={...v,parts:m.state,composer:f.state,isCopied:a,isHovering:s},t[18]=f.state,t[19]=a,t[20]=s,t[21]=m.state,t[22]=v,t[23]=y):y=t[23];let b=y,x;t[24]===b?x=t[25]:(x=()=>b,t[24]=b,t[25]=x);let S;t[26]===f.methods?S=t[27]:(S=()=>f.methods,t[26]=f.methods,t[27]=S);let C,w,T,E,D,O,k;t[28]===n?(C=t[29],w=t[30],T=t[31],E=t[32],D=t[33],O=t[34],k=t[35]):(C=()=>n.delete(),w=e=>n.reload(e),T=()=>n.speak(),E=()=>n.stopSpeaking(),D=e=>n.submitFeedback(e),O=e=>n.switchToBranch(e),k=()=>n.unstable_getCopyText(),t[28]=n,t[29]=C,t[30]=w,t[31]=T,t[32]=E,t[33]=D,t[34]=O,t[35]=k);let ee;t[36]===m?ee=t[37]:(ee=e=>`index`in e?m.get({index:e.index}):m.get({key:`toolCallId-${e.toolCallId}`}),t[36]=m,t[37]=ee);let A;t[38]===_?A=t[39]:(A=e=>`id`in e?_.get({key:e.id}):_.get(e),t[38]=_,t[39]=A);let j;t[40]===n?j=t[41]:(j=()=>n,t[40]=n,t[41]=j);let te;return t[42]!==C||t[43]!==w||t[44]!==T||t[45]!==E||t[46]!==D||t[47]!==O||t[48]!==k||t[49]!==ee||t[50]!==A||t[51]!==j||t[52]!==x||t[53]!==S?(te={getState:x,composer:S,delete:C,reload:w,speak:T,stopSpeaking:E,submitFeedback:D,switchToBranch:O,getCopyText:k,part:ee,attachment:A,setIsCopied:o,setIsHovering:c,__internal_getRuntime:j},t[42]=C,t[43]=w,t[44]=T,t[45]=E,t[46]=D,t[47]=O,t[48]=k,t[49]=ee,t[50]=A,t[51]=j,t[52]=x,t[53]=S,t[54]=te):te=t[54],te}),dle=ET(e=>{let t=V(6),{runtime:n,id:r,threadIdRef:i}=e,a;t[0]!==r||t[1]!==n?(a=n.getMessageById(r),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o=a,s;return t[3]!==o||t[4]!==i?(s=ule({runtime:o,threadIdRef:i}),t[3]=o,t[4]=i,t[5]=s):s=t[5],HT(s)}),fle=ET(e=>{let t=V(58),{runtime:n}=e,r=kE(n),i=bE(),a,o;t[0]!==i||t[1]!==n?(a=()=>{let e=[];for(let t of[`runStart`,`runEnd`,`initialize`,`modelContextUpdate`]){let r=n.unstable_on(t,()=>{let e=n.getState()?.threadId||`unknown`;i(`thread.${t}`,{threadId:e})});e.push(r)}return()=>{for(let t of e)t()}},o=[n,i],t[0]=i,t[1]=n,t[2]=a,t[3]=o):(a=t[2],o=t[3]),hT(a,o);let s;t[4]===n?s=t[5]:(s=ME(()=>n.getState().threadId),t[4]=n,t[5]=s);let c=s,l;t[6]!==n.composer||t[7]!==c?(l=jE({runtime:n.composer,threadIdRef:c}),t[6]=n.composer,t[7]=c,t[8]=l):l=t[8];let u=nE(l),d;if(t[9]!==n||t[10]!==r.messages||t[11]!==c){let e;t[13]!==n||t[14]!==c?(e=e=>DT(e.id,dle({runtime:n,id:e.id,threadIdRef:c}),[n,e.id,c]),t[13]=n,t[14]=c,t[15]=e):e=t[15],d=r.messages.map(e),t[9]=n,t[10]=r.messages,t[11]=c,t[12]=d}else d=t[12];let f=DE(d),p=f.state.length===0&&!r.isLoading,m;t[16]!==u.state||t[17]!==f.state||t[18]!==r.capabilities||t[19]!==r.extras||t[20]!==r.isDisabled||t[21]!==r.isLoading||t[22]!==r.isRunning||t[23]!==r.speech||t[24]!==r.state||t[25]!==r.suggestions||t[26]!==r.voice||t[27]!==p?(m={isEmpty:p,isDisabled:r.isDisabled,isLoading:r.isLoading,isRunning:r.isRunning,capabilities:r.capabilities,state:r.state,suggestions:r.suggestions,extras:r.extras,speech:r.speech,voice:r.voice,composer:u.state,messages:f.state},t[16]=u.state,t[17]=f.state,t[18]=r.capabilities,t[19]=r.extras,t[20]=r.isDisabled,t[21]=r.isLoading,t[22]=r.isRunning,t[23]=r.speech,t[24]=r.state,t[25]=r.suggestions,t[26]=r.voice,t[27]=p,t[28]=m):m=t[28];let h=m,g;t[29]===h?g=t[30]:(g=()=>h,t[29]=h,t[30]=g);let _;t[31]===u.methods?_=t[32]:(_=()=>u.methods,t[31]=u.methods,t[32]=_);let v;t[33]===f?v=t[34]:(v=e=>`id`in e?f.get({key:e.id}):f.get(e),t[33]=f,t[34]=v);let y;t[35]===n?y=t[36]:(y=()=>n,t[35]=n,t[36]=y);let b;return t[37]!==n.append||t[38]!==n.cancelRun||t[39]!==n.connectVoice||t[40]!==n.deleteMessage||t[41]!==n.disconnectVoice||t[42]!==n.export||t[43]!==n.getModelContext||t[44]!==n.getVoiceVolume||t[45]!==n.import||t[46]!==n.muteVoice||t[47]!==n.reset||t[48]!==n.resumeRun||t[49]!==n.startRun||t[50]!==n.stopSpeaking||t[51]!==n.subscribeVoiceVolume||t[52]!==n.unmuteVoice||t[53]!==v||t[54]!==y||t[55]!==g||t[56]!==_?(b={getState:g,composer:_,append:n.append,deleteMessage:n.deleteMessage,startRun:n.startRun,resumeRun:n.resumeRun,cancelRun:n.cancelRun,getModelContext:n.getModelContext,export:n.export,import:n.import,reset:n.reset,stopSpeaking:n.stopSpeaking,connectVoice:n.connectVoice,disconnectVoice:n.disconnectVoice,getVoiceVolume:n.getVoiceVolume,subscribeVoiceVolume:n.subscribeVoiceVolume,muteVoice:n.muteVoice,unmuteVoice:n.unmuteVoice,message:v,__internal_getRuntime:y},t[37]=n.append,t[38]=n.cancelRun,t[39]=n.connectVoice,t[40]=n.deleteMessage,t[41]=n.disconnectVoice,t[42]=n.export,t[43]=n.getModelContext,t[44]=n.getVoiceVolume,t[45]=n.import,t[46]=n.muteVoice,t[47]=n.reset,t[48]=n.resumeRun,t[49]=n.startRun,t[50]=n.stopSpeaking,t[51]=n.subscribeVoiceVolume,t[52]=n.unmuteVoice,t[53]=v,t[54]=y,t[55]=g,t[56]=_,t[57]=b):b=t[57],b}),ple=ET(e=>{let t=V(20),{runtime:n}=e,r=kE(n),i=bE(),a,o;t[0]!==i||t[1]!==n?(a=()=>{let e=[];for(let t of[`switchedTo`,`switchedAway`]){let r=n.unstable_on(t,()=>{i(`threadListItem.${t}`,{threadId:n.getState().id})});e.push(r)}return()=>{for(let t of e)t()}},o=[n,i],t[0]=i,t[1]=n,t[2]=a,t[3]=o):(a=t[2],o=t[3]),hT(a,o);let s;t[4]===r?s=t[5]:(s=()=>r,t[4]=r,t[5]=s);let c;t[6]===n?c=t[7]:(c=()=>n,t[6]=n,t[7]=c);let l;return t[8]!==n.archive||t[9]!==n.delete||t[10]!==n.detach||t[11]!==n.generateTitle||t[12]!==n.initialize||t[13]!==n.rename||t[14]!==n.switchTo||t[15]!==n.unarchive||t[16]!==n.updateCustom||t[17]!==s||t[18]!==c?(l={getState:s,switchTo:n.switchTo,rename:n.rename,updateCustom:n.updateCustom,archive:n.archive,unarchive:n.unarchive,delete:n.delete,generateTitle:n.generateTitle,initialize:n.initialize,detach:n.detach,__internal_getRuntime:c},t[8]=n.archive,t[9]=n.delete,t[10]=n.detach,t[11]=n.generateTitle,t[12]=n.initialize,t[13]=n.rename,t[14]=n.switchTo,t[15]=n.unarchive,t[16]=n.updateCustom,t[17]=s,t[18]=c,t[19]=l):l=t[19],l}),mle=ET(e=>{let t=V(5),{runtime:n,id:r}=e,i;t[0]!==r||t[1]!==n?(i=n.getItemById(r),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;return t[3]===a?o=t[4]:(o=ple({runtime:a}),t[3]=a,t[4]=o),HT(o)}),hle=ET(e=>{let t=V(40),{runtime:n,__internal_assistantRuntime:r}=e,i=kE(n),a;t[0]===n.main?a=t[1]:(a=fle({runtime:n.main}),t[0]=n.main,t[1]=a);let o=nE(a),s;t[2]!==n||t[3]!==i.threadItems?(s=Object.keys(i.threadItems).map(e=>DT(e,mle({runtime:n,id:e}),[n,e])),t[2]=n,t[3]=i.threadItems,t[4]=s):s=t[4];let c=DE(s),l=i.newThreadId??null,u;t[5]!==o.state||t[6]!==i.archivedThreadIds||t[7]!==i.hasMore||t[8]!==i.isLoading||t[9]!==i.isLoadingMore||t[10]!==i.mainThreadId||t[11]!==i.threadIds||t[12]!==l||t[13]!==c.state?(u={mainThreadId:i.mainThreadId,newThreadId:l,isLoading:i.isLoading,isLoadingMore:i.isLoadingMore,hasMore:i.hasMore,threadIds:i.threadIds,archivedThreadIds:i.archivedThreadIds,threadItems:c.state,main:o.state},t[5]=o.state,t[6]=i.archivedThreadIds,t[7]=i.hasMore,t[8]=i.isLoading,t[9]=i.isLoadingMore,t[10]=i.mainThreadId,t[11]=i.threadIds,t[12]=l,t[13]=c.state,t[14]=u):u=t[14];let d=u,f;t[15]===d?f=t[16]:(f=()=>d,t[15]=d,t[16]=f);let p;t[17]===o.methods?p=t[18]:(p=()=>o.methods,t[17]=o.methods,t[18]=p);let m;t[19]!==d||t[20]!==c?(m=e=>{if(e===`main`)return c.get({key:d.mainThreadId});if(`id`in e)return c.get({key:e.id});let{index:t,archived:n}=e,r=n!==void 0&&n?d.archivedThreadIds[t]:d.threadIds[t];return c.get({key:r})},t[19]=d,t[20]=c,t[21]=m):m=t[21];let h,g,_,v,y;t[22]===n?(h=t[23],g=t[24],_=t[25],v=t[26],y=t[27]):(v=async(e,t)=>{await n.switchToThread(e,t)},y=async()=>{await n.switchToNewThread()},h=()=>n.getLoadThreadsPromise(),g=()=>n.reload(),_=()=>n.loadMore(),t[22]=n,t[23]=h,t[24]=g,t[25]=_,t[26]=v,t[27]=y);let b;t[28]===r?b=t[29]:(b=()=>r,t[28]=r,t[29]=b);let x;return t[30]!==h||t[31]!==g||t[32]!==_||t[33]!==b||t[34]!==f||t[35]!==p||t[36]!==m||t[37]!==v||t[38]!==y?(x={getState:f,thread:p,item:m,switchToThread:v,switchToNewThread:y,getLoadThreadsPromise:h,reload:g,loadMore:_,__internal_getAssistantRuntime:b},t[30]=h,t[31]=g,t[32]=_,t[33]=b,t[34]=f,t[35]=p,t[36]=m,t[37]=v,t[38]=y,t[39]=x):x=t[39],x}),gle=ET(e=>({getState:()=>e})),_le=ET(e=>{let t=V(11),n;t[0]===e?n=t[1]:(n=()=>({suggestions:(e??[]).map(vle)}),t[0]=e,t[1]=n);let[r]=uT(n),i;t[2]===r.suggestions?i=t[3]:(i=r.suggestions.map(yle),t[2]=r.suggestions,t[3]=i);let a=DE(i),o;t[4]===r?o=t[5]:(o=()=>r,t[4]=r,t[5]=o);let s;t[6]===a?s=t[7]:(s=e=>{let{index:t}=e;return a.get({index:t})},t[6]=a,t[7]=s);let c;return t[8]!==o||t[9]!==s?(c={getState:o,suggestion:s},t[8]=o,t[9]=s,t[10]=c):c=t[10],c});function vle(e){return typeof e==`string`?{title:e,label:``,prompt:e}:{title:e.title,label:e.label,prompt:e.prompt}}function yle(e,t){return DT(t,gle(e),[e])}var ble=(e,t)=>{e.thread??=pE({source:`threads`,query:{type:`main`},get:e=>e.threads().thread(`main`)}),e.threadListItem??=pE({source:`threads`,query:{type:`main`},get:e=>e.threads().item(`main`)}),e.composer??=pE({source:`thread`,query:{},get:e=>e.threads().thread(`main`).composer()}),!e.modelContext&&t.modelContext.source===null&&(e.modelContext=JT()),!e.suggestions&&t.suggestions.source===null&&(e.suggestions=_le())},NE=e=>{let t=V(6),n=yE(),r,i;t[0]!==n||t[1]!==e?(r=()=>e.registerModelContextProvider(n.current.modelContext()),i=[e,n],t[0]=n,t[1]=e,t[2]=r,t[3]=i):(r=t[2],i=t[3]),hT(r,i);let a;return t[4]===e?a=t[5]:(a=hle({runtime:e.threads,__internal_assistantRuntime:e}),t[4]=e,t[5]=a),HT(a)},xle=ET(NE);hE(NE,(e,t)=>{ble(e,t),!e.tools&&t.tools.source===null&&(e.tools=Qce({})),!e.dataRenderers&&t.dataRenderers.source===null&&(e.dataRenderers=ice())});var Sle=e=>e._core?.RenderComponent,Cle=(0,sT.memo)(({runtime:e,aui:t=null,children:n})=>{"use no memo";let r=CE({threads:xle(e)},{parent:t}),i=Sle(e),a=(0,B.jsxs)(dE,{value:r,children:[i&&(0,B.jsx)(i,{}),n]});return t?(0,B.jsx)(dE,{value:t,children:a}):a}),PE=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},wle=(e=>e?PE(e):PE),Tle=e=>e;function Ele(e,t=Tle){let n=z.useSyncExternalStore(e.subscribe,z.useCallback(()=>t(e.getState()),[e,t]),z.useCallback(()=>t(e.getInitialState()),[e,t]));return z.useDebugValue(n),n}var FE=e=>{let t=wle(e),n=e=>Ele(t,e);return Object.assign(n,t),n},Dle=(e=>e?FE(e):FE),IE=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});if(!e||!t)throw Error(`Failed to create promise`);return{promise:n,resolve:e,reject:t}},Ole=()=>{let e=[],t=!1,n,r,i=i=>{i.promise||=i.reader.read().then(({done:a,value:o})=>{i.promise=void 0,a?(e.splice(e.indexOf(i),1),t&&e.length===0&&n.close()):n.enqueue(o),r?.resolve(),r=void 0}).catch(t=>{console.error(t),e.forEach(e=>{e.reader.cancel()}),e.length=0,n.error(t),r?.reject(t),r=void 0})};return{readable:new ReadableStream({start(e){n=e},pull(){return r=IE(),e.forEach(e=>{i(e)}),r.promise},cancel(){e.forEach(e=>{e.reader.cancel()}),e.length=0}}),isSealed(){return t},seal(){t=!0,e.length===0&&n.close()},addStream(n){if(t)throw Error(`Cannot add streams after the run callback has settled.`);let r={reader:n.getReader()};e.push(r),i(r)},enqueue(e){this.addStream(new ReadableStream({start(t){t.enqueue(e),t.close()}}))}}},LE=class{_controller;_isClosed=!1;constructor(e){this._controller=e}append(e){return this._controller.enqueue({type:`text-delta`,path:[],textDelta:e}),this}close(){this._isClosed||(this._isClosed=!0,this._controller.enqueue({type:`part-finish`,path:[]}),this._controller.close())}},RE=e=>new ReadableStream({start(t){return e.start?.(new LE(t))},pull(t){return e.pull?.(new LE(t))},cancel(t){return e.cancel?.(t)}}),zE=()=>{let e;return[RE({start(t){e=t}}),e]},BE=class{_controller;_isClosed=!1;_mergeTask;constructor(e){this._controller=e;let t=RE({start:e=>{this._argsTextController=e}}),n=!1;this._mergeTask=t.pipeTo(new WritableStream({write:e=>{switch(e.type){case`text-delta`:n=!0,this._controller.enqueue(e);break;case`part-finish`:n||this._controller.enqueue({type:`text-delta`,textDelta:`{}`,path:[]}),this._controller.enqueue({type:`tool-call-args-text-finish`,path:[]});break;default:throw Error(`Unexpected chunk type: ${e.type}`)}}}))}get argsText(){return this._argsTextController}_argsTextController;async setResponse(e){this._argsTextController.close(),await Promise.resolve(),this._controller.enqueue({type:`result`,path:[],...e.artifact===void 0?{}:{artifact:e.artifact},result:e.result,isError:e.isError??!1,...e.modelContent===void 0?{}:{modelContent:e.modelContent},...e.messages===void 0?{}:{messages:e.messages}})}async close(){this._isClosed||(this._isClosed=!0,this._argsTextController.close(),await this._mergeTask,this._controller.enqueue({type:`part-finish`,path:[]}),this._controller.close())}},kle=e=>new ReadableStream({start(t){return e.start?.(new BE(t))},pull(t){return e.pull?.(new BE(t))},cancel(t){return e.cancel?.(t)}}),Ale=()=>{let e;return[kle({start(t){e=t}}),e]},VE=class{value=-1;up(){return++this.value}},jle=class extends TransformStream{constructor(e){super({transform(t,n){n.enqueue({...t,path:[e,...t.path]})}})}};TransformStream;var Mle=class extends TransformStream{constructor(e){let t=new VE,n=new Map;super({transform(r,i){r.type===`part-start`&&r.path.length===0&&n.set(t.up(),e.up());let[a,...o]=r.path;if(a===void 0){i.enqueue(r);return}let s=n.get(a);if(s===void 0)throw Error(`Path not found`);i.enqueue({...r,path:[s,...o]})}})}},Nle=class extends TransformStream{constructor(e){super();let t=e(super.readable);Object.defineProperty(this,"readable",{value:t,writable:!1})}},HE=class extends TransformStream{constructor(){let e=[];super({transform(t,n){if(t.type===`part-start`){if(t.path.length!==0){n.error(Error(`Nested parts are not supported`));return}e.push(t.part),n.enqueue(t);return}if(t.type===`text-delta`||t.type===`result`||t.type===`part-finish`||t.type===`tool-call-args-text-finish`){if(t.path.length!==1){n.error(Error(`${t.type} chunks must have a path of length 1`));return}let r=t.path[0];if(r<0||r>=e.length){n.error(Error(`Invalid path index: ${r}`));return}let i=e[r];n.enqueue({...t,meta:i});return}n.enqueue(t)}})}},UE=(e,t=21)=>(n=t)=>{let r=``,i=n|0;for(;i-- >0;)r+=e[Math.random()*e.length|0];return r},Ple=UE(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,7),Fle=class e{_state;_parentId;constructor(e){this._state=e||{merger:Ole(),contentCounter:new VE}}get __internal_isClosed(){return this._state.merger.isSealed()}__internal_getReadable(){return this._state.merger.readable}__internal_subscribeToClose(e){this._state.closeSubscriber=e}_addPart(e,t){this._state.append&&(this._state.append.controller.close(),this._state.append=void 0),this.enqueue({type:`part-start`,part:e,path:[]}),this._state.merger.addStream(t.pipeThrough(new jle(this._state.contentCounter.value)))}merge(e){this._state.merger.addStream(e.pipeThrough(new Mle(this._state.contentCounter)))}appendText(e){(this._state.append?.kind!==`text`||this._state.append.parentId!==this._parentId)&&(this._state.append={kind:`text`,parentId:this._parentId,controller:this.addTextPart()}),this._state.append.controller.append(e)}appendReasoning(e){(this._state.append?.kind!==`reasoning`||this._state.append.parentId!==this._parentId)&&(this._state.append={kind:`reasoning`,parentId:this._parentId,controller:this.addReasoningPart()}),this._state.append.controller.append(e)}addTextPart(){let[e,t]=zE();return this._addPart(this._withParentIdOption({type:`text`}),e),t}addReasoningPart(){let[e,t]=zE();return this._addPart(this._withParentIdOption({type:`reasoning`}),e),t}addToolCallPart(e){let t=typeof e==`string`?{toolName:e}:e,n=t.toolName,r=t.toolCallId??Ple(),[i,a]=Ale();return this._addPart({type:`tool-call`,toolName:n,toolCallId:r,...this._parentId&&{parentId:this._parentId}},i),t.argsText!==void 0&&(a.argsText.append(t.argsText),a.argsText.close()),t.args!==void 0&&(a.argsText.append(JSON.stringify(t.args)),a.argsText.close()),t.response!==void 0&&a.setResponse(t.response),a}_finishedPartStream(){return new ReadableStream({start(e){e.enqueue({type:`part-finish`,path:[]}),e.close()}})}_withParentIdOption(e){return this._parentId?{...e,parentId:this._parentId}:e}appendSource(e){this._addPart(this._withParentIdOption(e),this._finishedPartStream())}appendFile(e){this._addPart(this._withParentIdOption(e),this._finishedPartStream())}appendData(e){this._addPart(this._withParentIdOption(e),this._finishedPartStream())}enqueue(e){this._state.merger.enqueue(e),e.type===`part-start`&&e.path.length===0&&this._state.contentCounter.up()}withParentId(t){let n=new e(this._state);return n._parentId=t,n}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}};function Ile(e){let t=new Fle;return(async()=>{try{await e(t)}catch(e){throw t.__internal_isClosed||t.enqueue({type:`error`,path:[],error:String(e)}),e}finally{t.__internal_isClosed||t.close()}})(),t.__internal_getReadable()}function Lle(){let{resolve:e,promise:t}=IE(),n;return[Ile(r=>(n=r,n.__internal_subscribeToClose(e),t)),n]}function Rle(e){let t=[`ROOT`],n=-1,r=null,i=[],a;function o(){a!==void 0&&(i.push(JSON.parse(`"${a}"`)),a=void 0)}function s(e,i,a){switch(e){case`"`:n=i,t.pop(),t.push(a),t.push(`INSIDE_STRING`),o();break;case`f`:case`t`:case`n`:n=i,r=i,t.pop(),t.push(a),t.push(`INSIDE_LITERAL`);break;case`-`:t.pop(),t.push(a),t.push(`INSIDE_NUMBER`),o();break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=i,t.pop(),t.push(a),t.push(`INSIDE_NUMBER`),o();break;case`{`:n=i,t.pop(),t.push(a),t.push(`INSIDE_OBJECT_START`),o();break;case`[`:n=i,t.pop(),t.push(a),t.push(`INSIDE_ARRAY_START`),o();break}}function c(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_COMMA`);break;case`}`:n=r,t.pop(),a=i.pop();break}}function l(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`),a=(Number(a)+1).toString();break;case`]`:n=r,t.pop(),a=i.pop();break}}for(let o=0;o<e.length;o++){let u=e[o];switch(t[t.length-1]){case`ROOT`:s(u,o,`FINISH`);break;case`INSIDE_OBJECT_START`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`),a=``;break;case`}`:n=o,t.pop(),a=i.pop();break}break;case`INSIDE_OBJECT_AFTER_COMMA`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`),a=``;break}break;case`INSIDE_OBJECT_KEY`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_KEY`);break;case`\\`:t.push(`INSIDE_STRING_ESCAPE`),a+=u;break;default:a+=u;break}break;case`INSIDE_OBJECT_AFTER_KEY`:switch(u){case`:`:t.pop(),t.push(`INSIDE_OBJECT_BEFORE_VALUE`);break}break;case`INSIDE_OBJECT_BEFORE_VALUE`:s(u,o,`INSIDE_OBJECT_AFTER_VALUE`);break;case`INSIDE_OBJECT_AFTER_VALUE`:c(u,o);break;case`INSIDE_STRING`:switch(u){case`"`:t.pop(),n=o,a=i.pop();break;case`\\`:t.push(`INSIDE_STRING_ESCAPE`);break;default:n=o}break;case`INSIDE_ARRAY_START`:switch(u){case`]`:n=o,t.pop(),a=i.pop();break;default:n=o,a=`0`,s(u,o,`INSIDE_ARRAY_AFTER_VALUE`);break}break;case`INSIDE_ARRAY_AFTER_VALUE`:switch(u){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`),a=(Number(a)+1).toString();break;case`]`:n=o,t.pop(),a=i.pop();break;default:n=o;break}break;case`INSIDE_ARRAY_AFTER_COMMA`:s(u,o,`INSIDE_ARRAY_AFTER_VALUE`);break;case`INSIDE_STRING_ESCAPE`:t.pop(),t[t.length-1]===`INSIDE_STRING`?n=o:t[t.length-1]===`INSIDE_OBJECT_KEY`&&(a+=u);break;case`INSIDE_NUMBER`:switch(u){case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=o;break;case`e`:case`E`:case`-`:case`.`:break;case`,`:t.pop(),a=i.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&l(u,o),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&c(u,o);break;case`}`:t.pop(),a=i.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&c(u,o);break;case`]`:t.pop(),a=i.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&l(u,o);break;default:t.pop(),a=i.pop();break}break;case`INSIDE_LITERAL`:{let i=e.substring(r,o+1);!`false`.startsWith(i)&&!`true`.startsWith(i)&&!`null`.startsWith(i)?(t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`?c(u,o):t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&l(u,o)):n=o;break}}}let u=e.slice(0,n+1);for(let n=t.length-1;n>=0;n--)switch(t[n]){case`INSIDE_STRING`:u+=`"`;break;case`INSIDE_OBJECT_KEY`:case`INSIDE_OBJECT_AFTER_KEY`:case`INSIDE_OBJECT_AFTER_COMMA`:case`INSIDE_OBJECT_START`:case`INSIDE_OBJECT_BEFORE_VALUE`:case`INSIDE_OBJECT_AFTER_VALUE`:u+=`}`;break;case`INSIDE_ARRAY_START`:case`INSIDE_ARRAY_AFTER_COMMA`:case`INSIDE_ARRAY_AFTER_VALUE`:u+=`]`;break;case`INSIDE_LITERAL`:{let t=e.substring(r,e.length);`true`.startsWith(t)?u+=`true`.slice(t.length):`false`.startsWith(t)?u+=`false`.slice(t.length):`null`.startsWith(t)&&(u+=`null`.slice(t.length))}}return[u,i]}var WE=r(a(((e,t)=>{var n=typeof Buffer<`u`,r=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,i=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function a(e,t,a){a==null&&typeof t==`object`&&t&&(a=t,t=void 0),n&&Buffer.isBuffer(e)&&(e=e.toString()),e&&e.charCodeAt(0)===65279&&(e=e.slice(1));let s=JSON.parse(e,t);if(typeof s!=`object`||!s)return s;let c=a&&a.protoAction||`error`,l=a&&a.constructorAction||`error`;if(c===`ignore`&&l===`ignore`)return s;if(c!==`ignore`&&l!==`ignore`){if(r.test(e)===!1&&i.test(e)===!1)return s}else if(c!==`ignore`&&l===`ignore`){if(r.test(e)===!1)return s}else if(i.test(e)===!1)return s;return o(s,{protoAction:c,constructorAction:l,safe:a&&a.safe})}function o(e,{protoAction:t=`error`,constructorAction:n=`error`,safe:r}={}){let i=[e];for(;i.length;){let e=i;i=[];for(let a of e){if(t!==`ignore`&&Object.prototype.hasOwnProperty.call(a,`__proto__`)){if(r===!0)return null;if(t===`error`)throw SyntaxError(`Object contains forbidden prototype property`);delete a.__proto__}if(n!==`ignore`&&Object.prototype.hasOwnProperty.call(a,`constructor`)&&a.constructor!==null&&typeof a.constructor==`object`&&Object.prototype.hasOwnProperty.call(a.constructor,`prototype`)){if(r===!0)return null;if(n===`error`)throw SyntaxError(`Object contains forbidden prototype property`);delete a.constructor}for(let e in a){let t=a[e];t&&typeof t==`object`&&i.push(t)}}}return e}function s(e,t,n){let{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return a(e,t,n)}finally{Error.stackTraceLimit=r}}function c(e,t){let{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return a(e,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=n}}t.exports=s,t.exports.default=s,t.exports.parse=s,t.exports.safeParse=c,t.exports.scan=o}))(),1),GE=Symbol(`aui.parse-partial-json-object.meta`),zle=e=>e?.[GE],KE=e=>{if(e.length===0)return{[GE]:{state:`partial`,partialPath:[]}};try{let t=WE.default.parse(e);if(typeof t!=`object`||!t)throw Error(`argsText is expected to be an object`);return t[GE]={state:`complete`,partialPath:[]},t}catch{try{let[t,n]=Rle(e),r=WE.default.parse(t);if(typeof r!=`object`||!r)throw Error(`argsText is expected to be an object`);return r[GE]={state:`partial`,partialPath:n},r}catch{return}}},qE=(e,t,n)=>{if(typeof e!=`object`||!e)return t.state;if(t.state===`complete`)return`complete`;if(n.length===0)return t.state;let[r,...i]=n;if(!Object.hasOwn(e,r))return`partial`;let[a,...o]=t.partialPath;if(r!==a)return`complete`;let s=e[r];return qE(s,{state:`partial`,partialPath:o},i)},JE=(e,t)=>{let n=zle(e);if(!n)throw Error(`unable to determine object state`);return qE(e,n,t.map(String))};async function*Ble(){let e=this.getReader();try{for(;;){let{done:t,value:n}=await e.read();if(t)break;yield n}}finally{e.releaseLock()}}function YE(e){return e[Symbol.asyncIterator]??=Ble,e}var XE=Symbol.for(`aui.tool-response`),ZE=class e{get[XE](){return!0}artifact;result;isError;modelContent;messages;constructor(e){e.artifact!==void 0&&(this.artifact=e.artifact),this.result=e.result,this.isError=e.isError??!1,e.modelContent!==void 0&&(this.modelContent=e.modelContent),e.messages!==void 0&&(this.messages=e.messages)}static[Symbol.hasInstance](e){return typeof e==`object`&&!!e&&XE in e}static toResponse(t){return t instanceof e?t:new e({result:t===void 0?`<no result>`:t})}};function Vle(e,t,n){try{let r=e();if(typeof r==`object`&&r&&`then`in r)return r.then(t,n);t(r)}catch(e){n(e)}}function QE(e,t){let n=e;for(let e of t){if(n==null)return;n=n[e]}return n}var Hle=class{resolve;reject;disposed=!1;fieldPath;constructor(e,t,n){this.resolve=e,this.reject=t,this.fieldPath=n}update(e){if(!this.disposed)try{if(JE(e,this.fieldPath)===`complete`){let t=QE(e,this.fieldPath);t!==void 0&&(this.resolve(t),this.dispose())}}catch(e){this.reject(e),this.dispose()}}end(e){if(!this.disposed)try{let t=QE(e,this.fieldPath);this.resolve(t)}catch(e){this.reject(e)}finally{this.dispose()}}dispose(){this.disposed=!0}},Ule=class{controller;disposed=!1;fieldPath;constructor(e,t){this.controller=e,this.fieldPath=t}update(e){if(!this.disposed)try{let t=QE(e,this.fieldPath);t!==void 0&&this.controller.enqueue(t),JE(e,this.fieldPath)===`complete`&&(this.controller.close(),this.dispose())}catch(e){this.controller.error(e),this.dispose()}}end(){this.disposed||(this.controller.close(),this.dispose())}dispose(){this.disposed=!0}},$E=class{controller;disposed=!1;fieldPath;lastValue=void 0;constructor(e,t){this.controller=e,this.fieldPath=t}update(e){if(!this.disposed)try{let t=QE(e,this.fieldPath);if(t!==void 0&&typeof t==`string`){let e=t.substring(this.lastValue?.length||0);this.lastValue=t,this.controller.enqueue(e)}JE(e,this.fieldPath)===`complete`&&(this.controller.close(),this.dispose())}catch(e){this.controller.error(e),this.dispose()}}end(){this.disposed||(this.controller.close(),this.dispose())}dispose(){this.disposed=!0}},eD=class{controller;disposed=!1;fieldPath;processedIndexes=new Set;constructor(e,t){this.controller=e,this.fieldPath=t}update(e){if(!this.disposed)try{let t=QE(e,this.fieldPath);if(!Array.isArray(t))return;for(let n=0;n<t.length;n++)this.processedIndexes.has(n)||JE(e,[...this.fieldPath,n])===`complete`&&(this.controller.enqueue(t[n]),this.processedIndexes.add(n));JE(e,this.fieldPath)===`complete`&&(this.controller.close(),this.dispose())}catch(e){this.controller.error(e),this.dispose()}}end(){this.disposed||(this.controller.close(),this.dispose())}dispose(){this.disposed=!0}},tD=class{argTextDeltas;handles=new Set;args=KE(``);finished=!1;constructor(e){this.argTextDeltas=e,this.processStream()}async processStream(){try{let e=``,t=this.argTextDeltas.getReader();for(;;){let{value:n,done:r}=await t.read();if(r)break;e+=n;let i=KE(e);if(i!==void 0){this.args=i;for(let e of this.handles)e.update(i)}}}catch(e){console.error(`Error processing argument stream:`,e)}finally{this.finished=!0;for(let e of this.handles)e.end(this.args);this.handles.clear()}}get(...e){return new Promise((t,n)=>{let r=new Hle(t,n,e);if(this.args&&JE(this.args,e)===`complete`){let n=QE(this.args,e);if(n!==void 0){t(n);return}}if(this.finished){r.end(this.args);return}this.handles.add(r),r.update(this.args)})}streamValues(...e){let t=e,n;return YE(new ReadableStream({start:e=>{n=new Ule(e,t),this.finished||this.handles.add(n),n.update(this.args),this.finished&&n.end()},cancel:()=>{n&&(n.dispose(),this.handles.delete(n))}}))}streamText(...e){let t=e,n;return YE(new ReadableStream({start:e=>{n=new $E(e,t),this.finished||this.handles.add(n),n.update(this.args),this.finished&&n.end()},cancel:()=>{n&&(n.dispose(),this.handles.delete(n))}}))}forEach(...e){let t=e,n;return YE(new ReadableStream({start:e=>{n=new eD(e,t),this.finished||this.handles.add(n),n.update(this.args),this.finished&&n.end()},cancel:()=>{n&&(n.dispose(),this.handles.delete(n))}}))}},nD=class{promise;constructor(e){this.promise=e}get(){return this.promise}},rD=class{args;response;writable;resolve;argsText=``;constructor(){let e=new TransformStream;this.writable=e.writable,this.args=new tD(e.readable);let{promise:t,resolve:n}=IE();this.resolve=n,this.response=new nD(t)}async appendArgsTextDelta(e){let t=this.writable.getWriter();try{await t.write(e)}catch(e){console.warn(e)}finally{t.releaseLock()}this.argsText+=e}async finishArgsText(){let e=this.writable.getWriter();try{await e.close()}catch(e){console.warn(e)}finally{e.releaseLock()}}setResponse(e){this.resolve(e)}result={get:async()=>(await this.response.get()).result}},iD=class extends Nle{constructor(e){let t=new Map,n=new Map;super(r=>{let i=new TransformStream({async transform(r,i){switch((r.type!==`part-finish`||r.meta.type!==`tool-call`)&&i.enqueue(r),r.type){case`part-start`:if(r.part.type===`tool-call`){let t=new rD;n.set(r.part.toolCallId,t),e.streamCall({reader:t,toolCallId:r.part.toolCallId,toolName:r.part.toolName})}break;case`text-delta`:if(r.meta.type===`tool-call`){let e=r.meta.toolCallId,t=n.get(e);if(!t)throw Error(`No controller found for tool call`);await t.appendArgsTextDelta(r.textDelta)}break;case`result`:{if(r.meta.type!==`tool-call`)break;let{toolCallId:e}=r.meta,t=n.get(e);if(!t)throw Error(`No controller found for tool call`);t.setResponse(new ZE({result:r.result,artifact:r.artifact,isError:r.isError,modelContent:r.modelContent}));break}case`tool-call-args-text-finish`:{if(r.meta.type!==`tool-call`)break;let{toolCallId:a,toolName:o}=r.meta,s=n.get(a);if(!s)throw Error(`No controller found for tool call`);await s.finishArgsText();let c=!1,l=Vle(()=>{let t;try{t=WE.default.parse(s.argsText)}catch(e){throw Error(`Function parameter parsing failed. ${JSON.stringify(e.message)}`)}let n=e.execute({toolCallId:a,toolName:o,args:t});return n!==void 0&&(c=!0,e.onExecutionStart?.(a,o)),n},t=>{if(c&&e.onExecutionEnd?.(a,o),t===void 0)return;let n=new ZE({artifact:t.artifact,result:t.result,isError:t.isError,messages:t.messages,modelContent:t.modelContent});s.setResponse(n),i.enqueue({type:`result`,path:r.path,...n})},t=>{c&&e.onExecutionEnd?.(a,o);let n=new ZE({result:String(t),isError:!0});s.setResponse(n),i.enqueue({type:`result`,path:r.path,...n})});l&&t.set(a,l);break}case`part-finish`:{if(r.meta.type!==`tool-call`)break;let{toolCallId:e}=r.meta,a=t.get(e);a?a.then(()=>{t.delete(e),n.delete(e),i.enqueue(r)}):i.enqueue(r)}}},async flush(){await Promise.all(t.values())}});return r.pipeThrough(new HE).pipeThrough(i)})}},aD=e=>typeof e==`object`&&!!e&&`~standard`in e&&e[`~standard`].version===1;function oD(e,t,n,r){let i=e?.[n.toolName];return i?.execute?(async e=>{if(t.aborted)return new ZE({result:`Tool execution was cancelled.`,isError:!0});let a=e;if(aD(i.parameters)){let e=i.parameters[`~standard`].validate(n.args);e instanceof Promise&&(e=await e),e.issues&&(a=i.experimental_onSchemaValidationError??(()=>{throw Error(`Function parameter validation failed. ${JSON.stringify(e.issues)}`)}))}let o=new Promise(e=>{let n=()=>{queueMicrotask(()=>{queueMicrotask(()=>{e(new ZE({result:`Tool execution was cancelled.`,isError:!0}))})})};t.aborted?n():t.addEventListener(`abort`,n,{once:!0})}),s=(async()=>{let e=await a(n.args,{toolCallId:n.toolCallId,abortSignal:t,human:e=>r(n.toolCallId,e)}),o=ZE.toResponse(e);if(i.toModelOutput&&!o.isError&&o.modelContent===void 0)try{let e=await i.toModelOutput({toolCallId:n.toolCallId,input:n.args,output:o.result});return new ZE({result:o.result,artifact:o.artifact,isError:o.isError,messages:o.messages,modelContent:e})}catch(e){console.warn(`[assistant-stream] tool "${n.toolName}" toModelOutput threw; falling back to default projection.`,e)}return o})();return Promise.race([s,o])})(i.execute):void 0}function sD(e,t,n,r,i){e?.[r.toolName]?.streamCall?.(n,{toolCallId:r.toolCallId,abortSignal:t,human:e=>i(r.toolCallId,e)})}function cD(e,t,n,r){let i=typeof e==`function`?e:()=>e,a=typeof t==`function`?t:()=>t;return new iD({execute:e=>oD(i(),a(),e,n),streamCall:({reader:e,...t})=>sD(i(),a(),e,t,n),onExecutionStart:r?.onExecutionStart,onExecutionEnd:r?.onExecutionEnd})}var lD=e=>{let t=V(7),{index:n,children:r}=e,i;t[0]===n?i=t[1]:(i=pE({source:`message`,query:{type:`index`,index:n},get:e=>e.message().attachment({index:n})}),t[0]=n,t[1]=i);let a;t[2]===i?a=t[3]:(a={attachment:i},t[2]=i,t[3]=a);let o=CE(a),s;return t[4]!==o||t[5]!==r?(s=(0,B.jsx)(dE,{value:o,children:r}),t[4]=o,t[5]=r,t[6]=s):s=t[6],s},uD=e=>{let t=V(7),{index:n,children:r}=e,i;t[0]===n?i=t[1]:(i=pE({source:`composer`,query:{type:`index`,index:n},get:e=>e.composer().attachment({index:n})}),t[0]=n,t[1]=i);let a;t[2]===i?a=t[3]:(a={attachment:i},t[2]=i,t[3]=a);let o=CE(a),s;return t[4]!==o||t[5]!==r?(s=(0,B.jsx)(dE,{value:o,children:r}),t[4]=o,t[5]=r,t[6]=s):s=t[6],s},dD=e=>{let t=V(10),{index:n,children:r}=e,i;t[0]===n?i=t[1]:(i=pE({source:`thread`,query:{type:`index`,index:n},get:e=>e.thread().message({index:n})}),t[0]=n,t[1]=i);let a;t[2]===n?a=t[3]:(a=pE({source:`message`,query:{},get:e=>e.thread().message({index:n}).composer()}),t[2]=n,t[3]=a);let o;t[4]!==i||t[5]!==a?(o={message:i,composer:a},t[4]=i,t[5]=a,t[6]=o):o=t[6];let s=CE(o),c;return t[7]!==s||t[8]!==r?(c=(0,B.jsx)(dE,{value:s,children:r}),t[7]=s,t[8]=r,t[9]=c):c=t[9],c},fD=e=>{let t=V(7),{index:n,children:r}=e,i;t[0]===n?i=t[1]:(i=pE({source:`message`,query:{type:`index`,index:n},get:e=>e.message().part({index:n})}),t[0]=n,t[1]=i);let a;t[2]===i?a=t[3]:(a={part:i},t[2]=i,t[3]=a);let o=CE(a),s;return t[4]!==o||t[5]!==r?(s=(0,B.jsx)(dE,{value:o,children:r}),t[4]=o,t[5]=r,t[6]=s):s=t[6],s},pD=ET(e=>{let t=V(7),{text:n,isRunning:r}=e,i;t[0]===r?i=t[1]:(i=r?{type:`running`}:{type:`complete`},t[0]=r,t[1]=i);let a;t[2]!==i||t[3]!==n?(a={type:`text`,text:n,status:i},t[2]=i,t[3]=n,t[4]=a):a=t[4];let o=a,s;return t[5]===o?s=t[6]:(s={getState:()=>o,addToolResult:hD,resumeToolCall:gD,respondToToolApproval:_D},t[5]=o,t[6]=s),s}),mD=e=>{let t=V(8),{text:n,isRunning:r,children:i}=e,a=r===void 0?!1:r,o;t[0]!==a||t[1]!==n?(o=pD({text:n,isRunning:a}),t[0]=a,t[1]=n,t[2]=o):o=t[2];let s;t[3]===o?s=t[4]:(s={part:o},t[3]=o,t[4]=s);let c=CE(s),l;return t[5]!==c||t[6]!==i?(l=(0,B.jsx)(dE,{value:c,children:i}),t[5]=c,t[6]=i,t[7]=l):l=t[7],l};function hD(){throw Error(`Not supported`)}function gD(){throw Error(`Not supported`)}function _D(){throw Error(`Not supported`)}var vD=Object.freeze({type:`complete`}),yD=ET(e=>{let t=V(9),{parts:n,getMessagePart:r}=e,[i,a]=uT(!0),o=n[n.length-1]?.status??vD,s;t[0]!==i||t[1]!==n||t[2]!==o?(s={parts:n,collapsed:i,status:o},t[0]=i,t[1]=n,t[2]=o,t[3]=s):s=t[3];let c=s,l;t[4]===c?l=t[5]:(l=()=>c,t[4]=c,t[5]=l);let u;return t[6]!==r||t[7]!==l?(u={getState:l,setCollapsed:a,part:r},t[6]=r,t[7]=l,t[8]=u):u=t[8],u}),bD=e=>{let t=V(5),{startIndex:n,endIndex:r,children:i}=e,a=H(xD).slice(n,r+1),o=CE(),s=yD({parts:a,getMessagePart:e=>{let{index:t}=e;if(t<0||t>=a.length)throw Error(`ChainOfThought part index ${t} is out of bounds (0..${a.length-1})`);return o.message().part({index:n+t})}}),c;t[0]===s?c=t[1]:(c={chainOfThought:s},t[0]=s,t[1]=c);let l=CE(c),u;return t[2]!==l||t[3]!==i?(u=(0,B.jsx)(dE,{value:l,children:i}),t[2]=l,t[3]=i,t[4]=u):u=t[4],u};function xD(e){return e.message.parts}var SD=e=>{let t=V(7),{index:n,children:r}=e,i;t[0]===n?i=t[1]:(i=pE({source:`suggestions`,query:{index:n},get:e=>e.suggestions().suggestion({index:n})}),t[0]=n,t[1]=i);let a;t[2]===i?a=t[3]:(a={suggestion:i},t[2]=i,t[3]=a);let o=CE(a),s;return t[4]!==o||t[5]!==r?(s=(0,B.jsx)(dE,{value:o,children:r}),t[4]=o,t[5]=r,t[6]=s):s=t[6],s},CD=e=>{let t=V(7),{index:n,children:r}=e,i;t[0]===n?i=t[1]:(i=pE({source:`composer`,query:{index:n},get:e=>e.composer().queueItem({index:n})}),t[0]=n,t[1]=i);let a;t[2]===i?a=t[3]:(a={queueItem:i},t[2]=i,t[3]=a);let o=CE(a),s;return t[4]!==o||t[5]!==r?(s=(0,B.jsx)(dE,{value:o,children:r}),t[4]=o,t[5]=r,t[6]=s):s=t[6],s},wD=Symbol(`innerMessage`),TD=Symbol(`innerMessages`),ED=[],DD=(e,t)=>{wD in e||(e[wD]=t)},OD=e=>{let t=`messages`in e?e.messages:e,n=t[TD]||t[wD];return n?Array.isArray(n)?n:(t[TD]=[n],t[TD]):ED},kD=Symbol(`skip-update`);function AD(e,t){if(e===void 0&&t===void 0)return!0;if(e===void 0||t===void 0)return!1;for(let n of Object.keys(e)){let r=e[n],i=t[n];if(!Object.is(r,i))return!1}return!0}var jD=class{_subscribers=new Set;subscribe(e){return this._subscribers.add(e),()=>this._subscribers.delete(e)}waitForUpdate(){return new Promise(e=>{let t=this.subscribe(()=>{t(),e()})})}_notifySubscribers(){let e=[];for(let t of this._subscribers)try{t()}catch(t){e.push(t)}if(e.length>0){if(e.length===1)throw e[0];for(let t of e)console.error(t);throw AggregateError(e)}}},MD=class{_subscriptions=new Set;_connection;get isConnected(){return!!this._connection}notifySubscribers(e){for(let t of this._subscriptions)t(e)}_updateConnection(){if(this._subscriptions.size>0){if(this._connection)return;this._connection=this._connect()}else this._connection?.(),this._connection=void 0}subscribe(e){return this._subscriptions.add(e),this._updateConnection(),()=>{this._subscriptions.delete(e),this._updateConnection()}}},ND=class extends MD{binding;get path(){return this.binding.path}constructor(e){super(),this.binding=e;let t=e.getState();if(t===kD)throw Error(`Entry not available in the store`);this._previousState=t}_previousState;getState=()=>(this.isConnected||this._syncState(),this._previousState);_syncState(){let e=this.binding.getState();return e===kD||AD(e,this._previousState)?!1:(this._previousState=e,!0)}_connect(){return this.binding.subscribe(()=>{this._syncState()&&this.notifySubscribers()})}},PD=class extends MD{binding;get path(){return this.binding.path}constructor(e){super(),this.binding=e}_previousStateDirty=!0;_previousState;getState=()=>{if(!this.isConnected||this._previousStateDirty){let e=this.binding.getState();e!==kD&&(this._previousState=e),this._previousStateDirty=!1}if(this._previousState===void 0)throw Error(`Entry not available in the store`);return this._previousState};_connect(){return this.binding.subscribe(()=>{this._previousStateDirty=!0,this.notifySubscribers()})}},FD=class extends MD{binding;get path(){return this.binding.path}constructor(e){super(),this.binding=e}getState(){return this.binding.getState()}outerSubscribe(e){return this.binding.subscribe(e)}_connect(){let e=()=>{this.notifySubscribers()},t=this.binding.getState(),n=t?.subscribe(e),r=this.outerSubscribe(()=>{let r=this.binding.getState();r!==t&&(t=r,n?.(),n=r?.subscribe(e),e())});return()=>{r?.(),n?.()}}},ID=class extends MD{config;constructor(e){super(),this.config=e}getState(){return this.config.binding.getState()}outerSubscribe(e){return this.config.binding.subscribe(e)}_connect(){let e=e=>{this.notifySubscribers(e)},t=this.config.binding.getState(),n=t?.unstable_on(this.config.event,e),r=this.outerSubscribe(()=>{let r=this.config.binding.getState();r!==t&&(t=r,n?.(),n=r?.unstable_on(this.config.event,e))});return()=>{r?.(),n?.()}}},LD=class{_core;get path(){return this._core.path}constructor(e){this._core=e,this.__internal_bindMethods()}__internal_bindMethods(){this.getState=this.getState.bind(this),this.remove=this.remove.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this._core.getState()}subscribe(e){return this._core.subscribe(e)}},RD=class extends LD{_composerApi;constructor(e,t){super(e),this._composerApi=t}remove(){let e=this._composerApi.getState();if(!e)throw Error(`Composer is not available`);return e.removeAttachment(this.getState().id)}},zD=class extends RD{get source(){return`thread-composer`}},BD=class extends RD{get source(){return`edit-composer`}},VD=class extends LD{get source(){return`message`}remove(){throw Error(`Message attachments cannot be removed`)}},HD=Object.freeze([]),UD=Object.freeze({}),WD=e=>Object.freeze({type:`thread`,isEditing:e?.isEditing??!1,canCancel:e?.canCancel??!1,canSend:e?.canSend??!1,isEmpty:e?.isEmpty??!0,attachments:e?.attachments??HD,text:e?.text??``,role:e?.role??`user`,runConfig:e?.runConfig??UD,attachmentAccept:e?.attachmentAccept??``,dictation:e?.dictation,quote:e?.quote,queue:e?.queue??HD,value:e?.text??``}),GD=e=>Object.freeze({type:`edit`,isEditing:e?.isEditing??!1,canCancel:e?.canCancel??!1,canSend:e?.canSend??!1,isEmpty:e?.isEmpty??!0,text:e?.text??``,role:e?.role??`user`,attachments:e?.attachments??HD,runConfig:e?.runConfig??UD,attachmentAccept:e?.attachmentAccept??``,dictation:e?.dictation,quote:e?.quote,queue:e?.queue??HD,parentId:e?.parentId??null,sourceId:e?.sourceId??null,value:e?.text??``}),KD=class{_core;get path(){return this._core.path}constructor(e){this._core=e}__internal_bindMethods(){this.setText=this.setText.bind(this),this.setRunConfig=this.setRunConfig.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.addAttachment=this.addAttachment.bind(this),this.reset=this.reset.bind(this),this.clearAttachments=this.clearAttachments.bind(this),this.send=this.send.bind(this),this.cancel=this.cancel.bind(this),this.steerQueueItem=this.steerQueueItem.bind(this),this.removeQueueItem=this.removeQueueItem.bind(this),this.setRole=this.setRole.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.startDictation=this.startDictation.bind(this),this.stopDictation=this.stopDictation.bind(this),this.setQuote=this.setQuote.bind(this),this.unstable_on=this.unstable_on.bind(this)}setText(e){let t=this._core.getState();if(!t)throw Error(`Composer is not available`);t.setText(e)}setRunConfig(e){let t=this._core.getState();if(!t)throw Error(`Composer is not available`);t.setRunConfig(e)}addAttachment(e){let t=this._core.getState();if(!t)throw Error(`Composer is not available`);return t.addAttachment(e)}reset(){let e=this._core.getState();if(!e)throw Error(`Composer is not available`);return e.reset()}clearAttachments(){let e=this._core.getState();if(!e)throw Error(`Composer is not available`);return e.clearAttachments()}send(e){let t=this._core.getState();if(!t)throw Error(`Composer is not available`);t.send(e)}cancel(){let e=this._core.getState();if(!e)throw Error(`Composer is not available`);e.cancel()}steerQueueItem(e){let t=this._core.getState();if(!t)throw Error(`Composer is not available`);t.steerQueueItem(e)}removeQueueItem(e){let t=this._core.getState();if(!t)throw Error(`Composer is not available`);t.removeQueueItem(e)}setRole(e){let t=this._core.getState();if(!t)throw Error(`Composer is not available`);t.setRole(e)}startDictation(){let e=this._core.getState();if(!e)throw Error(`Composer is not available`);e.startDictation()}stopDictation(){let e=this._core.getState();if(!e)throw Error(`Composer is not available`);e.stopDictation()}setQuote(e){let t=this._core.getState();if(!t)throw Error(`Composer is not available`);t.setQuote(e)}subscribe(e){return this._core.subscribe(e)}_eventSubscriptionSubjects=new Map;unstable_on(e,t){let n=this._eventSubscriptionSubjects.get(e);return n||(n=new ID({event:e,binding:this._core}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}},qD=class extends KD{get path(){return this._core.path}get type(){return`thread`}_getState;constructor(e){let t=new PD({path:e.path,getState:()=>WD(e.getState()),subscribe:t=>e.subscribe(t)});super({path:e.path,getState:()=>e.getState(),subscribe:e=>t.subscribe(e)}),this._getState=t.getState.bind(t),this.__internal_bindMethods()}getState(){return this._getState()}getAttachmentByIndex(e){return new zD(new ND({path:{...this.path,attachmentSource:`thread-composer`,attachmentSelector:{type:`index`,index:e},ref:`${this.path.ref}.attachments[${e}]`},getState:()=>{let t=this.getState().attachments[e];return t?{...t,source:`thread-composer`}:kD},subscribe:e=>this._core.subscribe(e)}),this._core)}},JD=class extends KD{_beginEdit;get path(){return this._core.path}get type(){return`edit`}_getState;constructor(e,t){let n=new PD({path:e.path,getState:()=>GD(e.getState()),subscribe:t=>e.subscribe(t)});super({path:e.path,getState:()=>e.getState(),subscribe:e=>n.subscribe(e)}),this._beginEdit=t,this._getState=n.getState.bind(n),this.__internal_bindMethods()}__internal_bindMethods(){super.__internal_bindMethods(),this.beginEdit=this.beginEdit.bind(this)}getState(){return this._getState()}beginEdit(){this._beginEdit()}getAttachmentByIndex(e){return new BD(new ND({path:{...this.path,attachmentSource:`edit-composer`,attachmentSelector:{type:`index`,index:e},ref:`${this.path.ref}.attachments[${e}]`},getState:()=>{let t=this.getState().attachments[e];return t?{...t,source:`edit-composer`}:kD},subscribe:e=>this._core.subscribe(e)}),this._core)}},YD=e=>e.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
99
|
+
|
|
100
|
+
`),XD={"allow-once":!0,"allow-always":!0,"reject-once":!1,"reject-always":!1},ZD=(e,t)=>{let n,r;if(`optionId`in t){let i=e.options?.find(e=>e.id===t.optionId);if(!i)throw Error(`Tool approval has no option with id "${t.optionId}"`);if(`approved`in t)n=t.approved;else{if(!Object.hasOwn(XD,i.kind))throw Error(`Tool approval option "${i.id}" has a custom kind "${i.kind}"; respond with an explicit approved value instead`);n=XD[i.kind]}r=i.id}else n=t.approved;return{approvalId:e.id,approved:n,...r!==void 0&&{optionId:r},...t.reason!=null&&{reason:t.reason}}},QD=class{contentBinding;messageApi;threadApi;get path(){return this.contentBinding.path}constructor(e,t,n){this.contentBinding=e,this.messageApi=t,this.threadApi=n,this.__internal_bindMethods()}__internal_bindMethods(){this.addToolResult=this.addToolResult.bind(this),this.resumeToolCall=this.resumeToolCall.bind(this),this.respondToToolApproval=this.respondToToolApproval.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this.contentBinding.getState()}addToolResult(e){let t=this.contentBinding.getState();if(!t)throw Error(`Message part is not available`);if(t.type!==`tool-call`)throw Error(`Tried to add tool result to non-tool message part`);if(!this.messageApi)throw Error(`Message API is not available. This is likely a bug in assistant-ui.`);if(!this.threadApi)throw Error(`Thread API is not available`);let n=this.messageApi.getState();if(!n)throw Error(`Message is not available`);let r=t.toolName,i=t.toolCallId,a=ZE.toResponse(e);this.threadApi.getState().addToolResult({messageId:n.id,toolName:r,toolCallId:i,result:a.result,artifact:a.artifact,isError:a.isError})}resumeToolCall(e){let t=this.contentBinding.getState();if(!t)throw Error(`Message part is not available`);if(t.type!==`tool-call`)throw Error(`Tried to resume tool call on non-tool message part`);if(!this.threadApi)throw Error(`Thread API is not available`);let n=t.toolCallId;this.threadApi.getState().resumeToolCall({toolCallId:n,payload:e})}respondToToolApproval(e){let t=this.contentBinding.getState();if(!t)throw Error(`Message part is not available`);if(t.type!==`tool-call`)throw Error(`Tried to respond to tool approval on non-tool message part`);if(!t.approval||t.approval.approved!==void 0||t.approval.resolution!==void 0)throw Error(`Tool call has no pending approval`);if(!this.threadApi)throw Error(`Thread API is not available`);this.threadApi.getState().respondToToolApproval(ZD(t.approval,e))}subscribe(e){return this.contentBinding.subscribe(e)}},$D=Object.freeze({type:`complete`}),eO=(e,t,n)=>{if(e.role!==`assistant`)return $D;if(n.type===`tool-call`)return n.result?$D:e.status;let r=t===Math.max(0,e.content.length-1);return e.status.type===`requires-action`?$D:r?e.status:$D},tO=(e,t)=>{let n=e.content[t];if(!n)return kD;let r=eO(e,t,n);return Object.freeze({...n,[wD]:n[wD],status:r})},nO=class{_core;_threadBinding;get path(){return this._core.path}constructor(e,t){this._core=e,this._threadBinding=t,this.composer=new JD(new FD({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.composer`,composerSource:`edit`},getState:this._getEditComposerRuntimeCore,subscribe:e=>this._threadBinding.subscribe(e)}),()=>this._threadBinding.getState().beginEdit(this._core.getState().id)),this.__internal_bindMethods()}__internal_bindMethods(){this.reload=this.reload.bind(this),this.delete=this.delete.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getMessagePartByIndex=this.getMessagePartByIndex.bind(this),this.getMessagePartByToolCallId=this.getMessagePartByToolCallId.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.unstable_getCopyText=this.unstable_getCopyText.bind(this),this.speak=this.speak.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.submitFeedback=this.submitFeedback.bind(this),this.switchToBranch=this.switchToBranch.bind(this)}composer;_getEditComposerRuntimeCore=()=>this._threadBinding.getState().getEditComposer(this._core.getState().id);getState(){return this._core.getState()}delete(){let e=this._core.getState();return this._threadBinding.getState().deleteMessage(e.id)}reload(e={}){let t=this._getEditComposerRuntimeCore(),n=t??this._threadBinding.getState().composer,r=t??n,{runConfig:i=r.runConfig}=e,a=this._core.getState();if(a.role!==`assistant`)throw Error(`Can only reload assistant messages`);this._threadBinding.getState().startRun({parentId:a.parentId,sourceId:a.id,runConfig:i})}speak(){let e=this._core.getState();return this._threadBinding.getState().speak(e.id)}stopSpeaking(){let e=this._core.getState();if(this._threadBinding.getState().speech?.messageId===e.id)this._threadBinding.getState().stopSpeaking();else throw Error(`Message is not being spoken`)}submitFeedback({type:e}){let t=this._core.getState();this._threadBinding.getState().submitFeedback({messageId:t.id,type:e})}switchToBranch({position:e,branchId:t}){let n=this._core.getState();if(t&&e)throw Error(`May not specify both branchId and position`);if(!t&&!e)throw Error(`Must specify either branchId or position`);let r=this._threadBinding.getState().getBranches(n.id),i=t;if(e===`previous`?i=r[n.branchNumber-2]:e===`next`&&(i=r[n.branchNumber]),!i)throw Error(`Branch not found`);this._threadBinding.getState().switchToBranch(i)}unstable_getCopyText(){return YD(this.getState())}subscribe(e){return this._core.subscribe(e)}getMessagePartByIndex(e){if(e<0)throw Error(`Message part index must be >= 0`);return new QD(new ND({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.content[${e}]`,messagePartSelector:{type:`index`,index:e}},getState:()=>tO(this.getState(),e),subscribe:e=>this._core.subscribe(e)}),this._core,this._threadBinding)}getMessagePartByToolCallId(e){return new QD(new ND({path:{...this.path,ref:this.path.ref+`${this.path.ref}.content[toolCallId=${JSON.stringify(e)}]`,messagePartSelector:{type:`toolCallId`,toolCallId:e}},getState:()=>{let t=this._core.getState(),n=t.content.findIndex(t=>t.type===`tool-call`&&t.toolCallId===e);return n===-1?kD:tO(t,n)},subscribe:e=>this._core.subscribe(e)}),this._core,this._threadBinding)}getAttachmentByIndex(e){return new VD(new ND({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.attachments[${e}]`,attachmentSource:`message`,attachmentSelector:{type:`index`,index:e}},getState:()=>{let t=this.getState().attachments?.[e];return t?{...t,source:`message`}:kD},subscribe:e=>this._core.subscribe(e)}))}},rO=e=>({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{},...e.stream?{stream:e.stream}:{}}),iO=e=>({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{}}),aO=(e,t)=>typeof t==`string`?{createdAt:new Date,parentId:e.at(-1)?.id??null,sourceId:null,runConfig:{},role:`user`,content:[{type:`text`,text:t}],attachments:[],metadata:{custom:{}}}:{createdAt:t.createdAt??new Date,parentId:t.parentId??e.at(-1)?.id??null,sourceId:t.sourceId??null,role:t.role??`user`,content:t.content,attachments:t.attachments??[],metadata:t.metadata??{custom:{}},runConfig:t.runConfig??{},startRun:t.startRun},oO=(e,t)=>{let n=e.messages.at(-1);return Object.freeze({threadId:t.id,metadata:t,capabilities:e.capabilities,isDisabled:e.isDisabled,isLoading:e.isLoading,isRunning:e.isRunning??(n?.role===`assistant`?n.status.type===`running`:!1),messages:e.messages,state:e.state,suggestions:e.suggestions,extras:e.extras,speech:e.speech,voice:e.voice})},sO=class{get path(){return this._threadBinding.path}get __internal_threadBinding(){return this._threadBinding}_threadBinding;constructor(e,t){let n=new ND({path:e.path,getState:()=>oO(e.getState(),t.getState()),subscribe:n=>{let r=e.subscribe(n),i=t.subscribe(n);return()=>{r(),i()}}});this._threadBinding={path:e.path,getState:()=>e.getState(),getStateState:()=>n.getState(),outerSubscribe:t=>e.outerSubscribe(t),subscribe:t=>e.subscribe(t)},this.composer=new qD(new FD({path:{...this.path,ref:`${this.path.ref}.composer`,composerSource:`thread`},getState:()=>this._threadBinding.getState().composer,subscribe:e=>this._threadBinding.subscribe(e)})),this.__internal_bindMethods()}__internal_bindMethods(){this.append=this.append.bind(this),this.deleteMessage=this.deleteMessage.bind(this),this.resumeRun=this.resumeRun.bind(this),this.importExternalState=this.importExternalState.bind(this),this.exportExternalState=this.exportExternalState.bind(this),this.startRun=this.startRun.bind(this),this.cancelRun=this.cancelRun.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.connectVoice=this.connectVoice.bind(this),this.disconnectVoice=this.disconnectVoice.bind(this),this.muteVoice=this.muteVoice.bind(this),this.unmuteVoice=this.unmuteVoice.bind(this),this.getVoiceVolume=this.getVoiceVolume.bind(this),this.subscribeVoiceVolume=this.subscribeVoiceVolume.bind(this),this.export=this.export.bind(this),this.import=this.import.bind(this),this.reset=this.reset.bind(this),this.getMessageByIndex=this.getMessageByIndex.bind(this),this.getMessageById=this.getMessageById.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getModelContext=this.getModelContext.bind(this),this.getState=this.getState.bind(this)}composer;getState(){return this._threadBinding.getStateState()}append(e){this._threadBinding.getState().append(aO(this._threadBinding.getState().messages,e))}deleteMessage(e){return this._threadBinding.getState().deleteMessage(e)}subscribe(e){return this._threadBinding.subscribe(e)}getModelContext(){return this._threadBinding.getState().getModelContext()}startRun(e){return this._threadBinding.getState().startRun(iO(e))}resumeRun(e){return this._threadBinding.getState().resumeRun(rO(e))}exportExternalState(){return this._threadBinding.getState().exportExternalState()}importExternalState(e){this._threadBinding.getState().importExternalState(e)}cancelRun(){this._threadBinding.getState().cancelRun()}stopSpeaking(){return this._threadBinding.getState().stopSpeaking()}connectVoice(){this._threadBinding.getState().connectVoice()}disconnectVoice(){this._threadBinding.getState().disconnectVoice()}getVoiceVolume(){return this._threadBinding.getState().getVoiceVolume()}subscribeVoiceVolume(e){return this._threadBinding.getState().subscribeVoiceVolume(e)}muteVoice(){this._threadBinding.getState().muteVoice()}unmuteVoice(){this._threadBinding.getState().unmuteVoice()}export(){return this._threadBinding.getState().export()}import(e){this._threadBinding.getState().import(e)}reset(e){this._threadBinding.getState().reset(e)}getMessageByIndex(e){if(e<0)throw Error(`Message index must be >= 0`);return this._getMessageRuntime({...this.path,ref:`${this.path.ref}.messages[${e}]`,messageSelector:{type:`index`,index:e}},()=>{let t=this._threadBinding.getState().messages,n=t[e];if(n)return{message:n,parentId:t[e-1]?.id??null,index:e}})}getMessageById(e){return this._getMessageRuntime({...this.path,ref:`${this.path.ref}.messages[messageId=${JSON.stringify(e)}]`,messageSelector:{type:`messageId`,messageId:e}},()=>this._threadBinding.getState().getMessageById(e))}_getMessageRuntime(e,t){return new nO(new ND({path:e,getState:()=>{let{message:e,parentId:n,index:r}=t()??{},{messages:i,speech:a}=this._threadBinding.getState();if(!e||n===void 0||r===void 0)return kD;let o=this._threadBinding.getState().getBranches(e.id);return{...e,[wD]:e[wD],index:r,isLast:i.at(-1)?.id===e.id,parentId:n,branchNumber:o.indexOf(e.id)+1,branchCount:o.length,speech:a?.messageId===e.id?a:void 0}},subscribe:e=>this._threadBinding.subscribe(e)}),this._threadBinding)}_eventSubscriptionSubjects=new Map;unstable_on(e,t){let n=this._eventSubscriptionSubjects.get(e);return n||(n=new ID({event:e,binding:this._threadBinding}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}},cO=bT(null),lO=()=>ST(cO),uO=class{_core;_threadListBinding;get path(){return this._core.path}constructor(e,t){this._core=e,this._threadListBinding=t,this.__internal_bindMethods()}__internal_bindMethods(){this.switchTo=this.switchTo.bind(this),this.rename=this.rename.bind(this),this.updateCustom=this.updateCustom.bind(this),this.archive=this.archive.bind(this),this.unarchive=this.unarchive.bind(this),this.delete=this.delete.bind(this),this.initialize=this.initialize.bind(this),this.generateTitle=this.generateTitle.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getState=this.getState.bind(this),this.detach=this.detach.bind(this)}getState(){return this._core.getState()}switchTo(e){let t=this._core.getState();return this._threadListBinding.switchToThread(t.id,e)}rename(e){let t=this._core.getState();return this._threadListBinding.rename(t.id,e)}updateCustom(e){let t=this._core.getState();if(!this._threadListBinding.updateCustom)throw Error(`Thread list runtime does not support updating custom metadata`);return this._threadListBinding.updateCustom(t.id,e)}archive(){let e=this._core.getState();return this._threadListBinding.archive(e.id)}unarchive(){let e=this._core.getState();return this._threadListBinding.unarchive(e.id)}delete(){let e=this._core.getState();return this._threadListBinding.delete(e.id)}initialize(){let e=this._core.getState();return this._threadListBinding.initialize(e.id)}generateTitle(){let e=this._core.getState();return this._threadListBinding.generateTitle(e.id)}unstable_on(e,t){let n=this._core.getState().isMain,r=this._core.getState().id;return this.subscribe(()=>{let i=this._core.getState(),a=i.isMain,o=i.id;n===a&&r===o||(n=a,r=o,!(e===`switchedTo`&&!a)&&(e===`switchedAway`&&a||t({})))})}subscribe(e){return this._core.subscribe(e)}detach(){let e=this._core.getState();this._threadListBinding.detach(e.id)}__internal_getRuntime(){return this}},dO=Promise.resolve(),fO=e=>({mainThreadId:e.mainThreadId,newThreadId:e.newThreadId,threadIds:e.threadIds,archivedThreadIds:e.archivedThreadIds,isLoading:e.isLoading,isLoadingMore:e.isLoadingMore??!1,hasMore:e.hasMore??!1,threadItems:e.threadItems}),pO=(e,t)=>{if(t===void 0)return kD;let n=e.getItemById(t);return n?{id:n.id,remoteId:n.remoteId,externalId:n.externalId,title:n.title,status:n.status,lastMessageAt:n.lastMessageAt,custom:n.custom,isMain:n.id===e.mainThreadId}:kD},mO=class{_core;_runtimeFactory;_getState;constructor(e,t=sO){this._core=e,this._runtimeFactory=t;let n=new PD({path:{},getState:()=>fO(e),subscribe:t=>e.subscribe(t)});this._getState=n.getState.bind(n),this._mainThreadListItemRuntime=new uO(new ND({path:{ref:`threadItems[main]`,threadSelector:{type:`main`}},getState:()=>pO(this._core,this._core.mainThreadId),subscribe:e=>this._core.subscribe(e)}),this._core),this.main=new t(new FD({path:{ref:`threads.main`,threadSelector:{type:`main`}},getState:()=>e.getMainThreadRuntimeCore(),subscribe:t=>e.subscribe(t)}),this._mainThreadListItemRuntime),this.__internal_bindMethods()}__internal_bindMethods(){this.switchToThread=this.switchToThread.bind(this),this.switchToNewThread=this.switchToNewThread.bind(this),this.getLoadThreadsPromise=this.getLoadThreadsPromise.bind(this),this.reload=this.reload.bind(this),this.loadMore=this.loadMore.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getById=this.getById.bind(this),this.getItemById=this.getItemById.bind(this),this.getItemByIndex=this.getItemByIndex.bind(this),this.getArchivedItemByIndex=this.getArchivedItemByIndex.bind(this)}switchToThread(e,t){return this._core.switchToThread(e,t)}switchToNewThread(){return this._core.switchToNewThread()}getLoadThreadsPromise(){return this._core.getLoadThreadsPromise()}reload(){return this._core.reload?.()??dO}loadMore(){return this._core.loadMore?.()??dO}getState(){return this._getState()}subscribe(e){return this._core.subscribe(e)}_mainThreadListItemRuntime;main;get mainItem(){return this._mainThreadListItemRuntime}getById(e){return new this._runtimeFactory(new FD({path:{ref:`threads[threadId=${JSON.stringify(e)}]`,threadSelector:{type:`threadId`,threadId:e}},getState:()=>this._core.getThreadRuntimeCore(e),subscribe:e=>this._core.subscribe(e)}),this.mainItem)}getItemByIndex(e){return new uO(new ND({path:{ref:`threadItems[${e}]`,threadSelector:{type:`index`,index:e}},getState:()=>pO(this._core,this._core.threadIds[e]),subscribe:e=>this._core.subscribe(e)}),this._core)}getArchivedItemByIndex(e){return new uO(new ND({path:{ref:`archivedThreadItems[${e}]`,threadSelector:{type:`archiveIndex`,index:e}},getState:()=>pO(this._core,this._core.archivedThreadIds[e]),subscribe:e=>this._core.subscribe(e)}),this._core)}getItemById(e){return new uO(new ND({path:{ref:`threadItems[threadId=${e}]`,threadSelector:{type:`threadId`,threadId:e}},getState:()=>pO(this._core,e),subscribe:e=>this._core.subscribe(e)}),this._core)}},hO=class{_core;threads;_thread;constructor(e){this._core=e,this.threads=new mO(e.threads),this._thread=this.threads.main,this.__internal_bindMethods()}__internal_bindMethods(){this.registerModelContextProvider=this.registerModelContextProvider.bind(this)}get thread(){return this._thread}registerModelContextProvider(e){return this._core.registerModelContextProvider(e)}},gO=class{_contextProvider=new GT;registerModelContextProvider(e){return this._contextProvider.registerModelContextProvider(e)}getModelContextProvider(){return this._contextProvider}},_O=Object.freeze([]),vO=`DEFAULT_THREAD_ID`,yO=Object.freeze([vO]),bO=Object.freeze({id:vO,remoteId:void 0,externalId:void 0,status:`regular`}),xO=Promise.resolve(),SO=Object.freeze({[vO]:bO}),CO=class{threadFactory;_mainThreadId=vO;_threads=yO;_archivedThreads=_O;_threadData=SO;adapter={};get isLoading(){return this.adapter.isLoading??!1}get newThreadId(){}get threadIds(){return this._threads}get archivedThreadIds(){return this._archivedThreads}get threadItems(){return this._threadData}getLoadThreadsPromise(){return xO}_mainThread;get mainThreadId(){return this._mainThreadId}constructor(e={},t){this.threadFactory=t,this.__internal_setAdapter(e,!0)}getMainThreadRuntimeCore(){return this._mainThread}getThreadRuntimeCore(){throw Error(`Method not implemented.`)}getItemById(e){return this._threadData[e]}__internal_setAdapter(e,t=!1){let n=this.adapter;this.adapter=e;let r=e.threadId??vO,i=e.threads??_O,a=e.archivedThreads??_O,o=n.threadId??vO,s=n.threads??_O,c=n.archivedThreads??_O;!t&&o===r&&s===i&&c===a||((s!==i||c!==a||o!==r)&&(this._threadData={...SO,...Object.fromEntries(e.threads?.map(e=>[e.id,{...e,remoteId:e.remoteId,externalId:e.externalId,status:`regular`}])??[]),...Object.fromEntries(e.archivedThreads?.map(e=>[e.id,{...e,remoteId:e.remoteId,externalId:e.externalId,status:`archived`}])??[])}),s!==i&&(this._threads=this.adapter.threads?.map(e=>e.id)??_O),c!==a&&(this._archivedThreads=this.adapter.archivedThreads?.map(e=>e.id)??_O),(t||o!==r)&&(this._mainThreadId=r,this._mainThread=this.threadFactory()),this._threadData[this._mainThreadId]||(this._threadData={...this._threadData,[this._mainThreadId]:{id:this._mainThreadId,remoteId:void 0,externalId:void 0,status:`regular`}}),this._notifySubscribers())}async switchToThread(e,t){if(this._mainThreadId===e)return;let n=this.adapter.onSwitchToThread;if(!n)throw Error(`External store adapter does not support switching to thread`);await n(e)}async switchToNewThread(){let e=this.adapter.onSwitchToNewThread;if(!e)throw Error(`External store adapter does not support switching to new thread`);await e()}async rename(e,t){let n=this.adapter.onRename;if(!n)throw Error(`External store adapter does not support renaming`);await n(e,t)}async updateCustom(e,t){let n=this.adapter.onUpdateCustom;if(!n)throw Error(`External store adapter does not support updating custom metadata`);await n(e,t)}async detach(){}async archive(e){let t=this.adapter.onArchive;if(!t)throw Error(`External store adapter does not support archiving`);await t(e)}async unarchive(e){let t=this.adapter.onUnarchive;if(!t)throw Error(`External store adapter does not support unarchiving`);await t(e)}async delete(e){let t=this.adapter.onDelete;if(!t)throw Error(`External store adapter does not support deleting`);await t(e)}initialize(e){return Promise.resolve({remoteId:e,externalId:void 0})}generateTitle(){throw Error(`Method not implemented.`)}_subscriptions=new Set;subscribe(e){return this._subscriptions.add(e),()=>this._subscriptions.delete(e)}_notifySubscribers(){for(let e of this._subscriptions)e()}},wO=UE(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,7),TO=(e,t)=>{if(e.startsWith(`data-`))return{type:`data`,name:e.substring(5),data:t}},EO=(e,t,n)=>{let{role:r,id:i,createdAt:a,attachments:o,status:s,metadata:c}=e,l={id:i??t,createdAt:a??new Date},u=typeof e.content==`string`?[{type:`text`,text:e.content}]:e.content,d=({image:e,...t})=>e.match(/^data:image\/(png|jpeg|jpg|gif|webp|svg\+xml);base64,(.*)$/)||/^(https:\/\/|blob:)/.test(e)?{...t,image:e}:(console.warn(`Invalid image data format detected`),null);if(r!==`user`&&o?.length)throw Error(`attachments are only supported for user messages`);if(r!==`assistant`&&s)throw Error(`status is only supported for assistant messages`);if(r!==`assistant`&&c?.steps)throw Error(`metadata.steps is only supported for assistant messages`);switch(r){case`assistant`:return{...l,role:r,content:u.map(e=>{let t=e.type;switch(t){case`text`:case`reasoning`:return e.text.trim().length===0?null:e;case`file`:case`source`:return e;case`image`:return d(e);case`data`:return e;case`generative-ui`:return e;case`tool-call`:{let{parentId:t,messages:n,...r}=e,i={...r,toolCallId:e.toolCallId??`tool-${wO()}`,...t!==void 0&&{parentId:t},...n!==void 0&&{messages:n}};return e.args?{...i,args:e.args,argsText:e.argsText??JSON.stringify(e.args)}:{...i,args:KE(e.argsText??``)??{},argsText:e.argsText??``}}default:{let n=TO(t,e.data);if(n)return n;throw Error(`Unsupported assistant message part type: ${t}`)}}}).filter(e=>!!e),status:s??n,metadata:{unstable_state:c?.unstable_state??null,unstable_annotations:c?.unstable_annotations??[],unstable_data:c?.unstable_data??[],custom:c?.custom??{},steps:c?.steps??[],...c?.timing&&{timing:c.timing},...c?.submittedFeedback&&{submittedFeedback:c.submittedFeedback},...c?.isOptimistic&&{isOptimistic:!0}}};case`user`:return{...l,role:r,content:u.map(e=>{let t=e.type;switch(t){case`text`:case`image`:case`audio`:case`file`:case`data`:return e;default:{let n=TO(t,e.data);if(n)return n;throw Error(`Unsupported user message part type: ${t}`)}}}),attachments:(o??[]).map(e=>({...e,content:e.content.map(e=>TO(e.type,e.data)??e)})),metadata:{custom:c?.custom??{}}};case`system`:if(u.length!==1||u[0].type!==`text`)throw Error(`System messages must have exactly one text message part.`);return{...l,role:r,content:u,metadata:{custom:c?.custom??{}}};default:throw Error(`Unknown message role: ${r}`)}},DO=Symbol(`autoStatus`),OO=Object.freeze(Object.assign({type:`running`},{[DO]:!0})),kO=Object.freeze(Object.assign({type:`complete`,reason:`unknown`},{[DO]:!0})),AO=Object.freeze(Object.assign({type:`requires-action`,reason:`tool-calls`},{[DO]:!0})),jO=Object.freeze(Object.assign({type:`requires-action`,reason:`interrupt`},{[DO]:!0})),MO=e=>e[DO]===!0,NO=(e,t,n,r,i)=>e&&i?Object.assign({type:`incomplete`,reason:`error`,error:i},{[DO]:!0}):e&&t?OO:n?jO:r?AO:kO,PO={fromArray:e=>{let t=e.map(e=>EO(e,wO(),NO(!1,!1,!1,!1,void 0)));return{messages:t.map((e,n)=>({parentId:n>0?t[n-1].id:null,message:e}))}},fromBranchableArray:(e,t)=>{let n=NO(!1,!1,!1,!1,void 0);return{...t?.headId===void 0?void 0:{headId:t.headId},messages:e.map(({message:e,parentId:t})=>{if(!e.id)throw Error(`ExportedMessageRepository.fromBranchableArray: Each message must have an 'id' field set.`);return{parentId:t,message:EO(e,e.id,n)}})}}},FO=e=>e.next?FO(e.next):`current`in e?e:null,IO=class{func;_value=null;constructor(e){this.func=e}get value(){return this._value===null&&(this._value=this.func()),this._value}dirty(){this._value=null}},LO=class{messages=new Map;head=null;root={children:[],next:null};updateLevels(e,t){e.level=t;for(let n of e.children){let e=this.messages.get(n);e&&this.updateLevels(e,t+1)}}performOp(e,t,n){let r=t.prev??this.root,i=e??this.root;if(!(n===`relink`&&r===i)){if(n!==`link`&&(r.children=r.children.filter(e=>e!==t.current.id),r.next===t)){let e=r.children.at(-1),t=e?this.messages.get(e):null;if(t===void 0)throw Error(`MessageRepository(performOp/cut): Fallback sibling message not found. This is likely an internal bug in assistant-ui.`);r.next=t}if(n!==`cut`){for(let n=e;n;n=n.prev)if(n.current.id===t.current.id)throw Error(`MessageRepository(performOp/link): A message with the same id already exists in the parent tree. This error occurs if the same message id is found multiple times. This is likely an internal bug in assistant-ui.`);i.children=[...i.children,t.current.id],(FO(t)===this.head||i.next===null)&&(i.next=t),t.prev=e;let n=e?e.level+1:0;this.updateLevels(t,n)}}}_messages=new IO(()=>{let e=Array((this.head?.level??-1)+1);for(let t=this.head;t;t=t.prev)e[t.level]=t.current;return e});get headId(){return this.head?.current.id??null}getMessages(e){if(e===void 0||e===this.head?.current.id)return this._messages.value;let t=this.messages.get(e);if(!t)throw Error(`MessageRepository(getMessages): Head message not found. This is likely an internal bug in assistant-ui.`);let n=Array(t.level+1);for(let e=t;e;e=e.prev)n[e.level]=e.current;return n}addOrUpdateMessage(e,t){let n=this.messages.get(t.id),r=e?this.messages.get(e):null;if(r===void 0)throw Error(`MessageRepository(addOrUpdateMessage): Parent message not found. This is likely an internal bug in assistant-ui.`);if(n){n.current=t,this.performOp(r,n,`relink`),this._messages.dirty();return}let i={prev:r,current:t,next:null,children:[],level:r?r.level+1:0};this.messages.set(t.id,i),this.performOp(r,i,`link`),this.head===r&&(this.head=i),this._messages.dirty()}getMessage(e){let t=this.messages.get(e);if(!t)throw Error(`MessageRepository(updateMessage): Message not found. This is likely an internal bug in assistant-ui.`);return{parentId:t.prev?.current.id??null,message:t.current,index:t.level}}deleteMessage(e,t){let n=this.messages.get(e);if(!n)throw Error(`MessageRepository(deleteMessage): Message not found. This is likely an internal bug in assistant-ui.`);let r=t===void 0?n.prev:t===null?null:this.messages.get(t);if(r===void 0)throw Error(`MessageRepository(deleteMessage): Replacement not found. This is likely an internal bug in assistant-ui.`);for(let e of n.children){let t=this.messages.get(e);if(!t)throw Error(`MessageRepository(deleteMessage): Child message not found. This is likely an internal bug in assistant-ui.`);this.performOp(r,t,`relink`)}this.performOp(null,n,`cut`),this.messages.delete(e),this.head===n&&(this.head=FO(r??this.root)),this._messages.dirty()}getBranches(e){let t=this.messages.get(e);if(!t)throw Error(`MessageRepository(getBranches): Message not found. This is likely an internal bug in assistant-ui.`);let{children:n}=t.prev??this.root;return n}evictOffBranchOptimisticMessages(e,t){if(!e)return;let n=new Set;for(let e=t;e;e=e.prev)n.add(e.current.id);let r=[];for(let t=e;t&&!n.has(t.current.id);t=t.prev)t.current.metadata?.isOptimistic&&r.push(t.current.id);for(let e of r)this.messages.has(e)&&this.deleteMessage(e)}switchToBranch(e){let t=this.messages.get(e);if(!t)throw Error(`MessageRepository(switchToBranch): Branch not found. This is likely an internal bug in assistant-ui.`);let n=this.head,r=t.prev??this.root;r.next=t,this.head=FO(t),this.evictOffBranchOptimisticMessages(n,this.head),this._messages.dirty()}resetHead(e){if(e===null){this.clear();return}let t=this.messages.get(e);if(!t)throw Error(`MessageRepository(resetHead): Branch not found. This is likely an internal bug in assistant-ui.`);let n=this.head;if(t.children.length>0){let e=t=>{for(let n of t.children){let t=this.messages.get(n);t&&(e(t),this.messages.delete(n))}};e(t),t.children=[],t.next=null}this.head=t;for(let e=t;e;e=e.prev)e.prev?e.prev.next=e:this.root.next=e;this.evictOffBranchOptimisticMessages(n,this.head),this._messages.dirty()}clear(){this.messages.clear(),this.head=null,this.root={children:[],next:null},this._messages.dirty()}export(){let e=[];for(let[,t]of this.messages)t.current.metadata?.isOptimistic||e.push({message:t.current,parentId:t.prev?.current.id??null});let t=this.head;for(;t?.current.metadata?.isOptimistic;)t=t.prev;return{headId:t?.current.id??null,messages:e}}import({headId:e,messages:t}){for(let{message:e,parentId:n}of t)this.addOrUpdateMessage(n,e);this.resetHead(e??t.at(-1)?.message.id??null)}},RO=Object.freeze([]);function zO(e,t){if(t===`*`)return!0;let n=t.split(`,`).map(e=>e.trim().toLowerCase()),r=`.${e.name.split(`.`).pop().toLowerCase()}`,i=e.type.toLowerCase();for(let e of n){if(e.startsWith(`.`)&&e===r||e.includes(`/`)&&e===i)return!0;if(e.endsWith(`/*`)){let t=e.split(`/`)[0];if(i.startsWith(`${t}/`))return!0}}return!1}function BO(e,t){return e.length===t.length?e.every((e,n)=>e.id===t[n].id):!1}function VO(e){let t=wO();return e.type===`image`?{id:t,type:`image`,name:e.filename??`image`,content:[e],status:{type:`complete`}}:e.type===`file`?{id:t,type:`document`,name:e.filename??`document`,contentType:e.mimeType,content:[e],status:{type:`complete`}}:e.type===`audio`?{id:t,type:`audio`,name:`audio.${e.audio.format}`,contentType:`audio/${e.audio.format}`,content:[e],status:{type:`complete`}}:{id:t,type:`data`,name:e.name,content:[e],status:{type:`complete`}}}function HO(e){let t=[];for(let n of e)n.type!==`text`&&t.push(VO(n));return t}var UO=e=>e.status.type===`complete`,WO=class extends jD{isEditing=!0;get attachmentAccept(){return this.getAttachmentAdapter()?.accept??`*`}_attachments=[];get attachments(){return this._attachments}setAttachments(e){this._attachments=e,this._notifySubscribers()}get isEmpty(){return!this.text.trim()&&!this.attachments.length}_text=``;get text(){return this._text}_role=`user`;get role(){return this._role}_runConfig={};get runConfig(){return this._runConfig}_quote=void 0;get quote(){return this._quote}setQuote(e){this._quote!==e&&(this._quote=e,this._notifySubscribers())}setText(e){if(this._text!==e){if(this._text=e,this._dictation){this._dictationBaseText=e,this._currentInterimText=``;let{status:t,inputDisabled:n}=this._dictation;this._dictation=n?{status:t,inputDisabled:n}:{status:t}}this._notifySubscribers()}}setRole(e){this._role!==e&&(this._role=e,this._notifySubscribers())}setRunConfig(e){this._runConfig!==e&&(this._runConfig=e,this._notifySubscribers())}_emptyTextAndAttachments(){this._attachments=[],this._text=``,this._notifySubscribers()}async _onClearAttachments(){let e=this.getAttachmentAdapter();if(e){let t=this._attachments.filter(e=>!UO(e));await Promise.all(t.map(t=>e.remove(t)))}}async reset(){if(this._attachments.length===0&&this._text===``&&this._role===`user`&&Object.keys(this._runConfig).length===0&&this._quote===void 0)return;this._role=`user`,this._runConfig={},this._quote=void 0;let e=this._onClearAttachments();this._emptyTextAndAttachments(),await e}async clearAttachments(){let e=this._onClearAttachments();this.setAttachments([]),await e}async send(e){if(!this.canSend)return;this._dictationSession&&(this._dictationSession.cancel(),this._cleanupDictation());let t=this.getAttachmentAdapter(),n=this.attachments.length>0?Promise.all(this.attachments.map(async e=>{if(UO(e))return e;if(!t)throw Error(`Attachments are not supported`);return await t.send(e)})):[],r=this.text,i=this._quote;this._quote=void 0,this._emptyTextAndAttachments();let a={createdAt:new Date,role:this.role,content:r?[{type:`text`,text:r}]:[],attachments:await n,runConfig:this.runConfig,metadata:{custom:{...i?{quote:i}:{}}}};this.handleSend(a,e),this._notifyEventSubscribers(`send`,{})}cancel(){this.handleCancel()}get queue(){return RO}steerQueueItem(e){}removeQueueItem(e){}async addAttachment(e){if(!(e instanceof File)){let t=this.getAttachmentAdapter();if(t&&!zO({name:e.name,type:e.contentType??``},t.accept)){let n=`File type ${e.contentType||`unknown`} is not accepted. Accepted types: ${t.accept}`,r=Error(n);throw this._safeEmitAttachmentAddError(`not-accepted`,n,void 0,r),r}let n={id:e.id??wO(),type:e.type??`document`,name:e.name,contentType:e.contentType,content:e.content,status:{type:`complete`}};this._attachments=[...this._attachments,n],this._notifySubscribers(),this._notifyEventSubscribers(`attachmentAdd`,{});return}let t=e=>{let t=this._attachments.findIndex(t=>t.id===e.id);t===-1?this._attachments=[...this._attachments,e]:this._attachments=[...this._attachments.slice(0,t),e,...this._attachments.slice(t+1)],this._notifySubscribers()},n=this.getAttachmentAdapter();if(!n){let e=`Attachments are not supported`,t=Error(e);throw this._safeEmitAttachmentAddError(`no-adapter`,e,void 0,t),t}if(!zO({name:e.name,type:e.type},n.accept)){let t=`File type ${e.type||`unknown`} is not accepted. Accepted types: ${n.accept}`,r=Error(t);throw this._safeEmitAttachmentAddError(`not-accepted`,t,void 0,r),r}let r;try{let i=n.add({file:e});if(Symbol.asyncIterator in i)for await(let e of i)r=e,t(e);else r=await i,t(r)}catch(e){throw r&&t({...r,status:{type:`incomplete`,reason:`error`}}),this._safeEmitAttachmentAddError(`adapter-error`,e instanceof Error?e.message:String(e),r?.id,e instanceof Error?e:void 0),e}r?.status.type===`incomplete`&&r.status.reason===`error`?this._safeEmitAttachmentAddError(`adapter-error`,`Attachment upload did not complete successfully.`,r?.id):this._notifyEventSubscribers(`attachmentAdd`,{})}_safeEmitAttachmentAddError(e,t,n,r){try{this._notifyEventSubscribers(`attachmentAddError`,{reason:e,message:t,...n!==void 0&&{attachmentId:n},...r!==void 0&&{error:r}})}catch(e){console.error(`[assistant-ui] attachmentAddError subscriber threw:`,e)}}async removeAttachment(e){let t=this._attachments.findIndex(t=>t.id===e);if(t===-1)throw Error(`Attachment not found`);let n=this._attachments[t];if(!UO(n)){let e=this.getAttachmentAdapter();if(!e)throw Error(`Attachments are not supported`);await e.remove(n)}this._attachments=this._attachments.filter(t=>t.id!==e),this._notifySubscribers()}_dictation;_dictationSession;_dictationUnsubscribes=[];_dictationBaseText=``;_currentInterimText=``;_dictationSessionIdCounter=0;_activeDictationSessionId;_isCleaningDictation=!1;get dictation(){return this._dictation}_isActiveSession(e,t){return this._activeDictationSessionId===e&&this._dictationSession===t}startDictation(){let e=this.getDictationAdapter();if(!e)throw Error(`Dictation adapter not configured`);if(this._dictationSession){for(let e of this._dictationUnsubscribes)e();this._dictationUnsubscribes=[],this._dictationSession.stop().catch(()=>{}),this._dictationSession=void 0}let t=e.disableInputDuringDictation??!1;this._dictationBaseText=this._text,this._currentInterimText=``;let n=e.listen();this._dictationSession=n;let r=++this._dictationSessionIdCounter;this._activeDictationSessionId=r,this._dictation={status:n.status,inputDisabled:t},this._notifySubscribers();let i=n.onSpeech(e=>{if(!this._isActiveSession(r,n))return;let t=e.isFinal!==!1,i=this._dictationBaseText&&!this._dictationBaseText.endsWith(` `)&&e.transcript?` `:``;if(t){if(this._dictationBaseText=this._dictationBaseText+i+e.transcript,this._currentInterimText=``,this._text=this._dictationBaseText,this._dictation){let{transcript:e,...t}=this._dictation;this._dictation=t}this._notifySubscribers()}else this._currentInterimText=i+e.transcript,this._text=this._dictationBaseText+this._currentInterimText,this._dictation&&={...this._dictation,transcript:e.transcript},this._notifySubscribers()});this._dictationUnsubscribes.push(i);let a=n.onSpeechStart(()=>{this._isActiveSession(r,n)&&(this._dictation={status:{type:`running`},inputDisabled:t,...this._dictation?.transcript&&{transcript:this._dictation.transcript}},this._notifySubscribers())});this._dictationUnsubscribes.push(a);let o=n.onSpeechEnd(()=>{this._cleanupDictation({sessionId:r})});this._dictationUnsubscribes.push(o);let s=setInterval(()=>{this._isActiveSession(r,n)&&n.status.type===`ended`&&this._cleanupDictation({sessionId:r})},100);this._dictationUnsubscribes.push(()=>clearInterval(s))}stopDictation(){if(!this._dictationSession)return;let e=this._dictationSession,t=this._activeDictationSessionId;e.stop().finally(()=>{this._cleanupDictation({sessionId:t})})}_cleanupDictation(e){if(!(e?.sessionId!==void 0&&e.sessionId!==this._activeDictationSessionId||this._isCleaningDictation)){this._isCleaningDictation=!0;try{for(let e of this._dictationUnsubscribes)e();this._dictationUnsubscribes=[],this._dictationSession=void 0,this._activeDictationSessionId=void 0,this._dictation=void 0,this._dictationBaseText=``,this._currentInterimText=``,this._notifySubscribers()}finally{this._isCleaningDictation=!1}}}_eventSubscribers=new Map;_notifyEventSubscribers(e,t){let n=this._eventSubscribers.get(e);if(n)for(let e of n)e(t)}unstable_on(e,t){let n=t,r=this._eventSubscribers.get(e);return r||(r=new Set,this._eventSubscribers.set(e,r)),r.add(n),()=>{this._eventSubscribers.get(e)?.delete(n)}}},GO=class extends WO{runtime;_canCancel=!1;get canCancel(){return this._canCancel}get canSend(){return!this.isEmpty&&!this.runtime.isSendDisabled}get queue(){return this.runtime.getQueueItems?.()??RO}steerQueueItem(e){this.runtime.steerQueueItem?.(e)}removeQueueItem(e){this.runtime.removeQueueItem?.(e)}getAttachmentAdapter(){return this.runtime.adapters?.attachments}getDictationAdapter(){return this.runtime.adapters?.dictation}constructor(e){super(),this.runtime=e,this.connect()}connect(){let e=this.runtime.isSendDisabled,t=this.queue;return this.runtime.subscribe(()=>{let n=!1;this.canCancel!==this.runtime.capabilities.cancel&&(this._canCancel=this.runtime.capabilities.cancel,n=!0),e!==this.runtime.isSendDisabled&&(e=this.runtime.isSendDisabled,n=!0),t!==this.queue&&(t=this.queue,n=!0),n&&this._notifySubscribers()})}async handleSend(e,t){this.runtime.append({...e,parentId:this.runtime.messages.at(-1)?.id??null,sourceId:null,startRun:t?.startRun,steer:t?.steer})}async handleCancel(){this.runtime.cancelRun()}},KO=class extends WO{runtime;endEditCallback;get canCancel(){return!0}get canSend(){return!this.isEmpty}getAttachmentAdapter(){return this.runtime.adapters?.attachments}getDictationAdapter(){return this.runtime.adapters?.dictation}_previousText;_previousAttachments;_nonTextPassthrough;_parentId;_sourceId;constructor(e,t,{parentId:n,message:r}){super(),this.runtime=e,this.endEditCallback=t,this._parentId=n,this._sourceId=r.id,this._previousText=YD(r),this.setText(this._previousText),this.setRole(r.role),r.role===`user`?(this._previousAttachments=[...r.attachments??[],...HO(r.content)],this._nonTextPassthrough=[]):(this._previousAttachments=r.attachments??[],this._nonTextPassthrough=r.content.filter(e=>e.type!==`text`)),this.setAttachments(this._previousAttachments),this.setRunConfig({...e.composer.runConfig})}get parentId(){return this._parentId}get sourceId(){return this._sourceId}async handleSend(e,t){let n=YD(e),r=!BO(e.attachments??[],this._previousAttachments);if(n!==this._previousText||r||t?.startRun){let n=this._nonTextPassthrough.length>0?[...e.content,...this._nonTextPassthrough]:e.content;this.runtime.append({...e,content:n,parentId:this._parentId,sourceId:this._sourceId,startRun:t?.startRun})}this.handleCancel()}handleCancel(){this.endEditCallback(),this._notifySubscribers()}},qO=class{_contextProvider;_subscriptions=new Set;_isInitialized=!1;repository=new LO;_voiceMessages=[];_voiceGeneration=0;_cachedMergedMessages=null;_cachedVoiceGeneration=-1;_cachedMergedBase=null;_markVoiceMessagesDirty(){this._voiceGeneration++,this._cachedMergedMessages=null}_getBaseMessages(){return this.repository.getMessages()}get messages(){if(this._voiceMessages.length===0)return this._getBaseMessages();let e=this._getBaseMessages();return(this._cachedVoiceGeneration!==this._voiceGeneration||this._cachedMergedBase!==e)&&(this._cachedMergedMessages=[...e,...this._voiceMessages],this._cachedVoiceGeneration=this._voiceGeneration,this._cachedMergedBase=e),this._cachedMergedMessages}get state(){let e;for(let t of this.messages)t.role===`assistant`&&(e=t);return e?.metadata.unstable_state??null}composer=new GO(this);constructor(e){this._contextProvider=e}getModelContext(){return this._contextProvider.getModelContext()}_editComposers=new Map;getEditComposer(e){return this._editComposers.get(e)}beginEdit(e){if(this._editComposers.has(e))throw Error(`Edit already in progress`);this._editComposers.set(e,new KO(this,()=>this._editComposers.delete(e),this.repository.getMessage(e))),this._notifySubscribers()}getMessageById(e){try{return this.repository.getMessage(e)}catch{let t=this.repository.getMessages(),n=this._voiceMessages.findIndex(t=>t.id===e);return n===-1?void 0:{parentId:n>0?this._voiceMessages[n-1].id:t.at(-1)?.id??null,message:this._voiceMessages[n],index:t.length+n}}}getBranches(e){return this._voiceMessages.some(t=>t.id===e)?[]:this.repository.getBranches(e)}switchToBranch(e){this.repository.switchToBranch(e),this._notifySubscribers()}_notifySubscribers(){for(let e of this._subscriptions)e()}_notifyEventSubscribers(e,t){let n=this._eventSubscribers.get(e);if(n)for(let e of n)e(t)}subscribe(e){return this._subscriptions.add(e),()=>this._subscriptions.delete(e)}submitFeedback({messageId:e,type:t}){let n=this.adapters?.feedback;if(!n)throw Error(`Feedback adapter not configured`);let{message:r,parentId:i}=this.repository.getMessage(e);if(n.submit({message:r,type:t}),r.role===`assistant`){let e={...r,metadata:{...r.metadata,submittedFeedback:{type:t}}};this.repository.addOrUpdateMessage(i,e)}this._notifySubscribers()}_stopSpeaking;speech;speak(e){let t=this.adapters?.speech;if(!t)throw Error(`Speech adapter not configured`);let{message:n}=this.repository.getMessage(e);this._stopSpeaking?.();let r=t.speak(YD(n)),i=r.subscribe(()=>{r.status.type===`ended`?(this._stopSpeaking=void 0,this.speech=void 0):this.speech={messageId:e,status:r.status},this._notifySubscribers()});this.speech={messageId:e,status:r.status},this._notifySubscribers(),this._stopSpeaking=()=>{r.cancel(),i(),this.speech=void 0,this._stopSpeaking=void 0}}stopSpeaking(){if(!this._stopSpeaking)throw Error(`No message is being spoken`);this._stopSpeaking(),this._notifySubscribers()}_voiceSession;_voiceUnsubs=[];voice;_voiceVolume=0;_voiceVolumeSubscribers=new Set;getVoiceVolume=()=>this._voiceVolume;subscribeVoiceVolume=e=>(this._voiceVolumeSubscribers.add(e),()=>this._voiceVolumeSubscribers.delete(e));connectVoice(){let e=this.adapters?.voice;if(!e)throw Error(`Voice adapter not configured`);this.disconnectVoice();let t=e.connect({});this._voiceSession=t;let n=[],r=`listening`;this.voice={status:t.status,isMuted:t.isMuted,mode:r},this._voiceVolume=0,this._notifySubscribers(),n.push(t.onStatusChange(e=>{e.type===`ended`?(this._finishVoiceAssistantMessage(),this._voiceSession=void 0,this.voice=void 0):this.voice={status:e,isMuted:t.isMuted,mode:r},this._notifySubscribers()})),n.push(t.onModeChange(e=>{r=e,this.voice&&(this.voice={...this.voice,mode:e},this._notifySubscribers())})),n.push(t.onVolumeChange(e=>{this._voiceVolume=e;for(let e of this._voiceVolumeSubscribers)e()})),n.push(t.onTranscript(e=>{this._handleVoiceTranscript(e)})),this._voiceUnsubs=n}_currentAssistantMsg=null;_handleVoiceTranscript(e){if(this.ensureInitialized(),e.role===`user`)this._finishVoiceAssistantMessage(),this._currentAssistantMsg=null,e.isFinal&&(this._voiceMessages.push({id:wO(),role:`user`,content:[{type:`text`,text:e.text}],metadata:{custom:{}},createdAt:new Date,status:{type:`complete`,reason:`unknown`},attachments:[]}),this._markVoiceMessagesDirty(),this._notifySubscribers());else{if(!this._currentAssistantMsg)this._currentAssistantMsg={id:wO(),role:`assistant`,content:[{type:`text`,text:e.text}],metadata:{unstable_state:this.state,unstable_annotations:[],unstable_data:[],steps:[],custom:{}},status:{type:`running`},createdAt:new Date},this._voiceMessages.push(this._currentAssistantMsg);else{let t=this._voiceMessages.indexOf(this._currentAssistantMsg);if(t===-1)return;let n={...this._currentAssistantMsg,content:[{type:`text`,text:e.text}],...e.isFinal?{status:{type:`complete`,reason:`stop`}}:{}};this._voiceMessages[t]=n,this._currentAssistantMsg=n}e.isFinal&&(this._currentAssistantMsg=null),this._markVoiceMessagesDirty(),this._notifySubscribers()}}_finishVoiceAssistantMessage(){let e=this._voiceMessages.at(-1);if(e?.role===`assistant`&&e.status.type===`running`){let t=this._voiceMessages.length-1;this._voiceMessages[t]={...e,status:{type:`complete`,reason:`stop`}},this._markVoiceMessagesDirty(),this._notifySubscribers()}}disconnectVoice(){this._finishVoiceAssistantMessage(),this._currentAssistantMsg=null;for(let e of this._voiceUnsubs)e();this._voiceUnsubs=[],this._voiceSession?.disconnect(),this._voiceSession=void 0,this.voice=void 0,this._voiceVolume=0;for(let e of this._voiceVolumeSubscribers)e();this._voiceMessages=[],this._markVoiceMessagesDirty(),this._notifySubscribers()}muteVoice(){if(!this._voiceSession)throw Error(`No active voice session`);this._voiceSession.mute(),this.voice={...this.voice,isMuted:!0},this._notifySubscribers()}unmuteVoice(){if(!this._voiceSession)throw Error(`No active voice session`);this._voiceSession.unmute(),this.voice={...this.voice,isMuted:!1},this._notifySubscribers()}ensureInitialized(){this._isInitialized||(this._isInitialized=!0,this._notifyEventSubscribers(`initialize`,{}))}export(){return this.repository.export()}import(e){this.ensureInitialized(),this.repository.clear(),this.repository.import(e),this._notifySubscribers()}reset(e){this.import(PO.fromArray(e??[]))}_eventSubscribers=new Map;unstable_on(e,t){let n=t;if(e===`modelContextUpdate`)return this._contextProvider.subscribe?.(()=>n({}))??(()=>{});let r=this._eventSubscribers.get(e);return r||(r=new Set,this._eventSubscribers.set(e,r)),r.add(n),e===`initialize`&&this._isInitialized&&queueMicrotask(()=>{r.has(n)&&n({})}),()=>{this._eventSubscribers.get(e)?.delete(n)}}},JO=class{cache=new WeakMap;convertMessages(e,t){return e.map((e,n)=>{let r=t(this.cache.get(e),e,n);return this.cache.set(e,r),r})}};function YO(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function XO(e,t=0){return t>100?!1:e===null||typeof e==`string`||typeof e==`boolean`?!0:typeof e==`number`?!Number.isNaN(e)&&Number.isFinite(e):Array.isArray(e)?e.every(e=>XO(e,t+1)):YO(e)?Object.entries(e).every(([e,n])=>typeof e==`string`&&XO(n,t+1)):!1}var ZO=100,QO=(e,t,n)=>{if(e===t)return!0;if(n>ZO||e==null||t==null)return!1;if(Array.isArray(e))return!Array.isArray(t)||e.length!==t.length?!1:e.every((e,r)=>QO(e,t[r],n+1));if(Array.isArray(t)||!YO(e)||!YO(t))return!1;let r=Object.keys(e),i=Object.keys(t);return r.length===i.length?r.every(r=>Object.hasOwn(t,r)&&QO(e[r],t[r],n+1)):!1},$O=(e,t)=>!XO(e)||!XO(t)?!1:QO(e,t,0),ek=e=>{try{return JSON.parse(e),!0}catch{return!1}},tk=e=>{try{return JSON.parse(e)}catch{return}},nk=(e,t)=>{let n=tk(e),r=tk(t);return n===void 0||r===void 0?!1:$O(n,r)},rk=class{_getTools;_callbacks;_entries=new Map;_skipExecuteStreamIds=new Set;_humanInput=new Map;_executing=new Set;_settledResolvers=[];_statuses=new Map;_ac=new AbortController;_pendingRestore=!0;_lastSnapshot=null;_isRunning=!1;_controller;_pipelineDead=!1;_pipelineRestartUsed=!1;constructor(e,t){this._getTools=e,this._callbacks=t,this._initPipeline()}_initPipeline(){let[e,t]=Lle();this._controller=t;let n=cD(()=>this._getWrappedTools(),()=>this._ac.signal,(e,t)=>this._onHumanInput(e,t),{onExecutionStart:e=>this._onExecutionStart(e),onExecutionEnd:e=>this._onExecutionEnd(e)});e.pipeThrough(n).pipeThrough(new HE).pipeTo(new WritableStream({write:e=>{try{if(e.type!==`result`)return;this._handleResultChunk(e)}catch(e){console.error(`[ToolInvocationTracker] result chunk handling failed`,e)}}})).catch(e=>{console.error(`[ToolInvocationTracker] stream pipeline failed; will attempt single restart on next setState`,e),this._pipelineDead=!0})}setState(e){try{if(this._pipelineDead){if(this._pipelineRestartUsed)return;this._pipelineRestartUsed=!0,this._pipelineDead=!1,this._demoteEntriesToRestored(),this._executing.clear(),this._ac=new AbortController,this._initPipeline()}if(this._lastSnapshot&&this._lastSnapshot.messages===e.messages&&this._lastSnapshot.isRunning===e.isRunning&&this._lastSnapshot.isLoading===e.isLoading)return;e.isLoading===!0&&(this._pendingRestore=!0);let t=this._isRunning;this._isRunning=e.isRunning;try{this._processMessages(e.messages)}catch(e){throw this._isRunning=t,e}this._lastSnapshot=e,this._pendingRestore=!1}catch(e){console.error(`[ToolInvocationTracker] setState failed; snapshot dropped`,e)}}reset(){try{this._pendingRestore=!0,this._entries.clear(),this._lastSnapshot=null,this.abort().finally(()=>{this._executing.clear()})}catch(e){console.error(`[ToolInvocationTracker] reset failed`,e)}}abort(){try{return this._humanInput.forEach(({reject:e})=>{try{e(Error(`Tool execution aborted`))}catch{}}),this._humanInput.clear(),this._ac.abort(),this._ac=new AbortController,this._executing.size===0?Promise.resolve():new Promise(e=>{this._settledResolvers.push(e)})}catch(e){return console.error(`[ToolInvocationTracker] abort failed`,e),Promise.resolve()}}resume(e,t){try{let n=this._humanInput.get(e);return n?(this._humanInput.delete(e),this._setStatus(e,{type:`executing`}),n.resolve(t),!0):!1}catch(e){return console.error(`[ToolInvocationTracker] resume failed`,e),!1}}getStatuses(){return this._statuses}_getWrappedTools(){let e=this._getTools();if(e)return Object.fromEntries(Object.entries(e).map(([e,t])=>{let n=t.execute;return n===void 0?[e,t]:[e,{...t,execute:(...[e,t])=>this._skipExecuteStreamIds.has(t.toolCallId)?new Promise(()=>{}):n(e,t)}]}))}_onHumanInput(e,t){return new Promise((n,r)=>{let i=this._humanInput.get(e);if(i)try{i.reject(Error(`Human input request was superseded by a new request`))}catch{}this._humanInput.set(e,{resolve:n,reject:r}),this._setStatus(e,{type:`interrupt`,payload:{type:`human`,payload:t}})})}_onExecutionStart(e){this._skipExecuteStreamIds.has(e)||(this._executing.add(e),this._setStatus(e,{type:`executing`}))}_onExecutionEnd(e){this._executing.delete(e)&&(this._deleteStatus(e),this._executing.size===0&&this._settledResolvers.splice(0).forEach(e=>{try{e()}catch{}}))}_handleResultChunk(e){let t=e.meta.toolCallId,n=this._entries.get(t);!n&&this._skipExecuteStreamIds.has(t)||n?.hasResult||this._invokeOnResult({type:`add-tool-result`,toolCallId:t,toolName:e.meta.toolName,result:e.result,isError:e.isError,...e.artifact!==void 0&&{artifact:e.artifact},...e.modelContent!==void 0&&{modelContent:e.modelContent}})}_invokeOnResult(e){try{this._callbacks.onResult(e)}catch(e){console.error(`[ToolInvocationTracker] onResult callback threw; result dropped`,e)}}_invokeOnStatusesChange(){try{this._callbacks.onStatusesChange(this._statuses)}catch(e){console.error(`[ToolInvocationTracker] onStatusesChange callback threw; status change not propagated`,e)}}_setStatus(e,t){let n=new Map(this._statuses);n.set(e,t),this._statuses=n,this._invokeOnStatusesChange()}_deleteStatus(e){if(!this._statuses.has(e))return;let t=new Map(this._statuses);t.delete(e),this._statuses=t,this._invokeOnStatusesChange()}_hasExecutableTool(e){let t=this._getTools()?.[e];return t?.execute!==void 0||t?.streamCall!==void 0}_shouldCloseArgsStream({toolName:e,argsText:t,hasResult:n}){return n?!0:(this._hasExecutableTool(e)||!this._isRunning)&&ek(t)}_startActiveEntry(e,t,n){let r=this._controller.addToolCallPart({toolName:t,toolCallId:e});n&&this._skipExecuteStreamIds.add(e);let i={toolName:t,controller:r,argsText:``,hasResult:!1,argsComplete:!1};return this._entries.set(e,i),i}_demoteEntriesToRestored(){for(let[e,t]of this._entries)t.controller&&this._entries.set(e,{toolName:t.toolName,argsText:t.argsText,hasResult:t.hasResult})}_processArgsText(e,t){if(!e.controller)return;let n=t.result!==void 0;if(t.argsText!==e.argsText){let r=!0;if(e.argsComplete)nk(e.argsText,t.argsText)&&(e.argsText=t.argsText),r=!1;else if(!t.argsText.startsWith(e.argsText))if(ek(e.argsText)&&ek(t.argsText)&&nk(e.argsText,t.argsText)){let i=this._shouldCloseArgsStream({toolName:t.toolName,argsText:t.argsText,hasResult:n});i&&e.controller.argsText.close(),e.argsText=t.argsText,e.argsComplete=i,r=!1}else r=!1;if(r&&e.controller){let r=t.argsText.slice(e.argsText.length);e.controller.argsText.append(r);let i=this._shouldCloseArgsStream({toolName:t.toolName,argsText:t.argsText,hasResult:n});i&&e.controller.argsText.close(),e.argsText=t.argsText,e.argsComplete=i}}!e.argsComplete&&e.controller&&this._shouldCloseArgsStream({toolName:t.toolName,argsText:t.argsText,hasResult:n})&&(e.controller.argsText.close(),e.argsText=t.argsText,e.argsComplete=!0)}_processMessages(e){let t=this._pendingRestore;for(let n of e)if(!(!n||!Array.isArray(n.content)))for(let e of n.content){if(!e||e.type!==`tool-call`)continue;let n=this._entries.get(e.toolCallId);if(t){n?.controller||this._entries.set(e.toolCallId,{toolName:e.toolName,argsText:e.argsText,hasResult:e.result!==void 0}),e.messages&&this._processMessages(e.messages);continue}let r=n;if(r&&!r.controller){if(!(e.argsText!==r.argsText||e.result!==void 0!==r.hasResult)){e.messages&&this._processMessages(e.messages);continue}this._entries.delete(e.toolCallId),r=void 0}if(r||=this._startActiveEntry(e.toolCallId,e.toolName,e.result!==void 0),this._processArgsText(r,e),e.result!==void 0&&!r.hasResult){let{controller:t}=r;if(!t)continue;r.hasResult=!0,r.argsComplete=!0,t.setResponse(new ZE({result:e.result,artifact:e.artifact,isError:e.isError,...e.modelContent===void 0?{}:{modelContent:e.modelContent}})),t.close()}e.messages&&this._processMessages(e.messages)}}},ik=Object.freeze([]),ak=(e,t)=>{let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0},ok=(e,t)=>e&&t[t.length-1]?.role!==`assistant`,sk=class extends qO{_capabilities={switchToBranch:!1,switchBranchDuringRun:!1,edit:!1,delete:!1,reload:!1,cancel:!1,unstable_copy:!1,speech:!1,dictation:!1,voice:!1,attachments:!1,feedback:!1,queue:!1};get capabilities(){return this._capabilities}_messages;isDisabled;isSendDisabled;get isLoading(){return this._store.isLoading??!1}get isRunning(){return this._store.isRunning}_getBaseMessages(){return this._messages}get state(){return this._store.state??super.state}get adapters(){return this._store.adapters}suggestions=[];extras=void 0;_converter=new JO;_store;_toolInvocations=null;beginEdit(e){if(!this._store.onEdit)throw Error(`Runtime does not support editing.`);super.beginEdit(e)}constructor(e,t){super(e),this.__internal_setAdapter(t)}__internal_setAdapter(e){if(this._store===e)return;let t=e.isRunning??!1;this.isDisabled=e.isDisabled??!1,this.isSendDisabled=e.isSendDisabled??!1;let n=this._store;this._store=e,this.extras!==e.extras&&(this.extras=e.extras);let r=e.suggestions??ik;ak(this.suggestions,r)||(this.suggestions=r);let i={switchToBranch:this._store.setMessages!==void 0,switchBranchDuringRun:!1,edit:this._store.onEdit!==void 0,delete:this._store.onDelete!==void 0||this._store.setMessages!==void 0,reload:this._store.onReload!==void 0,cancel:this._store.onCancel!==void 0,speech:this._store.adapters?.speech!==void 0,dictation:this._store.adapters?.dictation!==void 0,voice:this._store.adapters?.voice!==void 0,unstable_copy:this._store.unstable_capabilities?.copy!==!1,attachments:!!this._store.adapters?.attachments,feedback:!!this._store.adapters?.feedback,queue:this._store.queue!==void 0};ak(this._capabilities,i)||(this._capabilities=i);let a;if(e.messageRepository){if(n&&n.isRunning===e.isRunning&&n.messageRepository===e.messageRepository){this._notifySubscribers();return}let t=e.messageRepository.messages,r=e.messageRepository.headId??t.at(-1)?.message.id??null;if(n&&n.messageRepository===e.messageRepository)this.repository.resetHead(r),a=this.repository.getMessages();else{let e=new Set(t.map(({message:e})=>e.id));for(let{message:e,parentId:n}of t)this.repository.addOrUpdateMessage(n,e);for(let{message:t}of this.repository.export().messages)e.has(t.id)||this.repository.deleteMessage(t.id);this.repository.resetHead(r),a=this.repository.getMessages()}}else if(e.messages){if(n){if(n.convertMessage!==e.convertMessage)this._converter=new JO;else if(n.isRunning===e.isRunning&&n.messages===e.messages){this._notifySubscribers();return}}a=e.convertMessage?this._converter.convertMessages(e.messages,(n,r,i)=>{if(!e.convertMessage)return r;let a=NO(i===(e.messages?.length??0)-1,t,!1,!1,void 0);if(n&&(n.role!==`assistant`||!MO(n.status)||n.status===a))return n;let o=EO(e.convertMessage(r,i),i.toString(),a);return DD(o,r),o}):e.messages;for(let e=0;e<a.length;e++){let t=a[e],n=a[e-1];this.repository.addOrUpdateMessage(n?.id??null,t)}}else throw Error(`ExternalStoreAdapter must provide either 'messages' or 'messageRepository'`);a.length>0&&this.ensureInitialized(),(n?.isRunning??!1)!==(e.isRunning??!1)&&(e.isRunning?this._notifyEventSubscribers(`runStart`,{}):this._notifyEventSubscribers(`runEnd`,{}));let o=null;ok(t,a)&&(o=wO(),this.repository.addOrUpdateMessage(a.at(-1)?.id??null,EO({role:`assistant`,content:[],metadata:{isOptimistic:!0}},o,{type:`running`}))),this.repository.resetHead(o??a.at(-1)?.id??null),this._messages=this.repository.getMessages(),this._driveToolInvocations(),this._notifySubscribers()}_driveToolInvocations(){if(!this._store.unstable_enableToolInvocations){this._toolInvocations&&(this._toolInvocations.reset(),this._toolInvocations=null,this._store.setToolStatuses?.({}));return}this._toolInvocations||=new rk(()=>this.getModelContext().tools,{onResult:e=>{try{let t=this._findMessageIdForToolCall(e.toolCallId);if(t===void 0)return;this._store.onAddToolResult?.({messageId:t,toolCallId:e.toolCallId,toolName:e.toolName,result:e.result,isError:e.isError,...e.artifact!==void 0&&{artifact:e.artifact},...e.modelContent!==void 0&&{modelContent:e.modelContent}})}catch(e){console.error(`[ExternalStoreThreadRuntimeCore] onAddToolResult dispatch failed`,e)}},onStatusesChange:e=>{this._store.setToolStatuses?.(Object.fromEntries(e))}}),this._toolInvocations.setState({messages:this._messages,isRunning:this._store.isRunning??!1,...this._store.isLoading!==void 0&&{isLoading:this._store.isLoading}})}_toolCallToMessageId=new Map;_messagesForToolCallIndex=null;_findMessageIdForToolCall(e){if(this._messagesForToolCallIndex!==this._messages){this._toolCallToMessageId.clear();let e=t=>{for(let n of t)if(Array.isArray(n.content))for(let t of n.content)!t||t.type!==`tool-call`||(this._toolCallToMessageId.set(t.toolCallId,n.id),t.messages&&e(t.messages))};e(this._messages),this._messagesForToolCallIndex=this._messages}return this._toolCallToMessageId.get(e)}switchToBranch(e){if(!this._store.setMessages)throw Error(`Runtime does not support switching branches.`);this._store.isRunning||(this.repository.switchToBranch(e),this.updateMessages(this.repository.getMessages()))}async append(e){let t=e.parentId!==(this.messages.at(-1)?.id??null);if(!t&&this._store.queue){this._store.queue.enqueue(e,{steer:e.steer??!1});return}if((e.startRun??e.role===`user`)&&await this._toolInvocations?.abort(),t){if(!this._store.onEdit)throw Error(`Runtime does not support editing messages.`);this._store.queue?.clear(`edit`),await this._store.onEdit(e)}else await this._store.onNew(e)}async deleteMessage(e){if(this._store.onDelete){await this._store.onDelete(e);return}if(!this._store.setMessages)throw Error(`Runtime does not support deleting messages.`);this._store.isRunning&&await this._toolInvocations?.abort();let t=this.repository.getMessages();if(t.findIndex(t=>t.id===e)===-1)throw Error(`Message not found.`);this.updateMessages(t.filter(t=>t.id!==e))}getQueueItems(){return this._store?.queue?.items??RO}steerQueueItem(e){this._store?.queue?.steer(e)}removeQueueItem(e){this._store?.queue?.remove(e)}async startRun(e){if(!this._store.onReload)throw Error(`Runtime does not support reloading messages.`);this._store.queue?.clear(`reload`),await this._toolInvocations?.abort(),await this._store.onReload(e.parentId,e)}async resumeRun(e){if(!this._store.onResume)throw Error(`Runtime does not support resuming runs.`);await this._store.onResume(e)}exportExternalState(){if(!this._store.onExportExternalState)throw Error(`Runtime does not support exporting external states.`);return this._store.onExportExternalState()}importExternalState(e){if(!this._store.onLoadExternalState)throw Error(`Runtime does not support importing external states.`);this._toolInvocations&&(this._toolInvocations.reset(),this._store.setToolStatuses?.({})),this._store.onLoadExternalState(e)}cancelRun(){if(!this._store.onCancel)throw Error(`Runtime does not support cancelling runs.`);this._store.queue?.clear(`cancel-run`),this._toolInvocations?.abort(),this._store.onCancel();let e=this.repository.getMessages().at(-1);e&&e.metadata.isOptimistic&&e.content.length===0&&this.repository.deleteMessage(e.id);let t=this.repository.getMessages(),n=t[t.length-1];n?.role===`user`&&n.id===t.at(-1)?.id?(this.repository.deleteMessage(n.id),this.composer.text.trim()||this.composer.setText(YD(n)),t=this.repository.getMessages()):this._notifySubscribers(),setTimeout(()=>{this.updateMessages(t)},0)}addToolResult(e){if(!this._store.onAddToolResult)throw Error(`Runtime does not support tool results.`);this._store.onAddToolResult?.(e)}resumeToolCall(e){if(!(this._toolInvocations?.resume(e.toolCallId,e.payload)??!1)){if(this._store.onResumeToolCall){this._store.onResumeToolCall(e);return}throw Error(`Tool call ${e.toolCallId} is not waiting for resume.`)}}respondToToolApproval(e){if(!this._store.onRespondToToolApproval)throw Error(`Runtime does not support tool approvals.`);this._store.onRespondToToolApproval(e)}reset(e){let t=new LO;t.import(PO.fromArray(e??[])),this.updateMessages(t.getMessages())}import(e){super.import(e),this._store.onImport&&this._store.onImport(this.repository.getMessages())}updateMessages=e=>{this._store.convertMessage===void 0?this._store.setMessages?.(e):this._store.setMessages?.(e.flatMap(OD))}},ck=e=>e.adapters?.threadList??{},lk=class extends gO{threads;constructor(e){super(),this.threads=new CO(ck(e),()=>new sk(this._contextProvider,e))}setAdapter(e){this.threads.__internal_setAdapter(ck(e)),this.threads.getMainThreadRuntimeCore().__internal_setAdapter(e)}},uk=e=>{let t=V(11),n;t[0]===e?n=t[1]:(n=()=>new lk(e),t[0]=e,t[1]=n);let[r]=uT(n),i;t[2]!==r||t[3]!==e?(i=()=>{r.setAdapter(e)},t[2]=r,t[3]=e,t[4]=i):i=t[4],hT(i);let{modelContext:a}=lO()??{},o,s;t[5]!==a||t[6]!==r?(o=()=>{if(a)return r.registerModelContextProvider(a)},s=[a,r],t[5]=a,t[6]=r,t[7]=o,t[8]=s):(o=t[7],s=t[8]),hT(o,s);let c;return t[9]===r?c=t[10]:(c=new hO(r),t[9]=r,t[10]=c),c},dk=(e,t)=>e.Message===t.Message&&e.EditComposer===t.EditComposer&&e.UserEditComposer===t.UserEditComposer&&e.AssistantEditComposer===t.AssistantEditComposer&&e.SystemEditComposer===t.SystemEditComposer&&e.UserMessage===t.UserMessage&&e.AssistantMessage===t.AssistantMessage&&e.SystemMessage===t.SystemMessage,fk=()=>null,pk=(e,t,n)=>{switch(t){case`user`:return n?e.UserEditComposer??e.EditComposer??e.UserMessage??e.Message:e.UserMessage??e.Message;case`assistant`:return n?e.AssistantEditComposer??e.EditComposer??e.AssistantMessage??e.Message:e.AssistantMessage??e.Message;case`system`:return n?e.SystemEditComposer??e.EditComposer??e.SystemMessage??e.Message:e.SystemMessage??e.Message??fk;default:throw Error(`Unknown message role: ${t}`)}},mk=e=>{let t=V(6),{components:n}=e,r=H(yk),i=H(bk),a;t[0]!==n||t[1]!==i||t[2]!==r?(a=pk(n,r,i),t[0]=n,t[1]=i,t[2]=r,t[3]=a):a=t[3];let o=a,s;return t[4]===o?s=t[5]:(s=(0,B.jsx)(o,{}),t[4]=o,t[5]=s),s},hk=(0,sT.memo)(e=>{let t=V(5),{index:n,components:r}=e,i;t[0]===r?i=t[1]:(i=(0,B.jsx)(mk,{components:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,B.jsx)(dD,{index:n,children:i}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a},(e,t)=>e.index===t.index&&dk(e.components,t.components));hk.displayName=`ThreadPrimitive.MessageByIndex`;var gk=({children:e})=>{let t=H(e=>e.thread.messages.length);return pT(()=>t===0?null:Array.from({length:t},(t,n)=>(0,B.jsx)(dD,{index:n,children:(0,B.jsx)(wE,{getItemState:e=>e.thread().message({index:n}).getState(),children:t=>e({get message(){return t()}})})},n)),[t,e])},_k=e=>{let t=V(4),{components:n,children:r}=e;if(n){let e;return t[0]===n?e=t[1]:(e=(0,B.jsx)(gk,{children:()=>(0,B.jsx)(mk,{components:n})}),t[0]=n,t[1]=e),e}let i;return t[2]===r?i=t[3]:(i=(0,B.jsx)(gk,{children:r}),t[2]=r,t[3]=i),i};_k.displayName=`ThreadPrimitive.Messages`;var vk=(0,sT.memo)(_k,(e,t)=>e.children||t.children?e.children===t.children:dk(e.components,t.components));function yk(e){return e.message.role}function bk(e){return e.message.composer.isEditing}var xk=e=>{let t=e.message.metadata;if(!(!t||typeof t!=`object`))return t.custom?.quote},Sk=class extends Error{componentName;constructor(e,t=`Component "${e}" is not in the generative-ui allowlist.`){super(t),this.name=`GenerativeUIRenderError`,this.componentName=e}},Ck=e=>typeof e==`object`&&!!e,wk=(e,t,n,r)=>{if(e==null)return null;if(typeof e==`string`)return e;if(!Ck(e)||!(`component`in e))return null;let{component:i,props:a,children:o,key:s}=e,c=t[i];if(!c){if(n)return(0,B.jsx)(n,{component:i,props:a},s??r);throw new Sk(i)}let l=o?.length?o.map((e,i)=>wk(e,t,n,`${r}/${i}`)):void 0;return(0,sT.createElement)(c,{...a??{},key:s??r},...l??[])},Tk=e=>{if(!e||e.root===void 0||e.root===null)return[];let t=e.root;return Array.isArray(t)?t:[t]},Ek=e=>{let t=V(11),{spec:n,components:r,Fallback:i}=e,a;t[0]===n?a=t[1]:(a=Tk(n),t[0]=n,t[1]=a);let o=a,s;if(t[2]!==i||t[3]!==r||t[4]!==o){let e;t[6]!==i||t[7]!==r?(e=(e,t)=>wk(e,r,i,`${t}`),t[6]=i,t[7]=r,t[8]=e):e=t[8],s=o.map(e),t[2]=i,t[3]=r,t[4]=o,t[5]=s}else s=t[5];let c;return t[9]===s?c=t[10]:(c=(0,B.jsx)(B.Fragment,{children:s}),t[9]=s,t[10]=c),c};Ek.displayName=`GenerativeUIRender`;var Dk=e=>{let t=V(4),{components:n,spec:r,Fallback:i}=e,a=H(Ok),o=r??a;if(!o)return null;let s;return t[0]!==i||t[1]!==n||t[2]!==o?(s=(0,B.jsx)(Ek,{spec:o,components:n,Fallback:i}),t[0]=i,t[1]=n,t[2]=o,t[3]=s):s=t[3],s};Dk.displayName=`MessagePrimitive.GenerativeUI`;function Ok(e){let t=e.part;return t?.type===`generative-ui`?t.spec:void 0}var kk=`ui://`,Ak=e=>!!e?.startsWith(kk),jk=e=>Symbol.iterator in e,Mk=e=>`entries`in e,Nk=(e,t)=>{let n=e instanceof Map?e:new Map(e.entries()),r=t instanceof Map?t:new Map(t.entries());if(n.size!==r.size)return!1;for(let[e,t]of n)if(!r.has(e)||!Object.is(t,r.get(e)))return!1;return!0},Pk=(e,t)=>{let n=e[Symbol.iterator](),r=t[Symbol.iterator](),i=n.next(),a=r.next();for(;!i.done&&!a.done;){if(!Object.is(i.value,a.value))return!1;i=n.next(),a=r.next()}return!!i.done&&!!a.done};function Fk(e,t){return Object.is(e,t)?!0:typeof e!=`object`||!e||typeof t!=`object`||!t||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:jk(e)&&jk(t)?Mk(e)&&Mk(t)?Nk(e,t):Pk(e,t):Nk({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function Ik(e){let t=z.useRef(void 0);return n=>{let r=e(n);return Fk(t.current,r)?t.current:t.current=r}}var Lk=e=>{let t=-1;return{startGroup:e=>{t===-1&&(t=e)},endGroup:(n,r)=>{t!==-1&&(r.push({type:e,startIndex:t,endIndex:n}),t=-1)},finalize:(n,r)=>{t!==-1&&r.push({type:e,startIndex:t,endIndex:n})}}},Rk=(e,t,n)=>{let r=[];if(t){let t=Lk(`chainOfThoughtGroup`);for(let n=0;n<e.length;n++){let i=e[n];i===`tool-call`||i===`reasoning`?t.startGroup(n):(t.endGroup(n-1,r),r.push({type:`single`,index:n}))}t.finalize(e.length-1,r)}else{let t=Lk(`toolGroup`),n=Lk(`reasoningGroup`);for(let i=0;i<e.length;i++){let a=e[i];a===`tool-call`?(n.endGroup(i-1,r),t.startGroup(i)):a===`reasoning`?(t.endGroup(i-1,r),n.startGroup(i)):(t.endGroup(i-1,r),n.endGroup(i-1,r),r.push({type:`single`,index:i}))}t.finalize(e.length-1,r),n.finalize(e.length-1,r)}if(n){let e=new Set;for(let t of r){if(t.type===`single`)continue;let r=n[t.startIndex];r!==void 0&&!e.has(r)&&(e.add(r),t.idKey=`id:${r}`)}}return r},zk=e=>{let t=V(10),n=H(Ik(cA)),r=H(Ik(uA)),i;bb0:{if(n.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0];let n;t[1]===r?n=t[2]:(n={ranges:e,partIds:r},t[1]=r,t[2]=n),i=n;break bb0}let a;t[3]!==n||t[4]!==r||t[5]!==e?(a=Rk(n,e,r),t[3]=n,t[4]=r,t[5]=e,t[6]=a):a=t[6];let o;t[7]!==r||t[8]!==a?(o={ranges:a,partIds:r},t[7]=r,t[8]=a,t[9]=o):o=t[9],i=o}return i},Bk=e=>{let t=V(9),n,r;t[0]===e?(n=t[1],r=t[2]):({Fallback:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]!==n||t[4]!==r.toolName?(i=e=>e.tools.toolUIs[r.toolName]?.[0]?.render??n,t[3]=n,t[4]=r.toolName,t[5]=i):i=t[5];let a=H(i);if(!a)return null;let o;return t[6]!==a||t[7]!==r?(o=(0,B.jsx)(a,{...r}),t[6]=a,t[7]=r,t[8]=o):o=t[8],o},Vk=(e,t,n)=>e.renderers[t]?.[0]||(e.fallbacks[0]??n),Hk=e=>{let t=V(9),n,r;t[0]===e?(n=t[1],r=t[2]):({Fallback:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]!==n||t[4]!==r.name?(i=e=>Vk(e.dataRenderers,r.name,n),t[3]=n,t[4]=r.name,t[5]=i):i=t[5];let a=H(i);if(!a)return null;let o;return t[6]!==a||t[7]!==r?(o=(0,B.jsx)(a,{...r}),t[6]=a,t[7]=r,t[8]=o):o=t[8],o},Uk={Text:()=>null,Reasoning:()=>null,Source:()=>null,Image:()=>null,File:()=>null,Unstable_Audio:()=>null,ToolGroup:({children:e})=>e,ReasoningGroup:({children:e})=>e},Wk=e=>{let t=V(47),{components:n}=e,r;t[0]===n?r=t[1]:(r=n===void 0?{}:n,t[0]=n,t[1]=r);let{Text:i,Reasoning:a,Image:o,Source:s,File:c,Unstable_Audio:l,tools:u,data:d,generativeUI:f}=r,p=i===void 0?Uk.Text:i,m=a===void 0?Uk.Reasoning:a,h=o===void 0?Uk.Image:o,g=s===void 0?Uk.Source:s,_=c===void 0?Uk.File:c,v=l===void 0?Uk.Unstable_Audio:l,y;t[2]===u?y=t[3]:(y=u===void 0?{}:u,t[2]=u,t[3]=y);let b=y,x=CE(),S=H(dA),C=S.type;if(C===`tool-call`){let e;t[4]===x?e=t[5]:(e=x.part(),t[4]=x,t[5]=e);let n=e.addToolResult,r;t[6]===x?r=t[7]:(r=x.part(),t[6]=x,t[7]=r);let i=r.resumeToolCall,a;t[8]===x?a=t[9]:(a=x.part(),t[8]=x,t[9]=a);let o=a.respondToToolApproval;if(`Override`in b){let e;return t[10]!==n||t[11]!==S||t[12]!==o||t[13]!==i||t[14]!==b.Override?(e=(0,B.jsx)(b.Override,{...S,addResult:n,resume:i,respondToApproval:o}),t[10]=n,t[11]=S,t[12]=o,t[13]=i,t[14]=b.Override,t[15]=e):e=t[15],e}let s=b.by_name?.[S.toolName]??b.Fallback,c;return t[16]!==s||t[17]!==n||t[18]!==S||t[19]!==o||t[20]!==i?(c=(0,B.jsx)(Bk,{...S,Fallback:s,addResult:n,resume:i,respondToApproval:o}),t[16]=s,t[17]=n,t[18]=S,t[19]=o,t[20]=i,t[21]=c):c=t[21],c}if(S.status?.type===`requires-action`)throw Error(`Encountered unexpected requires-action status`);switch(C){case`text`:{let e;return t[22]!==p||t[23]!==S?(e=(0,B.jsx)(p,{...S}),t[22]=p,t[23]=S,t[24]=e):e=t[24],e}case`reasoning`:{let e;return t[25]!==m||t[26]!==S?(e=(0,B.jsx)(m,{...S}),t[25]=m,t[26]=S,t[27]=e):e=t[27],e}case`source`:{let e;return t[28]!==g||t[29]!==S?(e=(0,B.jsx)(g,{...S}),t[28]=g,t[29]=S,t[30]=e):e=t[30],e}case`image`:{let e;return t[31]!==h||t[32]!==S?(e=(0,B.jsx)(h,{...S}),t[31]=h,t[32]=S,t[33]=e):e=t[33],e}case`file`:{let e;return t[34]!==_||t[35]!==S?(e=(0,B.jsx)(_,{...S}),t[34]=_,t[35]=S,t[36]=e):e=t[36],e}case`audio`:{let e;return t[37]!==v||t[38]!==S?(e=(0,B.jsx)(v,{...S}),t[37]=v,t[38]=S,t[39]=e):e=t[39],e}case`data`:{let e=d?.by_name?.[S.name]??d?.Fallback,n;return t[40]!==e||t[41]!==S?(n=(0,B.jsx)(Hk,{...S,Fallback:e}),t[40]=e,t[41]=S,t[42]=n):n=t[42],n}case`generative-ui`:{if(!f?.components)return null;let e=S,n;return t[43]!==f.Fallback||t[44]!==f.components||t[45]!==e.spec?(n=(0,B.jsx)(Ek,{spec:e.spec,components:f.components,Fallback:f.Fallback}),t[43]=f.Fallback,t[44]=f.components,t[45]=e.spec,t[46]=n):n=t[46],n}default:return console.warn(`Unknown message part type: ${C}`),null}},Gk=(0,sT.memo)(e=>{let t=V(5),{index:n,components:r}=e,i;t[0]===r?i=t[1]:(i=(0,B.jsx)(Wk,{components:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,B.jsx)(fD,{index:n,children:i}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a},(e,t)=>e.index===t.index&&e.components?.Text===t.components?.Text&&e.components?.Reasoning===t.components?.Reasoning&&e.components?.Source===t.components?.Source&&e.components?.Image===t.components?.Image&&e.components?.File===t.components?.File&&e.components?.Unstable_Audio===t.components?.Unstable_Audio&&e.components?.tools===t.components?.tools&&e.components?.data===t.components?.data&&e.components?.generativeUI===t.components?.generativeUI&&e.components?.ToolGroup===t.components?.ToolGroup&&e.components?.ReasoningGroup===t.components?.ReasoningGroup);Gk.displayName=`MessagePrimitive.PartByIndex`;var Kk=e=>{let t=V(6),{status:n,component:r}=e,i=n.type===`running`,a;t[0]!==r||t[1]!==n?(a=(0,B.jsx)(r,{type:`text`,text:``,status:n}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==a?(o=(0,B.jsx)(mD,{text:``,isRunning:i,children:a}),t[3]=i,t[4]=a,t[5]=o):o=t[5],o},qk=Object.freeze({type:`complete`}),Jk=Object.freeze({type:`running`}),Yk=(0,sT.memo)(e=>{let t=V(6),{components:n}=e,r=H(fA);if(n?.Empty){let e;return t[0]!==n.Empty||t[1]!==r?(e=(0,B.jsx)(n.Empty,{status:r}),t[0]=n.Empty,t[1]=r,t[2]=e):e=t[2],e}if(r.type!==`running`)return null;let i=n?.Text??Uk.Text,a;return t[3]!==r||t[4]!==i?(a=(0,B.jsx)(Kk,{status:r,component:i}),t[3]=r,t[4]=i,t[5]=a):a=t[5],a},(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),Xk=(0,sT.memo)(e=>{let t=V(4),{components:n,enabled:r}=e,i;if(t[0]===r?i=t[1]:(i=e=>{if(!r||e.message.parts.length===0)return!1;let t=e.message.parts[e.message.parts.length-1];return t?.type!==`text`&&t?.type!==`reasoning`},t[0]=r,t[1]=i),!H(i))return null;let a;return t[2]===n?a=t[3]:(a=(0,B.jsx)(Yk,{components:n}),t[2]=n,t[3]=a),a},(e,t)=>e.enabled===t.enabled&&e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),Zk=(0,sT.memo)(e=>{let t=V(4),{Quote:n}=e,r=H(xk);if(!r)return null;let i;return t[0]!==n||t[1]!==r.messageId||t[2]!==r.text?(i=(0,B.jsx)(n,{text:r.text,messageId:r.messageId}),t[0]=n,t[1]=r.messageId,t[2]=r.text,t[3]=i):i=t[3],i});function Qk(e,t){return(e.toolUIs[t.toolName]?.[0]?.render??null)||(Ak(t.mcp?.app?.resourceUri)&&e.mcpApp?e.mcpApp.render:null)}var $k=()=>{let e=V(12),t=CE(),n=H(pA),r=H(mA);if(!r||n.type!==`tool-call`)return null;let i;e[0]===t?i=e[1]:(i=t.part(),e[0]=t,e[1]=i);let a=i.addToolResult,o;e[2]===t?o=e[3]:(o=t.part(),e[2]=t,e[3]=o);let s=o.resumeToolCall,c;e[4]===t?c=e[5]:(c=t.part(),e[4]=t,e[5]=c);let l;return e[6]!==r||e[7]!==n||e[8]!==i.addToolResult||e[9]!==o.resumeToolCall||e[10]!==c.respondToToolApproval?(l=(0,B.jsx)(r,{...n,addResult:a,resume:s,respondToApproval:c.respondToToolApproval}),e[6]=r,e[7]=n,e[8]=i.addToolResult,e[9]=o.resumeToolCall,e[10]=c.respondToToolApproval,e[11]=l):l=e[11],l},eA=()=>{let e=V(3),t=H(hA),n=H(gA);if(!n||t.type!==`data`)return null;let r=t,i;return e[0]!==n||e[1]!==r?(i=(0,B.jsx)(n,{...r}),e[0]=n,e[1]=r,e[2]=i):i=e[2],i},tA=()=>{let e=V(2),t=H(Wle);if(t===`tool-call`){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,B.jsx)($k,{}),e[0]=t):t=e[0],t}if(t===`data`){let t;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,B.jsx)(eA,{}),e[1]=t):t=e[1],t}return null},nA=Object.freeze({type:`text`,text:``,status:Jk}),rA=({index:e,children:t})=>{let n=CE(),r=H(e=>e.dataRenderers);return(0,B.jsx)(fD,{index:e,children:(0,B.jsx)(wE,{getItemState:t=>t.message().part({index:e}).getState(),children:i=>t({get part(){let t=i();if(t.type===`tool-call`){let r=Qk(n.tools().getState(),t)!==null,i=n.message().part({index:e});return{...t,toolUI:r?(0,B.jsx)($k,{}):null,addResult:i.addToolResult,resume:i.resumeToolCall,respondToApproval:i.respondToToolApproval}}if(t.type===`data`){let e=Vk(r,t.name,void 0)!==void 0;return{...t,dataRendererUI:e?(0,B.jsx)(eA,{}):null}}return t}})})})},iA=e=>{let t=V(9),{children:n}=e,r=H(Gle),i=H(Kle),a=r===0&&i;if(r===0){if(!a)return null;let e;t[0]===n?e=t[1]:(e=n({part:nA}),t[0]=n,t[1]=e);let r;return t[2]===e?r=t[3]:(r=(0,B.jsx)(mD,{text:``,isRunning:!0,children:e}),t[2]=e,t[3]=r),r}let o;if(t[4]!==n||t[5]!==r){let e;t[7]===n?e=t[8]:(e=(e,t)=>(0,B.jsx)(rA,{index:t,children:e=>n(e)??(0,B.jsx)(tA,{})},t),t[7]=n,t[8]=e),o=(0,B.jsx)(B.Fragment,{children:Array.from({length:r},e)}),t[4]=n,t[5]=r,t[6]=o}else o=t[6];return o},aA=e=>{let t=V(5),{components:n,unstable_showEmptyOnNonTextEnd:r,children:i}=e,a=r===void 0?!0:r;if(i){let e;return t[0]===i?e=t[1]:(e=(0,B.jsx)(iA,{children:i}),t[0]=i,t[1]=e),e}let o;return t[2]!==n||t[3]!==a?(o=(0,B.jsx)(oA,{components:n,unstable_showEmptyOnNonTextEnd:a}),t[2]=n,t[3]=a,t[4]=o):o=t[4],o};aA.displayName=`MessagePrimitive.Parts`;var oA=e=>{let t=V(15),{components:n,unstable_showEmptyOnNonTextEnd:r}=e,i=H(qle),{ranges:a,partIds:o}=zk(!!n?.ChainOfThought),s;bb0:{if(i===0){let e;t[0]===n?e=t[1]:(e=(0,B.jsx)(Yk,{components:n}),t[0]=n,t[1]=e),s=e;break bb0}let e;if(t[2]!==n||t[3]!==a||t[4]!==o){let r=new Set,i=e=>{let t=o[e];return t!==void 0&&!r.has(t)?(r.add(t),`part-id:${t}`):`part-${e}`};e=a.map(e=>{if(e.type===`single`)return(0,B.jsx)(Gk,{index:e.index,components:n},e.index);if(e.type===`chainOfThoughtGroup`){let t=n?.ChainOfThought;return t?(0,B.jsx)(bD,{startIndex:e.startIndex,endIndex:e.endIndex,children:(0,B.jsx)(t,{})},`chainOfThought-${e.idKey??e.startIndex}`):null}else if(e.type===`toolGroup`)return(0,B.jsx)(n?.ToolGroup??Uk.ToolGroup,{startIndex:e.startIndex,endIndex:e.endIndex,children:Array.from({length:e.endIndex-e.startIndex+1},(t,r)=>{let a=e.startIndex+r;return(0,B.jsx)(Gk,{index:a,components:n},i(a))})},`tool-${e.idKey??e.startIndex}`);else return(0,B.jsx)(n?.ReasoningGroup??Uk.ReasoningGroup,{startIndex:e.startIndex,endIndex:e.endIndex,children:Array.from({length:e.endIndex-e.startIndex+1},(t,r)=>{let i=e.startIndex+r;return(0,B.jsx)(Gk,{index:i,components:n},`part-${i}`)})},`reasoning-${e.startIndex}`)}),t[2]=n,t[3]=a,t[4]=o,t[5]=e}else e=t[5];s=e}let c=s,l;t[6]===n?l=t[7]:(l=n?.Quote&&(0,B.jsx)(Zk,{Quote:n.Quote}),t[6]=n,t[7]=l);let u;t[8]!==n||t[9]!==r?(u=(0,B.jsx)(Xk,{components:n,enabled:r}),t[8]=n,t[9]=r,t[10]=u):u=t[10];let d;return t[11]!==c||t[12]!==l||t[13]!==u?(d=(0,B.jsxs)(B.Fragment,{children:[l,c,u]}),t[11]=c,t[12]=l,t[13]=u,t[14]=d):d=t[14],d};function sA(e){return e.type}function cA(e){return e.message.parts.map(sA)}function lA(e){return e.type===`tool-call`?e.toolCallId:void 0}function uA(e){return e.message.parts.map(lA)}function dA(e){return e.part}function fA(e){return e.message.status??qk}function pA(e){return e.part}function mA(e){return e.part.type===`tool-call`?Qk(e.tools,e.part):null}function hA(e){return e.part}function gA(e){return e.part.type===`data`?Vk(e.dataRenderers,e.part.name,void 0)??null:null}function Wle(e){return e.part.type}function Gle(e){return e.message.parts.length}function Kle(e){return(e.message.status?.type??`complete`)===`running`}function qle(e){return e.message.parts.length}var Jle=Symbol.for(`@assistant-ui/groupBy.memoKey`),_A=e=>{let t=e.nextChildIdx++;return e.nodeKey===``?String(t):`${e.nodeKey}.${t}`},vA=(e,t)=>{if(!(t===void 0||e.claimed.has(t)))return e.claimed.add(t),`id:${t}`},Yle=(e,t)=>{let n={key:``,nodeKey:``,indices:[],children:[],nextChildIdx:0,claimed:new Set},r=[n],i=()=>{let e=r.pop(),n=r[r.length-1];n.children.push({type:`group`,key:e.key,nodeKey:e.nodeKey,idKey:vA(n,t?.[e.indices[0]]),indices:e.indices,children:e.children})};for(let n=0;n<e.length;n++){let a=e[n],o=0;for(;o<r.length-1&&o<a.length&&r[o+1].key===a[o];)o++;for(;r.length-1>o;)i();for(;r.length-1<a.length;){let e=r[r.length-1];r.push({key:a[r.length-1],nodeKey:_A(e),indices:[],children:[],nextChildIdx:0,claimed:new Set})}let s=r[r.length-1];s.children.push({type:`part`,index:n,nodeKey:_A(s),idKey:vA(s,t?.[n])});for(let e=1;e<r.length;e++)r[e].indices.push(n)}for(;r.length>1;)i();return n.children},Xle=Object.freeze({type:`complete`}),Zle=(e,t,n)=>{if(!n)return!1;switch(e){case`never`:return!1;case`always`:return!0;case`empty`:return t.length===0;case`no-text`:{let e=t[t.length-1];return e===void 0||e.type!==`text`&&e.type!==`reasoning`}}},yA=()=>{throw Error("MessagePrimitive.GroupedParts: rendered `children` under a leaf part. `children` is only meaningful for `group-…` cases — add a matching case for the part type or return `null` to skip it.")},bA=(e,t,n)=>{if(e.type===`part`)return(0,B.jsx)(rA,{index:e.index,children:({part:e})=>n({part:e,children:(0,B.jsx)(yA,{})})},e.idKey?`part-${e.idKey}`:`part-${e.index}`);let r=t[e.indices.at(-1)]?.status??Xle;return(0,B.jsx)(sT.Fragment,{children:n({part:{type:e.key,status:r,indices:e.indices},children:(0,B.jsx)(B.Fragment,{children:e.children.map(e=>bA(e,t,n))})})},e.idKey??e.nodeKey)},xA=({groupBy:e,indicator:t=`no-text`,children:n})=>{let r=H(Ik(e=>e.message.parts)),i=H(e=>e.tools.toolUIs),a=H(e=>t===`never`?!1:e.message.status?.type===`running`);return(0,B.jsxs)(B.Fragment,{children:[pT(()=>{let t={toolUIs:i};return Yle(r.map(n=>e(n,t)??[]),r.map(e=>e.type===`tool-call`?e.toolCallId:void 0))},[r,e[Jle]??e,i]).map(e=>bA(e,r,n)),Zle(t,r,a)&&n({part:{type:`indicator`},children:(0,B.jsx)(yA,{})})]})};xA.displayName=`MessagePrimitive.GroupedParts`;var SA=(0,sT.memo)(e=>{let t=V(5),{children:n}=e,r=H(xk);if(!r)return null;let i;t[0]!==n||t[1]!==r?(i=n(r),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;return t[3]===i?a=t[4]:(a=(0,B.jsx)(B.Fragment,{children:i}),t[3]=i,t[4]=a),a});SA.displayName=`MessagePrimitive.Quote`;var CA=(e,t)=>{switch(t.type){case`image`:return e?.Image??e?.Attachment;case`document`:return e?.Document??e?.Attachment;case`file`:return e?.File??e?.Attachment;default:return e?.Attachment}},Qle=e=>{let t=V(5),{components:n}=e,r=H($le);if(!r)return null;let i=r,a;t[0]!==n||t[1]!==i?(a=CA(n,i),t[0]=n,t[1]=i,t[2]=a):a=t[2];let o=a;if(!o)return null;let s;return t[3]===o?s=t[4]:(s=(0,B.jsx)(o,{}),t[3]=o,t[4]=s),s},wA=(0,sT.memo)(e=>{let t=V(5),{index:n,components:r}=e,i;t[0]===r?i=t[1]:(i=(0,B.jsx)(Qle,{components:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,B.jsx)(lD,{index:n,children:i}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a},(e,t)=>e.index===t.index&&e.components?.Image===t.components?.Image&&e.components?.Document===t.components?.Document&&e.components?.File===t.components?.File&&e.components?.Attachment===t.components?.Attachment);wA.displayName=`MessagePrimitive.AttachmentByIndex`;var TA=({children:e})=>{let t=H(e=>e.message.role===`user`?(e.message.attachments??[]).length:0);return pT(()=>Array.from({length:t},(t,n)=>(0,B.jsx)(lD,{index:n,children:(0,B.jsx)(wE,{getItemState:e=>e.message().attachment({index:n}).getState(),children:t=>e({get attachment(){return t()}})})},n)),[t,e])},EA=e=>{let t=V(4),{components:n,children:r}=e;if(n){let e;return t[0]===n?e=t[1]:(e=(0,B.jsx)(TA,{children:e=>{let{attachment:t}=e,r=CA(n,t);return r?(0,B.jsx)(r,{}):null}}),t[0]=n,t[1]=e),e}let i;return t[2]===r?i=t[3]:(i=(0,B.jsx)(TA,{children:r}),t[2]=r,t[3]=i),i};EA.displayName=`MessagePrimitive.Attachments`;function $le(e){return e.attachment}var DA=(e,t)=>{switch(t.type){case`image`:return e?.Image??e?.Attachment;case`document`:return e?.Document??e?.Attachment;case`file`:return e?.File??e?.Attachment;default:return e?.Attachment}},eue=e=>{let t=V(5),{components:n}=e,r=H(tue);if(!r)return null;let i;t[0]!==r||t[1]!==n?(i=DA(n,r),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i;if(!a)return null;let o;return t[3]===a?o=t[4]:(o=(0,B.jsx)(a,{}),t[3]=a,t[4]=o),o},OA=(0,sT.memo)(e=>{let t=V(5),{index:n,components:r}=e,i;t[0]===r?i=t[1]:(i=(0,B.jsx)(eue,{components:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,B.jsx)(uD,{index:n,children:i}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a},(e,t)=>e.index===t.index&&e.components?.Image===t.components?.Image&&e.components?.Document===t.components?.Document&&e.components?.File===t.components?.File&&e.components?.Attachment===t.components?.Attachment);OA.displayName=`ComposerPrimitive.AttachmentByIndex`;var kA=({children:e})=>{let t=H(e=>e.composer.attachments.length);return pT(()=>Array.from({length:t},(t,n)=>(0,B.jsx)(uD,{index:n,children:(0,B.jsx)(wE,{getItemState:e=>e.composer().attachment({index:n}).getState(),children:t=>e({get attachment(){return t()}})})},n)),[t,e])},AA=e=>{let t=V(4),{components:n,children:r}=e;if(n){let e;return t[0]===n?e=t[1]:(e=(0,B.jsx)(kA,{children:e=>{let{attachment:t}=e,r=DA(n,t);return r?(0,B.jsx)(r,{}):null}}),t[0]=n,t[1]=e),e}let i;return t[2]===r?i=t[3]:(i=(0,B.jsx)(kA,{children:r}),t[2]=r,t[3]=i),i};AA.displayName=`ComposerPrimitive.Attachments`;function tue(e){return e.attachment}var jA=(0,sT.memo)(({children:e})=>{let t=H(e=>e.composer.queue.length);return pT(()=>Array.from({length:t},(t,n)=>(0,B.jsx)(CD,{index:n,children:(0,B.jsx)(wE,{getItemState:e=>e.composer().queueItem({index:n}).getState(),children:t=>e({get queueItem(){return t()}})})},n)),[t,e])});jA.displayName=`ComposerPrimitive.Queue`;var MA=e=>{let{children:t}=e;return H(nue)?t:null};MA.displayName=`MessagePartPrimitive.InProgress`;function nue(e){return e.part.status.type===`running`}var NA=e=>{let t=V(2),{components:n}=e,r=n.Suggestion,i;return t[0]===r?i=t[1]:(i=(0,B.jsx)(r,{}),t[0]=r,t[1]=i),i},PA=(0,sT.memo)(e=>{let t=V(5),{index:n,components:r}=e,i;t[0]===r?i=t[1]:(i=(0,B.jsx)(NA,{components:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,B.jsx)(SD,{index:n,children:i}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a},(e,t)=>e.index===t.index&&e.components.Suggestion===t.components.Suggestion);PA.displayName=`ThreadPrimitive.SuggestionByIndex`;var FA=({children:e})=>{let t=H(e=>e.suggestions.suggestions.length);return pT(()=>t===0?null:Array.from({length:t},(t,n)=>(0,B.jsx)(SD,{index:n,children:(0,B.jsx)(wE,{getItemState:e=>e.suggestions().suggestion({index:n}).getState(),children:t=>e({get suggestion(){return t()}})})},n)),[t,e])},IA=e=>{let t=V(4),{components:n,children:r}=e;if(n){let e;return t[0]===n?e=t[1]:(e=(0,B.jsx)(FA,{children:()=>(0,B.jsx)(NA,{components:n})}),t[0]=n,t[1]=e),e}let i;return t[2]===r?i=t[3]:(i=(0,B.jsx)(FA,{children:r}),t[2]=r,t[3]=i),i};IA.displayName=`ThreadPrimitive.Suggestions`;var rue=(0,sT.memo)(IA,(e,t)=>e.children||t.children?e.children===t.children:e.components.Suggestion===t.components.Suggestion),iue=e=>{let t=V(3),n;return t[0]!==e.dictation||t[1]!==e.editing?(n=t=>{if(e.editing===!0&&!t.composer.isEditing||e.editing===!1&&t.composer.isEditing)return!1;let n=t.composer.dictation!=null;return!(e.dictation===!0&&!n||e.dictation===!1&&n)},t[0]=e.dictation,t[1]=e.editing,t[2]=n):n=t[2],H(n)},LA=e=>{let t=V(3),n,r;return t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),iue(r)?n:null};LA.displayName=`ComposerPrimitive.If`;var aue=()=>{let e=V(5),t=CE(),n=H(oue),r;e[0]===t?r=e[1]:(r=e=>{t.composer().send(e)},e[0]=t,e[1]=r);let i=r,a;return e[2]!==n||e[3]!==i?(a={send:i,disabled:n},e[2]=n,e[3]=i,e[4]=a):a=e[4],a};function oue(e){return!e.composer.canSend||e.thread.isRunning&&!e.thread.capabilities.queue}var sue=()=>{let e=V(5),t=CE(),n=H(cue),r;e[0]===t?r=e[1]:(r=()=>{t.composer().cancel()},e[0]=t,e[1]=r);let i=r,a;return e[2]!==i||e[3]!==n?(a={cancel:i,disabled:n},e[2]=i,e[3]=n,e[4]=a):a=e[4],a};function cue(e){return!e.composer.canCancel}var lue=()=>{let e=V(5),t=CE(),n=H(uue),r;e[0]===t?r=e[1]:(r=()=>{t.composer().startDictation()},e[0]=t,e[1]=r);let i=r,a;return e[2]!==n||e[3]!==i?(a={startDictation:i,disabled:n},e[2]=n,e[3]=i,e[4]=a):a=e[4],a};function uue(e){return e.composer.dictation!=null||!e.thread.capabilities.dictation||!e.composer.isEditing}var due=()=>{let e=V(5),t=CE(),n=H(fue),r;e[0]===t?r=e[1]:(r=e=>t.composer().addAttachment(e),e[0]=t,e[1]=r);let i=r,a;return e[2]!==i||e[3]!==n?(a={addAttachment:i,disabled:n},e[2]=i,e[3]=n,e[4]=a):a=e[4],a};function fue(e){return!e.composer.isEditing}var pue=e=>{let t=V(12),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{copiedDuration:r,copyToClipboard:i}=n,a=r===void 0?3e3:r,o=CE(),s=H(hue),c=H(gue),l=H(_ue),u=H(vue),d;t[2]!==o||t[3]!==u||t[4]!==a||t[5]!==i||t[6]!==l?(d=()=>{let e=l?u:o.message().getCopyText();if(!e)return;let t=i??yue;Promise.resolve(t(e)).then(()=>{o.message().setIsCopied(!0),setTimeout(()=>o.message().setIsCopied(!1),a)},bue)},t[2]=o,t[3]=u,t[4]=a,t[5]=i,t[6]=l,t[7]=d):d=t[7];let f=d,p;return t[8]!==f||t[9]!==s||t[10]!==c?(p={copy:f,disabled:s,isCopied:c},t[8]=f,t[9]=s,t[10]=c,t[11]=p):p=t[11],p};function mue(e){return e.type===`text`&&e.text.length>0}function hue(e){return!((e.message.role!==`assistant`||e.message.status?.type!==`running`)&&e.message.parts.some(mue))}function gue(e){return e.message.isCopied}function _ue(e){return e.composer.isEditing}function vue(e){return e.composer.text}function yue(){}function bue(){}var xue=()=>{let e=V(5),t=CE(),n=H(Sue),r;e[0]===t?r=e[1]:(r=()=>{t.composer().beginEdit()},e[0]=t,e[1]=r);let i=r,a;return e[2]!==n||e[3]!==i?(a={edit:i,disabled:n},e[2]=n,e[3]=i,e[4]=a):a=e[4],a};function Sue(e){return e.composer.isEditing}var Cue=()=>{let e=V(5),t=CE(),n=H(wue),r;e[0]===t?r=e[1]:(r=()=>{t.message().reload()},e[0]=t,e[1]=r);let i=r,a;return e[2]!==n||e[3]!==i?(a={reload:i,disabled:n},e[2]=n,e[3]=i,e[4]=a):a=e[4],a};function wue(e){return e.thread.isRunning||e.thread.isDisabled||e.message.role!==`assistant`}var Tue=()=>{let e=V(5),t=CE(),n=H(Due),r;e[0]===t?r=e[1]:(r=()=>{t.message().submitFeedback({type:`positive`})},e[0]=t,e[1]=r);let i=r,a;return e[2]!==n||e[3]!==i?(a={submit:i,isSubmitted:n},e[2]=n,e[3]=i,e[4]=a):a=e[4],a},Eue=()=>{let e=V(5),t=CE(),n=H(Oue),r;e[0]===t?r=e[1]:(r=()=>{t.message().submitFeedback({type:`negative`})},e[0]=t,e[1]=r);let i=r,a;return e[2]!==n||e[3]!==i?(a={submit:i,isSubmitted:n},e[2]=n,e[3]=i,e[4]=a):a=e[4],a};function Due(e){return e.message.metadata.submittedFeedback?.type===`positive`}function Oue(e){return e.message.metadata.submittedFeedback?.type===`negative`}var kue=()=>{let e=V(5),t=CE(),n=H(jue),r;e[0]===t?r=e[1]:(r=async()=>{t.message().speak()},e[0]=t,e[1]=r);let i=r,a;return e[2]!==n||e[3]!==i?(a={speak:i,disabled:n},e[2]=n,e[3]=i,e[4]=a):a=e[4],a};function Aue(e){return e.type===`text`&&e.text.length>0}function jue(e){return!((e.message.role!==`assistant`||e.message.status?.type!==`running`)&&e.message.parts.some(Aue))}var Mue=()=>{let e=V(5),t=CE(),n=H(Nue),r;e[0]===t?r=e[1]:(r=()=>{t.message().stopSpeaking()},e[0]=t,e[1]=r);let i=r,a;return e[2]!==n||e[3]!==i?(a={stopSpeaking:i,disabled:n},e[2]=n,e[3]=i,e[4]=a):a=e[4],a};function Nue(e){return e.message.speech==null}var Pue=e=>{let t=V(8),{prompt:n,send:r,clearComposer:i}=e,a=i===void 0?!0:i,o=CE(),s=H(Fue),c=r??!1,l;t[0]!==o||t[1]!==a||t[2]!==n||t[3]!==c?(l=()=>{let e=o.thread().getState().isRunning;if(c&&!e)o.thread().append({content:[{type:`text`,text:n}],runConfig:o.composer().getState().runConfig}),a&&o.composer().setText(``);else if(a)o.composer().setText(n);else{let e=o.composer().getState().text;o.composer().setText(e.trim()?`${e} ${n}`:n)}},t[0]=o,t[1]=a,t[2]=n,t[3]=c,t[4]=l):l=t[4];let u=l,d;return t[5]!==s||t[6]!==u?(d={trigger:u,disabled:s},t[5]=s,t[6]=u,t[7]=d):d=t[7],d};function Fue(e){return e.thread.isDisabled}var Iue=()=>H(Lue);function Lue(e){return e.message.status?.type===`incomplete`&&e.message.status.reason===`error`?e.message.status.error??`An error occurred`:void 0}var Rue=/:([\w-]{1,64})\[([^\]\n]{1,1024})\](?:\{name=([^}\n]{1,1024})\})?/gu,RA={serialize(e){let t=e.id===e.label?``:`{name=${e.id}}`;return`:${e.type}[${e.label}]${t}`},parse(e){let t=[],n=0;for(let r of e.matchAll(Rue)){r.index>n&&t.push({kind:`text`,text:e.slice(n,r.index)});let i=r[2];t.push({kind:`mention`,type:r[1],label:i,id:r[3]??i}),n=r.index+r[0].length}return n<e.length&&t.push({kind:`text`,text:e.slice(n)}),t}};function zue(e,t){function n(n){let r=ST(e);if(!n?.optional&&!r)throw Error(`This component must be used within ${t}.`);return r}return n}function zA(e,t){function n(n){let r=e(n);return r?r[t]:null}function r(e){let t=!1,r;typeof e==`function`?r=e:e&&typeof e==`object`&&(t=!!e.optional,r=e.selector);let i=n({optional:t});return i?r?i(r):i():null}return{[t]:r,[`${t}Store`]:n}}var BA=bT(null),{useThreadViewport:VA,useThreadViewportStore:HA}=zA(zue(BA,`ThreadPrimitive.Viewport`),`useThreadViewport`),UA=e=>{let t=new Map,n=()=>{let n=0;for(let e of t.values())n+=e;e(n)};return{register:()=>{let e=Symbol();return t.set(e,0),{setHeight:r=>{t.get(e)!==r&&(t.set(e,r),n())},unregister:()=>{t.delete(e),n()}}}}},Bue=(e={})=>{let t=new Set,n=UA(e=>{a.setState({height:{...a.getState().height,viewport:e}})}),r=UA(e=>{a.setState({height:{...a.getState().height,inset:e}})}),i=(e,t)=>(a.setState({element:{...a.getState().element,[e]:t}}),()=>{a.getState().element[e]===t&&a.setState({element:{...a.getState().element,[e]:null}})}),a=Dle(()=>({isAtBottom:!0,scrollToBottom:({behavior:e=`auto`}={})=>{for(let n of t)n({behavior:e})},onScrollToBottom:e=>(t.add(e),()=>{t.delete(e)}),turnAnchor:e.turnAnchor??`bottom`,topAnchorMessageClamp:{tallerThan:e.topAnchorMessageClamp?.tallerThan??`10em`,visibleHeight:e.topAnchorMessageClamp?.visibleHeight??`6em`},height:{viewport:0,inset:0},element:{viewport:null,anchor:null,target:null},targetConfig:null,topAnchorTurn:null,registerViewport:n.register,registerContentInset:r.register,registerViewportElement:e=>i(`viewport`,e),registerAnchorElement:e=>i(`anchor`,e),registerAnchorTargetElement:(e,t)=>(a.setState({element:{...a.getState().element,target:e},targetConfig:e&&t?t:null}),()=>{a.getState().element.target===e&&a.setState({element:{...a.getState().element,target:null},targetConfig:null})}),setTopAnchorTurn:e=>{a.setState({topAnchorTurn:e})}}));return a},WA=e=>e,Vue=e=>{let t=V(11),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={optional:!0},t[0]=n):n=t[0];let r=HA(n),i;t[1]===e?i=t[2]:(i=()=>Bue(e),t[1]=e,t[2]=i);let[a]=uT(i),o,s;t[3]!==r||t[4]!==a?(o=()=>r?.getState().onScrollToBottom(()=>{a.getState().scrollToBottom()}),s=[r,a],t[3]=r,t[4]=a,t[5]=o,t[6]=s):(o=t[5],s=t[6]),hT(o,s);let c,l;return t[7]!==r||t[8]!==a?(c=()=>{if(r)return a.subscribe(e=>{r.getState().isAtBottom!==e.isAtBottom&&WA(r).setState({isAtBottom:e.isAtBottom})})},l=[a,r],t[7]=r,t[8]=a,t[9]=c,t[10]=l):(c=t[9],l=t[10]),hT(c,l),a},GA=e=>{let t=V(7),{children:n,options:r}=e,i;t[0]===r?i=t[1]:(i=r===void 0?{}:r,t[0]=r,t[1]=i);let a=Vue(i),o;t[2]===a?o=t[3]:(o=()=>({useThreadViewport:a}),t[2]=a,t[3]=o);let[s]=uT(o),c;return t[4]!==n||t[5]!==s?(c=(0,B.jsx)(BA.Provider,{value:s,children:n}),t[4]=n,t[5]=s,t[6]=c):c=t[6],c},Hue=()=>{let e=V(3),t=CE(),n,r;return e[0]===t?(n=e[1],r=e[2]):(n=()=>{},r=[t],e[0]=t,e[1]=n,e[2]=r),hT(n,r),null},Uue=(0,sT.memo)(e=>{let t=V(7),{children:n,aui:r,runtime:i}=e,a=r??null,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,B.jsx)(Hue,{}),t[0]=o):o=t[0];let s;t[1]===n?s=t[2]:(s=(0,B.jsx)(GA,{children:n}),t[1]=n,t[2]=s);let c;return t[3]!==i||t[4]!==a||t[5]!==s?(c=(0,B.jsxs)(Cle,{runtime:i,aui:a,children:[o,s]}),t[3]=i,t[4]=a,t[5]=s,t[6]=c):c=t[6],c}),Wue=e=>{let t=e;t.__isBound||=(t.__internal_bindMethods?.(),!0)};function Gue(e,t){let n=V(4),r=t===void 0?Kue:t;Wue(e);let i,a;n[0]!==e||n[1]!==r?(i=()=>r(e.getState()),a=()=>r(e.getState()),n[0]=e,n[1]=r,n[2]=i,n[3]=a):(i=n[2],a=n[3]);let o=vT(e.subscribe,i,a);return yT(o),o}var Kue=e=>e;function KA(e){function t(t){let n=!1,r;typeof t==`function`?r=t:t&&(n=!!t.optional,r=t.selector);let i=e({optional:n});return i?Gue(i,r):null}return t}function que(e){let t=V(2),n=CE(),r;t[0]===n?r=t[1]:(r=()=>n.attachment.source?n.attachment().__internal_getRuntime?.()??null:null,t[0]=n,t[1]=r);let i=H(r);if(!i&&!e?.optional)throw Error(`AttachmentRuntime is not available`);return i}var qA=KA(que);function JA(e){let t=V(2),n=CE(),r;t[0]===n?r=t[1]:(r=()=>n.composer.source?n.composer().__internal_getRuntime?.()??null:null,t[0]=n,t[1]=r);let i=H(r);if(!i&&!e?.optional)throw Error(`ComposerRuntime is not available`);return i}var Jue=KA(JA);function Yue(e){let t=V(2),n=CE(),r;t[0]===n?r=t[1]:(r=()=>n.message.source?n.message().__internal_getRuntime?.()??null:null,t[0]=n,t[1]=r);let i=H(r);if(!i&&!e?.optional)throw Error(`MessageRuntime is not available`);return i}var U=KA(Yue);function YA(e){let t=V(2),n=CE(),r;t[0]===n?r=t[1]:(r=()=>n.thread.source?n.thread().__internal_getRuntime?.()??null:null,t[0]=n,t[1]=r);let i=H(r);if(!i&&!e?.optional)throw Error(`ThreadRuntime is not available`);return i}var XA=KA(YA),ZA=Object.defineProperty,QA=(e,t)=>{let n={};for(var r in e)ZA(n,r,{get:e[r],enumerable:!0});return t||ZA(n,Symbol.toStringTag,{value:`Module`}),n},Xue=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`];function $A(e){let t=(0,sT.forwardRef)((t,n)=>{let r=V(17),i,a,o,s;r[0]===t?(i=r[1],a=r[2],o=r[3],s=r[4]):({render:o,asChild:i,children:a,...s}=t,r[0]=t,r[1]=i,r[2]=a,r[3]=o,r[4]=s);let c=e;if(o&&(0,sT.isValidElement)(o)){let e=a===void 0?o.props.children:a,t=s,i;r[5]!==o||r[6]!==e?(i=(0,sT.cloneElement)(o,void 0,e),r[5]=o,r[6]=e,r[7]=i):i=r[7];let l;return r[8]!==n||r[9]!==t||r[10]!==i?(l=(0,B.jsx)(c,{...t,asChild:!0,ref:n,children:i}),r[8]=n,r[9]=t,r[10]=i,r[11]=l):l=r[11],l}let l=s,u;return r[12]!==i||r[13]!==a||r[14]!==n||r[15]!==l?(u=(0,B.jsx)(c,{...l,asChild:i,ref:n,children:a}),r[12]=i,r[13]=a,r[14]=n,r[15]=l,r[16]=u):u=r[16],u});return t.displayName=typeof e==`string`?e:e.displayName??e.name??`Component`,t}function Zue(e){let t=J_[e],n=$A(t);return n.displayName=`Primitive.${e}`,n}var ej=Xue.reduce((e,t)=>(e[t]=Zue(t),e),{}),Que=e=>{let t=V(5),{hideWhenRunning:n,autohide:r,autohideFloat:i,forceVisible:a}=e,o;return t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==n?(o=e=>{if(n&&e.thread.isRunning)return`hidden`;let t=r===`always`||r===`not-last`&&!e.message.isLast,o=a||e.message.isHovering;return t?o?i===`always`||i===`single-branch`&&e.message.branchCount<=1?`floating`:`normal`:`hidden`:`normal`},t[0]=r,t[1]=i,t[2]=a,t[3]=n,t[4]=o):o=t[4],H(o)},tj=bT(null),$ue=()=>ST(tj),nj=(0,sT.forwardRef)((e,t)=>{let n=V(18),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({hideWhenRunning:a,autohide:r,autohideFloat:i,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let[s,c]=uT(0),l;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{let e=!1;return c(ede),()=>{e||(e=!0,c(tde))}},n[5]=l):l=n[5];let u=l,d;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(d={acquireInteractionLock:u},n[6]=d):d=n[6];let f=d,p=s>0,m;n[7]!==r||n[8]!==i||n[9]!==a||n[10]!==p?(m={hideWhenRunning:a,autohide:r,autohideFloat:i,forceVisible:p},n[7]=r,n[8]=i,n[9]=a,n[10]=p,n[11]=m):m=n[11];let h=Que(m);if(h===`hidden`)return null;let g;n[12]===h?g=n[13]:(g=h===`floating`?{"data-floating":`true`}:null,n[12]=h,n[13]=g);let _;return n[14]!==t||n[15]!==o||n[16]!==g?(_=(0,B.jsx)(tj.Provider,{value:f,children:(0,B.jsx)(ej.div,{...g,...o,ref:t})}),n[14]=t,n[15]=o,n[16]=g,n[17]=_):_=n[17],_});nj.displayName=`ActionBarPrimitive.Root`;function ede(e){return e+1}function tde(e){return Math.max(0,e-1)}var nde=e=>{let t=V(4),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{copiedDuration:r}=n,i=r===void 0?3e3:r,a;t[2]===i?a=t[3]:(a={copiedDuration:i,copyToClipboard:rde},t[2]=i,t[3]=a);let{copy:o,disabled:s}=pue(a);return s?null:o},rj=(0,sT.forwardRef)((e,t)=>{let n=V(20),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({copiedDuration:r,onClick:a,disabled:i,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s=H(ide),c;n[5]===r?c=n[6]:(c={copiedDuration:r},n[5]=r,n[6]=c);let l=nde(c),u;n[7]===s?u=n[8]:(u=s?{"data-copied":`true`}:{},n[7]=s,n[8]=u);let d=i||!l,f;n[9]===l?f=n[10]:(f=()=>{l?.()},n[9]=l,n[10]=f);let p;n[11]!==a||n[12]!==f?(p=R(a,f),n[11]=a,n[12]=f,n[13]=p):p=n[13];let m;return n[14]!==t||n[15]!==o||n[16]!==u||n[17]!==d||n[18]!==p?(m=(0,B.jsx)(ej.button,{type:`button`,...u,...o,ref:t,disabled:d,onClick:p}),n[14]=t,n[15]=o,n[16]=u,n[17]=d,n[18]=p,n[19]=m):m=n[19],m});rj.displayName=`ActionBarPrimitive.Copy`;function rde(e){return typeof navigator>`u`||!navigator.clipboard?Promise.reject(Error(`Clipboard API is unavailable`)):navigator.clipboard.writeText(e)}function ide(e){return e.message.isCopied}var ij=(e,t,n=[])=>{let r=(0,sT.forwardRef)((e,r)=>{let i=V(6),a={},o={};Object.keys(e).forEach(t=>{n.includes(t)?a[t]=e[t]:o[t]=e[t]});let s=t(a)??void 0,c=ej,l=o.disabled||!s,u=R(o.onClick,s),d;return i[0]!==r||i[1]!==o||i[2]!==c.button||i[3]!==l||i[4]!==u?(d=(0,B.jsx)(c.button,{...o,type:`button`,ref:r,disabled:l,onClick:u}),i[0]=r,i[1]=o,i[2]=c.button,i[3]=l,i[4]=u,i[5]=d):d=i[5],d});return r.displayName=e,r},ade=ij(`ActionBarPrimitive.Reload`,()=>{let{disabled:e,reload:t}=Cue();return e?null:t}),ode=ij(`ActionBarPrimitive.Edit`,()=>{let{disabled:e,edit:t}=xue();return e?null:t}),sde=ij(`ActionBarPrimitive.Speak`,()=>{let{disabled:e,speak:t}=kue();return e?null:t}),cde=()=>{let{disabled:e,stopSpeaking:t}=Mue();return e?null:t},aj=(0,sT.forwardRef)((e,t)=>{let n=V(12),r=cde(),i;n[0]===r?i=n[1]:(i=e=>{r&&(e.preventDefault(),r())},n[0]=r,n[1]=i),im(i);let a=!r,o;n[2]===r?o=n[3]:(o=()=>{r?.()},n[2]=r,n[3]=o);let s;n[4]!==e.onClick||n[5]!==o?(s=R(e.onClick,o),n[4]=e.onClick,n[5]=o,n[6]=s):s=n[6];let c;return n[7]!==e||n[8]!==t||n[9]!==a||n[10]!==s?(c=(0,B.jsx)(ej.button,{type:`button`,disabled:a,...e,ref:t,onClick:s}),n[7]=e,n[8]=t,n[9]=a,n[10]=s,n[11]=c):c=n[11],c});aj.displayName=`ActionBarPrimitive.StopSpeaking`;var lde=()=>{let{submit:e}=Tue();return e},oj=(0,sT.forwardRef)((e,t)=>{let n=V(17),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({onClick:i,disabled:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o=H(ude),s=lde(),c;n[4]===o?c=n[5]:(c=o?{"data-submitted":`true`}:{},n[4]=o,n[5]=c);let l=r||!s,u;n[6]===s?u=n[7]:(u=()=>{s?.()},n[6]=s,n[7]=u);let d;n[8]!==i||n[9]!==u?(d=R(i,u),n[8]=i,n[9]=u,n[10]=d):d=n[10];let f;return n[11]!==t||n[12]!==a||n[13]!==c||n[14]!==l||n[15]!==d?(f=(0,B.jsx)(ej.button,{type:`button`,...c,...a,ref:t,disabled:l,onClick:d}),n[11]=t,n[12]=a,n[13]=c,n[14]=l,n[15]=d,n[16]=f):f=n[16],f});oj.displayName=`ActionBarPrimitive.FeedbackPositive`;function ude(e){return e.message.metadata.submittedFeedback?.type===`positive`}var dde=()=>{let{submit:e}=Eue();return e},sj=(0,sT.forwardRef)((e,t)=>{let n=V(17),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({onClick:i,disabled:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o=H(fde),s=dde(),c;n[4]===o?c=n[5]:(c=o?{"data-submitted":`true`}:{},n[4]=o,n[5]=c);let l=r||!s,u;n[6]===s?u=n[7]:(u=()=>{s?.()},n[6]=s,n[7]=u);let d;n[8]!==i||n[9]!==u?(d=R(i,u),n[8]=i,n[9]=u,n[10]=d):d=n[10];let f;return n[11]!==t||n[12]!==a||n[13]!==c||n[14]!==l||n[15]!==d?(f=(0,B.jsx)(ej.button,{type:`button`,...c,...a,ref:t,disabled:l,onClick:d}),n[11]=t,n[12]=a,n[13]=c,n[14]=l,n[15]=d,n[16]=f):f=n[16],f});sj.displayName=`ActionBarPrimitive.FeedbackNegative`;function fde(e){return e.message.metadata.submittedFeedback?.type===`negative`}var pde=e=>{let t=V(6),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{filename:r,onExport:i}=n,a=CE(),o=H(hde),s;return t[2]!==a||t[3]!==r||t[4]!==i?(s=async()=>{let e=a.message().getCopyText();if(!e)return;if(i){await i(e);return}let t=new Blob([e],{type:`text/markdown`}),n=URL.createObjectURL(t),o=document.createElement(`a`);o.href=n,o.download=r??`message-${Date.now()}.md`,o.click(),URL.revokeObjectURL(n)},t[2]=a,t[3]=r,t[4]=i,t[5]=s):s=t[5],o?s:null},cj=(0,sT.forwardRef)((e,t)=>{let n=V(19),r,i,a,o,s;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5]):({filename:i,onExport:o,onClick:a,disabled:r,...s}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s);let c;n[6]!==i||n[7]!==o?(c={filename:i,onExport:o},n[6]=i,n[7]=o,n[8]=c):c=n[8];let l=pde(c),u=r||!l,d;n[9]===l?d=n[10]:(d=()=>{l?.()},n[9]=l,n[10]=d);let f;n[11]!==a||n[12]!==d?(f=R(a,d),n[11]=a,n[12]=d,n[13]=f):f=n[13];let p;return n[14]!==t||n[15]!==s||n[16]!==u||n[17]!==f?(p=(0,B.jsx)(ej.button,{type:`button`,...s,ref:t,disabled:u,onClick:f}),n[14]=t,n[15]=s,n[16]=u,n[17]=f,n[18]=p):p=n[18],p});cj.displayName=`ActionBarPrimitive.ExportMarkdown`;function mde(e){return e.type===`text`&&e.text.length>0}function hde(e){return(e.message.role!==`assistant`||e.message.status?.type!==`running`)&&e.message.parts.some(mde)}var lj=QA({Copy:()=>rj,Edit:()=>ode,ExportMarkdown:()=>cj,FeedbackNegative:()=>sj,FeedbackPositive:()=>oj,Reload:()=>ade,Root:()=>nj,Speak:()=>sde,StopSpeaking:()=>aj}),uj=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),gde=`VisuallyHidden`,dj=z.forwardRef((e,t)=>(0,B.jsx)(J_.span,{...e,ref:t,style:{...uj,...e.style}}));dj.displayName=gde;var _de=dj,fj=`AlertDialog`,[vde,yde]=Em(fj,[bv]),pj=bv(),mj=e=>{let{__scopeAlertDialog:t,...n}=e,r=pj(t);return(0,B.jsx)(gv,{...r,...n,modal:!0})};mj.displayName=fj;var bde=`AlertDialogTrigger`,xde=z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=pj(n);return(0,B.jsx)(fv,{...i,...r,ref:t})});xde.displayName=bde;var Sde=`AlertDialogPortal`,hj=e=>{let{__scopeAlertDialog:t,...n}=e,r=pj(t);return(0,B.jsx)(dv,{...r,...n})};hj.displayName=Sde;var Cde=`AlertDialogOverlay`,gj=z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=pj(n);return(0,B.jsx)(pv,{...i,...r,ref:t})});gj.displayName=Cde;var _j=`AlertDialogContent`,[wde,Tde]=vde(_j),Ede=We(`AlertDialogContent`),vj=z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=pj(n),o=z.useRef(null),s=ac(t,o),c=z.useRef(null);return(0,B.jsx)(mv,{contentName:_j,titleName:yj,docsSlug:`alert-dialog`,children:(0,B.jsx)(wde,{scope:n,cancelRef:c,children:(0,B.jsxs)(hv,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:R(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,B.jsx)(Ede,{children:r}),(0,B.jsx)(Ode,{contentRef:o})]})})})});vj.displayName=_j;var yj=`AlertDialogTitle`,bj=z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=pj(n);return(0,B.jsx)(vv,{...i,...r,ref:t})});bj.displayName=yj;var xj=`AlertDialogDescription`,Sj=z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=pj(n);return(0,B.jsx)(_v,{...i,...r,ref:t})});Sj.displayName=xj;var Dde=`AlertDialogAction`,Cj=z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=pj(n);return(0,B.jsx)(yv,{...i,...r,ref:t})});Cj.displayName=Dde;var wj=`AlertDialogCancel`,Tj=z.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=Tde(wj,n),a=pj(n),o=ac(t,i);return(0,B.jsx)(yv,{...a,...r,ref:o})});Tj.displayName=wj;var Ode=({contentRef:e})=>{let t=`\`${_j}\` requires a description for the component to be accessible for screen reader users.
|
|
101
|
+
|
|
102
|
+
You can add a description to the \`${_j}\` by passing a \`${xj}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
103
|
+
|
|
104
|
+
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${_j}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
105
|
+
|
|
106
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return z.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},kde=mj,Ade=hj,jde=gj,Mde=vj,Nde=Cj,Pde=Tj,Fde=bj,Ide=Sj;function Ej(e){let t=z.useRef({value:e,previous:e});return z.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Dj=`Checkbox`,[Lde,Rde]=Em(Dj),[zde,Oj]=Lde(Dj);function Bde(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=Jp({prop:n,defaultProp:i??!1,onChange:c,caller:Dj}),[m,h]=z.useState(null),[g,_]=z.useState(null),v=z.useRef(!1),y=m?!!o||!!m.closest(`form`):!0,b={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,required:l,defaultChecked:Ij(i)?!1:i,isFormControl:y,bubbleInput:g,setBubbleInput:_};return(0,B.jsx)(zde,{scope:t,...b,children:Vde(d)?d(b):r})}var kj=`CheckboxTrigger`,Aj=z.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=Oj(kj,e),h=ac(i,u),g=z.useRef(c);return z.useEffect(()=>{let e=a?.form;if(e){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,B.jsx)(J_.button,{type:`button`,role:`checkbox`,"aria-checked":Ij(c)?`mixed`:c,"aria-required":l,"data-state":Lj(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:R(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:R(n,e=>{d(e=>Ij(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});Aj.displayName=kj;var jj=z.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,B.jsx)(Bde,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Aj,{...d,ref:t,__scopeCheckbox:n}),e&&(0,B.jsx)(Fj,{__scopeCheckbox:n})]})})});jj.displayName=Dj;var Mj=`CheckboxIndicator`,Nj=z.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=Oj(Mj,n);return(0,B.jsx)(np,{present:r||Ij(a.checked)||a.checked===!0,children:(0,B.jsx)(J_.span,{"data-state":Lj(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});Nj.displayName=Mj;var Pj=`CheckboxBubbleInput`,Fj=z.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=Oj(Pj,e),m=ac(n,p),h=Ej(a),g=xv(r);z.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=Ij(a),n.call(e,Ij(a)?!1:a),e.dispatchEvent(t)}},[f,h,a,i]);let _=z.useRef(Ij(a)?!1:a);return(0,B.jsx)(J_.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??_.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});Fj.displayName=Pj;function Vde(e){return typeof e==`function`}function Ij(e){return e===`indeterminate`}function Lj(e){return Ij(e)?`indeterminate`:e?`checked`:`unchecked`}var Rj=`rovingFocusGroup.onEntryFocus`,Hde={bubbles:!1,cancelable:!0},zj=`RovingFocusGroup`,[Bj,Vj,Ude]=sv(zj),[Wde,Hj]=Em(zj,[Ude]),[Gde,Kde]=Wde(zj),Uj=z.forwardRef((e,t)=>(0,B.jsx)(Bj.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,B.jsx)(Bj.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,B.jsx)(qde,{...e,ref:t})})}));Uj.displayName=zj;var qde=z.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=z.useRef(null),p=ac(t,f),m=lv(a),[h,g]=Jp({prop:o,defaultProp:s??null,onChange:c,caller:zj}),[_,v]=z.useState(!1),y=dd(l),b=Vj(n),x=z.useRef(!1),[S,C]=z.useState(0);return z.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Rj,y),()=>e.removeEventListener(Rj,y)},[y]),(0,B.jsx)(Gde,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:z.useCallback(e=>g(e),[g]),onItemShiftTab:z.useCallback(()=>v(!0),[]),onFocusableItemAdd:z.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:z.useCallback(()=>C(e=>e-1),[]),children:(0,B.jsx)(J_.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:R(e.onMouseDown,()=>{x.current=!0}),onFocus:R(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(Rj,Hde);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);Kj([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:R(e.onBlur,()=>v(!1))})})}),Wj=`RovingFocusGroupItem`,Gj=z.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=i_(),l=a||c,u=Kde(Wj,n),d=u.currentTabStopId===l,f=Vj(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return z.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,B.jsx)(Bj.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,B.jsx)(J_.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:R(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:R(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:R(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Xde(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Zde(n,r+1):n.slice(r+1)}setTimeout(()=>Kj(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});Gj.displayName=Wj;var Jde={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Yde(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Xde(e,t,n){let r=Yde(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Jde[r]}function Kj(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Zde(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var qj=Uj,Jj=Gj,Yj=[`Enter`,` `],Qde=[`ArrowDown`,`PageUp`,`Home`],Xj=[`ArrowUp`,`PageDown`,`End`],$de=[...Qde,...Xj],efe={ltr:[...Yj,`ArrowRight`],rtl:[...Yj,`ArrowLeft`]},tfe={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Zj=`Menu`,[Qj,nfe,rfe]=sv(Zj),[$j,eM]=Em(Zj,[rfe,Sv,Hj]),tM=Sv(),nM=Hj(),[rM,iM]=$j(Zj),[ife,aM]=$j(Zj),oM=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=tM(t),[c,l]=z.useState(null),u=z.useRef(!1),d=dd(a),f=lv(i);return z.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,B.jsx)(Cv,{...s,children:(0,B.jsx)(rM,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,B.jsx)(ife,{scope:t,onClose:z.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};oM.displayName=Zj;var afe=`MenuAnchor`,sM=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=tM(n);return(0,B.jsx)(Ev,{...i,...r,ref:t})});sM.displayName=afe;var cM=`MenuPortal`,[ofe,lM]=$j(cM,{forceMount:void 0}),uM=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=iM(cM,t);return(0,B.jsx)(ofe,{scope:t,forceMount:n,children:(0,B.jsx)(np,{present:n||a.open,children:(0,B.jsx)(Jg,{asChild:!0,container:i,children:r})})})};uM.displayName=cM;var dM=`MenuContent`,[sfe,fM]=$j(dM),pM=z.forwardRef((e,t)=>{let n=lM(dM,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=iM(dM,e.__scopeMenu),o=aM(dM,e.__scopeMenu);return(0,B.jsx)(Qj.Provider,{scope:e.__scopeMenu,children:(0,B.jsx)(np,{present:r||a.open,children:(0,B.jsx)(Qj.Slot,{scope:e.__scopeMenu,children:o.modal?(0,B.jsx)(cfe,{...i,ref:t}):(0,B.jsx)(lfe,{...i,ref:t})})})})}),cfe=z.forwardRef((e,t)=>{let n=iM(dM,e.__scopeMenu),r=z.useRef(null),i=ac(t,r);return z.useEffect(()=>{let e=r.current;if(e)return Zm(e)},[]),(0,B.jsx)(mM,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:R(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),lfe=z.forwardRef((e,t)=>{let n=iM(dM,e.__scopeMenu);return(0,B.jsx)(mM,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),ufe=Ls(`MenuContent.ScrollLock`),mM=z.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=iM(dM,n),_=aM(dM,n),v=tM(n),y=nM(n),b=nfe(n),[x,S]=z.useState(null),C=z.useRef(null),w=ac(t,C,g.onContentChange),T=z.useRef(0),E=z.useRef(``),D=z.useRef(0),O=z.useRef(null),k=z.useRef(`right`),ee=z.useRef(0),A=m?Fd:z.Fragment,j=m?{as:ufe,allowPinchZoom:!0}:void 0,te=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Cfe(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};z.useEffect(()=>()=>window.clearTimeout(T.current),[]),Dg();let ne=z.useCallback(e=>k.current===O.current?.side&&Tfe(e,O.current?.area),[]);return(0,B.jsx)(sfe,{scope:n,searchRef:E,onItemEnter:z.useCallback(e=>{ne(e)&&e.preventDefault()},[ne]),onItemLeave:z.useCallback(e=>{ne(e)||(C.current?.focus(),S(null))},[ne]),onTriggerLeave:z.useCallback(e=>{ne(e)&&e.preventDefault()},[ne]),pointerGraceTimerRef:D,onPointerGraceIntentChange:z.useCallback(e=>{O.current=e},[]),children:(0,B.jsx)(A,{...j,children:(0,B.jsx)(Mf,{asChild:!0,trapped:i,onMountAutoFocus:R(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,B.jsx)(pg,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,B.jsx)(qj,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:R(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,B.jsx)(Tv,{role:`menu`,"aria-orientation":`vertical`,"data-state":LM(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:R(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&te(e.key));let i=C.current;if(e.target!==i||!$de.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);Xj.includes(e.key)&&a.reverse(),xfe(a)}),onBlur:R(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:R(e.onPointerMove,BM(e=>{let t=e.target,n=ee.current!==e.clientX;e.currentTarget.contains(t)&&n&&(k.current=e.clientX>ee.current?`right`:`left`,ee.current=e.clientX)}))})})})})})})});pM.displayName=dM;var dfe=`MenuGroup`,hM=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(J_.div,{role:`group`,...r,ref:t})});hM.displayName=dfe;var ffe=`MenuLabel`,gM=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(J_.div,{...r,ref:t})});gM.displayName=ffe;var _M=`MenuItem`,vM=`menu.itemSelect`,yM=z.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=z.useRef(null),o=aM(_M,e.__scopeMenu),s=fM(_M,e.__scopeMenu),c=ac(t,a),l=z.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(vM,{bubbles:!0,cancelable:!0});e.addEventListener(vM,e=>r?.(e),{once:!0}),cf(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,B.jsx)(bM,{...i,ref:c,disabled:n,onClick:R(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:R(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:R(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Yj.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});yM.displayName=_M;var bM=z.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=fM(_M,n),s=nM(n),c=z.useRef(null),l=ac(t,c),[u,d]=z.useState(!1),[f,p]=z.useState(``);return z.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,B.jsx)(Qj.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,B.jsx)(Jj,{asChild:!0,...s,focusable:!r,children:(0,B.jsx)(J_.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:R(e.onPointerMove,BM(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:R(e.onPointerLeave,BM(e=>o.onItemLeave(e))),onFocus:R(e.onFocus,()=>d(!0)),onBlur:R(e.onBlur,()=>d(!1))})})})}),pfe=`MenuCheckboxItem`,xM=z.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,B.jsx)(DM,{scope:e.__scopeMenu,checked:n,children:(0,B.jsx)(yM,{role:`menuitemcheckbox`,"aria-checked":RM(n)?`mixed`:n,...i,ref:t,"data-state":zM(n),onSelect:R(i.onSelect,()=>r?.(RM(n)?!0:!n),{checkForDefaultPrevented:!1})})})});xM.displayName=pfe;var SM=`MenuRadioGroup`,[mfe,hfe]=$j(SM,{value:void 0,onValueChange:()=>{}}),CM=z.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=dd(r);return(0,B.jsx)(mfe,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,B.jsx)(hM,{...i,ref:t})})});CM.displayName=SM;var wM=`MenuRadioItem`,TM=z.forwardRef((e,t)=>{let{value:n,...r}=e,i=hfe(wM,e.__scopeMenu),a=n===i.value;return(0,B.jsx)(DM,{scope:e.__scopeMenu,checked:a,children:(0,B.jsx)(yM,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":zM(a),onSelect:R(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});TM.displayName=wM;var EM=`MenuItemIndicator`,[DM,gfe]=$j(EM,{checked:!1}),OM=z.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=gfe(EM,n);return(0,B.jsx)(np,{present:r||RM(a.checked)||a.checked===!0,children:(0,B.jsx)(J_.span,{...i,ref:t,"data-state":zM(a.checked)})})});OM.displayName=EM;var _fe=`MenuSeparator`,kM=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,B.jsx)(J_.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});kM.displayName=_fe;var vfe=`MenuArrow`,AM=z.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=tM(n);return(0,B.jsx)(wv,{...i,...r,ref:t})});AM.displayName=vfe;var jM=`MenuSub`,[yfe,MM]=$j(jM),bfe=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=iM(jM,t),o=tM(t),[s,c]=z.useState(null),[l,u]=z.useState(null),d=dd(i);return z.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,B.jsx)(Cv,{...o,children:(0,B.jsx)(rM,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,B.jsx)(yfe,{scope:t,contentId:i_(),triggerId:i_(),trigger:s,onTriggerChange:c,children:n})})})};bfe.displayName=jM;var NM=`MenuSubTrigger`,PM=z.forwardRef((e,t)=>{let n=iM(NM,e.__scopeMenu),r=aM(NM,e.__scopeMenu),i=MM(NM,e.__scopeMenu),a=fM(NM,e.__scopeMenu),o=z.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=z.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return z.useEffect(()=>u,[u]),z.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,B.jsx)(sM,{asChild:!0,...l,children:(0,B.jsx)(bM,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?i.contentId:void 0,"data-state":LM(n.open),...e,ref:y_(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:R(e.onPointerMove,BM(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:R(e.onPointerLeave,BM(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:R(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||efe[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});PM.displayName=NM;var FM=`MenuSubContent`,IM=z.forwardRef((e,t)=>{let n=lM(dM,e.__scopeMenu),{forceMount:r=n.forceMount,align:i=`start`,...a}=e,o=iM(dM,e.__scopeMenu),s=aM(dM,e.__scopeMenu),c=MM(FM,e.__scopeMenu),l=z.useRef(null),u=ac(t,l);return(0,B.jsx)(Qj.Provider,{scope:e.__scopeMenu,children:(0,B.jsx)(np,{present:r||o.open,children:(0,B.jsx)(Qj.Slot,{scope:e.__scopeMenu,children:(0,B.jsx)(mM,{id:c.contentId,"aria-labelledby":c.triggerId,...a,ref:u,align:i,side:s.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:R(e.onFocusOutside,e=>{e.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:R(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:R(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=tfe[s.dir].includes(e.key);t&&n&&(o.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())})})})})})});IM.displayName=FM;function LM(e){return e?`open`:`closed`}function RM(e){return e===`indeterminate`}function zM(e){return RM(e)?`indeterminate`:e?`checked`:`unchecked`}function xfe(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Sfe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Cfe(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Sfe(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function wfe(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Tfe(e,t){return t?wfe({x:e.clientX,y:e.clientY},t):!1}function BM(e){return t=>t.pointerType===`mouse`?e(t):void 0}var Efe=oM,Dfe=sM,Ofe=uM,kfe=pM,Afe=hM,jfe=gM,Mfe=yM,Nfe=xM,Pfe=CM,Ffe=TM,Ife=OM,Lfe=kM,Rfe=AM,zfe=PM,Bfe=IM,VM=`DropdownMenu`,[Vfe,Hfe]=Em(VM,[eM]),HM=eM(),[Ufe,UM]=Vfe(VM),WM=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=HM(t),l=z.useRef(null),[u,d]=Jp({prop:i,defaultProp:a??!1,onChange:o,caller:VM});return(0,B.jsx)(Ufe,{scope:t,triggerId:i_(),triggerRef:l,contentId:i_(),open:u,onOpenChange:d,onOpenToggle:z.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,B.jsx)(Efe,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};WM.displayName=VM;var GM=`DropdownMenuTrigger`,KM=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=UM(GM,n),o=HM(n);return(0,B.jsx)(Dfe,{asChild:!0,...o,children:(0,B.jsx)(J_.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:y_(t,a.triggerRef),onPointerDown:R(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:R(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});KM.displayName=GM;var Wfe=`DropdownMenuPortal`,qM=e=>{let{__scopeDropdownMenu:t,...n}=e,r=HM(t);return(0,B.jsx)(Ofe,{...r,...n})};qM.displayName=Wfe;var JM=`DropdownMenuContent`,YM=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=UM(JM,n),a=HM(n),o=z.useRef(!1);return(0,B.jsx)(kfe,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:R(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:R(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});YM.displayName=JM;var Gfe=`DropdownMenuGroup`,Kfe=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=HM(n);return(0,B.jsx)(Afe,{...i,...r,ref:t})});Kfe.displayName=Gfe;var qfe=`DropdownMenuLabel`,XM=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=HM(n);return(0,B.jsx)(jfe,{...i,...r,ref:t})});XM.displayName=qfe;var Jfe=`DropdownMenuItem`,ZM=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=HM(n);return(0,B.jsx)(Mfe,{...i,...r,ref:t})});ZM.displayName=Jfe;var Yfe=`DropdownMenuCheckboxItem`,Xfe=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=HM(n);return(0,B.jsx)(Nfe,{...i,...r,ref:t})});Xfe.displayName=Yfe;var Zfe=`DropdownMenuRadioGroup`,QM=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=HM(n);return(0,B.jsx)(Pfe,{...i,...r,ref:t})});QM.displayName=Zfe;var Qfe=`DropdownMenuRadioItem`,$M=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=HM(n);return(0,B.jsx)(Ffe,{...i,...r,ref:t})});$M.displayName=Qfe;var $fe=`DropdownMenuItemIndicator`,eN=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=HM(n);return(0,B.jsx)(Ife,{...i,...r,ref:t})});eN.displayName=$fe;var epe=`DropdownMenuSeparator`,tN=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=HM(n);return(0,B.jsx)(Lfe,{...i,...r,ref:t})});tN.displayName=epe;var tpe=`DropdownMenuArrow`,npe=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=HM(n);return(0,B.jsx)(Rfe,{...i,...r,ref:t})});npe.displayName=tpe;var rpe=`DropdownMenuSubTrigger`,ipe=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=HM(n);return(0,B.jsx)(zfe,{...i,...r,ref:t})});ipe.displayName=rpe;var ape=`DropdownMenuSubContent`,ope=z.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=HM(n);return(0,B.jsx)(Bfe,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});ope.displayName=ape;var nN=WM,rN=KM,iN=qM,aN=YM,spe=XM,oN=ZM,cpe=QM,lpe=$M,upe=eN,sN=tN;function cN(e,[t,n]){return Math.min(n,Math.max(t,e))}var lN=`Popover`,[uN,dpe]=Em(lN,[Sv]),dN=Sv(),[fpe,fN]=uN(lN),pN=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=dN(t),c=z.useRef(null),[l,u]=z.useState(!1),[d,f]=Jp({prop:r,defaultProp:i??!1,onChange:a,caller:lN});return(0,B.jsx)(Cv,{...s,children:(0,B.jsx)(fpe,{scope:t,contentId:i_(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:z.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:z.useCallback(()=>u(!0),[]),onCustomAnchorRemove:z.useCallback(()=>u(!1),[]),modal:o,children:n})})};pN.displayName=lN;var mN=`PopoverAnchor`,ppe=z.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=fN(mN,n),a=dN(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return z.useEffect(()=>(o(),()=>s()),[o,s]),(0,B.jsx)(Ev,{...a,...r,ref:t})});ppe.displayName=mN;var hN=`PopoverTrigger`,gN=z.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=fN(hN,n),a=dN(n),o=ac(t,i.triggerRef),s=(0,B.jsx)(J_.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":CN(i.open),...r,ref:o,onClick:R(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,B.jsx)(Ev,{asChild:!0,...a,children:s})});gN.displayName=hN;var _N=`PopoverPortal`,[mpe,hpe]=uN(_N,{forceMount:void 0}),vN=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=fN(_N,t);return(0,B.jsx)(mpe,{scope:t,forceMount:n,children:(0,B.jsx)(np,{present:n||a.open,children:(0,B.jsx)(Jg,{asChild:!0,container:i,children:r})})})};vN.displayName=_N;var yN=`PopoverContent`,bN=z.forwardRef((e,t)=>{let n=hpe(yN,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=fN(yN,e.__scopePopover);return(0,B.jsx)(np,{present:r||a.open,children:a.modal?(0,B.jsx)(_pe,{...i,ref:t}):(0,B.jsx)(vpe,{...i,ref:t})})});bN.displayName=yN;var gpe=Ls(`PopoverContent.RemoveScroll`),_pe=z.forwardRef((e,t)=>{let n=fN(yN,e.__scopePopover),r=z.useRef(null),i=ac(t,r),a=z.useRef(!1);return z.useEffect(()=>{let e=r.current;if(e)return Zm(e)},[]),(0,B.jsx)(Fd,{as:gpe,allowPinchZoom:!0,children:(0,B.jsx)(xN,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:R(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:R(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:R(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),vpe=z.forwardRef((e,t)=>{let n=fN(yN,e.__scopePopover),r=z.useRef(!1),i=z.useRef(!1);return(0,B.jsx)(xN,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),xN=z.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=fN(yN,n),p=dN(n);return Dg(),(0,B.jsx)(Mf,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,B.jsx)(pg,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,B.jsx)(Tv,{"data-state":CN(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),SN=`PopoverClose`,ype=z.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=fN(SN,n);return(0,B.jsx)(J_.button,{type:`button`,...r,ref:t,onClick:R(e.onClick,()=>i.onOpenChange(!1))})});ype.displayName=SN;var bpe=`PopoverArrow`,xpe=z.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=dN(n);return(0,B.jsx)(wv,{...i,...r,ref:t})});xpe.displayName=bpe;function CN(e){return e?`open`:`closed`}var wN=pN,TN=gN,EN=vN,DN=bN,Spe=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Cpe=[` `,`Enter`],ON=`Select`,[kN,AN,wpe]=sv(ON),[jN,Tpe]=Em(ON,[wpe,Sv]),MN=Sv(),[Epe,NN]=jN(ON),[Dpe,Ope]=jN(ON),kpe=`SelectProvider`;function PN(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=MN(t),[_,v]=z.useState(null),[y,b]=z.useState(null),[x,S]=z.useState(!1),C=lv(l),[w,T]=Jp({prop:r,defaultProp:i??!1,onChange:a,caller:ON}),[E,D]=Jp({prop:o,defaultProp:s,onChange:c,caller:ON}),O=z.useRef(null),k=_?!!m||!!_.closest(`form`):!0,[ee,A]=z.useState(new Set),j=i_(),te=Array.from(ee).map(e=>e.props.value).join(`;`),ne=z.useCallback(e=>{A(t=>new Set(t).add(e))},[]),M=z.useCallback(e=>{A(t=>{let n=new Set(t);return n.delete(e),n})},[]),N={required:p,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:j,value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:ee,nativeSelectKey:te,isFormControl:k};return(0,B.jsx)(Cv,{...g,children:(0,B.jsx)(Epe,{scope:t,...N,children:(0,B.jsx)(kN.Provider,{scope:t,children:(0,B.jsx)(Dpe,{scope:t,onNativeOptionAdd:ne,onNativeOptionRemove:M,children:Kpe(h)?h(N):n})})})})}PN.displayName=kpe;var FN=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,B.jsx)(PN,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,B.jsxs)(B.Fragment,{children:[n,e?(0,B.jsx)(_P,{__scopeSelect:t}):null]})})};FN.displayName=ON;var IN=`SelectTrigger`,LN=z.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=MN(n),o=NN(IN,n),s=o.disabled||r,c=ac(t,o.onTriggerChange),l=AN(n),u=z.useRef(`touch`),[d,f,p]=yP(e=>{let t=l().filter(e=>!e.disabled),n=bP(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,B.jsx)(Ev,{asChild:!0,...a,children:(0,B.jsx)(J_.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":vP(o.value)?``:void 0,...i,ref:c,onClick:R(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:R(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:R(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&Spe.includes(e.key)&&(m(),e.preventDefault())})})})});LN.displayName=IN;var RN=`SelectValue`,zN=z.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=NN(RN,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=ac(t,c.onValueNodeChange);jg(()=>{l(u)},[l,u]);let f=vP(c.value);return(0,B.jsx)(J_.span,{...s,asChild:f?!1:s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,B.jsx)(z.Fragment,{children:f?o:a},f?`placeholder`:`value`)})});zN.displayName=RN;var Ape=`SelectIcon`,BN=z.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,B.jsx)(J_.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});BN.displayName=Ape;var VN=`SelectPortal`,[jpe,Mpe]=jN(VN,{forceMount:void 0}),HN=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,B.jsx)(jpe,{scope:e.__scopeSelect,forceMount:n,children:(0,B.jsx)(Jg,{asChild:!0,...r})})};HN.displayName=VN;var UN=`SelectContent`,WN=z.forwardRef((e,t)=>{let n=Mpe(UN,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=NN(UN,e.__scopeSelect),[o,s]=z.useState();return jg(()=>{s(new DocumentFragment)},[]),(0,B.jsx)(np,{present:r||a.open,children:({present:e})=>e?(0,B.jsx)(YN,{...i,ref:t}):(0,B.jsx)(GN,{...i,fragment:o})})});WN.displayName=UN;var GN=z.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?Ex.createPortal((0,B.jsx)(qN,{scope:n,children:(0,B.jsx)(kN.Slot,{scope:n,children:(0,B.jsx)(`div`,{ref:t,children:r})})}),i):null});GN.displayName=`SelectContentFragment`;var KN=10,[qN,JN]=jN(UN),Npe=`SelectContentImpl`,Ppe=Ls(`SelectContent.RemoveScroll`),YN=z.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=NN(UN,n),[y,b]=z.useState(null),[x,S]=z.useState(null),C=ac(t,e=>b(e)),[w,T]=z.useState(null),[E,D]=z.useState(null),O=AN(n),[k,ee]=z.useState(!1),A=z.useRef(!1);z.useEffect(()=>{if(y)return Zm(y)},[y]),Dg();let j=z.useCallback(e=>{let[t,...n]=O().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,x]),te=z.useCallback(()=>j([w,y]),[j,w,y]);z.useEffect(()=>{k&&te()},[k,te]);let{onOpenChange:ne,triggerPointerDownPosRef:M}=v;z.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(M.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(M.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(y)||ne(!1),document.removeEventListener(`pointermove`,t),M.current=null};return M.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,ne,M]),z.useEffect(()=>{let e=()=>ne(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[ne]);let[N,re]=yP(e=>{let t=O().filter(e=>!e.disabled),n=bP(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ie=z.useCallback((e,t,n)=>{let r=!A.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(A.current=!0))},[v.value]),ae=z.useCallback(()=>y?.focus(),[y]),oe=z.useCallback((e,t,n)=>{let r=!A.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),se=r===`popper`?ZN:XN,ce=se===ZN?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,B.jsx)(qN,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:ie,selectedItem:w,onItemLeave:ae,itemTextRefCallback:oe,focusSelectedItem:te,selectedItemText:E,position:r,isPositioned:k,searchRef:N,children:(0,B.jsx)(Fd,{as:Ppe,allowPinchZoom:!0,children:(0,B.jsx)(Mf,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:R(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,B.jsx)(pg,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,B.jsx)(se,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...ce,onPlaced:()=>ee(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:R(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&re(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>j(t)),e.preventDefault()}})})})})})})});YN.displayName=Npe;var Fpe=`SelectItemAlignedPosition`,XN=z.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=NN(UN,n),o=JN(UN,n),[s,c]=z.useState(null),[l,u]=z.useState(null),d=ac(t,e=>u(e)),f=AN(n),p=z.useRef(!1),m=z.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:v}=o,y=z.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-KN,d=cN(a,[KN,Math.max(KN,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-KN,d=cN(a,[KN,Math.max(KN,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-KN*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-KN,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,ee=m+v+k,A=x-ee;if(ee<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=ee+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+A;s.style.height=t+`px`,h.scrollTop=ee-E+h.offsetTop}s.style.margin=`${KN}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);jg(()=>y(),[y]);let[b,x]=z.useState();return jg(()=>{l&&x(window.getComputedStyle(l).zIndex)},[l]),(0,B.jsx)(Lpe,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:z.useCallback(e=>{e&&m.current===!0&&(y(),v?.(),m.current=!1)},[y,v]),children:(0,B.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:b},children:(0,B.jsx)(J_.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});XN.displayName=Fpe;var Ipe=`SelectPopperPosition`,ZN=z.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=KN,...a}=e,o=MN(n);return(0,B.jsx)(Tv,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});ZN.displayName=Ipe;var[Lpe,QN]=jN(UN,{}),$N=`SelectViewport`,eP=z.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=JN($N,n),o=QN($N,n),s=ac(t,a.onViewportChange),c=z.useRef(0);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,B.jsx)(kN.Slot,{scope:n,children:(0,B.jsx)(J_.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:R(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-KN*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});eP.displayName=$N;var tP=`SelectGroup`,[Rpe,zpe]=jN(tP),Bpe=z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=i_();return(0,B.jsx)(Rpe,{scope:n,id:i,children:(0,B.jsx)(J_.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Bpe.displayName=tP;var nP=`SelectLabel`,Vpe=z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=zpe(nP,n);return(0,B.jsx)(J_.div,{id:i.id,...r,ref:t})});Vpe.displayName=nP;var rP=`SelectItem`,[Hpe,iP]=jN(rP),aP=z.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=NN(rP,n),c=JN(rP,n),l=s.value===r,[u,d]=z.useState(a??``),[f,p]=z.useState(!1),m=ac(t,e=>c.itemRefCallback?.(e,r,i)),h=i_(),g=z.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,B.jsx)(Hpe,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:z.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,B.jsx)(kN.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,B.jsx)(J_.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:R(o.onFocus,()=>p(!0)),onBlur:R(o.onBlur,()=>p(!1)),onClick:R(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:R(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:R(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:R(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:R(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:R(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(Cpe.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});aP.displayName=rP;var oP=`SelectItemText`,sP=z.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=NN(oP,n),s=JN(oP,n),c=iP(oP,n),l=Ope(oP,n),[u,d]=z.useState(null),f=ac(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=z.useMemo(()=>(0,B.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return jg(()=>(h(m),()=>g(m)),[h,g,m]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(J_.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Ex.createPortal(a.children,o.valueNode):null]})});sP.displayName=oP;var cP=`SelectItemIndicator`,lP=z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return iP(cP,n).isSelected?(0,B.jsx)(J_.span,{"aria-hidden":!0,...r,ref:t}):null});lP.displayName=cP;var uP=`SelectScrollUpButton`,dP=z.forwardRef((e,t)=>{let n=JN(uP,e.__scopeSelect),r=QN(uP,e.__scopeSelect),[i,a]=z.useState(!1),o=ac(t,r.onScrollButtonChange);return jg(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,B.jsx)(mP,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});dP.displayName=uP;var fP=`SelectScrollDownButton`,pP=z.forwardRef((e,t)=>{let n=JN(fP,e.__scopeSelect),r=QN(fP,e.__scopeSelect),[i,a]=z.useState(!1),o=ac(t,r.onScrollButtonChange);return jg(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,B.jsx)(mP,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});pP.displayName=fP;var mP=z.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=JN(`SelectScrollButton`,n),o=z.useRef(null),s=AN(n),c=z.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return z.useEffect(()=>()=>c(),[c]),jg(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,B.jsx)(J_.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:R(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:R(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:R(i.onPointerLeave,()=>{c()})})}),Upe=`SelectSeparator`,Wpe=z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,B.jsx)(J_.div,{"aria-hidden":!0,...r,ref:t})});Wpe.displayName=Upe;var hP=`SelectArrow`,Gpe=z.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=MN(n);return JN(hP,n).position===`popper`?(0,B.jsx)(wv,{...i,...r,ref:t}):null});Gpe.displayName=hP;var gP=`SelectBubbleInput`,_P=z.forwardRef(({__scopeSelect:e,...t},n)=>{let r=NN(gP,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=z.useRef(null),m=ac(n,p),h=i??``,g=Ej(h);return z.useEffect(()=>{let e=p.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(g!==h&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,h),e.dispatchEvent(t)}},[g,h]),(0,B.jsxs)(J_.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...uj,...t.style},ref:m,defaultValue:h,children:[vP(i)?(0,B.jsx)(`option`,{value:``}):null,Array.from(d)]},f)});_P.displayName=gP;function Kpe(e){return typeof e==`function`}function vP(e){return e===``||e===void 0}function yP(e){let t=dd(e),n=z.useRef(``),r=z.useRef(0),i=z.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=z.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return z.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function bP(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=qpe(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function qpe(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var xP=`Tabs`,[Jpe,Ype]=Em(xP,[Hj]),SP=Hj(),[Xpe,CP]=Jpe(xP),wP=z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=lv(s),[d,f]=Jp({prop:r,onChange:i,defaultProp:a??``,caller:xP});return(0,B.jsx)(Xpe,{scope:n,baseId:i_(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,B.jsx)(J_.div,{dir:u,"data-orientation":o,...l,ref:t})})});wP.displayName=xP;var TP=`TabsList`,EP=z.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=CP(TP,n),o=SP(n);return(0,B.jsx)(qj,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,B.jsx)(J_.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});EP.displayName=TP;var DP=`TabsTrigger`,OP=z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=CP(DP,n),s=SP(n),c=jP(o.baseId,r),l=MP(o.baseId,r),u=r===o.value;return(0,B.jsx)(Jj,{asChild:!0,...s,focusable:!i,active:u,children:(0,B.jsx)(J_.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:R(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:R(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:R(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});OP.displayName=DP;var kP=`TabsContent`,AP=z.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=CP(kP,n),c=jP(s.baseId,r),l=MP(s.baseId,r),u=r===s.value,d=z.useRef(u);return z.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,B.jsx)(np,{present:i||u,children:({present:n})=>(0,B.jsx)(J_.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});AP.displayName=kP;function jP(e,t){return`${e}-trigger-${t}`}function MP(e,t){return`${e}-content-${t}`}var Zpe=wP,Qpe=EP,$pe=OP,eme=AP,[NP,tme]=Em(`Tooltip`,[Sv]),PP=Sv(),FP=`TooltipProvider`,nme=700,IP=`tooltip.open`,[rme,LP]=NP(FP),RP=e=>{let{__scopeTooltip:t,delayDuration:n=nme,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=z.useRef(!0),s=z.useRef(!1),c=z.useRef(0);return z.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,B.jsx)(rme,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:z.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:z.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:z.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};RP.displayName=FP;var zP=`Tooltip`,[ime,BP]=NP(zP),VP=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=LP(zP,e.__scopeTooltip),l=PP(t),[u,d]=z.useState(null),f=i_(),p=z.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=z.useRef(!1),[_,v]=Jp({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(IP))):c.onClose(),a?.(e)},caller:zP}),y=z.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=z.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=z.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=z.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return z.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,B.jsx)(Cv,{...l,children:(0,B.jsx)(ime,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:z.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:z.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};VP.displayName=zP;var HP=`TooltipTrigger`,UP=z.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=BP(HP,n),a=LP(HP,n),o=PP(n),s=ac(t,z.useRef(null),i.onTriggerChange),c=z.useRef(!1),l=z.useRef(!1),u=z.useCallback(()=>c.current=!1,[]);return z.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,B.jsx)(Ev,{asChild:!0,...o,children:(0,B.jsx)(J_.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:R(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:R(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:R(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:R(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:R(e.onBlur,i.onClose),onClick:R(e.onClick,i.onClose)})})});UP.displayName=HP;var WP=`TooltipPortal`,[ame,ome]=NP(WP,{forceMount:void 0}),GP=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=BP(WP,t);return(0,B.jsx)(ame,{scope:t,forceMount:n,children:(0,B.jsx)(np,{present:n||a.open,children:(0,B.jsx)(Jg,{asChild:!0,container:i,children:r})})})};GP.displayName=WP;var KP=`TooltipContent`,qP=z.forwardRef((e,t)=>{let n=ome(KP,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=BP(KP,e.__scopeTooltip);return(0,B.jsx)(np,{present:r||o.open,children:o.disableHoverableContent?(0,B.jsx)(JP,{side:i,...a,ref:t}):(0,B.jsx)(sme,{side:i,...a,ref:t})})}),sme=z.forwardRef((e,t)=>{let n=BP(KP,e.__scopeTooltip),r=LP(KP,e.__scopeTooltip),i=z.useRef(null),a=ac(t,i),[o,s]=z.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=z.useCallback(()=>{s(null),d(!1)},[d]),p=z.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=fme(r,dme(r,n.getBoundingClientRect())),a=pme(t.getBoundingClientRect());s(hme([...i,...a])),d(!0)},[d]);return z.useEffect(()=>()=>f(),[f]),z.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),z.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!mme(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,B.jsx)(JP,{...e,ref:a})}),[cme,lme]=NP(zP,{isInside:!1}),ume=We(`TooltipContent`),JP=z.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=BP(KP,n),l=PP(n),{onClose:u}=c;return z.useEffect(()=>(document.addEventListener(IP,u),()=>document.removeEventListener(IP,u)),[u]),z.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,B.jsx)(pg,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,B.jsxs)(Tv,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,B.jsx)(ume,{children:r}),(0,B.jsx)(cme,{scope:n,isInside:!0,children:(0,B.jsx)(_de,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});qP.displayName=KP;var YP=`TooltipArrow`,XP=z.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=PP(n);return lme(YP,n).isInside?null:(0,B.jsx)(wv,{...i,...r,ref:t})});XP.displayName=YP;function dme(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function fme(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function pme(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function mme(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function hme(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),gme(t)}function gme(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var _me=RP,vme=VP,yme=UP,bme=GP,xme=qP,Sme=XP,ZP=Hfe(),QP=e=>{let t=V(25),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({__scopeActionBarMore:n,open:i,onOpenChange:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=ZP(n),s=$ue(),c=fT(null),l=i!==void 0,u;t[5]===s?u=t[6]:(u=e=>{if(e){if(c.current)return;c.current=s?.acquireInteractionLock()??null;return}c.current?.(),c.current=null},t[5]=s,t[6]=u);let d=u,f;t[7]!==l||t[8]!==r||t[9]!==d?(f=e=>{l||d(e),r?.(e)},t[7]=l,t[8]=r,t[9]=d,t[10]=f):f=t[10];let p=f,m,h;t[11]!==l||t[12]!==i||t[13]!==d?(m=()=>{l&&d(!!i)},h=[l,i,d],t[11]=l,t[12]=i,t[13]=d,t[14]=m,t[15]=h):(m=t[14],h=t[15]),hT(m,h);let g,_;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>()=>{c.current?.(),c.current=null},_=[],t[16]=g,t[17]=_):(g=t[16],_=t[17]),hT(g,_);let v;t[18]===i?v=t[19]:(v=i===void 0?null:{open:i},t[18]=i,t[19]=v);let y;return t[20]!==p||t[21]!==a||t[22]!==o||t[23]!==v?(y=(0,B.jsx)(nN,{...o,...a,...v,onOpenChange:p}),t[20]=p,t[21]=a,t[22]=o,t[23]=v,t[24]=y):y=t[24],y};QP.displayName=`ActionBarMorePrimitive.Root`;var Cme=$A(rN),wme=$A(aN),Tme=$A(oN),Eme=$A(sN),$P=(0,sT.forwardRef)((e,t)=>{let n=V(7),r,i;n[0]===e?(r=n[1],i=n[2]):({__scopeActionBarMore:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=ZP(r),o;return n[3]!==t||n[4]!==i||n[5]!==a?(o=(0,B.jsx)(Cme,{...a,...i,ref:t}),n[3]=t,n[4]=i,n[5]=a,n[6]=o):o=n[6],o});$P.displayName=`ActionBarMorePrimitive.Trigger`;var eF=(0,sT.forwardRef)((e,t)=>{let n=V(14),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({__scopeActionBarMore:r,portalProps:i,sideOffset:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s=o===void 0?4:o,c=ZP(r),l;n[5]!==t||n[6]!==a||n[7]!==c||n[8]!==s?(l=(0,B.jsx)(wme,{...c,...a,ref:t,sideOffset:s}),n[5]=t,n[6]=a,n[7]=c,n[8]=s,n[9]=l):l=n[9];let u;return n[10]!==i||n[11]!==c||n[12]!==l?(u=(0,B.jsx)(iN,{...c,...i,children:l}),n[10]=i,n[11]=c,n[12]=l,n[13]=u):u=n[13],u});eF.displayName=`ActionBarMorePrimitive.Content`;var tF=(0,sT.forwardRef)((e,t)=>{let n=V(7),r,i;n[0]===e?(r=n[1],i=n[2]):({__scopeActionBarMore:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=ZP(r),o;return n[3]!==t||n[4]!==i||n[5]!==a?(o=(0,B.jsx)(Tme,{...a,...i,ref:t}),n[3]=t,n[4]=i,n[5]=a,n[6]=o):o=n[6],o});tF.displayName=`ActionBarMorePrimitive.Item`;var nF=(0,sT.forwardRef)((e,t)=>{let n=V(7),r,i;n[0]===e?(r=n[1],i=n[2]):({__scopeActionBarMore:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=ZP(r),o;return n[3]!==t||n[4]!==i||n[5]!==a?(o=(0,B.jsx)(Eme,{...a,...i,ref:t}),n[3]=t,n[4]=i,n[5]=a,n[6]=o):o=n[6],o});nF.displayName=`ActionBarMorePrimitive.Separator`;var rF=QA({Content:()=>eF,Item:()=>tF,Root:()=>QP,Separator:()=>nF,Trigger:()=>$P}),iF=(0,sT.forwardRef)((e,t)=>{let n=V(3),r;return n[0]!==e||n[1]!==t?(r=(0,B.jsx)(ej.div,{...e,ref:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],r});iF.displayName=`AttachmentPrimitive.Root`;var aF=(0,sT.forwardRef)((e,t)=>{let n=V(4),r=H(Dme),i;return n[0]!==r||n[1]!==e||n[2]!==t?(i=(0,B.jsxs)(ej.div,{...e,ref:t,children:[`.`,r]}),n[0]=r,n[1]=e,n[2]=t,n[3]=i):i=n[3],i});aF.displayName=`AttachmentPrimitive.unstable_Thumb`;function Dme(e){let t=e.attachment.name.split(`.`);return t.length>1?t.pop():``}var oF=()=>{let e=V(2),t=H(Ome),n;return e[0]===t?n=e[1]:(n=(0,B.jsx)(B.Fragment,{children:t}),e[0]=t,e[1]=n),n};oF.displayName=`AttachmentPrimitive.Name`;function Ome(e){return e.attachment.name}var kme=ij(`AttachmentPrimitive.Remove`,()=>{let e=V(2),t=CE(),n;return e[0]===t?n=e[1]:(n=()=>{t.attachment().remove()},e[0]=t,e[1]=n),n}),sF=QA({Name:()=>oF,Remove:()=>kme,Root:()=>iF,unstable_Thumb:()=>aF}),Ame=e=>{let t=V(12),n;return t[0]!==e.assistant||t[1]!==e.copied||t[2]!==e.hasAttachments||t[3]!==e.hasBranches||t[4]!==e.hasContent||t[5]!==e.last||t[6]!==e.lastOrHover||t[7]!==e.speaking||t[8]!==e.submittedFeedback||t[9]!==e.system||t[10]!==e.user?(n=t=>{let{role:n,attachments:r,parts:i,branchCount:a,isLast:o,speech:s,isCopied:c,isHovering:l}=t.message;return!(e.hasBranches===!0&&a<2||e.user&&n!==`user`||e.assistant&&n!==`assistant`||e.system&&n!==`system`||e.lastOrHover===!0&&!l&&!o||e.last!==void 0&&e.last!==o||e.copied===!0&&!c||e.copied===!1&&c||e.speaking===!0&&s==null||e.speaking===!1&&s!=null||e.hasAttachments===!0&&(n!==`user`||!r?.length)||e.hasAttachments===!1&&n===`user`&&r?.length||e.hasContent===!0&&i.length===0||e.hasContent===!1&&i.length>0||e.submittedFeedback!==void 0&&(t.message.metadata.submittedFeedback?.type??null)!==e.submittedFeedback)},t[0]=e.assistant,t[1]=e.copied,t[2]=e.hasAttachments,t[3]=e.hasBranches,t[4]=e.hasContent,t[5]=e.last,t[6]=e.lastOrHover,t[7]=e.speaking,t[8]=e.submittedFeedback,t[9]=e.system,t[10]=e.user,t[11]=n):n=t[11],H(n)},cF=e=>{let t=V(3),n,r;return t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),Ame(r)?n:null};cF.displayName=`MessagePrimitive.If`;var lF=bT(null),uF=()=>ST(lF),jme=e=>{let t=V(8),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=new Map,t[0]=r):r=t[0];let i=fT(r),a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=[],t[1]=a):a=t[1];let o=fT(a),s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{let e=Array.from(i.current.entries());e.sort(Mme),o.current=e.map(Nme)},t[2]=s):s=t[2];let c=s,l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(e,t)=>{let n=t?.priority??0;return i.current.set(e,n),c(),()=>{i.current.delete(e),c()}},t[3]=l):l=t[3];let u=l,d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>o.current,t[4]=d):d=t[4];let f=d,p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p={register:u,getPlugins:f},t[5]=p):p=t[5];let m=p,h;return t[6]===n?h=t[7]:(h=(0,B.jsx)(lF.Provider,{value:m,children:n}),t[6]=n,t[7]=h),h};function Mme(e,t){return t[1]-e[1]}function Nme(e){let[t]=e;return t}var dF=bT(null),fF=bT(null),pF=()=>{let e=ST(dF);if(!e)throw Error(`useTriggerPopoverRootContext must be used within ComposerPrimitive.TriggerPopoverRoot`);return e},mF=()=>ST(dF),Pme=()=>{let e=ST(fF);if(!e)throw Error(`useTriggerPopoverAriaPublish must be used within ComposerPrimitive.TriggerPopoverRoot`);return e},Fme=()=>{let e=pF();return vT(e.subscribe,e.getTriggers,e.getTriggers)},Ime=new Map,hF=()=>()=>{},gF=()=>Ime,Lme=()=>{let e=mF();return vT(e?e.subscribe:hF,e?e.getTriggers:gF,e?e.getTriggers:gF)},_F=()=>null,Rme=()=>{let e=mF();return vT(e?e.subscribeAria:hF,e?e.getActiveAria:_F,e?e.getActiveAria:_F)};function vF(){let e=V(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=new Set,e[0]=t):t=e[0];let n=fT(t),r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{for(let e of n.current)e()},e[1]=r):r=e[1];let i=r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=e=>(n.current.add(e),()=>{n.current.delete(e)}),e[2]=a):a=e[2];let o=a,s;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s={notify:i,subscribe:o},e[3]=s):s=e[3],s}var yF=e=>{let t=V(21),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=new Map,t[0]=r):r=t[0];let i=fT(r),a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=new Set,t[1]=a):a=t[1];let o=fT(a),{notify:s,subscribe:c}=vF(),l;t[2]===s?l=t[3]:(l=e=>{let{char:t}=e;if(i.current.has(t))return zme;let n=new Map(i.current);n.set(t,e),i.current=n,s();for(let t of o.current)t.added(e);return()=>{let e=new Map(i.current);e.delete(t),i.current=e,s();for(let e of o.current)e.removed(t)}},t[2]=s,t[3]=l);let u=l,d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>i.current,t[4]=d):d=t[4];let f=d,p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>(o.current.add(e),()=>{o.current.delete(e)}),t[5]=p):p=t[5];let m=p,h=fT(null),g=fT(null),{notify:_,subscribe:v}=vF(),y;t[6]===_?y=t[7]:(y=(e,t)=>{if(t===null){if(g.current!==e)return;h.current=null,g.current=null,_();return}let n=h.current;g.current===e&&n!==null&&n.popoverId===t.popoverId&&n.highlightedItemId===t.highlightedItemId||(h.current=t,g.current=e,_())},t[6]=_,t[7]=y);let b=y,x;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>h.current,t[8]=x):x=t[8];let S=x,C;t[9]!==u||t[10]!==c||t[11]!==v?(C={register:u,getTriggers:f,subscribe:c,subscribeLifecycle:m,getActiveAria:S,subscribeAria:v},t[9]=u,t[10]=c,t[11]=v,t[12]=C):C=t[12];let w=C,T;t[13]===b?T=t[14]:(T={setActiveAria:b},t[13]=b,t[14]=T);let E=T,D;t[15]!==E||t[16]!==n?(D=(0,B.jsx)(fF.Provider,{value:E,children:n}),t[15]=E,t[16]=n,t[17]=D):D=t[17];let O;return t[18]!==D||t[19]!==w?(O=(0,B.jsx)(dF.Provider,{value:w,children:D}),t[18]=D,t[19]=w,t[20]=O):O=t[20],O},bF=e=>{let t=V(4),{children:n}=e;if(uF()){let e;return t[0]===n?e=t[1]:(e=(0,B.jsx)(yF,{children:n}),t[0]=n,t[1]=e),e}let r;return t[2]===n?r=t[3]:(r=(0,B.jsx)(jme,{children:(0,B.jsx)(yF,{children:n})}),t[2]=n,t[3]=r),r};bF.displayName=`ComposerPrimitive.TriggerPopoverRoot`;function zme(){}var xF=/\s/u;function Bme(e,t,n){let r=e.slice(0,n);for(let e=r.length-1;e>=0;e--){let n=r[e];if(xF.test(n))return null;if(r.startsWith(t,e)){if(e>0&&!xF.test(r[e-1]))continue;return{query:r.slice(e+t.length),offset:e}}}return null}var Vme=ET(e=>{let t=V(7),{text:n,triggerChar:r}=e,[i,a]=uT(n.length),o=Math.min(i,n.length),s;t[0]!==o||t[1]!==n||t[2]!==r?(s=Bme(n,r,o),t[0]=o,t[1]=n,t[2]=r,t[3]=s):s=t[3];let c=s,l=c?.query??``,u;return t[4]!==l||t[5]!==c?(u={trigger:c,query:l,setCursorPosition:a},t[4]=l,t[5]=c,t[6]=u):u=t[6],u});function Hme(e){return`type`in e}var Ume=ET(e=>{let t=V(25),{navigableList:n,isSearchMode:r,activeCategoryId:i,query:a,popoverId:o,open:s,selectItem:c,selectCategory:l,goBack:u,close:d}=e,[f,p]=uT(0),m;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{p(0)},t[0]=m):m=t[0];let h;t[1]===n?h=t[2]:(h=[n],t[1]=n,t[2]=h),hT(m,h);let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{p(0)},t[3]=g):g=t[3];let _;t[4]!==i||t[5]!==r?(_=[r,i],t[4]=i,t[5]=r,t[6]=_):_=t[6],hT(g,_);let v;t[7]!==f||t[8]!==n.length?(v=e=>{e<0||e>=n.length||e!==f&&p(e)},t[7]=f,t[8]=n.length,t[9]=v):v=t[9];let y=_T(v),b;t[10]!==i||t[11]!==d||t[12]!==u||t[13]!==f||t[14]!==n||t[15]!==s||t[16]!==a||t[17]!==l||t[18]!==c?(b=e=>{if(!s)return!1;switch(e.key){case`ArrowDown`:return e.preventDefault(),p(e=>{let t=n.length;return t===0?0:e<t-1?e+1:0}),!0;case`ArrowUp`:return e.preventDefault(),p(e=>{let t=n.length;return t===0?0:e>0?e-1:t-1}),!0;case`Enter`:case`Tab`:{if(e.shiftKey)return!1;e.preventDefault();let t=n[f];return t&&(Hme(t)?c(t):l(t.id)),!0}case`Escape`:return e.preventDefault(),d(),!0;case`Backspace`:return i&&a===``?(e.preventDefault(),u(),!0):!1;default:return!1}},t[10]=i,t[11]=d,t[12]=u,t[13]=f,t[14]=n,t[15]=s,t[16]=a,t[17]=l,t[18]=c,t[19]=b):b=t[19];let x=_T(b),S=n[f],C=s&&S?`${o}-option-${S.id}`:void 0,w;return t[20]!==x||t[21]!==y||t[22]!==f||t[23]!==C?(w={highlightedIndex:f,highlightedItemId:C,highlightIndex:y,handleKeyDown:x},t[20]=x,t[21]=y,t[22]=f,t[23]=C,t[24]=w):w=t[24],w});function SF(e,t){return e.id.toLowerCase().includes(t)||e.label.toLowerCase().includes(t)||(e.description?.toLowerCase().includes(t)??!1)}var Wme=ET(e=>{let t=V(38),{adapter:n,query:r,open:i}=e,[a,o]=uT(null),s,c;t[0]===i?(s=t[1],c=t[2]):(s=()=>{i||o(null)},c=[i],t[0]=i,t[1]=s,t[2]=c),hT(s,c);let l;bb0:{if(!i||!n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[3]=e):e=t[3],l=e;break bb0}let e;t[4]===n?e=t[5]:(e=n.categories(),t[4]=n,t[5]=e),l=e}let u=l,d=i?a:null,f;bb1:{if(!d||!n){let e;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[6]=e):e=t[6],f=e;break bb1}let e;t[7]!==n||t[8]!==d?(e=n.categoryItems(d),t[7]=n,t[8]=d,t[9]=e):e=t[9],f=e}let p=f,m;bb2:{if(!i||!n||d){m=null;break bb2}if(!r&&u.length>0){m=null;break bb2}if(n.search){let e;t[10]!==n||t[11]!==r?(e=n.search(r),t[10]=n,t[11]=r,t[12]=e):e=t[12],m=e;break bb2}let e;if(t[13]!==n||t[14]!==u||t[15]!==r){e=[];let i=r.toLowerCase();for(let t of u)for(let r of n.categoryItems(t.id))SF(r,i)&&e.push(r);t[13]=n,t[14]=u,t[15]=r,t[16]=e}else e=t[16];m=e}let h=m,g=h!==null,_;bb3:{if(g){let e;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[17]=e):e=t[17],_=e;break bb3}if(!r){_=u;break bb3}let e;if(t[18]!==u||t[19]!==r){let n=r.toLowerCase();e=u.filter(e=>e.label.toLowerCase().includes(n)),t[18]=u,t[19]=r,t[20]=e}else e=t[20];_=e}let v=_,y;bb4:{if(g){let e;t[21]===h?e=t[22]:(e=h??[],t[21]=h,t[22]=e),y=e;break bb4}if(!r){y=p;break bb4}let e;if(t[23]!==p||t[24]!==r){let n=r.toLowerCase();e=p.filter(e=>SF(e,n)),t[23]=p,t[24]=r,t[25]=e}else e=t[25];y=e}let b=y,x;bb5:{if(g){let e;t[26]===h?e=t[27]:(e=h??[],t[26]=h,t[27]=e),x=e;break bb5}if(d){x=b;break bb5}x=v}let S=x,C;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{o(e)},t[28]=C):C=t[28];let w=_T(C),T;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{o(null)},t[29]=T):T=t[29];let E=_T(T),D;return t[30]!==d||t[31]!==v||t[32]!==b||t[33]!==E||t[34]!==g||t[35]!==S||t[36]!==w?(D={categories:v,items:b,isSearchMode:g,activeCategoryId:d,navigableList:S,selectCategory:w,goBack:E},t[30]=d,t[31]=v,t[32]=b,t[33]=E,t[34]=g,t[35]=S,t[36]=w,t[37]=D):D=t[37],D}),Gme=ET(e=>{let t=V(15),{behavior:n,trigger:r,aui:i,triggerChar:a,setCursorPosition:o,onSelected:s}=e,c=fT(null),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=e=>(c.current=e,()=>{c.current===e&&(c.current=null)}),t[0]=l):l=t[0];let u=_T(l),d;t[1]!==i||t[2]!==n||t[3]!==s||t[4]!==r||t[5]!==a?(d=e=>{if(!r||!n)return;if(c.current?.(e)){s();return}let t=i.composer().getState().text,o=t.slice(0,r.offset),l=t.slice(r.offset+a.length+r.query.length),u=()=>{let t=n.formatter.serialize(e);i.composer().setText(o+t+(l.startsWith(` `)?l:` ${l}`))};n.kind===`directive`?(u(),n.onInserted?.(e)):(n.removeOnExecute?i.composer().setText(o+(l.startsWith(` `)?l.slice(1):l)):u(),n.onExecute(e)),s()},t[1]=i,t[2]=n,t[3]=s,t[4]=r,t[5]=a,t[6]=d):d=t[6];let f=_T(d),p;t[7]!==s||t[8]!==o||t[9]!==r?(p=()=>{s(),r&&o(r.offset)},t[7]=s,t[8]=o,t[9]=r,t[10]=p):p=t[10];let m=_T(p),h;return t[11]!==m||t[12]!==u||t[13]!==f?(h={selectItem:f,close:m,registerSelectItemOverride:u},t[11]=m,t[12]=u,t[13]=f,t[14]=h):h=t[14],h}),Kme=ET(e=>{let t=V(46),{adapter:n,text:r,triggerChar:i,behavior:a,aui:o,popoverId:s,isLoading:c}=e,l;t[0]!==r||t[1]!==i?(l=Vme({text:r,triggerChar:i}),t[0]=r,t[1]=i,t[2]=l):l=t[2];let u=HT(l),d=u.trigger!==null&&n!==void 0&&a!==void 0,f;t[3]!==n||t[4]!==u.query||t[5]!==d?(f=Wme({adapter:n,query:u.query,open:d}),t[3]=n,t[4]=u.query,t[5]=d,t[6]=f):f=t[6];let p=HT(f),m;t[7]===p?m=t[8]:(m=()=>{p.goBack()},t[7]=p,t[8]=m);let h=_T(m),g;t[9]!==o||t[10]!==a||t[11]!==u.setCursorPosition||t[12]!==u.trigger||t[13]!==h||t[14]!==i?(g=Gme({behavior:a,trigger:u.trigger,aui:o,triggerChar:i,setCursorPosition:u.setCursorPosition,onSelected:h}),t[9]=o,t[10]=a,t[11]=u.setCursorPosition,t[12]=u.trigger,t[13]=h,t[14]=i,t[15]=g):g=t[15];let _=HT(g),v;t[16]!==u.query||t[17]!==p.activeCategoryId||t[18]!==p.goBack||t[19]!==p.isSearchMode||t[20]!==p.navigableList||t[21]!==p.selectCategory||t[22]!==d||t[23]!==s||t[24]!==_.close||t[25]!==_.selectItem?(v=Ume({navigableList:p.navigableList,isSearchMode:p.isSearchMode,activeCategoryId:p.activeCategoryId,query:u.query,popoverId:s,open:d,selectItem:_.selectItem,selectCategory:p.selectCategory,goBack:p.goBack,close:_.close}),t[16]=u.query,t[17]=p.activeCategoryId,t[18]=p.goBack,t[19]=p.isSearchMode,t[20]=p.navigableList,t[21]=p.selectCategory,t[22]=d,t[23]=s,t[24]=_.close,t[25]=_.selectItem,t[26]=v):v=t[26];let y=HT(v),b;return t[27]!==u.query||t[28]!==u.setCursorPosition||t[29]!==c||t[30]!==y.handleKeyDown||t[31]!==y.highlightIndex||t[32]!==y.highlightedIndex||t[33]!==y.highlightedItemId||t[34]!==p.activeCategoryId||t[35]!==p.categories||t[36]!==p.goBack||t[37]!==p.isSearchMode||t[38]!==p.items||t[39]!==p.selectCategory||t[40]!==d||t[41]!==s||t[42]!==_.close||t[43]!==_.registerSelectItemOverride||t[44]!==_.selectItem?(b={open:d,query:u.query,activeCategoryId:p.activeCategoryId,categories:p.categories,items:p.items,highlightedIndex:y.highlightedIndex,isSearchMode:p.isSearchMode,isLoading:c,popoverId:s,highlightedItemId:y.highlightedItemId,selectCategory:p.selectCategory,goBack:p.goBack,selectItem:_.selectItem,close:_.close,highlightIndex:y.highlightIndex,handleKeyDown:y.handleKeyDown,setCursorPosition:u.setCursorPosition,registerSelectItemOverride:_.registerSelectItemOverride},t[27]=u.query,t[28]=u.setCursorPosition,t[29]=c,t[30]=y.handleKeyDown,t[31]=y.highlightIndex,t[32]=y.highlightedIndex,t[33]=y.highlightedItemId,t[34]=p.activeCategoryId,t[35]=p.categories,t[36]=p.goBack,t[37]=p.isSearchMode,t[38]=p.items,t[39]=p.selectCategory,t[40]=d,t[41]=s,t[42]=_.close,t[43]=_.registerSelectItemOverride,t[44]=_.selectItem,t[45]=b):b=t[45],b}),CF=bT(null),wF=()=>{let e=ST(CF);if(!e)throw Error(`useTriggerPopoverScopeContext must be used within ComposerPrimitive.TriggerPopover`);return e},qme=()=>ST(CF),TF=bT(null),EF=()=>{let e=ST(TF);if(!e)throw Error(`TriggerPopover.Directive / TriggerPopover.Action must be rendered inside ComposerPrimitive.TriggerPopover`);return e},DF=(0,sT.forwardRef)((e,t)=>{let n=V(61),r,i,a,o,s,c;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=n[6]):({char:a,adapter:r,isLoading:c,"aria-label":i,children:o,...s}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s,n[6]=c);let l=c===void 0?!1:c,u=CE(),d=H(Jme),f=(0,sT.useId)(),p=fT(null),[m,h]=uT(null),g=fT(0),_;n[7]===a?_=n[8]:(_=e=>(g.current+=1,p.current=e,h(e),()=>{g.current=Math.max(0,g.current-1),p.current===e&&(p.current=null,h(null))}),n[7]=a,n[8]=_);let v=_,y;n[9]===v?y=n[10]:(y={register:v},n[9]=v,n[10]=y);let b=y,x=m??void 0,S;n[11]!==r||n[12]!==u||n[13]!==a||n[14]!==l||n[15]!==f||n[16]!==x||n[17]!==d?(S=Kme({adapter:r,text:d,triggerChar:a,behavior:x,aui:u,popoverId:f,isLoading:l}),n[11]=r,n[12]=u,n[13]=a,n[14]=l,n[15]=f,n[16]=x,n[17]=d,n[18]=S):S=n[18];let C=HT(S),w;n[19]===C?w=n[20]:(w=()=>C,n[19]=C,n[20]=w);let T=_T(w),E=pF(),D;n[21]!==m||n[22]!==a||n[23]!==T||n[24]!==E?(D=()=>E.register({char:a,...m?{behavior:m}:{},resource:T()}),n[21]=m,n[22]=a,n[23]=T,n[24]=E,n[25]=D):D=n[25];let O;n[26]!==m||n[27]!==a||n[28]!==E?(O=[E,a,m],n[26]=m,n[27]=a,n[28]=E,n[29]=O):O=n[29],hT(D,O);let k=uF(),ee;n[30]!==T||n[31]!==k?(ee=()=>{if(k)return k.register(T())},n[30]=T,n[31]=k,n[32]=ee):ee=n[32];let A;n[33]===k?A=n[34]:(A=[k],n[33]=k,n[34]=A),hT(ee,A);let j=m!==null&&C.open,te=Pme(),ne,M;n[35]!==te||n[36]!==a||n[37]!==j?(ne=()=>{if(j)return()=>{te.setActiveAria(a,null)}},M=[te,a,j],n[35]=te,n[36]=a,n[37]=j,n[38]=ne,n[39]=M):(ne=n[38],M=n[39]),hT(ne,M);let N,re;n[40]!==te||n[41]!==a||n[42]!==j||n[43]!==f||n[44]!==C.highlightedItemId?(N=()=>{j&&te.setActiveAria(a,{popoverId:f,highlightedItemId:C.highlightedItemId})},re=[te,a,f,j,C.highlightedItemId],n[40]=te,n[41]=a,n[42]=j,n[43]=f,n[44]=C.highlightedItemId,n[45]=N,n[46]=re):(N=n[45],re=n[46]),hT(N,re);let ie;n[47]!==i||n[48]!==o||n[49]!==t||n[50]!==j||n[51]!==f||n[52]!==s||n[53]!==C.highlightedItemId?(ie=j?(0,B.jsx)(ej.div,{role:`listbox`,id:f,"aria-label":i??`Suggestions`,"aria-activedescendant":C.highlightedItemId,"data-state":`open`,...s,ref:t,children:o}):o,n[47]=i,n[48]=o,n[49]=t,n[50]=j,n[51]=f,n[52]=s,n[53]=C.highlightedItemId,n[54]=ie):ie=n[54];let ae;n[55]!==C||n[56]!==ie?(ae=(0,B.jsx)(CF.Provider,{value:C,children:ie}),n[55]=C,n[56]=ie,n[57]=ae):ae=n[57];let oe;return n[58]!==b||n[59]!==ae?(oe=(0,B.jsx)(TF.Provider,{value:b,children:ae}),n[58]=b,n[59]=ae,n[60]=oe):oe=n[60],oe});DF.displayName=`ComposerPrimitive.TriggerPopover`;function Jme(e){return e.composer.text}var OF=()=>{let e=V(2),{disabled:t,send:n}=aue(),r;return e[0]===n?r=e[1]:(r=()=>n(),e[0]=n,e[1]=r),t?null:r},Yme=ij(`ComposerPrimitive.Send`,OF),kF=(0,sT.forwardRef)((e,t)=>{let n=V(12),r,i;n[0]===e?(r=n[1],i=n[2]):({onSubmit:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=OF(),o;n[3]===a?o=n[4]:(o=e=>{e.preventDefault(),a&&a()},n[3]=a,n[4]=o);let s=o,c;n[5]!==s||n[6]!==r?(c=R(r,s),n[5]=s,n[6]=r,n[7]=c):c=n[7];let l;return n[8]!==t||n[9]!==i||n[10]!==c?(l=(0,B.jsx)(ej.form,{...i,ref:t,onSubmit:c}),n[8]=t,n[9]=i,n[10]=c,n[11]=l):l=n[11],l});kF.displayName=`ComposerPrimitive.Root`;var AF=e=>{let t=V(4),n=dd(e),r=VA(Xme),i,a;t[0]!==n||t[1]!==r?(i=()=>r(n),a=[r,n],t[0]=n,t[1]=r,t[2]=i,t[3]=a):(i=t[2],a=t[3]),hT(i,a)};function Xme(e){return e.onScrollToBottom}var Zme=()=>!1,Qme=()=>{},$me=e=>{let t=V(4),n;t[0]===e?n=t[1]:(n=t=>{if(typeof window>`u`||e===null)return Qme;let n=window.matchMedia(e);return n.addEventListener(`change`,t),()=>n.removeEventListener(`change`,t)},t[0]=e,t[1]=n);let r=n,i;return t[2]===e?i=t[3]:(i=()=>typeof window>`u`||e===null?!1:window.matchMedia(e).matches,t[2]=e,t[3]=i),vT(r,i,Zme)};function jF(){return jF=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jF.apply(null,arguments)}function ehe(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var the=z.useLayoutEffect,nhe=function(e){var t=z.useRef(e);return the(function(){t.current=e}),t},MF=function(e,t){if(typeof e==`function`){e(t);return}e.current=t},rhe=function(e,t){var n=z.useRef();return z.useCallback(function(r){e.current=r,n.current&&MF(n.current,null),n.current=t,t&&MF(t,r)},[t])},NF={"min-height":`0`,"max-height":`none`,height:`0`,visibility:`hidden`,overflow:`hidden`,position:`absolute`,"z-index":`-1000`,top:`0`,right:`0`,display:`block`},PF=function(e){Object.keys(NF).forEach(function(t){e.style.setProperty(t,NF[t],`important`)})},FF=null,IF=function(e,t){var n=e.scrollHeight;return t.sizingStyle.boxSizing===`border-box`?n+t.borderSize:n-t.paddingSize};function ihe(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),FF||(FF=document.createElement(`textarea`),FF.setAttribute(`tabindex`,`-1`),FF.setAttribute(`aria-hidden`,`true`),PF(FF)),FF.parentNode===null&&document.body.appendChild(FF);var i=e.paddingSize,a=e.borderSize,o=e.sizingStyle,s=o.boxSizing;Object.keys(o).forEach(function(e){var t=e;FF.style[t]=o[t]}),PF(FF),FF.value=t;var c=IF(FF,e);FF.value=t,c=IF(FF,e),FF.value=`x`;var l=FF.scrollHeight-i,u=l*n;s===`border-box`&&(u=u+i+a),c=Math.max(u,c);var d=l*r;return s===`border-box`&&(d=d+i+a),c=Math.min(d,c),[c,l]}var LF=function(){},ahe=function(e,t){return e.reduce(function(e,n){return e[n]=t[n],e},{})},ohe=[`borderBottomWidth`,`borderLeftWidth`,`borderRightWidth`,`borderTopWidth`,`boxSizing`,`fontFamily`,`fontSize`,`fontStyle`,`fontWeight`,`letterSpacing`,`lineHeight`,`paddingBottom`,`paddingLeft`,`paddingRight`,`paddingTop`,`tabSize`,`textIndent`,`textRendering`,`textTransform`,`width`,`wordBreak`,`wordSpacing`,`scrollbarGutter`],she=!!document.documentElement.currentStyle,che=function(e){var t=window.getComputedStyle(e);if(t===null)return null;var n=ahe(ohe,t),r=n.boxSizing;return r===``?null:(she&&r===`border-box`&&(n.width=parseFloat(n.width)+parseFloat(n.borderRightWidth)+parseFloat(n.borderLeftWidth)+parseFloat(n.paddingRight)+parseFloat(n.paddingLeft)+`px`),{sizingStyle:n,paddingSize:parseFloat(n.paddingBottom)+parseFloat(n.paddingTop),borderSize:parseFloat(n.borderBottomWidth)+parseFloat(n.borderTopWidth)})};function RF(e,t,n){var r=nhe(n);z.useLayoutEffect(function(){var n=function(e){return r.current(e)};if(e)return e.addEventListener(t,n),function(){return e.removeEventListener(t,n)}},[])}var lhe=function(e,t){RF(document.body,`reset`,function(n){e.current.form===n.target&&t(n)})},uhe=function(e){RF(window,`resize`,e)},dhe=function(e){RF(document.fonts,`loadingdone`,e)},fhe=[`cacheMeasurements`,`maxRows`,`minRows`,`onChange`,`onHeightChange`],phe=z.forwardRef(function(e,t){var n=e.cacheMeasurements,r=e.maxRows,i=e.minRows,a=e.onChange,o=a===void 0?LF:a,s=e.onHeightChange,c=s===void 0?LF:s,l=ehe(e,fhe),u=l.value!==void 0,d=z.useRef(null),f=rhe(d,t),p=z.useRef(0),m=z.useRef(),h=function(){var e=d.current,t=n&&m.current?m.current:che(e);if(t){m.current=t;var a=ihe(t,e.value||e.placeholder||`x`,i,r),o=a[0],s=a[1];p.current!==o&&(p.current=o,e.style.setProperty(`height`,o+`px`,`important`),c(o,{rowHeight:s}))}};return z.useLayoutEffect(h),lhe(d,function(){if(!u){var e=d.current.value;requestAnimationFrame(function(){var t=d.current;t&&e!==t.value&&h()})}}),uhe(h),dhe(h),z.createElement(`textarea`,jF({},l,{onChange:function(e){u||h(),o(e)},ref:f}))}),mhe=`(pointer: coarse) and (not (any-pointer: fine))`,zF=(0,sT.forwardRef)(({autoFocus:e=!1,asChild:t,render:n,disabled:r,onChange:i,onKeyDown:a,onPaste:o,onSelect:s,submitOnEnter:c,submitMode:l,cancelOnEscape:u=!0,unstable_focusOnRunStart:d=!0,unstable_focusOnScrollToBottom:f=!0,unstable_focusOnThreadSwitched:p=!0,unstable_insertNewlineOnTouchEnter:m=!1,addAttachmentOnPaste:h=!0,...g},_)=>{let v=CE(),y=uF(),b=Rme(),x=l??(c===!1?`none`:`enter`),S=$me(m?mhe:null),C=m&&S&&x===`enter`?`none`:x,w=H(e=>e.composer.isEditing?e.composer.text:``),T=H(e=>e.thread.isDisabled||e.composer.dictation?.inputDisabled)||r,E=fT(null),D=ac(_,E),O=fT(!1);im(e=>{if(!E.current?.contains(e.target))return;if(y){for(let t of y.getPlugins())if(t.handleKeyDown(e))return}if(!u)return;let t=v.composer();t.getState().canCancel&&(t.cancel(),e.preventDefault())});let k=e=>{if(!T&&!e.nativeEvent.isComposing){if(y){for(let t of y.getPlugins())if(t.handleKeyDown(e))return}if(e.key===`Enter`){let t=v.thread().getState(),n=t.capabilities.queue;if(e.shiftKey&&(e.ctrlKey||e.metaKey)&&n&&x!==`none`&&v.composer().getState().canSend){e.preventDefault(),v.composer().send({steer:!0});return}if(e.shiftKey||t.isRunning&&!n)return;let r=!1;C===`ctrlEnter`?r=e.ctrlKey||e.metaKey:C===`enter`&&(r=!0),r&&(e.preventDefault(),E.current?.closest(`form`)?.requestSubmit())}}},ee=async e=>{if(!h)return;let t=v.thread().getState().capabilities,n=Array.from(e.clipboardData?.files||[]);if(t.attachments&&n.length>0)try{e.preventDefault(),await Promise.all(n.map(e=>v.composer().addAttachment(e)))}catch(e){console.error(`Error adding attachment:`,e)}},A=e&&!T,j=mT(()=>{let e=E.current;!e||!A||(e.focus({preventScroll:!0}),e.setSelectionRange(e.value.length,e.value.length))},[A]);hT(()=>j(),[j]),AF(()=>{v.composer().getState().type===`thread`&&f&&j()}),hT(()=>{if(!(v.composer().getState().type!==`thread`||!d))return v.on(`thread.runStart`,j)},[d,j,v]),hT(()=>{if(!(v.composer().getState().type!==`thread`||!p))return v.on(`threadListItem.switchedTo`,j)},[p,j,v]);let te=b?{"aria-controls":b.popoverId,"aria-expanded":!0,"aria-haspopup":`listbox`,"aria-activedescendant":b.highlightedItemId}:{},ne={name:`input`,value:w,...g,...te,ref:D,disabled:T,onChange:R(i,e=>{if(!v.composer().getState().isEditing)return;let t=e.nativeEvent.isComposing===!0;O.current&&!t&&(O.current=!1);let n=t||O.current;if(AT(()=>{v.composer().setText(e.target.value)}),n)return;let r=e.target.selectionStart??e.target.value.length;if(y)for(let e of y.getPlugins())e.setCursorPosition(r)}),onKeyDown:R(a,k),onCompositionStart:R(g.onCompositionStart,()=>{O.current=!0}),onCompositionEnd:R(g.onCompositionEnd,e=>{if(O.current=!1,!v.composer().getState().isEditing)return;let t=e.target;AT(()=>{v.composer().setText(t.value)});let n=t.selectionStart??t.value.length;if(y)for(let e of y.getPlugins())e.setCursorPosition(n)}),onSelect:R(s,e=>{if(O.current)return;let t=e.target,n=t.selectionStart??t.value.length;if(y)for(let e of y.getPlugins())e.setCursorPosition(n)}),onPaste:R(o,ee)};if(n&&(0,sT.isValidElement)(n)){let e=g.children===void 0?n.props.children:g.children;return(0,B.jsx)(R_,{...ne,children:(0,sT.cloneElement)(n,void 0,e)})}return(0,B.jsx)(t?R_:phe,{...ne})});zF.displayName=`ComposerPrimitive.Input`;var hhe=ij(`ComposerPrimitive.Cancel`,()=>{let{disabled:e,cancel:t}=sue();return e?null:t}),ghe=ij(`ComposerPrimitive.AddAttachment`,e=>{let t=V(6),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{multiple:r}=n,i=r===void 0?!0:r,{disabled:a,addAttachment:o}=due(),s=CE(),c;return t[2]!==o||t[3]!==s||t[4]!==i?(c=()=>{let e=document.createElement(`input`);e.type=`file`,e.multiple=i,e.hidden=!0;let t=s.composer().getState().attachmentAccept;t!==`*`&&(e.accept=t),document.body.appendChild(e),e.onchange=t=>{let n=t.target.files;if(n){for(let e of n)o(e);document.body.removeChild(e)}},e.oncancel=()=>{(!e.files||e.files.length===0)&&document.body.removeChild(e)},e.click()},t[2]=o,t[3]=s,t[4]=i,t[5]=c):c=t[5],a?null:c},[`multiple`]),BF=(0,sT.forwardRef)((e,t)=>{let n=V(30),{disabled:r,asChild:i,render:a,children:o,...s}=e,c=i===void 0?!1:i,[l,u]=uT(!1),d=CE(),f;n[0]===r?f=n[1]:(f=e=>{r||(e.preventDefault(),u(!0))},n[0]=r,n[1]=f);let p=f,m;n[2]!==r||n[3]!==l?(m=e=>{r||(e.preventDefault(),l||u(!0))},n[2]=r,n[3]=l,n[4]=m):m=n[4];let h=m,g;n[5]===r?g=n[6]:(g=e=>{if(r)return;e.preventDefault();let t=e.relatedTarget;t&&e.currentTarget.contains(t)||u(!1)},n[5]=r,n[6]=g);let _=g,v;n[7]!==d||n[8]!==r?(v=async e=>{if(r)return;e.preventDefault(),u(!1);let t=Array.from(e.dataTransfer.files);await Promise.all(t.map(async e=>{try{await d.composer().addAttachment(e)}catch(e){console.error(`Failed to add attachment:`,e)}}))},n[7]=d,n[8]=r,n[9]=v):v=n[9];let y=v,b;n[10]===l?b=n[11]:(b=l?{"data-dragging":`true`}:null,n[10]=l,n[11]=b);let x=R(s.onDragEnterCapture,p),S=R(s.onDragOverCapture,h),C=R(s.onDragLeaveCapture,_),w=R(s.onDropCapture,y),T;n[12]!==t||n[13]!==s||n[14]!==w||n[15]!==b||n[16]!==x||n[17]!==S||n[18]!==C?(T={...b,...s,onDragEnterCapture:x,onDragOverCapture:S,onDragLeaveCapture:C,onDropCapture:w,ref:t},n[12]=t,n[13]=s,n[14]=w,n[15]=b,n[16]=x,n[17]=S,n[18]=C,n[19]=T):T=n[19];let E=T;if(a&&(0,sT.isValidElement)(a)){let e=o===void 0?a.props.children:o,t;n[20]!==a||n[21]!==e?(t=(0,sT.cloneElement)(a,void 0,e),n[20]=a,n[21]=e,n[22]=t):t=n[22];let r;return n[23]!==E||n[24]!==t?(r=(0,B.jsx)(R_,{...E,children:t}),n[23]=E,n[24]=t,n[25]=r):r=n[25],r}let D=c?R_:`div`,O;return n[26]!==D||n[27]!==o||n[28]!==E?(O=(0,B.jsx)(D,{...E,children:o}),n[26]=D,n[27]=o,n[28]=E,n[29]=O):O=n[29],O});BF.displayName=`ComposerPrimitive.AttachmentDropzone`;var _he=ij(`ComposerPrimitive.Dictate`,()=>{let{disabled:e,startDictation:t}=lue();return e?null:t}),vhe=ij(`ComposerPrimitive.StopDictation`,()=>{let e=V(2),t=CE(),n=H(yhe),r;return e[0]===t?r=e[1]:(r=()=>{t.composer().stopDictation()},e[0]=t,e[1]=r),n?r:null});function yhe(e){return e.composer.dictation!=null}var VF=(0,sT.forwardRef)((e,t)=>{let n=V(7),r,i;n[0]===e?(r=n[1],i=n[2]):({children:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=H(bhe);if(!a)return null;let o=r??a,s;return n[3]!==t||n[4]!==i||n[5]!==o?(s=(0,B.jsx)(ej.span,{...i,ref:t,children:o}),n[3]=t,n[4]=i,n[5]=o,n[6]=s):s=n[6],s});VF.displayName=`ComposerPrimitive.DictationTranscript`;function bhe(e){return e.composer.dictation?.transcript}var HF=(0,sT.forwardRef)((e,t)=>{let n=V(3);if(!H(xhe))return null;let r;return n[0]!==t||n[1]!==e?(r=(0,B.jsx)(ej.div,{...e,ref:t}),n[0]=t,n[1]=e,n[2]=r):r=n[2],r});HF.displayName=`ComposerPrimitive.Quote`;var UF=(0,sT.forwardRef)((e,t)=>{let n=V(7),r,i;n[0]===e?(r=n[1],i=n[2]):({children:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=H(She);if(!a)return null;let o=r??a,s;return n[3]!==t||n[4]!==i||n[5]!==o?(s=(0,B.jsx)(ej.span,{...i,ref:t,children:o}),n[3]=t,n[4]=i,n[5]=o,n[6]=s):s=n[6],s});UF.displayName=`ComposerPrimitive.QuoteText`;var WF=(0,sT.forwardRef)((e,t)=>{let n=V(12),r,i;n[0]===e?(r=n[1],i=n[2]):({onClick:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a=CE(),o;n[3]===a?o=n[4]:(o=()=>{a.composer().setQuote(void 0)},n[3]=a,n[4]=o);let s=o,c;n[5]!==s||n[6]!==r?(c=R(r,s),n[5]=s,n[6]=r,n[7]=c):c=n[7];let l;return n[8]!==t||n[9]!==i||n[10]!==c?(l=(0,B.jsx)(ej.button,{type:`button`,...i,ref:t,onClick:c}),n[8]=t,n[9]=i,n[10]=c,n[11]=l):l=n[11],l});WF.displayName=`ComposerPrimitive.QuoteDismiss`;function xhe(e){return e.composer.quote}function She(e){return e.composer.quote?.text}var GF=(0,sT.forwardRef)((e,t)=>{let n=V(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({children:i,"aria-label":r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let{categories:o,activeCategoryId:s,isSearchMode:c,open:l}=wF();if(!l||s||c)return null;let u=r??`Categories`,d;n[4]!==o||n[5]!==i?(d=i(o),n[4]=o,n[5]=i,n[6]=d):d=n[6];let f;return n[7]!==t||n[8]!==a||n[9]!==u||n[10]!==d?(f=(0,B.jsx)(ej.div,{role:`group`,"aria-label":u,...a,ref:t,children:d}),n[7]=t,n[8]=a,n[9]=u,n[10]=d,n[11]=f):f=n[11],f});GF.displayName=`ComposerPrimitive.TriggerPopoverCategories`;var KF=(0,sT.forwardRef)((e,t)=>{let n=V(30),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({categoryId:r,onClick:i,onMouseMove:a,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let{selectCategory:s,highlightIndex:c,categories:l,highlightedIndex:u,activeCategoryId:d,isSearchMode:f,popoverId:p}=wF(),m;n[5]!==r||n[6]!==s?(m=()=>{s(r)},n[5]=r,n[6]=s,n[7]=m):m=n[7];let h=m,g;if(n[8]!==l||n[9]!==r){let e;n[11]===r?e=n[12]:(e=e=>e.id===r,n[11]=r,n[12]=e),g=l.findIndex(e),n[8]=l,n[9]=r,n[10]=g}else g=n[10];let _=g,v=!d&&!f&&_===u,y;n[13]!==_||n[14]!==c?(y=()=>{c(_)},n[13]=_,n[14]=c,n[15]=y):y=n[15];let b=y,x=`${p}-option-${r}`,S=v?``:void 0,C;n[16]!==h||n[17]!==i?(C=R(i,h),n[16]=h,n[17]=i,n[18]=C):C=n[18];let w;n[19]!==b||n[20]!==a?(w=R(a,b),n[19]=b,n[20]=a,n[21]=w):w=n[21];let T;return n[22]!==t||n[23]!==v||n[24]!==o||n[25]!==x||n[26]!==S||n[27]!==C||n[28]!==w?(T=(0,B.jsx)(ej.button,{type:`button`,role:`option`,id:x,"aria-selected":v,"data-highlighted":S,...o,ref:t,onClick:C,onMouseMove:w}),n[22]=t,n[23]=v,n[24]=o,n[25]=x,n[26]=S,n[27]=C,n[28]=w,n[29]=T):T=n[29],T});KF.displayName=`ComposerPrimitive.TriggerPopoverCategoryItem`;var qF=(0,sT.forwardRef)((e,t)=>{let n=V(12),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({children:i,"aria-label":r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let{items:o,activeCategoryId:s,isSearchMode:c,open:l}=wF();if(!l||!s&&!c)return null;let u=r??`Items`,d;n[4]!==i||n[5]!==o?(d=i(o),n[4]=i,n[5]=o,n[6]=d):d=n[6];let f;return n[7]!==t||n[8]!==a||n[9]!==u||n[10]!==d?(f=(0,B.jsx)(ej.div,{role:`group`,"aria-label":u,...a,ref:t,children:d}),n[7]=t,n[8]=a,n[9]=u,n[10]=d,n[11]=f):f=n[11],f});qF.displayName=`ComposerPrimitive.TriggerPopoverItems`;var JF=(0,sT.forwardRef)((e,t)=>{let n=V(30),r,i,a,o,s;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5]):({item:i,index:r,onClick:a,onMouseMove:o,...s}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s);let{selectItem:c,highlightIndex:l,items:u,highlightedIndex:d,activeCategoryId:f,isSearchMode:p,popoverId:m}=wF(),h;n[6]!==i||n[7]!==c?(h=()=>{c(i)},n[6]=i,n[7]=c,n[8]=h):h=n[8];let g=h,_;n[9]!==r||n[10]!==i.id||n[11]!==u?(_=r??u.findIndex(e=>e.id===i.id),n[9]=r,n[10]=i.id,n[11]=u,n[12]=_):_=n[12];let v=_,y=(p||f!==null)&&v===d,b;n[13]!==l||n[14]!==v?(b=()=>{l(v)},n[13]=l,n[14]=v,n[15]=b):b=n[15];let x=b,S=`${m}-option-${i.id}`,C=y?``:void 0,w;n[16]!==g||n[17]!==a?(w=R(a,g),n[16]=g,n[17]=a,n[18]=w):w=n[18];let T;n[19]!==x||n[20]!==o?(T=R(o,x),n[19]=x,n[20]=o,n[21]=T):T=n[21];let E;return n[22]!==t||n[23]!==y||n[24]!==s||n[25]!==S||n[26]!==C||n[27]!==w||n[28]!==T?(E=(0,B.jsx)(ej.button,{type:`button`,role:`option`,id:S,"aria-selected":y,"data-highlighted":C,...s,ref:t,onClick:w,onMouseMove:T}),n[22]=t,n[23]=y,n[24]=s,n[25]=S,n[26]=C,n[27]=w,n[28]=T,n[29]=E):E=n[29],E});JF.displayName=`ComposerPrimitive.TriggerPopoverItem`;var YF=(0,sT.forwardRef)((e,t)=>{let n=V(10),r,i;n[0]===e?(r=n[1],i=n[2]):({onClick:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let{activeCategoryId:a,isSearchMode:o,goBack:s,open:c}=wF();if(!c||!a||o)return null;let l;n[3]!==s||n[4]!==r?(l=R(r,s),n[3]=s,n[4]=r,n[5]=l):l=n[5];let u;return n[6]!==t||n[7]!==i||n[8]!==l?(u=(0,B.jsx)(ej.button,{type:`button`,...i,ref:t,onClick:l}),n[6]=t,n[7]=i,n[8]=l,n[9]=u):u=n[9],u});YF.displayName=`ComposerPrimitive.TriggerPopoverBack`;var XF=({formatter:e,onExecute:t,removeOnExecute:n})=>{let{register:r}=EF(),i=fT(t);return i.current=t,hT(()=>r({kind:`action`,formatter:e??RA,onExecute:e=>i.current(e),...n===void 0?{}:{removeOnExecute:n}}),[r,e,n]),null};XF.displayName=`ComposerPrimitive.TriggerPopoverAction`;var ZF=({formatter:e,onInserted:t})=>{let{register:n}=EF(),r=fT(t);return r.current=t,hT(()=>n({kind:`directive`,formatter:e??RA,onInserted:e=>r.current?.(e)}),[n,e]),null};ZF.displayName=`ComposerPrimitive.TriggerPopoverDirective`;var Che=Object.assign(DF,{Directive:ZF,Action:XF}),QF=QA({AddAttachment:()=>ghe,AttachmentByIndex:()=>OA,AttachmentDropzone:()=>BF,Attachments:()=>AA,Cancel:()=>hhe,Dictate:()=>_he,DictationTranscript:()=>VF,If:()=>LA,Input:()=>zF,Queue:()=>jA,Quote:()=>HF,QuoteDismiss:()=>WF,QuoteText:()=>UF,Root:()=>kF,Send:()=>Yme,StopDictation:()=>vhe,Unstable_TriggerPopover:()=>Che,Unstable_TriggerPopoverBack:()=>YF,Unstable_TriggerPopoverCategories:()=>GF,Unstable_TriggerPopoverCategoryItem:()=>KF,Unstable_TriggerPopoverItem:()=>JF,Unstable_TriggerPopoverItems:()=>qF,Unstable_TriggerPopoverRoot:()=>bF,unstable_useTriggerPopoverRootContext:()=>pF,unstable_useTriggerPopoverRootContextOptional:()=>mF,unstable_useTriggerPopoverScopeContext:()=>wF,unstable_useTriggerPopoverScopeContextOptional:()=>qme,unstable_useTriggerPopoverTriggers:()=>Fme,unstable_useTriggerPopoverTriggersOptional:()=>Lme}),$F=()=>H(whe);function whe(e){if(e.part.type!==`text`&&e.part.type!==`reasoning`)throw Error(`MessagePartText can only be used inside text or reasoning message parts.`);return e.part}var The=bT(null);function Ehe(e){let t=ST(The);if(!e?.optional&&!t)throw Error(`This component must be used within a SmoothContextProvider.`);return t}var{useSmoothStatus:Dhe,useSmoothStatusStore:Ohe}=zA(Ehe,`useSmoothStatus`),eI=250,tI=5,khe=class{currentText;setText;animationFrameId=null;lastUpdateTime=Date.now();lastCommitTime=0;targetText=``;drainMs=eI;maxCharIntervalMs=tI;maxCharsPerFrame=1/0;minCommitMs=0;constructor(e,t){this.currentText=e,this.setText=t}start(){this.animationFrameId===null&&(this.lastUpdateTime=Date.now(),this.animate())}stop(){this.animationFrameId!==null&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}animate=()=>{let e=Date.now(),t=e-this.lastUpdateTime,n=this.targetText.length-this.currentText.length,r=Math.min(this.maxCharIntervalMs,this.drainMs/n),i=Math.min(n,this.maxCharsPerFrame),a=0;for(;t>=r&&a<i;)a++,t-=r;a===i&&i===this.maxCharsPerFrame&&(t=0),a===n?this.animationFrameId=null:this.animationFrameId=requestAnimationFrame(this.animate),a!==0&&(this.currentText=this.targetText.slice(0,this.currentText.length+a),this.lastUpdateTime=e-t,(a===n||e-this.lastCommitTime>=this.minCommitMs)&&(this.lastCommitTime=e,this.setText(this.currentText)))}},nI=Object.freeze({type:`running`}),rI=(e,t)=>e!==void 0&&e>0?e:t,iI=(e,t=!1)=>{let{text:n}=e,r=typeof t==`object`&&t?t:void 0,i=t!==!1&&t!==null,a=rI(r?.drainMs,eI),o=rI(r?.maxCharIntervalMs,tI),s=rI(r?.maxCharsPerFrame,1/0),c=rI(r?.minCommitMs,0),[l,u]=uT(e.status.type===`running`?``:n),d=CE(),f=H(()=>d.part()),[p,m]=uT(f);(f!==p||!n.startsWith(l))&&(m(f),u(e.status.type===`running`?``:n));let h=Ohe({optional:!0}),g=dd(t=>{if(u(t),h){let n=l!==t||e.status.type===`running`?nI:e.status;WA(h).setState(n,!0)}});hT(()=>{if(h){let t=i&&(l!==n||e.status.type===`running`)?nI:e.status;WA(h).setState(t,!0)}},[h,i,n,l,e.status]);let[_]=uT(new khe(l,g));hT(()=>{_.drainMs=a,_.maxCharIntervalMs=o,_.maxCharsPerFrame=s,_.minCommitMs=c},[_,a,o,s,c]);let v=fT(f);return hT(()=>{if(!i){_.stop();return}let t=v.current!==f;if(v.current=f,t||!n.startsWith(_.targetText)){e.status.type===`running`?(_.currentText=``,_.targetText=n,_.lastCommitTime=0,_.start()):(_.currentText=n,_.targetText=n,_.stop());return}_.targetText=n,_.start()},[_,i,n,e.status.type,f]),hT(()=>()=>{_.stop()},[_]),pT(()=>i?{...e,text:l,status:n===l?e.status:nI}:e,[i,l,e,n])},Ahe=()=>H(jhe);function jhe(e){if(e.part.type!==`image`)throw Error(`MessagePartImage can only be used inside image message parts.`);return e.part}var aI=(0,sT.forwardRef)((e,t)=>{let n=V(10),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({smooth:i,component:a,...r}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o=i===void 0?!0:i,s=a===void 0?`span`:a,{text:c,status:l}=iI($F(),o),u;return n[4]!==s||n[5]!==t||n[6]!==r||n[7]!==l.type||n[8]!==c?(u=(0,B.jsx)(s,{"data-status":l.type,...r,ref:t,children:c}),n[4]=s,n[5]=t,n[6]=r,n[7]=l.type,n[8]=c,n[9]=u):u=n[9],u});aI.displayName=`MessagePartPrimitive.Text`;var oI=(0,sT.forwardRef)((e,t)=>{let n=V(4),{image:r}=Ahe(),i;return n[0]!==t||n[1]!==r||n[2]!==e?(i=(0,B.jsx)(ej.img,{src:r,...e,ref:t}),n[0]=t,n[1]=r,n[2]=e,n[3]=i):i=n[3],i});oI.displayName=`MessagePartPrimitive.Image`;var sI=e=>{let t=V(2),n=fT(void 0),r;return t[0]===e?r=t[1]:(r=t=>{n.current&&=(n.current(),void 0),t&&(n.current=e(t))},t[0]=e,t[1]=r),r},cI=(e,t)=>{let n=e.trim().match(/^(\d+(?:\.\d+)?|\.\d+)(em|px|rem)$/);if(!n)return 1/0;let r=Number(n[1]),i=n[2];return i===`px`?r:i===`em`?r*(parseFloat(getComputedStyle(t).fontSize)||16):i===`rem`?r*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16):1/0},Mhe=e=>e.dataset.messageId,Nhe=()=>{let e=document.createElement(`div`);return e.dataset.auiTopAnchorReserve=``,e.style.height=`0px`,e.style.flexShrink=`0`,e.style.pointerEvents=`none`,e.setAttribute(`aria-hidden`,`true`),e},lI=(e,t)=>{let n=`${t}px`;return e.style.height===n?!1:(e.style.height=n,!0)},Phe=e=>{let t=window.devicePixelRatio||1;return Math.round(e*t)/t},uI=()=>{let e=V(4),t=CE(),n;e[0]===t?n=e[1]:(n=()=>t.message(),e[0]=t,e[1]=n);let r=H(n),i;return e[2]===r?i=e[3]:(i=e=>{let t=()=>{r.setIsHovering(!0)},n=()=>{r.setIsHovering(!1)};return e.addEventListener(`mouseenter`,t),e.addEventListener(`mouseleave`,n),e.matches(`:hover`)&&queueMicrotask(()=>r.setIsHovering(!0)),()=>{e.removeEventListener(`mouseenter`,t),e.removeEventListener(`mouseleave`,n),r.setIsHovering(!1)}},e[2]=r,e[3]=i),sI(i)},Fhe=()=>{let e=V(2),t=VA(Vhe),n;return e[0]===t?n=e[1]:(n=e=>e.message.role===`user`&&e.message.index>0&&e.message.index===e.thread.messages.length-2&&e.thread.messages.at(-1)?.role===`assistant`&&(e.message.id===t||e.thread.isRunning),e[0]=t,e[1]=n),H(n)},Ihe=()=>{let e=V(2),t=VA(Hhe),n;return e[0]===t?n=e[1]:(n=e=>e.message.isLast&&e.message.role===`assistant`&&e.message.index>=1&&e.thread.messages.at(e.message.index-1)?.role===`user`&&(e.message.id===t||e.thread.isRunning),e[0]=t,e[1]=n),H(n)},Lhe=(e,t)=>{let n=V(3),r;return n[0]!==e||n[1]!==t?(r=n=>{if(e)return t.getState().registerAnchorElement(n)},n[0]=e,n[1]=t,n[2]=r):r=n[2],sI(r)},Rhe=e=>{let t=V(3),{active:n,threadViewportStore:r}=e,i;return t[0]!==n||t[1]!==r?(i=e=>{if(!n)return;let t=r.getState(),i=t.topAnchorMessageClamp;return t.registerAnchorTargetElement(e,{tallerThan:cI(i.tallerThan,e),visibleHeight:cI(i.visibleHeight,e)})},t[0]=n,t[1]=r,t[2]=i):i=t[2],sI(i)},zhe=e=>{let t=V(7),n,r;t[0]===e?(n=t[1],r=t[2]):({forwardedRef:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=uI(),a=ac(n,i),o=H(Uhe),s;return t[3]!==o||t[4]!==r||t[5]!==a?(s=(0,B.jsx)(ej.div,{...r,ref:a,"data-message-id":o}),t[3]=o,t[4]=r,t[5]=a,t[6]=s):s=t[6],s},Bhe=e=>{let t=V(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({forwardedRef:n,threadViewportStore:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=uI(),o=Fhe(),s=Ihe(),c=Lhe(o,i),l;t[4]!==s||t[5]!==i?(l={active:s,threadViewportStore:i},t[4]=s,t[5]=i,t[6]=l):l=t[6];let u=Rhe(l),d=ac(n,a,c,u),f=H(Whe),p=o?``:void 0,m=s?``:void 0,h;return t[7]!==f||t[8]!==r||t[9]!==d||t[10]!==p||t[11]!==m?(h=(0,B.jsx)(ej.div,{...r,ref:d,"data-message-id":f,"data-aui-top-anchor-user":p,"data-aui-top-anchor-target":m}),t[7]=f,t[8]=r,t[9]=d,t[10]=p,t[11]=m,t[12]=h):h=t[12],h},dI=(0,sT.forwardRef)((e,t)=>{let n=V(7),r=HA();if(r.getState().turnAnchor===`top`){let i;return n[0]!==t||n[1]!==e||n[2]!==r?(i=(0,B.jsx)(Bhe,{...e,forwardedRef:t,threadViewportStore:r}),n[0]=t,n[1]=e,n[2]=r,n[3]=i):i=n[3],i}let i;return n[4]!==t||n[5]!==e?(i=(0,B.jsx)(zhe,{...e,forwardedRef:t}),n[4]=t,n[5]=e,n[6]=i):i=n[6],i});dI.displayName=`MessagePrimitive.Root`;function Vhe(e){return e.topAnchorTurn?.anchorId}function Hhe(e){return e.topAnchorTurn?.targetId}function Uhe(e){return e.message.id}function Whe(e){return e.message.id}var fI={...Uk,Text:()=>(0,B.jsxs)(`p`,{style:{whiteSpace:`pre-line`},children:[(0,B.jsx)(aI,{}),(0,B.jsx)(MA,{children:(0,B.jsx)(`span`,{style:{fontFamily:`revert`},children:` ●`})})]}),Image:()=>(0,B.jsx)(oI,{})},pI=e=>{let t=V(10);if(`children`in e){let n;return t[0]===e.children?n=t[1]:(n=(0,B.jsx)(aA,{children:e.children}),t[0]=e.children,t[1]=n),n}let n,r;t[2]===e?(n=t[3],r=t[4]):({components:n,...r}=e,t[2]=e,t[3]=n,t[4]=r);let i;t[5]===n?i=t[6]:(i=n?{Text:n.Text??fI.Text,Image:n.Image??fI.Image,Reasoning:n.Reasoning??Uk.Reasoning,Source:n.Source??Uk.Source,File:n.File??Uk.File,Unstable_Audio:n.Unstable_Audio??Uk.Unstable_Audio,...`ChainOfThought`in n?{ChainOfThought:n.ChainOfThought}:{tools:n.tools,data:n.data,ToolGroup:n.ToolGroup??Uk.ToolGroup,ReasoningGroup:n.ReasoningGroup??Uk.ReasoningGroup},Empty:n.Empty,Quote:n.Quote,generativeUI:n.generativeUI}:fI,t[5]=n,t[6]=i);let a=i,o;return t[7]!==r||t[8]!==a?(o=(0,B.jsx)(aA,{components:a,...r}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o};pI.displayName=`MessagePrimitive.Parts`;var mI=e=>{let{children:t}=e;return Iue()===void 0?null:t};mI.displayName=`MessagePrimitive.Error`;var Ghe=e=>{let t=new Map;for(let n=0;n<e.length;n++){let r=e[n]?.parentId??`__ungrouped_${n}`,i=t.get(r)??[];i.push(n),t.set(r,i)}let n=[];for(let[e,r]of t){let t=e.startsWith(`__ungrouped_`)?void 0:e;n.push({groupKey:t,indices:r})}return n},Khe=e=>{let t=V(4),n=H(ege),r;bb0:{if(n.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],r=e;break bb0}let i;t[1]!==e||t[2]!==n?(i=e(n),t[1]=e,t[2]=n,t[3]=i):i=t[3],r=i}return r},qhe=e=>{let t=V(9),n,r;t[0]===e?(n=t[1],r=t[2]):({Fallback:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]!==n||t[4]!==r.toolName?(i=e=>{let t=e.tools.tools[r.toolName]??n;return Array.isArray(t)?t[0]??n:t},t[3]=n,t[4]=r.toolName,t[5]=i):i=t[5];let a=H(i);if(!a)return null;let o;return t[6]!==a||t[7]!==r?(o=(0,B.jsx)(a,{...r}),t[6]=a,t[7]=r,t[8]=o):o=t[8],o},Jhe=e=>{let t=V(9),n,r;t[0]===e?(n=t[1],r=t[2]):({Fallback:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]!==n||t[4]!==r.name?(i=e=>{let t=e.dataRenderers.renderers[r.name]??n;return Array.isArray(t)?t[0]??n:t},t[3]=n,t[4]=r.name,t[5]=i):i=t[5];let a=H(i);if(!a)return null;let o;return t[6]!==a||t[7]!==r?(o=(0,B.jsx)(a,{...r}),t[6]=a,t[7]=r,t[8]=o):o=t[8],o},hI={Text:()=>(0,B.jsxs)(`p`,{style:{whiteSpace:`pre-line`},children:[(0,B.jsx)(aI,{}),(0,B.jsx)(MA,{children:(0,B.jsx)(`span`,{style:{fontFamily:`revert`},children:` ●`})})]}),Reasoning:()=>null,Source:()=>null,Image:()=>(0,B.jsx)(oI,{}),File:()=>null,Unstable_Audio:()=>null,Group:({children:e})=>e},Yhe=e=>{let t=V(43),{components:n}=e,r;t[0]===n?r=t[1]:(r=n===void 0?{}:n,t[0]=n,t[1]=r);let{Text:i,Reasoning:a,Image:o,Source:s,File:c,Unstable_Audio:l,tools:u,data:d}=r,f=i===void 0?hI.Text:i,p=a===void 0?hI.Reasoning:a,m=o===void 0?hI.Image:o,h=s===void 0?hI.Source:s,g=c===void 0?hI.File:c,_=l===void 0?hI.Unstable_Audio:l,v;t[2]===u?v=t[3]:(v=u===void 0?{}:u,t[2]=u,t[3]=v);let y=v,b=CE(),x=H(tge),S=x.type;if(S===`tool-call`){let e;t[4]===b?e=t[5]:(e=b.part(),t[4]=b,t[5]=e);let n=e.addToolResult,r;t[6]===b?r=t[7]:(r=b.part(),t[6]=b,t[7]=r);let i=r.resumeToolCall,a;t[8]===b?a=t[9]:(a=b.part(),t[8]=b,t[9]=a);let o=a.respondToToolApproval;if(`Override`in y){let e;return t[10]!==n||t[11]!==x||t[12]!==o||t[13]!==i||t[14]!==y.Override?(e=(0,B.jsx)(y.Override,{...x,addResult:n,resume:i,respondToApproval:o}),t[10]=n,t[11]=x,t[12]=o,t[13]=i,t[14]=y.Override,t[15]=e):e=t[15],e}let s=y.by_name?.[x.toolName]??y.Fallback,c;return t[16]!==s||t[17]!==n||t[18]!==x||t[19]!==o||t[20]!==i?(c=(0,B.jsx)(qhe,{...x,Fallback:s,addResult:n,resume:i,respondToApproval:o}),t[16]=s,t[17]=n,t[18]=x,t[19]=o,t[20]=i,t[21]=c):c=t[21],c}if(x.status?.type===`requires-action`)throw Error(`Encountered unexpected requires-action status`);switch(S){case`text`:{let e;return t[22]!==f||t[23]!==x?(e=(0,B.jsx)(f,{...x}),t[22]=f,t[23]=x,t[24]=e):e=t[24],e}case`reasoning`:{let e;return t[25]!==p||t[26]!==x?(e=(0,B.jsx)(p,{...x}),t[25]=p,t[26]=x,t[27]=e):e=t[27],e}case`source`:{let e;return t[28]!==h||t[29]!==x?(e=(0,B.jsx)(h,{...x}),t[28]=h,t[29]=x,t[30]=e):e=t[30],e}case`image`:{let e;return t[31]!==m||t[32]!==x?(e=(0,B.jsx)(m,{...x}),t[31]=m,t[32]=x,t[33]=e):e=t[33],e}case`file`:{let e;return t[34]!==g||t[35]!==x?(e=(0,B.jsx)(g,{...x}),t[34]=g,t[35]=x,t[36]=e):e=t[36],e}case`audio`:{let e;return t[37]!==_||t[38]!==x?(e=(0,B.jsx)(_,{...x}),t[37]=_,t[38]=x,t[39]=e):e=t[39],e}case`data`:{let e=d?.by_name?.[x.name]??d?.Fallback,n;return t[40]!==e||t[41]!==x?(n=(0,B.jsx)(Jhe,{...x,Fallback:e}),t[40]=e,t[41]=x,t[42]=n):n=t[42],n}default:return console.warn(`Unknown message part type: ${S}`),null}},Xhe=(0,sT.memo)(e=>{let t=V(5),{partIndex:n,components:r}=e,i;t[0]===r?i=t[1]:(i=(0,B.jsx)(Yhe,{components:r}),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,B.jsx)(fD,{index:n,children:i}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a},(e,t)=>e.partIndex===t.partIndex&&e.components?.Text===t.components?.Text&&e.components?.Reasoning===t.components?.Reasoning&&e.components?.Source===t.components?.Source&&e.components?.Image===t.components?.Image&&e.components?.File===t.components?.File&&e.components?.Unstable_Audio===t.components?.Unstable_Audio&&e.components?.tools===t.components?.tools&&e.components?.data===t.components?.data&&e.components?.Group===t.components?.Group),Zhe=e=>{let t=V(6),{status:n,component:r}=e,i=n.type===`running`,a;t[0]!==r||t[1]!==n?(a=(0,B.jsx)(r,{type:`text`,text:``,status:n}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==a?(o=(0,B.jsx)(mD,{text:``,isRunning:i,children:a}),t[3]=i,t[4]=a,t[5]=o):o=t[5],o},Qhe=Object.freeze({type:`complete`}),$he=(0,sT.memo)(e=>{let t=V(6),{components:n}=e,r=H(nge);if(n?.Empty){let e;return t[0]!==n.Empty||t[1]!==r?(e=(0,B.jsx)(n.Empty,{status:r}),t[0]=n.Empty,t[1]=r,t[2]=e):e=t[2],e}let i=n?.Text??hI.Text,a;return t[3]!==r||t[4]!==i?(a=(0,B.jsx)(Zhe,{status:r,component:i}),t[3]=r,t[4]=i,t[5]=a):a=t[5],a},(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),gI=e=>{let t=V(9),{groupingFunction:n,components:r}=e,i=H(rge),a=Khe(n),o;bb0:{if(i===0){let e;t[0]===r?e=t[1]:(e=(0,B.jsx)($he,{components:r}),t[0]=r,t[1]=e),o=e;break bb0}let e;if(t[2]!==r||t[3]!==a){let n;t[5]===r?n=t[6]:(n=(e,t)=>(0,B.jsx)(r?.Group??hI.Group,{groupKey:e.groupKey,indices:e.indices,children:e.indices.map(e=>(0,B.jsx)(Xhe,{partIndex:e,components:r},e))},`group-${t}-${e.groupKey??`ungrouped`}`),t[5]=r,t[6]=n),e=a.map(n),t[2]=r,t[3]=a,t[4]=e}else e=t[4];o=e}let s=o,c;return t[7]===s?c=t[8]:(c=(0,B.jsx)(B.Fragment,{children:s}),t[7]=s,t[8]=c),c};gI.displayName=`MessagePrimitive.Unstable_PartsGrouped`;var _I=e=>{let t=V(6),n,r;t[0]===e?(n=t[1],r=t[2]):({components:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;return t[3]!==n||t[4]!==r?(i=(0,B.jsx)(gI,{...r,components:n,groupingFunction:Ghe}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i};_I.displayName=`MessagePrimitive.Unstable_PartsGroupedByParentId`;function ege(e){return e.message.parts}function tge(e){return e.part}function nge(e){return e.message.status??Qhe}function rge(e){return e.message.parts.length}var vI=QA({AttachmentByIndex:()=>wA,Attachments:()=>EA,Content:()=>pI,Error:()=>mI,GenerativeUI:()=>Dk,GroupedParts:()=>xA,If:()=>cF,PartByIndex:()=>Gk,Parts:()=>pI,Quote:()=>SA,Root:()=>dI,Unstable_PartsGrouped:()=>gI,Unstable_PartsGroupedByParentId:()=>_I}),ige=e=>{let t=V(2),n=dd(e),r;return t[0]===n?r=t[1]:(r=e=>{let t=new ResizeObserver(()=>{n()}),r=new MutationObserver(e=>{e.some(age)&&n()});return t.observe(e),r.observe(e,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),()=>{t.disconnect(),r.disconnect()}},t[0]=n,t[1]=r),sI(r)};function age(e){return e.type!==`attributes`||e.attributeName!==`style`}var oge=({autoScroll:e,scrollToBottomOnRunStart:t=!0,scrollToBottomOnInitialize:n=!0,scrollToBottomOnThreadSwitch:r=!0})=>{let i=fT(null),a=H(e=>e.thread.messages.length>0),o=fT(!1),s=fT(null),c=HA();e===void 0&&(e=c.getState().turnAnchor!==`top`);let l=fT(0),u=fT(0),d=fT(0),f=fT(0),p=fT(null),m=mT(e=>{let t=i.current;t&&(p.current=e,t.scrollTo({top:t.scrollHeight,behavior:e}))},[]),h=mT(e=>{p.current=e,s.current!==null&&cancelAnimationFrame(s.current),s.current=requestAnimationFrame(()=>{s.current=null,m(e)})},[m]);gT(()=>()=>{s.current!==null&&cancelAnimationFrame(s.current)},[]);let g=mT(()=>{let e=c.getState();return e.turnAnchor===`top`&&e.element.viewport===i.current&&e.element.anchor!==null},[c]),_=()=>{let e=i.current;if(!e)return;let t=c.getState().isAtBottom,n=Math.abs(e.scrollHeight-e.scrollTop-e.clientHeight)<=1||e.scrollHeight<=e.clientHeight;!n&&l.current<e.scrollTop||(n?e.scrollHeight>e.clientHeight+1&&(p.current=null):l.current>e.scrollTop&&u.current===e.scrollHeight&&(p.current=null),(n||p.current===null)&&n!==t&&WA(c).setState({isAtBottom:n})),l.current=e.scrollTop,u.current=e.scrollHeight},v=ige(()=>{let t=i.current;if(!t)return;let{scrollHeight:n,clientHeight:r}=t;if(n===d.current&&r===f.current)return;d.current=n,f.current=r;let a=p.current;a&&g()?p.current=null:a?m(a):e&&c.getState().isAtBottom&&m(`instant`),_()}),y=sI(e=>{let t=()=>{p.current=null};return e.addEventListener(`scroll`,_),e.addEventListener(`pointerdown`,t),()=>{e.removeEventListener(`scroll`,_),e.removeEventListener(`pointerdown`,t)}});return gT(()=>{if(n){if(!a){o.current=!1;return}o.current||(o.current=!0,p.current===null&&h(`instant`))}},[a,h,n]),AF(({behavior:e})=>{m(e)}),EE(`thread.runStart`,()=>{t&&c.getState().turnAnchor!==`top`&&h(`auto`)}),EE(`threadListItem.switchedTo`,()=>{r&&h(`instant`)}),ac(v,y,i)},yI=(0,sT.forwardRef)((e,t)=>{let n=V(3),r;return n[0]!==e||n[1]!==t?(r=(0,B.jsx)(ej.div,{...e,ref:t}),n[0]=e,n[1]=t,n[2]=r):r=n[2],r});yI.displayName=`ThreadPrimitive.Root`;var bI=e=>{let{children:t}=e;return H(sge)?t:null};bI.displayName=`ThreadPrimitive.Empty`;function sge(e){return e.thread.isEmpty}var cge=e=>{let t=V(4),n;return t[0]!==e.disabled||t[1]!==e.empty||t[2]!==e.running?(n=t=>!(e.empty===!0&&!t.thread.isEmpty||e.empty===!1&&t.thread.isEmpty||e.running===!0&&!t.thread.isRunning||e.running===!1&&t.thread.isRunning||e.disabled===!0&&!t.thread.isDisabled||e.disabled===!1&&t.thread.isDisabled),t[0]=e.disabled,t[1]=e.empty,t[2]=e.running,t[3]=n):n=t[3],H(n)},xI=e=>{let t=V(3),n,r;return t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r),cge(r)?n:null};xI.displayName=`ThreadPrimitive.If`;var SI=(e,t)=>{let n=V(3),r;return n[0]!==t||n[1]!==e?(r=n=>{if(!e)return;let r=e(),i=()=>{let e=t?t(n):n.offsetHeight;r.setHeight(e)},a=new ResizeObserver(i);return a.observe(n),i(),()=>{a.disconnect(),r.unregister()}},n[0]=t,n[1]=e,n[2]=r):r=n[2],sI(r)},CI=e=>{let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t},lge=(e,t)=>{let n=0,r=e;for(;r&&r!==t;)n+=r.offsetTop,r=r.offsetParent;return r===t?n:CI(e)-CI(t)},wI=({viewport:e,anchor:t,tallerThan:n,visibleHeight:r})=>{let i=lge(t,e),a=t.offsetHeight;return i+Math.max(0,a-(a<=n?a:r))},uge=({scrollHeight:e,...t})=>{let{viewport:n}=t,r=wI(t)+n.clientHeight;return Math.max(0,r-e)},dge=({viewport:e,reserve:t,...n})=>uge({viewport:e,...n,scrollHeight:e.scrollHeight-t.offsetHeight}),fge=e=>{let t=new ResizeObserver(e),n=new MutationObserver(e),r=null,i=null,a=null,o=()=>{t.disconnect(),n.disconnect(),r=null,i=null,a=null};return{target:(e,s,c)=>{r===e&&i===s&&a===c||(o(),t.observe(e),t.observe(s),t.observe(c),n.observe(c,{childList:!0,subtree:!0,characterData:!0}),r=e,i=s,a=c)},disconnect:o}},pge=e=>{let t=null;return{schedule:()=>{t===null&&(t=requestAnimationFrame(()=>{t=null,e()}))},cancel:()=>{t!==null&&(cancelAnimationFrame(t),t=null)}}},mge=e=>{let t=null,n;function r(){let r=e.getState(),{viewport:o,anchor:s,target:c}=r.element,l=r.targetConfig;if(r.turnAnchor!==`top`||!o||!s||!c||!l){a.disconnect(),t&&(lI(t,0),t.remove());return}if(t??=Nhe(),(t.parentElement!==c.parentElement||t.previousElementSibling!==c)&&c.after(t),a.target(o,s,c),lI(t,dge({viewport:o,anchor:s,reserve:t,...l}))){i.schedule();return}let u=Mhe(s);if(u!==void 0&&n===u)return;let d=Phe(wI({viewport:o,anchor:s,...l}));Math.abs(o.scrollTop-d)>1&&o.scrollTo({top:d,behavior:`smooth`}),u!==void 0&&(n=u)}let i=pge(r),a=fge(i.schedule);i.schedule();let o=e.subscribe(i.schedule);return()=>{i.cancel(),o(),a.disconnect(),t?.remove()}},hge=e=>{let t=V(4),n=HA(),r,i;t[0]!==e||t[1]!==n?(r=()=>{if(e)return mge(n)},i=[e,n],t[0]=e,t[1]=n,t[2]=r,t[3]=i):(r=t[2],i=t[3]),gT(r,i)},TI=({isRunning:e,messages:t})=>{if(!e)return null;let n=t.at(-1),r=t.at(-2);return r?.role!==`user`||n?.role!==`assistant`?null:{anchorId:r.id,targetId:n.id}},gge=e=>TI(e)?.anchorId,_ge=e=>TI(e)?.targetId,vge=()=>SI(VA(xge),Sge),yge=()=>sI(VA(Cge)),bge=e=>{let t=V(13),n=HA(),r;t[0]===e?r=t[1]:(r=t=>{if(e)return gge(t.thread)},t[0]=e,t[1]=r);let i=H(r),a;t[2]===e?a=t[3]:(a=t=>{if(e)return _ge(t.thread)},t[2]=e,t[3]=a);let o=H(a),s;bb0:{if(!i||!o){s=null;break bb0}let e;t[4]!==i||t[5]!==o?(e={anchorId:i,targetId:o},t[4]=i,t[5]=o,t[6]=e):e=t[6],s=e}let c=s,l,u;t[7]!==c||t[8]!==n?(l=()=>{if(!c)return;let e=n.getState(),t=e.topAnchorTurn;t?.anchorId===c.anchorId&&t.targetId===c.targetId||e.setTopAnchorTurn(c)},u=[c,n],t[7]=c,t[8]=n,t[9]=l,t[10]=u):(l=t[9],u=t[10]),gT(l,u);let d;t[11]===n?d=t[12]:(d=()=>{n.getState().setTopAnchorTurn(null)},t[11]=n,t[12]=d);let f=d;EE(`thread.initialize`,f),EE(`threadListItem.switchedTo`,f)},EI=(0,sT.forwardRef)((e,t)=>{let n=V(18),r,i,a,o,s,c;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=n[6]):({autoScroll:r,scrollToBottomOnRunStart:s,scrollToBottomOnInitialize:o,scrollToBottomOnThreadSwitch:c,children:i,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s,n[6]=c);let l;n[7]!==r||n[8]!==o||n[9]!==s||n[10]!==c?(l={autoScroll:r,scrollToBottomOnRunStart:s,scrollToBottomOnInitialize:o,scrollToBottomOnThreadSwitch:c},n[7]=r,n[8]=o,n[9]=s,n[10]=c,n[11]=l):l=n[11];let u=oge(l),d=vge(),f=yge(),p=HA(),m;n[12]===p?m=n[13]:(m=p.getState(),n[12]=p,n[13]=m);let h=m.turnAnchor===`top`;bge(h),hge(h);let g=ac(t,u,d,f),_;return n[14]!==i||n[15]!==g||n[16]!==a?(_=(0,B.jsx)(ej.div,{...a,ref:g,children:i}),n[14]=i,n[15]=g,n[16]=a,n[17]=_):_=n[17],_});EI.displayName=`ThreadPrimitive.ViewportScrollable`;var DI=(0,sT.forwardRef)((e,t)=>{let n=V(13),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({turnAnchor:a,topAnchorMessageClamp:i,...r}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]!==i||n[5]!==a?(o={turnAnchor:a,topAnchorMessageClamp:i},n[4]=i,n[5]=a,n[6]=o):o=n[6];let s;n[7]!==r||n[8]!==t?(s=(0,B.jsx)(EI,{...r,ref:t}),n[7]=r,n[8]=t,n[9]=s):s=n[9];let c;return n[10]!==o||n[11]!==s?(c=(0,B.jsx)(GA,{options:o,children:s}),n[10]=o,n[11]=s,n[12]=c):c=n[12],c});DI.displayName=`ThreadPrimitive.Viewport`;function xge(e){return e.registerViewport}function Sge(e){return e.clientHeight}function Cge(e){return e.registerViewportElement}var OI=(0,sT.forwardRef)((e,t)=>{let n=V(3),r=ac(t,SI(VA(wge),Tge)),i;return n[0]!==e||n[1]!==r?(i=(0,B.jsx)(ej.div,{...e,ref:r}),n[0]=e,n[1]=r,n[2]=i):i=n[2],i});OI.displayName=`ThreadPrimitive.ViewportFooter`;function wge(e){return e.registerContentInset}function Tge(e){let t=parseFloat(getComputedStyle(e).marginTop)||0;return e.offsetHeight+t}var Ege=ij(`ThreadPrimitive.ScrollToBottom`,e=>{let t=V(5),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{behavior:r}=n,i=VA(Dge),a=HA(),o;return t[2]!==r||t[3]!==a?(o=()=>{a.getState().scrollToBottom({behavior:r})},t[2]=r,t[3]=a,t[4]=o):o=t[4],i?null:o},[`behavior`]);function Dge(e){return e.isAtBottom}var Oge=ij(`ThreadPrimitive.Suggestion`,e=>{let t=V(4),{prompt:n,send:r,clearComposer:i,autoSend:a}=e,o=r??a??!1,s;t[0]!==i||t[1]!==n||t[2]!==o?(s={prompt:n,send:o,clearComposer:i},t[0]=i,t[1]=n,t[2]=o,t[3]=s):s=t[3];let{disabled:c,trigger:l}=Pue(s);return c?null:l},[`prompt`,`send`,`clearComposer`,`autoSend`,`method`]),kI=QA({Empty:()=>bI,If:()=>xI,MessageByIndex:()=>hk,Messages:()=>vk,Root:()=>yI,ScrollToBottom:()=>Ege,Suggestion:()=>Oge,SuggestionByIndex:()=>PA,Suggestions:()=>rue,Viewport:()=>DI,ViewportFooter:()=>OI,ViewportProvider:()=>GA});function AI({...e}){return(0,B.jsx)(wN,{"data-slot":`popover`,...e})}function jI({...e}){return(0,B.jsx)(TN,{"data-slot":`popover-trigger`,...e})}function MI({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,B.jsx)(EN,{children:(0,B.jsx)(DN,{"data-slot":`popover-content`,align:t,sideOffset:n,className:Wg(`bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden`,e),...r})})}function NI(e){return(0,B.jsx)(nN,{"data-slot":`dropdown-menu`,...e})}function PI(e){return(0,B.jsx)(rN,{"data-slot":`dropdown-menu-trigger`,...e})}function FI({className:e,sideOffset:t=4,...n}){return(0,B.jsx)(iN,{children:(0,B.jsx)(aN,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:Wg(`bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md`,e),...n})})}function II({className:e,inset:t,variant:n=`default`,...r}){return(0,B.jsx)(oN,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:Wg(`focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r})}function LI({className:e,inset:t,...n}){return(0,B.jsx)(spe,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:Wg(`px-2 py-1.5 text-sm font-medium data-[inset]:pl-8`,e),...n})}function RI({className:e,...t}){return(0,B.jsx)(sN,{"data-slot":`dropdown-menu-separator`,className:Wg(`bg-border -mx-1 my-1 h-px`,e),...t})}function zI(e){return(0,B.jsx)(cpe,{"data-slot":`dropdown-menu-radio-group`,...e})}function BI({className:e,children:t,...n}){return(0,B.jsxs)(lpe,{"data-slot":`dropdown-menu-radio-item`,className:Wg(`focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n,children:[(0,B.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex size-3.5 items-center justify-center`,children:(0,B.jsx)(upe,{children:(0,B.jsx)(eS,{className:`size-2 fill-current`})})}),t]})}function VI({className:e,type:t,...n}){return(0,B.jsx)(`input`,{type:t,"data-slot":`input`,className:Wg(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function HI(e,t){let n=[],r=0;for(let i of e)t.has(i.messageId)?n.push(i):r++;return n.sort((e,n)=>{let r=t.get(e.messageId),i=t.get(n.messageId);if(r!==i)return r-i;let a=e.blockIndex??-1,o=n.blockIndex??-1;return a===o?e.createdAt-n.createdAt:a-o}),{ordered:n,unreachableCount:r}}function UI(e,t,n){if(e.length===0)return null;let r=t===null?-1:e.indexOf(t);return r===-1?n===1?e[0]:e[e.length-1]:e[(r+n+e.length)%e.length]}function WI(e){let t=[];for(let n of e.querySelectorAll(`.oc-md`))if(n.closest(`.oc-msg__meta`)===null)for(let e of n.children)e.tagName===`OL`||e.tagName===`UL`?t.push(...e.children):t.push(e);return t}function GI(e,t){return t===null?e:WI(e)[t]??e}function KI(e,t){let n=null,r=1/0;for(let i of e){let e=Math.abs(i.center-t);e<r&&(r=e,n=i.id)}return n}function qI(e,t=48){let n=e.replace(/\s+/g,` `).trim(),r=Array.from(n);if(r.length<=t)return n;let i=r.slice(0,t).join(``),a=i.lastIndexOf(` `);return(a>t*.6?i.slice(0,a):i)+`…`}var JI={mod:!0,key:`k`},YI={mod:!0,shift:!0,key:`o`},XI={mod:!0,shift:!0,key:`ArrowUp`},ZI={mod:!0,shift:!0,key:`ArrowDown`};function QI(e){return/mac/i.test(e)}function $I(){if(typeof navigator>`u`)return``;let e=navigator;return e.userAgentData?.platform||e.platform||e.userAgent||``}var eL=null;function tL(){return eL===null&&(eL=QI($I())),eL}var nL={arrowup:`↑`,arrowdown:`↓`,arrowleft:`←`,arrowright:`→`};function rL(e,t){let n=nL[e.key.toLowerCase()]??e.key.toUpperCase();if(t){let t=``;return e.alt&&(t+=`⌥`),e.shift&&(t+=`⇧`),e.mod&&(t+=`⌘`),t+n}let r=[];return e.mod&&r.push(`Ctrl`),e.shift&&r.push(`Shift`),e.alt&&r.push(`Alt`),r.push(n),r.join(`+`)}function iL(e,t){let n=e.metaKey||e.ctrlKey;return!!t.mod!==n||!!t.shift!==e.shiftKey||!!t.alt!==e.altKey?!1:e.key.toLowerCase()===t.key.toLowerCase()?!0:aL(e.code)===t.key.toLowerCase()}function aL(e){if(!e)return null;let t=/^Key([A-Z])$/.exec(e);if(t?.[1])return t[1].toLowerCase();let n=/^Digit([0-9])$/.exec(e);return n?.[1]?n[1]:null}function oL(e){if(!/^[a-z0-9]$/i.test(e.key)||!e.mod&&!e.alt)return!1;let t=t=>!!e.mod==!!t.mod&&!!e.shift==!!t.shift&&!!e.alt==!!t.alt&&e.key.toLowerCase()===t.key.toLowerCase();return!t(JI)&&!t(YI)}function sL(e){if([`Shift`,`Control`,`Meta`,`Alt`].includes(e.key))return null;let t=/^[a-z0-9]$/i.test(e.key)?e.key.toLowerCase():aL(e.code)??e.key.toLowerCase(),n={...e.metaKey||e.ctrlKey?{mod:!0}:{},...e.shiftKey?{shift:!0}:{},...e.altKey?{alt:!0}:{},key:t};return oL(n)?n:null}var cL=(0,z.createContext)(null);function lL(){return(0,z.useContext)(cL)}function uL(e,t,n,r){let i=!1,a=0,o=0,s=()=>{if(i)return;let c=document.querySelector(`[data-message-id="${CSS.escape(e)}"]`);if(c){let e=GI(c,t),i=c.closest(`.oc-thread__viewport`);if(!(()=>{if(!r?.skipScrollIfVisible||!i)return!1;let t=e.getBoundingClientRect(),n=i.getBoundingClientRect();return t.top>=n.top&&t.top<=n.bottom-48})())if(i){let t=e.getBoundingClientRect().top-i.getBoundingClientRect().top;i.scrollTo({top:i.scrollTop+t-Math.max(24,i.clientHeight*.3),behavior:n})}else e.scrollIntoView({block:`center`,behavior:n});let a=t===null?c:e,o=t===null?`oc-msg--highlight`:`oc-anchor--flash`;a.classList.remove(o),a.offsetWidth,a.classList.add(o),window.setTimeout(()=>a.classList.remove(o),2400);return}a++<40&&(o=window.setTimeout(s,150))};return o=window.setTimeout(s,0),()=>{i=!0,window.clearTimeout(o)}}function dL({chatId:e,focusMessageId:t,children:n}){let r=P(L.chatBookmarks.getBookmarks,{chatId:e}),i=I(L.chatBookmarks.toggleBookmark),a=I(L.chatBookmarks.removeBookmark),o=I(L.chatBookmarks.renameBookmark),s=I(L.chatBookmarks.setActiveBookmark),[c,l]=(0,z.useState)(null);(0,z.useEffect)(()=>{l(null)},[e]);let u=r?.activeBookmarkId??null;(0,z.useEffect)(()=>{c!==null&&u===c&&l(null)},[u,c]);let d=(0,z.useMemo)(()=>(r?.bookmarks??[]).map(e=>({id:e._id,messageId:e.messageId,blockIndex:e.blockIndex,label:e.label,createdAt:e.createdAt})),[r?.bookmarks]),f=c??u,p=(0,z.useMemo)(()=>{let e=new Map;for(let t of d){let n=e.get(t.messageId);n?n.push(t):e.set(t.messageId,[t])}return e},[d]),m=(0,z.useCallback)(t=>{l(t.id),uL(t.messageId,t.blockIndex,`smooth`),s({chatId:e,bookmarkId:t.id})},[e,s]),h=(0,z.useCallback)(t=>{l(t),s({chatId:e,bookmarkId:t})},[e,s]),g=(0,z.useMemo)(()=>({rows:d,activeId:f,byMessage:p,toggle:(t,n)=>void i({chatId:e,messageId:t,...n===null?{}:{blockIndex:n}}).then(e=>{e?.placed===!0&&uL(t,n,`smooth`,{skipScrollIfVisible:!0})}),remove:e=>void a({bookmarkId:e}),rename:(e,t)=>void o({bookmarkId:e,label:t}),jumpTo:m,setActiveQuiet:h}),[d,f,p,e,i,a,o,m,h]),_=(0,z.useRef)(null);return(0,z.useEffect)(()=>{if(_.current===e||r===void 0||(_.current=e,t!==null)||f===null)return;let n=d.find(e=>e.id===f);if(n!==void 0)return uL(n.messageId,n.blockIndex,`auto`)},[e,r===void 0]),(0,B.jsx)(cL.Provider,{value:g,children:n})}function fL(e){let t=e.target;return t instanceof HTMLElement?t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable:!1}function pL(e){if(e.label!==null&&e.label.length>0)return e.label;let t=document.querySelector(`[data-message-id="${CSS.escape(e.messageId)}"]`);if(t){let n=qI(GI(t,e.blockIndex).textContent??``);if(n.length>0)return n}return dr()}function mL(){let e=lL(),t=XA(e=>e.messages.length),[n,r]=(0,z.useState)([]),[i,a]=(0,z.useState)(0),o=e?.rows;(0,z.useEffect)(()=>{if(!o||o.length===0){r([]),a(0);return}let e=!1,t=0,n=0,i=()=>{if(e)return;let s=new Map;document.querySelectorAll(`.oc-thread__viewport [data-message-id]`).forEach((e,t)=>s.set(e.dataset.messageId??``,t));let c=HI(o,s);r(c.ordered),a(c.unreachableCount),c.ordered.length===0&&t++<40&&(n=window.setTimeout(i,150))};return i(),()=>{e=!0,window.clearTimeout(n)}},[o,t]);let[s,c]=(0,z.useState)(null),l=(0,z.useRef)(0),u=(0,z.useRef)(null),d=s!==null&&n.some(e=>e.id===s)?s:e?.activeId??null;(0,z.useEffect)(()=>{if(!e||n.length===0)return;let t=document.querySelector(`.oc-thread__viewport`);if(!t)return;let r=0,i=0,a=()=>{r===0&&(r=window.requestAnimationFrame(()=>{if(r=0,Date.now()-l.current<1200)return;let a=t.getBoundingClientRect(),o=a.top+a.height/2,s=[];for(let e of n){let n=t.querySelector(`[data-message-id="${CSS.escape(e.messageId)}"]`);if(!n)continue;let r=GI(n,e.blockIndex).getBoundingClientRect();s.push({id:e.id,center:(r.top+r.bottom)/2})}let d=KI(s,o);d!==null&&(c(d),u.current=d===e.activeId?null:d,window.clearTimeout(i),i=window.setTimeout(()=>{let t=u.current;u.current=null,t!==null&&e.setActiveQuiet(t)},800))}))};return t.addEventListener(`scroll`,a,{passive:!0}),()=>{t.removeEventListener(`scroll`,a),r!==0&&window.cancelAnimationFrame(r),window.clearTimeout(i);let n=u.current;u.current=null,n!==null&&e.setActiveQuiet(n)}},[e,n]);let f=(0,z.useCallback)(t=>{e&&(l.current=Date.now(),c(t.id),e.jumpTo(t))},[e]),p=(0,z.useCallback)(e=>{let t=UI(n.map(e=>e.id),d,e),r=n.find(e=>e.id===t);r&&f(r)},[n,d,f]);if((0,z.useEffect)(()=>{if(n.length===0)return;let e=e=>{fL(e)||(iL(e,XI)?(e.preventDefault(),p(-1)):iL(e,ZI)&&(e.preventDefault(),p(1)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n.length,p]),!e||e.rows.length===0)return null;let m=n.findIndex(e=>e.id===d),h=`${m===-1?`–`:m+1}/${n.length}`;return(0,B.jsxs)(`div`,{className:`oc-bmk-rail`,role:`navigation`,"aria-label":tv(),title:i>0?js({count:String(i)}):void 0,children:[(0,B.jsx)(Ov,{variant:`ghost`,size:`icon`,className:`oc-bmk-rail__btn`,onClick:()=>p(-1),disabled:n.length===0,title:`${hl()} (${rL(XI,tL())})`,"aria-label":hl(),children:(0,B.jsx)(Xx,{size:14})}),(0,B.jsxs)(NI,{children:[(0,B.jsx)(PI,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-bmk-rail__count`,title:Nr(),"aria-label":Nr(),children:[(0,B.jsx)(Ux,{size:11,"aria-hidden":!0}),(0,B.jsx)(`span`,{"aria-live":`polite`,children:h})]})}),(0,B.jsxs)(FI,{side:`left`,align:`center`,className:`oc-bmk-menu`,children:[n.map(e=>(0,B.jsxs)(II,{className:e.id===d?`oc-bmk-menu__item--current`:void 0,onSelect:()=>f(e),children:[(0,B.jsx)(Ux,{size:12,"aria-hidden":!0,className:`oc-bmk-menu__flag`}),(0,B.jsx)(`span`,{className:`oc-bmk-menu__text`,children:pL(e)})]},e.id)),i>0?(0,B.jsx)(`div`,{className:`oc-bmk-menu__foot`,children:js({count:String(i)})}):null]})]}),(0,B.jsx)(Ov,{variant:`ghost`,size:`icon`,className:`oc-bmk-rail__btn`,onClick:()=>p(1),disabled:n.length===0,title:`${Le()} (${rL(ZI,tL())})`,"aria-label":Le(),children:(0,B.jsx)(cv,{size:14})})]})}var hL=class extends z.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(){}render(){return this.state.failed?null:this.props.children}};function gL(e={}){return(0,B.jsx)(hL,{children:(0,B.jsx)(_L,{...e})})}function _L({messageLevelMarkers:e=!0,onReplyToBlock:t}={}){let n=lL(),r=U(e=>e.id),i=U(e=>e.status?.type===`running`),a=(0,z.useRef)(null),[o,s]=(0,z.useState)(null),[c,l]=(0,z.useState)(null),[u,d]=(0,z.useState)(new Map),f=n?.byMessage.get(r),p=(0,z.useMemo)(()=>e?f:f?.filter(e=>e.blockIndex!==null),[f,e]);if((0,z.useEffect)(()=>{let e=a.current?.closest(`.oc-msg`);s(e?.querySelector(`.oc-msg__body`)??e?.querySelector(`.oc-msg__bubble`)??null)},[r]),(0,z.useEffect)(()=>{if(!o||i||!n)return;let e=o.closest(`.oc-msg`)??o,t=0,r=e=>{t===0&&(t=window.requestAnimationFrame(()=>{t=0;let n=WI(o),r=o.getBoundingClientRect().top,i=null,a=1/0;for(let t=0;t<n.length;t++){let o=n[t].getBoundingClientRect();if(e.clientY>=o.top&&e.clientY<=o.bottom){l({top:o.top-r,blockIndex:t});return}let s=e.clientY<o.top?o.top-e.clientY:e.clientY-o.bottom;s<a&&(a=s,i={top:o.top-r,blockIndex:t})}l(a<=16?i:null)}))},a=()=>{t!==0&&(window.cancelAnimationFrame(t),t=0),l(null)};return e.addEventListener(`mousemove`,r),e.addEventListener(`mouseleave`,a),()=>{e.removeEventListener(`mousemove`,r),e.removeEventListener(`mouseleave`,a),t!==0&&window.cancelAnimationFrame(t)}},[o,i,n]),(0,z.useEffect)(()=>{if(!o||!p||p.length===0){d(new Map);return}let e=()=>{let e=o.getBoundingClientRect().top,t=new Map;for(let n of p){let r=GI(o,n.blockIndex);t.set(n.id,r.getBoundingClientRect().top-e)}d(t)};e();let t=new ResizeObserver(e);return t.observe(o),()=>t.disconnect()},[o,p]),!n||!o)return(0,B.jsx)(`span`,{ref:a,hidden:!0});let m=c!==null&&(p??[]).some(e=>e.blockIndex===c.blockIndex);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{ref:a,hidden:!0}),(0,Ex.createPortal)((0,B.jsxs)(B.Fragment,{children:[c!==null&&!i?(0,B.jsxs)(`span`,{className:`oc-bmk-gutterrow`,style:{top:c.top},children:[t?(0,B.jsx)(`button`,{type:`button`,className:`oc-bmk-gutter oc-bmk-gutter--reply`,title:Ci(),"aria-label":Ci(),onClick:()=>{let e=qI(GI(o,c.blockIndex).textContent??``,280);e!==``&&t(c.blockIndex,e)},children:(0,B.jsx)(XS,{size:14})}):null,(0,B.jsx)(`button`,{type:`button`,className:`oc-bmk-gutter${m?` is-set`:``}`,title:m?Ni():Bg(),"aria-label":m?Ni():Bg(),onClick:()=>n.toggle(r,c.blockIndex),children:(0,B.jsx)(Ux,{size:14})})]}):null,(p??[]).map(e=>{let t=u.get(e.id);return t===void 0?null:(0,B.jsx)(yL,{bookmark:e,top:t},e.id)})]}),o)]})}function vL({bookmark:e,trigger:t}){let n=lL(),[r,i]=(0,z.useState)(e.label??``),[a,o]=(0,z.useState)(!1);return n?(0,B.jsxs)(AI,{open:a,onOpenChange:t=>{o(t),t&&i(e.label??``)},children:[(0,B.jsx)(jI,{asChild:!0,children:t}),(0,B.jsx)(MI,{side:`left`,align:`start`,className:`oc-bmk-pop`,children:(0,B.jsxs)(`form`,{className:`oc-bmk-pop__form`,onSubmit:t=>{t.preventDefault(),n.rename(e.id,r),o(!1)},children:[(0,B.jsx)(VI,{value:r,onChange:e=>i(e.target.value),placeholder:Wc(),maxLength:60,autoFocus:!0}),(0,B.jsxs)(`div`,{className:`oc-bmk-pop__actions`,children:[(0,B.jsx)(Ov,{type:`submit`,size:`sm`,variant:`secondary`,children:Vn()}),(0,B.jsxs)(Ov,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{n.remove(e.id),o(!1)},children:[(0,B.jsx)(vC,{size:14,"aria-hidden":!0}),Hl()]})]})]})})]}):null}function yL({bookmark:e,top:t}){return(0,B.jsx)(vL,{bookmark:e,trigger:(0,B.jsx)(`button`,{type:`button`,className:`oc-bmk-marker`,style:{top:t},title:e.label??dr(),"aria-label":e.label??dr(),children:(0,B.jsx)(Ux,{size:14})})})}function bL(e){return(0,B.jsx)(hL,{children:(0,B.jsx)(xL,{...e})})}function xL({header:e=!1}){let t=lL(),n=U(e=>e.id),r=t?.byMessage.get(n)?.find(e=>e.blockIndex===null)??null;if(!t)return null;let i=r!==null,a=e?`oc-bmk-headbtn${i?` is-set`:``}`:`oc-iconbtn${i?` oc-iconbtn--bmk-set`:``}`;return e&&r!==null?(0,B.jsx)(vL,{bookmark:r,trigger:(0,B.jsx)(`button`,{type:`button`,className:a,title:r.label??dr(),"aria-label":r.label??dr(),children:(0,B.jsx)(Ux,{size:13})})}):(0,B.jsx)(`button`,{type:`button`,className:a,title:i?Ni():Bg(),"aria-label":i?Ni():Bg(),onClick:()=>t.toggle(n,null),children:(0,B.jsx)(Ux,{size:e?13:15})})}var SL=z.createContext(null),CL=6e3;function wL(e){let t=e?.data;if(typeof t==`string`&&t)return t;if(e instanceof Error)return e.message;if(typeof e==`string`)return e;try{return String(e)}catch{return Im()}}function TL({children:e}){let[t,n]=z.useState([]),r=z.useRef(0),i=z.useRef(new Map),a=z.useCallback(e=>{n(t=>t.filter(t=>t.id!==e));let t=i.current.get(e);t!==void 0&&(window.clearTimeout(t),i.current.delete(e))},[]),o=z.useCallback(e=>{let t=r.current++,o={id:t,variant:e.variant??`info`,title:e.title,description:e.description};n(e=>[...e,o]);let s=window.setTimeout(()=>a(t),CL);i.current.set(t,s)},[a]);z.useEffect(()=>{let e=i.current;return()=>{for(let t of e.values())window.clearTimeout(t);e.clear()}},[]);let s=z.useMemo(()=>({toast:o,error:(e,t)=>o({variant:`error`,title:e,description:t===void 0?void 0:wL(t)}),success:(e,t)=>o({variant:`success`,title:e,description:t})}),[o]);return(0,B.jsxs)(SL.Provider,{value:s,children:[e,(0,B.jsx)(`div`,{className:`oc-toast__viewport`,role:`region`,"aria-label":Gee(),children:t.map(e=>(0,B.jsxs)(`div`,{className:Wg(`oc-toast`,`oc-toast--${e.variant}`),role:e.variant===`error`?`alert`:`status`,children:[(0,B.jsxs)(`div`,{className:`oc-toast__body`,children:[(0,B.jsx)(`div`,{className:`oc-toast__title`,children:e.title}),e.description?(0,B.jsx)(`div`,{className:`oc-toast__desc`,children:e.description}):null]}),(0,B.jsx)(`button`,{type:`button`,className:`oc-toast__close`,"aria-label":P_(),onClick:()=>a(e.id),children:(0,B.jsx)(uv,{"aria-hidden":!0})})]},e.id))})]})}function EL(){let e=z.useContext(SL);if(!e)throw Error(`useToast must be used within <ToastProvider>`);return e}function DL(e){let t=(0,z.useRef)(null),n=(0,z.useRef)(e);return n.current=e,(0,z.useEffect)(()=>{let e=e=>{t.current!==null&&(n.current(e.clientX-t.current.x,e.clientY-t.current.y),t.current={x:e.clientX,y:e.clientY})},r=()=>{t.current=null};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,r),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,r)}},[]),e=>{t.current={x:e.clientX,y:e.clientY}}}function OL(){let e=(0,z.useSyncExternalStore)(zC,BC),t=wx(),n=EL();(0,z.useEffect)(()=>()=>void XC(),[]);let r=(0,z.useCallback)((e,t)=>{let n=BC()?.geom;n!==void 0&&KC({...n,x:n.x+e,y:n.y+t})},[]),i=(0,z.useCallback)((e,t)=>{let n=BC()?.geom;n!==void 0&&KC({...n,w:n.w+e,h:n.h+t})},[]),a=DL(r),o=DL(i);(0,z.useEffect)(()=>{let e=()=>{let e=BC()?.geom;e!==void 0&&KC(e)};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let s=(0,z.useRef)(null);(0,z.useEffect)(()=>()=>s.current?.stop(),[]);let c=e?.recording??!1,l=(0,z.useCallback)(()=>{if(BC()?.recording===!0){let e=UC();s.current?.stop(),s.current=null,gse(),window.setTimeout(()=>YC(e),1500);return}if(!iw())return;let e=BC()?.voiceLang||QC(``,Nm()),t={h:null,gen:0},r=()=>{s.current===t.h&&(s.current=null),YC(t.gen)},i=aw({lang:e,onText:(e,n)=>{t.gen===UC()&&WC(e,n.paragraph)},onInterim:e=>{t.gen===UC()&&GC(e)},onEnd:r,onError:e=>{r(),e===`not-allowed`||e===`service-not-allowed`?n.error(Rt()):e!==`no-speech`&&e!==`aborted`&&n.error(C_({code:e}))}});if(i===null){n.error(fc());return}t.h=i,s.current=i,HC(()=>i.stop()),t.gen=UC()},[n]),u=yw(e?.targetChatId??null);if(e===null)return null;let d=VC(e.geom,{w:window.innerWidth,h:window.innerHeight});return(0,Ex.createPortal)((0,B.jsxs)(`div`,{className:`oc-detach${c?` oc-detach--live`:``}`,style:{left:`${d.x}px`,top:`${d.y}px`,width:`${d.w}px`,height:`${d.h}px`},role:`dialog`,"aria-label":dh(),children:[(0,B.jsx)(`div`,{className:`oc-detach__handle`,onPointerDown:a,title:Qd(),"aria-label":Qd(),children:(0,B.jsx)(vS,{size:16,"aria-hidden":!0})}),(0,B.jsxs)(`div`,{className:`oc-detach__head`,onPointerDown:a,children:[c?(0,B.jsxs)(`span`,{className:`oc-detach__wave`,"aria-hidden":!0,children:[(0,B.jsx)(`i`,{}),(0,B.jsx)(`i`,{}),(0,B.jsx)(`i`,{})]}):null,(0,B.jsx)(`span`,{className:`oc-detach__chip`,title:e.targetLabel,children:e.targetLabel||dh()}),(0,B.jsx)(`button`,{type:`button`,className:`oc-detach__close`,title:qg(),"aria-label":qg(),onPointerDown:e=>e.stopPropagation(),onClick:()=>{Sse(e.targetChatId),XC()},children:(0,B.jsx)(uv,{size:14,"aria-hidden":!0})})]}),u.length>0?(0,B.jsx)(`div`,{className:`oc-detach__quotes`,children:u.map(n=>(0,B.jsxs)(`div`,{className:`oc-detach__quote`,role:`group`,"aria-label":nr(),children:[(0,B.jsx)(XS,{size:12,"aria-hidden":!0,className:`oc-detach__quote-ico`}),(0,B.jsx)(`button`,{type:`button`,className:`oc-detach__quote-text`,title:Fc(),onClick:()=>{uL(n.messageId,n.blockIndex,`smooth`),t({to:`/chat/$chatId`,params:{chatId:e.targetChatId}})},children:n.excerpt}),(0,B.jsx)(`button`,{type:`button`,className:`oc-detach__quote-x`,"aria-label":ol(),onClick:()=>hw(e.targetChatId,gw(n)),children:(0,B.jsx)(uv,{size:12,"aria-hidden":!0})})]},gw(n)))}):null,(0,B.jsx)(`textarea`,{className:`oc-detach__input`,value:e.text,placeholder:dh(),onChange:e=>dse(e.target.value),readOnly:e.sending,autoFocus:!0}),c&&e.interim!==``?(0,B.jsx)(`div`,{className:`oc-detach__interim`,"aria-hidden":!0,children:e.interim}):null,(0,B.jsxs)(`div`,{className:`oc-detach__bar`,children:[e.voiceEnabled&&iw()?(0,B.jsx)(`button`,{type:`button`,className:`oc-detach__icon${c?` oc-detach__icon--rec`:``}`,title:c?gt():ao(),"aria-label":c?gt():ao(),"aria-pressed":c,disabled:e.sending,onClick:l,children:c?(0,B.jsx)(NS,{size:16,"aria-hidden":!0}):(0,B.jsx)(PS,{size:16,"aria-hidden":!0})}):null,(0,B.jsx)(`button`,{type:`button`,className:`oc-detach__icon`,title:c?n_():Tg(),"aria-label":Tg(),disabled:e.sending||c,onClick:()=>{JC(),t({to:`/chat/$chatId`,params:{chatId:e.targetChatId}})},children:(0,B.jsx)(qS,{size:16,"aria-hidden":!0})}),(0,B.jsxs)(`button`,{type:`button`,className:`oc-detach__send`,disabled:e.text.trim()===``||c||e.sending,title:c?n_():Qg(),"aria-label":Qg(),onClick:()=>{fse(e.text),t({to:`/chat/$chatId`,params:{chatId:e.targetChatId}})},children:[(0,B.jsx)(tC,{size:15,"aria-hidden":!0}),Qg()]})]}),(0,B.jsx)(`button`,{type:`button`,className:`oc-detach__resize`,"aria-label":Fte(),onPointerDown:o})]}),document.body)}var kL=bg(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function AL({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,B.jsx)(n?R_:`span`,{"data-slot":`badge`,"data-variant":t,className:Wg(kL({variant:t}),e),...r})}function jL({...e}){return(0,B.jsx)(kde,{"data-slot":`alert-dialog`,...e})}function ML({...e}){return(0,B.jsx)(Ade,{"data-slot":`alert-dialog-portal`,...e})}function NL({className:e,...t}){return(0,B.jsx)(jde,{"data-slot":`alert-dialog-overlay`,className:Wg(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function PL({className:e,...t}){return(0,B.jsxs)(ML,{children:[(0,B.jsx)(NL,{}),(0,B.jsx)(Mde,{"data-slot":`alert-dialog-content`,className:Wg(`fixed top-1/2 left-1/2 z-50 grid w-[calc(100%-2rem)] max-w-md -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl border border-border bg-popover bg-clip-padding p-5 text-sm text-popover-foreground shadow-lg duration-200 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...t})]})}function FL({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:Wg(`flex flex-col gap-1.5`,e),...t})}function IL({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:Wg(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function LL({className:e,...t}){return(0,B.jsx)(Fde,{"data-slot":`alert-dialog-title`,className:Wg(`text-base font-medium text-foreground`,e),...t})}function RL({className:e,...t}){return(0,B.jsx)(Ide,{"data-slot":`alert-dialog-description`,className:Wg(`text-sm text-muted-foreground`,e),...t})}function zL({className:e,...t}){return(0,B.jsx)(Nde,{className:Wg(Dv(),e),...t})}function BL({className:e,...t}){return(0,B.jsx)(Pde,{className:Wg(Dv({variant:`outline`}),e),...t})}function VL(e,t,n){if(e===`*`)return{kind:`any`};let r=/^\*\/(\d{1,3})$/.exec(e);if(r!==null){let e=Number(r[1]);return e>=1?{kind:`step`,n:e}:null}let i=[];for(let r of e.split(`,`)){let e=/^(\d{1,3})-(\d{1,3})$/.exec(r);if(e!==null){let r=Number(e[1]),a=Number(e[2]);if(r>a||r<t||a>n)return null;for(let e=r;e<=a;e++)i.push(e);continue}if(!/^\d{1,3}$/.test(r))return null;let a=Number(r);if(a<t||a>n)return null;i.push(a)}return i.length>0&&i.length<=31?{kind:`values`,values:i}:null}function HL(e,t){let n=new Date(2024,0,1,e,t);return new Intl.DateTimeFormat(Nm(),{hour:`2-digit`,minute:`2-digit`}).format(n)}function UL(e){let t=new Date(2024,8,1+e%7);return new Intl.DateTimeFormat(Nm(),{weekday:`long`}).format(t)}function WL(e){let t=new Date(2024,e-1,1);return new Intl.DateTimeFormat(Nm(),{month:`long`}).format(t)}function GL(e){try{return new Intl.ListFormat(Nm(),{style:`long`,type:`conjunction`}).format(e)}catch{return e.join(`, `)}}function KL(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=VL(t[0],0,59),r=VL(t[1],0,23),i=VL(t[2],1,31),a=VL(t[3],1,12),o=VL(t[4],0,7);if(!n||!r||!i||!a||!o)return null;if(r.kind===`any`&&i.kind===`any`&&a.kind===`any`&&o.kind===`any`)return n.kind===`any`?df():n.kind===`step`?60%n.n==0?Sie({n:n.n}):null:n.values.length===1?qre({m:String(n.values[0]).padStart(2,`0`)}):null;if(r.kind===`step`&&n.kind===`values`&&n.values.length===1&&i.kind===`any`&&a.kind===`any`&&o.kind===`any`)return 24%r.n==0?hd({n:r.n}):null;if(n.kind!==`values`||n.values.length!==1||r.kind!==`values`||r.values.length!==1)return null;let s=HL(r.values[0],n.values[0]);if(o.kind===`values`&&i.kind===`any`&&a.kind===`any`)return jm({days:GL([...new Set(o.values.map(e=>e%7))].sort((e,t)=>e-t).map(UL)),time:s});if(o.kind!==`any`)return null;if(i.kind===`any`&&a.kind===`any`)return _ee({time:s});if(i.kind===`values`&&i.values.length===1){if(a.kind===`any`)return Bee({dom:i.values[0],time:s});if(a.kind===`values`&&a.values.length===1)return Jte({dom:i.values[0],month:WL(a.values[0]),time:s})}return null}function qL(e){if(e===null)return null;let t=/^(?:cron\s+)?([\d*,/-]+(?:\s+[\d*,/-]+){4})(?:\s*\(|$)/.exec(e.trim());return t===null?null:t[1]}function JL({icon:e,label:t,sublabel:n,trailing:r,tone:i=`default`,active:a,open:o,onClick:s,title:c,ariaLabel:l,ariaExpanded:u,ariaHasPopup:d,inert:f=!1}){return f?(0,B.jsxs)(`div`,{className:`oc-actrow oc-actrow--${i} oc-actrow--inert`,title:c,children:[(0,B.jsxs)(`span`,{className:`oc-actrow__top`,children:[(0,B.jsx)(`span`,{className:`oc-actrow__icon`,"aria-hidden":!0,children:e}),(0,B.jsx)(`span`,{className:`oc-actrow__label`,children:t}),r?(0,B.jsx)(`span`,{className:`oc-actrow__trail`,children:r}):null]}),n?(0,B.jsx)(`span`,{className:`oc-actrow__sub`,children:n}):null]}):(0,B.jsxs)(`button`,{type:`button`,className:`oc-actrow oc-actrow--${i}${a?` is-active`:``}${o?` is-open`:``}`,onClick:s,title:c,"aria-label":l,"aria-expanded":u,"aria-haspopup":d?`dialog`:void 0,children:[(0,B.jsxs)(`span`,{className:`oc-actrow__top`,children:[(0,B.jsx)(`span`,{className:`oc-actrow__icon`,"aria-hidden":!0,children:e}),(0,B.jsx)(`span`,{className:`oc-actrow__label`,children:t}),r?(0,B.jsx)(`span`,{className:`oc-actrow__trail`,children:r}):null,(0,B.jsx)(Yx,{size:14,className:`oc-actrow__chev`,"aria-hidden":!0})]}),n?(0,B.jsx)(`span`,{className:`oc-actrow__sub`,children:n}):null]})}var YL=(0,z.createContext)(null),XL=[];function ZL(e){return e===`created`?(0,B.jsx)(YS,{size:12,"aria-hidden":!0}):e===`removed`?(0,B.jsx)(vC,{size:12,"aria-hidden":!0}):e===`unchanged`?(0,B.jsx)($x,{size:12,"aria-hidden":!0}):(0,B.jsx)(WS,{size:12,"aria-hidden":!0})}function QL(e){return e===`created`?Fh():e===`removed`?ig():e===`unchanged`?mo():de()}function $L(){let e=U(e=>e.metadata?.custom?.cronParts??XL),t=U(e=>e.metadata?.custom?.routedInstanceName??null),n=U(e=>e.id),r=(0,z.useContext)(YL),[i,a]=(0,z.useState)(!0);return e.length===0?null:(0,B.jsxs)(`div`,{className:`oc-cronact`,children:[(0,B.jsx)(JL,{icon:(0,B.jsx)(Kx,{size:14}),label:pn({count:e.length}),open:i,ariaExpanded:i,title:Io(),onClick:()=>a(!i)}),i?(0,B.jsx)(`div`,{className:`oc-cronact__list`,children:e.map((e,i)=>(0,B.jsxs)(`button`,{type:`button`,className:`oc-cronact__item${r?.active!==null&&r?.active!==void 0&&r.active.jobId===(e.jobId??null)&&r.active.occurrenceId===`${n}#${i}`?` oc-cronact__item--active`:``}`,onClick:()=>r?.openFor(e,t,`${n}#${i}`),title:Ga(),children:[(0,B.jsxs)(`span`,{className:`oc-cronact__op oc-cronact__op--${e.op}`,children:[ZL(e.op),QL(e.op)]}),(0,B.jsx)(`span`,{className:`oc-cronact__name`,children:e.name??e.jobId??Sa()}),e.schedule===void 0?null:(0,B.jsx)(`span`,{className:`oc-cronact__sched`,children:e.schedule})]},`${e.jobId??`job`}-${i}`))}):null]})}function eR(e){return typeof e==`number`?new Intl.DateTimeFormat(Nm(),{dateStyle:`medium`,timeStyle:`short`}).format(e):`—`}function tR(e){return e===`ok`?(0,B.jsx)(AL,{variant:`secondary`,children:Hp()}):e===`error`?(0,B.jsx)(AL,{variant:`destructive`,children:Jo()}):e===`skipped`?(0,B.jsx)(AL,{variant:`outline`,children:V_()}):(0,B.jsx)(AL,{variant:`outline`,children:e??`—`})}function nR({instanceName:e,part:t,onClose:n,onChanged:r}){let i=mf(L.scheduled.getCronDetail),a=mf(L.scheduled.listCronRuns),o=mf(L.scheduled.updateCron),s=mf(L.scheduled.removeCron),c=mf(L.scheduled.runCronNow),l=EL(),u=t.jobId??null,[d,f]=(0,z.useState)(null),[m,h]=(0,z.useState)(null),[g,_]=(0,z.useState)(null),[v,y]=(0,z.useState)(`loading`),[b,x]=(0,z.useState)(null),[S,C]=(0,z.useState)(!1),w=(0,z.useRef)(0),T=(0,z.useCallback)(async()=>{let n=++w.current;if(f(null),h(null),_(null),u===null||t.op===`removed`){y(t.op===`removed`?`gone`:`error`);return}y(`loading`);try{let t=await i({instanceName:e,jobId:u});if(n!==w.current)return;if(f(t.job),h(t.capabilities),y(`ready`),t.capabilities.canHistory)try{let t=await a({instanceName:e,jobId:u,limit:5});if(n!==w.current)return;_(t)}catch{n===w.current&&_(null)}}catch(e){if(n!==w.current)return;let t=e?.data?.code;y(t===`not_found`?`gone`:`error`)}},[i,a,e,u,t.op]);(0,z.useEffect)(()=>{T()},[T]);let E=(0,z.useRef)(``);(0,z.useEffect)(()=>{E.current=`${e}:${u??``}`,x(null)},[e,u]);let D=async(t,n,i)=>{let a=`${e}:${u??``}`;x(t);try{if(await n(),E.current!==a)return;l.success(i),r?.(),await T()}catch(e){let t=e?.data?.code??`unknown`;l.toast({variant:`error`,title:Bre({code:t})})}finally{E.current===a&&x(e=>e===t?null:e)}},O=d??{id:u,name:t.name??null,enabled:t.enabled??null,schedule:t.schedule??null,message:t.message??null,deliveryMode:t.deliveryMode??null,agentId:t.agentId??null,nextRunAtMs:t.nextRunAtMs??null,lastRunStatus:null,lastDelivered:null,lastDeliveryError:null,updatedAtMs:null};return(0,B.jsxs)(`div`,{className:`oc-cronpanel`,children:[(0,B.jsxs)(`div`,{className:`oc-cronpanel__head`,children:[(0,B.jsx)(Kx,{size:16,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-cronpanel__title`,title:O.name??void 0,children:O.name??Sa()}),(0,B.jsx)(AL,{variant:`outline`,children:QL(t.op)}),(0,B.jsx)(Ov,{variant:`ghost`,size:`icon`,onClick:n,"aria-label":Ct(),children:(0,B.jsx)(uv,{"aria-hidden":!0})})]}),v===`loading`?(0,B.jsxs)(`div`,{className:`oc-cronpanel__loading`,children:[(0,B.jsx)(wS,{size:16,className:`oc-actrow__spin`,"aria-hidden":!0}),Kt()]}):null,v===`gone`?(0,B.jsx)(`div`,{className:`oc-cronpanel__notice`,children:bc()}):null,v===`error`?(0,B.jsx)(`div`,{className:`oc-cronpanel__notice`,children:j_()}):null,(0,B.jsxs)(`dl`,{className:`oc-cronpanel__facts`,children:[(0,B.jsx)(`dt`,{children:nt()}),(0,B.jsx)(`dd`,{children:O.enabled===!0?(0,B.jsx)(AL,{variant:`secondary`,children:ea()}):O.enabled===!1?(0,B.jsx)(AL,{variant:`outline`,children:ks()}):`—`}),(0,B.jsx)(`dt`,{children:Zs()}),(0,B.jsxs)(`dd`,{children:[(0,B.jsx)(`span`,{className:`oc-cronpanel__mono`,children:O.schedule??`—`}),(()=>{let e=qL(O.schedule),t=e===null?null:KL(e);return t===null?null:(0,B.jsx)(`span`,{className:`oc-cronpanel__plain`,children:t})})()]}),(0,B.jsx)(`dt`,{children:mie()}),(0,B.jsx)(`dd`,{children:eR(O.nextRunAtMs)}),(0,B.jsx)(`dt`,{children:wf()}),(0,B.jsx)(`dd`,{children:O.agentId??`—`}),O.deliveryMode===null?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{children:Mie()}),(0,B.jsx)(`dd`,{children:O.deliveryMode})]}),O.lastDelivered===!1?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{children:Qre()}),(0,B.jsxs)(`dd`,{className:`oc-cronpanel__undelivered`,children:[Dd(),O.lastDeliveryError===null?null:(0,B.jsx)(`span`,{className:`oc-cronpanel__plain`,children:O.lastDeliveryError})]})]}):null]}),O.message===null?null:(0,B.jsxs)(`div`,{className:`oc-cronpanel__message`,children:[(0,B.jsx)(`div`,{className:`oc-cronpanel__message-label`,children:vm()}),(0,B.jsx)(`div`,{className:`oc-cronpanel__message-body`,children:O.message})]}),v===`ready`&&m!==null&&u!==null?(0,B.jsxs)(`div`,{className:`oc-cronpanel__actions`,children:[m.canRunNow?(0,B.jsxs)(Ov,{variant:`outline`,size:`sm`,disabled:b!==null,onClick:()=>D(`run`,async()=>{let t=await c({instanceName:e,jobId:u});if(t.ran!==!0&&t.runId===null)throw{data:{code:t.reason??`run_not_started`}}},Mee()),children:[b===`run`?(0,B.jsx)(wS,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsx)(EC,{size:14,"aria-hidden":!0}),Um()]}):null,m.canToggle&&O.enabled!==null?(0,B.jsxs)(Ov,{variant:`outline`,size:`sm`,disabled:b!==null,onClick:()=>D(`toggle`,()=>o({instanceName:e,jobId:u,patch:{enabled:!(O.enabled??!1)}}),O.enabled===!0?Xf():are()),children:[O.enabled===!0?(0,B.jsx)(US,{size:14,"aria-hidden":!0}):(0,B.jsx)(JS,{size:14,"aria-hidden":!0}),O.enabled===!0?Zee():nne()]}):null,m.canDelete?(0,B.jsxs)(Ov,{variant:`outline`,size:`sm`,disabled:b!==null,onClick:()=>C(!0),children:[(0,B.jsx)(vC,{size:14,"aria-hidden":!0}),see()]}):null,(0,B.jsx)(Ov,{variant:`ghost`,size:`sm`,asChild:!0,children:(0,B.jsxs)(Ax,{to:`/settings/$tab`,params:{tab:`scheduled`},search:u===null?void 0:{job:u},children:[(0,B.jsx)(lS,{size:14,"aria-hidden":!0}),vp()]})})]}):null,g!==null&&g.length>0?(0,B.jsxs)(`div`,{className:`oc-cronpanel__runs`,children:[(0,B.jsx)(`div`,{className:`oc-cronpanel__runs-label`,children:xre()}),g.map((e,t)=>(0,B.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,B.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[tR(e.status),(0,B.jsx)(`span`,{children:eR(e.runAtMs??e.ts)}),typeof e.durationMs==`number`?(0,B.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,B.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[p({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,B.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))]}):null,(0,B.jsx)(jL,{open:S,onOpenChange:C,children:(0,B.jsxs)(PL,{children:[(0,B.jsxs)(FL,{children:[(0,B.jsx)(LL,{children:tf()}),(0,B.jsx)(RL,{children:mh({name:O.name??u??``})})]}),(0,B.jsxs)(IL,{children:[(0,B.jsx)(BL,{children:zne()}),(0,B.jsx)(zL,{onClick:()=>{u!==null&&D(`delete`,()=>s({instanceName:e,jobId:u}),Lte())},children:hte()})]})]})})]})}var rR=class extends z.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(){}render(){return this.state.failed?(0,B.jsxs)(`div`,{className:`oc-panel-failed`,children:[(0,B.jsx)(`p`,{children:Aa()}),this.props.onClose===void 0?null:(0,B.jsx)(`button`,{type:`button`,className:`oc-panel-failed__close`,onClick:this.props.onClose,children:Uh()})]}):this.props.children}},iR=[`github-light`,`github-dark`],aR=[`code`,`math`,`cjk`];function oR(e,t){let n={};for(let r of aR){let i=e?.[r];if(i===!1)continue;let a=i||t[r];a&&(n[r]=a)}let r=e?.mermaid;return r&&r!==!1&&(n.mermaid=r),n}function sR(e){return typeof e==`object`&&!!e&&`type`in e&&`key`in e}function cR(e,t){return e===t?!0:!sR(e)||!sR(t)?!1:e.type===t.type&&e.key===t.key}function lR(e,t){let n=Object.keys(e).filter(e=>e!==`children`),r=Object.keys(t).filter(e=>e!==`children`);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return cR(e.children,t.children)}var uR=(0,z.createContext)(null),dR=(0,z.memo)(function({children:e,node:t,...n}){let r=(0,z.isValidElement)(e)?(0,z.cloneElement)(e,{"data-block":`true`}):e;return(0,B.jsx)(uR.Provider,{value:{node:t,...n},children:r})},lR),fR=Object.defineProperty,pR=Object.defineProperties,mR=Object.getOwnPropertyDescriptors,hR=Object.getOwnPropertySymbols,gR=Object.prototype.hasOwnProperty,_R=Object.prototype.propertyIsEnumerable,vR=(e,t,n)=>t in e?fR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yR=(e,t)=>{for(var n in t||={})gR.call(t,n)&&vR(e,n,t[n]);if(hR)for(var n of hR(t))_R.call(t,n)&&vR(e,n,t[n]);return e},bR=(e,t)=>pR(e,mR(t)),xR=(e,t)=>{let n=!1,r=!1;for(let i=0;i<t;i+=1){if(e[i]===`\\`&&i+1<e.length&&e[i+1]==="`"){i+=1;continue}if(e.substring(i,i+3)==="```"){r=!r,i+=2;continue}!r&&e[i]==="`"&&(n=!n)}return n||r},SR=(e,t)=>{let n=e.substring(t,t+3)==="```",r=t>0&&e.substring(t-1,t+2)==="```",i=t>1&&e.substring(t-2,t+1)==="```";return n||r||i},CR=e=>{let t=0;for(let n=0;n<e.length;n+=1){if(e[n]===`\\`&&n+1<e.length&&e[n+1]==="`"){n+=1;continue}e[n]==="`"&&!SR(e,n)&&(t+=1)}return t},wR=(e,t)=>{let n=!1,r=!1,i=-1;for(let a=0;a<e.length;a+=1){if(e[a]===`\\`&&a+1<e.length&&e[a+1]==="`"){a+=1;continue}if(e.substring(a,a+3)==="```"){r=!r,a+=2;continue}if(!r&&e[a]==="`")if(n){if(i<t&&t<a)return!0;n=!1,i=-1}else n=!0,i=a}return!1},TR=/^(\s*(?:[-*+]|\d+[.)]) +)>(=?\s*[$]?\d)/gm,ER=e=>!e||typeof e!=`string`||!e.includes(`>`)?e:e.replace(TR,(t,n,r,i)=>xR(e,i)?t:`${n}\\>${r}`),DR=/(\*\*)([^*]*\*?)$/,OR=/(__)([^_]*?)$/,kR=/(\*\*\*)([^*]*?)$/,AR=/(\*)([^*]*?)$/,jR=/(_)([^_]*?)$/,MR=/(`)([^`]*?)$/,NR=/(~~)([^~]*?)$/,PR=/^[\s_~*`]*$/,FR=/^[\s]*[-*+][\s]+$/,IR=/[\p{L}\p{N}_]/u,LR=/^```[^`\n]*```?$/,RR=/^\*{4,}$/,zR=/(__)([^_]+)_$/,BR=/(~~)([^~]+)~$/,VR=/~~/g,HR=e=>{if(!e)return!1;let t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===95?!0:IR.test(e)},UR=(e,t)=>{let n=1;for(let r=t-1;r>=0;--r)if(e[r]===`]`)n+=1;else if(e[r]===`[`&&(--n,n===0))return r;return-1},WR=(e,t)=>{let n=1;for(let r=t+1;r<e.length;r+=1)if(e[r]===`[`)n+=1;else if(e[r]===`]`&&(--n,n===0))return r;return-1},GR=(e,t)=>{let n=!1,r=!1;for(let i=0;i<e.length&&i<t;i+=1){if(e[i]===`\\`&&e[i+1]===`$`){i+=1;continue}e[i]===`$`&&(e[i+1]===`$`?(r=!r,i+=1,n=!1):r||(n=!n))}return n||r},KR=(e,t)=>{for(let n=t;n<e.length;n+=1){if(e[n]===`)`)return!0;if(e[n]===`
|
|
107
|
+
`)return!1}return!1},qR=(e,t)=>{for(let n=t-1;n>=0;--n){if(e[n]===`)`)return!1;if(e[n]===`(`)return n>0&&e[n-1]===`]`?KR(e,t):!1;if(e[n]===`
|
|
108
|
+
`)return!1}return!1},JR=(e,t)=>{for(let n=t-1;n>=0;--n){if(e[n]===`>`)return!1;if(e[n]===`<`){let t=n+1<e.length?e[n+1]:``;return t>=`a`&&t<=`z`||t>=`A`&&t<=`Z`||t===`/`}if(e[n]===`
|
|
109
|
+
`)return!1}return!1},YR=(e,t,n)=>{let r=0;for(let n=t-1;n>=0;--n)if(e[n]===`
|
|
110
|
+
`){r=n+1;break}let i=e.length;for(let n=t;n<e.length;n+=1)if(e[n]===`
|
|
111
|
+
`){i=n;break}let a=e.substring(r,i),o=0,s=!1;for(let e of a)if(e===n)o+=1;else if(e!==` `&&e!==` `){s=!0;break}return o>=3&&!s},XR=(e,t,n,r)=>n===`\\`||e.includes(`$`)&&GR(e,t)?!0:n!==`*`&&r===`*`?(t<e.length-2?e[t+2]:``)!==`*`:!!(n===`*`||n&&r&&HR(n)&&HR(r)||(!n||n===` `||n===` `||n===`
|
|
112
|
+
`)&&(!r||r===` `||r===` `||r===`
|
|
113
|
+
`)),ZR=e=>{let t=0,n=!1,r=e.length;for(let i=0;i<r;i+=1){if(e[i]==="`"&&i+2<r&&e[i+1]==="`"&&e[i+2]==="`"){n=!n,i+=2;continue}if(n||e[i]!==`*`)continue;let a=i>0?e[i-1]:``,o=i<r-1?e[i+1]:``;XR(e,i,a,o)||(t+=1)}return t},QR=(e,t,n,r)=>!!(n===`\\`||e.includes(`$`)&&GR(e,t)||qR(e,t)||JR(e,t)||n===`_`||r===`_`||n&&r&&HR(n)&&HR(r)),$R=e=>{let t=0,n=!1,r=e.length;for(let i=0;i<r;i+=1){if(e[i]==="`"&&i+2<r&&e[i+1]==="`"&&e[i+2]==="`"){n=!n,i+=2;continue}if(n||e[i]!==`_`)continue;let a=i>0?e[i-1]:``,o=i<r-1?e[i+1]:``;QR(e,i,a,o)||(t+=1)}return t},ez=e=>{let t=0,n=0,r=!1;for(let i=0;i<e.length;i+=1){if(e[i]==="`"&&i+2<e.length&&e[i+1]==="`"&&e[i+2]==="`"){n>=3&&(t+=Math.floor(n/3)),n=0,r=!r,i+=2;continue}r||(e[i]===`*`?n+=1:(n>=3&&(t+=Math.floor(n/3)),n=0))}return n>=3&&(t+=Math.floor(n/3)),t},tz=e=>{let t=0,n=!1;for(let r=0;r<e.length;r+=1){if(e[r]==="`"&&r+2<e.length&&e[r+1]==="`"&&e[r+2]==="`"){n=!n,r+=2;continue}n||e[r]===`*`&&r+1<e.length&&e[r+1]===`*`&&(t+=1,r+=1)}return t},nz=e=>{let t=0,n=!1;for(let r=0;r<e.length;r+=1){if(e[r]==="`"&&r+2<e.length&&e[r+1]==="`"&&e[r+2]==="`"){n=!n,r+=2;continue}n||e[r]===`_`&&r+1<e.length&&e[r+1]===`_`&&(t+=1,r+=1)}return t},rz=(e,t,n)=>{if(!t||PR.test(t))return!0;let r=e.substring(0,n).lastIndexOf(`
|
|
114
|
+
`),i=r===-1?0:r+1,a=e.substring(i,n);return FR.test(a)&&t.includes(`
|
|
115
|
+
`)?!0:YR(e,n,`*`)},iz=e=>{let t=e.match(DR);if(!t)return e;let n=t[2],r=e.lastIndexOf(t[1]);return xR(e,r)||wR(e,r)||rz(e,n,r)?e:tz(e)%2==1?n.endsWith(`*`)?`${e}*`:`${e}**`:e},az=(e,t,n)=>{if(!t||PR.test(t))return!0;let r=e.substring(0,n).lastIndexOf(`
|
|
116
|
+
`),i=r===-1?0:r+1,a=e.substring(i,n);return FR.test(a)&&t.includes(`
|
|
117
|
+
`)?!0:YR(e,n,`_`)},oz=e=>{let t=e.match(OR);if(!t){let t=e.match(zR);if(t){let n=e.lastIndexOf(t[1]);if(!(xR(e,n)||wR(e,n))&&nz(e)%2==1)return`${e}_`}return e}let n=t[2],r=e.lastIndexOf(t[1]);return xR(e,r)||wR(e,r)||az(e,n,r)?e:nz(e)%2==1?`${e}__`:e},sz=e=>{let t=!1;for(let n=0;n<e.length;n+=1){if(e[n]==="`"&&n+2<e.length&&e[n+1]==="`"&&e[n+2]==="`"){t=!t,n+=2;continue}if(!t&&e[n]===`*`&&e[n-1]!==`*`&&e[n+1]!==`*`&&e[n-1]!==`\\`&&!GR(e,n)){let t=n>0?e[n-1]:``,r=n<e.length-1?e[n+1]:``;if((!t||t===` `||t===` `||t===`
|
|
118
|
+
`)&&(!r||r===` `||r===` `||r===`
|
|
119
|
+
`)||t&&r&&HR(t)&&HR(r))continue;return n}}return-1},cz=e=>{if(!e.match(AR))return e;let t=sz(e);if(t===-1||xR(e,t)||wR(e,t))return e;let n=e.substring(t+1);return!n||PR.test(n)?e:ZR(e)%2==1?`${e}*`:e},lz=e=>{let t=!1;for(let n=0;n<e.length;n+=1){if(e[n]==="`"&&n+2<e.length&&e[n+1]==="`"&&e[n+2]==="`"){t=!t,n+=2;continue}if(!t&&e[n]===`_`&&e[n-1]!==`_`&&e[n+1]!==`_`&&e[n-1]!==`\\`&&!GR(e,n)&&!qR(e,n)){let t=n>0?e[n-1]:``,r=n<e.length-1?e[n+1]:``;if(t&&r&&HR(t)&&HR(r))continue;return n}}return-1},uz=e=>{let t=e.length;for(;t>0&&e[t-1]===`
|
|
120
|
+
`;)--t;return t<e.length?`${e.slice(0,t)}_${e.slice(t)}`:`${e}_`},dz=e=>{if(!e.endsWith(`**`))return null;let t=e.slice(0,-2);if(tz(t)%2!=1)return null;let n=t.indexOf(`**`),r=lz(t);return n!==-1&&r!==-1&&n<r?`${t}_**`:null},fz=e=>{if(!e.match(jR))return e;let t=lz(e);if(t===-1)return e;let n=e.substring(t+1);if(!n||PR.test(n)||xR(e,t)||wR(e,t))return e;if($R(e)%2==1){let t=dz(e);return t===null?uz(e):t}return e},pz=e=>{let t=tz(e),n=ZR(e);return t%2==0&&n%2==0},mz=(e,t,n)=>!t||PR.test(t)||xR(e,n)||wR(e,n)?!0:YR(e,n,`*`),hz=e=>{if(RR.test(e))return e;let t=e.match(kR);if(!t)return e;let n=t[2];return mz(e,n,e.lastIndexOf(t[1]))?e:ez(e)%2==1?pz(e)?e:`${e}***`:e},gz=/<[a-zA-Z/][^>]*$/,_z=e=>{let t=e.match(gz);return!t||t.index===void 0||xR(e,t.index)?e:e.substring(0,t.index).trimEnd()},vz=e=>!e.match(LR)||e.includes(`
|
|
121
|
+
`)?null:e.endsWith("``")&&!e.endsWith("```")?`${e}\``:e,yz=e=>(e.match(/```/g)||[]).length%2==1,bz=e=>{let t=vz(e);if(t!==null)return t;let n=e.match(MR);if(n&&!yz(e)){let t=n[2];if(!t||PR.test(t))return e;if(CR(e)%2==1)return`${e}\``}return e},xz=(e,t)=>t>=2&&e.substring(t-2,t+1)==="```"||t>=1&&e.substring(t-1,t+2)==="```"||t<=e.length-3&&e.substring(t,t+3)==="```",Sz=e=>{let t=0,n=!1;for(let r=0;r<e.length-1;r+=1)e[r]==="`"&&!xz(e,r)&&(n=!n),!n&&e[r]===`$`&&e[r+1]===`$`&&(t+=1,r+=1);return t},Cz=e=>{let t=0,n=!1;for(let r=0;r<e.length;r+=1){if(e[r]===`\\`){r+=1;continue}if(e[r]==="`"&&!xz(e,r)){n=!n;continue}!n&&e[r]===`$`&&(r+1<e.length&&e[r+1]===`$`?r+=1:t+=1)}return t},wz=e=>{if(e.endsWith(`$`)&&!e.endsWith(`$$`))return`${e}$`;let t=e.indexOf(`$$`);return t!==-1&&e.indexOf(`
|
|
122
|
+
`,t)!==-1&&!e.endsWith(`
|
|
123
|
+
`)?`${e}
|
|
124
|
+
$$`:`${e}$$`},Tz=e=>Sz(e)%2==0?e:wz(e),Ez=e=>Cz(e)%2==1?`${e}$`:e,Dz=(e,t,n)=>{if(e.substring(t+2).includes(`)`))return null;let r=UR(e,t);if(r===-1||xR(e,r))return null;let i=r>0&&e[r-1]===`!`,a=i?r-1:r,o=e.substring(0,a);if(i)return o;let s=e.substring(r+1,t);return n===`text-only`?`${o}${s}`:`${o}[${s}](streamdown:incomplete-link)`},Oz=(e,t)=>{for(let n=0;n<t;n++)if(e[n]===`[`&&!xR(e,n)){if(n>0&&e[n-1]===`!`)continue;let t=WR(e,n);if(t===-1)return n;if(t+1<e.length&&e[t+1]===`(`){let r=e.indexOf(`)`,t+2);r!==-1&&(n=r)}}return t},kz=(e,t,n)=>{let r=t>0&&e[t-1]===`!`,i=r?t-1:t;if(!e.substring(t+1).includes(`]`)){let a=e.substring(0,i);if(r)return a;if(n===`text-only`){let n=Oz(e,t);return e.substring(0,n)+e.substring(n+1)}return`${e}](streamdown:incomplete-link)`}if(WR(e,t)===-1){let a=e.substring(0,i);if(r)return a;if(n===`text-only`){let n=Oz(e,t);return e.substring(0,n)+e.substring(n+1)}return`${e}](streamdown:incomplete-link)`}return null},Az=(e,t=`protocol`)=>{let n=e.lastIndexOf(`](`);if(n!==-1&&!xR(e,n)){let r=Dz(e,n,t);if(r!==null)return r}for(let n=e.length-1;n>=0;--n)if(e[n]===`[`&&!xR(e,n)){let r=kz(e,n,t);if(r!==null)return r}return e},jz=/^-{1,2}$/,Mz=/^[\s]*-{1,2}[\s]+$/,Nz=/^={1,2}$/,Pz=/^[\s]*={1,2}[\s]+$/,Fz=e=>{if(!e||typeof e!=`string`)return e;let t=e.lastIndexOf(`
|
|
125
|
+
`);if(t===-1)return e;let n=e.substring(t+1),r=e.substring(0,t),i=n.trim();if(jz.test(i)&&!n.match(Mz)){let t=r.split(`
|
|
126
|
+
`).at(-1);if(t&&t.trim().length>0)return`${e}\u200B`}if(Nz.test(i)&&!n.match(Pz)){let t=r.split(`
|
|
127
|
+
`).at(-1);if(t&&t.trim().length>0)return`${e}\u200B`}return e},Iz=RegExp(`(?<=[\\p{L}\\p{N}_])~(?!~)(?=[\\p{L}\\p{N}_])`,`gu`),Lz=e=>!e||typeof e!=`string`||!e.includes(`~`)?e:e.replace(Iz,(t,n)=>xR(e,n)?t:`\\~`),Rz=e=>{let t=e.match(NR);if(t){let n=t[2];if(!n||PR.test(n))return e;let r=e.lastIndexOf(t[1]);if(xR(e,r)||wR(e,r))return e;if(e.match(VR)?.length%2==1)return`${e}~~`}else{let t=e.match(BR);if(t){let n=e.lastIndexOf(t[0].slice(0,2));if(xR(e,n)||wR(e,n))return e;if(e.match(VR)?.length%2==1)return`${e}~`}}return e},zz=e=>e!==!1,Bz=e=>e===!0,Vz={SINGLE_TILDE:0,COMPARISON_OPERATORS:5,HTML_TAGS:10,SETEXT_HEADINGS:15,LINKS:20,BOLD_ITALIC:30,BOLD:35,ITALIC_DOUBLE_UNDERSCORE:40,ITALIC_SINGLE_ASTERISK:41,ITALIC_SINGLE_UNDERSCORE:42,INLINE_CODE:50,STRIKETHROUGH:60,KATEX:70,INLINE_KATEX:75,DEFAULT:100},Hz=[{handler:{name:`singleTilde`,handle:Lz,priority:Vz.SINGLE_TILDE},optionKey:`singleTilde`},{handler:{name:`comparisonOperators`,handle:ER,priority:Vz.COMPARISON_OPERATORS},optionKey:`comparisonOperators`},{handler:{name:`htmlTags`,handle:_z,priority:Vz.HTML_TAGS},optionKey:`htmlTags`},{handler:{name:`setextHeadings`,handle:Fz,priority:Vz.SETEXT_HEADINGS},optionKey:`setextHeadings`},{handler:{name:`links`,handle:Az,priority:Vz.LINKS},optionKey:`links`,earlyReturn:e=>e.endsWith(`](streamdown:incomplete-link)`)},{handler:{name:`boldItalic`,handle:hz,priority:Vz.BOLD_ITALIC},optionKey:`boldItalic`},{handler:{name:`bold`,handle:iz,priority:Vz.BOLD},optionKey:`bold`},{handler:{name:`italicDoubleUnderscore`,handle:oz,priority:Vz.ITALIC_DOUBLE_UNDERSCORE},optionKey:`italic`},{handler:{name:`italicSingleAsterisk`,handle:cz,priority:Vz.ITALIC_SINGLE_ASTERISK},optionKey:`italic`},{handler:{name:`italicSingleUnderscore`,handle:fz,priority:Vz.ITALIC_SINGLE_UNDERSCORE},optionKey:`italic`},{handler:{name:`inlineCode`,handle:bz,priority:Vz.INLINE_CODE},optionKey:`inlineCode`},{handler:{name:`strikethrough`,handle:Rz,priority:Vz.STRIKETHROUGH},optionKey:`strikethrough`},{handler:{name:`katex`,handle:Tz,priority:Vz.KATEX},optionKey:`katex`},{handler:{name:`inlineKatex`,handle:Ez,priority:Vz.INLINE_KATEX},optionKey:`inlineKatex`}],Uz=e=>{let t=e?.linkMode??`protocol`;return Hz.filter(({handler:t,optionKey:n})=>t.name===`links`?zz(e?.links)||zz(e?.images):t.name===`inlineKatex`?Bz(e?.inlineKatex):zz(e?.[n])).map(({handler:e,earlyReturn:n})=>e.name===`links`?{handler:bR(yR({},e),{handle:e=>Az(e,t)}),earlyReturn:t===`protocol`?n:void 0}:{handler:e,earlyReturn:n})},Wz=(e,t)=>{if(!e||typeof e!=`string`)return e;let n=e.endsWith(` `)&&!e.endsWith(` `)?e.slice(0,-1):e,r=Uz(t),i=(t?.handlers??[]).map(e=>({handler:bR(yR({},e),{priority:e.priority??Vz.DEFAULT}),earlyReturn:void 0})),a=[...r,...i].sort((e,t)=>(e.handler.priority??0)-(t.handler.priority??0));for(let{handler:e,earlyReturn:t}of a)if(n=e.handle(n),t!=null&&t(n))return n;return n},Gz=96,Kz=126,qz=32,Jz=9,Yz=13,Xz=92,Zz=e=>e===qz||e===Jz||e===Yz;function Qz(e,t,n){for(let r=t;r<n;r+=1)if(!Zz(e.charCodeAt(r)))return!1;return!0}function $z(e){let t=e.length,n=!1,r=0,i=0,a=!1,o=0,s=-1;for(let c=0;c<=t;){let l=e.indexOf(`
|
|
128
|
+
`,c);l===-1&&(l=t);let u=c;for(;u<l&&Zz(e.charCodeAt(u));)u+=1;let d=u<l?e.charCodeAt(u):-1,f=!1;if((d===Gz||d===Kz)&&u-c<=3){let t=u;for(;t<l&&e.charCodeAt(t)===d;)t+=1;t-u>=3&&(f=!0,n?d===r&&t-u>=i&&Qz(e,t,l)&&(n=!1):(n=!0,r=d,i=t-u))}if(!n&&!f)for(let t=e.indexOf(`$$`,c);t!==-1&&t<l-1;t=e.indexOf(`$$`,t+2))(t===0||e.charCodeAt(t-1)!==Xz)&&(a=!a);d===-1&&!n&&!a?s=l+1:s!==-1&&(o=s,s=-1),c=l+1}return o}function eB(e,t){let n=$z(e);return n<=0?Wz(e,t):e.slice(0,n)+Wz(e.slice(n),t)}var tB=/language-([^\s]+)/;function nB(e){if(typeof e==`string`)return e;if(!(0,z.isValidElement)(e))return``;let t=e.props;return t&&typeof t.children==`string`?t.children:``}function rB({node:e,...t}){return(0,B.jsx)(`pre`,{...t})}function iB({node:e,...t}){return(0,B.jsx)(`code`,{...t})}function aB(e){let{SyntaxHighlighter:t,CodeHeader:n,componentsByLanguage:r={}}=e;function i({node:e,className:i,children:a,"data-block":o,...s}){if(!o)return(0,B.jsx)(`code`,{className:`aui-streamdown-inline-code ${i??``}`.trim(),...s,children:a});let c=i?.match(tB)?.[1]??``,l=nB(a),u=r[c]?.SyntaxHighlighter??t,d=r[c]?.CodeHeader??n,f=d?(0,B.jsx)(d,{node:e,language:c,code:l}):null;return u?(0,B.jsxs)(B.Fragment,{children:[f,(0,B.jsx)(u,{node:e,components:{Pre:rB,Code:iB},language:c,code:l})]}):(0,B.jsxs)(B.Fragment,{children:[f,(0,B.jsx)(rB,{node:e,children:(0,B.jsx)(`code`,{className:i,...s,children:a})})]})}let a=(0,z.memo)(i,(e,t)=>e.className===t.className&&e[`data-block`]===t[`data-block`]&&e.children===t.children&&e.node?.position?.start.line===t.node?.position?.start.line&&e.node?.position?.end.line===t.node?.position?.end.line);return a.displayName=`AdaptedCode`,a}function oB(e){return!!(e.SyntaxHighlighter||e.CodeHeader||e.componentsByLanguage&&Object.keys(e.componentsByLanguage).length>0)}function sB({components:e,componentsByLanguage:t}){return(0,z.useMemo)(()=>{let{SyntaxHighlighter:n,CodeHeader:r,...i}=e??{},a={SyntaxHighlighter:n,CodeHeader:r,componentsByLanguage:t},o={pre:dR};if(!oB(a))return{...i,...o};let s=aB(a);return{...i,...o,code:s}},[e,t])}var cB=(function(e){if(e==null)return pB;if(typeof e==`function`)return fB(e);if(typeof e==`object`)return Array.isArray(e)?lB(e):uB(e);if(typeof e==`string`)return dB(e);throw Error(`Expected function, string, or object as test`)});function lB(e){let t=[],n=-1;for(;++n<e.length;)t[n]=cB(e[n]);return fB(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function uB(e){let t=e;return fB(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function dB(e){return fB(t);function t(t){return t&&t.type===e}}function fB(e){return t;function t(t,n,r){return!!(mB(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function pB(){return!0}function mB(e){return typeof e==`object`&&!!e&&`type`in e}function hB(e){return e}var gB=[],_B=`skip`;function vB(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=cB(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+hB(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=gB,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=yB(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function yB(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?gB:[e]}function bB(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),vB(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var xB={indicator:`indicator`,textOnly:`text-only`,remove:`remove`};function SB({defaultOrigin:e=``,allowedLinkPrefixes:t=[],allowedImagePrefixes:n=[],allowDataImages:r=!1,allowedProtocols:i=[],blockedImageClass:a=`inline-block bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400 px-3 py-1 rounded text-sm`,blockedLinkClass:o=`text-gray-500`,linkBlockPolicy:s=xB.indicator,imageBlockPolicy:c=xB.indicator}){let l=t.length&&!t.every(e=>e===`*`),u=n.length&&!n.every(e=>e===`*`);if(!e&&(l||u))throw Error(`defaultOrigin is required when allowedLinkPrefixes or allowedImagePrefixes are provided`);return l=>{let u=MB(e,t,n,r,i,a,o,s,c);OB(l),bB(l,u)}}function CB(e,t){if(typeof e!=`string`)return null;try{return new URL(e)}catch{if(t)try{return new URL(e,t)}catch{return null}if(e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`))try{return new URL(e,`http://example.com`)}catch{return null}return null}}function wB(e){return typeof e==`string`?e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`):!1}var TB=new Set([`https:`,`http:`,`irc:`,`ircs:`,`mailto:`,`xmpp:`,`blob:`]),EB=new Set([`javascript:`,`data:`,`file:`,`vbscript:`]);function DB(e,t,n,r=!1,i=!1,a=[]){if(!e)return null;if(typeof e==`string`&&e.startsWith(`#`)&&!i)try{if(new URL(e,`http://example.com`).hash===e)return e}catch{}if(typeof e==`string`&&e.startsWith(`data:`))return i&&r&&e.startsWith(`data:image/`)?e:null;if(typeof e==`string`&&e.startsWith(`blob:`)){try{if(new URL(e).protocol===`blob:`&&e.length>5){let t=e.substring(5);if(t&&t.length>0&&t!==`invalid`)return e}}catch{return null}return null}let o=CB(e,n);if(!o||EB.has(o.protocol)||!(TB.has(o.protocol)||a.includes(o.protocol)||a.includes(`*`)))return null;if(o.protocol===`mailto:`||!o.protocol.match(/^https?:$/))return o.href;let s=wB(e);return o&&t.some(e=>{let t=CB(e,n);return!t||t.origin!==o.origin?!1:o.href.startsWith(t.href)})?s?o.pathname+o.search+o.hash:o.href:t.includes(`*`)?o.protocol!==`https:`&&o.protocol!==`http:`?null:s?o.pathname+o.search+o.hash:o.href:null}function OB(e){if(`children`in e&&Array.isArray(e.children)){e.children=e.children.filter(e=>e!=null);for(let t of e.children)OB(t)}}var kB=Symbol(`node-seen`);function AB(e,t,n){return t===xB.remove?{type:`remove`}:t===xB.textOnly?{type:`replace`,element:{type:`element`,tagName:`span`,properties:{},children:[...e.children]}}:{type:`replace`,element:{type:`element`,tagName:`span`,properties:{title:`Blocked URL: `+String(e.properties.href),class:n},children:[...e.children,{type:`text`,value:` [blocked]`}]}}}function jB(e,t,n){if(t===xB.remove)return{type:`remove`};if(t===xB.textOnly){let t=String(e.properties.alt||``);return t?{type:`replace`,element:{type:`element`,tagName:`span`,properties:{},children:[{type:`text`,value:t}]}}:{type:`remove`}}return{type:`replace`,element:{type:`element`,tagName:`span`,properties:{class:n},children:[{type:`text`,value:`[Image blocked: `+String(e.properties.alt||`No description`)+`]`}]}}}var MB=(e,t,n,r,i,a,o,s,c)=>{let l=(u,d,f)=>{if(u.type!==`element`||u[kB])return!0;if(u.tagName===`a`){let n=DB(u.properties.href,t,e,!1,!1,i);if(n===null){if(u[kB]=!0,bB(u,l),f&&typeof d==`number`){let e=AB(u,s,o);if(e.type===`remove`)return f.children.splice(d,1),[_B,d];f.children[d]=e.element}return _B}else return u.properties.href=n,u.properties.target=`_blank`,u.properties.rel=`noopener noreferrer`,!0}if(u.tagName===`img`){let t=DB(u.properties.src,n,e,r,!0,i);if(t===null){if(u[kB]=!0,bB(u,l),f&&typeof d==`number`){let e=jB(u,c,a);if(e.type===`remove`)return f.children.splice(d,1),[_B,d];f.children[d]=e.element}return _B}else return u.properties.src=t,!0}return!0};return l},NB=typeof self==`object`?self:globalThis,PB=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new NB[e](t)},FB=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(PB(e,t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(PB(a,o),i)};return r},IB=e=>FB(new Map,e)(0),LB=``,{toString:RB}={},{keys:zB}=Object,BB=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=RB.call(e).slice(8,-1);switch(n){case`Array`:return[1,LB];case`Object`:return[2,LB];case`Date`:return[3,LB];case`RegExp`:return[4,LB];case`Map`:return[5,LB];case`Set`:return[6,LB];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},VB=([e,t])=>e===0&&(t===`function`||t===`symbol`),HB=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=BB(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of zB(r))(e||!VB(BB(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(VB(BB(n))||VB(BB(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!VB(BB(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},UB=(e,{json:t,lossy:n}={})=>{let r=[];return HB(!(t||n),!!t,new Map,r)(e),r},WB=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?IB(UB(e,t)):structuredClone(e):(e,t)=>IB(UB(e,t)),GB=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};GB.prototype.normal={},GB.prototype.property={},GB.prototype.space=void 0;function KB(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new GB(n,r,t)}function qB(e){return e.toLowerCase()}var JB=class{constructor(e,t){this.attribute=t,this.property=e}};JB.prototype.attribute=``,JB.prototype.booleanish=!1,JB.prototype.boolean=!1,JB.prototype.commaOrSpaceSeparated=!1,JB.prototype.commaSeparated=!1,JB.prototype.defined=!1,JB.prototype.mustUseProperty=!1,JB.prototype.number=!1,JB.prototype.overloadedBoolean=!1,JB.prototype.property=``,JB.prototype.spaceSeparated=!1,JB.prototype.space=void 0;var YB=s({boolean:()=>ZB,booleanish:()=>QB,commaOrSpaceSeparated:()=>nV,commaSeparated:()=>tV,number:()=>W,overloadedBoolean:()=>$B,spaceSeparated:()=>eV}),XB=0,ZB=rV(),QB=rV(),$B=rV(),W=rV(),eV=rV(),tV=rV(),nV=rV();function rV(){return 2**++XB}var iV=Object.keys(YB),aV=class extends JB{constructor(e,t,n,r){let i=-1;if(super(e,t),oV(this,`space`,r),typeof n==`number`)for(;++i<iV.length;){let e=iV[i];oV(this,iV[i],(n&YB[e])===YB[e])}}};aV.prototype.defined=!0;function oV(e,t,n){n&&(e[t]=n)}function sV(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new aV(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[qB(r)]=r,n[qB(a.attribute)]=r}return new GB(t,n,e.space)}var cV=sV({properties:{ariaActiveDescendant:null,ariaAtomic:QB,ariaAutoComplete:null,ariaBusy:QB,ariaChecked:QB,ariaColCount:W,ariaColIndex:W,ariaColSpan:W,ariaControls:eV,ariaCurrent:null,ariaDescribedBy:eV,ariaDetails:null,ariaDisabled:QB,ariaDropEffect:eV,ariaErrorMessage:null,ariaExpanded:QB,ariaFlowTo:eV,ariaGrabbed:QB,ariaHasPopup:null,ariaHidden:QB,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:eV,ariaLevel:W,ariaLive:null,ariaModal:QB,ariaMultiLine:QB,ariaMultiSelectable:QB,ariaOrientation:null,ariaOwns:eV,ariaPlaceholder:null,ariaPosInSet:W,ariaPressed:QB,ariaReadOnly:QB,ariaRelevant:null,ariaRequired:QB,ariaRoleDescription:eV,ariaRowCount:W,ariaRowIndex:W,ariaRowSpan:W,ariaSelected:QB,ariaSetSize:W,ariaSort:null,ariaValueMax:W,ariaValueMin:W,ariaValueNow:W,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function lV(e,t){return t in e?e[t]:t}function uV(e,t){return lV(e,t.toLowerCase())}var dV=sV({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:tV,acceptCharset:eV,accessKey:eV,action:null,allow:null,allowFullScreen:ZB,allowPaymentRequest:ZB,allowUserMedia:ZB,alpha:ZB,alt:null,as:null,async:ZB,autoCapitalize:null,autoComplete:eV,autoFocus:ZB,autoPlay:ZB,blocking:eV,capture:null,charSet:null,checked:ZB,cite:null,className:eV,closedBy:null,colorSpace:null,cols:W,colSpan:W,command:null,commandFor:null,content:null,contentEditable:QB,controls:ZB,controlsList:eV,coords:W|tV,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ZB,defer:ZB,dir:null,dirName:null,disabled:ZB,download:$B,draggable:QB,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ZB,formTarget:null,headers:eV,height:W,hidden:$B,high:W,href:null,hrefLang:null,htmlFor:eV,httpEquiv:eV,id:null,imageSizes:null,imageSrcSet:null,inert:ZB,inputMode:null,integrity:null,is:null,isMap:ZB,itemId:null,itemProp:eV,itemRef:eV,itemScope:ZB,itemType:eV,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ZB,low:W,manifest:null,max:null,maxLength:W,media:null,method:null,min:null,minLength:W,multiple:ZB,muted:ZB,name:null,nonce:null,noModule:ZB,noValidate:ZB,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ZB,optimum:W,pattern:null,ping:eV,placeholder:null,playsInline:ZB,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ZB,referrerPolicy:null,rel:eV,required:ZB,reversed:ZB,rows:W,rowSpan:W,sandbox:eV,scope:null,scoped:ZB,seamless:ZB,selected:ZB,shadowRootClonable:ZB,shadowRootCustomElementRegistry:ZB,shadowRootDelegatesFocus:ZB,shadowRootMode:null,shadowRootSerializable:ZB,shape:null,size:W,sizes:null,slot:null,span:W,spellCheck:QB,src:null,srcDoc:null,srcLang:null,srcSet:null,start:W,step:null,style:null,tabIndex:W,target:null,title:null,translate:null,type:null,typeMustMatch:ZB,useMap:null,value:QB,width:W,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:eV,axis:null,background:null,bgColor:null,border:W,borderColor:null,bottomMargin:W,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ZB,declare:ZB,event:null,face:null,frame:null,frameBorder:null,hSpace:W,leftMargin:W,link:null,longDesc:null,lowSrc:null,marginHeight:W,marginWidth:W,noResize:ZB,noHref:ZB,noShade:ZB,noWrap:ZB,object:null,profile:null,prompt:null,rev:null,rightMargin:W,rules:null,scheme:null,scrolling:QB,standby:null,summary:null,text:null,topMargin:W,valueType:null,version:null,vAlign:null,vLink:null,vSpace:W,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:ZB,disablePictureInPicture:ZB,disableRemotePlayback:ZB,exportParts:tV,part:eV,prefix:null,property:null,results:W,security:null,unselectable:null},space:`html`,transform:uV}),fV=sV({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:nV,accentHeight:W,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:W,amplitude:W,arabicForm:null,ascent:W,attributeName:null,attributeType:null,azimuth:W,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:W,by:null,calcMode:null,capHeight:W,className:eV,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:W,diffuseConstant:W,direction:null,display:null,dur:null,divisor:W,dominantBaseline:null,download:ZB,dx:null,dy:null,edgeMode:null,editable:null,elevation:W,enableBackground:null,end:null,event:null,exponent:W,externalResourcesRequired:null,fill:null,fillOpacity:W,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:tV,g2:tV,glyphName:tV,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:W,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:W,horizOriginX:W,horizOriginY:W,id:null,ideographic:W,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:W,k:W,k1:W,k2:W,k3:W,k4:W,kernelMatrix:nV,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:W,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:W,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:W,overlineThickness:W,paintOrder:null,panose1:null,path:null,pathLength:W,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:eV,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:W,pointsAtY:W,pointsAtZ:W,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:nV,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:nV,rev:nV,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:nV,requiredFeatures:nV,requiredFonts:nV,requiredFormats:nV,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:W,specularExponent:W,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:W,strikethroughThickness:W,string:null,stroke:null,strokeDashArray:nV,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:W,strokeOpacity:W,strokeWidth:null,style:null,surfaceScale:W,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:nV,tabIndex:W,tableValues:null,target:null,targetX:W,targetY:W,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:nV,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:W,underlineThickness:W,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:W,values:null,vAlphabetic:W,vMathematical:W,vectorEffect:null,vHanging:W,vIdeographic:W,version:null,vertAdvY:W,vertOriginX:W,vertOriginY:W,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:W,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:lV}),pV=sV({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),mV=sV({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:uV}),hV=sV({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),gV={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},_V=/[A-Z]/g,vV=/-[a-z]/g,yV=/^data[-\w.:]+$/i;function bV(e,t){let n=qB(t),r=t,i=JB;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&yV.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(vV,SV);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!vV.test(e)){let n=e.replace(_V,xV);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=aV}return new i(r,t)}function xV(e){return`-`+e.toLowerCase()}function SV(e){return e.charAt(1).toUpperCase()}var CV=KB([cV,dV,pV,mV,hV],`html`),wV=KB([cV,fV,pV,mV,hV],`svg`);function TV(e){let t=[],n=String(e||``),r=n.indexOf(`,`),i=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);let e=n.slice(i,r).trim();(e||!a)&&t.push(e),i=r+1,r=n.indexOf(`,`,i)}return t}function EV(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var DV=/[#.]/g;function OV(e,t){let n=e||``,r={},i=0,a,o;for(;i<n.length;){DV.lastIndex=i;let e=DV.exec(n),t=n.slice(i,e?e.index:n.length);t&&(a?a===`#`?r.id=t:Array.isArray(r.className)?r.className.push(t):r.className=[t]:o=t,i+=t.length),e&&(a=e[0],i++)}return{type:`element`,tagName:o||t||`div`,properties:r,children:[]}}function kV(e){let t=String(e||``).trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function AV(e){return e.join(` `).trim()}function jV(e,t,n){let r=n?LV(n):void 0;function i(n,i,...a){let o;if(n==null){o={type:`root`,children:[]};let e=i;a.unshift(e)}else{o=OV(n,t);let s=o.tagName.toLowerCase(),c=r?r.get(s):void 0;if(o.tagName=c||s,MV(i))a.unshift(i);else for(let[t,n]of Object.entries(i))NV(e,o.properties,t,n)}for(let e of a)PV(o.children,e);return o.type===`element`&&o.tagName===`template`&&(o.content={type:`root`,children:o.children},o.children=[]),o}return i}function MV(e){if(typeof e!=`object`||!e||Array.isArray(e))return!0;if(typeof e.type!=`string`)return!1;let t=e,n=Object.keys(e);for(let e of n){let n=t[e];if(n&&typeof n==`object`){if(!Array.isArray(n))return!0;let e=n;for(let t of e)if(typeof t!=`number`&&typeof t!=`string`)return!0}}return!!(`children`in e&&Array.isArray(e.children))}function NV(e,t,n,r){let i=bV(e,n),a;if(r!=null){if(typeof r==`number`){if(Number.isNaN(r))return;a=r}else a=typeof r==`boolean`?r:typeof r==`string`?i.spaceSeparated?kV(r):i.commaSeparated?TV(r):i.commaOrSpaceSeparated?kV(TV(r).join(` `)):FV(i,i.property,r):Array.isArray(r)?[...r]:i.property===`style`?IV(r):String(r);if(Array.isArray(a)){let e=[];for(let t of a)e.push(FV(i,i.property,t));a=e}i.property===`className`&&Array.isArray(t.className)&&(a=t.className.concat(a)),t[i.property]=a}}function PV(e,t){if(t!=null)if(typeof t==`number`||typeof t==`string`)e.push({type:`text`,value:String(t)});else if(Array.isArray(t))for(let n of t)PV(e,n);else if(typeof t==`object`&&`type`in t)t.type===`root`?PV(e,t.children):e.push(t);else throw Error("Expected node, nodes, or string, got `"+t+"`")}function FV(e,t,n){if(typeof n==`string`){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===``||qB(n)===qB(t)))return!0}return n}function IV(e){let t=[];for(let[n,r]of Object.entries(e))t.push([n,r].join(`: `));return t.join(`; `)}function LV(e){let t=new Map;for(let n of e)t.set(n.toLowerCase(),n);return t}var RV=`altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.solidColor.textArea.textPath`.split(`.`),zV=jV(CV,`div`),BV=jV(wV,`g`,RV);function VV(e){let t=String(e),n=[];return{toOffset:i,toPoint:r};function r(e){if(typeof e==`number`&&e>-1&&e<=t.length){let r=0;for(;;){let i=n[r];if(i===void 0){let e=HV(t,n[r-1]);i=e===-1?t.length+1:e+1,n[r]=i}if(i>e)return{line:r+1,column:e-(r>0?n[r-1]:0)+1,offset:e};r++}}}function i(e){if(e&&typeof e.line==`number`&&typeof e.column==`number`&&!Number.isNaN(e.line)&&!Number.isNaN(e.column)){for(;n.length<e.line;){let e=n[n.length-1],r=HV(t,e),i=r===-1?t.length+1:r+1;if(e===i)break;n.push(i)}let r=(e.line>1?n[e.line-2]:0)+e.column-1;if(r<n[e.line-1])return r}}}function HV(e,t){let n=e.indexOf(`\r`,t),r=e.indexOf(`
|
|
129
|
+
`,t);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}var UV={html:`http://www.w3.org/1999/xhtml`,mathml:`http://www.w3.org/1998/Math/MathML`,svg:`http://www.w3.org/2000/svg`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`},WV={}.hasOwnProperty,GV=Object.prototype;function KV(e,t){let n=t||{};return qV({file:n.file||void 0,location:!1,schema:n.space===`svg`?wV:CV,verbose:n.verbose||!1},e)}function qV(e,t){let n;switch(t.nodeName){case`#comment`:{let r=t;return n={type:`comment`,value:r.data},XV(e,r,n),n}case`#document`:case`#document-fragment`:{let r=t,i=`mode`in r?r.mode===`quirks`||r.mode===`limited-quirks`:!1;if(n={type:`root`,children:JV(e,t.childNodes),data:{quirksMode:i}},e.file&&e.location){let t=String(e.file),r=VV(t),i=r.toPoint(0),a=r.toPoint(t.length);n.position={start:i,end:a}}return n}case`#documentType`:{let r=t;return n={type:`doctype`},XV(e,r,n),n}case`#text`:{let r=t;return n={type:`text`,value:r.value},XV(e,r,n),n}default:return n=YV(e,t),n}}function JV(e,t){let n=-1,r=[];for(;++n<t.length;){let i=qV(e,t[n]);r.push(i)}return r}function YV(e,t){let n=e.schema;e.schema=t.namespaceURI===UV.svg?wV:CV;let r=-1,i={};for(;++r<t.attrs.length;){let e=t.attrs[r],n=(e.prefix?e.prefix+`:`:``)+e.name;WV.call(GV,n)||(i[n]=e.value)}let a=(e.schema.space===`svg`?BV:zV)(t.tagName,i,JV(e,t.childNodes));if(XV(e,t,a),a.tagName===`template`){let n=t,r=n.sourceCodeLocation,i=r&&r.startTag&&QV(r.startTag),o=r&&r.endTag&&QV(r.endTag),s=qV(e,n.content);i&&o&&e.file&&(s.position={start:i.end,end:o.start}),a.content=s}return e.schema=n,a}function XV(e,t,n){if(`sourceCodeLocation`in t&&t.sourceCodeLocation&&e.file){let r=ZV(e,n,t.sourceCodeLocation);r&&(e.location=!0,n.position=r)}}function ZV(e,t,n){let r=QV(n);if(t.type===`element`){let i=t.children[t.children.length-1];if(r&&!n.endTag&&i&&i.position&&i.position.end&&(r.end=Object.assign({},i.position.end)),e.verbose){let r={},i;if(n.attrs)for(i in n.attrs)WV.call(n.attrs,i)&&(r[bV(e.schema,i).property]=QV(n.attrs[i]));n.startTag;let a=QV(n.startTag),o=n.endTag?QV(n.endTag):void 0,s={opening:a};o&&(s.closing=o),s.properties=r,t.data={position:s}}}return r}function QV(e){let t=$V({line:e.startLine,column:e.startCol,offset:e.startOffset}),n=$V({line:e.endLine,column:e.endCol,offset:e.endOffset});return t||n?{start:t,end:n}:void 0}function $V(e){return e.line&&e.column?e:void 0}var eH={}.hasOwnProperty;function tH(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&eH.call(t,e)){let n=String(t[e]);i=eH.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var nH={},rH={}.hasOwnProperty,iH=tH(`type`,{handlers:{root:oH,element:dH,text:lH,comment:uH,doctype:cH}});function aH(e,t){let n=(t||nH).space;return iH(e,n===`svg`?wV:CV)}function oH(e,t){let n={nodeName:`#document`,mode:(e.data||{}).quirksMode?`quirks`:`no-quirks`,childNodes:[]};return n.childNodes=pH(e.children,n,t),mH(e,n),n}function sH(e,t){let n={nodeName:`#document-fragment`,childNodes:[]};return n.childNodes=pH(e.children,n,t),mH(e,n),n}function cH(e){let t={nodeName:`#documentType`,name:`html`,publicId:``,systemId:``,parentNode:null};return mH(e,t),t}function lH(e){let t={nodeName:`#text`,value:e.value,parentNode:null};return mH(e,t),t}function uH(e){let t={nodeName:`#comment`,data:e.value,parentNode:null};return mH(e,t),t}function dH(e,t){let n=t,r=n;e.type===`element`&&e.tagName.toLowerCase()===`svg`&&n.space===`html`&&(r=wV);let i=[],a;if(e.properties){for(a in e.properties)if(a!==`children`&&rH.call(e.properties,a)){let t=fH(r,a,e.properties[a]);t&&i.push(t)}}let o=r.space,s={nodeName:e.tagName,tagName:e.tagName,attrs:i,namespaceURI:UV[o],childNodes:[],parentNode:null};return s.childNodes=pH(e.children,s,r),mH(e,s),e.tagName===`template`&&e.content&&(s.content=sH(e.content,r)),s}function fH(e,t,n){let r=bV(e,t);if(n===!1||n==null||typeof n==`number`&&Number.isNaN(n)||!n&&r.boolean)return;Array.isArray(n)&&(n=r.commaSeparated?EV(n):AV(n));let i={name:r.attribute,value:n===!0?``:String(n)};if(r.space&&r.space!==`html`&&r.space!==`svg`){let e=i.name.indexOf(`:`);e<0?i.prefix=``:(i.name=i.name.slice(e+1),i.prefix=r.attribute.slice(0,e)),i.namespace=UV[r.space]}return i}function pH(e,t,n){let r=-1,i=[];if(e)for(;++r<e.length;){let a=iH(e[r],n);a.parentNode=t,i.push(a)}return i}function mH(e,t){let n=e.position;n&&n.start&&n.end&&(n.start.offset,n.end.offset,t.sourceCodeLocation={startLine:n.start.line,startCol:n.start.column,startOffset:n.start.offset,endLine:n.end.line,endCol:n.end.column,endOffset:n.end.offset})}var hH=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],gH=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),G;(function(e){e[e.EOF=-1]=`EOF`,e[e.NULL=0]=`NULL`,e[e.TABULATION=9]=`TABULATION`,e[e.CARRIAGE_RETURN=13]=`CARRIAGE_RETURN`,e[e.LINE_FEED=10]=`LINE_FEED`,e[e.FORM_FEED=12]=`FORM_FEED`,e[e.SPACE=32]=`SPACE`,e[e.EXCLAMATION_MARK=33]=`EXCLAMATION_MARK`,e[e.QUOTATION_MARK=34]=`QUOTATION_MARK`,e[e.AMPERSAND=38]=`AMPERSAND`,e[e.APOSTROPHE=39]=`APOSTROPHE`,e[e.HYPHEN_MINUS=45]=`HYPHEN_MINUS`,e[e.SOLIDUS=47]=`SOLIDUS`,e[e.DIGIT_0=48]=`DIGIT_0`,e[e.DIGIT_9=57]=`DIGIT_9`,e[e.SEMICOLON=59]=`SEMICOLON`,e[e.LESS_THAN_SIGN=60]=`LESS_THAN_SIGN`,e[e.EQUALS_SIGN=61]=`EQUALS_SIGN`,e[e.GREATER_THAN_SIGN=62]=`GREATER_THAN_SIGN`,e[e.QUESTION_MARK=63]=`QUESTION_MARK`,e[e.LATIN_CAPITAL_A=65]=`LATIN_CAPITAL_A`,e[e.LATIN_CAPITAL_Z=90]=`LATIN_CAPITAL_Z`,e[e.RIGHT_SQUARE_BRACKET=93]=`RIGHT_SQUARE_BRACKET`,e[e.GRAVE_ACCENT=96]=`GRAVE_ACCENT`,e[e.LATIN_SMALL_A=97]=`LATIN_SMALL_A`,e[e.LATIN_SMALL_Z=122]=`LATIN_SMALL_Z`})(G||={});var _H={DASH_DASH:`--`,CDATA_START:`[CDATA[`,DOCTYPE:`doctype`,SCRIPT:`script`,PUBLIC:`public`,SYSTEM:`system`};function vH(e){return e>=55296&&e<=57343}function yH(e){return e>=56320&&e<=57343}function bH(e,t){return(e-55296)*1024+9216+t}function xH(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function SH(e){return e>=64976&&e<=65007||gH.has(e)}var K;(function(e){e.controlCharacterInInputStream=`control-character-in-input-stream`,e.noncharacterInInputStream=`noncharacter-in-input-stream`,e.surrogateInInputStream=`surrogate-in-input-stream`,e.nonVoidHtmlElementStartTagWithTrailingSolidus=`non-void-html-element-start-tag-with-trailing-solidus`,e.endTagWithAttributes=`end-tag-with-attributes`,e.endTagWithTrailingSolidus=`end-tag-with-trailing-solidus`,e.unexpectedSolidusInTag=`unexpected-solidus-in-tag`,e.unexpectedNullCharacter=`unexpected-null-character`,e.unexpectedQuestionMarkInsteadOfTagName=`unexpected-question-mark-instead-of-tag-name`,e.invalidFirstCharacterOfTagName=`invalid-first-character-of-tag-name`,e.unexpectedEqualsSignBeforeAttributeName=`unexpected-equals-sign-before-attribute-name`,e.missingEndTagName=`missing-end-tag-name`,e.unexpectedCharacterInAttributeName=`unexpected-character-in-attribute-name`,e.unknownNamedCharacterReference=`unknown-named-character-reference`,e.missingSemicolonAfterCharacterReference=`missing-semicolon-after-character-reference`,e.unexpectedCharacterAfterDoctypeSystemIdentifier=`unexpected-character-after-doctype-system-identifier`,e.unexpectedCharacterInUnquotedAttributeValue=`unexpected-character-in-unquoted-attribute-value`,e.eofBeforeTagName=`eof-before-tag-name`,e.eofInTag=`eof-in-tag`,e.missingAttributeValue=`missing-attribute-value`,e.missingWhitespaceBetweenAttributes=`missing-whitespace-between-attributes`,e.missingWhitespaceAfterDoctypePublicKeyword=`missing-whitespace-after-doctype-public-keyword`,e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers=`missing-whitespace-between-doctype-public-and-system-identifiers`,e.missingWhitespaceAfterDoctypeSystemKeyword=`missing-whitespace-after-doctype-system-keyword`,e.missingQuoteBeforeDoctypePublicIdentifier=`missing-quote-before-doctype-public-identifier`,e.missingQuoteBeforeDoctypeSystemIdentifier=`missing-quote-before-doctype-system-identifier`,e.missingDoctypePublicIdentifier=`missing-doctype-public-identifier`,e.missingDoctypeSystemIdentifier=`missing-doctype-system-identifier`,e.abruptDoctypePublicIdentifier=`abrupt-doctype-public-identifier`,e.abruptDoctypeSystemIdentifier=`abrupt-doctype-system-identifier`,e.cdataInHtmlContent=`cdata-in-html-content`,e.incorrectlyOpenedComment=`incorrectly-opened-comment`,e.eofInScriptHtmlCommentLikeText=`eof-in-script-html-comment-like-text`,e.eofInDoctype=`eof-in-doctype`,e.nestedComment=`nested-comment`,e.abruptClosingOfEmptyComment=`abrupt-closing-of-empty-comment`,e.eofInComment=`eof-in-comment`,e.incorrectlyClosedComment=`incorrectly-closed-comment`,e.eofInCdata=`eof-in-cdata`,e.absenceOfDigitsInNumericCharacterReference=`absence-of-digits-in-numeric-character-reference`,e.nullCharacterReference=`null-character-reference`,e.surrogateCharacterReference=`surrogate-character-reference`,e.characterReferenceOutsideUnicodeRange=`character-reference-outside-unicode-range`,e.controlCharacterReference=`control-character-reference`,e.noncharacterCharacterReference=`noncharacter-character-reference`,e.missingWhitespaceBeforeDoctypeName=`missing-whitespace-before-doctype-name`,e.missingDoctypeName=`missing-doctype-name`,e.invalidCharacterSequenceAfterDoctypeName=`invalid-character-sequence-after-doctype-name`,e.duplicateAttribute=`duplicate-attribute`,e.nonConformingDoctype=`non-conforming-doctype`,e.missingDoctype=`missing-doctype`,e.misplacedDoctype=`misplaced-doctype`,e.endTagWithoutMatchingOpenElement=`end-tag-without-matching-open-element`,e.closingOfElementWithOpenChildElements=`closing-of-element-with-open-child-elements`,e.disallowedContentInNoscriptInHead=`disallowed-content-in-noscript-in-head`,e.openElementsLeftAfterEof=`open-elements-left-after-eof`,e.abandonedHeadElementChild=`abandoned-head-element-child`,e.misplacedStartTagForHeadElement=`misplaced-start-tag-for-head-element`,e.nestedNoscriptInHead=`nested-noscript-in-head`,e.eofInElementThatCanContainOnlyText=`eof-in-element-that-can-contain-only-text`})(K||={});var CH=65536,wH=class{constructor(e){this.handler=e,this.html=``,this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=CH,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+Number(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(e,t){let{line:n,col:r,offset:i}=this,a=r+t,o=i+t;return{code:e,startLine:n,endLine:n,startCol:a,endCol:a,startOffset:o,endOffset:o}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){let t=this.html.charCodeAt(this.pos+1);if(yH(t))return this.pos++,this._addGap(),bH(e,t)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,G.EOF;return this._err(K.surrogateInInputStream),e}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(e,t){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=t}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,t){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(t)return this.html.startsWith(e,this.pos);for(let t=0;t<e.length;t++)if((this.html.charCodeAt(this.pos+t)|32)!==e.charCodeAt(t))return!1;return!0}peek(e){let t=this.pos+e;if(t>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,G.EOF;let n=this.html.charCodeAt(t);return n===G.CARRIAGE_RETURN?G.LINE_FEED:n}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,G.EOF;let e=this.html.charCodeAt(this.pos);return e===G.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,G.LINE_FEED):e===G.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,vH(e)&&(e=this._processSurrogate(e)),this.handler.onParseError===null||e>31&&e<127||e===G.LINE_FEED||e===G.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){xH(e)?this._err(K.controlCharacterInInputStream):SH(e)&&this._err(K.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}},TH;(function(e){e[e.CHARACTER=0]=`CHARACTER`,e[e.NULL_CHARACTER=1]=`NULL_CHARACTER`,e[e.WHITESPACE_CHARACTER=2]=`WHITESPACE_CHARACTER`,e[e.START_TAG=3]=`START_TAG`,e[e.END_TAG=4]=`END_TAG`,e[e.COMMENT=5]=`COMMENT`,e[e.DOCTYPE=6]=`DOCTYPE`,e[e.EOF=7]=`EOF`,e[e.HIBERNATION=8]=`HIBERNATION`})(TH||={});function EH(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}var DH=new Uint16Array(`ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻\xA0ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌`.split(``).map(e=>e.charCodeAt(0))),OH=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);String.fromCodePoint;function kH(e){return e>=55296&&e<=57343||e>1114111?65533:OH.get(e)??e}var AH;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(AH||={});var jH=32,MH;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.BRANCH_LENGTH=16256]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(MH||={});function NH(e){return e>=AH.ZERO&&e<=AH.NINE}function PH(e){return e>=AH.UPPER_A&&e<=AH.UPPER_F||e>=AH.LOWER_A&&e<=AH.LOWER_F}function FH(e){return e>=AH.UPPER_A&&e<=AH.UPPER_Z||e>=AH.LOWER_A&&e<=AH.LOWER_Z||NH(e)}function IH(e){return e===AH.EQUALS||FH(e)}var LH;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(LH||={});var RH;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(RH||={});var zH=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=LH.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=RH.Strict}startEntity(e){this.decodeMode=e,this.state=LH.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case LH.EntityStart:return e.charCodeAt(t)===AH.NUM?(this.state=LH.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=LH.NamedEntity,this.stateNamedEntity(e,t));case LH.NumericStart:return this.stateNumericStart(e,t);case LH.NumericDecimal:return this.stateNumericDecimal(e,t);case LH.NumericHex:return this.stateNumericHex(e,t);case LH.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|jH)===AH.LOWER_X?(this.state=LH.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=LH.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,r){if(t!==n){let i=n-t;this.result=this.result*r**+i+Number.parseInt(e.substr(t,i),r),this.consumed+=i}}stateNumericHex(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(NH(r)||PH(r))t+=1;else return this.addToNumericResult(e,n,t,16),this.emitNumericEntity(r,3)}return this.addToNumericResult(e,n,t,16),-1}stateNumericDecimal(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(NH(r))t+=1;else return this.addToNumericResult(e,n,t,10),this.emitNumericEntity(r,2)}return this.addToNumericResult(e,n,t,10),-1}emitNumericEntity(e,t){var n;if(this.consumed<=t)return(n=this.errors)==null||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===AH.SEMI)this.consumed+=1;else if(this.decodeMode===RH.Strict)return 0;return this.emitCodePoint(kH(this.result),this.consumed),this.errors&&(e!==AH.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&MH.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){let a=e.charCodeAt(t);if(this.treeIndex=BH(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===RH.Attribute&&(i===0||IH(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&MH.VALUE_LENGTH)>>14,i!==0){if(a===AH.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==RH.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,r=(n[t]&MH.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),(e=this.errors)==null||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~MH.VALUE_LENGTH:r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case LH.NamedEntity:return this.result!==0&&(this.decodeMode!==RH.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case LH.NumericDecimal:return this.emitNumericEntity(0,2);case LH.NumericHex:return this.emitNumericEntity(0,3);case LH.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case LH.EntityStart:return 0}}};function BH(e,t,n,r){let i=(t&MH.BRANCH_LENGTH)>>7,a=t&MH.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=n,s=o+i-1;for(;o<=s;){let t=o+s>>>1,n=e[t];if(n<r)o=t+1;else if(n>r)s=t-1;else return e[t+i]}return-1}var q;(function(e){e.HTML=`http://www.w3.org/1999/xhtml`,e.MATHML=`http://www.w3.org/1998/Math/MathML`,e.SVG=`http://www.w3.org/2000/svg`,e.XLINK=`http://www.w3.org/1999/xlink`,e.XML=`http://www.w3.org/XML/1998/namespace`,e.XMLNS=`http://www.w3.org/2000/xmlns/`})(q||={});var VH;(function(e){e.TYPE=`type`,e.ACTION=`action`,e.ENCODING=`encoding`,e.PROMPT=`prompt`,e.NAME=`name`,e.COLOR=`color`,e.FACE=`face`,e.SIZE=`size`})(VH||={});var HH;(function(e){e.NO_QUIRKS=`no-quirks`,e.QUIRKS=`quirks`,e.LIMITED_QUIRKS=`limited-quirks`})(HH||={});var J;(function(e){e.A=`a`,e.ADDRESS=`address`,e.ANNOTATION_XML=`annotation-xml`,e.APPLET=`applet`,e.AREA=`area`,e.ARTICLE=`article`,e.ASIDE=`aside`,e.B=`b`,e.BASE=`base`,e.BASEFONT=`basefont`,e.BGSOUND=`bgsound`,e.BIG=`big`,e.BLOCKQUOTE=`blockquote`,e.BODY=`body`,e.BR=`br`,e.BUTTON=`button`,e.CAPTION=`caption`,e.CENTER=`center`,e.CODE=`code`,e.COL=`col`,e.COLGROUP=`colgroup`,e.DD=`dd`,e.DESC=`desc`,e.DETAILS=`details`,e.DIALOG=`dialog`,e.DIR=`dir`,e.DIV=`div`,e.DL=`dl`,e.DT=`dt`,e.EM=`em`,e.EMBED=`embed`,e.FIELDSET=`fieldset`,e.FIGCAPTION=`figcaption`,e.FIGURE=`figure`,e.FONT=`font`,e.FOOTER=`footer`,e.FOREIGN_OBJECT=`foreignObject`,e.FORM=`form`,e.FRAME=`frame`,e.FRAMESET=`frameset`,e.H1=`h1`,e.H2=`h2`,e.H3=`h3`,e.H4=`h4`,e.H5=`h5`,e.H6=`h6`,e.HEAD=`head`,e.HEADER=`header`,e.HGROUP=`hgroup`,e.HR=`hr`,e.HTML=`html`,e.I=`i`,e.IMG=`img`,e.IMAGE=`image`,e.INPUT=`input`,e.IFRAME=`iframe`,e.KEYGEN=`keygen`,e.LABEL=`label`,e.LI=`li`,e.LINK=`link`,e.LISTING=`listing`,e.MAIN=`main`,e.MALIGNMARK=`malignmark`,e.MARQUEE=`marquee`,e.MATH=`math`,e.MENU=`menu`,e.META=`meta`,e.MGLYPH=`mglyph`,e.MI=`mi`,e.MO=`mo`,e.MN=`mn`,e.MS=`ms`,e.MTEXT=`mtext`,e.NAV=`nav`,e.NOBR=`nobr`,e.NOFRAMES=`noframes`,e.NOEMBED=`noembed`,e.NOSCRIPT=`noscript`,e.OBJECT=`object`,e.OL=`ol`,e.OPTGROUP=`optgroup`,e.OPTION=`option`,e.P=`p`,e.PARAM=`param`,e.PLAINTEXT=`plaintext`,e.PRE=`pre`,e.RB=`rb`,e.RP=`rp`,e.RT=`rt`,e.RTC=`rtc`,e.RUBY=`ruby`,e.S=`s`,e.SCRIPT=`script`,e.SEARCH=`search`,e.SECTION=`section`,e.SELECT=`select`,e.SOURCE=`source`,e.SMALL=`small`,e.SPAN=`span`,e.STRIKE=`strike`,e.STRONG=`strong`,e.STYLE=`style`,e.SUB=`sub`,e.SUMMARY=`summary`,e.SUP=`sup`,e.TABLE=`table`,e.TBODY=`tbody`,e.TEMPLATE=`template`,e.TEXTAREA=`textarea`,e.TFOOT=`tfoot`,e.TD=`td`,e.TH=`th`,e.THEAD=`thead`,e.TITLE=`title`,e.TR=`tr`,e.TRACK=`track`,e.TT=`tt`,e.U=`u`,e.UL=`ul`,e.SVG=`svg`,e.VAR=`var`,e.WBR=`wbr`,e.XMP=`xmp`})(J||={});var Y;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.A=1]=`A`,e[e.ADDRESS=2]=`ADDRESS`,e[e.ANNOTATION_XML=3]=`ANNOTATION_XML`,e[e.APPLET=4]=`APPLET`,e[e.AREA=5]=`AREA`,e[e.ARTICLE=6]=`ARTICLE`,e[e.ASIDE=7]=`ASIDE`,e[e.B=8]=`B`,e[e.BASE=9]=`BASE`,e[e.BASEFONT=10]=`BASEFONT`,e[e.BGSOUND=11]=`BGSOUND`,e[e.BIG=12]=`BIG`,e[e.BLOCKQUOTE=13]=`BLOCKQUOTE`,e[e.BODY=14]=`BODY`,e[e.BR=15]=`BR`,e[e.BUTTON=16]=`BUTTON`,e[e.CAPTION=17]=`CAPTION`,e[e.CENTER=18]=`CENTER`,e[e.CODE=19]=`CODE`,e[e.COL=20]=`COL`,e[e.COLGROUP=21]=`COLGROUP`,e[e.DD=22]=`DD`,e[e.DESC=23]=`DESC`,e[e.DETAILS=24]=`DETAILS`,e[e.DIALOG=25]=`DIALOG`,e[e.DIR=26]=`DIR`,e[e.DIV=27]=`DIV`,e[e.DL=28]=`DL`,e[e.DT=29]=`DT`,e[e.EM=30]=`EM`,e[e.EMBED=31]=`EMBED`,e[e.FIELDSET=32]=`FIELDSET`,e[e.FIGCAPTION=33]=`FIGCAPTION`,e[e.FIGURE=34]=`FIGURE`,e[e.FONT=35]=`FONT`,e[e.FOOTER=36]=`FOOTER`,e[e.FOREIGN_OBJECT=37]=`FOREIGN_OBJECT`,e[e.FORM=38]=`FORM`,e[e.FRAME=39]=`FRAME`,e[e.FRAMESET=40]=`FRAMESET`,e[e.H1=41]=`H1`,e[e.H2=42]=`H2`,e[e.H3=43]=`H3`,e[e.H4=44]=`H4`,e[e.H5=45]=`H5`,e[e.H6=46]=`H6`,e[e.HEAD=47]=`HEAD`,e[e.HEADER=48]=`HEADER`,e[e.HGROUP=49]=`HGROUP`,e[e.HR=50]=`HR`,e[e.HTML=51]=`HTML`,e[e.I=52]=`I`,e[e.IMG=53]=`IMG`,e[e.IMAGE=54]=`IMAGE`,e[e.INPUT=55]=`INPUT`,e[e.IFRAME=56]=`IFRAME`,e[e.KEYGEN=57]=`KEYGEN`,e[e.LABEL=58]=`LABEL`,e[e.LI=59]=`LI`,e[e.LINK=60]=`LINK`,e[e.LISTING=61]=`LISTING`,e[e.MAIN=62]=`MAIN`,e[e.MALIGNMARK=63]=`MALIGNMARK`,e[e.MARQUEE=64]=`MARQUEE`,e[e.MATH=65]=`MATH`,e[e.MENU=66]=`MENU`,e[e.META=67]=`META`,e[e.MGLYPH=68]=`MGLYPH`,e[e.MI=69]=`MI`,e[e.MO=70]=`MO`,e[e.MN=71]=`MN`,e[e.MS=72]=`MS`,e[e.MTEXT=73]=`MTEXT`,e[e.NAV=74]=`NAV`,e[e.NOBR=75]=`NOBR`,e[e.NOFRAMES=76]=`NOFRAMES`,e[e.NOEMBED=77]=`NOEMBED`,e[e.NOSCRIPT=78]=`NOSCRIPT`,e[e.OBJECT=79]=`OBJECT`,e[e.OL=80]=`OL`,e[e.OPTGROUP=81]=`OPTGROUP`,e[e.OPTION=82]=`OPTION`,e[e.P=83]=`P`,e[e.PARAM=84]=`PARAM`,e[e.PLAINTEXT=85]=`PLAINTEXT`,e[e.PRE=86]=`PRE`,e[e.RB=87]=`RB`,e[e.RP=88]=`RP`,e[e.RT=89]=`RT`,e[e.RTC=90]=`RTC`,e[e.RUBY=91]=`RUBY`,e[e.S=92]=`S`,e[e.SCRIPT=93]=`SCRIPT`,e[e.SEARCH=94]=`SEARCH`,e[e.SECTION=95]=`SECTION`,e[e.SELECT=96]=`SELECT`,e[e.SOURCE=97]=`SOURCE`,e[e.SMALL=98]=`SMALL`,e[e.SPAN=99]=`SPAN`,e[e.STRIKE=100]=`STRIKE`,e[e.STRONG=101]=`STRONG`,e[e.STYLE=102]=`STYLE`,e[e.SUB=103]=`SUB`,e[e.SUMMARY=104]=`SUMMARY`,e[e.SUP=105]=`SUP`,e[e.TABLE=106]=`TABLE`,e[e.TBODY=107]=`TBODY`,e[e.TEMPLATE=108]=`TEMPLATE`,e[e.TEXTAREA=109]=`TEXTAREA`,e[e.TFOOT=110]=`TFOOT`,e[e.TD=111]=`TD`,e[e.TH=112]=`TH`,e[e.THEAD=113]=`THEAD`,e[e.TITLE=114]=`TITLE`,e[e.TR=115]=`TR`,e[e.TRACK=116]=`TRACK`,e[e.TT=117]=`TT`,e[e.U=118]=`U`,e[e.UL=119]=`UL`,e[e.SVG=120]=`SVG`,e[e.VAR=121]=`VAR`,e[e.WBR=122]=`WBR`,e[e.XMP=123]=`XMP`})(Y||={});var UH=new Map([[J.A,Y.A],[J.ADDRESS,Y.ADDRESS],[J.ANNOTATION_XML,Y.ANNOTATION_XML],[J.APPLET,Y.APPLET],[J.AREA,Y.AREA],[J.ARTICLE,Y.ARTICLE],[J.ASIDE,Y.ASIDE],[J.B,Y.B],[J.BASE,Y.BASE],[J.BASEFONT,Y.BASEFONT],[J.BGSOUND,Y.BGSOUND],[J.BIG,Y.BIG],[J.BLOCKQUOTE,Y.BLOCKQUOTE],[J.BODY,Y.BODY],[J.BR,Y.BR],[J.BUTTON,Y.BUTTON],[J.CAPTION,Y.CAPTION],[J.CENTER,Y.CENTER],[J.CODE,Y.CODE],[J.COL,Y.COL],[J.COLGROUP,Y.COLGROUP],[J.DD,Y.DD],[J.DESC,Y.DESC],[J.DETAILS,Y.DETAILS],[J.DIALOG,Y.DIALOG],[J.DIR,Y.DIR],[J.DIV,Y.DIV],[J.DL,Y.DL],[J.DT,Y.DT],[J.EM,Y.EM],[J.EMBED,Y.EMBED],[J.FIELDSET,Y.FIELDSET],[J.FIGCAPTION,Y.FIGCAPTION],[J.FIGURE,Y.FIGURE],[J.FONT,Y.FONT],[J.FOOTER,Y.FOOTER],[J.FOREIGN_OBJECT,Y.FOREIGN_OBJECT],[J.FORM,Y.FORM],[J.FRAME,Y.FRAME],[J.FRAMESET,Y.FRAMESET],[J.H1,Y.H1],[J.H2,Y.H2],[J.H3,Y.H3],[J.H4,Y.H4],[J.H5,Y.H5],[J.H6,Y.H6],[J.HEAD,Y.HEAD],[J.HEADER,Y.HEADER],[J.HGROUP,Y.HGROUP],[J.HR,Y.HR],[J.HTML,Y.HTML],[J.I,Y.I],[J.IMG,Y.IMG],[J.IMAGE,Y.IMAGE],[J.INPUT,Y.INPUT],[J.IFRAME,Y.IFRAME],[J.KEYGEN,Y.KEYGEN],[J.LABEL,Y.LABEL],[J.LI,Y.LI],[J.LINK,Y.LINK],[J.LISTING,Y.LISTING],[J.MAIN,Y.MAIN],[J.MALIGNMARK,Y.MALIGNMARK],[J.MARQUEE,Y.MARQUEE],[J.MATH,Y.MATH],[J.MENU,Y.MENU],[J.META,Y.META],[J.MGLYPH,Y.MGLYPH],[J.MI,Y.MI],[J.MO,Y.MO],[J.MN,Y.MN],[J.MS,Y.MS],[J.MTEXT,Y.MTEXT],[J.NAV,Y.NAV],[J.NOBR,Y.NOBR],[J.NOFRAMES,Y.NOFRAMES],[J.NOEMBED,Y.NOEMBED],[J.NOSCRIPT,Y.NOSCRIPT],[J.OBJECT,Y.OBJECT],[J.OL,Y.OL],[J.OPTGROUP,Y.OPTGROUP],[J.OPTION,Y.OPTION],[J.P,Y.P],[J.PARAM,Y.PARAM],[J.PLAINTEXT,Y.PLAINTEXT],[J.PRE,Y.PRE],[J.RB,Y.RB],[J.RP,Y.RP],[J.RT,Y.RT],[J.RTC,Y.RTC],[J.RUBY,Y.RUBY],[J.S,Y.S],[J.SCRIPT,Y.SCRIPT],[J.SEARCH,Y.SEARCH],[J.SECTION,Y.SECTION],[J.SELECT,Y.SELECT],[J.SOURCE,Y.SOURCE],[J.SMALL,Y.SMALL],[J.SPAN,Y.SPAN],[J.STRIKE,Y.STRIKE],[J.STRONG,Y.STRONG],[J.STYLE,Y.STYLE],[J.SUB,Y.SUB],[J.SUMMARY,Y.SUMMARY],[J.SUP,Y.SUP],[J.TABLE,Y.TABLE],[J.TBODY,Y.TBODY],[J.TEMPLATE,Y.TEMPLATE],[J.TEXTAREA,Y.TEXTAREA],[J.TFOOT,Y.TFOOT],[J.TD,Y.TD],[J.TH,Y.TH],[J.THEAD,Y.THEAD],[J.TITLE,Y.TITLE],[J.TR,Y.TR],[J.TRACK,Y.TRACK],[J.TT,Y.TT],[J.U,Y.U],[J.UL,Y.UL],[J.SVG,Y.SVG],[J.VAR,Y.VAR],[J.WBR,Y.WBR],[J.XMP,Y.XMP]]);function WH(e){return UH.get(e)??Y.UNKNOWN}var X=Y,GH={[q.HTML]:new Set([X.ADDRESS,X.APPLET,X.AREA,X.ARTICLE,X.ASIDE,X.BASE,X.BASEFONT,X.BGSOUND,X.BLOCKQUOTE,X.BODY,X.BR,X.BUTTON,X.CAPTION,X.CENTER,X.COL,X.COLGROUP,X.DD,X.DETAILS,X.DIR,X.DIV,X.DL,X.DT,X.EMBED,X.FIELDSET,X.FIGCAPTION,X.FIGURE,X.FOOTER,X.FORM,X.FRAME,X.FRAMESET,X.H1,X.H2,X.H3,X.H4,X.H5,X.H6,X.HEAD,X.HEADER,X.HGROUP,X.HR,X.HTML,X.IFRAME,X.IMG,X.INPUT,X.LI,X.LINK,X.LISTING,X.MAIN,X.MARQUEE,X.MENU,X.META,X.NAV,X.NOEMBED,X.NOFRAMES,X.NOSCRIPT,X.OBJECT,X.OL,X.P,X.PARAM,X.PLAINTEXT,X.PRE,X.SCRIPT,X.SECTION,X.SELECT,X.SOURCE,X.STYLE,X.SUMMARY,X.TABLE,X.TBODY,X.TD,X.TEMPLATE,X.TEXTAREA,X.TFOOT,X.TH,X.THEAD,X.TITLE,X.TR,X.TRACK,X.UL,X.WBR,X.XMP]),[q.MATHML]:new Set([X.MI,X.MO,X.MN,X.MS,X.MTEXT,X.ANNOTATION_XML]),[q.SVG]:new Set([X.TITLE,X.FOREIGN_OBJECT,X.DESC]),[q.XLINK]:new Set,[q.XML]:new Set,[q.XMLNS]:new Set},KH=new Set([X.H1,X.H2,X.H3,X.H4,X.H5,X.H6]);new Set([J.STYLE,J.SCRIPT,J.XMP,J.IFRAME,J.NOEMBED,J.NOFRAMES,J.PLAINTEXT]);var Z;(function(e){e[e.DATA=0]=`DATA`,e[e.RCDATA=1]=`RCDATA`,e[e.RAWTEXT=2]=`RAWTEXT`,e[e.SCRIPT_DATA=3]=`SCRIPT_DATA`,e[e.PLAINTEXT=4]=`PLAINTEXT`,e[e.TAG_OPEN=5]=`TAG_OPEN`,e[e.END_TAG_OPEN=6]=`END_TAG_OPEN`,e[e.TAG_NAME=7]=`TAG_NAME`,e[e.RCDATA_LESS_THAN_SIGN=8]=`RCDATA_LESS_THAN_SIGN`,e[e.RCDATA_END_TAG_OPEN=9]=`RCDATA_END_TAG_OPEN`,e[e.RCDATA_END_TAG_NAME=10]=`RCDATA_END_TAG_NAME`,e[e.RAWTEXT_LESS_THAN_SIGN=11]=`RAWTEXT_LESS_THAN_SIGN`,e[e.RAWTEXT_END_TAG_OPEN=12]=`RAWTEXT_END_TAG_OPEN`,e[e.RAWTEXT_END_TAG_NAME=13]=`RAWTEXT_END_TAG_NAME`,e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]=`SCRIPT_DATA_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_END_TAG_OPEN=15]=`SCRIPT_DATA_END_TAG_OPEN`,e[e.SCRIPT_DATA_END_TAG_NAME=16]=`SCRIPT_DATA_END_TAG_NAME`,e[e.SCRIPT_DATA_ESCAPE_START=17]=`SCRIPT_DATA_ESCAPE_START`,e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]=`SCRIPT_DATA_ESCAPE_START_DASH`,e[e.SCRIPT_DATA_ESCAPED=19]=`SCRIPT_DATA_ESCAPED`,e[e.SCRIPT_DATA_ESCAPED_DASH=20]=`SCRIPT_DATA_ESCAPED_DASH`,e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]=`SCRIPT_DATA_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]=`SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]=`SCRIPT_DATA_ESCAPED_END_TAG_OPEN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]=`SCRIPT_DATA_ESCAPED_END_TAG_NAME`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]=`SCRIPT_DATA_DOUBLE_ESCAPE_START`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]=`SCRIPT_DATA_DOUBLE_ESCAPED`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]=`SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]=`SCRIPT_DATA_DOUBLE_ESCAPE_END`,e[e.BEFORE_ATTRIBUTE_NAME=31]=`BEFORE_ATTRIBUTE_NAME`,e[e.ATTRIBUTE_NAME=32]=`ATTRIBUTE_NAME`,e[e.AFTER_ATTRIBUTE_NAME=33]=`AFTER_ATTRIBUTE_NAME`,e[e.BEFORE_ATTRIBUTE_VALUE=34]=`BEFORE_ATTRIBUTE_VALUE`,e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]=`ATTRIBUTE_VALUE_DOUBLE_QUOTED`,e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]=`ATTRIBUTE_VALUE_SINGLE_QUOTED`,e[e.ATTRIBUTE_VALUE_UNQUOTED=37]=`ATTRIBUTE_VALUE_UNQUOTED`,e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]=`AFTER_ATTRIBUTE_VALUE_QUOTED`,e[e.SELF_CLOSING_START_TAG=39]=`SELF_CLOSING_START_TAG`,e[e.BOGUS_COMMENT=40]=`BOGUS_COMMENT`,e[e.MARKUP_DECLARATION_OPEN=41]=`MARKUP_DECLARATION_OPEN`,e[e.COMMENT_START=42]=`COMMENT_START`,e[e.COMMENT_START_DASH=43]=`COMMENT_START_DASH`,e[e.COMMENT=44]=`COMMENT`,e[e.COMMENT_LESS_THAN_SIGN=45]=`COMMENT_LESS_THAN_SIGN`,e[e.COMMENT_LESS_THAN_SIGN_BANG=46]=`COMMENT_LESS_THAN_SIGN_BANG`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]=`COMMENT_LESS_THAN_SIGN_BANG_DASH`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]=`COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH`,e[e.COMMENT_END_DASH=49]=`COMMENT_END_DASH`,e[e.COMMENT_END=50]=`COMMENT_END`,e[e.COMMENT_END_BANG=51]=`COMMENT_END_BANG`,e[e.DOCTYPE=52]=`DOCTYPE`,e[e.BEFORE_DOCTYPE_NAME=53]=`BEFORE_DOCTYPE_NAME`,e[e.DOCTYPE_NAME=54]=`DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_NAME=55]=`AFTER_DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]=`AFTER_DOCTYPE_PUBLIC_KEYWORD`,e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]=`BEFORE_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]=`DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]=`DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]=`AFTER_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]=`BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS`,e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]=`AFTER_DOCTYPE_SYSTEM_KEYWORD`,e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]=`BEFORE_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]=`DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]=`DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]=`AFTER_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.BOGUS_DOCTYPE=67]=`BOGUS_DOCTYPE`,e[e.CDATA_SECTION=68]=`CDATA_SECTION`,e[e.CDATA_SECTION_BRACKET=69]=`CDATA_SECTION_BRACKET`,e[e.CDATA_SECTION_END=70]=`CDATA_SECTION_END`,e[e.CHARACTER_REFERENCE=71]=`CHARACTER_REFERENCE`,e[e.AMBIGUOUS_AMPERSAND=72]=`AMBIGUOUS_AMPERSAND`})(Z||={});var qH={DATA:Z.DATA,RCDATA:Z.RCDATA,RAWTEXT:Z.RAWTEXT,SCRIPT_DATA:Z.SCRIPT_DATA,PLAINTEXT:Z.PLAINTEXT,CDATA_SECTION:Z.CDATA_SECTION};function JH(e){return e>=G.DIGIT_0&&e<=G.DIGIT_9}function YH(e){return e>=G.LATIN_CAPITAL_A&&e<=G.LATIN_CAPITAL_Z}function XH(e){return e>=G.LATIN_SMALL_A&&e<=G.LATIN_SMALL_Z}function ZH(e){return XH(e)||YH(e)}function QH(e){return ZH(e)||JH(e)}function $H(e){return e+32}function eU(e){return e===G.SPACE||e===G.LINE_FEED||e===G.TABULATION||e===G.FORM_FEED}function tU(e){return eU(e)||e===G.SOLIDUS||e===G.GREATER_THAN_SIGN}function nU(e){return e===G.NULL?K.nullCharacterReference:e>1114111?K.characterReferenceOutsideUnicodeRange:vH(e)?K.surrogateCharacterReference:SH(e)?K.noncharacterCharacterReference:xH(e)||e===G.CARRIAGE_RETURN?K.controlCharacterReference:null}var rU=class{constructor(e,t){this.options=e,this.handler=t,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName=``,this.active=!1,this.state=Z.DATA,this.returnState=Z.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:``,value:``},this.preprocessor=new wH(t),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new zH(DH,(e,t)=>{this.preprocessor.pos=this.entityStartPos+t-1,this._flushCodePointConsumedAsCharacterReference(e)},t.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(K.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:e=>{this._err(K.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+e)},validateNumericCharacterReference:e=>{let t=nU(e);t&&this._err(t,1)}}:void 0)}_err(e,t=0){var n,r;(r=(n=this.handler).onParseError)==null||r.call(n,this.preprocessor.getError(e,t))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;let e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw Error(`Parser was already resumed`);this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||e?.())}write(e,t,n){this.active=!0,this.preprocessor.write(e,t),this._runParsingLoop(),this.paused||n?.()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(e){this.consumedAfterSnapshot+=e;for(let t=0;t<e;t++)this.preprocessor.advance()}_consumeSequenceIfMatch(e,t){return this.preprocessor.startsWith(e,t)?(this._advanceBy(e.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:TH.START_TAG,tagName:``,tagID:Y.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:TH.END_TAG,tagName:``,tagID:Y.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:TH.COMMENT,data:``,location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:TH.DOCTYPE,name:e,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t,location:this.currentLocation}}_createAttr(e){this.currentAttr={name:e,value:``},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var e;let t=this.currentToken;if(EH(t,this.currentAttr.name)===null){if(t.attrs.push(this.currentAttr),t.location&&this.currentLocation){let n=(e=t.location).attrs??(e.attrs=Object.create(null));n[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(K.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(e){this._emitCurrentCharacterToken(e.location),this.currentToken=null,e.location&&(e.location.endLine=this.preprocessor.line,e.location.endCol=this.preprocessor.col+1,e.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){let e=this.currentToken;this.prepareToken(e),e.tagID=WH(e.tagName),e.type===TH.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(K.endTagWithAttributes),e.selfClosing&&this._err(K.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case TH.CHARACTER:this.handler.onCharacter(this.currentCharacterToken);break;case TH.NULL_CHARACTER:this.handler.onNullCharacter(this.currentCharacterToken);break;case TH.WHITESPACE_CHARACTER:this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}this.currentCharacterToken=null}}_emitEOFToken(){let e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:TH.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,t){if(this.currentCharacterToken)if(this.currentCharacterToken.type===e){this.currentCharacterToken.chars+=t;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(e,t)}_emitCodePoint(e){let t=eU(e)?TH.WHITESPACE_CHARACTER:e===G.NULL?TH.NULL_CHARACTER:TH.CHARACTER;this._appendCharToCurrentCharacterToken(t,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(TH.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=Z.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?RH.Attribute:RH.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===Z.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===Z.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===Z.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case Z.DATA:this._stateData(e);break;case Z.RCDATA:this._stateRcdata(e);break;case Z.RAWTEXT:this._stateRawtext(e);break;case Z.SCRIPT_DATA:this._stateScriptData(e);break;case Z.PLAINTEXT:this._statePlaintext(e);break;case Z.TAG_OPEN:this._stateTagOpen(e);break;case Z.END_TAG_OPEN:this._stateEndTagOpen(e);break;case Z.TAG_NAME:this._stateTagName(e);break;case Z.RCDATA_LESS_THAN_SIGN:this._stateRcdataLessThanSign(e);break;case Z.RCDATA_END_TAG_OPEN:this._stateRcdataEndTagOpen(e);break;case Z.RCDATA_END_TAG_NAME:this._stateRcdataEndTagName(e);break;case Z.RAWTEXT_LESS_THAN_SIGN:this._stateRawtextLessThanSign(e);break;case Z.RAWTEXT_END_TAG_OPEN:this._stateRawtextEndTagOpen(e);break;case Z.RAWTEXT_END_TAG_NAME:this._stateRawtextEndTagName(e);break;case Z.SCRIPT_DATA_LESS_THAN_SIGN:this._stateScriptDataLessThanSign(e);break;case Z.SCRIPT_DATA_END_TAG_OPEN:this._stateScriptDataEndTagOpen(e);break;case Z.SCRIPT_DATA_END_TAG_NAME:this._stateScriptDataEndTagName(e);break;case Z.SCRIPT_DATA_ESCAPE_START:this._stateScriptDataEscapeStart(e);break;case Z.SCRIPT_DATA_ESCAPE_START_DASH:this._stateScriptDataEscapeStartDash(e);break;case Z.SCRIPT_DATA_ESCAPED:this._stateScriptDataEscaped(e);break;case Z.SCRIPT_DATA_ESCAPED_DASH:this._stateScriptDataEscapedDash(e);break;case Z.SCRIPT_DATA_ESCAPED_DASH_DASH:this._stateScriptDataEscapedDashDash(e);break;case Z.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataEscapedLessThanSign(e);break;case Z.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:this._stateScriptDataEscapedEndTagOpen(e);break;case Z.SCRIPT_DATA_ESCAPED_END_TAG_NAME:this._stateScriptDataEscapedEndTagName(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPE_START:this._stateScriptDataDoubleEscapeStart(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED:this._stateScriptDataDoubleEscaped(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:this._stateScriptDataDoubleEscapedDash(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:this._stateScriptDataDoubleEscapedDashDash(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataDoubleEscapedLessThanSign(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPE_END:this._stateScriptDataDoubleEscapeEnd(e);break;case Z.BEFORE_ATTRIBUTE_NAME:this._stateBeforeAttributeName(e);break;case Z.ATTRIBUTE_NAME:this._stateAttributeName(e);break;case Z.AFTER_ATTRIBUTE_NAME:this._stateAfterAttributeName(e);break;case Z.BEFORE_ATTRIBUTE_VALUE:this._stateBeforeAttributeValue(e);break;case Z.ATTRIBUTE_VALUE_DOUBLE_QUOTED:this._stateAttributeValueDoubleQuoted(e);break;case Z.ATTRIBUTE_VALUE_SINGLE_QUOTED:this._stateAttributeValueSingleQuoted(e);break;case Z.ATTRIBUTE_VALUE_UNQUOTED:this._stateAttributeValueUnquoted(e);break;case Z.AFTER_ATTRIBUTE_VALUE_QUOTED:this._stateAfterAttributeValueQuoted(e);break;case Z.SELF_CLOSING_START_TAG:this._stateSelfClosingStartTag(e);break;case Z.BOGUS_COMMENT:this._stateBogusComment(e);break;case Z.MARKUP_DECLARATION_OPEN:this._stateMarkupDeclarationOpen(e);break;case Z.COMMENT_START:this._stateCommentStart(e);break;case Z.COMMENT_START_DASH:this._stateCommentStartDash(e);break;case Z.COMMENT:this._stateComment(e);break;case Z.COMMENT_LESS_THAN_SIGN:this._stateCommentLessThanSign(e);break;case Z.COMMENT_LESS_THAN_SIGN_BANG:this._stateCommentLessThanSignBang(e);break;case Z.COMMENT_LESS_THAN_SIGN_BANG_DASH:this._stateCommentLessThanSignBangDash(e);break;case Z.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:this._stateCommentLessThanSignBangDashDash(e);break;case Z.COMMENT_END_DASH:this._stateCommentEndDash(e);break;case Z.COMMENT_END:this._stateCommentEnd(e);break;case Z.COMMENT_END_BANG:this._stateCommentEndBang(e);break;case Z.DOCTYPE:this._stateDoctype(e);break;case Z.BEFORE_DOCTYPE_NAME:this._stateBeforeDoctypeName(e);break;case Z.DOCTYPE_NAME:this._stateDoctypeName(e);break;case Z.AFTER_DOCTYPE_NAME:this._stateAfterDoctypeName(e);break;case Z.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._stateAfterDoctypePublicKeyword(e);break;case Z.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:this._stateBeforeDoctypePublicIdentifier(e);break;case Z.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypePublicIdentifierDoubleQuoted(e);break;case Z.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypePublicIdentifierSingleQuoted(e);break;case Z.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:this._stateAfterDoctypePublicIdentifier(e);break;case Z.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break;case Z.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._stateAfterDoctypeSystemKeyword(e);break;case Z.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:this._stateBeforeDoctypeSystemIdentifier(e);break;case Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypeSystemIdentifierDoubleQuoted(e);break;case Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypeSystemIdentifierSingleQuoted(e);break;case Z.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:this._stateAfterDoctypeSystemIdentifier(e);break;case Z.BOGUS_DOCTYPE:this._stateBogusDoctype(e);break;case Z.CDATA_SECTION:this._stateCdataSection(e);break;case Z.CDATA_SECTION_BRACKET:this._stateCdataSectionBracket(e);break;case Z.CDATA_SECTION_END:this._stateCdataSectionEnd(e);break;case Z.CHARACTER_REFERENCE:this._stateCharacterReference();break;case Z.AMBIGUOUS_AMPERSAND:this._stateAmbiguousAmpersand(e);break;default:throw Error(`Unknown state`)}}_stateData(e){switch(e){case G.LESS_THAN_SIGN:this.state=Z.TAG_OPEN;break;case G.AMPERSAND:this._startCharacterReference();break;case G.NULL:this._err(K.unexpectedNullCharacter),this._emitCodePoint(e);break;case G.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case G.AMPERSAND:this._startCharacterReference();break;case G.LESS_THAN_SIGN:this.state=Z.RCDATA_LESS_THAN_SIGN;break;case G.NULL:this._err(K.unexpectedNullCharacter),this._emitChars(`�`);break;case G.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case G.LESS_THAN_SIGN:this.state=Z.RAWTEXT_LESS_THAN_SIGN;break;case G.NULL:this._err(K.unexpectedNullCharacter),this._emitChars(`�`);break;case G.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_LESS_THAN_SIGN;break;case G.NULL:this._err(K.unexpectedNullCharacter),this._emitChars(`�`);break;case G.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case G.NULL:this._err(K.unexpectedNullCharacter),this._emitChars(`�`);break;case G.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateTagOpen(e){if(ZH(e))this._createStartTagToken(),this.state=Z.TAG_NAME,this._stateTagName(e);else switch(e){case G.EXCLAMATION_MARK:this.state=Z.MARKUP_DECLARATION_OPEN;break;case G.SOLIDUS:this.state=Z.END_TAG_OPEN;break;case G.QUESTION_MARK:this._err(K.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=Z.BOGUS_COMMENT,this._stateBogusComment(e);break;case G.EOF:this._err(K.eofBeforeTagName),this._emitChars(`<`),this._emitEOFToken();break;default:this._err(K.invalidFirstCharacterOfTagName),this._emitChars(`<`),this.state=Z.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(ZH(e))this._createEndTagToken(),this.state=Z.TAG_NAME,this._stateTagName(e);else switch(e){case G.GREATER_THAN_SIGN:this._err(K.missingEndTagName),this.state=Z.DATA;break;case G.EOF:this._err(K.eofBeforeTagName),this._emitChars(`</`),this._emitEOFToken();break;default:this._err(K.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=Z.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this.state=Z.BEFORE_ATTRIBUTE_NAME;break;case G.SOLIDUS:this.state=Z.SELF_CLOSING_START_TAG;break;case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentTagToken();break;case G.NULL:this._err(K.unexpectedNullCharacter),t.tagName+=`�`;break;case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:t.tagName+=String.fromCodePoint(YH(e)?$H(e):e)}}_stateRcdataLessThanSign(e){e===G.SOLIDUS?this.state=Z.RCDATA_END_TAG_OPEN:(this._emitChars(`<`),this.state=Z.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){ZH(e)?(this.state=Z.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars(`</`),this.state=Z.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();let t=this.currentToken;switch(t.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=Z.BEFORE_ATTRIBUTE_NAME,!1;case G.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=Z.SELF_CLOSING_START_TAG,!1;case G.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=Z.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Z.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===G.SOLIDUS?this.state=Z.RAWTEXT_END_TAG_OPEN:(this._emitChars(`<`),this.state=Z.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){ZH(e)?(this.state=Z.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars(`</`),this.state=Z.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Z.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case G.SOLIDUS:this.state=Z.SCRIPT_DATA_END_TAG_OPEN;break;case G.EXCLAMATION_MARK:this.state=Z.SCRIPT_DATA_ESCAPE_START,this._emitChars(`<!`);break;default:this._emitChars(`<`),this.state=Z.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){ZH(e)?(this.state=Z.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars(`</`),this.state=Z.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Z.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===G.HYPHEN_MINUS?(this.state=Z.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars(`-`)):(this.state=Z.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===G.HYPHEN_MINUS?(this.state=Z.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`)):(this.state=Z.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case G.HYPHEN_MINUS:this.state=Z.SCRIPT_DATA_ESCAPED_DASH,this._emitChars(`-`);break;case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case G.NULL:this._err(K.unexpectedNullCharacter),this._emitChars(`�`);break;case G.EOF:this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case G.HYPHEN_MINUS:this.state=Z.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case G.NULL:this._err(K.unexpectedNullCharacter),this.state=Z.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case G.EOF:this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Z.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case G.HYPHEN_MINUS:this._emitChars(`-`);break;case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case G.GREATER_THAN_SIGN:this.state=Z.SCRIPT_DATA,this._emitChars(`>`);break;case G.NULL:this._err(K.unexpectedNullCharacter),this.state=Z.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case G.EOF:this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Z.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===G.SOLIDUS?this.state=Z.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:ZH(e)?(this._emitChars(`<`),this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars(`<`),this.state=Z.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){ZH(e)?(this.state=Z.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars(`</`),this.state=Z.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Z.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(_H.SCRIPT,!1)&&tU(this.preprocessor.peek(_H.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<_H.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=Z.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case G.HYPHEN_MINUS:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars(`-`);break;case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case G.NULL:this._err(K.unexpectedNullCharacter),this._emitChars(`�`);break;case G.EOF:this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case G.HYPHEN_MINUS:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case G.NULL:this._err(K.unexpectedNullCharacter),this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case G.EOF:this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case G.HYPHEN_MINUS:this._emitChars(`-`);break;case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case G.GREATER_THAN_SIGN:this.state=Z.SCRIPT_DATA,this._emitChars(`>`);break;case G.NULL:this._err(K.unexpectedNullCharacter),this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case G.EOF:this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===G.SOLIDUS?(this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars(`/`)):(this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(_H.SCRIPT,!1)&&tU(this.preprocessor.peek(_H.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<_H.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=Z.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.SOLIDUS:case G.GREATER_THAN_SIGN:case G.EOF:this.state=Z.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case G.EQUALS_SIGN:this._err(K.unexpectedEqualsSignBeforeAttributeName),this._createAttr(`=`),this.state=Z.ATTRIBUTE_NAME;break;default:this._createAttr(``),this.state=Z.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:case G.SOLIDUS:case G.GREATER_THAN_SIGN:case G.EOF:this._leaveAttrName(),this.state=Z.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case G.EQUALS_SIGN:this._leaveAttrName(),this.state=Z.BEFORE_ATTRIBUTE_VALUE;break;case G.QUOTATION_MARK:case G.APOSTROPHE:case G.LESS_THAN_SIGN:this._err(K.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break;case G.NULL:this._err(K.unexpectedNullCharacter),this.currentAttr.name+=`�`;break;default:this.currentAttr.name+=String.fromCodePoint(YH(e)?$H(e):e)}}_stateAfterAttributeName(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.SOLIDUS:this.state=Z.SELF_CLOSING_START_TAG;break;case G.EQUALS_SIGN:this.state=Z.BEFORE_ATTRIBUTE_VALUE;break;case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentTagToken();break;case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:this._createAttr(``),this.state=Z.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.QUOTATION_MARK:this.state=Z.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break;case G.APOSTROPHE:this.state=Z.ATTRIBUTE_VALUE_SINGLE_QUOTED;break;case G.GREATER_THAN_SIGN:this._err(K.missingAttributeValue),this.state=Z.DATA,this.emitCurrentTagToken();break;default:this.state=Z.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case G.QUOTATION_MARK:this.state=Z.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case G.AMPERSAND:this._startCharacterReference();break;case G.NULL:this._err(K.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case G.APOSTROPHE:this.state=Z.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case G.AMPERSAND:this._startCharacterReference();break;case G.NULL:this._err(K.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this._leaveAttrValue(),this.state=Z.BEFORE_ATTRIBUTE_NAME;break;case G.AMPERSAND:this._startCharacterReference();break;case G.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=Z.DATA,this.emitCurrentTagToken();break;case G.NULL:this._err(K.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case G.QUOTATION_MARK:case G.APOSTROPHE:case G.LESS_THAN_SIGN:case G.EQUALS_SIGN:case G.GRAVE_ACCENT:this._err(K.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break;case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this._leaveAttrValue(),this.state=Z.BEFORE_ATTRIBUTE_NAME;break;case G.SOLIDUS:this._leaveAttrValue(),this.state=Z.SELF_CLOSING_START_TAG;break;case G.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=Z.DATA,this.emitCurrentTagToken();break;case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:this._err(K.missingWhitespaceBetweenAttributes),this.state=Z.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case G.GREATER_THAN_SIGN:{let e=this.currentToken;e.selfClosing=!0,this.state=Z.DATA,this.emitCurrentTagToken();break}case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:this._err(K.unexpectedSolidusInTag),this.state=Z.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){let t=this.currentToken;switch(e){case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentComment(t);break;case G.EOF:this.emitCurrentComment(t),this._emitEOFToken();break;case G.NULL:this._err(K.unexpectedNullCharacter),t.data+=`�`;break;default:t.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch(_H.DASH_DASH,!0)?(this._createCommentToken(_H.DASH_DASH.length+1),this.state=Z.COMMENT_START):this._consumeSequenceIfMatch(_H.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(_H.DOCTYPE.length+1),this.state=Z.DOCTYPE):this._consumeSequenceIfMatch(_H.CDATA_START,!0)?this.inForeignNode?this.state=Z.CDATA_SECTION:(this._err(K.cdataInHtmlContent),this._createCommentToken(_H.CDATA_START.length+1),this.currentToken.data=`[CDATA[`,this.state=Z.BOGUS_COMMENT):this._ensureHibernation()||(this._err(K.incorrectlyOpenedComment),this._createCommentToken(2),this.state=Z.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case G.HYPHEN_MINUS:this.state=Z.COMMENT_START_DASH;break;case G.GREATER_THAN_SIGN:{this._err(K.abruptClosingOfEmptyComment),this.state=Z.DATA;let e=this.currentToken;this.emitCurrentComment(e);break}default:this.state=Z.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){let t=this.currentToken;switch(e){case G.HYPHEN_MINUS:this.state=Z.COMMENT_END;break;case G.GREATER_THAN_SIGN:this._err(K.abruptClosingOfEmptyComment),this.state=Z.DATA,this.emitCurrentComment(t);break;case G.EOF:this._err(K.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=Z.COMMENT,this._stateComment(e)}}_stateComment(e){let t=this.currentToken;switch(e){case G.HYPHEN_MINUS:this.state=Z.COMMENT_END_DASH;break;case G.LESS_THAN_SIGN:t.data+=`<`,this.state=Z.COMMENT_LESS_THAN_SIGN;break;case G.NULL:this._err(K.unexpectedNullCharacter),t.data+=`�`;break;case G.EOF:this._err(K.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){let t=this.currentToken;switch(e){case G.EXCLAMATION_MARK:t.data+=`!`,this.state=Z.COMMENT_LESS_THAN_SIGN_BANG;break;case G.LESS_THAN_SIGN:t.data+=`<`;break;default:this.state=Z.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===G.HYPHEN_MINUS?this.state=Z.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=Z.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===G.HYPHEN_MINUS?this.state=Z.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=Z.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==G.GREATER_THAN_SIGN&&e!==G.EOF&&this._err(K.nestedComment),this.state=Z.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){let t=this.currentToken;switch(e){case G.HYPHEN_MINUS:this.state=Z.COMMENT_END;break;case G.EOF:this._err(K.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=Z.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){let t=this.currentToken;switch(e){case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentComment(t);break;case G.EXCLAMATION_MARK:this.state=Z.COMMENT_END_BANG;break;case G.HYPHEN_MINUS:t.data+=`-`;break;case G.EOF:this._err(K.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--`,this.state=Z.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){let t=this.currentToken;switch(e){case G.HYPHEN_MINUS:t.data+=`--!`,this.state=Z.COMMENT_END_DASH;break;case G.GREATER_THAN_SIGN:this._err(K.incorrectlyClosedComment),this.state=Z.DATA,this.emitCurrentComment(t);break;case G.EOF:this._err(K.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--!`,this.state=Z.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this.state=Z.BEFORE_DOCTYPE_NAME;break;case G.GREATER_THAN_SIGN:this.state=Z.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break;case G.EOF:{this._err(K.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._err(K.missingWhitespaceBeforeDoctypeName),this.state=Z.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(YH(e))this._createDoctypeToken(String.fromCharCode($H(e))),this.state=Z.DOCTYPE_NAME;else switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.NULL:this._err(K.unexpectedNullCharacter),this._createDoctypeToken(`�`),this.state=Z.DOCTYPE_NAME;break;case G.GREATER_THAN_SIGN:{this._err(K.missingDoctypeName),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=Z.DATA;break}case G.EOF:{this._err(K.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=Z.DOCTYPE_NAME}}_stateDoctypeName(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this.state=Z.AFTER_DOCTYPE_NAME;break;case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.NULL:this._err(K.unexpectedNullCharacter),t.name+=`�`;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.name+=String.fromCodePoint(YH(e)?$H(e):e)}}_stateAfterDoctypeName(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._consumeSequenceIfMatch(_H.PUBLIC,!1)?this.state=Z.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(_H.SYSTEM,!1)?this.state=Z.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(K.invalidCharacterSequenceAfterDoctypeName),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this.state=Z.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break;case G.QUOTATION_MARK:this._err(K.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=Z.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case G.APOSTROPHE:this._err(K.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=Z.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case G.GREATER_THAN_SIGN:this._err(K.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.QUOTATION_MARK:t.publicId=``,this.state=Z.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case G.APOSTROPHE:t.publicId=``,this.state=Z.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case G.GREATER_THAN_SIGN:this._err(K.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case G.QUOTATION_MARK:this.state=Z.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case G.NULL:this._err(K.unexpectedNullCharacter),t.publicId+=`�`;break;case G.GREATER_THAN_SIGN:this._err(K.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case G.APOSTROPHE:this.state=Z.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case G.NULL:this._err(K.unexpectedNullCharacter),t.publicId+=`�`;break;case G.GREATER_THAN_SIGN:this._err(K.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this.state=Z.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break;case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.QUOTATION_MARK:this._err(K.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case G.APOSTROPHE:this._err(K.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.QUOTATION_MARK:t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case G.APOSTROPHE:t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this.state=Z.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break;case G.QUOTATION_MARK:this._err(K.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case G.APOSTROPHE:this._err(K.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case G.GREATER_THAN_SIGN:this._err(K.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.QUOTATION_MARK:t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case G.APOSTROPHE:t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case G.GREATER_THAN_SIGN:this._err(K.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case G.QUOTATION_MARK:this.state=Z.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case G.NULL:this._err(K.unexpectedNullCharacter),t.systemId+=`�`;break;case G.GREATER_THAN_SIGN:this._err(K.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case G.APOSTROPHE:this.state=Z.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case G.NULL:this._err(K.unexpectedNullCharacter),t.systemId+=`�`;break;case G.GREATER_THAN_SIGN:this._err(K.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){let t=this.currentToken;switch(e){case G.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.NULL:this._err(K.unexpectedNullCharacter);break;case G.EOF:this.emitCurrentDoctype(t),this._emitEOFToken();break;default:}}_stateCdataSection(e){switch(e){case G.RIGHT_SQUARE_BRACKET:this.state=Z.CDATA_SECTION_BRACKET;break;case G.EOF:this._err(K.eofInCdata),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===G.RIGHT_SQUARE_BRACKET?this.state=Z.CDATA_SECTION_END:(this._emitChars(`]`),this.state=Z.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case G.GREATER_THAN_SIGN:this.state=Z.DATA;break;case G.RIGHT_SQUARE_BRACKET:this._emitChars(`]`);break;default:this._emitChars(`]]`),this.state=Z.CDATA_SECTION,this._stateCdataSection(e)}}_stateCharacterReference(){let e=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(e<0)if(this.preprocessor.lastChunkWritten)e=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}e===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(G.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&QH(this.preprocessor.peek(1))?Z.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){QH(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===G.SEMICOLON&&this._err(K.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}},iU=new Set([Y.DD,Y.DT,Y.LI,Y.OPTGROUP,Y.OPTION,Y.P,Y.RB,Y.RP,Y.RT,Y.RTC]),aU=new Set([...iU,Y.CAPTION,Y.COLGROUP,Y.TBODY,Y.TD,Y.TFOOT,Y.TH,Y.THEAD,Y.TR]),oU=new Set([Y.APPLET,Y.CAPTION,Y.HTML,Y.MARQUEE,Y.OBJECT,Y.TABLE,Y.TD,Y.TEMPLATE,Y.TH]),sU=new Set([...oU,Y.OL,Y.UL]),cU=new Set([...oU,Y.BUTTON]),lU=new Set([Y.ANNOTATION_XML,Y.MI,Y.MN,Y.MO,Y.MS,Y.MTEXT]),uU=new Set([Y.DESC,Y.FOREIGN_OBJECT,Y.TITLE]),dU=new Set([Y.TR,Y.TEMPLATE,Y.HTML]),fU=new Set([Y.TBODY,Y.TFOOT,Y.THEAD,Y.TEMPLATE,Y.HTML]),pU=new Set([Y.TABLE,Y.TEMPLATE,Y.HTML]),mU=new Set([Y.TD,Y.TH]),hU=class{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,t,n){this.treeAdapter=t,this.handler=n,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=Y.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===Y.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===q.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,t){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=t,this.currentTagId=t,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,t,!0)}pop(){let e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,t){let n=this._indexOf(e);this.items[n]=t,n===this.stackTop&&(this.current=t)}insertAfter(e,t,n){let r=this._indexOf(e)+1;this.items.splice(r,0,t),this.tagIDs.splice(r,0,n),this.stackTop++,r===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,r===this.stackTop)}popUntilTagNamePopped(e){let t=this.stackTop+1;do t=this.tagIDs.lastIndexOf(e,t-1);while(t>0&&this.treeAdapter.getNamespaceURI(this.items[t])!==q.HTML);this.shortenToLength(Math.max(t,0))}shortenToLength(e){for(;this.stackTop>=e;){let t=this.current;this.tmplCount>0&&this._isInTemplate()&&--this.tmplCount,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,this.stackTop<e)}}popUntilElementPopped(e){let t=this._indexOf(e);this.shortenToLength(Math.max(t,0))}popUntilPopped(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(Math.max(n,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(KH,q.HTML)}popUntilTableCellPopped(){this.popUntilPopped(mU,q.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,t){for(let n=this.stackTop;n>=0;n--)if(e.has(this.tagIDs[n])&&this.treeAdapter.getNamespaceURI(this.items[n])===t)return n;return-1}clearBackTo(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(n+1)}clearBackToTableContext(){this.clearBackTo(pU,q.HTML)}clearBackToTableBodyContext(){this.clearBackTo(fU,q.HTML)}clearBackToTableRowContext(){this.clearBackTo(dU,q.HTML)}remove(e){let t=this._indexOf(e);t>=0&&(t===this.stackTop?this.pop():(this.items.splice(t,1),this.tagIDs.splice(t,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===Y.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){let t=this._indexOf(e)-1;return t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===Y.HTML}hasInDynamicScope(e,t){for(let n=this.stackTop;n>=0;n--){let r=this.tagIDs[n];switch(this.treeAdapter.getNamespaceURI(this.items[n])){case q.HTML:if(r===e)return!0;if(t.has(r))return!1;break;case q.SVG:if(uU.has(r))return!1;break;case q.MATHML:if(lU.has(r))return!1;break}}return!0}hasInScope(e){return this.hasInDynamicScope(e,oU)}hasInListItemScope(e){return this.hasInDynamicScope(e,sU)}hasInButtonScope(e){return this.hasInDynamicScope(e,cU)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){let t=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case q.HTML:if(KH.has(t))return!0;if(oU.has(t))return!1;break;case q.SVG:if(uU.has(t))return!1;break;case q.MATHML:if(lU.has(t))return!1;break}}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===q.HTML)switch(this.tagIDs[t]){case e:return!0;case Y.TABLE:case Y.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===q.HTML)switch(this.tagIDs[e]){case Y.TBODY:case Y.THEAD:case Y.TFOOT:return!0;case Y.TABLE:case Y.HTML:return!1}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===q.HTML)switch(this.tagIDs[t]){case e:return!0;case Y.OPTION:case Y.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&iU.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&aU.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==void 0&&this.currentTagId!==e&&aU.has(this.currentTagId);)this.pop()}},gU=3,_U;(function(e){e[e.Marker=0]=`Marker`,e[e.Element=1]=`Element`})(_U||={});var vU={type:_U.Marker},yU=class{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,t){let n=[],r=t.length,i=this.treeAdapter.getTagName(e),a=this.treeAdapter.getNamespaceURI(e);for(let e=0;e<this.entries.length;e++){let t=this.entries[e];if(t.type===_U.Marker)break;let{element:o}=t;if(this.treeAdapter.getTagName(o)===i&&this.treeAdapter.getNamespaceURI(o)===a){let t=this.treeAdapter.getAttrList(o);t.length===r&&n.push({idx:e,attrs:t})}}return n}_ensureNoahArkCondition(e){if(this.entries.length<gU)return;let t=this.treeAdapter.getAttrList(e),n=this._getNoahArkConditionCandidates(e,t);if(n.length<gU)return;let r=new Map(t.map(e=>[e.name,e.value])),i=0;for(let e=0;e<n.length;e++){let t=n[e];t.attrs.every(e=>r.get(e.name)===e.value)&&(i+=1,i>=gU&&this.entries.splice(t.idx,1))}}insertMarker(){this.entries.unshift(vU)}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.unshift({type:_U.Element,element:e,token:t})}insertElementAfterBookmark(e,t){let n=this.entries.indexOf(this.bookmark);this.entries.splice(n,0,{type:_U.Element,element:e,token:t})}removeEntry(e){let t=this.entries.indexOf(e);t!==-1&&this.entries.splice(t,1)}clearToLastMarker(){let e=this.entries.indexOf(vU);e===-1?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){let t=this.entries.find(t=>t.type===_U.Marker||this.treeAdapter.getTagName(t.element)===e);return t&&t.type===_U.Element?t:null}getElementEntry(e){return this.entries.find(t=>t.type===_U.Element&&t.element===e)}},bU={createDocument(){return{nodeName:`#document`,mode:HH.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:`#document-fragment`,childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:`#comment`,data:e,parentNode:null}},createTextNode(e){return{nodeName:`#text`,value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){let r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){let i=e.childNodes.find(e=>e.nodeName===`#documentType`);if(i)i.name=t,i.publicId=n,i.systemId=r;else{let i={nodeName:`#documentType`,name:t,publicId:n,systemId:r,parentNode:null};bU.appendChild(e,i)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){let t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){let n=e.childNodes[e.childNodes.length-1];if(bU.isTextNode(n)){n.value+=t;return}}bU.appendChild(e,bU.createTextNode(t))},insertTextBefore(e,t,n){let r=e.childNodes[e.childNodes.indexOf(n)-1];r&&bU.isTextNode(r)?r.value+=t:bU.insertBefore(e,bU.createTextNode(t),n)},adoptAttributes(e,t){let n=new Set(e.attrs.map(e=>e.name));for(let r=0;r<t.length;r++)n.has(t[r].name)||e.attrs.push(t[r])},getFirstChild(e){return e.childNodes[0]},getChildNodes(e){return e.childNodes},getParentNode(e){return e.parentNode},getAttrList(e){return e.attrs},getTagName(e){return e.tagName},getNamespaceURI(e){return e.namespaceURI},getTextNodeContent(e){return e.value},getCommentNodeContent(e){return e.data},getDocumentTypeNodeName(e){return e.name},getDocumentTypeNodePublicId(e){return e.publicId},getDocumentTypeNodeSystemId(e){return e.systemId},isTextNode(e){return e.nodeName===`#text`},isCommentNode(e){return e.nodeName===`#comment`},isDocumentTypeNode(e){return e.nodeName===`#documentType`},isElementNode(e){return Object.prototype.hasOwnProperty.call(e,`tagName`)},setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation(e){return e.sourceCodeLocation},updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}},xU=`html`,SU=`about:legacy-compat`,CU=`http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd`,wU=`+//silmaril//dtd html pro v0r11 19970101//,-//as//dtd html 3.0 aswedit + extensions//,-//advasoft ltd//dtd html 3.0 aswedit + extensions//,-//ietf//dtd html 2.0 level 1//,-//ietf//dtd html 2.0 level 2//,-//ietf//dtd html 2.0 strict level 1//,-//ietf//dtd html 2.0 strict level 2//,-//ietf//dtd html 2.0 strict//,-//ietf//dtd html 2.0//,-//ietf//dtd html 2.1e//,-//ietf//dtd html 3.0//,-//ietf//dtd html 3.2 final//,-//ietf//dtd html 3.2//,-//ietf//dtd html 3//,-//ietf//dtd html level 0//,-//ietf//dtd html level 1//,-//ietf//dtd html level 2//,-//ietf//dtd html level 3//,-//ietf//dtd html strict level 0//,-//ietf//dtd html strict level 1//,-//ietf//dtd html strict level 2//,-//ietf//dtd html strict level 3//,-//ietf//dtd html strict//,-//ietf//dtd html//,-//metrius//dtd metrius presentational//,-//microsoft//dtd internet explorer 2.0 html strict//,-//microsoft//dtd internet explorer 2.0 html//,-//microsoft//dtd internet explorer 2.0 tables//,-//microsoft//dtd internet explorer 3.0 html strict//,-//microsoft//dtd internet explorer 3.0 html//,-//microsoft//dtd internet explorer 3.0 tables//,-//netscape comm. corp.//dtd html//,-//netscape comm. corp.//dtd strict html//,-//o'reilly and associates//dtd html 2.0//,-//o'reilly and associates//dtd html extended 1.0//,-//o'reilly and associates//dtd html extended relaxed 1.0//,-//sq//dtd html 2.0 hotmetal + extensions//,-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//,-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//,-//spyglass//dtd html 2.0 extended//,-//sun microsystems corp.//dtd hotjava html//,-//sun microsystems corp.//dtd hotjava strict html//,-//w3c//dtd html 3 1995-03-24//,-//w3c//dtd html 3.2 draft//,-//w3c//dtd html 3.2 final//,-//w3c//dtd html 3.2//,-//w3c//dtd html 3.2s draft//,-//w3c//dtd html 4.0 frameset//,-//w3c//dtd html 4.0 transitional//,-//w3c//dtd html experimental 19960712//,-//w3c//dtd html experimental 970421//,-//w3c//dtd w3 html//,-//w3o//dtd w3 html 3.0//,-//webtechs//dtd mozilla html 2.0//,-//webtechs//dtd mozilla html//`.split(`,`),TU=[...wU,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`],EU=new Set([`-//w3o//dtd w3 html strict 3.0//en//`,`-/w3c/dtd html 4.0 transitional/en`,`html`]),DU=[`-//w3c//dtd xhtml 1.0 frameset//`,`-//w3c//dtd xhtml 1.0 transitional//`],OU=[...DU,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`];function kU(e,t){return t.some(t=>e.startsWith(t))}function AU(e){return e.name===xU&&e.publicId===null&&(e.systemId===null||e.systemId===SU)}function jU(e){if(e.name!==xU)return HH.QUIRKS;let{systemId:t}=e;if(t&&t.toLowerCase()===CU)return HH.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),EU.has(n))return HH.QUIRKS;let e=t===null?TU:wU;if(kU(n,e))return HH.QUIRKS;if(e=t===null?DU:OU,kU(n,e))return HH.LIMITED_QUIRKS}return HH.NO_QUIRKS}var MU={TEXT_HTML:`text/html`,APPLICATION_XML:`application/xhtml+xml`},NU=`definitionurl`,PU=`definitionURL`,FU=new Map(`attributeName.attributeType.baseFrequency.baseProfile.calcMode.clipPathUnits.diffuseConstant.edgeMode.filterUnits.glyphRef.gradientTransform.gradientUnits.kernelMatrix.kernelUnitLength.keyPoints.keySplines.keyTimes.lengthAdjust.limitingConeAngle.markerHeight.markerUnits.markerWidth.maskContentUnits.maskUnits.numOctaves.pathLength.patternContentUnits.patternTransform.patternUnits.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.refX.refY.repeatCount.repeatDur.requiredExtensions.requiredFeatures.specularConstant.specularExponent.spreadMethod.startOffset.stdDeviation.stitchTiles.surfaceScale.systemLanguage.tableValues.targetX.targetY.textLength.viewBox.viewTarget.xChannelSelector.yChannelSelector.zoomAndPan`.split(`.`).map(e=>[e.toLowerCase(),e])),IU=new Map([[`xlink:actuate`,{prefix:`xlink`,name:`actuate`,namespace:q.XLINK}],[`xlink:arcrole`,{prefix:`xlink`,name:`arcrole`,namespace:q.XLINK}],[`xlink:href`,{prefix:`xlink`,name:`href`,namespace:q.XLINK}],[`xlink:role`,{prefix:`xlink`,name:`role`,namespace:q.XLINK}],[`xlink:show`,{prefix:`xlink`,name:`show`,namespace:q.XLINK}],[`xlink:title`,{prefix:`xlink`,name:`title`,namespace:q.XLINK}],[`xlink:type`,{prefix:`xlink`,name:`type`,namespace:q.XLINK}],[`xml:lang`,{prefix:`xml`,name:`lang`,namespace:q.XML}],[`xml:space`,{prefix:`xml`,name:`space`,namespace:q.XML}],[`xmlns`,{prefix:``,name:`xmlns`,namespace:q.XMLNS}],[`xmlns:xlink`,{prefix:`xmlns`,name:`xlink`,namespace:q.XMLNS}]]),LU=new Map(`altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.textPath`.split(`.`).map(e=>[e.toLowerCase(),e])),RU=new Set([Y.B,Y.BIG,Y.BLOCKQUOTE,Y.BODY,Y.BR,Y.CENTER,Y.CODE,Y.DD,Y.DIV,Y.DL,Y.DT,Y.EM,Y.EMBED,Y.H1,Y.H2,Y.H3,Y.H4,Y.H5,Y.H6,Y.HEAD,Y.HR,Y.I,Y.IMG,Y.LI,Y.LISTING,Y.MENU,Y.META,Y.NOBR,Y.OL,Y.P,Y.PRE,Y.RUBY,Y.S,Y.SMALL,Y.SPAN,Y.STRONG,Y.STRIKE,Y.SUB,Y.SUP,Y.TABLE,Y.TT,Y.U,Y.UL,Y.VAR]);function zU(e){let t=e.tagID;return t===Y.FONT&&e.attrs.some(({name:e})=>e===VH.COLOR||e===VH.SIZE||e===VH.FACE)||RU.has(t)}function BU(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===NU){e.attrs[t].name=PU;break}}function VU(e){for(let t=0;t<e.attrs.length;t++){let n=FU.get(e.attrs[t].name);n!=null&&(e.attrs[t].name=n)}}function HU(e){for(let t=0;t<e.attrs.length;t++){let n=IU.get(e.attrs[t].name);n&&(e.attrs[t].prefix=n.prefix,e.attrs[t].name=n.name,e.attrs[t].namespace=n.namespace)}}function UU(e){let t=LU.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=WH(e.tagName))}function WU(e,t){return t===q.MATHML&&(e===Y.MI||e===Y.MO||e===Y.MN||e===Y.MS||e===Y.MTEXT)}function GU(e,t,n){if(t===q.MATHML&&e===Y.ANNOTATION_XML){for(let e=0;e<n.length;e++)if(n[e].name===VH.ENCODING){let t=n[e].value.toLowerCase();return t===MU.TEXT_HTML||t===MU.APPLICATION_XML}}return t===q.SVG&&(e===Y.FOREIGN_OBJECT||e===Y.DESC||e===Y.TITLE)}function KU(e,t,n,r){return(!r||r===q.HTML)&&GU(e,t,n)||(!r||r===q.MATHML)&&WU(e,t)}var qU=`hidden`,JU=8,YU=3,Q;(function(e){e[e.INITIAL=0]=`INITIAL`,e[e.BEFORE_HTML=1]=`BEFORE_HTML`,e[e.BEFORE_HEAD=2]=`BEFORE_HEAD`,e[e.IN_HEAD=3]=`IN_HEAD`,e[e.IN_HEAD_NO_SCRIPT=4]=`IN_HEAD_NO_SCRIPT`,e[e.AFTER_HEAD=5]=`AFTER_HEAD`,e[e.IN_BODY=6]=`IN_BODY`,e[e.TEXT=7]=`TEXT`,e[e.IN_TABLE=8]=`IN_TABLE`,e[e.IN_TABLE_TEXT=9]=`IN_TABLE_TEXT`,e[e.IN_CAPTION=10]=`IN_CAPTION`,e[e.IN_COLUMN_GROUP=11]=`IN_COLUMN_GROUP`,e[e.IN_TABLE_BODY=12]=`IN_TABLE_BODY`,e[e.IN_ROW=13]=`IN_ROW`,e[e.IN_CELL=14]=`IN_CELL`,e[e.IN_SELECT=15]=`IN_SELECT`,e[e.IN_SELECT_IN_TABLE=16]=`IN_SELECT_IN_TABLE`,e[e.IN_TEMPLATE=17]=`IN_TEMPLATE`,e[e.AFTER_BODY=18]=`AFTER_BODY`,e[e.IN_FRAMESET=19]=`IN_FRAMESET`,e[e.AFTER_FRAMESET=20]=`AFTER_FRAMESET`,e[e.AFTER_AFTER_BODY=21]=`AFTER_AFTER_BODY`,e[e.AFTER_AFTER_FRAMESET=22]=`AFTER_AFTER_FRAMESET`})(Q||={});var XU={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},ZU=new Set([Y.TABLE,Y.TBODY,Y.TFOOT,Y.THEAD,Y.TR]),QU={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:bU,onParseError:null},$U=class{constructor(e,t,n=null,r=null){this.fragmentContext=n,this.scriptHandler=r,this.currentToken=null,this.stopped=!1,this.insertionMode=Q.INITIAL,this.originalInsertionMode=Q.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...QU,...e},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=t??this.treeAdapter.createDocument(),this.tokenizer=new rU(this.options,this),this.activeFormattingElements=new yU(this.treeAdapter),this.fragmentContextID=n?WH(this.treeAdapter.getTagName(n)):Y.UNKNOWN,this._setContextModes(n??this.document,this.fragmentContextID),this.openElements=new hU(this.document,this.treeAdapter,this)}static parse(e,t){let n=new this(t);return n.tokenizer.write(e,!0),n.document}static getFragmentParser(e,t){let n={...QU,...t};e??=n.treeAdapter.createElement(J.TEMPLATE,q.HTML,[]);let r=n.treeAdapter.createElement(`documentmock`,q.HTML,[]),i=new this(n,r,e);return i.fragmentContextID===Y.TEMPLATE&&i.tmplInsertionModeStack.unshift(Q.IN_TEMPLATE),i._initTokenizerForFragmentParsing(),i._insertFakeRootElement(),i._resetInsertionMode(),i._findFormInFragmentContext(),i}getFragment(){let e=this.treeAdapter.getFirstChild(this.document),t=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,t),t}_err(e,t,n){if(!this.onParseError)return;let r=e.location??XU,i={code:t,startLine:r.startLine,startCol:r.startCol,startOffset:r.startOffset,endLine:n?r.startLine:r.endLine,endCol:n?r.startCol:r.endCol,endOffset:n?r.startOffset:r.endOffset};this.onParseError(i)}onItemPush(e,t,n){var r,i;(i=(r=this.treeAdapter).onItemPush)==null||i.call(r,e),n&&this.openElements.stackTop>0&&this._setContextModes(e,t)}onItemPop(e,t){var n,r;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(r=(n=this.treeAdapter).onItemPop)==null||r.call(n,e,this.openElements.current),t){let e,t;this.openElements.stackTop===0&&this.fragmentContext?(e=this.fragmentContext,t=this.fragmentContextID):{current:e,currentTagId:t}=this.openElements,this._setContextModes(e,t)}}_setContextModes(e,t){let n=e===this.document||e&&this.treeAdapter.getNamespaceURI(e)===q.HTML;this.currentNotInHTML=!n,this.tokenizer.inForeignNode=!n&&e!==void 0&&t!==void 0&&!this._isIntegrationPoint(t,e)}_switchToTextParsing(e,t){this._insertElement(e,q.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=Q.TEXT}switchToPlaintextParsing(){this.insertionMode=Q.TEXT,this.originalInsertionMode=Q.IN_BODY,this.tokenizer.state=qH.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===J.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==q.HTML))switch(this.fragmentContextID){case Y.TITLE:case Y.TEXTAREA:this.tokenizer.state=qH.RCDATA;break;case Y.STYLE:case Y.XMP:case Y.IFRAME:case Y.NOEMBED:case Y.NOFRAMES:case Y.NOSCRIPT:this.tokenizer.state=qH.RAWTEXT;break;case Y.SCRIPT:this.tokenizer.state=qH.SCRIPT_DATA;break;case Y.PLAINTEXT:this.tokenizer.state=qH.PLAINTEXT;break;default:}}_setDocumentType(e){let t=e.name||``,n=e.publicId||``,r=e.systemId||``;if(this.treeAdapter.setDocumentType(this.document,t,n,r),e.location){let t=this.treeAdapter.getChildNodes(this.document).find(e=>this.treeAdapter.isDocumentTypeNode(e));t&&this.treeAdapter.setNodeSourceCodeLocation(t,e.location)}}_attachElementToTree(e,t){if(this.options.sourceCodeLocationInfo){let n=t&&{...t,startTag:t};this.treeAdapter.setNodeSourceCodeLocation(e,n)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{let t=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(t??this.document,e)}}_appendElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location)}_insertElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location),this.openElements.push(n,e.tagID)}_insertFakeElement(e,t){let n=this.treeAdapter.createElement(e,q.HTML,[]);this._attachElementToTree(n,null),this.openElements.push(n,t)}_insertTemplate(e){let t=this.treeAdapter.createElement(e.tagName,q.HTML,e.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,n),this._attachElementToTree(t,e.location),this.openElements.push(t,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,null)}_insertFakeRootElement(){let e=this.treeAdapter.createElement(J.HTML,q.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,Y.HTML)}_appendCommentNode(e,t){let n=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,n),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,e.location)}_insertCharacters(e){let t,n;if(this._shouldFosterParentOnInsertion()?({parent:t,beforeElement:n}=this._findFosterParentingLocation(),n?this.treeAdapter.insertTextBefore(t,e.chars,n):this.treeAdapter.insertText(t,e.chars)):(t=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(t,e.chars)),!e.location)return;let r=this.treeAdapter.getChildNodes(t),i=r[(n?r.lastIndexOf(n):r.length)-1];if(this.treeAdapter.getNodeSourceCodeLocation(i)){let{endLine:t,endCol:n,endOffset:r}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(i,{endLine:t,endCol:n,endOffset:r})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,e.location)}_adoptNodes(e,t){for(let n=this.treeAdapter.getFirstChild(e);n;n=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(t,n)}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){let n=t.location,r=this.treeAdapter.getTagName(e),i=t.type===TH.END_TAG&&r===t.tagName?{endTag:{...n},endLine:n.endLine,endCol:n.endCol,endOffset:n.endOffset}:{endLine:n.startLine,endCol:n.startCol,endOffset:n.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,i)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let t,n;return this.openElements.stackTop===0&&this.fragmentContext?(t=this.fragmentContext,n=this.fragmentContextID):{current:t,currentTagId:n}=this.openElements,e.tagID===Y.SVG&&this.treeAdapter.getTagName(t)===J.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(t)===q.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===Y.MGLYPH||e.tagID===Y.MALIGNMARK)&&n!==void 0&&!this._isIntegrationPoint(n,t,q.HTML)}_processToken(e){switch(e.type){case TH.CHARACTER:this.onCharacter(e);break;case TH.NULL_CHARACTER:this.onNullCharacter(e);break;case TH.COMMENT:this.onComment(e);break;case TH.DOCTYPE:this.onDoctype(e);break;case TH.START_TAG:this._processStartTag(e);break;case TH.END_TAG:this.onEndTag(e);break;case TH.EOF:this.onEof(e);break;case TH.WHITESPACE_CHARACTER:this.onWhitespaceCharacter(e);break}}_isIntegrationPoint(e,t,n){return KU(e,this.treeAdapter.getNamespaceURI(t),this.treeAdapter.getAttrList(t),n)}_reconstructActiveFormattingElements(){let e=this.activeFormattingElements.entries.length;if(e){let t=this.activeFormattingElements.entries.findIndex(e=>e.type===_U.Marker||this.openElements.contains(e.element)),n=t===-1?e-1:t-1;for(let e=n;e>=0;e--){let t=this.activeFormattingElements.entries[e];this._insertElement(t.token,this.treeAdapter.getNamespaceURI(t.element)),t.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=Q.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(Y.P),this.openElements.popUntilTagNamePopped(Y.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case Y.TR:this.insertionMode=Q.IN_ROW;return;case Y.TBODY:case Y.THEAD:case Y.TFOOT:this.insertionMode=Q.IN_TABLE_BODY;return;case Y.CAPTION:this.insertionMode=Q.IN_CAPTION;return;case Y.COLGROUP:this.insertionMode=Q.IN_COLUMN_GROUP;return;case Y.TABLE:this.insertionMode=Q.IN_TABLE;return;case Y.BODY:this.insertionMode=Q.IN_BODY;return;case Y.FRAMESET:this.insertionMode=Q.IN_FRAMESET;return;case Y.SELECT:this._resetInsertionModeForSelect(e);return;case Y.TEMPLATE:this.insertionMode=this.tmplInsertionModeStack[0];return;case Y.HTML:this.insertionMode=this.headElement?Q.AFTER_HEAD:Q.BEFORE_HEAD;return;case Y.TD:case Y.TH:if(e>0){this.insertionMode=Q.IN_CELL;return}break;case Y.HEAD:if(e>0){this.insertionMode=Q.IN_HEAD;return}break}this.insertionMode=Q.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){let e=this.openElements.tagIDs[t];if(e===Y.TEMPLATE)break;if(e===Y.TABLE){this.insertionMode=Q.IN_SELECT_IN_TABLE;return}}this.insertionMode=Q.IN_SELECT}_isElementCausesFosterParenting(e){return ZU.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){let t=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case Y.TEMPLATE:if(this.treeAdapter.getNamespaceURI(t)===q.HTML)return{parent:this.treeAdapter.getTemplateContent(t),beforeElement:null};break;case Y.TABLE:{let n=this.treeAdapter.getParentNode(t);return n?{parent:n,beforeElement:t}:{parent:this.openElements.items[e-1],beforeElement:null}}default:}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){let t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e)}_isSpecialElement(e,t){return GH[this.treeAdapter.getNamespaceURI(e)].has(t)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){_K(this,e);return}switch(this.insertionMode){case Q.INITIAL:fW(this,e);break;case Q.BEFORE_HTML:hW(this,e);break;case Q.BEFORE_HEAD:vW(this,e);break;case Q.IN_HEAD:SW(this,e);break;case Q.IN_HEAD_NO_SCRIPT:TW(this,e);break;case Q.AFTER_HEAD:OW(this,e);break;case Q.IN_BODY:case Q.IN_CAPTION:case Q.IN_CELL:case Q.IN_TEMPLATE:jW(this,e);break;case Q.TEXT:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:this._insertCharacters(e);break;case Q.IN_TABLE:case Q.IN_TABLE_BODY:case Q.IN_ROW:EG(this,e);break;case Q.IN_TABLE_TEXT:zG(this,e);break;case Q.IN_COLUMN_GROUP:KG(this,e);break;case Q.AFTER_BODY:cK(this,e);break;case Q.AFTER_AFTER_BODY:mK(this,e);break;default:}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){gK(this,e);return}switch(this.insertionMode){case Q.INITIAL:fW(this,e);break;case Q.BEFORE_HTML:hW(this,e);break;case Q.BEFORE_HEAD:vW(this,e);break;case Q.IN_HEAD:SW(this,e);break;case Q.IN_HEAD_NO_SCRIPT:TW(this,e);break;case Q.AFTER_HEAD:OW(this,e);break;case Q.TEXT:this._insertCharacters(e);break;case Q.IN_TABLE:case Q.IN_TABLE_BODY:case Q.IN_ROW:EG(this,e);break;case Q.IN_COLUMN_GROUP:KG(this,e);break;case Q.AFTER_BODY:cK(this,e);break;case Q.AFTER_AFTER_BODY:mK(this,e);break;default:}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML){sW(this,e);return}switch(this.insertionMode){case Q.INITIAL:case Q.BEFORE_HTML:case Q.BEFORE_HEAD:case Q.IN_HEAD:case Q.IN_HEAD_NO_SCRIPT:case Q.AFTER_HEAD:case Q.IN_BODY:case Q.IN_TABLE:case Q.IN_CAPTION:case Q.IN_COLUMN_GROUP:case Q.IN_TABLE_BODY:case Q.IN_ROW:case Q.IN_CELL:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:case Q.IN_TEMPLATE:case Q.IN_FRAMESET:case Q.AFTER_FRAMESET:sW(this,e);break;case Q.IN_TABLE_TEXT:BG(this,e);break;case Q.AFTER_BODY:cW(this,e);break;case Q.AFTER_AFTER_BODY:case Q.AFTER_AFTER_FRAMESET:lW(this,e);break;default:}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case Q.INITIAL:dW(this,e);break;case Q.BEFORE_HEAD:case Q.IN_HEAD:case Q.IN_HEAD_NO_SCRIPT:case Q.AFTER_HEAD:this._err(e,K.misplacedDoctype);break;case Q.IN_TABLE_TEXT:BG(this,e);break;default:}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,K.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?yK(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case Q.INITIAL:fW(this,e);break;case Q.BEFORE_HTML:pW(this,e);break;case Q.BEFORE_HEAD:gW(this,e);break;case Q.IN_HEAD:yW(this,e);break;case Q.IN_HEAD_NO_SCRIPT:CW(this,e);break;case Q.AFTER_HEAD:EW(this,e);break;case Q.IN_BODY:uG(this,e);break;case Q.IN_TABLE:FG(this,e);break;case Q.IN_TABLE_TEXT:BG(this,e);break;case Q.IN_CAPTION:HG(this,e);break;case Q.IN_COLUMN_GROUP:WG(this,e);break;case Q.IN_TABLE_BODY:qG(this,e);break;case Q.IN_ROW:YG(this,e);break;case Q.IN_CELL:ZG(this,e);break;case Q.IN_SELECT:$G(this,e);break;case Q.IN_SELECT_IN_TABLE:tK(this,e);break;case Q.IN_TEMPLATE:rK(this,e);break;case Q.AFTER_BODY:oK(this,e);break;case Q.IN_FRAMESET:lK(this,e);break;case Q.AFTER_FRAMESET:dK(this,e);break;case Q.AFTER_AFTER_BODY:pK(this,e);break;case Q.AFTER_AFTER_FRAMESET:hK(this,e);break;default:}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?bK(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case Q.INITIAL:fW(this,e);break;case Q.BEFORE_HTML:mW(this,e);break;case Q.BEFORE_HEAD:_W(this,e);break;case Q.IN_HEAD:bW(this,e);break;case Q.IN_HEAD_NO_SCRIPT:wW(this,e);break;case Q.AFTER_HEAD:DW(this,e);break;case Q.IN_BODY:SG(this,e);break;case Q.TEXT:wG(this,e);break;case Q.IN_TABLE:IG(this,e);break;case Q.IN_TABLE_TEXT:BG(this,e);break;case Q.IN_CAPTION:UG(this,e);break;case Q.IN_COLUMN_GROUP:GG(this,e);break;case Q.IN_TABLE_BODY:JG(this,e);break;case Q.IN_ROW:XG(this,e);break;case Q.IN_CELL:QG(this,e);break;case Q.IN_SELECT:eK(this,e);break;case Q.IN_SELECT_IN_TABLE:nK(this,e);break;case Q.IN_TEMPLATE:iK(this,e);break;case Q.AFTER_BODY:sK(this,e);break;case Q.IN_FRAMESET:uK(this,e);break;case Q.AFTER_FRAMESET:fK(this,e);break;case Q.AFTER_AFTER_BODY:mK(this,e);break;default:}}onEof(e){switch(this.insertionMode){case Q.INITIAL:fW(this,e);break;case Q.BEFORE_HTML:hW(this,e);break;case Q.BEFORE_HEAD:vW(this,e);break;case Q.IN_HEAD:SW(this,e);break;case Q.IN_HEAD_NO_SCRIPT:TW(this,e);break;case Q.AFTER_HEAD:OW(this,e);break;case Q.IN_BODY:case Q.IN_TABLE:case Q.IN_CAPTION:case Q.IN_COLUMN_GROUP:case Q.IN_TABLE_BODY:case Q.IN_ROW:case Q.IN_CELL:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:CG(this,e);break;case Q.TEXT:TG(this,e);break;case Q.IN_TABLE_TEXT:BG(this,e);break;case Q.IN_TEMPLATE:aK(this,e);break;case Q.AFTER_BODY:case Q.IN_FRAMESET:case Q.AFTER_FRAMESET:case Q.AFTER_AFTER_BODY:case Q.AFTER_AFTER_FRAMESET:uW(this,e);break;default:}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===G.LINE_FEED)){if(e.chars.length===1)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(e);return}switch(this.insertionMode){case Q.IN_HEAD:case Q.IN_HEAD_NO_SCRIPT:case Q.AFTER_HEAD:case Q.TEXT:case Q.IN_COLUMN_GROUP:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:case Q.IN_FRAMESET:case Q.AFTER_FRAMESET:this._insertCharacters(e);break;case Q.IN_BODY:case Q.IN_CAPTION:case Q.IN_CELL:case Q.IN_TEMPLATE:case Q.AFTER_BODY:case Q.AFTER_AFTER_BODY:case Q.AFTER_AFTER_FRAMESET:AW(this,e);break;case Q.IN_TABLE:case Q.IN_TABLE_BODY:case Q.IN_ROW:EG(this,e);break;case Q.IN_TABLE_TEXT:RG(this,e);break;default:}}};function eW(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):xG(e,t),n}function tW(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){let i=e.openElements.items[r];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[r])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function nW(e,t,n){let r=t,i=e.openElements.getCommonAncestor(t);for(let a=0,o=i;o!==n;a++,o=i){i=e.openElements.getCommonAncestor(o);let n=e.activeFormattingElements.getElementEntry(o),s=n&&a>=YU;!n||s?(s&&e.activeFormattingElements.removeEntry(n),e.openElements.remove(o)):(o=rW(e,n),r===t&&(e.activeFormattingElements.bookmark=n),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(o,r),r=o)}return r}function rW(e,t){let n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function iW(e,t,n){let r=WH(e.treeAdapter.getTagName(t));if(e._isElementCausesFosterParenting(r))e._fosterParentElement(n);else{let i=e.treeAdapter.getNamespaceURI(t);r===Y.TEMPLATE&&i===q.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function aW(e,t,n){let r=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,a=e.treeAdapter.createElement(i.tagName,r,i.attrs);e._adoptNodes(t,a),e.treeAdapter.appendChild(t,a),e.activeFormattingElements.insertElementAfterBookmark(a,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,a,i.tagID)}function oW(e,t){for(let n=0;n<JU;n++){let n=eW(e,t);if(!n)break;let r=tW(e,n);if(!r)break;e.activeFormattingElements.bookmark=n;let i=nW(e,r,n.element),a=e.openElements.getCommonAncestor(n.element);e.treeAdapter.detachNode(i),a&&iW(e,a,i),aW(e,r,n)}}function sW(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function cW(e,t){e._appendCommentNode(t,e.openElements.items[0])}function lW(e,t){e._appendCommentNode(t,e.document)}function uW(e,t){if(e.stopped=!0,t.location){let n=e.fragmentContext?0:2;for(let r=e.openElements.stackTop;r>=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){let n=e.openElements.items[0],r=e.treeAdapter.getNodeSourceCodeLocation(n);if(r&&!r.endTag&&(e._setEndLocation(n,t),e.openElements.stackTop>=1)){let n=e.openElements.items[1],r=e.treeAdapter.getNodeSourceCodeLocation(n);r&&!r.endTag&&e._setEndLocation(n,t)}}}}function dW(e,t){e._setDocumentType(t);let n=t.forceQuirks?HH.QUIRKS:jU(t);AU(t)||e._err(t,K.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=Q.BEFORE_HTML}function fW(e,t){e._err(t,K.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,HH.QUIRKS),e.insertionMode=Q.BEFORE_HTML,e._processToken(t)}function pW(e,t){t.tagID===Y.HTML?(e._insertElement(t,q.HTML),e.insertionMode=Q.BEFORE_HEAD):hW(e,t)}function mW(e,t){let n=t.tagID;(n===Y.HTML||n===Y.HEAD||n===Y.BODY||n===Y.BR)&&hW(e,t)}function hW(e,t){e._insertFakeRootElement(),e.insertionMode=Q.BEFORE_HEAD,e._processToken(t)}function gW(e,t){switch(t.tagID){case Y.HTML:uG(e,t);break;case Y.HEAD:e._insertElement(t,q.HTML),e.headElement=e.openElements.current,e.insertionMode=Q.IN_HEAD;break;default:vW(e,t)}}function _W(e,t){let n=t.tagID;n===Y.HEAD||n===Y.BODY||n===Y.HTML||n===Y.BR?vW(e,t):e._err(t,K.endTagWithoutMatchingOpenElement)}function vW(e,t){e._insertFakeElement(J.HEAD,Y.HEAD),e.headElement=e.openElements.current,e.insertionMode=Q.IN_HEAD,e._processToken(t)}function yW(e,t){switch(t.tagID){case Y.HTML:uG(e,t);break;case Y.BASE:case Y.BASEFONT:case Y.BGSOUND:case Y.LINK:case Y.META:e._appendElement(t,q.HTML),t.ackSelfClosing=!0;break;case Y.TITLE:e._switchToTextParsing(t,qH.RCDATA);break;case Y.NOSCRIPT:e.options.scriptingEnabled?e._switchToTextParsing(t,qH.RAWTEXT):(e._insertElement(t,q.HTML),e.insertionMode=Q.IN_HEAD_NO_SCRIPT);break;case Y.NOFRAMES:case Y.STYLE:e._switchToTextParsing(t,qH.RAWTEXT);break;case Y.SCRIPT:e._switchToTextParsing(t,qH.SCRIPT_DATA);break;case Y.TEMPLATE:e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=Q.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(Q.IN_TEMPLATE);break;case Y.HEAD:e._err(t,K.misplacedStartTagForHeadElement);break;default:SW(e,t)}}function bW(e,t){switch(t.tagID){case Y.HEAD:e.openElements.pop(),e.insertionMode=Q.AFTER_HEAD;break;case Y.BODY:case Y.BR:case Y.HTML:SW(e,t);break;case Y.TEMPLATE:xW(e,t);break;default:e._err(t,K.endTagWithoutMatchingOpenElement)}}function xW(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==Y.TEMPLATE&&e._err(t,K.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(Y.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,K.endTagWithoutMatchingOpenElement)}function SW(e,t){e.openElements.pop(),e.insertionMode=Q.AFTER_HEAD,e._processToken(t)}function CW(e,t){switch(t.tagID){case Y.HTML:uG(e,t);break;case Y.BASEFONT:case Y.BGSOUND:case Y.HEAD:case Y.LINK:case Y.META:case Y.NOFRAMES:case Y.STYLE:yW(e,t);break;case Y.NOSCRIPT:e._err(t,K.nestedNoscriptInHead);break;default:TW(e,t)}}function wW(e,t){switch(t.tagID){case Y.NOSCRIPT:e.openElements.pop(),e.insertionMode=Q.IN_HEAD;break;case Y.BR:TW(e,t);break;default:e._err(t,K.endTagWithoutMatchingOpenElement)}}function TW(e,t){let n=t.type===TH.EOF?K.openElementsLeftAfterEof:K.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=Q.IN_HEAD,e._processToken(t)}function EW(e,t){switch(t.tagID){case Y.HTML:uG(e,t);break;case Y.BODY:e._insertElement(t,q.HTML),e.framesetOk=!1,e.insertionMode=Q.IN_BODY;break;case Y.FRAMESET:e._insertElement(t,q.HTML),e.insertionMode=Q.IN_FRAMESET;break;case Y.BASE:case Y.BASEFONT:case Y.BGSOUND:case Y.LINK:case Y.META:case Y.NOFRAMES:case Y.SCRIPT:case Y.STYLE:case Y.TEMPLATE:case Y.TITLE:e._err(t,K.abandonedHeadElementChild),e.openElements.push(e.headElement,Y.HEAD),yW(e,t),e.openElements.remove(e.headElement);break;case Y.HEAD:e._err(t,K.misplacedStartTagForHeadElement);break;default:OW(e,t)}}function DW(e,t){switch(t.tagID){case Y.BODY:case Y.HTML:case Y.BR:OW(e,t);break;case Y.TEMPLATE:xW(e,t);break;default:e._err(t,K.endTagWithoutMatchingOpenElement)}}function OW(e,t){e._insertFakeElement(J.BODY,Y.BODY),e.insertionMode=Q.IN_BODY,kW(e,t)}function kW(e,t){switch(t.type){case TH.CHARACTER:jW(e,t);break;case TH.WHITESPACE_CHARACTER:AW(e,t);break;case TH.COMMENT:sW(e,t);break;case TH.START_TAG:uG(e,t);break;case TH.END_TAG:SG(e,t);break;case TH.EOF:CG(e,t);break;default:}}function AW(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function jW(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function MW(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function NW(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function PW(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_FRAMESET)}function FW(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML)}function IW(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&KH.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,q.HTML)}function LW(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function RW(e,t){let n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML),n||(e.formElement=e.openElements.current))}function zW(e,t){e.framesetOk=!1;let n=t.tagID;for(let t=e.openElements.stackTop;t>=0;t--){let r=e.openElements.tagIDs[t];if(n===Y.LI&&r===Y.LI||(n===Y.DD||n===Y.DT)&&(r===Y.DD||r===Y.DT)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.popUntilTagNamePopped(r);break}if(r!==Y.ADDRESS&&r!==Y.DIV&&r!==Y.P&&e._isSpecialElement(e.openElements.items[t],r))break}e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML)}function BW(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML),e.tokenizer.state=qH.PLAINTEXT}function VW(e,t){e.openElements.hasInScope(Y.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(Y.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.framesetOk=!1}function HW(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(J.A);n&&(oW(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function UW(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function WW(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(Y.NOBR)&&(oW(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,q.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function GW(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function KW(e,t){e.treeAdapter.getDocumentMode(e.document)!==HH.QUIRKS&&e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML),e.framesetOk=!1,e.insertionMode=Q.IN_TABLE}function qW(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,q.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function JW(e){let t=EH(e,VH.TYPE);return t!=null&&t.toLowerCase()===qU}function YW(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,q.HTML),JW(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function XW(e,t){e._appendElement(t,q.HTML),t.ackSelfClosing=!0}function ZW(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._appendElement(t,q.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function QW(e,t){t.tagName=J.IMG,t.tagID=Y.IMG,qW(e,t)}function $W(e,t){e._insertElement(t,q.HTML),e.skipNextNewLine=!0,e.tokenizer.state=qH.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=Q.TEXT}function eG(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,qH.RAWTEXT)}function tG(e,t){e.framesetOk=!1,e._switchToTextParsing(t,qH.RAWTEXT)}function nG(e,t){e._switchToTextParsing(t,qH.RAWTEXT)}function rG(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===Q.IN_TABLE||e.insertionMode===Q.IN_CAPTION||e.insertionMode===Q.IN_TABLE_BODY||e.insertionMode===Q.IN_ROW||e.insertionMode===Q.IN_CELL?Q.IN_SELECT_IN_TABLE:Q.IN_SELECT}function iG(e,t){e.openElements.currentTagId===Y.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML)}function aG(e,t){e.openElements.hasInScope(Y.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,q.HTML)}function oG(e,t){e.openElements.hasInScope(Y.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(Y.RTC),e._insertElement(t,q.HTML)}function sG(e,t){e._reconstructActiveFormattingElements(),BU(t),HU(t),t.selfClosing?e._appendElement(t,q.MATHML):e._insertElement(t,q.MATHML),t.ackSelfClosing=!0}function cG(e,t){e._reconstructActiveFormattingElements(),VU(t),HU(t),t.selfClosing?e._appendElement(t,q.SVG):e._insertElement(t,q.SVG),t.ackSelfClosing=!0}function lG(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML)}function uG(e,t){switch(t.tagID){case Y.I:case Y.S:case Y.B:case Y.U:case Y.EM:case Y.TT:case Y.BIG:case Y.CODE:case Y.FONT:case Y.SMALL:case Y.STRIKE:case Y.STRONG:UW(e,t);break;case Y.A:HW(e,t);break;case Y.H1:case Y.H2:case Y.H3:case Y.H4:case Y.H5:case Y.H6:IW(e,t);break;case Y.P:case Y.DL:case Y.OL:case Y.UL:case Y.DIV:case Y.DIR:case Y.NAV:case Y.MAIN:case Y.MENU:case Y.ASIDE:case Y.CENTER:case Y.FIGURE:case Y.FOOTER:case Y.HEADER:case Y.HGROUP:case Y.DIALOG:case Y.DETAILS:case Y.ADDRESS:case Y.ARTICLE:case Y.SEARCH:case Y.SECTION:case Y.SUMMARY:case Y.FIELDSET:case Y.BLOCKQUOTE:case Y.FIGCAPTION:FW(e,t);break;case Y.LI:case Y.DD:case Y.DT:zW(e,t);break;case Y.BR:case Y.IMG:case Y.WBR:case Y.AREA:case Y.EMBED:case Y.KEYGEN:qW(e,t);break;case Y.HR:ZW(e,t);break;case Y.RB:case Y.RTC:aG(e,t);break;case Y.RT:case Y.RP:oG(e,t);break;case Y.PRE:case Y.LISTING:LW(e,t);break;case Y.XMP:eG(e,t);break;case Y.SVG:cG(e,t);break;case Y.HTML:MW(e,t);break;case Y.BASE:case Y.LINK:case Y.META:case Y.STYLE:case Y.TITLE:case Y.SCRIPT:case Y.BGSOUND:case Y.BASEFONT:case Y.TEMPLATE:yW(e,t);break;case Y.BODY:NW(e,t);break;case Y.FORM:RW(e,t);break;case Y.NOBR:WW(e,t);break;case Y.MATH:sG(e,t);break;case Y.TABLE:KW(e,t);break;case Y.INPUT:YW(e,t);break;case Y.PARAM:case Y.TRACK:case Y.SOURCE:XW(e,t);break;case Y.IMAGE:QW(e,t);break;case Y.BUTTON:VW(e,t);break;case Y.APPLET:case Y.OBJECT:case Y.MARQUEE:GW(e,t);break;case Y.IFRAME:tG(e,t);break;case Y.SELECT:rG(e,t);break;case Y.OPTION:case Y.OPTGROUP:iG(e,t);break;case Y.NOEMBED:case Y.NOFRAMES:nG(e,t);break;case Y.FRAMESET:PW(e,t);break;case Y.TEXTAREA:$W(e,t);break;case Y.NOSCRIPT:e.options.scriptingEnabled?nG(e,t):lG(e,t);break;case Y.PLAINTEXT:BW(e,t);break;case Y.COL:case Y.TH:case Y.TD:case Y.TR:case Y.HEAD:case Y.FRAME:case Y.TBODY:case Y.TFOOT:case Y.THEAD:case Y.CAPTION:case Y.COLGROUP:break;default:lG(e,t)}}function dG(e,t){if(e.openElements.hasInScope(Y.BODY)&&(e.insertionMode=Q.AFTER_BODY,e.options.sourceCodeLocationInfo)){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function fG(e,t){e.openElements.hasInScope(Y.BODY)&&(e.insertionMode=Q.AFTER_BODY,sK(e,t))}function pG(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function mG(e){let t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(Y.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(Y.FORM):n&&e.openElements.remove(n))}function hG(e){e.openElements.hasInButtonScope(Y.P)||e._insertFakeElement(J.P,Y.P),e._closePElement()}function gG(e){e.openElements.hasInListItemScope(Y.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(Y.LI),e.openElements.popUntilTagNamePopped(Y.LI))}function _G(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function vG(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function yG(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function bG(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(J.BR,Y.BR),e.openElements.pop(),e.framesetOk=!1}function xG(e,t){let n=t.tagName,r=t.tagID;for(let t=e.openElements.stackTop;t>0;t--){let i=e.openElements.items[t],a=e.openElements.tagIDs[t];if(r===a&&(r!==Y.UNKNOWN||e.treeAdapter.getTagName(i)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=t&&e.openElements.shortenToLength(t);break}if(e._isSpecialElement(i,a))break}}function SG(e,t){switch(t.tagID){case Y.A:case Y.B:case Y.I:case Y.S:case Y.U:case Y.EM:case Y.TT:case Y.BIG:case Y.CODE:case Y.FONT:case Y.NOBR:case Y.SMALL:case Y.STRIKE:case Y.STRONG:oW(e,t);break;case Y.P:hG(e);break;case Y.DL:case Y.UL:case Y.OL:case Y.DIR:case Y.DIV:case Y.NAV:case Y.PRE:case Y.MAIN:case Y.MENU:case Y.ASIDE:case Y.BUTTON:case Y.CENTER:case Y.FIGURE:case Y.FOOTER:case Y.HEADER:case Y.HGROUP:case Y.DIALOG:case Y.ADDRESS:case Y.ARTICLE:case Y.DETAILS:case Y.SEARCH:case Y.SECTION:case Y.SUMMARY:case Y.LISTING:case Y.FIELDSET:case Y.BLOCKQUOTE:case Y.FIGCAPTION:pG(e,t);break;case Y.LI:gG(e);break;case Y.DD:case Y.DT:_G(e,t);break;case Y.H1:case Y.H2:case Y.H3:case Y.H4:case Y.H5:case Y.H6:vG(e);break;case Y.BR:bG(e);break;case Y.BODY:dG(e,t);break;case Y.HTML:fG(e,t);break;case Y.FORM:mG(e);break;case Y.APPLET:case Y.OBJECT:case Y.MARQUEE:yG(e,t);break;case Y.TEMPLATE:xW(e,t);break;default:xG(e,t)}}function CG(e,t){e.tmplInsertionModeStack.length>0?aK(e,t):uW(e,t)}function wG(e,t){var n;t.tagID===Y.SCRIPT&&((n=e.scriptHandler)==null||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function TG(e,t){e._err(t,K.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function EG(e,t){if(e.openElements.currentTagId!==void 0&&ZU.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=Q.IN_TABLE_TEXT,t.type){case TH.CHARACTER:zG(e,t);break;case TH.WHITESPACE_CHARACTER:RG(e,t);break}else LG(e,t)}function DG(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_CAPTION}function OG(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_COLUMN_GROUP}function kG(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(J.COLGROUP,Y.COLGROUP),e.insertionMode=Q.IN_COLUMN_GROUP,WG(e,t)}function AG(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_TABLE_BODY}function jG(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(J.TBODY,Y.TBODY),e.insertionMode=Q.IN_TABLE_BODY,qG(e,t)}function MG(e,t){e.openElements.hasInTableScope(Y.TABLE)&&(e.openElements.popUntilTagNamePopped(Y.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function NG(e,t){JW(t)?e._appendElement(t,q.HTML):LG(e,t),t.ackSelfClosing=!0}function PG(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,q.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function FG(e,t){switch(t.tagID){case Y.TD:case Y.TH:case Y.TR:jG(e,t);break;case Y.STYLE:case Y.SCRIPT:case Y.TEMPLATE:yW(e,t);break;case Y.COL:kG(e,t);break;case Y.FORM:PG(e,t);break;case Y.TABLE:MG(e,t);break;case Y.TBODY:case Y.TFOOT:case Y.THEAD:AG(e,t);break;case Y.INPUT:NG(e,t);break;case Y.CAPTION:DG(e,t);break;case Y.COLGROUP:OG(e,t);break;default:LG(e,t)}}function IG(e,t){switch(t.tagID){case Y.TABLE:e.openElements.hasInTableScope(Y.TABLE)&&(e.openElements.popUntilTagNamePopped(Y.TABLE),e._resetInsertionMode());break;case Y.TEMPLATE:xW(e,t);break;case Y.BODY:case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.HTML:case Y.TBODY:case Y.TD:case Y.TFOOT:case Y.TH:case Y.THEAD:case Y.TR:break;default:LG(e,t)}}function LG(e,t){let n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,kW(e,t),e.fosterParentingEnabled=n}function RG(e,t){e.pendingCharacterTokens.push(t)}function zG(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function BG(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)LG(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}var VG=new Set([Y.CAPTION,Y.COL,Y.COLGROUP,Y.TBODY,Y.TD,Y.TFOOT,Y.TH,Y.THEAD,Y.TR]);function HG(e,t){let n=t.tagID;VG.has(n)?e.openElements.hasInTableScope(Y.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(Y.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=Q.IN_TABLE,FG(e,t)):uG(e,t)}function UG(e,t){let n=t.tagID;switch(n){case Y.CAPTION:case Y.TABLE:e.openElements.hasInTableScope(Y.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(Y.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=Q.IN_TABLE,n===Y.TABLE&&IG(e,t));break;case Y.BODY:case Y.COL:case Y.COLGROUP:case Y.HTML:case Y.TBODY:case Y.TD:case Y.TFOOT:case Y.TH:case Y.THEAD:case Y.TR:break;default:SG(e,t)}}function WG(e,t){switch(t.tagID){case Y.HTML:uG(e,t);break;case Y.COL:e._appendElement(t,q.HTML),t.ackSelfClosing=!0;break;case Y.TEMPLATE:yW(e,t);break;default:KG(e,t)}}function GG(e,t){switch(t.tagID){case Y.COLGROUP:e.openElements.currentTagId===Y.COLGROUP&&(e.openElements.pop(),e.insertionMode=Q.IN_TABLE);break;case Y.TEMPLATE:xW(e,t);break;case Y.COL:break;default:KG(e,t)}}function KG(e,t){e.openElements.currentTagId===Y.COLGROUP&&(e.openElements.pop(),e.insertionMode=Q.IN_TABLE,e._processToken(t))}function qG(e,t){switch(t.tagID){case Y.TR:e.openElements.clearBackToTableBodyContext(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_ROW;break;case Y.TH:case Y.TD:e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(J.TR,Y.TR),e.insertionMode=Q.IN_ROW,YG(e,t);break;case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.TBODY:case Y.TFOOT:case Y.THEAD:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE,FG(e,t));break;default:FG(e,t)}}function JG(e,t){let n=t.tagID;switch(t.tagID){case Y.TBODY:case Y.TFOOT:case Y.THEAD:e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE);break;case Y.TABLE:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE,IG(e,t));break;case Y.BODY:case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.HTML:case Y.TD:case Y.TH:case Y.TR:break;default:IG(e,t)}}function YG(e,t){switch(t.tagID){case Y.TH:case Y.TD:e.openElements.clearBackToTableRowContext(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_CELL,e.activeFormattingElements.insertMarker();break;case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.TBODY:case Y.TFOOT:case Y.THEAD:case Y.TR:e.openElements.hasInTableScope(Y.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE_BODY,qG(e,t));break;default:FG(e,t)}}function XG(e,t){switch(t.tagID){case Y.TR:e.openElements.hasInTableScope(Y.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE_BODY);break;case Y.TABLE:e.openElements.hasInTableScope(Y.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE_BODY,JG(e,t));break;case Y.TBODY:case Y.TFOOT:case Y.THEAD:(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(Y.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE_BODY,JG(e,t));break;case Y.BODY:case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.HTML:case Y.TD:case Y.TH:break;default:IG(e,t)}}function ZG(e,t){let n=t.tagID;VG.has(n)?(e.openElements.hasInTableScope(Y.TD)||e.openElements.hasInTableScope(Y.TH))&&(e._closeTableCell(),YG(e,t)):uG(e,t)}function QG(e,t){let n=t.tagID;switch(n){case Y.TD:case Y.TH:e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=Q.IN_ROW);break;case Y.TABLE:case Y.TBODY:case Y.TFOOT:case Y.THEAD:case Y.TR:e.openElements.hasInTableScope(n)&&(e._closeTableCell(),XG(e,t));break;case Y.BODY:case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.HTML:break;default:SG(e,t)}}function $G(e,t){switch(t.tagID){case Y.HTML:uG(e,t);break;case Y.OPTION:e.openElements.currentTagId===Y.OPTION&&e.openElements.pop(),e._insertElement(t,q.HTML);break;case Y.OPTGROUP:e.openElements.currentTagId===Y.OPTION&&e.openElements.pop(),e.openElements.currentTagId===Y.OPTGROUP&&e.openElements.pop(),e._insertElement(t,q.HTML);break;case Y.HR:e.openElements.currentTagId===Y.OPTION&&e.openElements.pop(),e.openElements.currentTagId===Y.OPTGROUP&&e.openElements.pop(),e._appendElement(t,q.HTML),t.ackSelfClosing=!0;break;case Y.INPUT:case Y.KEYGEN:case Y.TEXTAREA:case Y.SELECT:e.openElements.hasInSelectScope(Y.SELECT)&&(e.openElements.popUntilTagNamePopped(Y.SELECT),e._resetInsertionMode(),t.tagID!==Y.SELECT&&e._processStartTag(t));break;case Y.SCRIPT:case Y.TEMPLATE:yW(e,t);break;default:}}function eK(e,t){switch(t.tagID){case Y.OPTGROUP:e.openElements.stackTop>0&&e.openElements.currentTagId===Y.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===Y.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===Y.OPTGROUP&&e.openElements.pop();break;case Y.OPTION:e.openElements.currentTagId===Y.OPTION&&e.openElements.pop();break;case Y.SELECT:e.openElements.hasInSelectScope(Y.SELECT)&&(e.openElements.popUntilTagNamePopped(Y.SELECT),e._resetInsertionMode());break;case Y.TEMPLATE:xW(e,t);break;default:}}function tK(e,t){let n=t.tagID;n===Y.CAPTION||n===Y.TABLE||n===Y.TBODY||n===Y.TFOOT||n===Y.THEAD||n===Y.TR||n===Y.TD||n===Y.TH?(e.openElements.popUntilTagNamePopped(Y.SELECT),e._resetInsertionMode(),e._processStartTag(t)):$G(e,t)}function nK(e,t){let n=t.tagID;n===Y.CAPTION||n===Y.TABLE||n===Y.TBODY||n===Y.TFOOT||n===Y.THEAD||n===Y.TR||n===Y.TD||n===Y.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(Y.SELECT),e._resetInsertionMode(),e.onEndTag(t)):eK(e,t)}function rK(e,t){switch(t.tagID){case Y.BASE:case Y.BASEFONT:case Y.BGSOUND:case Y.LINK:case Y.META:case Y.NOFRAMES:case Y.SCRIPT:case Y.STYLE:case Y.TEMPLATE:case Y.TITLE:yW(e,t);break;case Y.CAPTION:case Y.COLGROUP:case Y.TBODY:case Y.TFOOT:case Y.THEAD:e.tmplInsertionModeStack[0]=Q.IN_TABLE,e.insertionMode=Q.IN_TABLE,FG(e,t);break;case Y.COL:e.tmplInsertionModeStack[0]=Q.IN_COLUMN_GROUP,e.insertionMode=Q.IN_COLUMN_GROUP,WG(e,t);break;case Y.TR:e.tmplInsertionModeStack[0]=Q.IN_TABLE_BODY,e.insertionMode=Q.IN_TABLE_BODY,qG(e,t);break;case Y.TD:case Y.TH:e.tmplInsertionModeStack[0]=Q.IN_ROW,e.insertionMode=Q.IN_ROW,YG(e,t);break;default:e.tmplInsertionModeStack[0]=Q.IN_BODY,e.insertionMode=Q.IN_BODY,uG(e,t)}}function iK(e,t){t.tagID===Y.TEMPLATE&&xW(e,t)}function aK(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(Y.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):uW(e,t)}function oK(e,t){t.tagID===Y.HTML?uG(e,t):cK(e,t)}function sK(e,t){if(t.tagID===Y.HTML){if(e.fragmentContext||(e.insertionMode=Q.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===Y.HTML){e._setEndLocation(e.openElements.items[0],t);let n=e.openElements.items[1];n&&!e.treeAdapter.getNodeSourceCodeLocation(n)?.endTag&&e._setEndLocation(n,t)}}else cK(e,t)}function cK(e,t){e.insertionMode=Q.IN_BODY,kW(e,t)}function lK(e,t){switch(t.tagID){case Y.HTML:uG(e,t);break;case Y.FRAMESET:e._insertElement(t,q.HTML);break;case Y.FRAME:e._appendElement(t,q.HTML),t.ackSelfClosing=!0;break;case Y.NOFRAMES:yW(e,t);break;default:}}function uK(e,t){t.tagID===Y.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==Y.FRAMESET&&(e.insertionMode=Q.AFTER_FRAMESET))}function dK(e,t){switch(t.tagID){case Y.HTML:uG(e,t);break;case Y.NOFRAMES:yW(e,t);break;default:}}function fK(e,t){t.tagID===Y.HTML&&(e.insertionMode=Q.AFTER_AFTER_FRAMESET)}function pK(e,t){t.tagID===Y.HTML?uG(e,t):mK(e,t)}function mK(e,t){e.insertionMode=Q.IN_BODY,kW(e,t)}function hK(e,t){switch(t.tagID){case Y.HTML:uG(e,t);break;case Y.NOFRAMES:yW(e,t);break;default:}}function gK(e,t){t.chars=`�`,e._insertCharacters(t)}function _K(e,t){e._insertCharacters(t),e.framesetOk=!1}function vK(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==q.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function yK(e,t){if(zU(t))vK(e),e._startTagOutsideForeignContent(t);else{let n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===q.MATHML?BU(t):r===q.SVG&&(UU(t),VU(t)),HU(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function bK(e,t){if(t.tagID===Y.P||t.tagID===Y.BR){vK(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){let r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===q.HTML){e._endTagOutsideForeignContent(t);break}let i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}new Set([J.AREA,J.BASE,J.BASEFONT,J.BGSOUND,J.BR,J.COL,J.EMBED,J.FRAME,J.HR,J.IMG,J.INPUT,J.KEYGEN,J.LINK,J.META,J.PARAM,J.SOURCE,J.TRACK,J.WBR]);var xK=CK(`end`),SK=CK(`start`);function CK(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function wK(e){let t=SK(e),n=xK(e);if(t&&n)return{start:t,end:n}}var TK=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,EK=new Set([`mdxFlowExpression`,`mdxJsxFlowElement`,`mdxJsxTextElement`,`mdxTextExpression`,`mdxjsEsm`]),DK={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function OK(e,t){let n=HK(e),r=tH(`type`,{handlers:{root:AK,element:jK,text:MK,comment:FK,doctype:NK,raw:IK},unknown:LK}),i={parser:n?new $U(DK):$U.getFragmentParser(void 0,DK),handle(e){r(e,i)},stitches:!1,options:t||{}};r(e,i),RK(i,SK());let a=KV(n?i.parser.document:i.parser.getFragment(),{file:i.options.file});return i.stitches&&bB(a,`comment`,function(e,t,n){let r=e;if(r.value.stitch&&n&&t!==void 0){let e=n.children;return e[t]=r.value.stitch,t}}),a.type===`root`&&a.children.length===1&&a.children[0].type===e.type?a.children[0]:a}function kK(e,t){let n=-1;if(e)for(;++n<e.length;)t.handle(e[n])}function AK(e,t){kK(e.children,t)}function jK(e,t){BK(e,t),kK(e.children,t),VK(e,t)}function MK(e,t){t.parser.tokenizer.state>4&&(t.parser.tokenizer.state=0);let n={type:TH.CHARACTER,chars:e.value,location:UK(e)};RK(t,SK(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function NK(e,t){let n={type:TH.DOCTYPE,name:`html`,forceQuirks:!1,publicId:``,systemId:``,location:UK(e)};RK(t,SK(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function PK(e,t){t.stitches=!0;let n=WK(e);`children`in e&&`children`in n&&(n.children=OK({type:`root`,children:e.children},t.options).children),FK({type:`comment`,value:{stitch:n}},t)}function FK(e,t){let n=e.value,r={type:TH.COMMENT,data:n,location:UK(e)};RK(t,SK(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function IK(e,t){if(t.parser.tokenizer.preprocessor.html=``,t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,zK(t,SK(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(TK,`<$1$2`):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;let e=t.parser.tokenizer._consume();t.parser.tokenizer._callState(e)}}function LK(e,t){let n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))PK(n,t);else{let e=``;throw EK.has(n.type)&&(e=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),Error("Cannot compile `"+n.type+"` node"+e)}}function RK(e,t){zK(e,t);let n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=qH.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:``,value:``}}function zK(e,t){if(t&&t.offset!==void 0){let n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function BK(e,t){let n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===qH.PLAINTEXT)return;RK(t,SK(e));let r=t.parser.openElements.current,i=`namespaceURI`in r?r.namespaceURI:UV.html;i===UV.html&&n===`svg`&&(i=UV.svg);let a=aH({...e,children:[]},{space:i===UV.svg?`svg`:`html`}),o={type:TH.START_TAG,tagName:n,tagID:WH(n),selfClosing:!1,ackSelfClosing:!1,attrs:`attrs`in a?a.attrs:[],location:UK(e)};t.parser.currentToken=o,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function VK(e,t){let n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&hH.includes(n)||t.parser.tokenizer.state===qH.PLAINTEXT)return;RK(t,xK(e));let r={type:TH.END_TAG,tagName:n,tagID:WH(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:UK(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===qH.RCDATA||t.parser.tokenizer.state===qH.RAWTEXT||t.parser.tokenizer.state===qH.SCRIPT_DATA)&&(t.parser.tokenizer.state=qH.DATA)}function HK(e){let t=e.type===`root`?e.children[0]:e;return!!(t&&(t.type===`doctype`||t.type===`element`&&t.tagName.toLowerCase()===`html`))}function UK(e){let t=SK(e)||{line:void 0,column:void 0,offset:void 0},n=xK(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function WK(e){return`children`in e?WB({...e,children:[]}):WB(e)}function GK(e){return function(t,n){return OK(t,{...e,file:n})}}var KK=[`ariaDescribedBy`,`ariaLabel`,`ariaLabelledBy`],qK={ancestors:{tbody:[`table`],td:[`table`],th:[`table`],thead:[`table`],tfoot:[`table`],tr:[`table`]},attributes:{a:[...KK,`dataFootnoteBackref`,`dataFootnoteRef`,[`className`,`data-footnote-backref`],`href`],blockquote:[`cite`],code:[[`className`,/^language-./]],del:[`cite`],div:[`itemScope`,`itemType`],dl:[...KK],h2:[[`className`,`sr-only`]],img:[...KK,`longDesc`,`src`],input:[[`disabled`,!0],[`type`,`checkbox`]],ins:[`cite`],li:[[`className`,`task-list-item`]],ol:[...KK,[`className`,`contains-task-list`]],q:[`cite`],section:[`dataFootnotes`,[`className`,`footnotes`]],source:[`srcSet`],summary:[...KK],table:[...KK],ul:[...KK,[`className`,`contains-task-list`]],"*":`abbr.accept.acceptCharset.accessKey.action.align.alt.axis.border.cellPadding.cellSpacing.char.charOff.charSet.checked.clear.colSpan.color.cols.compact.coords.dateTime.dir.encType.frame.hSpace.headers.height.hrefLang.htmlFor.id.isMap.itemProp.label.lang.maxLength.media.method.multiple.name.noHref.noShade.noWrap.open.prompt.readOnly.rev.rowSpan.rows.rules.scope.selected.shape.size.span.start.summary.tabIndex.title.useMap.vAlign.value.width`.split(`.`)},clobber:[`ariaDescribedBy`,`ariaLabelledBy`,`id`,`name`],clobberPrefix:`user-content-`,protocols:{cite:[`http`,`https`],href:[`http`,`https`,`irc`,`ircs`,`mailto`,`xmpp`],longDesc:[`http`,`https`],src:[`http`,`https`]},required:{input:{disabled:!0,type:`checkbox`}},strip:[`script`],tagNames:`a.b.blockquote.br.code.dd.del.details.div.dl.dt.em.h1.h2.h3.h4.h5.h6.hr.i.img.input.ins.kbd.li.ol.p.picture.pre.q.rp.rt.ruby.s.samp.section.source.span.strike.strong.sub.summary.sup.table.tbody.td.tfoot.th.thead.tr.tt.ul.var`.split(`.`)},JK={}.hasOwnProperty;function YK(e,t){let n={type:`root`,children:[]},r=XK({schema:t?{...qK,...t}:qK,stack:[]},e);return r&&(Array.isArray(r)?r.length===1?n=r[0]:n.children=r:n=r),n}function XK(e,t){if(t&&typeof t==`object`){let n=t;switch(typeof n.type==`string`?n.type:``){case`comment`:return ZK(e,n);case`doctype`:return QK(e,n);case`element`:return $K(e,n);case`root`:return eq(e,n);case`text`:return tq(e,n);default:}}}function ZK(e,t){if(e.schema.allowComments){let e=typeof t.value==`string`?t.value:``,n=e.indexOf(`-->`),r={type:`comment`,value:n<0?e:e.slice(0,n)};return cq(r,t),r}}function QK(e,t){if(e.schema.allowDoctypes){let e={type:`doctype`};return cq(e,t),e}}function $K(e,t){let n=typeof t.tagName==`string`?t.tagName:``;e.stack.push(n);let r=nq(e,t.children),i=rq(e,t.properties);e.stack.pop();let a=!1;if(n&&n!==`*`&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(a=!0,e.schema.ancestors&&JK.call(e.schema.ancestors,n))){let t=e.schema.ancestors[n],r=-1;for(a=!1;++r<t.length;)e.stack.includes(t[r])&&(a=!0)}if(!a)return e.schema.strip&&!e.schema.strip.includes(n)?r:void 0;let o={type:`element`,tagName:n,properties:i,children:r};return cq(o,t),o}function eq(e,t){let n={type:`root`,children:nq(e,t.children)};return cq(n,t),n}function tq(e,t){let n={type:`text`,value:typeof t.value==`string`?t.value:``};return cq(n,t),n}function nq(e,t){let n=[];if(Array.isArray(t)){let r=t,i=-1;for(;++i<r.length;){let t=XK(e,r[i]);t&&(Array.isArray(t)?n.push(...t):n.push(t))}}return n}function rq(e,t){let n=e.stack[e.stack.length-1],r=e.schema.attributes,i=e.schema.required,a=r&&JK.call(r,n)?r[n]:void 0,o=r&&JK.call(r,`*`)?r[`*`]:void 0,s=t&&typeof t==`object`?t:{},c={},l;for(l in s)if(JK.call(s,l)){let t=s[l],n=iq(e,lq(a,l),l,t);n??=iq(e,lq(o,l),l,t),n!=null&&(c[l]=n)}if(i&&JK.call(i,n)){let e=i[n];for(l in e)JK.call(e,l)&&!JK.call(c,l)&&(c[l]=e[l])}return c}function iq(e,t,n,r){return t?Array.isArray(r)?aq(e,t,n,r):oq(e,t,n,r):void 0}function aq(e,t,n,r){let i=-1,a=[];for(;++i<r.length;){let o=oq(e,t,n,r[i]);(typeof o==`number`||typeof o==`string`)&&a.push(o)}return a}function oq(e,t,n,r){if(!(typeof r!=`boolean`&&typeof r!=`number`&&typeof r!=`string`)&&sq(e,n,r)){if(typeof t==`object`&&t.length>1){let e=!1,n=0;for(;++n<t.length;){let i=t[n];if(i&&typeof i==`object`&&`flags`in i){if(i.test(String(r))){e=!0;break}}else if(i===r){e=!0;break}}if(!e)return}return e.schema.clobber&&e.schema.clobberPrefix&&e.schema.clobber.includes(n)?e.schema.clobberPrefix+r:r}}function sq(e,t,n){let r=e.schema.protocols&&JK.call(e.schema.protocols,t)?e.schema.protocols[t]:void 0;if(!r||r.length===0)return!0;let i=String(n),a=i.indexOf(`:`),o=i.indexOf(`?`),s=i.indexOf(`#`),c=i.indexOf(`/`);if(a<0||c>-1&&a>c||o>-1&&a>o||s>-1&&a>s)return!0;let l=-1;for(;++l<r.length;){let e=r[l];if(a===e.length&&i.slice(0,e.length)===e)return!0}return!1}function cq(e,t){let n=wK(t);t.data&&(e.data=WB(t.data)),n&&(e.position=n)}function lq(e,t){let n,r=-1;if(e)for(;++r<e.length;){let i=e[r],a=typeof i==`string`?i:i[0];if(a===t)return i;a===`data*`&&(n=i)}if(t.length>4&&t.slice(0,4).toLowerCase()===`data`)return n}function uq(e){return function(t){return YK(t,e)}}function dq(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}var fq=wq(/[A-Za-z]/),pq=wq(/[\dA-Za-z]/),mq=wq(/[#-'*+\--9=?A-Z^-~]/);function hq(e){return e!==null&&(e<32||e===127)}var gq=wq(/\d/),_q=wq(/[\dA-Fa-f]/),vq=wq(/[!-/:-@[-`{-~]/);function yq(e){return e!==null&&e<-2}function bq(e){return e!==null&&(e<0||e===32)}function xq(e){return e===-2||e===-1||e===32}var Sq=wq(/\p{P}|\p{S}/u),Cq=wq(/\s/);function wq(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Tq(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function Eq(e,t,n){let r=cB((n||{}).ignore||[]),i=kge(t),a=-1;for(;++a<i.length;)vB(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function kge(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([Age(e[0]),jge(e[1])])}return t}function Age(e){return typeof e==`string`?new RegExp(Tq(e),`g`):e}function jge(e){return typeof e==`function`?e:function(){return e}}var Dq=`phrasing`,Oq=[`autolink`,`link`,`image`,`label`];function Mge(){return{transforms:[zge],enter:{literalAutolink:Pge,literalAutolinkEmail:kq,literalAutolinkHttp:kq,literalAutolinkWww:kq},exit:{literalAutolink:Rge,literalAutolinkEmail:Lge,literalAutolinkHttp:Fge,literalAutolinkWww:Ige}}}function Nge(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:Dq,notInConstruct:Oq},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:Dq,notInConstruct:Oq},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:Dq,notInConstruct:Oq}]}}function Pge(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function kq(e){this.config.enter.autolinkProtocol.call(this,e)}function Fge(e){this.config.exit.autolinkProtocol.call(this,e)}function Ige(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function Lge(e){this.config.exit.autolinkEmail.call(this,e)}function Rge(e){this.exit(e)}function zge(e){Eq(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Bge],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Vge]],{ignore:[`link`,`linkReference`]})}function Bge(e,t,n,r,i){let a=``;if(!Aq(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!Hge(n)))return!1;let o=Uge(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function Vge(e,t,n,r){return!Aq(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function Hge(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Uge(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=dq(e,`(`),a=dq(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function Aq(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Cq(n)||Sq(n))&&(!t||n!==47)}function jq(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}Mq.peek=Qge;function Wge(){this.buffer()}function Gge(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function Kge(){this.buffer()}function qge(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function Jge(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=jq(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Yge(e){this.exit(e)}function Xge(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=jq(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Zge(e){this.exit(e)}function Qge(){return`[`}function Mq(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function $ge(){return{enter:{gfmFootnoteCallString:Wge,gfmFootnoteCall:Gge,gfmFootnoteDefinitionLabelString:Kge,gfmFootnoteDefinition:qge},exit:{gfmFootnoteCallString:Jge,gfmFootnoteCall:Yge,gfmFootnoteDefinitionLabelString:Xge,gfmFootnoteDefinition:Zge}}}function e_e(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Mq},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
130
|
+
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?Nq:t_e))),s(),o}}function t_e(e,t,n){return t===0?e:Nq(e,t,n)}function Nq(e,t,n){return(n?``:` `)+e}var n_e=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];Pq.peek=s_e;function r_e(){return{canContainEols:[`delete`],enter:{strikethrough:a_e},exit:{strikethrough:o_e}}}function i_e(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:n_e}],handlers:{delete:Pq}}}function a_e(e){this.enter({type:`delete`,children:[]},e)}function o_e(e){this.exit(e)}function Pq(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function s_e(){return`~`}function c_e(e){return e.length}function l_e(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||c_e,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=u_e(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=Fq(r[d]);else{let e=Fq(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&!(n.alignDelimiters===!1&&i===``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
|
|
131
|
+
`)}function u_e(e){return e==null?``:String(e)}function Fq(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function d_e(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),f_e);return i(),o}function f_e(e,t,n){return`>`+(n?``:` `)+e}function p_e(e,t){return Iq(e,t.inConstruct,!0)&&!Iq(e,t.notInConstruct,!1)}function Iq(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function Lq(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
132
|
+
`&&p_e(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
|
|
133
|
+
`}function m_e(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function h_e(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function g_e(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function __e(e,t,n,r){let i=g_e(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(h_e(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,v_e);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(m_e(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
|
|
134
|
+
`,encode:["`"],...s.current()})),t()}return u+=s.move(`
|
|
135
|
+
`),a&&(u+=s.move(a+`
|
|
136
|
+
`)),u+=s.move(c),l(),u}function v_e(e,t,n){return(n?``:` `)+e}function Rq(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function y_e(e,t,n,r){let i=Rq(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
|
|
137
|
+
`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function b_e(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function zq(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function Bq(e){if(e===null||bq(e)||Cq(e))return 1;if(Sq(e))return 2}function Vq(e,t,n){let r=Bq(e),i=Bq(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Hq.peek=x_e;function Hq(e,t,n,r){let i=b_e(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=Vq(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=zq(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=Vq(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+zq(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function x_e(e,t,n){return n.options.emphasis||`*`}var S_e={};function Uq(e,t){let n=t||S_e;return Wq(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function Wq(e,t,n){if(C_e(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return Gq(e.children,t,n)}return Array.isArray(e)?Gq(e,t,n):``}function Gq(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Wq(e[i],t,n);return r.join(``)}function C_e(e){return!!(e&&typeof e==`object`)}function w_e(e,t){let n=!1;return bB(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&Uq(e)&&(t.options.setext||n))}function T_e(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(w_e(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
|
|
138
|
+
`,after:`
|
|
139
|
+
`});return r(),t(),o+`
|
|
140
|
+
`+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
|
|
141
|
+
`))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
|
|
142
|
+
`,...a.current()});return/^[\t ]/.test(l)&&(l=zq(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}Kq.peek=E_e;function Kq(e){return e.value||``}function E_e(){return`<`}qq.peek=D_e;function qq(e,t,n,r){let i=Rq(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function D_e(){return`!`}Jq.peek=O_e;function Jq(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function O_e(){return`!`}Yq.peek=k_e;function Yq(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function k_e(){return"`"}function Xq(e,t){let n=Uq(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type===`text`&&(n===e.url||`mailto:`+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Zq.peek=A_e;function Zq(e,t,n,r){let i=Rq(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(Xq(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function A_e(e,t,n){return Xq(e,n)?`<`:`[`}Qq.peek=j_e;function Qq(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function j_e(){return`[`}function $q(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function M_e(e){let t=$q(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function N_e(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function eJ(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function P_e(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?N_e(n):$q(n),s=e.ordered?o===`.`?`)`:`.`:M_e(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),eJ(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function F_e(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function I_e(e,t,n,r){let i=F_e(n),a=n.bulletCurrent||$q(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function L_e(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var R_e=cB([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function z_e(e,t,n,r){return(e.children.some(function(e){return R_e(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function B_e(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}tJ.peek=V_e;function tJ(e,t,n,r){let i=B_e(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=Vq(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=zq(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=Vq(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+zq(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function V_e(e,t,n){return n.options.strong||`*`}function H_e(e,t,n,r){return n.safe(e.value,r)}function U_e(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function W_e(e,t,n){let r=(eJ(n)+(n.options.ruleSpaces?` `:``)).repeat(U_e(n));return n.options.ruleSpaces?r.slice(0,-1):r}var nJ={blockquote:d_e,break:Lq,code:__e,definition:y_e,emphasis:Hq,hardBreak:Lq,heading:T_e,html:Kq,image:qq,imageReference:Jq,inlineCode:Yq,link:Zq,linkReference:Qq,list:P_e,listItem:I_e,paragraph:L_e,root:z_e,strong:tJ,text:H_e,thematicBreak:W_e},rJ=document.createElement(`i`);function iJ(e){let t=`&`+e+`;`;rJ.innerHTML=t;let n=rJ.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function aJ(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}var G_e=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function K_e(e){return e.replace(G_e,q_e)}function q_e(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return aJ(n.slice(t?2:1),t?16:10)}return iJ(n)||e}function J_e(){return{enter:{table:Y_e,tableData:sJ,tableHeader:sJ,tableRow:Z_e},exit:{codeText:Q_e,table:X_e,tableData:oJ,tableHeader:oJ,tableRow:oJ}}}function Y_e(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function X_e(e){this.exit(e),this.data.inTable=void 0}function Z_e(e){this.enter({type:`tableRow`,children:[]},e)}function oJ(e){this.exit(e)}function sJ(e){this.enter({type:`tableCell`,children:[]},e)}function Q_e(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,$_e));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function $_e(e,t){return t===`|`?t:e}function eve(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
|
|
143
|
+
`,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
|
|
144
|
+
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return l_e(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=nJ.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function tve(){return{exit:{taskListCheckValueChecked:cJ,taskListCheckValueUnchecked:cJ,paragraph:rve}}}function nve(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:ive}}}function cJ(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function rve(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function ive(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=nJ.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function ave(){return[Mge(),$ge(),r_e(),J_e(),tve()]}function ove(e){return{extensions:[Nge(),e_e(e),i_e(),eve(e),nve()]}}function lJ(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function uJ(e,t){return e.length>0?(lJ(e,e.length,0,t),e):t}var dJ={}.hasOwnProperty;function fJ(e){let t={},n=-1;for(;++n<e.length;)sve(t,e[n]);return t}function sve(e,t){let n;for(n in t){let r=(dJ.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){dJ.call(r,a)||(r[a]=[]);let e=i[a];cve(r[a],Array.isArray(e)?e:e?[e]:[])}}}function cve(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);lJ(e,0,0,r)}var lve={tokenize:hve,partial:!0},pJ={tokenize:gve,partial:!0},mJ={tokenize:_ve,partial:!0},hJ={tokenize:vve,partial:!0},uve={tokenize:yve,partial:!0},gJ={name:`wwwAutolink`,tokenize:pve,previous:xJ},_J={name:`protocolAutolink`,tokenize:mve,previous:SJ},vJ={name:`emailAutolink`,tokenize:fve,previous:CJ},yJ={};function dve(){return{text:yJ}}for(var bJ=48;bJ<123;)yJ[bJ]=vJ,bJ++,bJ===58?bJ=65:bJ===91&&(bJ=97);yJ[43]=vJ,yJ[45]=vJ,yJ[46]=vJ,yJ[95]=vJ,yJ[72]=[vJ,_J],yJ[104]=[vJ,_J],yJ[87]=[vJ,gJ],yJ[119]=[vJ,gJ];function fve(e,t,n){let r=this,i,a;return o;function o(t){return!wJ(t)||!CJ.call(r,r.previous)||TJ(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return wJ(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(uve,u,l)(t):t===45||t===95||pq(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&fq(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function pve(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!xJ.call(r,r.previous)||TJ(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(lve,e.attempt(pJ,e.attempt(mJ,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function mve(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&SJ.call(r,r.previous)&&!TJ(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(fq(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||hq(t)||bq(t)||Cq(t)||Sq(t)?n(t):e.attempt(pJ,e.attempt(mJ,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function hve(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function gve(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(hJ,c,s)(t):t===null||bq(t)||Cq(t)||t!==45&&Sq(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function _ve(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(hJ,t,a)(o):o===null||bq(o)||Cq(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function vve(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||bq(o)||Cq(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||bq(e)||Cq(e)?t(e):r(e)}function a(e){return fq(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):fq(t)?(e.consume(t),o):n(t)}}function yve(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return pq(e)?n(e):t(e)}}function xJ(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||bq(e)}function SJ(e){return!fq(e)}function CJ(e){return!(e===47||wJ(e))}function wJ(e){return e===43||e===45||e===46||e===95||pq(e)}function TJ(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function EJ(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&pq(e.charCodeAt(n+1))&&pq(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function DJ(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var OJ={name:`attention`,resolveAll:bve,tokenize:xve};function bve(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};kJ(d,-c),kJ(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=uJ(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=uJ(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=uJ(l,DJ(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=uJ(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=uJ(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,lJ(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function xve(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Bq(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Bq(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function kJ(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Sve={name:`autolink`,tokenize:Cve};function Cve(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return fq(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||pq(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||pq(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||hq(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):mq(t)?(e.consume(t),l):n(t)}function u(e){return pq(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||pq(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}function AJ(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return xq(r)?(e.enter(n),s(r)):t(r)}function s(r){return xq(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var jJ={partial:!0,tokenize:wve};function wve(e,t,n){return r;function r(t){return xq(t)?AJ(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||yq(e)?t(e):n(e)}}var MJ={continuation:{tokenize:Eve},exit:Dve,name:`blockQuote`,tokenize:Tve};function Tve(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return xq(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Eve(e,t,n){let r=this;return i;function i(t){return xq(t)?AJ(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(MJ,t,n)(r)}}function Dve(e){e.exit(`blockQuote`)}var NJ={name:`characterEscape`,tokenize:Ove};function Ove(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return vq(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var PJ={name:`characterReference`,tokenize:kve};function kve(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=pq,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=_q,u):(e.enter(`characterReferenceValue`),a=7,o=gq,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===pq&&!iJ(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var FJ={partial:!0,tokenize:jve},IJ={concrete:!0,name:`codeFenced`,tokenize:Ave};function Ave(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),xq(t)?AJ(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||yq(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(FJ,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||yq(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):xq(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),AJ(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||yq(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||yq(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&xq(t)?AJ(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||yq(t)?e.check(FJ,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||yq(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),xq(t)?AJ(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),xq(t)?AJ(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||yq(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function jve(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var LJ={name:`codeIndented`,tokenize:Nve},Mve={partial:!0,tokenize:Pve};function Nve(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),AJ(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):yq(t)?e.attempt(Mve,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||yq(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Pve(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):yq(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):AJ(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):yq(e)?i(e):n(e)}}var Fve={name:`codeText`,previous:Lve,resolve:Ive,tokenize:Rve};function Ive(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Lve(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Rve(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):yq(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||yq(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var zve=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&RJ(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),RJ(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),RJ(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);RJ(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);RJ(this.left,t.reverse())}}};function RJ(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function zJ(e){let t={},n=-1,r,i,a,o,s,c,l,u=new zve(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,Bve(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return lJ(e,0,1/0,u.slice(0)),!l}function Bve(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var Vve={resolve:Uve,tokenize:Wve},Hve={partial:!0,tokenize:Gve};function Uve(e){return zJ(e),e}function Wve(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):yq(t)?e.check(Hve,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function Gve(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),AJ(e,a,`linePrefix`)}function a(i){if(i===null||yq(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function BJ(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||hq(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||yq(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||bq(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||hq(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function VJ(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):yq(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||yq(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!xq(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function HJ(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):yq(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),AJ(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||yq(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function UJ(e,t){let n;return r;function r(i){return yq(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):xq(i)?AJ(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Kve={name:`definition`,tokenize:Jve},qve={partial:!0,tokenize:Yve};function Jve(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return VJ.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=jq(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return bq(t)?UJ(e,l)(t):l(t)}function l(t){return BJ(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(qve,d,d)(t)}function d(t){return xq(t)?AJ(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||yq(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Yve(e,t,n){return r;function r(t){return bq(t)?UJ(e,i)(t):n(t)}function i(t){return HJ(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return xq(t)?AJ(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||yq(e)?t(e):n(e)}}var Xve={name:`hardBreakEscape`,tokenize:Zve};function Zve(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return yq(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Qve={name:`headingAtx`,resolve:$ve,tokenize:eye};function $ve(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},lJ(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function eye(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||bq(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||yq(n)?(e.exit(`atxHeading`),t(n)):xq(n)?AJ(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||bq(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var tye=`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.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),WJ=[`pre`,`script`,`style`,`textarea`],nye={concrete:!0,name:`htmlFlow`,resolveTo:aye,tokenize:oye},rye={partial:!0,tokenize:cye},iye={partial:!0,tokenize:sye};function aye(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function oye(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:N):fq(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):fq(a)?(e.consume(a),i=4,r.interrupt?t:N):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:N):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return fq(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||bq(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&WJ.includes(l)?(i=1,r.interrupt?t(s):O(s)):tye.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||pq(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return xq(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||fq(t)?(e.consume(t),b):xq(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||pq(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):xq(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):xq(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||yq(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||bq(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||xq(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||yq(t)?O(t):xq(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),j):t===60&&i===1?(e.consume(t),te):t===62&&i===4?(e.consume(t),re):t===63&&i===3?(e.consume(t),N):t===93&&i===5?(e.consume(t),M):yq(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(rye,ie,k)(t)):t===null||yq(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(iye,ee,ie)(t)}function ee(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),A}function A(t){return t===null||yq(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function j(t){return t===45?(e.consume(t),N):O(t)}function te(t){return t===47?(e.consume(t),o=``,ne):O(t)}function ne(t){if(t===62){let n=o.toLowerCase();return WJ.includes(n)?(e.consume(t),re):O(t)}return fq(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ne):O(t)}function M(t){return t===93?(e.consume(t),N):O(t)}function N(t){return t===62?(e.consume(t),re):t===45&&i===2?(e.consume(t),N):O(t)}function re(t){return t===null||yq(t)?(e.exit(`htmlFlowData`),ie(t)):(e.consume(t),re)}function ie(n){return e.exit(`htmlFlow`),t(n)}}function sye(e,t,n){let r=this;return i;function i(t){return yq(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function cye(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(jJ,t,n)}}var lye={name:`htmlText`,tokenize:uye};function uye(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):fq(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):fq(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):yq(t)?(o=d,te(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?j(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):yq(t)?(o=h,te(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?j(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?j(t):yq(t)?(o=v,te(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):yq(t)?(o=y,te(t)):(e.consume(t),y)}function b(e){return e===62?j(e):y(e)}function x(t){return fq(t)?(e.consume(t),S):n(t)}function S(t){return t===45||pq(t)?(e.consume(t),S):C(t)}function C(t){return yq(t)?(o=C,te(t)):xq(t)?(e.consume(t),C):j(t)}function w(t){return t===45||pq(t)?(e.consume(t),w):t===47||t===62||bq(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),j):t===58||t===95||fq(t)?(e.consume(t),E):yq(t)?(o=T,te(t)):xq(t)?(e.consume(t),T):j(t)}function E(t){return t===45||t===46||t===58||t===95||pq(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):yq(t)?(o=D,te(t)):xq(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):yq(t)?(o=O,te(t)):xq(t)?(e.consume(t),O):(e.consume(t),ee)}function k(t){return t===i?(e.consume(t),i=void 0,A):t===null?n(t):yq(t)?(o=k,te(t)):(e.consume(t),k)}function ee(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||bq(t)?T(t):(e.consume(t),ee)}function A(e){return e===47||e===62||bq(e)?T(e):n(e)}function j(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function te(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ne}function ne(t){return xq(t)?AJ(e,M,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):M(t)}function M(t){return e.enter(`htmlTextData`),o(t)}}var GJ={name:`labelEnd`,resolveAll:mye,resolveTo:hye,tokenize:gye},dye={tokenize:_ye},fye={tokenize:vye},pye={tokenize:yye};function mye(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&lJ(e,0,e.length,n),e}function hye(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=uJ(s,e.slice(a+1,a+r+3)),s=uJ(s,[[`enter`,u,t]]),s=uJ(s,DJ(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=uJ(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=uJ(s,e.slice(o+1)),s=uJ(s,[[`exit`,c,t]]),lJ(e,a,e.length,s),e}function gye(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(jq(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(dye,u,o?u:d)(t):t===91?e.attempt(fye,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(pye,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function _ye(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return bq(t)?UJ(e,a)(t):a(t)}function a(t){return t===41?u(t):BJ(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return bq(t)?UJ(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?HJ(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return bq(t)?UJ(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function vye(e,t,n){let r=this;return i;function i(t){return VJ.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(jq(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function yye(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var bye={name:`labelStartImage`,resolveAll:GJ.resolveAll,tokenize:xye};function xye(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Sye={name:`labelStartLink`,resolveAll:GJ.resolveAll,tokenize:Cye};function Cye(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var KJ={name:`lineEnding`,tokenize:wye};function wye(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),AJ(e,t,`linePrefix`)}}var qJ={name:`thematicBreak`,tokenize:Tye};function Tye(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||yq(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),xq(t)?AJ(e,s,`whitespace`)(t):s(t))}}var JJ={continuation:{tokenize:kye},exit:jye,name:`list`,tokenize:Oye},Eye={partial:!0,tokenize:Mye},Dye={partial:!0,tokenize:Aye};function Oye(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:gq(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(qJ,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return gq(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(jJ,r.interrupt?n:u,e.attempt(Eye,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return xq(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function kye(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(jJ,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,AJ(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!xq(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Dye,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,AJ(e,e.attempt(JJ,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Aye(e,t,n){let r=this;return AJ(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function jye(e){e.exit(this.containerState.type)}function Mye(e,t,n){let r=this;return AJ(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!xq(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var YJ={name:`setextUnderline`,resolveTo:Nye,tokenize:Pye};function Nye(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function Pye(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),xq(t)?AJ(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||yq(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Fye={tokenize:Uye,partial:!0};function Iye(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:Bye,continuation:{tokenize:Vye},exit:Hye}},text:{91:{name:`gfmFootnoteCall`,tokenize:zye},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:Lye,resolveTo:Rye}}}}function Lye(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=jq(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function Rye(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function zye(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||bq(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(jq(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return bq(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function Bye(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||bq(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=jq(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return bq(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),AJ(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function Vye(e,t,n){return e.check(jJ,t,e.attempt(Fye,t,n))}function Hye(e){e.exit(`gfmFootnoteDefinition`)}function Uye(e,t,n){let r=this;return AJ(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function Wye(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&lJ(o,o.length,0,DJ(s,e.slice(r+1,n),t)),lJ(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),lJ(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=Bq(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=Bq(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var Gye=class{constructor(){this.map=[]}add(e,t,n){Kye(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function Kye(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function qye(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function Jye(){return{flow:{null:{name:`table`,tokenize:Yye,resolveAll:Xye}}}}function Yye(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):yq(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):xq(t)?AJ(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||bq(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,xq(t)?AJ(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return xq(t)?AJ(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||yq(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return xq(t)?AJ(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||yq(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||yq(n)?(e.exit(`tableRow`),t(n)):xq(n)?AJ(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||bq(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function Xye(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new Gye;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(ZJ(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=XJ(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=XJ(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=XJ(f,t,o,i,n,d)):(o[0]=o[1],d=XJ(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&ZJ(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=qye(t.events,n))}return e}function XJ(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},QJ(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=QJ(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=QJ(t.events,n[2]),a=QJ(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},QJ(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function ZJ(e,t,n,r,i){let a=[],o=QJ(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function QJ(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var Zye={name:`tasklistCheck`,tokenize:$ye};function Qye(){return{text:{91:Zye}}}function $ye(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return bq(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return yq(r)?t(r):xq(r)?e.check({tokenize:ebe},t,n)(r):n(r)}}function ebe(e,t,n){return AJ(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function tbe(e){return fJ([dve(),Iye(),Wye(e),Jye(),Qye()])}var nbe={};function rbe(e){let t=this,n=e||nbe,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(tbe(n)),a.push(ave()),o.push(ove(n))}var ibe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,abe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,obe={};function $J(e,t){return((t||obe).jsx?abe:ibe).test(e)}var sbe=/[ \t\n\f\r]/g;function cbe(e){return typeof e==`object`?e.type===`text`?eY(e.value):!1:eY(e)}function eY(e){return e.replace(sbe,``)===``}var lbe=a(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
145
|
+
`,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),ube=a((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(lbe());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),dbe=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),fbe=a(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(ube()),r=dbe();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i}));function tY(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?rY(e.position):`start`in e||`end`in e?rY(e):`line`in e||`column`in e?nY(e):``}function nY(e){return iY(e&&e.line)+`:`+iY(e&&e.column)}function rY(e){return nY(e&&e.start)+`-`+nY(e&&e.end)}function iY(e){return e&&typeof e==`number`?e:1}var aY=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=tY(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};aY.prototype.file=``,aY.prototype.name=``,aY.prototype.reason=``,aY.prototype.message=``,aY.prototype.stack=``,aY.prototype.column=void 0,aY.prototype.line=void 0,aY.prototype.ancestors=void 0,aY.prototype.cause=void 0,aY.prototype.fatal=void 0,aY.prototype.place=void 0,aY.prototype.ruleId=void 0,aY.prototype.source=void 0;var pbe=r(fbe(),1),oY={}.hasOwnProperty,mbe=new Map,hbe=/[A-Z]/g,gbe=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),_be=new Set([`td`,`th`]);function vbe(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Ebe(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Tbe(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?wV:CV,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=sY(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function sY(e,t,n){if(t.type===`element`)return ybe(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return bbe(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Sbe(e,t,n);if(t.type===`mdxjsEsm`)return xbe(e,t);if(t.type===`root`)return Cbe(e,t,n);if(t.type===`text`)return wbe(e,t)}function ybe(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=wV,e.schema=i),e.ancestors.push(t);let a=dY(e,t.tagName,!1),o=Dbe(e,t),s=uY(e,t);return gbe.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!cbe(e):!0})),cY(e,o,a,t),lY(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function bbe(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}fY(e,t.position)}function xbe(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);fY(e,t.position)}function Sbe(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=wV,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:dY(e,t.name,!0),o=Obe(e,t),s=uY(e,t);return cY(e,o,a,t),lY(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Cbe(e,t,n){let r={};return lY(r,uY(e,t)),e.create(t,e.Fragment,r,n)}function wbe(e,t){return t.value}function cY(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function lY(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Tbe(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Ebe(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=SK(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Dbe(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&oY.call(t.properties,i)){let a=kbe(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&_be.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Obe(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else fY(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else fY(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function uY(e,t){let n=[],r=-1,i=e.passKeys?new Map:mbe;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=sY(e,a,o);s!==void 0&&n.push(s)}return n}function kbe(e,t,n){let r=bV(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?EV(n):AV(n)),r.property===`style`){let t=typeof n==`object`?n:Abe(e,String(n));return e.stylePropertyNameCase===`css`&&(t=jbe(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?gV[r.property]||r.property:r.attribute,n]}}function Abe(e,t){try{return(0,pbe.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new aY("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-parse-style-attribute`,r}}function dY(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=$J(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=$J(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return oY.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);fY(e)}function fY(e,t){let n=new aY("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-handle-mdx-estrees-without-createevaluater`,n}function jbe(e){let t={},n;for(n in e)oY.call(e,n)&&(t[Mbe(n)]=e[n]);return t}function Mbe(e){let t=e.replace(hbe,Nbe);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Nbe(e){return`-`+e.toLowerCase()}var pY={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},Pbe={tokenize:Fbe};function Fbe(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),AJ(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return yq(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Ibe={tokenize:Lbe},mY={tokenize:Rbe};function Lbe(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return lJ(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(mY,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(mY,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return yq(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;lJ(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Rbe(e,t,n){return AJ(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}var zbe={tokenize:Bbe};function Bbe(e){let t=this,n=e.attempt(jJ,r,e.attempt(this.parser.constructs.flowInitial,i,AJ(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Vve,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Vbe={resolveAll:gY()},Hbe=hY(`string`),Ube=hY(`text`);function hY(e){return{resolveAll:gY(e===`text`?Wbe:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function gY(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Wbe(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var Gbe=s({attentionMarkers:()=>$be,contentInitial:()=>qbe,disable:()=>exe,document:()=>Kbe,flow:()=>Ybe,flowInitial:()=>Jbe,insideSpan:()=>Qbe,string:()=>Xbe,text:()=>Zbe}),Kbe={42:JJ,43:JJ,45:JJ,48:JJ,49:JJ,50:JJ,51:JJ,52:JJ,53:JJ,54:JJ,55:JJ,56:JJ,57:JJ,62:MJ},qbe={91:Kve},Jbe={[-2]:LJ,[-1]:LJ,32:LJ},Ybe={35:Qve,42:qJ,45:[YJ,qJ],60:nye,61:YJ,95:qJ,96:IJ,126:IJ},Xbe={38:PJ,92:NJ},Zbe={[-5]:KJ,[-4]:KJ,[-3]:KJ,33:bye,38:PJ,42:OJ,60:[Sve,lye],91:Sye,92:[Xve,NJ],93:GJ,95:OJ,96:Fve},Qbe={null:[OJ,Vbe]},$be={null:[42,95]},exe={null:[]};function txe(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=uJ(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=DJ(a,l.events,l),l.events):[]}function f(e,t){return rxe(p(e),t)}function p(e){return nxe(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){yq(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&lJ(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function nxe(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function rxe(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
146
|
+
`;break;case-3:o=`\r
|
|
147
|
+
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function ixe(e){let t={constructs:fJ([Gbe,...(e||{}).extensions||[]]),content:n(Pbe),defined:[],document:n(Ibe),flow:n(zbe),lazy:{},string:n(Hbe),text:n(Ube)};return t;function n(e){return n;function n(n){return txe(t,e,n)}}}function axe(e){for(;!zJ(e););return e}var _Y=/[\0\t\n\r]/g;function oxe(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(_Y.lastIndex=u,c=_Y.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var vY={}.hasOwnProperty;function sxe(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),cxe(n)(axe(ixe(n).document().write(oxe()(e,t,!0))))}function cxe(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(xe),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(_e),blockQuote:a(fe),characterEscape:T,characterReference:T,codeFenced:a(pe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(pe,o),codeText:a(me,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(he),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(ge),hardBreakEscape:a(ve),hardBreakTrailing:a(ve),htmlFlow:a(ye,o),htmlFlowData:T,htmlText:a(ye,o),htmlTextData:T,image:a(be),label:o,link:a(xe),listItem:a(Ce),listItemValue:f,listOrdered:a(Se,d),listUnordered:a(Se),paragraph:a(we),reference:ae,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(_e),strong:a(Te),thematicBreak:a(De)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:de,autolinkProtocol:ue,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:se,characterReferenceMarkerNumeric:se,characterReferenceValue:ce,characterReference:le,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(A),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(ee),htmlTextData:E,image:c(te),label:M,labelText:ne,lineEnding:D,link:c(j),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:oe,resourceDestinationString:N,resourceTitleString:re,resource:ie,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};bY(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];vY.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||xY).call(a,void 0,e[0])}for(r.position={start:yY(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:yY(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:yY(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||xY).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+tY({start:e.start,end:e.end})+`): it’s not open`);n.position.end=yY(e.end)}function u(){return Uq(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=jq(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=Ee(),n.position={start:yY(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=yY(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=yY(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function te(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function ne(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=K_e(t),n.identifier=jq(t).toLowerCase()}function M(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function N(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function re(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ie(){this.data.inReference=void 0}function ae(){this.data.referenceType=`collapsed`}function oe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=jq(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function se(e){this.data.characterReferenceType=e.type}function ce(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=aJ(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=iJ(t);let i=this.stack[this.stack.length-1];i.value+=r}function le(e){let t=this.stack.pop();t.position.end=yY(e.end)}function ue(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function de(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function fe(){return{type:`blockquote`,children:[]}}function pe(){return{type:`code`,lang:null,meta:null,value:``}}function me(){return{type:`inlineCode`,value:``}}function he(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function ge(){return{type:`emphasis`,children:[]}}function _e(){return{type:`heading`,depth:0,children:[]}}function ve(){return{type:`break`}}function ye(){return{type:`html`,value:``}}function be(){return{type:`image`,title:null,url:``,alt:null}}function xe(){return{type:`link`,title:null,url:``,children:[]}}function Se(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function Ce(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function we(){return{type:`paragraph`,children:[]}}function Te(){return{type:`strong`,children:[]}}function Ee(){return{type:`text`,value:``}}function De(){return{type:`thematicBreak`}}}function yY(e){return{line:e.line,column:e.column,offset:e.offset}}function bY(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?bY(e,r):lxe(e,r)}}function lxe(e,t){let n;for(n in t)if(vY.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function xY(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+tY({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+tY({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+tY({start:t.start,end:t.end})+`) is still open`)}function uxe(e){let t=this;t.parser=n;function n(n){return sxe(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function dxe(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function fxe(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
148
|
+
`}]}function pxe(e,t){let n=t.value?t.value+`
|
|
149
|
+
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function mxe(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function hxe(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function gxe(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=EJ(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function _xe(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vxe(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function SY(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function yxe(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return SY(e,t);let i={src:EJ(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function bxe(e,t){let n={src:EJ(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function xxe(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Sxe(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return SY(e,t);let i={href:EJ(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Cxe(e,t){let n={href:EJ(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function wxe(e,t,n){let r=e.all(t),i=n?Txe(n):CY(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
150
|
+
`}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
151
|
+
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function Txe(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=CY(n[r])}return t}function CY(e){return e.spread??e.children.length>1}function Exe(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function Dxe(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Oxe(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function kxe(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Axe(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=SK(t.children[1]),o=xK(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function jxe(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function Mxe(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var wY=9,TY=32;function Nxe(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(EY(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(EY(t.slice(i),i>0,!1)),a.join(``)}function EY(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===wY||t===TY;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===wY||t===TY;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function Pxe(e,t){let n={type:`text`,value:Nxe(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Fxe(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var Ixe={blockquote:dxe,break:fxe,code:pxe,delete:mxe,emphasis:hxe,footnoteReference:gxe,heading:_xe,html:vxe,imageReference:yxe,image:bxe,inlineCode:xxe,linkReference:Sxe,link:Cxe,listItem:wxe,list:Exe,paragraph:Dxe,root:Oxe,strong:kxe,table:Axe,tableCell:Mxe,tableRow:jxe,text:Pxe,thematicBreak:Fxe,toml:DY,yaml:DY,definition:DY,footnoteDefinition:DY};function DY(){}function Lxe(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function Rxe(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function zxe(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||Lxe,r=e.options.footnoteBackLabel||Rxe,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=EJ(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...WB(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
|
|
152
|
+
`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
|
|
153
|
+
`}]}}var OY={}.hasOwnProperty,Bxe={};function Vxe(e,t){let n=t||Bxe,r=new Map,i=new Map,a={all:s,applyData:Uxe,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...Ixe,...n.handlers},one:o,options:n,patch:Hxe,wrap:Gxe};return bB(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(OY.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=WB(n);return r.children=a.all(e),r}return WB(e)}return(a.options.unknownHandler||Wxe)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=kY(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=kY(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function Hxe(e,t){e.position&&(t.position=wK(e))}function Uxe(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,WB(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function Wxe(e,t){let n=t.data||{},r=`value`in t&&!(OY.call(n,`hProperties`)||OY.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Gxe(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
|
|
154
|
+
`});++r<e.length;)r&&n.push({type:`text`,value:`
|
|
155
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
|
|
156
|
+
`}),n}function kY(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function AY(e,t){let n=Vxe(e,t),r=n.one(e,void 0),i=zxe(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
|
|
157
|
+
`},i)),a}function Kxe(e,t){return e&&`run`in e?async function(n,r){let i=AY(n,{file:r,...t});await e.run(i,r)}:function(n,r){return AY(n,{file:r,...e||t})}}function jY(e){if(e)throw e}var qxe=a(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function MY(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Jxe(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?Yxe(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function Yxe(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var NY={basename:Xxe,dirname:Zxe,extname:Qxe,join:$xe,sep:`/`};function Xxe(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);PY(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Zxe(e){if(PY(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function Qxe(e){PY(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function $xe(...e){let t=-1,n;for(;++t<e.length;)PY(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:eSe(n)}function eSe(e){PY(e);let t=e.codePointAt(0)===47,n=tSe(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function tSe(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function PY(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var nSe={cwd:rSe};function rSe(){return`/`}function FY(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function iSe(e){if(typeof e==`string`)e=new URL(e);else if(!FY(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return aSe(e)}function aSe(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var IY=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],oSe=class{constructor(e){let t;t=e?FY(e)?{path:e}:typeof e==`string`||sSe(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:nSe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<IY.length;){let e=IY[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)IY.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?NY.basename(this.path):void 0}set basename(e){RY(e,`basename`),LY(e,`basename`),this.path=NY.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?NY.dirname(this.path):void 0}set dirname(e){zY(this.basename,`dirname`),this.path=NY.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?NY.extname(this.path):void 0}set extname(e){if(LY(e,`extname`),zY(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=NY.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){FY(e)&&(e=iSe(e)),RY(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?NY.basename(this.path,this.extname):void 0}set stem(e){RY(e,`stem`),LY(e,`stem`),this.path=NY.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new aY(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function LY(e,t){if(e&&e.includes(NY.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+NY.sep+"`")}function RY(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function zY(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function sSe(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var cSe=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),BY=r(qxe(),1),lSe={}.hasOwnProperty,uSe=new class e extends cSe{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Jxe()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,BY.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(UY(`data`,this.frozen),this.namespace[e]=t,this):lSe.call(this.namespace,e)&&this.namespace[e]||void 0:e?(UY(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=KY(e),n=this.parser||this.Parser;return VY(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),VY(`process`,this.parser||this.Parser),HY(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=KY(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);fSe(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),VY(`processSync`,this.parser||this.Parser),HY(`processSync`,this.compiler||this.Compiler),this.process(e,r),GY(`processSync`,`process`,t),n;function r(e,r){t=!0,jY(e),n=r}}run(e,t,n){WY(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=KY(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),GY(`runSync`,`run`,n),r;function i(e,t){jY(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=KY(t),r=this.compiler||this.Compiler;return HY(`stringify`,r),WY(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(UY(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,BY.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];MY(o)&&MY(r)&&(r=(0,BY.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function VY(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function HY(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function UY(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function WY(e){if(!MY(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function GY(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function KY(e){return dSe(e)?e:new oSe(e)}function dSe(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function fSe(e){return typeof e==`string`||pSe(e)}function pSe(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}function qY(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var JY=qY();function YY(e){JY=e}var XY={exec:()=>null};function ZY(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(QY.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var mSe=(()=>{try{return!0}catch{return!1}})(),QY={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,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ 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,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`),blockquoteBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}>`)},hSe=/^(?:[ \t]*(?:\n|$))+/,gSe=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,_Se=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,$Y=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,vSe=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,eX=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,tX=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,nX=ZY(tX).replace(/bull/g,eX).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(),ySe=ZY(tX).replace(/bull/g,eX).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(),rX=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,bSe=/^[^\n]+/,iX=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,xSe=ZY(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,iX).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),SSe=ZY(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,eX).getRegex(),aX=`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`,oX=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,CSe=ZY(`^ {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`,oX).replace(`tag`,aX).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),sX=ZY(rX).replace(`hr`,$Y).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[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,aX).getRegex(),cX={blockquote:ZY(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,sX).getRegex(),code:gSe,def:xSe,fences:_Se,heading:vSe,hr:$Y,html:CSe,lheading:nX,list:SSe,newline:hSe,paragraph:sX,table:XY,text:bSe},lX=ZY(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,$Y).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[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,aX).getRegex(),wSe={...cX,lheading:ySe,table:lX,paragraph:ZY(rX).replace(`hr`,$Y).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,lX).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,aX).getRegex()},TSe={...cX,html:ZY(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,oX).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:XY,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ZY(rX).replace(`hr`,$Y).replace(`heading`,` *#{1,6} *[^
|
|
158
|
+
]`).replace(`lheading`,nX).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},ESe=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,DSe=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,uX=/^( {2,}|\\)\n(?!\s*$)/,OSe=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,dX=/[\p{P}\p{S}]/u,fX=/[\s\p{P}\p{S}]/u,pX=/[^\s\p{P}\p{S}]/u,kSe=ZY(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,fX).getRegex(),mX=/(?!~)[\p{P}\p{S}]/u,ASe=/(?!~)[\s\p{P}\p{S}]/u,jSe=/(?:[^\s\p{P}\p{S}]|~)/u,MSe=ZY(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,mSe?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),hX=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,NSe=ZY(hX,`u`).replace(/punct/g,dX).getRegex(),PSe=ZY(hX,`u`).replace(/punct/g,mX).getRegex(),gX=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,FSe=ZY(gX,`gu`).replace(/notPunctSpace/g,pX).replace(/punctSpace/g,fX).replace(/punct/g,dX).getRegex(),ISe=ZY(gX,`gu`).replace(/notPunctSpace/g,jSe).replace(/punctSpace/g,ASe).replace(/punct/g,mX).getRegex(),LSe=ZY(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,pX).replace(/punctSpace/g,fX).replace(/punct/g,dX).getRegex(),RSe=ZY(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,dX).getRegex(),zSe=ZY(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,pX).replace(/punctSpace/g,fX).replace(/punct/g,dX).getRegex(),BSe=ZY(/\\(punct)/,`gu`).replace(/punct/g,dX).getRegex(),VSe=ZY(/^<(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(),HSe=ZY(oX).replace(`(?:-->|$)`,`-->`).getRegex(),USe=ZY(`^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`,HSe).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),_X=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,WSe=ZY(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,_X).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),vX=ZY(/^!?\[(label)\]\[(ref)\]/).replace(`label`,_X).replace(`ref`,iX).getRegex(),yX=ZY(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,iX).getRegex(),GSe=ZY(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,vX).replace(`nolink`,yX).getRegex(),bX=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,xX={_backpedal:XY,anyPunctuation:BSe,autolink:VSe,blockSkip:MSe,br:uX,code:DSe,del:XY,delLDelim:XY,delRDelim:XY,emStrongLDelim:NSe,emStrongRDelimAst:FSe,emStrongRDelimUnd:LSe,escape:ESe,link:WSe,nolink:yX,punctuation:kSe,reflink:vX,reflinkSearch:GSe,tag:USe,text:OSe,url:XY},KSe={...xX,link:ZY(/^!?\[(label)\]\((.*?)\)/).replace(`label`,_X).getRegex(),reflink:ZY(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,_X).getRegex()},SX={...xX,emStrongRDelimAst:ISe,emStrongLDelim:PSe,delLDelim:RSe,delRDelim:zSe,url:ZY(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,bX).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\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:ZY(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,bX).getRegex()},qSe={...SX,br:ZY(uX).replace(`{2,}`,`*`).getRegex(),text:ZY(SX.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},CX={normal:cX,gfm:wSe,pedantic:TSe},wX={normal:xX,gfm:SX,breaks:qSe,pedantic:KSe},JSe={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},TX=e=>JSe[e];function EX(e,t){if(t){if(QY.escapeTest.test(e))return e.replace(QY.escapeReplace,TX)}else if(QY.escapeTestNoEncode.test(e))return e.replace(QY.escapeReplaceNoEncode,TX);return e}function DX(e){try{e=encodeURI(e).replace(QY.percentDecode,`%`)}catch{return null}return e}function OX(e,t){let n=e.replace(QY.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(QY.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(QY.slashPipe,`|`);return n}function kX(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 YSe(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 XSe(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function AX(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 ZSe(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
159
|
+
`).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(`
|
|
160
|
+
`)}var jX=class{options;rules;lexer;constructor(e){this.options=e||JY}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:kX(e,`
|
|
161
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=ZSe(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=kX(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:kX(t[0],`
|
|
162
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=kX(t[0],`
|
|
163
|
+
`).split(`
|
|
164
|
+
`),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(`
|
|
165
|
+
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
166
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
167
|
+
${s}`:s,r=r?`${r}
|
|
168
|
+
${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+`
|
|
169
|
+
`+e.join(`
|
|
170
|
+
`),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+`
|
|
171
|
+
`+e.join(`
|
|
172
|
+
`),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(`
|
|
173
|
+
`);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=XSe(t[2].split(`
|
|
174
|
+
`,1)[0],t[1].length),l=e.split(`
|
|
175
|
+
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.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+`
|
|
176
|
+
`,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),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
|
|
177
|
+
`,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
|
|
178
|
+
`+m.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+=`
|
|
179
|
+
`+l}u=!l.trim(),r+=p+`
|
|
180
|
+
`,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),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 of i.items){if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),e.task){if(e.text=e.text.replace(this.rules.other.listReplaceTask,``),e.tokens[0]?.type===`text`||e.tokens[0]?.type===`paragraph`){e.tokens[0].raw=e.tokens[0].raw.replace(this.rules.other.listReplaceTask,``),e.tokens[0].text=e.tokens[0].text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}}let t=this.rules.other.listTaskCheckbox.exec(e.raw);if(t){let n={type:`checkbox`,raw:t[0]+` `,checked:t[0]!==`[ ]`};e.checked=n.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=n.raw+e.tokens[0].raw,e.tokens[0].text=n.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(n)):e.tokens.unshift({type:`paragraph`,raw:n.raw,text:n.raw,tokens:[n]}):e.tokens.unshift(n)}}if(!i.loose){let t=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 of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}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=OX(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
181
|
+
`):[],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(OX(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){let e=t[1].trim();return{type:`heading`,raw:t[0],depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
182
|
+
`?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=kX(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=YSe(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)),AX(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 AX(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!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,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}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}}}},MX=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||JY,this.options.tokenizer=this.options.tokenizer||new jX,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:QY,block:CX.normal,inline:wX.normal};this.options.pedantic?(t.block=CX.pedantic,t.inline=wX.pedantic):this.options.gfm&&(t.block=CX.gfm,this.options.breaks?t.inline=wX.breaks:t.inline=wX.gfm),this.tokenizer.rules=t}static get rules(){return{block:CX,inline:wX}}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(QY.carriageReturn,`
|
|
183
|
+
`),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.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(QY.tabCharGlobal,` `).replace(QY.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+=`
|
|
184
|
+
`: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+=(n.raw.endsWith(`
|
|
185
|
+
`)?``:`
|
|
186
|
+
`)+r.raw,n.text+=`
|
|
187
|
+
`+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+=(n.raw.endsWith(`
|
|
188
|
+
`)?``:`
|
|
189
|
+
`)+r.raw,n.text+=`
|
|
190
|
+
`+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},t.push(r));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+=(a.raw.endsWith(`
|
|
191
|
+
`)?``:`
|
|
192
|
+
`)+r.raw,a.text+=`
|
|
193
|
+
`+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+=(n.raw.endsWith(`
|
|
194
|
+
`)?``:`
|
|
195
|
+
`)+r.raw,n.text+=`
|
|
196
|
+
`+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=[]){this.tokenizer.lexer=this;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);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``;for(;e;){a||(o=``),a=!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,o)){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,n,o)){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 i=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&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!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}},NX=class{options;parser;constructor(e){this.options=e||JY}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(QY.notSpaceStart)?.[0],i=e.replace(QY.endingNewline,``)+`
|
|
197
|
+
`;return r?`<pre><code class="language-`+EX(r)+`">`+(n?i:EX(i,!0))+`</code></pre>
|
|
198
|
+
`:`<pre><code>`+(n?i:EX(i,!0))+`</code></pre>
|
|
199
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
200
|
+
${this.parser.parse(e)}</blockquote>
|
|
201
|
+
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
202
|
+
`}hr(e){return`<hr>
|
|
203
|
+
`}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+`>
|
|
204
|
+
`+r+`</`+i+`>
|
|
205
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
206
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
207
|
+
`}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>
|
|
208
|
+
<thead>
|
|
209
|
+
`+t+`</thead>
|
|
210
|
+
`+r+`</table>
|
|
211
|
+
`}tablerow({text:e}){return`<tr>
|
|
212
|
+
${e}</tr>
|
|
213
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
214
|
+
`}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>${EX(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=DX(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+EX(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=DX(e);if(i===null)return EX(n);e=i;let a=`<img src="${e}" alt="${EX(n)}"`;return t&&(a+=` title="${EX(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:EX(e.text)}},PX=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``}checkbox({raw:e}){return e}},FX=class e{options;renderer;textRenderer;constructor(e){this.options=e||JY,this.options.renderer=this.options.renderer||new NX,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new PX}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;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`checkbox`:n+=t.checkbox(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}},IX=class{options;block;constructor(e){this.options=e||JY}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?MX.lex:MX.lexInline}provideParser(e=this.block){return e?FX.parse:FX.parseInline}},LX=new class{defaults=qY();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=FX;Renderer=NX;TextRenderer=PX;Lexer=MX;Tokenizer=jX;Hooks=IX;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 NX(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 jX(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 IX;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];IX.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&IX.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();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 MX.lex(e,t??this.defaults)}parser(e,t){return FX.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(typeof t>`u`||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`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?MX.lex:MX.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?FX.parse:FX.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?MX.lex:MX.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?FX.parse:FX.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
215
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+EX(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function RX(e,t){return LX.parse(e,t)}RX.options=RX.setOptions=function(e){return LX.setOptions(e),RX.defaults=LX.defaults,YY(RX.defaults),RX},RX.getDefaults=qY,RX.defaults=JY,RX.use=function(...e){return LX.use(...e),RX.defaults=LX.defaults,YY(RX.defaults),RX},RX.walkTokens=function(e,t){return LX.walkTokens(e,t)},RX.parseInline=LX.parseInline,RX.Parser=FX,RX.parser=FX.parse,RX.Renderer=NX,RX.TextRenderer=PX,RX.Lexer=MX,RX.lexer=MX.lex,RX.Tokenizer=jX,RX.Hooks=IX,RX.parse=RX,RX.options,RX.setOptions,RX.use,RX.walkTokens,RX.parseInline,FX.parse,MX.lex;var QSe=`modulepreload`,$Se=function(e){return`/`+e},zX={},BX=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=$Se(t,n),t in zX)return;zX[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:QSe,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},eCe=300,tCe=`300px`,nCe=500;function rCe(e={}){let{immediate:t=!1,debounceDelay:n=eCe,rootMargin:r=tCe,idleTimeout:i=nCe}=e,[a,o]=(0,z.useState)(!1),s=(0,z.useRef)(null),c=(0,z.useRef)(null),l=(0,z.useRef)(null),u=(0,z.useMemo)(()=>e=>{let t=Date.now();return window.setTimeout(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-t))})},1)},[]),d=(0,z.useMemo)(()=>typeof window<`u`&&window.requestIdleCallback?(e,t)=>window.requestIdleCallback(e,t):u,[u]),f=(0,z.useMemo)(()=>typeof window<`u`&&window.cancelIdleCallback?e=>window.cancelIdleCallback(e):e=>{clearTimeout(e)},[]);return(0,z.useEffect)(()=>{if(t){o(!0);return}let e=s.current;if(!e)return;c.current&&=(clearTimeout(c.current),null),l.current&&=(f(l.current),null);let a=()=>{c.current&&=(clearTimeout(c.current),null),l.current&&=(f(l.current),null)},u=e=>{l.current=d(t=>{t.timeRemaining()>0||t.didTimeout?(o(!0),e.disconnect()):l.current=d(()=>{o(!0),e.disconnect()},{timeout:i/2})},{timeout:i})},p=e=>{a(),c.current=window.setTimeout(()=>{var t;let n=e.takeRecords();(n.length===0||(t=n.at(-1)?.isIntersecting)!=null&&t)&&u(e)},n)},m=(e,t)=>{e.isIntersecting?p(t):a()},h=new IntersectionObserver(e=>{for(let t of e)m(t,h)},{rootMargin:r,threshold:0});return h.observe(e),()=>{c.current&&clearTimeout(c.current),l.current&&f(l.current),h.disconnect()}},[t,n,r,i,f,d]),{shouldRender:a,containerRef:s}}var VX=/\s/,iCe=/^\s+$/,aCe=new Set([`code`,`pre`,`svg`,`math`,`annotation`]),oCe=e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`element`,sCe=e=>e.some(e=>oCe(e)&&aCe.has(e.tagName)),cCe=e=>{let t=[],n=``,r=!1;for(let i of e){let e=VX.test(i);e!==r&&n&&(t.push(n),n=``),n+=i,r=e}return n&&t.push(n),t},lCe=e=>{let t=[],n=``;for(let r of e)VX.test(r)?n+=r:(n&&=(t.push(n),``),t.push(r));return n&&t.push(n),t},uCe=(e,t,n,r,i,a)=>{let o=`--sd-animation:sd-${t};--sd-duration:${i?0:n}ms;--sd-easing:${r}`;return a&&(o+=`;--sd-delay:${a}ms`),{type:`element`,tagName:`span`,properties:{"data-sd-animate":!0,style:o},children:[{type:`text`,value:e}]}},dCe=(e,t,n,r,i)=>{let a=t.at(-1);if(!(a&&`children`in a))return;if(sCe(t))return _B;let o=a,s=o.children.indexOf(e);if(s===-1)return;let c=e.value;if(!c.trim()){i.count+=c.length;return}let l=n.sep===`char`?lCe(c):cCe(c),u=r.prevContentLength,d=l.map(e=>{let t=i.count;if(i.count+=e.length,iCe.test(e))return{type:`text`,value:e};let r=u>0&&t<u,a=r?0:i.newIndex++*n.stagger;return uCe(e,n.animation,n.duration,n.easing,r,a)});return o.children.splice(s,1,...d),s+d.length},fCe=0;function HX(e){let t={animation:e?.animation??`fadeIn`,duration:e?.duration??150,easing:e?.easing??`ease`,sep:e?.sep??`word`,stagger:e?.stagger??40},n={prevContentLength:0,lastRenderCharCount:0},r=fCe++,i=()=>e=>{let r={count:0,newIndex:0};vB(e,`text`,(e,i)=>dCe(e,i,t,n,r)),n.lastRenderCharCount=r.count,n.prevContentLength=0};return Object.defineProperty(i,"name",{value:`rehypeAnimate$${r}`}),{name:`animate`,type:`animate`,rehypePlugin:i,setPrevContentLength(e){n.prevContentLength=e},getLastRenderCharCount(){let e=n.lastRenderCharCount;return n.lastRenderCharCount=0,e}}}HX();var UX=(0,z.createContext)(!1),pCe=()=>(0,z.useContext)(UX),WX=(...e)=>c(i(e)),mCe=(e,t)=>{if(!e||!t)return t;let n=`${e}:`;return t.split(/\s+/).filter(Boolean).map(t=>t.startsWith(n)?t:`${e}:${t}`).join(` `)},hCe=e=>e?(...t)=>mCe(e,c(i(t))):WX,GX=(e,t,n)=>{let r=typeof t==`string`&&n.startsWith(`text/csv`)?``:``,i=typeof t==`string`?new Blob([r+t],{type:n}):t,a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=e,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a)},KX=(0,z.createContext)(WX),qX=()=>(0,z.useContext)(KX),gCe=WX(`block`,`before:content-[counter(line)]`,`before:inline-block`,`before:[counter-increment:line]`,`before:w-6`,`before:mr-4`,`before:text-[13px]`,`before:text-right`,`before:text-muted-foreground/50`,`before:font-mono`,`before:select-none`),_Ce=e=>{let t={};for(let n of e.split(`;`)){let e=n.indexOf(`:`);if(e>0){let r=n.slice(0,e).trim(),i=n.slice(e+1).trim();r&&i&&(t[r]=i)}}return t},JX=(0,z.memo)(({children:e,result:t,language:n,className:r,startLine:i,lineNumbers:a=!0,...o})=>{let s=qX(),c=(0,z.useMemo)(()=>s(gCe),[s]),l=(0,z.useMemo)(()=>{let e={};return t.bg&&(e[`--sdm-bg`]=t.bg),t.fg&&(e[`--sdm-fg`]=t.fg),t.rootStyle&&Object.assign(e,_Ce(t.rootStyle)),e},[t.bg,t.fg,t.rootStyle]);return(0,B.jsx)(`div`,{className:s(r,`overflow-x-auto rounded-md border border-border bg-background p-4 text-sm`),"data-language":n,"data-streamdown":`code-block-body`,...o,children:(0,B.jsx)(`pre`,{className:s(r,`bg-[var(--sdm-bg,inherit]`,`dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit)]`),style:l,children:(0,B.jsx)(`code`,{className:a?s(`[counter-increment:line_0] [counter-reset:line]`):void 0,style:a&&i&&i>1?{counterReset:`line ${i-1}`}:void 0,children:t.tokens.map((e,t)=>(0,B.jsx)(`span`,{className:a?c:void 0,children:e.length===0||e.length===1&&e[0].content===``?`
|
|
216
|
+
`:e.map((e,t)=>{let n={},r=!!e.bgColor;if(e.color&&(n[`--sdm-c`]=e.color),e.bgColor&&(n[`--sdm-tbg`]=e.bgColor),e.htmlStyle)for(let[t,i]of Object.entries(e.htmlStyle))t===`color`?n[`--sdm-c`]=i:t===`background-color`?(n[`--sdm-tbg`]=i,r=!0):n[t]=i;return(0,B.jsx)(`span`,{className:s(`text-[var(--sdm-c,inherit)]`,`dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]`,r&&`bg-[var(--sdm-tbg)]`,r&&`dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]`),style:n,...e.htmlAttrs,children:e.content},t)})},t))})})})},(e,t)=>e.result===t.result&&e.language===t.language&&e.className===t.className&&e.startLine===t.startLine&&e.lineNumbers===t.lineNumbers),vCe=({className:e,language:t,style:n,isIncomplete:r,...i})=>(0,B.jsx)(`div`,{className:qX()(`my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,e),"data-incomplete":r||void 0,"data-language":t,"data-streamdown":`code-block`,style:{contentVisibility:`auto`,containIntrinsicSize:`auto 200px`,...n},...i}),YX=(0,z.createContext)({code:``}),XX=()=>(0,z.useContext)(YX),yCe=({language:e})=>{let t=qX();return(0,B.jsx)(`div`,{className:t(`flex h-8 items-center text-muted-foreground text-xs`),"data-language":e,"data-streamdown":`code-block-header`,children:(0,B.jsx)(`span`,{className:t(`ml-1 font-mono lowercase`),children:e})})},bCe=e=>{let t=e.length;for(;t>0&&e[t-1]===`
|
|
217
|
+
`;)t--;return e.slice(0,t)},xCe=(0,z.lazy)(()=>BX(()=>import(`./highlighted-body-OFNGDK62-rit1TAaB.js`).then(e=>({default:e.HighlightedCodeBlockBody})),__vite__mapDeps([0,1]))),SCe=({code:e,language:t,className:n,children:r,isIncomplete:i=!1,startLine:a,lineNumbers:o,...s})=>{let c=qX(),l=(0,z.useMemo)(()=>bCe(e),[e]),u=(0,z.useMemo)(()=>({bg:`transparent`,fg:`inherit`,tokens:l.split(`
|
|
218
|
+
`).map(e=>[{content:e,color:`inherit`,bgColor:`transparent`,htmlStyle:{},offset:0}])}),[l]);return(0,B.jsx)(YX.Provider,{value:{code:e},children:(0,B.jsxs)(vCe,{isIncomplete:i,language:t,children:[(0,B.jsx)(yCe,{language:t}),r?(0,B.jsx)(`div`,{className:c(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,B.jsx)(`div`,{className:c(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`code-block-actions`,children:r})}):null,(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(JX,{className:n,language:t,lineNumbers:o,result:u,startLine:a,...s}),children:(0,B.jsx)(xCe,{className:n,code:l,language:t,lineNumbers:o,raw:u,startLine:a,...s})})]})})},ZX={CheckIcon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M15.5607 3.99999L15.0303 4.53032L6.23744 13.3232C5.55403 14.0066 4.44599 14.0066 3.76257 13.3232L4.2929 12.7929L3.76257 13.3232L0.969676 10.5303L0.439346 9.99999L1.50001 8.93933L2.03034 9.46966L4.82323 12.2626C4.92086 12.3602 5.07915 12.3602 5.17678 12.2626L13.9697 3.46966L14.5 2.93933L15.5607 3.99999Z`,fill:`currentColor`,fillRule:`evenodd`})}),CopyIcon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M2.75 0.5C1.7835 0.5 1 1.2835 1 2.25V9.75C1 10.7165 1.7835 11.5 2.75 11.5H3.75H4.5V10H3.75H2.75C2.61193 10 2.5 9.88807 2.5 9.75V2.25C2.5 2.11193 2.61193 2 2.75 2H8.25C8.38807 2 8.5 2.11193 8.5 2.25V3H10V2.25C10 1.2835 9.2165 0.5 8.25 0.5H2.75ZM7.75 4.5C6.7835 4.5 6 5.2835 6 6.25V13.75C6 14.7165 6.7835 15.5 7.75 15.5H13.25C14.2165 15.5 15 14.7165 15 13.75V6.25C15 5.2835 14.2165 4.5 13.25 4.5H7.75ZM7.5 6.25C7.5 6.11193 7.61193 6 7.75 6H13.25C13.3881 6 13.5 6.11193 13.5 6.25V13.75C13.5 13.8881 13.3881 14 13.25 14H7.75C7.61193 14 7.5 13.8881 7.5 13.75V6.25Z`,fill:`currentColor`,fillRule:`evenodd`})}),DownloadIcon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M8.75 1V1.75V8.68934L10.7197 6.71967L11.25 6.18934L12.3107 7.25L11.7803 7.78033L8.70711 10.8536C8.31658 11.2441 7.68342 11.2441 7.29289 10.8536L4.21967 7.78033L3.68934 7.25L4.75 6.18934L5.28033 6.71967L7.25 8.68934V1.75V1H8.75ZM13.5 9.25V13.5H2.5V9.25V8.5H1V9.25V14C1 14.5523 1.44771 15 2 15H14C14.5523 15 15 14.5523 15 14V9.25V8.5H13.5V9.25Z`,fill:`currentColor`,fillRule:`evenodd`})}),ExternalLinkIcon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M13.5 10.25V13.25C13.5 13.3881 13.3881 13.5 13.25 13.5H2.75C2.61193 13.5 2.5 13.3881 2.5 13.25L2.5 2.75C2.5 2.61193 2.61193 2.5 2.75 2.5H5.75H6.5V1H5.75H2.75C1.7835 1 1 1.7835 1 2.75V13.25C1 14.2165 1.7835 15 2.75 15H13.25C14.2165 15 15 14.2165 15 13.25V10.25V9.5H13.5V10.25ZM9 1H9.75H14.2495C14.6637 1 14.9995 1.33579 14.9995 1.75V6.25V7H13.4995V6.25V3.56066L8.53033 8.52978L8 9.06011L6.93934 7.99945L7.46967 7.46912L12.4388 2.5H9.75H9V1Z`,fill:`currentColor`,fillRule:`evenodd`})}),Loader2Icon:e=>(0,B.jsxs)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:[(0,B.jsx)(`path`,{d:`M8 0V4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M8 16V12`,opacity:`0.5`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M3.29773 1.52783L5.64887 4.7639`,opacity:`0.9`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M12.7023 1.52783L10.3511 4.7639`,opacity:`0.1`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M12.7023 14.472L10.3511 11.236`,opacity:`0.4`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M3.29773 14.472L5.64887 11.236`,opacity:`0.6`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M15.6085 5.52783L11.8043 6.7639`,opacity:`0.2`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M0.391602 10.472L4.19583 9.23598`,opacity:`0.7`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M15.6085 10.4722L11.8043 9.2361`,opacity:`0.3`,stroke:`currentColor`,strokeWidth:`1.5`}),(0,B.jsx)(`path`,{d:`M0.391602 5.52783L4.19583 6.7639`,opacity:`0.8`,stroke:`currentColor`,strokeWidth:`1.5`})]}),Maximize2Icon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M1 5.25V6H2.5V5.25V2.5H5.25H6V1H5.25H2C1.44772 1 1 1.44772 1 2V5.25ZM5.25 14.9994H6V13.4994H5.25H2.5V10.7494V9.99939H1V10.7494V13.9994C1 14.5517 1.44772 14.9994 2 14.9994H5.25ZM15 10V10.75V14C15 14.5523 14.5523 15 14 15H10.75H10V13.5H10.75H13.5V10.75V10H15ZM10.75 1H10V2.5H10.75H13.5V5.25V6H15V5.25V2C15 1.44772 14.5523 1 14 1H10.75Z`,fill:`currentColor`,fillRule:`evenodd`})}),RotateCcwIcon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M13.5 8C13.5 4.96643 11.0257 2.5 7.96452 2.5C5.42843 2.5 3.29365 4.19393 2.63724 6.5H5.25H6V8H5.25H0.75C0.335787 8 0 7.66421 0 7.25V2.75V2H1.5V2.75V5.23347C2.57851 2.74164 5.06835 1 7.96452 1C11.8461 1 15 4.13001 15 8C15 11.87 11.8461 15 7.96452 15C5.62368 15 3.54872 13.8617 2.27046 12.1122L1.828 11.5066L3.03915 10.6217L3.48161 11.2273C4.48831 12.6051 6.12055 13.5 7.96452 13.5C11.0257 13.5 13.5 11.0336 13.5 8Z`,fill:`currentColor`,fillRule:`evenodd`})}),XIcon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M12.4697 13.5303L13 14.0607L14.0607 13L13.5303 12.4697L9.06065 7.99999L13.5303 3.53032L14.0607 2.99999L13 1.93933L12.4697 2.46966L7.99999 6.93933L3.53032 2.46966L2.99999 1.93933L1.93933 2.99999L2.46966 3.53032L6.93933 7.99999L2.46966 12.4697L1.93933 13L2.99999 14.0607L3.53032 13.5303L7.99999 9.06065L12.4697 13.5303Z`,fill:`currentColor`,fillRule:`evenodd`})}),ZoomInIcon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H5.875V4.75V4.125H7.125V4.75V5.875H8.25H8.875V7.125H8.25H7.125V8.25V8.875H5.875V8.25V7.125H4.75H4.125V5.875Z`,fill:`currentColor`,fillRule:`evenodd`})}),ZoomOutIcon:e=>(0,B.jsx)(`svg`,{color:`currentColor`,height:16,strokeLinejoin:`round`,viewBox:`0 0 16 16`,width:16,...e,children:(0,B.jsx)(`path`,{clipRule:`evenodd`,d:`M1.5 6.5C1.5 3.73858 3.73858 1.5 6.5 1.5C9.26142 1.5 11.5 3.73858 11.5 6.5C11.5 9.26142 9.26142 11.5 6.5 11.5C3.73858 11.5 1.5 9.26142 1.5 6.5ZM6.5 0C2.91015 0 0 2.91015 0 6.5C0 10.0899 2.91015 13 6.5 13C8.02469 13 9.42677 12.475 10.5353 11.596L13.9697 15.0303L14.5 15.5607L15.5607 14.5L15.0303 13.9697L11.596 10.5353C12.475 9.42677 13 8.02469 13 6.5C13 2.91015 10.0899 0 6.5 0ZM4.125 5.875H4.75H8.25H8.875V7.125H8.25H4.75H4.125V5.875Z`,fill:`currentColor`,fillRule:`evenodd`})})},QX=(0,z.createContext)(ZX),CCe=(e,t)=>{if(e===t)return!0;if(!(e&&t))return e===t;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length?n.every(n=>e[n]===t[n]):!1},$X=({icons:e,children:t})=>{let n=(0,z.useRef)(e),r=(0,z.useRef)(e?{...ZX,...e}:ZX);CCe(n.current,e)||(n.current=e,r.current=e?{...ZX,...e}:ZX);let i=r.current;return(0,B.jsx)(QX.Provider,{value:i,children:t})},eZ=()=>(0,z.useContext)(QX),tZ={copyCode:`Copy Code`,downloadFile:`Download file`,downloadDiagram:`Download diagram`,downloadDiagramAsSvg:`Download diagram as SVG`,downloadDiagramAsPng:`Download diagram as PNG`,downloadDiagramAsMmd:`Download diagram as MMD`,viewFullscreen:`View fullscreen`,exitFullscreen:`Exit fullscreen`,mermaidFormatSvg:`SVG`,mermaidFormatPng:`PNG`,mermaidFormatMmd:`MMD`,copyTable:`Copy table`,copyTableAsMarkdown:`Copy table as Markdown`,copyTableAsCsv:`Copy table as CSV`,copyTableAsTsv:`Copy table as TSV`,downloadTable:`Download table`,downloadTableAsCsv:`Download table as CSV`,downloadTableAsMarkdown:`Download table as Markdown`,tableFormatMarkdown:`Markdown`,tableFormatCsv:`CSV`,tableFormatTsv:`TSV`,imageNotAvailable:`Image not available`,downloadImage:`Download image`,openExternalLink:`Open external link?`,externalLinkWarning:`You're about to visit an external website.`,close:`Close`,copyLink:`Copy link`,copied:`Copied`,openLink:`Open link`},nZ=(0,z.createContext)(tZ),rZ=()=>(0,z.useContext)(nZ),iZ=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,code:a,...o})=>{let s=qX(),[c,l]=(0,z.useState)(!1),u=(0,z.useRef)(0),{code:d}=XX(),{isAnimating:f}=(0,z.useContext)(pQ),p=rZ(),m=a??d,h=async()=>{var r;if(typeof window>`u`||!((r=navigator==null?void 0:navigator.clipboard)!=null&&r.writeText)){t?.(Error(`Clipboard API not available`));return}try{c||(await navigator.clipboard.writeText(m),l(!0),e?.(),u.current=window.setTimeout(()=>l(!1),n))}catch(e){t?.(e)}};(0,z.useEffect)(()=>()=>{window.clearTimeout(u.current)},[]);let g=eZ(),_=c?g.CheckIcon:g.CopyIcon;return(0,B.jsx)(`button`,{className:s(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),"data-streamdown":`code-block-copy-button`,disabled:f,onClick:h,title:p.copyCode,type:`button`,...o,children:r??(0,B.jsx)(_,{size:14})})},aZ={"1c":`1c`,"1c-query":`1cq`,abap:`abap`,"actionscript-3":`as`,ada:`ada`,adoc:`adoc`,"angular-html":`html`,"angular-ts":`ts`,apache:`conf`,apex:`cls`,apl:`apl`,applescript:`applescript`,ara:`ara`,asciidoc:`adoc`,asm:`asm`,astro:`astro`,awk:`awk`,ballerina:`bal`,bash:`sh`,bat:`bat`,batch:`bat`,be:`be`,beancount:`beancount`,berry:`berry`,bibtex:`bib`,bicep:`bicep`,blade:`blade.php`,bsl:`bsl`,c:`c`,"c#":`cs`,"c++":`cpp`,cadence:`cdc`,cairo:`cairo`,cdc:`cdc`,clarity:`clar`,clj:`clj`,clojure:`clj`,"closure-templates":`soy`,cmake:`cmake`,cmd:`cmd`,cobol:`cob`,codeowners:`CODEOWNERS`,codeql:`ql`,coffee:`coffee`,coffeescript:`coffee`,"common-lisp":`lisp`,console:`sh`,coq:`v`,cpp:`cpp`,cql:`cql`,crystal:`cr`,cs:`cs`,csharp:`cs`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cql`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,docker:`dockerfile`,dockerfile:`dockerfile`,dotenv:`env`,"dream-maker":`dm`,edge:`edge`,elisp:`el`,elixir:`ex`,elm:`elm`,"emacs-lisp":`el`,erb:`erb`,erl:`erl`,erlang:`erl`,f:`f`,"f#":`fs`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`f90`,f95:`f95`,fennel:`fnl`,fish:`fish`,fluent:`ftl`,for:`for`,"fortran-fixed-form":`f`,"fortran-free-form":`f90`,fs:`fs`,fsharp:`fs`,fsl:`fsl`,ftl:`ftl`,gdresource:`tres`,gdscript:`gd`,gdshader:`gdshader`,genie:`gs`,gherkin:`feature`,"git-commit":`gitcommit`,"git-rebase":`gitrebase`,gjs:`js`,gleam:`gleam`,"glimmer-js":`js`,"glimmer-ts":`ts`,glsl:`glsl`,gnuplot:`plt`,go:`go`,gql:`gql`,graphql:`graphql`,groovy:`groovy`,gts:`gts`,hack:`hack`,haml:`haml`,handlebars:`hbs`,haskell:`hs`,haxe:`hx`,hbs:`hbs`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,hs:`hs`,html:`html`,"html-derivative":`html`,http:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,jade:`jade`,java:`java`,javascript:`js`,jinja:`jinja`,jison:`jison`,jl:`jl`,js:`js`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,julia:`jl`,kotlin:`kt`,kql:`kql`,kt:`kt`,kts:`kts`,kusto:`kql`,latex:`tex`,lean:`lean`,lean4:`lean`,less:`less`,liquid:`liquid`,lisp:`lisp`,lit:`lit`,llvm:`ll`,log:`log`,logo:`logo`,lua:`lua`,luau:`luau`,make:`mak`,makefile:`mak`,markdown:`md`,marko:`marko`,matlab:`m`,md:`md`,mdc:`mdc`,mdx:`mdx`,mediawiki:`wiki`,mermaid:`mmd`,mips:`s`,mipsasm:`s`,mmd:`mmd`,mojo:`mojo`,move:`move`,nar:`nar`,narrat:`narrat`,nextflow:`nf`,nf:`nf`,nginx:`conf`,nim:`nim`,nix:`nix`,nu:`nu`,nushell:`nu`,objc:`m`,"objective-c":`m`,"objective-cpp":`mm`,ocaml:`ml`,pascal:`pas`,perl:`pl`,perl6:`p6`,php:`php`,plsql:`pls`,po:`po`,polar:`polar`,postcss:`pcss`,pot:`pot`,potx:`potx`,powerquery:`pq`,powershell:`ps1`,prisma:`prisma`,prolog:`pl`,properties:`properties`,proto:`proto`,protobuf:`proto`,ps:`ps`,ps1:`ps1`,pug:`pug`,puppet:`pp`,purescript:`purs`,py:`py`,python:`py`,ql:`ql`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,racket:`rkt`,raku:`raku`,razor:`cshtml`,rb:`rb`,reg:`reg`,regex:`regex`,regexp:`regexp`,rel:`rel`,riscv:`s`,rs:`rs`,rst:`rst`,ruby:`rb`,rust:`rs`,sas:`sas`,sass:`sass`,scala:`scala`,scheme:`scm`,scss:`scss`,sdbl:`sdbl`,sh:`sh`,shader:`shader`,shaderlab:`shader`,shell:`sh`,shellscript:`sh`,shellsession:`sh`,smalltalk:`st`,solidity:`sol`,soy:`soy`,sparql:`rq`,spl:`spl`,splunk:`spl`,sql:`sql`,"ssh-config":`config`,stata:`do`,styl:`styl`,stylus:`styl`,svelte:`svelte`,swift:`swift`,"system-verilog":`sv`,systemd:`service`,talon:`talon`,talonscript:`talon`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,terraform:`tf`,tex:`tex`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`ts`,"ts-tags":`ts`,tsp:`tsp`,tsv:`tsv`,tsx:`tsx`,turtle:`ttl`,twig:`twig`,typ:`typ`,typescript:`ts`,typespec:`tsp`,typst:`typ`,v:`v`,vala:`vala`,vb:`vb`,verilog:`v`,vhdl:`vhdl`,vim:`vim`,viml:`vim`,vimscript:`vim`,vue:`vue`,"vue-html":`html`,"vue-vine":`vine`,vy:`vy`,vyper:`vy`,wasm:`wasm`,wenyan:`wy`,wgsl:`wgsl`,wiki:`wiki`,wikitext:`wiki`,wit:`wit`,wl:`wl`,wolfram:`wl`,xml:`xml`,xsl:`xsl`,yaml:`yaml`,yml:`yml`,zenscript:`zs`,zig:`zig`,zsh:`zsh`,文言:`wy`},wCe=({onDownload:e,onError:t,language:n,children:r,className:i,code:a,...o})=>{let s=qX(),{code:c}=XX(),{isAnimating:l}=(0,z.useContext)(pQ),u=rZ(),d=eZ(),f=a??c,p=`file.${n&&n in aZ?aZ[n]:`txt`}`;return(0,B.jsx)(`button`,{className:s(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),"data-streamdown":`code-block-download-button`,disabled:l,onClick:()=>{try{GX(p,f,`text/plain`),e?.()}catch(e){t?.(e)}},title:u.downloadFile,type:`button`,...o,children:r??(0,B.jsx)(d.DownloadIcon,{size:14})})},oZ=()=>{let{Loader2Icon:e}=eZ(),t=qX();return(0,B.jsxs)(`div`,{className:t(`w-full divide-y divide-border overflow-hidden rounded-xl border border-border`),children:[(0,B.jsx)(`div`,{className:t(`h-[46px] w-full bg-muted/80`)}),(0,B.jsx)(`div`,{className:t(`flex w-full items-center justify-center p-4`),children:(0,B.jsx)(e,{className:t(`size-4 animate-spin`)})})]})},TCe=/\.[^/.]+$/,ECe=({node:e,className:t,src:n,alt:r,onLoad:i,onError:a,...o})=>{let{DownloadIcon:s}=eZ(),c=qX(),l=(0,z.useRef)(null),[u,d]=(0,z.useState)(!1),[f,p]=(0,z.useState)(!1),m=rZ(),h=o.width!=null||o.height!=null,g=(u||h)&&!f,_=f&&!h;(0,z.useEffect)(()=>{let e=l.current;if(e!=null&&e.complete){let t=e.naturalWidth>0;d(t),p(!t)}},[]);let v=(0,z.useCallback)(e=>{d(!0),p(!1),i?.(e)},[i]),y=(0,z.useCallback)(e=>{d(!1),p(!0),a?.(e)},[a]),b=async()=>{if(n)try{let e=await(await fetch(n)).blob(),t=new URL(n,window.location.origin).pathname.split(`/`).pop()||``,i=t.split(`.`).pop(),a=t.includes(`.`)&&i!==void 0&&i.length<=4,o=``;if(a)o=t;else{let n=e.type,i=`png`;n.includes(`jpeg`)||n.includes(`jpg`)?i=`jpg`:n.includes(`png`)?i=`png`:n.includes(`svg`)?i=`svg`:n.includes(`gif`)?i=`gif`:n.includes(`webp`)&&(i=`webp`),o=`${(r||t||`image`).replace(TCe,``)}.${i}`}GX(o,e,e.type)}catch{window.open(n,`_blank`)}};return n?(0,B.jsxs)(`div`,{className:c(`group relative my-4 inline-block`),"data-streamdown":`image-wrapper`,children:[(0,B.jsx)(`img`,{alt:r,className:c(`max-w-full rounded-lg`,_&&`hidden`,t),"data-streamdown":`image`,onError:y,onLoad:v,ref:l,src:n,...o}),_&&(0,B.jsx)(`span`,{className:c(`text-muted-foreground text-xs italic`),"data-streamdown":`image-fallback`,children:m.imageNotAvailable}),(0,B.jsx)(`div`,{className:c(`pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block`)}),g&&(0,B.jsx)(`button`,{className:c(`absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background`,`opacity-0 group-hover:opacity-100`),onClick:b,title:m.downloadImage,type:`button`,children:(0,B.jsx)(s,{size:14})})]}):null},sZ=0,cZ=()=>{sZ+=1,sZ===1&&(document.body.style.overflow=`hidden`)},lZ=()=>{sZ=Math.max(0,sZ-1),sZ===0&&(document.body.style.overflow=``)},DCe=({url:e,isOpen:t,onClose:n,onConfirm:r})=>{let{CheckIcon:i,CopyIcon:a,ExternalLinkIcon:o,XIcon:s}=eZ(),c=qX(),[l,u]=(0,z.useState)(!1),d=rZ(),f=(0,z.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),u(!0),setTimeout(()=>u(!1),2e3)}catch{}},[e]),p=(0,z.useCallback)(()=>{r(),n()},[r,n]);return(0,z.useEffect)(()=>{if(t){cZ();let e=e=>{e.key===`Escape`&&n()};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),lZ()}}},[t,n]),t?(0,B.jsx)(`div`,{className:c(`fixed inset-0 z-50 flex items-center justify-center bg-background/50 backdrop-blur-sm`),"data-streamdown":`link-safety-modal`,onClick:n,onKeyDown:e=>{e.key===`Escape`&&n()},role:`button`,tabIndex:0,children:(0,B.jsxs)(`div`,{className:c(`relative mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border bg-background p-6 shadow-lg`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,B.jsx)(`button`,{className:c(`absolute top-4 right-4 rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:n,title:d.close,type:`button`,children:(0,B.jsx)(s,{size:16})}),(0,B.jsxs)(`div`,{className:c(`flex flex-col gap-2`),children:[(0,B.jsxs)(`div`,{className:c(`flex items-center gap-2 font-semibold text-lg`),children:[(0,B.jsx)(o,{size:20}),(0,B.jsx)(`span`,{children:d.openExternalLink})]}),(0,B.jsx)(`p`,{className:c(`text-muted-foreground text-sm`),children:d.externalLinkWarning})]}),(0,B.jsx)(`div`,{className:c(`break-all rounded-md bg-muted p-3 font-mono text-sm`,e.length>100&&`max-h-32 overflow-y-auto`),children:e}),(0,B.jsxs)(`div`,{className:c(`flex gap-2`),children:[(0,B.jsx)(`button`,{className:c(`flex flex-1 items-center justify-center gap-2 rounded-md border bg-background px-4 py-2 font-medium text-sm transition-all hover:bg-muted`),onClick:f,type:`button`,children:l?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(i,{size:14}),(0,B.jsx)(`span`,{children:d.copied})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(a,{size:14}),(0,B.jsx)(`span`,{children:d.copyLink})]})}),(0,B.jsxs)(`button`,{className:c(`flex flex-1 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 font-medium text-primary-foreground text-sm transition-all hover:bg-primary/90`),onClick:p,type:`button`,children:[(0,B.jsx)(o,{size:14}),(0,B.jsx)(`span`,{children:d.openLink})]})]})]})}):null},uZ=(0,z.createContext)(null),dZ=()=>(0,z.useContext)(uZ),OCe=()=>dZ()?.code??null,fZ=()=>dZ()?.mermaid??null,kCe=e=>{var t;let n=dZ();return n!=null&&n.renderers&&e&&(t=n.renderers.find(t=>Array.isArray(t.language)?t.language.includes(e):t.language===e))!=null?t:null},ACe=(e,t)=>new Promise((t,n)=>{let r=`data:image/svg+xml;base64,`+btoa(unescape(encodeURIComponent(e))),i=new Image;i.crossOrigin=`anonymous`,i.onload=()=>{let e=document.createElement(`canvas`),r=i.width*5,a=i.height*5;e.width=r,e.height=a;let o=e.getContext(`2d`);if(!o){n(Error(`Failed to create 2D canvas context for PNG export`));return}o.drawImage(i,0,0,r,a),e.toBlob(e=>{if(!e){n(Error(`Failed to create PNG blob`));return}t(e)},`image/png`)},i.onerror=()=>n(Error(`Failed to load SVG image`)),i.src=r}),jCe=({chart:e,children:t,className:n,onDownload:r,config:i,onError:a})=>{let o=qX(),[s,c]=(0,z.useState)(!1),l=(0,z.useRef)(null),{isAnimating:u}=(0,z.useContext)(pQ),d=eZ(),f=fZ(),p=rZ(),m=async t=>{try{if(t===`mmd`){GX(`diagram.mmd`,e,`text/plain`),c(!1),r?.(t);return}if(!f){a?.(Error(`Mermaid plugin not available`));return}let n=f.getMermaid(i),o=e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),s=`mermaid-${Math.abs(o)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:l}=await n.render(s,e);if(!l){a?.(Error(`SVG not found. Please wait for the diagram to render.`));return}if(t===`svg`){GX(`diagram.svg`,l,`image/svg+xml`),c(!1),r?.(t);return}if(t===`png`){GX(`diagram.png`,await ACe(l),`image/png`),r?.(t),c(!1);return}}catch(e){a?.(e)}};return(0,z.useEffect)(()=>{let e=e=>{let t=e.composedPath();l.current&&!t.includes(l.current)&&c(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,B.jsxs)(`div`,{className:o(`relative`),ref:l,children:[(0,B.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,n),disabled:u,onClick:()=>c(!s),title:p.downloadDiagram,type:`button`,children:t??(0,B.jsx)(d.DownloadIcon,{size:14})}),s?(0,B.jsxs)(`div`,{className:o(`absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,B.jsx)(`button`,{className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`svg`),title:p.downloadDiagramAsSvg,type:`button`,children:p.mermaidFormatSvg}),(0,B.jsx)(`button`,{className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`png`),title:p.downloadDiagramAsPng,type:`button`,children:p.mermaidFormatPng}),(0,B.jsx)(`button`,{className:o(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`mmd`),title:p.downloadDiagramAsMmd,type:`button`,children:p.mermaidFormatMmd})]}):null]})},MCe=({chart:e,config:t,onFullscreen:n,onExit:r,className:i,...a})=>{let{Maximize2Icon:o,XIcon:s}=eZ(),c=qX(),[l,u]=(0,z.useState)(!1),{isAnimating:d,controls:f}=(0,z.useContext)(pQ),p=rZ(),m=(()=>{if(typeof f==`boolean`)return f;let e=f.mermaid;return e===!1?!1:e===!0||e===void 0?!0:e.panZoom!==!1})(),h=()=>{u(!l)};return(0,z.useEffect)(()=>{if(l){cZ();let e=e=>{e.key===`Escape`&&u(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),lZ()}}},[l]),(0,z.useEffect)(()=>{l?n?.():r&&r()},[l,n,r]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{className:c(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),disabled:d,onClick:h,title:p.viewFullscreen,type:`button`,...a,children:(0,B.jsx)(o,{size:14})}),l?(0,Ex.createPortal)((0,B.jsxs)(`div`,{className:c(`fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm`),onClick:h,onKeyDown:e=>{e.key===`Escape`&&h()},role:`button`,tabIndex:0,children:[(0,B.jsx)(`button`,{className:c(`absolute top-4 right-4 z-10 rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:h,title:p.exitFullscreen,type:`button`,children:(0,B.jsx)(s,{size:20})}),(0,B.jsx)(`div`,{className:c(`flex size-full items-center justify-center p-4`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:(0,B.jsx)(gQ,{chart:e,className:c(`size-full [&_svg]:h-auto [&_svg]:w-auto`),config:t,fullscreen:!0,showControls:m})})]}),document.body):null]})},pZ=e=>{let t=[],n=[],r=e.querySelectorAll(`thead th`);for(let e of r)t.push(e.textContent?.trim()||``);let i=e.querySelectorAll(`tbody tr`);for(let e of i){let t=[],r=e.querySelectorAll(`td`);for(let e of r)t.push(e.textContent?.trim()||``);n.push(t)}return{headers:t,rows:n}},mZ=e=>{let{headers:t,rows:n}=e,r=e=>{let t=!1,n=!1;for(let r of e){if(r===`"`){t=!0,n=!0;break}(r===`,`||r===`
|
|
219
|
+
`)&&(t=!0)}return t?n?`"${e.replace(/"/g,`""`)}"`:`"${e}"`:e},i=t.length>0?n.length+1:n.length,a=Array(i),o=0;t.length>0&&(a[o]=t.map(r).join(`,`),o+=1);for(let e of n)a[o]=e.map(r).join(`,`),o+=1;return a.join(`
|
|
220
|
+
`)},NCe=e=>{let{headers:t,rows:n}=e,r=e=>{let t=!1;for(let n of e)if(n===` `||n===`
|
|
221
|
+
`||n===`\r`){t=!0;break}if(!t)return e;let n=[];for(let t of e)t===` `?n.push(`\\t`):t===`
|
|
222
|
+
`?n.push(`\\n`):t===`\r`?n.push(`\\r`):n.push(t);return n.join(``)},i=t.length>0?n.length+1:n.length,a=Array(i),o=0;t.length>0&&(a[o]=t.map(r).join(` `),o+=1);for(let e of n)a[o]=e.map(r).join(` `),o+=1;return a.join(`
|
|
223
|
+
`)},hZ=e=>{let t=!1;for(let n of e)if(n===`\\`||n===`|`){t=!0;break}if(!t)return e;let n=[];for(let t of e)t===`\\`?n.push(`\\\\`):t===`|`?n.push(`\\|`):n.push(t);return n.join(``)},gZ=e=>{let{headers:t,rows:n}=e;if(t.length===0)return``;let r=Array(n.length+2),i=0;r[i]=`| ${t.map(e=>hZ(e)).join(` | `)} |`,i+=1;let a=Array(t.length);for(let e=0;e<t.length;e+=1)a[e]=`---`;r[i]=`| ${a.join(` | `)} |`,i+=1;for(let e of n)if(e.length<t.length){let n=Array(t.length);for(let r=0;r<t.length;r+=1)n[r]=r<e.length?hZ(e[r]):``;r[i]=`| ${n.join(` | `)} |`,i+=1}else r[i]=`| ${e.map(e=>hZ(e)).join(` | `)} |`,i+=1;return r.join(`
|
|
224
|
+
`)},_Z=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let a=qX(),[o,s]=(0,z.useState)(!1),[c,l]=(0,z.useState)(!1),u=(0,z.useRef)(null),d=(0,z.useRef)(0),{isAnimating:f}=(0,z.useContext)(pQ),p=rZ(),m=async e=>{var t;if(typeof window>`u`||!((t=navigator==null?void 0:navigator.clipboard)!=null&&t.write)){r?.(Error(`Clipboard API not available`));return}try{let t=(u.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let a=pZ(t),o=({csv:mZ,tsv:NCe,md:gZ}[e]||gZ)(a),c=new ClipboardItem({"text/plain":new Blob([o],{type:`text/plain`}),"text/html":new Blob([t.outerHTML],{type:`text/html`})});await navigator.clipboard.write([c]),l(!0),s(!1),n?.(e),d.current=window.setTimeout(()=>l(!1),i)}catch(e){r?.(e)}};(0,z.useEffect)(()=>{let e=e=>{let t=e.composedPath();u.current&&!t.includes(u.current)&&s(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e),window.clearTimeout(d.current)}},[]);let h=eZ(),g=c?h.CheckIcon:h.CopyIcon;return(0,B.jsxs)(`div`,{className:a(`relative`),ref:u,children:[(0,B.jsx)(`button`,{className:a(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:f,onClick:()=>s(!o),title:p.copyTable,type:`button`,children:e??(0,B.jsx)(g,{height:14,width:14})}),o?(0,B.jsxs)(`div`,{className:a(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,B.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`md`),title:p.copyTableAsMarkdown,type:`button`,children:p.tableFormatMarkdown}),(0,B.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`csv`),title:p.copyTableAsCsv,type:`button`,children:p.tableFormatCsv}),(0,B.jsx)(`button`,{className:a(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>m(`tsv`),title:p.copyTableAsTsv,type:`button`,children:p.tableFormatTsv})]}):null]})},vZ=({children:e,className:t,onDownload:n,onError:r})=>{let i=qX(),[a,o]=(0,z.useState)(!1),s=(0,z.useRef)(null),{isAnimating:c}=(0,z.useContext)(pQ),l=rZ(),u=eZ(),d=e=>{try{let t=(s.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=pZ(t),a=e===`csv`?mZ(i):gZ(i);GX(`table.${e===`csv`?`csv`:`md`}`,a,e===`csv`?`text/csv`:`text/markdown`),o(!1),n?.(e)}catch(e){r?.(e)}};return(0,z.useEffect)(()=>{let e=e=>{let t=e.composedPath();s.current&&!t.includes(s.current)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,B.jsxs)(`div`,{className:i(`relative`),ref:s,children:[(0,B.jsx)(`button`,{className:i(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:c,onClick:()=>o(!a),title:l.downloadTable,type:`button`,children:e??(0,B.jsx)(u.DownloadIcon,{size:14})}),a?(0,B.jsxs)(`div`,{className:i(`absolute top-full right-0 z-20 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`),children:[(0,B.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>d(`csv`),title:l.downloadTableAsCsv,type:`button`,children:l.tableFormatCsv}),(0,B.jsx)(`button`,{className:i(`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`),onClick:()=>d(`markdown`),title:l.downloadTableAsMarkdown,type:`button`,children:l.tableFormatMarkdown})]}):null]})},PCe=({children:e,className:t,showCopy:n=!0,showDownload:r=!0})=>{let{Maximize2Icon:i,XIcon:a}=eZ(),o=qX(),[s,c]=(0,z.useState)(!1),{isAnimating:l}=(0,z.useContext)(pQ),u=rZ(),d=()=>{c(!0)},f=()=>{c(!1)};return(0,z.useEffect)(()=>{if(s){cZ();let e=e=>{e.key===`Escape`&&c(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),lZ()}}},[s]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{className:o(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:l,onClick:d,title:u.viewFullscreen,type:`button`,children:(0,B.jsx)(i,{size:14})}),s?(0,Ex.createPortal)((0,B.jsx)(`div`,{"aria-label":u.viewFullscreen,"aria-modal":`true`,className:o(`fixed inset-0 z-50 flex flex-col bg-background`),"data-streamdown":`table-fullscreen`,onClick:f,onKeyDown:e=>{e.key===`Escape`&&f()},role:`dialog`,children:(0,B.jsxs)(`div`,{className:o(`flex h-full flex-col`),onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:[(0,B.jsxs)(`div`,{className:o(`flex items-center justify-end gap-1 p-4`),children:[n?(0,B.jsx)(_Z,{}):null,r?(0,B.jsx)(vZ,{}):null,(0,B.jsx)(`button`,{className:o(`rounded-md p-1 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`),onClick:f,title:u.exitFullscreen,type:`button`,children:(0,B.jsx)(a,{size:20})})]}),(0,B.jsx)(`div`,{className:o(`flex-1 overflow-auto p-4 pt-0 [&_thead]:sticky [&_thead]:top-0 [&_thead]:z-10`),children:(0,B.jsx)(`table`,{className:o(`w-full border-collapse border border-border`),"data-streamdown":`table`,children:e})})]})}),document.body):null]})},FCe=({children:e,className:t,showControls:n,showCopy:r=!0,showDownload:i=!0,showFullscreen:a=!0,...o})=>{let s=qX(),c=n&&r,l=n&&i,u=n&&a,d=c||l||u;return(0,B.jsxs)(`div`,{className:s(`my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2`),"data-streamdown":`table-wrapper`,children:[d?(0,B.jsxs)(`div`,{className:s(`flex items-center justify-end gap-1`),children:[c?(0,B.jsx)(_Z,{}):null,l?(0,B.jsx)(vZ,{}):null,u?(0,B.jsx)(PCe,{showCopy:c,showDownload:l,children:e}):null]}):null,(0,B.jsx)(`div`,{className:s(`border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background`),children:(0,B.jsx)(`table`,{className:s(`w-full divide-y divide-border`,t),"data-streamdown":`table`,...o,children:e})})]})},ICe=/startLine=(\d+)/,LCe=/\bnoLineNumbers\b/,RCe=(0,z.lazy)(()=>BX(()=>import(`./mermaid-GHXKKRXX-BOZxTT7y.js`).then(e=>({default:e.Mermaid})),[])),zCe=/language-([^\s]+)/;function yZ(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return!0;if(!(e!=null&&e.position&&t!=null&&t.position))return!1;let n=e.position.start,r=t.position.start,i=e.position.end,a=t.position.end;return n?.line===r?.line&&n?.column===r?.column&&i?.line===a?.line&&i?.column===a?.column}function bZ(e,t){return e.className===t.className&&yZ(e.node,t.node)}var xZ=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,SZ=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.table;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},CZ=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.code;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},wZ=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},TZ=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`ol`,{className:qX()(`list-inside list-decimal whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`ordered-list`,...r,children:e}),(e,t)=>bZ(e,t));TZ.displayName=`MarkdownOl`;var EZ=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`li`,{className:qX()(`py-1 [&>p]:inline`,t),"data-streamdown":`list-item`,...r,children:e}),(e,t)=>e.className===t.className&&yZ(e.node,t.node));EZ.displayName=`MarkdownLi`;var DZ=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`ul`,{className:qX()(`list-inside list-disc whitespace-normal [li_&]:pl-6`,t),"data-streamdown":`unordered-list`,...r,children:e}),(e,t)=>bZ(e,t));DZ.displayName=`MarkdownUl`;var OZ=(0,z.memo)(({className:e,node:t,...n})=>(0,B.jsx)(`hr`,{className:qX()(`my-6 border-border`,e),"data-streamdown":`horizontal-rule`,...n}),(e,t)=>bZ(e,t));OZ.displayName=`MarkdownHr`;var kZ=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`span`,{className:qX()(`font-semibold`,t),"data-streamdown":`strong`,...r,children:e}),(e,t)=>bZ(e,t));kZ.displayName=`MarkdownStrong`;var AZ=(0,z.memo)(({children:e,className:t,href:n,node:r,...i})=>{let a=qX(),{linkSafety:o}=(0,z.useContext)(pQ),[s,c]=(0,z.useState)(!1),l=n===`streamdown:incomplete-link`,u=(0,z.useCallback)(async e=>{if(!(!(o!=null&&o.enabled&&n)||l)){if(e.preventDefault(),o.onLinkCheck&&await o.onLinkCheck(n)){window.open(n,`_blank`,`noreferrer`);return}c(!0)}},[o,n,l]),d=(0,z.useCallback)(()=>{n&&window.open(n,`_blank`,`noreferrer`)},[n]),f=(0,z.useCallback)(()=>{c(!1)},[]),p={url:n??``,isOpen:s,onClose:f,onConfirm:d};return o!=null&&o.enabled&&n?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{className:a(`wrap-anywhere appearance-none text-left font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,onClick:u,type:`button`,children:e}),o.renderModal?o.renderModal(p):(0,B.jsx)(DCe,{...p})]}):(0,B.jsx)(`a`,{className:a(`wrap-anywhere font-medium text-primary underline`,t),"data-incomplete":l,"data-streamdown":`link`,href:n,rel:`noreferrer`,target:`_blank`,...i,children:e})},(e,t)=>bZ(e,t)&&e.href===t.href);AZ.displayName=`MarkdownA`;var jZ=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h1`,{className:qX()(`mt-6 mb-2 font-semibold text-3xl`,t),"data-streamdown":`heading-1`,...r,children:e}),(e,t)=>bZ(e,t));jZ.displayName=`MarkdownH1`;var MZ=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h2`,{className:qX()(`mt-6 mb-2 font-semibold text-2xl`,t),"data-streamdown":`heading-2`,...r,children:e}),(e,t)=>bZ(e,t));MZ.displayName=`MarkdownH2`;var NZ=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h3`,{className:qX()(`mt-6 mb-2 font-semibold text-xl`,t),"data-streamdown":`heading-3`,...r,children:e}),(e,t)=>bZ(e,t));NZ.displayName=`MarkdownH3`;var PZ=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h4`,{className:qX()(`mt-6 mb-2 font-semibold text-lg`,t),"data-streamdown":`heading-4`,...r,children:e}),(e,t)=>bZ(e,t));PZ.displayName=`MarkdownH4`;var FZ=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h5`,{className:qX()(`mt-6 mb-2 font-semibold text-base`,t),"data-streamdown":`heading-5`,...r,children:e}),(e,t)=>bZ(e,t));FZ.displayName=`MarkdownH5`;var IZ=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`h6`,{className:qX()(`mt-6 mb-2 font-semibold text-sm`,t),"data-streamdown":`heading-6`,...r,children:e}),(e,t)=>bZ(e,t));IZ.displayName=`MarkdownH6`;var LZ=(0,z.memo)(({children:e,className:t,node:n,...r})=>{let{controls:i}=(0,z.useContext)(pQ);return(0,B.jsx)(FCe,{className:t,showControls:xZ(i,`table`),showCopy:SZ(i,`copy`),showDownload:SZ(i,`download`),showFullscreen:SZ(i,`fullscreen`),...r,children:e})},(e,t)=>bZ(e,t));LZ.displayName=`MarkdownTable`;var RZ=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`thead`,{className:qX()(`bg-muted/80`,t),"data-streamdown":`table-header`,...r,children:e}),(e,t)=>bZ(e,t));RZ.displayName=`MarkdownThead`;var zZ=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`tbody`,{className:qX()(`divide-y divide-border`,t),"data-streamdown":`table-body`,...r,children:e}),(e,t)=>bZ(e,t));zZ.displayName=`MarkdownTbody`;var BZ=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`tr`,{className:qX()(`border-border`,t),"data-streamdown":`table-row`,...r,children:e}),(e,t)=>bZ(e,t));BZ.displayName=`MarkdownTr`;var VZ=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`th`,{className:qX()(`whitespace-nowrap px-4 py-2 text-left font-semibold text-sm`,t),"data-streamdown":`table-header-cell`,...r,children:e}),(e,t)=>bZ(e,t));VZ.displayName=`MarkdownTh`;var HZ=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`td`,{className:qX()(`px-4 py-2 text-sm`,t),"data-streamdown":`table-cell`,...r,children:e}),(e,t)=>bZ(e,t));HZ.displayName=`MarkdownTd`;var UZ=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`blockquote`,{className:qX()(`my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic`,t),"data-streamdown":`blockquote`,...r,children:e}),(e,t)=>bZ(e,t));UZ.displayName=`MarkdownBlockquote`;var WZ=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`sup`,{className:qX()(`text-sm`,t),"data-streamdown":`superscript`,...r,children:e}),(e,t)=>bZ(e,t));WZ.displayName=`MarkdownSup`;var GZ=(0,z.memo)(({children:e,className:t,node:n,...r})=>(0,B.jsx)(`sub`,{className:qX()(`text-sm`,t),"data-streamdown":`subscript`,...r,children:e}),(e,t)=>bZ(e,t));GZ.displayName=`MarkdownSub`;var KZ=(0,z.memo)(({children:e,className:t,node:n,...r})=>{if(`data-footnotes`in r){let n=e=>{if(!(0,z.isValidElement)(e))return!1;let t=Array.isArray(e.props.children)?e.props.children:[e.props.children],n=!1,r=!1;for(let e of t)if(e){if(typeof e==`string`)e.trim()!==``&&(n=!0);else if((0,z.isValidElement)(e))if(e.props?.[`data-footnote-backref`]!==void 0)r=!0;else{let t=Array.isArray(e.props.children)?e.props.children:[e.props.children];for(let e of t){if(typeof e==`string`&&e.trim()!==``){n=!0;break}if((0,z.isValidElement)(e)&&e.props?.[`data-footnote-backref`]===void 0){n=!0;break}}}}return r&&!n},i=Array.isArray(e)?e.map(e=>{if(!(0,z.isValidElement)(e))return e;if(e.type===TZ){let t=(Array.isArray(e.props.children)?e.props.children:[e.props.children]).filter(e=>!n(e));return t.length===0?null:{...e,props:{...e.props,children:t}}}return e}):e;return(Array.isArray(i)?i.some(e=>e!==null):i!==null)?(0,B.jsx)(`section`,{className:t,...r,children:i}):null}return(0,B.jsx)(`section`,{className:t,...r,children:e})},(e,t)=>bZ(e,t));KZ.displayName=`MarkdownSection`;var qZ=(0,z.memo)(({node:e,className:t,children:n,...r})=>{let i=qX(),a=!(`data-block`in r),{mermaid:o,controls:s,lineNumbers:c}=(0,z.useContext)(pQ),l=fZ(),u=pCe(),d=(t?.match(zCe))?.at(1)??``,f=kCe(d);if(a)return(0,B.jsx)(`code`,{className:i(`rounded bg-muted px-1.5 py-0.5 font-mono text-sm`,t),"data-streamdown":`inline-code`,...r,children:n});let p=e?.properties?.metastring,m=p?.match(ICe),h=m?Number.parseInt(m[1],10):void 0,g=h!==void 0&&h>=1?h:void 0,_=!(p&&LCe.test(p))&&c!==!1,v=``;if((0,z.isValidElement)(n)&&n.props&&typeof n.props==`object`&&`children`in n.props&&typeof n.props.children==`string`?v=n.props.children:typeof n==`string`&&(v=n),f){let e=f.component;return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(oZ,{}),children:(0,B.jsx)(e,{code:v,isIncomplete:u,language:d,meta:p})})}if(d===`mermaid`&&l){let e=xZ(s,`mermaid`),n=wZ(s,`download`),r=wZ(s,`copy`),a=wZ(s,`fullscreen`),c=wZ(s,`panZoom`),l=e&&(n||r||a);return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(oZ,{}),children:(0,B.jsxs)(`div`,{className:i(`group relative my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2`,t),"data-streamdown":`mermaid-block`,children:[(0,B.jsx)(`div`,{className:i(`flex h-8 items-center text-muted-foreground text-xs`),children:(0,B.jsx)(`span`,{className:i(`ml-1 font-mono lowercase`),children:`mermaid`})}),l?(0,B.jsx)(`div`,{className:i(`pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end`),children:(0,B.jsxs)(`div`,{className:i(`pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur`),"data-streamdown":`mermaid-block-actions`,children:[n?(0,B.jsx)(jCe,{chart:v,config:o?.config}):null,r?(0,B.jsx)(iZ,{code:v}):null,a?(0,B.jsx)(MCe,{chart:v,config:o?.config}):null]})}):null,(0,B.jsx)(`div`,{className:i(`rounded-md border border-border bg-background`),children:(0,B.jsx)(RCe,{chart:v,config:o?.config,showControls:c})})]})})}let y=xZ(s,`code`),b=CZ(s,`download`),x=CZ(s,`copy`);return(0,B.jsx)(SCe,{className:t,code:v,isIncomplete:u,language:d,lineNumbers:_,startLine:g,children:y?(0,B.jsxs)(B.Fragment,{children:[b?(0,B.jsx)(wCe,{code:v,language:d}):null,x?(0,B.jsx)(iZ,{}):null]}):null})},(e,t)=>e.className===t.className&&yZ(e.node,t.node));qZ.displayName=`MarkdownCode`;var JZ=(0,z.memo)(ECe,(e,t)=>e.className===t.className&&yZ(e.node,t.node));JZ.displayName=`MarkdownImg`;var YZ=(0,z.memo)(({children:e,node:t,...n})=>{let r=(Array.isArray(e)?e:[e]).filter(e=>e!=null&&e!==``);if(r.length===1&&(0,z.isValidElement)(r[0])){let t=r[0].props.node?.tagName;if(t===`img`||t===`code`&&`data-block`in r[0].props)return(0,B.jsx)(B.Fragment,{children:e})}return(0,B.jsx)(`p`,{...n,children:e})},(e,t)=>bZ(e,t));YZ.displayName=`MarkdownParagraph`;var BCe={ol:TZ,li:EZ,ul:DZ,hr:OZ,strong:kZ,a:AZ,h1:jZ,h2:MZ,h3:NZ,h4:PZ,h5:FZ,h6:IZ,table:LZ,thead:RZ,tbody:zZ,tr:BZ,th:VZ,td:HZ,blockquote:UZ,code:qZ,img:JZ,pre:({children:e})=>(0,z.isValidElement)(e)?(0,z.cloneElement)(e,{"data-block":`true`}):e,sup:WZ,sub:GZ,p:YZ,section:KZ},VCe=/[\u0590-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/,HCe=/\p{L}/u;function XZ(e){let t=e.replace(/^#{1,6}\s+/gm,``).replace(/(\*{1,3}|_{1,3})/g,``).replace(/`[^`]*`/g,``).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/^[\s>*\-+\d.]+/gm,``);for(let e of t){if(VCe.test(e))return`rtl`;if(HCe.test(e))return`ltr`}return`ltr`}var UCe=/^[ \t]{0,3}(`{3,}|~{3,})/,WCe=/^\|?[ \t]*:?-{1,}:?[ \t]*(\|[ \t]*:?-{1,}:?[ \t]*)*\|?$/,ZZ=e=>{let t=e.split(`
|
|
225
|
+
`),n=null,r=0;for(let e of t){let t=UCe.exec(e);if(n===null){if(t){let e=t[1];n=e[0],r=e.length}}else if(t){let e=t[1],i=e[0],a=e.length;i===n&&a>=r&&(n=null,r=0)}}return n!==null},GCe=e=>{let t=e.split(`
|
|
226
|
+
`);for(let e of t){let t=e.trim();if(t.length>0&&t.includes(`|`)&&WCe.test(t))return!0}return!1},KCe=()=>e=>{bB(e,`html`,(e,t,n)=>{!n||typeof t!=`number`||(n.children[t]={type:`text`,value:e.value})})},QZ=[],$Z={allowDangerousHtml:!0},eQ=new WeakMap,tQ=new class{constructor(){this.cache=new Map,this.keyCache=new WeakMap,this.maxSize=100}generateCacheKey(e){let t=this.keyCache.get(e);if(t)return t;let n=e.rehypePlugins,r=e.remarkPlugins,i=e.remarkRehypeOptions;if(!(n||r||i)){let t=`default`;return this.keyCache.set(e,t),t}let a=e=>{if(!e||e.length===0)return``;let t=``;for(let n=0;n<e.length;n+=1){let r=e[n];if(n>0&&(t+=`,`),Array.isArray(r)){let[e,n]=r;if(typeof e==`function`){let n=eQ.get(e);n||(n=e.name,eQ.set(e,n)),t+=n}else t+=String(e);t+=`:`,t+=JSON.stringify(n)}else if(typeof r==`function`){let e=eQ.get(r);e||(e=r.name,eQ.set(r,e)),t+=e}else t+=String(r)}return t},o=a(n),s=`${a(r)}::${o}::${i?JSON.stringify(i):``}`;return this.keyCache.set(e,s),s}get(e){let t=this.generateCacheKey(e),n=this.cache.get(t);return n&&(this.cache.delete(t),this.cache.set(t,n)),n}set(e,t){let n=this.generateCacheKey(e);if(this.cache.size>=this.maxSize){let e=this.cache.keys().next().value;e&&this.cache.delete(e)}this.cache.set(n,t)}clear(){this.cache.clear()}},nQ=e=>{let t=qCe(e),n=e.children||``;return ewe(t.runSync(t.parse(n),n),e)},qCe=e=>{let t=tQ.get(e);if(t)return t;let n=YCe(e);return tQ.set(e,n),n},JCe=e=>e.some(e=>Array.isArray(e)?e[0]===GK:e===GK),YCe=e=>{let t=e.rehypePlugins||QZ,n=e.remarkPlugins||QZ,r=JCe(t)?n:[...n,KCe],i=e.remarkRehypeOptions?{...$Z,...e.remarkRehypeOptions}:$Z;return uSe().use(uxe).use(r).use(Kxe,i).use(t)},XCe=e=>e,ZCe=(e,t,n,r)=>{n?e.children.splice(t,1):e.children[t]={type:`text`,value:r}},QCe=(e,t)=>{for(let n in pY)if(Object.hasOwn(pY,n)&&Object.hasOwn(e.properties,n)){let r=e.properties[n],i=pY[n];(i===null||i.includes(e.tagName))&&(e.properties[n]=t(String(r||``),n,e)??void 0)}},$Ce=(e,t,n,r,i,a)=>{let o=!1;return r?o=!r.includes(e.tagName):i&&(o=i.includes(e.tagName)),!o&&a&&typeof t==`number`&&(o=!a(e,t,n)),o},ewe=(e,t)=>{let{allowElement:n,allowedElements:r,disallowedElements:i,skipHtml:a,unwrapDisallowed:o,urlTransform:s}=t;if(n||r||i||a||s){let t=s||XCe;bB(e,(e,s,c)=>{if(e.type===`raw`&&c&&typeof s==`number`)return ZCe(c,s,a,e.value),s;if(e.type===`element`&&(QCe(e,t),$Ce(e,s,c,r,i,n)&&c&&typeof s==`number`))return o&&e.children?c.children.splice(s,1,...e.children):c.children.splice(s,1),s})}return vbe(e,{Fragment:B.Fragment,components:t.components,ignoreInvalidStyle:!0,jsx:B.jsx,jsxs:B.jsxs,passKeys:!0,passNode:!0})},twe=/\[\^[\w-]{1,200}\](?!:)/,nwe=/\[\^[\w-]{1,200}\]:/,rwe=/<(\w+)[\s>]/,iwe=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]),rQ=new Map,iQ=new Map,awe=e=>{let t=e.toLowerCase(),n=rQ.get(t);if(n)return n;let r=RegExp(`<${t}(?=[\\s>/])[^>]*>`,`gi`);return rQ.set(t,r),r},owe=e=>{let t=e.toLowerCase(),n=iQ.get(t);if(n)return n;let r=RegExp(`</${t}(?=[\\s>])[^>]*>`,`gi`);return iQ.set(t,r),r},aQ=(e,t)=>{if(iwe.has(t.toLowerCase()))return 0;let n=e.match(awe(t));if(!n)return 0;let r=0;for(let e of n)e.trimEnd().endsWith(`/>`)||(r+=1);return r},oQ=(e,t)=>{let n=e.match(owe(t));return n?n.length:0},swe=e=>{let t=0;for(let n=0;n<e.length-1;n+=1)e[n]===`$`&&e[n+1]===`$`&&(t+=1,n+=1);return t},cwe=e=>{let t=twe.test(e),n=nwe.test(e);if(t||n)return[e];let r=MX.lex(e,{gfm:!0}),i=[],a=[],o=!1;for(let e of r){let t=e.raw,n=i.length;if(a.length>0){i[n-1]+=t;let e=a.at(-1),r=aQ(t,e),o=oQ(t,e);for(let t=0;t<r;t+=1)a.push(e);for(let t=0;t<o;t+=1)a.length>0&&a.at(-1)===e&&a.pop();continue}if(e.type===`html`&&e.block){let e=t.match(rwe);if(e){let n=e[1];aQ(t,n)>oQ(t,n)&&a.push(n)}}if(n>0&&!o){let e=i[n-1];if(swe(e)%2==1){i[n-1]=e+t;continue}}i.push(t),e.type!==`space`&&(o=e.type===`code`)}return i},lwe=(e,t)=>{if(!t.length)return e;let n=e;for(let e of t){let t=RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`,`gi`);n=n.replace(t,(e,t,n,r)=>{if(!n.includes(`
|
|
227
|
+
|
|
228
|
+
`))return t+n+r;let i=n.replace(/\n\n/g,`
|
|
229
|
+
<!---->
|
|
230
|
+
`);return`${t}${(i.startsWith(`
|
|
231
|
+
`)?``:`
|
|
232
|
+
`)+i+(i.endsWith(`
|
|
233
|
+
`)?``:`
|
|
234
|
+
`)}${r}
|
|
235
|
+
|
|
236
|
+
`})}return n},uwe=/([\\`*_~[\]|])/g,dwe=e=>e.replace(uwe,`\\$1`),fwe=(e,t)=>{if(!t.length)return e;let n=e;for(let e of t){let t=RegExp(`(<${e}(?=[\\s>/])[^>]*>)([\\s\\S]*?)(</${e}\\s*>)`,`gi`);n=n.replace(t,(e,t,n,r)=>t+dwe(n).replace(/\n\n/g,` `)+r)}return n},sQ=e=>e.type===`text`?e.value:`children`in e&&Array.isArray(e.children)?e.children.map(sQ).join(``):``,pwe=e=>t=>{if(!e||e.length===0)return;let n=new Set(e.map(e=>e.toLowerCase()));bB(t,`element`,e=>{if(n.has(e.tagName.toLowerCase())){let t=sQ(e);e.children=t?[{type:`text`,value:t}]:[]}})},mwe=()=>e=>{bB(e,`code`,e=>{e.meta&&(e.data=e.data??{},e.data.hProperties={...e.data.hProperties??{},metastring:e.meta})})},hwe=/^[ \t]*<[\w!/?-]/,gwe=/(^|\n)[ \t]{4,}(?=<[\w!/?-])/g,_we=e=>typeof e!=`string`||e.length===0||!hwe.test(e)?e:e.replace(gwe,`$1`),cQ={...qK,protocols:{...qK.protocols,href:[...qK.protocols?.href??[],`tel`]},attributes:{...qK.attributes,code:[...qK.attributes?.code??[],`metastring`]}},lQ={raw:GK,sanitize:[uq,cQ],harden:[SB,{allowedImagePrefixes:[`*`],allowedLinkPrefixes:[`*`],allowedProtocols:[`*`],defaultOrigin:void 0,allowDataImages:!0}]},vwe={gfm:[rbe,{}],codeMeta:mwe},uQ=Object.values(lQ),ywe=Object.values(vwe),bwe={block:` ▋`,circle:` ●`},dQ=[`github-light`,`github-dark`],fQ={enabled:!0},pQ=(0,z.createContext)({shikiTheme:dQ,controls:!0,isAnimating:!1,lineNumbers:!0,mode:`streaming`,mermaid:void 0,linkSafety:fQ}),mQ=(0,z.memo)(({content:e,shouldParseIncompleteMarkdown:t,shouldNormalizeHtmlIndentation:n,index:r,isIncomplete:i,dir:a,animatePlugin:o,...s})=>{if(o){let e=o.getLastRenderCharCount();o.setPrevContentLength(e)}let c=typeof e==`string`&&n?_we(e):e,l=(0,B.jsx)(nQ,{...s,children:c});return(0,B.jsx)(UX.Provider,{value:i,children:a?(0,B.jsx)(`div`,{dir:a,style:{display:`contents`},children:l}):l})},(e,t)=>{if(e.content!==t.content||e.shouldNormalizeHtmlIndentation!==t.shouldNormalizeHtmlIndentation||e.index!==t.index||e.isIncomplete!==t.isIncomplete||e.dir!==t.dir)return!1;if(e.components!==t.components){let n=Object.keys(e.components||{}),r=Object.keys(t.components||{});if(n.length!==r.length||n.some(n=>e.components?.[n]!==t.components?.[n]))return!1}return!(e.rehypePlugins!==t.rehypePlugins||e.remarkPlugins!==t.remarkPlugins)});mQ.displayName=`Block`;var hQ=(0,z.memo)(({children:e,mode:t=`streaming`,dir:n,parseIncompleteMarkdown:r=!0,normalizeHtmlIndentation:i=!1,components:a,rehypePlugins:o=uQ,remarkPlugins:s=ywe,className:c,shikiTheme:l=dQ,mermaid:u,controls:d=!0,isAnimating:f=!1,animated:p,BlockComponent:m=mQ,parseMarkdownIntoBlocksFn:h=cwe,caret:g,plugins:_,remend:v,linkSafety:y=fQ,lineNumbers:b=!0,allowedTags:x,literalTagContent:S,translations:C,icons:w,prefix:T,onAnimationStart:E,onAnimationEnd:D,...O})=>{let k=(0,z.useId)(),[ee,A]=(0,z.useTransition)(),j=(0,z.useMemo)(()=>hCe(T),[T]),te=(0,z.useRef)(null),ne=(0,z.useRef)(E),M=(0,z.useRef)(D);ne.current=E,M.current=D,(0,z.useEffect)(()=>{var e,n,r;if(t===`static`)return;let i=te.current;if(te.current=f,i===null){f&&((e=ne.current)==null||e.call(ne));return}f&&!i?(n=ne.current)==null||n.call(ne):!f&&i&&((r=M.current)==null||r.call(M))},[f,t]);let N=(0,z.useMemo)(()=>x?Object.keys(x):[],[x]),re=(0,z.useMemo)(()=>{if(typeof e!=`string`)return``;let n=t===`streaming`&&r?Wz(e,v):e;return S&&S.length>0&&(n=fwe(n,S)),N.length>0&&(n=lwe(n,N)),n},[e,t,r,v,N,S]),ie=(0,z.useMemo)(()=>h(re),[re,h]),[ae,oe]=(0,z.useState)(ie);(0,z.useEffect)(()=>{t===`streaming`&&!de?A(()=>{oe(ie)}):oe(ie)},[ie,t]);let se=t===`streaming`?ae:ie,ce=(0,z.useMemo)(()=>n===`auto`?se.map(XZ):void 0,[se,n]),le=(0,z.useMemo)(()=>se.map((e,t)=>`${k}-${t}`),[se.length,k]),ue=(0,z.useMemo)(()=>p===!0?`true`:p?JSON.stringify(p):``,[p]),de=(0,z.useMemo)(()=>ue?ue===`true`?HX():HX(p):null,[ue]),fe=(0,z.useMemo)(()=>({shikiTheme:(_?.code)?.getThemes()??l,controls:d,isAnimating:f,lineNumbers:b,mode:t,mermaid:u,linkSafety:y}),[l,d,f,b,t,u,y,_?.code]),pe=(0,z.useMemo)(()=>({...tZ,...C}),[(0,z.useMemo)(()=>C?JSON.stringify(C):``,[C])]),me=(0,z.useMemo)(()=>{let{inlineCode:e,...t}=a??{},n={...BCe,...t};if(e){let t=n.code;n.code=n=>`data-block`in n?t?(0,z.createElement)(t,n):null:(0,z.createElement)(e,n)}return n},[a]),he=(0,z.useMemo)(()=>{let e=[];return _!=null&&_.cjk&&(e=[...e,..._.cjk.remarkPluginsBefore]),e=[...e,...s],_!=null&&_.cjk&&(e=[...e,..._.cjk.remarkPluginsAfter]),_!=null&&_.math&&(e=[...e,_.math.remarkPlugin]),e},[s,_?.math,_?.cjk]),ge=(0,z.useMemo)(()=>{let e=o;if(x&&Object.keys(x).length>0&&o===uQ){let t={...cQ,tagNames:[...cQ.tagNames??[],...Object.keys(x)],attributes:{...cQ.attributes,...x}};e=[lQ.raw,[uq,t],lQ.harden]}return S&&S.length>0&&(e=[...e,[pwe,S]]),_!=null&&_.math&&(e=[...e,_.math.rehypePlugin]),de&&f&&(e=[...e,de.rehypePlugin]),e},[o,_?.math,de,f,x,S]),_e=(0,z.useMemo)(()=>{if(!f||se.length===0)return!1;let e=se.at(-1);return ZZ(e)||GCe(e)},[f,se]),ve=(0,z.useMemo)(()=>g&&f&&!_e?{"--streamdown-caret":`"${bwe[g]}"`}:void 0,[g,f,_e]);return t===`static`?(0,B.jsx)(nZ.Provider,{value:pe,children:(0,B.jsx)(uZ.Provider,{value:_??null,children:(0,B.jsx)(pQ.Provider,{value:fe,children:(0,B.jsx)($X,{icons:w,children:(0,B.jsx)(KX.Provider,{value:j,children:(0,B.jsx)(`div`,{className:j(`space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,c),dir:n===`auto`?XZ(re):n,children:(0,B.jsx)(nQ,{components:me,rehypePlugins:ge,remarkPlugins:he,...O,children:re})})})})})})}):(0,B.jsx)(nZ.Provider,{value:pe,children:(0,B.jsx)(uZ.Provider,{value:_??null,children:(0,B.jsx)(pQ.Provider,{value:fe,children:(0,B.jsx)($X,{icons:w,children:(0,B.jsx)(KX.Provider,{value:j,children:(0,B.jsxs)(`div`,{className:j(`space-y-4 whitespace-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,g&&!_e?`[&>*:last-child]:after:inline [&>*:last-child]:after:align-baseline [&>*:last-child]:after:content-[var(--streamdown-caret)]`:null,c),style:ve,children:[se.length===0&&g&&f&&(0,B.jsx)(`span`,{}),se.map((e,t)=>{let a=t===se.length-1,o=f&&a&&ZZ(e);return(0,B.jsx)(m,{animatePlugin:de,components:me,content:e,dir:ce?.[t]??(n===`auto`?void 0:n),index:t,isIncomplete:o,rehypePlugins:ge,remarkPlugins:he,shouldNormalizeHtmlIndentation:i,shouldParseIncompleteMarkdown:r,...O},le[t])})]})})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating&&e.animated===t.animated&&e.mode===t.mode&&e.plugins===t.plugins&&e.className===t.className&&e.linkSafety===t.linkSafety&&e.lineNumbers===t.lineNumbers&&e.normalizeHtmlIndentation===t.normalizeHtmlIndentation&&e.literalTagContent===t.literalTagContent&&JSON.stringify(e.translations)===JSON.stringify(t.translations)&&e.prefix===t.prefix&&e.dir===t.dir);hQ.displayName=`Streamdown`;var xwe=({children:e,className:t,minZoom:n=.5,maxZoom:r=3,zoomStep:i=.1,showControls:a=!0,initialZoom:o=1,fullscreen:s=!1})=>{let{RotateCcwIcon:c,ZoomInIcon:l,ZoomOutIcon:u}=eZ(),d=qX(),f=(0,z.useRef)(null),p=(0,z.useRef)(null),[m,h]=(0,z.useState)(o),[g,_]=(0,z.useState)({x:0,y:0}),[v,y]=(0,z.useState)(!1),[b,x]=(0,z.useState)({x:0,y:0}),[S,C]=(0,z.useState)({x:0,y:0}),w=(0,z.useCallback)(e=>{h(t=>Math.max(n,Math.min(r,t+e)))},[n,r]),T=(0,z.useCallback)(()=>{w(i)},[w,i]),E=(0,z.useCallback)(()=>{w(-i)},[w,i]),D=(0,z.useCallback)(()=>{h(o),_({x:0,y:0})},[o]),O=(0,z.useCallback)(e=>{e.preventDefault(),w(e.deltaY>0?-i:i)},[w,i]),k=(0,z.useCallback)(e=>{if(e.button!==0||e.isPrimary===!1)return;y(!0),x({x:e.clientX,y:e.clientY}),C(g);let t=e.currentTarget;t instanceof HTMLElement&&t.setPointerCapture(e.pointerId)},[g]),ee=(0,z.useCallback)(e=>{if(!v)return;e.preventDefault();let t=e.clientX-b.x,n=e.clientY-b.y;_({x:S.x+t,y:S.y+n})},[v,b,S]),A=(0,z.useCallback)(e=>{y(!1);let t=e.currentTarget;t instanceof HTMLElement&&t.releasePointerCapture(e.pointerId)},[]);return(0,z.useEffect)(()=>{let e=f.current;if(e)return e.addEventListener(`wheel`,O,{passive:!1}),()=>{e.removeEventListener(`wheel`,O)}},[O]),(0,z.useEffect)(()=>{let e=p.current;if(e&&v)return document.body.style.userSelect=`none`,e.addEventListener(`pointermove`,ee,{passive:!1}),e.addEventListener(`pointerup`,A),e.addEventListener(`pointercancel`,A),()=>{document.body.style.userSelect=``,e.removeEventListener(`pointermove`,ee),e.removeEventListener(`pointerup`,A),e.removeEventListener(`pointercancel`,A)}},[v,ee,A]),(0,B.jsxs)(`div`,{className:d(`relative flex flex-col`,s?`h-full w-full`:`min-h-28 w-full`,t),ref:f,style:{cursor:v?`grabbing`:`grab`},children:[a?(0,B.jsxs)(`div`,{className:d(`absolute z-10 flex flex-col gap-1 rounded-md border border-border bg-background/80 p-1 supports-[backdrop-filter]:bg-background/70 supports-[backdrop-filter]:backdrop-blur-sm`,s?`bottom-4 left-4`:`bottom-2 left-2`),children:[(0,B.jsx)(`button`,{className:d(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`),disabled:m>=r,onClick:T,title:`Zoom in`,type:`button`,children:(0,B.jsx)(l,{size:16})}),(0,B.jsx)(`button`,{className:d(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`),disabled:m<=n,onClick:E,title:`Zoom out`,type:`button`,children:(0,B.jsx)(u,{size:16})}),(0,B.jsx)(`button`,{className:d(`flex items-center justify-center rounded p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`),onClick:D,title:`Reset zoom and pan`,type:`button`,children:(0,B.jsx)(c,{size:16})})]}):null,(0,B.jsx)(`div`,{className:d(`flex-1 origin-center transition-transform duration-150 ease-out`,s?`flex h-full w-full items-center justify-center`:`flex w-full items-center justify-center`),onPointerDown:k,ref:p,role:`application`,style:{transform:`translate(${g.x}px, ${g.y}px) scale(${m})`,transformOrigin:`center center`,touchAction:`none`,willChange:`transform`},children:e})]})},gQ=({chart:e,className:t,config:n,fullscreen:r=!1,showControls:i=!0})=>{let a=qX(),[o,s]=(0,z.useState)(null),[c,l]=(0,z.useState)(!1),[u,d]=(0,z.useState)(``),[f,p]=(0,z.useState)(``),[m,h]=(0,z.useState)(0),{mermaid:g}=(0,z.useContext)(pQ),_=fZ(),v=g?.errorComponent,{shouldRender:y,containerRef:b}=rCe({immediate:r});if((0,z.useEffect)(()=>{if(y){if(!_){s(`Mermaid plugin not available. Please add the mermaid plugin to enable diagram rendering.`);return}(async()=>{try{s(null),l(!0);let t=_.getMermaid(n),r=e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),i=`mermaid-${Math.abs(r)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:a}=await t.render(i,e);d(a),p(a)}catch(e){f||u||s(e instanceof Error?e.message:`Failed to render Mermaid chart`)}finally{l(!1)}})()}},[e,n,m,y,_]),!(y||u||f))return(0,B.jsx)(`div`,{className:a(`my-4 min-h-[200px]`,t),ref:b});if(c&&!u&&!f)return(0,B.jsx)(`div`,{className:a(`my-4 flex justify-center p-4`,t),ref:b,children:(0,B.jsxs)(`div`,{className:a(`flex items-center space-x-2 text-muted-foreground`),children:[(0,B.jsx)(`div`,{className:a(`h-4 w-4 animate-spin rounded-full border-current border-b-2`)}),(0,B.jsx)(`span`,{className:a(`text-sm`),children:`Loading diagram...`})]})});if(o&&!u&&!f)return v?(0,B.jsx)(`div`,{ref:b,children:(0,B.jsx)(v,{chart:e,error:o,retry:()=>h(e=>e+1)})}):(0,B.jsxs)(`div`,{className:a(`rounded-md bg-red-50 p-4`,t),ref:b,children:[(0,B.jsxs)(`p`,{className:a(`font-mono text-red-700 text-sm`),children:[`Mermaid Error: `,o]}),(0,B.jsxs)(`details`,{className:a(`mt-2`),children:[(0,B.jsx)(`summary`,{className:a(`cursor-pointer text-red-600 text-xs`),children:`Show Code`}),(0,B.jsx)(`pre`,{className:a(`mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs`),children:e})]})]});let x=u||f;return(0,B.jsx)(`div`,{className:a(`size-full`,t),"data-streamdown":`mermaid`,ref:b,children:(0,B.jsx)(xwe,{className:a(r?`size-full overflow-hidden`:`overflow-hidden`,t),fullscreen:r,maxZoom:3,minZoom:.5,showControls:i,zoomStep:.1,children:(0,B.jsx)(`div`,{"aria-label":`Mermaid chart`,className:a(`flex justify-center`,r?`size-full items-center`:null),dangerouslySetInnerHTML:{__html:x},role:`img`})})})};function Swe(e){return[GK,[uq,{}],[SB,{allowedImagePrefixes:e.allowedImagePrefixes??[`*`],allowedLinkPrefixes:e.allowedLinkPrefixes??[`*`],allowedProtocols:e.allowedProtocols??[`*`],allowDataImages:e.allowDataImages??!0,defaultOrigin:e.defaultOrigin,blockedLinkClass:e.blockedLinkClass,blockedImageClass:e.blockedImageClass}]]}var _Q=(0,z.forwardRef)(({components:e,componentsByLanguage:t,preprocess:n,defer:r=!1,smooth:i=!1,plugins:a,containerProps:o,containerClassName:s,caret:c,controls:l,linkSafety:u,remend:d,mermaid:f,parseIncompleteMarkdown:p,allowedTags:m,remarkRehypeOptions:h,security:g,BlockComponent:_,parseMarkdownIntoBlocksFn:v,mode:y=`streaming`,className:b,shikiTheme:x,...S},C)=>{let w=$F(),{text:T,status:E}=iI((0,z.useMemo)(()=>n?{...w,text:n(w.text)}:w,[w,n]),i),D=(0,z.useDeferredValue)(T),O=r?D:T,k=y===`streaming`&&p!==!1&&!v,ee=(0,z.useMemo)(()=>k?eB(O,d):O,[k,O,d]),A=k?!1:p,j=(0,z.useMemo)(()=>{let e=oR(a,{});return Object.keys(e).length>0?e:void 0},[a]),te=(0,z.useMemo)(()=>x??(j?.code?iR:void 0),[x,j?.code]),ne=sB({components:e,componentsByLanguage:t}),M=(0,z.useMemo)(()=>{let{SyntaxHighlighter:t,CodeHeader:n,...r}=e??{};return{...r,...ne}},[e,ne]),N=(0,z.useMemo)(()=>[s,o?.className].filter(Boolean).join(` `)||void 0,[s,o?.className]),re=(0,z.useMemo)(()=>g?Swe(g):void 0,[g]),ie={...b&&{className:b},...c&&{caret:c},...l!==void 0&&{controls:l},...u&&{linkSafety:u},...d&&{remend:d},...f&&{mermaid:f},...A!==void 0&&{parseIncompleteMarkdown:A},...m&&{allowedTags:m},...j&&{plugins:j},...te&&{shikiTheme:te},...h&&{remarkRehypeOptions:h},...re&&{rehypePlugins:re},..._&&{BlockComponent:_},...v&&{parseMarkdownIntoBlocksFn:v}};return(0,B.jsx)(`div`,{ref:C,"data-status":E.type,...o,className:N,children:(0,B.jsx)(hQ,{mode:y,isAnimating:E.type===`running`,components:M,...ie,...S,children:ee})})});_Q.displayName=`StreamdownTextPrimitive`;function Cwe(e){return typeof e==`string`&&/^(https?:|mailto:)/i.test(e.trim())}function vQ({href:e,children:t,node:n,...r}){return Cwe(e)?(0,B.jsx)(`a`,{...r,href:e,target:`_blank`,rel:`noopener noreferrer`,children:t}):(0,B.jsx)(`span`,{...r,children:t})}var wwe={a:vQ},Twe={a:vQ};function yQ({text:e}){return(0,B.jsx)(hQ,{className:`oc-md`,components:Twe,children:e})}var Ewe=(0,z.memo)(function(){return(0,B.jsx)(_Q,{className:`oc-md`,smooth:!U(e=>e.metadata?.custom?.hasMergedRuns===!0),components:wwe})}),Dwe=new Set(`txt.md.markdown.csv.tsv.log.json.yaml.yml.xml.html.css.js.ts.tsx.jsx.py.rb.go.rs.java.c.h.cpp.hpp.sh.bash.sql.toml.ini.env`.split(`.`)),Owe=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`avif`,`bmp`]),kwe=new Set([`application/vnd.openxmlformats-officedocument.presentationml.presentation`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`application/vnd.ms-powerpoint`,`application/msword`,`application/vnd.ms-excel`,`application/vnd.oasis.opendocument.text`,`application/vnd.oasis.opendocument.presentation`,`application/vnd.oasis.opendocument.spreadsheet`,`application/rtf`]),Awe=new Set([`pptx`,`ppt`,`docx`,`doc`,`xlsx`,`xls`,`odt`,`odp`,`ods`,`rtf`]);function bQ(e,t){let n=(e??``).toLowerCase();if(kwe.has(n))return!0;let r=xQ(t);return r!==null&&Awe.has(r)}function xQ(e){if(!e)return null;let t=e.lastIndexOf(`.`);return t<=0||t===e.length-1?null:e.slice(t+1).toLowerCase()}function SQ(e,t){let n=(e??``).split(`;`)[0].trim().toLowerCase(),r=xQ(t);if(n===`application/pdf`)return`pdf`;if(n.startsWith(`image/`))return`image`;if(n.startsWith(`video/`))return`video`;if(n.startsWith(`audio/`))return`audio`;if(n===`text/markdown`)return`markdown`;if(n===`text/csv`||n===`text/tab-separated-values`)return`csv`;if(n===`application/json`||n.endsWith(`+json`))return`json`;if(n===`text/x-log`)return`log`;if(n===``||n===`text/plain`||n===`application/octet-stream`||n===`binary/octet-stream`){if(r===`md`||r===`markdown`)return`markdown`;if(r===`csv`||r===`tsv`)return`csv`;if(r===`json`)return`json`;if(r===`log`)return`log`}return n.startsWith(`text/`)||n===`application/json`||n===`application/xml`||n===`application/x-yaml`?`text`:r===`pdf`?`pdf`:r!==null&&Owe.has(r)?`image`:r!==null&&Dwe.has(r)?`text`:`none`}var jwe=[`fit`,.5,.75,1,1.5,2];function CQ(e,t){return Number.isFinite(e)?Math.min(Math.max(1,Math.floor(e)),Math.max(1,Math.floor(t))):1}var wQ=512*1024,Mwe=1e3,Nwe=5e3;function Pwe(e,t){if((e??``).split(`;`)[0].trim().toLowerCase()===`text/tab-separated-values`||xQ(t)===`tsv`)return` `}function Fwe(e){let t=`,`,n=0;for(let r of[`,`,`;`,` `]){let i=TQ(e,r).length;i>n&&(t=r,n=i)}return t}function TQ(e,t){let n=[],r=``,i=!1;for(let a=0;a<e.length;a++){let o=e[a];i?o===`"`?e[a+1]===`"`?(r+=`"`,a++):i=!1:r+=o:o===`"`?i=!0:o===t?(n.push(r),r=``):r+=o}return n.push(r),n}function Iwe(e,t=Mwe,n){let r=[],i=``,a=!1,o=e.replace(/\r\n/g,`
|
|
237
|
+
`).replace(/\r/g,`
|
|
238
|
+
`);for(let e of o)e===`"`&&(a=!a),e===`
|
|
239
|
+
`&&!a?(r.push(i),i=``):i+=e;i!==``&&r.push(i);let s=r.findIndex(e=>e.trim()!==``);if(s===-1)return{header:[],rows:[],totalRows:0,truncatedRows:!1,delimiter:`,`};let c=n??Fwe(r[s]),l=TQ(r[s],c),u=r.slice(s+1);return{header:l,rows:u.slice(0,t).map(e=>TQ(e,c)),totalRows:u.length,truncatedRows:u.length>t,delimiter:c}}function Lwe(e,t){let n=e.trim(),r=t.trim();if(/^-?\d+$/.test(n)&&/^-?\d+$/.test(r)){let e=BigInt(n),t=BigInt(r);return e<t?-1:+(e>t)}let i=Number(e),a=Number(t);return n!==``&&r!==``&&!Number.isNaN(i)&&!Number.isNaN(a)?i-a:e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function Rwe(e){return/\b(error|err|fatal|critical|panic)\b/i.test(e)?`error`:/\b(warn|warning)\b/i.test(e)?`warn`:/\b(info|notice)\b/i.test(e)?`info`:/\b(debug|trace|verbose)\b/i.test(e)?`debug`:`plain`}var EQ=60;function DQ({url:e,filename:t}){let[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(!1),[o,s]=(0,z.useState)(1),[c,l]=(0,z.useState)(`fit`);if((0,z.useEffect)(()=>{let t=!1,n=null;return r(null),a(!1),s(1),(async()=>{try{let i=await BX(()=>import(`./pdf-BZkOsg6N.js`),[]);i.GlobalWorkerOptions.workerSrc=new URL(`/assets/pdf.worker.min-CHFwMXne.mjs`,``+import.meta.url).toString();let a=i.getDocument({url:e}),o=await a.promise;if(t){a.destroy().catch(()=>{});return}n=a,r(o)}catch(e){console.error(`[docviewer] pdf load failed:`,e?.message??e),t||a(!0)}})(),()=>{t=!0,n&&n.destroy().catch(()=>{})}},[e]),i)return(0,B.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,B.jsx)(`p`,{children:ze()}),(0,B.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`oc-docviewer__fallbacklink`,children:Wl()})]});if(n===null)return(0,B.jsx)(`div`,{className:`oc-docviewer__loading`,children:_l()});let u=n.numPages,d=CQ(o,u);return(0,B.jsxs)(`div`,{className:`oc-docviewer__pdf`,children:[(0,B.jsxs)(`div`,{className:`oc-docviewer__toolbar`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-docviewer__navbtn`,onClick:()=>s(e=>CQ(e-1,u)),disabled:d<=1,"aria-label":Bo(),children:(0,B.jsx)(Jx,{size:15})}),(0,B.jsxs)(`span`,{className:`oc-docviewer__pageinfo`,children:[d,` / `,u]}),(0,B.jsx)(`button`,{type:`button`,className:`oc-docviewer__navbtn`,onClick:()=>s(e=>CQ(e+1,u)),disabled:d>=u,"aria-label":Ya(),children:(0,B.jsx)(Yx,{size:15})}),(0,B.jsx)(`select`,{className:`oc-docviewer__zoom`,value:String(c),onChange:e=>{let t=e.target.value;l(t===`fit`?`fit`:Number(t))},"aria-label":pr(),children:jwe.map(e=>(0,B.jsx)(`option`,{value:String(e),children:e===`fit`?Kc():`${Math.round(e*100)}%`},String(e)))})]}),(0,B.jsxs)(`div`,{className:`oc-docviewer__pdfbody`,children:[u>1?(0,B.jsxs)(`div`,{className:`oc-docviewer__rail`,"aria-label":_n(),children:[Array.from({length:Math.min(u,EQ)},(e,t)=>(0,B.jsx)(Bwe,{doc:n,page:t+1,active:t+1===d,onClick:()=>s(t+1)},t+1)),u>EQ?(0,B.jsxs)(`span`,{className:`oc-docviewer__railmore`,children:[`+`,u-EQ]}):null]}):null,(0,B.jsx)(zwe,{doc:n,page:d,zoom:c,filename:t})]})]})}function zwe({doc:e,page:t,zoom:n,filename:r}){let i=(0,z.useRef)(null),a=(0,z.useRef)(null),[o,s]=(0,z.useState)(0);return(0,z.useEffect)(()=>{let e=i.current;if(!e)return;let t=new ResizeObserver(e=>{let t=e[0]?.contentRect.width??0;s(e=>Math.abs(e-t)>1?t:e)});return t.observe(e),()=>t.disconnect()},[]),(0,z.useEffect)(()=>{let r=!1,i=null;return(async()=>{try{let s=await e.getPage(t),c=a.current;if(r||!c)return;let l=s.getViewport({scale:1}),u=n===`fit`?Math.max(.1,(o-16)/l.width):n,d=window.devicePixelRatio||1,f=s.getViewport({scale:u*d});c.width=Math.floor(f.width),c.height=Math.floor(f.height),c.style.width=`${Math.floor(f.width/d)}px`,c.style.height=`${Math.floor(f.height/d)}px`;let p=s.render({canvas:c,viewport:f});i=p,await p.promise}catch(e){e?.name!==`RenderingCancelledException`&&console.error(`[docviewer] page render failed:`,e?.message??e)}})(),()=>{r=!0,i?.cancel()}},[e,t,n,o]),(0,B.jsx)(`div`,{ref:i,className:`oc-docviewer__main`,children:(0,B.jsx)(`canvas`,{ref:a,className:`oc-docviewer__canvas`,"aria-label":r})})}function Bwe({doc:e,page:t,active:n,onClick:r}){let i=(0,z.useRef)(null);return(0,z.useEffect)(()=>{let n=!1,r=null;return(async()=>{try{let a=await e.getPage(t),o=i.current;if(n||!o)return;let s=104/a.getViewport({scale:1}).width,c=a.getViewport({scale:s});o.width=Math.floor(c.width),o.height=Math.floor(c.height);let l=a.render({canvas:o,viewport:c});r=l,await l.promise}catch(e){e?.name!==`RenderingCancelledException`&&console.error(`[docviewer] thumbnail render failed:`,e?.message??e)}})(),()=>{n=!0,r?.cancel()}},[e,t]),(0,B.jsxs)(`button`,{type:`button`,className:`oc-docviewer__thumb${n?` is-active`:``}`,onClick:r,"aria-label":Ea({page:t}),"aria-current":n?`true`:void 0,children:[(0,B.jsx)(`canvas`,{ref:i,className:`oc-docviewer__thumbcanvas`}),(0,B.jsx)(`span`,{className:`oc-docviewer__thumbnum`,children:t})]})}var OQ={current:null},kQ=(0,z.createContext)(OQ);function Vwe(e){let t=0,n=e.match(/`+/g);if(n!==null)for(let e of n)t=Math.max(t,e.length);return"`".repeat(Math.max(3,t+1))}function Hwe(e,t,n){let r=Vwe(t);return`\n${e} ${n}\n${r}\n${t}\n${r}\n`}function Uwe(e,t){let n=e.length,r=1;for(let t=0;t<e.length;t++)e.charCodeAt(t)===10&&r++;return n<=8e3&&r<=150?{kind:`inline`,lines:r,chars:n}:{kind:`file`,filename:`texte-colle-${t}.txt`,lines:r,chars:n}}var AQ=new WeakSet;function jQ(e){AQ.add(e)}function MQ(e){return AQ.has(e)}var NQ=(0,z.createContext)({activeDoc:null,openFor:()=>{},openNewerVersion:()=>{},close:()=>{}});function PQ(){return(0,z.useContext)(NQ)}function FQ({doc:e,chatId:t,onClose:n}){let r=SQ(e.mimeType,e.filename),i=r===`none`&&e.sourceStorageId!==void 0,a=PQ(),o=P(L.documentDrafts.latestDeliveredFile,t===null?`skip`:{chatId:t,filename:e.filename,...e.storageId===void 0?{}:{currentStorageId:e.storageId}}),s=o!=null&&(e.storageId===void 0?o.url!==e.url:o.storageId!==e.storageId)?o:null;return(0,B.jsxs)(`div`,{className:`oc-docviewer`,children:[(0,B.jsxs)(`header`,{className:`oc-docviewer__header`,children:[(0,B.jsx)(fS,{size:15,"aria-hidden":!0,className:`oc-docviewer__icon`}),(0,B.jsx)(`span`,{className:`oc-docviewer__name`,title:e.filename,children:e.filename}),(0,B.jsx)(`a`,{className:`oc-docviewer__action`,href:e.url,target:`_blank`,rel:`noopener noreferrer`,title:Wl(),"aria-label":Wl(),children:(0,B.jsx)(lS,{size:14})}),(0,B.jsx)(`a`,{className:`oc-docviewer__action`,href:e.url,download:e.filename,title:qd(),"aria-label":qd(),children:(0,B.jsx)(oS,{size:14})}),(0,B.jsx)(Ov,{type:`button`,size:`icon-sm`,variant:`ghost`,onClick:n,"aria-label":Mte(),children:(0,B.jsx)(uv,{size:15})})]}),(0,B.jsxs)(`div`,{className:`oc-docviewer__body`,children:[s===null?null:(0,B.jsxs)(`div`,{className:`oc-docviewer__newversion`,role:`status`,children:[(0,B.jsx)(`span`,{children:kd()}),(0,B.jsx)(Ov,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>a.openNewerVersion({url:s.url,filename:e.filename,mimeType:s.mimeType||null,storageId:s.storageId,sourceStorageId:bQ(s.mimeType,e.filename)?s.storageId:void 0}),children:bm()})]}),r===`pdf`?(0,B.jsx)(DQ,{url:e.url,filename:e.filename}):r===`image`?(0,B.jsx)(`div`,{className:`oc-docviewer__imagewrap`,children:(0,B.jsx)(`img`,{src:e.url,alt:e.filename,className:`oc-docviewer__image`})}):r===`video`?(0,B.jsx)(`video`,{controls:!0,preload:`metadata`,src:e.url,className:`oc-docviewer__video`}):r===`audio`?(0,B.jsx)(`div`,{className:`oc-docviewer__audiowrap`,children:(0,B.jsx)(`audio`,{controls:!0,preload:`metadata`,src:e.url,className:`oc-docviewer__audio`})}):r===`text`?(0,B.jsx)(LQ,{url:e.url,chatId:t,filename:e.filename,mimeType:e.mimeType,storageId:e.storageId??null},e.url):r===`markdown`||r===`csv`||r===`log`||r===`json`?(0,B.jsx)(LQ,{url:e.url,chatId:t,filename:e.filename,mimeType:e.mimeType,storageId:e.storageId??null,rich:r,csvDelimiter:r===`csv`?Pwe(e.mimeType,e.filename):void 0},e.url):i?(0,B.jsx)(Wwe,{sourceStorageId:e.sourceStorageId,chatId:t,downloadUrl:e.url,filename:e.filename}):(0,B.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,B.jsx)(`p`,{children:rv()}),(0,B.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`oc-docviewer__fallbacklink`,children:qd()})]})]})]})}function Wwe({sourceStorageId:e,chatId:t,downloadUrl:n,filename:r}){let i=t===null?{}:{chatId:t},a=P(L.fileRenditions.getRendition,{sourceStorageId:e,...i}),o=I(L.fileRenditions.requestRendition),s=(0,z.useRef)(null);return(0,z.useEffect)(()=>{s.current=null},[e]),(0,z.useEffect)(()=>{a?.status===`pending`&&s.current!==e&&(s.current=e,o({sourceStorageId:e,...i}).catch(e=>{console.error(`[docviewer] rendition request failed:`,e)}))},[a?.status,e,o]),a===void 0?(0,B.jsx)(`div`,{className:`oc-docviewer__loading`,children:_l()}):a.status===`ready`?(0,B.jsx)(DQ,{url:a.pdfUrl,filename:a.filename}):a.status===`pending`?(0,B.jsxs)(`div`,{className:`oc-docviewer__preparing`,children:[(0,B.jsx)(`span`,{className:`oc-docviewer__spinner`,"aria-hidden":!0}),(0,B.jsx)(`p`,{children:Ns()}),(0,B.jsx)(`a`,{href:n,download:r,className:`oc-docviewer__fallbacklink`,children:qd()})]}):(0,B.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,B.jsx)(`p`,{children:a.status===`unconfigured`?rv():ia()}),(0,B.jsx)(`a`,{href:n,download:r,className:`oc-docviewer__fallbacklink`,children:qd()})]})}function Gwe(e){switch(e){case`markdown`:return fte();case`csv`:return _re();case`log`:return Fp();case`json`:return O()}}var IQ=e=>`oc.docviewer.raw.${e}`;function LQ({url:e,chatId:t,filename:n,mimeType:r,storageId:i,rich:a,csvDelimiter:o}){let[s,c]=(0,z.useState)({phase:`loading`}),[l,u]=(0,z.useState)(()=>a?localStorage.getItem(IQ(a))===`1`:!1),d=e=>{u(e),a&&localStorage.setItem(IQ(a),e?`1`:`0`)},[f,p]=(0,z.useState)(!1),m=P(L.documentDrafts.getDraft,t===null?`skip`:{chatId:t,filename:n}),h=t!==null&&s.phase===`ready`&&!s.truncated&&m!==void 0;if((0,z.useEffect)(()=>{let t=!1;return c({phase:`loading`}),(async()=>{try{let n=await fetch(e);if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.blob(),i=r.size>wQ,a=await(i?r.slice(0,wQ):r).text();t||c({phase:`ready`,text:a,truncated:i})}catch(e){console.error(`[docviewer] text fetch failed:`,e?.message??e),t||c({phase:`error`})}})(),()=>{t=!0}},[e]),s.phase===`loading`)return(0,B.jsx)(`div`,{className:`oc-docviewer__loading`,children:_l()});if(s.phase===`error`)return(0,B.jsxs)(`div`,{className:`oc-docviewer__fallback`,children:[(0,B.jsx)(`p`,{children:ze()}),(0,B.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`oc-docviewer__fallbacklink`,children:Wl()})]});let g=a!==void 0&&!l,_=s.truncated?(0,B.jsx)(`p`,{className:`oc-docviewer__truncated`,children:Fr()}):null,v=m?.text??s.text,y=m==null?null:(0,B.jsx)(Kwe,{chatId:t,filename:n,diverged:m.sourceStorageId!==null&&i!==null&&m.sourceStorageId!==i}),b=f?(0,B.jsx)(qwe,{chatId:t,filename:n,mimeType:r,sourceStorageId:i,initialText:v,hasDraft:m!=null,onExit:()=>p(!1)}):g&&a===`markdown`?(0,B.jsx)(`div`,{className:`oc-docviewer__mdwrap`,children:(0,B.jsx)(yQ,{text:v})}):g&&a===`csv`?(0,B.jsx)(Jwe,{text:v,textTruncated:s.truncated,delimiter:o}):g&&a===`log`?(0,B.jsx)(Ywe,{text:v,textTruncated:s.truncated}):g&&a===`json`?(0,B.jsx)(Xwe,{text:v}):(0,B.jsx)(`pre`,{className:`oc-docviewer__text`,children:v});return a===void 0&&!h?(0,B.jsxs)(`div`,{className:`oc-docviewer__textwrap`,children:[_,y,b]}):(0,B.jsxs)(`div`,{className:`oc-docviewer__textwrap oc-docviewer__textwrap--bar`,children:[(0,B.jsxs)(`div`,{className:`oc-docviewer__mdbar`,role:`group`,"aria-label":sh(),children:[a===void 0?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ov,{type:`button`,size:`sm`,variant:g&&!f?`secondary`:`ghost`,"aria-pressed":g&&!f,onClick:()=>{p(!1),d(!1)},children:Gwe(a)}),(0,B.jsx)(Ov,{type:`button`,size:`sm`,variant:l&&!f?`secondary`:`ghost`,"aria-pressed":l&&!f,onClick:()=>{p(!1),d(!0)},children:Pne()})]}),h?(0,B.jsxs)(Ov,{type:`button`,size:`sm`,variant:f?`secondary`:`ghost`,"aria-pressed":f,onClick:()=>p(e=>!e),className:`oc-docviewer__editbtn`,children:[(0,B.jsx)(WS,{size:13,"aria-hidden":!0}),pe(),m==null?null:(0,B.jsx)(`span`,{className:`oc-docviewer__draftdot`,"aria-hidden":!0})]}):null]}),f?b:(0,B.jsx)(`div`,{className:`oc-docviewer__textscroll`,children:(0,B.jsxs)(`div`,{className:`oc-docviewer__scrollpad`,children:[_,y,b]})})]})}function Kwe({chatId:e,filename:t,diverged:n}){let r=I(L.documentDrafts.deleteDraft),i=EL();return(0,B.jsxs)(`p`,{className:`oc-docviewer__draftnote`,children:[n?eie():Pie(),(0,B.jsx)(`button`,{type:`button`,className:`oc-docviewer__draftnote-discard`,onClick:()=>void r({chatId:e,filename:t}).then(e=>{e.applied===!1&&i.error(rm())}).catch(()=>i.error(Ig())),children:Sc()})]})}function qwe({chatId:e,filename:t,mimeType:n,sourceStorageId:r,initialText:i,hasDraft:a,onExit:o}){let s=I(L.documentDrafts.saveDraft),c=I(L.documentDrafts.deleteDraft),l=(0,z.useContext)(kQ),u=EL(),d=`oc.docdraft.fallback.${e}.${t}`,[f,p]=(0,z.useState)(()=>{try{let e=localStorage.getItem(d);if(e!==null)return e}catch{}return i}),[m,h]=(0,z.useState)(`idle`),g=(0,z.useRef)(0),_=(0,z.useRef)(f);_.current=f;let v=(0,z.useRef)(!1),y=(0,z.useRef)(!1),b=(0,z.useCallback)(n=>{h(`saving`),s({chatId:e,filename:t,text:n,...r!==null&&(y.current||!a)?{sourceStorageId:r}:{}}).then(e=>{if(e.applied===!1){u.error(rm()),h(`idle`);return}h(`saved`)}).catch(e=>{console.error(`[docviewer] draft save failed:`,e),u.error(String(e?.message??e).includes(`draft_limit_reached`)?Jt():Tt()),h(`idle`)})},[s,e,t,r,a,u]),x=e=>{y.current=!0,p(e),window.clearTimeout(g.current),g.current=window.setTimeout(()=>b(e),800)};return(0,z.useEffect)(()=>{try{localStorage.getItem(d)!==null&&(y.current=!0,s({chatId:e,filename:t,text:_.current,...r===null?{}:{sourceStorageId:r}}).then(()=>localStorage.removeItem(d)))}catch{}let n=()=>{if(!(!y.current||v.current))try{localStorage.setItem(d,_.current)}catch{}};return window.addEventListener(`pagehide`,n),()=>{if(window.removeEventListener(`pagehide`,n),window.clearTimeout(g.current),!v.current&&y.current){try{localStorage.setItem(d,_.current)}catch{}s({chatId:e,filename:t,text:_.current,...r===null?{}:{sourceStorageId:r}}).then(()=>{try{localStorage.removeItem(d)}catch{}}).catch(()=>{})}}},[]),(0,B.jsxs)(`div`,{className:`oc-docviewer__editor`,children:[(0,B.jsx)(`textarea`,{className:`oc-docviewer__editarea`,value:f,onChange:e=>x(e.target.value),spellCheck:!1,"aria-label":pe()}),(0,B.jsxs)(`div`,{className:`oc-docviewer__editbar`,children:[(0,B.jsx)(`span`,{className:`oc-docviewer__savestate`,role:`status`,children:m===`saving`?og():m===`saved`?go():`\xA0`}),(0,B.jsx)(Ov,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{v.current=!0,window.clearTimeout(g.current);try{localStorage.removeItem(d)}catch{}c({chatId:e,filename:t}).then(e=>{if(e.applied===!1){v.current=!1,u.error(rm());return}o()}).catch(e=>{console.error(`[docviewer] draft discard failed:`,e),v.current=!1,u.error(Ig())})},children:Sc()}),(0,B.jsx)(Ov,{type:`button`,size:`sm`,variant:`secondary`,onClick:()=>{let e=l?.current??null;if(e===null){u.error(Ef());return}if(window.clearTimeout(g.current),b(f),e.canAttach){let r=(n??`text/plain`).split(`;`)[0].trim(),i=new File([f],t,{type:`${r}; charset=utf-8`});e.attachFile(i).catch(e=>{console.error(`[docviewer] attach failed:`,e),u.error(gie())})}else{if(f.length>8e3){u.error($ee());return}e.insertText(Hwe(t,f,Gm()))}},children:N_()})]})]})}function Jwe({text:e,textTruncated:t,delimiter:n}){let r=(0,z.useMemo)(()=>Iwe(e,void 0,n),[e,n]),[i,a]=(0,z.useState)(null),o=(0,z.useMemo)(()=>i?[...r.rows].sort((e,t)=>Lwe(e[i.col]??``,t[i.col]??``)*i.dir):r.rows,[r.rows,i]);if(r.header.length===0)return(0,B.jsx)(`pre`,{className:`oc-docviewer__text`,children:e});let s=r.header.slice(0,100),c=r.header.length>s.length;return(0,B.jsxs)(`div`,{className:`oc-docviewer__csvwrap`,children:[r.truncatedRows?(0,B.jsx)(`p`,{className:`oc-docviewer__truncated`,children:t?sd({shown:r.rows.length}):ds({shown:r.rows.length,total:r.totalRows})}):null,c?(0,B.jsx)(`p`,{className:`oc-docviewer__truncated`,children:mu({shown:s.length,total:r.header.length})}):null,(0,B.jsxs)(`table`,{className:`oc-docviewer__csv`,children:[(0,B.jsx)(`thead`,{children:(0,B.jsx)(`tr`,{children:s.map((e,t)=>(0,B.jsx)(`th`,{children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-docviewer__csvsort`,onClick:()=>a(e=>e?.col===t?e.dir===1?{col:t,dir:-1}:null:{col:t,dir:1}),"aria-label":zu({column:e}),children:[e,i?.col===t?i.dir===1?` ▲`:` ▼`:``]})},t))})}),(0,B.jsx)(`tbody`,{children:o.map((e,t)=>(0,B.jsx)(`tr`,{children:s.map((t,n)=>(0,B.jsx)(`td`,{children:e[n]??``},n))},t))})]})]})}function Ywe({text:e,textTruncated:t}){let n=(0,z.useMemo)(()=>{let t=e.split(`
|
|
240
|
+
`);return t.length>1&&t[t.length-1]===``&&t.pop(),t},[e]),r=(0,z.useMemo)(()=>n.slice(0,Nwe),[n]);return(0,B.jsxs)(B.Fragment,{children:[n.length>r.length?(0,B.jsx)(`p`,{className:`oc-docviewer__truncated`,children:t?Tne({shown:r.length}):si({shown:r.length,total:n.length})}):null,(0,B.jsx)(`pre`,{className:`oc-docviewer__text oc-docviewer__logview`,children:r.map((e,t)=>(0,B.jsxs)(`span`,{className:`oc-logline oc-logline--${Rwe(e)}`,children:[e,`
|
|
241
|
+
`]},t))})]})}function Xwe({text:e}){let t=(0,z.useMemo)(()=>{try{return{ok:!0,value:JSON.parse(e,(e,t,n)=>{if(typeof t==`number`&&Number.isInteger(t)&&!Number.isSafeInteger(t)&&typeof n?.source==`string`&&/^-?\d+$/.test(n.source))try{return BigInt(n.source)}catch{return t}return t})}}catch{return{ok:!1}}},[e]);return t.ok?(0,B.jsx)(`div`,{className:`oc-docviewer__jsonwrap`,children:(0,B.jsx)(RQ,{value:t.value,depth:0})}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`oc-docviewer__truncated`,children:Fi()}),(0,B.jsx)(`pre`,{className:`oc-docviewer__text`,children:e})]})}function Zwe(e){if(Array.isArray(e))return e.length;let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function Qwe(e,t){if(Array.isArray(e))return e.slice(0,t).map((e,t)=>[String(t),e]);let n=[];for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(n.length>=t)break;n.push([r,e[r]])}return n}function RQ({value:e,depth:t,name:n}){let r=typeof e==`object`&&!!e,i=r?Zwe(e):0,[a,o]=(0,z.useState)(t<2&&i<=100),s=n===void 0?null:(0,B.jsxs)(`span`,{className:`oc-json__key`,children:[n,`: `]});if(!r)return(0,B.jsxs)(`div`,{className:`oc-json__leaf`,children:[s,(0,B.jsx)(`span`,{className:`oc-json__val oc-json__val--${e===null?`null`:typeof e==`bigint`?`number`:typeof e}`,children:typeof e==`bigint`?e.toString():JSON.stringify(e)})]});let c=a?Qwe(e,500):[];return(0,B.jsxs)(`details`,{className:`oc-json__node`,open:a,onToggle:e=>o(e.target.open),children:[(0,B.jsxs)(`summary`,{children:[s,(0,B.jsx)(`span`,{className:`oc-json__summary`,children:Array.isArray(e)?`[${i}]`:`{${i}}`})]}),a?(0,B.jsxs)(`div`,{className:`oc-json__children`,children:[c.map(([e,n])=>(0,B.jsx)(RQ,{name:e,value:n,depth:t+1},e)),i>c.length?(0,B.jsx)(`div`,{className:`oc-json__more`,children:Un({count:i-c.length})}):null]}):null]})}var zQ=(0,z.createContext)(null);function $we(){return(0,z.useContext)(zQ)??{open:()=>{}}}function BQ({children:e}){let[t,n]=(0,z.useState)(null),[r,i]=(0,z.useState)(!1),[a,o]=(0,z.useState)(!1),s=(0,z.useRef)(null),c=(0,z.useCallback)(e=>{n(e),i(!1)},[]),l=(0,z.useCallback)(()=>{document.fullscreenElement&&document.exitFullscreen().catch(()=>{}),n(null),o(!1)},[]);(0,z.useEffect)(()=>{if(t===null)return;let e=e=>{e.key===`Escape`&&l()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,l]),(0,z.useEffect)(()=>{let e=()=>o(document.fullscreenElement!==null);return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]);let u=(0,z.useCallback)(()=>{let e=s.current;e&&(document.fullscreenElement?document.exitFullscreen().catch(()=>{}):e.requestFullscreen().catch(()=>{}))},[]);return(0,B.jsxs)(zQ.Provider,{value:{open:c},children:[e,t===null?null:(0,Ex.createPortal)((0,B.jsxs)(`div`,{ref:s,className:`oc-lightbox`,role:`dialog`,"aria-modal":`true`,"aria-label":t.name,onClick:e=>{e.target===e.currentTarget&&l()},children:[(0,B.jsxs)(`div`,{className:`oc-lightbox__bar`,children:[(0,B.jsx)(`span`,{className:`oc-lightbox__name`,title:t.name,children:t.name}),(0,B.jsx)(`button`,{type:`button`,className:`oc-lightbox__btn`,onClick:()=>i(e=>!e),"aria-label":r?Cs():Ji(),title:r?Cs():Ji(),children:r?(0,B.jsx)(OC,{size:18}):(0,B.jsx)(DC,{size:18})}),(0,B.jsx)(`button`,{type:`button`,className:`oc-lightbox__btn`,onClick:u,"aria-label":a?sn():Er(),title:a?sn():Er(),children:a?(0,B.jsx)(FS,{size:18}):(0,B.jsx)(OS,{size:18})}),(0,B.jsx)(`a`,{className:`oc-lightbox__btn`,href:t.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":Ao(),title:Ao(),children:(0,B.jsx)(lS,{size:18})}),(0,B.jsx)(`button`,{type:`button`,className:`oc-lightbox__btn`,onClick:l,"aria-label":Ra(),title:Ra(),children:(0,B.jsx)(uv,{size:18})})]}),(0,B.jsx)(`div`,{className:`oc-lightbox__stage${r?` oc-lightbox__stage--scroll`:``}`,onClick:e=>{e.target===e.currentTarget&&l()},children:(0,B.jsx)(`img`,{src:t.url,alt:t.name,className:r?`oc-lightbox__img--actual`:`oc-lightbox__img--fit`,decoding:`async`})})]}),document.body)]})}function VQ({className:e,...t}){return(0,B.jsx)(jj,{"data-slot":`checkbox`,className:Wg(`peer size-4 shrink-0 rounded-[4px] border border-input bg-background ring-offset-background transition-shadow outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=indeterminate]:border-primary data-[state=indeterminate]:bg-primary data-[state=indeterminate]:text-primary-foreground`,e),...t,children:(0,B.jsx)(Nj,{"data-slot":`checkbox-indicator`,className:`flex items-center justify-center text-current`,children:t.checked===`indeterminate`?(0,B.jsx)(IS,{className:`size-3.5`}):(0,B.jsx)(qx,{className:`size-3.5`})})})}function HQ(e,t){return t===`memory`?`memory`:e.context===!0||!e.file_name?`context`:`document`}function UQ(e){let t={memory:0,documents:0,context:0};for(let n of e)for(let e of n.items){let r=HQ(e,n.group);r===`memory`?t.memory+=1:r===`document`?t.documents+=1:t.context+=1}return t}function eTe(e){return e.memory+e.documents+e.context>0}function WQ(e){let t=[];return e.memory>0&&t.push(e.memory===1?Om():Lee({count:e.memory})),e.documents>0&&t.push(e.documents===1?Wte():Xp({count:e.documents})),e.context>0&&t.push(e.context===1?Pf():Kne({count:e.context})),t.join(` · `)}function GQ(e){return e.title??e.file_name??e.id??e.type??$m()}function KQ(e){return e.title&&e.file_name?e.file_name:void 0}function tTe(e){return e.file_name??GQ(e)}function qQ(e){let t=[];return e.type&&GQ(e)!==e.type&&t.push(e.type),e.date&&t.push(e.date),e.collection&&t.push(e.collection),typeof e.score==`number`&&t.push(Ld({score:e.score.toFixed(2)})),t}function JQ(e,t){let n=[];return e.forEach((e,r)=>{e.group===t&&e.items.forEach((t,i)=>{n.push({key:`${e.pluginId}|${e.group}|${t.id??t.file_name??`?`}|${r}.${i}`,group:e.group,pluginId:e.pluginId,source:e.source,item:t})})}),n.sort((e,t)=>(t.item.score??0)-(e.item.score??0))}function YQ(e,t){let n=t.trim().toLowerCase();return n===``?!0:[QQ(e),e.item.file_name??``,e.item.text??``,...qQ(e.item)].join(` `).toLowerCase().includes(n)}function XQ(e){return HQ(e.item,e.group)===`document`}function ZQ(e){return HQ(e.item,e.group)===`context`}function QQ(e){return ZQ(e)?Ste():GQ(e.item)}var $Q=(0,z.createContext)(null),nTe=[];function rTe(){let e=U(e=>e.metadata?.custom?.provenanceParts??nTe),t=U(e=>e.metadata?.custom?.messageId),n=U(e=>e.metadata?.custom?.attachedDocCount??0),r=(0,z.useContext)($Q),i=UQ(e);if(e.length===0||!eTe(i))return null;let a=r?.activeMessageId===t&&t!==void 0,o=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`oc-actrow__counts`,children:WQ(i)}),n>0?(0,B.jsxs)(`span`,{className:`oc-actrow__badge`,title:Hu({count:n}),children:[(0,B.jsx)(oS,{size:12,"aria-hidden":!0}),n]}):null]});return(0,B.jsx)(JL,{icon:(0,B.jsx)(fS,{size:14}),label:mee(),trailing:o,active:a,ariaExpanded:a,ariaHasPopup:!0,ariaLabel:ote(),onClick:()=>t&&r?.openFor(t)})}function e$({messageId:e,onClose:t}){let n=P(L.messages.getProvenanceParts,{messageId:e}),r=(0,z.useMemo)(()=>n??[],[n]),i=P(L.agents.documentaryAvailable,{}),a=P(L.documentAttachments.getDocumentAttachments,{sourceMessageId:e}),o=I(L.documentAttachments.attachDocuments),s=EL(),c=(0,z.useMemo)(()=>{let e=new Map;for(let t of a??[])e.set(t.entryKey,t);return e},[a]),l=(a??[]).some(e=>e.status===`pending`),[u,d]=(0,z.useState)(``),[f,p]=(0,z.useState)(!1),[m,h]=(0,z.useState)(!1),[g,_]=(0,z.useState)(!1),[v,y]=(0,z.useState)(new Set);(0,z.useEffect)(()=>{d(``),p(!1),h(!1),_(!1),y(new Set)},[e]);let b=(0,z.useMemo)(()=>JQ(r,`documents`).filter(e=>XQ(e)&&YQ(e,u)),[r,u]),x=(0,z.useMemo)(()=>JQ(r,`documents`).filter(e=>ZQ(e)&&YQ(e,u)),[r,u]),S=(0,z.useMemo)(()=>JQ(r,`memory`).filter(e=>YQ(e,u)),[r,u]),C=UQ(r),w=e=>y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),T=(e,t)=>y(n=>{let r=new Set(n);for(let n of e)t?r.add(n):r.delete(n);return r}),E=(0,z.useMemo)(()=>JQ(r,`documents`).filter(e=>XQ(e)&&v.has(e.key)),[r,v]),D=i!=null&&E.length>0&&!l;async function O(){if(D)try{await o({sourceMessageId:e,items:E.map(e=>({entryKey:e.key,reference:tTe(e.item)}))}),s.success(Kn())}catch(e){let t=wL(e);t.includes(`fetch_in_flight`)?s.error(Ri()):t.includes(`no_documentary_agent`)?s.error(Ug()):s.error(Jl(),e)}}let k=n===void 0;return(0,B.jsxs)(`div`,{className:`oc-sources-panel`,children:[(0,B.jsxs)(`div`,{className:`oc-sources-panel__head`,children:[(0,B.jsxs)(`div`,{className:`oc-sources-panel__heading`,children:[(0,B.jsx)(`h2`,{className:`oc-sources-panel__title`,children:Dne()}),(0,B.jsx)(`p`,{className:`oc-sources-panel__sub`,children:WQ(C)})]}),(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn`,onClick:t,"aria-label":Is(),title:Is(),children:(0,B.jsx)(uv,{size:16,"aria-hidden":!0})})]}),(0,B.jsxs)(`div`,{className:`oc-sources-panel__search`,children:[(0,B.jsx)($S,{size:15,"aria-hidden":!0}),(0,B.jsx)(VI,{value:u,onChange:e=>d(e.target.value),placeholder:$g(),"aria-label":$g()})]}),(0,B.jsx)(`div`,{className:`oc-sources-panel__body`,children:k?(0,B.jsx)(`p`,{className:`oc-sources-panel__empty`,children:(0,B.jsx)(wS,{size:14,className:`oc-iconbtn__spin`,"aria-hidden":!0})}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(t$,{icon:(0,B.jsx)(fS,{size:14,"aria-hidden":!0}),label:Ore(),count:b.length,expanded:f,onToggle:()=>p(e=>!e),entries:b,selectable:!0,selected:v,onToggle1:w,onToggleAll:e=>T(b.map(e=>e.key),e),attachmentByKey:c}),(0,B.jsx)(t$,{icon:(0,B.jsx)(zS,{size:14,"aria-hidden":!0}),label:vee(),count:x.length,expanded:m,onToggle:()=>h(e=>!e),entries:x,selectable:!1,selected:v,onToggle1:w,onToggleAll:e=>T(x.map(e=>e.key),e),attachmentByKey:c}),(0,B.jsx)(t$,{icon:(0,B.jsx)(Gx,{size:14,"aria-hidden":!0}),label:ip(),count:S.length,expanded:g,onToggle:()=>_(e=>!e),entries:S,selectable:!1,selected:v,onToggle1:w,onToggleAll:e=>T(S.map(e=>e.key),e),attachmentByKey:c}),b.length===0&&x.length===0&&S.length===0?(0,B.jsx)(`p`,{className:`oc-sources-panel__empty`,children:Dp()}):null]})}),E.length>0?(0,B.jsxs)(`div`,{className:`oc-sources-panel__actions`,children:[(0,B.jsxs)(`div`,{className:`oc-sources-panel__actrow`,children:[(0,B.jsx)(`span`,{className:`oc-sources-panel__selcount`,children:ms({count:E.length})}),(0,B.jsxs)(Ov,{variant:`outline`,size:`sm`,disabled:!D,onClick:()=>void O(),children:[l?(0,B.jsx)(wS,{size:14,className:`oc-iconbtn__spin`,"aria-hidden":!0}):(0,B.jsx)(uC,{size:14,"aria-hidden":!0}),ud()]})]}),(0,B.jsx)(`p`,{className:`oc-sources-panel__acthint`,children:i==null?Ug():l?Ri():_u()})]}):null]})}function t$({icon:e,label:t,count:n,expanded:r,onToggle:i,entries:a,selectable:o,selected:s,onToggle1:c,onToggleAll:l,attachmentByKey:u}){if(n===0)return null;let d=a.every(e=>s.has(e.key));return(0,B.jsxs)(`section`,{className:`oc-srcsec${r?` is-open`:``}`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-srcsec__head`,"aria-expanded":r,onClick:i,children:[r?(0,B.jsx)(cv,{size:14,"aria-hidden":!0}):(0,B.jsx)(Yx,{size:14,"aria-hidden":!0}),e,(0,B.jsx)(`span`,{className:`oc-srcsec__label`,children:t}),(0,B.jsx)(`span`,{className:`oc-srcsec__count`,children:n})]}),r?(0,B.jsxs)(`div`,{className:`oc-srcsec__body`,children:[o?(0,B.jsxs)(`label`,{className:`oc-srcsec__all`,children:[(0,B.jsx)(VQ,{checked:d,onCheckedChange:e=>l(e===!0)}),(0,B.jsx)(`span`,{children:A()})]}):null,a.map(e=>(0,B.jsx)(iTe,{entry:e,selectable:o,selected:s.has(e.key),onToggle:()=>c(e.key),attachment:u.get(e.key)},e.key))]}):null]})}function iTe({entry:e,selectable:t,selected:n,onToggle:r,attachment:i}){let[a,o]=(0,z.useState)(!1),s=(0,z.useRef)(null),[c,l]=(0,z.useState)(!1),{item:u}=e;(0,z.useEffect)(()=>{let e=s.current;if(!e)return;let t=()=>l(e.scrollHeight>e.clientHeight+1);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[u.text]);let d=qQ(u),f=typeof u.score==`number`?Math.max(0,Math.min(1,u.score)):null,p=XQ(e);return(0,B.jsxs)(`div`,{className:`oc-srccard${t&&n?` is-selected`:``}`,children:[t?(0,B.jsx)(`label`,{className:`oc-srccard__pick`,children:(0,B.jsx)(VQ,{checked:n,onCheckedChange:r})}):null,(0,B.jsxs)(`div`,{className:`oc-srccard__body`,children:[(0,B.jsx)(`div`,{className:`oc-srccard__title`,children:QQ(e)}),p&&KQ(e.item)?(0,B.jsx)(`div`,{className:`oc-srccard__subid`,title:KQ(e.item),children:KQ(e.item)}):null,d.length>0||f!==null?(0,B.jsxs)(`div`,{className:`oc-srccard__meta`,children:[d.map(e=>(0,B.jsx)(`span`,{className:`oc-srccard__chip`,children:e},e)),f===null?null:(0,B.jsx)(`span`,{className:`oc-srccard__relev`,title:Ld({score:f.toFixed(2)}),children:(0,B.jsx)(`span`,{className:`oc-srccard__relev-track`,"aria-hidden":!0,children:(0,B.jsx)(`span`,{className:`oc-srccard__relev-fill`,style:{width:`${Math.round(f*100)}%`}})})})]}):null,u.text?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`blockquote`,{ref:s,className:`oc-srccard__excerpt${a?` is-full`:``}`,children:u.text}),c||a?(0,B.jsx)(`button`,{type:`button`,className:`oc-srccard__more`,onClick:()=>o(e=>!e),children:a?ov():Ue()}):null]}):null,p?(0,B.jsx)(aTe,{attachment:i}):null]})]})}function aTe({attachment:e}){if(e?.status===`ready`&&e.url){let t=e.filename??_r();return(0,B.jsxs)(`a`,{className:`oc-srccard__origin oc-srccard__origin--ready`,href:e.url,download:e.filename??void 0,target:`_blank`,rel:`noreferrer`,title:_r(),children:[(0,B.jsx)(oS,{size:13,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-srccard__origin-name`,children:t})]})}return e?.status===`pending`?(0,B.jsxs)(`div`,{className:`oc-srccard__origin oc-srccard__origin--pending`,children:[(0,B.jsx)(wS,{size:13,"aria-hidden":!0}),Xc()]}):e?.status===`not_found`||e?.status===`failed`?(0,B.jsxs)(`div`,{className:`oc-srccard__origin oc-srccard__origin--missing`,"aria-disabled":!0,children:[(0,B.jsx)(uv,{size:13,"aria-hidden":!0}),xl()]}):(0,B.jsxs)(`div`,{className:`oc-srccard__origin`,"aria-disabled":!0,children:[(0,B.jsx)(oS,{size:13,"aria-hidden":!0}),ui()]})}function n$(e,t){return new Date(e).toLocaleString(Nm(),t)}function oTe(e){return new Date(e).toLocaleDateString(Nm())}function r$(e){return new Date(e).toLocaleTimeString(Nm())}function sTe(e){return e.toLocaleString(Nm())}function i$(e){if(!Number.isFinite(e)||e<0)return null;if(e<1e3)return`< 1 s`;let t=Math.round(e/1e3);if(t<60)return`${t} s`;let n=Math.floor(t/60),r=t%60;if(n<60)return r===0?`${n} min`:`${n} min ${String(r).padStart(2,`0`)} s`;let i=Math.floor(n/60),a=n%60;return a===0?`${i} h`:`${i} h ${String(a).padStart(2,`0`)} min`}var cTe=new Set([`status`,`exitCode`,`durationMs`]);function lTe(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function uTe(e){if(typeof e==`string`)return{kind:`text`,text:e};if(typeof e==`object`&&e&&!Array.isArray(e)){let t=e,n=Object.keys(t);if(typeof t.exitCode==`number`&&n.every(e=>cTe.has(e)))return{kind:`outcome`,status:typeof t.status==`string`?t.status:null,exitCode:t.exitCode,durationMs:typeof t.durationMs==`number`?t.durationMs:null}}return{kind:`json`,text:lTe(e)}}function dTe(e){let t=[(e.exitCode===null?e.status===`completed`:e.exitCode===0)?N():Kh()];return e.exitCode!==null&&t.push(to({code:e.exitCode})),e.durationMs!==null&&t.push(ft({ms:e.durationMs})),t.join(` · `)}var fTe=new Set([`complete`,`error`,`aborted`]),pTe=new Set([`completed`,`error`]);function mTe(e,t){if(e.length===0)return!1;if(t===`streaming`)return!0;if(t!==void 0&&fTe.has(t))return!1;let n=e[e.length-1];return n.phase!==void 0&&pTe.has(n.phase)?!1:n.result===void 0||n.result===null}var hTe=[`command`,`query`,`url`,`path`,`pattern`,`file`,`cmd`,`prompt`];function gTe(e,t){let n=``;if(e&&typeof e==`object`&&!Array.isArray(e)){let t=e;for(let e of hTe){let r=t[e];if(typeof r==`string`&&r.trim()){n=r;break}}}return n||=t??(typeof e==`string`?e:``),n.replace(/\s+/g,` `).trim()}function _Te(e,t){let n=e.length,r=n===1?da({count:n}):Ch({count:n});return{count:n,running:mTe(e,t),label:r}}function a$({text:e}){let[t,n]=(0,z.useState)(!1);return(0,B.jsx)(`button`,{type:`button`,className:`oc-copybtn`,title:fp(),"aria-label":Fre(),onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{n(!0),window.setTimeout(()=>n(!1),1200)})},children:t?(0,B.jsx)(qx,{size:13,"aria-hidden":!0}):(0,B.jsx)(rS,{size:13,"aria-hidden":!0})})}function vTe(e,t,n){let r=typeof e==`string`?e:void 0;return r===`error`?`error`:t||r===`completed`||n?`completed`:`running`}function yTe(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function o$({toolName:e,args:t,argsText:n,result:r,status:i,turnSettled:a}){let o=r!=null,s=vTe(i?.type,o,a),c=n??yTe(t),l=gTe(t,n),u=o?uTe(r):null,d=s===`running`?wS:s===`error`?Zx:$x;return(0,B.jsxs)(`details`,{className:`oc-tool oc-tool--${s}`,children:[(0,B.jsxs)(`summary`,{className:`oc-tool__header`,children:[(0,B.jsx)(d,{className:`oc-tool__status${s===`running`?` oc-tool__status--spin`:``}`,size:14,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-tool__name`,children:e}),l?(0,B.jsx)(`span`,{className:`oc-tool__preview`,title:l,children:l}):null,(0,B.jsx)(`span`,{className:`oc-tool__phase`,children:s}),(0,B.jsx)(Yx,{size:15,className:`oc-tool__chevron`,"aria-hidden":!0})]}),(0,B.jsxs)(`div`,{className:`oc-tool__body`,children:[c?(0,B.jsxs)(`details`,{className:`oc-tool__io`,children:[(0,B.jsx)(`summary`,{children:`input`}),(0,B.jsxs)(`div`,{className:`oc-tool__prewrap`,children:[(0,B.jsx)(`pre`,{className:`oc-tool__pre`,children:c}),(0,B.jsx)(a$,{text:c})]})]}):null,u&&u.kind===`outcome`?(0,B.jsxs)(`div`,{className:`oc-tool__outcome`,children:[(0,B.jsx)(`span`,{className:`oc-tool__outcome-label`,children:dTe(u)}),(0,B.jsx)(`span`,{className:`oc-tool__outcome-note`,children:Pt()})]}):u?(0,B.jsxs)(`details`,{className:`oc-tool__io`,open:!0,children:[(0,B.jsx)(`summary`,{children:`output`}),(0,B.jsxs)(`div`,{className:`oc-tool__prewrap`,children:[(0,B.jsx)(`pre`,{className:`oc-tool__pre`,children:u.text}),(0,B.jsx)(a$,{text:u.text})]})]}):null]})]})}function s$({...e}){return(0,B.jsx)(gv,{"data-slot":`dialog`,...e})}function bTe({...e}){return(0,B.jsx)(dv,{"data-slot":`dialog-portal`,...e})}function xTe({className:e,...t}){return(0,B.jsx)(pv,{"data-slot":`dialog-overlay`,className:Wg(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function c$({className:e,children:t,showCloseButton:n=!0,...r}){return(0,B.jsxs)(bTe,{children:[(0,B.jsx)(xTe,{}),(0,B.jsxs)(hv,{"data-slot":`dialog-content`,className:Wg(`fixed top-1/2 left-1/2 z-50 grid w-[calc(100%-2rem)] max-w-md -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl border border-border bg-popover bg-clip-padding p-5 text-sm text-popover-foreground shadow-lg duration-200 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n&&(0,B.jsx)(yv,{"data-slot":`dialog-close`,asChild:!0,children:(0,B.jsxs)(Ov,{variant:`ghost`,size:`icon-sm`,className:`absolute top-3 right-3`,children:[(0,B.jsx)(uv,{}),(0,B.jsx)(`span`,{className:`sr-only`,children:P_()})]})})]})]})}function l$({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`dialog-header`,className:Wg(`flex flex-col gap-1.5 pr-6`,e),...t})}function u$({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`dialog-footer`,className:Wg(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function d$({className:e,...t}){return(0,B.jsx)(vv,{"data-slot":`dialog-title`,className:Wg(`text-base font-medium text-foreground`,e),...t})}function f$({className:e,...t}){return(0,B.jsx)(_v,{"data-slot":`dialog-description`,className:Wg(`text-sm text-muted-foreground`,e),...t})}function p$(e){return(0,B.jsx)(FN,{"data-slot":`select`,...e})}function m$(e){return(0,B.jsx)(zN,{"data-slot":`select-value`,...e})}function h$({className:e,size:t=`default`,children:n,...r}){return(0,B.jsxs)(LN,{"data-slot":`select-trigger`,"data-size":t,className:Wg(`flex w-fit items-center justify-between gap-2 rounded-lg border border-input bg-background px-2.5 py-1 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[placeholder]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`[&>[data-slot=select-value]]:min-w-0 [&>[data-slot=select-value]]:truncate`,e),...r,children:[n,(0,B.jsx)(BN,{asChild:!0,children:(0,B.jsx)(cv,{className:`size-4 opacity-50`})})]})}function g$({className:e,children:t,position:n=`popper`,...r}){return(0,B.jsx)(HN,{children:(0,B.jsxs)(WN,{"data-slot":`select-content`,className:Wg(`relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] origin-[--radix-select-content-transform-origin] overflow-y-auto overflow-x-hidden rounded-lg border border-border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,B.jsx)(dP,{className:`flex cursor-default items-center justify-center py-1`,children:(0,B.jsx)(Xx,{className:`size-4`})}),(0,B.jsx)(eP,{className:Wg(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,B.jsx)(pP,{className:`flex cursor-default items-center justify-center py-1`,children:(0,B.jsx)(cv,{className:`size-4`})})]})})}function _$({className:e,children:t,...n}){return(0,B.jsxs)(aP,{"data-slot":`select-item`,className:Wg(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-none select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,B.jsx)(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,B.jsx)(lP,{children:(0,B.jsx)(qx,{className:`size-4`})})}),(0,B.jsx)(sP,{children:t})]})}var v$=1e3;function STe(){return[{id:`hung`,label:dl()},{id:`wrong_result`,label:Ne()},{id:`error`,label:Yie()},{id:`other`,label:Es()}]}function CTe({target:e,onClose:t}){let n=I(L.subAgentReports.createSubAgentReport),[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(!1);(0,z.useEffect)(()=>{e&&(i(``),o(``),c(!1),u(!1))},[e]);function d(e){e||t()}async function f(){if(!(!e||s)){c(!0);try{await n({subAgentId:e.subAgentId,category:r||void 0,comment:a.trim()||void 0}),u(!0)}catch{c(!1)}}}return(0,B.jsx)(s$,{open:e!==null,onOpenChange:d,children:e?(0,B.jsxs)(c$,{className:`sm:max-w-md`,children:[(0,B.jsxs)(l$,{children:[(0,B.jsx)(d$,{children:bne()}),(0,B.jsx)(f$,{children:l?Ln():ki({label:e.label})})]}),l?(0,B.jsx)(`div`,{className:`oc-feedback__result`,role:`status`,children:(0,B.jsx)(`p`,{className:`oc-feedback__fidelity is-ok`,children:Rl()})}):(0,B.jsxs)(`div`,{className:`oc-feedback__form`,children:[(0,B.jsx)(`label`,{className:`oc-feedback__label`,children:Bc()}),(0,B.jsxs)(p$,{value:r,onValueChange:i,children:[(0,B.jsx)(h$,{children:(0,B.jsx)(m$,{placeholder:sr()})}),(0,B.jsx)(g$,{children:STe().map(e=>(0,B.jsx)(_$,{value:e.id,children:e.label},e.id))})]}),(0,B.jsx)(`label`,{className:`oc-feedback__label`,htmlFor:`oc-subagentreport-comment`,children:Zi()}),(0,B.jsx)(`textarea`,{id:`oc-subagentreport-comment`,className:`oc-feedback__textarea`,placeholder:kr(),value:a,maxLength:v$,onChange:e=>o(e.target.value.slice(0,v$)),rows:4}),(0,B.jsxs)(`div`,{className:`oc-feedback__count`,children:[a.length,`/`,v$]})]}),(0,B.jsx)(u$,{children:l?(0,B.jsx)(Ov,{onClick:()=>d(!1),children:va()}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ov,{variant:`outline`,onClick:()=>d(!1),children:un()}),(0,B.jsx)(Ov,{onClick:()=>void f(),disabled:s,children:s?Va():No()})]})})]}):null})}function wTe(e,t=`md`){let n=(e??``).trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,40);return`sous-agent${n?`-${n}`:``}.${t}`}function TTe(e){return JSON.stringify({kind:`sub-agent`,taskName:e.taskName??null,status:e.status,exportedAt:new Date(e.exportedAt).toISOString(),parentAgent:e.parentAgentLabel??null,config:e.sessionMeta??null,telemetry:e.telemetry??null,tools:e.tools.map(e=>({name:e.name,status:e.status,input:e.argsText??null,output:e.resultText??null})),result:e.result??null,error:e.error??null},null,2)}function ETe(e){let t=[],n=e.taskName?.trim()||d_();t.push(`# ${d_()} — ${n}`,``);let r=[];e.parentAgentLabel&&r.push(`- ${Qr()} : ${e.parentAgentLabel}`);let i=e.sessionMeta;if(i?.model&&r.push(`- ${Kg()} : ${i.model}${i.modelProvider?` (${i.modelProvider})`:``}`),i?.thinkingLevel&&r.push(`- ${t_()} : ${i.thinkingLevel}`),i?.fastMode!==void 0&&r.push(`- ${Ip()} : ${i.fastMode?x():ns()}`),i?.controlScope&&r.push(`- ${ed()} : ${i.controlScope}`),i?.subagentRole&&r.push(`- ${su()} : ${i.subagentRole}`),i?.spawnDepth!==void 0&&r.push(`- ${Au()} : ${i.spawnDepth}`),r.length&&t.push(...r,``),e.tools.length>0){t.push(`## ${yg()} (${e.tools.length})`,``);for(let n of e.tools)t.push(`### ${n.name} — ${n.status}`,``),n.argsText&&t.push(`**Input**`,``,"```",n.argsText,"```",``),n.resultText&&t.push(`**Output**`,``,"```",n.resultText,"```",``)}return e.error&&t.push(`## ${Pg()}`,``,e.error,``),e.result&&t.push(`## ${pp()}`,``,e.result,``),`${t.join(`
|
|
242
|
+
`).trim()}\n`}function DTe(e,t,n=!1){if(e===void 0)return`thinking`;switch(e){case`streaming`:return t?`generating`:`thinking`;case`error`:return`error`;case`aborted`:return`aborted`;default:return n?`aborted`:null}}function OTe(e){return e?e.some(e=>e?.type===`text`&&typeof e.text==`string`&&e.text.trim().length>0):!1}var y$=/\b(?:profile|api\s*key)\s+"/i;function kTe(e){if(y$.test(e)){let t=e.indexOf(`"`);return t===-1?e:`${e.slice(0,t+1)}…`}let t=e;return(t.match(/"/g)??[]).length%2==1&&(t=t.replace(/"[^"]*$/,`"…`)),t.replace(/"[^"]*"/g,`"…"`)}function ATe(e){if(typeof e!=`string`||!y$.test(e))return e;let t=e.indexOf(`"`);return t===-1?e:`${e.slice(0,t+1)}…`}var jTe=120*1e3;function MTe(e,t){if(!e)return null;if(e.kind===`repeated_failures`)return{kind:`repeated_failures`,tool:e.tool,failures:e.failures,sameTool:e.sameTool};let n=t-e.quietSince;return n>=12e4?{kind:`quiet_after_failure`,tool:e.tool,quietMs:n}:null}function NTe(e){return e?.kind===`failed_then_quiet`?e.quietSince+jTe:null}function b$(e){return e.kind===`quiet_after_failure`?Mp({tool:e.tool,minutes:String(Math.floor(e.quietMs/6e4))}):e.sameTool?ute({tool:e.tool,count:String(e.failures)}):mre({tool:e.tool,count:String(e.failures)})}function PTe(e,t){let n=new Map,r=new Map;for(let i of e??[]){let e=MTe(i.facts,t);e!==null&&(r.set(i.messageId,e),n.has(i.chatId)||n.set(i.chatId,e))}return{byChat:n,byMessage:r}}function FTe(e,t){let n=null;for(let r of e??[]){let e=NTe(r.facts);if(e===null)continue;let i=e>t?e:t+3e4;n=n===null?i:Math.min(n,i)}return n}var x$=(0,z.createContext)(new Map);function S$(e,t){return e?{className:`oc-chatitem__busy oc-chatitem__busy--struggling`,label:b$(e),struggling:!0}:{className:`oc-chatitem__busy`,label:t,struggling:!1}}var ITe=[];function C$(e){let t=[...e??ITe].sort().join(`,`),n=(0,z.useMemo)(()=>t===``?null:{chatIds:t.split(`,`)},[t]),r=P(L.chatReads.liveTurnDifficulty,n??`skip`),[i,a]=(0,z.useState)(()=>Date.now()),o=n===null?null:FTe(r,i);return(0,z.useEffect)(()=>{if(o===null)return;let e=window.setTimeout(()=>a(Date.now()),Math.max(o-Date.now(),0)+250);return()=>window.clearTimeout(e)},[o]),(0,z.useMemo)(()=>PTe(n===null?void 0:r,Math.max(i,Date.now())),[r,i,n])}var LTe=new Set([`awaiting_approval`,`awaiting_input`]),RTe={thinking:Mre,generating:fs,error:F_,aborted:te},w$={processing_history:Cee,compacting:zf,querying_gateway:Zne,awaiting_subagents:Dte,post_processing:Hd,awaiting_approval:k,awaiting_input:Zie,retrying:ih},zTe=[[`read`,/^(read|read_file|cat|open|view|notebook_read)$/i],[`exec`,/^(exec|bash|shell|run|command|terminal)$/i],[`search`,/^(web_search|search|grep|find|glob|rg)$/i],[`fetch`,/^(web_fetch|fetch|browser|http_get)$/i],[`write`,/^(write|write_file|apply_patch|edit|str_replace|notebook_edit)$/i]];function T$(e){for(let[t,n]of zTe)if(n.test(e))return t;return`other`}var BTe={read:()=>cd(),exec:()=>hu(),search:()=>Bu(),fetch:()=>ci(),write:()=>Vg(),other:e=>Ii({tool:e})};function E$(e){if(!e||e.length===0)return null;let t=e=>e.toolCallId??e.toolName,n=new Set;for(let r=e.length-1;r>=0;r--){let i=e[r],a=i.phase??`completed`;if(a===`completed`||a===`error`){n.add(t(i));continue}if((a===`start`||a===`started`||a===`running`)&&!n.has(t(i)))return{name:i.toolName,family:T$(i.toolName)}}return null}function VTe(e,t,n,r,i,a,o){let s=DTe(e,t,i??!1);if(s===null)return null;if(s===`thinking`||s===`generating`){if(o&&!(n&<e.has(n)))return{kind:s,label:b$(o),phased:!0,struggling:!0};if(r)return{kind:s,label:BTe[r.family](r.name),phased:!0};if(n===`retrying`&&a)return{kind:s,label:jne({attempt:String(a.attempt),maxAttempts:String(a.maxAttempts)}),phased:!0};if(n&&w$[n])return{kind:s,label:w$[n](),phased:!0}}return{kind:s,label:RTe[s]()}}function HTe(e,t){return!t||e!==`thinking`&&e!==`generating`?null:cp()}var UTe=new Set([`context_length`,`context_length_compacted`,`context_length_presend`]),WTe=new Set([`session_gone`,`session_archived`,`session_archived_historic`,`session_paused_review`,`gateway_agent_db_closed`]),D$={context_length:nie,context_length_compacted:Md,context_length_presend:Cm,rate_limit:Ma,timeout:la,refusal:xh,stream_orphaned:ot,connection_lost:nc,gateway_restarting:q_,connection_saturated:kf,GATEWAY_RESTARTING:q_,CONNECTION_SATURATED:kf,response_timeout:Iie,compaction_timeout:ep,empty_response:cre,msgtool_args_unreadable:Vte,awaiting_approval:of,empty_response_silent:vh,unclassified_error:Une,provider_internal:yte,session_init_conflict:une,session_write_conflict:pi,session_gone:Cn,session_archived:wl,session_archived_historic:kc,session_paused_review:Yn,session_visibility_refused:$c,session_settings_changed:Se,permission_mode_not_applied:_s,knowledge_policy_not_applied:od,auth_profile_cooldown:Vi,pending_input_dropped:Vie,gateway_storage_busy:br,gateway_storage_unavailable:tn,gateway_agent_db_closed:Co,not_configured:ete,no_agent:rne,agent_restricted:lee,AGENT_LEFT_ROOM:xp,send_failed:Hre,DISPATCH_STALLED:bp,ATTACHMENT_TOO_LARGE:_g,ATTACHMENT_REJECTED:Qf,attachment_name_too_long:Oe,attachment_path_refused:Yr,attachment_staging_failed:Yr,attachment_cleanup_unconfirmed:Yr,message_too_large:Oo,subagent_reply_pending:Ki},GTe=new RegExp(String.raw`(?:auto-compaction|preflight compaction)(?:[^\n.!?;,:—-]{0,200}?failed\s*:\s*|[^\n.!?;,:—-]{0,200}?[.!?]\s*reason\s*:\s*)(?:no conversation found|conversation (?:not found|does not exist|expired|invalid)|session (?:not found|does not exist|expired|invalid)|no such session|invalid session|(?:session|conversation) id not found)(?=[.,;:!)\]]|\s*$|\s+(?:for|on|in|with)\b|\s+[—-]\s)`,`i`),KTe=/is archived\.?\s*restore it before starting new work/i,qTe=/is paused as a precaution\.?\s*review the provider findings|provider review changed\.?\s*refresh the findings/i;function O$(e){return e.replace(/"[^"]*"/g,`""`)}var k$=/pending input is no longer active in its admitted transcript/i,JTe=/^\s*all (?:[a-z][\w -]{0,60}? )?models failed \(\d+\):\s*/i,A$=/^[^\s/|]+\/\S+?:\s+/;function YTe(e){let t=JTe.exec(e);if(t===null)return k$.test(e);let n=e.slice(t[0].length).split(` | `).map(e=>e.trim()).filter(e=>A$.test(e)).map(e=>e.replace(A$,``));return n.length>0&&n.every(e=>k$.test(e))}var XTe=/context overflow|prompt too large|maximum context length|context[- ]length exceeded|request_too_large|request too large|input (?:token count )?exceeds the maximum number of (?:input )?tokens|input is too long for the model|too many tokens/i,j$=new Set([`stream_orphaned`,`connection_lost`,`gateway_restarting`,`connection_saturated`,`response_timeout`,`not_configured`,`no_agent`,`agent_restricted`,`send_failed`,`ATTACHMENT_TOO_LARGE`,`ATTACHMENT_REJECTED`,`attachment_path_refused`,`attachment_name_too_long`,`attachment_staging_failed`,`attachment_cleanup_unconfirmed`,`message_too_large`,`subagent_reply_pending`]);function M$(e,t){let n=ATe((e??``).trim()),r=kTe(n),i=t&&D$[t]&&t!==`unclassified_error`?t:j$.has(r)?r:GTe.test(r)?`session_gone`:KTe.test(O$(r))?`session_archived_historic`:qTe.test(O$(r))?`session_paused_review`:YTe(n)?`pending_input_dropped`:XTe.test(r)?`context_length`:t??null,a=i===null?null:D$[i]?.()??null;return r&&r!==i&&j$.has(r),{headline:a,detail:n&&n!==i&&!j$.has(n)&&!(i!==null&&WTe.has(i))?n:null,code:i}}var N$=OTe,ZTe=new Set([`chat_busy`,`not_last_message`,`no_preceding_user_turn`]);function QTe(e){return e==null?null:e.outcome===`exhausted`?d({attempt:String(e.attempt),max:String(e.maxAttempts)}):e.reason===`another_turn_streaming`?Ko():e.reason===`delegated_work`?Gu():e.reason===`concurrent_writer`?Zl():e.reason!==void 0&&ZTe.has(e.reason)?bu():Vr()}function $Te(e){let t=e.trim();if(t===``)return``;let n=t.slice(t.lastIndexOf(`:`)+1)||t;return n.length>10?`${n.slice(0,8)}…`:n}var eEe=RegExp(`^agent:(.+?):(?:${[`subagent`,`dashboard`].join(`|`)}):`);function P$(e){return eEe.exec(e.trim())?.[1]?.trim()||void 0}function tEe(e){if(!Number.isFinite(e)||e<0)return``;if(e<1e3)return`< 1 s`;let t=Math.round(e/1e3);if(t<60)return`${t} s`;let n=Math.floor(t/60),r=t%60;if(n<60)return r>0?`${n} min ${r} s`:`${n} min`;let i=Math.floor(n/60),a=n%60;return a>0?`${i} h ${String(a).padStart(2,`0`)} min`:`${i} h`}function nEe(e){if(!Number.isFinite(e)||e<0)return``;let t=e>0&&e<.01?4:2;return`${e.toFixed(t).replace(`.`,`,`)} $`}function F$(e){return e.moaRole===`moa_aggregator`?In():e.moaRole===`moa_reference`?Oi():d_()}function I$(e){return e.kind===`task`?El({tool:e.taskName?.trim()||`task`}):e.taskName?.trim()||$Te(e.childSessionKey)||Oie()}function rEe(e){return e.some(e=>e.status===`running`&&e.kind!==`task`)}function iEe(e){return e===`running`?`running`:e===`done`?`done`:e===`aborted`?`aborted`:`failed`}function aEe(e){return e!==`running`}function oEe(e){return e!==void 0&&e.tone!==`running`&&e.sessionMeta?.cleanup===`delete`}function sEe(e){return e.startsWith(`fork:`)}function cEe(e){let t=iEe(e.status),n=e.sessionMeta?.subagentRole;return{id:e._id,childSessionKey:e.childSessionKey,...e.kind===`task`?{isTask:!0}:{},...n===`moa_reference`||n===`moa_aggregator`?{moaRole:n}:{},taskName:e.taskName?.trim()||void 0,label:I$(e),status:e.status,tone:t,failure:t===`failed`,phase:e.status===`running`?e.phase:void 0,errorMessage:e.errorMessage,errorCode:e.errorCode,runTimeoutSeconds:e.runTimeoutSeconds,resultText:e.resultText,tools:e.tools?.map(e=>({name:e.name,status:e.status,toolCallId:e.toolCallId})),sessionMeta:e.sessionMeta,telemetry:e.telemetry,childAgentId:P$(e.childSessionKey)}}function L$(e){let t=[...e].sort((e,t)=>t.createdAt-e.createdAt).map(cEe).sort((e,t)=>{let n=e=>e.moaRole===`moa_aggregator`?0:e.moaRole===`moa_reference`?1:2,r=e=>e.moaRole?e.childSessionKey.replace(/:(ref\d+|aggregate)$/,``):``,i=r(e).localeCompare(r(t));if(e.moaRole&&t.moaRole&&i!==0)return i;let a=n(e),o=n(t);if(a!==o)return a-o;if(a===1){let n=e=>{let t=/ref(\d+)$/.exec(e.childSessionKey);return t?.[1]?Number.parseInt(t[1],10):0};return n(e)-n(t)}return 0});return{cards:t,total:t.length,done:t.filter(e=>e.tone===`done`).length,running:t.filter(e=>e.tone===`running`).length,failed:t.filter(e=>e.tone===`failed`).length,aborted:t.filter(e=>e.tone===`aborted`).length}}function lEe(e){if(e.total<=1)return[];let t={done:e.done,running:e.running,failed:e.failed,aborted:e.aborted};return[`done`,`running`,`failed`,`aborted`].filter(e=>t[e]>0).map(e=>({tone:e,count:t[e]}))}function R$(e,t,n){let r=new Set(t);return e.filter(e=>n!==void 0&&e.parentMessageId===n||r.has(e.childSessionKey))}function uEe(e){return e===1?Qh({count:e}):so({count:e})}var z$=120,dEe=/EXTERNAL_UNTRUSTED_CONTENT|SECURITY\s*NOTICE|UNTRUSTED\s*CONTENT/i,fEe=/DO NOT/;function B$(e){return dEe.test(e)||fEe.test(e)}function V$(e){return e.length<=z$?e:`${e.slice(0,z$-1)}…`}function H$(e){for(let t of e.split(/\r?\n/)){let e=t.replace(/\s+/g,` `).trim();if(!(e.length<3)&&/[\p{L}\p{N}]/u.test(e)&&!B$(e))return e}return null}function U$(e,t,n){let r=T_();if(t===`timeout`)return V$(typeof n==`number`&&Number.isInteger(n)&&n>0?Ye({seconds:n}):Ws());if(t===`subagent_no_activity`)return V$(_f());if(t===`spawn_refused`)return V$(uie());if(t){let e=D$[t]?.();if(e)return V$(e)}if(e==null)return r;let i=e.trim();if(i===``)return r;let a=/([A-Za-z][\w.-]*)\s+failed\s*\(([^)]{1,40})\)/i.exec(i);if(a)return V$(`${a[1]} (${a[2].trim()})`);let o=H$(i);return o&&!B$(o)?V$(o):r}function pEe(e,t){if(!t||t!==`timeout`&&t!==`spawn_refused`&&D$[t]===void 0)return null;let n=e?.trim()??``;return n===``||H$(n)===null?null:n}function mEe(e){return e===`message_too_large`?Oo():e===`attachment_too_large`?_g():e??die()}function hEe(e){let t=document.querySelector(`[data-message-id="${CSS.escape(e)}"]`);if(!t)return;let n=t.closest(`.oc-thread__viewport`);if(n){let e=t.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTo({top:n.scrollTop+e-12,behavior:`smooth`})}else t.scrollIntoView({block:`start`,behavior:`smooth`});t.classList.remove(`oc-msg--highlight`),t.offsetWidth,t.classList.add(`oc-msg--highlight`),window.setTimeout(()=>t.classList.remove(`oc-msg--highlight`),2400)}function gEe(e,t){let n=new Blob([t],{type:`text/markdown;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=e,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(r)}var W$=(0,z.createContext)(null);function _Ee({card:e}){let t=e.tone===`running`?_t():e.tone===`failed`?mc():zt();return(0,B.jsxs)(`span`,{className:`oc-subpanel__status oc-subpanel__status--${e.tone}`,children:[t,e.tone===`running`?(0,B.jsx)(wS,{size:13,className:`oc-subagent__spin`,"aria-hidden":!0}):e.tone===`failed`?(0,B.jsx)(Zx,{size:13,"aria-hidden":!0}):(0,B.jsx)(qx,{size:13,"aria-hidden":!0})]})}function vEe(e){if(e)try{return JSON.parse(e)}catch{return}}function yEe(e){return{type:e===`error`?`error`:e===`done`?`completed`:`running`}}function G$(e){return e.toolCallId??`name:${e.name}`}function bEe({summary:e,parts:t,subAgentRunning:n}){let[r,i]=(0,z.useState)(!1),a=n,o=e.length===1?da({count:e.length}):Ch({count:e.length}),s=a?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(wS,{size:13,className:`oc-actrow__status-icon oc-actrow__spin`,"aria-hidden":!0}),wo()]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(qx,{size:13,className:`oc-actrow__status-icon`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-sr-only`,children:Na()})]}),c=new Map;for(let e of t??[])c.set(e.toolCallId,e);return(0,B.jsxs)(`div`,{className:`oc-toolact`,children:[(0,B.jsx)(JL,{icon:(0,B.jsx)(TC,{size:14}),label:o,trailing:s,open:r,ariaExpanded:r,title:r?Sh():ua(),onClick:()=>i(!r)}),r?(0,B.jsx)(`div`,{className:`oc-toolact__detail`,children:e.map((e,t)=>{let r=c.get(G$(e));return(0,B.jsx)(o$,{toolName:e.name,args:r?vEe(r.argsText):void 0,argsText:r?.argsText,result:r?.resultText,status:yEe(r?.status??e.status),turnSettled:!n},`${G$(e)}-${t}`)})}):null]})}function xEe({meta:e,telemetry:t,childAgentId:n,instanceName:r,parentAgentLabel:i,onExport:a}){let[o,s]=(0,z.useState)(!1),c=!!e&&Object.values(e).some(e=>e!==void 0)||!!t&&Object.values(t).some(e=>e!==void 0)||n!==void 0;if(!c&&!i&&!a)return(0,B.jsx)(`div`,{className:`oc-subpanel__barslot`,"aria-hidden":!0});let l=e?.fastMode===void 0?null:e.fastMode?x():ns();return(0,B.jsxs)(`div`,{className:`oc-subpanel__bar`,children:[(0,B.jsxs)(`div`,{className:`oc-subpanel__bar-chips`,children:[e?.model?(0,B.jsxs)(`span`,{className:`oc-chip oc-chip--info`,title:e.modelProvider?On({provider:e.modelProvider}):Kg(),children:[(0,B.jsx)(Yoe,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:e.model})]}):null,e?.thinkingLevel?(0,B.jsxs)(`span`,{className:`oc-chip`,title:t_(),children:[(0,B.jsx)(Gx,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:e.thinkingLevel})]}):null,l?(0,B.jsxs)(`span`,{className:`oc-chip`,title:Ip(),children:[(0,B.jsx)(_S,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:l})]}):null,e?.context?(0,B.jsxs)(`span`,{className:`oc-chip`,title:e.context===`fork`?Nn():Ti(),children:[(0,B.jsx)(dC,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:e.context})]}):null,i?(0,B.jsxs)(`span`,{className:`oc-chip`,title:Qr(),children:[(0,B.jsx)(Wx,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:i})]}):null,a?(0,B.jsxs)(NI,{children:[(0,B.jsx)(PI,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-chip oc-chip--btn oc-subpanel__bar-export`,title:ch(),children:[(0,B.jsx)(oS,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:Jd()}),(0,B.jsx)(cv,{size:12,className:`oc-chip__chev`,"aria-hidden":!0})]})}),(0,B.jsxs)(FI,{align:`end`,className:`w-44`,children:[(0,B.jsx)(LI,{children:Jd()}),(0,B.jsx)(II,{onClick:()=>a(`md`),children:bh()}),(0,B.jsx)(II,{onClick:()=>a(`json`),children:j()})]})]}):null]}),c?(0,B.jsxs)(`button`,{type:`button`,className:`oc-subpanel__adv-toggle${o?` is-open`:``}`,"aria-expanded":o,onClick:()=>s(e=>!e),children:[(0,B.jsx)(lC,{size:13,"aria-hidden":!0}),_ne(),(0,B.jsx)(Yx,{size:13,className:`oc-subpanel__adv-chevron`,"aria-hidden":!0})]}):null,o&&c?(0,B.jsx)(CEe,{meta:e??{},telemetry:t,childAgentId:n,instanceName:r}):null]})}function SEe(e){return e===`leaf`?vt():e===`orchestrator`?Bt():null}function CEe({meta:e,telemetry:t,childAgentId:n,instanceName:r}){let i=[];e.model&&i.push([Kg(),e.model]),e.modelProvider&&i.push([Cg(),e.modelProvider]);let a=e.agentId??n;a&&i.push([ws(),a]),r&&i.push([$f(),r]),e.label&&i.push([Yi(),e.label]),e.thinkingLevel&&i.push([t_(),e.thinkingLevel]),e.fastMode!==void 0&&i.push([Ip(),e.fastMode?x():ns()]),e.context&&i.push([Ti(),e.context]),e.lightContext!==void 0&&i.push([Dr(),e.lightContext?cn():jo()]),e.runtime&&i.push([Pl(),e.runtime]),e.mode&&i.push([Lc(),e.mode]),e.cleanup&&i.push([ir(),e.cleanup]),e.sandbox&&i.push([cl(),e.sandbox]),e.controlScope&&i.push([ed(),e.controlScope]),e.subagentRole&&i.push([su(),e.subagentRole]),e.spawnDepth!==void 0&&i.push([Au(),String(e.spawnDepth)]);let o=SEe(e.subagentRole);if(o&&i.push([qie(),o]),e.sessionId&&i.push([za(),e.sessionId]),e.gatewayKind&&i.push([je(),e.gatewayKind]),t?.runtimeMs!==void 0){let e=tEe(t.runtimeMs);e&&i.push([ga(),e])}if(t?.totalTokens!==void 0&&i.push([Ah(),sTe(t.totalTokens)]),t?.estimatedCostUsd!==void 0){let e=typeof t.totalTokens==`number`&&t.totalTokens>0;if(t.estimatedCostUsd<=0&&e)i.push([oe(),Zr()]);else{let e=nEe(t.estimatedCostUsd);e&&i.push([oe(),e])}}return(0,B.jsx)(`dl`,{className:`oc-subpanel__adv-list`,children:i.map(([e,t])=>(0,B.jsxs)(`div`,{className:`oc-subpanel__adv-row`,children:[(0,B.jsx)(`dt`,{children:e}),(0,B.jsx)(`dd`,{children:t})]},e))})}function K$({chatId:e,childKey:t,onClose:n,parentAgentLabel:r}){let i=P(L.subAgents.listSubAgents,{chatId:e}),a=P(L.agents.getChatAgent,{chatId:e}),o=P(L.messages.getSessionMeta,{chatId:e}),s=o?.viewerRole===`participant`,c=o?.perTurnRouting===!0?void 0:a?.agent?.instanceName,l=(i??[]).find(e=>e.childSessionKey===t),u=l?L$([l]).cards[0]:void 0,d=l?.taskName?.trim(),f=oEe(u),p=u?.failure?pEe(u.errorMessage,u.errorCode):null,m=sEe(t),h=P(L.subAgentReports.myReportedSubAgentIds,{chatId:e}),g=P(L.subAgents.listSubAgentToolParts,{chatId:e,childSessionKey:t}),_=P(L.subAgentInteractions.listSubAgentInteractions,{chatId:e,childSessionKey:t}),v=mf(L.subAgentInteractions.sendToSubAgent),y=I(L.chats.generateUploadUrl),b=I(L.uploads.registerUpload),[x,S]=(0,z.useState)(!1),[C,w]=(0,z.useState)(!0),[T,E]=(0,z.useState)(!1),[D,O]=(0,z.useState)(``),[k,ee]=(0,z.useState)(!1),[A,j]=(0,z.useState)([]),[te,ne]=(0,z.useState)(!1),[M,N]=(0,z.useState)(!0),re=(0,z.useRef)(null),ie=(0,z.useRef)(null),ae=(0,z.useCallback)(async e=>{if(!(!e||e.length===0)){ne(!0);try{for(let t of Array.from(e)){if(A.length>=6)break;let e=await y(),{storageId:n}=await(await fetch(e,{method:`POST`,headers:{"Content-Type":t.type||`application/octet-stream`},body:t})).json();await b({storageId:n}),j(e=>e.length>=6?e:[...e,{storageId:n,filename:t.name,mimeType:t.type||`application/octet-stream`}])}}finally{ne(!1),re.current&&(re.current.value=``)}}},[A.length,y,b]),[oe,se]=(0,z.useState)(null),ce=u?(h??[]).includes(u.id):!1,le=(0,z.useCallback)(e=>{if(!u)return;let t=g&&g.length>0?g.map(e=>({name:e.name,status:e.status,argsText:e.argsText,resultText:e.resultText})):(u.tools??[]).map(e=>({name:e.name,status:e.status})),n={taskName:d,status:u.status,parentAgentLabel:r,sessionMeta:u.sessionMeta,telemetry:u.telemetry,result:u.resultText,error:u.failure?U$(u.errorMessage,u.errorCode,u.runTimeoutSeconds):void 0,tools:t};gEe(wTe(d,e),e===`md`?ETe(n):TTe({...n,exportedAt:Date.now()}))},[u,g,d,r]);(0,z.useEffect)(()=>{let e=e=>{e.key===`Escape`&&n()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[n]),(0,z.useEffect)(()=>{i!==void 0&&!l&&n()},[i,l,n]);let ue=_&&_.length>0?`${_.length}:${_[_.length-1].status}`:``;(0,z.useEffect)(()=>{if(!ue)return;let e=ie.current;e&&e.scrollTo({top:e.scrollHeight,behavior:`smooth`})},[ue]);let de=EL(),fe=async()=>{let n=D.trim();if(!(f||m)&&!(!n&&A.length===0||x||te)){S(!0);try{await v({chatId:e,childSessionKey:t,text:n,...A.length>0?{attachments:A.map(e=>({storageId:e.storageId,filename:e.filename,mimeType:e.mimeType}))}:{}}),O(``),j([])}catch(e){let t=String(e?.message??``);de.error(t.includes(`TALK_CALL_ACTIVE`)?gd():t.includes(`SUBAGENT_RECOVERING`)?Xe():am())}finally{S(!1)}}};return(0,B.jsxs)(`div`,{className:`oc-subpanel`,children:[(0,B.jsxs)(`header`,{className:`oc-subpanel__head`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-subpanel__avatar oc-subpanel__back${u?` oc-subpanel__avatar--${u.tone}`:``}`,disabled:!l?.parentMessageId,title:Wf(),"aria-label":Dee(),onClick:()=>l?.parentMessageId&&hEe(l.parentMessageId),children:(0,B.jsx)(Woe,{size:16})}),(0,B.jsxs)(`div`,{className:`oc-subpanel__headmain`,children:[(0,B.jsxs)(`div`,{className:`oc-subpanel__head-top`,children:[(0,B.jsx)(`span`,{className:`oc-subpanel__kind`,children:u?F$(u):d_()}),(0,B.jsxs)(`div`,{className:`oc-subpanel__head-ctrls`,children:[u?(0,B.jsx)(_Ee,{card:u}):null,u&&aEe(u.status)&&!s?(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn oc-subpanel__report${ce?` is-on`:``}`,title:ce?ti():Og(),"aria-label":Og(),disabled:ce,onClick:()=>se({subAgentId:u.id,label:u.label}),children:(0,B.jsx)(pS,{size:15,"aria-hidden":!0})}):null,(0,B.jsx)(Ov,{variant:`ghost`,size:`icon-sm`,onClick:n,"aria-label":fm(),className:`oc-subpanel__close`,children:(0,B.jsx)(uv,{size:16})})]})]}),d?(0,B.jsx)(`button`,{type:`button`,className:`oc-subpanel__task${k?` is-expanded`:``}`,title:tre(),"aria-expanded":k,onClick:()=>ee(e=>!e),children:d}):null]})]}),(0,B.jsx)(xEe,{meta:u?.sessionMeta,telemetry:u?.telemetry,childAgentId:u?.childAgentId,instanceName:c,parentAgentLabel:r,onExport:u?le:void 0}),(0,B.jsx)(`div`,{className:`oc-subpanel__body`,ref:ie,children:u?(0,B.jsxs)(B.Fragment,{children:[u.tools&&u.tools.length>0&&M?(0,B.jsxs)(`section`,{className:`oc-subpanel__section`,children:[(0,B.jsx)(`h3`,{className:`oc-subpanel__section-title`,children:yg()}),(0,B.jsx)(bEe,{summary:u.tools,parts:g,subAgentRunning:u.tone===`running`})]}):null,u.failure?(0,B.jsxs)(`section`,{className:`oc-subpanel__section`,children:[(0,B.jsx)(`h3`,{className:`oc-subpanel__section-title`,children:Pg()}),(0,B.jsx)(`p`,{className:`oc-subpanel__error`,children:U$(u.errorMessage,u.errorCode,u.runTimeoutSeconds)}),p===null?null:(0,B.jsxs)(`details`,{className:`oc-subpanel__error-detail`,children:[(0,B.jsx)(`summary`,{children:nee()}),(0,B.jsx)(`p`,{className:`oc-subpanel__muted`,children:p})]})]}):null,u.resultText?(0,B.jsxs)(`section`,{className:`oc-subpanel__section oc-subpanel__result${C?` is-open`:``}`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-subpanel__result-toggle`,"aria-expanded":C,onClick:()=>w(!C),children:[(0,B.jsx)(Yx,{size:13,className:`oc-subpanel__result-chevron`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-subpanel__section-title`,children:pp()})]}),C?(0,B.jsx)(yQ,{text:u.resultText}):null]}):u.tone===`running`?(0,B.jsxs)(`p`,{className:`oc-subpanel__muted oc-subpanel__working`,children:[(0,B.jsx)(wS,{size:14,className:`oc-subagent__spin`,"aria-hidden":!0}),Ire()]}):null,_&&_.length>0?(0,B.jsxs)(`section`,{className:`oc-subpanel__section`,children:[(0,B.jsx)(`h3`,{className:`oc-subpanel__section-title`,children:hc()}),(0,B.jsx)(`div`,{className:`oc-subpanel__thread`,children:_.map(e=>(0,B.jsxs)(`div`,{className:`oc-subpanel__exchange`,children:[(0,B.jsxs)(`div`,{className:`oc-subpanel__msg oc-subpanel__msg--user`,children:[e.userText,e.attachments&&e.attachments.length>0?(0,B.jsx)(`div`,{className:`oc-subpanel__msg-atts`,children:e.attachments.map((t,n)=>(0,B.jsxs)(`span`,{className:`oc-subpanel__attchip oc-subpanel__attchip--sent`,title:t.filename,children:[(0,B.jsx)(HS,{size:11,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-subpanel__attchip-name`,children:t.filename})]},`${e._id}-att-${n}`))}):null]}),e.status===`pending`?(0,B.jsxs)(`div`,{className:`oc-subpanel__msg oc-subpanel__msg--pending`,children:[(0,B.jsx)(wS,{size:13,className:`oc-actrow__spin`,"aria-hidden":!0}),E_()]}):e.status===`error`?(0,B.jsx)(`div`,{className:`oc-subpanel__msg oc-subpanel__msg--err`,children:mEe(e.errorMessage)}):(0,B.jsxs)(`div`,{className:`oc-subpanel__msg oc-subpanel__msg--reply`,children:[(0,B.jsx)(yQ,{text:e.replyText??``}),e.widgetOmitted===!0?(0,B.jsx)(`p`,{className:`oc-subpanel__note`,children:Gs()}):null]})]},e._id))})]}):null]}):(0,B.jsx)(`p`,{className:`oc-subpanel__muted`,children:Lm()})}),s?null:(0,B.jsx)(`footer`,{className:`oc-subpanel__foot`,children:T?(0,B.jsxs)(`div`,{className:`oc-subpanel__prompt`,children:[A.length>0?(0,B.jsx)(`div`,{className:`oc-subpanel__attstrip`,children:A.map((e,t)=>(0,B.jsxs)(`span`,{className:`oc-subpanel__attchip`,title:e.filename,children:[(0,B.jsx)(HS,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-subpanel__attchip-name`,children:e.filename}),(0,B.jsx)(`button`,{type:`button`,className:`oc-subpanel__attchip-x`,"aria-label":pm(),onClick:()=>j(e=>e.filter((e,n)=>n!==t)),children:(0,B.jsx)(uv,{size:11,"aria-hidden":!0})})]},`${e.storageId}-${t}`))}):null,(0,B.jsx)(`textarea`,{className:`oc-subpanel__prompt-input`,rows:2,value:D,onChange:e=>O(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),fe())},placeholder:Kee(),autoFocus:!0}),(0,B.jsxs)(`div`,{className:`oc-subpanel__prompt-bar`,children:[(0,B.jsxs)(`div`,{className:`oc-subpanel__composer-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-subpanel__composer-btn`,title:f_(),"aria-label":f_(),disabled:te||A.length>=6,onClick:()=>re.current?.click(),children:te?(0,B.jsx)(wS,{size:15,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsx)(YS,{size:15,"aria-hidden":!0})}),u?.tools&&u.tools.length>0?(0,B.jsxs)(`button`,{type:`button`,className:`oc-subpanel__composer-btn oc-subpanel__composer-btn--label${M?` is-on`:``}`,title:xd(),"aria-pressed":M,onClick:()=>N(e=>!e),children:[(0,B.jsx)(TC,{size:14,"aria-hidden":!0}),yg()]}):null]}),u?.tone===`running`?(0,B.jsx)(`span`,{className:`oc-subpanel__prompt-hint`,children:vf()}):m?(0,B.jsx)(`span`,{className:`oc-subpanel__prompt-hint`,children:co()}):f?(0,B.jsx)(`span`,{className:`oc-subpanel__prompt-hint`,children:$h()}):(_??[]).some(e=>e.status===`pending`)?(0,B.jsx)(`span`,{className:`oc-subpanel__prompt-hint`,children:kie()}):null,(0,B.jsxs)(Ov,{variant:`default`,size:`sm`,className:`gap-1.5`,disabled:!D.trim()&&A.length===0||x||te||u?.tone===`running`||f||m||(_??[]).some(e=>e.status===`pending`),onClick:()=>void fe(),children:[x?(0,B.jsx)(wS,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsx)(eC,{size:14,"aria-hidden":!0}),Qte()]})]}),(0,B.jsx)(`input`,{ref:re,type:`file`,multiple:!0,className:`oc-subpanel__fileinput`,onChange:e=>void ae(e.target.files)})]}):(0,B.jsxs)(`button`,{type:`button`,className:`oc-subpanel__interact`,onClick:()=>E(!0),children:[(0,B.jsx)(jS,{size:15,"aria-hidden":!0}),Rm()]})}),(0,B.jsx)(CTe,{target:oe,onClose:()=>se(null)})]})}var wEe=[`op`,`jobId`,`name`,`enabled`,`schedule`,`message`,`deliveryMode`,`agentId`,`nextRunAtMs`],q$=null,TEe=1,J$=new Set;function Y$(){for(let e of[...J$])e()}function X$(e){return J$.add(e),()=>J$.delete(e)}function Z$(){return q$}function EEe(e){return q$={pinId:TEe++,kind:e.kind,ownerUserId:e.ownerUserId,originChatId:e.originChatId,originLabel:e.originLabel,params:e.params,pinned:!1},Y$(),q$}function Q$(e,t){q$===null||q$.pinId!==e||q$.pinned!==t&&(q$={...q$,pinned:t},Y$())}function $$(e){q$!==null&&(e!==void 0&&e!==q$.pinId||(q$=null,Y$()))}function e1(e,t){q$===null||q$.pinId!==e||(q$={...q$,params:t},Y$())}function DEe(e,t){return e===null||e.ownerUserId!==t.userId?`none`:e.pinned||r1(e,t)?`dock`:`none`}function OEe(e,t){switch(e){case`sources`:return`sources:${String(t.messageId??``)}`;case`subagent`:return`subagent:${String(t.childKey??``)}`;case`cron`:{let e=t.part??{};return`cron:${JSON.stringify([String(t.instanceName??``),String(t.jobId??``),String(t.occurrenceId??``),wEe.map(t=>e[t]??null)])}`}case`document`:{let e=t.doc??{};return`document:${JSON.stringify([e.filename??null,e.storageId??e.url??null])}`}}}function t1(e,t){return e-420>=t}function n1(e,t,n){return Math.max(n,Math.min(e,t-420))}function r1(e,t){return e===null||e.ownerUserId!==t.userId?!1:e.originChatId!==null&&e.originChatId===t.chatId}function kEe(e,t){return e===null||e.ownerUserId!==t.userId?!1:!e.pinned&&!r1(e,t)}function AEe(e,t){return r1(e,t)?`keep`:`close`}function jEe(e,t){return r1(e,t)?e:null}function i1(){let[e,t]=(0,z.useState)(()=>window.innerWidth);return(0,z.useLayoutEffect)(()=>{let e=()=>{let e=document.querySelector(`.oc-workspace`);if(e===null)return;let n=e.querySelector(`.oc-sidebar-col`),r=n===null?0:n.getBoundingClientRect().width,i=e.getBoundingClientRect().width-r;i>0&&t(i)},n=new ResizeObserver(e);n.observe(document.documentElement);let r=new Set,i=()=>{let t=document.querySelector(`.oc-workspace`),i=new Set;if(t!==null){let e=t.querySelector(`.oc-sidebar-col`);e!==null&&i.add(e)}for(let e of r)i.has(e)||n.unobserve(e);for(let e of i)r.has(e)||n.observe(e);r.clear();for(let e of i)r.add(e);e()};i();let a=new MutationObserver(i);return a.observe(document.body,{childList:!0,subtree:!0}),()=>{n.disconnect(),a.disconnect()}},[]),e}var MEe=`oc.sidebar.width`,a1=`oc.sidebar.collapsed`,o1=200,s1=520,NEe=260,c1=`(max-width: 767px)`;function l1(){let[e,t]=(0,z.useState)(()=>typeof window<`u`&&window.matchMedia(c1).matches);return(0,z.useEffect)(()=>{let e=window.matchMedia(c1),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var u1=new Map;function d1(e,t,n){let r=u1.get(e);if(r!==void 0)for(let e of[...r])e!==n&&e(t)}function f1(e){let{storageKey:t,defaultWidth:n,min:r,max:i,edge:a,maxViewportFraction:o}=e,s=e.fit??(e=>e),c=(0,z.useRef)(s);c.current=s;let l=(0,z.useCallback)(e=>Math.min(i,Math.max(r,e)),[r,i]),[u,d]=(0,z.useState)(()=>l(Number(localStorage.getItem(t))||n)),[f,p]=(0,z.useState)(()=>window.innerWidth);(0,z.useEffect)(()=>{let e=()=>p(window.innerWidth);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let m=(0,z.useCallback)(e=>{let t=o===void 0?1/0:Math.round(f*o);return Math.min(Math.max(r,Math.min(i,t)),Math.max(r,e))},[r,i,o,f]),h=(0,z.useRef)(m);h.current=m;let g=(0,z.useRef)(u);g.current=u;let[_,v]=(0,z.useState)(null),y=s(m(_??u)),b=(0,z.useRef)(()=>{});(0,z.useEffect)(()=>{localStorage.setItem(t,String(u)),d1(t,u,b.current)},[t,u]);let x=(0,z.useCallback)(e=>{localStorage.setItem(t,String(e)),d1(t,e,b.current),d(e)},[t]);(0,z.useEffect)(()=>{let e=e=>d(e);b.current=e;let n=u1.get(t)??new Set;return n.add(e),u1.set(t,n),()=>{n.delete(e),n.size===0&&u1.delete(t)}},[t]);let S=(0,z.useRef)(!1),C=(0,z.useRef)(null),w=(0,z.useRef)(null);return(0,z.useEffect)(()=>()=>w.current?.(),[]),{width:y,startResize:(0,z.useCallback)(e=>{if(w.current!==null)return;e.preventDefault(),S.current=!0;let t=e.pointerId,n=e.currentTarget;try{n.setPointerCapture(t)}catch{}let r=e.clientX,i=y,o=!1,s=a===`left`?1:-1,u=i,d=0,f=e=>c.current(h.current(e)),p=()=>{d=0;let e=C.current;if(e){let t=f(u);e.style.width=`${t}px`,e.style.flex=`0 0 ${t}px`}},m=e=>{if(!S.current||e.pointerId!==t)return;let n=l(i+s*(e.clientX-r));f(n)!==f(u)&&(o=!0),u=n,C.current?d===0&&(d=requestAnimationFrame(p)):v(u)},_=e=>{if(e instanceof PointerEvent&&e.pointerId!==t)return;S.current=!1,d!==0&&cancelAnimationFrame(d),v(null),window.removeEventListener(`pointermove`,m),window.removeEventListener(`pointerup`,_),window.removeEventListener(`pointercancel`,_),window.removeEventListener(`blur`,_),document.removeEventListener(`lostpointercapture`,_);try{n.hasPointerCapture(t)&&n.releasePointerCapture(t)}catch{}w.current=null,document.body.style.cursor=``,document.body.style.userSelect=``;let r=o&&u!==i,a=r?u:g.current,s=C.current;if(s){let e=f(a);s.style.width=`${e}px`,s.style.flex=`0 0 ${e}px`}r&&x(u)};w.current=_,window.addEventListener(`pointermove`,m),window.addEventListener(`pointerup`,_),window.addEventListener(`pointercancel`,_),window.addEventListener(`blur`,_),document.addEventListener(`lostpointercapture`,_),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},[y,a,m,l,x]),setWidth:d,columnRef:C}}function p1(){let{width:e,startResize:t,columnRef:n}=f1({storageKey:MEe,defaultWidth:NEe,min:o1,max:s1,edge:`left`}),[r,i]=(0,z.useState)(()=>localStorage.getItem(a1)===`1`),a=l1();return(0,z.useEffect)(()=>{localStorage.setItem(a1,r?`1`:`0`)},[r]),(0,z.useEffect)(()=>{a&&i(!0)},[a]),{width:e,columnRef:n,collapsed:r,toggleCollapsed:(0,z.useCallback)(()=>i(e=>!e),[]),collapse:(0,z.useCallback)(()=>i(!0),[]),startResize:t,isMobile:a,MIN_WIDTH:o1,MAX_WIDTH:s1}}function PEe(e){let t=f1({storageKey:`oc.sources.width`,fit:e(300),defaultWidth:380,min:300,max:680,edge:`right`}),n=f1({storageKey:`oc.subagent.width`,fit:e(320),defaultWidth:460,min:320,max:720,edge:`right`}),r=f1({storageKey:`oc.docviewer.width`,fit:e(380),defaultWidth:560,min:380,max:1800,maxViewportFraction:.72,edge:`right`}),i={...t,min:300},a={...r,min:380};return{sources:i,subagent:{...n,min:320},cron:i,document:a}}function FEe({viewerUserId:e,currentChatId:t}){let n=(0,z.useSyncExternalStore)(X$,Z$,Z$),r=wx(),i=l1(),a=i1(),o=PEe((0,z.useCallback)(e=>t=>n1(t,a,e),[a])),s={userId:e,chatId:t};(0,z.useEffect)(()=>()=>$$(),[]);let c=kEe(n,s),l=n?.pinId;if((0,z.useEffect)(()=>{c&&l!==void 0&&$$(l)},[c,l]),n===null||DEe(n,s)!==`dock`)return null;let u=n.params,d=()=>$$(n.pinId),{width:f,startResize:p,columnRef:m,min:h}=o[n.kind],g=i||!t1(a,h);if(g&&!n.pinned)return null;let _=n1(f,a,h);return(0,B.jsx)(BQ,{children:(0,B.jsxs)(`aside`,{className:`oc-pinpanel`,ref:m,hidden:g,style:g?{display:`none`}:{width:_,flex:`0 0 ${_}px`},"aria-label":sa({origin:n.originLabel}),children:[(0,B.jsx)(`div`,{className:`oc-pinpanel__resizer`,onPointerDown:p,role:`separator`,"aria-orientation":`vertical`,"aria-label":bn()}),(0,B.jsxs)(`div`,{className:`oc-pinpanel__head`,children:[(0,B.jsx)(`span`,{className:`oc-pinpanel__origin`,title:n.originLabel,children:n.originLabel}),(0,B.jsxs)(`span`,{className:`oc-pinpanel__ctrls`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-pinpanel__btn${n.pinned?` is-on`:``}`,"aria-pressed":n.pinned,title:n.pinned?Uo():Qa(),"aria-label":n.pinned?Uo():Qa(),onClick:()=>{if(!n.pinned){Q$(n.pinId,!0);return}AEe(n,s)===`close`?d():Q$(n.pinId,!1)},children:n.pinned?(0,B.jsx)(qS,{size:14,"aria-hidden":!0}):(0,B.jsx)(KS,{size:14,"aria-hidden":!0})}),n.originChatId!==null&&!r1(n,s)?(0,B.jsx)(`button`,{type:`button`,className:`oc-pinpanel__btn`,title:Rr(),"aria-label":Rr(),onClick:()=>void r({to:`/chat/$chatId`,params:{chatId:n.originChatId}}),children:(0,B.jsx)(lS,{size:14,"aria-hidden":!0})}):null,(0,B.jsx)(`button`,{type:`button`,className:`oc-pinpanel__btn`,title:Uh(),"aria-label":Uh(),onClick:d,children:(0,B.jsx)(uv,{size:14,"aria-hidden":!0})})]})]}),(0,B.jsx)(rR,{onClose:d,children:(0,B.jsx)(`div`,{className:`oc-pinpanel__body`,children:n.kind===`cron`?(0,B.jsx)(nR,{instanceName:u.instanceName,part:u.part,onClose:d}):n.kind===`document`?(0,B.jsx)(NQ.Provider,{value:{activeDoc:u.doc,openFor:e=>e1(n.pinId,{...u,doc:e}),openNewerVersion:e=>e1(n.pinId,{...u,doc:e}),close:d},children:(0,B.jsx)(FQ,{doc:u.doc,chatId:n.originChatId,onClose:d})}):n.kind===`subagent`?(0,B.jsx)(K$,{chatId:n.originChatId,childKey:u.childKey,onClose:d,parentAgentLabel:u.parentAgentLabel??``}):(0,B.jsx)(e$,{messageId:u.messageId,onClose:d})})},n.pinId)]})})}var m1;function $(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var h1=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},g1=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(m1=globalThis).__zod_globalConfig??(m1.__zod_globalConfig={});var _1=globalThis.__zod_globalConfig;function v1(e){return e&&Object.assign(_1,e),_1}function y1(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function b1(e,t){return typeof t==`bigint`?t.toString():t}function x1(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function S1(e){return e==null}function C1(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function IEe(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var w1=Symbol(`evaluating`);function T1(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==w1)return r===void 0&&(r=w1,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function E1(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function D1(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function O1(e){return JSON.stringify(e)}function LEe(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var k1=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function A1(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var REe=x1(()=>{if(_1.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function j1(e){if(A1(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(A1(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function M1(e){return j1(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var zEe=new Set([`string`,`number`,`symbol`]);function N1(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function P1(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function F1(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function BEe(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var VEe={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function HEe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return P1(e,D1(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return E1(this,`shape`,e),e},checks:[]}))}function UEe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return P1(e,D1(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return E1(this,`shape`,r),r},checks:[]}))}function WEe(e,t){if(!j1(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return P1(e,D1(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return E1(this,`shape`,n),n}}))}function GEe(e,t){if(!j1(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return P1(e,D1(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return E1(this,`shape`,n),n}}))}function KEe(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return P1(e,D1(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return E1(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function qEe(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return P1(t,D1(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return E1(this,`shape`,i),i},checks:[]}))}function JEe(e,t,n){return P1(t,D1(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return E1(this,`shape`,i),i}}))}function I1(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function YEe(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function L1(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function R1(e){return typeof e==`string`?e:e?.message}function z1(e,t,n){let r=e.message?e.message:R1(e.inst?._zod.def?.error?.(e))??R1(t?.error?.(e))??R1(n.customError?.(e))??R1(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function B1(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function V1(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var H1=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,b1,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},U1=$(`$ZodError`,H1),W1=$(`$ZodError`,H1,{Parent:Error});function XEe(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ZEe(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var G1=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new h1;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>z1(e,a,v1())));throw k1(t,i?.callee),t}return o.value},K1=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>z1(e,a,v1())));throw k1(t,i?.callee),t}return o.value},q1=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new h1;return a.issues.length?{success:!1,error:new(e??U1)(a.issues.map(e=>z1(e,i,v1())))}:{success:!0,data:a.value}},QEe=q1(W1),J1=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>z1(e,i,v1())))}:{success:!0,data:a.value}},$Ee=J1(W1),eDe=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return G1(e)(t,n,i)},tDe=e=>(t,n,r)=>G1(e)(t,n,r),nDe=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return K1(e)(t,n,i)},rDe=e=>async(t,n,r)=>K1(e)(t,n,r),iDe=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return q1(e)(t,n,i)},aDe=e=>(t,n,r)=>q1(e)(t,n,r),oDe=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return J1(e)(t,n,i)},sDe=e=>async(t,n,r)=>J1(e)(t,n,r),cDe=/^[cC][0-9a-z]{6,}$/,lDe=/^[0-9a-z]+$/,uDe=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,dDe=/^[0-9a-vA-V]{20}$/,fDe=/^[A-Za-z0-9]{27}$/,pDe=/^[a-zA-Z0-9_-]{21}$/,mDe=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,hDe=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Y1=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,gDe=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,_De=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function vDe(){return new RegExp(_De,`u`)}var yDe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,bDe=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,xDe=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,SDe=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,CDe=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,X1=/^[A-Za-z0-9_-]*$/,wDe=/^https?$/,TDe=/^\+[1-9]\d{6,14}$/,Z1=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,EDe=RegExp(`^${Z1}$`);function Q1(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function DDe(e){return RegExp(`^${Q1(e)}$`)}function ODe(e){let t=Q1({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Z1}T(?:${r})$`)}var kDe=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},ADe=/^-?\d+$/,jDe=/^-?\d+(?:\.\d+)?$/,MDe=/^[^A-Z]*$/,NDe=/^[^a-z]*$/,$1=$(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),e0={number:`number`,bigint:`bigint`,object:`date`},t0=$(`$ZodCheckLessThan`,(e,t)=>{$1.init(e,t);let n=e0[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),n0=$(`$ZodCheckGreaterThan`,(e,t)=>{$1.init(e,t);let n=e0[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),PDe=$(`$ZodCheckMultipleOf`,(e,t)=>{$1.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):IEe(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),FDe=$(`$ZodCheckNumberFormat`,(e,t)=>{$1.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=VEe[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=ADe)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),IDe=$(`$ZodCheckMaxLength`,(e,t)=>{var n;$1.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!S1(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=B1(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),LDe=$(`$ZodCheckMinLength`,(e,t)=>{var n;$1.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!S1(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=B1(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),RDe=$(`$ZodCheckLengthEquals`,(e,t)=>{var n;$1.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!S1(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=B1(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),r0=$(`$ZodCheckStringFormat`,(e,t)=>{var n,r;$1.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),zDe=$(`$ZodCheckRegex`,(e,t)=>{r0.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),BDe=$(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=MDe,r0.init(e,t)}),VDe=$(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=NDe,r0.init(e,t)}),HDe=$(`$ZodCheckIncludes`,(e,t)=>{$1.init(e,t);let n=N1(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),UDe=$(`$ZodCheckStartsWith`,(e,t)=>{$1.init(e,t);let n=RegExp(`^${N1(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),WDe=$(`$ZodCheckEndsWith`,(e,t)=>{$1.init(e,t);let n=RegExp(`.*${N1(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),GDe=$(`$ZodCheckOverwrite`,(e,t)=>{$1.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),KDe=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
243
|
+
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
244
|
+
`))}},qDe={major:4,minor:4,patch:3},i0=$(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=qDe;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=I1(e),i;for(let a of t){if(a._zod.def.when){if(YEe(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new h1;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=I1(e,t))});else{if(e.issues.length===t)continue;r||=I1(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(I1(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new h1;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new h1;return o.then(e=>t(e,r,a))}return t(o,r,a)}}T1(e,`~standard`,()=>({validate:t=>{try{let n=QEe(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return $Ee(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),a0=$(`$ZodString`,(e,t)=>{i0.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??kDe(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),o0=$(`$ZodStringFormat`,(e,t)=>{r0.init(e,t),a0.init(e,t)}),JDe=$(`$ZodGUID`,(e,t)=>{t.pattern??=hDe,o0.init(e,t)}),YDe=$(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Y1(e)}else t.pattern??=Y1();o0.init(e,t)}),XDe=$(`$ZodEmail`,(e,t)=>{t.pattern??=gDe,o0.init(e,t)}),ZDe=$(`$ZodURL`,(e,t)=>{o0.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===wDe.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),QDe=$(`$ZodEmoji`,(e,t)=>{t.pattern??=vDe(),o0.init(e,t)}),$De=$(`$ZodNanoID`,(e,t)=>{t.pattern??=pDe,o0.init(e,t)}),eOe=$(`$ZodCUID`,(e,t)=>{t.pattern??=cDe,o0.init(e,t)}),tOe=$(`$ZodCUID2`,(e,t)=>{t.pattern??=lDe,o0.init(e,t)}),nOe=$(`$ZodULID`,(e,t)=>{t.pattern??=uDe,o0.init(e,t)}),rOe=$(`$ZodXID`,(e,t)=>{t.pattern??=dDe,o0.init(e,t)}),iOe=$(`$ZodKSUID`,(e,t)=>{t.pattern??=fDe,o0.init(e,t)}),aOe=$(`$ZodISODateTime`,(e,t)=>{t.pattern??=ODe(t),o0.init(e,t)}),oOe=$(`$ZodISODate`,(e,t)=>{t.pattern??=EDe,o0.init(e,t)}),sOe=$(`$ZodISOTime`,(e,t)=>{t.pattern??=DDe(t),o0.init(e,t)}),cOe=$(`$ZodISODuration`,(e,t)=>{t.pattern??=mDe,o0.init(e,t)}),lOe=$(`$ZodIPv4`,(e,t)=>{t.pattern??=yDe,o0.init(e,t),e._zod.bag.format=`ipv4`}),uOe=$(`$ZodIPv6`,(e,t)=>{t.pattern??=bDe,o0.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),dOe=$(`$ZodCIDRv4`,(e,t)=>{t.pattern??=xDe,o0.init(e,t)}),fOe=$(`$ZodCIDRv6`,(e,t)=>{t.pattern??=SDe,o0.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function s0(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var pOe=$(`$ZodBase64`,(e,t)=>{t.pattern??=CDe,o0.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{s0(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function mOe(e){if(!X1.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return s0(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var hOe=$(`$ZodBase64URL`,(e,t)=>{t.pattern??=X1,o0.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{mOe(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),gOe=$(`$ZodE164`,(e,t)=>{t.pattern??=TDe,o0.init(e,t)});function _Oe(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var vOe=$(`$ZodJWT`,(e,t)=>{o0.init(e,t),e._zod.check=n=>{_Oe(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),c0=$(`$ZodNumber`,(e,t)=>{i0.init(e,t),e._zod.pattern=e._zod.bag.pattern??jDe,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),yOe=$(`$ZodNumberFormat`,(e,t)=>{FDe.init(e,t),c0.init(e,t)}),bOe=$(`$ZodUnknown`,(e,t)=>{i0.init(e,t),e._zod.parse=e=>e}),xOe=$(`$ZodNever`,(e,t)=>{i0.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function l0(e,t,n){e.issues.length&&t.issues.push(...L1(n,e.issues)),t.value[n]=e.value}var SOe=$(`$ZodArray`,(e,t)=>{i0.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>l0(t,n,e))):l0(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function u0(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...L1(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function d0(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=BEe(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function f0(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>u0(e,n,i,t,u,d))):u0(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var COe=$(`$ZodObject`,(e,t)=>{if(i0.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=x1(()=>d0(t));T1(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=A1,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>u0(n,t,e,s,r,i))):u0(a,t,e,s,r,i)}return i?f0(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),wOe=$(`$ZodObjectJIT`,(e,t)=>{COe.init(e,t);let n=e._zod.parse,r=x1(()=>d0(t)),i=e=>{let t=new KDe([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=O1(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=O1(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
|
|
245
|
+
if (${n}.issues.length) {
|
|
246
|
+
if (${o} in input) {
|
|
247
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
248
|
+
...iss,
|
|
249
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
250
|
+
})));
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (${n}.value === undefined) {
|
|
255
|
+
if (${o} in input) {
|
|
256
|
+
newResult[${o}] = undefined;
|
|
257
|
+
}
|
|
258
|
+
} else {
|
|
259
|
+
newResult[${o}] = ${n}.value;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
`):c?t.write(`
|
|
263
|
+
if (${n}.issues.length) {
|
|
264
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
265
|
+
...iss,
|
|
266
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
267
|
+
})));
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (${n}.value === undefined) {
|
|
271
|
+
if (${o} in input) {
|
|
272
|
+
newResult[${o}] = undefined;
|
|
273
|
+
}
|
|
274
|
+
} else {
|
|
275
|
+
newResult[${o}] = ${n}.value;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
`):t.write(`
|
|
279
|
+
const ${n}_present = ${o} in input;
|
|
280
|
+
if (${n}.issues.length) {
|
|
281
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
282
|
+
...iss,
|
|
283
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
284
|
+
})));
|
|
285
|
+
}
|
|
286
|
+
if (!${n}_present && !${n}.issues.length) {
|
|
287
|
+
payload.issues.push({
|
|
288
|
+
code: "invalid_type",
|
|
289
|
+
expected: "nonoptional",
|
|
290
|
+
input: undefined,
|
|
291
|
+
path: [${o}]
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
if (${n}_present) {
|
|
296
|
+
if (${n}.value === undefined) {
|
|
297
|
+
newResult[${o}] = undefined;
|
|
298
|
+
} else {
|
|
299
|
+
newResult[${o}] = ${n}.value;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=A1,s=!_1.jitless,c=s&&REe.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?f0([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function p0(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!I1(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>z1(e,r,v1())))}),t)}var TOe=$(`$ZodUnion`,(e,t)=>{i0.init(e,t),T1(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),T1(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),T1(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),T1(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>C1(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>p0(t,r,e,i)):p0(o,r,e,i)}}),EOe=$(`$ZodIntersection`,(e,t)=>{i0.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>h0(e,t,n)):h0(e,i,a)}});function m0(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(j1(e)&&j1(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=m0(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=m0(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function h0(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),I1(e))return e;let o=m0(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var DOe=$(`$ZodEnum`,(e,t)=>{i0.init(e,t);let n=y1(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>zEe.has(typeof e)).map(e=>typeof e==`string`?N1(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),OOe=$(`$ZodLiteral`,(e,t)=>{if(i0.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?N1(e):e?N1(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),kOe=$(`$ZodTransform`,(e,t)=>{i0.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new g1(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new h1;return n.value=i,n.fallback=!0,n}});function g0(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var _0=$(`$ZodOptional`,(e,t)=>{i0.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,T1(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),T1(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${C1(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>g0(e,r)):g0(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),AOe=$(`$ZodExactOptional`,(e,t)=>{_0.init(e,t),T1(e._zod,`values`,()=>t.innerType._zod.values),T1(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),jOe=$(`$ZodNullable`,(e,t)=>{i0.init(e,t),T1(e._zod,`optin`,()=>t.innerType._zod.optin),T1(e._zod,`optout`,()=>t.innerType._zod.optout),T1(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${C1(e.source)}|null)$`):void 0}),T1(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),MOe=$(`$ZodDefault`,(e,t)=>{i0.init(e,t),e._zod.optin=`optional`,T1(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>v0(e,t)):v0(r,t)}});function v0(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var NOe=$(`$ZodPrefault`,(e,t)=>{i0.init(e,t),e._zod.optin=`optional`,T1(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),POe=$(`$ZodNonOptional`,(e,t)=>{i0.init(e,t),T1(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>y0(t,e)):y0(i,e)}});function y0(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var FOe=$(`$ZodCatch`,(e,t)=>{i0.init(e,t),e._zod.optin=`optional`,T1(e._zod,`optout`,()=>t.innerType._zod.optout),T1(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>z1(e,n,v1()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>z1(e,n,v1()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),IOe=$(`$ZodPipe`,(e,t)=>{i0.init(e,t),T1(e._zod,`values`,()=>t.in._zod.values),T1(e._zod,`optin`,()=>t.in._zod.optin),T1(e._zod,`optout`,()=>t.out._zod.optout),T1(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>b0(e,t.in,n)):b0(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>b0(e,t.out,n)):b0(r,t.out,n)}});function b0(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var LOe=$(`$ZodReadonly`,(e,t)=>{i0.init(e,t),T1(e._zod,`propValues`,()=>t.innerType._zod.propValues),T1(e._zod,`values`,()=>t.innerType._zod.values),T1(e._zod,`optin`,()=>t.innerType?._zod?.optin),T1(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(x0):x0(r)}});function x0(e){return e.value=Object.freeze(e.value),e}var ROe=$(`$ZodCustom`,(e,t)=>{$1.init(e,t),i0.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>S0(t,n,r,e));S0(i,n,r,e)}});function S0(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(V1(e))}}var C0,zOe=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function BOe(){return new zOe}(C0=globalThis).__zod_globalRegistry??(C0.__zod_globalRegistry=BOe());var w0=globalThis.__zod_globalRegistry;function VOe(e,t){return new e({type:`string`,...F1(t)})}function HOe(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...F1(t)})}function T0(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...F1(t)})}function UOe(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...F1(t)})}function WOe(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...F1(t)})}function GOe(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...F1(t)})}function KOe(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...F1(t)})}function qOe(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...F1(t)})}function JOe(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...F1(t)})}function YOe(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...F1(t)})}function XOe(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...F1(t)})}function ZOe(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...F1(t)})}function QOe(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...F1(t)})}function $Oe(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...F1(t)})}function eke(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...F1(t)})}function tke(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...F1(t)})}function nke(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...F1(t)})}function rke(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...F1(t)})}function ike(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...F1(t)})}function ake(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...F1(t)})}function oke(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...F1(t)})}function ske(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...F1(t)})}function cke(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...F1(t)})}function lke(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...F1(t)})}function uke(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...F1(t)})}function dke(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...F1(t)})}function fke(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...F1(t)})}function pke(e,t){return new e({type:`number`,coerce:!0,checks:[],...F1(t)})}function mke(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...F1(t)})}function hke(e){return new e({type:`unknown`})}function gke(e,t){return new e({type:`never`,...F1(t)})}function E0(e,t){return new t0({check:`less_than`,...F1(t),value:e,inclusive:!1})}function D0(e,t){return new t0({check:`less_than`,...F1(t),value:e,inclusive:!0})}function O0(e,t){return new n0({check:`greater_than`,...F1(t),value:e,inclusive:!1})}function k0(e,t){return new n0({check:`greater_than`,...F1(t),value:e,inclusive:!0})}function A0(e,t){return new PDe({check:`multiple_of`,...F1(t),value:e})}function j0(e,t){return new IDe({check:`max_length`,...F1(t),maximum:e})}function M0(e,t){return new LDe({check:`min_length`,...F1(t),minimum:e})}function N0(e,t){return new RDe({check:`length_equals`,...F1(t),length:e})}function _ke(e,t){return new zDe({check:`string_format`,format:`regex`,...F1(t),pattern:e})}function vke(e){return new BDe({check:`string_format`,format:`lowercase`,...F1(e)})}function yke(e){return new VDe({check:`string_format`,format:`uppercase`,...F1(e)})}function bke(e,t){return new HDe({check:`string_format`,format:`includes`,...F1(t),includes:e})}function xke(e,t){return new UDe({check:`string_format`,format:`starts_with`,...F1(t),prefix:e})}function Ske(e,t){return new WDe({check:`string_format`,format:`ends_with`,...F1(t),suffix:e})}function P0(e){return new GDe({check:`overwrite`,tx:e})}function Cke(e){return P0(t=>t.normalize(e))}function wke(){return P0(e=>e.trim())}function Tke(){return P0(e=>e.toLowerCase())}function Eke(){return P0(e=>e.toUpperCase())}function Dke(){return P0(e=>LEe(e))}function Oke(e,t,n){return new e({type:`array`,element:t,...F1(n)})}function kke(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...F1(n)})}function Ake(e,t){let n=jke(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(V1(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(V1(r))}},e(t.value,t)),t);return n}function jke(e,t){let n=new $1({check:`custom`,...F1(t)});return n._zod.check=e,n}function F0(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??w0,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function I0(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,I0(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&z0(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function L0(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
304
|
+
|
|
305
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function R0(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:B0(t,`input`,e.processors),output:B0(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function z0(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return z0(r.element,n);if(r.type===`set`)return z0(r.valueType,n);if(r.type===`lazy`)return z0(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return z0(r.innerType,n);if(r.type===`intersection`)return z0(r.left,n)||z0(r.right,n);if(r.type===`record`||r.type===`map`)return z0(r.keyType,n)||z0(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:z0(r.in,n)||z0(r.out,n);if(r.type===`object`){for(let e in r.shape)if(z0(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(z0(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(z0(e,n))return!0;return!!(r.rest&&z0(r.rest,n))}return!1}var Mke=(e,t={})=>n=>{let r=F0({...n,processors:t});return I0(e,r),L0(r,e),R0(r,e)},B0=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=F0({...i??{},target:a,io:t,processors:n});return I0(e,o),L0(o,e),R0(o,e)},Nke={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Pke=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Nke[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Fke=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Ike=(e,t,n,r)=>{n.not={}},Lke=(e,t,n,r)=>{let i=e._zod.def,a=y1(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Rke=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},zke=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Bke=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Vke=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=I0(a.element,t,{...r,path:[...r.path,`items`]})},Hke=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=I0(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=I0(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Uke=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>I0(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Wke=(e,t,n,r)=>{let i=e._zod.def,a=I0(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=I0(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Gke=(e,t,n,r)=>{let i=e._zod.def,a=I0(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Kke=(e,t,n,r)=>{let i=e._zod.def;I0(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},qke=(e,t,n,r)=>{let i=e._zod.def;I0(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Jke=(e,t,n,r)=>{let i=e._zod.def;I0(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Yke=(e,t,n,r)=>{let i=e._zod.def;I0(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Xke=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;I0(o,t,r);let s=t.seen.get(e);s.ref=o},Zke=(e,t,n,r)=>{let i=e._zod.def;I0(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},V0=(e,t,n,r)=>{let i=e._zod.def;I0(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Qke=$(`ZodISODateTime`,(e,t)=>{aOe.init(e,t),J0.init(e,t)});function $ke(e){return lke(Qke,e)}var eAe=$(`ZodISODate`,(e,t)=>{oOe.init(e,t),J0.init(e,t)});function tAe(e){return uke(eAe,e)}var nAe=$(`ZodISOTime`,(e,t)=>{sOe.init(e,t),J0.init(e,t)});function rAe(e){return dke(nAe,e)}var iAe=$(`ZodISODuration`,(e,t)=>{cOe.init(e,t),J0.init(e,t)});function aAe(e){return fke(iAe,e)}var H0=$(`ZodError`,(e,t)=>{U1.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>ZEe(e,t)},flatten:{value:t=>XEe(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,b1,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,b1,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),oAe=G1(H0),sAe=K1(H0),cAe=q1(H0),lAe=J1(H0),uAe=eDe(H0),dAe=tDe(H0),fAe=nDe(H0),pAe=rDe(H0),mAe=iDe(H0),hAe=aDe(H0),gAe=oDe(H0),_Ae=sDe(H0),U0=new WeakMap;function W0(e,t,n){let r=Object.getPrototypeOf(e),i=U0.get(r);if(i||(i=new Set,U0.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var G0=$(`ZodType`,(e,t)=>(i0.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:B0(e,`input`),output:B0(e,`output`)}}),e.toJSONSchema=Mke(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>oAe(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>cAe(e,t,n),e.parseAsync=async(t,n)=>sAe(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>lAe(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>uAe(e,t,n),e.decode=(t,n)=>dAe(e,t,n),e.encodeAsync=async(t,n)=>fAe(e,t,n),e.decodeAsync=async(t,n)=>pAe(e,t,n),e.safeEncode=(t,n)=>mAe(e,t,n),e.safeDecode=(t,n)=>hAe(e,t,n),e.safeEncodeAsync=async(t,n)=>gAe(e,t,n),e.safeDecodeAsync=async(t,n)=>_Ae(e,t,n),W0(e,`ZodType`,{check(...e){let t=this.def;return this.clone(D1(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return P1(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(lje(e,t))},superRefine(e,t){return this.check(uje(e,t))},overwrite(e){return this.check(P0(e))},optional(){return o2(this)},exactOptional(){return XAe(this)},nullable(){return s2(this)},nullish(){return o2(s2(this))},nonoptional(e){return nje(this,e)},array(){return VAe(this)},or(e){return t2([this,e])},and(e){return GAe(this,e)},transform(e){return l2(this,JAe(e))},default(e){return $Ae(this,e)},prefault(e){return tje(this,e)},catch(e){return ije(this,e)},pipe(e){return l2(this,e)},readonly(){return sje(this)},describe(e){let t=this.clone();return w0.add(t,{description:e}),t},meta(...e){if(e.length===0)return w0.get(this);let t=this.clone();return w0.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return w0.get(e)?.description},configurable:!0}),e)),K0=$(`_ZodString`,(e,t)=>{a0.init(e,t),G0.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pke(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,W0(e,`_ZodString`,{regex(...e){return this.check(_ke(...e))},includes(...e){return this.check(bke(...e))},startsWith(...e){return this.check(xke(...e))},endsWith(...e){return this.check(Ske(...e))},min(...e){return this.check(M0(...e))},max(...e){return this.check(j0(...e))},length(...e){return this.check(N0(...e))},nonempty(...e){return this.check(M0(1,...e))},lowercase(e){return this.check(vke(e))},uppercase(e){return this.check(yke(e))},trim(){return this.check(wke())},normalize(...e){return this.check(Cke(...e))},toLowerCase(){return this.check(Tke())},toUpperCase(){return this.check(Eke())},slugify(){return this.check(Dke())}})}),vAe=$(`ZodString`,(e,t)=>{a0.init(e,t),K0.init(e,t),e.email=t=>e.check(HOe(yAe,t)),e.url=t=>e.check(qOe(bAe,t)),e.jwt=t=>e.check(cke(FAe,t)),e.emoji=t=>e.check(JOe(xAe,t)),e.guid=t=>e.check(T0(Y0,t)),e.uuid=t=>e.check(UOe(X0,t)),e.uuidv4=t=>e.check(WOe(X0,t)),e.uuidv6=t=>e.check(GOe(X0,t)),e.uuidv7=t=>e.check(KOe(X0,t)),e.nanoid=t=>e.check(YOe(SAe,t)),e.guid=t=>e.check(T0(Y0,t)),e.cuid=t=>e.check(XOe(CAe,t)),e.cuid2=t=>e.check(ZOe(wAe,t)),e.ulid=t=>e.check(QOe(TAe,t)),e.base64=t=>e.check(ake(MAe,t)),e.base64url=t=>e.check(oke(NAe,t)),e.xid=t=>e.check($Oe(EAe,t)),e.ksuid=t=>e.check(eke(DAe,t)),e.ipv4=t=>e.check(tke(OAe,t)),e.ipv6=t=>e.check(nke(kAe,t)),e.cidrv4=t=>e.check(rke(AAe,t)),e.cidrv6=t=>e.check(ike(jAe,t)),e.e164=t=>e.check(ske(PAe,t)),e.datetime=t=>e.check($ke(t)),e.date=t=>e.check(tAe(t)),e.time=t=>e.check(rAe(t)),e.duration=t=>e.check(aAe(t))});function q0(e){return VOe(vAe,e)}var J0=$(`ZodStringFormat`,(e,t)=>{o0.init(e,t),K0.init(e,t)}),yAe=$(`ZodEmail`,(e,t)=>{XDe.init(e,t),J0.init(e,t)}),Y0=$(`ZodGUID`,(e,t)=>{JDe.init(e,t),J0.init(e,t)}),X0=$(`ZodUUID`,(e,t)=>{YDe.init(e,t),J0.init(e,t)}),bAe=$(`ZodURL`,(e,t)=>{ZDe.init(e,t),J0.init(e,t)}),xAe=$(`ZodEmoji`,(e,t)=>{QDe.init(e,t),J0.init(e,t)}),SAe=$(`ZodNanoID`,(e,t)=>{$De.init(e,t),J0.init(e,t)}),CAe=$(`ZodCUID`,(e,t)=>{eOe.init(e,t),J0.init(e,t)}),wAe=$(`ZodCUID2`,(e,t)=>{tOe.init(e,t),J0.init(e,t)}),TAe=$(`ZodULID`,(e,t)=>{nOe.init(e,t),J0.init(e,t)}),EAe=$(`ZodXID`,(e,t)=>{rOe.init(e,t),J0.init(e,t)}),DAe=$(`ZodKSUID`,(e,t)=>{iOe.init(e,t),J0.init(e,t)}),OAe=$(`ZodIPv4`,(e,t)=>{lOe.init(e,t),J0.init(e,t)}),kAe=$(`ZodIPv6`,(e,t)=>{uOe.init(e,t),J0.init(e,t)}),AAe=$(`ZodCIDRv4`,(e,t)=>{dOe.init(e,t),J0.init(e,t)}),jAe=$(`ZodCIDRv6`,(e,t)=>{fOe.init(e,t),J0.init(e,t)}),MAe=$(`ZodBase64`,(e,t)=>{pOe.init(e,t),J0.init(e,t)}),NAe=$(`ZodBase64URL`,(e,t)=>{hOe.init(e,t),J0.init(e,t)}),PAe=$(`ZodE164`,(e,t)=>{gOe.init(e,t),J0.init(e,t)}),FAe=$(`ZodJWT`,(e,t)=>{vOe.init(e,t),J0.init(e,t)}),Z0=$(`ZodNumber`,(e,t)=>{c0.init(e,t),G0.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fke(e,t,n,r),W0(e,`ZodNumber`,{gt(e,t){return this.check(O0(e,t))},gte(e,t){return this.check(k0(e,t))},min(e,t){return this.check(k0(e,t))},lt(e,t){return this.check(E0(e,t))},lte(e,t){return this.check(D0(e,t))},max(e,t){return this.check(D0(e,t))},int(e){return this.check(Q0(e))},safe(e){return this.check(Q0(e))},positive(e){return this.check(O0(0,e))},nonnegative(e){return this.check(k0(0,e))},negative(e){return this.check(E0(0,e))},nonpositive(e){return this.check(D0(0,e))},multipleOf(e,t){return this.check(A0(e,t))},step(e,t){return this.check(A0(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null}),IAe=$(`ZodNumberFormat`,(e,t)=>{yOe.init(e,t),Z0.init(e,t)});function Q0(e){return mke(IAe,e)}var LAe=$(`ZodUnknown`,(e,t)=>{bOe.init(e,t),G0.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function $0(){return hke(LAe)}var RAe=$(`ZodNever`,(e,t)=>{xOe.init(e,t),G0.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ike(e,t,n,r)});function zAe(e){return gke(RAe,e)}var BAe=$(`ZodArray`,(e,t)=>{SOe.init(e,t),G0.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vke(e,t,n,r),e.element=t.element,W0(e,`ZodArray`,{min(e,t){return this.check(M0(e,t))},nonempty(e){return this.check(M0(1,e))},max(e,t){return this.check(j0(e,t))},length(e,t){return this.check(N0(e,t))},unwrap(){return this.element}})});function VAe(e,t){return Oke(BAe,e,t)}var HAe=$(`ZodObject`,(e,t)=>{wOe.init(e,t),G0.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hke(e,t,n,r),T1(e,`shape`,()=>t.shape),W0(e,`ZodObject`,{keyof(){return r2(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:$0()})},loose(){return this.clone({...this._zod.def,catchall:$0()})},strict(){return this.clone({...this._zod.def,catchall:zAe()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return WEe(this,e)},safeExtend(e){return GEe(this,e)},merge(e){return KEe(this,e)},pick(e){return HEe(this,e)},omit(e){return UEe(this,e)},partial(...e){return qEe(a2,this,e[0])},required(...e){return JEe(c2,this,e[0])}})});function e2(e,t){return new HAe({type:`object`,shape:e??{},...F1(t)})}var UAe=$(`ZodUnion`,(e,t)=>{TOe.init(e,t),G0.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uke(e,t,n,r),e.options=t.options});function t2(e,t){return new UAe({type:`union`,options:e,...F1(t)})}var WAe=$(`ZodIntersection`,(e,t)=>{EOe.init(e,t),G0.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wke(e,t,n,r)});function GAe(e,t){return new WAe({type:`intersection`,left:e,right:t})}var n2=$(`ZodEnum`,(e,t)=>{DOe.init(e,t),G0.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lke(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new n2({...t,checks:[],...F1(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new n2({...t,checks:[],...F1(r),entries:i})}});function r2(e,t){return new n2({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...F1(t)})}var KAe=$(`ZodLiteral`,(e,t)=>{OOe.init(e,t),G0.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rke(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function i2(e,t){return new KAe({type:`literal`,values:Array.isArray(e)?e:[e],...F1(t)})}var qAe=$(`ZodTransform`,(e,t)=>{kOe.init(e,t),G0.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bke(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new g1(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(V1(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(V1(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function JAe(e){return new qAe({type:`transform`,transform:e})}var a2=$(`ZodOptional`,(e,t)=>{_0.init(e,t),G0.init(e,t),e._zod.processJSONSchema=(t,n,r)=>V0(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function o2(e){return new a2({type:`optional`,innerType:e})}var YAe=$(`ZodExactOptional`,(e,t)=>{AOe.init(e,t),G0.init(e,t),e._zod.processJSONSchema=(t,n,r)=>V0(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function XAe(e){return new YAe({type:`optional`,innerType:e})}var ZAe=$(`ZodNullable`,(e,t)=>{jOe.init(e,t),G0.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gke(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function s2(e){return new ZAe({type:`nullable`,innerType:e})}var QAe=$(`ZodDefault`,(e,t)=>{MOe.init(e,t),G0.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qke(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function $Ae(e,t){return new QAe({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():M1(t)}})}var eje=$(`ZodPrefault`,(e,t)=>{NOe.init(e,t),G0.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jke(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function tje(e,t){return new eje({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():M1(t)}})}var c2=$(`ZodNonOptional`,(e,t)=>{POe.init(e,t),G0.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kke(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function nje(e,t){return new c2({type:`nonoptional`,innerType:e,...F1(t)})}var rje=$(`ZodCatch`,(e,t)=>{FOe.init(e,t),G0.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yke(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ije(e,t){return new rje({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var aje=$(`ZodPipe`,(e,t)=>{IOe.init(e,t),G0.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xke(e,t,n,r),e.in=t.in,e.out=t.out});function l2(e,t){return new aje({type:`pipe`,in:e,out:t})}var oje=$(`ZodReadonly`,(e,t)=>{LOe.init(e,t),G0.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zke(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sje(e){return new oje({type:`readonly`,innerType:e})}var cje=$(`ZodCustom`,(e,t)=>{ROe.init(e,t),G0.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zke(e,t,n,r)});function lje(e,t={}){return kke(cje,e,t)}function uje(e,t){return Ake(e,t)}function dje(e){return pke(Z0,e)}var u2=`atrium:lastChatId`;function fje(e){try{localStorage.setItem(u2,e)}catch{}}function pje(){try{return localStorage.getItem(u2)}catch{return null}}function mje(e){let t=e instanceof Error?`${e.name}: ${e.message}`:String(e??``);return t.includes(`Failed to fetch dynamically imported module`)||t.includes(`Importing a module script failed`)||t.includes(`error loading dynamically imported module`)||t.includes(`Unable to preload CSS`)}var d2=`atrium:chunkReloadAt`,hje=6e4;function gje(){try{return typeof sessionStorage>`u`?null:sessionStorage}catch{return null}}function _je(e,t=gje()){if(t===null)return!1;try{let n=Number(t.getItem(d2)??0);return Number.isFinite(n)&&e-n<hje?!1:(t.setItem(d2,String(e)),!0)}catch{return!1}}var f2=null,p2=null,m2=null;async function vje(){try{let e=await fetch(`/config.json`,{cache:`no-store`});if(e.ok){let t=await e.json(),n=t?.convexSiteUrl;typeof n==`string`&&n.trim()&&(p2=n.trim());let r=t?.widgetSandboxOrigin;typeof r==`string`&&r.trim()&&(m2=r.trim());let i=t?.convexUrl;if(typeof i==`string`&&i.trim())return f2=i.trim(),f2}}catch{}throw Error(`No Convex URL configured: serve /config.json {"convexUrl":"…"} (production) or set VITE_CONVEX_URL (local dev).`)}function yje(e){try{let t=new URL(e);return t.hostname.endsWith(`.convex.cloud`)?(t.hostname=t.hostname.replace(/\.convex\.cloud$/,`.convex.site`),t.origin):t.port?(t.port=String(Number(t.port)+1),t.origin):e}catch{return e}}function h2(){return p2||(f2?yje(f2):null)}function g2(){return f2||null}function _2(){return m2||null}var bje=`<!doctype html>
|
|
306
|
+
<meta charset="utf-8" />
|
|
307
|
+
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
308
|
+
<title>MCP App sandbox</title>
|
|
309
|
+
<style>html,body{height:100%;margin:0;background:transparent}iframe{display:block;width:100%;height:100%;border:0;background:transparent}</style>
|
|
310
|
+
<body>
|
|
311
|
+
<script>
|
|
312
|
+
(() => {
|
|
313
|
+
if (window.self === window.top) throw new Error("invalid MCP App sandbox host");
|
|
314
|
+
let hostOrigin;
|
|
315
|
+
try {
|
|
316
|
+
const referrer = new URL(document.referrer);
|
|
317
|
+
if (referrer.protocol !== "http:" && referrer.protocol !== "https:") throw new Error();
|
|
318
|
+
hostOrigin = referrer.origin;
|
|
319
|
+
} catch { throw new Error("invalid MCP App sandbox parent"); }
|
|
320
|
+
try { void window.top.document; throw new Error("MCP App sandbox isolation failed"); } catch (error) {
|
|
321
|
+
if (error instanceof Error && error.message === "MCP App sandbox isolation failed") throw error;
|
|
322
|
+
}
|
|
323
|
+
const createInner = (allowScripts = true) => {
|
|
324
|
+
const frame = document.createElement("iframe");
|
|
325
|
+
// Block native popups here without reserving widget globals such as open.
|
|
326
|
+
frame.setAttribute("sandbox", allowScripts ? "allow-scripts allow-forms" : "");
|
|
327
|
+
return frame;
|
|
328
|
+
};
|
|
329
|
+
let inner = createInner();
|
|
330
|
+
document.body.appendChild(inner);
|
|
331
|
+
const widgetPortsOffered = new Set();
|
|
332
|
+
const blockDescendantFrames = true;
|
|
333
|
+
const descendantSelector = "iframe,frame,object,embed,portal,fencedframe,webview,browser";
|
|
334
|
+
const hasBlockedDescendant = root => {
|
|
335
|
+
if (root.querySelector(descendantSelector)) return true;
|
|
336
|
+
for (const template of root.querySelectorAll("template")) {
|
|
337
|
+
if (hasBlockedDescendant(template.content)) return true;
|
|
338
|
+
}
|
|
339
|
+
return false;
|
|
340
|
+
};
|
|
341
|
+
const documentGuard = "\\u003cscript>(()=>{\\n const blocked=[\\"iframe\\",\\"frame\\",\\"object\\",\\"embed\\",\\"portal\\",\\"fencedframe\\",\\"webview\\",\\"browser\\"];\\n const apply=Reflect.apply;\\n const defineProperty=Object.defineProperty;\\n const getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor;\\n const toString=String;\\n const toLowerCase=String.prototype.toLowerCase;\\n const lastIndexOf=String.prototype.lastIndexOf;\\n const slice=String.prototype.slice;\\n const includes=Array.prototype.includes;\\n const regexpTest=RegExp.prototype.test;\\n const descendantMarkup=/\\u003c\\\\s*(?:iframe|frame|object|embed|portal|fencedframe|webview|browser)\\\\b/iu;\\n const reject=()=>{throw new Error(\\"sandbox descendant browsing contexts are disabled\\");};\\n const assertName=name=>{const value=apply(toLowerCase,toString(name),[]);const separator=apply(lastIndexOf,value,[\\":\\"]);const localName=separator\\u003c0?value:apply(slice,value,[separator+1]);if(apply(includes,blocked,[localName]))reject();};\\n const assertMarkup=value=>{if(apply(regexpTest,descendantMarkup,[toString(value)]))reject();};\\n const lock=(target,name,value)=>{try{defineProperty(target,name,{value,writable:false,configurable:false});}catch{}};\\n for(const name of [\\"RTCPeerConnection\\",\\"webkitRTCPeerConnection\\",\\"RTCIceGatherer\\",\\"RTCIceTransport\\",\\"RTCDtlsTransport\\",\\"RTCSctpTransport\\",\\"RTCDataChannel\\"])lock(globalThis,name,undefined);\\n const createElement=Document.prototype.createElement;\\n lock(Document.prototype,\\"createElement\\",function(name,...args){assertName(name);return Reflect.apply(createElement,this,[name,...args]);});\\n const createElementNS=Document.prototype.createElementNS;\\n lock(Document.prototype,\\"createElementNS\\",function(namespace,name,...args){assertName(name);return Reflect.apply(createElementNS,this,[namespace,name,...args]);});\\n const wrapSetter=(target,name)=>{const descriptor=getOwnPropertyDescriptor(target,name);if(!descriptor?.set)return;try{defineProperty(target,name,{get:descriptor.get,set(value){assertMarkup(value);return apply(descriptor.set,this,[value]);},enumerable:descriptor.enumerable,configurable:false});}catch{}};\\n wrapSetter(Element.prototype,\\"innerHTML\\");wrapSetter(Element.prototype,\\"outerHTML\\");\\n if(globalThis.ShadowRoot)wrapSetter(ShadowRoot.prototype,\\"innerHTML\\");\\n const wrapMethod=(target,name,indexes)=>{const original=target?.[name];if(typeof original!==\\"function\\")return;lock(target,name,function(...args){if(indexes){for(let index=0;index\\u003cindexes.length;index+=1)assertMarkup(args[indexes[index]]);}else{for(let index=0;index\\u003cargs.length;index+=1)assertMarkup(args[index]);}return apply(original,this,args);});};\\n wrapMethod(Element.prototype,\\"insertAdjacentHTML\\",[1]);wrapMethod(Document.prototype,\\"write\\");wrapMethod(Document.prototype,\\"writeln\\");wrapMethod(Range.prototype,\\"createContextualFragment\\",[0]);wrapMethod(DOMParser.prototype,\\"parseFromString\\",[0]);\\n wrapMethod(Element.prototype,\\"setHTMLUnsafe\\",[0]);wrapMethod(Element.prototype,\\"setHTML\\",[0]);\\n if(globalThis.ShadowRoot){wrapMethod(ShadowRoot.prototype,\\"setHTMLUnsafe\\",[0]);wrapMethod(ShadowRoot.prototype,\\"setHTML\\",[0]);}\\n})();\\u003c/script>";
|
|
342
|
+
const resolveLeadingDoctypeEnd = (html) => {
|
|
343
|
+
let index = html.charCodeAt(0) === 0xfeff ? 1 : 0;
|
|
344
|
+
const whitespace = new Set([9, 10, 12, 13, 32]);
|
|
345
|
+
while (true) {
|
|
346
|
+
while (index < html.length && whitespace.has(html.charCodeAt(index))) index += 1;
|
|
347
|
+
if (html.slice(index, index + 4) !== "<!--") break;
|
|
348
|
+
const commentEnd = html.indexOf("-->", index + 4);
|
|
349
|
+
if (commentEnd < 0) return 0;
|
|
350
|
+
index = commentEnd + 3;
|
|
351
|
+
}
|
|
352
|
+
if (html.slice(index, index + 9).toLowerCase() !== "<!doctype") return 0;
|
|
353
|
+
let quote = "";
|
|
354
|
+
for (let cursor = index + 9; cursor < html.length; cursor += 1) {
|
|
355
|
+
const char = html[cursor];
|
|
356
|
+
if (quote) { if (char === quote) quote = ""; continue; }
|
|
357
|
+
if (char === '"' || char === "'") { quote = char; continue; }
|
|
358
|
+
if (char === ">") return cursor + 1;
|
|
359
|
+
}
|
|
360
|
+
return 0;
|
|
361
|
+
};
|
|
362
|
+
const guardDocument = html => {
|
|
363
|
+
if (!blockDescendantFrames) return html;
|
|
364
|
+
if (hasBlockedDescendant(new DOMParser().parseFromString(html, "text/html"))) {
|
|
365
|
+
throw new Error("sandbox descendant browsing contexts are disabled");
|
|
366
|
+
}
|
|
367
|
+
const doctypeEnd = resolveLeadingDoctypeEnd(html);
|
|
368
|
+
return html.slice(0, doctypeEnd) + documentGuard + html.slice(doctypeEnd);
|
|
369
|
+
};
|
|
370
|
+
window.addEventListener("message", (event) => {
|
|
371
|
+
if (event.source === window.parent) {
|
|
372
|
+
if (event.origin !== hostOrigin) return;
|
|
373
|
+
if (event.data?.method === "ui/notifications/sandbox-resource-ready") {
|
|
374
|
+
const params = event.data.params ?? {};
|
|
375
|
+
if (typeof params.html === "string") {
|
|
376
|
+
const guardedHtml = guardDocument(params.html);
|
|
377
|
+
// Replace the browsing context so a superseded document cannot race
|
|
378
|
+
// the new wrapper's first private bridge-port offer.
|
|
379
|
+
const nextInner = createInner(params.allowScripts !== false);
|
|
380
|
+
nextInner.addEventListener("load", () => {
|
|
381
|
+
if (inner !== nextInner || typeof params.renderId !== "string") return;
|
|
382
|
+
window.parent.postMessage({
|
|
383
|
+
jsonrpc: "2.0",
|
|
384
|
+
method: "ui/notifications/sandbox-resource-loaded",
|
|
385
|
+
params: { renderId: params.renderId },
|
|
386
|
+
}, hostOrigin);
|
|
387
|
+
}, { once: true });
|
|
388
|
+
widgetPortsOffered.clear();
|
|
389
|
+
nextInner.srcdoc = guardedHtml;
|
|
390
|
+
inner.replaceWith(nextInner);
|
|
391
|
+
inner = nextInner;
|
|
392
|
+
}
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
if (typeof event.data?.method === "string" && event.data.method.startsWith("ui/notifications/sandbox-")) return;
|
|
396
|
+
inner.contentWindow?.postMessage(event.data, "*");
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
if (event.source === inner.contentWindow) {
|
|
400
|
+
if (typeof event.data?.method === "string" && event.data.method.startsWith("ui/notifications/sandbox-")) return;
|
|
401
|
+
if (event.data?.type === "openclaw:widget-bridge-port-offer" || event.data?.type === "openclaw:widget-prompt-offer") {
|
|
402
|
+
const port = event.ports[0];
|
|
403
|
+
// Each wrapper offers its private channels before untrusted code runs.
|
|
404
|
+
// Only the first offer of each kind belongs to this document instance.
|
|
405
|
+
if (!widgetPortsOffered.has(event.data.type) && port) {
|
|
406
|
+
widgetPortsOffered.add(event.data.type);
|
|
407
|
+
window.parent.postMessage(event.data, hostOrigin, [port]);
|
|
408
|
+
} else {
|
|
409
|
+
port?.close();
|
|
410
|
+
}
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
window.parent.postMessage(event.data, hostOrigin);
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
window.parent.postMessage({
|
|
417
|
+
jsonrpc: "2.0",
|
|
418
|
+
method: "ui/notifications/sandbox-proxy-ready",
|
|
419
|
+
params: { sandboxUrl: window.location.href },
|
|
420
|
+
}, hostOrigin);
|
|
421
|
+
})();
|
|
422
|
+
<\/script>
|
|
423
|
+
</body>`,v2={"Content-Type":`text/html; charset=utf-8`,"Content-Security-Policy":`default-src 'none'; script-src 'self' 'unsafe-inline' https://cdnjs.cloudflare.com https://cdn.jsdelivr.net https://esm.sh https://unpkg.com https://fonts.googleapis.com https://fonts.gstatic.com https://fonts.bunny.net; style-src 'self' 'unsafe-inline' https://cdnjs.cloudflare.com https://cdn.jsdelivr.net https://esm.sh https://unpkg.com https://fonts.googleapis.com https://fonts.gstatic.com https://fonts.bunny.net; img-src 'self' data: https://cdnjs.cloudflare.com https://cdn.jsdelivr.net https://esm.sh https://unpkg.com https://fonts.googleapis.com https://fonts.gstatic.com https://fonts.bunny.net; media-src 'self' data: https: blob:; font-src 'self' https://cdnjs.cloudflare.com https://cdn.jsdelivr.net https://esm.sh https://unpkg.com https://fonts.googleapis.com https://fonts.gstatic.com https://fonts.bunny.net; connect-src 'none'; webrtc 'block'; frame-src 'none'; base-uri 'self'; object-src 'none'; form-action 'none'; frame-ancestors http: https:`,"Permissions-Policy":`camera=(), microphone=(), geolocation=(), clipboard-write=()`,"Cross-Origin-Resource-Policy":`cross-origin`,"Origin-Agent-Cluster":`?1`,"Referrer-Policy":`no-referrer`,"X-Content-Type-Options":`nosniff`},xje=`openclaw:widget-size`,Sje=`openclaw:widget-theme`,Cje=`openclaw:widget-chat-host`,wje=`openclaw:widget-bridge-ready`,Tje=`openclaw:widget-prompt-offer`,Eje=`openclaw:widget-prompt-host-ready`,Dje=`openclaw:widget-bridge-port-offer`,Oje=`openclaw:widget-runtime-error`,kje=`ui/notifications/sandbox-resource-ready`,Aje=`allow-scripts allow-forms`,jje=`allow-scripts allow-same-origin allow-forms`,Mje=8e3,Nje=1e4;function Pje(e){return typeof e!=`number`||!Number.isFinite(e)||e<=0?null:Math.min(Mje,Math.max(48,Math.trunc(e)))}function Fje(e,t,n){return t!=null&&e.source===t&&e.origin===n}function y2(e,t,n=[]){if(!e||!e.trim())return{mode:`simple`,reason:`unset`};let r;try{r=new URL(e.trim())}catch{return{mode:`simple`,reason:`invalid`}}if(r.protocol!==`https:`&&r.protocol!==`http:`||r.username!==``||r.password!==``||r.pathname!==`/`&&r.pathname!==``||r.search!==``||r.hash!==``)return{mode:`simple`,reason:`invalid`};let i=r.origin,a=e=>{if(!e)return!1;try{return new URL(e).origin===i}catch{return!1}};return a(t)||n.some(a)?{mode:`simple`,reason:`same-origin`}:r.protocol===`http:`&&t.startsWith(`https:`)?{mode:`simple`,reason:`insecure`}:{mode:`dedicated`,origin:i}}function Ije(e){return e.mode===`dedicated`?`frame-src ${e.origin}`:`frame-src 'none'`}var Lje=`data-atrium-frame-policy`;function Rje(e,t){if(e.head.querySelector(`meta[data-atrium-frame-policy]`))return;let n=e.createElement(`meta`);n.httpEquiv=`Content-Security-Policy`,n.content=t,n.setAttribute(Lje,``),e.head.prepend(n)}function zje(e){return`${e}/`}function Bje(e,t){let n=e;return n?.method===`ui/notifications/sandbox-proxy-ready`&&n.params?.sandboxUrl===t}function Vje(e,t){return{jsonrpc:`2.0`,method:kje,params:{html:e,renderId:t}}}function Hje(){let e=/const documentGuard = ("(?:[^"\\]|\\.)*");/.exec(bje);if(!e)throw Error(`vendored widget sandbox proxy has no documentGuard`);return JSON.parse(e[1])}var Uje=Hje(),b2=`media-src 'self' data: blob:`;function Wje(e){let t=e.split(`;`).map(e=>e.trim()).filter(e=>e!==``),n=!1,r=t.map(e=>e.split(/\s+/)[0].toLowerCase()===`media-src`?(n=!0,b2):e);return n||r.push(b2),r.join(`; `)}var Gje={...v2,"Content-Security-Policy":Wje(v2[`Content-Security-Policy`])}[`Content-Security-Policy`].split(`;`).map(e=>e.trim()).filter(e=>e!==``&&!e.startsWith(`frame-ancestors`)).join(`; `),Kje=`iframe,frame,object,embed,portal,fencedframe,webview,browser`;function qje(e){let t=+(e.charCodeAt(0)===65279),n=new Set([9,10,12,13,32]);for(;;){for(;t<e.length&&n.has(e.charCodeAt(t));)t+=1;if(e.slice(t,t+4)!==`<!--`)break;let r=e.indexOf(`-->`,t+4);if(r<0)return 0;t=r+3}if(e.slice(t,t+9).toLowerCase()!==`<!doctype`)return 0;let r=``;for(let n=t+9;n<e.length;n+=1){let t=e[n];if(r){t===r&&(r=``);continue}if(t===`"`||t===`'`){r=t;continue}if(t===`>`)return n+1}return 0}var x2=class extends Error{};function S2(e){if(e.querySelector(Kje))return!0;for(let t of e.querySelectorAll(`template`))if(S2(t.content))return!0;return!1}function Jje(e,t){if(S2(t(e)))throw new x2(`widget documents may not embed frames`);let n=qje(e),r=`<meta http-equiv="Content-Security-Policy" content="${Gje.replaceAll(`"`,`"`)}">`;return e.slice(0,n)+r+Uje+e.slice(n)}var Yje=[`surface`,`card`,`elevated`,`text`,`text-strong`,`muted`,`border`,`border-strong`,`accent`,`accent-fill`,`accent-fg`,`ok`,`warn`,`danger`,`info`,`radius`,`radius-full`,`scrollbar-size`,`scrollbar-thumb-inset`,`scrollbar-thumb`,`scrollbar-thumb-hover`,`font-body`,`font-mono`],Xje={surface:{cssVar:`--background`},card:{cssVar:`--card`},elevated:{cssVar:`--popover`},text:{cssVar:`--foreground`},"text-strong":{cssVar:`--foreground`},muted:{cssVar:`--muted-foreground`},border:{cssVar:`--border`},"border-strong":{cssVar:`--ring`},accent:{cssVar:`--primary`},"accent-fill":{cssVar:`--primary`},"accent-fg":{cssVar:`--primary-foreground`},ok:{light:`#15803d`,dark:`#22c55e`},warn:{light:`#b45309`,dark:`#f59e0b`},danger:{cssVar:`--destructive`},info:{light:`#2563eb`,dark:`#3b82f6`},radius:{cssVar:`--radius`},"radius-full":{value:`9999px`},"scrollbar-size":{value:`12px`},"scrollbar-thumb-inset":{value:`3px`},"scrollbar-thumb":{value:`color-mix(in srgb,var(--muted) 32%,transparent)`},"scrollbar-thumb-hover":{value:`color-mix(in srgb,var(--muted) 64%,transparent)`},"font-body":{cssVar:`--ui-font-sans`},"font-mono":{cssVar:`--ui-font-mono`}};function Zje(e,t){let n={};for(let r of Yje){let i=Xje[r],a=`cssVar`in i?e(i.cssVar).trim():`value`in i?i.value:i[t];a&&a.length<=256&&(n[r]=a)}return{type:Sje,mode:t,tokens:n}}var Qje=6e4,$je=100;function eMe(e){if(typeof e!=`string`)return null;let t=e.trim();return!t||t.length>4e3||t.startsWith(`/`)||t.startsWith(`!`)?null:t}var tMe=new class{byKey=new Map;allow(e,t){let n=t-Qje,r=(this.byKey.get(e)??[]).filter(e=>e>n);if(!this.byKey.has(e)&&this.byKey.size>=$je){let e=this.byKey.keys().next().value;e!==void 0&&this.byKey.delete(e)}return r.length>=10?(this.byKey.set(e,r),!1):(r.push(t),this.byKey.set(e,r),!0)}};function nMe(e,t,n,r,i=tMe){let a=eMe(e);return a===null?{ok:!1,reason:`text`}:!t.connected||!t.visible||!t.focused?{ok:!1,reason:`not-interactable`}:i.allow(n,r)?{ok:!0,text:a}:{ok:!1,reason:`rate`}}var C2=class{offered=!1;loaded=!1;pending=null;adopted=null;offer(e){return e?this.offered?(e.close(),null):(this.offered=!0,this.loaded?(this.adopted=e,e):(this.pending=e,null)):null}load(){return this.loaded=!0,this.pending&&!this.adopted?(this.adopted=this.pending,this.pending=null,this.adopted):null}dispose(){this.pending?.close(),this.adopted?.close(),this.pending=null,this.adopted=null}},rMe=class{deps;pendingText=null;constructor(e){this.deps=e}get pending(){return this.pendingText}offer(e){return this.pendingText===null?this.deps.mustConfirm()?(this.pendingText=e,this.deps.onPending(e),`pending`):(this.dispatch(e),`sent`):`ignored`}confirm(){let e=this.pendingText;e!==null&&(this.pendingText=null,this.deps.onPending(null),this.dispatch(e))}cancel(){this.pendingText!==null&&(this.pendingText=null,this.deps.onPending(null))}dispatch(e){this.deps.send(e).then(e=>{e||this.deps.onFailed()},()=>this.deps.onFailed())}};function iMe(e,t,n,r){return{chatId:e,text:t,clientMessageId:r,...n?{routedAgent:n}:{}}}function aMe(){let e=document.documentElement,t=getComputedStyle(e);return Zje(e=>t.getPropertyValue(e),e.classList.contains(`dark`)?`dark`:`light`)}function oMe(e){return new DOMParser().parseFromString(e,`text/html`)}async function sMe(e,t,n){let r=h2();if(!r)return{ok:!1,unavailable:!1};let i=new URLSearchParams(t),a=await fetch(`${r.replace(/\/$/,``)}/api/v1/widget-view?${i}`,{headers:{Authorization:`Bearer ${e}`},cache:`no-store`,signal:n});return a.ok?{ok:!0,html:await a.text()}:{ok:!1,unavailable:a.status===404}}function cMe({data:e}){let t=e?.viewId??``,n=e?.title?.trim()||l(),r=U(e=>e.metadata?.custom?.chatId??``),i=U(e=>e.metadata?.custom?.messageId??``),a=U(e=>{let t=e.metadata?.custom;return t?.routedInstanceName&&t.routedAgentId?`${t.routedInstanceName}\u0000${t.routedAgentId}`:null}),o=Qv(),s=(0,z.useRef)(o);s.current=o;let c=o!=null&&o!==``,u=P(L.widgets.widgetConfigForMessage,r&&i?{chatId:r,messageId:i}:`skip`),d=u?.effective===!0,f=I(L.send.sendMessage),[p,m]=(0,z.useState)(0),[h,g]=(0,z.useState)({state:`loading`}),[_,v]=(0,z.useState)(e?.preferredHeight??320),[y,b]=(0,z.useState)(null),[x,S]=(0,z.useState)(null),[C,w]=(0,z.useState)(null),T=(0,z.useRef)(null),E=(0,z.useMemo)(()=>y2(_2(),window.location.origin,[h2(),g2()]),[]),D=E.mode===`dedicated`?E.origin:`null`,O=E.mode===`dedicated`?zje(E.origin):null;(0,z.useEffect)(()=>{let e=s.current;if(!d||!e||!r||!i||!t)return;let n=new AbortController,a=!1,o=window.setTimeout(()=>n.abort(),Nje*2);return g({state:`loading`}),sMe(e,{chatId:r,messageId:i,viewId:t},n.signal).then(e=>{a||g(e.ok?{state:`ready`,html:e.html}:{state:`error`,unavailable:e.unavailable})}).catch(()=>{a||g({state:`error`,unavailable:!1})}).finally(()=>window.clearTimeout(o)),()=>{a=!0,window.clearTimeout(o),n.abort()}},[d,c,r,i,t,p]);let k=(0,z.useMemo)(()=>{if(h.state!==`ready`||E.mode!==`simple`)return null;try{return Jje(h.html,oMe)}catch(e){return e instanceof x2?``:null}},[h,E.mode]),ee=(0,z.useRef)(new C2),A=(0,z.useRef)(null),j=(0,z.useCallback)(()=>{let e=T.current?.contentWindow;if(!e)return;let t=E.mode===`dedicated`?E.origin:`*`;e.postMessage(aMe(),t),e.postMessage({type:Cje},t)},[E]),te=`${r}\u0000${t}\u0000${p}`,ne=(0,z.useRef)(!1);ne.current=u?.promptConfirm===!0;let M=(0,z.useRef)(async()=>!1);M.current=async e=>{if(!r)return!1;let[t,n]=a?.split(`\0`)??[];try{let i=iMe(r,e,t&&n?{instanceName:t,agentId:n}:null,crypto.randomUUID());return await f({...i,chatId:i.chatId}),!0}catch{return!1}};let[N]=(0,z.useState)(()=>new rMe({mustConfirm:()=>ne.current,send:e=>M.current(e),onPending:e=>S(e),onFailed:()=>w(Zc())})),re=(0,z.useCallback)(e=>{let t=T.current,n=nMe(e,{connected:t?.isConnected===!0,visible:t!==null&&(typeof t.checkVisibility==`function`?t.checkVisibility():t.getClientRects().length>0),focused:t!==null&&t.ownerDocument.activeElement===t},te,Date.now());n.ok&&N.offer(n.text)},[te,N]),ie=(0,z.useCallback)(e=>{e&&(e.addEventListener(`message`,e=>{let t=e.data;t?.type===`openclaw:widget-prompt`&&re(t.prompt)}),e.start(),e.postMessage({type:Eje}))},[re]);(0,z.useEffect)(()=>{let e=new C2;return ee.current=e,()=>e.dispose()},[h,p]),(0,z.useEffect)(()=>{if(h.state!==`ready`)return;let e=e=>{let t=T.current;if(!Fje(e,t?.contentWindow,D))return;let n=e.data;if(!(!n||typeof n!=`object`)){if(E.mode===`dedicated`&&O){if(Bje(n,O)){let e=crypto.randomUUID();A.current=e,t.contentWindow.postMessage(Vje(h.html,e),E.origin),ie(ee.current.load()),j();return}if(n.method===`ui/notifications/sandbox-resource-loaded`)return}switch(n.type){case xje:{let e=Pje(n.height);e!==null&&v(e);return}case wje:j();return;case Tje:ie(ee.current.offer(e.ports[0]));return;case Dje:e.ports[0]?.close();return;case Oje:typeof n.message==`string`&&b(e=>e??n.message.toString().slice(0,300));return}}};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[h,D,E,O,ie,j]),(0,z.useEffect)(()=>{if(h.state!==`ready`)return;let e=new MutationObserver(()=>j());return e.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`,`style`]}),()=>e.disconnect()},[h.state,j]);let ae=(0,z.useCallback)(()=>{E.mode===`simple`&&(ie(ee.current.load()),j())},[E.mode,ie,j]);return t?u===void 0?(0,B.jsx)(`figure`,{className:`oc-widget`,"aria-label":n,children:(0,B.jsx)(`div`,{className:`oc-widget__skeleton`,role:`status`,"aria-label":Wo(),style:{minHeight:e?.preferredHeight??320}})}):d?(0,B.jsxs)(`figure`,{className:`oc-widget`,"aria-label":n,children:[(0,B.jsxs)(`figcaption`,{className:`oc-widget__title`,children:[(0,B.jsx)(xS,{className:`size-4`,"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:n})]}),h.state===`loading`?(0,B.jsx)(`div`,{className:`oc-widget__skeleton`,role:`status`,"aria-label":Wo(),style:{minHeight:e?.preferredHeight??320}}):h.state===`error`||k===``?(0,B.jsxs)(`div`,{className:`oc-widget__error`,role:`alert`,children:[(0,B.jsx)(yC,{className:`size-4`,"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:k===``?vu():h.state===`error`&&h.unavailable?Uu():Yl()}),(0,B.jsxs)(Ov,{variant:`outline`,size:`sm`,onClick:()=>m(e=>e+1),children:[(0,B.jsx)(QS,{className:`size-4`,"aria-hidden":`true`}),zr()]})]}):(0,B.jsxs)(B.Fragment,{children:[y?(0,B.jsxs)(`details`,{className:`oc-widget__notice`,role:`status`,children:[(0,B.jsx)(`summary`,{children:cne()}),(0,B.jsx)(`code`,{className:`oc-widget__notice-detail`,children:y})]}):null,E.mode===`simple`?k===null?null:(0,B.jsx)(`iframe`,{ref:T,className:`oc-widget__frame`,title:n,sandbox:Aje,referrerPolicy:`no-referrer`,srcDoc:k,style:{height:_},onLoad:ae},`${t}:${p}`):(0,B.jsx)(`iframe`,{ref:T,className:`oc-widget__frame`,title:n,sandbox:jje,referrerPolicy:`origin`,src:O,style:{height:_}},`${t}:${p}`),x===null?null:(0,B.jsxs)(`div`,{className:`oc-widget__confirm`,role:`alertdialog`,"aria-label":xn(),children:[(0,B.jsx)(`p`,{className:`oc-widget__confirm-text`,children:Sl()}),(0,B.jsx)(`blockquote`,{className:`oc-widget__confirm-quote`,children:x}),(0,B.jsxs)(`div`,{className:`oc-widget__confirm-actions`,children:[(0,B.jsx)(Ov,{variant:`ghost`,size:`sm`,onClick:()=>N.cancel(),children:Dc()}),(0,B.jsx)(Ov,{size:`sm`,onClick:()=>N.confirm(),children:qn()})]})]}),C?(0,B.jsx)(`p`,{className:`oc-widget__notice`,role:`status`,children:C}):null]})]}):(0,B.jsxs)(`div`,{className:`oc-widget oc-widget--off`,role:`note`,children:[(0,B.jsx)(xS,{className:`size-4`,"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:di()})]}):null}function w2(e){return new Map(e.map(e=>[e._id,e]))}function T2(e,t){let n=t.parentId??null;return n===null?null:e.has(n)?n:null}function E2(e){return[...e].sort((e,t)=>(e.sortKey??0)-(t.sortKey??0))}function lMe(e){let t=w2(e);return E2(e.filter(e=>T2(t,e)===null))}function D2(e,t){let n=w2(e);return E2(e.filter(e=>T2(n,e)===t))}function uMe(e,t){let n=w2(e);if(!n.has(t))return[];let r=new Map;for(let t of e){let e=T2(n,t);if(e===null)continue;let i=r.get(e);i===void 0?r.set(e,[t._id]):i.push(t._id)}let i=[],a=new Set,o=[t];for(;o.length>0;){let e=o.shift();if(!a.has(e)){a.add(e),i.push(e);for(let t of r.get(e)??[])o.push(t)}}return i}function dMe(e,t,n){return n===null?!1:n===t?!0:uMe(e,t).includes(n)}function O2(e,t,n){return!(dMe(e,t,n)||!e.some(e=>e._id===t)||n!==null&&!e.some(e=>e._id===n))}function k2(e,t){let n=w2(e),r=n.get(t);if(r===void 0)return[];let i=new Set([t]),a=[r];for(;;){let e=T2(n,r);if(e===null||i.has(e))return a.reverse();i.add(e),r=n.get(e),a.push(r)}}function fMe(e,t){let n=k2(e,t);return n.length>0?n[0]._id:t}function pMe(e){let t=[],n=(r,i)=>{for(let a of D2(e,r))t.push({node:a,depth:i}),n(a._id,i+1)};return n(null,1),t}var A2=typeof window<`u`&&window.location?window.location.hostname:``,j2=e=>`oc.brand.${e}`;function mMe(e){if(typeof e!=`object`||!e||Array.isArray(e)||!(`tokens`in e))return!1;let t=e.tokens;if(t===null)return!0;if(typeof t!=`object`)return!1;let n=t.colors;return typeof n==`object`&&!!n&&`light`in n&&`dark`in n}function hMe(e){try{let t=localStorage.getItem(j2(e));if(!t)return null;let n=JSON.parse(t);return mMe(n)?n:null}catch{return null}}function gMe(e,t){try{localStorage.setItem(j2(e),JSON.stringify(t))}catch{}}var _Me=`background.foreground.card.card-foreground.popover.popover-foreground.primary.primary-foreground.secondary.secondary-foreground.muted.muted-foreground.accent.accent-foreground.destructive.destructive-foreground.border.input.ring.chart-1.chart-2.chart-3.chart-4.chart-5.sidebar.sidebar-foreground.sidebar-primary.sidebar-primary-foreground.sidebar-accent.sidebar-accent-foreground.sidebar-border.sidebar-ring.highlight.bookmark.voice`.split(`.`),M2=[{key:`ocean`,name:`Ocean`,tokens:{colors:{light:{background:`oklch(0.985 0.012 230)`,foreground:`oklch(0.22 0.04 245)`,card:`oklch(0.995 0.008 230)`,"card-foreground":`oklch(0.22 0.04 245)`,popover:`oklch(0.995 0.008 230)`,"popover-foreground":`oklch(0.22 0.04 245)`,primary:`oklch(0.55 0.13 235)`,"primary-foreground":`oklch(0.99 0.01 230)`,secondary:`oklch(0.93 0.03 220)`,"secondary-foreground":`oklch(0.28 0.05 240)`,muted:`oklch(0.94 0.02 225)`,"muted-foreground":`oklch(0.5 0.04 235)`,accent:`oklch(0.9 0.05 200)`,"accent-foreground":`oklch(0.28 0.06 230)`,border:`oklch(0.88 0.03 225)`,input:`oklch(0.88 0.03 225)`,ring:`oklch(0.55 0.13 235)`,"chart-1":`oklch(0.6 0.13 235)`,"chart-2":`oklch(0.65 0.12 200)`,"chart-3":`oklch(0.55 0.1 260)`,"chart-4":`oklch(0.7 0.11 180)`,"chart-5":`oklch(0.5 0.12 215)`,sidebar:`oklch(0.96 0.02 228)`,"sidebar-foreground":`oklch(0.24 0.04 245)`,"sidebar-primary":`oklch(0.55 0.13 235)`,"sidebar-primary-foreground":`oklch(0.99 0.01 230)`,"sidebar-accent":`oklch(0.9 0.05 200)`,"sidebar-accent-foreground":`oklch(0.28 0.06 230)`,"sidebar-border":`oklch(0.87 0.03 225)`,"sidebar-ring":`oklch(0.55 0.13 235)`},dark:{background:`oklch(0.2 0.03 245)`,foreground:`oklch(0.95 0.02 225)`,card:`oklch(0.25 0.04 245)`,"card-foreground":`oklch(0.95 0.02 225)`,popover:`oklch(0.25 0.04 245)`,"popover-foreground":`oklch(0.95 0.02 225)`,primary:`oklch(0.7 0.12 230)`,"primary-foreground":`oklch(0.18 0.04 245)`,secondary:`oklch(0.3 0.04 240)`,"secondary-foreground":`oklch(0.95 0.02 225)`,muted:`oklch(0.3 0.03 242)`,"muted-foreground":`oklch(0.72 0.04 228)`,accent:`oklch(0.4 0.07 210)`,"accent-foreground":`oklch(0.96 0.02 220)`,border:`oklch(0.35 0.03 242)`,input:`oklch(0.35 0.03 242)`,ring:`oklch(0.7 0.12 230)`,"chart-1":`oklch(0.7 0.13 230)`,"chart-2":`oklch(0.72 0.12 195)`,"chart-3":`oklch(0.65 0.11 260)`,"chart-4":`oklch(0.76 0.1 180)`,"chart-5":`oklch(0.62 0.12 215)`,sidebar:`oklch(0.23 0.04 246)`,"sidebar-foreground":`oklch(0.95 0.02 225)`,"sidebar-primary":`oklch(0.7 0.12 230)`,"sidebar-primary-foreground":`oklch(0.18 0.04 245)`,"sidebar-accent":`oklch(0.4 0.07 210)`,"sidebar-accent-foreground":`oklch(0.96 0.02 220)`,"sidebar-border":`oklch(0.34 0.03 242)`,"sidebar-ring":`oklch(0.7 0.12 230)`}},radius:`0.75rem`,fontSans:`ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif`}},{key:`forest`,name:`Forest`,tokens:{colors:{light:{background:`oklch(0.985 0.012 130)`,foreground:`oklch(0.24 0.04 145)`,card:`oklch(0.995 0.008 130)`,"card-foreground":`oklch(0.24 0.04 145)`,popover:`oklch(0.995 0.008 130)`,"popover-foreground":`oklch(0.24 0.04 145)`,primary:`oklch(0.52 0.12 150)`,"primary-foreground":`oklch(0.99 0.01 130)`,secondary:`oklch(0.93 0.04 130)`,"secondary-foreground":`oklch(0.3 0.05 150)`,muted:`oklch(0.94 0.03 135)`,"muted-foreground":`oklch(0.5 0.04 145)`,accent:`oklch(0.9 0.06 115)`,"accent-foreground":`oklch(0.3 0.06 150)`,border:`oklch(0.88 0.03 135)`,input:`oklch(0.88 0.03 135)`,ring:`oklch(0.52 0.12 150)`,"chart-1":`oklch(0.58 0.13 150)`,"chart-2":`oklch(0.68 0.12 120)`,"chart-3":`oklch(0.6 0.11 95)`,"chart-4":`oklch(0.55 0.1 175)`,"chart-5":`oklch(0.5 0.12 140)`,sidebar:`oklch(0.96 0.02 132)`,"sidebar-foreground":`oklch(0.26 0.04 145)`,"sidebar-primary":`oklch(0.52 0.12 150)`,"sidebar-primary-foreground":`oklch(0.99 0.01 130)`,"sidebar-accent":`oklch(0.9 0.06 115)`,"sidebar-accent-foreground":`oklch(0.3 0.06 150)`,"sidebar-border":`oklch(0.87 0.03 135)`,"sidebar-ring":`oklch(0.52 0.12 150)`},dark:{background:`oklch(0.2 0.03 150)`,foreground:`oklch(0.95 0.02 130)`,card:`oklch(0.25 0.04 150)`,"card-foreground":`oklch(0.95 0.02 130)`,popover:`oklch(0.25 0.04 150)`,"popover-foreground":`oklch(0.95 0.02 130)`,primary:`oklch(0.68 0.13 145)`,"primary-foreground":`oklch(0.18 0.04 150)`,secondary:`oklch(0.3 0.04 148)`,"secondary-foreground":`oklch(0.95 0.02 130)`,muted:`oklch(0.3 0.03 150)`,"muted-foreground":`oklch(0.72 0.04 135)`,accent:`oklch(0.4 0.07 120)`,"accent-foreground":`oklch(0.96 0.02 125)`,border:`oklch(0.35 0.03 148)`,input:`oklch(0.35 0.03 148)`,ring:`oklch(0.68 0.13 145)`,"chart-1":`oklch(0.68 0.14 148)`,"chart-2":`oklch(0.74 0.12 120)`,"chart-3":`oklch(0.68 0.11 95)`,"chart-4":`oklch(0.62 0.1 175)`,"chart-5":`oklch(0.6 0.12 140)`,sidebar:`oklch(0.23 0.04 150)`,"sidebar-foreground":`oklch(0.95 0.02 130)`,"sidebar-primary":`oklch(0.68 0.13 145)`,"sidebar-primary-foreground":`oklch(0.18 0.04 150)`,"sidebar-accent":`oklch(0.4 0.07 120)`,"sidebar-accent-foreground":`oklch(0.96 0.02 125)`,"sidebar-border":`oklch(0.34 0.03 148)`,"sidebar-ring":`oklch(0.68 0.13 145)`}},radius:`0.375rem`,fontSans:`Georgia, Cambria, 'Times New Roman', Times, serif`}},{key:`dusk`,name:`Dusk`,tokens:{colors:{light:{background:`oklch(0.985 0.012 300)`,foreground:`oklch(0.24 0.05 300)`,card:`oklch(0.995 0.008 300)`,"card-foreground":`oklch(0.24 0.05 300)`,popover:`oklch(0.995 0.008 300)`,"popover-foreground":`oklch(0.24 0.05 300)`,primary:`oklch(0.55 0.16 300)`,"primary-foreground":`oklch(0.99 0.01 300)`,secondary:`oklch(0.93 0.04 310)`,"secondary-foreground":`oklch(0.3 0.06 300)`,muted:`oklch(0.94 0.03 305)`,"muted-foreground":`oklch(0.5 0.05 300)`,accent:`oklch(0.9 0.07 70)`,"accent-foreground":`oklch(0.32 0.08 60)`,border:`oklch(0.88 0.03 305)`,input:`oklch(0.88 0.03 305)`,ring:`oklch(0.55 0.16 300)`,"chart-1":`oklch(0.58 0.17 300)`,"chart-2":`oklch(0.7 0.15 70)`,"chart-3":`oklch(0.55 0.15 330)`,"chart-4":`oklch(0.65 0.14 35)`,"chart-5":`oklch(0.5 0.16 280)`,sidebar:`oklch(0.96 0.02 303)`,"sidebar-foreground":`oklch(0.26 0.05 300)`,"sidebar-primary":`oklch(0.55 0.16 300)`,"sidebar-primary-foreground":`oklch(0.99 0.01 300)`,"sidebar-accent":`oklch(0.9 0.07 70)`,"sidebar-accent-foreground":`oklch(0.32 0.08 60)`,"sidebar-border":`oklch(0.87 0.03 305)`,"sidebar-ring":`oklch(0.55 0.16 300)`},dark:{background:`oklch(0.2 0.04 300)`,foreground:`oklch(0.95 0.02 305)`,card:`oklch(0.25 0.05 300)`,"card-foreground":`oklch(0.95 0.02 305)`,popover:`oklch(0.25 0.05 300)`,"popover-foreground":`oklch(0.95 0.02 305)`,primary:`oklch(0.72 0.15 300)`,"primary-foreground":`oklch(0.18 0.04 300)`,secondary:`oklch(0.3 0.05 305)`,"secondary-foreground":`oklch(0.95 0.02 305)`,muted:`oklch(0.3 0.04 303)`,"muted-foreground":`oklch(0.72 0.05 305)`,accent:`oklch(0.45 0.1 65)`,"accent-foreground":`oklch(0.96 0.02 70)`,border:`oklch(0.35 0.04 303)`,input:`oklch(0.35 0.04 303)`,ring:`oklch(0.72 0.15 300)`,"chart-1":`oklch(0.72 0.16 300)`,"chart-2":`oklch(0.78 0.14 70)`,"chart-3":`oklch(0.68 0.15 330)`,"chart-4":`oklch(0.72 0.13 35)`,"chart-5":`oklch(0.64 0.16 280)`,sidebar:`oklch(0.23 0.05 300)`,"sidebar-foreground":`oklch(0.95 0.02 305)`,"sidebar-primary":`oklch(0.72 0.15 300)`,"sidebar-primary-foreground":`oklch(0.18 0.04 300)`,"sidebar-accent":`oklch(0.45 0.1 65)`,"sidebar-accent-foreground":`oklch(0.96 0.02 70)`,"sidebar-border":`oklch(0.34 0.04 303)`,"sidebar-ring":`oklch(0.72 0.15 300)`}},radius:`1rem`,fontSans:`ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace`}}];new Set(M2.map(e=>e.key));function N2(e){let t=e??localStorage.getItem(`oc.theme`)??`system`,n=()=>t===`system`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:t,[r,i]=(0,z.useState)(n);return(0,z.useEffect)(()=>{if(i(n()),t!==`system`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`),r=()=>i(e.matches?`dark`:`light`);return e.addEventListener(`change`,r),()=>e.removeEventListener(`change`,r)},[t]),r}function vMe(e,t){let n=document.documentElement.style,r=e?.colors?.[t];for(let e of _Me){let t=r?.[e];t===void 0?n.removeProperty(`--`+e):n.setProperty(`--`+e,t)}e?.radius===void 0?n.removeProperty(`--radius`):n.setProperty(`--radius`,e.radius),e?.fontSans===void 0?n.removeProperty(`--ui-font-sans`):n.setProperty(`--ui-font-sans`,e.fontSans),e?.fontMono===void 0?n.removeProperty(`--ui-font-mono`):n.setProperty(`--ui-font-mono`,e.fontMono);let i=e?.bpm;i!==void 0&&i>0?n.setProperty(`--heart-period`,`${(60/Math.min(90,i)).toFixed(3)}s`):i===0?n.setProperty(`--heart-period`,`0s`):n.removeProperty(`--heart-period`)}function P2(e,t){(0,z.useEffect)(()=>{vMe(e??null,t)},[e,t])}var F2=new Map,I2={active:!1,percent:0,count:0},L2=new Set;function R2(){let e=0,t=0;for(let n of F2.values())e+=n.loaded,t+=n.total;let n=F2.size;I2={active:n>0,percent:t>0?Math.min(100,Math.round(e/t*100)):0,count:n};for(let e of L2)e()}var z2={subscribe(e){return L2.add(e),()=>L2.delete(e)},getSnapshot(){return I2},report(e,t,n){F2.set(e,{loaded:t,total:n}),R2()},clear(e){F2.delete(e)&&R2()}},B2=0;function yMe(){B2+=1}function bMe(){B2=Math.max(0,B2-1)}function xMe(){return B2>0}var SMe={phase:`idle`,model:null,voice:null,muted:!1,errorCode:null};function CMe(e,t){switch(t){case`start`:return e===`idle`?`minting`:null;case`minted`:return e===`minting`?`connecting`:null;case`connected`:return e===`connecting`?`live`:null;case`hangup`:return e===`minting`||e===`connecting`||e===`live`?`ending`:null;case`failed`:return e===`minting`||e===`connecting`||e===`live`?`ending`:null;case`ended`:return e===`ending`?`idle`:null}}function wMe(e,t){return t===null||t===``?e:`${e}${e.includes(`?`)?`&`:`?`}model=${encodeURIComponent(t)}`}function TMe(e,t){return t?`connect`:`hangup-now`}var EMe=new Set([`authorization`,`content-type`]);async function V2(e,t=[1e3,3e3],n=e=>new Promise(t=>setTimeout(t,e))){for(let r=0;;r+=1){try{if((await e()).ok)return!0}catch{}if(r>=t.length)return!1;await n(t[r])}}async function DMe(e,t,n=fetch,r){if(e.offerRelay){if(!r)return{ok:!1,code:`relay_unavailable`};try{let n=await r(e.offerRelay.relayId,t);return n.ok&&n.answerSdp.trim()===``?{ok:!1,code:`sdp_empty`}:n}catch{return{ok:!1,code:`relay_failed`}}}if(!e.offerUrl||!e.clientSecret)return{ok:!1,code:`talk_malformed`};try{let r=Object.fromEntries(Object.entries(e.offerHeaders??{}).filter(([e])=>!EMe.has(e.toLowerCase()))),i=await n(wMe(e.offerUrl,e.model??null),{method:`POST`,headers:{...r,Authorization:`Bearer ${e.clientSecret}`,"Content-Type":`application/sdp`},body:t});if(!i.ok)return{ok:!1,code:i.status===401?`talk_secret_expired`:`sdp_${i.status}`};let a=await i.text();return a.trim()===``?{ok:!1,code:`sdp_empty`}:{ok:!0,answerSdp:a}}catch{return{ok:!1,code:`sdp_unreachable`}}}var H2=[`marin`,`cedar`,`alloy`,`ash`,`ballad`,`coral`,`echo`,`sage`,`shimmer`,`verse`],U2=`oc.talk.voice`,W2=`oc.talk.vad`,G2=[{id:`low`,threshold:.8},{id:`medium`,threshold:.5},{id:`high`,threshold:.3}];function K2(e){return G2.some(t=>t.id===e)?e:``}function OMe(e){let t=G2.find(t=>t.id===e);return t?t.threshold:null}function kMe(){try{return K2(localStorage.getItem(W2))}catch{return``}}function AMe(e){try{K2(e)===``?localStorage.removeItem(W2):localStorage.setItem(W2,e)}catch{}}function q2(e){return H2.includes(e??``)?e:``}function jMe(){try{return q2(localStorage.getItem(U2))}catch{return``}}function MMe(e){try{q2(e)===``?localStorage.removeItem(U2):localStorage.setItem(U2,e)}catch{}}function NMe(e){let t;try{let n=JSON.parse(e);if(typeof n!=`object`||!n)return null;t=n}catch{return null}let n,r,i;if(t.type===`response.output_item.done`){let e=t.item;if(!e||e.type!==`function_call`)return null;n=e.call_id,r=e.name,i=e.arguments}else if(t.type===`response.function_call_arguments.done`)n=t.call_id,r=t.name,i=t.arguments;else return null;if(typeof n!=`string`||n===``||typeof r!=`string`||r===``)return null;let a={};if(typeof i==`string`&&i!==``)try{let e=JSON.parse(i);typeof e==`object`&&e&&(a=e)}catch{}return{callId:n,name:r,args:a}}function PMe(e){return e.phase!==`idle`||e.serverCall===!0?!1:e.available!==!0}var FMe=new Set([`talk_session_stale`,`agent_restricted`,`talk_disabled`,`talk_unsupported`,`provider_unsupported`,`no_agent`]);function IMe(e){return FMe.has(e)}function LMe(e){switch(e){case`talk_disabled`:return`talk_error_disabled`;case`call_active`:case`talk_call_active`:return`talk_error_call_active`;case`turn_in_flight`:return`talk_error_turn_in_flight`;case`talk_session_stale`:return`talk_error_session_stale`;case`talk_unsupported`:case`provider_unsupported`:return`talk_error_unsupported`;case`mic_denied`:return`talk_error_mic_denied`;case`talk_secret_expired`:return`talk_error_secret_expired`;default:return`talk_error_generic`}}function J2(e){switch(LMe(e)){case`talk_error_disabled`:return Si();case`talk_error_unsupported`:return jl();case`talk_error_mic_denied`:return Rt();case`talk_error_secret_expired`:return Pc();case`talk_error_session_stale`:return al();case`talk_error_call_active`:return tr();case`talk_error_turn_in_flight`:return An();case`talk_error_generic`:return`${Gie()} (${e})`}}function RMe({chatId:e,routedAgent:t=null,onCallActiveChange:n,serverCallSessionId:r=null}){let[i,a]=(0,z.useState)(SMe),[o,s]=(0,z.useState)(()=>jMe()),[c,l]=(0,z.useState)(()=>kMe()),u=P(L.talk.talkAvailable,{chatId:e,...t?{routedAgent:t}:{}}),d=mf(L.talk.mintTalkSession),f=mf(L.talk.relayTalkToolCall),p=mf(L.talk.relayTalkOffer),m=mf(L.talk.hangupTalkSession),h=(0,z.useRef)(null),g=EL(),_=(0,z.useRef)(0),v=(0,z.useRef)(null),y=(0,z.useRef)(`idle`),b=(0,z.useRef)({pc:null,mic:null}),x=(0,z.useRef)(null),S=(0,z.useCallback)(e=>{let t=CMe(y.current,e);return t===null?null:(y.current=t,a(e=>({...e,phase:t})),t)},[]),C=(0,z.useCallback)(()=>{let e=b.current;try{e.mic?.getTracks().forEach(e=>e.stop())}catch{}try{e.pc?.close()}catch{}e.mic=null,e.pc=null,v.current=null,D(null),x.current&&(x.current.srcObject=null)},[]),w=(0,z.useCallback)(()=>{let t=h.current;h.current=null,t!==null&&V2(()=>m({chatId:e,sessionId:t.sessionId}))},[e,m]),T=(0,z.useCallback)(()=>{S(`hangup`)!==null&&(_.current++,w(),C(),S(`ended`),a(e=>({...e,muted:!1})))},[S,w,C]),[E,D]=(0,z.useState)(null),O=P(L.talk.talkCallLive,E===null?`skip`:{sessionId:E}),k=y.current!==`idle`&&O===!1;(0,z.useEffect)(()=>{k&&(_.current++,w(),C(),S(`ended`),a(e=>({...e,muted:!1})),g.error(ke()))},[k,S,w,C,g]),(0,z.useEffect)(()=>()=>{_.current++,w(),C()},[w,C]);let ee=(0,z.useCallback)(async()=>{if(S(`start`)===null)return;let n=++_.current;a(e=>({...e,errorCode:null,muted:!1}));let r=e=>{_.current===n&&(S(`failed`),w(),C(),S(`ended`),a(t=>({...t,errorCode:e})),g.error(J2(e)))},i=OMe(c),s=await d({chatId:e,...o===``?{}:{voice:o},...i===null?{}:{vadThreshold:i},...t?{routedAgent:t}:{}}).catch(()=>({ok:!1,code:`mint_failed`}));if(s.ok){if(TMe(s.session,_.current===n)===`hangup-now`){V2(()=>m({chatId:e,sessionId:s.sessionId}));return}}else if(_.current!==n)return;if(!s.ok){r(s.code);return}v.current=s.sessionId,D(s.sessionId),h.current={sessionId:s.sessionId};let l;try{l=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{r(`mic_denied`);return}if(_.current!==n){l.getTracks().forEach(e=>e.stop());return}b.current.mic=l,a(e=>({...e,model:s.session.model,voice:s.session.voice})),S(`minted`);let u=new RTCPeerConnection;b.current.pc=u;for(let e of l.getTracks())u.addTrack(e,l);u.ontrack=e=>{_.current!==n||x.current===null||(x.current.srcObject=e.streams[0]??null)};let y=u.createDataChannel(`oai-events`),E=e=>{try{y.send(JSON.stringify(e))}catch{}},O=async t=>{if(t.name!==`openclaw_agent_consult`){E({type:`conversation.item.create`,item:{type:`function_call_output`,call_id:t.callId,output:`Task-control is not available in this interface yet; tell the user so.`}}),E({type:`response.create`});return}E({type:`response.create`,response:{instructions:`Briefly tell the user, in their language, that you are checking with the agent. Do not invent the result.`}});let r=await f({chatId:e,callId:t.callId,...v.current?{sessionId:v.current}:{},args:{question:typeof t.args.question==`string`?t.args.question:``,...typeof t.args.context==`string`?{context:t.args.context}:{},...typeof t.args.responseStyle==`string`?{responseStyle:t.args.responseStyle}:{}}}).catch(()=>({ok:!1,code:`relay_failed`}));if(_.current!==n)return;if(!r.ok&&IMe(r.code)){T(),a(e=>({...e,errorCode:r.code})),g.error(J2(r.code));return}let i=r.ok?r.pending?`The agent is still working on it. Tell the user the task continues and its result will arrive in the conversation.`:typeof r.errorText==`string`?`The agent run failed: ${r.errorText}`:r.resultText??``:`The agent could not be reached (${r.code}). Tell the user and suggest typing the request in the conversation instead.`;E({type:`conversation.item.create`,item:{type:`function_call_output`,call_id:t.callId,output:i===``?`(the agent returned an empty result)`:i}}),E({type:`response.create`})},k=new Set;y.onmessage=e=>{if(_.current!==n)return;let t=NMe(typeof e.data==`string`?e.data:``);t===null||k.has(t.callId)||(k.add(t.callId),O(t))},u.onconnectionstatechange=()=>{_.current===n&&u.connectionState===`failed`&&r(`rtc_lost`)};try{let t=await u.createOffer();if(await u.setLocalDescription(t),_.current!==n)return;let i=await DMe(s.session,t.sdp??``,fetch,(t,n)=>p({chatId:e,sessionId:s.sessionId,relayId:t,sdp:n}));if(_.current!==n)return;if(!i.ok){r(i.code);return}await u.setRemoteDescription({type:`answer`,sdp:i.answerSdp})}catch{r(`rtc_setup`);return}_.current===n&&S(`connected`)},[S,e,m,d,p,w,C,o,c,t]),A=(0,z.useCallback)(()=>{let e=b.current.mic;if(e===null)return;let t=!i.muted;for(let n of e.getAudioTracks())n.enabled=!t;a(e=>({...e,muted:t}))},[i.muted]),j=i.phase,te=j!==`idle`;return(0,z.useEffect)(()=>{n?.(te)},[te,n]),(0,z.useEffect)(()=>()=>{n?.(!1)},[n]),PMe({phase:j,available:u,serverCall:r!==null})?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`audio`,{ref:x,autoPlay:!0,className:`oc-talk__audio`}),j===`idle`&&r!==null?(0,B.jsx)(`span`,{className:`oc-talk__pill`,children:(0,B.jsx)(`button`,{type:`button`,className:`oc-talk__pillmain`,title:Qu(),"aria-label":Qu(),onClick:()=>{V2(()=>m({chatId:e,sessionId:r}))},children:(0,B.jsx)(GS,{size:16,"aria-hidden":!0})})}):j===`idle`?(0,B.jsxs)(`span`,{className:`oc-talk__pill`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-talk__pillmain`,title:es(),"aria-label":es(),onClick:()=>void ee(),children:(0,B.jsx)(Vx,{size:16,"aria-hidden":!0})}),(0,B.jsxs)(AI,{children:[(0,B.jsx)(jI,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,className:`oc-talk__pillchev`,title:Tr(),"aria-label":Tr(),children:(0,B.jsx)(cv,{size:13,"aria-hidden":!0})})}),(0,B.jsxs)(MI,{align:`end`,className:`oc-talk__settings`,children:[(0,B.jsxs)(`label`,{className:`oc-talk__setting`,children:[(0,B.jsx)(`span`,{className:`oc-talk__settinglabel`,children:Ss()}),(0,B.jsxs)(p$,{value:o===``?`__default__`:o,onValueChange:e=>{let t=e===`__default__`?``:e;s(t),MMe(t)},children:[(0,B.jsx)(h$,{size:`sm`,"aria-label":Ss(),children:(0,B.jsx)(m$,{})}),(0,B.jsxs)(g$,{children:[(0,B.jsx)(_$,{value:`__default__`,children:qi()}),H2.map(e=>(0,B.jsx)(_$,{value:e,children:e},e))]})]})]}),(0,B.jsxs)(`label`,{className:`oc-talk__setting`,children:[(0,B.jsx)(`span`,{className:`oc-talk__settinglabel`,children:on()}),(0,B.jsxs)(p$,{value:c===``?`__default__`:c,onValueChange:e=>{let t=e===`__default__`?``:e;l(t),AMe(t)},children:[(0,B.jsx)(h$,{size:`sm`,"aria-label":on(),children:(0,B.jsx)(m$,{})}),(0,B.jsxs)(g$,{children:[(0,B.jsx)(_$,{value:`__default__`,children:ko()}),G2.map(e=>(0,B.jsx)(_$,{value:e.id,children:e.id===`low`?La():e.id===`medium`?ma():Oh()},e.id))]})]})]})]})]})]}):(0,B.jsxs)(`span`,{className:`oc-talk${j===`live`?` oc-talk--live`:``}`,role:`status`,children:[(0,B.jsx)(`i`,{className:`oc-talk__dot`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-talk__label`,children:j===`live`?i.voice||Ou():au()}),j===`live`?(0,B.jsx)(`button`,{type:`button`,className:`oc-talk__btn`,title:i.muted?zg():Xr(),"aria-label":i.muted?zg():Xr(),"aria-pressed":i.muted,onClick:A,children:i.muted?(0,B.jsx)(NS,{size:14,"aria-hidden":!0}):(0,B.jsx)(PS,{size:14,"aria-hidden":!0})}):null,(0,B.jsx)(`button`,{type:`button`,className:`oc-talk__btn oc-talk__btn--end`,title:Qu(),"aria-label":Qu(),onClick:T,children:(0,B.jsx)(GS,{size:14,"aria-hidden":!0})})]})]})}function zMe(e,t){if(!e)return null;let n=e.logoLightHasAlpha&&e.logoLightUrl||e.logoDarkHasAlpha&&e.logoDarkUrl||null;if(n)return{url:n,masked:!0};let r=Y2(e,t);return r?{url:r,masked:!1}:null}function Y2(e,t){return(t===`dark`?e?.logoDarkUrl:e?.logoLightUrl)??(t===`dark`?e?.logoLightUrl:e?.logoDarkUrl)??null}function X2(e){if(!e)return null;let t=/oklch\(\s*([0-9]*\.?[0-9]+)(%?)/i.exec(e);if(!t)return null;let n=parseFloat(t[1]);return Number.isFinite(n)?t[2]===`%`?n/100:n:null}function BMe(e,t,n){let r=X2(e),i=X2(t);return r===null||i===null?n:i>r?`dark`:`light`}function VMe(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?`?`:t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[1][0]).toUpperCase()}function Z2({className:e}){return(0,B.jsxs)(`svg`,{className:e,viewBox:`0 0 64 64`,fill:`none`,"aria-hidden":`true`,children:[(0,B.jsx)(`path`,{d:`M25 15H15V49H25`,stroke:`currentColor`,strokeWidth:`6.5`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,B.jsx)(`path`,{d:`M39 15H49V49H39`,stroke:`currentColor`,strokeWidth:`6.5`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,B.jsx)(`polyline`,{points:`20 33 26 33 29 25 33 41 37 29 41 33 44 33`,stroke:`currentColor`,strokeWidth:`3.4`,strokeLinecap:`round`,strokeLinejoin:`round`})]})}var Q2=(0,z.createContext)({label:`Atrium`,logoUrl:null,logoMasked:!1,isDefault:!0,initials:`A`,agentName:null,agentEmoji:null});function $2(){return(0,z.useContext)(Q2)}function e4(e){return e.agentName??e.label}function HMe(e){return e.agentName?iie({name:e.agentName}):Rie({name:e.label})}function UMe(e){let t=new Map;for(let n of e){let e=t.get(n.instanceName);e||(e={instanceName:n.instanceName,kind:n.kind,agents:[]},t.set(n.instanceName,e)),e.agents.push(n)}let n=e=>(e.displayName??e.agentId).toLowerCase();for(let e of t.values())e.agents.sort((e,t)=>e.isDefault===t.isDefault?n(e).localeCompare(n(t)):e.isDefault?-1:1);let r=[...t.values()],i=e=>e.agents.some(e=>e.isDefault);return r.sort((e,t)=>i(e)===i(t)?e.instanceName.localeCompare(t.instanceName):i(e)?-1:1),r}function t4(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>[e.displayName,e.agentId,e.instanceName,e.model,e.description].filter(Boolean).some(e=>e.toLowerCase().includes(n))):e}function WMe({open:e,onOpenChange:t,agents:n,onPick:r}){let[i,a]=(0,z.useState)(``),o=(0,z.useMemo)(()=>UMe(t4(n??[],i)),[n,i]);return(0,B.jsx)(s$,{open:e,onOpenChange:t,children:(0,B.jsxs)(c$,{className:`oc-agentpicker`,children:[(0,B.jsxs)(l$,{children:[(0,B.jsx)(d$,{children:Ju()}),(0,B.jsx)(f$,{children:eu()})]}),n===void 0?(0,B.jsx)(`p`,{className:`oc-agentpicker__hint`,children:Cu()}):n.length===0?(0,B.jsx)(`p`,{className:`oc-agentpicker__hint`,children:Gr()}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(VI,{autoFocus:!0,value:i,onChange:e=>a(e.target.value),placeholder:Rg(),className:`oc-agentpicker__search`,"aria-label":vi()}),(0,B.jsx)(`div`,{className:`oc-agentpicker__list`,role:`listbox`,children:o.map(e=>(0,B.jsxs)(`div`,{className:`oc-agentpicker__group`,children:[(0,B.jsxs)(`div`,{className:`oc-agentpicker__instance`,children:[(0,B.jsx)(nC,{size:13,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:e.instanceName}),(0,B.jsx)(AL,{variant:`outline`,className:`oc-agentpicker__kind`,children:e.kind})]}),e.agents.map(e=>(0,B.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":!1,className:`oc-agentpicker__item`,onClick:()=>r(e.instanceName,e.agentId),disabled:e.state===`deleted`,title:e.state===`deleted`?Dn():void 0,children:[(0,B.jsx)(Wx,{size:15,"aria-hidden":!0,className:`oc-agentpicker__icon`}),(0,B.jsxs)(`span`,{className:`oc-agentpicker__main`,children:[(0,B.jsxs)(`span`,{className:`oc-agentpicker__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.description?(0,B.jsx)(`span`,{className:`oc-agentpicker__desc`,children:e.description}):null]}),e.model?(0,B.jsx)(`span`,{className:`oc-agentpicker__model`,children:e.model}):null,e.isDefault?(0,B.jsx)(mC,{size:13,"aria-label":Ol(),className:`oc-agentpicker__default`}):null]},`${e.instanceName}/${e.agentId}`))]},e.instanceName))})]})]})})}var n4=[`viewer`,`member`,`manager`];function r4(e){return e===`owner`||e===`manager`}function GMe(e,t,n){return e===`owner`?[...n4]:e!==`manager`||n||t===`manager`?[]:n4.filter(e=>e!==`manager`)}function KMe(e,t,n){return n?!1:e===`owner`?!0:e===`manager`&&t!==`manager`}function i4(e,t){return t.roomRole===`owner`?!1:KMe(e,t.roomRole,t.isSelf)}function a4(e){return e===`owner`?[...n4]:e===`manager`?[`viewer`,`member`]:[]}function o4(e,t){return a4(t).includes(e)?e:`member`}function s4(e,t){return e===null||t===null?e===t:e.instanceName===t.instanceName&&e.agentId===t.agentId}function c4(e){return e.routedInstanceName&&e.routedAgentId?{instanceName:e.routedInstanceName,agentId:e.routedAgentId}:null}function qMe(e){let t=new Map,n=null;for(let r of e){let e=c4(r);r.role===`user`?(n=e,t.set(r._id,e)):r.role===`assistant`?t.set(r._id,e??n):t.set(r._id,e)}return t}function JMe(e){for(let t=e.length-1;t>=0;t--){let n=c4(e[t]);if(n)return n}return null}function l4(e,t){if(!t)return!1;let n=e.find(e=>s4(e,t));return n!==void 0&&n.state!==`deleted`}function YMe(e){let{lastRouted:t,primary:n,pool:r}=e,i=e=>({instanceName:e.instanceName,agentId:e.agentId});if(l4(r,t))return i(t);if(l4(r,n))return i(n);let a=r.filter(e=>e.state!==`deleted`);return a.length===0?null:i(a.find(e=>e.isDefault)??a[0])}function XMe(e){let{selected:t,lastRouted:n,primary:r,pool:i,poolLoading:a,messagesLoading:o,canRoute:s}=e;if(!s)return null;let c=t??n;return a||o?c??r:YMe({lastRouted:c,primary:r,pool:i})}function ZMe(e){let{readOnly:t,multiAgent:n,poolSize:r}=e,i=r===0||!n;return e.callActive===!0?{hidden:i,disabled:!0,reason:`call-active`,onCall:e.onCall??null}:t?{hidden:i,disabled:!0,reason:`read-only`}:{hidden:i,disabled:!1}}function u4(e,t){if(!t)return null;let n=e.find(e=>s4(e,t));return n?{displayName:n.displayName,emoji:n.emoji}:null}function d4(e){let{mentioned:t,primary:n,severalAgents:r,perTurnRouting:i,canRoute:a}=e;if(!a)return;let o=t[0];if(o!==void 0)return{instanceName:o.instanceName,agentId:o.agentId};if(!(n===null||!(r||i)))return{instanceName:n.instanceName,agentId:n.agentId}}function QMe(e){let t=new Map,n=null;for(let r of e){if(r.role===`user`){n=r.importedAgentLabel??null,t.set(r._id,n??r.chatImportedAgentLabel??null);continue}t.set(r._id,r.importedAgentLabel??n??r.chatImportedAgentLabel??null)}return t}function $Me(e,t,n){let r=e.find(e=>s4(e,t))??null,i=n.map(t=>e.find(e=>s4(e,t))??null).filter(e=>e!==null&&!s4(e,t)),a=e=>s4(e,t)||i.some(t=>s4(t,e)),o=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`}),s=e=>e.displayName??e.agentId,c=e.filter(e=>!a(e)).sort((e,t)=>o.compare(s(e),s(t))||o.compare(e.instanceName,t.instanceName));return i.length===0?{room:[],others:r?[r,...c]:c}:{room:r?[r,...i]:i,others:c}}function eNe(e){let t=e=>(e.displayName??e.agentId).trim().toLocaleLowerCase(),n=new Map;for(let r of e){let e=n.get(t(r))??new Set;e.add(`${r.instanceName}\u0000${r.agentId}`),n.set(t(r),e)}let r=new Set;for(let e of n.values())if(e.size>1)for(let t of e)r.add(t);return r}function tNe(e,t,n,r){return!r4(e)||s4(t,n)?!1:r.some(e=>s4(e,t))}function nNe(e,t){let n=[];for(let r of t)r===null||e.some(e=>s4(e,r))||n.push({instanceName:r.instanceName,agentId:r.agentId,isDefault:r.role===`primary`,displayName:r.displayName,emoji:r.emoji,model:r.model,description:r.description,kind:r.kind,state:`deleted`});return n.length===0?e:[...e,...n]}function rNe(e,t){return e.every(e=>e.isSelf)&&t.length<=1?null:{people:e,agents:t}}function iNe(e,t){if(t===null)return[...e];let n=new Set(t.filter(e=>e!==null).map(e=>`${e.instanceName}\u0000${e.agentId}`));return e.filter(e=>n.has(`${e.instanceName}\u0000${e.agentId}`))}function f4(e){return e.unfolded||e.searching||e.hereCount===0}var p4=e=>`${e.instanceName}\u0000${e.agentId}`;function aNe(e,t,n){let r=new Set(e.map(p4)),i=n.trim().toLocaleLowerCase();return t.filter(e=>!r.has(p4(e))).filter(e=>i===``||[e.displayName,e.agentId,e.instanceName].filter(e=>!!e).some(e=>e.toLocaleLowerCase().includes(i)))}var oNe={user:Gre(),assistant:`OpenClaw`,system:pd()},sNe=hee();function m4(e){return new Date(e).toISOString().slice(0,16).replace(`T`,` `)+` UTC`}function h4(e){return e?e.filter(e=>e.kind===`file`||e.kind===`media`).map(e=>e.filename).filter(e=>typeof e==`string`&&e.length>0):[]}function cNe(e,t={}){let n=[];n.push(`# ${t.title?.trim()||km()}`),t.exportedAt!=null&&(n.push(``),n.push(`_${Ree({date:m4(t.exportedAt)})}_`)),t.truncated&&(n.push(``),n.push(sNe));for(let t of e){n.push(``),n.push(`## ${oNe[t.role]} · ${m4(t.createdAt)}`);for(let e of t.quotedExcerpts??[])e!==``&&(n.push(``),n.push(`> ${Fc()} : ${e}`));let e=t.text.trim();e.length>0&&(n.push(``),n.push(e));for(let e of h4(t.parts))n.push(``),n.push(Gte({name:e}))}return n.join(`
|
|
424
|
+
`)+`
|
|
425
|
+
`}function lNe(e,t={}){let n={title:t.title?.trim()||km(),exportedAt:t.exportedAt??null,truncated:!!t.truncated,messageCount:e.length,messages:e.map(e=>({role:e.role,createdAt:e.createdAt,text:e.text,...e.quotedExcerpts!==void 0&&e.quotedExcerpts.length>0?{quotedExcerpts:e.quotedExcerpts.filter(e=>e!==``)}:{},attachments:h4(e.parts)}))};return JSON.stringify(n,null,2)+`
|
|
426
|
+
`}function uNe(e){return((e??``).trim()||`conversation`).toLowerCase().normalize(`NFD`).replace(/[̀-ͯ]/g,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,60)||`conversation`}var g4=z.createContext(null);function dNe({children:e}){let[t,n]=z.useState(null),r=z.useRef(null),i=z.useRef(null),[a,o]=z.useState(``),s=z.useCallback(e=>{let t=r.current;r.current=null,n(null),t&&t(e)},[]),c=z.useMemo(()=>({confirm:e=>new Promise(t=>{r.current=t,o(``),n({kind:`confirm`,opts:e})}),prompt:e=>new Promise(t=>{r.current=t,o(e.defaultValue??``),n({kind:`prompt`,opts:e})})}),[]),l=t?.kind===`confirm`,u=t?.kind===`prompt`,d=t?.kind===`confirm`?t.opts.confirmWord:void 0,f=!d||a.trim().toLowerCase()===d.trim().toLowerCase(),p=a.trim().length>0||t?.kind===`prompt`&&t.opts.allowEmpty===!0,m=e=>{e.preventDefault(),requestAnimationFrame(()=>i.current?.focus())};return(0,B.jsxs)(g4.Provider,{value:c,children:[e,(0,B.jsx)(jL,{open:l,onOpenChange:e=>{e||s(!1)},children:l?(0,B.jsxs)(PL,{onOpenAutoFocus:d?m:void 0,...t.opts.description?{}:{"aria-describedby":void 0},children:[(0,B.jsxs)(FL,{children:[(0,B.jsx)(LL,{children:t.opts.title}),t.opts.description?(0,B.jsx)(RL,{children:t.opts.description}):null]}),d?(0,B.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[l_(),` `,(0,B.jsx)(`span`,{className:`font-medium text-foreground`,children:dm({word:d})}),` `,yd()]}),(0,B.jsx)(VI,{ref:i,value:a,placeholder:d,autoComplete:`off`,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f&&(e.preventDefault(),s(!0))}})]}):null,(0,B.jsxs)(IL,{children:[(0,B.jsx)(BL,{onClick:()=>s(!1),children:t.opts.cancelLabel??U_()}),(0,B.jsx)(Ov,{variant:t.opts.destructive?`destructive`:`default`,disabled:!f,onClick:()=>s(!0),children:t.opts.confirmLabel??gf()})]})]}):null}),(0,B.jsx)(s$,{open:u,onOpenChange:e=>{e||s(null)},children:u?(0,B.jsxs)(c$,{onOpenAutoFocus:m,...t.opts.description?{}:{"aria-describedby":void 0},children:[(0,B.jsxs)(l$,{children:[(0,B.jsx)(d$,{children:t.opts.title}),t.opts.description?(0,B.jsx)(f$,{children:t.opts.description}):null]}),(0,B.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[t.opts.label?(0,B.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:t.opts.label}):null,(0,B.jsx)(VI,{ref:i,value:a,placeholder:t.opts.placeholder,autoComplete:`off`,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),s(a.trim()))}})]}),(0,B.jsxs)(u$,{children:[(0,B.jsx)(Ov,{variant:`outline`,onClick:()=>s(null),children:t.opts.cancelLabel??U_()}),(0,B.jsx)(Ov,{disabled:!p,onClick:()=>s(a.trim()),children:t.opts.confirmLabel??Die()})]})]}):null})]})}function _4(){let e=z.useContext(g4);if(!e)throw Error(`useConfirm/usePrompt must be used within <DialogsProvider>`);return e}function v4(){return _4().confirm}function y4(){return _4().prompt}var b4=null,x4=new Set,S4=null,fNe=4e3;function C4(){for(let e of x4)e()}function w4(e,t){b4={chatId:e,expand:t?.expand===!0},S4!==null&&clearTimeout(S4),S4=setTimeout(()=>{S4=null,b4=null,C4()},fNe),C4()}function T4(e){b4?.chatId===e&&(S4!==null&&(clearTimeout(S4),S4=null),b4=null,C4())}function E4(){return(0,z.useSyncExternalStore)(e=>(x4.add(e),()=>{x4.delete(e)}),()=>b4)}function pNe(e){let t=-1,n=-1/0,r=-1/0;for(let i=0;i<e.length;i++){let a=e[i]?.stamp,o=a??r;o>=n&&(t=i,n=o),a!==void 0&&a>r&&(r=a)}return t}function mNe(e){let t=e[pNe(e)];return t===void 0||t.steps.length===0?null:t}var hNe=[];function gNe({status:e,settled:t}){return e===`completed`?(0,B.jsx)(qx,{size:13,className:`oc-planact__icon oc-planact__icon--done`,"aria-hidden":!0}):e===`in_progress`&&!t?(0,B.jsx)(wS,{size:13,className:`oc-planact__icon oc-planact__icon--current oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsx)(eS,{size:13,className:`oc-planact__icon`,"aria-hidden":!0})}function _Ne(){let e=U(e=>e.metadata?.custom?.planParts??hNe),t=U(e=>e.metadata?.custom?.status!==`streaming`),[n,r]=(0,z.useState)(null),i=mNe(e);if(i===null)return null;let a=i.steps.length,o=i.steps.filter(e=>e.status===`completed`).length,s=n??o!==a,c=i.steps.find(e=>e.status===`in_progress`);return(0,B.jsxs)(`div`,{className:`oc-planact`,children:[(0,B.jsx)(JL,{icon:(0,B.jsx)(CS,{size:14}),label:i.estimated?`${Ur({done:o,total:a})} \u00b7 ${fne()}`:Ur({done:o,total:a}),sublabel:!s&&c!==void 0?c.step:void 0,trailing:(0,B.jsx)(`span`,{className:`oc-planact__bar`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":a,"aria-valuenow":o,children:(0,B.jsx)(`span`,{className:`oc-planact__bar-fill`,style:{width:`${a>0?o/a*100:0}%`}})}),open:s,ariaExpanded:s,title:s?Tn():hi(),onClick:()=>r(!s)}),s?(0,B.jsx)(`ol`,{className:`oc-planact__steps`,children:i.steps.map((e,n)=>(0,B.jsxs)(`li`,{className:`oc-planact__step oc-planact__step--${e.status}`,children:[(0,B.jsx)(gNe,{status:e.status,settled:t}),(0,B.jsx)(`span`,{className:`oc-planact__step-text`,children:e.step})]},n))}):null,s&&i.explanation!==void 0?(0,B.jsx)(`div`,{className:`oc-planact__note`,children:i.explanation}):null]})}function D4({...e}){return(0,B.jsx)(gv,{"data-slot":`sheet`,...e})}function vNe({...e}){return(0,B.jsx)(dv,{"data-slot":`sheet-portal`,...e})}function yNe({className:e,...t}){return(0,B.jsx)(pv,{"data-slot":`sheet-overlay`,className:Wg(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function O4({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,B.jsxs)(vNe,{children:[(0,B.jsx)(yNe,{}),(0,B.jsxs)(hv,{"data-slot":`sheet-content`,"data-side":n,className:Wg(`fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10`,e),...i,children:[t,r&&(0,B.jsx)(yv,{"data-slot":`sheet-close`,asChild:!0,children:(0,B.jsxs)(Ov,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,B.jsx)(uv,{}),(0,B.jsx)(`span`,{className:`sr-only`,children:P_()})]})})]})]})}function k4({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`sheet-header`,className:Wg(`flex flex-col gap-0.5 p-4`,e),...t})}function A4({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`sheet-footer`,className:Wg(`mt-auto flex flex-col gap-2 p-4`,e),...t})}function j4({className:e,...t}){return(0,B.jsx)(vv,{"data-slot":`sheet-title`,className:Wg(`font-heading text-base font-medium text-foreground`,e),...t})}function M4({className:e,...t}){return(0,B.jsx)(_v,{"data-slot":`sheet-description`,className:Wg(`text-sm text-muted-foreground`,e),...t})}function N4({className:e,orientation:t=`horizontal`,...n}){return(0,B.jsx)(Zpe,{"data-slot":`tabs`,"data-orientation":t,className:Wg(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var bNe=bg(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function P4({className:e,variant:t=`default`,...n}){return(0,B.jsx)(Qpe,{"data-slot":`tabs-list`,"data-variant":t,className:Wg(bNe({variant:t}),e),...n})}function F4({className:e,...t}){return(0,B.jsx)($pe,{"data-slot":`tabs-trigger`,className:Wg(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function I4({className:e,...t}){return(0,B.jsx)(eme,{"data-slot":`tabs-content`,className:Wg(`flex-1 text-sm outline-none`,e),...t})}function xNe(e){let t=e.split(/[\s._-]+/).map(e=>e.trim()).filter(e=>e.length>0);return t.length===0?`?`:t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[1][0]).toUpperCase()}function SNe(e){let t=0;for(let n=0;n<e.length;n+=1)t=t*31+e.charCodeAt(n)>>>0;return t%8}function L4({userId:e,name:t,showTitle:n=!0}){return(0,B.jsx)(`span`,{className:`oc-avatar`,"data-tone":SNe(e),title:n?t:void 0,"aria-hidden":!0,children:xNe(t)})}function R4({kind:e,size:t=16,className:n}){let r=e===`hermes`?`Hermes`:`OpenClaw`;return e===`hermes`?(0,B.jsx)(Xoe,{size:t,className:n,"aria-label":r,role:`img`}):(0,B.jsxs)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:n,role:`img`,"aria-label":r,children:[(0,B.jsx)(`path`,{d:`M4 20l3-3`}),(0,B.jsx)(`path`,{d:`M7 17a4 4 0 0 1 0-6l1-1`}),(0,B.jsx)(`path`,{d:`M8 10c1-4 5-6.5 11-6-2.5 3-5 4.5-8 5.5`}),(0,B.jsx)(`path`,{d:`M11 12.5c3 0 6 1 8.5 3.5-3 1-6 .5-8.5-1.5`}),(0,B.jsx)(`path`,{d:`M7 17a4 4 0 0 0 5.5-1.5`})]})}var CNe={thinkingLevel:`segmented`,model:`list`,fastMode:`segmented`};function wNe(e,t){return CNe[e]===`segmented`&&t<=5?`segmented`:`list`}function z4(e,t){return e!=null&&e[t]!==void 0}var TNe=[`inherit`,`fast`,`standard`];function ENe(e){return e==null||e.fastMode===void 0?`inherit`:e.fastMode?`fast`:`standard`}function DNe(e){return e===`inherit`?Sm():e===`fast`?qm():tte()}function ONe(e){return e===`inherit`?null:e===`fast`}function B4(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function V4(e){return e.length?e[0].toUpperCase()+e.slice(1):e}var kNe={off:`Off`,minimal:`Min`,low:`Low`,medium:`Med`,high:`High`,xhigh:`XHigh`};function ANe(e,t){return kNe[e]??t}function H4(e){return U4(e).used}function U4(e){if(!e)return{used:null,source:`unknown`};let t=e.contextTokens,n=e=>e==null||t&&e>t?null:e;if(e.estimatedPromptTokens!=null)return{used:e.estimatedPromptTokens,source:`budget_estimate`};let r=n(e.activeTokens);if(r!=null)return{used:r,source:`last_call_usage`};if(e.totalTokensFresh===!1)return{used:null,source:`unknown`};let i=n(e.totalTokens);return i==null?{used:null,source:`unknown`}:{used:i,source:`last_call_usage`}}function W4(e){return e?e.promptBudgetBeforeReserve!=null&&e.promptBudgetBeforeReserve>0?e.promptBudgetBeforeReserve:e.contextTokens!=null&&e.contextTokens>0?e.contextTokens:null:null}function jNe(e){if(!e)return null;if(e.sessionOverfull===!0)return`compaction_failed`;let t=H4(e),n=W4(e);return t!=null&&n!=null&&t>n?`estimate_exceeds_budget`:null}function MNe(e){return U4(e).source}function G4(e,t){return e==null||!t||t<=0?null:Math.round(e/t*100)}function NNe(e,t){let n=G4(e,t);return n===null?null:wre({pct:n,used:B4(e),total:B4(t)})}function PNe(e){return v({level:e??`full`})}function FNe(e,t){let n=typeof e==`number`,r=typeof t==`number`;return n&&r?ru({cost:e.toFixed(2),tokens:B4(t)}):n?Eu({cost:e.toFixed(2)}):r?Jr({tokens:B4(t)}):null}function INe(e){let t=e.filter(e=>typeof e==`string`&&e.length>0);return t.length>0?t.join(` · `):null}function LNe(e,t=5){let n=e?.contextPercent;if(typeof n!=`number`||!Number.isFinite(n))return null;let r=H4(e),i=W4(e);if(r===null||i===null)return null;let a=G4(r,i);if(a===null)return null;let o=Math.abs(n-a);return o<=t?null:{gateway:n,derived:a,delta:o}}var RNe=new Set([`knobThinkingLevel`,`knobModel`,`knobFastMode`,`knobUnset`,`agentFiles`,`sessionCompact`,`configDefaults`,`subagents`,`inboundAttachments`,`talk`,`cronList`,`cronManage`,`permissionModes`,`knowledgePolicy`,`inlineWidgets`]),zNe=new Set([`knobThinkingLevel`,`knobModel`]);function K4(e,t){return RNe.has(t)?e==null?zNe.has(t):e[t]===!0:!1}function BNe(e,t){return{model:e(`knobModel`)&&t.hasModels,thinking:e(`knobThinkingLevel`)&&t.hasLevels,speed:e(`knobFastMode`),reset:e(`knobUnset`)}}function VNe(e,t){return e===void 0?`loading`:e===null?{blocked:!K4(null,t),gatewayVersion:null,provider:null}:{blocked:!K4(e.capabilities,t),gatewayVersion:e.gatewayVersion,provider:e.provider}}function q4(e,t){let n=P(L.compat.forChat,e===null?`skip`:{chatId:e,...t?{routedAgent:t}:{}}),r=n==null?null:n.capabilities;return{can:(0,z.useCallback)(e=>K4(r,e),[r]),resolved:r!==null,loading:n===void 0,gatewayVersion:n?.gatewayVersion??null,provider:n?.provider??null,beyondValidated:n?.versionBeyondValidated===!0}}function HNe(e){let t=I(L.chats.setSessionKnob),[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(null);return{apply:(0,z.useCallback)(async(n,i)=>{r(n),a(null);let o={chatId:e};n===`fastMode`?o.fastMode=i:o[n]=i;try{await t(o)}catch{a({field:n,value:i})}finally{r(null)}},[e,t]),pending:n,error:i}}function J4({label:e,overridden:t,onReset:n,pending:r,error:i,onRetry:a,help:o,children:s,resettable:c=!0}){return(0,B.jsxs)(`div`,{className:`oc-spanel__row${t?` is-overridden`:``}`,children:[(0,B.jsxs)(`div`,{className:`oc-spanel__rowhead`,children:[(0,B.jsx)(`span`,{className:`oc-spanel__label`,children:e}),r?(0,B.jsx)(wS,{size:13,className:`oc-spanel__spin`,"aria-label":K_()}):t?c?(0,B.jsx)(`button`,{type:`button`,className:`oc-spanel__reset`,title:tc(),"aria-label":tc(),onClick:n,children:(0,B.jsx)(ZS,{size:12,"aria-hidden":!0})}):null:(0,B.jsx)(`span`,{className:`oc-spanel__badge`,children:at()})]}),(0,B.jsx)(`div`,{className:`oc-spanel__ctl`,children:s}),o?(0,B.jsx)(`p`,{className:`oc-spanel__help`,children:o}):null,i?(0,B.jsxs)(`p`,{className:`oc-spanel__error`,role:`alert`,children:[Of(),(0,B.jsx)(`button`,{type:`button`,className:`oc-spanel__retry`,onClick:a,children:Q_()})]}):null]})}function UNe({options:e,value:t,onChange:n,ariaLabel:r,disabled:i}){return(0,B.jsx)(`div`,{className:`oc-spanel__seg`,role:`group`,"aria-label":r,children:e.map(e=>(0,B.jsx)(`button`,{type:`button`,className:`oc-spanel__seg-btn${t===e.id?` is-active`:``}`,"aria-pressed":t===e.id,title:e.title??e.label,"aria-label":e.title??e.label,disabled:i,onClick:()=>{e.id!==t&&n(e.id)},children:e.label},e.id))})}function WNe({options:e,value:t,onChange:n,disabled:r,ariaLabel:i}){let a=t===null||e.some(e=>e.id===t);return(0,B.jsxs)(`select`,{className:`oc-spanel__select`,value:t??``,disabled:r,"aria-label":i,onChange:e=>{e.target.value&&e.target.value!==t&&n(e.target.value)},children:[t===null?(0,B.jsx)(`option`,{value:``,disabled:!0,children:`—`}):null,a?null:(0,B.jsx)(`option`,{value:t,children:t}),e.map(e=>(0,B.jsx)(`option`,{value:e.id,children:e.label},e.id))]})}function Y4({field:e,options:t,value:n,onChange:r,disabled:i,ariaLabel:a}){return wNe(e,t.length)===`list`?(0,B.jsx)(WNe,{options:t,value:n,onChange:r,disabled:i,ariaLabel:a}):(0,B.jsx)(UNe,{options:t,value:n,onChange:r,disabled:i,ariaLabel:a})}function X4({chatId:e,sm:t,settings:n}){let{apply:r,pending:i,error:a}=HNe(e),{can:o}=q4(e),s=i!==null,c=(0,z.useCallback)(()=>{a&&r(a.field,a.value)},[r,a]),l=t.thinkingLevels??[],u=t.availableModels??[],d=ENe(n),f=BNe(o,{hasModels:u.length>0,hasLevels:l.length>0});return(0,B.jsxs)(B.Fragment,{children:[f.model?(0,B.jsx)(J4,{label:bi(),overridden:z4(n,`model`),onReset:()=>void r(`model`,null),pending:i===`model`,error:a?.field===`model`,onRetry:c,resettable:f.reset,children:(0,B.jsx)(Y4,{field:`model`,options:u,value:t.model??null,onChange:e=>void r(`model`,e),disabled:s,ariaLabel:bi()})}):null,f.thinking?(0,B.jsx)(J4,{label:v_(),overridden:z4(n,`thinkingLevel`),onReset:()=>void r(`thinkingLevel`,null),pending:i===`thinkingLevel`,error:a?.field===`thinkingLevel`,onRetry:c,resettable:f.reset,children:(0,B.jsx)(Y4,{field:`thinkingLevel`,ariaLabel:v_(),options:l.map(e=>({id:e.id,label:ANe(e.id,V4(e.label)),title:V4(e.label)})),value:t.thinkingLevel??null,onChange:e=>void r(`thinkingLevel`,e),disabled:s})}):null,f.speed?(0,B.jsx)(J4,{label:jd(),overridden:z4(n,`fastMode`),onReset:()=>void r(`fastMode`,null),pending:i===`fastMode`,error:a?.field===`fastMode`,onRetry:c,resettable:f.reset,children:(0,B.jsx)(Y4,{field:`fastMode`,ariaLabel:jd(),options:TNe.map(e=>({id:e,label:DNe(e)})),value:d,onChange:e=>void r(`fastMode`,ONe(e)),disabled:s})}):null]})}var GNe=2.4;function KNe(e,t,n=GNe,r=56){return t===null||!Number.isFinite(t)?e.map(()=>1):e.map(e=>{let i=Math.abs(e-t);return i>=r?1:1+(n-1)*Math.cos(i/r*(Math.PI/2))})}function qNe(e){let t=-1,n=1;return e.forEach((e,r)=>{e>n&&(t=r,n=e)}),t===-1?null:t}function JNe(e,t,n){return e.map((r,i)=>{let a=0;return e.forEach((e,o)=>{if(o===i)return;let s=((t[o]??1)-1)*n;a+=s/2*(r>e?1:r<e?-1:0)}),a})}function YNe(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function XNe(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function ZNe(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function QNe(e){switch(e){case`admin`:return um();case`user`:return Fm();case`pending`:return Wee();default:return e}}function $Ne(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function ePe(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}function tPe(e,t){return e.assigned?`toggle`:e.claimable?`claim`:!e.present||!e.enabled?`locked`:t||e.reservedForGroup?`toggle`:`locked`}function nPe(e,t){return`${e.length}:${e}/${t}`}function rPe(e,t,n,r){let i=new Set(n?t:e);return i.has(r)?i.delete(r):i.add(r),e.filter(e=>i.has(e))}function iPe(e){switch(e){case`pending`:return Hh();case`approved`:return ve();case`rejected`:return dg()}}function Z4(e){let t=e?.data;return typeof t==`object`&&!!t&&t.code===`agent_purge_pending`}function aPe(e){let t=e?.data;if(typeof t!=`object`||!t)return e;let{code:n,agent:r}=t,i=typeof r==`string`?r:null;return n===`admin_restriction_would_lift`?i===null?Gl():Be({agent:i}):n===`admin_restriction_would_apply`?qc({agent:i??`?`}):n===`member_cleanup_pending`?mr():n===`agent_purge_pending`?vl():e}var Q4=e=>e===`owner`?Pe():e===`manager`?ev():e===`member`?Ds():Qi(),$4=e=>{let t=Q4(e);return t.charAt(0).toUpperCase()+t.slice(1)},oPe=e=>e===`manager`?Ar():e===`member`?dn():Po();function e3({agent:e}){return(0,B.jsx)(`span`,{className:`oc-convpanel__face`,"aria-hidden":!0,children:e.emoji?e.emoji:(0,B.jsx)(Wx,{size:14})})}var t3=e=>e.displayName??e.agentId;function sPe(e,t){let n=e.trim().toLowerCase();return n===``?!0:t.some(e=>(e??``).toLowerCase().includes(n))}function n3({open:e,onOpenChange:t,title:n,description:r,items:i,keyOf:a,searchFields:o,render:s,actionLabel:c,onPick:l,closeOnPick:u=!1,empty:d,header:f}){let[p,m]=(0,z.useState)(``),[h,g]=(0,z.useState)(new Set),[_,v]=(0,z.useState)(null),y=(0,z.useRef)(null);(0,z.useEffect)(()=>{e||(m(``),g(new Set))},[e]);let b=(i??[]).filter(e=>sPe(p,o(e)));return(0,B.jsx)(s$,{open:e,onOpenChange:t,children:(0,B.jsxs)(c$,{className:`oc-convpicker`,onOpenAutoFocus:e=>{e.preventDefault(),y.current?.focus()},children:[(0,B.jsxs)(l$,{children:[(0,B.jsx)(d$,{children:n}),(0,B.jsx)(f$,{children:r})]}),(0,B.jsx)(VI,{ref:y,value:p,onChange:e=>m(e.target.value),placeholder:Ha(),"aria-label":Ha()}),f,(0,B.jsx)(`ul`,{className:`oc-convpicker__list`,children:i===void 0?(0,B.jsx)(`li`,{className:`oc-convpicker__empty`,children:_m()}):b.length===0?(0,B.jsx)(`li`,{className:`oc-convpicker__empty`,children:d}):b.map(e=>{let n=a(e),r=h.has(n);return(0,B.jsxs)(`li`,{className:`oc-convpicker__row`,children:[s(e),(0,B.jsxs)(Ov,{variant:r?`ghost`:`outline`,size:`sm`,disabled:r||_!==null,onClick:()=>{v(n),l(e).then(()=>{g(e=>new Set(e).add(n)),u&&t(!1)}).catch(()=>{}).finally(()=>v(null))},children:[r?(0,B.jsx)(qx,{size:14,"aria-hidden":!0}):null,r?Bne():c]})]},n)})})]})})}var r3=6;function cPe({chatId:e,onOpen:t}){let n=P(L.chatParticipants.listMembers,{chatId:e}),r=P(L.chatAgents.listChatAgents,{chatId:e}),i=(0,z.useRef)([]),a=(0,z.useRef)([]),o=(0,z.useRef)(20),[s,c]=(0,z.useState)(null),l=(0,z.useRef)(0),u=rNe(n??[],r?[r.primary,...r.agents].filter(e=>e!==null):[]);if(u===null)return null;let{people:d,agents:f}=u,p=[...d.map(e=>({kind:`person`,key:`p/${String(e.userId)}`,name:e.isSelf?`${e.name} (${rt()})`:e.name,userId:String(e.userId),role:Q4(e.roomRole),self:e.isSelf})),...f.map(e=>({kind:`agent`,key:`a/${e.instanceName}/${e.agentId}`,name:e.displayName??e.agentId,gateway:e.kind,primary:e.role===`primary`}))],m=p.slice(0,r3),h=p.slice(r3),g=typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches===!0?m.map(()=>1):KNe(a.current.slice(0,m.length),s),_=qNe(g),v=JNe(a.current.slice(0,m.length),g,o.current);return(0,B.jsxs)(`button`,{type:`button`,className:`oc-presence`,onClick:t,onMouseEnter:e=>{let t=e.currentTarget.getBoundingClientRect();l.current=t.left,a.current=i.current.slice(0,m.length).map(e=>{let n=e?.getBoundingClientRect();return n?n.left+n.width/2-t.left:NaN}),o.current=i.current[0]?.getBoundingClientRect().width||20,c(e.clientX-t.left)},onMouseMove:e=>c(e.clientX-l.current),onMouseLeave:()=>c(null),"aria-label":Ut({people:d.length,agents:f.length}),children:[m.map((e,t)=>e.kind===`person`?(0,B.jsx)(`span`,{ref:e=>{i.current[t]=e},className:`oc-presence__face${e.self?` is-self`:``}${_===t?` is-focus`:``}`,style:{"--dock-s":g[t]??1,"--dock-x":`${v[t]??0}px`},"data-name":`${e.name} · ${e.role}`,children:(0,B.jsx)(L4,{userId:e.userId,name:e.name,showTitle:!1})},e.key):(0,B.jsxs)(`span`,{ref:e=>{i.current[t]=e},className:`oc-presence__face oc-presence__agent${e.primary?` is-primary`:``}${_===t?` is-focus`:``}`,style:{"--dock-s":g[t]??1,"--dock-x":`${v[t]??0}px`},"data-name":e.name,children:[(0,B.jsx)(R4,{kind:e.gateway,size:12}),e.primary?(0,B.jsx)(aS,{size:8,className:`oc-presence__crown`,"aria-hidden":!0}):null]},e.key)),h.length>0?(0,B.jsxs)(`span`,{className:`oc-presence__more`,title:h.map(e=>e.name).join(`
|
|
427
|
+
`),children:[`+`,h.length]}):null]})}function lPe({chatId:e,routing:t,open:n,onOpenChange:r,tab:i,onTabChange:a,intent:o,onIntentDone:s}){let c=P(L.chatAgents.listChatAgents,n?{chatId:e}:`skip`),l=P(L.chatParticipants.listMembers,n?{chatId:e}:`skip`),u=c?.viewerRoomRole,d=c?c.agents.length+ +!!c.primary:0;return(0,B.jsx)(D4,{open:n,onOpenChange:r,children:(0,B.jsxs)(O4,{side:`right`,className:`oc-spanel oc-convpanel`,children:[(0,B.jsxs)(k4,{children:[(0,B.jsx)(j4,{children:As()}),(0,B.jsx)(M4,{children:u===void 0?``:r4(u)?ta():Mr({role:Q4(u)})})]}),(0,B.jsx)(`div`,{className:`oc-spanel__body`,children:c===void 0?(0,B.jsx)(`p`,{className:`oc-spanel__loading`,children:Ng()}):c===null?null:(0,B.jsxs)(N4,{value:i,onValueChange:e=>a(e),children:[(0,B.jsxs)(P4,{className:`oc-convpanel__tabs`,children:[(0,B.jsxs)(F4,{value:`agents`,children:[(0,B.jsx)(Wx,{size:14,"aria-hidden":!0}),` `,ya(),(0,B.jsx)(`span`,{className:`oc-convpanel__count`,children:d})]}),(0,B.jsxs)(F4,{value:`people`,children:[(0,B.jsx)(CC,{size:14,"aria-hidden":!0}),` `,Mh(),(0,B.jsx)(`span`,{className:`oc-convpanel__count`,children:l?.length??``})]})]}),(0,B.jsx)(I4,{value:`agents`,children:(0,B.jsx)(uPe,{chatId:e,routing:t,room:c,intent:o,onIntentDone:s})}),(0,B.jsx)(I4,{value:`people`,children:(0,B.jsx)(dPe,{chatId:e,viewer:c.viewerRoomRole,authMode:c.authMode,participantIdentity:c.participantIdentity,intent:o,onIntentDone:s,onLeft:()=>r(!1)})})]})})]})})}function uPe({chatId:e,routing:t,room:n,intent:r,onIntentDone:i}){let a=EL(),o=r4(n.viewerRoomRole),s=n.viewerRoomRole===`owner`,[c,l]=(0,z.useState)(!1),[u,d]=(0,z.useState)(!1),[f,p]=(0,z.useState)(!1);(0,z.useEffect)(()=>{r===`add-agent`?(l(!0),i()):r===`primary`&&(d(!0),i())},[r,i]);let m=P(L.chatAgents.listAddableAgents,c&&o?{chatId:e}:`skip`),h=I(L.chatAgents.addChatAgent),g=I(L.chatAgents.removeChatAgent),_=I(L.chats.rebindChatAgent),v=I(L.chatAgents.setPrimaryAgent),y=t=>void v({chatId:e,instanceName:t.instanceName,agentId:t.agentId}).then(e=>{!e.changed&&e.reason===`busy`&&a.error(Ca()),!e.changed&&e.reason===`preparing`&&a.error(Ih())}).catch(e=>{let t=e instanceof Error?e.message:String(e);a.error(t.includes(`TALK_CALL_ACTIVE`)?Tu():Z4(e)?vl():Qs())}),b=P(L.messages.getSessionMeta,s?{chatId:e}:`skip`),x=b?.sessionMeta??null,S=b?.sessionSettings??null,C=t?.emptyThread===!0,w=(0,z.useMemo)(()=>(t?.pool??[]).filter(e=>e.state!==`deleted`&&!s4(e,n.primary)),[t?.pool,n.primary]),T=e=>{let t=e instanceof Error?e.message:String(e),n=/chat_agents_limit:(\d+)/.exec(t);throw a.error(n===null?Z4(e)?vl():Qs():ag({count:Number(n[1])})),e},E=(t,n)=>(0,B.jsxs)(`li`,{className:`oc-convpanel__member${t.gone?` is-gone`:``}`,children:[(0,B.jsx)(e3,{agent:t}),(0,B.jsxs)(`span`,{className:`oc-convpanel__who`,children:[(0,B.jsxs)(`span`,{className:`oc-convpanel__name`,children:[t3(t),n?(0,B.jsx)(aS,{size:12,className:`oc-convpanel__crown`,"aria-label":D(),children:(0,B.jsx)(`title`,{children:D()})}):null,t.gone?(0,B.jsx)(`span`,{className:`oc-convpanel__badge is-warn`,children:xc()}):t.usable?null:(0,B.jsx)(`span`,{className:`oc-convpanel__badge is-muted`,children:M_()})]}),(0,B.jsxs)(`span`,{className:`oc-convpanel__sub`,children:[(0,B.jsx)(nC,{size:10,"aria-hidden":!0}),` `,t.instanceName,t.model?` · ${t.model}`:``]})]}),!n&&o?(0,B.jsxs)(NI,{children:[(0,B.jsx)(PI,{asChild:!0,children:(0,B.jsx)(Ov,{variant:`ghost`,size:`icon-xs`,"aria-label":nf(),children:(0,B.jsx)(cS,{})})}),(0,B.jsxs)(FI,{align:`end`,children:[s&&t.usable&&!t.gone?(0,B.jsxs)(II,{onSelect:()=>y(t),children:[(0,B.jsx)(aS,{"aria-hidden":!0}),Lo()]}):null,(0,B.jsx)(II,{variant:`destructive`,onSelect:()=>void g({chatId:e,instanceName:t.instanceName,agentId:t.agentId}).catch(()=>a.error(Qs())),children:wt()})]})]}):null]},`${t.instanceName}/${t.agentId}`);return(0,B.jsxs)(`div`,{className:`oc-convpanel__tab`,children:[(0,B.jsxs)(`ul`,{className:`oc-convpanel__members`,children:[n.primary?E(n.primary,!0):null,n.agents.map(e=>E(e,!1))]}),s&&n.primary?C?w.length>0?(0,B.jsx)(Ov,{variant:`ghost`,size:`sm`,className:`oc-convpanel__link`,onClick:()=>d(!0),children:mn()}):null:(0,B.jsx)(`p`,{className:`oc-convpanel__hint`,children:Ka()}):null,s&&x?(0,B.jsxs)(`div`,{className:`oc-convpanel__settings`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-convpanel__disclosure`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,B.jsx)(cv,{size:14,"aria-hidden":!0}):(0,B.jsx)(Yx,{size:14,"aria-hidden":!0}),fl()]}),f?(0,B.jsx)(`div`,{className:`oc-convpanel__knobs`,children:(0,B.jsx)(X4,{chatId:e,sm:x,settings:S})}):null]}):null,o?(0,B.jsxs)(Ov,{variant:`outline`,size:`sm`,className:`oc-convpanel__add`,disabled:n.agents.length>=n.limit,onClick:()=>l(!0),children:[(0,B.jsx)(YS,{size:14,"aria-hidden":!0}),ho(),(0,B.jsxs)(`span`,{className:`oc-convpanel__count`,children:[n.agents.length,`/`,n.limit]})]}):null,(0,B.jsx)(`p`,{className:`oc-convpanel__hint`,children:Sre()}),(0,B.jsx)(n3,{open:c,onOpenChange:l,title:ho(),description:gte(),items:o?m:[],keyOf:e=>`${e.instanceName}/${e.agentId}`,searchFields:e=>[e.displayName,e.agentId,e.instanceName,e.description],render:e=>(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(e3,{agent:e}),(0,B.jsxs)(`span`,{className:`oc-convpanel__who`,children:[(0,B.jsx)(`span`,{className:`oc-convpanel__name`,children:t3(e)}),(0,B.jsxs)(`span`,{className:`oc-convpanel__sub`,children:[(0,B.jsx)(nC,{size:10,"aria-hidden":!0}),` `,e.instanceName,e.description?` · ${e.description}`:``]})]})]}),actionLabel:hh(),onPick:t=>h({chatId:e,instanceName:t.instanceName,agentId:t.agentId}).catch(T),empty:qt()}),(0,B.jsx)(n3,{open:u,onOpenChange:d,title:mn(),description:cr(),items:w,keyOf:e=>`${e.instanceName}/${e.agentId}`,searchFields:e=>[e.displayName,e.agentId,e.instanceName],render:e=>(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(e3,{agent:e}),(0,B.jsxs)(`span`,{className:`oc-convpanel__who`,children:[(0,B.jsx)(`span`,{className:`oc-convpanel__name`,children:t3(e)}),(0,B.jsxs)(`span`,{className:`oc-convpanel__sub`,children:[(0,B.jsx)(nC,{size:10,"aria-hidden":!0}),` `,e.instanceName]})]})]}),actionLabel:Up(),closeOnPick:!0,onPick:t=>_({chatId:e,instanceName:t.instanceName,agentId:t.agentId}).catch(e=>{throw a.error(Z4(e)?vl():mne()),e}),empty:qt()})]})}function dPe({chatId:e,viewer:t,authMode:n,participantIdentity:r,intent:i,onIntentDone:a,onLeft:o}){let s=EL(),c=r4(t),[l,u]=(0,z.useState)(!1),[d,f]=(0,z.useState)(`member`),p=o4(d,t);(0,z.useEffect)(()=>{f(`member`)},[e]),(0,z.useEffect)(()=>{i===`invite`&&(u(!0),a())},[i,a]);let m=P(L.chatParticipants.listMembers,{chatId:e}),h=P(L.chatParticipants.listInvitable,l&&c?{chatId:e}:`skip`),g=I(L.chatParticipants.addMember),_=I(L.chatParticipants.removeMember),v=I(L.chatParticipants.setMemberRole),y=I(L.chatParticipants.leaveChat),b=e=>{let t=e instanceof Error?e.message:String(e),n=/participants_limit:(\d+)/.exec(t);throw s.error(n===null?Du():iu({count:Number(n[1])})),e};return(0,B.jsxs)(`div`,{className:`oc-convpanel__tab`,children:[(0,B.jsx)(`ul`,{className:`oc-convpanel__members`,children:(m??[]).map(n=>{let r=n.roomRole===`owner`?null:n.roomRole,i=r===null?[]:GMe(t,r,n.isSelf),a=i4(t,n);return(0,B.jsxs)(`li`,{className:`oc-convpanel__member`,children:[(0,B.jsx)(L4,{userId:String(n.userId),name:n.name}),(0,B.jsxs)(`span`,{className:`oc-convpanel__who`,children:[(0,B.jsxs)(`span`,{className:`oc-convpanel__name`,children:[n.name,n.isSelf?(0,B.jsx)(`span`,{className:`oc-convpanel__you`,children:rt()}):null]}),i.length===0?(0,B.jsx)(`span`,{className:`oc-convpanel__sub`,children:$4(n.roomRole)}):null]}),r!==null&&i.length>0?(0,B.jsxs)(p$,{value:r,onValueChange:t=>void v({chatId:e,memberId:n.userId,role:t}).catch(()=>s.error(Du())),children:[(0,B.jsx)(h$,{size:`sm`,className:`oc-convpanel__role`,children:(0,B.jsx)(m$,{})}),(0,B.jsx)(g$,{align:`end`,children:i.map(e=>(0,B.jsx)(_$,{value:e,children:$4(e)},e))})]}):null,a?(0,B.jsxs)(NI,{children:[(0,B.jsx)(PI,{asChild:!0,children:(0,B.jsx)(Ov,{variant:`ghost`,size:`icon-xs`,"aria-label":nf(),children:(0,B.jsx)(cS,{})})}),(0,B.jsx)(FI,{align:`end`,children:(0,B.jsx)(II,{variant:`destructive`,onSelect:()=>void _({chatId:e,memberId:n.userId}).catch(()=>s.error(Du())),children:__()})})]}):null]},String(n.userId))})}),c?(0,B.jsxs)(Ov,{variant:`outline`,size:`sm`,className:`oc-convpanel__add`,onClick:()=>u(!0),children:[(0,B.jsx)(xC,{size:14,"aria-hidden":!0}),w()]}):null,(0,B.jsxs)(`div`,{className:`oc-convpanel__callout`,children:[(0,B.jsx)(oC,{size:14,"aria-hidden":!0}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`oc-convpanel__callout-title`,children:n===`mixed`?xne():n===`trusted-proxy`?zl():ni()}),(0,B.jsx)(`p`,{children:n===`mixed`?Ai():n===`trusted-proxy`?r===`self`?Ite():Vc():Rn()}),(0,B.jsx)(`dl`,{className:`oc-convpanel__roles`,children:[`viewer`,`member`,`manager`].map(e=>(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`dt`,{children:$4(e)}),(0,B.jsx)(`dd`,{children:oPe(e)})]},e))})]})]}),t===`owner`?null:(0,B.jsxs)(Ov,{variant:`ghost`,size:`sm`,className:`oc-convpanel__leave`,onClick:()=>void y({chatId:e}).then(o).catch(()=>s.error(Du())),children:[(0,B.jsx)(DS,{size:14,"aria-hidden":!0}),Ed()]}),(0,B.jsx)(n3,{open:l,onOpenChange:u,title:w(),description:uu(),items:c?h:[],keyOf:e=>String(e.userId),searchFields:e=>[e.name],header:(0,B.jsxs)(`label`,{className:`oc-convpicker__role`,children:[(0,B.jsx)(`span`,{children:rd()}),(0,B.jsxs)(p$,{value:p,onValueChange:e=>f(e),children:[(0,B.jsx)(h$,{size:`sm`,className:`w-40`,children:(0,B.jsx)(m$,{})}),(0,B.jsx)(g$,{children:a4(t).map(e=>(0,B.jsx)(_$,{value:e,children:$4(e)},e))})]})]}),render:e=>(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(L4,{userId:String(e.userId),name:e.name}),(0,B.jsx)(`span`,{className:`oc-convpanel__who`,children:(0,B.jsx)(`span`,{className:`oc-convpanel__name`,children:e.name})})]}),actionLabel:os(),onPick:t=>g({chatId:e,memberId:t.userId,role:p}).catch(b),empty:Hm()})]})}function i3(e){let t=e.trim().replace(/\s+/g,`.`);return`@${t.length>0?t:`?`}`}var a3=/[\p{L}\p{N}_\-]/u;function o3(e,t,n=[],r=0){if(t.length===0)return null;for(let i=e.indexOf(t,r);i!==-1;i=e.indexOf(t,i+1)){let r=i+t.length,a=i>0?e[i-1]:``;if(a!==``&&(a3.test(a)||a===`@`))continue;let o=e[r]??``;if(!a3.test(o)&&!((o===`.`||o===`'`)&&a3.test(e[r+1]??``))&&!n.some(e=>i<e.end&&r>e.start))return{start:i,end:r}}return null}var s3=e=>`agent`in e;function c3(e){return s3(e)?`agent\u0000${e.agent.instanceName}\u0000${e.agent.agentId}`:`user\u0000${e.userId}`}var l3=[],u3=new Map,d3=new Set;function f3(){for(let e of d3)e()}function fPe(e){return d3.add(e),()=>d3.delete(e)}function p3(e){return u3.get(e)??l3}function pPe(e,t){let n=u3.get(e)??[],r=n.findIndex(e=>c3(e)===c3(t));r!==-1&&n[r].token===t.token||(u3.set(e,r===-1?[...n,t]:n.map((e,n)=>n===r?t:e)),f3())}function mPe(e){let t=u3.get(e)??l3;return t.length>0&&(u3.delete(e),f3()),t}function m3(e,t){if(t.length===0)return;let n=u3.get(e)??[],r=new Set(n.map(c3)),i=[...n];for(let e of t)r.has(c3(e))||i.push(e);u3.set(e,i),f3()}function hPe(e,t){let n=[],r=[],i=[];for(let a of t){let t=o3(e,a.token,i);t!==null&&(s3(a)?r.push({...a.agent,start:t.start,end:t.end}):n.push({userId:a.userId,start:t.start,end:t.end}),i.push(t))}return{people:n.sort((e,t)=>e.start-t.start),agents:r.sort((e,t)=>e.start-t.start)}}function h3(e,t){let n=mPe(e),{people:r,agents:i}=hPe(t,n);return{staged:n,mentions:r,agentMentions:i}}function g3(e){return e.filter(s3).map(e=>({...e.agent}))}function gPe(e,t,n,r){return _3(e,t,{userId:n,token:r})}function _Pe(e,t,n,r){return _3(e,t,{agent:{instanceName:n.instanceName,agentId:n.agentId},token:r})}function _3(e,t,n){let r=c3(n),i=n.token,a=p3(e),o=a.find(e=>c3(e)===r);if(o!==void 0&&o3(t,o.token)!==null)return null;let s=new Set(a.filter(e=>c3(e)!==r).map(e=>e.token)),c=i;for(let e=2;s.has(c);e+=1)c=`${i}-${e}`;return pPe(e,{...n,token:c}),`${t}${t.length===0||t.endsWith(` `)?``:` `}${c} `}function vPe(e){return e.kind===`tool`}function yPe(e){return e.kind===`media`}function bPe(e){return e.kind===`file`}function xPe(e){return e.kind===`reasoning`}function SPe(e){return e.kind===`plan`}function CPe(e){return e.kind===`cron`}function v3(e){return e.kind===`widget`}function wPe(e){return e.kind===`compaction`}function TPe(e){let t=[],n=/^ {0,3}(`{3,}|~{3,})(.*)$/gm,r=-1,i=``,a=0;for(let o=n.exec(e);o!==null;o=n.exec(e)){let e=o[1][0];r===-1?(r=o.index,i=e,a=o[1].length):e===i&&o[1].length>=a&&/^[ \t]*$/.test(o[2])&&(t.push([r,o.index+o[1].length]),r=-1)}return r!==-1&&t.push([r,e.length]),t}function EPe(e,t){let n=Math.max(0,t);if(n===0)return 0;if(n>=e.length)return n;for(let[t,r]of TPe(e))if(n>t&&n<r)return t;return n}function y3(e,t,n){if((n?.settled??!0)||(t=t.filter(t=>t.offset<=e.length)),t.length===0)return e.length>0?[{kind:`text`,text:e}]:[];let r=[],i=0;for(let n of t){let t=Math.max(i,EPe(e,n.offset));i=t;let a=r[r.length-1];a!==void 0&&a.cut===t?a.parts.push(n.activity):r.push({cut:t,parts:[n.activity]})}let a=[];for(let t of r){let n=a[a.length-1];n!==void 0&&e.slice(Math.min(n.cut,e.length),Math.min(t.cut,e.length)).trim()===``?n.parts.push(...t.parts):a.push(t)}let o=[],s=0;for(let t of a){let n=Math.min(t.cut,e.length),r=e.slice(s,n);r.trim()!==``&&o.push({kind:`text`,text:r}),o.push({kind:`activity`,parts:t.parts,cut:t.cut}),s=Math.max(s,n)}let c=e.slice(s);return c.trim()!==``&&o.push({kind:`text`,text:c}),o}var b3=[`read`,`exec`,`search`,`fetch`,`write`,`other`],x3={read:{one:()=>yl(),many:e=>Ve({count:String(e)})},exec:{one:()=>iv(),many:e=>Ps({count:String(e)})},search:{one:()=>aa(),many:e=>Ir({count:String(e)})},fetch:{one:()=>vn(),many:e=>Vo({count:String(e)})},write:{one:()=>Xa(),many:e=>Oa({count:String(e)})},other:{one:e=>Bh({tool:e}),many:e=>ge({count:String(e)})}};function S3(e){return e===`started`||e===`running`||e===`start`}function DPe(e){let t=new Map;for(let n of e){let e=T$(n.toolName);t.set(e,(t.get(e)??0)+1)}let n=`other`,r=-1;for(let e of b3){let i=t.get(e)??0;i>r&&(n=e,r=i)}return n}function OPe(e,t){let n=t?.live===!1?void 0:[...e].reverse().find(e=>S3(e.phase));if(n!==void 0)switch(T$(n.toolName)){case`read`:return cd();case`exec`:return hu();case`search`:return Bu();case`fetch`:return ci();case`write`:return Vg();default:return Ii({tool:n.toolName})}let r=new Map;for(let t of e){let e=T$(t.toolName),n=r.get(e)??[];n.push(t),r.set(e,n)}let i=[];for(let e of b3){let t=r.get(e);t!==void 0&&i.push(t.length===1?x3[e].one(t[0].toolName):x3[e].many(t.length))}let a=i.length===1?i[0]:i.slice(0,-1).join(Jc())+hr()+i[i.length-1],o=Kl()+a;return o.charAt(0).toUpperCase()+o.slice(1)}var kPe=/---[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}(?=\.[^.]+$|$)/i;function APe(e){return e.replace(kPe,``)}var C3=`/__openclaw__/canvas/documents/`,jPe=/^cv_[A-Za-z0-9._-]{1,253}$/;function w3(e){if(!/[`~\t]| {4}/u.test(e))return[];let t=[],n=[];{let t=0;for(;t<=e.length;){let r=e.indexOf(`
|
|
428
|
+
`,t),i=r===-1?e.length:r+1;if(n.push({start:t,end:i,body:e.slice(t,r===-1?e.length:r)}),r===-1)break;t=i}}let r=[],i=!0;for(let t=0;t<n.length;t++){let a=n[t],o=/^ {0,3}(`{3,}|~{3,})/.exec(a.body);if(o&&!(o[1][0]==="`"&&a.body.slice(o[0].length).includes("`"))){let s=o[1][0],c=o[1].length,l=RegExp(`^ {0,3}\\${s}{${c},}\\s*$`),u=t+1;for(;u<n.length&&!l.test(n[u].body);)u++;let d=u<n.length?n[u].end:e.length;r.push({start:a.start,end:d}),t=u,i=!1;continue}if(i&&/^(?: {4}|\t)/.test(a.body)&&a.body.trim()!==``){let e=t;for(;e+1<n.length&&(/^(?: {4}|\t)/.test(n[e+1].body)||n[e+1].body.trim()===``);)e++;r.push({start:a.start,end:n[e].end}),t=e,i=n[e].body.trim()===``;continue}i=a.body.trim()===``}t.push(...r);let a=e=>r.some(t=>e>=t.start&&e<t.end),o=0;for(;o<e.length;){if(e[o]!=="`"||a(o)){o++;continue}let n=0;for(;e[o+n]==="`";)n++;let r=o+n,i=-1;for(;r<e.length;)if(e[r]==="`"){let t=0;for(;e[r+t]==="`";)t++;if(t===n){i=r+t;break}r+=t}else r++;if(i===-1){o+=n;continue}t.push({start:o,end:i}),o=i}return t.sort((e,t)=>e.start-t.start)}function T3(e,t){return t.some(t=>e>=t.start&&e<t.end)}function MPe(e){let t={},n=/([A-Za-z_][A-Za-z0-9_-]*)\s*=\s*(?:"([^"]*)"|'([^']*)')/g,r;for(;r=n.exec(e);){let e=r[1]?.trim().toLowerCase(),n=(r[2]??r[3]??``).trim();e&&n&&(t[e]=n)}return t}function NPe(e){if(e.target&&e.target!==`assistant_message`)return null;let t=e.ref?.trim();if(!t||!jPe.test(t))return null;let n=e.url?.trim()||`${C3}${encodeURIComponent(t)}/index.html`;try{let e=new URL(n,`http://localhost`);if(e.origin!==`http://localhost`||!e.pathname.startsWith(C3))return null;let[r,i]=e.pathname.slice(31).split(`/`,2);if(!r||!i)return null;let a=decodeURIComponent(r);return/^[A-Za-z0-9._-]+$/u.test(a)&&a===t?t:null}catch{return null}}function PPe(e){if(!e.trim()||!e.toLowerCase().includes(`[embed`))return[];let t=w3(e),n=[];for(let r of[/\[embed\s+([^\]]*?[^\]/]|)\]([\s\S]*?)\[\/embed\]/gi,/\[embed\s+([^\]]*?)\/\]/gi]){let i;for(;i=r.exec(e);){let e=i.index;T3(e,t)||n.push({start:e,end:e+i[0].length,viewId:NPe(MPe(i[1]??``))})}}n.sort((e,t)=>e.start-t.start);let r=[],i=0;for(let e of n)e.start<i||(r.push(e),i=e.end);return r}function FPe(e){let t=e.toLowerCase(),n=t=>T3(t,w3(e))?e:e.slice(0,t),r=e.lastIndexOf(`[`);if(r!==-1){let e=t.slice(r);if(e.length<6&&`[embed`.startsWith(e))return n(r)}let i=t.lastIndexOf(`[embed`);if(i===-1)return e;let a=e.slice(i);if(!/^\[embed(?:\s|$)/i.test(a))return e;let o=a.indexOf(`]`);return o===-1?n(i):a[o-1]===`/`||/\[\/embed\]/i.test(a)?e:n(i)}function IPe(e,t,n){let r=e;if(t.size>0){let n=PPe(e).filter(e=>e.viewId!==null&&t.has(e.viewId));if(n.length>0){r=``;let t=0;for(let i of n)r+=e.slice(t,i.start),t=i.end;r+=e.slice(t)}}return n?FPe(r):r}function E3(e){return cc({size:String(Math.round((e??0)/1024))})}function LPe(e,t){let n=e.runId??`norun`;return`${e._id}:${n}:${t}`}function RPe(e,t,n){return{toolCallId:n.toolCallId??LPe(e,t),toolName:n.name,args:n.input??{},result:n.outputOmitted?E3(n.outputBytes):n.output,...n.outputDetails===void 0?{}:{resultDetails:n.outputDetails},argsText:n.inputOmitted?E3(n.inputBytes):n.input===void 0?void 0:HPe(n.input),phase:typeof n.phase==`string`?n.phase:void 0}}function D3(e){return e&&APe(e)}function zPe(e){return e.url?{type:`file`,mimeType:e.mimeType,data:e.url,filename:D3(e.filename),storageId:e.storageId}:null}function BPe(e,t,n){return t.length>0?y3(e,t,{settled:n}):e.length>0?[{kind:`text`,text:e}]:[]}function VPe(e,t,n,r){let i=[...n].sort((e,t)=>e.at-t.at),a=[],o=0;for(let n=0;n<=i.length;n++){let s=i[n],c=s===void 0?1/0:s.at,l=Math.max(0,Math.min(o,e.length)),u=Math.max(l,Math.min(c,e.length));a.push(...BPe(e.slice(l,u),t.filter(e=>e.offset>=o&&e.offset<c).map(e=>({...e,offset:e.offset-l})),r).map(e=>e.kind===`activity`?{...e,cut:e.cut+l}:e)),s!==void 0&&(a.push({kind:`delegated`,key:s.key,...s.slot===void 0?{}:{slot:s.slot}}),o=Math.max(o,s.at))}return a}function O3(e){if(e.role!==`assistant`)return[];let t=e.continuations??[];if(t.length===0)return e.continuationAt===void 0?[]:[{at:e.continuationAt,key:``}];let n=t.flatMap(e=>e.childRunIds);return[...t.map((e,t)=>({at:e.at,key:String(t),slot:{kind:`batch`,childRunIds:e.childRunIds}})),{at:e.continuationAt??1/0,key:`rest`,slot:{kind:`rest`,claimed:n}}]}function HPe(e){try{return typeof e==`string`?e:JSON.stringify(e,null,2)}catch{return String(e)}}function UPe(e,t,n){let r=[],i=[],a=[],o=[],s=[],c=[],l=[],u=null;e.parts.forEach((t,n)=>{if(xPe(t))r.push({type:`reasoning`,text:t.textOmitted?E3(t.textBytes):t.text??``});else if(vPe(t)){let r=RPe(e,n,t);o.push(r),t.textOffset===void 0?i.push(r):a.push({offset:t.textOffset,activity:r})}else t.kind===`provenance`?s.push(t):CPe(t)?c.push(t):SPe(t)?l.push(t):wPe(t)&&u===null&&(u={phase:t.phase,at:t.at,...typeof t.reason==`string`&&t.reason?{reason:t.reason}:{}})});let d=e.status!==`streaming`,f=O3(e),p=f.length>0?VPe(e.text??``,a,f,d):a.length>0?y3(e.text??``,a,{settled:d}):e.text&&e.text.length>0?[{kind:`text`,text:e.text}]:[],m=new Set(e.role===`assistant`?e.parts.filter(v3).map(e=>e.viewId):[]),h=e.role===`assistant`&&!d&&p[p.length-1]?.kind===`text`?p.length-1:-1;p.forEach((t,n)=>{t.kind===`text`?r.push({type:`text`,text:e.role===`assistant`?IPe(t.text,m,n===h):t.text}):t.kind===`delegated`?r.push({type:`tool-call`,toolCallId:t.key===``?`delegated:${e._id}`:`delegated:${e._id}:${t.key}`,toolName:`__delegated_reply__`,args:t.slot===void 0?{}:{slot:t.slot}}):r.push({type:`tool-call`,toolCallId:`flow:${e._id}:${t.cut}`,toolName:`__turn_flow__`,args:{parts:t.parts}})}),e.role===`assistant`&&e.parts.forEach(e=>{v3(e)&&r.push({type:`data-widget`,data:{viewId:e.viewId,...e.title===void 0?{}:{title:e.title},...e.preferredHeight===void 0?{}:{preferredHeight:e.preferredHeight}}})}),e.parts.forEach(e=>{if(yPe(e)||bPe(e)){let t=zPe(e);t&&r.push(t)}}),r.length===0&&r.push({type:`text`,text:``});let g=e.role===`assistant`?e.status===`streaming`?{type:`running`}:e.status===`complete`?{type:`complete`,reason:`stop`}:e.status===`error`?{type:`incomplete`,reason:`error`,error:e.error??e.errorCode??`error`}:e.status===`aborted`?{type:`incomplete`,reason:`cancelled`}:void 0:void 0;return{id:e._id,role:e.role,createdAt:new Date(e.updatedAt??e._creationTime),...g===void 0?{}:{status:g},content:r,metadata:{custom:{messageId:e._id,authorName:e.authorName??null,mentions:e.mentions??null,importedAgentLabel:n??null,sentAt:e.orderTime??e._creationTime,settledAt:e.finalizedAt??e.updatedAt??null,generationMs:e.role===`assistant`&&(e.status===`complete`||e.status===`aborted`)&&e.orderTime===void 0&&typeof e.finalizedAt==`number`?Math.max(0,e.finalizedAt-e._creationTime):null,chatId:e.chatId,status:e.status,runId:e.runId??null,hasMergedRuns:e.hasMergedRuns??!1,continuationAt:e.continuationAt??null,hasContinuation:O3(e).length>0,answeredChildRunIds:e.role===`assistant`?[...e.followedUpChildRunIds??[]]:[],error:e.error??null,errorCode:e.errorCode??null,autoRetry:e.autoRetry??null,autoRetryOutcome:e.autoRetryOutcome??null,interruptedAt:e.interruptedAt??null,phase:e.phase??null,phaseRetry:e.phaseRetry??null,toolParts:i,allToolParts:o,activeToolName:E$(o)?.name??null,provenanceParts:s,cronParts:c,planParts:l,routedInstanceName:t?.instanceName??e.routedInstanceName??null,routedAgentId:t?.agentId??e.routedAgentId??null,compaction:u,attachedDocCount:e.attachedDocCount??0,queued:e.role===`user`&&e.outbox?.status===`queued`,rawText:e.text,quotedRefs:e.quotedRefs??null}}}}var WPe=new Set([`image/png`,`image/jpeg`,`image/jpg`,`image/gif`,`image/webp`]);function GPe(e){if(typeof e!=`string`)return!1;let t=e.toLowerCase().split(`;`)[0]?.trim()??``;return WPe.has(t)}var KPe=128*1024;function qPe(e){let t=e-KPe;return t<=0?0:Math.floor(t/4)*3}function JPe(e){let t=e.split(`;`)[0]?.trim().toLowerCase()??``;return!(t.startsWith(`text/`)||t===`application/json`||t===`application/xml`||t===`image/svg+xml`)||e.toLowerCase().includes(`charset`)?e:`${e}; charset=utf-8`}function YPe(){return`att_${Math.random().toString(36).slice(2)}_${Date.now()}`}function XPe(e){if(!e)return[];let t=[];for(let n of e){let e=n.convex;e?.storageId&&t.push({storageId:e.storageId,filename:e.filename,mimeType:e.mimeType,...e.origin?{origin:e.origin}:{}})}return t}var ZPe=`image/*`;function QPe(e,t,n,r){return{accept:`*`,async add({file:i}){yMe();try{let a=null;try{let t=r?.()??null;a=(await e.query(L.bridgeHealth.getBridgeAvailability,n?{chatId:n,...t?{routedAgent:t}:{}}:{}))?.maxInboundBytes??null}catch{}let o=a??qPe(26214400);if(n&&!GPe(i.type))try{let t=r?.()??null,i=await e.query(L.bridge.getChatInboundPolicy,{chatId:n,...t?{routedAgent:t}:{}});i?.inboundMediaMode===`shared-fs`&&(o=i.sharedFsMaxBytes)}catch{}if(i.size>o){let e=e=>Math.floor(e/1024/1024),n=Hee({size:e(i.size),max:e(o)});throw t?.(n),Error(n)}return{id:YPe(),type:$Pe(i.type),name:i.name,contentType:i.type||`application/octet-stream`,file:i,status:{type:`running`,reason:`uploading`,progress:0}}}finally{bMe()}},async send(t){let n=t.file;z2.report(t.id,0,n.size||1);try{let r;try{r=await e.mutation(L.chats.generateUploadUrl,{})}catch(e){throw console.error(`[attach] generateUploadUrl failed:`,e),e}let i=await new Promise((e,i)=>{let a=new XMLHttpRequest;a.open(`POST`,r),a.setRequestHeader(`Content-Type`,JPe(n.type||`application/octet-stream`)),a.upload.onprogress=e=>{e.lengthComputable&&z2.report(t.id,e.loaded,e.total)},a.onload=()=>{if(a.status>=200&&a.status<300)try{e(JSON.parse(a.responseText).storageId)}catch(e){i(e)}else i(Error(`Upload failed (${a.status})`))},a.onerror=()=>{console.error(`[attach] upload POST failed (network/CORS/CSP)`),i(Error(`Upload failed (network)`))},a.send(n)});return await e.mutation(L.uploads.registerUpload,{storageId:i}),{id:t.id,type:t.type,name:t.name,contentType:t.contentType,status:{type:`complete`},content:[{type:`text`,text:n.name}],convex:{storageId:i,filename:n.name,mimeType:n.type||`application/octet-stream`,...MQ(n)?{origin:`pasted`}:{}}}}finally{z2.clear(t.id)}},async remove(){}}}function $Pe(e){return e.startsWith(`image/`)?`image`:`document`}function eFe(e){let t=[],n=e.replace(/\r\n/g,`
|
|
429
|
+
`).split(`
|
|
430
|
+
|
|
431
|
+
`),r=n.pop()??``;for(let e of n){if(e.trim()===``)continue;let n={data:``},r=[];for(let t of e.split(`
|
|
432
|
+
`))if(t.startsWith(`id:`)){let e=Number.parseInt(t.slice(3).trim(),10);Number.isFinite(e)&&(n.id=e)}else t.startsWith(`event:`)?n.event=t.slice(6).trim():t.startsWith(`data:`)&&r.push(t.slice(5).trim());n.data=r.join(`
|
|
433
|
+
`),t.push(n)}return{events:t,rest:r}}var tFe={text:``,lastSeq:0,done:!1};function nFe(e){if(e.event===`done`||e.event===`final`||e.data===``)return null;try{let t=JSON.parse(e.data);return typeof t.recTimingId==`string`?t.recTimingId:null}catch{return null}}function rFe(e,t){if(t.event===`done`)return{...e,done:!0};if(t.event===`final`){try{let n=JSON.parse(t.data);if(typeof n.text==`string`)return{...e,text:n.text}}catch{}return e}if(t.data===``)return e;try{let n=JSON.parse(t.data);if(typeof n.text!=`string`)return e;let r=n.kind===`replace`?n.text:e.text+n.text;return{...e,text:r,lastSeq:t.id??e.lastSeq}}catch{return e}}function iFe(){return!1}function aFe(e,t,n,r){let i=Qv(),a=(0,z.useRef)(r);a.current=r;let[o,s]=(0,z.useState)(null);return(0,z.useEffect)(()=>{let r=h2();if(!n||!e||!i||!r){s(null);return}let o=!1,c=new AbortController,l=tFe;return s(null),(async()=>{for(;!o&&!l.done;){try{let n=await fetch(`${r}/api/v1/message-stream?messageId=${encodeURIComponent(e)}`,{headers:{Authorization:`Bearer ${i}`,...l.lastSeq>0?{"Last-Event-ID":String(l.lastSeq)}:{}},signal:c.signal});if(!n.ok||!n.body){s(null);return}let u=n.body.getReader(),d=new TextDecoder,f=``;for(;!o;){let{value:n,done:r}=await u.read();if(r)break;f+=d.decode(n,{stream:!0});let i=eFe(f);f=i.rest;for(let e of i.events){l=rFe(l,e);let t=nFe(e);t!==null&&a.current?.(t,e.id??0)}if(o||s({text:l.text,lastSeq:l.lastSeq,messageId:e,generationKey:t}),l.done)break}}catch{if(o)return;s(null)}if(l.done||o)break;await new Promise(e=>setTimeout(e,500))}})(),()=>{o=!0,c.abort()}},[n,e,i,t]),o}function oFe(e){let t=e=>e===null?`—`:String(Math.round(e)),n=`delivery latency — session ${e.sessionId??`?`} (${e.count}${e.truncated?`+`:``} deltas)`;if(e.segments===null)return`${n}\n(no samples)`;let r=e.segments,i=(e,n)=>`${e}: p50=${t(n.p50)} p95=${t(n.p95)} max=${t(n.max)} ms (n=${n.count})`,a=[n,i(`bridge internal`,r.bridge),i(`A bridge->Convex`,r.A),i(`C Convex->frontend`,r.C),`B Convex exec: from Convex telemetry (not measurable in-app)`];return e.truncated&&a.push(`(report capped at ${e.count} rows — later deltas not included)`),a.join(`
|
|
434
|
+
`)}function sFe(e,t,n){return t-(e+(n-e)/2)}function k3(e,t,n){return e.length===0||t===void 0?null:e.slice(0,n).map(e=>({...e,clientSkew:e.clientSkew??t}))}function cFe(e,t){let n=[];for(let r of e)r.recTimingId!==void 0&&n.push({timingId:r.recTimingId,t4:t});return n}function A3(e,t,n){for(let r of t){if(n.has(r.timingId))continue;let t=e.get(r.timingId);(t===void 0||r.t4<t)&&e.set(r.timingId,r.t4)}}var lFe=1e3,j3=2e3,M3=500;function uFe(e,t){let n=P(L.messages.getStreamingText,e?{chatId:e}:`skip`),r=I(L.deliveryTiming.recordFrontendTiming),i=I(L.deliveryTiming.calibrateClock),a=(0,z.useRef)(new Map),o=(0,z.useRef)(new Set),s=(0,z.useRef)([]),c=(0,z.useRef)(void 0),l=(0,z.useRef)(!1),u=(0,z.useCallback)(()=>{if(c.current!==void 0||l.current)return;l.current=!0;let e=Date.now();i({clientSentAt:e}).then(t=>{c.current=sFe(e,t.serverNow,Date.now())}).catch(()=>{l.current=!1})},[i]);(0,z.useEffect)(()=>{n&&(A3(a.current,cFe(n,Date.now()),o.current),a.current.size>0&&u(),o.current.size>0&&!n.some(e=>e.recTimingId!==void 0)&&o.current.clear())},[n,u]),(0,z.useEffect)(()=>{let e=()=>{A3(a.current,t.current??[],o.current),t.current&&(t.current.length=0),a.current.size>0&&u();for(let[e,t]of a.current)s.current.push({timingId:e,t4:t,clientSkew:c.current}),o.current.add(e);a.current.clear(),s.current.length>j3&&s.current.splice(0,s.current.length-j3);let e=k3(s.current,c.current,M3);e!==null&&(s.current.splice(0,e.length),r({samples:e}).catch(()=>{}))},n=window.setInterval(e,lFe);return()=>{for(window.clearInterval(n),e();k3(s.current,c.current,M3)!==null;)e()}},[r,t,u])}var dFe=[];function N3(e){let t=e instanceof Error?e.message:``;return new Set([...t.matchAll(/Invalid: quote target gone \[([^\]]+)\]/g)].map(e=>e[1]))}function P3(e){let t=e instanceof Error?e.message:``;return N3(e).size>0?!1:/Invalid:.*quote/i.test(t)}function F3(e){let t=e instanceof Error?e.message:String(e??``);return t.includes(`agent_mentions_invalid:too_many_agents`)?`too_many`:t.includes(`agent_mentions_invalid:`)||t.includes(`Forbidden: agent is not part of this conversation`)||t.includes(`Forbidden: routed agent is not dispatchable`)?`invalid`:null}function fFe({chatId:e}){let t=H_(),n=EL(),r=I(L.send.sendMessage).withOptimisticUpdate((e,t)=>{let n={chatId:t.chatId},r=e.getQuery(L.messages.listByChat,n)??[],i=`optimistic-${t.clientMessageId}`;if(r.some(e=>e._id===i))return;let a=Date.now(),o={_id:i,chatId:t.chatId,_creationTime:a,orderTime:void 0,role:`user`,status:`complete`,runId:void 0,error:void 0,errorCode:void 0,attachedDocCount:void 0,finalizedAt:void 0,text:t.text,updatedAt:a,routedInstanceName:t.routedAgent?.instanceName??t.agentMentions?.[0]?.instanceName,routedAgentId:t.routedAgent?.agentId??t.agentMentions?.[0]?.agentId,quotedRefs:t.quotes,hasMergedRuns:!1,hasAnnouncePrefix:!1,mergedIntoTurn:void 0,continuationAt:void 0,continuations:void 0,followedUpChildRunIds:void 0,autoRetry:void 0,autoRetryOutcome:void 0,interruptedAt:void 0,parts:[],outbox:null,finalizeCause:void 0,priorFinalizeCauses:void 0,importedAgentLabel:void 0,chatImportedAgentLabel:void 0};e.setQuery(L.messages.listByChat,n,[...r,o])}),i=P(L.messages.listByChat,e?{chatId:e}:`skip`),a=P(L.messages.getStreamingText,e?{chatId:e}:`skip`),o=a&&a.length>0?a[0].messageId:null,s=P(L.messages.getChatStreamTransport,e?{chatId:e}:`skip`)===`sse`||iFe(),c=(0,z.useRef)([]),l=(0,z.useRef)(0),u=(0,z.useCallback)((e,t)=>{t<l.current||c.current.push({timingId:e,t4:Date.now()})},[]),d=a&&a.length>0?a[0].streamRowId??null:null,f=aFe(o,d,s,u);l.current=(a?.[0]?.chunkSeq??1)-1,uFe(e,c);let p=P(L.agents.getChatAgent,e?{chatId:e}:`skip`),m=P(L.messages.getSessionMeta,e?{chatId:e}:`skip`),h=P(L.agents.listMyAgents,e?{}:`skip`),g=P(L.chatAgents.listChatAgents,e?{chatId:e}:`skip`),_=(g?.viewerRole??m?.viewerRole)===`participant`,v=g?[g.primary,...g.agents].filter(e=>e!==null).map(e=>`${e.instanceName}\0${e.agentId}`).join(`|`):``,y=(0,z.useMemo)(()=>(g?.agents??[]).map(e=>({instanceName:e.instanceName,agentId:e.agentId})),[v]),b=h===void 0||e!==null&&g===void 0,x=(0,z.useMemo)(()=>e!==null&&g===void 0?[]:!_||!g?h??[]:[g.primary,...g.agents].filter(e=>e!==null).map(e=>({instanceName:e.instanceName,agentId:e.agentId,isDefault:e.role===`primary`,displayName:e.displayName,emoji:e.emoji,model:e.model,description:e.description,kind:e.kind,state:e.usable?`ok`:`deleted`})),[e,h,_,v,g]),S=(0,z.useMemo)(()=>iNe(x,g?[g.primary,...g.agents]:null),[x,v,g===void 0]),C=p?.multiAgent===!0,w=m?.perTurnRouting===!0,T=C||w,E=(0,z.useMemo)(()=>p?.agent?{instanceName:p.agent.instanceName,agentId:p.agent.agentId}:null,[p?.agent?`${p.agent.instanceName}\0${p.agent.agentId}`:``]),D=(0,z.useMemo)(()=>m?.lastRoutedInstanceName&&m?.lastRoutedAgentId?{instanceName:m.lastRoutedInstanceName,agentId:m.lastRoutedAgentId}:null,[m?.lastRoutedInstanceName&&m?.lastRoutedAgentId?`${m.lastRoutedInstanceName}\0${m.lastRoutedAgentId}`:``]),O=(0,z.useSyncExternalStore)(fPe,()=>e?p3(e):dFe),k=g3(O).map(e=>`${e.instanceName}\0${e.agentId}`).join(`|`),ee=y.length>0,A=i===void 0,j=(0,z.useMemo)(()=>qMe(i??[]),[i]),te=(0,z.useMemo)(()=>(i?JMe(i):null)??D,[i,D]),ne=(0,z.useMemo)(()=>XMe({selected:null,lastRouted:te,primary:E,pool:S,poolLoading:b,messagesLoading:A,canRoute:T}),[te,E,S,b,A,T]),M=(0,z.useMemo)(()=>d4({mentioned:g3(O),primary:E,severalAgents:ee,perTurnRouting:w,canRoute:T})??null,[k,E,ee,w,T]),N=i!==void 0&&i.length===0,re=(0,z.useRef)({primary:null,severalAgents:!1,perTurnRouting:!1,canRoute:!1,nextTarget:null});re.current={primary:E,severalAgents:ee,perTurnRouting:w,canRoute:T,nextTarget:M};let ie=(0,z.useCallback)(e=>{let t=re.current;if(e.length>0&&t.canRoute)return{agentMentions:e.map(e=>({instanceName:e.instanceName,agentId:e.agentId,start:e.start,end:e.end}))};let n=d4({mentioned:[],primary:t.primary,severalAgents:t.severalAgents,perTurnRouting:t.perTurnRouting,canRoute:t.canRoute});return n?{routedAgent:n}:{}},[]),ae=(0,z.useMemo)(()=>QPe(t,e=>n.error(e),e,()=>re.current.nextTarget),[t,n,e]),oe=(0,z.useMemo)(()=>{let e=i??[];if(!a||a.length===0)return e;let t=new Map(a.map(e=>[e.messageId,{text:e.text,chunkSeq:e.chunkSeq,phase:e.phase,phaseRetry:e.phaseRetry}]));return e.map(e=>{if(e.status!==`streaming`)return e;let n=e._id,r=t.get(n);if(typeof e.runId==`string`&&e.runId.startsWith(`announce:v1:`)){let t=r?.phase,n=r?.phaseRetry;return t===void 0?e:{...e,phase:t,phaseRetry:n}}if(f!==null&&f.messageId===o&&f.generationKey===d&&n===o){let t=(r?.chunkSeq??1)-1,n=f.lastSeq>=t;return{...e,text:n?f.text:r?.text??f.text,...r?.phase===void 0?{}:{phase:r.phase},...r?.phaseRetry===void 0?{}:{phaseRetry:r.phaseRetry}}}return r===void 0?e:{...e,text:r.text,...r.phase===void 0?{}:{phase:r.phase},...r.phaseRetry===void 0?{}:{phaseRetry:r.phaseRetry}}})},[i,a,f,o]),se=(0,z.useRef)(new Set),ce=e=>e.role===`user`&&(e.outbox?.status===`queued`||se.current.has(String(e._id))),le=oe.filter(ce).map(e=>({messageId:String(e._id),text:e.text,mine:e.mine!==!1,canCancel:e.mine!==!1||!_,pending:String(e._id).startsWith(`optimistic-`)})),ue=(0,z.useMemo)(()=>oe.filter(e=>!ce(e)),[oe]),de=ue.length>0?ue[ue.length-1].role:null,fe=ue.some(e=>e.status===`streaming`),[pe,me]=(0,z.useState)(null);(0,z.useEffect)(()=>{me(null)},[e]),(0,z.useEffect)(()=>{de===`assistant`&&me(null)},[de,oe]),(0,z.useEffect)(()=>{if(pe===null)return;let e=window.setTimeout(()=>me(null),12e4);return()=>window.clearTimeout(e)},[pe]);let he=pe!==null||fe,ge=le.length>0&&!fe,_e=(0,z.useMemo)(()=>QMe(i??[]),[i]),ve=(0,z.useCallback)(e=>UPe(e,j.get(e._id)??null,_e.get(e._id)??null),[j,_e]),ye=(0,z.useMemo)(()=>({messages:ue,isRunning:he,convertMessage:ve,onNew:async t=>{if(!e)throw Error(`No chat selected`);let i=t.content.filter(e=>e.type===`text`).map(e=>e.text).join(``),a=XPe(t.attachments).map(e=>({storageId:e.storageId,filename:e.filename,mimeType:e.mimeType,...e.origin?{origin:e.origin}:{}})),o=_w(e),{staged:s,mentions:c,agentMentions:l}=h3(e,i),u=c.map(e=>({userId:e.userId,start:e.start,end:e.end})),d=ie(l);me(Date.now());try{await r({chatId:e,text:i,clientMessageId:crypto.randomUUID(),attachments:a,...d,...o.length>0?{quotes:o.map(e=>({messageId:e.messageId,blockIndex:e.blockIndex,excerpt:e.excerpt}))}:{},...u.length>0?{mentions:u}:{}})}catch(t){if(m3(e,s),!P3(t)){let r=vw(e,o,N3(t));r.gone>0&&n.error(Sf({count:r.gone})),r.dropped>0&&n.error(Z_({count:r.dropped}))}let r=F3(t);throw r!==null&&n.error(r===`too_many`?En():Dl()),me(null),t}},adapters:{attachments:ae}}),[oe,he,e,r,ae,ie]),be=(0,z.useMemo)(()=>({begin:()=>me(Date.now()),cancel:()=>me(null)}),[]),xe=I(L.messages.abortTurn),Se=I(L.send.cancelQueuedMessage),Ce=(0,z.useCallback)(async e=>{try{return await Se({messageId:e}),!0}catch{return n.error(wc()),!1}},[Se,n]),we=(0,z.useCallback)(async t=>{let i=t.trim();if(!e||i===``)return!1;let a=_w(e),{staged:o,mentions:s,agentMentions:c}=h3(e,t),l=ie(c),u=s.map(e=>({userId:e.userId,start:e.start,end:e.end})),d=crypto.randomUUID();se.current.add(`optimistic-${d}`);try{return await r({chatId:e,text:t,clientMessageId:d,...l,...a.length>0?{quotes:a.map(e=>({messageId:e.messageId,blockIndex:e.blockIndex,excerpt:e.excerpt}))}:{},...u.length>0?{mentions:u}:{}}),!0}catch(t){if(m3(e,o),!P3(t)){let r=vw(e,a,N3(t));r.gone>0&&n.error(Sf({count:r.gone})),r.dropped>0&&n.error(Z_({count:r.dropped}))}let r=t?.message??``,i=F3(t);return n.error(i===`too_many`?En():i===`invalid`?Dl():r.includes(`QUEUE_FULL`)?Jre():r.includes(`TALK_CALL_ACTIVE`)?gd():am()),!1}},[e,r,n,ie]),Te=(0,z.useMemo)(()=>({pool:x,roomAgents:y,multiAgent:C,perTurnRouting:w,emptyThread:N,primary:E,nextTarget:M,messageAgents:j,fallbackAgent:ne}),[x,y,C,w,N,E,M,j,ne]),Ee=(0,z.useCallback)(async()=>{if(e)try{if((await xe({chatId:e})).ok){me(null);return}n.error(sc())}catch(e){n.error(Nt(),e)}},[e,xe,n]);return{runtime:uk(ye),turnGate:be,queueSend:we,abortTurn:Ee,routing:Te,lastUserTurnQueued:ge,queuedTurns:le,cancelQueued:Ce,initialLoading:A}}function I3(e,{key:t,value:n}){let r=e.getQuery(L.me.getMe,{host:A2});if(!r?.ui)return;let i={...r.ui.effective},a={...r.ui.userOverrides},o=t,s=t;n===null?delete a[s]:(i[o]=n,a[s]=n),e.setQuery(L.me.getMe,{host:A2},{...r,ui:{...r.ui,effective:i,userOverrides:a}})}function pFe(e,{messageId:t}){for(let{args:n,value:r}of e.getAllQueries(L.messages.listByChat)){if(r===void 0)continue;let i=r.find(e=>e._id===t);if(i===void 0)continue;let a=i._creationTime;e.setQuery(L.messages.listByChat,n,r.filter(e=>e._creationTime<a))}}function mFe(e){let t=e instanceof Error?e.message:typeof e?.data==`string`?String(e.data):String(e??``);return/compact_refused|already_active|already_in_flight|deferred_compaction_not_scheduled|below_threshold|already_compacted_recently|unsupported_harness_compaction|no transcript|no sessionId/i.test(t)}function hFe(e){let t=mf(L.agentFiles.compactSession),n=I(L.chatFork.forkChat),r=P(L.messages.getSessionMeta,{chatId:e.chatId})?.viewerRole===`participant`,[i,a]=(0,z.useState)(null),[o,s]=(0,z.useState)(null),[c,l]=(0,z.useState)(null),u=async()=>{a(`compact`),s(null);try{await t({chatId:e.chatId}),l(`compact`),s(ane())}catch(e){s(mFe(e)?Fee():s_())}finally{a(null)}},d=async()=>{if(e.messageId!==null){a(`branch`),s(null);try{let{chatId:t}=await n({branchMessageId:e.messageId});w4(t,{expand:!0}),l(`branch`),s(dee())}catch{s(s_())}finally{a(null)}}};return r?null:(0,B.jsxs)(`div`,{className:`oc-error-card__actions`,children:[(0,B.jsx)(Ov,{type:`button`,size:`sm`,variant:`outline`,disabled:i!==null||c!==null,onClick:()=>void u(),children:i===`compact`?Cp():Jm()}),e.messageId===null?null:(0,B.jsx)(Ov,{type:`button`,size:`sm`,variant:`outline`,disabled:i!==null||c===`branch`,onClick:()=>void d(),children:i===`branch`?Cp():nte()}),o===null?null:(0,B.jsx)(`p`,{className:`oc-error-card__notice`,role:`status`,children:o})]})}var L3=(0,z.createContext)(!1);function gFe({retry:e}){let[,t]=(0,z.useState)(0);(0,z.useEffect)(()=>{let e=window.setInterval(()=>t(e=>e+1),1e3);return()=>window.clearInterval(e)},[]);let n=Math.max(0,Math.ceil((e.firesAt-Date.now())/1e3));return(0,B.jsxs)(`span`,{className:`oc-error-card__retry`,role:`status`,children:[(0,B.jsx)(QS,{size:13,className:`oc-error-card__retry-spin`,"aria-hidden":!0}),n>0?Tre({attempt:String(e.attempt),max:String(e.maxAttempts),seconds:String(n)}):Kp({attempt:String(e.attempt),max:String(e.maxAttempts)})]})}function _Fe(){let e=$2(),t=U(e=>e.metadata?.custom?.status),n=U(e=>e.metadata?.custom?.runId),r=U(e=>e.metadata?.custom?.error),i=U(e=>e.metadata?.custom?.errorCode),a=U(e=>e.metadata?.custom?.autoRetry??null),o=U(e=>QTe(e.metadata?.custom?.autoRetryOutcome)),s=U(e=>e.metadata?.custom?.chatId),c=U(e=>e.metadata?.custom?.messageId??e.id),l=U(e=>N$(e.content)),u=U(e=>e.metadata?.custom?.phase),d=U(e=>e.metadata?.custom?.phaseRetry),f=U(e=>{let t=e.metadata?.custom;return t?.activeToolName??E$(t?.toolParts)?.name??null}),p=f===null?null:{name:f,family:T$(f)},m=(0,z.useContext)(L3),h=U(e=>e.metadata?.custom?.interruptedAt!=null),{byMessage:g}=C$(t===`streaming`&&s?[s]:null),_=VTe(t,l,u,p,h,d,g.get(c??``)??null),v=_?.kind===`thinking`,[y,b]=(0,z.useState)(!1);if((0,z.useEffect)(()=>{if(!v){b(!1);return}let e=window.setTimeout(()=>b(!0),6e3);return()=>window.clearTimeout(e)},[v]),!_)return null;if(_.kind===`error`){let{headline:e,detail:t,code:l}=M$(r,i);return(0,B.jsxs)(`div`,{className:`oc-error-card`,role:`alert`,title:n?`run ${n}`:void 0,children:[(0,B.jsx)(Zx,{size:18,className:`oc-error-card__icon`,"aria-hidden":!0}),(0,B.jsxs)(`div`,{className:`oc-error-card__body`,children:[(0,B.jsx)(`span`,{className:`oc-error-card__title`,children:_.label}),e?(0,B.jsx)(`span`,{className:`oc-error-card__msg`,children:e}):null,t?(0,B.jsx)(`span`,{className:e?`oc-error-card__msg oc-error-card__msg--detail`:`oc-error-card__msg`,children:t}):null,a?(0,B.jsx)(gFe,{retry:a}):o?(0,B.jsx)(`span`,{className:`oc-error-card__msg oc-error-card__msg--detail`,children:o}):null,l&&UTe.has(l)&&s?(0,B.jsx)(hFe,{chatId:s,messageId:c??null}):null]})]})}return(0,B.jsxs)(`div`,{className:`oc-run-status oc-run-status--${_.kind}${_.struggling?` oc-run-status--struggling`:``}`,role:`status`,title:n?`run ${n}`:void 0,children:[_.kind===`thinking`?(0,B.jsxs)(`span`,{className:`oc-dots`,"aria-hidden":!0,children:[(0,B.jsx)(`span`,{}),(0,B.jsx)(`span`,{}),(0,B.jsx)(`span`,{})]}):_.kind===`generating`?(0,B.jsx)(`span`,{className:`oc-run-status__pulse`,"aria-hidden":!0}):(0,B.jsx)(pC,{size:13,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:_.phased&&!m?`oc-run-status__label oc-shimmer-text`:`oc-run-status__label`,children:HTe(_.kind,m)??(_.kind===`thinking`&&y&&!_.phased?HMe(e):_.label)})]})}function R3(e,t){return Math.max(0,t-e)}function z3(e,t,n){return e+Math.max(0,n-t)}function vFe(e,t,n){return e?!0:n!==void 0&&t===n}function B3(e){return i$(e)}var V3=(0,z.createContext)(null);function yFe(e){return e!==void 0&&e.some(e=>e.status===`streaming`)}function bFe(e,t,n,r){return t===null||n===null||n<=0?!1:!(r?.chatId===e&&r.key===t)}function xFe(){let e=U(e=>e.metadata?.custom?.status),t=U(e=>e.metadata?.custom?.messageId),n=U(e=>e.metadata?.custom?.sentAt),r=vFe(e===`streaming`,(0,z.useContext)(V3)?.messageId??null,t),i=(0,z.useRef)(null);if(r&&t!==void 0&&n!==void 0&&i.current?.id!==t){let e=Date.now();i.current={id:t,baselineMs:R3(n,e),firstLocalMs:e}}let[,a]=(0,z.useState)(0);if((0,z.useEffect)(()=>{if(!r)return;let e=window.setInterval(()=>a(e=>e+1),1e3);return()=>window.clearInterval(e)},[r]),!r||i.current===null||i.current.id!==t)return null;let o=B3(z3(i.current.baselineMs,i.current.firstLocalMs,Date.now()));return o===null?null:(0,B.jsx)(`div`,{className:`oc-turn-clock`,role:`timer`,children:(0,B.jsx)(`span`,{className:`oc-turn-clock__label`,children:Wn({duration:o})})})}var SFe={read:Koe,exec:gC,search:$S,fetch:tse,write:WS,other:TC};function CFe(e){let t=U(e=>e.metadata?.custom?.status),[n,r]=(0,z.useState)(!1),{showTools:i}=e8(),a=e.args?.parts??[];if(!i||a.length===0)return null;let o=t===`streaming`&&a.some(e=>S3(e.phase)),s=SFe[DPe(a)],c=o?(0,B.jsx)(wS,{size:13,className:`oc-actrow__status-icon oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsxs)(B.Fragment,{children:[a.length>1?(0,B.jsx)(`span`,{className:`oc-flowact__count`,children:a.length}):null,(0,B.jsx)(qx,{size:13,className:`oc-actrow__status-icon`,"aria-hidden":!0})]});return(0,B.jsxs)(`div`,{className:`oc-msg__meta oc-flowact`,role:`group`,"aria-label":lg(),children:[(0,B.jsx)(JL,{icon:(0,B.jsx)(s,{size:14}),label:OPe(a,{live:o}),trailing:c,open:n,ariaExpanded:n,title:n?Sh():ua(),onClick:()=>r(!n)}),n?(0,B.jsx)(`div`,{className:`oc-toolact__detail`,children:a.map(e=>(0,B.jsx)(o$,{toolName:e.toolName,args:e.args,argsText:e.argsText,result:e.result,status:e.phase?{type:e.phase}:void 0,turnSettled:t!==void 0&&t!==`streaming`},e.toolCallId))}):null]})}function wFe(){let e=(0,z.useContext)(r8),t=YA(),n=(0,z.useRef)(null),r=e?.queuedTurns.length??0;if((0,z.useLayoutEffect)(()=>{let e=n.current,t=document.querySelector(`.oc-thread__viewport`);if(!t)return;if(!e||r===0){t.style.removeProperty(`--oc-dock-pad`);return}let i=()=>t.style.setProperty(`--oc-dock-pad`,`${e.offsetHeight}px`);i();let a=new ResizeObserver(i);return a.observe(e),()=>{a.disconnect(),t.style.removeProperty(`--oc-dock-pad`)}},[r]),e===null||r===0)return null;let{queuedTurns:i,cancelQueued:a}=e;return(0,B.jsx)(`div`,{ref:n,className:`oc-queue-dock`,role:`status`,"aria-label":yo(),children:i.map(e=>(0,B.jsxs)(`div`,{className:`oc-queue-card`,children:[(0,B.jsx)(iS,{size:16,"aria-hidden":!0,className:`oc-queue-card__icon`}),(0,B.jsx)(`span`,{className:`oc-queue-card__text`,title:e.text,children:e.text}),e.mine?(0,B.jsx)(`button`,{type:`button`,className:`oc-queue-card__btn`,title:Ot(),"aria-label":Ot(),disabled:e.pending,onClick:()=>{a(e.messageId).then(n=>{n&&t.composer.setText(e.text)})},children:(0,B.jsx)(WS,{size:15})}):null,e.canCancel?(0,B.jsx)(`button`,{type:`button`,className:`oc-queue-card__btn oc-queue-card__btn--danger`,title:Zt(),"aria-label":Zt(),disabled:e.pending,onClick:()=>void a(e.messageId),children:(0,B.jsx)(vC,{size:15})}):null]},e.messageId))})}var H3=(0,z.createContext)(!1);function TFe(){let e=U(e=>e.metadata?.custom?.toolParts),t=U(e=>e.metadata?.custom?.status),[n,r]=(0,z.useState)(!1);if(!e||e.length===0)return null;let i=n,a=_Te(e,t),o=a.running?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(wS,{size:13,className:`oc-actrow__status-icon oc-actrow__spin`,"aria-hidden":!0}),wo()]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(qx,{size:13,className:`oc-actrow__status-icon`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-sr-only`,children:Na()})]});return(0,B.jsxs)(`div`,{className:`oc-toolact`,children:[(0,B.jsx)(JL,{icon:(0,B.jsx)(TC,{size:14}),label:a.label,trailing:o,open:i,ariaExpanded:i,title:i?Sh():ua(),onClick:()=>r(!i)}),i?(0,B.jsx)(`div`,{className:`oc-toolact__detail`,children:e.map(e=>(0,B.jsx)(o$,{toolName:e.toolName,args:e.args,argsText:e.argsText,result:e.result,status:e.phase?{type:e.phase}:void 0,turnSettled:t!==void 0&&t!==`streaming`},e.toolCallId))}):null]})}function U3(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function W3(e){if(!U3(e))return null;let t=e.details;if(U3(t)&&typeof t.status==`string`)return t.status;if(typeof e.status==`string`)return e.status;for(let t of[`content`,`contentItems`]){let n=e[t];if(Array.isArray(n)){for(let e of n)if(!(!U3(e)||typeof e.text!=`string`))try{let t=JSON.parse(e.text);if(U3(t)&&typeof t.status==`string`)return t.status}catch{}}}return null}function EFe(e,t){if(e!==`completed`)return!1;let n=W3(t);return n===null||n===`yielded`}function DFe(e){return typeof e==`string`&&e.startsWith(`announce:requester-settle:`)}var OFe=/^[A-Za-z0-9_-]{1,128}$/,kFe=32;function AFe(e){if(!DFe(e))return null;let t=e.split(`:`);/^retry-\d+$/.test(t[t.length-1]??``)&&t.pop();let n=null,r=/^yield-(\d+)$/.exec(t[t.length-1]??``);r!==null&&r[1]!==void 0&&(n=Number(r[1]),t.pop());let i=(t.pop()??``).split(`,`);return t.length<4||i.length===0||i.length>kFe||!i.every(e=>OFe.test(e))?null:{childRunIds:i,yieldGeneration:n}}var jFe=18e4,MFe=3e4;function G3(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function K3(e){let t=[];for(let n of e){if(n.toolName!==`sessions_spawn`)continue;let e=n.resultDetails?.childSessionKey;if(typeof e==`string`&&e!==``){t.push(e);continue}let r=n.result;if(!G3(r))continue;let i=r.details?.childSessionKey;if(typeof i==`string`&&i!==``){t.push(i);continue}let a=Array.isArray(r.content)?r.content:Array.isArray(r.contentItems)?r.contentItems:null;if(a!==null)for(let e of a){let n=G3(e)?e.text:void 0;if(typeof n==`string`)try{let e=JSON.parse(n),r=G3(e)?e.childSessionKey:void 0;typeof r==`string`&&r!==``&&t.push(r)}catch{}}}return t}var q3=new Set([`sessions_spawn`,`delegate_task`,`mixture_of_agents`]),NFe=new Set([`accepted`,`ok`,`started`,`running`]);function PFe(e){return e.some(e=>{if(!q3.has(e.toolName))return!1;let t=W3(e.resultDetails??e.result);return t===`error`||t===`forbidden`?!1:K3([e]).length>0?!0:e.phase===`error`?!1:t===null||NFe.has(t)})}function FFe(e){return e.some(e=>q3.has(e.toolName))}function J3(e){return e.some(e=>{let t=e.result;if(typeof t!=`object`||!t)return!1;let n=t.details;if(typeof n!=`object`||!n)return!1;let r=n;return r.async===!0&&typeof r.taskId==`string`})}function Y3(e){return e?.trim()||void 0}function X3(e,t,n,r){let i=e.childRunId;return i===void 0?!1:(r??[]).includes(i)?!0:n!==void 0&&t.some(e=>e.parentMessageId===n&&e.kind!==`task`&&(e.status===`running`||e.status===`done`)&&(AFe(e.bornOfRun)?.childRunIds.includes(i)??!1))}function IFe(e,t,n,r){let i=e.filter(e=>e.status===`error`&&!X3(e,t,n,r)),a=i[0];return a===void 0?null:{task:I$(a),reason:U$(a.errorMessage,a.errorCode,a.runTimeoutSeconds),more:i.length-1}}function Z3(e,t,n,r,i=Date.now()){let a=n??[],o=e.hasText||e.hasMedia,s=t.some(e=>e.toolName===`sessions_yield`?EFe(e.phase,e.resultDetails??e.result):!1)&&(PFe(t)||J3(t));if(o&&!s||e.status!==`complete`)return{kind:`none`};let c=new Set(K3(t)),l=a.filter(e=>r!==void 0&&e.parentMessageId===r||c.has(e.childSessionKey)),u=l.find(e=>e.status===`running`);if(u)return{kind:`waiting`,taskName:Y3(u.taskName)};let d=l.filter(e=>e.kind!==`task`),f=d.find(t=>(t.status===`error`||t.status===`aborted`)&&!X3(t,a,r,e.answeredChildRunIds));if(f)return{kind:`failed`,taskName:Y3(f.taskName),reason:U$(f.errorMessage,f.errorCode,f.runTimeoutSeconds),...f.status===`aborted`&&f.stopRequestedAt===void 0?{cardSilent:!0}:{}};if(o)return{kind:`none`};let p=d.find(e=>e.status===`done`);if(p){let t=p.updatedAt+jFe;return i<t?{kind:`composing`,taskName:Y3(p.taskName),recheckAt:t}:e.delegatedInline===!0?{kind:`none`}:{kind:`done`,taskName:Y3(p.taskName),resultText:p.resultText,agentId:P$(p.childSessionKey)}}if(s&&l.length===0){if(n===void 0)return{kind:`none`};if(e.settledAt!==void 0){let t=e.settledAt+MFe;if(i<t)return{kind:`waiting`,recheckAt:t}}}return{kind:`generic`}}function LFe(e,t,n){return e===void 0||t===void 0?[]:e.filter(e=>e.parentMessageId===t&&e.kind!==`task`&&e.status===`done`&&typeof e.resultText==`string`&&e.resultText.trim()!==``&&RFe(e,n)).slice().sort((e,t)=>e.createdAt-t.createdAt).map(e=>({childSessionKey:e.childSessionKey,agentId:P$(e.childSessionKey),resultText:e.resultText}))}function RFe(e,t){if(t===void 0)return!0;let n=e.childRunId;return t.kind===`batch`?n!==void 0&&t.childRunIds.includes(n):n===void 0||!t.claimed.includes(n)}function Q3(e,t){return e===`done`?b({count:t}):e===`running`?ts({count:t}):$u({count:t})}function zFe({card:e}){let t=e.tone===`running`?wS:e.tone===`failed`?Zx:qx,n=(0,z.useContext)(W$),r=e.tools?.length??0,i=n?.activeChildKey===e.childSessionKey,a=(0,B.jsxs)(B.Fragment,{children:[r>0?(0,B.jsx)(`span`,{className:`oc-actrow__toolcount`,children:r===1?da({count:r}):Ch({count:r})}):null,(0,B.jsx)(t,{size:13,className:`oc-actrow__status-icon${e.tone===`running`?` oc-actrow__spin`:``}`,"aria-hidden":!0})]});return(0,B.jsxs)(`div`,{className:`oc-subagent oc-subagent--${e.tone}${e.moaRole===`moa_reference`?` oc-subagent--nested`:``}`,children:[(0,B.jsx)(JL,{tone:e.tone,icon:e.isTask?(0,B.jsx)(EC,{size:15}):(0,B.jsx)(Wx,{size:15}),label:e.isTask?e.label:F$(e),sublabel:e.isTask?void 0:e.taskName,trailing:a,active:i,ariaExpanded:e.isTask?void 0:i,ariaHasPopup:!e.isTask,title:e.isTask?void 0:bd(),ariaLabel:e.isTask?void 0:bd(),inert:e.isTask,onClick:()=>{e.isTask||n?.openFor(e.childSessionKey)}}),e.failure?(0,B.jsx)(`p`,{className:`oc-subagent__error`,role:`status`,children:U$(e.errorMessage,e.errorCode,e.runTimeoutSeconds)}):null]})}var BFe=[],VFe=[];function HFe(){let e=U(e=>e.metadata?.custom?.chatId),t=U(e=>{let t=e.metadata?.custom;return t?.allToolParts??t?.toolParts??BFe}),n=(0,z.useMemo)(()=>K3(t),[t]),r=(0,z.useMemo)(()=>FFe(t)||J3(t),[t]),i=U(e=>e.metadata?.custom?.messageId),a=U(e=>e.metadata?.custom?.answeredChildRunIds??VFe),o=r&&e?e:null,{can:s}=q4(o),c=P(L.subAgents.listSubAgents,o?{chatId:o}:`skip`),[l,u]=(0,z.useState)(!1);if(!r||!s(`subagents`))return null;let d=R$(c??[],n,i),f=L$(d),p=[...f.cards];if(p.length===0)return null;let m=lEe(f),h=m.length>0&&!l?IFe([...d].sort((e,t)=>t.createdAt-e.createdAt),c??[],i,a):null;return(0,B.jsxs)(`div`,{className:`oc-msg-subagents`,children:[m.length>0?(0,B.jsx)(JL,{icon:(0,B.jsx)(Wx,{size:15}),label:uEe(f.total),trailing:m.map(e=>(0,B.jsxs)(`span`,{className:`oc-subagent-badge oc-subagent-badge--${e.tone}`,title:Q3(e.tone,e.count),"aria-label":Q3(e.tone,e.count),children:[e.tone===`done`?(0,B.jsx)(qx,{size:12,"aria-hidden":!0}):e.tone===`running`?(0,B.jsx)(wS,{size:12,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsx)(Zx,{size:12,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-subagent-badge__count`,children:e.count})]},e.tone)),open:l,ariaExpanded:l,title:l?Sh():ua(),onClick:()=>u(!l)}):null,h?(0,B.jsxs)(`p`,{className:`oc-subagent__error`,role:`status`,children:[ou({task:h.task,reason:h.reason}),h.more>0?` ${ku({count:String(h.more)})}`:null]}):null,(m.length===0||l)&&p.map(e=>(0,B.jsx)(`div`,{className:`oc-msg-subagents__anchor`,"data-subagent-id":e.id,"data-subagent-failed":e.failure?``:void 0,children:(0,B.jsx)(zFe,{card:e})},e.id))]})}function $3({delayDuration:e=0,...t}){return(0,B.jsx)(_me,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function e6({...e}){return(0,B.jsx)(vme,{"data-slot":`tooltip`,...e})}function t6({...e}){return(0,B.jsx)(yme,{"data-slot":`tooltip-trigger`,...e})}function n6({className:e,sideOffset:t=0,children:n,...r}){return(0,B.jsx)(bme,{children:(0,B.jsxs)(xme,{"data-slot":`tooltip-content`,sideOffset:t,className:Wg(`z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[n,(0,B.jsx)(Sme,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`})]})})}function UFe(){return U(e=>e.metadata?.custom?.compaction??null)}function WFe(e){switch(e){case`overflow`:return rr();case`manual`:return Ae();case`heap_threshold`:case`rss_threshold`:case`pre_compaction`:case`non_manual_trigger`:return sl();case`already_active`:case`already_in_flight`:case`deferred_compaction_not_scheduled`:case`unsupported_harness_compaction`:return Kie();default:return``}}function GFe(){let e=UFe();if(!e)return null;let t=e.phase===`failed`,n=`${t?Ic():e.phase===`midturn`?Mn():wi()}${WFe(e.reason)}`;return(0,B.jsx)($3,{delayDuration:150,children:(0,B.jsxs)(e6,{children:[(0,B.jsx)(t6,{asChild:!0,children:(0,B.jsxs)(`div`,{className:`oc-compaction${t?` oc-compaction--failed`:``}`,role:`note`,"aria-label":n,children:[(0,B.jsx)(`span`,{className:`oc-compaction__rule`,"aria-hidden":!0}),(0,B.jsxs)(`span`,{className:`oc-compaction__label`,children:[(0,B.jsx)(Qoe,{size:12,"aria-hidden":!0}),t?Nl():gne()]}),(0,B.jsx)(`span`,{className:`oc-compaction__rule`,"aria-hidden":!0})]})}),(0,B.jsx)(n6,{className:`oc-compaction__tip`,children:n})]})})}function KFe(e,t){if(e===null||e<=t)return null;let n=Math.floor((e-t)/6e4);if(n<60)return`${n}m`;let r=Math.floor(n/60);if(r<24){let e=n%60;return e>0?`${r}h ${e}m`:`${r}h`}return`${Math.floor(r/24)}${en()} ${r%24}h`}function r6(e,t){if(!e||e.length===0)return null;let n=[];for(let r of e)for(let e of r.windows)n.push({provider:r.provider,label:e.label,percentLeft:Math.round(Math.min(100,Math.max(0,100-e.usedPercent))),resetText:KFe(e.resetAt,t)});if(n.length===0)return null;let r=n.reduce((e,t)=>t.percentLeft<e.percentLeft?t:e),i=r.percentLeft<=10?`is-critical`:r.percentLeft<=25?`is-warn`:`is-ok`;return{percentLeft:r.percentLeft,label:r.label,resetText:r.resetText,level:i,windows:n}}var qFe=/^(?:[a-z0-9][a-z0-9_.]{0,15}-)?[a-z0-9]{25,40}$/;function JFe(e){let t=e.trim();return qFe.test(t)?t:null}var i6=null;function a6(e,t){i6={messageId:e,terms:t}}function YFe(e){if(i6===null||i6.messageId!==e)return null;let t=i6.terms;return i6=null,t}function XFe(e){return e.readOnly?`read_only`:e.unavailable?`unavailable`:e.degraded?`degraded`:e.beyondValidated?`beyond_validated`:null}function ZFe(e){return e.turnRunning?{mode:`queue`,reason:`turn`}:e.hasRunningSubAgent?{mode:`queue`,reason:`subagent`}:{mode:`send`,reason:null}}var QFe=[`o`,`ko`,`Mo`,`Go`,`To`],$Fe=[`B`,`kB`,`MB`,`GB`,`TB`];function o6(e,t){if(!Number.isFinite(e)||e<0)return`—`;let n=t.startsWith(`fr`)?QFe:$Fe,r=e,i=0;for(;r>=1e3&&i<n.length-1;)r/=1e3,i+=1;return`${new Intl.NumberFormat(t,{maximumFractionDigits:i===0?0:1}).format(r)} ${n[i]}`}function eIe(e,t){return!Number.isFinite(e)||e<0?`—`:new Intl.NumberFormat(t).format(e)}function s6(e){return e?.trim()||null}function tIe({mimeType:e,data:t,filename:n,storageId:r}){let i=e??``,a=t??``,o=n??`attachment`;return a?i.startsWith(`audio/`)?(0,B.jsxs)(`div`,{className:`oc-media oc-media--audio`,children:[(0,B.jsx)(`audio`,{controls:!0,preload:`metadata`,src:a,className:`oc-media__audio`,children:(0,B.jsx)(`a`,{href:a,download:o,children:Uf()})}),(0,B.jsx)(`span`,{className:`oc-media__name`,children:o})]}):i.startsWith(`image/`)?(0,B.jsx)(iIe,{url:a,name:o}):i.startsWith(`video/`)?(0,B.jsxs)(`div`,{className:`oc-media oc-media--video`,children:[(0,B.jsx)(`video`,{controls:!0,preload:`metadata`,src:a,className:`oc-media__video`}),(0,B.jsx)(`span`,{className:`oc-media__name`,children:o})]}):(0,B.jsx)(nIe,{url:a,name:o,mime:i,storageId:r}):null}function nIe({url:e,name:t,mime:n,storageId:r}){let i=PQ(),a=SQ(n,t)!==`none`,o=!!r&&bQ(n,t),s=a||o,c=n=>{n.metaKey||n.ctrlKey||n.shiftKey||n.altKey||n.button!==0||(n.preventDefault(),(async()=>{try{let n=await fetch(e);if(!n.ok)throw Error(`HTTP ${n.status}`);let r=URL.createObjectURL(await n.blob()),i=document.createElement(`a`);i.href=r,i.download=t,document.body.appendChild(i),i.click(),i.remove(),setTimeout(()=>URL.revokeObjectURL(r),3e4)}catch{let t=window.open(``,`_blank`);t?(t.opener=null,t.location.href=e):window.location.href=e}})())};return(0,B.jsxs)(`span`,{className:`oc-media oc-media--file oc-filechip`,title:t,children:[(0,B.jsxs)(`a`,{className:`oc-filechip__main`,href:e,target:`_blank`,rel:`noopener noreferrer`,onClick:c,"aria-label":c_({name:t}),children:[(0,B.jsx)(`span`,{className:`oc-media__icon`,"aria-hidden":!0,children:`📄`}),(0,B.jsx)(`span`,{className:`oc-media__name`,children:t})]}),(0,B.jsx)(`a`,{className:`oc-filechip__btn`,href:e,target:`_blank`,rel:`noopener noreferrer`,onClick:c,title:c_({name:t}),"aria-label":c_({name:t}),children:(0,B.jsx)(oS,{size:14,"aria-hidden":!0})}),s?(0,B.jsx)(`button`,{type:`button`,className:`oc-filechip__btn`,onClick:()=>i.openFor({url:e,filename:t,mimeType:n||null,storageId:r,sourceStorageId:o?r:void 0}),title:Xg({name:t}),"aria-label":Xg({name:t}),children:(0,B.jsx)(Goe,{size:14,"aria-hidden":!0})}):null,r?(0,B.jsx)(rIe,{storageId:r,name:t}):null]})}function rIe({storageId:e,name:t}){let[n,r]=(0,z.useState)(!1),i=U(e=>e.id),a=P(L.files.metadata,n&&i?{storageId:e,messageId:i}:`skip`),o=Nm();return(0,B.jsxs)(AI,{open:n,onOpenChange:r,children:[(0,B.jsx)(jI,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,className:`oc-filechip__btn`,title:vg({name:t}),"aria-label":vg({name:t}),children:(0,B.jsx)(ase,{size:14,"aria-hidden":!0})})}),(0,B.jsxs)(MI,{side:`top`,align:`end`,className:`oc-filemeta`,children:[(0,B.jsx)(`div`,{className:`oc-filemeta__title`,children:tp()}),a===void 0?(0,B.jsx)(`div`,{className:`oc-filemeta__note`,children:$l()}):a===null?(0,B.jsx)(`div`,{className:`oc-filemeta__note`,children:qu()}):(0,B.jsxs)(`dl`,{className:`oc-filemeta__rows`,children:[(0,B.jsx)(c6,{label:lre(),value:D3(a.filename)??a.filename}),(0,B.jsx)(c6,{label:Hte(),value:a.contentType??Yo()}),(0,B.jsx)(c6,{label:sf(),value:`${o6(a.bytes,o)} (${yh({count:eIe(a.bytes,o)})})`}),(0,B.jsx)(c6,{label:bte(),value:a.direction===`inbound`?Ere():qp()}),(0,B.jsx)(c6,{label:m(),value:new Intl.DateTimeFormat(o,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(a.createdAt))}),s6(a.sha256)?(0,B.jsxs)(`div`,{className:`oc-filemeta__row oc-filemeta__row--digest`,children:[(0,B.jsx)(`dt`,{children:Wne()}),(0,B.jsxs)(`dd`,{children:[(0,B.jsx)(`code`,{className:`oc-filemeta__digest`,children:s6(a.sha256)}),(0,B.jsx)(`button`,{type:`button`,className:`oc-filemeta__copy`,title:Su(),"aria-label":Su(),onClick:()=>{navigator.clipboard?.writeText(s6(a.sha256)??``)},children:(0,B.jsx)(rS,{size:12,"aria-hidden":!0})})]})]}):null]})]})]})}function c6({label:e,value:t}){return(0,B.jsxs)(`div`,{className:`oc-filemeta__row`,children:[(0,B.jsx)(`dt`,{children:e}),(0,B.jsx)(`dd`,{children:t})]})}function iIe({url:e,name:t}){let{open:n}=$we();return(0,B.jsx)(`button`,{type:`button`,className:`oc-media oc-media--thumb`,onClick:()=>n({url:e,name:t}),title:t,"aria-label":t,children:(0,B.jsx)(`img`,{src:e,alt:t,className:`oc-media__thumbimg`,loading:`lazy`,decoding:`async`})})}var l6=1e3;function aIe(){return[{id:`incorrect`,label:Ht()},{id:`incoherence`,label:_c()},{id:`altered_words`,label:O_()},{id:`formatting`,label:Qe()},{id:`latency`,label:qs()},{id:`api_error`,label:fie()},{id:`other`,label:bf()}]}function oIe(){return[{id:`altered_words`,label:Aie()},{id:`formatting`,label:m_()},{id:`other`,label:bf()}]}function sIe(e){return e===`user`?oIe():aIe()}var cIe=[{name:`Grammarly`,selector:`grammarly-desktop-integration, grammarly-extension, [data-grammarly-shadow-root]`},{name:`LanguageTool`,selector:`[data-lt-installed], .lt-toolbar`},{name:`DeepL`,selector:`deepl-inline-translate, .deepl-translator`},{name:`ProWritingAad`,selector:`pwa-shadow-host, .pwa-tag`}];function lIe(){let e=[];try{e=Array.from(navigator.plugins??[]).map(e=>e.name).slice(0,40)}catch{e=[]}let t=[];for(let{name:e,selector:n}of cIe)try{document.querySelector(n)&&t.push(e)}catch{}return{plugins:e,extensionsDetected:t}}var u6=z.createContext(null);function uIe(){let e=z.useContext(u6);if(!e)throw Error(`useFeedback must be used within <FeedbackProvider>`);return e}function dIe({children:e}){let t=I(L.feedback.submitFeedback),[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(!1),[u,d]=(0,z.useState)(null),[f,p]=(0,z.useState)(null),[m,h]=(0,z.useState)(!1),g=z.useCallback(e=>{a(``),s(``),l(!1),d(null),p(null),h(!1),r(e)},[]);function _(e){e||r(null)}async function v(){if(!(!n||!i||c)){l(!0);try{let e=await t({chatId:n.chatId,messageId:n.messageId,category:i,comment:o.trim()||void 0,client:{displayedText:n.displayedText,sourceWasOpen:n.sourceWasOpen,userAgent:navigator.userAgent,language:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,theme:document.documentElement.classList.contains(`dark`)?`dark`:`light`,...lIe()}});d(e.displayedMatchesStored),p(String(e.reference??e.feedbackId))}catch{l(!1)}}}let y=u!==null,b=n?.role===`user`;return(0,B.jsxs)(u6.Provider,{value:g,children:[e,(0,B.jsx)(s$,{open:n!==null,onOpenChange:_,children:n?(0,B.jsxs)(c$,{className:`sm:max-w-md`,children:[(0,B.jsxs)(l$,{children:[(0,B.jsx)(d$,{children:Cd()}),(0,B.jsx)(f$,{children:y?hm():b?Bm():Jee()})]}),y?(0,B.jsxs)(`div`,{className:`oc-feedback__result`,role:`status`,children:[n.sourceWasOpen?u===!0?(0,B.jsx)(`p`,{className:`oc-feedback__fidelity is-ok`,children:ene()}):(0,B.jsx)(`p`,{className:`oc-feedback__fidelity is-warn`,children:aee()}):(0,B.jsx)(`p`,{className:`oc-feedback__fidelity`,children:gp()}),f?(0,B.jsxs)(`div`,{className:`oc-feedback__ref`,children:[(0,B.jsx)(`span`,{className:`oc-feedback__ref-label`,children:ha()}),(0,B.jsx)(`code`,{className:`oc-feedback__ref-id`,title:f,children:f}),(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn`,title:kh(),"aria-label":kh(),onClick:()=>{navigator.clipboard.writeText(f).then(()=>{h(!0),window.setTimeout(()=>h(!1),1500)})},children:m?(0,B.jsx)(qx,{size:14}):(0,B.jsx)(rS,{size:14})})]}):null]}):(0,B.jsxs)(`div`,{className:`oc-feedback__form`,children:[(0,B.jsx)(`label`,{className:`oc-feedback__label`,children:zre()}),(0,B.jsxs)(p$,{value:i,onValueChange:a,children:[(0,B.jsx)(h$,{children:(0,B.jsx)(m$,{placeholder:Aee()})}),(0,B.jsx)(g$,{children:sIe(n.role).map(e=>(0,B.jsx)(_$,{value:e.id,children:e.label},e.id))})]}),(0,B.jsx)(`label`,{className:`oc-feedback__label`,htmlFor:`oc-feedback-comment`,children:qf()}),(0,B.jsx)(`textarea`,{id:`oc-feedback-comment`,className:`oc-feedback__textarea`,placeholder:rre(),value:o,maxLength:l6,onChange:e=>s(e.target.value.slice(0,l6)),rows:4}),(0,B.jsxs)(`div`,{className:`oc-feedback__count`,children:[o.length,`/`,l6]})]}),(0,B.jsx)(u$,{children:y?(0,B.jsx)(Ov,{onClick:()=>_(!1),children:Pte()}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ov,{variant:`outline`,onClick:()=>_(!1),children:Zd()}),(0,B.jsx)(Ov,{onClick:()=>void v(),disabled:!i||c,children:c?uh():Ine()})]})})]}):null})]})}function fIe(e,t){let n=e.closest(`.oc-msg`)?.querySelector(`.oc-msg__source-pre`),r=n?.textContent;return n&&r!=null&&r!==`(aucun texte)`?{displayedText:r,sourceWasOpen:!0}:{displayedText:t,sourceWasOpen:!1}}function d6(){let e=uIe(),t=U(e=>e.metadata?.custom?.messageId),n=U(e=>e.metadata?.custom?.chatId),r=U(e=>e.role),i=U(e=>e.metadata?.custom?.rawText??``),a=P(L.feedback.myReportedMessageIds,n?{chatId:n}:`skip`);if(!t||!n)return null;let o=(a??[]).includes(t);function s(a){e({chatId:n,messageId:t,role:r,...fIe(a.currentTarget,i)})}return(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn${o?` is-on`:``}`,title:o?pte():yre(),"aria-label":Rp(),onClick:s,children:(0,B.jsx)(pS,{size:15,"aria-hidden":!0})})}function f6(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function p6({label:e,state:t,destructive:n,disabled:r,disabledHint:i,onClick:a,onRetry:o}){return(0,B.jsxs)(`div`,{className:`oc-spanel__action`,children:[(0,B.jsxs)(Ov,{variant:n?`destructive`:`outline`,size:`sm`,disabled:t===`pending`||r===!0,onClick:a,children:[t===`pending`?(0,B.jsx)(wS,{className:`oc-spanel__spin`,"aria-hidden":!0}):null,e]}),t===`done`?(0,B.jsx)(`p`,{className:`oc-spanel__action-note`,role:`status`,children:xs()}):null,t===`error`?(0,B.jsxs)(`p`,{className:`oc-spanel__error`,role:`alert`,children:[Gi(),(0,B.jsx)(`button`,{type:`button`,className:`oc-spanel__retry`,onClick:o,children:Q_()})]}):null,r===!0&&i?(0,B.jsx)(`p`,{className:`oc-spanel__hint`,children:i}):null]})}function pIe({chatId:e,open:t,onOpenChange:n}){let r=P(L.messages.getSessionMeta,t?{chatId:e}:`skip`),i=P(L.chatSummaries.getChatSummary,t?{chatId:e}:`skip`),a=P(L.agents.getChatAgent,t?{chatId:e}:`skip`),o=(P(L.messages.getStreamingText,t?{chatId:e}:`skip`)?.length??0)>0,s=r?.sessionMeta??null,c=r?.sessionSettings??null,{can:l}=q4(t?e:null),u=v4(),d=mf(L.agentFiles.compactSession),f=I(L.chats.resetSession),p=I(L.chatSummaries.requestSummarize),[m,h]=(0,z.useState)(`idle`),[g,_]=(0,z.useState)(`idle`),[v,y]=(0,z.useState)(`idle`),[b,x]=(0,z.useState)(null),[S,C]=(0,z.useState)(null),[w,T]=(0,z.useState)(!1),[E,D]=(0,z.useState)(!1),[O,k]=(0,z.useState)(null),[ee,A]=(0,z.useState)(`idle`),j=I(L.chatSummaries.updateSummary);(0,z.useEffect)(()=>{k(null),A(`idle`),D(!1),T(!1),x(null),y(`idle`),C(null),_(`idle`)},[e]);async function te(){if(i?.summary)try{await navigator.clipboard.writeText(i.summary),T(!0),window.setTimeout(()=>T(!1),2e3)}catch{}}async function ne(){if(!(O===null||O.trim().length===0)){A(`saving`);try{await j({chatId:e,summary:O}),k(null),A(`idle`)}catch{A(`error`)}}}let[M,N]=(0,z.useState)(()=>Date.now()),re=i?.jobInFlight===!0;(0,z.useEffect)(()=>{if(!re)return;let e=window.setInterval(()=>N(Date.now()),1e3);return()=>window.clearInterval(e)},[re]);async function ie(){h(`pending`);try{await d({chatId:e}),h(`done`)}catch{h(`error`)}}async function ae(){y(`pending`),x(null);try{let{outcome:t}=await p({chatId:e});x(({dispatched:po,in_flight:St,nothing_to_do:Gt,scanning:jee,bridge_outdated:Vp,engine_off:yc,no_agent:A_,backoff:Gt}[t]??Gt)()),y(t===`dispatched`||t===`scanning`?`done`:`idle`)}catch{y(`error`)}}async function oe(){_(`pending`),C(null);try{let t=await f({chatId:e});if(t!==void 0&&t.ok===!1){_(`idle`),C($_());return}_(`done`)}catch{_(`error`)}}async function se(){await u({title:xi(),description:kn(),confirmLabel:Al(),cancelLabel:b_()})&&await ie()}async function ce(){await u({title:er(),description:il(),confirmLabel:De(),cancelLabel:b_(),destructive:!0})&&await oe()}let le=H4(s),de=W4(s),fe=G4(le??void 0,de??void 0),pe=fe==null?``:fe>=90?`is-critical`:fe>=75?`is-warn`:`is-ok`,me=NNe(le??void 0,de??void 0),he=jNe(s),ge=FNe(s?.estimatedCostUsd,s?.totalTokens),_e=a?.agent??null,ve=INe([_e?_e.displayName??_e.agentId:null,s?.agentRuntime,s?.model]);return(0,B.jsx)(D4,{open:t,onOpenChange:n,children:(0,B.jsxs)(O4,{side:`right`,className:`oc-spanel`,children:[(0,B.jsxs)(k4,{children:[(0,B.jsx)(j4,{children:uee()}),(0,B.jsx)(M4,{children:Sp()})]}),(0,B.jsx)(`div`,{className:`oc-spanel__body`,children:r===void 0?(0,B.jsx)(`p`,{className:`oc-spanel__loading`,children:Ng()}):(0,B.jsxs)(B.Fragment,{children:[s?(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`oc-spanel__cat`,children:Ure()}),(0,B.jsx)(X4,{chatId:e,sm:s,settings:c})]}):null,(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`oc-spanel__cat`,children:Pee()}),me!==null&&fe!==null?(0,B.jsxs)(`div`,{className:`oc-spanel__static`,children:[(0,B.jsx)(`span`,{className:`oc-spanel__label`,children:_h()}),(0,B.jsxs)(`span`,{className:`oc-meter oc-spanel__meter ${pe}`,children:[(0,B.jsx)(`span`,{className:`oc-meter__track`,children:(0,B.jsx)(`span`,{className:`oc-meter__fill`,style:{width:`${Math.min(fe,100)}%`}})}),(0,B.jsx)(`span`,{className:`oc-meter__label`,children:me})]})]}):null,he===null?null:(0,B.jsx)(`p`,{className:`oc-spanel__help oc-spanel__help--warn`,children:he===`compaction_failed`?vte():Hne()}),(0,B.jsxs)(`div`,{className:`oc-spanel__static`,children:[(0,B.jsx)(`span`,{className:`oc-spanel__label`,children:Gp()}),(0,B.jsx)(`span`,{className:`oc-spanel__value`,children:PNe(s?.verboseLevel)}),(0,B.jsx)(`p`,{className:`oc-spanel__help`,children:$o()})]}),ge===null?null:(0,B.jsxs)(`div`,{className:`oc-spanel__static`,children:[(0,B.jsx)(`span`,{className:`oc-spanel__label`,children:Zu()}),(0,B.jsx)(`span`,{className:`oc-spanel__value`,children:ge})]})]}),ve!==null||s?(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`oc-spanel__cat`,children:Bte()}),(0,B.jsxs)(`dl`,{className:`oc-spanel__kv`,children:[_e?(0,B.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,B.jsx)(`dt`,{children:ws()}),(0,B.jsxs)(`dd`,{children:[_e.emoji?`${_e.emoji} `:``,_e.displayName??_e.agentId]})]}):null,_e?.instanceName?(0,B.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,B.jsx)(`dt`,{children:$f()}),(0,B.jsx)(`dd`,{children:_e.instanceName})]}):null,s?.model?(0,B.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,B.jsx)(`dt`,{children:Kg()}),(0,B.jsx)(`dd`,{children:s.model})]}):null,s?.modelProvider?(0,B.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,B.jsx)(`dt`,{children:Cg()}),(0,B.jsx)(`dd`,{children:s.modelProvider})]}):null,s?.agentRuntime?(0,B.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,B.jsx)(`dt`,{children:je()}),(0,B.jsx)(`dd`,{children:s.agentRuntime})]}):null,s?.thinkingLevel?(0,B.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,B.jsx)(`dt`,{children:t_()}),(0,B.jsx)(`dd`,{children:s.thinkingLevel})]}):null,s?.thinkingDefault?(0,B.jsxs)(`div`,{className:`oc-spanel__kv-row`,children:[(0,B.jsx)(`dt`,{children:sre()}),(0,B.jsx)(`dd`,{children:s.thinkingDefault})]}):null]})]}):null,(0,B.jsxs)(`section`,{children:[(0,B.jsx)(`h3`,{className:`oc-spanel__cat`,children:Wa()}),i?(0,B.jsxs)(`div`,{className:`oc-spanel__static`,children:[(0,B.jsx)(`span`,{className:`oc-spanel__label`,children:Xs()}),(0,B.jsxs)(`span`,{className:`oc-meter oc-spanel__meter is-ok`,children:[(0,B.jsx)(`span`,{className:`oc-meter__track`,children:(0,B.jsx)(`span`,{className:`oc-meter__fill`,style:{width:`${Math.min(i.pendingChars/Math.max(i.thresholdChars,1)*100,100)}%`}})}),(0,B.jsx)(`span`,{className:`oc-meter__label`,children:pie({pending:`${f6(i.pendingChars)}${i.pendingApprox?`+`:``}`,threshold:f6(i.thresholdChars)})})]})]}):null,i&&!i.jobInFlight&&i.pendingChars>=i.thresholdChars?(0,B.jsx)(`p`,{className:`oc-spanel__hint`,children:Cf()}):null,i?.jobInFlight?(0,B.jsxs)(`p`,{className:`oc-spanel__hint oc-spanel__job`,role:`status`,children:[(0,B.jsx)(wS,{size:13,className:`oc-spanel__job-spin`,"aria-hidden":!0}),i.jobStreaming?ire():Yf(),i.jobStartedAt?` · ${Math.max(0,Math.round((M-i.jobStartedAt)/1e3))} s`:``]}):null,i&&i.summary.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`p`,{className:`oc-spanel__hint`,children:[xa({count:String(i.coveredCount),date:n$(i.updatedAt,{dateStyle:`short`,timeStyle:`short`})}),i.lastAgentId?` ${tt({agent:i.lastInstanceName?`${i.lastAgentId} (${i.lastInstanceName})`:i.lastAgentId})}`:``]}),i.failureCount>0?(0,B.jsx)(`p`,{className:`oc-spanel__hint oc-spanel__hint--warn`,children:Ph({count:String(i.failureCount)})}):null,(0,B.jsxs)(`div`,{className:`oc-spanel__summary-tools`,children:[(0,B.jsx)(Ov,{variant:`ghost`,size:`sm`,className:`oc-spanel__summary-tool`,onClick:()=>void te(),title:Ag(),"aria-label":Ag(),children:w?(0,B.jsx)(qx,{size:14,"aria-hidden":!0}):(0,B.jsx)(rS,{size:14,"aria-hidden":!0})}),(0,B.jsx)(Ov,{variant:`ghost`,size:`sm`,className:`oc-spanel__summary-tool`,onClick:()=>D(!0),title:ef(),"aria-label":ef(),children:(0,B.jsx)(OS,{size:14,"aria-hidden":!0})}),i.jobInFlight?null:(0,B.jsx)(Ov,{variant:`ghost`,size:`sm`,className:`oc-spanel__summary-tool`,onClick:()=>{k(i.summary),D(!0)},title:ph(),"aria-label":ph(),children:(0,B.jsx)(WS,{size:14,"aria-hidden":!0})})]}),(0,B.jsx)(`div`,{className:`oc-spanel__summary`,children:i.summary})]}):i&&i.failureCount>0?(0,B.jsx)(`p`,{className:`oc-spanel__hint oc-spanel__hint--warn`,children:Ph({count:String(i.failureCount)})}):i?.jobInFlight?null:(0,B.jsx)(`p`,{className:`oc-spanel__hint`,children:ue()})]})]})}),(0,B.jsx)(s$,{open:E,onOpenChange:e=>{D(e),e||(k(null),A(`idle`))},children:(0,B.jsxs)(c$,{className:`oc-summary-dialog`,children:[(0,B.jsxs)(l$,{children:[(0,B.jsx)(d$,{children:Wa()}),(0,B.jsx)(f$,{children:O===null?i&&i.summary.length>0?xa({count:String(i.coveredCount),date:n$(i.updatedAt,{dateStyle:`short`,timeStyle:`short`})}):``:bre()})]}),O===null?(0,B.jsx)(`div`,{className:`oc-summary-dialog__body`,children:i?.summary??``}):(0,B.jsx)(`textarea`,{className:`oc-summary-dialog__body oc-summary-dialog__edit`,value:O,onChange:e=>k(e.target.value)}),ee===`error`?(0,B.jsx)(`p`,{className:`oc-spanel__hint oc-spanel__hint--warn`,children:mte()}):null,(0,B.jsx)(`div`,{className:`oc-summary-dialog__actions`,children:O===null?(0,B.jsxs)(B.Fragment,{children:[i&&i.summary.length>0&&!i.jobInFlight?(0,B.jsxs)(Ov,{variant:`outline`,size:`sm`,onClick:()=>k(i.summary),children:[(0,B.jsx)(WS,{size:14,"aria-hidden":!0}),ph()]}):null,(0,B.jsxs)(Ov,{variant:`outline`,size:`sm`,onClick:()=>void te(),children:[w?(0,B.jsx)(qx,{size:14,"aria-hidden":!0}):(0,B.jsx)(rS,{size:14,"aria-hidden":!0}),Ag()]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ov,{variant:`ghost`,size:`sm`,onClick:()=>{k(null),A(`idle`)},children:b_()}),(0,B.jsx)(Ov,{size:`sm`,disabled:O.trim().length===0||ee===`saving`,onClick:()=>void ne(),children:ee===`saving`?K_():Rne()})]})})]})}),(0,B.jsxs)(A4,{className:`oc-spanel__actions`,children:[(0,B.jsx)(`h3`,{className:`oc-spanel__cat`,children:af()}),l(`sessionCompact`)?(0,B.jsx)(p6,{label:hne(),state:m,onClick:()=>void se(),onRetry:()=>void ie()}):null,(0,B.jsx)(p6,{label:rg(),state:re?`pending`:v,onClick:()=>void ae(),onRetry:()=>void ae()}),b===null?null:(0,B.jsx)(`p`,{className:`oc-spanel__hint`,children:b}),(0,B.jsx)(p6,{label:Nc(),state:g,destructive:!0,disabled:o,disabledHint:$_(),onClick:()=>void ce(),onRetry:()=>void oe()}),!o&&S!==null?(0,B.jsx)(`p`,{className:`oc-spanel__hint`,children:S}):null]})]})})}function mIe(e){let t=null;for(let n of e)(t===null||n.createdAt>=t.createdAt)&&(t=n);return t===null?{kind:`bottom`}:{kind:`bookmark`,messageId:t.messageId,blockIndex:t.blockIndex}}var hIe=class{last=-1;stable=0;observe(e){return e===this.last?(this.stable+=1,this.stable>=3):(this.last=e,this.stable=0,!1)}};function gIe(e){if(e.kind===`bottom`)return Math.max(0,e.scrollHeight-e.clientHeight);if(e.anchorDelta===void 0)return null;let t=Math.max(24,e.clientHeight*.3);return Math.max(0,e.scrollTop+e.anchorDelta-t)}function _Ie(e,t,n=()=>performance.now()){let r=n(),i=new hIe,a=0,o=!1,s=()=>{o||(o=!0,a&&cancelAnimationFrame(a),a=0,e.removeAttribute(`data-oc-landing`))},c=()=>{if(t.kind!==`bookmark`)return;let n=e.querySelector(`[data-message-id="${CSS.escape(t.messageId)}"]`);if(n)return(t.blockIndex===null?n:n.querySelector(`[data-block-index="${t.blockIndex}"]`)??n).getBoundingClientRect().top-e.getBoundingClientRect().top},l=()=>{if(o)return;let u=gIe({kind:t.kind,scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,anchorDelta:c()});if(u!==null&&(e.scrollTop=u),u!==null&&i.observe(e.scrollHeight)||n()-r>=1200){s();return}a=requestAnimationFrame(l)};return a=requestAnimationFrame(l),s}function vIe(e){let t=lL()?.rows;(0,z.useEffect)(()=>{if(!e.ready||e.focusMessageId)return;let n=document.querySelector(`.oc-thread__viewport`);if(!n)return;n.setAttribute(`data-oc-landing`,``);let r=_Ie(n,mIe(t??[]));return()=>{r()}},[e.chatId,e.ready,e.focusMessageId])}var yIe=[`read-only`,`guarded`,`workspace`,`full`],bIe=[`admin`,`owner`,`member`,`viewer`];function m6(e){return typeof e==`string`&&yIe.includes(e)}function xIe(e){return typeof e==`string`&&bIe.includes(e)}function SIe(e){switch(e){case`admin`:return Qc();case`owner`:return xe();case`member`:return Bie();case`viewer`:return gs()}}function CIe(e){let t=e?.visibility;if(t!==`read-only`&&t!==`suggest`&&t!==`draft`)return null;let n=e?.sharingRole,r=xIe(n)?n:null,[i,a]=t===`read-only`?[Br(),Sn()]:t===`suggest`?[lne(),Cl()]:[fi(),Oc()],o=[a];return r!==null&&o.push(Jn({role:SIe(r)})),{visibility:t,role:r,label:i,title:o.join(`
|
|
435
|
+
`)}}var wIe=`https://docs.openclaw.ai/gateway/permission-modes`,h6=[`default`,`read-only`,`guarded`,`workspace`,`full`];function TIe(e){return typeof e==`string`&&h6.includes(e)}function g6(e){switch(e){case`read-only`:return`ellipsis`;case`guarded`:return`lock`;case`workspace`:return`cog`;case`full`:return`alert`;default:return`check`}}function _6(e){switch(e){case`read-only`:return qh();case`guarded`:return pt();case`workspace`:return lc();case`full`:return qe()}}function EIe(e){switch(e){case`read-only`:return no();case`guarded`:return Ft();case`workspace`:return oie();case`full`:return Vs()}}function v6(e,t){return e==="default"?t===null?fa():Th({mode:_6(t)}):_6(e)}function DIe(e){switch(e){case`scope_refused`:return wee();case`active_run`:return Bf();case`unsupported_gateway`:return Qne();case`full_not_authorized`:return Ote();case`session_not_established`:return Ud();case`bridge_unreachable`:return ah();case`no_agent`:return Mne();case`not_managed`:return Wu();case`reapply_exhausted`:return Xl();default:return Sg()}}function OIe(e){let t=m6(e.agentDefault)?e.agentDefault:null,n=m6(e.sessionMode)?e.sessionMode:`default`,r=e.managed?e.choice??`default`:n,i=v6(r,t),a=r===`full`||r==="default"&&t===`full`,o=e.viewerRole===`owner`,s=e.viewerRole===void 0||e.target===`hermes`&&!e.multiAgent&&e.choice===null||e.target===`unknown`&&e.choice===null&&!m6(e.sessionMode)&&e.sessionMode!==null,c=e.choice!==null&&e.apply!==null&&e.apply.mode===e.choice&&e.apply.status===`pending`||e.sessionModePending,l=null;e.anyManaged?o?e.target===`unknown`?l=Mm():e.target===`unsupported`?l=sm():e.target===`hermes`&&!e.multiAgent&&(l=Yre()):l=wie():l=u();let d=l!==null,f=h6.map((n,i)=>{let a=n===`full`&&!e.viewerIsAdmin;return{value:n,label:v6(n,t),description:n==="default"?re():EIe(n),icon:g6(n),shortcut:i+1,selected:n===r,disabled:d||c||a,disabledReason:a?pf():null}}),p=null,m=!1;o&&e.choice===`full`&&!e.viewerIsAdmin?(p=hre(),m=!0):e.choice!==null&&e.apply!==null&&e.apply.mode===e.choice&&(e.apply.status===`failed`?(p=a_({reason:DIe(e.apply.reason)}),m=!0):e.apply.status===`deferred`?p=tm():e.apply.status===`applied`&&e.apply.reason===`saved_not_applied`&&(p=lp()));let h=[`${an()}: ${i}`];h.push(l??Eo()),e.multiAgent&&h.push(Vee()),e.target===`hermes`&&e.multiAgent&&h.push(_d()),e.anyManaged&&!e.managed&&e.target!==`hermes`&&h.push(Go()),a&&h.push(Np()),c&&h.push(Mg()),p!==null&&h.push(p),e.sessionRoot&&h.push(yu({root:e.sessionRoot}));let g=c?Mg():e.target===`hermes`&&e.multiAgent?_d():e.anyManaged&&!e.managed&&e.target!==`hermes`?Go():null;return{hidden:s,current:r,label:i,icon:g6(r),alert:a,pending:c,locked:d,lockReason:l,note:g,status:p,statusIsError:m,title:h.join(`
|
|
436
|
+
`),ariaLabel:cie({label:an(),mode:i}),items:f}}function kIe(e,t){if(!/^[1-5]$/.test(e))return null;let n=t.find(t=>t.shortcut===Number(e));return n&&!n.disabled?n.value:null}function AIe(e,t,n){let r=t.items.find(t=>t.value===e);return!r||r.disabled?!1:e!==n}function jIe({size:e=14}){return(0,B.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:e,height:e,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:[(0,B.jsx)(`path`,{d:`M20 9.807V6a1 1 0 0 0-1-1c-2 0-4.49-1.19-6.24-2.72a1.17 1.17 0 0 0-1.52 0C9.5 3.8 7 5 5 5a1 1 0 0 0-1 1v7c0 3.88 2.107 6.254 5 7.796`}),(0,B.jsx)(`path`,{d:`M19 17v-2a2 2 0 0 0-4 0v2`}),(0,B.jsx)(`rect`,{x:`13`,y:`17`,width:`8`,height:`5`,rx:`1`})]})}function y6({icon:e,size:t=14}){switch(e){case`ellipsis`:return(0,B.jsx)(sC,{size:t,"aria-hidden":!0});case`lock`:return(0,B.jsx)(jIe,{size:t});case`cog`:return(0,B.jsx)(cC,{size:t,"aria-hidden":!0});case`alert`:return(0,B.jsx)(aC,{size:t,"aria-hidden":!0});default:return(0,B.jsx)(oC,{size:t,"aria-hidden":!0})}}function b6(e,t,n){let r=P(L.permissionMode.permissionControl,{chatId:e,...t?{routedAgent:t}:{}}),i=P(L.messages.getSessionMeta,{chatId:e}),a=q4(e,t),o=I(L.permissionMode.setPermissionMode),s=EL(),c=(0,z.useCallback)(t=>{o({chatId:e,mode:t}).catch(e=>{s.error(a_({reason:Sg()}),e)})},[e,o,s]);if(r==null)return null;let l=a.loading||!a.resolved?`unknown`:a.provider===`hermes`?`hermes`:a.can(`permissionModes`)?`openclaw`:`unsupported`,u=i?.sessionMeta??null,d=TIe(r.choice)?r.choice:null,f=OIe({viewerRole:r.viewerRole,viewerIsAdmin:r.viewerIsAdmin,choice:d,apply:r.apply,sessionMode:u?.permissionMode,sessionModePending:u?.permissionModePending===!0,sessionRoot:typeof u?.sessionRoot==`string`?u.sessionRoot:null,agentDefault:r.agentDefault,target:l,multiAgent:n,managed:r.managed,anyManaged:r.anyManaged});return{view:f,choice:d,pick:e=>{AIe(e,f,d)&&c(e)}}}function x6({item:e}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`oc-perm__opt-icon`,"aria-hidden":!0,children:(0,B.jsx)(y6,{icon:e.icon})}),(0,B.jsxs)(`span`,{className:`oc-perm__opt-copy`,children:[(0,B.jsx)(`span`,{className:`oc-perm__opt-title`,children:e.label}),(0,B.jsx)(`span`,{className:`oc-perm__opt-desc`,children:e.description}),e.disabledReason===null?null:(0,B.jsx)(`span`,{className:`oc-perm__opt-reason`,children:e.disabledReason})]}),(0,B.jsx)(`span`,{className:`oc-perm__opt-state`,"aria-hidden":!0,children:e.selected&&e.disabledReason===null?(0,B.jsx)(qx,{size:14}):e.disabledReason===null?(0,B.jsx)(`span`,{className:`oc-perm__shortcut`,children:e.shortcut}):(0,B.jsx)(ES,{size:13})})]})}function S6(){return(0,B.jsxs)(`div`,{className:`oc-perm__heading`,children:[(0,B.jsx)(`span`,{children:an()}),(0,B.jsx)(`a`,{className:`oc-perm__learn`,href:wIe,target:`_blank`,rel:`noopener noreferrer`,children:Fa()})]})}function MIe({chatId:e,routedAgent:t,multiAgent:n}){let r=b6(e,t,n),[i,a]=(0,z.useState)(!1);if(r===null||r.view.hidden)return null;let{view:o,pick:s}=r;return(0,B.jsxs)(NI,{open:i,onOpenChange:a,children:[(0,B.jsx)(PI,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-composer__perm${o.alert?` is-alert`:``}${o.pending?` is-pending`:``}${r.choice===null?` is-default`:``}`,title:o.title,"aria-label":o.ariaLabel,"data-permission-mode":o.current,children:[(0,B.jsx)(y6,{icon:o.icon,size:15}),(0,B.jsx)(`span`,{className:`oc-composer__perm-label`,children:o.label}),(0,B.jsx)(cv,{size:13,"aria-hidden":!0,className:`oc-composer__perm-chev`})]})}),(0,B.jsxs)(FI,{align:`start`,side:`top`,className:`oc-perm__menu w-80`,onKeyDown:e=>{let t=kIe(e.key,o.items);t!==null&&(e.preventDefault(),e.stopPropagation(),s(t),a(!1))},children:[(0,B.jsx)(S6,{}),o.items.map(e=>(0,B.jsx)(II,{className:`oc-perm__opt${e.selected?` is-selected`:``}${e.value===`full`?` is-full`:``}`,role:`menuitemradio`,"aria-checked":e.selected,"aria-keyshortcuts":String(e.shortcut),disabled:e.disabled,title:e.disabledReason??void 0,"data-permission-option":e.value,onSelect:()=>s(e.value),children:(0,B.jsx)(x6,{item:e})},e.value)),o.status===null?null:(0,B.jsx)(`p`,{className:`oc-perm__status${o.statusIsError?` is-error`:``}`,role:o.statusIsError?`alert`:`status`,children:o.status}),o.lockReason===null?null:(0,B.jsx)(`p`,{className:`oc-perm__note`,children:o.lockReason}),o.note===null?null:(0,B.jsx)(`p`,{className:`oc-perm__note`,children:o.note})]})]})}function NIe({chatId:e,routedAgent:t,multiAgent:n}){let r=b6(e,t,n);if(r===null||r.view.hidden)return null;let{view:i,pick:a}=r;return(0,B.jsxs)(`section`,{className:`oc-perm__section`,"aria-label":an(),title:i.title,children:[(0,B.jsx)(S6,{}),(0,B.jsx)(`div`,{role:`radiogroup`,"aria-label":an(),className:`oc-perm__list`,children:i.items.map(e=>(0,B.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e.selected,disabled:e.disabled,title:e.disabledReason??void 0,className:`oc-perm__opt${e.selected?` is-selected`:``}${e.value===`full`?` is-full`:``}`,"data-permission-option":e.value,onClick:()=>a(e.value),children:(0,B.jsx)(x6,{item:e})},e.value))}),i.status===null?null:(0,B.jsx)(`p`,{className:`oc-perm__status${i.statusIsError?` is-error`:``}`,role:i.statusIsError?`alert`:`status`,children:i.status}),i.lockReason===null?null:(0,B.jsx)(`p`,{className:`oc-perm__note`,children:i.lockReason}),i.note===null?null:(0,B.jsx)(`p`,{className:`oc-perm__note`,children:i.note})]})}function C6(e){let t=P(L.widgets.widgetConfigForChat,e===null?`skip`:{chatId:e}),{can:n}=q4(e),r=I(L.widgets.setChatWidgets),i=EL(),[a,o]=(0,z.useState)(null),s=t?.canToggle===!0&&n(`inlineWidgets`),c=a??t?.chatDisabled!==!0,l=(0,z.useCallback)(t=>{e!==null&&(o(t),r({chatId:e,enabled:t}).catch(e=>i.error(be(),e)).finally(()=>o(null)))},[e,r,i]);return{offered:s,enabled:c,pending:a!==null,set:l}}function w6(e,t){return e===null||e.kind==="default"?{off:t.injection===`off`,sources:t.injection===`off`?[]:[...t.defaultSources]}:e.kind===`off`?{off:!0,sources:[]}:{off:!1,sources:[...e.sources]}}var T6={hidden:!0,items:[],readOnlyReason:null,origin:`agent`,originLabel:``,allOff:!1,canReset:!1,emptyNote:null,status:null,statusIsError:!1};function E6(e){switch(e){case`plugin_absent`:return Ta();case`overrides_disabled`:return Rh();case`source_not_allowed`:case`unknown_source`:return me();case`unsupported_gateway`:return sg();case`scope_refused`:return _o();default:return Et()}}function PIe(e){if(e==null||e.provider!==`openclaw`||!e.supported)return T6;let t=e.facts;if(t===null||!t.available)return T6;let n=e.choice,r=n!==null&&n.kind!=="default";if(t.sources.length===0&&!r)return T6;let i=w6(n,{injection:t.injection,defaultSources:t.defaultSources}),a=e.viewerRole===`owner`?t.overridesAllowed?null:Pr():ra(),o=null,s=!1,c=e.apply?.status===`clamped`&&n!==null&&Array.isArray(e.apply.dropped)?e.apply.dropped:[];if(e.apply!==null&&n!==null){if(e.apply.status===`pending`)o=gn();else if(e.apply.status===`deferred`)o=zo();else if(e.apply.status===`failed`)o=Ja({reason:E6(e.apply.reason)}),s=!0;else if(e.apply.status===`clamped`&&c.length>0){let e=c.map(e=>t.sources.find(t=>t.id===e)?.label??e);o=e.length===1?Ul({source:e[0]}):Gc({sources:e.join(`, `)})}}return{hidden:!1,items:t.sources.map(e=>({id:e.id,label:e.label,description:e.description,checked:!i.off&&i.sources.includes(e.id)&&!c.includes(e.id),unavailable:c.includes(e.id)})),readOnlyReason:a,origin:r?`conversation`:`agent`,originLabel:r?n.kind===`sources`&&t.injection===`off`?Re():Hn():Pi(),allOff:i.off||i.sources.length===0,canReset:e.viewerRole===`owner`&&r,status:o,statusIsError:s,emptyNote:t.sources.length===0?fr():null}}function FIe(e,t){let n=e.facts,r=w6(e.choice,{injection:n?.injection??null,defaultSources:n?.defaultSources??[]}),i=r.off?[]:r.sources,a=new Set((n?.sources??[]).map(e=>e.id)),o=(i.includes(t)?i.filter(e=>e!==t):[...i,t]).filter(e=>a.has(e));return o.length===0?{kind:`off`}:{kind:`sources`,sources:(n?.sources??[]).map(e=>e.id).filter(e=>o.includes(e)),...n?.injection===`off`?{injection:`auto`}:{}}}function IIe(e,t){return e===null||t===null?e===t:e.kind===t.kind?e.kind!==`sources`||t.kind!==`sources`?!0:e.injection===t.injection&&e.sources.length===t.sources.length&&e.sources.every(e=>t.sources.includes(e)):!1}function D6(e,t){return t===null?e:{...e,choice:t}}function O6(e){return`${e.instanceName}\u0000${e.agentId}`}function LIe(e,t){return e[t]?.choice??null}function RIe(e,t,n,r){let i=e[t];return{...e,[t]:{choice:n,inFlight:(i?.inFlight??0)+1,gen:r}}}function k6(e,t,n,r,i){let a=e[t];if(a===void 0)return e;let o=Math.max(0,a.inFlight-1);return!r&&a.gen===n||r&&o===0&&t!==i?A6(e,t):{...e,[t]:{...a,inFlight:o}}}function zIe(e,t,n){let r=e[t];return r===void 0||BIe(n,r.choice,r.inFlight)!==null?e:A6(e,t)}function A6(e,t){let n={};for(let[r,i]of Object.entries(e))r!==t&&(n[r]=i);return n}function BIe(e,t,n){return t===null?null:n>0?t:IIe(e,t)?null:t}function VIe({chatId:e,routedAgent:t,attachmentsSupported:n,attachDisabled:r}){let i=JA(),a=EL(),o=(0,z.useRef)(null),s=(0,z.useRef)(null),c=P(L.knowledge.knowledgeControl,e===null?`skip`:{chatId:e,...t?{routedAgent:t}:{}}),l=I(L.knowledge.setKnowledgeChoice),u=c==null?``:O6(c.target),[d,f]=(0,z.useState)({}),p=(0,z.useRef)(new Map),m=(0,z.useRef)(u);m.current=u;let h=LIe(d,u),g=c?.choice??null;(0,z.useEffect)(()=>{c!=null&&f(e=>zIe(e,u,g))},[c,g,u,d]);let _=PIe(c==null?c:D6(c,h)),v=C6(e),y=(0,z.useCallback)(e=>{let t=Array.from(e.target.files??[]);e.target.value=``;for(let e of t)i.addAttachment(e).catch(()=>{})},[i]),b=(0,z.useCallback)(t=>{if(c==null)return;let n=O6(c.target),r=(p.current.get(n)??0)+1;p.current.set(n,r),f(e=>RIe(e,n,t,r)),l({chatId:e,instanceName:c.target.instanceName,agentId:c.target.agentId,choice:t}).then(()=>f(e=>k6(e,n,r,!0,m.current))).catch(e=>{f(e=>k6(e,n,r,!1,m.current));let t=/overrides_disabled|source_not_allowed|unavailable|not_openclaw/.exec(String(e?.message??``))?.[0];a.error(Yt({reason:E6(t===`unavailable`?`plugin_absent`:t)}),e)})},[e,c,l,a]);if(!n&&_.hidden&&!v.offered)return null;let x=_.readOnlyReason===null;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`input`,{ref:o,type:`file`,multiple:!0,hidden:!0,onChange:y,"data-testid":`composer-add-file-input`}),(0,B.jsx)(`input`,{ref:s,type:`file`,accept:ZPe,multiple:!0,hidden:!0,onChange:y,"data-testid":`composer-add-image-input`}),(0,B.jsxs)(NI,{children:[(0,B.jsx)(PI,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__icon`,"aria-label":pu(),title:pu(),children:(0,B.jsx)(YS,{size:18,"aria-hidden":!0})})}),(0,B.jsxs)(FI,{align:`start`,side:`top`,className:`oc-perm__menu w-80`,children:[n?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(II,{className:`oc-perm__opt`,disabled:r,onSelect:()=>o.current?.click(),"data-add-option":`file`,children:[(0,B.jsx)(`span`,{className:`oc-perm__opt-icon`,"aria-hidden":!0,children:(0,B.jsx)(Zoe,{size:14})}),(0,B.jsx)(`span`,{className:`oc-perm__opt-copy`,children:(0,B.jsx)(`span`,{className:`oc-perm__opt-title`,children:Ru()})})]}),(0,B.jsxs)(II,{className:`oc-perm__opt`,disabled:r,onSelect:()=>s.current?.click(),"data-add-option":`image`,children:[(0,B.jsx)(`span`,{className:`oc-perm__opt-icon`,"aria-hidden":!0,children:(0,B.jsx)(rse,{size:14})}),(0,B.jsx)(`span`,{className:`oc-perm__opt-copy`,children:(0,B.jsx)(`span`,{className:`oc-perm__opt-title`,children:oi()})})]})]}):null,_.hidden||c==null?null:(0,B.jsxs)(B.Fragment,{children:[n?(0,B.jsx)(RI,{}):null,(0,B.jsxs)(LI,{className:`oc-perm__heading`,"data-knowledge-origin":_.origin,children:[(0,B.jsx)(`span`,{children:wne()}),(0,B.jsx)(`span`,{className:`oc-knowledge__origin`,children:_.originLabel})]}),_.items.map(e=>(0,B.jsxs)(II,{className:`oc-perm__opt${e.checked?` is-selected`:``}`,role:`menuitemcheckbox`,"aria-checked":e.checked,disabled:!x||e.unavailable,title:e.unavailable?gl():_.readOnlyReason??void 0,"data-knowledge-source":e.id,onSelect:t=>{t.preventDefault(),x&&!e.unavailable&&b(FIe(D6(c,h),e.id))},children:[(0,B.jsxs)(`span`,{className:`oc-perm__opt-copy`,children:[(0,B.jsx)(`span`,{className:`oc-perm__opt-title`,children:e.label}),e.description===``?null:(0,B.jsx)(`span`,{className:`oc-perm__opt-desc`,children:e.description})]}),(0,B.jsx)(`span`,{className:`oc-perm__opt-state`,"aria-hidden":!0,children:!x||e.unavailable?e.checked?(0,B.jsx)(qx,{size:14}):(0,B.jsx)(ES,{size:13}):e.checked?(0,B.jsx)(qx,{size:14}):null})]},e.id)),_.emptyNote===null?null:(0,B.jsx)(`p`,{className:`oc-perm__note`,children:_.emptyNote}),_.allOff&&_.emptyNote===null?(0,B.jsx)(`p`,{className:`oc-perm__note`,children:Ms()}):null,_.canReset?(0,B.jsxs)(II,{className:`oc-perm__opt`,onSelect:()=>b({kind:`default`}),"data-knowledge-reset":!0,children:[(0,B.jsx)(`span`,{className:`oc-perm__opt-icon`,"aria-hidden":!0,children:(0,B.jsx)(ZS,{size:14})}),(0,B.jsx)(`span`,{className:`oc-perm__opt-copy`,children:(0,B.jsx)(`span`,{className:`oc-perm__opt-title`,children:nv()})})]}):null,_.status===null?null:(0,B.jsx)(`p`,{className:`oc-perm__status${_.statusIsError?` is-error`:``}`,role:_.statusIsError?`alert`:`status`,children:_.status}),_.readOnlyReason===null?null:(0,B.jsx)(`p`,{className:`oc-perm__note`,children:_.readOnlyReason})]}),v.offered?(0,B.jsxs)(B.Fragment,{children:[n||!_.hidden?(0,B.jsx)(RI,{}):null,(0,B.jsxs)(II,{className:`oc-perm__opt${v.enabled?` is-selected`:``}`,role:`menuitemcheckbox`,"aria-checked":v.enabled,disabled:v.pending,"data-widgets-toggle":!0,onSelect:e=>{e.preventDefault(),v.set(!v.enabled)},children:[(0,B.jsx)(`span`,{className:`oc-perm__opt-icon`,"aria-hidden":!0,children:(0,B.jsx)(xS,{size:14})}),(0,B.jsxs)(`span`,{className:`oc-perm__opt-copy`,children:[(0,B.jsx)(`span`,{className:`oc-perm__opt-title`,children:zie()}),(0,B.jsx)(`span`,{className:`oc-perm__opt-desc`,children:hs()})]}),(0,B.jsx)(`span`,{className:`oc-perm__opt-state`,"aria-hidden":!0,children:v.enabled?(0,B.jsx)(qx,{size:14}):null})]})]}):null]})]})]})}function j6(e){return e.kind===`credential`?`credential`:e.kind===`question`?e.questions?.some(e=>e.secret)?`credential`:`question`:e.approval?.severity===`critical`?`critical`:`approval`}function M6(e){return e===`pending`||e===`submitting`}function N6(e,t){return M6(e.status)&&e.expiresAt>t}function HIe(e){return e.source!==`hermes.approval`&&e.answerById!==!0}function UIe(e,t){let n=e-t;if(n<=0)return{unit:`expired`,value:0,urgent:!0};let r=Math.ceil(n/1e3);if(r<60)return{unit:`seconds`,value:r,urgent:!0};let i=Math.ceil(r/60);return i<60?{unit:`minutes`,value:i,urgent:i<=2}:{unit:`hours`,value:Math.round(i/60),urgent:!1}}function WIe(e){if(e.kind===`question`||e.kind===`credential`&&e.questions)return e.questions?.[0]?.text??``;if(e.kind===`approval`){let t=e.approval;return t?.title??t?.command??t?.description??``}return e.credential?.prompt??e.credential?.envVar??``}function P6(){return{selected:[],other:``}}function GIe(e,t,n){let r=t.selected.includes(n);return e.multiSelect?{...t,selected:r?t.selected.filter(e=>e!==n):[...t.selected,n]}:{selected:r?[]:[n],other:r?t.other:``}}function F6(e,t,n){return e.multiSelect?{...t,other:n}:{selected:n.trim()===``?t.selected:[],other:n}}function KIe(e,t){let n=[];for(let r of e){let e=t[r.id]??P6(),i=r.secret?e.other:e.other.trim(),a=[...e.selected];(r.allowOther||r.options.length===0)&&i!==``&&a.push(i);let o=r.multiSelect?a:a.slice(-1);if(o.length===0)return{ok:!1,problem:{code:`missing`,questionId:r.id}};if(o.some(e=>e.length>8e3))return{ok:!1,problem:{code:`too_long`,questionId:r.id}};n.push({id:r.id,values:o})}return{ok:!0,answers:n}}function I6(e,t){return e.filter(e=>N6(e,t)).sort((e,t)=>e.expiresAt-t.expiresAt)}function qIe(e,t){if(e.source!==`hermes.approval`||e.answerById)return null;let n=e.seq??e.createdAt;return t.filter(t=>t._id!==e._id&&t.source===`hermes.approval`&&!t.answerById&&!t.answerById&&t.queueKey===e.queueKey&&(t.status===`pending`||t.status===`submitting`)&&(t.seq??t.createdAt)<n).sort((e,t)=>(e.seq??e.createdAt)-(t.seq??t.createdAt))[0]??null}function JIe(e,t){return e.source!==`hermes.approval`||e.answerById?!1:t.some(t=>t._id!==e._id&&t.source===`hermes.approval`&&!t.answerById&&t.queueKey===e.queueKey&&(t.status===`pending`||t.status===`submitting`))}function YIe(e,t){let n=I6(e,t),r=new Set(n.map(e=>e._id));return{waiting:n,history:e.filter(e=>!r.has(e._id)).sort((e,t)=>(t.resolvedAt??t.createdAt)-(e.resolvedAt??e.createdAt))}}function XIe(e,t){if(M6(e.status)&&e.expiresAt<=t)return`expired`;switch(e.status){case`answered`:return e.resolvedElsewhere?`answered_elsewhere`:`answered`;case`allowed`:return e.resolvedElsewhere?`allowed_elsewhere`:e.decision===`allow-always`?`allowed_always`:e.decision===`allow-session`?`allowed_session`:`allowed_once`;case`denied`:return e.resolvedElsewhere?`denied_elsewhere`:`denied`;case`expired`:return`expired`;case`cancelled`:return e.answeredByMe?`skipped`:`cancelled`;case`failed`:return`failed`;default:return null}}function L6(e){return e===null?`none`:e===`not_configured`||e===`instance_not_served`||e===`provider_mismatch`?`config`:`retry`}var R6=(0,z.createContext)(null);function z6(){return(0,z.useContext)(R6)}function ZIe(e){let[t,n]=(0,z.useState)(()=>Date.now());return(0,z.useEffect)(()=>{let t=window.setInterval(()=>n(Date.now()),e?1e3:3e4);return()=>window.clearInterval(t)},[e]),t}function QIe(e){let t=document.querySelector(`.oc-thread__viewport [data-agent-request-id="${CSS.escape(e._id)}"]`)??(e.messageId===null?null:document.querySelector(`[data-message-id="${CSS.escape(e.messageId)}"]`));if(!t)return;let n=t.closest(`.oc-thread__viewport`);if(n){let e=t.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTo({top:n.scrollTop+e-Math.max(24,n.clientHeight*.25),behavior:`smooth`})}else t.scrollIntoView({block:`center`,behavior:`smooth`});t.classList.remove(`oc-areq--flash`),t.offsetWidth,t.classList.add(`oc-areq--flash`),window.setTimeout(()=>t.classList.remove(`oc-areq--flash`),2200)}function $Ie({chatId:e,children:t}){let n=P(L.agentRequests.listForChat,{chatId:e}),r=(0,z.useMemo)(()=>n??[],[n]),i=ZIe(r.some(e=>M6(e.status))),a=mf(L.agentRequests.answer),[o,s]=(0,z.useState)(!1),c=(0,z.useCallback)(async(e,t)=>{try{let n=await a({requestId:e,...t});return n.ok?{ok:!0}:{ok:!1,reason:n.reason}}catch{return{ok:!1,reason:`unreachable`}}},[a]),l=(0,z.useMemo)(()=>{let e=new Map;for(let t of[...r].sort((e,t)=>e.createdAt-t.createdAt)){if(t.messageId===null)continue;let n=e.get(t.messageId)??[];n.push(t),e.set(t.messageId,n)}return e},[r]),u=(0,z.useMemo)(()=>I6(r,i),[r,i]),d=(0,z.useMemo)(()=>({rows:r,now:i,byMessage:l,waiting:u,answer:c,openPanel:()=>s(!0),jumpTo:e=>{s(!1),window.setTimeout(()=>QIe(e),120)}}),[r,i,l,u,c]);return(0,B.jsxs)(R6.Provider,{value:d,children:[t,(0,B.jsx)(mLe,{open:o,onOpenChange:s})]})}var B6=`atrium.agentRequests.folded`;function V6(){try{let e=window.localStorage.getItem(B6),t=e?JSON.parse(e):[];return new Set(Array.isArray(t)?t.filter(e=>typeof e==`string`):[])}catch{return new Set}}function eLe(e){try{window.localStorage.setItem(B6,JSON.stringify([...e].slice(-200)))}catch{}}function tLe(e,t){let[n,r]=(0,z.useState)(()=>t&&V6().has(e)?!1:null);return[n??t,(0,z.useCallback)(n=>{if(r(n),!t)return;let i=V6();n?i.delete(e):i.add(e),eLe(i)},[e,t])]}var H6={question:AS,approval:oC,critical:aC,credential:bS};function U6(e){switch(e){case`question`:return Dh();case`approval`:return ie();case`critical`:return Yh();case`credential`:return io()}}function nLe(e,t){let n=UIe(e,t);switch(n.unit){case`expired`:return{text:S_(),urgent:!0};case`seconds`:return{text:ht({value:String(n.value)}),urgent:!0};case`minutes`:return{text:Lt({value:String(n.value)}),urgent:n.urgent};case`hours`:return{text:dc({value:String(n.value)}),urgent:!1}}}var rLe={answered:()=>ln(),answered_elsewhere:()=>Mo(),skipped:()=>Ba(),allowed_once:()=>_a(),allowed_session:()=>jh(),allowed_always:()=>se(),allowed_elsewhere:()=>eg(),denied:()=>lo(),denied_elsewhere:()=>yt(),expired:()=>Vt(),cancelled:()=>gc(),failed:()=>D_()},W6={"allow-once":()=>lm(),"allow-session":()=>Pm(),"allow-always":()=>Uee(),deny:()=>Xte()},iLe={"message-send":()=>oh(),payment:()=>Nne(),"external-post":()=>dte(),"standing-grant":()=>gre()};function G6(e){if(e.startsWith(`AGENT_REQUEST_INVALID_ANSWER`))return Bn();switch(e){case`AGENT_REQUEST_EXPIRED`:return Xd();case`request_gone`:case`AGENT_REQUEST_NOT_PENDING`:return lh();case`AGENT_REQUEST_OWNER_ONLY`:return kg();case`AGENT_REQUEST_READ_ONLY`:return $d();case`AGENT_REQUEST_AGENT_NOT_IN_ROOM`:return fh();case`AGENT_REQUEST_IMPERSONATING`:return Fne();case`AGENT_REQUEST_ANSWER_OLDEST_FIRST`:return Zg();case`AGENT_REQUEST_DECISION_NOT_OFFERED`:return Lp();case`session_mismatch`:return ad();case`approval_order_unknown`:return fu();case`approval_ambiguous`:return Mi();case`AGENT_REQUEST_CLIPPED`:return ii();case`invalid_answer`:return Bn();default:return L6(e)===`config`?E():ls()}}function aLe(e){if(e.status!==`answered`||e.answers===null)return null;if(e.kind===`credential`||e.questions?.some(e=>e.secret))return Ze();let t=e.answers.flatMap(e=>e.values).filter(e=>e!==``);return t.length>0?t.join(` · `):null}function K6({request:e,mode:t,open:n,onToggle:r}){let i=z6(),a=i?.now??Date.now(),o=j6(e),s=H6[o],c=N6(e,a),[l,u]=tLe(e._id,c),d=n??l,f=r??u,p=(0,z.useId)(),m=XIe(e,a),h=c&&HIe(e)?nLe(e.expiresAt,a):null,g=i&&c?qIe(e,i.rows):null,_=WIe(e),v=aLe(e);return(0,B.jsxs)(`section`,{className:[`oc-areq`,`oc-areq--${o}`,`oc-areq--${t}`,c?`oc-areq--waiting`:`oc-areq--settled`,d?`oc-areq--open`:``].join(` `),"data-agent-request-id":e._id,"aria-label":`${U6(o)} — ${_}`,children:[(0,B.jsxs)(`header`,{className:`oc-areq__head`,children:[(0,B.jsx)(`span`,{className:`oc-areq__icon`,"aria-hidden":!0,children:(0,B.jsx)(s,{size:15})}),(0,B.jsxs)(`button`,{type:`button`,className:`oc-areq__toggle`,"aria-expanded":d,"aria-controls":p,title:d?yf():W_(),onClick:()=>f(!d),children:[(0,B.jsx)(`span`,{className:`oc-areq__kind`,children:U6(o)}),!d||!c?(0,B.jsx)(`span`,{className:`oc-areq__summary`,children:_}):null]}),m===null?null:(0,B.jsxs)(`span`,{className:`oc-areq__outcome oc-areq__outcome--${m}`,children:[m.startsWith(`allowed`)||m===`answered`?(0,B.jsx)(qx,{size:12,"aria-hidden":!0}):m.startsWith(`denied`)?(0,B.jsx)(uv,{size:12,"aria-hidden":!0}):null,rLe[m](),v!==null&&!d?(0,B.jsx)(`span`,{className:`oc-areq__outcome-detail`,children:v}):null]}),e.status===`submitting`?(0,B.jsx)(`span`,{className:`oc-areq__outcome oc-areq__outcome--sending`,children:Ks()}):null,h!==null&&e.status===`pending`?(0,B.jsxs)(`span`,{className:`oc-areq__timer${h.urgent?` oc-areq__timer--urgent`:``}`,title:new Date(e.expiresAt).toLocaleTimeString(),children:[(0,B.jsx)(_C,{size:12,"aria-hidden":!0}),h.text]}):null,t!==`inline`&&i?(0,B.jsx)(`button`,{type:`button`,className:`oc-areq__iconbtn`,title:X_(),"aria-label":X_(),onClick:()=>i.jumpTo(e),children:(0,B.jsx)(TS,{size:14})}):null,(0,B.jsx)(`button`,{type:`button`,className:`oc-areq__iconbtn`,"aria-hidden":!0,tabIndex:-1,onClick:()=>f(!d),children:d?(0,B.jsx)(Xx,{size:14}):(0,B.jsx)(cv,{size:14})})]}),d?(0,B.jsx)(`div`,{className:`oc-areq__body`,id:p,children:(0,B.jsx)(oLe,{request:e,waiting:c,blocker:g})}):null]})}function oLe({request:e,waiting:t,blocker:n}){let r=z6(),i=r!==null&&JIe(e,r.rows),a=t&&e.status===`pending`&&e.canAnswer&&n===null&&!i,o=t?e.canAnswer?i?Mi():n===null?null:Zg():kg():null;return(0,B.jsxs)(B.Fragment,{children:[e.kind===`approval`&&e.approval?(0,B.jsx)(uLe,{request:e,answerable:a}):e.questions===null?(0,B.jsx)(dLe,{request:e,answerable:a}):(0,B.jsx)(sLe,{request:e,answerable:a}),o===null?null:(0,B.jsx)(`p`,{className:`oc-areq__note`,children:o})]})}function q6(e){let t=z6(),[n,r]=(0,z.useState)(!1),[i,a]=(0,z.useState)(null),o=(0,z.useCallback)(async n=>{if(!t)return!1;r(!0),a(null);let i=await t.answer(e._id,n);return r(!1),i.ok||a(G6(i.reason)),i.ok},[t,e._id]),s=e.status===`pending`&&L6(e.failureCode)!==`none`?G6(e.failureCode):null;return{busy:n||e.status===`submitting`,sending:n,error:i??s,setError:a,submit:o}}function sLe({request:e,answerable:t}){let n=e.questions??[],[r,i]=(0,z.useState)({}),{busy:a,sending:o,error:s,setError:c,submit:l}=q6(e),u=e.answers,d=M6(e.status),f=!d||!t&&!o;(0,z.useEffect)(()=>{f&&i({})},[f]);let p=async()=>{let e=KIe(n,r);if(!e.ok){c(e.problem.code===`missing`?wg():vre());return}await l({answers:e.answers})&&i({})};return(0,B.jsxs)(`form`,{className:`oc-areq__form`,onSubmit:e=>{e.preventDefault(),p()},onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),p())},children:[n.map(e=>(0,B.jsx)(cLe,{question:e,draft:r[e.id]??P6(),disabled:!t||a,closed:!d,settled:u?.find(t=>t.id===e.id)?.values??null,onChange:t=>{c(null),i(n=>({...n,[e.id]:t}))}},e.id)),s===null?null:(0,B.jsx)(`p`,{className:`oc-areq__error`,role:`alert`,children:s}),t?(0,B.jsxs)(`div`,{className:`oc-areq__actions`,children:[(0,B.jsx)(Ov,{type:`button`,variant:`ghost`,size:`sm`,disabled:a,title:lie(),onClick:()=>{i({}),l({skip:!0})},children:Hs()}),(0,B.jsx)(Ov,{type:`submit`,size:`sm`,disabled:a,children:a?Ks():Je()})]}):null]})}function cLe({question:e,draft:t,disabled:n,closed:r,settled:i,onChange:a}){let o=(0,z.useId)(),s=e.options.length===0,[c,l]=(0,z.useState)(!1),u=i??t.selected;return(0,B.jsxs)(`fieldset`,{className:`oc-areq__q`,"aria-labelledby":o,disabled:n,children:[(0,B.jsxs)(`div`,{className:`oc-areq__qhead`,id:o,children:[e.header?(0,B.jsx)(`span`,{className:`oc-areq__qchip`,children:e.header}):null,(0,B.jsx)(`span`,{className:`oc-areq__qtext`,children:e.text})]}),e.store?(0,B.jsx)(lLe,{store:e.store}):null,e.url?(0,B.jsxs)(`a`,{className:`oc-areq__link`,href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:[(0,B.jsx)(lS,{size:13,"aria-hidden":!0}),vd()]}):null,e.options.length>0?(0,B.jsxs)(`div`,{className:`oc-areq__options`,role:e.multiSelect?`group`:`radiogroup`,"aria-labelledby":o,children:[e.options.map(r=>{let o=u.includes(r.label);return(0,B.jsxs)(`button`,{type:`button`,className:`oc-areq__option${o?` oc-areq__option--on`:``}`,role:e.multiSelect?`checkbox`:`radio`,"aria-checked":o,disabled:n||i!==null,onClick:()=>a(GIe(e,t,r.label)),children:[(0,B.jsx)(`span`,{className:`oc-areq__option-mark`,"aria-hidden":!0,children:o?(0,B.jsx)(qx,{size:11}):null}),(0,B.jsxs)(`span`,{className:`oc-areq__option-text`,children:[(0,B.jsx)(`span`,{className:`oc-areq__option-label`,title:r.label.length>120?r.label:void 0,children:r.label}),r.description?(0,B.jsx)(`span`,{className:`oc-areq__option-desc`,children:r.description}):null]})]},r.label)}),e.multiSelect?(0,B.jsx)(`span`,{className:`oc-areq__hint`,children:Zre()}):null]}):null,!r&&i===null&&(e.allowOther||s)?e.secret?(0,B.jsxs)(`div`,{className:`oc-areq__secret`,children:[(0,B.jsx)(`input`,{className:`oc-areq__input`,type:c?`text`:`password`,autoComplete:`off`,spellCheck:!1,placeholder:$r(),value:t.other,onChange:n=>a(F6(e,t,n.target.value))}),(0,B.jsx)(`button`,{type:`button`,className:`oc-areq__iconbtn`,title:c?Pn():Ei(),"aria-label":c?Pn():Ei(),onClick:()=>l(e=>!e),children:c?(0,B.jsx)(uS,{size:14}):(0,B.jsx)(dS,{size:14})})]}):s?(0,B.jsx)(`textarea`,{className:`oc-areq__input oc-areq__input--area`,rows:2,placeholder:Eie(),value:t.other,onChange:n=>a(F6(e,t,n.target.value))}):(0,B.jsx)(`input`,{className:`oc-areq__input`,type:`text`,placeholder:hf(),value:t.other,onChange:n=>a(F6(e,t,n.target.value))}):null,i!==null&&i.length>0&&e.options.length===0&&!e.secret?(0,B.jsx)(`p`,{className:`oc-areq__given`,children:i.join(` · `)}):null,e.secret?(0,B.jsx)(`p`,{className:`oc-areq__hint`,children:e.store?Me():Fl()}):null]})}function lLe({store:e}){return(0,B.jsxs)(`div`,{className:`oc-areq__facts`,children:[(0,B.jsx)(`span`,{className:`oc-areq__fact oc-areq__fact--mono`,children:Rc({name:e.name})}),e.allowedHosts?(0,B.jsx)(`span`,{className:`oc-areq__fact`,children:ar({hosts:e.allowedHosts.join(`, `)})}):null,e.replacesSinceMs===void 0?null:(0,B.jsx)(`span`,{className:`oc-areq__fact oc-areq__fact--warning`,children:ll({date:new Date(e.replacesSinceMs).toLocaleDateString()})}),e.reason?(0,B.jsx)(`span`,{className:`oc-areq__fact`,children:e.reason}):null]})}function uLe({request:e,answerable:t}){let n=e.approval,{busy:r,error:i,submit:a}=q6(e),[o,s]=(0,z.useState)(!1),c=n.decisions.filter(e=>e!==`deny`);return(0,B.jsxs)(`div`,{className:`oc-areq__approval`,children:[n.title?(0,B.jsx)(`p`,{className:`oc-areq__title`,children:n.title}):null,n.description?(0,B.jsx)(`p`,{className:`oc-areq__desc`,children:n.description}):null,n.command?(0,B.jsxs)(`pre`,{className:`oc-areq__command`,"aria-label":hg(),children:[(0,B.jsx)(fC,{size:13,"aria-hidden":!0,className:`oc-areq__command-icon`}),(0,B.jsx)(`code`,{children:n.command})]}):null,n.warning?(0,B.jsxs)(`p`,{className:`oc-areq__warning`,children:[(0,B.jsx)(aC,{size:13,"aria-hidden":!0}),n.warning]}):null,n.clipped?(0,B.jsxs)(`p`,{className:`oc-areq__warning`,role:`note`,children:[(0,B.jsx)(aC,{size:13,"aria-hidden":!0}),Iu()]}):null,n.detail?(0,B.jsxs)(`details`,{className:`oc-areq__detail`,children:[(0,B.jsx)(`summary`,{children:Hf()}),(0,B.jsx)(`pre`,{children:n.detail})]}):null,(0,B.jsxs)(`div`,{className:`oc-areq__facts`,children:[n.severity&&n.severity!==`info`?(0,B.jsx)(`span`,{className:`oc-areq__fact oc-areq__fact--${n.severity}`,children:n.severity===`critical`?cu():td()}):null,n.scope?(0,B.jsxs)(`span`,{className:`oc-areq__fact`,children:[(iLe[n.scope.kind]??(()=>n.scope.kind))(),` · `,n.scope.summary]}):null,n.scope?.external?(0,B.jsx)(`span`,{className:`oc-areq__fact oc-areq__fact--warning`,children:Pp()}):null,n.scope?.grantDays===void 0?null:(0,B.jsx)(`span`,{className:`oc-areq__fact`,children:S({days:String(n.scope.grantDays)})}),n.host?(0,B.jsx)(`span`,{className:`oc-areq__fact`,children:Gd({host:n.host})}):null,n.nodeId?(0,B.jsx)(`span`,{className:`oc-areq__fact`,children:$ne({node:n.nodeId})}):null,n.pluginId?(0,B.jsx)(`span`,{className:`oc-areq__fact`,children:Ate({plugin:n.pluginId})}):null,n.toolName?(0,B.jsx)(`span`,{className:`oc-areq__fact oc-areq__fact--mono`,children:n.toolName}):null]}),i===null?null:(0,B.jsx)(`p`,{className:`oc-areq__error`,role:`alert`,children:i}),t?o?(0,B.jsxs)(`div`,{className:`oc-areq__confirm`,role:`group`,"aria-label":nm(),children:[(0,B.jsx)(`p`,{children:n.scope?.grantDays===void 0?dp():rs({days:String(n.scope.grantDays)})}),(0,B.jsxs)(`div`,{className:`oc-areq__actions`,children:[(0,B.jsx)(Ov,{type:`button`,variant:`ghost`,size:`sm`,disabled:r,onClick:()=>s(!1),children:Pre()}),(0,B.jsx)(Ov,{type:`button`,size:`sm`,disabled:r,onClick:()=>void a({decision:`allow-always`}),children:nm()})]})]}):(0,B.jsxs)(`div`,{className:`oc-areq__actions`,children:[(0,B.jsx)(Ov,{type:`button`,variant:`destructive`,size:`sm`,disabled:r,onClick:()=>void a({decision:`deny`}),children:W6.deny()}),(0,B.jsx)(`span`,{className:`oc-areq__spacer`}),c.filter(e=>e!==`allow-once`).map(e=>(0,B.jsx)(Ov,{type:`button`,variant:`outline`,size:`sm`,disabled:r,onClick:()=>e===`allow-always`?s(!0):void a({decision:e}),children:W6[e]()},e)),c.includes(`allow-once`)?(0,B.jsx)(Ov,{type:`button`,size:`sm`,disabled:r,onClick:()=>void a({decision:`allow-once`}),children:r?Ks():W6[`allow-once`]()}):null]}):null]})}function dLe({request:e,answerable:t}){let n=e.credential,[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(!1),{busy:s,sending:c,error:l,setError:u,submit:d}=q6(e),f=n?.mode===`password`,p=!M6(e.status)||!t&&!c;(0,z.useEffect)(()=>{p&&i(``)},[p]);let m=(0,z.useRef)(null);return(0,B.jsxs)(`form`,{className:`oc-areq__form`,onSubmit:e=>{if(e.preventDefault(),r.length===0){u(wg());return}d({secret:r}).then(e=>{e&&i(``)})},children:[(0,B.jsx)(`p`,{className:`oc-areq__desc`,children:n?.prompt??(f?Xi():Or())}),n?.command?(0,B.jsxs)(`pre`,{className:`oc-areq__command`,"aria-label":hg(),children:[(0,B.jsx)(fC,{size:13,"aria-hidden":!0,className:`oc-areq__command-icon`}),(0,B.jsx)(`code`,{children:n.command})]}):null,n?.envVar?(0,B.jsx)(`span`,{className:`oc-areq__fact oc-areq__fact--mono`,children:ju({name:n.envVar})}):null,n?.clipped||n?.commandMissing?(0,B.jsxs)(`p`,{className:`oc-areq__warning`,role:`note`,children:[(0,B.jsx)(aC,{size:13,"aria-hidden":!0}),n.clipped?ii():Cne()]}):null,t&&!n?.clipped&&!n?.commandMissing?(0,B.jsxs)(`div`,{className:`oc-areq__secret`,children:[(0,B.jsx)(`input`,{ref:m,className:`oc-areq__input`,type:a?`text`:`password`,autoComplete:f?`current-password`:`off`,spellCheck:!1,placeholder:f?vne():$r(),value:r,onChange:e=>{u(null),i(e.target.value)}}),(0,B.jsx)(`button`,{type:`button`,className:`oc-areq__iconbtn`,title:a?Pn():Ei(),"aria-label":a?Pn():Ei(),onClick:()=>{o(e=>!e),m.current?.focus()},children:a?(0,B.jsx)(uS,{size:14}):(0,B.jsx)(dS,{size:14})})]}):null,(0,B.jsx)(`p`,{className:`oc-areq__hint`,children:Fl()}),l===null?null:(0,B.jsx)(`p`,{className:`oc-areq__error`,role:`alert`,children:l}),t?(0,B.jsxs)(`div`,{className:`oc-areq__actions`,children:[(0,B.jsx)(Ov,{type:`button`,variant:`ghost`,size:`sm`,disabled:s,onClick:()=>{i(``),d({skip:!0})},children:Ts()}),n?.clipped||n?.commandMissing?null:(0,B.jsx)(Ov,{type:`submit`,size:`sm`,disabled:s,children:s?Ks():Jie()})]}):null]})}function fLe(){let e=z6(),t=U(e=>e.id),n=e?.byMessage.get(t);return!n||n.length===0?null:(0,B.jsx)(`div`,{className:`oc-areq-inline`,children:n.map(e=>(0,B.jsx)(K6,{request:e,mode:`inline`},e._id))})}function pLe(){let e=z6(),[t,n]=(0,z.useState)(!1),[r,i]=(0,z.useState)(null),a=e?.waiting??[];if((0,z.useEffect)(()=>{r!==null&&!a.some(e=>e._id===r)&&i(null)},[r,a]),!e||a.length===0)return null;let o=a[0],s=j6(o),c=H6[s],l=t?a:[o],u=a.length-1;return(0,B.jsxs)(`div`,{className:`oc-areq-dock oc-areq-dock--${s}`,role:`region`,"aria-label":p_(),children:[(0,B.jsxs)(`div`,{className:`oc-areq-dock__bar`,children:[(0,B.jsx)(`span`,{className:`oc-areq-dock__pulse`,"aria-hidden":!0,children:(0,B.jsx)(c,{size:14})}),(0,B.jsx)(`span`,{className:`oc-areq-dock__title`,children:p_()}),u>0?(0,B.jsxs)(`button`,{type:`button`,className:`oc-areq-dock__count`,"aria-expanded":t,title:t?yf():W_(),onClick:()=>n(e=>!e),children:[Sd({count:String(a.length)}),t?(0,B.jsx)(cv,{size:12,"aria-hidden":!0}):(0,B.jsx)(Xx,{size:12,"aria-hidden":!0})]}):null,(0,B.jsx)(`span`,{className:`oc-areq__spacer`}),(0,B.jsx)(`button`,{type:`button`,className:`oc-areq__iconbtn`,title:mm(),"aria-label":mm(),onClick:e.openPanel,children:(0,B.jsx)(yS,{size:14})})]}),(0,B.jsx)(`div`,{className:`oc-areq-dock__list`,children:l.map(e=>(0,B.jsx)(K6,{request:e,mode:`dock`,open:r===e._id,onToggle:t=>i(t?e._id:null)},e._id))})]})}function mLe({open:e,onOpenChange:t}){let n=z6(),[r,i]=(0,z.useState)(`all`),a=(0,z.useMemo)(()=>n?YIe(n.rows,n.now):{waiting:[],history:[]},[n]),o=e=>{if(r===`all`)return!0;let t=j6(e);return r===`approval`?t===`approval`||t===`critical`:t===r},s=a.waiting.filter(o),c=a.history.filter(o);return(0,B.jsx)(D4,{open:e,onOpenChange:t,children:(0,B.jsxs)(O4,{side:`right`,className:`oc-areq-panel`,children:[(0,B.jsxs)(k4,{children:[(0,B.jsx)(j4,{children:mm()}),(0,B.jsx)(M4,{children:zm()})]}),(0,B.jsx)(`div`,{className:`oc-areq-panel__filters`,role:`tablist`,"aria-label":hp(),children:[`all`,`question`,`approval`,`credential`].map(e=>(0,B.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":r===e,className:`oc-areq-panel__filter${r===e?` oc-areq-panel__filter--on`:``}${e===`all`?``:` oc-areq-panel__filter--${e}`}`,onClick:()=>i(e),children:e===`all`?Rre():U6(e)},e))}),(0,B.jsxs)(`div`,{className:`oc-areq-panel__body`,children:[s.length===0&&c.length===0?(0,B.jsx)(`p`,{className:`oc-areq-panel__empty`,children:iee()}):null,s.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`h3`,{className:`oc-areq-panel__section`,children:[qee(),` `,(0,B.jsx)(`span`,{className:`oc-areq-panel__n`,children:s.length})]}),s.map(e=>(0,B.jsx)(K6,{request:e,mode:`panel`},e._id))]}):null,c.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h3`,{className:`oc-areq-panel__section`,children:$te()}),c.map(e=>(0,B.jsx)(K6,{request:e,mode:`panel`},e._id))]}):null]})]})})}function hLe({compact:e=!1,ghost:t=!1}){let n=z6();if(!n||n.rows.length===0)return null;let r=n.waiting.length,i=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(yS,{size:13,"aria-hidden":!0}),e?null:(0,B.jsx)(`span`,{className:`oc-chip__label`,children:kee()}),r>0?(0,B.jsx)(`span`,{className:`oc-areq-headbadge`,children:r}):null]}),a=`oc-chip oc-chip--btn${r>0?` oc-chip--areq`:``}`;return t?(0,B.jsx)(`span`,{className:a,children:i}):(0,B.jsx)(`button`,{type:`button`,className:a,title:r>0?Kf({count:String(r)}):mm(),onClick:n.openPanel,children:i})}var J6={showSource:!0,showReport:!0,copyAssistant:!0,copyUser:!0,showDelete:!0,showTools:!1,voiceInput:!1,showUsage:!0,autoReadAloud:!0},Y6=(0,z.createContext)({enabled:!1,lang:`auto`,rate:1,autoRead:!1,engine:`browser`,loaded:!1}),X6=(0,z.createContext)({active:null,setActive:()=>{},clearIf:()=>{}}),Z6=0;function Q6(){Z6++,nw(),cw()}var $6=(0,z.createContext)(J6);function e8(){return(0,z.useContext)($6)}var t8=(0,z.createContext)(null),n8=(0,z.createContext)(null),r8=(0,z.createContext)(null),i8=(0,z.createContext)(null),a8=(0,z.createContext)(!0),o8=(0,z.createContext)(null),s8=(0,z.createContext)(null);function c8(){return(0,z.useContext)(s8)}function l8({className:e}){let t=$2();return(0,B.jsx)(`div`,{className:e,"aria-hidden":!0,children:t.logoUrl?t.logoMasked?(0,B.jsx)(`span`,{className:`oc-avatar__img oc-avatar__img--mask`,style:{"--oc-logo-url":`url("${t.logoUrl}")`}}):(0,B.jsx)(`img`,{className:`oc-avatar__img`,src:t.logoUrl,alt:``}):t.isDefault?(0,B.jsx)(Z2,{className:`oc-avatar__mark`}):t.initials})}function u8({chatId:e,focusMessageId:t}){let{runtime:n,turnGate:r,queueSend:i,abortTurn:a,routing:o,lastUserTurnQueued:s,queuedTurns:c,cancelQueued:l,initialLoading:u}=fFe({chatId:e}),d=P(L.me.getMe,{host:A2}),f=d?.ui?.effective??J6,p=P(L.messages.getSessionMeta,e?{chatId:e}:`skip`)?.viewerRole===`participant`,m=(0,z.useMemo)(()=>p?{...f,showDelete:!1,showReport:!1}:f,[p,f]),h=f.showTools,g=N2(d?.resolvedThemeMode),_=d?.resolvedChartBrand,v=d?.resolvedChartTokens,y=P(L.agents.getChatAgent,e?{chatId:e}:`skip`),b=y?.multiAgent?y.agent:null,x=(0,z.useMemo)(()=>{let e=_?.label??`Atrium`,t=v?.colors?.[g],n=zMe(_,BMe(t?.primary,t?.[`primary-foreground`],g));return{label:e,logoUrl:n?.url??null,logoMasked:n?.masked??!1,isDefault:_?.isDefault??!0,initials:VMe(e),agentName:b?.displayName??b?.agentId??null,agentEmoji:b?.emoji??null}},[_,g,v,b]),S=I(L.me.setUiPref).withOptimisticUpdate(I3),C=P(L.messages.getSessionMeta,e?{chatId:e}:`skip`),w=e!==null&&C===null,T=d?.userId??``,E=e??null,D=l1(),O=i1(),k=jEe((0,z.useSyncExternalStore)(X$,Z$,Z$),{userId:T,chatId:E}),ee=y?.agent?.instanceName??null,A=(0,z.useCallback)((e,t)=>{EEe({kind:e,ownerUserId:T,originChatId:E,originLabel:C?.title||Xu(),params:t})},[T,E,C?.title]),j=(0,z.useCallback)(()=>{k!==null&&$$(k.pinId)},[k]),te=k?.kind===`sources`?k.params.messageId:null,ne=k?.kind===`subagent`?k.params.childKey:null,M=k?.kind===`document`?k.params.doc:null,N=k?.kind===`cron`?k.params:null,re=(0,z.useMemo)(()=>({activeMessageId:te,openFor:e=>A(`sources`,{messageId:e}),close:j}),[te,A,j]),ie=e4(x),ae=(0,z.useMemo)(()=>({activeChildKey:ne,openFor:e=>A(`subagent`,{childKey:e,parentAgentLabel:ie}),close:j}),[ne,ie,A,j]),oe=OQ;(0,z.useEffect)(()=>()=>{oe.current=null},[oe]);let se=(0,z.useMemo)(()=>({activeDoc:M,openFor:e=>A(`document`,{doc:e}),openNewerVersion:e=>{k===null?A(`document`,{doc:e}):e1(k.pinId,{doc:e})},close:j}),[M,k,A,j]),ce=(0,z.useMemo)(()=>({active:N,openFor:(e,t,n)=>{let r=t??ee;r!==null&&A(`cron`,{instanceName:r,jobId:e.jobId??null,part:e,occurrenceId:n})},close:j}),[N,ee,A,j]),le=te!==null,ue=ne!==null,de=M!==null,fe=N!==null,pe=k?.kind??null,me=k?.params??null,he=pe===null?null:OEe(pe,me??{}),ge=fe||de||ue||le,_e=pe===null||t1(O,de?380:ue?320:300),ve=ge&&(D||!_e)&&k?.pinned!==!0,ye=P(L.voice.voiceConfigForChat,e?{chatId:e}:`skip`),[be,xe]=(0,z.useState)(null),Se=(0,z.useMemo)(()=>({active:be,setActive:xe,clearIf:e=>xe(t=>t?.messageId===e?null:t)}),[be]);(0,z.useEffect)(()=>{Q6(),xe(null)},[e]);let Ce=(0,z.useMemo)(()=>ye?{...ye,loaded:!0}:{enabled:!1,lang:`auto`,rate:1,autoRead:!1,engine:`browser`,loaded:!1},[ye]);return(0,B.jsx)(Uue,{runtime:n,children:(0,B.jsx)(Y6.Provider,{value:Ce,children:(0,B.jsx)(X6.Provider,{value:Se,children:(0,B.jsx)(t8.Provider,{value:r,children:(0,B.jsx)(n8.Provider,{value:i,children:(0,B.jsx)(r8.Provider,{value:{queuedTurns:c,cancelQueued:l},children:(0,B.jsx)(o8.Provider,{value:e,children:(0,B.jsx)(i8.Provider,{value:p?null:a,children:(0,B.jsx)(a8.Provider,{value:!p,children:(0,B.jsx)(H3.Provider,{value:s,children:(0,B.jsx)(s8.Provider,{value:o,children:(0,B.jsx)($6.Provider,{value:m,children:(0,B.jsx)(Q2.Provider,{value:x,children:(0,B.jsx)($Q.Provider,{value:re,children:(0,B.jsx)(W$.Provider,{value:ae,children:(0,B.jsx)(YL.Provider,{value:ce,children:(0,B.jsx)(kQ.Provider,{value:oe,children:(0,B.jsx)(NQ.Provider,{value:se,children:(0,B.jsxs)(BQ,{children:[(0,B.jsx)(`div`,{className:`oc-chat`,children:(0,B.jsx)(`div`,{className:`oc-chat__convo`,children:e?w?(0,B.jsx)(gLe,{}):(0,B.jsx)(xLe,{chatId:e,showTools:h,onToggleTools:()=>void S({key:`showTools`,value:!h}),focusMessageId:t??null,initialLoading:u}):(0,B.jsx)(`div`,{className:`oc-empty`,children:See()})})}),le&&ve?(0,B.jsx)(D4,{open:!0,onOpenChange:e=>{e||re.close()},children:(0,B.jsx)(O4,{side:`right`,className:`oc-sources-panel-sheet`,children:(0,B.jsx)(rR,{onClose:j,children:(0,B.jsx)(e$,{messageId:te,onClose:re.close})},he??`none`)})}):null,ue&&ve?(0,B.jsx)(D4,{open:!0,onOpenChange:e=>{e||ae.close()},children:(0,B.jsx)(O4,{side:`right`,className:`oc-sources-panel-sheet`,children:(0,B.jsx)(rR,{onClose:j,children:(0,B.jsx)(K$,{chatId:e,childKey:ne,onClose:ae.close,parentAgentLabel:e4(x)})},he??`none`)})}):null,fe&&ve?(0,B.jsx)(D4,{open:!0,onOpenChange:e=>{e||ce.close()},children:(0,B.jsx)(O4,{side:`right`,className:`oc-sources-panel-sheet`,children:(0,B.jsx)(rR,{onClose:j,children:(0,B.jsx)(nR,{instanceName:N.instanceName,part:N.part,onClose:ce.close})},he??`none`)})}):null,de&&ve?(0,B.jsx)(D4,{open:!0,onOpenChange:e=>{e||se.close()},children:(0,B.jsx)(O4,{side:`right`,className:`oc-sources-panel-sheet oc-docviewer-sheet`,children:(0,B.jsx)(rR,{onClose:j,children:(0,B.jsx)(FQ,{doc:M,chatId:e,onClose:se.close})},he??`none`)})}):null]})})})})})})})})})})})})})})})})})})})}function gLe(){let e=wx();return(0,B.jsxs)(`div`,{className:`oc-notfound`,role:`status`,children:[(0,B.jsx)(`div`,{className:`oc-notfound__icon`,"aria-hidden":!0,children:(0,B.jsx)($S,{size:28})}),(0,B.jsx)(`h2`,{className:`oc-notfound__title`,children:Rf()}),(0,B.jsx)(`p`,{className:`oc-notfound__body`,children:Xne()}),(0,B.jsxs)(`button`,{type:`button`,className:`oc-notfound__cta`,onClick:()=>void e({to:`/`}),children:[(0,B.jsx)(YS,{size:16,"aria-hidden":!0}),Ete()]})]})}function _Le(e,t){let n=CSS.highlights,r=window.Highlight;if(!n||!r)return null;let i=t.map(e=>e.toLowerCase()).filter(e=>e.length>=2);if(i.length===0)return null;let a=[],o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let e=o.nextNode();e;e=o.nextNode()){let t=(e.textContent??``).toLowerCase();for(let n of i){let r=t.indexOf(n);for(;r!==-1;){let i=document.createRange();if(i.setStart(e,r),i.setEnd(e,r+n.length),a.push(i),a.length>=200)break;r=t.indexOf(n,r+n.length)}if(a.length>=200)break}if(a.length>=200)break}return a.length===0?null:(n.set(`oc-search-terms`,new r(...a)),()=>n.delete(`oc-search-terms`))}function vLe(e,t){(0,z.useEffect)(()=>{if(!t)return;let e=!1,n=0,r=0,i=null,a=()=>{if(e)return;let o=document.querySelector(`[data-message-id="${CSS.escape(t)}"]`);if(o){o.scrollIntoView({block:`center`,behavior:`smooth`}),o.classList.remove(`oc-msg--highlight`),o.offsetWidth,o.classList.add(`oc-msg--highlight`),window.setTimeout(()=>o.classList.remove(`oc-msg--highlight`),2400);let e=YFe(t);e&&(i=_Le(o,e.split(/\s+/).filter(Boolean)));return}n++<40&&(r=window.setTimeout(a,150))};return r=window.setTimeout(a,0),()=>{e=!0,window.clearTimeout(r),i?.()}},[e,t])}function yLe(){return(0,B.jsx)(`div`,{className:`oc-thread-skeleton`,role:`status`,"aria-label":Ui(),children:[72,38,84,56,64].map((e,t)=>(0,B.jsx)(`div`,{className:`oc-thread-skeleton__row${t%2?` oc-thread-skeleton__row--user`:``}`,children:(0,B.jsx)(`span`,{className:`oc-thread-skeleton__bubble`,style:{width:`${e}%`}})},t))})}function bLe(e){return vIe({chatId:e.chatId,ready:e.ready,focusMessageId:e.focusMessageId}),null}function xLe({chatId:e,showTools:t,onToggleTools:n,focusMessageId:r,initialLoading:i}){let a=P(L.bridgeHealth.getBridgeAvailability,{chatId:e}),o=c8(),s=o?.nextTarget??null,c=P(L.bridgeHealth.getBridgeAvailability,{chatId:e,...s?{routedAgent:{instanceName:s.instanceName,agentId:s.agentId}}:{}}),l=c&&!c.available?c:null,{beyondValidated:u,gatewayVersion:d}=q4(e,s?{instanceName:s.instanceName,agentId:s.agentId}:null),f=a?.available===!0&&a.degraded===!0,p=c?.available===!0&&c.degraded===!0,m=P(L.agents.getChatAgent,{chatId:e}),h=m?.readOnly===!0,g=P(L.messages.getSessionMeta,{chatId:e})?.viewerRole===`participant`,[_,v]=(0,z.useState)(!1),y=P(L.talk.chatCallState,{chatId:e}),b=ZMe({callActive:_||y?.active===!0,onCall:y?.active===!0&&y.instanceName!==void 0&&y.agentId!==void 0?{instanceName:y.instanceName,agentId:y.agentId}:null,unavailable:l!==null,readOnly:h,multiAgent:o?.multiAgent===!0,poolSize:(o?.pool??[]).filter(e=>e.state!==`deleted`).length}),x=!b.hidden&&!b.disabled,S=XFe({readOnly:h,unavailable:l!==null,degraded:p,beyondValidated:u}),C=P(L.messages.getSessionMeta,{chatId:e})?.title??``,w=P(L.subAgents.listSubAgents,{chatId:e}),T=rEe(w??[]),E=mf(L.subAgents.reconcileTaskEngagements),D=(w??[]).some(e=>e.kind===`task`&&e.status===`running`),O=4*6e4,k=(w??[]).reduce((e,t)=>t.kind===`task`&&t.updatedAt>e?t.updatedAt:e,0),ee=(0,z.useRef)({chatId:null,seenStamp:0,armedAtLocal:0});if(ee.current.chatId!==(e??null)&&(ee.current={chatId:e??null,seenStamp:0,armedAtLocal:0}),k>0&&ee.current.seenStamp!==k){let t=ee.current.seenStamp===0,n=Date.now()-k<10*6e4;ee.current={chatId:e??null,seenStamp:k,armedAtLocal:t&&!n?0:Date.now()}}let A=ee.current.armedAtLocal>0&&Date.now()-ee.current.armedAtLocal<O;(0,z.useEffect)(()=>{if(!D&&!A||!e)return;let t=!1,n=!1,r,i=()=>{if(t||n)return;let r=ee.current.armedAtLocal+O;!D&&Date.now()>r||(n=!0,E({chatId:e}).catch(()=>{}).finally(()=>{n=!1}))};return i(),r=window.setInterval(i,3e4),()=>{t=!0,window.clearInterval(r)}},[D,A,e,E]);let j=P(L.subAgents.turnActivity,{chatId:e}),te=yFe(P(L.messages.listByChat,{chatId:e})),ne=j?.deliveringSince??null,M=j?.deliveringTtlRemainingMs??null,[N,re]=(0,z.useState)(null);(0,z.useEffect)(()=>{if(ne===null||M===null||M<=0)return;let t=window.setTimeout(()=>re({chatId:e,key:ne}),M);return()=>window.clearTimeout(t)},[ne,M,e]);let ie=bFe(e,ne,M,N),ae=j?.runningTtlRemainingMs??null,[oe,se]=(0,z.useState)(!1);(0,z.useEffect)(()=>{if(se(!1),j?.running!==!0||ae===null)return;let e=window.setTimeout(()=>se(!0),ae);return()=>window.clearTimeout(e)},[j?.running,ae,e]);let ce=j?.running===!0&&!oe,le=!te&&(ce||ie),ue=j?.anchorMessageId??null,[de,fe]=(0,z.useState)(!1);(0,z.useEffect)(()=>{if(!le||ue===null){fe(!1);return}let e=()=>fe(document.querySelector(`[data-message-id="${CSS.escape(ue)}"]`)!==null);e();let t=window.setInterval(e,2e3);return()=>window.clearInterval(t)},[le,ue]);let pe=j?.detachedTask===!0?null:j?.workingSince??null,me=le&&ue!==null&&de?{messageId:ue,running:ce,workingSince:pe,progressSummary:j?.progressSummary??null}:null;return vLe(e,r),(0,B.jsx)(L3.Provider,{value:f,children:(0,B.jsx)(V3.Provider,{value:me,children:(0,B.jsx)(dL,{chatId:e,focusMessageId:r,children:(0,B.jsx)($Ie,{chatId:e,children:(0,B.jsxs)(kI.Root,{className:`oc-thread`,children:[(0,B.jsx)(OLe,{chatId:e}),(0,B.jsx)(ELe,{chatId:e}),i?(0,B.jsx)(yLe,{}):null,(0,B.jsx)(bLe,{chatId:e,ready:!i,focusMessageId:r}),(0,B.jsxs)(kI.Viewport,{className:`oc-thread__viewport`,style:i?{display:`none`}:void 0,children:[(0,B.jsx)(kI.Empty,{children:(0,B.jsx)(DLe,{})}),(0,B.jsx)(kI.Messages,{components:{UserMessage:qLe,AssistantMessage:QLe,SystemMessage:$Le}}),le&&me===null?(0,B.jsx)(d8,{running:ce,since:pe,progress:j?.progressSummary??null}):null]}),(0,B.jsx)(mL,{}),(0,B.jsx)(`div`,{className:`oc-scrolldown-anchor`,children:(0,B.jsx)(kI.If,{empty:!1,children:(0,B.jsxs)(kI.ScrollToBottom,{className:`oc-scrolldown`,children:[(0,B.jsx)(NLe,{}),(0,B.jsx)(`span`,{children:Vd()})]})})}),S===`read_only`?(0,B.jsx)(TLe,{reason:m?.readOnlyReason??null,guest:g}):S===`unavailable`?(0,B.jsx)(wLe,{reason:l?.reason??null,canSwitchAgent:x}):S===`degraded`?(0,B.jsx)(CLe,{}):S===`beyond_validated`?(0,B.jsx)(SLe,{version:d}):null,(0,B.jsx)(wFe,{}),(0,B.jsx)(pLe,{}),(0,B.jsx)(lRe,{chatId:e,chatTitle:C,showTools:t,onToggleTools:n,unavailable:l!==null||h,agentGate:b,onTalkCallActiveChange:v,serverCallSessionId:_?null:y?.sessionId??null,subAgentBusy:T})]})})})})})}function d8({running:e,since:t=null,anchored:n=!1,progress:r=null}){let i=(0,z.useRef)(null);if(t!==null&&i.current?.key!==t){let e=Date.now();i.current={key:t,baselineMs:R3(t,e),firstLocalMs:e}}let[,a]=(0,z.useState)(0);(0,z.useEffect)(()=>{if(t===null)return;let e=window.setInterval(()=>a(e=>e+1),1e3);return()=>window.clearInterval(e)},[t]);let o=!n&&t!==null&&i.current!==null&&i.current.key===t?B3(z3(i.current.baselineMs,i.current.firstLocalMs,Date.now())):null;return(0,B.jsxs)(`div`,{className:`oc-turn-activity${n?` oc-turn-activity--anchored`:``}`,children:[(0,B.jsxs)(`span`,{className:`oc-dots`,"aria-hidden":!0,children:[(0,B.jsx)(`span`,{}),(0,B.jsx)(`span`,{}),(0,B.jsx)(`span`,{})]}),(0,B.jsx)(`span`,{role:`status`,className:r===null?void 0:`oc-sr-only`,children:e?Zn():tl()}),r===null?null:(0,B.jsx)(`span`,{className:`oc-turn-activity__progress`,title:r,children:r}),o===null?null:(0,B.jsx)(`span`,{className:`oc-turn-activity__clock`,role:`timer`,children:o})]})}function SLe({version:e}){return(0,B.jsxs)(`div`,{className:`oc-chat-banner oc-chat-banner--warn`,role:`status`,children:[(0,B.jsx)(Zx,{size:16,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:e===null?Ane():nh({version:e})})]})}function CLe(){return(0,B.jsxs)(`div`,{className:`oc-chat-banner oc-chat-banner--warn`,role:`status`,children:[(0,B.jsx)(Zx,{size:16,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:lte()})]})}function wLe({reason:e,canSwitchAgent:t}){let n=e===`instance_unreachable`?t?ai():Lu():pre();return(0,B.jsxs)(`div`,{className:`oc-chat-banner oc-chat-banner--error`,role:`status`,children:[(0,B.jsx)(Zx,{size:16,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:n})]})}function TLe({reason:e,guest:t}){let n=e===`viewer`?ore():t?Rte():jp();return(0,B.jsxs)(`div`,{className:`oc-chat-banner ${e===`viewer`?`oc-chat-banner--info`:`oc-chat-banner--error`}`,role:`status`,children:[(0,B.jsx)(ES,{size:16,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:n})]})}function ELe({chatId:e}){let t=P(L.messages.listByChat,{chatId:e}),[n,r]=(0,z.useState)(``),i=(0,z.useRef)(null);return(0,z.useEffect)(()=>{i.current=null,r(``)},[e]),(0,z.useEffect)(()=>{if(!t)return;let e;for(let n of t)n.role===`assistant`&&(e=n);if(!(!e||e.status!==`complete`)){if(i.current===null){i.current=e._id;return}i.current!==e._id&&(i.current=e._id,r(e=>e===_()?`${_()} `:_()))}},[t]),(0,B.jsx)(`div`,{"aria-live":`polite`,"aria-atomic":`true`,className:`oc-sr-only`,children:n})}function DLe(){return(0,B.jsxs)(`div`,{className:`oc-emptystate`,children:[(0,B.jsx)(l8,{className:`oc-emptystate__avatar`}),(0,B.jsx)(`h2`,{className:`oc-emptystate__title`,children:Qo()})]})}function f8({chatId:e,viewerRole:t}){let n=c8()?.nextTarget??null,r=r6(P(L.agents.usageForChat,t===`participant`?`skip`:{chatId:e,...n?{routedAgent:{instanceName:n.instanceName,agentId:n.agentId}}:{}})?.usage??null,Date.now());if(!r)return null;let i=r.windows.map(e=>`${e.provider} ${e.label}: ${e.percentLeft}%`+(e.resetText?` ⏱${e.resetText}`:``)).join(` · `);return(0,B.jsxs)(`span`,{className:`oc-meter ${r.level}`,title:yr({detail:i}),children:[(0,B.jsx)(`span`,{className:`oc-meter__track`,children:(0,B.jsx)(`span`,{className:`oc-meter__fill`,style:{width:`${r.percentLeft}%`}})}),(0,B.jsx)(`span`,{className:`oc-meter__label`,children:Bi({pct:r.percentLeft})})]})}function p8({sm:e,detail:t=!0}){let n=H4(e),r=MNe(e),i=W4(e),a=n!=null&&i?Math.round(n/i*100):null;if(a==null||n==null)return i?(0,B.jsx)(`span`,{className:`oc-meter is-unknown`,title:Cr(),role:`status`,children:(0,B.jsx)(`span`,{className:`oc-meter__label`,children:`—`})}):null;let o=a>=90?`is-critical`:a>=75?`is-warn`:`is-ok`,s=LNe(e);return(0,B.jsxs)(`span`,{className:`oc-meter ${o}`,title:`${Ee({pct:a,used:B4(n),total:B4(i)})}\n${r===`budget_estimate`?Wie():bs()}${s?`\n${Wi({gateway:s.gateway,delta:s.delta})}`:``}`,children:[(0,B.jsx)(`span`,{className:`oc-meter__track`,children:(0,B.jsx)(`span`,{className:`oc-meter__fill`,style:{width:`${Math.min(a,100)}%`}})}),(0,B.jsxs)(`span`,{className:`oc-meter__label`,children:[a,`%`,t?(0,B.jsxs)(`span`,{className:`oc-meter__detail`,children:[` · `,B4(n),`/`,B4(i)]}):null]})]})}function OLe({chatId:e}){let t=P(L.messages.getSessionMeta,{chatId:e}),n=wx(),r=P(L.projects.listProjects,{}),i=(0,z.useMemo)(()=>{let e=t?.projectId??null;return e===null||r===void 0?[]:k2(r,e)},[t?.projectId,r]),a=t?.sessionMeta??null,o=t?.sessionSettings??null,s=e8(),c=z6(),[l,u]=(0,z.useState)(!1),d=(0,z.useRef)(null),f=(0,z.useRef)(null),p=(0,z.useRef)(null),[m,h]=(0,z.useState)(!1),g=CIe(a),_=!z4(o,`thinkingLevel`),v=(n,r)=>(0,B.jsxs)(B.Fragment,{children:[s.showTools&&!n&&a?.model?(0,B.jsxs)(`span`,{className:`oc-chip oc-chip--info`,title:a.modelProvider?On({provider:a.modelProvider}):bi(),children:[(0,B.jsx)(jLe,{}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:a.model})]}):null,s.showTools&&!n&&a?.thinkingLevel?(0,B.jsxs)(`span`,{className:`oc-chip oc-chip--info`,title:_?kl():Mc(),children:[(0,B.jsx)(MLe,{}),(0,B.jsxs)(`span`,{className:`oc-chip__label`,children:[$n(),`\xA0: `,V4(a.thinkingLevel)]}),_?(0,B.jsx)(`span`,{className:`oc-chip__hint`,children:rl()}):null]}):null,g?(0,B.jsxs)(`span`,{className:`oc-chip oc-chip--info`,title:g.title,children:[(0,B.jsx)(ES,{size:13,"aria-hidden":!0}),n?(0,B.jsx)(`span`,{className:`sr-only`,children:g.label}):(0,B.jsx)(`span`,{className:`oc-chip__label`,children:g.label})]}):null,s.showTools&&a?(0,B.jsx)(p8,{sm:a,detail:!n}):null,s.showUsage&&!a?(0,B.jsx)(f8,{chatId:e,viewerRole:t?.viewerRole}):null,(0,B.jsx)(hLe,{compact:n,ghost:r}),(0,B.jsx)(kLe,{chatId:e,title:t?.title??null,compact:n,ghost:r}),a&&t?.viewerRole===`owner`?(0,B.jsx)(ALe,{chatId:e,viewerRole:t?.viewerRole,sm:a,settings:o,onOpenPanel:()=>u(!0),compact:n,ghost:r,showUsage:s.showUsage}):null]});return(0,z.useLayoutEffect)(()=>{let e=d.current;if(!e)return;let t=()=>{let t=p.current?.offsetWidth??0;if(t===0)return;let n=Math.min(f.current?.scrollWidth??0,360),r=e.clientWidth-n-16<t;h(e=>e===r?e:r)};t();let n=new ResizeObserver(t);return n.observe(e),p.current&&n.observe(p.current),()=>n.disconnect()},[[ca(),c===null?``:`${+(c.rows.length>0)}:${c.waiting.length}`,$a(),t?.viewerRole??``,a?.model??``,a?.thinkingLevel??``,g?.label??``,t?.title??``,i.map(e=>e.name).join(`/`),s.showTools?`1`:`0`].join(`|`)]),(0,B.jsxs)(`header`,{className:`oc-chathead`,ref:d,children:[(0,B.jsxs)(`div`,{className:`oc-chathead__titlebox`,ref:f,children:[i.length>0?(0,B.jsx)(`nav`,{className:`oc-chathead__crumbs`,"aria-label":qte(),children:i.map((e,t)=>(0,B.jsxs)(`span`,{className:`oc-chathead__crumb`,children:[t>0?(0,B.jsx)(`span`,{className:`oc-chathead__crumbsep`,"aria-hidden":!0,children:`›`}):null,(0,B.jsx)(`button`,{type:`button`,className:`oc-chathead__crumblink`,onClick:()=>void n({to:`/project/$projectId`,params:{projectId:e._id}}),children:e.name})]},e._id))}):null,(0,B.jsx)(`div`,{className:`oc-chathead__title`,title:t?.title??void 0,children:t?.title||Xu()})]}),(0,B.jsx)(`div`,{className:`oc-chathead__meta`,children:v(m,!1)}),(0,B.jsx)(`div`,{className:`oc-chathead-ghost`,"aria-hidden":!0,ref:p,children:v(!1,!0)}),t?.viewerRole===`owner`?(0,B.jsx)(pIe,{chatId:e,open:l,onOpenChange:u}):null]})}function m8(e,t,n){let r=new Blob([e],{type:`${n};charset=utf-8`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=t,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}function kLe({chatId:e,title:t,compact:n=!1,ghost:r=!1}){let i=H_();async function a(n){let[r,a]=await Promise.all([i.query(L.messages.listByChat,{chatId:e}),i.query(L.messages.getStreamingText,{chatId:e})]),o=new Map(a.map(e=>[e.messageId,e.text])),s=r.map(e=>({role:e.role,text:e.status===`streaming`?o.get(e._id)??e.text:e.text,createdAt:e.updatedAt??e._creationTime,...e.quotedRefs!==void 0&&e.quotedRefs.length>0?{quotedExcerpts:e.quotedRefs.map(e=>e.excerpt)}:{},parts:e.parts.map(e=>({kind:e.kind,filename:`filename`in e?e.filename:void 0,name:`name`in e?e.name:void 0}))})),c=r.length>=200,l={title:t??void 0,truncated:c,exportedAt:Date.now()},u=uNe(t);n===`md`?m8(cNe(s,l),`${u}.md`,`text/markdown`):m8(lNe(s,l),`${u}.json`,`application/json`)}let o=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(oS,{size:13,"aria-hidden":!0}),n?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`oc-chip__label`,children:ca()}),(0,B.jsx)(cv,{size:13,className:`oc-chip__chev`,"aria-hidden":!0})]})]});return r?(0,B.jsx)(`span`,{className:`oc-chip oc-chip--btn`,children:o}):(0,B.jsxs)(NI,{children:[(0,B.jsx)(PI,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,className:`oc-chip oc-chip--btn`,title:ja(),children:o})}),(0,B.jsxs)(FI,{align:`end`,className:`w-44`,children:[(0,B.jsx)(LI,{children:ca()}),(0,B.jsx)(II,{onClick:()=>void a(`md`),children:bh()}),(0,B.jsx)(II,{onClick:()=>void a(`json`),children:j()})]})]})}function ALe({chatId:e,viewerRole:t,sm:n,settings:r,onOpenPanel:i,compact:a=!1,ghost:o=!1,showUsage:s=!1}){let[c,l]=(0,z.useState)(!1),u=c8(),d=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(lC,{size:13,"aria-hidden":!0}),a?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`oc-chip__label`,children:$a()}),(0,B.jsx)(cv,{size:13,className:`oc-chip__chev`,"aria-hidden":!0})]})]});return o?(0,B.jsx)(`span`,{className:`oc-chip oc-chip--btn`,children:d}):(0,B.jsxs)(AI,{open:c,onOpenChange:l,children:[(0,B.jsx)(jI,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,className:`oc-chip oc-chip--btn`,title:Wh(),children:d})}),(0,B.jsxs)(MI,{align:`end`,className:`oc-spanel-pop w-80 p-2`,children:[W4(n)?(0,B.jsxs)(`div`,{className:`oc-spanel-pop__usage`,children:[(0,B.jsx)(`span`,{className:`oc-spanel-pop__usage-label`,children:So()}),(0,B.jsx)(p8,{sm:n})]}):null,s?(0,B.jsxs)(`div`,{className:`oc-spanel-pop__usage`,children:[(0,B.jsx)(`span`,{className:`oc-spanel-pop__usage-label`,children:as()}),(0,B.jsx)(f8,{chatId:e,viewerRole:t})]}):null,(0,B.jsx)(X4,{chatId:e,sm:n,settings:r}),(0,B.jsx)(NIe,{chatId:e,routedAgent:u?.nextTarget?{instanceName:u.nextTarget.instanceName,agentId:u.nextTarget.agentId}:null,multiAgent:u?.perTurnRouting===!0||(u?.roomAgents?.length??0)>0}),(0,B.jsxs)(`button`,{type:`button`,className:`oc-spanel-pop__all`,onClick:()=>{l(!1),i()},children:[(0,B.jsx)(lC,{size:13,"aria-hidden":!0}),ine(),(0,B.jsx)(Yx,{size:13,"aria-hidden":!0})]})]})]})}function jLe(){return(0,B.jsxs)(`svg`,{className:`oc-chip__icon`,viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:[(0,B.jsx)(`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`}),(0,B.jsx)(`rect`,{x:`9`,y:`9`,width:`6`,height:`6`}),(0,B.jsx)(`path`,{d:`M9 1v3M15 1v3M9 20v3M15 20v3M20 9h3M20 14h3M1 9h3M1 14h3`})]})}function MLe(){return(0,B.jsxs)(`svg`,{className:`oc-chip__icon`,viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:[(0,B.jsx)(`path`,{d:`M12 5a3 3 0 1 0-5.997.142 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`}),(0,B.jsx)(`path`,{d:`M12 5a3 3 0 1 1 5.997.142 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z`})]})}function h8({children:e}){return(0,B.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:e})}function NLe(){return(0,B.jsx)(h8,{children:(0,B.jsx)(`path`,{d:`M12 5v14M19 12l-7 7-7-7`})})}var PLe=`bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 oc-overlay-layer min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md`,g8=`focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`;function FLe({sourceShown:e,sourceActive:t,onToggleSource:n}){let r=U(e=>e.metadata?.custom?.messageId),i=U(e=>e.metadata?.custom?.sentAt),a=U(e=>e.metadata?.custom?.generationMs??null),o=U(e=>e.metadata?.custom?.status===`streaming`),s=I(L.chatFork.forkChat),c=(0,z.useContext)(a8),l=y4(),u=EL(),[d,f]=(0,z.useState)(!1);if(!r)return null;let p=async()=>{let e=await l({title:Tm(),description:sne(),label:em(),placeholder:pee(),confirmLabel:Xm(),allowEmpty:!0});if(e!==null){f(!0);try{let{chatId:t}=await s({branchMessageId:r,...e.trim()?{title:e.trim()}:{}});w4(t,{expand:!0}),u.success(ite())}catch(e){u.error(Tp(),e)}finally{f(!1)}}};return(0,B.jsxs)(rF.Root,{children:[(0,B.jsx)(rF.Trigger,{className:`oc-iconbtn`,title:Wr(),"aria-label":Wr(),disabled:d,children:(0,B.jsx)(cS,{size:15})}),(0,B.jsxs)(rF.Content,{align:`end`,sideOffset:4,className:PLe,children:[i===void 0?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`oc-msgmenu__when px-2 py-1.5 text-sm`,children:[n$(i,{dateStyle:`medium`,timeStyle:`short`}),(()=>{let e=a===null?null:i$(a);return e===null?null:(0,B.jsxs)(`span`,{className:`oc-msgmenu__duration`,children:[(0,B.jsx)(_C,{size:12,"aria-hidden":!0}),rh({duration:e})]})})()]}),(0,B.jsx)(rF.Separator,{className:`bg-border -mx-1 my-1 h-px`})]}),e?(0,B.jsxs)(rF.Item,{className:g8,onSelect:n,children:[(0,B.jsx)(nS,{size:14,"aria-hidden":!0}),t?Ec():L_()]}):null,c?(0,B.jsxs)(rF.Item,{className:g8,disabled:d||o,onSelect:()=>void p(),children:[(0,B.jsx)(ese,{size:14,"aria-hidden":!0}),Tm()]}):null,(0,B.jsx)(ILe,{})]})]})}function ILe(){let e=lL(),t=U(e=>e.id);if(!e)return null;let n=e.byMessage.get(t)?.some(e=>e.blockIndex===null)??!1;return(0,B.jsxs)(rF.Item,{className:g8,onSelect:()=>e.toggle(t,null),children:[(0,B.jsx)(Ux,{size:14,"aria-hidden":!0}),n?Ni():Bg()]})}function LLe(){let[e,t]=(0,z.useState)(!1),n=U(e=>e.content.filter(e=>e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(`
|
|
437
|
+
`)),r=M$(U(e=>e.metadata?.custom?.error??null),U(e=>e.metadata?.custom?.errorCode??null)),i=n.trim()||[r.headline,r.detail].filter(Boolean).join(`
|
|
438
|
+
`),a=i.length===0;return(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn`,title:Pd(),"aria-label":Pd(),disabled:a,onClick:()=>{navigator.clipboard.writeText(i).then(()=>{t(!0),window.setTimeout(()=>t(!1),1500)})},children:e?(0,B.jsx)(v8,{}):(0,B.jsx)(_8,{})})}function RLe(e){let t=(0,z.useContext)(Y6),n=(0,z.useContext)(X6),r=U(e=>e.metadata?.custom?.messageId??e.id),i=e8().autoReadAloud,a=U(e=>e.metadata?.custom?.status??``),o=(0,z.useRef)(null);(0,z.useEffect)(()=>{if(!t.loaded)return;let s=o.current;o.current=a,!(!t.enabled||!t.autoRead||t.engine===`gateway`||!i||!ew())&&(a!==`complete`||s===null||s===`complete`||e.trim()&&tw($C(e),{lang:QC(t.lang,Nm()),rate:t.rate,onEnd:()=>n.clearIf(r)})&&n.setActive({messageId:r,phase:`playing`}))},[a,e,t,n,r,i])}function zLe(){let e=(0,z.useContext)(Y6),t=(0,z.useContext)(X6),n=mf(L.voice.gatewayTts),r=EL(),i=U(e=>e.metadata?.custom?.messageId??e.id),a=U(e=>e.metadata?.custom?.chatId??null),o=U(e=>e.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
439
|
+
`)),s=e.engine!==`gateway`;if(!e.enabled||!o.trim()||s&&!ew())return null;let c=QC(e.lang,Nm()),l=t.active?.messageId===i,u=l&&t.active?.phase===`loading`,d=l&&t.active?.phase===`playing`,f=()=>{Q6();let l=$C(o);if(s){let n=tw(l,{lang:c,rate:e.rate,onEnd:()=>t.clearIf(i)});t.setActive(n?{messageId:i,phase:`playing`}:null);return}if(!a)return;let u=Z6;t.setActive({messageId:i,phase:`loading`}),n({chatId:a,text:l.slice(0,1500)}).then(({mime:n,audioBase64:r})=>{if(u!==Z6)return;let a=sw(r,n,{rate:e.rate,onEnd:()=>t.clearIf(i)});t.setActive(a?{messageId:i,phase:`playing`}:null)}).catch(e=>{u===Z6&&(r.error(ere(),e),t.setActive(null))})};return(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn${l?` oc-iconbtn--reading`:``}`,title:l?wd():h_(),"aria-label":l?wd():h_(),"aria-pressed":l,"aria-busy":u,onClick:()=>{if(l){Q6(),t.setActive(null);return}f()},children:u?(0,B.jsx)(wS,{size:16,className:`oc-actrow__spin`,"aria-hidden":!0}):d?(0,B.jsx)(HLe,{}):(0,B.jsx)(VLe,{})})}function BLe(){let e=(0,z.useContext)(X6);if(!e.active)return null;let t=e.active.phase===`loading`;return(0,B.jsxs)(`div`,{className:`oc-reading-banner`,role:`status`,children:[t?(0,B.jsx)(wS,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsx)(wC,{size:14,className:`oc-reading-banner__pulse`,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:t?jte():Kd()}),(0,B.jsx)(`button`,{type:`button`,className:`oc-reading-banner__stop`,onClick:()=>{Q6(),e.setActive(null)},children:wd()})]})}function VLe(){return(0,B.jsxs)(h8,{children:[(0,B.jsx)(`path`,{d:`M11 5 6 9H2v6h4l5 4V5z`}),(0,B.jsx)(`path`,{d:`M15.5 8.5a5 5 0 0 1 0 7`})]})}function HLe(){return(0,B.jsxs)(h8,{children:[(0,B.jsx)(`path`,{d:`M11 5 6 9H2v6h4l5 4V5z`}),(0,B.jsx)(`line`,{x1:`22`,y1:`9`,x2:`16`,y2:`15`}),(0,B.jsx)(`line`,{x1:`16`,y1:`9`,x2:`22`,y2:`15`})]})}function _8(){return(0,B.jsxs)(h8,{children:[(0,B.jsx)(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`}),(0,B.jsx)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]})}function v8(){return(0,B.jsx)(h8,{children:(0,B.jsx)(`path`,{d:`M20 6 9 17l-5-5`})})}function ULe({text:e}){let t=(e??``).trim();return t?(0,B.jsx)(`div`,{className:`oc-msg__segment`,role:`note`,children:t}):null}function WLe({text:e}){let t=U(e=>e.metadata?.custom?.mentions??null);if(t===null||t.length===0)return(0,B.jsx)(B.Fragment,{children:e});let n=[],r=0;for(let[i,a]of t.entries())a.start<r||a.end>e.length||(a.start>r&&n.push(e.slice(r,a.start)),n.push((0,B.jsx)(`span`,{className:`oc-mention${a.isViewer?` oc-mention--self`:``}${a.isAgent===!0?` oc-mention--agent`:``}`,title:a.name,children:e.slice(a.start,a.end)},`${a.start}-${i}`)),r=a.end);return r<e.length&&n.push(e.slice(r)),(0,B.jsx)(B.Fragment,{children:n})}var y8={File:tIe,Text:WLe},GLe={...y8,Text:Ewe,Reasoning:ULe,data:{by_name:{widget:cMe}},tools:{by_name:{__turn_flow__:CFe,__delegated_reply__:XLe}}};function b8({kind:e}){let t=U(e=>e.metadata?.custom?.messageId),n=I(L.messages.deleteMessage).withOptimisticUpdate(pFe),r=v4(),i=EL(),a=(0,z.useContext)(t8),[o,s]=(0,z.useState)(!1),c=XA(e=>e.isRunning);if(!t)return null;async function l(){if(await r(e===`assistant`?{title:lt(),description:jt(),confirmLabel:oc(),cancelLabel:b_(),destructive:!0}:{title:Ge(),description:Rs(),confirmLabel:z_(),cancelLabel:b_(),destructive:!0})){s(!0),e===`assistant`&&a?.begin();try{await n({messageId:t})}catch(t){e===`assistant`&&a?.cancel(),i.error(fd(),t)}finally{s(!1)}}}return(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn oc-iconbtn--danger`,title:c?pc():e===`assistant`?lf():bie(),"aria-label":Wre(),"aria-busy":o,disabled:o||c,onClick:()=>void l(),children:o?(0,B.jsx)(wS,{size:15,className:`oc-iconbtn__spin`,"aria-hidden":!0}):(0,B.jsx)(vC,{size:15,"aria-hidden":!0})})}function x8(){let e=U(e=>e.metadata?.custom?.rawText??``),t=U(e=>e.metadata?.custom?.chatId),n=U(e=>e.metadata?.custom?.messageId),r=U(e=>e.metadata?.custom?.allToolParts??e.metadata?.custom?.toolParts??S8),i=P(L.subAgents.listSubAgents,e===``&&t?{chatId:t}:`skip`),a=e===``?R$(i??[],K3(r),n).find(e=>e.status===`done`&&e.resultText)?.resultText??``:``,o=e===``&&a!==``,s=e===``?a:e,[c,l]=(0,z.useState)(!1),u=[...s].length;return(0,B.jsxs)(`div`,{className:`oc-msg__source`,children:[(0,B.jsxs)(`div`,{className:`oc-msg__source-head`,children:[(0,B.jsx)(`span`,{className:`oc-msg__source-label`,children:o?xo({count:u}):u>1?fg({count:u}):ye({count:u})}),(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn`,title:At(),"aria-label":At(),onClick:()=>{navigator.clipboard?.writeText(s).then(()=>{l(!0),window.setTimeout(()=>l(!1),1200)})},children:c?(0,B.jsx)(v8,{}):(0,B.jsx)(_8,{})})]}),(0,B.jsx)(`pre`,{className:`oc-msg__source-pre`,children:s.length>0?s:$t()})]})}function KLe({active:e,onToggle:t}){return(0,B.jsx)(`button`,{type:`button`,className:`oc-iconbtn${e?` is-on`:``}`,onClick:t,"aria-pressed":e,title:e?Ec():L_(),"aria-label":ct(),children:(0,B.jsx)(nS,{size:15,"aria-hidden":!0})})}function qLe(){let[e,t]=(0,z.useState)(!1),n=e8(),r=U(e=>e.id.startsWith(`optimistic-`)),i=U(e=>e.metadata?.custom?.queued===!0),a=U(e=>e.id),o=U(e=>e.metadata?.custom?.quotedRefs??null),s=EL(),c=U(e=>e.metadata?.custom?.authorName??null);return(0,B.jsx)(vI.Root,{className:`oc-msg oc-msg--user${r?` is-sending`:``}${i?` is-queued`:``}`,"data-message-id":a,children:(0,B.jsxs)(`div`,{className:`oc-msg__col oc-msg__col--user`,children:[(0,B.jsx)(gL,{}),c===null?null:(0,B.jsx)(`div`,{className:`oc-msg__author`,children:Xee({name:c})}),o?.map((e,t)=>(0,B.jsxs)(`button`,{type:`button`,className:`oc-msg__quote`,title:Fc(),onClick:e.messageId?()=>w8(e.messageId,e.blockIndex,s):void 0,children:[(0,B.jsx)(XS,{size:12,"aria-hidden":!0,className:`oc-msg__quote-ico`}),(0,B.jsx)(`span`,{className:`oc-msg__quote-text`,children:e.excerpt})]},`${e.messageId??`orphan`}:${e.blockIndex??`all`}:${t}`))??null,(0,B.jsx)(`div`,{className:`oc-msg__bubble`,children:e?(0,B.jsx)(x8,{}):(0,B.jsx)(vI.Parts,{components:y8})}),r?(0,B.jsxs)(`span`,{className:`oc-msg__sending`,role:`status`,children:[(0,B.jsx)(`span`,{className:`oc-msg__sending-spin`,"aria-hidden":!0}),yie()]}):i?(0,B.jsxs)(`span`,{className:`oc-msg__queued`,role:`status`,children:[(0,B.jsx)(tS,{size:12,"aria-hidden":!0}),jf()]}):(0,B.jsxs)(lj.Root,{className:`oc-msg__actions oc-msg__actions--user`,autohide:`not-last`,children:[(0,B.jsx)(bL,{}),n.copyUser?(0,B.jsxs)(lj.Copy,{className:`oc-iconbtn`,title:ic(),children:[(0,B.jsx)(vI.If,{copied:!0,children:(0,B.jsx)(v8,{})}),(0,B.jsx)(vI.If,{copied:!1,children:(0,B.jsx)(_8,{})})]}):null,n.showSource?(0,B.jsx)(KLe,{active:e,onToggle:()=>t(e=>!e)}):null,n.showReport?(0,B.jsx)(d6,{}):null,n.showDelete?(0,B.jsx)(b8,{kind:`user`}):null]})]})})}function JLe({pool:e,agent:t}){let n=u4(e,t),r=n?.displayName??t.agentId;return(0,B.jsxs)(`span`,{className:`oc-chip oc-chip--agent oc-msg__agent`,title:nu({name:r}),children:[n?.emoji?(0,B.jsx)(`span`,{className:`oc-chip__emoji`,"aria-hidden":!0,children:n.emoji}):(0,B.jsx)(Wx,{size:13,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-chip__label`,children:r})]})}var S8=[],YLe=[];function C8(){let e=(0,z.useRef)(null),[t,n]=(0,z.useState)(null);return(0,z.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=()=>{let e=0;try{e=t.getTotalLength()}catch{e=0}if(!e){let n=t.getBoundingClientRect();e=2*(n.width+n.height)}e>0&&n(Math.round(e))};r();let i=new ResizeObserver(r);return i.observe(t.ownerSVGElement??t),()=>i.disconnect()},[]),(0,B.jsxs)(`svg`,{className:`oc-empty-answer__ants`,"aria-hidden":!0,children:[(0,B.jsx)(`rect`,{ref:e}),t===null?null:(0,B.jsx)(`rect`,{className:`oc-ants-accent`,style:{strokeDasharray:`3 3 3 3 3 ${Math.max(t-15,6)}`,animationDuration:`${Math.max(t*4,800)}ms`,animationTimingFunction:`steps(${Math.max(Math.round(t/6),8)}, end)`,"--oc-ants-p":`${t}px`}})]})}function XLe(e){let t=U(e=>e.metadata?.custom?.chatId),n=U(e=>e.metadata?.custom?.messageId),r=LFe(P(L.subAgents.listSubAgents,t?{chatId:t}:`skip`),n,e.args?.slot);return r.length===0?null:(0,B.jsx)(B.Fragment,{children:r.map(e=>(0,B.jsxs)(`div`,{className:`oc-delegated-reply`,children:[e.agentId?(0,B.jsxs)(`div`,{className:`oc-empty-answer__from`,role:`note`,children:[(0,B.jsx)(iS,{size:13,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:Yd({agent:e.agentId})})]}):null,(0,B.jsx)(yQ,{text:e.resultText})]},e.childSessionKey))})}function ZLe({show:e}){let t=U(e=>e.metadata?.custom?.status),n=U(e=>e.metadata?.custom?.chatId),r=U(e=>N$(e.content)),i=U(e=>e.content.some(e=>e?.type===`file`||e?.type===`data`&&e.name===`widget`)),a=U(e=>e.metadata?.custom?.allToolParts??e.metadata?.custom?.toolParts??S8),o=P(L.subAgents.listSubAgents,n?{chatId:n}:`skip`),s=U(e=>e.metadata?.custom?.messageId),c=U(e=>e.metadata?.custom?.settledAt??void 0),l=U(e=>e.metadata?.custom?.hasContinuation===!0),u=U(e=>e.metadata?.custom?.answeredChildRunIds??YLe),[,d]=(0,z.useState)(0),f=Z3({status:t,hasText:r,hasMedia:i,settledAt:c,delegatedInline:l,answeredChildRunIds:u},a,o,s),p=f.kind===`composing`?f.recheckAt:f.kind===`waiting`?f.recheckAt??null:null;return(0,z.useEffect)(()=>{if(p===null)return;let e=window.setTimeout(()=>d(e=>e+1),Math.max(p-Date.now(),0)+250);return()=>window.clearTimeout(e)},[p]),f.kind===`none`?null:f.kind===`composing`?(0,B.jsxs)(`div`,{className:`oc-empty-answer oc-empty-answer--waiting`,role:`status`,children:[(0,B.jsx)(C8,{}),(0,B.jsx)(wS,{size:15,className:`oc-empty-answer__spin`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-empty-answer__text`,children:f.taskName?Oee({task:f.taskName}):Lre()})]}):f.kind===`failed`?e&&f.cardSilent!==!0?null:(0,B.jsxs)(`div`,{className:`oc-empty-answer oc-empty-answer--failed`,role:`status`,children:[(0,B.jsx)(Wx,{size:15,className:`oc-empty-answer__icon`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-empty-answer__text`,children:f.taskName?nre({task:f.taskName,reason:f.reason}):Gf({reason:f.reason})})]}):f.kind===`waiting`?e&&f.recheckAt===void 0?null:(0,B.jsxs)(`div`,{className:`oc-empty-answer oc-empty-answer--waiting`,role:`status`,children:[(0,B.jsx)(C8,{}),(0,B.jsx)(wS,{size:15,className:`oc-empty-answer__spin`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-empty-answer__text`,children:f.taskName?mp({task:f.taskName}):ree()})]}):f.kind===`done`?f.resultText?(0,B.jsxs)(B.Fragment,{children:[f.agentId?(0,B.jsxs)(`div`,{className:`oc-empty-answer__from`,role:`note`,children:[(0,B.jsx)(iS,{size:13,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:Yd({agent:f.agentId})})]}):null,(0,B.jsx)(yQ,{text:f.resultText})]}):null:(0,B.jsxs)(`div`,{className:`oc-empty-answer oc-empty-answer--generic`,role:`status`,children:[(0,B.jsx)(Wx,{size:15,className:`oc-empty-answer__icon`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-empty-answer__text`,children:Nte()})]})}function QLe(){let[e,t]=(0,z.useState)(!1),n=e8(),r=$2(),i=U(e=>e.id),a=(0,z.useContext)(o8),o=EL(),s=(0,z.useCallback)((e,t)=>{let n=xse(e,t);n===`too-many`?o.error(et({count:10})):n===`too-long`&&o.error(Ys())},[o]),c=U(e=>e.metadata?.custom?.rawText??``),l=U(e=>e.status?.type===`running`),u=U(e=>e.metadata?.custom?.chatId),d=U(e=>e.metadata?.custom?.messageId),f=U(e=>e.metadata?.custom?.status),p=U(e=>e.content.some(e=>e?.type===`file`)),m=U(e=>e.metadata?.custom?.allToolParts??e.metadata?.custom?.toolParts??S8),h=P(L.subAgents.listSubAgents,c===``&&u?{chatId:u}:`skip`),g=c===``?Z3({status:f,hasText:!1,hasMedia:p},m,h,d):null,_=c===``?g?.kind===`done`?g.resultText??``:``:c,v=(0,z.useContext)(V3),y=v!==null&&v.messageId===i?v:null,b=U(e=>e.metadata?.custom?.status),x=(0,z.useContext)(H3);RLe(U(e=>e.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
440
|
+
`)));let S=c8(),C=S&&S.perTurnRouting?S.messageAgents.has(i)?S.messageAgents.get(i)??S.primary:S.fallbackAgent:null,w=S?.pool,T=U(e=>e.metadata?.custom?.importedAgentLabel??null),E=(0,z.useMemo)(()=>{if(T!==null)return{...r,agentName:T,agentEmoji:null};if(!C)return r;let e=u4(w??[],C);return{...r,agentName:e?.displayName??C.agentId,agentEmoji:e?.emoji??null}},[T,C,r,w]);return b===void 0&&x?null:(0,B.jsxs)(vI.Root,{className:`oc-msg oc-msg--assistant`,"data-message-id":i,children:[(0,B.jsx)(l8,{className:`oc-msg__avatar`}),(0,B.jsxs)(`div`,{className:`oc-msg__col`,children:[(0,B.jsxs)(`div`,{className:`oc-msg__name`,children:[C?(0,B.jsx)(JLe,{pool:S.pool,agent:C}):(0,B.jsxs)(B.Fragment,{children:[r.agentEmoji?(0,B.jsx)(`span`,{className:`oc-msg__name-emoji`,"aria-hidden":!0,children:r.agentEmoji}):null,e4(r)]}),(0,B.jsx)(bL,{header:!0}),a!==null&&!i.startsWith(`optimistic-`)&&!l&&_!==``?(0,B.jsx)(`button`,{type:`button`,className:`oc-bmk-headbtn`,title:jn(),"aria-label":jn(),onClick:()=>{let e=qI(_,280);e!==``&&s(a,{messageId:i,blockIndex:null,excerpt:e})},children:(0,B.jsx)(XS,{size:13})}):null]}),(0,B.jsxs)(`div`,{className:`oc-msg__body`,children:[(0,B.jsx)(xFe,{}),(0,B.jsx)(`div`,{className:`oc-msg__meta oc-msg__meta--cron`,children:(0,B.jsx)($L,{})}),n.showTools?(0,B.jsxs)(`div`,{className:`oc-msg__meta`,children:[(0,B.jsx)(_Ne,{}),(0,B.jsx)(HFe,{}),(0,B.jsx)(TFe,{}),(0,B.jsx)(rTe,{})]}):null,(0,B.jsx)(GFe,{}),e?(0,B.jsx)(x8,{}):(0,B.jsx)(vI.Parts,{components:GLe}),e?null:(0,B.jsx)(ZLe,{show:n.showTools}),(0,B.jsx)(fLe,{}),(0,B.jsx)(Q2.Provider,{value:E,children:(0,B.jsx)(_Fe,{})}),y===null?null:(0,B.jsx)(d8,{running:y.running,since:y.workingSince,progress:y.progressSummary??null,anchored:!0})]}),(0,B.jsx)(gL,{messageLevelMarkers:!1,onReplyToBlock:a!==null&&!i.startsWith(`optimistic-`)?(e,t)=>s(a,{messageId:i,blockIndex:e,excerpt:t}):void 0}),(0,B.jsxs)(lj.Root,{className:`oc-msg__actions`,autohide:`not-last`,children:[n.copyAssistant?(0,B.jsx)(LLe,{}):null,(0,B.jsx)(zLe,{}),n.showReport?(0,B.jsx)(d6,{}):null,n.showDelete?(0,B.jsx)(b8,{kind:`assistant`}):null,(0,B.jsx)(FLe,{sourceShown:n.showSource,sourceActive:e,onToggleSource:()=>t(e=>!e)})]})]})]})}function $Le(){let e=U(e=>e.id);return(0,B.jsx)(vI.Root,{className:`oc-msg oc-msg--system`,"data-message-id":e,children:(0,B.jsx)(`div`,{className:`oc-msg__body`,children:(0,B.jsx)(vI.Parts,{components:y8})})})}function w8(e,t,n){if(document.querySelector(`[data-message-id="${CSS.escape(e)}"]`)===null&&document.querySelector(`[data-message-id]`)!==null){n.error(Ml());return}uL(e,t,`smooth`)}function eRe({chatId:e}){let t=yw(e),n=EL();return t.length===0?null:(0,B.jsx)(`div`,{className:`oc-composer__quotes`,role:`group`,"aria-label":nr(),children:t.map(t=>(0,B.jsxs)(`div`,{className:`oc-composer__quote`,children:[(0,B.jsx)(XS,{size:13,"aria-hidden":!0,className:`oc-composer__quote-ico`}),(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__quote-text`,title:Fc(),onClick:()=>w8(t.messageId,t.blockIndex,n),children:t.excerpt}),(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__quote-x`,"aria-label":ol(),onClick:()=>hw(e,gw(t)),children:(0,B.jsx)(uv,{size:13,"aria-hidden":!0})})]},gw(t)))})}function tRe(){let e=qA(e=>e.status?.type),t=qA(e=>e.type),n=qA(e=>e.file??null),[r,i]=(0,z.useState)(null);(0,z.useEffect)(()=>{if(t!==`image`||!n){i(null);return}let e=URL.createObjectURL(n);return i(e),()=>URL.revokeObjectURL(e)},[t,n]);let a=e===`incomplete`,o=n!==null&&MQ(n),[s,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(null),d=(0,z.useRef)(null);d.current=n;let f=n!==null&&(n.type.startsWith(`text/`)||/\.(txt|md|json|csv|log|xml|yaml|yml)$/i.test(n.name));return(0,B.jsxs)(sF.Root,{className:`oc-attach${a?` oc-attach--error`:``}${r&&!a?` oc-attach--image`:``}${o?` oc-attach--flash`:``}`,"data-status":e,children:[r&&!a?(0,B.jsx)(`img`,{src:r,alt:``,className:`oc-attach__thumb`}):(0,B.jsx)(`span`,{className:`oc-attach__icon`,"aria-hidden":!0,children:a?(0,B.jsx)(Zx,{size:14}):t===`image`?(0,B.jsx)(ise,{size:14}):(0,B.jsx)(HS,{size:14})}),r&&!a?null:(0,B.jsx)(`span`,{className:`oc-attach__name`,children:(0,B.jsx)(sF.Name,{})}),a?(0,B.jsx)(`span`,{className:`oc-attach__state`,children:Qn()}):null,!a&&(f||r)?(0,B.jsx)(`button`,{type:`button`,className:`oc-attach__view`,"aria-label":ys(),title:ys(),onClick:()=>{if(c(!0),u(null),f&&n){let e=n,t=2e5;e.slice(0,t).text().then(n=>{d.current===e&&u(e.size>t?n+`
|
|
441
|
+
|
|
442
|
+
`+Sr():n)}).catch(()=>{d.current===e&&u(null)})}},children:(0,B.jsx)(dS,{size:13,"aria-hidden":!0})}):null,(0,B.jsx)(sF.Remove,{className:`oc-attach__remove`,"aria-label":Uie(),children:(0,B.jsx)(uv,{size:13,"aria-hidden":!0})}),(0,B.jsx)(s$,{open:s,onOpenChange:c,children:(0,B.jsxs)(c$,{className:`oc-attach__dialog`,children:[(0,B.jsx)(l$,{children:(0,B.jsx)(d$,{className:`oc-attach__dialog-title`,children:n?.name??ys()})}),r?(0,B.jsx)(`img`,{src:r,alt:``,className:`oc-attach__dialog-img`}):l===null?(0,B.jsx)(`p`,{className:`oc-attach__dialog-text`,children:`…`}):(0,B.jsx)(`pre`,{className:`oc-attach__dialog-text`,children:l})]})})]})}function nRe(){let e=(0,z.useSyncExternalStore)(z2.subscribe,z2.getSnapshot);return e.active?(0,B.jsxs)(`div`,{className:`oc-upload`,role:`status`,"aria-live":`polite`,children:[(0,B.jsxs)(`div`,{className:`oc-upload__head`,children:[(0,B.jsx)(wS,{className:`oc-upload__spin`,size:14,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:e.count>1?Te({count:e.count,percent:e.percent}):nl({percent:e.percent})})]}),(0,B.jsx)(`div`,{className:`oc-upload__track`,"aria-hidden":!0,children:(0,B.jsx)(`div`,{className:`oc-upload__bar`,style:{width:`${e.percent}%`}})})]}):null}function rRe({reason:e}){let t=(0,z.useContext)(n8),n=JA(),r=Jue(e=>e.text).trim().length>0,i=e===`subagent`;return(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__send`,disabled:!r||t===null,"aria-label":i?ff():Ke(),title:r?i?Cie():Bs():i?sie():aie(),onClick:()=>{if(t===null)return;let e=n.getState().text;e.trim()!==``&&t(e).then(e=>{e&&n.setText(``)})},children:(0,B.jsx)(zx,{size:18,"aria-hidden":!0})})}function iRe(){let e=(0,z.useContext)(i8);return e===null?null:(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__send oc-composer__stop`,"aria-label":eo(),title:dt(),onClick:()=>void e(),children:(0,B.jsx)(pC,{size:14,"aria-hidden":!0})})}function aRe({chatId:e,gate:t,onManage:n}){let r=c8(),i=P(L.chatAgents.listChatAgents,{chatId:e}),a=i?r4(i.viewerRoomRole):!1,o=EL(),[s,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(`agents`),[d,f]=(0,z.useState)(``),[p,m]=(0,z.useState)(`member`),h=a4(i?.viewerRoomRole),g=o4(p,i?.viewerRoomRole),[_,v]=(0,z.useState)(!1),[y,b]=(0,z.useState)(!1);(0,z.useEffect)(()=>{m(`member`),f(``),v(!1),b(!1)},[e]);let x=P(L.chatParticipants.listInvitable,a&&s&&l===`people`?{chatId:e}:`skip`),S=I(L.chatParticipants.addMember),C=I(L.chatParticipants.removeMember),w=t=>{C({chatId:e,memberId:t.userId}).then(()=>o.success(r_({name:t.name}))).catch(()=>o.error(Du()))},T=P(L.chatAgents.listAddableAgents,a&&s&&l===`agents`?{chatId:e}:`skip`),E=I(L.chatAgents.addChatAgent),O=I(L.chatAgents.removeChatAgent),k=t=>{let n=t.displayName??t.agentId;O({chatId:e,instanceName:t.instanceName,agentId:t.agentId}).then(e=>{e.removed&&o.success(r_({name:n}))}).catch(()=>o.error(Qs()))},ee=t=>{E({chatId:e,instanceName:t.instanceName,agentId:t.agentId}).catch(e=>{let t=e instanceof Error?e.message:String(e),n=/chat_agents_limit:(\d+)/.exec(t);o.error(n===null?Z4(e)?vl():k_():ag({count:Number(n[1])}))})},[A,j]=(0,z.useState)(``),te=P(L.chatParticipants.listMembers,{chatId:e}),ne=JA(),M=r?.pool??[],N=r?.roomAgents??[],re=i==null?r?.primary??null:i.primary?{instanceName:i.primary.instanceName,agentId:i.primary.agentId}:null,ie=(0,z.useMemo)(()=>nNe(M,i?[i.primary,...i.agents]:[]),[M,i]),{room:ae,others:oe}=(0,z.useMemo)(()=>$Me(t4(ie,A),re,N),[ie,A,N,re]),se=(0,z.useMemo)(()=>eNe([...ie,...T??[]]),[ie,T]),le=t.onCall!=null&&!M.some(e=>s4(e,t.onCall));if(!r||t.hidden&&!n)return null;let ue=!t.hidden,{disabled:de}=t,pe=t=>{let n=_Pe(String(e),ne.getState().text,{instanceName:t.instanceName,agentId:t.agentId},i3(t.displayName??t.agentId));n!==null&&ne.setText(n)},me=t.onCall??r.primary,he=u4(M,me),ge=new Set((T??[]).map(e=>`${e.instanceName}\u0000${e.agentId}`)),_e=A.trim().toLocaleLowerCase(),ve=aNe(ie,T??[],A),ye=ve.slice(0,8),be=oe.length+ve.length,xe=f4({unfolded:_,searching:_e!==``,hereCount:ae.length}),Se=e=>{let t=se.has(`${e.instanceName}\u0000${e.agentId}`),n=ge.has(`${e.instanceName}\u0000${e.agentId}`),r=tNe(i?.viewerRoomRole,e,re,N),a=(0,B.jsxs)(`button`,{type:`button`,role:`option`,className:`oc-agentrow`,disabled:e.state===`deleted`||de||!ue,title:e.state===`deleted`?Dn():Bp({name:e.displayName??e.agentId}),onClick:()=>{pe(e),c(!1),j(``)},children:[(0,B.jsx)(`span`,{className:`oc-agentrow__glyph`,title:e.kind===`hermes`?`Hermes`:`OpenClaw`,children:(0,B.jsx)(R4,{kind:e.kind,size:16})}),(0,B.jsxs)(`span`,{className:`oc-agentrow__text`,children:[(0,B.jsxs)(`span`,{className:`oc-agentrow__name`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId,s4(e,re)?(0,B.jsx)(aS,{size:12,className:`oc-agentrow__primary`,"aria-label":D(),children:(0,B.jsx)(`title`,{children:D()})}):null]}),t?(0,B.jsx)(`span`,{className:`oc-agentrow__meta`,children:(0,B.jsx)(`span`,{className:`oc-agentrow__inst`,children:e.instanceName})}):null]}),(0,B.jsx)(Bx,{size:14,"aria-hidden":!0,className:`oc-agentrow__hover`})]},`${e.instanceName}/${e.agentId}`);if(!n&&!r)return a;let o=e.displayName??e.agentId;return(0,B.jsxs)(`div`,{className:`oc-agentrow-wrap`,children:[a,n?(0,B.jsx)(`button`,{type:`button`,className:`oc-agentrow__add`,title:vc(),"aria-label":vc(),onClick:()=>ee(e),children:(0,B.jsx)(YS,{size:14,"aria-hidden":!0})}):null,r?(0,B.jsx)(`button`,{type:`button`,className:`oc-agentrow__remove`,title:Eg({name:o}),"aria-label":Eg({name:o}),onClick:()=>k(e),children:(0,B.jsx)(uv,{size:14,"aria-hidden":!0})}):null]},`${e.instanceName}/${e.agentId}`)},Ce=+!!re+N.length,we=te?.length??1,Te=ce({agents:Ce,people:we,next:me?`${he?.displayName??me.agentId}${(se.has(`${me.instanceName}\u0000${me.agentId}`)||le)&&me?` (${me.instanceName})`:``}`:`—`}),Ee=(0,B.jsxs)(B.Fragment,{children:[ue&&M.length>6||a?(0,B.jsxs)(`div`,{className:`oc-agentlist__search`,children:[(0,B.jsx)($S,{size:14,"aria-hidden":!0}),(0,B.jsx)(`input`,{autoFocus:!0,value:A,onChange:e=>j(e.target.value),placeholder:Rg(),"aria-label":vi()})]}):null,de?(0,B.jsx)(`p`,{className:`oc-agentpicker__hint`,children:t.reason===`call-active`?Tu():qr()}):null,(0,B.jsxs)(`div`,{className:`oc-agentlist`,role:`listbox`,children:[ae.map(e=>Se(e)),ae.length>0&&be>0?(0,B.jsxs)(`button`,{type:`button`,className:`oc-agentlist__divider oc-agentlist__toggle`,"aria-expanded":xe,onClick:()=>v(!xe),children:[(0,B.jsx)(Yx,{size:13,"aria-hidden":!0,className:`oc-agentlist__chev`}),(0,B.jsx)(`span`,{children:fe()}),(0,B.jsx)(`span`,{className:`oc-agentlist__togglecount`,children:be})]}):null,xe?(0,B.jsx)(B.Fragment,{children:oe.map(e=>{let t=`${e.instanceName}\u0000${e.agentId}`,n=ge.has(t);return(0,B.jsxs)(`button`,{type:`button`,className:`oc-agentrow oc-agentrow--outside`,disabled:!n,onClick:()=>ee(e),title:n?vc():us(),children:[(0,B.jsx)(`span`,{className:`oc-agentrow__glyph`,children:(0,B.jsx)(R4,{kind:e.kind,size:16})}),(0,B.jsxs)(`span`,{className:`oc-agentrow__text`,children:[(0,B.jsxs)(`span`,{className:`oc-agentrow__name`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),se.has(t)?(0,B.jsx)(`span`,{className:`oc-agentrow__meta`,children:(0,B.jsx)(`span`,{className:`oc-agentrow__inst`,children:e.instanceName})}):null]}),n?(0,B.jsx)(YS,{size:14,"aria-hidden":!0,className:`oc-agentrow__hover`}):null]},`other/${e.instanceName}/${e.agentId}`)})}):null,xe&&ye.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`oc-agentlist__divider`,role:`presentation`,children:$e()}),ye.map(e=>(0,B.jsxs)(`button`,{type:`button`,className:`oc-agentrow`,onClick:()=>ee(e),title:vc(),children:[(0,B.jsx)(`span`,{className:`oc-agentrow__glyph`,children:(0,B.jsx)(R4,{kind:e.kind,size:16})}),(0,B.jsxs)(`span`,{className:`oc-agentrow__text`,children:[(0,B.jsxs)(`span`,{className:`oc-agentrow__name`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),se.has(`${e.instanceName}\u0000${e.agentId}`)?(0,B.jsx)(`span`,{className:`oc-agentrow__meta`,children:(0,B.jsx)(`span`,{className:`oc-agentrow__inst`,children:e.instanceName})}):null]}),(0,B.jsx)(YS,{size:14,"aria-hidden":!0,className:`oc-agentrow__hover`})]},`add/${e.instanceName}/${e.agentId}`))]}):null]})]}),De=(t,n)=>{let r=gPe(String(e),ne.getState().text,String(n),i3(t));r!==null&&ne.setText(r),c(!1)},Oe=d.trim().toLocaleLowerCase(),ke=(te??[]).filter(e=>Oe===``||e.name.toLocaleLowerCase().includes(Oe)),Ae=(x??[]).filter(e=>e.name.toLocaleLowerCase().includes(Oe)||(e.detail??``).toLocaleLowerCase().includes(Oe)),je=Ae.slice(0,8),Me=f4({unfolded:y,searching:Oe!==``,hereCount:ke.filter(e=>!e.isSelf).length}),Ne=t=>{S({chatId:e,memberId:t.userId,role:g}).then(()=>f(``)).catch(e=>{let t=e instanceof Error?e.message:String(e),n=/participants_limit:(\d+)/.exec(t);o.error(n===null?Du():iu({count:Number(n[1])}))})},Pe=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`oc-agentlist__search`,children:[(0,B.jsx)($S,{size:14,"aria-hidden":!0}),(0,B.jsx)(`input`,{value:d,onChange:e=>f(e.target.value),placeholder:a?G_():Js(),"aria-label":a?G_():Js()})]}),(0,B.jsx)(`div`,{className:`oc-agentlist__caption`,children:uo()}),(0,B.jsxs)(`div`,{className:`oc-agentlist`,role:`list`,children:[ke.map(e=>{let t=(0,B.jsxs)(`button`,{type:`button`,role:`listitem`,className:`oc-agentrow oc-agentrow--person`,disabled:e.isSelf,onClick:()=>De(e.name,e.userId),title:e.isSelf?void 0:bt({name:e.name}),children:[(0,B.jsx)(L4,{userId:String(e.userId),name:e.name}),(0,B.jsxs)(`span`,{className:`oc-agentrow__text`,children:[(0,B.jsxs)(`span`,{className:`oc-agentrow__name`,children:[e.name,e.isSelf?(0,B.jsx)(`span`,{className:`oc-agentrow__tag`,children:Td()}):null]}),(0,B.jsx)(`span`,{className:`oc-agentrow__meta`,children:(0,B.jsx)(oRe,{role:e.roomRole})})]}),(0,B.jsx)(Bx,{size:14,"aria-hidden":!0,className:`oc-agentrow__hover`})]},String(e.userId));return i4(i?.viewerRoomRole,e)?(0,B.jsxs)(`div`,{className:`oc-agentrow-wrap`,children:[t,(0,B.jsx)(`button`,{type:`button`,className:`oc-agentrow__remove`,title:Eg({name:e.name}),"aria-label":Eg({name:e.name}),onClick:()=>w(e),children:(0,B.jsx)(uv,{size:14,"aria-hidden":!0})})]},String(e.userId)):t}),a?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`oc-agentlist__divider oc-agentlist__divider--invite`,role:`presentation`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-agentlist__toggle`,"aria-expanded":Me,onClick:()=>b(!Me),children:[(0,B.jsx)(Yx,{size:13,"aria-hidden":!0,className:`oc-agentlist__chev`}),(0,B.jsx)(`span`,{children:xf()}),x!==void 0&&Ae.length>0?(0,B.jsx)(`span`,{className:`oc-agentlist__togglecount`,children:Ae.length}):null]}),Me?(0,B.jsxs)(`label`,{className:`oc-invite-as`,children:[(0,B.jsx)(`span`,{children:rd()}),(0,B.jsxs)(p$,{value:g,onValueChange:e=>m(e),children:[(0,B.jsx)(h$,{size:`sm`,className:`oc-invite-as__trigger`,children:(0,B.jsx)(m$,{})}),(0,B.jsx)(g$,{children:h.map(e=>(0,B.jsx)(_$,{value:e,children:$4(e)},e))})]})]}):null]}),Me?x===void 0?(0,B.jsx)(`p`,{className:`oc-agentpicker__hint`,children:jie()}):je.length===0?(0,B.jsx)(`p`,{className:`oc-agentpicker__hint`,children:Hm()}):je.map(e=>(0,B.jsxs)(`button`,{type:`button`,role:`listitem`,className:`oc-agentrow oc-agentrow--person`,onClick:()=>Ne(e),title:g_({name:e.name,role:$4(g)}),children:[(0,B.jsx)(L4,{userId:String(e.userId),name:e.name}),(0,B.jsxs)(`span`,{className:`oc-agentrow__text`,children:[(0,B.jsx)(`span`,{className:`oc-agentrow__name`,children:e.name}),e.detail?(0,B.jsx)(`span`,{className:`oc-agentrow__meta`,title:e.detail,children:(0,B.jsx)(`span`,{className:`oc-agentrow__model`,children:e.detail})}):null]}),(0,B.jsx)(xC,{size:14,"aria-hidden":!0,className:`oc-agentrow__hover`})]},String(e.userId))):null,Me&&Ae.length>je.length?(0,B.jsx)(`p`,{className:`oc-agentpicker__hint`,children:Lne({count:Ae.length-je.length})}):null]}):null]})]});return(0,B.jsxs)(`span`,{className:`oc-roompill`,children:[(0,B.jsxs)(AI,{open:s,onOpenChange:e=>{c(e),e||(j(``),v(!1),b(!1))},children:[(0,B.jsx)(jI,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-roompill__main`,title:t.reason===`call-active`?Tu():Te,"aria-label":Te,children:[(0,B.jsx)(CC,{size:16,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-roompill__count`,children:Ce+we})]})}),(0,B.jsxs)(MI,{align:`start`,className:`oc-composer__agent-pop p-0`,children:[(0,B.jsxs)(`div`,{className:`oc-roomtabs`,role:`tablist`,children:[(0,B.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":l===`agents`,className:`oc-roomtabs__tab`,onClick:()=>u(`agents`),children:[(0,B.jsx)(Wx,{size:14,"aria-hidden":!0}),ya(),(0,B.jsx)(`span`,{className:`oc-roomtabs__count`,children:Ce})]}),(0,B.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":l===`people`,className:`oc-roomtabs__tab`,onClick:()=>u(`people`),children:[(0,B.jsx)(CC,{size:14,"aria-hidden":!0}),Mh(),(0,B.jsx)(`span`,{className:`oc-roomtabs__count`,children:we})]})]}),l===`agents`?Ee:Pe]})]}),n?(0,B.jsxs)(NI,{children:[(0,B.jsx)(PI,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,className:`oc-roompill__chev`,title:tg(),"aria-label":tg(),children:(0,B.jsx)(cv,{size:13,"aria-hidden":!0})})}),(0,B.jsx)(FI,{align:`end`,className:`oc-roommenu`,children:(0,B.jsxs)(II,{onSelect:()=>n(`agents`,null),children:[(0,B.jsx)(rC,{"aria-hidden":!0}),Pu()]})})]}):null]})}function oRe({role:e}){let t=e===`owner`?Pe():e===`manager`?ev():e===`viewer`?Qi():Ds();return(0,B.jsxs)(`span`,{className:`oc-rolemark`,title:t,children:[(0,B.jsx)(e===`owner`?aS:e===`manager`?oC:e===`viewer`?dS:SC,{size:13,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:t})]})}function sRe(e){let t=(0,z.useContext)(Y6),n=JA(),r=EL(),[i,a]=(0,z.useState)(!1),[o,s]=(0,z.useState)(``),c=(0,z.useRef)(null),l=(0,z.useRef)(null),u=(0,z.useRef)(e);u.current=e;let d=(0,z.useSyncExternalStore)(zC,BC),f=d!==null&&d.targetChatId===e.chatId;(0,z.useEffect)(()=>()=>{c.current?.stop(),c.current=null,a(!1),s(``)},[e.chatId]);let p=(0,z.useCallback)(()=>{requestAnimationFrame(()=>{let t=e.rootRef.current?.querySelector(`.oc-composer__input`);t&&(t.scrollTop=t.scrollHeight)})},[]),m=QC(t.lang,Nm()),h=(0,z.useRef)(m);h.current=m;let g=(0,z.useRef)(e.voiceInput);g.current=e.voiceInput;let _=(0,z.useCallback)(()=>{let e=BC();e!==null&&e.targetChatId===u.current.chatId&&XC(),c.current?.stop(),c.current=null,a(!1),s(``)},[]),v=(0,z.useCallback)(()=>{if(!iw()){r.error(fc());return}let e=BC();if(e!==null&&e.targetChatId!==u.current.chatId&&e.recording){r.error(y());return}let t=u.current.chatId,i={h:null,boundToHold:!1};l.current=i;let o=aw({lang:m,onText:(e,r)=>{if(i.holdGen!==void 0&&i.holdGen!==UC())return;let a=BC();if(a!==null&&a.targetChatId===t){if(WC(e,r.paragraph),u.current.chatId===t){let e=BC();e!==null&&(n.setText(e.text),p())}return}if(u.current.chatId!==t)return;let o=n.getState().text;n.setText(ZC(o,e,r.paragraph)),p()},onInterim:e=>{if(i.holdGen!==void 0&&i.holdGen!==UC())return;let n=BC();n!==null&&n.targetChatId===t&&GC(e),s(e)},onEnd:()=>{i.boundToHold&&YC(i.holdGen),!(c.current!==null&&c.current!==i.h)&&(c.current=null,a(!1),s(``))},onError:e=>{i.boundToHold&&YC(i.holdGen),!(c.current!==null&&c.current!==i.h)&&(c.current=null,a(!1),s(``),e===`not-allowed`||e===`service-not-allowed`?r.error(Rt()):e!==`no-speech`&&e!==`aborted`&&r.error(C_({code:e})))}});if(o===null){r.error(fc());return}i.h=o;let d=BC();if(d!==null&&d.targetChatId===t){i.boundToHold=!0,HC(()=>o.stop()),i.holdGen=UC(),a(!0);return}c.current=o,a(!0)},[m,r]),b=(0,z.useCallback)(()=>{if(n.getState().attachments.length>0||xMe()){r.error(zp());return}let e=c.current;use({targetChatId:u.current.chatId,targetLabel:u.current.chatTitle,text:n.getState().text,voiceEnabled:g.current,voiceLang:h.current,recording:e!==null,...e===null?{}:{stop:()=>e.stop()}})&&(e!==null&&l.current?.h===e&&(l.current.boundToHold=!0,l.current.holdGen=UC()),c.current=null,a(!1),s(``),n.setText(``))},[r]);return{recording:i||f&&d!==null&&d.recording,interim:f&&d!==null?d.interim:o,held:f,canPin:d===null,pinned:d!==null,pinnedHere:f,pinnedLabel:d?.targetLabel??``,pinnedTargetChatId:d?.targetChatId??null,pendingSend:f?d?.pendingSend??null:null,pendingSendId:f?d?.pendingSendId??0:0,pendingRestore:f?d?.pendingRestore??null:null,start:v,stop:_,hold:b}}function cRe({recording:e,onStart:t,onStop:n}){let r=P(L.me.getMe,{host:A2})?.dictationShortcut??null,i=(0,z.useRef)(()=>{});(0,z.useEffect)(()=>{if(!r)return;let e=e=>{e.repeat||iL(e,r)&&(e.preventDefault(),i.current())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let a=r?` (${rL(r,tL())})`:``;return(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__icon${e?` oc-composer__icon--rec`:``}`,title:(e?gt():ao())+a,"aria-label":e?gt():ao(),"aria-pressed":e,ref:e=>{i.current=()=>e?.click()},onClick:()=>e?n():t(),children:(0,B.jsx)(PS,{size:18,"aria-hidden":!0})})}function lRe({chatId:e,chatTitle:t=``,showTools:n,onToggleTools:r,unavailable:i=!1,agentGate:a,onTalkCallActiveChange:o,serverCallSessionId:s,subAgentBusy:c=!1}){let{can:l,loading:u,resolved:d}=q4(e),f=u||!d||l(`inboundAttachments`),p=e8().voiceInput,m=$2(),h=c8(),[g,_]=(0,z.useState)(!1),[v,y]=(0,z.useState)(`agents`),[b,x]=(0,z.useState)(null),S=(0,z.useCallback)(()=>x(null),[]),C=(0,z.useCallback)((e,t)=>{y(e),x(t),_(!0)},[]),w=h?.nextTarget??null,T=h?.primary??null,E=(h?.roomAgents.length??0)>0,D=E&&T?u4(h?.pool??[],T)?.displayName??T.agentId:e4(m),O=ZFe({turnRunning:XA(e=>e.isRunning),hasRunningSubAgent:c}),k=O.mode===`queue`,ee=(0,z.useContext)(n8),A=JA(),j=H_(),te=(0,z.useRef)(null),ne=wx(),N=sRe({chatId:e,chatTitle:t===``?D:t,voiceInput:p,rootRef:te}),[re,ie]=(0,z.useState)(!1),oe=N.pendingSendId,se=EL(),ce=(0,z.useRef)(0);(0,z.useEffect)(()=>{if(oe===0||ce.current===oe)return;ce.current=oe;let e=BC(),t=e?.pendingSend??``,n=e?.holdId??-1;if(pse(),i){qC(n),se.error(Lg());return}if(t.trim()===``){mse(n);return}k&&ee!==null?ee(t).then(e=>{e?BC()?.holdId===n&&(XC(),A.setText(``)):qC(n)}):BC()?.holdId===n&&(XC(),A.setText(t),A.send())},[oe]);let le=N.pendingRestore;(0,z.useEffect)(()=>{le!==null&&(A.setText(le),hse(),XC())},[le]),(0,z.useEffect)(()=>{if(!re)return;let e=e=>{e.key===`Escape`&&(e.stopPropagation(),ie(!1))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[re]);let ue=(0,z.useContext)(kQ);(0,z.useEffect)(()=>{if(ue!==null)return ue.current={canAttach:f&&!k&&!N.pinned,attachFile:e=>N.pinned?Promise.resolve():(me(e=>e+1),A.addAttachment(e).then(()=>{ge(``),requestAnimationFrame(()=>ge(it()))}).finally(()=>me(e=>Math.max(0,e-1)))),insertText:e=>{let t=A.getState();A.setText(t.text+e),ge(``),requestAnimationFrame(()=>ge($s()))}},()=>{ue.current=null}},[ue,f,k,A,N.pinned]);let de=(0,z.useRef)(1),fe=EL(),[pe,me]=(0,z.useState)(0),[he,ge]=(0,z.useState)(``),_e=pe>0,ve=(0,B.jsxs)(B.Fragment,{children:[re?(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__backdrop`,"aria-label":gg(),onClick:()=>ie(!1)}):null,(0,B.jsxs)(QF.Root,{ref:te,className:`oc-composer${i?` oc-composer--disabled`:``}${N.recording?` oc-composer--dictation`:``}${re?` oc-composer--expanded`:``}`,children:[re?(0,B.jsxs)(`div`,{className:`oc-composer__exphead`,children:[(0,B.jsx)(`span`,{className:`oc-composer__exptitle`,children:gm()}),(0,B.jsxs)(`button`,{type:`button`,className:`oc-composer__expclose`,title:gg(),onClick:()=>ie(!1),children:[(0,B.jsx)(FS,{size:15,"aria-hidden":!0}),gg()]})]}):null,e?(0,B.jsx)(cPe,{chatId:e,onOpen:()=>C(`people`,null)}):null,e?(0,B.jsx)(lPe,{chatId:e,routing:h,open:g,onOpenChange:_,tab:v,onTabChange:y,intent:b,onIntentDone:S}):null,(0,B.jsx)(eRe,{chatId:e}),(0,B.jsx)(`div`,{className:`oc-attachrow`,children:(0,B.jsx)(QF.Attachments,{components:{Attachment:tRe}})}),(0,B.jsx)(`span`,{className:`oc-sr-only`,role:`status`,"aria-live":`polite`,children:he}),(0,B.jsx)(nRe,{}),(0,B.jsx)(QF.Input,{className:`oc-composer__input`,placeholder:i?Lg():E?jc({name:D}):_i({name:D}),autoFocus:!0,rows:1,disabled:i,onKeyDownCapture:e=>{if(_e&&e.key===`Enter`&&!e.shiftKey){e.preventDefault(),e.stopPropagation();return}if(!k||ee===null||e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing)return;e.preventDefault(),e.stopPropagation();let t=A.getState().text;t.trim()!==``&&ee(t).then(e=>{e&&A.setText(``)})},onPaste:e=>{if((e.clipboardData?.files?.length??0)>0)return;let t=e.clipboardData?.getData(`text/plain`)??``;if(!t)return;let n=JFe(t);if(n!==null&&f&&!k){e.preventDefault();let r=e.currentTarget,i=r.selectionStart??null,a=r.selectionEnd??null,o=A.getState().text,s=()=>{let e=A.getState();e.text===o&&i!==null&&a!==null?A.setText(o.slice(0,i)+t+o.slice(a)):A.setText(e.text+t)};me(e=>e+1),j.query(L.chatExport.exportByReference,{reference:n}).then(e=>{let t=e;if(t===null){s();return}let n=new File([t.markdown],t.filename,{type:`text/markdown; charset=utf-8`});return jQ(n),A.addAttachment(n).then(()=>{ge(``),requestAnimationFrame(()=>ge(wa()))})}).catch(()=>{s(),fe.error(Lh())}).finally(()=>me(e=>Math.max(0,e-1)));return}let r=Uwe(t,de.current);if(r.kind!==`file`||!f)return;if(e.preventDefault(),k){fe.error(ae());return}de.current+=1;let i=new File([t],r.filename??`texte-colle.txt`,{type:`text/plain; charset=utf-8`});jQ(i),me(e=>e+1),A.addAttachment(i).then(()=>{ge(``),requestAnimationFrame(()=>ge(oo({lines:String(r.lines)})))}).catch(e=>{console.error(`[paste] attachment routing failed:`,e),fe.error(Zh())}).finally(()=>me(e=>Math.max(0,e-1)))},autoCorrect:`off`,autoCapitalize:`off`,autoComplete:`off`,"data-gramm":`false`,"data-gramm_editor":`false`,"data-enable-grammarly":`false`}),N.recording&&N.interim!==``?(0,B.jsxs)(`div`,{className:`oc-composer__interim`,"aria-hidden":!0,children:[(0,B.jsx)(`span`,{className:`oc-composer__interim-dot`}),N.interim]}):null,(0,B.jsxs)(`div`,{className:`oc-composer__bar`,children:[(0,B.jsxs)(`div`,{className:`oc-composer__group`,children:[(0,B.jsx)(VIe,{chatId:e,routedAgent:w?{instanceName:w.instanceName,agentId:w.agentId}:null,attachmentsSupported:f,attachDisabled:k||i}),re?null:(0,B.jsxs)(`button`,{type:`button`,className:`oc-composer__tools${n?` is-on`:``}`,onClick:r,"aria-pressed":n,title:n?rn():To(),children:[(0,B.jsx)(lC,{size:15,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-composer__tools-label`,children:Pa()})]}),(0,B.jsx)(aRe,{chatId:e,gate:a,onManage:C}),(0,B.jsx)(MIe,{chatId:e,routedAgent:w?{instanceName:w.instanceName,agentId:w.agentId}:null,multiAgent:h?.perTurnRouting===!0||(h?.roomAgents?.length??0)>0})]}),(0,B.jsxs)(`div`,{className:`oc-composer__group`,children:[(0,B.jsx)(`span`,{className:`oc-composer__voiceslot${N.canPin||N.held?` is-shown`:``}`,"aria-hidden":!N.canPin&&!N.held,children:N.held?(0,B.jsxs)(`button`,{type:`button`,className:`oc-composer__heldchip`,title:Xh(),"aria-label":Xh(),onClick:()=>XC(),children:[(0,B.jsx)(KS,{size:12,"aria-hidden":!0}),Jf(),(0,B.jsx)(uv,{size:11,"aria-hidden":!0})]}):(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__icon oc-composer__hold`,title:Vm(),"aria-label":Vm(),onClick:N.hold,disabled:!N.canPin||_e,tabIndex:!N.canPin||_e?-1:0,children:(0,B.jsx)(KS,{size:16,"aria-hidden":!0})})}),(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__icon${re?` is-on`:``}`,title:re?gg():o_(),"aria-label":re?gg():o_(),"aria-pressed":re,onClick:()=>ie(e=>!e),children:re?(0,B.jsx)(FS,{size:16,"aria-hidden":!0}):(0,B.jsx)(OS,{size:16,"aria-hidden":!0})}),p?(0,B.jsx)(cRe,{recording:N.recording,onStart:N.start,onStop:N.stop}):null,(0,B.jsx)(RMe,{chatId:e,onCallActiveChange:o,serverCallSessionId:s,routedAgent:w?{instanceName:w.instanceName,agentId:w.agentId}:null},e),i?(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__send`,disabled:!0,"aria-label":M(),children:(0,B.jsx)(zx,{size:18,"aria-hidden":!0})}):O.mode===`queue`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(iRe,{}),(0,B.jsx)(rRe,{reason:O.reason})]}):(0,B.jsx)(QF.Send,{className:`oc-composer__send`,"aria-label":Gh(),disabled:_e,children:(0,B.jsx)(zx,{size:18,"aria-hidden":!0})})]})]})]})]});return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(BLe,{}),N.pinned?(0,B.jsxs)(`div`,{className:`oc-composer__pinnednote`,role:`note`,children:[(0,B.jsx)(KS,{size:14,"aria-hidden":!0}),N.pinnedHere?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:Yee()}),(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__pinnedgoto`,onClick:()=>JC(),children:tne()})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:oee({chat:N.pinnedLabel||dh()})}),N.pinnedTargetChatId?(0,B.jsx)(`button`,{type:`button`,className:`oc-composer__pinnedgoto`,onClick:()=>{ne({to:`/chat/$chatId`,params:{chatId:N.pinnedTargetChatId}})},children:_p()}):null]})]}):re?(0,Ex.createPortal)(ve,document.body):ve]})}function uRe({chatId:e}){let t=C6(e);return t.offered?(0,B.jsxs)(II,{disabled:t.pending,"data-widgets-toggle":!0,onSelect:()=>t.set(!t.enabled),children:[(0,B.jsx)(xS,{}),t.enabled?zi():vr()]}):null}var T8=67324752,E8=33639248,D8=101010256,O8=0,k8=2048,A8=class extends Error{reason;constructor(e,t){super(t===void 0?e:`${e}: ${t}`),this.reason=e,this.name=`ZipError`}},dRe=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t+=1){let n=t;for(let e=0;e<8;e+=1)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function j8(e){let t=4294967295;for(let n of e)t=dRe[(t^n)&255]^t>>>8;return(t^4294967295)>>>0}function fRe(e){if(e.length>65535)throw new A8(`too_many_entries`,String(e.length));let t=new TextEncoder,n=[],r=[],i=0;for(let a of e){let e=t.encode(a.name),o=j8(a.bytes),s=new Uint8Array(30+e.length),c=new DataView(s.buffer);c.setUint32(0,T8,!0),c.setUint16(4,20,!0),c.setUint16(6,k8,!0),c.setUint16(8,O8,!0),c.setUint16(10,0,!0),c.setUint16(12,33,!0),c.setUint32(14,o,!0),c.setUint32(18,a.bytes.length,!0),c.setUint32(22,a.bytes.length,!0),c.setUint16(26,e.length,!0),c.setUint16(28,0,!0),s.set(e,30);let l=new Uint8Array(46+e.length),u=new DataView(l.buffer);u.setUint32(0,E8,!0),u.setUint16(4,20,!0),u.setUint16(6,20,!0),u.setUint16(8,k8,!0),u.setUint16(10,O8,!0),u.setUint16(12,0,!0),u.setUint16(14,33,!0),u.setUint32(16,o,!0),u.setUint32(20,a.bytes.length,!0),u.setUint32(24,a.bytes.length,!0),u.setUint16(28,e.length,!0),u.setUint32(42,i,!0),l.set(e,46),n.push(s,a.bytes),r.push(l),i+=s.length+a.bytes.length}let a=r.reduce((e,t)=>e+t.length,0),o=new Uint8Array(22),s=new DataView(o.buffer);s.setUint32(0,D8,!0),s.setUint16(8,e.length,!0),s.setUint16(10,e.length,!0),s.setUint32(12,a,!0),s.setUint32(16,i,!0);let c=n.reduce((e,t)=>e+t.length,0)+a+22,l=new Uint8Array(c),u=0;for(let e of[...n,...r,o])l.set(e,u),u+=e.length;return l}function pRe(e){let t=new DataView(e.buffer,e.byteOffset,e.length),n=new TextDecoder,r=-1;for(let n=e.length-22;n>=0;--n)if(t.getUint32(n,!0)===D8){r=n;break}if(r===-1)throw new A8(`not_a_zip`);let i=t.getUint16(r+10,!0),a=t.getUint32(r+16,!0),o=[];for(let r=0;r<i;r+=1){if(a+46>e.length||t.getUint32(a,!0)!==E8)throw new A8(`corrupt`,`central directory`);let r=t.getUint16(a+8,!0),i=t.getUint16(a+10,!0),s=t.getUint32(a+16,!0),c=t.getUint32(a+24,!0),l=t.getUint16(a+28,!0),u=t.getUint16(a+30,!0),d=t.getUint16(a+32,!0),f=t.getUint32(a+42,!0),p=n.decode(e.subarray(a+46,a+46+l));if(i!==O8)throw new A8(`unsupported_method`,p);if((r&k8)===0)throw new A8(`unsupported_encoding`,p);if(f+30>e.length||t.getUint32(f,!0)!==T8)throw new A8(`corrupt`,p);let m=t.getUint16(f+26,!0),h=t.getUint16(f+28,!0),g=f+30+m+h;if(g+c>e.length)throw new A8(`corrupt`,p);let _=e.slice(g,g+c);if(j8(_)!==s)throw new A8(`checksum_mismatch`,p);o.push({name:p,bytes:_}),a+=46+l+u+d}return o}var M8=`manifest.json`,N8=`chats/`,mRe=`sections/`,P8=`blobs/`,hRe=512*1024*1024,gRe=1e4,_Re=76,vRe=600*1e3;function yRe(e,t){return e.filter(e=>t-e.updatedAt>vRe)}var bRe=class extends Error{bytes;constructor(e){super(`archive exceeds ${hRe} bytes`),this.bytes=e,this.name=`ArchiveTooLarge`}};async function F8(e,t,n){let r=new TextEncoder,i=await e.manifest(),a=[],o=0,s=0,c=0,l=new Set,u=(e,t)=>{if(o+=t.length+_Re+2*e.length,o>536870912)throw new bRe(o);a.push({name:e,bytes:t})},d=[];for(let a of t){let t=await e.chat(a);u(`${N8}${a}.json`,r.encode(JSON.stringify(t)));for(let t of i.sections){let i=null,o=0;do{let f=await e.section(a,t,i);f.rows.length>0&&u(`${mRe}${a}/${t}/${o}.json`,r.encode(JSON.stringify(f.rows)));for(let t of f.blobs){if(t.url===null){d.push(t.key);continue}l.has(t.key)||(l.add(t.key),u(`${P8}${t.key}`,await e.blob(t.url)),s+=1,n?.({phase:`blobs`,done:s,total:null}))}i=f.cursor,o+=1,c+=1,n?.({phase:`sections`,done:c,total:null})}while(i!==null&&o<1e4);if(i!==null)throw Error(`export of ${t} did not finish within ${gRe} pages`)}}return n?.({phase:`packing`,done:a.length,total:a.length}),a.unshift({name:M8,bytes:r.encode(JSON.stringify({...i,missingBlobs:d}))}),{archive:fRe(a),manifest:i,blobCount:s,missingBlobs:d}}async function xRe(e,t,n,r){let i=new TextDecoder,a=pRe(t);r?.({phase:`reading`,done:a.length,total:a.length});let o=new Map(a.map(e=>[e.name,e.bytes])).get(M8);if(o===void 0)throw Error(`archive has no manifest`);let s=JSON.parse(i.decode(o)),c=await e.begin({formatVersion:s.formatVersion,origin:s.origin??null},n),l=0,u=!1,d=new Map,f=new Set;try{let t=a.filter(e=>e.name.startsWith(P8)).length;for(let n of a){if(!n.name.startsWith(`blobs/`))continue;let i=n.name.slice(6);if(d.has(i))throw Error(`archive names the same blob twice: ${i}`);let a=await e.upload(n.bytes,i);await e.registerBlob(c,a),d.set(i,a),r?.({phase:`uploading`,done:d.size,total:t})}let n=a.filter(e=>e.name.startsWith(N8));for(let t of n){let n=JSON.parse(i.decode(t.bytes)),r=await e.batch(c,`chats`,[n],I8([n],d));l+=r.written,L8([n],r.writtenIds,f)}for(let t of s.sections){let n=a.filter(e=>e.name.startsWith(`sections/`)&&e.name.includes(`/${t}/`)).sort((e,t)=>R8(e.name)-R8(t.name));for(let a of n){let n=JSON.parse(i.decode(a.bytes)),o=await e.batch(c,t,n,I8(n,d));l+=o.written,r?.({phase:`writing`,done:l,total:null}),L8(n,o.writtenIds,f)}}for(let[t,n]of d)f.has(t)||await e.discardUpload(c,n);let o=Math.ceil(l/100)+100;for(let t=0;t<o&&!u;t+=1)u=(await e.finish(c)).done}catch(t){try{let t=!1;for(let n=0;n<1e4&&!t;n+=1)t=(await e.abandon(c)).done;for(let t of d.values())await e.discardUpload(c,t)}catch{}throw t}return{importId:c,written:l,purged:u}}function I8(e,t){let n=new Set;for(let t of e){let e=t.archiveBlobKey;typeof e==`string`&&n.add(e);let r=t.archiveBlobKeys;if(Array.isArray(r))for(let e of r)typeof e==`string`&&n.add(e)}let r=[];for(let e of n){let n=t.get(e);n!==void 0&&r.push({key:e,storageId:n})}return r}function L8(e,t,n){let r=new Set(t);for(let t of e){if(typeof t._id!=`string`||!r.has(t._id))continue;let e=t.archiveBlobKey;typeof e==`string`&&n.add(e);let i=t.archiveBlobKeys;if(Array.isArray(i))for(let e of i)typeof e==`string`&&n.add(e)}}function R8(e){let t=/\/(\d+)\.json$/.exec(e);return t===null?0:Number(t[1])}function z8(e){return`atrium-${e.normalize(`NFKD`).replace(/[^\p{Letter}\p{Number}]+/gu,`-`).replace(/^-+|-+$/g,``).slice(0,60)||`conversation`}.zip`}function B8(e,t){let n=URL.createObjectURL(new Blob([e],{type:`application/zip`})),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),setTimeout(()=>URL.revokeObjectURL(n),6e4)}function SRe(){let e=H_(),[t,n]=(0,z.useState)({running:!1,progress:null}),r=(0,z.useRef)(!1),i=(0,z.useCallback)(()=>({manifest:()=>e.action(L.archiveExport.exportManifest,{}),chat:t=>e.query(L.archiveExport.exportChat,{chatId:t}),section:(t,n,r)=>e.query(L.archiveExport.exportChatSection,{chatId:t,section:n,cursor:r}),blob:async e=>{let t=await fetch(e);if(!t.ok)throw Error(`attachment could not be read (${t.status})`);return new Uint8Array(await t.arrayBuffer())}}),[e]),a=(0,z.useCallback)(()=>({begin:(t,n)=>e.mutation(L.archiveImport.beginImport,{manifest:t,targetProjectId:n??null}),batch:(t,n,r,i)=>e.mutation(L.archiveImport.importBatch,{importId:t,section:n,rows:r,blobs:i.map(e=>({key:e.key,storageId:e.storageId}))}),finish:t=>e.mutation(L.archiveImport.finishImport,{importId:t}),abandon:t=>e.mutation(L.archiveImport.abandonImport,{importId:t}),upload:async t=>{let n=await e.mutation(L.chats.generateUploadUrl,{}),{storageId:r}=await(await fetch(n,{method:`POST`,headers:{"Content-Type":`application/octet-stream`},body:new Blob([t])})).json();return await e.mutation(L.uploads.registerUpload,{storageId:r}),r},registerBlob:async(t,n)=>{await e.mutation(L.archiveImport.registerImportBlob,{importId:t,storageId:n})},discardUpload:async(t,n)=>{await e.mutation(L.archiveImport.discardUpload,{importId:t,storageId:n})}}),[e]),o=(0,z.useCallback)(async e=>{if(r.current)throw Error(`a transfer is already running`);r.current=!0,n({running:!0,progress:null});try{return await e(e=>n({running:!0,progress:e}))}finally{r.current=!1,n({running:!1,progress:null})}},[]),s=(0,z.useCallback)((e,t)=>o(async n=>{let{archive:r,missingBlobs:a}=await F8(i(),e,n);return B8(r,z8(t)),{missingBlobs:a}}),[o,i]),c=(0,z.useCallback)((t,n)=>o(async r=>{let a=await e.query(L.archiveExport.exportFolderTree,{projectId:t});if(!a.complete)throw Error(`folder_too_large`);let o=[];for(let t of a.folders){let n=null;do{let r=await e.query(L.archiveExport.exportFolderChats,{projectId:t._id,cursor:n});o.push(...r.chatIds),n=r.cursor}while(n!==null)}let{archive:s,missingBlobs:c}=await F8(i(),o,r);return B8(s,z8(n)),{missingBlobs:c,chatCount:o.length}}),[e,o,i]),l=(0,z.useCallback)((e,t)=>o(async n=>{if(e.size>536870912)throw Error(`archive_too_large`);return xRe(a(),new Uint8Array(await e.arrayBuffer()),t,n)}),[o,a]);return(0,z.useEffect)(()=>{let t=!1;return(async()=>{try{let n=await e.query(L.archiveImport.listOpenImports,{});for(let r of yRe(n,Date.now())){let n=!1;for(let i=0;i<1e3&&!n&&!t;i+=1)n=(await e.mutation(L.archiveImport.abandonImport,{importId:r.importId})).done}}catch{}})(),()=>{t=!0}},[e]),{state:t,exportChats:s,exportFolder:c,importArchive:l}}var V8=(0,z.createContext)(null);function CRe({children:e}){let t=SRe(),n=EL(),r=(e,t)=>{let r=e instanceof Error?e.message:String(e);if(r.includes(`folder_too_large`)){n.error(ba());return}if(r.includes(`already running`)){n.error(Nh());return}if(r.includes(`archive_too_large`)){n.error(xt());return}if(r.includes(`not_a_zip`)||r.includes(`no manifest`)){n.error(fo());return}n.error(t,e)},i={state:t.state,exportChat:(e,i)=>{t.exportChats([e],i).then(({missingBlobs:e})=>{e.length>0?n.error(fn({count:e.length})):n.success(jr())}).catch(e=>r(e,ng()))},exportFolder:(e,i)=>{t.exportFolder(e,i).then(({missingBlobs:e})=>{e.length>0?n.error(fn({count:e.length})):n.success(jr())}).catch(e=>r(e,ng()))},importArchive:(e,i)=>{t.importArchive(e,i).then(({written:e,purged:t})=>{n.success(Fo({count:e}),t?void 0:Ua())}).catch(e=>r(e,le()))}},a={...i,pickAndImport:e=>{let t=document.createElement(`input`);t.type=`file`,t.accept=`.zip,application/zip`,t.addEventListener(`change`,()=>{let n=t.files?.[0];n!==void 0&&i.importArchive(n,e)}),t.click()}};return(0,B.jsx)(V8.Provider,{value:a,children:e})}function H8(){return(0,z.useContext)(V8)}function wRe(e){if(!e.running)return null;let t=e.progress;if(t===null)return Fe();switch(t.phase){case`sections`:return lr({count:t.done});case`blobs`:return pl({count:t.done});case`packing`:return Fe();case`reading`:return Xie({count:t.done});case`uploading`:return Os({done:t.done,total:t.total??t.done});case`writing`:return $i({count:t.done})}}function TRe(e,t){return e===null?t:`${e}-${t}`}function ERe(){var e=[...arguments];return(0,z.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var U8=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function W8(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function G8(e){return`nodeType`in e}function K8(e){return e?W8(e)?e:G8(e)?e.ownerDocument?.defaultView??window:window:window}function q8(e){let{Document:t}=K8(e);return e instanceof t}function J8(e){return W8(e)?!1:e instanceof K8(e).HTMLElement}function Y8(e){return e instanceof K8(e).SVGElement}function X8(e){return e?W8(e)?e.document:G8(e)?q8(e)?e:J8(e)||Y8(e)?e.ownerDocument:document:document:document}var Z8=U8?z.useLayoutEffect:z.useEffect;function Q8(e){let t=(0,z.useRef)(e);return Z8(()=>{t.current=e}),(0,z.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function DRe(){let e=(0,z.useRef)(null);return[(0,z.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,z.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function $8(e,t){t===void 0&&(t=[e]);let n=(0,z.useRef)(e);return Z8(()=>{n.current!==e&&(n.current=e)},t),n}function e5(e,t){let n=(0,z.useRef)();return(0,z.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function t5(e){let t=Q8(e),n=(0,z.useRef)(null);return[n,(0,z.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function n5(e){let t=(0,z.useRef)();return(0,z.useEffect)(()=>{t.current=e},[e]),t.current}var r5={};function i5(e,t){return(0,z.useMemo)(()=>{if(t)return t;let n=r5[e]==null?0:r5[e]+1;return r5[e]=n,e+`-`+n},[e,t])}function a5(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var o5=a5(1),s5=a5(-1);function ORe(e){return`clientX`in e&&`clientY`in e}function c5(e){if(!e)return!1;let{KeyboardEvent:t}=K8(e.target);return t&&e instanceof t}function kRe(e){if(!e)return!1;let{TouchEvent:t}=K8(e.target);return t&&e instanceof t}function l5(e){if(kRe(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return ORe(e)?{x:e.clientX,y:e.clientY}:null}var u5=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[u5.Translate.toString(e),u5.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),d5=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function ARe(e){return e.matches(d5)?e:e.querySelector(d5)}var jRe={display:`none`};function MRe(e){let{id:t,value:n}=e;return z.createElement(`div`,{id:t,style:jRe},n)}function NRe(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return z.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function PRe(){let[e,t]=(0,z.useState)(``);return{announce:(0,z.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var f5=(0,z.createContext)(null);function FRe(e){let t=(0,z.useContext)(f5);(0,z.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function IRe(){let[e]=(0,z.useState)(()=>new Set),t=(0,z.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,z.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var LRe={draggable:`
|
|
443
|
+
To pick up a draggable item, press the space bar.
|
|
444
|
+
While dragging, use the arrow keys to move the item.
|
|
445
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
446
|
+
`},RRe={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function zRe(e){let{announcements:t=RRe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=LRe}=e,{announce:a,announcement:o}=PRe(),s=i5(`DndLiveRegion`),[c,l]=(0,z.useState)(!1);if((0,z.useEffect)(()=>{l(!0)},[]),FRe((0,z.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=z.createElement(z.Fragment,null,z.createElement(MRe,{id:r,value:i.draggable}),z.createElement(NRe,{id:s,announcement:o}));return n?(0,Ex.createPortal)(u,n):u}var p5;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(p5||={});function m5(){}function h5(e,t){return(0,z.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function g5(){var e=[...arguments];return(0,z.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var _5=Object.freeze({x:0,y:0});function v5(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function BRe(e,t){let n=l5(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function y5(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function VRe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function b5(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function x5(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function S5(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var HRe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=S5(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=v5(S5(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(y5)},C5=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=b5(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=b5(r),o=i.reduce((e,t,r)=>e+v5(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(y5)};function URe(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var WRe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=URe(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(VRe)};function GRe(e,t){let{top:n,left:r,bottom:i,right:a}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=a}var KRe=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];let i=[];for(let e of t){let{id:t}=e,a=n.get(t);if(a&&GRe(r,a)){let n=b5(a).reduce((e,t)=>e+v5(r,t),0),o=Number((n/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:o}})}}return i.sort(y5)};function qRe(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function w5(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:_5}function JRe(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var YRe=JRe(1);function T5(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function XRe(e,t,n){let r=T5(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var ZRe={ignoreTransform:!1};function E5(e,t){t===void 0&&(t=ZRe);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=K8(e).getComputedStyle(e);t&&(n=XRe(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function D5(e){return E5(e,{ignoreTransform:!0})}function QRe(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function $Re(e,t){return t===void 0&&(t=K8(e).getComputedStyle(e)),t.position===`fixed`}function eze(e,t){t===void 0&&(t=K8(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function O5(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(q8(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!J8(i)||Y8(i)||n.includes(i))return n;let a=K8(e).getComputedStyle(i);return i!==e&&eze(i,a)&&n.push(i),$Re(i,a)?n:r(i.parentNode)}return e?r(e):n}function k5(e){let[t]=O5(e,1);return t??null}function A5(e){return!U8||!e?null:W8(e)?e:G8(e)?q8(e)||e===X8(e).scrollingElement?window:J8(e)?e:null:null}function j5(e){return W8(e)?e.scrollX:e.scrollLeft}function M5(e){return W8(e)?e.scrollY:e.scrollTop}function N5(e){return{x:j5(e),y:M5(e)}}var P5;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(P5||={});function F5(e){return!U8||!e?!1:e===document.scrollingElement}function I5(e){let t={x:0,y:0},n=F5(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var tze={x:.2,y:.2};function nze(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=tze);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=I5(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=P5.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=P5.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=P5.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=P5.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function rze(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function L5(e){return e.reduce((e,t)=>o5(e,N5(t)),_5)}function ize(e){return e.reduce((e,t)=>e+j5(t),0)}function aze(e){return e.reduce((e,t)=>e+M5(t),0)}function R5(e,t){if(t===void 0&&(t=E5),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);k5(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var oze=[[`x`,[`left`,`right`],ize],[`y`,[`top`,`bottom`],aze]],z5=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=O5(t),r=L5(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of oze)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},B5=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function sze(e){let{EventTarget:t}=K8(e);return e instanceof t?e:X8(e)}function V5(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var H5;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(H5||={});function U5(e){e.preventDefault()}function cze(e){e.stopPropagation()}var W5;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(W5||={});var G5={start:[W5.Space,W5.Enter],cancel:[W5.Esc],end:[W5.Space,W5.Enter,W5.Tab]},lze=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case W5.Right:return{...n,x:n.x+25};case W5.Left:return{...n,x:n.x-25};case W5.Down:return{...n,y:n.y+25};case W5.Up:return{...n,y:n.y-25}}},K5=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new B5(X8(t)),this.windowListeners=new B5(K8(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(H5.Resize,this.handleCancel),this.windowListeners.add(H5.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(H5.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&R5(n),t(_5)}handleKeyDown(e){if(c5(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=G5,coordinateGetter:a=lze,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:_5;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=s5(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=I5(n),p=rze(n),m={x:Math.min(i===W5.Right?p.right-p.width/2:p.right,Math.max(i===W5.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===W5.Down?p.bottom-p.height/2:p.bottom,Math.max(i===W5.Down?p.top:p.top+p.height/2,u.y))},h=i===W5.Right&&!s||i===W5.Left&&!c,g=i===W5.Down&&!l||i===W5.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===W5.Right&&e<=d.x||i===W5.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===W5.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===W5.Down&&e<=d.y||i===W5.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===W5.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,o5(s5(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};K5.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=G5,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function q5(e){return!!(e&&`distance`in e)}function J5(e){return!!(e&&`delay`in e)}var Y5=class{constructor(e,t,n){n===void 0&&(n=sze(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=X8(i),this.documentListeners=new B5(this.document),this.listeners=new B5(n),this.windowListeners=new B5(K8(i)),this.initialCoordinates=l5(r)??_5,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(H5.Resize,this.handleCancel),this.windowListeners.add(H5.DragStart,U5),this.windowListeners.add(H5.VisibilityChange,this.handleCancel),this.windowListeners.add(H5.ContextMenu,U5),this.documentListeners.add(H5.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(J5(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(q5(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(H5.Click,cze,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(H5.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=l5(e)??_5,s=s5(n,o);if(!t&&a){if(q5(a)){if(a.tolerance!=null&&V5(s,a.tolerance))return this.handleCancel();if(V5(s,a.distance))return this.handleStart()}if(J5(a)&&V5(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===W5.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},uze={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},X5=class extends Y5{constructor(e){let{event:t}=e,n=X8(t.target);super(e,uze,n)}};X5.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var dze={move:{name:`mousemove`},end:{name:`mouseup`}},Z5;(function(e){e[e.RightClick=2]=`RightClick`})(Z5||={});var Q5=class extends Y5{constructor(e){super(e,dze,X8(e.event.target))}};Q5.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Z5.RightClick?!1:(r?.({event:n}),!0)}}];var $5={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},e7=class extends Y5{constructor(e){super(e,$5)}static setup(){return window.addEventListener($5.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener($5.move.name,e)};function e(){}}};e7.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var t7;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(t7||={});var n7;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(n7||={});function fze(e){let{acceleration:t,activator:n=t7.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=n7.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=mze({delta:d,disabled:!a}),[m,h]=DRe(),g=(0,z.useRef)({x:0,y:0}),_=(0,z.useRef)({x:0,y:0}),v=(0,z.useMemo)(()=>{switch(n){case t7.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case t7.DraggableRect:return i}},[n,i,c]),y=(0,z.useRef)(null),b=(0,z.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,z.useMemo)(()=>s===n7.TreeOrder?[...l].reverse():l,[s,l]);(0,z.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=nze(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var pze={x:{[P5.Backward]:!1,[P5.Forward]:!1},y:{[P5.Backward]:!1,[P5.Forward]:!1}};function mze(e){let{delta:t,disabled:n}=e,r=n5(t);return e5(e=>{if(n||!r||!e)return pze;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[P5.Backward]:e.x[P5.Backward]||i.x===-1,[P5.Forward]:e.x[P5.Forward]||i.x===1},y:{[P5.Backward]:e.y[P5.Backward]||i.y===-1,[P5.Forward]:e.y[P5.Forward]||i.y===1}}},[n,t,r])}function hze(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return e5(e=>t==null?null:r??e??null,[r,t])}function gze(e,t){return(0,z.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var r7;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(r7||={});var i7;(function(e){e.Optimized=`optimized`})(i7||={});var a7=new Map;function _ze(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,z.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,z.useRef)(e),d=g(),f=$8(d),p=(0,z.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,z.useRef)(null),h=e5(t=>{if(d&&!n)return a7;if(!t||t===a7||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new z5(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,z.useEffect)(()=>{u.current=e},[e]),(0,z.useEffect)(()=>{d||p()},[n,d]),(0,z.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,z.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case r7.Always:return!1;case r7.BeforeDragging:return n;default:return!n}}}function o7(e,t){return e5(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function vze(e,t){return o7(e,t)}function yze(e){let{callback:t,disabled:n}=e,r=Q8(t),i=(0,z.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,z.useEffect)(()=>()=>i?.disconnect(),[i]),i}function s7(e){let{callback:t,disabled:n}=e,r=Q8(t),i=(0,z.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,z.useEffect)(()=>()=>i?.disconnect(),[i]),i}function bze(e){return new z5(E5(e),e)}function c7(e,t,n){t===void 0&&(t=bze);let[r,i]=(0,z.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=yze({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=s7({callback:a});return Z8(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function xze(e){return w5(e,o7(e))}var l7=[];function Sze(e){let t=(0,z.useRef)(e),n=e5(n=>e?n&&n!==l7&&e&&t.current&&e.parentNode===t.current.parentNode?n:O5(e):l7,[e]);return(0,z.useEffect)(()=>{t.current=e},[e]),n}function Cze(e){let[t,n]=(0,z.useState)(null),r=(0,z.useRef)(e),i=(0,z.useCallback)(e=>{let t=A5(e.target);t&&n(e=>e?(e.set(t,N5(t)),new Map(e)):null)},[]);return(0,z.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=A5(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,N5(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{A5(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,z.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>o5(e,t),_5):L5(e):_5,[e,t])}function u7(e,t){t===void 0&&(t=[]);let n=(0,z.useRef)(null);return(0,z.useEffect)(()=>{n.current=null},t),(0,z.useEffect)(()=>{let t=e!==_5;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?s5(e,n.current):_5}function wze(e){(0,z.useEffect)(()=>{if(!U8)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function Tze(e,t){return(0,z.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function d7(e){return(0,z.useMemo)(()=>e?QRe(e):null,[e])}var f7=[];function Eze(e,t){t===void 0&&(t=E5);let[n]=e,r=d7(n?K8(n):null),[i,a]=(0,z.useState)(f7);function o(){a(()=>e.length?e.map(e=>F5(e)?r:new z5(t(e),e)):f7)}let s=s7({callback:o});return Z8(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function p7(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return J8(t)?t:e}function Dze(e){let{measure:t}=e,[n,r]=(0,z.useState)(null),i=s7({callback:(0,z.useCallback)(e=>{for(let{target:n}of e)if(J8(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=t5((0,z.useCallback)(e=>{let n=p7(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,z.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Oze=[{sensor:X5,options:{}},{sensor:K5,options:{}}],kze={current:{}},m7={draggable:{measure:D5},droppable:{measure:D5,strategy:r7.WhileDragging,frequency:i7.Optimized},dragOverlay:{measure:E5}},h7=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Aze={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new h7,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:m5},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:m7,measureDroppableContainers:m5,windowRect:null,measuringScheduled:!1},g7={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:m5,draggableNodes:new Map,over:null,measureDroppableContainers:m5},_7=(0,z.createContext)(g7),v7=(0,z.createContext)(Aze);function jze(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new h7}}}function Mze(e,t){switch(t.type){case p5.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case p5.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case p5.DragEnd:case p5.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case p5.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new h7(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case p5.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new h7(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case p5.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new h7(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Nze(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,z.useContext)(_7),a=n5(r),o=n5(n?.id);return(0,z.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!c5(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=ARe(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function y7(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Pze(e){return(0,z.useMemo)(()=>({draggable:{...m7.draggable,...e?.draggable},droppable:{...m7.droppable,...e?.droppable},dragOverlay:{...m7.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Fze(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,z.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;Z8(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=w5(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=k5(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var b7=(0,z.createContext)({..._5,scaleX:1,scaleY:1}),x7;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(x7||={});var S7=(0,z.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Oze,collisionDetection:o=WRe,measuring:s,modifiers:c,...l}=e,[u,d]=(0,z.useReducer)(Mze,void 0,jze),[f,p]=IRe(),[m,h]=(0,z.useState)(x7.Uninitialized),g=m===x7.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,z.useRef)({initial:null,translated:null}),C=(0,z.useMemo)(()=>_==null?null:{id:_,data:x?.data??kze,rect:S},[_,x]),w=(0,z.useRef)(null),[T,E]=(0,z.useState)(null),[D,O]=(0,z.useState)(null),k=$8(l,Object.values(l)),ee=i5(`DndDescribedBy`,t),A=(0,z.useMemo)(()=>b.getEnabled(),[b]),j=Pze(s),{droppableRects:te,measureDroppableContainers:ne,measuringScheduled:M}=_ze(A,{dragging:g,dependencies:[y.x,y.y],config:j.droppable}),N=hze(v,_),re=(0,z.useMemo)(()=>D?l5(D):null,[D]),ie=Fe(),ae=vze(N,j.draggable.measure);Fze({activeNode:_==null?null:v.get(_),config:ie.layoutShiftCompensation,initialRect:ae,measure:j.draggable.measure});let oe=c7(N,j.draggable.measure,ae),se=c7(N?N.parentElement:null),ce=(0,z.useRef)({activatorEvent:null,active:null,activeNode:N,collisionRect:null,collisions:null,droppableRects:te,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),le=b.getNodeFor(ce.current.over?.id),ue=Dze({measure:j.dragOverlay.measure}),de=ue.nodeRef.current??N,fe=g?ue.rect??oe:null,pe=!!(ue.nodeRef.current&&ue.rect),me=xze(pe?null:oe),he=d7(de?K8(de):null),ge=Sze(g?le??N:null),_e=Eze(ge),ve=y7(c,{transform:{x:y.x-me.x,y:y.y-me.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:oe,containerNodeRect:se,draggingNodeRect:fe,over:ce.current.over,overlayNodeRect:ue.rect,scrollableAncestors:ge,scrollableAncestorRects:_e,windowRect:he}),ye=re?o5(re,y):null,be=Cze(ge),xe=u7(be),Se=u7(be,[oe]),Ce=o5(ve,xe),we=fe?YRe(fe,ve):null,Te=C&&we?o({active:C,collisionRect:we,droppableRects:te,droppableContainers:A,pointerCoordinates:ye}):null,Ee=x5(Te,`id`),[De,Oe]=(0,z.useState)(null),ke=qRe(pe?ve:o5(ve,Se),De?.rect??null,oe),Ae=(0,z.useRef)(null),je=(0,z.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent;Ae.current=new n({active:w.current,activeNode:i,event:a,options:r,context:ce,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,Ex.unstable_batchedUpdates)(()=>{r?.(i),h(x7.Initializing),d({type:p5.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(Ae.current),O(a)})},onMove(e){d({type:p5.DragMove,coordinates:e})},onEnd:o(p5.DragEnd),onCancel:o(p5.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=ce.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===p5.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=p5.DragCancel)}w.current=null,(0,Ex.unstable_batchedUpdates)(()=>{d({type:e}),h(x7.Uninitialized),Oe(null),E(null),O(null),Ae.current=null;let t=e===p5.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Me=gze(a,(0,z.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,je(n,t))},[v,je]));wze(a),Z8(()=>{oe&&m===x7.Initializing&&h(x7.Initialized)},[oe,m]),(0,z.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=ce.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:Ce.x,y:Ce.y},over:i};(0,Ex.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[Ce.x,Ce.y]),(0,z.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=ce.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(Ee),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,Ex.unstable_batchedUpdates)(()=>{Oe(s),a?.(c),f({type:`onDragOver`,event:c})})},[Ee]),Z8(()=>{ce.current={activatorEvent:D,active:C,activeNode:N,collisionRect:we,collisions:Te,droppableRects:te,draggableNodes:v,draggingNode:de,draggingNodeRect:fe,droppableContainers:b,over:De,scrollableAncestors:ge,scrollAdjustedTranslate:Ce},S.current={initial:fe,translated:we}},[C,N,Te,we,v,de,fe,te,b,De,ge,Ce]),fze({...ie,delta:y,draggingRect:we,pointerCoordinates:ye,scrollableAncestors:ge,scrollableAncestorRects:_e});let Ne=(0,z.useMemo)(()=>({active:C,activeNode:N,activeNodeRect:oe,activatorEvent:D,collisions:Te,containerNodeRect:se,dragOverlay:ue,draggableNodes:v,droppableContainers:b,droppableRects:te,over:De,measureDroppableContainers:ne,scrollableAncestors:ge,scrollableAncestorRects:_e,measuringConfiguration:j,measuringScheduled:M,windowRect:he}),[C,N,oe,D,Te,se,ue,v,b,te,De,ne,ge,_e,j,M,he]),Pe=(0,z.useMemo)(()=>({activatorEvent:D,activators:Me,active:C,activeNodeRect:oe,ariaDescribedById:{draggable:ee},dispatch:d,draggableNodes:v,over:De,measureDroppableContainers:ne}),[D,Me,C,oe,d,ee,v,De,ne]);return z.createElement(f5.Provider,{value:p},z.createElement(_7.Provider,{value:Pe},z.createElement(v7.Provider,{value:Ne},z.createElement(b7.Provider,{value:ke},i)),z.createElement(Nze,{disabled:n?.restoreFocus===!1})),z.createElement(zRe,{...n,hiddenTextDescribedById:ee}));function Fe(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),Ize=(0,z.createContext)(null),C7=`button`,Lze=`Draggable`;function Rze(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=i5(Lze),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,z.useContext)(_7),{role:p=C7,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,z.useContext)(g?b7:Ize),[v,y]=t5(),[b,x]=t5(),S=Tze(o,t),C=$8(n);return Z8(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,z.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===C7?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function w7(){return(0,z.useContext)(v7)}var zze=`Droppable`,Bze={timeout:25};function T7(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=i5(zze),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,z.useContext)(_7),u=(0,z.useRef)({disabled:n}),d=(0,z.useRef)(!1),f=(0,z.useRef)(null),p=(0,z.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...Bze,...i},_=$8(h??r),v=s7({callback:(0,z.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=t5((0,z.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=$8(t);return(0,z.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,z.useEffect)(()=>(s({type:p5.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:p5.UnregisterDroppable,key:a,id:r})),[r]),(0,z.useEffect)(()=>{n!==u.current.disabled&&(s({type:p5.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function Vze(e){let{animation:t,children:n}=e,[r,i]=(0,z.useState)(null),[a,o]=(0,z.useState)(null),s=n5(n);return!n&&!r&&s&&i(s),Z8(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),z.createElement(z.Fragment,null,n,r?(0,z.cloneElement)(r,{ref:o}):null)}var Hze={x:0,y:0,scaleX:1,scaleY:1};function Uze(e){let{children:t}=e;return z.createElement(_7.Provider,{value:g7},z.createElement(b7.Provider,{value:Hze},t))}var Wze={position:`fixed`,touchAction:`none`},Gze=e=>c5(e)?`transform 250ms ease`:void 0,Kze=(0,z.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=Gze}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...Wze,width:s.width,height:s.height,top:s.top,left:s.left,transform:u5.Transform.toString(d),transformOrigin:i&&r?BRe(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return z.createElement(n,{className:o,style:f,ref:t},a)}),qze={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:u5.Transform.toString(t)},{transform:u5.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function Jze(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return Q8((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=p7(a);if(!c)return;let{transform:l}=K8(a).getComputedStyle(a),u=T5(l);if(!u)return;let d=typeof t==`function`?t:Yze(t);return R5(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function Yze(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...qze,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var E7=0;function Xze(e){return(0,z.useMemo)(()=>{if(e!=null)return E7++,E7},[e])}var D7=z.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=w7(),S=(0,z.useContext)(b7),C=Xze(d?.id),w=y7(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:S,windowRect:x}),T=o7(f),E=Jze({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),D=T?g.setRef:void 0;return z.createElement(Uze,null,z.createElement(Vze,{animation:E},d&&C?z.createElement(Kze,{key:C,id:d.id,ref:D,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:T,style:{zIndex:l,...i},transform:w},n):null))}),Zze=e=>{let{transform:t}=e;return{...t,y:0}};function Qze(e,t,n){let r={...e};return t.top+e.y<=n.top?r.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(r.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?r.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(r.x=n.left+n.width-t.right),r}var $ze=e=>{let{draggingNodeRect:t,transform:n,scrollableAncestorRects:r}=e,i=r[0];return!t||!i?n:Qze(n,t,i)},eBe=e=>{let{transform:t}=e;return{...t,x:0}};function O7(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function tBe(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function k7(e){return e!==null&&e>=0}function nBe(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function rBe(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var A7={scaleX:1,scaleY:1},iBe=e=>{let{rects:t,activeNodeRect:n,activeIndex:r,overIndex:i,index:a}=e,o=t[r]??n;if(!o)return null;let s=aBe(t,a,r);if(a===r){let e=t[i];return e?{x:r<i?e.left+e.width-(o.left+o.width):e.left-o.left,y:0,...A7}:null}return a>r&&a<=i?{x:-o.width-s,y:0,...A7}:a<r&&a>=i?{x:o.width+s,y:0,...A7}:{x:0,y:0,...A7}};function aBe(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return!r||!i&&!a?0:n<t?i?r.left-(i.left+i.width):a.left-(r.left+r.width):a?a.left-(r.left+r.width):r.left-(i.left+i.width)}var j7=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=O7(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},M7={scaleX:1,scaleY:1},N7=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...M7}:null}let s=oBe(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...M7}:r<t&&r>=a?{x:0,y:o.height+s,...M7}:{x:0,y:0,...M7}};function oBe(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var P7=`Sortable`,F7=z.createContext({activeIndex:-1,containerId:P7,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:j7,disabled:{draggable:!1,droppable:!1}});function I7(e){let{children:t,id:n,items:r,strategy:i=j7,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=w7(),d=i5(P7,n),f=s.rect!==null,p=(0,z.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,z.useRef)(p),v=!nBe(p,_.current),y=g!==-1&&h===-1||v,b=rBe(a);Z8(()=>{v&&m&&u(p)},[v,p,m,u]),(0,z.useEffect)(()=>{_.current=p},[p]);let x=(0,z.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:tBe(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return z.createElement(F7.Provider,{value:x},t)}var sBe=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return O7(n,r,i).indexOf(t)},cBe=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},lBe={duration:200,easing:`ease`},L7=`transform`,uBe=u5.Transition.toString({property:L7,duration:0,easing:`linear`}),dBe={roleDescription:`sortable`};function fBe(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,z.useState)(null),s=(0,z.useRef)(n);return Z8(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=E5(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,z.useEffect)(()=>{a&&o(null)},[a]),a}function R7(e){let{animateLayoutChanges:t=cBe,attributes:n,disabled:r,data:i,getNewIndex:a=sBe,id:o,strategy:s,resizeObserverConfig:c,transition:l=lBe}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,z.useContext)(F7),y=pBe(r,p),b=u.indexOf(o),x=(0,z.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,z.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=T7({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:k,attributes:ee,setNodeRef:A,listeners:j,isDragging:te,over:ne,setActivatorNodeRef:M,transform:N}=Rze({id:o,data:x,attributes:{...dBe,...n},disabled:y.draggable}),re=ERe(E,A),ie=!!D,ae=ie&&!m&&k7(f)&&k7(g),oe=!_&&te,se=ae?(oe&&ae?N:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,ce=k7(f)&&k7(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,le=D?.id,ue=(0,z.useRef)({activeId:le,items:u,newIndex:ce,containerId:d}),de=u!==ue.current.items,fe=t({active:D,containerId:d,isDragging:te,isSorting:ie,id:o,index:b,items:u,newIndex:ue.current.newIndex,previousItems:ue.current.items,previousContainerId:ue.current.containerId,transition:l,wasDragging:ue.current.activeId!=null}),pe=fBe({disabled:!fe,index:b,node:w,rect:C});return(0,z.useEffect)(()=>{ie&&ue.current.newIndex!==ce&&(ue.current.newIndex=ce),d!==ue.current.containerId&&(ue.current.containerId=d),u!==ue.current.items&&(ue.current.items=u)},[ie,ce,d,u]),(0,z.useEffect)(()=>{if(le===ue.current.activeId)return;if(le!=null&&ue.current.activeId==null){ue.current.activeId=le;return}let e=setTimeout(()=>{ue.current.activeId=le},50);return()=>clearTimeout(e)},[le]),{active:D,activeIndex:f,attributes:ee,data:x,rect:C,index:b,newIndex:ce,items:u,isOver:T,isSorting:ie,isDragging:te,listeners:j,node:w,overIndex:g,over:ne,setNodeRef:re,setActivatorNodeRef:M,setDroppableNodeRef:E,setDraggableNodeRef:A,transform:pe??se,transition:me()};function me(){if(pe||de&&ue.current.newIndex===b)return uBe;if(!(oe&&!c5(O)||!l)&&(ie||fe))return u5.Transition.toString({...l,property:L7})}}function pBe(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function z7(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var mBe=[W5.Down,W5.Right,W5.Up,W5.Left],B7=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(mBe.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case W5.Down:r.top<a.top&&t.push(n);break;case W5.Up:r.top>a.top&&t.push(n);break;case W5.Left:r.left>a.left&&t.push(n);break;case W5.Right:r.left<a.left&&t.push(n);break}});let c=C5({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=x5(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=O5(c).some((e,t)=>s[t]!==e),i=V7(e,t),a=hBe(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:s5(u,l)}}}};function V7(e,t){return!z7(e)||!z7(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function hBe(e,t){return!z7(e)||!z7(t)||!V7(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function H7({open:e,onOpenChange:t,title:n,description:r,children:i,onSubmit:a,submitLabel:o,submitting:s=!1,canSubmit:c=!0}){let[l,u]=(0,z.useState)(!1),d=s||l;async function f(){if(!(!c||d))try{u(!0),await a()}finally{u(!1)}}return(0,B.jsx)(D4,{open:e,onOpenChange:t,children:(0,B.jsxs)(O4,{side:`right`,className:`w-4/5 sm:max-w-none gap-0 p-0`,children:[(0,B.jsxs)(k4,{className:`border-b px-6 py-4`,children:[(0,B.jsx)(j4,{children:n}),r?(0,B.jsx)(M4,{children:r}):null]}),(0,B.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),f()},children:[(0,B.jsx)(`div`,{className:`oc-sheet__body flex-1 overflow-y-auto px-6 py-4`,children:i}),(0,B.jsxs)(A4,{className:`border-t px-6 py-4`,children:[(0,B.jsxs)(Ov,{type:`submit`,disabled:!c||d,children:[d?(0,B.jsx)(wS,{className:`size-4 animate-spin`}):null,o??Zte()]}),(0,B.jsx)(Ov,{type:`button`,variant:`ghost`,onClick:()=>t(!1),children:tee()})]})]})]})})}var U7=[{value:`red`,hue:`var(--oc-accent-red, oklch(0.63 0.21 25))`},{value:`orange`,hue:`var(--oc-accent-orange, oklch(0.7 0.17 50))`},{value:`amber`,hue:`var(--oc-accent-amber, oklch(0.8 0.15 85))`},{value:`green`,hue:`var(--oc-accent-green, oklch(0.7 0.16 150))`},{value:`teal`,hue:`var(--oc-accent-teal, oklch(0.7 0.12 190))`},{value:`blue`,hue:`var(--oc-accent-blue, oklch(0.62 0.19 250))`},{value:`violet`,hue:`var(--oc-accent-violet, oklch(0.6 0.2 300))`},{value:`pink`,hue:`var(--oc-accent-pink, oklch(0.7 0.2 350))`}],W7=e=>U7.find(t=>t.value===e)?.hue??null;function gBe(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)>>>0;return U7[t%U7.length].hue}var G7=e=>W7(e.color)??gBe(e._id);function K7({open:e,onOpenChange:t,title:n,movingFolderId:r,currentId:i,onPick:a}){let o=P(L.projects.listProjects,e?{}:`skip`),[s,c]=(0,z.useState)(``),l=(0,z.useMemo)(()=>{let e=o??[],t=pMe(e),n=s.trim().toLowerCase();return(n===``?t:t.filter(e=>e.node.name.toLowerCase().includes(n))).map(t=>({...t,disabled:r!==void 0&&!O2(e,r,t.node._id)}))},[o,s,r]),u=()=>{t(!1),c(``)};return(0,B.jsx)(s$,{open:e,onOpenChange:e=>{e||c(``),t(e)},children:(0,B.jsxs)(c$,{className:`oc-folderpick`,showCloseButton:!1,children:[(0,B.jsx)(l$,{children:(0,B.jsx)(d$,{children:n})}),(0,B.jsx)(VI,{autoFocus:!0,value:s,onChange:e=>c(e.target.value),placeholder:Tte()}),(0,B.jsxs)(`div`,{className:`oc-folderpick__list`,role:`listbox`,children:[(0,B.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":i===null,className:`oc-folderpick__opt`,onClick:()=>{a(null),u()},children:[(0,B.jsx)(Joe,{size:14,"aria-hidden":!0,className:`oc-folderpick__ico`}),(0,B.jsx)(`span`,{className:`oc-folderpick__name`,children:Yne()}),i===null?(0,B.jsx)(qx,{size:13,"aria-hidden":!0,className:`oc-folderpick__check`}):null]}),l.length===0?(0,B.jsx)(`p`,{className:`oc-folderpick__empty`,children:Bd()}):l.map(({node:e,depth:t,disabled:n})=>(0,B.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":e._id===i,disabled:n,className:`oc-folderpick__opt`,style:{"--pick-depth":t-1,"--proj-hue":G7(e)},onClick:()=>{a(e._id),u()},children:[(0,B.jsx)(gS,{size:14,"aria-hidden":!0,className:`oc-folderpick__ico`}),(0,B.jsx)(`span`,{className:`oc-folderpick__name`,children:e.name}),e._id===i?(0,B.jsx)(qx,{size:13,"aria-hidden":!0,className:`oc-folderpick__check`}):null]},e._id))]})]})})}function q7(){return P(L.trash.retention,{})?.days??30}function J7({folders:e,chats:t,days:n}){return e>0?vs({folders:e,chats:t,days:n}):t>0?Hie({count:t,days:n}):kne()}function _Be(e,t=Nm()){return new Date(e).toLocaleDateString(t,{day:`2-digit`,month:`2-digit`})}var Y7=6e4,X7=60*Y7,Z7=24*X7,Q7=7*Z7,$7=30*Z7,e9=365*Z7;function t9(e,t){let n=t-e;if(n<Y7)return`maintenant`;if(n<X7)return`${Math.floor(n/Y7)}min`;if(n<Z7)return`${Math.floor(n/X7)}h`;if(n<Q7)return`${Math.floor(n/Z7)}j`;if(n<$7)return`${Math.floor(n/Q7)}sem`;if(n<e9)return`${Math.floor(n/$7)}mois`;let r=Math.floor(n/e9);return`${r}an${r>1?`s`:``}`}var n9=`project:none`,vBe=e=>`project:${e}`,r9=`projhead:`,i9=e=>`${r9}${e}`,a9=`oc.noproject.collapsed`,o9=`oc.shared.collapsed`;function s9(){return(0,B.jsx)(`div`,{className:`oc-sidebar__skeleton`,"aria-hidden":`true`,children:Array.from({length:7}).map((e,t)=>(0,B.jsx)(`div`,{className:`oc-skel oc-skel--row`},t))})}var c9=(0,z.createContext)(new Map);function yBe({activeChatId:e,onSelect:t,onNewChat:n,newChatShortcut:r}){let i=P(L.messages.listChats,{}),a=P(L.projects.listProjects,{}),o=P(L.me.getMe,{host:A2})?.ui?.effective?.showChatAge??!0,s=P(L.chatReads.myChatReads,{}),c=(0,z.useMemo)(()=>{let e=new Map;for(let t of s??[])e.set(t.chatId,t.lastSeenAt);return e},[s]),l=P(L.chatReads.myBusyChats,{}),u=(0,z.useMemo)(()=>new Set(l??[]),[l]),{byChat:d}=C$(l??null),p=P(L.agentRequests.pendingByChat,{}),m=(0,z.useMemo)(()=>{let e=new Map;for(let t of p??[])e.set(t.chatId,t.kinds.includes(`approval`)?`approval`:t.kinds.includes(`credential`)?`credential`:`question`);return e},[p]),h=P(L.chatBookmarks.myBookmarkedChats,{}),g=P(L.chatExport.referenceLabel,{}),_=(0,z.useMemo)(()=>new Set(h??[]),[h]),v=(0,z.useMemo)(()=>{let t=new Set;for(let n of i??[]){if(n._id===e)continue;let r=c.get(n._id);r!==void 0&&n.lastAssistantAt!==null&&n.lastAssistantAt>r&&t.add(n._id)}return t},[i,c,e]),[y,b]=(0,z.useState)(0);(0,z.useEffect)(()=>{if(!o)return;let e=window.setInterval(()=>b(e=>e+1),6e4);return()=>window.clearInterval(e)},[o]);let x=I(L.projects.createProject),S=I(L.projects.setProjectCollapsed),C=I(L.projects.setProjectSidebar),w=I(L.chats.reorderChat),T=I(L.projects.reorderProject),E=I(L.chats.moveChatToProject),D=y4(),O=th(),k=(0,z.useRef)(null),ee=(0,z.useRef)(null),A=(0,z.useRef)(null),[j,te]=(0,z.useState)(`full`);(0,z.useLayoutEffect)(()=>{let e=k.current;if(!e)return;let t=()=>{let t=e.clientWidth,n=ee.current?.offsetWidth??0,r=A.current?.offsetWidth??0,i=n===0||t>=n?`full`:t>=r?`label`:`icon`;te(e=>e===i?e:i)};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[O,r]);let[ne,M]=(0,z.useState)(null),N=(0,z.useRef)(!1);(0,z.useEffect)(()=>{!N.current&&i&&M(i)},[i]);let re=ne??i??[],ie=re.filter(e=>e.sidebarHidden!==!0),ae=re.filter(e=>e.sidebarHidden===!0),oe=i===void 0&&ne===null,[se,ce]=(0,z.useState)(null),[le,ue]=(0,z.useState)(()=>localStorage.getItem(a9)===`1`),[de,fe]=(0,z.useState)(()=>localStorage.getItem(o9)===`1`);function pe(){fe(e=>(localStorage.setItem(o9,e?`0`:`1`),!e))}function me(){ue(e=>(localStorage.setItem(a9,e?`0`:`1`),!e))}let he=E4();(0,z.useEffect)(()=>{if(!he?.expand)return;let e=ie.find(e=>e._id===he.chatId);if(!e)return;let t=e.projectId??null;if(t===null){le&&(localStorage.setItem(a9,`0`),ue(!1));return}let n=(a??[]).find(e=>e._id===t);n&&n.parentId!==null||n?.collapsed&&S({projectId:t,collapsed:!1})},[he,ie,a,le,S]);let ge=g5(h5(Q5,{activationConstraint:{distance:4}}),h5(e7,{activationConstraint:{delay:250,tolerance:8}}),h5(K5,{coordinateGetter:B7})),_e=(0,z.useRef)(!1),ve=()=>{_e.current=!0,setTimeout(()=>{_e.current=!1},0)},ye=(0,z.useCallback)(e=>String(e.active.id).startsWith(r9)?C5({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(r9))}):C5(e),[]),be=ie.filter(e=>e.pinned),xe=ie.filter(e=>!e.pinned&&e.role===`participant`),Se=ie.filter(e=>!e.pinned&&e.role!==`participant`),Ce=e=>Se.filter(t=>(t.projectId??null)===e),we=wx(),Te=(0,z.useMemo)(()=>lMe(a??[]),[a]),Ee=(0,z.useMemo)(()=>Te.filter(e=>!e.sidebarHidden),[Te]),De=(0,z.useMemo)(()=>Te.filter(e=>e.sidebarHidden),[Te]),Oe=(0,z.useMemo)(()=>{let e=a??[];return new Map(e.map(t=>[t._id,fMe(e,t._id)]))},[a]),ke=(0,z.useMemo)(()=>new Map((a??[]).map(e=>[e._id,e.name])),[a]),Ae=e=>Se.filter(t=>t.projectId!==null&&(Oe.get(t.projectId)??t.projectId)===e);function je(e){return ie.find(t=>t._id===e)}async function Me(e){ce(null),ve();let{active:t,over:n}=e;if(!n)return;let r=String(t.id),i=String(n.id);if(r.startsWith(r9)){let e=r.slice(9),t=Ee,n=null;if(i.startsWith(r9))n=i.slice(9);else if(i.startsWith(`project:`)&&i!==n9)n=i.slice(8);else{let e=je(i);n=e&&!e.pinned?e.projectId??null:null}if(n===null||n===e)return;let a=t.findIndex(t=>t._id===e),o=t.findIndex(e=>e._id===n);if(a<0||o<0)return;let s=[...t],[c]=s.splice(a,1);s.splice(o,0,c);let l=s[o-1]??null,u=s[o+1]??null;await T({projectId:e,prevKey:l?l.sortKey:null,nextKey:u?u.sortKey:null});return}let a=je(r);if(!a||a.role===`participant`)return;if(i.startsWith(r9)){let e=i.slice(9);if((a.projectId??null)===e)return;N.current=!0,M(t=>(t??ie).map(t=>t._id===a._id?{...t,projectId:e}:t));try{await E({chatId:a._id,projectId:e})}finally{N.current=!1}return}if(i.startsWith(`project:`)){let e=i===n9?null:i.slice(8);if((a.projectId??null)===e)return;N.current=!0,M(t=>(t??ie).map(t=>t._id===a._id?{...t,projectId:e}:t));try{await E({chatId:a._id,projectId:e})}finally{N.current=!1}return}let o=je(i);if(!o||t.id===n.id)return;if((o.projectId??null)!==(a.projectId??null)||o.pinned!==a.pinned){if(a.pinned||o.pinned)return;N.current=!0,M(e=>(e??ie).map(e=>e._id===a._id?{...e,projectId:o.projectId??null}:e));try{await E({chatId:a._id,projectId:o.projectId??null})}finally{N.current=!1}return}let s=o.pinned?be:Ce(o.projectId??null),c=s.map(e=>e._id),l=c.indexOf(a._id),u=c.indexOf(o._id);if(l<0||u<0)return;let d=[...s];d.splice(l,1),d.splice(u,0,a);let f=d[u-1]??null,p=d[u+1]??null;N.current=!0,M(e=>[...(e??ie).filter(e=>!s.some(t=>t._id===e._id)),...d]);try{await w({chatId:a._id,prevKey:f?f.sortKey:null,nextKey:p?p.sortKey:null})}finally{N.current=!1}}let Ne=H8(),Pe=Ne?wRe(Ne.state):null,[Fe,Ie]=(0,z.useState)(!1),Le=se?je(se):null;return(0,B.jsx)(c9.Provider,{value:m,children:(0,B.jsx)(x$.Provider,{value:d,children:(0,B.jsxs)(`aside`,{className:`oc-sidebar`+(Fe?` oc-sidebar--archivedrop`:``),onDragOver:e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),Ie(!0))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||Ie(!1)},onDrop:e=>{if(!e.dataTransfer.types.includes(`Files`))return;e.preventDefault(),Ie(!1);let t=e.dataTransfer.files[0];t!==void 0&&Ne?.importArchive(t,null)},children:[Fe?(0,B.jsxs)(`div`,{className:`oc-sidebar__droparchive`,"aria-hidden":!0,children:[(0,B.jsx)(bC,{className:`size-4`}),(0,B.jsx)(`span`,{children:Hc()})]}):null,Pe===null?null:(0,B.jsxs)(`div`,{className:`oc-sidebar__transfer`,role:`status`,"aria-live":`polite`,children:[(0,B.jsx)(`span`,{className:`oc-sidebar__transfer-spin`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-sidebar__transfer-label`,children:Pe})]}),(0,B.jsxs)(`div`,{className:`oc-sidebar__top`,ref:k,children:[(0,B.jsxs)(Ov,{className:j===`icon`?`oc-newchat flex-1 justify-center`:`oc-newchat flex-1 justify-start`,onClick:n,title:`${O} (${r})`,"aria-label":O,children:[(0,B.jsx)(YS,{}),j===`icon`?null:(0,B.jsx)(`span`,{className:`oc-newchat__label`,children:O}),j===`full`?(0,B.jsx)(`kbd`,{className:`oc-newchat__kbd`,"aria-hidden":!0,children:r}):null]}),(0,B.jsx)(`div`,{className:`oc-newchat-ghost`,"aria-hidden":!0,children:(0,B.jsxs)(`div`,{className:`oc-newchat-ghost__row`,ref:ee,children:[(0,B.jsxs)(Ov,{className:`oc-newchat justify-start`,tabIndex:-1,children:[(0,B.jsx)(YS,{}),(0,B.jsx)(`span`,{className:`oc-newchat__label`,children:O}),(0,B.jsx)(`kbd`,{className:`oc-newchat__kbd`,children:r})]}),(0,B.jsx)(Ov,{variant:`outline`,size:`icon`,tabIndex:-1,children:(0,B.jsx)(hS,{})})]})}),(0,B.jsx)(`div`,{className:`oc-newchat-ghost`,"aria-hidden":!0,children:(0,B.jsxs)(`div`,{className:`oc-newchat-ghost__row`,ref:A,children:[(0,B.jsxs)(Ov,{className:`oc-newchat justify-start`,tabIndex:-1,children:[(0,B.jsx)(YS,{}),(0,B.jsx)(`span`,{className:`oc-newchat__label`,children:O})]}),(0,B.jsx)(Ov,{variant:`outline`,size:`icon`,tabIndex:-1,children:(0,B.jsx)(hS,{})})]})}),(0,B.jsx)(Ov,{className:`oc-newproject`,variant:`outline`,size:`icon`,"aria-label":Gg(),title:Gg(),onClick:async()=>{let e=await D({title:Gg(),label:cte(),placeholder:fre(),confirmLabel:kp()});e&&await x({name:e})},children:(0,B.jsx)(hS,{})})]}),(0,B.jsxs)(S7,{sensors:ge,collisionDetection:ye,modifiers:[eBe,$ze],onDragStart:e=>ce(String(e.active.id)),onDragCancel:()=>{ce(null),ve()},onDragEnd:Me,children:[(0,B.jsx)(`div`,{className:`oc-sidebar__scroll`,children:oe?(0,B.jsx)(s9,{}):(0,B.jsxs)(B.Fragment,{children:[be.length>0?(0,B.jsx)(l9,{label:f(),chats:be,children:be.map(n=>(0,B.jsx)(u9,{chat:n,active:n._id===e,unread:v.has(n._id),busy:u.has(n._id),bookmarked:_.has(n._id),referenceLabel:g,ageTick:y,suppressClick:_e,onSelect:t},n._id))}):null,(0,B.jsx)(I7,{items:Ee.map(e=>i9(e._id)),strategy:N7,children:Ee.map(n=>{let r=Ae(n._id);return(0,B.jsx)(l9,{label:n.name,dropId:vBe(n._id),sortId:i9(n._id),suppressClick:_e,projectId:n._id,project:n,chats:r,collapsible:!0,collapsed:n.collapsed,busy:r.some(e=>u.has(e._id)),unread:r.some(e=>v.has(e._id)),onToggle:()=>void S({projectId:n._id,collapsed:!n.collapsed}),onOpen:()=>void we({to:`/project/$projectId`,params:{projectId:n._id}}),children:n.collapsed?null:r.length===0?(0,B.jsx)(`div`,{className:`oc-sidebar__empty`,children:qo()}):r.map(r=>(0,B.jsx)(u9,{chat:r,active:r._id===e,unread:v.has(r._id),busy:u.has(r._id),bookmarked:_.has(r._id),referenceLabel:g,domainLabel:r.projectId!==null&&r.projectId!==n._id?ke.get(r.projectId)??null:null,ageTick:y,suppressClick:_e,onSelect:t},r._id))},n._id)})}),De.length>0?(0,B.jsxs)(NI,{children:[(0,B.jsx)(PI,{asChild:!0,children:(0,B.jsxs)(`button`,{className:`oc-sidebar__hiddenfolders`,children:[(0,B.jsx)(uS,{className:`size-3.5`,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:Wt({count:De.length})})]})}),(0,B.jsx)(FI,{align:`start`,className:`w-56`,children:De.map(e=>(0,B.jsxs)(II,{onSelect:()=>void C({projectId:e._id,hidden:!1}),children:[(0,B.jsx)(mS,{}),` `,e.name]},e._id))})]}):null,xe.length>0||ae.length>0?(0,B.jsxs)(l9,{label:cee(),chats:xe,collapsible:!0,collapsed:de,busy:xe.some(e=>u.has(e._id)),unread:xe.some(e=>v.has(e._id)),onToggle:pe,children:[de?null:xe.map(n=>(0,B.jsx)(u9,{chat:n,active:n._id===e,unread:v.has(n._id),busy:u.has(n._id),bookmarked:_.has(n._id),referenceLabel:g,ageTick:y,suppressClick:_e,onSelect:t},n._id)),!de&&ae.length>0?(0,B.jsx)(bBe,{chats:ae}):null]}):null,(0,B.jsx)(l9,{label:Ku(),dropId:n9,chats:Ce(null),collapsible:!0,collapsed:le,busy:Ce(null).some(e=>u.has(e._id)),unread:Ce(null).some(e=>v.has(e._id)),onToggle:me,children:le?null:Ce(null).map(n=>(0,B.jsx)(u9,{chat:n,active:n._id===e,unread:v.has(n._id),busy:u.has(n._id),bookmarked:_.has(n._id),referenceLabel:g,ageTick:y,suppressClick:_e,onSelect:t},n._id))})]})}),(0,B.jsxs)(D7,{children:[se?.startsWith(r9)?(()=>{let e=(a??[]).find(e=>i9(e._id)===se);return e?(0,B.jsxs)(`div`,{className:`oc-sidebar__group-head oc-chatitem--overlay`,style:{"--proj-hue":G7(e)},children:[(0,B.jsx)(cv,{className:`size-3.5 shrink-0 oc-sidebar__group-chev`}),(0,B.jsx)(`span`,{className:`oc-sidebar__group-label`,children:e.name})]}):null})():null,Le?(0,B.jsxs)(`div`,{className:`oc-chatitem oc-chatitem--overlay`,children:[W7(Le.color)?(0,B.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:W7(Le.color)}}):(0,B.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,B.jsx)(`span`,{className:`oc-chatitem__label`,children:Le.title||Ql()})]}):null]})]}),(0,B.jsxs)(Ov,{variant:`ghost`,size:`sm`,className:`oc-sidebar__trash`,onClick:()=>void we({to:`/trash`}),children:[(0,B.jsx)(vC,{}),` `,yi()]})]})})})}function l9({label:e,dropId:t,sortId:n,suppressClick:r,projectId:i,project:a,chats:o,collapsible:s,collapsed:c,busy:l,unread:u,onToggle:d,onOpen:f,children:p}){let m=I(L.projects.setProjectSidebar),h=H8(),_=(0,z.useContext)(x$),v=o.map(e=>_.get(e._id)).find(e=>e!==void 0)??null,y=I(L.projects.deleteProject),b=I(L.projects.renameProject),x=I(L.projects.setProjectColor),S=I(L.projects.moveProject),C=v4(),w=q7(),[T,E]=(0,z.useState)(!1),[D,O]=(0,z.useState)(e),[k,ee]=(0,z.useState)(!1),A=P(L.projects.projectTreeCount,i?{projectId:i}:`skip`),{setNodeRef:j,isOver:te}=T7({id:t??`static:${e}`}),ne=R7({id:n??`static-sort:${e}`,disabled:!n}),{onKeyDown:M,...N}=ne.listeners??{},re=f??d,ie=e=>{e.target===e.currentTarget&&s&&re&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),re())},ae=a?G7(a):null;return(0,B.jsxs)(`div`,{ref:e=>{t&&j(e),n&&ne.setNodeRef(e)},className:`oc-sidebar__group`+(te?` oc-sidebar__group--over`:``)+(a?` oc-sidebar__group--project`:``),style:{...ae?{"--proj-hue":ae}:{},...n?{transform:u5.Transform.toString(ne.transform),transition:ne.transition,opacity:ne.isDragging?.35:1}:{}},children:[(0,B.jsxs)(`div`,{className:`oc-sidebar__group-head group/head`+(s?` oc-sidebar__group-head--btn`:``),title:c&&l&&v?b$(v):void 0,...s?{role:`button`,tabIndex:0,onClick:()=>{r?.current||re?.()},onKeyDown:ie}:{},...n?N:{},children:[s?f?(0,B.jsx)(`button`,{type:`button`,className:`oc-sidebar__group-chevbtn`,"aria-label":c?ut():Mt(),"aria-expanded":!c,onClick:e=>{e.stopPropagation(),!r?.current&&d?.()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:c?(0,B.jsx)(Yx,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):(0,B.jsx)(cv,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)})}):c?(0,B.jsx)(Yx,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):(0,B.jsx)(cv,{className:`size-3.5 shrink-0`+(a?` oc-sidebar__group-chev`:``)}):null,(0,B.jsx)(`span`,{className:`oc-sidebar__group-label`,children:e}),n?(0,B.jsx)(`button`,{className:`oc-drag-a11y`,"aria-label":e_(),onClick:e=>e.stopPropagation(),...ne.attributes,onKeyDown:M,children:(0,B.jsx)(vS,{className:`size-3.5`})}):null,c&&l?(0,B.jsx)(`span`,{className:S$(v,xu()).className,title:S$(v,xu()).label,"aria-label":S$(v,xu()).label}):null,c&&u?(0,B.jsx)(`span`,{className:`oc-chatitem__unread`,title:Ac(),"aria-label":Ac()}):null,i?(0,B.jsxs)(NI,{children:[(0,B.jsx)(PI,{asChild:!0,children:(0,B.jsx)(Ov,{variant:`ghost`,size:`icon-xs`,"aria-label":dne(),className:`oc-sidebar__group-menu opacity-0 group-hover/head:opacity-100 group-focus-within/head:opacity-100 aria-expanded:opacity-100`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:(0,B.jsx)(sS,{})})}),(0,B.jsxs)(FI,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[f?(0,B.jsxs)(II,{onSelect:()=>f(),children:[(0,B.jsx)(mS,{}),` `,Hi()]}):null,(0,B.jsxs)(II,{onSelect:()=>{O(e),E(!0)},children:[(0,B.jsx)(WS,{}),` `,g()]}),(0,B.jsxs)(II,{onSelect:()=>ee(!0),children:[(0,B.jsx)(hS,{}),` `,jre()]}),a!==void 0&&a.parentId===null?(0,B.jsxs)(II,{onSelect:()=>void m({projectId:a._id,hidden:!0}),children:[(0,B.jsx)(uS,{}),` `,xr()]}):null,h&&a?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(II,{disabled:h.state.running,onSelect:()=>h.exportFolder(a._id,e),children:[(0,B.jsx)(oS,{}),` `,zn()]}),(0,B.jsxs)(II,{disabled:h.state.running,onSelect:()=>h.pickAndImport(a._id),children:[(0,B.jsx)(bC,{}),` `,Bl()]})]}):null,(0,B.jsx)(LI,{children:tu()}),(0,B.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,B.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void x({projectId:i,color:null}),"aria-label":wu(),children:`✕`}),U7.map(e=>(0,B.jsx)(`button`,{className:`oc-colorgrid__dot`+(a?.color===e.value?` is-selected`:``),style:{background:e.hue},"aria-label":e.value,onClick:()=>void x({projectId:i,color:e.value})},e.value))]}),(0,B.jsx)(RI,{}),(0,B.jsxs)(II,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let t=A?.folders??0,n=A?.chats??0;await C({title:Ce({name:e}),description:J7({folders:t,chats:n,days:w}),confirmWord:xg(),confirmLabel:el(),destructive:!0})&&await y({projectId:i})})},children:[(0,B.jsx)(vC,{}),` `,xg()]})]})]}):null]}),(0,B.jsx)(`div`,{className:a&&!c?`oc-sidebar__group-body`:void 0,children:(0,B.jsx)(I7,{items:o.map(e=>e._id),strategy:N7,children:p})}),i?(0,B.jsx)(H7,{open:T,onOpenChange:E,title:mi(),canSubmit:D.trim().length>0,onSubmit:async()=>{await b({projectId:i,name:D.trim()}),E(!1)},children:(0,B.jsx)(`div`,{className:`oc-form`,children:(0,B.jsxs)(`label`,{className:`oc-field`,children:[(0,B.jsx)(`span`,{className:`oc-field__label`,children:em()}),(0,B.jsx)(VI,{value:D,onChange:e=>O(e.target.value),autoFocus:!0})]})})}):null,i&&k?(0,B.jsx)(K7,{open:k,onOpenChange:ee,title:Lf(),movingFolderId:i,currentId:a?.parentId??null,onPick:e=>void S({projectId:i,parentId:e})}):null]})}var u9=(0,z.memo)(function({chat:e,active:t,unread:n,busy:r,bookmarked:i,referenceLabel:a,domainLabel:o,suppressClick:s,onSelect:c}){let l=(0,z.useContext)(c9).get(e._id),u=(0,z.useContext)(x$).get(e._id)??null,d=H8(),{attributes:f,listeners:p,setNodeRef:m,transform:h,transition:_,isDragging:v}=R7({id:e._id}),{onKeyDown:y,...b}=p??{},x=I(L.chats.renameChat),S=EL(),C=()=>{if(a===void 0)return;let t=TRe(a,e._id);navigator.clipboard.writeText(t).then(()=>S.success(Ro({reference:t})),()=>S.error(qa()))},w=I(L.chats.deleteChat),T=I(L.chats.pinChat),E=I(L.chats.setChatColor),D=I(L.chats.moveChatToProject),O=I(L.chats.setChatSidebar),k=I(L.chatParticipants.leaveChat),ee=e.role===`participant`,A=wx(),[j,te]=(0,z.useState)(!1),M=P(L.me.getMe,{host:A2})?.ui?.effective?.showChatAge??!0,N=v4(),re=q7(),[ie,ae]=(0,z.useState)(!1),[oe,se]=(0,z.useState)(e.title??``),ce=E4()?.chatId===e._id,le=(0,z.useRef)(null);(0,z.useEffect)(()=>{if(!ce)return;let t=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;le.current?.scrollIntoView({block:`nearest`,behavior:t?`auto`:`smooth`});let n=setTimeout(()=>T4(e._id),2600);return()=>clearTimeout(n)},[ce,e._id]);let ue={transform:u5.Transform.toString(h),transition:_,opacity:+!v},de=W7(e.color);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{ref:e=>{m(e),le.current=e},style:ue,className:`oc-chatitem group/row`+(t?` oc-chatitem--active`:``)+(ce?` oc-chatitem--flash`:``),title:r&&u?b$(u):void 0,onClick:()=>{s.current||c(e._id)},...b,onAnimationEnd:t=>{ce&&t.animationName===`oc-chatitem-flash`&&T4(e._id)},children:[(0,B.jsx)(`button`,{className:`oc-drag-a11y`,"aria-label":e_(),onClick:e=>e.stopPropagation(),...f,onKeyDown:y,children:(0,B.jsx)(vS,{className:`size-3.5`})}),de?(0,B.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:de}}):(0,B.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,B.jsxs)(`button`,{className:`oc-chatitem__label`,onClick:t=>{t.stopPropagation(),!s.current&&c(e._id)},children:[(0,B.jsxs)(`span`,{className:`oc-chatitem__title`,children:[e.group?(0,B.jsx)(CC,{className:`oc-chatitem__group`,size:12,"aria-label":Zf()}):null,e.title||Ql()]}),e.role===`participant`&&e.ownerName?(0,B.jsx)(`span`,{className:`oc-chatitem__domain`,children:Nee({name:e.ownerName})}):o?(0,B.jsx)(`span`,{className:`oc-chatitem__domain`,children:o}):null]}),l===void 0?null:(0,B.jsx)(`span`,{className:`oc-areq-sidebadge oc-areq-sidebadge--${l}`,title:Vl(),"aria-label":Vl(),children:l===`approval`?(0,B.jsx)(oC,{size:11,"aria-hidden":!0}):l===`credential`?(0,B.jsx)(bS,{size:11,"aria-hidden":!0}):(0,B.jsx)(AS,{size:11,"aria-hidden":!0})}),r?(0,B.jsx)(`span`,{className:S$(u,Hr()).className,title:S$(u,Hr()).label,"aria-label":S$(u,Hr()).label}):null,n?(0,B.jsx)(`span`,{className:`oc-chatitem__unread`,title:Ac(),"aria-label":Ac()}):null,e.readOnly?(0,B.jsx)(`span`,{className:`oc-chatitem__readonly`,title:Xn(),children:(0,B.jsx)(ES,{size:12,"aria-label":Xn()})}):null,i?(0,B.jsx)(`span`,{className:`oc-chatitem__bookmark group-hover/row:opacity-0 group-focus-within/row:opacity-0`,title:na(),children:(0,B.jsx)(Ux,{size:12,"aria-label":na()})}):null,M?(0,B.jsx)(`span`,{className:`oc-chatitem__age group-hover/row:opacity-0 group-focus-within/row:opacity-0`,title:n$(e.updatedAt),children:t9(e.updatedAt,Date.now())}):null,(0,B.jsxs)(NI,{children:[(0,B.jsx)(PI,{asChild:!0,children:(0,B.jsx)(Ov,{variant:`ghost`,size:`icon-xs`,"aria-label":Ap(),className:`opacity-0 group-hover/row:opacity-100 group-focus-within/row:opacity-100 aria-expanded:opacity-100`,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:(0,B.jsx)(sS,{})})}),(0,B.jsxs)(FI,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[ee?null:(0,B.jsxs)(II,{onSelect:()=>{se(e.title??``),ae(!0)},children:[(0,B.jsx)(WS,{}),` `,g()]}),d&&!ee?(0,B.jsxs)(II,{disabled:d.state.running,onSelect:()=>d.exportChat(e._id,e.title??Ku()),children:[(0,B.jsx)(oS,{}),` `,ji()]}):null,(0,B.jsxs)(II,{onSelect:()=>void T({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,B.jsx)(qS,{}):(0,B.jsx)(KS,{}),e.pinned?Zo():Yu()]}),ee?null:(0,B.jsx)(uRe,{chatId:e._id}),ee?null:(0,B.jsxs)(II,{onSelect:C,disabled:a===void 0,children:[(0,B.jsx)(SS,{}),` `,hn()]}),ee?null:(0,B.jsxs)(II,{onSelect:()=>te(!0),children:[(0,B.jsx)(mS,{}),` `,sp()]}),e.projectId===null?null:(0,B.jsxs)(II,{onSelect:()=>void A({to:`/project/$projectId`,params:{projectId:e.projectId},search:{c:e._id}}),children:[(0,B.jsx)($oe,{}),` `,ne()]}),e.pinned?null:(0,B.jsxs)(II,{onSelect:()=>void O({chatId:e._id,hidden:!0}),children:[(0,B.jsx)(BS,{}),` `,xr()]}),ee?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(RI,{}),(0,B.jsxs)(II,{variant:`destructive`,onSelect:()=>void k({chatId:e._id}),children:[(0,B.jsx)(DS,{}),` `,Ed()]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(LI,{children:tu()}),(0,B.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,B.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void E({chatId:e._id,color:null}),"aria-label":wu(),children:`✕`}),U7.map(t=>(0,B.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void E({chatId:e._id,color:t.value})},t.value))]}),(0,B.jsx)(RI,{}),(0,B.jsxs)(II,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await N({title:Kr(),description:pne({days:re}),confirmLabel:xg(),destructive:!0})&&await w({chatId:e._id})})},children:[(0,B.jsx)(vC,{}),` `,xg()]})]})]})]})]}),(0,B.jsx)(H7,{open:ie,onOpenChange:ae,title:Yte(),canSubmit:oe.trim().length>0,onSubmit:async()=>{await x({chatId:e._id,title:oe.trim()}),ae(!1)},children:(0,B.jsx)(`div`,{className:`oc-form`,children:(0,B.jsxs)(`label`,{className:`oc-field`,children:[(0,B.jsx)(`span`,{className:`oc-field__label`,children:em()}),(0,B.jsx)(VI,{value:oe,onChange:e=>se(e.target.value),autoFocus:!0})]})})}),j?(0,B.jsx)(K7,{open:j,onOpenChange:te,title:xee(),currentId:e.projectId,onPick:t=>void D({chatId:e._id,projectId:t})}):null]})});function bBe({chats:e}){let[t,n]=(0,z.useState)(!1),r=I(L.chats.setChatSidebar);return(0,B.jsxs)(`div`,{className:`oc-hiddenshared`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-hiddenshared__toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,B.jsx)(cv,{size:12,"aria-hidden":!0}):(0,B.jsx)(Yx,{size:12,"aria-hidden":!0}),yp({count:e.length})]}),t?(0,B.jsx)(`ul`,{className:`oc-hiddenshared__list`,children:e.map(e=>(0,B.jsxs)(`li`,{className:`oc-hiddenshared__row`,children:[(0,B.jsx)(`span`,{className:`oc-hiddenshared__title`,children:e.title??Ku()}),(0,B.jsx)(`button`,{type:`button`,className:`oc-hiddenshared__show`,onClick:()=>void r({chatId:e._id,hidden:!1}),children:Vre()})]},e._id))}):null]})}var d9=null,f9=0,xBe=400;function SBe(){if(typeof window>`u`)return null;let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;if(!d9)try{d9=new e}catch{return null}return d9}function p9(e,t,n,r,i){let a=e.createOscillator(),o=e.createGain();a.type=`sine`,a.frequency.value=t;let s=e.currentTime+n;o.gain.setValueAtTime(1e-4,s),o.gain.linearRampToValueAtTime(i,s+.015),o.gain.exponentialRampToValueAtTime(1e-4,s+r),a.connect(o).connect(e.destination),a.start(s),a.stop(s+r+.02)}function m9(e){let t=Date.now();if(t-f9<xBe)return;let n=SBe();if(!n)return;f9=t;let r=()=>{try{e(n)}catch{}};n.state===`suspended`?n.resume().then(r,()=>{}):r()}function CBe(){m9(e=>{p9(e,660,0,.16,.12),p9(e,440,.14,.2,.1)})}function wBe(){m9(e=>{p9(e,880,0,.14,.08)})}function TBe({activeChatId:e}){let t=P(L.messages.listChats,{}),n=I(L.chatReads.markChatSeen),r=P(L.me.getMe,{host:A2}),i=r?.ui?.effective?.replySound===!0,a=r?.userId??null,o=(0,z.useRef)(null),s=(0,z.useRef)(null);return(0,z.useEffect)(()=>{if(!t)return;s.current!==String(a)&&(s.current=String(a),o.current=null);let r=new Map;for(let e of t)e.lastAssistantAt!==null&&r.set(e._id,e.lastAssistantAt);let c=o.current;if(o.current=r,c===null)return;let l=!1;for(let[t,i]of r){let r=c.get(t);r!==void 0&&i<=r||r===void 0&&Date.now()-i>3e4||(l=!0,t===e&&document.visibilityState===`visible`?n({chatId:t}):t!==e&&w4(t))}l&&i&&wBe()},[t,e,i,n,a]),(0,z.useEffect)(()=>{e&&document.visibilityState===`visible`&&n({chatId:e})},[e,n]),(0,z.useEffect)(()=>{let t=()=>{document.visibilityState===`visible`&&e&&n({chatId:e})};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},[e,n]),null}function h9(e){let t=I(L.chats.createChat),n=P(L.agents.listMyAgents),[r,i]=(0,z.useState)(!1),a=(0,z.useRef)(void 0),o=(0,z.useCallback)(async(n,r)=>{e(await t({instanceName:n,agentId:r,projectId:a.current}))},[t,e]);return{startNewChat:(0,z.useCallback)(async e=>{a.current=e?.projectId;let t=n;if(t&&t.length===1&&t[0].state!==`deleted`){await o(t[0].instanceName,t[0].agentId);return}i(!0)},[n,o]),picker:(0,B.jsx)(WMe,{open:r,onOpenChange:i,agents:n,onPick:(e,t)=>{i(!1),o(e,t)}})}}var g9=[`admin`,`user`,`pending`];function _9(){let e=P(L.me.authProviders)?.anonymous===!0,[t,n]=(0,z.useState)(!1),r=P(L.dev.listUsersDev,e?{}:`skip`),i=P(L.me.getImpersonation),a=I(L.dev.setMyRole),o=I(L.dev.setRole),s=I(L.admin.startImpersonation),c=I(L.admin.stopImpersonation);if(!e)return null;let l=r?.find(e=>e.isMe),u=l?.role===`admin`,d=i?.impersonating===!0,f=(r??[]).filter(e=>!e.isMe);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-devfab`,onClick:()=>n(!0),title:Kre(),children:[(0,B.jsx)(TC,{size:13}),`DEV`]}),(0,B.jsx)(s$,{open:t,onOpenChange:n,children:(0,B.jsxs)(c$,{children:[(0,B.jsxs)(l$,{children:[(0,B.jsx)(d$,{children:md()}),(0,B.jsx)(f$,{children:gee()})]}),(0,B.jsxs)(`div`,{className:`oc-devsw__me`,children:[(0,B.jsxs)(`span`,{className:`oc-devsw__melabel`,children:[Am({canonical:l?.canonical??`…`}),` `,(0,B.jsx)(AL,{variant:`outline`,children:l?.role??`…`})]}),(0,B.jsx)(`div`,{className:`oc-devsw__roles`,children:g9.map(e=>(0,B.jsx)(Ov,{type:`button`,size:`xs`,variant:l?.role===e?`secondary`:`ghost`,disabled:l?.role===e,onClick:()=>void a({role:e}),children:e===`admin`?zee():e===`user`?Kte():Qp()},e))})]}),d?(0,B.jsxs)(`div`,{className:`oc-devsw__imp`,children:[op(),` `,(0,B.jsx)(`strong`,{children:i.targetLabel}),`.`,(0,B.jsx)(Ov,{type:`button`,size:`xs`,variant:`outline`,onClick:()=>void c(),children:Are()})]}):null,(0,B.jsx)(`div`,{className:`oc-devsw__list`,children:f.length===0?(0,B.jsx)(`p`,{className:`oc-devsw__empty`,children:bee()}):f.map(e=>(0,B.jsxs)(`div`,{className:`oc-devsw__row`,children:[(0,B.jsx)(`span`,{className:`oc-devsw__label`,children:e.name||e.email||e.canonical||e.userId.slice(0,8)}),(0,B.jsx)(`select`,{className:`oc-devsw__select`,value:e.role,disabled:!e.canonical,onChange:t=>e.canonical&&void o({canonical:e.canonical,role:t.target.value}),children:g9.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))}),(0,B.jsx)(Ov,{type:`button`,size:`xs`,variant:`ghost`,disabled:!u||e.role===`pending`,title:u?e.role===`pending`?Jne():wte():If(),onClick:()=>{s({profileId:e.profileId}),n(!1)},children:zd()})]},e.profileId))})]})})]})}function v9({label:e,mode:t,minimal:n=!1}){let{signOut:r}=Zv(),i=I(L.me.setThemeMode).withOptimisticUpdate((e,{mode:t})=>{let n=e.getQuery(L.me.getMe,{host:A2});if(!n)return;let r=t===null?n.defaultThemeMode??`system`:t;e.setQuery(L.me.getMe,{host:A2},{...n,themeMode:t,resolvedThemeMode:r})}),a=t??`default`;return(0,B.jsxs)(NI,{children:[(0,B.jsx)(PI,{asChild:!0,children:(0,B.jsxs)(Ov,{variant:`ghost`,size:`sm`,className:`gap-1.5`,children:[e,(0,B.jsx)(cv,{className:`opacity-60`})]})}),(0,B.jsx)(FI,{align:`end`,className:`w-52`,children:n?(0,B.jsxs)(II,{onClick:()=>void r(),children:[(0,B.jsx)(DS,{}),` `,Yg()]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(LI,{children:eee()}),(0,B.jsxs)(zI,{value:a,onValueChange:e=>void i({mode:e==="default"?null:e}),children:[(0,B.jsxs)(BI,{value:`light`,children:[(0,B.jsx)(hC,{}),` `,up()]}),(0,B.jsxs)(BI,{value:`dark`,children:[(0,B.jsx)(RS,{}),` `,Nre()]}),(0,B.jsxs)(BI,{value:`system`,children:[(0,B.jsx)(LS,{}),` `,Tee()]}),(0,B.jsx)(BI,{value:`default`,children:Vf()})]}),(0,B.jsx)(RI,{}),(0,B.jsxs)(II,{onClick:()=>void r(),children:[(0,B.jsx)(DS,{}),` `,Yg()]})]})})]})}var EBe={altered_words:()=>_e(),incorrect:()=>ug(),incoherence:()=>bo(),formatting:()=>kt(),latency:()=>Qt(),api_error:()=>Tc(),other:()=>I_()},y9=e=>EBe[e]?.()??e,DBe={anomaly_open:yC,anomaly_resolved:Qx,feedback_reply:MS,feedback_resolved:MS,feedback_new:MS,curation:fS,operator_announcement:kS,mention:Bx,agent_request:AS,chat_added:CC,group_invite:xC},OBe={atrium:()=>ss(),assistants:()=>id(),platform:()=>du()},kBe={investigating:()=>Fu(),monitoring:()=>ri(),resolved:()=>Sne()},b9=e=>(e?OBe[e]:void 0)?.()??`?`,ABe=e=>(e?kBe[e]:void 0)?.()??`?`,x9=e=>{let t=e===void 0?NaN:Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleString(Nm()):`?`},jBe={notif_feedback_reply_admin:()=>({title:Ho(),body:Za()}),notif_feedback_reply:()=>({title:Ho(),body:Za()}),notif_feedback_resolved:()=>({title:Y_(),body:u_()}),notif_feedback_new:e=>({title:ka(),body:Vh({reference:e.reference??`?`,category:y9(e.category??`other`)})}),notif_mention:e=>({title:hie(),body:Fg({chat:e.chat??``})}),notif_chat_added:e=>({title:Tf({by:e.by??`?`}),body:Fg({chat:e.chat??``})}),notif_group_invite_request:e=>({title:Nie(),body:$re({by:e.by??`?`,group:e.group??`?`})}),notif_group_invite_approved:e=>({title:Od(),body:ym({email:e.email??`?`,group:e.group??`?`})}),notif_group_invite_rejected:e=>({title:Wm(),body:Qee({email:e.email??`?`,group:e.group??`?`})}),notif_agent_request_question:e=>({title:Uc(),body:Ie({chat:e.chat??``})}),notif_agent_request_approval:e=>({title:ur(),body:Ie({chat:e.chat??``})}),notif_agent_request_credential:e=>({title:ml(),body:Ie({chat:e.chat??``})}),notif_curation_proposed:e=>({title:ec(),body:_ie({name:e.name??`?`,agentId:e.agentId??`?`})}),notif_curation_failed:e=>({title:Df(),body:Fie({name:e.name??`?`,reason:e.reason??`unknown`})}),notif_curation_relaunch_refused:e=>({title:tie(),body:Ad({name:e.name??`?`,reason:e.reason??`unknown`})}),notif_anomaly_open:(e,t)=>({title:xm({kind:e.kind??`?`}),body:t.body}),notif_anomaly_resolved:(e,t)=>({title:Km({kind:e.kind??`?`}),body:t.body}),notif_operator_maintenance_scheduled:e=>({title:zte(),body:rf({service:b9(e.service),startsAt:x9(e.starts_at),endsAt:x9(e.ends_at)})}),notif_operator_maintenance_completed:e=>({title:gh(),body:Vne({service:b9(e.service),completedAt:x9(e.completed_at)})}),notif_operator_incident_update:e=>({title:_te(),body:Cre({service:b9(e.service),status:ABe(e.status),reference:e.reference??`?`})}),notif_operator_subscription_notice:e=>({title:Wp(),body:T({plan:e.plan??`?`,effectiveAt:x9(e.effective_at)})})};function S9(e){let t=e.messageKey?jBe[e.messageKey]:void 0;return t?t(e.params??{},e):e.kind===`feedback_reply`?{title:Ho(),body:Za()}:e.kind===`feedback_resolved`?{title:Y_(),body:u_()}:{title:e.title,body:e.body}}function MBe(){let e=P(L.notifications.myUnreadCount)??0,t=P(L.notifications.myNotifications),n=P(L.feedback.myFeedback),r=I(L.notifications.markRead),i=I(L.notifications.markAllRead),a=I(L.notifications.clearOne),o=I(L.notifications.clearAll),s=I(L.feedback.closeMyFeedback),c=wx(),[l,u]=(0,z.useState)(!1),d=P(L.me.getMe,{host:A2}),f=d?.ui?.effective?.notifSound===!0,p=d?.ui?.effective?.notifSystem===!0,m=d?.userId??null,h=(0,z.useRef)(null),g=(0,z.useRef)(0),_=(0,z.useRef)(null);(0,z.useEffect)(()=>{if(!t)return;_.current!==String(m)&&(_.current=String(m),h.current=null,g.current=0);let e=t.reduce((e,t)=>Math.max(e,t.creationTime??0),0);if(h.current===null){h.current=new Set(t.map(e=>String(e._id))),g.current=e;return}let n=h.current,r=t.filter(e=>!n.has(String(e._id))&&(e.creationTime??0)>g.current);for(let e of t)n.add(String(e._id));if(g.current=Math.max(g.current,e),n.size>500){let e=new Set(t.map(e=>String(e._id)));for(let t of n)e.has(t)||n.delete(t)}if(r.length!==0&&(f&&CBe(),p&&typeof Notification<`u`&&Notification.permission===`granted`&&document.visibilityState!==`visible`)){let e=r[0],{title:t,body:n}=S9(e);try{let r=new Notification(t,{body:n,tag:String(e._id)});r.onclick=()=>window.focus()}catch{}}},[t,f,p,m]);let v=e=>{if(e.unread&&r({notificationId:e._id}),!e.href)return;if(u(!1),e.href.startsWith(`/chat/`)){c({to:`/chat/$chatId`,params:{chatId:e.href.slice(6)}});return}let[t,n]=e.href.split(`?`);c({to:t,search:Object.fromEntries(new URLSearchParams(n??``))})};return(0,B.jsxs)(NI,{open:l,onOpenChange:u,children:[(0,B.jsx)(PI,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-bell`,"aria-label":e>0?ee({count:e}):ps(),children:[(0,B.jsx)(Hx,{size:18,"aria-hidden":!0}),e>0?(0,B.jsx)(`span`,{className:`oc-bell__badge`,"aria-hidden":!0,children:e>9?`9+`:e}):null]})}),(0,B.jsxs)(FI,{align:`end`,className:`oc-notif`,children:[(0,B.jsxs)(`div`,{className:`oc-notif__head`,children:[(0,B.jsx)(`span`,{children:ld()}),t&&t.length>0?(0,B.jsxs)(`span`,{className:`oc-notif__bulk`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__act`,disabled:e===0,onClick:()=>void i({}),children:gu()}),(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__act`,onClick:()=>void o({}),children:Vu()})]}):null]}),t===void 0?(0,B.jsx)(`div`,{className:`oc-notif__empty`,children:Ng()}):t.length===0?(0,B.jsx)(`div`,{className:`oc-notif__empty`,children:li()}):(0,B.jsx)(`div`,{className:`oc-notif__list`,children:t.map(e=>{let t=DBe[e.kind]??Hx,{title:n,body:i}=S9(e);return(0,B.jsxs)(`div`,{className:`oc-notif__item${e.unread?` is-unread`:``}${e.href?` is-link`:``}`,role:e.href?`button`:void 0,tabIndex:e.href?0:void 0,onClick:e.href?()=>v(e):void 0,children:[(0,B.jsxs)(`div`,{className:`oc-notif__item-head`,children:[(0,B.jsx)(t,{size:14,className:`oc-notif__kind oc-notif__kind--${e.kind}`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-notif__title`,children:n}),(0,B.jsxs)(`span`,{className:`oc-notif__row-actions`,children:[e.unread?(0,B.jsx)(`button`,{type:`button`,title:Hg(),"aria-label":Hg(),onClick:t=>{t.stopPropagation(),r({notificationId:e._id})},children:(0,B.jsx)(qx,{size:13})}):null,(0,B.jsx)(`button`,{type:`button`,title:Li(),"aria-label":Li(),onClick:t=>{t.stopPropagation(),a({notificationId:e._id})},children:(0,B.jsx)(uv,{size:13})})]})]}),(0,B.jsx)(`p`,{className:`oc-notif__body`,children:i}),(0,B.jsx)(`div`,{className:`oc-notif__when`,children:new Date(e.createdAt).toLocaleString(Nm())})]},e._id)})}),n&&n.length>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`oc-notif__head oc-notif__head--sub`,children:Gn()}),(0,B.jsx)(`div`,{className:`oc-notif__list`,children:n.map(e=>(0,B.jsx)(NBe,{it:e,onClose:t=>s({feedbackId:e._id,reason:t}),onNavigate:()=>u(!1)},e._id))})]}):null]})]})}function NBe({it:e,onClose:t,onNavigate:n}){let r=EL(),[i,a]=(0,z.useState)(!1),[o,s]=(0,z.useState)(!1),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(!1);async function f(){d(!0);try{await t(c.trim()||void 0)}catch(e){r.error(Fs(),e)}finally{d(!1)}}return(0,B.jsxs)(`div`,{className:`oc-notif__item`,children:[(0,B.jsxs)(`div`,{className:`oc-notif__item-head`,children:[(0,B.jsx)(`span`,{className:`oc-notif__title`,children:y9(e.category)}),(0,B.jsx)(`span`,{className:`oc-notif__status${e.answered||e.resolvedAt?` is-answered`:``}`,children:e.resolvedAt?Us():e.answered?ql():Yc()})]}),(0,B.jsx)(`div`,{className:`oc-notif__when`,children:new Date(e.at).toLocaleString(Nm())}),e.thread.length>0?(0,B.jsx)(`div`,{className:`oc-notif__thread`,children:e.thread.map((e,t)=>(0,B.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,B.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?gr():e.authorRole===`agent`?w_():bl()}),(0,B.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):null,e.messageText?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-notif__report-toggle`,"aria-expanded":i,onClick:()=>a(e=>!e),children:[i?(0,B.jsx)(cv,{size:13,"aria-hidden":!0}):(0,B.jsx)(Yx,{size:13,"aria-hidden":!0}),av()]}),i?(0,B.jsx)(`div`,{className:`oc-notif__report-msg`,children:e.messageText}):null]}):null,(0,B.jsxs)(`div`,{className:`oc-notif__report-actions`,children:[(0,B.jsx)(Ax,{to:`/chat/$chatId`,params:{chatId:e.chatId},search:{m:e.messageId},className:`oc-notif__link`,onClick:n,children:He()}),o?null:(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__link oc-notif__link--muted`,onClick:()=>s(!0),children:Fs()})]}),o?(0,B.jsxs)(`div`,{className:`oc-notif__close-form`,children:[(0,B.jsx)(`textarea`,{className:`oc-notif__close-input`,rows:2,value:c,onChange:e=>l(e.target.value),placeholder:oa()}),(0,B.jsxs)(`div`,{className:`oc-notif__close-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__close-confirm`,disabled:u,onClick:()=>void f(),children:Lr()}),(0,B.jsx)(`button`,{type:`button`,className:`oc-notif__close-cancel`,onClick:()=>{s(!1),l(``)},children:yn()})]})]}):null]})}var C9=2,PBe=180;function FBe(){let e=wx(),t=(0,z.useRef)(null),n=(0,z.useRef)(null),[r,i]=(0,z.useState)(!1),[a,o]=(0,z.useState)(``),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(0),d=(0,z.useMemo)(()=>rL(JI,tL()),[]);(0,z.useEffect)(()=>{let e=setTimeout(()=>c(a),PBe);return()=>clearTimeout(e)},[a]);let f=s.trim(),p=P(L.search.searchConversations,f.length>=C9?{query:f}:`skip`),m=p??[],g=f.length>=C9&&p===void 0;(0,z.useEffect)(()=>{let e=e=>{iL(e,JI)&&(e.preventDefault(),i(!0))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,z.useEffect)(()=>{r&&(o(``),c(``),u(0))},[r]),(0,z.useEffect)(()=>{u(0)},[p]),(0,z.useEffect)(()=>{(n.current?.querySelector(`[data-index="${l}"]`))?.scrollIntoView({block:`nearest`})},[l]);let _=(0,z.useCallback)((t,n)=>{i(!1),n&&a.trim()&&a6(n,a.trim()),e({to:`/chat/$chatId`,params:{chatId:t},...n?{search:{m:n}}:{}})},[e,a]);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,className:`oc-search-trigger`,onClick:()=>i(!0),"aria-label":Zp(),children:[(0,B.jsx)($S,{className:`oc-search-trigger__icon`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-search-trigger__label`,children:ap()}),(0,B.jsx)(`kbd`,{className:`oc-search-trigger__kbd`,children:d})]}),(0,B.jsx)(s$,{open:r,onOpenChange:i,children:(0,B.jsxs)(c$,{showCloseButton:!1,className:`oc-search-palette top-[12vh] translate-y-0 max-w-xl gap-0 overflow-hidden p-0`,onOpenAutoFocus:e=>{e.preventDefault(),t.current?.focus()},children:[(0,B.jsx)(d$,{className:`sr-only`,children:kre()}),(0,B.jsxs)(`div`,{className:`oc-search-palette__head`,children:[(0,B.jsx)($S,{className:`oc-search-palette__head-icon`,"aria-hidden":!0}),(0,B.jsx)(`input`,{ref:t,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`)e.preventDefault(),u(e=>Math.min(e+1,m.length-1));else if(e.key===`ArrowUp`)e.preventDefault(),u(e=>Math.max(e-1,0));else if(e.key===`Enter`){e.preventDefault();let t=m[l];t&&_(t.chatId,t.messageId)}},placeholder:yee(),className:`oc-search-palette__field`,autoComplete:`off`,spellCheck:!1,"aria-label":Ff()})]}),(0,B.jsx)(`div`,{className:`oc-search-palette__results`,ref:n,role:`listbox`,children:f.length<C9?(0,B.jsx)(`div`,{className:`oc-search-palette__hint`,children:qne({count:C9})}):g?(0,B.jsx)(`div`,{className:`oc-search-palette__hint`,children:Cte()}):m.length===0?(0,B.jsx)(`div`,{className:`oc-search-palette__hint`,children:Rd({term:f})}):m.map((e,t)=>(0,B.jsxs)(`button`,{type:`button`,"data-index":t,role:`option`,"aria-selected":t===l,className:Wg(`oc-search-result`,t===l&&`is-active`),onMouseMove:()=>u(t),onClick:()=>_(e.chatId,e.messageId),children:[(0,B.jsx)(`span`,{className:`oc-search-result__icon`,"aria-hidden":!0,children:e.matchedIn===`title`?(0,B.jsx)(nse,{size:15}):(0,B.jsx)(MS,{size:15})}),(0,B.jsxs)(`span`,{className:`oc-search-result__body`,children:[(0,B.jsx)(`span`,{className:`oc-search-result__title`,children:e.title||eh()}),e.projectPath&&e.projectPath.length>0?(0,B.jsx)(`span`,{className:`oc-search-result__path`,"aria-label":$p(),children:e.projectPath.join(` › `)}):null,e.snippet?(0,B.jsx)(`span`,{className:`oc-search-result__snippet`,children:e.snippet}):null]}),(0,B.jsx)(`span`,{className:`oc-search-result__tag`,children:e.matchedIn===`title`?One():ste()})]},e.chatId))}),(0,B.jsxs)(`div`,{className:`oc-search-palette__footer`,children:[(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`kbd`,{children:`↑`}),(0,B.jsx)(`kbd`,{children:`↓`}),` `,dre()]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`kbd`,{children:`↵`}),` `,Op()]}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`kbd`,{children:h()}),` `,Xo()]})]})]})})]})}var w9=[`users`,`groups`,`instances`,`bridge`,`injections`,`serviceAccounts`,`roles`,`access`,`traces`,`kpi`,`anomalies`,`files`,`scheduled`,`agentFiles`,`preferences`,`integrations`,`theme`,`chatDefaults`,`audit`,`feedbacks`,`subagentReports`,`voice`,`trash`],T9=[`groups`,`access`,`roles`,`integrations`,`instances`,`injections`,`theme`,`feedbacks`,`subagentReports`,`files`,`scheduled`,`agentFiles`,`preferences`,`chatDefaults`,`trash`],E9={users:()=>st(),groups:()=>fee(),instances:()=>rc(),bridge:()=>vie(),injections:()=>gi(),serviceAccounts:()=>Af(),roles:()=>Lie(),access:()=>wp(),traces:()=>rie(),kpi:()=>Nd(),anomalies:()=>wm(),files:()=>nn(),scheduled:()=>cs(),agentFiles:()=>wr(),preferences:()=>kte(),integrations:()=>Ym(),theme:()=>we(),chatDefaults:()=>Wd(),audit:()=>rte(),feedbacks:()=>one(),subagentReports:()=>Nu(),voice:()=>Ll(),trash:()=>wh()},D9={users:`admin.manage`,groups:`groups.manage`,instances:`admin.manage`,bridge:`bridge.read`,injections:`admin.manage`,serviceAccounts:`admin.manage`,roles:`admin.manage`,access:`admin.manage`,traces:`traces.read`,kpi:`kpi.read`,anomalies:`anomalies.read`,files:`chats.read`,scheduled:`chats.read`,agentFiles:`agents.files.read`,preferences:`chats.read`,integrations:`admin.manage`,theme:`chats.read`,chatDefaults:`admin.manage`,audit:`admin.manage`,feedbacks:`admin.manage`,subagentReports:`admin.manage`,voice:`admin.manage`,trash:`admin.manage`},IBe=[`traces`,`kpi`,`anomalies`,`bridge`,`agentFiles`,`groups`];function O9(e){let t=new Set(e);return w9.filter(e=>t.has(D9[e]))}function k9(e){return`/settings/${e}`}function A9(e){let t=e.split(`/`)[2];return w9.includes(t)?t:void 0}var LBe={uiprefs:`preferences`},j9=[{id:`personal`,label:()=>vo(),tabs:[`preferences`,`theme`,`files`,`scheduled`]},{id:`agents`,label:()=>Dt(),tabs:[`instances`,`agentFiles`,`chatDefaults`,`voice`,`bridge`,`injections`]},{id:`access`,label:()=>Xt(),tabs:[`users`,`groups`,`access`,`roles`,`serviceAccounts`,`trash`]},{id:`observability`,label:()=>Cc(),tabs:[`traces`,`kpi`,`anomalies`,`audit`,`feedbacks`,`subagentReports`,`integrations`]}],RBe=new Map(j9.flatMap(e=>e.tabs.map(t=>[t,e.id])));function M9(e){let t=RBe.get(e);if(!t)throw Error(`Settings tab "${e}" belongs to no group`);return t}function zBe(e,t){return e.find(e=>M9(e)===t)}j9.flatMap(e=>[...e.tabs]);function BBe(){let e=P(L.bridgeHealth.getBridgeAvailability,{});if(e===void 0)return null;let t=e.gatewaysUnreachable??0,n=e.known?e.available?t>0?`warn`:`ok`:`error`:`idle`,r=e.known?e.available?t>0?om({count:t}):`${B_()}${e.checkedAt?uf({time:r$(e.checkedAt)}):``}`:xie({reason:e.reason??`?`}):zs();return(0,B.jsx)($3,{delayDuration:150,children:(0,B.jsxs)(e6,{children:[(0,B.jsx)(t6,{asChild:!0,children:(0,B.jsx)(`span`,{className:`oc-bridge-dot oc-bridge-dot--${n}`,role:`img`,"aria-label":r})}),(0,B.jsx)(n6,{children:r})]})})}function N9(e){let t=new Set(w9),n=new Set,r=[];for(let i of e??[])t.has(i)&&!n.has(i)&&(r.push(i),n.add(i));for(let e of w9)n.has(e)||r.push(e);return r}function VBe(e,t){let n=new Set(t),r=[...t];return e.map(e=>n.has(e)?r.shift():e)}function HBe({tab:e,active:t}){let n=E9[e](),r=`oc-settings-tabs__tab`+(t?` is-active`:``),i=(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`oc-settings-tabs__label`,children:n}),e===`bridge`?(0,B.jsx)(BBe,{}):null]});return T9.includes(e)?(0,B.jsx)(Ax,{to:`/settings/$tab`,params:{tab:e},className:r,role:`tab`,"aria-selected":t,children:i}):(0,B.jsx)(Ax,{to:`/settings/${e}`,className:r,role:`tab`,"aria-selected":t,children:i})}function UBe({tab:e,active:t}){let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=R7({id:e});return(0,B.jsxs)(`div`,{ref:i,style:{transform:u5.Transform.toString(a),transition:o,opacity:s?.5:1},className:`oc-settings-tabs__item`,role:`presentation`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-settings-tabs__grip`,"aria-label":Da(),...n,...r,children:(0,B.jsx)(vS,{size:14,"aria-hidden":!0})}),(0,B.jsx)(HBe,{tab:e,active:t})]})}function WBe(){let e=P(L.me.getMe,{host:A2}),t=I(L.me.setSettingsTabOrder),n=A9(Rx({select:e=>e.pathname})),r=n===void 0?void 0:M9(n),i=(0,z.useMemo)(()=>N9(e?.settingsTabOrder??null),[e?.settingsTabOrder]),[a,o]=(0,z.useState)(i);(0,z.useEffect)(()=>o(i),[i]);let s=(0,z.useMemo)(()=>new Set(O9(e?.permissions??[])),[e?.permissions]),c=(0,z.useMemo)(()=>r===void 0?[]:a.filter(e=>s.has(e)&&M9(e)===r),[a,s,r]),l=g5(h5(X5,{activationConstraint:{distance:5}}),h5(K5,{coordinateGetter:B7}));if(r===void 0||c.length===0)return null;let u=j9.find(e=>e.id===r);function d(e){let{active:n,over:r}=e;if(!r||n.id===r.id)return;let i=c.indexOf(n.id),s=c.indexOf(r.id);if(i<0||s<0)return;let l=VBe(a,O7(c,i,s));o(l),t({order:l})}return(0,B.jsx)(`div`,{className:`oc-settings-tabs`,role:`tablist`,"aria-label":u?.label(),children:(0,B.jsx)(S7,{sensors:l,collisionDetection:HRe,modifiers:[Zze],onDragEnd:d,children:(0,B.jsx)(I7,{items:c,strategy:iBe,children:c.map(e=>(0,B.jsx)(UBe,{tab:e,active:e===n},e))})})})}function GBe(){let e=P(L.me.getMe,{host:A2}),t=wx(),n=A9(Rx({select:e=>e.pathname})),r=n===void 0?void 0:M9(n),i=(0,z.useMemo)(()=>new Set(O9(e?.permissions??[])),[e?.permissions]),a=(0,z.useMemo)(()=>N9(e?.settingsTabOrder??null).filter(e=>i.has(e)),[e?.settingsTabOrder,i]),o=j9.filter(e=>e.tabs.some(e=>i.has(e)));function s(e){let n=zBe(a,e.id);n&&t({to:k9(n)})}return(0,B.jsxs)(`nav`,{className:`oc-settings-nav`,"aria-label":zh(),children:[(0,B.jsx)(Ax,{to:`/`,className:`oc-settings-nav__back`,children:he()}),(0,B.jsx)(`div`,{className:`oc-settings-nav__title`,children:cg()}),(0,B.jsx)(`div`,{className:`oc-settings-nav__list`,children:o.map(e=>(0,B.jsx)(`button`,{type:`button`,className:`oc-settings-nav__group`+(e.id===r?` is-active`:``),"aria-current":e.id===r?`true`:void 0,onClick:()=>s(e),children:e.label()},e.id))})]})}var KBe=[`eq`,`neq`,`contains`,`gt`,`gte`,`lt`,`lte`],P9=[50,100,200,500],F9=`now-30d`,qBe=`now-24h`;function JBe(e,t,n=F9,r=`now`){let i=e??n,a=t??r,o=Number(i),s=Number(a);return i!==``&&a!==``&&Number.isFinite(o)&&Number.isFinite(s)?{kind:`absolute`,from:o,to:s}:{kind:`relative`,from:i,to:a}}function YBe(e){return e.kind===`absolute`?{from:String(e.from),to:String(e.to)}:{from:e.from,to:e.to}}function XBe(e){if(e.length!==0)return JSON.stringify(e)}function ZBe(e){if(!e)return[];let t;try{t=JSON.parse(e)}catch{return[]}if(!Array.isArray(t))return[];let n=[];for(let e of t){if(typeof e!=`object`||!e)continue;let t=e,r=t.field,i=t.op,a=t.value;typeof r!=`string`||r===``||typeof i!=`string`||!KBe.includes(i)||typeof a!=`string`&&typeof a!=`number`&&typeof a!=`boolean`||n.push({field:r,op:i,value:a})}return n}var I9=q0().optional(),L9=q0().optional(),R9=q0().optional(),z9=q0().optional().catch(void 0),QBe=e2({q:I9,section:r2([`latency`,`events`]).default(`events`).catch(`events`),kind:q0().default(`all`).catch(`all`),correlationId:q0().optional().catch(void 0),limit:dje().pipe(t2([i2(P9[0]),i2(P9[1]),i2(P9[2]),i2(P9[3])])).catch(100),statusClass:r2([`2xx`,`4xx`,`5xx`]).optional().catch(void 0),principalType:r2([`user`,`service`,`system`]).optional().catch(void 0),direction:r2([`inbound`,`outbound`,`internal`]).optional().catch(void 0),roleKey:z9,from:L9,to:L9,adv:R9}),$Be=e2({q:I9,action:z9,impersonated:r2([`yes`,`no`]).optional().catch(void 0),resource:z9,from:L9,to:L9,adv:R9}),eVe=e2({q:I9,status:r2([`open`,`acknowledged`,`resolved`,`all`]).default(`open`).catch(`open`),severity:r2([`info`,`warn`,`critical`]).optional().catch(void 0),kind:z9,from:L9,to:L9}),tVe=e2({from:L9,to:L9}),nVe=e2({q:I9,status:r2([`active`,`disabled`]).optional().catch(void 0)}),rVe=e2({q:I9,role:z9});e2({q:I9,mode:r2([`per-user`,`shared`]).optional().catch(void 0)});var iVe=e2({section:r2([`readaloud`,`dictation`,`talk`]).default(`readaloud`).catch(`readaloud`)}),aVe=e2({section:q0().max(32).default(`openclaw`).catch(`openclaw`)}),B9=`oc.theme`;function V9(e){let t=e===`dark`||e===`system`&&window.matchMedia(`(prefers-color-scheme: dark)`).matches;document.documentElement.classList.toggle(`dark`,t)}function H9(e){(0,z.useEffect)(()=>{let t=e??localStorage.getItem(B9)??`system`;if(localStorage.setItem(B9,t),V9(t),t===`system`){let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>V9(`system`);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}},[e])}var U9=`oc.fontScale`,oVe={sm:`87.5%`,md:``,lg:`112.5%`,xl:`125%`,"2xl":`137.5%`,"3xl":`150%`},W9=[`sm`,`md`,`lg`,`xl`,`2xl`,`3xl`];function sVe(e){return e!==null&&W9.includes(e)}function cVe(e){document.documentElement.style.fontSize=oVe[e]}function G9(e){(0,z.useEffect)(()=>{let t=localStorage.getItem(U9),n=e??(sVe(t)?t:`md`);localStorage.setItem(U9,n),cVe(n)},[e])}function lVe(e){(0,z.useEffect)(()=>{if(!e)return;document.documentElement.lang=e;let t;try{t=Nm()}catch{t=void 0}t!==e&&cm(e)},[e])}var uVe=(0,z.lazy)(()=>BX(()=>import(`./RolesTab-CdpxcL32.js`).then(e=>({default:e.RolesTab})),__vite__mapDeps([2,1,3,4,5]))),dVe=(0,z.lazy)(()=>BX(()=>import(`./InstancesTab-CykKru2n.js`).then(e=>({default:e.InstancesTab})),__vite__mapDeps([6,1,3,7,8,9,10,11,12,13,14,15,5,16,17,18]))),fVe=(0,z.lazy)(()=>BX(()=>import(`./PromptInjectionsTab-iKx77mc6.js`).then(e=>({default:e.PromptInjectionsTab})),__vite__mapDeps([19,1,3,7,8,9,20,5,21]))),pVe=(0,z.lazy)(()=>BX(()=>import(`./GroupsTab-BblkD-Mw.js`).then(e=>({default:e.GroupsTab})),__vite__mapDeps([22,1,3,23,18,12,13,5,16,24,14,15]))),mVe=(0,z.lazy)(()=>BX(()=>import(`./IntegrationsTab-BGvWPcJJ.js`).then(e=>({default:e.IntegrationsTab})),__vite__mapDeps([25,1,3,5]))),hVe=(0,z.lazy)(()=>BX(()=>import(`./FeedbacksTab-CmhVA188.js`).then(e=>({default:e.FeedbacksTab})),__vite__mapDeps([26,1,3,18,12,13,5,16]))),K9=(0,z.lazy)(()=>BX(()=>import(`./SubAgentReportsTab-DjKyJxXi.js`).then(e=>({default:e.SubAgentReportsTab})),__vite__mapDeps([27,1,3,18,12,13,5,16]))),gVe=(0,z.lazy)(()=>BX(()=>import(`./TrashTab-C5EAGQ-A.js`).then(e=>({default:e.TrashTab})),__vite__mapDeps([28,1,3,29,30,5,31]))),_Ve=(0,z.lazy)(()=>BX(()=>import(`./FilesTab-Bs-qAb6x.js`).then(e=>({default:e.FilesTab})),__vite__mapDeps([32,1,3,5,16]))),vVe=(0,z.lazy)(()=>BX(()=>import(`./ScheduledTab-mr_m7UIj.js`).then(e=>({default:e.ScheduledTab})),__vite__mapDeps([33,1,3,34,35,13,21,14,15,5,16]))),yVe=(0,z.lazy)(()=>BX(()=>import(`./AgentFilesTab-DaYXJcuZ.js`).then(e=>({default:e.AgentFilesTab})),__vite__mapDeps([36,1,3,11,8,5,21]))),bVe=(0,z.lazy)(()=>BX(()=>import(`./PreferencesTab-B7rx5jxG.js`).then(e=>({default:e.PreferencesTab})),__vite__mapDeps([37,1,3,35,13,21,20,9,5]))),xVe=(0,z.lazy)(()=>BX(()=>import(`./ChatDefaultsTab-BuS1Ihhq.js`).then(e=>({default:e.ChatDefaultsTab})),__vite__mapDeps([38,1,3,11,29,5,21]))),SVe=(0,z.lazy)(()=>BX(()=>import(`./AccessTab-Cwu9fJwI.js`).then(e=>({default:e.AccessTab})),__vite__mapDeps([39,1,3]))),CVe=(0,z.lazy)(()=>BX(()=>import(`./ThemeShowroom-wAQ75k0V.js`).then(e=>({default:e.ThemeShowroom})),__vite__mapDeps([40,1,3,23,41,12,15,5,14,20,9,42,16])));function wVe(){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(oae,{children:(0,B.jsx)(`div`,{className:`oc-boot`,children:Dm()})}),(0,B.jsx)(aae,{children:(0,B.jsx)(EVe,{})}),(0,B.jsx)(iae,{children:(0,B.jsx)(TL,{children:(0,B.jsx)(CRe,{children:(0,B.jsx)(OVe,{})})})})]})}function TVe(){return(0,B.jsxs)(`svg`,{className:`oc-provider__logo`,viewBox:`0 0 48 48`,"aria-hidden":`true`,children:[(0,B.jsx)(`path`,{fill:`#EA4335`,d:`M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z`}),(0,B.jsx)(`path`,{fill:`#4285F4`,d:`M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z`}),(0,B.jsx)(`path`,{fill:`#FBBC05`,d:`M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z`}),(0,B.jsx)(`path`,{fill:`#34A853`,d:`M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z`})]})}function EVe(){let{signIn:e}=Zv();H9(void 0),G9(void 0);let t=P(L.charts.brandForHost,{host:A2}),n=hMe(A2),r=t??n??null,i=N2(void 0);P2(r?.tokens??null,i),(0,z.useEffect)(()=>{t&&gMe(A2,t)},[t]);let a=r?.brand,o=a&&!a.isDefault?Y2(a,i):null,s=a?.label??`Atrium`,c=P(L.me.authProviders),[l,u]=(0,z.useState)(null);async function d(t){u(null);try{await e(t)}catch{u(Iee())}}let f=c!==void 0&&!c.google&&!c.microsoft&&!c.authelia&&!c.anonymous;return(0,B.jsxs)(`div`,{className:`oc-signin`,children:[(0,B.jsxs)(`svg`,{className:`oc-signin__motif`,viewBox:`0 0 1200 1000`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,B.jsx)(`polyline`,{className:`oc-signin__line`,points:`0,860 470,860 522,790 574,940 626,810 678,860 1200,860`,vectorEffect:`non-scaling-stroke`}),(0,B.jsx)(`polyline`,{className:`oc-signin__pulse`,points:`0,860 470,860 522,790 574,940 626,810 678,860 1200,860`,pathLength:`100`,vectorEffect:`non-scaling-stroke`})]}),(0,B.jsxs)(`div`,{className:`oc-signin__brand`,children:[o?(0,B.jsx)(`img`,{className:`oc-signin__brandlogo`,src:o,alt:``}):null,(0,B.jsx)(`span`,{className:`oc-signin__wordmark`,children:s})]}),(0,B.jsxs)(`div`,{className:`oc-signin__card`,children:[(0,B.jsx)(`h1`,{className:`oc-signin__title`,children:Ute()}),(0,B.jsx)(`p`,{className:`oc-signin__subtitle`,children:Yp()}),(0,B.jsxs)(`div`,{className:`oc-signin__providers`,children:[c?.google?(0,B.jsxs)(`button`,{type:`button`,className:`oc-provider oc-provider--google`,onClick:()=>void d(`google`),children:[(0,B.jsx)(TVe,{}),(0,B.jsx)(`span`,{children:rp()})]}):null,c?.microsoft?(0,B.jsx)(`button`,{type:`button`,className:`oc-provider oc-provider--microsoft`,onClick:()=>void d(`microsoft-entra-id`),children:(0,B.jsx)(`span`,{children:mg()})}):null,c?.authelia?(0,B.jsx)(`button`,{type:`button`,className:`oc-provider oc-provider--authelia`,onClick:()=>void d(`authelia`),children:(0,B.jsx)(`span`,{children:Dre()})}):null]}),l?(0,B.jsx)(`p`,{className:`oc-signin__error`,children:l}):null,f?(0,B.jsx)(`p`,{className:`oc-signin__error`,children:Nf()}):null,c?.anonymous?(0,B.jsx)(`button`,{type:`button`,className:`oc-signin__dev`,onClick:()=>void e(`anonymous`),children:Gne()}):null]})]})}function DVe(){let{width:e,collapsed:t,isMobile:n}=p1();return(0,B.jsxs)(`div`,{className:`oc-shell`,children:[(0,B.jsxs)(`header`,{className:`oc-topbar`,children:[(0,B.jsxs)(`div`,{className:`oc-topbar__left`,children:[(0,B.jsx)(`div`,{className:`oc-skel`,style:{width:`1.75rem`,height:`1.75rem`}}),(0,B.jsx)(`div`,{className:`oc-skel`,style:{width:`5.5rem`,height:`1.1rem`}})]}),(0,B.jsx)(`div`,{className:`oc-topbar__search`,children:(0,B.jsx)(`div`,{className:`oc-skel`,style:{width:`100%`,height:`2.25rem`}})}),(0,B.jsx)(`div`,{className:`oc-topbar__actions`,children:(0,B.jsx)(`div`,{className:`oc-skel`,style:{width:`1.75rem`,height:`1.75rem`,borderRadius:`999px`}})})]}),(0,B.jsxs)(`div`,{className:n?`oc-workspace oc-workspace--mobile`:`oc-workspace`,children:[!t&&!n?(0,B.jsx)(`div`,{className:`oc-sidebar-col`,style:{width:e,flex:`0 0 ${e}px`},children:(0,B.jsxs)(`aside`,{className:`oc-sidebar`,children:[(0,B.jsx)(`div`,{className:`oc-skel`,style:{height:`2.25rem`,margin:`0.25rem 0.25rem 0`}}),(0,B.jsx)(s9,{})]})}):null,(0,B.jsx)(`main`,{className:`oc-main`})]})]})}function OVe(){let e=P(L.me.getMe,{host:A2}),t=I(L.me.bootstrap),n=wx();(0,z.useEffect)(()=>{e&&!e.hasProfile&&t()},[e,t]),H9(e?.resolvedThemeMode),G9(e?.resolvedFontScale);let r=N2(e?.resolvedThemeMode);P2(e?.resolvedChartTokens,r),lVe(e?.resolvedLocale);let i=(0,z.useRef)(null);if((0,z.useEffect)(()=>{e&&(i.current!==null&&i.current!==e.userId&&n({to:`/`}),i.current=e.userId)},[e,n]),e===void 0)return(0,B.jsx)(DVe,{});let a=e.name||e.email||xte();return e.role===`pending`?(0,B.jsxs)(`div`,{className:`oc-shell`,children:[(0,B.jsx)(q9,{}),(0,B.jsx)(_9,{}),(0,B.jsxs)(`header`,{className:`oc-topbar`,children:[(0,B.jsx)(`span`,{className:`oc-topbar__brand`,children:(0,B.jsx)(J9,{brand:e.resolvedChartBrand,resolvedThemeMode:e.resolvedThemeMode})}),(0,B.jsx)(`div`,{className:`oc-topbar__actions`,children:(0,B.jsx)(v9,{label:a,mode:e.themeMode,minimal:!0})})]}),(0,B.jsxs)(`div`,{className:`oc-pending`,children:[(0,B.jsx)(`h1`,{className:`oc-pending__title`,children:Id()}),(0,B.jsx)(`p`,{className:`oc-pending__body`,children:Qm()})]})]}):(0,B.jsx)(AVe,{canOpenSettings:O9(e.permissions??[]).length>0,viewerUserId:e.userId,userLabel:a,themeMode:e.themeMode,resolvedThemeMode:e.resolvedThemeMode,brand:e.resolvedChartBrand},e.userId)}function q9(){let e=P(L.me.getImpersonation),t=I(L.admin.stopImpersonation);return!e||!e.impersonating?null:(0,B.jsxs)(`div`,{className:`oc-imp`,role:`alert`,children:[(0,B.jsx)(dS,{className:`size-4 shrink-0`}),(0,B.jsxs)(`span`,{className:`oc-imp__text`,children:[Ene(),` `,(0,B.jsx)(`strong`,{children:e.targetLabel}),ate(),(0,B.jsx)(`strong`,{children:e.realLabel}),ure()]}),(0,B.jsx)(Ov,{size:`sm`,variant:`outline`,className:`oc-imp__exit`,onClick:()=>void t(),children:Ep()})]})}function J9({brand:e,resolvedThemeMode:t}){let n=N2(t),r=e?.label??`Atrium`,i=e?.isDefault??!0,a=Y2(e,n),[o,s]=(0,z.useState)(!1);return(0,z.useEffect)(()=>s(!1),[a]),(0,B.jsxs)(B.Fragment,{children:[a!==null&&!o?(0,B.jsx)(`img`,{className:`oc-brand__logo`,src:a,alt:``,"aria-hidden":`true`,onError:()=>s(!0)}):i?(0,B.jsx)(Z2,{className:`oc-brand__logo`}):null,(0,B.jsx)(`span`,{className:`oc-brand__label`,children:r})]})}function kVe({userLabel:e,themeMode:t,resolvedThemeMode:n,brand:r,collapsed:i,onToggleSidebar:a}){return(0,B.jsxs)(`header`,{className:`oc-topbar`,children:[(0,B.jsxs)(`div`,{className:`oc-topbar__left`,children:[(0,B.jsx)(Ov,{variant:`ghost`,size:`icon-sm`,"aria-label":i?C():is(),onClick:a,children:i?(0,B.jsx)(VS,{}):(0,B.jsx)(BS,{})}),(0,B.jsx)(Ax,{to:`/`,className:`oc-topbar__brand`,children:(0,B.jsx)(J9,{brand:r,resolvedThemeMode:n})})]}),(0,B.jsx)(`div`,{className:`oc-topbar__search`,children:(0,B.jsx)(FBe,{})}),(0,B.jsxs)(`div`,{className:`oc-topbar__actions`,children:[(0,B.jsx)(MBe,{}),(0,B.jsx)(v9,{label:e,mode:t})]})]})}function AVe({canOpenSettings:e,viewerUserId:t,userLabel:n,themeMode:r,resolvedThemeMode:i,brand:a}){let{width:o,columnRef:s,collapsed:c,toggleCollapsed:l,collapse:u,startResize:d,isMobile:f}=p1(),p=Roe(),m=Sx({strict:!1}),h=wx(),g=!!p({to:`/settings`,fuzzy:!0});(0,z.useEffect)(()=>{f&&u()},[Rx({select:e=>e.pathname}),f,u]);let _=(0,z.useCallback)(e=>{h({to:`/chat/$chatId`,params:{chatId:e}})},[h]),{startNewChat:v,picker:y}=h9(_),b=(0,z.useMemo)(()=>rL(YI,tL()),[]);return(0,z.useEffect)(()=>{let e=e=>{iL(e,YI)&&(e.preventDefault(),v())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[v]),(0,B.jsxs)(`div`,{className:`oc-shell`,children:[y,(0,B.jsx)(TBe,{activeChatId:m.chatId??null}),(0,B.jsx)(q9,{}),(0,B.jsx)(_9,{}),(0,B.jsx)(kVe,{userLabel:n,themeMode:r,resolvedThemeMode:i,brand:a,collapsed:c,onToggleSidebar:l}),(0,B.jsxs)(`div`,{className:f?`oc-workspace oc-workspace--mobile`:`oc-workspace`,children:[f&&!c?(0,B.jsx)(`div`,{className:`oc-sidebar-backdrop`,onClick:u,"aria-hidden":!0}):null,c?null:(0,B.jsxs)(`div`,{className:`oc-sidebar-col`,ref:e=>{s.current=f?null:e},style:f?void 0:{width:o,flex:`0 0 ${o}px`},children:[g?(0,B.jsx)(GBe,{}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(yBe,{activeChatId:m.chatId??null,onSelect:_,onNewChat:()=>void v(),newChatShortcut:b}),(0,B.jsx)(Ov,{variant:`ghost`,className:`mx-2 justify-start`,asChild:!0,children:(0,B.jsxs)(Ax,{to:`/settings/$tab`,params:{tab:`scheduled`},children:[(0,B.jsx)(Kx,{"aria-hidden":!0}),Tl()]})}),(0,B.jsx)(Ov,{variant:`ghost`,className:`mx-2 justify-start`,asChild:!0,children:(0,B.jsxs)(Ax,{to:`/settings/$tab`,params:{tab:`files`},children:[(0,B.jsx)(ose,{"aria-hidden":!0}),wn()]})}),e?(0,B.jsx)(Ov,{variant:`ghost`,className:`mx-2 mb-2 justify-start`,asChild:!0,children:(0,B.jsxs)(Ax,{to:`/settings`,children:[(0,B.jsx)(iC,{"aria-hidden":!0}),nd()]})}):null]}),(0,B.jsx)(`div`,{className:`oc-sidebar-resizer`,onPointerDown:d,role:`separator`,"aria-orientation":`vertical`,"aria-label":lu()})]}),(0,B.jsx)(`main`,{className:`oc-main`,children:(0,B.jsx)(Lx,{})}),(0,B.jsx)(FEe,{viewerUserId:t,currentChatId:m.chatId??null})]}),(0,B.jsx)(OL,{})]})}function jVe(){let e=P(L.me.getMe,{host:A2}),t=wx(),n=Rx({select:e=>e.pathname}),r=(0,z.useMemo)(()=>e?O9(e.permissions??[]):[],[e]),i=e!==void 0&&r.length===0;if((0,z.useEffect)(()=>{i&&t({to:`/`})},[i,t]),e===void 0)return(0,B.jsx)(`div`,{className:`oc-admin__hint`,style:{padding:16},children:Dm()});if(i)return null;let a=A9(n),o=a!==void 0&&!r.includes(a);return(0,B.jsxs)(`div`,{className:`oc-admin`,children:[(0,B.jsx)(WBe,{}),(0,B.jsx)(`div`,{className:`oc-admin__body`,children:o?(0,B.jsx)(MVe,{}):(0,B.jsx)(Lx,{})})]})}function MVe(){return(0,B.jsxs)(`div`,{className:`oc-route-error`,role:`alert`,children:[(0,B.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,B.jsx)(yC,{size:28})}),(0,B.jsx)(`h2`,{className:`oc-route-error__title`,children:Mu()}),(0,B.jsx)(`p`,{className:`oc-route-error__body`,children:ei()})]})}function NVe(){let e=P(L.me.getMe,{host:A2}),t=wx();return(0,z.useEffect)(()=>{if(e===void 0)return;let n=O9(e.permissions??[]);t({to:n.includes(`files`)?k9(`files`):n.length>0?k9(n[0]):`/`,replace:!0})},[e,t]),(0,B.jsx)(`div`,{className:`oc-admin__hint`,style:{padding:16},children:Dm()})}function PVe(e){switch(e){case`groups`:return(0,B.jsx)(pVe,{});case`integrations`:return(0,B.jsx)(mVe,{});case`instances`:return(0,B.jsx)(dVe,{});case`injections`:return(0,B.jsx)(fVe,{});case`theme`:return(0,B.jsx)(CVe,{});case`feedbacks`:return(0,B.jsx)(hVe,{});case`subagentReports`:return(0,B.jsx)(K9,{});case`files`:return(0,B.jsx)(_Ve,{});case`scheduled`:return(0,B.jsx)(vVe,{});case`agentFiles`:return(0,B.jsx)(yVe,{});case`preferences`:return(0,B.jsx)(bVe,{});case`chatDefaults`:return(0,B.jsx)(xVe,{});case`access`:return(0,B.jsx)(SVe,{});case`trash`:return(0,B.jsx)(gVe,{});default:return(0,B.jsx)(uVe,{})}}function FVe(){let{tab:e}=Sx({from:`/settings/$tab`});return(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`}),children:PVe(e)})}function IVe(){let{chatId:e}=Sx({from:`/chat/$chatId`}),{m:t}=Cx({from:`/chat/$chatId`});return(0,z.useEffect)(()=>{fje(e)},[e]),(0,B.jsx)(u8,{chatId:e,focusMessageId:t??null})}function LVe(){let e=wx(),t=pje(),n=P(L.messages.listChats,{}),r=t!==null&&n!==void 0&&n.some(e=>e._id===t);return(0,z.useEffect)(()=>{r&&t&&e({to:`/chat/$chatId`,params:{chatId:t},replace:!0})},[r,t,e]),t!==null&&(n===void 0||r)?(0,B.jsx)(`div`,{className:`oc-boot`,children:Dm()}):(0,B.jsx)(u8,{chatId:null})}var Y9=Aoe({component:wVe}),RVe=jx({getParentRoute:()=>Y9,path:`/`,component:LVe}),zVe=jx({getParentRoute:()=>Y9,path:`chat/$chatId`,component:IVe,validateSearch:e=>({m:typeof e.m==`string`?e.m:void 0})}),BVe=jx({getParentRoute:()=>Y9,path:`project/$projectId`,component:Mx(()=>BX(()=>import(`./ProjectPage-DeOofCgG.js`),__vite__mapDeps([43,1,3,12,34,5,44])),`ProjectPage`),validateSearch:e=>({c:typeof e.c==`string`?e.c:void 0})}),VVe=jx({getParentRoute:()=>Y9,path:`trash`,component:Mx(()=>BX(()=>import(`./TrashPage-DKaJKpYI.js`),__vite__mapDeps([30,1,3,29,5,31])),`TrashPage`)}),X9=jx({getParentRoute:()=>Y9,path:`settings`,component:jVe}),HVe=jx({getParentRoute:()=>X9,path:`/`,component:NVe}),UVe=jx({getParentRoute:()=>X9,path:`traces`,validateSearch:QBe,component:Mx(()=>BX(()=>import(`./TracesTab-n_5fNBHX.js`),__vite__mapDeps([45,1,3,23,18,12,13,5,16,41,15,14])),`TracesTab`)}),WVe=jx({getParentRoute:()=>X9,path:`bridge`,validateSearch:aVe,component:Mx(()=>BX(()=>import(`./BridgeTab-1RNCxXv2.js`),__vite__mapDeps([10,1,3,11,7,8,9,12,13,14,15,5,16,17])),`BridgeTab`)}),GVe=jx({getParentRoute:()=>X9,path:`voice`,validateSearch:iVe,component:Mx(()=>BX(()=>import(`./VoiceTab-CaHc9iZY.js`),__vite__mapDeps([46,1,3,5,21])),`VoiceTab`)}),KVe=jx({getParentRoute:()=>X9,path:`audit`,validateSearch:$Be,component:Mx(()=>BX(()=>import(`./AuditTab-CqLksOpr.js`),__vite__mapDeps([47,1,3,18,12,13,5,16,41,23,15,14])),`AuditTab`)}),qVe=jx({getParentRoute:()=>X9,path:`anomalies`,validateSearch:eVe,component:Mx(()=>BX(()=>import(`./AnomaliesTab-RKY5LYNV.js`),__vite__mapDeps([48,1,3,18,12,13,5,16,14,15,17])),`AnomaliesTab`)}),JVe=jx({getParentRoute:()=>X9,path:`kpi`,validateSearch:tVe,component:Mx(()=>BX(()=>import(`./KpiTab-0-fYoy76.js`),__vite__mapDeps([49,1,3,15,5,42])),`KpiTab`)}),YVe=jx({getParentRoute:()=>X9,path:`serviceAccounts`,validateSearch:nVe,component:Mx(()=>BX(()=>import(`./ServiceAccountsTab-Do5kRXXv.js`),__vite__mapDeps([50,1,3,12,18,13,5,16,14,15,4])),`ServiceAccountsTab`)}),XVe=jx({getParentRoute:()=>X9,path:`users`,validateSearch:rVe,component:Mx(()=>BX(()=>import(`./UsersTab-DIGrBmUm.js`),__vite__mapDeps([51,1,3,18,12,13,5,16,24,14,15])),`UsersTab`)}),ZVe=jx({getParentRoute:()=>X9,path:`uiprefs`,beforeLoad:()=>{throw nb({to:`/settings/$tab`,params:{tab:LBe.uiprefs},replace:!0})}}),QVe=jx({getParentRoute:()=>X9,path:`$tab`,parseParams:e=>({tab:r2([...T9]).catch(`roles`).parse(e.tab)}),component:FVe});function $Ve({error:e,reset:t}){let n=wx(),r=mje(e),[i]=(0,z.useState)(()=>r&&_je(Date.now()));return(0,z.useEffect)(()=>{i&&window.location.reload()},[i]),i?(0,B.jsx)(`div`,{className:`oc-route-error`,role:`status`,children:(0,B.jsx)(`p`,{className:`oc-route-error__body`,children:yne()})}):(0,B.jsxs)(`div`,{className:`oc-route-error`,role:`alert`,children:[(0,B.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,B.jsx)(yC,{size:28})}),(0,B.jsx)(`h2`,{className:`oc-route-error__title`,children:Di()}),(0,B.jsx)(`p`,{className:`oc-route-error__body`,children:Fn()}),(0,B.jsxs)(`div`,{className:`oc-route-error__actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-route-error__cta`,onClick:()=>{r?window.location.reload():t()},children:Il()}),(0,B.jsx)(`button`,{type:`button`,className:`oc-route-error__cta oc-route-error__cta--ghost`,onClick:()=>void n({to:`/`}),children:zc()})]})]})}function eHe(){let e=wx();return(0,B.jsxs)(`div`,{className:`oc-route-error`,role:`status`,children:[(0,B.jsx)(`div`,{className:`oc-route-error__icon`,"aria-hidden":!0,children:(0,B.jsx)(qoe,{size:28})}),(0,B.jsx)(`h2`,{className:`oc-route-error__title`,children:or()}),(0,B.jsx)(`p`,{className:`oc-route-error__body`,children:ul()}),(0,B.jsx)(`div`,{className:`oc-route-error__actions`,children:(0,B.jsx)(`button`,{type:`button`,className:`oc-route-error__cta`,onClick:()=>void e({to:`/`}),children:zc()})})]})}var Z9=Boe({routeTree:Y9.addChildren([RVe,zVe,BVe,VVe,X9.addChildren([HVe,UVe,GVe,WVe,KVe,qVe,JVe,YVe,XVe,ZVe,QVe])]),defaultPreload:`intent`,defaultErrorComponent:$Ve,defaultNotFoundComponent:eHe}),tHe=()=>null;function Q9({children:e}){return(0,B.jsx)(`div`,{style:{display:`flex`,minHeight:`100vh`,alignItems:`center`,justifyContent:`center`,padding:`2rem`,textAlign:`center`,font:`14px system-ui, sans-serif`,opacity:.6},children:e})}var $9=sae.createRoot(document.getElementById(`root`));$9.render((0,B.jsx)(z.StrictMode,{children:(0,B.jsx)(Q9,{children:Ng()})})),vje().then(e=>{Rje(document,Ije(y2(_2(),window.location.origin,[h2(),g2()])));let t=new Tie(e);$9.render((0,B.jsx)(z.StrictMode,{children:(0,B.jsx)(yae,{client:t,children:(0,B.jsxs)(dNe,{children:[(0,B.jsx)(dIe,{children:(0,B.jsx)(Uoe,{router:Z9})}),(0,B.jsx)(z.Suspense,{fallback:null,children:(0,B.jsx)(tHe,{router:Z9,position:`bottom-right`})})]})})}))}).catch(e=>{console.error(`Boot failed:`,e),$9.render((0,B.jsx)(z.StrictMode,{children:(0,B.jsxs)(Q9,{children:[Eee(),` `,e instanceof Error?e.message:String(e)]})}))});export{$Ne as $,dS as $n,VI as $t,KRe as A,vC as An,n$ as At,$3 as B,KS as Bn,jL as Bt,R7 as C,ew as Cn,s$ as Ct,Q5 as D,xC as Dn,l$ as Dt,D7 as E,CC as En,u$ as Et,o6 as F,$S as Fn,pQ as Ft,tPe as G,MS as Gn,IL as Gt,I3 as H,US as Hn,BL as Ht,a6 as I,ZS as In,gQ as It,aPe as J,wS as Jn,AL as Jt,XNe as K,jS as Kn,FL as Kt,r6 as L,YS as Ln,BX as Lt,h5 as M,lC as Mn,VQ as Mt,g5 as N,oC as Nn,JX as Nt,e7 as O,bC as On,d$ as Ot,u5 as P,nC as Pn,OCe as Pt,QNe as Q,mS as Qn,rL as Qt,e6 as R,JS as Rn,qL as Rt,j7 as S,nw as Sn,m$ as St,S7 as T,wC as Tn,f$ as Tt,oFe as U,BS as Un,PL as Ut,t6 as V,WS as Vn,zL as Vt,nPe as W,PS as Wn,RL as Wt,rPe as X,gS as Xn,tL as Xt,iPe as Y,_S as Yn,EL as Yt,ePe as Z,hS as Zn,sL as Zt,U7 as _,iw as _n,C$ as _t,XBe as a,PI as an,Qx as ar,I4 as at,H7 as b,tw as bn,_$ as bt,IBe as c,jI as cn,Jx as cr,v4 as ct,h9 as d,wN as dn,wx as dr,M2 as dt,NI as en,uS as er,ZNe as et,t9 as f,TN as fn,Cx as fr,A2 as ft,K7 as g,bse as gn,S$ as gt,q7 as h,yse as hn,x$ as ht,JBe as i,RI as in,tS as ir,N4 as it,T7 as j,mC as jn,r$ as jt,C5 as k,yC as kn,oTe as kt,E9 as l,DN as ln,qx as lr,y4 as lt,_Be as m,vse as mn,D2 as mt,F9 as n,II as nn,oS as nr,VNe as nt,YBe as o,AI as on,Xx as or,P4 as ot,J7 as p,lw as pn,Sx as pr,O2 as pt,YNe as q,ES as qn,LL as qt,qBe as r,LI as rn,rS as rr,V4 as rt,ZBe as s,MI as sn,Yx as sr,F4 as st,W9 as t,FI as tn,sS as tr,Y4 as tt,D9 as u,EN as un,Vx as ur,N2 as ut,W7 as v,sw as vn,p$ as vt,N7 as w,EC as wn,c$ as wt,I7 as x,cw as xn,h$ as xt,G7 as y,QC as yn,g$ as yt,n6 as z,qS as zn,KL as zt};
|