local-operator-ui 0.34.47 → 0.34.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/renderer/assets/{_basePickBy-B2JiaFKi.js → _basePickBy-4PhBKMwz.js} +1 -1
- package/out/renderer/assets/{_baseUniq-CfpDxOYw.js → _baseUniq-DpFJNrpb.js} +1 -1
- package/out/renderer/assets/{agent-details-page-C0GdJMfq.js → agent-details-page-Ci1JjvpV.js} +1 -1
- package/out/renderer/assets/{agent-hub-page-C6ze_xjQ.js → agent-hub-page-NtBm1phk.js} +1 -1
- package/out/renderer/assets/{agents-page-DSNLtN_J.js → agents-page-YFjN8oZC.js} +3 -3
- package/out/renderer/assets/{arc-K65ZzfoN.js → arc-DkuXQZT0.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-IEHRJDOE-CLJdV8y-.js → architectureDiagram-IEHRJDOE-DWa4IuFf.js} +1 -1
- package/out/renderer/assets/{blockDiagram-JOT3LUYC-DpImr7tl.js → blockDiagram-JOT3LUYC-2iLLg_nw.js} +1 -1
- package/out/renderer/assets/{book-open-BEOtYKZe.js → book-open-CTi9TDfn.js} +1 -1
- package/out/renderer/assets/browser-page-DEUUMy_g.js +1 -0
- package/out/renderer/assets/{browser-webauthn-prompt-4jHz_1RY.js → browser-webauthn-prompt-AacQARJZ.js} +1 -1
- package/out/renderer/assets/{c4Diagram-VJAJSXHY-CD9xVR0f.js → c4Diagram-VJAJSXHY-SvCGL91g.js} +1 -1
- package/out/renderer/assets/channel-CRKSwn0G.js +1 -0
- package/out/renderer/assets/{chunk-4BMEZGHF-CTvc3b4C.js → chunk-4BMEZGHF-CzVlqRCP.js} +1 -1
- package/out/renderer/assets/{chunk-A2AXSNBT-ByqThlbf.js → chunk-A2AXSNBT-DqhEqW0h.js} +1 -1
- package/out/renderer/assets/{chunk-AEK57VVT-DD6OqDr0.js → chunk-AEK57VVT-BEa7M8E9.js} +1 -1
- package/out/renderer/assets/{chunk-D6G4REZN-DyRn0cWl.js → chunk-D6G4REZN-4tI3iHrd.js} +1 -1
- package/out/renderer/assets/{chunk-RZ5BOZE2-CnZV3WTJ.js → chunk-RZ5BOZE2-BSTylGcM.js} +1 -1
- package/out/renderer/assets/{chunk-XZIHB7SX-DolFB-S0.js → chunk-XZIHB7SX-BWyzWCnC.js} +1 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-BxJWvaym.js +1 -0
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-BxJWvaym.js +1 -0
- package/out/renderer/assets/clone-BCVTFSZA.js +1 -0
- package/out/renderer/assets/{console-mirror-DpL-JwpC.js → console-mirror-CxkpeCdB.js} +1 -1
- package/out/renderer/assets/{consoleCapture-DD1Sq_ph.js → consoleCapture-C9FjfQJX.js} +1 -1
- package/out/renderer/assets/{conversation-input-sync-BX8IVirL.js → conversation-input-sync-DFpqmO4l.js} +251 -252
- package/out/renderer/assets/{dagre-OKDRZEBW-CDaLTqSD.js → dagre-OKDRZEBW-Bro14G70.js} +1 -1
- package/out/renderer/assets/{diagram-SSKATNLV-CT01eufZ.js → diagram-SSKATNLV-DxML5WmE.js} +1 -1
- package/out/renderer/assets/{diagram-VNBRO52H-Dm95zJ6Z.js → diagram-VNBRO52H-C1VKCLuH.js} +1 -1
- package/out/renderer/assets/{erDiagram-Q7BY3M3F-CKncNCh2.js → erDiagram-Q7BY3M3F-D1W_lttQ.js} +1 -1
- package/out/renderer/assets/{error-boundary-BDLNfQKz.js → error-boundary-C6UV5tx-.js} +1 -1
- package/out/renderer/assets/{flowDiagram-4HSFHLVR-DxgK_2s-.js → flowDiagram-4HSFHLVR-3Jb09NsW.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-APWFNJXF-C26kU1-9.js → ganttDiagram-APWFNJXF-BuFcOiO1.js} +1 -1
- package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-B22ejsPk.js → gitGraphDiagram-7IBYFJ6S-BbZdk2nO.js} +1 -1
- package/out/renderer/assets/{graph-CnXCW8BP.js → graph-D8Y4lmRI.js} +1 -1
- package/out/renderer/assets/{index-Dk4-Px6P.css → index-D3f_KfVo.css} +1 -1
- package/out/renderer/assets/{index-CnQsclLj.js → index-D7GWaNpY.js} +3 -3
- package/out/renderer/assets/{index-Be9pTy7F.js → index-Dhq36hI2.js} +1 -1
- package/out/renderer/assets/{index-UE_QEAqr.js → index-Hr50KutK.js} +1 -1
- package/out/renderer/assets/{infoDiagram-PH2N3AL5-DJZU3P7J.js → infoDiagram-PH2N3AL5-BVHpnvtw.js} +1 -1
- package/out/renderer/assets/{installer-CIu909RT.js → installer-B8s-TXTU.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-U35MCT3I-C-Aue1NR.js → journeyDiagram-U35MCT3I-BWLCHSce.js} +1 -1
- package/out/renderer/assets/{kanban-definition-NDS4AKOZ-DhgXwdEM.js → kanban-definition-NDS4AKOZ-D7-FbJp3.js} +1 -1
- package/out/renderer/assets/{layout-Dw8q0WZh.js → layout-DogvO2Ky.js} +1 -1
- package/out/renderer/assets/{legacy-agents-page-u84wTmRV.js → legacy-agents-page-Dlp--Xt6.js} +1 -1
- package/out/renderer/assets/{mermaid.core-CLdsX7Rp.js → mermaid.core-CdeoM9AZ.js} +5 -5
- package/out/renderer/assets/{mesh-page-Dys9-2sY.js → mesh-page-BzfNUAkq.js} +1 -1
- package/out/renderer/assets/{messages-Yrm2FT2V.js → messages-CZNg7vOE.js} +1 -1
- package/out/renderer/assets/{mindmap-definition-ALO5MXBD-BjBiqabY.js → mindmap-definition-ALO5MXBD-CfocVEGs.js} +1 -1
- package/out/renderer/assets/{mini-BXXRy4rW.js → mini-D-rHRr3X.js} +1 -1
- package/out/renderer/assets/{notebook-pen-B5Stfimb.js → notebook-pen-D7t7mRlh.js} +1 -1
- package/out/renderer/assets/{org-access-CyjYN726.js → org-access-BIipdCDk.js} +1 -1
- package/out/renderer/assets/{org-surface-gate-i_SGPHN5.js → org-surface-gate-n0a6WDBY.js} +1 -1
- package/out/renderer/assets/{page-header-BR-fmx4f.js → page-header-CJAvj3rs.js} +1 -1
- package/out/renderer/assets/{pieDiagram-IB7DONF6-DjDH1mVr.js → pieDiagram-IB7DONF6-B22hqaTH.js} +1 -1
- package/out/renderer/assets/{projects-page-CGRUr8ls.js → projects-page-Dg-fywlg.js} +1 -1
- package/out/renderer/assets/{publication-validation-B4k6VAFZ.js → publication-validation-mYDoNagz.js} +1 -1
- package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-Ba5XUz4h.js → quadrantDiagram-7GDLP6J5-DJXJe1Jf.js} +1 -1
- package/out/renderer/assets/{radar-MK3ICKWK-eQRm6qEE.js → radar-MK3ICKWK-COD-ZwKJ.js} +1 -1
- package/out/renderer/assets/{radient-auth-buttons-BW_zi2lF.js → radient-auth-buttons-BJmqjZos.js} +1 -1
- package/out/renderer/assets/{requirementDiagram-KVF5MWMF-BSpyCNos.js → requirementDiagram-KVF5MWMF-Cg7p0tZp.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-C-fzkOnd.js → sankeyDiagram-QLVOVGJD-Qir1GlwB.js} +1 -1
- package/out/renderer/assets/{schedules-page-CiSL5P8q.js → schedules-page-CtMNJr6J.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-DdHVib_S.js → sequenceDiagram-X6HHIX6F-B2P7CUDU.js} +1 -1
- package/out/renderer/assets/{settings-page-C11l7qyA.js → settings-page-CFbI2wWy.js} +1 -1
- package/out/renderer/assets/{stateDiagram-DGXRK772-DEwuWkNd.js → stateDiagram-DGXRK772-CGQsk3sX.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-CpHmsYwj.js +1 -0
- package/out/renderer/assets/{timeline-definition-BDJGKUSR-5dsF-6I0.js → timeline-definition-BDJGKUSR-CbnWjiR-.js} +1 -1
- package/out/renderer/assets/{use-download-agent-mutation-DGGt-uXR.js → use-download-agent-mutation-C7H5xbvf.js} +1 -1
- package/out/renderer/assets/{use-memberships-query-BMGVy3RO.js → use-memberships-query-DR_Lujnw.js} +1 -1
- package/out/renderer/assets/{use-session-snapshot-D3QghcPD.js → use-session-snapshot-DKL97J-r.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-VJFVF3MP-DmEwPPnE.js → xychartDiagram-VJFVF3MP-Cq_N4nhd.js} +1 -1
- 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 +2 -2
- package/out/renderer/assets/browser-page-Hj-3V4SP.js +0 -1
- package/out/renderer/assets/channel-CjH9_X6K.js +0 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-DNFX9Bxc.js +0 -1
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-DNFX9Bxc.js +0 -1
- package/out/renderer/assets/clone-Dh-7KwYI.js +0 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-DRPVtafh.js +0 -1
- /package/out/renderer/assets/{index-DF_hRerL.js → index-B8qxAfMF.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./agent-details-page-
|
|
2
|
-
import{r as g,j as c,c as _,b as Ve,f as R2,l as pW,u as gW,s as mW,v as OS,a as vW,R as xW}from"./index-DF_hRerL.js";import{aq as Ee,dH as bW,dI as LS,dJ as Fw,c8 as vx,bD as Hh,c6 as za,bM as T_,C as fs,ag as wa,ah as ys,aG as zt,aH as Kn,aI as Ns,u as nn,aF as Kc,aO as x0,c9 as wW,aP as b0,dK as Z3,dL as CW,a as zn,c as Et,e as w0,dM as gm,dN as yW,dO as SW,dP as EW,dQ as kW,aL as e4,aK as Xr,dR as R_,dS as ol,dT as ry,dU as iy,dj as vl,ca as A_,cL as Bl,ct as xx,cs as _W,cr as Xs,cu as on,dV as t4,dW as TW,dX as BS,d as Ct,D as F_,dY as A2,dZ as RW,d_ as AW,d$ as jS,e0 as FW,e1 as DW,e2 as PW,e3 as IW,aB as Uh,e4 as F2,e5 as D2,e6 as NW,e7 as MW,e8 as OW,e9 as n4,ea as LW,eb as BW,ec as s4,ed as Dw,ee as Pw,ef as jW,eg as HW,eh as UW,ei as P2,ej as GW,ek as Dh,el as r4,em as $W,en as VW,eo as WW,ep as zW,eq as qW,er as KW,es as YW,et as i4,eu as XW,_ as Bi,ev as QW,a1 as gi,ew as a4,ex as JW,ey as I2,ez as ZW,eA as ez,eB as ji,eC as Iw,eD as o4,eE as tz,eF as nz,eG as N2,eH as sz,eI as rz,aQ as Yf,eJ as iz,eK as az,eL as oz,bn as l4,eM as c4,eN as Fg,eO as lz,eP as cz,eQ as uz,eR as dz,eS as hz,bC as Ho,eT as fz,eU as pz,bB as ud,eV as dd,eW as gz,ac as D_,eX as M2,eY as mz,eZ as vz,e_ as xz,e$ as bz,f0 as wz,f1 as Cz,f2 as Ch,cP as yz,f3 as Sz,f4 as Ez,cS as kz,f5 as Nw,f6 as HS,f7 as _z,f8 as Tz,f9 as Rz,as as zu,$ as Az,fa as u4,aS as d4,aU as Ja,fb as h4,aM as P_,cM as Mw,Z as Md,bI as hd,cg as Ow,bz as fd,fc as Fz,fd as Dz,fe as Pz,ff as Iz,fg as Nz,fh as Mz,fi as Oz,fj as Lz,fk as O2,fl as Bz,fm as jz,fn as I_,fo as L2,cU as Hz,fp as Uz,fq as f4,fr as Gz,fs as $z,ft as p4,fu as B2,fv as Vz,fw as Gh,fx as Xf,fy as Wz,fz as N_,bG as zz,fA as qz,fB as Kz,fC as j2,fD as Yz,fE as Xz,fF as Lw,fG as Qz,fH as Jz,fI as g4,fJ as m4,fK as Zz,fL as v4,fM as Yx,fN as eq,fO as tq,fP as nq,fQ as sq,fR as rq,fS as iq,fT as aq,au as ls,fU as oq,at as wc,fV as x4,fW as b4,fX as lq,ax as Ro,fY as cq,fZ as uq,ci as Bw,cj as C0,f_ as jw,f$ as Ca,g0 as dq,g1 as _n,g2 as en,g3 as y0,g4 as mm,g5 as Hw,g6 as M_,g7 as Uw,g8 as hq,g9 as fq,ga as pq,gb as fn,gc as vm,gd as w4,ge as oa,gf as pd,gg as gq,gh as mq,gi as vq,gj as xq,gk as H2,gl as bq,gm as wq,gn as Cq,ch as yq,go as Sq,gp as $h,gq as C4,gr as y4,gs as O_,gt as Xx,gu as S4,V as L_,gv as US,gw as B_,gx as ay,gy as Eq,gz as kq,gA as _q,gB as Ph,gC as GS,gD as E4,gE as Tq,gF as k4,gG as Rq,gH as Aq,gI as Fq,gJ as Dq,gK as Pq,gL as Iq,gM as Nq,gN as Mq,gO as Oq,gP as Lq,gQ as Qx,gR as Bq,gS as jq,gT as Hq,gU as Uq,gV as Gq,gW as $q,gX as j_,gY as Vq,gZ as _4,I as tt,g_ as Wq,g$ as Gw,h0 as Qf,bL as T4,bP as zq,h1 as U2,bi as R4,h2 as qq,h3 as Kq,h4 as Yq,h5 as Xq,h6 as Qq,h7 as Jq,az as wr,h8 as Zq,h9 as eK,ha as tK,hb as nK,hc as sK,hd as rK,he as iK,hf as aK,hg as oK,hh as lK,hi as cK,hj as uK,hk as A4,hl as $w,hm as H_,hn as U_,ho as bf,hp as Vw,hq as G_,hr as dK,hs as hK,ht as fK,hu as F4,hv as pK,hw as G2,hx as gK,hy as $_,hz as mK,hA as V_,hB as S0,hC as E0,hD as vK,hE as D4,hF as xm,hG as xK,hH as bK,hI as wK,hJ as CK,hK as yK,hL as SK,hM as $2,hN as P4,cd as I4,hO as EK,hP as kK,cf as W_,hQ as _K,aT as Ww,hR as TK,hS as RK,hT as V2,hU as AK,hV as FK,hW as N4,hX as W2,hY as DK,hZ as PK,h_ as IK,h$ as M4,b as NK,i0 as oy,i1 as MK,i2 as O4,by as Dg,i3 as z_,dF as OK,i4 as LK,bO as q_,i5 as Rc,i6 as K_,i7 as L4,i8 as BK,bu as jK,bv as zw,bs as wf,i9 as B4,ia as HK,ib as j4,ic as H4,cq as ly,aJ as k0,id as z2,ie as UK,ig as Jx,ih as q2,ii as GK,ij as $K,ik as VK,il as WK,im as U4,io as $S,ip as yh,iq as zK,ir as qK,is as G4,c3 as KK,br as YK,it as XK,iu as QK,iv as JK,iw as ZK,ix as eY,dc as tY,iy as nY,iz as Y_,iA as sY,iB as rY,iC as hv,iD as $4,iE as VS,a7 as K2,iF as iY,iG as aY,iH as oY,iI as qu,de as V4,df as X_,iJ as lY,iK as cY,iL as uY,iM as W4,cb as dY,iN as Y2,ad as X2,iO as hY,iP as z4,iQ as fY,iR as pY,iS as Q2,iT as gY,bk as J2,bl as Z2,bm as eF,aA as mY,iU as vY,iV as xY,iW as bY,iX as wY,iY as ah,iZ as oh,i_ as CY,i$ as yY,j0 as SY,j1 as EY,j2 as q4,j3 as kY,j4 as K4,j5 as WS,j6 as zS,j7 as cy,j8 as _Y,j9 as TY,ja as Sh,jb as RY,ap as Zx,ar as Y4,av as AY,a9 as tF,jc as FY,jd as DY,je as PY,jf as IY,jg as NY,jh as MY,ji as OY,jj as X4,jk as LY,jl as qS,jm as bx,jn as Q4,jo as J4,jp as BY,jq as jY,jr as HY,js as UY,jt as Z4,ju as Jf,jv as GY,jw as $Y,jx as Q_,bo as VY,jy as WY,jz as zY,jA as qY,jB as KY,jC as YY,jD as XY,jE as QY,jF as JY,jG as ZY,jH as eX,bj as tX,jI as nF,jJ as nX,jK as uy,jL as sF,jM as sX,jN as rX,jO as iX,jP as aX,jQ as oX,jR as lX,jS as cX,jT as uX,jU as dX,jV as hX,jW as fX,jX as pX,jY as gX,jZ as rF,j_ as mX,j$ as vX,ak as xX,al as bX,am as wX,an as CX,ao as yX,k0 as SX,k1 as EX,k2 as kX,k3 as _X,k4 as TX,k5 as RX,k6 as AX,aw as FX,k7 as DX,k8 as PX,k9 as IX,ka as iF,cT as eB,kb as J_,kc as NX,aR as tB,kd as nB,ke as MX,kf as OX,kg as sB,kh as LX,ki as Cr,kj as BX,kk as uc,kl as rB,km as iB,cA as aB,kn as oB,ko as Z_,kp as _i,kq as jX,kr as HX,ks as UX,kt as GX,ku as $X,kv as VX,kw as WX,kx as zX,ky as qX,kz as KX,kA as YX,kB as lB,kC as XX,kD as QX,kE as JX,kF as ZX,kG as eQ,kH as KS,kI as tQ,kJ as nQ,kK as aF,kL as cB,kM as sQ,kN as rQ,kO as iQ,kP as oF,kQ as aQ,kR as oQ,kS as lQ,kT as cQ,kU as uQ,kV as dQ,kW as hQ,kX as fQ,kY as uB,kZ as pQ,k_ as gQ,db as eb,k$ as mQ,bH as vQ,d6 as xQ,l0 as lF,l1 as bQ,l2 as wQ,l3 as CQ,cH as yQ,cZ as SQ,l4 as EQ,l5 as kQ,l6 as _Q,l7 as TQ,B as dB,cY as cF,l8 as RQ,ae as AQ,bA as jl,l9 as FQ,la as DQ,lb as PQ,lc as ti,aV as uF,ld as tb,le as dF,lf as IQ,lg as dy,lh as hy,li as hF,lj as fy,lk as fF,ll as hB,lm as fB,ln as pB,lo as NQ,aC as MQ,aD as OQ,lp as LQ,aE as BQ}from"./conversation-input-sync-BX8IVirL.js";import{c as dt,ae as jQ,af as gB,ag as HQ,ah as UQ,ai as GQ,aj as $Q,ak as VQ,al as WQ,am as Np,an as zQ,e as Od,S as vn,p as to,B as ae,L as sr,I as Ss,T as eT,g as Ms,X as Nn,ao as YS,ap as Bu,x as va,w as di,o as _0,h as Cf,ad as qw,l as nt,$ as Zf,D as Yc,a as Xc,b as Kw,d as Al,A as zr,f as Yw,z as bm,F as wm,G as Cm,H as ym,J as Sm,q as Fl,r as Uo,s as Dl,t as XS,u as qr,v as Ut,aq as T0,y as Lc,ab as mB,ar as QS,as as qQ,at as KQ,au as YQ,W as vB,Y as xB,Z as JS,k as wx,ac as XQ,a0 as Em,a1 as bB,a2 as yf,av as Vh,aw as QQ,K as pF,i as wB,ax as JQ,j as CB,ay as ZQ,az as gF,a3 as eJ,a9 as ZS,C as tJ,aA as Mp,aB as tT,M as nT,_ as nJ,a4 as sJ,a5 as rJ,a6 as iJ,a7 as aJ,a8 as oJ,aC as lJ,aD as cJ,aE as uJ,aF as dJ,aG as yB,m as mF,n as vF,E as hJ}from"./error-boundary-BDLNfQKz.js";import{W as py,v as R0,u as qe,w as SB,x as EB,S as fJ,y as kB,z as pJ,R as gJ,A as mJ,e as A0,B as xl,t as Z,C as xF,E as vJ,F as xJ,G as bJ,M as bF,H as Xw,I as wJ,J as CJ,N as cg,O as yJ,Q as _B,U as gy,V as SJ,X as wF,Y as CF,Z as EJ,_ as yF,$ as kJ,a0 as mu,a1 as fv,a2 as _J,a3 as TJ,a4 as RJ,a5 as SF,a6 as EF,a7 as AJ,a8 as FJ,a9 as DJ,aa as PJ,ab as kF,ac as _F,ad as TF,ae as IJ,af as NJ,ag as MJ,ah as OJ,ai as LJ,aj as RF,ak as BJ,al as jJ,am as AF,an as HJ,ao as UJ,ap as GJ,aq as $J,ar as VJ,as as WJ,at as TB,r as FF,au as zJ,T as qJ,av as KJ,aw as YJ,ax as XJ,ay as pv,az as gv,aA as DF,aB as mv,aC as vv,aD as PF,aE as IF,aF as QJ,aG as Cx,aH as JJ,aI as ZJ,aJ as eZ,L as Fo,aK as tZ,aL as nZ,g as sZ,aM as NF,aN as rZ,aO as iZ,aP as MF,aQ as aZ}from"./messages-Yrm2FT2V.js";import{C as oZ}from"./console-mirror-DpL-JwpC.js";const eE=8e3,RB=1e4;function lZ(e){return e?`“${e}”`:"Conversation"}const cZ="archived.";function uZ(e){return Ee.getState().archiveFacts[e]}function dZ(e){const t=Ee.getState(),n=t.archiveFacts[e];return n?n.archived:t.sessions.find(s=>s.session_id===e)?.archived}function hZ(){const e=Ee(t=>t.archiveUndo);g.useEffect(()=>{if(e===null)return;let t=!1;const n=()=>{t||(t=!0,r())},s=()=>{n();const i=Ee.getState().archiveUndo;i!==null&&i.sessionId===e.sessionId&&i.at===e.at&&Ee.getState().setArchiveUndo(null)},r=Ee.subscribe(()=>{const i=uZ(e.sessionId);i!==void 0&&!i.answered||bW(e.archived,dZ(e.sessionId))||s()});return n},[e])}function fZ(e){return e===1?"Draft":`${e} drafts`}const pZ="discarded.",gZ=e=>{const t=LS(e),n=t.length,s=t.filter(o=>!o.active).length,r=n===1?"chat":"chats",i=e.filter(o=>Fw(o)!==null&&LS([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`:""}},AB=e=>e===1?"1 lives on another device and clears when that device updates.":`${e} live on other devices and clear when those devices update.`,mZ=e=>{if(e.attempted===0)return{tone:"success",message:"Nothing to clear."};const t=e.unknown-e.deferred,n=[e.superseded>0?`${e.superseded} ${e.superseded===1?"has a newer result and stays":"have newer results and stay"} unread.`:null,t>0?`${t} could not be cleared and ${t===1?"stays":"stay"} unread.`:null,e.deferred>0?AB(e.deferred):null].filter(s=>s!==null);return e.cleared===0?{tone:"warning",message:["Nothing was cleared.",...n].join(" ")}:{tone:"success",message:[`Marked ${e.cleared} ${e.cleared===1?"chat":"chats"} as read.`,...n].join(" ")}},my="archive",OF="drafts-undo",LF="bulk-read-deferral",vZ=8e3;function xZ(){const e=Ee(h=>h.archiveFailure),t=Ee(h=>h.archiveUndo),n=Ee(h=>h.draftsUndo),s=Ee(h=>h.bulkReadDeferral),r=Ee(h=>h.clearArchiveFailure),i=Ee(h=>h.setArchiveUndo),a=Ee(h=>h.setSessionArchived),o=Ee(h=>h.restoreDraftsUndo);hZ();const l=g.useRef(null);g.useEffect(()=>{if(e===null&&t===null){if(l.current===null)return;l.current=null,vx(my);return}const h=e&&t?t.at>e.at?"offer":"failure":e?"failure":"offer",f=h==="offer"?t?.at??0:e?.at??0,p=l.current;l.current={kind:h,at:f},p!==null&&p.kind!==h&&f>p.at&&(h==="failure"?i(null):r());const m=(v,x)=>()=>{const b=Ee.getState();v==="offer"?b.archiveUndo?.at===x&&b.setArchiveUndo(null):b.archiveFailure?.at===x&&b.clearArchiveFailure();const w=l.current;w!==null&&w.kind===v&&w.at===x&&(l.current=null)};if(h==="failure"&&e){Hh(`Could not ${e.archived?"archive":"unarchive"} “${e.title}”.${e.detail?` ${e.detail}`:""}`,{id:my,duration:RB,onAutoClose:m("failure",e.at),onDismiss:m("failure",e.at),action:{label:"Retry",onClick:v=>{v.preventDefault(),a(e.sessionId,e.archived,e.title)}}});return}t&&za(c.jsxs("span",{className:_("flex min-w-0 items-baseline gap-1"),children:[c.jsx("span",{className:_("min-w-0 truncate"),children:lZ(t.title)}),c.jsx("span",{className:_("shrink-0"),children:cZ})]}),{id:my,duration:eE,classNames:{content:"min-w-0"},onAutoClose:m("offer",t.at),onDismiss:m("offer",t.at),action:{label:"Undo",onClick:v=>{v.preventDefault(),a(t.sessionId,!t.archived,t.title)}}})},[e,t,i,r,a]);const u=g.useRef(!1);g.useEffect(()=>{if(n===null){if(!u.current)return;u.current=!1,vx(OF);return}u.current=!0;const h=()=>{const f=Ee.getState();f.draftsUndo?.at===n.at&&(f.setDraftsUndo(null),u.current=!1)};za(c.jsxs("span",{className:_("flex min-w-0 items-baseline gap-1"),children:[c.jsx("span",{className:_("min-w-0 truncate"),children:fZ(n.keys.length)}),c.jsx("span",{className:_("shrink-0"),children:pZ})]}),{id:OF,duration:eE,classNames:{content:"min-w-0"},onAutoClose:h,onDismiss:h,action:{label:"Undo",onClick:f=>{f.preventDefault(),o();const p=Ee.getState(),m=p.stagedByDiscard;p.setStagedByDiscard(null),n.keys.length===1&&m!==null&&Ee.getState().activeDraftKey===m&&Ee.getState().openDraft(n.keys[0])}}})},[n,o]);const d=g.useRef(!1);return g.useEffect(()=>{if(s===null){if(!d.current)return;d.current=!1,vx(LF);return}d.current=!0;const h=()=>{const f=Ee.getState();f.bulkReadDeferral?.at===s.at&&(f.clearBulkReadDeferral(),d.current=!1)};za(AB(s.count),{id:LF,duration:vZ,onAutoClose:h,onDismiss:h})},[s]),null}var Ga,Be=typeof window<"u"?window:void 0,oi=typeof globalThis<"u"?globalThis:Be,FB=Array.prototype,BF=FB.forEach,jF=FB.indexOf,Di=oi?.navigator,yt=oi?.document,ii=oi?.location,tE=oi?.fetch,nE=oi!=null&&oi.XMLHttpRequest&&"withCredentials"in new oi.XMLHttpRequest?oi.XMLHttpRequest:void 0,HF=oi?.AbortController,Ds=Di?.userAgent,Gt=Be??{},hl={DEBUG:!1,LIB_VERSION:"1.235.6"},vy="$copy_autocapture",bZ=["$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"})(Ga||(Ga={}));var wZ=["fatal","error","warning","log","info","debug"];function Zt(e,t){return e.indexOf(t)!==-1}var Qw=function(e){return e.trim()},sT=function(e){return e.replace(/^\$/,"")},CZ=Array.isArray,DB=Object.prototype,PB=DB.hasOwnProperty,Jw=DB.toString,cs=CZ||function(e){return Jw.call(e)==="[object Array]"},qa=e=>typeof e=="function",us=e=>e===Object(e)&&!cs(e),Ih=e=>{if(us(e)){for(var t in e)if(PB.call(e,t))return!1;return!0}return!1},xt=e=>e===void 0,Is=e=>Jw.call(e)=="[object String]",sE=e=>Is(e)&&e.trim().length===0,Qc=e=>e===null,kn=e=>xt(e)||Qc(e),Wr=e=>Jw.call(e)=="[object Number]",pl=e=>Jw.call(e)==="[object Boolean]",yZ=e=>e instanceof FormData,SZ=e=>Zt(bZ,e),IB=e=>{var t={_log:function(n){if(Be&&(hl.DEBUG||Gt.POSTHOG_DEBUG)&&!xt(Be.console)&&Be.console){for(var s=("__rrweb_original__"in Be.console[n])?Be.console[n].__rrweb_original__:Be.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=>IB("".concat(e," ").concat(n))};return t},_t=IB("[PostHog.js]"),Fr=_t.createLogger,EZ=Fr("[ExternalScriptsLoader]"),UF=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return EZ.warn("".concat(t," was requested but loading of external scripts is disabled.")),n("Loading of external scripts is disabled");var s=yt?.querySelectorAll("script");if(s){for(var r=0;r<s.length;r++)if(s[r].src===t)return n()}var i=()=>{if(!yt)return n("document not found");var a=yt.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=yt.querySelectorAll("body > script");l.length>0?(o=l[0].parentNode)===null||o===void 0||o.insertBefore(a,l[0]):yt.body.appendChild(a)};yt!=null&&yt.body?i():yt?.addEventListener("DOMContentLoaded",i)};function GF(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 $e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?GF(Object(n),!0).forEach(function(s){ct(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):GF(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function ct(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function NB(e,t){if(e==null)return{};var n,s,r=function(a,o){if(a==null)return{};var l,u,d={},h=Object.keys(a);for(u=0;u<h.length;u++)l=h[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}Gt.__PosthogExtensions__=Gt.__PosthogExtensions__||{},Gt.__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);UF(e,a,n)},Gt.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var s=e.requestRouter.endpointFor("api",t);UF(e,s,n)};var nb={};function Ac(e,t,n){if(cs(e)){if(BF&&e.forEach===BF)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)===nb)return}}}function Pn(e,t,n){if(!kn(e)){if(cs(e))return Ac(e,t,n);if(yZ(e)){for(var s of e.entries())if(t.call(n,s[1],s[0])===nb)return}else for(var r in e)if(PB.call(e,r)&&t.call(n,e[r],r)===nb)return}}var vs=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 Ac(n,function(r){for(var i in r)r[i]!==void 0&&(e[i]=r[i])}),e},yx=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 Ac(n,function(r){Ac(r,function(i){e.push(i)})}),e};function Sx(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 $F=function(e){try{return e()}catch{return}},kZ=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){_t.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),_t.critical(r)}}},km=function(e){var t={};return Pn(e,function(n,s){Is(n)&&n.length>0&&(t[s]=n)}),t};function _Z(e,t){return n=e,s=i=>Is(i)&&!Qc(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),cs(a)?(l=[],Ac(a,u=>{l.push(i(u))})):(l={},Pn(a,(u,d)=>{r.has(u)||(l[d]=i(u,d))})),l);var l}(n);var n,s,r}var TZ=["herokuapp.com","vercel.app","netlify.app"];function RZ(e){var t=e?.hostname;if(!Is(t))return!1;var n=t.split(".").slice(-2).join(".");for(var s of TZ)if(n===s)return!1;return!0}function MB(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function bs(e,t,n,s){var{capture:r=!1,passive:i=!0}=s??{};e?.addEventListener(t,n,{capture:r,passive:i})}var OB="$people_distinct_id",ug="__alias",dg="__timers",VF="$autocapture_disabled_server_side",rE="$heatmaps_enabled_server_side",WF="$exception_capture_enabled_server_side",zF="$web_vitals_enabled_server_side",LB="$dead_clicks_enabled_server_side",qF="$web_vitals_allowed_metrics",iE="$session_recording_enabled_server_side",KF="$console_log_recording_enabled_server_side",YF="$session_recording_network_payload_capture",XF="$session_recording_masking",QF="$session_recording_canvas_recording",JF="$replay_sample_rate",ZF="$replay_minimum_duration",eD="$replay_script_config",sb="$sesid",hg="$session_is_sampled",xy="$session_recording_url_trigger_activated_session",by="$session_recording_event_trigger_activated_session",Nh="$enabled_feature_flags",Ex="$early_access_features",aE="$feature_flag_details",fg="$stored_person_properties",Eu="$stored_group_properties",oE="$surveys",xv="$surveys_activated",rb="$flag_call_reported",cl="$user_state",lE="$client_session_props",cE="$capture_rate_limit",uE="$initial_campaign_params",dE="$initial_referrer_info",hE="$initial_person_info",ib="$epp",BB="__POSTHOG_TOOLBAR__",tD="$posthog_cookieless",AZ=[OB,ug,"__cmpns",dg,iE,rE,sb,Nh,cl,Ex,aE,Eu,fg,oE,rb,lE,cE,uE,dE,ib];function nD(e){var t;return e instanceof Element&&(e.id===BB||!((t=e.closest)===null||t===void 0||!t.call(e,".toolbar-global-fade-container")))}function Zw(e){return!!e&&e.nodeType===1}function Fc(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function jB(e){return!!e&&e.nodeType===3}function HB(e){return!!e&&e.nodeType===11}function rT(e){return e?Qw(e).split(/\s+/):[]}function sD(e){var t=Be?.location.href;return!!(t&&e&&e.some(n=>t.match(n)))}function ab(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 rT(t)}function UB(e){return kn(e)?null:Qw(e).split(/(\s+)/).filter(t=>Sf(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function eC(e){var t="";return pE(e)&&!VB(e)&&e.childNodes&&e.childNodes.length&&Pn(e.childNodes,function(n){var s;jB(n)&&n.textContent&&(t+=(s=UB(n.textContent))!==null&&s!==void 0?s:"")}),Qw(t)}function GB(e){return xt(e.target)?e.srcElement||null:(t=e.target)!==null&&t!==void 0&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var fE=["a","button","form","input","select","textarea","label"];function $B(e){var t=e.parentNode;return!(!t||!Zw(t))&&t}function FZ(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(!Be||!e||Fc(e,"html")||!Zw(e)||n!=null&&n.url_allowlist&&!sD(n.url_allowlist)||n!=null&&n.url_ignorelist&&sD(n.url_ignorelist))return!1;if(n!=null&&n.dom_event_allowlist){var i=n.dom_event_allowlist;if(i&&!i.some(p=>t.type===p))return!1}for(var a=!1,o=[e],l=!0,u=e;u.parentNode&&!Fc(u,"body");)if(HB(u.parentNode))o.push(u.parentNode.host),u=u.parentNode.host;else{if(!(l=$B(u)))break;if(s||fE.indexOf(l.tagName.toLowerCase())>-1)a=!0;else{var d=Be.getComputedStyle(l);d&&d.getPropertyValue("cursor")==="pointer"&&(a=!0)}o.push(l),u=l}if(!function(p,m){var v=m?.element_allowlist;if(xt(v))return!0;var x=function(C){if(v.some(k=>C.tagName.toLowerCase()===k))return{v:!0}};for(var b of p){var w=x(b);if(typeof w=="object")return w.v}return!1}(o,n)||!function(p,m){var v=m?.css_selector_allowlist;if(xt(v))return!0;var x=function(C){if(v.some(k=>C.matches(k)))return{v:!0}};for(var b of p){var w=x(b);if(typeof w=="object")return w.v}return!1}(o,n))return!1;var h=Be.getComputedStyle(e);if(h&&h.getPropertyValue("cursor")==="pointer"&&t.type==="click")return!0;var f=e.tagName.toLowerCase();switch(f){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&&(fE.indexOf(f)>-1||e.getAttribute("contenteditable")==="true")}}function pE(e){for(var t=e;t.parentNode&&!Fc(t,"body");t=t.parentNode){var n=ab(t);if(Zt(n,"ph-sensitive")||Zt(n,"ph-no-capture"))return!1}if(Zt(ab(e),"ph-include"))return!0;var s=e.type||"";if(Is(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";return!(Is(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 VB(e){return!!(Fc(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Fc(e,"select")||Fc(e,"textarea")||e.getAttribute("contenteditable")==="true")}var WB="(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})",DZ=new RegExp("^(?:".concat(WB,")$")),PZ=new RegExp(WB),zB="\\d{3}-?\\d{2}-?\\d{4}",IZ=new RegExp("^(".concat(zB,")$")),NZ=new RegExp("(".concat(zB,")"));function Sf(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(kn(e)||Is(e)&&(e=Qw(e),(t?DZ:PZ).test((e||"").replace(/[- ]/g,""))||(t?IZ:NZ).test(e)))}function qB(e){var t=eC(e);return Sf(t="".concat(t," ").concat(KB(e)).trim())?t:""}function KB(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Pn(e.childNodes,function(n){var s;if(n&&((s=n.tagName)===null||s===void 0?void 0:s.toLowerCase())==="span")try{var r=eC(n);t="".concat(t," ").concat(r).trim(),n.childNodes&&n.childNodes.length&&(t="".concat(t," ").concat(KB(n)).trim())}catch(i){_t.error("[AutoCapture]",i)}}),t}function MZ(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=$e($e($e($e({},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 Sx(l).sort((d,h)=>{var[f]=d,[p]=h;return f.localeCompare(p)}).forEach(d=>{var[h,f]=d;return u[rD(h.toString())]=rD(f.toString())}),a+=":",a+=Sx(l).map(d=>{var[h,f]=d;return"".concat(h,'="').concat(f,'"')}).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:OZ(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return Sx(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 rD(e){return e.replace(/"|\\"/g,'\\"')}function OZ(e){var t=e.attr__class;return t?cs(t)?t:rT(t):void 0}class YB{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 LZ=["localhost","127.0.0.1"],Wh=e=>{var t=yt?.createElement("a");return xt(t)?null:(t.href=e,t)},BZ=function(e){var t,n,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",r=[];return Pn(e,function(i,a){xt(i)||xt(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)},ob=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(!cs(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch{_t.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},wy=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=[],h=0;h<u.length;h++){var f=u[h].split("=");cs(f)&&(t.includes(f[0])?d.push(f[0]+"="+n):d.push(u[h]))}var p=l;return o!=null&&(p+="?"+d.join("&")),i!=null&&(p+="#"+i),p},lb=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},iD=Fr("[AutoCapture]");function Cy(e,t){return t.length>e?t.slice(0,e)+"...":t}function jZ(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!Zw(t));return t}function HZ(e,t,n,s){var r=e.tagName.toLowerCase(),i={tag_name:r};fE.indexOf(r)>-1&&!n&&(r.toLowerCase()==="a"||r.toLowerCase()==="button"?i.$el_text=Cy(1024,qB(e)):i.$el_text=Cy(1024,eC(e)));var a=ab(e);a.length>0&&(i.classes=a.filter(function(d){return d!==""})),Pn(e.attributes,function(d){var h;if((!VB(e)||["name","id","class","aria-label"].indexOf(d.name)!==-1)&&(s==null||!s.includes(d.name))&&!t&&Sf(d.value)&&(h=d.name,!Is(h)||h.substring(0,10)!=="_ngcontent"&&h.substring(0,7)!=="_nghost")){var f=d.value;d.name==="class"&&(f=rT(f).join(" ")),i["attr__"+d.name]=Cy(1024,f)}});for(var o=1,l=1,u=e;u=jZ(u);)o++,u.tagName===e.tagName&&l++;return i.nth_child=o,i.nth_of_type=l,i}function UZ(e,t){for(var n,s,{e:r,maskAllElementAttributes:i,maskAllText:a,elementAttributeIgnoreList:o,elementsChainAsString:l}=t,u=[e],d=e;d.parentNode&&!Fc(d,"body");)HB(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var h,f=[],p={},m=!1,v=!1;if(Pn(u,k=>{var y=pE(k);k.tagName.toLowerCase()==="a"&&(m=k.getAttribute("href"),m=y&&m&&Sf(m)&&m),Zt(ab(k),"ph-no-capture")&&(v=!0),f.push(HZ(k,i,a,o));var E=function(T){if(!pE(T))return{};var F={};return Pn(T.attributes,function(R){if(R.name&&R.name.indexOf("data-ph-capture-attribute")===0){var I=R.name.replace("data-ph-capture-attribute-",""),N=R.value;I&&N&&Sf(N)&&(F[I]=N)}}),F}(k);vs(p,E)}),v)return{props:{},explicitNoCapture:v};if(a||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?f[0].$el_text=qB(e):f[0].$el_text=eC(e)),m){var x,b;f[0].attr__href=m;var w=(x=Wh(m))===null||x===void 0?void 0:x.host,C=Be==null||(b=Be.location)===null||b===void 0?void 0:b.host;w&&C&&w!==C&&(h=m)}return{props:vs({$event_type:r.type,$ce_version:1},l?{}:{$elements:f},{$elements_chain:MZ(f)},(n=f[0])!==null&&n!==void 0&&n.$el_text?{$el_text:(s=f[0])===null||s===void 0?void 0:s.$el_text}:{},h&&r.type==="click"?{$external_click_url:h}:{},p)}}let GZ=class{constructor(t){ct(this,"_initialized",!1),ct(this,"_isDisabledServerSide",null),ct(this,"rageclicks",new YB),ct(this,"_elementsChainAsString",!1),this.instance=t,this._elementSelectors=null}get config(){var t,n,s=us(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(Be&&yt){var t=s=>{s=s||Be?.event;try{this._captureEvent(s)}catch(r){iD.error("Failed to capture event",r)}};if(bs(yt,"submit",t,{capture:!0}),bs(yt,"change",t,{capture:!0}),bs(yt,"click",t,{capture:!0}),this.config.capture_copied_text){var n=s=>{s=s||Be?.event,this._captureEvent(s,vy)};bs(yt,"copy",n,{capture:!0}),bs(yt,"cut",n,{capture:!0})}}}else iD.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({[VF]:!!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=yt?.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[VF],r=this._isDisabledServerSide;if(Qc(r)&&!pl(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=GB(t);jB(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===vy;if(r&&FZ(r,t,this.config,i,i?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:o}=UZ(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===vy){var u,d=UB(Be==null||(u=Be.getSelection())===null||u===void 0?void 0:u.toString()),h=t.type||"clipboard";if(!d)return!1;a.$selected_content=d,a.$copy_type=h}return this.instance.capture(n,a),!0}}}isBrowserSupported(){return qa(yt?.querySelectorAll)}};Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Wr(e)&&isFinite(e)&&Math.floor(e)===e});var aD="0123456789abcdef";let $Z=class gE{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 gE(i)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+aD.charAt(this.bytes[n]>>>4)+aD.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 gE(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}},VZ=class{constructor(){ct(this,"timestamp",0),ct(this,"counter",0),ct(this,"random",new WZ)}generate(){var t=this.generateOrAbort();if(xt(t)){this.timestamp=0;var n=this.generateOrAbort();if(xt(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 $Z.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 oD,XB=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};Be&&!xt(Be.crypto)&&crypto.getRandomValues&&(XB=e=>crypto.getRandomValues(e));let WZ=class{constructor(){ct(this,"buffer",new Uint32Array(8)),ct(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(XB(this.buffer),this.cursor=0),this.buffer[this.cursor++]}};var Cc=()=>zZ().toString(),zZ=()=>(oD||(oD=new VZ)).generate(),qZ="Thu, 01 Jan 1970 00:00:00 GMT",Op="",KZ=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function YZ(e,t){if(t){var n=function(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:yt;if(Op)return Op;if(!i||["localhost","127.0.0.1"].includes(r))return"";for(var a=r.split("."),o=Math.min(a.length,8),l="dmn_chk_"+Cc(),u=new RegExp("(^|;)\\s*"+l+"=1");!Op&&o--;){var d=a.slice(o).join("."),h=l+"=1;domain=."+d;i.cookie=h,u.test(i.cookie)&&(i.cookie=h+";expires="+qZ,Op=d)}return Op}(e);if(!n){var s=(r=>{var i=r.match(KZ);return i?i[0]:""})(e);s!==n&&_t.info("Warning: cookie subdomain discovery mismatch",s,n),n=s}return n?"; domain=."+n:""}return""}var gc,wl={is_supported:()=>!!yt,error:function(e){_t.error("cookieStore error: "+e)},get:function(e){if(yt){try{for(var t=e+"=",n=yt.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(wl.get(e))||{}}catch{}return t},set:function(e,t,n,s,r){if(yt)try{var i="",a="",o=YZ(yt.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&&_t.warn("cookieStore warning: large cookie, len="+u.length),yt.cookie=u,u}catch{return}},remove:function(e,t){try{wl.set(e,"",-1,t)}catch{return}}},yy=null,Bs={is_supported:function(){if(!Qc(yy))return yy;var e=!0;if(xt(Be))e=!1;else try{var t="__mplssupport__";Bs.set(t,"xyz"),Bs.get(t)!=='"xyz"'&&(e=!1),Bs.remove(t)}catch{e=!1}return e||_t.error("localStorage unsupported; falling back to cookie store"),yy=e,e},error:function(e){_t.error("localStorage error: "+e)},get:function(e){try{return Be?.localStorage.getItem(e)}catch(t){Bs.error(t)}return null},parse:function(e){try{return JSON.parse(Bs.get(e))||{}}catch{}return null},set:function(e,t){try{Be?.localStorage.setItem(e,JSON.stringify(t))}catch(n){Bs.error(n)}},remove:function(e){try{Be?.localStorage.removeItem(e)}catch(t){Bs.error(t)}}},XZ=["distinct_id",sb,hg,ib,hE],bv=$e($e({},Bs),{},{parse:function(e){try{var t={};try{t=wl.parse(e)||{}}catch{}var n=vs(t,JSON.parse(Bs.get(e)||"{}"));return Bs.set(e,n),n}catch{}return null},set:function(e,t,n,s,r,i){try{Bs.set(e,t,void 0,void 0,i);var a={};XZ.forEach(o=>{t[o]&&(a[o]=t[o])}),Object.keys(a).length&&wl.set(e,a,n,s,r,i)}catch(o){Bs.error(o)}},remove:function(e,t){try{Be?.localStorage.removeItem(e),wl.remove(e,t)}catch(n){Bs.error(n)}}}),wv={},QZ={is_supported:function(){return!0},error:function(e){_t.error("memoryStorage error: "+e)},get:function(e){return wv[e]||null},parse:function(e){return wv[e]||null},set:function(e,t){wv[e]=t},remove:function(e){delete wv[e]}},vu=null,dr={is_supported:function(){if(!Qc(vu))return vu;if(vu=!0,xt(Be))vu=!1;else try{var e="__support__";dr.set(e,"xyz"),dr.get(e)!=='"xyz"'&&(vu=!1),dr.remove(e)}catch{vu=!1}return vu},error:function(e){_t.error("sessionStorage error: ",e)},get:function(e){try{return Be?.sessionStorage.getItem(e)}catch(t){dr.error(t)}return null},parse:function(e){try{return JSON.parse(dr.get(e))||null}catch{}return null},set:function(e,t){try{Be?.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){dr.error(n)}},remove:function(e){try{Be?.sessionStorage.removeItem(e)}catch(t){dr.error(t)}}};(function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"})(gc||(gc={}));let JZ=class{constructor(t){this.instance=t}get config(){return this.instance.config}get consent(){return this.getDnt()?gc.DENIED:this.storedConsent}isOptedOut(){return this.consent===gc.DENIED||this.consent===gc.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"?gc.GRANTED:t==="0"?gc.DENIED:gc.PENDING}get storage(){if(!this._storage){var t=this.config.opt_out_capturing_persistence_type;this._storage=t==="localStorage"?Bs:wl;var n=t==="localStorage"?wl:Bs;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&&!!MB([Di?.doNotTrack,Di?.msDoNotTrack,Gt.doNotTrack],t=>Zt([!0,1,"1","yes"],t))}};var Cv=Fr("[Dead Clicks]"),ZZ=()=>!0,eee=e=>{var t,n=!((t=e.instance.persistence)===null||t===void 0||!t.get_property(LB)),s=e.instance.config.capture_dead_clicks;return pl(s)?s:n};let QB=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({[LB]:t?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript(()=>{this.start()})}loadScript(t){var n,s,r;(n=Gt.__PosthogExtensions__)!==null&&n!==void 0&&n.initDeadClicksAutocapture&&t(),(s=Gt.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"dead-clicks-autocapture",i=>{i?Cv.error("failed to load script",i):t()})}start(){var t;if(yt){if(!this._lazyLoadedDeadClicksAutocapture&&(t=Gt.__PosthogExtensions__)!==null&&t!==void 0&&t.initDeadClicksAutocapture){var n=us(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=Gt.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this._lazyLoadedDeadClicksAutocapture.start(yt),Cv.info("starting...")}}else Cv.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,Cv.info("stopping..."))}};var Sy=Fr("[ExceptionAutocapture]");let tee=class{constructor(t){var n;ct(this,"startCapturing",()=>{var s;if(Be&&this.isEnabled&&(s=Gt.__PosthogExtensions__)!==null&&s!==void 0&&s.errorWrappingFunctions){var r=Gt.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Gt.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,a=Gt.__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){Sy.error("failed to start",o),this.stopCapturing()}}}),this.instance=t,this.remoteEnabled=!((n=this.instance.persistence)===null||n===void 0||!n.props[WF]),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 us(t)?n=$e($e({},n),t):(xt(t)?this.remoteEnabled:t)&&(n=$e($e({},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&&(Sy.info("enabled"),this.loadScript(this.startCapturing))}loadScript(t){var n,s,r;(n=Gt.__PosthogExtensions__)!==null&&n!==void 0&&n.errorWrappingFunctions&&t(),(s=Gt.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"exception-autocapture",i=>{if(i)return Sy.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({[WF]: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 JB(e){return!xt(Event)&&ZB(e,Event)}function ZB(e,t){try{return e instanceof t}catch{return!1}}function kx(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function Ey(e){return kx(e,"DOMError")}var lD=/\(error: (.*)\)/,cD=50,Mh="?";function ky(e,t,n,s){var r={platform:"web:javascript",filename:e,function:t==="<anonymous>"?Mh:t,in_app:!0};return xt(n)||(r.lineno=n),xt(s)||(r.colno=s),r}var nee=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,see=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ree=/\((\S*)(?::(\d+))(?::(\d+))\)/,iee=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,aee=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,oee=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-Ci1JjvpV.js","./index-B8qxAfMF.js","./index-D3f_KfVo.css","./publication-validation-mYDoNagz.js","./conversation-input-sync-DFpqmO4l.js","./messages-CZNg7vOE.js","./error-boundary-C6UV5tx-.js","./conversation-input-sync-CAX4_ErH.css","./use-memberships-query-DR_Lujnw.js","./use-download-agent-mutation-C7H5xbvf.js","./en-US-BcB1DWxG.js","./book-open-CTi9TDfn.js","./console-mirror-CxkpeCdB.js","./console-mirror-DOrYoP_4.css","./agent-hub-page-NtBm1phk.js","./page-header-CJAvj3rs.js","./org-access-BIipdCDk.js","./radient-auth-buttons-BJmqjZos.js","./format-CZUObkkr.js","./org-surface-gate-n0a6WDBY.js","./agents-page-YFjN8oZC.js","./schedules-page-CtMNJr6J.js","./parseISO-CZfAC2_J.js","./projects-page-Dg-fywlg.js","./use-session-snapshot-DKL97J-r.js","./browser-page-DEUUMy_g.js","./mesh-page-BzfNUAkq.js","./settings-page-CFbI2wWy.js","./notebook-pen-D7t7mRlh.js","./browser-webauthn-prompt-AacQARJZ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as g,j as c,c as _,b as Ve,f as R2,l as pW,u as gW,s as mW,v as OS,a as vW,R as xW}from"./index-B8qxAfMF.js";import{aq as Ee,dH as bW,dI as LS,dJ as Fw,c8 as vx,bD as Hh,c6 as za,bM as T_,C as fs,ag as wa,ah as ys,aG as zt,aH as Kn,aI as Ns,u as nn,aF as Kc,aO as x0,c9 as wW,aP as b0,dK as Z3,dL as CW,a as zn,c as Et,e as w0,dM as gm,dN as yW,dO as SW,dP as EW,dQ as kW,aL as e4,aK as Xr,dR as R_,dS as ol,dT as ry,dU as iy,dj as vl,ca as A_,cL as Bl,ct as xx,cs as _W,cr as Xs,cu as on,dV as t4,dW as TW,dX as BS,d as Ct,D as F_,dY as A2,dZ as RW,d_ as AW,d$ as jS,e0 as FW,e1 as DW,e2 as PW,e3 as IW,aB as Uh,e4 as F2,e5 as D2,e6 as NW,e7 as MW,e8 as OW,e9 as n4,ea as LW,eb as BW,ec as s4,ed as Dw,ee as Pw,ef as jW,eg as HW,eh as UW,ei as P2,ej as GW,ek as Dh,el as r4,em as $W,en as VW,eo as WW,ep as zW,eq as qW,er as KW,es as YW,et as i4,eu as XW,_ as Bi,ev as QW,a1 as gi,ew as a4,ex as JW,ey as I2,ez as ZW,eA as ez,eB as ji,eC as Iw,eD as o4,eE as tz,eF as nz,eG as N2,eH as sz,eI as rz,aQ as Yf,eJ as iz,eK as az,eL as oz,bn as l4,eM as c4,eN as Fg,eO as lz,eP as cz,eQ as uz,eR as dz,eS as hz,bC as Ho,eT as fz,eU as pz,bB as ud,eV as dd,eW as gz,ac as D_,eX as M2,eY as mz,eZ as vz,e_ as xz,e$ as bz,f0 as wz,f1 as Cz,f2 as Ch,cP as yz,f3 as Sz,f4 as Ez,cS as kz,f5 as Nw,f6 as HS,f7 as _z,f8 as Tz,f9 as Rz,as as zu,$ as Az,fa as u4,aS as d4,aU as Ja,fb as h4,aM as P_,cM as Mw,Z as Md,bI as hd,cg as Ow,bz as fd,fc as Fz,fd as Dz,fe as Pz,ff as Iz,fg as Nz,fh as Mz,fi as Oz,fj as Lz,fk as O2,fl as Bz,fm as jz,fn as I_,fo as L2,cU as Hz,fp as Uz,fq as f4,fr as Gz,fs as $z,ft as p4,fu as B2,fv as Vz,fw as Gh,fx as Xf,fy as Wz,fz as N_,bG as zz,fA as qz,fB as Kz,fC as j2,fD as Yz,fE as Xz,fF as Lw,fG as Qz,fH as Jz,fI as g4,fJ as m4,fK as Zz,fL as v4,fM as Yx,fN as eq,fO as tq,fP as nq,fQ as sq,fR as rq,fS as iq,fT as aq,au as ls,fU as oq,at as wc,fV as x4,fW as b4,fX as lq,ax as Ro,fY as cq,fZ as uq,ci as Bw,cj as C0,f_ as jw,f$ as Ca,g0 as dq,g1 as _n,g2 as en,g3 as y0,g4 as mm,g5 as Hw,g6 as M_,g7 as Uw,g8 as hq,g9 as fq,ga as pq,gb as fn,gc as vm,gd as w4,ge as oa,gf as pd,gg as gq,gh as mq,gi as vq,gj as xq,gk as H2,gl as bq,gm as wq,gn as Cq,ch as yq,go as Sq,gp as $h,gq as C4,gr as y4,gs as O_,gt as Xx,gu as S4,V as L_,gv as US,gw as B_,gx as ay,gy as Eq,gz as kq,gA as _q,gB as Ph,gC as GS,gD as E4,gE as Tq,gF as k4,gG as Rq,gH as Aq,gI as Fq,gJ as Dq,gK as Pq,gL as Iq,gM as Nq,gN as Mq,gO as Oq,gP as Lq,gQ as Qx,gR as Bq,gS as jq,gT as Hq,gU as Uq,gV as Gq,gW as $q,gX as j_,gY as Vq,gZ as _4,I as tt,g_ as Wq,g$ as Gw,h0 as Qf,bL as T4,bP as zq,h1 as U2,bi as R4,h2 as qq,h3 as Kq,h4 as Yq,h5 as Xq,h6 as Qq,h7 as Jq,az as wr,h8 as Zq,h9 as eK,ha as tK,hb as nK,hc as sK,hd as rK,he as iK,hf as aK,hg as oK,hh as lK,hi as cK,hj as uK,hk as A4,hl as $w,hm as H_,hn as U_,ho as bf,hp as Vw,hq as G_,hr as dK,hs as hK,ht as fK,hu as F4,hv as pK,hw as G2,hx as gK,hy as $_,hz as mK,hA as V_,hB as S0,hC as E0,hD as vK,hE as D4,hF as xm,hG as xK,hH as bK,hI as wK,hJ as CK,hK as yK,hL as SK,hM as $2,hN as P4,cd as I4,hO as EK,hP as kK,cf as W_,hQ as _K,aT as Ww,hR as TK,hS as RK,hT as V2,hU as AK,hV as FK,hW as N4,hX as W2,hY as DK,hZ as PK,h_ as IK,h$ as M4,b as NK,i0 as oy,i1 as MK,i2 as O4,by as Dg,i3 as z_,dF as OK,i4 as LK,bO as q_,i5 as Rc,i6 as K_,i7 as L4,i8 as BK,bu as jK,bv as zw,bs as wf,i9 as B4,ia as HK,ib as j4,ic as H4,cq as ly,aJ as k0,id as z2,ie as UK,ig as Jx,ih as q2,ii as GK,ij as $K,ik as VK,il as WK,im as U4,io as $S,ip as yh,iq as zK,ir as qK,is as G4,c3 as KK,br as YK,it as XK,iu as QK,iv as JK,iw as ZK,ix as eY,dc as tY,iy as nY,iz as Y_,iA as sY,iB as rY,iC as hv,iD as $4,iE as VS,a7 as K2,iF as iY,iG as aY,iH as oY,iI as qu,de as V4,df as X_,iJ as lY,iK as cY,iL as uY,iM as W4,cb as dY,iN as Y2,ad as X2,iO as hY,iP as z4,iQ as fY,iR as pY,iS as Q2,iT as gY,bk as J2,bl as Z2,bm as eF,aA as mY,iU as vY,iV as xY,iW as bY,iX as wY,iY as ah,iZ as oh,i_ as CY,i$ as yY,j0 as SY,j1 as EY,j2 as q4,j3 as kY,j4 as K4,j5 as WS,j6 as zS,j7 as cy,j8 as _Y,j9 as TY,ja as Sh,jb as RY,ap as Zx,ar as Y4,av as AY,a9 as tF,jc as FY,jd as DY,je as PY,jf as IY,jg as NY,jh as MY,ji as OY,jj as X4,jk as LY,jl as qS,jm as bx,jn as Q4,jo as J4,jp as BY,jq as jY,jr as HY,js as UY,jt as Z4,ju as Jf,jv as GY,jw as $Y,jx as Q_,bo as VY,jy as WY,jz as zY,jA as qY,jB as KY,jC as YY,jD as XY,jE as QY,jF as JY,jG as ZY,jH as eX,bj as tX,jI as nF,jJ as nX,jK as uy,jL as sF,jM as sX,jN as rX,jO as iX,jP as aX,jQ as oX,jR as lX,jS as cX,jT as uX,jU as dX,jV as hX,jW as fX,jX as pX,jY as gX,jZ as rF,j_ as mX,j$ as vX,ak as xX,al as bX,am as wX,an as CX,ao as yX,k0 as SX,k1 as EX,k2 as kX,k3 as _X,k4 as TX,k5 as RX,k6 as AX,aw as FX,k7 as DX,k8 as PX,k9 as IX,ka as iF,cT as eB,kb as J_,kc as NX,aR as tB,kd as nB,ke as MX,kf as OX,kg as sB,kh as LX,ki as Cr,kj as BX,kk as uc,kl as rB,km as iB,cA as aB,kn as oB,ko as Z_,kp as _i,kq as jX,kr as HX,ks as UX,kt as GX,ku as $X,kv as VX,kw as WX,kx as zX,ky as qX,kz as KX,kA as YX,kB as lB,kC as XX,kD as QX,kE as JX,kF as ZX,kG as eQ,kH as KS,kI as tQ,kJ as nQ,kK as aF,kL as cB,kM as sQ,kN as rQ,kO as iQ,kP as oF,kQ as aQ,kR as oQ,kS as lQ,kT as cQ,kU as uQ,kV as dQ,kW as hQ,kX as fQ,kY as uB,kZ as pQ,k_ as gQ,db as eb,k$ as mQ,bH as vQ,d6 as xQ,l0 as lF,l1 as bQ,l2 as wQ,l3 as CQ,cH as yQ,cZ as SQ,l4 as EQ,l5 as kQ,l6 as _Q,l7 as TQ,B as dB,cY as cF,l8 as RQ,ae as AQ,bA as jl,l9 as FQ,la as DQ,lb as PQ,lc as ti,aV as uF,ld as tb,le as dF,lf as IQ,lg as dy,lh as hy,li as hF,lj as fy,lk as fF,ll as hB,lm as fB,ln as pB,lo as NQ,aC as MQ,aD as OQ,lp as LQ,aE as BQ}from"./conversation-input-sync-DFpqmO4l.js";import{c as dt,ae as jQ,af as gB,ag as HQ,ah as UQ,ai as GQ,aj as $Q,ak as VQ,al as WQ,am as Np,an as zQ,e as Od,S as vn,p as to,B as ae,L as sr,I as Ss,T as eT,g as Ms,X as Nn,ao as YS,ap as Bu,x as va,w as di,o as _0,h as Cf,ad as qw,l as nt,$ as Zf,D as Yc,a as Xc,b as Kw,d as Al,A as zr,f as Yw,z as bm,F as wm,G as Cm,H as ym,J as Sm,q as Fl,r as Uo,s as Dl,t as XS,u as qr,v as Ut,aq as T0,y as Lc,ab as mB,ar as QS,as as qQ,at as KQ,au as YQ,W as vB,Y as xB,Z as JS,k as wx,ac as XQ,a0 as Em,a1 as bB,a2 as yf,av as Vh,aw as QQ,K as pF,i as wB,ax as JQ,j as CB,ay as ZQ,az as gF,a3 as eJ,a9 as ZS,C as tJ,aA as Mp,aB as tT,M as nT,_ as nJ,a4 as sJ,a5 as rJ,a6 as iJ,a7 as aJ,a8 as oJ,aC as lJ,aD as cJ,aE as uJ,aF as dJ,aG as yB,m as mF,n as vF,E as hJ}from"./error-boundary-C6UV5tx-.js";import{W as py,v as R0,u as qe,w as SB,x as EB,S as fJ,y as kB,z as pJ,R as gJ,A as mJ,e as A0,B as xl,t as Z,C as xF,E as vJ,F as xJ,G as bJ,M as bF,H as Xw,I as wJ,J as CJ,N as cg,O as yJ,Q as _B,U as gy,V as SJ,X as wF,Y as CF,Z as EJ,_ as yF,$ as kJ,a0 as mu,a1 as fv,a2 as _J,a3 as TJ,a4 as RJ,a5 as SF,a6 as EF,a7 as AJ,a8 as FJ,a9 as DJ,aa as PJ,ab as kF,ac as _F,ad as TF,ae as IJ,af as NJ,ag as MJ,ah as OJ,ai as LJ,aj as RF,ak as BJ,al as jJ,am as AF,an as HJ,ao as UJ,ap as GJ,aq as $J,ar as VJ,as as WJ,at as TB,r as FF,au as zJ,T as qJ,av as KJ,aw as YJ,ax as XJ,ay as pv,az as gv,aA as DF,aB as mv,aC as vv,aD as PF,aE as IF,aF as QJ,aG as Cx,aH as JJ,aI as ZJ,aJ as eZ,L as Fo,aK as tZ,aL as nZ,g as sZ,aM as NF,aN as rZ,aO as iZ,aP as MF,aQ as aZ}from"./messages-CZNg7vOE.js";import{C as oZ}from"./console-mirror-CxkpeCdB.js";const eE=8e3,RB=1e4;function lZ(e){return e?`“${e}”`:"Conversation"}const cZ="archived.";function uZ(e){return Ee.getState().archiveFacts[e]}function dZ(e){const t=Ee.getState(),n=t.archiveFacts[e];return n?n.archived:t.sessions.find(s=>s.session_id===e)?.archived}function hZ(){const e=Ee(t=>t.archiveUndo);g.useEffect(()=>{if(e===null)return;let t=!1;const n=()=>{t||(t=!0,r())},s=()=>{n();const i=Ee.getState().archiveUndo;i!==null&&i.sessionId===e.sessionId&&i.at===e.at&&Ee.getState().setArchiveUndo(null)},r=Ee.subscribe(()=>{const i=uZ(e.sessionId);i!==void 0&&!i.answered||bW(e.archived,dZ(e.sessionId))||s()});return n},[e])}function fZ(e){return e===1?"Draft":`${e} drafts`}const pZ="discarded.",gZ=e=>{const t=LS(e),n=t.length,s=t.filter(o=>!o.active).length,r=n===1?"chat":"chats",i=e.filter(o=>Fw(o)!==null&&LS([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`:""}},AB=e=>e===1?"1 lives on another device and clears when that device updates.":`${e} live on other devices and clear when those devices update.`,mZ=e=>{if(e.attempted===0)return{tone:"success",message:"Nothing to clear."};const t=e.unknown-e.deferred,n=[e.superseded>0?`${e.superseded} ${e.superseded===1?"has a newer result and stays":"have newer results and stay"} unread.`:null,t>0?`${t} could not be cleared and ${t===1?"stays":"stay"} unread.`:null,e.deferred>0?AB(e.deferred):null].filter(s=>s!==null);return e.cleared===0?{tone:"warning",message:["Nothing was cleared.",...n].join(" ")}:{tone:"success",message:[`Marked ${e.cleared} ${e.cleared===1?"chat":"chats"} as read.`,...n].join(" ")}},my="archive",OF="drafts-undo",LF="bulk-read-deferral",vZ=8e3;function xZ(){const e=Ee(h=>h.archiveFailure),t=Ee(h=>h.archiveUndo),n=Ee(h=>h.draftsUndo),s=Ee(h=>h.bulkReadDeferral),r=Ee(h=>h.clearArchiveFailure),i=Ee(h=>h.setArchiveUndo),a=Ee(h=>h.setSessionArchived),o=Ee(h=>h.restoreDraftsUndo);hZ();const l=g.useRef(null);g.useEffect(()=>{if(e===null&&t===null){if(l.current===null)return;l.current=null,vx(my);return}const h=e&&t?t.at>e.at?"offer":"failure":e?"failure":"offer",f=h==="offer"?t?.at??0:e?.at??0,p=l.current;l.current={kind:h,at:f},p!==null&&p.kind!==h&&f>p.at&&(h==="failure"?i(null):r());const m=(v,x)=>()=>{const b=Ee.getState();v==="offer"?b.archiveUndo?.at===x&&b.setArchiveUndo(null):b.archiveFailure?.at===x&&b.clearArchiveFailure();const w=l.current;w!==null&&w.kind===v&&w.at===x&&(l.current=null)};if(h==="failure"&&e){Hh(`Could not ${e.archived?"archive":"unarchive"} “${e.title}”.${e.detail?` ${e.detail}`:""}`,{id:my,duration:RB,onAutoClose:m("failure",e.at),onDismiss:m("failure",e.at),action:{label:"Retry",onClick:v=>{v.preventDefault(),a(e.sessionId,e.archived,e.title)}}});return}t&&za(c.jsxs("span",{className:_("flex min-w-0 items-baseline gap-1"),children:[c.jsx("span",{className:_("min-w-0 truncate"),children:lZ(t.title)}),c.jsx("span",{className:_("shrink-0"),children:cZ})]}),{id:my,duration:eE,classNames:{content:"min-w-0"},onAutoClose:m("offer",t.at),onDismiss:m("offer",t.at),action:{label:"Undo",onClick:v=>{v.preventDefault(),a(t.sessionId,!t.archived,t.title)}}})},[e,t,i,r,a]);const u=g.useRef(!1);g.useEffect(()=>{if(n===null){if(!u.current)return;u.current=!1,vx(OF);return}u.current=!0;const h=()=>{const f=Ee.getState();f.draftsUndo?.at===n.at&&(f.setDraftsUndo(null),u.current=!1)};za(c.jsxs("span",{className:_("flex min-w-0 items-baseline gap-1"),children:[c.jsx("span",{className:_("min-w-0 truncate"),children:fZ(n.keys.length)}),c.jsx("span",{className:_("shrink-0"),children:pZ})]}),{id:OF,duration:eE,classNames:{content:"min-w-0"},onAutoClose:h,onDismiss:h,action:{label:"Undo",onClick:f=>{f.preventDefault(),o();const p=Ee.getState(),m=p.stagedByDiscard;p.setStagedByDiscard(null),n.keys.length===1&&m!==null&&Ee.getState().activeDraftKey===m&&Ee.getState().openDraft(n.keys[0])}}})},[n,o]);const d=g.useRef(!1);return g.useEffect(()=>{if(s===null){if(!d.current)return;d.current=!1,vx(LF);return}d.current=!0;const h=()=>{const f=Ee.getState();f.bulkReadDeferral?.at===s.at&&(f.clearBulkReadDeferral(),d.current=!1)};za(AB(s.count),{id:LF,duration:vZ,onAutoClose:h,onDismiss:h})},[s]),null}var Ga,Be=typeof window<"u"?window:void 0,oi=typeof globalThis<"u"?globalThis:Be,FB=Array.prototype,BF=FB.forEach,jF=FB.indexOf,Di=oi?.navigator,yt=oi?.document,ii=oi?.location,tE=oi?.fetch,nE=oi!=null&&oi.XMLHttpRequest&&"withCredentials"in new oi.XMLHttpRequest?oi.XMLHttpRequest:void 0,HF=oi?.AbortController,Ds=Di?.userAgent,Gt=Be??{},hl={DEBUG:!1,LIB_VERSION:"1.235.6"},vy="$copy_autocapture",bZ=["$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"})(Ga||(Ga={}));var wZ=["fatal","error","warning","log","info","debug"];function Zt(e,t){return e.indexOf(t)!==-1}var Qw=function(e){return e.trim()},sT=function(e){return e.replace(/^\$/,"")},CZ=Array.isArray,DB=Object.prototype,PB=DB.hasOwnProperty,Jw=DB.toString,cs=CZ||function(e){return Jw.call(e)==="[object Array]"},qa=e=>typeof e=="function",us=e=>e===Object(e)&&!cs(e),Ih=e=>{if(us(e)){for(var t in e)if(PB.call(e,t))return!1;return!0}return!1},xt=e=>e===void 0,Is=e=>Jw.call(e)=="[object String]",sE=e=>Is(e)&&e.trim().length===0,Qc=e=>e===null,kn=e=>xt(e)||Qc(e),Wr=e=>Jw.call(e)=="[object Number]",pl=e=>Jw.call(e)==="[object Boolean]",yZ=e=>e instanceof FormData,SZ=e=>Zt(bZ,e),IB=e=>{var t={_log:function(n){if(Be&&(hl.DEBUG||Gt.POSTHOG_DEBUG)&&!xt(Be.console)&&Be.console){for(var s=("__rrweb_original__"in Be.console[n])?Be.console[n].__rrweb_original__:Be.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=>IB("".concat(e," ").concat(n))};return t},_t=IB("[PostHog.js]"),Fr=_t.createLogger,EZ=Fr("[ExternalScriptsLoader]"),UF=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return EZ.warn("".concat(t," was requested but loading of external scripts is disabled.")),n("Loading of external scripts is disabled");var s=yt?.querySelectorAll("script");if(s){for(var r=0;r<s.length;r++)if(s[r].src===t)return n()}var i=()=>{if(!yt)return n("document not found");var a=yt.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=yt.querySelectorAll("body > script");l.length>0?(o=l[0].parentNode)===null||o===void 0||o.insertBefore(a,l[0]):yt.body.appendChild(a)};yt!=null&&yt.body?i():yt?.addEventListener("DOMContentLoaded",i)};function GF(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 $e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?GF(Object(n),!0).forEach(function(s){ct(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):GF(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function ct(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function NB(e,t){if(e==null)return{};var n,s,r=function(a,o){if(a==null)return{};var l,u,d={},h=Object.keys(a);for(u=0;u<h.length;u++)l=h[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}Gt.__PosthogExtensions__=Gt.__PosthogExtensions__||{},Gt.__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);UF(e,a,n)},Gt.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var s=e.requestRouter.endpointFor("api",t);UF(e,s,n)};var nb={};function Ac(e,t,n){if(cs(e)){if(BF&&e.forEach===BF)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)===nb)return}}}function Pn(e,t,n){if(!kn(e)){if(cs(e))return Ac(e,t,n);if(yZ(e)){for(var s of e.entries())if(t.call(n,s[1],s[0])===nb)return}else for(var r in e)if(PB.call(e,r)&&t.call(n,e[r],r)===nb)return}}var vs=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 Ac(n,function(r){for(var i in r)r[i]!==void 0&&(e[i]=r[i])}),e},yx=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 Ac(n,function(r){Ac(r,function(i){e.push(i)})}),e};function Sx(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 $F=function(e){try{return e()}catch{return}},kZ=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){_t.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),_t.critical(r)}}},km=function(e){var t={};return Pn(e,function(n,s){Is(n)&&n.length>0&&(t[s]=n)}),t};function _Z(e,t){return n=e,s=i=>Is(i)&&!Qc(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),cs(a)?(l=[],Ac(a,u=>{l.push(i(u))})):(l={},Pn(a,(u,d)=>{r.has(u)||(l[d]=i(u,d))})),l);var l}(n);var n,s,r}var TZ=["herokuapp.com","vercel.app","netlify.app"];function RZ(e){var t=e?.hostname;if(!Is(t))return!1;var n=t.split(".").slice(-2).join(".");for(var s of TZ)if(n===s)return!1;return!0}function MB(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function bs(e,t,n,s){var{capture:r=!1,passive:i=!0}=s??{};e?.addEventListener(t,n,{capture:r,passive:i})}var OB="$people_distinct_id",ug="__alias",dg="__timers",VF="$autocapture_disabled_server_side",rE="$heatmaps_enabled_server_side",WF="$exception_capture_enabled_server_side",zF="$web_vitals_enabled_server_side",LB="$dead_clicks_enabled_server_side",qF="$web_vitals_allowed_metrics",iE="$session_recording_enabled_server_side",KF="$console_log_recording_enabled_server_side",YF="$session_recording_network_payload_capture",XF="$session_recording_masking",QF="$session_recording_canvas_recording",JF="$replay_sample_rate",ZF="$replay_minimum_duration",eD="$replay_script_config",sb="$sesid",hg="$session_is_sampled",xy="$session_recording_url_trigger_activated_session",by="$session_recording_event_trigger_activated_session",Nh="$enabled_feature_flags",Ex="$early_access_features",aE="$feature_flag_details",fg="$stored_person_properties",Eu="$stored_group_properties",oE="$surveys",xv="$surveys_activated",rb="$flag_call_reported",cl="$user_state",lE="$client_session_props",cE="$capture_rate_limit",uE="$initial_campaign_params",dE="$initial_referrer_info",hE="$initial_person_info",ib="$epp",BB="__POSTHOG_TOOLBAR__",tD="$posthog_cookieless",AZ=[OB,ug,"__cmpns",dg,iE,rE,sb,Nh,cl,Ex,aE,Eu,fg,oE,rb,lE,cE,uE,dE,ib];function nD(e){var t;return e instanceof Element&&(e.id===BB||!((t=e.closest)===null||t===void 0||!t.call(e,".toolbar-global-fade-container")))}function Zw(e){return!!e&&e.nodeType===1}function Fc(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function jB(e){return!!e&&e.nodeType===3}function HB(e){return!!e&&e.nodeType===11}function rT(e){return e?Qw(e).split(/\s+/):[]}function sD(e){var t=Be?.location.href;return!!(t&&e&&e.some(n=>t.match(n)))}function ab(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 rT(t)}function UB(e){return kn(e)?null:Qw(e).split(/(\s+)/).filter(t=>Sf(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function eC(e){var t="";return pE(e)&&!VB(e)&&e.childNodes&&e.childNodes.length&&Pn(e.childNodes,function(n){var s;jB(n)&&n.textContent&&(t+=(s=UB(n.textContent))!==null&&s!==void 0?s:"")}),Qw(t)}function GB(e){return xt(e.target)?e.srcElement||null:(t=e.target)!==null&&t!==void 0&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var fE=["a","button","form","input","select","textarea","label"];function $B(e){var t=e.parentNode;return!(!t||!Zw(t))&&t}function FZ(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(!Be||!e||Fc(e,"html")||!Zw(e)||n!=null&&n.url_allowlist&&!sD(n.url_allowlist)||n!=null&&n.url_ignorelist&&sD(n.url_ignorelist))return!1;if(n!=null&&n.dom_event_allowlist){var i=n.dom_event_allowlist;if(i&&!i.some(p=>t.type===p))return!1}for(var a=!1,o=[e],l=!0,u=e;u.parentNode&&!Fc(u,"body");)if(HB(u.parentNode))o.push(u.parentNode.host),u=u.parentNode.host;else{if(!(l=$B(u)))break;if(s||fE.indexOf(l.tagName.toLowerCase())>-1)a=!0;else{var d=Be.getComputedStyle(l);d&&d.getPropertyValue("cursor")==="pointer"&&(a=!0)}o.push(l),u=l}if(!function(p,m){var v=m?.element_allowlist;if(xt(v))return!0;var x=function(C){if(v.some(k=>C.tagName.toLowerCase()===k))return{v:!0}};for(var b of p){var w=x(b);if(typeof w=="object")return w.v}return!1}(o,n)||!function(p,m){var v=m?.css_selector_allowlist;if(xt(v))return!0;var x=function(C){if(v.some(k=>C.matches(k)))return{v:!0}};for(var b of p){var w=x(b);if(typeof w=="object")return w.v}return!1}(o,n))return!1;var h=Be.getComputedStyle(e);if(h&&h.getPropertyValue("cursor")==="pointer"&&t.type==="click")return!0;var f=e.tagName.toLowerCase();switch(f){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&&(fE.indexOf(f)>-1||e.getAttribute("contenteditable")==="true")}}function pE(e){for(var t=e;t.parentNode&&!Fc(t,"body");t=t.parentNode){var n=ab(t);if(Zt(n,"ph-sensitive")||Zt(n,"ph-no-capture"))return!1}if(Zt(ab(e),"ph-include"))return!0;var s=e.type||"";if(Is(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";return!(Is(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 VB(e){return!!(Fc(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Fc(e,"select")||Fc(e,"textarea")||e.getAttribute("contenteditable")==="true")}var WB="(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})",DZ=new RegExp("^(?:".concat(WB,")$")),PZ=new RegExp(WB),zB="\\d{3}-?\\d{2}-?\\d{4}",IZ=new RegExp("^(".concat(zB,")$")),NZ=new RegExp("(".concat(zB,")"));function Sf(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(kn(e)||Is(e)&&(e=Qw(e),(t?DZ:PZ).test((e||"").replace(/[- ]/g,""))||(t?IZ:NZ).test(e)))}function qB(e){var t=eC(e);return Sf(t="".concat(t," ").concat(KB(e)).trim())?t:""}function KB(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Pn(e.childNodes,function(n){var s;if(n&&((s=n.tagName)===null||s===void 0?void 0:s.toLowerCase())==="span")try{var r=eC(n);t="".concat(t," ").concat(r).trim(),n.childNodes&&n.childNodes.length&&(t="".concat(t," ").concat(KB(n)).trim())}catch(i){_t.error("[AutoCapture]",i)}}),t}function MZ(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=$e($e($e($e({},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 Sx(l).sort((d,h)=>{var[f]=d,[p]=h;return f.localeCompare(p)}).forEach(d=>{var[h,f]=d;return u[rD(h.toString())]=rD(f.toString())}),a+=":",a+=Sx(l).map(d=>{var[h,f]=d;return"".concat(h,'="').concat(f,'"')}).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:OZ(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return Sx(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 rD(e){return e.replace(/"|\\"/g,'\\"')}function OZ(e){var t=e.attr__class;return t?cs(t)?t:rT(t):void 0}class YB{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 LZ=["localhost","127.0.0.1"],Wh=e=>{var t=yt?.createElement("a");return xt(t)?null:(t.href=e,t)},BZ=function(e){var t,n,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",r=[];return Pn(e,function(i,a){xt(i)||xt(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)},ob=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(!cs(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch{_t.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},wy=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=[],h=0;h<u.length;h++){var f=u[h].split("=");cs(f)&&(t.includes(f[0])?d.push(f[0]+"="+n):d.push(u[h]))}var p=l;return o!=null&&(p+="?"+d.join("&")),i!=null&&(p+="#"+i),p},lb=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},iD=Fr("[AutoCapture]");function Cy(e,t){return t.length>e?t.slice(0,e)+"...":t}function jZ(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!Zw(t));return t}function HZ(e,t,n,s){var r=e.tagName.toLowerCase(),i={tag_name:r};fE.indexOf(r)>-1&&!n&&(r.toLowerCase()==="a"||r.toLowerCase()==="button"?i.$el_text=Cy(1024,qB(e)):i.$el_text=Cy(1024,eC(e)));var a=ab(e);a.length>0&&(i.classes=a.filter(function(d){return d!==""})),Pn(e.attributes,function(d){var h;if((!VB(e)||["name","id","class","aria-label"].indexOf(d.name)!==-1)&&(s==null||!s.includes(d.name))&&!t&&Sf(d.value)&&(h=d.name,!Is(h)||h.substring(0,10)!=="_ngcontent"&&h.substring(0,7)!=="_nghost")){var f=d.value;d.name==="class"&&(f=rT(f).join(" ")),i["attr__"+d.name]=Cy(1024,f)}});for(var o=1,l=1,u=e;u=jZ(u);)o++,u.tagName===e.tagName&&l++;return i.nth_child=o,i.nth_of_type=l,i}function UZ(e,t){for(var n,s,{e:r,maskAllElementAttributes:i,maskAllText:a,elementAttributeIgnoreList:o,elementsChainAsString:l}=t,u=[e],d=e;d.parentNode&&!Fc(d,"body");)HB(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var h,f=[],p={},m=!1,v=!1;if(Pn(u,k=>{var y=pE(k);k.tagName.toLowerCase()==="a"&&(m=k.getAttribute("href"),m=y&&m&&Sf(m)&&m),Zt(ab(k),"ph-no-capture")&&(v=!0),f.push(HZ(k,i,a,o));var E=function(T){if(!pE(T))return{};var F={};return Pn(T.attributes,function(R){if(R.name&&R.name.indexOf("data-ph-capture-attribute")===0){var I=R.name.replace("data-ph-capture-attribute-",""),N=R.value;I&&N&&Sf(N)&&(F[I]=N)}}),F}(k);vs(p,E)}),v)return{props:{},explicitNoCapture:v};if(a||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?f[0].$el_text=qB(e):f[0].$el_text=eC(e)),m){var x,b;f[0].attr__href=m;var w=(x=Wh(m))===null||x===void 0?void 0:x.host,C=Be==null||(b=Be.location)===null||b===void 0?void 0:b.host;w&&C&&w!==C&&(h=m)}return{props:vs({$event_type:r.type,$ce_version:1},l?{}:{$elements:f},{$elements_chain:MZ(f)},(n=f[0])!==null&&n!==void 0&&n.$el_text?{$el_text:(s=f[0])===null||s===void 0?void 0:s.$el_text}:{},h&&r.type==="click"?{$external_click_url:h}:{},p)}}let GZ=class{constructor(t){ct(this,"_initialized",!1),ct(this,"_isDisabledServerSide",null),ct(this,"rageclicks",new YB),ct(this,"_elementsChainAsString",!1),this.instance=t,this._elementSelectors=null}get config(){var t,n,s=us(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(Be&&yt){var t=s=>{s=s||Be?.event;try{this._captureEvent(s)}catch(r){iD.error("Failed to capture event",r)}};if(bs(yt,"submit",t,{capture:!0}),bs(yt,"change",t,{capture:!0}),bs(yt,"click",t,{capture:!0}),this.config.capture_copied_text){var n=s=>{s=s||Be?.event,this._captureEvent(s,vy)};bs(yt,"copy",n,{capture:!0}),bs(yt,"cut",n,{capture:!0})}}}else iD.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({[VF]:!!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=yt?.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[VF],r=this._isDisabledServerSide;if(Qc(r)&&!pl(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=GB(t);jB(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===vy;if(r&&FZ(r,t,this.config,i,i?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:o}=UZ(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===vy){var u,d=UB(Be==null||(u=Be.getSelection())===null||u===void 0?void 0:u.toString()),h=t.type||"clipboard";if(!d)return!1;a.$selected_content=d,a.$copy_type=h}return this.instance.capture(n,a),!0}}}isBrowserSupported(){return qa(yt?.querySelectorAll)}};Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Wr(e)&&isFinite(e)&&Math.floor(e)===e});var aD="0123456789abcdef";let $Z=class gE{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 gE(i)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+aD.charAt(this.bytes[n]>>>4)+aD.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 gE(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}},VZ=class{constructor(){ct(this,"timestamp",0),ct(this,"counter",0),ct(this,"random",new WZ)}generate(){var t=this.generateOrAbort();if(xt(t)){this.timestamp=0;var n=this.generateOrAbort();if(xt(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 $Z.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 oD,XB=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};Be&&!xt(Be.crypto)&&crypto.getRandomValues&&(XB=e=>crypto.getRandomValues(e));let WZ=class{constructor(){ct(this,"buffer",new Uint32Array(8)),ct(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(XB(this.buffer),this.cursor=0),this.buffer[this.cursor++]}};var Cc=()=>zZ().toString(),zZ=()=>(oD||(oD=new VZ)).generate(),qZ="Thu, 01 Jan 1970 00:00:00 GMT",Op="",KZ=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function YZ(e,t){if(t){var n=function(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:yt;if(Op)return Op;if(!i||["localhost","127.0.0.1"].includes(r))return"";for(var a=r.split("."),o=Math.min(a.length,8),l="dmn_chk_"+Cc(),u=new RegExp("(^|;)\\s*"+l+"=1");!Op&&o--;){var d=a.slice(o).join("."),h=l+"=1;domain=."+d;i.cookie=h,u.test(i.cookie)&&(i.cookie=h+";expires="+qZ,Op=d)}return Op}(e);if(!n){var s=(r=>{var i=r.match(KZ);return i?i[0]:""})(e);s!==n&&_t.info("Warning: cookie subdomain discovery mismatch",s,n),n=s}return n?"; domain=."+n:""}return""}var gc,wl={is_supported:()=>!!yt,error:function(e){_t.error("cookieStore error: "+e)},get:function(e){if(yt){try{for(var t=e+"=",n=yt.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(wl.get(e))||{}}catch{}return t},set:function(e,t,n,s,r){if(yt)try{var i="",a="",o=YZ(yt.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&&_t.warn("cookieStore warning: large cookie, len="+u.length),yt.cookie=u,u}catch{return}},remove:function(e,t){try{wl.set(e,"",-1,t)}catch{return}}},yy=null,Bs={is_supported:function(){if(!Qc(yy))return yy;var e=!0;if(xt(Be))e=!1;else try{var t="__mplssupport__";Bs.set(t,"xyz"),Bs.get(t)!=='"xyz"'&&(e=!1),Bs.remove(t)}catch{e=!1}return e||_t.error("localStorage unsupported; falling back to cookie store"),yy=e,e},error:function(e){_t.error("localStorage error: "+e)},get:function(e){try{return Be?.localStorage.getItem(e)}catch(t){Bs.error(t)}return null},parse:function(e){try{return JSON.parse(Bs.get(e))||{}}catch{}return null},set:function(e,t){try{Be?.localStorage.setItem(e,JSON.stringify(t))}catch(n){Bs.error(n)}},remove:function(e){try{Be?.localStorage.removeItem(e)}catch(t){Bs.error(t)}}},XZ=["distinct_id",sb,hg,ib,hE],bv=$e($e({},Bs),{},{parse:function(e){try{var t={};try{t=wl.parse(e)||{}}catch{}var n=vs(t,JSON.parse(Bs.get(e)||"{}"));return Bs.set(e,n),n}catch{}return null},set:function(e,t,n,s,r,i){try{Bs.set(e,t,void 0,void 0,i);var a={};XZ.forEach(o=>{t[o]&&(a[o]=t[o])}),Object.keys(a).length&&wl.set(e,a,n,s,r,i)}catch(o){Bs.error(o)}},remove:function(e,t){try{Be?.localStorage.removeItem(e),wl.remove(e,t)}catch(n){Bs.error(n)}}}),wv={},QZ={is_supported:function(){return!0},error:function(e){_t.error("memoryStorage error: "+e)},get:function(e){return wv[e]||null},parse:function(e){return wv[e]||null},set:function(e,t){wv[e]=t},remove:function(e){delete wv[e]}},vu=null,dr={is_supported:function(){if(!Qc(vu))return vu;if(vu=!0,xt(Be))vu=!1;else try{var e="__support__";dr.set(e,"xyz"),dr.get(e)!=='"xyz"'&&(vu=!1),dr.remove(e)}catch{vu=!1}return vu},error:function(e){_t.error("sessionStorage error: ",e)},get:function(e){try{return Be?.sessionStorage.getItem(e)}catch(t){dr.error(t)}return null},parse:function(e){try{return JSON.parse(dr.get(e))||null}catch{}return null},set:function(e,t){try{Be?.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){dr.error(n)}},remove:function(e){try{Be?.sessionStorage.removeItem(e)}catch(t){dr.error(t)}}};(function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"})(gc||(gc={}));let JZ=class{constructor(t){this.instance=t}get config(){return this.instance.config}get consent(){return this.getDnt()?gc.DENIED:this.storedConsent}isOptedOut(){return this.consent===gc.DENIED||this.consent===gc.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"?gc.GRANTED:t==="0"?gc.DENIED:gc.PENDING}get storage(){if(!this._storage){var t=this.config.opt_out_capturing_persistence_type;this._storage=t==="localStorage"?Bs:wl;var n=t==="localStorage"?wl:Bs;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&&!!MB([Di?.doNotTrack,Di?.msDoNotTrack,Gt.doNotTrack],t=>Zt([!0,1,"1","yes"],t))}};var Cv=Fr("[Dead Clicks]"),ZZ=()=>!0,eee=e=>{var t,n=!((t=e.instance.persistence)===null||t===void 0||!t.get_property(LB)),s=e.instance.config.capture_dead_clicks;return pl(s)?s:n};let QB=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({[LB]:t?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript(()=>{this.start()})}loadScript(t){var n,s,r;(n=Gt.__PosthogExtensions__)!==null&&n!==void 0&&n.initDeadClicksAutocapture&&t(),(s=Gt.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"dead-clicks-autocapture",i=>{i?Cv.error("failed to load script",i):t()})}start(){var t;if(yt){if(!this._lazyLoadedDeadClicksAutocapture&&(t=Gt.__PosthogExtensions__)!==null&&t!==void 0&&t.initDeadClicksAutocapture){var n=us(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=Gt.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this._lazyLoadedDeadClicksAutocapture.start(yt),Cv.info("starting...")}}else Cv.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,Cv.info("stopping..."))}};var Sy=Fr("[ExceptionAutocapture]");let tee=class{constructor(t){var n;ct(this,"startCapturing",()=>{var s;if(Be&&this.isEnabled&&(s=Gt.__PosthogExtensions__)!==null&&s!==void 0&&s.errorWrappingFunctions){var r=Gt.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=Gt.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,a=Gt.__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){Sy.error("failed to start",o),this.stopCapturing()}}}),this.instance=t,this.remoteEnabled=!((n=this.instance.persistence)===null||n===void 0||!n.props[WF]),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 us(t)?n=$e($e({},n),t):(xt(t)?this.remoteEnabled:t)&&(n=$e($e({},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&&(Sy.info("enabled"),this.loadScript(this.startCapturing))}loadScript(t){var n,s,r;(n=Gt.__PosthogExtensions__)!==null&&n!==void 0&&n.errorWrappingFunctions&&t(),(s=Gt.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"exception-autocapture",i=>{if(i)return Sy.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({[WF]: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 JB(e){return!xt(Event)&&ZB(e,Event)}function ZB(e,t){try{return e instanceof t}catch{return!1}}function kx(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function Ey(e){return kx(e,"DOMError")}var lD=/\(error: (.*)\)/,cD=50,Mh="?";function ky(e,t,n,s){var r={platform:"web:javascript",filename:e,function:t==="<anonymous>"?Mh:t,in_app:!0};return xt(n)||(r.lineno=n),xt(s)||(r.colno=s),r}var nee=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,see=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ree=/\((\S*)(?::(\d+))(?::(\d+))\)/,iee=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,aee=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,oee=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=lD.test(u)?u.replace(lD,"$1"):u;if(!d.match(/\S*Error: /)){for(var h of s){var f=h(d);if(f){a.push(f);break}}if(a.length>=cD)break}}}return function(p){if(!p.length)return[];var m=Array.from(p);return m.reverse(),m.slice(0,cD).map(v=>$e($e({},v),{},{filename:v.filename||lee(m).filename,function:v.function||Mh}))}(a)}}([30,e=>{var t=nee.exec(e);if(t){var[,n,s,r]=t;return ky(n,Mh,+s,+r)}var i=see.exec(e);if(i){if(i[2]&&i[2].indexOf("eval")===0){var a=ree.exec(i[2]);a&&(i[2]=a[1],i[3]=a[2],i[4]=a[3])}var[o,l]=dD(i[1]||Mh,i[2]);return ky(l,o,i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}}],[50,e=>{var t=iee.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=aee.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]||Mh;return[r,s]=dD(r,s),ky(s,r,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]);function lee(e){return e[e.length-1]||{}}var yv,uD,_y,dD=(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]:Mh,n?"safari-extension:".concat(t):"safari-web-extension:".concat(t)]:[e,t]},cee=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function iT(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=e.stacktrace||e.stack||"",s=function(a){return a&&uee.test(a.message)?1:0}(e);try{var r=oee,i=function(a,o){var l=function(u){var d=globalThis._posthogChunkIds;if(!d)return{};var h=Object.keys(d);return _y&&h.length===uD||(uD=h.length,_y=h.reduce((f,p)=>{yv||(yv={});var m=yv[p];if(m)f[m[0]]=m[1];else for(var v=u(p),x=v.length-1;x>=0;x--){var b=v[x],w=b?.filename,C=d[p];if(w&&C){f[w]=C,yv[p]=[w,C];break}}return f},{})),_y}(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 uee=/Minified React error #\d+;/i;function Ty(e,t){var n,s,r=iT(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 Ry(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=iT(t.syntheticException,1);l.length&&(o.stacktrace={frames:l,type:"raw"})}return{$exception_list:[o],$exception_level:"error"}}function dee(e){return Is(e)&&!sE(e)&&wZ.indexOf(e)>=0}function hee(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:JB(e)?e.constructor.name:"Error",o="Non-Error 'exception' captured with keys: ".concat(function(d){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:40,f=Object.keys(d);if(f.sort(),!f.length)return"[object has no keys]";for(var p=f.length;p>0;p--){var m=f.slice(0,p).join(", ");if(!(m.length>h))return p===f.length||m.length<=h?m:"".concat(m.slice(0,h),"...")}return""}(e)),l={type:a,value:o,mechanism:{handled:r,synthetic:i}};if(t!=null&&t.syntheticException){var u=iT(t?.syntheticException,1);u.length&&(l.stacktrace={frames:u,type:"raw"})}return{$exception_list:[l],$exception_level:dee(e.level)?e.level:"error"}}function fee(e,t){var{error:n,event:s}=e,r={$exception_list:[]},i=n||s;if(Ey(i)||function(p){return kx(p,"DOMException")}(i)){var a=i;if(function(p){return"stack"in p}(i))r=Ty(i,t);else{var o=a.name||(Ey(a)?"DOMError":"DOMException"),l=a.message?"".concat(o,": ").concat(a.message):o,u=Ey(a)?"DOMError":"DOMException";r=Ry(l,$e($e({},t),{},{overrideExceptionType:u,defaultExceptionMessage:l}))}return"code"in a&&(r.$exception_DOMException_code="".concat(a.code)),r}if(function(p){return kx(p,"ErrorEvent")}(i)&&i.error)return Ty(i.error,t);if(function(p){switch(Object.prototype.toString.call(p)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return ZB(p,Error)}}(i))return Ty(i,t);if(function(p){return kx(p,"Object")}(i)||JB(i))return hee(i,t);if(xt(n)&&Is(s)){var d="Error",h=s,f=s.match(cee);return f&&(d=f[1],h=f[2]),Ry(h,$e($e({},t),{},{overrideExceptionType:d,defaultExceptionMessage:h}))}return Ry(i,t)}function cb(e){var t,n;return((t=JSON.stringify(e,(n=[],function(s,r){if(us(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 mE(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[mE({size:cb(s),data:s,sessionId:e.sessionId,windowId:e.windowId}),mE({size:cb(r),data:r,sessionId:e.sessionId,windowId:e.windowId})].flatMap(i=>i)}return[e]}var ul=(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))(ul||{}),ja=(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))(ja||{}),vE="[SessionRecording]",xE="redacted",Sv={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"]},pee=["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"],gee=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],mee=["/s/","/e/","/i/"];function hD(e,t,n,s){if(kn(e))return e;var r=t?.["content-length"]||function(i){return new Blob([i]).size}(e);return Is(r)&&(r=parseInt(r)),r>n?vE+" ".concat(s," body too large to record (").concat(r," bytes)"):e}function fD(e,t){if(kn(e))return e;var n=e;return Sf(n,!1)||(n=vE+" "+t+" body "+xE),Pn(gee,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=vE+" "+t+" body "+xE+" as might contain: "+s)}),n}var vee=(e,t)=>{var n,s,r,i={payloadSizeLimitBytes:Sv.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Sv.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...Sv.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),f=>(f!=null&&f.requestBody&&(f.requestBody=hD(f.requestBody,f.requestHeaders,r,"Request")),f!=null&&f.responseBody&&(f.responseBody=hD(f.responseBody,f.responseHeaders,r,"Response")),f)),d=f=>{return u(((v,x)=>{var b,w=Wh(v.name),C=x.indexOf("http")===0?(b=Wh(x))===null||b===void 0?void 0:b.pathname:x;C==="/"&&(C="");var k=w?.pathname.replace(C||"","");if(!(w&&k&&mee.some(y=>k.indexOf(y)===0)))return v})((m=(p=f).requestHeaders,kn(m)||Pn(Object.keys(m??{}),v=>{pee.includes(v.toLowerCase())&&(m[v]=xE)}),p),e.api_host));var p,m},h=qa(e.session_recording.maskNetworkRequestFn);return h&&qa(e.session_recording.maskCapturedNetworkRequestFn)&&_t.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),h&&(e.session_recording.maskCapturedNetworkRequestFn=f=>{var p=e.session_recording.maskNetworkRequestFn({url:f.name});return $e($e({},f),{},{name:p?.url})}),i.maskRequestFn=qa(e.session_recording.maskCapturedNetworkRequestFn)?f=>{var p,m,v,x=d(f);return x&&(p=(m=(v=e.session_recording).maskCapturedNetworkRequestFn)===null||m===void 0?void 0:m.call(v,x))!==null&&p!==void 0?p:void 0}:f=>function(p){if(!xt(p))return p.requestBody=fD(p.requestBody,"Request"),p.responseBody=fD(p.responseBody,"Response"),p}(d(f)),$e($e($e({},Sv),i),{},{recordHeaders:a,recordBody:o,recordPerformance:l,recordInitialRequests:l})};function la(e,t,n,s,r){return t>n&&(_t.warn("min cannot be greater than max."),t=n),Wr(e)?e>n?(s&&_t.warn(s+" cannot be greater than max: "+n+". Using max value instead."),n):e<t?(s&&_t.warn(s+" cannot be less than min: "+t+". Using min value instead."),t):e:(s&&_t.warn(s+" must be a number. using max or fallback. max: "+n+", fallback: "+r),la(r||n,t,n,s))}let xee=class{constructor(t){var n,s,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};ct(this,"bucketSize",100),ct(this,"refillRate",10),ct(this,"mutationBuckets",{}),ct(this,"loggedTracker",{}),ct(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]})}),ct(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]}),ct(this,"numberOfChanges",i=>{var a,o,l,u,d,h,f,p;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=(h=i.texts)===null||h===void 0?void 0:h.length)!==null&&d!==void 0?d:0)+((f=(p=i.adds)===null||p===void 0?void 0:p.length)!==null&&f!==void 0?f:0)}),ct(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,h,f,[p,m]=this.getNodeOrRelevantParent(u.id);return this.mutationBuckets[p]===0?!1:(this.mutationBuckets[p]=(d=this.mutationBuckets[p])!==null&&d!==void 0?d:this.bucketSize,this.mutationBuckets[p]=Math.max(this.mutationBuckets[p]-1,0),this.mutationBuckets[p]===0&&(this.loggedTracker[p]||(this.loggedTracker[p]=!0,(h=(f=this.options).onBlockedNode)===null||h===void 0||h.call(f,p,m))),u)}));var l=this.numberOfChanges(a);return l!==0||o===l?i:void 0}),this.rrweb=t,this.options=r,this.refillRate=la((n=this.options.refillRate)!==null&&n!==void 0?n:this.refillRate,0,100,"mutation throttling refill rate"),this.bucketSize=la((s=this.options.bucketSize)!==null&&s!==void 0?s:this.bucketSize,0,100,"mutation throttling bucket size"),setInterval(()=>{this.refillBuckets()},1e3)}};var ha=Uint8Array,li=Uint16Array,Ef=Uint32Array,aT=new ha([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]),oT=new ha([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]),pD=new ha([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),e6=function(e,t){for(var n=new li(31),s=0;s<31;++s)n[s]=t+=1<<e[s-1];var r=new Ef(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]},t6=e6(aT,2),bee=t6[0],bE=t6[1];bee[28]=258,bE[258]=28;for(var gD=e6(oT,0)[1],n6=new li(32768),Un=0;Un<32768;++Un){var xu=(43690&Un)>>>1|(21845&Un)<<1;xu=(61680&(xu=(52428&xu)>>>2|(13107&xu)<<2))>>>4|(3855&xu)<<4,n6[Un]=((65280&xu)>>>8|(255&xu)<<8)>>>1}var Pg=function(e,t,n){for(var s=e.length,r=0,i=new li(t);r<s;++r)++i[e[r]-1];var a,o=new li(t);for(r=0;r<t;++r)o[r]=o[r-1]+i[r-1]<<1;for(a=new li(s),r=0;r<s;++r)a[r]=n6[o[e[r]-1]++]>>>15-e[r];return a},gd=new ha(288);for(Un=0;Un<144;++Un)gd[Un]=8;for(Un=144;Un<256;++Un)gd[Un]=9;for(Un=256;Un<280;++Un)gd[Un]=7;for(Un=280;Un<288;++Un)gd[Un]=8;var ub=new ha(32);for(Un=0;Un<32;++Un)ub[Un]=5;var wee=Pg(gd,9),Cee=Pg(ub,5),s6=function(e){return(e/8>>0)+(7&e&&1)},r6=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var s=new(e instanceof li?li:e instanceof Ef?Ef:ha)(n-t);return s.set(e.subarray(t,n)),s},al=function(e,t,n){n<<=7&t;var s=t/8>>0;e[s]|=n,e[s+1]|=n>>>8},Lp=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},Ay=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 ha(0),0];if(r==1){var a=new ha(n[0].s+1);return a[n[0].s]=1,[a,1]}n.sort(function(y,E){return y.f-E.f}),n.push({s:-1,f:25001});var o=n[0],l=n[1],u=0,d=1,h=2;for(n[0]={s:-1,f:o.f+l.f,l:o,r:l};d!=r-1;)o=n[n[u].f<n[h].f?u++:h++],l=n[u!=d&&n[u].f<n[h].f?u++:h++],n[d++]={s:-1,f:o.f+l.f,l:o,r:l};var f=i[0].s;for(s=1;s<r;++s)i[s].s>f&&(f=i[s].s);var p=new li(f+1),m=wE(n[d-1],p,0);if(m>t){s=0;var v=0,x=m-t,b=1<<x;for(i.sort(function(y,E){return p[E.s]-p[y.s]||y.f-E.f});s<r;++s){var w=i[s].s;if(!(p[w]>t))break;v+=b-(1<<m-p[w]),p[w]=t}for(v>>>=x;v>0;){var C=i[s].s;p[C]<t?v-=1<<t-p[C]++-1:++s}for(;s>=0&&v;--s){var k=i[s].s;p[k]==t&&(--p[k],++v)}m=t}return[new ha(p),m]},wE=function(e,t,n){return e.s==-1?Math.max(wE(e.l,t,n+1),wE(e.r,t,n+1)):t[e.s]=n},mD=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new li(++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]},Bp=function(e,t){for(var n=0,s=0;s<t.length;++s)n+=e[s]*t[s];return n},CE=function(e,t,n){var s=n.length,r=s6(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)},vD=function(e,t,n,s,r,i,a,o,l,u,d){al(t,d++,n),++r[256];for(var h=Ay(r,15),f=h[0],p=h[1],m=Ay(i,15),v=m[0],x=m[1],b=mD(f),w=b[0],C=b[1],k=mD(v),y=k[0],E=k[1],T=new li(19),F=0;F<w.length;++F)T[31&w[F]]++;for(F=0;F<y.length;++F)T[31&y[F]]++;for(var R=Ay(T,7),I=R[0],N=R[1],D=19;D>4&&!I[pD[D-1]];--D);var O,G,B,ee,z=u+5<<3,ue=Bp(r,gd)+Bp(i,ub)+a,U=Bp(r,f)+Bp(i,v)+a+14+3*D+Bp(T,I)+(2*T[16]+3*T[17]+7*T[18]);if(z<=ue&&z<=U)return CE(t,d,e.subarray(l,l+u));if(al(t,d,1+(U<ue)),d+=2,U<ue){O=Pg(f,p),G=f,B=Pg(v,x),ee=v;var se=Pg(I,N);for(al(t,d,C-257),al(t,d+5,E-1),al(t,d+10,D-4),d+=14,F=0;F<D;++F)al(t,d+3*F,I[pD[F]]);d+=3*D;for(var le=[w,y],M=0;M<2;++M){var H=le[M];for(F=0;F<H.length;++F){var A=31&H[F];al(t,d,se[A]),d+=I[A],A>15&&(al(t,d,H[F]>>>5&127),d+=H[F]>>>12)}}}else O=wee,G=gd,B=Cee,ee=ub;for(F=0;F<o;++F)if(s[F]>255){A=s[F]>>>18&31,Lp(t,d,O[A+257]),d+=G[A+257],A>7&&(al(t,d,s[F]>>>23&31),d+=aT[A]);var V=31&s[F];Lp(t,d,B[V]),d+=ee[V],V>3&&(Lp(t,d,s[F]>>>5&8191),d+=oT[V])}else Lp(t,d,O[s[F]]),d+=G[s[F]];return Lp(t,d,O[256]),d+G[256]},yee=new Ef([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),See=function(){for(var e=new Ef(256),t=0;t<256;++t){for(var n=t,s=9;--s;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),Eee=function(){var e=4294967295;return{p:function(t){for(var n=e,s=0;s<t.length;++s)n=See[255&n^t[s]]^n>>>8;e=n},d:function(){return 4294967295^e}}},kee=function(e,t,n,s,r){return function(i,a,o,l,u,d){var h=i.length,f=new ha(l+h+5*(1+Math.floor(h/7e3))+u),p=f.subarray(l,f.length-u),m=0;if(!a||h<8)for(var v=0;v<=h;v+=65535){var x=v+65535;x<h?m=CE(p,m,i.subarray(v,x)):(p[v]=d,m=CE(p,m,i.subarray(v,h)))}else{for(var b=yee[a-1],w=b>>>13,C=8191&b,k=(1<<o)-1,y=new li(32768),E=new li(k+1),T=Math.ceil(o/3),F=2*T,R=function(de){return(i[de]^i[de+1]<<T^i[de+2]<<F)&k},I=new Ef(25e3),N=new li(288),D=new li(32),O=0,G=0,B=(v=0,0),ee=0,z=0;v<h;++v){var ue=R(v),U=32767&v,se=E[ue];if(y[U]=se,E[ue]=U,ee<=v){var le=h-v;if((O>7e3||B>24576)&&le>423){m=vD(i,p,0,I,N,D,G,B,z,v-z,m),B=O=G=0,z=v;for(var M=0;M<286;++M)N[M]=0;for(M=0;M<30;++M)D[M]=0}var H=2,A=0,V=C,J=U-se&32767;if(le>2&&ue==R(v-J))for(var fe=Math.min(w,le)-1,ce=Math.min(32767,v),oe=Math.min(258,le);J<=ce&&--V&&U!=se;){if(i[v+H]==i[v+H-J]){for(var X=0;X<oe&&i[v+X]==i[v+X-J];++X);if(X>H){if(H=X,A=J,X>fe)break;var Ce=Math.min(J,X-2),L=0;for(M=0;M<Ce;++M){var be=v-J+M+32768&32767,re=be-y[be]+32768&32767;re>L&&(L=re,se=be)}}}J+=(U=se)-(se=y[U])+32768&32767}if(A){I[B++]=268435456|bE[H]<<18|gD[A];var Ae=31&bE[H],te=31&gD[A];G+=aT[Ae]+oT[te],++N[257+Ae],++D[te],ee=v+H,++O}else I[B++]=i[v],++N[i[v]]}}m=vD(i,p,d,I,N,D,G,B,z,v-z,m)}return r6(f,0,l+s6(m)+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)},yE=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},_ee=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&&yE(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)}},Tee=function(e){return 10+(e.filename&&e.filename.length+1||0)};function i6(e,t){t===void 0&&(t={});var n=Eee(),s=e.length;n.p(e);var r=kee(e,t,Tee(t),8),i=r.length;return _ee(r,t),yE(r,i-8,n.d()),yE(r,i-4,s),r}function a6(e,t){var n=e.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(e);for(var s=new ha(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 ha(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 r6(s,0,r)}function Ree(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<la(100*t,0,100)}var pg="[SessionRecording]",vr=Fr(pg);function Ev(){var e,t;return Gt==null||(e=Gt.__PosthogExtensions__)===null||e===void 0||(t=e.rrweb)===null||t===void 0?void 0:t.record}var Aee=3e5,Fee=[ja.MouseMove,ja.MouseInteraction,ja.Scroll,ja.ViewportResize,ja.Input,ja.TouchMove,ja.MediaInteraction,ja.Drag],xD=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function bu(e){return function(t,n){for(var s="",r=0;r<t.length;){var i=t[r++];s+=String.fromCharCode(i)}return s}(i6(a6(JSON.stringify(e))))}function bD(e){return e.type===ul.Custom&&e.data.tag==="sessionIdle"}function wD(e,t){return t.some(n=>n.matching==="regex"&&new RegExp(n.url).test(e))}let Dee=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(pg+" 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:Aee}get isSampled(){var t=this.instance.get_property(hg);return pl(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(iE),n=!this.instance.config.disable_session_recording;return Be&&t&&n}get isConsoleLogCaptureEnabled(){var t=!!this.instance.get_property(KF),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(QF),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,h=(i=(a=o?.canvasQuality)!==null&&a!==void 0?a:l?.quality)!==null&&i!==void 0?i:.4;if(typeof h=="string"){var f=parseFloat(h);h=isNaN(f)?.4:f}return{enabled:u,fps:la(d,0,12,"canvas recording fps",4),quality:la(h,0,1,"canvas recording quality",.4)}}get networkPayloadCapture(){var t,n,s=this.instance.get_property(YF),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=us(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,l=!!(pl(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(XF),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,h=(a=l?.blockSelector)!==null&&a!==void 0?a:o?.blockSelector;return xt(u)&&xt(d)&&xt(h)?void 0:{maskAllInputs:u==null||u,maskTextSelector:d,blockSelector:h}}get sampleRate(){var t=this.instance.get_property(JF);return Wr(t)?t:null}get minimumDuration(){var t=this.instance.get_property(ZF);return Wr(t)?t:null}get status(){return this.receivedDecide?this.isRecordingEnabled?this.isSampled===!1?"disabled":this._urlBlocked?"paused":kn(this._linkedFlag)||this._linkedFlagSeen?this.triggerStatus==="trigger_pending"?"buffering":pl(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(xy))===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(by))===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(ct(this,"queuedRRWebEvents",[]),ct(this,"isIdle","unknown"),ct(this,"_linkedFlagSeen",!1),ct(this,"_lastActivityTimestamp",Date.now()),ct(this,"_linkedFlag",null),ct(this,"_removePageViewCaptureHook",void 0),ct(this,"_onSessionIdListener",void 0),ct(this,"_persistDecideOnSessionListener",void 0),ct(this,"_samplingSessionListener",void 0),ct(this,"_urlTriggers",[]),ct(this,"_urlBlocklist",[]),ct(this,"_urlBlocked",!1),ct(this,"_eventTriggers",[]),ct(this,"_removeEventTriggerCaptureHook",void 0),ct(this,"_forceAllowLocalhostNetworkCapture",!1),ct(this,"_onBeforeUnload",()=>{this._flushBuffer()}),ct(this,"_onOffline",()=>{this._tryAddCustomEvent("browser offline",{})}),ct(this,"_onOnline",()=>{this._tryAddCustomEvent("browser online",{})}),ct(this,"_onVisibilityChange",()=>{if(yt!=null&&yt.visibilityState){var r="window "+yt.visibilityState;this._tryAddCustomEvent(r,{})}}),this.instance=t,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw vr.error("started without valid sessionManager"),new Error(pg+" started without valid sessionManager. This is a bug.");if(this.instance.config.__preview_experimental_cookieless_mode)throw new Error(pg+" 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&&vr.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),bs(Be,"beforeunload",this._onBeforeUnload),bs(Be,"offline",this._onOffline),bs(Be,"online",this._onOnline),bs(Be,"visibilitychange",this._onVisibilityChange),this._setupSampling(),this._addEventTriggerListener(),kn(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){vr.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(by),(o=this.instance)===null||o===void 0||(l=o.persistence)===null||l===void 0||l.unregister(xy))}))):this.stopRecording()}stopRecording(){var t,n,s,r;this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,Be?.removeEventListener("beforeunload",this._onBeforeUnload),Be?.removeEventListener("offline",this._onOffline),Be?.removeEventListener("online",this._onOnline),Be?.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,vr.info("stopped"))}_resetSampling(){var t;(t=this.instance.persistence)===null||t===void 0||t.unregister(hg)}makeSamplingDecision(t){var n,s=this.sessionId!==t,r=this.sampleRate;if(Wr(r)){var i=this.isSampled,a=s||!pl(i),o=a?Ree(t,r):i;a&&(o?this._reportStarted("sampled"):vr.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({[hg]: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(),!kn(this._linkedFlag)&&!this._linkedFlagSeen){var l=Is(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,u=Is(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags((d,h)=>{var f=us(h)&&l in h,p=u?h[l]===u:f;p&&this._reportStarted("linked_flag_matched",{linkedFlag:l,linkedVariant:u}),this._linkedFlagSeen=p})}(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(){Wr(this.sampleRate)&&kn(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,h,f,p,m=(i=t.sessionRecording)===null||i===void 0?void 0:i.sampleRate,v=kn(m)?null:parseFloat(m);kn(v)&&this._resetSampling();var x=(a=t.sessionRecording)===null||a===void 0?void 0:a.minimumDurationMilliseconds;s.register({[iE]:!!t.sessionRecording,[KF]:(o=t.sessionRecording)===null||o===void 0?void 0:o.consoleLogRecordingEnabled,[YF]:$e({capturePerformance:t.capturePerformance},(l=t.sessionRecording)===null||l===void 0?void 0:l.networkPayloadCapture),[XF]:(u=t.sessionRecording)===null||u===void 0?void 0:u.masking,[QF]:{enabled:(d=t.sessionRecording)===null||d===void 0?void 0:d.recordCanvas,fps:(h=t.sessionRecording)===null||h===void 0?void 0:h.canvasFps,quality:(f=t.sessionRecording)===null||f===void 0?void 0:f.canvasQuality},[JF]:v,[ZF]:xt(x)?null:x,[eD]:(p=t.sessionRecording)===null||p===void 0?void 0:p.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(!xt(Object.assign)&&!xt(Array.from)&&!(this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut())){var n,s;this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),Ev()?this._onScriptLoaded():(n=Gt.__PosthogExtensions__)===null||n===void 0||(s=n.loadExternalDependency)===null||s===void 0||s.call(n,this.instance,this.scriptName,r=>{if(r)return vr.error("could not load recorder",r);this._onScriptLoaded()}),vr.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(eD))===null||s===void 0?void 0:s.script)||"recorder"}isInteractiveEvent(t){var n;return t.type===3&&Fee.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}):vr.warn("could not emit queued rrweb event.",n,t),!1}}_tryAddCustomEvent(t,n){return this._tryRRWebMethod(xD(()=>Ev().addCustomEvent(t,n)))}_tryTakeFullSnapshot(){return this._tryRRWebMethod(xD(()=>Ev().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=$e({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=Ev();if(u){this.mutationRateLimiter=(t=this.mutationRateLimiter)!==null&&t!==void 0?t:new xee(u,{refillRate:this.instance.config.session_recording.__mutationRateLimiterRefillRate,bucketSize:this.instance.config.session_recording.__mutationRateLimiterBucketSize,onBlockedNode:(h,f)=>{var p="Too many mutations on node '".concat(h,"'. Rate limiting. This could be due to SVG animations or something similar");vr.info(p,{node:f}),this.log(pg+" "+p,"warn")}});var d=this._gatherRRWebPlugins();this.stopRrweb=u($e({emit:h=>{this.onRRwebEmit(h)},plugins:d},i)),this._lastActivityTimestamp=Date.now(),this.isIdle=pl(this.isIdle)?this.isIdle:"unknown",this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:i,activePlugins:d.map(h=>h?.name)}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}else vr.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=Gt.__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=Gt.__PosthogExtensions__)===null||s===void 0||(r=s.rrwebPlugins)===null||r===void 0?void 0:r.getRecordNetworkPlugin;return this.networkPayloadCapture&&qa(o)&&(!LZ.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?i.push(o(vee(this.instance.config,this.networkPayloadCapture))):vr.info("NetworkCapture not started because we are on localhost.")),i}onRRwebEmit(t){var n;if(this._processQueuedEvents(),t&&us(t)){if(t.type===ul.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(h){return h.type===ul.Custom&&h.data.tag==="recording paused"}(t)){t.type===ul.FullSnapshot&&this._scheduleFullSnapshot(),t.type===ul.FullSnapshot&&this.triggerStatus==="trigger_pending"&&this.clearBuffer();var r=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(t):t;if(r){var i=function(h){var f=h;if(f&&us(f)&&f.type===6&&us(f.data)&&f.data.plugin==="rrweb/console@1"){f.data.payload.payload.length>10&&(f.data.payload.payload=f.data.payload.payload.slice(0,10),f.data.payload.payload.push("...[truncated]"));for(var p=[],m=0;m<f.data.payload.payload.length;m++)f.data.payload.payload[m]&&f.data.payload.payload[m].length>2e3?p.push(f.data.payload.payload[m].slice(0,2e3)+"...[truncated]"):p.push(f.data.payload.payload[m]);return f.data.payload.payload=p,h}return h}(r);if(this._updateWindowAndSessionIds(i),this.isIdle!==!0||bD(i)){if(bD(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(h){if(cb(h)<1024)return h;try{if(h.type===ul.FullSnapshot)return $e($e({},h),{},{data:bu(h.data),cv:"2024-10"});if(h.type===ul.IncrementalSnapshot&&h.data.source===ja.Mutation)return $e($e({},h),{},{cv:"2024-10",data:$e($e({},h.data),{},{texts:bu(h.data.texts),attributes:bu(h.data.attributes),removes:bu(h.data.removes),adds:bu(h.data.adds)})});if(h.type===ul.IncrementalSnapshot&&h.data.source===ja.StyleSheetRule)return $e($e({},h),{},{cv:"2024-10",data:$e($e({},h.data),{},{adds:h.data.adds?bu(h.data.adds):void 0,removes:h.data.removes?bu(h.data.removes):void 0})})}catch(f){vr.error("could not compress event - will use uncompressed event",f)}return h}(i):i,d={$snapshot_bytes:cb(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&&Be){var t=this._maskUrl(Be.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=Wr(n)&&n>=0,r=Wr(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&&mE(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:hl.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(Be!==void 0&&Be.location.href){var t=Be.location.href,n=this._urlBlocked,s=wD(t,this._urlBlocklist);s&&!n?this._pauseRecording():!s&&n&&this._resumeRecording(),wD(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"?xy:by]:this.sessionId}),this._flushBuffer(),this._reportStarted(t+"_trigger_matched"))}_pauseRecording(){this._urlBlocked||(this._urlBlocked=!0,clearInterval(this._fullSnapshotTimer),vr.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"}),vr.info("recording resumed"))}_addEventTriggerListener(){this._eventTriggers.length!==0&&kn(this._removeEventTriggerCaptureHook)&&(this._removeEventTriggerCaptureHook=this.instance.on("eventCaptured",t=>{try{this._eventTriggers.includes(t.event)&&this._activateTrigger("event")}catch(n){vr.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({[hg]:!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}),vr.info(t.replace("_"," "),n),Zt(["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 Fy=Fr("[SegmentIntegration]");function Pee(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()||Cc();s.config.get_device_id=u,l.id()&&(s.register({distinct_id:l.id(),$device_id:u()}),s.persistence.set_property(cl,"identified")),r()},o=i.user();"then"in o&&qa(o.then)?o.then(l=>a(l)):a(o)})(e,()=>{n.register((s=>{Promise&&Promise.resolve||Fy.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()||(Fy.info("No userId set, resetting PostHog"),s.reset()),i.event.userId&&i.event.userId!==s.get_distinct_id()&&(Fy.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 o6="posthog-js";function l6(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 h=e.requestRouter.endpointFor("ui","/project/".concat(e.config.token,"/person/").concat(e.get_distinct_id()));i.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var f=((a=i.exception)===null||a===void 0?void 0:a.values)||[],p=f.map(v=>$e($e({},v),{},{stacktrace:v.stacktrace?$e($e({},v.stacktrace),{},{type:"raw",frames:(v.stacktrace.frames||[]).map(x=>$e($e({},x),{},{platform:"web:javascript"}))}):void 0})),m={$exception_message:((o=f[0])===null||o===void 0?void 0:o.value)||i.message,$exception_type:(l=f[0])===null||l===void 0?void 0:l.type,$exception_personURL:h,$exception_level:i.level,$exception_list:p,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:((u=f[0])===null||u===void 0?void 0:u.value)||i.message,$sentry_exception_type:(d=f[0])===null||d===void 0?void 0:d.type,$sentry_tags:i.tags};return t&&n&&(m.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+n+"&query="+i.event_id),e.exceptions.sendExceptionEvent(m),i}}let Iee=class{constructor(t,n,s,r,i){this.name=o6,this.setupOnce=function(a){a(l6(t,{organization:n,projectId:s,prefix:r,severityAllowList:i}))}}};var dl,Nee=Be!=null&&Be.location?lb(Be.location.hash,"__posthog")||lb(location.hash,"state"):null,CD="_postHogToolbarParams",yD=Fr("[Toolbar]");(function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"})(dl||(dl={}));class Mee{constructor(t){this.instance=t}setToolbarState(t){Gt.ph_toolbar_state=t}getToolbarState(){var t;return(t=Gt.ph_toolbar_state)!==null&&t!==void 0?t:dl.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(!Be||!yt)return!1;s=(t=s)!==null&&t!==void 0?t:Be.location,i=(n=i)!==null&&n!==void 0?n:Be.history;try{if(!r){try{Be.localStorage.setItem("test","test"),Be.localStorage.removeItem("test")}catch{return!1}r=Be?.localStorage}var a,o=Nee||lb(s.hash,"__posthog")||lb(s.hash,"state"),l=o?$F(()=>JSON.parse(atob(decodeURIComponent(o))))||$F(()=>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(CD)||"{}")).source="localstorage",delete a.userIntent),!(!a.token||this.instance.config.token!==a.token)&&(this.loadToolbar(a),!0)}catch{return!1}}_callLoadToolbar(t){var n=Gt.ph_load_toolbar||Gt.ph_load_editor;!kn(n)&&qa(n)?n(t,this.instance):yD.warn("No toolbar load function found")}loadToolbar(t){var n=!(yt==null||!yt.getElementById(BB));if(!Be||n)return!1;var s=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=$e($e({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(Be.localStorage.setItem(CD,JSON.stringify($e($e({},r),{},{source:void 0}))),this.getToolbarState()===dl.LOADED)this._callLoadToolbar(r);else if(this.getToolbarState()===dl.UNINITIALIZED){var i,a;this.setToolbarState(dl.LOADING),(i=Gt.__PosthogExtensions__)===null||i===void 0||(a=i.loadExternalDependency)===null||a===void 0||a.call(i,this.instance,"toolbar",o=>{if(o)return yD.error("[Toolbar] Failed to load",o),void this.setToolbarState(dl.UNINITIALIZED);this.setToolbarState(dl.LOADED),this._callLoadToolbar(r)}),bs(Be,"turbolinks:load",()=>{this.setToolbarState(dl.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 Oee=Fr("[TracingHeaders]");class Lee{constructor(t){ct(this,"_restoreXHRPatch",void 0),ct(this,"_restoreFetchPatch",void 0),ct(this,"_startCapturing",()=>{var n,s,r,i;xt(this._restoreXHRPatch)&&((n=Gt.__PosthogExtensions__)===null||n===void 0||(s=n.tracingHeadersPatchFns)===null||s===void 0||s._patchXHR(this.instance.sessionManager)),xt(this._restoreFetchPatch)&&((r=Gt.__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=Gt.__PosthogExtensions__)!==null&&n!==void 0&&n.tracingHeadersPatchFns&&t(),(s=Gt.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"tracing-headers",i=>{if(i)return Oee.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 rc=Fr("[Web Vitals]"),SD=9e5;class Bee{constructor(t){var n;ct(this,"_enabledServerSide",!1),ct(this,"_initialized",!1),ct(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),ct(this,"_flushToCapture",()=>{clearTimeout(this._delayedFlushTimer),this.buffer.metrics.length!==0&&(this.instance.capture("$web_vitals",this.buffer.metrics.reduce((s,r)=>$e($e({},s),{},{["$web_vitals_".concat(r.name,"_event")]:$e({},r),["$web_vitals_".concat(r.name,"_value")]:r.value}),{})),this.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})}),ct(this,"_addToBuffer",s=>{var r,i=(r=this.instance.sessionManager)===null||r===void 0?void 0:r.checkAndGetSessionAndWindowId(!0);if(xt(i))rc.error("Could not read session ID. Dropping metrics!");else{this.buffer=this.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var a=this._currentURL();xt(a)||(kn(s?.name)||kn(s?.value)?rc.error("Invalid metric received",s):this._maxAllowedValue&&s.value>=this._maxAllowedValue?rc.error("Ignoring metric with value >= "+this._maxAllowedValue,s):(this.buffer.url!==a&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),xt(this.buffer.url)&&(this.buffer.url=a),this.buffer.firstMetricTimestamp=xt(this.buffer.firstMetricTimestamp)?Date.now():this.buffer.firstMetricTimestamp,s.attribution&&s.attribution.interactionTargetElement&&(s.attribution.interactionTargetElement=void 0),this.buffer.metrics.push($e($e({},s),{},{$current_url:a,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()))}}),ct(this,"_startCapturing",()=>{var s,r,i,a,o=Gt.__PosthogExtensions__;xt(o)||xt(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):rc.error("web vitals callbacks not loaded - not starting")}),this.instance=t,this._enabledServerSide=!((n=this.instance.persistence)===null||n===void 0||!n.props[zF]),this.startIfEnabled()}get allowedMetrics(){var t,n,s=us(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 xt(s)?((n=this.instance.persistence)===null||n===void 0?void 0:n.props[qF])||["CLS","FCP","INP","LCP"]:s}get flushToCaptureTimeoutMs(){return(us(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){var t=us(this.instance.config.capture_performance)&&Wr(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:SD;return 0<t&&t<=6e4?SD:t}get isEnabled(){var t=ii?.protocol;if(t!=="http:"&&t!=="https:")return rc.info("Web Vitals are disabled on non-http/https protocols"),!1;var n=us(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:pl(this.instance.config.capture_performance)?this.instance.config.capture_performance:void 0;return pl(n)?n:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(rc.info("enabled, starting..."),this.loadScript(this._startCapturing))}onRemoteConfig(t){var n=us(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=us(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this.instance.persistence&&(this.instance.persistence.register({[zF]:n}),this.instance.persistence.register({[qF]:s})),this._enabledServerSide=n,this.startIfEnabled()}loadScript(t){var n,s,r;(n=Gt.__PosthogExtensions__)!==null&&n!==void 0&&n.postHogWebVitalsCallbacks&&t(),(s=Gt.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"web-vitals",i=>{i?rc.error("failed to load script",i):t()})}_currentURL(){var t=Be?Be.location.href:void 0;return t||rc.error("Could not determine current URL"),t}}var jee=Fr("[Heatmaps]");function ED(e){return us(e)&&"clientX"in e&&"clientY"in e&&Wr(e.clientX)&&Wr(e.clientY)}class Hee{constructor(t){var n;ct(this,"rageclicks",new YB),ct(this,"_enabledServerSide",!1),ct(this,"_initialized",!1),ct(this,"_flushInterval",null),this.instance=t,this._enabledServerSide=!((n=this.instance.persistence)===null||n===void 0||!n.props[rE])}get flushIntervalMilliseconds(){var t=5e3;return us(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 xt(this.instance.config.capture_heatmaps)?xt(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;jee.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({[rE]: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(){Be&&yt&&(bs(Be,"beforeunload",this.flush.bind(this)),bs(yt,"click",t=>this._onClick(t||Be?.event),{capture:!0}),bs(yt,"mousemove",t=>this._onMouseMove(t||Be?.event),{capture:!0}),this.deadClicksCapture=new QB(this.instance,ZZ,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&&Zw(d)&&!Fc(d,"body");){if(d===u)return!1;if(Zt(l,Be?.getComputedStyle(d).position))return!0;d=$B(d)}return!1}(GB(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(!nD(t.target)&&ED(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($e($e({},r),{},{type:"rageclick"})),this._capture(r)}}_onMouseMove(t){!nD(t.target)&&ED(t)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(t,"mousemove"))},500))}_capture(t){if(Be){var n=Be.location.href;this.buffer=this.buffer||{},this.buffer[n]||(this.buffer[n]=[]),this.buffer[n].push(t)}}flush(){this.buffer&&!Ih(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class Uee{constructor(t){this._instance=t}doPageView(t,n){var s,r=this._previousPageViewProperties(t,n);return this._currentPageview={pathname:(s=Be?.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:h}=i;if(!(xt(a)||xt(o)||xt(l)||xt(u)||xt(d)||xt(h))){a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),u=Math.ceil(u),d=Math.ceil(d),h=Math.ceil(h);var f=a<=1?1:la(o/a,0,1),p=a<=1?1:la(l/a,0,1),m=u<=1?1:la(d/u,0,1),v=u<=1?1:la(h/u,0,1);r=vs(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:f,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:p,$prev_pageview_last_content:d,$prev_pageview_last_content_percentage:m,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:v})}}return s.pathname&&(r.$prev_pageview_pathname=s.pathname),s.timestamp&&(r.$prev_pageview_duration=(t.getTime()-s.timestamp.getTime())/1e3),r}}let Gee=class{constructor(t){this.instance=t}sendExceptionEvent(t){this.instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent"})}};var fa="Mobile",db="iOS",Do="Android",_m="Tablet",c6=Do+" "+_m,u6="iPad",d6="Apple",h6=d6+" Watch",Tm="Safari",kf="BlackBerry",f6="Samsung",p6=f6+"Browser",g6=f6+" Internet",md="Chrome",$ee=md+" OS",m6=md+" "+db,lT="Internet Explorer",v6=lT+" "+fa,cT="Opera",Vee=cT+" Mini",uT="Edge",x6="Microsoft "+uT,zh="Firefox",b6=zh+" "+db,Rm="Nintendo",Am="PlayStation",qh="Xbox",w6=Do+" "+fa,C6=fa+" "+Tm,gg="Windows",SE=gg+" Phone",kD="Nokia",EE="Ouya",y6="Generic",Wee=y6+" "+fa.toLowerCase(),S6=y6+" "+_m.toLowerCase(),kE="Konqueror",Ur="(\\d+(\\.\\d+)?)",Dy=new RegExp("Version/"+Ur),zee=new RegExp(qh,"i"),qee=new RegExp(Am+" \\w+","i"),Kee=new RegExp(Rm+" \\w+","i"),dT=new RegExp(kf+"|PlayBook|BB10","i"),Yee={"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"},_E,Xee=(e,t)=>t&&Zt(t,d6)||function(n){return Zt(n,Tm)&&!Zt(n,md)&&!Zt(n,Do)}(e),_D=function(e,t){return t=t||"",Zt(e," OPR/")&&Zt(e,"Mini")?Vee:Zt(e," OPR/")?cT:dT.test(e)?kf:Zt(e,"IE"+fa)||Zt(e,"WPDesktop")?v6:Zt(e,p6)?g6:Zt(e,uT)||Zt(e,"Edg/")?x6:Zt(e,"FBIOS")?"Facebook "+fa:Zt(e,"UCWEB")||Zt(e,"UCBrowser")?"UC Browser":Zt(e,"CriOS")?m6:Zt(e,"CrMo")||Zt(e,md)?md:Zt(e,Do)&&Zt(e,Tm)?w6:Zt(e,"FxiOS")?b6:Zt(e.toLowerCase(),kE.toLowerCase())?kE:Xee(e,t)?Zt(e,fa)?C6:Tm:Zt(e,zh)?zh:Zt(e,"MSIE")||Zt(e,"Trident/")?lT:Zt(e,"Gecko")?zh:""},Qee={[v6]:[new RegExp("rv:"+Ur)],[x6]:[new RegExp(uT+"?\\/"+Ur)],[md]:[new RegExp("("+md+"|CrMo)\\/"+Ur)],[m6]:[new RegExp("CriOS\\/"+Ur)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ur)],[Tm]:[Dy],[C6]:[Dy],[cT]:[new RegExp("(Opera|OPR)\\/"+Ur)],[zh]:[new RegExp(zh+"\\/"+Ur)],[b6]:[new RegExp("FxiOS\\/"+Ur)],[kE]:[new RegExp("Konqueror[:/]?"+Ur,"i")],[kf]:[new RegExp(kf+" "+Ur),Dy],[w6]:[new RegExp("android\\s"+Ur,"i")],[g6]:[new RegExp(p6+"\\/"+Ur)],[lT]:[new RegExp("(rv:|MSIE )"+Ur)],Mozilla:[new RegExp("rv:"+Ur)]},TD=[[new RegExp(qh+"; "+qh+" (.*?)[);]","i"),e=>[qh,e&&e[1]||""]],[new RegExp(Rm,"i"),[Rm,""]],[new RegExp(Am,"i"),[Am,""]],[dT,[kf,""]],[new RegExp(gg,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[SE,""];if(new RegExp(fa).test(t)&&!/IEMobile\b/.test(t))return[gg+" "+fa,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var s=n[1],r=Yee[s]||"";return/arm/i.test(t)&&(r="RT"),[gg,r]}return[gg,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[db,t.join(".")]}return[db,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=xt(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Do+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Do+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[Do,t.join(".")]}return[Do,""]}],[/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/,[$ee,""]],[/Linux|debian/i,["Linux",""]]],RD=function(e){return Kee.test(e)?Rm:qee.test(e)?Am:zee.test(e)?qh:new RegExp(EE,"i").test(e)?EE:new RegExp("("+SE+"|WPDesktop)","i").test(e)?SE:/iPad/.test(e)?u6:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?h6:dT.test(e)?kf:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(kD,"i").test(e)?kD:/(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(fa).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)?Do:c6:Do:new RegExp("(pda|"+fa+")","i").test(e)?Wee:new RegExp(_m,"i").test(e)&&!new RegExp(_m+" pc","i").test(e)?S6:""},kv="https?://(.*)",_x=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","irclid","_kx"],Jee=yx(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],_x),Py="<masked>",Qn={campaignParams:function(){var{customTrackedParams:e,maskPersonalDataProperties:t,customPersonalDataProperties:n}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!yt)return{};var s=t?yx([],_x,n||[]):[];return this._campaignParamsFromUrl(wy(yt.URL,s,Py),e)},_campaignParamsFromUrl:function(e,t){var n=Jee.concat(t||[]),s={};return Pn(n,function(r){var i=ob(e,r);s[r]=i||null}),s},_searchEngine:function(e){return e?e.search(kv+"google.([^/?]*)")===0?"google":e.search(kv+"bing.com")===0?"bing":e.search(kv+"yahoo.com")===0?"yahoo":e.search(kv+"duckduckgo.com")===0?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){var t=Qn._searchEngine(e),n=t!="yahoo"?"q":"p",s={};if(!Qc(t)){s.$search_engine=t;var r=yt?ob(yt.referrer,n):"";r.length&&(s.ph_keyword=r)}return s},searchInfo:function(){var e=yt?.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:_D,browserVersion:function(e,t){var n=_D(e,t),s=Qee[n];if(xt(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<TD.length;t++){var[n,s]=TD[t],r=n.exec(e),i=r&&(qa(s)?s(r,e):s);if(i)return i}return["",""]},device:RD,deviceType:function(e){var t=RD(e);return t===u6||t===c6||t==="Kobo"||t==="Kindle Fire"||t===S6?_m:t===Rm||t===qh||t===Am||t===EE?"Console":t===h6?"Wearable":t?fa:"Desktop"},referrer:function(){return yt?.referrer||"$direct"},referringDomain:function(){var e;return yt!=null&&yt.referrer&&((e=Wh(yt.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?yx([],_x,t||[]):[],s=ii?.href.substring(0,1e3);return{r:this.referrer().substring(0,1e3),u:s?wy(s,n,Py):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=Wh(n))===null||t===void 0?void 0:t.host};if(s){r.$current_url=s;var i=Wh(s);r.$host=i?.host,r.$pathname=i?.pathname;var a=this._campaignParamsFromUrl(s);vs(r,a)}if(n){var o=this._searchInfoFromReferrer(n);vs(r,o)}return r},initialPersonPropsFromInfo:function(e){var t=this.personPropsFromInfo(e),n={};return Pn(t,function(s,r){n["$initial_".concat(sT(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(!Ds)return{};var n=e?yx([],_x,t||[]):[],[s,r]=Qn.os(Ds);return vs(km({$os:s,$os_version:r,$browser:Qn.browser(Ds,navigator.vendor),$device:Qn.device(Ds),$device_type:Qn.deviceType(Ds),$timezone:Qn.timezone(),$timezone_offset:Qn.timezoneOffset()}),{$current_url:wy(ii?.href,n,Py),$host:ii?.host,$pathname:ii?.pathname,$raw_user_agent:Ds.length>1e3?Ds.substring(0,997)+"...":Ds,$browser_version:Qn.browserVersion(Ds,navigator.vendor),$browser_language:Qn.browserLanguage(),$browser_language_prefix:Qn.browserLanguagePrefix(),$screen_height:Be?.screen.height,$screen_width:Be?.screen.width,$viewport_height:Be?.innerHeight,$viewport_width:Be?.innerWidth,$lib:"web",$lib_version:hl.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(!Ds)return{};var[e,t]=Qn.os(Ds);return vs(km({$os:e,$os_version:t,$browser:Qn.browser(Ds,navigator.vendor)}),{$browser_version:Qn.browserVersion(Ds,navigator.vendor)})}},bo=Fr("[FeatureFlags]"),Iy="$active_feature_flags",lh="$override_feature_flags",AD="$feature_flag_payloads",jp="$override_feature_flag_payloads",FD="$feature_flag_request_id",DD=e=>{var t={};for(var[n,s]of Sx(e||{}))s&&(t[n]=s);return t},Zee=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]}))):bo.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"})(_E||(_E={}));class ete{constructor(t){ct(this,"_override_warning",!1),ct(this,"_hasLoadedFlags",!1),ct(this,"_requestInFlight",!1),ct(this,"_reloadingDisabled",!1),ct(this,"_additionalReloadRequested",!1),ct(this,"_decideCalled",!1),ct(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(aE),n=this.instance.get_property(lh),s=this.instance.get_property(jp);if(!s&&!n)return t||{};var r=vs({},t||{}),i=[...new Set([...Object.keys(s||{}),...Object.keys(n||{})])];for(var a of i){var o,l,u=r[a],d=n?.[a],h=xt(d)?(o=u?.enabled)!==null&&o!==void 0&&o:!!d,f=xt(d)?u.variant:typeof d=="string"?d:void 0,p=s?.[a],m=$e($e({},u),{},{enabled:h,variant:h?f??u?.variant:void 0});h!==u?.enabled&&(m.original_enabled=u?.enabled),f!==u?.variant&&(m.original_variant=u?.variant),p&&(m.metadata=$e($e({},u?.metadata),{},{payload:p,original_payload:u==null||(l=u.metadata)===null||l===void 0?void 0:l.payload})),r[a]=m}return this._override_warning||(bo.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:s,finalDetails:r}),this._override_warning=!0),r}getFlagVariants(){var t=this.instance.get_property(Nh),n=this.instance.get_property(lh);if(!n)return t||{};for(var s=vs({},t),r=Object.keys(n),i=0;i<r.length;i++)s[r[i]]=n[r[i]];return this._override_warning||(bo.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:n,finalFlags:s}),this._override_warning=!0),s}getFlagPayloads(){var t=this.instance.get_property(AD),n=this.instance.get_property(jp);if(!n)return t||{};for(var s=vs({},t||{}),r=Object.keys(n),i=0;i<r.length;i++)s[r[i]]=n[r[i]];return this._override_warning||(bo.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:$e($e({},((n=this.instance.persistence)===null||n===void 0?void 0:n.get_initial_props())||{}),this.instance.get_property(fg)||{}),group_properties:this.instance.get_property(Eu)};(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=Qn.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:Ga.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(_E.FeatureFlags)?bo.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(FD)||void 0,a=this.instance.get_property(rb)||{};if((n.send_event||!("send_event"in n))&&(!(t in a)||!a[t].includes(r))){var o,l,u,d,h,f,p,m,v,x,b;cs(a[t])?a[t].push(r):a[t]=[r],(o=this.instance.persistence)===null||o===void 0||o.register({[rb]:a});var w=this.getFeatureFlagDetails(t),C={$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||(h=d.featureFlagPayloads)===null||h===void 0?void 0:h[t])||null,$used_bootstrap_value:!this._flagsLoadedFromRemote};xt(w==null||(f=w.metadata)===null||f===void 0?void 0:f.version)||(C.$feature_flag_version=w.metadata.version);var k,y=(p=w==null||(m=w.reason)===null||m===void 0?void 0:m.description)!==null&&p!==void 0?p:w==null||(v=w.reason)===null||v===void 0?void 0:v.code;y&&(C.$feature_flag_reason=y),w!=null&&(x=w.metadata)!==null&&x!==void 0&&x.id&&(C.$feature_flag_id=w.metadata.id),xt(w?.original_variant)&&xt(w?.original_enabled)||(C.$feature_flag_original_response=xt(w.original_variant)?w.original_enabled:w.original_variant),w!=null&&(b=w.metadata)!==null&&b!==void 0&&b.original_payload&&(C.$feature_flag_original_payload=w==null||(k=w.metadata)===null||k===void 0?void 0:k.original_payload),this.instance.capture("$feature_flag_called",C)}return s}bo.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:Ga.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);bo.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]:{},h=Zee(a),f=h.flags,p=h.featureFlags,m=h.featureFlagPayloads;if(p){var v=a.requestId;if(cs(p)){bo.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var x={};if(p)for(var b=0;b<p.length;b++)x[p[b]]=!0;o&&o.register({[Iy]:p,[Nh]:x})}else{var w=p,C=m,k=f;a.errorsWhileComputingFlags&&(w=$e($e({},l),w),C=$e($e({},u),C),k=$e($e({},d),k)),o&&o.register($e({[Iy]:Object.keys(DD(w)),[Nh]:w||{},[AD]:C||{},[aE]:k||{}},v?{[FD]:v}:{}))}}})(t,this.instance.persistence,s,r,i),this._fireFeatureFlagsCallbacks(n)}}override(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];bo.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:n})}overrideFeatureFlags(t){if(!this.instance.__loaded||!this.instance.persistence)return bo.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.instance.persistence.unregister(lh),this.instance.persistence.unregister(jp),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(lh);else if(s.flags)if(cs(s.flags)){for(var r={},i=0;i<s.flags.length;i++)r[s.flags[i]]=!0;this.instance.persistence.register({[lh]:r})}else this.instance.persistence.register({[lh]:s.flags})}return"payloads"in s&&(s.payloads===!1?this.instance.persistence.unregister(jp):s.payloads&&this.instance.persistence.register({[jp]:s.payloads})),void this._fireFeatureFlagsCallbacks()}this._fireFeatureFlagsCallbacks()}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this._hasLoadedFlags){var{flags:n,flagVariants:s}=this._prepareFeatureFlagsForCallbacks();t(n,s)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,n){var s,r=(this.instance.get_property(Ex)||[]).find(l=>l.flagKey===t),i={["$feature_enrollment/".concat(t)]:n},a={$feature_flag:t,$feature_enrollment:n,$set:i};r&&(a.$early_access_feature_name=r.name),this.instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(i,!1);var o=$e($e({},this.getFlagVariants()),{},{[t]:n});(s=this.instance.persistence)===null||s===void 0||s.register({[Iy]:Object.keys(DD(o)),[Nh]:o}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1],s=arguments.length>2?arguments[2]:void 0,r=this.instance.get_property(Ex),i=s?"&".concat(s.map(a=>"stage=".concat(a)).join("&")):"";if(r&&!n)return t(r);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/early_access_features/?token=".concat(this.instance.config.token).concat(i)),method:"GET",callback:a=>{var o;if(a.json){var l=a.json.earlyAccessFeatures;return(o=this.instance.persistence)===null||o===void 0||o.register({[Ex]:l}),t(l)}}})}_prepareFeatureFlagsForCallbacks(){var t=this.getFlags(),n=this.getFlagVariants();return{flags:t.filter(s=>n[s]),flagVariants:Object.keys(n).filter(s=>n[s]).reduce((s,r)=>(s[r]=n[r],s),{})}}_fireFeatureFlagsCallbacks(t){var{flags:n,flagVariants:s}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach(r=>r(n,s,{errorsLoading:t}))}setPersonPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],s=this.instance.get_property(fg)||{};this.instance.register({[fg]:$e($e({},s),t)}),n&&this.instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this.instance.unregister(fg)}setGroupPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],s=this.instance.get_property(Eu)||{};Object.keys(s).length!==0&&Object.keys(s).forEach(r=>{s[r]=$e($e({},s[r]),t[r]),delete t[r]}),this.instance.register({[Eu]:$e($e({},s),t)}),n&&this.instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var n=this.instance.get_property(Eu)||{};this.instance.register({[Eu]:$e($e({},n),{},{[t]:{}})})}else this.instance.unregister(Eu)}}var tte=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Ny{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&&_t.info("Persistence loaded",t.persistence,$e({},this.props)),this.update_config(t,t),this.save()}buildStorage(t){tte.indexOf(t.persistence.toLowerCase())===-1&&(_t.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n=t.persistence.toLowerCase();return n==="localstorage"&&Bs.is_supported()?Bs:n==="localstorage+cookie"&&bv.is_supported()?bv:n==="sessionstorage"&&dr.is_supported()?dr:n==="memory"?QZ:n==="cookie"?wl:bv.is_supported()?bv:wl}properties(){var t={};return Pn(this.props,function(n,s){if(s===Nh&&us(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,(Qc(a=AZ)?l:jF&&a.indexOf===jF?a.indexOf(o)!=-1:(Pn(a,function(u){if(l||(l=u===o))return nb}),l))||(t[s]=n);var a,o,l}),t}load(){if(!this.disabled){var t=this.storage.parse(this.name);t&&(this.props=vs({},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(us(t)){xt(n)&&(n="None"),this.expire_days=xt(s)?this.default_expiry:s;var r=!1;if(Pn(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(us(t)){this.expire_days=xt(n)?this.default_expiry:n;var s=!1;if(Pn(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=Qn.campaignParams({customTrackedParams:this.config.custom_campaign_params,maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});Ih(km(t))||this.register(t),this.campaign_params_saved=!0}}update_search_keyword(){this.register(Qn.searchInfo())}update_referrer_info(){this.register_once(Qn.referrerInfo(),void 0)}set_initial_person_info(){this.props[uE]||this.props[dE]||this.register_once({[hE]:Qn.personInfo({maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties})},void 0)}get_referrer_info(){return km({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}get_initial_props(){var t={};Pn([dE,uE],r=>{var i=this.props[r];i&&Pn(i,function(a,o){t["$initial_"+sT(o)]=a})});var n=this.props[hE];if(n){var s=Qn.initialPersonPropsFromInfo(n);vs(t,s)}return t}safe_merge(t){return Pn(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[dg]||{};s[t]=n,this.props[dg]=s,this.save()}remove_event_timer(t){var n=(this.props[dg]||{})[t];return xt(n)||(delete this.props[dg][t],this.save()),n}get_property(t){return this.props[t]}set_property(t,n){this.props[t]=n,this.save()}}var E6,ds,k6,Au,PD,_6,TE,T6,ID,RE,ND,MD,OD,LD,AE={},R6=[],nte=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,hT=Array.isArray;function yc(e,t){for(var n in t)e[n]=t[n];return e}function A6(e){var t=e.parentNode;t&&t.removeChild(e)}function My(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??++k6,__i:-1,__u:0};return r==null&&ds.vnode!=null&&ds.vnode(i),i}function fT(e){return e.children}function Tx(e,t){this.props=e,this.context=t}function _f(e,t){if(t==null)return e.__?_f(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"?_f(e):null}function F6(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 F6(e)}}function FE(e){(!e.__d&&(e.__d=!0)&&Au.push(e)&&!hb.__r++||PD!==ds.debounceRendering)&&((PD=ds.debounceRendering)||_6)(hb)}function hb(){var e,t,n,s,r,i,a,o,l;for(Au.sort(TE);e=Au.shift();)e.__d&&(t=Au.length,s=void 0,i=(r=(n=e).__v).__e,o=[],l=[],(a=n.__P)&&((s=yc({},r)).__v=r.__v+1,ds.vnode&&ds.vnode(s),I6(a,s,r,n.__n,a.ownerSVGElement!==void 0,32&r.__u?[i]:null,o,i??_f(r),!!(32&r.__u),l),s.__.__k[s.__i]=s,ite(o,s,l),s.__e!=i&&F6(s)),Au.length>t&&Au.sort(TE));hb.__r=0}function D6(e,t,n,s,r,i,a,o,l,u,d){var h,f,p,m,v,x=s&&s.__k||R6,b=t.length;for(n.__d=l,ste(n,t,x),l=n.__d,h=0;h<b;h++)(p=n.__k[h])!=null&&typeof p!="boolean"&&typeof p!="function"&&(f=p.__i===-1?AE:x[p.__i]||AE,p.__i=h,I6(e,p,f,r,i,a,o,l,u,d),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&pT(f.ref,null,p),d.push(p.ref,p.__c||m,p)),v==null&&m!=null&&(v=m),65536&p.__u||f.__k===p.__k?l=P6(p,l,e):typeof p.type=="function"&&p.__d!==void 0?l=p.__d:m&&(l=m.nextSibling),p.__d=void 0,p.__u&=-196609);n.__d=l,n.__e=v}function ste(e,t,n){var s,r,i,a,o,l=t.length,u=n.length,d=u,h=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?My(null,r,null,null,r):hT(r)?My(fT,{children:r},null,null,null):r.constructor===void 0&&r.__b>0?My(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)!=null?(r.__=e,r.__b=e.__b+1,o=rte(r,n,a=s+h,d),r.__i=o,i=null,o!==-1&&(d--,(i=n[o])&&(i.__u|=131072)),i==null||i.__v===null?(o==-1&&h--,typeof r.type!="function"&&(r.__u|=65536)):o!==a&&(o===a+1?h++:o>a?d>l-a?h+=o-a:h--:h=o<a&&o==a-1?o-a:0,o!==s+h&&(r.__u|=65536))):(i=n[s])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=_f(i)),DE(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=_f(i)),DE(i,i))}function P6(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=P6(s[r],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function rte(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 BD(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||nte.test(t)?n:n+"px"}function _v(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||BD(e.style,t,"");if(n)for(t in n)s&&n[t]===s[t]||BD(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?HD:jD,i)):e.removeEventListener(t,i?HD:jD,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 jD(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(ds.event?ds.event(e):e)}function HD(e){return this.l[e.type+!0](ds.event?ds.event(e):e)}function I6(e,t,n,s,r,i,a,o,l,u){var d,h,f,p,m,v,x,b,w,C,k,y,E,T,F,R=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),i=[o=t.__e=n.__e]),(d=ds.__b)&&d(t);e:if(typeof R=="function")try{if(b=t.props,w=(d=R.contextType)&&s[d.__c],C=d?w?w.props.value:d.__:s,n.__c?x=(h=t.__c=n.__c).__=h.__E:("prototype"in R&&R.prototype.render?t.__c=h=new R(b,C):(t.__c=h=new Tx(b,C),h.constructor=R,h.render=ote),w&&w.sub(h),h.props=b,h.state||(h.state={}),h.context=C,h.__n=s,f=h.__d=!0,h.__h=[],h._sb=[]),h.__s==null&&(h.__s=h.state),R.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=yc({},h.__s)),yc(h.__s,R.getDerivedStateFromProps(b,h.__s))),p=h.props,m=h.state,h.__v=t,f)R.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(R.getDerivedStateFromProps==null&&b!==p&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(b,C),!h.__e&&(h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(b,h.__s,C)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(h.props=b,h.state=h.__s,h.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(I){I&&(I.__=t)}),k=0;k<h._sb.length;k++)h.__h.push(h._sb[k]);h._sb=[],h.__h.length&&a.push(h);break e}h.componentWillUpdate!=null&&h.componentWillUpdate(b,h.__s,C),h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(p,m,v)})}if(h.context=C,h.props=b,h.__P=e,h.__e=!1,y=ds.__r,E=0,"prototype"in R&&R.prototype.render){for(h.state=h.__s,h.__d=!1,y&&y(t),d=h.render(h.props,h.state,h.context),T=0;T<h._sb.length;T++)h.__h.push(h._sb[T]);h._sb=[]}else do h.__d=!1,y&&y(t),d=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++E<25);h.state=h.__s,h.getChildContext!=null&&(s=yc(yc({},s),h.getChildContext())),f||h.getSnapshotBeforeUpdate==null||(v=h.getSnapshotBeforeUpdate(p,m)),D6(e,hT(F=d!=null&&d.type===fT&&d.key==null?d.props.children:d)?F:[F],t,n,s,r,i,a,o,l,u),h.base=t.__e,t.__u&=-161,h.__h.length&&a.push(h),x&&(h.__E=h.__=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),ds.__e(I,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=ate(n.__e,t,n,s,r,i,a,l,u);(d=ds.diffed)&&d(t)}function ite(e,t,n){t.__d=void 0;for(var s=0;s<n.length;s++)pT(n[s],n[++s],n[++s]);ds.__c&&ds.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(i){i.call(r)})}catch(i){ds.__e(i,r.__v)}})}function ate(e,t,n,s,r,i,a,o,l){var u,d,h,f,p,m,v,x=n.props,b=t.props,w=t.type;if(w==="svg"&&(r=!0),i!=null){for(u=0;u<i.length;u++)if((p=i[u])&&"setAttribute"in p==!!w&&(w?p.localName===w:p.nodeType===3)){e=p,i[u]=null;break}}if(e==null){if(w===null)return document.createTextNode(b);e=r?document.createElementNS("http://www.w3.org/2000/svg",w):document.createElement(w,b.is&&b),i=null,o=!1}if(w===null)x===b||o&&e.data===b||(e.data=b);else{if(i=i&&E6.call(e.childNodes),x=n.props||AE,!o&&i!=null)for(x={},u=0;u<e.attributes.length;u++)x[(p=e.attributes[u]).name]=p.value;for(u in x)p=x[u],u=="children"||(u=="dangerouslySetInnerHTML"?h=p:u==="key"||u in b||_v(e,u,null,p,r));for(u in b)p=b[u],u=="children"?f=p:u=="dangerouslySetInnerHTML"?d=p:u=="value"?m=p:u=="checked"?v=p:u==="key"||o&&typeof p!="function"||x[u]===p||_v(e,u,p,x[u],r);if(d)o||h&&(d.__html===h.__html||d.__html===e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(h&&(e.innerHTML=""),D6(e,hT(f)?f:[f],t,n,s,r&&w!=="foreignObject",i,a,i?i[0]:n.__k&&_f(n,0),o,l),i!=null)for(u=i.length;u--;)i[u]!=null&&A6(i[u]);o||(u="value",m!==void 0&&(m!==e[u]||w==="progress"&&!m||w==="option"&&m!==x[u])&&_v(e,u,m,x[u],!1),u="checked",v!==void 0&&v!==e[u]&&_v(e,u,v,x[u],!1))}return e}function pT(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(s){ds.__e(s,n)}}function DE(e,t,n){var s,r;if(ds.unmount&&ds.unmount(e),(s=e.ref)&&(s.current&&s.current!==e.__e||pT(s,null,t)),(s=e.__c)!=null){if(s.componentWillUnmount)try{s.componentWillUnmount()}catch(i){ds.__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]&&DE(s[r],t,n||typeof e.type!="function");n||e.__e==null||A6(e.__e),e.__=e.__e=e.__d=void 0}function ote(e,t,n){return this.constructor(e,n)}E6=R6.slice,ds={__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}},k6=0,Tx.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=yc({},this.state),typeof e=="function"&&(e=e(yc({},n),this.props)),e&&yc(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),FE(this))},Tx.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),FE(this))},Tx.prototype.render=fT,Au=[],_6=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,TE=function(e,t){return e.__v.__b-t.__v.__b},hb.__r=0,T6=0,function(e){e.Button="button",e.Tab="tab",e.Selector="selector"}(ID||(ID={})),function(e){e.Left="left",e.Center="center",e.Right="right",e.NextToTrigger="next_to_trigger"}(RE||(RE={})),function(e){e.Popover="popover",e.API="api",e.Widget="widget"}(ND||(ND={})),function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"}(MD||(MD={})),function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"}(OD||(OD={})),function(e){e.Once="once",e.Recurring="recurring",e.Always="always"}(LD||(LD={}));var Tf=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}},cr=Fr("[Surveys]"),UD={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=>Tf(t,n)),not_regex:(e,t)=>e.every(n=>!Tf(t,n)),exact:(e,t)=>e.some(n=>t===n),is_not:(e,t)=>e.every(n=>t!==n)};function GD(e){return e??"icontains"}RE.Right;(function(e,t){var n={__c:t="__cC"+T6++,__: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,FE(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 N6=class{constructor(){ct(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)}},lte=class Eh{constructor(t){ct(this,"_debugEventEmitter",new N6),ct(this,"checkStep",(n,s)=>this.checkStepEvent(n,s)&&this.checkStepUrl(n,s)&&this.checkStepElement(n,s)),ct(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(!xt((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(!xt((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"||!Eh.matchString(r,n?.url,n?.url_matching||"contains"))return!1}return!0}static matchString(t,n,s){switch(s){case"regex":return!!Be&&Tf(t,n);case"exact":return n===t;case"contains":var r=Eh.escapeStringRegexp(n).replace(/_/g,".").replace(/%/g,".*");return Tf(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&&!Eh.matchString(i.href||"",n?.href,n?.href_matching||"exact"))&&(n==null||!n.tag_name||i.tag_name===n?.tag_name)&&!(n!=null&&n.text&&!Eh.matchString(i.text||"",n?.text,n?.text_matching||"exact")&&!Eh.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}},PE=class M6{constructor(t){this.instance=t,this.eventToSurveys=new Map,this.actionToSurveys=new Map}register(t){var n;xt((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 lte(this.instance),this.actionMatcher.init(),this.actionMatcher._addActionHook(s=>{this.onAction(s)})),n.forEach(s=>{var r,i,a,o,l,u,d,h,f,p;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),(h=s.conditions)===null||h===void 0||(f=h.actions)===null||f===void 0||(p=f.values)===null||p===void 0||p.forEach(m=>{if(m&&m.name){var v=this.actionToSurveys.get(m.name);v&&v.push(s.id),this.actionToSurveys.set(m.name,v||[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[xv])||[];if(M6.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[xv])||[];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({[xv]:[...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[xv];return s||[]}getEventToSurveys(){return this.eventToSurveys}_getActionMatcher(){return this.actionMatcher}};ct(PE,"SURVEY_SHOWN_EVENT_NAME","survey shown");let cte=class{constructor(t){ct(this,"_isFetchingSurveys",!1),ct(this,"_isInitializingSurveys",!1),ct(this,"_surveyCallbacks",[]),this.instance=t,this._surveyEventReceiver=null}onRemoteConfig(t){var n=t.surveys;if(kn(n))return cr.warn("Decide not loaded yet. Not loading surveys.");var s=cs(n);this._hasSurveys=s?n.length>0:n,cr.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)cr.info("Already initializing surveys, skipping...");else if(this.instance.config.disable_surveys)cr.info("Disabled. Not loading surveys.");else{var t=Gt?.__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 PE(this.instance),cr.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 cr.error("Could not load surveys script",i),void(this._isInitializingSurveys=!1);this._surveyManager=t.generateSurveys(this.instance),this._isInitializingSurveys=!1,this._surveyEventReceiver=new PE(this.instance),cr.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})});else{var r="PostHog loadExternalDependency extension not found. Cannot load remote config.";cr.error(r),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:r})}}}catch(i){throw cr.error("Error initializing surveys",i),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:"Error initializing surveys"}),i}}else cr.info("No surveys to load.");else cr.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 cr.info("Disabled. Not loading surveys."),t([]);var s=this.instance.get_property(oE);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 cr.error(o),t([],{isLoaded:!1,error:o})}var l,u=r.json.surveys||[],d=u.filter(h=>{var f,p,m,v,x,b,w,C,k,y,E,T;return((f=h.conditions)===null||f===void 0?void 0:f.events)&&((p=h.conditions)===null||p===void 0||(m=p.events)===null||m===void 0?void 0:m.values)&&((v=h.conditions)===null||v===void 0||(x=v.events)===null||x===void 0||(b=x.values)===null||b===void 0?void 0:b.length)>0||((w=h.conditions)===null||w===void 0?void 0:w.actions)&&((C=h.conditions)===null||C===void 0||(k=C.actions)===null||k===void 0?void 0:k.values)&&((y=h.conditions)===null||y===void 0||(E=y.actions)===null||E===void 0||(T=E.values)===null||T===void 0?void 0:T.length)>0});return d.length>0&&((l=this._surveyEventReceiver)===null||l===void 0||l.register(d)),(i=this.instance.persistence)===null||i===void 0||i.register({[oE]: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){cr.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(p){var m,v,x;if((m=p.conditions)===null||m===void 0||!m.url)return!0;var b=Be==null||(v=Be.location)===null||v===void 0?void 0:v.href;if(!b)return!1;var w=[p.conditions.url];return UD[GD((x=p.conditions)===null||x===void 0?void 0:x.urlMatchType)](w,b)}(l),h=(u=l.conditions)===null||u===void 0||!u.selector||yt?.querySelector(l.conditions.selector),f=function(p){var m,v,x;if((m=p.conditions)===null||m===void 0||!m.deviceTypes||((v=p.conditions)===null||v===void 0?void 0:v.deviceTypes.length)===0)return!0;if(!Ds)return!1;var b=Qn.deviceType(Ds);return UD[GD((x=p.conditions)===null||x===void 0?void 0:x.deviceTypesMatchType)](p.conditions.deviceTypes,b)}(l);return d&&h&&f}),a=(r=this._surveyEventReceiver)===null||r===void 0?void 0:r.getSurveys(),o=i.filter(l=>{var u,d,h,f,p,m,v,x,b;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),C=this.isSurveyFeatureFlagEnabled(l.targeting_flag_key),k=((d=(h=l.conditions)===null||h===void 0||(f=h.events)===null||f===void 0||(p=f.values)===null||p===void 0?void 0:p.length)!==null&&d!==void 0?d:0)>0,y=((m=(v=l.conditions)===null||v===void 0||(x=v.actions)===null||x===void 0||(b=x.values)===null||b===void 0?void 0:b.length)!==null&&m!==void 0?m:0)>0,E=!k&&!y||a?.includes(l.id),T=this._canActivateRepeatedly(l)||this.isSurveyFeatureFlagEnabled(l.internal_targeting_flag_key),F=this.checkFlags(l);return w&&C&&T&&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 kn((n=Gt.__PosthogExtensions__)===null||n===void 0?void 0:n.canActivateRepeatedly)?(cr.warn("init was not called"),!1):Gt.__PosthogExtensions__.canActivateRepeatedly(t)}canRenderSurvey(t){if(kn(this._surveyManager))return cr.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?$e({},this._surveyManager.canRenderSurvey(r)):{visible:!1,disabledReason:"Survey not found"}}),n}renderSurvey(t,n){kn(this._surveyManager)?cr.warn("init was not called"):this.getSurveys(s=>{var r=s.filter(i=>i.id===t)[0];this._surveyManager.renderSurvey(r,yt?.querySelector(n))})}};var $D=Fr("[RateLimiter]");let ute=class{constructor(t){var n,s;ct(this,"serverLimits",{}),ct(this,"lastEventRateLimited",!1),ct(this,"checkForLimiting",r=>{var i=r.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(a=>{$D.info("".concat(a||"events"," is quota limited.")),this.serverLimits[a]=new Date().getTime()+6e4})}catch(a){return void $D.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(cE))!==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(cE,a),{isRateLimited:o,remainingTokens:a.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}};var wu=Fr("[RemoteConfig]");let dte=class{constructor(t){this.instance=t}get remoteConfig(){var t,n;return(t=Gt._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=Gt.__PosthogExtensions__)!==null&&n!==void 0&&n.loadExternalDependency?(s=Gt.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"remote-config",()=>t(this.remoteConfig)):(wu.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 wu.info("Using preloaded remote config",this.remoteConfig),void this.onRemoteConfig(this.remoteConfig);if(this.instance.config.advanced_disable_decide)return void wu.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(t=>{if(!t)return wu.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){wu.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()):wu.info("__preview_remote_config is disabled. Logging config instead",t):wu.error("Failed to fetch remote config from PostHog.")}};var hte=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),Qc(o)||(n>t&&(i+=e.substring(t,n)),i+=o,t=n=r+1)}return n>t&&(i+=e.substring(t,e.length)),i},fte=!!nE||!!tE,VD="text/plain",fb=(e,t)=>{var[n,s]=e.split("?"),r=$e({},t);s?.split("&").forEach(a=>{var[o]=a.split("=");delete r[o]});var i=BZ(r);return i=i?(s?s+"&":"")+i:s,"".concat(n,"?").concat(i)},mg=(e,t)=>JSON.stringify(e,(n,s)=>typeof s=="bigint"?s.toString():s,t),Oy=e=>{var{data:t,compression:n}=e;if(t){if(n===Ga.GZipJS){var s=i6(a6(mg(t)),{mtime:0}),r=new Blob([s],{type:VD});return{contentType:VD,body:r,estimatedSize:r.size}}if(n===Ga.Base64){var i=function(l){var u,d,h,f,p,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",v=0,x=0,b="",w=[];if(!l)return l;l=hte(l);do u=(p=l.charCodeAt(v++)<<16|l.charCodeAt(v++)<<8|l.charCodeAt(v++))>>18&63,d=p>>12&63,h=p>>6&63,f=63&p,w[x++]=m.charAt(u)+m.charAt(d)+m.charAt(h)+m.charAt(f);while(v<l.length);switch(b=w.join(""),l.length%3){case 1:b=b.slice(0,-2)+"==";break;case 2:b=b.slice(0,-1)+"="}return b}(mg(t)),a=(l=>"data="+encodeURIComponent(typeof l=="string"?l:mg(l)))(i);return{contentType:"application/x-www-form-urlencoded",body:a,estimatedSize:new Blob([a]).size}}var o=mg(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Ig=[];tE&&Ig.push({transport:"fetch",method:e=>{var t,n,{contentType:s,body:r,estimatedSize:i}=(t=Oy(e))!==null&&t!==void 0?t:{},a=new Headers;Pn(e.headers,function(d,h){a.append(h,d)}),s&&a.append("Content-Type",s);var o=e.url,l=null;if(HF){var u=new HF;l={signal:u.signal,timeout:setTimeout(()=>u.abort(),e.timeout)}}tE(o,$e({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(h=>{var f,p={statusCode:d.status,text:h};if(d.status===200)try{p.json=JSON.parse(h)}catch(m){_t.error(m)}(f=e.callback)===null||f===void 0||f.call(e,p)})).catch(d=>{var h;_t.error(d),(h=e.callback)===null||h===void 0||h.call(e,{statusCode:0,text:d})}).finally(()=>l?clearTimeout(l.timeout):null)}}),nE&&Ig.push({transport:"XHR",method:e=>{var t,n=new nE;n.open(e.method||"GET",e.url,!0);var{contentType:s,body:r}=(t=Oy(e))!==null&&t!==void 0?t:{};Pn(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)}}),Di!=null&&Di.sendBeacon&&Ig.push({transport:"sendBeacon",method:e=>{var t=fb(e.url,{beacon:"1"});try{var n,{contentType:s,body:r}=(n=Oy(e))!==null&&n!==void 0?n:{},i=typeof r=="string"?new Blob([r],{type:s}):r;Di.sendBeacon(t,i)}catch{}}});var IE=3e3;let pte=class{constructor(t,n){ct(this,"isPaused",!0),ct(this,"queue",[]),this.flushTimeoutMs=la(n?.flush_interval_ms||IE,250,5e3,"flush interval",IE),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($e($e({},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&&cs(a.data)&&Pn(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 Pn(this.queue,n=>{var s,r=n,i=(r?r.batchKey:null)||r.url;xt(t[i])&&(t[i]=$e($e({},r),{},{data:[]})),(s=t[i].data)===null||s===void 0||s.push(r.data)}),this.queue=[],t}};var gte=["retriesPerformedSoFar"];let mte=class{constructor(t){ct(this,"isPolling",!1),ct(this,"pollIntervalMs",3e3),ct(this,"queue",[]),this.instance=t,this.queue=[],this.areWeOnline=!0,!xt(Be)&&"onLine"in Be.navigator&&(this.areWeOnline=Be.navigator.onLine,bs(Be,"online",()=>{this.areWeOnline=!0,this.flush()}),bs(Be,"offline",()=>{this.areWeOnline=!1}))}retriableRequest(t){var{retriesPerformedSoFar:n}=t,s=NB(t,gte);Wr(n)&&n>0&&(s.url=fb(s.url,{retry_count:n})),this.instance._send_request($e($e({},s),{},{callback:r=>{var i;r.statusCode!==200&&(r.statusCode<400||r.statusCode>=500)&&(n??0)<10?this.enqueue($e({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)"),_t.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($e($e({},t),{},{transport:"sendBeacon"}))}catch(n){_t.error(n)}this.queue=[]}},vte=class{constructor(t){ct(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(){bs(Be,"scroll",this._updateScrollData,{capture:!0}),bs(Be,"scrollend",this._updateScrollData,{capture:!0}),bs(Be,"resize",this._updateScrollData)}scrollElement(){if(!this.instance.config.scroll_root_selector)return Be?.document.documentElement;var t=cs(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=Be?.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 Be&&(Be.scrollY||Be.pageYOffset||Be.document.documentElement.scrollTop)||0}scrollX(){if(this.instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollLeft||0}return Be&&(Be.scrollX||Be.pageXOffset||Be.document.documentElement.scrollLeft)||0}};var xte=e=>Qn.personInfo({maskPersonalDataProperties:e?.config.mask_personal_data_properties,customPersonalDataProperties:e?.config.custom_personal_data_properties});let bte=class{constructor(t,n,s,r){ct(this,"_onSessionIdCallback",i=>{var a=this._getStored();if(!a||a.sessionId!==i){var o={sessionId:i,props:this._sessionSourceParamGenerator(this.instance)};this._persistence.register({[lE]:o})}}),this.instance=t,this._sessionIdManager=n,this._persistence=s,this._sessionSourceParamGenerator=r||xte,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[lE]}getSetOnceProps(){var t,n=(t=this._getStored())===null||t===void 0?void 0:t.props;return n?"r"in n?Qn.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 Pn(km(this.getSetOnceProps()),(n,s)=>{s==="$current_url"&&(s="url"),t["$session_entry_".concat(sT(s))]=n}),t}};var WD=Fr("[SessionId]");let wte=class{constructor(t,n,s){var r;if(ct(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||Cc,this._windowIdGenerator=s||Cc;var i=this.config.persistence_name||this.config.token,a=this.config.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*la(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=dr.parse(this._window_id_storage_key),l=dr.parse(this._primary_window_exists_storage_key);o&&!l?this._windowId=o:dr.remove(this._window_id_storage_key),dr.set(this._primary_window_exists_storage_key,!0)}if((r=this.config.bootstrap)!==null&&r!==void 0&&r.sessionID)try{var u=(d=>{var h=d.replace(/-/g,"");if(h.length!==32)throw new Error("Not a valid UUID");if(h[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(h.substring(0,12),16)})(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,new Date().getTime(),u)}catch(d){WD.error("Invalid sessionID in bootstrap",d)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return xt(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&&dr.is_supported()}_setWindowId(t){t!==this._windowId&&(this._windowId=t,this._canUseSessionStorage()&&dr.set(this._window_id_storage_key,t))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?dr.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({[sb]:[n,t,s]}))}_getSessionId(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var t=this.persistence.props[sb];return cs(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}_listenToReloadWindow(){bs(Be,"beforeunload",()=>{this._canUseSessionStorage()&&dr.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=Wr(a)&&a>0&&Math.abs(s-a)>864e5,u=!1,d=!i,h=!t&&Math.abs(s-r)>this.sessionTimeoutMs;d||h||l?(i=this._sessionIdGenerator(),o=this._windowIdGenerator(),WD.info("new session ID generated",{sessionId:i,windowId:o,changeReason:{noSessionId:d,activityTimeout:h,sessionPastMaximumLength:l}}),a=s,u=!0):o||(o=this._windowIdGenerator(),u=!0);var f=r===0||!t||l?s:r,p=a===0?new Date().getTime():a;return this._setWindowId(o),this._setSessionId(i,f,p),t||this.resetIdleTimer(),u&&this._sessionIdChangedHandlers.forEach(m=>m(i,o,u?{noSessionId:d,activityTimeout:h,sessionPastMaximumLength:l}:void 0)),{sessionId:i,windowId:o,sessionStartTimestamp:p,changeReason:u?{noSessionId:d,activityTimeout:h,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:r}}resetIdleTimer(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{this.resetSessionId()},1.1*this.sessionTimeoutMs)}};var Cte=["$set_once","$set"],ic=Fr("[SiteApps]");let yte=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=Gt._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")||[],h=this.instance.get_property("$stored_group_properties")||{};for(var[f,p]of Object.entries(h))u[f]={id:d[f],type:f,properties:p};var{$set_once:m,$set:v}=t;return{event:$e($e({},NB(t,Cte)),{},{properties:$e($e($e({},t.properties),v?{$set:$e($e({},(n=(s=t.properties)===null||s===void 0?void 0:s.$set)!==null&&n!==void 0?n:{}),v)}:{}),m?{$set_once:$e($e({},(r=(i=t.properties)===null||i===void 0?void 0:i.$set_once)!==null&&r!==void 0?r:{}),m)}:{}),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&&(ic.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,ic.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){ic.error("Error while initializing PostHog app with config id ".concat(t.id),o),i(!1)}if(r&&n.loaded)try{s()}catch(o){ic.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){ic.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 ic.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 h,f;Gt["__$$ph_site_app_".concat(u)]=i.instance,(h=Gt.__PosthogExtensions__)===null||h===void 0||(f=h.loadSiteApp)===null||f===void 0||f.call(h,i.instance,d,p=>{if(p)return ic.error("Error while initializing PostHog app with config id ".concat(u),p)})};for(var{id:o,url:l}of t.siteApps)a(o,l)}else ic.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}};var ju,Ste=["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"],zD=function(e,t){if(!e)return!1;var n=e.toLowerCase();return Ste.concat(t||[]).some(s=>{var r=s.toLowerCase();return n.indexOf(r)!==-1})},O6=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&zD(n,t))return!0;try{var s=e?.userAgentData;if(s!=null&&s.brands&&s.brands.some(r=>zD(r?.brand,t)))return!0}catch{}return!!e.webdriver};function qD(e,t,n){return mg({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}(function(e){e.US="us",e.EU="eu",e.CUSTOM="custom"})(ju||(ju={}));var KD="i.posthog.com";let Ete=class{constructor(t){ct(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(KD),".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]=ju.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=ju.EU:this._regionCache[this.apiHost]=ju.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===ju.CUSTOM)return this.apiHost+n;var s=KD+n;switch(t){case"assets":return"https://".concat(this.region,"-assets.").concat(s);case"api":return"https://".concat(this.region,".").concat(s)}}};var kte={icontains:(e,t)=>!!Be&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!Be&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!Be&&Tf(t.href,e),not_regex:(e,t)=>!!Be&&!Tf(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};let _te=class Gr{constructor(t){var n=this;ct(this,"getWebExperimentsAndEvaluateDisplayLogic",function(){var s=arguments.length>0&&arguments[0]!==void 0&&arguments[0];n.getWebExperiments(r=>{Gr.logInfo("retrieved web experiments from the server"),n._flagToExperiments=new Map,r.forEach(i=>{if(i.feature_flag_key){var a;n._flagToExperiments&&(Gr.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);Is(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];Gr.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())Gr.logInfo("Refusing to render web experiment since the viewer is a likely bot");else if(!this.instance.config.disable_web_experiments){if(kn(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Gr.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=Gr.getWindowLocation();if(t!=null&&t.search){var n=ob(t?.search,"__experiment_id"),s=ob(t?.search,"__experiment_variant");n&&s&&(Gr.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&&(Gr.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!kn(t.conditions)&&Gr.matchUrlConditions(t)&&Gr.matchUTMConditions(t)}static matchUrlConditions(t){var n;if(kn(t.conditions)||kn((n=t.conditions)===null||n===void 0?void 0:n.url))return!0;var s,r,i,a=Gr.getWindowLocation();return!!a&&((s=t.conditions)===null||s===void 0||!s.url||kte[(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 Be?.location}static matchUTMConditions(t){var n;if(kn(t.conditions)||kn((n=t.conditions)===null||n===void 0?void 0:n.utm))return!0;var s=Qn.campaignParams();if(s.utm_source){var r,i,a,o,l,u,d,h,f,p,m,v,x,b,w,C,k=(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,y=(l=t.conditions)===null||l===void 0||(u=l.utm)===null||u===void 0||!u.utm_source||((d=t.conditions)===null||d===void 0||(h=d.utm)===null||h===void 0?void 0:h.utm_source)==s.utm_source,E=(f=t.conditions)===null||f===void 0||(p=f.utm)===null||p===void 0||!p.utm_medium||((m=t.conditions)===null||m===void 0||(v=m.utm)===null||v===void 0?void 0:v.utm_medium)==s.utm_medium,T=(x=t.conditions)===null||x===void 0||(b=x.utm)===null||b===void 0||!b.utm_term||((w=t.conditions)===null||w===void 0||(C=w.utm)===null||C===void 0?void 0:C.utm_term)==s.utm_term;return k&&E&&T&&y}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];_t.info("[WebExperiments] ".concat(t),s)}applyTransforms(t,n,s){this._is_bot()?Gr.logInfo("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?s.forEach(r=>{if(r.selector){var i;Gr.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)})}}):Gr.logInfo("Control variants leave the page unmodified.")}_is_bot(){return Di&&this.instance?O6(Di,this.instance.config.custom_blocked_useragents):void 0}};var Ng={},NE=()=>{},kh="posthog",L6=!fte&&Ds?.indexOf("MSIE")===-1&&Ds?.indexOf("Mozilla")===-1,YD=()=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:RZ(yt?.location),persistence:"localStorage+cookie",persistence_name:"",loaded:NE,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:ii&&Is(ii?.search)&&ii.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:(Be==null||(e=Be.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;_t.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:IE},_onCapture:NE}},XD=e=>{var t={};xt(e.process_person)||(t.person_profiles=e.process_person),xt(e.xhr_headers)||(t.request_headers=e.xhr_headers),xt(e.cookie_name)||(t.persistence_name=e.cookie_name),xt(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),xt(e.store_google)||(t.save_campaign_params=e.store_google),xt(e.verbose)||(t.debug=e.verbose);var n=vs({},t,e);return cs(e.property_blacklist)&&(xt(e.property_denylist)?n.property_denylist=e.property_blacklist:cs(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:_t.error("Invalid value for property_denylist config: "+e.property_denylist)),n};class Tte{constructor(){ct(this,"__forceAllowLocalhost",!1)}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(t){_t.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class tC{get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){ct(this,"webPerformance",new Tte),ct(this,"_personProcessingSetOncePropertiesSent",!1),ct(this,"version",hl.LIB_VERSION),ct(this,"_internalEventEmitter",new N6),this.config=YD(),this.SentryIntegration=Iee,this.sentryIntegration=t=>function(n,s){var r=l6(n,s);return{name:o6,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 ete(this),this.toolbar=new Mee(this),this.scrollManager=new vte(this),this.pageViewManager=new Uee(this),this.surveys=new cte(this),this.experiments=new _te(this),this.exceptions=new Gee(this),this.rateLimiter=new ute(this),this.requestRouter=new Ete(this),this.consent=new JZ(this),this.people={set:(t,n,s)=>{var r=Is(t)?{[t]:n}:t;this.setPersonProperties(r),s?.({})},set_once:(t,n,s)=>{var r=Is(t)?{[t]:n}:t;this.setPersonProperties(void 0,r),s?.({})}},this.on("eventCaptured",t=>_t.info('send "'.concat(t?.event,'"'),t))}init(t,n,s){if(s&&s!==kh){var r,i=(r=Ng[s])!==null&&r!==void 0?r:new tC;return i._init(t,n,s),Ng[s]=i,Ng[kh][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(xt(t)||sE(t))return _t.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 _t.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(vs({},YD(),XD(r),{name:i,token:t})),this.config.on_xhr_error&&_t.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=r.disable_compression?void 0:Ga.GZipJS,this.persistence=new Ny(this.config),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ny($e($e({},this.config),{},{persistence:"sessionStorage"}));var a=$e({},this.persistence.props),o=$e({},this.sessionPersistence.props);if(this._requestQueue=new pte(b=>this._send_retriable_request(b),this.config.request_queue_config),this._retryQueue=new mte(this),this.__request_queue=[],this.config.__preview_experimental_cookieless_mode||(this.sessionManager=new wte(this),this.sessionPropsManager=new bte(this,this.sessionManager,this.persistence)),new Lee(this).startIfEnabledOrStop(),this.siteApps=new yte(this),(n=this.siteApps)===null||n===void 0||n.init(),this.config.__preview_experimental_cookieless_mode||(this.sessionRecording=new Dee(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new GZ(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new Hee(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new Bee(this),this.exceptionObserver=new tee(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new QB(this,eee),this.deadClicksAutocapture.startIfEnabled(),hl.DEBUG=hl.DEBUG||this.config.debug,hl.DEBUG&&_t.info("Starting in debug mode",{this:this,config:r,thisC:$e({},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(Cc()),h=(l=r.bootstrap)!==null&&l!==void 0&&l.isIdentifiedID?d:r.bootstrap.distinctID;this.persistence.set_property(cl,(u=r.bootstrap)!==null&&u!==void 0&&u.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:r.bootstrap.distinctID,$device_id:h})}if(this._hasBootstrappedFeatureFlags()){var f,p,m=Object.keys(((f=r.bootstrap)===null||f===void 0?void 0:f.featureFlags)||{}).filter(b=>{var w,C;return!((w=r.bootstrap)===null||w===void 0||(C=w.featureFlags)===null||C===void 0||!C[b])}).reduce((b,w)=>{var C,k;return b[w]=((C=r.bootstrap)===null||C===void 0||(k=C.featureFlags)===null||k===void 0?void 0:k[w])||!1,b},{}),v=Object.keys(((p=r.bootstrap)===null||p===void 0?void 0:p.featureFlagPayloads)||{}).filter(b=>m[b]).reduce((b,w)=>{var C,k,y,E;return(C=r.bootstrap)!==null&&C!==void 0&&(k=C.featureFlagPayloads)!==null&&k!==void 0&&k[w]&&(b[w]=(y=r.bootstrap)===null||y===void 0||(E=y.featureFlagPayloads)===null||E===void 0?void 0:E[w]),b},{});this.featureFlags.receivedFeatureFlags({featureFlags:m,featureFlagPayloads:v})}if(this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:tD,$device_id:null},"");else if(!this.get_distinct_id()){var x=this.config.get_device_id(Cc());this.register_once({distinct_id:x,$device_id:x},""),this.persistence.set_property(cl,"anonymous")}return bs(Be,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),r.segment?Pee(this,()=>this._loaded()):this._loaded(),qa(this.config._onCapture)&&this.config._onCapture!==NE&&(_t.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",b=>this.config._onCapture(b.event,b))),this}_onRemoteConfig(t){var n,s,r,i,a,o,l,u;if(!yt||!yt.body)return _t.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=Zt(t.supportedCompression,Ga.GZipJS)?Ga.GZipJS:Zt(t.supportedCompression,Ga.Base64)?Ga.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){_t.critical("`loaded` function failed",t)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout(()=>{this.consent.isOptedIn()&&this._captureInitialPageview()},1),new dte(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()||Ac(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&&(L6?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=fb(t.url,{ip:this.config.ip?1:0}),t.headers=$e({},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=$e({},n);a.timeout=a.timeout||6e4,a.url=fb(a.url,{_:new Date().getTime().toString(),ver:hl.LIB_VERSION,compression:a.compression});var o=(s=a.transport)!==null&&s!==void 0?s:"fetch",l=(r=(i=MB(Ig,u=>u.transport===o))===null||i===void 0?void 0:i.method)!==null&&r!==void 0?r:Ig[0].method;if(!l)throw new Error("No available transport method");l(a)})($e($e({},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=[];Ac(t,o=>{o&&(n=o[0],cs(n)?i.push(o):qa(o)?o.call(this):cs(o)&&n==="alias"?s.push(o):cs(o)&&n.indexOf("capture")!==-1&&qa(this[n])?i.push(o):r.push(o))});var a=function(o,l){Ac(o,function(u){if(cs(u[0])){var d=l;Pn(u,function(h){d=d[h[0]].apply(d,h.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(!xt(t)&&Is(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&&!Is(n?.$current_url)&&(_t.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=Cc(),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=_Z(u,s!=null&&s._noTruncate?null:this.config.properties_string_max_length)).timestamp=o,xt(s?.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=a);var h=$e($e({},u.properties.$set),u.$set);if(Ih(h)||this.setPersonPropertiesForFlags(h),!kn(this.config.before_send)){var f=this._runBeforeSend(u);if(!f)return;u=f}this._internalEventEmitter.emit("eventCaptured",u);var p={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(p):this._requestQueue.enqueue(p),u}_t.critical("This capture call is ignored due to client rate limiting.")}}else _t.error("No event name provided to posthog.capture")}else _t.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=$e({},n);if(a.token=this.config.token,this.config.__preview_experimental_cookieless_mode&&(a.$cookieless_mode=!0),t==="$snapshot"){var o=$e($e({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=o.distinct_id,(!Is(a.distinct_id)&&!Wr(a.distinct_id)||sE(a.distinct_id))&&_t.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var l,u=Qn.properties({maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});if(this.sessionManager){var{sessionId:d,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId();a.$session_id=d,a.$window_id=h}this.sessionPropsManager&&vs(a,this.sessionPropsManager.getSessionProps());try{var f,p;this.sessionRecording&&vs(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(f=this._retryQueue)===null||f===void 0||(p=f.queue)===null||p===void 0?void 0:p.length}catch(b){a.$sdk_debug_error_capturing_properties=String(b)}if(this.requestRouter.region===ju.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=vs(a,l),t==="$pageview"&&yt&&(a.title=yt.title),!xt(i)){var m=s.getTime()-i;a.$duration=parseFloat((m/1e3).toFixed(3))}Ds&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=vs({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),cs(this.config.property_denylist)?Pn(this.config.property_denylist,function(b){delete a[b]}):_t.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(_t.error("sanitize_properties is deprecated. Use before_send instead"),a=v(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=vs({},s,r||{},t||{}),a=this.config.sanitize_properties;return a&&(_t.error("sanitize_properties is deprecated. Use before_send instead"),i=a(i,"$set_once")),this._personProcessingSetOncePropertiesSent=!0,Ih(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 _t.uninitializedWarning("posthog.identify");if(Wr(t)&&(t=t.toString(),_t.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()))_t.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(ug)&&(this.unregister(ug),this.register({distinct_id:t}));var a=(this.persistence.get_property(cl)||"anonymous")==="anonymous";t!==r&&a?(this.persistence.set_property(cl,"identified"),this.setPersonPropertiesForFlags($e($e({},s||{}),n||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:r},{$set:n||{},$set_once:s||{}}),this._cachedPersonProperties=qD(t,n,s),this.featureFlags.setAnonymousDistinctId(r)):(n||s)&&this.setPersonProperties(n,s),t!==r&&(this.reloadFeatureFlags(),this.unregister(rb))}}else _t.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,n){if((t||n)&&this._requirePersonProcessing("posthog.setPersonProperties")){var s=qD(this.get_distinct_id(),t,n);this._cachedPersonProperties!==s?(this.setPersonPropertiesForFlags($e($e({},n||{}),t||{})),this.capture("$set",{$set:t||{},$set_once:n||{}}),this._cachedPersonProperties=s):_t.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:$e($e({},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 _t.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(_t.info("reset"),!this.__loaded)return _t.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(cl,"anonymous"),(i=this.sessionManager)===null||i===void 0||i.resetSessionId(),this._cachedPersonProperties=null,this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:tD,$device_id:null},"");else{var o=this.config.get_device_id(Cc());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(OB)?(_t.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(xt(n)&&(n=this.get_distinct_id()),t!==n?(this._register_single(ug,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(_t.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n,s,r,i,a=$e({},this.config);us(t)&&(vs(this.config,XD(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 Ny($e($e({},this.config),{},{persistence:"sessionStorage"})),Bs.is_supported()&&Bs.get("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(hl.DEBUG=!0,_t.info("set_config",JSON.stringify({config:t,oldConfig:a,newConfig:$e({},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($e($e({},fee((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:kh;return n!==kh&&(n=kh+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)===null||t===void 0?void 0:t.get_property(cl))==="identified"||((n=this.sessionPersistence)===null||n===void 0?void 0:n.get_property(cl))==="identified"}_hasPersonProcessing(){var t,n,s,r;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Ih(this.getGroups())&&((t=this.persistence)===null||t===void 0||(n=t.props)===null||n===void 0||!n[ug])&&((s=this.persistence)===null||s===void 0||(r=s.props)===null||r===void 0||!r[ib]))}_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"?(_t.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(ib,!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(),(xt(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 Di?O6(Di,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){yt&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:yt.title},{send_instantly:!0}))}debug(t){t===!1?(Be?.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(Be?.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(kn(this.config.before_send))return t;var n=cs(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var r of n){if(s=r(s),kn(s)){var i="Event '".concat(t.event,"' was rejected in beforeSend function");return SZ(t.event)?_t.warn("".concat(i,". This can cause unexpected behavior.")):_t.info(i),null}s.properties&&!Ih(s.properties)||_t.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]]=kZ(e.prototype[t[n]])})(tC,["identify"]);var QD,Fu=(QD=Ng[kh]=new tC,function(){function e(){e.done||(e.done=!0,L6=!1,Pn(Ng,function(t){t._dom_loaded()}))}yt!=null&&yt.addEventListener?yt.readyState==="complete"?e():bs(yt,"DOMContentLoaded",e,{capture:!1}):Be&&_t.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),QD),gT=g.createContext({client:Fu});function B6(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)||!B6(e[o],t[o],n))return!1}return!0}function Rte(e){var t=e.children,n=e.client,s=e.apiKey,r=e.options,i=g.useRef(null),a=g.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."),Fu)},[n,s,JSON.stringify(r)]);return g.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&&!B6(r,o.options)&&Fu.set_config(r),i.current={apiKey:s,options:r??{}}):(Fu.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),Fu.init(s,r),i.current={apiKey:s,options:r??{}})}},[n,s,JSON.stringify(r)]),Ve.createElement(gT.Provider,{value:{client:a}},t)}var Ate=function(){var e=g.useContext(gT).client;return e};function Ly(e){var t=Ate(),n=g.useState(function(){return t.isFeatureEnabled(e)}),s=n[0],r=n[1];return g.useEffect(function(){return t.onFeatureFlags(function(){r(t.isFeatureEnabled(e))})},[t,e]),s}var ME=function(e,t){return ME=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])},ME(e,t)};function Fte(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");ME(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var By=function(e){return typeof e=="function"},Dte={componentStack:null,error:null},Pte={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."};(function(e){Fte(t,e);function t(n){var s=e.call(this,n)||this;return s.state=Dte,s}return t.prototype.componentDidCatch=function(n,s){var r=s.componentStack,i=this.props.additionalProperties;this.setState({error:n,componentStack:r});var a;By(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 By(s)?s():s;var a=By(r)?Ve.createElement(r,{error:i.error,componentStack:i.componentStack}):r;return Ve.isValidElement(a)?a:(console.warn(Pte.INVALID_FALLBACK),Ve.createElement(Ve.Fragment,null))},t.contextType=gT,t})(Ve.Component);/**
|
|
@@ -681,7 +681,7 @@ ${w9(r)}`)}const C9=AK;function tL(e){return e.artifact&&FK(e.path)?e.artifact:n
|
|
|
681
681
|
* LICENSE file in the root directory of this source tree.
|
|
682
682
|
*/var g3;function Gqe(){if(g3)return og;g3=1;var e=Ve,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,h={},f=null,p=null;u!==void 0&&(f=""+u),l.key!==void 0&&(f=""+l.key),l.ref!==void 0&&(p=l.ref);for(d in l)s.call(l,d)&&!i.hasOwnProperty(d)&&(h[d]=l[d]);if(o&&o.defaultProps)for(d in l=o.defaultProps,l)h[d]===void 0&&(h[d]=l[d]);return{$$typeof:t,type:o,key:f,ref:p,props:h,_owner:r.current}}return og.Fragment=n,og.jsx=a,og.jsxs=a,og}var m3;function $qe(){return m3||(m3=1,p3.exports=Gqe()),p3.exports}var Vqe=$qe();/*! shepherd.js 14.5.0 */function Wqe(e){return e instanceof Element}function $f(e){return e instanceof HTMLElement}function zc(e){return typeof e=="function"}function p0(e){return typeof e=="string"}function _r(e){return e===void 0}class GA{on(t,n,s,r=!1){var i;return _r(this.bindings)&&(this.bindings={}),_r(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(_r(this.bindings)||_r(this.bindings[t]))return this;if(_r(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(!_r(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 pi(){return pi=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},pi.apply(null,arguments)}function $A(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 ru={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")};ru.defaultMerge;function zqe(e,t){return t}function qqe(e,t){return e.filter(n=>n!==void 0)}var v3;(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"})(v3||(v3={}));function x3(e){return typeof e!="object"||e===null?0:Array.isArray(e)?2:Xqe(e)?1:e instanceof Set?3:e instanceof Map?4:5}function Kqe(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 Yqe(e,t){return typeof e=="object"&&Object.prototype.propertyIsEnumerable.call(e,t)}function vV(e){return{*[Symbol.iterator](){for(const t of e)for(const n of t)yield n}}}const b3=new Set(["[object Object]","[object Module]"]);function Xqe(e){if(!b3.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"||!b3.has(Object.prototype.toString.call(n))||!n.hasOwnProperty("isPrototypeOf"))}function Qqe(e,t,n){const s={};for(const r of Kqe(e)){const i=[];for(const l of e)Yqe(l,r)&&i.push(l[r]);if(i.length===0)continue;const a=t.metaDataUpdater(n,{key:r,parents:e}),o=xV(i,t,a);o!==ru.skip&&(r==="__proto__"?Object.defineProperty(s,r,{value:o,configurable:!0,enumerable:!0,writable:!0}):s[r]=o)}return s}function Jqe(e){return e.flat()}function Zqe(e){return new Set(vV(e))}function eKe(e){return new Map(vV(e))}function tKe(e){return e.at(-1)}const gx={mergeRecords:Qqe,mergeArrays:Jqe,mergeSets:Zqe,mergeMaps:eKe,mergeOthers:tKe};function VA(...e){return nKe({})(...e)}function nKe(e,t){const n=sKe(e,s);function s(...r){return xV(r,n,t)}return s}function sKe(e,t){var n,s,r;return{defaultMergeFunctions:gx,mergeFunctions:pi({},gx,Object.fromEntries(Object.entries(e).filter(([i,a])=>Object.hasOwn(gx,i)).map(([i,a])=>a===!1?[i,gx.mergeOthers]:[i,a]))),metaDataUpdater:(n=e.metaDataUpdater)!=null?n:zqe,deepmerge:t,useImplicitDefaultMerging:(s=e.enableImplicitDefaultMerging)!=null?s:!1,filterValues:e.filterValues===!1?void 0:(r=e.filterValues)!=null?r:qqe,actions:ru}}function xV(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 IS(r,t,n);const i=x3(r[0]);if(i!==0&&i!==5){for(let a=1;a<r.length;a++)if(x3(r[a])!==i)return IS(r,t,n)}switch(i){case 1:return rKe(r,t,n);case 2:return iKe(r,t,n);case 3:return aKe(r,t,n);case 4:return oKe(r,t,n);default:return IS(r,t,n)}}function rKe(e,t,n){const s=t.mergeFunctions.mergeRecords(e,t,n);return s===ru.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeRecords!==t.defaultMergeFunctions.mergeRecords?t.defaultMergeFunctions.mergeRecords(e,t,n):s}function iKe(e,t,n){const s=t.mergeFunctions.mergeArrays(e,t,n);return s===ru.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeArrays!==t.defaultMergeFunctions.mergeArrays?t.defaultMergeFunctions.mergeArrays(e):s}function aKe(e,t,n){const s=t.mergeFunctions.mergeSets(e,t,n);return s===ru.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeSets!==t.defaultMergeFunctions.mergeSets?t.defaultMergeFunctions.mergeSets(e):s}function oKe(e,t,n){const s=t.mergeFunctions.mergeMaps(e,t,n);return s===ru.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps?t.defaultMergeFunctions.mergeMaps(e):s}function IS(e,t,n){const s=t.mergeFunctions.mergeOthers(e,t,n);return s===ru.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(e):s}function WA(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 lKe(e,t){return n=>{if(e.isOpen()){const s=e.el&&n.currentTarget===e.el;(!_r(t)&&n.currentTarget.matches(t)||s)&&e.tour.next()}}}function cKe(e){const{event:t,selector:n}=e.options.advanceOn||{};if(t){const s=lKe(e,n);let r=null;if(!_r(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 uKe{constructor(t){}}class dKe{constructor(t,n){}}function bV(e){return!p0(e)||e===""?"":e.charAt(e.length-1)!=="-"?`${e}-`:e}function hKe(e){const t=e.options.attachTo||{},n=Object.assign({},t);if(zc(n.element)&&(n.element=n.element.call(e)),p0(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 fKe(e){return e.options.extraHighlights?e.options.extraHighlights.flatMap(t=>Array.from(document.querySelectorAll(t))):[]}function wV(e){return e==null?!0:!e.element||!e.on}function CV(){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 pKe=["top","right","bottom","left"],w3=["start","end"],C3=pKe.reduce((e,t)=>e.concat(t,t+"-"+w3[0],t+"-"+w3[1]),[]),Vf=Math.min,od=Math.max,kw=Math.round,mx=Math.floor,jo=e=>({x:e,y:e}),gKe={left:"right",right:"left",bottom:"top",top:"bottom"},mKe={start:"end",end:"start"};function w_(e,t,n){return od(e,Vf(t,n))}function Id(e,t){return typeof e=="function"?e(t):e}function Ll(e){return e.split("-")[0]}function Rl(e){return e.split("-")[1]}function zA(e){return e==="x"?"y":"x"}function qA(e){return e==="y"?"height":"width"}function Wf(e){return["top","bottom"].includes(Ll(e))?"y":"x"}function KA(e){return zA(Wf(e))}function yV(e,t,n){n===void 0&&(n=!1);const s=Rl(e),r=KA(e),i=qA(r);let a=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Tw(a)),[a,Tw(a)]}function vKe(e){const t=Tw(e);return[_w(e),t,_w(t)]}function _w(e){return e.replace(/start|end/g,t=>mKe[t])}function xKe(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 bKe(e,t,n,s){const r=Rl(e);let i=xKe(Ll(e),n==="start",s);return r&&(i=i.map(a=>a+"-"+r),t&&(i=i.concat(i.map(_w)))),i}function Tw(e){return e.replace(/left|right|bottom|top/g,t=>gKe[t])}function wKe(e){return pi({top:0,right:0,bottom:0,left:0},e)}function SV(e){return typeof e!="number"?wKe(e):{top:e,right:e,bottom:e,left:e}}function Rw(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 CKe=["crossAxis","alignment","allowedPlacements","autoAlignment"],yKe=["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"],SKe=["mainAxis","crossAxis","limiter"];function y3(e,t,n){let{reference:s,floating:r}=e;const i=Wf(t),a=KA(t),o=qA(a),l=Ll(t),u=i==="y",d=s.x+s.width/2-r.width/2,h=s.y+s.height/2-r.height/2,f=s[o]/2-r[o]/2;let p;switch(l){case"top":p={x:d,y:s.y-r.height};break;case"bottom":p={x:d,y:s.y+s.height};break;case"right":p={x:s.x+s.width,y:h};break;case"left":p={x:s.x-r.width,y:h};break;default:p={x:s.x,y:s.y}}switch(Rl(t)){case"start":p[a]-=f*(n&&u?-1:1);break;case"end":p[a]+=f*(n&&u?-1:1);break}return p}const EKe=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:h}=y3(u,s,l),f=s,p={},m=0;for(let v=0;v<o.length;v++){const{name:x,fn:b}=o[v],{x:w,y:C,data:k,reset:y}=await b({x:d,y:h,initialPlacement:s,placement:f,strategy:r,middlewareData:p,rects:u,platform:a,elements:{reference:e,floating:t}});d=w??d,h=C??h,p=pi({},p,{[x]:pi({},p[x],k)}),y&&m<=50&&(m++,typeof y=="object"&&(y.placement&&(f=y.placement),y.rects&&(u=y.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:r}):y.rects),{x:d,y:h}=y3(u,f,l)),v=-1)}return{x:d,y:h,placement:f,strategy:r,middlewareData:p}};async function YA(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:h="floating",altBoundary:f=!1,padding:p=0}=Id(t,e),m=SV(p),v=o[f?h==="floating"?"reference":"floating":h],x=Rw(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:u,rootBoundary:d,strategy:l})),b=h==="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)),C=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},k=Rw(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:b,offsetParent:w,strategy:l}):b);return{top:(x.top-k.top+m.top)/C.y,bottom:(k.bottom-x.bottom+m.bottom)/C.y,left:(x.left-k.left+m.left)/C.x,right:(k.right-x.right+m.right)/C.x}}const kKe=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}=Id(e,t)||{};if(u==null)return{};const h=SV(d),f={x:n,y:s},p=KA(r),m=qA(p),v=await a.getDimensions(u),x=p==="y",b=x?"top":"left",w=x?"bottom":"right",C=x?"clientHeight":"clientWidth",k=i.reference[m]+i.reference[p]-f[p]-i.floating[m],y=f[p]-i.reference[p],E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let T=E?E[C]:0;(!T||!await(a.isElement==null?void 0:a.isElement(E)))&&(T=o.floating[C]||i.floating[m]);const F=k/2-y/2,R=T/2-v[m]/2-1,I=Vf(h[b],R),N=Vf(h[w],R),D=I,O=T-v[m]-N,G=T/2-v[m]/2+F,B=w_(D,G,O),ee=!l.arrow&&Rl(r)!=null&&G!==B&&i.reference[m]/2-(G<D?I:N)-v[m]/2<0,z=ee?G<D?G-D:G-O:0;return{[p]:f[p]+z,data:pi({[p]:B,centerOffset:G-B-z},ee&&{alignmentOffset:z}),reset:ee}}});function _Ke(e,t,n){return(e?[...n.filter(s=>Rl(s)===e),...n.filter(s=>Rl(s)!==e)]:n.filter(s=>Ll(s)===s)).filter(s=>e?Rl(s)===e||(t?_w(s)!==s:!1):!0)}const TKe=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=Id(e,t),{crossAxis:h=!1,alignment:f,allowedPlacements:p=C3,autoAlignment:m=!0}=d,v=$A(d,CKe),x=f!==void 0||p===C3?_Ke(f||null,m,p):p,b=await YA(t,v),w=((n=a.autoPlacement)==null?void 0:n.index)||0,C=x[w];if(C==null)return{};const k=yV(C,i,await(l.isRTL==null?void 0:l.isRTL(u.floating)));if(o!==C)return{reset:{placement:x[0]}};const y=[b[Ll(C)],b[k[0]],b[k[1]]],E=[...((s=a.autoPlacement)==null?void 0:s.overflows)||[],{placement:C,overflows:y}],T=x[w+1];if(T)return{data:{index:w+1,overflows:E},reset:{placement:T}};const F=E.map(I=>{const N=Rl(I.placement);return[I.placement,N&&h?I.overflows.slice(0,2).reduce((D,O)=>D+O,0):I.overflows[0],I.overflows]}).sort((I,N)=>I[1]-N[1]),R=((r=F.filter(I=>I[2].slice(0,Rl(I[0])?2:3).every(N=>N<=0))[0])==null?void 0:r[0])||F[0][0];return R!==o?{data:{index:w+1,overflows:E},reset:{placement:R}}:{}}}},RKe=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=Id(e,t),{mainAxis:h=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:x=!0}=d,b=$A(d,yKe);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=Ll(r),C=Wf(o),k=Ll(o)===o,y=await(l.isRTL==null?void 0:l.isRTL(u.floating)),E=p||(k||!x?[Tw(o)]:vKe(o)),T=v!=="none";!p&&T&&E.push(...bKe(o,x,v,y));const F=[o,...E],R=await YA(t,b),I=[];let N=((s=i.flip)==null?void 0:s.overflows)||[];if(h&&I.push(R[w]),f){const B=yV(r,a,y);I.push(R[B[0]],R[B[1]])}if(N=[...N,{placement:r,overflows:I}],!I.every(B=>B<=0)){var D,O;const B=(((D=i.flip)==null?void 0:D.index)||0)+1,ee=F[B];if(ee)return{data:{index:B,overflows:N},reset:{placement:ee}};let z=(O=N.filter(ue=>ue.overflows[0]<=0).sort((ue,U)=>ue.overflows[1]-U.overflows[1])[0])==null?void 0:O.placement;if(!z)switch(m){case"bestFit":{var G;const ue=(G=N.filter(U=>{if(T){const se=Wf(U.placement);return se===C||se==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(se=>se>0).reduce((se,le)=>se+le,0)]).sort((U,se)=>U[1]-se[1])[0])==null?void 0:G[0];ue&&(z=ue);break}case"initialPlacement":z=o;break}if(r!==z)return{reset:{placement:z}}}return{}}}},AKe=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:r}=t,i=Id(e,t),{mainAxis:a=!0,crossAxis:o=!1,limiter:l={fn:b=>{let{x:w,y:C}=b;return{x:w,y:C}}}}=i,u=$A(i,SKe),d={x:n,y:s},h=await YA(t,u),f=Wf(Ll(r)),p=zA(f);let m=d[p],v=d[f];if(a){const b=p==="y"?"top":"left",w=p==="y"?"bottom":"right",C=m+h[b],k=m-h[w];m=w_(C,m,k)}if(o){const b=f==="y"?"top":"left",w=f==="y"?"bottom":"right",C=v+h[b],k=v-h[w];v=w_(C,v,k)}const x=l.fn(pi({},t,{[p]:m,[f]:v}));return pi({},x,{data:{x:x.x-n,y:x.y-s}})}}},FKe=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}=Id(e,t),d={x:n,y:s},h=Wf(r),f=zA(h);let p=d[f],m=d[h];const v=Id(o,t),x=typeof v=="number"?{mainAxis:v,crossAxis:0}:pi({mainAxis:0,crossAxis:0},v);if(l){const C=f==="y"?"height":"width",k=i.reference[f]-i.floating[C]+x.mainAxis,y=i.reference[f]+i.reference[C]-x.mainAxis;p<k?p=k:p>y&&(p=y)}if(u){var b,w;const C=f==="y"?"width":"height",k=["top","left"].includes(Ll(r)),y=i.reference[h]-i.floating[C]+(k&&((b=a.offset)==null?void 0:b[h])||0)+(k?0:x.crossAxis),E=i.reference[h]+i.reference[C]+(k?0:((w=a.offset)==null?void 0:w[h])||0)-(k?x.crossAxis:0);m<y?m=y:m>E&&(m=E)}return{[f]:p,[h]:m}}}};function $C(){return typeof window<"u"}function mp(e){return EV(e)?(e.nodeName||"").toLowerCase():"#document"}function Ni(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Xo(e){var t;return(t=(EV(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function EV(e){return $C()?e instanceof Node||e instanceof Ni(e).Node:!1}function Za(e){return $C()?e instanceof Element||e instanceof Ni(e).Element:!1}function Vo(e){return $C()?e instanceof HTMLElement||e instanceof Ni(e).HTMLElement:!1}function S3(e){return!$C()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ni(e).ShadowRoot}function ev(e){const{overflow:t,overflowX:n,overflowY:s,display:r}=eo(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!["inline","contents"].includes(r)}function DKe(e){return["table","td","th"].includes(mp(e))}function VC(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function XA(e){const t=QA(),n=Za(e)?eo(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 PKe(e){let t=qc(e);for(;Vo(t)&&!zf(t);){if(XA(t))return t;if(VC(t))return null;t=qc(t)}return null}function QA(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function zf(e){return["html","body","#document"].includes(mp(e))}function eo(e){return Ni(e).getComputedStyle(e)}function WC(e){return Za(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function qc(e){if(mp(e)==="html")return e;const t=e.assignedSlot||e.parentNode||S3(e)&&e.host||Xo(e);return S3(t)?t.host:t}function kV(e){const t=qc(e);return zf(t)?e.ownerDocument?e.ownerDocument.body:e.body:Vo(t)&&ev(t)?t:kV(t)}function g0(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=kV(e),i=r===((s=e.ownerDocument)==null?void 0:s.body),a=Ni(r);if(i){const o=C_(a);return t.concat(a,a.visualViewport||[],ev(r)?r:[],o&&n?g0(o):[])}return t.concat(r,g0(r,[],n))}function C_(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function _V(e){const t=eo(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=Vo(e),i=r?e.offsetWidth:n,a=r?e.offsetHeight:s,o=kw(n)!==i||kw(s)!==a;return o&&(n=i,s=a),{width:n,height:s,$:o}}function JA(e){return Za(e)?e:e.contextElement}function vf(e){const t=JA(e);if(!Vo(t))return jo(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:i}=_V(t);let a=(i?kw(n.width):n.width)/s,o=(i?kw(n.height):n.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}const IKe=jo(0);function TV(e){const t=Ni(e);return!QA()||!t.visualViewport?IKe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function NKe(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ni(e)?!1:t}function Nd(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=JA(e);let a=jo(1);t&&(s?Za(s)&&(a=vf(s)):a=vf(e));const o=NKe(i,n,s)?TV(i):jo(0);let l=(r.left+o.x)/a.x,u=(r.top+o.y)/a.y,d=r.width/a.x,h=r.height/a.y;if(i){const f=Ni(i),p=s&&Za(s)?Ni(s):s;let m=f,v=C_(m);for(;v&&s&&p!==m;){const x=vf(v),b=v.getBoundingClientRect(),w=eo(v),C=b.left+(v.clientLeft+parseFloat(w.paddingLeft))*x.x,k=b.top+(v.clientTop+parseFloat(w.paddingTop))*x.y;l*=x.x,u*=x.y,d*=x.x,h*=x.y,l+=C,u+=k,m=Ni(v),v=C_(m)}}return Rw({width:d,height:h,x:l,y:u})}function ZA(e,t){const n=WC(e).scrollLeft;return t?t.left+n:Nd(Xo(e)).left+n}function RV(e,t,n){n===void 0&&(n=!1);const s=e.getBoundingClientRect(),r=s.left+t.scrollLeft-(n?0:ZA(e,s)),i=s.top+t.scrollTop;return{x:r,y:i}}function MKe(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const i=r==="fixed",a=Xo(s),o=t?VC(t.floating):!1;if(s===a||o&&i)return n;let l={scrollLeft:0,scrollTop:0},u=jo(1);const d=jo(0),h=Vo(s);if((h||!h&&!i)&&((mp(s)!=="body"||ev(a))&&(l=WC(s)),Vo(s))){const p=Nd(s);u=vf(s),d.x=p.x+s.clientLeft,d.y=p.y+s.clientTop}const f=a&&!h&&!i?RV(a,l,!0):jo(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+f.x,y:n.y*u.y-l.scrollTop*u.y+d.y+f.y}}function OKe(e){return Array.from(e.getClientRects())}function LKe(e){const t=Xo(e),n=WC(e),s=e.ownerDocument.body,r=od(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),i=od(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let a=-n.scrollLeft+ZA(e);const o=-n.scrollTop;return eo(s).direction==="rtl"&&(a+=od(t.clientWidth,s.clientWidth)-r),{width:r,height:i,x:a,y:o}}function BKe(e,t){const n=Ni(e),s=Xo(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=QA();(!u||u&&t==="fixed")&&(o=r.offsetLeft,l=r.offsetTop)}return{width:i,height:a,x:o,y:l}}function jKe(e,t){const n=Nd(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,i=Vo(e)?vf(e):jo(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 E3(e,t,n){let s;if(t==="viewport")s=BKe(e,n);else if(t==="document")s=LKe(Xo(e));else if(Za(t))s=jKe(t,n);else{const r=TV(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Rw(s)}function AV(e,t){const n=qc(e);return n===t||!Za(n)||zf(n)?!1:eo(n).position==="fixed"||AV(n,t)}function HKe(e,t){const n=t.get(e);if(n)return n;let s=g0(e,[],!1).filter(o=>Za(o)&&mp(o)!=="body"),r=null;const i=eo(e).position==="fixed";let a=i?qc(e):e;for(;Za(a)&&!zf(a);){const o=eo(a),l=XA(a);!l&&o.position==="fixed"&&(r=null),(i?!l&&!r:!l&&o.position==="static"&&r&&["absolute","fixed"].includes(r.position)||ev(a)&&!l&&AV(e,a))?s=s.filter(u=>u!==a):r=o,a=qc(a)}return t.set(e,s),s}function UKe(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const i=[...n==="clippingAncestors"?VC(t)?[]:HKe(t,this._c):[].concat(n),s],a=i[0],o=i.reduce((l,u)=>{const d=E3(t,u,r);return l.top=od(d.top,l.top),l.right=Vf(d.right,l.right),l.bottom=Vf(d.bottom,l.bottom),l.left=od(d.left,l.left),l},E3(t,a,r));return{width:o.right-o.left,height:o.bottom-o.top,x:o.left,y:o.top}}function GKe(e){const{width:t,height:n}=_V(e);return{width:t,height:n}}function $Ke(e,t,n){const s=Vo(t),r=Xo(t),i=n==="fixed",a=Nd(e,!0,i,t);let o={scrollLeft:0,scrollTop:0};const l=jo(0);if(s||!s&&!i)if((mp(t)!=="body"||ev(r))&&(o=WC(t)),s){const f=Nd(t,!0,i,t);l.x=f.x+t.clientLeft,l.y=f.y+t.clientTop}else r&&(l.x=ZA(r));const u=r&&!s&&!i?RV(r,o):jo(0),d=a.left+o.scrollLeft-l.x-u.x,h=a.top+o.scrollTop-l.y-u.y;return{x:d,y:h,width:a.width,height:a.height}}function NS(e){return eo(e).position==="static"}function k3(e,t){if(!Vo(e)||eo(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Xo(e)===n&&(n=n.ownerDocument.body),n}function FV(e,t){const n=Ni(e);if(VC(e))return n;if(!Vo(e)){let r=qc(e);for(;r&&!zf(r);){if(Za(r)&&!NS(r))return r;r=qc(r)}return n}let s=k3(e,t);for(;s&&DKe(s)&&NS(s);)s=k3(s,t);return s&&zf(s)&&NS(s)&&!XA(s)?n:s||PKe(e)||n}const VKe=async function(e){const t=this.getOffsetParent||FV,n=this.getDimensions,s=await n(e.floating);return{reference:$Ke(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function WKe(e){return eo(e).direction==="rtl"}const zKe={convertOffsetParentRelativeRectToViewportRelativeRect:MKe,getDocumentElement:Xo,getClippingRect:UKe,getOffsetParent:FV,getElementRects:VKe,getClientRects:OKe,getDimensions:GKe,getScale:vf,isElement:Za,isRTL:WKe};function qKe(e,t){let n=null,s;const r=Xo(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:h,height:f}=e.getBoundingClientRect();if(o||t(),!h||!f)return;const p=mx(d),m=mx(r.clientWidth-(u+h)),v=mx(r.clientHeight-(d+f)),x=mx(u),b={rootMargin:-p+"px "+-m+"px "+-v+"px "+-x+"px",threshold:od(0,Vf(1,l))||1};let w=!0;function C(k){const y=k[0].intersectionRatio;if(y!==l){if(!w)return a();y?a(!1,y):s=setTimeout(()=>{a(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(C,pi({},b,{root:r.ownerDocument}))}catch{n=new IntersectionObserver(C,b)}n.observe(e)}return a(!0),i}function KKe(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=JA(e),d=r||i?[...u?g0(u):[],...g0(t)]:[];d.forEach(b=>{r&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const h=u&&o?qKe(u,n):null;let f=-1,p=null;a&&(p=new ResizeObserver(b=>{let[w]=b;w&&w.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var C;(C=p)==null||C.observe(t)})),n()}),u&&!l&&p.observe(u),p.observe(t));let m,v=l?Nd(e):null;l&&x();function x(){const b=Nd(e);v&&(b.x!==v.x||b.y!==v.y||b.width!==v.width||b.height!==v.height)&&n(),v=b,m=requestAnimationFrame(x)}return n(),()=>{var b;d.forEach(w=>{r&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),h?.(),(b=p)==null||b.disconnect(),p=null,l&&cancelAnimationFrame(m)}}const YKe=TKe,XKe=AKe,QKe=RKe,JKe=kKe,ZKe=FKe,eYe=(e,t,n)=>{const s=new Map,r=pi({platform:zKe},n),i=pi({},r.platform,{_c:s});return EKe(e,t,pi({},r,{platform:i}))};function tYe(e){e.cleanup&&e.cleanup();const t=e._getResolvedAttachToOptions();let n=t.element;const s=oYe(t,e),r=wV(t);return r&&(n=document.body,e.shepherdElementComponent.getElement().classList.add("shepherd-centered")),e.cleanup=KKe(n,e.el,()=>{if(!e.el){e.cleanup==null||e.cleanup();return}rYe(n,e,s,r)}),e.target=t.element,s}function nYe(e,t){return{floatingUIOptions:VA(e.floatingUIOptions||{},t.floatingUIOptions||{})}}function sYe(e){e.cleanup&&e.cleanup(),e.cleanup=null}function rYe(e,t,n,s){return eYe(e,t.el,n).then(iYe(t,s)).then(r=>new Promise(i=>{setTimeout(()=>i(r),300)})).then(r=>{r!=null&&r.el&&r.el.focus({preventScroll:!0})})}function iYe(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,aYe(e.el,i)),e)}function aYe(e,t){const n=e.querySelector(".shepherd-arrow");if($f(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 oYe(e,t){var n,s,r;const i={strategy:"absolute"};i.middleware=[];const a=lYe(t),o=wV(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(YKe({crossAxis:!0,alignment:u?e==null||(d=e.on)==null?void 0:d.split("-").pop():null}))}else i.middleware.push(QKe());if(i.middleware.push(XKe({limiter:ZKe(),crossAxis:!0})),a){const h=typeof t.options.arrow=="object"?t.options.arrow:{padding:4};i.middleware.push(JKe({element:a,padding:u?h.padding:0}))}l||(i.placement=e.on)}return VA(i,t.options.floatingUIOptions||{})}function lYe(e){return e.options.arrow&&e.el?e.el.querySelector(".shepherd-arrow"):!1}function Li(){}function cYe(e,t){for(const n in t)e[n]=t[n];return e}function DV(e){return e()}function _3(){return Object.create(null)}function tv(e){e.forEach(DV)}function e2(e){return typeof e=="function"}function zl(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function uYe(e){return Object.keys(e).length===0}function qf(e,t){e.appendChild(t)}function ao(e,t,n){e.insertBefore(t,n||null)}function Ea(e){e.parentNode&&e.parentNode.removeChild(e)}function dYe(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function Wo(e){return document.createElement(e)}function T3(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function PV(e){return document.createTextNode(e)}function Aw(){return PV(" ")}function hYe(){return PV("")}function zC(e,t,n,s){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n,s)}function In(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}const fYe=["width","height"];function R3(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&&fYe.indexOf(s)===-1?e[s]=t[s]:In(e,s,t[s])}function pYe(e){return Array.from(e.childNodes)}function xh(e,t,n){e.classList.toggle(t,!!n)}let m0;function hm(e){m0=e}function IV(){if(!m0)throw new Error("Function called outside component initialization");return m0}function gYe(e){IV().$$.on_mount.push(e)}function t2(e){IV().$$.after_update.push(e)}const Fh=[],Kf=[];let xf=[];const A3=[],mYe=Promise.resolve();let y_=!1;function vYe(){y_||(y_=!0,mYe.then(NV))}function S_(e){xf.push(e)}const MS=new Set;let bh=0;function NV(){if(bh!==0)return;const e=m0;do{try{for(;bh<Fh.length;){const t=Fh[bh];bh++,hm(t),xYe(t.$$)}}catch(t){throw Fh.length=0,bh=0,t}for(hm(null),Fh.length=0,bh=0;Kf.length;)Kf.pop()();for(let t=0;t<xf.length;t+=1){const n=xf[t];MS.has(n)||(MS.add(n),n())}xf.length=0}while(Fh.length);for(;A3.length;)A3.pop()();y_=!1,MS.clear(),hm(e)}function xYe(e){if(e.fragment!==null){e.update(),tv(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(S_)}}function bYe(e){const t=[],n=[];xf.forEach(s=>e.indexOf(s)===-1?t.push(s):n.push(s)),n.forEach(s=>s()),xf=t}const Kx=new Set;let $u;function ld(){$u={r:0,c:[],p:$u}}function cd(){$u.r||tv($u.c),$u=$u.p}function En(e,t){e&&e.i&&(Kx.delete(e),e.i(t))}function xs(e,t,n,s){if(e&&e.o){if(Kx.has(e))return;Kx.add(e),$u.c.push(()=>{Kx.delete(e),s&&(n&&e.d(1),s())}),e.o(t)}else s&&s()}function F3(e){return e?.length!==void 0?e:Array.from(e)}function wYe(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 Qd(e){e&&e.c()}function iu(e,t,n){const{fragment:s,after_update:r}=e.$$;s&&s.m(t,n),S_(()=>{const i=e.$$.on_mount.map(DV).filter(e2);e.$$.on_destroy?e.$$.on_destroy.push(...i):tv(i),e.$$.on_mount=[]}),r.forEach(S_)}function au(e,t){const n=e.$$;n.fragment!==null&&(bYe(n.after_update),tv(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function CYe(e,t){e.$$.dirty[0]===-1&&(Fh.push(e),vYe(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function ql(e,t,n,s,r,i,a=null,o=[-1]){const l=m0;hm(e);const u=e.$$={fragment:null,ctx:[],props:i,update:Li,not_equal:r,bound:_3(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:_3(),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||{},(h,f,...p)=>{const m=p.length?p[0]:f;return u.ctx&&r(u.ctx[h],u.ctx[h]=m)&&(!u.skip_bound&&u.bound[h]&&u.bound[h](m),d&&CYe(e,h)),f}):[],u.update(),d=!0,tv(u.before_update),u.fragment=s?s(u.ctx):!1,t.target){if(t.hydrate){const h=pYe(t.target);u.fragment&&u.fragment.l(h),h.forEach(Ea)}else u.fragment&&u.fragment.c();t.intro&&En(e.$$.fragment),iu(e,t.target,t.anchor),NV()}hm(l)}class Kl{constructor(){this.$$=void 0,this.$$set=void 0}$destroy(){au(this,1),this.$destroy=Li}$on(t,n){if(!e2(n))return Li;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&&!uYe(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const yYe="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(yYe);function SYe(e){let t,n,s,r,i;return{c(){t=Wo("button"),In(t,"aria-label",n=e[3]?e[3]:null),In(t,"class",s=`${e[1]||""} shepherd-button ${e[4]?"shepherd-button-secondary":""}`),t.disabled=e[2],In(t,"tabindex","0"),In(t,"type","button")},m(a,o){ao(a,t,o),t.innerHTML=e[5],r||(i=zC(t,"click",function(){e2(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)&&In(t,"aria-label",n),o&18&&s!==(s=`${e[1]||""} shepherd-button ${e[4]?"shepherd-button-secondary":""}`)&&In(t,"class",s),o&4&&(t.disabled=e[2])},i:Li,o:Li,d(a){a&&Ea(t),r=!1,i()}}}function EYe(e,t,n){let{config:s,step:r}=t,i,a,o,l,u,d;function h(f){return zc(f)?f=f.call(r):f}return e.$$set=f=>{"config"in f&&n(6,s=f.config),"step"in f&&n(7,r=f.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?h(s.disabled):!1),n(3,l=s.label?h(s.label):null),n(4,u=s.secondary),n(5,d=s.text?h(s.text):null))},[i,a,o,l,u,d,s,r]}class kYe extends Kl{constructor(t){super(),ql(this,t,EYe,SYe,zl,{config:6,step:7})}}function D3(e,t,n){const s=e.slice();return s[2]=t[n],s}function P3(e){let t,n,s=F3(e[1]),r=[];for(let a=0;a<s.length;a+=1)r[a]=I3(D3(e,s,a));const i=a=>xs(r[a],1,1,()=>{r[a]=null});return{c(){for(let a=0;a<r.length;a+=1)r[a].c();t=hYe()},m(a,o){for(let l=0;l<r.length;l+=1)r[l]&&r[l].m(a,o);ao(a,t,o),n=!0},p(a,o){if(o&3){s=F3(a[1]);let l;for(l=0;l<s.length;l+=1){const u=D3(a,s,l);r[l]?(r[l].p(u,o),En(r[l],1)):(r[l]=I3(u),r[l].c(),En(r[l],1),r[l].m(t.parentNode,t))}for(ld(),l=s.length;l<r.length;l+=1)i(l);cd()}},i(a){if(!n){for(let o=0;o<s.length;o+=1)En(r[o]);n=!0}},o(a){r=r.filter(Boolean);for(let o=0;o<r.length;o+=1)xs(r[o]);n=!1},d(a){a&&Ea(t),dYe(r,a)}}}function I3(e){let t,n;return t=new kYe({props:{config:e[2],step:e[0]}}),{c(){Qd(t.$$.fragment)},m(s,r){iu(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||(En(t.$$.fragment,s),n=!0)},o(s){xs(t.$$.fragment,s),n=!1},d(s){au(t,s)}}}function _Ye(e){let t,n,s=e[1]&&P3(e);return{c(){t=Wo("footer"),s&&s.c(),In(t,"class","shepherd-footer")},m(r,i){ao(r,t,i),s&&s.m(t,null),n=!0},p(r,[i]){r[1]?s?(s.p(r,i),i&2&&En(s,1)):(s=P3(r),s.c(),En(s,1),s.m(t,null)):s&&(ld(),xs(s,1,1,()=>{s=null}),cd())},i(r){n||(En(s),n=!0)},o(r){xs(s),n=!1},d(r){r&&Ea(t),s&&s.d()}}}function TYe(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 RYe extends Kl{constructor(t){super(),ql(this,t,TYe,_Ye,zl,{step:0})}}function AYe(e){let t,n,s,r,i;return{c(){t=Wo("button"),n=Wo("span"),n.textContent="×",In(n,"aria-hidden","true"),In(t,"aria-label",s=e[0].label?e[0].label:"Close Tour"),In(t,"class","shepherd-cancel-icon"),In(t,"type","button")},m(a,o){ao(a,t,o),qf(t,n),r||(i=zC(t,"click",e[1]),r=!0)},p(a,[o]){o&1&&s!==(s=a[0].label?a[0].label:"Close Tour")&&In(t,"aria-label",s)},i:Li,o:Li,d(a){a&&Ea(t),r=!1,i()}}}function FYe(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 DYe extends Kl{constructor(t){super(),ql(this,t,FYe,AYe,zl,{cancelIcon:0,step:2})}}function PYe(e){let t;return{c(){t=Wo("h3"),In(t,"id",e[1]),In(t,"class","shepherd-title")},m(n,s){ao(n,t,s),e[3](t)},p(n,[s]){s&2&&In(t,"id",n[1])},i:Li,o:Li,d(n){n&&Ea(t),e[3](null)}}}function IYe(e,t,n){let{labelId:s,element:r,title:i}=t;t2(()=>{zc(i)&&n(2,i=i()),n(0,r.innerHTML=i,r)});function a(o){Kf[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 NYe extends Kl{constructor(t){super(),ql(this,t,IYe,PYe,zl,{labelId:1,element:0,title:2})}}function N3(e){let t,n;return t=new NYe({props:{labelId:e[0],title:e[2]}}),{c(){Qd(t.$$.fragment)},m(s,r){iu(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||(En(t.$$.fragment,s),n=!0)},o(s){xs(t.$$.fragment,s),n=!1},d(s){au(t,s)}}}function M3(e){let t,n;return t=new DYe({props:{cancelIcon:e[3],step:e[1]}}),{c(){Qd(t.$$.fragment)},m(s,r){iu(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||(En(t.$$.fragment,s),n=!0)},o(s){xs(t.$$.fragment,s),n=!1},d(s){au(t,s)}}}function MYe(e){let t,n,s,r=e[2]&&N3(e),i=e[3]&&e[3].enabled&&M3(e);return{c(){t=Wo("header"),r&&r.c(),n=Aw(),i&&i.c(),In(t,"class","shepherd-header")},m(a,o){ao(a,t,o),r&&r.m(t,null),qf(t,n),i&&i.m(t,null),s=!0},p(a,[o]){a[2]?r?(r.p(a,o),o&4&&En(r,1)):(r=N3(a),r.c(),En(r,1),r.m(t,n)):r&&(ld(),xs(r,1,1,()=>{r=null}),cd()),a[3]&&a[3].enabled?i?(i.p(a,o),o&8&&En(i,1)):(i=M3(a),i.c(),En(i,1),i.m(t,null)):i&&(ld(),xs(i,1,1,()=>{i=null}),cd())},i(a){s||(En(r),En(i),s=!0)},o(a){xs(r),xs(i),s=!1},d(a){a&&Ea(t),r&&r.d(),i&&i.d()}}}function OYe(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 LYe extends Kl{constructor(t){super(),ql(this,t,OYe,MYe,zl,{labelId:0,step:1})}}function BYe(e){let t;return{c(){t=Wo("div"),In(t,"class","shepherd-text"),In(t,"id",e[1])},m(n,s){ao(n,t,s),e[3](t)},p(n,[s]){s&2&&In(t,"id",n[1])},i:Li,o:Li,d(n){n&&Ea(t),e[3](null)}}}function jYe(e,t,n){let{descriptionId:s,element:r,step:i}=t;t2(()=>{let{text:o}=i.options;zc(o)&&(o=o.call(i)),$f(o)?r.appendChild(o):n(0,r.innerHTML=o,r)});function a(o){Kf[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 HYe extends Kl{constructor(t){super(),ql(this,t,jYe,BYe,zl,{descriptionId:1,element:0,step:2})}}function O3(e){let t,n;return t=new LYe({props:{labelId:e[1],step:e[2]}}),{c(){Qd(t.$$.fragment)},m(s,r){iu(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||(En(t.$$.fragment,s),n=!0)},o(s){xs(t.$$.fragment,s),n=!1},d(s){au(t,s)}}}function L3(e){let t,n;return t=new HYe({props:{descriptionId:e[0],step:e[2]}}),{c(){Qd(t.$$.fragment)},m(s,r){iu(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||(En(t.$$.fragment,s),n=!0)},o(s){xs(t.$$.fragment,s),n=!1},d(s){au(t,s)}}}function B3(e){let t,n;return t=new RYe({props:{step:e[2]}}),{c(){Qd(t.$$.fragment)},m(s,r){iu(t,s,r),n=!0},p(s,r){const i={};r&4&&(i.step=s[2]),t.$set(i)},i(s){n||(En(t.$$.fragment,s),n=!0)},o(s){xs(t.$$.fragment,s),n=!1},d(s){au(t,s)}}}function UYe(e){let t,n=!_r(e[2].options.title)||e[2].options.cancelIcon&&e[2].options.cancelIcon.enabled,s,r=!_r(e[2].options.text),i,a=Array.isArray(e[2].options.buttons)&&e[2].options.buttons.length,o,l=n&&O3(e),u=r&&L3(e),d=a&&B3(e);return{c(){t=Wo("div"),l&&l.c(),s=Aw(),u&&u.c(),i=Aw(),d&&d.c(),In(t,"class","shepherd-content")},m(h,f){ao(h,t,f),l&&l.m(t,null),qf(t,s),u&&u.m(t,null),qf(t,i),d&&d.m(t,null),o=!0},p(h,[f]){f&4&&(n=!_r(h[2].options.title)||h[2].options.cancelIcon&&h[2].options.cancelIcon.enabled),n?l?(l.p(h,f),f&4&&En(l,1)):(l=O3(h),l.c(),En(l,1),l.m(t,s)):l&&(ld(),xs(l,1,1,()=>{l=null}),cd()),f&4&&(r=!_r(h[2].options.text)),r?u?(u.p(h,f),f&4&&En(u,1)):(u=L3(h),u.c(),En(u,1),u.m(t,i)):u&&(ld(),xs(u,1,1,()=>{u=null}),cd()),f&4&&(a=Array.isArray(h[2].options.buttons)&&h[2].options.buttons.length),a?d?(d.p(h,f),f&4&&En(d,1)):(d=B3(h),d.c(),En(d,1),d.m(t,null)):d&&(ld(),xs(d,1,1,()=>{d=null}),cd())},i(h){o||(En(l),En(u),En(d),o=!0)},o(h){xs(l),xs(u),xs(d),o=!1},d(h){h&&Ea(t),l&&l.d(),u&&u.d(),d&&d.d()}}}function GYe(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 $Ye extends Kl{constructor(t){super(),ql(this,t,GYe,UYe,zl,{descriptionId:0,labelId:1,step:2})}}function j3(e){let t;return{c(){t=Wo("div"),In(t,"class","shepherd-arrow"),In(t,"data-popper-arrow","")},m(n,s){ao(n,t,s)},d(n){n&&Ea(t)}}}function VYe(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&&j3();s=new $Ye({props:{descriptionId:e[2],labelId:e[3],step:e[4]}});let d=[{"aria-describedby":r=_r(e[4].options.text)?null:e[2]},{"aria-labelledby":i=e[4].options.title?e[3]:null},e[1],{open:"true"}],h={};for(let f=0;f<d.length;f+=1)h=cYe(h,d[f]);return{c(){t=Wo("dialog"),u&&u.c(),n=Aw(),Qd(s.$$.fragment),R3(t,h),xh(t,"shepherd-has-cancel-icon",e[5]),xh(t,"shepherd-has-title",e[6]),xh(t,"shepherd-element",!0)},m(f,p){ao(f,t,p),u&&u.m(t,null),qf(t,n),iu(s,t,null),e[13](t),a=!0,o||(l=zC(t,"keydown",e[7]),o=!0)},p(f,[p]){f[4].options.arrow&&f[4].options.attachTo&&f[4].options.attachTo.element&&f[4].options.attachTo.on?u||(u=j3(),u.c(),u.m(t,n)):u&&(u.d(1),u=null);const m={};p&4&&(m.descriptionId=f[2]),p&8&&(m.labelId=f[3]),p&16&&(m.step=f[4]),s.$set(m),R3(t,h=wYe(d,[(!a||p&20&&r!==(r=_r(f[4].options.text)?null:f[2]))&&{"aria-describedby":r},(!a||p&24&&i!==(i=f[4].options.title?f[3]:null))&&{"aria-labelledby":i},p&2&&f[1],{open:"true"}])),xh(t,"shepherd-has-cancel-icon",f[5]),xh(t,"shepherd-has-title",f[6]),xh(t,"shepherd-element",!0)},i(f){a||(En(s.$$.fragment,f),a=!0)},o(f){xs(s.$$.fragment,f),a=!1},d(f){f&&Ea(t),u&&u.d(),au(s),e[13](null),o=!1,l()}}}const WYe=9,zYe=27,qYe=37,KYe=39;function H3(e){return e.split(" ").filter(t=>!!t.length)}function YYe(e,t,n){let{classPrefix:s,element:r,descriptionId:i,firstFocusableElement:a,focusableElements:o,labelId:l,lastFocusableElement:u,step:d,dataStepId:h}=t,f,p,m;const v=()=>r;gYe(()=>{n(1,h={[`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])}),t2(()=>{m!==d.options.classes&&x()});function x(){b(m),m=d.options.classes,w(m)}function b(y){if(p0(y)){const E=H3(y);E.length&&r.classList.remove(...E)}}function w(y){if(p0(y)){const E=H3(y);E.length&&r.classList.add(...E)}}const C=y=>{const{tour:E}=d;switch(y.keyCode){case WYe:if(o.length===0){y.preventDefault();break}y.shiftKey?(document.activeElement===a||document.activeElement.classList.contains("shepherd-element"))&&(y.preventDefault(),u.focus()):document.activeElement===u&&(y.preventDefault(),a.focus());break;case zYe:E.options.exitOnEsc&&(y.preventDefault(),y.stopPropagation(),d.cancel());break;case qYe:E.options.keyboardNavigation&&(y.preventDefault(),y.stopPropagation(),E.back());break;case KYe:E.options.keyboardNavigation&&(y.preventDefault(),y.stopPropagation(),E.next());break}};function k(y){Kf[y?"unshift":"push"](()=>{r=y,n(0,r)})}return e.$$set=y=>{"classPrefix"in y&&n(11,s=y.classPrefix),"element"in y&&n(0,r=y.element),"descriptionId"in y&&n(2,i=y.descriptionId),"firstFocusableElement"in y&&n(8,a=y.firstFocusableElement),"focusableElements"in y&&n(9,o=y.focusableElements),"labelId"in y&&n(3,l=y.labelId),"lastFocusableElement"in y&&n(10,u=y.lastFocusableElement),"step"in y&&n(4,d=y.step),"dataStepId"in y&&n(1,h=y.dataStepId)},e.$$.update=()=>{e.$$.dirty&16&&(n(5,f=d.options&&d.options.cancelIcon&&d.options.cancelIcon.enabled),n(6,p=d.options&&d.options.title))},[r,h,i,l,d,f,p,C,a,o,u,s,v,k]}class XYe extends Kl{constructor(t){super(),ql(this,t,YYe,VYe,zl,{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 E_ extends GA{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?bV(this.tour.options.classPrefix):"",this.styles=t.styles,this._resolvedAttachTo=null,WA(this),this._setOptions(n),this}cancel(){this.tour.cancel(),this.trigger("cancel")}complete(){this.tour.complete(),this.trigger("complete")}destroy(){sYe(this),$f(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=fKe(this),this._resolvedExtraHighlightElements}_resolveAttachToOptions(){return this._resolvedAttachTo=hKe(this),this._resolvedAttachTo}_getResolvedAttachToOptions(){return this._resolvedAttachTo===null?this._resolveAttachToOptions():this._resolvedAttachTo}isOpen(){return!!(this.el&&!this.el.hidden)}show(){return zc(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 XYe({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();zc(this.options.scrollToHandler)?this.options.scrollToHandler(n):Wqe(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=VA({},n||{}),this.options=Object.assign({arrow:!0},n,t,nYe(n,t));const{when:s}=this.options;this.options.classes=this._getClassOptions(t),this.destroy(),this.id=this.options.id||`step-${CV()}`,s&&Object.keys(s).forEach(r=>{this.on(r,s[r],this)})}_setupElements(){_r(this.el)||this.destroy(),this.el=this._createTooltipContent(),this.options.advanceOn&&cKe(this),tYe(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 QYe(e){if(e){const{steps:t}=e;t.forEach(n=>{n.options&&n.options.canClickTarget===!1&&n.options.attachTo&&($f(n.target)&&n.target.classList.remove("shepherd-target-click-disabled"),n._resolvedExtraHighlightElements&&n._resolvedExtraHighlightElements.forEach(s=>{$f(s)&&s.classList.remove("shepherd-target-click-disabled")}))})}}function JYe(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:h=0,bottomRight:f=0,bottomLeft:p=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-p} a${p},${p},0,0,0,${p},${p} H${i+o-f} a${f},${f},0,0,0,${f}-${f} V${l+h} a${h},${h},0,0,0-${h}-${h} Z`}),`M${n},${s} H0 V0 H${n} V${s} Z ${t}`.replace(/\s/g,"")}function ZYe(e){let t,n,s,r,i;return{c(){t=T3("svg"),n=T3("path"),In(n,"d",e[2]),In(t,"class",s=`${e[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)},m(a,o){ao(a,t,o),qf(t,n),e[11](t),r||(i=zC(t,"touchmove",e[3]),r=!0)},p(a,[o]){o&4&&In(n,"d",a[2]),o&2&&s!==(s=`${a[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)&&In(t,"class",s)},i:Li,o:Li,d(a){a&&Ea(t),e[11](null),r=!1,i()}}}function MV(e){if(!e)return null;const t=e instanceof HTMLElement&&window.getComputedStyle(e).overflowY;return t!=="hidden"&&t!=="visible"&&e.scrollHeight>=e.clientHeight?e:MV(e.parentElement)}function eXe(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 tXe(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 nXe(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),b()}function h(k=0,y=0,E=0,T=0,F,R,I){if(R){const N=[R,...I||[]];n(4,r=[]);for(const D of N){if(!D||N.indexOf(D)!==N.lastIndexOf(D))continue;const{y:O,height:G}=tXe(D,F),{x:B,width:ee,left:z}=D.getBoundingClientRect();N.some(ue=>{if(ue===D)return!1;const U=ue.getBoundingClientRect();return B>=U.left&&B+ee<=U.right&&O>=U.top&&O+G<=U.bottom})||r.push({width:ee+k*2,height:G+k*2,x:(B||z)+E-k,y:O+T-k,r:y})}}else u()}function f(k){b(),k.tour.options.useModalOverlay?(w(k),p()):d()}function p(){n(1,i=!0)}const m=k=>{k.preventDefault()},v=k=>{k.stopPropagation()};function x(){window.addEventListener("touchmove",m,{passive:!1})}function b(){a&&(cancelAnimationFrame(a),a=void 0),window.removeEventListener("touchmove",m,{passive:!1})}function w(k){const{modalOverlayOpeningPadding:y,modalOverlayOpeningRadius:E,modalOverlayOpeningXOffset:T=0,modalOverlayOpeningYOffset:F=0}=k.options,R=eXe(k.target),I=MV(k.target),N=()=>{a=void 0,h(y,E,T+R.left,F+R.top,I,k.target,k._resolvedExtraHighlightElements),a=requestAnimationFrame(N)};N(),x()}function C(k){Kf[k?"unshift":"push"](()=>{s=k,n(0,s)})}return e.$$set=k=>{"element"in k&&n(0,s=k.element),"openingProperties"in k&&n(4,r=k.openingProperties)},e.$$.update=()=>{e.$$.dirty&16&&n(2,o=JYe(r))},[s,i,o,v,r,l,u,d,h,f,p,C]}class sXe extends Kl{constructor(t){super(),ql(this,t,nXe,ZYe,zl,{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 rXe extends GA{constructor(){super(),this.activeTour=void 0,WA(this)}}class iXe extends GA{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,WA(this);const n={exitOnEsc:!0,keyboardNavigation:!0};return this.options=Object.assign({},n,t),this.classPrefix=bV(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,Vu.trigger(r,i)})})(s)}),this._setTourID(t.id),this}addStep(t,n){let s=t;return s instanceof E_?s.tour=this:s=new E_(this,s),_r(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;zc(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 Vu.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=p0(t)?this.getById(t):this.steps[t];s&&(this._updateStateBeforeShow(),zc(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()),QYe(this),this.trigger(t,{index:n}),Vu.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)}$f(this.focusedElBeforeOpen)&&this.focusedElBeforeOpen.focus()}_setupActiveTour(){this.trigger("active",{tour:this}),Vu.activeTour=this}setupModal(){this.modal=new sXe({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||CV();this.id=`${n}--${s}`}}const Vu=new rXe,OV=typeof window>"u";Vu.Step=OV?uKe:E_;Vu.Tour=OV?dKe:iXe;const qC=g.createContext(void 0);qC.Consumer;const aXe=({children:e})=>Vqe.jsx(qC.Provider,{value:{Shepherd:Vu},children:e}),oXe=""+new URL("agentic-sequence-CExfswgi.png",import.meta.url).href,lXe=""+new URL("canvas-code-inline-edit-DLji9b0m.png",import.meta.url).href,cXe=""+new URL("canvas-overview-CruGEIRC.png",import.meta.url).href,uXe=""+new URL("canvas-variables-view-DrA20zqs.png",import.meta.url).href,dXe=""+new URL("chat-attachments-_3cRrONU.png",import.meta.url).href,hXe=""+new URL("chat-full-view-e-eJPzrw.png",import.meta.url).href,fXe=""+new URL("chat-input-CU-CA7Se.png",import.meta.url).href,pXe=""+new URL("inline-edit-canvas-O9conTkE.png",import.meta.url).href,gXe=e=>{const t=Array.from(document.querySelectorAll(`[data-tour-tag="${e}"]`));return t.find(n=>n.offsetParent!==null)??t[0]??null},U3=e=>{document.querySelector(`[data-tour-action="${e}"]`)?.click()},G3=[{id:"welcome",title:"Welcome to Local Operator",text:`Local Operator is an AI agents platform that allows you to create a team of proactive AI agents that support you and help to reduce your daily workload.<br/><img src="${hXe}" alt="Chat full view" style="width: 100%; height: 350px; object-fit: contain; border-radius: 8px;"/><br />These agents are different from simple chatbots because they can actually do things for you on your computer like create files, run code and analytics, edit images, videos, and PDFs, organize your system, and much more.<br/><br/>In this walkthrough we'll cover:<ul><li>Creating agents</li><li>Making agents do things</li><li>The canvas workspace</li><li>Customizing agents</li><li>Agent hub for sharing and collaborating</li><li>Schedules for proactive agents</li><li>Settings for customization</li></ul>Let's explore how it works.`,buttons:[{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"agent-list",attachTo:{element:'[data-tour-tag="agent-list-panel"]',on:"right"},title:"Your agents",text:"On the left, you'll see a list of your available AI agents. You can select an agent to start a conversation or manage its settings. Think of this as your messenger contacts list, but for AI agents. There are no limits to how many agents you can have, so create as many as you need to handle all your daily tasks.<br/><br/>Use the create agents button at the top of the toolbar to create a new agent at any time. You can also import agents from the Agent hub, which we will cover later in this tour.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"select-agent",attachTo:{element:'[data-tour-tag="agent-list-item-button-0"]',on:"right"},title:"Select an agent",text:"Click on an agent to open the chat window to pull up your conversation with it. This will show the messages that you have sent them and the responses and actions that they have taken.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"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:"Ask your agent anything",text:`Type your request here. Agents can answer questions, perform tasks, search the web, and much more. When you create a new agent, you'll see suggested prompts for ideas.<br /><br />Some powerful requests that you can try:<br /><br /><ul><li>"Create a spreadsheet in my Documents folder with all the major cities in Canada."</li><li>"Search the web for the latest news on AI and make a thorough report."</li><li>Select an attachment and then "translate this document to French."</li></ul><br /><img src="${fXe}" alt="Chat input" style="width: 100%; height: 200px; object-fit: contain; border-radius: 8px;"/><br />You can also attach files to your message by clicking the paperclip button, which we will cover in the next step.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"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:"Attach files to your message",text:`You can attach any files, images, or documents to your message by clicking this paperclip button, there are no limitations on the file types. Your agent can process, analyze, or translate these attachments as part of your request.<br /><br />Try attaching a PDF, image, or text file and then ask your agent to summarize, translate, or extract information from it.<br /><img src="${dXe}" alt="Chat attachments" style="width: 100%; height: 200px; object-fit: contain; border-radius: 8px;"/><br />Images like PNGs, JPGs, and PDFs are natively streamed into the model context window, so they can understand them directly without needing to run any code. Other files like Excel, Word, and CSV files are included as file paths on your device to direct the model's attention to work with them using code. You can attach massive files like million line CSVs and have the agent work with them using code.<br /><br />You can also paste images into the chat input, and attach multiple files at once to achieve more complex tasks. Try taking a screenshot of a website and then asking your agent to try to code it.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"agent-capabilities",attachTo:{element:'[data-tour-tag="chat-header"]',on:"top"},title:"More than just chat",text:`Local Operator agents are different from simple chatbots. They can perform actions on your computer, like creating files, running code, or browsing the web, based on your instructions. You'll see them use "tools" like reading, writing, and executing code to get things done. Agents have memory of the conversation, previous steps, learnings, and even store the execution variables of previous steps in code to be able to use them later in the conversation.<br /><img src="${oXe}" alt="Agentic sequence" style="width: 100%; height: 350px; object-fit: contain; border-radius: 8px;"/><br />Local Operator agents are extremely flexible, so they can bounce back and forth with you for simple chatting, and know when they need to embark on a work journey to get things done in multiple steps with tool use.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){const{openCommandPalette:e}=qe.getState();e(),setTimeout(()=>{this.next()},500)}}]},{id:"pre-command-palette-open-canvas",title:"Command palette",attachTo:{element:'[data-tour-tag="command-palette-dialog"]',on:"right"},text:`Let's quickly look at another powerful feature: the Command Palette. You can open it anywhere in the app by pressing <code>${To("everything",!0)}</code> on Mac and <code>${To("everything",!1)}</code> on Windows or Linux. This is a helpful window that you can open from anywhere in the app to be able to access your chats, agents, settings, pages and actions, and much more, using your keyboard. It can often be faster to access sections in the app this way instead of clicking through menus. Type a word to search everything at once, or start with a prefix to narrow it: <code>#</code> for chats, <code>@</code> for agents and teams, <code>,</code> for settings, and <code>></code> for commands and pages.<br /><br />In a hurry for a conversation? Press <code>${To("chats",!0)}</code> on Mac and <code>${To("chats",!1)}</code> on Windows or Linux and the palette opens already searching your chats, so you can jump straight to one — and <code>${To("commands",!0)}</code> on Mac and <code>${To("commands",!1)}</code> on Windows or Linux opens it on the app's own commands and pages when that is what you are after. You can also just click Search in the sidebar to open it.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const{closeCommandPalette:e}=qe.getState();e(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const{closeCommandPalette:e}=qe.getState();e(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-open-button",attachTo:{element:'button[data-tour-tag="open-canvas-button"]',on:"left"},title:"Open the canvas",text:"Click here to open the Canvas, a workspace for files and dynamic visualizations where you can organize, plan, and interact with your agents in a more flexible way.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const{openCommandPalette:e}=qe.getState();e(),setTimeout(()=>{this.back()},500)}},{text:"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:"left"},title:"The canvas: your visual workspace",text:`This is the Canvas, your workspace for files and dynamic visualizations where you can organize, plan, and interact with your agents in a more flexible way. Any files that your agents create on your device can be opened here by clicking on the file icons that you see as they work.<br/><br/>Agents can make dynamic visualizations like games, charts, maps, and more in HTML files. Any HTML files you open will be rendered dynamically in an iframe. Any markdown files that you open will be rendered in full markdown viewer with support for code blocks, tables, mermaid diagrams, and more.<br/><img src="${cXe}" alt="Canvas overview" style="width: 100%; height: 300px; object-fit: contain; border-radius: 8px;"/>`,buttons:[{text:"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:"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:"Documents view",text:`The Documents view shows all your open notes, blog articles, code, and visualizations as tabs. You can switch between documents to edit them and see dynamic visualizations in HTML created by your agents. Use this view to work with your notes, reports, and agent-generated content.<br /><br />This is where you can get more precise around your agents' work.<br/><img src="${pXe}" alt="Inline edit canvas" style="width: 100%; height: 200px; object-fit: contain; border-radius: 8px;"/><br />In your documents, highlight any text that you want your agent to improve and press Cmd/Ctrl+K to bring up the inline AI editor.
|
|
683
683
|
<br /><img src="${lXe}" alt="Canvas code inline edit" style="width: 100%; height: 200px; object-fit: cover; object-position: top; border-radius: 8px;"/><br />You can be as precise as you want and the agent will edit the document for you in place, using its memories and context so you don't have to re-explain things.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"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:"Files view",text:"The Files view lets you browse and open files that your agents have created or that are relevant to your current conversation. Use this to quickly access, preview, and open files in the Canvas workspace.",buttons:[{text:"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:"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:"Variables view",text:`The Variables view displays the "code memory" that agents have stored during their work. These are technical variables that include results, intermediate values, and other data that agents use to perform tasks. You can inspect and manage these variables here.<br /><br />This section will be most helpful for more technical users who want to understand how agents are working and what they are doing.<br/><img src="${uXe}" alt="Canvas variables" style="width: 100%; height: 350px; object-fit: contain; border-radius: 8px;"/>`,buttons:[{text:"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:"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:"right"},title:"Agent options",text:"Click here to see options for the currently selected agent, like viewing its settings, exporting it, or deleting it.",buttons:[{text:"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:"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:"right"},title:"View configuration",text:'Click "View agent settings" to see and change how this agent works and change things like its name, description, hosting provider, and AI model.',buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"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:"left"},title:"Agent configuration",text:"This is where you can customize and configure your agent. You can change its name, description, the AI model it uses, its temperature for creativity, and other chat settings.<br /><br />The agents will already have default settings that work well for most use cases, but if you want to roll up your sleeves and customize, you can do so here.",buttons:[{text:"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:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"select-provider",attachTo:{element:'[data-tour-tag="agent-settings-hosting-select"]',on:"left"},title:"Select hosting provider",text:`Choose an AI provider for your agent. If you don't pick one here, then the default provider from the settings page will be used. Providers offer different AI models and pricing. Radient is recommended for Local Operator as its "Automatic" mode is optimized for the lowest cost and best performance.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"select-model",attachTo:{element:'[data-tour-tag="agent-settings-model-select"]',on:"left"},title:"Select AI model",text:"After selecting a provider, choose an AI model. Models marked as 'Recommended' are known to work well with Local Operator. Other models might have inconsistent performance. If a model you expect to be recommended isn't listed, please let us know if it works well for you in Local Operator via GitHub Issues or email.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"modify-security-prompt",attachTo:{element:'[data-tour-tag="agent-settings-security"]',on:"left"},title:"Customize security behaviors",text:"This prompt provides separate instructions to the security agent that reviews this agent's work. You can explicitly allow certain actions that would normally be blocked. If you encounter frequent security interventions, consider adding a note here for the security agent.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"modify-agent-prompt",attachTo:{element:'[data-tour-tag="agent-settings-system-prompt"]',on:"left"},title:"Customize the agent's behavior",text:"This prompt allows you to customize the baseline behavior of the agent. While most customization can happen by talking to the agent (it records learnings in its notebook), you can provide specific workflow instructions here that will be followed separately.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"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:"Create a new agent",text:'Click the "+" button to create a brand new agent from scratch. You can then customize its behavior and capabilities.',buttons:[{text:"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:"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:"right"},title:"Naming and describing your agent",text:`Give your agent a clear, descriptive name that reflects its purpose (e.g., "File Organizer" or "Web Researcher").
|
|
684
|
-
A good description helps you and others understand what the agent does and any special instructions. The descriptions are also used by other agents to help them understand how to tag each other in for certain tasks.<br /><br />If you want this agent to be part of the agent-to-agent communication network, it will need to have a description that captures its purpose and capabilities. Be concise and specific.`,buttons:[{text:"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:"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:"right"},title:"Discover more agents",text:`Let's visit the Agent hub to find community-created agents. Click on the "Agent hub" icon in the navigation bar.`,buttons:[{text:"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:"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:"right"},title:"The Agent hub",text:"Here you can browse agents by category or search for specific ones. These agents are shared by the community and can perform various specialized tasks.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"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:"Download an agent",text:'Find an agent that interests you and click the "Get" button to add it to your local agent list.',buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"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:()=>gXe("upload-to-hub-header-button"),on:"bottom"},title:"Share your agents",text:"If you create a useful agent, you can also share it with the community by uploading it to the Agent hub from the agent options menu.",buttons:[{text:"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:"Next",classes:"shepherd-button-primary",action:function(){U3("open-upload-dialog"),setTimeout(()=>{this.next()},500)}}]},{id:"upload-agent-hub-dialog",attachTo:{element:'[data-tour-tag="upload-agent-dialog"]',on:"right"},title:"Upload agent to hub",text:"This dialog publishes your agent's instruction set to the community. You need a Radient account to publish, which is free to create and costs nothing per agent. You can review the details before confirming. What is published is what describes the agent - its name, description, instructions and tool surface; no conversation, execution history, memory, plan or machine-specific configuration leaves your computer. Make sure your agent meets the required criteria before submitting.",buttons:[{text:"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:"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:"right"},title:"Automate tasks with schedules",text:"Local Operator can run tasks for you on a regular basis. Let's check out the Schedules section.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{U3("open-upload-dialog")},500),setTimeout(()=>{this.back()},1e3)}},{text:"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:"Proactive agents with schedules",text:"A powerful feature of Local Operator is the ability to ask agents to perform tasks on their own on a recurring basis. This turns them from reactive agent bots to proactive agents that work on their own in the background to support you without you needing to continually ask them to do things.<br /><br />You can simply ask any agent to do something at some point in the future, or to handle some daily task at a certain time, and it will create a prompt for itself that will be executed at the specified times.<br /><br />Here, you can view, create, and manage all your scheduled tasks in one place to streamline your workflow and ensure important actions happen automatically.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"create-schedule",attachTo:{element:'button[data-tour-tag="create-schedule-button"]',on:"bottom"},title:"Set up a recurring task",text:'Click "Create schedule" to ask an agent to perform a task for you regularly, like sending a daily report or checking for news updates.<br /><br />You can also create one-off tasks that only run once at some point in the future.',buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"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:"right"},title:"Configure your schedule",text:"While it is often much easier to simply ask the agent to do a task on a recurring basis for you, you can also manually set up a schedule for a task here or update existing tasks.<br /><br />The prompt is the message that will be sent to the agent at the predefined schedule. You can update the time of day in your local timezone, the frequency of the task, and even specify a specific date or time that the task should stop running at.<br /><br />You can also schedule one-off tasks that only run once at some point in the future.",buttons:[{text:"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:"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:"right"},title:"Personalize your experience",text:"Now, let's explore the Settings menu to customize Local Operator to your liking.",buttons:[{text:"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:"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:"right"},title:"General settings",text:"Here you can update your user profile and configure model settings (like default hosting provider and model).",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"appearance-settings",attachTo:{element:'[data-tour-tag="settings-appearance-section"]',on:"right"},title:"Customize appearance",text:"Choose from various themes to change the look and feel of Local Operator. Find one that suits your style.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"radient-account-settings",attachTo:{element:'[data-tour-tag="settings-radient-account-section"]',on:"right"},title:"Radient account",text:"Connect your Radient account to access your Radient Pass details, credits, and unlock unified access to models and tools. Radient is the best way to use Local Operator since it powers the AI models, web search, image generation, and much more with a single integration. You get free credits when you sign up to try it out and bonus credits when you top up.<br /><br />When you sign in for the first time, it will automatically create a Radient Pass for you and save it securely to your computer. This will power your Local Operator agents with Radient Automatic, which mixes and matches AI models to get you the best balance of speed, accuracy, and cost in every step of your agents' workflows.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"integrations-settings",attachTo:{element:'[data-tour-tag="settings-integrations-section"]',on:"right"},title:"Connect your services",text:"Enhance your agents' capabilities by connecting your Google services like Gmail, Calendar, and Drive. This allows agents to access and manage your information with your permission.<br /><br />You need to be logged in to a Radient account to use this feature, however it is free to use and doesn't cost any additional Radient credits per action.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"application-updates-settings",attachTo:{element:'[data-tour-tag="settings-app-updates-section"]',on:"right"},title:"Stay up to date",text:"Check for updates to Local Operator here to ensure you have the latest features and improvements. You can see your current version information below.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"tour-complete",title:"Tour complete",text:"You've now seen the main features of Local Operator. Feel free to explore further and discover all the ways your AI agents can assist you. Happy automating.",buttons:[{text:"Finish",classes:"shepherd-button-primary",action:function(){this.complete()}}]}],mXe=()=>{const e=Xr(),{completeTourOnboarding:t}=gm(),n=g.useContext(qC),s={cancelIcon:{enabled:!0},scrollTo:{behavior:"smooth",block:"center"}},r=!0;return{startTour:a=>{if(n?.tour?.isActive()&&!a?.forceModalCompleted){console.log("Onboarding tour is already active (from context.tour). Not starting another.");return}const o=gm.getState();if(!a?.forceModalCompleted&&!o.isModalComplete){console.log("Onboarding modal not completed (checked via store). Tour will not start.");return}if(o.isTourComplete&&!a?.forceModalCompleted){console.log("Onboarding tour already completed in store and not forced. Not starting again.");return}let l=n?.tour;const u=n?.Shepherd;if(!l&&u&&(l=u.activeTour,!l&&u.Tour&&(console.log("No active Shepherd tour found from context or global. Creating a new one."),l=new u.Tour({useModalOverlay:r,defaultStepOptions:s}))),!l){console.warn("Failed to get or create a Shepherd tour instance.",n);return}if(l.isActive()){console.log("Tour is already active. Not starting again.");return}if(l.options.defaultStepOptions={...l.options.defaultStepOptions||{},...s},l.options.useModalOverlay=r,a?.firstAgentId&&(l.options.firstAgentId=a.firstAgentId),l.off("complete",t),l.on("complete",t),l.off("cancel",t),l.on("cancel",t),a?.forceModalCompleted||!l.isActive()){const d=[...l.steps];for(const h of d)h.id&&l.removeStep(h.id);l.addSteps(G3)}else l.steps.length===0&&l.addSteps(G3);typeof l.start=="function"?(e("/"),l.start()):console.warn("Shepherd tour instance does not have a start method.",l)}}},vXe=()=>{const{isModalComplete:e,isTourComplete:t}=gm(),{startTour:n}=mXe(),s=Ve.useContext(qC),{data:r}=jE(1,1);return g.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},xXe=({children:e})=>c.jsxs(aXe,{children:[e,c.jsx(vXe,{})]}),bXe=()=>{const{open:e,focusGroup:t,providerId:n,closeConnect:s}=nB(),r=g.useRef(null);g.useEffect(()=>{e&&(r.current=document.activeElement instanceof HTMLElement?document.activeElement:null)},[e]);const i=Xr();return c.jsx(Yc,{open:e,onOpenChange:a=>{a||s()},children:c.jsxs(Xc,{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(Al,{className:"text-title",children:"Connect a model provider"}),c.jsx(Od,{className:"text-body-sm text-ink-muted",children:"Your agents need a model to think with. Sign in with an account you already have, or add an API key."})]}),e?c.jsx(gV,{context:"dialog",featuredOnly:!0,focusGroup:t,initialProviderId:n,onDone:s,onChangeModel:()=>{s(),i("/settings")}}):null]})})},wXe=({title:e,description:t,icon:n,children:s,titleComponent:r,sectionRef:i,dataTourTag:a,className:o,id:l})=>c.jsxs("div",{ref:i,id:l,tabIndex:l?-1:void 0,"data-tour-tag":a,className:_("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})]}),xZe=({label:e,value:t,className:n,valueClassName:s})=>c.jsxs("div",{className:_("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:_("mt-0.5 break-words text-body-sm",s??"text-ink"),children:t})]}),bZe=({children:e,className:t})=>c.jsx("div",{className:_("grid grid-cols-[repeat(auto-fit,minmax(160px,1fr))] gap-x-6 gap-y-4",t),children:e});async function LV(e){await Ct({op:"settings.edit",key:Fo,value:e.value}),mQ(e.queryClient)}async function CXe(e){await LV(e),e.queryClient.setQueryData(eb.all,t=>t&&{...t,settings:t.settings.map(n=>n.key===Fo?{...n,value:e.value,is_default:e.value===n.default}:n)});try{return await e.queryClient.fetchQuery({queryKey:eb.all,queryFn:()=>Ct({op:"settings.list"}),staleTime:0,retry:!1}),"confirmed"}catch{return"readback-unknown"}}const wZe=({focus:e=!1})=>{const t=nn(),n=zn(),s=Et(n.data,"settings"),r=fs({queryKey:eb.all,queryFn:()=>Ct({op:"settings.list"}),enabled:s,retry:!1,refetchOnReconnect:!0}),i=r.data?.settings.find(F=>F.key===Fo),[a,o]=g.useState(!1),[l,u]=g.useState(null),[d,h]=g.useState(!1),[f,p]=g.useState(!1),m=g.useRef(!1),v=g.useRef(null),x=g.useRef(!1);g.useEffect(()=>{if(!e){x.current=!1;return}!i||x.current||(v.current?.querySelector("[role=combobox]")?.focus(),x.current=!0)},[e,i]),g.useEffect(()=>{r.isSuccess&&!r.isFetching&&h(!1)},[r.isFetching,r.isSuccess]);const b=async F=>{if(!(!i||m.current||d||!i.choices.some(R=>R.value===F))){m.current=!0,o(!0),u(null),p(!1);try{const R=await CXe({value:F,queryClient:t});h(R==="readback-unknown"),p(R==="confirmed")}catch(R){u({value:F,message:R instanceof Error?R.message:""})}finally{m.current=!1,o(!1)}}},w=async()=>{const[F,R]=await Promise.all([r.refetch(),n.refetch()]);!F.isError&&!R.isError&&h(!1)},C=!r.data&&r.error||!n.data&&n.error,k=n.data&&(!s||r.data&&!i),y=!C&&!k&&!i,E=n.data?.features?.i18n?n.data.language:void 0,T=typeof E=="string"&&E!==""?E:void 0;return c.jsx(wXe,{title:Z("ui.settings.language.dialog.title"),icon:$6,description:Z("ui.settings.language.general.description"),children:c.jsxs("div",{ref:v,"data-setting-key":Fo,className:"flex flex-col gap-3","aria-busy":a,children:[y&&c.jsx("output",{className:"text-meta text-ink-dim",children:Z("ui.settings.language.dialog.loading")}),k&&c.jsx("p",{className:"text-meta text-ink-dim",children:Z("ui.settings.language.dialog.unavailable")}),i&&c.jsx(uB,{setting:{...J_(i),label:Z("ui.settings.language.dialog.title")},value:String(i.value),onValueChange:F=>{b(F)},disabled:a||d,suppressEffectiveNote:!0}),c.jsx("output",{id:pQ(Fo),"aria-live":"polite",className:"text-meta text-ink-dim",children:a?Z("ui.settings.language.general.pending"):f?Z("ui.settings.language.general.saved"):T?Z(d||n.error?"ui.settings.language.general.last_known":"ui.settings.language.general.effective",{locale:gQ(T)?.name??T}):Z("ui.settings.language.general.no_resolution")}),(C||l||d)&&c.jsx(zr,{variant:"danger",children:c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("p",{role:"alert",children:l?Z("ui.settings.language.general.write_error",{message:l.message}):d?Z("ui.settings.language.general.readback_error"):Z("ui.settings.language.dialog.unavailable")}),c.jsx(ae,{variant:"outline",size:"sm",disabled:a||r.isFetching||n.isFetching,onClick:()=>{l?b(l.value):w()},children:Z("ui.settings.language.dialog.retry")})]})})]})})},yXe=()=>{const e=x_(ee=>ee.open),t=x_(ee=>ee.closeLanguage),n=nn(),s=zn(),r=Et(s.data,"settings"),i=fs({queryKey:eb.all,queryFn:()=>Ct({op:"settings.list"}),enabled:e&&r,staleTime:1e4}),a=g.useRef(null),o=vQ(),l=(i.data?.settings??[]).find(ee=>ee.key===Fo),u=l?J_(l):void 0,[d,h]=g.useState(null),[f,p]=g.useState(!1),[m,v]=g.useState(!1),[x,b]=g.useState(null),w=g.useRef(null);g.useEffect(()=>{e&&h(null)},[e]),g.useEffect(()=>{if(!e||!u)return;const ee=String(u.value??"");(d===null||d===w.current)&&h(ee),w.current=ee},[e,u,d]),g.useEffect(()=>{e&&(v(!1),b(null))},[e]);const C=d??String(u?.value??""),k=!!u&&C!==String(u?.value??""),y=!u||!k||f,E=async()=>{if(!(!u||!k)){p(!0),b(null);try{await LV({value:C,queryClient:n}),v(!0),h(null),await i.refetch()}catch(ee){b(ee instanceof Error?ee.message:"The language could not be saved.")}finally{p(!1)}}},T=!!s.data,F=T&&!r,R=s.error&&!s.data?s.error:null,I=R??i.error,N=!T&&!I,{sentence:D,remedy:O}=xQ(o??null,"Your settings could not be loaded.",I),G=s.isFetching||i.isFetching,B=u?"combo":I?"retry":"none";return g.useEffect(()=>{!e||B==="none"||requestAnimationFrame(()=>{a.current?.querySelector(B==="combo"?'[role="combobox"]':"[data-language-retry]")?.focus()})},[e,B]),c.jsx(Yc,{open:e,onOpenChange:ee=>!ee&&t(),children:c.jsxs(Xc,{ref:a,onOpenAutoFocus:ee=>ee.preventDefault(),className:"max-w-[min(28rem,calc(100vw-4rem))] gap-4",children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx(Al,{className:"text-title",children:Z("ui.settings.language.dialog.title")}),c.jsx(Od,{className:"text-body-sm text-ink-muted",children:Z("ui.settings.language.dialog.description")})]}),N?c.jsxs("div",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[c.jsx(vn,{}),Z("ui.settings.language.dialog.loading")]}):F?c.jsx(zr,{variant:"warning",children:c.jsx("span",{children:Z("ui.settings.language.dialog.unavailable")})}):I?c.jsx(zr,{variant:"warning",children:c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("span",{children:D}),O&&c.jsx(ae,{variant:"secondary",size:"sm",className:"shrink-0","data-language-retry":"",onClick:()=>{R?s.refetch():i.refetch()},disabled:G,children:G?Z("ui.settings.language.dialog.retrying"):Z("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(vn,{}),Z("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:lF(Fo),className:"text-meta text-ink-dim",children:u.help}),c.jsx(uB,{setting:u,value:C,disabled:f,helpId:lF(Fo),effectiveNoteId:bQ(Fo,wQ),onValueChange:ee=>{v(!1),h(ee)}})]}),x&&c.jsx("p",{className:"text-meta text-danger",children:x}),c.jsx("div",{className:"flex min-h-8 items-center justify-end",children:m&&!k?c.jsxs("output",{"data-language-save":"",className:"inline-flex items-center gap-1.5 text-body-sm text-ink",children:[c.jsx(Ms,{"aria-hidden":"true",className:"size-3.5"}),Z("ui.settings.language.dialog.saved")]}):c.jsx(ae,{onClick:E,disabled:y,"data-language-save":"",children:f?`${Z("ui.settings.language.dialog.save")}...`:Z("ui.settings.language.dialog.save")})})]}):c.jsx(zr,{variant:"warning",children:c.jsx("span",{children:Z("ui.settings.language.dialog.unavailable")})})]})})};function SXe(){const{data:e}=zn();g.useEffect(()=>{e&&tZ(e)},[e]);const t=K_(),n=nn(),s=g.useRef(null);g.useEffect(()=>{const r=t.configChange;if(!r)return;const i=`${r.epoch}:${r.seq}`;s.current!==i&&r.changedKeys.includes(Fo)&&(s.current=i,n.invalidateQueries({queryKey:Ho.capabilities}),n.invalidateQueries({queryKey:Ho.settings}),!CQ()&&za(Z("ui.settings.language.external_notice",{language:r.language}),{id:"i18n-language-external"}))},[t.configChange,n])}function EXe(e,t){if(e.defaultPrevented||e.repeat||e.isComposing||!(e.metaKey||e.ctrlKey))return null;const n=yQ(e);if(n===null)return null;const s=nZ(t.bindings).get(n);return s===void 0||Y_(e.target)||!Ace(BV(s),t.route)?null:s}const BV=e=>e.slice(6);function kXe(e){const t=Ee.getState(),n=t.activeDraftKey?t.drafts[t.activeDraftKey]:void 0,s=Jf(t.activeDraftKey,n?.sessionId,t.activeSessionId)??null;Pu(BV(e),{sessionId:s,askScope:s===null?"fleet":"session"})}function _Xe(){g.useEffect(()=>{const e=t=>{const n=qe.getState(),s=EXe(t,{bindings:n.shortcutBindings,route:n.rightSlotRoute});s!==null&&(t.preventDefault(),kXe(s))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[])}const TXe=""+new URL("radient-icon-1024x1024-D_JJedvo.png",import.meta.url).href,jV=A0()(sZ(e=>({hasBeenNotified:!1,setHasBeenNotified:t=>{e({hasBeenNotified:t})}}),{name:"low-credits-storage"})),RXe=({open:e,onClose:t,onGoToConsole:n})=>{const{setHasBeenNotified:s}=jV(),{prices:r,isLoading:i,error:a}=SQ(),o=d=>typeof d!="number"?"$...":`$${d.toFixed(2)} USD`,l=()=>{s(!0),t()},u=()=>{s(!0),n()};return c.jsx(Kc,{open:e,onClose:l,title:c.jsxs(c.Fragment,{children:[c.jsx("img",{src:TXe,alt:"Radient icon",className:"size-7"}),"Running low on Radient credits?"]}),maxWidth:"sm",fullWidth:!1,actions:c.jsxs(c.Fragment,{children:[c.jsx(x0,{onClick:l,children:"Maybe later"}),c.jsx(b0,{onClick:u,startIcon:c.jsx(vl,{size:18}),className:"min-w-55",children:"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:["Unlock the full power of Local Operator with"," ",c.jsx("span",{className:"font-bold text-accent",children:"Radient Pass"}),"."]}),c.jsx("p",{className:"text-body-sm text-ink-muted",children:"Radient Automatic is often cheaper than bringing your own key: its smart model routing picks the most cost-effective model for each step of your agentic workflows."}),c.jsx("p",{className:"text-body-sm text-ink-muted",children:"It's pay-as-you-go with no commitments. Load up what you need, starting small for maximum flexibility."}),c.jsxs("p",{className:"text-body-sm text-ink-muted",children:["Plus, get"," ",c.jsx("span",{className:"font-medium text-ink",children:i?c.jsx(vn,{size:"sm",className:"mr-0.5 align-middle"}):o(r?.default_registration_credits)})," ","in bonus credits with your first purchase.",a&&c.jsx("span",{className:"mt-1 block text-meta text-danger",children:"Could not load bonus credit information."})]}),c.jsx("p",{className:"text-meta text-ink-dim",children:"You can also reach the Radient Console from Settings at any time."})]})})},AXe=(e,t)=>t?LS(e.filter(n=>n.session_id===t)).length:0;function FXe(e){return Ee(t=>AXe(t.sessions,e))}const DXe=(e,t)=>t?e.some(n=>n.session_id===t&&n.status?.code==="busy"):!1;function PXe(e){return Ee(t=>DXe(t.sessions,e))}const IXe=[];function NXe(){const{state:e}=oC(),t=e?.pendingConsent??IXe,n=Ij(s=>FP(t,s));return g.useEffect(()=>{t.length>0&&FT()},[t]),FP(t,n)}const HV={approvals:["desktop","mesh","approvals"]},MXe=15e3,OXe=new Set(["requested","approved","connecting","failed"]);function LXe(e){return OXe.has(e)}function BXe(e){return e==="requested"}function jXe(e){return e.filter(t=>BXe(t.state)).length}function CZe(e){return e==="requested"}function yZe(e){return LXe(e)}function SZe(e){switch(e){case"requested":return"Waiting for you";case"approved":return"Approved";case"connecting":return"Connecting…";case"connected":return"Connected";case"denied":return"Denied";case"expired":return"Expired";case"failed":return"Failed";default:return e}}function Wu(e){return typeof e=="object"&&e!==null}function HXe(e){const t=Wu(e)?e:{};return{deviceId:Ft(t.device_id),name:Ft(t.name),host:Ft(t.host),user:Ft(t.user),transport:Ft(t.transport),hostKeyFp:Ft(t.host_key_fp)}}function UXe(e){const t=Wu(e)?e:{};return{connect:Lo(t.connect,!1),install:Lo(t.install,!1),anchor:Wu(t.anchor),networkId:Ft(t.network_id),role:Ft(t.role),unattended:Lo(t.unattended,!1),grants:Df(t.grant)}}function GXe(e){const t=Array.isArray(e)?e:e?.approvals??[];if(!Array.isArray(t))return[];const n=[];for(const s of t){if(!Wu(s))continue;const r=Ft(s.approval_id),i=Ft(s.state);if(!r||!i)continue;const a=!Wu(s.device)&&Wu(s.machine)?"machine":"device",o=Wu(s.requested_by)?s.requested_by:{};n.push({approvalId:r,state:i,kind:a,where:HXe(a==="machine"?s.machine:s.device),what:UXe(s.what),requestedBy:{surface:Ft(o.surface),sessionId:Ft(o.session_id),deviceId:Ft(o.device_id)},expiresAt:Ec(s.expires_at)})}return n}function $Xe(e){return e.kind==="machine"?"this machine":n5({device_id:e.where.deviceId,name:e.where.name})}function EZe(e,t){const n=VXe(e),s=zXe(e,t).map(r=>r.clause);return s.length?`${n}: ${WXe(s)}.`:`${n}.`}function VXe(e){return e.kind==="machine"?"Set up operator authority on this machine":`Onboard ${$Xe(e)}`}function WXe(e){return e.length===1?e[0]:`${e.slice(0,-1).join(", ")}; ${e[e.length-1]}`}function kZe(e){const{user:t,host:n,transport:s,name:r}=e.where,i=[n?t?`${t}@${n}`:n:"",s?`via ${s}`:"",r&&r!==n?`(${r})`:""].filter(Boolean);return i.length?i.join(" "):null}function _Ze(e){return e.where.hostKeyFp||null}function TZe(e){const{surface:t,sessionId:n}=e.requestedBy,s=[t||"",n?`session ${n.slice(-6)}`:""].filter(Boolean);return s.length?`asked by ${s.join(" · ")}`:null}function zXe(e,t){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?`connect over ${e.where.transport}`:"connect to it",consequence:e.where.transport?`this machine may connect to it over ${e.where.transport}`:"this machine may connect to it"}),s&&u.push({term:"install",clause:e.kind==="machine"?"install Local Operator":"install Local Operator there",consequence:e.kind==="machine"?"Local Operator is installed on this machine":"Local Operator is installed on it"}),r&&u.push({term:"install operator anchor",clause:"check approvals signed on your machines",consequence:"that device can check approvals signed on your machines; nothing there can sign"}),i){const d=t?.get(i),h=`join ${d||i} as ${a||"?"}`;u.push({term:h,clause:h,consequence:`it joins ${d||i} as ${a||"?"}`})}o&&u.push({term:"trust unattended sessions",clause:"run sessions there without an approval prompt",consequence:"sessions you start on that device run without an approval prompt there"});for(const d of qXe(l,o)){const h=KXe[d];u.push({term:h?.term??`grant ${d}`,clause:YXe[d]??`use the ${d} capability`,consequence:h?.gloss??`you may ${d} on that device`})}return u}function qXe(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 KXe={unattended:{term:"trust unattended sessions",gloss:"sessions you start on that device run without an approval prompt there"},broker_credential:{term:"borrow logins there",gloss:"your sessions may use the logins stored on that device"}},YXe={list:"see its sessions",view:"watch a session there",prompt:"send prompts to a session there",steer:"steer a running turn there",stop:"stop a session there",slash:"run slash commands there",delete:"archive or delete a session there",move:"move sessions to or from there",broker_credential:"borrow the logins stored there",approve:"answer approval prompts there",unattended:"run sessions there without an approval prompt"};function RZe(e,t){if(e===null||e<=0)return null;const n=e-t;if(n<=0)return null;if(n<60)return"expires in under a minute";const s=Math.ceil(n/60);if(s<90)return s===1?"expires in 1 minute":`expires in ${s} minutes`;const r=Math.ceil(s/60);return r===1?"expires in 1 hour":`expires in ${r} hours`}function XXe(e,{poll:t=!0}={}){return fs({queryKey:HV.approvals,enabled:e,queryFn:async()=>GXe(await Ct({op:"approvals.list"})),retry:!1,staleTime:t?1e4:Number.POSITIVE_INFINITY,refetchInterval:e&&t?MXe:!1,refetchOnWindowFocus:t})}function AZe(){const e=nn();return Kn({mutationFn:async t=>{const n=t.decision==="approve"?{op:"approvals.approve",approvalId:t.approvalId}:{op:"approvals.deny",approvalId:t.approvalId};await Ct(n)},onSettled:()=>{e.invalidateQueries({queryKey:HV.approvals}),e.invalidateQueries({queryKey:Pl.networks}),e.invalidateQueries({queryKey:Pl.peers})}})}function FZe(e){const t=e?.message;return typeof t=="string"&&t.trim()?t.trim():"The approvals could not be read."}function DZe(e){const t=e;return{code:Ft(t?.code)||"approval_refused",sentence:Ft(t?.message)||"The decision could not be answered."}}const $3=e=>{const t=_Q(e.type),n=typeof e.percent=="number"?`, ${Math.round(e.percent)}%`:"";return`${t} in progress${n}.`},UV=e=>kQ({type:e.type,version:e.offer.version}),QXe=e=>`${e.map(s=>UV(s)).map((s,r)=>r===0?s:`${s.charAt(0).toLowerCase()}${s.slice(1)}`).join(" and ")} available. Show the update notice.`,JXe=({surfaces:e,inflight:t,onShow:n,onDismiss:s})=>{if(t===null&&e.length===0)return null;if(t!==null)return c.jsx(nt,{side:"top",collisionPadding:8,content:$3(t),children:c.jsx("output",{"data-update-foot-icon":"","data-update-foot-icon-state":"inflight","aria-label":$3(t),className:"flex size-8 shrink-0 items-center justify-center text-accent",children:c.jsx(ji,{className:"size-4 shrink-0 motion-safe:animate-spin","aria-hidden":"true"})})});const r=e.find(i=>(i.offer.summary??"").trim()!=="");return c.jsx(nt,{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:[UV(i)," available"]},i.type)),r?c.jsx("span",{className:"truncate text-ink-muted",children:(r.offer.summary??"").trim()}):null,c.jsx("span",{className:"whitespace-nowrap text-ink-muted",children:"Show the update notice."})]}),children:c.jsx("button",{type:"button","data-update-foot-icon":"","data-update-foot-icon-state":"available","aria-label":QXe(e),onClick:n,onKeyDown:i=>{i.key!=="Escape"||!s||(i.stopPropagation(),s())},className:_("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(z_,{className:"size-4 shrink-0","aria-hidden":"true"})})})},V3=()=>{const e=Xs(p=>p.followed),t=Xs(p=>p.running),n=Xs(p=>p.offers),s=Xs(p=>p.detailOpen),r=Xs(p=>p.inflight),i=Xs(p=>p.downloadPercent),a=Xs(p=>p.openNotice),o=Xs(p=>p.noticeOpen),l=Xs(p=>p.dismissNotice),u=g.useMemo(()=>{const p={followed:e,running:t,offers:n,detailOpen:s};return t4.filter(m=>EQ(p,m)).map(m=>{const v=n[m];return v?{type:m,offer:v}:null}).filter(m=>m!==null)},[e,t,n,s]),d=g.useMemo(()=>r[on.BACKEND]?{type:on.BACKEND,percent:null}:r[on.UI]?{type:on.UI,percent:i[on.UI]}:null,[r,i]),h=g.useCallback(()=>a(),[a]),f=g.useCallback(()=>l(),[l]);return c.jsx(JXe,{surfaces:u,inflight:d,onShow:h,onDismiss:o?f:void 0})},W3=({expanded:e})=>c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(TQ,{className:"size-6",label:e?void 0:"Local Operator"}),e&&c.jsx("span",{className:"truncate font-semibold text-body text-ink",children:"Local Operator"})]}),k_=Ve.memo(({expanded:e,useAuth:t=!1})=>{const n=Xr(),{user:s,isAuthenticated:r,accountRead:i,signOut:a}=dB(),o=i==="checking"?"Checking account…":cF(i)?"Account unavailable":null,l=s?.name??o??"User",u=cF(i),d=s?.email??"",h=u?"Reconnect Radient":d,f=u?"/settings?section=providers&provider=radient":"/settings",p=u?"Reconnect Radient":"Account settings",m=g.useCallback(async()=>{r&&(await a(),window.location.reload())},[r,a]),v=g.useMemo(()=>{const w=s?.name;return w?w.split(" ").map(C=>C.charAt(0)).join("").toUpperCase().substring(0,2):null},[s?.name]),x=c.jsxs("button",{type:"button",onClick:t?void 0:()=>n(f),"aria-label":e?void 0:p,className:_("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.jsx(wB,{className:"size-7 shrink-0",children:c.jsx(CB,{className:"border border-control bg-elevated text-ink",children:v??c.jsx(rre,{size:14,"aria-hidden":"true"})})}),e&&l&&c.jsxs("span",{className:"min-w-0 text-left",children:[c.jsx("span",{className:"block truncate text-body-sm text-ink",children:l}),h&&c.jsx("span",{className:_("block truncate text-meta",u?"text-accent":"text-ink-dim"),children:h})]})]}),b=e?x:c.jsx(nt,{content:p,side:"right",children:x});return t?c.jsxs(Fl,{children:[e?c.jsx(Uo,{asChild:!0,children:x}):c.jsx(nt,{content:p,side:"right",children:c.jsx(Uo,{asChild:!0,children:x})}),c.jsxs(Dl,{align:"end",side:"top",className:"min-w-50",children:[u?c.jsxs(Ut,{onSelect:()=>n(f),children:[c.jsx(mB,{size:16,"aria-hidden":"true"}),"Reconnect Radient"]}):null,c.jsxs(Ut,{onSelect:()=>n("/settings"),children:[c.jsx(Sc,{size:16,"aria-hidden":"true"}),"Settings"]}),c.jsxs(Ut,{children:[c.jsx(_se,{size:16,"aria-hidden":"true"}),"Privacy and security"]}),c.jsx(qr,{}),c.jsxs(Ut,{onSelect:m,className:"text-danger focus:bg-danger-wash focus:text-danger",children:[c.jsx(Kne,{size:16,"aria-hidden":"true"}),"Sign out"]})]})]}):b});k_.displayName="UserProfileSidebar";const ZXe=()=>{const e=K_(),t=zn(),n=Ee(o=>o.setCataloguePageable),s=Ee(o=>o.fetchSessions),r=Et(t.data,"session_catalogue_page");g.useEffect(()=>{n(r)},[r,n]);const i=Ja(t.data,"session_catalogue",2)==="enabled",a=g.useCallback(()=>s(r?B4:Mw,r),[s,r]);return g.useEffect(()=>{i&&a()},[i,a,e.catalogueRevision]),null},eQe="flex h-[30px] w-full items-center gap-2 rounded-md px-2 text-body-sm transition-colors duration-fast ease-out-quart",tQe=()=>{const e=Xr(),t=sae(),{expanded:n,mode:s,onCollapse:r}=RQ(),i=qe(oe=>oe.openCommandPalette),a=zn(),o=Ee(oe=>oe.activeSessionId),l=NXe(),u=Ja(a.data,"peers")==="enabled",d=jT(u),h=Ja(a.data,"approvals")==="enabled",f=XXe(d==="member"&&h,{poll:!0}),p=jXe(f.data??[]),m=Et(a.data,"projects",1),v=Et(a.data,"aida",1),x=I0(v),b=v&&x.data?.enabled===!0,w=x.data?.name??"Aida",C=poe(),k=FXe(x.data?.session_id),y=PXe(x.data?.session_id),E=()=>{C(e,x.data).catch(oe=>zt(Sh(oe)))},T=[...b?[{icon:nne,label:w,path:"/chat",isActive:t==="chat"&&!!x.data?.session_id&&o===x.data?.session_id,tourTag:"nav-item-aida",onSelect:E,attention:k,attentionTag:"nav-aida-badge",attentionName:oe=>`${w}, ${oe} missed message${oe===1?"":"s"}`,working:y,workingName:`${w}, working`}]:[],{icon:Bc,label:"Agents",path:"/agents",isActive:t==="agents",tourTag:"nav-item-agents"},...m?[{icon:G6,label:"Projects",path:"/projects",isActive:t==="projects",tourTag:"nav-item-projects"}]:[],{icon:H6,label:"Schedules",path:"/schedules",isActive:t==="schedules",tourTag:"nav-item-schedules"},{icon:hd,label:"Browser",path:"/browser",isActive:t==="browser",tourTag:"nav-item-browser",attention:l,attentionTag:"nav-browser-badge",attentionName:oe=>`Browser, ${oe} waiting`},{icon:X6,label:"Agent hub",path:"/agent-hub",isActive:t==="agent-hub",tourTag:"nav-item-agent-hub"},...d==="member"?[{icon:tB,label:"Mesh",path:"/mesh",isActive:t==="mesh",tourTag:"nav-item-mesh",attention:p,attentionTag:"nav-mesh-badge",attentionName:oe=>`Mesh, ${oe} waiting`}]:[]],F=c.jsx(fVe,{selectedConversation:o??void 0,onSelectConversation:oe=>void tp(e,oe),onStageDraft:(oe,X)=>{Ee.getState().stageDraft(oe,X),e("/chat")}}),R=oe=>{const X=oe.attention??0,Ce=X>0&&oe.attentionName?oe.attentionName(X):oe.label;return oe.working&&oe.workingName?oe.workingName:Ce},I=oe=>{const X=oe.attention??0,Ce=R(oe),L=oe.isActive?So:"text-ink-muted hover:bg-row-hover hover:text-ink";return c.jsx("li",{className:_("flex h-[30px] w-full items-center rounded-md","transition-colors duration-fast ease-out-quart",L),children:c.jsxs("button",{type:"button",onClick:()=>oe.onSelect?oe.onSelect():e(oe.path),"data-tour-tag":oe.tourTag,"aria-current":oe.isActive?"page":void 0,"aria-label":n&&Ce===oe.label?void 0:Ce,className:_("flex h-full min-w-0 flex-1 items-center gap-2 rounded-md",n?"px-2":"justify-center px-0"),children:[c.jsx(oe.icon,{size:16,"aria-hidden":"true",className:_("shrink-0",oe.isActive&&"text-accent")}),n&&c.jsx("span",{className:"truncate",children:oe.label}),X>0&&c.jsx("span",{className:_(n&&"ml-auto","inline-flex"),children:c.jsx(Lc,{variant:"attentionQuiet",shape:"pill",size:"count","data-tour-tag":oe.attentionTag,children:X})}),oe.working&&c.jsx("span",{className:_(n&&"ml-auto","inline-flex"),children:c.jsx(ji,{size:16,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})})]})},oe.tourTag)},N=oe=>n?I(oe):c.jsx("li",{children:c.jsx(nt,{content:R(oe),side:"right",children:I(oe)})},oe.tourTag),D=s==="overlay"?"Close sidebar":n?"Collapse sidebar":"Expand sidebar",O=s==="overlay"?Nn:n?ud:va,G=navigator.platform.toUpperCase().indexOf("MAC")>=0,B=Et(a.data,"session_catalogue",2),ee=Ee(oe=>oe.activeDraftKey),z=Ee(oe=>oe.drafts),ue=!!ee&&!(ee?z[ee]:void 0)?.target,U=()=>{Ee.getState().stageDraft(void 0,!0),e("/chat")},se=`New chat (${n3(G).replace("+","")})`,le=`Search (${To("everything",G)}) — chats (${To("chats",G)})`,M=`Search everything (${To("everything",G)}) · your chats (${To("chats",G)})`,H=(oe,X,Ce,L)=>{const be=oe;return c.jsxs("button",{type:"button",...L.attrs,onClick:L.onClick,disabled:L.disabled,"aria-label":L.ariaLabel,"aria-current":L.current?"page":void 0,className:_(eQe,L.current?So:"text-ink-muted hover:bg-row-hover hover:text-ink","disabled:text-ink-disabled disabled:hover:bg-transparent"),children:[c.jsx(be,{size:16,"aria-hidden":"true",className:"shrink-0"}),c.jsx("span",{className:"truncate",children:X}),c.jsx("span",{"aria-hidden":"true",className:"ml-auto",children:c.jsx(wr,{shortcut:Ce,joined:!0})})]})},A=H(BE,"New chat",n3(G),{onClick:U,ariaLabel:se,current:ue,disabled:!B,attrs:{"data-tour-tag":"nav-item-chat","data-new-chat-row":""}}),V=H(fd,"Search",Sze("everything",G),{onClick:i,ariaLabel:le,attrs:{"data-command-palette-trigger":"",title:M}}),J=(oe,X,Ce)=>{const L=oe;return c.jsx(nt,{content:X,side:"right",children:c.jsx("button",{type:"button",...Ce.attrs,onClick:Ce.onClick,disabled:Ce.disabled,"aria-label":X,className:_("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.jsx(L,{size:16,"aria-hidden":"true"})})})},fe=c.jsx("div",{className:_(s!=="overlay"&&_("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(nt,{content:D,side:"right",children:c.jsx(ae,{variant:"ghost",size:"icon-sm",onClick:r,"aria-label":D,"aria-expanded":s==="overlay"?void 0:n,"aria-keyshortcuts":NF(G),children:c.jsx(O,{"aria-hidden":"true"})})})}),ce=c.jsx(nt,{content:"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":"Settings",className:_("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(Sc,{size:16,"aria-hidden":"true"})})});return n?c.jsxs("div",{"data-sidebar-shell":"",className:"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 pr-2 pl-4",children:[c.jsx(W3,{expanded:!0}),c.jsx("span",{className:"ml-auto",children:fe})]}),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:[A,V]}),c.jsx("ul",{className:"flex flex-col gap-0.5",children:T.map(N)})]}),c.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:F}),c.jsxs("div",{className:"flex min-h-10 shrink-0 items-center justify-between gap-1 px-2 pb-2",children:[c.jsx(k_,{expanded:!0}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(V3,{}),ce]})]})]}):c.jsxs("div",{"data-sidebar-strip":"",className:"group/sidebar flex h-full min-h-0 flex-col items-center bg-surface",children:[c.jsx(ZXe,{}),c.jsx("div",{className:"flex h-10 shrink-0 items-center justify-center",children:c.jsx(W3,{expanded:!1})}),c.jsxs("ul",{className:"flex flex-col items-center gap-1",children:[c.jsx("li",{children:J(va,D,{onClick:r,attrs:{"aria-expanded":!1,"aria-keyshortcuts":NF(G)}})}),c.jsx("li",{children:J(BE,se,{onClick:U,disabled:!B,attrs:{"data-tour-tag":"nav-item-chat"}})}),c.jsx("li",{children:J(fd,le,{onClick:i,attrs:{"data-command-palette-trigger":""}})})]}),c.jsx("ul",{className:"mt-4 flex flex-col items-center gap-1",children:T.map(N)}),c.jsxs("div",{className:"mt-auto flex flex-col items-center gap-1 pb-2",children:[c.jsx(V3,{}),ce,c.jsx(k_,{expanded:!1})]})]})},nQe=1,sQe=()=>{const{isAuthenticated:e,user:t}=dB(),{hasBeenNotified:n,setHasBeenNotified:s}=jV(),[r,i]=g.useState(!1),[a,o]=g.useState(null),l=g.useCallback(async()=>{if(!(!e||!t?.radientUser?.account?.tenant_id))try{const f=await AQ({operation:"credits",tenantId:t.radientUser.account.tenant_id});if(!f||typeof f.balance!="number")throw new Error("Invalid credit balance response format");o(f.balance)}catch(f){console.error("Failed to fetch Radient credits:",f),o(null)}},[e,t?.radientUser?.account?.tenant_id]);return g.useEffect(()=>{e&&l()},[e,l]),g.useEffect(()=>{e&&a!==null?a<nQe?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 rQe(){const e=Xr();g.useEffect(()=>{const t=r=>{e(r==="back"?-1:1)},n=r=>{const i=uhe(r);i&&(r.preventDefault(),t(i))},s=r=>{const i=dhe(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 iQe(){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 aQe(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 oQe(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 lQe(){g.useLayoutEffect(()=>{if(!window.api?.windowChrome)return;const t=document.documentElement.dataset.chromePlatform??"linux",n=()=>aQe(iQe(),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)}},[]),g.useEffect(()=>{const e=window.api?.windowChrome;if(e)return e.onState(t=>{document.documentElement.dataset.chromeFullscreen=t.fullScreen?"true":"false"})},[])}const cQe=g.lazy(()=>jl(()=>import("./agent-details-page-C0GdJMfq.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]),import.meta.url).then(e=>({default:e.AgentDetailsPage}))),uQe=g.lazy(()=>jl(()=>import("./agent-hub-page-C6ze_xjQ.js"),__vite__mapDeps([14,1,2,4,5,6,7,15,3,8,9,10,11,16,17,18,19,12,13]),import.meta.url).then(e=>({default:e.AgentHubPage}))),z3=g.lazy(()=>jl(()=>import("./agents-page-DSNLtN_J.js"),__vite__mapDeps([20,4,5,1,2,6,7,8,16,12,13]),import.meta.url).then(e=>({default:e.AgentsPage}))),dQe=g.lazy(()=>jl(()=>import("./schedules-page-CiSL5P8q.js"),__vite__mapDeps([21,1,2,4,5,6,7,15,18,10,22,12,13]),import.meta.url).then(e=>({default:e.SchedulesPage}))),q3=g.lazy(()=>jl(()=>import("./projects-page-CGRUr8ls.js"),__vite__mapDeps([23,1,2,4,5,6,7,15,24,12,13]),import.meta.url).then(e=>({default:e.ProjectsPage}))),hQe=g.lazy(()=>jl(()=>import("./browser-page-Hj-3V4SP.js"),__vite__mapDeps([25,1,2,4,5,6,7,12,13]),import.meta.url).then(e=>({default:e.BrowserPage}))),fQe=g.lazy(()=>jl(()=>import("./mesh-page-Dys9-2sY.js"),__vite__mapDeps([26,1,2,4,5,6,7,15,12,13]),import.meta.url).then(e=>({default:e.MeshPage}))),pQe=g.lazy(()=>jl(()=>import("./settings-page-C11l7qyA.js"),__vite__mapDeps([27,1,2,4,5,6,7,15,17,28,11,22,10,18,12,13]),import.meta.url).then(e=>({default:e.SettingsPage}))),gQe=g.lazy(()=>jl(()=>import("./browser-webauthn-prompt-4jHz_1RY.js"),__vite__mapDeps([29,1,2,4,5,6,7]),import.meta.url).then(e=>({default:e.BrowserWebauthnPrompt}))),mQe=()=>{lQe(),SXe();const{pathname:e}=q_(),t=e.startsWith("/chat")||e.startsWith("/browser"),{isOnboardingActive:n}=tae(),{isLowCreditsDialogOpen:s,openRadientConsole:r,onLowCreditsDialogClose:i}=sQe(),{isCommandPaletteOpen:a,isCreateAgentDialogOpen:o,isSidebarCollapsed:l,closeCreateAgentDialog:u}=qe();Bu(a,"command-palette"),Bu(o,"create-agent-dialog"),Bu(n,"onboarding"),Bu(s,"low-credits");const d=Xr(),h=zn(),f=Et(h.data,"session_catalogue",2),p=Et(h.data,"session_archive");g.useEffect(()=>{Ee.getState().requestArchiveConfirm(null)},[e]);const m=Ja(h.data,"peers"),v=y=>{Ee.getState().stageDraft({kind:"agent",name:y.name}),d("/chat"),u()};zze(),_Xe(),Fze(),rQe(),Mhe();const x=Ee(y=>y.setActiveSession),b=Ee(y=>{const E=y.activeDraftKey?y.drafts[y.activeDraftKey]:void 0;return Jf(y.activeDraftKey,E?.sessionId,y.activeSessionId)}),w=qe(y=>y.setConsolePaneOpen),C=qe(y=>y.setBrowserPaneOpen),k=qe(y=>y.setConsoleActiveSurface);return g.useEffect(()=>{const y=window.api?.desktop?.onOpenConversation?.((E,T)=>{E!==null&&performance.mark("lop:open:requested"),x(E),T!==void 0&&E!==null&&(k(T),w(!0)),d("/chat")});return()=>y?.()},[d,x,w,k]),g.useEffect(()=>{const y=window.api?.console?.onReveal?.(E=>{E.mode!=="none"&&(E.mode==="session"&&E.session_id!==b||(E.mode==="open"&&x(E.session_id),k(E.surface),w(!0)))});return()=>y?.()},[b,x,w,k]),aoe(),mze(),g.useEffect(()=>{const y=window.api?.browser?.onConsentAttention?.(E=>{const T=Dae(E.requesterSessionId,Ee.getState().sessions);if(Rae(E.entryId),T.kind==="browser"){d("/browser");return}x(T.sessionId),C(!0),d("/chat")});return()=>y?.()},[d,x,C]),g.useEffect(()=>{const y=E=>{n||f&&xze(E)&&(E.preventDefault(),Ee.getState().stageDraft(void 0,!0),d("/chat"))};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[f,n,d]),c.jsx(xXe,{children:c.jsx("div",{className:"relative flex h-screen flex-col overflow-hidden","data-titlebar-sidebar-collapsed":l?"true":"false",children:c.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[a&&c.jsx(Gze,{}),c.jsx(bze,{}),c.jsx(FQ,{}),c.jsx(qze,{enabled:m==="enabled"}),c.jsx(Uqe,{open:n}),c.jsx(bXe,{}),c.jsx(yXe,{}),p&&c.jsx(uoe,{}),c.jsx(_ae,{}),c.jsx(g.Suspense,{fallback:null,children:c.jsx(gQe,{})}),c.jsx(RXe,{open:s,onClose:i,onGoToConsole:r}),c.jsx(aae,{open:o,onClose:u,onAgentCreated:v}),c.jsx(DQ,{sidebar:c.jsx(tQe,{}),content:c.jsxs("main",{className:"flex grow flex-col overflow-hidden",children:[t?null:c.jsx("div",{"data-chrome-route-band":""}),c.jsx(g.Suspense,{fallback:c.jsx("div",{className:"flex grow items-center justify-center",children:c.jsx(vn,{size:"lg",label:"Loading page"})}),children:c.jsxs(PQ,{children:[c.jsx(ti,{path:"/",element:c.jsx(uF,{to:"/chat",replace:!0})}),c.jsx(ti,{path:"/chat",element:c.jsx(e3,{})}),c.jsx(ti,{path:"/chat/:agentId",element:c.jsx(e3,{})}),c.jsx(ti,{path:"/agents",element:c.jsx(z3,{})}),c.jsx(ti,{path:"/agents/:agentId",element:c.jsx(z3,{})}),c.jsx(ti,{path:"/settings",element:c.jsx(pQe,{})}),c.jsx(ti,{path:"/agent-hub",element:c.jsx(uQe,{})}),c.jsx(ti,{path:"/agent-hub/:agentId",element:c.jsx(cQe,{})}),c.jsx(ti,{path:"/schedules",element:c.jsx(dQe,{})}),c.jsx(ti,{path:"/projects",element:c.jsx(q3,{})}),c.jsx(ti,{path:"/projects/:projectId",element:c.jsx(q3,{})}),c.jsx(ti,{path:"/browser",element:c.jsx(hQe,{})}),m==="enabled"&&c.jsx(ti,{path:"/mesh",element:c.jsx(fQe,{})}),c.jsx(ti,{path:"*",element:c.jsx(uF,{to:"/chat",replace:!0})})]})})]})})]})})})};function Lu(){return new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))})}const vQe=3,xQe=3e3;function bQe(e){return e instanceof CSSTransition&&e.playState==="running"}function wQe(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 ${v0(n)??"an element no longer in the document"} = ${i}`}async function CQe(e=xQe){const t=performance.now();let n=0;for(;;){await Lu();const s=Math.round(performance.now()-t),r=document.getAnimations().filter(bQe);if(n=r.length===0?n+1:0,n>=vQe)return{waitedMs:s,timedOut:!1,pending:[]};if(s>e)return{waitedMs:s,timedOut:!0,pending:r.map(wQe)}}}const yQe=/^#/;function fm(){const e=window.location.hash.replace(yQe,"");return e===""?"/":e}function v0(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 SQe(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=>v0(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:v0(r),stack:a,disabled:e instanceof HTMLButtonElement?e.disabled:null,rect:{x:t.x,y:t.y,width:t.width,height:t.height}}}function lg(e,t){if(typeof e!="string"||e==="")throw new Error(`${t} must be a non-empty string`);return e}async function EQe(e,t=1e4){const n=Date.now();for(;fm()!==e;){if(Date.now()-n>t)throw new Error(`route did not become ${e} (it is ${fm()})`);await new Promise(s=>setTimeout(s,50))}return await Lu(),fm()}const __=["dev-driver","query-fetch-probe"];let pm=null;function kQe(){if(pm)return pm;const e=[],t=dF.prototype.fetch;return dF.prototype.fetch=function(...s){return e.push({at:Date.now(),key:JSON.stringify(this.queryKey),stack:(new Error().stack??"").split(`
|
|
684
|
+
A good description helps you and others understand what the agent does and any special instructions. The descriptions are also used by other agents to help them understand how to tag each other in for certain tasks.<br /><br />If you want this agent to be part of the agent-to-agent communication network, it will need to have a description that captures its purpose and capabilities. Be concise and specific.`,buttons:[{text:"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:"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:"right"},title:"Discover more agents",text:`Let's visit the Agent hub to find community-created agents. Click on the "Agent hub" icon in the navigation bar.`,buttons:[{text:"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:"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:"right"},title:"The Agent hub",text:"Here you can browse agents by category or search for specific ones. These agents are shared by the community and can perform various specialized tasks.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"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:"Download an agent",text:'Find an agent that interests you and click the "Get" button to add it to your local agent list.',buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"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:()=>gXe("upload-to-hub-header-button"),on:"bottom"},title:"Share your agents",text:"If you create a useful agent, you can also share it with the community by uploading it to the Agent hub from the agent options menu.",buttons:[{text:"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:"Next",classes:"shepherd-button-primary",action:function(){U3("open-upload-dialog"),setTimeout(()=>{this.next()},500)}}]},{id:"upload-agent-hub-dialog",attachTo:{element:'[data-tour-tag="upload-agent-dialog"]',on:"right"},title:"Upload agent to hub",text:"This dialog publishes your agent's instruction set to the community. You need a Radient account to publish, which is free to create and costs nothing per agent. You can review the details before confirming. What is published is what describes the agent - its name, description, instructions and tool surface; no conversation, execution history, memory, plan or machine-specific configuration leaves your computer. Make sure your agent meets the required criteria before submitting.",buttons:[{text:"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:"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:"right"},title:"Automate tasks with schedules",text:"Local Operator can run tasks for you on a regular basis. Let's check out the Schedules section.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{U3("open-upload-dialog")},500),setTimeout(()=>{this.back()},1e3)}},{text:"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:"Proactive agents with schedules",text:"A powerful feature of Local Operator is the ability to ask agents to perform tasks on their own on a recurring basis. This turns them from reactive agent bots to proactive agents that work on their own in the background to support you without you needing to continually ask them to do things.<br /><br />You can simply ask any agent to do something at some point in the future, or to handle some daily task at a certain time, and it will create a prompt for itself that will be executed at the specified times.<br /><br />Here, you can view, create, and manage all your scheduled tasks in one place to streamline your workflow and ensure important actions happen automatically.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"create-schedule",attachTo:{element:'button[data-tour-tag="create-schedule-button"]',on:"bottom"},title:"Set up a recurring task",text:'Click "Create schedule" to ask an agent to perform a task for you regularly, like sending a daily report or checking for news updates.<br /><br />You can also create one-off tasks that only run once at some point in the future.',buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"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:"right"},title:"Configure your schedule",text:"While it is often much easier to simply ask the agent to do a task on a recurring basis for you, you can also manually set up a schedule for a task here or update existing tasks.<br /><br />The prompt is the message that will be sent to the agent at the predefined schedule. You can update the time of day in your local timezone, the frequency of the task, and even specify a specific date or time that the task should stop running at.<br /><br />You can also schedule one-off tasks that only run once at some point in the future.",buttons:[{text:"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:"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:"right"},title:"Personalize your experience",text:"Now, let's explore the Settings menu to customize Local Operator to your liking.",buttons:[{text:"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:"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:"right"},title:"General settings",text:"Here you can update your user profile and configure model settings (like default hosting provider and model).",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"appearance-settings",attachTo:{element:'[data-tour-tag="settings-appearance-section"]',on:"right"},title:"Customize appearance",text:"Choose from various themes to change the look and feel of Local Operator. Find one that suits your style.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"radient-account-settings",attachTo:{element:'[data-tour-tag="settings-radient-account-section"]',on:"right"},title:"Radient account",text:"Connect your Radient account to access your Radient Pass details, credits, and unlock unified access to models and tools. Radient is the best way to use Local Operator since it powers the AI models, web search, image generation, and much more with a single integration. You get free credits when you sign up to try it out and bonus credits when you top up.<br /><br />When you sign in for the first time, it will automatically create a Radient Pass for you and save it securely to your computer. This will power your Local Operator agents with Radient Automatic, which mixes and matches AI models to get you the best balance of speed, accuracy, and cost in every step of your agents' workflows.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"integrations-settings",attachTo:{element:'[data-tour-tag="settings-integrations-section"]',on:"right"},title:"Connect your services",text:"Enhance your agents' capabilities by connecting your Google services like Gmail, Calendar, and Drive. This allows agents to access and manage your information with your permission.<br /><br />You need to be logged in to a Radient account to use this feature, however it is free to use and doesn't cost any additional Radient credits per action.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"application-updates-settings",attachTo:{element:'[data-tour-tag="settings-app-updates-section"]',on:"right"},title:"Stay up to date",text:"Check for updates to Local Operator here to ensure you have the latest features and improvements. You can see your current version information below.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"tour-complete",title:"Tour complete",text:"You've now seen the main features of Local Operator. Feel free to explore further and discover all the ways your AI agents can assist you. Happy automating.",buttons:[{text:"Finish",classes:"shepherd-button-primary",action:function(){this.complete()}}]}],mXe=()=>{const e=Xr(),{completeTourOnboarding:t}=gm(),n=g.useContext(qC),s={cancelIcon:{enabled:!0},scrollTo:{behavior:"smooth",block:"center"}},r=!0;return{startTour:a=>{if(n?.tour?.isActive()&&!a?.forceModalCompleted){console.log("Onboarding tour is already active (from context.tour). Not starting another.");return}const o=gm.getState();if(!a?.forceModalCompleted&&!o.isModalComplete){console.log("Onboarding modal not completed (checked via store). Tour will not start.");return}if(o.isTourComplete&&!a?.forceModalCompleted){console.log("Onboarding tour already completed in store and not forced. Not starting again.");return}let l=n?.tour;const u=n?.Shepherd;if(!l&&u&&(l=u.activeTour,!l&&u.Tour&&(console.log("No active Shepherd tour found from context or global. Creating a new one."),l=new u.Tour({useModalOverlay:r,defaultStepOptions:s}))),!l){console.warn("Failed to get or create a Shepherd tour instance.",n);return}if(l.isActive()){console.log("Tour is already active. Not starting again.");return}if(l.options.defaultStepOptions={...l.options.defaultStepOptions||{},...s},l.options.useModalOverlay=r,a?.firstAgentId&&(l.options.firstAgentId=a.firstAgentId),l.off("complete",t),l.on("complete",t),l.off("cancel",t),l.on("cancel",t),a?.forceModalCompleted||!l.isActive()){const d=[...l.steps];for(const h of d)h.id&&l.removeStep(h.id);l.addSteps(G3)}else l.steps.length===0&&l.addSteps(G3);typeof l.start=="function"?(e("/"),l.start()):console.warn("Shepherd tour instance does not have a start method.",l)}}},vXe=()=>{const{isModalComplete:e,isTourComplete:t}=gm(),{startTour:n}=mXe(),s=Ve.useContext(qC),{data:r}=jE(1,1);return g.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},xXe=({children:e})=>c.jsxs(aXe,{children:[e,c.jsx(vXe,{})]}),bXe=()=>{const{open:e,focusGroup:t,providerId:n,closeConnect:s}=nB(),r=g.useRef(null);g.useEffect(()=>{e&&(r.current=document.activeElement instanceof HTMLElement?document.activeElement:null)},[e]);const i=Xr();return c.jsx(Yc,{open:e,onOpenChange:a=>{a||s()},children:c.jsxs(Xc,{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(Al,{className:"text-title",children:"Connect a model provider"}),c.jsx(Od,{className:"text-body-sm text-ink-muted",children:"Your agents need a model to think with. Sign in with an account you already have, or add an API key."})]}),e?c.jsx(gV,{context:"dialog",featuredOnly:!0,focusGroup:t,initialProviderId:n,onDone:s,onChangeModel:()=>{s(),i("/settings")}}):null]})})},wXe=({title:e,description:t,icon:n,children:s,titleComponent:r,sectionRef:i,dataTourTag:a,className:o,id:l})=>c.jsxs("div",{ref:i,id:l,tabIndex:l?-1:void 0,"data-tour-tag":a,className:_("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})]}),xZe=({label:e,value:t,className:n,valueClassName:s})=>c.jsxs("div",{className:_("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:_("mt-0.5 break-words text-body-sm",s??"text-ink"),children:t})]}),bZe=({children:e,className:t})=>c.jsx("div",{className:_("grid grid-cols-[repeat(auto-fit,minmax(160px,1fr))] gap-x-6 gap-y-4",t),children:e});async function LV(e){await Ct({op:"settings.edit",key:Fo,value:e.value}),mQ(e.queryClient)}async function CXe(e){await LV(e),e.queryClient.setQueryData(eb.all,t=>t&&{...t,settings:t.settings.map(n=>n.key===Fo?{...n,value:e.value,is_default:e.value===n.default}:n)});try{return await e.queryClient.fetchQuery({queryKey:eb.all,queryFn:()=>Ct({op:"settings.list"}),staleTime:0,retry:!1}),"confirmed"}catch{return"readback-unknown"}}const wZe=({focus:e=!1})=>{const t=nn(),n=zn(),s=Et(n.data,"settings"),r=fs({queryKey:eb.all,queryFn:()=>Ct({op:"settings.list"}),enabled:s,retry:!1,refetchOnReconnect:!0}),i=r.data?.settings.find(F=>F.key===Fo),[a,o]=g.useState(!1),[l,u]=g.useState(null),[d,h]=g.useState(!1),[f,p]=g.useState(!1),m=g.useRef(!1),v=g.useRef(null),x=g.useRef(!1);g.useEffect(()=>{if(!e){x.current=!1;return}!i||x.current||(v.current?.querySelector("[role=combobox]")?.focus(),x.current=!0)},[e,i]),g.useEffect(()=>{r.isSuccess&&!r.isFetching&&h(!1)},[r.isFetching,r.isSuccess]);const b=async F=>{if(!(!i||m.current||d||!i.choices.some(R=>R.value===F))){m.current=!0,o(!0),u(null),p(!1);try{const R=await CXe({value:F,queryClient:t});h(R==="readback-unknown"),p(R==="confirmed")}catch(R){u({value:F,message:R instanceof Error?R.message:""})}finally{m.current=!1,o(!1)}}},w=async()=>{const[F,R]=await Promise.all([r.refetch(),n.refetch()]);!F.isError&&!R.isError&&h(!1)},C=!r.data&&r.error||!n.data&&n.error,k=n.data&&(!s||r.data&&!i),y=!C&&!k&&!i,E=n.data?.features?.i18n?n.data.language:void 0,T=typeof E=="string"&&E!==""?E:void 0;return c.jsx(wXe,{title:Z("ui.settings.language.dialog.title"),icon:$6,description:Z("ui.settings.language.general.description"),children:c.jsxs("div",{ref:v,"data-setting-key":Fo,className:"flex flex-col gap-3","aria-busy":a,children:[y&&c.jsx("output",{className:"text-meta text-ink-dim",children:Z("ui.settings.language.dialog.loading")}),k&&c.jsx("p",{className:"text-meta text-ink-dim",children:Z("ui.settings.language.dialog.unavailable")}),i&&c.jsx(uB,{setting:{...J_(i),label:Z("ui.settings.language.dialog.title")},value:String(i.value),onValueChange:F=>{b(F)},disabled:a||d,suppressEffectiveNote:!0}),c.jsx("output",{id:pQ(Fo),"aria-live":"polite",className:"text-meta text-ink-dim",children:a?Z("ui.settings.language.general.pending"):f?Z("ui.settings.language.general.saved"):T?Z(d||n.error?"ui.settings.language.general.last_known":"ui.settings.language.general.effective",{locale:gQ(T)?.name??T}):Z("ui.settings.language.general.no_resolution")}),(C||l||d)&&c.jsx(zr,{variant:"danger",children:c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("p",{role:"alert",children:l?Z("ui.settings.language.general.write_error",{message:l.message}):d?Z("ui.settings.language.general.readback_error"):Z("ui.settings.language.dialog.unavailable")}),c.jsx(ae,{variant:"outline",size:"sm",disabled:a||r.isFetching||n.isFetching,onClick:()=>{l?b(l.value):w()},children:Z("ui.settings.language.dialog.retry")})]})})]})})},yXe=()=>{const e=x_(ee=>ee.open),t=x_(ee=>ee.closeLanguage),n=nn(),s=zn(),r=Et(s.data,"settings"),i=fs({queryKey:eb.all,queryFn:()=>Ct({op:"settings.list"}),enabled:e&&r,staleTime:1e4}),a=g.useRef(null),o=vQ(),l=(i.data?.settings??[]).find(ee=>ee.key===Fo),u=l?J_(l):void 0,[d,h]=g.useState(null),[f,p]=g.useState(!1),[m,v]=g.useState(!1),[x,b]=g.useState(null),w=g.useRef(null);g.useEffect(()=>{e&&h(null)},[e]),g.useEffect(()=>{if(!e||!u)return;const ee=String(u.value??"");(d===null||d===w.current)&&h(ee),w.current=ee},[e,u,d]),g.useEffect(()=>{e&&(v(!1),b(null))},[e]);const C=d??String(u?.value??""),k=!!u&&C!==String(u?.value??""),y=!u||!k||f,E=async()=>{if(!(!u||!k)){p(!0),b(null);try{await LV({value:C,queryClient:n}),v(!0),h(null),await i.refetch()}catch(ee){b(ee instanceof Error?ee.message:"The language could not be saved.")}finally{p(!1)}}},T=!!s.data,F=T&&!r,R=s.error&&!s.data?s.error:null,I=R??i.error,N=!T&&!I,{sentence:D,remedy:O}=xQ(o??null,"Your settings could not be loaded.",I),G=s.isFetching||i.isFetching,B=u?"combo":I?"retry":"none";return g.useEffect(()=>{!e||B==="none"||requestAnimationFrame(()=>{a.current?.querySelector(B==="combo"?'[role="combobox"]':"[data-language-retry]")?.focus()})},[e,B]),c.jsx(Yc,{open:e,onOpenChange:ee=>!ee&&t(),children:c.jsxs(Xc,{ref:a,onOpenAutoFocus:ee=>ee.preventDefault(),className:"max-w-[min(28rem,calc(100vw-4rem))] gap-4",children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx(Al,{className:"text-title",children:Z("ui.settings.language.dialog.title")}),c.jsx(Od,{className:"text-body-sm text-ink-muted",children:Z("ui.settings.language.dialog.description")})]}),N?c.jsxs("div",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[c.jsx(vn,{}),Z("ui.settings.language.dialog.loading")]}):F?c.jsx(zr,{variant:"warning",children:c.jsx("span",{children:Z("ui.settings.language.dialog.unavailable")})}):I?c.jsx(zr,{variant:"warning",children:c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("span",{children:D}),O&&c.jsx(ae,{variant:"secondary",size:"sm",className:"shrink-0","data-language-retry":"",onClick:()=>{R?s.refetch():i.refetch()},disabled:G,children:G?Z("ui.settings.language.dialog.retrying"):Z("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(vn,{}),Z("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:lF(Fo),className:"text-meta text-ink-dim",children:u.help}),c.jsx(uB,{setting:u,value:C,disabled:f,helpId:lF(Fo),effectiveNoteId:bQ(Fo,wQ),onValueChange:ee=>{v(!1),h(ee)}})]}),x&&c.jsx("p",{className:"text-meta text-danger",children:x}),c.jsx("div",{className:"flex min-h-8 items-center justify-end",children:m&&!k?c.jsxs("output",{"data-language-save":"",className:"inline-flex items-center gap-1.5 text-body-sm text-ink",children:[c.jsx(Ms,{"aria-hidden":"true",className:"size-3.5"}),Z("ui.settings.language.dialog.saved")]}):c.jsx(ae,{onClick:E,disabled:y,"data-language-save":"",children:f?`${Z("ui.settings.language.dialog.save")}...`:Z("ui.settings.language.dialog.save")})})]}):c.jsx(zr,{variant:"warning",children:c.jsx("span",{children:Z("ui.settings.language.dialog.unavailable")})})]})})};function SXe(){const{data:e}=zn();g.useEffect(()=>{e&&tZ(e)},[e]);const t=K_(),n=nn(),s=g.useRef(null);g.useEffect(()=>{const r=t.configChange;if(!r)return;const i=`${r.epoch}:${r.seq}`;s.current!==i&&r.changedKeys.includes(Fo)&&(s.current=i,n.invalidateQueries({queryKey:Ho.capabilities}),n.invalidateQueries({queryKey:Ho.settings}),!CQ()&&za(Z("ui.settings.language.external_notice",{language:r.language}),{id:"i18n-language-external"}))},[t.configChange,n])}function EXe(e,t){if(e.defaultPrevented||e.repeat||e.isComposing||!(e.metaKey||e.ctrlKey))return null;const n=yQ(e);if(n===null)return null;const s=nZ(t.bindings).get(n);return s===void 0||Y_(e.target)||!Ace(BV(s),t.route)?null:s}const BV=e=>e.slice(6);function kXe(e){const t=Ee.getState(),n=t.activeDraftKey?t.drafts[t.activeDraftKey]:void 0,s=Jf(t.activeDraftKey,n?.sessionId,t.activeSessionId)??null;Pu(BV(e),{sessionId:s,askScope:s===null?"fleet":"session"})}function _Xe(){g.useEffect(()=>{const e=t=>{const n=qe.getState(),s=EXe(t,{bindings:n.shortcutBindings,route:n.rightSlotRoute});s!==null&&(t.preventDefault(),kXe(s))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[])}const TXe=""+new URL("radient-icon-1024x1024-D_JJedvo.png",import.meta.url).href,jV=A0()(sZ(e=>({hasBeenNotified:!1,setHasBeenNotified:t=>{e({hasBeenNotified:t})}}),{name:"low-credits-storage"})),RXe=({open:e,onClose:t,onGoToConsole:n})=>{const{setHasBeenNotified:s}=jV(),{prices:r,isLoading:i,error:a}=SQ(),o=d=>typeof d!="number"?"$...":`$${d.toFixed(2)} USD`,l=()=>{s(!0),t()},u=()=>{s(!0),n()};return c.jsx(Kc,{open:e,onClose:l,title:c.jsxs(c.Fragment,{children:[c.jsx("img",{src:TXe,alt:"Radient icon",className:"size-7"}),"Running low on Radient credits?"]}),maxWidth:"sm",fullWidth:!1,actions:c.jsxs(c.Fragment,{children:[c.jsx(x0,{onClick:l,children:"Maybe later"}),c.jsx(b0,{onClick:u,startIcon:c.jsx(vl,{size:18}),className:"min-w-55",children:"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:["Unlock the full power of Local Operator with"," ",c.jsx("span",{className:"font-bold text-accent",children:"Radient Pass"}),"."]}),c.jsx("p",{className:"text-body-sm text-ink-muted",children:"Radient Automatic is often cheaper than bringing your own key: its smart model routing picks the most cost-effective model for each step of your agentic workflows."}),c.jsx("p",{className:"text-body-sm text-ink-muted",children:"It's pay-as-you-go with no commitments. Load up what you need, starting small for maximum flexibility."}),c.jsxs("p",{className:"text-body-sm text-ink-muted",children:["Plus, get"," ",c.jsx("span",{className:"font-medium text-ink",children:i?c.jsx(vn,{size:"sm",className:"mr-0.5 align-middle"}):o(r?.default_registration_credits)})," ","in bonus credits with your first purchase.",a&&c.jsx("span",{className:"mt-1 block text-meta text-danger",children:"Could not load bonus credit information."})]}),c.jsx("p",{className:"text-meta text-ink-dim",children:"You can also reach the Radient Console from Settings at any time."})]})})},AXe=(e,t)=>t?LS(e.filter(n=>n.session_id===t)).length:0;function FXe(e){return Ee(t=>AXe(t.sessions,e))}const DXe=(e,t)=>t?e.some(n=>n.session_id===t&&n.status?.code==="busy"):!1;function PXe(e){return Ee(t=>DXe(t.sessions,e))}const IXe=[];function NXe(){const{state:e}=oC(),t=e?.pendingConsent??IXe,n=Ij(s=>FP(t,s));return g.useEffect(()=>{t.length>0&&FT()},[t]),FP(t,n)}const HV={approvals:["desktop","mesh","approvals"]},MXe=15e3,OXe=new Set(["requested","approved","connecting","failed"]);function LXe(e){return OXe.has(e)}function BXe(e){return e==="requested"}function jXe(e){return e.filter(t=>BXe(t.state)).length}function CZe(e){return e==="requested"}function yZe(e){return LXe(e)}function SZe(e){switch(e){case"requested":return"Waiting for you";case"approved":return"Approved";case"connecting":return"Connecting…";case"connected":return"Connected";case"denied":return"Denied";case"expired":return"Expired";case"failed":return"Failed";default:return e}}function Wu(e){return typeof e=="object"&&e!==null}function HXe(e){const t=Wu(e)?e:{};return{deviceId:Ft(t.device_id),name:Ft(t.name),host:Ft(t.host),user:Ft(t.user),transport:Ft(t.transport),hostKeyFp:Ft(t.host_key_fp)}}function UXe(e){const t=Wu(e)?e:{};return{connect:Lo(t.connect,!1),install:Lo(t.install,!1),anchor:Wu(t.anchor),networkId:Ft(t.network_id),role:Ft(t.role),unattended:Lo(t.unattended,!1),grants:Df(t.grant)}}function GXe(e){const t=Array.isArray(e)?e:e?.approvals??[];if(!Array.isArray(t))return[];const n=[];for(const s of t){if(!Wu(s))continue;const r=Ft(s.approval_id),i=Ft(s.state);if(!r||!i)continue;const a=!Wu(s.device)&&Wu(s.machine)?"machine":"device",o=Wu(s.requested_by)?s.requested_by:{};n.push({approvalId:r,state:i,kind:a,where:HXe(a==="machine"?s.machine:s.device),what:UXe(s.what),requestedBy:{surface:Ft(o.surface),sessionId:Ft(o.session_id),deviceId:Ft(o.device_id)},expiresAt:Ec(s.expires_at)})}return n}function $Xe(e){return e.kind==="machine"?"this machine":n5({device_id:e.where.deviceId,name:e.where.name})}function EZe(e,t){const n=VXe(e),s=zXe(e,t).map(r=>r.clause);return s.length?`${n}: ${WXe(s)}.`:`${n}.`}function VXe(e){return e.kind==="machine"?"Set up operator authority on this machine":`Onboard ${$Xe(e)}`}function WXe(e){return e.length===1?e[0]:`${e.slice(0,-1).join(", ")}; ${e[e.length-1]}`}function kZe(e){const{user:t,host:n,transport:s,name:r}=e.where,i=[n?t?`${t}@${n}`:n:"",s?`via ${s}`:"",r&&r!==n?`(${r})`:""].filter(Boolean);return i.length?i.join(" "):null}function _Ze(e){return e.where.hostKeyFp||null}function TZe(e){const{surface:t,sessionId:n}=e.requestedBy,s=[t||"",n?`session ${n.slice(-6)}`:""].filter(Boolean);return s.length?`asked by ${s.join(" · ")}`:null}function zXe(e,t){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?`connect over ${e.where.transport}`:"connect to it",consequence:e.where.transport?`this machine may connect to it over ${e.where.transport}`:"this machine may connect to it"}),s&&u.push({term:"install",clause:e.kind==="machine"?"install Local Operator":"install Local Operator there",consequence:e.kind==="machine"?"Local Operator is installed on this machine":"Local Operator is installed on it"}),r&&u.push({term:"install operator anchor",clause:"check approvals signed on your machines",consequence:"that device can check approvals signed on your machines; nothing there can sign"}),i){const d=t?.get(i),h=`join ${d||i} as ${a||"?"}`;u.push({term:h,clause:h,consequence:`it joins ${d||i} as ${a||"?"}`})}o&&u.push({term:"trust unattended sessions",clause:"run sessions there without an approval prompt",consequence:"sessions you start on that device run without an approval prompt there"});for(const d of qXe(l,o)){const h=KXe[d];u.push({term:h?.term??`grant ${d}`,clause:YXe[d]??`use the ${d} capability`,consequence:h?.gloss??`you may ${d} on that device`})}return u}function qXe(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 KXe={unattended:{term:"trust unattended sessions",gloss:"sessions you start on that device run without an approval prompt there"},broker_credential:{term:"borrow logins there",gloss:"your sessions may use the logins stored on that device"}},YXe={list:"see its sessions",view:"watch a session there",prompt:"send prompts to a session there",steer:"steer a running turn there",stop:"stop a session there",slash:"run slash commands there",delete:"archive or delete a session there",move:"move sessions to or from there",broker_credential:"borrow the logins stored there",approve:"answer approval prompts there",unattended:"run sessions there without an approval prompt"};function RZe(e,t){if(e===null||e<=0)return null;const n=e-t;if(n<=0)return null;if(n<60)return"expires in under a minute";const s=Math.ceil(n/60);if(s<90)return s===1?"expires in 1 minute":`expires in ${s} minutes`;const r=Math.ceil(s/60);return r===1?"expires in 1 hour":`expires in ${r} hours`}function XXe(e,{poll:t=!0}={}){return fs({queryKey:HV.approvals,enabled:e,queryFn:async()=>GXe(await Ct({op:"approvals.list"})),retry:!1,staleTime:t?1e4:Number.POSITIVE_INFINITY,refetchInterval:e&&t?MXe:!1,refetchOnWindowFocus:t})}function AZe(){const e=nn();return Kn({mutationFn:async t=>{const n=t.decision==="approve"?{op:"approvals.approve",approvalId:t.approvalId}:{op:"approvals.deny",approvalId:t.approvalId};await Ct(n)},onSettled:()=>{e.invalidateQueries({queryKey:HV.approvals}),e.invalidateQueries({queryKey:Pl.networks}),e.invalidateQueries({queryKey:Pl.peers})}})}function FZe(e){const t=e?.message;return typeof t=="string"&&t.trim()?t.trim():"The approvals could not be read."}function DZe(e){const t=e;return{code:Ft(t?.code)||"approval_refused",sentence:Ft(t?.message)||"The decision could not be answered."}}const $3=e=>{const t=_Q(e.type),n=typeof e.percent=="number"?`, ${Math.round(e.percent)}%`:"";return`${t} in progress${n}.`},UV=e=>kQ({type:e.type,version:e.offer.version}),QXe=e=>`${e.map(s=>UV(s)).map((s,r)=>r===0?s:`${s.charAt(0).toLowerCase()}${s.slice(1)}`).join(" and ")} available. Show the update notice.`,JXe=({surfaces:e,inflight:t,onShow:n,onDismiss:s})=>{if(t===null&&e.length===0)return null;if(t!==null)return c.jsx(nt,{side:"top",collisionPadding:8,content:$3(t),children:c.jsx("output",{"data-update-foot-icon":"","data-update-foot-icon-state":"inflight","aria-label":$3(t),className:"flex size-8 shrink-0 items-center justify-center text-accent",children:c.jsx(ji,{className:"size-4 shrink-0 motion-safe:animate-spin","aria-hidden":"true"})})});const r=e.find(i=>(i.offer.summary??"").trim()!=="");return c.jsx(nt,{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:[UV(i)," available"]},i.type)),r?c.jsx("span",{className:"truncate text-ink-muted",children:(r.offer.summary??"").trim()}):null,c.jsx("span",{className:"whitespace-nowrap text-ink-muted",children:"Show the update notice."})]}),children:c.jsx("button",{type:"button","data-update-foot-icon":"","data-update-foot-icon-state":"available","aria-label":QXe(e),onClick:n,onKeyDown:i=>{i.key!=="Escape"||!s||(i.stopPropagation(),s())},className:_("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(z_,{className:"size-4 shrink-0","aria-hidden":"true"})})})},V3=()=>{const e=Xs(p=>p.followed),t=Xs(p=>p.running),n=Xs(p=>p.offers),s=Xs(p=>p.detailOpen),r=Xs(p=>p.inflight),i=Xs(p=>p.downloadPercent),a=Xs(p=>p.openNotice),o=Xs(p=>p.noticeOpen),l=Xs(p=>p.dismissNotice),u=g.useMemo(()=>{const p={followed:e,running:t,offers:n,detailOpen:s};return t4.filter(m=>EQ(p,m)).map(m=>{const v=n[m];return v?{type:m,offer:v}:null}).filter(m=>m!==null)},[e,t,n,s]),d=g.useMemo(()=>r[on.BACKEND]?{type:on.BACKEND,percent:null}:r[on.UI]?{type:on.UI,percent:i[on.UI]}:null,[r,i]),h=g.useCallback(()=>a(),[a]),f=g.useCallback(()=>l(),[l]);return c.jsx(JXe,{surfaces:u,inflight:d,onShow:h,onDismiss:o?f:void 0})},W3=({expanded:e})=>c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(TQ,{className:"size-6",label:e?void 0:"Local Operator"}),e&&c.jsx("span",{className:"truncate font-semibold text-body text-ink",children:"Local Operator"})]}),k_=Ve.memo(({expanded:e,useAuth:t=!1})=>{const n=Xr(),{user:s,isAuthenticated:r,accountRead:i,signOut:a}=dB(),o=i==="checking"?"Checking account…":cF(i)?"Account unavailable":null,l=s?.name??o??"User",u=cF(i),d=s?.email??"",h=u?"Reconnect Radient":d,f=u?"/settings?section=providers&provider=radient":"/settings",p=u?"Reconnect Radient":"Account settings",m=g.useCallback(async()=>{r&&(await a(),window.location.reload())},[r,a]),v=g.useMemo(()=>{const w=s?.name;return w?w.split(" ").map(C=>C.charAt(0)).join("").toUpperCase().substring(0,2):null},[s?.name]),x=c.jsxs("button",{type:"button",onClick:t?void 0:()=>n(f),"aria-label":e?void 0:p,className:_("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.jsx(wB,{className:"size-7 shrink-0",children:c.jsx(CB,{className:"border border-control bg-elevated text-ink",children:v??c.jsx(rre,{size:14,"aria-hidden":"true"})})}),e&&l&&c.jsxs("span",{className:"min-w-0 text-left",children:[c.jsx("span",{className:"block truncate text-body-sm text-ink",children:l}),h&&c.jsx("span",{className:_("block truncate text-meta",u?"text-accent":"text-ink-dim"),children:h})]})]}),b=e?x:c.jsx(nt,{content:p,side:"right",children:x});return t?c.jsxs(Fl,{children:[e?c.jsx(Uo,{asChild:!0,children:x}):c.jsx(nt,{content:p,side:"right",children:c.jsx(Uo,{asChild:!0,children:x})}),c.jsxs(Dl,{align:"end",side:"top",className:"min-w-50",children:[u?c.jsxs(Ut,{onSelect:()=>n(f),children:[c.jsx(mB,{size:16,"aria-hidden":"true"}),"Reconnect Radient"]}):null,c.jsxs(Ut,{onSelect:()=>n("/settings"),children:[c.jsx(Sc,{size:16,"aria-hidden":"true"}),"Settings"]}),c.jsxs(Ut,{children:[c.jsx(_se,{size:16,"aria-hidden":"true"}),"Privacy and security"]}),c.jsx(qr,{}),c.jsxs(Ut,{onSelect:m,className:"text-danger focus:bg-danger-wash focus:text-danger",children:[c.jsx(Kne,{size:16,"aria-hidden":"true"}),"Sign out"]})]})]}):b});k_.displayName="UserProfileSidebar";const ZXe=()=>{const e=K_(),t=zn(),n=Ee(o=>o.setCataloguePageable),s=Ee(o=>o.fetchSessions),r=Et(t.data,"session_catalogue_page");g.useEffect(()=>{n(r)},[r,n]);const i=Ja(t.data,"session_catalogue",2)==="enabled",a=g.useCallback(()=>s(r?B4:Mw,r),[s,r]);return g.useEffect(()=>{i&&a()},[i,a,e.catalogueRevision]),null},eQe="flex h-[30px] w-full items-center gap-2 rounded-md px-2 text-body-sm transition-colors duration-fast ease-out-quart",tQe=()=>{const e=Xr(),t=sae(),{expanded:n,mode:s,onCollapse:r}=RQ(),i=qe(oe=>oe.openCommandPalette),a=zn(),o=Ee(oe=>oe.activeSessionId),l=NXe(),u=Ja(a.data,"peers")==="enabled",d=jT(u),h=Ja(a.data,"approvals")==="enabled",f=XXe(d==="member"&&h,{poll:!0}),p=jXe(f.data??[]),m=Et(a.data,"projects",1),v=Et(a.data,"aida",1),x=I0(v),b=v&&x.data?.enabled===!0,w=x.data?.name??"Aida",C=poe(),k=FXe(x.data?.session_id),y=PXe(x.data?.session_id),E=()=>{C(e,x.data).catch(oe=>zt(Sh(oe)))},T=[...b?[{icon:nne,label:w,path:"/chat",isActive:t==="chat"&&!!x.data?.session_id&&o===x.data?.session_id,tourTag:"nav-item-aida",onSelect:E,attention:k,attentionTag:"nav-aida-badge",attentionName:oe=>`${w}, ${oe} missed message${oe===1?"":"s"}`,working:y,workingName:`${w}, working`}]:[],{icon:Bc,label:"Agents",path:"/agents",isActive:t==="agents",tourTag:"nav-item-agents"},...m?[{icon:G6,label:"Projects",path:"/projects",isActive:t==="projects",tourTag:"nav-item-projects"}]:[],{icon:H6,label:"Schedules",path:"/schedules",isActive:t==="schedules",tourTag:"nav-item-schedules"},{icon:hd,label:"Browser",path:"/browser",isActive:t==="browser",tourTag:"nav-item-browser",attention:l,attentionTag:"nav-browser-badge",attentionName:oe=>`Browser, ${oe} waiting`},{icon:X6,label:"Agent hub",path:"/agent-hub",isActive:t==="agent-hub",tourTag:"nav-item-agent-hub"},...d==="member"?[{icon:tB,label:"Mesh",path:"/mesh",isActive:t==="mesh",tourTag:"nav-item-mesh",attention:p,attentionTag:"nav-mesh-badge",attentionName:oe=>`Mesh, ${oe} waiting`}]:[]],F=c.jsx(fVe,{selectedConversation:o??void 0,onSelectConversation:oe=>void tp(e,oe),onStageDraft:(oe,X)=>{Ee.getState().stageDraft(oe,X),e("/chat")}}),R=oe=>{const X=oe.attention??0,Ce=X>0&&oe.attentionName?oe.attentionName(X):oe.label;return oe.working&&oe.workingName?oe.workingName:Ce},I=oe=>{const X=oe.attention??0,Ce=R(oe),L=oe.isActive?So:"text-ink-muted hover:bg-row-hover hover:text-ink";return c.jsx("li",{className:_("flex h-[30px] w-full items-center rounded-md","transition-colors duration-fast ease-out-quart",L),children:c.jsxs("button",{type:"button",onClick:()=>oe.onSelect?oe.onSelect():e(oe.path),"data-tour-tag":oe.tourTag,"aria-current":oe.isActive?"page":void 0,"aria-label":n&&Ce===oe.label?void 0:Ce,className:_("flex h-full min-w-0 flex-1 items-center gap-2 rounded-md",n?"px-2":"justify-center px-0"),children:[c.jsx(oe.icon,{size:16,"aria-hidden":"true",className:_("shrink-0",oe.isActive&&"text-accent")}),n&&c.jsx("span",{className:"truncate",children:oe.label}),X>0&&c.jsx("span",{className:_(n&&"ml-auto","inline-flex"),children:c.jsx(Lc,{variant:"attentionQuiet",shape:"pill",size:"count","data-tour-tag":oe.attentionTag,children:X})}),oe.working&&c.jsx("span",{className:_(n&&"ml-auto","inline-flex"),children:c.jsx(ji,{size:16,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})})]})},oe.tourTag)},N=oe=>n?I(oe):c.jsx("li",{children:c.jsx(nt,{content:R(oe),side:"right",children:I(oe)})},oe.tourTag),D=s==="overlay"?"Close sidebar":n?"Collapse sidebar":"Expand sidebar",O=s==="overlay"?Nn:n?ud:va,G=navigator.platform.toUpperCase().indexOf("MAC")>=0,B=Et(a.data,"session_catalogue",2),ee=Ee(oe=>oe.activeDraftKey),z=Ee(oe=>oe.drafts),ue=!!ee&&!(ee?z[ee]:void 0)?.target,U=()=>{Ee.getState().stageDraft(void 0,!0),e("/chat")},se=`New chat (${n3(G).replace("+","")})`,le=`Search (${To("everything",G)}) — chats (${To("chats",G)})`,M=`Search everything (${To("everything",G)}) · your chats (${To("chats",G)})`,H=(oe,X,Ce,L)=>{const be=oe;return c.jsxs("button",{type:"button",...L.attrs,onClick:L.onClick,disabled:L.disabled,"aria-label":L.ariaLabel,"aria-current":L.current?"page":void 0,className:_(eQe,L.current?So:"text-ink-muted hover:bg-row-hover hover:text-ink","disabled:text-ink-disabled disabled:hover:bg-transparent"),children:[c.jsx(be,{size:16,"aria-hidden":"true",className:"shrink-0"}),c.jsx("span",{className:"truncate",children:X}),c.jsx("span",{"aria-hidden":"true",className:"ml-auto",children:c.jsx(wr,{shortcut:Ce,joined:!0})})]})},A=H(BE,"New chat",n3(G),{onClick:U,ariaLabel:se,current:ue,disabled:!B,attrs:{"data-tour-tag":"nav-item-chat","data-new-chat-row":""}}),V=H(fd,"Search",Sze("everything",G),{onClick:i,ariaLabel:le,attrs:{"data-command-palette-trigger":"",title:M}}),J=(oe,X,Ce)=>{const L=oe;return c.jsx(nt,{content:X,side:"right",children:c.jsx("button",{type:"button",...Ce.attrs,onClick:Ce.onClick,disabled:Ce.disabled,"aria-label":X,className:_("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.jsx(L,{size:16,"aria-hidden":"true"})})})},fe=c.jsx("div",{className:_(s!=="overlay"&&_("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(nt,{content:D,side:"right",children:c.jsx(ae,{variant:"ghost",size:"icon-sm",onClick:r,"aria-label":D,"aria-expanded":s==="overlay"?void 0:n,"aria-keyshortcuts":NF(G),children:c.jsx(O,{"aria-hidden":"true"})})})}),ce=c.jsx(nt,{content:"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":"Settings",className:_("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(Sc,{size:16,"aria-hidden":"true"})})});return n?c.jsxs("div",{"data-sidebar-shell":"",className:"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 pr-2 pl-4",children:[c.jsx(W3,{expanded:!0}),c.jsx("span",{className:"ml-auto",children:fe})]}),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:[A,V]}),c.jsx("ul",{className:"flex flex-col gap-0.5",children:T.map(N)})]}),c.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:F}),c.jsxs("div",{className:"flex min-h-10 shrink-0 items-center justify-between gap-1 px-2 pb-2",children:[c.jsx(k_,{expanded:!0}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(V3,{}),ce]})]})]}):c.jsxs("div",{"data-sidebar-strip":"",className:"group/sidebar flex h-full min-h-0 flex-col items-center bg-surface",children:[c.jsx(ZXe,{}),c.jsx("div",{className:"flex h-10 shrink-0 items-center justify-center",children:c.jsx(W3,{expanded:!1})}),c.jsxs("ul",{className:"flex flex-col items-center gap-1",children:[c.jsx("li",{children:J(va,D,{onClick:r,attrs:{"aria-expanded":!1,"aria-keyshortcuts":NF(G)}})}),c.jsx("li",{children:J(BE,se,{onClick:U,disabled:!B,attrs:{"data-tour-tag":"nav-item-chat"}})}),c.jsx("li",{children:J(fd,le,{onClick:i,attrs:{"data-command-palette-trigger":""}})})]}),c.jsx("ul",{className:"mt-4 flex flex-col items-center gap-1",children:T.map(N)}),c.jsxs("div",{className:"mt-auto flex flex-col items-center gap-1 pb-2",children:[c.jsx(V3,{}),ce,c.jsx(k_,{expanded:!1})]})]})},nQe=1,sQe=()=>{const{isAuthenticated:e,user:t}=dB(),{hasBeenNotified:n,setHasBeenNotified:s}=jV(),[r,i]=g.useState(!1),[a,o]=g.useState(null),l=g.useCallback(async()=>{if(!(!e||!t?.radientUser?.account?.tenant_id))try{const f=await AQ({operation:"credits",tenantId:t.radientUser.account.tenant_id});if(!f||typeof f.balance!="number")throw new Error("Invalid credit balance response format");o(f.balance)}catch(f){console.error("Failed to fetch Radient credits:",f),o(null)}},[e,t?.radientUser?.account?.tenant_id]);return g.useEffect(()=>{e&&l()},[e,l]),g.useEffect(()=>{e&&a!==null?a<nQe?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 rQe(){const e=Xr();g.useEffect(()=>{const t=r=>{e(r==="back"?-1:1)},n=r=>{const i=uhe(r);i&&(r.preventDefault(),t(i))},s=r=>{const i=dhe(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 iQe(){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 aQe(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 oQe(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 lQe(){g.useLayoutEffect(()=>{if(!window.api?.windowChrome)return;const t=document.documentElement.dataset.chromePlatform??"linux",n=()=>aQe(iQe(),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)}},[]),g.useEffect(()=>{const e=window.api?.windowChrome;if(e)return e.onState(t=>{document.documentElement.dataset.chromeFullscreen=t.fullScreen?"true":"false"})},[])}const cQe=g.lazy(()=>jl(()=>import("./agent-details-page-Ci1JjvpV.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]),import.meta.url).then(e=>({default:e.AgentDetailsPage}))),uQe=g.lazy(()=>jl(()=>import("./agent-hub-page-NtBm1phk.js"),__vite__mapDeps([14,1,2,4,5,6,7,15,3,8,9,10,11,16,17,18,19,12,13]),import.meta.url).then(e=>({default:e.AgentHubPage}))),z3=g.lazy(()=>jl(()=>import("./agents-page-YFjN8oZC.js"),__vite__mapDeps([20,4,5,1,2,6,7,8,16,12,13]),import.meta.url).then(e=>({default:e.AgentsPage}))),dQe=g.lazy(()=>jl(()=>import("./schedules-page-CtMNJr6J.js"),__vite__mapDeps([21,1,2,4,5,6,7,15,18,10,22,12,13]),import.meta.url).then(e=>({default:e.SchedulesPage}))),q3=g.lazy(()=>jl(()=>import("./projects-page-Dg-fywlg.js"),__vite__mapDeps([23,1,2,4,5,6,7,15,24,12,13]),import.meta.url).then(e=>({default:e.ProjectsPage}))),hQe=g.lazy(()=>jl(()=>import("./browser-page-DEUUMy_g.js"),__vite__mapDeps([25,1,2,4,5,6,7,12,13]),import.meta.url).then(e=>({default:e.BrowserPage}))),fQe=g.lazy(()=>jl(()=>import("./mesh-page-BzfNUAkq.js"),__vite__mapDeps([26,1,2,4,5,6,7,15,12,13]),import.meta.url).then(e=>({default:e.MeshPage}))),pQe=g.lazy(()=>jl(()=>import("./settings-page-CFbI2wWy.js"),__vite__mapDeps([27,1,2,4,5,6,7,15,17,28,11,22,10,18,12,13]),import.meta.url).then(e=>({default:e.SettingsPage}))),gQe=g.lazy(()=>jl(()=>import("./browser-webauthn-prompt-AacQARJZ.js"),__vite__mapDeps([29,1,2,4,5,6,7]),import.meta.url).then(e=>({default:e.BrowserWebauthnPrompt}))),mQe=()=>{lQe(),SXe();const{pathname:e}=q_(),t=e.startsWith("/chat")||e.startsWith("/browser"),{isOnboardingActive:n}=tae(),{isLowCreditsDialogOpen:s,openRadientConsole:r,onLowCreditsDialogClose:i}=sQe(),{isCommandPaletteOpen:a,isCreateAgentDialogOpen:o,isSidebarCollapsed:l,closeCreateAgentDialog:u}=qe();Bu(a,"command-palette"),Bu(o,"create-agent-dialog"),Bu(n,"onboarding"),Bu(s,"low-credits");const d=Xr(),h=zn(),f=Et(h.data,"session_catalogue",2),p=Et(h.data,"session_archive");g.useEffect(()=>{Ee.getState().requestArchiveConfirm(null)},[e]);const m=Ja(h.data,"peers"),v=y=>{Ee.getState().stageDraft({kind:"agent",name:y.name}),d("/chat"),u()};zze(),_Xe(),Fze(),rQe(),Mhe();const x=Ee(y=>y.setActiveSession),b=Ee(y=>{const E=y.activeDraftKey?y.drafts[y.activeDraftKey]:void 0;return Jf(y.activeDraftKey,E?.sessionId,y.activeSessionId)}),w=qe(y=>y.setConsolePaneOpen),C=qe(y=>y.setBrowserPaneOpen),k=qe(y=>y.setConsoleActiveSurface);return g.useEffect(()=>{const y=window.api?.desktop?.onOpenConversation?.((E,T)=>{E!==null&&performance.mark("lop:open:requested"),x(E),T!==void 0&&E!==null&&(k(T),w(!0)),d("/chat")});return()=>y?.()},[d,x,w,k]),g.useEffect(()=>{const y=window.api?.console?.onReveal?.(E=>{E.mode!=="none"&&(E.mode==="session"&&E.session_id!==b||(E.mode==="open"&&x(E.session_id),k(E.surface),w(!0)))});return()=>y?.()},[b,x,w,k]),aoe(),mze(),g.useEffect(()=>{const y=window.api?.browser?.onConsentAttention?.(E=>{const T=Dae(E.requesterSessionId,Ee.getState().sessions);if(Rae(E.entryId),T.kind==="browser"){d("/browser");return}x(T.sessionId),C(!0),d("/chat")});return()=>y?.()},[d,x,C]),g.useEffect(()=>{const y=E=>{n||f&&xze(E)&&(E.preventDefault(),Ee.getState().stageDraft(void 0,!0),d("/chat"))};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[f,n,d]),c.jsx(xXe,{children:c.jsx("div",{className:"relative flex h-screen flex-col overflow-hidden","data-titlebar-sidebar-collapsed":l?"true":"false",children:c.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[a&&c.jsx(Gze,{}),c.jsx(bze,{}),c.jsx(FQ,{}),c.jsx(qze,{enabled:m==="enabled"}),c.jsx(Uqe,{open:n}),c.jsx(bXe,{}),c.jsx(yXe,{}),p&&c.jsx(uoe,{}),c.jsx(_ae,{}),c.jsx(g.Suspense,{fallback:null,children:c.jsx(gQe,{})}),c.jsx(RXe,{open:s,onClose:i,onGoToConsole:r}),c.jsx(aae,{open:o,onClose:u,onAgentCreated:v}),c.jsx(DQ,{sidebar:c.jsx(tQe,{}),content:c.jsxs("main",{className:"flex grow flex-col overflow-hidden",children:[t?null:c.jsx("div",{"data-chrome-route-band":""}),c.jsx(g.Suspense,{fallback:c.jsx("div",{className:"flex grow items-center justify-center",children:c.jsx(vn,{size:"lg",label:"Loading page"})}),children:c.jsxs(PQ,{children:[c.jsx(ti,{path:"/",element:c.jsx(uF,{to:"/chat",replace:!0})}),c.jsx(ti,{path:"/chat",element:c.jsx(e3,{})}),c.jsx(ti,{path:"/chat/:agentId",element:c.jsx(e3,{})}),c.jsx(ti,{path:"/agents",element:c.jsx(z3,{})}),c.jsx(ti,{path:"/agents/:agentId",element:c.jsx(z3,{})}),c.jsx(ti,{path:"/settings",element:c.jsx(pQe,{})}),c.jsx(ti,{path:"/agent-hub",element:c.jsx(uQe,{})}),c.jsx(ti,{path:"/agent-hub/:agentId",element:c.jsx(cQe,{})}),c.jsx(ti,{path:"/schedules",element:c.jsx(dQe,{})}),c.jsx(ti,{path:"/projects",element:c.jsx(q3,{})}),c.jsx(ti,{path:"/projects/:projectId",element:c.jsx(q3,{})}),c.jsx(ti,{path:"/browser",element:c.jsx(hQe,{})}),m==="enabled"&&c.jsx(ti,{path:"/mesh",element:c.jsx(fQe,{})}),c.jsx(ti,{path:"*",element:c.jsx(uF,{to:"/chat",replace:!0})})]})})]})})]})})})};function Lu(){return new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))})}const vQe=3,xQe=3e3;function bQe(e){return e instanceof CSSTransition&&e.playState==="running"}function wQe(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 ${v0(n)??"an element no longer in the document"} = ${i}`}async function CQe(e=xQe){const t=performance.now();let n=0;for(;;){await Lu();const s=Math.round(performance.now()-t),r=document.getAnimations().filter(bQe);if(n=r.length===0?n+1:0,n>=vQe)return{waitedMs:s,timedOut:!1,pending:[]};if(s>e)return{waitedMs:s,timedOut:!0,pending:r.map(wQe)}}}const yQe=/^#/;function fm(){const e=window.location.hash.replace(yQe,"");return e===""?"/":e}function v0(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 SQe(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=>v0(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:v0(r),stack:a,disabled:e instanceof HTMLButtonElement?e.disabled:null,rect:{x:t.x,y:t.y,width:t.width,height:t.height}}}function lg(e,t){if(typeof e!="string"||e==="")throw new Error(`${t} must be a non-empty string`);return e}async function EQe(e,t=1e4){const n=Date.now();for(;fm()!==e;){if(Date.now()-n>t)throw new Error(`route did not become ${e} (it is ${fm()})`);await new Promise(s=>setTimeout(s,50))}return await Lu(),fm()}const __=["dev-driver","query-fetch-probe"];let pm=null;function kQe(){if(pm)return pm;const e=[],t=dF.prototype.fetch;return dF.prototype.fetch=function(...s){return e.push({at:Date.now(),key:JSON.stringify(this.queryKey),stack:(new Error().stack??"").split(`
|
|
685
685
|
`).slice(2).join(" | ")}),t.apply(this,s)},pm=e,e}function _Qe(e){const t=pm??[],n=JSON.stringify(__),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:pm!==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 TQe(){const e=window.__loDevDriver;return e?.armed?e.install({hello:()=>({armed:!0,outDir:e.outDir,title:document.title,route:fm(),href:window.location.href,theme:qe.getState().themeName,viewport:{width:window.innerWidth,height:window.innerHeight,devicePixelRatio:window.devicePixelRatio},visibilityState:document.visibilityState,hasFocus:document.hasFocus(),apiBaseUrl:ys.baseUrl,userAgent:navigator.userAgent}),filesFacts:()=>mVe(),state:()=>{const t=qe.getState(),n=Ee.getState();return{route:fm(),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}])),sessionCount:n.sessions.length,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:()=>tb.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 _Qe(n.key);const s=kQe(),r=JSON.stringify(__),i=s.length;return await tb.fetchQuery({queryKey:__,queryFn:()=>null,retry:!1,staleTime:0}),{armed:!0,validated:s.slice(i).some(a=>a.key===r)}},navigate:async t=>{const n=lg(t,"navigate path");if(!n.startsWith("/"))throw new Error(`navigate path must start with "/" (got "${n}")`);return window.location.hash=`#${n}`,{route:await EQe(n)}},setTheme:async t=>{const n=lg(t,"theme name");qe.getState().setTheme(n),await Lu();const s=document.documentElement.getAttribute("data-theme"),r=await CQe();return{theme:qe.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=rZ(n);return qe.getState().setChatSidebarWidth(s),await Lu(),{width:qe.getState().chatSidebarWidth,clamped:s!==n}},measure:async t=>{const n=typeof t=="string"?{selector:t}:t,s=lg(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:v0(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=lg(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=SQe(a);return await Lu(),{selector:s,target:v0(a),...o}},openCanvasDocument:async t=>{const n=t,s=lg(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=wc(a,{title:r,type:bf(a),availability:"present",sizeBytes:i.sizeBytes??void 0,lastAgentModified:i.mtimeMs??void 0,readMtimeMs:i.mtimeMs??void 0}),l=Gw[Qf(a,o.type)??"code"];if(l==="utf-8"||l==="base64"){const h=await window.api.readFile(o.path,l);if(!h.success)throw new Error(`could not read ${o.path}`);o.content=h.data}const u=Ee.getState(),d=Q_(u.activeDraftKey,u.activeSessionId)??u.stageDraft();return qe.getState().setCanvasOpen(!0),ls.getState().addFileAndSelect(d,o),n?.mention===!0&&ls.getState().addMentionedFile(d,o),await Lu(),{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 Wae({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 Lu(),{count:s}}}):[]}function RQe(){const e=g.useMemo(D_,[]),t=g.useRef(null);return g.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=iZ(a.value,e);zt(IQ(a.status,l))};n.getRegistration?.()?.then(r)?.catch(()=>{});const i=n.onRegistration(r);return()=>{s=!0,i?.()}},[e]),null}const AQe=`
|
|
686
686
|
/*
|
|
687
687
|
* A transition declared on ::-webkit-scrollbar-thumb does not animate in
|