local-operator-ui 0.52.7 → 0.52.9
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/main/index.js +368 -30
- package/out/renderer/assets/{_basePickBy-Cn6QfSqv.js → _basePickBy-BG2VhiIr.js} +1 -1
- package/out/renderer/assets/{_baseUniq-DvtjRZBO.js → _baseUniq-G4ujmd2X.js} +1 -1
- package/out/renderer/assets/{agent-details-page-Bxrn_AT6.js → agent-details-page-CGBPck3M.js} +1 -1
- package/out/renderer/assets/agent-hub-page-oNcQi-BL.js +7 -0
- package/out/renderer/assets/{agents-page-BFDBD9AA.js → agents-page-BM9GCJql.js} +3 -3
- package/out/renderer/assets/{appearance-CdmD45BF.js → appearance-B-Sdp9IA.js} +36 -36
- package/out/renderer/assets/{approvalsOverlay-BEPoTGeb.js → approvalsOverlay-CT-lsZQd.js} +1 -1
- package/out/renderer/assets/{arc-DkFGP-FZ.js → arc-BN6jtH3A.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-IEHRJDOE-CJxjagYN.js → architectureDiagram-IEHRJDOE-DsuIeLu0.js} +1 -1
- package/out/renderer/assets/{avatar-cropper-Dz0ipbuz.js → avatar-cropper-DlNZ1v12.js} +1 -1
- package/out/renderer/assets/{blockDiagram-JOT3LUYC-BX-DQQld.js → blockDiagram-JOT3LUYC-DJvSMoVj.js} +1 -1
- package/out/renderer/assets/{book-open-B_tNY4KA.js → book-open-Cp8uKo-d.js} +1 -1
- package/out/renderer/assets/browser-page-onX8FqEA.js +1 -0
- package/out/renderer/assets/{browser-webauthn-prompt-GZSUrY94.js → browser-webauthn-prompt-CHryNF4a.js} +1 -1
- package/out/renderer/assets/{building-2-S91Q-HFt.js → building-2-DjXAKQ-_.js} +1 -1
- package/out/renderer/assets/{c4Diagram-VJAJSXHY-BtqbckVB.js → c4Diagram-VJAJSXHY-BxuD4dqm.js} +1 -1
- package/out/renderer/assets/channel-Dpjqf8Pr.js +1 -0
- package/out/renderer/assets/{chunk-4BMEZGHF-CxrhkLzw.js → chunk-4BMEZGHF-B-9ZkOo4.js} +1 -1
- package/out/renderer/assets/{chunk-A2AXSNBT-BH6_YcXd.js → chunk-A2AXSNBT-DYX_2Wnw.js} +1 -1
- package/out/renderer/assets/{chunk-AEK57VVT-BfSHypbQ.js → chunk-AEK57VVT-Bt8NwGtc.js} +1 -1
- package/out/renderer/assets/{chunk-D6G4REZN-CEf3Ob5y.js → chunk-D6G4REZN-Cgk8iMci.js} +1 -1
- package/out/renderer/assets/{chunk-RZ5BOZE2-B1oObDF1.js → chunk-RZ5BOZE2-BjDeLAwH.js} +1 -1
- package/out/renderer/assets/{chunk-XZIHB7SX-NzAsvJnk.js → chunk-XZIHB7SX-PPlj1JKr.js} +1 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-Bd3jAzCq.js +1 -0
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-Bd3jAzCq.js +1 -0
- package/out/renderer/assets/clone-BgtnSptX.js +1 -0
- package/out/renderer/assets/{console-mirror-B21mv5xh.js → console-mirror-Icddfzc5.js} +14 -14
- package/out/renderer/assets/{consoleCapture-DbuMCHv1.js → consoleCapture-D0hv_YWG.js} +1 -1
- package/out/renderer/assets/{conversation-input-sync-OWxmq4zX.js → conversation-input-sync-D9Xccwx1.js} +4 -4
- package/out/renderer/assets/{dagre-OKDRZEBW-TI8wrMwZ.js → dagre-OKDRZEBW-YoenwJF-.js} +1 -1
- package/out/renderer/assets/{diagram-SSKATNLV-DiuvjlIQ.js → diagram-SSKATNLV-BxRRTg9E.js} +1 -1
- package/out/renderer/assets/{diagram-VNBRO52H-SBCP7W0-.js → diagram-VNBRO52H-CwmxlyUn.js} +1 -1
- package/out/renderer/assets/{erDiagram-Q7BY3M3F-Be-kevat.js → erDiagram-Q7BY3M3F-10_uYtjI.js} +1 -1
- package/out/renderer/assets/{error-boundary-iNbBBB3v.js → error-boundary-DfFcgZm0.js} +1 -1
- package/out/renderer/assets/{flowDiagram-4HSFHLVR-ChKlZnvv.js → flowDiagram-4HSFHLVR-BIi6hVks.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-APWFNJXF-m7hdnycR.js → ganttDiagram-APWFNJXF-D_OgK0jY.js} +1 -1
- package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-CHmzBlmf.js → gitGraphDiagram-7IBYFJ6S-DL22eEyk.js} +1 -1
- package/out/renderer/assets/{graph-BGrC6Hfx.js → graph-BD4wR-0f.js} +1 -1
- package/out/renderer/assets/{heart-DMfZg11o.js → heart-bD3ezZjX.js} +1 -1
- package/out/renderer/assets/{index-qz7T7xAV.js → index-C5MuLj2j.js} +1 -1
- package/out/renderer/assets/{index-D-BaobqX.js → index-CSQMTsGZ.js} +1 -1
- package/out/renderer/assets/{index-DoVjJu6F.js → index-CVc_oCb8.js} +1 -1
- package/out/renderer/assets/{index-5nnHkCvU.js → index-zeRfNJaS.js} +3 -3
- package/out/renderer/assets/infoDiagram-PH2N3AL5-M2sSQges.js +2 -0
- package/out/renderer/assets/{installer-CVV6WR5Y.js → installer-Ddkg6-C5.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-U35MCT3I-C0KHA5Fo.js → journeyDiagram-U35MCT3I-ClJJE5-O.js} +1 -1
- package/out/renderer/assets/{kanban-definition-NDS4AKOZ-D5LqjQe3.js → kanban-definition-NDS4AKOZ-Vmh-ffzp.js} +1 -1
- package/out/renderer/assets/{layout-CofsTb_n.js → layout-viZOtHI3.js} +1 -1
- package/out/renderer/assets/{legacy-agents-page-RoKJOLAC.js → legacy-agents-page-CUK9HFM4.js} +1 -1
- package/out/renderer/assets/{library-page-D364qPaH.js → library-page-d7jnJ1cM.js} +3 -3
- package/out/renderer/assets/{log-in-BMURtcLk.js → log-in-DRqGQiMM.js} +1 -1
- package/out/renderer/assets/{mermaid.core-CRutHT7B.js → mermaid.core-ZnA0Lmkj.js} +5 -5
- package/out/renderer/assets/{mesh-page-CNqutPsU.js → mesh-page-C972n1XX.js} +1 -1
- package/out/renderer/assets/{messages-CjI8V3o6.js → messages-BdH-KMeX.js} +10 -10
- package/out/renderer/assets/{mindmap-definition-ALO5MXBD-BMHv6mmG.js → mindmap-definition-ALO5MXBD-oyMq2Ffx.js} +1 -1
- package/out/renderer/assets/{mini-hQqzZmLY.js → mini-XTqXeT0x.js} +1 -1
- package/out/renderer/assets/{notebook-pen-B9De8HRk.js → notebook-pen-CgBQhdFa.js} +1 -1
- package/out/renderer/assets/{notifications-page-DnRTPmsg.js → notifications-page-C0pIdEuW.js} +1 -1
- package/out/renderer/assets/{org-access-CSvWotkU.js → org-access-D_YDOtGr.js} +1 -1
- package/out/renderer/assets/{org-surface-gate-D1cQMCPq.js → org-surface-gate-BRBzEvbn.js} +1 -1
- package/out/renderer/assets/{page-header-FRvAuVa5.js → page-header-Bz2lz4LI.js} +1 -1
- package/out/renderer/assets/{pieDiagram-IB7DONF6-B3dl8PAh.js → pieDiagram-IB7DONF6-CJ7Aytd-.js} +1 -1
- package/out/renderer/assets/{project-markdown-B6i3hW9x.js → project-markdown-DYciqMBs.js} +1 -1
- package/out/renderer/assets/{projects-page-DbLor3Wq.js → projects-page-JmH0vUnI.js} +1 -1
- package/out/renderer/assets/{publication-validation-CcVpgrCU.js → publication-validation-quCeNj-v.js} +1 -1
- package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-BNCSmGNZ.js → quadrantDiagram-7GDLP6J5-CLPvPjaT.js} +1 -1
- package/out/renderer/assets/{radar-MK3ICKWK-CjpC5GXo.js → radar-MK3ICKWK-Dl4nMpzG.js} +1 -1
- package/out/renderer/assets/{radient-auth-buttons-r1SLaVYS.js → radient-auth-buttons-DKI9Bh07.js} +1 -1
- package/out/renderer/assets/{requirementDiagram-KVF5MWMF-b-bdNYve.js → requirementDiagram-KVF5MWMF-B3VtoeFm.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-Bk2jSYW-.js → sankeyDiagram-QLVOVGJD-D0ll6mUD.js} +1 -1
- package/out/renderer/assets/{schedules-page-DkoUCdGL.js → schedules-page-Bj-EKraP.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-CrWu9Act.js → sequenceDiagram-X6HHIX6F-DI1TMyGm.js} +1 -1
- package/out/renderer/assets/{settings-page-DS-Emp0f.js → settings-page-DTjdJ7Xe.js} +15 -15
- package/out/renderer/assets/{smartart-Dt5OHgL0.js → smartart-89hlq0Z-.js} +1 -1
- package/out/renderer/assets/{stateDiagram-DGXRK772-CPEB-zup.js → stateDiagram-DGXRK772-AlwHo7F1.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-BMk0V1sn.js +1 -0
- package/out/renderer/assets/{team-bridge-page-BYsUTX6d.js → team-bridge-page-vIR1dP5K.js} +1 -1
- package/out/renderer/assets/{team-bridge-scope-preference-DarSp0-H.js → team-bridge-scope-preference-Dlf6h_m5.js} +1 -1
- package/out/renderer/assets/{timeline-definition-BDJGKUSR-DRCjj8mV.js → timeline-definition-BDJGKUSR-B7rXhxSU.js} +1 -1
- package/out/renderer/assets/{use-download-agent-mutation-D0VLYK_u.js → use-download-agent-mutation-DPsC_HGf.js} +1 -1
- package/out/renderer/assets/{use-session-snapshot-CwV-f4ml.js → use-session-snapshot-DO0nbiYH.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-VJFVF3MP-DY5NVy6E.js → xychartDiagram-VJFVF3MP-B5a0ZuzY.js} +1 -1
- package/out/renderer/browser-approvals-overlay.html +2 -2
- package/out/renderer/console-capture.html +5 -5
- package/out/renderer/index.html +7 -7
- package/out/renderer/installer.html +4 -4
- package/out/renderer/mini.html +7 -7
- package/package.json +6 -2
- package/out/renderer/assets/agent-hub-page-CI0_3cgV.js +0 -7
- package/out/renderer/assets/browser-page-BHpD48Cg.js +0 -1
- package/out/renderer/assets/channel-Qv6Kv9n_.js +0 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-ja7Pq_F9.js +0 -1
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-ja7Pq_F9.js +0 -1
- package/out/renderer/assets/clone-bejLhD1C.js +0 -1
- package/out/renderer/assets/infoDiagram-PH2N3AL5-CjGQEcoF.js +0 -2
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-Ds89SmF1.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./agent-details-page-
|
|
2
|
-
import{r as m,j as c,c as R,b as st,h as pP,x as lJ,E as cJ,w as uJ,F as dJ,u as Du,G as hJ,H as fJ,I as pJ,R as gJ}from"./index-qz7T7xAV.js";import{t as h,b as Q5,c as Ym,r as x1,a as mJ,L as Tl,d as vJ}from"./messages-CjI8V3o6.js";import{bl as bJ,bm as A_,bn as J5,bo as Z5,u as Pt,bp as xJ,bq as _J,br as wJ,bs as yJ,bt as CJ,bu as SJ,bv as gP,bw as mP,bx as kJ,by as EJ,y as Ie,bz as TJ,bA as vP,bB as NA,bC as Bd,h as Ln,a as Yn,c as vt,e as qv,q as eH,s as ei,a2 as tH,bD as qa,ai as mg,ao as nH,H as so,d as nt,bE as RJ,bF as bP,bG as _1,bH as sH,bI as xE,aJ as _E,bJ as AJ,N as Gi,r as Kv,bK as eh,bL as MA,bM as FJ,g as la,n as zd,bN as w1,am as Yv,M as Yo,bO as DJ,bP as OA,ag as IJ,bQ as PJ,bR as NJ,G as tt,bS as rH,bT as iH,bU as Cy,bV as wE,bW as MJ,S as Xm,bX as aH,bY as OJ,bZ as LJ,b_ as BJ,Z as Ku,b$ as jJ,X as LA,T as Xv,aG as y1,c0 as C1,c1 as rn,c2 as F_,c3 as xP,c4 as yE,V as HJ,c5 as UJ,c6 as GJ,c7 as VJ,f as oH,c8 as WJ,c9 as zJ,ca as $J,t as wr,al as CE,cb as Cc,bd as Sy,b as lH,cc as _P,cd as qJ,ce as wP,cf as KJ,cg as YJ,ch as yP,x as BA,ci as cH,af as jA,ay as XJ,cj as CP,ck as ky,cl as QJ,cm as JJ,cn as ZJ,co as eZ,cp as tZ,cq as uH,cr as S1,cs as dH,ct as hH,cu as Am,cv as nZ,cw as fH,cx as sZ,cy as SP,cz as kP,cA as $x,a8 as HA,cB as pH,cC as rZ,a7 as iZ,a6 as aZ,cD as oZ,cE as lZ,cF as EP,cG as cZ,cH as uZ,cI as dZ,cJ as Mb,cK as hZ,cL as fZ,cM as pZ,cN as TP,cO as RP,cP as gZ,cQ as mZ,cR as Fd,cS as AP,cT as FP,cU as DP,cV as IP,cW as vZ,cX as bZ,cY as xZ,cZ as _Z,c_ as wZ,c$ as yZ,d0 as CZ,d1 as PP,d2 as k1,d3 as NP,d4 as SZ,d5 as kZ,d6 as EZ,d7 as D_,d8 as MP,d9 as TZ,da as RZ,db as AZ,dc as FZ,dd as OP,de as DZ,df as IZ,dg as PZ,dh as NZ,di as Ob,dj as MZ,dk as SE,dl as OZ,dm as LZ,dn as BZ,dp as gH,m as jZ,dq as HZ,a9 as UA,bk as LP,dr as UZ,ds as GZ,dt as VZ,bj as WZ,aR as mH,aT as zZ,du as BP,w as jP,dv as Qm,dw as $Z,dx as qZ,dy as HP,dz as KZ,dA as Lb,dB as UP,dC as YZ,dD as Bb,dE as XZ,dF as jb,dG as GP,dH as QZ,dI as JZ,dJ as VP,dK as Hb,dL as WP,dM as Ub,dN as qx,z as I_,A as vH,B as ZZ,az as kE,dO as eee,dP as tee,dQ as nee,dR as see,dS as ree,dT as iee,dU as aee,dV as oee,dW as bH,dX as lee,a5 as Qv,dY as cee,dZ as GA,aj as uee,d_ as dee,d$ as hee,ah as fee,e0 as pee,e1 as gee,e2 as zP,aU as mee,e3 as E1,a3 as vee,e4 as $P,e5 as bee,e6 as xee,e7 as _ee,e8 as wee,e9 as yee,ea as Cee,eb as qP,U as See,ec as kee,ed as Eee,ee as Tee,ef as Ree,C as Aee,eg as Fee,L as Ae,ar as kf,aa as Dee,eh as xH,ei as Iee,ej as Pee,ek as Nee,el as Mee,em as Ey,en as VA,eo as _H,ep as wH,o as Oee,eq as Lee,be as Bee,er as jee,es as WA,et as KP,eu as Hee,ev as Uee,ew as T1,ex as Gee,aI as Vee,ey as Wee,ez as zee,aq as $ee,eA as YP,eB as qee,eC as vr,a1 as XP,eD as Kee,eE as Yee,eF as QP,eG as JP,eH as Xee,eI as yH,eJ as ZP,eK as Qee,E as CH,F as Jee}from"./appearance-CdmD45BF.js";import{u as Ve,c as Tt,z as ud,S as On,G as el,B as ue,L as gr,K as Ts,T as Ty,a as mr,X as rs,af as EE,aB as Zee,n as Wc,o as zc,p as Ol,J as Bi,k as ji,r as Jv,s as Gp,aj as Zv,A as xr,w as bt,a6 as vg,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 vo,d as Qo,H as eN,I as Hr,e as on,g as eb,i as Yu,j as P_,aC as R1,al as SH,N as kH,O as EH,P as TE,f as Kx,aD as hp,aA as ete,a7 as kh,a8 as Fy,a9 as Xu,aE as tte,_ as N_,t as TH,ab as Dy,v as Iy,aF as nte,Z as zA,aa as ste,ai as RE,h as rte,aG as Jg,au as $A,$ as qA,Q as ite,ac as ate,ad as ote,ae as lte,l as cte,m as ute,ag as dte,ah as hte,ay as fte,az as pte,aH as RH,as as sp,q as tN,x as nN,aI as Iu,E as gte}from"./error-boundary-iNbBBB3v.js";import{d3 as Yx,c6 as Hu,az as Aa,cC as KA,b4 as _o,b5 as ir,aF as fn,bv as pn,ay as Ks,aU as Wl,bz as tb,d4 as mte,bA as nb,gX as AH,gY as vte,gZ as z0,g_ as bte,g$ as xte,h0 as _te,h1 as wte,h2 as A1,h3 as F1,a0 as Pu,cK as Py,fl as dd,f3 as Xx,f2 as yte,f1 as Ir,f4 as Pn,h4 as FH,h5 as Cte,co as AE,bC as qh,bF as Ny,fa as My,g5 as Ste,h6 as sN,h7 as kte,h8 as Ete,h9 as FE,ha as Tte,hb as Rte,hc as Ate,hd as Fte,he as M_,aZ as O_,bj as fp,hf as rN,hg as iN,X as DE,hh as Dte,hi as Ite,hj as Pte,hk as Nte,hl as DH,hm as Mte,hn as Ote,ho as IH,hp as Oy,hq as Ly,hr as Lte,hs as Bte,ht as jte,hu as aN,hv as Hte,hw as Ute,hx as Gte,hy as Vte,hz as Wte,hA as zte,hB as $te,hC as qte,hD as Kte,hE as Yte,hF as Xte,hG as Qte,cU as PH,hH as Jte,hI as NH,hJ as Zte,hK as oN,hL as ene,hM as tne,cR as Li,hN as YA,eB as MH,hO as nne,hP as sne,hQ as lN,hR as rne,hS as ine,hT as ane,hU as one,hV as lne,cf as OH,hW as Jm,hX as LH,hY as cne,hZ as une,h_ as dne,h$ as hne,i0 as fne,i1 as bg,i2 as pne,i3 as gne,c4 as Qu,i4 as Ju,i5 as mne,b1 as xg,i6 as cN,i7 as vne,i8 as bne,i9 as xne,ia as uN,ib as _ne,ic as wne,id as $f,fy as yne,ie as Cne,ig as Sne,fB as kne,ih as Ene,ii as Tne,ij as BH,ik as By,bH as jH,il as jy,im as Rne,bx as XA,gc as Vo,dR as Oi,io as HH,a1 as Sc,ip as UH,c5 as Eh,cJ as Hy,cI as $0,iq as Ane,ir as Fne,ca as Zu,cM as Uy,ft as Dne,is as Ine,it as Pne,iu as Nne,iv as Mne,iw as One,ix as Lne,iy as Bne,iz as jne,iA as Hne,iB as dN,iC as Une,iD as Gne,iE as QA,iF as hN,fD as Vne,iG as Wne,iH as GH,iI as zne,iJ as $ne,iK as VH,iL as IE,iM as qne,dz as pp,iN as fN,iO as D1,iP as Kne,cN as Gy,iQ as Yne,iR as WH,iS as PE,iT as Xne,iU as zH,iV as Qne,iW as L_,iX as Jne,iY as Zne,iZ as ese,i_ as tse,i$ as nse,j0 as sse,j1 as rse,be as Os,j2 as $H,bd as jo,j3 as qH,j4 as ise,j5 as ase,eA as pN,j6 as KH,j7 as YH,j8 as XH,e3 as QH,j9 as ed,ja as JH,y as gt,jb as is,jc as B_,jd as Tn,je as ZH,jf as e8,jg as JA,jh as j_,ji as t8,jj as Vy,jk as sb,jl as Th,O as ZA,jm as NE,jn as e2,jo as I1,jp as Wy,jq as ose,jr as wo,js as lse,jt as cse,ju as rp,jv as ME,jw as n8,jx as use,jy as q0,jz as zy,jA as t2,jB as dse,jC as hse,jD as fse,jE as Hn,jF as K0,jG as s8,jH as io,jI as pse,jJ as gse,jK as r8,jL as mse,jM as vse,jN as bse,jO as xse,jP as _se,jQ as wse,jR as yse,jS as Cse,jT as Sse,jU as kse,jV as Ese,jW as Tse,jX as Rse,jY as Ase,jZ as Fse,j_ as Dse,j$ as Ise,k0 as n2,k1 as Pse,k2 as gN,k3 as s2,k4 as Nse,k5 as i8,k6 as a8,k7 as r2,k8 as Mse,cT as o8,da as $y,dd as qy,k9 as Ky,ka as _g,cA as l8,cE as Ose,dL as mN,cb as c8,dP as Lse,dE as Bse,kb as jse,dF as Hse,dG as Use,dH as Gse,dI as Vse,dJ as Wse,dK as zse,bh as $r,dS as $se,kc as qse,kd as Kse,dU as Yse,dT as Xse,dO as Qse,dQ as Jse,ke as Zse,kf as u8,kg as ere,kh as tre,ki as Y0,kj as i2,kk as Yy,kl as a2,km as nre,kn as sre,ko as rre,kp as d8,kq as ire,kr as vN,ks as are,kt as o2,ku as ore,kv as l2,kw as rb,kx as ib,ky as lre,kz as h8,eg as X0,kA as cre,kB as ure,kC as dre,kD as hre,kE as fre,kF as pre,kG as bN,ef as f8,r as p8,eh as gre,kH as mre,kI as vre,kJ as bre,cQ as xre,kK as _re,kL as _c,kM as xN,kN as Zm,kO as Zg,kP as wre,kQ as _N,kR as wN,kS as yre,ac as g8,cy as m8,cv as e0,kT as Cre,kU as Sre,kV as Xy,kW as Q0,dg as kre,bw as wg,kX as Ere,kY as OE,kZ as Tre,k_ as Rre,bB as Vi,bu as Qy,di as yg,dj as v8,k$ as c2,cF as b8,l0 as Are,l1 as x8,l2 as Fre,l3 as Uu,fZ as u2,a3 as d2,l4 as Dre,cr as h2,cs as Jy,l5 as Ire,cq as Vp,dh as P1,l6 as Pre,l7 as Nre,l8 as Mre,l9 as Ore,la as Lre,lb as Bre,fo as jre,fp as Hre,fq as Ure,fr as lc,lc as yN,ld as Gre,le as Vre,lf as Wre,lg as zre,lh as $re,li as qre,lj as Kre,lk as Yre,ll as Xre,lm as LE,e8 as _8,e9 as H_,ln as Qre,lo as w8,cW as Jre,cS as Zre,lp as eie,lq as y8,lr as tie,ls as nie,c_ as sie,lt as rie,lu as iie,lv as aie,lw as oie,lx as lie,ly as cie,fk as uie,lz as C8,lA as die,lB as hie,lC as Gb,lD as S8,fh as fie,lE as pie,lF as k8,lG as gie,lH as oh,gy as E8,gz as f2,lI as mie,lJ as vie,lK as bie,lL as T8,M as xie,lM as _ie,bk as R8,gx as wie,lN as yie,c9 as A8,lO as Cie,lP as Sie,a4 as kie,lQ as Eie,lR as Tie,lS as Rie,lT as Aie,lU as Fie,lV as CN,lW as N1,lX as Die,cc as M1,cd as O1,ce as L1,bi as Iie,lY as Pie,lZ as Nie,l_ as Mie,d0 as Ef,l$ as Tf,m0 as Oie,m1 as Lie,m2 as Bie,m3 as jie,m4 as Hie,m5 as Uie,m6 as F8,m7 as Gie,m8 as D8,m9 as BE,ma as jE,mb as B1,mc as Vie,md as Wie,me as qf,mf as zie,a$ as SN,mg as kN,mh as I8,mi as HE,mj as P8,mk as N8,ml as $ie,mm as qie,mn as Kie,mo as Yie,mp as Xie,mq as Qie,mr as Jie,ms as Zie,mt as eae,mu as tae,mv as nae,mw as sae,mx as rae,my as iae,mz as j1,mA as aae,mB as oae,mC as lae,mD as cae,aa as uae,a6 as dae,ab as H1,a8 as hae,a7 as fae,mE as pae,mF as gae,mG as EN,mH as mae,mI as vae,mJ as bae,mK as xae,mL as _ae,b8 as wae,b9 as yae,ba as Cae,bb as Sae,bc as kae,mM as Eae,mN as Tae,mO as Rae,mP as TN,dv as Zr,e0 as Gt,dV as M8,aR as Oc,aS as UE,et as p2,ew as g2,mQ as Aae,mR as O8,mS as Fae,mT as Dae,mU as Iae,e$ as Pae,mV as Nae,mW as Mae,mX as L8,mY as Oae,f0 as RN,ex as m2,mZ as v2,du as gp,cB as B8,fC as j8,eI as H8,eF as Lae,eo as Bae,eO as jae,dm as Hae,dl as AN,eP as Uae,dn as Gae,ep as Vae,eu as Wae,eV as zae,eW as $ae,eX as U8,m_ as b2,m$ as qae,bG as G8,n0 as V8,n1 as Kae,n2 as Yae,n3 as Xae,n4 as li,n5 as Qae,n6 as _u,n7 as W8,n8 as z8,n9 as $8,na as x2,nb as ya,nc as Jae,nd as Zae,ne as eoe,nf as toe,ng as noe,nh as soe,ni as roe,nj as ioe,S as aoe,nk as ooe,d5 as loe,nl as q8,nm as coe,nn as uoe,no as doe,np as hoe,nq as foe,nr as GE,ns as poe,nt as goe,nu as FN,nv as K8,nw as moe,nx as voe,ny as boe,nz as DN,nA as xoe,nB as _oe,nC as woe,nD as yoe,nE as Coe,nF as Soe,nG as koe,nH as Eoe,nI as _2,nJ as Toe,nK as IN,nL as jd,nM as Y8,nN as VE,nO as U_,nP as Roe,nQ as Aoe,nR as Vb,nS as Fm,nT as w2,nU as X8,nV as Foe,nW as Doe,nX as Ioe,nY as Q8,nZ as Poe,n_ as Noe,fj as G_,n$ as Moe,o0 as PN,o1 as Ooe,o2 as Loe,o3 as Boe,o4 as joe,o5 as Hoe,o6 as Uoe,o7 as Goe,g6 as NN,o8 as J8,o9 as Z8,oa as Voe,ob as Woe,dw as zoe,oc as $oe,g7 as qoe,od as Koe,oe as Yoe,b2 as Xoe,cx as Ma,of as Qoe,og as Joe,oh as Zoe,oi as ele,oj as tle,fM as Rf,ok as nle,ol as sle,om as V_,on as rle,oo as ile,op as U1,oq as G1,or as MN,os as V1,ot as ON,ou as eU,ov as ale,bt as ole,ow as tU,ox as lle,bo as cle,bp as ule,bm as dle,bn as hle,oy as fle,bq as ple}from"./conversation-input-sync-OWxmq4zX.js";import{u as nU,o as Cg,b as gle,c as mle,r as sU,d as rU,e as J0,f as vle,g as ble,s as y2,n as W_,h as xle,i as _le,p as wle,j as yle,k as Cle,l as Sle,q as kle,v as Ele,w as LN,x as BN,y as Tle,z as Rle,A as Ale,C as Fle,B as Dle,D as Ile,E as iU,F as aU,M as Ple,G as Nle,H as Mle,I as Ole}from"./console-mirror-B21mv5xh.js";import"./roles-D1pcbxAx.js";function jN(e,t){return e.filter(n=>!t.includes(n))}function Lle(e,t,n){const s=e.slice(0);return s[t]=n,s}var Ble=class extends bJ{#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,A_.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()&&(jN(n,r).forEach(o=>{o.destroy()}),jN(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=J5(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 Z5(this.#s,r)})}),n}#h(e,t){const n=this.#t.indexOf(e);n!==-1&&(this.#e=Lle(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&&A_.batch(()=>{this.listeners.forEach(s=>{s(this.#e)})})}}};function oU({queries:e,...t},n){const s=Pt(n),r=xJ(),i=_J(),a=m.useMemo(()=>e.map(b=>{const x=s.defaultQueryOptions(b);return x._optimisticResults=r?"isRestoring":"optimistic",x}),[e,s,r]);a.forEach(b=>{wJ(b),yJ(b,i)}),CJ(i);const[o]=m.useState(()=>new Ble(s,a,t)),[l,u,d]=o.getOptimisticResult(a,t.combine),f=!r&&t.subscribed!==!1;m.useSyncExternalStore(m.useCallback(b=>f?o.subscribe(A_.batchCalls(b)):SJ,[o,f]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),m.useEffect(()=>{o.setQueries(a,t)},[a,t,o]);const g=l.some((b,x)=>gP(a[x],b))?l.flatMap((b,x)=>{const _=a[x];if(_){const w=new Z5(s,_);if(gP(_,b))return mP(_,w,i);kJ(b,r)&&mP(_,w,i)}return[]}):[];if(g.length>0)throw Promise.all(g);const v=l.find((b,x)=>{const _=a[x];return _&&EJ({result:b,errorResetBoundary:i,throwOnError:_.throwOnError,query:s.getQueryCache().get(_.queryHash),suspense:_.suspense})});if(v?.error)throw v.error;return u(d())}function HN(e,t){return e.findAll(t.filters).map(n=>t.select?t.select(n):n.state)}function jle(e={},t){const n=Pt(t).getMutationCache(),s=m.useRef(e),r=m.useRef(null);return r.current||(r.current=HN(n,e)),m.useEffect(()=>{s.current=e}),m.useSyncExternalStore(m.useCallback(i=>n.subscribe(()=>{const a=J5(r.current,HN(n,s.current));r.current!==a&&(r.current=a,A_.schedule(i))}),[n]),()=>r.current,()=>r.current)}const Qx=8e3,lU=1e4;function Hle(e){return e?h("ui.notices.chat.archive_offered_title",{title:e}):h("ui.notices.chat.archive_offered_no_name")}const Ule=()=>h("ui.notices.chat.archive_offered_verb");function Gle(e){return Ie.getState().archiveFacts[e]}function Vle(e){const t=Ie.getState(),n=t.archiveFacts[e];return n?n.archived:t.sessions.find(s=>s.session_id===e)?.archived}function Wle(){const e=Ie(t=>t.archiveUndo);m.useEffect(()=>{if(e===null)return;let t=!1;const n=()=>{t||(t=!0,r())},s=()=>{n();const i=Ie.getState().archiveUndo;i!==null&&i.sessionId===e.sessionId&&i.at===e.at&&Ie.getState().setArchiveUndo(null)},r=Ie.subscribe(()=>{const i=Gle(e.sessionId);i!==void 0&&!i.answered||TJ(e.archived,Vle(e.sessionId))||s()});return n},[e])}function zle(e){return h("ui.notices.chat.drafts_offered_name",{count:e})}const $le=e=>h("ui.notices.chat.drafts_offered_verb",{count:e}),qle=e=>{const t=vP(e),n=t.length,s=t.filter(o=>!o.active).length,r=n===1?"chat":"chats",i=e.filter(o=>NA(o)!==null&&vP([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`:""}},cU=e=>h("ui.notices.chat.mark_all_read_deferred",{count:e}),Kle=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?cU(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",UN="drafts-undo",GN="bulk-read-deferral",Yle=8e3;function Xle(){const e=Ve(),t=Ie(b=>b.archiveFailure),n=Ie(b=>b.archiveUndo),s=Ie(b=>b.draftsUndo),r=Ie(b=>b.bulkReadDeferral),i=Ie(b=>b.clearArchiveFailure),a=Ie(b=>b.setArchiveUndo),o=Ie(b=>b.setSessionArchived),l=Ie(b=>b.restoreDraftsUndo);Wle();const u=Bd(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,Yx(W1);return}const b=t&&n?n.at>t.at?"offer":"failure":t?"failure":"offer",x=b==="offer"?n?.at??0:t?.at??0,_=d.current;d.current={kind:b,at:x},_!==null&&_.kind!==b&&x>_.at&&(b==="failure"?a(null):i());const w=(y,S)=>()=>{const C=Ie.getState();y==="offer"?C.archiveUndo?.at===S&&C.setArchiveUndo(null):C.archiveFailure?.at===S&&C.clearArchiveFailure();const E=d.current;E!==null&&E.kind===y&&E.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():lU;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:E=>{E.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():Qx;if(C<=0)return;f.current=S?{...y,locale:e}:{kind:"offer",at:n.at,raisedAt:Date.now(),duration:C,locale:e},Aa(c.jsxs("span",{className:R("flex min-w-0 items-baseline gap-1"),children:[c.jsx("span",{className:R("min-w-0 truncate"),children:Hle(n.title)}),c.jsx("span",{className:R("shrink-0"),children:Ule()})]}),{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:E=>{E.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,Yx(UN);return}p.current=!0;const b=g.current,x=b!==null&&b.at===s.at;if(x&&b.locale===e)return;const _=x?b.raisedAt+Qx-Date.now():Qx;if(_<=0)return;g.current=x?{...b,locale:e}:{at:s.at,raisedAt:Date.now(),locale:e};const w=()=>{const y=Ie.getState();y.draftsUndo?.at===s.at&&(y.setDraftsUndo(null),p.current=!1)};Aa(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(s.keys.length)}),c.jsx("span",{className:R("shrink-0"),children:$le(s.keys.length)})]}),{id:UN,duration:_,classNames:{content:"min-w-0"},onAutoClose:w,onDismiss:w,action:{label:h("ui.notices.chat.undo"),onClick:y=>{y.preventDefault(),l();const S=Ie.getState(),C=S.stagedByDiscard;S.setStagedByDiscard(null),s.keys.length===1&&C!==null&&Ie.getState().activeDraftKey===C&&Ie.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,Yx(GN);return}v.current=!0;const b=()=>{const x=Ie.getState();x.bulkReadDeferral?.at===r.at&&(x.clearBulkReadDeferral(),v.current=!1)};Aa(cU(r.count),{id:GN,duration:Yle,onAutoClose:b,onDismiss:b})},[r]),null}var Bo,Xe=typeof window<"u"?window:void 0,na=typeof globalThis<"u"?globalThis:Xe,uU=Array.prototype,VN=uU.forEach,WN=uU.indexOf,Ta=na?.navigator,Ot=na?.document,ea=na?.location,WE=na?.fetch,zE=na!=null&&na.XMLHttpRequest&&"withCredentials"in new na.XMLHttpRequest?na.XMLHttpRequest:void 0,zN=na?.AbortController,hr=Ta?.userAgent,hn=Xe??{},mc={DEBUG:!1,LIB_VERSION:"1.235.6"},z1="$copy_autocapture",Qle=["$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 Jle=["fatal","error","warning","log","info","debug"];function En(e,t){return e.indexOf(t)!==-1}var Zy=function(e){return e.trim()},C2=function(e){return e.replace(/^\$/,"")},Zle=Array.isArray,dU=Object.prototype,hU=dU.hasOwnProperty,eC=dU.toString,Ws=Zle||function(e){return eC.call(e)==="[object Array]"},Wo=e=>typeof e=="function",zs=e=>e===Object(e)&&!Ws(e),ip=e=>{if(zs(e)){for(var t in e)if(hU.call(e,t))return!1;return!0}return!1},It=e=>e===void 0,pr=e=>eC.call(e)=="[object String]",$E=e=>pr(e)&&e.trim().length===0,hd=e=>e===null,ss=e=>It(e)||hd(e),Mi=e=>eC.call(e)=="[object Number]",bc=e=>eC.call(e)==="[object Boolean]",ece=e=>e instanceof FormData,tce=e=>En(Qle,e),fU=e=>{var t={_log:function(n){if(Xe&&(mc.DEBUG||hn.POSTHOG_DEBUG)&&!It(Xe.console)&&Xe.console){for(var s=("__rrweb_original__"in Xe.console[n])?Xe.console[n].__rrweb_original__:Xe.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=>fU("".concat(e," ").concat(n))};return t},Wt=fU("[PostHog.js]"),bi=Wt.createLogger,nce=bi("[ExternalScriptsLoader]"),$N=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return nce.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 qN(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 et(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qN(Object(n),!0).forEach(function(s){St(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qN(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function St(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pU(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);$N(e,a,n)},hn.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var s=e.requestRouter.endpointFor("api",t);$N(e,s,n)};var z_={};function Gu(e,t,n){if(Ws(e)){if(VN&&e.forEach===VN)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)===z_)return}}}function ds(e,t,n){if(!ss(e)){if(Ws(e))return Gu(e,t,n);if(ece(e)){for(var s of e.entries())if(t.call(n,s[1],s[0])===z_)return}else for(var r in e)if(hU.call(e,r)&&t.call(n,e[r],r)===z_)return}}var er=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},Jx=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 Zx(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 KN=function(e){try{return e()}catch{return}},sce=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){Wt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Wt.critical(r)}}},Z0=function(e){var t={};return ds(e,function(n,s){pr(n)&&n.length>0&&(t[s]=n)}),t};function rce(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),Ws(a)?(l=[],Gu(a,u=>{l.push(i(u))})):(l={},ds(a,(u,d)=>{r.has(u)||(l[d]=i(u,d))})),l);var l}(n);var n,s,r}var ice=["herokuapp.com","vercel.app","netlify.app"];function ace(e){var t=e?.hostname;if(!pr(t))return!1;var n=t.split(".").slice(-2).join(".");for(var s of ice)if(n===s)return!1;return!0}function gU(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function nr(e,t,n,s){var{capture:r=!1,passive:i=!0}=s??{};e?.addEventListener(t,n,{capture:r,passive:i})}var mU="$people_distinct_id",Dm="__alias",Im="__timers",YN="$autocapture_disabled_server_side",qE="$heatmaps_enabled_server_side",XN="$exception_capture_enabled_server_side",QN="$web_vitals_enabled_server_side",vU="$dead_clicks_enabled_server_side",JN="$web_vitals_allowed_metrics",KE="$session_recording_enabled_server_side",ZN="$console_log_recording_enabled_server_side",eM="$session_recording_network_payload_capture",tM="$session_recording_masking",nM="$session_recording_canvas_recording",sM="$replay_sample_rate",rM="$replay_minimum_duration",iM="$replay_script_config",$_="$sesid",Pm="$session_is_sampled",$1="$session_recording_url_trigger_activated_session",q1="$session_recording_event_trigger_activated_session",ap="$enabled_feature_flags",e_="$early_access_features",YE="$feature_flag_details",Nm="$stored_person_properties",Hd="$stored_group_properties",XE="$surveys",Wb="$surveys_activated",q_="$flag_call_reported",fc="$user_state",QE="$client_session_props",JE="$capture_rate_limit",ZE="$initial_campaign_params",eT="$initial_referrer_info",tT="$initial_person_info",K_="$epp",bU="__POSTHOG_TOOLBAR__",aM="$posthog_cookieless",oce=[mU,Dm,"__cmpns",Im,KE,qE,$_,ap,fc,e_,YE,Hd,Nm,XE,q_,QE,JE,ZE,eT,K_];function oM(e){var t;return e instanceof Element&&(e.id===bU||!((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 xU(e){return!!e&&e.nodeType===3}function _U(e){return!!e&&e.nodeType===11}function S2(e){return e?Zy(e).split(/\s+/):[]}function lM(e){var t=Xe?.location.href;return!!(t&&e&&e.some(n=>t.match(n)))}function Y_(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 S2(t)}function wU(e){return ss(e)?null:Zy(e).split(/(\s+)/).filter(t=>Wp(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function nC(e){var t="";return sT(e)&&!SU(e)&&e.childNodes&&e.childNodes.length&&ds(e.childNodes,function(n){var s;xU(n)&&n.textContent&&(t+=(s=wU(n.textContent))!==null&&s!==void 0?s:"")}),Zy(t)}function yU(e){return It(e.target)?e.srcElement||null:(t=e.target)!==null&&t!==void 0&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var nT=["a","button","form","input","select","textarea","label"];function CU(e){var t=e.parentNode;return!(!t||!tC(t))&&t}function lce(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(!Xe||!e||Vu(e,"html")||!tC(e)||n!=null&&n.url_allowlist&&!lM(n.url_allowlist)||n!=null&&n.url_ignorelist&&lM(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(_U(u.parentNode))o.push(u.parentNode.host),u=u.parentNode.host;else{if(!(l=CU(u)))break;if(s||nT.indexOf(l.tagName.toLowerCase())>-1)a=!0;else{var d=Xe.getComputedStyle(l);d&&d.getPropertyValue("cursor")==="pointer"&&(a=!0)}o.push(l),u=l}if(!function(g,v){var b=v?.element_allowlist;if(It(b))return!0;var x=function(y){if(b.some(S=>y.tagName.toLowerCase()===S))return{v:!0}};for(var _ 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(It(b))return!0;var x=function(y){if(b.some(S=>y.matches(S)))return{v:!0}};for(var _ of g){var w=x(_);if(typeof w=="object")return w.v}return!1}(o,n))return!1;var f=Xe.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&&(nT.indexOf(p)>-1||e.getAttribute("contenteditable")==="true")}}function sT(e){for(var t=e;t.parentNode&&!Vu(t,"body");t=t.parentNode){var n=Y_(t);if(En(n,"ph-sensitive")||En(n,"ph-no-capture"))return!1}if(En(Y_(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 SU(e){return!!(Vu(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Vu(e,"select")||Vu(e,"textarea")||e.getAttribute("contenteditable")==="true")}var kU="(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})",cce=new RegExp("^(?:".concat(kU,")$")),uce=new RegExp(kU),EU="\\d{3}-?\\d{2}-?\\d{4}",dce=new RegExp("^(".concat(EU,")$")),hce=new RegExp("(".concat(EU,")"));function Wp(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(ss(e)||pr(e)&&(e=Zy(e),(t?cce:uce).test((e||"").replace(/[- ]/g,""))||(t?dce:hce).test(e)))}function TU(e){var t=nC(e);return Wp(t="".concat(t," ").concat(RU(e)).trim())?t:""}function RU(e){var t="";return e&&e.childNodes&&e.childNodes.length&&ds(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(RU(n)).trim())}catch(i){Wt.error("[AutoCapture]",i)}}),t}function fce(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=et(et(et(et({},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 Zx(l).sort((d,f)=>{var[p]=d,[g]=f;return p.localeCompare(g)}).forEach(d=>{var[f,p]=d;return u[cM(f.toString())]=cM(p.toString())}),a+=":",a+=Zx(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:pce(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return Zx(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 cM(e){return e.replace(/"|\\"/g,'\\"')}function pce(e){var t=e.attr__class;return t?Ws(t)?t:S2(t):void 0}class AU{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 gce=["localhost","127.0.0.1"],mp=e=>{var t=Ot?.createElement("a");return It(t)?null:(t.href=e,t)},mce=function(e){var t,n,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",r=[];return ds(e,function(i,a){It(i)||It(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)},X_=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(!Ws(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch{Wt.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("=");Ws(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},Q_=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},uM=bi("[AutoCapture]");function Y1(e,t){return t.length>e?t.slice(0,e)+"...":t}function vce(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!tC(t));return t}function bce(e,t,n,s){var r=e.tagName.toLowerCase(),i={tag_name:r};nT.indexOf(r)>-1&&!n&&(r.toLowerCase()==="a"||r.toLowerCase()==="button"?i.$el_text=Y1(1024,TU(e)):i.$el_text=Y1(1024,nC(e)));var a=Y_(e);a.length>0&&(i.classes=a.filter(function(d){return d!==""})),ds(e.attributes,function(d){var f;if((!SU(e)||["name","id","class","aria-label"].indexOf(d.name)!==-1)&&(s==null||!s.includes(d.name))&&!t&&Wp(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=S2(p).join(" ")),i["attr__"+d.name]=Y1(1024,p)}});for(var o=1,l=1,u=e;u=vce(u);)o++,u.tagName===e.tagName&&l++;return i.nth_child=o,i.nth_of_type=l,i}function xce(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");)_U(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(ds(u,S=>{var C=sT(S);S.tagName.toLowerCase()==="a"&&(v=S.getAttribute("href"),v=C&&v&&Wp(v)&&v),En(Y_(S),"ph-no-capture")&&(b=!0),p.push(bce(S,i,a,o));var E=function(k){if(!sT(k))return{};var F={};return ds(k.attributes,function(A){if(A.name&&A.name.indexOf("data-ph-capture-attribute")===0){var I=A.name.replace("data-ph-capture-attribute-",""),P=A.value;I&&P&&Wp(P)&&(F[I]=P)}}),F}(S);er(g,E)}),b)return{props:{},explicitNoCapture:b};if(a||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?p[0].$el_text=TU(e):p[0].$el_text=nC(e)),v){var x,_;p[0].attr__href=v;var w=(x=mp(v))===null||x===void 0?void 0:x.host,y=Xe==null||(_=Xe.location)===null||_===void 0?void 0:_.host;w&&y&&w!==y&&(f=v)}return{props:er({$event_type:r.type,$ce_version:1},l?{}:{$elements:p},{$elements_chain:fce(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 _ce=class{constructor(t){St(this,"_initialized",!1),St(this,"_isDisabledServerSide",null),St(this,"rageclicks",new AU),St(this,"_elementsChainAsString",!1),this.instance=t,this._elementSelectors=null}get config(){var t,n,s=zs(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(Xe&&Ot){var t=s=>{s=s||Xe?.event;try{this._captureEvent(s)}catch(r){uM.error("Failed to capture event",r)}};if(nr(Ot,"submit",t,{capture:!0}),nr(Ot,"change",t,{capture:!0}),nr(Ot,"click",t,{capture:!0}),this.config.capture_copied_text){var n=s=>{s=s||Xe?.event,this._captureEvent(s,z1)};nr(Ot,"copy",n,{capture:!0}),nr(Ot,"cut",n,{capture:!0})}}}else uM.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({[YN]:!!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[YN],r=this._isDisabledServerSide;if(hd(r)&&!bc(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=yU(t);xU(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&&lce(r,t,this.config,i,i?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:o}=xce(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=wU(Xe==null||(u=Xe.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 Mi(e)&&isFinite(e)&&Math.floor(e)===e});var dM="0123456789abcdef";let wce=class rT{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 rT(i)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+dM.charAt(this.bytes[n]>>>4)+dM.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 rT(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}},yce=class{constructor(){St(this,"timestamp",0),St(this,"counter",0),St(this,"random",new Cce)}generate(){var t=this.generateOrAbort();if(It(t)){this.timestamp=0;var n=this.generateOrAbort();if(It(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 wce.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 hM,FU=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};Xe&&!It(Xe.crypto)&&crypto.getRandomValues&&(FU=e=>crypto.getRandomValues(e));let Cce=class{constructor(){St(this,"buffer",new Uint32Array(8)),St(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(FU(this.buffer),this.cursor=0),this.buffer[this.cursor++]}};var Nu=()=>Sce().toString(),Sce=()=>(hM||(hM=new yce)).generate(),kce="Thu, 01 Jan 1970 00:00:00 GMT",em="",Ece=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Tce(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_"+Nu(),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="+kce,em=d)}return em}(e);if(!n){var s=(r=>{var i=r.match(Ece);return i?i[0]:""})(e);s!==n&&Wt.info("Warning: cookie subdomain discovery mismatch",s,n),n=s}return n?"; domain=."+n:""}return""}var ku,kc={is_supported:()=>!!Ot,error:function(e){Wt.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(kc.get(e))||{}}catch{}return t},set:function(e,t,n,s,r){if(Ot)try{var i="",a="",o=Tce(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&&Wt.warn("cookieStore warning: large cookie, len="+u.length),Ot.cookie=u,u}catch{return}},remove:function(e,t){try{kc.set(e,"",-1,t)}catch{return}}},X1=null,br={is_supported:function(){if(!hd(X1))return X1;var e=!0;if(It(Xe))e=!1;else try{var t="__mplssupport__";br.set(t,"xyz"),br.get(t)!=='"xyz"'&&(e=!1),br.remove(t)}catch{e=!1}return e||Wt.error("localStorage unsupported; falling back to cookie store"),X1=e,e},error:function(e){Wt.error("localStorage error: "+e)},get:function(e){try{return Xe?.localStorage.getItem(e)}catch(t){br.error(t)}return null},parse:function(e){try{return JSON.parse(br.get(e))||{}}catch{}return null},set:function(e,t){try{Xe?.localStorage.setItem(e,JSON.stringify(t))}catch(n){br.error(n)}},remove:function(e){try{Xe?.localStorage.removeItem(e)}catch(t){br.error(t)}}},Rce=["distinct_id",$_,Pm,K_,tT],zb=et(et({},br),{},{parse:function(e){try{var t={};try{t=kc.parse(e)||{}}catch{}var n=er(t,JSON.parse(br.get(e)||"{}"));return br.set(e,n),n}catch{}return null},set:function(e,t,n,s,r,i){try{br.set(e,t,void 0,void 0,i);var a={};Rce.forEach(o=>{t[o]&&(a[o]=t[o])}),Object.keys(a).length&&kc.set(e,a,n,s,r,i)}catch(o){br.error(o)}},remove:function(e,t){try{Xe?.localStorage.removeItem(e),kc.remove(e,t)}catch(n){br.error(n)}}}),$b={},Ace={is_supported:function(){return!0},error:function(e){Wt.error("memoryStorage error: "+e)},get:function(e){return $b[e]||null},parse:function(e){return $b[e]||null},set:function(e,t){$b[e]=t},remove:function(e){delete $b[e]}},Dd=null,qr={is_supported:function(){if(!hd(Dd))return Dd;if(Dd=!0,It(Xe))Dd=!1;else try{var e="__support__";qr.set(e,"xyz"),qr.get(e)!=='"xyz"'&&(Dd=!1),qr.remove(e)}catch{Dd=!1}return Dd},error:function(e){Wt.error("sessionStorage error: ",e)},get:function(e){try{return Xe?.sessionStorage.getItem(e)}catch(t){qr.error(t)}return null},parse:function(e){try{return JSON.parse(qr.get(e))||null}catch{}return null},set:function(e,t){try{Xe?.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){qr.error(n)}},remove:function(e){try{Xe?.sessionStorage.removeItem(e)}catch(t){qr.error(t)}}};(function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"})(ku||(ku={}));let Fce=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"?br:kc;var n=t==="localStorage"?kc:br;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&&!!gU([Ta?.doNotTrack,Ta?.msDoNotTrack,hn.doNotTrack],t=>En([!0,1,"1","yes"],t))}};var qb=bi("[Dead Clicks]"),Dce=()=>!0,Ice=e=>{var t,n=!((t=e.instance.persistence)===null||t===void 0||!t.get_property(vU)),s=e.instance.config.capture_dead_clicks;return bc(s)?s:n};let DU=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({[vU]: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?qb.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=zs(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),qb.info("starting...")}}else qb.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,qb.info("stopping..."))}};var Q1=bi("[ExceptionAutocapture]");let Pce=class{constructor(t){var n;St(this,"startCapturing",()=>{var s;if(Xe&&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[XN]),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 zs(t)?n=et(et({},n),t):(It(t)?this.remoteEnabled:t)&&(n=et(et({},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({[XN]: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 IU(e){return!It(Event)&&PU(e,Event)}function PU(e,t){try{return e instanceof t}catch{return!1}}function t_(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function J1(e){return t_(e,"DOMError")}var fM=/\(error: (.*)\)/,pM=50,op="?";function Z1(e,t,n,s){var r={platform:"web:javascript",filename:e,function:t==="<anonymous>"?op:t,in_app:!0};return It(n)||(r.lineno=n),It(s)||(r.colno=s),r}var Nce=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Mce=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Oce=/\((\S*)(?::(\d+))(?::(\d+))\)/,Lce=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Bce=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,jce=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(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./agent-details-page-CGBPck3M.js","./index-C5MuLj2j.js","./messages-BdH-KMeX.js","./index-xOFm2yrV.css","./publication-validation-quCeNj-v.js","./appearance-B-Sdp9IA.js","./roles-D1pcbxAx.js","./conversation-input-sync-D9Xccwx1.js","./error-boundary-DfFcgZm0.js","./conversation-input-sync-BmGWvjex.css","./use-download-agent-mutation-DPsC_HGf.js","./book-open-Cp8uKo-d.js","./en-US-CW_dDnkH.js","./heart-bD3ezZjX.js","./console-mirror-Icddfzc5.js","./console-mirror-C58ni4_c.css","./agent-hub-page-oNcQi-BL.js","./page-header-Bz2lz4LI.js","./org-access-D_YDOtGr.js","./radient-auth-buttons-DKI9Bh07.js","./org-surface-gate-BRBzEvbn.js","./building-2-DjXAKQ-_.js","./agents-page-BM9GCJql.js","./avatar-cropper-DlNZ1v12.js","./log-in-DRqGQiMM.js","./project-markdown-DYciqMBs.js","./schedules-page-Bj-EKraP.js","./parseISO-CxPiCKvF.js","./projects-page-JmH0vUnI.js","./use-session-snapshot-DO0nbiYH.js","./library-page-d7jnJ1cM.js","./notifications-page-C0pIdEuW.js","./team-bridge-page-vIR1dP5K.js","./team-bridge-scope-preference-Dlf6h_m5.js","./browser-page-onX8FqEA.js","./mesh-page-C972n1XX.js","./settings-page-DTjdJ7Xe.js","./notebook-pen-CgBQhdFa.js","./settings-page-CE0BRKlY.css","./browser-webauthn-prompt-CHryNF4a.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as m,j as c,c as R,b as st,h as pP,x as lJ,E as cJ,w as uJ,F as dJ,u as Du,G as hJ,H as fJ,I as pJ,R as gJ}from"./index-C5MuLj2j.js";import{t as h,b as Q5,c as Ym,r as x1,a as mJ,L as Tl,d as vJ}from"./messages-BdH-KMeX.js";import{bo as bJ,bp as A_,bq as J5,br as Z5,u as Pt,bs as xJ,bt as _J,bu as wJ,bv as yJ,bw as CJ,bx as SJ,by as gP,bz as mP,bA as kJ,bB as EJ,y as Ie,bC as TJ,bD as vP,bE as NA,bF as Bd,h as Ln,a as Yn,c as vt,e as qv,q as eH,s as ei,a3 as tH,bG as qa,al as mg,ar as nH,H as so,d as nt,bH as RJ,bI as bP,bJ as _1,bK as sH,bL as xE,aM as _E,bM as AJ,N as Gi,r as Kv,bN as eh,bO as MA,bP as FJ,g as la,n as zd,bQ as w1,ap as Yv,M as Yo,bR as DJ,bS as OA,aj as IJ,bT as PJ,bU as NJ,G as tt,bV as rH,bW as iH,bX as Cy,bY as wE,bZ as MJ,S as Xm,b_ as aH,b$ as OJ,c0 as LJ,c1 as BJ,Z as Ku,c2 as jJ,X as LA,T as Xv,aJ as y1,c3 as C1,c4 as rn,c5 as F_,c6 as xP,c7 as yE,V as HJ,c8 as UJ,c9 as GJ,ca as VJ,f as oH,cb as WJ,cc as zJ,cd as $J,t as wr,ao as CE,ce as Cc,bg as Sy,b as lH,cf as _P,cg as qJ,ch as wP,ci as KJ,cj as YJ,ck as yP,x as BA,cl as cH,ai as jA,aB as XJ,cm as CP,cn as ky,co as QJ,cp as JJ,cq as ZJ,cr as eZ,cs as tZ,ct as uH,cu as S1,cv as dH,cw as hH,cx as Am,cy as nZ,cz as fH,cA as sZ,cB as SP,cC as kP,cD as $x,ab as HA,cE as pH,cF as rZ,aa as iZ,a9 as aZ,cG as oZ,cH as lZ,cI as EP,cJ as cZ,cK as uZ,cL as dZ,cM as Mb,cN as hZ,cO as fZ,cP as pZ,cQ as TP,cR as RP,cS as gZ,cT as mZ,cU as Fd,cV as AP,cW as FP,cX as DP,cY as IP,cZ as vZ,c_ as bZ,c$ as xZ,d0 as _Z,d1 as wZ,d2 as yZ,d3 as CZ,d4 as PP,d5 as k1,d6 as NP,d7 as SZ,d8 as kZ,d9 as EZ,da as D_,db as MP,dc as TZ,dd as RZ,de as AZ,df as FZ,dg as OP,dh as DZ,di as IZ,dj as PZ,dk as NZ,dl as Ob,dm as MZ,dn as SE,dp as OZ,dq as LZ,dr as BZ,ds as gH,m as jZ,dt as HZ,ac as UA,bn as LP,du as UZ,dv as GZ,dw as VZ,bm as WZ,aU as mH,aW as zZ,dx as BP,w as jP,dy as Qm,dz as $Z,dA as qZ,dB as HP,dC as KZ,dD as Lb,dE as UP,dF as YZ,dG as Bb,dH as XZ,dI as jb,dJ as GP,dK as QZ,dL as JZ,dM as VP,dN as Hb,dO as WP,dP as Ub,dQ as qx,z as I_,A as vH,B as ZZ,aC as kE,dR as eee,dS as tee,dT as nee,dU as see,dV as ree,dW as iee,dX as aee,dY as oee,dZ as bH,d_ as lee,a8 as Qv,d$ as cee,e0 as GA,am as uee,e1 as dee,e2 as hee,ak as fee,e3 as pee,e4 as gee,e5 as zP,aX as mee,e6 as E1,a4 as vee,e7 as $P,e8 as bee,e9 as xee,ea as _ee,eb as wee,ec as yee,ed as Cee,ee as qP,U as See,ef as kee,eg as Eee,eh as Tee,ei as Ree,C as Aee,ej as Fee,L as Ae,au as kf,ad as Dee,ek as xH,el as Iee,em as Pee,en as Nee,eo as Mee,ep as Ey,eq as VA,er as _H,es as wH,o as Oee,et as Lee,bh as Bee,eu as jee,ev as WA,ew as KP,ex as Hee,ey as Uee,ez as T1,eA as Gee,aL as Vee,eB as Wee,eC as zee,at as $ee,eD as YP,eE as qee,eF as vr,a1 as XP,eG as Kee,eH as Yee,eI as QP,eJ as JP,eK as Xee,eL as yH,eM as ZP,eN as Qee,E as CH,F as Jee}from"./appearance-B-Sdp9IA.js";import{u as Ve,c as Tt,z as ud,S as On,G as el,B as ue,L as gr,K as Ts,T as Ty,a as mr,X as rs,af as EE,aB as Zee,n as Wc,o as zc,p as Ol,J as Bi,k as ji,r as Jv,s as Gp,aj as Zv,A as xr,w as bt,a6 as vg,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 vo,d as Qo,H as eN,I as Hr,e as on,g as eb,i as Yu,j as P_,aC as R1,al as SH,N as kH,O as EH,P as TE,f as Kx,aD as hp,aA as ete,a7 as kh,a8 as Fy,a9 as Xu,aE as tte,_ as N_,t as TH,ab as Dy,v as Iy,aF as nte,Z as zA,aa as ste,ai as RE,h as rte,aG as Jg,au as $A,$ as qA,Q as ite,ac as ate,ad as ote,ae as lte,l as cte,m as ute,ag as dte,ah as hte,ay as fte,az as pte,aH as RH,as as sp,q as tN,x as nN,aI as Iu,E as gte}from"./error-boundary-DfFcgZm0.js";import{d3 as Yx,c6 as Hu,az as Aa,cC as KA,b4 as _o,b5 as ir,aF as fn,bv as pn,ay as Ks,aU as Wl,bz as tb,d4 as mte,bA as nb,gX as AH,gY as vte,gZ as z0,g_ as bte,g$ as xte,h0 as _te,h1 as wte,h2 as A1,h3 as F1,a0 as Pu,cK as Py,fl as dd,f3 as Xx,f2 as yte,f1 as Ir,f4 as Pn,h4 as FH,h5 as Cte,co as AE,bC as qh,bF as Ny,fa as My,g5 as Ste,h6 as sN,h7 as kte,h8 as Ete,h9 as FE,ha as Tte,hb as Rte,hc as Ate,hd as Fte,he as M_,aZ as O_,bj as fp,hf as rN,hg as iN,X as DE,hh as Dte,hi as Ite,hj as Pte,hk as Nte,hl as DH,hm as Mte,hn as Ote,ho as IH,hp as Oy,hq as Ly,hr as Lte,hs as Bte,ht as jte,hu as aN,hv as Hte,hw as Ute,hx as Gte,hy as Vte,hz as Wte,hA as zte,hB as $te,hC as qte,hD as Kte,hE as Yte,hF as Xte,hG as Qte,cU as PH,hH as Jte,hI as NH,hJ as Zte,hK as oN,hL as ene,hM as tne,cR as Li,hN as YA,eB as MH,hO as nne,hP as sne,hQ as lN,hR as rne,hS as ine,hT as ane,hU as one,hV as lne,cf as OH,hW as Jm,hX as LH,hY as cne,hZ as une,h_ as dne,h$ as hne,i0 as fne,i1 as bg,i2 as pne,i3 as gne,c4 as Qu,i4 as Ju,i5 as mne,b1 as xg,i6 as cN,i7 as vne,i8 as bne,i9 as xne,ia as uN,ib as _ne,ic as wne,id as $f,fy as yne,ie as Cne,ig as Sne,fB as kne,ih as Ene,ii as Tne,ij as BH,ik as By,bH as jH,il as jy,im as Rne,bx as XA,gc as Vo,dR as Oi,io as HH,a1 as Sc,ip as UH,c5 as Eh,cJ as Hy,cI as $0,iq as Ane,ir as Fne,ca as Zu,cM as Uy,ft as Dne,is as Ine,it as Pne,iu as Nne,iv as Mne,iw as One,ix as Lne,iy as Bne,iz as jne,iA as Hne,iB as dN,iC as Une,iD as Gne,iE as QA,iF as hN,fD as Vne,iG as Wne,iH as GH,iI as zne,iJ as $ne,iK as VH,iL as IE,iM as qne,dz as pp,iN as fN,iO as D1,iP as Kne,cN as Gy,iQ as Yne,iR as WH,iS as PE,iT as Xne,iU as zH,iV as Qne,iW as L_,iX as Jne,iY as Zne,iZ as ese,i_ as tse,i$ as nse,j0 as sse,j1 as rse,be as Os,j2 as $H,bd as jo,j3 as qH,j4 as ise,j5 as ase,eA as pN,j6 as KH,j7 as YH,j8 as XH,e3 as QH,j9 as ed,ja as JH,y as gt,jb as is,jc as B_,jd as Tn,je as ZH,jf as e8,jg as JA,jh as j_,ji as t8,jj as Vy,jk as sb,jl as Th,O as ZA,jm as NE,jn as e2,jo as I1,jp as Wy,jq as ose,jr as wo,js as lse,jt as cse,ju as rp,jv as ME,jw as n8,jx as use,jy as q0,jz as zy,jA as t2,jB as dse,jC as hse,jD as fse,jE as Hn,jF as K0,jG as s8,jH as io,jI as pse,jJ as gse,jK as r8,jL as mse,jM as vse,jN as bse,jO as xse,jP as _se,jQ as wse,jR as yse,jS as Cse,jT as Sse,jU as kse,jV as Ese,jW as Tse,jX as Rse,jY as Ase,jZ as Fse,j_ as Dse,j$ as Ise,k0 as n2,k1 as Pse,k2 as gN,k3 as s2,k4 as Nse,k5 as i8,k6 as a8,k7 as r2,k8 as Mse,cT as o8,da as $y,dd as qy,k9 as Ky,ka as _g,cA as l8,cE as Ose,dL as mN,cb as c8,dP as Lse,dE as Bse,kb as jse,dF as Hse,dG as Use,dH as Gse,dI as Vse,dJ as Wse,dK as zse,bh as $r,dS as $se,kc as qse,kd as Kse,dU as Yse,dT as Xse,dO as Qse,dQ as Jse,ke as Zse,kf as u8,kg as ere,kh as tre,ki as Y0,kj as i2,kk as Yy,kl as a2,km as nre,kn as sre,ko as rre,kp as d8,kq as ire,kr as vN,ks as are,kt as o2,ku as ore,kv as l2,kw as rb,kx as ib,ky as lre,kz as h8,eg as X0,kA as cre,kB as ure,kC as dre,kD as hre,kE as fre,kF as pre,kG as bN,ef as f8,r as p8,eh as gre,kH as mre,kI as vre,kJ as bre,cQ as xre,kK as _re,kL as _c,kM as xN,kN as Zm,kO as Zg,kP as wre,kQ as _N,kR as wN,kS as yre,ac as g8,cy as m8,cv as e0,kT as Cre,kU as Sre,kV as Xy,kW as Q0,dg as kre,bw as wg,kX as Ere,kY as OE,kZ as Tre,k_ as Rre,bB as Vi,bu as Qy,di as yg,dj as v8,k$ as c2,cF as b8,l0 as Are,l1 as x8,l2 as Fre,l3 as Uu,fZ as u2,a3 as d2,l4 as Dre,cr as h2,cs as Jy,l5 as Ire,cq as Vp,dh as P1,l6 as Pre,l7 as Nre,l8 as Mre,l9 as Ore,la as Lre,lb as Bre,fo as jre,fp as Hre,fq as Ure,fr as lc,lc as yN,ld as Gre,le as Vre,lf as Wre,lg as zre,lh as $re,li as qre,lj as Kre,lk as Yre,ll as Xre,lm as LE,e8 as _8,e9 as H_,ln as Qre,lo as w8,cW as Jre,cS as Zre,lp as eie,lq as y8,lr as tie,ls as nie,c_ as sie,lt as rie,lu as iie,lv as aie,lw as oie,lx as lie,ly as cie,fk as uie,lz as C8,lA as die,lB as hie,lC as Gb,lD as S8,fh as fie,lE as pie,lF as k8,lG as gie,lH as oh,gy as E8,gz as f2,lI as mie,lJ as vie,lK as bie,lL as T8,M as xie,lM as _ie,bk as R8,gx as wie,lN as yie,c9 as A8,lO as Cie,lP as Sie,a4 as kie,lQ as Eie,lR as Tie,lS as Rie,lT as Aie,lU as Fie,lV as CN,lW as N1,lX as Die,cc as M1,cd as O1,ce as L1,bi as Iie,lY as Pie,lZ as Nie,l_ as Mie,d0 as Ef,l$ as Tf,m0 as Oie,m1 as Lie,m2 as Bie,m3 as jie,m4 as Hie,m5 as Uie,m6 as F8,m7 as Gie,m8 as D8,m9 as BE,ma as jE,mb as B1,mc as Vie,md as Wie,me as qf,mf as zie,a$ as SN,mg as kN,mh as I8,mi as HE,mj as P8,mk as N8,ml as $ie,mm as qie,mn as Kie,mo as Yie,mp as Xie,mq as Qie,mr as Jie,ms as Zie,mt as eae,mu as tae,mv as nae,mw as sae,mx as rae,my as iae,mz as j1,mA as aae,mB as oae,mC as lae,mD as cae,aa as uae,a6 as dae,ab as H1,a8 as hae,a7 as fae,mE as pae,mF as gae,mG as EN,mH as mae,mI as vae,mJ as bae,mK as xae,mL as _ae,b8 as wae,b9 as yae,ba as Cae,bb as Sae,bc as kae,mM as Eae,mN as Tae,mO as Rae,mP as TN,dv as Zr,e0 as Gt,dV as M8,aR as Oc,aS as UE,et as p2,ew as g2,mQ as Aae,mR as O8,mS as Fae,mT as Dae,mU as Iae,e$ as Pae,mV as Nae,mW as Mae,mX as L8,mY as Oae,f0 as RN,ex as m2,mZ as v2,du as gp,cB as B8,fC as j8,eI as H8,eF as Lae,eo as Bae,eO as jae,dm as Hae,dl as AN,eP as Uae,dn as Gae,ep as Vae,eu as Wae,eV as zae,eW as $ae,eX as U8,m_ as b2,m$ as qae,bG as G8,n0 as V8,n1 as Kae,n2 as Yae,n3 as Xae,n4 as li,n5 as Qae,n6 as _u,n7 as W8,n8 as z8,n9 as $8,na as x2,nb as ya,nc as Jae,nd as Zae,ne as eoe,nf as toe,ng as noe,nh as soe,ni as roe,nj as ioe,S as aoe,nk as ooe,d5 as loe,nl as q8,nm as coe,nn as uoe,no as doe,np as hoe,nq as foe,nr as GE,ns as poe,nt as goe,nu as FN,nv as K8,nw as moe,nx as voe,ny as boe,nz as DN,nA as xoe,nB as _oe,nC as woe,nD as yoe,nE as Coe,nF as Soe,nG as koe,nH as Eoe,nI as _2,nJ as Toe,nK as IN,nL as jd,nM as Y8,nN as VE,nO as U_,nP as Roe,nQ as Aoe,nR as Vb,nS as Fm,nT as w2,nU as X8,nV as Foe,nW as Doe,nX as Ioe,nY as Q8,nZ as Poe,n_ as Noe,fj as G_,n$ as Moe,o0 as PN,o1 as Ooe,o2 as Loe,o3 as Boe,o4 as joe,o5 as Hoe,o6 as Uoe,o7 as Goe,g6 as NN,o8 as J8,o9 as Z8,oa as Voe,ob as Woe,dw as zoe,oc as $oe,g7 as qoe,od as Koe,oe as Yoe,b2 as Xoe,cx as Ma,of as Qoe,og as Joe,oh as Zoe,oi as ele,oj as tle,fM as Rf,ok as nle,ol as sle,om as V_,on as rle,oo as ile,op as U1,oq as G1,or as MN,os as V1,ot as ON,ou as eU,ov as ale,bt as ole,ow as tU,ox as lle,bo as cle,bp as ule,bm as dle,bn as hle,oy as fle,bq as ple}from"./conversation-input-sync-D9Xccwx1.js";import{u as nU,o as Cg,b as gle,c as mle,r as sU,d as rU,e as J0,f as vle,g as ble,s as y2,n as W_,h as xle,i as _le,p as wle,j as yle,k as Cle,l as Sle,q as kle,v as Ele,w as LN,x as BN,y as Tle,z as Rle,A as Ale,C as Fle,B as Dle,D as Ile,E as iU,F as aU,M as Ple,G as Nle,H as Mle,I as Ole}from"./console-mirror-Icddfzc5.js";import"./roles-D1pcbxAx.js";function jN(e,t){return e.filter(n=>!t.includes(n))}function Lle(e,t,n){const s=e.slice(0);return s[t]=n,s}var Ble=class extends bJ{#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,A_.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()&&(jN(n,r).forEach(o=>{o.destroy()}),jN(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=J5(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 Z5(this.#s,r)})}),n}#h(e,t){const n=this.#t.indexOf(e);n!==-1&&(this.#e=Lle(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&&A_.batch(()=>{this.listeners.forEach(s=>{s(this.#e)})})}}};function oU({queries:e,...t},n){const s=Pt(n),r=xJ(),i=_J(),a=m.useMemo(()=>e.map(b=>{const x=s.defaultQueryOptions(b);return x._optimisticResults=r?"isRestoring":"optimistic",x}),[e,s,r]);a.forEach(b=>{wJ(b),yJ(b,i)}),CJ(i);const[o]=m.useState(()=>new Ble(s,a,t)),[l,u,d]=o.getOptimisticResult(a,t.combine),f=!r&&t.subscribed!==!1;m.useSyncExternalStore(m.useCallback(b=>f?o.subscribe(A_.batchCalls(b)):SJ,[o,f]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),m.useEffect(()=>{o.setQueries(a,t)},[a,t,o]);const g=l.some((b,x)=>gP(a[x],b))?l.flatMap((b,x)=>{const _=a[x];if(_){const w=new Z5(s,_);if(gP(_,b))return mP(_,w,i);kJ(b,r)&&mP(_,w,i)}return[]}):[];if(g.length>0)throw Promise.all(g);const v=l.find((b,x)=>{const _=a[x];return _&&EJ({result:b,errorResetBoundary:i,throwOnError:_.throwOnError,query:s.getQueryCache().get(_.queryHash),suspense:_.suspense})});if(v?.error)throw v.error;return u(d())}function HN(e,t){return e.findAll(t.filters).map(n=>t.select?t.select(n):n.state)}function jle(e={},t){const n=Pt(t).getMutationCache(),s=m.useRef(e),r=m.useRef(null);return r.current||(r.current=HN(n,e)),m.useEffect(()=>{s.current=e}),m.useSyncExternalStore(m.useCallback(i=>n.subscribe(()=>{const a=J5(r.current,HN(n,s.current));r.current!==a&&(r.current=a,A_.schedule(i))}),[n]),()=>r.current,()=>r.current)}const Qx=8e3,lU=1e4;function Hle(e){return e?h("ui.notices.chat.archive_offered_title",{title:e}):h("ui.notices.chat.archive_offered_no_name")}const Ule=()=>h("ui.notices.chat.archive_offered_verb");function Gle(e){return Ie.getState().archiveFacts[e]}function Vle(e){const t=Ie.getState(),n=t.archiveFacts[e];return n?n.archived:t.sessions.find(s=>s.session_id===e)?.archived}function Wle(){const e=Ie(t=>t.archiveUndo);m.useEffect(()=>{if(e===null)return;let t=!1;const n=()=>{t||(t=!0,r())},s=()=>{n();const i=Ie.getState().archiveUndo;i!==null&&i.sessionId===e.sessionId&&i.at===e.at&&Ie.getState().setArchiveUndo(null)},r=Ie.subscribe(()=>{const i=Gle(e.sessionId);i!==void 0&&!i.answered||TJ(e.archived,Vle(e.sessionId))||s()});return n},[e])}function zle(e){return h("ui.notices.chat.drafts_offered_name",{count:e})}const $le=e=>h("ui.notices.chat.drafts_offered_verb",{count:e}),qle=e=>{const t=vP(e),n=t.length,s=t.filter(o=>!o.active).length,r=n===1?"chat":"chats",i=e.filter(o=>NA(o)!==null&&vP([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`:""}},cU=e=>h("ui.notices.chat.mark_all_read_deferred",{count:e}),Kle=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?cU(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",UN="drafts-undo",GN="bulk-read-deferral",Yle=8e3;function Xle(){const e=Ve(),t=Ie(b=>b.archiveFailure),n=Ie(b=>b.archiveUndo),s=Ie(b=>b.draftsUndo),r=Ie(b=>b.bulkReadDeferral),i=Ie(b=>b.clearArchiveFailure),a=Ie(b=>b.setArchiveUndo),o=Ie(b=>b.setSessionArchived),l=Ie(b=>b.restoreDraftsUndo);Wle();const u=Bd(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,Yx(W1);return}const b=t&&n?n.at>t.at?"offer":"failure":t?"failure":"offer",x=b==="offer"?n?.at??0:t?.at??0,_=d.current;d.current={kind:b,at:x},_!==null&&_.kind!==b&&x>_.at&&(b==="failure"?a(null):i());const w=(y,S)=>()=>{const C=Ie.getState();y==="offer"?C.archiveUndo?.at===S&&C.setArchiveUndo(null):C.archiveFailure?.at===S&&C.clearArchiveFailure();const E=d.current;E!==null&&E.kind===y&&E.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():lU;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:E=>{E.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():Qx;if(C<=0)return;f.current=S?{...y,locale:e}:{kind:"offer",at:n.at,raisedAt:Date.now(),duration:C,locale:e},Aa(c.jsxs("span",{className:R("flex min-w-0 items-baseline gap-1"),children:[c.jsx("span",{className:R("min-w-0 truncate"),children:Hle(n.title)}),c.jsx("span",{className:R("shrink-0"),children:Ule()})]}),{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:E=>{E.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,Yx(UN);return}p.current=!0;const b=g.current,x=b!==null&&b.at===s.at;if(x&&b.locale===e)return;const _=x?b.raisedAt+Qx-Date.now():Qx;if(_<=0)return;g.current=x?{...b,locale:e}:{at:s.at,raisedAt:Date.now(),locale:e};const w=()=>{const y=Ie.getState();y.draftsUndo?.at===s.at&&(y.setDraftsUndo(null),p.current=!1)};Aa(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(s.keys.length)}),c.jsx("span",{className:R("shrink-0"),children:$le(s.keys.length)})]}),{id:UN,duration:_,classNames:{content:"min-w-0"},onAutoClose:w,onDismiss:w,action:{label:h("ui.notices.chat.undo"),onClick:y=>{y.preventDefault(),l();const S=Ie.getState(),C=S.stagedByDiscard;S.setStagedByDiscard(null),s.keys.length===1&&C!==null&&Ie.getState().activeDraftKey===C&&Ie.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,Yx(GN);return}v.current=!0;const b=()=>{const x=Ie.getState();x.bulkReadDeferral?.at===r.at&&(x.clearBulkReadDeferral(),v.current=!1)};Aa(cU(r.count),{id:GN,duration:Yle,onAutoClose:b,onDismiss:b})},[r]),null}var Bo,Xe=typeof window<"u"?window:void 0,na=typeof globalThis<"u"?globalThis:Xe,uU=Array.prototype,VN=uU.forEach,WN=uU.indexOf,Ta=na?.navigator,Ot=na?.document,ea=na?.location,WE=na?.fetch,zE=na!=null&&na.XMLHttpRequest&&"withCredentials"in new na.XMLHttpRequest?na.XMLHttpRequest:void 0,zN=na?.AbortController,hr=Ta?.userAgent,hn=Xe??{},mc={DEBUG:!1,LIB_VERSION:"1.235.6"},z1="$copy_autocapture",Qle=["$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 Jle=["fatal","error","warning","log","info","debug"];function En(e,t){return e.indexOf(t)!==-1}var Zy=function(e){return e.trim()},C2=function(e){return e.replace(/^\$/,"")},Zle=Array.isArray,dU=Object.prototype,hU=dU.hasOwnProperty,eC=dU.toString,Ws=Zle||function(e){return eC.call(e)==="[object Array]"},Wo=e=>typeof e=="function",zs=e=>e===Object(e)&&!Ws(e),ip=e=>{if(zs(e)){for(var t in e)if(hU.call(e,t))return!1;return!0}return!1},It=e=>e===void 0,pr=e=>eC.call(e)=="[object String]",$E=e=>pr(e)&&e.trim().length===0,hd=e=>e===null,ss=e=>It(e)||hd(e),Mi=e=>eC.call(e)=="[object Number]",bc=e=>eC.call(e)==="[object Boolean]",ece=e=>e instanceof FormData,tce=e=>En(Qle,e),fU=e=>{var t={_log:function(n){if(Xe&&(mc.DEBUG||hn.POSTHOG_DEBUG)&&!It(Xe.console)&&Xe.console){for(var s=("__rrweb_original__"in Xe.console[n])?Xe.console[n].__rrweb_original__:Xe.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=>fU("".concat(e," ").concat(n))};return t},Wt=fU("[PostHog.js]"),bi=Wt.createLogger,nce=bi("[ExternalScriptsLoader]"),$N=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return nce.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 qN(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 et(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?qN(Object(n),!0).forEach(function(s){St(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qN(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function St(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pU(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);$N(e,a,n)},hn.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var s=e.requestRouter.endpointFor("api",t);$N(e,s,n)};var z_={};function Gu(e,t,n){if(Ws(e)){if(VN&&e.forEach===VN)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)===z_)return}}}function ds(e,t,n){if(!ss(e)){if(Ws(e))return Gu(e,t,n);if(ece(e)){for(var s of e.entries())if(t.call(n,s[1],s[0])===z_)return}else for(var r in e)if(hU.call(e,r)&&t.call(n,e[r],r)===z_)return}}var er=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},Jx=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 Zx(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 KN=function(e){try{return e()}catch{return}},sce=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){Wt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Wt.critical(r)}}},Z0=function(e){var t={};return ds(e,function(n,s){pr(n)&&n.length>0&&(t[s]=n)}),t};function rce(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),Ws(a)?(l=[],Gu(a,u=>{l.push(i(u))})):(l={},ds(a,(u,d)=>{r.has(u)||(l[d]=i(u,d))})),l);var l}(n);var n,s,r}var ice=["herokuapp.com","vercel.app","netlify.app"];function ace(e){var t=e?.hostname;if(!pr(t))return!1;var n=t.split(".").slice(-2).join(".");for(var s of ice)if(n===s)return!1;return!0}function gU(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function nr(e,t,n,s){var{capture:r=!1,passive:i=!0}=s??{};e?.addEventListener(t,n,{capture:r,passive:i})}var mU="$people_distinct_id",Dm="__alias",Im="__timers",YN="$autocapture_disabled_server_side",qE="$heatmaps_enabled_server_side",XN="$exception_capture_enabled_server_side",QN="$web_vitals_enabled_server_side",vU="$dead_clicks_enabled_server_side",JN="$web_vitals_allowed_metrics",KE="$session_recording_enabled_server_side",ZN="$console_log_recording_enabled_server_side",eM="$session_recording_network_payload_capture",tM="$session_recording_masking",nM="$session_recording_canvas_recording",sM="$replay_sample_rate",rM="$replay_minimum_duration",iM="$replay_script_config",$_="$sesid",Pm="$session_is_sampled",$1="$session_recording_url_trigger_activated_session",q1="$session_recording_event_trigger_activated_session",ap="$enabled_feature_flags",e_="$early_access_features",YE="$feature_flag_details",Nm="$stored_person_properties",Hd="$stored_group_properties",XE="$surveys",Wb="$surveys_activated",q_="$flag_call_reported",fc="$user_state",QE="$client_session_props",JE="$capture_rate_limit",ZE="$initial_campaign_params",eT="$initial_referrer_info",tT="$initial_person_info",K_="$epp",bU="__POSTHOG_TOOLBAR__",aM="$posthog_cookieless",oce=[mU,Dm,"__cmpns",Im,KE,qE,$_,ap,fc,e_,YE,Hd,Nm,XE,q_,QE,JE,ZE,eT,K_];function oM(e){var t;return e instanceof Element&&(e.id===bU||!((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 xU(e){return!!e&&e.nodeType===3}function _U(e){return!!e&&e.nodeType===11}function S2(e){return e?Zy(e).split(/\s+/):[]}function lM(e){var t=Xe?.location.href;return!!(t&&e&&e.some(n=>t.match(n)))}function Y_(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 S2(t)}function wU(e){return ss(e)?null:Zy(e).split(/(\s+)/).filter(t=>Wp(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function nC(e){var t="";return sT(e)&&!SU(e)&&e.childNodes&&e.childNodes.length&&ds(e.childNodes,function(n){var s;xU(n)&&n.textContent&&(t+=(s=wU(n.textContent))!==null&&s!==void 0?s:"")}),Zy(t)}function yU(e){return It(e.target)?e.srcElement||null:(t=e.target)!==null&&t!==void 0&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var nT=["a","button","form","input","select","textarea","label"];function CU(e){var t=e.parentNode;return!(!t||!tC(t))&&t}function lce(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(!Xe||!e||Vu(e,"html")||!tC(e)||n!=null&&n.url_allowlist&&!lM(n.url_allowlist)||n!=null&&n.url_ignorelist&&lM(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(_U(u.parentNode))o.push(u.parentNode.host),u=u.parentNode.host;else{if(!(l=CU(u)))break;if(s||nT.indexOf(l.tagName.toLowerCase())>-1)a=!0;else{var d=Xe.getComputedStyle(l);d&&d.getPropertyValue("cursor")==="pointer"&&(a=!0)}o.push(l),u=l}if(!function(g,v){var b=v?.element_allowlist;if(It(b))return!0;var x=function(y){if(b.some(S=>y.tagName.toLowerCase()===S))return{v:!0}};for(var _ 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(It(b))return!0;var x=function(y){if(b.some(S=>y.matches(S)))return{v:!0}};for(var _ of g){var w=x(_);if(typeof w=="object")return w.v}return!1}(o,n))return!1;var f=Xe.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&&(nT.indexOf(p)>-1||e.getAttribute("contenteditable")==="true")}}function sT(e){for(var t=e;t.parentNode&&!Vu(t,"body");t=t.parentNode){var n=Y_(t);if(En(n,"ph-sensitive")||En(n,"ph-no-capture"))return!1}if(En(Y_(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 SU(e){return!!(Vu(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Vu(e,"select")||Vu(e,"textarea")||e.getAttribute("contenteditable")==="true")}var kU="(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})",cce=new RegExp("^(?:".concat(kU,")$")),uce=new RegExp(kU),EU="\\d{3}-?\\d{2}-?\\d{4}",dce=new RegExp("^(".concat(EU,")$")),hce=new RegExp("(".concat(EU,")"));function Wp(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(ss(e)||pr(e)&&(e=Zy(e),(t?cce:uce).test((e||"").replace(/[- ]/g,""))||(t?dce:hce).test(e)))}function TU(e){var t=nC(e);return Wp(t="".concat(t," ").concat(RU(e)).trim())?t:""}function RU(e){var t="";return e&&e.childNodes&&e.childNodes.length&&ds(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(RU(n)).trim())}catch(i){Wt.error("[AutoCapture]",i)}}),t}function fce(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=et(et(et(et({},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 Zx(l).sort((d,f)=>{var[p]=d,[g]=f;return p.localeCompare(g)}).forEach(d=>{var[f,p]=d;return u[cM(f.toString())]=cM(p.toString())}),a+=":",a+=Zx(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:pce(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return Zx(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 cM(e){return e.replace(/"|\\"/g,'\\"')}function pce(e){var t=e.attr__class;return t?Ws(t)?t:S2(t):void 0}class AU{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 gce=["localhost","127.0.0.1"],mp=e=>{var t=Ot?.createElement("a");return It(t)?null:(t.href=e,t)},mce=function(e){var t,n,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",r=[];return ds(e,function(i,a){It(i)||It(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)},X_=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(!Ws(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch{Wt.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("=");Ws(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},Q_=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},uM=bi("[AutoCapture]");function Y1(e,t){return t.length>e?t.slice(0,e)+"...":t}function vce(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!tC(t));return t}function bce(e,t,n,s){var r=e.tagName.toLowerCase(),i={tag_name:r};nT.indexOf(r)>-1&&!n&&(r.toLowerCase()==="a"||r.toLowerCase()==="button"?i.$el_text=Y1(1024,TU(e)):i.$el_text=Y1(1024,nC(e)));var a=Y_(e);a.length>0&&(i.classes=a.filter(function(d){return d!==""})),ds(e.attributes,function(d){var f;if((!SU(e)||["name","id","class","aria-label"].indexOf(d.name)!==-1)&&(s==null||!s.includes(d.name))&&!t&&Wp(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=S2(p).join(" ")),i["attr__"+d.name]=Y1(1024,p)}});for(var o=1,l=1,u=e;u=vce(u);)o++,u.tagName===e.tagName&&l++;return i.nth_child=o,i.nth_of_type=l,i}function xce(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");)_U(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(ds(u,S=>{var C=sT(S);S.tagName.toLowerCase()==="a"&&(v=S.getAttribute("href"),v=C&&v&&Wp(v)&&v),En(Y_(S),"ph-no-capture")&&(b=!0),p.push(bce(S,i,a,o));var E=function(k){if(!sT(k))return{};var F={};return ds(k.attributes,function(A){if(A.name&&A.name.indexOf("data-ph-capture-attribute")===0){var I=A.name.replace("data-ph-capture-attribute-",""),P=A.value;I&&P&&Wp(P)&&(F[I]=P)}}),F}(S);er(g,E)}),b)return{props:{},explicitNoCapture:b};if(a||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?p[0].$el_text=TU(e):p[0].$el_text=nC(e)),v){var x,_;p[0].attr__href=v;var w=(x=mp(v))===null||x===void 0?void 0:x.host,y=Xe==null||(_=Xe.location)===null||_===void 0?void 0:_.host;w&&y&&w!==y&&(f=v)}return{props:er({$event_type:r.type,$ce_version:1},l?{}:{$elements:p},{$elements_chain:fce(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 _ce=class{constructor(t){St(this,"_initialized",!1),St(this,"_isDisabledServerSide",null),St(this,"rageclicks",new AU),St(this,"_elementsChainAsString",!1),this.instance=t,this._elementSelectors=null}get config(){var t,n,s=zs(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(Xe&&Ot){var t=s=>{s=s||Xe?.event;try{this._captureEvent(s)}catch(r){uM.error("Failed to capture event",r)}};if(nr(Ot,"submit",t,{capture:!0}),nr(Ot,"change",t,{capture:!0}),nr(Ot,"click",t,{capture:!0}),this.config.capture_copied_text){var n=s=>{s=s||Xe?.event,this._captureEvent(s,z1)};nr(Ot,"copy",n,{capture:!0}),nr(Ot,"cut",n,{capture:!0})}}}else uM.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({[YN]:!!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[YN],r=this._isDisabledServerSide;if(hd(r)&&!bc(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=yU(t);xU(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&&lce(r,t,this.config,i,i?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:o}=xce(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=wU(Xe==null||(u=Xe.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 Mi(e)&&isFinite(e)&&Math.floor(e)===e});var dM="0123456789abcdef";let wce=class rT{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 rT(i)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+dM.charAt(this.bytes[n]>>>4)+dM.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 rT(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}},yce=class{constructor(){St(this,"timestamp",0),St(this,"counter",0),St(this,"random",new Cce)}generate(){var t=this.generateOrAbort();if(It(t)){this.timestamp=0;var n=this.generateOrAbort();if(It(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 wce.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 hM,FU=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};Xe&&!It(Xe.crypto)&&crypto.getRandomValues&&(FU=e=>crypto.getRandomValues(e));let Cce=class{constructor(){St(this,"buffer",new Uint32Array(8)),St(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(FU(this.buffer),this.cursor=0),this.buffer[this.cursor++]}};var Nu=()=>Sce().toString(),Sce=()=>(hM||(hM=new yce)).generate(),kce="Thu, 01 Jan 1970 00:00:00 GMT",em="",Ece=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Tce(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_"+Nu(),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="+kce,em=d)}return em}(e);if(!n){var s=(r=>{var i=r.match(Ece);return i?i[0]:""})(e);s!==n&&Wt.info("Warning: cookie subdomain discovery mismatch",s,n),n=s}return n?"; domain=."+n:""}return""}var ku,kc={is_supported:()=>!!Ot,error:function(e){Wt.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(kc.get(e))||{}}catch{}return t},set:function(e,t,n,s,r){if(Ot)try{var i="",a="",o=Tce(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&&Wt.warn("cookieStore warning: large cookie, len="+u.length),Ot.cookie=u,u}catch{return}},remove:function(e,t){try{kc.set(e,"",-1,t)}catch{return}}},X1=null,br={is_supported:function(){if(!hd(X1))return X1;var e=!0;if(It(Xe))e=!1;else try{var t="__mplssupport__";br.set(t,"xyz"),br.get(t)!=='"xyz"'&&(e=!1),br.remove(t)}catch{e=!1}return e||Wt.error("localStorage unsupported; falling back to cookie store"),X1=e,e},error:function(e){Wt.error("localStorage error: "+e)},get:function(e){try{return Xe?.localStorage.getItem(e)}catch(t){br.error(t)}return null},parse:function(e){try{return JSON.parse(br.get(e))||{}}catch{}return null},set:function(e,t){try{Xe?.localStorage.setItem(e,JSON.stringify(t))}catch(n){br.error(n)}},remove:function(e){try{Xe?.localStorage.removeItem(e)}catch(t){br.error(t)}}},Rce=["distinct_id",$_,Pm,K_,tT],zb=et(et({},br),{},{parse:function(e){try{var t={};try{t=kc.parse(e)||{}}catch{}var n=er(t,JSON.parse(br.get(e)||"{}"));return br.set(e,n),n}catch{}return null},set:function(e,t,n,s,r,i){try{br.set(e,t,void 0,void 0,i);var a={};Rce.forEach(o=>{t[o]&&(a[o]=t[o])}),Object.keys(a).length&&kc.set(e,a,n,s,r,i)}catch(o){br.error(o)}},remove:function(e,t){try{Xe?.localStorage.removeItem(e),kc.remove(e,t)}catch(n){br.error(n)}}}),$b={},Ace={is_supported:function(){return!0},error:function(e){Wt.error("memoryStorage error: "+e)},get:function(e){return $b[e]||null},parse:function(e){return $b[e]||null},set:function(e,t){$b[e]=t},remove:function(e){delete $b[e]}},Dd=null,qr={is_supported:function(){if(!hd(Dd))return Dd;if(Dd=!0,It(Xe))Dd=!1;else try{var e="__support__";qr.set(e,"xyz"),qr.get(e)!=='"xyz"'&&(Dd=!1),qr.remove(e)}catch{Dd=!1}return Dd},error:function(e){Wt.error("sessionStorage error: ",e)},get:function(e){try{return Xe?.sessionStorage.getItem(e)}catch(t){qr.error(t)}return null},parse:function(e){try{return JSON.parse(qr.get(e))||null}catch{}return null},set:function(e,t){try{Xe?.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){qr.error(n)}},remove:function(e){try{Xe?.sessionStorage.removeItem(e)}catch(t){qr.error(t)}}};(function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"})(ku||(ku={}));let Fce=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"?br:kc;var n=t==="localStorage"?kc:br;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&&!!gU([Ta?.doNotTrack,Ta?.msDoNotTrack,hn.doNotTrack],t=>En([!0,1,"1","yes"],t))}};var qb=bi("[Dead Clicks]"),Dce=()=>!0,Ice=e=>{var t,n=!((t=e.instance.persistence)===null||t===void 0||!t.get_property(vU)),s=e.instance.config.capture_dead_clicks;return bc(s)?s:n};let DU=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({[vU]: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?qb.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=zs(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),qb.info("starting...")}}else qb.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,qb.info("stopping..."))}};var Q1=bi("[ExceptionAutocapture]");let Pce=class{constructor(t){var n;St(this,"startCapturing",()=>{var s;if(Xe&&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[XN]),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 zs(t)?n=et(et({},n),t):(It(t)?this.remoteEnabled:t)&&(n=et(et({},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({[XN]: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 IU(e){return!It(Event)&&PU(e,Event)}function PU(e,t){try{return e instanceof t}catch{return!1}}function t_(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function J1(e){return t_(e,"DOMError")}var fM=/\(error: (.*)\)/,pM=50,op="?";function Z1(e,t,n,s){var r={platform:"web:javascript",filename:e,function:t==="<anonymous>"?op:t,in_app:!0};return It(n)||(r.lineno=n),It(s)||(r.colno=s),r}var Nce=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Mce=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Oce=/\((\S*)(?::(\d+))(?::(\d+))\)/,Lce=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Bce=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,jce=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=fM.test(u)?u.replace(fM,"$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>=pM)break}}}return function(g){if(!g.length)return[];var v=Array.from(g);return v.reverse(),v.slice(0,pM).map(b=>et(et({},b),{},{filename:b.filename||Hce(v).filename,function:b.function||op}))}(a)}}([30,e=>{var t=Nce.exec(e);if(t){var[,n,s,r]=t;return Z1(n,op,+s,+r)}var i=Mce.exec(e);if(i){if(i[2]&&i[2].indexOf("eval")===0){var a=Oce.exec(i[2]);a&&(i[2]=a[1],i[3]=a[2],i[4]=a[3])}var[o,l]=mM(i[1]||op,i[2]);return Z1(l,o,i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}}],[50,e=>{var t=Lce.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=Bce.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]||op;return[r,s]=mM(r,s),Z1(s,r,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]);function Hce(e){return e[e.length-1]||{}}var Kb,gM,eS,mM=(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]:op,n?"safari-extension:".concat(t):"safari-web-extension:".concat(t)]:[e,t]},Uce=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function k2(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=e.stacktrace||e.stack||"",s=function(a){return a&&Gce.test(a.message)?1:0}(e);try{var r=jce,i=function(a,o){var l=function(u){var d=globalThis._posthogChunkIds;if(!d)return{};var f=Object.keys(d);return eS&&f.length===gM||(gM=f.length,eS=f.reduce((p,g)=>{Kb||(Kb={});var v=Kb[g];if(v)p[v[0]]=v[1];else for(var b=u(g),x=b.length-1;x>=0;x--){var _=b[x],w=_?.filename,y=d[g];if(w&&y){p[w]=y,Kb[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 Gce=/Minified React error #\d+;/i;function tS(e,t){var n,s,r=k2(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=k2(t.syntheticException,1);l.length&&(o.stacktrace={frames:l,type:"raw"})}return{$exception_list:[o],$exception_level:"error"}}function Vce(e){return pr(e)&&!$E(e)&&Jle.indexOf(e)>=0}function Wce(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:IU(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=k2(t?.syntheticException,1);u.length&&(l.stacktrace={frames:u,type:"raw"})}return{$exception_list:[l],$exception_level:Vce(e.level)?e.level:"error"}}function zce(e,t){var{error:n,event:s}=e,r={$exception_list:[]},i=n||s;if(J1(i)||function(g){return t_(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,et(et({},t),{},{overrideExceptionType:u,defaultExceptionMessage:l}))}return"code"in a&&(r.$exception_DOMException_code="".concat(a.code)),r}if(function(g){return t_(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 PU(g,Error)}}(i))return tS(i,t);if(function(g){return t_(g,"Object")}(i)||IU(i))return Wce(i,t);if(It(n)&&pr(s)){var d="Error",f=s,p=s.match(Uce);return p&&(d=p[1],f=p[2]),nS(f,et(et({},t),{},{overrideExceptionType:d,defaultExceptionMessage:f}))}return nS(i,t)}function J_(e){var t,n;return((t=JSON.stringify(e,(n=[],function(s,r){if(zs(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 iT(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[iT({size:J_(s),data:s,sessionId:e.sessionId,windowId:e.windowId}),iT({size:J_(r),data:r,sessionId:e.sessionId,windowId:e.windowId})].flatMap(i=>i)}return[e]}var pc=(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))(pc||{}),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||{}),aT="[SessionRecording]",oT="redacted",Yb={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"]},$ce=["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"],qce=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Kce=["/s/","/e/","/i/"];function vM(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?aT+" ".concat(s," body too large to record (").concat(r," bytes)"):e}function bM(e,t){if(ss(e))return e;var n=e;return Wp(n,!1)||(n=aT+" "+t+" body "+oT),ds(qce,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=aT+" "+t+" body "+oT+" as might contain: "+s)}),n}var Yce=(e,t)=>{var n,s,r,i={payloadSizeLimitBytes:Yb.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Yb.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...Yb.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=vM(p.requestBody,p.requestHeaders,r,"Request")),p!=null&&p.responseBody&&(p.responseBody=vM(p.responseBody,p.responseHeaders,r,"Response")),p)),d=p=>{return u(((b,x)=>{var _,w=mp(b.name),y=x.indexOf("http")===0?(_=mp(x))===null||_===void 0?void 0:_.pathname:x;y==="/"&&(y="");var S=w?.pathname.replace(y||"","");if(!(w&&S&&Kce.some(C=>S.indexOf(C)===0)))return b})((v=(g=p).requestHeaders,ss(v)||ds(Object.keys(v??{}),b=>{$ce.includes(b.toLowerCase())&&(v[b]=oT)}),g),e.api_host));var g,v},f=Wo(e.session_recording.maskNetworkRequestFn);return f&&Wo(e.session_recording.maskCapturedNetworkRequestFn)&&Wt.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 et(et({},p),{},{name:g?.url})}),i.maskRequestFn=Wo(e.session_recording.maskCapturedNetworkRequestFn)?p=>{var g,v,b,x=d(p);return x&&(g=(v=(b=e.session_recording).maskCapturedNetworkRequestFn)===null||v===void 0?void 0:v.call(b,x))!==null&&g!==void 0?g:void 0}:p=>function(g){if(!It(g))return g.requestBody=bM(g.requestBody,"Request"),g.responseBody=bM(g.responseBody,"Response"),g}(d(p)),et(et(et({},Yb),i),{},{recordHeaders:a,recordBody:o,recordPerformance:l,recordInitialRequests:l})};function ao(e,t,n,s,r){return t>n&&(Wt.warn("min cannot be greater than max."),t=n),Mi(e)?e>n?(s&&Wt.warn(s+" cannot be greater than max: "+n+". Using max value instead."),n):e<t?(s&&Wt.warn(s+" cannot be less than min: "+t+". Using min value instead."),t):e:(s&&Wt.warn(s+" must be a number. using max or fallback. max: "+n+", fallback: "+r),ao(r||n,t,n,s))}let Xce=class{constructor(t){var n,s,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};St(this,"bucketSize",100),St(this,"refillRate",10),St(this,"mutationBuckets",{}),St(this,"loggedTracker",{}),St(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]})}),St(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]}),St(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)}),St(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=ao((n=this.options.refillRate)!==null&&n!==void 0?n:this.refillRate,0,100,"mutation throttling refill rate"),this.bucketSize=ao((s=this.options.bucketSize)!==null&&s!==void 0?s:this.bucketSize,0,100,"mutation throttling bucket size"),setInterval(()=>{this.refillBuckets()},1e3)}};var ho=Uint8Array,sa=Uint16Array,zp=Uint32Array,E2=new ho([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]),T2=new ho([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]),xM=new ho([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),NU=function(e,t){for(var n=new sa(31),s=0;s<31;++s)n[s]=t+=1<<e[s-1];var r=new zp(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]},MU=NU(E2,2),Qce=MU[0],lT=MU[1];Qce[28]=258,lT[258]=28;for(var _M=NU(T2,0)[1],OU=new sa(32768),ys=0;ys<32768;++ys){var Id=(43690&ys)>>>1|(21845&ys)<<1;Id=(61680&(Id=(52428&Id)>>>2|(13107&Id)<<2))>>>4|(3855&Id)<<4,OU[ys]=((65280&Id)>>>8|(255&Id)<<8)>>>1}var t0=function(e,t,n){for(var s=e.length,r=0,i=new sa(t);r<s;++r)++i[e[r]-1];var a,o=new sa(t);for(r=0;r<t;++r)o[r]=o[r-1]+i[r-1]<<1;for(a=new sa(s),r=0;r<s;++r)a[r]=OU[o[e[r]-1]++]>>>15-e[r];return a},Rh=new ho(288);for(ys=0;ys<144;++ys)Rh[ys]=8;for(ys=144;ys<256;++ys)Rh[ys]=9;for(ys=256;ys<280;++ys)Rh[ys]=7;for(ys=280;ys<288;++ys)Rh[ys]=8;var Z_=new ho(32);for(ys=0;ys<32;++ys)Z_[ys]=5;var Jce=t0(Rh,9),Zce=t0(Z_,5),LU=function(e){return(e/8>>0)+(7&e&&1)},BU=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var s=new(e instanceof sa?sa:e instanceof zp?zp:ho)(n-t);return s.set(e.subarray(t,n)),s},cc=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 ho(0),0];if(r==1){var a=new ho(n[0].s+1);return a[n[0].s]=1,[a,1]}n.sort(function(C,E){return C.f-E.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 sa(p+1),v=cT(n[d-1],g,0);if(v>t){s=0;var b=0,x=v-t,_=1<<x;for(i.sort(function(C,E){return g[E.s]-g[C.s]||C.f-E.f});s<r;++s){var w=i[s].s;if(!(g[w]>t))break;b+=_-(1<<v-g[w]),g[w]=t}for(b>>>=x;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 ho(g),v]},cT=function(e,t,n){return e.s==-1?Math.max(cT(e.l,t,n+1),cT(e.r,t,n+1)):t[e.s]=n},wM=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new sa(++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},uT=function(e,t,n){var s=n.length,r=LU(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)},yM=function(e,t,n,s,r,i,a,o,l,u,d){cc(t,d++,n),++r[256];for(var f=sS(r,15),p=f[0],g=f[1],v=sS(i,15),b=v[0],x=v[1],_=wM(p),w=_[0],y=_[1],S=wM(b),C=S[0],E=S[1],k=new sa(19),F=0;F<w.length;++F)k[31&w[F]]++;for(F=0;F<C.length;++F)k[31&C[F]]++;for(var A=sS(k,7),I=A[0],P=A[1],N=19;N>4&&!I[xM[N-1]];--N);var B,H,O,X,ee=u+5<<3,se=nm(r,Rh)+nm(i,Z_)+a,q=nm(r,p)+nm(i,b)+a+14+3*N+nm(k,I)+(2*k[16]+3*k[17]+7*k[18]);if(ee<=se&&ee<=q)return uT(t,d,e.subarray(l,l+u));if(cc(t,d,1+(q<se)),d+=2,q<se){B=t0(p,g),H=p,O=t0(b,x),X=b;var ne=t0(I,P);for(cc(t,d,y-257),cc(t,d+5,E-1),cc(t,d+10,N-4),d+=14,F=0;F<N;++F)cc(t,d+3*F,I[xM[F]]);d+=3*N;for(var te=[w,C],M=0;M<2;++M){var L=te[M];for(F=0;F<L.length;++F){var W=31&L[F];cc(t,d,ne[W]),d+=I[W],W>15&&(cc(t,d,L[F]>>>5&127),d+=L[F]>>>12)}}}else B=Jce,H=Rh,O=Zce,X=Z_;for(F=0;F<o;++F)if(s[F]>255){W=s[F]>>>18&31,tm(t,d,B[W+257]),d+=H[W+257],W>7&&(cc(t,d,s[F]>>>23&31),d+=E2[W]);var j=31&s[F];tm(t,d,O[j]),d+=X[j],j>3&&(tm(t,d,s[F]>>>5&8191),d+=T2[j])}else tm(t,d,B[s[F]]),d+=H[s[F]];return tm(t,d,B[256]),d+H[256]},eue=new zp([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),tue=function(){for(var e=new zp(256),t=0;t<256;++t){for(var n=t,s=9;--s;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),nue=function(){var e=4294967295;return{p:function(t){for(var n=e,s=0;s<t.length;++s)n=tue[255&n^t[s]]^n>>>8;e=n},d:function(){return 4294967295^e}}},sue=function(e,t,n,s,r){return function(i,a,o,l,u,d){var f=i.length,p=new ho(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 x=b+65535;x<f?v=uT(g,v,i.subarray(b,x)):(g[b]=d,v=uT(g,v,i.subarray(b,f)))}else{for(var _=eue[a-1],w=_>>>13,y=8191&_,S=(1<<o)-1,C=new sa(32768),E=new sa(S+1),k=Math.ceil(o/3),F=2*k,A=function(be){return(i[be]^i[be+1]<<k^i[be+2]<<F)&S},I=new zp(25e3),P=new sa(288),N=new sa(32),B=0,H=0,O=(b=0,0),X=0,ee=0;b<f;++b){var se=A(b),q=32767&b,ne=E[se];if(C[q]=ne,E[se]=q,X<=b){var te=f-b;if((B>7e3||O>24576)&&te>423){v=yM(i,g,0,I,P,N,H,O,ee,b-ee,v),O=B=H=0,ee=b;for(var M=0;M<286;++M)P[M]=0;for(M=0;M<30;++M)N[M]=0}var L=2,W=0,j=y,z=q-ne&32767;if(te>2&&se==A(b-z))for(var oe=Math.min(w,te)-1,J=Math.min(32767,b),Re=Math.min(258,te);z<=J&&--j&&q!=ne;){if(i[b+L]==i[b+L-z]){for(var ie=0;ie<Re&&i[b+ie]==i[b+ie-z];++ie);if(ie>L){if(L=ie,W=z,ie>oe)break;var ge=Math.min(z,ie-2),U=0;for(M=0;M<ge;++M){var we=b-z+M+32768&32767,ke=we-C[we]+32768&32767;ke>U&&(U=ke,ne=we)}}}z+=(q=ne)-(ne=C[q])+32768&32767}if(W){I[O++]=268435456|lT[L]<<18|_M[W];var De=31&lT[L],pe=31&_M[W];H+=E2[De]+T2[pe],++P[257+De],++N[pe],X=b+L,++B}else I[O++]=i[b],++P[i[b]]}}v=yM(i,g,d,I,P,N,H,O,ee,b-ee,v)}return BU(p,0,l+LU(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)},dT=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},rue=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&&dT(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)}},iue=function(e){return 10+(e.filename&&e.filename.length+1||0)};function jU(e,t){t===void 0&&(t={});var n=nue(),s=e.length;n.p(e);var r=sue(e,t,iue(t),8),i=r.length;return rue(r,t),dT(r,i-8,n.d()),dT(r,i-4,s),r}function HU(e,t){var n=e.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(e);for(var s=new ho(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 ho(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 BU(s,0,r)}function aue(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<ao(100*t,0,100)}var Mm="[SessionRecording]",ii=bi(Mm);function Xb(){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 oue=3e5,lue=[Mo.MouseMove,Mo.MouseInteraction,Mo.Scroll,Mo.ViewportResize,Mo.Input,Mo.TouchMove,Mo.MediaInteraction,Mo.Drag],CM=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}(jU(HU(JSON.stringify(e))))}function SM(e){return e.type===pc.Custom&&e.data.tag==="sessionIdle"}function kM(e,t){return t.some(n=>n.matching==="regex"&&new RegExp(n.url).test(e))}let cue=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(Mm+" 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:oue}get isSampled(){var t=this.instance.get_property(Pm);return bc(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(KE),n=!this.instance.config.disable_session_recording;return Xe&&t&&n}get isConsoleLogCaptureEnabled(){var t=!!this.instance.get_property(ZN),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(nM),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:ao(d,0,12,"canvas recording fps",4),quality:ao(f,0,1,"canvas recording quality",.4)}}get networkPayloadCapture(){var t,n,s=this.instance.get_property(eM),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=zs(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,l=!!(bc(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(tM),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 It(u)&&It(d)&&It(f)?void 0:{maskAllInputs:u==null||u,maskTextSelector:d,blockSelector:f}}get sampleRate(){var t=this.instance.get_property(sM);return Mi(t)?t:null}get minimumDuration(){var t=this.instance.get_property(rM);return Mi(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":bc(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(St(this,"queuedRRWebEvents",[]),St(this,"isIdle","unknown"),St(this,"_linkedFlagSeen",!1),St(this,"_lastActivityTimestamp",Date.now()),St(this,"_linkedFlag",null),St(this,"_removePageViewCaptureHook",void 0),St(this,"_onSessionIdListener",void 0),St(this,"_persistDecideOnSessionListener",void 0),St(this,"_samplingSessionListener",void 0),St(this,"_urlTriggers",[]),St(this,"_urlBlocklist",[]),St(this,"_urlBlocked",!1),St(this,"_eventTriggers",[]),St(this,"_removeEventTriggerCaptureHook",void 0),St(this,"_forceAllowLocalhostNetworkCapture",!1),St(this,"_onBeforeUnload",()=>{this._flushBuffer()}),St(this,"_onOffline",()=>{this._tryAddCustomEvent("browser offline",{})}),St(this,"_onOnline",()=>{this._tryAddCustomEvent("browser online",{})}),St(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 ii.error("started without valid sessionManager"),new Error(Mm+" started without valid sessionManager. This is a bug.");if(this.instance.config.__preview_experimental_cookieless_mode)throw new Error(Mm+" 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&&ii.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),nr(Xe,"beforeunload",this._onBeforeUnload),nr(Xe,"offline",this._onOffline),nr(Xe,"online",this._onOnline),nr(Xe,"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){ii.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,Xe?.removeEventListener("beforeunload",this._onBeforeUnload),Xe?.removeEventListener("offline",this._onOffline),Xe?.removeEventListener("online",this._onOnline),Xe?.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,ii.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(Mi(r)){var i=this.isSampled,a=s||!bc(i),o=a?aue(t,r):i;a&&(o?this._reportStarted("sampled"):ii.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=zs(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(){Mi(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 x=(a=t.sessionRecording)===null||a===void 0?void 0:a.minimumDurationMilliseconds;s.register({[KE]:!!t.sessionRecording,[ZN]:(o=t.sessionRecording)===null||o===void 0?void 0:o.consoleLogRecordingEnabled,[eM]:et({capturePerformance:t.capturePerformance},(l=t.sessionRecording)===null||l===void 0?void 0:l.networkPayloadCapture),[tM]:(u=t.sessionRecording)===null||u===void 0?void 0:u.masking,[nM]:{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},[sM]:b,[rM]:It(x)?null:x,[iM]:(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(!It(Object.assign)&&!It(Array.from)&&!(this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut())){var n,s;this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),Xb()?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 ii.error("could not load recorder",r);this._onScriptLoaded()}),ii.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(iM))===null||s===void 0?void 0:s.script)||"recorder"}isInteractiveEvent(t){var n;return t.type===3&&lue.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}):ii.warn("could not emit queued rrweb event.",n,t),!1}}_tryAddCustomEvent(t,n){return this._tryRRWebMethod(CM(()=>Xb().addCustomEvent(t,n)))}_tryTakeFullSnapshot(){return this._tryRRWebMethod(CM(()=>Xb().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=et({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=Xb();if(u){this.mutationRateLimiter=(t=this.mutationRateLimiter)!==null&&t!==void 0?t:new Xce(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");ii.info(g,{node:p}),this.log(Mm+" "+g,"warn")}});var d=this._gatherRRWebPlugins();this.stopRrweb=u(et({emit:f=>{this.onRRwebEmit(f)},plugins:d},i)),this._lastActivityTimestamp=Date.now(),this.isIdle=bc(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 ii.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)&&(!gce.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?i.push(o(Yce(this.instance.config,this.networkPayloadCapture))):ii.info("NetworkCapture not started because we are on localhost.")),i}onRRwebEmit(t){var n;if(this._processQueuedEvents(),t&&zs(t)){if(t.type===pc.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===pc.Custom&&f.data.tag==="recording paused"}(t)){t.type===pc.FullSnapshot&&this._scheduleFullSnapshot(),t.type===pc.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&&zs(p)&&p.type===6&&zs(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||SM(i)){if(SM(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(J_(f)<1024)return f;try{if(f.type===pc.FullSnapshot)return et(et({},f),{},{data:Pd(f.data),cv:"2024-10"});if(f.type===pc.IncrementalSnapshot&&f.data.source===Mo.Mutation)return et(et({},f),{},{cv:"2024-10",data:et(et({},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===pc.IncrementalSnapshot&&f.data.source===Mo.StyleSheetRule)return et(et({},f),{},{cv:"2024-10",data:et(et({},f.data),{},{adds:f.data.adds?Pd(f.data.adds):void 0,removes:f.data.removes?Pd(f.data.removes):void 0})})}catch(p){ii.error("could not compress event - will use uncompressed event",p)}return f}(i):i,d={$snapshot_bytes:J_(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&&Xe){var t=this._maskUrl(Xe.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=Mi(n)&&n>=0,r=Mi(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&&iT(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:mc.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(Xe!==void 0&&Xe.location.href){var t=Xe.location.href,n=this._urlBlocked,s=kM(t,this._urlBlocklist);s&&!n?this._pauseRecording():!s&&n&&this._resumeRecording(),kM(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),ii.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"}),ii.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){ii.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}),ii.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=bi("[SegmentIntegration]");function uue(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()||Nu();s.config.get_device_id=u,l.id()&&(s.register({distinct_id:l.id(),$device_id:u()}),s.persistence.set_property(fc,"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 UU="posthog-js";function GU(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=>et(et({},b),{},{stacktrace:b.stacktrace?et(et({},b.stacktrace),{},{type:"raw",frames:(b.stacktrace.frames||[]).map(x=>et(et({},x),{},{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 due=class{constructor(t,n,s,r,i){this.name=UU,this.setupOnce=function(a){a(GU(t,{organization:n,projectId:s,prefix:r,severityAllowList:i}))}}};var gc,hue=Xe!=null&&Xe.location?Q_(Xe.location.hash,"__posthog")||Q_(location.hash,"state"):null,EM="_postHogToolbarParams",TM=bi("[Toolbar]");(function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"})(gc||(gc={}));class fue{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:gc.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(!Xe||!Ot)return!1;s=(t=s)!==null&&t!==void 0?t:Xe.location,i=(n=i)!==null&&n!==void 0?n:Xe.history;try{if(!r){try{Xe.localStorage.setItem("test","test"),Xe.localStorage.removeItem("test")}catch{return!1}r=Xe?.localStorage}var a,o=hue||Q_(s.hash,"__posthog")||Q_(s.hash,"state"),l=o?KN(()=>JSON.parse(atob(decodeURIComponent(o))))||KN(()=>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(EM)||"{}")).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):TM.warn("No toolbar load function found")}loadToolbar(t){var n=!(Ot==null||!Ot.getElementById(bU));if(!Xe||n)return!1;var s=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=et(et({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(Xe.localStorage.setItem(EM,JSON.stringify(et(et({},r),{},{source:void 0}))),this.getToolbarState()===gc.LOADED)this._callLoadToolbar(r);else if(this.getToolbarState()===gc.UNINITIALIZED){var i,a;this.setToolbarState(gc.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 TM.error("[Toolbar] Failed to load",o),void this.setToolbarState(gc.UNINITIALIZED);this.setToolbarState(gc.LOADED),this._callLoadToolbar(r)}),nr(Xe,"turbolinks:load",()=>{this.setToolbarState(gc.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 pue=bi("[TracingHeaders]");class gue{constructor(t){St(this,"_restoreXHRPatch",void 0),St(this,"_restoreFetchPatch",void 0),St(this,"_startCapturing",()=>{var n,s,r,i;It(this._restoreXHRPatch)&&((n=hn.__PosthogExtensions__)===null||n===void 0||(s=n.tracingHeadersPatchFns)===null||s===void 0||s._patchXHR(this.instance.sessionManager)),It(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 pue.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=bi("[Web Vitals]"),RM=9e5;class mue{constructor(t){var n;St(this,"_enabledServerSide",!1),St(this,"_initialized",!1),St(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),St(this,"_flushToCapture",()=>{clearTimeout(this._delayedFlushTimer),this.buffer.metrics.length!==0&&(this.instance.capture("$web_vitals",this.buffer.metrics.reduce((s,r)=>et(et({},s),{},{["$web_vitals_".concat(r.name,"_event")]:et({},r),["$web_vitals_".concat(r.name,"_value")]:r.value}),{})),this.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})}),St(this,"_addToBuffer",s=>{var r,i=(r=this.instance.sessionManager)===null||r===void 0?void 0:r.checkAndGetSessionAndWindowId(!0);if(It(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();It(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)),It(this.buffer.url)&&(this.buffer.url=a),this.buffer.firstMetricTimestamp=It(this.buffer.firstMetricTimestamp)?Date.now():this.buffer.firstMetricTimestamp,s.attribution&&s.attribution.interactionTargetElement&&(s.attribution.interactionTargetElement=void 0),this.buffer.metrics.push(et(et({},s),{},{$current_url:a,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()))}}),St(this,"_startCapturing",()=>{var s,r,i,a,o=hn.__PosthogExtensions__;It(o)||It(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[QN]),this.startIfEnabled()}get allowedMetrics(){var t,n,s=zs(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 It(s)?((n=this.instance.persistence)===null||n===void 0?void 0:n.props[JN])||["CLS","FCP","INP","LCP"]:s}get flushToCaptureTimeoutMs(){return(zs(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){var t=zs(this.instance.config.capture_performance)&&Mi(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:RM;return 0<t&&t<=6e4?RM:t}get isEnabled(){var t=ea?.protocol;if(t!=="http:"&&t!=="https:")return fu.info("Web Vitals are disabled on non-http/https protocols"),!1;var n=zs(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:bc(this.instance.config.capture_performance)?this.instance.config.capture_performance:void 0;return bc(n)?n:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(fu.info("enabled, starting..."),this.loadScript(this._startCapturing))}onRemoteConfig(t){var n=zs(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=zs(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this.instance.persistence&&(this.instance.persistence.register({[QN]:n}),this.instance.persistence.register({[JN]: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=Xe?Xe.location.href:void 0;return t||fu.error("Could not determine current URL"),t}}var vue=bi("[Heatmaps]");function AM(e){return zs(e)&&"clientX"in e&&"clientY"in e&&Mi(e.clientX)&&Mi(e.clientY)}class bue{constructor(t){var n;St(this,"rageclicks",new AU),St(this,"_enabledServerSide",!1),St(this,"_initialized",!1),St(this,"_flushInterval",null),this.instance=t,this._enabledServerSide=!((n=this.instance.persistence)===null||n===void 0||!n.props[qE])}get flushIntervalMilliseconds(){var t=5e3;return zs(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 It(this.instance.config.capture_heatmaps)?It(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;vue.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({[qE]: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(){Xe&&Ot&&(nr(Xe,"beforeunload",this.flush.bind(this)),nr(Ot,"click",t=>this._onClick(t||Xe?.event),{capture:!0}),nr(Ot,"mousemove",t=>this._onMouseMove(t||Xe?.event),{capture:!0}),this.deadClicksCapture=new DU(this.instance,Dce,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,Xe?.getComputedStyle(d).position))return!0;d=CU(d)}return!1}(yU(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(!oM(t.target)&&AM(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(et(et({},r),{},{type:"rageclick"})),this._capture(r)}}_onMouseMove(t){!oM(t.target)&&AM(t)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(t,"mousemove"))},500))}_capture(t){if(Xe){var n=Xe.location.href;this.buffer=this.buffer||{},this.buffer[n]||(this.buffer[n]=[]),this.buffer[n].push(t)}}flush(){this.buffer&&!ip(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class xue{constructor(t){this._instance=t}doPageView(t,n){var s,r=this._previousPageViewProperties(t,n);return this._currentPageview={pathname:(s=Xe?.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(!(It(a)||It(o)||It(l)||It(u)||It(d)||It(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:ao(o/a,0,1),g=a<=1?1:ao(l/a,0,1),v=u<=1?1:ao(d/u,0,1),b=u<=1?1:ao(f/u,0,1);r=er(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 _ue=class{constructor(t){this.instance=t}sendExceptionEvent(t){this.instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent"})}};var fo="Mobile",ew="iOS",Rl="Android",ev="Tablet",VU=Rl+" "+ev,WU="iPad",zU="Apple",$U=zU+" Watch",tv="Safari",$p="BlackBerry",qU="Samsung",KU=qU+"Browser",YU=qU+" Internet",Ah="Chrome",wue=Ah+" OS",XU=Ah+" "+ew,R2="Internet Explorer",QU=R2+" "+fo,A2="Opera",yue=A2+" Mini",F2="Edge",JU="Microsoft "+F2,vp="Firefox",ZU=vp+" "+ew,nv="Nintendo",sv="PlayStation",bp="Xbox",eG=Rl+" "+fo,tG=fo+" "+tv,Om="Windows",hT=Om+" Phone",FM="Nokia",fT="Ouya",nG="Generic",Cue=nG+" "+fo.toLowerCase(),sG=nG+" "+ev.toLowerCase(),pT="Konqueror",Di="(\\d+(\\.\\d+)?)",iS=new RegExp("Version/"+Di),Sue=new RegExp(bp,"i"),kue=new RegExp(sv+" \\w+","i"),Eue=new RegExp(nv+" \\w+","i"),D2=new RegExp($p+"|PlayBook|BB10","i"),Tue={"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"},gT,Rue=(e,t)=>t&&En(t,zU)||function(n){return En(n,tv)&&!En(n,Ah)&&!En(n,Rl)}(e),DM=function(e,t){return t=t||"",En(e," OPR/")&&En(e,"Mini")?yue:En(e," OPR/")?A2:D2.test(e)?$p:En(e,"IE"+fo)||En(e,"WPDesktop")?QU:En(e,KU)?YU:En(e,F2)||En(e,"Edg/")?JU:En(e,"FBIOS")?"Facebook "+fo:En(e,"UCWEB")||En(e,"UCBrowser")?"UC Browser":En(e,"CriOS")?XU:En(e,"CrMo")||En(e,Ah)?Ah:En(e,Rl)&&En(e,tv)?eG:En(e,"FxiOS")?ZU:En(e.toLowerCase(),pT.toLowerCase())?pT:Rue(e,t)?En(e,fo)?tG:tv:En(e,vp)?vp:En(e,"MSIE")||En(e,"Trident/")?R2:En(e,"Gecko")?vp:""},Aue={[QU]:[new RegExp("rv:"+Di)],[JU]:[new RegExp(F2+"?\\/"+Di)],[Ah]:[new RegExp("("+Ah+"|CrMo)\\/"+Di)],[XU]:[new RegExp("CriOS\\/"+Di)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Di)],[tv]:[iS],[tG]:[iS],[A2]:[new RegExp("(Opera|OPR)\\/"+Di)],[vp]:[new RegExp(vp+"\\/"+Di)],[ZU]:[new RegExp("FxiOS\\/"+Di)],[pT]:[new RegExp("Konqueror[:/]?"+Di,"i")],[$p]:[new RegExp($p+" "+Di),iS],[eG]:[new RegExp("android\\s"+Di,"i")],[YU]:[new RegExp(KU+"\\/"+Di)],[R2]:[new RegExp("(rv:|MSIE )"+Di)],Mozilla:[new RegExp("rv:"+Di)]},IM=[[new RegExp(bp+"; "+bp+" (.*?)[);]","i"),e=>[bp,e&&e[1]||""]],[new RegExp(nv,"i"),[nv,""]],[new RegExp(sv,"i"),[sv,""]],[D2,[$p,""]],[new RegExp(Om,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[hT,""];if(new RegExp(fo).test(t)&&!/IEMobile\b/.test(t))return[Om+" "+fo,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var s=n[1],r=Tue[s]||"";return/arm/i.test(t)&&(r="RT"),[Om,r]}return[Om,""]}],[/((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=It(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/,[wue,""]],[/Linux|debian/i,["Linux",""]]],PM=function(e){return Eue.test(e)?nv:kue.test(e)?sv:Sue.test(e)?bp:new RegExp(fT,"i").test(e)?fT:new RegExp("("+hT+"|WPDesktop)","i").test(e)?hT:/iPad/.test(e)?WU:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?$U:D2.test(e)?$p:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(FM,"i").test(e)?FM:/(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(fo).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:VU:Rl:new RegExp("(pda|"+fo+")","i").test(e)?Cue:new RegExp(ev,"i").test(e)&&!new RegExp(ev+" pc","i").test(e)?sG:""},Qb="https?://(.*)",n_=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","irclid","_kx"],Fue=Jx(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],n_),aS="<masked>",Ds={campaignParams:function(){var{customTrackedParams:e,maskPersonalDataProperties:t,customPersonalDataProperties:n}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!Ot)return{};var s=t?Jx([],n_,n||[]):[];return this._campaignParamsFromUrl(K1(Ot.URL,s,aS),e)},_campaignParamsFromUrl:function(e,t){var n=Fue.concat(t||[]),s={};return ds(n,function(r){var i=X_(e,r);s[r]=i||null}),s},_searchEngine:function(e){return e?e.search(Qb+"google.([^/?]*)")===0?"google":e.search(Qb+"bing.com")===0?"bing":e.search(Qb+"yahoo.com")===0?"yahoo":e.search(Qb+"duckduckgo.com")===0?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){var t=Ds._searchEngine(e),n=t!="yahoo"?"q":"p",s={};if(!hd(t)){s.$search_engine=t;var r=Ot?X_(Ot.referrer,n):"";r.length&&(s.ph_keyword=r)}return s},searchInfo:function(){var e=Ot?.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:DM,browserVersion:function(e,t){var n=DM(e,t),s=Aue[n];if(It(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<IM.length;t++){var[n,s]=IM[t],r=n.exec(e),i=r&&(Wo(s)?s(r,e):s);if(i)return i}return["",""]},device:PM,deviceType:function(e){var t=PM(e);return t===WU||t===VU||t==="Kobo"||t==="Kindle Fire"||t===sG?ev:t===nv||t===bp||t===sv||t===fT?"Console":t===$U?"Wearable":t?fo:"Desktop"},referrer:function(){return Ot?.referrer||"$direct"},referringDomain:function(){var e;return Ot!=null&&Ot.referrer&&((e=mp(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?Jx([],n_,t||[]):[],s=ea?.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=mp(n))===null||t===void 0?void 0:t.host};if(s){r.$current_url=s;var i=mp(s);r.$host=i?.host,r.$pathname=i?.pathname;var a=this._campaignParamsFromUrl(s);er(r,a)}if(n){var o=this._searchInfoFromReferrer(n);er(r,o)}return r},initialPersonPropsFromInfo:function(e){var t=this.personPropsFromInfo(e),n={};return ds(t,function(s,r){n["$initial_".concat(C2(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?Jx([],n_,t||[]):[],[s,r]=Ds.os(hr);return er(Z0({$os:s,$os_version:r,$browser:Ds.browser(hr,navigator.vendor),$device:Ds.device(hr),$device_type:Ds.deviceType(hr),$timezone:Ds.timezone(),$timezone_offset:Ds.timezoneOffset()}),{$current_url:K1(ea?.href,n,aS),$host:ea?.host,$pathname:ea?.pathname,$raw_user_agent:hr.length>1e3?hr.substring(0,997)+"...":hr,$browser_version:Ds.browserVersion(hr,navigator.vendor),$browser_language:Ds.browserLanguage(),$browser_language_prefix:Ds.browserLanguagePrefix(),$screen_height:Xe?.screen.height,$screen_width:Xe?.screen.width,$viewport_height:Xe?.innerHeight,$viewport_width:Xe?.innerWidth,$lib:"web",$lib_version:mc.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]=Ds.os(hr);return er(Z0({$os:e,$os_version:t,$browser:Ds.browser(hr,navigator.vendor)}),{$browser_version:Ds.browserVersion(hr,navigator.vendor)})}},bl=bi("[FeatureFlags]"),oS="$active_feature_flags",Af="$override_feature_flags",NM="$feature_flag_payloads",sm="$override_feature_flag_payloads",MM="$feature_flag_request_id",OM=e=>{var t={};for(var[n,s]of Zx(e||{}))s&&(t[n]=s);return t},Due=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"})(gT||(gT={}));class Iue{constructor(t){St(this,"_override_warning",!1),St(this,"_hasLoadedFlags",!1),St(this,"_requestInFlight",!1),St(this,"_reloadingDisabled",!1),St(this,"_additionalReloadRequested",!1),St(this,"_decideCalled",!1),St(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(YE),n=this.instance.get_property(Af),s=this.instance.get_property(sm);if(!s&&!n)return t||{};var r=er({},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=It(d)?(o=u?.enabled)!==null&&o!==void 0&&o:!!d,p=It(d)?u.variant:typeof d=="string"?d:void 0,g=s?.[a],v=et(et({},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=et(et({},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(ap),n=this.instance.get_property(Af);if(!n)return t||{};for(var s=er({},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(NM),n=this.instance.get_property(sm);if(!n)return t||{};for(var s=er({},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:et(et({},((n=this.instance.persistence)===null||n===void 0?void 0:n.get_initial_props())||{}),this.instance.get_property(Nm)||{}),group_properties:this.instance.get_property(Hd)};(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=Ds.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(gT.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(MM)||void 0,a=this.instance.get_property(q_)||{};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,_;Ws(a[t])?a[t].push(r):a[t]=[r],(o=this.instance.persistence)===null||o===void 0||o.register({[q_]: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};It(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&&(x=w.metadata)!==null&&x!==void 0&&x.id&&(y.$feature_flag_id=w.metadata.id),It(w?.original_variant)&&It(w?.original_enabled)||(y.$feature_flag_original_response=It(w.original_variant)?w.original_enabled:w.original_variant),w!=null&&(_=w.metadata)!==null&&_!==void 0&&_.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=Due(a),p=f.flags,g=f.featureFlags,v=f.featureFlagPayloads;if(g){var b=a.requestId;if(Ws(g)){bl.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var x={};if(g)for(var _=0;_<g.length;_++)x[g[_]]=!0;o&&o.register({[oS]:g,[ap]:x})}else{var w=g,y=v,S=p;a.errorsWhileComputingFlags&&(w=et(et({},l),w),y=et(et({},u),y),S=et(et({},d),S)),o&&o.register(et({[oS]:Object.keys(OM(w)),[ap]:w||{},[NM]:y||{},[YE]:S||{}},b?{[MM]: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(Af),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(Af);else if(s.flags)if(Ws(s.flags)){for(var r={},i=0;i<s.flags.length;i++)r[s.flags[i]]=!0;this.instance.persistence.register({[Af]:r})}else this.instance.persistence.register({[Af]: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(e_)||[]).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=et(et({},this.getFlagVariants()),{},{[t]:n});(s=this.instance.persistence)===null||s===void 0||s.register({[oS]:Object.keys(OM(o)),[ap]: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(e_),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({[e_]: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(Nm)||{};this.instance.register({[Nm]:et(et({},s),t)}),n&&this.instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this.instance.unregister(Nm)}setGroupPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],s=this.instance.get_property(Hd)||{};Object.keys(s).length!==0&&Object.keys(s).forEach(r=>{s[r]=et(et({},s[r]),t[r]),delete t[r]}),this.instance.register({[Hd]:et(et({},s),t)}),n&&this.instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var n=this.instance.get_property(Hd)||{};this.instance.register({[Hd]:et(et({},n),{},{[t]:{}})})}else this.instance.unregister(Hd)}}var Pue=["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&&Wt.info("Persistence loaded",t.persistence,et({},this.props)),this.update_config(t,t),this.save()}buildStorage(t){Pue.indexOf(t.persistence.toLowerCase())===-1&&(Wt.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n=t.persistence.toLowerCase();return n==="localstorage"&&br.is_supported()?br:n==="localstorage+cookie"&&zb.is_supported()?zb:n==="sessionstorage"&&qr.is_supported()?qr:n==="memory"?Ace:n==="cookie"?kc:zb.is_supported()?zb:kc}properties(){var t={};return ds(this.props,function(n,s){if(s===ap&&zs(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=oce)?l:WN&&a.indexOf===WN?a.indexOf(o)!=-1:(ds(a,function(u){if(l||(l=u===o))return z_}),l))||(t[s]=n);var a,o,l}),t}load(){if(!this.disabled){var t=this.storage.parse(this.name);t&&(this.props=er({},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(zs(t)){It(n)&&(n="None"),this.expire_days=It(s)?this.default_expiry:s;var r=!1;if(ds(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(zs(t)){this.expire_days=It(n)?this.default_expiry:n;var s=!1;if(ds(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=Ds.campaignParams({customTrackedParams:this.config.custom_campaign_params,maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});ip(Z0(t))||this.register(t),this.campaign_params_saved=!0}}update_search_keyword(){this.register(Ds.searchInfo())}update_referrer_info(){this.register_once(Ds.referrerInfo(),void 0)}set_initial_person_info(){this.props[ZE]||this.props[eT]||this.register_once({[tT]:Ds.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={};ds([eT,ZE],r=>{var i=this.props[r];i&&ds(i,function(a,o){t["$initial_"+C2(o)]=a})});var n=this.props[tT];if(n){var s=Ds.initialPersonPropsFromInfo(n);er(t,s)}return t}safe_merge(t){return ds(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[Im]||{};s[t]=n,this.props[Im]=s,this.save()}remove_event_timer(t){var n=(this.props[Im]||{})[t];return It(n)||(delete this.props[Im][t],this.save()),n}get_property(t){return this.props[t]}set_property(t,n){this.props[t]=n,this.save()}}var rG,qs,iG,$d,LM,aG,mT,oG,BM,vT,jM,HM,UM,GM,bT={},lG=[],Nue=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,I2=Array.isArray;function Mu(e,t){for(var n in t)e[n]=t[n];return e}function cG(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??++iG,__i:-1,__u:0};return r==null&&qs.vnode!=null&&qs.vnode(i),i}function P2(e){return e.children}function s_(e,t){this.props=e,this.context=t}function qp(e,t){if(t==null)return e.__?qp(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"?qp(e):null}function uG(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 uG(e)}}function xT(e){(!e.__d&&(e.__d=!0)&&$d.push(e)&&!tw.__r++||LM!==qs.debounceRendering)&&((LM=qs.debounceRendering)||aG)(tw)}function tw(){var e,t,n,s,r,i,a,o,l;for($d.sort(mT);e=$d.shift();)e.__d&&(t=$d.length,s=void 0,i=(r=(n=e).__v).__e,o=[],l=[],(a=n.__P)&&((s=Mu({},r)).__v=r.__v+1,qs.vnode&&qs.vnode(s),fG(a,s,r,n.__n,a.ownerSVGElement!==void 0,32&r.__u?[i]:null,o,i??qp(r),!!(32&r.__u),l),s.__.__k[s.__i]=s,Lue(o,s,l),s.__e!=i&&uG(s)),$d.length>t&&$d.sort(mT));tw.__r=0}function dG(e,t,n,s,r,i,a,o,l,u,d){var f,p,g,v,b,x=s&&s.__k||lG,_=t.length;for(n.__d=l,Mue(n,t,x),l=n.__d,f=0;f<_;f++)(g=n.__k[f])!=null&&typeof g!="boolean"&&typeof g!="function"&&(p=g.__i===-1?bT:x[g.__i]||bT,g.__i=f,fG(e,g,p,r,i,a,o,l,u,d),v=g.__e,g.ref&&p.ref!=g.ref&&(p.ref&&N2(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=hG(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 Mue(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):I2(r)?cS(P2,{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=Oue(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=qp(i)),_T(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=qp(i)),_T(i,i))}function hG(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=hG(s[r],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Oue(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 VM(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Nue.test(t)?n:n+"px"}function Jb(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||VM(e.style,t,"");if(n)for(t in n)s&&n[t]===s[t]||VM(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?zM:WM,i)):e.removeEventListener(t,i?zM:WM,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 WM(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(qs.event?qs.event(e):e)}function zM(e){return this.l[e.type+!0](qs.event?qs.event(e):e)}function fG(e,t,n,s,r,i,a,o,l,u){var d,f,p,g,v,b,x,_,w,y,S,C,E,k,F,A=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),i=[o=t.__e=n.__e]),(d=qs.__b)&&d(t);e:if(typeof A=="function")try{if(_=t.props,w=(d=A.contextType)&&s[d.__c],y=d?w?w.props.value:d.__:s,n.__c?x=(f=t.__c=n.__c).__=f.__E:("prototype"in A&&A.prototype.render?t.__c=f=new A(_,y):(t.__c=f=new s_(_,y),f.constructor=A,f.render=jue),w&&w.sub(f),f.props=_,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),A.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Mu({},f.__s)),Mu(f.__s,A.getDerivedStateFromProps(_,f.__s))),g=f.props,v=f.state,f.__v=t,p)A.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(A.getDerivedStateFromProps==null&&_!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(_,y),!f.__e&&(f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(_,f.__s,y)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(f.props=_,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(_,f.__s,y),f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,v,b)})}if(f.context=y,f.props=_,f.__P=e,f.__e=!1,C=qs.__r,E=0,"prototype"in A&&A.prototype.render){for(f.state=f.__s,f.__d=!1,C&&C(t),d=f.render(f.props,f.state,f.context),k=0;k<f._sb.length;k++)f.__h.push(f._sb[k]);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&&++E<25);f.state=f.__s,f.getChildContext!=null&&(s=Mu(Mu({},s),f.getChildContext())),p||f.getSnapshotBeforeUpdate==null||(b=f.getSnapshotBeforeUpdate(g,v)),dG(e,I2(F=d!=null&&d.type===P2&&d.key==null?d.props.children:d)?F:[F],t,n,s,r,i,a,o,l,u),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),x&&(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),qs.__e(I,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Bue(n.__e,t,n,s,r,i,a,l,u);(d=qs.diffed)&&d(t)}function Lue(e,t,n){t.__d=void 0;for(var s=0;s<n.length;s++)N2(n[s],n[++s],n[++s]);qs.__c&&qs.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(i){i.call(r)})}catch(i){qs.__e(i,r.__v)}})}function Bue(e,t,n,s,r,i,a,o,l){var u,d,f,p,g,v,b,x=n.props,_=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(_);e=r?document.createElementNS("http://www.w3.org/2000/svg",w):document.createElement(w,_.is&&_),i=null,o=!1}if(w===null)x===_||o&&e.data===_||(e.data=_);else{if(i=i&&rG.call(e.childNodes),x=n.props||bT,!o&&i!=null)for(x={},u=0;u<e.attributes.length;u++)x[(g=e.attributes[u]).name]=g.value;for(u in x)g=x[u],u=="children"||(u=="dangerouslySetInnerHTML"?f=g:u==="key"||u in _||Jb(e,u,null,g,r));for(u in _)g=_[u],u=="children"?p=g:u=="dangerouslySetInnerHTML"?d=g:u=="value"?v=g:u=="checked"?b=g:u==="key"||o&&typeof g!="function"||x[u]===g||Jb(e,u,g,x[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=""),dG(e,I2(p)?p:[p],t,n,s,r&&w!=="foreignObject",i,a,i?i[0]:n.__k&&qp(n,0),o,l),i!=null)for(u=i.length;u--;)i[u]!=null&&cG(i[u]);o||(u="value",v!==void 0&&(v!==e[u]||w==="progress"&&!v||w==="option"&&v!==x[u])&&Jb(e,u,v,x[u],!1),u="checked",b!==void 0&&b!==e[u]&&Jb(e,u,b,x[u],!1))}return e}function N2(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(s){qs.__e(s,n)}}function _T(e,t,n){var s,r;if(qs.unmount&&qs.unmount(e),(s=e.ref)&&(s.current&&s.current!==e.__e||N2(s,null,t)),(s=e.__c)!=null){if(s.componentWillUnmount)try{s.componentWillUnmount()}catch(i){qs.__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]&&_T(s[r],t,n||typeof e.type!="function");n||e.__e==null||cG(e.__e),e.__=e.__e=e.__d=void 0}function jue(e,t,n){return this.constructor(e,n)}rG=lG.slice,qs={__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}},iG=0,s_.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))},s_.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),xT(this))},s_.prototype.render=P2,$d=[],aG=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,mT=function(e,t){return e.__v.__b-t.__v.__b},tw.__r=0,oG=0,function(e){e.Button="button",e.Tab="tab",e.Selector="selector"}(BM||(BM={})),function(e){e.Left="left",e.Center="center",e.Right="right",e.NextToTrigger="next_to_trigger"}(vT||(vT={})),function(e){e.Popover="popover",e.API="api",e.Widget="widget"}(jM||(jM={})),function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"}(HM||(HM={})),function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"}(UM||(UM={})),function(e){e.Once="once",e.Recurring="recurring",e.Always="always"}(GM||(GM={}));var Kp=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}},Wr=bi("[Surveys]"),$M={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=>Kp(t,n)),not_regex:(e,t)=>e.every(n=>!Kp(t,n)),exact:(e,t)=>e.some(n=>t===n),is_not:(e,t)=>e.every(n=>t!==n)};function qM(e){return e??"icontains"}vT.Right;(function(e,t){var n={__c:t="__cC"+oG++,__: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 pG=class{constructor(){St(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)}},Hue=class Kf{constructor(t){St(this,"_debugEventEmitter",new pG),St(this,"checkStep",(n,s)=>this.checkStepEvent(n,s)&&this.checkStepUrl(n,s)&&this.checkStepElement(n,s)),St(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(!It((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(!It((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"||!Kf.matchString(r,n?.url,n?.url_matching||"contains"))return!1}return!0}static matchString(t,n,s){switch(s){case"regex":return!!Xe&&Kp(t,n);case"exact":return n===t;case"contains":var r=Kf.escapeStringRegexp(n).replace(/_/g,".").replace(/%/g,".*");return Kp(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&&!Kf.matchString(i.href||"",n?.href,n?.href_matching||"exact"))&&(n==null||!n.tag_name||i.tag_name===n?.tag_name)&&!(n!=null&&n.text&&!Kf.matchString(i.text||"",n?.text,n?.text_matching||"exact")&&!Kf.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}},wT=class gG{constructor(t){this.instance=t,this.eventToSurveys=new Map,this.actionToSurveys=new Map}register(t){var n;It((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 Hue(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[Wb])||[];if(gG.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[Wb])||[];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({[Wb]:[...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[Wb];return s||[]}getEventToSurveys(){return this.eventToSurveys}_getActionMatcher(){return this.actionMatcher}};St(wT,"SURVEY_SHOWN_EVENT_NAME","survey shown");let Uue=class{constructor(t){St(this,"_isFetchingSurveys",!1),St(this,"_isInitializingSurveys",!1),St(this,"_surveyCallbacks",[]),this.instance=t,this._surveyEventReceiver=null}onRemoteConfig(t){var n=t.surveys;if(ss(n))return Wr.warn("Decide not loaded yet. Not loading surveys.");var s=Ws(n);this._hasSurveys=s?n.length>0:n,Wr.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)Wr.info("Already initializing surveys, skipping...");else if(this.instance.config.disable_surveys)Wr.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 wT(this.instance),Wr.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 Wr.error("Could not load surveys script",i),void(this._isInitializingSurveys=!1);this._surveyManager=t.generateSurveys(this.instance),this._isInitializingSurveys=!1,this._surveyEventReceiver=new wT(this.instance),Wr.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})});else{var r="PostHog loadExternalDependency extension not found. Cannot load remote config.";Wr.error(r),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:r})}}}catch(i){throw Wr.error("Error initializing surveys",i),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:"Error initializing surveys"}),i}}else Wr.info("No surveys to load.");else Wr.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 Wr.info("Disabled. Not loading surveys."),t([]);var s=this.instance.get_property(XE);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 Wr.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,E,k;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||(x=b.events)===null||x===void 0||(_=x.values)===null||_===void 0?void 0:_.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||(E=C.actions)===null||E===void 0||(k=E.values)===null||k===void 0?void 0:k.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({[XE]: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){Wr.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,x;if((v=g.conditions)===null||v===void 0||!v.url)return!0;var _=Xe==null||(b=Xe.location)===null||b===void 0?void 0:b.href;if(!_)return!1;var w=[g.conditions.url];return $M[qM((x=g.conditions)===null||x===void 0?void 0:x.urlMatchType)](w,_)}(l),f=(u=l.conditions)===null||u===void 0||!u.selector||Ot?.querySelector(l.conditions.selector),p=function(g){var v,b,x;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 _=Ds.deviceType(hr);return $M[qM((x=g.conditions)===null||x===void 0?void 0:x.deviceTypesMatchType)](g.conditions.deviceTypes,_)}(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||(x=b.actions)===null||x===void 0||(_=x.values)===null||_===void 0?void 0:_.length)!==null&&v!==void 0?v:0)>0,E=!S&&!C||a?.includes(l.id),k=this._canActivateRepeatedly(l)||this.isSurveyFeatureFlagEnabled(l.internal_targeting_flag_key),F=this.checkFlags(l);return w&&y&&k&&E&&F});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)?(Wr.warn("init was not called"),!1):hn.__PosthogExtensions__.canActivateRepeatedly(t)}canRenderSurvey(t){if(ss(this._surveyManager))return Wr.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?et({},this._surveyManager.canRenderSurvey(r)):{visible:!1,disabledReason:"Survey not found"}}),n}renderSurvey(t,n){ss(this._surveyManager)?Wr.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 KM=bi("[RateLimiter]");let Gue=class{constructor(t){var n,s;St(this,"serverLimits",{}),St(this,"lastEventRateLimited",!1),St(this,"checkForLimiting",r=>{var i=r.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(a=>{KM.info("".concat(a||"events"," is quota limited.")),this.serverLimits[a]=new Date().getTime()+6e4})}catch(a){return void KM.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(JE))!==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(JE,a),{isRateLimited:o,remainingTokens:a.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}};var Nd=bi("[RemoteConfig]");let Vue=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)):(Nd.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 Nd.info("Using preloaded remote config",this.remoteConfig),void this.onRemoteConfig(this.remoteConfig);if(this.instance.config.advanced_disable_decide)return void Nd.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(t=>{if(!t)return Nd.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){Nd.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()):Nd.info("__preview_remote_config is disabled. Logging config instead",t):Nd.error("Failed to fetch remote config from PostHog.")}};var Wue=function(e){var t,n,s,r,i="";for(t=n=0,s=(e=(e+"").replace(/\r\n/g,`
|
|
4
4
|
`).replace(/\r/g,`
|
|
5
5
|
`)).length,r=0;r<s;r++){var a=e.charCodeAt(r),o=null;a<128?n++:o=a>127&&a<2048?String.fromCharCode(a>>6|192,63&a|128):String.fromCharCode(a>>12|224,a>>6&63|128,63&a|128),hd(o)||(n>t&&(i+=e.substring(t,n)),i+=o,t=n=r+1)}return n>t&&(i+=e.substring(t,e.length)),i},zue=!!zE||!!WE,YM="text/plain",nw=(e,t)=>{var[n,s]=e.split("?"),r=et({},t);s?.split("&").forEach(a=>{var[o]=a.split("=");delete r[o]});var i=mce(r);return i=i?(s?s+"&":"")+i:s,"".concat(n,"?").concat(i)},Lm=(e,t)=>JSON.stringify(e,(n,s)=>typeof s=="bigint"?s.toString():s,t),uS=e=>{var{data:t,compression:n}=e;if(t){if(n===Bo.GZipJS){var s=jU(HU(Lm(t)),{mtime:0}),r=new Blob([s],{type:YM});return{contentType:YM,body:r,estimatedSize:r.size}}if(n===Bo.Base64){var i=function(l){var u,d,f,p,g,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",b=0,x=0,_="",w=[];if(!l)return l;l=Wue(l);do u=(g=l.charCodeAt(b++)<<16|l.charCodeAt(b++)<<8|l.charCodeAt(b++))>>18&63,d=g>>12&63,f=g>>6&63,p=63&g,w[x++]=v.charAt(u)+v.charAt(d)+v.charAt(f)+v.charAt(p);while(b<l.length);switch(_=w.join(""),l.length%3){case 1:_=_.slice(0,-2)+"==";break;case 2:_=_.slice(0,-1)+"="}return _}(Lm(t)),a=(l=>"data="+encodeURIComponent(typeof l=="string"?l:Lm(l)))(i);return{contentType:"application/x-www-form-urlencoded",body:a,estimatedSize:new Blob([a]).size}}var o=Lm(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},n0=[];WE&&n0.push({transport:"fetch",method:e=>{var t,n,{contentType:s,body:r,estimatedSize:i}=(t=uS(e))!==null&&t!==void 0?t:{},a=new Headers;ds(e.headers,function(d,f){a.append(f,d)}),s&&a.append("Content-Type",s);var o=e.url,l=null;if(zN){var u=new zN;l={signal:u.signal,timeout:setTimeout(()=>u.abort(),e.timeout)}}WE(o,et({method:e?.method||"GET",headers:a,keepalive:e.method==="POST"&&(i||0)<52428.8,body:r,signal:(n=l)===null||n===void 0?void 0:n.signal},e.fetchOptions)).then(d=>d.text().then(f=>{var p,g={statusCode:d.status,text:f};if(d.status===200)try{g.json=JSON.parse(f)}catch(v){Wt.error(v)}(p=e.callback)===null||p===void 0||p.call(e,g)})).catch(d=>{var f;Wt.error(d),(f=e.callback)===null||f===void 0||f.call(e,{statusCode:0,text:d})}).finally(()=>l?clearTimeout(l.timeout):null)}}),zE&&n0.push({transport:"XHR",method:e=>{var t,n=new zE;n.open(e.method||"GET",e.url,!0);var{contentType:s,body:r}=(t=uS(e))!==null&&t!==void 0?t:{};ds(e.headers,function(i,a){n.setRequestHeader(a,i)}),s&&n.setRequestHeader("Content-Type",s),e.timeout&&(n.timeout=e.timeout),n.withCredentials=!0,n.onreadystatechange=()=>{if(n.readyState===4){var i,a={statusCode:n.status,text:n.responseText};if(n.status===200)try{a.json=JSON.parse(n.responseText)}catch{}(i=e.callback)===null||i===void 0||i.call(e,a)}},n.send(r)}}),Ta!=null&&Ta.sendBeacon&&n0.push({transport:"sendBeacon",method:e=>{var t=nw(e.url,{beacon:"1"});try{var n,{contentType:s,body:r}=(n=uS(e))!==null&&n!==void 0?n:{},i=typeof r=="string"?new Blob([r],{type:s}):r;Ta.sendBeacon(t,i)}catch{}}});var yT=3e3;let $ue=class{constructor(t,n){St(this,"isPaused",!0),St(this,"queue",[]),this.flushTimeoutMs=ao(n?.flush_interval_ms||yT,250,5e3,"flush interval",yT),this.sendRequest=t}enqueue(t){this.queue.push(t),this.flushTimeout||this.setFlushTimeout()}unload(){this.clearFlushTimeout();var t=this.queue.length>0?this.formatQueue():{},n=Object.values(t),s=[...n.filter(r=>r.url.indexOf("/e")===0),...n.filter(r=>r.url.indexOf("/e")!==0)];s.map(r=>{this.sendRequest(et(et({},r),{},{transport:"sendBeacon"}))})}enable(){this.isPaused=!1,this.setFlushTimeout()}setFlushTimeout(){var t=this;this.isPaused||(this.flushTimeout=setTimeout(()=>{if(this.clearFlushTimeout(),this.queue.length>0){var n=this.formatQueue(),s=function(i){var a=n[i],o=new Date().getTime();a.data&&Ws(a.data)&&ds(a.data,l=>{l.offset=Math.abs(l.timestamp-o),delete l.timestamp}),t.sendRequest(a)};for(var r in n)s(r)}},this.flushTimeoutMs))}clearFlushTimeout(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}formatQueue(){var t={};return ds(this.queue,n=>{var s,r=n,i=(r?r.batchKey:null)||r.url;It(t[i])&&(t[i]=et(et({},r),{},{data:[]})),(s=t[i].data)===null||s===void 0||s.push(r.data)}),this.queue=[],t}};var que=["retriesPerformedSoFar"];let Kue=class{constructor(t){St(this,"isPolling",!1),St(this,"pollIntervalMs",3e3),St(this,"queue",[]),this.instance=t,this.queue=[],this.areWeOnline=!0,!It(Xe)&&"onLine"in Xe.navigator&&(this.areWeOnline=Xe.navigator.onLine,nr(Xe,"online",()=>{this.areWeOnline=!0,this.flush()}),nr(Xe,"offline",()=>{this.areWeOnline=!1}))}retriableRequest(t){var{retriesPerformedSoFar:n}=t,s=pU(t,que);Mi(n)&&n>0&&(s.url=nw(s.url,{retry_count:n})),this.instance._send_request(et(et({},s),{},{callback:r=>{var i;r.statusCode!==200&&(r.statusCode<400||r.statusCode>=500)&&(n??0)<10?this.enqueue(et({retriesPerformedSoFar:n},s)):(i=s.callback)===null||i===void 0||i.call(s,r)}}))}enqueue(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var s=function(a){var o=3e3*Math.pow(2,a),l=o/2,u=Math.min(18e5,o),d=(Math.random()-.5)*(u-l);return Math.ceil(u+d)}(n),r=Date.now()+s;this.queue.push({retryAt:r,requestOptions:t});var i="Enqueued failed request for retry in ".concat(s);navigator.onLine||(i+=" (Browser is offline)"),Wt.warn(i),this.isPolling||(this.isPolling=!0,this.poll())}poll(){this.poller&&clearTimeout(this.poller),this.poller=setTimeout(()=>{this.areWeOnline&&this.queue.length>0&&this.flush(),this.poll()},this.pollIntervalMs)}flush(){var t=Date.now(),n=[],s=this.queue.filter(i=>i.retryAt<t||(n.push(i),!1));if(this.queue=n,s.length>0)for(var{requestOptions:r}of s)this.retriableRequest(r)}unload(){for(var{requestOptions:t}of(this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.queue))try{this.instance._send_request(et(et({},t),{},{transport:"sendBeacon"}))}catch(n){Wt.error(n)}this.queue=[]}},Yue=class{constructor(t){St(this,"_updateScrollData",()=>{var n,s,r,i;this.context||(this.context={});var a=this.scrollElement(),o=this.scrollY(),l=a?Math.max(0,a.scrollHeight-a.clientHeight):0,u=o+(a?.clientHeight||0),d=a?.scrollHeight||0;this.context.lastScrollY=Math.ceil(o),this.context.maxScrollY=Math.max(o,(n=this.context.maxScrollY)!==null&&n!==void 0?n:0),this.context.maxScrollHeight=Math.max(l,(s=this.context.maxScrollHeight)!==null&&s!==void 0?s:0),this.context.lastContentY=u,this.context.maxContentY=Math.max(u,(r=this.context.maxContentY)!==null&&r!==void 0?r:0),this.context.maxContentHeight=Math.max(d,(i=this.context.maxContentHeight)!==null&&i!==void 0?i:0)}),this.instance=t}getContext(){return this.context}resetContext(){var t=this.context;return setTimeout(this._updateScrollData,0),t}startMeasuringScrollPosition(){nr(Xe,"scroll",this._updateScrollData,{capture:!0}),nr(Xe,"scrollend",this._updateScrollData,{capture:!0}),nr(Xe,"resize",this._updateScrollData)}scrollElement(){if(!this.instance.config.scroll_root_selector)return Xe?.document.documentElement;var t=Ws(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector];for(var n of t){var s=Xe?.document.querySelector(n);if(s)return s}}scrollY(){if(this.instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollTop||0}return Xe&&(Xe.scrollY||Xe.pageYOffset||Xe.document.documentElement.scrollTop)||0}scrollX(){if(this.instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollLeft||0}return Xe&&(Xe.scrollX||Xe.pageXOffset||Xe.document.documentElement.scrollLeft)||0}};var Xue=e=>Ds.personInfo({maskPersonalDataProperties:e?.config.mask_personal_data_properties,customPersonalDataProperties:e?.config.custom_personal_data_properties});let Que=class{constructor(t,n,s,r){St(this,"_onSessionIdCallback",i=>{var a=this._getStored();if(!a||a.sessionId!==i){var o={sessionId:i,props:this._sessionSourceParamGenerator(this.instance)};this._persistence.register({[QE]:o})}}),this.instance=t,this._sessionIdManager=n,this._persistence=s,this._sessionSourceParamGenerator=r||Xue,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[QE]}getSetOnceProps(){var t,n=(t=this._getStored())===null||t===void 0?void 0:t.props;return n?"r"in n?Ds.personPropsFromInfo(n):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var t={};return ds(Z0(this.getSetOnceProps()),(n,s)=>{s==="$current_url"&&(s="url"),t["$session_entry_".concat(C2(s))]=n}),t}};var XM=bi("[SessionId]");let Jue=class{constructor(t,n,s){var r;if(St(this,"_sessionIdChangedHandlers",[]),!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.__preview_experimental_cookieless_mode)throw new Error("SessionIdManager cannot be used with __preview_experimental_cookieless_mode");this.config=t.config,this.persistence=t.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=n||Nu,this._windowIdGenerator=s||Nu;var i=this.config.persistence_name||this.config.token,a=this.config.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*ao(a,60,36e3,"session_idle_timeout_seconds",1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.resetIdleTimer(),this._window_id_storage_key="ph_"+i+"_window_id",this._primary_window_exists_storage_key="ph_"+i+"_primary_window_exists",this._canUseSessionStorage()){var o=qr.parse(this._window_id_storage_key),l=qr.parse(this._primary_window_exists_storage_key);o&&!l?this._windowId=o:qr.remove(this._window_id_storage_key),qr.set(this._primary_window_exists_storage_key,!0)}if((r=this.config.bootstrap)!==null&&r!==void 0&&r.sessionID)try{var u=(d=>{var f=d.replace(/-/g,"");if(f.length!==32)throw new Error("Not a valid UUID");if(f[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(f.substring(0,12),16)})(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,new Date().getTime(),u)}catch(d){XM.error("Invalid sessionID in bootstrap",d)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return It(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(t),this._sessionId&&t(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter(n=>n!==t)}}_canUseSessionStorage(){return this.config.persistence!=="memory"&&!this.persistence.disabled&&qr.is_supported()}_setWindowId(t){t!==this._windowId&&(this._windowId=t,this._canUseSessionStorage()&&qr.set(this._window_id_storage_key,t))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?qr.parse(this._window_id_storage_key):null}_setSessionId(t,n,s){t===this._sessionId&&n===this._sessionActivityTimestamp&&s===this._sessionStartTimestamp||(this._sessionStartTimestamp=s,this._sessionActivityTimestamp=n,this._sessionId=t,this.persistence.register({[$_]:[n,t,s]}))}_getSessionId(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var t=this.persistence.props[$_];return Ws(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}_listenToReloadWindow(){nr(Xe,"beforeunload",()=>{this._canUseSessionStorage()&&qr.remove(this._primary_window_exists_storage_key)},{capture:!1})}checkAndGetSessionAndWindowId(){var t=arguments.length>0&&arguments[0]!==void 0&&arguments[0],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(this.config.__preview_experimental_cookieless_mode)throw new Error("checkAndGetSessionAndWindowId should not be called in __preview_experimental_cookieless_mode");var s=n||new Date().getTime(),[r,i,a]=this._getSessionId(),o=this._getWindowId(),l=Mi(a)&&a>0&&Math.abs(s-a)>864e5,u=!1,d=!i,f=!t&&Math.abs(s-r)>this.sessionTimeoutMs;d||f||l?(i=this._sessionIdGenerator(),o=this._windowIdGenerator(),XM.info("new session ID generated",{sessionId:i,windowId:o,changeReason:{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:l}}),a=s,u=!0):o||(o=this._windowIdGenerator(),u=!0);var p=r===0||!t||l?s:r,g=a===0?new Date().getTime():a;return this._setWindowId(o),this._setSessionId(i,p,g),t||this.resetIdleTimer(),u&&this._sessionIdChangedHandlers.forEach(v=>v(i,o,u?{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:l}:void 0)),{sessionId:i,windowId:o,sessionStartTimestamp:g,changeReason:u?{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:r}}resetIdleTimer(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{this.resetSessionId()},1.1*this.sessionTimeoutMs)}};var Zue=["$set_once","$set"],pu=bi("[SiteApps]");let ede=class{constructor(t){this.instance=t,this.bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this.instance.config.opt_in_site_apps}eventCollector(t,n){if(n){var s=this.globalsForEvent(n);this.bufferedInvocations.push(s),this.bufferedInvocations.length>1e3&&(this.bufferedInvocations=this.bufferedInvocations.slice(10))}}get siteAppLoaders(){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.siteApps}init(){if(this.isEnabled){var t=this.instance._addCaptureHook(this.eventCollector.bind(this));this.stopBuffering=()=>{t(),this.bufferedInvocations=[],this.stopBuffering=void 0}}}globalsForEvent(t){var n,s,r,i,a,o,l;if(!t)throw new Error("Event payload is required");var u={},d=this.instance.get_property("$groups")||[],f=this.instance.get_property("$stored_group_properties")||{};for(var[p,g]of Object.entries(f))u[p]={id:d[p],type:p,properties:g};var{$set_once:v,$set:b}=t;return{event:et(et({},pU(t,Zue)),{},{properties:et(et(et({},t.properties),b?{$set:et(et({},(n=(s=t.properties)===null||s===void 0?void 0:s.$set)!==null&&n!==void 0?n:{}),b)}:{}),v?{$set_once:et(et({},(r=(i=t.properties)===null||i===void 0?void 0:i.$set_once)!==null&&r!==void 0?r:{}),v)}:{}),elements_chain:(a=(o=t.properties)===null||o===void 0?void 0:o.$elements_chain)!==null&&a!==void 0?a:"",distinct_id:(l=t.properties)===null||l===void 0?void 0:l.distinct_id}),person:{properties:this.instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(t){var n=this.apps[t.id],s=()=>{var o;!n.errored&&this.bufferedInvocations.length&&(pu.info("Processing ".concat(this.bufferedInvocations.length," events for site app with id ").concat(t.id)),this.bufferedInvocations.forEach(l=>{var u;return(u=n.processEvent)===null||u===void 0?void 0:u.call(n,l)}),n.processedBuffer=!0),Object.values(this.apps).every(l=>l.processedBuffer||l.errored)&&((o=this.stopBuffering)===null||o===void 0||o.call(this))},r=!1,i=o=>{n.errored=!o,n.loaded=!0,pu.info("Site app with id ".concat(t.id," ").concat(o?"loaded":"errored")),r&&s()};try{var{processEvent:a}=t.init({posthog:this.instance,callback:o=>{i(o)}});a&&(n.processEvent=a),r=!0}catch(o){pu.error("Error while initializing PostHog app with config id ".concat(t.id),o),i(!1)}if(r&&n.loaded)try{s()}catch(o){pu.error("Error while processing buffered events PostHog app with config id ".concat(t.id),o),n.errored=!0}}setupSiteApps(){var t=this.siteAppLoaders||[];for(var n of t)this.apps[n.id]={id:n.id,loaded:!1,errored:!1,processedBuffer:!1};for(var s of t)this.setupSiteApp(s)}onCapturedEvent(t){if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(t);for(var s of Object.values(this.apps))try{var r;(r=s.processEvent)===null||r===void 0||r.call(s,n)}catch(i){pu.error("Error while processing event ".concat(t.event," for site app ").concat(s.id),i)}}}onRemoteConfig(t){var n,s,r,i=this;if((n=this.siteAppLoaders)!==null&&n!==void 0&&n.length)return this.isEnabled?(this.setupSiteApps(),void this.instance.on("eventCaptured",u=>this.onCapturedEvent(u))):void pu.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((s=this.stopBuffering)===null||s===void 0||s.call(this),(r=t.siteApps)!==null&&r!==void 0&&r.length)if(this.isEnabled){var a=function(u,d){var f,p;hn["__$$ph_site_app_".concat(u)]=i.instance,(f=hn.__PosthogExtensions__)===null||f===void 0||(p=f.loadSiteApp)===null||p===void 0||p.call(f,i.instance,d,g=>{if(g)return pu.error("Error while initializing PostHog app with config id ".concat(u),g)})};for(var{id:o,url:l}of t.siteApps)a(o,l)}else pu.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}};var th,tde=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google","bytespider"],QM=function(e,t){if(!e)return!1;var n=e.toLowerCase();return tde.concat(t||[]).some(s=>{var r=s.toLowerCase();return n.indexOf(r)!==-1})},mG=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&QM(n,t))return!0;try{var s=e?.userAgentData;if(s!=null&&s.brands&&s.brands.some(r=>QM(r?.brand,t)))return!0}catch{}return!!e.webdriver};function JM(e,t,n){return Lm({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}(function(e){e.US="us",e.EU="eu",e.CUSTOM="custom"})(th||(th={}));var ZM="i.posthog.com";let nde=class{constructor(t){St(this,"_regionCache",{}),this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return t==="https://app.posthog.com"?"https://us.i.posthog.com":t}get uiHost(){var t,n=(t=this.instance.config.ui_host)===null||t===void 0?void 0:t.replace(/\/$/,"");return n||(n=this.apiHost.replace(".".concat(ZM),".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this._regionCache[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=th.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=th.EU:this._regionCache[this.apiHost]=th.CUSTOM),this._regionCache[this.apiHost]}endpointFor(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if(n&&(n=n[0]==="/"?n:"/".concat(n)),t==="ui")return this.uiHost+n;if(this.region===th.CUSTOM)return this.apiHost+n;var s=ZM+n;switch(t){case"assets":return"https://".concat(this.region,"-assets.").concat(s);case"api":return"https://".concat(this.region,".").concat(s)}}};var sde={icontains:(e,t)=>!!Xe&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!Xe&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!Xe&&Kp(t.href,e),not_regex:(e,t)=>!!Xe&&!Kp(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};let rde=class Ii{constructor(t){var n=this;St(this,"getWebExperimentsAndEvaluateDisplayLogic",function(){var s=arguments.length>0&&arguments[0]!==void 0&&arguments[0];n.getWebExperiments(r=>{Ii.logInfo("retrieved web experiments from the server"),n._flagToExperiments=new Map,r.forEach(i=>{if(i.feature_flag_key){var a;n._flagToExperiments&&(Ii.logInfo("setting flag key ",i.feature_flag_key," to web experiment ",i),(a=n._flagToExperiments)===null||a===void 0||a.set(i.feature_flag_key,i));var o=n.instance.getFeatureFlag(i.feature_flag_key);pr(o)&&i.variants[o]&&n.applyTransforms(i.name,o,i.variants[o].transforms)}else if(i.variants)for(var l in i.variants){var u=i.variants[l];Ii.matchesTestVariant(u)&&n.applyTransforms(i.name,l,u.transforms)}})},s)}),this.instance=t,this.instance.onFeatureFlags(s=>{this.onFeatureFlags(s)})}onFeatureFlags(t){if(this._is_bot())Ii.logInfo("Refusing to render web experiment since the viewer is a likely bot");else if(!this.instance.config.disable_web_experiments){if(ss(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Ii.logInfo("applying feature flags",t),t.forEach(n=>{var s;if(this._flagToExperiments&&(s=this._flagToExperiments)!==null&&s!==void 0&&s.has(n)){var r,i=this.instance.getFeatureFlag(n),a=(r=this._flagToExperiments)===null||r===void 0?void 0:r.get(n);i&&a!=null&&a.variants[i]&&this.applyTransforms(a.name,i,a.variants[i].transforms)}})}}previewWebExperiment(){var t=Ii.getWindowLocation();if(t!=null&&t.search){var n=X_(t?.search,"__experiment_id"),s=X_(t?.search,"__experiment_variant");n&&s&&(Ii.logInfo("previewing web experiments ".concat(n," && ").concat(s)),this.getWebExperiments(r=>{this.showPreviewWebExperiment(parseInt(n),s,r)},!1,!0))}}loadIfEnabled(){this.instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,s){if(this.instance.config.disable_web_experiments&&!s)return t([]);var r=this.instance.get_property("$web_experiments");if(r&&!n)return t(r);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/web_experiments/?token=".concat(this.instance.config.token)),method:"GET",callback:i=>{if(i.statusCode!==200||!i.json)return t([]);var a=i.json.experiments||[];return t(a)}})}showPreviewWebExperiment(t,n,s){var r=s.filter(i=>i.id===t);r&&r.length>0&&(Ii.logInfo("Previewing web experiment [".concat(r[0].name,"] with variant [").concat(n,"]")),this.applyTransforms(r[0].name,n,r[0].variants[n].transforms))}static matchesTestVariant(t){return!ss(t.conditions)&&Ii.matchUrlConditions(t)&&Ii.matchUTMConditions(t)}static matchUrlConditions(t){var n;if(ss(t.conditions)||ss((n=t.conditions)===null||n===void 0?void 0:n.url))return!0;var s,r,i,a=Ii.getWindowLocation();return!!a&&((s=t.conditions)===null||s===void 0||!s.url||sde[(r=(i=t.conditions)===null||i===void 0?void 0:i.urlMatchType)!==null&&r!==void 0?r:"icontains"](t.conditions.url,a))}static getWindowLocation(){return Xe?.location}static matchUTMConditions(t){var n;if(ss(t.conditions)||ss((n=t.conditions)===null||n===void 0?void 0:n.utm))return!0;var s=Ds.campaignParams();if(s.utm_source){var r,i,a,o,l,u,d,f,p,g,v,b,x,_,w,y,S=(r=t.conditions)===null||r===void 0||(i=r.utm)===null||i===void 0||!i.utm_campaign||((a=t.conditions)===null||a===void 0||(o=a.utm)===null||o===void 0?void 0:o.utm_campaign)==s.utm_campaign,C=(l=t.conditions)===null||l===void 0||(u=l.utm)===null||u===void 0||!u.utm_source||((d=t.conditions)===null||d===void 0||(f=d.utm)===null||f===void 0?void 0:f.utm_source)==s.utm_source,E=(p=t.conditions)===null||p===void 0||(g=p.utm)===null||g===void 0||!g.utm_medium||((v=t.conditions)===null||v===void 0||(b=v.utm)===null||b===void 0?void 0:b.utm_medium)==s.utm_medium,k=(x=t.conditions)===null||x===void 0||(_=x.utm)===null||_===void 0||!_.utm_term||((w=t.conditions)===null||w===void 0||(y=w.utm)===null||y===void 0?void 0:y.utm_term)==s.utm_term;return S&&E&&k&&C}return!1}static logInfo(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),r=1;r<n;r++)s[r-1]=arguments[r];Wt.info("[WebExperiments] ".concat(t),s)}applyTransforms(t,n,s){this._is_bot()?Ii.logInfo("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?s.forEach(r=>{if(r.selector){var i;Ii.logInfo("applying transform of variant ".concat(n," for experiment ").concat(t," "),r);var a=(i=document)===null||i===void 0?void 0:i.querySelectorAll(r.selector);a?.forEach(o=>{var l=o;r.html&&(l.innerHTML=r.html),r.css&&l.setAttribute("style",r.css)})}}):Ii.logInfo("Control variants leave the page unmodified.")}_is_bot(){return Ta&&this.instance?mG(Ta,this.instance.config.custom_blocked_useragents):void 0}};var s0={},CT=()=>{},Yf="posthog",vG=!zue&&hr?.indexOf("MSIE")===-1&&hr?.indexOf("Mozilla")===-1,eO=()=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:ace(Ot?.location),persistence:"localStorage+cookie",persistence_name:"",loaded:CT,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:ea&&pr(ea?.search)&&ea.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(Xe==null||(e=Xe.location)===null||e===void 0?void 0:e.protocol)==="https:",ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var n="Bad HTTP status: "+t.statusCode+" "+t.text;Wt.error(n)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:yT},_onCapture:CT}},tO=e=>{var t={};It(e.process_person)||(t.person_profiles=e.process_person),It(e.xhr_headers)||(t.request_headers=e.xhr_headers),It(e.cookie_name)||(t.persistence_name=e.cookie_name),It(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),It(e.store_google)||(t.save_campaign_params=e.store_google),It(e.verbose)||(t.debug=e.verbose);var n=er({},t,e);return Ws(e.property_blacklist)&&(It(e.property_denylist)?n.property_denylist=e.property_blacklist:Ws(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:Wt.error("Invalid value for property_denylist config: "+e.property_denylist)),n};class ide{constructor(){St(this,"__forceAllowLocalhost",!1)}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(t){Wt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class sC{get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){St(this,"webPerformance",new ide),St(this,"_personProcessingSetOncePropertiesSent",!1),St(this,"version",mc.LIB_VERSION),St(this,"_internalEventEmitter",new pG),this.config=eO(),this.SentryIntegration=due,this.sentryIntegration=t=>function(n,s){var r=GU(n,s);return{name:UU,processEvent:i=>r(i)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.featureFlags=new Iue(this),this.toolbar=new fue(this),this.scrollManager=new Yue(this),this.pageViewManager=new xue(this),this.surveys=new Uue(this),this.experiments=new rde(this),this.exceptions=new _ue(this),this.rateLimiter=new Gue(this),this.requestRouter=new nde(this),this.consent=new Fce(this),this.people={set:(t,n,s)=>{var r=pr(t)?{[t]:n}:t;this.setPersonProperties(r),s?.({})},set_once:(t,n,s)=>{var r=pr(t)?{[t]:n}:t;this.setPersonProperties(void 0,r),s?.({})}},this.on("eventCaptured",t=>Wt.info('send "'.concat(t?.event,'"'),t))}init(t,n,s){if(s&&s!==Yf){var r,i=(r=s0[s])!==null&&r!==void 0?r:new sC;return i._init(t,n,s),s0[s]=i,s0[Yf][s]=i,i}return this._init(t,n,s)}_init(t){var n,s,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if(It(t)||$E(t))return Wt.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return Wt.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this._triggered_notifs=[],r.person_profiles&&(this._initialPersonProfilesConfig=r.person_profiles),this.set_config(er({},eO(),tO(r),{name:i,token:t})),this.config.on_xhr_error&&Wt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=r.disable_compression?void 0:Bo.GZipJS,this.persistence=new lS(this.config),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new lS(et(et({},this.config),{},{persistence:"sessionStorage"}));var a=et({},this.persistence.props),o=et({},this.sessionPersistence.props);if(this._requestQueue=new $ue(_=>this._send_retriable_request(_),this.config.request_queue_config),this._retryQueue=new Kue(this),this.__request_queue=[],this.config.__preview_experimental_cookieless_mode||(this.sessionManager=new Jue(this),this.sessionPropsManager=new Que(this,this.sessionManager,this.persistence)),new gue(this).startIfEnabledOrStop(),this.siteApps=new ede(this),(n=this.siteApps)===null||n===void 0||n.init(),this.config.__preview_experimental_cookieless_mode||(this.sessionRecording=new cue(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new _ce(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new bue(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new mue(this),this.exceptionObserver=new Pce(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new DU(this,Ice),this.deadClicksAutocapture.startIfEnabled(),mc.DEBUG=mc.DEBUG||this.config.debug,mc.DEBUG&&Wt.info("Starting in debug mode",{this:this,config:r,thisC:et({},this.config),p:a,s:o}),this._sync_opt_out_with_persistence(),((s=r.bootstrap)===null||s===void 0?void 0:s.distinctID)!==void 0){var l,u,d=this.config.get_device_id(Nu()),f=(l=r.bootstrap)!==null&&l!==void 0&&l.isIdentifiedID?d:r.bootstrap.distinctID;this.persistence.set_property(fc,(u=r.bootstrap)!==null&&u!==void 0&&u.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:r.bootstrap.distinctID,$device_id:f})}if(this._hasBootstrappedFeatureFlags()){var p,g,v=Object.keys(((p=r.bootstrap)===null||p===void 0?void 0:p.featureFlags)||{}).filter(_=>{var w,y;return!((w=r.bootstrap)===null||w===void 0||(y=w.featureFlags)===null||y===void 0||!y[_])}).reduce((_,w)=>{var y,S;return _[w]=((y=r.bootstrap)===null||y===void 0||(S=y.featureFlags)===null||S===void 0?void 0:S[w])||!1,_},{}),b=Object.keys(((g=r.bootstrap)===null||g===void 0?void 0:g.featureFlagPayloads)||{}).filter(_=>v[_]).reduce((_,w)=>{var y,S,C,E;return(y=r.bootstrap)!==null&&y!==void 0&&(S=y.featureFlagPayloads)!==null&&S!==void 0&&S[w]&&(_[w]=(C=r.bootstrap)===null||C===void 0||(E=C.featureFlagPayloads)===null||E===void 0?void 0:E[w]),_},{});this.featureFlags.receivedFeatureFlags({featureFlags:v,featureFlagPayloads:b})}if(this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:aM,$device_id:null},"");else if(!this.get_distinct_id()){var x=this.config.get_device_id(Nu());this.register_once({distinct_id:x,$device_id:x},""),this.persistence.set_property(fc,"anonymous")}return nr(Xe,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),r.segment?uue(this,()=>this._loaded()):this._loaded(),Wo(this.config._onCapture)&&this.config._onCapture!==CT&&(Wt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",_=>this.config._onCapture(_.event,_))),this}_onRemoteConfig(t){var n,s,r,i,a,o,l,u;if(!Ot||!Ot.body)return Wt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this._onRemoteConfig(t)},500);this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=En(t.supportedCompression,Bo.GZipJS)?Bo.GZipJS:En(t.supportedCompression,Bo.Base64)?Bo.Base64:void 0),(n=t.analytics)!==null&&n!==void 0&&n.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:"identified_only"}),(s=this.siteApps)===null||s===void 0||s.onRemoteConfig(t),(r=this.sessionRecording)===null||r===void 0||r.onRemoteConfig(t),(i=this.autocapture)===null||i===void 0||i.onRemoteConfig(t),(a=this.heatmaps)===null||a===void 0||a.onRemoteConfig(t),this.surveys.onRemoteConfig(t),(o=this.webVitalsAutocapture)===null||o===void 0||o.onRemoteConfig(t),(l=this.exceptionObserver)===null||l===void 0||l.onRemoteConfig(t),(u=this.deadClicksAutocapture)===null||u===void 0||u.onRemoteConfig(t)}_loaded(){try{this.config.loaded(this)}catch(t){Wt.critical("`loaded` function failed",t)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout(()=>{this.consent.isOptedIn()&&this._captureInitialPageview()},1),new Vue(this).load(),this.featureFlags.decide()}_start_queue_if_opted_in(){var t;this.has_opted_out_capturing()||this.config.request_batching&&((t=this._requestQueue)===null||t===void 0||t.enable())}_dom_loaded(){this.has_opted_out_capturing()||Gu(this.__request_queue,t=>this._send_retriable_request(t)),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var t,n;this.config.request_batching?(this._shouldCapturePageleave()&&this.capture("$pageleave"),(t=this._requestQueue)===null||t===void 0||t.unload(),(n=this._retryQueue)===null||n===void 0||n.unload()):this._shouldCapturePageleave()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(vG?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=nw(t.url,{ip:this.config.ip?1:0}),t.headers=et({},this.config.request_headers),t.compression=t.compression==="best-available"?this.compression:t.compression,t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var s,r,i,a=et({},n);a.timeout=a.timeout||6e4,a.url=nw(a.url,{_:new Date().getTime().toString(),ver:mc.LIB_VERSION,compression:a.compression});var o=(s=a.transport)!==null&&s!==void 0?s:"fetch",l=(r=(i=gU(n0,u=>u.transport===o))===null||i===void 0?void 0:i.method)!==null&&r!==void 0?r:n0[0].method;if(!l)throw new Error("No available transport method");l(a)})(et(et({},t),{},{callback:n=>{var s,r,i;this.rateLimiter.checkForLimiting(n),n.statusCode>=400&&((r=(i=this.config).on_request_error)===null||r===void 0||r.call(i,n)),(s=t.callback)===null||s===void 0||s.call(t,n)}}))))}_send_retriable_request(t){this._retryQueue?this._retryQueue.retriableRequest(t):this._send_request(t)}_execute_array(t){var n,s=[],r=[],i=[];Gu(t,o=>{o&&(n=o[0],Ws(n)?i.push(o):Wo(o)?o.call(this):Ws(o)&&n==="alias"?s.push(o):Ws(o)&&n.indexOf("capture")!==-1&&Wo(this[n])?i.push(o):r.push(o))});var a=function(o,l){Gu(o,function(u){if(Ws(u[0])){var d=l;ds(u,function(f){d=d[f[0]].apply(d,f.slice(1))})}else this[u[0]].apply(this,u.slice(1))},l)};a(s,this),a(r,this),a(i,this)}_hasBootstrappedFeatureFlags(){var t,n;return((t=this.config.bootstrap)===null||t===void 0?void 0:t.featureFlags)&&Object.keys((n=this.config.bootstrap)===null||n===void 0?void 0:n.featureFlags).length>0||!1}push(t){this._execute_array([t])}capture(t,n,s){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(!this.consent.isOptedOut())if(!It(t)&&pr(t)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var i=s!=null&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(i==null||!i.isRateLimited){n!=null&&n.$current_url&&!pr(n?.$current_url)&&(Wt.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var a=new Date,o=s?.timestamp||a,l=Nu(),u={uuid:l,event:t,properties:this._calculate_event_properties(t,n||{},o,l)};i&&(u.properties.$lib_rate_limit_remaining_tokens=i.remainingTokens),s?.$set&&(u.$set=s?.$set);var d=this._calculate_set_once_properties(s?.$set_once);d&&(u.$set_once=d),(u=rce(u,s!=null&&s._noTruncate?null:this.config.properties_string_max_length)).timestamp=o,It(s?.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=a);var f=et(et({},u.properties.$set),u.$set);if(ip(f)||this.setPersonPropertiesForFlags(f),!ss(this.config.before_send)){var p=this._runBeforeSend(u);if(!p)return;u=p}this._internalEventEmitter.emit("eventCaptured",u);var g={method:"POST",url:(r=s?._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:s?._batchKey};return!this.config.request_batching||s&&(s==null||!s._batchKey)||s!=null&&s.send_instantly?this._send_retriable_request(g):this._requestQueue.enqueue(g),u}Wt.critical("This capture call is ignored due to client rate limiting.")}}else Wt.error("No event name provided to posthog.capture")}else Wt.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",n=>t(n.event,n))}_calculate_event_properties(t,n,s,r){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return n;var i=this.persistence.remove_event_timer(t),a=et({},n);if(a.token=this.config.token,this.config.__preview_experimental_cookieless_mode&&(a.$cookieless_mode=!0),t==="$snapshot"){var o=et(et({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=o.distinct_id,(!pr(a.distinct_id)&&!Mi(a.distinct_id)||$E(a.distinct_id))&&Wt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var l,u=Ds.properties({maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});if(this.sessionManager){var{sessionId:d,windowId:f}=this.sessionManager.checkAndGetSessionAndWindowId();a.$session_id=d,a.$window_id=f}this.sessionPropsManager&&er(a,this.sessionPropsManager.getSessionProps());try{var p,g;this.sessionRecording&&er(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(p=this._retryQueue)===null||p===void 0||(g=p.queue)===null||g===void 0?void 0:g.length}catch(_){a.$sdk_debug_error_capturing_properties=String(_)}if(this.requestRouter.region===th.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),l=t==="$pageview"?this.pageViewManager.doPageView(s,r):t==="$pageleave"?this.pageViewManager.doPageLeave(s):this.pageViewManager.doEvent(),a=er(a,l),t==="$pageview"&&Ot&&(a.title=Ot.title),!It(i)){var v=s.getTime()-i;a.$duration=parseFloat((v/1e3).toFixed(3))}hr&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=er({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),Ws(this.config.property_denylist)?ds(this.config.property_denylist,function(_){delete a[_]}):Wt.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(Wt.error("sanitize_properties is deprecated. Use before_send instead"),a=b(a,t));var x=this._hasPersonProcessing();return a.$process_person_profile=x,x&&this._requirePersonProcessing("_calculate_event_properties"),a}_calculate_set_once_properties(t){var n;if(!this.persistence||!this._hasPersonProcessing()||this._personProcessingSetOncePropertiesSent)return t;var s=this.persistence.get_initial_props(),r=(n=this.sessionPropsManager)===null||n===void 0?void 0:n.getSetOnceProps(),i=er({},s,r||{},t||{}),a=this.config.sanitize_properties;return a&&(Wt.error("sanitize_properties is deprecated. Use before_send instead"),i=a(i,"$set_once")),this._personProcessingSetOncePropertiesSent=!0,ip(i)?void 0:i}register(t,n){var s;(s=this.persistence)===null||s===void 0||s.register(t,n)}register_once(t,n,s){var r;(r=this.persistence)===null||r===void 0||r.register_once(t,n,s)}register_for_session(t){var n;(n=this.sessionPersistence)===null||n===void 0||n.register(t)}unregister(t){var n;(n=this.persistence)===null||n===void 0||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(t)}_register_single(t,n){this.register({[t]:n})}getFeatureFlag(t,n){return this.featureFlags.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n=this.featureFlags.getFeatureFlagPayload(t);try{return JSON.parse(n)}catch{return n}}isFeatureEnabled(t,n){return this.featureFlags.isFeatureEnabled(t,n)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(t,n){this.featureFlags.updateEarlyAccessFeatureEnrollment(t,n)}getEarlyAccessFeatures(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1],s=arguments.length>2?arguments[2]:void 0;return this.featureFlags.getEarlyAccessFeatures(t,n,s)}on(t,n){return this._internalEventEmitter.on(t,n)}onFeatureFlags(t){return this.featureFlags.onFeatureFlags(t)}onSurveysLoaded(t){return this.surveys.onSurveysLoaded(t)}onSessionId(t){var n,s;return(n=(s=this.sessionManager)===null||s===void 0?void 0:s.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getSurveys(t,n)}getActiveMatchingSurveys(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getActiveMatchingSurveys(t,n)}renderSurvey(t,n){this.surveys.renderSurvey(t,n)}canRenderSurvey(t){return this.surveys.canRenderSurvey(t)}identify(t,n,s){if(!this.__loaded||!this.persistence)return Wt.uninitializedWarning("posthog.identify");if(Mi(t)&&(t=t.toString(),Wt.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),t){if(["distinct_id","distinctid"].includes(t.toLowerCase()))Wt.critical('The string "'.concat(t,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else if(this._requirePersonProcessing("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:t}),!this.get_property("$device_id")){var i=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:i},"")}t!==r&&t!==this.get_property(Dm)&&(this.unregister(Dm),this.register({distinct_id:t}));var a=(this.persistence.get_property(fc)||"anonymous")==="anonymous";t!==r&&a?(this.persistence.set_property(fc,"identified"),this.setPersonPropertiesForFlags(et(et({},s||{}),n||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:r},{$set:n||{},$set_once:s||{}}),this._cachedPersonProperties=JM(t,n,s),this.featureFlags.setAnonymousDistinctId(r)):(n||s)&&this.setPersonProperties(n,s),t!==r&&(this.reloadFeatureFlags(),this.unregister(q_))}}else Wt.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,n){if((t||n)&&this._requirePersonProcessing("posthog.setPersonProperties")){var s=JM(this.get_distinct_id(),t,n);this._cachedPersonProperties!==s?(this.setPersonPropertiesForFlags(et(et({},n||{}),t||{})),this.capture("$set",{$set:t||{},$set_once:n||{}}),this._cachedPersonProperties=s):Wt.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,n,s){if(t&&n){if(this._requirePersonProcessing("posthog.group")){var r=this.getGroups();r[t]!==n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:et(et({},r),{},{[t]:n})}),s&&(this.capture("$groupidentify",{$group_type:t,$group_key:n,$group_set:s}),this.setGroupPropertiesForFlags({[t]:s})),r[t]===n||s||this.reloadFeatureFlags()}}else Wt.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this.featureFlags.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(t,n)}resetGroupPropertiesForFlags(t){this.featureFlags.resetGroupPropertiesForFlags(t)}reset(t){var n,s,r,i;if(Wt.info("reset"),!this.__loaded)return Wt.uninitializedWarning("posthog.reset");var a=this.get_property("$device_id");if(this.consent.reset(),(n=this.persistence)===null||n===void 0||n.clear(),(s=this.sessionPersistence)===null||s===void 0||s.clear(),this.surveys.reset(),(r=this.persistence)===null||r===void 0||r.set_property(fc,"anonymous"),(i=this.sessionManager)===null||i===void 0||i.resetSessionId(),this._cachedPersonProperties=null,this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:aM,$device_id:null},"");else{var o=this.config.get_device_id(Nu());this.register_once({distinct_id:o,$device_id:t?o:a},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)===null||n===void 0?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:s}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(n));if(t!=null&&t.withTimestamp&&s){var i,a=(i=t.timestampLookBack)!==null&&i!==void 0?i:10;if(!s)return r;var o=Math.max(Math.floor((new Date().getTime()-s)/1e3)-a,0);r+="?t=".concat(o)}return r}alias(t,n){return t===this.get_property(mU)?(Wt.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(It(n)&&(n=this.get_distinct_id()),t!==n?(this._register_single(Dm,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(Wt.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n,s,r,i,a=et({},this.config);zs(t)&&(er(this.config,tO(t)),(n=this.persistence)===null||n===void 0||n.update_config(this.config,a),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new lS(et(et({},this.config),{},{persistence:"sessionStorage"})),br.is_supported()&&br.get("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(mc.DEBUG=!0,Wt.info("set_config",JSON.stringify({config:t,oldConfig:a,newConfig:et({},this.config)},null,2))),(s=this.sessionRecording)===null||s===void 0||s.startIfEnabledOrStop(),(r=this.autocapture)===null||r===void 0||r.startIfEnabled(),(i=this.heatmaps)===null||i===void 0||i.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence())}startSessionRecording(t){var n=t===!0,s={sampling:n||!(t==null||!t.sampling),linked_flag:n||!(t==null||!t.linked_flag),url_trigger:n||!(t==null||!t.url_trigger),event_trigger:n||!(t==null||!t.event_trigger)};if(Object.values(s).some(Boolean)){var r,i,a,o,l;(r=this.sessionManager)===null||r===void 0||r.checkAndGetSessionAndWindowId(),s.sampling&&((i=this.sessionRecording)===null||i===void 0||i.overrideSampling()),s.linked_flag&&((a=this.sessionRecording)===null||a===void 0||a.overrideLinkedFlag()),s.url_trigger&&((o=this.sessionRecording)===null||o===void 0||o.overrideTrigger("url")),s.event_trigger&&((l=this.sessionRecording)===null||l===void 0||l.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)===null||t===void 0||!t.started)}captureException(t,n){var s=new Error("PostHog syntheticException");this.exceptions.sendExceptionEvent(et(et({},zce((r=>r instanceof Error)(t)?{error:t,event:t.message}:{event:t},{syntheticException:s})),n))}loadToolbar(t){return this.toolbar.loadToolbar(t)}get_property(t){var n;return(n=this.persistence)===null||n===void 0?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)===null||n===void 0?void 0:n.props[t]}toString(){var t,n=(t=this.config.name)!==null&&t!==void 0?t:Yf;return n!==Yf&&(n=Yf+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)===null||t===void 0?void 0:t.get_property(fc))==="identified"||((n=this.sessionPersistence)===null||n===void 0?void 0:n.get_property(fc))==="identified"}_hasPersonProcessing(){var t,n,s,r;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&ip(this.getGroups())&&((t=this.persistence)===null||t===void 0||(n=t.props)===null||n===void 0||!n[Dm])&&((s=this.persistence)===null||s===void 0||(r=s.props)===null||r===void 0||!r[K_]))}_shouldCapturePageleave(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}_requirePersonProcessing(t){return this.config.person_profiles==="never"?(Wt.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(K_,!0),!0)}_sync_opt_out_with_persistence(){var t,n,s,r,i=this.consent.isOptedOut(),a=this.config.opt_out_persistence_by_default,o=this.config.disable_persistence||i&&!!a;((t=this.persistence)===null||t===void 0?void 0:t.disabled)!==o&&((s=this.persistence)===null||s===void 0||s.set_disabled(o)),((n=this.sessionPersistence)===null||n===void 0?void 0:n.disabled)!==o&&((r=this.sessionPersistence)===null||r===void 0||r.set_disabled(o))}opt_in_capturing(t){var n;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),(It(t?.captureEventName)||t!=null&&t.captureEventName)&&this.capture((n=t?.captureEventName)!==null&&n!==void 0?n:"$opt_in",t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}opt_out_capturing(){this.consent.optInOut(!1),this._sync_opt_out_with_persistence()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return Ta?mG(Ta,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){Ot&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:Ot.title},{send_instantly:!0}))}debug(t){t===!1?(Xe?.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(Xe?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}_runBeforeSend(t){if(ss(this.config.before_send))return t;var n=Ws(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var r of n){if(s=r(s),ss(s)){var i="Event '".concat(t.event,"' was rejected in beforeSend function");return tce(t.event)?Wt.warn("".concat(i,". This can cause unexpected behavior.")):Wt.info(i),null}s.properties&&!ip(s.properties)||Wt.warn("Event '".concat(t.event,"' has no properties after beforeSend function, this is likely an error."))}return s}getPageViewId(){var t;return(t=this.pageViewManager._currentPageview)===null||t===void 0?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,s){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(s)})}}(function(e,t){for(var n=0;n<t.length;n++)e.prototype[t[n]]=sce(e.prototype[t[n]])})(sC,["identify"]);var nO,qd=(nO=s0[Yf]=new sC,function(){function e(){e.done||(e.done=!0,vG=!1,ds(s0,function(t){t._dom_loaded()}))}Ot!=null&&Ot.addEventListener?Ot.readyState==="complete"?e():nr(Ot,"DOMContentLoaded",e,{capture:!1}):Xe&&Wt.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),nO),M2=m.createContext({client:qd});function bG(e,t,n){if(n===void 0&&(n=new WeakMap),e===t)return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(n.has(e)&&n.get(e)===t)return!0;n.set(e,t);var s=Object.keys(e),r=Object.keys(t);if(s.length!==r.length)return!1;for(var i=0,a=s;i<a.length;i++){var o=a[i];if(!r.includes(o)||!bG(e[o],t[o],n))return!1}return!0}function ade(e){var t=e.children,n=e.client,s=e.apiKey,r=e.options,i=m.useRef(null),a=m.useMemo(function(){return n?(s&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),r&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),n):(s||console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior."),qd)},[n,s,JSON.stringify(r)]);return m.useEffect(function(){if(!n){var o=i.current;o?(s!==o.apiKey&&console.warn("[PostHog.js] You have provided a different `apiKey` to `PostHogProvider` than the one that was already initialized. This is not supported by our provider and we'll keep using the previous key. If you need to toggle between API Keys you need to control the `client` yourself and pass it in as a prop rather than an `apiKey` prop."),r&&!bG(r,o.options)&&qd.set_config(r),i.current={apiKey:s,options:r??{}}):(qd.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),qd.init(s,r),i.current={apiKey:s,options:r??{}})}},[n,s,JSON.stringify(r)]),st.createElement(M2.Provider,{value:{client:a}},t)}var ode=function(){var e=m.useContext(M2).client;return e};function dS(e){var t=ode(),n=m.useState(function(){return t.isFeatureEnabled(e)}),s=n[0],r=n[1];return m.useEffect(function(){return t.onFeatureFlags(function(){r(t.isFeatureEnabled(e))})},[t,e]),s}var ST=function(e,t){return ST=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(n[r]=s[r])},ST(e,t)};function lde(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");ST(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var hS=function(e){return typeof e=="function"},cde={componentStack:null,error:null},ude={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."};(function(e){lde(t,e);function t(n){var s=e.call(this,n)||this;return s.state=cde,s}return t.prototype.componentDidCatch=function(n,s){var r=s.componentStack,i=this.props.additionalProperties;this.setState({error:n,componentStack:r});var a;hS(i)?a=i(n):typeof i=="object"&&(a=i);var o=this.context.client;o.captureException(n,a)},t.prototype.render=function(){var n=this.props,s=n.children,r=n.fallback,i=this.state;if(i.componentStack==null)return hS(s)?s():s;var a=hS(r)?st.createElement(r,{error:i.error,componentStack:i.componentStack}):r;return st.isValidElement(a)?a:(console.warn(ude.INVALID_FALLBACK),st.createElement(st.Fragment,null))},t.contextType=M2,t})(st.Component);/**
|
|
@@ -668,7 +668,7 @@ If you are trying to annotate ${s} with application data, use the '${s}.context'
|
|
|
668
668
|
*
|
|
669
669
|
* This source code is licensed under the MIT license found in the
|
|
670
670
|
* LICENSE file in the root directory of this source tree.
|
|
671
|
-
*/var e5;function aot(){if(e5)return km;e5=1;var e=st,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 km.Fragment=n,km.jsx=a,km.jsxs=a,km}var t5;function oot(){return t5||(t5=1,Z6.exports=aot()),Z6.exports}var lot=oot();/*! shepherd.js 14.5.0 */function cot(e){return e instanceof Element}function ug(e){return e instanceof HTMLElement}function ld(e){return typeof e=="function"}function Vv(e){return typeof e=="string"}function fi(e){return e===void 0}class gI{on(t,n,s,r=!1){var i;return fi(this.bindings)&&(this.bindings={}),fi(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(fi(this.bindings)||fi(this.bindings[t]))return this;if(fi(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(!fi(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 oa(){return oa=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},oa.apply(null,arguments)}function mI(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 _d={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")};_d.defaultMerge;function uot(e,t){return t}function dot(e,t){return e.filter(n=>n!==void 0)}var n5;(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"})(n5||(n5={}));function s5(e){return typeof e!="object"||e===null?0:Array.isArray(e)?2:pot(e)?1:e instanceof Set?3:e instanceof Map?4:5}function hot(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 fot(e,t){return typeof e=="object"&&Object.prototype.propertyIsEnumerable.call(e,t)}function DX(e){return{*[Symbol.iterator](){for(const t of e)for(const n of t)yield n}}}const r5=new Set(["[object Object]","[object Module]"]);function pot(e){if(!r5.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"||!r5.has(Object.prototype.toString.call(n))||!n.hasOwnProperty("isPrototypeOf"))}function got(e,t,n){const s={};for(const r of hot(e)){const i=[];for(const l of e)fot(l,r)&&i.push(l[r]);if(i.length===0)continue;const a=t.metaDataUpdater(n,{key:r,parents:e}),o=IX(i,t,a);o!==_d.skip&&(r==="__proto__"?Object.defineProperty(s,r,{value:o,configurable:!0,enumerable:!0,writable:!0}):s[r]=o)}return s}function mot(e){return e.flat()}function vot(e){return new Set(DX(e))}function bot(e){return new Map(DX(e))}function xot(e){return e.at(-1)}const Wx={mergeRecords:got,mergeArrays:mot,mergeSets:vot,mergeMaps:bot,mergeOthers:xot};function vI(...e){return _ot({})(...e)}function _ot(e,t){const n=wot(e,s);function s(...r){return IX(r,n,t)}return s}function wot(e,t){var n,s,r;return{defaultMergeFunctions:Wx,mergeFunctions:oa({},Wx,Object.fromEntries(Object.entries(e).filter(([i,a])=>Object.hasOwn(Wx,i)).map(([i,a])=>a===!1?[i,Wx.mergeOthers]:[i,a]))),metaDataUpdater:(n=e.metaDataUpdater)!=null?n:uot,deepmerge:t,useImplicitDefaultMerging:(s=e.enableImplicitDefaultMerging)!=null?s:!1,filterValues:e.filterValues===!1?void 0:(r=e.filterValues)!=null?r:dot,actions:_d}}function IX(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 hE(r,t,n);const i=s5(r[0]);if(i!==0&&i!==5){for(let a=1;a<r.length;a++)if(s5(r[a])!==i)return hE(r,t,n)}switch(i){case 1:return yot(r,t,n);case 2:return Cot(r,t,n);case 3:return Sot(r,t,n);case 4:return kot(r,t,n);default:return hE(r,t,n)}}function yot(e,t,n){const s=t.mergeFunctions.mergeRecords(e,t,n);return s===_d.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeRecords!==t.defaultMergeFunctions.mergeRecords?t.defaultMergeFunctions.mergeRecords(e,t,n):s}function Cot(e,t,n){const s=t.mergeFunctions.mergeArrays(e,t,n);return s===_d.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeArrays!==t.defaultMergeFunctions.mergeArrays?t.defaultMergeFunctions.mergeArrays(e):s}function Sot(e,t,n){const s=t.mergeFunctions.mergeSets(e,t,n);return s===_d.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeSets!==t.defaultMergeFunctions.mergeSets?t.defaultMergeFunctions.mergeSets(e):s}function kot(e,t,n){const s=t.mergeFunctions.mergeMaps(e,t,n);return s===_d.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps?t.defaultMergeFunctions.mergeMaps(e):s}function hE(e,t,n){const s=t.mergeFunctions.mergeOthers(e,t,n);return s===_d.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(e):s}function bI(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 Eot(e,t){return n=>{if(e.isOpen()){const s=e.el&&n.currentTarget===e.el;(!fi(t)&&n.currentTarget.matches(t)||s)&&e.tour.next()}}}function Tot(e){const{event:t,selector:n}=e.options.advanceOn||{};if(t){const s=Eot(e,n);let r=null;if(!fi(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 Rot{constructor(t){}}class Aot{constructor(t,n){}}function PX(e){return!Vv(e)||e===""?"":e.charAt(e.length-1)!=="-"?`${e}-`:e}function Fot(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 Dot(e){return e.options.extraHighlights?e.options.extraHighlights.flatMap(t=>Array.from(document.querySelectorAll(t))):[]}function NX(e){return e==null?!0:!e.element||!e.on}function MX(){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 Iot=["top","right","bottom","left"],i5=["start","end"],a5=Iot.reduce((e,t)=>e.concat(t,t+"-"+i5[0],t+"-"+i5[1]),[]),dg=Math.min,yh=Math.max,gy=Math.round,zx=Math.floor,Ml=e=>({x:e,y:e}),Pot={left:"right",right:"left",bottom:"top",top:"bottom"},Not={start:"end",end:"start"};function yA(e,t,n){return yh(e,dg(t,n))}function zh(e,t){return typeof e=="function"?e(t):e}function Vc(e){return e.split("-")[0]}function Mc(e){return e.split("-")[1]}function xI(e){return e==="x"?"y":"x"}function _I(e){return e==="y"?"height":"width"}function hg(e){return["top","bottom"].includes(Vc(e))?"y":"x"}function wI(e){return xI(hg(e))}function OX(e,t,n){n===void 0&&(n=!1);const s=Mc(e),r=wI(e),i=_I(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 Mot(e){const t=vy(e);return[my(e),t,my(t)]}function my(e){return e.replace(/start|end/g,t=>Not[t])}function Oot(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 Lot(e,t,n,s){const r=Mc(e);let i=Oot(Vc(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=>Pot[t])}function Bot(e){return oa({top:0,right:0,bottom:0,left:0},e)}function LX(e){return typeof e!="number"?Bot(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"],Hot=["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"],Uot=["mainAxis","crossAxis","limiter"];function o5(e,t,n){let{reference:s,floating:r}=e;const i=hg(t),a=wI(t),o=_I(a),l=Vc(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(Mc(t)){case"start":g[a]-=p*(n&&u?-1:1);break;case"end":g[a]+=p*(n&&u?-1:1);break}return g}const Got=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}=o5(u,s,l),p=s,g={},v=0;for(let b=0;b<o.length;b++){const{name:x,fn:_}=o[b],{x:w,y,data:S,reset:C}=await _({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=oa({},g,{[x]:oa({},g[x],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}=o5(u,p,l)),b=-1)}return{x:d,y:f,placement:p,strategy:r,middlewareData:g}};async function yI(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}=zh(t,e),v=LX(g),b=o[p?f==="floating"?"reference":"floating":f],x=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})),_=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:_,offsetParent:w,strategy:l}):_);return{top:(x.top-S.top+v.top)/y.y,bottom:(S.bottom-x.bottom+v.bottom)/y.y,left:(x.left-S.left+v.left)/y.x,right:(S.right-x.right+v.right)/y.x}}const Vot=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}=zh(e,t)||{};if(u==null)return{};const f=LX(d),p={x:n,y:s},g=wI(r),v=_I(g),b=await a.getDimensions(u),x=g==="y",_=x?"top":"left",w=x?"bottom":"right",y=x?"clientHeight":"clientWidth",S=i.reference[v]+i.reference[g]-p[g]-i.floating[v],C=p[g]-i.reference[g],E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let k=E?E[y]:0;(!k||!await(a.isElement==null?void 0:a.isElement(E)))&&(k=o.floating[y]||i.floating[v]);const F=S/2-C/2,A=k/2-b[v]/2-1,I=dg(f[_],A),P=dg(f[w],A),N=I,B=k-b[v]-P,H=k/2-b[v]/2+F,O=yA(N,H,B),X=!l.arrow&&Mc(r)!=null&&H!==O&&i.reference[v]/2-(H<N?I:P)-b[v]/2<0,ee=X?H<N?H-N:H-B:0;return{[g]:p[g]+ee,data:oa({[g]:O,centerOffset:H-O-ee},X&&{alignmentOffset:ee}),reset:X}}});function Wot(e,t,n){return(e?[...n.filter(s=>Mc(s)===e),...n.filter(s=>Mc(s)!==e)]:n.filter(s=>Vc(s)===s)).filter(s=>e?Mc(s)===e||(t?my(s)!==s:!1):!0)}const zot=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=zh(e,t),{crossAxis:f=!1,alignment:p,allowedPlacements:g=a5,autoAlignment:v=!0}=d,b=mI(d,jot),x=p!==void 0||g===a5?Wot(p||null,v,g):g,_=await yI(t,b),w=((n=a.autoPlacement)==null?void 0:n.index)||0,y=x[w];if(y==null)return{};const S=OX(y,i,await(l.isRTL==null?void 0:l.isRTL(u.floating)));if(o!==y)return{reset:{placement:x[0]}};const C=[_[Vc(y)],_[S[0]],_[S[1]]],E=[...((s=a.autoPlacement)==null?void 0:s.overflows)||[],{placement:y,overflows:C}],k=x[w+1];if(k)return{data:{index:w+1,overflows:E},reset:{placement:k}};const F=E.map(I=>{const P=Mc(I.placement);return[I.placement,P&&f?I.overflows.slice(0,2).reduce((N,B)=>N+B,0):I.overflows[0],I.overflows]}).sort((I,P)=>I[1]-P[1]),A=((r=F.filter(I=>I[2].slice(0,Mc(I[0])?2:3).every(P=>P<=0))[0])==null?void 0:r[0])||F[0][0];return A!==o?{data:{index:w+1,overflows:E},reset:{placement:A}}:{}}}},$ot=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=zh(e,t),{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:x=!0}=d,_=mI(d,Hot);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=Vc(r),y=hg(o),S=Vc(o)===o,C=await(l.isRTL==null?void 0:l.isRTL(u.floating)),E=g||(S||!x?[vy(o)]:Mot(o)),k=b!=="none";!g&&k&&E.push(...Lot(o,x,b,C));const F=[o,...E],A=await yI(t,_),I=[];let P=((s=i.flip)==null?void 0:s.overflows)||[];if(f&&I.push(A[w]),p){const O=OX(r,a,C);I.push(A[O[0]],A[O[1]])}if(P=[...P,{placement:r,overflows:I}],!I.every(O=>O<=0)){var N,B;const O=(((N=i.flip)==null?void 0:N.index)||0)+1,X=F[O];if(X)return{data:{index:O,overflows:P},reset:{placement:X}};let ee=(B=P.filter(se=>se.overflows[0]<=0).sort((se,q)=>se.overflows[1]-q.overflows[1])[0])==null?void 0:B.placement;if(!ee)switch(v){case"bestFit":{var H;const se=(H=P.filter(q=>{if(k){const ne=hg(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:H[0];se&&(ee=se);break}case"initialPlacement":ee=o;break}if(r!==ee)return{reset:{placement:ee}}}return{}}}},qot=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:r}=t,i=zh(e,t),{mainAxis:a=!0,crossAxis:o=!1,limiter:l={fn:_=>{let{x:w,y}=_;return{x:w,y}}}}=i,u=mI(i,Uot),d={x:n,y:s},f=await yI(t,u),p=hg(Vc(r)),g=xI(p);let v=d[g],b=d[p];if(a){const _=g==="y"?"top":"left",w=g==="y"?"bottom":"right",y=v+f[_],S=v-f[w];v=yA(y,v,S)}if(o){const _=p==="y"?"top":"left",w=p==="y"?"bottom":"right",y=b+f[_],S=b-f[w];b=yA(y,b,S)}const x=l.fn(oa({},t,{[g]:v,[p]:b}));return oa({},x,{data:{x:x.x-n,y:x.y-s}})}}},Kot=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}=zh(e,t),d={x:n,y:s},f=hg(r),p=xI(f);let g=d[p],v=d[f];const b=zh(o,t),x=typeof b=="number"?{mainAxis:b,crossAxis:0}:oa({mainAxis:0,crossAxis:0},b);if(l){const y=p==="y"?"height":"width",S=i.reference[p]-i.floating[y]+x.mainAxis,C=i.reference[p]+i.reference[y]-x.mainAxis;g<S?g=S:g>C&&(g=C)}if(u){var _,w;const y=p==="y"?"width":"height",S=["top","left"].includes(Vc(r)),C=i.reference[f]-i.floating[y]+(S&&((_=a.offset)==null?void 0:_[f])||0)+(S?0:x.crossAxis),E=i.reference[f]+i.reference[y]+(S?0:((w=a.offset)==null?void 0:w[f])||0)-(S?x.crossAxis:0);v<C?v=C:v>E&&(v=E)}return{[p]:g,[f]:v}}}};function JC(){return typeof window<"u"}function Bg(e){return BX(e)?(e.nodeName||"").toLowerCase():"#document"}function Da(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Yl(e){var t;return(t=(BX(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function BX(e){return JC()?e instanceof Node||e instanceof Da(e).Node:!1}function Jo(e){return JC()?e instanceof Element||e instanceof Da(e).Element:!1}function Gl(e){return JC()?e instanceof HTMLElement||e instanceof Da(e).HTMLElement:!1}function l5(e){return!JC()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Da(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 Yot(e){return["table","td","th"].includes(Bg(e))}function ZC(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function CI(e){const t=SI(),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 Xot(e){let t=cd(e);for(;Gl(t)&&!fg(t);){if(CI(t))return t;if(ZC(t))return null;t=cd(t)}return null}function SI(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function fg(e){return["html","body","#document"].includes(Bg(e))}function Zo(e){return Da(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(Bg(e)==="html")return e;const t=e.assignedSlot||e.parentNode||l5(e)&&e.host||Yl(e);return l5(t)?t.host:t}function jX(e){const t=cd(e);return fg(t)?e.ownerDocument?e.ownerDocument.body:e.body:Gl(t)&&Tb(t)?t:jX(t)}function Wv(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=jX(e),i=r===((s=e.ownerDocument)==null?void 0:s.body),a=Da(r);if(i){const o=CA(a);return t.concat(a,a.visualViewport||[],Tb(r)?r:[],o&&n?Wv(o):[])}return t.concat(r,Wv(r,[],n))}function CA(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function HX(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 kI(e){return Jo(e)?e:e.contextElement}function Hp(e){const t=kI(e);if(!Gl(t))return Ml(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:i}=HX(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 Qot=Ml(0);function UX(e){const t=Da(e);return!SI()||!t.visualViewport?Qot:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Jot(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Da(e)?!1:t}function $h(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=kI(e);let a=Ml(1);t&&(s?Jo(s)&&(a=Hp(s)):a=Hp(e));const o=Jot(i,n,s)?UX(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=Da(i),g=s&&Jo(s)?Da(s):s;let v=p,b=CA(v);for(;b&&s&&g!==v;){const x=Hp(b),_=b.getBoundingClientRect(),w=Zo(b),y=_.left+(b.clientLeft+parseFloat(w.paddingLeft))*x.x,S=_.top+(b.clientTop+parseFloat(w.paddingTop))*x.y;l*=x.x,u*=x.y,d*=x.x,f*=x.y,l+=y,u+=S,v=Da(b),b=CA(v)}}return by({width:d,height:f,x:l,y:u})}function EI(e,t){const n=e1(e).scrollLeft;return t?t.left+n:$h(Yl(e)).left+n}function GX(e,t,n){n===void 0&&(n=!1);const s=e.getBoundingClientRect(),r=s.left+t.scrollLeft-(n?0:EI(e,s)),i=s.top+t.scrollTop;return{x:r,y:i}}function Zot(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)&&((Bg(s)!=="body"||Tb(a))&&(l=e1(s)),Gl(s))){const g=$h(s);u=Hp(s),d.x=g.x+s.clientLeft,d.y=g.y+s.clientTop}const p=a&&!f&&!i?GX(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 elt(e){return Array.from(e.getClientRects())}function tlt(e){const t=Yl(e),n=e1(e),s=e.ownerDocument.body,r=yh(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),i=yh(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let a=-n.scrollLeft+EI(e);const o=-n.scrollTop;return Zo(s).direction==="rtl"&&(a+=yh(t.clientWidth,s.clientWidth)-r),{width:r,height:i,x:a,y:o}}function nlt(e,t){const n=Da(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=SI();(!u||u&&t==="fixed")&&(o=r.offsetLeft,l=r.offsetTop)}return{width:i,height:a,x:o,y:l}}function slt(e,t){const n=$h(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,i=Gl(e)?Hp(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 c5(e,t,n){let s;if(t==="viewport")s=nlt(e,n);else if(t==="document")s=tlt(Yl(e));else if(Jo(t))s=slt(t,n);else{const r=UX(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return by(s)}function VX(e,t){const n=cd(e);return n===t||!Jo(n)||fg(n)?!1:Zo(n).position==="fixed"||VX(n,t)}function rlt(e,t){const n=t.get(e);if(n)return n;let s=Wv(e,[],!1).filter(o=>Jo(o)&&Bg(o)!=="body"),r=null;const i=Zo(e).position==="fixed";let a=i?cd(e):e;for(;Jo(a)&&!fg(a);){const o=Zo(a),l=CI(a);!l&&o.position==="fixed"&&(r=null),(i?!l&&!r:!l&&o.position==="static"&&r&&["absolute","fixed"].includes(r.position)||Tb(a)&&!l&&VX(e,a))?s=s.filter(u=>u!==a):r=o,a=cd(a)}return t.set(e,s),s}function ilt(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const i=[...n==="clippingAncestors"?ZC(t)?[]:rlt(t,this._c):[].concat(n),s],a=i[0],o=i.reduce((l,u)=>{const d=c5(t,u,r);return l.top=yh(d.top,l.top),l.right=dg(d.right,l.right),l.bottom=dg(d.bottom,l.bottom),l.left=yh(d.left,l.left),l},c5(t,a,r));return{width:o.right-o.left,height:o.bottom-o.top,x:o.left,y:o.top}}function alt(e){const{width:t,height:n}=HX(e);return{width:t,height:n}}function olt(e,t,n){const s=Gl(t),r=Yl(t),i=n==="fixed",a=$h(e,!0,i,t);let o={scrollLeft:0,scrollTop:0};const l=Ml(0);if(s||!s&&!i)if((Bg(t)!=="body"||Tb(r))&&(o=e1(t)),s){const p=$h(t,!0,i,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else r&&(l.x=EI(r));const u=r&&!s&&!i?GX(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 fE(e){return Zo(e).position==="static"}function u5(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 WX(e,t){const n=Da(e);if(ZC(e))return n;if(!Gl(e)){let r=cd(e);for(;r&&!fg(r);){if(Jo(r)&&!fE(r))return r;r=cd(r)}return n}let s=u5(e,t);for(;s&&Yot(s)&&fE(s);)s=u5(s,t);return s&&fg(s)&&fE(s)&&!CI(s)?n:s||Xot(e)||n}const llt=async function(e){const t=this.getOffsetParent||WX,n=this.getDimensions,s=await n(e.floating);return{reference:olt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function clt(e){return Zo(e).direction==="rtl"}const ult={convertOffsetParentRelativeRectToViewportRelativeRect:Zot,getDocumentElement:Yl,getClippingRect:ilt,getOffsetParent:WX,getElementRects:llt,getClientRects:elt,getDimensions:alt,getScale:Hp,isElement:Jo,isRTL:clt};function dlt(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=zx(d),v=zx(r.clientWidth-(u+f)),b=zx(r.clientHeight-(d+p)),x=zx(u),_={rootMargin:-g+"px "+-v+"px "+-b+"px "+-x+"px",threshold:yh(0,dg(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,oa({},_,{root:r.ownerDocument}))}catch{n=new IntersectionObserver(y,_)}n.observe(e)}return a(!0),i}function hlt(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=kI(e),d=r||i?[...u?Wv(u):[],...Wv(t)]:[];d.forEach(_=>{r&&_.addEventListener("scroll",n,{passive:!0}),i&&_.addEventListener("resize",n)});const f=u&&o?dlt(u,n):null;let p=-1,g=null;a&&(g=new ResizeObserver(_=>{let[w]=_;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?$h(e):null;l&&x();function x(){const _=$h(e);b&&(_.x!==b.x||_.y!==b.y||_.width!==b.width||_.height!==b.height)&&n(),b=_,v=requestAnimationFrame(x)}return n(),()=>{var _;d.forEach(w=>{r&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),f?.(),(_=g)==null||_.disconnect(),g=null,l&&cancelAnimationFrame(v)}}const flt=zot,plt=qot,glt=$ot,mlt=Vot,vlt=Kot,blt=(e,t,n)=>{const s=new Map,r=oa({platform:ult},n),i=oa({},r.platform,{_c:s});return Got(e,t,oa({},r,{platform:i}))};function xlt(e){e.cleanup&&e.cleanup();const t=e._getResolvedAttachToOptions();let n=t.element;const s=klt(t,e),r=NX(t);return r&&(n=document.body,e.shepherdElementComponent.getElement().classList.add("shepherd-centered")),e.cleanup=hlt(n,e.el,()=>{if(!e.el){e.cleanup==null||e.cleanup();return}ylt(n,e,s,r)}),e.target=t.element,s}function _lt(e,t){return{floatingUIOptions:vI(e.floatingUIOptions||{},t.floatingUIOptions||{})}}function wlt(e){e.cleanup&&e.cleanup(),e.cleanup=null}function ylt(e,t,n,s){return blt(e,t.el,n).then(Clt(t,s)).then(r=>new Promise(i=>{setTimeout(()=>i(r),300)})).then(r=>{r!=null&&r.el&&r.el.focus({preventScroll:!0})})}function Clt(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,Slt(e.el,i)),e)}function Slt(e,t){const n=e.querySelector(".shepherd-arrow");if(ug(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 klt(e,t){var n,s,r;const i={strategy:"absolute"};i.middleware=[];const a=Elt(t),o=NX(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(flt({crossAxis:!0,alignment:u?e==null||(d=e.on)==null?void 0:d.split("-").pop():null}))}else i.middleware.push(glt());if(i.middleware.push(plt({limiter:vlt(),crossAxis:!0})),a){const f=typeof t.options.arrow=="object"?t.options.arrow:{padding:4};i.middleware.push(mlt({element:a,padding:u?f.padding:0}))}l||(i.placement=e.on)}return vI(i,t.options.floatingUIOptions||{})}function Elt(e){return e.options.arrow&&e.el?e.el.querySelector(".shepherd-arrow"):!1}function Na(){}function Tlt(e,t){for(const n in t)e[n]=t[n];return e}function zX(e){return e()}function d5(){return Object.create(null)}function Rb(e){e.forEach(zX)}function TI(e){return typeof e=="function"}function Zc(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Rlt(e){return Object.keys(e).length===0}function pg(e,t){e.appendChild(t)}function il(e,t,n){e.insertBefore(t,n||null)}function So(e){e.parentNode&&e.parentNode.removeChild(e)}function Alt(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 h5(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function $X(e){return document.createTextNode(e)}function xy(){return $X(" ")}function Flt(){return $X("")}function t1(e,t,n,s){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n,s)}function hs(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}const Dlt=["width","height"];function f5(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&&Dlt.indexOf(s)===-1?e[s]=t[s]:hs(e,s,t[s])}function Ilt(e){return Array.from(e.childNodes)}function Hf(e,t,n){e.classList.toggle(t,!!n)}let zv;function L0(e){zv=e}function qX(){if(!zv)throw new Error("Function called outside component initialization");return zv}function Plt(e){qX().$$.on_mount.push(e)}function RI(e){qX().$$.after_update.push(e)}const np=[],gg=[];let Up=[];const p5=[],Nlt=Promise.resolve();let SA=!1;function Mlt(){SA||(SA=!0,Nlt.then(KX))}function kA(e){Up.push(e)}const pE=new Set;let Uf=0;function KX(){if(Uf!==0)return;const e=zv;do{try{for(;Uf<np.length;){const t=np[Uf];Uf++,L0(t),Olt(t.$$)}}catch(t){throw np.length=0,Uf=0,t}for(L0(null),np.length=0,Uf=0;gg.length;)gg.pop()();for(let t=0;t<Up.length;t+=1){const n=Up[t];pE.has(n)||(pE.add(n),n())}Up.length=0}while(np.length);for(;p5.length;)p5.pop()();SA=!1,pE.clear(),L0(e)}function Olt(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(kA)}}function Llt(e){const t=[],n=[];Up.forEach(s=>e.indexOf(s)===-1?t.push(s):n.push(s)),n.forEach(s=>s()),Up=t}const E_=new Set;let ih;function Ch(){ih={r:0,c:[],p:ih}}function Sh(){ih.r||Rb(ih.c),ih=ih.p}function ns(e,t){e&&e.i&&(E_.delete(e),e.i(t))}function tr(e,t,n,s){if(e&&e.o){if(E_.has(e))return;E_.add(e),ih.c.push(()=>{E_.delete(e),s&&(n&&e.d(1),s())}),e.o(t)}else s&&s()}function g5(e){return e?.length!==void 0?e:Array.from(e)}function Blt(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 uf(e){e&&e.c()}function wd(e,t,n){const{fragment:s,after_update:r}=e.$$;s&&s.m(t,n),kA(()=>{const i=e.$$.on_mount.map(zX).filter(TI);e.$$.on_destroy?e.$$.on_destroy.push(...i):Rb(i),e.$$.on_mount=[]}),r.forEach(kA)}function yd(e,t){const n=e.$$;n.fragment!==null&&(Llt(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&&(np.push(e),Mlt(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function eu(e,t,n,s,r,i,a=null,o=[-1]){const l=zv;L0(e);const u=e.$$={fragment:null,ctx:[],props:i,update:Na,not_equal:r,bound:d5(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:d5(),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=Ilt(t.target);u.fragment&&u.fragment.l(f),f.forEach(So)}else u.fragment&&u.fragment.c();t.intro&&ns(e.$$.fragment),wd(e,t.target,t.anchor),KX()}L0(l)}class tu{constructor(){this.$$=void 0,this.$$set=void 0}$destroy(){yd(this,1),this.$destroy=Na}$on(t,n){if(!TI(n))return Na;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&&!Rlt(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Hlt="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Hlt);function Ult(e){let t,n,s,r,i;return{c(){t=Vl("button"),hs(t,"aria-label",n=e[3]?e[3]:null),hs(t,"class",s=`${e[1]||""} shepherd-button ${e[4]?"shepherd-button-secondary":""}`),t.disabled=e[2],hs(t,"tabindex","0"),hs(t,"type","button")},m(a,o){il(a,t,o),t.innerHTML=e[5],r||(i=t1(t,"click",function(){TI(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)&&hs(t,"aria-label",n),o&18&&s!==(s=`${e[1]||""} shepherd-button ${e[4]?"shepherd-button-secondary":""}`)&&hs(t,"class",s),o&4&&(t.disabled=e[2])},i:Na,o:Na,d(a){a&&So(t),r=!1,i()}}}function Glt(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 Vlt extends tu{constructor(t){super(),eu(this,t,Glt,Ult,Zc,{config:6,step:7})}}function m5(e,t,n){const s=e.slice();return s[2]=t[n],s}function v5(e){let t,n,s=g5(e[1]),r=[];for(let a=0;a<s.length;a+=1)r[a]=b5(m5(e,s,a));const i=a=>tr(r[a],1,1,()=>{r[a]=null});return{c(){for(let a=0;a<r.length;a+=1)r[a].c();t=Flt()},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=g5(a[1]);let l;for(l=0;l<s.length;l+=1){const u=m5(a,s,l);r[l]?(r[l].p(u,o),ns(r[l],1)):(r[l]=b5(u),r[l].c(),ns(r[l],1),r[l].m(t.parentNode,t))}for(Ch(),l=s.length;l<r.length;l+=1)i(l);Sh()}},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)tr(r[o]);n=!1},d(a){a&&So(t),Alt(r,a)}}}function b5(e){let t,n;return t=new Vlt({props:{config:e[2],step:e[0]}}),{c(){uf(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){tr(t.$$.fragment,s),n=!1},d(s){yd(t,s)}}}function Wlt(e){let t,n,s=e[1]&&v5(e);return{c(){t=Vl("footer"),s&&s.c(),hs(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=v5(r),s.c(),ns(s,1),s.m(t,null)):s&&(Ch(),tr(s,1,1,()=>{s=null}),Sh())},i(r){n||(ns(s),n=!0)},o(r){tr(s),n=!1},d(r){r&&So(t),s&&s.d()}}}function zlt(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 $lt extends tu{constructor(t){super(),eu(this,t,zlt,Wlt,Zc,{step:0})}}function qlt(e){let t,n,s,r,i;return{c(){t=Vl("button"),n=Vl("span"),n.textContent="×",hs(n,"aria-hidden","true"),hs(t,"aria-label",s=e[0].label?e[0].label:"Close Tour"),hs(t,"class","shepherd-cancel-icon"),hs(t,"type","button")},m(a,o){il(a,t,o),pg(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")&&hs(t,"aria-label",s)},i:Na,o:Na,d(a){a&&So(t),r=!1,i()}}}function Klt(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 Ylt extends tu{constructor(t){super(),eu(this,t,Klt,qlt,Zc,{cancelIcon:0,step:2})}}function Xlt(e){let t;return{c(){t=Vl("h3"),hs(t,"id",e[1]),hs(t,"class","shepherd-title")},m(n,s){il(n,t,s),e[3](t)},p(n,[s]){s&2&&hs(t,"id",n[1])},i:Na,o:Na,d(n){n&&So(t),e[3](null)}}}function Qlt(e,t,n){let{labelId:s,element:r,title:i}=t;RI(()=>{ld(i)&&n(2,i=i()),n(0,r.innerHTML=i,r)});function a(o){gg[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 Jlt extends tu{constructor(t){super(),eu(this,t,Qlt,Xlt,Zc,{labelId:1,element:0,title:2})}}function x5(e){let t,n;return t=new Jlt({props:{labelId:e[0],title:e[2]}}),{c(){uf(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){tr(t.$$.fragment,s),n=!1},d(s){yd(t,s)}}}function _5(e){let t,n;return t=new Ylt({props:{cancelIcon:e[3],step:e[1]}}),{c(){uf(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){tr(t.$$.fragment,s),n=!1},d(s){yd(t,s)}}}function Zlt(e){let t,n,s,r=e[2]&&x5(e),i=e[3]&&e[3].enabled&&_5(e);return{c(){t=Vl("header"),r&&r.c(),n=xy(),i&&i.c(),hs(t,"class","shepherd-header")},m(a,o){il(a,t,o),r&&r.m(t,null),pg(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=x5(a),r.c(),ns(r,1),r.m(t,n)):r&&(Ch(),tr(r,1,1,()=>{r=null}),Sh()),a[3]&&a[3].enabled?i?(i.p(a,o),o&8&&ns(i,1)):(i=_5(a),i.c(),ns(i,1),i.m(t,null)):i&&(Ch(),tr(i,1,1,()=>{i=null}),Sh())},i(a){s||(ns(r),ns(i),s=!0)},o(a){tr(r),tr(i),s=!1},d(a){a&&So(t),r&&r.d(),i&&i.d()}}}function ect(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 tct extends tu{constructor(t){super(),eu(this,t,ect,Zlt,Zc,{labelId:0,step:1})}}function nct(e){let t;return{c(){t=Vl("div"),hs(t,"class","shepherd-text"),hs(t,"id",e[1])},m(n,s){il(n,t,s),e[3](t)},p(n,[s]){s&2&&hs(t,"id",n[1])},i:Na,o:Na,d(n){n&&So(t),e[3](null)}}}function sct(e,t,n){let{descriptionId:s,element:r,step:i}=t;RI(()=>{let{text:o}=i.options;ld(o)&&(o=o.call(i)),ug(o)?r.appendChild(o):n(0,r.innerHTML=o,r)});function a(o){gg[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 rct extends tu{constructor(t){super(),eu(this,t,sct,nct,Zc,{descriptionId:1,element:0,step:2})}}function w5(e){let t,n;return t=new tct({props:{labelId:e[1],step:e[2]}}),{c(){uf(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){tr(t.$$.fragment,s),n=!1},d(s){yd(t,s)}}}function y5(e){let t,n;return t=new rct({props:{descriptionId:e[0],step:e[2]}}),{c(){uf(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){tr(t.$$.fragment,s),n=!1},d(s){yd(t,s)}}}function C5(e){let t,n;return t=new $lt({props:{step:e[2]}}),{c(){uf(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){tr(t.$$.fragment,s),n=!1},d(s){yd(t,s)}}}function ict(e){let t,n=!fi(e[2].options.title)||e[2].options.cancelIcon&&e[2].options.cancelIcon.enabled,s,r=!fi(e[2].options.text),i,a=Array.isArray(e[2].options.buttons)&&e[2].options.buttons.length,o,l=n&&w5(e),u=r&&y5(e),d=a&&C5(e);return{c(){t=Vl("div"),l&&l.c(),s=xy(),u&&u.c(),i=xy(),d&&d.c(),hs(t,"class","shepherd-content")},m(f,p){il(f,t,p),l&&l.m(t,null),pg(t,s),u&&u.m(t,null),pg(t,i),d&&d.m(t,null),o=!0},p(f,[p]){p&4&&(n=!fi(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=w5(f),l.c(),ns(l,1),l.m(t,s)):l&&(Ch(),tr(l,1,1,()=>{l=null}),Sh()),p&4&&(r=!fi(f[2].options.text)),r?u?(u.p(f,p),p&4&&ns(u,1)):(u=y5(f),u.c(),ns(u,1),u.m(t,i)):u&&(Ch(),tr(u,1,1,()=>{u=null}),Sh()),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=C5(f),d.c(),ns(d,1),d.m(t,null)):d&&(Ch(),tr(d,1,1,()=>{d=null}),Sh())},i(f){o||(ns(l),ns(u),ns(d),o=!0)},o(f){tr(l),tr(u),tr(d),o=!1},d(f){f&&So(t),l&&l.d(),u&&u.d(),d&&d.d()}}}function act(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 oct extends tu{constructor(t){super(),eu(this,t,act,ict,Zc,{descriptionId:0,labelId:1,step:2})}}function S5(e){let t;return{c(){t=Vl("div"),hs(t,"class","shepherd-arrow"),hs(t,"data-popper-arrow","")},m(n,s){il(n,t,s)},d(n){n&&So(t)}}}function lct(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&&S5();s=new oct({props:{descriptionId:e[2],labelId:e[3],step:e[4]}});let d=[{"aria-describedby":r=fi(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=Tlt(f,d[p]);return{c(){t=Vl("dialog"),u&&u.c(),n=xy(),uf(s.$$.fragment),f5(t,f),Hf(t,"shepherd-has-cancel-icon",e[5]),Hf(t,"shepherd-has-title",e[6]),Hf(t,"shepherd-element",!0)},m(p,g){il(p,t,g),u&&u.m(t,null),pg(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=S5(),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),f5(t,f=Blt(d,[(!a||g&20&&r!==(r=fi(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"}])),Hf(t,"shepherd-has-cancel-icon",p[5]),Hf(t,"shepherd-has-title",p[6]),Hf(t,"shepherd-element",!0)},i(p){a||(ns(s.$$.fragment,p),a=!0)},o(p){tr(s.$$.fragment,p),a=!1},d(p){p&&So(t),u&&u.d(),yd(s),e[13](null),o=!1,l()}}}const cct=9,uct=27,dct=37,hct=39;function k5(e){return e.split(" ").filter(t=>!!t.length)}function fct(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;Plt(()=>{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])}),RI(()=>{v!==d.options.classes&&x()});function x(){_(v),v=d.options.classes,w(v)}function _(C){if(Vv(C)){const E=k5(C);E.length&&r.classList.remove(...E)}}function w(C){if(Vv(C)){const E=k5(C);E.length&&r.classList.add(...E)}}const y=C=>{const{tour:E}=d;switch(C.keyCode){case cct: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 uct:E.options.exitOnEsc&&(C.preventDefault(),C.stopPropagation(),d.cancel());break;case dct:E.options.keyboardNavigation&&(C.preventDefault(),C.stopPropagation(),E.back());break;case hct:E.options.keyboardNavigation&&(C.preventDefault(),C.stopPropagation(),E.next());break}};function S(C){gg[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 pct extends tu{constructor(t){super(),eu(this,t,fct,lct,Zc,{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 EA extends gI{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?PX(this.tour.options.classPrefix):"",this.styles=t.styles,this._resolvedAttachTo=null,bI(this),this._setOptions(n),this}cancel(){this.tour.cancel(),this.trigger("cancel")}complete(){this.tour.complete(),this.trigger("complete")}destroy(){wlt(this),ug(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=Dot(this),this._resolvedExtraHighlightElements}_resolveAttachToOptions(){return this._resolvedAttachTo=Fot(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 pct({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):cot(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=vI({},n||{}),this.options=Object.assign({arrow:!0},n,t,_lt(n,t));const{when:s}=this.options;this.options.classes=this._getClassOptions(t),this.destroy(),this.id=this.options.id||`step-${MX()}`,s&&Object.keys(s).forEach(r=>{this.on(r,s[r],this)})}_setupElements(){fi(this.el)||this.destroy(),this.el=this._createTooltipContent(),this.options.advanceOn&&Tot(this),xlt(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 gct(e){if(e){const{steps:t}=e;t.forEach(n=>{n.options&&n.options.canClickTarget===!1&&n.options.attachTo&&(ug(n.target)&&n.target.classList.remove("shepherd-target-click-disabled"),n._resolvedExtraHighlightElements&&n._resolvedExtraHighlightElements.forEach(s=>{ug(s)&&s.classList.remove("shepherd-target-click-disabled")}))})}}function mct(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 vct(e){let t,n,s,r,i;return{c(){t=h5("svg"),n=h5("path"),hs(n,"d",e[2]),hs(t,"class",s=`${e[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)},m(a,o){il(a,t,o),pg(t,n),e[11](t),r||(i=t1(t,"touchmove",e[3]),r=!0)},p(a,[o]){o&4&&hs(n,"d",a[2]),o&2&&s!==(s=`${a[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)&&hs(t,"class",s)},i:Na,o:Na,d(a){a&&So(t),e[11](null),r=!1,i()}}}function YX(e){if(!e)return null;const t=e instanceof HTMLElement&&window.getComputedStyle(e).overflowY;return t!=="hidden"&&t!=="visible"&&e.scrollHeight>=e.clientHeight?e:YX(e.parentElement)}function bct(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 xct(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 _ct(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),_()}function f(S=0,C=0,E=0,k=0,F,A,I){if(A){const P=[A,...I||[]];n(4,r=[]);for(const N of P){if(!N||P.indexOf(N)!==P.lastIndexOf(N))continue;const{y:B,height:H}=xct(N,F),{x:O,width:X,left:ee}=N.getBoundingClientRect();P.some(se=>{if(se===N)return!1;const q=se.getBoundingClientRect();return O>=q.left&&O+X<=q.right&&B>=q.top&&B+H<=q.bottom})||r.push({width:X+S*2,height:H+S*2,x:(O||ee)+E-S,y:B+k-S,r:C})}}else u()}function p(S){_(),S.tour.options.useModalOverlay?(w(S),g()):d()}function g(){n(1,i=!0)}const v=S=>{S.preventDefault()},b=S=>{S.stopPropagation()};function x(){window.addEventListener("touchmove",v,{passive:!1})}function _(){a&&(cancelAnimationFrame(a),a=void 0),window.removeEventListener("touchmove",v,{passive:!1})}function w(S){const{modalOverlayOpeningPadding:C,modalOverlayOpeningRadius:E,modalOverlayOpeningXOffset:k=0,modalOverlayOpeningYOffset:F=0}=S.options,A=bct(S.target),I=YX(S.target),P=()=>{a=void 0,f(C,E,k+A.left,F+A.top,I,S.target,S._resolvedExtraHighlightElements),a=requestAnimationFrame(P)};P(),x()}function y(S){gg[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=mct(r))},[s,i,o,b,r,l,u,d,f,p,g,y]}class wct extends tu{constructor(t){super(),eu(this,t,_ct,vct,Zc,{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 yct extends gI{constructor(){super(),this.activeTour=void 0,bI(this)}}class Cct extends gI{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,bI(this);const n={exitOnEsc:!0,keyboardNavigation:!0};return this.options=Object.assign({},n,t),this.classPrefix=PX(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,ah.trigger(r,i)})})(s)}),this._setTourID(t.id),this}addStep(t,n){let s=t;return s instanceof EA?s.tour=this:s=new EA(this,s),fi(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 ah.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()),gct(this),this.trigger(t,{index:n}),ah.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)}ug(this.focusedElBeforeOpen)&&this.focusedElBeforeOpen.focus()}_setupActiveTour(){this.trigger("active",{tour:this}),ah.activeTour=this}setupModal(){this.modal=new wct({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||MX();this.id=`${n}--${s}`}}const ah=new yct,XX=typeof window>"u";ah.Step=XX?Rot:EA;ah.Tour=XX?Aot:Cct;const n1=m.createContext(void 0);n1.Consumer;const Sct=({children:e})=>lot.jsx(n1.Provider,{value:{Shepherd:ah},children:e}),_y=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),kct=e=>_y(e).replace(/"/g,"""),it=e=>_y(h(e)),Ect=['<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(""),Tct=['<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(""),Rct={welcome:Ect,"agent-capabilities":Tct},E5=e=>e.map(t=>"key"in t?_y(h(t.key)):`<code>${_y(t.code)}</code>`).join(""),Act=e=>{const t="<br/>".repeat(e.breaks??0);return e.kind==="paragraph"?`${E5(e.runs)}${t}`:e.kind==="list"?`<ul>${e.items.map(s=>`<li>${E5(s)}</li>`).join("")}</ul>${t}`:`<div class="tour-figure tour-figure-${e.figure}" role="img" aria-label="${kct(h(e.altKey))}">${Rct[e.figure]}</div>${t}`},Sn=e=>e.map(Act).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}]},Fct=e=>{const t=Array.from(document.querySelectorAll(`[data-tour-tag="${e}"]`));return t.find(n=>n.offsetParent!==null)??t[0]??null},T5=e=>{document.querySelector(`[data-tour-action="${e}"]`)?.click()},QX=1340,AI="tour-beside-palette",s1="pre-command-palette-open-canvas",JX='[data-tour-tag="command-palette-dialog"]',_s=e=>Q5(Ym())!=="rtl"?e:e==="left"?"right":"left",Dct=e=>(e.getById(s1)?.options.classes??"").split(" ").includes(AI),ZX=(e,t)=>{const n=e.getById(s1);!n||Dct(e)===t||n.updateStepOptions(t?{attachTo:{element:JX,on:_s("right")},classes:AI}:{attachTo:void 0,classes:void 0})},eQ=e=>{const t=window.innerWidth>=QX;return ZX(e,t),t};let FI=0;const TA=new WeakMap;tt.subscribe((e,t)=>{t.isCommandPaletteOpen&&!e.isCommandPaletteOpen&&(FI+=1)});const tQ=e=>{const t=TA.get(e);return t===void 0||(TA.delete(e),t!==FI)?!1:(tt.getState().closeCommandPalette(),!0)},R5=(e,t)=>{if(!eQ(e)){t();return}const n=tt.getState();n.isCommandPaletteOpen||(n.openCommandPalette(),TA.set(e,FI)),setTimeout(()=>{e.isActive()&&t()},500)},A5=(e,t)=>{if(!tQ(e)){t();return}setTimeout(()=>{e.isActive()&&t()},500)},F5=e=>{const t=e?.step;if(t?.id!==s1)return;(!eQ(t.tour)||document.querySelector(JX)===null)&&ZX(t.tour,!1)},Ict=()=>{const e=window.innerWidth>=QX;return{id:s1,...e?{attachTo:{element:'[data-tour-tag="command-palette-dialog"]',on:_s("right")},classes:AI}:{},title:it("ui.onboarding.tour.pre_command_palette_open_canvas.title"),text:Sn(kn.pre_command_palette_open_canvas),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){A5(this,()=>this.back())}},{text:it("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){A5(this,()=>this.next())}}]}},nQ=()=>[{id:"welcome",title:it("ui.onboarding.tour.welcome.title"),text:Sn(kn.welcome),buttons:[{text:it("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:_s("right")},title:it("ui.onboarding.tour.agent_list.title"),text:Sn(kn.agent_list),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:_s("right")},title:it("ui.onboarding.tour.select_agent.title"),text:Sn(kn.select_agent),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:it("ui.onboarding.tour.chat_input.title"),text:Sn(kn.chat_input),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:it("ui.onboarding.tour.attachments.title"),text:Sn(kn.attachments),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:it("ui.onboarding.tour.agent_capabilities.title"),text:Sn(kn.agent_capabilities),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){R5(this,()=>this.next())}}]},Ict(),{id:"canvas-open-button",attachTo:{element:'button[data-tour-tag="open-canvas-button"]',on:_s("left")},title:it("ui.onboarding.tour.canvas_open_button.title"),text:Sn(kn.canvas_open_button),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){R5(this,()=>this.back())}},{text:it("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:_s("left")},title:it("ui.onboarding.tour.canvas_feature.title"),text:Sn(kn.canvas_feature),buttons:[{text:it("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:it("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:it("ui.onboarding.tour.canvas_documents_view.title"),text:Sn(kn.canvas_documents_view),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:it("ui.onboarding.tour.canvas_files_view.title"),text:Sn(kn.canvas_files_view),buttons:[{text:it("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:it("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:it("ui.onboarding.tour.canvas_variables_view.title"),text:Sn(kn.canvas_variables_view),buttons:[{text:it("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:it("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:_s("right")},title:it("ui.onboarding.tour.agent_options.title"),text:Sn(kn.agent_options),buttons:[{text:it("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:it("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:_s("right")},title:it("ui.onboarding.tour.click_view_settings_from_chat.title"),text:Sn(kn.click_view_settings_from_chat),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:_s("left")},title:it("ui.onboarding.tour.view_agent_settings.title"),text:Sn(kn.view_agent_settings),buttons:[{text:it("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:it("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:_s("left")},title:it("ui.onboarding.tour.select_provider.title"),text:Sn(kn.select_provider),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:_s("left")},title:it("ui.onboarding.tour.select_model.title"),text:Sn(kn.select_model),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:_s("left")},title:it("ui.onboarding.tour.modify_security_prompt.title"),text:Sn(kn.modify_security_prompt),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:_s("left")},title:it("ui.onboarding.tour.modify_agent_prompt.title"),text:Sn(kn.modify_agent_prompt),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:it("ui.onboarding.tour.create_new_agent.title"),text:Sn(kn.create_new_agent),buttons:[{text:it("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:it("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:_s("right")},title:it("ui.onboarding.tour.agent_naming_guidelines.title"),text:Sn(kn.agent_naming_guidelines),buttons:[{text:it("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:it("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:_s("right")},title:it("ui.onboarding.tour.navigate_agent_hub.title"),text:Sn(kn.navigate_agent_hub),buttons:[{text:it("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:it("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:_s("right")},title:it("ui.onboarding.tour.agent_hub_view.title"),text:Sn(kn.agent_hub_view),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:it("ui.onboarding.tour.download_agent.title"),text:Sn(kn.download_agent),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:()=>Fct("upload-to-hub-header-button"),on:"bottom"},title:it("ui.onboarding.tour.upload_agent_hub.title"),text:Sn(kn.upload_agent_hub),buttons:[{text:it("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:it("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){T5("open-upload-dialog"),setTimeout(()=>{this.next()},500)}}]},{id:"upload-agent-hub-dialog",attachTo:{element:'[data-tour-tag="upload-agent-dialog"]',on:_s("right")},title:it("ui.onboarding.tour.upload_agent_hub_dialog.title"),text:Sn(kn.upload_agent_hub_dialog),buttons:[{text:it("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:it("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:_s("right")},title:it("ui.onboarding.tour.navigate_schedules.title"),text:Sn(kn.navigate_schedules),buttons:[{text:it("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(()=>{T5("open-upload-dialog")},500),setTimeout(()=>{this.back()},1e3)}},{text:it("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:it("ui.onboarding.tour.schedules_overview.title"),text:Sn(kn.schedules_overview),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:it("ui.onboarding.tour.create_schedule.title"),text:Sn(kn.create_schedule),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:_s("right")},title:it("ui.onboarding.tour.create_schedule_dialog.title"),text:Sn(kn.create_schedule_dialog),buttons:[{text:it("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:it("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:_s("right")},title:it("ui.onboarding.tour.navigate_settings.title"),text:Sn(kn.navigate_settings),buttons:[{text:it("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:it("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:_s("right")},title:it("ui.onboarding.tour.general_settings.title"),text:Sn(kn.general_settings),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:_s("right")},title:it("ui.onboarding.tour.appearance_settings.title"),text:Sn(kn.appearance_settings),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:_s("right")},title:it("ui.onboarding.tour.radient_account_settings.title"),text:Sn(kn.radient_account_settings),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:_s("right")},title:it("ui.onboarding.tour.integrations_settings.title"),text:Sn(kn.integrations_settings),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:_s("right")},title:it("ui.onboarding.tour.application_updates_settings.title"),text:Sn(kn.application_updates_settings),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"tour-complete",title:it("ui.onboarding.tour.tour_complete.title"),text:Sn(kn.tour_complete),buttons:[{text:it("ui.onboarding.tour.action.finish"),classes:"shepherd-button-primary",action:function(){this.complete()}}]}],sQ=()=>({enabled:!0,label:h("ui.onboarding.tour.action.close")}),RA=new WeakMap,Pct=(e,t)=>{RA.set(e,t)},Nct=(e,t)=>{if(RA.get(e)===t)return;const n=new Map(nQ().filter(r=>r.id).map(r=>[r.id,r])),s=sQ();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},RA.set(e,t)},D5=new WeakMap,Mct=e=>{const t=D5.get(e);if(t)return t;const n=()=>tQ(e);return D5.set(e,n),n},Oct=()=>{const e=ei(),{completeTourOnboarding:t}=z0(),n=m.useContext(n1),s=Ve(),r={cancelIcon:sQ(),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=Mct(u);u.off("complete",f),u.on("complete",f),u.off("cancel",f),u.on("cancel",f),u.off("show",F5),u.on("show",F5);const p=nQ();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);Pct(u,Ym()),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()&&Nct(o,s)},[s,n]),{startTour:a}},Lct=()=>{const{isModalComplete:e,isTourComplete:t}=z0(),{startTour:n}=Oct(),s=st.useContext(n1),{data:r}=RT(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},Bct=({children:e})=>c.jsxs(Sct,{children:[e,c.jsx(Lct,{})]}),jct=()=>{Ve();const{open:e,focusGroup:t,providerId:n,closeConnect:s}=V8(),r=m.useRef(null);m.useEffect(()=>{e&&(r.current=document.activeElement instanceof HTMLElement?document.activeElement:null)},[e]);const i=ei();return c.jsx(Wc,{open:e,onOpenChange:a=>{a||s()},children:c.jsxs(zc,{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(AX,{context:"dialog",featuredOnly:!0,focusGroup:t,initialProviderId:n,onDone:s,onChangeModel:()=>{s(),i("/settings")}}):null]})})};function Hct(){const{visible:e,rows:t,cursor:n,commitAt:s,hoverAt:r}=Ile();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:[rQ(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(Vct,{row:o,active:l===n,onCommit:()=>s(l),onHover:()=>r(l)},o.sessionId))})}),document.body):null]})}function rQ(e){return e.title??h("ui.command_palette.palette_search.untitled_chat")}const Uct=1e3;function Gct(){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,Uct),window.addEventListener("contextmenu",n,!0),window.addEventListener("pointerup",t,!0)}function Vct({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(),Gct(),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:rQ(e)})]})}const iQ=({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})]}),pgt=({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})]}),ggt=({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 aQ({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:x,focusKey:_}){const w=m.useRef(!1);return m.useEffect(()=>{if(_!==s||w.current)return;const y=l.current;y&&(w.current=!0,y.scrollIntoView?.({block:"center"}),y.focus())},[_,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(Ts,{ref:l,id:e,"aria-label":a,"aria-describedby":`${e}-hint ${e}-notes ${e}-status`,"aria-invalid":x?!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"):x?c.jsx("span",{className:"text-danger",children:x}):null})]})]})}function oQ({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 nt(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 Gi){const x=v.detail;typeof x=="object"&&x!==null&&"code"in x&&x.code==="keymap.conflict"&&"label"in x&&typeof x.label=="string"&&(b=h("ui.settings.shortcuts.capture.already_assigned",{label:x.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 lQ(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 Wct(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 zct(e,t,n,s){for(const r of["AltRight","ControlRight","MetaRight"]){const i=Y8(r,t);if(i===null)continue;const a=jd(i);if(!(!a||a.code===e)&&!lQ(r,t,n,s))return a.label}return null}const $ct=/^(Alt|Meta|Control|Shift)(Left|Right)$/,gE=e=>e.split("-").slice(1).join("-");function qct({setting:e,refetch:t,focusKey:n}){const s=_2(),r=tt(F=>F.shortcutBindings),i=m.useRef(null),a=m.useId(),o=m.useMemo(()=>Toe(),[]),l=m.useRef(null),u=typeof e.default=="string"?e.default:IN,{saving:d,error:f,setError:p,write:g}=oQ({settingKey:e.key,refetch:t,fieldRef:i,onSaved:(F,A)=>Roe(F==="settings.edit"?A:u)}),v=h("ui.settings.shortcuts.speech.push_to_talk_hold"),b=typeof e.value=="string"?e.value:"",x=jd(b)??jd(u)??jd(IN),_=jd(b)?.code===jd(u)?.code,w=Ey.flatMap(F=>{const A=VA(F.id,r);return A?[A]:[]}),y=s.canonical?[s.canonical]:[],S=x===null?null:lQ(x.code,o,w,y),C=S===null||x===null?null:zct(x.code,o,w,y),E=h("ui.settings.shortcuts.speech.push_to_talk_letter_pointer"),k=()=>p(h("ui.settings.shortcuts.speech.push_to_talk_refused",{platform:o}));return c.jsx(aQ,{id:a,rank:"secondary",action:v,settingKey:e.key,focusKey:n,help:e.help,hint:`${h("ui.settings.shortcuts.speech.push_to_talk_hint")} ${E}`,ariaLabel:h("ui.settings.configuration.setting_control.label_press_the_key_you_want",{label:v}),value:x?.label??"",fieldRef:i,saving:d,showReset:!_,onReset:()=>void g("settings.reset"),onBlur:()=>{l.current=null,p(null)},onKeyDown:F=>{if(d)return;if(F.repeat||F.nativeEvent.isComposing){VE.has(F.key)||F.preventDefault();return}const A=l.current!==null;if(l.current&&(l.current.tainted=!0),VE.has(F.key)){A&&k();return}if(U_.has(F.key)){l.current=null,p(null),F.preventDefault();return}if(F.preventDefault(),A||!$ct.test(F.code)){A||(l.current=null),k();return}p(null),l.current={code:F.code,tainted:!1}},onKeyUp:F=>{const A=l.current;if(!A||F.code!==A.code||(l.current=null,A.tainted||d))return;const I=Y8(A.code,o);if(I===null){k();return}jd(I)?.code!==x?.code&&g("settings.edit",I)},notes:S!==null&&x!==null&&c.jsx("p",{children:h("ui.settings.shortcuts.speech.push_to_talk_overlap",{modifier:gE(x.label),example:Wct(S,gE(x.label),o),alternative:C?gE(C):"none"})}),error:f})}function Kct({setting:e,refetch:t,focusKey:n}){const s=m.useRef(!1),r=_2(),i=m.useRef(null),a=m.useId(),o=m.useMemo(()=>xg(),[]),{saving:l,error:u,setError:d,write:f}=oQ({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:Aoe,x=Vb(g)===Vb(b),_=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(aQ,{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:_H(v,o),fieldRef:i,saving:l,showReset:!x,onReset:()=>void f("settings.reset"),onKeyUp:S=>{!Fm.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&&Fm.has(S.key)){S.preventDefault();return}if(s.current=Fm.has(S.key),U_.has(S.key)||Fm.has(S.key)){U_.has(S.key)&&d(null),S.preventDefault();return}const C=w2(S);if(C===null)return;if(S.preventDefault(),Vb(C)===Vb(g)){d(null);return}const E=tt.getState().shortcutBindings,k=X8(r,_(w));for(const A of Ey){const I=E[A.id]??A.defaultChord;I&&k.set(I,A.label)}const F=wH(C,"panel.console",{},o,k);if(F!==null){d(F);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 Yct({focusKey:e}){const{client:t,provided:n}=Oee(),s=Ln({queryKey:Yo.settings,queryFn:()=>nt({op:"settings.list"}),enabled:n,staleTime:1e4},t),r=l=>s.data?.settings.find(u=>u.key===l),i=r(Foe),a=r(Doe);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(Kct,{setting:i,refetch:s.refetch,focusKey:e}),a&&c.jsx(qct,{setting:a,refetch:s.refetch,focusKey:e})]})}const cQ=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")}},Xct=()=>h("ui.chat.composer.start_recording");function Qct(){m.useEffect(()=>{let e=0;const t=()=>{const r=tt.getState().shortcutBindings,i=new Map(Lee);for(const a of Ey){const o=VA(a.id,r);if(!o)continue;const l=cQ(a);for(const u of Ioe(o,xg()))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=mJ(t);return()=>{n(),s()}},[])}const Jct=({action:e})=>{const t=_2(),n=X8(t,Xct());Ve();const s=m.useId(),r=m.useRef(null),i=tt(x=>x.shortcutBindings),a=i[e.id],o=tt(x=>x.setShortcutBinding),l=tt(x=>x.clearShortcutBinding),[u,d]=m.useState(!1),[f,p]=m.useState(null),g=m.useMemo(xg,[]),v=VA(e.id,i),b=cQ(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(Ts,{id:s,readOnly:!0,value:v===null?h("ui.settings.shortcuts.keyboard_shortcuts_section.no_shortcut"):_H(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:x=>{if(VE.has(x.key))return;if(U_.has(x.key)){d(!1),p(null);return}if(Fm.has(x.key)||x.nativeEvent.isComposing)return;const _=w2({key:x.key,code:x.code,metaKey:x.metaKey,ctrlKey:x.ctrlKey,altKey:x.altKey,shiftKey:x.shiftKey}),w=wH(_,e.id,i,g,n);if(w!==null){x.preventDefault(),d(!0),p(w);return}if(_===v){d(!0),p(null);return}x.preventDefault(),d(!0),p(null),_===e.defaultChord?o(e.id,null,n):_!==null&&o(e.id,_,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})]})},mgt=({sectionRef:e,focusKey:t})=>(Ve(),c.jsx(iQ,{title:h("ui.settings.shortcuts.keyboard_shortcuts_section.keyboard_shortcuts"),icon:EG,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(Yct,{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(Jct,{action:n},n.id))})]})}));async function Zct(e){await nt({op:"settings.edit",key:Tl,value:e.value}),Moe(e.queryClient)}async function uQ(e){await Zct(e),e.queryClient.setQueryData(G_.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:G_.all,queryFn:()=>nt({op:"settings.list"}),staleTime:0,retry:!1}),"confirmed"}catch{return"readback-unknown"}}const vgt=({focus:e=!1,focusNonce:t})=>{Ve();const n=Pt(),s=Yn(),r=vt(s.data,"settings"),i=Ln({queryKey:G_.all,queryFn:()=>nt({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),x=m.useRef(null),_=m.useRef(!1),w=m.useRef(t);m.useEffect(()=>{t!==w.current&&(w.current=t,_.current=!1)},[t]),m.useEffect(()=>{if(!e){_.current=!1;return}!a||_.current||(x.current?.querySelector("[role=combobox]")?.focus(),_.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(P=>P.value===I))){b.current=!0,l(!0),d(null),v(!1);try{const P=await uQ({value:I,queryClient:n});p(P==="readback-unknown"),v(P==="confirmed")}catch(P){d({value:I,message:P instanceof Error?P.message:""})}finally{b.current=!1,l(!1)}}},S=async()=>{const[I,P]=await Promise.all([i.refetch(),s.refetch()]);!I.isError&&!P.isError&&p(!1)},C=!i.data&&i.error||!s.data&&s.error,E=s.data&&(!r||i.data&&!a),k=!C&&!E&&!a,F=s.data?.features?.i18n?s.data.language:void 0,A=typeof F=="string"&&F!==""?F:void 0;return c.jsx(iQ,{title:h("ui.settings.language.dialog.title"),icon:TG,description:h("ui.settings.language.general.description"),children:c.jsxs("div",{ref:x,"data-setting-key":Tl,"data-search-row":"general.language","data-search-control":!0,className:"flex flex-col gap-3","aria-busy":o,children:[k&&c.jsx("output",{className:"text-meta text-ink-dim",children:h("ui.settings.language.dialog.loading")}),E&&c.jsx("p",{className:"text-meta text-ink-dim",children:h("ui.settings.language.dialog.unavailable")}),a&&c.jsx(Q8,{setting:{...b2(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:Poe(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"):A?h(f||s.error?"ui.settings.language.general.last_known":"ui.settings.language.general.effective",{locale:Noe(A)?.name??A}):h("ui.settings.language.general.no_resolution")}),(C||u||f)&&c.jsx(xr,{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")})]})})]})})},eut=()=>{Ve();const e=C_(O=>O.open),t=C_(O=>O.closeLanguage),n=Pt(),s=Yn(),r=vt(s.data,"settings"),i=Ln({queryKey:G_.all,queryFn:()=>nt({op:"settings.list"}),enabled:e&&r,staleTime:1e4}),a=m.useRef(null),o=A8(),l=(i.data?.settings??[]).find(O=>O.key===Tl),u=l?b2(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 O=>{if(!(!u||w.current||x||!u.choices.some(X=>X.value===O))){w.current=!0,f(!0),b(null),g(!1);try{const X=await uQ({value:O,queryClient:n});_(X==="readback-unknown"),g(X==="confirmed")}catch(X){const ee=X instanceof Error?X.message:"";b({value:O,message:ee}),C_.getState().open||fn(h("ui.settings.language.general.write_error",{message:ee}))}finally{w.current=!1,f(!1)}}},C=async()=>{const[O,X]=await Promise.all([i.refetch(),s.refetch()]);!O.isError&&!X.isError&&_(!1)},E=!!s.data,k=E&&!r,F=s.error&&!s.data?s.error:null,A=F??(i.data?null:i.error),I=!E&&!A,{sentence:P,remedy:N}=Bee(o??null,h("ui.settings.configuration.language_dialog.your_settings_could_not_be_loaded"),A),B=s.isFetching||i.isFetching,H=u?"combo":A?"retry":"none";return m.useEffect(()=>{!e||H==="none"||requestAnimationFrame(()=>{a.current?.querySelector(H==="combo"?'[role="combobox"]':"[data-language-retry]")?.focus()})},[e,H]),c.jsx(Wc,{open:e,onOpenChange:O=>!O&&t(),children:c.jsxs(zc,{ref:a,onOpenAutoFocus:O=>O.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(On,{}),h("ui.settings.language.dialog.loading")]}):k?c.jsx(xr,{variant:"warning",children:c.jsx("span",{children:h("ui.settings.language.dialog.unavailable")})}):A?c.jsx(xr,{variant:"warning",children:c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("span",{children:P}),N&&c.jsx(ue,{variant:"tonal",size:"sm",className:"shrink-0","data-language-retry":"",onClick:()=>{F?s.refetch():i.refetch()},disabled:B,children:B?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(On,{}),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:PN(Tl),className:"text-meta text-ink-dim",children:u.help}),c.jsx(Q8,{setting:u,value:y,disabled:d||x,helpId:PN(Tl),effectiveNoteId:Ooe(Tl,Loe),onValueChange:O=>{S(O)}})]}),v&&c.jsx(xr,{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")})]})}),x&&c.jsx(xr,{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(xr,{variant:"warning",children:c.jsx("span",{children:h("ui.settings.language.dialog.unavailable")})})]})})},I5=e=>{const t=Hoe(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})},dQ=e=>joe({type:e.type,version:e.offer.version}),tut=e=>{const t=e.map(s=>dQ(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})},nut=({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:I5(t),children:c.jsx("output",{"data-update-foot-icon":"","data-update-foot-icon-state":"inflight","aria-label":I5(t),className:"flex size-8 shrink-0 items-center justify-center text-accent",children:c.jsx(Li,{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:[dQ(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":tut(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(c2,{className:"size-4 shrink-0","aria-hidden":"true"})})})},hQ=()=>{const e=Ir(g=>g.followed),t=Ir(g=>g.running),n=Ir(g=>g.offers),s=Ir(g=>g.detailOpen),r=Ir(g=>g.inflight),i=Ir(g=>g.downloadPercent),a=Ir(g=>g.openNotice),o=Ir(g=>g.noticeOpen),l=Ir(g=>g.dismissNotice),u=m.useMemo(()=>{const g={followed:e,running:t,offers:n,detailOpen:s};return FH.filter(v=>Boe(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[Pn.BACKEND]?{type:Pn.BACKEND,percent:null}:r[Pn.UI]?{type:Pn.UI,percent:i[Pn.UI]}:null,[r,i]),f=m.useCallback(()=>a(),[a]),p=m.useCallback(()=>l(),[l]);return c.jsx(nut,{surfaces:u,inflight:d,onShow:f,onDismiss:o?p:void 0})},fQ="px-2",AA=new WeakMap,sut=64,rut=1024*1024,iut=3e3;function aut(e){const t=AA.get(e);if(t)return t;const n=new Map;AA.set(e,n);let s=gp(e);return m2(e,()=>{const r=gp(e);if(r===s)return;s=r;const i=[...n.values()];n.clear();for(const a of i){a.url&&H_(a.url),a.url=void 0;for(const o of a.listeners)o()}}),n}function out(e){if(e.size<sut)return!0;for(const[t,n]of e)if(!(n.listeners.size||n.promise))return n.url&&H_(n.url),e.delete(t),!0;return!1}const lut=uX;function bgt(e,t){const n=pQ(t),s=cut(),r=e?hX(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 gQ(u,n)}function pQ(e){return Uoe(e,Goe())}function cut(){return O8("team_bridge_endpoint_avatar")}const uut=/^(?: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})$/,dut=/^[0-9a-f]{16}$/;function hut(e){const t=e?.id,n=e?.profile?.avatar;if(!t||!uut.test(t)||!n||!n.hash||!dut.test(n.hash)||n.source==="none")return null;if(e.avatar_url){const s=lut.exec(e.avatar_url);if(!s||s[1]!==t||s[2]!==n.hash)return null}return{accountId:t,hash:n.hash}}function fut(e,t){const n=yg(),s=e?.id,r=e?.profile?.avatar?.hash,i=e?.profile?.avatar?.source,a=e?.avatar_url,o=m.useMemo(()=>hut({id:s,avatar_url:a,profile:{avatar:{hash:r,source:i}}}),[s,r,i,a]);return put(o&&o.accountId===n.accountId?o:null,t,{retryOnce:!0})}function put(e,t,n={}){const s=pQ(t),r=m.useMemo(()=>e?{type:"account",...e}:null,[e]);return gQ(r,s,n)}function gQ(e,t,n={}){const s=n.retryOnce===!0,r=Pt(),i=yg(),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=aut(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"?Jn.endpointAvatarBytes({expectedAccountId:g,endpointId:e.endpointId,hash:e.hash,size:t}):Jn.avatarBytes({expectedAccountId:g,accountId:e.accountId,hash:e.hash,size:t})).then(({data:w,mimeType:y})=>{if(u.get(a)!==f)return;const S=Zr(r);if(S.epoch!==p||S.accountId!==g){u.delete(a);return}if(!["image/png","image/jpeg"].includes(y)||w.byteLength===0||w.byteLength>rut)throw new Error("Invalid avatar bytes");f.url=_8(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(!out(u))return;u.set(a,f),v()}let b=!1;const x=()=>{!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=Zr(r);w.epoch!==p||w.accountId!==g||v()},iut))};u.delete(a),u.set(a,f);const _=()=>{x(),l.current&&o(w=>w+1)};return f.listeners.add(_),x(),()=>{f.listeners.delete(_),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 AA.get(r)?.get(a)?.url}const DI=st.memo(({expanded:e,useAuth:t=!1})=>{const n=Ny(),s=ei(),{user:r,isAuthenticated:i,accountRead:a,signOut:o}=Qy(),l=a==="checking"?h("ui.shell.user_profile_sidebar.checking_account"):NN(a)?h("ui.shell.user_profile_sidebar.account_unavailable"):null,u=r?.name??l??h("ui.shell.user_profile_sidebar.user"),d=NN(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]),x=m.useMemo(()=>{const S=r?.name;return S?S.split(" ").map(C=>C.charAt(0)).join("").toUpperCase().substring(0,2):null},[r?.name]),_=fut(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(TH,{className:"size-7 shrink-0 rounded-full bg-media-surface",children:[_&&c.jsx(Dy,{src:_,alt:"",className:"lo-avatar-arrival"}),c.jsx(Iy,{className:"rounded-full bg-media-surface text-ink-muted",children:x??c.jsx(PG,{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(vo,{asChild:!0,children:w}):c.jsx(Iu,{content:v,side:n==="rtl"?"left":"right",children:c.jsx(vo,{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(SH,{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(Zhe,{size:16,"aria-hidden":"true"}),h("ui.shell.user_profile_sidebar.privacy_and_security")]}),c.jsx(Hr,{}),c.jsxs(on,{onSelect:b,className:"text-danger focus:bg-danger-wash focus:text-danger",children:[c.jsx(Ehe,{size:16,"aria-hidden":"true"}),h("ui.shell.user_profile_sidebar.sign_out")]})]})]}):y});DI.displayName="UserProfileSidebar";const mQ=()=>{const e=ei(),t=s9();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"})})})},vQ=()=>c.jsxs("div",{className:R("flex min-h-10 shrink-0 items-center justify-between gap-1 pb-2",fQ),children:[c.jsx(DI,{expanded:!0}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(hQ,{}),c.jsx(mQ,{})]})]});function bQ(e){return Ie(t=>jee(t.sessions,e))}const gut=[];function xQ(){const{state:e}=cC(),t=e?.pendingConsent??gut,n=w9(s=>GO(t,s));return m.useEffect(()=>{t.length>0&&X2()},[t]),GO(t,n)}const _Q={approvals:["desktop","mesh","approvals"]},mut=15e3,vut=new Set(["requested","approved","connecting","failed"]);function but(e){return vut.has(e)}function xut(e){return e==="requested"}function wQ(e){return e.filter(t=>xut(t.state)).length}function _ut(e){return KP.test(e.requestDigest)&&KP.test(e.disclosureDigest)}function II(e){return e.kind==="credential"&&e.typed!==void 0&&e.typed.action==="approve-credential"&&e.typed.operation!==null&&_ut(e.typed)}function mE(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===WA:e.kind==="credential"?t&&II(e)&&e.typed.signableHere&&e.typed.disclosure?.operation===e.typed.operation:e.canApproveHere!==!1&&(e.kind==="device"||e.kind==="machine")}function wut(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 yut(e,{credentialApprovals:t=!1}={},n){return t&&II(e)&&(e.state==="approved"||e.state==="failed")&&(n??e.typed.applyOutcome?.retryable===!0)}function xgt(e,t,n={},s){const r=e.approvalId;return t==="deny"?{op:"approvals.deny",approvalId:r}:e.kind==="profile"?!(t==="approve"?mE(e,n):wut(e,n,s))||!e.profile?null:{op:t==="approve"?"approvals.approveOperation":"approvals.applyOperation",approvalId:r,operation:WA,requestDigest:e.profile.request_digest,disclosureDigest:e.profile.disclosure_digest??""}:e.kind==="device"||e.kind==="machine"?t==="approve"&&mE(e,n)?{op:"approvals.approve",approvalId:r}:null:!(t==="approve"?mE(e,n):yut(e,n,s))||!II(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 _gt(e){return but(e)}function wgt(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 Br(e){return typeof e=="object"&&e!==null}function Cut(e){const t=Br(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 P5(e){return typeof e=="string"?e:""}function yQ(e){return Gee.includes(e)?e:null}function Sut(e){if(!Br(e))return null;const t=yQ(e.operation);if(t===null)return null;const n=Br(e.recipient)?e.recipient:{},s=Br(e.grant_lifetime)?e.grant_lifetime:{},r=Br(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 CQ(e){return Br(e)?{code:rn(e.code),retryable:e.retryable===!0,reason:rn(e.reason),remedy:rn(e.remedy)}:null}function kut(e){if(Br(e))return{action:rn(e.action),operation:yQ(e.operation),requestDigest:P5(e.request_digest),disclosureDigest:P5(e.disclosure_digest),disclosure:Sut(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:CQ(e.apply_outcome),...Br(e.upgrade)?{upgrade:{...e.upgrade}}:{}}}function Eut(e){const t=Br(e)?e:{};return{connect:T1(t.connect,!1),install:T1(t.install,!1),anchor:Br(t.anchor),networkId:rn(t.network_id),role:rn(t.role),unattended:T1(t.unattended,!1),grants:yE(t.grant)}}function Tut(e){const t=Array.isArray(e)?e:e?.approvals??[];if(!Array.isArray(t))return[];const n=[];for(const s of t){if(!Br(s))continue;const r=rn(s.approval_id),i=rn(s.state);if(!r||!i)continue;const a=kut(s.typed_approval),o=Hee(s.typed_approval),l=Br(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===WA?"profile":l||u==="credential_inheritance"?"credential":u!==void 0&&!["device_onboard","local_authority"].includes(u)?"unknown":!Br(s.device)&&Br(s.machine)?"machine":"device",f=Br(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:Cut(d==="machine"?s.machine:s.device),what:Eut(s.what),requestedBy:{surface:rn(f.surface),sessionId:rn(f.session_id),deviceId:rn(f.device_id)},expiresAt:Uee(s.expires_at),...a&&d==="credential"?{typed:a}:{},...o&&d==="profile"?{profile:o}:{}})}return n}function Rut(e){return e.kind==="machine"?h("ui.mesh.mesh_approvals.this_machine"):F_({device_id:e.where.deviceId,name:e.where.name})}function ygt(e,t){if(e.kind==="credential"||e.kind==="unknown"||e.canApproveHere===!1){const r=PI(e);if(r)return r;if(e.summary)return e.summary;if(e.kind==="credential"||e.kind==="unknown")return N5(e)}const n=N5(e),s=Iut(e,t).map(r=>r.clause);return s.length?h("ui.mesh.mesh_approvals.approval_title_with_clauses",{head:n,clauses:Dut(s)}):h("ui.mesh.mesh_approvals.approval_title",{head:n})}function N5(e){return e.kind==="credential"?PI(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:Rut(e)})}function Cgt(e){return e.summary?e.kind==="credential"?PI(e)===null:e.kind==="unknown"||e.canApproveHere===!1:!1}const Aut={github:"GitHub",gitlab:"GitLab"};function M5(e){return Aut[e.toLowerCase()]??e}function SQ(e){const t=e.typed?.disclosure?.recipient;return F_({device_id:t?.deviceId??"",name:t?.name??""})}function PI(e){const t=e.kind==="credential"?e.typed?.disclosure:null;if(!t)return null;const n=SQ(e);return t.operation==="credential_finite_share"?h("ui.mesh.approval.head_finite_share",{credential:M5(t.credentialKey),device:n}):h("ui.mesh.approval.head_inheritance",{provider:M5(t.provider),account:t.account,device:n})}function Fut(e){const t=e.kind==="credential"?e.typed?.disclosure:null;if(!t)return[];const n=SQ(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 Dut(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 Sgt(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 kgt(e){return e.kind==="credential"||e.kind==="unknown"?null:e.where.hostKeyFp||null}function Egt(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 Iut(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 Put(l,o)){const f=Nut()[d];u.push({term:f?.term??h("ui.mesh.mesh_approvals.grant_capability",{grant:d}),clause:Mut()[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 Put(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 Nut=()=>({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")}}),Mut=()=>({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 Tgt(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 Rgt(e,t){return e.kind==="credential"&&(e.state==="approved"||e.state==="failed")&&(t??e.typed?.applyOutcome?.retryable)===!1}function Agt(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 Fgt(e){const t=e.typed?.disclosure;if(!t)return"";const n=Fut(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 kQ(e,{poll:t=!0}={}){return Ln({queryKey:_Q.approvals,enabled:e,queryFn:async()=>Tut(await nt({op:"approvals.list"})),retry:!1,staleTime:t?1e4:Number.POSITIVE_INFINITY,refetchInterval:e&&t?mut:!1,refetchOnWindowFocus:t})}function Out(){return{retry:!1,mutationFn:async e=>{const t=await nt(e.request);if(e.request.op==="approvals.approveCredential"){const n=Lut(t);if(n)throw n}}}}function Dgt(){const e=Pt();return pn({...Out(),onSettled:()=>{e.invalidateQueries({queryKey:_Q.approvals}),e.invalidateQueries({queryKey:Lc.networks}),e.invalidateQueries({queryKey:Lc.peers})}})}function Igt(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 Pgt(e){const t=e,n=CQ(t?.applyOutcome??(Br(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 Lut(e){const t=Br(e)?e.applied:void 0;return!Br(t)||t.ok!==!1?null:{code:rn(t.code),message:rn(t.message),applyOutcome:t}}const But=/(\{request\}|\{reason\})/;function Ngt(e,t){return h("ui.mesh.approval.named_refusal",{request:"{request}",reason:"{reason}"}).split(But).filter(Boolean).map(n=>n==="{request}"?{kind:"request",text:e}:n==="{reason}"?{kind:"reason",text:t}:{kind:"literal",text:n})}function Mgt(e,t,n=!1){return e==="request"&&!n?t:"auto"}function Ogt({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=Yn(),t=vt(e.data,"aida",1),n=Kh(t),s=t&&n.data?.enabled===!0,r=bQ(n.data?.session_id),i=vt(e.data,"notifications",1),a=J8(i),o=xQ(),l=fC(wr(e.data,"peers")==="enabled"),u=kQ(l==="member"&&wr(e.data,"approvals")==="enabled",{poll:!0}),d=s?r:0,f=i?Z8(a.data):0,p=l==="member"?wQ(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 Hut(e){const t=typeof e=="object"&&e!==null?e.idx:void 0;return typeof t=="number"&&t>0?"history":"/chat"}const Uut=()=>{Ve();const e=ei(),t=Ny()==="rtl"?By:_G,[n,s]=m.useState(!1),{total:r,lines:i}=jut(),a=W_("back",Ple.test(navigator.platform)),o=r>0?h("ui.teamBridge.leave.name_attention",{count:r}):h("ui.teamBridge.leave.name"),l=m.useCallback(()=>{Hut(window.history.state)==="history"?e(-1):e("/chat")},[e]);return m.useEffect(()=>{const u=f=>{iU(f)==="back"&&(f.preventDefault(),l())},d=f=>{aU(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",fQ),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:Oi(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(sp,{count:r,"aria-hidden":"true",className:"ms-1"})]})})})},Gut=({children:e,inline:t})=>c.jsxs(Voe,{fallback:t,children:[c.jsx(Uut,{}),e,c.jsx(vQ,{})]}),Vut=()=>(Ve(),c.jsxs(Gut,{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"})]})),Wut=140,zut=/^\s*(```|~~~).*$/gm,$ut=/^\s{0,3}#{1,6}\s+/gm,qut=/^\s{0,3}(>\s?)+/gm,Kut=/^\s*([-*+]|\d{1,9}[.)])\s+/gm,Yut=/^\[[ xX]\]\s+/gm,Xut=/^\s{0,3}([-*_])(\s*\1){2,}\s*$/gm,Qut=/!\[([^\]]*)\]\([^)]*\)/g,Jut=/\[([^\]]+)\]\([^)]*\)/g,Zut=/<((?:https?|mailto):[^>\s]+)>/gi,edt=/<\/?[A-Za-z][^>]*>/g,tdt=/`+([^`]*)`+/g,ndt=/(\*\*|__)(?=\S)([\s\S]*?\S)\1/g,sdt=/~~(?=\S)([\s\S]*?\S)~~/g,rdt=/(^|[^\w*])\*(?=\S)([^*]*?\S)\*(?!\w)/g,idt=/(^|[^\w])_(?=\S)([^_]*?\S)_(?!\w)/g;function adt(e,t=Wut){if(typeof e!="string"||e.trim().length===0)return null;const n=e.replace(zut," ").replace(Xut," ").replace($ut,"").replace(qut,"").replace(Kut,"").replace(Yut,"").replace(Qut,"$1").replace(Jut,"$1").replace(Zut,"$1").replace(edt,"").replace(tdt,"$1").replace(ndt,"$2").replace(sdt,"$1").replace(rdt,"$1$2").replace(idt,"$1$2"),s=jp(n,Number.MAX_SAFE_INTEGER);return s.length===0?null:TX(s,t)}function odt(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:jp(n,Gv)||t.untitled,subtitle:jp(r,wit)||t.untitled,body:jp(a,_it)||t.fallback}}const Em=3e4,ldt=10;function cdt(e,t=ldt){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 udt(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 EQ(e,t){return udt(e,t)&&M8(e)==="all"&&e.builtin!=="agents"}function ddt(e,t,n){return{conversationName:g2(e,t),organizationName:H8(e,n),senderLabel:p2(e.last_sender_label??"")}}function hdt(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),EQ(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,...ddt(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 NI(e,t,n,s){return e.getMutationCache().findAll({mutationKey:Gt.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 fdt(e,t,n,s,r){return new Promise(i=>{const a=()=>{l(),r.removeEventListener("abort",a),i()},o=()=>{(r.aborted||!NI(e,t,n,s))&&a()},l=e.getMutationCache().subscribe(o);r.addEventListener("abort",a,{once:!0}),o()})}function Lgt(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 TQ(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 Bgt(e,t,n,s){return TQ(await Jn.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 T_=null;function pdt(){return T_}function Hgt(e){m.useEffect(()=>{const t=e??null;return T_=t,()=>{T_===t&&(T_=null)}},[e])}const gdt="display.notifications";function mdt(){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 vdt(e){return e.kind==="dm"?{kind:"dm"}:{kind:e.kind,name:e.name}}function bdt(e,t){return irt(e,t==="person_agent"?"agent":"human")}function FA(e,t){const n=hX(bdt(e,t)).src,s=n?.type==="account"?n:null,r=n?.type==="endpoint"?n:null;return Tit({v:1,kind:t,account_id:e.account_id,display_name:jp(e.display_label,Gv),agent_name:jp(e.agent?.name??"",Gv),...s?{avatar:{account_id:s.accountId,hash:s.hash}}:{},...r?{endpoint_avatar:{endpoint_id:r.endpointId,hash:r.hash}}:{}})}function xdt(e,t,n){return e.getQueryData(Gt.directory(t,n))?.members??[]}function _dt(e,t,n,s){const r=Gt.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 wdt(e,t,n,s){return{...uI(e,t,n,s),staleTime:0}}async function ydt(e,t,n,s,r){if(!s())return;let i=t.senderLabel,a,o=null,l;const u=Zr(e);if(u.accountId!==n)return;const d={accountId:n,epoch:u.epoch},f=t.threadId;try{let b;if(f)b=TQ(await Jn.listReplies(t.conversationId,f,{tenantId:t.tenantId,accountId:n,afterSeq:t.seq,limit:1}),{tenantId:t.tenantId,conversationId:t.conversationId,rootId:f}).replies.find(x=>x.seq===t.seq),b&&s()&&_dt(e,t,f,b);else{const x=()=>e.fetchQuery(wdt(e,t.conversationId,t.tenantId,n));b=(await x().catch(w=>{if(!Vee(w))throw w;return x()})).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 x=xdt(e,t.tenantId,n);i=zoe(b.sender,x,{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);_&&(b.sender.kind==="human"||b.sender.kind==="agent")&&(a=FA(_,b.sender.kind==="human"?"person":"person_agent")),o=adt(b.body)}}catch{}const p=window.api?.desktop?.teamBridge;if(!p)return;const g=odt({senderLabel:i,conversationName:t.conversationName,place:vdt(t),organizationName:t.organizationName,preview:o,unreadCount:t.unreadCount},mdt());for(;NI(e,d,t.conversationId,t.tenantId);)if(await fdt(e,d,t.conversationId,t.tenantId,r),r.aborted||!s())return;if(r.aborted||!s())return;const v=e.getQueryData(Gt.conversations(Oc,n))?.conversations.find(b=>b.id===t.conversationId&&b.tenant_id===t.tenantId);!v||!EQ(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:pdt()===t.conversationId}).catch(()=>{})}function Cdt(e,t,n,s,r){Jst(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=uI(e,i.conversation_id,n,t);e.getQueryState(l.queryKey)?.data!==void 0&&e.fetchQuery({...l,staleTime:0}).catch(()=>{})}}function Sdt(e){const t=!!window.api?.desktop?.teamBridge,n=KC(),s=dI(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=Pt(),l=jle({filters:{mutationKey:Gt.notifyMutation(r,n.epoch),exact:!0,status:"pending"},select:L=>L.mutationId});m.useLayoutEffect(()=>{const L=window.api?.desktop?.teamBridge;if(!L?.setAuthority)return;const W=()=>{L.setAuthority({...Zr(o),settling:v2(o)}).catch(()=>{})},j=m2(o,W);return W(),j},[o]);const u=eI({enabled:a}),d=Yn(),f=vt(d.data,"settings"),p=Ln({...BH(),enabled:a&&f}),g=f&&Woe(p.data?.settings,gdt)===!1,v=m.useRef(g);v.current=g;const b=m.useRef(r);b.current=r;const x=m.useRef(a);x.current=a;const _=m.useRef(new AbortController);m.useEffect(()=>{const L=new AbortController;return _.current=L,(!a||g||n.token!==gp(o))&&L.abort(),()=>L.abort()},[a,g,n.token,o]),m.useEffect(()=>(x.current=a,()=>{x.current=!1}),[a]);const w=u.data,y=CX(a,Oc,{accountId:r,refetchInterval:Em,refetchIntervalInBackground:!0}),S=m.useMemo(()=>cdt(y.data),[y.data]),C=oU({queries:S.map(L=>{const W=UE(L.tenant_id);return{queryKey:Gt.unread(W,r??"unresolved-owner"),queryFn:()=>Ul(o,r,()=>Jn.unread({tenantId:W})),enabled:a,staleTime:Em,refetchInterval:Em,refetchIntervalInBackground:!0,refetchOnWindowFocus:!0,retry:1}})}),E=C.map(L=>`${L.status}:${L.dataUpdatedAt}`).join("|"),k=m.useRef(C);k.current=C;const F=m.useRef(S);F.current=S;const I=yX(S.map(L=>UE(L.tenant_id)),a,r).members,P={};for(const[L,W]of Object.entries(I))P[L]=W.filter(j=>j.account_id!==r).flatMap(j=>[FA(j,"person"),...j.agent?.name?[FA(j,"person_agent")]:[]]).filter(j=>j!==void 0);const N=JSON.stringify(P),B=m.useRef(P);B.current=P;const H=m.useRef(null),O=m.useRef(new Set),X=Ln({queryKey:Gt.conversations(Oc,r??"unresolved-owner"),queryFn:()=>Ul(o,r,()=>Jn.listConversations("account")),enabled:a,staleTime:Em,refetchInterval:Em,refetchIntervalInBackground:!0,refetchOnWindowFocus:!0,retry:1}),ee=m.useRef(new Map),se=m.useRef(new Map),q=m.useRef(new Set),ne=m.useRef(void 0),te=m.useRef(null),M=[a,g,l.join(","),E,y.dataUpdatedAt,X.dataUpdatedAt,(w?.memberships??[]).map(L=>`${L.tenant_id}:${L.tenant_name}`).join(","),r??""].join("#");m.useEffect(()=>{if(H.current===N)return;H.current=N;const L=window.api?.desktop?.teamBridge;if(!L?.syncDirectory)return;const W=B.current;for(const j of O.current)j in W||L.syncDirectory({tenantId:j,members:[]}).catch(()=>{});O.current=new Set(Object.keys(W));for(const[j,z]of Object.entries(W))L.syncDirectory({tenantId:j,members:z}).catch(()=>{})},[N]),m.useEffect(()=>{const L=ne.current;ne.current=r,L!==r&&L!==void 0&&(ee.current=new Map,se.current=new Map,q.current=new Set,te.current=null,o.invalidateQueries({queryKey:Gt.unreadPrefix}),o.invalidateQueries({queryKey:Gt.conversationsPrefix}))},[r,o]),m.useEffect(()=>{if(te.current===M||(te.current=M,!y.data))return;for(const oe of y.data.organizations??[])oe.unread===0&&!q.current.has(oe.tenant_id)&&q.current.add(oe.tenant_id);if(!X.data)return;const L=k.current,W=F.current,j=U8(w?.memberships??[],y.data.organizations,y.data.organizations??null);let z=ee.current;for(let oe=0;oe<W.length;oe+=1){const J=W[oe],Re=L[oe]?.data;if(!Re)continue;const ie=(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&&Cdt(o,r,J.tenant_id,Re.conversations??[],se.current);const ge=q.current.has(J.tenant_id),U=Zr(o),we=ie.filter(Se=>!ge||!x.current||v.current||!U.accountId||U.accountId!==r?!0:!NI(o,{accountId:U.accountId,epoch:U.epoch},Se.conversation_id,Se.tenant_id)),ke=hdt({conversations:X.data.conversations,rows:we,organizations:j,selfAccountId:r,cursors:z,seeded:ge,quiet:!a||g});if(z=ke.cursors,ke.seeded&&q.current.add(J.tenant_id),!a||g||!r)continue;const De=r,pe=gp(o),be=rX(o,De);for(const Se of ke.candidates)ydt(o,Se,De,()=>b.current===De&&gp(o)===pe&&be()&&x.current&&!v.current&&Gc(o,De),_.current.signal)}ee.current=z},[M,a,g,y.data,X.data,w,r,o])}function kdt(){const{data:e}=Yn();m.useEffect(()=>{e&&vJ(e)},[e]);const t=u2(),n=Pt(),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}),!$oe()&&Aa(h("ui.settings.language.external_notice",{language:r.language}),{id:"i18n-language-external"}))},[t.configChange,n])}function Edt(e,t){if(e.defaultPrevented||e.repeat||e.isComposing||!(e.metaKey||e.ctrlKey))return null;const n=w2(e);if(n===null)return null;const s=Wee(t.bindings).get(n);return s===void 0||UA(e.target)||!dbe(RQ(s),t.route)?null:s}const RQ=e=>e.slice(6);function Tdt(e){const t=Ie.getState(),n=t.activeDraftKey?t.drafts[t.activeDraftKey]:void 0,s=Qv(t.activeDraftKey,n?.sessionId,t.activeSessionId)??null;Yd(RQ(e),{sessionId:s,askScope:s===null?"fleet":"session",via:"chord"})}function Rdt(){m.useEffect(()=>{const e=t=>{const n=tt.getState(),s=Edt(t,{bindings:n.shortcutBindings,route:n.rightSlotRoute});s!==null&&(t.preventDefault(),Tdt(s))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[])}function Adt(e,t){const n=yg(),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 Fdt=""+new URL("radient-icon-1024x1024-D_JJedvo.png",import.meta.url).href,AQ=mg()(nH(e=>({hasBeenNotified:!1,setHasBeenNotified:t=>{e({hasBeenNotified:t})}}),{name:"low-credits-storage"})),Ddt=({open:e,onClose:t,onGoToConsole:n})=>{Ve();const{setHasBeenNotified:s}=AQ(),{prices:r,isLoading:i,error:a}=qoe(),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:Fdt,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(Pu,{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(On,{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")})]})})},Idt=(e,t)=>t?e.some(n=>n.session_id===t&&n.status?.code==="busy"):!1;function Pdt(e){return Ie(t=>Idt(t.sessions,e))}const DA={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=>DA[e]==="visible"),more:wy.filter(e=>DA[e]==="more")},O5=new Map(wy.map((e,t)=>[e,t])),Ndt=new Map([["notifications","notifications"]]);function Mdt(e,t){const n=s=>{const r=Ndt.get(s);return r===void 0||t(r)};return{visible:e.visible.filter(n),more:e.more.filter(n)}}const Odt=new Set(zee);function Ldt(e){return typeof e=="string"&&Odt.has(e)}function vE(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 No(e,t){return e.visible.includes(t)?"visible":"more"}function R_(e,t,n){return e[t].filter(s=>n.has(s))}function Bdt(e,t,n,s){if(!s.has(t))return null;const r=No(e,t),i=R_(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 L5(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 B5(e,t){for(const n of wy){if(DA[n]!==t||e.visible.includes(n)||e.more.includes(n))continue;const s=O5.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=O5.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 IA(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)Ldt(a)&&(n.has(a)||(n.add(a),t[r].push(a)))}}return B5(t,"visible"),B5(t,"more"),t}function Hdt(e){return e.reduce((t,n)=>{const s=n.attention??0;return Number.isFinite(s)&&s>0?t+s:t},0)}const Gf={layout:["desktop","sidebar_layout"]};async function Udt(){const e=await nt({op:"sidebar_layout.get"});return IA(e.layout)}function Gdt(e,t=()=>!1){const n=Pt(),s=Ln({queryKey:Gf.layout,enabled:e,queryFn:Udt,staleTime:Number.POSITIVE_INFINITY,retry:Kv}),r=m.useRef(0),i=pn({scope:{id:"sidebar-layout"},mutationFn:async d=>{const f=await nt({op:"sidebar_layout.set",layout:Mdt(d,t)});return IA(f.layout)},retry:$ee,onMutate:async d=>{const f=++r.current;await n.cancelQueries({queryKey:Gf.layout});const p=n.getQueryData(Gf.layout);return n.setQueryData(Gf.layout,d),{previous:p,seq:f}},onError:(d,f,p)=>{p?.seq===r.current&&p.previous&&n.setQueryData(Gf.layout,p.previous),fn(h("ui.shell.sidebar_navigation.save_failed"))},onSettled:(d,f,p,g)=>{g?.seq===r.current&&n.invalidateQueries({queryKey:Gf.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(IA(yy))}}}const j5=({expanded:e})=>(Ve(),c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(HH,{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")})]})),FQ=()=>{const e=u2(),t=Yn(),n=Ie(u=>u.setCataloguePageable),s=Ie(u=>u.setCatalogueActivityHead),r=Ie(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=wr(t.data,"session_catalogue",2)==="enabled",l=m.useCallback(()=>r(i?pH:Sy,i),[r,i]);return m.useEffect(()=>{o&&l()},[o,l,e.catalogueRevision]),null},H5="flex h-[30px] w-full items-center gap-2 rounded-md px-2 text-body-sm transition-colors duration-fast ease-out-quart",Vdt=()=>{Ve();const e=Ny()==="rtl",t=ei(),n=s9(),{expanded:s,onCollapse:r}=Koe(),i=tt(ce=>ce.openCommandPalette),a=Yn(),o=mit(vt(a.data,"team_bridge_conversations")),l=Ie(ce=>ce.activeSessionId),u=xQ(),d=wr(a.data,"peers")==="enabled",f=fC(d),p=wr(a.data,"approvals")==="enabled",g=kQ(f==="member"&&p,{poll:!0}),v=wQ(g.data??[]),b=vt(a.data,"projects",1),x=vt(a.data,"library",1),_=vt(a.data,"notifications",1),w=J8(_),y=_?Z8(w.data):0,S=tt(ce=>ce.sidebarOverflowExpanded),C=tt(ce=>ce.setSidebarOverflowExpanded),E=vt(a.data,"aida",1),k=Kh(E),F=E&&k.data?.enabled===!0,A=k.data?.name??"Aida",I=fme(),P=bQ(k.data?.session_id),N=Pdt(k.data?.session_id),B=()=>{I(t,k.data).catch(ce=>fn(qf(ce)))},H=new Map;F&&H.set("aida",{icon:Yoe,label:A,path:"/chat",isActive:n==="chat"&&!!k.data?.session_id&&l===k.data?.session_id,tourTag:"nav-item-aida",onSelect:B,attention:P,attentionTag:"nav-aida-badge",attentionName:ce=>h("ui.shell.sidebar_navigation.aida_missed",{name:A,count:ce}),working:N,workingName:h("ui.shell.sidebar_navigation.aida_working",{name:A})}),_&&H.set("notifications",{icon:yG,label:h("ui.notifications.nav.label"),path:"/notifications",isActive:n==="notifications",tourTag:"nav-item-notifications",attention:y,attentionTag:"nav-notifications-badge",attentionName:ce=>h("ui.notifications.nav.unread",{count:ce,countText:String(ce)})}),x&&H.set("library",{icon:phe,label:h("ui.library.page.title"),path:"/library",isActive:n==="library",tourTag:"nav-item-library"}),b&&H.set("projects",{icon:kG,label:h("ui.shell.sidebar_navigation.projects"),path:"/projects",isActive:n==="projects",tourTag:"nav-item-projects"}),H.set("agents",{icon:Ll,label:h("ui.shell.sidebar_navigation.agents"),path:"/agents",isActive:n==="agents",tourTag:"nav-item-agents"}),H.set("schedules",{icon:CG,label:h("ui.shell.sidebar_navigation.schedules"),path:"/schedules",isActive:n==="schedules",tourTag:"nav-item-schedules"}),H.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:ce=>h("ui.shell.sidebar_navigation.browser_waiting",{count:ce,countText:String(ce)})}),o&&H.set("team-bridge",{...o,isActive:n==="team-bridge"}),H.set("agent-hub",{icon:IG,label:h("ui.shell.sidebar_navigation.agent_hub"),path:"/agent-hub",isActive:n==="agent-hub",tourTag:"nav-item-agent-hub"}),f==="member"&&H.set("mesh",{icon:G8,label:h("ui.shell.sidebar_navigation.mesh"),path:"/mesh",isActive:n==="mesh",tourTag:"nav-item-mesh",attention:v,attentionTag:"nav-mesh-badge",attentionName:ce=>h("ui.shell.sidebar_navigation.mesh_waiting",{count:ce,countText:String(ce)})});const O=new Set(H.keys()),X=vt(a.data,"sidebar_layout",1),{layout:ee,canCustomise:se,save:q,reset:ne}=Gdt(X,ce=>vt(a.data,ce,1)),te=se?ee:yy,M=R_(te,"visible",O),L=R_(te,"more",O),[W,j]=m.useState(!1),z=S||W||L.some(ce=>H.get(ce)?.isActive),[oe,J]=m.useState(""),[Re,ie]=m.useState(null),ge=m.useRef(new Map),U=ce=>{requestAnimationFrame(()=>ge.current.get(ce)?.focus())},[we,ke]=m.useState(null),[De,pe]=m.useState(null),be=m.useRef(null),Se=m.useRef(null),Ce=m.useRef(null),me=m.useRef(0),ze=m.useRef(0),ae=m.useRef(null),$e=m.useRef(null),Ke=m.useRef(!1),de=ce=>{const he=be.current;return he===null?[]:Array.from(he.querySelectorAll("[data-sidebar-row]")).filter(Pe=>Pe.dataset.sidebarRow!==ce).map(Pe=>{const je=Pe.getBoundingClientRect();return{id:Pe.dataset.sidebarRow??"",top:je.top,bottom:je.bottom}})},Me=(ce,he)=>{const Pe=be.current;if(Pe===null)return null;const je=Pe.getBoundingClientRect(),Ze=de(he),le=ye=>Ze.filter(Fe=>No(te,Fe.id)===ye);let _e=null;if(ce.kind==="more"){const ye=le("more").at(-1);if(ye)_e=ye.bottom;else{const Fe=Pe.querySelector("[data-sidebar-more]");_e=Fe?Fe.getBoundingClientRect().bottom:je.top+2}}else if(ce.kind==="band"){const ye=No(te,he),rt=le(ye==="more"?"visible":"more").at(-1);if(rt)_e=rt.bottom;else if(ye==="more"){const yt=Pe.querySelector("[data-sidebar-more]");_e=yt?yt.getBoundingClientRect().top:je.top+2}}else{const ye=Ze[ce.slot];ye?_e=ye.top:_e=Ze.at(-1)?.bottom??je.top+2}return _e===null?null:Math.round(_e-je.top+Pe.scrollTop)},Ne=()=>{$e.current!==null&&(window.clearTimeout($e.current),$e.current=null)},We=(ce,he)=>{const Pe=Se.current;if(Pe===null||!Pe.armed)return;const je=document.elementFromPoint(ce,he),Ze=!!je?.closest("[data-sidebar-more]"),le=!!je?.closest("[data-sidebar-drop-band]");let _e;if(Ze)_e={kind:"more"},No(te,Pe.id)==="visible"&&!z&&$e.current===null&&($e.current=window.setTimeout(()=>{$e.current=null,j(!0),requestAnimationFrame(()=>at.current(me.current,ze.current))},400));else if(Ne(),le)_e={kind:"band"};else{const ye=de(Pe.id),Fe=xY(ye,Pe.id,he),rt=ye[Fe];let yt="visible";if(rt)yt=No(te,rt.id);else{const Rt=ye.at(-1);yt=Rt?No(te,Rt.id):"visible"}_e={kind:"slot",slot:Fe,beforeId:rt?.id??null,region:yt}}Ce.current=_e,pe(Me(_e,Pe.id))},at=m.useRef(We);at.current=We;const xt=()=>{ae.current!==null&&(cancelAnimationFrame(ae.current),ae.current=null)},Bt=()=>{ae.current=null;const ce=Se.current,he=be.current;if(ce===null||!ce.armed||he===null)return;const Pe=he.getBoundingClientRect(),je=ze.current,Ze=he.scrollHeight-he.clientHeight;let le=0;je-Pe.top<24&&he.scrollTop>0?le=-1:Pe.bottom-je<24&&he.scrollTop<Ze&&(le=1),le!==0&&(he.scrollTop+=le*8,at.current(me.current,je)),ae.current=requestAnimationFrame(Bt)},gn=(ce,he)=>{if(se&&he.button===0&&!(he.altKey||he.ctrlKey||he.metaKey||he.shiftKey)){try{he.currentTarget.setPointerCapture(he.pointerId)}catch{}Se.current={pointerId:he.pointerId,id:ce,armed:!1,startX:he.clientX,startY:he.clientY},me.current=he.clientX,ze.current=he.clientY}},At=ce=>{const he=Se.current;if(!(he===null||he.pointerId!==ce.pointerId)){if(me.current=ce.clientX,ze.current=ce.clientY,!he.armed){if(Math.hypot(ce.clientX-he.startX,ce.clientY-he.startY)<5)return;he.armed=!0,Ke.current=!0,ke(he.id);const Pe=H.get(he.id);Pe&&J(h("ui.shell.sidebar_navigation.drag_armed",{name:Pe.label})),ae.current===null&&(ae.current=requestAnimationFrame(Bt))}We(ce.clientX,ce.clientY)}},dt=(ce,he)=>{if(he.kind==="slot")return jdt(te,ce,he.region,he.beforeId,O);const Pe=No(te,ce),je=he.kind==="more"?"more":Pe==="more"?"visible":"more";return L5(te,ce,je)},Kt=(ce,he)=>{const Pe=H.get(ce);if(Pe===void 0)return;const je=dt(ce,he);if(je===null||vE(je,te))return;const Ze=No(je,ce);if(Ze==="more"&&C(!0),q(je),he.kind==="slot"){vn(je,ce);return}J(Ze==="more"?h("ui.shell.sidebar_navigation.move_to_more_note",{name:Pe.label}):h("ui.shell.sidebar_navigation.show_in_sidebar_note",{name:Pe.label}))},vn=(ce,he)=>{const Pe=H.get(he),je=No(ce,he),Ze=R_(ce,je,O);J(h("ui.shell.sidebar_navigation.move_note",{name:Pe?.label??"",position:String(Ze.indexOf(he)+1),total:String(Ze.length)}))},Dt=(ce,he=!1)=>{const Pe=Se.current;if(Pe===null)return;Se.current=null,xt(),Ne();const je=Ce.current;if(Ce.current=null,ke(null),pe(null),j(!1),!!Pe.armed){if(!ce){if(he){Ke.current=!1,J("");return}const Ze=()=>{Ke.current=!1},le=()=>{window.setTimeout(Ze,0)},_e=()=>{window.removeEventListener("pointerup",ye,!0),window.removeEventListener("pointercancel",Fe,!0),window.removeEventListener("blur",Fe,!0)},ye=()=>{_e(),le()},Fe=()=>{_e(),Ze()};window.addEventListener("pointerup",ye,!0),window.addEventListener("pointercancel",Fe,!0),window.addEventListener("blur",Fe,!0),J("");return}window.setTimeout(()=>{Ke.current=!1},0),je!==null&&Kt(Pe.id,je)}},ln=m.useRef(Dt);ln.current=Dt,m.useEffect(()=>{if(we===null)return;const ce=je=>{je.key==="Escape"&&(ln.current(!1),je.preventDefault())},he=je=>{Se.current?.pointerId===je.pointerId&&ln.current(!0)},Pe=()=>ln.current(!1,!0);return window.addEventListener("keydown",ce),window.addEventListener("pointerup",he),window.addEventListener("pointercancel",Pe),window.addEventListener("blur",Pe),()=>{window.removeEventListener("keydown",ce),window.removeEventListener("pointerup",he),window.removeEventListener("pointercancel",Pe),window.removeEventListener("blur",Pe)}},[we]),m.useEffect(()=>()=>{ae.current!==null&&cancelAnimationFrame(ae.current),$e.current!==null&&window.clearTimeout($e.current)},[]);const An=(ce,he)=>{if(!se)return;const Pe=H.get(ce);if(Pe===void 0)return;if(he.kind==="reset"){ne(),J(h("ui.shell.sidebar_navigation.reset_note")),U(ce);return}if(he.kind==="move"){const Ze=Bdt(te,ce,he.delta,O);if(Ze===null)return;q(Ze),vn(Ze,ce),U(ce);return}const je=L5(te,ce,he.region);vE(je,te)||(he.region==="more"&&C(!0),q(je),J(he.region==="more"?h("ui.shell.sidebar_navigation.move_to_more_note",{name:Pe.label}):h("ui.shell.sidebar_navigation.show_in_sidebar_note",{name:Pe.label})),U(ce))},nn=c.jsx(Mtt,{selectedConversation:l??void 0,onSelectConversation:ce=>void Cg(t,ce,"sidebar"),onStageDraft:(ce,he)=>{Ie.getState().stageDraft(ce,he),t("/chat")}}),sn=ce=>{const he=ce.attention??0,Pe=he>0&&ce.attentionName?ce.attentionName(he):ce.label;return ce.working&&ce.workingName?ce.workingName:Pe},un=ce=>{const he=H.get(ce);if(he===void 0)return null;const Pe=No(te,ce),je=Pe==="more"?L:M,Ze=je.indexOf(ce),le=Ze<=0,_e=Ze===-1||Ze>=je.length-1,ye=he.attention??0,Fe=sn(he),rt=we===ce,yt=e?"left":"right",Rt=he.isActive?Lo:"text-ink-muted hover:bg-row-hover hover:text-ink",Vt=c.jsx(he.icon,{size:16,"aria-hidden":"true",className:R("shrink-0",he.isActive&&"text-accent")}),Ht=c.jsxs("button",{type:"button",ref:Ft=>{Ft?ge.current.set(ce,Ft):ge.current.delete(ce)},onClick:()=>{if(Ke.current){Ke.current=!1;return}he.onSelect?he.onSelect():t(he.path)},onPointerDown:se?Ft=>gn(ce,Ft):void 0,onPointerMove:se?At:void 0,onPointerUp:se?Ft=>{Se.current?.pointerId===Ft.pointerId&&Dt(!0)}:void 0,onPointerCancel:se?()=>Dt(!1,!0):void 0,onKeyDown:se?Ft=>{if(Ft.key==="ContextMenu"||Ft.shiftKey&&Ft.key==="F10"){Ft.preventDefault(),ie(ce);return}Ft.altKey&&(Ft.key!=="ArrowUp"&&Ft.key!=="ArrowDown"||(Ft.preventDefault(),An(ce,{kind:"move",delta:Ft.key==="ArrowUp"?-1:1})))}:void 0,"data-tour-tag":he.tourTag,"aria-current":he.isActive?"page":void 0,"aria-haspopup":se?"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?Vt:c.jsxs("span",{className:"relative flex size-7 shrink-0 items-center justify-center",children:[Vt,ye>0&&c.jsx("span",{className:"pointer-events-none absolute -top-1 -end-1.5 flex",children:c.jsx(sp,{count:ye,placement:"corner","data-tour-tag":he.attentionTag})})]}),!s&&he.working&&c.jsx("span",{className:"inline-flex",children:c.jsx(Li,{size:16,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})}),s&&c.jsx("span",{className:"truncate",children:he.label})]}),Nt=se?c.jsxs(Xo,{open:Re===ce,onOpenChange:Ft=>ie(Ft?ce:null),children:[c.jsx(vo,{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(Sc,{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:yt,sideOffset:s?6:16,className:"min-w-44",onCloseAutoFocus:Ft=>{Ft.preventDefault(),U(ce)},children:[c.jsx(on,{disabled:le,onSelect:()=>An(ce,{kind:"move",delta:-1}),children:h("ui.shell.sidebar_navigation.move_up")}),c.jsx(on,{disabled:_e,onSelect:()=>An(ce,{kind:"move",delta:1}),children:h("ui.shell.sidebar_navigation.move_down")}),c.jsx(Hr,{}),Pe==="more"?c.jsx(on,{onSelect:()=>An(ce,{kind:"region",region:"visible"}),children:h("ui.shell.sidebar_navigation.show_in_sidebar")}):c.jsx(on,{onSelect:()=>An(ce,{kind:"region",region:"more"}),children:h("ui.shell.sidebar_navigation.move_to_more")}),!vE(te,yy)&&c.jsxs(c.Fragment,{children:[c.jsx(Hr,{}),c.jsx(on,{onSelect:()=>An(ce,{kind:"reset"}),children:h("ui.shell.sidebar_navigation.reset_layout")})]})]})]}):null;return c.jsxs("li",{"data-sidebar-row":ce,"data-sidebar-region":Pe,onContextMenu:se?Ft=>{Ft.preventDefault(),ie(ce)}:void 0,className:R("group/row relative flex h-[30px] w-full items-center rounded-md","transition-colors duration-fast ease-out-quart",Rt,rt&&BY,rt&&jY),children:[s?Ht:c.jsx(Iu,{content:sn(he),side:yt,suppressed:we!==null,children:Ht}),Nt,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(sp,{count:ye,"data-tour-tag":he.attentionTag}),he.working&&c.jsx(Li,{size:16,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})]})]},he.tourTag)},Fn=De===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:De}}),fs=(we===null?null:No(te,we))==="more"?h("ui.shell.sidebar_navigation.show_in_sidebar"):h("ui.shell.sidebar_navigation.move_to_more"),Un=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:fs}):c.jsx(Iu,{content:fs,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"})})}),Sr=c.jsx("span",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:oe}),Gn=s?h("ui.shell.sidebar_navigation.collapse_sidebar"):h("ui.shell.sidebar_navigation.expand_sidebar"),cn=s?e?Bi:Qu:e?Qu:Bi,Lt=navigator.platform.toUpperCase().indexOf("MAC")>=0,gs=vt(a.data,"session_catalogue",2),bn=Ie(ce=>ce.activeDraftKey),dn=Ie(ce=>ce.drafts),Vn=!!bn&&!(bn?dn[bn]:void 0)?.target,ms=()=>{Ie.getState().stageDraft(void 0,!0),t("/chat")},G=h("ui.shell.sidebar_navigation.new_chat_shortcut",{shortcut:Oi(I6(Lt).replace("+",""))}),V=h("ui.shell.sidebar_navigation.search_accessible",{everything:Oi(kl("everything",Lt)),chats:Oi(kl("chats",Lt))}),K=h("ui.shell.sidebar_navigation.search_tooltip",{everything:Oi(kl("everything",Lt)),chats:Oi(kl("chats",Lt))}),Q=(ce,he,Pe,je)=>{const Ze=ce;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(H5,je.current?Lo:"text-ink-muted hover:bg-row-hover hover:text-ink","disabled:text-ink-disabled disabled:hover:bg-transparent"),children:[c.jsx(Ze,{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($r,{shortcut:Pe,joined:!0})})]})},Y=Q(TT,h("ui.shell.sidebar_navigation.new_chat"),I6(Lt),{onClick:ms,ariaLabel:G,current:Vn,disabled:!gs,attrs:{"data-tour-tag":"nav-item-chat","data-new-chat-row":""}}),Z=Q(Eh,h("ui.shell.sidebar_navigation.search"),Oit("everything",Lt),{onClick:i,ariaLabel:V,attrs:{"data-command-palette-trigger":"",title:K}}),Te=(ce,he,Pe)=>{const je=ce;return c.jsx(Iu,{content:c.jsx(Vo,{text:he}),side:e?"left":"right",children:c.jsx("button",{type:"button",...Pe.attrs,onClick:Pe.onClick,disabled:Pe.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"}),(Pe.attention??0)>0&&c.jsx("span",{className:"pointer-events-none absolute -top-1 -end-1.5 flex",children:c.jsx(sp,{count:Pe.attention??0,placement:"corner","data-tour-tag":Pe.attentionTag})}),Pe.working&&c.jsx("span",{className:"pointer-events-none absolute -bottom-0.5 -end-0.5 flex",children:c.jsx(Li,{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:Gn,side:e?"left":"right",children:c.jsx(ue,{variant:"ghost",size:"icon-sm",onClick:r,"aria-label":Gn,"aria-expanded":s,"aria-keyshortcuts":YP(Lt),children:c.jsx(cn,{"aria-hidden":"true"})})})}),Ee=()=>{if(L.length===0)return null;const ce=L.map(le=>H.get(le)).filter(le=>le!==void 0),he=Hdt(ce),Pe=z?0:he,je=ce.some(le=>le.working===!0),Ze=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":z,"aria-controls":"sidebar-more-destinations","aria-label":Ze,onClick:()=>C(!z),className:R(H5,"text-ink-muted hover:bg-row-hover hover:text-ink"),children:[c.jsx(Sc,{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")}),(Pe>0||je)&&c.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1",children:[Pe>0&&c.jsx(sp,{count:Pe,"data-tour-tag":"nav-more-badge"}),je&&c.jsx(Li,{size:16,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})]}),c.jsx(ji,{size:14,"aria-hidden":"true",className:R("shrink-0 transition-transform duration-fast",z&&"rotate-180")})]}):Te(Sc,Ze,{onClick:()=>C(!z),attention:Pe,attentionTag:"nav-more-badge",working:je,attrs:{"aria-expanded":z,"aria-controls":"sidebar-more-destinations","data-tour-tag":"nav-item-more","data-sidebar-more":""}}),z&&c.jsx("ul",{id:"sidebar-more-destinations",className:R("flex flex-col gap-0.5",!s&&"items-center gap-1"),children:L.map(un)})]},"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(j5,{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:[Y,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:[M.map(un),Ee()]}),Fn]}),Un]}),Sr]}),c.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:nn}),c.jsx(vQ,{})]}):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(FQ,{}),c.jsx("div",{className:"flex h-10 shrink-0 items-center justify-center",children:c.jsx(j5,{expanded:!1})}),c.jsxs("ul",{className:"flex flex-col items-center gap-1",children:[c.jsx("li",{children:Te(Bi,Gn,{onClick:r,attrs:{"aria-expanded":!1,"aria-keyshortcuts":YP(Lt)}})}),c.jsx("li",{children:Te(TT,G,{onClick:ms,disabled:!gs,attrs:{"data-tour-tag":"nav-item-chat"}})}),c.jsx("li",{children:Te(Eh,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:[M.map(un),Ee()]}),Fn,Un]}),Sr,c.jsxs("div",{className:"mt-auto flex flex-col items-center gap-1 pb-2",children:[c.jsx(hQ,{}),c.jsx(mQ,{}),c.jsx(DI,{expanded:!1})]})]})},Wdt=1,zdt=()=>{const{isAuthenticated:e,user:t}=Qy(),{hasBeenNotified:n,setHasBeenNotified:s}=AQ(),[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 Xoe({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<Wdt?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 $dt(){const e=ei();m.useEffect(()=>{const t=r=>{e(r==="back"?-1:1)},n=r=>{const i=iU(r);i&&(r.preventDefault(),t(i))},s=r=>{const i=aU(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 qdt(){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 Kdt(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 Ydt(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 Xdt(){m.useLayoutEffect(()=>{if(!window.api?.windowChrome)return;const t=document.documentElement.dataset.chromePlatform??"linux",n=()=>Kdt(qdt(),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 Qdt=m.lazy(()=>Ma(()=>import("./agent-details-page-Bxrn_AT6.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}))),Jdt=m.lazy(()=>Ma(()=>import("./agent-hub-page-CI0_3cgV.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}))),U5=m.lazy(()=>Ma(()=>import("./agents-page-BFDBD9AA.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}))),Zdt=m.lazy(()=>Ma(()=>import("./schedules-page-DkoUCdGL.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}))),G5=m.lazy(()=>Ma(()=>import("./projects-page-DbLor3Wq.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}))),V5=m.lazy(()=>Ma(()=>import("./library-page-D364qPaH.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}))),W5=m.lazy(()=>Ma(()=>import("./notifications-page-DnRTPmsg.js"),__vite__mapDeps([31,1,2,3,14,5,6,15,17,8,7,9,25]),import.meta.url).then(e=>({default:e.NotificationsPage}))),eht=m.lazy(()=>Ma(()=>import("./team-bridge-page-BYsUTX6d.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}))),tht=m.lazy(()=>Ma(()=>import("./browser-page-BHpD48Cg.js"),__vite__mapDeps([34,1,2,3,5,6,8,7,9,14,15]),import.meta.url).then(e=>({default:e.BrowserPage}))),nht=m.lazy(()=>Ma(()=>import("./mesh-page-CNqutPsU.js"),__vite__mapDeps([35,1,2,3,5,6,17,8,7,9,14,15]),import.meta.url).then(e=>({default:e.MeshPage}))),sht=m.lazy(()=>Ma(()=>import("./settings-page-DS-Emp0f.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}))),rht=m.lazy(()=>Ma(()=>import("./browser-webauthn-prompt-GZSUrY94.js"),__vite__mapDeps([39,1,2,3,5,6,8,7,9,14,15]),import.meta.url).then(e=>({default:e.BrowserWebauthnPrompt}))),iht=()=>{Ve(),Qct(),Xdt(),kdt(),Qoe();const{pathname:e}=HA(),t=e.startsWith("/chat")||e.startsWith("/browser"),{isOnboardingActive:n}=dge(),{isLowCreditsDialogOpen:s,openRadientConsole:r,onLowCreditsDialogClose:i}=zdt(),{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=ei(),f=Yn(),p=vt(f.data,"session_catalogue",2),g=vt(f.data,"session_archive");m.useEffect(()=>{Ie.getState().requestArchiveConfirm(null)},[e]);const v=wr(f.data,"peers"),b=wr(f.data,"library"),x=wr(f.data,"notifications"),_=wr(f.data,"team_bridge_conversations"),w=_==="enabled"&&e.startsWith(cg);Sdt(vt(f.data,"team_bridge_conversations"));const y=N=>{Ie.getState().stageDraft({kind:"agent",name:N.name}),d("/chat"),u()};uat(),Rdt(),Nle(),Joe(),$dt(),Eye();const S=Ie(N=>N.setActiveSession),C=Yn(),E=Kh(vt(C.data,"aida",1)),k=Ie(N=>{const B=N.activeDraftKey?N.drafts[N.activeDraftKey]:void 0;return Qv(N.activeDraftKey,B?.sessionId,N.activeSessionId)}),F=cme({displayedSessionId:k,archiveEnabled:g}),A=tt(N=>N.setConsolePaneOpen),I=tt(N=>N.setBrowserPaneOpen),P=tt(N=>N.setConsoleActiveSurface);return m.useEffect(()=>{const N=window.api?.desktop?.onOpenConversation?.((B,H)=>{B!==null&&(performance.mark("lop:open:requested"),Mle(B,"native")),S(B),H!==void 0&&B!==null&&(P(H),A(!0)),d("/chat")});return()=>N?.()},[d,S,A,P]),Iit(_==="enabled",d),Adt(_==="enabled",d),m.useEffect(()=>{const N=window.api?.console?.onReveal?.(B=>{if(B.mode!=="none"&&!(B.mode==="session"&&B.session_id!==k)){if(B.mode==="open"){if(!Zoe({targetSessionId:B.session_id,displayedSessionId:k,activeElement:document.activeElement,commandPaletteOpen:a}))return;S(B.session_id)}P(B.surface),A(!0)}});return()=>N?.()},[k,a,S,A,P]),Mme(),Hst(),m.useEffect(()=>{const N=window.api?.browser?.onConsentAttention?.(B=>{const H=vme(B.requesterSessionId,Ie.getState().sessions);if(pme(B.entryId),H.kind==="browser"){d("/browser");return}S(H.sessionId),I(!0),d("/chat")});return()=>N?.()},[d,S,I]),m.useEffect(()=>{const N=B=>{n||p&&Gst(B)&&(B.preventDefault(),Ie.getState().stageDraft(void 0,!0),d("/chat"))};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[p,n,d]),c.jsx(Bct,{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(aat,{}),c.jsx(Hct,{}),c.jsx(Vst,{}),c.jsx(ele,{}),c.jsx(dat,{enabled:v==="enabled"}),c.jsx(iot,{open:n}),c.jsx(jct,{}),c.jsx(eut,{}),g&&c.jsx(jme,{}),c.jsx(Bge,{}),c.jsx(m.Suspense,{fallback:null,children:c.jsx(rht,{})}),c.jsx(sme,{blocked:n||s||a||o||F,sessionId:E.data?.session_id??null}),c.jsx(Ddt,{open:s,onClose:i,onGoToConsole:r}),c.jsx(gge,{open:o,onClose:u,onAgentCreated:y}),c.jsx(tle,{sidebar:c.jsx(Vdt,{}),routeSidebar:w&&{keeper:c.jsx(FQ,{}),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(Vut,{}),c.jsx("div",{className:"flex grow items-center justify-center",children:c.jsx(On,{size:"lg",label:h("ui.common.loading.page")})})]}),children:c.jsxs(qee,{children:[c.jsx(vr,{path:"/",element:c.jsx(XP,{to:"/chat",replace:!0})}),c.jsx(vr,{path:"/chat",element:c.jsx(F6,{})}),c.jsx(vr,{path:"/chat/:agentId",element:c.jsx(F6,{})}),c.jsx(vr,{path:"/agents",element:c.jsx(U5,{})}),c.jsx(vr,{path:"/agents/:agentId",element:c.jsx(U5,{})}),c.jsx(vr,{path:"/settings",element:c.jsx(sht,{})}),c.jsx(vr,{path:"/agent-hub",element:c.jsx(Jdt,{})}),c.jsx(vr,{path:"/agent-hub/:agentId",element:c.jsx(Qdt,{})}),c.jsx(vr,{path:"/schedules",element:c.jsx(Zdt,{})}),c.jsx(vr,{path:"/projects",element:c.jsx(G5,{})}),c.jsx(vr,{path:"/projects/:projectId",element:c.jsx(G5,{})}),c.jsx(vr,{path:"/browser",element:c.jsx(tht,{})}),x==="enabled"&&c.jsxs(c.Fragment,{children:[c.jsx(vr,{path:"/notifications",element:c.jsx(W5,{})}),c.jsx(vr,{path:"/notifications/:notificationId",element:c.jsx(W5,{})})]}),b==="enabled"&&c.jsxs(c.Fragment,{children:[c.jsx(vr,{path:"/library",element:c.jsx(V5,{})}),c.jsx(vr,{path:"/library/assets/:assetId",element:c.jsx(V5,{})})]}),_==="enabled"&&c.jsx(vr,{path:"/team-bridge",element:c.jsx(eht,{})}),v==="enabled"&&c.jsx(vr,{path:"/mesh",element:c.jsx(nht,{})}),c.jsx(vr,{path:"*",element:c.jsx(XP,{to:"/chat",replace:!0})})]})})]})})]})})})};let vl=null,Vf=null,Tm=null,Wf=null,bE=null;const aht={soundsArm:async()=>{if(Rf.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(),sle(e=>{if(!vl)throw new Error("sounds safety: no context");const t=vl.createMediaElementSource(e);Tm=vl.createGain(),Tm.gain.value=0,Vf=vl.createAnalyser(),Wf=vl.createAnalyser(),t.connect(Wf),Wf.connect(Tm),Tm.connect(Vf),Vf.connect(vl.destination)}),{armed:!0,contextState:vl.state}},soundsFacts:()=>{const e=Rf.getState(),t=new Float32Array(Vf?.fftSize??32);Vf?.getFloatTimeDomainData(t);const n=new Float32Array(Wf?.fftSize??32);return Wf?.getFloatTimeDomainData(n),{ownerId:e.ownerId,status:e.status,time:e.element?.currentTime??0,duration:e.element?.duration??0,paused:e.element?.paused??!0,gain:Tm?.gain.value??null,inputRms:Wf?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:Vf?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(Os.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}bE=()=>{r("pointerup",s.left+s.width*t.fraction),n.setPointerCapture=i,n.releasePointerCapture=a},u({during:f,seconds:Rf.getState().element?.currentTime})};requestAnimationFrame(d)})},soundsScrubFinish:()=>(bE?.(),bE=null,{committed:!0}),soundsEnd:()=>{const e=Rf.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=Rf.getState();if(!e.element?.src)throw new Error("sounds: fixture not resolved");const{fetchAttachmentBlob:t}=await Ma(async()=>{const{fetchAttachmentBlob:r}=await import("./conversation-input-sync-OWxmq4zX.js").then(i=>i.oA);return{fetchAttachmentBlob:r}},__vite__mapDeps([7,1,2,3,5,6,8,9]),import.meta.url),n=Ie.getState().activeSessionId,s=e.ownerId?.startsWith("sound:")?e.ownerId.slice(6):null;if(!n||!s)throw new Error("sounds: missing attachment identity");return await nle.getState().speak("sounds-driver",()=>t({sessionId:n,childId:null},s)),{ownerId:Rf.getState().ownerId}}};function Tu(){return new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))})}const oht=3,lht=3e3;function cht(e){return e instanceof CSSTransition&&e.playState==="running"}function uht(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 z5(e=lht){const t=performance.now();let n=0;for(;;){await Tu();const s=Math.round(performance.now()-t),r=document.getAnimations().filter(cht);if(n=r.length===0?n+1:0,n>=oht)return{waitedMs:s,timedOut:!1,pending:[]};if(s>e)return{waitedMs:s,timedOut:!0,pending:r.map(uht)}}}const dht=/^#/;function B0(){const e=window.location.hash.replace(dht,"");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 hht(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 Rm(e,t){if(typeof e!="string"||e==="")throw new Error(`${t} must be a non-empty string`);return e}async function fht(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 PA=["dev-driver","query-fetch-probe"];let j0=null;function pht(){if(j0)return j0;const e=[],t=JP.prototype.fetch;return JP.prototype.fetch=function(...s){return e.push({at:Date.now(),key:JSON.stringify(this.queryKey),stack:(new Error().stack??"").split(`
|
|
671
|
+
*/var e5;function aot(){if(e5)return km;e5=1;var e=st,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 km.Fragment=n,km.jsx=a,km.jsxs=a,km}var t5;function oot(){return t5||(t5=1,Z6.exports=aot()),Z6.exports}var lot=oot();/*! shepherd.js 14.5.0 */function cot(e){return e instanceof Element}function ug(e){return e instanceof HTMLElement}function ld(e){return typeof e=="function"}function Vv(e){return typeof e=="string"}function fi(e){return e===void 0}class gI{on(t,n,s,r=!1){var i;return fi(this.bindings)&&(this.bindings={}),fi(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(fi(this.bindings)||fi(this.bindings[t]))return this;if(fi(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(!fi(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 oa(){return oa=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},oa.apply(null,arguments)}function mI(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 _d={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")};_d.defaultMerge;function uot(e,t){return t}function dot(e,t){return e.filter(n=>n!==void 0)}var n5;(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"})(n5||(n5={}));function s5(e){return typeof e!="object"||e===null?0:Array.isArray(e)?2:pot(e)?1:e instanceof Set?3:e instanceof Map?4:5}function hot(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 fot(e,t){return typeof e=="object"&&Object.prototype.propertyIsEnumerable.call(e,t)}function DX(e){return{*[Symbol.iterator](){for(const t of e)for(const n of t)yield n}}}const r5=new Set(["[object Object]","[object Module]"]);function pot(e){if(!r5.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"||!r5.has(Object.prototype.toString.call(n))||!n.hasOwnProperty("isPrototypeOf"))}function got(e,t,n){const s={};for(const r of hot(e)){const i=[];for(const l of e)fot(l,r)&&i.push(l[r]);if(i.length===0)continue;const a=t.metaDataUpdater(n,{key:r,parents:e}),o=IX(i,t,a);o!==_d.skip&&(r==="__proto__"?Object.defineProperty(s,r,{value:o,configurable:!0,enumerable:!0,writable:!0}):s[r]=o)}return s}function mot(e){return e.flat()}function vot(e){return new Set(DX(e))}function bot(e){return new Map(DX(e))}function xot(e){return e.at(-1)}const Wx={mergeRecords:got,mergeArrays:mot,mergeSets:vot,mergeMaps:bot,mergeOthers:xot};function vI(...e){return _ot({})(...e)}function _ot(e,t){const n=wot(e,s);function s(...r){return IX(r,n,t)}return s}function wot(e,t){var n,s,r;return{defaultMergeFunctions:Wx,mergeFunctions:oa({},Wx,Object.fromEntries(Object.entries(e).filter(([i,a])=>Object.hasOwn(Wx,i)).map(([i,a])=>a===!1?[i,Wx.mergeOthers]:[i,a]))),metaDataUpdater:(n=e.metaDataUpdater)!=null?n:uot,deepmerge:t,useImplicitDefaultMerging:(s=e.enableImplicitDefaultMerging)!=null?s:!1,filterValues:e.filterValues===!1?void 0:(r=e.filterValues)!=null?r:dot,actions:_d}}function IX(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 hE(r,t,n);const i=s5(r[0]);if(i!==0&&i!==5){for(let a=1;a<r.length;a++)if(s5(r[a])!==i)return hE(r,t,n)}switch(i){case 1:return yot(r,t,n);case 2:return Cot(r,t,n);case 3:return Sot(r,t,n);case 4:return kot(r,t,n);default:return hE(r,t,n)}}function yot(e,t,n){const s=t.mergeFunctions.mergeRecords(e,t,n);return s===_d.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeRecords!==t.defaultMergeFunctions.mergeRecords?t.defaultMergeFunctions.mergeRecords(e,t,n):s}function Cot(e,t,n){const s=t.mergeFunctions.mergeArrays(e,t,n);return s===_d.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeArrays!==t.defaultMergeFunctions.mergeArrays?t.defaultMergeFunctions.mergeArrays(e):s}function Sot(e,t,n){const s=t.mergeFunctions.mergeSets(e,t,n);return s===_d.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeSets!==t.defaultMergeFunctions.mergeSets?t.defaultMergeFunctions.mergeSets(e):s}function kot(e,t,n){const s=t.mergeFunctions.mergeMaps(e,t,n);return s===_d.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps?t.defaultMergeFunctions.mergeMaps(e):s}function hE(e,t,n){const s=t.mergeFunctions.mergeOthers(e,t,n);return s===_d.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(e):s}function bI(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 Eot(e,t){return n=>{if(e.isOpen()){const s=e.el&&n.currentTarget===e.el;(!fi(t)&&n.currentTarget.matches(t)||s)&&e.tour.next()}}}function Tot(e){const{event:t,selector:n}=e.options.advanceOn||{};if(t){const s=Eot(e,n);let r=null;if(!fi(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 Rot{constructor(t){}}class Aot{constructor(t,n){}}function PX(e){return!Vv(e)||e===""?"":e.charAt(e.length-1)!=="-"?`${e}-`:e}function Fot(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 Dot(e){return e.options.extraHighlights?e.options.extraHighlights.flatMap(t=>Array.from(document.querySelectorAll(t))):[]}function NX(e){return e==null?!0:!e.element||!e.on}function MX(){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 Iot=["top","right","bottom","left"],i5=["start","end"],a5=Iot.reduce((e,t)=>e.concat(t,t+"-"+i5[0],t+"-"+i5[1]),[]),dg=Math.min,yh=Math.max,gy=Math.round,zx=Math.floor,Ml=e=>({x:e,y:e}),Pot={left:"right",right:"left",bottom:"top",top:"bottom"},Not={start:"end",end:"start"};function yA(e,t,n){return yh(e,dg(t,n))}function zh(e,t){return typeof e=="function"?e(t):e}function Vc(e){return e.split("-")[0]}function Mc(e){return e.split("-")[1]}function xI(e){return e==="x"?"y":"x"}function _I(e){return e==="y"?"height":"width"}function hg(e){return["top","bottom"].includes(Vc(e))?"y":"x"}function wI(e){return xI(hg(e))}function OX(e,t,n){n===void 0&&(n=!1);const s=Mc(e),r=wI(e),i=_I(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 Mot(e){const t=vy(e);return[my(e),t,my(t)]}function my(e){return e.replace(/start|end/g,t=>Not[t])}function Oot(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 Lot(e,t,n,s){const r=Mc(e);let i=Oot(Vc(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=>Pot[t])}function Bot(e){return oa({top:0,right:0,bottom:0,left:0},e)}function LX(e){return typeof e!="number"?Bot(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"],Hot=["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"],Uot=["mainAxis","crossAxis","limiter"];function o5(e,t,n){let{reference:s,floating:r}=e;const i=hg(t),a=wI(t),o=_I(a),l=Vc(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(Mc(t)){case"start":g[a]-=p*(n&&u?-1:1);break;case"end":g[a]+=p*(n&&u?-1:1);break}return g}const Got=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}=o5(u,s,l),p=s,g={},v=0;for(let b=0;b<o.length;b++){const{name:x,fn:_}=o[b],{x:w,y,data:S,reset:C}=await _({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=oa({},g,{[x]:oa({},g[x],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}=o5(u,p,l)),b=-1)}return{x:d,y:f,placement:p,strategy:r,middlewareData:g}};async function yI(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}=zh(t,e),v=LX(g),b=o[p?f==="floating"?"reference":"floating":f],x=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})),_=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:_,offsetParent:w,strategy:l}):_);return{top:(x.top-S.top+v.top)/y.y,bottom:(S.bottom-x.bottom+v.bottom)/y.y,left:(x.left-S.left+v.left)/y.x,right:(S.right-x.right+v.right)/y.x}}const Vot=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}=zh(e,t)||{};if(u==null)return{};const f=LX(d),p={x:n,y:s},g=wI(r),v=_I(g),b=await a.getDimensions(u),x=g==="y",_=x?"top":"left",w=x?"bottom":"right",y=x?"clientHeight":"clientWidth",S=i.reference[v]+i.reference[g]-p[g]-i.floating[v],C=p[g]-i.reference[g],E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let k=E?E[y]:0;(!k||!await(a.isElement==null?void 0:a.isElement(E)))&&(k=o.floating[y]||i.floating[v]);const F=S/2-C/2,A=k/2-b[v]/2-1,I=dg(f[_],A),P=dg(f[w],A),N=I,B=k-b[v]-P,H=k/2-b[v]/2+F,O=yA(N,H,B),X=!l.arrow&&Mc(r)!=null&&H!==O&&i.reference[v]/2-(H<N?I:P)-b[v]/2<0,ee=X?H<N?H-N:H-B:0;return{[g]:p[g]+ee,data:oa({[g]:O,centerOffset:H-O-ee},X&&{alignmentOffset:ee}),reset:X}}});function Wot(e,t,n){return(e?[...n.filter(s=>Mc(s)===e),...n.filter(s=>Mc(s)!==e)]:n.filter(s=>Vc(s)===s)).filter(s=>e?Mc(s)===e||(t?my(s)!==s:!1):!0)}const zot=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=zh(e,t),{crossAxis:f=!1,alignment:p,allowedPlacements:g=a5,autoAlignment:v=!0}=d,b=mI(d,jot),x=p!==void 0||g===a5?Wot(p||null,v,g):g,_=await yI(t,b),w=((n=a.autoPlacement)==null?void 0:n.index)||0,y=x[w];if(y==null)return{};const S=OX(y,i,await(l.isRTL==null?void 0:l.isRTL(u.floating)));if(o!==y)return{reset:{placement:x[0]}};const C=[_[Vc(y)],_[S[0]],_[S[1]]],E=[...((s=a.autoPlacement)==null?void 0:s.overflows)||[],{placement:y,overflows:C}],k=x[w+1];if(k)return{data:{index:w+1,overflows:E},reset:{placement:k}};const F=E.map(I=>{const P=Mc(I.placement);return[I.placement,P&&f?I.overflows.slice(0,2).reduce((N,B)=>N+B,0):I.overflows[0],I.overflows]}).sort((I,P)=>I[1]-P[1]),A=((r=F.filter(I=>I[2].slice(0,Mc(I[0])?2:3).every(P=>P<=0))[0])==null?void 0:r[0])||F[0][0];return A!==o?{data:{index:w+1,overflows:E},reset:{placement:A}}:{}}}},$ot=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=zh(e,t),{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:x=!0}=d,_=mI(d,Hot);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=Vc(r),y=hg(o),S=Vc(o)===o,C=await(l.isRTL==null?void 0:l.isRTL(u.floating)),E=g||(S||!x?[vy(o)]:Mot(o)),k=b!=="none";!g&&k&&E.push(...Lot(o,x,b,C));const F=[o,...E],A=await yI(t,_),I=[];let P=((s=i.flip)==null?void 0:s.overflows)||[];if(f&&I.push(A[w]),p){const O=OX(r,a,C);I.push(A[O[0]],A[O[1]])}if(P=[...P,{placement:r,overflows:I}],!I.every(O=>O<=0)){var N,B;const O=(((N=i.flip)==null?void 0:N.index)||0)+1,X=F[O];if(X)return{data:{index:O,overflows:P},reset:{placement:X}};let ee=(B=P.filter(se=>se.overflows[0]<=0).sort((se,q)=>se.overflows[1]-q.overflows[1])[0])==null?void 0:B.placement;if(!ee)switch(v){case"bestFit":{var H;const se=(H=P.filter(q=>{if(k){const ne=hg(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:H[0];se&&(ee=se);break}case"initialPlacement":ee=o;break}if(r!==ee)return{reset:{placement:ee}}}return{}}}},qot=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:r}=t,i=zh(e,t),{mainAxis:a=!0,crossAxis:o=!1,limiter:l={fn:_=>{let{x:w,y}=_;return{x:w,y}}}}=i,u=mI(i,Uot),d={x:n,y:s},f=await yI(t,u),p=hg(Vc(r)),g=xI(p);let v=d[g],b=d[p];if(a){const _=g==="y"?"top":"left",w=g==="y"?"bottom":"right",y=v+f[_],S=v-f[w];v=yA(y,v,S)}if(o){const _=p==="y"?"top":"left",w=p==="y"?"bottom":"right",y=b+f[_],S=b-f[w];b=yA(y,b,S)}const x=l.fn(oa({},t,{[g]:v,[p]:b}));return oa({},x,{data:{x:x.x-n,y:x.y-s}})}}},Kot=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}=zh(e,t),d={x:n,y:s},f=hg(r),p=xI(f);let g=d[p],v=d[f];const b=zh(o,t),x=typeof b=="number"?{mainAxis:b,crossAxis:0}:oa({mainAxis:0,crossAxis:0},b);if(l){const y=p==="y"?"height":"width",S=i.reference[p]-i.floating[y]+x.mainAxis,C=i.reference[p]+i.reference[y]-x.mainAxis;g<S?g=S:g>C&&(g=C)}if(u){var _,w;const y=p==="y"?"width":"height",S=["top","left"].includes(Vc(r)),C=i.reference[f]-i.floating[y]+(S&&((_=a.offset)==null?void 0:_[f])||0)+(S?0:x.crossAxis),E=i.reference[f]+i.reference[y]+(S?0:((w=a.offset)==null?void 0:w[f])||0)-(S?x.crossAxis:0);v<C?v=C:v>E&&(v=E)}return{[p]:g,[f]:v}}}};function JC(){return typeof window<"u"}function Bg(e){return BX(e)?(e.nodeName||"").toLowerCase():"#document"}function Da(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Yl(e){var t;return(t=(BX(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function BX(e){return JC()?e instanceof Node||e instanceof Da(e).Node:!1}function Jo(e){return JC()?e instanceof Element||e instanceof Da(e).Element:!1}function Gl(e){return JC()?e instanceof HTMLElement||e instanceof Da(e).HTMLElement:!1}function l5(e){return!JC()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Da(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 Yot(e){return["table","td","th"].includes(Bg(e))}function ZC(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function CI(e){const t=SI(),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 Xot(e){let t=cd(e);for(;Gl(t)&&!fg(t);){if(CI(t))return t;if(ZC(t))return null;t=cd(t)}return null}function SI(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function fg(e){return["html","body","#document"].includes(Bg(e))}function Zo(e){return Da(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(Bg(e)==="html")return e;const t=e.assignedSlot||e.parentNode||l5(e)&&e.host||Yl(e);return l5(t)?t.host:t}function jX(e){const t=cd(e);return fg(t)?e.ownerDocument?e.ownerDocument.body:e.body:Gl(t)&&Tb(t)?t:jX(t)}function Wv(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=jX(e),i=r===((s=e.ownerDocument)==null?void 0:s.body),a=Da(r);if(i){const o=CA(a);return t.concat(a,a.visualViewport||[],Tb(r)?r:[],o&&n?Wv(o):[])}return t.concat(r,Wv(r,[],n))}function CA(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function HX(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 kI(e){return Jo(e)?e:e.contextElement}function Hp(e){const t=kI(e);if(!Gl(t))return Ml(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:i}=HX(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 Qot=Ml(0);function UX(e){const t=Da(e);return!SI()||!t.visualViewport?Qot:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Jot(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Da(e)?!1:t}function $h(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=kI(e);let a=Ml(1);t&&(s?Jo(s)&&(a=Hp(s)):a=Hp(e));const o=Jot(i,n,s)?UX(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=Da(i),g=s&&Jo(s)?Da(s):s;let v=p,b=CA(v);for(;b&&s&&g!==v;){const x=Hp(b),_=b.getBoundingClientRect(),w=Zo(b),y=_.left+(b.clientLeft+parseFloat(w.paddingLeft))*x.x,S=_.top+(b.clientTop+parseFloat(w.paddingTop))*x.y;l*=x.x,u*=x.y,d*=x.x,f*=x.y,l+=y,u+=S,v=Da(b),b=CA(v)}}return by({width:d,height:f,x:l,y:u})}function EI(e,t){const n=e1(e).scrollLeft;return t?t.left+n:$h(Yl(e)).left+n}function GX(e,t,n){n===void 0&&(n=!1);const s=e.getBoundingClientRect(),r=s.left+t.scrollLeft-(n?0:EI(e,s)),i=s.top+t.scrollTop;return{x:r,y:i}}function Zot(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)&&((Bg(s)!=="body"||Tb(a))&&(l=e1(s)),Gl(s))){const g=$h(s);u=Hp(s),d.x=g.x+s.clientLeft,d.y=g.y+s.clientTop}const p=a&&!f&&!i?GX(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 elt(e){return Array.from(e.getClientRects())}function tlt(e){const t=Yl(e),n=e1(e),s=e.ownerDocument.body,r=yh(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),i=yh(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let a=-n.scrollLeft+EI(e);const o=-n.scrollTop;return Zo(s).direction==="rtl"&&(a+=yh(t.clientWidth,s.clientWidth)-r),{width:r,height:i,x:a,y:o}}function nlt(e,t){const n=Da(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=SI();(!u||u&&t==="fixed")&&(o=r.offsetLeft,l=r.offsetTop)}return{width:i,height:a,x:o,y:l}}function slt(e,t){const n=$h(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,i=Gl(e)?Hp(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 c5(e,t,n){let s;if(t==="viewport")s=nlt(e,n);else if(t==="document")s=tlt(Yl(e));else if(Jo(t))s=slt(t,n);else{const r=UX(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return by(s)}function VX(e,t){const n=cd(e);return n===t||!Jo(n)||fg(n)?!1:Zo(n).position==="fixed"||VX(n,t)}function rlt(e,t){const n=t.get(e);if(n)return n;let s=Wv(e,[],!1).filter(o=>Jo(o)&&Bg(o)!=="body"),r=null;const i=Zo(e).position==="fixed";let a=i?cd(e):e;for(;Jo(a)&&!fg(a);){const o=Zo(a),l=CI(a);!l&&o.position==="fixed"&&(r=null),(i?!l&&!r:!l&&o.position==="static"&&r&&["absolute","fixed"].includes(r.position)||Tb(a)&&!l&&VX(e,a))?s=s.filter(u=>u!==a):r=o,a=cd(a)}return t.set(e,s),s}function ilt(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const i=[...n==="clippingAncestors"?ZC(t)?[]:rlt(t,this._c):[].concat(n),s],a=i[0],o=i.reduce((l,u)=>{const d=c5(t,u,r);return l.top=yh(d.top,l.top),l.right=dg(d.right,l.right),l.bottom=dg(d.bottom,l.bottom),l.left=yh(d.left,l.left),l},c5(t,a,r));return{width:o.right-o.left,height:o.bottom-o.top,x:o.left,y:o.top}}function alt(e){const{width:t,height:n}=HX(e);return{width:t,height:n}}function olt(e,t,n){const s=Gl(t),r=Yl(t),i=n==="fixed",a=$h(e,!0,i,t);let o={scrollLeft:0,scrollTop:0};const l=Ml(0);if(s||!s&&!i)if((Bg(t)!=="body"||Tb(r))&&(o=e1(t)),s){const p=$h(t,!0,i,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else r&&(l.x=EI(r));const u=r&&!s&&!i?GX(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 fE(e){return Zo(e).position==="static"}function u5(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 WX(e,t){const n=Da(e);if(ZC(e))return n;if(!Gl(e)){let r=cd(e);for(;r&&!fg(r);){if(Jo(r)&&!fE(r))return r;r=cd(r)}return n}let s=u5(e,t);for(;s&&Yot(s)&&fE(s);)s=u5(s,t);return s&&fg(s)&&fE(s)&&!CI(s)?n:s||Xot(e)||n}const llt=async function(e){const t=this.getOffsetParent||WX,n=this.getDimensions,s=await n(e.floating);return{reference:olt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function clt(e){return Zo(e).direction==="rtl"}const ult={convertOffsetParentRelativeRectToViewportRelativeRect:Zot,getDocumentElement:Yl,getClippingRect:ilt,getOffsetParent:WX,getElementRects:llt,getClientRects:elt,getDimensions:alt,getScale:Hp,isElement:Jo,isRTL:clt};function dlt(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=zx(d),v=zx(r.clientWidth-(u+f)),b=zx(r.clientHeight-(d+p)),x=zx(u),_={rootMargin:-g+"px "+-v+"px "+-b+"px "+-x+"px",threshold:yh(0,dg(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,oa({},_,{root:r.ownerDocument}))}catch{n=new IntersectionObserver(y,_)}n.observe(e)}return a(!0),i}function hlt(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=kI(e),d=r||i?[...u?Wv(u):[],...Wv(t)]:[];d.forEach(_=>{r&&_.addEventListener("scroll",n,{passive:!0}),i&&_.addEventListener("resize",n)});const f=u&&o?dlt(u,n):null;let p=-1,g=null;a&&(g=new ResizeObserver(_=>{let[w]=_;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?$h(e):null;l&&x();function x(){const _=$h(e);b&&(_.x!==b.x||_.y!==b.y||_.width!==b.width||_.height!==b.height)&&n(),b=_,v=requestAnimationFrame(x)}return n(),()=>{var _;d.forEach(w=>{r&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),f?.(),(_=g)==null||_.disconnect(),g=null,l&&cancelAnimationFrame(v)}}const flt=zot,plt=qot,glt=$ot,mlt=Vot,vlt=Kot,blt=(e,t,n)=>{const s=new Map,r=oa({platform:ult},n),i=oa({},r.platform,{_c:s});return Got(e,t,oa({},r,{platform:i}))};function xlt(e){e.cleanup&&e.cleanup();const t=e._getResolvedAttachToOptions();let n=t.element;const s=klt(t,e),r=NX(t);return r&&(n=document.body,e.shepherdElementComponent.getElement().classList.add("shepherd-centered")),e.cleanup=hlt(n,e.el,()=>{if(!e.el){e.cleanup==null||e.cleanup();return}ylt(n,e,s,r)}),e.target=t.element,s}function _lt(e,t){return{floatingUIOptions:vI(e.floatingUIOptions||{},t.floatingUIOptions||{})}}function wlt(e){e.cleanup&&e.cleanup(),e.cleanup=null}function ylt(e,t,n,s){return blt(e,t.el,n).then(Clt(t,s)).then(r=>new Promise(i=>{setTimeout(()=>i(r),300)})).then(r=>{r!=null&&r.el&&r.el.focus({preventScroll:!0})})}function Clt(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,Slt(e.el,i)),e)}function Slt(e,t){const n=e.querySelector(".shepherd-arrow");if(ug(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 klt(e,t){var n,s,r;const i={strategy:"absolute"};i.middleware=[];const a=Elt(t),o=NX(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(flt({crossAxis:!0,alignment:u?e==null||(d=e.on)==null?void 0:d.split("-").pop():null}))}else i.middleware.push(glt());if(i.middleware.push(plt({limiter:vlt(),crossAxis:!0})),a){const f=typeof t.options.arrow=="object"?t.options.arrow:{padding:4};i.middleware.push(mlt({element:a,padding:u?f.padding:0}))}l||(i.placement=e.on)}return vI(i,t.options.floatingUIOptions||{})}function Elt(e){return e.options.arrow&&e.el?e.el.querySelector(".shepherd-arrow"):!1}function Na(){}function Tlt(e,t){for(const n in t)e[n]=t[n];return e}function zX(e){return e()}function d5(){return Object.create(null)}function Rb(e){e.forEach(zX)}function TI(e){return typeof e=="function"}function Zc(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Rlt(e){return Object.keys(e).length===0}function pg(e,t){e.appendChild(t)}function il(e,t,n){e.insertBefore(t,n||null)}function So(e){e.parentNode&&e.parentNode.removeChild(e)}function Alt(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 h5(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function $X(e){return document.createTextNode(e)}function xy(){return $X(" ")}function Flt(){return $X("")}function t1(e,t,n,s){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n,s)}function hs(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}const Dlt=["width","height"];function f5(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&&Dlt.indexOf(s)===-1?e[s]=t[s]:hs(e,s,t[s])}function Ilt(e){return Array.from(e.childNodes)}function Hf(e,t,n){e.classList.toggle(t,!!n)}let zv;function L0(e){zv=e}function qX(){if(!zv)throw new Error("Function called outside component initialization");return zv}function Plt(e){qX().$$.on_mount.push(e)}function RI(e){qX().$$.after_update.push(e)}const np=[],gg=[];let Up=[];const p5=[],Nlt=Promise.resolve();let SA=!1;function Mlt(){SA||(SA=!0,Nlt.then(KX))}function kA(e){Up.push(e)}const pE=new Set;let Uf=0;function KX(){if(Uf!==0)return;const e=zv;do{try{for(;Uf<np.length;){const t=np[Uf];Uf++,L0(t),Olt(t.$$)}}catch(t){throw np.length=0,Uf=0,t}for(L0(null),np.length=0,Uf=0;gg.length;)gg.pop()();for(let t=0;t<Up.length;t+=1){const n=Up[t];pE.has(n)||(pE.add(n),n())}Up.length=0}while(np.length);for(;p5.length;)p5.pop()();SA=!1,pE.clear(),L0(e)}function Olt(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(kA)}}function Llt(e){const t=[],n=[];Up.forEach(s=>e.indexOf(s)===-1?t.push(s):n.push(s)),n.forEach(s=>s()),Up=t}const E_=new Set;let ih;function Ch(){ih={r:0,c:[],p:ih}}function Sh(){ih.r||Rb(ih.c),ih=ih.p}function ns(e,t){e&&e.i&&(E_.delete(e),e.i(t))}function tr(e,t,n,s){if(e&&e.o){if(E_.has(e))return;E_.add(e),ih.c.push(()=>{E_.delete(e),s&&(n&&e.d(1),s())}),e.o(t)}else s&&s()}function g5(e){return e?.length!==void 0?e:Array.from(e)}function Blt(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 uf(e){e&&e.c()}function wd(e,t,n){const{fragment:s,after_update:r}=e.$$;s&&s.m(t,n),kA(()=>{const i=e.$$.on_mount.map(zX).filter(TI);e.$$.on_destroy?e.$$.on_destroy.push(...i):Rb(i),e.$$.on_mount=[]}),r.forEach(kA)}function yd(e,t){const n=e.$$;n.fragment!==null&&(Llt(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&&(np.push(e),Mlt(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function eu(e,t,n,s,r,i,a=null,o=[-1]){const l=zv;L0(e);const u=e.$$={fragment:null,ctx:[],props:i,update:Na,not_equal:r,bound:d5(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:d5(),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=Ilt(t.target);u.fragment&&u.fragment.l(f),f.forEach(So)}else u.fragment&&u.fragment.c();t.intro&&ns(e.$$.fragment),wd(e,t.target,t.anchor),KX()}L0(l)}class tu{constructor(){this.$$=void 0,this.$$set=void 0}$destroy(){yd(this,1),this.$destroy=Na}$on(t,n){if(!TI(n))return Na;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&&!Rlt(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Hlt="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Hlt);function Ult(e){let t,n,s,r,i;return{c(){t=Vl("button"),hs(t,"aria-label",n=e[3]?e[3]:null),hs(t,"class",s=`${e[1]||""} shepherd-button ${e[4]?"shepherd-button-secondary":""}`),t.disabled=e[2],hs(t,"tabindex","0"),hs(t,"type","button")},m(a,o){il(a,t,o),t.innerHTML=e[5],r||(i=t1(t,"click",function(){TI(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)&&hs(t,"aria-label",n),o&18&&s!==(s=`${e[1]||""} shepherd-button ${e[4]?"shepherd-button-secondary":""}`)&&hs(t,"class",s),o&4&&(t.disabled=e[2])},i:Na,o:Na,d(a){a&&So(t),r=!1,i()}}}function Glt(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 Vlt extends tu{constructor(t){super(),eu(this,t,Glt,Ult,Zc,{config:6,step:7})}}function m5(e,t,n){const s=e.slice();return s[2]=t[n],s}function v5(e){let t,n,s=g5(e[1]),r=[];for(let a=0;a<s.length;a+=1)r[a]=b5(m5(e,s,a));const i=a=>tr(r[a],1,1,()=>{r[a]=null});return{c(){for(let a=0;a<r.length;a+=1)r[a].c();t=Flt()},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=g5(a[1]);let l;for(l=0;l<s.length;l+=1){const u=m5(a,s,l);r[l]?(r[l].p(u,o),ns(r[l],1)):(r[l]=b5(u),r[l].c(),ns(r[l],1),r[l].m(t.parentNode,t))}for(Ch(),l=s.length;l<r.length;l+=1)i(l);Sh()}},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)tr(r[o]);n=!1},d(a){a&&So(t),Alt(r,a)}}}function b5(e){let t,n;return t=new Vlt({props:{config:e[2],step:e[0]}}),{c(){uf(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){tr(t.$$.fragment,s),n=!1},d(s){yd(t,s)}}}function Wlt(e){let t,n,s=e[1]&&v5(e);return{c(){t=Vl("footer"),s&&s.c(),hs(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=v5(r),s.c(),ns(s,1),s.m(t,null)):s&&(Ch(),tr(s,1,1,()=>{s=null}),Sh())},i(r){n||(ns(s),n=!0)},o(r){tr(s),n=!1},d(r){r&&So(t),s&&s.d()}}}function zlt(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 $lt extends tu{constructor(t){super(),eu(this,t,zlt,Wlt,Zc,{step:0})}}function qlt(e){let t,n,s,r,i;return{c(){t=Vl("button"),n=Vl("span"),n.textContent="×",hs(n,"aria-hidden","true"),hs(t,"aria-label",s=e[0].label?e[0].label:"Close Tour"),hs(t,"class","shepherd-cancel-icon"),hs(t,"type","button")},m(a,o){il(a,t,o),pg(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")&&hs(t,"aria-label",s)},i:Na,o:Na,d(a){a&&So(t),r=!1,i()}}}function Klt(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 Ylt extends tu{constructor(t){super(),eu(this,t,Klt,qlt,Zc,{cancelIcon:0,step:2})}}function Xlt(e){let t;return{c(){t=Vl("h3"),hs(t,"id",e[1]),hs(t,"class","shepherd-title")},m(n,s){il(n,t,s),e[3](t)},p(n,[s]){s&2&&hs(t,"id",n[1])},i:Na,o:Na,d(n){n&&So(t),e[3](null)}}}function Qlt(e,t,n){let{labelId:s,element:r,title:i}=t;RI(()=>{ld(i)&&n(2,i=i()),n(0,r.innerHTML=i,r)});function a(o){gg[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 Jlt extends tu{constructor(t){super(),eu(this,t,Qlt,Xlt,Zc,{labelId:1,element:0,title:2})}}function x5(e){let t,n;return t=new Jlt({props:{labelId:e[0],title:e[2]}}),{c(){uf(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){tr(t.$$.fragment,s),n=!1},d(s){yd(t,s)}}}function _5(e){let t,n;return t=new Ylt({props:{cancelIcon:e[3],step:e[1]}}),{c(){uf(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){tr(t.$$.fragment,s),n=!1},d(s){yd(t,s)}}}function Zlt(e){let t,n,s,r=e[2]&&x5(e),i=e[3]&&e[3].enabled&&_5(e);return{c(){t=Vl("header"),r&&r.c(),n=xy(),i&&i.c(),hs(t,"class","shepherd-header")},m(a,o){il(a,t,o),r&&r.m(t,null),pg(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=x5(a),r.c(),ns(r,1),r.m(t,n)):r&&(Ch(),tr(r,1,1,()=>{r=null}),Sh()),a[3]&&a[3].enabled?i?(i.p(a,o),o&8&&ns(i,1)):(i=_5(a),i.c(),ns(i,1),i.m(t,null)):i&&(Ch(),tr(i,1,1,()=>{i=null}),Sh())},i(a){s||(ns(r),ns(i),s=!0)},o(a){tr(r),tr(i),s=!1},d(a){a&&So(t),r&&r.d(),i&&i.d()}}}function ect(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 tct extends tu{constructor(t){super(),eu(this,t,ect,Zlt,Zc,{labelId:0,step:1})}}function nct(e){let t;return{c(){t=Vl("div"),hs(t,"class","shepherd-text"),hs(t,"id",e[1])},m(n,s){il(n,t,s),e[3](t)},p(n,[s]){s&2&&hs(t,"id",n[1])},i:Na,o:Na,d(n){n&&So(t),e[3](null)}}}function sct(e,t,n){let{descriptionId:s,element:r,step:i}=t;RI(()=>{let{text:o}=i.options;ld(o)&&(o=o.call(i)),ug(o)?r.appendChild(o):n(0,r.innerHTML=o,r)});function a(o){gg[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 rct extends tu{constructor(t){super(),eu(this,t,sct,nct,Zc,{descriptionId:1,element:0,step:2})}}function w5(e){let t,n;return t=new tct({props:{labelId:e[1],step:e[2]}}),{c(){uf(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){tr(t.$$.fragment,s),n=!1},d(s){yd(t,s)}}}function y5(e){let t,n;return t=new rct({props:{descriptionId:e[0],step:e[2]}}),{c(){uf(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){tr(t.$$.fragment,s),n=!1},d(s){yd(t,s)}}}function C5(e){let t,n;return t=new $lt({props:{step:e[2]}}),{c(){uf(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){tr(t.$$.fragment,s),n=!1},d(s){yd(t,s)}}}function ict(e){let t,n=!fi(e[2].options.title)||e[2].options.cancelIcon&&e[2].options.cancelIcon.enabled,s,r=!fi(e[2].options.text),i,a=Array.isArray(e[2].options.buttons)&&e[2].options.buttons.length,o,l=n&&w5(e),u=r&&y5(e),d=a&&C5(e);return{c(){t=Vl("div"),l&&l.c(),s=xy(),u&&u.c(),i=xy(),d&&d.c(),hs(t,"class","shepherd-content")},m(f,p){il(f,t,p),l&&l.m(t,null),pg(t,s),u&&u.m(t,null),pg(t,i),d&&d.m(t,null),o=!0},p(f,[p]){p&4&&(n=!fi(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=w5(f),l.c(),ns(l,1),l.m(t,s)):l&&(Ch(),tr(l,1,1,()=>{l=null}),Sh()),p&4&&(r=!fi(f[2].options.text)),r?u?(u.p(f,p),p&4&&ns(u,1)):(u=y5(f),u.c(),ns(u,1),u.m(t,i)):u&&(Ch(),tr(u,1,1,()=>{u=null}),Sh()),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=C5(f),d.c(),ns(d,1),d.m(t,null)):d&&(Ch(),tr(d,1,1,()=>{d=null}),Sh())},i(f){o||(ns(l),ns(u),ns(d),o=!0)},o(f){tr(l),tr(u),tr(d),o=!1},d(f){f&&So(t),l&&l.d(),u&&u.d(),d&&d.d()}}}function act(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 oct extends tu{constructor(t){super(),eu(this,t,act,ict,Zc,{descriptionId:0,labelId:1,step:2})}}function S5(e){let t;return{c(){t=Vl("div"),hs(t,"class","shepherd-arrow"),hs(t,"data-popper-arrow","")},m(n,s){il(n,t,s)},d(n){n&&So(t)}}}function lct(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&&S5();s=new oct({props:{descriptionId:e[2],labelId:e[3],step:e[4]}});let d=[{"aria-describedby":r=fi(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=Tlt(f,d[p]);return{c(){t=Vl("dialog"),u&&u.c(),n=xy(),uf(s.$$.fragment),f5(t,f),Hf(t,"shepherd-has-cancel-icon",e[5]),Hf(t,"shepherd-has-title",e[6]),Hf(t,"shepherd-element",!0)},m(p,g){il(p,t,g),u&&u.m(t,null),pg(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=S5(),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),f5(t,f=Blt(d,[(!a||g&20&&r!==(r=fi(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"}])),Hf(t,"shepherd-has-cancel-icon",p[5]),Hf(t,"shepherd-has-title",p[6]),Hf(t,"shepherd-element",!0)},i(p){a||(ns(s.$$.fragment,p),a=!0)},o(p){tr(s.$$.fragment,p),a=!1},d(p){p&&So(t),u&&u.d(),yd(s),e[13](null),o=!1,l()}}}const cct=9,uct=27,dct=37,hct=39;function k5(e){return e.split(" ").filter(t=>!!t.length)}function fct(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;Plt(()=>{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])}),RI(()=>{v!==d.options.classes&&x()});function x(){_(v),v=d.options.classes,w(v)}function _(C){if(Vv(C)){const E=k5(C);E.length&&r.classList.remove(...E)}}function w(C){if(Vv(C)){const E=k5(C);E.length&&r.classList.add(...E)}}const y=C=>{const{tour:E}=d;switch(C.keyCode){case cct: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 uct:E.options.exitOnEsc&&(C.preventDefault(),C.stopPropagation(),d.cancel());break;case dct:E.options.keyboardNavigation&&(C.preventDefault(),C.stopPropagation(),E.back());break;case hct:E.options.keyboardNavigation&&(C.preventDefault(),C.stopPropagation(),E.next());break}};function S(C){gg[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 pct extends tu{constructor(t){super(),eu(this,t,fct,lct,Zc,{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 EA extends gI{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?PX(this.tour.options.classPrefix):"",this.styles=t.styles,this._resolvedAttachTo=null,bI(this),this._setOptions(n),this}cancel(){this.tour.cancel(),this.trigger("cancel")}complete(){this.tour.complete(),this.trigger("complete")}destroy(){wlt(this),ug(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=Dot(this),this._resolvedExtraHighlightElements}_resolveAttachToOptions(){return this._resolvedAttachTo=Fot(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 pct({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):cot(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=vI({},n||{}),this.options=Object.assign({arrow:!0},n,t,_lt(n,t));const{when:s}=this.options;this.options.classes=this._getClassOptions(t),this.destroy(),this.id=this.options.id||`step-${MX()}`,s&&Object.keys(s).forEach(r=>{this.on(r,s[r],this)})}_setupElements(){fi(this.el)||this.destroy(),this.el=this._createTooltipContent(),this.options.advanceOn&&Tot(this),xlt(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 gct(e){if(e){const{steps:t}=e;t.forEach(n=>{n.options&&n.options.canClickTarget===!1&&n.options.attachTo&&(ug(n.target)&&n.target.classList.remove("shepherd-target-click-disabled"),n._resolvedExtraHighlightElements&&n._resolvedExtraHighlightElements.forEach(s=>{ug(s)&&s.classList.remove("shepherd-target-click-disabled")}))})}}function mct(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 vct(e){let t,n,s,r,i;return{c(){t=h5("svg"),n=h5("path"),hs(n,"d",e[2]),hs(t,"class",s=`${e[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)},m(a,o){il(a,t,o),pg(t,n),e[11](t),r||(i=t1(t,"touchmove",e[3]),r=!0)},p(a,[o]){o&4&&hs(n,"d",a[2]),o&2&&s!==(s=`${a[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)&&hs(t,"class",s)},i:Na,o:Na,d(a){a&&So(t),e[11](null),r=!1,i()}}}function YX(e){if(!e)return null;const t=e instanceof HTMLElement&&window.getComputedStyle(e).overflowY;return t!=="hidden"&&t!=="visible"&&e.scrollHeight>=e.clientHeight?e:YX(e.parentElement)}function bct(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 xct(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 _ct(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),_()}function f(S=0,C=0,E=0,k=0,F,A,I){if(A){const P=[A,...I||[]];n(4,r=[]);for(const N of P){if(!N||P.indexOf(N)!==P.lastIndexOf(N))continue;const{y:B,height:H}=xct(N,F),{x:O,width:X,left:ee}=N.getBoundingClientRect();P.some(se=>{if(se===N)return!1;const q=se.getBoundingClientRect();return O>=q.left&&O+X<=q.right&&B>=q.top&&B+H<=q.bottom})||r.push({width:X+S*2,height:H+S*2,x:(O||ee)+E-S,y:B+k-S,r:C})}}else u()}function p(S){_(),S.tour.options.useModalOverlay?(w(S),g()):d()}function g(){n(1,i=!0)}const v=S=>{S.preventDefault()},b=S=>{S.stopPropagation()};function x(){window.addEventListener("touchmove",v,{passive:!1})}function _(){a&&(cancelAnimationFrame(a),a=void 0),window.removeEventListener("touchmove",v,{passive:!1})}function w(S){const{modalOverlayOpeningPadding:C,modalOverlayOpeningRadius:E,modalOverlayOpeningXOffset:k=0,modalOverlayOpeningYOffset:F=0}=S.options,A=bct(S.target),I=YX(S.target),P=()=>{a=void 0,f(C,E,k+A.left,F+A.top,I,S.target,S._resolvedExtraHighlightElements),a=requestAnimationFrame(P)};P(),x()}function y(S){gg[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=mct(r))},[s,i,o,b,r,l,u,d,f,p,g,y]}class wct extends tu{constructor(t){super(),eu(this,t,_ct,vct,Zc,{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 yct extends gI{constructor(){super(),this.activeTour=void 0,bI(this)}}class Cct extends gI{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,bI(this);const n={exitOnEsc:!0,keyboardNavigation:!0};return this.options=Object.assign({},n,t),this.classPrefix=PX(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,ah.trigger(r,i)})})(s)}),this._setTourID(t.id),this}addStep(t,n){let s=t;return s instanceof EA?s.tour=this:s=new EA(this,s),fi(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 ah.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()),gct(this),this.trigger(t,{index:n}),ah.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)}ug(this.focusedElBeforeOpen)&&this.focusedElBeforeOpen.focus()}_setupActiveTour(){this.trigger("active",{tour:this}),ah.activeTour=this}setupModal(){this.modal=new wct({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||MX();this.id=`${n}--${s}`}}const ah=new yct,XX=typeof window>"u";ah.Step=XX?Rot:EA;ah.Tour=XX?Aot:Cct;const n1=m.createContext(void 0);n1.Consumer;const Sct=({children:e})=>lot.jsx(n1.Provider,{value:{Shepherd:ah},children:e}),_y=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),kct=e=>_y(e).replace(/"/g,"""),it=e=>_y(h(e)),Ect=['<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(""),Tct=['<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(""),Rct={welcome:Ect,"agent-capabilities":Tct},E5=e=>e.map(t=>"key"in t?_y(h(t.key)):`<code>${_y(t.code)}</code>`).join(""),Act=e=>{const t="<br/>".repeat(e.breaks??0);return e.kind==="paragraph"?`${E5(e.runs)}${t}`:e.kind==="list"?`<ul>${e.items.map(s=>`<li>${E5(s)}</li>`).join("")}</ul>${t}`:`<div class="tour-figure tour-figure-${e.figure}" role="img" aria-label="${kct(h(e.altKey))}">${Rct[e.figure]}</div>${t}`},Sn=e=>e.map(Act).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}]},Fct=e=>{const t=Array.from(document.querySelectorAll(`[data-tour-tag="${e}"]`));return t.find(n=>n.offsetParent!==null)??t[0]??null},T5=e=>{document.querySelector(`[data-tour-action="${e}"]`)?.click()},QX=1340,AI="tour-beside-palette",s1="pre-command-palette-open-canvas",JX='[data-tour-tag="command-palette-dialog"]',_s=e=>Q5(Ym())!=="rtl"?e:e==="left"?"right":"left",Dct=e=>(e.getById(s1)?.options.classes??"").split(" ").includes(AI),ZX=(e,t)=>{const n=e.getById(s1);!n||Dct(e)===t||n.updateStepOptions(t?{attachTo:{element:JX,on:_s("right")},classes:AI}:{attachTo:void 0,classes:void 0})},eQ=e=>{const t=window.innerWidth>=QX;return ZX(e,t),t};let FI=0;const TA=new WeakMap;tt.subscribe((e,t)=>{t.isCommandPaletteOpen&&!e.isCommandPaletteOpen&&(FI+=1)});const tQ=e=>{const t=TA.get(e);return t===void 0||(TA.delete(e),t!==FI)?!1:(tt.getState().closeCommandPalette(),!0)},R5=(e,t)=>{if(!eQ(e)){t();return}const n=tt.getState();n.isCommandPaletteOpen||(n.openCommandPalette(),TA.set(e,FI)),setTimeout(()=>{e.isActive()&&t()},500)},A5=(e,t)=>{if(!tQ(e)){t();return}setTimeout(()=>{e.isActive()&&t()},500)},F5=e=>{const t=e?.step;if(t?.id!==s1)return;(!eQ(t.tour)||document.querySelector(JX)===null)&&ZX(t.tour,!1)},Ict=()=>{const e=window.innerWidth>=QX;return{id:s1,...e?{attachTo:{element:'[data-tour-tag="command-palette-dialog"]',on:_s("right")},classes:AI}:{},title:it("ui.onboarding.tour.pre_command_palette_open_canvas.title"),text:Sn(kn.pre_command_palette_open_canvas),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){A5(this,()=>this.back())}},{text:it("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){A5(this,()=>this.next())}}]}},nQ=()=>[{id:"welcome",title:it("ui.onboarding.tour.welcome.title"),text:Sn(kn.welcome),buttons:[{text:it("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:_s("right")},title:it("ui.onboarding.tour.agent_list.title"),text:Sn(kn.agent_list),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:_s("right")},title:it("ui.onboarding.tour.select_agent.title"),text:Sn(kn.select_agent),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:it("ui.onboarding.tour.chat_input.title"),text:Sn(kn.chat_input),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:it("ui.onboarding.tour.attachments.title"),text:Sn(kn.attachments),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:it("ui.onboarding.tour.agent_capabilities.title"),text:Sn(kn.agent_capabilities),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){R5(this,()=>this.next())}}]},Ict(),{id:"canvas-open-button",attachTo:{element:'button[data-tour-tag="open-canvas-button"]',on:_s("left")},title:it("ui.onboarding.tour.canvas_open_button.title"),text:Sn(kn.canvas_open_button),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){R5(this,()=>this.back())}},{text:it("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:_s("left")},title:it("ui.onboarding.tour.canvas_feature.title"),text:Sn(kn.canvas_feature),buttons:[{text:it("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:it("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:it("ui.onboarding.tour.canvas_documents_view.title"),text:Sn(kn.canvas_documents_view),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:it("ui.onboarding.tour.canvas_files_view.title"),text:Sn(kn.canvas_files_view),buttons:[{text:it("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:it("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:it("ui.onboarding.tour.canvas_variables_view.title"),text:Sn(kn.canvas_variables_view),buttons:[{text:it("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:it("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:_s("right")},title:it("ui.onboarding.tour.agent_options.title"),text:Sn(kn.agent_options),buttons:[{text:it("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:it("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:_s("right")},title:it("ui.onboarding.tour.click_view_settings_from_chat.title"),text:Sn(kn.click_view_settings_from_chat),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:_s("left")},title:it("ui.onboarding.tour.view_agent_settings.title"),text:Sn(kn.view_agent_settings),buttons:[{text:it("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:it("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:_s("left")},title:it("ui.onboarding.tour.select_provider.title"),text:Sn(kn.select_provider),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:_s("left")},title:it("ui.onboarding.tour.select_model.title"),text:Sn(kn.select_model),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:_s("left")},title:it("ui.onboarding.tour.modify_security_prompt.title"),text:Sn(kn.modify_security_prompt),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:_s("left")},title:it("ui.onboarding.tour.modify_agent_prompt.title"),text:Sn(kn.modify_agent_prompt),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:it("ui.onboarding.tour.create_new_agent.title"),text:Sn(kn.create_new_agent),buttons:[{text:it("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:it("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:_s("right")},title:it("ui.onboarding.tour.agent_naming_guidelines.title"),text:Sn(kn.agent_naming_guidelines),buttons:[{text:it("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:it("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:_s("right")},title:it("ui.onboarding.tour.navigate_agent_hub.title"),text:Sn(kn.navigate_agent_hub),buttons:[{text:it("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:it("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:_s("right")},title:it("ui.onboarding.tour.agent_hub_view.title"),text:Sn(kn.agent_hub_view),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:it("ui.onboarding.tour.download_agent.title"),text:Sn(kn.download_agent),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:()=>Fct("upload-to-hub-header-button"),on:"bottom"},title:it("ui.onboarding.tour.upload_agent_hub.title"),text:Sn(kn.upload_agent_hub),buttons:[{text:it("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:it("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){T5("open-upload-dialog"),setTimeout(()=>{this.next()},500)}}]},{id:"upload-agent-hub-dialog",attachTo:{element:'[data-tour-tag="upload-agent-dialog"]',on:_s("right")},title:it("ui.onboarding.tour.upload_agent_hub_dialog.title"),text:Sn(kn.upload_agent_hub_dialog),buttons:[{text:it("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:it("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:_s("right")},title:it("ui.onboarding.tour.navigate_schedules.title"),text:Sn(kn.navigate_schedules),buttons:[{text:it("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(()=>{T5("open-upload-dialog")},500),setTimeout(()=>{this.back()},1e3)}},{text:it("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:it("ui.onboarding.tour.schedules_overview.title"),text:Sn(kn.schedules_overview),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:it("ui.onboarding.tour.create_schedule.title"),text:Sn(kn.create_schedule),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:_s("right")},title:it("ui.onboarding.tour.create_schedule_dialog.title"),text:Sn(kn.create_schedule_dialog),buttons:[{text:it("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:it("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:_s("right")},title:it("ui.onboarding.tour.navigate_settings.title"),text:Sn(kn.navigate_settings),buttons:[{text:it("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:it("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:_s("right")},title:it("ui.onboarding.tour.general_settings.title"),text:Sn(kn.general_settings),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:_s("right")},title:it("ui.onboarding.tour.appearance_settings.title"),text:Sn(kn.appearance_settings),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:_s("right")},title:it("ui.onboarding.tour.radient_account_settings.title"),text:Sn(kn.radient_account_settings),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:_s("right")},title:it("ui.onboarding.tour.integrations_settings.title"),text:Sn(kn.integrations_settings),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("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:_s("right")},title:it("ui.onboarding.tour.application_updates_settings.title"),text:Sn(kn.application_updates_settings),buttons:[{text:it("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:it("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"tour-complete",title:it("ui.onboarding.tour.tour_complete.title"),text:Sn(kn.tour_complete),buttons:[{text:it("ui.onboarding.tour.action.finish"),classes:"shepherd-button-primary",action:function(){this.complete()}}]}],sQ=()=>({enabled:!0,label:h("ui.onboarding.tour.action.close")}),RA=new WeakMap,Pct=(e,t)=>{RA.set(e,t)},Nct=(e,t)=>{if(RA.get(e)===t)return;const n=new Map(nQ().filter(r=>r.id).map(r=>[r.id,r])),s=sQ();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},RA.set(e,t)},D5=new WeakMap,Mct=e=>{const t=D5.get(e);if(t)return t;const n=()=>tQ(e);return D5.set(e,n),n},Oct=()=>{const e=ei(),{completeTourOnboarding:t}=z0(),n=m.useContext(n1),s=Ve(),r={cancelIcon:sQ(),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=Mct(u);u.off("complete",f),u.on("complete",f),u.off("cancel",f),u.on("cancel",f),u.off("show",F5),u.on("show",F5);const p=nQ();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);Pct(u,Ym()),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()&&Nct(o,s)},[s,n]),{startTour:a}},Lct=()=>{const{isModalComplete:e,isTourComplete:t}=z0(),{startTour:n}=Oct(),s=st.useContext(n1),{data:r}=RT(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},Bct=({children:e})=>c.jsxs(Sct,{children:[e,c.jsx(Lct,{})]}),jct=()=>{Ve();const{open:e,focusGroup:t,providerId:n,closeConnect:s}=V8(),r=m.useRef(null);m.useEffect(()=>{e&&(r.current=document.activeElement instanceof HTMLElement?document.activeElement:null)},[e]);const i=ei();return c.jsx(Wc,{open:e,onOpenChange:a=>{a||s()},children:c.jsxs(zc,{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(AX,{context:"dialog",featuredOnly:!0,focusGroup:t,initialProviderId:n,onDone:s,onChangeModel:()=>{s(),i("/settings")}}):null]})})};function Hct(){const{visible:e,rows:t,cursor:n,commitAt:s,hoverAt:r}=Ile();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:[rQ(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(Vct,{row:o,active:l===n,onCommit:()=>s(l),onHover:()=>r(l)},o.sessionId))})}),document.body):null]})}function rQ(e){return e.title??h("ui.command_palette.palette_search.untitled_chat")}const Uct=1e3;function Gct(){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,Uct),window.addEventListener("contextmenu",n,!0),window.addEventListener("pointerup",t,!0)}function Vct({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(),Gct(),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:rQ(e)})]})}const iQ=({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})]}),pgt=({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})]}),ggt=({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 aQ({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:x,focusKey:_}){const w=m.useRef(!1);return m.useEffect(()=>{if(_!==s||w.current)return;const y=l.current;y&&(w.current=!0,y.scrollIntoView?.({block:"center"}),y.focus())},[_,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(Ts,{ref:l,id:e,"aria-label":a,"aria-describedby":`${e}-hint ${e}-notes ${e}-status`,"aria-invalid":x?!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"):x?c.jsx("span",{className:"text-danger",children:x}):null})]})]})}function oQ({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 nt(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 Gi){const x=v.detail;typeof x=="object"&&x!==null&&"code"in x&&x.code==="keymap.conflict"&&"label"in x&&typeof x.label=="string"&&(b=h("ui.settings.shortcuts.capture.already_assigned",{label:x.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 lQ(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 Wct(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 zct(e,t,n,s){for(const r of["AltRight","ControlRight","MetaRight"]){const i=Y8(r,t);if(i===null)continue;const a=jd(i);if(!(!a||a.code===e)&&!lQ(r,t,n,s))return a.label}return null}const $ct=/^(Alt|Meta|Control|Shift)(Left|Right)$/,gE=e=>e.split("-").slice(1).join("-");function qct({setting:e,refetch:t,focusKey:n}){const s=_2(),r=tt(F=>F.shortcutBindings),i=m.useRef(null),a=m.useId(),o=m.useMemo(()=>Toe(),[]),l=m.useRef(null),u=typeof e.default=="string"?e.default:IN,{saving:d,error:f,setError:p,write:g}=oQ({settingKey:e.key,refetch:t,fieldRef:i,onSaved:(F,A)=>Roe(F==="settings.edit"?A:u)}),v=h("ui.settings.shortcuts.speech.push_to_talk_hold"),b=typeof e.value=="string"?e.value:"",x=jd(b)??jd(u)??jd(IN),_=jd(b)?.code===jd(u)?.code,w=Ey.flatMap(F=>{const A=VA(F.id,r);return A?[A]:[]}),y=s.canonical?[s.canonical]:[],S=x===null?null:lQ(x.code,o,w,y),C=S===null||x===null?null:zct(x.code,o,w,y),E=h("ui.settings.shortcuts.speech.push_to_talk_letter_pointer"),k=()=>p(h("ui.settings.shortcuts.speech.push_to_talk_refused",{platform:o}));return c.jsx(aQ,{id:a,rank:"secondary",action:v,settingKey:e.key,focusKey:n,help:e.help,hint:`${h("ui.settings.shortcuts.speech.push_to_talk_hint")} ${E}`,ariaLabel:h("ui.settings.configuration.setting_control.label_press_the_key_you_want",{label:v}),value:x?.label??"",fieldRef:i,saving:d,showReset:!_,onReset:()=>void g("settings.reset"),onBlur:()=>{l.current=null,p(null)},onKeyDown:F=>{if(d)return;if(F.repeat||F.nativeEvent.isComposing){VE.has(F.key)||F.preventDefault();return}const A=l.current!==null;if(l.current&&(l.current.tainted=!0),VE.has(F.key)){A&&k();return}if(U_.has(F.key)){l.current=null,p(null),F.preventDefault();return}if(F.preventDefault(),A||!$ct.test(F.code)){A||(l.current=null),k();return}p(null),l.current={code:F.code,tainted:!1}},onKeyUp:F=>{const A=l.current;if(!A||F.code!==A.code||(l.current=null,A.tainted||d))return;const I=Y8(A.code,o);if(I===null){k();return}jd(I)?.code!==x?.code&&g("settings.edit",I)},notes:S!==null&&x!==null&&c.jsx("p",{children:h("ui.settings.shortcuts.speech.push_to_talk_overlap",{modifier:gE(x.label),example:Wct(S,gE(x.label),o),alternative:C?gE(C):"none"})}),error:f})}function Kct({setting:e,refetch:t,focusKey:n}){const s=m.useRef(!1),r=_2(),i=m.useRef(null),a=m.useId(),o=m.useMemo(()=>xg(),[]),{saving:l,error:u,setError:d,write:f}=oQ({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:Aoe,x=Vb(g)===Vb(b),_=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(aQ,{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:_H(v,o),fieldRef:i,saving:l,showReset:!x,onReset:()=>void f("settings.reset"),onKeyUp:S=>{!Fm.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&&Fm.has(S.key)){S.preventDefault();return}if(s.current=Fm.has(S.key),U_.has(S.key)||Fm.has(S.key)){U_.has(S.key)&&d(null),S.preventDefault();return}const C=w2(S);if(C===null)return;if(S.preventDefault(),Vb(C)===Vb(g)){d(null);return}const E=tt.getState().shortcutBindings,k=X8(r,_(w));for(const A of Ey){const I=E[A.id]??A.defaultChord;I&&k.set(I,A.label)}const F=wH(C,"panel.console",{},o,k);if(F!==null){d(F);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 Yct({focusKey:e}){const{client:t,provided:n}=Oee(),s=Ln({queryKey:Yo.settings,queryFn:()=>nt({op:"settings.list"}),enabled:n,staleTime:1e4},t),r=l=>s.data?.settings.find(u=>u.key===l),i=r(Foe),a=r(Doe);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(Kct,{setting:i,refetch:s.refetch,focusKey:e}),a&&c.jsx(qct,{setting:a,refetch:s.refetch,focusKey:e})]})}const cQ=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")}},Xct=()=>h("ui.chat.composer.start_recording");function Qct(){m.useEffect(()=>{let e=0;const t=()=>{const r=tt.getState().shortcutBindings,i=new Map(Lee);for(const a of Ey){const o=VA(a.id,r);if(!o)continue;const l=cQ(a);for(const u of Ioe(o,xg()))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=mJ(t);return()=>{n(),s()}},[])}const Jct=({action:e})=>{const t=_2(),n=X8(t,Xct());Ve();const s=m.useId(),r=m.useRef(null),i=tt(x=>x.shortcutBindings),a=i[e.id],o=tt(x=>x.setShortcutBinding),l=tt(x=>x.clearShortcutBinding),[u,d]=m.useState(!1),[f,p]=m.useState(null),g=m.useMemo(xg,[]),v=VA(e.id,i),b=cQ(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(Ts,{id:s,readOnly:!0,value:v===null?h("ui.settings.shortcuts.keyboard_shortcuts_section.no_shortcut"):_H(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:x=>{if(VE.has(x.key))return;if(U_.has(x.key)){d(!1),p(null);return}if(Fm.has(x.key)||x.nativeEvent.isComposing)return;const _=w2({key:x.key,code:x.code,metaKey:x.metaKey,ctrlKey:x.ctrlKey,altKey:x.altKey,shiftKey:x.shiftKey}),w=wH(_,e.id,i,g,n);if(w!==null){x.preventDefault(),d(!0),p(w);return}if(_===v){d(!0),p(null);return}x.preventDefault(),d(!0),p(null),_===e.defaultChord?o(e.id,null,n):_!==null&&o(e.id,_,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})]})},mgt=({sectionRef:e,focusKey:t})=>(Ve(),c.jsx(iQ,{title:h("ui.settings.shortcuts.keyboard_shortcuts_section.keyboard_shortcuts"),icon:EG,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(Yct,{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(Jct,{action:n},n.id))})]})}));async function Zct(e){await nt({op:"settings.edit",key:Tl,value:e.value}),Moe(e.queryClient)}async function uQ(e){await Zct(e),e.queryClient.setQueryData(G_.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:G_.all,queryFn:()=>nt({op:"settings.list"}),staleTime:0,retry:!1}),"confirmed"}catch{return"readback-unknown"}}const vgt=({focus:e=!1,focusNonce:t})=>{Ve();const n=Pt(),s=Yn(),r=vt(s.data,"settings"),i=Ln({queryKey:G_.all,queryFn:()=>nt({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),x=m.useRef(null),_=m.useRef(!1),w=m.useRef(t);m.useEffect(()=>{t!==w.current&&(w.current=t,_.current=!1)},[t]),m.useEffect(()=>{if(!e){_.current=!1;return}!a||_.current||(x.current?.querySelector("[role=combobox]")?.focus(),_.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(P=>P.value===I))){b.current=!0,l(!0),d(null),v(!1);try{const P=await uQ({value:I,queryClient:n});p(P==="readback-unknown"),v(P==="confirmed")}catch(P){d({value:I,message:P instanceof Error?P.message:""})}finally{b.current=!1,l(!1)}}},S=async()=>{const[I,P]=await Promise.all([i.refetch(),s.refetch()]);!I.isError&&!P.isError&&p(!1)},C=!i.data&&i.error||!s.data&&s.error,E=s.data&&(!r||i.data&&!a),k=!C&&!E&&!a,F=s.data?.features?.i18n?s.data.language:void 0,A=typeof F=="string"&&F!==""?F:void 0;return c.jsx(iQ,{title:h("ui.settings.language.dialog.title"),icon:TG,description:h("ui.settings.language.general.description"),children:c.jsxs("div",{ref:x,"data-setting-key":Tl,"data-search-row":"general.language","data-search-control":!0,className:"flex flex-col gap-3","aria-busy":o,children:[k&&c.jsx("output",{className:"text-meta text-ink-dim",children:h("ui.settings.language.dialog.loading")}),E&&c.jsx("p",{className:"text-meta text-ink-dim",children:h("ui.settings.language.dialog.unavailable")}),a&&c.jsx(Q8,{setting:{...b2(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:Poe(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"):A?h(f||s.error?"ui.settings.language.general.last_known":"ui.settings.language.general.effective",{locale:Noe(A)?.name??A}):h("ui.settings.language.general.no_resolution")}),(C||u||f)&&c.jsx(xr,{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")})]})})]})})},eut=()=>{Ve();const e=C_(O=>O.open),t=C_(O=>O.closeLanguage),n=Pt(),s=Yn(),r=vt(s.data,"settings"),i=Ln({queryKey:G_.all,queryFn:()=>nt({op:"settings.list"}),enabled:e&&r,staleTime:1e4}),a=m.useRef(null),o=A8(),l=(i.data?.settings??[]).find(O=>O.key===Tl),u=l?b2(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 O=>{if(!(!u||w.current||x||!u.choices.some(X=>X.value===O))){w.current=!0,f(!0),b(null),g(!1);try{const X=await uQ({value:O,queryClient:n});_(X==="readback-unknown"),g(X==="confirmed")}catch(X){const ee=X instanceof Error?X.message:"";b({value:O,message:ee}),C_.getState().open||fn(h("ui.settings.language.general.write_error",{message:ee}))}finally{w.current=!1,f(!1)}}},C=async()=>{const[O,X]=await Promise.all([i.refetch(),s.refetch()]);!O.isError&&!X.isError&&_(!1)},E=!!s.data,k=E&&!r,F=s.error&&!s.data?s.error:null,A=F??(i.data?null:i.error),I=!E&&!A,{sentence:P,remedy:N}=Bee(o??null,h("ui.settings.configuration.language_dialog.your_settings_could_not_be_loaded"),A),B=s.isFetching||i.isFetching,H=u?"combo":A?"retry":"none";return m.useEffect(()=>{!e||H==="none"||requestAnimationFrame(()=>{a.current?.querySelector(H==="combo"?'[role="combobox"]':"[data-language-retry]")?.focus()})},[e,H]),c.jsx(Wc,{open:e,onOpenChange:O=>!O&&t(),children:c.jsxs(zc,{ref:a,onOpenAutoFocus:O=>O.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(On,{}),h("ui.settings.language.dialog.loading")]}):k?c.jsx(xr,{variant:"warning",children:c.jsx("span",{children:h("ui.settings.language.dialog.unavailable")})}):A?c.jsx(xr,{variant:"warning",children:c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("span",{children:P}),N&&c.jsx(ue,{variant:"tonal",size:"sm",className:"shrink-0","data-language-retry":"",onClick:()=>{F?s.refetch():i.refetch()},disabled:B,children:B?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(On,{}),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:PN(Tl),className:"text-meta text-ink-dim",children:u.help}),c.jsx(Q8,{setting:u,value:y,disabled:d||x,helpId:PN(Tl),effectiveNoteId:Ooe(Tl,Loe),onValueChange:O=>{S(O)}})]}),v&&c.jsx(xr,{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")})]})}),x&&c.jsx(xr,{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(xr,{variant:"warning",children:c.jsx("span",{children:h("ui.settings.language.dialog.unavailable")})})]})})},I5=e=>{const t=Hoe(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})},dQ=e=>joe({type:e.type,version:e.offer.version}),tut=e=>{const t=e.map(s=>dQ(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})},nut=({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:I5(t),children:c.jsx("output",{"data-update-foot-icon":"","data-update-foot-icon-state":"inflight","aria-label":I5(t),className:"flex size-8 shrink-0 items-center justify-center text-accent",children:c.jsx(Li,{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:[dQ(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":tut(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(c2,{className:"size-4 shrink-0","aria-hidden":"true"})})})},hQ=()=>{const e=Ir(g=>g.followed),t=Ir(g=>g.running),n=Ir(g=>g.offers),s=Ir(g=>g.detailOpen),r=Ir(g=>g.inflight),i=Ir(g=>g.downloadPercent),a=Ir(g=>g.openNotice),o=Ir(g=>g.noticeOpen),l=Ir(g=>g.dismissNotice),u=m.useMemo(()=>{const g={followed:e,running:t,offers:n,detailOpen:s};return FH.filter(v=>Boe(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[Pn.BACKEND]?{type:Pn.BACKEND,percent:null}:r[Pn.UI]?{type:Pn.UI,percent:i[Pn.UI]}:null,[r,i]),f=m.useCallback(()=>a(),[a]),p=m.useCallback(()=>l(),[l]);return c.jsx(nut,{surfaces:u,inflight:d,onShow:f,onDismiss:o?p:void 0})},fQ="px-2",AA=new WeakMap,sut=64,rut=1024*1024,iut=3e3;function aut(e){const t=AA.get(e);if(t)return t;const n=new Map;AA.set(e,n);let s=gp(e);return m2(e,()=>{const r=gp(e);if(r===s)return;s=r;const i=[...n.values()];n.clear();for(const a of i){a.url&&H_(a.url),a.url=void 0;for(const o of a.listeners)o()}}),n}function out(e){if(e.size<sut)return!0;for(const[t,n]of e)if(!(n.listeners.size||n.promise))return n.url&&H_(n.url),e.delete(t),!0;return!1}const lut=uX;function bgt(e,t){const n=pQ(t),s=cut(),r=e?hX(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 gQ(u,n)}function pQ(e){return Uoe(e,Goe())}function cut(){return O8("team_bridge_endpoint_avatar")}const uut=/^(?: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})$/,dut=/^[0-9a-f]{16}$/;function hut(e){const t=e?.id,n=e?.profile?.avatar;if(!t||!uut.test(t)||!n||!n.hash||!dut.test(n.hash)||n.source==="none")return null;if(e.avatar_url){const s=lut.exec(e.avatar_url);if(!s||s[1]!==t||s[2]!==n.hash)return null}return{accountId:t,hash:n.hash}}function fut(e,t){const n=yg(),s=e?.id,r=e?.profile?.avatar?.hash,i=e?.profile?.avatar?.source,a=e?.avatar_url,o=m.useMemo(()=>hut({id:s,avatar_url:a,profile:{avatar:{hash:r,source:i}}}),[s,r,i,a]);return put(o&&o.accountId===n.accountId?o:null,t,{retryOnce:!0})}function put(e,t,n={}){const s=pQ(t),r=m.useMemo(()=>e?{type:"account",...e}:null,[e]);return gQ(r,s,n)}function gQ(e,t,n={}){const s=n.retryOnce===!0,r=Pt(),i=yg(),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=aut(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"?Jn.endpointAvatarBytes({expectedAccountId:g,endpointId:e.endpointId,hash:e.hash,size:t}):Jn.avatarBytes({expectedAccountId:g,accountId:e.accountId,hash:e.hash,size:t})).then(({data:w,mimeType:y})=>{if(u.get(a)!==f)return;const S=Zr(r);if(S.epoch!==p||S.accountId!==g){u.delete(a);return}if(!["image/png","image/jpeg"].includes(y)||w.byteLength===0||w.byteLength>rut)throw new Error("Invalid avatar bytes");f.url=_8(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(!out(u))return;u.set(a,f),v()}let b=!1;const x=()=>{!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=Zr(r);w.epoch!==p||w.accountId!==g||v()},iut))};u.delete(a),u.set(a,f);const _=()=>{x(),l.current&&o(w=>w+1)};return f.listeners.add(_),x(),()=>{f.listeners.delete(_),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 AA.get(r)?.get(a)?.url}const DI=st.memo(({expanded:e,useAuth:t=!1})=>{const n=Ny(),s=ei(),{user:r,isAuthenticated:i,accountRead:a,signOut:o}=Qy(),l=a==="checking"?h("ui.shell.user_profile_sidebar.checking_account"):NN(a)?h("ui.shell.user_profile_sidebar.account_unavailable"):null,u=r?.name??l??h("ui.shell.user_profile_sidebar.user"),d=NN(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]),x=m.useMemo(()=>{const S=r?.name;return S?S.split(" ").map(C=>C.charAt(0)).join("").toUpperCase().substring(0,2):null},[r?.name]),_=fut(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(TH,{className:"size-7 shrink-0 rounded-full bg-media-surface",children:[_&&c.jsx(Dy,{src:_,alt:"",className:"lo-avatar-arrival"}),c.jsx(Iy,{className:"rounded-full bg-media-surface text-ink-muted",children:x??c.jsx(PG,{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(vo,{asChild:!0,children:w}):c.jsx(Iu,{content:v,side:n==="rtl"?"left":"right",children:c.jsx(vo,{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(SH,{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(Zhe,{size:16,"aria-hidden":"true"}),h("ui.shell.user_profile_sidebar.privacy_and_security")]}),c.jsx(Hr,{}),c.jsxs(on,{onSelect:b,className:"text-danger focus:bg-danger-wash focus:text-danger",children:[c.jsx(Ehe,{size:16,"aria-hidden":"true"}),h("ui.shell.user_profile_sidebar.sign_out")]})]})]}):y});DI.displayName="UserProfileSidebar";const mQ=()=>{const e=ei(),t=s9();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"})})})},vQ=()=>c.jsxs("div",{className:R("flex min-h-10 shrink-0 items-center justify-between gap-1 pb-2",fQ),children:[c.jsx(DI,{expanded:!0}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(hQ,{}),c.jsx(mQ,{})]})]});function bQ(e){return Ie(t=>jee(t.sessions,e))}const gut=[];function xQ(){const{state:e}=cC(),t=e?.pendingConsent??gut,n=w9(s=>GO(t,s));return m.useEffect(()=>{t.length>0&&X2()},[t]),GO(t,n)}const _Q={approvals:["desktop","mesh","approvals"]},mut=15e3,vut=new Set(["requested","approved","connecting","failed"]);function but(e){return vut.has(e)}function xut(e){return e==="requested"}function wQ(e){return e.filter(t=>xut(t.state)).length}function _ut(e){return KP.test(e.requestDigest)&&KP.test(e.disclosureDigest)}function II(e){return e.kind==="credential"&&e.typed!==void 0&&e.typed.action==="approve-credential"&&e.typed.operation!==null&&_ut(e.typed)}function mE(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===WA:e.kind==="credential"?t&&II(e)&&e.typed.signableHere&&e.typed.disclosure?.operation===e.typed.operation:e.canApproveHere!==!1&&(e.kind==="device"||e.kind==="machine")}function wut(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 yut(e,{credentialApprovals:t=!1}={},n){return t&&II(e)&&(e.state==="approved"||e.state==="failed")&&(n??e.typed.applyOutcome?.retryable===!0)}function xgt(e,t,n={},s){const r=e.approvalId;return t==="deny"?{op:"approvals.deny",approvalId:r}:e.kind==="profile"?!(t==="approve"?mE(e,n):wut(e,n,s))||!e.profile?null:{op:t==="approve"?"approvals.approveOperation":"approvals.applyOperation",approvalId:r,operation:WA,requestDigest:e.profile.request_digest,disclosureDigest:e.profile.disclosure_digest??""}:e.kind==="device"||e.kind==="machine"?t==="approve"&&mE(e,n)?{op:"approvals.approve",approvalId:r}:null:!(t==="approve"?mE(e,n):yut(e,n,s))||!II(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 _gt(e){return but(e)}function wgt(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 Br(e){return typeof e=="object"&&e!==null}function Cut(e){const t=Br(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 P5(e){return typeof e=="string"?e:""}function yQ(e){return Gee.includes(e)?e:null}function Sut(e){if(!Br(e))return null;const t=yQ(e.operation);if(t===null)return null;const n=Br(e.recipient)?e.recipient:{},s=Br(e.grant_lifetime)?e.grant_lifetime:{},r=Br(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 CQ(e){return Br(e)?{code:rn(e.code),retryable:e.retryable===!0,reason:rn(e.reason),remedy:rn(e.remedy)}:null}function kut(e){if(Br(e))return{action:rn(e.action),operation:yQ(e.operation),requestDigest:P5(e.request_digest),disclosureDigest:P5(e.disclosure_digest),disclosure:Sut(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:CQ(e.apply_outcome),...Br(e.upgrade)?{upgrade:{...e.upgrade}}:{}}}function Eut(e){const t=Br(e)?e:{};return{connect:T1(t.connect,!1),install:T1(t.install,!1),anchor:Br(t.anchor),networkId:rn(t.network_id),role:rn(t.role),unattended:T1(t.unattended,!1),grants:yE(t.grant)}}function Tut(e){const t=Array.isArray(e)?e:e?.approvals??[];if(!Array.isArray(t))return[];const n=[];for(const s of t){if(!Br(s))continue;const r=rn(s.approval_id),i=rn(s.state);if(!r||!i)continue;const a=kut(s.typed_approval),o=Hee(s.typed_approval),l=Br(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===WA?"profile":l||u==="credential_inheritance"?"credential":u!==void 0&&!["device_onboard","local_authority"].includes(u)?"unknown":!Br(s.device)&&Br(s.machine)?"machine":"device",f=Br(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:Cut(d==="machine"?s.machine:s.device),what:Eut(s.what),requestedBy:{surface:rn(f.surface),sessionId:rn(f.session_id),deviceId:rn(f.device_id)},expiresAt:Uee(s.expires_at),...a&&d==="credential"?{typed:a}:{},...o&&d==="profile"?{profile:o}:{}})}return n}function Rut(e){return e.kind==="machine"?h("ui.mesh.mesh_approvals.this_machine"):F_({device_id:e.where.deviceId,name:e.where.name})}function ygt(e,t){if(e.kind==="credential"||e.kind==="unknown"||e.canApproveHere===!1){const r=PI(e);if(r)return r;if(e.summary)return e.summary;if(e.kind==="credential"||e.kind==="unknown")return N5(e)}const n=N5(e),s=Iut(e,t).map(r=>r.clause);return s.length?h("ui.mesh.mesh_approvals.approval_title_with_clauses",{head:n,clauses:Dut(s)}):h("ui.mesh.mesh_approvals.approval_title",{head:n})}function N5(e){return e.kind==="credential"?PI(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:Rut(e)})}function Cgt(e){return e.summary?e.kind==="credential"?PI(e)===null:e.kind==="unknown"||e.canApproveHere===!1:!1}const Aut={github:"GitHub",gitlab:"GitLab"};function M5(e){return Aut[e.toLowerCase()]??e}function SQ(e){const t=e.typed?.disclosure?.recipient;return F_({device_id:t?.deviceId??"",name:t?.name??""})}function PI(e){const t=e.kind==="credential"?e.typed?.disclosure:null;if(!t)return null;const n=SQ(e);return t.operation==="credential_finite_share"?h("ui.mesh.approval.head_finite_share",{credential:M5(t.credentialKey),device:n}):h("ui.mesh.approval.head_inheritance",{provider:M5(t.provider),account:t.account,device:n})}function Fut(e){const t=e.kind==="credential"?e.typed?.disclosure:null;if(!t)return[];const n=SQ(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 Dut(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 Sgt(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 kgt(e){return e.kind==="credential"||e.kind==="unknown"?null:e.where.hostKeyFp||null}function Egt(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 Iut(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 Put(l,o)){const f=Nut()[d];u.push({term:f?.term??h("ui.mesh.mesh_approvals.grant_capability",{grant:d}),clause:Mut()[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 Put(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 Nut=()=>({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")}}),Mut=()=>({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 Tgt(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 Rgt(e,t){return e.kind==="credential"&&(e.state==="approved"||e.state==="failed")&&(t??e.typed?.applyOutcome?.retryable)===!1}function Agt(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 Fgt(e){const t=e.typed?.disclosure;if(!t)return"";const n=Fut(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 kQ(e,{poll:t=!0}={}){return Ln({queryKey:_Q.approvals,enabled:e,queryFn:async()=>Tut(await nt({op:"approvals.list"})),retry:!1,staleTime:t?1e4:Number.POSITIVE_INFINITY,refetchInterval:e&&t?mut:!1,refetchOnWindowFocus:t})}function Out(){return{retry:!1,mutationFn:async e=>{const t=await nt(e.request);if(e.request.op==="approvals.approveCredential"){const n=Lut(t);if(n)throw n}}}}function Dgt(){const e=Pt();return pn({...Out(),onSettled:()=>{e.invalidateQueries({queryKey:_Q.approvals}),e.invalidateQueries({queryKey:Lc.networks}),e.invalidateQueries({queryKey:Lc.peers})}})}function Igt(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 Pgt(e){const t=e,n=CQ(t?.applyOutcome??(Br(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 Lut(e){const t=Br(e)?e.applied:void 0;return!Br(t)||t.ok!==!1?null:{code:rn(t.code),message:rn(t.message),applyOutcome:t}}const But=/(\{request\}|\{reason\})/;function Ngt(e,t){return h("ui.mesh.approval.named_refusal",{request:"{request}",reason:"{reason}"}).split(But).filter(Boolean).map(n=>n==="{request}"?{kind:"request",text:e}:n==="{reason}"?{kind:"reason",text:t}:{kind:"literal",text:n})}function Mgt(e,t,n=!1){return e==="request"&&!n?t:"auto"}function Ogt({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=Yn(),t=vt(e.data,"aida",1),n=Kh(t),s=t&&n.data?.enabled===!0,r=bQ(n.data?.session_id),i=vt(e.data,"notifications",1),a=J8(i),o=xQ(),l=fC(wr(e.data,"peers")==="enabled"),u=kQ(l==="member"&&wr(e.data,"approvals")==="enabled",{poll:!0}),d=s?r:0,f=i?Z8(a.data):0,p=l==="member"?wQ(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 Hut(e){const t=typeof e=="object"&&e!==null?e.idx:void 0;return typeof t=="number"&&t>0?"history":"/chat"}const Uut=()=>{Ve();const e=ei(),t=Ny()==="rtl"?By:_G,[n,s]=m.useState(!1),{total:r,lines:i}=jut(),a=W_("back",Ple.test(navigator.platform)),o=r>0?h("ui.teamBridge.leave.name_attention",{count:r}):h("ui.teamBridge.leave.name"),l=m.useCallback(()=>{Hut(window.history.state)==="history"?e(-1):e("/chat")},[e]);return m.useEffect(()=>{const u=f=>{iU(f)==="back"&&(f.preventDefault(),l())},d=f=>{aU(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",fQ),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:Oi(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(sp,{count:r,"aria-hidden":"true",className:"ms-1"})]})})})},Gut=({children:e,inline:t})=>c.jsxs(Voe,{fallback:t,children:[c.jsx(Uut,{}),e,c.jsx(vQ,{})]}),Vut=()=>(Ve(),c.jsxs(Gut,{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"})]})),Wut=140,zut=/^\s*(```|~~~).*$/gm,$ut=/^\s{0,3}#{1,6}\s+/gm,qut=/^\s{0,3}(>\s?)+/gm,Kut=/^\s*([-*+]|\d{1,9}[.)])\s+/gm,Yut=/^\[[ xX]\]\s+/gm,Xut=/^\s{0,3}([-*_])(\s*\1){2,}\s*$/gm,Qut=/!\[([^\]]*)\]\([^)]*\)/g,Jut=/\[([^\]]+)\]\([^)]*\)/g,Zut=/<((?:https?|mailto):[^>\s]+)>/gi,edt=/<\/?[A-Za-z][^>]*>/g,tdt=/`+([^`]*)`+/g,ndt=/(\*\*|__)(?=\S)([\s\S]*?\S)\1/g,sdt=/~~(?=\S)([\s\S]*?\S)~~/g,rdt=/(^|[^\w*])\*(?=\S)([^*]*?\S)\*(?!\w)/g,idt=/(^|[^\w])_(?=\S)([^_]*?\S)_(?!\w)/g;function adt(e,t=Wut){if(typeof e!="string"||e.trim().length===0)return null;const n=e.replace(zut," ").replace(Xut," ").replace($ut,"").replace(qut,"").replace(Kut,"").replace(Yut,"").replace(Qut,"$1").replace(Jut,"$1").replace(Zut,"$1").replace(edt,"").replace(tdt,"$1").replace(ndt,"$2").replace(sdt,"$1").replace(rdt,"$1$2").replace(idt,"$1$2"),s=jp(n,Number.MAX_SAFE_INTEGER);return s.length===0?null:TX(s,t)}function odt(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:jp(n,Gv)||t.untitled,subtitle:jp(r,wit)||t.untitled,body:jp(a,_it)||t.fallback}}const Em=3e4,ldt=10;function cdt(e,t=ldt){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 udt(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 EQ(e,t){return udt(e,t)&&M8(e)==="all"&&e.builtin!=="agents"}function ddt(e,t,n){return{conversationName:g2(e,t),organizationName:H8(e,n),senderLabel:p2(e.last_sender_label??"")}}function hdt(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),EQ(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,...ddt(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 NI(e,t,n,s){return e.getMutationCache().findAll({mutationKey:Gt.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 fdt(e,t,n,s,r){return new Promise(i=>{const a=()=>{l(),r.removeEventListener("abort",a),i()},o=()=>{(r.aborted||!NI(e,t,n,s))&&a()},l=e.getMutationCache().subscribe(o);r.addEventListener("abort",a,{once:!0}),o()})}function Lgt(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 TQ(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 Bgt(e,t,n,s){return TQ(await Jn.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 T_=null;function pdt(){return T_}function Hgt(e){m.useEffect(()=>{const t=e??null;return T_=t,()=>{T_===t&&(T_=null)}},[e])}const gdt="display.notifications";function mdt(){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 vdt(e){return e.kind==="dm"?{kind:"dm"}:{kind:e.kind,name:e.name}}function bdt(e,t){return irt(e,t==="person_agent"?"agent":"human")}function FA(e,t){const n=hX(bdt(e,t)).src,s=n?.type==="account"?n:null,r=n?.type==="endpoint"?n:null;return Tit({v:1,kind:t,account_id:e.account_id,display_name:jp(e.display_label,Gv),agent_name:jp(e.agent?.name??"",Gv),...s?{avatar:{account_id:s.accountId,hash:s.hash}}:{},...r?{endpoint_avatar:{endpoint_id:r.endpointId,hash:r.hash}}:{}})}function xdt(e,t,n){return e.getQueryData(Gt.directory(t,n))?.members??[]}function _dt(e,t,n,s){const r=Gt.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 wdt(e,t,n,s){return{...uI(e,t,n,s),staleTime:0}}async function ydt(e,t,n,s,r){if(!s())return;let i=t.senderLabel,a,o=null,l;const u=Zr(e);if(u.accountId!==n)return;const d={accountId:n,epoch:u.epoch},f=t.threadId;try{let b;if(f)b=TQ(await Jn.listReplies(t.conversationId,f,{tenantId:t.tenantId,accountId:n,afterSeq:t.seq,limit:1}),{tenantId:t.tenantId,conversationId:t.conversationId,rootId:f}).replies.find(x=>x.seq===t.seq),b&&s()&&_dt(e,t,f,b);else{const x=()=>e.fetchQuery(wdt(e,t.conversationId,t.tenantId,n));b=(await x().catch(w=>{if(!Vee(w))throw w;return x()})).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 x=xdt(e,t.tenantId,n);i=zoe(b.sender,x,{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);_&&(b.sender.kind==="human"||b.sender.kind==="agent")&&(a=FA(_,b.sender.kind==="human"?"person":"person_agent")),o=adt(b.body)}}catch{}const p=window.api?.desktop?.teamBridge;if(!p)return;const g=odt({senderLabel:i,conversationName:t.conversationName,place:vdt(t),organizationName:t.organizationName,preview:o,unreadCount:t.unreadCount},mdt());for(;NI(e,d,t.conversationId,t.tenantId);)if(await fdt(e,d,t.conversationId,t.tenantId,r),r.aborted||!s())return;if(r.aborted||!s())return;const v=e.getQueryData(Gt.conversations(Oc,n))?.conversations.find(b=>b.id===t.conversationId&&b.tenant_id===t.tenantId);!v||!EQ(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:pdt()===t.conversationId}).catch(()=>{})}function Cdt(e,t,n,s,r){Jst(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=uI(e,i.conversation_id,n,t);e.getQueryState(l.queryKey)?.data!==void 0&&e.fetchQuery({...l,staleTime:0}).catch(()=>{})}}function Sdt(e){const t=!!window.api?.desktop?.teamBridge,n=KC(),s=dI(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=Pt(),l=jle({filters:{mutationKey:Gt.notifyMutation(r,n.epoch),exact:!0,status:"pending"},select:L=>L.mutationId});m.useLayoutEffect(()=>{const L=window.api?.desktop?.teamBridge;if(!L?.setAuthority)return;const W=()=>{L.setAuthority({...Zr(o),settling:v2(o)}).catch(()=>{})},j=m2(o,W);return W(),j},[o]);const u=eI({enabled:a}),d=Yn(),f=vt(d.data,"settings"),p=Ln({...BH(),enabled:a&&f}),g=f&&Woe(p.data?.settings,gdt)===!1,v=m.useRef(g);v.current=g;const b=m.useRef(r);b.current=r;const x=m.useRef(a);x.current=a;const _=m.useRef(new AbortController);m.useEffect(()=>{const L=new AbortController;return _.current=L,(!a||g||n.token!==gp(o))&&L.abort(),()=>L.abort()},[a,g,n.token,o]),m.useEffect(()=>(x.current=a,()=>{x.current=!1}),[a]);const w=u.data,y=CX(a,Oc,{accountId:r,refetchInterval:Em,refetchIntervalInBackground:!0}),S=m.useMemo(()=>cdt(y.data),[y.data]),C=oU({queries:S.map(L=>{const W=UE(L.tenant_id);return{queryKey:Gt.unread(W,r??"unresolved-owner"),queryFn:()=>Ul(o,r,()=>Jn.unread({tenantId:W})),enabled:a,staleTime:Em,refetchInterval:Em,refetchIntervalInBackground:!0,refetchOnWindowFocus:!0,retry:1}})}),E=C.map(L=>`${L.status}:${L.dataUpdatedAt}`).join("|"),k=m.useRef(C);k.current=C;const F=m.useRef(S);F.current=S;const I=yX(S.map(L=>UE(L.tenant_id)),a,r).members,P={};for(const[L,W]of Object.entries(I))P[L]=W.filter(j=>j.account_id!==r).flatMap(j=>[FA(j,"person"),...j.agent?.name?[FA(j,"person_agent")]:[]]).filter(j=>j!==void 0);const N=JSON.stringify(P),B=m.useRef(P);B.current=P;const H=m.useRef(null),O=m.useRef(new Set),X=Ln({queryKey:Gt.conversations(Oc,r??"unresolved-owner"),queryFn:()=>Ul(o,r,()=>Jn.listConversations("account")),enabled:a,staleTime:Em,refetchInterval:Em,refetchIntervalInBackground:!0,refetchOnWindowFocus:!0,retry:1}),ee=m.useRef(new Map),se=m.useRef(new Map),q=m.useRef(new Set),ne=m.useRef(void 0),te=m.useRef(null),M=[a,g,l.join(","),E,y.dataUpdatedAt,X.dataUpdatedAt,(w?.memberships??[]).map(L=>`${L.tenant_id}:${L.tenant_name}`).join(","),r??""].join("#");m.useEffect(()=>{if(H.current===N)return;H.current=N;const L=window.api?.desktop?.teamBridge;if(!L?.syncDirectory)return;const W=B.current;for(const j of O.current)j in W||L.syncDirectory({tenantId:j,members:[]}).catch(()=>{});O.current=new Set(Object.keys(W));for(const[j,z]of Object.entries(W))L.syncDirectory({tenantId:j,members:z}).catch(()=>{})},[N]),m.useEffect(()=>{const L=ne.current;ne.current=r,L!==r&&L!==void 0&&(ee.current=new Map,se.current=new Map,q.current=new Set,te.current=null,o.invalidateQueries({queryKey:Gt.unreadPrefix}),o.invalidateQueries({queryKey:Gt.conversationsPrefix}))},[r,o]),m.useEffect(()=>{if(te.current===M||(te.current=M,!y.data))return;for(const oe of y.data.organizations??[])oe.unread===0&&!q.current.has(oe.tenant_id)&&q.current.add(oe.tenant_id);if(!X.data)return;const L=k.current,W=F.current,j=U8(w?.memberships??[],y.data.organizations,y.data.organizations??null);let z=ee.current;for(let oe=0;oe<W.length;oe+=1){const J=W[oe],Re=L[oe]?.data;if(!Re)continue;const ie=(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&&Cdt(o,r,J.tenant_id,Re.conversations??[],se.current);const ge=q.current.has(J.tenant_id),U=Zr(o),we=ie.filter(Se=>!ge||!x.current||v.current||!U.accountId||U.accountId!==r?!0:!NI(o,{accountId:U.accountId,epoch:U.epoch},Se.conversation_id,Se.tenant_id)),ke=hdt({conversations:X.data.conversations,rows:we,organizations:j,selfAccountId:r,cursors:z,seeded:ge,quiet:!a||g});if(z=ke.cursors,ke.seeded&&q.current.add(J.tenant_id),!a||g||!r)continue;const De=r,pe=gp(o),be=rX(o,De);for(const Se of ke.candidates)ydt(o,Se,De,()=>b.current===De&&gp(o)===pe&&be()&&x.current&&!v.current&&Gc(o,De),_.current.signal)}ee.current=z},[M,a,g,y.data,X.data,w,r,o])}function kdt(){const{data:e}=Yn();m.useEffect(()=>{e&&vJ(e)},[e]);const t=u2(),n=Pt(),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}),!$oe()&&Aa(h("ui.settings.language.external_notice",{language:r.language}),{id:"i18n-language-external"}))},[t.configChange,n])}function Edt(e,t){if(e.defaultPrevented||e.repeat||e.isComposing||!(e.metaKey||e.ctrlKey))return null;const n=w2(e);if(n===null)return null;const s=Wee(t.bindings).get(n);return s===void 0||UA(e.target)||!dbe(RQ(s),t.route)?null:s}const RQ=e=>e.slice(6);function Tdt(e){const t=Ie.getState(),n=t.activeDraftKey?t.drafts[t.activeDraftKey]:void 0,s=Qv(t.activeDraftKey,n?.sessionId,t.activeSessionId)??null;Yd(RQ(e),{sessionId:s,askScope:s===null?"fleet":"session",via:"chord"})}function Rdt(){m.useEffect(()=>{const e=t=>{const n=tt.getState(),s=Edt(t,{bindings:n.shortcutBindings,route:n.rightSlotRoute});s!==null&&(t.preventDefault(),Tdt(s))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[])}function Adt(e,t){const n=yg(),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 Fdt=""+new URL("radient-icon-1024x1024-D_JJedvo.png",import.meta.url).href,AQ=mg()(nH(e=>({hasBeenNotified:!1,setHasBeenNotified:t=>{e({hasBeenNotified:t})}}),{name:"low-credits-storage"})),Ddt=({open:e,onClose:t,onGoToConsole:n})=>{Ve();const{setHasBeenNotified:s}=AQ(),{prices:r,isLoading:i,error:a}=qoe(),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:Fdt,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(Pu,{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(On,{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")})]})})},Idt=(e,t)=>t?e.some(n=>n.session_id===t&&n.status?.code==="busy"):!1;function Pdt(e){return Ie(t=>Idt(t.sessions,e))}const DA={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=>DA[e]==="visible"),more:wy.filter(e=>DA[e]==="more")},O5=new Map(wy.map((e,t)=>[e,t])),Ndt=new Map([["notifications","notifications"]]);function Mdt(e,t){const n=s=>{const r=Ndt.get(s);return r===void 0||t(r)};return{visible:e.visible.filter(n),more:e.more.filter(n)}}const Odt=new Set(zee);function Ldt(e){return typeof e=="string"&&Odt.has(e)}function vE(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 No(e,t){return e.visible.includes(t)?"visible":"more"}function R_(e,t,n){return e[t].filter(s=>n.has(s))}function Bdt(e,t,n,s){if(!s.has(t))return null;const r=No(e,t),i=R_(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 L5(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 B5(e,t){for(const n of wy){if(DA[n]!==t||e.visible.includes(n)||e.more.includes(n))continue;const s=O5.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=O5.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 IA(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)Ldt(a)&&(n.has(a)||(n.add(a),t[r].push(a)))}}return B5(t,"visible"),B5(t,"more"),t}function Hdt(e){return e.reduce((t,n)=>{const s=n.attention??0;return Number.isFinite(s)&&s>0?t+s:t},0)}const Gf={layout:["desktop","sidebar_layout"]};async function Udt(){const e=await nt({op:"sidebar_layout.get"});return IA(e.layout)}function Gdt(e,t=()=>!1){const n=Pt(),s=Ln({queryKey:Gf.layout,enabled:e,queryFn:Udt,staleTime:Number.POSITIVE_INFINITY,retry:Kv}),r=m.useRef(0),i=pn({scope:{id:"sidebar-layout"},mutationFn:async d=>{const f=await nt({op:"sidebar_layout.set",layout:Mdt(d,t)});return IA(f.layout)},retry:$ee,onMutate:async d=>{const f=++r.current;await n.cancelQueries({queryKey:Gf.layout});const p=n.getQueryData(Gf.layout);return n.setQueryData(Gf.layout,d),{previous:p,seq:f}},onError:(d,f,p)=>{p?.seq===r.current&&p.previous&&n.setQueryData(Gf.layout,p.previous),fn(h("ui.shell.sidebar_navigation.save_failed"))},onSettled:(d,f,p,g)=>{g?.seq===r.current&&n.invalidateQueries({queryKey:Gf.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(IA(yy))}}}const j5=({expanded:e})=>(Ve(),c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(HH,{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")})]})),FQ=()=>{const e=u2(),t=Yn(),n=Ie(u=>u.setCataloguePageable),s=Ie(u=>u.setCatalogueActivityHead),r=Ie(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=wr(t.data,"session_catalogue",2)==="enabled",l=m.useCallback(()=>r(i?pH:Sy,i),[r,i]);return m.useEffect(()=>{o&&l()},[o,l,e.catalogueRevision]),null},H5="flex h-[30px] w-full items-center gap-2 rounded-md px-2 text-body-sm transition-colors duration-fast ease-out-quart",Vdt=()=>{Ve();const e=Ny()==="rtl",t=ei(),n=s9(),{expanded:s,onCollapse:r}=Koe(),i=tt(ce=>ce.openCommandPalette),a=Yn(),o=mit(vt(a.data,"team_bridge_conversations")),l=Ie(ce=>ce.activeSessionId),u=xQ(),d=wr(a.data,"peers")==="enabled",f=fC(d),p=wr(a.data,"approvals")==="enabled",g=kQ(f==="member"&&p,{poll:!0}),v=wQ(g.data??[]),b=vt(a.data,"projects",1),x=vt(a.data,"library",1),_=vt(a.data,"notifications",1),w=J8(_),y=_?Z8(w.data):0,S=tt(ce=>ce.sidebarOverflowExpanded),C=tt(ce=>ce.setSidebarOverflowExpanded),E=vt(a.data,"aida",1),k=Kh(E),F=E&&k.data?.enabled===!0,A=k.data?.name??"Aida",I=fme(),P=bQ(k.data?.session_id),N=Pdt(k.data?.session_id),B=()=>{I(t,k.data).catch(ce=>fn(qf(ce)))},H=new Map;F&&H.set("aida",{icon:Yoe,label:A,path:"/chat",isActive:n==="chat"&&!!k.data?.session_id&&l===k.data?.session_id,tourTag:"nav-item-aida",onSelect:B,attention:P,attentionTag:"nav-aida-badge",attentionName:ce=>h("ui.shell.sidebar_navigation.aida_missed",{name:A,count:ce}),working:N,workingName:h("ui.shell.sidebar_navigation.aida_working",{name:A})}),_&&H.set("notifications",{icon:yG,label:h("ui.notifications.nav.label"),path:"/notifications",isActive:n==="notifications",tourTag:"nav-item-notifications",attention:y,attentionTag:"nav-notifications-badge",attentionName:ce=>h("ui.notifications.nav.unread",{count:ce,countText:String(ce)})}),x&&H.set("library",{icon:phe,label:h("ui.library.page.title"),path:"/library",isActive:n==="library",tourTag:"nav-item-library"}),b&&H.set("projects",{icon:kG,label:h("ui.shell.sidebar_navigation.projects"),path:"/projects",isActive:n==="projects",tourTag:"nav-item-projects"}),H.set("agents",{icon:Ll,label:h("ui.shell.sidebar_navigation.agents"),path:"/agents",isActive:n==="agents",tourTag:"nav-item-agents"}),H.set("schedules",{icon:CG,label:h("ui.shell.sidebar_navigation.schedules"),path:"/schedules",isActive:n==="schedules",tourTag:"nav-item-schedules"}),H.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:ce=>h("ui.shell.sidebar_navigation.browser_waiting",{count:ce,countText:String(ce)})}),o&&H.set("team-bridge",{...o,isActive:n==="team-bridge"}),H.set("agent-hub",{icon:IG,label:h("ui.shell.sidebar_navigation.agent_hub"),path:"/agent-hub",isActive:n==="agent-hub",tourTag:"nav-item-agent-hub"}),f==="member"&&H.set("mesh",{icon:G8,label:h("ui.shell.sidebar_navigation.mesh"),path:"/mesh",isActive:n==="mesh",tourTag:"nav-item-mesh",attention:v,attentionTag:"nav-mesh-badge",attentionName:ce=>h("ui.shell.sidebar_navigation.mesh_waiting",{count:ce,countText:String(ce)})});const O=new Set(H.keys()),X=vt(a.data,"sidebar_layout",1),{layout:ee,canCustomise:se,save:q,reset:ne}=Gdt(X,ce=>vt(a.data,ce,1)),te=se?ee:yy,M=R_(te,"visible",O),L=R_(te,"more",O),[W,j]=m.useState(!1),z=S||W||L.some(ce=>H.get(ce)?.isActive),[oe,J]=m.useState(""),[Re,ie]=m.useState(null),ge=m.useRef(new Map),U=ce=>{requestAnimationFrame(()=>ge.current.get(ce)?.focus())},[we,ke]=m.useState(null),[De,pe]=m.useState(null),be=m.useRef(null),Se=m.useRef(null),Ce=m.useRef(null),me=m.useRef(0),ze=m.useRef(0),ae=m.useRef(null),$e=m.useRef(null),Ke=m.useRef(!1),de=ce=>{const he=be.current;return he===null?[]:Array.from(he.querySelectorAll("[data-sidebar-row]")).filter(Pe=>Pe.dataset.sidebarRow!==ce).map(Pe=>{const je=Pe.getBoundingClientRect();return{id:Pe.dataset.sidebarRow??"",top:je.top,bottom:je.bottom}})},Me=(ce,he)=>{const Pe=be.current;if(Pe===null)return null;const je=Pe.getBoundingClientRect(),Ze=de(he),le=ye=>Ze.filter(Fe=>No(te,Fe.id)===ye);let _e=null;if(ce.kind==="more"){const ye=le("more").at(-1);if(ye)_e=ye.bottom;else{const Fe=Pe.querySelector("[data-sidebar-more]");_e=Fe?Fe.getBoundingClientRect().bottom:je.top+2}}else if(ce.kind==="band"){const ye=No(te,he),rt=le(ye==="more"?"visible":"more").at(-1);if(rt)_e=rt.bottom;else if(ye==="more"){const yt=Pe.querySelector("[data-sidebar-more]");_e=yt?yt.getBoundingClientRect().top:je.top+2}}else{const ye=Ze[ce.slot];ye?_e=ye.top:_e=Ze.at(-1)?.bottom??je.top+2}return _e===null?null:Math.round(_e-je.top+Pe.scrollTop)},Ne=()=>{$e.current!==null&&(window.clearTimeout($e.current),$e.current=null)},We=(ce,he)=>{const Pe=Se.current;if(Pe===null||!Pe.armed)return;const je=document.elementFromPoint(ce,he),Ze=!!je?.closest("[data-sidebar-more]"),le=!!je?.closest("[data-sidebar-drop-band]");let _e;if(Ze)_e={kind:"more"},No(te,Pe.id)==="visible"&&!z&&$e.current===null&&($e.current=window.setTimeout(()=>{$e.current=null,j(!0),requestAnimationFrame(()=>at.current(me.current,ze.current))},400));else if(Ne(),le)_e={kind:"band"};else{const ye=de(Pe.id),Fe=xY(ye,Pe.id,he),rt=ye[Fe];let yt="visible";if(rt)yt=No(te,rt.id);else{const Rt=ye.at(-1);yt=Rt?No(te,Rt.id):"visible"}_e={kind:"slot",slot:Fe,beforeId:rt?.id??null,region:yt}}Ce.current=_e,pe(Me(_e,Pe.id))},at=m.useRef(We);at.current=We;const xt=()=>{ae.current!==null&&(cancelAnimationFrame(ae.current),ae.current=null)},Bt=()=>{ae.current=null;const ce=Se.current,he=be.current;if(ce===null||!ce.armed||he===null)return;const Pe=he.getBoundingClientRect(),je=ze.current,Ze=he.scrollHeight-he.clientHeight;let le=0;je-Pe.top<24&&he.scrollTop>0?le=-1:Pe.bottom-je<24&&he.scrollTop<Ze&&(le=1),le!==0&&(he.scrollTop+=le*8,at.current(me.current,je)),ae.current=requestAnimationFrame(Bt)},gn=(ce,he)=>{if(se&&he.button===0&&!(he.altKey||he.ctrlKey||he.metaKey||he.shiftKey)){try{he.currentTarget.setPointerCapture(he.pointerId)}catch{}Se.current={pointerId:he.pointerId,id:ce,armed:!1,startX:he.clientX,startY:he.clientY},me.current=he.clientX,ze.current=he.clientY}},At=ce=>{const he=Se.current;if(!(he===null||he.pointerId!==ce.pointerId)){if(me.current=ce.clientX,ze.current=ce.clientY,!he.armed){if(Math.hypot(ce.clientX-he.startX,ce.clientY-he.startY)<5)return;he.armed=!0,Ke.current=!0,ke(he.id);const Pe=H.get(he.id);Pe&&J(h("ui.shell.sidebar_navigation.drag_armed",{name:Pe.label})),ae.current===null&&(ae.current=requestAnimationFrame(Bt))}We(ce.clientX,ce.clientY)}},dt=(ce,he)=>{if(he.kind==="slot")return jdt(te,ce,he.region,he.beforeId,O);const Pe=No(te,ce),je=he.kind==="more"?"more":Pe==="more"?"visible":"more";return L5(te,ce,je)},Kt=(ce,he)=>{const Pe=H.get(ce);if(Pe===void 0)return;const je=dt(ce,he);if(je===null||vE(je,te))return;const Ze=No(je,ce);if(Ze==="more"&&C(!0),q(je),he.kind==="slot"){vn(je,ce);return}J(Ze==="more"?h("ui.shell.sidebar_navigation.move_to_more_note",{name:Pe.label}):h("ui.shell.sidebar_navigation.show_in_sidebar_note",{name:Pe.label}))},vn=(ce,he)=>{const Pe=H.get(he),je=No(ce,he),Ze=R_(ce,je,O);J(h("ui.shell.sidebar_navigation.move_note",{name:Pe?.label??"",position:String(Ze.indexOf(he)+1),total:String(Ze.length)}))},Dt=(ce,he=!1)=>{const Pe=Se.current;if(Pe===null)return;Se.current=null,xt(),Ne();const je=Ce.current;if(Ce.current=null,ke(null),pe(null),j(!1),!!Pe.armed){if(!ce){if(he){Ke.current=!1,J("");return}const Ze=()=>{Ke.current=!1},le=()=>{window.setTimeout(Ze,0)},_e=()=>{window.removeEventListener("pointerup",ye,!0),window.removeEventListener("pointercancel",Fe,!0),window.removeEventListener("blur",Fe,!0)},ye=()=>{_e(),le()},Fe=()=>{_e(),Ze()};window.addEventListener("pointerup",ye,!0),window.addEventListener("pointercancel",Fe,!0),window.addEventListener("blur",Fe,!0),J("");return}window.setTimeout(()=>{Ke.current=!1},0),je!==null&&Kt(Pe.id,je)}},ln=m.useRef(Dt);ln.current=Dt,m.useEffect(()=>{if(we===null)return;const ce=je=>{je.key==="Escape"&&(ln.current(!1),je.preventDefault())},he=je=>{Se.current?.pointerId===je.pointerId&&ln.current(!0)},Pe=()=>ln.current(!1,!0);return window.addEventListener("keydown",ce),window.addEventListener("pointerup",he),window.addEventListener("pointercancel",Pe),window.addEventListener("blur",Pe),()=>{window.removeEventListener("keydown",ce),window.removeEventListener("pointerup",he),window.removeEventListener("pointercancel",Pe),window.removeEventListener("blur",Pe)}},[we]),m.useEffect(()=>()=>{ae.current!==null&&cancelAnimationFrame(ae.current),$e.current!==null&&window.clearTimeout($e.current)},[]);const An=(ce,he)=>{if(!se)return;const Pe=H.get(ce);if(Pe===void 0)return;if(he.kind==="reset"){ne(),J(h("ui.shell.sidebar_navigation.reset_note")),U(ce);return}if(he.kind==="move"){const Ze=Bdt(te,ce,he.delta,O);if(Ze===null)return;q(Ze),vn(Ze,ce),U(ce);return}const je=L5(te,ce,he.region);vE(je,te)||(he.region==="more"&&C(!0),q(je),J(he.region==="more"?h("ui.shell.sidebar_navigation.move_to_more_note",{name:Pe.label}):h("ui.shell.sidebar_navigation.show_in_sidebar_note",{name:Pe.label})),U(ce))},nn=c.jsx(Mtt,{selectedConversation:l??void 0,onSelectConversation:ce=>void Cg(t,ce,"sidebar"),onStageDraft:(ce,he)=>{Ie.getState().stageDraft(ce,he),t("/chat")}}),sn=ce=>{const he=ce.attention??0,Pe=he>0&&ce.attentionName?ce.attentionName(he):ce.label;return ce.working&&ce.workingName?ce.workingName:Pe},un=ce=>{const he=H.get(ce);if(he===void 0)return null;const Pe=No(te,ce),je=Pe==="more"?L:M,Ze=je.indexOf(ce),le=Ze<=0,_e=Ze===-1||Ze>=je.length-1,ye=he.attention??0,Fe=sn(he),rt=we===ce,yt=e?"left":"right",Rt=he.isActive?Lo:"text-ink-muted hover:bg-row-hover hover:text-ink",Vt=c.jsx(he.icon,{size:16,"aria-hidden":"true",className:R("shrink-0",he.isActive&&"text-accent")}),Ht=c.jsxs("button",{type:"button",ref:Ft=>{Ft?ge.current.set(ce,Ft):ge.current.delete(ce)},onClick:()=>{if(Ke.current){Ke.current=!1;return}he.onSelect?he.onSelect():t(he.path)},onPointerDown:se?Ft=>gn(ce,Ft):void 0,onPointerMove:se?At:void 0,onPointerUp:se?Ft=>{Se.current?.pointerId===Ft.pointerId&&Dt(!0)}:void 0,onPointerCancel:se?()=>Dt(!1,!0):void 0,onKeyDown:se?Ft=>{if(Ft.key==="ContextMenu"||Ft.shiftKey&&Ft.key==="F10"){Ft.preventDefault(),ie(ce);return}Ft.altKey&&(Ft.key!=="ArrowUp"&&Ft.key!=="ArrowDown"||(Ft.preventDefault(),An(ce,{kind:"move",delta:Ft.key==="ArrowUp"?-1:1})))}:void 0,"data-tour-tag":he.tourTag,"aria-current":he.isActive?"page":void 0,"aria-haspopup":se?"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?Vt:c.jsxs("span",{className:"relative flex size-7 shrink-0 items-center justify-center",children:[Vt,ye>0&&c.jsx("span",{className:"pointer-events-none absolute -top-1 -end-1.5 flex",children:c.jsx(sp,{count:ye,placement:"corner","data-tour-tag":he.attentionTag})})]}),!s&&he.working&&c.jsx("span",{className:"inline-flex",children:c.jsx(Li,{size:16,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})}),s&&c.jsx("span",{className:"truncate",children:he.label})]}),Nt=se?c.jsxs(Xo,{open:Re===ce,onOpenChange:Ft=>ie(Ft?ce:null),children:[c.jsx(vo,{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(Sc,{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:yt,sideOffset:s?6:16,className:"min-w-44",onCloseAutoFocus:Ft=>{Ft.preventDefault(),U(ce)},children:[c.jsx(on,{disabled:le,onSelect:()=>An(ce,{kind:"move",delta:-1}),children:h("ui.shell.sidebar_navigation.move_up")}),c.jsx(on,{disabled:_e,onSelect:()=>An(ce,{kind:"move",delta:1}),children:h("ui.shell.sidebar_navigation.move_down")}),c.jsx(Hr,{}),Pe==="more"?c.jsx(on,{onSelect:()=>An(ce,{kind:"region",region:"visible"}),children:h("ui.shell.sidebar_navigation.show_in_sidebar")}):c.jsx(on,{onSelect:()=>An(ce,{kind:"region",region:"more"}),children:h("ui.shell.sidebar_navigation.move_to_more")}),!vE(te,yy)&&c.jsxs(c.Fragment,{children:[c.jsx(Hr,{}),c.jsx(on,{onSelect:()=>An(ce,{kind:"reset"}),children:h("ui.shell.sidebar_navigation.reset_layout")})]})]})]}):null;return c.jsxs("li",{"data-sidebar-row":ce,"data-sidebar-region":Pe,onContextMenu:se?Ft=>{Ft.preventDefault(),ie(ce)}:void 0,className:R("group/row relative flex h-[30px] w-full items-center rounded-md","transition-colors duration-fast ease-out-quart",Rt,rt&&BY,rt&&jY),children:[s?Ht:c.jsx(Iu,{content:sn(he),side:yt,suppressed:we!==null,children:Ht}),Nt,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(sp,{count:ye,"data-tour-tag":he.attentionTag}),he.working&&c.jsx(Li,{size:16,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})]})]},he.tourTag)},Fn=De===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:De}}),fs=(we===null?null:No(te,we))==="more"?h("ui.shell.sidebar_navigation.show_in_sidebar"):h("ui.shell.sidebar_navigation.move_to_more"),Un=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:fs}):c.jsx(Iu,{content:fs,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"})})}),Sr=c.jsx("span",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:oe}),Gn=s?h("ui.shell.sidebar_navigation.collapse_sidebar"):h("ui.shell.sidebar_navigation.expand_sidebar"),cn=s?e?Bi:Qu:e?Qu:Bi,Lt=navigator.platform.toUpperCase().indexOf("MAC")>=0,gs=vt(a.data,"session_catalogue",2),bn=Ie(ce=>ce.activeDraftKey),dn=Ie(ce=>ce.drafts),Vn=!!bn&&!(bn?dn[bn]:void 0)?.target,ms=()=>{Ie.getState().stageDraft(void 0,!0),t("/chat")},G=h("ui.shell.sidebar_navigation.new_chat_shortcut",{shortcut:Oi(I6(Lt).replace("+",""))}),V=h("ui.shell.sidebar_navigation.search_accessible",{everything:Oi(kl("everything",Lt)),chats:Oi(kl("chats",Lt))}),K=h("ui.shell.sidebar_navigation.search_tooltip",{everything:Oi(kl("everything",Lt)),chats:Oi(kl("chats",Lt))}),Q=(ce,he,Pe,je)=>{const Ze=ce;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(H5,je.current?Lo:"text-ink-muted hover:bg-row-hover hover:text-ink","disabled:text-ink-disabled disabled:hover:bg-transparent"),children:[c.jsx(Ze,{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($r,{shortcut:Pe,joined:!0})})]})},Y=Q(TT,h("ui.shell.sidebar_navigation.new_chat"),I6(Lt),{onClick:ms,ariaLabel:G,current:Vn,disabled:!gs,attrs:{"data-tour-tag":"nav-item-chat","data-new-chat-row":""}}),Z=Q(Eh,h("ui.shell.sidebar_navigation.search"),Oit("everything",Lt),{onClick:i,ariaLabel:V,attrs:{"data-command-palette-trigger":"",title:K}}),Te=(ce,he,Pe)=>{const je=ce;return c.jsx(Iu,{content:c.jsx(Vo,{text:he}),side:e?"left":"right",children:c.jsx("button",{type:"button",...Pe.attrs,onClick:Pe.onClick,disabled:Pe.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"}),(Pe.attention??0)>0&&c.jsx("span",{className:"pointer-events-none absolute -top-1 -end-1.5 flex",children:c.jsx(sp,{count:Pe.attention??0,placement:"corner","data-tour-tag":Pe.attentionTag})}),Pe.working&&c.jsx("span",{className:"pointer-events-none absolute -bottom-0.5 -end-0.5 flex",children:c.jsx(Li,{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:Gn,side:e?"left":"right",children:c.jsx(ue,{variant:"ghost",size:"icon-sm",onClick:r,"aria-label":Gn,"aria-expanded":s,"aria-keyshortcuts":YP(Lt),children:c.jsx(cn,{"aria-hidden":"true"})})})}),Ee=()=>{if(L.length===0)return null;const ce=L.map(le=>H.get(le)).filter(le=>le!==void 0),he=Hdt(ce),Pe=z?0:he,je=ce.some(le=>le.working===!0),Ze=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":z,"aria-controls":"sidebar-more-destinations","aria-label":Ze,onClick:()=>C(!z),className:R(H5,"text-ink-muted hover:bg-row-hover hover:text-ink"),children:[c.jsx(Sc,{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")}),(Pe>0||je)&&c.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1",children:[Pe>0&&c.jsx(sp,{count:Pe,"data-tour-tag":"nav-more-badge"}),je&&c.jsx(Li,{size:16,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})]}),c.jsx(ji,{size:14,"aria-hidden":"true",className:R("shrink-0 transition-transform duration-fast",z&&"rotate-180")})]}):Te(Sc,Ze,{onClick:()=>C(!z),attention:Pe,attentionTag:"nav-more-badge",working:je,attrs:{"aria-expanded":z,"aria-controls":"sidebar-more-destinations","data-tour-tag":"nav-item-more","data-sidebar-more":""}}),z&&c.jsx("ul",{id:"sidebar-more-destinations",className:R("flex flex-col gap-0.5",!s&&"items-center gap-1"),children:L.map(un)})]},"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(j5,{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:[Y,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:[M.map(un),Ee()]}),Fn]}),Un]}),Sr]}),c.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:nn}),c.jsx(vQ,{})]}):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(FQ,{}),c.jsx("div",{className:"flex h-10 shrink-0 items-center justify-center",children:c.jsx(j5,{expanded:!1})}),c.jsxs("ul",{className:"flex flex-col items-center gap-1",children:[c.jsx("li",{children:Te(Bi,Gn,{onClick:r,attrs:{"aria-expanded":!1,"aria-keyshortcuts":YP(Lt)}})}),c.jsx("li",{children:Te(TT,G,{onClick:ms,disabled:!gs,attrs:{"data-tour-tag":"nav-item-chat"}})}),c.jsx("li",{children:Te(Eh,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:[M.map(un),Ee()]}),Fn,Un]}),Sr,c.jsxs("div",{className:"mt-auto flex flex-col items-center gap-1 pb-2",children:[c.jsx(hQ,{}),c.jsx(mQ,{}),c.jsx(DI,{expanded:!1})]})]})},Wdt=1,zdt=()=>{const{isAuthenticated:e,user:t}=Qy(),{hasBeenNotified:n,setHasBeenNotified:s}=AQ(),[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 Xoe({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<Wdt?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 $dt(){const e=ei();m.useEffect(()=>{const t=r=>{e(r==="back"?-1:1)},n=r=>{const i=iU(r);i&&(r.preventDefault(),t(i))},s=r=>{const i=aU(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 qdt(){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 Kdt(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 Ydt(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 Xdt(){m.useLayoutEffect(()=>{if(!window.api?.windowChrome)return;const t=document.documentElement.dataset.chromePlatform??"linux",n=()=>Kdt(qdt(),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 Qdt=m.lazy(()=>Ma(()=>import("./agent-details-page-CGBPck3M.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}))),Jdt=m.lazy(()=>Ma(()=>import("./agent-hub-page-oNcQi-BL.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}))),U5=m.lazy(()=>Ma(()=>import("./agents-page-BM9GCJql.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}))),Zdt=m.lazy(()=>Ma(()=>import("./schedules-page-Bj-EKraP.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}))),G5=m.lazy(()=>Ma(()=>import("./projects-page-JmH0vUnI.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}))),V5=m.lazy(()=>Ma(()=>import("./library-page-d7jnJ1cM.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}))),W5=m.lazy(()=>Ma(()=>import("./notifications-page-C0pIdEuW.js"),__vite__mapDeps([31,1,2,3,14,5,6,15,17,8,7,9,25]),import.meta.url).then(e=>({default:e.NotificationsPage}))),eht=m.lazy(()=>Ma(()=>import("./team-bridge-page-vIR1dP5K.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}))),tht=m.lazy(()=>Ma(()=>import("./browser-page-onX8FqEA.js"),__vite__mapDeps([34,1,2,3,5,6,8,7,9,14,15]),import.meta.url).then(e=>({default:e.BrowserPage}))),nht=m.lazy(()=>Ma(()=>import("./mesh-page-C972n1XX.js"),__vite__mapDeps([35,1,2,3,5,6,17,8,7,9,14,15]),import.meta.url).then(e=>({default:e.MeshPage}))),sht=m.lazy(()=>Ma(()=>import("./settings-page-DTjdJ7Xe.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}))),rht=m.lazy(()=>Ma(()=>import("./browser-webauthn-prompt-CHryNF4a.js"),__vite__mapDeps([39,1,2,3,5,6,8,7,9,14,15]),import.meta.url).then(e=>({default:e.BrowserWebauthnPrompt}))),iht=()=>{Ve(),Qct(),Xdt(),kdt(),Qoe();const{pathname:e}=HA(),t=e.startsWith("/chat")||e.startsWith("/browser"),{isOnboardingActive:n}=dge(),{isLowCreditsDialogOpen:s,openRadientConsole:r,onLowCreditsDialogClose:i}=zdt(),{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=ei(),f=Yn(),p=vt(f.data,"session_catalogue",2),g=vt(f.data,"session_archive");m.useEffect(()=>{Ie.getState().requestArchiveConfirm(null)},[e]);const v=wr(f.data,"peers"),b=wr(f.data,"library"),x=wr(f.data,"notifications"),_=wr(f.data,"team_bridge_conversations"),w=_==="enabled"&&e.startsWith(cg);Sdt(vt(f.data,"team_bridge_conversations"));const y=N=>{Ie.getState().stageDraft({kind:"agent",name:N.name}),d("/chat"),u()};uat(),Rdt(),Nle(),Joe(),$dt(),Eye();const S=Ie(N=>N.setActiveSession),C=Yn(),E=Kh(vt(C.data,"aida",1)),k=Ie(N=>{const B=N.activeDraftKey?N.drafts[N.activeDraftKey]:void 0;return Qv(N.activeDraftKey,B?.sessionId,N.activeSessionId)}),F=cme({displayedSessionId:k,archiveEnabled:g}),A=tt(N=>N.setConsolePaneOpen),I=tt(N=>N.setBrowserPaneOpen),P=tt(N=>N.setConsoleActiveSurface);return m.useEffect(()=>{const N=window.api?.desktop?.onOpenConversation?.((B,H)=>{B!==null&&(performance.mark("lop:open:requested"),Mle(B,"native")),S(B),H!==void 0&&B!==null&&(P(H),A(!0)),d("/chat")});return()=>N?.()},[d,S,A,P]),Iit(_==="enabled",d),Adt(_==="enabled",d),m.useEffect(()=>{const N=window.api?.console?.onReveal?.(B=>{if(B.mode!=="none"&&!(B.mode==="session"&&B.session_id!==k)){if(B.mode==="open"){if(!Zoe({targetSessionId:B.session_id,displayedSessionId:k,activeElement:document.activeElement,commandPaletteOpen:a}))return;S(B.session_id)}P(B.surface),A(!0)}});return()=>N?.()},[k,a,S,A,P]),Mme(),Hst(),m.useEffect(()=>{const N=window.api?.browser?.onConsentAttention?.(B=>{const H=vme(B.requesterSessionId,Ie.getState().sessions);if(pme(B.entryId),H.kind==="browser"){d("/browser");return}S(H.sessionId),I(!0),d("/chat")});return()=>N?.()},[d,S,I]),m.useEffect(()=>{const N=B=>{n||p&&Gst(B)&&(B.preventDefault(),Ie.getState().stageDraft(void 0,!0),d("/chat"))};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[p,n,d]),c.jsx(Bct,{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(aat,{}),c.jsx(Hct,{}),c.jsx(Vst,{}),c.jsx(ele,{}),c.jsx(dat,{enabled:v==="enabled"}),c.jsx(iot,{open:n}),c.jsx(jct,{}),c.jsx(eut,{}),g&&c.jsx(jme,{}),c.jsx(Bge,{}),c.jsx(m.Suspense,{fallback:null,children:c.jsx(rht,{})}),c.jsx(sme,{blocked:n||s||a||o||F,sessionId:E.data?.session_id??null}),c.jsx(Ddt,{open:s,onClose:i,onGoToConsole:r}),c.jsx(gge,{open:o,onClose:u,onAgentCreated:y}),c.jsx(tle,{sidebar:c.jsx(Vdt,{}),routeSidebar:w&&{keeper:c.jsx(FQ,{}),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(Vut,{}),c.jsx("div",{className:"flex grow items-center justify-center",children:c.jsx(On,{size:"lg",label:h("ui.common.loading.page")})})]}),children:c.jsxs(qee,{children:[c.jsx(vr,{path:"/",element:c.jsx(XP,{to:"/chat",replace:!0})}),c.jsx(vr,{path:"/chat",element:c.jsx(F6,{})}),c.jsx(vr,{path:"/chat/:agentId",element:c.jsx(F6,{})}),c.jsx(vr,{path:"/agents",element:c.jsx(U5,{})}),c.jsx(vr,{path:"/agents/:agentId",element:c.jsx(U5,{})}),c.jsx(vr,{path:"/settings",element:c.jsx(sht,{})}),c.jsx(vr,{path:"/agent-hub",element:c.jsx(Jdt,{})}),c.jsx(vr,{path:"/agent-hub/:agentId",element:c.jsx(Qdt,{})}),c.jsx(vr,{path:"/schedules",element:c.jsx(Zdt,{})}),c.jsx(vr,{path:"/projects",element:c.jsx(G5,{})}),c.jsx(vr,{path:"/projects/:projectId",element:c.jsx(G5,{})}),c.jsx(vr,{path:"/browser",element:c.jsx(tht,{})}),x==="enabled"&&c.jsxs(c.Fragment,{children:[c.jsx(vr,{path:"/notifications",element:c.jsx(W5,{})}),c.jsx(vr,{path:"/notifications/:notificationId",element:c.jsx(W5,{})})]}),b==="enabled"&&c.jsxs(c.Fragment,{children:[c.jsx(vr,{path:"/library",element:c.jsx(V5,{})}),c.jsx(vr,{path:"/library/assets/:assetId",element:c.jsx(V5,{})})]}),_==="enabled"&&c.jsx(vr,{path:"/team-bridge",element:c.jsx(eht,{})}),v==="enabled"&&c.jsx(vr,{path:"/mesh",element:c.jsx(nht,{})}),c.jsx(vr,{path:"*",element:c.jsx(XP,{to:"/chat",replace:!0})})]})})]})})]})})})};let vl=null,Vf=null,Tm=null,Wf=null,bE=null;const aht={soundsArm:async()=>{if(Rf.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(),sle(e=>{if(!vl)throw new Error("sounds safety: no context");const t=vl.createMediaElementSource(e);Tm=vl.createGain(),Tm.gain.value=0,Vf=vl.createAnalyser(),Wf=vl.createAnalyser(),t.connect(Wf),Wf.connect(Tm),Tm.connect(Vf),Vf.connect(vl.destination)}),{armed:!0,contextState:vl.state}},soundsFacts:()=>{const e=Rf.getState(),t=new Float32Array(Vf?.fftSize??32);Vf?.getFloatTimeDomainData(t);const n=new Float32Array(Wf?.fftSize??32);return Wf?.getFloatTimeDomainData(n),{ownerId:e.ownerId,status:e.status,time:e.element?.currentTime??0,duration:e.element?.duration??0,paused:e.element?.paused??!0,gain:Tm?.gain.value??null,inputRms:Wf?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:Vf?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(Os.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}bE=()=>{r("pointerup",s.left+s.width*t.fraction),n.setPointerCapture=i,n.releasePointerCapture=a},u({during:f,seconds:Rf.getState().element?.currentTime})};requestAnimationFrame(d)})},soundsScrubFinish:()=>(bE?.(),bE=null,{committed:!0}),soundsEnd:()=>{const e=Rf.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=Rf.getState();if(!e.element?.src)throw new Error("sounds: fixture not resolved");const{fetchAttachmentBlob:t}=await Ma(async()=>{const{fetchAttachmentBlob:r}=await import("./conversation-input-sync-D9Xccwx1.js").then(i=>i.oA);return{fetchAttachmentBlob:r}},__vite__mapDeps([7,1,2,3,5,6,8,9]),import.meta.url),n=Ie.getState().activeSessionId,s=e.ownerId?.startsWith("sound:")?e.ownerId.slice(6):null;if(!n||!s)throw new Error("sounds: missing attachment identity");return await nle.getState().speak("sounds-driver",()=>t({sessionId:n,childId:null},s)),{ownerId:Rf.getState().ownerId}}};function Tu(){return new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))})}const oht=3,lht=3e3;function cht(e){return e instanceof CSSTransition&&e.playState==="running"}function uht(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 z5(e=lht){const t=performance.now();let n=0;for(;;){await Tu();const s=Math.round(performance.now()-t),r=document.getAnimations().filter(cht);if(n=r.length===0?n+1:0,n>=oht)return{waitedMs:s,timedOut:!1,pending:[]};if(s>e)return{waitedMs:s,timedOut:!0,pending:r.map(uht)}}}const dht=/^#/;function B0(){const e=window.location.hash.replace(dht,"");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 hht(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 Rm(e,t){if(typeof e!="string"||e==="")throw new Error(`${t} must be a non-empty string`);return e}async function fht(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 PA=["dev-driver","query-fetch-probe"];let j0=null;function pht(){if(j0)return j0;const e=[],t=JP.prototype.fetch;return JP.prototype.fetch=function(...s){return e.push({at:Date.now(),key:JSON.stringify(this.queryKey),stack:(new Error().stack??"").split(`
|
|
672
672
|
`).slice(2).join(" | ")}),t.apply(this,s)},j0=e,e}function ght(e){const t=j0??[],n=JSON.stringify(PA),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 mht(){const e=window.__loDevDriver;return e?.armed?e.install({...aht,modelAuthority:async t=>{t&&typeof t=="object"&&"start"in t&&t.start===!0&&Yee();const n=QP();if(!n.armed||n.fault)throw new Error("model authority observer unavailable");if(await Tu(),(await z5()).timedOut)throw new Error("model authority DOM did not settle");return QP()},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:ir.baseUrl,userAgent:navigator.userAgent}),filesFacts:()=>rle(),state:()=>{const t=tt.getState(),n=Ie.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:()=>V_.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 ght(n.key);const s=pht(),r=JSON.stringify(PA),i=s.length;return await V_.fetchQuery({queryKey:PA,queryFn:()=>null,retry:!1,staleTime:0}),{armed:!0,validated:s.slice(i).some(a=>a.key===r)}},navigate:async t=>{const n=Rm(t,"navigate path");if(!n.startsWith("/"))throw new Error(`navigate path must start with "/" (got "${n}")`);return window.location.hash=`#${n}`,{route:await fht(n)}},setTheme:async t=>{const n=Rm(t,"theme name");tt.getState().setTheme(n),await Tu();const s=document.documentElement.getAttribute("data-theme"),r=await z5();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=Kee(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=Rm(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=Rm(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=hht(a);return await Tu(),{selector:s,target:$v(a),...o}},openCanvasDocument:async t=>{const n=t,s=Rm(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[_g(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=Ie.getState(),d=GA(u.activeDraftKey,u.activeSessionId)??u.stageDraft();return tt.getState().setCanvasOpen(!0),Os.getState().addFileAndSelect(d,o),n?.mention===!0&&Os.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 Ole({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 vht(){const e=m.useMemo(xg,[]),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=Xee(a.value,e);fn(ile(a.status,l))};n.getRegistration?.()?.then(r)?.catch(()=>{});const i=n.onRegistration(r);return()=>{s=!0,i?.()}},[e]),null}const bht=`
|
|
673
673
|
/*
|
|
674
674
|
* A transition declared on ::-webkit-scrollbar-thumb does not animate in
|