local-operator-ui 0.52.14 → 0.52.15
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/out/renderer/assets/{agent-details-page-B9CKxSrs.js → agent-details-page-Dk8RHSMl.js} +1 -1
- package/out/renderer/assets/{agent-hub-page-D8LnPErX.js → agent-hub-page-CIocC2nK.js} +1 -1
- package/out/renderer/assets/{agents-page-DgxoevHb.js → agents-page-Bd6D46Bi.js} +3 -3
- package/out/renderer/assets/{avatar-cropper-B9BekkbE.js → avatar-cropper-Dl5ov8YL.js} +1 -1
- package/out/renderer/assets/{browser-page-Cs7_uVtb.js → browser-page-Dajczk6E.js} +1 -1
- package/out/renderer/assets/{browser-webauthn-prompt-Dzw1WBRS.js → browser-webauthn-prompt-h19MrXeQ.js} +1 -1
- package/out/renderer/assets/{index-BGDEYSH_.js → index-CpEaJdlZ.js} +2 -2
- package/out/renderer/assets/{legacy-agents-page-kKEUs0O8.js → legacy-agents-page-BF2R4lbR.js} +1 -1
- package/out/renderer/assets/{library-page-BQJdR2rI.js → library-page-O8Tpue7P.js} +3 -3
- package/out/renderer/assets/{mesh-page-Ct_YkVDL.js → mesh-page-CuhfZMiu.js} +1 -1
- package/out/renderer/assets/{notifications-page-B8nZbtlS.js → notifications-page-CSsqs93y.js} +1 -1
- package/out/renderer/assets/{org-access-DuRFDs9W.js → org-access-z8_b5XCu.js} +1 -1
- package/out/renderer/assets/{projects-page-DZEkOZlF.js → projects-page-X-DhX0pA.js} +1 -1
- package/out/renderer/assets/{publication-validation-Bvsz95rc.js → publication-validation-JbdY7VfP.js} +1 -1
- package/out/renderer/assets/{radient-auth-buttons-PCN4Dj5p.js → radient-auth-buttons-CfYSHdIY.js} +1 -1
- package/out/renderer/assets/{schedules-page-C8nW1wgf.js → schedules-page-fHpOwysL.js} +1 -1
- package/out/renderer/assets/{settings-page-DLGUbw65.js → settings-page-cGGZni-k.js} +1 -1
- package/out/renderer/assets/{smartart-CG3pwH-W.js → smartart-uJ0Wwefz.js} +1 -1
- package/out/renderer/assets/{team-bridge-page-CiWbJeGL.js → team-bridge-page-DSlbd_JZ.js} +20 -20
- package/out/renderer/assets/{team-bridge-scope-preference-Bw_NlB2r.js → team-bridge-scope-preference-DpxjIHL_.js} +1 -1
- package/out/renderer/assets/{use-download-agent-mutation-DxaW8MAR.js → use-download-agent-mutation-C48jB1cG.js} +1 -1
- package/out/renderer/index.html +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./agent-details-page-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./agent-details-page-Dk8RHSMl.js","./index-CGJ-zGUj.js","./messages-WCx2gWDp.js","./index-DpyKnIlO.css","./publication-validation-JbdY7VfP.js","./appearance-D-cqStrp.js","./roles-D1pcbxAx.js","./conversation-input-sync-PkxW9VtI.js","./error-boundary-DP-w218V.js","./conversation-input-sync-BmGWvjex.css","./use-download-agent-mutation-C48jB1cG.js","./book-open-Csr9Wimz.js","./en-US-CW_dDnkH.js","./heart-D5op1fb2.js","./console-mirror-B88TErpS.js","./console-mirror-C58ni4_c.css","./agent-hub-page-CIocC2nK.js","./page-header-BPTd2v4r.js","./org-access-z8_b5XCu.js","./radient-auth-buttons-CfYSHdIY.js","./org-surface-gate-CX8f5End.js","./building-2-CXOVJzQP.js","./agents-page-Bd6D46Bi.js","./avatar-cropper-Dl5ov8YL.js","./log-in-3BiTWJmW.js","./project-markdown-Ccogexd0.js","./schedules-page-fHpOwysL.js","./parseISO-CxPiCKvF.js","./projects-page-X-DhX0pA.js","./use-session-snapshot-PmnbAXYe.js","./library-page-O8Tpue7P.js","./notifications-page-CSsqs93y.js","./team-bridge-page-DSlbd_JZ.js","./team-bridge-scope-preference-DpxjIHL_.js","./browser-page-Dajczk6E.js","./mesh-page-CuhfZMiu.js","./settings-page-cGGZni-k.js","./notebook-pen-B_-UUXmb.js","./settings-page-CE0BRKlY.css","./browser-webauthn-prompt-h19MrXeQ.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{r as m,j as c,c as R,b as rt,h as mN,x as dJ,E as hJ,w as fJ,F as pJ,u as Du,G as gJ,H as mJ,I as vJ,R as bJ}from"./index-CGJ-zGUj.js";import{t as h,b as Z5,c as Xm,r as _1,a as _J,L as Tl,d as xJ}from"./messages-WCx2gWDp.js";import{bp as wJ,bq as Ax,br as eH,bs as tH,u as Nt,bt as yJ,bu as CJ,bv as SJ,bw as kJ,bx as EJ,by as TJ,bz as vN,bA as bN,bB as RJ,bC as AJ,x as Ne,bD as FJ,bE as _N,bF as OA,bG as jd,h as Mn,a as zn,c as vt,e as qv,q as nH,s as si,a4 as sH,bH as Ya,K as fg,ar as rH,G as io,d as et,bI as DJ,bJ as xN,bK as x1,bL as iH,bM as xE,aN as wE,bN as IJ,O as Wi,r as Kv,bO as th,bP as LA,bQ as NJ,g as da,n as $d,bR as w1,ap as Yv,N as Yo,bS as PJ,bT as BA,ak as MJ,bU as OJ,bV as LJ,bW as BJ,F as tt,bX as aH,bY as oH,bZ as Cy,b_ as yE,b$ as jJ,c0 as lH,c1 as HJ,c2 as UJ,c3 as GJ,_ as Ku,c4 as VJ,Y as jA,V as Xv,aJ as y1,c5 as C1,c6 as rn,c7 as Fx,c8 as wN,c9 as CE,W as WJ,ca as zJ,cb as $J,cc as qJ,f as cH,cd as KJ,ce as YJ,cf as XJ,t as Sr,ao as SE,cg as wc,bh as Sy,b as uH,ch as yN,ci as QJ,cj as CN,ck as JJ,cl as ZJ,cm as SN,w as HA,cn as dH,aj as UA,aB as eZ,co as kN,cp as ky,cq as tZ,cr as nZ,cs as sZ,ct as rZ,cu as iZ,cv as hH,cw as S1,cx as fH,cy as pH,cz as Fm,cA as aZ,cB as gH,cC as oZ,cD as EN,cE as TN,cF as $_,ac as GA,cG as mH,cH as lZ,ab as cZ,aa as uZ,cI as dZ,cJ as hZ,cK as RN,cL as fZ,cM as pZ,cN as gZ,cO as Ob,cP as mZ,cQ as vZ,cR as bZ,cS as AN,cT as FN,cU as _Z,cV as xZ,cW as Dd,cX as DN,cY as IN,cZ as NN,c_ as PN,c$ as wZ,d0 as yZ,d1 as CZ,d2 as SZ,d3 as kZ,d4 as EZ,d5 as TZ,d6 as MN,d7 as k1,d8 as ON,d9 as RZ,da as AZ,db as FZ,dc as Dx,dd as LN,de as DZ,df as IZ,dg as NZ,dh as PZ,di as BN,dj as MZ,dk as OZ,dl as LZ,dm as BZ,dn as Lb,dp as jZ,dq as kE,dr as HZ,ds as UZ,dt as GZ,du as vH,m as VZ,dv as WZ,ad as VA,bo as jN,dw as zZ,dx as $Z,dy as qZ,bn as KZ,aV as bH,aX as YZ,dz as HN,v as UN,dA as Qm,dB as XZ,dC as QZ,dD as GN,dE as JZ,dF as Bb,dG as VN,dH as ZZ,dI as jb,dJ as eee,dK as Hb,dL as WN,dM as tee,dN as nee,dO as zN,dP as Ub,dQ as $N,dR as Gb,dS as q_,y as Ix,z as _H,A as see,aC as EE,dT as ree,dU as iee,dV as aee,dW as oee,dX as lee,dY as cee,dZ as uee,d_ as dee,d$ as xH,e0 as hee,a9 as Qv,e1 as fee,e2 as WA,am as pee,e3 as gee,e4 as mee,al as vee,e5 as bee,e6 as _ee,e7 as qN,aY as xee,e8 as E1,a5 as wee,e9 as KN,ea as yee,eb as Cee,ec as See,ed as kee,ee as Eee,ef as Tee,eg as YN,U as Ree,eh as Aee,S as XN,ei as Fee,ej as Dee,ek as Iee,B as Nee,el as Pee,M as Ce,au as yf,ae as Mee,em as wH,en as Oee,eo as Lee,ep as Bee,eq as jee,er as Ey,es as zA,et as yH,eu as CH,o as Hee,ev as Uee,bi as Gee,ew as Vee,ex as $A,ey as QN,ez as Wee,eA as zee,eB as T1,eC as $ee,aL as qee,eD as Kee,eE as Yee,at as Xee,eF as JN,eG as Qee,eH as xr,a2 as ZN,eI as Jee,eJ as Zee,eK as eP,eL as tP,eM as ete,eN as SH,eO as nP,eP as tte,C as kH,E as nte}from"./appearance-D-cqStrp.js";import{u as Ve,c as Rt,z as ud,S as Pn,G as el,B as ue,L as gr,K as ks,T as Ty,a as mr,X as rs,af as TE,aB as ste,n as Gc,o as Vc,p as Ol,J as Hi,k as Ui,r as Jv,s as jp,aj as Zv,A as yr,w as bt,a6 as pg,y as Ry,F as Ay,R as H0,U as U0,V as G0,W as V0,Y as W0,D as Xo,b as _o,d as Qo,H as sP,I as Wr,e as on,g as eb,i as Yu,j as Nx,aC as R1,al as EH,N as TH,O as RH,P as RE,f as K_,aD as cp,aA as rte,a7 as Eh,a8 as Fy,a9 as Xu,aE as ite,_ as Px,t as AH,ab as Dy,v as Iy,aF as ate,Z as qA,aa as ote,ai as AE,h as lte,aG as Jg,au as KA,$ as YA,Q as cte,ac as ute,ad as dte,ae as hte,l as fte,m as pte,ag as gte,ah as mte,ay as vte,az as bte,aH as FH,as as ep,q as rP,x as iP,aI as Iu,E as _te}from"./error-boundary-DP-w218V.js";import{d3 as Y_,c6 as Hu,az as Da,cC as XA,b1 as yo,b2 as sr,aF as fn,bv as pn,ay as zs,aR as Wl,bz as tb,d4 as xte,bA as nb,gY as DH,gZ as wte,g_ as z0,g$ as yte,h0 as Cte,h1 as Ste,h2 as kte,h3 as A1,h4 as F1,a0 as Nu,cK as Ny,fl as dd,f3 as X_,f2 as Ete,f1 as Or,f4 as Dn,h5 as IH,h6 as Tte,co as FE,bC as Kh,bF as Py,fa as My,g5 as Rte,h7 as aP,h8 as Ate,h9 as Fte,ha as DE,hb as Dte,hc as Ite,hd as Nte,he as Pte,hf as Mx,aW as Ox,bg as up,hg as oP,hh as lP,X as IE,hi as Mte,hj as Ote,hk as Lte,hl as Bte,hm as NH,hn as jte,ho as Hte,hp as PH,hq as Oy,hr as Ly,hs as Ute,ht as Gte,hu as Vte,hv as cP,hw as Wte,hx as zte,hy as $te,hz as qte,hA as Kte,hB as Yte,hC as Xte,hD as Qte,hE as Jte,hF as Zte,hG as ene,hH as tne,cU as MH,hI as nne,hJ as OH,hK as sne,hL as uP,hM as rne,hN as ine,cR as yi,hO as QA,eB as LH,hP as ane,hQ as one,hR as dP,hS as lne,hT as cne,hU as une,hV as dne,hW as hne,cf as BH,hX as Jm,hY as jH,hZ as fne,h_ as pne,h$ as gne,i0 as mne,i1 as vne,i2 as gg,i3 as bne,i4 as _ne,c4 as Qu,i5 as Ju,i6 as xne,a_ as mg,i7 as hP,i8 as wne,i9 as yne,ia as Cne,ib as fP,ic as Sne,id as kne,ie as Vf,fy as Ene,ig as Tne,ih as Rne,fB as Ane,ii as Fne,ij as Dne,ik as HH,il as By,bH as UH,im as jy,io as Ine,bx as JA,gc as Vo,dR as ji,ip as GH,a1 as yc,iq as VH,c5 as Th,cJ as Hy,cI as $0,ir as Nne,is as Pne,ca as Zu,cM as Uy,ft as Mne,it as One,iu as Lne,iv as Bne,iw as jne,ix as Hne,iy as Une,iz as Gne,iA as Vne,iB as Wne,iC as pP,iD as zne,iE as $ne,iF as ZA,iG as gP,gX as qne,fD as Kne,iH as Yne,iI as WH,iJ as Xne,iK as Qne,iL as zH,iM as NE,iN as Jne,dz as dp,iO as mP,iP as D1,iQ as Zne,cN as Gy,iR as ese,iS as $H,iT as PE,iU as tse,iV as qH,iW as nse,iX as Lx,iY as sse,iZ as rse,i_ as ise,i$ as ase,j0 as ose,j1 as lse,j2 as cse,bb as Ps,j3 as KH,ba as jo,j4 as YH,j5 as use,j6 as dse,eA as vP,j7 as XH,j8 as QH,j9 as JH,e3 as ZH,ja as ed,jb as e8,y as gt,jc as is,jd as Bx,je as Tn,jf as t8,jg as n8,jh as e2,ji as jx,jj as s8,jk as Vy,jl as sb,jm as Rh,O as t2,jn as ME,jo as n2,jp as I1,jq as Wy,jr as hse,js as Co,jt as fse,ju as pse,jv as tp,jw as OE,jx as r8,jy as gse,jz as q0,jA as zy,jB as s2,jC as mse,jD as vse,jE as bse,jF as Bn,jG as K0,jH as i8,jI as oo,jJ as _se,jK as xse,jL as a8,jM as wse,jN as yse,jO as Cse,jP as Sse,jQ as kse,jR as Ese,jS as Tse,jT as Rse,jU as Ase,jV as Fse,jW as Dse,jX as Ise,jY as Nse,jZ as Pse,j_ as Mse,j$ as Ose,k0 as Lse,k1 as r2,k2 as Bse,k3 as bP,k4 as i2,k5 as jse,k6 as o8,k7 as l8,k8 as a2,k9 as Hse,cT as c8,da as $y,dd as qy,ka as Ky,kb as vg,cA as u8,cE as Use,dL as _P,cb as d8,dP as Gse,dE as Vse,kc as Wse,dF as zse,dG as $se,dH as qse,dI as Kse,dJ as Yse,dK as Xse,be as Yr,dS as Qse,kd as Jse,ke as Zse,dU as ere,dT as tre,dO as nre,dQ as sre,kf as rre,kg as h8,kh as ire,ki as are,kj as Y0,kk as o2,kl as Yy,km as l2,kn as ore,ko as lre,kp as cre,kq as f8,kr as ure,ks as xP,kt as dre,ku as c2,kv as hre,kw as u2,kx as rb,ky as ib,kz as fre,kA as p8,eg as X0,kB as pre,kC as gre,kD as mre,kE as vre,kF as bre,kG as _re,kH as wP,ef as g8,r as m8,eh as xre,kI as wre,kJ as yre,kK as Cre,cQ as Sre,kL as kre,kM as bc,kN as yP,kO as Zm,kP as Zg,kQ as Ere,kR as CP,kS as SP,kT as Tre,ac as v8,cy as b8,cv as e0,kU as Rre,kV as Are,kW as Xy,kX as Q0,dg as Fre,bw as bg,kY as Dre,kZ as LE,k_ as Ire,k$ as Nre,bB as zi,bu as Qy,di as _g,dj as _8,l0 as d2,cF as x8,l1 as Pre,l2 as w8,l3 as Mre,l4 as Uu,fZ as h2,a3 as f2,l5 as Ore,cr as p2,cs as Jy,l6 as Lre,cq as Hp,dh as N1,l7 as Bre,l8 as jre,l9 as Hre,la as Ure,lb as Gre,lc as Vre,fo as Wre,fp as zre,fq as $re,fr as ac,ld as kP,le as qre,lf as Kre,lg as Yre,lh as Xre,li as Qre,lj as Jre,lk as Zre,ll as eie,lm as tie,ln as BE,e8 as y8,e9 as Hx,lo as nie,lp as C8,cW as sie,cS as rie,lq as iie,lr as S8,ls as aie,lt as oie,c_ as lie,lu as cie,lv as uie,lw as die,lx as hie,ly as fie,lz as pie,fk as gie,lA as k8,lB as mie,lC as vie,lD as Vb,lE as E8,fh as bie,lF as _ie,lG as T8,lH as xie,lI as lh,gy as R8,gz as g2,lJ as wie,lK as yie,lL as Cie,lM as A8,M as Sie,lN as kie,bh as F8,gx as Eie,lO as Tie,c9 as D8,lP as Rie,lQ as Aie,a4 as Fie,lR as Die,lS as Iie,lT as Nie,lU as Pie,lV as Mie,lW as EP,lX as P1,lY as Oie,cc as M1,cd as O1,ce as L1,bf as Lie,lZ as Bie,l_ as jie,l$ as Hie,d0 as Cf,m0 as Sf,m1 as Uie,m2 as Gie,m3 as Vie,m4 as Wie,m5 as zie,m6 as $ie,m7 as I8,m8 as qie,m9 as N8,ma as jE,mb as HE,mc as B1,md as Kie,me as Yie,mf as Wf,mg as Xie,aY as TP,mh as RP,mi as P8,mj as UE,mk as M8,ml as O8,mm as Qie,mn as Jie,mo as Zie,mp as eae,mq as tae,mr as nae,ms as sae,mt as rae,mu as iae,mv as aae,mw as oae,mx as lae,my as cae,mz as uae,mA as j1,mB as dae,mC as hae,mD as fae,mE as pae,aa as gae,a6 as mae,ab as H1,a8 as vae,a7 as bae,mF as _ae,mG as xae,mH as AP,mI as wae,mJ as yae,mK as Cae,mL as Sae,mM as kae,b5 as Eae,b6 as Tae,b7 as Rae,b8 as Aae,b9 as Fae,mN as Dae,mO as Iae,mP as Nae,mQ as FP,dv as ni,e0 as Ut,dV as L8,br as Pc,bs as GE,et as m2,ew as v2,mR as Pae,mS as B8,mT as Mae,mU as Oae,mV as Lae,e$ as Bae,mW as jae,mX as Hae,mY as j8,mZ as Uae,f0 as DP,ex as b2,m_ as _2,du as hp,cB as H8,fC as U8,eI as G8,eF as Gae,eo as Vae,eO as Wae,dm as zae,dl as IP,eP as $ae,dn as qae,ep as Kae,eu as Yae,eV as Xae,eW as Qae,eX as V8,m$ as x2,n0 as Jae,bG as W8,n1 as z8,n2 as Zae,n3 as eoe,n4 as toe,n5 as gi,n6 as noe,n7 as xu,n8 as $8,n9 as q8,na as K8,nb as w2,nc as Sa,nd as soe,ne as roe,nf as ioe,ng as aoe,nh as ooe,ni as loe,nj as coe,nk as uoe,S as doe,nl as hoe,d5 as foe,nm as Y8,nn as poe,no as goe,np as moe,nq as voe,nr as boe,ns as VE,nt as _oe,nu as xoe,nv as NP,nw as X8,nx as woe,ny as yoe,nz as Coe,nA as PP,nB as Soe,nC as koe,nD as Eoe,nE as Toe,nF as Roe,nG as Aoe,nH as Foe,nI as Doe,nJ as y2,nK as Ioe,nL as MP,nM as Hd,nN as Q8,nO as WE,nP as Ux,nQ as Noe,nR as Poe,nS as Wb,nT as Dm,nU as C2,nV as J8,nW as Moe,nX as Ooe,nY as Loe,nZ as Z8,n_ as Boe,n$ as joe,fj as Gx,o0 as Hoe,o1 as OP,o2 as Uoe,o3 as Goe,o4 as Voe,o5 as Woe,o6 as zoe,o7 as $oe,o8 as qoe,g6 as LP,o9 as eU,oa as tU,ob as Koe,oc as Yoe,dw as Xoe,od as Qoe,g7 as Joe,oe as Zoe,of as ele,a$ as tle,cx as La,og as nle,oh as sle,oi as rle,oj as ile,ok as ale,fM as kf,ol as ole,om as lle,on as Vx,oo as cle,op as ule,oq as U1,or as G1,os as BP,ot as V1,ou as jP,ov as nU,ow as dle,bq as hle,ox as sU,oy as fle,bl as ple,bm as gle,bj as mle,bk as vle,oz as ble,bn as _le}from"./conversation-input-sync-PkxW9VtI.js";import{u as rU,o as xg,b as xle,c as wle,r as iU,d as aU,e as J0,f as yle,g as Cle,s as S2,n as Wx,h as Sle,i as kle,p as Ele,j as Tle,k as Rle,l as Ale,q as Fle,v as Dle,w as HP,x as UP,y as Ile,z as Nle,A as Ple,C as Mle,B as Ole,D as Lle,E as oU,F as lU,M as Ble,G as jle,H as Hle,I as Ule}from"./console-mirror-B88TErpS.js";import"./roles-D1pcbxAx.js";function GP(e,t){return e.filter(n=>!t.includes(n))}function Gle(e,t,n){const s=e.slice(0);return s[t]=n,s}var Vle=class extends wJ{#s;#e;#r;#i;#t;#n;#a;#o;#l=[];constructor(e,t,n){super(),this.#s=e,this.#i=n,this.#r=[],this.#t=[],this.#e=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(e=>{e.subscribe(t=>{this.#h(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(e=>{e.destroy()})}setQueries(e,t){this.#r=e,this.#i=t,Ax.batch(()=>{const n=this.#t,s=this.#d(this.#r);this.#l=s,s.forEach(o=>o.observer.setOptions(o.defaultedQueryOptions));const r=s.map(o=>o.observer),i=r.map(o=>o.getCurrentResult()),a=r.some((o,l)=>o!==n[l]);n.length===r.length&&!a||(this.#t=r,this.#e=i,this.hasListeners()&&(GP(n,r).forEach(o=>{o.destroy()}),GP(r,n).forEach(o=>{o.subscribe(l=>{this.#h(o,l)})}),this.#f()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(e=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,t){const n=this.#d(e),s=n.map(r=>r.observer.getOptimisticResult(r.defaultedQueryOptions));return[s,r=>this.#u(r??s,t),()=>this.#c(s,n)]}#c(e,t){return t.map((n,s)=>{const r=e[s];return n.defaultedQueryOptions.notifyOnChangeProps?r:n.observer.trackResult(r,i=>{t.forEach(a=>{a.observer.trackProp(i)})})})}#u(e,t){return t?((!this.#n||this.#e!==this.#o||t!==this.#a)&&(this.#a=t,this.#o=this.#e,this.#n=eH(this.#n,t(e))),this.#n):e}#d(e){const t=new Map(this.#t.map(s=>[s.options.queryHash,s])),n=[];return e.forEach(s=>{const r=this.#s.defaultQueryOptions(s),i=t.get(r.queryHash);i?n.push({defaultedQueryOptions:r,observer:i}):n.push({defaultedQueryOptions:r,observer:new tH(this.#s,r)})}),n}#h(e,t){const n=this.#t.indexOf(e);n!==-1&&(this.#e=Gle(this.#e,n,t),this.#f())}#f(){if(this.hasListeners()){const e=this.#n,t=this.#c(this.#e,this.#l),n=this.#u(t,this.#i?.combine);e!==n&&Ax.batch(()=>{this.listeners.forEach(s=>{s(this.#e)})})}}};function cU({queries:e,...t},n){const s=Nt(n),r=yJ(),i=CJ(),a=m.useMemo(()=>e.map(b=>{const _=s.defaultQueryOptions(b);return _._optimisticResults=r?"isRestoring":"optimistic",_}),[e,s,r]);a.forEach(b=>{SJ(b),kJ(b,i)}),EJ(i);const[o]=m.useState(()=>new Vle(s,a,t)),[l,u,d]=o.getOptimisticResult(a,t.combine),f=!r&&t.subscribed!==!1;m.useSyncExternalStore(m.useCallback(b=>f?o.subscribe(Ax.batchCalls(b)):TJ,[o,f]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),m.useEffect(()=>{o.setQueries(a,t)},[a,t,o]);const g=l.some((b,_)=>vN(a[_],b))?l.flatMap((b,_)=>{const x=a[_];if(x){const w=new tH(s,x);if(vN(x,b))return bN(x,w,i);RJ(b,r)&&bN(x,w,i)}return[]}):[];if(g.length>0)throw Promise.all(g);const v=l.find((b,_)=>{const x=a[_];return x&&AJ({result:b,errorResetBoundary:i,throwOnError:x.throwOnError,query:s.getQueryCache().get(x.queryHash),suspense:x.suspense})});if(v?.error)throw v.error;return u(d())}function VP(e,t){return e.findAll(t.filters).map(n=>t.select?t.select(n):n.state)}function Wle(e={},t){const n=Nt(t).getMutationCache(),s=m.useRef(e),r=m.useRef(null);return r.current||(r.current=VP(n,e)),m.useEffect(()=>{s.current=e}),m.useSyncExternalStore(m.useCallback(i=>n.subscribe(()=>{const a=eH(r.current,VP(n,s.current));r.current!==a&&(r.current=a,Ax.schedule(i))}),[n]),()=>r.current,()=>r.current)}const Q_=8e3,uU=1e4;function zle(e){return e?h("ui.notices.chat.archive_offered_title",{title:e}):h("ui.notices.chat.archive_offered_no_name")}const $le=()=>h("ui.notices.chat.archive_offered_verb");function qle(e){return Ne.getState().archiveFacts[e]}function Kle(e){const t=Ne.getState(),n=t.archiveFacts[e];return n?n.archived:t.sessions.find(s=>s.session_id===e)?.archived}function Yle(){const e=Ne(t=>t.archiveUndo);m.useEffect(()=>{if(e===null)return;let t=!1;const n=()=>{t||(t=!0,r())},s=()=>{n();const i=Ne.getState().archiveUndo;i!==null&&i.sessionId===e.sessionId&&i.at===e.at&&Ne.getState().setArchiveUndo(null)},r=Ne.subscribe(()=>{const i=qle(e.sessionId);i!==void 0&&!i.answered||FJ(e.archived,Kle(e.sessionId))||s()});return n},[e])}function Xle(e){return h("ui.notices.chat.drafts_offered_name",{count:e})}const Qle=e=>h("ui.notices.chat.drafts_offered_verb",{count:e}),Jle=e=>{const t=_N(e),n=t.length,s=t.filter(o=>!o.active).length,r=n===1?"chat":"chats",i=e.filter(o=>OA(o)!==null&&_N([o]).length===0).length,a=[`Mark ${n} unread ${r} as read${s>0?`, including ${s} in Previous chats`:""}.`];return i>0&&a.push(`${i} unread ${i===1?"mark":"marks"} with no completion token cannot be cleared.`),{count:n,label:`Mark all ${n} read`,scope:a.join(" "),nameSuffix:s>0?`, including ${s} in Previous chats`:""}},dU=e=>h("ui.notices.chat.mark_all_read_deferred",{count:e}),Zle=e=>{if(e.attempted===0)return{tone:"success",message:h("ui.notices.chat.mark_all_read_nothing")};const t=e.unknown-e.deferred,n=[e.superseded>0?h("ui.notices.chat.mark_all_read_superseded",{count:e.superseded}):null,t>0?h("ui.notices.chat.mark_all_read_unknown",{count:t}):null,e.deferred>0?dU(e.deferred):null].filter(s=>s!==null);return e.cleared===0?{tone:"warning",message:[h("ui.notices.chat.mark_all_read_none_cleared"),...n].join(" ")}:{tone:"success",message:[h("ui.notices.chat.mark_all_read_cleared",{count:e.cleared}),...n].join(" ")}},W1="archive",WP="drafts-undo",zP="bulk-read-deferral",ece=8e3;function tce(){const e=Ve(),t=Ne(b=>b.archiveFailure),n=Ne(b=>b.archiveUndo),s=Ne(b=>b.draftsUndo),r=Ne(b=>b.bulkReadDeferral),i=Ne(b=>b.clearArchiveFailure),a=Ne(b=>b.setArchiveUndo),o=Ne(b=>b.setSessionArchived),l=Ne(b=>b.restoreDraftsUndo);Yle();const u=jd(t?.title),d=m.useRef(null),f=m.useRef(null);m.useEffect(()=>{if(t===null&&n===null){if(d.current===null)return;d.current=null,f.current=null,Y_(W1);return}const b=t&&n?n.at>t.at?"offer":"failure":t?"failure":"offer",_=b==="offer"?n?.at??0:t?.at??0,x=d.current;d.current={kind:b,at:_},x!==null&&x.kind!==b&&_>x.at&&(b==="failure"?a(null):i());const w=(y,S)=>()=>{const C=Ne.getState();y==="offer"?C.archiveUndo?.at===S&&C.setArchiveUndo(null):C.archiveFailure?.at===S&&C.clearArchiveFailure();const k=d.current;k!==null&&k.kind===y&&k.at===S&&(d.current=null)};if(b==="failure"&&t){const y=f.current,S=y!==null&&y.kind==="failure"&&y.at===t.at;if(S&&y.locale===e)return;const C=S?y.raisedAt+y.duration-Date.now():uU;if(C<=0)return;f.current=S?{...y,locale:e}:{kind:"failure",at:t.at,raisedAt:Date.now(),duration:C,locale:e},Hu(`${t.archived?h("ui.notices.chat.archive_failed",{title:u}):h("ui.notices.chat.unarchive_failed",{title:u})}${t.detail?` ${t.detail}`:""}`,{id:W1,duration:C,onAutoClose:w("failure",t.at),onDismiss:w("failure",t.at),action:{label:h("ui.common.actions.retry"),onClick:k=>{k.preventDefault(),o(t.sessionId,t.archived,t.title)}}});return}if(n){const y=f.current,S=y!==null&&y.kind==="offer"&&y.at===n.at;if(S&&y.locale===e)return;const C=S?y.raisedAt+y.duration-Date.now():Q_;if(C<=0)return;f.current=S?{...y,locale:e}:{kind:"offer",at:n.at,raisedAt:Date.now(),duration:C,locale:e},Da(c.jsxs("span",{className:R("flex min-w-0 items-baseline gap-1"),children:[c.jsx("span",{className:R("min-w-0 truncate"),children:zle(n.title)}),c.jsx("span",{className:R("shrink-0"),children:$le()})]}),{id:W1,duration:C,classNames:{content:"min-w-0"},onAutoClose:w("offer",n.at),onDismiss:w("offer",n.at),action:{label:h("ui.notices.chat.undo"),onClick:k=>{k.preventDefault(),o(n.sessionId,!n.archived,n.title)}}})}},[e,u,t,n,a,i,o]);const p=m.useRef(!1),g=m.useRef(null);m.useEffect(()=>{if(s===null){if(!p.current)return;p.current=!1,g.current=null,Y_(WP);return}p.current=!0;const b=g.current,_=b!==null&&b.at===s.at;if(_&&b.locale===e)return;const x=_?b.raisedAt+Q_-Date.now():Q_;if(x<=0)return;g.current=_?{...b,locale:e}:{at:s.at,raisedAt:Date.now(),locale:e};const w=()=>{const y=Ne.getState();y.draftsUndo?.at===s.at&&(y.setDraftsUndo(null),p.current=!1)};Da(c.jsxs("span",{className:R("flex min-w-0 items-baseline gap-1"),children:[c.jsx("span",{className:R("min-w-0 truncate"),children:Xle(s.keys.length)}),c.jsx("span",{className:R("shrink-0"),children:Qle(s.keys.length)})]}),{id:WP,duration:x,classNames:{content:"min-w-0"},onAutoClose:w,onDismiss:w,action:{label:h("ui.notices.chat.undo"),onClick:y=>{y.preventDefault(),l();const S=Ne.getState(),C=S.stagedByDiscard;S.setStagedByDiscard(null),s.keys.length===1&&C!==null&&Ne.getState().activeDraftKey===C&&Ne.getState().openDraft(s.keys[0])}}})},[e,s,l]);const v=m.useRef(!1);return m.useEffect(()=>{if(r===null){if(!v.current)return;v.current=!1,Y_(zP);return}v.current=!0;const b=()=>{const _=Ne.getState();_.bulkReadDeferral?.at===r.at&&(_.clearBulkReadDeferral(),v.current=!1)};Da(dU(r.count),{id:zP,duration:ece,onAutoClose:b,onDismiss:b})},[r]),null}var Bo,Ke=typeof window<"u"?window:void 0,ia=typeof globalThis<"u"?globalThis:Ke,hU=Array.prototype,$P=hU.forEach,qP=hU.indexOf,Aa=ia?.navigator,Ot=ia?.document,sa=ia?.location,zE=ia?.fetch,$E=ia!=null&&ia.XMLHttpRequest&&"withCredentials"in new ia.XMLHttpRequest?ia.XMLHttpRequest:void 0,KP=ia?.AbortController,hr=Aa?.userAgent,hn=Ke??{},pc={DEBUG:!1,LIB_VERSION:"1.235.6"},z1="$copy_autocapture",nce=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];(function(e){e.GZipJS="gzip-js",e.Base64="base64"})(Bo||(Bo={}));var sce=["fatal","error","warning","log","info","debug"];function En(e,t){return e.indexOf(t)!==-1}var Zy=function(e){return e.trim()},k2=function(e){return e.replace(/^\$/,"")},rce=Array.isArray,fU=Object.prototype,pU=fU.hasOwnProperty,eC=fU.toString,Gs=rce||function(e){return eC.call(e)==="[object Array]"},Wo=e=>typeof e=="function",Vs=e=>e===Object(e)&&!Gs(e),np=e=>{if(Vs(e)){for(var t in e)if(pU.call(e,t))return!1;return!0}return!1},Dt=e=>e===void 0,pr=e=>eC.call(e)=="[object String]",qE=e=>pr(e)&&e.trim().length===0,hd=e=>e===null,ss=e=>Dt(e)||hd(e),Bi=e=>eC.call(e)=="[object Number]",mc=e=>eC.call(e)==="[object Boolean]",ice=e=>e instanceof FormData,ace=e=>En(nce,e),gU=e=>{var t={_log:function(n){if(Ke&&(pc.DEBUG||hn.POSTHOG_DEBUG)&&!Dt(Ke.console)&&Ke.console){for(var s=("__rrweb_original__"in Ke.console[n])?Ke.console[n].__rrweb_original__:Ke.console[n],r=arguments.length,i=new Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];s(e,...i)}},info:function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];t._log("log",...s)},warn:function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];t._log("warn",...s)},error:function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];t._log("error",...s)},critical:function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];console.error(e,...s)},uninitializedWarning:n=>{t.error("You must initialize PostHog before calling ".concat(n))},createLogger:n=>gU("".concat(e," ").concat(n))};return t},Vt=gU("[PostHog.js]"),Ei=Vt.createLogger,oce=Ei("[ExternalScriptsLoader]"),YP=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return oce.warn("".concat(t," was requested but loading of external scripts is disabled.")),n("Loading of external scripts is disabled");var s=Ot?.querySelectorAll("script");if(s){for(var r=0;r<s.length;r++)if(s[r].src===t)return n()}var i=()=>{if(!Ot)return n("document not found");var a=Ot.createElement("script");if(a.type="text/javascript",a.crossOrigin="anonymous",a.src=t,a.onload=u=>n(void 0,u),a.onerror=u=>n(u),e.config.prepare_external_dependency_script&&(a=e.config.prepare_external_dependency_script(a)),!a)return n("prepare_external_dependency_script returned null");var o,l=Ot.querySelectorAll("body > script");l.length>0?(o=l[0].parentNode)===null||o===void 0||o.insertBefore(a,l[0]):Ot.body.appendChild(a)};Ot!=null&&Ot.body?i():Ot?.addEventListener("DOMContentLoaded",i)};function XP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,s)}return n}function Ze(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?XP(Object(n),!0).forEach(function(s){yt(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):XP(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function yt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mU(e,t){if(e==null)return{};var n,s,r=function(a,o){if(a==null)return{};var l,u,d={},f=Object.keys(a);for(u=0;u<f.length;u++)l=f[u],o.indexOf(l)>=0||(d[l]=a[l]);return d}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}hn.__PosthogExtensions__=hn.__PosthogExtensions__||{},hn.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{var s="/static/".concat(t,".js")+"?v=".concat(e.version);if(t==="remote-config"&&(s="/array/".concat(e.config.token,"/config.js")),t==="toolbar"){var r=3e5,i=Math.floor(Date.now()/r)*r;s="".concat(s,"&t=").concat(i)}var a=e.requestRouter.endpointFor("assets",s);YP(e,a,n)},hn.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var s=e.requestRouter.endpointFor("api",t);YP(e,s,n)};var zx={};function Gu(e,t,n){if(Gs(e)){if($P&&e.forEach===$P)e.forEach(t,n);else if("length"in e&&e.length===+e.length){for(var s=0,r=e.length;s<r;s++)if(s in e&&t.call(n,e[s],s)===zx)return}}}function fs(e,t,n){if(!ss(e)){if(Gs(e))return Gu(e,t,n);if(ice(e)){for(var s of e.entries())if(t.call(n,s[1],s[0])===zx)return}else for(var r in e)if(pU.call(e,r)&&t.call(n,e[r],r)===zx)return}}var Js=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];return Gu(n,function(r){for(var i in r)r[i]!==void 0&&(e[i]=r[i])}),e},J_=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];return Gu(n,function(r){Gu(r,function(i){e.push(i)})}),e};function Z_(e){for(var t=Object.keys(e),n=t.length,s=new Array(n);n--;)s[n]=[t[n],e[t[n]]];return s}var QP=function(e){try{return e()}catch{return}},lce=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return e.apply(this,n)}catch(r){Vt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Vt.critical(r)}}},Z0=function(e){var t={};return fs(e,function(n,s){pr(n)&&n.length>0&&(t[s]=n)}),t};function cce(e,t){return n=e,s=i=>pr(i)&&!hd(t)?i.slice(0,t):i,r=new Set,function i(a,o){return a!==Object(a)?s?s(a,o):a:r.has(a)?void 0:(r.add(a),Gs(a)?(l=[],Gu(a,u=>{l.push(i(u))})):(l={},fs(a,(u,d)=>{r.has(u)||(l[d]=i(u,d))})),l);var l}(n);var n,s,r}var uce=["herokuapp.com","vercel.app","netlify.app"];function dce(e){var t=e?.hostname;if(!pr(t))return!1;var n=t.split(".").slice(-2).join(".");for(var s of uce)if(n===s)return!1;return!0}function vU(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function er(e,t,n,s){var{capture:r=!1,passive:i=!0}=s??{};e?.addEventListener(t,n,{capture:r,passive:i})}var bU="$people_distinct_id",Im="__alias",Nm="__timers",JP="$autocapture_disabled_server_side",KE="$heatmaps_enabled_server_side",ZP="$exception_capture_enabled_server_side",eM="$web_vitals_enabled_server_side",_U="$dead_clicks_enabled_server_side",tM="$web_vitals_allowed_metrics",YE="$session_recording_enabled_server_side",nM="$console_log_recording_enabled_server_side",sM="$session_recording_network_payload_capture",rM="$session_recording_masking",iM="$session_recording_canvas_recording",aM="$replay_sample_rate",oM="$replay_minimum_duration",lM="$replay_script_config",$x="$sesid",Pm="$session_is_sampled",$1="$session_recording_url_trigger_activated_session",q1="$session_recording_event_trigger_activated_session",sp="$enabled_feature_flags",ex="$early_access_features",XE="$feature_flag_details",Mm="$stored_person_properties",Ud="$stored_group_properties",QE="$surveys",zb="$surveys_activated",qx="$flag_call_reported",dc="$user_state",JE="$client_session_props",ZE="$capture_rate_limit",eT="$initial_campaign_params",tT="$initial_referrer_info",nT="$initial_person_info",Kx="$epp",xU="__POSTHOG_TOOLBAR__",cM="$posthog_cookieless",hce=[bU,Im,"__cmpns",Nm,YE,KE,$x,sp,dc,ex,XE,Ud,Mm,QE,qx,JE,ZE,eT,tT,Kx];function uM(e){var t;return e instanceof Element&&(e.id===xU||!((t=e.closest)===null||t===void 0||!t.call(e,".toolbar-global-fade-container")))}function tC(e){return!!e&&e.nodeType===1}function Vu(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function wU(e){return!!e&&e.nodeType===3}function yU(e){return!!e&&e.nodeType===11}function E2(e){return e?Zy(e).split(/\s+/):[]}function dM(e){var t=Ke?.location.href;return!!(t&&e&&e.some(n=>t.match(n)))}function Yx(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return E2(t)}function CU(e){return ss(e)?null:Zy(e).split(/(\s+)/).filter(t=>Up(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function nC(e){var t="";return rT(e)&&!EU(e)&&e.childNodes&&e.childNodes.length&&fs(e.childNodes,function(n){var s;wU(n)&&n.textContent&&(t+=(s=CU(n.textContent))!==null&&s!==void 0?s:"")}),Zy(t)}function SU(e){return Dt(e.target)?e.srcElement||null:(t=e.target)!==null&&t!==void 0&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var sT=["a","button","form","input","select","textarea","label"];function kU(e){var t=e.parentNode;return!(!t||!tC(t))&&t}function fce(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;if(!Ke||!e||Vu(e,"html")||!tC(e)||n!=null&&n.url_allowlist&&!dM(n.url_allowlist)||n!=null&&n.url_ignorelist&&dM(n.url_ignorelist))return!1;if(n!=null&&n.dom_event_allowlist){var i=n.dom_event_allowlist;if(i&&!i.some(g=>t.type===g))return!1}for(var a=!1,o=[e],l=!0,u=e;u.parentNode&&!Vu(u,"body");)if(yU(u.parentNode))o.push(u.parentNode.host),u=u.parentNode.host;else{if(!(l=kU(u)))break;if(s||sT.indexOf(l.tagName.toLowerCase())>-1)a=!0;else{var d=Ke.getComputedStyle(l);d&&d.getPropertyValue("cursor")==="pointer"&&(a=!0)}o.push(l),u=l}if(!function(g,v){var b=v?.element_allowlist;if(Dt(b))return!0;var _=function(y){if(b.some(S=>y.tagName.toLowerCase()===S))return{v:!0}};for(var x of g){var w=_(x);if(typeof w=="object")return w.v}return!1}(o,n)||!function(g,v){var b=v?.css_selector_allowlist;if(Dt(b))return!0;var _=function(y){if(b.some(S=>y.matches(S)))return{v:!0}};for(var x of g){var w=_(x);if(typeof w=="object")return w.v}return!1}(o,n))return!1;var f=Ke.getComputedStyle(e);if(f&&f.getPropertyValue("cursor")==="pointer"&&t.type==="click")return!0;var p=e.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(r||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(t.type)>=0;default:return a?(r||["click"]).indexOf(t.type)>=0:(r||["click"]).indexOf(t.type)>=0&&(sT.indexOf(p)>-1||e.getAttribute("contenteditable")==="true")}}function rT(e){for(var t=e;t.parentNode&&!Vu(t,"body");t=t.parentNode){var n=Yx(t);if(En(n,"ph-sensitive")||En(n,"ph-no-capture"))return!1}if(En(Yx(e),"ph-include"))return!0;var s=e.type||"";if(pr(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";return!(pr(r)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,"")))}function EU(e){return!!(Vu(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Vu(e,"select")||Vu(e,"textarea")||e.getAttribute("contenteditable")==="true")}var TU="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",pce=new RegExp("^(?:".concat(TU,")$")),gce=new RegExp(TU),RU="\\d{3}-?\\d{2}-?\\d{4}",mce=new RegExp("^(".concat(RU,")$")),vce=new RegExp("(".concat(RU,")"));function Up(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(ss(e)||pr(e)&&(e=Zy(e),(t?pce:gce).test((e||"").replace(/[- ]/g,""))||(t?mce:vce).test(e)))}function AU(e){var t=nC(e);return Up(t="".concat(t," ").concat(FU(e)).trim())?t:""}function FU(e){var t="";return e&&e.childNodes&&e.childNodes.length&&fs(e.childNodes,function(n){var s;if(n&&((s=n.tagName)===null||s===void 0?void 0:s.toLowerCase())==="span")try{var r=nC(n);t="".concat(t," ").concat(r).trim(),n.childNodes&&n.childNodes.length&&(t="".concat(t," ").concat(FU(n)).trim())}catch(i){Vt.error("[AutoCapture]",i)}}),t}function bce(e){return function(t){var n=t.map(s=>{var r,i,a="";if(s.tag_name&&(a+=s.tag_name),s.attr_class)for(var o of(s.attr_class.sort(),s.attr_class))a+=".".concat(o.replace(/"/g,""));var l=Ze(Ze(Ze(Ze({},s.text?{text:s.text}:{}),{},{"nth-child":(r=s.nth_child)!==null&&r!==void 0?r:0,"nth-of-type":(i=s.nth_of_type)!==null&&i!==void 0?i:0},s.href?{href:s.href}:{}),s.attr_id?{attr_id:s.attr_id}:{}),s.attributes),u={};return Z_(l).sort((d,f)=>{var[p]=d,[g]=f;return p.localeCompare(g)}).forEach(d=>{var[f,p]=d;return u[hM(f.toString())]=hM(p.toString())}),a+=":",a+=Z_(l).map(d=>{var[f,p]=d;return"".concat(f,'="').concat(p,'"')}).join("")});return n.join(";")}(function(t){return t.map(n=>{var s,r,i={text:(s=n.$el_text)===null||s===void 0?void 0:s.slice(0,400),tag_name:n.tag_name,href:(r=n.attr__href)===null||r===void 0?void 0:r.slice(0,2048),attr_class:_ce(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return Z_(n).filter(a=>{var[o]=a;return o.indexOf("attr__")===0}).forEach(a=>{var[o,l]=a;return i.attributes[o]=l}),i})}(e))}function hM(e){return e.replace(/"|\\"/g,'\\"')}function _ce(e){var t=e.attr__class;return t?Gs(t)?t:E2(t):void 0}class DU{constructor(){this.clicks=[]}isRageClick(t,n,s){var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(n-r.y)<30&&s-r.timestamp<1e3){if(this.clicks.push({x:t,y:n,timestamp:s}),this.clicks.length===3)return!0}else this.clicks=[{x:t,y:n,timestamp:s}];return!1}}var xce=["localhost","127.0.0.1"],fp=e=>{var t=Ot?.createElement("a");return Dt(t)?null:(t.href=e,t)},wce=function(e){var t,n,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",r=[];return fs(e,function(i,a){Dt(i)||Dt(a)||a==="undefined"||(t=encodeURIComponent((o=>o instanceof File)(i)?i.name:i.toString()),n=encodeURIComponent(a),r[r.length]=n+"="+t)}),r.join(s)},Xx=function(e,t){for(var n,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;r<s.length;r++){var i=s[r].split("=");if(i[0]===t){n=i;break}}if(!Gs(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch{Vt.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},K1=function(e,t,n){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[0]||"",i=s[1],a=r.split("?"),o=a[1],l=a[0],u=(o||"").split("&"),d=[],f=0;f<u.length;f++){var p=u[f].split("=");Gs(p)&&(t.includes(p[0])?d.push(p[0]+"="+n):d.push(u[f]))}var g=l;return o!=null&&(g+="?"+d.join("&")),i!=null&&(g+="#"+i),g},Qx=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},fM=Ei("[AutoCapture]");function Y1(e,t){return t.length>e?t.slice(0,e)+"...":t}function yce(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!tC(t));return t}function Cce(e,t,n,s){var r=e.tagName.toLowerCase(),i={tag_name:r};sT.indexOf(r)>-1&&!n&&(r.toLowerCase()==="a"||r.toLowerCase()==="button"?i.$el_text=Y1(1024,AU(e)):i.$el_text=Y1(1024,nC(e)));var a=Yx(e);a.length>0&&(i.classes=a.filter(function(d){return d!==""})),fs(e.attributes,function(d){var f;if((!EU(e)||["name","id","class","aria-label"].indexOf(d.name)!==-1)&&(s==null||!s.includes(d.name))&&!t&&Up(d.value)&&(f=d.name,!pr(f)||f.substring(0,10)!=="_ngcontent"&&f.substring(0,7)!=="_nghost")){var p=d.value;d.name==="class"&&(p=E2(p).join(" ")),i["attr__"+d.name]=Y1(1024,p)}});for(var o=1,l=1,u=e;u=yce(u);)o++,u.tagName===e.tagName&&l++;return i.nth_child=o,i.nth_of_type=l,i}function Sce(e,t){for(var n,s,{e:r,maskAllElementAttributes:i,maskAllText:a,elementAttributeIgnoreList:o,elementsChainAsString:l}=t,u=[e],d=e;d.parentNode&&!Vu(d,"body");)yU(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var f,p=[],g={},v=!1,b=!1;if(fs(u,S=>{var C=rT(S);S.tagName.toLowerCase()==="a"&&(v=S.getAttribute("href"),v=C&&v&&Up(v)&&v),En(Yx(S),"ph-no-capture")&&(b=!0),p.push(Cce(S,i,a,o));var k=function(T){if(!rT(T))return{};var A={};return fs(T.attributes,function(F){if(F.name&&F.name.indexOf("data-ph-capture-attribute")===0){var I=F.name.replace("data-ph-capture-attribute-",""),N=F.value;I&&N&&Up(N)&&(A[I]=N)}}),A}(S);Js(g,k)}),b)return{props:{},explicitNoCapture:b};if(a||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?p[0].$el_text=AU(e):p[0].$el_text=nC(e)),v){var _,x;p[0].attr__href=v;var w=(_=fp(v))===null||_===void 0?void 0:_.host,y=Ke==null||(x=Ke.location)===null||x===void 0?void 0:x.host;w&&y&&w!==y&&(f=v)}return{props:Js({$event_type:r.type,$ce_version:1},l?{}:{$elements:p},{$elements_chain:bce(p)},(n=p[0])!==null&&n!==void 0&&n.$el_text?{$el_text:(s=p[0])===null||s===void 0?void 0:s.$el_text}:{},f&&r.type==="click"?{$external_click_url:f}:{},g)}}let kce=class{constructor(t){yt(this,"_initialized",!1),yt(this,"_isDisabledServerSide",null),yt(this,"rageclicks",new DU),yt(this,"_elementsChainAsString",!1),this.instance=t,this._elementSelectors=null}get config(){var t,n,s=Vs(this.instance.config.autocapture)?this.instance.config.autocapture:{};return s.url_allowlist=(t=s.url_allowlist)===null||t===void 0?void 0:t.map(r=>new RegExp(r)),s.url_ignorelist=(n=s.url_ignorelist)===null||n===void 0?void 0:n.map(r=>new RegExp(r)),s}_addDomEventHandlers(){if(this.isBrowserSupported()){if(Ke&&Ot){var t=s=>{s=s||Ke?.event;try{this._captureEvent(s)}catch(r){fM.error("Failed to capture event",r)}};if(er(Ot,"submit",t,{capture:!0}),er(Ot,"change",t,{capture:!0}),er(Ot,"click",t,{capture:!0}),this.config.capture_copied_text){var n=s=>{s=s||Ke?.event,this._captureEvent(s,z1)};er(Ot,"copy",n,{capture:!0}),er(Ot,"cut",n,{capture:!0})}}}else fM.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this._elementsChainAsString=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[JP]:!!t.autocapture_opt_out}),this._isDisabledServerSide=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this._elementSelectors=t}getElementSelectors(t){var n,s=[];return(n=this._elementSelectors)===null||n===void 0||n.forEach(r=>{var i=Ot?.querySelectorAll(r);i?.forEach(a=>{t===a&&s.push(r)})}),s}get isEnabled(){var t,n,s=(t=this.instance.persistence)===null||t===void 0?void 0:t.props[JP],r=this._isDisabledServerSide;if(hd(r)&&!mc(s)&&!this.instance.config.advanced_disable_decide)return!1;var i=(n=this._isDisabledServerSide)!==null&&n!==void 0?n:!!s;return!!this.instance.config.autocapture&&!i}_captureEvent(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"$autocapture";if(this.isEnabled){var s,r=SU(t);wU(r)&&(r=r.parentNode||null),n==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(s=this.rageclicks)!==null&&s!==void 0&&s.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this._captureEvent(t,"$rageclick");var i=n===z1;if(r&&fce(r,t,this.config,i,i?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:o}=Sce(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString});if(o)return!1;var l=this.getElementSelectors(r);if(l&&l.length>0&&(a.$element_selectors=l),n===z1){var u,d=CU(Ke==null||(u=Ke.getSelection())===null||u===void 0?void 0:u.toString()),f=t.type||"clipboard";if(!d)return!1;a.$selected_content=d,a.$copy_type=f}return this.instance.capture(n,a),!0}}}isBrowserSupported(){return Wo(Ot?.querySelectorAll)}};Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Bi(e)&&isFinite(e)&&Math.floor(e)===e});var pM="0123456789abcdef";let Ece=class iT{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,s,r){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(s)||!Number.isInteger(r)||t<0||n<0||s<0||r<0||t>0xffffffffffff||n>4095||s>1073741823||r>4294967295)throw new RangeError("invalid field value");var i=new Uint8Array(16);return i[0]=t/Math.pow(2,40),i[1]=t/Math.pow(2,32),i[2]=t/Math.pow(2,24),i[3]=t/Math.pow(2,16),i[4]=t/Math.pow(2,8),i[5]=t,i[6]=112|n>>>8,i[7]=n,i[8]=128|s>>>24,i[9]=s>>>16,i[10]=s>>>8,i[11]=s,i[12]=r>>>24,i[13]=r>>>16,i[14]=r>>>8,i[15]=r,new iT(i)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+pM.charAt(this.bytes[n]>>>4)+pM.charAt(15&this.bytes[n]),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new iT(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;n<16;n++){var s=this.bytes[n]-t.bytes[n];if(s!==0)return Math.sign(s)}return 0}},Tce=class{constructor(){yt(this,"timestamp",0),yt(this,"counter",0),yt(this,"random",new Rce)}generate(){var t=this.generateOrAbort();if(Dt(t)){this.timestamp=0;var n=this.generateOrAbort();if(Dt(n))throw new Error("Could not generate UUID after timestamp reset");return n}return t}generateOrAbort(){var t=Date.now();if(t>this.timestamp)this.timestamp=t,this.resetCounter();else{if(!(t+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return Ece.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}};var gM,IU=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};Ke&&!Dt(Ke.crypto)&&crypto.getRandomValues&&(IU=e=>crypto.getRandomValues(e));let Rce=class{constructor(){yt(this,"buffer",new Uint32Array(8)),yt(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(IU(this.buffer),this.cursor=0),this.buffer[this.cursor++]}};var Pu=()=>Ace().toString(),Ace=()=>(gM||(gM=new Tce)).generate(),Fce="Thu, 01 Jan 1970 00:00:00 GMT",em="",Dce=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Ice(e,t){if(t){var n=function(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ot;if(em)return em;if(!i||["localhost","127.0.0.1"].includes(r))return"";for(var a=r.split("."),o=Math.min(a.length,8),l="dmn_chk_"+Pu(),u=new RegExp("(^|;)\\s*"+l+"=1");!em&&o--;){var d=a.slice(o).join("."),f=l+"=1;domain=."+d;i.cookie=f,u.test(i.cookie)&&(i.cookie=f+";expires="+Fce,em=d)}return em}(e);if(!n){var s=(r=>{var i=r.match(Dce);return i?i[0]:""})(e);s!==n&&Vt.info("Warning: cookie subdomain discovery mismatch",s,n),n=s}return n?"; domain=."+n:""}return""}var ku,Cc={is_supported:()=>!!Ot,error:function(e){Vt.error("cookieStore error: "+e)},get:function(e){if(Ot){try{for(var t=e+"=",n=Ot.cookie.split(";").filter(i=>i.length),s=0;s<n.length;s++){for(var r=n[s];r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(t)===0)return decodeURIComponent(r.substring(t.length,r.length))}}catch{}return null}},parse:function(e){var t;try{t=JSON.parse(Cc.get(e))||{}}catch{}return t},set:function(e,t,n,s,r){if(Ot)try{var i="",a="",o=Ice(Ot.location.hostname,s);if(n){var l=new Date;l.setTime(l.getTime()+24*n*60*60*1e3),i="; expires="+l.toUTCString()}r&&(a="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+i+"; SameSite=Lax; path=/"+o+a;return u.length>3686.4&&Vt.warn("cookieStore warning: large cookie, len="+u.length),Ot.cookie=u,u}catch{return}},remove:function(e,t){try{Cc.set(e,"",-1,t)}catch{return}}},X1=null,wr={is_supported:function(){if(!hd(X1))return X1;var e=!0;if(Dt(Ke))e=!1;else try{var t="__mplssupport__";wr.set(t,"xyz"),wr.get(t)!=='"xyz"'&&(e=!1),wr.remove(t)}catch{e=!1}return e||Vt.error("localStorage unsupported; falling back to cookie store"),X1=e,e},error:function(e){Vt.error("localStorage error: "+e)},get:function(e){try{return Ke?.localStorage.getItem(e)}catch(t){wr.error(t)}return null},parse:function(e){try{return JSON.parse(wr.get(e))||{}}catch{}return null},set:function(e,t){try{Ke?.localStorage.setItem(e,JSON.stringify(t))}catch(n){wr.error(n)}},remove:function(e){try{Ke?.localStorage.removeItem(e)}catch(t){wr.error(t)}}},Nce=["distinct_id",$x,Pm,Kx,nT],$b=Ze(Ze({},wr),{},{parse:function(e){try{var t={};try{t=Cc.parse(e)||{}}catch{}var n=Js(t,JSON.parse(wr.get(e)||"{}"));return wr.set(e,n),n}catch{}return null},set:function(e,t,n,s,r,i){try{wr.set(e,t,void 0,void 0,i);var a={};Nce.forEach(o=>{t[o]&&(a[o]=t[o])}),Object.keys(a).length&&Cc.set(e,a,n,s,r,i)}catch(o){wr.error(o)}},remove:function(e,t){try{Ke?.localStorage.removeItem(e),Cc.remove(e,t)}catch(n){wr.error(n)}}}),qb={},Pce={is_supported:function(){return!0},error:function(e){Vt.error("memoryStorage error: "+e)},get:function(e){return qb[e]||null},parse:function(e){return qb[e]||null},set:function(e,t){qb[e]=t},remove:function(e){delete qb[e]}},Id=null,Xr={is_supported:function(){if(!hd(Id))return Id;if(Id=!0,Dt(Ke))Id=!1;else try{var e="__support__";Xr.set(e,"xyz"),Xr.get(e)!=='"xyz"'&&(Id=!1),Xr.remove(e)}catch{Id=!1}return Id},error:function(e){Vt.error("sessionStorage error: ",e)},get:function(e){try{return Ke?.sessionStorage.getItem(e)}catch(t){Xr.error(t)}return null},parse:function(e){try{return JSON.parse(Xr.get(e))||null}catch{}return null},set:function(e,t){try{Ke?.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){Xr.error(n)}},remove:function(e){try{Ke?.sessionStorage.removeItem(e)}catch(t){Xr.error(t)}}};(function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"})(ku||(ku={}));let Mce=class{constructor(t){this.instance=t}get config(){return this.instance.config}get consent(){return this.getDnt()?ku.DENIED:this.storedConsent}isOptedOut(){return this.consent===ku.DENIED||this.consent===ku.PENDING&&this.config.opt_out_capturing_by_default}isOptedIn(){return!this.isOptedOut()}optInOut(t){this.storage.set(this.storageKey,t?1:0,this.config.cookie_expiration,this.config.cross_subdomain_cookie,this.config.secure_cookie)}reset(){this.storage.remove(this.storageKey,this.config.cross_subdomain_cookie)}get storageKey(){var{token:t,opt_out_capturing_cookie_prefix:n}=this.instance.config;return(n||"__ph_opt_in_out_")+t}get storedConsent(){var t=this.storage.get(this.storageKey);return t==="1"?ku.GRANTED:t==="0"?ku.DENIED:ku.PENDING}get storage(){if(!this._storage){var t=this.config.opt_out_capturing_persistence_type;this._storage=t==="localStorage"?wr:Cc;var n=t==="localStorage"?Cc:wr;n.get(this.storageKey)&&(this._storage.get(this.storageKey)||this.optInOut(n.get(this.storageKey)==="1"),n.remove(this.storageKey,this.config.cross_subdomain_cookie))}return this._storage}getDnt(){return!!this.config.respect_dnt&&!!vU([Aa?.doNotTrack,Aa?.msDoNotTrack,hn.doNotTrack],t=>En([!0,1,"1","yes"],t))}};var Kb=Ei("[Dead Clicks]"),Oce=()=>!0,Lce=e=>{var t,n=!((t=e.instance.persistence)===null||t===void 0||!t.get_property(_U)),s=e.instance.config.capture_dead_clicks;return mc(s)?s:n};let NU=class{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(t,n,s){this.instance=t,this.isEnabled=n,this.onCapture=s,this.startIfEnabled()}onRemoteConfig(t){this.instance.persistence&&this.instance.persistence.register({[_U]:t?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript(()=>{this.start()})}loadScript(t){var n,s,r;(n=hn.__PosthogExtensions__)!==null&&n!==void 0&&n.initDeadClicksAutocapture&&t(),(s=hn.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"dead-clicks-autocapture",i=>{i?Kb.error("failed to load script",i):t()})}start(){var t;if(Ot){if(!this._lazyLoadedDeadClicksAutocapture&&(t=hn.__PosthogExtensions__)!==null&&t!==void 0&&t.initDeadClicksAutocapture){var n=Vs(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=hn.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this._lazyLoadedDeadClicksAutocapture.start(Ot),Kb.info("starting...")}}else Kb.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,Kb.info("stopping..."))}};var Q1=Ei("[ExceptionAutocapture]");let Bce=class{constructor(t){var n;yt(this,"startCapturing",()=>{var s;if(Ke&&this.isEnabled&&(s=hn.__PosthogExtensions__)!==null&&s!==void 0&&s.errorWrappingFunctions){var r=hn.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=hn.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,a=hn.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.unwrapOnError&&this.config.capture_unhandled_errors&&(this.unwrapOnError=r(this.captureException.bind(this))),!this.unwrapUnhandledRejection&&this.config.capture_unhandled_rejections&&(this.unwrapUnhandledRejection=i(this.captureException.bind(this))),!this.unwrapConsoleError&&this.config.capture_console_errors&&(this.unwrapConsoleError=a(this.captureException.bind(this)))}catch(o){Q1.error("failed to start",o),this.stopCapturing()}}}),this.instance=t,this.remoteEnabled=!((n=this.instance.persistence)===null||n===void 0||!n.props[ZP]),this.config=this.requiredConfig(),this.startIfEnabled()}requiredConfig(){var t=this.instance.config.capture_exceptions,n={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Vs(t)?n=Ze(Ze({},n),t):(Dt(t)?this.remoteEnabled:t)&&(n=Ze(Ze({},n),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),n}get isEnabled(){return this.config.capture_console_errors||this.config.capture_unhandled_errors||this.config.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(Q1.info("enabled"),this.loadScript(this.startCapturing))}loadScript(t){var n,s,r;(n=hn.__PosthogExtensions__)!==null&&n!==void 0&&n.errorWrappingFunctions&&t(),(s=hn.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"exception-autocapture",i=>{if(i)return Q1.error("failed to load script",i);t()})}stopCapturing(){var t,n,s;(t=this.unwrapOnError)===null||t===void 0||t.call(this),this.unwrapOnError=void 0,(n=this.unwrapUnhandledRejection)===null||n===void 0||n.call(this),this.unwrapUnhandledRejection=void 0,(s=this.unwrapConsoleError)===null||s===void 0||s.call(this),this.unwrapConsoleError=void 0}onRemoteConfig(t){var n=t.autocaptureExceptions;this.remoteEnabled=!!n||!1,this.config=this.requiredConfig(),this.instance.persistence&&this.instance.persistence.register({[ZP]:this.remoteEnabled}),this.startIfEnabled()}captureException(t){var n=this.instance.requestRouter.endpointFor("ui");t.$exception_personURL="".concat(n,"/project/").concat(this.instance.config.token,"/person/").concat(this.instance.get_distinct_id()),this.instance.exceptions.sendExceptionEvent(t)}};function PU(e){return!Dt(Event)&&MU(e,Event)}function MU(e,t){try{return e instanceof t}catch{return!1}}function tx(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function J1(e){return tx(e,"DOMError")}var mM=/\(error: (.*)\)/,vM=50,rp="?";function Z1(e,t,n,s){var r={platform:"web:javascript",filename:e,function:t==="<anonymous>"?rp:t,in_app:!0};return Dt(n)||(r.lineno=n),Dt(s)||(r.colno=s),r}var jce=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Hce=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Uce=/\((\S*)(?::(\d+))(?::(\d+))\)/,Gce=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Vce=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Wce=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var s=t.sort((r,i)=>r[0]-i[0]).map(r=>r[1]);return function(r){for(var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=[],o=r.split(`
|
|
3
3
|
`),l=i;l<o.length;l++){var u=o[l];if(!(u.length>1024)){var d=mM.test(u)?u.replace(mM,"$1"):u;if(!d.match(/\S*Error: /)){for(var f of s){var p=f(d);if(p){a.push(p);break}}if(a.length>=vM)break}}}return function(g){if(!g.length)return[];var v=Array.from(g);return v.reverse(),v.slice(0,vM).map(b=>Ze(Ze({},b),{},{filename:b.filename||zce(v).filename,function:b.function||rp}))}(a)}}([30,e=>{var t=jce.exec(e);if(t){var[,n,s,r]=t;return Z1(n,rp,+s,+r)}var i=Hce.exec(e);if(i){if(i[2]&&i[2].indexOf("eval")===0){var a=Uce.exec(i[2]);a&&(i[2]=a[1],i[3]=a[2],i[4]=a[3])}var[o,l]=_M(i[1]||rp,i[2]);return Z1(l,o,i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}}],[50,e=>{var t=Gce.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=Vce.exec(t[3]);n&&(t[1]=t[1]||"eval",t[3]=n[1],t[4]=n[2],t[5]="")}var s=t[3],r=t[1]||rp;return[r,s]=_M(r,s),Z1(s,r,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]);function zce(e){return e[e.length-1]||{}}var Yb,bM,eS,_M=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,s=e.indexOf("safari-web-extension")!==-1;return n||s?[e.indexOf("@")!==-1?e.split("@")[0]:rp,n?"safari-extension:".concat(t):"safari-web-extension:".concat(t)]:[e,t]},$ce=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function T2(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=e.stacktrace||e.stack||"",s=function(a){return a&&qce.test(a.message)?1:0}(e);try{var r=Wce,i=function(a,o){var l=function(u){var d=globalThis._posthogChunkIds;if(!d)return{};var f=Object.keys(d);return eS&&f.length===bM||(bM=f.length,eS=f.reduce((p,g)=>{Yb||(Yb={});var v=Yb[g];if(v)p[v[0]]=v[1];else for(var b=u(g),_=b.length-1;_>=0;_--){var x=b[_],w=x?.filename,y=d[g];if(w&&y){p[w]=y,Yb[g]=[w,y];break}}return p},{})),eS}(o);return a.forEach(u=>{u.filename&&(u.chunk_id=l[u.filename])}),a}(r(n,s),r);return i.slice(0,i.length-t)}catch{}return[]}var qce=/Minified React error #\d+;/i;function tS(e,t){var n,s,r=T2(e),i=(n=t?.handled)===null||n===void 0||n,a=(s=t?.synthetic)!==null&&s!==void 0&&s;return{$exception_list:[{type:t!=null&&t.overrideExceptionType?t.overrideExceptionType:e.name,value:function(o){var l=o.message;return l.error&&typeof l.error.message=="string"?String(l.error.message):String(l)}(e),stacktrace:{frames:r,type:"raw"},mechanism:{handled:i,synthetic:a}}],$exception_level:"error"}}function nS(e,t){var n,s,r,i=(n=t?.handled)===null||n===void 0||n,a=(s=t?.synthetic)===null||s===void 0||s,o={type:t!=null&&t.overrideExceptionType?t.overrideExceptionType:(r=t?.defaultExceptionType)!==null&&r!==void 0?r:"Error",value:e||t?.defaultExceptionMessage,mechanism:{handled:i,synthetic:a}};if(t!=null&&t.syntheticException){var l=T2(t.syntheticException,1);l.length&&(o.stacktrace={frames:l,type:"raw"})}return{$exception_list:[o],$exception_level:"error"}}function Kce(e){return pr(e)&&!qE(e)&&sce.indexOf(e)>=0}function Yce(e,t){var n,s,r=(n=t?.handled)===null||n===void 0||n,i=(s=t?.synthetic)===null||s===void 0||s,a=t!=null&&t.overrideExceptionType?t.overrideExceptionType:PU(e)?e.constructor.name:"Error",o="Non-Error 'exception' captured with keys: ".concat(function(d){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:40,p=Object.keys(d);if(p.sort(),!p.length)return"[object has no keys]";for(var g=p.length;g>0;g--){var v=p.slice(0,g).join(", ");if(!(v.length>f))return g===p.length||v.length<=f?v:"".concat(v.slice(0,f),"...")}return""}(e)),l={type:a,value:o,mechanism:{handled:r,synthetic:i}};if(t!=null&&t.syntheticException){var u=T2(t?.syntheticException,1);u.length&&(l.stacktrace={frames:u,type:"raw"})}return{$exception_list:[l],$exception_level:Kce(e.level)?e.level:"error"}}function Xce(e,t){var{error:n,event:s}=e,r={$exception_list:[]},i=n||s;if(J1(i)||function(g){return tx(g,"DOMException")}(i)){var a=i;if(function(g){return"stack"in g}(i))r=tS(i,t);else{var o=a.name||(J1(a)?"DOMError":"DOMException"),l=a.message?"".concat(o,": ").concat(a.message):o,u=J1(a)?"DOMError":"DOMException";r=nS(l,Ze(Ze({},t),{},{overrideExceptionType:u,defaultExceptionMessage:l}))}return"code"in a&&(r.$exception_DOMException_code="".concat(a.code)),r}if(function(g){return tx(g,"ErrorEvent")}(i)&&i.error)return tS(i.error,t);if(function(g){switch(Object.prototype.toString.call(g)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return MU(g,Error)}}(i))return tS(i,t);if(function(g){return tx(g,"Object")}(i)||PU(i))return Yce(i,t);if(Dt(n)&&pr(s)){var d="Error",f=s,p=s.match($ce);return p&&(d=p[1],f=p[2]),nS(f,Ze(Ze({},t),{},{overrideExceptionType:d,defaultExceptionMessage:f}))}return nS(i,t)}function Jx(e){var t,n;return((t=JSON.stringify(e,(n=[],function(s,r){if(Vs(r)){for(;n.length>0&&n[n.length-1]!==this;)n.pop();return n.includes(r)?"[Circular]":(n.push(r),r)}return r})))===null||t===void 0?void 0:t.length)||0}function aT(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:66060288e-1;if(e.size>=t&&e.data.length>1){var n=Math.floor(e.data.length/2),s=e.data.slice(0,n),r=e.data.slice(n);return[aT({size:Jx(s),data:s,sessionId:e.sessionId,windowId:e.windowId}),aT({size:Jx(r),data:r,sessionId:e.sessionId,windowId:e.windowId})].flatMap(i=>i)}return[e]}var hc=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(hc||{}),Mo=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(Mo||{}),oT="[SessionRecording]",lT="redacted",Xb={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","analytics.google.com"]},Qce=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],Jce=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Zce=["/s/","/e/","/i/"];function xM(e,t,n,s){if(ss(e))return e;var r=t?.["content-length"]||function(i){return new Blob([i]).size}(e);return pr(r)&&(r=parseInt(r)),r>n?oT+" ".concat(s," body too large to record (").concat(r," bytes)"):e}function wM(e,t){if(ss(e))return e;var n=e;return Up(n,!1)||(n=oT+" "+t+" body "+lT),fs(Jce,s=>{var r,i;(r=n)!==null&&r!==void 0&&r.length&&((i=n)===null||i===void 0?void 0:i.indexOf(s))!==-1&&(n=oT+" "+t+" body "+lT+" as might contain: "+s)}),n}var eue=(e,t)=>{var n,s,r,i={payloadSizeLimitBytes:Xb.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Xb.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...Xb.payloadHostDenyList]},a=e.session_recording.recordHeaders!==!1&&t.recordHeaders,o=e.session_recording.recordBody!==!1&&t.recordBody,l=e.capture_performance!==!1&&t.recordPerformance,u=(n=i,r=Math.min(1e6,(s=n.payloadSizeLimitBytes)!==null&&s!==void 0?s:1e6),p=>(p!=null&&p.requestBody&&(p.requestBody=xM(p.requestBody,p.requestHeaders,r,"Request")),p!=null&&p.responseBody&&(p.responseBody=xM(p.responseBody,p.responseHeaders,r,"Response")),p)),d=p=>{return u(((b,_)=>{var x,w=fp(b.name),y=_.indexOf("http")===0?(x=fp(_))===null||x===void 0?void 0:x.pathname:_;y==="/"&&(y="");var S=w?.pathname.replace(y||"","");if(!(w&&S&&Zce.some(C=>S.indexOf(C)===0)))return b})((v=(g=p).requestHeaders,ss(v)||fs(Object.keys(v??{}),b=>{Qce.includes(b.toLowerCase())&&(v[b]=lT)}),g),e.api_host));var g,v},f=Wo(e.session_recording.maskNetworkRequestFn);return f&&Wo(e.session_recording.maskCapturedNetworkRequestFn)&&Vt.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),f&&(e.session_recording.maskCapturedNetworkRequestFn=p=>{var g=e.session_recording.maskNetworkRequestFn({url:p.name});return Ze(Ze({},p),{},{name:g?.url})}),i.maskRequestFn=Wo(e.session_recording.maskCapturedNetworkRequestFn)?p=>{var g,v,b,_=d(p);return _&&(g=(v=(b=e.session_recording).maskCapturedNetworkRequestFn)===null||v===void 0?void 0:v.call(b,_))!==null&&g!==void 0?g:void 0}:p=>function(g){if(!Dt(g))return g.requestBody=wM(g.requestBody,"Request"),g.responseBody=wM(g.responseBody,"Response"),g}(d(p)),Ze(Ze(Ze({},Xb),i),{},{recordHeaders:a,recordBody:o,recordPerformance:l,recordInitialRequests:l})};function lo(e,t,n,s,r){return t>n&&(Vt.warn("min cannot be greater than max."),t=n),Bi(e)?e>n?(s&&Vt.warn(s+" cannot be greater than max: "+n+". Using max value instead."),n):e<t?(s&&Vt.warn(s+" cannot be less than min: "+t+". Using min value instead."),t):e:(s&&Vt.warn(s+" must be a number. using max or fallback. max: "+n+", fallback: "+r),lo(r||n,t,n,s))}let tue=class{constructor(t){var n,s,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};yt(this,"bucketSize",100),yt(this,"refillRate",10),yt(this,"mutationBuckets",{}),yt(this,"loggedTracker",{}),yt(this,"refillBuckets",()=>{Object.keys(this.mutationBuckets).forEach(i=>{this.mutationBuckets[i]=this.mutationBuckets[i]+this.refillRate,this.mutationBuckets[i]>=this.bucketSize&&delete this.mutationBuckets[i]})}),yt(this,"getNodeOrRelevantParent",i=>{var a=this.rrweb.mirror.getNode(i);if(a?.nodeName!=="svg"&&a instanceof Element){var o=a.closest("svg");if(o)return[this.rrweb.mirror.getId(o),o]}return[i,a]}),yt(this,"numberOfChanges",i=>{var a,o,l,u,d,f,p,g;return((a=(o=i.removes)===null||o===void 0?void 0:o.length)!==null&&a!==void 0?a:0)+((l=(u=i.attributes)===null||u===void 0?void 0:u.length)!==null&&l!==void 0?l:0)+((d=(f=i.texts)===null||f===void 0?void 0:f.length)!==null&&d!==void 0?d:0)+((p=(g=i.adds)===null||g===void 0?void 0:g.length)!==null&&p!==void 0?p:0)}),yt(this,"throttleMutations",i=>{if(i.type!==3||i.data.source!==0)return i;var a=i.data,o=this.numberOfChanges(a);a.attributes&&(a.attributes=a.attributes.filter(u=>{var d,f,p,[g,v]=this.getNodeOrRelevantParent(u.id);return this.mutationBuckets[g]===0?!1:(this.mutationBuckets[g]=(d=this.mutationBuckets[g])!==null&&d!==void 0?d:this.bucketSize,this.mutationBuckets[g]=Math.max(this.mutationBuckets[g]-1,0),this.mutationBuckets[g]===0&&(this.loggedTracker[g]||(this.loggedTracker[g]=!0,(f=(p=this.options).onBlockedNode)===null||f===void 0||f.call(p,g,v))),u)}));var l=this.numberOfChanges(a);return l!==0||o===l?i:void 0}),this.rrweb=t,this.options=r,this.refillRate=lo((n=this.options.refillRate)!==null&&n!==void 0?n:this.refillRate,0,100,"mutation throttling refill rate"),this.bucketSize=lo((s=this.options.bucketSize)!==null&&s!==void 0?s:this.bucketSize,0,100,"mutation throttling bucket size"),setInterval(()=>{this.refillBuckets()},1e3)}};var po=Uint8Array,aa=Uint16Array,Gp=Uint32Array,R2=new po([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),A2=new po([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),yM=new po([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),OU=function(e,t){for(var n=new aa(31),s=0;s<31;++s)n[s]=t+=1<<e[s-1];var r=new Gp(n[30]);for(s=1;s<30;++s)for(var i=n[s];i<n[s+1];++i)r[i]=i-n[s]<<5|s;return[n,r]},LU=OU(R2,2),nue=LU[0],cT=LU[1];nue[28]=258,cT[258]=28;for(var CM=OU(A2,0)[1],BU=new aa(32768),xs=0;xs<32768;++xs){var Nd=(43690&xs)>>>1|(21845&xs)<<1;Nd=(61680&(Nd=(52428&Nd)>>>2|(13107&Nd)<<2))>>>4|(3855&Nd)<<4,BU[xs]=((65280&Nd)>>>8|(255&Nd)<<8)>>>1}var t0=function(e,t,n){for(var s=e.length,r=0,i=new aa(t);r<s;++r)++i[e[r]-1];var a,o=new aa(t);for(r=0;r<t;++r)o[r]=o[r-1]+i[r-1]<<1;for(a=new aa(s),r=0;r<s;++r)a[r]=BU[o[e[r]-1]++]>>>15-e[r];return a},Ah=new po(288);for(xs=0;xs<144;++xs)Ah[xs]=8;for(xs=144;xs<256;++xs)Ah[xs]=9;for(xs=256;xs<280;++xs)Ah[xs]=7;for(xs=280;xs<288;++xs)Ah[xs]=8;var Zx=new po(32);for(xs=0;xs<32;++xs)Zx[xs]=5;var sue=t0(Ah,9),rue=t0(Zx,5),jU=function(e){return(e/8>>0)+(7&e&&1)},HU=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var s=new(e instanceof aa?aa:e instanceof Gp?Gp:po)(n-t);return s.set(e.subarray(t,n)),s},oc=function(e,t,n){n<<=7&t;var s=t/8>>0;e[s]|=n,e[s+1]|=n>>>8},tm=function(e,t,n){n<<=7&t;var s=t/8>>0;e[s]|=n,e[s+1]|=n>>>8,e[s+2]|=n>>>16},sS=function(e,t){for(var n=[],s=0;s<e.length;++s)e[s]&&n.push({s,f:e[s]});var r=n.length,i=n.slice();if(!r)return[new po(0),0];if(r==1){var a=new po(n[0].s+1);return a[n[0].s]=1,[a,1]}n.sort(function(C,k){return C.f-k.f}),n.push({s:-1,f:25001});var o=n[0],l=n[1],u=0,d=1,f=2;for(n[0]={s:-1,f:o.f+l.f,l:o,r:l};d!=r-1;)o=n[n[u].f<n[f].f?u++:f++],l=n[u!=d&&n[u].f<n[f].f?u++:f++],n[d++]={s:-1,f:o.f+l.f,l:o,r:l};var p=i[0].s;for(s=1;s<r;++s)i[s].s>p&&(p=i[s].s);var g=new aa(p+1),v=uT(n[d-1],g,0);if(v>t){s=0;var b=0,_=v-t,x=1<<_;for(i.sort(function(C,k){return g[k.s]-g[C.s]||C.f-k.f});s<r;++s){var w=i[s].s;if(!(g[w]>t))break;b+=x-(1<<v-g[w]),g[w]=t}for(b>>>=_;b>0;){var y=i[s].s;g[y]<t?b-=1<<t-g[y]++-1:++s}for(;s>=0&&b;--s){var S=i[s].s;g[S]==t&&(--g[S],++b)}v=t}return[new po(g),v]},uT=function(e,t,n){return e.s==-1?Math.max(uT(e.l,t,n+1),uT(e.r,t,n+1)):t[e.s]=n},SM=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new aa(++t),s=0,r=e[0],i=1,a=function(l){n[s++]=l},o=1;o<=t;++o)if(e[o]==r&&o!=t)++i;else{if(!r&&i>2){for(;i>138;i-=138)a(32754);i>2&&(a(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(a(r),--i;i>6;i-=6)a(8304);i>2&&(a(i-3<<5|8208),i=0)}for(;i--;)a(r);i=1,r=e[o]}return[n.subarray(0,s),t]},nm=function(e,t){for(var n=0,s=0;s<t.length;++s)n+=e[s]*t[s];return n},dT=function(e,t,n){var s=n.length,r=jU(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var i=0;i<s;++i)e[r+i+4]=n[i];return 8*(r+4+s)},kM=function(e,t,n,s,r,i,a,o,l,u,d){oc(t,d++,n),++r[256];for(var f=sS(r,15),p=f[0],g=f[1],v=sS(i,15),b=v[0],_=v[1],x=SM(p),w=x[0],y=x[1],S=SM(b),C=S[0],k=S[1],T=new aa(19),A=0;A<w.length;++A)T[31&w[A]]++;for(A=0;A<C.length;++A)T[31&C[A]]++;for(var F=sS(T,7),I=F[0],N=F[1],P=19;P>4&&!I[yM[P-1]];--P);var O,j,M,X,se=u+5<<3,ee=nm(r,Ah)+nm(i,Zx)+a,q=nm(r,p)+nm(i,b)+a+14+3*P+nm(T,I)+(2*T[16]+3*T[17]+7*T[18]);if(se<=ee&&se<=q)return dT(t,d,e.subarray(l,l+u));if(oc(t,d,1+(q<ee)),d+=2,q<ee){O=t0(p,g),j=p,M=t0(b,_),X=b;var ne=t0(I,N);for(oc(t,d,y-257),oc(t,d+5,k-1),oc(t,d+10,P-4),d+=14,A=0;A<P;++A)oc(t,d+3*A,I[yM[A]]);d+=3*P;for(var te=[w,C],L=0;L<2;++L){var B=te[L];for(A=0;A<B.length;++A){var G=31&B[A];oc(t,d,ne[G]),d+=I[G],G>15&&(oc(t,d,B[A]>>>5&127),d+=B[A]>>>12)}}}else O=sue,j=Ah,M=rue,X=Zx;for(A=0;A<o;++A)if(s[A]>255){G=s[A]>>>18&31,tm(t,d,O[G+257]),d+=j[G+257],G>7&&(oc(t,d,s[A]>>>23&31),d+=R2[G]);var H=31&s[A];tm(t,d,M[H]),d+=X[H],H>3&&(tm(t,d,s[A]>>>5&8191),d+=A2[H])}else tm(t,d,O[s[A]]),d+=j[s[A]];return tm(t,d,O[256]),d+j[256]},iue=new Gp([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),aue=function(){for(var e=new Gp(256),t=0;t<256;++t){for(var n=t,s=9;--s;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),oue=function(){var e=4294967295;return{p:function(t){for(var n=e,s=0;s<t.length;++s)n=aue[255&n^t[s]]^n>>>8;e=n},d:function(){return 4294967295^e}}},lue=function(e,t,n,s,r){return function(i,a,o,l,u,d){var f=i.length,p=new po(l+f+5*(1+Math.floor(f/7e3))+u),g=p.subarray(l,p.length-u),v=0;if(!a||f<8)for(var b=0;b<=f;b+=65535){var _=b+65535;_<f?v=dT(g,v,i.subarray(b,_)):(g[b]=d,v=dT(g,v,i.subarray(b,f)))}else{for(var x=iue[a-1],w=x>>>13,y=8191&x,S=(1<<o)-1,C=new aa(32768),k=new aa(S+1),T=Math.ceil(o/3),A=2*T,F=function(be){return(i[be]^i[be+1]<<T^i[be+2]<<A)&S},I=new Gp(25e3),N=new aa(288),P=new aa(32),O=0,j=0,M=(b=0,0),X=0,se=0;b<f;++b){var ee=F(b),q=32767&b,ne=k[ee];if(C[q]=ne,k[ee]=q,X<=b){var te=f-b;if((O>7e3||M>24576)&&te>423){v=kM(i,g,0,I,N,P,j,M,se,b-se,v),M=O=j=0,se=b;for(var L=0;L<286;++L)N[L]=0;for(L=0;L<30;++L)P[L]=0}var B=2,G=0,H=y,W=q-ne&32767;if(te>2&&ee==F(b-W))for(var de=Math.min(w,te)-1,J=Math.min(32767,b),Re=Math.min(258,te);W<=J&&--H&&q!=ne;){if(i[b+B]==i[b+B-W]){for(var le=0;le<Re&&i[b+le]==i[b+le-W];++le);if(le>B){if(B=le,G=W,le>de)break;var ge=Math.min(W,le-2),U=0;for(L=0;L<ge;++L){var we=b-W+L+32768&32767,Ee=we-C[we]+32768&32767;Ee>U&&(U=Ee,ne=we)}}}W+=(q=ne)-(ne=C[q])+32768&32767}if(G){I[M++]=268435456|cT[B]<<18|CM[G];var Ie=31&cT[B],pe=31&CM[G];j+=R2[Ie]+A2[pe],++N[257+Ie],++P[pe],X=b+B,++O}else I[M++]=i[b],++N[i[b]]}}v=kM(i,g,d,I,N,P,j,M,se,b-se,v)}return HU(p,0,l+jU(v)+u)}(e,t.level==null?6:t.level,t.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,s,!0)},hT=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},cue=function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&hT(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var s=0;s<=n.length;++s)e[s+10]=n.charCodeAt(s)}},uue=function(e){return 10+(e.filename&&e.filename.length+1||0)};function UU(e,t){t===void 0&&(t={});var n=oue(),s=e.length;n.p(e);var r=lue(e,t,uue(t),8),i=r.length;return cue(r,t),hT(r,i-8,n.d()),hT(r,i-4,s),r}function GU(e,t){var n=e.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(e);for(var s=new po(e.length+(e.length>>>1)),r=0,i=function(u){s[r++]=u},a=0;a<n;++a){if(r+5>s.length){var o=new po(r+8+(n-a<<1));o.set(s),s=o}var l=e.charCodeAt(a);l<128||t?i(l):l<2048?(i(192|l>>>6),i(128|63&l)):l>55295&&l<57344?(i(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++a))>>>18),i(128|l>>>12&63),i(128|l>>>6&63),i(128|63&l)):(i(224|l>>>12),i(128|l>>>6&63),i(128|63&l))}return HU(s,0,r)}function due(e,t){return function(n){for(var s=0,r=0;r<n.length;r++)s=(s<<5)-s+n.charCodeAt(r),s|=0;return Math.abs(s)}(e)%100<lo(100*t,0,100)}var Om="[SessionRecording]",hi=Ei(Om);function Qb(){var e,t;return hn==null||(e=hn.__PosthogExtensions__)===null||e===void 0||(t=e.rrweb)===null||t===void 0?void 0:t.record}var hue=3e5,fue=[Mo.MouseMove,Mo.MouseInteraction,Mo.Scroll,Mo.ViewportResize,Mo.Input,Mo.TouchMove,Mo.MediaInteraction,Mo.Drag],EM=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function Pd(e){return function(t,n){for(var s="",r=0;r<t.length;){var i=t[r++];s+=String.fromCharCode(i)}return s}(UU(GU(JSON.stringify(e))))}function TM(e){return e.type===hc.Custom&&e.data.tag==="sessionIdle"}function RM(e,t){return t.some(n=>n.matching==="regex"&&new RegExp(n.url).test(e))}let pue=class{get sessionIdleThresholdMilliseconds(){return this.instance.config.session_recording.session_idle_threshold_ms||3e5}get started(){return this._captureStarted}get sessionManager(){if(!this.instance.sessionManager)throw new Error(Om+" must be started with a valid sessionManager.");return this.instance.sessionManager}get fullSnapshotIntervalMillis(){var t,n;return this.triggerStatus==="trigger_pending"?6e4:(t=(n=this.instance.config.session_recording)===null||n===void 0?void 0:n.full_snapshot_interval_millis)!==null&&t!==void 0?t:hue}get isSampled(){var t=this.instance.get_property(Pm);return mc(t)?t:null}get sessionDuration(){var t,n,s=(t=this.buffer)===null||t===void 0?void 0:t.data[((n=this.buffer)===null||n===void 0?void 0:n.data.length)-1],{sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0);return s?s.timestamp-r:null}get isRecordingEnabled(){var t=!!this.instance.get_property(YE),n=!this.instance.config.disable_session_recording;return Ke&&t&&n}get isConsoleLogCaptureEnabled(){var t=!!this.instance.get_property(nM),n=this.instance.config.enable_recording_console_log;return n??t}get canvasRecording(){var t,n,s,r,i,a,o=this.instance.config.session_recording.captureCanvas,l=this.instance.get_property(iM),u=(t=(n=o?.recordCanvas)!==null&&n!==void 0?n:l?.enabled)!==null&&t!==void 0&&t,d=(s=(r=o?.canvasFps)!==null&&r!==void 0?r:l?.fps)!==null&&s!==void 0?s:4,f=(i=(a=o?.canvasQuality)!==null&&a!==void 0?a:l?.quality)!==null&&i!==void 0?i:.4;if(typeof f=="string"){var p=parseFloat(f);f=isNaN(p)?.4:p}return{enabled:u,fps:lo(d,0,12,"canvas recording fps",4),quality:lo(f,0,1,"canvas recording quality",.4)}}get networkPayloadCapture(){var t,n,s=this.instance.get_property(sM),r={recordHeaders:(t=this.instance.config.session_recording)===null||t===void 0?void 0:t.recordHeaders,recordBody:(n=this.instance.config.session_recording)===null||n===void 0?void 0:n.recordBody},i=r?.recordHeaders||s?.recordHeaders,a=r?.recordBody||s?.recordBody,o=Vs(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,l=!!(mc(o)?o:s?.capturePerformance);return i||a||l?{recordHeaders:i,recordBody:a,recordPerformance:l}:void 0}get masking(){var t,n,s,r,i,a,o=this.instance.get_property(rM),l={maskAllInputs:(t=this.instance.config.session_recording)===null||t===void 0?void 0:t.maskAllInputs,maskTextSelector:(n=this.instance.config.session_recording)===null||n===void 0?void 0:n.maskTextSelector,blockSelector:(s=this.instance.config.session_recording)===null||s===void 0?void 0:s.blockSelector},u=(r=l?.maskAllInputs)!==null&&r!==void 0?r:o?.maskAllInputs,d=(i=l?.maskTextSelector)!==null&&i!==void 0?i:o?.maskTextSelector,f=(a=l?.blockSelector)!==null&&a!==void 0?a:o?.blockSelector;return Dt(u)&&Dt(d)&&Dt(f)?void 0:{maskAllInputs:u==null||u,maskTextSelector:d,blockSelector:f}}get sampleRate(){var t=this.instance.get_property(aM);return Bi(t)?t:null}get minimumDuration(){var t=this.instance.get_property(oM);return Bi(t)?t:null}get status(){return this.receivedDecide?this.isRecordingEnabled?this.isSampled===!1?"disabled":this._urlBlocked?"paused":ss(this._linkedFlag)||this._linkedFlagSeen?this.triggerStatus==="trigger_pending"?"buffering":mc(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"buffering":"disabled":"buffering"}get urlTriggerStatus(){var t;return this._urlTriggers.length===0?"trigger_disabled":((t=this.instance)===null||t===void 0?void 0:t.get_property($1))===this.sessionId?"trigger_activated":"trigger_pending"}get eventTriggerStatus(){var t;return this._eventTriggers.length===0?"trigger_disabled":((t=this.instance)===null||t===void 0?void 0:t.get_property(q1))===this.sessionId?"trigger_activated":"trigger_pending"}get triggerStatus(){var t=this.eventTriggerStatus==="trigger_activated"||this.urlTriggerStatus==="trigger_activated",n=this.eventTriggerStatus==="trigger_pending"||this.urlTriggerStatus==="trigger_pending";return t?"trigger_activated":n?"trigger_pending":"trigger_disabled"}constructor(t){if(yt(this,"queuedRRWebEvents",[]),yt(this,"isIdle","unknown"),yt(this,"_linkedFlagSeen",!1),yt(this,"_lastActivityTimestamp",Date.now()),yt(this,"_linkedFlag",null),yt(this,"_removePageViewCaptureHook",void 0),yt(this,"_onSessionIdListener",void 0),yt(this,"_persistDecideOnSessionListener",void 0),yt(this,"_samplingSessionListener",void 0),yt(this,"_urlTriggers",[]),yt(this,"_urlBlocklist",[]),yt(this,"_urlBlocked",!1),yt(this,"_eventTriggers",[]),yt(this,"_removeEventTriggerCaptureHook",void 0),yt(this,"_forceAllowLocalhostNetworkCapture",!1),yt(this,"_onBeforeUnload",()=>{this._flushBuffer()}),yt(this,"_onOffline",()=>{this._tryAddCustomEvent("browser offline",{})}),yt(this,"_onOnline",()=>{this._tryAddCustomEvent("browser online",{})}),yt(this,"_onVisibilityChange",()=>{if(Ot!=null&&Ot.visibilityState){var r="window "+Ot.visibilityState;this._tryAddCustomEvent(r,{})}}),this.instance=t,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw hi.error("started without valid sessionManager"),new Error(Om+" started without valid sessionManager. This is a bug.");if(this.instance.config.__preview_experimental_cookieless_mode)throw new Error(Om+" cannot be used with __preview_experimental_cookieless_mode.");var{sessionId:n,windowId:s}=this.sessionManager.checkAndGetSessionAndWindowId();this.sessionId=n,this.windowId=s,this.buffer=this.clearBuffer(),this.sessionIdleThresholdMilliseconds>=this.sessionManager.sessionTimeoutMs&&hi.warn("session_idle_threshold_ms (".concat(this.sessionIdleThresholdMilliseconds,") is greater than the session timeout (").concat(this.sessionManager.sessionTimeoutMs,"). Session will never be detected as idle"))}startIfEnabledOrStop(t){this.isRecordingEnabled?(this._startCapture(t),er(Ke,"beforeunload",this._onBeforeUnload),er(Ke,"offline",this._onOffline),er(Ke,"online",this._onOnline),er(Ke,"visibilitychange",this._onVisibilityChange),this._setupSampling(),this._addEventTriggerListener(),ss(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this.instance.on("eventCaptured",n=>{try{if(n.event==="$pageview"){var s=n!=null&&n.properties.$current_url?this._maskUrl(n?.properties.$current_url):"";if(!s)return;this._tryAddCustomEvent("$pageview",{href:s})}}catch(r){hi.error("Could not add $pageview to rrweb session",r)}})),this._onSessionIdListener||(this._onSessionIdListener=this.sessionManager.onSessionId((n,s,r)=>{var i,a,o,l;r&&(this._tryAddCustomEvent("$session_id_change",{sessionId:n,windowId:s,changeReason:r}),(i=this.instance)===null||i===void 0||(a=i.persistence)===null||a===void 0||a.unregister(q1),(o=this.instance)===null||o===void 0||(l=o.persistence)===null||l===void 0||l.unregister($1))}))):this.stopRecording()}stopRecording(){var t,n,s,r;this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,Ke?.removeEventListener("beforeunload",this._onBeforeUnload),Ke?.removeEventListener("offline",this._onOffline),Ke?.removeEventListener("online",this._onOnline),Ke?.removeEventListener("visibilitychange",this._onVisibilityChange),this.clearBuffer(),clearInterval(this._fullSnapshotTimer),(t=this._removePageViewCaptureHook)===null||t===void 0||t.call(this),this._removePageViewCaptureHook=void 0,(n=this._removeEventTriggerCaptureHook)===null||n===void 0||n.call(this),this._removeEventTriggerCaptureHook=void 0,(s=this._onSessionIdListener)===null||s===void 0||s.call(this),this._onSessionIdListener=void 0,(r=this._samplingSessionListener)===null||r===void 0||r.call(this),this._samplingSessionListener=void 0,hi.info("stopped"))}_resetSampling(){var t;(t=this.instance.persistence)===null||t===void 0||t.unregister(Pm)}makeSamplingDecision(t){var n,s=this.sessionId!==t,r=this.sampleRate;if(Bi(r)){var i=this.isSampled,a=s||!mc(i),o=a?due(t,r):i;a&&(o?this._reportStarted("sampled"):hi.warn("Sample rate (".concat(r,") has determined that this sessionId (").concat(t,") will not be sent to the server.")),this._tryAddCustomEvent("samplingDecisionMade",{sampleRate:r,isSampled:o})),(n=this.instance.persistence)===null||n===void 0||n.register({[Pm]:o})}else this._resetSampling()}onRemoteConfig(t){var n,s,r,i,a,o;if(this._tryAddCustomEvent("$remote_config_received",t),this._persistRemoteConfig(t),this._linkedFlag=((n=t.sessionRecording)===null||n===void 0?void 0:n.linkedFlag)||null,(s=t.sessionRecording)!==null&&s!==void 0&&s.endpoint&&(this._endpoint=(o=t.sessionRecording)===null||o===void 0?void 0:o.endpoint),this._setupSampling(),!ss(this._linkedFlag)&&!this._linkedFlagSeen){var l=pr(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,u=pr(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags((d,f)=>{var p=Vs(f)&&l in f,g=u?f[l]===u:p;g&&this._reportStarted("linked_flag_matched",{linkedFlag:l,linkedVariant:u}),this._linkedFlagSeen=g})}(r=t.sessionRecording)!==null&&r!==void 0&&r.urlTriggers&&(this._urlTriggers=t.sessionRecording.urlTriggers),(i=t.sessionRecording)!==null&&i!==void 0&&i.urlBlocklist&&(this._urlBlocklist=t.sessionRecording.urlBlocklist),(a=t.sessionRecording)!==null&&a!==void 0&&a.eventTriggers&&(this._eventTriggers=t.sessionRecording.eventTriggers),this.receivedDecide=!0,this.startIfEnabledOrStop()}_setupSampling(){Bi(this.sampleRate)&&ss(this._samplingSessionListener)&&(this._samplingSessionListener=this.sessionManager.onSessionId(t=>{this.makeSamplingDecision(t)}))}_persistRemoteConfig(t){if(this.instance.persistence){var n,s=this.instance.persistence,r=()=>{var i,a,o,l,u,d,f,p,g,v=(i=t.sessionRecording)===null||i===void 0?void 0:i.sampleRate,b=ss(v)?null:parseFloat(v);ss(b)&&this._resetSampling();var _=(a=t.sessionRecording)===null||a===void 0?void 0:a.minimumDurationMilliseconds;s.register({[YE]:!!t.sessionRecording,[nM]:(o=t.sessionRecording)===null||o===void 0?void 0:o.consoleLogRecordingEnabled,[sM]:Ze({capturePerformance:t.capturePerformance},(l=t.sessionRecording)===null||l===void 0?void 0:l.networkPayloadCapture),[rM]:(u=t.sessionRecording)===null||u===void 0?void 0:u.masking,[iM]:{enabled:(d=t.sessionRecording)===null||d===void 0?void 0:d.recordCanvas,fps:(f=t.sessionRecording)===null||f===void 0?void 0:f.canvasFps,quality:(p=t.sessionRecording)===null||p===void 0?void 0:p.canvasQuality},[aM]:b,[oM]:Dt(_)?null:_,[lM]:(g=t.sessionRecording)===null||g===void 0?void 0:g.scriptConfig})};r(),(n=this._persistDecideOnSessionListener)===null||n===void 0||n.call(this),this._persistDecideOnSessionListener=this.sessionManager.onSessionId(r)}}log(t){var n,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"log";(n=this.instance.sessionRecording)===null||n===void 0||n.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:s,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}_startCapture(t){if(!Dt(Object.assign)&&!Dt(Array.from)&&!(this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut())){var n,s;this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),Qb()?this._onScriptLoaded():(n=hn.__PosthogExtensions__)===null||n===void 0||(s=n.loadExternalDependency)===null||s===void 0||s.call(n,this.instance,this.scriptName,r=>{if(r)return hi.error("could not load recorder",r);this._onScriptLoaded()}),hi.info("starting"),this.status==="active"&&this._reportStarted(t||"recording_initialized")}}get scriptName(){var t,n,s;return((t=this.instance)===null||t===void 0||(n=t.persistence)===null||n===void 0||(s=n.get_property(lM))===null||s===void 0?void 0:s.script)||"recorder"}isInteractiveEvent(t){var n;return t.type===3&&fue.indexOf((n=t.data)===null||n===void 0?void 0:n.source)!==-1}_updateWindowAndSessionIds(t){var n=this.isInteractiveEvent(t);n||this.isIdle||t.timestamp-this._lastActivityTimestamp>this.sessionIdleThresholdMilliseconds&&(this.isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this.sessionIdleThresholdMilliseconds,bufferLength:this.buffer.data.length,bufferSize:this.buffer.size}),this._flushBuffer());var s=!1;if(n&&(this._lastActivityTimestamp=t.timestamp,this.isIdle)){var r=this.isIdle==="unknown";this.isIdle=!1,r||(this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:t.type}),s=!0)}if(!this.isIdle){var{windowId:i,sessionId:a}=this.sessionManager.checkAndGetSessionAndWindowId(!n,t.timestamp),o=this.sessionId!==a,l=this.windowId!==i;this.windowId=i,this.sessionId=a,o||l?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):s&&this._scheduleFullSnapshot()}}_tryRRWebMethod(t){try{return t.rrwebMethod(),!0}catch(n){return this.queuedRRWebEvents.length<10?this.queuedRRWebEvents.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt++,rrwebMethod:t.rrwebMethod}):hi.warn("could not emit queued rrweb event.",n,t),!1}}_tryAddCustomEvent(t,n){return this._tryRRWebMethod(EM(()=>Qb().addCustomEvent(t,n)))}_tryTakeFullSnapshot(){return this._tryRRWebMethod(EM(()=>Qb().takeFullSnapshot()))}_onScriptLoaded(){var t,n,s,r,i={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},a=this.instance.config.session_recording;for(var[o,l]of Object.entries(a||{}))o in i&&(o==="maskInputOptions"?i.maskInputOptions=Ze({password:!0},l):i[o]=l);this.canvasRecording&&this.canvasRecording.enabled&&(i.recordCanvas=!0,i.sampling={canvas:this.canvasRecording.fps},i.dataURLOptions={type:"image/webp",quality:this.canvasRecording.quality}),this.masking&&(i.maskAllInputs=(n=this.masking.maskAllInputs)===null||n===void 0||n,i.maskTextSelector=(s=this.masking.maskTextSelector)!==null&&s!==void 0?s:void 0,i.blockSelector=(r=this.masking.blockSelector)!==null&&r!==void 0?r:void 0);var u=Qb();if(u){this.mutationRateLimiter=(t=this.mutationRateLimiter)!==null&&t!==void 0?t:new tue(u,{refillRate:this.instance.config.session_recording.__mutationRateLimiterRefillRate,bucketSize:this.instance.config.session_recording.__mutationRateLimiterBucketSize,onBlockedNode:(f,p)=>{var g="Too many mutations on node '".concat(f,"'. Rate limiting. This could be due to SVG animations or something similar");hi.info(g,{node:p}),this.log(Om+" "+g,"warn")}});var d=this._gatherRRWebPlugins();this.stopRrweb=u(Ze({emit:f=>{this.onRRwebEmit(f)},plugins:d},i)),this._lastActivityTimestamp=Date.now(),this.isIdle=mc(this.isIdle)?this.isIdle:"unknown",this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:i,activePlugins:d.map(f=>f?.name)}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}else hi.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),this.isIdle!==!0){var t=this.fullSnapshotIntervalMillis;t&&(this._fullSnapshotTimer=setInterval(()=>{this._tryTakeFullSnapshot()},t))}}_gatherRRWebPlugins(){var t,n,s,r,i=[],a=(t=hn.__PosthogExtensions__)===null||t===void 0||(n=t.rrwebPlugins)===null||n===void 0?void 0:n.getRecordConsolePlugin;a&&this.isConsoleLogCaptureEnabled&&i.push(a());var o=(s=hn.__PosthogExtensions__)===null||s===void 0||(r=s.rrwebPlugins)===null||r===void 0?void 0:r.getRecordNetworkPlugin;return this.networkPayloadCapture&&Wo(o)&&(!xce.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?i.push(o(eue(this.instance.config,this.networkPayloadCapture))):hi.info("NetworkCapture not started because we are on localhost.")),i}onRRwebEmit(t){var n;if(this._processQueuedEvents(),t&&Vs(t)){if(t.type===hc.Meta){var s=this._maskUrl(t.data.href);if(this._lastHref=s,!s)return;t.data.href=s}else this._pageViewFallBack();if(this._checkUrlTriggerConditions(),!this._urlBlocked||function(f){return f.type===hc.Custom&&f.data.tag==="recording paused"}(t)){t.type===hc.FullSnapshot&&this._scheduleFullSnapshot(),t.type===hc.FullSnapshot&&this.triggerStatus==="trigger_pending"&&this.clearBuffer();var r=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(t):t;if(r){var i=function(f){var p=f;if(p&&Vs(p)&&p.type===6&&Vs(p.data)&&p.data.plugin==="rrweb/console@1"){p.data.payload.payload.length>10&&(p.data.payload.payload=p.data.payload.payload.slice(0,10),p.data.payload.payload.push("...[truncated]"));for(var g=[],v=0;v<p.data.payload.payload.length;v++)p.data.payload.payload[v]&&p.data.payload.payload[v].length>2e3?g.push(p.data.payload.payload[v].slice(0,2e3)+"...[truncated]"):g.push(p.data.payload.payload[v]);return p.data.payload.payload=g,f}return f}(r);if(this._updateWindowAndSessionIds(i),this.isIdle!==!0||TM(i)){if(TM(i)){var a=i.data.payload;if(a){var o=a.lastActivityTimestamp,l=a.threshold;i.timestamp=o+l}}var u=(n=this.instance.config.session_recording.compress_events)===null||n===void 0||n?function(f){if(Jx(f)<1024)return f;try{if(f.type===hc.FullSnapshot)return Ze(Ze({},f),{},{data:Pd(f.data),cv:"2024-10"});if(f.type===hc.IncrementalSnapshot&&f.data.source===Mo.Mutation)return Ze(Ze({},f),{},{cv:"2024-10",data:Ze(Ze({},f.data),{},{texts:Pd(f.data.texts),attributes:Pd(f.data.attributes),removes:Pd(f.data.removes),adds:Pd(f.data.adds)})});if(f.type===hc.IncrementalSnapshot&&f.data.source===Mo.StyleSheetRule)return Ze(Ze({},f),{},{cv:"2024-10",data:Ze(Ze({},f.data),{},{adds:f.data.adds?Pd(f.data.adds):void 0,removes:f.data.removes?Pd(f.data.removes):void 0})})}catch(p){hi.error("could not compress event - will use uncompressed event",p)}return f}(i):i,d={$snapshot_bytes:Jx(u),$snapshot_data:u,$session_id:this.sessionId,$window_id:this.windowId};this.status!=="disabled"?this._captureSnapshotBuffered(d):this.clearBuffer()}}}}}_pageViewFallBack(){if(!this.instance.config.capture_pageview&&Ke){var t=this._maskUrl(Ke.location.href);this._lastHref!==t&&(this._tryAddCustomEvent("$url_changed",{href:t}),this._lastHref=t)}}_processQueuedEvents(){if(this.queuedRRWebEvents.length){var t=[...this.queuedRRWebEvents];this.queuedRRWebEvents=[],t.forEach(n=>{Date.now()-n.enqueuedAt<=2e3&&this._tryRRWebMethod(n)})}}_maskUrl(t){var n=this.instance.config.session_recording;if(n.maskNetworkRequestFn){var s,r={url:t};return(s=r=n.maskNetworkRequestFn(r))===null||s===void 0?void 0:s.url}return t}clearBuffer(){return this.buffer={size:0,data:[],sessionId:this.sessionId,windowId:this.windowId},this.buffer}_flushBuffer(){this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0);var t=this.minimumDuration,n=this.sessionDuration,s=Bi(n)&&n>=0,r=Bi(t)&&s&&n<t;return this.status==="buffering"||this.status==="paused"||this.status==="disabled"||r?(this.flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3),this.buffer):(this.buffer.data.length>0&&aT(this.buffer).forEach(i=>{this._captureSnapshot({$snapshot_bytes:i.size,$snapshot_data:i.data,$session_id:i.sessionId,$window_id:i.windowId,$lib:"web",$lib_version:pc.LIB_VERSION})}),this.clearBuffer())}_captureSnapshotBuffered(t){var n,s=2+(((n=this.buffer)===null||n===void 0?void 0:n.data.length)||0);!this.isIdle&&(this.buffer.size+t.$snapshot_bytes+s>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=t.$snapshot_bytes,this.buffer.data.push(t.$snapshot_data),this.flushBufferTimer||this.isIdle||(this.flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3))}_captureSnapshot(t){this.instance.capture("$snapshot",t,{_url:this.instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}_checkUrlTriggerConditions(){if(Ke!==void 0&&Ke.location.href){var t=Ke.location.href,n=this._urlBlocked,s=RM(t,this._urlBlocklist);s&&!n?this._pauseRecording():!s&&n&&this._resumeRecording(),RM(t,this._urlTriggers)&&this._activateTrigger("url")}}_activateTrigger(t){var n,s;this.triggerStatus==="trigger_pending"&&((n=this.instance)===null||n===void 0||(s=n.persistence)===null||s===void 0||s.register({[t==="url"?$1:q1]:this.sessionId}),this._flushBuffer(),this._reportStarted(t+"_trigger_matched"))}_pauseRecording(){this._urlBlocked||(this._urlBlocked=!0,clearInterval(this._fullSnapshotTimer),hi.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){this._urlBlocked&&(this._urlBlocked=!1,this._tryTakeFullSnapshot(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),hi.info("recording resumed"))}_addEventTriggerListener(){this._eventTriggers.length!==0&&ss(this._removeEventTriggerCaptureHook)&&(this._removeEventTriggerCaptureHook=this.instance.on("eventCaptured",t=>{try{this._eventTriggers.includes(t.event)&&this._activateTrigger("event")}catch(n){hi.error("Could not activate event trigger",n)}}))}overrideLinkedFlag(){this._linkedFlagSeen=!0,this._tryTakeFullSnapshot(),this._reportStarted("linked_flag_overridden")}overrideSampling(){var t;(t=this.instance.persistence)===null||t===void 0||t.register({[Pm]:!0}),this._tryTakeFullSnapshot(),this._reportStarted("sampling_overridden")}overrideTrigger(t){this._activateTrigger(t)}_reportStarted(t,n){this.instance.register_for_session({$session_recording_start_reason:t}),hi.info(t.replace("_"," "),n),En(["recording_initialized","session_id_changed"],t)||this._tryAddCustomEvent(t,n)}get sdkDebugProperties(){var{sessionStartTimestamp:t}=this.sessionManager.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this.buffer.data.length,$sdk_debug_replay_internal_buffer_size:this.buffer.size,$sdk_debug_current_session_duration:this.sessionDuration,$sdk_debug_session_start:t}}};var rS=Ei("[SegmentIntegration]");function gue(e,t){var n=e.config.segment;if(!n)return t();(function(s,r){var i=s.config.segment;if(!i)return r();var a=l=>{var u=()=>l.anonymousId()||Pu();s.config.get_device_id=u,l.id()&&(s.register({distinct_id:l.id(),$device_id:u()}),s.persistence.set_property(dc,"identified")),r()},o=i.user();"then"in o&&Wo(o.then)?o.then(l=>a(l)):a(o)})(e,()=>{n.register((s=>{Promise&&Promise.resolve||rS.warn("This browser does not have Promise support, and can not use the segment integration");var r=(i,a)=>{var o;if(!a)return i;i.event.userId||i.event.anonymousId===s.get_distinct_id()||(rS.info("No userId set, resetting PostHog"),s.reset()),i.event.userId&&i.event.userId!==s.get_distinct_id()&&(rS.info("UserId set, identifying with PostHog"),s.identify(i.event.userId));var l=s._calculate_event_properties(a,(o=i.event.properties)!==null&&o!==void 0?o:{},new Date);return i.event.properties=Object.assign({},l,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:i=>r(i,i.event.event),page:i=>r(i,"$pageview"),identify:i=>r(i,"$identify"),screen:i=>r(i,"$screen")}})(e)).then(()=>{t()})})}var VU="posthog-js";function WU(e){var{organization:t,projectId:n,prefix:s,severityAllowList:r=["error"]}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return i=>{var a,o,l,u,d;if(!(r==="*"||r.includes(i.level))||!e.__loaded)return i;i.tags||(i.tags={});var f=e.requestRouter.endpointFor("ui","/project/".concat(e.config.token,"/person/").concat(e.get_distinct_id()));i.tags["PostHog Person URL"]=f,e.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p=((a=i.exception)===null||a===void 0?void 0:a.values)||[],g=p.map(b=>Ze(Ze({},b),{},{stacktrace:b.stacktrace?Ze(Ze({},b.stacktrace),{},{type:"raw",frames:(b.stacktrace.frames||[]).map(_=>Ze(Ze({},_),{},{platform:"web:javascript"}))}):void 0})),v={$exception_message:((o=p[0])===null||o===void 0?void 0:o.value)||i.message,$exception_type:(l=p[0])===null||l===void 0?void 0:l.type,$exception_personURL:f,$exception_level:i.level,$exception_list:g,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:((u=p[0])===null||u===void 0?void 0:u.value)||i.message,$sentry_exception_type:(d=p[0])===null||d===void 0?void 0:d.type,$sentry_tags:i.tags};return t&&n&&(v.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+n+"&query="+i.event_id),e.exceptions.sendExceptionEvent(v),i}}let mue=class{constructor(t,n,s,r,i){this.name=VU,this.setupOnce=function(a){a(WU(t,{organization:n,projectId:s,prefix:r,severityAllowList:i}))}}};var fc,vue=Ke!=null&&Ke.location?Qx(Ke.location.hash,"__posthog")||Qx(location.hash,"state"):null,AM="_postHogToolbarParams",FM=Ei("[Toolbar]");(function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"})(fc||(fc={}));class bue{constructor(t){this.instance=t}setToolbarState(t){hn.ph_toolbar_state=t}getToolbarState(){var t;return(t=hn.ph_toolbar_state)!==null&&t!==void 0?t:fc.UNINITIALIZED}maybeLoadToolbar(){var t,n,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(!Ke||!Ot)return!1;s=(t=s)!==null&&t!==void 0?t:Ke.location,i=(n=i)!==null&&n!==void 0?n:Ke.history;try{if(!r){try{Ke.localStorage.setItem("test","test"),Ke.localStorage.removeItem("test")}catch{return!1}r=Ke?.localStorage}var a,o=vue||Qx(s.hash,"__posthog")||Qx(s.hash,"state"),l=o?QP(()=>JSON.parse(atob(decodeURIComponent(o))))||QP(()=>JSON.parse(decodeURIComponent(o))):null;return l&&l.action==="ph_authorize"?((a=l).source="url",a&&Object.keys(a).length>0&&(l.desiredHash?s.hash=l.desiredHash:i?i.replaceState(i.state,"",s.pathname+s.search):s.hash="")):((a=JSON.parse(r.getItem(AM)||"{}")).source="localstorage",delete a.userIntent),!(!a.token||this.instance.config.token!==a.token)&&(this.loadToolbar(a),!0)}catch{return!1}}_callLoadToolbar(t){var n=hn.ph_load_toolbar||hn.ph_load_editor;!ss(n)&&Wo(n)?n(t,this.instance):FM.warn("No toolbar load function found")}loadToolbar(t){var n=!(Ot==null||!Ot.getElementById(xU));if(!Ke||n)return!1;var s=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=Ze(Ze({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(Ke.localStorage.setItem(AM,JSON.stringify(Ze(Ze({},r),{},{source:void 0}))),this.getToolbarState()===fc.LOADED)this._callLoadToolbar(r);else if(this.getToolbarState()===fc.UNINITIALIZED){var i,a;this.setToolbarState(fc.LOADING),(i=hn.__PosthogExtensions__)===null||i===void 0||(a=i.loadExternalDependency)===null||a===void 0||a.call(i,this.instance,"toolbar",o=>{if(o)return FM.error("[Toolbar] Failed to load",o),void this.setToolbarState(fc.UNINITIALIZED);this.setToolbarState(fc.LOADED),this._callLoadToolbar(r)}),er(Ke,"turbolinks:load",()=>{this.setToolbarState(fc.UNINITIALIZED),this.loadToolbar(r)})}return!0}_loadEditor(t){return this.loadToolbar(t)}maybeLoadEditor(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;return this.maybeLoadToolbar(t,n,s)}}var _ue=Ei("[TracingHeaders]");class xue{constructor(t){yt(this,"_restoreXHRPatch",void 0),yt(this,"_restoreFetchPatch",void 0),yt(this,"_startCapturing",()=>{var n,s,r,i;Dt(this._restoreXHRPatch)&&((n=hn.__PosthogExtensions__)===null||n===void 0||(s=n.tracingHeadersPatchFns)===null||s===void 0||s._patchXHR(this.instance.sessionManager)),Dt(this._restoreFetchPatch)&&((r=hn.__PosthogExtensions__)===null||r===void 0||(i=r.tracingHeadersPatchFns)===null||i===void 0||i._patchFetch(this.instance.sessionManager))}),this.instance=t}_loadScript(t){var n,s,r;(n=hn.__PosthogExtensions__)!==null&&n!==void 0&&n.tracingHeadersPatchFns&&t(),(s=hn.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"tracing-headers",i=>{if(i)return _ue.error("failed to load script",i);t()})}startIfEnabledOrStop(){var t,n;this.instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):((t=this._restoreXHRPatch)===null||t===void 0||t.call(this),(n=this._restoreFetchPatch)===null||n===void 0||n.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}var fu=Ei("[Web Vitals]"),DM=9e5;class wue{constructor(t){var n;yt(this,"_enabledServerSide",!1),yt(this,"_initialized",!1),yt(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),yt(this,"_flushToCapture",()=>{clearTimeout(this._delayedFlushTimer),this.buffer.metrics.length!==0&&(this.instance.capture("$web_vitals",this.buffer.metrics.reduce((s,r)=>Ze(Ze({},s),{},{["$web_vitals_".concat(r.name,"_event")]:Ze({},r),["$web_vitals_".concat(r.name,"_value")]:r.value}),{})),this.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})}),yt(this,"_addToBuffer",s=>{var r,i=(r=this.instance.sessionManager)===null||r===void 0?void 0:r.checkAndGetSessionAndWindowId(!0);if(Dt(i))fu.error("Could not read session ID. Dropping metrics!");else{this.buffer=this.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var a=this._currentURL();Dt(a)||(ss(s?.name)||ss(s?.value)?fu.error("Invalid metric received",s):this._maxAllowedValue&&s.value>=this._maxAllowedValue?fu.error("Ignoring metric with value >= "+this._maxAllowedValue,s):(this.buffer.url!==a&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),Dt(this.buffer.url)&&(this.buffer.url=a),this.buffer.firstMetricTimestamp=Dt(this.buffer.firstMetricTimestamp)?Date.now():this.buffer.firstMetricTimestamp,s.attribution&&s.attribution.interactionTargetElement&&(s.attribution.interactionTargetElement=void 0),this.buffer.metrics.push(Ze(Ze({},s),{},{$current_url:a,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()))}}),yt(this,"_startCapturing",()=>{var s,r,i,a,o=hn.__PosthogExtensions__;Dt(o)||Dt(o.postHogWebVitalsCallbacks)||({onLCP:s,onCLS:r,onFCP:i,onINP:a}=o.postHogWebVitalsCallbacks),s&&r&&i&&a?(this.allowedMetrics.indexOf("LCP")>-1&&s(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&a(this._addToBuffer.bind(this)),this._initialized=!0):fu.error("web vitals callbacks not loaded - not starting")}),this.instance=t,this._enabledServerSide=!((n=this.instance.persistence)===null||n===void 0||!n.props[eM]),this.startIfEnabled()}get allowedMetrics(){var t,n,s=Vs(this.instance.config.capture_performance)?(t=this.instance.config.capture_performance)===null||t===void 0?void 0:t.web_vitals_allowed_metrics:void 0;return Dt(s)?((n=this.instance.persistence)===null||n===void 0?void 0:n.props[tM])||["CLS","FCP","INP","LCP"]:s}get flushToCaptureTimeoutMs(){return(Vs(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){var t=Vs(this.instance.config.capture_performance)&&Bi(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:DM;return 0<t&&t<=6e4?DM:t}get isEnabled(){var t=sa?.protocol;if(t!=="http:"&&t!=="https:")return fu.info("Web Vitals are disabled on non-http/https protocols"),!1;var n=Vs(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:mc(this.instance.config.capture_performance)?this.instance.config.capture_performance:void 0;return mc(n)?n:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(fu.info("enabled, starting..."),this.loadScript(this._startCapturing))}onRemoteConfig(t){var n=Vs(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=Vs(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this.instance.persistence&&(this.instance.persistence.register({[eM]:n}),this.instance.persistence.register({[tM]:s})),this._enabledServerSide=n,this.startIfEnabled()}loadScript(t){var n,s,r;(n=hn.__PosthogExtensions__)!==null&&n!==void 0&&n.postHogWebVitalsCallbacks&&t(),(s=hn.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"web-vitals",i=>{i?fu.error("failed to load script",i):t()})}_currentURL(){var t=Ke?Ke.location.href:void 0;return t||fu.error("Could not determine current URL"),t}}var yue=Ei("[Heatmaps]");function IM(e){return Vs(e)&&"clientX"in e&&"clientY"in e&&Bi(e.clientX)&&Bi(e.clientY)}class Cue{constructor(t){var n;yt(this,"rageclicks",new DU),yt(this,"_enabledServerSide",!1),yt(this,"_initialized",!1),yt(this,"_flushInterval",null),this.instance=t,this._enabledServerSide=!((n=this.instance.persistence)===null||n===void 0||!n.props[KE])}get flushIntervalMilliseconds(){var t=5e3;return Vs(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(t=this.instance.config.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Dt(this.instance.config.capture_heatmaps)?Dt(this.instance.config.enable_heatmaps)?this._enabledServerSide:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;yue.info("starting..."),this._setupListeners(),this._flushInterval=setInterval(this.flush.bind(this),this.flushIntervalMilliseconds)}else{var t,n;clearInterval((t=this._flushInterval)!==null&&t!==void 0?t:void 0),(n=this.deadClicksCapture)===null||n===void 0||n.stop(),this.getAndClearBuffer()}}onRemoteConfig(t){var n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[KE]:n}),this._enabledServerSide=n,this.startIfEnabled()}getAndClearBuffer(){var t=this.buffer;return this.buffer=void 0,t}_onDeadClick(t){this._onClick(t.originalEvent,"deadclick")}_setupListeners(){Ke&&Ot&&(er(Ke,"beforeunload",this.flush.bind(this)),er(Ot,"click",t=>this._onClick(t||Ke?.event),{capture:!0}),er(Ot,"mousemove",t=>this._onMouseMove(t||Ke?.event),{capture:!0}),this.deadClicksCapture=new NU(this.instance,Oce,this._onDeadClick.bind(this)),this.deadClicksCapture.startIfEnabled(),this._initialized=!0)}_getProperties(t,n){var s=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),a=function(o,l,u){for(var d=o;d&&tC(d)&&!Vu(d,"body");){if(d===u)return!1;if(En(l,Ke?.getComputedStyle(d).position))return!0;d=kU(d)}return!1}(SU(t),["fixed","sticky"],i);return{x:t.clientX+(a?0:r),y:t.clientY+(a?0:s),target_fixed:a,type:n}}_onClick(t){var n,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"click";if(!uM(t.target)&&IM(t)){var r=this._getProperties(t,s);(n=this.rageclicks)!==null&&n!==void 0&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this._capture(Ze(Ze({},r),{},{type:"rageclick"})),this._capture(r)}}_onMouseMove(t){!uM(t.target)&&IM(t)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(t,"mousemove"))},500))}_capture(t){if(Ke){var n=Ke.location.href;this.buffer=this.buffer||{},this.buffer[n]||(this.buffer[n]=[]),this.buffer[n].push(t)}}flush(){this.buffer&&!np(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class Sue{constructor(t){this._instance=t}doPageView(t,n){var s,r=this._previousPageViewProperties(t,n);return this._currentPageview={pathname:(s=Ke?.location.pathname)!==null&&s!==void 0?s:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var n;return this._previousPageViewProperties(t,(n=this._currentPageview)===null||n===void 0?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this._currentPageview)===null||t===void 0?void 0:t.pageViewId}}_previousPageViewProperties(t,n){var s=this._currentPageview;if(!s)return{$pageview_id:n};var r={$pageview_id:n,$prev_pageview_id:s.pageViewId},i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:o,maxScrollY:l,maxContentHeight:u,lastContentY:d,maxContentY:f}=i;if(!(Dt(a)||Dt(o)||Dt(l)||Dt(u)||Dt(d)||Dt(f))){a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),u=Math.ceil(u),d=Math.ceil(d),f=Math.ceil(f);var p=a<=1?1:lo(o/a,0,1),g=a<=1?1:lo(l/a,0,1),v=u<=1?1:lo(d/u,0,1),b=u<=1?1:lo(f/u,0,1);r=Js(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:p,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:g,$prev_pageview_last_content:d,$prev_pageview_last_content_percentage:v,$prev_pageview_max_content:f,$prev_pageview_max_content_percentage:b})}}return s.pathname&&(r.$prev_pageview_pathname=s.pathname),s.timestamp&&(r.$prev_pageview_duration=(t.getTime()-s.timestamp.getTime())/1e3),r}}let kue=class{constructor(t){this.instance=t}sendExceptionEvent(t){this.instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent"})}};var go="Mobile",ew="iOS",Rl="Android",ev="Tablet",zU=Rl+" "+ev,$U="iPad",qU="Apple",KU=qU+" Watch",tv="Safari",Vp="BlackBerry",YU="Samsung",XU=YU+"Browser",QU=YU+" Internet",Fh="Chrome",Eue=Fh+" OS",JU=Fh+" "+ew,F2="Internet Explorer",ZU=F2+" "+go,D2="Opera",Tue=D2+" Mini",I2="Edge",eG="Microsoft "+I2,pp="Firefox",tG=pp+" "+ew,nv="Nintendo",sv="PlayStation",gp="Xbox",nG=Rl+" "+go,sG=go+" "+tv,Lm="Windows",fT=Lm+" Phone",NM="Nokia",pT="Ouya",rG="Generic",Rue=rG+" "+go.toLowerCase(),iG=rG+" "+ev.toLowerCase(),gT="Konqueror",Pi="(\\d+(\\.\\d+)?)",iS=new RegExp("Version/"+Pi),Aue=new RegExp(gp,"i"),Fue=new RegExp(sv+" \\w+","i"),Due=new RegExp(nv+" \\w+","i"),N2=new RegExp(Vp+"|PlayBook|BB10","i"),Iue={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},mT,Nue=(e,t)=>t&&En(t,qU)||function(n){return En(n,tv)&&!En(n,Fh)&&!En(n,Rl)}(e),PM=function(e,t){return t=t||"",En(e," OPR/")&&En(e,"Mini")?Tue:En(e," OPR/")?D2:N2.test(e)?Vp:En(e,"IE"+go)||En(e,"WPDesktop")?ZU:En(e,XU)?QU:En(e,I2)||En(e,"Edg/")?eG:En(e,"FBIOS")?"Facebook "+go:En(e,"UCWEB")||En(e,"UCBrowser")?"UC Browser":En(e,"CriOS")?JU:En(e,"CrMo")||En(e,Fh)?Fh:En(e,Rl)&&En(e,tv)?nG:En(e,"FxiOS")?tG:En(e.toLowerCase(),gT.toLowerCase())?gT:Nue(e,t)?En(e,go)?sG:tv:En(e,pp)?pp:En(e,"MSIE")||En(e,"Trident/")?F2:En(e,"Gecko")?pp:""},Pue={[ZU]:[new RegExp("rv:"+Pi)],[eG]:[new RegExp(I2+"?\\/"+Pi)],[Fh]:[new RegExp("("+Fh+"|CrMo)\\/"+Pi)],[JU]:[new RegExp("CriOS\\/"+Pi)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Pi)],[tv]:[iS],[sG]:[iS],[D2]:[new RegExp("(Opera|OPR)\\/"+Pi)],[pp]:[new RegExp(pp+"\\/"+Pi)],[tG]:[new RegExp("FxiOS\\/"+Pi)],[gT]:[new RegExp("Konqueror[:/]?"+Pi,"i")],[Vp]:[new RegExp(Vp+" "+Pi),iS],[nG]:[new RegExp("android\\s"+Pi,"i")],[QU]:[new RegExp(XU+"\\/"+Pi)],[F2]:[new RegExp("(rv:|MSIE )"+Pi)],Mozilla:[new RegExp("rv:"+Pi)]},MM=[[new RegExp(gp+"; "+gp+" (.*?)[);]","i"),e=>[gp,e&&e[1]||""]],[new RegExp(nv,"i"),[nv,""]],[new RegExp(sv,"i"),[sv,""]],[N2,[Vp,""]],[new RegExp(Lm,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[fT,""];if(new RegExp(go).test(t)&&!/IEMobile\b/.test(t))return[Lm+" "+go,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var s=n[1],r=Iue[s]||"";return/arm/i.test(t)&&(r="RT"),[Lm,r]}return[Lm,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[ew,t.join(".")]}return[ew,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Dt(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Rl+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Rl+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[Rl,t.join(".")]}return[Rl,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];if(e&&e[1]){var n=[e[1],e[2],e[3]||"0"];t[1]=n.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Eue,""]],[/Linux|debian/i,["Linux",""]]],OM=function(e){return Due.test(e)?nv:Fue.test(e)?sv:Aue.test(e)?gp:new RegExp(pT,"i").test(e)?pT:new RegExp("("+fT+"|WPDesktop)","i").test(e)?fT:/iPad/.test(e)?$U:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?KU:N2.test(e)?Vp:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(NM,"i").test(e)?NM:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?!new RegExp(go).test(e)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)?/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Rl:zU:Rl:new RegExp("(pda|"+go+")","i").test(e)?Rue:new RegExp(ev,"i").test(e)&&!new RegExp(ev+" pc","i").test(e)?iG:""},Jb="https?://(.*)",nx=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","irclid","_kx"],Mue=J_(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],nx),aS="<masked>",Fs={campaignParams:function(){var{customTrackedParams:e,maskPersonalDataProperties:t,customPersonalDataProperties:n}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!Ot)return{};var s=t?J_([],nx,n||[]):[];return this._campaignParamsFromUrl(K1(Ot.URL,s,aS),e)},_campaignParamsFromUrl:function(e,t){var n=Mue.concat(t||[]),s={};return fs(n,function(r){var i=Xx(e,r);s[r]=i||null}),s},_searchEngine:function(e){return e?e.search(Jb+"google.([^/?]*)")===0?"google":e.search(Jb+"bing.com")===0?"bing":e.search(Jb+"yahoo.com")===0?"yahoo":e.search(Jb+"duckduckgo.com")===0?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){var t=Fs._searchEngine(e),n=t!="yahoo"?"q":"p",s={};if(!hd(t)){s.$search_engine=t;var r=Ot?Xx(Ot.referrer,n):"";r.length&&(s.ph_keyword=r)}return s},searchInfo:function(){var e=Ot?.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:PM,browserVersion:function(e,t){var n=PM(e,t),s=Pue[n];if(Dt(s))return null;for(var r=0;r<s.length;r++){var i=s[r],a=e.match(i);if(a)return parseFloat(a[a.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},browserLanguagePrefix:function(){var e=this.browserLanguage();return typeof e=="string"?e.split("-")[0]:void 0},os:function(e){for(var t=0;t<MM.length;t++){var[n,s]=MM[t],r=n.exec(e),i=r&&(Wo(s)?s(r,e):s);if(i)return i}return["",""]},device:OM,deviceType:function(e){var t=OM(e);return t===$U||t===zU||t==="Kobo"||t==="Kindle Fire"||t===iG?ev:t===nv||t===gp||t===sv||t===pT?"Console":t===KU?"Wearable":t?go:"Desktop"},referrer:function(){return Ot?.referrer||"$direct"},referringDomain:function(){var e;return Ot!=null&&Ot.referrer&&((e=fp(Ot.referrer))===null||e===void 0?void 0:e.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},personInfo:function(){var{maskPersonalDataProperties:e,customPersonalDataProperties:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e?J_([],nx,t||[]):[],s=sa?.href.substring(0,1e3);return{r:this.referrer().substring(0,1e3),u:s?K1(s,n,aS):void 0}},personPropsFromInfo:function(e){var t,{r:n,u:s}=e,r={$referrer:n,$referring_domain:n==null?void 0:n=="$direct"?"$direct":(t=fp(n))===null||t===void 0?void 0:t.host};if(s){r.$current_url=s;var i=fp(s);r.$host=i?.host,r.$pathname=i?.pathname;var a=this._campaignParamsFromUrl(s);Js(r,a)}if(n){var o=this._searchInfoFromReferrer(n);Js(r,o)}return r},initialPersonPropsFromInfo:function(e){var t=this.personPropsFromInfo(e),n={};return fs(t,function(s,r){n["$initial_".concat(k2(r))]=s}),n},timezone:function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}},timezoneOffset:function(){try{return new Date().getTimezoneOffset()}catch{return}},properties:function(){var{maskPersonalDataProperties:e,customPersonalDataProperties:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!hr)return{};var n=e?J_([],nx,t||[]):[],[s,r]=Fs.os(hr);return Js(Z0({$os:s,$os_version:r,$browser:Fs.browser(hr,navigator.vendor),$device:Fs.device(hr),$device_type:Fs.deviceType(hr),$timezone:Fs.timezone(),$timezone_offset:Fs.timezoneOffset()}),{$current_url:K1(sa?.href,n,aS),$host:sa?.host,$pathname:sa?.pathname,$raw_user_agent:hr.length>1e3?hr.substring(0,997)+"...":hr,$browser_version:Fs.browserVersion(hr,navigator.vendor),$browser_language:Fs.browserLanguage(),$browser_language_prefix:Fs.browserLanguagePrefix(),$screen_height:Ke?.screen.height,$screen_width:Ke?.screen.width,$viewport_height:Ke?.innerHeight,$viewport_width:Ke?.innerWidth,$lib:"web",$lib_version:pc.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})},people_properties:function(){if(!hr)return{};var[e,t]=Fs.os(hr);return Js(Z0({$os:e,$os_version:t,$browser:Fs.browser(hr,navigator.vendor)}),{$browser_version:Fs.browserVersion(hr,navigator.vendor)})}},bl=Ei("[FeatureFlags]"),oS="$active_feature_flags",Ef="$override_feature_flags",LM="$feature_flag_payloads",sm="$override_feature_flag_payloads",BM="$feature_flag_request_id",jM=e=>{var t={};for(var[n,s]of Z_(e||{}))s&&(t[n]=s);return t},Oue=e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map(n=>{var s;return[n,(s=t[n].variant)!==null&&s!==void 0?s:t[n].enabled]})),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter(n=>t[n].enabled).filter(n=>{var s;return(s=t[n].metadata)===null||s===void 0?void 0:s.payload}).map(n=>{var s;return[n,(s=t[n].metadata)===null||s===void 0?void 0:s.payload]}))):bl.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e};(function(e){e.FeatureFlags="feature_flags",e.Recordings="recordings"})(mT||(mT={}));class Lue{constructor(t){yt(this,"_override_warning",!1),yt(this,"_hasLoadedFlags",!1),yt(this,"_requestInFlight",!1),yt(this,"_reloadingDisabled",!1),yt(this,"_additionalReloadRequested",!1),yt(this,"_decideCalled",!1),yt(this,"_flagsLoadedFromRemote",!1),this.instance=t,this.featureFlagEventHandlers=[]}decide(){if(this.instance.config.__preview_remote_config)this._decideCalled=!0;else{var t=!this._reloadDebouncer&&(this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load);this._callDecideEndpoint({disableFlags:t})}}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.instance.get_property(XE),n=this.instance.get_property(Ef),s=this.instance.get_property(sm);if(!s&&!n)return t||{};var r=Js({},t||{}),i=[...new Set([...Object.keys(s||{}),...Object.keys(n||{})])];for(var a of i){var o,l,u=r[a],d=n?.[a],f=Dt(d)?(o=u?.enabled)!==null&&o!==void 0&&o:!!d,p=Dt(d)?u.variant:typeof d=="string"?d:void 0,g=s?.[a],v=Ze(Ze({},u),{},{enabled:f,variant:f?p??u?.variant:void 0});f!==u?.enabled&&(v.original_enabled=u?.enabled),p!==u?.variant&&(v.original_variant=u?.variant),g&&(v.metadata=Ze(Ze({},u?.metadata),{},{payload:g,original_payload:u==null||(l=u.metadata)===null||l===void 0?void 0:l.payload})),r[a]=v}return this._override_warning||(bl.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:s,finalDetails:r}),this._override_warning=!0),r}getFlagVariants(){var t=this.instance.get_property(sp),n=this.instance.get_property(Ef);if(!n)return t||{};for(var s=Js({},t),r=Object.keys(n),i=0;i<r.length;i++)s[r[i]]=n[r[i]];return this._override_warning||(bl.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:n,finalFlags:s}),this._override_warning=!0),s}getFlagPayloads(){var t=this.instance.get_property(LM),n=this.instance.get_property(sm);if(!n)return t||{};for(var s=Js({},t||{}),r=Object.keys(n),i=0;i<r.length;i++)s[r[i]]=n[r[i]];return this._override_warning||(bl.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:n,finalPayloads:s}),this._override_warning=!0),s}reloadFeatureFlags(){this._reloadingDisabled||this.instance.config.advanced_disable_feature_flags||this._reloadDebouncer||(this._reloadDebouncer=setTimeout(()=>{this._callDecideEndpoint()},5))}clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this._reloadingDisabled=t}_callDecideEndpoint(t){var n;if(this.clearDebouncer(),!this.instance.config.advanced_disable_decide)if(this._requestInFlight)this._additionalReloadRequested=!0;else{var s={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:Ze(Ze({},((n=this.instance.persistence)===null||n===void 0?void 0:n.get_initial_props())||{}),this.instance.get_property(Mm)||{}),group_properties:this.instance.get_property(Ud)};(t!=null&&t.disableFlags||this.instance.config.advanced_disable_feature_flags)&&(s.disable_flags=!0);var r=this.instance.config.__preview_flags_v2&&this.instance.config.__preview_remote_config;r&&(s.timezone=Fs.timezone()),this._requestInFlight=!0,this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api",r?"/flags/?v=2":"/decide/?v=4"),data:s,compression:this.instance.config.disable_compression?void 0:Bo.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:i=>{var a,o,l,u=!0;i.statusCode===200&&(this._additionalReloadRequested||(this.$anon_distinct_id=void 0),u=!1),this._requestInFlight=!1,this._decideCalled||(this._decideCalled=!0,this.instance._onRemoteConfig((l=i.json)!==null&&l!==void 0?l:{})),s.disable_flags&&!this._additionalReloadRequested||(this._flagsLoadedFromRemote=!u,i.json&&(a=i.json.quotaLimited)!==null&&a!==void 0&&a.includes(mT.FeatureFlags)?bl.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(this.receivedFeatureFlags((o=i.json)!==null&&o!==void 0?o:{},u),this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callDecideEndpoint())))}})}}getFeatureFlag(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){var s=this.getFlagVariants()[t],r="".concat(s),i=this.instance.get_property(BM)||void 0,a=this.instance.get_property(qx)||{};if((n.send_event||!("send_event"in n))&&(!(t in a)||!a[t].includes(r))){var o,l,u,d,f,p,g,v,b,_,x;Gs(a[t])?a[t].push(r):a[t]=[r],(o=this.instance.persistence)===null||o===void 0||o.register({[qx]:a});var w=this.getFeatureFlagDetails(t),y={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:this.getFeatureFlagPayload(t)||null,$feature_flag_request_id:i,$feature_flag_bootstrapped_response:((l=this.instance.config.bootstrap)===null||l===void 0||(u=l.featureFlags)===null||u===void 0?void 0:u[t])||null,$feature_flag_bootstrapped_payload:((d=this.instance.config.bootstrap)===null||d===void 0||(f=d.featureFlagPayloads)===null||f===void 0?void 0:f[t])||null,$used_bootstrap_value:!this._flagsLoadedFromRemote};Dt(w==null||(p=w.metadata)===null||p===void 0?void 0:p.version)||(y.$feature_flag_version=w.metadata.version);var S,C=(g=w==null||(v=w.reason)===null||v===void 0?void 0:v.description)!==null&&g!==void 0?g:w==null||(b=w.reason)===null||b===void 0?void 0:b.code;C&&(y.$feature_flag_reason=C),w!=null&&(_=w.metadata)!==null&&_!==void 0&&_.id&&(y.$feature_flag_id=w.metadata.id),Dt(w?.original_variant)&&Dt(w?.original_enabled)||(y.$feature_flag_original_response=Dt(w.original_variant)?w.original_enabled:w.original_variant),w!=null&&(x=w.metadata)!==null&&x!==void 0&&x.original_payload&&(y.$feature_flag_original_payload=w==null||(S=w.metadata)===null||S===void 0?void 0:S.original_payload),this.instance.capture("$feature_flag_called",y)}return s}bl.warn('getFeatureFlag for key "'+t+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){return this.getFlagPayloads()[t]}getRemoteConfigPayload(t,n){var s=this.instance.config.token;this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=4"),data:{distinct_id:this.instance.get_distinct_id(),token:s},compression:this.instance.config.disable_compression?void 0:Bo.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:r=>{var i,a=(i=r.json)===null||i===void 0?void 0:i.featureFlagPayloads;n(a?.[t]||void 0)}})}isFeatureEnabled(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(t,n);bl.warn('isFeatureEnabled for key "'+t+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(n=>n!==t)}receivedFeatureFlags(t,n){if(this.instance.persistence){this._hasLoadedFlags=!0;var s=this.getFlagVariants(),r=this.getFlagPayloads(),i=this.getFlagsWithDetails();(function(a,o){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},d=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{},f=Oue(a),p=f.flags,g=f.featureFlags,v=f.featureFlagPayloads;if(g){var b=a.requestId;if(Gs(g)){bl.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var _={};if(g)for(var x=0;x<g.length;x++)_[g[x]]=!0;o&&o.register({[oS]:g,[sp]:_})}else{var w=g,y=v,S=p;a.errorsWhileComputingFlags&&(w=Ze(Ze({},l),w),y=Ze(Ze({},u),y),S=Ze(Ze({},d),S)),o&&o.register(Ze({[oS]:Object.keys(jM(w)),[sp]:w||{},[LM]:y||{},[XE]:S||{}},b?{[BM]:b}:{}))}}})(t,this.instance.persistence,s,r,i),this._fireFeatureFlagsCallbacks(n)}}override(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];bl.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:n})}overrideFeatureFlags(t){if(!this.instance.__loaded||!this.instance.persistence)return bl.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.instance.persistence.unregister(Ef),this.instance.persistence.unregister(sm),void this._fireFeatureFlagsCallbacks();if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var n,s=t;if(this._override_warning=!!((n=s.suppressWarning)!==null&&n!==void 0&&n),"flags"in s){if(s.flags===!1)this.instance.persistence.unregister(Ef);else if(s.flags)if(Gs(s.flags)){for(var r={},i=0;i<s.flags.length;i++)r[s.flags[i]]=!0;this.instance.persistence.register({[Ef]:r})}else this.instance.persistence.register({[Ef]:s.flags})}return"payloads"in s&&(s.payloads===!1?this.instance.persistence.unregister(sm):s.payloads&&this.instance.persistence.register({[sm]:s.payloads})),void this._fireFeatureFlagsCallbacks()}this._fireFeatureFlagsCallbacks()}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this._hasLoadedFlags){var{flags:n,flagVariants:s}=this._prepareFeatureFlagsForCallbacks();t(n,s)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,n){var s,r=(this.instance.get_property(ex)||[]).find(l=>l.flagKey===t),i={["$feature_enrollment/".concat(t)]:n},a={$feature_flag:t,$feature_enrollment:n,$set:i};r&&(a.$early_access_feature_name=r.name),this.instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(i,!1);var o=Ze(Ze({},this.getFlagVariants()),{},{[t]:n});(s=this.instance.persistence)===null||s===void 0||s.register({[oS]:Object.keys(jM(o)),[sp]:o}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1],s=arguments.length>2?arguments[2]:void 0,r=this.instance.get_property(ex),i=s?"&".concat(s.map(a=>"stage=".concat(a)).join("&")):"";if(r&&!n)return t(r);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/early_access_features/?token=".concat(this.instance.config.token).concat(i)),method:"GET",callback:a=>{var o;if(a.json){var l=a.json.earlyAccessFeatures;return(o=this.instance.persistence)===null||o===void 0||o.register({[ex]:l}),t(l)}}})}_prepareFeatureFlagsForCallbacks(){var t=this.getFlags(),n=this.getFlagVariants();return{flags:t.filter(s=>n[s]),flagVariants:Object.keys(n).filter(s=>n[s]).reduce((s,r)=>(s[r]=n[r],s),{})}}_fireFeatureFlagsCallbacks(t){var{flags:n,flagVariants:s}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach(r=>r(n,s,{errorsLoading:t}))}setPersonPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],s=this.instance.get_property(Mm)||{};this.instance.register({[Mm]:Ze(Ze({},s),t)}),n&&this.instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this.instance.unregister(Mm)}setGroupPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],s=this.instance.get_property(Ud)||{};Object.keys(s).length!==0&&Object.keys(s).forEach(r=>{s[r]=Ze(Ze({},s[r]),t[r]),delete t[r]}),this.instance.register({[Ud]:Ze(Ze({},s),t)}),n&&this.instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var n=this.instance.get_property(Ud)||{};this.instance.register({[Ud]:Ze(Ze({},n),{},{[t]:{}})})}else this.instance.unregister(Ud)}}var Bue=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class lS{constructor(t){this.config=t,this.props={},this.campaign_params_saved=!1,this.name=(n=>{var s="";return n.token&&(s=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+s+"_posthog"})(t),this.storage=this.buildStorage(t),this.load(),t.debug&&Vt.info("Persistence loaded",t.persistence,Ze({},this.props)),this.update_config(t,t),this.save()}buildStorage(t){Bue.indexOf(t.persistence.toLowerCase())===-1&&(Vt.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n=t.persistence.toLowerCase();return n==="localstorage"&&wr.is_supported()?wr:n==="localstorage+cookie"&&$b.is_supported()?$b:n==="sessionstorage"&&Xr.is_supported()?Xr:n==="memory"?Pce:n==="cookie"?Cc:$b.is_supported()?$b:Cc}properties(){var t={};return fs(this.props,function(n,s){if(s===sp&&Vs(n))for(var r=Object.keys(n),i=0;i<r.length;i++)t["$feature/".concat(r[i])]=n[r[i]];else o=s,l=!1,(hd(a=hce)?l:qP&&a.indexOf===qP?a.indexOf(o)!=-1:(fs(a,function(u){if(l||(l=u===o))return zx}),l))||(t[s]=n);var a,o,l}),t}load(){if(!this.disabled){var t=this.storage.parse(this.name);t&&(this.props=Js({},t))}}save(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure,this.config.debug)}remove(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}clear(){this.remove(),this.props={}}register_once(t,n,s){if(Vs(t)){Dt(n)&&(n="None"),this.expire_days=Dt(s)?this.default_expiry:s;var r=!1;if(fs(t,(i,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==n||(this.props[a]=i,r=!0)}),r)return this.save(),!0}return!1}register(t,n){if(Vs(t)){this.expire_days=Dt(n)?this.default_expiry:n;var s=!1;if(fs(t,(r,i)=>{t.hasOwnProperty(i)&&this.props[i]!==r&&(this.props[i]=r,s=!0)}),s)return this.save(),!0}return!1}unregister(t){t in this.props&&(delete this.props[t],this.save())}update_campaign_params(){if(!this.campaign_params_saved){var t=Fs.campaignParams({customTrackedParams:this.config.custom_campaign_params,maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});np(Z0(t))||this.register(t),this.campaign_params_saved=!0}}update_search_keyword(){this.register(Fs.searchInfo())}update_referrer_info(){this.register_once(Fs.referrerInfo(),void 0)}set_initial_person_info(){this.props[eT]||this.props[tT]||this.register_once({[nT]:Fs.personInfo({maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties})},void 0)}get_referrer_info(){return Z0({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}get_initial_props(){var t={};fs([tT,eT],r=>{var i=this.props[r];i&&fs(i,function(a,o){t["$initial_"+k2(o)]=a})});var n=this.props[nT];if(n){var s=Fs.initialPersonPropsFromInfo(n);Js(t,s)}return t}safe_merge(t){return fs(this.props,function(n,s){s in t||(t[s]=n)}),t}update_config(t,n){if(this.default_expiry=this.expire_days=t.cookie_expiration,this.set_disabled(t.disable_persistence),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==n.persistence){var s=this.buildStorage(t),r=this.props;this.clear(),this.storage=s,this.props=r,this.save()}}set_disabled(t){this.disabled=t,this.disabled?this.remove():this.save()}set_cross_subdomain(t){t!==this.cross_subdomain&&(this.cross_subdomain=t,this.remove(),this.save())}get_cross_subdomain(){return!!this.cross_subdomain}set_secure(t){t!==this.secure&&(this.secure=t,this.remove(),this.save())}set_event_timer(t,n){var s=this.props[Nm]||{};s[t]=n,this.props[Nm]=s,this.save()}remove_event_timer(t){var n=(this.props[Nm]||{})[t];return Dt(n)||(delete this.props[Nm][t],this.save()),n}get_property(t){return this.props[t]}set_property(t,n){this.props[t]=n,this.save()}}var aG,Ws,oG,qd,HM,lG,vT,cG,UM,bT,GM,VM,WM,zM,_T={},uG=[],jue=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,P2=Array.isArray;function Mu(e,t){for(var n in t)e[n]=t[n];return e}function dG(e){var t=e.parentNode;t&&t.removeChild(e)}function cS(e,t,n,s,r){var i={type:e,props:t,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:r??++oG,__i:-1,__u:0};return r==null&&Ws.vnode!=null&&Ws.vnode(i),i}function M2(e){return e.children}function sx(e,t){this.props=e,this.context=t}function Wp(e,t){if(t==null)return e.__?Wp(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Wp(e):null}function hG(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return hG(e)}}function xT(e){(!e.__d&&(e.__d=!0)&&qd.push(e)&&!tw.__r++||HM!==Ws.debounceRendering)&&((HM=Ws.debounceRendering)||lG)(tw)}function tw(){var e,t,n,s,r,i,a,o,l;for(qd.sort(vT);e=qd.shift();)e.__d&&(t=qd.length,s=void 0,i=(r=(n=e).__v).__e,o=[],l=[],(a=n.__P)&&((s=Mu({},r)).__v=r.__v+1,Ws.vnode&&Ws.vnode(s),gG(a,s,r,n.__n,a.ownerSVGElement!==void 0,32&r.__u?[i]:null,o,i??Wp(r),!!(32&r.__u),l),s.__.__k[s.__i]=s,Gue(o,s,l),s.__e!=i&&hG(s)),qd.length>t&&qd.sort(vT));tw.__r=0}function fG(e,t,n,s,r,i,a,o,l,u,d){var f,p,g,v,b,_=s&&s.__k||uG,x=t.length;for(n.__d=l,Hue(n,t,_),l=n.__d,f=0;f<x;f++)(g=n.__k[f])!=null&&typeof g!="boolean"&&typeof g!="function"&&(p=g.__i===-1?_T:_[g.__i]||_T,g.__i=f,gG(e,g,p,r,i,a,o,l,u,d),v=g.__e,g.ref&&p.ref!=g.ref&&(p.ref&&O2(p.ref,null,g),d.push(g.ref,g.__c||v,g)),b==null&&v!=null&&(b=v),65536&g.__u||p.__k===g.__k?l=pG(g,l,e):typeof g.type=="function"&&g.__d!==void 0?l=g.__d:v&&(l=v.nextSibling),g.__d=void 0,g.__u&=-196609);n.__d=l,n.__e=b}function Hue(e,t,n){var s,r,i,a,o,l=t.length,u=n.length,d=u,f=0;for(e.__k=[],s=0;s<l;s++)(r=e.__k[s]=(r=t[s])==null||typeof r=="boolean"||typeof r=="function"?null:typeof r=="string"||typeof r=="number"||typeof r=="bigint"||r.constructor==String?cS(null,r,null,null,r):P2(r)?cS(M2,{children:r},null,null,null):r.constructor===void 0&&r.__b>0?cS(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)!=null?(r.__=e,r.__b=e.__b+1,o=Uue(r,n,a=s+f,d),r.__i=o,i=null,o!==-1&&(d--,(i=n[o])&&(i.__u|=131072)),i==null||i.__v===null?(o==-1&&f--,typeof r.type!="function"&&(r.__u|=65536)):o!==a&&(o===a+1?f++:o>a?d>l-a?f+=o-a:f--:f=o<a&&o==a-1?o-a:0,o!==s+f&&(r.__u|=65536))):(i=n[s])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=Wp(i)),wT(i,i,!1),n[s]=null,d--);if(d)for(s=0;s<u;s++)(i=n[s])!=null&&(131072&i.__u)==0&&(i.__e==e.__d&&(e.__d=Wp(i)),wT(i,i))}function pG(e,t,n){var s,r;if(typeof e.type=="function"){for(s=e.__k,r=0;s&&r<s.length;r++)s[r]&&(s[r].__=e,t=pG(s[r],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Uue(e,t,n,s){var r=e.key,i=e.type,a=n-1,o=n+1,l=t[n];if(l===null||l&&r==l.key&&i===l.type)return n;if(s>(l!=null&&(131072&l.__u)==0?1:0))for(;a>=0||o<t.length;){if(a>=0){if((l=t[a])&&(131072&l.__u)==0&&r==l.key&&i===l.type)return a;a--}if(o<t.length){if((l=t[o])&&(131072&l.__u)==0&&r==l.key&&i===l.type)return o;o++}}return-1}function $M(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||jue.test(t)?n:n+"px"}function Zb(e,t,n,s,r){var i;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof s=="string"&&(e.style.cssText=s=""),s)for(t in s)n&&t in n||$M(e.style,t,"");if(n)for(t in n)s&&n[t]===s[t]||$M(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?s?n.u=s.u:(n.u=Date.now(),e.addEventListener(t,i?KM:qM,i)):e.removeEventListener(t,i?KM:qM,i);else{if(r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,n))}}function qM(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(Ws.event?Ws.event(e):e)}function KM(e){return this.l[e.type+!0](Ws.event?Ws.event(e):e)}function gG(e,t,n,s,r,i,a,o,l,u){var d,f,p,g,v,b,_,x,w,y,S,C,k,T,A,F=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),i=[o=t.__e=n.__e]),(d=Ws.__b)&&d(t);e:if(typeof F=="function")try{if(x=t.props,w=(d=F.contextType)&&s[d.__c],y=d?w?w.props.value:d.__:s,n.__c?_=(f=t.__c=n.__c).__=f.__E:("prototype"in F&&F.prototype.render?t.__c=f=new F(x,y):(t.__c=f=new sx(x,y),f.constructor=F,f.render=Wue),w&&w.sub(f),f.props=x,f.state||(f.state={}),f.context=y,f.__n=s,p=f.__d=!0,f.__h=[],f._sb=[]),f.__s==null&&(f.__s=f.state),F.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Mu({},f.__s)),Mu(f.__s,F.getDerivedStateFromProps(x,f.__s))),g=f.props,v=f.state,f.__v=t,p)F.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(F.getDerivedStateFromProps==null&&x!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(x,y),!f.__e&&(f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(x,f.__s,y)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(f.props=x,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(I){I&&(I.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&a.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(x,f.__s,y),f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,v,b)})}if(f.context=y,f.props=x,f.__P=e,f.__e=!1,C=Ws.__r,k=0,"prototype"in F&&F.prototype.render){for(f.state=f.__s,f.__d=!1,C&&C(t),d=f.render(f.props,f.state,f.context),T=0;T<f._sb.length;T++)f.__h.push(f._sb[T]);f._sb=[]}else do f.__d=!1,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++k<25);f.state=f.__s,f.getChildContext!=null&&(s=Mu(Mu({},s),f.getChildContext())),p||f.getSnapshotBeforeUpdate==null||(b=f.getSnapshotBeforeUpdate(g,v)),fG(e,P2(A=d!=null&&d.type===M2&&d.key==null?d.props.children:d)?A:[A],t,n,s,r,i,a,o,l,u),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),_&&(f.__E=f.__=null)}catch(I){t.__v=null,l||i!=null?(t.__e=o,t.__u|=l?160:32,i[i.indexOf(o)]=null):(t.__e=n.__e,t.__k=n.__k),Ws.__e(I,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Vue(n.__e,t,n,s,r,i,a,l,u);(d=Ws.diffed)&&d(t)}function Gue(e,t,n){t.__d=void 0;for(var s=0;s<n.length;s++)O2(n[s],n[++s],n[++s]);Ws.__c&&Ws.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(i){i.call(r)})}catch(i){Ws.__e(i,r.__v)}})}function Vue(e,t,n,s,r,i,a,o,l){var u,d,f,p,g,v,b,_=n.props,x=t.props,w=t.type;if(w==="svg"&&(r=!0),i!=null){for(u=0;u<i.length;u++)if((g=i[u])&&"setAttribute"in g==!!w&&(w?g.localName===w:g.nodeType===3)){e=g,i[u]=null;break}}if(e==null){if(w===null)return document.createTextNode(x);e=r?document.createElementNS("http://www.w3.org/2000/svg",w):document.createElement(w,x.is&&x),i=null,o=!1}if(w===null)_===x||o&&e.data===x||(e.data=x);else{if(i=i&&aG.call(e.childNodes),_=n.props||_T,!o&&i!=null)for(_={},u=0;u<e.attributes.length;u++)_[(g=e.attributes[u]).name]=g.value;for(u in _)g=_[u],u=="children"||(u=="dangerouslySetInnerHTML"?f=g:u==="key"||u in x||Zb(e,u,null,g,r));for(u in x)g=x[u],u=="children"?p=g:u=="dangerouslySetInnerHTML"?d=g:u=="value"?v=g:u=="checked"?b=g:u==="key"||o&&typeof g!="function"||_[u]===g||Zb(e,u,g,_[u],r);if(d)o||f&&(d.__html===f.__html||d.__html===e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=""),fG(e,P2(p)?p:[p],t,n,s,r&&w!=="foreignObject",i,a,i?i[0]:n.__k&&Wp(n,0),o,l),i!=null)for(u=i.length;u--;)i[u]!=null&&dG(i[u]);o||(u="value",v!==void 0&&(v!==e[u]||w==="progress"&&!v||w==="option"&&v!==_[u])&&Zb(e,u,v,_[u],!1),u="checked",b!==void 0&&b!==e[u]&&Zb(e,u,b,_[u],!1))}return e}function O2(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(s){Ws.__e(s,n)}}function wT(e,t,n){var s,r;if(Ws.unmount&&Ws.unmount(e),(s=e.ref)&&(s.current&&s.current!==e.__e||O2(s,null,t)),(s=e.__c)!=null){if(s.componentWillUnmount)try{s.componentWillUnmount()}catch(i){Ws.__e(i,t)}s.base=s.__P=null,e.__c=void 0}if(s=e.__k)for(r=0;r<s.length;r++)s[r]&&wT(s[r],t,n||typeof e.type!="function");n||e.__e==null||dG(e.__e),e.__=e.__e=e.__d=void 0}function Wue(e,t,n){return this.constructor(e,n)}aG=uG.slice,Ws={__e:function(e,t,n,s){for(var r,i,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((i=r.constructor)&&i.getDerivedStateFromError!=null&&(r.setState(i.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,s||{}),a=r.__d),a)return r.__E=r}catch(o){e=o}throw e}},oG=0,sx.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Mu({},this.state),typeof e=="function"&&(e=e(Mu({},n),this.props)),e&&Mu(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),xT(this))},sx.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),xT(this))},sx.prototype.render=M2,qd=[],lG=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,vT=function(e,t){return e.__v.__b-t.__v.__b},tw.__r=0,cG=0,function(e){e.Button="button",e.Tab="tab",e.Selector="selector"}(UM||(UM={})),function(e){e.Left="left",e.Center="center",e.Right="right",e.NextToTrigger="next_to_trigger"}(bT||(bT={})),function(e){e.Popover="popover",e.API="api",e.Widget="widget"}(GM||(GM={})),function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"}(VM||(VM={})),function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"}(WM||(WM={})),function(e){e.Once="once",e.Recurring="recurring",e.Always="always"}(zM||(zM={}));var zp=function(e,t){if(!function(n){try{new RegExp(n)}catch{return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}},qr=Ei("[Surveys]"),YM={icontains:(e,t)=>e.some(n=>t.toLowerCase().includes(n.toLowerCase())),not_icontains:(e,t)=>e.every(n=>!t.toLowerCase().includes(n.toLowerCase())),regex:(e,t)=>e.some(n=>zp(t,n)),not_regex:(e,t)=>e.every(n=>!zp(t,n)),exact:(e,t)=>e.some(n=>t===n),is_not:(e,t)=>e.every(n=>t!==n)};function XM(e){return e??"icontains"}bT.Right;(function(e,t){var n={__c:t="__cC"+cG++,__:e,Consumer:function(s,r){return s.children(r)},Provider:function(s){var r,i;return this.getChildContext||(r=[],(i={})[t]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(a){this.props.value!==a.value&&r.some(function(o){o.__e=!0,xT(o)})},this.sub=function(a){r.push(a);var o=a.componentWillUnmount;a.componentWillUnmount=function(){r.splice(r.indexOf(a),1),o&&o.call(a)}}),s.children}};n.Provider.__=n.Consumer.contextType=n})({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed:()=>{},isPopup:!0,onPreviewSubmit:()=>{}});let mG=class{constructor(){yt(this,"events",{}),this.events={}}on(t,n){return this.events[t]||(this.events[t]=[]),this.events[t].push(n),()=>{this.events[t]=this.events[t].filter(s=>s!==n)}}emit(t,n){for(var s of this.events[t]||[])s(n);for(var r of this.events["*"]||[])r(t,n)}},zue=class zf{constructor(t){yt(this,"_debugEventEmitter",new mG),yt(this,"checkStep",(n,s)=>this.checkStepEvent(n,s)&&this.checkStepUrl(n,s)&&this.checkStepElement(n,s)),yt(this,"checkStepEvent",(n,s)=>s==null||!s.event||n?.event===s?.event),this.instance=t,this.actionEvents=new Set,this.actionRegistry=new Set}init(){var t;if(!Dt((t=this.instance)===null||t===void 0?void 0:t._addCaptureHook)){var n;(n=this.instance)===null||n===void 0||n._addCaptureHook((s,r)=>{this.on(s,r)})}}register(t){var n,s;if(!Dt((n=this.instance)===null||n===void 0?void 0:n._addCaptureHook)&&(t.forEach(a=>{var o,l;(o=this.actionRegistry)===null||o===void 0||o.add(a),(l=a.steps)===null||l===void 0||l.forEach(u=>{var d;(d=this.actionEvents)===null||d===void 0||d.add(u?.event||"")})}),(s=this.instance)!==null&&s!==void 0&&s.autocapture)){var r,i=new Set;t.forEach(a=>{var o;(o=a.steps)===null||o===void 0||o.forEach(l=>{l!=null&&l.selector&&i.add(l?.selector)})}),(r=this.instance)===null||r===void 0||r.autocapture.setElementSelectors(i)}}on(t,n){var s;n!=null&&t.length!=0&&(this.actionEvents.has(t)||this.actionEvents.has(n?.event))&&this.actionRegistry&&((s=this.actionRegistry)===null||s===void 0?void 0:s.size)>0&&this.actionRegistry.forEach(r=>{this.checkAction(n,r)&&this._debugEventEmitter.emit("actionCaptured",r.name)})}_addActionHook(t){this.onAction("actionCaptured",n=>t(n))}checkAction(t,n){if(n?.steps==null)return!1;for(var s of n.steps)if(this.checkStep(t,s))return!0;return!1}onAction(t,n){return this._debugEventEmitter.on(t,n)}checkStepUrl(t,n){if(n!=null&&n.url){var s,r=t==null||(s=t.properties)===null||s===void 0?void 0:s.$current_url;if(!r||typeof r!="string"||!zf.matchString(r,n?.url,n?.url_matching||"contains"))return!1}return!0}static matchString(t,n,s){switch(s){case"regex":return!!Ke&&zp(t,n);case"exact":return n===t;case"contains":var r=zf.escapeStringRegexp(n).replace(/_/g,".").replace(/%/g,".*");return zp(t,r);default:return!1}}static escapeStringRegexp(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}checkStepElement(t,n){if((n!=null&&n.href||n!=null&&n.tag_name||n!=null&&n.text)&&!this.getElementsList(t).some(i=>!(n!=null&&n.href&&!zf.matchString(i.href||"",n?.href,n?.href_matching||"exact"))&&(n==null||!n.tag_name||i.tag_name===n?.tag_name)&&!(n!=null&&n.text&&!zf.matchString(i.text||"",n?.text,n?.text_matching||"exact")&&!zf.matchString(i.$el_text||"",n?.text,n?.text_matching||"exact"))))return!1;if(n!=null&&n.selector){var s,r=t==null||(s=t.properties)===null||s===void 0?void 0:s.$element_selectors;if(!r||!r.includes(n?.selector))return!1}return!0}getElementsList(t){return t?.properties.$elements==null?[]:t?.properties.$elements}},yT=class vG{constructor(t){this.instance=t,this.eventToSurveys=new Map,this.actionToSurveys=new Map}register(t){var n;Dt((n=this.instance)===null||n===void 0?void 0:n._addCaptureHook)||(this.setupEventBasedSurveys(t),this.setupActionBasedSurveys(t))}setupActionBasedSurveys(t){var n=t.filter(s=>{var r,i,a,o;return((r=s.conditions)===null||r===void 0?void 0:r.actions)&&((i=s.conditions)===null||i===void 0||(a=i.actions)===null||a===void 0||(o=a.values)===null||o===void 0?void 0:o.length)>0});n.length!==0&&(this.actionMatcher==null&&(this.actionMatcher=new zue(this.instance),this.actionMatcher.init(),this.actionMatcher._addActionHook(s=>{this.onAction(s)})),n.forEach(s=>{var r,i,a,o,l,u,d,f,p,g;s.conditions&&(r=s.conditions)!==null&&r!==void 0&&r.actions&&(i=s.conditions)!==null&&i!==void 0&&(a=i.actions)!==null&&a!==void 0&&a.values&&((o=s.conditions)===null||o===void 0||(l=o.actions)===null||l===void 0||(u=l.values)===null||u===void 0?void 0:u.length)>0&&((d=this.actionMatcher)===null||d===void 0||d.register(s.conditions.actions.values),(f=s.conditions)===null||f===void 0||(p=f.actions)===null||p===void 0||(g=p.values)===null||g===void 0||g.forEach(v=>{if(v&&v.name){var b=this.actionToSurveys.get(v.name);b&&b.push(s.id),this.actionToSurveys.set(v.name,b||[s.id])}}))}))}setupEventBasedSurveys(t){var n;t.filter(s=>{var r,i,a,o;return((r=s.conditions)===null||r===void 0?void 0:r.events)&&((i=s.conditions)===null||i===void 0||(a=i.events)===null||a===void 0||(o=a.values)===null||o===void 0?void 0:o.length)>0}).length!==0&&((n=this.instance)===null||n===void 0||n._addCaptureHook((s,r)=>{this.onEvent(s,r)}),t.forEach(s=>{var r,i,a;(r=s.conditions)===null||r===void 0||(i=r.events)===null||i===void 0||(a=i.values)===null||a===void 0||a.forEach(o=>{if(o&&o.name){var l=this.eventToSurveys.get(o.name);l&&l.push(s.id),this.eventToSurveys.set(o.name,l||[s.id])}})}))}onEvent(t,n){var s,r,i=((s=this.instance)===null||s===void 0||(r=s.persistence)===null||r===void 0?void 0:r.props[zb])||[];if(vG.SURVEY_SHOWN_EVENT_NAME==t&&n&&i.length>0){var a,o=n==null||(a=n.properties)===null||a===void 0?void 0:a.$survey_id;if(o){var l=i.indexOf(o);l>=0&&(i.splice(l,1),this._updateActivatedSurveys(i))}}else this.eventToSurveys.has(t)&&this._updateActivatedSurveys(i.concat(this.eventToSurveys.get(t)||[]))}onAction(t){var n,s,r=((n=this.instance)===null||n===void 0||(s=n.persistence)===null||s===void 0?void 0:s.props[zb])||[];this.actionToSurveys.has(t)&&this._updateActivatedSurveys(r.concat(this.actionToSurveys.get(t)||[]))}_updateActivatedSurveys(t){var n,s;(n=this.instance)===null||n===void 0||(s=n.persistence)===null||s===void 0||s.register({[zb]:[...new Set(t)]})}getSurveys(){var t,n,s=(t=this.instance)===null||t===void 0||(n=t.persistence)===null||n===void 0?void 0:n.props[zb];return s||[]}getEventToSurveys(){return this.eventToSurveys}_getActionMatcher(){return this.actionMatcher}};yt(yT,"SURVEY_SHOWN_EVENT_NAME","survey shown");let $ue=class{constructor(t){yt(this,"_isFetchingSurveys",!1),yt(this,"_isInitializingSurveys",!1),yt(this,"_surveyCallbacks",[]),this.instance=t,this._surveyEventReceiver=null}onRemoteConfig(t){var n=t.surveys;if(ss(n))return qr.warn("Decide not loaded yet. Not loading surveys.");var s=Gs(n);this._hasSurveys=s?n.length>0:n,qr.info("decide response received, hasSurveys: ".concat(this._hasSurveys)),this._hasSurveys&&this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");var t=(()=>{for(var n=[],s=0;s<localStorage.length;s++){var r=localStorage.key(s);r!=null&&r.startsWith("seenSurvey_")&&n.push(r)}return n})();t.forEach(n=>localStorage.removeItem(n))}loadIfEnabled(){if(!this._surveyManager)if(this._isInitializingSurveys)qr.info("Already initializing surveys, skipping...");else if(this.instance.config.disable_surveys)qr.info("Disabled. Not loading surveys.");else{var t=hn?.__PosthogExtensions__;if(t)if(this._hasSurveys){this._isInitializingSurveys=!0;try{var n=t.generateSurveys;if(n)this._surveyManager=n(this.instance),this._isInitializingSurveys=!1,this._surveyEventReceiver=new yT(this.instance),qr.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0});else{var s=t.loadExternalDependency;if(s)s(this.instance,"surveys",i=>{if(i||!t.generateSurveys)return qr.error("Could not load surveys script",i),void(this._isInitializingSurveys=!1);this._surveyManager=t.generateSurveys(this.instance),this._isInitializingSurveys=!1,this._surveyEventReceiver=new yT(this.instance),qr.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})});else{var r="PostHog loadExternalDependency extension not found. Cannot load remote config.";qr.error(r),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:r})}}}catch(i){throw qr.error("Error initializing surveys",i),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:"Error initializing surveys"}),i}}else qr.info("No surveys to load.");else qr.error("PostHog Extensions not found.")}}onSurveysLoaded(t){return this._surveyCallbacks.push(t),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter(n=>n!==t)}}getSurveys(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(this.instance.config.disable_surveys)return qr.info("Disabled. Not loading surveys."),t([]);var s=this.instance.get_property(QE);if(s&&!n)return t(s,{isLoaded:!0});if(this._isFetchingSurveys)return t([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this._isFetchingSurveys=!0,this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/surveys/?token=".concat(this.instance.config.token)),method:"GET",timeout:this.instance.config.surveys_request_timeout_ms,callback:r=>{var i;this._isFetchingSurveys=!1;var a=r.statusCode;if(a!==200||!r.json){var o="Surveys API could not be loaded, status: ".concat(a);return qr.error(o),t([],{isLoaded:!1,error:o})}var l,u=r.json.surveys||[],d=u.filter(f=>{var p,g,v,b,_,x,w,y,S,C,k,T;return((p=f.conditions)===null||p===void 0?void 0:p.events)&&((g=f.conditions)===null||g===void 0||(v=g.events)===null||v===void 0?void 0:v.values)&&((b=f.conditions)===null||b===void 0||(_=b.events)===null||_===void 0||(x=_.values)===null||x===void 0?void 0:x.length)>0||((w=f.conditions)===null||w===void 0?void 0:w.actions)&&((y=f.conditions)===null||y===void 0||(S=y.actions)===null||S===void 0?void 0:S.values)&&((C=f.conditions)===null||C===void 0||(k=C.actions)===null||k===void 0||(T=k.values)===null||T===void 0?void 0:T.length)>0});return d.length>0&&((l=this._surveyEventReceiver)===null||l===void 0||l.register(d)),(i=this.instance.persistence)===null||i===void 0||i.register({[QE]:u}),t(u,{isLoaded:!0})}})}catch(r){throw this._isFetchingSurveys=!1,r}}_notifySurveyCallbacks(t){for(var n of this._surveyCallbacks)try{t.isLoaded?this.getSurveys(n):n([],t)}catch(s){qr.error("Error in survey callback",s)}}isSurveyFeatureFlagEnabled(t){return!t||this.instance.featureFlags.isFeatureEnabled(t)}getActiveMatchingSurveys(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.getSurveys(s=>{var r,i=s.filter(l=>!(!l.start_date||l.end_date)).filter(l=>{var u;if(!l.conditions)return!0;var d=function(g){var v,b,_;if((v=g.conditions)===null||v===void 0||!v.url)return!0;var x=Ke==null||(b=Ke.location)===null||b===void 0?void 0:b.href;if(!x)return!1;var w=[g.conditions.url];return YM[XM((_=g.conditions)===null||_===void 0?void 0:_.urlMatchType)](w,x)}(l),f=(u=l.conditions)===null||u===void 0||!u.selector||Ot?.querySelector(l.conditions.selector),p=function(g){var v,b,_;if((v=g.conditions)===null||v===void 0||!v.deviceTypes||((b=g.conditions)===null||b===void 0?void 0:b.deviceTypes.length)===0)return!0;if(!hr)return!1;var x=Fs.deviceType(hr);return YM[XM((_=g.conditions)===null||_===void 0?void 0:_.deviceTypesMatchType)](g.conditions.deviceTypes,x)}(l);return d&&f&&p}),a=(r=this._surveyEventReceiver)===null||r===void 0?void 0:r.getSurveys(),o=i.filter(l=>{var u,d,f,p,g,v,b,_,x;if(!(l.linked_flag_key||l.targeting_flag_key||l.internal_targeting_flag_key||(u=l.feature_flag_keys)!==null&&u!==void 0&&u.length))return!0;var w=this.isSurveyFeatureFlagEnabled(l.linked_flag_key),y=this.isSurveyFeatureFlagEnabled(l.targeting_flag_key),S=((d=(f=l.conditions)===null||f===void 0||(p=f.events)===null||p===void 0||(g=p.values)===null||g===void 0?void 0:g.length)!==null&&d!==void 0?d:0)>0,C=((v=(b=l.conditions)===null||b===void 0||(_=b.actions)===null||_===void 0||(x=_.values)===null||x===void 0?void 0:x.length)!==null&&v!==void 0?v:0)>0,k=!S&&!C||a?.includes(l.id),T=this._canActivateRepeatedly(l)||this.isSurveyFeatureFlagEnabled(l.internal_targeting_flag_key),A=this.checkFlags(l);return w&&y&&T&&k&&A});return t(o)},n)}checkFlags(t){var n;return(n=t.feature_flag_keys)===null||n===void 0||!n.length||t.feature_flag_keys.every(s=>{var{key:r,value:i}=s;return!r||!i||this.instance.featureFlags.isFeatureEnabled(i)})}_canActivateRepeatedly(t){var n;return ss((n=hn.__PosthogExtensions__)===null||n===void 0?void 0:n.canActivateRepeatedly)?(qr.warn("init was not called"),!1):hn.__PosthogExtensions__.canActivateRepeatedly(t)}canRenderSurvey(t){if(ss(this._surveyManager))return qr.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var n=null;return this.getSurveys(s=>{var r=s.filter(i=>i.id===t)[0];n=r?Ze({},this._surveyManager.canRenderSurvey(r)):{visible:!1,disabledReason:"Survey not found"}}),n}renderSurvey(t,n){ss(this._surveyManager)?qr.warn("init was not called"):this.getSurveys(s=>{var r=s.filter(i=>i.id===t)[0];this._surveyManager.renderSurvey(r,Ot?.querySelector(n))})}};var QM=Ei("[RateLimiter]");let que=class{constructor(t){var n,s;yt(this,"serverLimits",{}),yt(this,"lastEventRateLimited",!1),yt(this,"checkForLimiting",r=>{var i=r.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(a=>{QM.info("".concat(a||"events"," is quota limited.")),this.serverLimits[a]=new Date().getTime()+6e4})}catch(a){return void QM.warn('could not rate limit - continuing. Error: "'.concat(a?.message,'"'),{text:i})}}),this.instance=t,this.captureEventsPerSecond=((n=t.config.rate_limiting)===null||n===void 0?void 0:n.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((s=t.config.rate_limiting)===null||s===void 0?void 0:s.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(){var t,n,s,r=arguments.length>0&&arguments[0]!==void 0&&arguments[0],i=new Date().getTime(),a=(t=(n=this.instance.persistence)===null||n===void 0?void 0:n.get_property(ZE))!==null&&t!==void 0?t:{tokens:this.captureEventsBurstLimit,last:i};a.tokens+=(i-a.last)/1e3*this.captureEventsPerSecond,a.last=i,a.tokens>this.captureEventsBurstLimit&&(a.tokens=this.captureEventsBurstLimit);var o=a.tokens<1;return o||r||(a.tokens=Math.max(0,a.tokens-1)),!o||this.lastEventRateLimited||r||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to ".concat(this.captureEventsPerSecond," events per second and ").concat(this.captureEventsBurstLimit," events burst limit.")},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=o,(s=this.instance.persistence)===null||s===void 0||s.set_property(ZE,a),{isRateLimited:o,remainingTokens:a.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}};var Md=Ei("[RemoteConfig]");let Kue=class{constructor(t){this.instance=t}get remoteConfig(){var t,n;return(t=hn._POSTHOG_REMOTE_CONFIG)===null||t===void 0||(n=t[this.instance.config.token])===null||n===void 0?void 0:n.config}_loadRemoteConfigJs(t){var n,s,r;(n=hn.__PosthogExtensions__)!==null&&n!==void 0&&n.loadExternalDependency?(s=hn.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"remote-config",()=>t(this.remoteConfig)):(Md.error("PostHog Extensions not found. Cannot load remote config."),t())}_loadRemoteConfigJSON(t){this.instance._send_request({method:"GET",url:this.instance.requestRouter.endpointFor("assets","/array/".concat(this.instance.config.token,"/config")),callback:n=>{t(n.json)}})}load(){try{if(this.remoteConfig)return Md.info("Using preloaded remote config",this.remoteConfig),void this.onRemoteConfig(this.remoteConfig);if(this.instance.config.advanced_disable_decide)return void Md.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(t=>{if(!t)return Md.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON(n=>{this.onRemoteConfig(n)});this.onRemoteConfig(t)})}catch(t){Md.error("Error loading remote config",t)}}onRemoteConfig(t){t?this.instance.config.__preview_remote_config?(this.instance._onRemoteConfig(t),t.hasFeatureFlags!==!1&&this.instance.featureFlags.ensureFlagsLoaded()):Md.info("__preview_remote_config is disabled. Logging config instead",t):Md.error("Failed to fetch remote config from PostHog.")}};var Yue=function(e){var t,n,s,r,i="";for(t=n=0,s=(e=(e+"").replace(/\r\n/g,`
|
|
4
4
|
`).replace(/\r/g,`
|
|
@@ -663,7 +663,7 @@ If you are trying to annotate ${s} with application data, use the '${s}.context'
|
|
|
663
663
|
*
|
|
664
664
|
* This source code is licensed under the MIT license found in the
|
|
665
665
|
* LICENSE file in the root directory of this source tree.
|
|
666
|
-
*/var n5;function _ot(){if(n5)return Em;n5=1;var e=rt,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,r=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function a(o,l,u){var d,f={},p=null,g=null;u!==void 0&&(p=""+u),l.key!==void 0&&(p=""+l.key),l.ref!==void 0&&(g=l.ref);for(d in l)s.call(l,d)&&!i.hasOwnProperty(d)&&(f[d]=l[d]);if(o&&o.defaultProps)for(d in l=o.defaultProps,l)f[d]===void 0&&(f[d]=l[d]);return{$$typeof:t,type:o,key:p,ref:g,props:f,_owner:r.current}}return Em.Fragment=n,Em.jsx=a,Em.jsxs=a,Em}var s5;function xot(){return s5||(s5=1,t5.exports=_ot()),t5.exports}var wot=xot();/*! shepherd.js 14.5.0 */function yot(e){return e instanceof Element}function og(e){return e instanceof HTMLElement}function ld(e){return typeof e=="function"}function Vv(e){return typeof e=="string"}function xi(e){return e===void 0}class vI{on(t,n,s,r=!1){var i;return xi(this.bindings)&&(this.bindings={}),xi(this.bindings[t])&&(this.bindings[t]=[]),(i=this.bindings[t])==null||i.push({handler:n,ctx:s,once:r}),this}once(t,n,s){return this.on(t,n,s,!0)}off(t,n){if(xi(this.bindings)||xi(this.bindings[t]))return this;if(xi(n))delete this.bindings[t];else{var s;(s=this.bindings[t])==null||s.forEach((r,i)=>{if(r.handler===n){var a;(a=this.bindings[t])==null||a.splice(i,1)}})}return this}trigger(t,...n){if(!xi(this.bindings)&&this.bindings[t]){var s;(s=this.bindings[t])==null||s.forEach((r,i)=>{const{ctx:a,handler:o,once:l}=r,u=a||this;if(o.apply(u,n),l){var d;(d=this.bindings[t])==null||d.splice(i,1)}})}return this}}function ua(){return ua=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)({}).hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},ua.apply(null,arguments)}function bI(e,t){if(e==null)return{};var n={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(t.includes(s))continue;n[s]=e[s]}return n}const xd={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")};xd.defaultMerge;function Cot(e,t){return t}function Sot(e,t){return e.filter(n=>n!==void 0)}var r5;(function(e){e[e.NOT=0]="NOT",e[e.RECORD=1]="RECORD",e[e.ARRAY=2]="ARRAY",e[e.SET=3]="SET",e[e.MAP=4]="MAP",e[e.OTHER=5]="OTHER"})(r5||(r5={}));function i5(e){return typeof e!="object"||e===null?0:Array.isArray(e)?2:Tot(e)?1:e instanceof Set?3:e instanceof Map?4:5}function kot(e){const t=new Set;for(const n of e)for(const s of[...Object.keys(n),...Object.getOwnPropertySymbols(n)])t.add(s);return t}function Eot(e,t){return typeof e=="object"&&Object.prototype.propertyIsEnumerable.call(e,t)}function PX(e){return{*[Symbol.iterator](){for(const t of e)for(const n of t)yield n}}}const a5=new Set(["[object Object]","[object Module]"]);function Tot(e){if(!a5.has(Object.prototype.toString.call(e)))return!1;const{constructor:t}=e;if(t===void 0)return!0;const n=t.prototype;return!(n===null||typeof n!="object"||!a5.has(Object.prototype.toString.call(n))||!n.hasOwnProperty("isPrototypeOf"))}function Rot(e,t,n){const s={};for(const r of kot(e)){const i=[];for(const l of e)Eot(l,r)&&i.push(l[r]);if(i.length===0)continue;const a=t.metaDataUpdater(n,{key:r,parents:e}),o=MX(i,t,a);o!==xd.skip&&(r==="__proto__"?Object.defineProperty(s,r,{value:o,configurable:!0,enumerable:!0,writable:!0}):s[r]=o)}return s}function Aot(e){return e.flat()}function Fot(e){return new Set(PX(e))}function Dot(e){return new Map(PX(e))}function Iot(e){return e.at(-1)}const W_={mergeRecords:Rot,mergeArrays:Aot,mergeSets:Fot,mergeMaps:Dot,mergeOthers:Iot};function _I(...e){return Not({})(...e)}function Not(e,t){const n=Pot(e,s);function s(...r){return MX(r,n,t)}return s}function Pot(e,t){var n,s,r;return{defaultMergeFunctions:W_,mergeFunctions:ua({},W_,Object.fromEntries(Object.entries(e).filter(([i,a])=>Object.hasOwn(W_,i)).map(([i,a])=>a===!1?[i,W_.mergeOthers]:[i,a]))),metaDataUpdater:(n=e.metaDataUpdater)!=null?n:Cot,deepmerge:t,useImplicitDefaultMerging:(s=e.enableImplicitDefaultMerging)!=null?s:!1,filterValues:e.filterValues===!1?void 0:(r=e.filterValues)!=null?r:Sot,actions:xd}}function MX(e,t,n){var s;const r=(s=t.filterValues==null?void 0:t.filterValues(e,n))!=null?s:e;if(r.length===0)return;if(r.length===1)return fE(r,t,n);const i=i5(r[0]);if(i!==0&&i!==5){for(let a=1;a<r.length;a++)if(i5(r[a])!==i)return fE(r,t,n)}switch(i){case 1:return Mot(r,t,n);case 2:return Oot(r,t,n);case 3:return Lot(r,t,n);case 4:return Bot(r,t,n);default:return fE(r,t,n)}}function Mot(e,t,n){const s=t.mergeFunctions.mergeRecords(e,t,n);return s===xd.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeRecords!==t.defaultMergeFunctions.mergeRecords?t.defaultMergeFunctions.mergeRecords(e,t,n):s}function Oot(e,t,n){const s=t.mergeFunctions.mergeArrays(e,t,n);return s===xd.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeArrays!==t.defaultMergeFunctions.mergeArrays?t.defaultMergeFunctions.mergeArrays(e):s}function Lot(e,t,n){const s=t.mergeFunctions.mergeSets(e,t,n);return s===xd.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeSets!==t.defaultMergeFunctions.mergeSets?t.defaultMergeFunctions.mergeSets(e):s}function Bot(e,t,n){const s=t.mergeFunctions.mergeMaps(e,t,n);return s===xd.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps?t.defaultMergeFunctions.mergeMaps(e):s}function fE(e,t,n){const s=t.mergeFunctions.mergeOthers(e,t,n);return s===xd.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(e):s}function xI(e){const t=Object.getOwnPropertyNames(e.constructor.prototype);for(let n=0;n<t.length;n++){const s=t[n],r=e[s];s!=="constructor"&&typeof r=="function"&&(e[s]=r.bind(e))}return e}function jot(e,t){return n=>{if(e.isOpen()){const s=e.el&&n.currentTarget===e.el;(!xi(t)&&n.currentTarget.matches(t)||s)&&e.tour.next()}}}function Hot(e){const{event:t,selector:n}=e.options.advanceOn||{};if(t){const s=jot(e,n);let r=null;if(!xi(n)&&(r=document.querySelector(n),!r))return console.error(`No element was found for the selector supplied to advanceOn: ${n}`);r?(r.addEventListener(t,s),e.on("destroy",()=>r.removeEventListener(t,s))):(document.body.addEventListener(t,s,!0),e.on("destroy",()=>document.body.removeEventListener(t,s,!0)))}else return console.error("advanceOn was defined, but no event name was passed.")}class Uot{constructor(t){}}class Got{constructor(t,n){}}function OX(e){return!Vv(e)||e===""?"":e.charAt(e.length-1)!=="-"?`${e}-`:e}function Vot(e){const t=e.options.attachTo||{},n=Object.assign({},t);if(ld(n.element)&&(n.element=n.element.call(e)),Vv(n.element)){try{n.element=document.querySelector(n.element)}catch{}n.element||console.error(`The element for this Shepherd step was not found ${t.element}`)}return n}function Wot(e){return e.options.extraHighlights?e.options.extraHighlights.flatMap(t=>Array.from(document.querySelectorAll(t))):[]}function LX(e){return e==null?!0:!e.element||!e.on}function BX(){let e=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(t=="x"?n:n&3|8).toString(16)})}const zot=["top","right","bottom","left"],o5=["start","end"],l5=zot.reduce((e,t)=>e.concat(t,t+"-"+o5[0],t+"-"+o5[1]),[]),lg=Math.min,Ch=Math.max,gy=Math.round,z_=Math.floor,Ml=e=>({x:e,y:e}),$ot={left:"right",right:"left",bottom:"top",top:"bottom"},qot={start:"end",end:"start"};function SA(e,t,n){return Ch(e,lg(t,n))}function $h(e,t){return typeof e=="function"?e(t):e}function Uc(e){return e.split("-")[0]}function Nc(e){return e.split("-")[1]}function wI(e){return e==="x"?"y":"x"}function yI(e){return e==="y"?"height":"width"}function cg(e){return["top","bottom"].includes(Uc(e))?"y":"x"}function CI(e){return wI(cg(e))}function jX(e,t,n){n===void 0&&(n=!1);const s=Nc(e),r=CI(e),i=yI(r);let a=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=vy(a)),[a,vy(a)]}function Kot(e){const t=vy(e);return[my(e),t,my(t)]}function my(e){return e.replace(/start|end/g,t=>qot[t])}function Yot(e,t,n){const s=["left","right"],r=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?r:s:t?s:r;case"left":case"right":return t?i:a;default:return[]}}function Xot(e,t,n,s){const r=Nc(e);let i=Yot(Uc(e),n==="start",s);return r&&(i=i.map(a=>a+"-"+r),t&&(i=i.concat(i.map(my)))),i}function vy(e){return e.replace(/left|right|bottom|top/g,t=>$ot[t])}function Qot(e){return ua({top:0,right:0,bottom:0,left:0},e)}function HX(e){return typeof e!="number"?Qot(e):{top:e,right:e,bottom:e,left:e}}function by(e){const{x:t,y:n,width:s,height:r}=e;return{width:s,height:r,top:n,left:t,right:t+s,bottom:n+r,x:t,y:n}}const Jot=["crossAxis","alignment","allowedPlacements","autoAlignment"],Zot=["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"],elt=["mainAxis","crossAxis","limiter"];function c5(e,t,n){let{reference:s,floating:r}=e;const i=cg(t),a=CI(t),o=yI(a),l=Uc(t),u=i==="y",d=s.x+s.width/2-r.width/2,f=s.y+s.height/2-r.height/2,p=s[o]/2-r[o]/2;let g;switch(l){case"top":g={x:d,y:s.y-r.height};break;case"bottom":g={x:d,y:s.y+s.height};break;case"right":g={x:s.x+s.width,y:f};break;case"left":g={x:s.x-r.width,y:f};break;default:g={x:s.x,y:s.y}}switch(Nc(t)){case"start":g[a]-=p*(n&&u?-1:1);break;case"end":g[a]+=p*(n&&u?-1:1);break}return g}const tlt=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:i=[],platform:a}=n,o=i.filter(Boolean),l=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:f}=c5(u,s,l),p=s,g={},v=0;for(let b=0;b<o.length;b++){const{name:_,fn:x}=o[b],{x:w,y,data:S,reset:C}=await x({x:d,y:f,initialPlacement:s,placement:p,strategy:r,middlewareData:g,rects:u,platform:a,elements:{reference:e,floating:t}});d=w??d,f=y??f,g=ua({},g,{[_]:ua({},g[_],S)}),C&&v<=50&&(v++,typeof C=="object"&&(C.placement&&(p=C.placement),C.rects&&(u=C.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:r}):C.rects),{x:d,y:f}=c5(u,p,l)),b=-1)}return{x:d,y:f,placement:p,strategy:r,middlewareData:g}};async function SI(e,t){var n;t===void 0&&(t={});const{x:s,y:r,platform:i,rects:a,elements:o,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:p=!1,padding:g=0}=$h(t,e),v=HX(g),b=o[p?f==="floating"?"reference":"floating":f],_=by(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(b)))==null||n?b:b.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:u,rootBoundary:d,strategy:l})),x=f==="floating"?{x:s,y:r,width:a.floating.width,height:a.floating.height}:a.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),y=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},S=by(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:x,offsetParent:w,strategy:l}):x);return{top:(_.top-S.top+v.top)/y.y,bottom:(S.bottom-_.bottom+v.bottom)/y.y,left:(_.left-S.left+v.left)/y.x,right:(S.right-_.right+v.right)/y.x}}const nlt=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:r,rects:i,platform:a,elements:o,middlewareData:l}=t,{element:u,padding:d=0}=$h(e,t)||{};if(u==null)return{};const f=HX(d),p={x:n,y:s},g=CI(r),v=yI(g),b=await a.getDimensions(u),_=g==="y",x=_?"top":"left",w=_?"bottom":"right",y=_?"clientHeight":"clientWidth",S=i.reference[v]+i.reference[g]-p[g]-i.floating[v],C=p[g]-i.reference[g],k=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let T=k?k[y]:0;(!T||!await(a.isElement==null?void 0:a.isElement(k)))&&(T=o.floating[y]||i.floating[v]);const A=S/2-C/2,F=T/2-b[v]/2-1,I=lg(f[x],F),N=lg(f[w],F),P=I,O=T-b[v]-N,j=T/2-b[v]/2+A,M=SA(P,j,O),X=!l.arrow&&Nc(r)!=null&&j!==M&&i.reference[v]/2-(j<P?I:N)-b[v]/2<0,se=X?j<P?j-P:j-O:0;return{[g]:p[g]+se,data:ua({[g]:M,centerOffset:j-M-se},X&&{alignmentOffset:se}),reset:X}}});function slt(e,t,n){return(e?[...n.filter(s=>Nc(s)===e),...n.filter(s=>Nc(s)!==e)]:n.filter(s=>Uc(s)===s)).filter(s=>e?Nc(s)===e||(t?my(s)!==s:!1):!0)}const rlt=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,s,r;const{rects:i,middlewareData:a,placement:o,platform:l,elements:u}=t,d=$h(e,t),{crossAxis:f=!1,alignment:p,allowedPlacements:g=l5,autoAlignment:v=!0}=d,b=bI(d,Jot),_=p!==void 0||g===l5?slt(p||null,v,g):g,x=await SI(t,b),w=((n=a.autoPlacement)==null?void 0:n.index)||0,y=_[w];if(y==null)return{};const S=jX(y,i,await(l.isRTL==null?void 0:l.isRTL(u.floating)));if(o!==y)return{reset:{placement:_[0]}};const C=[x[Uc(y)],x[S[0]],x[S[1]]],k=[...((s=a.autoPlacement)==null?void 0:s.overflows)||[],{placement:y,overflows:C}],T=_[w+1];if(T)return{data:{index:w+1,overflows:k},reset:{placement:T}};const A=k.map(I=>{const N=Nc(I.placement);return[I.placement,N&&f?I.overflows.slice(0,2).reduce((P,O)=>P+O,0):I.overflows[0],I.overflows]}).sort((I,N)=>I[1]-N[1]),F=((r=A.filter(I=>I[2].slice(0,Nc(I[0])?2:3).every(N=>N<=0))[0])==null?void 0:r[0])||A[0][0];return F!==o?{data:{index:w+1,overflows:k},reset:{placement:F}}:{}}}},ilt=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:l,elements:u}=t,d=$h(e,t),{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:_=!0}=d,x=bI(d,Zot);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=Uc(r),y=cg(o),S=Uc(o)===o,C=await(l.isRTL==null?void 0:l.isRTL(u.floating)),k=g||(S||!_?[vy(o)]:Kot(o)),T=b!=="none";!g&&T&&k.push(...Xot(o,_,b,C));const A=[o,...k],F=await SI(t,x),I=[];let N=((s=i.flip)==null?void 0:s.overflows)||[];if(f&&I.push(F[w]),p){const M=jX(r,a,C);I.push(F[M[0]],F[M[1]])}if(N=[...N,{placement:r,overflows:I}],!I.every(M=>M<=0)){var P,O;const M=(((P=i.flip)==null?void 0:P.index)||0)+1,X=A[M];if(X)return{data:{index:M,overflows:N},reset:{placement:X}};let se=(O=N.filter(ee=>ee.overflows[0]<=0).sort((ee,q)=>ee.overflows[1]-q.overflows[1])[0])==null?void 0:O.placement;if(!se)switch(v){case"bestFit":{var j;const ee=(j=N.filter(q=>{if(T){const ne=cg(q.placement);return ne===y||ne==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(ne=>ne>0).reduce((ne,te)=>ne+te,0)]).sort((q,ne)=>q[1]-ne[1])[0])==null?void 0:j[0];ee&&(se=ee);break}case"initialPlacement":se=o;break}if(r!==se)return{reset:{placement:se}}}return{}}}},alt=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:r}=t,i=$h(e,t),{mainAxis:a=!0,crossAxis:o=!1,limiter:l={fn:x=>{let{x:w,y}=x;return{x:w,y}}}}=i,u=bI(i,elt),d={x:n,y:s},f=await SI(t,u),p=cg(Uc(r)),g=wI(p);let v=d[g],b=d[p];if(a){const x=g==="y"?"top":"left",w=g==="y"?"bottom":"right",y=v+f[x],S=v-f[w];v=SA(y,v,S)}if(o){const x=p==="y"?"top":"left",w=p==="y"?"bottom":"right",y=b+f[x],S=b-f[w];b=SA(y,b,S)}const _=l.fn(ua({},t,{[g]:v,[p]:b}));return ua({},_,{data:{x:_.x-n,y:_.y-s}})}}},olt=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:r,rects:i,middlewareData:a}=t,{offset:o=0,mainAxis:l=!0,crossAxis:u=!0}=$h(e,t),d={x:n,y:s},f=cg(r),p=wI(f);let g=d[p],v=d[f];const b=$h(o,t),_=typeof b=="number"?{mainAxis:b,crossAxis:0}:ua({mainAxis:0,crossAxis:0},b);if(l){const y=p==="y"?"height":"width",S=i.reference[p]-i.floating[y]+_.mainAxis,C=i.reference[p]+i.reference[y]-_.mainAxis;g<S?g=S:g>C&&(g=C)}if(u){var x,w;const y=p==="y"?"width":"height",S=["top","left"].includes(Uc(r)),C=i.reference[f]-i.floating[y]+(S&&((x=a.offset)==null?void 0:x[f])||0)+(S?0:_.crossAxis),k=i.reference[f]+i.reference[y]+(S?0:((w=a.offset)==null?void 0:w[f])||0)-(S?_.crossAxis:0);v<C?v=C:v>k&&(v=k)}return{[p]:g,[f]:v}}}};function JC(){return typeof window<"u"}function Mg(e){return UX(e)?(e.nodeName||"").toLowerCase():"#document"}function Na(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Yl(e){var t;return(t=(UX(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function UX(e){return JC()?e instanceof Node||e instanceof Na(e).Node:!1}function Jo(e){return JC()?e instanceof Element||e instanceof Na(e).Element:!1}function Gl(e){return JC()?e instanceof HTMLElement||e instanceof Na(e).HTMLElement:!1}function u5(e){return!JC()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Na(e).ShadowRoot}function Tb(e){const{overflow:t,overflowX:n,overflowY:s,display:r}=Zo(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!["inline","contents"].includes(r)}function llt(e){return["table","td","th"].includes(Mg(e))}function ZC(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function kI(e){const t=EI(),n=Jo(e)?Zo(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(s=>(n.willChange||"").includes(s))||["paint","layout","strict","content"].some(s=>(n.contain||"").includes(s))}function clt(e){let t=cd(e);for(;Gl(t)&&!ug(t);){if(kI(t))return t;if(ZC(t))return null;t=cd(t)}return null}function EI(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ug(e){return["html","body","#document"].includes(Mg(e))}function Zo(e){return Na(e).getComputedStyle(e)}function e1(e){return Jo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function cd(e){if(Mg(e)==="html")return e;const t=e.assignedSlot||e.parentNode||u5(e)&&e.host||Yl(e);return u5(t)?t.host:t}function GX(e){const t=cd(e);return ug(t)?e.ownerDocument?e.ownerDocument.body:e.body:Gl(t)&&Tb(t)?t:GX(t)}function Wv(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=GX(e),i=r===((s=e.ownerDocument)==null?void 0:s.body),a=Na(r);if(i){const o=kA(a);return t.concat(a,a.visualViewport||[],Tb(r)?r:[],o&&n?Wv(o):[])}return t.concat(r,Wv(r,[],n))}function kA(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function VX(e){const t=Zo(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=Gl(e),i=r?e.offsetWidth:n,a=r?e.offsetHeight:s,o=gy(n)!==i||gy(s)!==a;return o&&(n=i,s=a),{width:n,height:s,$:o}}function TI(e){return Jo(e)?e:e.contextElement}function Lp(e){const t=TI(e);if(!Gl(t))return Ml(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:i}=VX(t);let a=(i?gy(n.width):n.width)/s,o=(i?gy(n.height):n.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}const ult=Ml(0);function WX(e){const t=Na(e);return!EI()||!t.visualViewport?ult:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function dlt(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Na(e)?!1:t}function qh(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=TI(e);let a=Ml(1);t&&(s?Jo(s)&&(a=Lp(s)):a=Lp(e));const o=dlt(i,n,s)?WX(i):Ml(0);let l=(r.left+o.x)/a.x,u=(r.top+o.y)/a.y,d=r.width/a.x,f=r.height/a.y;if(i){const p=Na(i),g=s&&Jo(s)?Na(s):s;let v=p,b=kA(v);for(;b&&s&&g!==v;){const _=Lp(b),x=b.getBoundingClientRect(),w=Zo(b),y=x.left+(b.clientLeft+parseFloat(w.paddingLeft))*_.x,S=x.top+(b.clientTop+parseFloat(w.paddingTop))*_.y;l*=_.x,u*=_.y,d*=_.x,f*=_.y,l+=y,u+=S,v=Na(b),b=kA(v)}}return by({width:d,height:f,x:l,y:u})}function RI(e,t){const n=e1(e).scrollLeft;return t?t.left+n:qh(Yl(e)).left+n}function zX(e,t,n){n===void 0&&(n=!1);const s=e.getBoundingClientRect(),r=s.left+t.scrollLeft-(n?0:RI(e,s)),i=s.top+t.scrollTop;return{x:r,y:i}}function hlt(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const i=r==="fixed",a=Yl(s),o=t?ZC(t.floating):!1;if(s===a||o&&i)return n;let l={scrollLeft:0,scrollTop:0},u=Ml(1);const d=Ml(0),f=Gl(s);if((f||!f&&!i)&&((Mg(s)!=="body"||Tb(a))&&(l=e1(s)),Gl(s))){const g=qh(s);u=Lp(s),d.x=g.x+s.clientLeft,d.y=g.y+s.clientTop}const p=a&&!f&&!i?zX(a,l,!0):Ml(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-l.scrollTop*u.y+d.y+p.y}}function flt(e){return Array.from(e.getClientRects())}function plt(e){const t=Yl(e),n=e1(e),s=e.ownerDocument.body,r=Ch(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),i=Ch(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let a=-n.scrollLeft+RI(e);const o=-n.scrollTop;return Zo(s).direction==="rtl"&&(a+=Ch(t.clientWidth,s.clientWidth)-r),{width:r,height:i,x:a,y:o}}function glt(e,t){const n=Na(e),s=Yl(e),r=n.visualViewport;let i=s.clientWidth,a=s.clientHeight,o=0,l=0;if(r){i=r.width,a=r.height;const u=EI();(!u||u&&t==="fixed")&&(o=r.offsetLeft,l=r.offsetTop)}return{width:i,height:a,x:o,y:l}}function mlt(e,t){const n=qh(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,i=Gl(e)?Lp(e):Ml(1),a=e.clientWidth*i.x,o=e.clientHeight*i.y,l=r*i.x,u=s*i.y;return{width:a,height:o,x:l,y:u}}function d5(e,t,n){let s;if(t==="viewport")s=glt(e,n);else if(t==="document")s=plt(Yl(e));else if(Jo(t))s=mlt(t,n);else{const r=WX(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return by(s)}function $X(e,t){const n=cd(e);return n===t||!Jo(n)||ug(n)?!1:Zo(n).position==="fixed"||$X(n,t)}function vlt(e,t){const n=t.get(e);if(n)return n;let s=Wv(e,[],!1).filter(o=>Jo(o)&&Mg(o)!=="body"),r=null;const i=Zo(e).position==="fixed";let a=i?cd(e):e;for(;Jo(a)&&!ug(a);){const o=Zo(a),l=kI(a);!l&&o.position==="fixed"&&(r=null),(i?!l&&!r:!l&&o.position==="static"&&r&&["absolute","fixed"].includes(r.position)||Tb(a)&&!l&&$X(e,a))?s=s.filter(u=>u!==a):r=o,a=cd(a)}return t.set(e,s),s}function blt(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const i=[...n==="clippingAncestors"?ZC(t)?[]:vlt(t,this._c):[].concat(n),s],a=i[0],o=i.reduce((l,u)=>{const d=d5(t,u,r);return l.top=Ch(d.top,l.top),l.right=lg(d.right,l.right),l.bottom=lg(d.bottom,l.bottom),l.left=Ch(d.left,l.left),l},d5(t,a,r));return{width:o.right-o.left,height:o.bottom-o.top,x:o.left,y:o.top}}function _lt(e){const{width:t,height:n}=VX(e);return{width:t,height:n}}function xlt(e,t,n){const s=Gl(t),r=Yl(t),i=n==="fixed",a=qh(e,!0,i,t);let o={scrollLeft:0,scrollTop:0};const l=Ml(0);if(s||!s&&!i)if((Mg(t)!=="body"||Tb(r))&&(o=e1(t)),s){const p=qh(t,!0,i,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else r&&(l.x=RI(r));const u=r&&!s&&!i?zX(r,o):Ml(0),d=a.left+o.scrollLeft-l.x-u.x,f=a.top+o.scrollTop-l.y-u.y;return{x:d,y:f,width:a.width,height:a.height}}function pE(e){return Zo(e).position==="static"}function h5(e,t){if(!Gl(e)||Zo(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Yl(e)===n&&(n=n.ownerDocument.body),n}function qX(e,t){const n=Na(e);if(ZC(e))return n;if(!Gl(e)){let r=cd(e);for(;r&&!ug(r);){if(Jo(r)&&!pE(r))return r;r=cd(r)}return n}let s=h5(e,t);for(;s&&llt(s)&&pE(s);)s=h5(s,t);return s&&ug(s)&&pE(s)&&!kI(s)?n:s||clt(e)||n}const wlt=async function(e){const t=this.getOffsetParent||qX,n=this.getDimensions,s=await n(e.floating);return{reference:xlt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function ylt(e){return Zo(e).direction==="rtl"}const Clt={convertOffsetParentRelativeRectToViewportRelativeRect:hlt,getDocumentElement:Yl,getClippingRect:blt,getOffsetParent:qX,getElementRects:wlt,getClientRects:flt,getDimensions:_lt,getScale:Lp,isElement:Jo,isRTL:ylt};function Slt(e,t){let n=null,s;const r=Yl(e);function i(){var o;clearTimeout(s),(o=n)==null||o.disconnect(),n=null}function a(o,l){o===void 0&&(o=!1),l===void 0&&(l=1),i();const{left:u,top:d,width:f,height:p}=e.getBoundingClientRect();if(o||t(),!f||!p)return;const g=z_(d),v=z_(r.clientWidth-(u+f)),b=z_(r.clientHeight-(d+p)),_=z_(u),x={rootMargin:-g+"px "+-v+"px "+-b+"px "+-_+"px",threshold:Ch(0,lg(1,l))||1};let w=!0;function y(S){const C=S[0].intersectionRatio;if(C!==l){if(!w)return a();C?a(!1,C):s=setTimeout(()=>{a(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(y,ua({},x,{root:r.ownerDocument}))}catch{n=new IntersectionObserver(y,x)}n.observe(e)}return a(!0),i}function klt(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:l=!1}=s,u=TI(e),d=r||i?[...u?Wv(u):[],...Wv(t)]:[];d.forEach(x=>{r&&x.addEventListener("scroll",n,{passive:!0}),i&&x.addEventListener("resize",n)});const f=u&&o?Slt(u,n):null;let p=-1,g=null;a&&(g=new ResizeObserver(x=>{let[w]=x;w&&w.target===u&&g&&(g.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var y;(y=g)==null||y.observe(t)})),n()}),u&&!l&&g.observe(u),g.observe(t));let v,b=l?qh(e):null;l&&_();function _(){const x=qh(e);b&&(x.x!==b.x||x.y!==b.y||x.width!==b.width||x.height!==b.height)&&n(),b=x,v=requestAnimationFrame(_)}return n(),()=>{var x;d.forEach(w=>{r&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),f?.(),(x=g)==null||x.disconnect(),g=null,l&&cancelAnimationFrame(v)}}const Elt=rlt,Tlt=alt,Rlt=ilt,Alt=nlt,Flt=olt,Dlt=(e,t,n)=>{const s=new Map,r=ua({platform:Clt},n),i=ua({},r.platform,{_c:s});return tlt(e,t,ua({},r,{platform:i}))};function Ilt(e){e.cleanup&&e.cleanup();const t=e._getResolvedAttachToOptions();let n=t.element;const s=Blt(t,e),r=LX(t);return r&&(n=document.body,e.shepherdElementComponent.getElement().classList.add("shepherd-centered")),e.cleanup=klt(n,e.el,()=>{if(!e.el){e.cleanup==null||e.cleanup();return}Mlt(n,e,s,r)}),e.target=t.element,s}function Nlt(e,t){return{floatingUIOptions:_I(e.floatingUIOptions||{},t.floatingUIOptions||{})}}function Plt(e){e.cleanup&&e.cleanup(),e.cleanup=null}function Mlt(e,t,n,s){return Dlt(e,t.el,n).then(Olt(t,s)).then(r=>new Promise(i=>{setTimeout(()=>i(r),300)})).then(r=>{r!=null&&r.el&&r.el.focus({preventScroll:!0})})}function Olt(e,t){return({x:n,y:s,placement:r,middlewareData:i})=>(e.el&&(t?Object.assign(e.el.style,{position:"fixed",left:"50%",top:"50%",transform:"translate(-50%, -50%)"}):Object.assign(e.el.style,{position:"absolute",left:`${n}px`,top:`${s}px`}),e.el.dataset.popperPlacement=r,Llt(e.el,i)),e)}function Llt(e,t){const n=e.querySelector(".shepherd-arrow");if(og(n)&&t.arrow){const{x:s,y:r}=t.arrow;Object.assign(n.style,{left:s!=null?`${s}px`:"",top:r!=null?`${r}px`:""})}}function Blt(e,t){var n,s,r;const i={strategy:"absolute"};i.middleware=[];const a=jlt(t),o=LX(e),l=(n=e.on)==null?void 0:n.includes("auto"),u=(e==null||(s=e.on)==null?void 0:s.includes("-start"))||(e==null||(r=e.on)==null?void 0:r.includes("-end"));if(!o){if(l){var d;i.middleware.push(Elt({crossAxis:!0,alignment:u?e==null||(d=e.on)==null?void 0:d.split("-").pop():null}))}else i.middleware.push(Rlt());if(i.middleware.push(Tlt({limiter:Flt(),crossAxis:!0})),a){const f=typeof t.options.arrow=="object"?t.options.arrow:{padding:4};i.middleware.push(Alt({element:a,padding:u?f.padding:0}))}l||(i.placement=e.on)}return _I(i,t.options.floatingUIOptions||{})}function jlt(e){return e.options.arrow&&e.el?e.el.querySelector(".shepherd-arrow"):!1}function Oa(){}function Hlt(e,t){for(const n in t)e[n]=t[n];return e}function KX(e){return e()}function f5(){return Object.create(null)}function Rb(e){e.forEach(KX)}function AI(e){return typeof e=="function"}function Qc(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Ult(e){return Object.keys(e).length===0}function dg(e,t){e.appendChild(t)}function il(e,t,n){e.insertBefore(t,n||null)}function Eo(e){e.parentNode&&e.parentNode.removeChild(e)}function Glt(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function Vl(e){return document.createElement(e)}function p5(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function YX(e){return document.createTextNode(e)}function _y(){return YX(" ")}function Vlt(){return YX("")}function t1(e,t,n,s){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n,s)}function ps(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}const Wlt=["width","height"];function g5(e,t){const n=Object.getOwnPropertyDescriptors(e.__proto__);for(const s in t)t[s]==null?e.removeAttribute(s):s==="style"?e.style.cssText=t[s]:s==="__value"?e.value=e[s]=t[s]:n[s]&&n[s].set&&Wlt.indexOf(s)===-1?e[s]=t[s]:ps(e,s,t[s])}function zlt(e){return Array.from(e.childNodes)}function Lf(e,t,n){e.classList.toggle(t,!!n)}let zv;function L0(e){zv=e}function XX(){if(!zv)throw new Error("Function called outside component initialization");return zv}function $lt(e){XX().$$.on_mount.push(e)}function FI(e){XX().$$.after_update.push(e)}const Zf=[],hg=[];let Bp=[];const m5=[],qlt=Promise.resolve();let EA=!1;function Klt(){EA||(EA=!0,qlt.then(QX))}function TA(e){Bp.push(e)}const gE=new Set;let Bf=0;function QX(){if(Bf!==0)return;const e=zv;do{try{for(;Bf<Zf.length;){const t=Zf[Bf];Bf++,L0(t),Ylt(t.$$)}}catch(t){throw Zf.length=0,Bf=0,t}for(L0(null),Zf.length=0,Bf=0;hg.length;)hg.pop()();for(let t=0;t<Bp.length;t+=1){const n=Bp[t];gE.has(n)||(gE.add(n),n())}Bp.length=0}while(Zf.length);for(;m5.length;)m5.pop()();EA=!1,gE.clear(),L0(e)}function Ylt(e){if(e.fragment!==null){e.update(),Rb(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(TA)}}function Xlt(e){const t=[],n=[];Bp.forEach(s=>e.indexOf(s)===-1?t.push(s):n.push(s)),n.forEach(s=>s()),Bp=t}const Ex=new Set;let ah;function Sh(){ah={r:0,c:[],p:ah}}function kh(){ah.r||Rb(ah.c),ah=ah.p}function ns(e,t){e&&e.i&&(Ex.delete(e),e.i(t))}function Zs(e,t,n,s){if(e&&e.o){if(Ex.has(e))return;Ex.add(e),ah.c.push(()=>{Ex.delete(e),s&&(n&&e.d(1),s())}),e.o(t)}else s&&s()}function v5(e){return e?.length!==void 0?e:Array.from(e)}function Qlt(e,t){const n={},s={},r={$$scope:1};let i=e.length;for(;i--;){const a=e[i],o=t[i];if(o){for(const l in a)l in o||(s[l]=1);for(const l in o)r[l]||(n[l]=o[l],r[l]=1);e[i]=o}else for(const l in a)r[l]=1}for(const a in s)a in n||(n[a]=void 0);return n}function df(e){e&&e.c()}function wd(e,t,n){const{fragment:s,after_update:r}=e.$$;s&&s.m(t,n),TA(()=>{const i=e.$$.on_mount.map(KX).filter(AI);e.$$.on_destroy?e.$$.on_destroy.push(...i):Rb(i),e.$$.on_mount=[]}),r.forEach(TA)}function yd(e,t){const n=e.$$;n.fragment!==null&&(Xlt(n.after_update),Rb(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Jlt(e,t){e.$$.dirty[0]===-1&&(Zf.push(e),Klt(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function Jc(e,t,n,s,r,i,a=null,o=[-1]){const l=zv;L0(e);const u=e.$$={fragment:null,ctx:[],props:i,update:Oa,not_equal:r,bound:f5(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:f5(),dirty:o,skip_bound:!1,root:t.target||l.$$.root};a&&a(u.root);let d=!1;if(u.ctx=n?n(e,t.props||{},(f,p,...g)=>{const v=g.length?g[0]:p;return u.ctx&&r(u.ctx[f],u.ctx[f]=v)&&(!u.skip_bound&&u.bound[f]&&u.bound[f](v),d&&Jlt(e,f)),p}):[],u.update(),d=!0,Rb(u.before_update),u.fragment=s?s(u.ctx):!1,t.target){if(t.hydrate){const f=zlt(t.target);u.fragment&&u.fragment.l(f),f.forEach(Eo)}else u.fragment&&u.fragment.c();t.intro&&ns(e.$$.fragment),wd(e,t.target,t.anchor),QX()}L0(l)}class Zc{constructor(){this.$$=void 0,this.$$set=void 0}$destroy(){yd(this,1),this.$destroy=Oa}$on(t,n){if(!AI(n))return Oa;const s=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return s.push(n),()=>{const r=s.indexOf(n);r!==-1&&s.splice(r,1)}}$set(t){this.$$set&&!Ult(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Zlt="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Zlt);function ect(e){let t,n,s,r,i;return{c(){t=Vl("button"),ps(t,"aria-label",n=e[3]?e[3]:null),ps(t,"class",s=`${e[1]||""} shepherd-button ${e[4]?"shepherd-button-secondary":""}`),t.disabled=e[2],ps(t,"tabindex","0"),ps(t,"type","button")},m(a,o){il(a,t,o),t.innerHTML=e[5],r||(i=t1(t,"click",function(){AI(e[0])&&e[0].apply(this,arguments)}),r=!0)},p(a,[o]){e=a,o&32&&(t.innerHTML=e[5]),o&8&&n!==(n=e[3]?e[3]:null)&&ps(t,"aria-label",n),o&18&&s!==(s=`${e[1]||""} shepherd-button ${e[4]?"shepherd-button-secondary":""}`)&&ps(t,"class",s),o&4&&(t.disabled=e[2])},i:Oa,o:Oa,d(a){a&&Eo(t),r=!1,i()}}}function tct(e,t,n){let{config:s,step:r}=t,i,a,o,l,u,d;function f(p){return ld(p)?p=p.call(r):p}return e.$$set=p=>{"config"in p&&n(6,s=p.config),"step"in p&&n(7,r=p.step)},e.$$.update=()=>{e.$$.dirty&192&&(n(0,i=s.action?s.action.bind(r.tour):null),n(1,a=s.classes),n(2,o=s.disabled?f(s.disabled):!1),n(3,l=s.label?f(s.label):null),n(4,u=s.secondary),n(5,d=s.text?f(s.text):null))},[i,a,o,l,u,d,s,r]}class nct extends Zc{constructor(t){super(),Jc(this,t,tct,ect,Qc,{config:6,step:7})}}function b5(e,t,n){const s=e.slice();return s[2]=t[n],s}function _5(e){let t,n,s=v5(e[1]),r=[];for(let a=0;a<s.length;a+=1)r[a]=x5(b5(e,s,a));const i=a=>Zs(r[a],1,1,()=>{r[a]=null});return{c(){for(let a=0;a<r.length;a+=1)r[a].c();t=Vlt()},m(a,o){for(let l=0;l<r.length;l+=1)r[l]&&r[l].m(a,o);il(a,t,o),n=!0},p(a,o){if(o&3){s=v5(a[1]);let l;for(l=0;l<s.length;l+=1){const u=b5(a,s,l);r[l]?(r[l].p(u,o),ns(r[l],1)):(r[l]=x5(u),r[l].c(),ns(r[l],1),r[l].m(t.parentNode,t))}for(Sh(),l=s.length;l<r.length;l+=1)i(l);kh()}},i(a){if(!n){for(let o=0;o<s.length;o+=1)ns(r[o]);n=!0}},o(a){r=r.filter(Boolean);for(let o=0;o<r.length;o+=1)Zs(r[o]);n=!1},d(a){a&&Eo(t),Glt(r,a)}}}function x5(e){let t,n;return t=new nct({props:{config:e[2],step:e[0]}}),{c(){df(t.$$.fragment)},m(s,r){wd(t,s,r),n=!0},p(s,r){const i={};r&2&&(i.config=s[2]),r&1&&(i.step=s[0]),t.$set(i)},i(s){n||(ns(t.$$.fragment,s),n=!0)},o(s){Zs(t.$$.fragment,s),n=!1},d(s){yd(t,s)}}}function sct(e){let t,n,s=e[1]&&_5(e);return{c(){t=Vl("footer"),s&&s.c(),ps(t,"class","shepherd-footer")},m(r,i){il(r,t,i),s&&s.m(t,null),n=!0},p(r,[i]){r[1]?s?(s.p(r,i),i&2&&ns(s,1)):(s=_5(r),s.c(),ns(s,1),s.m(t,null)):s&&(Sh(),Zs(s,1,1,()=>{s=null}),kh())},i(r){n||(ns(s),n=!0)},o(r){Zs(s),n=!1},d(r){r&&Eo(t),s&&s.d()}}}function rct(e,t,n){let s,{step:r}=t;return e.$$set=i=>{"step"in i&&n(0,r=i.step)},e.$$.update=()=>{e.$$.dirty&1&&n(1,s=r.options.buttons)},[r,s]}class ict extends Zc{constructor(t){super(),Jc(this,t,rct,sct,Qc,{step:0})}}function act(e){let t,n,s,r,i;return{c(){t=Vl("button"),n=Vl("span"),n.textContent="×",ps(n,"aria-hidden","true"),ps(t,"aria-label",s=e[0].label?e[0].label:"Close Tour"),ps(t,"class","shepherd-cancel-icon"),ps(t,"type","button")},m(a,o){il(a,t,o),dg(t,n),r||(i=t1(t,"click",e[1]),r=!0)},p(a,[o]){o&1&&s!==(s=a[0].label?a[0].label:"Close Tour")&&ps(t,"aria-label",s)},i:Oa,o:Oa,d(a){a&&Eo(t),r=!1,i()}}}function oct(e,t,n){let{cancelIcon:s,step:r}=t;const i=a=>{a.preventDefault(),r.cancel()};return e.$$set=a=>{"cancelIcon"in a&&n(0,s=a.cancelIcon),"step"in a&&n(2,r=a.step)},[s,i,r]}class lct extends Zc{constructor(t){super(),Jc(this,t,oct,act,Qc,{cancelIcon:0,step:2})}}function cct(e){let t;return{c(){t=Vl("h3"),ps(t,"id",e[1]),ps(t,"class","shepherd-title")},m(n,s){il(n,t,s),e[3](t)},p(n,[s]){s&2&&ps(t,"id",n[1])},i:Oa,o:Oa,d(n){n&&Eo(t),e[3](null)}}}function uct(e,t,n){let{labelId:s,element:r,title:i}=t;FI(()=>{ld(i)&&n(2,i=i()),n(0,r.innerHTML=i,r)});function a(o){hg[o?"unshift":"push"](()=>{r=o,n(0,r)})}return e.$$set=o=>{"labelId"in o&&n(1,s=o.labelId),"element"in o&&n(0,r=o.element),"title"in o&&n(2,i=o.title)},[r,s,i,a]}class dct extends Zc{constructor(t){super(),Jc(this,t,uct,cct,Qc,{labelId:1,element:0,title:2})}}function w5(e){let t,n;return t=new dct({props:{labelId:e[0],title:e[2]}}),{c(){df(t.$$.fragment)},m(s,r){wd(t,s,r),n=!0},p(s,r){const i={};r&1&&(i.labelId=s[0]),r&4&&(i.title=s[2]),t.$set(i)},i(s){n||(ns(t.$$.fragment,s),n=!0)},o(s){Zs(t.$$.fragment,s),n=!1},d(s){yd(t,s)}}}function y5(e){let t,n;return t=new lct({props:{cancelIcon:e[3],step:e[1]}}),{c(){df(t.$$.fragment)},m(s,r){wd(t,s,r),n=!0},p(s,r){const i={};r&8&&(i.cancelIcon=s[3]),r&2&&(i.step=s[1]),t.$set(i)},i(s){n||(ns(t.$$.fragment,s),n=!0)},o(s){Zs(t.$$.fragment,s),n=!1},d(s){yd(t,s)}}}function hct(e){let t,n,s,r=e[2]&&w5(e),i=e[3]&&e[3].enabled&&y5(e);return{c(){t=Vl("header"),r&&r.c(),n=_y(),i&&i.c(),ps(t,"class","shepherd-header")},m(a,o){il(a,t,o),r&&r.m(t,null),dg(t,n),i&&i.m(t,null),s=!0},p(a,[o]){a[2]?r?(r.p(a,o),o&4&&ns(r,1)):(r=w5(a),r.c(),ns(r,1),r.m(t,n)):r&&(Sh(),Zs(r,1,1,()=>{r=null}),kh()),a[3]&&a[3].enabled?i?(i.p(a,o),o&8&&ns(i,1)):(i=y5(a),i.c(),ns(i,1),i.m(t,null)):i&&(Sh(),Zs(i,1,1,()=>{i=null}),kh())},i(a){s||(ns(r),ns(i),s=!0)},o(a){Zs(r),Zs(i),s=!1},d(a){a&&Eo(t),r&&r.d(),i&&i.d()}}}function fct(e,t,n){let{labelId:s,step:r}=t,i,a;return e.$$set=o=>{"labelId"in o&&n(0,s=o.labelId),"step"in o&&n(1,r=o.step)},e.$$.update=()=>{e.$$.dirty&2&&(n(2,i=r.options.title),n(3,a=r.options.cancelIcon))},[s,r,i,a]}class pct extends Zc{constructor(t){super(),Jc(this,t,fct,hct,Qc,{labelId:0,step:1})}}function gct(e){let t;return{c(){t=Vl("div"),ps(t,"class","shepherd-text"),ps(t,"id",e[1])},m(n,s){il(n,t,s),e[3](t)},p(n,[s]){s&2&&ps(t,"id",n[1])},i:Oa,o:Oa,d(n){n&&Eo(t),e[3](null)}}}function mct(e,t,n){let{descriptionId:s,element:r,step:i}=t;FI(()=>{let{text:o}=i.options;ld(o)&&(o=o.call(i)),og(o)?r.appendChild(o):n(0,r.innerHTML=o,r)});function a(o){hg[o?"unshift":"push"](()=>{r=o,n(0,r)})}return e.$$set=o=>{"descriptionId"in o&&n(1,s=o.descriptionId),"element"in o&&n(0,r=o.element),"step"in o&&n(2,i=o.step)},[r,s,i,a]}class vct extends Zc{constructor(t){super(),Jc(this,t,mct,gct,Qc,{descriptionId:1,element:0,step:2})}}function C5(e){let t,n;return t=new pct({props:{labelId:e[1],step:e[2]}}),{c(){df(t.$$.fragment)},m(s,r){wd(t,s,r),n=!0},p(s,r){const i={};r&2&&(i.labelId=s[1]),r&4&&(i.step=s[2]),t.$set(i)},i(s){n||(ns(t.$$.fragment,s),n=!0)},o(s){Zs(t.$$.fragment,s),n=!1},d(s){yd(t,s)}}}function S5(e){let t,n;return t=new vct({props:{descriptionId:e[0],step:e[2]}}),{c(){df(t.$$.fragment)},m(s,r){wd(t,s,r),n=!0},p(s,r){const i={};r&1&&(i.descriptionId=s[0]),r&4&&(i.step=s[2]),t.$set(i)},i(s){n||(ns(t.$$.fragment,s),n=!0)},o(s){Zs(t.$$.fragment,s),n=!1},d(s){yd(t,s)}}}function k5(e){let t,n;return t=new ict({props:{step:e[2]}}),{c(){df(t.$$.fragment)},m(s,r){wd(t,s,r),n=!0},p(s,r){const i={};r&4&&(i.step=s[2]),t.$set(i)},i(s){n||(ns(t.$$.fragment,s),n=!0)},o(s){Zs(t.$$.fragment,s),n=!1},d(s){yd(t,s)}}}function bct(e){let t,n=!xi(e[2].options.title)||e[2].options.cancelIcon&&e[2].options.cancelIcon.enabled,s,r=!xi(e[2].options.text),i,a=Array.isArray(e[2].options.buttons)&&e[2].options.buttons.length,o,l=n&&C5(e),u=r&&S5(e),d=a&&k5(e);return{c(){t=Vl("div"),l&&l.c(),s=_y(),u&&u.c(),i=_y(),d&&d.c(),ps(t,"class","shepherd-content")},m(f,p){il(f,t,p),l&&l.m(t,null),dg(t,s),u&&u.m(t,null),dg(t,i),d&&d.m(t,null),o=!0},p(f,[p]){p&4&&(n=!xi(f[2].options.title)||f[2].options.cancelIcon&&f[2].options.cancelIcon.enabled),n?l?(l.p(f,p),p&4&&ns(l,1)):(l=C5(f),l.c(),ns(l,1),l.m(t,s)):l&&(Sh(),Zs(l,1,1,()=>{l=null}),kh()),p&4&&(r=!xi(f[2].options.text)),r?u?(u.p(f,p),p&4&&ns(u,1)):(u=S5(f),u.c(),ns(u,1),u.m(t,i)):u&&(Sh(),Zs(u,1,1,()=>{u=null}),kh()),p&4&&(a=Array.isArray(f[2].options.buttons)&&f[2].options.buttons.length),a?d?(d.p(f,p),p&4&&ns(d,1)):(d=k5(f),d.c(),ns(d,1),d.m(t,null)):d&&(Sh(),Zs(d,1,1,()=>{d=null}),kh())},i(f){o||(ns(l),ns(u),ns(d),o=!0)},o(f){Zs(l),Zs(u),Zs(d),o=!1},d(f){f&&Eo(t),l&&l.d(),u&&u.d(),d&&d.d()}}}function _ct(e,t,n){let{descriptionId:s,labelId:r,step:i}=t;return e.$$set=a=>{"descriptionId"in a&&n(0,s=a.descriptionId),"labelId"in a&&n(1,r=a.labelId),"step"in a&&n(2,i=a.step)},[s,r,i]}class xct extends Zc{constructor(t){super(),Jc(this,t,_ct,bct,Qc,{descriptionId:0,labelId:1,step:2})}}function E5(e){let t;return{c(){t=Vl("div"),ps(t,"class","shepherd-arrow"),ps(t,"data-popper-arrow","")},m(n,s){il(n,t,s)},d(n){n&&Eo(t)}}}function wct(e){let t,n,s,r,i,a,o,l,u=e[4].options.arrow&&e[4].options.attachTo&&e[4].options.attachTo.element&&e[4].options.attachTo.on&&E5();s=new xct({props:{descriptionId:e[2],labelId:e[3],step:e[4]}});let d=[{"aria-describedby":r=xi(e[4].options.text)?null:e[2]},{"aria-labelledby":i=e[4].options.title?e[3]:null},e[1],{open:"true"}],f={};for(let p=0;p<d.length;p+=1)f=Hlt(f,d[p]);return{c(){t=Vl("dialog"),u&&u.c(),n=_y(),df(s.$$.fragment),g5(t,f),Lf(t,"shepherd-has-cancel-icon",e[5]),Lf(t,"shepherd-has-title",e[6]),Lf(t,"shepherd-element",!0)},m(p,g){il(p,t,g),u&&u.m(t,null),dg(t,n),wd(s,t,null),e[13](t),a=!0,o||(l=t1(t,"keydown",e[7]),o=!0)},p(p,[g]){p[4].options.arrow&&p[4].options.attachTo&&p[4].options.attachTo.element&&p[4].options.attachTo.on?u||(u=E5(),u.c(),u.m(t,n)):u&&(u.d(1),u=null);const v={};g&4&&(v.descriptionId=p[2]),g&8&&(v.labelId=p[3]),g&16&&(v.step=p[4]),s.$set(v),g5(t,f=Qlt(d,[(!a||g&20&&r!==(r=xi(p[4].options.text)?null:p[2]))&&{"aria-describedby":r},(!a||g&24&&i!==(i=p[4].options.title?p[3]:null))&&{"aria-labelledby":i},g&2&&p[1],{open:"true"}])),Lf(t,"shepherd-has-cancel-icon",p[5]),Lf(t,"shepherd-has-title",p[6]),Lf(t,"shepherd-element",!0)},i(p){a||(ns(s.$$.fragment,p),a=!0)},o(p){Zs(s.$$.fragment,p),a=!1},d(p){p&&Eo(t),u&&u.d(),yd(s),e[13](null),o=!1,l()}}}const yct=9,Cct=27,Sct=37,kct=39;function T5(e){return e.split(" ").filter(t=>!!t.length)}function Ect(e,t,n){let{classPrefix:s,element:r,descriptionId:i,firstFocusableElement:a,focusableElements:o,labelId:l,lastFocusableElement:u,step:d,dataStepId:f}=t,p,g,v;const b=()=>r;$lt(()=>{n(1,f={[`data-${s}shepherd-step-id`]:d.id}),n(9,o=r.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]')),n(8,a=o[0]),n(10,u=o[o.length-1])}),FI(()=>{v!==d.options.classes&&_()});function _(){x(v),v=d.options.classes,w(v)}function x(C){if(Vv(C)){const k=T5(C);k.length&&r.classList.remove(...k)}}function w(C){if(Vv(C)){const k=T5(C);k.length&&r.classList.add(...k)}}const y=C=>{const{tour:k}=d;switch(C.keyCode){case yct:if(o.length===0){C.preventDefault();break}C.shiftKey?(document.activeElement===a||document.activeElement.classList.contains("shepherd-element"))&&(C.preventDefault(),u.focus()):document.activeElement===u&&(C.preventDefault(),a.focus());break;case Cct:k.options.exitOnEsc&&(C.preventDefault(),C.stopPropagation(),d.cancel());break;case Sct:k.options.keyboardNavigation&&(C.preventDefault(),C.stopPropagation(),k.back());break;case kct:k.options.keyboardNavigation&&(C.preventDefault(),C.stopPropagation(),k.next());break}};function S(C){hg[C?"unshift":"push"](()=>{r=C,n(0,r)})}return e.$$set=C=>{"classPrefix"in C&&n(11,s=C.classPrefix),"element"in C&&n(0,r=C.element),"descriptionId"in C&&n(2,i=C.descriptionId),"firstFocusableElement"in C&&n(8,a=C.firstFocusableElement),"focusableElements"in C&&n(9,o=C.focusableElements),"labelId"in C&&n(3,l=C.labelId),"lastFocusableElement"in C&&n(10,u=C.lastFocusableElement),"step"in C&&n(4,d=C.step),"dataStepId"in C&&n(1,f=C.dataStepId)},e.$$.update=()=>{e.$$.dirty&16&&(n(5,p=d.options&&d.options.cancelIcon&&d.options.cancelIcon.enabled),n(6,g=d.options&&d.options.title))},[r,f,i,l,d,p,g,y,a,o,u,s,b,S]}class Tct extends Zc{constructor(t){super(),Jc(this,t,Ect,wct,Qc,{classPrefix:11,element:0,descriptionId:2,firstFocusableElement:8,focusableElements:9,labelId:3,lastFocusableElement:10,step:4,dataStepId:1,getElement:12})}get getElement(){return this.$$.ctx[12]}}class RA extends vI{constructor(t,n={}){return super(),this._resolvedAttachTo=void 0,this._resolvedExtraHighlightElements=void 0,this.classPrefix=void 0,this.el=void 0,this.target=void 0,this.tour=void 0,this.tour=t,this.classPrefix=this.tour.options?OX(this.tour.options.classPrefix):"",this.styles=t.styles,this._resolvedAttachTo=null,xI(this),this._setOptions(n),this}cancel(){this.tour.cancel(),this.trigger("cancel")}complete(){this.tour.complete(),this.trigger("complete")}destroy(){Plt(this),og(this.el)&&(this.el.remove(),this.el=null),this._updateStepTargetOnHide(),this.trigger("destroy")}getTour(){return this.tour}hide(){var t;(t=this.tour.modal)==null||t.hide(),this.trigger("before-hide"),this.el&&(this.el.hidden=!0),this._updateStepTargetOnHide(),this.trigger("hide")}_resolveExtraHiglightElements(){return this._resolvedExtraHighlightElements=Wot(this),this._resolvedExtraHighlightElements}_resolveAttachToOptions(){return this._resolvedAttachTo=Vot(this),this._resolvedAttachTo}_getResolvedAttachToOptions(){return this._resolvedAttachTo===null?this._resolveAttachToOptions():this._resolvedAttachTo}isOpen(){return!!(this.el&&!this.el.hidden)}show(){return ld(this.options.beforeShowPromise)?Promise.resolve(this.options.beforeShowPromise()).then(()=>this._show()):Promise.resolve(this._show())}updateStepOptions(t){Object.assign(this.options,t),this.shepherdElementComponent&&this.shepherdElementComponent.$set({step:this})}getElement(){return this.el}getTarget(){return this.target}_createTooltipContent(){const t=`${this.id}-description`,n=`${this.id}-label`;return this.shepherdElementComponent=new Tct({target:this.tour.options.stepsContainer||document.body,props:{classPrefix:this.classPrefix,descriptionId:t,labelId:n,step:this,styles:this.styles}}),this.shepherdElementComponent.getElement()}_scrollTo(t){const{element:n}=this._getResolvedAttachToOptions();ld(this.options.scrollToHandler)?this.options.scrollToHandler(n):yot(n)&&typeof n.scrollIntoView=="function"&&n.scrollIntoView(t)}_getClassOptions(t){const n=this.tour&&this.tour.options&&this.tour.options.defaultStepOptions,s=t.classes?t.classes:"",r=n&&n.classes?n.classes:"",i=[...s.split(" "),...r.split(" ")],a=new Set(i);return Array.from(a).join(" ").trim()}_setOptions(t={}){let n=this.tour&&this.tour.options&&this.tour.options.defaultStepOptions;n=_I({},n||{}),this.options=Object.assign({arrow:!0},n,t,Nlt(n,t));const{when:s}=this.options;this.options.classes=this._getClassOptions(t),this.destroy(),this.id=this.options.id||`step-${BX()}`,s&&Object.keys(s).forEach(r=>{this.on(r,s[r],this)})}_setupElements(){xi(this.el)||this.destroy(),this.el=this._createTooltipContent(),this.options.advanceOn&&Hot(this),Ilt(this)}_show(){var t;this.trigger("before-show"),this._resolveAttachToOptions(),this._resolveExtraHiglightElements(),this._setupElements(),this.tour.modal||this.tour.setupModal(),(t=this.tour.modal)==null||t.setupForStep(this),this._styleTargetElementForStep(this),this.el&&(this.el.hidden=!1),this.options.scrollTo&&setTimeout(()=>{this._scrollTo(this.options.scrollTo)}),this.el&&(this.el.hidden=!1);const n=this.shepherdElementComponent.getElement(),s=this.target||document.body,r=this._resolvedExtraHighlightElements;s.classList.add(`${this.classPrefix}shepherd-enabled`),s.classList.add(`${this.classPrefix}shepherd-target`),n.classList.add("shepherd-enabled"),r?.forEach(i=>{i.classList.add(`${this.classPrefix}shepherd-enabled`),i.classList.add(`${this.classPrefix}shepherd-target`)}),this.trigger("show")}_styleTargetElementForStep(t){const n=t.target,s=t._resolvedExtraHighlightElements;if(!n)return;const r=t.options.highlightClass;r&&(n.classList.add(r),s?.forEach(i=>i.classList.add(r))),n.classList.remove("shepherd-target-click-disabled"),s?.forEach(i=>i.classList.remove("shepherd-target-click-disabled")),t.options.canClickTarget===!1&&(n.classList.add("shepherd-target-click-disabled"),s?.forEach(i=>i.classList.add("shepherd-target-click-disabled")))}_updateStepTargetOnHide(){const t=this.target||document.body,n=this._resolvedExtraHighlightElements,s=this.options.highlightClass;s&&(t.classList.remove(s),n?.forEach(r=>r.classList.remove(s))),t.classList.remove("shepherd-target-click-disabled",`${this.classPrefix}shepherd-enabled`,`${this.classPrefix}shepherd-target`),n?.forEach(r=>{r.classList.remove("shepherd-target-click-disabled",`${this.classPrefix}shepherd-enabled`,`${this.classPrefix}shepherd-target`)})}}function Rct(e){if(e){const{steps:t}=e;t.forEach(n=>{n.options&&n.options.canClickTarget===!1&&n.options.attachTo&&(og(n.target)&&n.target.classList.remove("shepherd-target-click-disabled"),n._resolvedExtraHighlightElements&&n._resolvedExtraHighlightElements.forEach(s=>{og(s)&&s.classList.remove("shepherd-target-click-disabled")}))})}}function Act(e){let t="";const{innerWidth:n,innerHeight:s}=window;return e.forEach(r=>{const{width:i,height:a,x:o=0,y:l=0,r:u=0}=r,{topLeft:d=0,topRight:f=0,bottomRight:p=0,bottomLeft:g=0}=typeof u=="number"?{topLeft:u,topRight:u,bottomRight:u,bottomLeft:u}:u;t+=`M${o+d},${l} a${d},${d},0,0,0-${d},${d} V${a+l-g} a${g},${g},0,0,0,${g},${g} H${i+o-p} a${p},${p},0,0,0,${p}-${p} V${l+f} a${f},${f},0,0,0-${f}-${f} Z`}),`M${n},${s} H0 V0 H${n} V${s} Z ${t}`.replace(/\s/g,"")}function Fct(e){let t,n,s,r,i;return{c(){t=p5("svg"),n=p5("path"),ps(n,"d",e[2]),ps(t,"class",s=`${e[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)},m(a,o){il(a,t,o),dg(t,n),e[11](t),r||(i=t1(t,"touchmove",e[3]),r=!0)},p(a,[o]){o&4&&ps(n,"d",a[2]),o&2&&s!==(s=`${a[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)&&ps(t,"class",s)},i:Oa,o:Oa,d(a){a&&Eo(t),e[11](null),r=!1,i()}}}function JX(e){if(!e)return null;const t=e instanceof HTMLElement&&window.getComputedStyle(e).overflowY;return t!=="hidden"&&t!=="visible"&&e.scrollHeight>=e.clientHeight?e:JX(e.parentElement)}function Dct(e){let t={top:0,left:0};if(!e)return t;let n=e.ownerDocument.defaultView;for(;n!==window.top;){var s;const a=(s=n)==null?void 0:s.frameElement;if(a){var r,i;const o=a.getBoundingClientRect();t.top+=o.top+((r=o.scrollTop)!=null?r:0),t.left+=o.left+((i=o.scrollLeft)!=null?i:0)}n=n.parent}return t}function Ict(e,t){const n=e.getBoundingClientRect();let s=n.y||n.top,r=n.bottom||s+n.height;if(t){const a=t.getBoundingClientRect(),o=a.y||a.top,l=a.bottom||o+a.height;s=Math.max(s,o),r=Math.min(r,l)}const i=Math.max(r-s,0);return{y:s,height:i}}function Nct(e,t,n){let{element:s,openingProperties:r}=t,i=!1,a,o;u();const l=()=>s;function u(){n(4,r=[{width:0,height:0,x:0,y:0,r:0}])}function d(){n(1,i=!1),x()}function f(S=0,C=0,k=0,T=0,A,F,I){if(F){const N=[F,...I||[]];n(4,r=[]);for(const P of N){if(!P||N.indexOf(P)!==N.lastIndexOf(P))continue;const{y:O,height:j}=Ict(P,A),{x:M,width:X,left:se}=P.getBoundingClientRect();N.some(ee=>{if(ee===P)return!1;const q=ee.getBoundingClientRect();return M>=q.left&&M+X<=q.right&&O>=q.top&&O+j<=q.bottom})||r.push({width:X+S*2,height:j+S*2,x:(M||se)+k-S,y:O+T-S,r:C})}}else u()}function p(S){x(),S.tour.options.useModalOverlay?(w(S),g()):d()}function g(){n(1,i=!0)}const v=S=>{S.preventDefault()},b=S=>{S.stopPropagation()};function _(){window.addEventListener("touchmove",v,{passive:!1})}function x(){a&&(cancelAnimationFrame(a),a=void 0),window.removeEventListener("touchmove",v,{passive:!1})}function w(S){const{modalOverlayOpeningPadding:C,modalOverlayOpeningRadius:k,modalOverlayOpeningXOffset:T=0,modalOverlayOpeningYOffset:A=0}=S.options,F=Dct(S.target),I=JX(S.target),N=()=>{a=void 0,f(C,k,T+F.left,A+F.top,I,S.target,S._resolvedExtraHighlightElements),a=requestAnimationFrame(N)};N(),_()}function y(S){hg[S?"unshift":"push"](()=>{s=S,n(0,s)})}return e.$$set=S=>{"element"in S&&n(0,s=S.element),"openingProperties"in S&&n(4,r=S.openingProperties)},e.$$.update=()=>{e.$$.dirty&16&&n(2,o=Act(r))},[s,i,o,b,r,l,u,d,f,p,g,y]}class Pct extends Zc{constructor(t){super(),Jc(this,t,Nct,Fct,Qc,{element:0,openingProperties:4,getElement:5,closeModalOpening:6,hide:7,positionModal:8,setupForStep:9,show:10})}get getElement(){return this.$$.ctx[5]}get closeModalOpening(){return this.$$.ctx[6]}get hide(){return this.$$.ctx[7]}get positionModal(){return this.$$.ctx[8]}get setupForStep(){return this.$$.ctx[9]}get show(){return this.$$.ctx[10]}}class Mct extends vI{constructor(){super(),this.activeTour=void 0,xI(this)}}class Oct extends vI{constructor(t={}){super(),this.trackedEvents=["active","cancel","complete","show"],this.classPrefix=void 0,this.currentStep=void 0,this.focusedElBeforeOpen=void 0,this.id=void 0,this.modal=void 0,this.options=void 0,this.steps=void 0,xI(this);const n={exitOnEsc:!0,keyboardNavigation:!0};return this.options=Object.assign({},n,t),this.classPrefix=OX(this.options.classPrefix),this.steps=[],this.addSteps(this.options.steps),["active","cancel","complete","inactive","show","start"].map(s=>{(r=>{this.on(r,i=>{i=i||{},i.tour=this,oh.trigger(r,i)})})(s)}),this._setTourID(t.id),this}addStep(t,n){let s=t;return s instanceof RA?s.tour=this:s=new RA(this,s),xi(n)?this.steps.push(s):this.steps.splice(n,0,s),s}addSteps(t){return Array.isArray(t)&&t.forEach(n=>{this.addStep(n)}),this}back(){const t=this.steps.indexOf(this.currentStep);this.show(t-1,!1)}async cancel(){if(this.options.confirmCancel){const t=this.options.confirmCancelMessage||"Are you sure you want to stop the tour?";let n;ld(this.options.confirmCancel)?n=await this.options.confirmCancel():n=window.confirm(t),n&&this._done("cancel")}else this._done("cancel")}complete(){this._done("complete")}getById(t){return this.steps.find(n=>n.id===t)}getCurrentStep(){return this.currentStep}hide(){const t=this.getCurrentStep();if(t)return t.hide()}isActive(){return oh.activeTour===this}next(){const t=this.steps.indexOf(this.currentStep);t===this.steps.length-1?this.complete():this.show(t+1,!0)}removeStep(t){const n=this.getCurrentStep();this.steps.some((s,r)=>{if(s.id===t)return s.isOpen()&&s.hide(),s.destroy(),this.steps.splice(r,1),!0}),n&&n.id===t&&(this.currentStep=void 0,this.steps.length?this.show(0):this.cancel())}show(t=0,n=!0){const s=Vv(t)?this.getById(t):this.steps[t];s&&(this._updateStateBeforeShow(),ld(s.options.showOn)&&!s.options.showOn()?this._skipStep(s,n):(this.currentStep=s,this.trigger("show",{step:s,previous:this.currentStep}),s.show()))}async start(){this.trigger("start"),this.focusedElBeforeOpen=document.activeElement,this.currentStep=null,this.setupModal(),this._setupActiveTour(),this.next()}_done(t){const n=this.steps.indexOf(this.currentStep);if(Array.isArray(this.steps)&&this.steps.forEach(s=>s.destroy()),Rct(this),this.trigger(t,{index:n}),oh.activeTour=null,this.trigger("inactive",{tour:this}),this.modal&&this.modal.hide(),(t==="cancel"||t==="complete")&&this.modal){const s=document.querySelector(".shepherd-modal-overlay-container");s&&(s.remove(),this.modal=null)}og(this.focusedElBeforeOpen)&&this.focusedElBeforeOpen.focus()}_setupActiveTour(){this.trigger("active",{tour:this}),oh.activeTour=this}setupModal(){this.modal=new Pct({target:this.options.modalContainer||document.body,props:{styles:this.styles}})}_skipStep(t,n){const s=this.steps.indexOf(t);if(s===this.steps.length-1)this.complete();else{const r=n?s+1:s-1;this.show(r,n)}}_updateStateBeforeShow(){this.currentStep&&this.currentStep.hide(),this.isActive()||this._setupActiveTour()}_setTourID(t){const n=this.options.tourName||"tour",s=t||BX();this.id=`${n}--${s}`}}const oh=new Mct,ZX=typeof window>"u";oh.Step=ZX?Uot:RA;oh.Tour=ZX?Got:Oct;const n1=m.createContext(void 0);n1.Consumer;const Lct=({children:e})=>wot.jsx(n1.Provider,{value:{Shepherd:oh},children:e}),xy=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),Bct=e=>xy(e).replace(/"/g,"""),at=e=>xy(h(e)),jct=['<div class="tour-figure-rail" aria-hidden="true">','<span class="tour-figure-dot"></span>','<span class="tour-figure-dot"></span>','<span class="tour-figure-dot"></span>','<span class="tour-figure-rail-line"></span>',"</div>",'<div class="tour-figure-main" aria-hidden="true">','<span class="tour-figure-bubble tour-figure-bubble-in"></span>','<span class="tour-figure-bubble tour-figure-bubble-out"></span>','<span class="tour-figure-composer">','<span class="tour-figure-composer-line"></span>','<span class="tour-figure-send"></span>',"</span>","</div>"].join(""),Hct=['<div class="tour-figure-flow" aria-hidden="true">','<div class="tour-figure-node">','<span class="tour-figure-node-icon"></span>','<span class="tour-figure-node-bar"></span>','<span class="tour-figure-node-bar tour-figure-node-bar-short"></span>',"</div>",'<span class="tour-figure-connector"></span>','<div class="tour-figure-node">','<span class="tour-figure-node-icon tour-figure-node-icon-round"></span>','<span class="tour-figure-node-bar"></span>','<span class="tour-figure-node-bar tour-figure-node-bar-short"></span>',"</div>",'<span class="tour-figure-connector"></span>','<div class="tour-figure-node">','<span class="tour-figure-node-icon tour-figure-node-icon-end"></span>','<span class="tour-figure-node-bar"></span>','<span class="tour-figure-node-bar tour-figure-node-bar-short"></span>',"</div>","</div>"].join(""),Uct={welcome:jct,"agent-capabilities":Hct},R5=e=>e.map(t=>"key"in t?xy(h(t.key)):`<code>${xy(t.code)}</code>`).join(""),Gct=e=>{const t="<br/>".repeat(e.breaks??0);return e.kind==="paragraph"?`${R5(e.runs)}${t}`:e.kind==="list"?`<ul>${e.items.map(s=>`<li>${R5(s)}</li>`).join("")}</ul>${t}`:`<div class="tour-figure tour-figure-${e.figure}" role="img" aria-label="${Bct(h(e.altKey))}">${Uct[e.figure]}</div>${t}`},Sn=e=>e.map(Gct).join(""),kn={welcome:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.welcome.body.1"}],breaks:1},{kind:"figure",figure:"welcome",altKey:"ui.onboarding.tour.welcome.image.1.alt",breaks:1},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.welcome.body.2"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.welcome.body.3"}],breaks:0},{kind:"list",items:[[{key:"ui.onboarding.tour.welcome.list.1.item.1"}],[{key:"ui.onboarding.tour.welcome.list.1.item.2"}],[{key:"ui.onboarding.tour.welcome.list.1.item.3"}],[{key:"ui.onboarding.tour.welcome.list.1.item.4"}],[{key:"ui.onboarding.tour.welcome.list.1.item.5"}],[{key:"ui.onboarding.tour.welcome.list.1.item.6"}],[{key:"ui.onboarding.tour.welcome.list.1.item.7"}]],breaks:0},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.welcome.body.4"}],breaks:0}],agent_list:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_list.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_list.body.2"}],breaks:0}],select_agent:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.select_agent.body.1"}],breaks:0}],chat_input:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.chat_input.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.chat_input.body.2"}],breaks:2},{kind:"list",items:[[{key:"ui.onboarding.tour.chat_input.list.1.item.1"}],[{key:"ui.onboarding.tour.chat_input.list.1.item.2"}],[{key:"ui.onboarding.tour.chat_input.list.1.item.3"}]],breaks:1},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.chat_input.body.3"}],breaks:0}],attachments:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.attachments.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.attachments.body.2"}],breaks:1},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.attachments.body.3"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.attachments.body.4"}],breaks:0}],agent_capabilities:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_capabilities.body.1"}],breaks:1},{kind:"figure",figure:"agent-capabilities",altKey:"ui.onboarding.tour.agent_capabilities.image.1.alt",breaks:1},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_capabilities.body.2"}],breaks:0}],pre_command_palette_open_canvas:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.1.1"},{code:kl("everything",!0)},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.connector.on_mac_and"},{code:kl("everything",!1)},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.1.3"},{code:"#"},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.1.4"},{code:"@"},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.1.5"},{code:","},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.1.6"},{code:">"},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.1.7"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.2.1"},{code:kl("chats",!0)},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.connector.on_mac_and"},{code:kl("chats",!1)},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.2.3"},{code:kl("commands",!0)},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.connector.on_mac_and"},{code:kl("commands",!1)},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.2.5"}],breaks:0}],canvas_open_button:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_open_button.body.1"}],breaks:0}],canvas_feature:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_feature.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_feature.body.2"}],breaks:0}],canvas_documents_view:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_documents_view.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_documents_view.body.2"}],breaks:1},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_documents_view.body.3"}],breaks:1},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_documents_view.body.4"}],breaks:0}],canvas_files_view:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_files_view.body.1"}],breaks:0}],canvas_variables_view:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_variables_view.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_variables_view.body.2"}],breaks:0}],agent_options:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_options.body.1"}],breaks:0}],click_view_settings_from_chat:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.click_view_settings_from_chat.body.1"}],breaks:0}],view_agent_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.view_agent_settings.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.view_agent_settings.body.2"}],breaks:0}],select_provider:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.select_provider.body.1"}],breaks:0}],select_model:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.select_model.body.1"}],breaks:0}],modify_security_prompt:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.modify_security_prompt.body.1"}],breaks:0}],modify_agent_prompt:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.modify_agent_prompt.body.1"}],breaks:0}],create_new_agent:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.create_new_agent.body.1"}],breaks:0}],agent_naming_guidelines:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_naming_guidelines.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_naming_guidelines.body.2"}],breaks:0}],navigate_agent_hub:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.navigate_agent_hub.body.1"}],breaks:0}],agent_hub_view:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_hub_view.body.1"}],breaks:0}],download_agent:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.download_agent.body.1"}],breaks:0}],upload_agent_hub:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.upload_agent_hub.body.1"}],breaks:0}],upload_agent_hub_dialog:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.upload_agent_hub_dialog.body.1"}],breaks:0}],navigate_schedules:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.navigate_schedules.body.1"}],breaks:0}],schedules_overview:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.schedules_overview.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.schedules_overview.body.2"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.schedules_overview.body.3"}],breaks:0}],create_schedule:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.create_schedule.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.create_schedule.body.2"}],breaks:0}],create_schedule_dialog:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.create_schedule_dialog.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.create_schedule_dialog.body.2"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.create_schedule_dialog.body.3"}],breaks:0}],navigate_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.navigate_settings.body.1"}],breaks:0}],general_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.general_settings.body.1"}],breaks:0}],appearance_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.appearance_settings.body.1"}],breaks:0}],radient_account_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.radient_account_settings.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.radient_account_settings.body.2"}],breaks:0}],integrations_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.integrations_settings.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.integrations_settings.body.2"}],breaks:0}],application_updates_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.application_updates_settings.body.1"}],breaks:0}],tour_complete:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.tour_complete.body.1"}],breaks:0}]},Vct=e=>{const t=Array.from(document.querySelectorAll(`[data-tour-tag="${e}"]`));return t.find(n=>n.offsetParent!==null)??t[0]??null},A5=e=>{document.querySelector(`[data-tour-action="${e}"]`)?.click()},eQ=1340,DI="tour-beside-palette",s1="pre-command-palette-open-canvas",tQ='[data-tour-tag="command-palette-dialog"]',bs=e=>Z5(Xm())!=="rtl"?e:e==="left"?"right":"left",Wct=e=>(e.getById(s1)?.options.classes??"").split(" ").includes(DI),nQ=(e,t)=>{const n=e.getById(s1);!n||Wct(e)===t||n.updateStepOptions(t?{attachTo:{element:tQ,on:bs("right")},classes:DI}:{attachTo:void 0,classes:void 0})},sQ=e=>{const t=window.innerWidth>=eQ;return nQ(e,t),t};let II=0;const AA=new WeakMap;tt.subscribe((e,t)=>{t.isCommandPaletteOpen&&!e.isCommandPaletteOpen&&(II+=1)});const rQ=e=>{const t=AA.get(e);return t===void 0||(AA.delete(e),t!==II)?!1:(tt.getState().closeCommandPalette(),!0)},F5=(e,t)=>{if(!sQ(e)){t();return}const n=tt.getState();n.isCommandPaletteOpen||(n.openCommandPalette(),AA.set(e,II)),setTimeout(()=>{e.isActive()&&t()},500)},D5=(e,t)=>{if(!rQ(e)){t();return}setTimeout(()=>{e.isActive()&&t()},500)},I5=e=>{const t=e?.step;if(t?.id!==s1)return;(!sQ(t.tour)||document.querySelector(tQ)===null)&&nQ(t.tour,!1)},zct=()=>{const e=window.innerWidth>=eQ;return{id:s1,...e?{attachTo:{element:'[data-tour-tag="command-palette-dialog"]',on:bs("right")},classes:DI}:{},title:at("ui.onboarding.tour.pre_command_palette_open_canvas.title"),text:Sn(kn.pre_command_palette_open_canvas),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){D5(this,()=>this.back())}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){D5(this,()=>this.next())}}]}},iQ=()=>[{id:"welcome",title:at("ui.onboarding.tour.welcome.title"),text:Sn(kn.welcome),buttons:[{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"agent-list",attachTo:{element:'[data-tour-tag="agent-list-panel"]',on:bs("right")},title:at("ui.onboarding.tour.agent_list.title"),text:Sn(kn.agent_list),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"select-agent",attachTo:{element:'[data-tour-tag="agent-list-item-button-0"]',on:bs("right")},title:at("ui.onboarding.tour.select_agent.title"),text:Sn(kn.select_agent),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="agent-list-item-button-0"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"chat-input",attachTo:{element:'[data-tour-tag="chat-input-textarea"]',on:"top"},title:at("ui.onboarding.tour.chat_input.title"),text:Sn(kn.chat_input),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"attachments",attachTo:{element:'button[data-tour-tag="chat-input-attach-file-button"]',on:"top"},title:at("ui.onboarding.tour.attachments.title"),text:Sn(kn.attachments),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"agent-capabilities",attachTo:{element:'[data-tour-tag="chat-header"]',on:"top"},title:at("ui.onboarding.tour.agent_capabilities.title"),text:Sn(kn.agent_capabilities),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){F5(this,()=>this.next())}}]},zct(),{id:"canvas-open-button",attachTo:{element:'button[data-tour-tag="open-canvas-button"]',on:bs("left")},title:at("ui.onboarding.tour.canvas_open_button.title"),text:Sn(kn.canvas_open_button),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){F5(this,()=>this.back())}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="open-canvas-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-feature",attachTo:{element:'[data-tour-tag="canvas-container"]',on:bs("left")},title:at("ui.onboarding.tour.canvas_feature.title"),text:Sn(kn.canvas_feature),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="close-canvas-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-documents-view-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-documents-view",attachTo:{element:'button[data-tour-tag="canvas-documents-view-button"]',on:"top"},title:at("ui.onboarding.tour.canvas_documents_view.title"),text:Sn(kn.canvas_documents_view),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-files-view-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-files-view",attachTo:{element:'button[data-tour-tag="canvas-files-view-button"]',on:"top"},title:at("ui.onboarding.tour.canvas_files_view.title"),text:Sn(kn.canvas_files_view),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-documents-view-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-variables-view-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-variables-view",attachTo:{element:'button[data-tour-tag="canvas-variables-view-button"]',on:"top"},title:at("ui.onboarding.tour.canvas_variables_view.title"),text:Sn(kn.canvas_variables_view),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-files-view-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="close-canvas-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"agent-options",attachTo:{element:'button[data-tour-tag="agent-options-button"]',on:bs("right")},title:at("ui.onboarding.tour.agent_options.title"),text:Sn(kn.agent_options),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="open-canvas-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="agent-options-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"click-view-settings-from-chat",attachTo:{element:'[role="menuitem"][data-tour-tag="view-agent-settings-menu-item"]',on:bs("right")},title:at("ui.onboarding.tour.click_view_settings_from_chat.title"),text:Sn(kn.click_view_settings_from_chat),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[role="menuitem"][data-tour-tag="view-agent-settings-menu-item"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"view-agent-settings",attachTo:{element:'div[data-tour-tag="agent-settings-details-paper"]',on:bs("left")},title:at("ui.onboarding.tour.view_agent_settings.title"),text:Sn(kn.view_agent_settings),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-chat"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('button[data-tour-tag="agent-options-button"]');t&&t.click()},500),setTimeout(()=>{this.back()},1e3)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"select-provider",attachTo:{element:'[data-tour-tag="agent-settings-hosting-select"]',on:bs("left")},title:at("ui.onboarding.tour.select_provider.title"),text:Sn(kn.select_provider),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"select-model",attachTo:{element:'[data-tour-tag="agent-settings-model-select"]',on:bs("left")},title:at("ui.onboarding.tour.select_model.title"),text:Sn(kn.select_model),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"modify-security-prompt",attachTo:{element:'[data-tour-tag="agent-settings-security"]',on:bs("left")},title:at("ui.onboarding.tour.modify_security_prompt.title"),text:Sn(kn.modify_security_prompt),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"modify-agent-prompt",attachTo:{element:'[data-tour-tag="agent-settings-system-prompt"]',on:bs("left")},title:at("ui.onboarding.tour.modify_agent_prompt.title"),text:Sn(kn.modify_agent_prompt),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"create-new-agent",attachTo:{element:'button[data-tour-tag="create-new-agent-button"]',on:"bottom"},title:at("ui.onboarding.tour.create_new_agent.title"),text:Sn(kn.create_new_agent),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="agent-list-item-button-0"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('button[data-tour-tag="agent-options-button"]');t&&t.click()},500),setTimeout(()=>{const t=document.querySelector('[role="menuitem"][data-tour-tag="view-agent-settings-menu-item"]');t&&t.click()},1e3),setTimeout(()=>{this.back()},1500)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="create-new-agent-button"]');e&&e.click(),setTimeout(()=>{this.next()},1e3)}}]},{id:"agent-naming-guidelines",attachTo:{element:'[data-tour-tag="create-agent-dialog"]',on:bs("right")},title:at("ui.onboarding.tour.agent_naming_guidelines.title"),text:Sn(kn.agent_naming_guidelines),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="create-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="create-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"navigate-agent-hub",attachTo:{element:'[data-tour-tag="nav-item-agent-hub"]',on:bs("right")},title:at("ui.onboarding.tour.navigate_agent_hub.title"),text:Sn(kn.navigate_agent_hub),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('[data-tour-tag="create-new-agent-button"]');t&&t.click()},500),setTimeout(()=>{this.back()},1e3)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agent-hub"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"agent-hub-view",attachTo:{element:'[data-tour-tag="agent-hub-sidebar-container"]',on:bs("right")},title:at("ui.onboarding.tour.agent_hub_view.title"),text:Sn(kn.agent_hub_view),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"download-agent",attachTo:{element:'button[data-tour-tag="agent-hub-download-button"]',on:"bottom"},title:at("ui.onboarding.tour.download_agent.title"),text:Sn(kn.download_agent),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{this.next()},1e3)}}]},{id:"upload-agent-hub",attachTo:{element:()=>Vct("upload-to-hub-header-button"),on:"bottom"},title:at("ui.onboarding.tour.upload_agent_hub.title"),text:Sn(kn.upload_agent_hub),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agent-hub"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){A5("open-upload-dialog"),setTimeout(()=>{this.next()},500)}}]},{id:"upload-agent-hub-dialog",attachTo:{element:'[data-tour-tag="upload-agent-dialog"]',on:bs("right")},title:at("ui.onboarding.tour.upload_agent_hub_dialog.title"),text:Sn(kn.upload_agent_hub_dialog),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="upload-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="upload-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"navigate-schedules",attachTo:{element:'[data-tour-tag="nav-item-schedules"]',on:bs("right")},title:at("ui.onboarding.tour.navigate_schedules.title"),text:Sn(kn.navigate_schedules),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{A5("open-upload-dialog")},500),setTimeout(()=>{this.back()},1e3)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-schedules"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"schedules-overview",title:at("ui.onboarding.tour.schedules_overview.title"),text:Sn(kn.schedules_overview),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"create-schedule",attachTo:{element:'button[data-tour-tag="create-schedule-button"]',on:"bottom"},title:at("ui.onboarding.tour.create_schedule.title"),text:Sn(kn.create_schedule),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="create-schedule-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"create-schedule-dialog",attachTo:{element:'[data-tour-tag="create-schedule-dialog"]',on:bs("right")},title:at("ui.onboarding.tour.create_schedule_dialog.title"),text:Sn(kn.create_schedule_dialog),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="create-schedule-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="create-schedule-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"navigate-settings",attachTo:{element:'[data-tour-tag="nav-item-settings"]',on:bs("right")},title:at("ui.onboarding.tour.navigate_settings.title"),text:Sn(kn.navigate_settings),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-schedules"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('button[data-tour-tag="create-schedule-button"]');t&&t.click()},500),setTimeout(()=>{this.back()},1e3)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-settings"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"general-settings",attachTo:{element:'div[data-tour-tag="settings-general-section"]',on:bs("right")},title:at("ui.onboarding.tour.general_settings.title"),text:Sn(kn.general_settings),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"appearance-settings",attachTo:{element:'[data-tour-tag="settings-appearance-section"]',on:bs("right")},title:at("ui.onboarding.tour.appearance_settings.title"),text:Sn(kn.appearance_settings),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"radient-account-settings",attachTo:{element:'[data-tour-tag="settings-radient-account-section"]',on:bs("right")},title:at("ui.onboarding.tour.radient_account_settings.title"),text:Sn(kn.radient_account_settings),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"integrations-settings",attachTo:{element:'[data-tour-tag="settings-integrations-section"]',on:bs("right")},title:at("ui.onboarding.tour.integrations_settings.title"),text:Sn(kn.integrations_settings),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"application-updates-settings",attachTo:{element:'[data-tour-tag="settings-app-updates-section"]',on:bs("right")},title:at("ui.onboarding.tour.application_updates_settings.title"),text:Sn(kn.application_updates_settings),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"tour-complete",title:at("ui.onboarding.tour.tour_complete.title"),text:Sn(kn.tour_complete),buttons:[{text:at("ui.onboarding.tour.action.finish"),classes:"shepherd-button-primary",action:function(){this.complete()}}]}],aQ=()=>({enabled:!0,label:h("ui.onboarding.tour.action.close")}),FA=new WeakMap,$ct=(e,t)=>{FA.set(e,t)},qct=(e,t)=>{if(FA.get(e)===t)return;const n=new Map(iQ().filter(r=>r.id).map(r=>[r.id,r])),s=aQ();for(const r of e.steps){const i=r.id?n.get(r.id):void 0;i&&r.updateStepOptions({title:i.title,text:i.text,buttons:i.buttons,cancelIcon:s})}e.options.defaultStepOptions={...e.options.defaultStepOptions,cancelIcon:s},FA.set(e,t)},N5=new WeakMap,Kct=e=>{const t=N5.get(e);if(t)return t;const n=()=>rQ(e);return N5.set(e,n),n},Yct=()=>{const e=si(),{completeTourOnboarding:t}=z0(),n=m.useContext(n1),s=Ve(),r={cancelIcon:aQ(),scrollTo:{behavior:"smooth",block:"center"}},i=!0,a=o=>{if(n?.tour?.isActive()&&!o?.forceModalCompleted){console.log("Onboarding tour is already active (from context.tour). Not starting another.");return}const l=z0.getState();if(!o?.forceModalCompleted&&!l.isModalComplete){console.log("Onboarding modal not completed (checked via store). Tour will not start.");return}if(l.isTourComplete&&!o?.forceModalCompleted){console.log("Onboarding tour already completed in store and not forced. Not starting again.");return}let u=n?.tour;const d=n?.Shepherd;if(!u&&d&&(u=d.activeTour,!u&&d.Tour&&(console.log("No active Shepherd tour found from context or global. Creating a new one."),u=new d.Tour({useModalOverlay:i,defaultStepOptions:r}))),!u){console.warn("Failed to get or create a Shepherd tour instance.",n);return}if(u.isActive()){console.log("Tour is already active. Not starting again.");return}u.options.defaultStepOptions={...u.options.defaultStepOptions||{},...r},u.options.useModalOverlay=i,o?.firstAgentId&&(u.options.firstAgentId=o.firstAgentId),u.off("complete",t),u.on("complete",t),u.off("cancel",t),u.on("cancel",t);const f=Kct(u);u.off("complete",f),u.on("complete",f),u.off("cancel",f),u.on("cancel",f),u.off("show",I5),u.on("show",I5);const p=iQ();if(o?.forceModalCompleted||!u.isActive()){const g=[...u.steps];for(const v of g)v.id&&u.removeStep(v.id);u.addSteps(p)}else u.steps.length===0&&u.addSteps(p);$ct(u,Xm()),typeof u.start=="function"?(e("/"),u.start()):console.warn("Shepherd tour instance does not have a start method.",u)};return m.useEffect(()=>{const o=n?.tour??n?.Shepherd?.activeTour;o?.isActive()&&qct(o,s)},[s,n]),{startTour:a}},Xct=()=>{const{isModalComplete:e,isTourComplete:t}=z0(),{startTour:n}=Yct(),s=rt.useContext(n1),{data:r}=AT(1,1);return m.useEffect(()=>{if(e&&!t&&s){const i=setTimeout(()=>{const a=r?.agents?.[0]?.id;n({firstAgentId:a})},500);return()=>clearTimeout(i)}},[e,t,s,n,r]),null},Qct=({children:e})=>c.jsxs(Lct,{children:[e,c.jsx(Xct,{})]}),Jct=()=>{Ve();const{open:e,focusGroup:t,providerId:n,closeConnect:s}=z8(),r=m.useRef(null);m.useEffect(()=>{e&&(r.current=document.activeElement instanceof HTMLElement?document.activeElement:null)},[e]);const i=si();return c.jsx(Gc,{open:e,onOpenChange:a=>{a||s()},children:c.jsxs(Vc,{className:"max-h-[calc(100vh-4rem)] max-w-[min(40rem,calc(100vw-4rem))] gap-4 overflow-y-auto","data-connect-provider-dialog":"",onCloseAutoFocus:a=>{const o=r.current;r.current=null,o?.isConnected&&(a.preventDefault(),o.focus())},children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx(Ol,{className:"text-title",children:h("ui.providers.connect_provider_dialog.connect_a_model_provider")}),c.jsx(ud,{className:"text-body-sm text-ink-muted",children:h("ui.providers.connect_provider_dialog.your_agents_need_a_model_to_think")})]}),e?c.jsx(IX,{context:"dialog",featuredOnly:!0,focusGroup:t,initialProviderId:n,onDone:s,onChangeModel:()=>{s(),i("/settings")}}):null]})})};function Zct(){const{visible:e,rows:t,cursor:n,commitAt:s,hoverAt:r}=Lle();Du(e,"session-switcher");const i=n!==null&&e?t[n]??null:null,a=e&&t.length>=2;return c.jsxs(c.Fragment,{children:[c.jsx("output",{"aria-live":"polite",className:"sr-only","data-session-switcher-announcement":"",children:i!==null&&n!==null?c.jsxs(c.Fragment,{children:[oQ(i),", ",n+1," / ",t.length]}):null}),a?Zv.createPortal(c.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 flex items-start justify-center pt-[18vh]",children:c.jsx("div",{role:"dialog","aria-modal":"false","aria-label":h("ui.command_palette.palette_search.recents"),"data-lo-floating":"",className:"pointer-events-auto w-160 max-w-[90vw] rounded-lg bg-elevated p-2 shadow-overlay","data-glass-overlay":"",children:t.map((o,l)=>c.jsx(nut,{row:o,active:l===n,onCommit:()=>s(l),onHover:()=>r(l)},o.sessionId))})}),document.body):null]})}function oQ(e){return e.title??h("ui.command_palette.palette_search.untitled_chat")}const eut=1e3;function tut(){let e=0;function t(){window.clearTimeout(e),window.removeEventListener("contextmenu",n,!0),window.removeEventListener("pointerup",t,!0)}function n(s){s.preventDefault(),s.stopPropagation(),t()}e=window.setTimeout(t,eut),window.addEventListener("contextmenu",n,!0),window.addEventListener("pointerup",t,!0)}function nut({row:e,active:t,onCommit:n,onHover:s}){return c.jsxs("button",{type:"button",tabIndex:-1,"aria-current":t?"true":void 0,"data-session-id":e.sessionId,onPointerDown:r=>{r.button===0&&(r.preventDefault(),tut(),n())},onMouseDown:r=>r.preventDefault(),onContextMenu:r=>r.preventDefault(),onMouseMove:s,className:R("flex h-9 w-full items-center gap-3 rounded-sm px-2 text-left",t?"bg-sunken outline-solid outline-1 -outline-offset-1 outline-control":"bg-transparent"),children:[e.row===null?c.jsx("span",{"aria-hidden":"true",className:"size-4 shrink-0"}):c.jsx(Q0,{row:e.row}),c.jsx("span",{className:R("min-w-0 flex-1 truncate text-body-sm",e.title===null?"text-ink-muted":"text-ink"),children:oQ(e)})]})}const lQ=({title:e,description:t,icon:n,children:s,titleComponent:r,sectionRef:i,dataTourTag:a,className:o,id:l,searchSection:u,searchSectionLabel:d,searchIgnore:f})=>c.jsxs("div",{ref:i,id:l,"data-search-section":u,"data-search-section-label":d,"data-search-ignore":f,tabIndex:l?-1:void 0,"data-tour-tag":a,className:R("w-full",o),children:[r??c.jsxs("h2",{className:"flex items-center gap-2 text-heading text-ink",children:[n&&c.jsx(n,{size:16,className:"shrink-0 text-ink-dim"}),e]}),t&&c.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:t}),c.jsx("div",{className:"mt-4",children:s})]}),Tgt=({label:e,value:t,className:n,valueClassName:s})=>c.jsxs("div",{className:R("min-w-0",n),children:[c.jsx("div",{className:"flex items-center gap-1.5 text-meta text-ink-dim",children:e}),c.jsx("div",{className:R("mt-0.5 break-words text-body-sm",s??"text-ink"),children:t})]}),Rgt=({children:e,className:t})=>c.jsx("div",{className:R("grid grid-cols-[repeat(auto-fit,minmax(160px,1fr))] gap-x-6 gap-y-4",t),children:e});function cQ({id:e,rank:t,action:n,settingKey:s,help:r,hint:i,ariaLabel:a,value:o,fieldRef:l,saving:u,showReset:d,onReset:f,onKeyDown:p,onKeyUp:g,onBlur:v,notes:b,error:_,focusKey:x}){const w=m.useRef(!1);return m.useEffect(()=>{if(x!==s||w.current)return;const y=l.current;y&&(w.current=!0,y.scrollIntoView?.({block:"center"}),y.focus())},[x,s,l]),c.jsxs("div",{className:"group flex min-w-0 flex-col gap-1","data-speech-rank":t,"data-search-row":`keyboard.${s}`,"data-search-label":n,"data-search-terms":s,"data-search-control":!0,children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsxs("div",{className:"flex w-32 flex-col",children:[c.jsx(gr,{htmlFor:e,className:"text-body-sm text-ink",children:t==="primary"?h("ui.settings.shortcuts.speech.primary"):h("ui.settings.shortcuts.speech.secondary")}),c.jsx("span",{className:"text-meta text-ink-muted",children:n})]}),c.jsx(ks,{ref:l,id:e,"aria-label":a,"aria-describedby":`${e}-hint ${e}-notes ${e}-status`,"aria-invalid":_?!0:void 0,"aria-busy":u,"data-shortcut-action":s,className:"w-52 text-left font-mono text-body-sm",value:o,readOnly:!0,onKeyDown:p,onKeyUp:g,onBlur:v}),d&&c.jsx(ue,{variant:"secondary",size:"sm",disabled:u,"aria-label":h("ui.settings.shortcuts.keyboard_shortcuts_section.reset_label_to_its_default",{label:n}),onClick:f,children:h("ui.settings.shortcuts.keyboard_shortcuts_section.reset")})]}),c.jsxs("div",{className:"ml-0 max-w-88 text-meta text-ink-muted sm:ml-34",children:[c.jsx("p",{children:r}),c.jsx("p",{id:`${e}-hint`,className:"hidden group-focus-within:block",children:i}),c.jsx("div",{id:`${e}-notes`,children:b}),c.jsx("output",{id:`${e}-status`,className:"block","aria-live":"polite",children:u?h("ui.settings.configuration.backend_setting_row.saving"):_?c.jsx("span",{className:"text-danger",children:_}):null})]})]})}function uQ({settingKey:e,refetch:t,fieldRef:n,onPending:s,onSaved:r}){const[i,a]=m.useState(!1),[o,l]=m.useState(null),[u,d]=m.useState(!1);return m.useEffect(()=>{!u||i||(n.current?.focus(),d(!1))},[u,i,n]),{saving:i,error:o,setError:l,write:async(p,g)=>{if(!(e===void 0||i||p==="settings.edit"&&g===void 0)){a(!0),l(null),s?.(g);try{await et(p==="settings.edit"?{op:p,key:e,value:g??""}:{op:p,key:e}),r?.(p,g),await t()}catch(v){let b;if(v instanceof Wi){const _=v.detail;typeof _=="object"&&_!==null&&"code"in _&&_.code==="keymap.conflict"&&"label"in _&&typeof _.label=="string"&&(b=h("ui.settings.shortcuts.capture.already_assigned",{label:_.label}))}l(b??(v instanceof Error?v.message:h(p==="settings.edit"?"ui.settings.configuration.backend_settings_section.the_setting_could_not_be_saved":"ui.settings.configuration.backend_settings_section.the_setting_could_not_be_reset")))}finally{s?.(),a(!1),d(!0)}}}}}function dQ(e,t,n,s=[]){const r=/^(Alt|Meta|Control)/.exec(e)?.[1],i=o=>r==="Control"?o.includes("ctrl")||o.includes("primary"):r==="Meta"?o.includes("meta")||t==="darwin"&&o.includes("primary"):r==="Alt"&&o.includes("alt"),a=o=>o.split("+").slice(0,-1);return s.find(o=>i(a(o)))??n.find(o=>i(a(o)))??null}function sut(e,t,n){const s=e.split("+"),r=s.at(-1)??"",i=o=>o==="primary"?t==="Control"||t==="Command"?t:n==="darwin"?"Command":"Control":o==="ctrl"?"Control":o==="shift"?"Shift":o==="alt"?n==="darwin"?"Option":"Alt":o==="meta"?n==="darwin"?"Command":n==="win32"?"Windows":"Super":o,a=r.length===1?r.toUpperCase():r.charAt(0).toUpperCase()+r.slice(1);return[...s.slice(0,-1).map(i),a].join("+")}function rut(e,t,n,s){for(const r of["AltRight","ControlRight","MetaRight"]){const i=Q8(r,t);if(i===null)continue;const a=Hd(i);if(!(!a||a.code===e)&&!dQ(r,t,n,s))return a.label}return null}const iut=/^(Alt|Meta|Control|Shift)(Left|Right)$/,mE=e=>e.split("-").slice(1).join("-");function aut({setting:e,refetch:t,focusKey:n}){const s=y2(),r=tt(A=>A.shortcutBindings),i=m.useRef(null),a=m.useId(),o=m.useMemo(()=>Ioe(),[]),l=m.useRef(null),u=typeof e.default=="string"?e.default:MP,{saving:d,error:f,setError:p,write:g}=uQ({settingKey:e.key,refetch:t,fieldRef:i,onSaved:(A,F)=>Noe(A==="settings.edit"?F:u)}),v=h("ui.settings.shortcuts.speech.push_to_talk_hold"),b=typeof e.value=="string"?e.value:"",_=Hd(b)??Hd(u)??Hd(MP),x=Hd(b)?.code===Hd(u)?.code,w=Ey.flatMap(A=>{const F=zA(A.id,r);return F?[F]:[]}),y=s.canonical?[s.canonical]:[],S=_===null?null:dQ(_.code,o,w,y),C=S===null||_===null?null:rut(_.code,o,w,y),k=h("ui.settings.shortcuts.speech.push_to_talk_letter_pointer"),T=()=>p(h("ui.settings.shortcuts.speech.push_to_talk_refused",{platform:o}));return c.jsx(cQ,{id:a,rank:"secondary",action:v,settingKey:e.key,focusKey:n,help:e.help,hint:`${h("ui.settings.shortcuts.speech.push_to_talk_hint")} ${k}`,ariaLabel:h("ui.settings.configuration.setting_control.label_press_the_key_you_want",{label:v}),value:_?.label??"",fieldRef:i,saving:d,showReset:!x,onReset:()=>void g("settings.reset"),onBlur:()=>{l.current=null,p(null)},onKeyDown:A=>{if(d)return;if(A.repeat||A.nativeEvent.isComposing){WE.has(A.key)||A.preventDefault();return}const F=l.current!==null;if(l.current&&(l.current.tainted=!0),WE.has(A.key)){F&&T();return}if(Ux.has(A.key)){l.current=null,p(null),A.preventDefault();return}if(A.preventDefault(),F||!iut.test(A.code)){F||(l.current=null),T();return}p(null),l.current={code:A.code,tainted:!1}},onKeyUp:A=>{const F=l.current;if(!F||A.code!==F.code||(l.current=null,F.tainted||d))return;const I=Q8(F.code,o);if(I===null){T();return}Hd(I)?.code!==_?.code&&g("settings.edit",I)},notes:S!==null&&_!==null&&c.jsx("p",{children:h("ui.settings.shortcuts.speech.push_to_talk_overlap",{modifier:mE(_.label),example:sut(S,mE(_.label),o),alternative:C?mE(C):"none"})}),error:f})}function out({setting:e,refetch:t,focusKey:n}){const s=m.useRef(!1),r=y2(),i=m.useRef(null),a=m.useId(),o=m.useMemo(()=>mg(),[]),{saving:l,error:u,setError:d,write:f}=uQ({settingKey:e.key,refetch:t,fieldRef:i,onPending:S=>window.api?.recordingShortcut?.markPending(S)}),p=h("ui.settings.shortcuts.speech.start_recording_press"),g=typeof e.value=="string"?e.value:r.value,v=r.problem?r.value:g,b=typeof e.default=="string"?e.default:Poe,_=Wb(g)===Wb(b),x=S=>h("ui.settings.shortcuts.capture.already_assigned",{label:S}),w=h("ui.chat.composer.start_recording"),y=h("ui.settings.shortcuts.keyboard_shortcuts_section.press_the_keys_you_want_esc_cancels");return c.jsx(cQ,{id:a,rank:"primary",action:p,settingKey:e.key,focusKey:n,help:e.help,hint:y,ariaLabel:h("ui.settings.shortcuts.keyboard_shortcuts_section.label_press_the_keys_you_want",{label:p}),value:yH(v,o),fieldRef:i,saving:l,showReset:!_,onReset:()=>void f("settings.reset"),onKeyUp:S=>{!Dm.has(S.key)||!s.current||(s.current=!1,d(h("ui.settings.shortcuts.speech.start_recording_needs_key")))},onBlur:()=>{s.current=!1},onKeyDown:S=>{if(l)return;if(S.repeat&&Dm.has(S.key)){S.preventDefault();return}if(s.current=Dm.has(S.key),Ux.has(S.key)||Dm.has(S.key)){Ux.has(S.key)&&d(null),S.preventDefault();return}const C=C2(S);if(C===null)return;if(S.preventDefault(),Wb(C)===Wb(g)){d(null);return}const k=tt.getState().shortcutBindings,T=J8(r,x(w));for(const F of Ey){const I=k[F.id]??F.defaultChord;I&&T.set(I,F.label)}const A=CH(C,"panel.console",{},o,T);if(A!==null){d(A);return}f("settings.edit",C)},notes:c.jsxs(c.Fragment,{children:[r.shadowedBy&&!u&&c.jsx("output",{className:"block text-danger",children:h("ui.settings.shortcuts.recording.inactive_claimed",{label:r.shadowedBy})}),r.problem&&!u&&c.jsx("output",{className:"block text-danger",children:h("ui.settings.shortcuts.recording.invalid_stored_value")})]}),error:u})}function lut({focusKey:e}){const{client:t,provided:n}=Hee(),s=Mn({queryKey:Yo.settings,queryFn:()=>et({op:"settings.list"}),enabled:n,staleTime:1e4},t),r=l=>s.data?.settings.find(u=>u.key===l),i=r(Moe),a=r(Ooe);if(!n)return null;const o=c.jsx("h3",{className:"pt-1 text-body-sm font-medium text-ink",children:h("ui.settings.shortcuts.category.speech_to_text")});return!i&&!a?s.isPending?c.jsx("div",{className:"min-h-24 space-y-3","aria-busy":"true",children:o}):null:c.jsxs("div",{className:"space-y-3","data-shortcut-recording":!0,children:[o,i&&c.jsx(out,{setting:i,refetch:s.refetch,focusKey:e}),a&&c.jsx(aut,{setting:a,refetch:s.refetch,focusKey:e})]})}const hQ=e=>{switch(e.id){case"panel.console":return h("ui.settings.shortcuts.row.console");case"panel.canvas":return h("ui.settings.shortcuts.row.canvas");case"panel.run":return h("ui.settings.shortcuts.row.execution");case"panel.ask":return h("ui.settings.shortcuts.row.asks");case"panel.browser":return h("ui.settings.shortcuts.row.browser");case"panel.code":return h("ui.settings.shortcuts.row.code_review")}},cut=()=>h("ui.chat.composer.start_recording");function uut(){m.useEffect(()=>{let e=0;const t=()=>{const r=tt.getState().shortcutBindings,i=new Map(Uee);for(const a of Ey){const o=zA(a.id,r);if(!o)continue;const l=hQ(a);for(const u of Loe(o,mg()))i.set(u,l)}window.api?.recordingShortcut?.syncClaims(++e,[...i].map(([a,o])=>({chord:a,label:o})))};t();const n=tt.subscribe((r,i)=>{r.shortcutBindings!==i.shortcutBindings&&t()}),s=_J(t);return()=>{n(),s()}},[])}const dut=({action:e})=>{const t=y2(),n=J8(t,cut());Ve();const s=m.useId(),r=m.useRef(null),i=tt(_=>_.shortcutBindings),a=i[e.id],o=tt(_=>_.setShortcutBinding),l=tt(_=>_.clearShortcutBinding),[u,d]=m.useState(!1),[f,p]=m.useState(null),g=m.useMemo(mg,[]),v=zA(e.id,i),b=hQ(e);return c.jsxs("div",{"data-search-row":`keyboard.${e.id}`,"data-search-control":!0,className:"flex flex-col gap-1",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(gr,{htmlFor:s,className:"w-32 text-body-sm text-ink",children:b}),c.jsx(ks,{id:s,readOnly:!0,value:v===null?h("ui.settings.shortcuts.keyboard_shortcuts_section.no_shortcut"):yH(v,g),"aria-label":h("ui.settings.shortcuts.keyboard_shortcuts_section.label_press_the_keys_you_want",{label:String(b)}),"data-shortcut-action":e.id,ref:r,className:R("w-52",v===null?"text-body-sm":"font-mono text-body-sm"),onFocus:()=>d(!0),onBlur:()=>{d(!1),p(null)},onKeyDown:_=>{if(WE.has(_.key))return;if(Ux.has(_.key)){d(!1),p(null);return}if(Dm.has(_.key)||_.nativeEvent.isComposing)return;const x=C2({key:_.key,code:_.code,metaKey:_.metaKey,ctrlKey:_.ctrlKey,altKey:_.altKey,shiftKey:_.shiftKey}),w=CH(x,e.id,i,g,n);if(w!==null){_.preventDefault(),d(!0),p(w);return}if(x===v){d(!0),p(null);return}_.preventDefault(),d(!0),p(null),x===e.defaultChord?o(e.id,null,n):x!==null&&o(e.id,x,n)}}),v!==null&&c.jsx(ue,{variant:"secondary",size:"sm","aria-label":h("ui.settings.shortcuts.keyboard_shortcuts_section.clear_label_s_shortcut",{label:String(b)}),onClick:()=>{l(e.id),r.current?.focus()},children:h("ui.settings.shortcuts.keyboard_shortcuts_section.clear")}),a!==void 0&&c.jsx(ue,{variant:"secondary",size:"sm","aria-label":h("ui.settings.shortcuts.keyboard_shortcuts_section.reset_label_to_its_default",{label:String(b)}),onClick:()=>{o(e.id,null,n),r.current?.focus()},children:h("ui.settings.shortcuts.keyboard_shortcuts_section.reset")})]}),u&&c.jsx("span",{className:"text-meta text-ink-dim",children:h("ui.settings.shortcuts.keyboard_shortcuts_section.press_the_keys_you_want_esc_cancels")}),f!==null&&c.jsx("output",{className:"text-meta text-danger",children:f})]})},Agt=({sectionRef:e,focusKey:t})=>(Ve(),c.jsx(lQ,{title:h("ui.settings.shortcuts.keyboard_shortcuts_section.keyboard_shortcuts"),icon:RG,description:h("ui.settings.shortcuts.keyboard_shortcuts_section.shortcut_capture_description"),sectionRef:e,searchSection:"keyboard",searchSectionLabel:h("ui.settings.navigation.settings_sidebar.keyboard_shortcuts"),children:c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsx("p",{"data-shortcut-note":"browser-scope",className:"max-w-2xl text-body-sm text-ink-muted",children:h("ui.settings.shortcuts.keyboard_shortcuts_section.browser_shortcuts_answer_only_while_the_browser_has_focus")}),c.jsx(lut,{focusKey:t}),c.jsx("h3",{className:"pt-1 text-body-sm font-medium text-ink",children:h("ui.settings.shortcuts.category.panels")}),c.jsx("div",{className:"flex flex-col gap-4",children:Ey.map(n=>c.jsx(dut,{action:n},n.id))})]})}));async function hut(e){await et({op:"settings.edit",key:Tl,value:e.value}),Hoe(e.queryClient)}async function fQ(e){await hut(e),e.queryClient.setQueryData(Gx.all,t=>t&&{...t,settings:t.settings.map(n=>n.key===Tl?{...n,value:e.value,is_default:e.value===n.default}:n)});try{return await e.queryClient.fetchQuery({queryKey:Gx.all,queryFn:()=>et({op:"settings.list"}),staleTime:0,retry:!1}),"confirmed"}catch{return"readback-unknown"}}const Fgt=({focus:e=!1,focusNonce:t})=>{Ve();const n=Nt(),s=zn(),r=vt(s.data,"settings"),i=Mn({queryKey:Gx.all,queryFn:()=>et({op:"settings.list"}),enabled:r,retry:!1,refetchOnReconnect:!0}),a=i.data?.settings.find(I=>I.key===Tl),[o,l]=m.useState(!1),[u,d]=m.useState(null),[f,p]=m.useState(!1),[g,v]=m.useState(!1),b=m.useRef(!1),_=m.useRef(null),x=m.useRef(!1),w=m.useRef(t);m.useEffect(()=>{t!==w.current&&(w.current=t,x.current=!1)},[t]),m.useEffect(()=>{if(!e){x.current=!1;return}!a||x.current||(_.current?.querySelector("[role=combobox]")?.focus(),x.current=!0)},[e,t,a]),m.useEffect(()=>{i.isSuccess&&!i.isFetching&&p(!1)},[i.isFetching,i.isSuccess]);const y=async I=>{if(!(!a||b.current||f||!a.choices.some(N=>N.value===I))){b.current=!0,l(!0),d(null),v(!1);try{const N=await fQ({value:I,queryClient:n});p(N==="readback-unknown"),v(N==="confirmed")}catch(N){d({value:I,message:N instanceof Error?N.message:""})}finally{b.current=!1,l(!1)}}},S=async()=>{const[I,N]=await Promise.all([i.refetch(),s.refetch()]);!I.isError&&!N.isError&&p(!1)},C=!i.data&&i.error||!s.data&&s.error,k=s.data&&(!r||i.data&&!a),T=!C&&!k&&!a,A=s.data?.features?.i18n?s.data.language:void 0,F=typeof A=="string"&&A!==""?A:void 0;return c.jsx(lQ,{title:h("ui.settings.language.dialog.title"),icon:AG,description:h("ui.settings.language.general.description"),children:c.jsxs("div",{ref:_,"data-setting-key":Tl,"data-search-row":"general.language","data-search-control":!0,className:"flex flex-col gap-3","aria-busy":o,children:[T&&c.jsx("output",{className:"text-meta text-ink-dim",children:h("ui.settings.language.dialog.loading")}),k&&c.jsx("p",{className:"text-meta text-ink-dim",children:h("ui.settings.language.dialog.unavailable")}),a&&c.jsx(Z8,{setting:{...x2(a),label:h("ui.settings.language.dialog.title")},value:String(a.value),onValueChange:I=>{y(I)},disabled:o||f,suppressEffectiveNote:!0}),c.jsx("output",{id:Boe(Tl),"aria-live":"polite",className:"text-meta text-ink-dim",children:o?h("ui.settings.language.general.pending"):g?h("ui.settings.language.general.saved"):F?h(f||s.error?"ui.settings.language.general.last_known":"ui.settings.language.general.effective",{locale:joe(F)?.name??F}):h("ui.settings.language.general.no_resolution")}),(C||u||f)&&c.jsx(yr,{variant:"danger",children:c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("p",{role:"alert",children:u?h("ui.settings.language.general.write_error",{message:u.message}):f?h("ui.settings.language.general.readback_error"):h("ui.settings.language.dialog.unavailable")}),c.jsx(ue,{variant:"outline",size:"sm",disabled:o||i.isFetching||s.isFetching,onClick:()=>{u?y(u.value):S()},children:h("ui.settings.language.dialog.retry")})]})})]})})},fut=()=>{Ve();const e=Cx(M=>M.open),t=Cx(M=>M.closeLanguage),n=Nt(),s=zn(),r=vt(s.data,"settings"),i=Mn({queryKey:Gx.all,queryFn:()=>et({op:"settings.list"}),enabled:e&&r,staleTime:1e4}),a=m.useRef(null),o=D8(),l=(i.data?.settings??[]).find(M=>M.key===Tl),u=l?x2(l):void 0,[d,f]=m.useState(!1),[p,g]=m.useState(!1),[v,b]=m.useState(null),[_,x]=m.useState(!1),w=m.useRef(!1);m.useEffect(()=>{e&&(g(!1),b(null))},[e]);const y=String(u?.value??""),S=async M=>{if(!(!u||w.current||_||!u.choices.some(X=>X.value===M))){w.current=!0,f(!0),b(null),g(!1);try{const X=await fQ({value:M,queryClient:n});x(X==="readback-unknown"),g(X==="confirmed")}catch(X){const se=X instanceof Error?X.message:"";b({value:M,message:se}),Cx.getState().open||fn(h("ui.settings.language.general.write_error",{message:se}))}finally{w.current=!1,f(!1)}}},C=async()=>{const[M,X]=await Promise.all([i.refetch(),s.refetch()]);!M.isError&&!X.isError&&x(!1)},k=!!s.data,T=k&&!r,A=s.error&&!s.data?s.error:null,F=A??(i.data?null:i.error),I=!k&&!F,{sentence:N,remedy:P}=Gee(o??null,h("ui.settings.configuration.language_dialog.your_settings_could_not_be_loaded"),F),O=s.isFetching||i.isFetching,j=u?"combo":F?"retry":"none";return m.useEffect(()=>{!e||j==="none"||requestAnimationFrame(()=>{a.current?.querySelector(j==="combo"?'[role="combobox"]':"[data-language-retry]")?.focus()})},[e,j]),c.jsx(Gc,{open:e,onOpenChange:M=>!M&&t(),children:c.jsxs(Vc,{ref:a,onOpenAutoFocus:M=>M.preventDefault(),className:"max-w-[min(28rem,calc(100vw-4rem))] gap-4",children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx(Ol,{className:"text-title",children:h("ui.settings.language.dialog.title")}),c.jsx(ud,{className:"text-body-sm text-ink-muted",children:h("ui.settings.language.dialog.description")})]}),I?c.jsxs("div",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[c.jsx(Pn,{}),h("ui.settings.language.dialog.loading")]}):T?c.jsx(yr,{variant:"warning",children:c.jsx("span",{children:h("ui.settings.language.dialog.unavailable")})}):F?c.jsx(yr,{variant:"warning",children:c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("span",{children:N}),P&&c.jsx(ue,{variant:"tonal",size:"sm",className:"shrink-0","data-language-retry":"",onClick:()=>{A?s.refetch():i.refetch()},disabled:O,children:O?h("ui.settings.language.dialog.retrying"):h("ui.settings.language.dialog.retry")})]})}):i.isPending?c.jsxs("div",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[c.jsx(Pn,{}),h("ui.settings.language.dialog.loading")]}):u?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{id:OP(Tl),className:"text-meta text-ink-dim",children:u.help}),c.jsx(Z8,{setting:u,value:y,disabled:d||_,helpId:OP(Tl),effectiveNoteId:Uoe(Tl,Goe),onValueChange:M=>{S(M)}})]}),v&&c.jsx(yr,{variant:"danger",children:c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("p",{role:"alert",children:h("ui.settings.language.general.write_error",{message:v.message})}),c.jsx(ue,{variant:"outline",size:"sm",disabled:d||i.isFetching,onClick:()=>{S(v.value)},children:h("ui.settings.language.dialog.retry")})]})}),_&&c.jsx(yr,{variant:"danger",children:c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("p",{role:"alert",children:h("ui.settings.language.general.readback_error")}),c.jsx(ue,{variant:"outline",size:"sm",disabled:d||i.isFetching||s.isFetching,onClick:()=>{C()},children:h("ui.settings.language.dialog.retry")})]})}),c.jsx("div",{className:"flex min-h-8 items-center justify-end",children:d?c.jsx("output",{"aria-live":"polite",className:"text-body-sm text-ink-muted",children:h("ui.settings.language.general.pending")}):p?c.jsxs("output",{"data-language-status":"","aria-live":"polite",className:"inline-flex items-center gap-1.5 text-body-sm text-ink",children:[c.jsx(mr,{"aria-hidden":"true",className:"size-3.5"}),h("ui.settings.language.dialog.saved")]}):null})]}):c.jsx(yr,{variant:"warning",children:c.jsx("span",{children:h("ui.settings.language.dialog.unavailable")})})]})})},P5=e=>{const t=zoe(e.type),n=typeof e.percent=="number"?`, ${Math.round(e.percent)}%`:"";return h("ui.common.updates.update_foot_icon.in_progress",{subject:t,percent:n})},pQ=e=>Woe({type:e.type,version:e.offer.version}),put=e=>{const t=e.map(s=>pQ(s)),n=t.slice(1).reduce((s,r)=>h("ui.common.updates.update_foot_icon.subject_join",{left:s,right:`${r.charAt(0).toLowerCase()}${r.slice(1)}`}),t[0]);return h("ui.common.updates.update_foot_icon.available_show_the_update_notice",{joined:n})},gut=({surfaces:e,inflight:t,onShow:n,onDismiss:s})=>{if(Ve(),t===null&&e.length===0)return null;if(t!==null)return c.jsx(bt,{side:"top",collisionPadding:8,content:P5(t),children:c.jsx("output",{"data-update-foot-icon":"","data-update-foot-icon-state":"inflight","aria-label":P5(t),className:"flex size-8 shrink-0 items-center justify-center text-accent",children:c.jsx(yi,{className:"size-4 shrink-0 motion-safe:animate-spin","aria-hidden":"true"})})});const r=e.find(i=>(i.offer.summary??"").trim()!=="");return c.jsx(bt,{side:"top",collisionPadding:8,content:c.jsxs("div",{className:"flex max-w-64 flex-col gap-0.5",children:[e.map(i=>c.jsxs("span",{className:"truncate text-ink",children:[pQ(i)," ",h("ui.common.updates.update_foot_icon.available")]},i.type)),r?c.jsx("span",{className:"truncate text-ink-muted",children:(r.offer.summary??"").trim()}):null,e.every(i=>i.offer.nonDisruptive===!0)?c.jsx("span",{className:"text-ink-muted",children:h("ui.common.updates.update_foot_icon.sessions_keep_running")}):null,c.jsx("span",{className:"whitespace-nowrap text-ink-muted",children:h("ui.common.updates.update_foot_icon.show_the_update_notice")})]}),children:c.jsx("button",{type:"button","data-update-foot-icon":"","data-update-foot-icon-state":"available","aria-label":put(e),onClick:n,onKeyDown:i=>{i.key!=="Escape"||!s||(i.stopPropagation(),s())},className:R("flex size-8 shrink-0 items-center justify-center rounded-sm text-accent","transition-colors duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink"),children:c.jsx(d2,{className:"size-4 shrink-0","aria-hidden":"true"})})})},gQ=()=>{const e=Or(g=>g.followed),t=Or(g=>g.running),n=Or(g=>g.offers),s=Or(g=>g.detailOpen),r=Or(g=>g.inflight),i=Or(g=>g.downloadPercent),a=Or(g=>g.openNotice),o=Or(g=>g.noticeOpen),l=Or(g=>g.dismissNotice),u=m.useMemo(()=>{const g={followed:e,running:t,offers:n,detailOpen:s};return IH.filter(v=>Voe(g,v)).map(v=>{const b=n[v];return b?{type:v,offer:b}:null}).filter(v=>v!==null)},[e,t,n,s]),d=m.useMemo(()=>r[Dn.BACKEND]?{type:Dn.BACKEND,percent:null}:r[Dn.UI]?{type:Dn.UI,percent:i[Dn.UI]}:null,[r,i]),f=m.useCallback(()=>a(),[a]),p=m.useCallback(()=>l(),[l]);return c.jsx(gut,{surfaces:u,inflight:d,onShow:f,onDismiss:o?p:void 0})},mQ="px-2",DA=new WeakMap,mut=64,vut=1024*1024,but=3e3;function _ut(e){const t=DA.get(e);if(t)return t;const n=new Map;DA.set(e,n);let s=hp(e);return b2(e,()=>{const r=hp(e);if(r===s)return;s=r;const i=[...n.values()];n.clear();for(const a of i){a.url&&Hx(a.url),a.url=void 0;for(const o of a.listeners)o()}}),n}function xut(e){if(e.size<mut)return!0;for(const[t,n]of e)if(!(n.listeners.size||n.promise))return n.url&&Hx(n.url),e.delete(t),!0;return!1}const wut=hX;function Dgt(e,t){const n=vQ(t),s=yut(),r=e?pX(e):null,i=r?.src?.type==="endpoint"&&!s?null:r?.src,a=i?.type,o=i?.type==="account"?i.accountId:i?.type==="endpoint"?i.endpointId:void 0,l=i?.hash,u=m.useMemo(()=>a==="account"&&o&&l?{type:"account",accountId:o,hash:l}:a==="endpoint"&&o&&l?{type:"endpoint",endpointId:o,hash:l}:null,[a,o,l]);return bQ(u,n)}function vQ(e){return $oe(e,qoe())}function yut(){return B8("team_bridge_endpoint_avatar")}const Cut=/^(?:acc_[A-Za-z0-9_-]{1,64}|[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12})$/,Sut=/^[0-9a-f]{16}$/;function kut(e){const t=e?.id,n=e?.profile?.avatar;if(!t||!Cut.test(t)||!n||!n.hash||!Sut.test(n.hash)||n.source==="none")return null;if(e.avatar_url){const s=wut.exec(e.avatar_url);if(!s||s[1]!==t||s[2]!==n.hash)return null}return{accountId:t,hash:n.hash}}function Eut(e,t){const n=_g(),s=e?.id,r=e?.profile?.avatar?.hash,i=e?.profile?.avatar?.source,a=e?.avatar_url,o=m.useMemo(()=>kut({id:s,avatar_url:a,profile:{avatar:{hash:r,source:i}}}),[s,r,i,a]);return Tut(o&&o.accountId===n.accountId?o:null,t,{retryOnce:!0})}function Tut(e,t,n={}){const s=vQ(t),r=m.useMemo(()=>e?{type:"account",...e}:null,[e]);return bQ(r,s,n)}function bQ(e,t,n={}){const s=n.retryOnce===!0,r=Nt(),i=_g(),a=e?`${i.epoch}:${i.accountId??"none"}:${e.type}:${e.type==="account"?e.accountId:e.endpointId}:${e.hash}:${t}`:null,[,o]=m.useState(0),l=m.useRef(!0);if(m.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]),m.useEffect(()=>{if(!a||!e||!i.accountId)return;const u=_ut(r),d=u.get(a),f=d??{failed:!1,listeners:new Set,retried:!1},p=i.epoch,g=i.accountId,v=()=>{f.failed=!1,f.promise=(e.type==="endpoint"?Xn.endpointAvatarBytes({expectedAccountId:g,endpointId:e.endpointId,hash:e.hash,size:t}):Xn.avatarBytes({expectedAccountId:g,accountId:e.accountId,hash:e.hash,size:t})).then(({data:w,mimeType:y})=>{if(u.get(a)!==f)return;const S=ni(r);if(S.epoch!==p||S.accountId!==g){u.delete(a);return}if(!["image/png","image/jpeg"].includes(y)||w.byteLength===0||w.byteLength>vut)throw new Error("Invalid avatar bytes");f.url=y8(new Blob([w],{type:y}),y)}).catch(()=>{f.failed=!0}).finally(()=>{if(f.promise=void 0,u.get(a)===f)for(const w of f.listeners)w()})};if(!d){if(!xut(u))return;u.set(a,f),v()}let b=!1;const _=()=>{!s||!f.failed||f.promise||f.retried||(f.retried=!0,b=!0,f.retryTimer=setTimeout(()=>{if(f.retryTimer=void 0,b=!1,u.get(a)!==f||!f.failed)return;const w=ni(r);w.epoch!==p||w.accountId!==g||v()},but))};u.delete(a),u.set(a,f);const x=()=>{_(),l.current&&o(w=>w+1)};return f.listeners.add(x),_(),()=>{f.listeners.delete(x),b&&f.retryTimer&&(clearTimeout(f.retryTimer),f.retryTimer=void 0,f.retried=!1)}},[i.accountId,i.epoch,a,r,s,t,e]),!(!a||!i.accountId))return DA.get(r)?.get(a)?.url}const NI=rt.memo(({expanded:e,useAuth:t=!1})=>{const n=Py(),s=si(),{user:r,isAuthenticated:i,accountRead:a,signOut:o}=Qy(),l=a==="checking"?h("ui.shell.user_profile_sidebar.checking_account"):LP(a)?h("ui.shell.user_profile_sidebar.account_unavailable"):null,u=r?.name??l??h("ui.shell.user_profile_sidebar.user"),d=LP(a),f=r?.email??"",p=d?h("ui.shell.user_profile_sidebar.reconnect_radient"):f,g=d?"/settings?section=providers&provider=radient":"/settings",v=d?h("ui.shell.user_profile_sidebar.reconnect_radient"):h("ui.shell.user_profile_sidebar.account_settings"),b=m.useCallback(async()=>{i&&(await o(),window.location.reload())},[i,o]),_=m.useMemo(()=>{const S=r?.name;return S?S.split(" ").map(C=>C.charAt(0)).join("").toUpperCase().substring(0,2):null},[r?.name]),x=Eut(r?.radientUser.account,28),w=c.jsxs("button",{type:"button",onClick:t?void 0:()=>s(g),"aria-label":e?void 0:v,className:R("flex w-full min-w-0 items-center gap-2 rounded-sm transition-colors duration-fast ease-out-quart hover:bg-row-hover",e?"px-2 py-1.5":"justify-center py-1.5"),children:[c.jsxs(AH,{className:"size-7 shrink-0 rounded-full bg-media-surface",children:[x&&c.jsx(Dy,{src:x,alt:"",className:"lo-avatar-arrival"}),c.jsx(Iy,{className:"rounded-full bg-media-surface text-ink-muted",children:_??c.jsx(MG,{size:14,"aria-hidden":"true"})})]}),e&&u&&c.jsxs("span",{className:"min-w-0 text-start",children:[c.jsx("span",{className:"block truncate text-body-sm text-ink",children:u}),p&&c.jsx("span",{className:R("block truncate text-meta",d?"text-accent":"text-ink-dim"),children:p})]})]}),y=e?w:c.jsx(Iu,{content:v,side:n==="rtl"?"left":"right",children:w});return t?c.jsxs(Xo,{children:[e?c.jsx(_o,{asChild:!0,children:w}):c.jsx(Iu,{content:v,side:n==="rtl"?"left":"right",children:c.jsx(_o,{asChild:!0,children:w})}),c.jsxs(Qo,{align:"end",side:"top",className:"min-w-50",children:[d?c.jsxs(on,{onSelect:()=>s(g),children:[c.jsx(EH,{size:16,"aria-hidden":"true"}),h("ui.shell.user_profile_sidebar.reconnect_radient")]}):null,c.jsxs(on,{onSelect:()=>s("/settings"),children:[c.jsx(Ou,{size:16,"aria-hidden":"true"}),h("ui.shell.user_profile_sidebar.settings")]}),c.jsxs(on,{children:[c.jsx(nfe,{size:16,"aria-hidden":"true"}),h("ui.shell.user_profile_sidebar.privacy_and_security")]}),c.jsx(Wr,{}),c.jsxs(on,{onSelect:b,className:"text-danger focus:bg-danger-wash focus:text-danger",children:[c.jsx(Ahe,{size:16,"aria-hidden":"true"}),h("ui.shell.user_profile_sidebar.sign_out")]})]})]}):y});NI.displayName="UserProfileSidebar";const _Q=()=>{const e=si(),t=i9();return c.jsx(Iu,{content:h("ui.shell.sidebar_navigation.settings"),side:"top",children:c.jsx("button",{type:"button","data-tour-tag":"nav-item-settings",onClick:()=>e("/settings"),"aria-current":t==="settings"?"page":void 0,"aria-label":h("ui.shell.sidebar_navigation.settings"),className:R("flex size-8 shrink-0 items-center justify-center rounded-sm text-ink-muted","transition-colors duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink",t==="settings"&&"text-ink"),children:c.jsx(Ou,{size:16,"aria-hidden":"true"})})})},xQ=()=>c.jsxs("div",{className:R("flex min-h-10 shrink-0 items-center justify-between gap-1 pb-2",mQ),children:[c.jsx(NI,{expanded:!0}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(gQ,{}),c.jsx(_Q,{})]})]});function wQ(e){return Ne(t=>Vee(t.sessions,e))}const Rut=[];function yQ(){const{state:e}=cC(),t=e?.pendingConsent??Rut,n=C9(s=>zO(t,s));return m.useEffect(()=>{t.length>0&&J2()},[t]),zO(t,n)}const CQ={approvals:["desktop","mesh","approvals"]},Aut=15e3,Fut=new Set(["requested","approved","connecting","failed"]);function Dut(e){return Fut.has(e)}function Iut(e){return e==="requested"}function SQ(e){return e.filter(t=>Iut(t.state)).length}function Nut(e){return QN.test(e.requestDigest)&&QN.test(e.disclosureDigest)}function PI(e){return e.kind==="credential"&&e.typed!==void 0&&e.typed.action==="approve-credential"&&e.typed.operation!==null&&Nut(e.typed)}function vE(e,{credentialApprovals:t=!1,profileApprovals:n=!1}={}){return e.state!=="requested"?!1:e.kind==="profile"?n&&e.profile!==void 0&&e.profile.signable_here===!0&&e.profile.disclosure!=null&&e.profile.disclosure.operation===$A:e.kind==="credential"?t&&PI(e)&&e.typed.signableHere&&e.typed.disclosure?.operation===e.typed.operation:e.canApproveHere!==!1&&(e.kind==="device"||e.kind==="machine")}function Put(e,{profileApprovals:t=!1}={},n){return t&&e.kind==="profile"&&e.profile!==void 0&&(e.state==="approved"||e.state==="failed")&&(n??e.profile.apply_outcome?.retryable===!0)}function Mut(e,{credentialApprovals:t=!1}={},n){return t&&PI(e)&&(e.state==="approved"||e.state==="failed")&&(n??e.typed.applyOutcome?.retryable===!0)}function Igt(e,t,n={},s){const r=e.approvalId;return t==="deny"?{op:"approvals.deny",approvalId:r}:e.kind==="profile"?!(t==="approve"?vE(e,n):Put(e,n,s))||!e.profile?null:{op:t==="approve"?"approvals.approveOperation":"approvals.applyOperation",approvalId:r,operation:$A,requestDigest:e.profile.request_digest,disclosureDigest:e.profile.disclosure_digest??""}:e.kind==="device"||e.kind==="machine"?t==="approve"&&vE(e,n)?{op:"approvals.approve",approvalId:r}:null:!(t==="approve"?vE(e,n):Mut(e,n,s))||!PI(e)||e.typed.operation===null?null:{op:t==="approve"?"approvals.approveCredential":"approvals.applyCredential",approvalId:r,operation:e.typed.operation,requestDigest:e.typed.requestDigest,disclosureDigest:e.typed.disclosureDigest}}function Ngt(e){return Dut(e)}function Pgt(e){switch(e){case"requested":return h("ui.mesh.mesh_approvals.waiting_for_you");case"approved":return h("ui.mesh.mesh_approvals.approved");case"connecting":return h("ui.mesh.mesh_approvals.connecting");case"connected":return h("ui.mesh.mesh_approvals.connected");case"denied":return h("ui.mesh.mesh_approvals.denied");case"expired":return h("ui.mesh.mesh_approvals.expired");case"failed":return h("ui.mesh.mesh_approvals.failed");default:return e}}function Gr(e){return typeof e=="object"&&e!==null}function Out(e){const t=Gr(e)?e:{};return{deviceId:rn(t.device_id),name:rn(t.name),host:rn(t.host),user:rn(t.user),transport:rn(t.transport),hostKeyFp:rn(t.host_key_fp)}}function M5(e){return typeof e=="string"?e:""}function kQ(e){return $ee.includes(e)?e:null}function Lut(e){if(!Gr(e))return null;const t=kQ(e.operation);if(t===null)return null;const n=Gr(e.recipient)?e.recipient:{},s=Gr(e.grant_lifetime)?e.grant_lifetime:{},r=Gr(e.requires_capability)?e.requires_capability:{};return{operation:t,credentialKey:rn(e.credential_key),provider:rn(e.provider),account:rn(e.account),org:rn(e.org),scope:rn(e.scope),recipient:{deviceId:rn(n.device_id),name:rn(n.name),keyFingerprint:rn(n.key_fingerprint)},evidence:JSON.stringify(e,null,2),withdrawalCount:Array.isArray(e.withdrawals)?e.withdrawals.length:0,untilRevoked:s.kind==="until_revoked",futureLogins:e.future_logins!==!1,installsOrJoins:e.installs_or_joins!==!1,copiesCredential:typeof e.copies_credential=="boolean"?e.copies_credential:null,requiresCapability:rn(r.name)}}function EQ(e){return Gr(e)?{code:rn(e.code),retryable:e.retryable===!0,reason:rn(e.reason),remedy:rn(e.remedy)}:null}function But(e){if(Gr(e))return{action:rn(e.action),operation:kQ(e.operation),requestDigest:M5(e.request_digest),disclosureDigest:M5(e.disclosure_digest),disclosure:Lut(e.disclosure),assurance:rn(e.assurance),unprovenHuman:e.unproven_human!==!1,signableHere:e.signable_here===!0,refusal:rn(e.refusal),refusalMessage:rn(e.refusal_message),applyOutcome:EQ(e.apply_outcome),...Gr(e.upgrade)?{upgrade:{...e.upgrade}}:{}}}function jut(e){const t=Gr(e)?e:{};return{connect:T1(t.connect,!1),install:T1(t.install,!1),anchor:Gr(t.anchor),networkId:rn(t.network_id),role:rn(t.role),unattended:T1(t.unattended,!1),grants:CE(t.grant)}}function Hut(e){const t=Array.isArray(e)?e:e?.approvals??[];if(!Array.isArray(t))return[];const n=[];for(const s of t){if(!Gr(s))continue;const r=rn(s.approval_id),i=rn(s.state);if(!r||!i)continue;const a=But(s.typed_approval),o=Wee(s.typed_approval),l=Gr(s.what)&&(Object.prototype.hasOwnProperty.call(s.what,"credential_inheritance")||Object.prototype.hasOwnProperty.call(s.what,"credential_finite_share"))||a?.action==="approve-credential",u=Object.prototype.hasOwnProperty.call(s,"kind")?rn(s.kind):void 0,d=o!==null||u===$A?"profile":l||u==="credential_inheritance"?"credential":u!==void 0&&!["device_onboard","local_authority"].includes(u)?"unknown":!Gr(s.device)&&Gr(s.machine)?"machine":"device",f=Gr(s.requested_by)?s.requested_by:{};n.push({approvalId:r,state:i,kind:d,summary:rn(s.summary)||void 0,details:Array.isArray(s.details)&&s.details.every(p=>typeof p=="string")?s.details.slice():void 0,canApproveHere:Object.prototype.hasOwnProperty.call(s,"can_approve_here")?s.can_approve_here===!0:void 0,approveRemedy:rn(s.approve_remedy)||void 0,where:Out(d==="machine"?s.machine:s.device),what:jut(s.what),requestedBy:{surface:rn(f.surface),sessionId:rn(f.session_id),deviceId:rn(f.device_id)},expiresAt:zee(s.expires_at),...a&&d==="credential"?{typed:a}:{},...o&&d==="profile"?{profile:o}:{}})}return n}function Uut(e){return e.kind==="machine"?h("ui.mesh.mesh_approvals.this_machine"):Fx({device_id:e.where.deviceId,name:e.where.name})}function Mgt(e,t){if(e.kind==="credential"||e.kind==="unknown"||e.canApproveHere===!1){const r=MI(e);if(r)return r;if(e.summary)return e.summary;if(e.kind==="credential"||e.kind==="unknown")return O5(e)}const n=O5(e),s=zut(e,t).map(r=>r.clause);return s.length?h("ui.mesh.mesh_approvals.approval_title_with_clauses",{head:n,clauses:Wut(s)}):h("ui.mesh.mesh_approvals.approval_title",{head:n})}function O5(e){return e.kind==="credential"?MI(e)||e.summary||h("ui.mesh.approval.credential_title"):e.kind==="unknown"?e.summary||h("ui.mesh.approval.unknown_title"):e.canApproveHere===!1&&e.summary?e.summary:e.kind==="machine"?h("ui.mesh.mesh_approvals.set_up_operator_authority_on_this_machine"):h("ui.mesh.mesh_approvals.onboard_subject",{subject:Uut(e)})}function Ogt(e){return e.summary?e.kind==="credential"?MI(e)===null:e.kind==="unknown"||e.canApproveHere===!1:!1}const Gut={github:"GitHub",gitlab:"GitLab"};function L5(e){return Gut[e.toLowerCase()]??e}function TQ(e){const t=e.typed?.disclosure?.recipient;return Fx({device_id:t?.deviceId??"",name:t?.name??""})}function MI(e){const t=e.kind==="credential"?e.typed?.disclosure:null;if(!t)return null;const n=TQ(e);return t.operation==="credential_finite_share"?h("ui.mesh.approval.head_finite_share",{credential:L5(t.credentialKey),device:n}):h("ui.mesh.approval.head_inheritance",{provider:L5(t.provider),account:t.account,device:n})}function Vut(e){const t=e.kind==="credential"?e.typed?.disclosure:null;if(!t)return[];const n=TQ(e),s=[];return t.operation==="credential_finite_share"?s.push(t.scope==="session"?h("ui.mesh.approval.scope_session",{device:n}):h("ui.mesh.approval.scope_device",{device:n})):(s.push(t.org?h("ui.mesh.approval.org_limited",{org:t.org}):h("ui.mesh.approval.org_any")),t.copiesCredential===!1&&s.push(h("ui.mesh.approval.not_copied",{device:n}))),t.untilRevoked&&s.push(h("ui.mesh.approval.until_revoked")),s.push(t.futureLogins?h("ui.mesh.approval.future_logins_covered"):h("ui.mesh.approval.future_logins_not_shared")),s.push(t.installsOrJoins?h("ui.mesh.approval.installs_something"):h("ui.mesh.approval.installs_nothing")),t.requiresCapability==="broker_credential"&&s.push(h("ui.mesh.approval.needs_broker",{device:n})),t.withdrawalCount>0&&s.push(h("ui.mesh.approval.undoes_withdrawals",{count:t.withdrawalCount,device:n})),s}function Wut(e){return e.length===1?e[0]:h("ui.mesh.mesh_approvals.join_clauses",{clauses:e.slice(0,-1).join(", "),last:e[e.length-1]})}function Lgt(e){if(e.kind==="credential"||e.kind==="unknown")return null;const{user:t,host:n,transport:s,name:r}=e.where,i=[n?t?`${t}@${n}`:n:"",s?h("ui.mesh.mesh_approvals.via_transport",{transport:s}):"",r&&r!==n?`(${r})`:""].filter(Boolean);return i.length?i.join(" "):null}function Bgt(e){return e.kind==="credential"||e.kind==="unknown"?null:e.where.hostKeyFp||null}function jgt(e){const{surface:t,sessionId:n}=e.requestedBy,s=[t||"",n?h("ui.mesh.mesh_approvals.session_suffix",{suffix:n.slice(-6)}):""].filter(Boolean);return s.length?h("ui.mesh.mesh_approvals.asked_by",{requester:s.join(" · ")}):null}function zut(e,t){if(e.kind==="credential"||e.kind==="unknown")return[];const{connect:n,install:s,anchor:r,networkId:i,role:a,unattended:o,grants:l}=e.what,u=[];if(n&&u.push({term:"connect",clause:e.where.transport?h("ui.mesh.mesh_approvals.connect_over",{transport:e.where.transport}):h("ui.mesh.mesh_approvals.connect_to_it"),consequence:e.where.transport?h("ui.mesh.mesh_approvals.may_connect_over",{transport:e.where.transport}):h("ui.mesh.mesh_approvals.this_machine_may_connect_to_it")}),s&&u.push({term:"install",clause:e.kind==="machine"?h("ui.mesh.mesh_approvals.install_local_operator"):h("ui.mesh.mesh_approvals.install_local_operator_there"),consequence:e.kind==="machine"?h("ui.mesh.mesh_approvals.local_operator_is_installed_on_this_machine"):h("ui.mesh.mesh_approvals.local_operator_is_installed_on_it")}),r&&u.push({term:h("ui.mesh.mesh_approvals.install_operator_anchor"),clause:h("ui.mesh.mesh_approvals.check_approvals_signed_on_your_machines"),consequence:h("ui.mesh.mesh_approvals.that_device_can_check_approvals_signed_on")}),i){const d=t?.get(i),f=h("ui.mesh.mesh_approvals.join_network",{network:d||i,role:a||"?"});u.push({term:f,clause:f,consequence:h("ui.mesh.mesh_approvals.joins_network",{network:d||i,role:a||"?"})})}o&&u.push({term:h("ui.mesh.mesh_approvals.trust_unattended_sessions"),clause:h("ui.mesh.mesh_approvals.run_sessions_there_without_an_approval_prompt"),consequence:h("ui.mesh.mesh_approvals.sessions_you_start_on_that_device_run")});for(const d of $ut(l,o)){const f=qut()[d];u.push({term:f?.term??h("ui.mesh.mesh_approvals.grant_capability",{grant:d}),clause:Kut()[d]??h("ui.mesh.mesh_approvals.use_capability",{grant:d}),consequence:f?.gloss??h("ui.mesh.mesh_approvals.may_use_capability",{grant:d})})}return u}function $ut(e,t){const n=new Set;for(const s of e){const r=String(s??"").trim();r&&(t&&r==="unattended"||n.add(r))}return[...n]}const qut=()=>({unattended:{term:h("ui.mesh.mesh_approvals.trust_unattended_sessions"),gloss:h("ui.mesh.mesh_approvals.sessions_you_start_on_that_device_run")},broker_credential:{term:h("ui.mesh.mesh_approvals.borrow_logins_there"),gloss:h("ui.mesh.mesh_approvals.your_sessions_may_use_the_logins_stored")}}),Kut=()=>({list:h("ui.mesh.mesh_approvals.see_its_sessions"),view:h("ui.mesh.mesh_approvals.watch_a_session_there"),prompt:h("ui.mesh.mesh_approvals.send_prompts_to_a_session_there"),steer:h("ui.mesh.mesh_approvals.steer_a_running_turn_there"),stop:h("ui.mesh.mesh_approvals.stop_a_session_there"),slash:h("ui.mesh.mesh_approvals.run_slash_commands_there"),delete:h("ui.mesh.mesh_approvals.archive_or_delete_a_session_there"),move:h("ui.mesh.mesh_approvals.move_sessions_to_or_from_there"),broker_credential:h("ui.mesh.mesh_approvals.borrow_the_logins_stored_there"),approve:h("ui.mesh.mesh_approvals.answer_approval_prompts_there"),unattended:h("ui.mesh.mesh_approvals.run_sessions_there_without_an_approval_prompt")});function Hgt(e){return e.kind==="profile"?e.profile!==void 0&&(e.state==="approved"||e.state==="failed"):e.kind==="credential"&&e.typed!==void 0&&(e.state==="approved"||e.state==="failed")}function Ugt(e,t){return e.kind==="credential"&&(e.state==="approved"||e.state==="failed")&&(t??e.typed?.applyOutcome?.retryable)===!1}function Ggt(e,t,n=!1){if(e===null||e<=t||e<=0)return null;const s=Math.ceil((e-t)/60),r=e-t<60?h("ui.mesh.approval.duration_under_minute"):s<90?h("ui.mesh.approval.duration_minutes",{count:s}):h("ui.mesh.approval.duration_hours",{count:Math.ceil(s/60)});return h(n?"ui.mesh.approval.expires_window":"ui.mesh.approval.answer_window",{duration:r})}function Vgt(e){const t=e.typed?.disclosure;if(!t)return"";const n=Vut(e),s=h("ui.mesh.approval.until_revoked"),r=h(t.futureLogins?"ui.mesh.approval.future_logins_covered":"ui.mesh.approval.future_logins_not_shared");return n.filter((i,a)=>a===0||i===s||i===r).join(" · ")}function RQ(e,{poll:t=!0}={}){return Mn({queryKey:CQ.approvals,enabled:e,queryFn:async()=>Hut(await et({op:"approvals.list"})),retry:!1,staleTime:t?1e4:Number.POSITIVE_INFINITY,refetchInterval:e&&t?Aut:!1,refetchOnWindowFocus:t})}function Yut(){return{retry:!1,mutationFn:async e=>{const t=await et(e.request);if(e.request.op==="approvals.approveCredential"){const n=Xut(t);if(n)throw n}}}}function Wgt(){const e=Nt();return pn({...Yut(),onSettled:()=>{e.invalidateQueries({queryKey:CQ.approvals}),e.invalidateQueries({queryKey:Mc.networks}),e.invalidateQueries({queryKey:Mc.peers})}})}function zgt(e){const t=e?.message;return typeof t=="string"&&t.trim()?t.trim():h("ui.mesh.mesh_approvals.the_approvals_could_not_be_read")}function $gt(e){const t=e,n=EQ(t?.applyOutcome??(Gr(t?.detail)?t.detail.apply_outcome:void 0)),s=n?[n.reason,n.remedy].filter(Boolean).join(" "):"";return{code:n?.code||rn(t?.code)||"approval_refused",sentence:s||rn(t?.message)||h("ui.mesh.mesh_approvals.decision_could_not_be_answered"),retryable:n?n.retryable===!0:void 0}}function Xut(e){const t=Gr(e)?e.applied:void 0;return!Gr(t)||t.ok!==!1?null:{code:rn(t.code),message:rn(t.message),applyOutcome:t}}const Qut=/(\{request\}|\{reason\})/;function qgt(e,t){return h("ui.mesh.approval.named_refusal",{request:"{request}",reason:"{reason}"}).split(Qut).filter(Boolean).map(n=>n==="{request}"?{kind:"request",text:e}:n==="{reason}"?{kind:"reason",text:t}:{kind:"literal",text:n})}function Kgt(e,t,n=!1){return e==="request"&&!n?t:"auto"}function Ygt({document:e,target:t,refusalTarget:n,origin:s,allowFocus:r,sentence:i}){r&&(e.activeElement===e.body||e.activeElement===s)&&t?.focus({preventScroll:!0});const a=n!==null&&e.activeElement===n;return{focused:a,announcement:a?"":i}}function Jut(){const e=zn(),t=vt(e.data,"aida",1),n=Yh(t),s=t&&n.data?.enabled===!0,r=wQ(n.data?.session_id),i=vt(e.data,"notifications",1),a=eU(i),o=yQ(),l=fC(Sr(e.data,"peers")==="enabled"),u=RQ(l==="member"&&Sr(e.data,"approvals")==="enabled",{poll:!0}),d=s?r:0,f=i?tU(a.data):0,p=l==="member"?SQ(u.data??[]):0,g=[];return d>0&&g.push(h("ui.shell.sidebar_navigation.aida_missed",{name:n.data?.name??"Aida",count:d})),f>0&&g.push(h("ui.notifications.nav.unread",{count:f,countText:String(f)})),o>0&&g.push(h("ui.shell.sidebar_navigation.browser_waiting",{count:o,countText:String(o)})),p>0&&g.push(h("ui.shell.sidebar_navigation.mesh_waiting",{count:p,countText:String(p)})),{total:d+f+o+p,lines:g}}function Zut(e){const t=typeof e=="object"&&e!==null?e.idx:void 0;return typeof t=="number"&&t>0?"history":"/chat"}const edt=()=>{Ve();const e=si(),t=Py()==="rtl"?By:yG,[n,s]=m.useState(!1),{total:r,lines:i}=Jut(),a=Wx("back",Ble.test(navigator.platform)),o=r>0?h("ui.teamBridge.leave.name_attention",{count:r}):h("ui.teamBridge.leave.name"),l=m.useCallback(()=>{Zut(window.history.state)==="history"?e(-1):e("/chat")},[e]);return m.useEffect(()=>{const u=f=>{oU(f)==="back"&&(f.preventDefault(),l())},d=f=>{lU(f)==="back"&&(f.preventDefault(),l())};return document.addEventListener("keydown",u),document.addEventListener("mouseup",d),()=>{document.removeEventListener("keydown",u),document.removeEventListener("mouseup",d)}},[l]),c.jsx("div",{"data-team-bridge-back-row":"",className:R("flex h-10 shrink-0 items-center",mQ),children:c.jsx(Iu,{content:c.jsxs("span",{className:"flex flex-col",children:[c.jsx("span",{children:c.jsx(Vo,{text:h("ui.teamBridge.leave.back_shortcut",{shortcut:ji(a)})})}),i.map(u=>c.jsx("span",{children:u},u))]}),side:"bottom",align:"start",collisionPadding:8,suppressed:n,discardWhileSuppressed:!0,children:c.jsxs("button",{type:"button","data-team-bridge-back":"",onFocus:u=>{u.currentTarget.hasAttribute("data-focus-handoff")&&(u.currentTarget.removeAttribute("data-focus-handoff"),s(!0))},onBlur:()=>s(!1),onPointerEnter:()=>s(!1),onKeyDown:()=>s(!1),onClick:l,"aria-label":o,"aria-keyshortcuts":a,className:R("inline-flex h-8 items-center gap-1.5 rounded-sm px-2 text-body-sm font-medium text-ink-muted","transition-colors duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink"),children:[c.jsx(t,{size:16,"aria-hidden":"true"}),c.jsx("span",{children:h("ui.teamBridge.leave.back")}),c.jsx(ep,{count:r,"aria-hidden":"true",className:"ms-1"})]})})})},tdt=({children:e,inline:t})=>c.jsxs(Koe,{fallback:t,children:[c.jsx(edt,{}),e,c.jsx(xQ,{})]}),ndt=()=>(Ve(),c.jsxs(tdt,{inline:null,children:[c.jsx("h1",{className:"flex h-10 shrink-0 items-center px-4 text-body-sm font-semibold text-ink",children:h("ui.teamBridge.page.title")}),c.jsx("div",{className:"min-h-0 flex-1"})]})),sdt=140,rdt=/^\s*(```|~~~).*$/gm,idt=/^\s{0,3}#{1,6}\s+/gm,adt=/^\s{0,3}(>\s?)+/gm,odt=/^\s*([-*+]|\d{1,9}[.)])\s+/gm,ldt=/^\[[ xX]\]\s+/gm,cdt=/^\s{0,3}([-*_])(\s*\1){2,}\s*$/gm,udt=/!\[([^\]]*)\]\([^)]*\)/g,ddt=/\[([^\]]+)\]\([^)]*\)/g,hdt=/<((?:https?|mailto):[^>\s]+)>/gi,fdt=/<\/?[A-Za-z][^>]*>/g,pdt=/`+([^`]*)`+/g,gdt=/(\*\*|__)(?=\S)([\s\S]*?\S)\1/g,mdt=/~~(?=\S)([\s\S]*?\S)~~/g,vdt=/(^|[^\w*])\*(?=\S)([^*]*?\S)\*(?!\w)/g,bdt=/(^|[^\w])_(?=\S)([^_]*?\S)_(?!\w)/g;function _dt(e,t=sdt){if(typeof e!="string"||e.trim().length===0)return null;const n=e.replace(rdt," ").replace(cdt," ").replace(idt,"").replace(adt,"").replace(odt,"").replace(ldt,"").replace(udt,"$1").replace(ddt,"$1").replace(hdt,"$1").replace(fdt,"").replace(pdt,"$1").replace(gdt,"$2").replace(mdt,"$1").replace(vdt,"$1$2").replace(bdt,"$1$2"),s=Op(n,Number.MAX_SAFE_INTEGER);return s.length===0?null:FX(s,t)}function xdt(e,t){const n=e.senderLabel?.trim()||e.conversationName?.trim()||t.untitled,s=e.place.kind==="dm"?t.directMessage:e.place.kind==="channel"?e.place.name?.trim()?t.channel(e.place.name.trim()):e.conversationName?.trim()??t.untitled:e.place.name?.trim()||e.conversationName?.trim()||t.group,r=e.organizationName?t.subtitle(s,e.organizationName):s,i=Math.max(1,Math.floor(e.unreadCount)),a=i>1?e.preview?t.countPreview(i,e.preview):t.count(i):e.preview??t.fallback;return{title:Op(n,Gv)||t.untitled,subtitle:Op(r,Pit)||t.untitled,body:Op(a,Nit)||t.fallback}}const Tm=3e4,wdt=10;function ydt(e,t=wdt){return[...e?.organizations??[]].filter(n=>n.eligible&&n.unread>0).sort((n,s)=>s.unread-n.unread||n.tenant_id.localeCompare(s.tenant_id)).slice(0,t)}function Cdt(e,t){return e.member===!0?!0:e.member===!1||!t?!1:e.members.some(n=>n.kind==="human"&&n.account_id===t&&n.state==="active")}function AQ(e,t){return Cdt(e,t)&&L8(e)==="all"&&e.builtin!=="agents"}function Sdt(e,t,n){return{conversationName:v2(e,t),organizationName:G8(e,n),senderLabel:m2(e.last_sender_label??"")}}function kdt(e){const t=new Map(e.cursors),n=e.rows;if(!e.seeded){for(const a of n)t.set(a.conversation_id,a.latest_seq);return{candidates:[],cursors:t,seeded:!0}}const r=new Map(e.conversations.map(a=>[a.id,a])),i=[];for(const a of n){const o=t.get(a.conversation_id);if(a.unread_count===0||a.latest_seq<=a.last_read_seq||o!==void 0&&a.latest_seq<=o){(o===void 0||a.latest_seq>o)&&t.set(a.conversation_id,a.latest_seq);continue}const l=r.get(a.conversation_id);l!==void 0&&l.latest_seq===a.latest_seq&&(t.set(a.conversation_id,a.latest_seq),AQ(l,e.selfAccountId)&&(e.quiet||i.push({conversationId:l.id,...l.last_thread_root_id?{threadId:l.last_thread_root_id}:{},tenantId:a.tenant_id,seq:a.latest_seq,...Sdt(l,e.selfAccountId,e.organizations),kind:l.kind,name:l.name?.trim()||null,unreadCount:a.unread_count})))}return{candidates:i,cursors:t,seeded:!0}}function OI(e,t,n,s){return e.getMutationCache().findAll({mutationKey:Ut.notifyMutation(t.accountId,t.epoch),exact:!0,status:"pending"}).some(r=>{const i=r.state.variables;return i?.conversationId===n&&(i.tenantId===void 0||i.tenantId===s)})}function Edt(e,t,n,s,r){return new Promise(i=>{const a=()=>{l(),r.removeEventListener("abort",a),i()},o=()=>{(r.aborted||!OI(e,t,n,s))&&a()},l=e.getMutationCache().subscribe(o);r.addEventListener("abort",a,{once:!0}),o()})}function Xgt(e){const t=e.get("tenant"),n=e.get("conversation"),s=e.get("thread");return t&&n&&s?{tenantId:t,conversationId:n,rootId:s}:null}function FQ(e,t){if(e.root.id!==t.rootId||e.root.conversation_id!==t.conversationId||e.root.thread_root_id||e.replies.some(n=>n.conversation_id!==t.conversationId||n.thread_root_id!==t.rootId))throw new Error("Thread response identity mismatch");return e}async function Qgt(e,t,n,s){return FQ(await Xn.listReplies(e.conversationId,e.rootId,{tenantId:e.tenantId,accountId:t,afterSeq:n,...s?{limit:50,...s}:{}}),e)}function Jgt(e,t,n){if(typeof IntersectionObserver>"u")return()=>{};const s=new Map(t.map(d=>[d.id,d.seq])),r=new Map,i=e.ownerDocument;let a=!0,o=-1;const l=()=>{if(!a||!e.isConnected||i.visibilityState!=="visible"||!i.hasFocus())return;const d=Math.max(-1,...r.values());d<=o||(o=d,n(d).catch(()=>{a&&o===d&&(o=-1)}))},u=new IntersectionObserver(d=>{if(a){for(const f of d){const p=f.target.dataset.messageId??"",g=s.get(p);g!==void 0&&f.isIntersecting&&f.intersectionRect.height>0?r.set(p,g):r.delete(p)}l()}},{root:e.querySelector("[data-radix-scroll-area-viewport]"),threshold:0});for(const d of e.querySelectorAll("[data-message-id]"))s.has(d.dataset.messageId??"")&&u.observe(d);return i.addEventListener("visibilitychange",l),i.defaultView?.addEventListener("focus",l),()=>{a=!1,u.disconnect(),i.removeEventListener("visibilitychange",l),i.defaultView?.removeEventListener("focus",l)}}let Tx=null;function Tdt(){return Tx}function Zgt(e){m.useEffect(()=>{const t=e??null;return Tx=t,()=>{Tx===t&&(Tx=null)}},[e])}const Rdt="display.notifications";function Adt(){return{untitled:h("ui.teamBridge.list.untitled"),directMessage:h("ui.teamBridge.kind.dm"),group:h("ui.teamBridge.kind.group"),channel:e=>h("ui.teamBridge.notify.channel",{channel:e}),subtitle:(e,t)=>h("ui.teamBridge.notify.subtitle",{place:e,organization:t}),count:e=>h("ui.teamBridge.notify.count",{count:e}),countPreview:(e,t)=>h("ui.teamBridge.notify.count_preview",{count:e,preview:t}),fallback:h("ui.teamBridge.notify.body_fallback")}}function Fdt(e){return e.kind==="dm"?{kind:"dm"}:{kind:e.kind,name:e.name}}function Ddt(e,t){return crt(e,t==="person_agent"?"agent":"human")}function IA(e,t){const n=pX(Ddt(e,t)).src,s=n?.type==="account"?n:null,r=n?.type==="endpoint"?n:null;return Hit({v:1,kind:t,account_id:e.account_id,display_name:Op(e.display_label,Gv),agent_name:Op(e.agent?.name??"",Gv),...s?{avatar:{account_id:s.accountId,hash:s.hash}}:{},...r?{endpoint_avatar:{endpoint_id:r.endpointId,hash:r.hash}}:{}})}function Idt(e,t,n){return e.getQueryData(Ut.directory(t,n))?.members??[]}function Ndt(e,t,n,s){const r=Ut.replies(t.tenantId,t.conversationId,n);e.setQueryData(r,i=>{const a=i?.pages.at(-1);return!i||!a||a.has_more||i.pages.some(o=>o.replies.some(l=>l.id===s.id))?i:{...i,pages:[...i.pages.slice(0,-1),{...a,replies:[...a.replies,s].sort((o,l)=>o.seq-l.seq)}]}})}function Pdt(e,t,n,s){return{...hI(e,t,n,s),staleTime:0}}async function Mdt(e,t,n,s,r){if(!s())return;let i=t.senderLabel,a,o=null,l;const u=ni(e);if(u.accountId!==n)return;const d={accountId:n,epoch:u.epoch},f=t.threadId;try{let b;if(f)b=FQ(await Xn.listReplies(t.conversationId,f,{tenantId:t.tenantId,accountId:n,afterSeq:t.seq,limit:1}),{tenantId:t.tenantId,conversationId:t.conversationId,rootId:f}).replies.find(_=>_.seq===t.seq),b&&s()&&Ndt(e,t,f,b);else{const _=()=>e.fetchQuery(Pdt(e,t.conversationId,t.tenantId,n));b=(await _().catch(w=>{if(!qee(w))throw w;return _()})).messages.reduce((w,y)=>w===void 0||y.seq>w.seq?y:w,void 0)}if(b&&b.seq>=t.seq){if(f||(l=b.id),b.sender.kind==="human"&&b.sender.account_id===n||!s())return;const _=Idt(e,t.tenantId,n);i=Xoe(b.sender,_,{named:(w,y)=>h("ui.teamBridge.chief.label",{agent:w,person:y}),unnamed:w=>h("ui.teamBridge.chief.unnamed",{person:w})});const x=_.find(w=>w.account_id===b.sender.account_id);x&&(b.sender.kind==="human"||b.sender.kind==="agent")&&(a=IA(x,b.sender.kind==="human"?"person":"person_agent")),o=_dt(b.body)}}catch{}const p=window.api?.desktop?.teamBridge;if(!p)return;const g=xdt({senderLabel:i,conversationName:t.conversationName,place:Fdt(t),organizationName:t.organizationName,preview:o,unreadCount:t.unreadCount},Adt());for(;OI(e,d,t.conversationId,t.tenantId);)if(await Edt(e,d,t.conversationId,t.tenantId,r),r.aborted||!s())return;if(r.aborted||!s())return;const v=e.getQueryData(Ut.conversations(Pc,n))?.conversations.find(b=>b.id===t.conversationId&&b.tenant_id===t.tenantId);!v||!AQ(v,n)||await p.notify({owner:{accountId:n,epoch:d.epoch},conversationId:t.conversationId,...f?{threadId:f}:{},...l?{messageId:l}:{},tenantId:t.tenantId,...a?{sender:a}:{},seq:t.seq,title:g.title,subtitle:g.subtitle,body:g.body,viewing:Tdt()===t.conversationId}).catch(()=>{})}function Odt(e,t,n,s,r){nrt(e,t,n,s);for(const i of s){const a=`${n}\0${i.conversation_id}`,o=r.get(a);if(r.set(a,i.latest_seq),o===void 0||i.latest_seq<=o)continue;const l=hI(e,i.conversation_id,n,t);e.getQueryState(l.queryKey)?.data!==void 0&&e.fetchQuery({...l,staleTime:0}).catch(()=>{})}}function Ldt(e){const t=!!window.api?.desktop?.teamBridge,n=KC(),s=fI(e&&t),r=n.accountId,a=e&&t&&!!r&&s.data?.account_id===r&&s.data?.state==="ready"&&s.data.local.enabled&&!s.data.read_only,o=Nt(),l=Wle({filters:{mutationKey:Ut.notifyMutation(r,n.epoch),exact:!0,status:"pending"},select:B=>B.mutationId});m.useLayoutEffect(()=>{const B=window.api?.desktop?.teamBridge;if(!B?.setAuthority)return;const G=()=>{B.setAuthority({...ni(o),settling:_2(o)}).catch(()=>{})},H=b2(o,G);return G(),H},[o]);const u=nI({enabled:a}),d=zn(),f=vt(d.data,"settings"),p=Mn({...HH(),enabled:a&&f}),g=f&&Yoe(p.data?.settings,Rdt)===!1,v=m.useRef(g);v.current=g;const b=m.useRef(r);b.current=r;const _=m.useRef(a);_.current=a;const x=m.useRef(new AbortController);m.useEffect(()=>{const B=new AbortController;return x.current=B,(!a||g||n.token!==hp(o))&&B.abort(),()=>B.abort()},[a,g,n.token,o]),m.useEffect(()=>(_.current=a,()=>{_.current=!1}),[a]);const w=u.data,y=EX(a,Pc,{accountId:r,refetchInterval:Tm,refetchIntervalInBackground:!0}),S=m.useMemo(()=>ydt(y.data),[y.data]),C=cU({queries:S.map(B=>{const G=GE(B.tenant_id);return{queryKey:Ut.unread(G,r??"unresolved-owner"),queryFn:()=>Ul(o,r,()=>Xn.unread({tenantId:G})),enabled:a,staleTime:Tm,refetchInterval:Tm,refetchIntervalInBackground:!0,refetchOnWindowFocus:!0,retry:1}})}),k=C.map(B=>`${B.status}:${B.dataUpdatedAt}`).join("|"),T=m.useRef(C);T.current=C;const A=m.useRef(S);A.current=S;const I=kX(S.map(B=>GE(B.tenant_id)),a,r).members,N={};for(const[B,G]of Object.entries(I))N[B]=G.filter(H=>H.account_id!==r).flatMap(H=>[IA(H,"person"),...H.agent?.name?[IA(H,"person_agent")]:[]]).filter(H=>H!==void 0);const P=JSON.stringify(N),O=m.useRef(N);O.current=N;const j=m.useRef(null),M=m.useRef(new Set),X=Mn({queryKey:Ut.conversations(Pc,r??"unresolved-owner"),queryFn:()=>Ul(o,r,()=>Xn.listConversations("account")),enabled:a,staleTime:Tm,refetchInterval:Tm,refetchIntervalInBackground:!0,refetchOnWindowFocus:!0,retry:1}),se=m.useRef(new Map),ee=m.useRef(new Map),q=m.useRef(new Set),ne=m.useRef(void 0),te=m.useRef(null),L=[a,g,l.join(","),k,y.dataUpdatedAt,X.dataUpdatedAt,(w?.memberships??[]).map(B=>`${B.tenant_id}:${B.tenant_name}`).join(","),r??""].join("#");m.useEffect(()=>{if(j.current===P)return;j.current=P;const B=window.api?.desktop?.teamBridge;if(!B?.syncDirectory)return;const G=O.current;for(const H of M.current)H in G||B.syncDirectory({tenantId:H,members:[]}).catch(()=>{});M.current=new Set(Object.keys(G));for(const[H,W]of Object.entries(G))B.syncDirectory({tenantId:H,members:W}).catch(()=>{})},[P]),m.useEffect(()=>{const B=ne.current;ne.current=r,B!==r&&B!==void 0&&(se.current=new Map,ee.current=new Map,q.current=new Set,te.current=null,o.invalidateQueries({queryKey:Ut.unreadPrefix}),o.invalidateQueries({queryKey:Ut.conversationsPrefix}))},[r,o]),m.useEffect(()=>{if(te.current===L||(te.current=L,!y.data))return;for(const de of y.data.organizations??[])de.unread===0&&!q.current.has(de.tenant_id)&&q.current.add(de.tenant_id);if(!X.data)return;const B=T.current,G=A.current,H=V8(w?.memberships??[],y.data.organizations,y.data.organizations??null);let W=se.current;for(let de=0;de<G.length;de+=1){const J=G[de],Re=B[de]?.data;if(!Re)continue;const le=(Re.conversations??[]).map(Se=>({conversation_id:Se.conversation_id,tenant_id:J.tenant_id,unread_count:Se.unread_count,last_read_seq:Se.last_read_seq,latest_seq:Se.latest_seq}));r&&Odt(o,r,J.tenant_id,Re.conversations??[],ee.current);const ge=q.current.has(J.tenant_id),U=ni(o),we=le.filter(Se=>!ge||!_.current||v.current||!U.accountId||U.accountId!==r?!0:!OI(o,{accountId:U.accountId,epoch:U.epoch},Se.conversation_id,Se.tenant_id)),Ee=kdt({conversations:X.data.conversations,rows:we,organizations:H,selfAccountId:r,cursors:W,seeded:ge,quiet:!a||g});if(W=Ee.cursors,Ee.seeded&&q.current.add(J.tenant_id),!a||g||!r)continue;const Ie=r,pe=hp(o),be=aX(o,Ie);for(const Se of Ee.candidates)Mdt(o,Se,Ie,()=>b.current===Ie&&hp(o)===pe&&be()&&_.current&&!v.current&&Hc(o,Ie),x.current.signal)}se.current=W},[L,a,g,y.data,X.data,w,r,o])}function Bdt(){const{data:e}=zn();m.useEffect(()=>{e&&xJ(e)},[e]);const t=h2(),n=Nt(),s=m.useRef(null);m.useEffect(()=>{const r=t.configChange;if(!r)return;const i=`${r.epoch}:${r.seq}`;s.current!==i&&r.changedKeys.includes(Tl)&&(s.current=i,n.invalidateQueries({queryKey:Yo.capabilities}),n.invalidateQueries({queryKey:Yo.settings}),!Qoe()&&Da(h("ui.settings.language.external_notice",{language:r.language}),{id:"i18n-language-external"}))},[t.configChange,n])}function jdt(e,t){if(e.defaultPrevented||e.repeat||e.isComposing||!(e.metaKey||e.ctrlKey))return null;const n=C2(e);if(n===null)return null;const s=Kee(t.bindings).get(n);return s===void 0||VA(e.target)||!pbe(DQ(s),t.route)?null:s}const DQ=e=>e.slice(6);function Hdt(e){const t=Ne.getState(),n=t.activeDraftKey?t.drafts[t.activeDraftKey]:void 0,s=Qv(t.activeDraftKey,n?.sessionId,t.activeSessionId)??null;Xd(DQ(e),{sessionId:s,askScope:s===null?"fleet":"session",via:"chord"})}function Udt(){m.useEffect(()=>{const e=t=>{const n=tt.getState(),s=jdt(t,{bindings:n.shortcutBindings,route:n.rightSlotRoute});s!==null&&(t.preventDefault(),Hdt(s))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[])}function Gdt(e,t){const n=_g(),s=m.useRef(!1);m.useEffect(()=>{s.current||!e||!n.accountId||window.__loDevDriver?.armed!==!0||window.__loDevDriver.startupScene!=="team-bridge-owner-audit"||(s.current=!0,t("/team-bridge"))},[e,n.accountId,t])}const Vdt=""+new URL("radient-icon-1024x1024-D_JJedvo.png",import.meta.url).href,IQ=fg()(rH(e=>({hasBeenNotified:!1,setHasBeenNotified:t=>{e({hasBeenNotified:t})}}),{name:"low-credits-storage"})),Wdt=({open:e,onClose:t,onGoToConsole:n})=>{Ve();const{setHasBeenNotified:s}=IQ(),{prices:r,isLoading:i,error:a}=Joe(),o=d=>typeof d!="number"?"$...":h("ui.common.account.low_credits_dialog.detail",{detail:String(d.toFixed(2))}),l=()=>{s(!0),t()},u=()=>{s(!0),n()};return c.jsx(Wl,{open:e,onClose:l,title:c.jsxs(c.Fragment,{children:[c.jsx("img",{src:Vdt,alt:h("ui.common.account.low_credits_dialog.radient_icon"),className:"size-7"}),h("ui.common.account.low_credits_dialog.running_low_on_radient_credits")]}),maxWidth:"sm",fullWidth:!1,actions:c.jsxs(c.Fragment,{children:[c.jsx(tb,{onClick:l,children:h("ui.common.account.low_credits_dialog.maybe_later")}),c.jsx(nb,{onClick:u,startIcon:c.jsx(Nu,{size:18}),className:"min-w-55",children:h("ui.common.account.low_credits_dialog.get_more_credits")})]}),children:c.jsxs("div",{className:"flex flex-col items-center gap-4 py-2 text-center",children:[c.jsxs("p",{className:"text-body-sm text-ink-muted",children:[h("ui.common.account.low_credits_dialog.unlock_the_full_power_of_local_operator_with")," ",c.jsx("span",{className:"font-bold text-accent",children:h("ui.common.account.low_credits_dialog.radient_pass")}),"."]}),c.jsx("p",{className:"text-body-sm text-ink-muted",children:h("ui.common.account.low_credits_dialog.radient_automatic_is_often_cheaper_than_bringing_your_own_key_its")}),c.jsx("p",{className:"text-body-sm text-ink-muted",children:h("ui.common.account.low_credits_dialog.it_s_pay_as_you_go_with_no_commitments_load_up_what_you_need_star")}),c.jsxs("p",{className:"text-body-sm text-ink-muted",children:[h("ui.common.account.low_credits_dialog.plus_get")," ",c.jsx("span",{className:"font-medium text-ink",children:i?c.jsx(Pn,{size:"sm",className:"me-0.5 align-middle"}):o(r?.default_registration_credits)})," ",h("ui.common.account.low_credits_dialog.in_bonus_credits_with_your_first_purchase"),a&&c.jsx("span",{className:"mt-1 block text-meta text-danger",children:h("ui.common.account.low_credits_dialog.could_not_load_bonus_credit_information")})]}),c.jsx("p",{className:"text-meta text-ink-dim",children:h("ui.common.account.low_credits_dialog.you_can_also_reach_the_radient_console_from_settings_at_any_time")})]})})},zdt=(e,t)=>t?e.some(n=>n.session_id===t&&n.status?.code==="busy"):!1;function $dt(e){return Ne(t=>zdt(t.sessions,e))}const NA={aida:"visible",notifications:"visible",library:"visible",projects:"visible",agents:"visible",schedules:"more",browser:"visible","team-bridge":"more","agent-hub":"more",mesh:"more"},wy=["aida","notifications","library","projects","agents","schedules","browser","team-bridge","agent-hub","mesh"],yy={visible:wy.filter(e=>NA[e]==="visible"),more:wy.filter(e=>NA[e]==="more")},B5=new Map(wy.map((e,t)=>[e,t])),qdt=new Map([["notifications","notifications"]]);function Kdt(e,t){const n=s=>{const r=qdt.get(s);return r===void 0||t(r)};return{visible:e.visible.filter(n),more:e.more.filter(n)}}const Ydt=new Set(Yee);function Xdt(e){return typeof e=="string"&&Ydt.has(e)}function bE(e,t){if(e===t)return!0;if(e.visible.length!==t.visible.length||e.more.length!==t.more.length)return!1;for(let n=0;n<e.visible.length;n+=1)if(e.visible[n]!==t.visible[n])return!1;for(let n=0;n<e.more.length;n+=1)if(e.more[n]!==t.more[n])return!1;return!0}function Po(e,t){return e.visible.includes(t)?"visible":"more"}function Rx(e,t,n){return e[t].filter(s=>n.has(s))}function Qdt(e,t,n,s){if(!s.has(t))return null;const r=Po(e,t),i=Rx(e,r,s),a=i.indexOf(t);if(a<0)return null;const o=a+n;if(o<0||o>=i.length)return null;const l=i[o],u=e[r],d=u.indexOf(t),f=u.indexOf(l);if(d<0||f<0)return null;const p=u.slice();p[d]=l,p[f]=t;const g={visible:e.visible.slice(),more:e.more.slice()};return g[r]=p,g}function j5(e,t,n){const s={visible:e.visible.filter(r=>r!==t),more:e.more.filter(r=>r!==t)};return{...s,[n]:[...s[n],t]}}function Jdt(e,t,n,s,r){if(s===t)return{visible:e.visible.slice(),more:e.more.slice()};if(s!==null&&(!r.has(s)||!e[n].includes(s)))return null;const i={visible:e.visible.filter(l=>l!==t),more:e.more.filter(l=>l!==t)},a=i[n].slice(),o=s===null?a.length:a.indexOf(s);return o<0?null:(a.splice(o,0,t),{...i,[n]:a})}function H5(e,t){for(const n of wy){if(NA[n]!==t||e.visible.includes(n)||e.more.includes(n))continue;const s=B5.get(n)??0,r=e[t];let i=-1,a=-1,o=-1,l=Number.POSITIVE_INFINITY;for(let d=0;d<r.length;d+=1){const f=B5.get(r[d])??0;f<s&&f>a&&(a=f,i=d),f>s&&f<l&&(l=f,o=d)}const u=i>=0?i+1:o>=0?o:r.length;r.splice(u,0,n)}}function PA(e){const t={visible:[],more:[]},n=new Set;if(e&&typeof e=="object"){const s=e;for(const r of["visible","more"]){const i=s[r];if(Array.isArray(i))for(const a of i)Xdt(a)&&(n.has(a)||(n.add(a),t[r].push(a)))}}return H5(t,"visible"),H5(t,"more"),t}function Zdt(e){return e.reduce((t,n)=>{const s=n.attention??0;return Number.isFinite(s)&&s>0?t+s:t},0)}const jf={layout:["desktop","sidebar_layout"]};async function eht(){const e=await et({op:"sidebar_layout.get"});return PA(e.layout)}function tht(e,t=()=>!1){const n=Nt(),s=Mn({queryKey:jf.layout,enabled:e,queryFn:eht,staleTime:Number.POSITIVE_INFINITY,retry:Kv}),r=m.useRef(0),i=pn({scope:{id:"sidebar-layout"},mutationFn:async d=>{const f=await et({op:"sidebar_layout.set",layout:Kdt(d,t)});return PA(f.layout)},retry:Xee,onMutate:async d=>{const f=++r.current;await n.cancelQueries({queryKey:jf.layout});const p=n.getQueryData(jf.layout);return n.setQueryData(jf.layout,d),{previous:p,seq:f}},onError:(d,f,p)=>{p?.seq===r.current&&p.previous&&n.setQueryData(jf.layout,p.previous),fn(h("ui.shell.sidebar_navigation.save_failed"))},onSettled:(d,f,p,g)=>{g?.seq===r.current&&n.invalidateQueries({queryKey:jf.layout})}}),a=e&&s.data!==void 0;return{layout:a?s.data:yy,canCustomise:a,save:d=>{a&&i.mutate(d)},reset:()=>{a&&i.mutate(PA(yy))}}}const U5=({expanded:e})=>(Ve(),c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(GH,{className:"size-6",label:e?void 0:h("ui.shell.collapsible_app_logo.local_operator")}),e&&c.jsx("span",{className:"truncate font-semibold text-body text-ink",children:h("ui.shell.collapsible_app_logo.local_operator")})]})),NQ=()=>{const e=h2(),t=zn(),n=Ne(u=>u.setCataloguePageable),s=Ne(u=>u.setCatalogueActivityHead),r=Ne(u=>u.fetchSessions),i=vt(t.data,"session_catalogue_page"),a=vt(t.data,"session_catalogue_sort");m.useEffect(()=>{n(i)},[i,n]),m.useEffect(()=>{s(a)},[a,s]);const o=Sr(t.data,"session_catalogue",2)==="enabled",l=m.useCallback(()=>r(i?mH:Sy,i),[r,i]);return m.useEffect(()=>{o&&l()},[o,l,e.catalogueRevision]),null},G5="flex h-[30px] w-full items-center gap-2 rounded-md px-2 text-body-sm transition-colors duration-fast ease-out-quart",nht=()=>{Ve();const e=Py()==="rtl",t=si(),n=i9(),{expanded:s,onCollapse:r}=Zoe(),i=tt(oe=>oe.openCommandPalette),a=zn(),o=Ait(vt(a.data,"team_bridge_conversations")),l=Ne(oe=>oe.activeSessionId),u=yQ(),d=Sr(a.data,"peers")==="enabled",f=fC(d),p=Sr(a.data,"approvals")==="enabled",g=RQ(f==="member"&&p,{poll:!0}),v=SQ(g.data??[]),b=vt(a.data,"projects",1),_=vt(a.data,"library",1),x=vt(a.data,"notifications",1),w=eU(x),y=x?tU(w.data):0,S=tt(oe=>oe.sidebarOverflowExpanded),C=tt(oe=>oe.setSidebarOverflowExpanded),k=vt(a.data,"aida",1),T=Yh(k),A=k&&T.data?.enabled===!0,F=T.data?.name??"Aida",I=mme(),N=wQ(T.data?.session_id),P=$dt(T.data?.session_id),O=()=>{I(t,T.data).catch(oe=>fn(Wf(oe)))},j=new Map;A&&j.set("aida",{icon:ele,label:F,path:"/chat",isActive:n==="chat"&&!!T.data?.session_id&&l===T.data?.session_id,tourTag:"nav-item-aida",onSelect:O,attention:N,attentionTag:"nav-aida-badge",attentionName:oe=>h("ui.shell.sidebar_navigation.aida_missed",{name:F,count:oe}),working:P,workingName:h("ui.shell.sidebar_navigation.aida_working",{name:F})}),x&&j.set("notifications",{icon:SG,label:h("ui.notifications.nav.label"),path:"/notifications",isActive:n==="notifications",tourTag:"nav-item-notifications",attention:y,attentionTag:"nav-notifications-badge",attentionName:oe=>h("ui.notifications.nav.unread",{count:oe,countText:String(oe)})}),_&&j.set("library",{icon:vhe,label:h("ui.library.page.title"),path:"/library",isActive:n==="library",tourTag:"nav-item-library"}),b&&j.set("projects",{icon:TG,label:h("ui.shell.sidebar_navigation.projects"),path:"/projects",isActive:n==="projects",tourTag:"nav-item-projects"}),j.set("agents",{icon:Ll,label:h("ui.shell.sidebar_navigation.agents"),path:"/agents",isActive:n==="agents",tourTag:"nav-item-agents"}),j.set("schedules",{icon:kG,label:h("ui.shell.sidebar_navigation.schedules"),path:"/schedules",isActive:n==="schedules",tourTag:"nav-item-schedules"}),j.set("browser",{icon:Zu,label:h("ui.shell.sidebar_navigation.browser"),path:"/browser",isActive:n==="browser",tourTag:"nav-item-browser",attention:u,attentionTag:"nav-browser-badge",attentionName:oe=>h("ui.shell.sidebar_navigation.browser_waiting",{count:oe,countText:String(oe)})}),o&&j.set("team-bridge",{...o,isActive:n==="team-bridge"}),j.set("agent-hub",{icon:PG,label:h("ui.shell.sidebar_navigation.agent_hub"),path:"/agent-hub",isActive:n==="agent-hub",tourTag:"nav-item-agent-hub"}),f==="member"&&j.set("mesh",{icon:W8,label:h("ui.shell.sidebar_navigation.mesh"),path:"/mesh",isActive:n==="mesh",tourTag:"nav-item-mesh",attention:v,attentionTag:"nav-mesh-badge",attentionName:oe=>h("ui.shell.sidebar_navigation.mesh_waiting",{count:oe,countText:String(oe)})});const M=new Set(j.keys()),X=vt(a.data,"sidebar_layout",1),{layout:se,canCustomise:ee,save:q,reset:ne}=tht(X,oe=>vt(a.data,oe,1)),te=ee?se:yy,L=Rx(te,"visible",M),B=Rx(te,"more",M),[G,H]=m.useState(!1),W=S||G||B.some(oe=>j.get(oe)?.isActive),[de,J]=m.useState(""),[Re,le]=m.useState(null),ge=m.useRef(new Map),U=oe=>{requestAnimationFrame(()=>ge.current.get(oe)?.focus())},[we,Ee]=m.useState(null),[Ie,pe]=m.useState(null),be=m.useRef(null),Se=m.useRef(null),ke=m.useRef(null),me=m.useRef(0),Xe=m.useRef(0),ae=m.useRef(null),We=m.useRef(null),Je=m.useRef(!1),ce=oe=>{const he=be.current;return he===null?[]:Array.from(he.querySelectorAll("[data-sidebar-row]")).filter(De=>De.dataset.sidebarRow!==oe).map(De=>{const je=De.getBoundingClientRect();return{id:De.dataset.sidebarRow??"",top:je.top,bottom:je.bottom}})},Me=(oe,he)=>{const De=be.current;if(De===null)return null;const je=De.getBoundingClientRect(),nt=ce(he),ie=ye=>nt.filter(Fe=>Po(te,Fe.id)===ye);let xe=null;if(oe.kind==="more"){const ye=ie("more").at(-1);if(ye)xe=ye.bottom;else{const Fe=De.querySelector("[data-sidebar-more]");xe=Fe?Fe.getBoundingClientRect().bottom:je.top+2}}else if(oe.kind==="band"){const ye=Po(te,he),it=ie(ye==="more"?"visible":"more").at(-1);if(it)xe=it.bottom;else if(ye==="more"){const Ct=De.querySelector("[data-sidebar-more]");xe=Ct?Ct.getBoundingClientRect().top:je.top+2}}else{const ye=nt[oe.slot];ye?xe=ye.top:xe=nt.at(-1)?.bottom??je.top+2}return xe===null?null:Math.round(xe-je.top+De.scrollTop)},Pe=()=>{We.current!==null&&(window.clearTimeout(We.current),We.current=null)},ze=(oe,he)=>{const De=Se.current;if(De===null||!De.armed)return;const je=document.elementFromPoint(oe,he),nt=!!je?.closest("[data-sidebar-more]"),ie=!!je?.closest("[data-sidebar-drop-band]");let xe;if(nt)xe={kind:"more"},Po(te,De.id)==="visible"&&!W&&We.current===null&&(We.current=window.setTimeout(()=>{We.current=null,H(!0),requestAnimationFrame(()=>st.current(me.current,Xe.current))},400));else if(Pe(),ie)xe={kind:"band"};else{const ye=ce(De.id),Fe=wY(ye,De.id,he),it=ye[Fe];let Ct="visible";if(it)Ct=Po(te,it.id);else{const It=ye.at(-1);Ct=It?Po(te,It.id):"visible"}xe={kind:"slot",slot:Fe,beforeId:it?.id??null,region:Ct}}ke.current=xe,pe(Me(xe,De.id))},st=m.useRef(ze);st.current=ze;const _t=()=>{ae.current!==null&&(cancelAnimationFrame(ae.current),ae.current=null)},jt=()=>{ae.current=null;const oe=Se.current,he=be.current;if(oe===null||!oe.armed||he===null)return;const De=he.getBoundingClientRect(),je=Xe.current,nt=he.scrollHeight-he.clientHeight;let ie=0;je-De.top<24&&he.scrollTop>0?ie=-1:De.bottom-je<24&&he.scrollTop<nt&&(ie=1),ie!==0&&(he.scrollTop+=ie*8,st.current(me.current,je)),ae.current=requestAnimationFrame(jt)},gn=(oe,he)=>{if(ee&&he.button===0&&!(he.altKey||he.ctrlKey||he.metaKey||he.shiftKey)){try{he.currentTarget.setPointerCapture(he.pointerId)}catch{}Se.current={pointerId:he.pointerId,id:oe,armed:!1,startX:he.clientX,startY:he.clientY},me.current=he.clientX,Xe.current=he.clientY}},Ft=oe=>{const he=Se.current;if(!(he===null||he.pointerId!==oe.pointerId)){if(me.current=oe.clientX,Xe.current=oe.clientY,!he.armed){if(Math.hypot(oe.clientX-he.startX,oe.clientY-he.startY)<5)return;he.armed=!0,Je.current=!0,Ee(he.id);const De=j.get(he.id);De&&J(h("ui.shell.sidebar_navigation.drag_armed",{name:De.label})),ae.current===null&&(ae.current=requestAnimationFrame(jt))}ze(oe.clientX,oe.clientY)}},dt=(oe,he)=>{if(he.kind==="slot")return Jdt(te,oe,he.region,he.beforeId,M);const De=Po(te,oe),je=he.kind==="more"?"more":De==="more"?"visible":"more";return j5(te,oe,je)},ln=(oe,he)=>{const De=j.get(oe);if(De===void 0)return;const je=dt(oe,he);if(je===null||bE(je,te))return;const nt=Po(je,oe);if(nt==="more"&&C(!0),q(je),he.kind==="slot"){Jt(je,oe);return}J(nt==="more"?h("ui.shell.sidebar_navigation.move_to_more_note",{name:De.label}):h("ui.shell.sidebar_navigation.show_in_sidebar_note",{name:De.label}))},Jt=(oe,he)=>{const De=j.get(he),je=Po(oe,he),nt=Rx(oe,je,M);J(h("ui.shell.sidebar_navigation.move_note",{name:De?.label??"",position:String(nt.indexOf(he)+1),total:String(nt.length)}))},Pt=(oe,he=!1)=>{const De=Se.current;if(De===null)return;Se.current=null,_t(),Pe();const je=ke.current;if(ke.current=null,Ee(null),pe(null),H(!1),!!De.armed){if(!oe){if(he){Je.current=!1,J("");return}const nt=()=>{Je.current=!1},ie=()=>{window.setTimeout(nt,0)},xe=()=>{window.removeEventListener("pointerup",ye,!0),window.removeEventListener("pointercancel",Fe,!0),window.removeEventListener("blur",Fe,!0)},ye=()=>{xe(),ie()},Fe=()=>{xe(),nt()};window.addEventListener("pointerup",ye,!0),window.addEventListener("pointercancel",Fe,!0),window.addEventListener("blur",Fe,!0),J("");return}window.setTimeout(()=>{Je.current=!1},0),je!==null&&ln(De.id,je)}},qt=m.useRef(Pt);qt.current=Pt,m.useEffect(()=>{if(we===null)return;const oe=je=>{je.key==="Escape"&&(qt.current(!1),je.preventDefault())},he=je=>{Se.current?.pointerId===je.pointerId&&qt.current(!0)},De=()=>qt.current(!1,!0);return window.addEventListener("keydown",oe),window.addEventListener("pointerup",he),window.addEventListener("pointercancel",De),window.addEventListener("blur",De),()=>{window.removeEventListener("keydown",oe),window.removeEventListener("pointerup",he),window.removeEventListener("pointercancel",De),window.removeEventListener("blur",De)}},[we]),m.useEffect(()=>()=>{ae.current!==null&&cancelAnimationFrame(ae.current),We.current!==null&&window.clearTimeout(We.current)},[]);const jn=(oe,he)=>{if(!ee)return;const De=j.get(oe);if(De===void 0)return;if(he.kind==="reset"){ne(),J(h("ui.shell.sidebar_navigation.reset_note")),U(oe);return}if(he.kind==="move"){const nt=Qdt(te,oe,he.delta,M);if(nt===null)return;q(nt),Jt(nt,oe),U(oe);return}const je=j5(te,oe,he.region);bE(je,te)||(he.region==="more"&&C(!0),q(je),J(he.region==="more"?h("ui.shell.sidebar_navigation.move_to_more_note",{name:De.label}):h("ui.shell.sidebar_navigation.show_in_sidebar_note",{name:De.label})),U(oe))},Kt=c.jsx(Btt,{selectedConversation:l??void 0,onSelectConversation:oe=>void xg(t,oe,"sidebar"),onStageDraft:(oe,he)=>{Ne.getState().stageDraft(oe,he),t("/chat")}}),an=oe=>{const he=oe.attention??0,De=he>0&&oe.attentionName?oe.attentionName(he):oe.label;return oe.working&&oe.workingName?oe.workingName:De},ls=oe=>{const he=j.get(oe);if(he===void 0)return null;const De=Po(te,oe),je=De==="more"?B:L,nt=je.indexOf(oe),ie=nt<=0,xe=nt===-1||nt>=je.length-1,ye=he.attention??0,Fe=an(he),it=we===oe,Ct=e?"left":"right",It=he.isActive?Lo:"text-ink-muted hover:bg-row-hover hover:text-ink",Bt=c.jsx(he.icon,{size:16,"aria-hidden":"true",className:R("shrink-0",he.isActive&&"text-accent")}),Xt=c.jsxs("button",{type:"button",ref:At=>{At?ge.current.set(oe,At):ge.current.delete(oe)},onClick:()=>{if(Je.current){Je.current=!1;return}he.onSelect?he.onSelect():t(he.path)},onPointerDown:ee?At=>gn(oe,At):void 0,onPointerMove:ee?Ft:void 0,onPointerUp:ee?At=>{Se.current?.pointerId===At.pointerId&&Pt(!0)}:void 0,onPointerCancel:ee?()=>Pt(!1,!0):void 0,onKeyDown:ee?At=>{if(At.key==="ContextMenu"||At.shiftKey&&At.key==="F10"){At.preventDefault(),le(oe);return}At.altKey&&(At.key!=="ArrowUp"&&At.key!=="ArrowDown"||(At.preventDefault(),jn(oe,{kind:"move",delta:At.key==="ArrowUp"?-1:1})))}:void 0,"data-tour-tag":he.tourTag,"aria-current":he.isActive?"page":void 0,"aria-haspopup":ee?"menu":void 0,"aria-label":s&&Fe===he.label?void 0:Fe,className:R("flex h-full min-w-0 flex-1 items-center gap-2 rounded-md",s?"px-2":"justify-center px-0"),children:[s?Bt:c.jsxs("span",{className:"relative flex size-7 shrink-0 items-center justify-center",children:[Bt,ye>0&&c.jsx("span",{className:"pointer-events-none absolute -top-1 -end-1.5 flex",children:c.jsx(ep,{count:ye,placement:"corner","data-tour-tag":he.attentionTag})})]}),!s&&he.working&&c.jsx("span",{className:"inline-flex",children:c.jsx(yi,{size:16,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})}),s&&c.jsx("span",{className:"truncate",children:he.label})]}),Tt=ee?c.jsxs(Xo,{open:Re===oe,onOpenChange:At=>le(At?oe:null),children:[c.jsx(_o,{asChild:!0,children:s?c.jsx("button",{type:"button","data-sidebar-row-menu":"","aria-label":h("ui.shell.sidebar_navigation.row_actions",{name:he.label}),className:R("me-0.5 flex size-6 shrink-0 items-center justify-center rounded-sm","text-ink-muted opacity-0 transition-opacity duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink","group-hover/row:opacity-100 group-focus-within/row:opacity-100","focus-visible:opacity-100 data-[state=open]:opacity-100",we!==null&&"pointer-events-none opacity-0!"),children:c.jsx(yc,{size:16,"aria-hidden":"true"})}):c.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-1 end-0 w-0"})}),c.jsxs(Qo,{align:"start",side:Ct,sideOffset:s?6:16,className:"min-w-44",onCloseAutoFocus:At=>{At.preventDefault(),U(oe)},children:[c.jsx(on,{disabled:ie,onSelect:()=>jn(oe,{kind:"move",delta:-1}),children:h("ui.shell.sidebar_navigation.move_up")}),c.jsx(on,{disabled:xe,onSelect:()=>jn(oe,{kind:"move",delta:1}),children:h("ui.shell.sidebar_navigation.move_down")}),c.jsx(Wr,{}),De==="more"?c.jsx(on,{onSelect:()=>jn(oe,{kind:"region",region:"visible"}),children:h("ui.shell.sidebar_navigation.show_in_sidebar")}):c.jsx(on,{onSelect:()=>jn(oe,{kind:"region",region:"more"}),children:h("ui.shell.sidebar_navigation.move_to_more")}),!bE(te,yy)&&c.jsxs(c.Fragment,{children:[c.jsx(Wr,{}),c.jsx(on,{onSelect:()=>jn(oe,{kind:"reset"}),children:h("ui.shell.sidebar_navigation.reset_layout")})]})]})]}):null;return c.jsxs("li",{"data-sidebar-row":oe,"data-sidebar-region":De,onContextMenu:ee?At=>{At.preventDefault(),le(oe)}:void 0,className:R("group/row relative flex h-[30px] w-full items-center rounded-md","transition-colors duration-fast ease-out-quart",It,it&&HY,it&&UY),children:[s?Xt:c.jsx(Iu,{content:an(he),side:Ct,suppressed:we!==null,children:Xt}),Tt,s&&(ye>0||he.working)&&c.jsxs("span",{"aria-hidden":"true",className:"pointer-events-none inline-flex shrink-0 items-center gap-1 pe-2",children:[ye>0&&c.jsx(ep,{count:ye,"data-tour-tag":he.attentionTag}),he.working&&c.jsx(yi,{size:16,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})]})]},he.tourTag)},Zt=Ie===null?null:c.jsx("span",{"aria-hidden":"true","data-sidebar-drop-indicator":"",className:"pointer-events-none absolute inset-x-1 z-10 h-0.5 -translate-y-px rounded-full bg-accent",style:{top:Ie}}),us=(we===null?null:Po(te,we))==="more"?h("ui.shell.sidebar_navigation.show_in_sidebar"):h("ui.shell.sidebar_navigation.move_to_more"),Hn=we===null?null:s?c.jsx("div",{"data-sidebar-drop-band":"",className:"absolute inset-x-0 top-full z-20 mt-1 flex h-7 items-center justify-center rounded-md border border-dashed border-control bg-surface text-meta text-ink-dim",children:us}):c.jsx(Iu,{content:us,side:e?"left":"right",children:c.jsx("div",{"data-sidebar-drop-band":"",className:"absolute inset-x-0 top-full z-20 mx-auto mt-1 flex h-6 w-8 items-center justify-center rounded-sm border border-dashed border-control bg-surface",children:c.jsx("span",{"aria-hidden":"true",className:"h-0.5 w-4 rounded-full bg-ink-dim"})})}),vr=c.jsx("span",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:de}),Qn=s?h("ui.shell.sidebar_navigation.collapse_sidebar"):h("ui.shell.sidebar_navigation.expand_sidebar"),_n=s?e?Hi:Qu:e?Qu:Hi,Lt=navigator.platform.toUpperCase().indexOf("MAC")>=0,Jn=vt(a.data,"session_catalogue",2),vn=Ne(oe=>oe.activeDraftKey),dn=Ne(oe=>oe.drafts),$n=!!vn&&!(vn?dn[vn]:void 0)?.target,gs=()=>{Ne.getState().stageDraft(void 0,!0),t("/chat")},z=h("ui.shell.sidebar_navigation.new_chat_shortcut",{shortcut:ji(N6(Lt).replace("+",""))}),V=h("ui.shell.sidebar_navigation.search_accessible",{everything:ji(kl("everything",Lt)),chats:ji(kl("chats",Lt))}),Q=h("ui.shell.sidebar_navigation.search_tooltip",{everything:ji(kl("everything",Lt)),chats:ji(kl("chats",Lt))}),Y=(oe,he,De,je)=>{const nt=oe;return c.jsxs("button",{type:"button",...je.attrs,onClick:je.onClick,disabled:je.disabled,"aria-label":je.ariaLabel,"aria-current":je.current?"page":void 0,className:R(G5,je.current?Lo:"text-ink-muted hover:bg-row-hover hover:text-ink","disabled:text-ink-disabled disabled:hover:bg-transparent"),children:[c.jsx(nt,{size:16,"aria-hidden":"true",className:"shrink-0"}),c.jsx("span",{className:"truncate",children:he}),c.jsx("span",{"aria-hidden":"true",className:"ms-auto",children:c.jsx(Yr,{shortcut:De,joined:!0})})]})},K=Y(RT,h("ui.shell.sidebar_navigation.new_chat"),N6(Lt),{onClick:gs,ariaLabel:z,current:$n,disabled:!Jn,attrs:{"data-tour-tag":"nav-item-chat","data-new-chat-row":""}}),Z=Y(Th,h("ui.shell.sidebar_navigation.search"),Yit("everything",Lt),{onClick:i,ariaLabel:V,attrs:{"data-command-palette-trigger":"",title:Q}}),Te=(oe,he,De)=>{const je=oe;return c.jsx(Iu,{content:c.jsx(Vo,{text:he}),side:e?"left":"right",children:c.jsx("button",{type:"button",...De.attrs,onClick:De.onClick,disabled:De.disabled,"aria-label":he,className:R("flex size-8 items-center justify-center rounded-sm text-ink-muted","transition-colors duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink","disabled:text-ink-disabled disabled:hover:bg-transparent"),children:c.jsxs("span",{className:"relative flex size-7 items-center justify-center",children:[c.jsx(je,{size:16,"aria-hidden":"true"}),(De.attention??0)>0&&c.jsx("span",{className:"pointer-events-none absolute -top-1 -end-1.5 flex",children:c.jsx(ep,{count:De.attention??0,placement:"corner","data-tour-tag":De.attentionTag})}),De.working&&c.jsx("span",{className:"pointer-events-none absolute -bottom-0.5 -end-0.5 flex",children:c.jsx(yi,{size:12,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})})]})})})},He=c.jsx("div",{className:R("pointer-events-none opacity-0 transition-opacity duration-fast ease-out-quart","group-hover/sidebar:pointer-events-auto group-hover/sidebar:opacity-100","group-focus-within/sidebar:pointer-events-auto group-focus-within/sidebar:opacity-100"),children:c.jsx(Iu,{content:Qn,side:e?"left":"right",children:c.jsx(ue,{variant:"ghost",size:"icon-sm",onClick:r,"aria-label":Qn,"aria-expanded":s,"aria-keyshortcuts":JN(Lt),children:c.jsx(_n,{"aria-hidden":"true"})})})}),Ae=()=>{if(B.length===0)return null;const oe=B.map(ie=>j.get(ie)).filter(ie=>ie!==void 0),he=Zdt(oe),De=W?0:he,je=oe.some(ie=>ie.working===!0),nt=he>0?h("ui.shell.sidebar_navigation.more_waiting",{count:he,countText:String(he)}):je?h("ui.shell.sidebar_navigation.more_working"):h("ui.library.page.more_destinations");return c.jsxs("li",{className:R("flex flex-col",s?"gap-0.5":"items-center gap-1"),children:[s?c.jsxs("button",{type:"button","data-tour-tag":"nav-item-more","data-sidebar-more":"","aria-expanded":W,"aria-controls":"sidebar-more-destinations","aria-label":nt,onClick:()=>C(!W),className:R(G5,"text-ink-muted hover:bg-row-hover hover:text-ink"),children:[c.jsx(yc,{size:16,"aria-hidden":"true",className:"shrink-0"}),c.jsx("span",{className:"min-w-0 flex-1 truncate text-start",children:h("ui.library.page.more")}),(De>0||je)&&c.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1",children:[De>0&&c.jsx(ep,{count:De,"data-tour-tag":"nav-more-badge"}),je&&c.jsx(yi,{size:16,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})]}),c.jsx(Ui,{size:14,"aria-hidden":"true",className:R("shrink-0 transition-transform duration-fast",W&&"rotate-180")})]}):Te(yc,nt,{onClick:()=>C(!W),attention:De,attentionTag:"nav-more-badge",working:je,attrs:{"aria-expanded":W,"aria-controls":"sidebar-more-destinations","data-tour-tag":"nav-item-more","data-sidebar-more":""}}),W&&c.jsx("ul",{id:"sidebar-more-destinations",className:R("flex flex-col gap-0.5",!s&&"items-center gap-1"),children:B.map(ls)})]},"nav-overflow")};return s?c.jsxs("div",{"data-sidebar-shell":"","data-glass-region":"sidebar",className:"panel-top-pad group/sidebar flex h-full min-h-0 flex-col overflow-hidden bg-surface",children:[c.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 pe-2 ps-4",children:[c.jsx(U5,{expanded:!0}),c.jsx("span",{className:"ms-auto",children:He})]}),c.jsxs("div",{className:"flex shrink-0 flex-col gap-2 px-2 pb-2",children:[c.jsxs("div",{className:"flex flex-col gap-0.5",children:[K,Z]}),c.jsxs("div",{className:"relative",children:[c.jsxs("div",{ref:be,"data-sidebar-destinations-area":"","data-sidebar-dragging":we!==null?"":void 0,className:"relative min-h-0 max-h-[50dvh] overflow-y-auto select-none",children:[c.jsxs("ul",{"data-sidebar-destinations":"",className:"flex flex-col gap-0.5",children:[L.map(ls),Ae()]}),Zt]}),Hn]}),vr]}),c.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:Kt}),c.jsx(xQ,{})]}):c.jsxs("div",{"data-sidebar-strip":"","data-glass-region":"sidebar",className:"panel-top-pad group/sidebar flex h-full min-h-0 flex-col items-center bg-surface",children:[c.jsx(NQ,{}),c.jsx("div",{className:"flex h-10 shrink-0 items-center justify-center",children:c.jsx(U5,{expanded:!1})}),c.jsxs("ul",{className:"flex flex-col items-center gap-1",children:[c.jsx("li",{children:Te(Hi,Qn,{onClick:r,attrs:{"aria-expanded":!1,"aria-keyshortcuts":JN(Lt)}})}),c.jsx("li",{children:Te(RT,z,{onClick:gs,disabled:!Jn,attrs:{"data-tour-tag":"nav-item-chat"}})}),c.jsx("li",{children:Te(Th,V,{onClick:i,attrs:{"data-command-palette-trigger":""}})})]}),c.jsxs("div",{ref:be,"data-sidebar-destinations-area":"","data-sidebar-dragging":we!==null?"":void 0,className:"relative mt-4 flex flex-col items-center gap-1 select-none",children:[c.jsxs("ul",{"data-sidebar-destinations":"",className:"flex flex-col items-center gap-1",children:[L.map(ls),Ae()]}),Zt,Hn]}),vr,c.jsxs("div",{className:"mt-auto flex flex-col items-center gap-1 pb-2",children:[c.jsx(gQ,{}),c.jsx(_Q,{}),c.jsx(NI,{expanded:!1})]})]})},sht=1,rht=()=>{const{isAuthenticated:e,user:t}=Qy(),{hasBeenNotified:n,setHasBeenNotified:s}=IQ(),[r,i]=m.useState(!1),[a,o]=m.useState(null),l=m.useCallback(async()=>{if(!(!e||!t?.radientUser?.account?.tenant_id))try{const p=await tle({operation:"credits",tenantId:t.radientUser.account.tenant_id});if(!p||typeof p.balance!="number")throw new Error(h("ui.common.errors.credit_balance_invalid"));o(p.balance)}catch(p){console.error("Failed to fetch Radient credits:",p),o(null)}},[e,t?.radientUser?.account?.tenant_id]);return m.useEffect(()=>{e&&l()},[e,l]),m.useEffect(()=>{e&&a!==null?a<sht?n||i(!0):(i(!1),n&&s(!1)):i(!1)},[e,n,a,s]),{isLowCreditsDialogOpen:r,openRadientConsole:()=>{window.api?.openExternal?window.api.openExternal("https://console.radienthq.com"):window.open("https://console.radienthq.com","_blank"),s(!0),i(!1)},closeLowCreditsDialog:()=>{i(!1)},onLowCreditsDialogClose:()=>{s(!0),i(!1)},currentCredits:a}};function iht(){const e=si();m.useEffect(()=>{const t=r=>{e(r==="back"?-1:1)},n=r=>{const i=oU(r);i&&(r.preventDefault(),t(i))},s=r=>{const i=lU(r);i&&(r.preventDefault(),t(i))};return window.addEventListener("keydown",n),window.addEventListener("mouseup",s),()=>{window.removeEventListener("keydown",n),window.removeEventListener("mouseup",s)}},[e])}function aht(){const e=navigator.windowControlsOverlay;if(!e?.getTitlebarAreaRect)return null;try{const t=e.getTitlebarAreaRect();return t.width<=0&&t.height<=0?null:{x:t.x,y:t.y,width:t.width,height:t.height}}catch{return null}}function oht(e,t,n){const s=document.documentElement;if(t==="mac"){s.dataset.chromeLeading="true",s.dataset.chromeTrailing="false";return}if(e===null){s.dataset.chromeLeading="false",s.dataset.chromeTrailing="false";return}s.dataset.chromeLeading=e.x<=1?"true":"false",s.dataset.chromeTrailing=Math.abs(e.x+e.width-n)<=1?"true":"false"}function lht(e){const t=window.api?.windowChrome;if(!t)return;const n=getComputedStyle(document.documentElement),s=n.getPropertyValue("--lo-canvas").trim(),r=n.getPropertyValue("--lo-ink-muted").trim(),i=n.getPropertyValue("--lo-ink-dim").trim();!s||!r||!i||t.report({themeId:e,colors:{ground:s,symbol:r,symbolInactive:i}})}function cht(){m.useLayoutEffect(()=>{if(!window.api?.windowChrome)return;const t=document.documentElement.dataset.chromePlatform??"linux",n=()=>oht(aht(),t,window.innerWidth);n();const s=navigator.windowControlsOverlay;return s?.addEventListener?.("geometrychange",n),window.addEventListener("resize",n),()=>{s?.removeEventListener?.("geometrychange",n),window.removeEventListener("resize",n)}},[]),m.useEffect(()=>{const e=window.api?.windowChrome;if(e)return e.onState(t=>{document.documentElement.dataset.chromeFullscreen=t.fullScreen?"true":"false"})},[])}const uht=m.lazy(()=>La(()=>import("./agent-details-page-B9CKxSrs.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url).then(e=>({default:e.AgentDetailsPage}))),dht=m.lazy(()=>La(()=>import("./agent-hub-page-D8LnPErX.js"),__vite__mapDeps([16,1,2,3,5,6,17,8,7,9,4,10,11,12,13,18,19,20,21,14,15]),import.meta.url).then(e=>({default:e.AgentHubPage}))),V5=m.lazy(()=>La(()=>import("./agents-page-DgxoevHb.js").then(e=>e.a),__vite__mapDeps([22,7,1,2,3,5,6,8,9,18,23,24,25]),import.meta.url).then(e=>({default:e.AgentsPage}))),hht=m.lazy(()=>La(()=>import("./schedules-page-C8nW1wgf.js"),__vite__mapDeps([26,1,2,3,5,6,17,8,7,9,27,12,14,15]),import.meta.url).then(e=>({default:e.SchedulesPage}))),W5=m.lazy(()=>La(()=>import("./projects-page-DZEkOZlF.js"),__vite__mapDeps([28,1,2,3,5,6,8,7,9,17,14,15,25,29]),import.meta.url).then(e=>({default:e.ProjectsPage}))),z5=m.lazy(()=>La(()=>import("./library-page-BQJdR2rI.js").then(e=>e.l),__vite__mapDeps([30,1,2,3,14,5,6,15,17,7,8,9,13,29]),import.meta.url).then(e=>({default:e.LibraryPage}))),$5=m.lazy(()=>La(()=>import("./notifications-page-B8nZbtlS.js"),__vite__mapDeps([31,1,2,3,14,5,6,15,17,8,7,9,25]),import.meta.url).then(e=>({default:e.NotificationsPage}))),fht=m.lazy(()=>La(()=>import("./team-bridge-page-CiWbJeGL.js"),__vite__mapDeps([32,1,2,3,7,5,6,8,9,33,24,21,14,15]),import.meta.url).then(e=>({default:e.TeamBridgePage}))),pht=m.lazy(()=>La(()=>import("./browser-page-Cs7_uVtb.js"),__vite__mapDeps([34,1,2,3,5,6,8,7,9,14,15]),import.meta.url).then(e=>({default:e.BrowserPage}))),ght=m.lazy(()=>La(()=>import("./mesh-page-Ct_YkVDL.js"),__vite__mapDeps([35,1,2,3,5,6,17,8,7,9,14,15]),import.meta.url).then(e=>({default:e.MeshPage}))),mht=m.lazy(()=>La(()=>import("./settings-page-DLGUbw65.js"),__vite__mapDeps([36,1,2,3,5,6,14,15,7,8,9,17,33,19,23,37,11,27,12,38]),import.meta.url).then(e=>({default:e.SettingsPage}))),vht=m.lazy(()=>La(()=>import("./browser-webauthn-prompt-Dzw1WBRS.js"),__vite__mapDeps([39,1,2,3,5,6,8,7,9,14,15]),import.meta.url).then(e=>({default:e.BrowserWebauthnPrompt}))),bht=()=>{Ve(),uut(),cht(),Bdt(),nle();const{pathname:e}=GA(),t=e.startsWith("/chat")||e.startsWith("/browser"),{isOnboardingActive:n}=pge(),{isLowCreditsDialogOpen:s,openRadientConsole:r,onLowCreditsDialogClose:i}=rht(),{isCommandPaletteOpen:a,isCreateAgentDialogOpen:o,isSidebarCollapsed:l,closeCreateAgentDialog:u}=tt();Du(a,"command-palette"),Du(o,"dialog","create-agent"),Du(n,"onboarding"),Du(s,"dialog","low-credits");const d=si(),f=zn(),p=vt(f.data,"session_catalogue",2),g=vt(f.data,"session_archive");m.useEffect(()=>{Ne.getState().requestArchiveConfirm(null)},[e]);const v=Sr(f.data,"peers"),b=Sr(f.data,"library"),_=Sr(f.data,"notifications"),x=Sr(f.data,"team_bridge_conversations"),w=x==="enabled"&&e.startsWith(ag);Ldt(vt(f.data,"team_bridge_conversations"));const y=P=>{Ne.getState().stageDraft({kind:"agent",name:P.name}),d("/chat"),u()};Cat(),Udt(),jle(),sle(),iht(),Aye();const S=Ne(P=>P.setActiveSession),C=zn(),k=Yh(vt(C.data,"aida",1)),T=Ne(P=>{const O=P.activeDraftKey?P.drafts[P.activeDraftKey]:void 0;return Qv(P.activeDraftKey,O?.sessionId,P.activeSessionId)}),A=hme({displayedSessionId:T,archiveEnabled:g}),F=tt(P=>P.setConsolePaneOpen),I=tt(P=>P.setBrowserPaneOpen),N=tt(P=>P.setConsoleActiveSurface);return m.useEffect(()=>{const P=window.api?.desktop?.onOpenConversation?.((O,j)=>{O!==null&&(performance.mark("lop:open:requested"),Hle(O,"native")),S(O),j!==void 0&&O!==null&&(N(j),F(!0)),d("/chat")});return()=>P?.()},[d,S,F,N]),zit(x==="enabled",d),Gdt(x==="enabled",d),m.useEffect(()=>{const P=window.api?.console?.onReveal?.(O=>{if(O.mode!=="none"&&!(O.mode==="session"&&O.session_id!==T)){if(O.mode==="open"){if(!rle({targetSessionId:O.session_id,displayedSessionId:T,activeElement:document.activeElement,commandPaletteOpen:a}))return;S(O.session_id)}N(O.surface),F(!0)}});return()=>P?.()},[T,a,S,F,N]),Bme(),Wst(),m.useEffect(()=>{const P=window.api?.browser?.onConsentAttention?.(O=>{const j=xme(O.requesterSessionId,Ne.getState().sessions);if(vme(O.entryId),j.kind==="browser"){d("/browser");return}S(j.sessionId),I(!0),d("/chat")});return()=>P?.()},[d,S,I]),m.useEffect(()=>{const P=O=>{n||p&&$st(O)&&(O.preventDefault(),Ne.getState().stageDraft(void 0,!0),d("/chat"))};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[p,n,d]),c.jsx(Qct,{children:c.jsx("div",{className:"relative flex h-screen flex-col overflow-hidden","data-titlebar-sidebar-collapsed":l&&!w?"true":"false",children:c.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[a&&c.jsx(_at,{}),c.jsx(Zct,{}),c.jsx(qst,{}),c.jsx(ile,{}),c.jsx(Sat,{enabled:v==="enabled"}),c.jsx(bot,{open:n}),c.jsx(Jct,{}),c.jsx(fut,{}),g&&c.jsx(Gme,{}),c.jsx(Uge,{}),c.jsx(m.Suspense,{fallback:null,children:c.jsx(vht,{})}),c.jsx(ame,{blocked:n||s||a||o||A,sessionId:k.data?.session_id??null}),c.jsx(Wdt,{open:s,onClose:i,onGoToConsole:r}),c.jsx(bge,{open:o,onClose:u,onAgentCreated:y}),c.jsx(ale,{sidebar:c.jsx(nht,{}),routeSidebar:w&&{keeper:c.jsx(NQ,{}),label:h("ui.teamBridge.page.title")},content:c.jsxs("main",{"data-glass-region":"canvas-backing",className:"panel-top-pad flex grow flex-col overflow-hidden",children:[t?null:c.jsx("div",{"data-chrome-route-band":""}),c.jsx(m.Suspense,{fallback:c.jsxs(c.Fragment,{children:[w&&c.jsx(ndt,{}),c.jsx("div",{className:"flex grow items-center justify-center",children:c.jsx(Pn,{size:"lg",label:h("ui.common.loading.page")})})]}),children:c.jsxs(Qee,{children:[c.jsx(xr,{path:"/",element:c.jsx(ZN,{to:"/chat",replace:!0})}),c.jsx(xr,{path:"/chat",element:c.jsx(D6,{})}),c.jsx(xr,{path:"/chat/:agentId",element:c.jsx(D6,{})}),c.jsx(xr,{path:"/agents",element:c.jsx(V5,{})}),c.jsx(xr,{path:"/agents/:agentId",element:c.jsx(V5,{})}),c.jsx(xr,{path:"/settings",element:c.jsx(mht,{})}),c.jsx(xr,{path:"/agent-hub",element:c.jsx(dht,{})}),c.jsx(xr,{path:"/agent-hub/:agentId",element:c.jsx(uht,{})}),c.jsx(xr,{path:"/schedules",element:c.jsx(hht,{})}),c.jsx(xr,{path:"/projects",element:c.jsx(W5,{})}),c.jsx(xr,{path:"/projects/:projectId",element:c.jsx(W5,{})}),c.jsx(xr,{path:"/browser",element:c.jsx(pht,{})}),_==="enabled"&&c.jsxs(c.Fragment,{children:[c.jsx(xr,{path:"/notifications",element:c.jsx($5,{})}),c.jsx(xr,{path:"/notifications/:notificationId",element:c.jsx($5,{})})]}),b==="enabled"&&c.jsxs(c.Fragment,{children:[c.jsx(xr,{path:"/library",element:c.jsx(z5,{})}),c.jsx(xr,{path:"/library/assets/:assetId",element:c.jsx(z5,{})})]}),x==="enabled"&&c.jsx(xr,{path:"/team-bridge",element:c.jsx(fht,{})}),v==="enabled"&&c.jsx(xr,{path:"/mesh",element:c.jsx(ght,{})}),c.jsx(xr,{path:"*",element:c.jsx(ZN,{to:"/chat",replace:!0})})]})})]})})]})})})};let vl=null,Hf=null,Rm=null,Uf=null,_E=null;const _ht={soundsArm:async()=>{if(kf.getState().element)throw new Error("sounds safety: element already exists");if(vl)throw new Error("sounds safety: graph already armed");return vl=new AudioContext,await vl.resume(),lle(e=>{if(!vl)throw new Error("sounds safety: no context");const t=vl.createMediaElementSource(e);Rm=vl.createGain(),Rm.gain.value=0,Hf=vl.createAnalyser(),Uf=vl.createAnalyser(),t.connect(Uf),Uf.connect(Rm),Rm.connect(Hf),Hf.connect(vl.destination)}),{armed:!0,contextState:vl.state}},soundsFacts:()=>{const e=kf.getState(),t=new Float32Array(Hf?.fftSize??32);Hf?.getFloatTimeDomainData(t);const n=new Float32Array(Uf?.fftSize??32);return Uf?.getFloatTimeDomainData(n),{ownerId:e.ownerId,status:e.status,time:e.element?.currentTime??0,duration:e.element?.duration??0,paused:e.element?.paused??!0,gain:Rm?.gain.value??null,inputRms:Uf?Math.sqrt(n.reduce((s,r)=>s+r*r,0)/n.length):null,players:Array.from(document.querySelectorAll("[data-sound-player]")).map(s=>({status:s.getAttribute("data-sound-status"),clock:s.querySelector("[data-sound-time]")?.textContent,clip:s.querySelectorAll("canvas")[1]?.style.clipPath,numeric:getComputedStyle(s.querySelector("[data-sound-time]")??s).fontVariantNumeric})),rms:Hf?Math.sqrt(t.reduce((s,r)=>s+r*r,0)/t.length):null,src:e.element?.src??null,nativeElements:document.querySelectorAll("audio").length,canvas:Object.values(Ps.getState().conversations).map(s=>({selectedTab:s.selectedTabId,files:s.files?.map(r=>({id:r.id,path:r.path,artifact:r.artifact??null}))}))}},soundsScrub:e=>{const t=e,n=document.querySelector(t.selector);if(!n)throw new Error("sounds: no slider");const s=n.getBoundingClientRect(),r=(u,d)=>n.dispatchEvent(new PointerEvent(u,{pointerId:17,pointerType:"mouse",clientX:d,clientY:s.y+s.height/2,bubbles:!0})),i=n.setPointerCapture,a=n.releasePointerCapture;n.setPointerCapture=()=>{},n.releasePointerCapture=()=>{},r("pointerdown",s.left+1),r("pointermove",s.left+s.width*t.fraction);const o=()=>n.closest("[data-sound-player]")?.getAttribute("data-sound-status"),l=performance.now()+1500;return new Promise(u=>{const d=()=>{const f=o();if(f!=="scrubbing"&&performance.now()<l){requestAnimationFrame(d);return}_E=()=>{r("pointerup",s.left+s.width*t.fraction),n.setPointerCapture=i,n.releasePointerCapture=a},u({during:f,seconds:kf.getState().element?.currentTime})};requestAnimationFrame(d)})},soundsScrubFinish:()=>(_E?.(),_E=null,{committed:!0}),soundsEnd:()=>{const e=kf.getState();if(!e.ownerId||!e.element)throw new Error("sounds: no active playback");return e.seek(e.ownerId,e.element.duration-.12),{requested:!0}},soundsSpeech:async()=>{const e=kf.getState();if(!e.element?.src)throw new Error("sounds: fixture not resolved");const{fetchAttachmentBlob:t}=await La(async()=>{const{fetchAttachmentBlob:r}=await import("./conversation-input-sync-PkxW9VtI.js").then(i=>i.oB);return{fetchAttachmentBlob:r}},__vite__mapDeps([7,1,2,3,5,6,8,9]),import.meta.url),n=Ne.getState().activeSessionId,s=e.ownerId?.startsWith("sound:")?e.ownerId.slice(6):null;if(!n||!s)throw new Error("sounds: missing attachment identity");return await ole.getState().speak("sounds-driver",()=>t({sessionId:n,childId:null},s)),{ownerId:kf.getState().ownerId}}};function Tu(){return new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))})}const xht=3,wht=3e3;function yht(e){return e instanceof CSSTransition&&e.playState==="running"}function Cht(e){const t=e.effect,n=t instanceof KeyframeEffect?t.target:null,s=e.transitionProperty,i=/^[a-z-]+$/.test(s)&&n instanceof Element?getComputedStyle(n).getPropertyValue(s).trim()||"(empty)":"(unreadable)";return`${s||"(unnamed property)"} on ${$v(n)??"an element no longer in the document"} = ${i}`}async function q5(e=wht){const t=performance.now();let n=0;for(;;){await Tu();const s=Math.round(performance.now()-t),r=document.getAnimations().filter(yht);if(n=r.length===0?n+1:0,n>=xht)return{waitedMs:s,timedOut:!1,pending:[]};if(s>e)return{waitedMs:s,timedOut:!0,pending:r.map(Cht)}}}const Sht=/^#/;function B0(){const e=window.location.hash.replace(Sht,"");return e===""?"/":e}function $v(e){if(!e)return null;const t=e.getAttribute("aria-label")??e.textContent??"";return`${e.tagName.toLowerCase()}${e.id?`#${e.id}`:""} "${t.trim().slice(0,60)}"`}function kht(e){const t=e.getBoundingClientRect(),n=t.left+t.width/2,s=t.top+t.height/2,r=document.elementFromPoint(n,s),i=r!==null&&(r===e||e.contains(r)),a=document.elementsFromPoint(n,s).slice(0,4).map(l=>$v(l)),o={bubbles:!0,cancelable:!0,composed:!0,button:0,buttons:1,clientX:n,clientY:s,view:window};return e.dispatchEvent(new PointerEvent("pointerdown",{...o,pointerId:1,isPrimary:!0})),e.dispatchEvent(new MouseEvent("mousedown",o)),e.dispatchEvent(new PointerEvent("pointerup",{...o,buttons:0,pointerId:1,isPrimary:!0})),e.dispatchEvent(new MouseEvent("mouseup",{...o,buttons:0})),e.dispatchEvent(new MouseEvent("click",{...o,buttons:0})),{hitTest:i,hit:$v(r),stack:a,disabled:e instanceof HTMLButtonElement?e.disabled:null,rect:{x:t.x,y:t.y,width:t.width,height:t.height}}}function Am(e,t){if(typeof e!="string"||e==="")throw new Error(`${t} must be a non-empty string`);return e}async function Eht(e,t=1e4){const n=Date.now();for(;B0()!==e;){if(Date.now()-n>t)throw new Error(`route did not become ${e} (it is ${B0()})`);await new Promise(s=>setTimeout(s,50))}return await Tu(),B0()}const MA=["dev-driver","query-fetch-probe"];let j0=null;function Tht(){if(j0)return j0;const e=[],t=tP.prototype.fetch;return tP.prototype.fetch=function(...s){return e.push({at:Date.now(),key:JSON.stringify(this.queryKey),stack:(new Error().stack??"").split(`
|
|
666
|
+
*/var n5;function _ot(){if(n5)return Em;n5=1;var e=rt,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,r=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function a(o,l,u){var d,f={},p=null,g=null;u!==void 0&&(p=""+u),l.key!==void 0&&(p=""+l.key),l.ref!==void 0&&(g=l.ref);for(d in l)s.call(l,d)&&!i.hasOwnProperty(d)&&(f[d]=l[d]);if(o&&o.defaultProps)for(d in l=o.defaultProps,l)f[d]===void 0&&(f[d]=l[d]);return{$$typeof:t,type:o,key:p,ref:g,props:f,_owner:r.current}}return Em.Fragment=n,Em.jsx=a,Em.jsxs=a,Em}var s5;function xot(){return s5||(s5=1,t5.exports=_ot()),t5.exports}var wot=xot();/*! shepherd.js 14.5.0 */function yot(e){return e instanceof Element}function og(e){return e instanceof HTMLElement}function ld(e){return typeof e=="function"}function Vv(e){return typeof e=="string"}function xi(e){return e===void 0}class vI{on(t,n,s,r=!1){var i;return xi(this.bindings)&&(this.bindings={}),xi(this.bindings[t])&&(this.bindings[t]=[]),(i=this.bindings[t])==null||i.push({handler:n,ctx:s,once:r}),this}once(t,n,s){return this.on(t,n,s,!0)}off(t,n){if(xi(this.bindings)||xi(this.bindings[t]))return this;if(xi(n))delete this.bindings[t];else{var s;(s=this.bindings[t])==null||s.forEach((r,i)=>{if(r.handler===n){var a;(a=this.bindings[t])==null||a.splice(i,1)}})}return this}trigger(t,...n){if(!xi(this.bindings)&&this.bindings[t]){var s;(s=this.bindings[t])==null||s.forEach((r,i)=>{const{ctx:a,handler:o,once:l}=r,u=a||this;if(o.apply(u,n),l){var d;(d=this.bindings[t])==null||d.splice(i,1)}})}return this}}function ua(){return ua=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)({}).hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},ua.apply(null,arguments)}function bI(e,t){if(e==null)return{};var n={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(t.includes(s))continue;n[s]=e[s]}return n}const xd={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")};xd.defaultMerge;function Cot(e,t){return t}function Sot(e,t){return e.filter(n=>n!==void 0)}var r5;(function(e){e[e.NOT=0]="NOT",e[e.RECORD=1]="RECORD",e[e.ARRAY=2]="ARRAY",e[e.SET=3]="SET",e[e.MAP=4]="MAP",e[e.OTHER=5]="OTHER"})(r5||(r5={}));function i5(e){return typeof e!="object"||e===null?0:Array.isArray(e)?2:Tot(e)?1:e instanceof Set?3:e instanceof Map?4:5}function kot(e){const t=new Set;for(const n of e)for(const s of[...Object.keys(n),...Object.getOwnPropertySymbols(n)])t.add(s);return t}function Eot(e,t){return typeof e=="object"&&Object.prototype.propertyIsEnumerable.call(e,t)}function PX(e){return{*[Symbol.iterator](){for(const t of e)for(const n of t)yield n}}}const a5=new Set(["[object Object]","[object Module]"]);function Tot(e){if(!a5.has(Object.prototype.toString.call(e)))return!1;const{constructor:t}=e;if(t===void 0)return!0;const n=t.prototype;return!(n===null||typeof n!="object"||!a5.has(Object.prototype.toString.call(n))||!n.hasOwnProperty("isPrototypeOf"))}function Rot(e,t,n){const s={};for(const r of kot(e)){const i=[];for(const l of e)Eot(l,r)&&i.push(l[r]);if(i.length===0)continue;const a=t.metaDataUpdater(n,{key:r,parents:e}),o=MX(i,t,a);o!==xd.skip&&(r==="__proto__"?Object.defineProperty(s,r,{value:o,configurable:!0,enumerable:!0,writable:!0}):s[r]=o)}return s}function Aot(e){return e.flat()}function Fot(e){return new Set(PX(e))}function Dot(e){return new Map(PX(e))}function Iot(e){return e.at(-1)}const W_={mergeRecords:Rot,mergeArrays:Aot,mergeSets:Fot,mergeMaps:Dot,mergeOthers:Iot};function _I(...e){return Not({})(...e)}function Not(e,t){const n=Pot(e,s);function s(...r){return MX(r,n,t)}return s}function Pot(e,t){var n,s,r;return{defaultMergeFunctions:W_,mergeFunctions:ua({},W_,Object.fromEntries(Object.entries(e).filter(([i,a])=>Object.hasOwn(W_,i)).map(([i,a])=>a===!1?[i,W_.mergeOthers]:[i,a]))),metaDataUpdater:(n=e.metaDataUpdater)!=null?n:Cot,deepmerge:t,useImplicitDefaultMerging:(s=e.enableImplicitDefaultMerging)!=null?s:!1,filterValues:e.filterValues===!1?void 0:(r=e.filterValues)!=null?r:Sot,actions:xd}}function MX(e,t,n){var s;const r=(s=t.filterValues==null?void 0:t.filterValues(e,n))!=null?s:e;if(r.length===0)return;if(r.length===1)return fE(r,t,n);const i=i5(r[0]);if(i!==0&&i!==5){for(let a=1;a<r.length;a++)if(i5(r[a])!==i)return fE(r,t,n)}switch(i){case 1:return Mot(r,t,n);case 2:return Oot(r,t,n);case 3:return Lot(r,t,n);case 4:return Bot(r,t,n);default:return fE(r,t,n)}}function Mot(e,t,n){const s=t.mergeFunctions.mergeRecords(e,t,n);return s===xd.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeRecords!==t.defaultMergeFunctions.mergeRecords?t.defaultMergeFunctions.mergeRecords(e,t,n):s}function Oot(e,t,n){const s=t.mergeFunctions.mergeArrays(e,t,n);return s===xd.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeArrays!==t.defaultMergeFunctions.mergeArrays?t.defaultMergeFunctions.mergeArrays(e):s}function Lot(e,t,n){const s=t.mergeFunctions.mergeSets(e,t,n);return s===xd.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeSets!==t.defaultMergeFunctions.mergeSets?t.defaultMergeFunctions.mergeSets(e):s}function Bot(e,t,n){const s=t.mergeFunctions.mergeMaps(e,t,n);return s===xd.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps?t.defaultMergeFunctions.mergeMaps(e):s}function fE(e,t,n){const s=t.mergeFunctions.mergeOthers(e,t,n);return s===xd.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(e):s}function xI(e){const t=Object.getOwnPropertyNames(e.constructor.prototype);for(let n=0;n<t.length;n++){const s=t[n],r=e[s];s!=="constructor"&&typeof r=="function"&&(e[s]=r.bind(e))}return e}function jot(e,t){return n=>{if(e.isOpen()){const s=e.el&&n.currentTarget===e.el;(!xi(t)&&n.currentTarget.matches(t)||s)&&e.tour.next()}}}function Hot(e){const{event:t,selector:n}=e.options.advanceOn||{};if(t){const s=jot(e,n);let r=null;if(!xi(n)&&(r=document.querySelector(n),!r))return console.error(`No element was found for the selector supplied to advanceOn: ${n}`);r?(r.addEventListener(t,s),e.on("destroy",()=>r.removeEventListener(t,s))):(document.body.addEventListener(t,s,!0),e.on("destroy",()=>document.body.removeEventListener(t,s,!0)))}else return console.error("advanceOn was defined, but no event name was passed.")}class Uot{constructor(t){}}class Got{constructor(t,n){}}function OX(e){return!Vv(e)||e===""?"":e.charAt(e.length-1)!=="-"?`${e}-`:e}function Vot(e){const t=e.options.attachTo||{},n=Object.assign({},t);if(ld(n.element)&&(n.element=n.element.call(e)),Vv(n.element)){try{n.element=document.querySelector(n.element)}catch{}n.element||console.error(`The element for this Shepherd step was not found ${t.element}`)}return n}function Wot(e){return e.options.extraHighlights?e.options.extraHighlights.flatMap(t=>Array.from(document.querySelectorAll(t))):[]}function LX(e){return e==null?!0:!e.element||!e.on}function BX(){let e=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(t=="x"?n:n&3|8).toString(16)})}const zot=["top","right","bottom","left"],o5=["start","end"],l5=zot.reduce((e,t)=>e.concat(t,t+"-"+o5[0],t+"-"+o5[1]),[]),lg=Math.min,Ch=Math.max,gy=Math.round,z_=Math.floor,Ml=e=>({x:e,y:e}),$ot={left:"right",right:"left",bottom:"top",top:"bottom"},qot={start:"end",end:"start"};function SA(e,t,n){return Ch(e,lg(t,n))}function $h(e,t){return typeof e=="function"?e(t):e}function Uc(e){return e.split("-")[0]}function Nc(e){return e.split("-")[1]}function wI(e){return e==="x"?"y":"x"}function yI(e){return e==="y"?"height":"width"}function cg(e){return["top","bottom"].includes(Uc(e))?"y":"x"}function CI(e){return wI(cg(e))}function jX(e,t,n){n===void 0&&(n=!1);const s=Nc(e),r=CI(e),i=yI(r);let a=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=vy(a)),[a,vy(a)]}function Kot(e){const t=vy(e);return[my(e),t,my(t)]}function my(e){return e.replace(/start|end/g,t=>qot[t])}function Yot(e,t,n){const s=["left","right"],r=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?r:s:t?s:r;case"left":case"right":return t?i:a;default:return[]}}function Xot(e,t,n,s){const r=Nc(e);let i=Yot(Uc(e),n==="start",s);return r&&(i=i.map(a=>a+"-"+r),t&&(i=i.concat(i.map(my)))),i}function vy(e){return e.replace(/left|right|bottom|top/g,t=>$ot[t])}function Qot(e){return ua({top:0,right:0,bottom:0,left:0},e)}function HX(e){return typeof e!="number"?Qot(e):{top:e,right:e,bottom:e,left:e}}function by(e){const{x:t,y:n,width:s,height:r}=e;return{width:s,height:r,top:n,left:t,right:t+s,bottom:n+r,x:t,y:n}}const Jot=["crossAxis","alignment","allowedPlacements","autoAlignment"],Zot=["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"],elt=["mainAxis","crossAxis","limiter"];function c5(e,t,n){let{reference:s,floating:r}=e;const i=cg(t),a=CI(t),o=yI(a),l=Uc(t),u=i==="y",d=s.x+s.width/2-r.width/2,f=s.y+s.height/2-r.height/2,p=s[o]/2-r[o]/2;let g;switch(l){case"top":g={x:d,y:s.y-r.height};break;case"bottom":g={x:d,y:s.y+s.height};break;case"right":g={x:s.x+s.width,y:f};break;case"left":g={x:s.x-r.width,y:f};break;default:g={x:s.x,y:s.y}}switch(Nc(t)){case"start":g[a]-=p*(n&&u?-1:1);break;case"end":g[a]+=p*(n&&u?-1:1);break}return g}const tlt=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:i=[],platform:a}=n,o=i.filter(Boolean),l=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:f}=c5(u,s,l),p=s,g={},v=0;for(let b=0;b<o.length;b++){const{name:_,fn:x}=o[b],{x:w,y,data:S,reset:C}=await x({x:d,y:f,initialPlacement:s,placement:p,strategy:r,middlewareData:g,rects:u,platform:a,elements:{reference:e,floating:t}});d=w??d,f=y??f,g=ua({},g,{[_]:ua({},g[_],S)}),C&&v<=50&&(v++,typeof C=="object"&&(C.placement&&(p=C.placement),C.rects&&(u=C.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:r}):C.rects),{x:d,y:f}=c5(u,p,l)),b=-1)}return{x:d,y:f,placement:p,strategy:r,middlewareData:g}};async function SI(e,t){var n;t===void 0&&(t={});const{x:s,y:r,platform:i,rects:a,elements:o,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:p=!1,padding:g=0}=$h(t,e),v=HX(g),b=o[p?f==="floating"?"reference":"floating":f],_=by(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(b)))==null||n?b:b.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:u,rootBoundary:d,strategy:l})),x=f==="floating"?{x:s,y:r,width:a.floating.width,height:a.floating.height}:a.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),y=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},S=by(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:x,offsetParent:w,strategy:l}):x);return{top:(_.top-S.top+v.top)/y.y,bottom:(S.bottom-_.bottom+v.bottom)/y.y,left:(_.left-S.left+v.left)/y.x,right:(S.right-_.right+v.right)/y.x}}const nlt=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:r,rects:i,platform:a,elements:o,middlewareData:l}=t,{element:u,padding:d=0}=$h(e,t)||{};if(u==null)return{};const f=HX(d),p={x:n,y:s},g=CI(r),v=yI(g),b=await a.getDimensions(u),_=g==="y",x=_?"top":"left",w=_?"bottom":"right",y=_?"clientHeight":"clientWidth",S=i.reference[v]+i.reference[g]-p[g]-i.floating[v],C=p[g]-i.reference[g],k=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let T=k?k[y]:0;(!T||!await(a.isElement==null?void 0:a.isElement(k)))&&(T=o.floating[y]||i.floating[v]);const A=S/2-C/2,F=T/2-b[v]/2-1,I=lg(f[x],F),N=lg(f[w],F),P=I,O=T-b[v]-N,j=T/2-b[v]/2+A,M=SA(P,j,O),X=!l.arrow&&Nc(r)!=null&&j!==M&&i.reference[v]/2-(j<P?I:N)-b[v]/2<0,se=X?j<P?j-P:j-O:0;return{[g]:p[g]+se,data:ua({[g]:M,centerOffset:j-M-se},X&&{alignmentOffset:se}),reset:X}}});function slt(e,t,n){return(e?[...n.filter(s=>Nc(s)===e),...n.filter(s=>Nc(s)!==e)]:n.filter(s=>Uc(s)===s)).filter(s=>e?Nc(s)===e||(t?my(s)!==s:!1):!0)}const rlt=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,s,r;const{rects:i,middlewareData:a,placement:o,platform:l,elements:u}=t,d=$h(e,t),{crossAxis:f=!1,alignment:p,allowedPlacements:g=l5,autoAlignment:v=!0}=d,b=bI(d,Jot),_=p!==void 0||g===l5?slt(p||null,v,g):g,x=await SI(t,b),w=((n=a.autoPlacement)==null?void 0:n.index)||0,y=_[w];if(y==null)return{};const S=jX(y,i,await(l.isRTL==null?void 0:l.isRTL(u.floating)));if(o!==y)return{reset:{placement:_[0]}};const C=[x[Uc(y)],x[S[0]],x[S[1]]],k=[...((s=a.autoPlacement)==null?void 0:s.overflows)||[],{placement:y,overflows:C}],T=_[w+1];if(T)return{data:{index:w+1,overflows:k},reset:{placement:T}};const A=k.map(I=>{const N=Nc(I.placement);return[I.placement,N&&f?I.overflows.slice(0,2).reduce((P,O)=>P+O,0):I.overflows[0],I.overflows]}).sort((I,N)=>I[1]-N[1]),F=((r=A.filter(I=>I[2].slice(0,Nc(I[0])?2:3).every(N=>N<=0))[0])==null?void 0:r[0])||A[0][0];return F!==o?{data:{index:w+1,overflows:k},reset:{placement:F}}:{}}}},ilt=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:l,elements:u}=t,d=$h(e,t),{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:_=!0}=d,x=bI(d,Zot);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=Uc(r),y=cg(o),S=Uc(o)===o,C=await(l.isRTL==null?void 0:l.isRTL(u.floating)),k=g||(S||!_?[vy(o)]:Kot(o)),T=b!=="none";!g&&T&&k.push(...Xot(o,_,b,C));const A=[o,...k],F=await SI(t,x),I=[];let N=((s=i.flip)==null?void 0:s.overflows)||[];if(f&&I.push(F[w]),p){const M=jX(r,a,C);I.push(F[M[0]],F[M[1]])}if(N=[...N,{placement:r,overflows:I}],!I.every(M=>M<=0)){var P,O;const M=(((P=i.flip)==null?void 0:P.index)||0)+1,X=A[M];if(X)return{data:{index:M,overflows:N},reset:{placement:X}};let se=(O=N.filter(ee=>ee.overflows[0]<=0).sort((ee,q)=>ee.overflows[1]-q.overflows[1])[0])==null?void 0:O.placement;if(!se)switch(v){case"bestFit":{var j;const ee=(j=N.filter(q=>{if(T){const ne=cg(q.placement);return ne===y||ne==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(ne=>ne>0).reduce((ne,te)=>ne+te,0)]).sort((q,ne)=>q[1]-ne[1])[0])==null?void 0:j[0];ee&&(se=ee);break}case"initialPlacement":se=o;break}if(r!==se)return{reset:{placement:se}}}return{}}}},alt=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:r}=t,i=$h(e,t),{mainAxis:a=!0,crossAxis:o=!1,limiter:l={fn:x=>{let{x:w,y}=x;return{x:w,y}}}}=i,u=bI(i,elt),d={x:n,y:s},f=await SI(t,u),p=cg(Uc(r)),g=wI(p);let v=d[g],b=d[p];if(a){const x=g==="y"?"top":"left",w=g==="y"?"bottom":"right",y=v+f[x],S=v-f[w];v=SA(y,v,S)}if(o){const x=p==="y"?"top":"left",w=p==="y"?"bottom":"right",y=b+f[x],S=b-f[w];b=SA(y,b,S)}const _=l.fn(ua({},t,{[g]:v,[p]:b}));return ua({},_,{data:{x:_.x-n,y:_.y-s}})}}},olt=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:r,rects:i,middlewareData:a}=t,{offset:o=0,mainAxis:l=!0,crossAxis:u=!0}=$h(e,t),d={x:n,y:s},f=cg(r),p=wI(f);let g=d[p],v=d[f];const b=$h(o,t),_=typeof b=="number"?{mainAxis:b,crossAxis:0}:ua({mainAxis:0,crossAxis:0},b);if(l){const y=p==="y"?"height":"width",S=i.reference[p]-i.floating[y]+_.mainAxis,C=i.reference[p]+i.reference[y]-_.mainAxis;g<S?g=S:g>C&&(g=C)}if(u){var x,w;const y=p==="y"?"width":"height",S=["top","left"].includes(Uc(r)),C=i.reference[f]-i.floating[y]+(S&&((x=a.offset)==null?void 0:x[f])||0)+(S?0:_.crossAxis),k=i.reference[f]+i.reference[y]+(S?0:((w=a.offset)==null?void 0:w[f])||0)-(S?_.crossAxis:0);v<C?v=C:v>k&&(v=k)}return{[p]:g,[f]:v}}}};function JC(){return typeof window<"u"}function Mg(e){return UX(e)?(e.nodeName||"").toLowerCase():"#document"}function Na(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Yl(e){var t;return(t=(UX(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function UX(e){return JC()?e instanceof Node||e instanceof Na(e).Node:!1}function Jo(e){return JC()?e instanceof Element||e instanceof Na(e).Element:!1}function Gl(e){return JC()?e instanceof HTMLElement||e instanceof Na(e).HTMLElement:!1}function u5(e){return!JC()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Na(e).ShadowRoot}function Tb(e){const{overflow:t,overflowX:n,overflowY:s,display:r}=Zo(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!["inline","contents"].includes(r)}function llt(e){return["table","td","th"].includes(Mg(e))}function ZC(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function kI(e){const t=EI(),n=Jo(e)?Zo(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(s=>(n.willChange||"").includes(s))||["paint","layout","strict","content"].some(s=>(n.contain||"").includes(s))}function clt(e){let t=cd(e);for(;Gl(t)&&!ug(t);){if(kI(t))return t;if(ZC(t))return null;t=cd(t)}return null}function EI(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ug(e){return["html","body","#document"].includes(Mg(e))}function Zo(e){return Na(e).getComputedStyle(e)}function e1(e){return Jo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function cd(e){if(Mg(e)==="html")return e;const t=e.assignedSlot||e.parentNode||u5(e)&&e.host||Yl(e);return u5(t)?t.host:t}function GX(e){const t=cd(e);return ug(t)?e.ownerDocument?e.ownerDocument.body:e.body:Gl(t)&&Tb(t)?t:GX(t)}function Wv(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=GX(e),i=r===((s=e.ownerDocument)==null?void 0:s.body),a=Na(r);if(i){const o=kA(a);return t.concat(a,a.visualViewport||[],Tb(r)?r:[],o&&n?Wv(o):[])}return t.concat(r,Wv(r,[],n))}function kA(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function VX(e){const t=Zo(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=Gl(e),i=r?e.offsetWidth:n,a=r?e.offsetHeight:s,o=gy(n)!==i||gy(s)!==a;return o&&(n=i,s=a),{width:n,height:s,$:o}}function TI(e){return Jo(e)?e:e.contextElement}function Lp(e){const t=TI(e);if(!Gl(t))return Ml(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:i}=VX(t);let a=(i?gy(n.width):n.width)/s,o=(i?gy(n.height):n.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}const ult=Ml(0);function WX(e){const t=Na(e);return!EI()||!t.visualViewport?ult:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function dlt(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Na(e)?!1:t}function qh(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=TI(e);let a=Ml(1);t&&(s?Jo(s)&&(a=Lp(s)):a=Lp(e));const o=dlt(i,n,s)?WX(i):Ml(0);let l=(r.left+o.x)/a.x,u=(r.top+o.y)/a.y,d=r.width/a.x,f=r.height/a.y;if(i){const p=Na(i),g=s&&Jo(s)?Na(s):s;let v=p,b=kA(v);for(;b&&s&&g!==v;){const _=Lp(b),x=b.getBoundingClientRect(),w=Zo(b),y=x.left+(b.clientLeft+parseFloat(w.paddingLeft))*_.x,S=x.top+(b.clientTop+parseFloat(w.paddingTop))*_.y;l*=_.x,u*=_.y,d*=_.x,f*=_.y,l+=y,u+=S,v=Na(b),b=kA(v)}}return by({width:d,height:f,x:l,y:u})}function RI(e,t){const n=e1(e).scrollLeft;return t?t.left+n:qh(Yl(e)).left+n}function zX(e,t,n){n===void 0&&(n=!1);const s=e.getBoundingClientRect(),r=s.left+t.scrollLeft-(n?0:RI(e,s)),i=s.top+t.scrollTop;return{x:r,y:i}}function hlt(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const i=r==="fixed",a=Yl(s),o=t?ZC(t.floating):!1;if(s===a||o&&i)return n;let l={scrollLeft:0,scrollTop:0},u=Ml(1);const d=Ml(0),f=Gl(s);if((f||!f&&!i)&&((Mg(s)!=="body"||Tb(a))&&(l=e1(s)),Gl(s))){const g=qh(s);u=Lp(s),d.x=g.x+s.clientLeft,d.y=g.y+s.clientTop}const p=a&&!f&&!i?zX(a,l,!0):Ml(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-l.scrollTop*u.y+d.y+p.y}}function flt(e){return Array.from(e.getClientRects())}function plt(e){const t=Yl(e),n=e1(e),s=e.ownerDocument.body,r=Ch(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),i=Ch(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let a=-n.scrollLeft+RI(e);const o=-n.scrollTop;return Zo(s).direction==="rtl"&&(a+=Ch(t.clientWidth,s.clientWidth)-r),{width:r,height:i,x:a,y:o}}function glt(e,t){const n=Na(e),s=Yl(e),r=n.visualViewport;let i=s.clientWidth,a=s.clientHeight,o=0,l=0;if(r){i=r.width,a=r.height;const u=EI();(!u||u&&t==="fixed")&&(o=r.offsetLeft,l=r.offsetTop)}return{width:i,height:a,x:o,y:l}}function mlt(e,t){const n=qh(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,i=Gl(e)?Lp(e):Ml(1),a=e.clientWidth*i.x,o=e.clientHeight*i.y,l=r*i.x,u=s*i.y;return{width:a,height:o,x:l,y:u}}function d5(e,t,n){let s;if(t==="viewport")s=glt(e,n);else if(t==="document")s=plt(Yl(e));else if(Jo(t))s=mlt(t,n);else{const r=WX(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return by(s)}function $X(e,t){const n=cd(e);return n===t||!Jo(n)||ug(n)?!1:Zo(n).position==="fixed"||$X(n,t)}function vlt(e,t){const n=t.get(e);if(n)return n;let s=Wv(e,[],!1).filter(o=>Jo(o)&&Mg(o)!=="body"),r=null;const i=Zo(e).position==="fixed";let a=i?cd(e):e;for(;Jo(a)&&!ug(a);){const o=Zo(a),l=kI(a);!l&&o.position==="fixed"&&(r=null),(i?!l&&!r:!l&&o.position==="static"&&r&&["absolute","fixed"].includes(r.position)||Tb(a)&&!l&&$X(e,a))?s=s.filter(u=>u!==a):r=o,a=cd(a)}return t.set(e,s),s}function blt(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const i=[...n==="clippingAncestors"?ZC(t)?[]:vlt(t,this._c):[].concat(n),s],a=i[0],o=i.reduce((l,u)=>{const d=d5(t,u,r);return l.top=Ch(d.top,l.top),l.right=lg(d.right,l.right),l.bottom=lg(d.bottom,l.bottom),l.left=Ch(d.left,l.left),l},d5(t,a,r));return{width:o.right-o.left,height:o.bottom-o.top,x:o.left,y:o.top}}function _lt(e){const{width:t,height:n}=VX(e);return{width:t,height:n}}function xlt(e,t,n){const s=Gl(t),r=Yl(t),i=n==="fixed",a=qh(e,!0,i,t);let o={scrollLeft:0,scrollTop:0};const l=Ml(0);if(s||!s&&!i)if((Mg(t)!=="body"||Tb(r))&&(o=e1(t)),s){const p=qh(t,!0,i,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else r&&(l.x=RI(r));const u=r&&!s&&!i?zX(r,o):Ml(0),d=a.left+o.scrollLeft-l.x-u.x,f=a.top+o.scrollTop-l.y-u.y;return{x:d,y:f,width:a.width,height:a.height}}function pE(e){return Zo(e).position==="static"}function h5(e,t){if(!Gl(e)||Zo(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Yl(e)===n&&(n=n.ownerDocument.body),n}function qX(e,t){const n=Na(e);if(ZC(e))return n;if(!Gl(e)){let r=cd(e);for(;r&&!ug(r);){if(Jo(r)&&!pE(r))return r;r=cd(r)}return n}let s=h5(e,t);for(;s&&llt(s)&&pE(s);)s=h5(s,t);return s&&ug(s)&&pE(s)&&!kI(s)?n:s||clt(e)||n}const wlt=async function(e){const t=this.getOffsetParent||qX,n=this.getDimensions,s=await n(e.floating);return{reference:xlt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function ylt(e){return Zo(e).direction==="rtl"}const Clt={convertOffsetParentRelativeRectToViewportRelativeRect:hlt,getDocumentElement:Yl,getClippingRect:blt,getOffsetParent:qX,getElementRects:wlt,getClientRects:flt,getDimensions:_lt,getScale:Lp,isElement:Jo,isRTL:ylt};function Slt(e,t){let n=null,s;const r=Yl(e);function i(){var o;clearTimeout(s),(o=n)==null||o.disconnect(),n=null}function a(o,l){o===void 0&&(o=!1),l===void 0&&(l=1),i();const{left:u,top:d,width:f,height:p}=e.getBoundingClientRect();if(o||t(),!f||!p)return;const g=z_(d),v=z_(r.clientWidth-(u+f)),b=z_(r.clientHeight-(d+p)),_=z_(u),x={rootMargin:-g+"px "+-v+"px "+-b+"px "+-_+"px",threshold:Ch(0,lg(1,l))||1};let w=!0;function y(S){const C=S[0].intersectionRatio;if(C!==l){if(!w)return a();C?a(!1,C):s=setTimeout(()=>{a(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(y,ua({},x,{root:r.ownerDocument}))}catch{n=new IntersectionObserver(y,x)}n.observe(e)}return a(!0),i}function klt(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:l=!1}=s,u=TI(e),d=r||i?[...u?Wv(u):[],...Wv(t)]:[];d.forEach(x=>{r&&x.addEventListener("scroll",n,{passive:!0}),i&&x.addEventListener("resize",n)});const f=u&&o?Slt(u,n):null;let p=-1,g=null;a&&(g=new ResizeObserver(x=>{let[w]=x;w&&w.target===u&&g&&(g.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var y;(y=g)==null||y.observe(t)})),n()}),u&&!l&&g.observe(u),g.observe(t));let v,b=l?qh(e):null;l&&_();function _(){const x=qh(e);b&&(x.x!==b.x||x.y!==b.y||x.width!==b.width||x.height!==b.height)&&n(),b=x,v=requestAnimationFrame(_)}return n(),()=>{var x;d.forEach(w=>{r&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),f?.(),(x=g)==null||x.disconnect(),g=null,l&&cancelAnimationFrame(v)}}const Elt=rlt,Tlt=alt,Rlt=ilt,Alt=nlt,Flt=olt,Dlt=(e,t,n)=>{const s=new Map,r=ua({platform:Clt},n),i=ua({},r.platform,{_c:s});return tlt(e,t,ua({},r,{platform:i}))};function Ilt(e){e.cleanup&&e.cleanup();const t=e._getResolvedAttachToOptions();let n=t.element;const s=Blt(t,e),r=LX(t);return r&&(n=document.body,e.shepherdElementComponent.getElement().classList.add("shepherd-centered")),e.cleanup=klt(n,e.el,()=>{if(!e.el){e.cleanup==null||e.cleanup();return}Mlt(n,e,s,r)}),e.target=t.element,s}function Nlt(e,t){return{floatingUIOptions:_I(e.floatingUIOptions||{},t.floatingUIOptions||{})}}function Plt(e){e.cleanup&&e.cleanup(),e.cleanup=null}function Mlt(e,t,n,s){return Dlt(e,t.el,n).then(Olt(t,s)).then(r=>new Promise(i=>{setTimeout(()=>i(r),300)})).then(r=>{r!=null&&r.el&&r.el.focus({preventScroll:!0})})}function Olt(e,t){return({x:n,y:s,placement:r,middlewareData:i})=>(e.el&&(t?Object.assign(e.el.style,{position:"fixed",left:"50%",top:"50%",transform:"translate(-50%, -50%)"}):Object.assign(e.el.style,{position:"absolute",left:`${n}px`,top:`${s}px`}),e.el.dataset.popperPlacement=r,Llt(e.el,i)),e)}function Llt(e,t){const n=e.querySelector(".shepherd-arrow");if(og(n)&&t.arrow){const{x:s,y:r}=t.arrow;Object.assign(n.style,{left:s!=null?`${s}px`:"",top:r!=null?`${r}px`:""})}}function Blt(e,t){var n,s,r;const i={strategy:"absolute"};i.middleware=[];const a=jlt(t),o=LX(e),l=(n=e.on)==null?void 0:n.includes("auto"),u=(e==null||(s=e.on)==null?void 0:s.includes("-start"))||(e==null||(r=e.on)==null?void 0:r.includes("-end"));if(!o){if(l){var d;i.middleware.push(Elt({crossAxis:!0,alignment:u?e==null||(d=e.on)==null?void 0:d.split("-").pop():null}))}else i.middleware.push(Rlt());if(i.middleware.push(Tlt({limiter:Flt(),crossAxis:!0})),a){const f=typeof t.options.arrow=="object"?t.options.arrow:{padding:4};i.middleware.push(Alt({element:a,padding:u?f.padding:0}))}l||(i.placement=e.on)}return _I(i,t.options.floatingUIOptions||{})}function jlt(e){return e.options.arrow&&e.el?e.el.querySelector(".shepherd-arrow"):!1}function Oa(){}function Hlt(e,t){for(const n in t)e[n]=t[n];return e}function KX(e){return e()}function f5(){return Object.create(null)}function Rb(e){e.forEach(KX)}function AI(e){return typeof e=="function"}function Qc(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Ult(e){return Object.keys(e).length===0}function dg(e,t){e.appendChild(t)}function il(e,t,n){e.insertBefore(t,n||null)}function Eo(e){e.parentNode&&e.parentNode.removeChild(e)}function Glt(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function Vl(e){return document.createElement(e)}function p5(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function YX(e){return document.createTextNode(e)}function _y(){return YX(" ")}function Vlt(){return YX("")}function t1(e,t,n,s){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n,s)}function ps(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}const Wlt=["width","height"];function g5(e,t){const n=Object.getOwnPropertyDescriptors(e.__proto__);for(const s in t)t[s]==null?e.removeAttribute(s):s==="style"?e.style.cssText=t[s]:s==="__value"?e.value=e[s]=t[s]:n[s]&&n[s].set&&Wlt.indexOf(s)===-1?e[s]=t[s]:ps(e,s,t[s])}function zlt(e){return Array.from(e.childNodes)}function Lf(e,t,n){e.classList.toggle(t,!!n)}let zv;function L0(e){zv=e}function XX(){if(!zv)throw new Error("Function called outside component initialization");return zv}function $lt(e){XX().$$.on_mount.push(e)}function FI(e){XX().$$.after_update.push(e)}const Zf=[],hg=[];let Bp=[];const m5=[],qlt=Promise.resolve();let EA=!1;function Klt(){EA||(EA=!0,qlt.then(QX))}function TA(e){Bp.push(e)}const gE=new Set;let Bf=0;function QX(){if(Bf!==0)return;const e=zv;do{try{for(;Bf<Zf.length;){const t=Zf[Bf];Bf++,L0(t),Ylt(t.$$)}}catch(t){throw Zf.length=0,Bf=0,t}for(L0(null),Zf.length=0,Bf=0;hg.length;)hg.pop()();for(let t=0;t<Bp.length;t+=1){const n=Bp[t];gE.has(n)||(gE.add(n),n())}Bp.length=0}while(Zf.length);for(;m5.length;)m5.pop()();EA=!1,gE.clear(),L0(e)}function Ylt(e){if(e.fragment!==null){e.update(),Rb(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(TA)}}function Xlt(e){const t=[],n=[];Bp.forEach(s=>e.indexOf(s)===-1?t.push(s):n.push(s)),n.forEach(s=>s()),Bp=t}const Ex=new Set;let ah;function Sh(){ah={r:0,c:[],p:ah}}function kh(){ah.r||Rb(ah.c),ah=ah.p}function ns(e,t){e&&e.i&&(Ex.delete(e),e.i(t))}function Zs(e,t,n,s){if(e&&e.o){if(Ex.has(e))return;Ex.add(e),ah.c.push(()=>{Ex.delete(e),s&&(n&&e.d(1),s())}),e.o(t)}else s&&s()}function v5(e){return e?.length!==void 0?e:Array.from(e)}function Qlt(e,t){const n={},s={},r={$$scope:1};let i=e.length;for(;i--;){const a=e[i],o=t[i];if(o){for(const l in a)l in o||(s[l]=1);for(const l in o)r[l]||(n[l]=o[l],r[l]=1);e[i]=o}else for(const l in a)r[l]=1}for(const a in s)a in n||(n[a]=void 0);return n}function df(e){e&&e.c()}function wd(e,t,n){const{fragment:s,after_update:r}=e.$$;s&&s.m(t,n),TA(()=>{const i=e.$$.on_mount.map(KX).filter(AI);e.$$.on_destroy?e.$$.on_destroy.push(...i):Rb(i),e.$$.on_mount=[]}),r.forEach(TA)}function yd(e,t){const n=e.$$;n.fragment!==null&&(Xlt(n.after_update),Rb(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Jlt(e,t){e.$$.dirty[0]===-1&&(Zf.push(e),Klt(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function Jc(e,t,n,s,r,i,a=null,o=[-1]){const l=zv;L0(e);const u=e.$$={fragment:null,ctx:[],props:i,update:Oa,not_equal:r,bound:f5(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:f5(),dirty:o,skip_bound:!1,root:t.target||l.$$.root};a&&a(u.root);let d=!1;if(u.ctx=n?n(e,t.props||{},(f,p,...g)=>{const v=g.length?g[0]:p;return u.ctx&&r(u.ctx[f],u.ctx[f]=v)&&(!u.skip_bound&&u.bound[f]&&u.bound[f](v),d&&Jlt(e,f)),p}):[],u.update(),d=!0,Rb(u.before_update),u.fragment=s?s(u.ctx):!1,t.target){if(t.hydrate){const f=zlt(t.target);u.fragment&&u.fragment.l(f),f.forEach(Eo)}else u.fragment&&u.fragment.c();t.intro&&ns(e.$$.fragment),wd(e,t.target,t.anchor),QX()}L0(l)}class Zc{constructor(){this.$$=void 0,this.$$set=void 0}$destroy(){yd(this,1),this.$destroy=Oa}$on(t,n){if(!AI(n))return Oa;const s=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return s.push(n),()=>{const r=s.indexOf(n);r!==-1&&s.splice(r,1)}}$set(t){this.$$set&&!Ult(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Zlt="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Zlt);function ect(e){let t,n,s,r,i;return{c(){t=Vl("button"),ps(t,"aria-label",n=e[3]?e[3]:null),ps(t,"class",s=`${e[1]||""} shepherd-button ${e[4]?"shepherd-button-secondary":""}`),t.disabled=e[2],ps(t,"tabindex","0"),ps(t,"type","button")},m(a,o){il(a,t,o),t.innerHTML=e[5],r||(i=t1(t,"click",function(){AI(e[0])&&e[0].apply(this,arguments)}),r=!0)},p(a,[o]){e=a,o&32&&(t.innerHTML=e[5]),o&8&&n!==(n=e[3]?e[3]:null)&&ps(t,"aria-label",n),o&18&&s!==(s=`${e[1]||""} shepherd-button ${e[4]?"shepherd-button-secondary":""}`)&&ps(t,"class",s),o&4&&(t.disabled=e[2])},i:Oa,o:Oa,d(a){a&&Eo(t),r=!1,i()}}}function tct(e,t,n){let{config:s,step:r}=t,i,a,o,l,u,d;function f(p){return ld(p)?p=p.call(r):p}return e.$$set=p=>{"config"in p&&n(6,s=p.config),"step"in p&&n(7,r=p.step)},e.$$.update=()=>{e.$$.dirty&192&&(n(0,i=s.action?s.action.bind(r.tour):null),n(1,a=s.classes),n(2,o=s.disabled?f(s.disabled):!1),n(3,l=s.label?f(s.label):null),n(4,u=s.secondary),n(5,d=s.text?f(s.text):null))},[i,a,o,l,u,d,s,r]}class nct extends Zc{constructor(t){super(),Jc(this,t,tct,ect,Qc,{config:6,step:7})}}function b5(e,t,n){const s=e.slice();return s[2]=t[n],s}function _5(e){let t,n,s=v5(e[1]),r=[];for(let a=0;a<s.length;a+=1)r[a]=x5(b5(e,s,a));const i=a=>Zs(r[a],1,1,()=>{r[a]=null});return{c(){for(let a=0;a<r.length;a+=1)r[a].c();t=Vlt()},m(a,o){for(let l=0;l<r.length;l+=1)r[l]&&r[l].m(a,o);il(a,t,o),n=!0},p(a,o){if(o&3){s=v5(a[1]);let l;for(l=0;l<s.length;l+=1){const u=b5(a,s,l);r[l]?(r[l].p(u,o),ns(r[l],1)):(r[l]=x5(u),r[l].c(),ns(r[l],1),r[l].m(t.parentNode,t))}for(Sh(),l=s.length;l<r.length;l+=1)i(l);kh()}},i(a){if(!n){for(let o=0;o<s.length;o+=1)ns(r[o]);n=!0}},o(a){r=r.filter(Boolean);for(let o=0;o<r.length;o+=1)Zs(r[o]);n=!1},d(a){a&&Eo(t),Glt(r,a)}}}function x5(e){let t,n;return t=new nct({props:{config:e[2],step:e[0]}}),{c(){df(t.$$.fragment)},m(s,r){wd(t,s,r),n=!0},p(s,r){const i={};r&2&&(i.config=s[2]),r&1&&(i.step=s[0]),t.$set(i)},i(s){n||(ns(t.$$.fragment,s),n=!0)},o(s){Zs(t.$$.fragment,s),n=!1},d(s){yd(t,s)}}}function sct(e){let t,n,s=e[1]&&_5(e);return{c(){t=Vl("footer"),s&&s.c(),ps(t,"class","shepherd-footer")},m(r,i){il(r,t,i),s&&s.m(t,null),n=!0},p(r,[i]){r[1]?s?(s.p(r,i),i&2&&ns(s,1)):(s=_5(r),s.c(),ns(s,1),s.m(t,null)):s&&(Sh(),Zs(s,1,1,()=>{s=null}),kh())},i(r){n||(ns(s),n=!0)},o(r){Zs(s),n=!1},d(r){r&&Eo(t),s&&s.d()}}}function rct(e,t,n){let s,{step:r}=t;return e.$$set=i=>{"step"in i&&n(0,r=i.step)},e.$$.update=()=>{e.$$.dirty&1&&n(1,s=r.options.buttons)},[r,s]}class ict extends Zc{constructor(t){super(),Jc(this,t,rct,sct,Qc,{step:0})}}function act(e){let t,n,s,r,i;return{c(){t=Vl("button"),n=Vl("span"),n.textContent="×",ps(n,"aria-hidden","true"),ps(t,"aria-label",s=e[0].label?e[0].label:"Close Tour"),ps(t,"class","shepherd-cancel-icon"),ps(t,"type","button")},m(a,o){il(a,t,o),dg(t,n),r||(i=t1(t,"click",e[1]),r=!0)},p(a,[o]){o&1&&s!==(s=a[0].label?a[0].label:"Close Tour")&&ps(t,"aria-label",s)},i:Oa,o:Oa,d(a){a&&Eo(t),r=!1,i()}}}function oct(e,t,n){let{cancelIcon:s,step:r}=t;const i=a=>{a.preventDefault(),r.cancel()};return e.$$set=a=>{"cancelIcon"in a&&n(0,s=a.cancelIcon),"step"in a&&n(2,r=a.step)},[s,i,r]}class lct extends Zc{constructor(t){super(),Jc(this,t,oct,act,Qc,{cancelIcon:0,step:2})}}function cct(e){let t;return{c(){t=Vl("h3"),ps(t,"id",e[1]),ps(t,"class","shepherd-title")},m(n,s){il(n,t,s),e[3](t)},p(n,[s]){s&2&&ps(t,"id",n[1])},i:Oa,o:Oa,d(n){n&&Eo(t),e[3](null)}}}function uct(e,t,n){let{labelId:s,element:r,title:i}=t;FI(()=>{ld(i)&&n(2,i=i()),n(0,r.innerHTML=i,r)});function a(o){hg[o?"unshift":"push"](()=>{r=o,n(0,r)})}return e.$$set=o=>{"labelId"in o&&n(1,s=o.labelId),"element"in o&&n(0,r=o.element),"title"in o&&n(2,i=o.title)},[r,s,i,a]}class dct extends Zc{constructor(t){super(),Jc(this,t,uct,cct,Qc,{labelId:1,element:0,title:2})}}function w5(e){let t,n;return t=new dct({props:{labelId:e[0],title:e[2]}}),{c(){df(t.$$.fragment)},m(s,r){wd(t,s,r),n=!0},p(s,r){const i={};r&1&&(i.labelId=s[0]),r&4&&(i.title=s[2]),t.$set(i)},i(s){n||(ns(t.$$.fragment,s),n=!0)},o(s){Zs(t.$$.fragment,s),n=!1},d(s){yd(t,s)}}}function y5(e){let t,n;return t=new lct({props:{cancelIcon:e[3],step:e[1]}}),{c(){df(t.$$.fragment)},m(s,r){wd(t,s,r),n=!0},p(s,r){const i={};r&8&&(i.cancelIcon=s[3]),r&2&&(i.step=s[1]),t.$set(i)},i(s){n||(ns(t.$$.fragment,s),n=!0)},o(s){Zs(t.$$.fragment,s),n=!1},d(s){yd(t,s)}}}function hct(e){let t,n,s,r=e[2]&&w5(e),i=e[3]&&e[3].enabled&&y5(e);return{c(){t=Vl("header"),r&&r.c(),n=_y(),i&&i.c(),ps(t,"class","shepherd-header")},m(a,o){il(a,t,o),r&&r.m(t,null),dg(t,n),i&&i.m(t,null),s=!0},p(a,[o]){a[2]?r?(r.p(a,o),o&4&&ns(r,1)):(r=w5(a),r.c(),ns(r,1),r.m(t,n)):r&&(Sh(),Zs(r,1,1,()=>{r=null}),kh()),a[3]&&a[3].enabled?i?(i.p(a,o),o&8&&ns(i,1)):(i=y5(a),i.c(),ns(i,1),i.m(t,null)):i&&(Sh(),Zs(i,1,1,()=>{i=null}),kh())},i(a){s||(ns(r),ns(i),s=!0)},o(a){Zs(r),Zs(i),s=!1},d(a){a&&Eo(t),r&&r.d(),i&&i.d()}}}function fct(e,t,n){let{labelId:s,step:r}=t,i,a;return e.$$set=o=>{"labelId"in o&&n(0,s=o.labelId),"step"in o&&n(1,r=o.step)},e.$$.update=()=>{e.$$.dirty&2&&(n(2,i=r.options.title),n(3,a=r.options.cancelIcon))},[s,r,i,a]}class pct extends Zc{constructor(t){super(),Jc(this,t,fct,hct,Qc,{labelId:0,step:1})}}function gct(e){let t;return{c(){t=Vl("div"),ps(t,"class","shepherd-text"),ps(t,"id",e[1])},m(n,s){il(n,t,s),e[3](t)},p(n,[s]){s&2&&ps(t,"id",n[1])},i:Oa,o:Oa,d(n){n&&Eo(t),e[3](null)}}}function mct(e,t,n){let{descriptionId:s,element:r,step:i}=t;FI(()=>{let{text:o}=i.options;ld(o)&&(o=o.call(i)),og(o)?r.appendChild(o):n(0,r.innerHTML=o,r)});function a(o){hg[o?"unshift":"push"](()=>{r=o,n(0,r)})}return e.$$set=o=>{"descriptionId"in o&&n(1,s=o.descriptionId),"element"in o&&n(0,r=o.element),"step"in o&&n(2,i=o.step)},[r,s,i,a]}class vct extends Zc{constructor(t){super(),Jc(this,t,mct,gct,Qc,{descriptionId:1,element:0,step:2})}}function C5(e){let t,n;return t=new pct({props:{labelId:e[1],step:e[2]}}),{c(){df(t.$$.fragment)},m(s,r){wd(t,s,r),n=!0},p(s,r){const i={};r&2&&(i.labelId=s[1]),r&4&&(i.step=s[2]),t.$set(i)},i(s){n||(ns(t.$$.fragment,s),n=!0)},o(s){Zs(t.$$.fragment,s),n=!1},d(s){yd(t,s)}}}function S5(e){let t,n;return t=new vct({props:{descriptionId:e[0],step:e[2]}}),{c(){df(t.$$.fragment)},m(s,r){wd(t,s,r),n=!0},p(s,r){const i={};r&1&&(i.descriptionId=s[0]),r&4&&(i.step=s[2]),t.$set(i)},i(s){n||(ns(t.$$.fragment,s),n=!0)},o(s){Zs(t.$$.fragment,s),n=!1},d(s){yd(t,s)}}}function k5(e){let t,n;return t=new ict({props:{step:e[2]}}),{c(){df(t.$$.fragment)},m(s,r){wd(t,s,r),n=!0},p(s,r){const i={};r&4&&(i.step=s[2]),t.$set(i)},i(s){n||(ns(t.$$.fragment,s),n=!0)},o(s){Zs(t.$$.fragment,s),n=!1},d(s){yd(t,s)}}}function bct(e){let t,n=!xi(e[2].options.title)||e[2].options.cancelIcon&&e[2].options.cancelIcon.enabled,s,r=!xi(e[2].options.text),i,a=Array.isArray(e[2].options.buttons)&&e[2].options.buttons.length,o,l=n&&C5(e),u=r&&S5(e),d=a&&k5(e);return{c(){t=Vl("div"),l&&l.c(),s=_y(),u&&u.c(),i=_y(),d&&d.c(),ps(t,"class","shepherd-content")},m(f,p){il(f,t,p),l&&l.m(t,null),dg(t,s),u&&u.m(t,null),dg(t,i),d&&d.m(t,null),o=!0},p(f,[p]){p&4&&(n=!xi(f[2].options.title)||f[2].options.cancelIcon&&f[2].options.cancelIcon.enabled),n?l?(l.p(f,p),p&4&&ns(l,1)):(l=C5(f),l.c(),ns(l,1),l.m(t,s)):l&&(Sh(),Zs(l,1,1,()=>{l=null}),kh()),p&4&&(r=!xi(f[2].options.text)),r?u?(u.p(f,p),p&4&&ns(u,1)):(u=S5(f),u.c(),ns(u,1),u.m(t,i)):u&&(Sh(),Zs(u,1,1,()=>{u=null}),kh()),p&4&&(a=Array.isArray(f[2].options.buttons)&&f[2].options.buttons.length),a?d?(d.p(f,p),p&4&&ns(d,1)):(d=k5(f),d.c(),ns(d,1),d.m(t,null)):d&&(Sh(),Zs(d,1,1,()=>{d=null}),kh())},i(f){o||(ns(l),ns(u),ns(d),o=!0)},o(f){Zs(l),Zs(u),Zs(d),o=!1},d(f){f&&Eo(t),l&&l.d(),u&&u.d(),d&&d.d()}}}function _ct(e,t,n){let{descriptionId:s,labelId:r,step:i}=t;return e.$$set=a=>{"descriptionId"in a&&n(0,s=a.descriptionId),"labelId"in a&&n(1,r=a.labelId),"step"in a&&n(2,i=a.step)},[s,r,i]}class xct extends Zc{constructor(t){super(),Jc(this,t,_ct,bct,Qc,{descriptionId:0,labelId:1,step:2})}}function E5(e){let t;return{c(){t=Vl("div"),ps(t,"class","shepherd-arrow"),ps(t,"data-popper-arrow","")},m(n,s){il(n,t,s)},d(n){n&&Eo(t)}}}function wct(e){let t,n,s,r,i,a,o,l,u=e[4].options.arrow&&e[4].options.attachTo&&e[4].options.attachTo.element&&e[4].options.attachTo.on&&E5();s=new xct({props:{descriptionId:e[2],labelId:e[3],step:e[4]}});let d=[{"aria-describedby":r=xi(e[4].options.text)?null:e[2]},{"aria-labelledby":i=e[4].options.title?e[3]:null},e[1],{open:"true"}],f={};for(let p=0;p<d.length;p+=1)f=Hlt(f,d[p]);return{c(){t=Vl("dialog"),u&&u.c(),n=_y(),df(s.$$.fragment),g5(t,f),Lf(t,"shepherd-has-cancel-icon",e[5]),Lf(t,"shepherd-has-title",e[6]),Lf(t,"shepherd-element",!0)},m(p,g){il(p,t,g),u&&u.m(t,null),dg(t,n),wd(s,t,null),e[13](t),a=!0,o||(l=t1(t,"keydown",e[7]),o=!0)},p(p,[g]){p[4].options.arrow&&p[4].options.attachTo&&p[4].options.attachTo.element&&p[4].options.attachTo.on?u||(u=E5(),u.c(),u.m(t,n)):u&&(u.d(1),u=null);const v={};g&4&&(v.descriptionId=p[2]),g&8&&(v.labelId=p[3]),g&16&&(v.step=p[4]),s.$set(v),g5(t,f=Qlt(d,[(!a||g&20&&r!==(r=xi(p[4].options.text)?null:p[2]))&&{"aria-describedby":r},(!a||g&24&&i!==(i=p[4].options.title?p[3]:null))&&{"aria-labelledby":i},g&2&&p[1],{open:"true"}])),Lf(t,"shepherd-has-cancel-icon",p[5]),Lf(t,"shepherd-has-title",p[6]),Lf(t,"shepherd-element",!0)},i(p){a||(ns(s.$$.fragment,p),a=!0)},o(p){Zs(s.$$.fragment,p),a=!1},d(p){p&&Eo(t),u&&u.d(),yd(s),e[13](null),o=!1,l()}}}const yct=9,Cct=27,Sct=37,kct=39;function T5(e){return e.split(" ").filter(t=>!!t.length)}function Ect(e,t,n){let{classPrefix:s,element:r,descriptionId:i,firstFocusableElement:a,focusableElements:o,labelId:l,lastFocusableElement:u,step:d,dataStepId:f}=t,p,g,v;const b=()=>r;$lt(()=>{n(1,f={[`data-${s}shepherd-step-id`]:d.id}),n(9,o=r.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]')),n(8,a=o[0]),n(10,u=o[o.length-1])}),FI(()=>{v!==d.options.classes&&_()});function _(){x(v),v=d.options.classes,w(v)}function x(C){if(Vv(C)){const k=T5(C);k.length&&r.classList.remove(...k)}}function w(C){if(Vv(C)){const k=T5(C);k.length&&r.classList.add(...k)}}const y=C=>{const{tour:k}=d;switch(C.keyCode){case yct:if(o.length===0){C.preventDefault();break}C.shiftKey?(document.activeElement===a||document.activeElement.classList.contains("shepherd-element"))&&(C.preventDefault(),u.focus()):document.activeElement===u&&(C.preventDefault(),a.focus());break;case Cct:k.options.exitOnEsc&&(C.preventDefault(),C.stopPropagation(),d.cancel());break;case Sct:k.options.keyboardNavigation&&(C.preventDefault(),C.stopPropagation(),k.back());break;case kct:k.options.keyboardNavigation&&(C.preventDefault(),C.stopPropagation(),k.next());break}};function S(C){hg[C?"unshift":"push"](()=>{r=C,n(0,r)})}return e.$$set=C=>{"classPrefix"in C&&n(11,s=C.classPrefix),"element"in C&&n(0,r=C.element),"descriptionId"in C&&n(2,i=C.descriptionId),"firstFocusableElement"in C&&n(8,a=C.firstFocusableElement),"focusableElements"in C&&n(9,o=C.focusableElements),"labelId"in C&&n(3,l=C.labelId),"lastFocusableElement"in C&&n(10,u=C.lastFocusableElement),"step"in C&&n(4,d=C.step),"dataStepId"in C&&n(1,f=C.dataStepId)},e.$$.update=()=>{e.$$.dirty&16&&(n(5,p=d.options&&d.options.cancelIcon&&d.options.cancelIcon.enabled),n(6,g=d.options&&d.options.title))},[r,f,i,l,d,p,g,y,a,o,u,s,b,S]}class Tct extends Zc{constructor(t){super(),Jc(this,t,Ect,wct,Qc,{classPrefix:11,element:0,descriptionId:2,firstFocusableElement:8,focusableElements:9,labelId:3,lastFocusableElement:10,step:4,dataStepId:1,getElement:12})}get getElement(){return this.$$.ctx[12]}}class RA extends vI{constructor(t,n={}){return super(),this._resolvedAttachTo=void 0,this._resolvedExtraHighlightElements=void 0,this.classPrefix=void 0,this.el=void 0,this.target=void 0,this.tour=void 0,this.tour=t,this.classPrefix=this.tour.options?OX(this.tour.options.classPrefix):"",this.styles=t.styles,this._resolvedAttachTo=null,xI(this),this._setOptions(n),this}cancel(){this.tour.cancel(),this.trigger("cancel")}complete(){this.tour.complete(),this.trigger("complete")}destroy(){Plt(this),og(this.el)&&(this.el.remove(),this.el=null),this._updateStepTargetOnHide(),this.trigger("destroy")}getTour(){return this.tour}hide(){var t;(t=this.tour.modal)==null||t.hide(),this.trigger("before-hide"),this.el&&(this.el.hidden=!0),this._updateStepTargetOnHide(),this.trigger("hide")}_resolveExtraHiglightElements(){return this._resolvedExtraHighlightElements=Wot(this),this._resolvedExtraHighlightElements}_resolveAttachToOptions(){return this._resolvedAttachTo=Vot(this),this._resolvedAttachTo}_getResolvedAttachToOptions(){return this._resolvedAttachTo===null?this._resolveAttachToOptions():this._resolvedAttachTo}isOpen(){return!!(this.el&&!this.el.hidden)}show(){return ld(this.options.beforeShowPromise)?Promise.resolve(this.options.beforeShowPromise()).then(()=>this._show()):Promise.resolve(this._show())}updateStepOptions(t){Object.assign(this.options,t),this.shepherdElementComponent&&this.shepherdElementComponent.$set({step:this})}getElement(){return this.el}getTarget(){return this.target}_createTooltipContent(){const t=`${this.id}-description`,n=`${this.id}-label`;return this.shepherdElementComponent=new Tct({target:this.tour.options.stepsContainer||document.body,props:{classPrefix:this.classPrefix,descriptionId:t,labelId:n,step:this,styles:this.styles}}),this.shepherdElementComponent.getElement()}_scrollTo(t){const{element:n}=this._getResolvedAttachToOptions();ld(this.options.scrollToHandler)?this.options.scrollToHandler(n):yot(n)&&typeof n.scrollIntoView=="function"&&n.scrollIntoView(t)}_getClassOptions(t){const n=this.tour&&this.tour.options&&this.tour.options.defaultStepOptions,s=t.classes?t.classes:"",r=n&&n.classes?n.classes:"",i=[...s.split(" "),...r.split(" ")],a=new Set(i);return Array.from(a).join(" ").trim()}_setOptions(t={}){let n=this.tour&&this.tour.options&&this.tour.options.defaultStepOptions;n=_I({},n||{}),this.options=Object.assign({arrow:!0},n,t,Nlt(n,t));const{when:s}=this.options;this.options.classes=this._getClassOptions(t),this.destroy(),this.id=this.options.id||`step-${BX()}`,s&&Object.keys(s).forEach(r=>{this.on(r,s[r],this)})}_setupElements(){xi(this.el)||this.destroy(),this.el=this._createTooltipContent(),this.options.advanceOn&&Hot(this),Ilt(this)}_show(){var t;this.trigger("before-show"),this._resolveAttachToOptions(),this._resolveExtraHiglightElements(),this._setupElements(),this.tour.modal||this.tour.setupModal(),(t=this.tour.modal)==null||t.setupForStep(this),this._styleTargetElementForStep(this),this.el&&(this.el.hidden=!1),this.options.scrollTo&&setTimeout(()=>{this._scrollTo(this.options.scrollTo)}),this.el&&(this.el.hidden=!1);const n=this.shepherdElementComponent.getElement(),s=this.target||document.body,r=this._resolvedExtraHighlightElements;s.classList.add(`${this.classPrefix}shepherd-enabled`),s.classList.add(`${this.classPrefix}shepherd-target`),n.classList.add("shepherd-enabled"),r?.forEach(i=>{i.classList.add(`${this.classPrefix}shepherd-enabled`),i.classList.add(`${this.classPrefix}shepherd-target`)}),this.trigger("show")}_styleTargetElementForStep(t){const n=t.target,s=t._resolvedExtraHighlightElements;if(!n)return;const r=t.options.highlightClass;r&&(n.classList.add(r),s?.forEach(i=>i.classList.add(r))),n.classList.remove("shepherd-target-click-disabled"),s?.forEach(i=>i.classList.remove("shepherd-target-click-disabled")),t.options.canClickTarget===!1&&(n.classList.add("shepherd-target-click-disabled"),s?.forEach(i=>i.classList.add("shepherd-target-click-disabled")))}_updateStepTargetOnHide(){const t=this.target||document.body,n=this._resolvedExtraHighlightElements,s=this.options.highlightClass;s&&(t.classList.remove(s),n?.forEach(r=>r.classList.remove(s))),t.classList.remove("shepherd-target-click-disabled",`${this.classPrefix}shepherd-enabled`,`${this.classPrefix}shepherd-target`),n?.forEach(r=>{r.classList.remove("shepherd-target-click-disabled",`${this.classPrefix}shepherd-enabled`,`${this.classPrefix}shepherd-target`)})}}function Rct(e){if(e){const{steps:t}=e;t.forEach(n=>{n.options&&n.options.canClickTarget===!1&&n.options.attachTo&&(og(n.target)&&n.target.classList.remove("shepherd-target-click-disabled"),n._resolvedExtraHighlightElements&&n._resolvedExtraHighlightElements.forEach(s=>{og(s)&&s.classList.remove("shepherd-target-click-disabled")}))})}}function Act(e){let t="";const{innerWidth:n,innerHeight:s}=window;return e.forEach(r=>{const{width:i,height:a,x:o=0,y:l=0,r:u=0}=r,{topLeft:d=0,topRight:f=0,bottomRight:p=0,bottomLeft:g=0}=typeof u=="number"?{topLeft:u,topRight:u,bottomRight:u,bottomLeft:u}:u;t+=`M${o+d},${l} a${d},${d},0,0,0-${d},${d} V${a+l-g} a${g},${g},0,0,0,${g},${g} H${i+o-p} a${p},${p},0,0,0,${p}-${p} V${l+f} a${f},${f},0,0,0-${f}-${f} Z`}),`M${n},${s} H0 V0 H${n} V${s} Z ${t}`.replace(/\s/g,"")}function Fct(e){let t,n,s,r,i;return{c(){t=p5("svg"),n=p5("path"),ps(n,"d",e[2]),ps(t,"class",s=`${e[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)},m(a,o){il(a,t,o),dg(t,n),e[11](t),r||(i=t1(t,"touchmove",e[3]),r=!0)},p(a,[o]){o&4&&ps(n,"d",a[2]),o&2&&s!==(s=`${a[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)&&ps(t,"class",s)},i:Oa,o:Oa,d(a){a&&Eo(t),e[11](null),r=!1,i()}}}function JX(e){if(!e)return null;const t=e instanceof HTMLElement&&window.getComputedStyle(e).overflowY;return t!=="hidden"&&t!=="visible"&&e.scrollHeight>=e.clientHeight?e:JX(e.parentElement)}function Dct(e){let t={top:0,left:0};if(!e)return t;let n=e.ownerDocument.defaultView;for(;n!==window.top;){var s;const a=(s=n)==null?void 0:s.frameElement;if(a){var r,i;const o=a.getBoundingClientRect();t.top+=o.top+((r=o.scrollTop)!=null?r:0),t.left+=o.left+((i=o.scrollLeft)!=null?i:0)}n=n.parent}return t}function Ict(e,t){const n=e.getBoundingClientRect();let s=n.y||n.top,r=n.bottom||s+n.height;if(t){const a=t.getBoundingClientRect(),o=a.y||a.top,l=a.bottom||o+a.height;s=Math.max(s,o),r=Math.min(r,l)}const i=Math.max(r-s,0);return{y:s,height:i}}function Nct(e,t,n){let{element:s,openingProperties:r}=t,i=!1,a,o;u();const l=()=>s;function u(){n(4,r=[{width:0,height:0,x:0,y:0,r:0}])}function d(){n(1,i=!1),x()}function f(S=0,C=0,k=0,T=0,A,F,I){if(F){const N=[F,...I||[]];n(4,r=[]);for(const P of N){if(!P||N.indexOf(P)!==N.lastIndexOf(P))continue;const{y:O,height:j}=Ict(P,A),{x:M,width:X,left:se}=P.getBoundingClientRect();N.some(ee=>{if(ee===P)return!1;const q=ee.getBoundingClientRect();return M>=q.left&&M+X<=q.right&&O>=q.top&&O+j<=q.bottom})||r.push({width:X+S*2,height:j+S*2,x:(M||se)+k-S,y:O+T-S,r:C})}}else u()}function p(S){x(),S.tour.options.useModalOverlay?(w(S),g()):d()}function g(){n(1,i=!0)}const v=S=>{S.preventDefault()},b=S=>{S.stopPropagation()};function _(){window.addEventListener("touchmove",v,{passive:!1})}function x(){a&&(cancelAnimationFrame(a),a=void 0),window.removeEventListener("touchmove",v,{passive:!1})}function w(S){const{modalOverlayOpeningPadding:C,modalOverlayOpeningRadius:k,modalOverlayOpeningXOffset:T=0,modalOverlayOpeningYOffset:A=0}=S.options,F=Dct(S.target),I=JX(S.target),N=()=>{a=void 0,f(C,k,T+F.left,A+F.top,I,S.target,S._resolvedExtraHighlightElements),a=requestAnimationFrame(N)};N(),_()}function y(S){hg[S?"unshift":"push"](()=>{s=S,n(0,s)})}return e.$$set=S=>{"element"in S&&n(0,s=S.element),"openingProperties"in S&&n(4,r=S.openingProperties)},e.$$.update=()=>{e.$$.dirty&16&&n(2,o=Act(r))},[s,i,o,b,r,l,u,d,f,p,g,y]}class Pct extends Zc{constructor(t){super(),Jc(this,t,Nct,Fct,Qc,{element:0,openingProperties:4,getElement:5,closeModalOpening:6,hide:7,positionModal:8,setupForStep:9,show:10})}get getElement(){return this.$$.ctx[5]}get closeModalOpening(){return this.$$.ctx[6]}get hide(){return this.$$.ctx[7]}get positionModal(){return this.$$.ctx[8]}get setupForStep(){return this.$$.ctx[9]}get show(){return this.$$.ctx[10]}}class Mct extends vI{constructor(){super(),this.activeTour=void 0,xI(this)}}class Oct extends vI{constructor(t={}){super(),this.trackedEvents=["active","cancel","complete","show"],this.classPrefix=void 0,this.currentStep=void 0,this.focusedElBeforeOpen=void 0,this.id=void 0,this.modal=void 0,this.options=void 0,this.steps=void 0,xI(this);const n={exitOnEsc:!0,keyboardNavigation:!0};return this.options=Object.assign({},n,t),this.classPrefix=OX(this.options.classPrefix),this.steps=[],this.addSteps(this.options.steps),["active","cancel","complete","inactive","show","start"].map(s=>{(r=>{this.on(r,i=>{i=i||{},i.tour=this,oh.trigger(r,i)})})(s)}),this._setTourID(t.id),this}addStep(t,n){let s=t;return s instanceof RA?s.tour=this:s=new RA(this,s),xi(n)?this.steps.push(s):this.steps.splice(n,0,s),s}addSteps(t){return Array.isArray(t)&&t.forEach(n=>{this.addStep(n)}),this}back(){const t=this.steps.indexOf(this.currentStep);this.show(t-1,!1)}async cancel(){if(this.options.confirmCancel){const t=this.options.confirmCancelMessage||"Are you sure you want to stop the tour?";let n;ld(this.options.confirmCancel)?n=await this.options.confirmCancel():n=window.confirm(t),n&&this._done("cancel")}else this._done("cancel")}complete(){this._done("complete")}getById(t){return this.steps.find(n=>n.id===t)}getCurrentStep(){return this.currentStep}hide(){const t=this.getCurrentStep();if(t)return t.hide()}isActive(){return oh.activeTour===this}next(){const t=this.steps.indexOf(this.currentStep);t===this.steps.length-1?this.complete():this.show(t+1,!0)}removeStep(t){const n=this.getCurrentStep();this.steps.some((s,r)=>{if(s.id===t)return s.isOpen()&&s.hide(),s.destroy(),this.steps.splice(r,1),!0}),n&&n.id===t&&(this.currentStep=void 0,this.steps.length?this.show(0):this.cancel())}show(t=0,n=!0){const s=Vv(t)?this.getById(t):this.steps[t];s&&(this._updateStateBeforeShow(),ld(s.options.showOn)&&!s.options.showOn()?this._skipStep(s,n):(this.currentStep=s,this.trigger("show",{step:s,previous:this.currentStep}),s.show()))}async start(){this.trigger("start"),this.focusedElBeforeOpen=document.activeElement,this.currentStep=null,this.setupModal(),this._setupActiveTour(),this.next()}_done(t){const n=this.steps.indexOf(this.currentStep);if(Array.isArray(this.steps)&&this.steps.forEach(s=>s.destroy()),Rct(this),this.trigger(t,{index:n}),oh.activeTour=null,this.trigger("inactive",{tour:this}),this.modal&&this.modal.hide(),(t==="cancel"||t==="complete")&&this.modal){const s=document.querySelector(".shepherd-modal-overlay-container");s&&(s.remove(),this.modal=null)}og(this.focusedElBeforeOpen)&&this.focusedElBeforeOpen.focus()}_setupActiveTour(){this.trigger("active",{tour:this}),oh.activeTour=this}setupModal(){this.modal=new Pct({target:this.options.modalContainer||document.body,props:{styles:this.styles}})}_skipStep(t,n){const s=this.steps.indexOf(t);if(s===this.steps.length-1)this.complete();else{const r=n?s+1:s-1;this.show(r,n)}}_updateStateBeforeShow(){this.currentStep&&this.currentStep.hide(),this.isActive()||this._setupActiveTour()}_setTourID(t){const n=this.options.tourName||"tour",s=t||BX();this.id=`${n}--${s}`}}const oh=new Mct,ZX=typeof window>"u";oh.Step=ZX?Uot:RA;oh.Tour=ZX?Got:Oct;const n1=m.createContext(void 0);n1.Consumer;const Lct=({children:e})=>wot.jsx(n1.Provider,{value:{Shepherd:oh},children:e}),xy=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),Bct=e=>xy(e).replace(/"/g,"""),at=e=>xy(h(e)),jct=['<div class="tour-figure-rail" aria-hidden="true">','<span class="tour-figure-dot"></span>','<span class="tour-figure-dot"></span>','<span class="tour-figure-dot"></span>','<span class="tour-figure-rail-line"></span>',"</div>",'<div class="tour-figure-main" aria-hidden="true">','<span class="tour-figure-bubble tour-figure-bubble-in"></span>','<span class="tour-figure-bubble tour-figure-bubble-out"></span>','<span class="tour-figure-composer">','<span class="tour-figure-composer-line"></span>','<span class="tour-figure-send"></span>',"</span>","</div>"].join(""),Hct=['<div class="tour-figure-flow" aria-hidden="true">','<div class="tour-figure-node">','<span class="tour-figure-node-icon"></span>','<span class="tour-figure-node-bar"></span>','<span class="tour-figure-node-bar tour-figure-node-bar-short"></span>',"</div>",'<span class="tour-figure-connector"></span>','<div class="tour-figure-node">','<span class="tour-figure-node-icon tour-figure-node-icon-round"></span>','<span class="tour-figure-node-bar"></span>','<span class="tour-figure-node-bar tour-figure-node-bar-short"></span>',"</div>",'<span class="tour-figure-connector"></span>','<div class="tour-figure-node">','<span class="tour-figure-node-icon tour-figure-node-icon-end"></span>','<span class="tour-figure-node-bar"></span>','<span class="tour-figure-node-bar tour-figure-node-bar-short"></span>',"</div>","</div>"].join(""),Uct={welcome:jct,"agent-capabilities":Hct},R5=e=>e.map(t=>"key"in t?xy(h(t.key)):`<code>${xy(t.code)}</code>`).join(""),Gct=e=>{const t="<br/>".repeat(e.breaks??0);return e.kind==="paragraph"?`${R5(e.runs)}${t}`:e.kind==="list"?`<ul>${e.items.map(s=>`<li>${R5(s)}</li>`).join("")}</ul>${t}`:`<div class="tour-figure tour-figure-${e.figure}" role="img" aria-label="${Bct(h(e.altKey))}">${Uct[e.figure]}</div>${t}`},Sn=e=>e.map(Gct).join(""),kn={welcome:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.welcome.body.1"}],breaks:1},{kind:"figure",figure:"welcome",altKey:"ui.onboarding.tour.welcome.image.1.alt",breaks:1},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.welcome.body.2"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.welcome.body.3"}],breaks:0},{kind:"list",items:[[{key:"ui.onboarding.tour.welcome.list.1.item.1"}],[{key:"ui.onboarding.tour.welcome.list.1.item.2"}],[{key:"ui.onboarding.tour.welcome.list.1.item.3"}],[{key:"ui.onboarding.tour.welcome.list.1.item.4"}],[{key:"ui.onboarding.tour.welcome.list.1.item.5"}],[{key:"ui.onboarding.tour.welcome.list.1.item.6"}],[{key:"ui.onboarding.tour.welcome.list.1.item.7"}]],breaks:0},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.welcome.body.4"}],breaks:0}],agent_list:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_list.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_list.body.2"}],breaks:0}],select_agent:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.select_agent.body.1"}],breaks:0}],chat_input:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.chat_input.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.chat_input.body.2"}],breaks:2},{kind:"list",items:[[{key:"ui.onboarding.tour.chat_input.list.1.item.1"}],[{key:"ui.onboarding.tour.chat_input.list.1.item.2"}],[{key:"ui.onboarding.tour.chat_input.list.1.item.3"}]],breaks:1},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.chat_input.body.3"}],breaks:0}],attachments:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.attachments.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.attachments.body.2"}],breaks:1},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.attachments.body.3"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.attachments.body.4"}],breaks:0}],agent_capabilities:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_capabilities.body.1"}],breaks:1},{kind:"figure",figure:"agent-capabilities",altKey:"ui.onboarding.tour.agent_capabilities.image.1.alt",breaks:1},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_capabilities.body.2"}],breaks:0}],pre_command_palette_open_canvas:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.1.1"},{code:kl("everything",!0)},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.connector.on_mac_and"},{code:kl("everything",!1)},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.1.3"},{code:"#"},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.1.4"},{code:"@"},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.1.5"},{code:","},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.1.6"},{code:">"},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.1.7"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.2.1"},{code:kl("chats",!0)},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.connector.on_mac_and"},{code:kl("chats",!1)},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.2.3"},{code:kl("commands",!0)},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.connector.on_mac_and"},{code:kl("commands",!1)},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.2.5"}],breaks:0}],canvas_open_button:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_open_button.body.1"}],breaks:0}],canvas_feature:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_feature.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_feature.body.2"}],breaks:0}],canvas_documents_view:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_documents_view.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_documents_view.body.2"}],breaks:1},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_documents_view.body.3"}],breaks:1},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_documents_view.body.4"}],breaks:0}],canvas_files_view:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_files_view.body.1"}],breaks:0}],canvas_variables_view:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_variables_view.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_variables_view.body.2"}],breaks:0}],agent_options:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_options.body.1"}],breaks:0}],click_view_settings_from_chat:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.click_view_settings_from_chat.body.1"}],breaks:0}],view_agent_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.view_agent_settings.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.view_agent_settings.body.2"}],breaks:0}],select_provider:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.select_provider.body.1"}],breaks:0}],select_model:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.select_model.body.1"}],breaks:0}],modify_security_prompt:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.modify_security_prompt.body.1"}],breaks:0}],modify_agent_prompt:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.modify_agent_prompt.body.1"}],breaks:0}],create_new_agent:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.create_new_agent.body.1"}],breaks:0}],agent_naming_guidelines:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_naming_guidelines.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_naming_guidelines.body.2"}],breaks:0}],navigate_agent_hub:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.navigate_agent_hub.body.1"}],breaks:0}],agent_hub_view:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_hub_view.body.1"}],breaks:0}],download_agent:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.download_agent.body.1"}],breaks:0}],upload_agent_hub:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.upload_agent_hub.body.1"}],breaks:0}],upload_agent_hub_dialog:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.upload_agent_hub_dialog.body.1"}],breaks:0}],navigate_schedules:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.navigate_schedules.body.1"}],breaks:0}],schedules_overview:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.schedules_overview.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.schedules_overview.body.2"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.schedules_overview.body.3"}],breaks:0}],create_schedule:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.create_schedule.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.create_schedule.body.2"}],breaks:0}],create_schedule_dialog:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.create_schedule_dialog.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.create_schedule_dialog.body.2"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.create_schedule_dialog.body.3"}],breaks:0}],navigate_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.navigate_settings.body.1"}],breaks:0}],general_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.general_settings.body.1"}],breaks:0}],appearance_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.appearance_settings.body.1"}],breaks:0}],radient_account_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.radient_account_settings.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.radient_account_settings.body.2"}],breaks:0}],integrations_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.integrations_settings.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.integrations_settings.body.2"}],breaks:0}],application_updates_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.application_updates_settings.body.1"}],breaks:0}],tour_complete:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.tour_complete.body.1"}],breaks:0}]},Vct=e=>{const t=Array.from(document.querySelectorAll(`[data-tour-tag="${e}"]`));return t.find(n=>n.offsetParent!==null)??t[0]??null},A5=e=>{document.querySelector(`[data-tour-action="${e}"]`)?.click()},eQ=1340,DI="tour-beside-palette",s1="pre-command-palette-open-canvas",tQ='[data-tour-tag="command-palette-dialog"]',bs=e=>Z5(Xm())!=="rtl"?e:e==="left"?"right":"left",Wct=e=>(e.getById(s1)?.options.classes??"").split(" ").includes(DI),nQ=(e,t)=>{const n=e.getById(s1);!n||Wct(e)===t||n.updateStepOptions(t?{attachTo:{element:tQ,on:bs("right")},classes:DI}:{attachTo:void 0,classes:void 0})},sQ=e=>{const t=window.innerWidth>=eQ;return nQ(e,t),t};let II=0;const AA=new WeakMap;tt.subscribe((e,t)=>{t.isCommandPaletteOpen&&!e.isCommandPaletteOpen&&(II+=1)});const rQ=e=>{const t=AA.get(e);return t===void 0||(AA.delete(e),t!==II)?!1:(tt.getState().closeCommandPalette(),!0)},F5=(e,t)=>{if(!sQ(e)){t();return}const n=tt.getState();n.isCommandPaletteOpen||(n.openCommandPalette(),AA.set(e,II)),setTimeout(()=>{e.isActive()&&t()},500)},D5=(e,t)=>{if(!rQ(e)){t();return}setTimeout(()=>{e.isActive()&&t()},500)},I5=e=>{const t=e?.step;if(t?.id!==s1)return;(!sQ(t.tour)||document.querySelector(tQ)===null)&&nQ(t.tour,!1)},zct=()=>{const e=window.innerWidth>=eQ;return{id:s1,...e?{attachTo:{element:'[data-tour-tag="command-palette-dialog"]',on:bs("right")},classes:DI}:{},title:at("ui.onboarding.tour.pre_command_palette_open_canvas.title"),text:Sn(kn.pre_command_palette_open_canvas),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){D5(this,()=>this.back())}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){D5(this,()=>this.next())}}]}},iQ=()=>[{id:"welcome",title:at("ui.onboarding.tour.welcome.title"),text:Sn(kn.welcome),buttons:[{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"agent-list",attachTo:{element:'[data-tour-tag="agent-list-panel"]',on:bs("right")},title:at("ui.onboarding.tour.agent_list.title"),text:Sn(kn.agent_list),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"select-agent",attachTo:{element:'[data-tour-tag="agent-list-item-button-0"]',on:bs("right")},title:at("ui.onboarding.tour.select_agent.title"),text:Sn(kn.select_agent),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="agent-list-item-button-0"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"chat-input",attachTo:{element:'[data-tour-tag="chat-input-textarea"]',on:"top"},title:at("ui.onboarding.tour.chat_input.title"),text:Sn(kn.chat_input),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"attachments",attachTo:{element:'button[data-tour-tag="chat-input-attach-file-button"]',on:"top"},title:at("ui.onboarding.tour.attachments.title"),text:Sn(kn.attachments),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"agent-capabilities",attachTo:{element:'[data-tour-tag="chat-header"]',on:"top"},title:at("ui.onboarding.tour.agent_capabilities.title"),text:Sn(kn.agent_capabilities),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){F5(this,()=>this.next())}}]},zct(),{id:"canvas-open-button",attachTo:{element:'button[data-tour-tag="open-canvas-button"]',on:bs("left")},title:at("ui.onboarding.tour.canvas_open_button.title"),text:Sn(kn.canvas_open_button),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){F5(this,()=>this.back())}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="open-canvas-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-feature",attachTo:{element:'[data-tour-tag="canvas-container"]',on:bs("left")},title:at("ui.onboarding.tour.canvas_feature.title"),text:Sn(kn.canvas_feature),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="close-canvas-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-documents-view-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-documents-view",attachTo:{element:'button[data-tour-tag="canvas-documents-view-button"]',on:"top"},title:at("ui.onboarding.tour.canvas_documents_view.title"),text:Sn(kn.canvas_documents_view),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-files-view-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-files-view",attachTo:{element:'button[data-tour-tag="canvas-files-view-button"]',on:"top"},title:at("ui.onboarding.tour.canvas_files_view.title"),text:Sn(kn.canvas_files_view),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-documents-view-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-variables-view-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-variables-view",attachTo:{element:'button[data-tour-tag="canvas-variables-view-button"]',on:"top"},title:at("ui.onboarding.tour.canvas_variables_view.title"),text:Sn(kn.canvas_variables_view),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-files-view-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="close-canvas-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"agent-options",attachTo:{element:'button[data-tour-tag="agent-options-button"]',on:bs("right")},title:at("ui.onboarding.tour.agent_options.title"),text:Sn(kn.agent_options),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="open-canvas-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="agent-options-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"click-view-settings-from-chat",attachTo:{element:'[role="menuitem"][data-tour-tag="view-agent-settings-menu-item"]',on:bs("right")},title:at("ui.onboarding.tour.click_view_settings_from_chat.title"),text:Sn(kn.click_view_settings_from_chat),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[role="menuitem"][data-tour-tag="view-agent-settings-menu-item"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"view-agent-settings",attachTo:{element:'div[data-tour-tag="agent-settings-details-paper"]',on:bs("left")},title:at("ui.onboarding.tour.view_agent_settings.title"),text:Sn(kn.view_agent_settings),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-chat"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('button[data-tour-tag="agent-options-button"]');t&&t.click()},500),setTimeout(()=>{this.back()},1e3)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"select-provider",attachTo:{element:'[data-tour-tag="agent-settings-hosting-select"]',on:bs("left")},title:at("ui.onboarding.tour.select_provider.title"),text:Sn(kn.select_provider),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"select-model",attachTo:{element:'[data-tour-tag="agent-settings-model-select"]',on:bs("left")},title:at("ui.onboarding.tour.select_model.title"),text:Sn(kn.select_model),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"modify-security-prompt",attachTo:{element:'[data-tour-tag="agent-settings-security"]',on:bs("left")},title:at("ui.onboarding.tour.modify_security_prompt.title"),text:Sn(kn.modify_security_prompt),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"modify-agent-prompt",attachTo:{element:'[data-tour-tag="agent-settings-system-prompt"]',on:bs("left")},title:at("ui.onboarding.tour.modify_agent_prompt.title"),text:Sn(kn.modify_agent_prompt),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"create-new-agent",attachTo:{element:'button[data-tour-tag="create-new-agent-button"]',on:"bottom"},title:at("ui.onboarding.tour.create_new_agent.title"),text:Sn(kn.create_new_agent),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="agent-list-item-button-0"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('button[data-tour-tag="agent-options-button"]');t&&t.click()},500),setTimeout(()=>{const t=document.querySelector('[role="menuitem"][data-tour-tag="view-agent-settings-menu-item"]');t&&t.click()},1e3),setTimeout(()=>{this.back()},1500)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="create-new-agent-button"]');e&&e.click(),setTimeout(()=>{this.next()},1e3)}}]},{id:"agent-naming-guidelines",attachTo:{element:'[data-tour-tag="create-agent-dialog"]',on:bs("right")},title:at("ui.onboarding.tour.agent_naming_guidelines.title"),text:Sn(kn.agent_naming_guidelines),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="create-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="create-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"navigate-agent-hub",attachTo:{element:'[data-tour-tag="nav-item-agent-hub"]',on:bs("right")},title:at("ui.onboarding.tour.navigate_agent_hub.title"),text:Sn(kn.navigate_agent_hub),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('[data-tour-tag="create-new-agent-button"]');t&&t.click()},500),setTimeout(()=>{this.back()},1e3)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agent-hub"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"agent-hub-view",attachTo:{element:'[data-tour-tag="agent-hub-sidebar-container"]',on:bs("right")},title:at("ui.onboarding.tour.agent_hub_view.title"),text:Sn(kn.agent_hub_view),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"download-agent",attachTo:{element:'button[data-tour-tag="agent-hub-download-button"]',on:"bottom"},title:at("ui.onboarding.tour.download_agent.title"),text:Sn(kn.download_agent),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{this.next()},1e3)}}]},{id:"upload-agent-hub",attachTo:{element:()=>Vct("upload-to-hub-header-button"),on:"bottom"},title:at("ui.onboarding.tour.upload_agent_hub.title"),text:Sn(kn.upload_agent_hub),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agent-hub"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){A5("open-upload-dialog"),setTimeout(()=>{this.next()},500)}}]},{id:"upload-agent-hub-dialog",attachTo:{element:'[data-tour-tag="upload-agent-dialog"]',on:bs("right")},title:at("ui.onboarding.tour.upload_agent_hub_dialog.title"),text:Sn(kn.upload_agent_hub_dialog),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="upload-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="upload-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"navigate-schedules",attachTo:{element:'[data-tour-tag="nav-item-schedules"]',on:bs("right")},title:at("ui.onboarding.tour.navigate_schedules.title"),text:Sn(kn.navigate_schedules),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{A5("open-upload-dialog")},500),setTimeout(()=>{this.back()},1e3)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-schedules"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"schedules-overview",title:at("ui.onboarding.tour.schedules_overview.title"),text:Sn(kn.schedules_overview),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"create-schedule",attachTo:{element:'button[data-tour-tag="create-schedule-button"]',on:"bottom"},title:at("ui.onboarding.tour.create_schedule.title"),text:Sn(kn.create_schedule),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="create-schedule-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"create-schedule-dialog",attachTo:{element:'[data-tour-tag="create-schedule-dialog"]',on:bs("right")},title:at("ui.onboarding.tour.create_schedule_dialog.title"),text:Sn(kn.create_schedule_dialog),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="create-schedule-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="create-schedule-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"navigate-settings",attachTo:{element:'[data-tour-tag="nav-item-settings"]',on:bs("right")},title:at("ui.onboarding.tour.navigate_settings.title"),text:Sn(kn.navigate_settings),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-schedules"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('button[data-tour-tag="create-schedule-button"]');t&&t.click()},500),setTimeout(()=>{this.back()},1e3)}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-settings"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"general-settings",attachTo:{element:'div[data-tour-tag="settings-general-section"]',on:bs("right")},title:at("ui.onboarding.tour.general_settings.title"),text:Sn(kn.general_settings),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"appearance-settings",attachTo:{element:'[data-tour-tag="settings-appearance-section"]',on:bs("right")},title:at("ui.onboarding.tour.appearance_settings.title"),text:Sn(kn.appearance_settings),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"radient-account-settings",attachTo:{element:'[data-tour-tag="settings-radient-account-section"]',on:bs("right")},title:at("ui.onboarding.tour.radient_account_settings.title"),text:Sn(kn.radient_account_settings),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"integrations-settings",attachTo:{element:'[data-tour-tag="settings-integrations-section"]',on:bs("right")},title:at("ui.onboarding.tour.integrations_settings.title"),text:Sn(kn.integrations_settings),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"application-updates-settings",attachTo:{element:'[data-tour-tag="settings-app-updates-section"]',on:bs("right")},title:at("ui.onboarding.tour.application_updates_settings.title"),text:Sn(kn.application_updates_settings),buttons:[{text:at("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:at("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"tour-complete",title:at("ui.onboarding.tour.tour_complete.title"),text:Sn(kn.tour_complete),buttons:[{text:at("ui.onboarding.tour.action.finish"),classes:"shepherd-button-primary",action:function(){this.complete()}}]}],aQ=()=>({enabled:!0,label:h("ui.onboarding.tour.action.close")}),FA=new WeakMap,$ct=(e,t)=>{FA.set(e,t)},qct=(e,t)=>{if(FA.get(e)===t)return;const n=new Map(iQ().filter(r=>r.id).map(r=>[r.id,r])),s=aQ();for(const r of e.steps){const i=r.id?n.get(r.id):void 0;i&&r.updateStepOptions({title:i.title,text:i.text,buttons:i.buttons,cancelIcon:s})}e.options.defaultStepOptions={...e.options.defaultStepOptions,cancelIcon:s},FA.set(e,t)},N5=new WeakMap,Kct=e=>{const t=N5.get(e);if(t)return t;const n=()=>rQ(e);return N5.set(e,n),n},Yct=()=>{const e=si(),{completeTourOnboarding:t}=z0(),n=m.useContext(n1),s=Ve(),r={cancelIcon:aQ(),scrollTo:{behavior:"smooth",block:"center"}},i=!0,a=o=>{if(n?.tour?.isActive()&&!o?.forceModalCompleted){console.log("Onboarding tour is already active (from context.tour). Not starting another.");return}const l=z0.getState();if(!o?.forceModalCompleted&&!l.isModalComplete){console.log("Onboarding modal not completed (checked via store). Tour will not start.");return}if(l.isTourComplete&&!o?.forceModalCompleted){console.log("Onboarding tour already completed in store and not forced. Not starting again.");return}let u=n?.tour;const d=n?.Shepherd;if(!u&&d&&(u=d.activeTour,!u&&d.Tour&&(console.log("No active Shepherd tour found from context or global. Creating a new one."),u=new d.Tour({useModalOverlay:i,defaultStepOptions:r}))),!u){console.warn("Failed to get or create a Shepherd tour instance.",n);return}if(u.isActive()){console.log("Tour is already active. Not starting again.");return}u.options.defaultStepOptions={...u.options.defaultStepOptions||{},...r},u.options.useModalOverlay=i,o?.firstAgentId&&(u.options.firstAgentId=o.firstAgentId),u.off("complete",t),u.on("complete",t),u.off("cancel",t),u.on("cancel",t);const f=Kct(u);u.off("complete",f),u.on("complete",f),u.off("cancel",f),u.on("cancel",f),u.off("show",I5),u.on("show",I5);const p=iQ();if(o?.forceModalCompleted||!u.isActive()){const g=[...u.steps];for(const v of g)v.id&&u.removeStep(v.id);u.addSteps(p)}else u.steps.length===0&&u.addSteps(p);$ct(u,Xm()),typeof u.start=="function"?(e("/"),u.start()):console.warn("Shepherd tour instance does not have a start method.",u)};return m.useEffect(()=>{const o=n?.tour??n?.Shepherd?.activeTour;o?.isActive()&&qct(o,s)},[s,n]),{startTour:a}},Xct=()=>{const{isModalComplete:e,isTourComplete:t}=z0(),{startTour:n}=Yct(),s=rt.useContext(n1),{data:r}=AT(1,1);return m.useEffect(()=>{if(e&&!t&&s){const i=setTimeout(()=>{const a=r?.agents?.[0]?.id;n({firstAgentId:a})},500);return()=>clearTimeout(i)}},[e,t,s,n,r]),null},Qct=({children:e})=>c.jsxs(Lct,{children:[e,c.jsx(Xct,{})]}),Jct=()=>{Ve();const{open:e,focusGroup:t,providerId:n,closeConnect:s}=z8(),r=m.useRef(null);m.useEffect(()=>{e&&(r.current=document.activeElement instanceof HTMLElement?document.activeElement:null)},[e]);const i=si();return c.jsx(Gc,{open:e,onOpenChange:a=>{a||s()},children:c.jsxs(Vc,{className:"max-h-[calc(100vh-4rem)] max-w-[min(40rem,calc(100vw-4rem))] gap-4 overflow-y-auto","data-connect-provider-dialog":"",onCloseAutoFocus:a=>{const o=r.current;r.current=null,o?.isConnected&&(a.preventDefault(),o.focus())},children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx(Ol,{className:"text-title",children:h("ui.providers.connect_provider_dialog.connect_a_model_provider")}),c.jsx(ud,{className:"text-body-sm text-ink-muted",children:h("ui.providers.connect_provider_dialog.your_agents_need_a_model_to_think")})]}),e?c.jsx(IX,{context:"dialog",featuredOnly:!0,focusGroup:t,initialProviderId:n,onDone:s,onChangeModel:()=>{s(),i("/settings")}}):null]})})};function Zct(){const{visible:e,rows:t,cursor:n,commitAt:s,hoverAt:r}=Lle();Du(e,"session-switcher");const i=n!==null&&e?t[n]??null:null,a=e&&t.length>=2;return c.jsxs(c.Fragment,{children:[c.jsx("output",{"aria-live":"polite",className:"sr-only","data-session-switcher-announcement":"",children:i!==null&&n!==null?c.jsxs(c.Fragment,{children:[oQ(i),", ",n+1," / ",t.length]}):null}),a?Zv.createPortal(c.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 flex items-start justify-center pt-[18vh]",children:c.jsx("div",{role:"dialog","aria-modal":"false","aria-label":h("ui.command_palette.palette_search.recents"),"data-lo-floating":"",className:"pointer-events-auto w-160 max-w-[90vw] rounded-lg bg-elevated p-2 shadow-overlay","data-glass-overlay":"",children:t.map((o,l)=>c.jsx(nut,{row:o,active:l===n,onCommit:()=>s(l),onHover:()=>r(l)},o.sessionId))})}),document.body):null]})}function oQ(e){return e.title??h("ui.command_palette.palette_search.untitled_chat")}const eut=1e3;function tut(){let e=0;function t(){window.clearTimeout(e),window.removeEventListener("contextmenu",n,!0),window.removeEventListener("pointerup",t,!0)}function n(s){s.preventDefault(),s.stopPropagation(),t()}e=window.setTimeout(t,eut),window.addEventListener("contextmenu",n,!0),window.addEventListener("pointerup",t,!0)}function nut({row:e,active:t,onCommit:n,onHover:s}){return c.jsxs("button",{type:"button",tabIndex:-1,"aria-current":t?"true":void 0,"data-session-id":e.sessionId,onPointerDown:r=>{r.button===0&&(r.preventDefault(),tut(),n())},onMouseDown:r=>r.preventDefault(),onContextMenu:r=>r.preventDefault(),onMouseMove:s,className:R("flex h-9 w-full items-center gap-3 rounded-sm px-2 text-left",t?"bg-sunken outline-solid outline-1 -outline-offset-1 outline-control":"bg-transparent"),children:[e.row===null?c.jsx("span",{"aria-hidden":"true",className:"size-4 shrink-0"}):c.jsx(Q0,{row:e.row}),c.jsx("span",{className:R("min-w-0 flex-1 truncate text-body-sm",e.title===null?"text-ink-muted":"text-ink"),children:oQ(e)})]})}const lQ=({title:e,description:t,icon:n,children:s,titleComponent:r,sectionRef:i,dataTourTag:a,className:o,id:l,searchSection:u,searchSectionLabel:d,searchIgnore:f})=>c.jsxs("div",{ref:i,id:l,"data-search-section":u,"data-search-section-label":d,"data-search-ignore":f,tabIndex:l?-1:void 0,"data-tour-tag":a,className:R("w-full",o),children:[r??c.jsxs("h2",{className:"flex items-center gap-2 text-heading text-ink",children:[n&&c.jsx(n,{size:16,className:"shrink-0 text-ink-dim"}),e]}),t&&c.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:t}),c.jsx("div",{className:"mt-4",children:s})]}),Tgt=({label:e,value:t,className:n,valueClassName:s})=>c.jsxs("div",{className:R("min-w-0",n),children:[c.jsx("div",{className:"flex items-center gap-1.5 text-meta text-ink-dim",children:e}),c.jsx("div",{className:R("mt-0.5 break-words text-body-sm",s??"text-ink"),children:t})]}),Rgt=({children:e,className:t})=>c.jsx("div",{className:R("grid grid-cols-[repeat(auto-fit,minmax(160px,1fr))] gap-x-6 gap-y-4",t),children:e});function cQ({id:e,rank:t,action:n,settingKey:s,help:r,hint:i,ariaLabel:a,value:o,fieldRef:l,saving:u,showReset:d,onReset:f,onKeyDown:p,onKeyUp:g,onBlur:v,notes:b,error:_,focusKey:x}){const w=m.useRef(!1);return m.useEffect(()=>{if(x!==s||w.current)return;const y=l.current;y&&(w.current=!0,y.scrollIntoView?.({block:"center"}),y.focus())},[x,s,l]),c.jsxs("div",{className:"group flex min-w-0 flex-col gap-1","data-speech-rank":t,"data-search-row":`keyboard.${s}`,"data-search-label":n,"data-search-terms":s,"data-search-control":!0,children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsxs("div",{className:"flex w-32 flex-col",children:[c.jsx(gr,{htmlFor:e,className:"text-body-sm text-ink",children:t==="primary"?h("ui.settings.shortcuts.speech.primary"):h("ui.settings.shortcuts.speech.secondary")}),c.jsx("span",{className:"text-meta text-ink-muted",children:n})]}),c.jsx(ks,{ref:l,id:e,"aria-label":a,"aria-describedby":`${e}-hint ${e}-notes ${e}-status`,"aria-invalid":_?!0:void 0,"aria-busy":u,"data-shortcut-action":s,className:"w-52 text-left font-mono text-body-sm",value:o,readOnly:!0,onKeyDown:p,onKeyUp:g,onBlur:v}),d&&c.jsx(ue,{variant:"secondary",size:"sm",disabled:u,"aria-label":h("ui.settings.shortcuts.keyboard_shortcuts_section.reset_label_to_its_default",{label:n}),onClick:f,children:h("ui.settings.shortcuts.keyboard_shortcuts_section.reset")})]}),c.jsxs("div",{className:"ml-0 max-w-88 text-meta text-ink-muted sm:ml-34",children:[c.jsx("p",{children:r}),c.jsx("p",{id:`${e}-hint`,className:"hidden group-focus-within:block",children:i}),c.jsx("div",{id:`${e}-notes`,children:b}),c.jsx("output",{id:`${e}-status`,className:"block","aria-live":"polite",children:u?h("ui.settings.configuration.backend_setting_row.saving"):_?c.jsx("span",{className:"text-danger",children:_}):null})]})]})}function uQ({settingKey:e,refetch:t,fieldRef:n,onPending:s,onSaved:r}){const[i,a]=m.useState(!1),[o,l]=m.useState(null),[u,d]=m.useState(!1);return m.useEffect(()=>{!u||i||(n.current?.focus(),d(!1))},[u,i,n]),{saving:i,error:o,setError:l,write:async(p,g)=>{if(!(e===void 0||i||p==="settings.edit"&&g===void 0)){a(!0),l(null),s?.(g);try{await et(p==="settings.edit"?{op:p,key:e,value:g??""}:{op:p,key:e}),r?.(p,g),await t()}catch(v){let b;if(v instanceof Wi){const _=v.detail;typeof _=="object"&&_!==null&&"code"in _&&_.code==="keymap.conflict"&&"label"in _&&typeof _.label=="string"&&(b=h("ui.settings.shortcuts.capture.already_assigned",{label:_.label}))}l(b??(v instanceof Error?v.message:h(p==="settings.edit"?"ui.settings.configuration.backend_settings_section.the_setting_could_not_be_saved":"ui.settings.configuration.backend_settings_section.the_setting_could_not_be_reset")))}finally{s?.(),a(!1),d(!0)}}}}}function dQ(e,t,n,s=[]){const r=/^(Alt|Meta|Control)/.exec(e)?.[1],i=o=>r==="Control"?o.includes("ctrl")||o.includes("primary"):r==="Meta"?o.includes("meta")||t==="darwin"&&o.includes("primary"):r==="Alt"&&o.includes("alt"),a=o=>o.split("+").slice(0,-1);return s.find(o=>i(a(o)))??n.find(o=>i(a(o)))??null}function sut(e,t,n){const s=e.split("+"),r=s.at(-1)??"",i=o=>o==="primary"?t==="Control"||t==="Command"?t:n==="darwin"?"Command":"Control":o==="ctrl"?"Control":o==="shift"?"Shift":o==="alt"?n==="darwin"?"Option":"Alt":o==="meta"?n==="darwin"?"Command":n==="win32"?"Windows":"Super":o,a=r.length===1?r.toUpperCase():r.charAt(0).toUpperCase()+r.slice(1);return[...s.slice(0,-1).map(i),a].join("+")}function rut(e,t,n,s){for(const r of["AltRight","ControlRight","MetaRight"]){const i=Q8(r,t);if(i===null)continue;const a=Hd(i);if(!(!a||a.code===e)&&!dQ(r,t,n,s))return a.label}return null}const iut=/^(Alt|Meta|Control|Shift)(Left|Right)$/,mE=e=>e.split("-").slice(1).join("-");function aut({setting:e,refetch:t,focusKey:n}){const s=y2(),r=tt(A=>A.shortcutBindings),i=m.useRef(null),a=m.useId(),o=m.useMemo(()=>Ioe(),[]),l=m.useRef(null),u=typeof e.default=="string"?e.default:MP,{saving:d,error:f,setError:p,write:g}=uQ({settingKey:e.key,refetch:t,fieldRef:i,onSaved:(A,F)=>Noe(A==="settings.edit"?F:u)}),v=h("ui.settings.shortcuts.speech.push_to_talk_hold"),b=typeof e.value=="string"?e.value:"",_=Hd(b)??Hd(u)??Hd(MP),x=Hd(b)?.code===Hd(u)?.code,w=Ey.flatMap(A=>{const F=zA(A.id,r);return F?[F]:[]}),y=s.canonical?[s.canonical]:[],S=_===null?null:dQ(_.code,o,w,y),C=S===null||_===null?null:rut(_.code,o,w,y),k=h("ui.settings.shortcuts.speech.push_to_talk_letter_pointer"),T=()=>p(h("ui.settings.shortcuts.speech.push_to_talk_refused",{platform:o}));return c.jsx(cQ,{id:a,rank:"secondary",action:v,settingKey:e.key,focusKey:n,help:e.help,hint:`${h("ui.settings.shortcuts.speech.push_to_talk_hint")} ${k}`,ariaLabel:h("ui.settings.configuration.setting_control.label_press_the_key_you_want",{label:v}),value:_?.label??"",fieldRef:i,saving:d,showReset:!x,onReset:()=>void g("settings.reset"),onBlur:()=>{l.current=null,p(null)},onKeyDown:A=>{if(d)return;if(A.repeat||A.nativeEvent.isComposing){WE.has(A.key)||A.preventDefault();return}const F=l.current!==null;if(l.current&&(l.current.tainted=!0),WE.has(A.key)){F&&T();return}if(Ux.has(A.key)){l.current=null,p(null),A.preventDefault();return}if(A.preventDefault(),F||!iut.test(A.code)){F||(l.current=null),T();return}p(null),l.current={code:A.code,tainted:!1}},onKeyUp:A=>{const F=l.current;if(!F||A.code!==F.code||(l.current=null,F.tainted||d))return;const I=Q8(F.code,o);if(I===null){T();return}Hd(I)?.code!==_?.code&&g("settings.edit",I)},notes:S!==null&&_!==null&&c.jsx("p",{children:h("ui.settings.shortcuts.speech.push_to_talk_overlap",{modifier:mE(_.label),example:sut(S,mE(_.label),o),alternative:C?mE(C):"none"})}),error:f})}function out({setting:e,refetch:t,focusKey:n}){const s=m.useRef(!1),r=y2(),i=m.useRef(null),a=m.useId(),o=m.useMemo(()=>mg(),[]),{saving:l,error:u,setError:d,write:f}=uQ({settingKey:e.key,refetch:t,fieldRef:i,onPending:S=>window.api?.recordingShortcut?.markPending(S)}),p=h("ui.settings.shortcuts.speech.start_recording_press"),g=typeof e.value=="string"?e.value:r.value,v=r.problem?r.value:g,b=typeof e.default=="string"?e.default:Poe,_=Wb(g)===Wb(b),x=S=>h("ui.settings.shortcuts.capture.already_assigned",{label:S}),w=h("ui.chat.composer.start_recording"),y=h("ui.settings.shortcuts.keyboard_shortcuts_section.press_the_keys_you_want_esc_cancels");return c.jsx(cQ,{id:a,rank:"primary",action:p,settingKey:e.key,focusKey:n,help:e.help,hint:y,ariaLabel:h("ui.settings.shortcuts.keyboard_shortcuts_section.label_press_the_keys_you_want",{label:p}),value:yH(v,o),fieldRef:i,saving:l,showReset:!_,onReset:()=>void f("settings.reset"),onKeyUp:S=>{!Dm.has(S.key)||!s.current||(s.current=!1,d(h("ui.settings.shortcuts.speech.start_recording_needs_key")))},onBlur:()=>{s.current=!1},onKeyDown:S=>{if(l)return;if(S.repeat&&Dm.has(S.key)){S.preventDefault();return}if(s.current=Dm.has(S.key),Ux.has(S.key)||Dm.has(S.key)){Ux.has(S.key)&&d(null),S.preventDefault();return}const C=C2(S);if(C===null)return;if(S.preventDefault(),Wb(C)===Wb(g)){d(null);return}const k=tt.getState().shortcutBindings,T=J8(r,x(w));for(const F of Ey){const I=k[F.id]??F.defaultChord;I&&T.set(I,F.label)}const A=CH(C,"panel.console",{},o,T);if(A!==null){d(A);return}f("settings.edit",C)},notes:c.jsxs(c.Fragment,{children:[r.shadowedBy&&!u&&c.jsx("output",{className:"block text-danger",children:h("ui.settings.shortcuts.recording.inactive_claimed",{label:r.shadowedBy})}),r.problem&&!u&&c.jsx("output",{className:"block text-danger",children:h("ui.settings.shortcuts.recording.invalid_stored_value")})]}),error:u})}function lut({focusKey:e}){const{client:t,provided:n}=Hee(),s=Mn({queryKey:Yo.settings,queryFn:()=>et({op:"settings.list"}),enabled:n,staleTime:1e4},t),r=l=>s.data?.settings.find(u=>u.key===l),i=r(Moe),a=r(Ooe);if(!n)return null;const o=c.jsx("h3",{className:"pt-1 text-body-sm font-medium text-ink",children:h("ui.settings.shortcuts.category.speech_to_text")});return!i&&!a?s.isPending?c.jsx("div",{className:"min-h-24 space-y-3","aria-busy":"true",children:o}):null:c.jsxs("div",{className:"space-y-3","data-shortcut-recording":!0,children:[o,i&&c.jsx(out,{setting:i,refetch:s.refetch,focusKey:e}),a&&c.jsx(aut,{setting:a,refetch:s.refetch,focusKey:e})]})}const hQ=e=>{switch(e.id){case"panel.console":return h("ui.settings.shortcuts.row.console");case"panel.canvas":return h("ui.settings.shortcuts.row.canvas");case"panel.run":return h("ui.settings.shortcuts.row.execution");case"panel.ask":return h("ui.settings.shortcuts.row.asks");case"panel.browser":return h("ui.settings.shortcuts.row.browser");case"panel.code":return h("ui.settings.shortcuts.row.code_review")}},cut=()=>h("ui.chat.composer.start_recording");function uut(){m.useEffect(()=>{let e=0;const t=()=>{const r=tt.getState().shortcutBindings,i=new Map(Uee);for(const a of Ey){const o=zA(a.id,r);if(!o)continue;const l=hQ(a);for(const u of Loe(o,mg()))i.set(u,l)}window.api?.recordingShortcut?.syncClaims(++e,[...i].map(([a,o])=>({chord:a,label:o})))};t();const n=tt.subscribe((r,i)=>{r.shortcutBindings!==i.shortcutBindings&&t()}),s=_J(t);return()=>{n(),s()}},[])}const dut=({action:e})=>{const t=y2(),n=J8(t,cut());Ve();const s=m.useId(),r=m.useRef(null),i=tt(_=>_.shortcutBindings),a=i[e.id],o=tt(_=>_.setShortcutBinding),l=tt(_=>_.clearShortcutBinding),[u,d]=m.useState(!1),[f,p]=m.useState(null),g=m.useMemo(mg,[]),v=zA(e.id,i),b=hQ(e);return c.jsxs("div",{"data-search-row":`keyboard.${e.id}`,"data-search-control":!0,className:"flex flex-col gap-1",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(gr,{htmlFor:s,className:"w-32 text-body-sm text-ink",children:b}),c.jsx(ks,{id:s,readOnly:!0,value:v===null?h("ui.settings.shortcuts.keyboard_shortcuts_section.no_shortcut"):yH(v,g),"aria-label":h("ui.settings.shortcuts.keyboard_shortcuts_section.label_press_the_keys_you_want",{label:String(b)}),"data-shortcut-action":e.id,ref:r,className:R("w-52",v===null?"text-body-sm":"font-mono text-body-sm"),onFocus:()=>d(!0),onBlur:()=>{d(!1),p(null)},onKeyDown:_=>{if(WE.has(_.key))return;if(Ux.has(_.key)){d(!1),p(null);return}if(Dm.has(_.key)||_.nativeEvent.isComposing)return;const x=C2({key:_.key,code:_.code,metaKey:_.metaKey,ctrlKey:_.ctrlKey,altKey:_.altKey,shiftKey:_.shiftKey}),w=CH(x,e.id,i,g,n);if(w!==null){_.preventDefault(),d(!0),p(w);return}if(x===v){d(!0),p(null);return}_.preventDefault(),d(!0),p(null),x===e.defaultChord?o(e.id,null,n):x!==null&&o(e.id,x,n)}}),v!==null&&c.jsx(ue,{variant:"secondary",size:"sm","aria-label":h("ui.settings.shortcuts.keyboard_shortcuts_section.clear_label_s_shortcut",{label:String(b)}),onClick:()=>{l(e.id),r.current?.focus()},children:h("ui.settings.shortcuts.keyboard_shortcuts_section.clear")}),a!==void 0&&c.jsx(ue,{variant:"secondary",size:"sm","aria-label":h("ui.settings.shortcuts.keyboard_shortcuts_section.reset_label_to_its_default",{label:String(b)}),onClick:()=>{o(e.id,null,n),r.current?.focus()},children:h("ui.settings.shortcuts.keyboard_shortcuts_section.reset")})]}),u&&c.jsx("span",{className:"text-meta text-ink-dim",children:h("ui.settings.shortcuts.keyboard_shortcuts_section.press_the_keys_you_want_esc_cancels")}),f!==null&&c.jsx("output",{className:"text-meta text-danger",children:f})]})},Agt=({sectionRef:e,focusKey:t})=>(Ve(),c.jsx(lQ,{title:h("ui.settings.shortcuts.keyboard_shortcuts_section.keyboard_shortcuts"),icon:RG,description:h("ui.settings.shortcuts.keyboard_shortcuts_section.shortcut_capture_description"),sectionRef:e,searchSection:"keyboard",searchSectionLabel:h("ui.settings.navigation.settings_sidebar.keyboard_shortcuts"),children:c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsx("p",{"data-shortcut-note":"browser-scope",className:"max-w-2xl text-body-sm text-ink-muted",children:h("ui.settings.shortcuts.keyboard_shortcuts_section.browser_shortcuts_answer_only_while_the_browser_has_focus")}),c.jsx(lut,{focusKey:t}),c.jsx("h3",{className:"pt-1 text-body-sm font-medium text-ink",children:h("ui.settings.shortcuts.category.panels")}),c.jsx("div",{className:"flex flex-col gap-4",children:Ey.map(n=>c.jsx(dut,{action:n},n.id))})]})}));async function hut(e){await et({op:"settings.edit",key:Tl,value:e.value}),Hoe(e.queryClient)}async function fQ(e){await hut(e),e.queryClient.setQueryData(Gx.all,t=>t&&{...t,settings:t.settings.map(n=>n.key===Tl?{...n,value:e.value,is_default:e.value===n.default}:n)});try{return await e.queryClient.fetchQuery({queryKey:Gx.all,queryFn:()=>et({op:"settings.list"}),staleTime:0,retry:!1}),"confirmed"}catch{return"readback-unknown"}}const Fgt=({focus:e=!1,focusNonce:t})=>{Ve();const n=Nt(),s=zn(),r=vt(s.data,"settings"),i=Mn({queryKey:Gx.all,queryFn:()=>et({op:"settings.list"}),enabled:r,retry:!1,refetchOnReconnect:!0}),a=i.data?.settings.find(I=>I.key===Tl),[o,l]=m.useState(!1),[u,d]=m.useState(null),[f,p]=m.useState(!1),[g,v]=m.useState(!1),b=m.useRef(!1),_=m.useRef(null),x=m.useRef(!1),w=m.useRef(t);m.useEffect(()=>{t!==w.current&&(w.current=t,x.current=!1)},[t]),m.useEffect(()=>{if(!e){x.current=!1;return}!a||x.current||(_.current?.querySelector("[role=combobox]")?.focus(),x.current=!0)},[e,t,a]),m.useEffect(()=>{i.isSuccess&&!i.isFetching&&p(!1)},[i.isFetching,i.isSuccess]);const y=async I=>{if(!(!a||b.current||f||!a.choices.some(N=>N.value===I))){b.current=!0,l(!0),d(null),v(!1);try{const N=await fQ({value:I,queryClient:n});p(N==="readback-unknown"),v(N==="confirmed")}catch(N){d({value:I,message:N instanceof Error?N.message:""})}finally{b.current=!1,l(!1)}}},S=async()=>{const[I,N]=await Promise.all([i.refetch(),s.refetch()]);!I.isError&&!N.isError&&p(!1)},C=!i.data&&i.error||!s.data&&s.error,k=s.data&&(!r||i.data&&!a),T=!C&&!k&&!a,A=s.data?.features?.i18n?s.data.language:void 0,F=typeof A=="string"&&A!==""?A:void 0;return c.jsx(lQ,{title:h("ui.settings.language.dialog.title"),icon:AG,description:h("ui.settings.language.general.description"),children:c.jsxs("div",{ref:_,"data-setting-key":Tl,"data-search-row":"general.language","data-search-control":!0,className:"flex flex-col gap-3","aria-busy":o,children:[T&&c.jsx("output",{className:"text-meta text-ink-dim",children:h("ui.settings.language.dialog.loading")}),k&&c.jsx("p",{className:"text-meta text-ink-dim",children:h("ui.settings.language.dialog.unavailable")}),a&&c.jsx(Z8,{setting:{...x2(a),label:h("ui.settings.language.dialog.title")},value:String(a.value),onValueChange:I=>{y(I)},disabled:o||f,suppressEffectiveNote:!0}),c.jsx("output",{id:Boe(Tl),"aria-live":"polite",className:"text-meta text-ink-dim",children:o?h("ui.settings.language.general.pending"):g?h("ui.settings.language.general.saved"):F?h(f||s.error?"ui.settings.language.general.last_known":"ui.settings.language.general.effective",{locale:joe(F)?.name??F}):h("ui.settings.language.general.no_resolution")}),(C||u||f)&&c.jsx(yr,{variant:"danger",children:c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("p",{role:"alert",children:u?h("ui.settings.language.general.write_error",{message:u.message}):f?h("ui.settings.language.general.readback_error"):h("ui.settings.language.dialog.unavailable")}),c.jsx(ue,{variant:"outline",size:"sm",disabled:o||i.isFetching||s.isFetching,onClick:()=>{u?y(u.value):S()},children:h("ui.settings.language.dialog.retry")})]})})]})})},fut=()=>{Ve();const e=Cx(M=>M.open),t=Cx(M=>M.closeLanguage),n=Nt(),s=zn(),r=vt(s.data,"settings"),i=Mn({queryKey:Gx.all,queryFn:()=>et({op:"settings.list"}),enabled:e&&r,staleTime:1e4}),a=m.useRef(null),o=D8(),l=(i.data?.settings??[]).find(M=>M.key===Tl),u=l?x2(l):void 0,[d,f]=m.useState(!1),[p,g]=m.useState(!1),[v,b]=m.useState(null),[_,x]=m.useState(!1),w=m.useRef(!1);m.useEffect(()=>{e&&(g(!1),b(null))},[e]);const y=String(u?.value??""),S=async M=>{if(!(!u||w.current||_||!u.choices.some(X=>X.value===M))){w.current=!0,f(!0),b(null),g(!1);try{const X=await fQ({value:M,queryClient:n});x(X==="readback-unknown"),g(X==="confirmed")}catch(X){const se=X instanceof Error?X.message:"";b({value:M,message:se}),Cx.getState().open||fn(h("ui.settings.language.general.write_error",{message:se}))}finally{w.current=!1,f(!1)}}},C=async()=>{const[M,X]=await Promise.all([i.refetch(),s.refetch()]);!M.isError&&!X.isError&&x(!1)},k=!!s.data,T=k&&!r,A=s.error&&!s.data?s.error:null,F=A??(i.data?null:i.error),I=!k&&!F,{sentence:N,remedy:P}=Gee(o??null,h("ui.settings.configuration.language_dialog.your_settings_could_not_be_loaded"),F),O=s.isFetching||i.isFetching,j=u?"combo":F?"retry":"none";return m.useEffect(()=>{!e||j==="none"||requestAnimationFrame(()=>{a.current?.querySelector(j==="combo"?'[role="combobox"]':"[data-language-retry]")?.focus()})},[e,j]),c.jsx(Gc,{open:e,onOpenChange:M=>!M&&t(),children:c.jsxs(Vc,{ref:a,onOpenAutoFocus:M=>M.preventDefault(),className:"max-w-[min(28rem,calc(100vw-4rem))] gap-4",children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx(Ol,{className:"text-title",children:h("ui.settings.language.dialog.title")}),c.jsx(ud,{className:"text-body-sm text-ink-muted",children:h("ui.settings.language.dialog.description")})]}),I?c.jsxs("div",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[c.jsx(Pn,{}),h("ui.settings.language.dialog.loading")]}):T?c.jsx(yr,{variant:"warning",children:c.jsx("span",{children:h("ui.settings.language.dialog.unavailable")})}):F?c.jsx(yr,{variant:"warning",children:c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("span",{children:N}),P&&c.jsx(ue,{variant:"tonal",size:"sm",className:"shrink-0","data-language-retry":"",onClick:()=>{A?s.refetch():i.refetch()},disabled:O,children:O?h("ui.settings.language.dialog.retrying"):h("ui.settings.language.dialog.retry")})]})}):i.isPending?c.jsxs("div",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[c.jsx(Pn,{}),h("ui.settings.language.dialog.loading")]}):u?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{id:OP(Tl),className:"text-meta text-ink-dim",children:u.help}),c.jsx(Z8,{setting:u,value:y,disabled:d||_,helpId:OP(Tl),effectiveNoteId:Uoe(Tl,Goe),onValueChange:M=>{S(M)}})]}),v&&c.jsx(yr,{variant:"danger",children:c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("p",{role:"alert",children:h("ui.settings.language.general.write_error",{message:v.message})}),c.jsx(ue,{variant:"outline",size:"sm",disabled:d||i.isFetching,onClick:()=>{S(v.value)},children:h("ui.settings.language.dialog.retry")})]})}),_&&c.jsx(yr,{variant:"danger",children:c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("p",{role:"alert",children:h("ui.settings.language.general.readback_error")}),c.jsx(ue,{variant:"outline",size:"sm",disabled:d||i.isFetching||s.isFetching,onClick:()=>{C()},children:h("ui.settings.language.dialog.retry")})]})}),c.jsx("div",{className:"flex min-h-8 items-center justify-end",children:d?c.jsx("output",{"aria-live":"polite",className:"text-body-sm text-ink-muted",children:h("ui.settings.language.general.pending")}):p?c.jsxs("output",{"data-language-status":"","aria-live":"polite",className:"inline-flex items-center gap-1.5 text-body-sm text-ink",children:[c.jsx(mr,{"aria-hidden":"true",className:"size-3.5"}),h("ui.settings.language.dialog.saved")]}):null})]}):c.jsx(yr,{variant:"warning",children:c.jsx("span",{children:h("ui.settings.language.dialog.unavailable")})})]})})},P5=e=>{const t=zoe(e.type),n=typeof e.percent=="number"?`, ${Math.round(e.percent)}%`:"";return h("ui.common.updates.update_foot_icon.in_progress",{subject:t,percent:n})},pQ=e=>Woe({type:e.type,version:e.offer.version}),put=e=>{const t=e.map(s=>pQ(s)),n=t.slice(1).reduce((s,r)=>h("ui.common.updates.update_foot_icon.subject_join",{left:s,right:`${r.charAt(0).toLowerCase()}${r.slice(1)}`}),t[0]);return h("ui.common.updates.update_foot_icon.available_show_the_update_notice",{joined:n})},gut=({surfaces:e,inflight:t,onShow:n,onDismiss:s})=>{if(Ve(),t===null&&e.length===0)return null;if(t!==null)return c.jsx(bt,{side:"top",collisionPadding:8,content:P5(t),children:c.jsx("output",{"data-update-foot-icon":"","data-update-foot-icon-state":"inflight","aria-label":P5(t),className:"flex size-8 shrink-0 items-center justify-center text-accent",children:c.jsx(yi,{className:"size-4 shrink-0 motion-safe:animate-spin","aria-hidden":"true"})})});const r=e.find(i=>(i.offer.summary??"").trim()!=="");return c.jsx(bt,{side:"top",collisionPadding:8,content:c.jsxs("div",{className:"flex max-w-64 flex-col gap-0.5",children:[e.map(i=>c.jsxs("span",{className:"truncate text-ink",children:[pQ(i)," ",h("ui.common.updates.update_foot_icon.available")]},i.type)),r?c.jsx("span",{className:"truncate text-ink-muted",children:(r.offer.summary??"").trim()}):null,e.every(i=>i.offer.nonDisruptive===!0)?c.jsx("span",{className:"text-ink-muted",children:h("ui.common.updates.update_foot_icon.sessions_keep_running")}):null,c.jsx("span",{className:"whitespace-nowrap text-ink-muted",children:h("ui.common.updates.update_foot_icon.show_the_update_notice")})]}),children:c.jsx("button",{type:"button","data-update-foot-icon":"","data-update-foot-icon-state":"available","aria-label":put(e),onClick:n,onKeyDown:i=>{i.key!=="Escape"||!s||(i.stopPropagation(),s())},className:R("flex size-8 shrink-0 items-center justify-center rounded-sm text-accent","transition-colors duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink"),children:c.jsx(d2,{className:"size-4 shrink-0","aria-hidden":"true"})})})},gQ=()=>{const e=Or(g=>g.followed),t=Or(g=>g.running),n=Or(g=>g.offers),s=Or(g=>g.detailOpen),r=Or(g=>g.inflight),i=Or(g=>g.downloadPercent),a=Or(g=>g.openNotice),o=Or(g=>g.noticeOpen),l=Or(g=>g.dismissNotice),u=m.useMemo(()=>{const g={followed:e,running:t,offers:n,detailOpen:s};return IH.filter(v=>Voe(g,v)).map(v=>{const b=n[v];return b?{type:v,offer:b}:null}).filter(v=>v!==null)},[e,t,n,s]),d=m.useMemo(()=>r[Dn.BACKEND]?{type:Dn.BACKEND,percent:null}:r[Dn.UI]?{type:Dn.UI,percent:i[Dn.UI]}:null,[r,i]),f=m.useCallback(()=>a(),[a]),p=m.useCallback(()=>l(),[l]);return c.jsx(gut,{surfaces:u,inflight:d,onShow:f,onDismiss:o?p:void 0})},mQ="px-2",DA=new WeakMap,mut=64,vut=1024*1024,but=3e3;function _ut(e){const t=DA.get(e);if(t)return t;const n=new Map;DA.set(e,n);let s=hp(e);return b2(e,()=>{const r=hp(e);if(r===s)return;s=r;const i=[...n.values()];n.clear();for(const a of i){a.url&&Hx(a.url),a.url=void 0;for(const o of a.listeners)o()}}),n}function xut(e){if(e.size<mut)return!0;for(const[t,n]of e)if(!(n.listeners.size||n.promise))return n.url&&Hx(n.url),e.delete(t),!0;return!1}const wut=hX;function Dgt(e,t){const n=vQ(t),s=yut(),r=e?pX(e):null,i=r?.src?.type==="endpoint"&&!s?null:r?.src,a=i?.type,o=i?.type==="account"?i.accountId:i?.type==="endpoint"?i.endpointId:void 0,l=i?.hash,u=m.useMemo(()=>a==="account"&&o&&l?{type:"account",accountId:o,hash:l}:a==="endpoint"&&o&&l?{type:"endpoint",endpointId:o,hash:l}:null,[a,o,l]);return bQ(u,n)}function vQ(e){return $oe(e,qoe())}function yut(){return B8("team_bridge_endpoint_avatar")}const Cut=/^(?:acc_[A-Za-z0-9_-]{1,64}|[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12})$/,Sut=/^[0-9a-f]{16}$/;function kut(e){const t=e?.id,n=e?.profile?.avatar;if(!t||!Cut.test(t)||!n||!n.hash||!Sut.test(n.hash)||n.source==="none")return null;if(e.avatar_url){const s=wut.exec(e.avatar_url);if(!s||s[1]!==t||s[2]!==n.hash)return null}return{accountId:t,hash:n.hash}}function Eut(e,t){const n=_g(),s=e?.id,r=e?.profile?.avatar?.hash,i=e?.profile?.avatar?.source,a=e?.avatar_url,o=m.useMemo(()=>kut({id:s,avatar_url:a,profile:{avatar:{hash:r,source:i}}}),[s,r,i,a]);return Tut(o&&o.accountId===n.accountId?o:null,t,{retryOnce:!0})}function Tut(e,t,n={}){const s=vQ(t),r=m.useMemo(()=>e?{type:"account",...e}:null,[e]);return bQ(r,s,n)}function bQ(e,t,n={}){const s=n.retryOnce===!0,r=Nt(),i=_g(),a=e?`${i.epoch}:${i.accountId??"none"}:${e.type}:${e.type==="account"?e.accountId:e.endpointId}:${e.hash}:${t}`:null,[,o]=m.useState(0),l=m.useRef(!0);if(m.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]),m.useEffect(()=>{if(!a||!e||!i.accountId)return;const u=_ut(r),d=u.get(a),f=d??{failed:!1,listeners:new Set,retried:!1},p=i.epoch,g=i.accountId,v=()=>{f.failed=!1,f.promise=(e.type==="endpoint"?Xn.endpointAvatarBytes({expectedAccountId:g,endpointId:e.endpointId,hash:e.hash,size:t}):Xn.avatarBytes({expectedAccountId:g,accountId:e.accountId,hash:e.hash,size:t})).then(({data:w,mimeType:y})=>{if(u.get(a)!==f)return;const S=ni(r);if(S.epoch!==p||S.accountId!==g){u.delete(a);return}if(!["image/png","image/jpeg"].includes(y)||w.byteLength===0||w.byteLength>vut)throw new Error("Invalid avatar bytes");f.url=y8(new Blob([w],{type:y}),y)}).catch(()=>{f.failed=!0}).finally(()=>{if(f.promise=void 0,u.get(a)===f)for(const w of f.listeners)w()})};if(!d){if(!xut(u))return;u.set(a,f),v()}let b=!1;const _=()=>{!s||!f.failed||f.promise||f.retried||(f.retried=!0,b=!0,f.retryTimer=setTimeout(()=>{if(f.retryTimer=void 0,b=!1,u.get(a)!==f||!f.failed)return;const w=ni(r);w.epoch!==p||w.accountId!==g||v()},but))};u.delete(a),u.set(a,f);const x=()=>{_(),l.current&&o(w=>w+1)};return f.listeners.add(x),_(),()=>{f.listeners.delete(x),b&&f.retryTimer&&(clearTimeout(f.retryTimer),f.retryTimer=void 0,f.retried=!1)}},[i.accountId,i.epoch,a,r,s,t,e]),!(!a||!i.accountId))return DA.get(r)?.get(a)?.url}const NI=rt.memo(({expanded:e,useAuth:t=!1})=>{const n=Py(),s=si(),{user:r,isAuthenticated:i,accountRead:a,signOut:o}=Qy(),l=a==="checking"?h("ui.shell.user_profile_sidebar.checking_account"):LP(a)?h("ui.shell.user_profile_sidebar.account_unavailable"):null,u=r?.name??l??h("ui.shell.user_profile_sidebar.user"),d=LP(a),f=r?.email??"",p=d?h("ui.shell.user_profile_sidebar.reconnect_radient"):f,g=d?"/settings?section=providers&provider=radient":"/settings",v=d?h("ui.shell.user_profile_sidebar.reconnect_radient"):h("ui.shell.user_profile_sidebar.account_settings"),b=m.useCallback(async()=>{i&&(await o(),window.location.reload())},[i,o]),_=m.useMemo(()=>{const S=r?.name;return S?S.split(" ").map(C=>C.charAt(0)).join("").toUpperCase().substring(0,2):null},[r?.name]),x=Eut(r?.radientUser.account,28),w=c.jsxs("button",{type:"button",onClick:t?void 0:()=>s(g),"aria-label":e?void 0:v,className:R("flex w-full min-w-0 items-center gap-2 rounded-sm transition-colors duration-fast ease-out-quart hover:bg-row-hover",e?"px-2 py-1.5":"justify-center py-1.5"),children:[c.jsxs(AH,{className:"size-7 shrink-0 rounded-full bg-media-surface",children:[x&&c.jsx(Dy,{src:x,alt:"",className:"lo-avatar-arrival"}),c.jsx(Iy,{className:"rounded-full bg-media-surface text-ink-muted",children:_??c.jsx(MG,{size:14,"aria-hidden":"true"})})]}),e&&u&&c.jsxs("span",{className:"min-w-0 text-start",children:[c.jsx("span",{className:"block truncate text-body-sm text-ink",children:u}),p&&c.jsx("span",{className:R("block truncate text-meta",d?"text-accent":"text-ink-dim"),children:p})]})]}),y=e?w:c.jsx(Iu,{content:v,side:n==="rtl"?"left":"right",children:w});return t?c.jsxs(Xo,{children:[e?c.jsx(_o,{asChild:!0,children:w}):c.jsx(Iu,{content:v,side:n==="rtl"?"left":"right",children:c.jsx(_o,{asChild:!0,children:w})}),c.jsxs(Qo,{align:"end",side:"top",className:"min-w-50",children:[d?c.jsxs(on,{onSelect:()=>s(g),children:[c.jsx(EH,{size:16,"aria-hidden":"true"}),h("ui.shell.user_profile_sidebar.reconnect_radient")]}):null,c.jsxs(on,{onSelect:()=>s("/settings"),children:[c.jsx(Ou,{size:16,"aria-hidden":"true"}),h("ui.shell.user_profile_sidebar.settings")]}),c.jsxs(on,{children:[c.jsx(nfe,{size:16,"aria-hidden":"true"}),h("ui.shell.user_profile_sidebar.privacy_and_security")]}),c.jsx(Wr,{}),c.jsxs(on,{onSelect:b,className:"text-danger focus:bg-danger-wash focus:text-danger",children:[c.jsx(Ahe,{size:16,"aria-hidden":"true"}),h("ui.shell.user_profile_sidebar.sign_out")]})]})]}):y});NI.displayName="UserProfileSidebar";const _Q=()=>{const e=si(),t=i9();return c.jsx(Iu,{content:h("ui.shell.sidebar_navigation.settings"),side:"top",children:c.jsx("button",{type:"button","data-tour-tag":"nav-item-settings",onClick:()=>e("/settings"),"aria-current":t==="settings"?"page":void 0,"aria-label":h("ui.shell.sidebar_navigation.settings"),className:R("flex size-8 shrink-0 items-center justify-center rounded-sm text-ink-muted","transition-colors duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink",t==="settings"&&"text-ink"),children:c.jsx(Ou,{size:16,"aria-hidden":"true"})})})},xQ=()=>c.jsxs("div",{className:R("flex min-h-10 shrink-0 items-center justify-between gap-1 pb-2",mQ),children:[c.jsx(NI,{expanded:!0}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(gQ,{}),c.jsx(_Q,{})]})]});function wQ(e){return Ne(t=>Vee(t.sessions,e))}const Rut=[];function yQ(){const{state:e}=cC(),t=e?.pendingConsent??Rut,n=C9(s=>zO(t,s));return m.useEffect(()=>{t.length>0&&J2()},[t]),zO(t,n)}const CQ={approvals:["desktop","mesh","approvals"]},Aut=15e3,Fut=new Set(["requested","approved","connecting","failed"]);function Dut(e){return Fut.has(e)}function Iut(e){return e==="requested"}function SQ(e){return e.filter(t=>Iut(t.state)).length}function Nut(e){return QN.test(e.requestDigest)&&QN.test(e.disclosureDigest)}function PI(e){return e.kind==="credential"&&e.typed!==void 0&&e.typed.action==="approve-credential"&&e.typed.operation!==null&&Nut(e.typed)}function vE(e,{credentialApprovals:t=!1,profileApprovals:n=!1}={}){return e.state!=="requested"?!1:e.kind==="profile"?n&&e.profile!==void 0&&e.profile.signable_here===!0&&e.profile.disclosure!=null&&e.profile.disclosure.operation===$A:e.kind==="credential"?t&&PI(e)&&e.typed.signableHere&&e.typed.disclosure?.operation===e.typed.operation:e.canApproveHere!==!1&&(e.kind==="device"||e.kind==="machine")}function Put(e,{profileApprovals:t=!1}={},n){return t&&e.kind==="profile"&&e.profile!==void 0&&(e.state==="approved"||e.state==="failed")&&(n??e.profile.apply_outcome?.retryable===!0)}function Mut(e,{credentialApprovals:t=!1}={},n){return t&&PI(e)&&(e.state==="approved"||e.state==="failed")&&(n??e.typed.applyOutcome?.retryable===!0)}function Igt(e,t,n={},s){const r=e.approvalId;return t==="deny"?{op:"approvals.deny",approvalId:r}:e.kind==="profile"?!(t==="approve"?vE(e,n):Put(e,n,s))||!e.profile?null:{op:t==="approve"?"approvals.approveOperation":"approvals.applyOperation",approvalId:r,operation:$A,requestDigest:e.profile.request_digest,disclosureDigest:e.profile.disclosure_digest??""}:e.kind==="device"||e.kind==="machine"?t==="approve"&&vE(e,n)?{op:"approvals.approve",approvalId:r}:null:!(t==="approve"?vE(e,n):Mut(e,n,s))||!PI(e)||e.typed.operation===null?null:{op:t==="approve"?"approvals.approveCredential":"approvals.applyCredential",approvalId:r,operation:e.typed.operation,requestDigest:e.typed.requestDigest,disclosureDigest:e.typed.disclosureDigest}}function Ngt(e){return Dut(e)}function Pgt(e){switch(e){case"requested":return h("ui.mesh.mesh_approvals.waiting_for_you");case"approved":return h("ui.mesh.mesh_approvals.approved");case"connecting":return h("ui.mesh.mesh_approvals.connecting");case"connected":return h("ui.mesh.mesh_approvals.connected");case"denied":return h("ui.mesh.mesh_approvals.denied");case"expired":return h("ui.mesh.mesh_approvals.expired");case"failed":return h("ui.mesh.mesh_approvals.failed");default:return e}}function Gr(e){return typeof e=="object"&&e!==null}function Out(e){const t=Gr(e)?e:{};return{deviceId:rn(t.device_id),name:rn(t.name),host:rn(t.host),user:rn(t.user),transport:rn(t.transport),hostKeyFp:rn(t.host_key_fp)}}function M5(e){return typeof e=="string"?e:""}function kQ(e){return $ee.includes(e)?e:null}function Lut(e){if(!Gr(e))return null;const t=kQ(e.operation);if(t===null)return null;const n=Gr(e.recipient)?e.recipient:{},s=Gr(e.grant_lifetime)?e.grant_lifetime:{},r=Gr(e.requires_capability)?e.requires_capability:{};return{operation:t,credentialKey:rn(e.credential_key),provider:rn(e.provider),account:rn(e.account),org:rn(e.org),scope:rn(e.scope),recipient:{deviceId:rn(n.device_id),name:rn(n.name),keyFingerprint:rn(n.key_fingerprint)},evidence:JSON.stringify(e,null,2),withdrawalCount:Array.isArray(e.withdrawals)?e.withdrawals.length:0,untilRevoked:s.kind==="until_revoked",futureLogins:e.future_logins!==!1,installsOrJoins:e.installs_or_joins!==!1,copiesCredential:typeof e.copies_credential=="boolean"?e.copies_credential:null,requiresCapability:rn(r.name)}}function EQ(e){return Gr(e)?{code:rn(e.code),retryable:e.retryable===!0,reason:rn(e.reason),remedy:rn(e.remedy)}:null}function But(e){if(Gr(e))return{action:rn(e.action),operation:kQ(e.operation),requestDigest:M5(e.request_digest),disclosureDigest:M5(e.disclosure_digest),disclosure:Lut(e.disclosure),assurance:rn(e.assurance),unprovenHuman:e.unproven_human!==!1,signableHere:e.signable_here===!0,refusal:rn(e.refusal),refusalMessage:rn(e.refusal_message),applyOutcome:EQ(e.apply_outcome),...Gr(e.upgrade)?{upgrade:{...e.upgrade}}:{}}}function jut(e){const t=Gr(e)?e:{};return{connect:T1(t.connect,!1),install:T1(t.install,!1),anchor:Gr(t.anchor),networkId:rn(t.network_id),role:rn(t.role),unattended:T1(t.unattended,!1),grants:CE(t.grant)}}function Hut(e){const t=Array.isArray(e)?e:e?.approvals??[];if(!Array.isArray(t))return[];const n=[];for(const s of t){if(!Gr(s))continue;const r=rn(s.approval_id),i=rn(s.state);if(!r||!i)continue;const a=But(s.typed_approval),o=Wee(s.typed_approval),l=Gr(s.what)&&(Object.prototype.hasOwnProperty.call(s.what,"credential_inheritance")||Object.prototype.hasOwnProperty.call(s.what,"credential_finite_share"))||a?.action==="approve-credential",u=Object.prototype.hasOwnProperty.call(s,"kind")?rn(s.kind):void 0,d=o!==null||u===$A?"profile":l||u==="credential_inheritance"?"credential":u!==void 0&&!["device_onboard","local_authority"].includes(u)?"unknown":!Gr(s.device)&&Gr(s.machine)?"machine":"device",f=Gr(s.requested_by)?s.requested_by:{};n.push({approvalId:r,state:i,kind:d,summary:rn(s.summary)||void 0,details:Array.isArray(s.details)&&s.details.every(p=>typeof p=="string")?s.details.slice():void 0,canApproveHere:Object.prototype.hasOwnProperty.call(s,"can_approve_here")?s.can_approve_here===!0:void 0,approveRemedy:rn(s.approve_remedy)||void 0,where:Out(d==="machine"?s.machine:s.device),what:jut(s.what),requestedBy:{surface:rn(f.surface),sessionId:rn(f.session_id),deviceId:rn(f.device_id)},expiresAt:zee(s.expires_at),...a&&d==="credential"?{typed:a}:{},...o&&d==="profile"?{profile:o}:{}})}return n}function Uut(e){return e.kind==="machine"?h("ui.mesh.mesh_approvals.this_machine"):Fx({device_id:e.where.deviceId,name:e.where.name})}function Mgt(e,t){if(e.kind==="credential"||e.kind==="unknown"||e.canApproveHere===!1){const r=MI(e);if(r)return r;if(e.summary)return e.summary;if(e.kind==="credential"||e.kind==="unknown")return O5(e)}const n=O5(e),s=zut(e,t).map(r=>r.clause);return s.length?h("ui.mesh.mesh_approvals.approval_title_with_clauses",{head:n,clauses:Wut(s)}):h("ui.mesh.mesh_approvals.approval_title",{head:n})}function O5(e){return e.kind==="credential"?MI(e)||e.summary||h("ui.mesh.approval.credential_title"):e.kind==="unknown"?e.summary||h("ui.mesh.approval.unknown_title"):e.canApproveHere===!1&&e.summary?e.summary:e.kind==="machine"?h("ui.mesh.mesh_approvals.set_up_operator_authority_on_this_machine"):h("ui.mesh.mesh_approvals.onboard_subject",{subject:Uut(e)})}function Ogt(e){return e.summary?e.kind==="credential"?MI(e)===null:e.kind==="unknown"||e.canApproveHere===!1:!1}const Gut={github:"GitHub",gitlab:"GitLab"};function L5(e){return Gut[e.toLowerCase()]??e}function TQ(e){const t=e.typed?.disclosure?.recipient;return Fx({device_id:t?.deviceId??"",name:t?.name??""})}function MI(e){const t=e.kind==="credential"?e.typed?.disclosure:null;if(!t)return null;const n=TQ(e);return t.operation==="credential_finite_share"?h("ui.mesh.approval.head_finite_share",{credential:L5(t.credentialKey),device:n}):h("ui.mesh.approval.head_inheritance",{provider:L5(t.provider),account:t.account,device:n})}function Vut(e){const t=e.kind==="credential"?e.typed?.disclosure:null;if(!t)return[];const n=TQ(e),s=[];return t.operation==="credential_finite_share"?s.push(t.scope==="session"?h("ui.mesh.approval.scope_session",{device:n}):h("ui.mesh.approval.scope_device",{device:n})):(s.push(t.org?h("ui.mesh.approval.org_limited",{org:t.org}):h("ui.mesh.approval.org_any")),t.copiesCredential===!1&&s.push(h("ui.mesh.approval.not_copied",{device:n}))),t.untilRevoked&&s.push(h("ui.mesh.approval.until_revoked")),s.push(t.futureLogins?h("ui.mesh.approval.future_logins_covered"):h("ui.mesh.approval.future_logins_not_shared")),s.push(t.installsOrJoins?h("ui.mesh.approval.installs_something"):h("ui.mesh.approval.installs_nothing")),t.requiresCapability==="broker_credential"&&s.push(h("ui.mesh.approval.needs_broker",{device:n})),t.withdrawalCount>0&&s.push(h("ui.mesh.approval.undoes_withdrawals",{count:t.withdrawalCount,device:n})),s}function Wut(e){return e.length===1?e[0]:h("ui.mesh.mesh_approvals.join_clauses",{clauses:e.slice(0,-1).join(", "),last:e[e.length-1]})}function Lgt(e){if(e.kind==="credential"||e.kind==="unknown")return null;const{user:t,host:n,transport:s,name:r}=e.where,i=[n?t?`${t}@${n}`:n:"",s?h("ui.mesh.mesh_approvals.via_transport",{transport:s}):"",r&&r!==n?`(${r})`:""].filter(Boolean);return i.length?i.join(" "):null}function Bgt(e){return e.kind==="credential"||e.kind==="unknown"?null:e.where.hostKeyFp||null}function jgt(e){const{surface:t,sessionId:n}=e.requestedBy,s=[t||"",n?h("ui.mesh.mesh_approvals.session_suffix",{suffix:n.slice(-6)}):""].filter(Boolean);return s.length?h("ui.mesh.mesh_approvals.asked_by",{requester:s.join(" · ")}):null}function zut(e,t){if(e.kind==="credential"||e.kind==="unknown")return[];const{connect:n,install:s,anchor:r,networkId:i,role:a,unattended:o,grants:l}=e.what,u=[];if(n&&u.push({term:"connect",clause:e.where.transport?h("ui.mesh.mesh_approvals.connect_over",{transport:e.where.transport}):h("ui.mesh.mesh_approvals.connect_to_it"),consequence:e.where.transport?h("ui.mesh.mesh_approvals.may_connect_over",{transport:e.where.transport}):h("ui.mesh.mesh_approvals.this_machine_may_connect_to_it")}),s&&u.push({term:"install",clause:e.kind==="machine"?h("ui.mesh.mesh_approvals.install_local_operator"):h("ui.mesh.mesh_approvals.install_local_operator_there"),consequence:e.kind==="machine"?h("ui.mesh.mesh_approvals.local_operator_is_installed_on_this_machine"):h("ui.mesh.mesh_approvals.local_operator_is_installed_on_it")}),r&&u.push({term:h("ui.mesh.mesh_approvals.install_operator_anchor"),clause:h("ui.mesh.mesh_approvals.check_approvals_signed_on_your_machines"),consequence:h("ui.mesh.mesh_approvals.that_device_can_check_approvals_signed_on")}),i){const d=t?.get(i),f=h("ui.mesh.mesh_approvals.join_network",{network:d||i,role:a||"?"});u.push({term:f,clause:f,consequence:h("ui.mesh.mesh_approvals.joins_network",{network:d||i,role:a||"?"})})}o&&u.push({term:h("ui.mesh.mesh_approvals.trust_unattended_sessions"),clause:h("ui.mesh.mesh_approvals.run_sessions_there_without_an_approval_prompt"),consequence:h("ui.mesh.mesh_approvals.sessions_you_start_on_that_device_run")});for(const d of $ut(l,o)){const f=qut()[d];u.push({term:f?.term??h("ui.mesh.mesh_approvals.grant_capability",{grant:d}),clause:Kut()[d]??h("ui.mesh.mesh_approvals.use_capability",{grant:d}),consequence:f?.gloss??h("ui.mesh.mesh_approvals.may_use_capability",{grant:d})})}return u}function $ut(e,t){const n=new Set;for(const s of e){const r=String(s??"").trim();r&&(t&&r==="unattended"||n.add(r))}return[...n]}const qut=()=>({unattended:{term:h("ui.mesh.mesh_approvals.trust_unattended_sessions"),gloss:h("ui.mesh.mesh_approvals.sessions_you_start_on_that_device_run")},broker_credential:{term:h("ui.mesh.mesh_approvals.borrow_logins_there"),gloss:h("ui.mesh.mesh_approvals.your_sessions_may_use_the_logins_stored")}}),Kut=()=>({list:h("ui.mesh.mesh_approvals.see_its_sessions"),view:h("ui.mesh.mesh_approvals.watch_a_session_there"),prompt:h("ui.mesh.mesh_approvals.send_prompts_to_a_session_there"),steer:h("ui.mesh.mesh_approvals.steer_a_running_turn_there"),stop:h("ui.mesh.mesh_approvals.stop_a_session_there"),slash:h("ui.mesh.mesh_approvals.run_slash_commands_there"),delete:h("ui.mesh.mesh_approvals.archive_or_delete_a_session_there"),move:h("ui.mesh.mesh_approvals.move_sessions_to_or_from_there"),broker_credential:h("ui.mesh.mesh_approvals.borrow_the_logins_stored_there"),approve:h("ui.mesh.mesh_approvals.answer_approval_prompts_there"),unattended:h("ui.mesh.mesh_approvals.run_sessions_there_without_an_approval_prompt")});function Hgt(e){return e.kind==="profile"?e.profile!==void 0&&(e.state==="approved"||e.state==="failed"):e.kind==="credential"&&e.typed!==void 0&&(e.state==="approved"||e.state==="failed")}function Ugt(e,t){return e.kind==="credential"&&(e.state==="approved"||e.state==="failed")&&(t??e.typed?.applyOutcome?.retryable)===!1}function Ggt(e,t,n=!1){if(e===null||e<=t||e<=0)return null;const s=Math.ceil((e-t)/60),r=e-t<60?h("ui.mesh.approval.duration_under_minute"):s<90?h("ui.mesh.approval.duration_minutes",{count:s}):h("ui.mesh.approval.duration_hours",{count:Math.ceil(s/60)});return h(n?"ui.mesh.approval.expires_window":"ui.mesh.approval.answer_window",{duration:r})}function Vgt(e){const t=e.typed?.disclosure;if(!t)return"";const n=Vut(e),s=h("ui.mesh.approval.until_revoked"),r=h(t.futureLogins?"ui.mesh.approval.future_logins_covered":"ui.mesh.approval.future_logins_not_shared");return n.filter((i,a)=>a===0||i===s||i===r).join(" · ")}function RQ(e,{poll:t=!0}={}){return Mn({queryKey:CQ.approvals,enabled:e,queryFn:async()=>Hut(await et({op:"approvals.list"})),retry:!1,staleTime:t?1e4:Number.POSITIVE_INFINITY,refetchInterval:e&&t?Aut:!1,refetchOnWindowFocus:t})}function Yut(){return{retry:!1,mutationFn:async e=>{const t=await et(e.request);if(e.request.op==="approvals.approveCredential"){const n=Xut(t);if(n)throw n}}}}function Wgt(){const e=Nt();return pn({...Yut(),onSettled:()=>{e.invalidateQueries({queryKey:CQ.approvals}),e.invalidateQueries({queryKey:Mc.networks}),e.invalidateQueries({queryKey:Mc.peers})}})}function zgt(e){const t=e?.message;return typeof t=="string"&&t.trim()?t.trim():h("ui.mesh.mesh_approvals.the_approvals_could_not_be_read")}function $gt(e){const t=e,n=EQ(t?.applyOutcome??(Gr(t?.detail)?t.detail.apply_outcome:void 0)),s=n?[n.reason,n.remedy].filter(Boolean).join(" "):"";return{code:n?.code||rn(t?.code)||"approval_refused",sentence:s||rn(t?.message)||h("ui.mesh.mesh_approvals.decision_could_not_be_answered"),retryable:n?n.retryable===!0:void 0}}function Xut(e){const t=Gr(e)?e.applied:void 0;return!Gr(t)||t.ok!==!1?null:{code:rn(t.code),message:rn(t.message),applyOutcome:t}}const Qut=/(\{request\}|\{reason\})/;function qgt(e,t){return h("ui.mesh.approval.named_refusal",{request:"{request}",reason:"{reason}"}).split(Qut).filter(Boolean).map(n=>n==="{request}"?{kind:"request",text:e}:n==="{reason}"?{kind:"reason",text:t}:{kind:"literal",text:n})}function Kgt(e,t,n=!1){return e==="request"&&!n?t:"auto"}function Ygt({document:e,target:t,refusalTarget:n,origin:s,allowFocus:r,sentence:i}){r&&(e.activeElement===e.body||e.activeElement===s)&&t?.focus({preventScroll:!0});const a=n!==null&&e.activeElement===n;return{focused:a,announcement:a?"":i}}function Jut(){const e=zn(),t=vt(e.data,"aida",1),n=Yh(t),s=t&&n.data?.enabled===!0,r=wQ(n.data?.session_id),i=vt(e.data,"notifications",1),a=eU(i),o=yQ(),l=fC(Sr(e.data,"peers")==="enabled"),u=RQ(l==="member"&&Sr(e.data,"approvals")==="enabled",{poll:!0}),d=s?r:0,f=i?tU(a.data):0,p=l==="member"?SQ(u.data??[]):0,g=[];return d>0&&g.push(h("ui.shell.sidebar_navigation.aida_missed",{name:n.data?.name??"Aida",count:d})),f>0&&g.push(h("ui.notifications.nav.unread",{count:f,countText:String(f)})),o>0&&g.push(h("ui.shell.sidebar_navigation.browser_waiting",{count:o,countText:String(o)})),p>0&&g.push(h("ui.shell.sidebar_navigation.mesh_waiting",{count:p,countText:String(p)})),{total:d+f+o+p,lines:g}}function Zut(e){const t=typeof e=="object"&&e!==null?e.idx:void 0;return typeof t=="number"&&t>0?"history":"/chat"}const edt=()=>{Ve();const e=si(),t=Py()==="rtl"?By:yG,[n,s]=m.useState(!1),{total:r,lines:i}=Jut(),a=Wx("back",Ble.test(navigator.platform)),o=r>0?h("ui.teamBridge.leave.name_attention",{count:r}):h("ui.teamBridge.leave.name"),l=m.useCallback(()=>{Zut(window.history.state)==="history"?e(-1):e("/chat")},[e]);return m.useEffect(()=>{const u=f=>{oU(f)==="back"&&(f.preventDefault(),l())},d=f=>{lU(f)==="back"&&(f.preventDefault(),l())};return document.addEventListener("keydown",u),document.addEventListener("mouseup",d),()=>{document.removeEventListener("keydown",u),document.removeEventListener("mouseup",d)}},[l]),c.jsx("div",{"data-team-bridge-back-row":"",className:R("flex h-10 shrink-0 items-center",mQ),children:c.jsx(Iu,{content:c.jsxs("span",{className:"flex flex-col",children:[c.jsx("span",{children:c.jsx(Vo,{text:h("ui.teamBridge.leave.back_shortcut",{shortcut:ji(a)})})}),i.map(u=>c.jsx("span",{children:u},u))]}),side:"bottom",align:"start",collisionPadding:8,suppressed:n,discardWhileSuppressed:!0,children:c.jsxs("button",{type:"button","data-team-bridge-back":"",onFocus:u=>{u.currentTarget.hasAttribute("data-focus-handoff")&&(u.currentTarget.removeAttribute("data-focus-handoff"),s(!0))},onBlur:()=>s(!1),onPointerEnter:()=>s(!1),onKeyDown:()=>s(!1),onClick:l,"aria-label":o,"aria-keyshortcuts":a,className:R("inline-flex h-8 items-center gap-1.5 rounded-sm px-2 text-body-sm font-medium text-ink-muted","transition-colors duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink"),children:[c.jsx(t,{size:16,"aria-hidden":"true"}),c.jsx("span",{children:h("ui.teamBridge.leave.back")}),c.jsx(ep,{count:r,"aria-hidden":"true",className:"ms-1"})]})})})},tdt=({children:e,inline:t})=>c.jsxs(Koe,{fallback:t,children:[c.jsx(edt,{}),e,c.jsx(xQ,{})]}),ndt=()=>(Ve(),c.jsxs(tdt,{inline:null,children:[c.jsx("h1",{className:"flex h-10 shrink-0 items-center px-4 text-body-sm font-semibold text-ink",children:h("ui.teamBridge.page.title")}),c.jsx("div",{className:"min-h-0 flex-1"})]})),sdt=140,rdt=/^\s*(```|~~~).*$/gm,idt=/^\s{0,3}#{1,6}\s+/gm,adt=/^\s{0,3}(>\s?)+/gm,odt=/^\s*([-*+]|\d{1,9}[.)])\s+/gm,ldt=/^\[[ xX]\]\s+/gm,cdt=/^\s{0,3}([-*_])(\s*\1){2,}\s*$/gm,udt=/!\[([^\]]*)\]\([^)]*\)/g,ddt=/\[([^\]]+)\]\([^)]*\)/g,hdt=/<((?:https?|mailto):[^>\s]+)>/gi,fdt=/<\/?[A-Za-z][^>]*>/g,pdt=/`+([^`]*)`+/g,gdt=/(\*\*|__)(?=\S)([\s\S]*?\S)\1/g,mdt=/~~(?=\S)([\s\S]*?\S)~~/g,vdt=/(^|[^\w*])\*(?=\S)([^*]*?\S)\*(?!\w)/g,bdt=/(^|[^\w])_(?=\S)([^_]*?\S)_(?!\w)/g;function _dt(e,t=sdt){if(typeof e!="string"||e.trim().length===0)return null;const n=e.replace(rdt," ").replace(cdt," ").replace(idt,"").replace(adt,"").replace(odt,"").replace(ldt,"").replace(udt,"$1").replace(ddt,"$1").replace(hdt,"$1").replace(fdt,"").replace(pdt,"$1").replace(gdt,"$2").replace(mdt,"$1").replace(vdt,"$1$2").replace(bdt,"$1$2"),s=Op(n,Number.MAX_SAFE_INTEGER);return s.length===0?null:FX(s,t)}function xdt(e,t){const n=e.senderLabel?.trim()||e.conversationName?.trim()||t.untitled,s=e.place.kind==="dm"?t.directMessage:e.place.kind==="channel"?e.place.name?.trim()?t.channel(e.place.name.trim()):e.conversationName?.trim()??t.untitled:e.place.name?.trim()||e.conversationName?.trim()||t.group,r=e.organizationName?t.subtitle(s,e.organizationName):s,i=Math.max(1,Math.floor(e.unreadCount)),a=i>1?e.preview?t.countPreview(i,e.preview):t.count(i):e.preview??t.fallback;return{title:Op(n,Gv)||t.untitled,subtitle:Op(r,Pit)||t.untitled,body:Op(a,Nit)||t.fallback}}const Tm=3e4,wdt=10;function ydt(e,t=wdt){return[...e?.organizations??[]].filter(n=>n.eligible&&n.unread>0).sort((n,s)=>s.unread-n.unread||n.tenant_id.localeCompare(s.tenant_id)).slice(0,t)}function Cdt(e,t){return e.member===!0?!0:e.member===!1||!t?!1:e.members.some(n=>n.kind==="human"&&n.account_id===t&&n.state==="active")}function AQ(e,t){return Cdt(e,t)&&L8(e)==="all"&&e.builtin!=="agents"}function Sdt(e,t,n){return{conversationName:v2(e,t),organizationName:G8(e,n),senderLabel:m2(e.last_sender_label??"")}}function kdt(e){const t=new Map(e.cursors),n=e.rows;if(!e.seeded){for(const a of n)t.set(a.conversation_id,a.latest_seq);return{candidates:[],cursors:t,seeded:!0}}const r=new Map(e.conversations.map(a=>[a.id,a])),i=[];for(const a of n){const o=t.get(a.conversation_id);if(a.unread_count===0||a.latest_seq<=a.last_read_seq||o!==void 0&&a.latest_seq<=o){(o===void 0||a.latest_seq>o)&&t.set(a.conversation_id,a.latest_seq);continue}const l=r.get(a.conversation_id);l!==void 0&&l.latest_seq===a.latest_seq&&(t.set(a.conversation_id,a.latest_seq),AQ(l,e.selfAccountId)&&(e.quiet||i.push({conversationId:l.id,...l.last_thread_root_id?{threadId:l.last_thread_root_id}:{},tenantId:a.tenant_id,seq:a.latest_seq,...Sdt(l,e.selfAccountId,e.organizations),kind:l.kind,name:l.name?.trim()||null,unreadCount:a.unread_count})))}return{candidates:i,cursors:t,seeded:!0}}function OI(e,t,n,s){return e.getMutationCache().findAll({mutationKey:Ut.notifyMutation(t.accountId,t.epoch),exact:!0,status:"pending"}).some(r=>{const i=r.state.variables;return i?.conversationId===n&&(i.tenantId===void 0||i.tenantId===s)})}function Edt(e,t,n,s,r){return new Promise(i=>{const a=()=>{l(),r.removeEventListener("abort",a),i()},o=()=>{(r.aborted||!OI(e,t,n,s))&&a()},l=e.getMutationCache().subscribe(o);r.addEventListener("abort",a,{once:!0}),o()})}function Xgt(e){const t=e.get("tenant"),n=e.get("conversation"),s=e.get("thread");return t&&n&&s?{tenantId:t,conversationId:n,rootId:s}:null}function FQ(e,t){if(e.root.id!==t.rootId||e.root.conversation_id!==t.conversationId||e.root.thread_root_id||e.replies.some(n=>n.conversation_id!==t.conversationId||n.thread_root_id!==t.rootId))throw new Error("Thread response identity mismatch");return e}async function Qgt(e,t,n,s){return FQ(await Xn.listReplies(e.conversationId,e.rootId,{tenantId:e.tenantId,accountId:t,afterSeq:n,...s?{limit:50,...s}:{}}),e)}function Jgt(e,t,n){if(typeof IntersectionObserver>"u")return()=>{};const s=new Map(t.map(d=>[d.id,d.seq])),r=new Map,i=e.ownerDocument;let a=!0,o=-1;const l=()=>{if(!a||!e.isConnected||i.visibilityState!=="visible"||!i.hasFocus())return;const d=Math.max(-1,...r.values());d<=o||(o=d,n(d).catch(()=>{a&&o===d&&(o=-1)}))},u=new IntersectionObserver(d=>{if(a){for(const f of d){const p=f.target.dataset.messageId??"",g=s.get(p);g!==void 0&&f.isIntersecting&&f.intersectionRect.height>0?r.set(p,g):r.delete(p)}l()}},{root:e.querySelector("[data-radix-scroll-area-viewport]"),threshold:0});for(const d of e.querySelectorAll("[data-message-id]"))s.has(d.dataset.messageId??"")&&u.observe(d);return i.addEventListener("visibilitychange",l),i.defaultView?.addEventListener("focus",l),()=>{a=!1,u.disconnect(),i.removeEventListener("visibilitychange",l),i.defaultView?.removeEventListener("focus",l)}}let Tx=null;function Tdt(){return Tx}function Zgt(e){m.useEffect(()=>{const t=e??null;return Tx=t,()=>{Tx===t&&(Tx=null)}},[e])}const Rdt="display.notifications";function Adt(){return{untitled:h("ui.teamBridge.list.untitled"),directMessage:h("ui.teamBridge.kind.dm"),group:h("ui.teamBridge.kind.group"),channel:e=>h("ui.teamBridge.notify.channel",{channel:e}),subtitle:(e,t)=>h("ui.teamBridge.notify.subtitle",{place:e,organization:t}),count:e=>h("ui.teamBridge.notify.count",{count:e}),countPreview:(e,t)=>h("ui.teamBridge.notify.count_preview",{count:e,preview:t}),fallback:h("ui.teamBridge.notify.body_fallback")}}function Fdt(e){return e.kind==="dm"?{kind:"dm"}:{kind:e.kind,name:e.name}}function Ddt(e,t){return crt(e,t==="person_agent"?"agent":"human")}function IA(e,t){const n=pX(Ddt(e,t)).src,s=n?.type==="account"?n:null,r=n?.type==="endpoint"?n:null;return Hit({v:1,kind:t,account_id:e.account_id,display_name:Op(e.display_label,Gv),agent_name:Op(e.agent?.name??"",Gv),...s?{avatar:{account_id:s.accountId,hash:s.hash}}:{},...r?{endpoint_avatar:{endpoint_id:r.endpointId,hash:r.hash}}:{}})}function Idt(e,t,n){return e.getQueryData(Ut.directory(t,n))?.members??[]}function Ndt(e,t,n,s){const r=Ut.replies(t.tenantId,t.conversationId,n);e.setQueryData(r,i=>{const a=i?.pages.at(-1);return!i||!a||a.has_more||i.pages.some(o=>o.replies.some(l=>l.id===s.id))?i:{...i,pages:[...i.pages.slice(0,-1),{...a,replies:[...a.replies,s].sort((o,l)=>o.seq-l.seq)}]}})}function Pdt(e,t,n,s){return{...hI(e,t,n,s),staleTime:0}}async function Mdt(e,t,n,s,r){if(!s())return;let i=t.senderLabel,a,o=null,l;const u=ni(e);if(u.accountId!==n)return;const d={accountId:n,epoch:u.epoch},f=t.threadId;try{let b;if(f)b=FQ(await Xn.listReplies(t.conversationId,f,{tenantId:t.tenantId,accountId:n,afterSeq:t.seq,limit:1}),{tenantId:t.tenantId,conversationId:t.conversationId,rootId:f}).replies.find(_=>_.seq===t.seq),b&&s()&&Ndt(e,t,f,b);else{const _=()=>e.fetchQuery(Pdt(e,t.conversationId,t.tenantId,n));b=(await _().catch(w=>{if(!qee(w))throw w;return _()})).messages.reduce((w,y)=>w===void 0||y.seq>w.seq?y:w,void 0)}if(b&&b.seq>=t.seq){if(f||(l=b.id),b.sender.kind==="human"&&b.sender.account_id===n||!s())return;const _=Idt(e,t.tenantId,n);i=Xoe(b.sender,_,{named:(w,y)=>h("ui.teamBridge.chief.label",{agent:w,person:y}),unnamed:w=>h("ui.teamBridge.chief.unnamed",{person:w})});const x=_.find(w=>w.account_id===b.sender.account_id);x&&(b.sender.kind==="human"||b.sender.kind==="agent")&&(a=IA(x,b.sender.kind==="human"?"person":"person_agent")),o=_dt(b.body)}}catch{}const p=window.api?.desktop?.teamBridge;if(!p)return;const g=xdt({senderLabel:i,conversationName:t.conversationName,place:Fdt(t),organizationName:t.organizationName,preview:o,unreadCount:t.unreadCount},Adt());for(;OI(e,d,t.conversationId,t.tenantId);)if(await Edt(e,d,t.conversationId,t.tenantId,r),r.aborted||!s())return;if(r.aborted||!s())return;const v=e.getQueryData(Ut.conversations(Pc,n))?.conversations.find(b=>b.id===t.conversationId&&b.tenant_id===t.tenantId);!v||!AQ(v,n)||await p.notify({owner:{accountId:n,epoch:d.epoch},conversationId:t.conversationId,...f?{threadId:f}:{},...l?{messageId:l}:{},tenantId:t.tenantId,...a?{sender:a}:{},seq:t.seq,title:g.title,subtitle:g.subtitle,body:g.body,viewing:Tdt()===t.conversationId}).catch(()=>{})}function Odt(e,t,n,s,r){nrt(e,t,n,s);for(const i of s){const a=`${n}\0${i.conversation_id}`,o=r.get(a);if(r.set(a,i.latest_seq),o===void 0||i.latest_seq<=o)continue;const l=hI(e,i.conversation_id,n,t);e.getQueryState(l.queryKey)?.data!==void 0&&e.fetchQuery({...l,staleTime:0}).catch(()=>{})}}function Ldt(e){const t=!!window.api?.desktop?.teamBridge,n=KC(),s=fI(e&&t),r=n.accountId,a=e&&t&&!!r&&s.data?.account_id===r&&s.data?.state==="ready"&&s.data.local.enabled&&!s.data.read_only,o=Nt(),l=Wle({filters:{mutationKey:Ut.notifyMutation(r,n.epoch),exact:!0,status:"pending"},select:B=>B.mutationId});m.useLayoutEffect(()=>{const B=window.api?.desktop?.teamBridge;if(!B?.setAuthority)return;const G=()=>{B.setAuthority({...ni(o),settling:_2(o)}).catch(()=>{})},H=b2(o,G);return G(),H},[o]);const u=nI({enabled:a}),d=zn(),f=vt(d.data,"settings"),p=Mn({...HH(),enabled:a&&f}),g=f&&Yoe(p.data?.settings,Rdt)===!1,v=m.useRef(g);v.current=g;const b=m.useRef(r);b.current=r;const _=m.useRef(a);_.current=a;const x=m.useRef(new AbortController);m.useEffect(()=>{const B=new AbortController;return x.current=B,(!a||g||n.token!==hp(o))&&B.abort(),()=>B.abort()},[a,g,n.token,o]),m.useEffect(()=>(_.current=a,()=>{_.current=!1}),[a]);const w=u.data,y=EX(a,Pc,{accountId:r,refetchInterval:Tm,refetchIntervalInBackground:!0}),S=m.useMemo(()=>ydt(y.data),[y.data]),C=cU({queries:S.map(B=>{const G=GE(B.tenant_id);return{queryKey:Ut.unread(G,r??"unresolved-owner"),queryFn:()=>Ul(o,r,()=>Xn.unread({tenantId:G})),enabled:a,staleTime:Tm,refetchInterval:Tm,refetchIntervalInBackground:!0,refetchOnWindowFocus:!0,retry:1}})}),k=C.map(B=>`${B.status}:${B.dataUpdatedAt}`).join("|"),T=m.useRef(C);T.current=C;const A=m.useRef(S);A.current=S;const I=kX(S.map(B=>GE(B.tenant_id)),a,r).members,N={};for(const[B,G]of Object.entries(I))N[B]=G.filter(H=>H.account_id!==r).flatMap(H=>[IA(H,"person"),...H.agent?.name?[IA(H,"person_agent")]:[]]).filter(H=>H!==void 0);const P=JSON.stringify(N),O=m.useRef(N);O.current=N;const j=m.useRef(null),M=m.useRef(new Set),X=Mn({queryKey:Ut.conversations(Pc,r??"unresolved-owner"),queryFn:()=>Ul(o,r,()=>Xn.listConversations("account")),enabled:a,staleTime:Tm,refetchInterval:Tm,refetchIntervalInBackground:!0,refetchOnWindowFocus:!0,retry:1}),se=m.useRef(new Map),ee=m.useRef(new Map),q=m.useRef(new Set),ne=m.useRef(void 0),te=m.useRef(null),L=[a,g,l.join(","),k,y.dataUpdatedAt,X.dataUpdatedAt,(w?.memberships??[]).map(B=>`${B.tenant_id}:${B.tenant_name}`).join(","),r??""].join("#");m.useEffect(()=>{if(j.current===P)return;j.current=P;const B=window.api?.desktop?.teamBridge;if(!B?.syncDirectory)return;const G=O.current;for(const H of M.current)H in G||B.syncDirectory({tenantId:H,members:[]}).catch(()=>{});M.current=new Set(Object.keys(G));for(const[H,W]of Object.entries(G))B.syncDirectory({tenantId:H,members:W}).catch(()=>{})},[P]),m.useEffect(()=>{const B=ne.current;ne.current=r,B!==r&&B!==void 0&&(se.current=new Map,ee.current=new Map,q.current=new Set,te.current=null,o.invalidateQueries({queryKey:Ut.unreadPrefix}),o.invalidateQueries({queryKey:Ut.conversationsPrefix}))},[r,o]),m.useEffect(()=>{if(te.current===L||(te.current=L,!y.data))return;for(const de of y.data.organizations??[])de.unread===0&&!q.current.has(de.tenant_id)&&q.current.add(de.tenant_id);if(!X.data)return;const B=T.current,G=A.current,H=V8(w?.memberships??[],y.data.organizations,y.data.organizations??null);let W=se.current;for(let de=0;de<G.length;de+=1){const J=G[de],Re=B[de]?.data;if(!Re)continue;const le=(Re.conversations??[]).map(Se=>({conversation_id:Se.conversation_id,tenant_id:J.tenant_id,unread_count:Se.unread_count,last_read_seq:Se.last_read_seq,latest_seq:Se.latest_seq}));r&&Odt(o,r,J.tenant_id,Re.conversations??[],ee.current);const ge=q.current.has(J.tenant_id),U=ni(o),we=le.filter(Se=>!ge||!_.current||v.current||!U.accountId||U.accountId!==r?!0:!OI(o,{accountId:U.accountId,epoch:U.epoch},Se.conversation_id,Se.tenant_id)),Ee=kdt({conversations:X.data.conversations,rows:we,organizations:H,selfAccountId:r,cursors:W,seeded:ge,quiet:!a||g});if(W=Ee.cursors,Ee.seeded&&q.current.add(J.tenant_id),!a||g||!r)continue;const Ie=r,pe=hp(o),be=aX(o,Ie);for(const Se of Ee.candidates)Mdt(o,Se,Ie,()=>b.current===Ie&&hp(o)===pe&&be()&&_.current&&!v.current&&Hc(o,Ie),x.current.signal)}se.current=W},[L,a,g,y.data,X.data,w,r,o])}function Bdt(){const{data:e}=zn();m.useEffect(()=>{e&&xJ(e)},[e]);const t=h2(),n=Nt(),s=m.useRef(null);m.useEffect(()=>{const r=t.configChange;if(!r)return;const i=`${r.epoch}:${r.seq}`;s.current!==i&&r.changedKeys.includes(Tl)&&(s.current=i,n.invalidateQueries({queryKey:Yo.capabilities}),n.invalidateQueries({queryKey:Yo.settings}),!Qoe()&&Da(h("ui.settings.language.external_notice",{language:r.language}),{id:"i18n-language-external"}))},[t.configChange,n])}function jdt(e,t){if(e.defaultPrevented||e.repeat||e.isComposing||!(e.metaKey||e.ctrlKey))return null;const n=C2(e);if(n===null)return null;const s=Kee(t.bindings).get(n);return s===void 0||VA(e.target)||!pbe(DQ(s),t.route)?null:s}const DQ=e=>e.slice(6);function Hdt(e){const t=Ne.getState(),n=t.activeDraftKey?t.drafts[t.activeDraftKey]:void 0,s=Qv(t.activeDraftKey,n?.sessionId,t.activeSessionId)??null;Xd(DQ(e),{sessionId:s,askScope:s===null?"fleet":"session",via:"chord"})}function Udt(){m.useEffect(()=>{const e=t=>{const n=tt.getState(),s=jdt(t,{bindings:n.shortcutBindings,route:n.rightSlotRoute});s!==null&&(t.preventDefault(),Hdt(s))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[])}function Gdt(e,t){const n=_g(),s=m.useRef(!1);m.useEffect(()=>{s.current||!e||!n.accountId||window.__loDevDriver?.armed!==!0||window.__loDevDriver.startupScene!=="team-bridge-owner-audit"||(s.current=!0,t("/team-bridge"))},[e,n.accountId,t])}const Vdt=""+new URL("radient-icon-1024x1024-D_JJedvo.png",import.meta.url).href,IQ=fg()(rH(e=>({hasBeenNotified:!1,setHasBeenNotified:t=>{e({hasBeenNotified:t})}}),{name:"low-credits-storage"})),Wdt=({open:e,onClose:t,onGoToConsole:n})=>{Ve();const{setHasBeenNotified:s}=IQ(),{prices:r,isLoading:i,error:a}=Joe(),o=d=>typeof d!="number"?"$...":h("ui.common.account.low_credits_dialog.detail",{detail:String(d.toFixed(2))}),l=()=>{s(!0),t()},u=()=>{s(!0),n()};return c.jsx(Wl,{open:e,onClose:l,title:c.jsxs(c.Fragment,{children:[c.jsx("img",{src:Vdt,alt:h("ui.common.account.low_credits_dialog.radient_icon"),className:"size-7"}),h("ui.common.account.low_credits_dialog.running_low_on_radient_credits")]}),maxWidth:"sm",fullWidth:!1,actions:c.jsxs(c.Fragment,{children:[c.jsx(tb,{onClick:l,children:h("ui.common.account.low_credits_dialog.maybe_later")}),c.jsx(nb,{onClick:u,startIcon:c.jsx(Nu,{size:18}),className:"min-w-55",children:h("ui.common.account.low_credits_dialog.get_more_credits")})]}),children:c.jsxs("div",{className:"flex flex-col items-center gap-4 py-2 text-center",children:[c.jsxs("p",{className:"text-body-sm text-ink-muted",children:[h("ui.common.account.low_credits_dialog.unlock_the_full_power_of_local_operator_with")," ",c.jsx("span",{className:"font-bold text-accent",children:h("ui.common.account.low_credits_dialog.radient_pass")}),"."]}),c.jsx("p",{className:"text-body-sm text-ink-muted",children:h("ui.common.account.low_credits_dialog.radient_automatic_is_often_cheaper_than_bringing_your_own_key_its")}),c.jsx("p",{className:"text-body-sm text-ink-muted",children:h("ui.common.account.low_credits_dialog.it_s_pay_as_you_go_with_no_commitments_load_up_what_you_need_star")}),c.jsxs("p",{className:"text-body-sm text-ink-muted",children:[h("ui.common.account.low_credits_dialog.plus_get")," ",c.jsx("span",{className:"font-medium text-ink",children:i?c.jsx(Pn,{size:"sm",className:"me-0.5 align-middle"}):o(r?.default_registration_credits)})," ",h("ui.common.account.low_credits_dialog.in_bonus_credits_with_your_first_purchase"),a&&c.jsx("span",{className:"mt-1 block text-meta text-danger",children:h("ui.common.account.low_credits_dialog.could_not_load_bonus_credit_information")})]}),c.jsx("p",{className:"text-meta text-ink-dim",children:h("ui.common.account.low_credits_dialog.you_can_also_reach_the_radient_console_from_settings_at_any_time")})]})})},zdt=(e,t)=>t?e.some(n=>n.session_id===t&&n.status?.code==="busy"):!1;function $dt(e){return Ne(t=>zdt(t.sessions,e))}const NA={aida:"visible",notifications:"visible",library:"visible",projects:"visible",agents:"visible",schedules:"more",browser:"visible","team-bridge":"more","agent-hub":"more",mesh:"more"},wy=["aida","notifications","library","projects","agents","schedules","browser","team-bridge","agent-hub","mesh"],yy={visible:wy.filter(e=>NA[e]==="visible"),more:wy.filter(e=>NA[e]==="more")},B5=new Map(wy.map((e,t)=>[e,t])),qdt=new Map([["notifications","notifications"]]);function Kdt(e,t){const n=s=>{const r=qdt.get(s);return r===void 0||t(r)};return{visible:e.visible.filter(n),more:e.more.filter(n)}}const Ydt=new Set(Yee);function Xdt(e){return typeof e=="string"&&Ydt.has(e)}function bE(e,t){if(e===t)return!0;if(e.visible.length!==t.visible.length||e.more.length!==t.more.length)return!1;for(let n=0;n<e.visible.length;n+=1)if(e.visible[n]!==t.visible[n])return!1;for(let n=0;n<e.more.length;n+=1)if(e.more[n]!==t.more[n])return!1;return!0}function Po(e,t){return e.visible.includes(t)?"visible":"more"}function Rx(e,t,n){return e[t].filter(s=>n.has(s))}function Qdt(e,t,n,s){if(!s.has(t))return null;const r=Po(e,t),i=Rx(e,r,s),a=i.indexOf(t);if(a<0)return null;const o=a+n;if(o<0||o>=i.length)return null;const l=i[o],u=e[r],d=u.indexOf(t),f=u.indexOf(l);if(d<0||f<0)return null;const p=u.slice();p[d]=l,p[f]=t;const g={visible:e.visible.slice(),more:e.more.slice()};return g[r]=p,g}function j5(e,t,n){const s={visible:e.visible.filter(r=>r!==t),more:e.more.filter(r=>r!==t)};return{...s,[n]:[...s[n],t]}}function Jdt(e,t,n,s,r){if(s===t)return{visible:e.visible.slice(),more:e.more.slice()};if(s!==null&&(!r.has(s)||!e[n].includes(s)))return null;const i={visible:e.visible.filter(l=>l!==t),more:e.more.filter(l=>l!==t)},a=i[n].slice(),o=s===null?a.length:a.indexOf(s);return o<0?null:(a.splice(o,0,t),{...i,[n]:a})}function H5(e,t){for(const n of wy){if(NA[n]!==t||e.visible.includes(n)||e.more.includes(n))continue;const s=B5.get(n)??0,r=e[t];let i=-1,a=-1,o=-1,l=Number.POSITIVE_INFINITY;for(let d=0;d<r.length;d+=1){const f=B5.get(r[d])??0;f<s&&f>a&&(a=f,i=d),f>s&&f<l&&(l=f,o=d)}const u=i>=0?i+1:o>=0?o:r.length;r.splice(u,0,n)}}function PA(e){const t={visible:[],more:[]},n=new Set;if(e&&typeof e=="object"){const s=e;for(const r of["visible","more"]){const i=s[r];if(Array.isArray(i))for(const a of i)Xdt(a)&&(n.has(a)||(n.add(a),t[r].push(a)))}}return H5(t,"visible"),H5(t,"more"),t}function Zdt(e){return e.reduce((t,n)=>{const s=n.attention??0;return Number.isFinite(s)&&s>0?t+s:t},0)}const jf={layout:["desktop","sidebar_layout"]};async function eht(){const e=await et({op:"sidebar_layout.get"});return PA(e.layout)}function tht(e,t=()=>!1){const n=Nt(),s=Mn({queryKey:jf.layout,enabled:e,queryFn:eht,staleTime:Number.POSITIVE_INFINITY,retry:Kv}),r=m.useRef(0),i=pn({scope:{id:"sidebar-layout"},mutationFn:async d=>{const f=await et({op:"sidebar_layout.set",layout:Kdt(d,t)});return PA(f.layout)},retry:Xee,onMutate:async d=>{const f=++r.current;await n.cancelQueries({queryKey:jf.layout});const p=n.getQueryData(jf.layout);return n.setQueryData(jf.layout,d),{previous:p,seq:f}},onError:(d,f,p)=>{p?.seq===r.current&&p.previous&&n.setQueryData(jf.layout,p.previous),fn(h("ui.shell.sidebar_navigation.save_failed"))},onSettled:(d,f,p,g)=>{g?.seq===r.current&&n.invalidateQueries({queryKey:jf.layout})}}),a=e&&s.data!==void 0;return{layout:a?s.data:yy,canCustomise:a,save:d=>{a&&i.mutate(d)},reset:()=>{a&&i.mutate(PA(yy))}}}const U5=({expanded:e})=>(Ve(),c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(GH,{className:"size-6",label:e?void 0:h("ui.shell.collapsible_app_logo.local_operator")}),e&&c.jsx("span",{className:"truncate font-semibold text-body text-ink",children:h("ui.shell.collapsible_app_logo.local_operator")})]})),NQ=()=>{const e=h2(),t=zn(),n=Ne(u=>u.setCataloguePageable),s=Ne(u=>u.setCatalogueActivityHead),r=Ne(u=>u.fetchSessions),i=vt(t.data,"session_catalogue_page"),a=vt(t.data,"session_catalogue_sort");m.useEffect(()=>{n(i)},[i,n]),m.useEffect(()=>{s(a)},[a,s]);const o=Sr(t.data,"session_catalogue",2)==="enabled",l=m.useCallback(()=>r(i?mH:Sy,i),[r,i]);return m.useEffect(()=>{o&&l()},[o,l,e.catalogueRevision]),null},G5="flex h-[30px] w-full items-center gap-2 rounded-md px-2 text-body-sm transition-colors duration-fast ease-out-quart",nht=()=>{Ve();const e=Py()==="rtl",t=si(),n=i9(),{expanded:s,onCollapse:r}=Zoe(),i=tt(oe=>oe.openCommandPalette),a=zn(),o=Ait(vt(a.data,"team_bridge_conversations")),l=Ne(oe=>oe.activeSessionId),u=yQ(),d=Sr(a.data,"peers")==="enabled",f=fC(d),p=Sr(a.data,"approvals")==="enabled",g=RQ(f==="member"&&p,{poll:!0}),v=SQ(g.data??[]),b=vt(a.data,"projects",1),_=vt(a.data,"library",1),x=vt(a.data,"notifications",1),w=eU(x),y=x?tU(w.data):0,S=tt(oe=>oe.sidebarOverflowExpanded),C=tt(oe=>oe.setSidebarOverflowExpanded),k=vt(a.data,"aida",1),T=Yh(k),A=k&&T.data?.enabled===!0,F=T.data?.name??"Aida",I=mme(),N=wQ(T.data?.session_id),P=$dt(T.data?.session_id),O=()=>{I(t,T.data).catch(oe=>fn(Wf(oe)))},j=new Map;A&&j.set("aida",{icon:ele,label:F,path:"/chat",isActive:n==="chat"&&!!T.data?.session_id&&l===T.data?.session_id,tourTag:"nav-item-aida",onSelect:O,attention:N,attentionTag:"nav-aida-badge",attentionName:oe=>h("ui.shell.sidebar_navigation.aida_missed",{name:F,count:oe}),working:P,workingName:h("ui.shell.sidebar_navigation.aida_working",{name:F})}),x&&j.set("notifications",{icon:SG,label:h("ui.notifications.nav.label"),path:"/notifications",isActive:n==="notifications",tourTag:"nav-item-notifications",attention:y,attentionTag:"nav-notifications-badge",attentionName:oe=>h("ui.notifications.nav.unread",{count:oe,countText:String(oe)})}),_&&j.set("library",{icon:vhe,label:h("ui.library.page.title"),path:"/library",isActive:n==="library",tourTag:"nav-item-library"}),b&&j.set("projects",{icon:TG,label:h("ui.shell.sidebar_navigation.projects"),path:"/projects",isActive:n==="projects",tourTag:"nav-item-projects"}),j.set("agents",{icon:Ll,label:h("ui.shell.sidebar_navigation.agents"),path:"/agents",isActive:n==="agents",tourTag:"nav-item-agents"}),j.set("schedules",{icon:kG,label:h("ui.shell.sidebar_navigation.schedules"),path:"/schedules",isActive:n==="schedules",tourTag:"nav-item-schedules"}),j.set("browser",{icon:Zu,label:h("ui.shell.sidebar_navigation.browser"),path:"/browser",isActive:n==="browser",tourTag:"nav-item-browser",attention:u,attentionTag:"nav-browser-badge",attentionName:oe=>h("ui.shell.sidebar_navigation.browser_waiting",{count:oe,countText:String(oe)})}),o&&j.set("team-bridge",{...o,isActive:n==="team-bridge"}),j.set("agent-hub",{icon:PG,label:h("ui.shell.sidebar_navigation.agent_hub"),path:"/agent-hub",isActive:n==="agent-hub",tourTag:"nav-item-agent-hub"}),f==="member"&&j.set("mesh",{icon:W8,label:h("ui.shell.sidebar_navigation.mesh"),path:"/mesh",isActive:n==="mesh",tourTag:"nav-item-mesh",attention:v,attentionTag:"nav-mesh-badge",attentionName:oe=>h("ui.shell.sidebar_navigation.mesh_waiting",{count:oe,countText:String(oe)})});const M=new Set(j.keys()),X=vt(a.data,"sidebar_layout",1),{layout:se,canCustomise:ee,save:q,reset:ne}=tht(X,oe=>vt(a.data,oe,1)),te=ee?se:yy,L=Rx(te,"visible",M),B=Rx(te,"more",M),[G,H]=m.useState(!1),W=S||G||B.some(oe=>j.get(oe)?.isActive),[de,J]=m.useState(""),[Re,le]=m.useState(null),ge=m.useRef(new Map),U=oe=>{requestAnimationFrame(()=>ge.current.get(oe)?.focus())},[we,Ee]=m.useState(null),[Ie,pe]=m.useState(null),be=m.useRef(null),Se=m.useRef(null),ke=m.useRef(null),me=m.useRef(0),Xe=m.useRef(0),ae=m.useRef(null),We=m.useRef(null),Je=m.useRef(!1),ce=oe=>{const he=be.current;return he===null?[]:Array.from(he.querySelectorAll("[data-sidebar-row]")).filter(De=>De.dataset.sidebarRow!==oe).map(De=>{const je=De.getBoundingClientRect();return{id:De.dataset.sidebarRow??"",top:je.top,bottom:je.bottom}})},Me=(oe,he)=>{const De=be.current;if(De===null)return null;const je=De.getBoundingClientRect(),nt=ce(he),ie=ye=>nt.filter(Fe=>Po(te,Fe.id)===ye);let xe=null;if(oe.kind==="more"){const ye=ie("more").at(-1);if(ye)xe=ye.bottom;else{const Fe=De.querySelector("[data-sidebar-more]");xe=Fe?Fe.getBoundingClientRect().bottom:je.top+2}}else if(oe.kind==="band"){const ye=Po(te,he),it=ie(ye==="more"?"visible":"more").at(-1);if(it)xe=it.bottom;else if(ye==="more"){const Ct=De.querySelector("[data-sidebar-more]");xe=Ct?Ct.getBoundingClientRect().top:je.top+2}}else{const ye=nt[oe.slot];ye?xe=ye.top:xe=nt.at(-1)?.bottom??je.top+2}return xe===null?null:Math.round(xe-je.top+De.scrollTop)},Pe=()=>{We.current!==null&&(window.clearTimeout(We.current),We.current=null)},ze=(oe,he)=>{const De=Se.current;if(De===null||!De.armed)return;const je=document.elementFromPoint(oe,he),nt=!!je?.closest("[data-sidebar-more]"),ie=!!je?.closest("[data-sidebar-drop-band]");let xe;if(nt)xe={kind:"more"},Po(te,De.id)==="visible"&&!W&&We.current===null&&(We.current=window.setTimeout(()=>{We.current=null,H(!0),requestAnimationFrame(()=>st.current(me.current,Xe.current))},400));else if(Pe(),ie)xe={kind:"band"};else{const ye=ce(De.id),Fe=wY(ye,De.id,he),it=ye[Fe];let Ct="visible";if(it)Ct=Po(te,it.id);else{const It=ye.at(-1);Ct=It?Po(te,It.id):"visible"}xe={kind:"slot",slot:Fe,beforeId:it?.id??null,region:Ct}}ke.current=xe,pe(Me(xe,De.id))},st=m.useRef(ze);st.current=ze;const _t=()=>{ae.current!==null&&(cancelAnimationFrame(ae.current),ae.current=null)},jt=()=>{ae.current=null;const oe=Se.current,he=be.current;if(oe===null||!oe.armed||he===null)return;const De=he.getBoundingClientRect(),je=Xe.current,nt=he.scrollHeight-he.clientHeight;let ie=0;je-De.top<24&&he.scrollTop>0?ie=-1:De.bottom-je<24&&he.scrollTop<nt&&(ie=1),ie!==0&&(he.scrollTop+=ie*8,st.current(me.current,je)),ae.current=requestAnimationFrame(jt)},gn=(oe,he)=>{if(ee&&he.button===0&&!(he.altKey||he.ctrlKey||he.metaKey||he.shiftKey)){try{he.currentTarget.setPointerCapture(he.pointerId)}catch{}Se.current={pointerId:he.pointerId,id:oe,armed:!1,startX:he.clientX,startY:he.clientY},me.current=he.clientX,Xe.current=he.clientY}},Ft=oe=>{const he=Se.current;if(!(he===null||he.pointerId!==oe.pointerId)){if(me.current=oe.clientX,Xe.current=oe.clientY,!he.armed){if(Math.hypot(oe.clientX-he.startX,oe.clientY-he.startY)<5)return;he.armed=!0,Je.current=!0,Ee(he.id);const De=j.get(he.id);De&&J(h("ui.shell.sidebar_navigation.drag_armed",{name:De.label})),ae.current===null&&(ae.current=requestAnimationFrame(jt))}ze(oe.clientX,oe.clientY)}},dt=(oe,he)=>{if(he.kind==="slot")return Jdt(te,oe,he.region,he.beforeId,M);const De=Po(te,oe),je=he.kind==="more"?"more":De==="more"?"visible":"more";return j5(te,oe,je)},ln=(oe,he)=>{const De=j.get(oe);if(De===void 0)return;const je=dt(oe,he);if(je===null||bE(je,te))return;const nt=Po(je,oe);if(nt==="more"&&C(!0),q(je),he.kind==="slot"){Jt(je,oe);return}J(nt==="more"?h("ui.shell.sidebar_navigation.move_to_more_note",{name:De.label}):h("ui.shell.sidebar_navigation.show_in_sidebar_note",{name:De.label}))},Jt=(oe,he)=>{const De=j.get(he),je=Po(oe,he),nt=Rx(oe,je,M);J(h("ui.shell.sidebar_navigation.move_note",{name:De?.label??"",position:String(nt.indexOf(he)+1),total:String(nt.length)}))},Pt=(oe,he=!1)=>{const De=Se.current;if(De===null)return;Se.current=null,_t(),Pe();const je=ke.current;if(ke.current=null,Ee(null),pe(null),H(!1),!!De.armed){if(!oe){if(he){Je.current=!1,J("");return}const nt=()=>{Je.current=!1},ie=()=>{window.setTimeout(nt,0)},xe=()=>{window.removeEventListener("pointerup",ye,!0),window.removeEventListener("pointercancel",Fe,!0),window.removeEventListener("blur",Fe,!0)},ye=()=>{xe(),ie()},Fe=()=>{xe(),nt()};window.addEventListener("pointerup",ye,!0),window.addEventListener("pointercancel",Fe,!0),window.addEventListener("blur",Fe,!0),J("");return}window.setTimeout(()=>{Je.current=!1},0),je!==null&&ln(De.id,je)}},qt=m.useRef(Pt);qt.current=Pt,m.useEffect(()=>{if(we===null)return;const oe=je=>{je.key==="Escape"&&(qt.current(!1),je.preventDefault())},he=je=>{Se.current?.pointerId===je.pointerId&&qt.current(!0)},De=()=>qt.current(!1,!0);return window.addEventListener("keydown",oe),window.addEventListener("pointerup",he),window.addEventListener("pointercancel",De),window.addEventListener("blur",De),()=>{window.removeEventListener("keydown",oe),window.removeEventListener("pointerup",he),window.removeEventListener("pointercancel",De),window.removeEventListener("blur",De)}},[we]),m.useEffect(()=>()=>{ae.current!==null&&cancelAnimationFrame(ae.current),We.current!==null&&window.clearTimeout(We.current)},[]);const jn=(oe,he)=>{if(!ee)return;const De=j.get(oe);if(De===void 0)return;if(he.kind==="reset"){ne(),J(h("ui.shell.sidebar_navigation.reset_note")),U(oe);return}if(he.kind==="move"){const nt=Qdt(te,oe,he.delta,M);if(nt===null)return;q(nt),Jt(nt,oe),U(oe);return}const je=j5(te,oe,he.region);bE(je,te)||(he.region==="more"&&C(!0),q(je),J(he.region==="more"?h("ui.shell.sidebar_navigation.move_to_more_note",{name:De.label}):h("ui.shell.sidebar_navigation.show_in_sidebar_note",{name:De.label})),U(oe))},Kt=c.jsx(Btt,{selectedConversation:l??void 0,onSelectConversation:oe=>void xg(t,oe,"sidebar"),onStageDraft:(oe,he)=>{Ne.getState().stageDraft(oe,he),t("/chat")}}),an=oe=>{const he=oe.attention??0,De=he>0&&oe.attentionName?oe.attentionName(he):oe.label;return oe.working&&oe.workingName?oe.workingName:De},ls=oe=>{const he=j.get(oe);if(he===void 0)return null;const De=Po(te,oe),je=De==="more"?B:L,nt=je.indexOf(oe),ie=nt<=0,xe=nt===-1||nt>=je.length-1,ye=he.attention??0,Fe=an(he),it=we===oe,Ct=e?"left":"right",It=he.isActive?Lo:"text-ink-muted hover:bg-row-hover hover:text-ink",Bt=c.jsx(he.icon,{size:16,"aria-hidden":"true",className:R("shrink-0",he.isActive&&"text-accent")}),Xt=c.jsxs("button",{type:"button",ref:At=>{At?ge.current.set(oe,At):ge.current.delete(oe)},onClick:()=>{if(Je.current){Je.current=!1;return}he.onSelect?he.onSelect():t(he.path)},onPointerDown:ee?At=>gn(oe,At):void 0,onPointerMove:ee?Ft:void 0,onPointerUp:ee?At=>{Se.current?.pointerId===At.pointerId&&Pt(!0)}:void 0,onPointerCancel:ee?()=>Pt(!1,!0):void 0,onKeyDown:ee?At=>{if(At.key==="ContextMenu"||At.shiftKey&&At.key==="F10"){At.preventDefault(),le(oe);return}At.altKey&&(At.key!=="ArrowUp"&&At.key!=="ArrowDown"||(At.preventDefault(),jn(oe,{kind:"move",delta:At.key==="ArrowUp"?-1:1})))}:void 0,"data-tour-tag":he.tourTag,"aria-current":he.isActive?"page":void 0,"aria-haspopup":ee?"menu":void 0,"aria-label":s&&Fe===he.label?void 0:Fe,className:R("flex h-full min-w-0 flex-1 items-center gap-2 rounded-md",s?"px-2":"justify-center px-0"),children:[s?Bt:c.jsxs("span",{className:"relative flex size-7 shrink-0 items-center justify-center",children:[Bt,ye>0&&c.jsx("span",{className:"pointer-events-none absolute -top-1 -end-1.5 flex",children:c.jsx(ep,{count:ye,placement:"corner","data-tour-tag":he.attentionTag})})]}),!s&&he.working&&c.jsx("span",{className:"inline-flex",children:c.jsx(yi,{size:16,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})}),s&&c.jsx("span",{className:"truncate",children:he.label})]}),Tt=ee?c.jsxs(Xo,{open:Re===oe,onOpenChange:At=>le(At?oe:null),children:[c.jsx(_o,{asChild:!0,children:s?c.jsx("button",{type:"button","data-sidebar-row-menu":"","aria-label":h("ui.shell.sidebar_navigation.row_actions",{name:he.label}),className:R("me-0.5 flex size-6 shrink-0 items-center justify-center rounded-sm","text-ink-muted opacity-0 transition-opacity duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink","group-hover/row:opacity-100 group-focus-within/row:opacity-100","focus-visible:opacity-100 data-[state=open]:opacity-100",we!==null&&"pointer-events-none opacity-0!"),children:c.jsx(yc,{size:16,"aria-hidden":"true"})}):c.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-1 end-0 w-0"})}),c.jsxs(Qo,{align:"start",side:Ct,sideOffset:s?6:16,className:"min-w-44",onCloseAutoFocus:At=>{At.preventDefault(),U(oe)},children:[c.jsx(on,{disabled:ie,onSelect:()=>jn(oe,{kind:"move",delta:-1}),children:h("ui.shell.sidebar_navigation.move_up")}),c.jsx(on,{disabled:xe,onSelect:()=>jn(oe,{kind:"move",delta:1}),children:h("ui.shell.sidebar_navigation.move_down")}),c.jsx(Wr,{}),De==="more"?c.jsx(on,{onSelect:()=>jn(oe,{kind:"region",region:"visible"}),children:h("ui.shell.sidebar_navigation.show_in_sidebar")}):c.jsx(on,{onSelect:()=>jn(oe,{kind:"region",region:"more"}),children:h("ui.shell.sidebar_navigation.move_to_more")}),!bE(te,yy)&&c.jsxs(c.Fragment,{children:[c.jsx(Wr,{}),c.jsx(on,{onSelect:()=>jn(oe,{kind:"reset"}),children:h("ui.shell.sidebar_navigation.reset_layout")})]})]})]}):null;return c.jsxs("li",{"data-sidebar-row":oe,"data-sidebar-region":De,onContextMenu:ee?At=>{At.preventDefault(),le(oe)}:void 0,className:R("group/row relative flex h-[30px] w-full items-center rounded-md","transition-colors duration-fast ease-out-quart",It,it&&HY,it&&UY),children:[s?Xt:c.jsx(Iu,{content:an(he),side:Ct,suppressed:we!==null,children:Xt}),Tt,s&&(ye>0||he.working)&&c.jsxs("span",{"aria-hidden":"true",className:"pointer-events-none inline-flex shrink-0 items-center gap-1 pe-2",children:[ye>0&&c.jsx(ep,{count:ye,"data-tour-tag":he.attentionTag}),he.working&&c.jsx(yi,{size:16,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})]})]},he.tourTag)},Zt=Ie===null?null:c.jsx("span",{"aria-hidden":"true","data-sidebar-drop-indicator":"",className:"pointer-events-none absolute inset-x-1 z-10 h-0.5 -translate-y-px rounded-full bg-accent",style:{top:Ie}}),us=(we===null?null:Po(te,we))==="more"?h("ui.shell.sidebar_navigation.show_in_sidebar"):h("ui.shell.sidebar_navigation.move_to_more"),Hn=we===null?null:s?c.jsx("div",{"data-sidebar-drop-band":"",className:"absolute inset-x-0 top-full z-20 mt-1 flex h-7 items-center justify-center rounded-md border border-dashed border-control bg-surface text-meta text-ink-dim",children:us}):c.jsx(Iu,{content:us,side:e?"left":"right",children:c.jsx("div",{"data-sidebar-drop-band":"",className:"absolute inset-x-0 top-full z-20 mx-auto mt-1 flex h-6 w-8 items-center justify-center rounded-sm border border-dashed border-control bg-surface",children:c.jsx("span",{"aria-hidden":"true",className:"h-0.5 w-4 rounded-full bg-ink-dim"})})}),vr=c.jsx("span",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:de}),Qn=s?h("ui.shell.sidebar_navigation.collapse_sidebar"):h("ui.shell.sidebar_navigation.expand_sidebar"),_n=s?e?Hi:Qu:e?Qu:Hi,Lt=navigator.platform.toUpperCase().indexOf("MAC")>=0,Jn=vt(a.data,"session_catalogue",2),vn=Ne(oe=>oe.activeDraftKey),dn=Ne(oe=>oe.drafts),$n=!!vn&&!(vn?dn[vn]:void 0)?.target,gs=()=>{Ne.getState().stageDraft(void 0,!0),t("/chat")},z=h("ui.shell.sidebar_navigation.new_chat_shortcut",{shortcut:ji(N6(Lt).replace("+",""))}),V=h("ui.shell.sidebar_navigation.search_accessible",{everything:ji(kl("everything",Lt)),chats:ji(kl("chats",Lt))}),Q=h("ui.shell.sidebar_navigation.search_tooltip",{everything:ji(kl("everything",Lt)),chats:ji(kl("chats",Lt))}),Y=(oe,he,De,je)=>{const nt=oe;return c.jsxs("button",{type:"button",...je.attrs,onClick:je.onClick,disabled:je.disabled,"aria-label":je.ariaLabel,"aria-current":je.current?"page":void 0,className:R(G5,je.current?Lo:"text-ink-muted hover:bg-row-hover hover:text-ink","disabled:text-ink-disabled disabled:hover:bg-transparent"),children:[c.jsx(nt,{size:16,"aria-hidden":"true",className:"shrink-0"}),c.jsx("span",{className:"truncate",children:he}),c.jsx("span",{"aria-hidden":"true",className:"ms-auto",children:c.jsx(Yr,{shortcut:De,joined:!0})})]})},K=Y(RT,h("ui.shell.sidebar_navigation.new_chat"),N6(Lt),{onClick:gs,ariaLabel:z,current:$n,disabled:!Jn,attrs:{"data-tour-tag":"nav-item-chat","data-new-chat-row":""}}),Z=Y(Th,h("ui.shell.sidebar_navigation.search"),Yit("everything",Lt),{onClick:i,ariaLabel:V,attrs:{"data-command-palette-trigger":"",title:Q}}),Te=(oe,he,De)=>{const je=oe;return c.jsx(Iu,{content:c.jsx(Vo,{text:he}),side:e?"left":"right",children:c.jsx("button",{type:"button",...De.attrs,onClick:De.onClick,disabled:De.disabled,"aria-label":he,className:R("flex size-8 items-center justify-center rounded-sm text-ink-muted","transition-colors duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink","disabled:text-ink-disabled disabled:hover:bg-transparent"),children:c.jsxs("span",{className:"relative flex size-7 items-center justify-center",children:[c.jsx(je,{size:16,"aria-hidden":"true"}),(De.attention??0)>0&&c.jsx("span",{className:"pointer-events-none absolute -top-1 -end-1.5 flex",children:c.jsx(ep,{count:De.attention??0,placement:"corner","data-tour-tag":De.attentionTag})}),De.working&&c.jsx("span",{className:"pointer-events-none absolute -bottom-0.5 -end-0.5 flex",children:c.jsx(yi,{size:12,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})})]})})})},He=c.jsx("div",{className:R("pointer-events-none opacity-0 transition-opacity duration-fast ease-out-quart","group-hover/sidebar:pointer-events-auto group-hover/sidebar:opacity-100","group-focus-within/sidebar:pointer-events-auto group-focus-within/sidebar:opacity-100"),children:c.jsx(Iu,{content:Qn,side:e?"left":"right",children:c.jsx(ue,{variant:"ghost",size:"icon-sm",onClick:r,"aria-label":Qn,"aria-expanded":s,"aria-keyshortcuts":JN(Lt),children:c.jsx(_n,{"aria-hidden":"true"})})})}),Ae=()=>{if(B.length===0)return null;const oe=B.map(ie=>j.get(ie)).filter(ie=>ie!==void 0),he=Zdt(oe),De=W?0:he,je=oe.some(ie=>ie.working===!0),nt=he>0?h("ui.shell.sidebar_navigation.more_waiting",{count:he,countText:String(he)}):je?h("ui.shell.sidebar_navigation.more_working"):h("ui.library.page.more_destinations");return c.jsxs("li",{className:R("flex flex-col",s?"gap-0.5":"items-center gap-1"),children:[s?c.jsxs("button",{type:"button","data-tour-tag":"nav-item-more","data-sidebar-more":"","aria-expanded":W,"aria-controls":"sidebar-more-destinations","aria-label":nt,onClick:()=>C(!W),className:R(G5,"text-ink-muted hover:bg-row-hover hover:text-ink"),children:[c.jsx(yc,{size:16,"aria-hidden":"true",className:"shrink-0"}),c.jsx("span",{className:"min-w-0 flex-1 truncate text-start",children:h("ui.library.page.more")}),(De>0||je)&&c.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1",children:[De>0&&c.jsx(ep,{count:De,"data-tour-tag":"nav-more-badge"}),je&&c.jsx(yi,{size:16,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})]}),c.jsx(Ui,{size:14,"aria-hidden":"true",className:R("shrink-0 transition-transform duration-fast",W&&"rotate-180")})]}):Te(yc,nt,{onClick:()=>C(!W),attention:De,attentionTag:"nav-more-badge",working:je,attrs:{"aria-expanded":W,"aria-controls":"sidebar-more-destinations","data-tour-tag":"nav-item-more","data-sidebar-more":""}}),W&&c.jsx("ul",{id:"sidebar-more-destinations",className:R("flex flex-col gap-0.5",!s&&"items-center gap-1"),children:B.map(ls)})]},"nav-overflow")};return s?c.jsxs("div",{"data-sidebar-shell":"","data-glass-region":"sidebar",className:"panel-top-pad group/sidebar flex h-full min-h-0 flex-col overflow-hidden bg-surface",children:[c.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 pe-2 ps-4",children:[c.jsx(U5,{expanded:!0}),c.jsx("span",{className:"ms-auto",children:He})]}),c.jsxs("div",{className:"flex shrink-0 flex-col gap-2 px-2 pb-2",children:[c.jsxs("div",{className:"flex flex-col gap-0.5",children:[K,Z]}),c.jsxs("div",{className:"relative",children:[c.jsxs("div",{ref:be,"data-sidebar-destinations-area":"","data-sidebar-dragging":we!==null?"":void 0,className:"relative min-h-0 max-h-[50dvh] overflow-y-auto select-none",children:[c.jsxs("ul",{"data-sidebar-destinations":"",className:"flex flex-col gap-0.5",children:[L.map(ls),Ae()]}),Zt]}),Hn]}),vr]}),c.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:Kt}),c.jsx(xQ,{})]}):c.jsxs("div",{"data-sidebar-strip":"","data-glass-region":"sidebar",className:"panel-top-pad group/sidebar flex h-full min-h-0 flex-col items-center bg-surface",children:[c.jsx(NQ,{}),c.jsx("div",{className:"flex h-10 shrink-0 items-center justify-center",children:c.jsx(U5,{expanded:!1})}),c.jsxs("ul",{className:"flex flex-col items-center gap-1",children:[c.jsx("li",{children:Te(Hi,Qn,{onClick:r,attrs:{"aria-expanded":!1,"aria-keyshortcuts":JN(Lt)}})}),c.jsx("li",{children:Te(RT,z,{onClick:gs,disabled:!Jn,attrs:{"data-tour-tag":"nav-item-chat"}})}),c.jsx("li",{children:Te(Th,V,{onClick:i,attrs:{"data-command-palette-trigger":""}})})]}),c.jsxs("div",{ref:be,"data-sidebar-destinations-area":"","data-sidebar-dragging":we!==null?"":void 0,className:"relative mt-4 flex flex-col items-center gap-1 select-none",children:[c.jsxs("ul",{"data-sidebar-destinations":"",className:"flex flex-col items-center gap-1",children:[L.map(ls),Ae()]}),Zt,Hn]}),vr,c.jsxs("div",{className:"mt-auto flex flex-col items-center gap-1 pb-2",children:[c.jsx(gQ,{}),c.jsx(_Q,{}),c.jsx(NI,{expanded:!1})]})]})},sht=1,rht=()=>{const{isAuthenticated:e,user:t}=Qy(),{hasBeenNotified:n,setHasBeenNotified:s}=IQ(),[r,i]=m.useState(!1),[a,o]=m.useState(null),l=m.useCallback(async()=>{if(!(!e||!t?.radientUser?.account?.tenant_id))try{const p=await tle({operation:"credits",tenantId:t.radientUser.account.tenant_id});if(!p||typeof p.balance!="number")throw new Error(h("ui.common.errors.credit_balance_invalid"));o(p.balance)}catch(p){console.error("Failed to fetch Radient credits:",p),o(null)}},[e,t?.radientUser?.account?.tenant_id]);return m.useEffect(()=>{e&&l()},[e,l]),m.useEffect(()=>{e&&a!==null?a<sht?n||i(!0):(i(!1),n&&s(!1)):i(!1)},[e,n,a,s]),{isLowCreditsDialogOpen:r,openRadientConsole:()=>{window.api?.openExternal?window.api.openExternal("https://console.radienthq.com"):window.open("https://console.radienthq.com","_blank"),s(!0),i(!1)},closeLowCreditsDialog:()=>{i(!1)},onLowCreditsDialogClose:()=>{s(!0),i(!1)},currentCredits:a}};function iht(){const e=si();m.useEffect(()=>{const t=r=>{e(r==="back"?-1:1)},n=r=>{const i=oU(r);i&&(r.preventDefault(),t(i))},s=r=>{const i=lU(r);i&&(r.preventDefault(),t(i))};return window.addEventListener("keydown",n),window.addEventListener("mouseup",s),()=>{window.removeEventListener("keydown",n),window.removeEventListener("mouseup",s)}},[e])}function aht(){const e=navigator.windowControlsOverlay;if(!e?.getTitlebarAreaRect)return null;try{const t=e.getTitlebarAreaRect();return t.width<=0&&t.height<=0?null:{x:t.x,y:t.y,width:t.width,height:t.height}}catch{return null}}function oht(e,t,n){const s=document.documentElement;if(t==="mac"){s.dataset.chromeLeading="true",s.dataset.chromeTrailing="false";return}if(e===null){s.dataset.chromeLeading="false",s.dataset.chromeTrailing="false";return}s.dataset.chromeLeading=e.x<=1?"true":"false",s.dataset.chromeTrailing=Math.abs(e.x+e.width-n)<=1?"true":"false"}function lht(e){const t=window.api?.windowChrome;if(!t)return;const n=getComputedStyle(document.documentElement),s=n.getPropertyValue("--lo-canvas").trim(),r=n.getPropertyValue("--lo-ink-muted").trim(),i=n.getPropertyValue("--lo-ink-dim").trim();!s||!r||!i||t.report({themeId:e,colors:{ground:s,symbol:r,symbolInactive:i}})}function cht(){m.useLayoutEffect(()=>{if(!window.api?.windowChrome)return;const t=document.documentElement.dataset.chromePlatform??"linux",n=()=>oht(aht(),t,window.innerWidth);n();const s=navigator.windowControlsOverlay;return s?.addEventListener?.("geometrychange",n),window.addEventListener("resize",n),()=>{s?.removeEventListener?.("geometrychange",n),window.removeEventListener("resize",n)}},[]),m.useEffect(()=>{const e=window.api?.windowChrome;if(e)return e.onState(t=>{document.documentElement.dataset.chromeFullscreen=t.fullScreen?"true":"false"})},[])}const uht=m.lazy(()=>La(()=>import("./agent-details-page-Dk8RHSMl.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url).then(e=>({default:e.AgentDetailsPage}))),dht=m.lazy(()=>La(()=>import("./agent-hub-page-CIocC2nK.js"),__vite__mapDeps([16,1,2,3,5,6,17,8,7,9,4,10,11,12,13,18,19,20,21,14,15]),import.meta.url).then(e=>({default:e.AgentHubPage}))),V5=m.lazy(()=>La(()=>import("./agents-page-Bd6D46Bi.js").then(e=>e.a),__vite__mapDeps([22,7,1,2,3,5,6,8,9,18,23,24,25]),import.meta.url).then(e=>({default:e.AgentsPage}))),hht=m.lazy(()=>La(()=>import("./schedules-page-fHpOwysL.js"),__vite__mapDeps([26,1,2,3,5,6,17,8,7,9,27,12,14,15]),import.meta.url).then(e=>({default:e.SchedulesPage}))),W5=m.lazy(()=>La(()=>import("./projects-page-X-DhX0pA.js"),__vite__mapDeps([28,1,2,3,5,6,8,7,9,17,14,15,25,29]),import.meta.url).then(e=>({default:e.ProjectsPage}))),z5=m.lazy(()=>La(()=>import("./library-page-O8Tpue7P.js").then(e=>e.l),__vite__mapDeps([30,1,2,3,14,5,6,15,17,7,8,9,13,29]),import.meta.url).then(e=>({default:e.LibraryPage}))),$5=m.lazy(()=>La(()=>import("./notifications-page-CSsqs93y.js"),__vite__mapDeps([31,1,2,3,14,5,6,15,17,8,7,9,25]),import.meta.url).then(e=>({default:e.NotificationsPage}))),fht=m.lazy(()=>La(()=>import("./team-bridge-page-DSlbd_JZ.js"),__vite__mapDeps([32,1,2,3,7,5,6,8,9,33,24,21,14,15]),import.meta.url).then(e=>({default:e.TeamBridgePage}))),pht=m.lazy(()=>La(()=>import("./browser-page-Dajczk6E.js"),__vite__mapDeps([34,1,2,3,5,6,8,7,9,14,15]),import.meta.url).then(e=>({default:e.BrowserPage}))),ght=m.lazy(()=>La(()=>import("./mesh-page-CuhfZMiu.js"),__vite__mapDeps([35,1,2,3,5,6,17,8,7,9,14,15]),import.meta.url).then(e=>({default:e.MeshPage}))),mht=m.lazy(()=>La(()=>import("./settings-page-cGGZni-k.js"),__vite__mapDeps([36,1,2,3,5,6,14,15,7,8,9,17,33,19,23,37,11,27,12,38]),import.meta.url).then(e=>({default:e.SettingsPage}))),vht=m.lazy(()=>La(()=>import("./browser-webauthn-prompt-h19MrXeQ.js"),__vite__mapDeps([39,1,2,3,5,6,8,7,9,14,15]),import.meta.url).then(e=>({default:e.BrowserWebauthnPrompt}))),bht=()=>{Ve(),uut(),cht(),Bdt(),nle();const{pathname:e}=GA(),t=e.startsWith("/chat")||e.startsWith("/browser"),{isOnboardingActive:n}=pge(),{isLowCreditsDialogOpen:s,openRadientConsole:r,onLowCreditsDialogClose:i}=rht(),{isCommandPaletteOpen:a,isCreateAgentDialogOpen:o,isSidebarCollapsed:l,closeCreateAgentDialog:u}=tt();Du(a,"command-palette"),Du(o,"dialog","create-agent"),Du(n,"onboarding"),Du(s,"dialog","low-credits");const d=si(),f=zn(),p=vt(f.data,"session_catalogue",2),g=vt(f.data,"session_archive");m.useEffect(()=>{Ne.getState().requestArchiveConfirm(null)},[e]);const v=Sr(f.data,"peers"),b=Sr(f.data,"library"),_=Sr(f.data,"notifications"),x=Sr(f.data,"team_bridge_conversations"),w=x==="enabled"&&e.startsWith(ag);Ldt(vt(f.data,"team_bridge_conversations"));const y=P=>{Ne.getState().stageDraft({kind:"agent",name:P.name}),d("/chat"),u()};Cat(),Udt(),jle(),sle(),iht(),Aye();const S=Ne(P=>P.setActiveSession),C=zn(),k=Yh(vt(C.data,"aida",1)),T=Ne(P=>{const O=P.activeDraftKey?P.drafts[P.activeDraftKey]:void 0;return Qv(P.activeDraftKey,O?.sessionId,P.activeSessionId)}),A=hme({displayedSessionId:T,archiveEnabled:g}),F=tt(P=>P.setConsolePaneOpen),I=tt(P=>P.setBrowserPaneOpen),N=tt(P=>P.setConsoleActiveSurface);return m.useEffect(()=>{const P=window.api?.desktop?.onOpenConversation?.((O,j)=>{O!==null&&(performance.mark("lop:open:requested"),Hle(O,"native")),S(O),j!==void 0&&O!==null&&(N(j),F(!0)),d("/chat")});return()=>P?.()},[d,S,F,N]),zit(x==="enabled",d),Gdt(x==="enabled",d),m.useEffect(()=>{const P=window.api?.console?.onReveal?.(O=>{if(O.mode!=="none"&&!(O.mode==="session"&&O.session_id!==T)){if(O.mode==="open"){if(!rle({targetSessionId:O.session_id,displayedSessionId:T,activeElement:document.activeElement,commandPaletteOpen:a}))return;S(O.session_id)}N(O.surface),F(!0)}});return()=>P?.()},[T,a,S,F,N]),Bme(),Wst(),m.useEffect(()=>{const P=window.api?.browser?.onConsentAttention?.(O=>{const j=xme(O.requesterSessionId,Ne.getState().sessions);if(vme(O.entryId),j.kind==="browser"){d("/browser");return}S(j.sessionId),I(!0),d("/chat")});return()=>P?.()},[d,S,I]),m.useEffect(()=>{const P=O=>{n||p&&$st(O)&&(O.preventDefault(),Ne.getState().stageDraft(void 0,!0),d("/chat"))};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[p,n,d]),c.jsx(Qct,{children:c.jsx("div",{className:"relative flex h-screen flex-col overflow-hidden","data-titlebar-sidebar-collapsed":l&&!w?"true":"false",children:c.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[a&&c.jsx(_at,{}),c.jsx(Zct,{}),c.jsx(qst,{}),c.jsx(ile,{}),c.jsx(Sat,{enabled:v==="enabled"}),c.jsx(bot,{open:n}),c.jsx(Jct,{}),c.jsx(fut,{}),g&&c.jsx(Gme,{}),c.jsx(Uge,{}),c.jsx(m.Suspense,{fallback:null,children:c.jsx(vht,{})}),c.jsx(ame,{blocked:n||s||a||o||A,sessionId:k.data?.session_id??null}),c.jsx(Wdt,{open:s,onClose:i,onGoToConsole:r}),c.jsx(bge,{open:o,onClose:u,onAgentCreated:y}),c.jsx(ale,{sidebar:c.jsx(nht,{}),routeSidebar:w&&{keeper:c.jsx(NQ,{}),label:h("ui.teamBridge.page.title")},content:c.jsxs("main",{"data-glass-region":"canvas-backing",className:"panel-top-pad flex grow flex-col overflow-hidden",children:[t?null:c.jsx("div",{"data-chrome-route-band":""}),c.jsx(m.Suspense,{fallback:c.jsxs(c.Fragment,{children:[w&&c.jsx(ndt,{}),c.jsx("div",{className:"flex grow items-center justify-center",children:c.jsx(Pn,{size:"lg",label:h("ui.common.loading.page")})})]}),children:c.jsxs(Qee,{children:[c.jsx(xr,{path:"/",element:c.jsx(ZN,{to:"/chat",replace:!0})}),c.jsx(xr,{path:"/chat",element:c.jsx(D6,{})}),c.jsx(xr,{path:"/chat/:agentId",element:c.jsx(D6,{})}),c.jsx(xr,{path:"/agents",element:c.jsx(V5,{})}),c.jsx(xr,{path:"/agents/:agentId",element:c.jsx(V5,{})}),c.jsx(xr,{path:"/settings",element:c.jsx(mht,{})}),c.jsx(xr,{path:"/agent-hub",element:c.jsx(dht,{})}),c.jsx(xr,{path:"/agent-hub/:agentId",element:c.jsx(uht,{})}),c.jsx(xr,{path:"/schedules",element:c.jsx(hht,{})}),c.jsx(xr,{path:"/projects",element:c.jsx(W5,{})}),c.jsx(xr,{path:"/projects/:projectId",element:c.jsx(W5,{})}),c.jsx(xr,{path:"/browser",element:c.jsx(pht,{})}),_==="enabled"&&c.jsxs(c.Fragment,{children:[c.jsx(xr,{path:"/notifications",element:c.jsx($5,{})}),c.jsx(xr,{path:"/notifications/:notificationId",element:c.jsx($5,{})})]}),b==="enabled"&&c.jsxs(c.Fragment,{children:[c.jsx(xr,{path:"/library",element:c.jsx(z5,{})}),c.jsx(xr,{path:"/library/assets/:assetId",element:c.jsx(z5,{})})]}),x==="enabled"&&c.jsx(xr,{path:"/team-bridge",element:c.jsx(fht,{})}),v==="enabled"&&c.jsx(xr,{path:"/mesh",element:c.jsx(ght,{})}),c.jsx(xr,{path:"*",element:c.jsx(ZN,{to:"/chat",replace:!0})})]})})]})})]})})})};let vl=null,Hf=null,Rm=null,Uf=null,_E=null;const _ht={soundsArm:async()=>{if(kf.getState().element)throw new Error("sounds safety: element already exists");if(vl)throw new Error("sounds safety: graph already armed");return vl=new AudioContext,await vl.resume(),lle(e=>{if(!vl)throw new Error("sounds safety: no context");const t=vl.createMediaElementSource(e);Rm=vl.createGain(),Rm.gain.value=0,Hf=vl.createAnalyser(),Uf=vl.createAnalyser(),t.connect(Uf),Uf.connect(Rm),Rm.connect(Hf),Hf.connect(vl.destination)}),{armed:!0,contextState:vl.state}},soundsFacts:()=>{const e=kf.getState(),t=new Float32Array(Hf?.fftSize??32);Hf?.getFloatTimeDomainData(t);const n=new Float32Array(Uf?.fftSize??32);return Uf?.getFloatTimeDomainData(n),{ownerId:e.ownerId,status:e.status,time:e.element?.currentTime??0,duration:e.element?.duration??0,paused:e.element?.paused??!0,gain:Rm?.gain.value??null,inputRms:Uf?Math.sqrt(n.reduce((s,r)=>s+r*r,0)/n.length):null,players:Array.from(document.querySelectorAll("[data-sound-player]")).map(s=>({status:s.getAttribute("data-sound-status"),clock:s.querySelector("[data-sound-time]")?.textContent,clip:s.querySelectorAll("canvas")[1]?.style.clipPath,numeric:getComputedStyle(s.querySelector("[data-sound-time]")??s).fontVariantNumeric})),rms:Hf?Math.sqrt(t.reduce((s,r)=>s+r*r,0)/t.length):null,src:e.element?.src??null,nativeElements:document.querySelectorAll("audio").length,canvas:Object.values(Ps.getState().conversations).map(s=>({selectedTab:s.selectedTabId,files:s.files?.map(r=>({id:r.id,path:r.path,artifact:r.artifact??null}))}))}},soundsScrub:e=>{const t=e,n=document.querySelector(t.selector);if(!n)throw new Error("sounds: no slider");const s=n.getBoundingClientRect(),r=(u,d)=>n.dispatchEvent(new PointerEvent(u,{pointerId:17,pointerType:"mouse",clientX:d,clientY:s.y+s.height/2,bubbles:!0})),i=n.setPointerCapture,a=n.releasePointerCapture;n.setPointerCapture=()=>{},n.releasePointerCapture=()=>{},r("pointerdown",s.left+1),r("pointermove",s.left+s.width*t.fraction);const o=()=>n.closest("[data-sound-player]")?.getAttribute("data-sound-status"),l=performance.now()+1500;return new Promise(u=>{const d=()=>{const f=o();if(f!=="scrubbing"&&performance.now()<l){requestAnimationFrame(d);return}_E=()=>{r("pointerup",s.left+s.width*t.fraction),n.setPointerCapture=i,n.releasePointerCapture=a},u({during:f,seconds:kf.getState().element?.currentTime})};requestAnimationFrame(d)})},soundsScrubFinish:()=>(_E?.(),_E=null,{committed:!0}),soundsEnd:()=>{const e=kf.getState();if(!e.ownerId||!e.element)throw new Error("sounds: no active playback");return e.seek(e.ownerId,e.element.duration-.12),{requested:!0}},soundsSpeech:async()=>{const e=kf.getState();if(!e.element?.src)throw new Error("sounds: fixture not resolved");const{fetchAttachmentBlob:t}=await La(async()=>{const{fetchAttachmentBlob:r}=await import("./conversation-input-sync-PkxW9VtI.js").then(i=>i.oB);return{fetchAttachmentBlob:r}},__vite__mapDeps([7,1,2,3,5,6,8,9]),import.meta.url),n=Ne.getState().activeSessionId,s=e.ownerId?.startsWith("sound:")?e.ownerId.slice(6):null;if(!n||!s)throw new Error("sounds: missing attachment identity");return await ole.getState().speak("sounds-driver",()=>t({sessionId:n,childId:null},s)),{ownerId:kf.getState().ownerId}}};function Tu(){return new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))})}const xht=3,wht=3e3;function yht(e){return e instanceof CSSTransition&&e.playState==="running"}function Cht(e){const t=e.effect,n=t instanceof KeyframeEffect?t.target:null,s=e.transitionProperty,i=/^[a-z-]+$/.test(s)&&n instanceof Element?getComputedStyle(n).getPropertyValue(s).trim()||"(empty)":"(unreadable)";return`${s||"(unnamed property)"} on ${$v(n)??"an element no longer in the document"} = ${i}`}async function q5(e=wht){const t=performance.now();let n=0;for(;;){await Tu();const s=Math.round(performance.now()-t),r=document.getAnimations().filter(yht);if(n=r.length===0?n+1:0,n>=xht)return{waitedMs:s,timedOut:!1,pending:[]};if(s>e)return{waitedMs:s,timedOut:!0,pending:r.map(Cht)}}}const Sht=/^#/;function B0(){const e=window.location.hash.replace(Sht,"");return e===""?"/":e}function $v(e){if(!e)return null;const t=e.getAttribute("aria-label")??e.textContent??"";return`${e.tagName.toLowerCase()}${e.id?`#${e.id}`:""} "${t.trim().slice(0,60)}"`}function kht(e){const t=e.getBoundingClientRect(),n=t.left+t.width/2,s=t.top+t.height/2,r=document.elementFromPoint(n,s),i=r!==null&&(r===e||e.contains(r)),a=document.elementsFromPoint(n,s).slice(0,4).map(l=>$v(l)),o={bubbles:!0,cancelable:!0,composed:!0,button:0,buttons:1,clientX:n,clientY:s,view:window};return e.dispatchEvent(new PointerEvent("pointerdown",{...o,pointerId:1,isPrimary:!0})),e.dispatchEvent(new MouseEvent("mousedown",o)),e.dispatchEvent(new PointerEvent("pointerup",{...o,buttons:0,pointerId:1,isPrimary:!0})),e.dispatchEvent(new MouseEvent("mouseup",{...o,buttons:0})),e.dispatchEvent(new MouseEvent("click",{...o,buttons:0})),{hitTest:i,hit:$v(r),stack:a,disabled:e instanceof HTMLButtonElement?e.disabled:null,rect:{x:t.x,y:t.y,width:t.width,height:t.height}}}function Am(e,t){if(typeof e!="string"||e==="")throw new Error(`${t} must be a non-empty string`);return e}async function Eht(e,t=1e4){const n=Date.now();for(;B0()!==e;){if(Date.now()-n>t)throw new Error(`route did not become ${e} (it is ${B0()})`);await new Promise(s=>setTimeout(s,50))}return await Tu(),B0()}const MA=["dev-driver","query-fetch-probe"];let j0=null;function Tht(){if(j0)return j0;const e=[],t=tP.prototype.fetch;return tP.prototype.fetch=function(...s){return e.push({at:Date.now(),key:JSON.stringify(this.queryKey),stack:(new Error().stack??"").split(`
|
|
667
667
|
`).slice(2).join(" | ")}),t.apply(this,s)},j0=e,e}function Rht(e){const t=j0??[],n=JSON.stringify(MA),s=t.filter(i=>i.key!==n&&(e===void 0||i.key.includes(e))),r=new Map;for(const i of s){const a=r.get(i.stack)??{key:i.key,count:0,firstAt:i.at,lastAt:i.at};a.count+=1,a.lastAt=i.at,r.set(i.stack,a)}return{armed:j0!==null,total:s.length,probeRecords:t.filter(i=>i.key===n).length,callers:[...r.entries()].map(([i,a])=>({stack:i,...a})).sort((i,a)=>i.firstAt-a.firstAt)}}function Aht(){const e=window.__loDevDriver;return e?.armed?e.install({..._ht,modelAuthority:async t=>{t&&typeof t=="object"&&"start"in t&&t.start===!0&&Zee();const n=eP();if(!n.armed||n.fault)throw new Error("model authority observer unavailable");if(await Tu(),(await q5()).timedOut)throw new Error("model authority DOM did not settle");return eP()},hello:()=>({armed:!0,outDir:e.outDir,title:document.title,route:B0(),href:window.location.href,theme:tt.getState().themeName,viewport:{width:window.innerWidth,height:window.innerHeight,devicePixelRatio:window.devicePixelRatio},visibilityState:document.visibilityState,hasFocus:document.hasFocus(),apiBaseUrl:sr.baseUrl,userAgent:navigator.userAgent}),filesFacts:()=>cle(),state:()=>{const t=tt.getState(),n=Ne.getState();return{route:B0(),theme:t.themeName,commandPaletteOpen:t.isCommandPaletteOpen,canvasOpen:t.isCanvasOpen,runPanelOpen:t.isRunPanelOpen,browserPaneOpen:t.isBrowserPaneOpen,rightSlotWidth:t.rightSlotWidth,rightSlotKey:t.rightSlotKey??null,rightSlotMemory:t.rightSlotMemory.map(([s,r])=>[s,r]),activeSessionId:n.activeSessionId,activeDraftKey:n.activeDraftKey,drafts:Object.fromEntries(Object.entries(n.drafts).map(([s,r])=>[s,{sessionId:r.sessionId??null,error:r.error!==void 0,undelivered:r.undelivered!==void 0,submitted:r.submittedText!==void 0,admissionAttempted:r.admissionAttempted===!0,model:r.model??null}])),sessionCount:n.sessions.length,cataloguePinnedCount:n.sessions.filter(s=>s.pinned===!0).length,cataloguePageable:n.cataloguePageable,catalogueActivityHead:n.catalogueActivityHead,scopes:Object.fromEntries(Object.entries(n.scopes).map(([s,r])=>[s,{ids:r.ids.length,nextCursor:r.nextCursor,loading:r.loading,error:r.error}])),countsTotal:n.counts?.total??null,archiveAttempts:n.answerSeq,archiveFailure:n.archiveFailure?{sessionId:n.archiveFailure.sessionId,archived:n.archiveFailure.archived}:null,onboardingVisible:!!document.querySelector("[data-onboarding-modal]")}},queries:()=>Vx.getQueryCache().getAll().map(t=>({key:JSON.stringify(t.queryKey),status:t.state.status,fetchStatus:t.state.fetchStatus,isLoading:t.state.status==="pending"&&t.state.fetchStatus==="fetching",error:t.state.error instanceof Error?t.state.error.message:null,hasData:t.state.data!==void 0,updatedAt:t.state.dataUpdatedAt,failureCount:t.state.fetchFailureCount,observers:t.getObserversCount()})),queryFetches:async t=>{const n=t??{};if(!n.arm)return Rht(n.key);const s=Tht(),r=JSON.stringify(MA),i=s.length;return await Vx.fetchQuery({queryKey:MA,queryFn:()=>null,retry:!1,staleTime:0}),{armed:!0,validated:s.slice(i).some(a=>a.key===r)}},navigate:async t=>{const n=Am(t,"navigate path");if(!n.startsWith("/"))throw new Error(`navigate path must start with "/" (got "${n}")`);return window.location.hash=`#${n}`,{route:await Eht(n)}},setTheme:async t=>{const n=Am(t,"theme name");tt.getState().setTheme(n),await Tu();const s=document.documentElement.getAttribute("data-theme"),r=await q5();return{theme:tt.getState().themeName,dataTheme:s,settledAfterMs:r.waitedMs,settleTimedOut:r.timedOut,settlePending:r.pending}},setSidebarWidth:async t=>{const n=Number(t?.width);if(!Number.isFinite(n))throw new Error("sidebar width must be a number");const s=Jee(n);return tt.getState().setChatSidebarWidth(s),await Tu(),{width:tt.getState().chatSidebarWidth,clamped:s!==n}},measure:async t=>{const n=typeof t=="string"?{selector:t}:t,s=Am(n?.selector,"measure selector"),r=typeof n?.timeoutMs=="number"?n.timeoutMs:1e4,i=Date.now();let a=null;for(;a===null&&(a=document.querySelector(s),a===null);){if(Date.now()-i>r)throw new Error(`nothing matches ${s} after ${r}ms of waiting`);await new Promise(d=>setTimeout(d,100))}const o=a.getBoundingClientRect(),l={x:Math.round(o.left+o.width/2),y:Math.round(o.top+o.height/2)},u=document.elementFromPoint(l.x,l.y);return{selector:s,target:$v(a),centre:l,rect:{x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height)},hitTest:u!==null&&(u===a||a.contains(u)),focused:a===document.activeElement,inViewport:o.top>=0&&o.left>=0&&o.bottom<=window.innerHeight&&o.right<=window.innerWidth}},press:async t=>{const n=typeof t=="string"?{selector:t}:t,s=Am(n?.selector,"press selector"),r=typeof n?.timeoutMs=="number"?n.timeoutMs:1e4,i=Date.now();let a=null;for(;a===null&&(a=document.querySelector(s),a===null);){if(Date.now()-i>r)throw new Error(`nothing matches ${s} after ${r}ms of waiting`);await new Promise(l=>setTimeout(l,100))}const o=kht(a);return await Tu(),{selector:s,target:$v(a),...o}},openCanvasDocument:async t=>{const n=t,s=Am(n?.path,"canvas document path"),r=typeof n?.title=="string"?n.title:void 0,[i]=await window.api.probeFiles([s]);if(!i||!i.exists||!i.isFile)throw new Error(`no file at ${i?.resolved??s}`);const a=i.resolved??s,o=jo(a,{title:r,type:ed(a),availability:"present",sizeBytes:i.sizeBytes??void 0,lastAgentModified:i.mtimeMs??void 0,readMtimeMs:i.mtimeMs??void 0}),l=Ky[vg(a,o.type)??"code"];if(l==="utf-8"||l==="base64"){const f=await window.api.readFile(o.path,l);if(!f.success)throw new Error(`could not read ${o.path}`);o.content=f.data}const u=Ne.getState(),d=WA(u.activeDraftKey,u.activeSessionId)??u.stageDraft();return tt.getState().setCanvasOpen(!0),Ps.getState().addFileAndSelect(d,o),n?.mention===!0&&Ps.getState().addMentionedFile(d,o),await Tu(),{conversationId:d,documentId:o.id,readMtimeMs:o.readMtimeMs??null,contentLength:o.content.length,encoding:l}},stageLiveConsents:async t=>{const s=t?.count;if(typeof s!="number"||!Number.isInteger(s)||s<0)throw new Error(`stageLiveConsents count must be a non-negative integer (got ${JSON.stringify(s)})`);const r=Date.now();return Ule({tabs:[],activeTabId:null,url:"",title:"",loading:!1,canGoBack:!1,canGoForward:!1,pendingConsent:Array.from({length:s},(i,a)=>({entryId:`dev-driver-probe-${a+1}`,origin:`https://dev-driver-probe-${a+1}.example.com`,authority:`dev-driver-probe-${a+1}.example.com`,broad:null,expiresAt:r+10*6e4,requesterSessionId:null})),approvals:[],navFailure:null}),await Tu(),{count:s}}}):[]}function Fht(){const e=m.useMemo(mg,[]),t=m.useRef(null);return m.useEffect(()=>{const n=window.api?.miniView;if(!n?.onRegistration)return;let s=!1;const r=a=>{if(s)return;const o=t.current;if(t.current=a.status,o===null||a.status===o||a.status==="registered")return;const l=ete(a.value,e);fn(ule(a.status,l))};n.getRegistration?.()?.then(r)?.catch(()=>{});const i=n.onRegistration(r);return()=>{s=!0,i?.()}},[e]),null}const Dht=`
|
|
668
668
|
/*
|
|
669
669
|
* A transition declared on ::-webkit-scrollbar-thumb does not animate in
|