local-operator-ui 0.33.1 → 0.33.2

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.
Files changed (67) hide show
  1. package/out/renderer/assets/{_basePickBy-C5kQFinZ.js → _basePickBy-xlxpiO1T.js} +1 -1
  2. package/out/renderer/assets/{_baseUniq-B8-ZWrt7.js → _baseUniq-DDGoglF4.js} +1 -1
  3. package/out/renderer/assets/{agent-details-page-CNfFll1o.js → agent-details-page-Bwm-2oEG.js} +1 -1
  4. package/out/renderer/assets/{agent-hub-page-CjbuplrT.js → agent-hub-page-C1EpDhw3.js} +1 -1
  5. package/out/renderer/assets/{agents-page-DfD6fXfN.js → agents-page-PK39vXwB.js} +3 -3
  6. package/out/renderer/assets/{arc-Ci9wnwwg.js → arc-esKC5fBq.js} +1 -1
  7. package/out/renderer/assets/{architectureDiagram-IEHRJDOE-DljLLBfc.js → architectureDiagram-IEHRJDOE-vHPyecr4.js} +1 -1
  8. package/out/renderer/assets/{blockDiagram-JOT3LUYC-C69FLs-Q.js → blockDiagram-JOT3LUYC-yIa2q0m5.js} +1 -1
  9. package/out/renderer/assets/{browser-page-BNpu-nAK.js → browser-page-XHmhbk6T.js} +1 -1
  10. package/out/renderer/assets/{browser-webauthn-prompt-DJxesanQ.js → browser-webauthn-prompt-BCVm2Nam.js} +1 -1
  11. package/out/renderer/assets/{c4Diagram-VJAJSXHY-DbCsAUEv.js → c4Diagram-VJAJSXHY-DEIV2mf7.js} +1 -1
  12. package/out/renderer/assets/channel-d7eB_3w7.js +1 -0
  13. package/out/renderer/assets/{chunk-4BMEZGHF-8nflKkkw.js → chunk-4BMEZGHF-J4FHIw-0.js} +1 -1
  14. package/out/renderer/assets/{chunk-A2AXSNBT-BB_9DE2p.js → chunk-A2AXSNBT-C8yRj1jW.js} +1 -1
  15. package/out/renderer/assets/{chunk-AEK57VVT-Bhhy2TE9.js → chunk-AEK57VVT-BK0W8dUh.js} +1 -1
  16. package/out/renderer/assets/{chunk-D6G4REZN-B-IzxGIu.js → chunk-D6G4REZN-Dq_ZCxZN.js} +1 -1
  17. package/out/renderer/assets/{chunk-RZ5BOZE2-BsuWp2Ze.js → chunk-RZ5BOZE2-BlWBa8Xw.js} +1 -1
  18. package/out/renderer/assets/{chunk-XZIHB7SX-Ixs9A_A4.js → chunk-XZIHB7SX-DklCB2jH.js} +1 -1
  19. package/out/renderer/assets/classDiagram-GIVACNV2-B8-AfLUb.js +1 -0
  20. package/out/renderer/assets/classDiagram-v2-COTLJTTW-B8-AfLUb.js +1 -0
  21. package/out/renderer/assets/clone-DgkTtKqC.js +1 -0
  22. package/out/renderer/assets/{conversation-input-sync-CyplegvR.js → conversation-input-sync-CGt-xTOz.js} +237 -237
  23. package/out/renderer/assets/{dagre-OKDRZEBW-eJT17F4E.js → dagre-OKDRZEBW-B8IR98Xu.js} +1 -1
  24. package/out/renderer/assets/{diagram-SSKATNLV-Bir90M9j.js → diagram-SSKATNLV-CZaWzWNi.js} +1 -1
  25. package/out/renderer/assets/{diagram-VNBRO52H-A1Kvgw0i.js → diagram-VNBRO52H-JU5IwY6U.js} +1 -1
  26. package/out/renderer/assets/{erDiagram-Q7BY3M3F-BTVZ_i0O.js → erDiagram-Q7BY3M3F-D1OQa11G.js} +1 -1
  27. package/out/renderer/assets/{flowDiagram-4HSFHLVR-wISyvxcE.js → flowDiagram-4HSFHLVR-Bf9QU0V7.js} +1 -1
  28. package/out/renderer/assets/{ganttDiagram-APWFNJXF-Dbq4vd4O.js → ganttDiagram-APWFNJXF-C_uLS0rJ.js} +1 -1
  29. package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-DmUVypwe.js → gitGraphDiagram-7IBYFJ6S-DJw6xk3j.js} +1 -1
  30. package/out/renderer/assets/{graph-7fG1KWbA.js → graph-BZNJIUOU.js} +1 -1
  31. package/out/renderer/assets/{index-CmNztGGk.js → index-CGpTS9bE.js} +1 -1
  32. package/out/renderer/assets/{index-Q2XNILJH.js → index-PjCSJDNc.js} +1 -1
  33. package/out/renderer/assets/{index-D-UhHAOS.js → index-nmr8j3me.js} +3 -3
  34. package/out/renderer/assets/{infoDiagram-PH2N3AL5-DZjhbW7N.js → infoDiagram-PH2N3AL5-BwUnxMKs.js} +1 -1
  35. package/out/renderer/assets/{journeyDiagram-U35MCT3I-hGAXMH3o.js → journeyDiagram-U35MCT3I-fgOqV0yr.js} +1 -1
  36. package/out/renderer/assets/{kanban-definition-NDS4AKOZ-B7Rt3hyk.js → kanban-definition-NDS4AKOZ-BM2bsU1o.js} +1 -1
  37. package/out/renderer/assets/{layout-CLs1bv5N.js → layout-BzFEkJ1O.js} +1 -1
  38. package/out/renderer/assets/{legacy-agents-page-QNQOMqtI.js → legacy-agents-page-sKeXQN2j.js} +1 -1
  39. package/out/renderer/assets/{mermaid.core-AkBpGaFA.js → mermaid.core-yndIRpa0.js} +5 -5
  40. package/out/renderer/assets/{mesh-page--4HRhvVR.js → mesh-page-ZyHoot0F.js} +1 -1
  41. package/out/renderer/assets/{mindmap-definition-ALO5MXBD-B8mXTFEB.js → mindmap-definition-ALO5MXBD-2kkvFKs1.js} +1 -1
  42. package/out/renderer/assets/{mini-Bj7ed-gO.js → mini-DqvWnXHB.js} +1 -1
  43. package/out/renderer/assets/{org-surface-gate-Dbdjr4YT.js → org-surface-gate-BCSHEY9w.js} +1 -1
  44. package/out/renderer/assets/{pieDiagram-IB7DONF6-DkK304mh.js → pieDiagram-IB7DONF6-oVtqKpOo.js} +1 -1
  45. package/out/renderer/assets/{projects-page-FnxH_c61.js → projects-page-DIUM-rpH.js} +1 -1
  46. package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-Dftj-6eV.js → quadrantDiagram-7GDLP6J5-CpSOFbKY.js} +1 -1
  47. package/out/renderer/assets/{radar-MK3ICKWK-DarjmquO.js → radar-MK3ICKWK-DG2fupFO.js} +1 -1
  48. package/out/renderer/assets/{radient-auth-buttons-BRZKhCLw.js → radient-auth-buttons-DUXYHbFc.js} +1 -1
  49. package/out/renderer/assets/{requirementDiagram-KVF5MWMF-CUBB3WtQ.js → requirementDiagram-KVF5MWMF-dFx9XstI.js} +1 -1
  50. package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-CWYInz9O.js → sankeyDiagram-QLVOVGJD-CQbkDYHX.js} +1 -1
  51. package/out/renderer/assets/{schedules-page-CH-Bi8gk.js → schedules-page-4Pa4fKXg.js} +1 -1
  52. package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-BkQDNnX8.js → sequenceDiagram-X6HHIX6F-DfusOgVT.js} +1 -1
  53. package/out/renderer/assets/{settings-page-ph6qP9Ie.js → settings-page-6xA1GAGZ.js} +1 -1
  54. package/out/renderer/assets/{stateDiagram-DGXRK772-CWs3-JgW.js → stateDiagram-DGXRK772-BiT2Hjfl.js} +1 -1
  55. package/out/renderer/assets/{stateDiagram-v2-YXO3MK2T-_iAPQjAT.js → stateDiagram-v2-YXO3MK2T-D2L4nJta.js} +1 -1
  56. package/out/renderer/assets/{timeline-definition-BDJGKUSR-CT-joH3a.js → timeline-definition-BDJGKUSR-CXpImtBQ.js} +1 -1
  57. package/out/renderer/assets/{use-download-agent-mutation-bZLqwaCM.js → use-download-agent-mutation-BkceQylm.js} +1 -1
  58. package/out/renderer/assets/{use-memberships-query-6gVyI6R0.js → use-memberships-query-N1i6wDBt.js} +1 -1
  59. package/out/renderer/assets/{use-session-snapshot-DLuR153j.js → use-session-snapshot-CvDP9p_a.js} +1 -1
  60. package/out/renderer/assets/{xychartDiagram-VJFVF3MP-BaUKXp9G.js → xychartDiagram-VJFVF3MP-LmQvWrKa.js} +1 -1
  61. package/out/renderer/index.html +2 -2
  62. package/out/renderer/mini.html +3 -3
  63. package/package.json +1 -1
  64. package/out/renderer/assets/channel-CvT_zN3z.js +0 -1
  65. package/out/renderer/assets/classDiagram-GIVACNV2-xp14m7NS.js +0 -1
  66. package/out/renderer/assets/classDiagram-v2-COTLJTTW-xp14m7NS.js +0 -1
  67. package/out/renderer/assets/clone-BaQ3C8Yt.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./agent-details-page-CNfFll1o.js","./index-DDd7NnXP.js","./index-DxRO8eiH.css","./use-memberships-query-6gVyI6R0.js","./conversation-input-sync-CyplegvR.js","./ui-preferences-store-33sdgyd1.js","./error-boundary-BytCV_16.js","./conversation-input-sync-CIGg7Rga.css","./use-download-agent-mutation-bZLqwaCM.js","./en-US-BcB1DWxG.js","./book-open-DYd3X6Ks.js","./console-mirror-BsrFX_mx.js","./console-mirror-DOrYoP_4.css","./agent-hub-page-CjbuplrT.js","./page-header-BK4_E8_S.js","./radient-auth-buttons-BRZKhCLw.js","./org-surface-gate-Dbdjr4YT.js","./format-CZUObkkr.js","./agents-page-DfD6fXfN.js","./schedules-page-CH-Bi8gk.js","./parseISO-CZfAC2_J.js","./projects-page-FnxH_c61.js","./use-session-snapshot-DLuR153j.js","./browser-page-BNpu-nAK.js","./mesh-page--4HRhvVR.js","./settings-page-ph6qP9Ie.js","./settings-section-DbH2vofx.js","./browser-webauthn-prompt-DJxesanQ.js"])))=>i.map(i=>d[i]);
2
- import{r as g,j as u,c as T,b as He,f as h2,l as Y9,u as X9,s as Q9,v as Ry,a as J9,R as Z9}from"./index-DDd7NnXP.js";import{ah as Ee,dE as e$,dF as Ay,dG as Db,c8 as Sv,bD as oh,c6 as tc,bM as pk,aG as Qr,a7 as Fi,a8 as Jr,ax as Zt,aN as Fs,aO as Pr,u as Qn,aw as Sc,aU as Nm,c9 as t$,aV as Mm,dH as mL,dI as n$,a as Zr,b as Mt,c as mf,dJ as Dg,dK as r$,dL as s$,dM as i$,aR as vL,aQ as di,dN as gk,dO as Ho,dP as Xw,dQ as Qw,d8 as xu,ca as xL,cH as id,ct as Ev,cs as a$,cr as Vr,cu as an,dR as bL,dS as o$,dT as Fy,dU as f2,dV as l$,dW as c$,dX as Dy,dY as u$,dZ as d$,d_ as h$,d$ as f$,at as lh,e0 as Py,e1 as p2,e2 as p$,e3 as wL,e4 as g$,e5 as CL,e6 as m$,e7 as v$,e8 as yL,e9 as Pb,ea as Ib,eb as x$,ec as b$,ed as w$,ee as g2,ef as C$,eg as Jd,eh as SL,d as At,ei as y$,ej as S$,ek as E$,el as k$,em as _$,en as T$,eo as R$,ep as EL,eq as A$,er as F$,es as D$,et as m2,eu as P$,ev as I$,ew as Na,ex as kL,ey as _L,ez as N$,eA as M$,eB as v2,eC as O$,eD as L$,aW as vf,eE as B$,eF as j$,eG as H$,b2 as TL,eH as U$,eI as G$,eJ as $$,eK as V$,eL as hc,eM as W$,eN as z$,eO as Lh,eP as q$,eQ as x2,eR as K$,eS as Y$,eT as X$,eU as Q$,eV as J$,eW as Z$,cL as eV,eX as tV,eY as nV,cO as rV,T as Ec,eZ as mk,aA as sa,dz as sV,e_ as iV,aj as bu,e$ as aV,f0 as oV,f1 as lV,f2 as cV,ay as uV,f3 as RL,aY as AL,a_ as al,f4 as dV,aS as vk,cI as Nb,aZ as Om,bI as Bu,f5 as xk,aH as bk,f6 as FL,f7 as Lm,f8 as hV,f9 as wk,bG as fV,fa as pV,fb as gV,fc as DL,fd as PL,fe as mV,ff as vV,fg as xV,fh as bV,fi as wV,fj as CV,fk as yV,al as pr,ak as ch,fl as b2,fm as w2,fn as SV,fo as C2,fp as y2,fq as EV,fr as kV,ch as Ck,fs as Mb,ft as oa,fu as _V,fv as kn,fw as Xt,fx as Bm,fy as Pg,fz as Ob,fA as yk,fB as Lb,fC as TV,fD as RV,fE as AV,fF as dn,fG as Ig,fH as IL,fI as qi,fJ as ju,fK as FV,fL as DV,ao as Ca,fM as PV,fN as IV,fO as S2,fP as NV,fQ as MV,fR as OV,fS as LV,fT as BV,fU as uh,fV as NL,fW as ML,fX as Sk,fY as Qv,fZ as OL,Q as Ek,f_ as Iy,f$ as kk,g0 as Jw,g1 as jV,g2 as HV,g3 as UV,g4 as Zd,g5 as Ny,g6 as LL,g7 as GV,g8 as BL,g9 as $V,ga as VV,gb as WV,gc as zV,gd as qV,ge as KV,gf as YV,gg as XV,gh as QV,gi as JV,gj as Jv,gk as ZV,gl as eW,gm as tW,gn as nW,go as rW,gp as sW,gq as _k,gr as iW,gs as jL,B as Ke,gt as aW,gu as Bb,gv as jm,bL as HL,bP as oW,gw as E2,b0 as UL,gx as lW,gy as cW,gz as uW,gA as dW,gB as hW,gC as fW,aq as Cs,gD as pW,gE as gW,gF as mW,gG as vW,gH as xW,gI as bW,gJ as wW,gK as CW,gL as yW,gM as SW,gN as EW,gO as Bh,gP as jb,gQ as Tk,gR as kW,gS as _W,gT as TW,gU as GL,gV as RW,gW as k2,gX as AW,gY as Rk,gZ as FW,g_ as Ak,g$ as Hm,h0 as Um,h1 as DW,h2 as $L,h3 as Ng,h4 as PW,h5 as IW,h6 as NW,h7 as MW,h8 as OW,h9 as LW,ha as _2,hb as VL,cd as WL,hc as BW,hd as jW,cl as Fk,he as HW,hf as UW,hg as T2,hh as Hb,hi as GW,hj as $W,hk as VW,hl as WW,hm as zL,U as zW,hn as Zw,ho as qW,hp as qL,bc as Yp,hq as KL,dC as KW,hr as YW,bO as Dk,hs as nc,ht as YL,hu as XL,hv as XW,b8 as QW,b9 as Ub,b5 as jh,hw as QL,hx as JW,hy as ZW,hz as ez,cq as Xp,hA as Hh,aP as Gm,bd as Hu,hB as R2,hC as tz,hD as dh,hE as Zv,hF as A2,hG as nz,hH as rz,hI as sz,hJ as iz,cm as az,hK as Pk,hL as F2,hM as oz,hN as lz,hO as cz,hP as JL,hQ as uz,hR as dz,d2 as hz,hS as fz,hT as ZL,hU as pz,hV as gz,hW as S0,hX as e3,hY as My,Z as D2,hZ as mz,h_ as vz,h$ as xz,i0 as bz,i1 as wu,d4 as t3,d5 as Ik,i2 as wz,i3 as Cz,i4 as yz,i5 as n3,cb as Sz,i6 as P2,a4 as I2,i7 as Ez,i8 as r3,i9 as ex,as as kz,ia as _z,ib as Tz,ic as Rz,id as Az,ie as Jf,ig as Zf,ih as Fz,ii as Dz,ij as Pz,ik as s3,il as Iz,im as i3,io as Oy,ip as Ly,iq as eC,ir as Nz,is as Mz,it as $d,iu as Oz,ag as tx,ai as a3,am as Lz,$ as N2,iv as Bz,iw as jz,ix as Hz,iy as Uz,iz as Gz,iA as $z,iB as Vz,iC as o3,iD as Wz,iE as By,iF as kv,iG as l3,iH as c3,iI as zz,iJ as qz,iK as Kz,iL as Yz,iM as u3,iN as Nk,iO as Xz,iP as Qz,iQ as Mk,b3 as Jz,iR as Zz,iS as eq,iT as tq,iU as nq,iV as rq,iW as sq,iX as iq,iY as aq,iZ as oq,i_ as lq,i$ as cq,b1 as uq,j0 as M2,j1 as dq,j2 as tC,j3 as O2,j4 as hq,j5 as fq,j6 as pq,j7 as gq,j8 as mq,j9 as vq,ja as xq,jb as bq,jc as wq,jd as Cq,je as yq,jf as Sq,dt as L2,jg as Eq,jh as B2,ji as kq,jj as _q,ab as Tq,ac as Rq,ad as Aq,ae as Fq,af as Dq,jk as Pq,jl as Iq,jm as Nq,jn as Mq,jo as Oq,jp as Lq,jq as Bq,jr as j2,js as jq,an as Hq,jt as Uq,ju as Gq,jv as $q,jw as H2,cP as d3,jx as Vq,aX as h3,jy as f3,jz as Wq,jA as Vs,jB as Bl,jC as p3,jD as g3,cA as m3,jE as v3,jF as Ok,jG as vi,jH as zq,jI as qq,jJ as Kq,jK as Yq,jL as Xq,jM as Qq,jN as Jq,jO as Zq,jP as eK,jQ as tK,jR as nK,jS as rK,jT as sK,jU as iK,jV as jy,jW as aK,jX as U2,jY as x3,jZ as oK,j_ as lK,j$ as cK,k0 as G2,k1 as uK,k2 as dK,cT as hK,a5 as b3,k3 as fK,k4 as pK,k5 as gK,k6 as mK,aM as w3,cU as $2,k7 as vK,be as pl,k8 as xK,k9 as bK,ka as wK,kb as Qs,a$ as V2,kc as nx,kd as W2,a3 as CK,ke as yK,kf as SK,kg as C3,kh as y3,ki as S3,au as EK,kj as kK,av as _K}from"./conversation-input-sync-CyplegvR.js";import{c as st,a2 as TK,a3 as E3,a4 as RK,a5 as AK,a6 as FK,a7 as DK,a8 as PK,a9 as IK,aa as ep,ab as NK,ac as $m,S as Hn,k as gl,B as ue,L as Ir,I as wr,T as Lk,C as es,X as Un,ad as Hy,ae as uu,r as xo,q as Ji,i as Bk,a as Mg,f as Je,J as xf,af as bf,ag as wf,ah as jk,ai as Uu,A as fo,aj as Hk,s as Og,t as Lg,u as Bg,v as jg,w as Hg,D as kc,l as ol,m as _c,n as rx,o as Ei,p as tn,ak as Gb,j as Cu,$ as Uk,al as Uy,am as MK,an as OK,z as k3,F as _3,G as Gy,a1 as T3,a0 as LK,P as sx,K as BK,N as Ug,ao as jK,b as R3,ap as HK,d as A3,aq as UK,ar as z2,Q as GK,Z as $y,O as $K,as as Vy,at as VK,au as F3,y as Gk,H as WK,e as zK,R as qK,U as KK,V as YK,W as XK,Y as QK,av as JK,aw as ZK,ax as eY,ay as tY,az as D3,g as q2,h as K2,E as nY}from"./error-boundary-BytCV_16.js";import{u as ct,c as $b,g as Y2,h as rY,i as sY,j as iY,k as Rp,l as aY,n as P3,S as nC,o as oY,q as X2,s as Q2,v as lY,w as cY,x as Vc,y as uY,D as E0,z as dY,A as hY,B as fY,E as J2,F as Z2,G as pY,H as gY,I as mY,J as eA,K as tA,L as nA,M as vY,N as xY,O as bY,P as wY,Q as CY,R as rA,U as yY,V as SY,W as sA,X as EY,f as iA,Y as kY,e as _Y,Z as TY,_ as RY,$ as AY,a0 as tp,d as aA,C as oA,b as lA,a1 as k0,a2 as cA,a3 as uA,a4 as dA,a5 as FY,a6 as DY,a7 as PY,a8 as IY,a9 as NY,p as MY,aa as hA,ab as OY}from"./ui-preferences-store-33sdgyd1.js";import{C as LY}from"./console-mirror-BsrFX_mx.js";const Wy=8e3,I3=1e4;function BY(e){return e?`“${e}”`:"Conversation"}const jY="archived.";function HY(e){return Ee.getState().archiveFacts[e]}function UY(e){const t=Ee.getState(),n=t.archiveFacts[e];return n?n.archived:t.sessions.find(r=>r.session_id===e)?.archived}function GY(){const e=Ee(t=>t.archiveUndo);g.useEffect(()=>{if(e===null)return;let t=!1;const n=()=>{t||(t=!0,s())},r=()=>{n();const i=Ee.getState().archiveUndo;i!==null&&i.sessionId===e.sessionId&&i.at===e.at&&Ee.getState().setArchiveUndo(null)},s=Ee.subscribe(()=>{const i=HY(e.sessionId);i!==void 0&&!i.answered||e$(e.archived,UY(e.sessionId))||r()});return n},[e])}function $Y(e){return e===1?"Draft":`${e} drafts`}const VY="discarded.",WY=e=>{const t=Ay(e),n=t.length,r=t.filter(o=>!o.active).length,s=n===1?"chat":"chats",i=e.filter(o=>Db(o)!==null&&Ay([o]).length===0).length,a=[`Mark ${n} unread ${s} as read${r>0?`, including ${r} 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:r>0?`, including ${r} in Previous chats`:""}},N3=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.`,zY=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?N3(e.deferred):null].filter(r=>r!==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(" ")}},rC="archive",fA="drafts-undo",pA="bulk-read-deferral",qY=8e3;function KY(){const e=Ee(h=>h.archiveFailure),t=Ee(h=>h.archiveUndo),n=Ee(h=>h.draftsUndo),r=Ee(h=>h.bulkReadDeferral),s=Ee(h=>h.clearArchiveFailure),i=Ee(h=>h.setArchiveUndo),a=Ee(h=>h.setSessionArchived),o=Ee(h=>h.restoreDraftsUndo);GY();const l=g.useRef(null);g.useEffect(()=>{if(e===null&&t===null){if(l.current===null)return;l.current=null,Sv(rC);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):s());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){oh(`Could not ${e.archived?"archive":"unarchive"} “${e.title}”.${e.detail?` ${e.detail}`:""}`,{id:rC,duration:I3,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&&tc(u.jsxs("span",{className:T("flex min-w-0 items-baseline gap-1"),children:[u.jsx("span",{className:T("min-w-0 truncate"),children:BY(t.title)}),u.jsx("span",{className:T("shrink-0"),children:jY})]}),{id:rC,duration:Wy,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,s,a]);const c=g.useRef(!1);g.useEffect(()=>{if(n===null){if(!c.current)return;c.current=!1,Sv(fA);return}c.current=!0;const h=()=>{const f=Ee.getState();f.draftsUndo?.at===n.at&&(f.setDraftsUndo(null),c.current=!1)};tc(u.jsxs("span",{className:T("flex min-w-0 items-baseline gap-1"),children:[u.jsx("span",{className:T("min-w-0 truncate"),children:$Y(n.keys.length)}),u.jsx("span",{className:T("shrink-0"),children:VY})]}),{id:fA,duration:Wy,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(r===null){if(!d.current)return;d.current=!1,Sv(pA);return}d.current=!0;const h=()=>{const f=Ee.getState();f.bulkReadDeferral?.at===r.at&&(f.clearBulkReadDeferral(),d.current=!1)};tc(N3(r.count),{id:pA,duration:qY,onAutoClose:h,onDismiss:h})},[r]),null}var Sa,Fe=typeof window<"u"?window:void 0,ri=typeof globalThis<"u"?globalThis:Fe,M3=Array.prototype,gA=M3.forEach,mA=M3.indexOf,yi=ri?.navigator,mt=ri?.document,ti=ri?.location,zy=ri?.fetch,qy=ri!=null&&ri.XMLHttpRequest&&"withCredentials"in new ri.XMLHttpRequest?ri.XMLHttpRequest:void 0,vA=ri?.AbortController,Tr=yi?.userAgent,jt=Fe??{},Wo={DEBUG:!1,LIB_VERSION:"1.235.6"},sC="$copy_autocapture",YY=["$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"})(Sa||(Sa={}));var XY=["fatal","error","warning","log","info","debug"];function Yt(e,t){return e.indexOf(t)!==-1}var Vb=function(e){return e.trim()},$k=function(e){return e.replace(/^\$/,"")},QY=Array.isArray,O3=Object.prototype,L3=O3.hasOwnProperty,Wb=O3.toString,or=QY||function(e){return Wb.call(e)==="[object Array]"},Ta=e=>typeof e=="function",lr=e=>e===Object(e)&&!or(e),eh=e=>{if(lr(e)){for(var t in e)if(L3.call(e,t))return!1;return!0}return!1},ft=e=>e===void 0,Ar=e=>Wb.call(e)=="[object String]",Ky=e=>Ar(e)&&e.trim().length===0,Tc=e=>e===null,En=e=>ft(e)||Tc(e),qs=e=>Wb.call(e)=="[object Number]",qo=e=>Wb.call(e)==="[object Boolean]",JY=e=>e instanceof FormData,ZY=e=>Yt(YY,e),B3=e=>{var t={_log:function(n){if(Fe&&(Wo.DEBUG||jt.POSTHOG_DEBUG)&&!ft(Fe.console)&&Fe.console){for(var r=("__rrweb_original__"in Fe.console[n])?Fe.console[n].__rrweb_original__:Fe.console[n],s=arguments.length,i=new Array(s>1?s-1:0),a=1;a<s;a++)i[a-1]=arguments[a];r(e,...i)}},info:function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];t._log("log",...r)},warn:function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];t._log("warn",...r)},error:function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];t._log("error",...r)},critical:function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];console.error(e,...r)},uninitializedWarning:n=>{t.error("You must initialize PostHog before calling ".concat(n))},createLogger:n=>B3("".concat(e," ").concat(n))};return t},wt=B3("[PostHog.js]"),Ds=wt.createLogger,eX=Ds("[ExternalScriptsLoader]"),xA=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return eX.warn("".concat(t," was requested but loading of external scripts is disabled.")),n("Loading of external scripts is disabled");var r=mt?.querySelectorAll("script");if(r){for(var s=0;s<r.length;s++)if(r[s].src===t)return n()}var i=()=>{if(!mt)return n("document not found");var a=mt.createElement("script");if(a.type="text/javascript",a.crossOrigin="anonymous",a.src=t,a.onload=c=>n(void 0,c),a.onerror=c=>n(c),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=mt.querySelectorAll("body > script");l.length>0?(o=l[0].parentNode)===null||o===void 0||o.insertBefore(a,l[0]):mt.body.appendChild(a)};mt!=null&&mt.body?i():mt?.addEventListener("DOMContentLoaded",i)};function bA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Oe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?bA(Object(n),!0).forEach(function(r){nt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bA(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function nt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j3(e,t){if(e==null)return{};var n,r,s=function(a,o){if(a==null)return{};var l,c,d={},h=Object.keys(a);for(c=0;c<h.length;c++)l=h[c],o.indexOf(l)>=0||(d[l]=a[l]);return d}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}jt.__PosthogExtensions__=jt.__PosthogExtensions__||{},jt.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{var r="/static/".concat(t,".js")+"?v=".concat(e.version);if(t==="remote-config"&&(r="/array/".concat(e.config.token,"/config.js")),t==="toolbar"){var s=3e5,i=Math.floor(Date.now()/s)*s;r="".concat(r,"&t=").concat(i)}var a=e.requestRouter.endpointFor("assets",r);xA(e,a,n)},jt.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);xA(e,r,n)};var ix={};function rc(e,t,n){if(or(e)){if(gA&&e.forEach===gA)e.forEach(t,n);else if("length"in e&&e.length===+e.length){for(var r=0,s=e.length;r<s;r++)if(r in e&&t.call(n,e[r],r)===ix)return}}}function Fn(e,t,n){if(!En(e)){if(or(e))return rc(e,t,n);if(JY(e)){for(var r of e.entries())if(t.call(n,r[1],r[0])===ix)return}else for(var s in e)if(L3.call(e,s)&&t.call(n,e[s],s)===ix)return}}var gr=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return rc(n,function(s){for(var i in s)s[i]!==void 0&&(e[i]=s[i])}),e},_v=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return rc(n,function(s){rc(s,function(i){e.push(i)})}),e};function Tv(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var wA=function(e){try{return e()}catch{return}},tX=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.apply(this,n)}catch(s){wt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),wt.critical(s)}}},Gg=function(e){var t={};return Fn(e,function(n,r){Ar(n)&&n.length>0&&(t[r]=n)}),t};function nX(e,t){return n=e,r=i=>Ar(i)&&!Tc(t)?i.slice(0,t):i,s=new Set,function i(a,o){return a!==Object(a)?r?r(a,o):a:s.has(a)?void 0:(s.add(a),or(a)?(l=[],rc(a,c=>{l.push(i(c))})):(l={},Fn(a,(c,d)=>{s.has(c)||(l[d]=i(c,d))})),l);var l}(n);var n,r,s}var rX=["herokuapp.com","vercel.app","netlify.app"];function sX(e){var t=e?.hostname;if(!Ar(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of rX)if(n===r)return!1;return!0}function H3(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function vr(e,t,n,r){var{capture:s=!1,passive:i=!0}=r??{};e?.addEventListener(t,n,{capture:s,passive:i})}var U3="$people_distinct_id",Ap="__alias",Fp="__timers",CA="$autocapture_disabled_server_side",Yy="$heatmaps_enabled_server_side",yA="$exception_capture_enabled_server_side",SA="$web_vitals_enabled_server_side",G3="$dead_clicks_enabled_server_side",EA="$web_vitals_allowed_metrics",Xy="$session_recording_enabled_server_side",kA="$console_log_recording_enabled_server_side",_A="$session_recording_network_payload_capture",TA="$session_recording_masking",RA="$session_recording_canvas_recording",AA="$replay_sample_rate",FA="$replay_minimum_duration",DA="$replay_script_config",ax="$sesid",Dp="$session_is_sampled",iC="$session_recording_url_trigger_activated_session",aC="$session_recording_event_trigger_activated_session",th="$enabled_feature_flags",Rv="$early_access_features",Qy="$feature_flag_details",Pp="$stored_person_properties",Qc="$stored_group_properties",Jy="$surveys",_0="$surveys_activated",ox="$flag_call_reported",Go="$user_state",Zy="$client_session_props",eS="$capture_rate_limit",tS="$initial_campaign_params",nS="$initial_referrer_info",rS="$initial_person_info",lx="$epp",$3="__POSTHOG_TOOLBAR__",PA="$posthog_cookieless",iX=[U3,Ap,"__cmpns",Fp,Xy,Yy,ax,th,Go,Rv,Qy,Qc,Pp,Jy,ox,Zy,eS,tS,nS,lx];function IA(e){var t;return e instanceof Element&&(e.id===$3||!((t=e.closest)===null||t===void 0||!t.call(e,".toolbar-global-fade-container")))}function zb(e){return!!e&&e.nodeType===1}function sc(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function V3(e){return!!e&&e.nodeType===3}function W3(e){return!!e&&e.nodeType===11}function Vk(e){return e?Vb(e).split(/\s+/):[]}function NA(e){var t=Fe?.location.href;return!!(t&&e&&e.some(n=>t.match(n)))}function cx(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 Vk(t)}function z3(e){return En(e)?null:Vb(e).split(/(\s+)/).filter(t=>Uh(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function qb(e){var t="";return iS(e)&&!Y3(e)&&e.childNodes&&e.childNodes.length&&Fn(e.childNodes,function(n){var r;V3(n)&&n.textContent&&(t+=(r=z3(n.textContent))!==null&&r!==void 0?r:"")}),Vb(t)}function q3(e){return ft(e.target)?e.srcElement||null:(t=e.target)!==null&&t!==void 0&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var sS=["a","button","form","input","select","textarea","label"];function K3(e){var t=e.parentNode;return!(!t||!zb(t))&&t}function aX(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;if(!Fe||!e||sc(e,"html")||!zb(e)||n!=null&&n.url_allowlist&&!NA(n.url_allowlist)||n!=null&&n.url_ignorelist&&NA(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,c=e;c.parentNode&&!sc(c,"body");)if(W3(c.parentNode))o.push(c.parentNode.host),c=c.parentNode.host;else{if(!(l=K3(c)))break;if(r||sS.indexOf(l.tagName.toLowerCase())>-1)a=!0;else{var d=Fe.getComputedStyle(l);d&&d.getPropertyValue("cursor")==="pointer"&&(a=!0)}o.push(l),c=l}if(!function(p,m){var v=m?.element_allowlist;if(ft(v))return!0;var x=function(C){if(v.some(E=>C.tagName.toLowerCase()===E))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(ft(v))return!0;var x=function(C){if(v.some(E=>C.matches(E)))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=Fe.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(s||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(t.type)>=0;default:return a?(s||["click"]).indexOf(t.type)>=0:(s||["click"]).indexOf(t.type)>=0&&(sS.indexOf(f)>-1||e.getAttribute("contenteditable")==="true")}}function iS(e){for(var t=e;t.parentNode&&!sc(t,"body");t=t.parentNode){var n=cx(t);if(Yt(n,"ph-sensitive")||Yt(n,"ph-no-capture"))return!1}if(Yt(cx(e),"ph-include"))return!0;var r=e.type||"";if(Ar(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=e.name||e.id||"";return!(Ar(s)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,"")))}function Y3(e){return!!(sc(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||sc(e,"select")||sc(e,"textarea")||e.getAttribute("contenteditable")==="true")}var X3="(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})",oX=new RegExp("^(?:".concat(X3,")$")),lX=new RegExp(X3),Q3="\\d{3}-?\\d{2}-?\\d{4}",cX=new RegExp("^(".concat(Q3,")$")),uX=new RegExp("(".concat(Q3,")"));function Uh(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(En(e)||Ar(e)&&(e=Vb(e),(t?oX:lX).test((e||"").replace(/[- ]/g,""))||(t?cX:uX).test(e)))}function J3(e){var t=qb(e);return Uh(t="".concat(t," ").concat(Z3(e)).trim())?t:""}function Z3(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Fn(e.childNodes,function(n){var r;if(n&&((r=n.tagName)===null||r===void 0?void 0:r.toLowerCase())==="span")try{var s=qb(n);t="".concat(t," ").concat(s).trim(),n.childNodes&&n.childNodes.length&&(t="".concat(t," ").concat(Z3(n)).trim())}catch(i){wt.error("[AutoCapture]",i)}}),t}function dX(e){return function(t){var n=t.map(r=>{var s,i,a="";if(r.tag_name&&(a+=r.tag_name),r.attr_class)for(var o of(r.attr_class.sort(),r.attr_class))a+=".".concat(o.replace(/"/g,""));var l=Oe(Oe(Oe(Oe({},r.text?{text:r.text}:{}),{},{"nth-child":(s=r.nth_child)!==null&&s!==void 0?s:0,"nth-of-type":(i=r.nth_of_type)!==null&&i!==void 0?i:0},r.href?{href:r.href}:{}),r.attr_id?{attr_id:r.attr_id}:{}),r.attributes),c={};return Tv(l).sort((d,h)=>{var[f]=d,[p]=h;return f.localeCompare(p)}).forEach(d=>{var[h,f]=d;return c[MA(h.toString())]=MA(f.toString())}),a+=":",a+=Tv(l).map(d=>{var[h,f]=d;return"".concat(h,'="').concat(f,'"')}).join("")});return n.join(";")}(function(t){return t.map(n=>{var r,s,i={text:(r=n.$el_text)===null||r===void 0?void 0:r.slice(0,400),tag_name:n.tag_name,href:(s=n.attr__href)===null||s===void 0?void 0:s.slice(0,2048),attr_class:hX(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return Tv(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 MA(e){return e.replace(/"|\\"/g,'\\"')}function hX(e){var t=e.attr__class;return t?or(t)?t:Vk(t):void 0}class e4{constructor(){this.clicks=[]}isRageClick(t,n,r){var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(t-s.x)+Math.abs(n-s.y)<30&&r-s.timestamp<1e3){if(this.clicks.push({x:t,y:n,timestamp:r}),this.clicks.length===3)return!0}else this.clicks=[{x:t,y:n,timestamp:r}];return!1}}var fX=["localhost","127.0.0.1"],hh=e=>{var t=mt?.createElement("a");return ft(t)?null:(t.href=e,t)},pX=function(e){var t,n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",s=[];return Fn(e,function(i,a){ft(i)||ft(a)||a==="undefined"||(t=encodeURIComponent((o=>o instanceof File)(i)?i.name:i.toString()),n=encodeURIComponent(a),s[s.length]=n+"="+t)}),s.join(r)},ux=function(e,t){for(var n,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<r.length;s++){var i=r[s].split("=");if(i[0]===t){n=i;break}}if(!or(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch{wt.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},oC=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split("#"),s=r[0]||"",i=r[1],a=s.split("?"),o=a[1],l=a[0],c=(o||"").split("&"),d=[],h=0;h<c.length;h++){var f=c[h].split("=");or(f)&&(t.includes(f[0])?d.push(f[0]+"="+n):d.push(c[h]))}var p=l;return o!=null&&(p+="?"+d.join("&")),i!=null&&(p+="#"+i),p},dx=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},OA=Ds("[AutoCapture]");function lC(e,t){return t.length>e?t.slice(0,e)+"...":t}function gX(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!zb(t));return t}function mX(e,t,n,r){var s=e.tagName.toLowerCase(),i={tag_name:s};sS.indexOf(s)>-1&&!n&&(s.toLowerCase()==="a"||s.toLowerCase()==="button"?i.$el_text=lC(1024,J3(e)):i.$el_text=lC(1024,qb(e)));var a=cx(e);a.length>0&&(i.classes=a.filter(function(d){return d!==""})),Fn(e.attributes,function(d){var h;if((!Y3(e)||["name","id","class","aria-label"].indexOf(d.name)!==-1)&&(r==null||!r.includes(d.name))&&!t&&Uh(d.value)&&(h=d.name,!Ar(h)||h.substring(0,10)!=="_ngcontent"&&h.substring(0,7)!=="_nghost")){var f=d.value;d.name==="class"&&(f=Vk(f).join(" ")),i["attr__"+d.name]=lC(1024,f)}});for(var o=1,l=1,c=e;c=gX(c);)o++,c.tagName===e.tagName&&l++;return i.nth_child=o,i.nth_of_type=l,i}function vX(e,t){for(var n,r,{e:s,maskAllElementAttributes:i,maskAllText:a,elementAttributeIgnoreList:o,elementsChainAsString:l}=t,c=[e],d=e;d.parentNode&&!sc(d,"body");)W3(d.parentNode)?(c.push(d.parentNode.host),d=d.parentNode.host):(c.push(d.parentNode),d=d.parentNode);var h,f=[],p={},m=!1,v=!1;if(Fn(c,E=>{var y=iS(E);E.tagName.toLowerCase()==="a"&&(m=E.getAttribute("href"),m=y&&m&&Uh(m)&&m),Yt(cx(E),"ph-no-capture")&&(v=!0),f.push(mX(E,i,a,o));var k=function(_){if(!iS(_))return{};var I={};return Fn(_.attributes,function(A){if(A.name&&A.name.indexOf("data-ph-capture-attribute")===0){var P=A.name.replace("data-ph-capture-attribute-",""),N=A.value;P&&N&&Uh(N)&&(I[P]=N)}}),I}(E);gr(p,k)}),v)return{props:{},explicitNoCapture:v};if(a||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?f[0].$el_text=J3(e):f[0].$el_text=qb(e)),m){var x,b;f[0].attr__href=m;var w=(x=hh(m))===null||x===void 0?void 0:x.host,C=Fe==null||(b=Fe.location)===null||b===void 0?void 0:b.host;w&&C&&w!==C&&(h=m)}return{props:gr({$event_type:s.type,$ce_version:1},l?{}:{$elements:f},{$elements_chain:dX(f)},(n=f[0])!==null&&n!==void 0&&n.$el_text?{$el_text:(r=f[0])===null||r===void 0?void 0:r.$el_text}:{},h&&s.type==="click"?{$external_click_url:h}:{},p)}}let xX=class{constructor(t){nt(this,"_initialized",!1),nt(this,"_isDisabledServerSide",null),nt(this,"rageclicks",new e4),nt(this,"_elementsChainAsString",!1),this.instance=t,this._elementSelectors=null}get config(){var t,n,r=lr(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=(t=r.url_allowlist)===null||t===void 0?void 0:t.map(s=>new RegExp(s)),r.url_ignorelist=(n=r.url_ignorelist)===null||n===void 0?void 0:n.map(s=>new RegExp(s)),r}_addDomEventHandlers(){if(this.isBrowserSupported()){if(Fe&&mt){var t=r=>{r=r||Fe?.event;try{this._captureEvent(r)}catch(s){OA.error("Failed to capture event",s)}};if(vr(mt,"submit",t,{capture:!0}),vr(mt,"change",t,{capture:!0}),vr(mt,"click",t,{capture:!0}),this.config.capture_copied_text){var n=r=>{r=r||Fe?.event,this._captureEvent(r,sC)};vr(mt,"copy",n,{capture:!0}),vr(mt,"cut",n,{capture:!0})}}}else OA.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({[CA]:!!t.autocapture_opt_out}),this._isDisabledServerSide=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this._elementSelectors=t}getElementSelectors(t){var n,r=[];return(n=this._elementSelectors)===null||n===void 0||n.forEach(s=>{var i=mt?.querySelectorAll(s);i?.forEach(a=>{t===a&&r.push(s)})}),r}get isEnabled(){var t,n,r=(t=this.instance.persistence)===null||t===void 0?void 0:t.props[CA],s=this._isDisabledServerSide;if(Tc(s)&&!qo(r)&&!this.instance.config.advanced_disable_decide)return!1;var i=(n=this._isDisabledServerSide)!==null&&n!==void 0?n:!!r;return!!this.instance.config.autocapture&&!i}_captureEvent(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"$autocapture";if(this.isEnabled){var r,s=q3(t);V3(s)&&(s=s.parentNode||null),n==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!==null&&r!==void 0&&r.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this._captureEvent(t,"$rageclick");var i=n===sC;if(s&&aX(s,t,this.config,i,i?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:o}=vX(s,{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(s);if(l&&l.length>0&&(a.$element_selectors=l),n===sC){var c,d=z3(Fe==null||(c=Fe.getSelection())===null||c===void 0?void 0:c.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 Ta(mt?.querySelectorAll)}};Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return qs(e)&&isFinite(e)&&Math.floor(e)===e});var LA="0123456789abcdef";let bX=class aS{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,r,s){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(s)||t<0||n<0||r<0||s<0||t>0xffffffffffff||n>4095||r>1073741823||s>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|r>>>24,i[9]=r>>>16,i[10]=r>>>8,i[11]=r,i[12]=s>>>24,i[13]=s>>>16,i[14]=s>>>8,i[15]=s,new aS(i)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+LA.charAt(this.bytes[n]>>>4)+LA.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 aS(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;n<16;n++){var r=this.bytes[n]-t.bytes[n];if(r!==0)return Math.sign(r)}return 0}},wX=class{constructor(){nt(this,"timestamp",0),nt(this,"counter",0),nt(this,"random",new CX)}generate(){var t=this.generateOrAbort();if(ft(t)){this.timestamp=0;var n=this.generateOrAbort();if(ft(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 bX.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 BA,t4=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};Fe&&!ft(Fe.crypto)&&crypto.getRandomValues&&(t4=e=>crypto.getRandomValues(e));let CX=class{constructor(){nt(this,"buffer",new Uint32Array(8)),nt(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(t4(this.buffer),this.cursor=0),this.buffer[this.cursor++]}};var Kl=()=>yX().toString(),yX=()=>(BA||(BA=new wX)).generate(),SX="Thu, 01 Jan 1970 00:00:00 GMT",np="",EX=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function kX(e,t){if(t){var n=function(s){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:mt;if(np)return np;if(!i||["localhost","127.0.0.1"].includes(s))return"";for(var a=s.split("."),o=Math.min(a.length,8),l="dmn_chk_"+Kl(),c=new RegExp("(^|;)\\s*"+l+"=1");!np&&o--;){var d=a.slice(o).join("."),h=l+"=1;domain=."+d;i.cookie=h,c.test(i.cookie)&&(i.cookie=h+";expires="+SX,np=d)}return np}(e);if(!n){var r=(s=>{var i=s.match(EX);return i?i[0]:""})(e);r!==n&&wt.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var Gl,Qo={is_supported:()=>!!mt,error:function(e){wt.error("cookieStore error: "+e)},get:function(e){if(mt){try{for(var t=e+"=",n=mt.cookie.split(";").filter(i=>i.length),r=0;r<n.length;r++){for(var s=n[r];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(t)===0)return decodeURIComponent(s.substring(t.length,s.length))}}catch{}return null}},parse:function(e){var t;try{t=JSON.parse(Qo.get(e))||{}}catch{}return t},set:function(e,t,n,r,s){if(mt)try{var i="",a="",o=kX(mt.location.hostname,r);if(n){var l=new Date;l.setTime(l.getTime()+24*n*60*60*1e3),i="; expires="+l.toUTCString()}s&&(a="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+i+"; SameSite=Lax; path=/"+o+a;return c.length>3686.4&&wt.warn("cookieStore warning: large cookie, len="+c.length),mt.cookie=c,c}catch{return}},remove:function(e,t){try{Qo.set(e,"",-1,t)}catch{return}}},cC=null,Fr={is_supported:function(){if(!Tc(cC))return cC;var e=!0;if(ft(Fe))e=!1;else try{var t="__mplssupport__";Fr.set(t,"xyz"),Fr.get(t)!=='"xyz"'&&(e=!1),Fr.remove(t)}catch{e=!1}return e||wt.error("localStorage unsupported; falling back to cookie store"),cC=e,e},error:function(e){wt.error("localStorage error: "+e)},get:function(e){try{return Fe?.localStorage.getItem(e)}catch(t){Fr.error(t)}return null},parse:function(e){try{return JSON.parse(Fr.get(e))||{}}catch{}return null},set:function(e,t){try{Fe?.localStorage.setItem(e,JSON.stringify(t))}catch(n){Fr.error(n)}},remove:function(e){try{Fe?.localStorage.removeItem(e)}catch(t){Fr.error(t)}}},_X=["distinct_id",ax,Dp,lx,rS],T0=Oe(Oe({},Fr),{},{parse:function(e){try{var t={};try{t=Qo.parse(e)||{}}catch{}var n=gr(t,JSON.parse(Fr.get(e)||"{}"));return Fr.set(e,n),n}catch{}return null},set:function(e,t,n,r,s,i){try{Fr.set(e,t,void 0,void 0,i);var a={};_X.forEach(o=>{t[o]&&(a[o]=t[o])}),Object.keys(a).length&&Qo.set(e,a,n,r,s,i)}catch(o){Fr.error(o)}},remove:function(e,t){try{Fe?.localStorage.removeItem(e),Qo.remove(e,t)}catch(n){Fr.error(n)}}}),R0={},TX={is_supported:function(){return!0},error:function(e){wt.error("memoryStorage error: "+e)},get:function(e){return R0[e]||null},parse:function(e){return R0[e]||null},set:function(e,t){R0[e]=t},remove:function(e){delete R0[e]}},Wc=null,ls={is_supported:function(){if(!Tc(Wc))return Wc;if(Wc=!0,ft(Fe))Wc=!1;else try{var e="__support__";ls.set(e,"xyz"),ls.get(e)!=='"xyz"'&&(Wc=!1),ls.remove(e)}catch{Wc=!1}return Wc},error:function(e){wt.error("sessionStorage error: ",e)},get:function(e){try{return Fe?.sessionStorage.getItem(e)}catch(t){ls.error(t)}return null},parse:function(e){try{return JSON.parse(ls.get(e))||null}catch{}return null},set:function(e,t){try{Fe?.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){ls.error(n)}},remove:function(e){try{Fe?.sessionStorage.removeItem(e)}catch(t){ls.error(t)}}};(function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"})(Gl||(Gl={}));let RX=class{constructor(t){this.instance=t}get config(){return this.instance.config}get consent(){return this.getDnt()?Gl.DENIED:this.storedConsent}isOptedOut(){return this.consent===Gl.DENIED||this.consent===Gl.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"?Gl.GRANTED:t==="0"?Gl.DENIED:Gl.PENDING}get storage(){if(!this._storage){var t=this.config.opt_out_capturing_persistence_type;this._storage=t==="localStorage"?Fr:Qo;var n=t==="localStorage"?Qo:Fr;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&&!!H3([yi?.doNotTrack,yi?.msDoNotTrack,jt.doNotTrack],t=>Yt([!0,1,"1","yes"],t))}};var A0=Ds("[Dead Clicks]"),AX=()=>!0,FX=e=>{var t,n=!((t=e.instance.persistence)===null||t===void 0||!t.get_property(G3)),r=e.instance.config.capture_dead_clicks;return qo(r)?r:n};let n4=class{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(t,n,r){this.instance=t,this.isEnabled=n,this.onCapture=r,this.startIfEnabled()}onRemoteConfig(t){this.instance.persistence&&this.instance.persistence.register({[G3]:t?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript(()=>{this.start()})}loadScript(t){var n,r,s;(n=jt.__PosthogExtensions__)!==null&&n!==void 0&&n.initDeadClicksAutocapture&&t(),(r=jt.__PosthogExtensions__)===null||r===void 0||(s=r.loadExternalDependency)===null||s===void 0||s.call(r,this.instance,"dead-clicks-autocapture",i=>{i?A0.error("failed to load script",i):t()})}start(){var t;if(mt){if(!this._lazyLoadedDeadClicksAutocapture&&(t=jt.__PosthogExtensions__)!==null&&t!==void 0&&t.initDeadClicksAutocapture){var n=lr(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=jt.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this._lazyLoadedDeadClicksAutocapture.start(mt),A0.info("starting...")}}else A0.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,A0.info("stopping..."))}};var uC=Ds("[ExceptionAutocapture]");let DX=class{constructor(t){var n;nt(this,"startCapturing",()=>{var r;if(Fe&&this.isEnabled&&(r=jt.__PosthogExtensions__)!==null&&r!==void 0&&r.errorWrappingFunctions){var s=jt.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=jt.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,a=jt.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.unwrapOnError&&this.config.capture_unhandled_errors&&(this.unwrapOnError=s(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){uC.error("failed to start",o),this.stopCapturing()}}}),this.instance=t,this.remoteEnabled=!((n=this.instance.persistence)===null||n===void 0||!n.props[yA]),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 lr(t)?n=Oe(Oe({},n),t):(ft(t)?this.remoteEnabled:t)&&(n=Oe(Oe({},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&&(uC.info("enabled"),this.loadScript(this.startCapturing))}loadScript(t){var n,r,s;(n=jt.__PosthogExtensions__)!==null&&n!==void 0&&n.errorWrappingFunctions&&t(),(r=jt.__PosthogExtensions__)===null||r===void 0||(s=r.loadExternalDependency)===null||s===void 0||s.call(r,this.instance,"exception-autocapture",i=>{if(i)return uC.error("failed to load script",i);t()})}stopCapturing(){var t,n,r;(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,(r=this.unwrapConsoleError)===null||r===void 0||r.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({[yA]: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 r4(e){return!ft(Event)&&s4(e,Event)}function s4(e,t){try{return e instanceof t}catch{return!1}}function Av(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function dC(e){return Av(e,"DOMError")}var jA=/\(error: (.*)\)/,HA=50,nh="?";function hC(e,t,n,r){var s={platform:"web:javascript",filename:e,function:t==="<anonymous>"?nh:t,in_app:!0};return ft(n)||(s.lineno=n),ft(r)||(s.colno=r),s}var PX=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,IX=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,NX=/\((\S*)(?::(\d+))(?::(\d+))\)/,MX=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,OX=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,LX=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.sort((s,i)=>s[0]-i[0]).map(s=>s[1]);return function(s){for(var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=[],o=s.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./agent-details-page-Bwm-2oEG.js","./index-DDd7NnXP.js","./index-DxRO8eiH.css","./use-memberships-query-N1i6wDBt.js","./conversation-input-sync-CGt-xTOz.js","./ui-preferences-store-33sdgyd1.js","./error-boundary-BytCV_16.js","./conversation-input-sync-CIGg7Rga.css","./use-download-agent-mutation-BkceQylm.js","./en-US-BcB1DWxG.js","./book-open-DYd3X6Ks.js","./console-mirror-BsrFX_mx.js","./console-mirror-DOrYoP_4.css","./agent-hub-page-C1EpDhw3.js","./page-header-BK4_E8_S.js","./radient-auth-buttons-DUXYHbFc.js","./org-surface-gate-BCSHEY9w.js","./format-CZUObkkr.js","./agents-page-PK39vXwB.js","./schedules-page-4Pa4fKXg.js","./parseISO-CZfAC2_J.js","./projects-page-DIUM-rpH.js","./use-session-snapshot-CvDP9p_a.js","./browser-page-XHmhbk6T.js","./mesh-page-ZyHoot0F.js","./settings-page-6xA1GAGZ.js","./settings-section-DbH2vofx.js","./browser-webauthn-prompt-BCVm2Nam.js"])))=>i.map(i=>d[i]);
2
+ import{r as g,j as u,c as T,b as He,f as h2,l as Y9,u as X9,s as Q9,v as Ry,a as J9,R as Z9}from"./index-DDd7NnXP.js";import{ah as Ee,dE as e$,dF as Ay,dG as Db,c8 as Sv,bD as oh,c6 as tc,bM as pk,aG as Qr,a7 as Fi,a8 as Jr,ax as Zt,aN as Fs,aO as Pr,u as Qn,aw as Sc,aU as Nm,c9 as t$,aV as Mm,dH as mL,dI as n$,a as Zr,b as Mt,c as mf,dJ as Dg,dK as r$,dL as s$,dM as i$,aR as vL,aQ as di,dN as gk,dO as Ho,dP as Xw,dQ as Qw,d8 as xu,ca as xL,cH as id,ct as Ev,cs as a$,cr as Vr,cu as an,dR as bL,dS as o$,dT as Fy,dU as f2,dV as l$,dW as c$,dX as Dy,dY as u$,dZ as d$,d_ as h$,d$ as f$,at as lh,e0 as Py,e1 as p2,e2 as p$,e3 as wL,e4 as g$,e5 as CL,e6 as m$,e7 as v$,e8 as yL,e9 as Pb,ea as Ib,eb as x$,ec as b$,ed as w$,ee as g2,ef as C$,eg as Jd,eh as SL,d as At,ei as y$,ej as S$,ek as E$,el as k$,em as _$,en as T$,eo as R$,ep as EL,eq as A$,er as F$,es as D$,et as m2,eu as P$,ev as I$,ew as Na,ex as kL,ey as _L,ez as N$,eA as M$,eB as v2,eC as O$,eD as L$,aW as vf,eE as B$,eF as j$,eG as H$,b2 as TL,eH as U$,eI as G$,eJ as $$,eK as V$,eL as hc,eM as W$,eN as z$,eO as Lh,eP as q$,eQ as x2,eR as K$,eS as Y$,eT as X$,eU as Q$,eV as J$,eW as Z$,cL as eV,eX as tV,eY as nV,cO as rV,T as Ec,eZ as mk,aA as sa,dz as sV,e_ as iV,aj as bu,e$ as aV,f0 as oV,f1 as lV,f2 as cV,ay as uV,f3 as RL,aY as AL,a_ as al,f4 as dV,aS as vk,cI as Nb,aZ as Om,bI as Bu,f5 as xk,aH as bk,f6 as FL,f7 as Lm,f8 as hV,f9 as wk,bG as fV,fa as pV,fb as gV,fc as DL,fd as PL,fe as mV,ff as vV,fg as xV,fh as bV,fi as wV,fj as CV,fk as yV,al as pr,ak as ch,fl as b2,fm as w2,fn as SV,fo as C2,fp as y2,fq as EV,fr as kV,ch as Ck,fs as Mb,ft as oa,fu as _V,fv as kn,fw as Xt,fx as Bm,fy as Pg,fz as Ob,fA as yk,fB as Lb,fC as TV,fD as RV,fE as AV,fF as dn,fG as Ig,fH as IL,fI as qi,fJ as ju,fK as FV,fL as DV,ao as Ca,fM as PV,fN as IV,fO as S2,fP as NV,fQ as MV,fR as OV,fS as LV,fT as BV,fU as uh,fV as NL,fW as ML,fX as Sk,fY as Qv,fZ as OL,Q as Ek,f_ as Iy,f$ as kk,g0 as Jw,g1 as jV,g2 as HV,g3 as UV,g4 as Zd,g5 as Ny,g6 as LL,g7 as GV,g8 as BL,g9 as $V,ga as VV,gb as WV,gc as zV,gd as qV,ge as KV,gf as YV,gg as XV,gh as QV,gi as JV,gj as Jv,gk as ZV,gl as eW,gm as tW,gn as nW,go as rW,gp as sW,gq as _k,gr as iW,gs as jL,B as Ke,gt as aW,gu as Bb,gv as jm,bL as HL,bP as oW,gw as E2,b0 as UL,gx as lW,gy as cW,gz as uW,gA as dW,gB as hW,gC as fW,aq as Cs,gD as pW,gE as gW,gF as mW,gG as vW,gH as xW,gI as bW,gJ as wW,gK as CW,gL as yW,gM as SW,gN as EW,gO as Bh,gP as jb,gQ as Tk,gR as kW,gS as _W,gT as TW,gU as GL,gV as RW,gW as k2,gX as AW,gY as Rk,gZ as FW,g_ as Ak,g$ as Hm,h0 as Um,h1 as DW,h2 as $L,h3 as Ng,h4 as PW,h5 as IW,h6 as NW,h7 as MW,h8 as OW,h9 as LW,ha as _2,hb as VL,cd as WL,hc as BW,hd as jW,cl as Fk,he as HW,hf as UW,hg as T2,hh as Hb,hi as GW,hj as $W,hk as VW,hl as WW,hm as zL,U as zW,hn as Zw,ho as qW,hp as qL,bc as Yp,hq as KL,dC as KW,hr as YW,bO as Dk,hs as nc,ht as YL,hu as XL,hv as XW,b8 as QW,b9 as Ub,b5 as jh,hw as QL,hx as JW,hy as ZW,hz as ez,cq as Xp,hA as Hh,aP as Gm,bd as Hu,hB as R2,hC as tz,hD as dh,hE as Zv,hF as A2,hG as nz,hH as rz,hI as sz,hJ as iz,cm as az,hK as Pk,hL as F2,hM as oz,hN as lz,hO as cz,hP as JL,hQ as uz,hR as dz,d2 as hz,hS as fz,hT as ZL,hU as pz,hV as gz,hW as S0,hX as e3,hY as My,Z as D2,hZ as mz,h_ as vz,h$ as xz,i0 as bz,i1 as wu,d4 as t3,d5 as Ik,i2 as wz,i3 as Cz,i4 as yz,i5 as n3,cb as Sz,i6 as P2,a4 as I2,i7 as Ez,i8 as r3,i9 as ex,as as kz,ia as _z,ib as Tz,ic as Rz,id as Az,ie as Jf,ig as Zf,ih as Fz,ii as Dz,ij as Pz,ik as s3,il as Iz,im as i3,io as Oy,ip as Ly,iq as eC,ir as Nz,is as Mz,it as $d,iu as Oz,ag as tx,ai as a3,am as Lz,$ as N2,iv as Bz,iw as jz,ix as Hz,iy as Uz,iz as Gz,iA as $z,iB as Vz,iC as o3,iD as Wz,iE as By,iF as kv,iG as l3,iH as c3,iI as zz,iJ as qz,iK as Kz,iL as Yz,iM as u3,iN as Nk,iO as Xz,iP as Qz,iQ as Mk,b3 as Jz,iR as Zz,iS as eq,iT as tq,iU as nq,iV as rq,iW as sq,iX as iq,iY as aq,iZ as oq,i_ as lq,i$ as cq,b1 as uq,j0 as M2,j1 as dq,j2 as tC,j3 as O2,j4 as hq,j5 as fq,j6 as pq,j7 as gq,j8 as mq,j9 as vq,ja as xq,jb as bq,jc as wq,jd as Cq,je as yq,jf as Sq,dt as L2,jg as Eq,jh as B2,ji as kq,jj as _q,ab as Tq,ac as Rq,ad as Aq,ae as Fq,af as Dq,jk as Pq,jl as Iq,jm as Nq,jn as Mq,jo as Oq,jp as Lq,jq as Bq,jr as j2,js as jq,an as Hq,jt as Uq,ju as Gq,jv as $q,jw as H2,cP as d3,jx as Vq,aX as h3,jy as f3,jz as Wq,jA as Vs,jB as Bl,jC as p3,jD as g3,cA as m3,jE as v3,jF as Ok,jG as vi,jH as zq,jI as qq,jJ as Kq,jK as Yq,jL as Xq,jM as Qq,jN as Jq,jO as Zq,jP as eK,jQ as tK,jR as nK,jS as rK,jT as sK,jU as iK,jV as jy,jW as aK,jX as U2,jY as x3,jZ as oK,j_ as lK,j$ as cK,k0 as G2,k1 as uK,k2 as dK,cT as hK,a5 as b3,k3 as fK,k4 as pK,k5 as gK,k6 as mK,aM as w3,cU as $2,k7 as vK,be as pl,k8 as xK,k9 as bK,ka as wK,kb as Qs,a$ as V2,kc as nx,kd as W2,a3 as CK,ke as yK,kf as SK,kg as C3,kh as y3,ki as S3,au as EK,kj as kK,av as _K}from"./conversation-input-sync-CGt-xTOz.js";import{c as st,a2 as TK,a3 as E3,a4 as RK,a5 as AK,a6 as FK,a7 as DK,a8 as PK,a9 as IK,aa as ep,ab as NK,ac as $m,S as Hn,k as gl,B as ue,L as Ir,I as wr,T as Lk,C as es,X as Un,ad as Hy,ae as uu,r as xo,q as Ji,i as Bk,a as Mg,f as Je,J as xf,af as bf,ag as wf,ah as jk,ai as Uu,A as fo,aj as Hk,s as Og,t as Lg,u as Bg,v as jg,w as Hg,D as kc,l as ol,m as _c,n as rx,o as Ei,p as tn,ak as Gb,j as Cu,$ as Uk,al as Uy,am as MK,an as OK,z as k3,F as _3,G as Gy,a1 as T3,a0 as LK,P as sx,K as BK,N as Ug,ao as jK,b as R3,ap as HK,d as A3,aq as UK,ar as z2,Q as GK,Z as $y,O as $K,as as Vy,at as VK,au as F3,y as Gk,H as WK,e as zK,R as qK,U as KK,V as YK,W as XK,Y as QK,av as JK,aw as ZK,ax as eY,ay as tY,az as D3,g as q2,h as K2,E as nY}from"./error-boundary-BytCV_16.js";import{u as ct,c as $b,g as Y2,h as rY,i as sY,j as iY,k as Rp,l as aY,n as P3,S as nC,o as oY,q as X2,s as Q2,v as lY,w as cY,x as Vc,y as uY,D as E0,z as dY,A as hY,B as fY,E as J2,F as Z2,G as pY,H as gY,I as mY,J as eA,K as tA,L as nA,M as vY,N as xY,O as bY,P as wY,Q as CY,R as rA,U as yY,V as SY,W as sA,X as EY,f as iA,Y as kY,e as _Y,Z as TY,_ as RY,$ as AY,a0 as tp,d as aA,C as oA,b as lA,a1 as k0,a2 as cA,a3 as uA,a4 as dA,a5 as FY,a6 as DY,a7 as PY,a8 as IY,a9 as NY,p as MY,aa as hA,ab as OY}from"./ui-preferences-store-33sdgyd1.js";import{C as LY}from"./console-mirror-BsrFX_mx.js";const Wy=8e3,I3=1e4;function BY(e){return e?`“${e}”`:"Conversation"}const jY="archived.";function HY(e){return Ee.getState().archiveFacts[e]}function UY(e){const t=Ee.getState(),n=t.archiveFacts[e];return n?n.archived:t.sessions.find(r=>r.session_id===e)?.archived}function GY(){const e=Ee(t=>t.archiveUndo);g.useEffect(()=>{if(e===null)return;let t=!1;const n=()=>{t||(t=!0,s())},r=()=>{n();const i=Ee.getState().archiveUndo;i!==null&&i.sessionId===e.sessionId&&i.at===e.at&&Ee.getState().setArchiveUndo(null)},s=Ee.subscribe(()=>{const i=HY(e.sessionId);i!==void 0&&!i.answered||e$(e.archived,UY(e.sessionId))||r()});return n},[e])}function $Y(e){return e===1?"Draft":`${e} drafts`}const VY="discarded.",WY=e=>{const t=Ay(e),n=t.length,r=t.filter(o=>!o.active).length,s=n===1?"chat":"chats",i=e.filter(o=>Db(o)!==null&&Ay([o]).length===0).length,a=[`Mark ${n} unread ${s} as read${r>0?`, including ${r} 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:r>0?`, including ${r} in Previous chats`:""}},N3=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.`,zY=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?N3(e.deferred):null].filter(r=>r!==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(" ")}},rC="archive",fA="drafts-undo",pA="bulk-read-deferral",qY=8e3;function KY(){const e=Ee(h=>h.archiveFailure),t=Ee(h=>h.archiveUndo),n=Ee(h=>h.draftsUndo),r=Ee(h=>h.bulkReadDeferral),s=Ee(h=>h.clearArchiveFailure),i=Ee(h=>h.setArchiveUndo),a=Ee(h=>h.setSessionArchived),o=Ee(h=>h.restoreDraftsUndo);GY();const l=g.useRef(null);g.useEffect(()=>{if(e===null&&t===null){if(l.current===null)return;l.current=null,Sv(rC);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):s());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){oh(`Could not ${e.archived?"archive":"unarchive"} “${e.title}”.${e.detail?` ${e.detail}`:""}`,{id:rC,duration:I3,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&&tc(u.jsxs("span",{className:T("flex min-w-0 items-baseline gap-1"),children:[u.jsx("span",{className:T("min-w-0 truncate"),children:BY(t.title)}),u.jsx("span",{className:T("shrink-0"),children:jY})]}),{id:rC,duration:Wy,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,s,a]);const c=g.useRef(!1);g.useEffect(()=>{if(n===null){if(!c.current)return;c.current=!1,Sv(fA);return}c.current=!0;const h=()=>{const f=Ee.getState();f.draftsUndo?.at===n.at&&(f.setDraftsUndo(null),c.current=!1)};tc(u.jsxs("span",{className:T("flex min-w-0 items-baseline gap-1"),children:[u.jsx("span",{className:T("min-w-0 truncate"),children:$Y(n.keys.length)}),u.jsx("span",{className:T("shrink-0"),children:VY})]}),{id:fA,duration:Wy,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(r===null){if(!d.current)return;d.current=!1,Sv(pA);return}d.current=!0;const h=()=>{const f=Ee.getState();f.bulkReadDeferral?.at===r.at&&(f.clearBulkReadDeferral(),d.current=!1)};tc(N3(r.count),{id:pA,duration:qY,onAutoClose:h,onDismiss:h})},[r]),null}var Sa,Fe=typeof window<"u"?window:void 0,ri=typeof globalThis<"u"?globalThis:Fe,M3=Array.prototype,gA=M3.forEach,mA=M3.indexOf,yi=ri?.navigator,mt=ri?.document,ti=ri?.location,zy=ri?.fetch,qy=ri!=null&&ri.XMLHttpRequest&&"withCredentials"in new ri.XMLHttpRequest?ri.XMLHttpRequest:void 0,vA=ri?.AbortController,Tr=yi?.userAgent,jt=Fe??{},Wo={DEBUG:!1,LIB_VERSION:"1.235.6"},sC="$copy_autocapture",YY=["$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"})(Sa||(Sa={}));var XY=["fatal","error","warning","log","info","debug"];function Yt(e,t){return e.indexOf(t)!==-1}var Vb=function(e){return e.trim()},$k=function(e){return e.replace(/^\$/,"")},QY=Array.isArray,O3=Object.prototype,L3=O3.hasOwnProperty,Wb=O3.toString,or=QY||function(e){return Wb.call(e)==="[object Array]"},Ta=e=>typeof e=="function",lr=e=>e===Object(e)&&!or(e),eh=e=>{if(lr(e)){for(var t in e)if(L3.call(e,t))return!1;return!0}return!1},ft=e=>e===void 0,Ar=e=>Wb.call(e)=="[object String]",Ky=e=>Ar(e)&&e.trim().length===0,Tc=e=>e===null,En=e=>ft(e)||Tc(e),qs=e=>Wb.call(e)=="[object Number]",qo=e=>Wb.call(e)==="[object Boolean]",JY=e=>e instanceof FormData,ZY=e=>Yt(YY,e),B3=e=>{var t={_log:function(n){if(Fe&&(Wo.DEBUG||jt.POSTHOG_DEBUG)&&!ft(Fe.console)&&Fe.console){for(var r=("__rrweb_original__"in Fe.console[n])?Fe.console[n].__rrweb_original__:Fe.console[n],s=arguments.length,i=new Array(s>1?s-1:0),a=1;a<s;a++)i[a-1]=arguments[a];r(e,...i)}},info:function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];t._log("log",...r)},warn:function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];t._log("warn",...r)},error:function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];t._log("error",...r)},critical:function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];console.error(e,...r)},uninitializedWarning:n=>{t.error("You must initialize PostHog before calling ".concat(n))},createLogger:n=>B3("".concat(e," ").concat(n))};return t},wt=B3("[PostHog.js]"),Ds=wt.createLogger,eX=Ds("[ExternalScriptsLoader]"),xA=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return eX.warn("".concat(t," was requested but loading of external scripts is disabled.")),n("Loading of external scripts is disabled");var r=mt?.querySelectorAll("script");if(r){for(var s=0;s<r.length;s++)if(r[s].src===t)return n()}var i=()=>{if(!mt)return n("document not found");var a=mt.createElement("script");if(a.type="text/javascript",a.crossOrigin="anonymous",a.src=t,a.onload=c=>n(void 0,c),a.onerror=c=>n(c),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=mt.querySelectorAll("body > script");l.length>0?(o=l[0].parentNode)===null||o===void 0||o.insertBefore(a,l[0]):mt.body.appendChild(a)};mt!=null&&mt.body?i():mt?.addEventListener("DOMContentLoaded",i)};function bA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Oe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?bA(Object(n),!0).forEach(function(r){nt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bA(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function nt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function j3(e,t){if(e==null)return{};var n,r,s=function(a,o){if(a==null)return{};var l,c,d={},h=Object.keys(a);for(c=0;c<h.length;c++)l=h[c],o.indexOf(l)>=0||(d[l]=a[l]);return d}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}jt.__PosthogExtensions__=jt.__PosthogExtensions__||{},jt.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{var r="/static/".concat(t,".js")+"?v=".concat(e.version);if(t==="remote-config"&&(r="/array/".concat(e.config.token,"/config.js")),t==="toolbar"){var s=3e5,i=Math.floor(Date.now()/s)*s;r="".concat(r,"&t=").concat(i)}var a=e.requestRouter.endpointFor("assets",r);xA(e,a,n)},jt.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);xA(e,r,n)};var ix={};function rc(e,t,n){if(or(e)){if(gA&&e.forEach===gA)e.forEach(t,n);else if("length"in e&&e.length===+e.length){for(var r=0,s=e.length;r<s;r++)if(r in e&&t.call(n,e[r],r)===ix)return}}}function Fn(e,t,n){if(!En(e)){if(or(e))return rc(e,t,n);if(JY(e)){for(var r of e.entries())if(t.call(n,r[1],r[0])===ix)return}else for(var s in e)if(L3.call(e,s)&&t.call(n,e[s],s)===ix)return}}var gr=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return rc(n,function(s){for(var i in s)s[i]!==void 0&&(e[i]=s[i])}),e},_v=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return rc(n,function(s){rc(s,function(i){e.push(i)})}),e};function Tv(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var wA=function(e){try{return e()}catch{return}},tX=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.apply(this,n)}catch(s){wt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),wt.critical(s)}}},Gg=function(e){var t={};return Fn(e,function(n,r){Ar(n)&&n.length>0&&(t[r]=n)}),t};function nX(e,t){return n=e,r=i=>Ar(i)&&!Tc(t)?i.slice(0,t):i,s=new Set,function i(a,o){return a!==Object(a)?r?r(a,o):a:s.has(a)?void 0:(s.add(a),or(a)?(l=[],rc(a,c=>{l.push(i(c))})):(l={},Fn(a,(c,d)=>{s.has(c)||(l[d]=i(c,d))})),l);var l}(n);var n,r,s}var rX=["herokuapp.com","vercel.app","netlify.app"];function sX(e){var t=e?.hostname;if(!Ar(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of rX)if(n===r)return!1;return!0}function H3(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function vr(e,t,n,r){var{capture:s=!1,passive:i=!0}=r??{};e?.addEventListener(t,n,{capture:s,passive:i})}var U3="$people_distinct_id",Ap="__alias",Fp="__timers",CA="$autocapture_disabled_server_side",Yy="$heatmaps_enabled_server_side",yA="$exception_capture_enabled_server_side",SA="$web_vitals_enabled_server_side",G3="$dead_clicks_enabled_server_side",EA="$web_vitals_allowed_metrics",Xy="$session_recording_enabled_server_side",kA="$console_log_recording_enabled_server_side",_A="$session_recording_network_payload_capture",TA="$session_recording_masking",RA="$session_recording_canvas_recording",AA="$replay_sample_rate",FA="$replay_minimum_duration",DA="$replay_script_config",ax="$sesid",Dp="$session_is_sampled",iC="$session_recording_url_trigger_activated_session",aC="$session_recording_event_trigger_activated_session",th="$enabled_feature_flags",Rv="$early_access_features",Qy="$feature_flag_details",Pp="$stored_person_properties",Qc="$stored_group_properties",Jy="$surveys",_0="$surveys_activated",ox="$flag_call_reported",Go="$user_state",Zy="$client_session_props",eS="$capture_rate_limit",tS="$initial_campaign_params",nS="$initial_referrer_info",rS="$initial_person_info",lx="$epp",$3="__POSTHOG_TOOLBAR__",PA="$posthog_cookieless",iX=[U3,Ap,"__cmpns",Fp,Xy,Yy,ax,th,Go,Rv,Qy,Qc,Pp,Jy,ox,Zy,eS,tS,nS,lx];function IA(e){var t;return e instanceof Element&&(e.id===$3||!((t=e.closest)===null||t===void 0||!t.call(e,".toolbar-global-fade-container")))}function zb(e){return!!e&&e.nodeType===1}function sc(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function V3(e){return!!e&&e.nodeType===3}function W3(e){return!!e&&e.nodeType===11}function Vk(e){return e?Vb(e).split(/\s+/):[]}function NA(e){var t=Fe?.location.href;return!!(t&&e&&e.some(n=>t.match(n)))}function cx(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 Vk(t)}function z3(e){return En(e)?null:Vb(e).split(/(\s+)/).filter(t=>Uh(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function qb(e){var t="";return iS(e)&&!Y3(e)&&e.childNodes&&e.childNodes.length&&Fn(e.childNodes,function(n){var r;V3(n)&&n.textContent&&(t+=(r=z3(n.textContent))!==null&&r!==void 0?r:"")}),Vb(t)}function q3(e){return ft(e.target)?e.srcElement||null:(t=e.target)!==null&&t!==void 0&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var sS=["a","button","form","input","select","textarea","label"];function K3(e){var t=e.parentNode;return!(!t||!zb(t))&&t}function aX(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,s=arguments.length>4?arguments[4]:void 0;if(!Fe||!e||sc(e,"html")||!zb(e)||n!=null&&n.url_allowlist&&!NA(n.url_allowlist)||n!=null&&n.url_ignorelist&&NA(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,c=e;c.parentNode&&!sc(c,"body");)if(W3(c.parentNode))o.push(c.parentNode.host),c=c.parentNode.host;else{if(!(l=K3(c)))break;if(r||sS.indexOf(l.tagName.toLowerCase())>-1)a=!0;else{var d=Fe.getComputedStyle(l);d&&d.getPropertyValue("cursor")==="pointer"&&(a=!0)}o.push(l),c=l}if(!function(p,m){var v=m?.element_allowlist;if(ft(v))return!0;var x=function(C){if(v.some(E=>C.tagName.toLowerCase()===E))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(ft(v))return!0;var x=function(C){if(v.some(E=>C.matches(E)))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=Fe.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(s||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(t.type)>=0;default:return a?(s||["click"]).indexOf(t.type)>=0:(s||["click"]).indexOf(t.type)>=0&&(sS.indexOf(f)>-1||e.getAttribute("contenteditable")==="true")}}function iS(e){for(var t=e;t.parentNode&&!sc(t,"body");t=t.parentNode){var n=cx(t);if(Yt(n,"ph-sensitive")||Yt(n,"ph-no-capture"))return!1}if(Yt(cx(e),"ph-include"))return!0;var r=e.type||"";if(Ar(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=e.name||e.id||"";return!(Ar(s)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,"")))}function Y3(e){return!!(sc(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||sc(e,"select")||sc(e,"textarea")||e.getAttribute("contenteditable")==="true")}var X3="(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})",oX=new RegExp("^(?:".concat(X3,")$")),lX=new RegExp(X3),Q3="\\d{3}-?\\d{2}-?\\d{4}",cX=new RegExp("^(".concat(Q3,")$")),uX=new RegExp("(".concat(Q3,")"));function Uh(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(En(e)||Ar(e)&&(e=Vb(e),(t?oX:lX).test((e||"").replace(/[- ]/g,""))||(t?cX:uX).test(e)))}function J3(e){var t=qb(e);return Uh(t="".concat(t," ").concat(Z3(e)).trim())?t:""}function Z3(e){var t="";return e&&e.childNodes&&e.childNodes.length&&Fn(e.childNodes,function(n){var r;if(n&&((r=n.tagName)===null||r===void 0?void 0:r.toLowerCase())==="span")try{var s=qb(n);t="".concat(t," ").concat(s).trim(),n.childNodes&&n.childNodes.length&&(t="".concat(t," ").concat(Z3(n)).trim())}catch(i){wt.error("[AutoCapture]",i)}}),t}function dX(e){return function(t){var n=t.map(r=>{var s,i,a="";if(r.tag_name&&(a+=r.tag_name),r.attr_class)for(var o of(r.attr_class.sort(),r.attr_class))a+=".".concat(o.replace(/"/g,""));var l=Oe(Oe(Oe(Oe({},r.text?{text:r.text}:{}),{},{"nth-child":(s=r.nth_child)!==null&&s!==void 0?s:0,"nth-of-type":(i=r.nth_of_type)!==null&&i!==void 0?i:0},r.href?{href:r.href}:{}),r.attr_id?{attr_id:r.attr_id}:{}),r.attributes),c={};return Tv(l).sort((d,h)=>{var[f]=d,[p]=h;return f.localeCompare(p)}).forEach(d=>{var[h,f]=d;return c[MA(h.toString())]=MA(f.toString())}),a+=":",a+=Tv(l).map(d=>{var[h,f]=d;return"".concat(h,'="').concat(f,'"')}).join("")});return n.join(";")}(function(t){return t.map(n=>{var r,s,i={text:(r=n.$el_text)===null||r===void 0?void 0:r.slice(0,400),tag_name:n.tag_name,href:(s=n.attr__href)===null||s===void 0?void 0:s.slice(0,2048),attr_class:hX(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return Tv(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 MA(e){return e.replace(/"|\\"/g,'\\"')}function hX(e){var t=e.attr__class;return t?or(t)?t:Vk(t):void 0}class e4{constructor(){this.clicks=[]}isRageClick(t,n,r){var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(t-s.x)+Math.abs(n-s.y)<30&&r-s.timestamp<1e3){if(this.clicks.push({x:t,y:n,timestamp:r}),this.clicks.length===3)return!0}else this.clicks=[{x:t,y:n,timestamp:r}];return!1}}var fX=["localhost","127.0.0.1"],hh=e=>{var t=mt?.createElement("a");return ft(t)?null:(t.href=e,t)},pX=function(e){var t,n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",s=[];return Fn(e,function(i,a){ft(i)||ft(a)||a==="undefined"||(t=encodeURIComponent((o=>o instanceof File)(i)?i.name:i.toString()),n=encodeURIComponent(a),s[s.length]=n+"="+t)}),s.join(r)},ux=function(e,t){for(var n,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<r.length;s++){var i=r[s].split("=");if(i[0]===t){n=i;break}}if(!or(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch{wt.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},oC=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split("#"),s=r[0]||"",i=r[1],a=s.split("?"),o=a[1],l=a[0],c=(o||"").split("&"),d=[],h=0;h<c.length;h++){var f=c[h].split("=");or(f)&&(t.includes(f[0])?d.push(f[0]+"="+n):d.push(c[h]))}var p=l;return o!=null&&(p+="?"+d.join("&")),i!=null&&(p+="#"+i),p},dx=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},OA=Ds("[AutoCapture]");function lC(e,t){return t.length>e?t.slice(0,e)+"...":t}function gX(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!zb(t));return t}function mX(e,t,n,r){var s=e.tagName.toLowerCase(),i={tag_name:s};sS.indexOf(s)>-1&&!n&&(s.toLowerCase()==="a"||s.toLowerCase()==="button"?i.$el_text=lC(1024,J3(e)):i.$el_text=lC(1024,qb(e)));var a=cx(e);a.length>0&&(i.classes=a.filter(function(d){return d!==""})),Fn(e.attributes,function(d){var h;if((!Y3(e)||["name","id","class","aria-label"].indexOf(d.name)!==-1)&&(r==null||!r.includes(d.name))&&!t&&Uh(d.value)&&(h=d.name,!Ar(h)||h.substring(0,10)!=="_ngcontent"&&h.substring(0,7)!=="_nghost")){var f=d.value;d.name==="class"&&(f=Vk(f).join(" ")),i["attr__"+d.name]=lC(1024,f)}});for(var o=1,l=1,c=e;c=gX(c);)o++,c.tagName===e.tagName&&l++;return i.nth_child=o,i.nth_of_type=l,i}function vX(e,t){for(var n,r,{e:s,maskAllElementAttributes:i,maskAllText:a,elementAttributeIgnoreList:o,elementsChainAsString:l}=t,c=[e],d=e;d.parentNode&&!sc(d,"body");)W3(d.parentNode)?(c.push(d.parentNode.host),d=d.parentNode.host):(c.push(d.parentNode),d=d.parentNode);var h,f=[],p={},m=!1,v=!1;if(Fn(c,E=>{var y=iS(E);E.tagName.toLowerCase()==="a"&&(m=E.getAttribute("href"),m=y&&m&&Uh(m)&&m),Yt(cx(E),"ph-no-capture")&&(v=!0),f.push(mX(E,i,a,o));var k=function(_){if(!iS(_))return{};var I={};return Fn(_.attributes,function(A){if(A.name&&A.name.indexOf("data-ph-capture-attribute")===0){var P=A.name.replace("data-ph-capture-attribute-",""),N=A.value;P&&N&&Uh(N)&&(I[P]=N)}}),I}(E);gr(p,k)}),v)return{props:{},explicitNoCapture:v};if(a||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?f[0].$el_text=J3(e):f[0].$el_text=qb(e)),m){var x,b;f[0].attr__href=m;var w=(x=hh(m))===null||x===void 0?void 0:x.host,C=Fe==null||(b=Fe.location)===null||b===void 0?void 0:b.host;w&&C&&w!==C&&(h=m)}return{props:gr({$event_type:s.type,$ce_version:1},l?{}:{$elements:f},{$elements_chain:dX(f)},(n=f[0])!==null&&n!==void 0&&n.$el_text?{$el_text:(r=f[0])===null||r===void 0?void 0:r.$el_text}:{},h&&s.type==="click"?{$external_click_url:h}:{},p)}}let xX=class{constructor(t){nt(this,"_initialized",!1),nt(this,"_isDisabledServerSide",null),nt(this,"rageclicks",new e4),nt(this,"_elementsChainAsString",!1),this.instance=t,this._elementSelectors=null}get config(){var t,n,r=lr(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=(t=r.url_allowlist)===null||t===void 0?void 0:t.map(s=>new RegExp(s)),r.url_ignorelist=(n=r.url_ignorelist)===null||n===void 0?void 0:n.map(s=>new RegExp(s)),r}_addDomEventHandlers(){if(this.isBrowserSupported()){if(Fe&&mt){var t=r=>{r=r||Fe?.event;try{this._captureEvent(r)}catch(s){OA.error("Failed to capture event",s)}};if(vr(mt,"submit",t,{capture:!0}),vr(mt,"change",t,{capture:!0}),vr(mt,"click",t,{capture:!0}),this.config.capture_copied_text){var n=r=>{r=r||Fe?.event,this._captureEvent(r,sC)};vr(mt,"copy",n,{capture:!0}),vr(mt,"cut",n,{capture:!0})}}}else OA.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({[CA]:!!t.autocapture_opt_out}),this._isDisabledServerSide=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this._elementSelectors=t}getElementSelectors(t){var n,r=[];return(n=this._elementSelectors)===null||n===void 0||n.forEach(s=>{var i=mt?.querySelectorAll(s);i?.forEach(a=>{t===a&&r.push(s)})}),r}get isEnabled(){var t,n,r=(t=this.instance.persistence)===null||t===void 0?void 0:t.props[CA],s=this._isDisabledServerSide;if(Tc(s)&&!qo(r)&&!this.instance.config.advanced_disable_decide)return!1;var i=(n=this._isDisabledServerSide)!==null&&n!==void 0?n:!!r;return!!this.instance.config.autocapture&&!i}_captureEvent(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"$autocapture";if(this.isEnabled){var r,s=q3(t);V3(s)&&(s=s.parentNode||null),n==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!==null&&r!==void 0&&r.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this._captureEvent(t,"$rageclick");var i=n===sC;if(s&&aX(s,t,this.config,i,i?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:o}=vX(s,{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(s);if(l&&l.length>0&&(a.$element_selectors=l),n===sC){var c,d=z3(Fe==null||(c=Fe.getSelection())===null||c===void 0?void 0:c.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 Ta(mt?.querySelectorAll)}};Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return qs(e)&&isFinite(e)&&Math.floor(e)===e});var LA="0123456789abcdef";let bX=class aS{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,r,s){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(s)||t<0||n<0||r<0||s<0||t>0xffffffffffff||n>4095||r>1073741823||s>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|r>>>24,i[9]=r>>>16,i[10]=r>>>8,i[11]=r,i[12]=s>>>24,i[13]=s>>>16,i[14]=s>>>8,i[15]=s,new aS(i)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+LA.charAt(this.bytes[n]>>>4)+LA.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 aS(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;n<16;n++){var r=this.bytes[n]-t.bytes[n];if(r!==0)return Math.sign(r)}return 0}},wX=class{constructor(){nt(this,"timestamp",0),nt(this,"counter",0),nt(this,"random",new CX)}generate(){var t=this.generateOrAbort();if(ft(t)){this.timestamp=0;var n=this.generateOrAbort();if(ft(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 bX.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 BA,t4=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};Fe&&!ft(Fe.crypto)&&crypto.getRandomValues&&(t4=e=>crypto.getRandomValues(e));let CX=class{constructor(){nt(this,"buffer",new Uint32Array(8)),nt(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(t4(this.buffer),this.cursor=0),this.buffer[this.cursor++]}};var Kl=()=>yX().toString(),yX=()=>(BA||(BA=new wX)).generate(),SX="Thu, 01 Jan 1970 00:00:00 GMT",np="",EX=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function kX(e,t){if(t){var n=function(s){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:mt;if(np)return np;if(!i||["localhost","127.0.0.1"].includes(s))return"";for(var a=s.split("."),o=Math.min(a.length,8),l="dmn_chk_"+Kl(),c=new RegExp("(^|;)\\s*"+l+"=1");!np&&o--;){var d=a.slice(o).join("."),h=l+"=1;domain=."+d;i.cookie=h,c.test(i.cookie)&&(i.cookie=h+";expires="+SX,np=d)}return np}(e);if(!n){var r=(s=>{var i=s.match(EX);return i?i[0]:""})(e);r!==n&&wt.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var Gl,Qo={is_supported:()=>!!mt,error:function(e){wt.error("cookieStore error: "+e)},get:function(e){if(mt){try{for(var t=e+"=",n=mt.cookie.split(";").filter(i=>i.length),r=0;r<n.length;r++){for(var s=n[r];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(t)===0)return decodeURIComponent(s.substring(t.length,s.length))}}catch{}return null}},parse:function(e){var t;try{t=JSON.parse(Qo.get(e))||{}}catch{}return t},set:function(e,t,n,r,s){if(mt)try{var i="",a="",o=kX(mt.location.hostname,r);if(n){var l=new Date;l.setTime(l.getTime()+24*n*60*60*1e3),i="; expires="+l.toUTCString()}s&&(a="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+i+"; SameSite=Lax; path=/"+o+a;return c.length>3686.4&&wt.warn("cookieStore warning: large cookie, len="+c.length),mt.cookie=c,c}catch{return}},remove:function(e,t){try{Qo.set(e,"",-1,t)}catch{return}}},cC=null,Fr={is_supported:function(){if(!Tc(cC))return cC;var e=!0;if(ft(Fe))e=!1;else try{var t="__mplssupport__";Fr.set(t,"xyz"),Fr.get(t)!=='"xyz"'&&(e=!1),Fr.remove(t)}catch{e=!1}return e||wt.error("localStorage unsupported; falling back to cookie store"),cC=e,e},error:function(e){wt.error("localStorage error: "+e)},get:function(e){try{return Fe?.localStorage.getItem(e)}catch(t){Fr.error(t)}return null},parse:function(e){try{return JSON.parse(Fr.get(e))||{}}catch{}return null},set:function(e,t){try{Fe?.localStorage.setItem(e,JSON.stringify(t))}catch(n){Fr.error(n)}},remove:function(e){try{Fe?.localStorage.removeItem(e)}catch(t){Fr.error(t)}}},_X=["distinct_id",ax,Dp,lx,rS],T0=Oe(Oe({},Fr),{},{parse:function(e){try{var t={};try{t=Qo.parse(e)||{}}catch{}var n=gr(t,JSON.parse(Fr.get(e)||"{}"));return Fr.set(e,n),n}catch{}return null},set:function(e,t,n,r,s,i){try{Fr.set(e,t,void 0,void 0,i);var a={};_X.forEach(o=>{t[o]&&(a[o]=t[o])}),Object.keys(a).length&&Qo.set(e,a,n,r,s,i)}catch(o){Fr.error(o)}},remove:function(e,t){try{Fe?.localStorage.removeItem(e),Qo.remove(e,t)}catch(n){Fr.error(n)}}}),R0={},TX={is_supported:function(){return!0},error:function(e){wt.error("memoryStorage error: "+e)},get:function(e){return R0[e]||null},parse:function(e){return R0[e]||null},set:function(e,t){R0[e]=t},remove:function(e){delete R0[e]}},Wc=null,ls={is_supported:function(){if(!Tc(Wc))return Wc;if(Wc=!0,ft(Fe))Wc=!1;else try{var e="__support__";ls.set(e,"xyz"),ls.get(e)!=='"xyz"'&&(Wc=!1),ls.remove(e)}catch{Wc=!1}return Wc},error:function(e){wt.error("sessionStorage error: ",e)},get:function(e){try{return Fe?.sessionStorage.getItem(e)}catch(t){ls.error(t)}return null},parse:function(e){try{return JSON.parse(ls.get(e))||null}catch{}return null},set:function(e,t){try{Fe?.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){ls.error(n)}},remove:function(e){try{Fe?.sessionStorage.removeItem(e)}catch(t){ls.error(t)}}};(function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"})(Gl||(Gl={}));let RX=class{constructor(t){this.instance=t}get config(){return this.instance.config}get consent(){return this.getDnt()?Gl.DENIED:this.storedConsent}isOptedOut(){return this.consent===Gl.DENIED||this.consent===Gl.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"?Gl.GRANTED:t==="0"?Gl.DENIED:Gl.PENDING}get storage(){if(!this._storage){var t=this.config.opt_out_capturing_persistence_type;this._storage=t==="localStorage"?Fr:Qo;var n=t==="localStorage"?Qo:Fr;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&&!!H3([yi?.doNotTrack,yi?.msDoNotTrack,jt.doNotTrack],t=>Yt([!0,1,"1","yes"],t))}};var A0=Ds("[Dead Clicks]"),AX=()=>!0,FX=e=>{var t,n=!((t=e.instance.persistence)===null||t===void 0||!t.get_property(G3)),r=e.instance.config.capture_dead_clicks;return qo(r)?r:n};let n4=class{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(t,n,r){this.instance=t,this.isEnabled=n,this.onCapture=r,this.startIfEnabled()}onRemoteConfig(t){this.instance.persistence&&this.instance.persistence.register({[G3]:t?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript(()=>{this.start()})}loadScript(t){var n,r,s;(n=jt.__PosthogExtensions__)!==null&&n!==void 0&&n.initDeadClicksAutocapture&&t(),(r=jt.__PosthogExtensions__)===null||r===void 0||(s=r.loadExternalDependency)===null||s===void 0||s.call(r,this.instance,"dead-clicks-autocapture",i=>{i?A0.error("failed to load script",i):t()})}start(){var t;if(mt){if(!this._lazyLoadedDeadClicksAutocapture&&(t=jt.__PosthogExtensions__)!==null&&t!==void 0&&t.initDeadClicksAutocapture){var n=lr(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=jt.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this._lazyLoadedDeadClicksAutocapture.start(mt),A0.info("starting...")}}else A0.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,A0.info("stopping..."))}};var uC=Ds("[ExceptionAutocapture]");let DX=class{constructor(t){var n;nt(this,"startCapturing",()=>{var r;if(Fe&&this.isEnabled&&(r=jt.__PosthogExtensions__)!==null&&r!==void 0&&r.errorWrappingFunctions){var s=jt.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=jt.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,a=jt.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.unwrapOnError&&this.config.capture_unhandled_errors&&(this.unwrapOnError=s(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){uC.error("failed to start",o),this.stopCapturing()}}}),this.instance=t,this.remoteEnabled=!((n=this.instance.persistence)===null||n===void 0||!n.props[yA]),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 lr(t)?n=Oe(Oe({},n),t):(ft(t)?this.remoteEnabled:t)&&(n=Oe(Oe({},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&&(uC.info("enabled"),this.loadScript(this.startCapturing))}loadScript(t){var n,r,s;(n=jt.__PosthogExtensions__)!==null&&n!==void 0&&n.errorWrappingFunctions&&t(),(r=jt.__PosthogExtensions__)===null||r===void 0||(s=r.loadExternalDependency)===null||s===void 0||s.call(r,this.instance,"exception-autocapture",i=>{if(i)return uC.error("failed to load script",i);t()})}stopCapturing(){var t,n,r;(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,(r=this.unwrapConsoleError)===null||r===void 0||r.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({[yA]: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 r4(e){return!ft(Event)&&s4(e,Event)}function s4(e,t){try{return e instanceof t}catch{return!1}}function Av(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function dC(e){return Av(e,"DOMError")}var jA=/\(error: (.*)\)/,HA=50,nh="?";function hC(e,t,n,r){var s={platform:"web:javascript",filename:e,function:t==="<anonymous>"?nh:t,in_app:!0};return ft(n)||(s.lineno=n),ft(r)||(s.colno=r),s}var PX=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,IX=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,NX=/\((\S*)(?::(\d+))(?::(\d+))\)/,MX=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,OX=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,LX=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.sort((s,i)=>s[0]-i[0]).map(s=>s[1]);return function(s){for(var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=[],o=s.split(`
3
3
  `),l=i;l<o.length;l++){var c=o[l];if(!(c.length>1024)){var d=jA.test(c)?c.replace(jA,"$1"):c;if(!d.match(/\S*Error: /)){for(var h of r){var f=h(d);if(f){a.push(f);break}}if(a.length>=HA)break}}}return function(p){if(!p.length)return[];var m=Array.from(p);return m.reverse(),m.slice(0,HA).map(v=>Oe(Oe({},v),{},{filename:v.filename||BX(m).filename,function:v.function||nh}))}(a)}}([30,e=>{var t=PX.exec(e);if(t){var[,n,r,s]=t;return hC(n,nh,+r,+s)}var i=IX.exec(e);if(i){if(i[2]&&i[2].indexOf("eval")===0){var a=NX.exec(i[2]);a&&(i[2]=a[1],i[3]=a[2],i[4]=a[3])}var[o,l]=GA(i[1]||nh,i[2]);return hC(l,o,i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}}],[50,e=>{var t=MX.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=OX.exec(t[3]);n&&(t[1]=t[1]||"eval",t[3]=n[1],t[4]=n[2],t[5]="")}var r=t[3],s=t[1]||nh;return[s,r]=GA(s,r),hC(r,s,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]);function BX(e){return e[e.length-1]||{}}var F0,UA,fC,GA=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,r=e.indexOf("safari-web-extension")!==-1;return n||r?[e.indexOf("@")!==-1?e.split("@")[0]:nh,n?"safari-extension:".concat(t):"safari-web-extension:".concat(t)]:[e,t]},jX=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function Wk(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=e.stacktrace||e.stack||"",r=function(a){return a&&HX.test(a.message)?1:0}(e);try{var s=LX,i=function(a,o){var l=function(c){var d=globalThis._posthogChunkIds;if(!d)return{};var h=Object.keys(d);return fC&&h.length===UA||(UA=h.length,fC=h.reduce((f,p)=>{F0||(F0={});var m=F0[p];if(m)f[m[0]]=m[1];else for(var v=c(p),x=v.length-1;x>=0;x--){var b=v[x],w=b?.filename,C=d[p];if(w&&C){f[w]=C,F0[p]=[w,C];break}}return f},{})),fC}(o);return a.forEach(c=>{c.filename&&(c.chunk_id=l[c.filename])}),a}(s(n,r),s);return i.slice(0,i.length-t)}catch{}return[]}var HX=/Minified React error #\d+;/i;function pC(e,t){var n,r,s=Wk(e),i=(n=t?.handled)===null||n===void 0||n,a=(r=t?.synthetic)!==null&&r!==void 0&&r;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:s,type:"raw"},mechanism:{handled:i,synthetic:a}}],$exception_level:"error"}}function gC(e,t){var n,r,s,i=(n=t?.handled)===null||n===void 0||n,a=(r=t?.synthetic)===null||r===void 0||r,o={type:t!=null&&t.overrideExceptionType?t.overrideExceptionType:(s=t?.defaultExceptionType)!==null&&s!==void 0?s:"Error",value:e||t?.defaultExceptionMessage,mechanism:{handled:i,synthetic:a}};if(t!=null&&t.syntheticException){var l=Wk(t.syntheticException,1);l.length&&(o.stacktrace={frames:l,type:"raw"})}return{$exception_list:[o],$exception_level:"error"}}function UX(e){return Ar(e)&&!Ky(e)&&XY.indexOf(e)>=0}function GX(e,t){var n,r,s=(n=t?.handled)===null||n===void 0||n,i=(r=t?.synthetic)===null||r===void 0||r,a=t!=null&&t.overrideExceptionType?t.overrideExceptionType:r4(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:s,synthetic:i}};if(t!=null&&t.syntheticException){var c=Wk(t?.syntheticException,1);c.length&&(l.stacktrace={frames:c,type:"raw"})}return{$exception_list:[l],$exception_level:UX(e.level)?e.level:"error"}}function $X(e,t){var{error:n,event:r}=e,s={$exception_list:[]},i=n||r;if(dC(i)||function(p){return Av(p,"DOMException")}(i)){var a=i;if(function(p){return"stack"in p}(i))s=pC(i,t);else{var o=a.name||(dC(a)?"DOMError":"DOMException"),l=a.message?"".concat(o,": ").concat(a.message):o,c=dC(a)?"DOMError":"DOMException";s=gC(l,Oe(Oe({},t),{},{overrideExceptionType:c,defaultExceptionMessage:l}))}return"code"in a&&(s.$exception_DOMException_code="".concat(a.code)),s}if(function(p){return Av(p,"ErrorEvent")}(i)&&i.error)return pC(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 s4(p,Error)}}(i))return pC(i,t);if(function(p){return Av(p,"Object")}(i)||r4(i))return GX(i,t);if(ft(n)&&Ar(r)){var d="Error",h=r,f=r.match(jX);return f&&(d=f[1],h=f[2]),gC(h,Oe(Oe({},t),{},{overrideExceptionType:d,defaultExceptionMessage:h}))}return gC(i,t)}function hx(e){var t,n;return((t=JSON.stringify(e,(n=[],function(r,s){if(lr(s)){for(;n.length>0&&n[n.length-1]!==this;)n.pop();return n.includes(s)?"[Circular]":(n.push(s),s)}return s})))===null||t===void 0?void 0:t.length)||0}function oS(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),r=e.data.slice(0,n),s=e.data.slice(n);return[oS({size:hx(r),data:r,sessionId:e.sessionId,windowId:e.windowId}),oS({size:hx(s),data:s,sessionId:e.sessionId,windowId:e.windowId})].flatMap(i=>i)}return[e]}var $o=(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))($o||{}),ba=(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))(ba||{}),lS="[SessionRecording]",cS="redacted",D0={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"]},VX=["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"],WX=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],zX=["/s/","/e/","/i/"];function $A(e,t,n,r){if(En(e))return e;var s=t?.["content-length"]||function(i){return new Blob([i]).size}(e);return Ar(s)&&(s=parseInt(s)),s>n?lS+" ".concat(r," body too large to record (").concat(s," bytes)"):e}function VA(e,t){if(En(e))return e;var n=e;return Uh(n,!1)||(n=lS+" "+t+" body "+cS),Fn(WX,r=>{var s,i;(s=n)!==null&&s!==void 0&&s.length&&((i=n)===null||i===void 0?void 0:i.indexOf(r))!==-1&&(n=lS+" "+t+" body "+cS+" as might contain: "+r)}),n}var qX=(e,t)=>{var n,r,s,i={payloadSizeLimitBytes:D0.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...D0.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...D0.payloadHostDenyList]},a=e.session_recording.recordHeaders!==!1&&t.recordHeaders,o=e.session_recording.recordBody!==!1&&t.recordBody,l=e.capture_performance!==!1&&t.recordPerformance,c=(n=i,s=Math.min(1e6,(r=n.payloadSizeLimitBytes)!==null&&r!==void 0?r:1e6),f=>(f!=null&&f.requestBody&&(f.requestBody=$A(f.requestBody,f.requestHeaders,s,"Request")),f!=null&&f.responseBody&&(f.responseBody=$A(f.responseBody,f.responseHeaders,s,"Response")),f)),d=f=>{return c(((v,x)=>{var b,w=hh(v.name),C=x.indexOf("http")===0?(b=hh(x))===null||b===void 0?void 0:b.pathname:x;C==="/"&&(C="");var E=w?.pathname.replace(C||"","");if(!(w&&E&&zX.some(y=>E.indexOf(y)===0)))return v})((m=(p=f).requestHeaders,En(m)||Fn(Object.keys(m??{}),v=>{VX.includes(v.toLowerCase())&&(m[v]=cS)}),p),e.api_host));var p,m},h=Ta(e.session_recording.maskNetworkRequestFn);return h&&Ta(e.session_recording.maskCapturedNetworkRequestFn)&&wt.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 Oe(Oe({},f),{},{name:p?.url})}),i.maskRequestFn=Ta(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(!ft(p))return p.requestBody=VA(p.requestBody,"Request"),p.responseBody=VA(p.responseBody,"Response"),p}(d(f)),Oe(Oe(Oe({},D0),i),{},{recordHeaders:a,recordBody:o,recordPerformance:l,recordInitialRequests:l})};function Ki(e,t,n,r,s){return t>n&&(wt.warn("min cannot be greater than max."),t=n),qs(e)?e>n?(r&&wt.warn(r+" cannot be greater than max: "+n+". Using max value instead."),n):e<t?(r&&wt.warn(r+" cannot be less than min: "+t+". Using min value instead."),t):e:(r&&wt.warn(r+" must be a number. using max or fallback. max: "+n+", fallback: "+s),Ki(s||n,t,n,r))}let KX=class{constructor(t){var n,r,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};nt(this,"bucketSize",100),nt(this,"refillRate",10),nt(this,"mutationBuckets",{}),nt(this,"loggedTracker",{}),nt(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]})}),nt(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]}),nt(this,"numberOfChanges",i=>{var a,o,l,c,d,h,f,p;return((a=(o=i.removes)===null||o===void 0?void 0:o.length)!==null&&a!==void 0?a:0)+((l=(c=i.attributes)===null||c===void 0?void 0:c.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)}),nt(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(c=>{var d,h,f,[p,m]=this.getNodeOrRelevantParent(c.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))),c)}));var l=this.numberOfChanges(a);return l!==0||o===l?i:void 0}),this.rrweb=t,this.options=s,this.refillRate=Ki((n=this.options.refillRate)!==null&&n!==void 0?n:this.refillRate,0,100,"mutation throttling refill rate"),this.bucketSize=Ki((r=this.options.bucketSize)!==null&&r!==void 0?r:this.bucketSize,0,100,"mutation throttling bucket size"),setInterval(()=>{this.refillBuckets()},1e3)}};var Zi=Uint8Array,si=Uint16Array,Gh=Uint32Array,zk=new Zi([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]),qk=new Zi([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]),WA=new Zi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),i4=function(e,t){for(var n=new si(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var s=new Gh(n[30]);for(r=1;r<30;++r)for(var i=n[r];i<n[r+1];++i)s[i]=i-n[r]<<5|r;return[n,s]},a4=i4(zk,2),YX=a4[0],uS=a4[1];YX[28]=258,uS[258]=28;for(var zA=i4(qk,0)[1],o4=new si(32768),Bn=0;Bn<32768;++Bn){var zc=(43690&Bn)>>>1|(21845&Bn)<<1;zc=(61680&(zc=(52428&zc)>>>2|(13107&zc)<<2))>>>4|(3855&zc)<<4,o4[Bn]=((65280&zc)>>>8|(255&zc)<<8)>>>1}var Qp=function(e,t,n){for(var r=e.length,s=0,i=new si(t);s<r;++s)++i[e[s]-1];var a,o=new si(t);for(s=0;s<t;++s)o[s]=o[s-1]+i[s-1]<<1;for(a=new si(r),s=0;s<r;++s)a[s]=o4[o[e[s]-1]++]>>>15-e[s];return a},Gu=new Zi(288);for(Bn=0;Bn<144;++Bn)Gu[Bn]=8;for(Bn=144;Bn<256;++Bn)Gu[Bn]=9;for(Bn=256;Bn<280;++Bn)Gu[Bn]=7;for(Bn=280;Bn<288;++Bn)Gu[Bn]=8;var fx=new Zi(32);for(Bn=0;Bn<32;++Bn)fx[Bn]=5;var XX=Qp(Gu,9),QX=Qp(fx,5),l4=function(e){return(e/8>>0)+(7&e&&1)},c4=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof si?si:e instanceof Gh?Gh:Zi)(n-t);return r.set(e.subarray(t,n)),r},jo=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},rp=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},mC=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var s=n.length,i=n.slice();if(!s)return[new Zi(0),0];if(s==1){var a=new Zi(n[0].s+1);return a[n[0].s]=1,[a,1]}n.sort(function(y,k){return y.f-k.f}),n.push({s:-1,f:25001});var o=n[0],l=n[1],c=0,d=1,h=2;for(n[0]={s:-1,f:o.f+l.f,l:o,r:l};d!=s-1;)o=n[n[c].f<n[h].f?c++:h++],l=n[c!=d&&n[c].f<n[h].f?c++:h++],n[d++]={s:-1,f:o.f+l.f,l:o,r:l};var f=i[0].s;for(r=1;r<s;++r)i[r].s>f&&(f=i[r].s);var p=new si(f+1),m=dS(n[d-1],p,0);if(m>t){r=0;var v=0,x=m-t,b=1<<x;for(i.sort(function(y,k){return p[k.s]-p[y.s]||y.f-k.f});r<s;++r){var w=i[r].s;if(!(p[w]>t))break;v+=b-(1<<m-p[w]),p[w]=t}for(v>>>=x;v>0;){var C=i[r].s;p[C]<t?v-=1<<t-p[C]++-1:++r}for(;r>=0&&v;--r){var E=i[r].s;p[E]==t&&(--p[E],++v)}m=t}return[new Zi(p),m]},dS=function(e,t,n){return e.s==-1?Math.max(dS(e.l,t,n+1),dS(e.r,t,n+1)):t[e.s]=n},qA=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new si(++t),r=0,s=e[0],i=1,a=function(l){n[r++]=l},o=1;o<=t;++o)if(e[o]==s&&o!=t)++i;else{if(!s&&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(s),--i;i>6;i-=6)a(8304);i>2&&(a(i-3<<5|8208),i=0)}for(;i--;)a(s);i=1,s=e[o]}return[n.subarray(0,r),t]},sp=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},hS=function(e,t,n){var r=n.length,s=l4(t+2);e[s]=255&r,e[s+1]=r>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var i=0;i<r;++i)e[s+i+4]=n[i];return 8*(s+4+r)},KA=function(e,t,n,r,s,i,a,o,l,c,d){jo(t,d++,n),++s[256];for(var h=mC(s,15),f=h[0],p=h[1],m=mC(i,15),v=m[0],x=m[1],b=qA(f),w=b[0],C=b[1],E=qA(v),y=E[0],k=E[1],_=new si(19),I=0;I<w.length;++I)_[31&w[I]]++;for(I=0;I<y.length;++I)_[31&y[I]]++;for(var A=mC(_,7),P=A[0],N=A[1],F=19;F>4&&!P[WA[F-1]];--F);var j,q,L,ie,Z=c+5<<3,J=sp(s,Gu)+sp(i,fx)+a,U=sp(s,f)+sp(i,v)+a+14+3*F+sp(_,P)+(2*_[16]+3*_[17]+7*_[18]);if(Z<=J&&Z<=U)return hS(t,d,e.subarray(l,l+c));if(jo(t,d,1+(U<J)),d+=2,U<J){j=Qp(f,p),q=f,L=Qp(v,x),ie=v;var ne=Qp(P,N);for(jo(t,d,C-257),jo(t,d+5,k-1),jo(t,d+10,F-4),d+=14,I=0;I<F;++I)jo(t,d+3*I,P[WA[I]]);d+=3*F;for(var re=[w,y],D=0;D<2;++D){var H=re[D];for(I=0;I<H.length;++I){var M=31&H[I];jo(t,d,ne[M]),d+=P[M],M>15&&(jo(t,d,H[I]>>>5&127),d+=H[I]>>>12)}}}else j=XX,q=Gu,L=QX,ie=fx;for(I=0;I<o;++I)if(r[I]>255){M=r[I]>>>18&31,rp(t,d,j[M+257]),d+=q[M+257],M>7&&(jo(t,d,r[I]>>>23&31),d+=zk[M]);var Y=31&r[I];rp(t,d,L[Y]),d+=ie[Y],Y>3&&(rp(t,d,r[I]>>>5&8191),d+=qk[Y])}else rp(t,d,j[r[I]]),d+=q[r[I]];return rp(t,d,j[256]),d+q[256]},JX=new Gh([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ZX=function(){for(var e=new Gh(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),eQ=function(){var e=4294967295;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=ZX[255&n^t[r]]^n>>>8;e=n},d:function(){return 4294967295^e}}},tQ=function(e,t,n,r,s){return function(i,a,o,l,c,d){var h=i.length,f=new Zi(l+h+5*(1+Math.floor(h/7e3))+c),p=f.subarray(l,f.length-c),m=0;if(!a||h<8)for(var v=0;v<=h;v+=65535){var x=v+65535;x<h?m=hS(p,m,i.subarray(v,x)):(p[v]=d,m=hS(p,m,i.subarray(v,h)))}else{for(var b=JX[a-1],w=b>>>13,C=8191&b,E=(1<<o)-1,y=new si(32768),k=new si(E+1),_=Math.ceil(o/3),I=2*_,A=function(he){return(i[he]^i[he+1]<<_^i[he+2]<<I)&E},P=new Gh(25e3),N=new si(288),F=new si(32),j=0,q=0,L=(v=0,0),ie=0,Z=0;v<h;++v){var J=A(v),U=32767&v,ne=k[J];if(y[U]=ne,k[J]=U,ie<=v){var re=h-v;if((j>7e3||L>24576)&&re>423){m=KA(i,p,0,P,N,F,q,L,Z,v-Z,m),L=j=q=0,Z=v;for(var D=0;D<286;++D)N[D]=0;for(D=0;D<30;++D)F[D]=0}var H=2,M=0,Y=C,ee=U-ne&32767;if(re>2&&J==A(v-ee))for(var ae=Math.min(w,re)-1,le=Math.min(32767,v),te=Math.min(258,re);ee<=le&&--Y&&U!=ne;){if(i[v+H]==i[v+H-ee]){for(var Q=0;Q<te&&i[v+Q]==i[v+Q-ee];++Q);if(Q>H){if(H=Q,M=ee,Q>ae)break;var ce=Math.min(ee,Q-2),B=0;for(D=0;D<ce;++D){var ye=v-ee+D+32768&32767,Pe=ye-y[ye]+32768&32767;Pe>B&&(B=Pe,ne=ye)}}}ee+=(U=ne)-(ne=y[U])+32768&32767}if(M){P[L++]=268435456|uS[H]<<18|zA[M];var de=31&uS[H],fe=31&zA[M];q+=zk[de]+qk[fe],++N[257+de],++F[fe],ie=v+H,++j}else P[L++]=i[v],++N[i[v]]}}m=KA(i,p,d,P,N,F,q,L,Z,v-Z,m)}return c4(f,0,l+l4(m)+c)}(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,r,!0)},fS=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},nQ=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&&fS(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}},rQ=function(e){return 10+(e.filename&&e.filename.length+1||0)};function u4(e,t){t===void 0&&(t={});var n=eQ(),r=e.length;n.p(e);var s=tQ(e,t,rQ(t),8),i=s.length;return nQ(s,t),fS(s,i-8,n.d()),fS(s,i-4,r),s}function d4(e,t){var n=e.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(e);for(var r=new Zi(e.length+(e.length>>>1)),s=0,i=function(c){r[s++]=c},a=0;a<n;++a){if(s+5>r.length){var o=new Zi(s+8+(n-a<<1));o.set(r),r=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 c4(r,0,s)}function sQ(e,t){return function(n){for(var r=0,s=0;s<n.length;s++)r=(r<<5)-r+n.charCodeAt(s),r|=0;return Math.abs(r)}(e)%100<Ki(100*t,0,100)}var Ip="[SessionRecording]",xs=Ds(Ip);function P0(){var e,t;return jt==null||(e=jt.__PosthogExtensions__)===null||e===void 0||(t=e.rrweb)===null||t===void 0?void 0:t.record}var iQ=3e5,aQ=[ba.MouseMove,ba.MouseInteraction,ba.Scroll,ba.ViewportResize,ba.Input,ba.TouchMove,ba.MediaInteraction,ba.Drag],YA=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function qc(e){return function(t,n){for(var r="",s=0;s<t.length;){var i=t[s++];r+=String.fromCharCode(i)}return r}(u4(d4(JSON.stringify(e))))}function XA(e){return e.type===$o.Custom&&e.data.tag==="sessionIdle"}function QA(e,t){return t.some(n=>n.matching==="regex"&&new RegExp(n.url).test(e))}let oQ=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(Ip+" 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:iQ}get isSampled(){var t=this.instance.get_property(Dp);return qo(t)?t:null}get sessionDuration(){var t,n,r=(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:s}=this.sessionManager.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-s:null}get isRecordingEnabled(){var t=!!this.instance.get_property(Xy),n=!this.instance.config.disable_session_recording;return Fe&&t&&n}get isConsoleLogCaptureEnabled(){var t=!!this.instance.get_property(kA),n=this.instance.config.enable_recording_console_log;return n??t}get canvasRecording(){var t,n,r,s,i,a,o=this.instance.config.session_recording.captureCanvas,l=this.instance.get_property(RA),c=(t=(n=o?.recordCanvas)!==null&&n!==void 0?n:l?.enabled)!==null&&t!==void 0&&t,d=(r=(s=o?.canvasFps)!==null&&s!==void 0?s:l?.fps)!==null&&r!==void 0?r: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:c,fps:Ki(d,0,12,"canvas recording fps",4),quality:Ki(h,0,1,"canvas recording quality",.4)}}get networkPayloadCapture(){var t,n,r=this.instance.get_property(_A),s={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=s?.recordHeaders||r?.recordHeaders,a=s?.recordBody||r?.recordBody,o=lr(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,l=!!(qo(o)?o:r?.capturePerformance);return i||a||l?{recordHeaders:i,recordBody:a,recordPerformance:l}:void 0}get masking(){var t,n,r,s,i,a,o=this.instance.get_property(TA),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:(r=this.instance.config.session_recording)===null||r===void 0?void 0:r.blockSelector},c=(s=l?.maskAllInputs)!==null&&s!==void 0?s: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 ft(c)&&ft(d)&&ft(h)?void 0:{maskAllInputs:c==null||c,maskTextSelector:d,blockSelector:h}}get sampleRate(){var t=this.instance.get_property(AA);return qs(t)?t:null}get minimumDuration(){var t=this.instance.get_property(FA);return qs(t)?t:null}get status(){return this.receivedDecide?this.isRecordingEnabled?this.isSampled===!1?"disabled":this._urlBlocked?"paused":En(this._linkedFlag)||this._linkedFlagSeen?this.triggerStatus==="trigger_pending"?"buffering":qo(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(iC))===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(aC))===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(nt(this,"queuedRRWebEvents",[]),nt(this,"isIdle","unknown"),nt(this,"_linkedFlagSeen",!1),nt(this,"_lastActivityTimestamp",Date.now()),nt(this,"_linkedFlag",null),nt(this,"_removePageViewCaptureHook",void 0),nt(this,"_onSessionIdListener",void 0),nt(this,"_persistDecideOnSessionListener",void 0),nt(this,"_samplingSessionListener",void 0),nt(this,"_urlTriggers",[]),nt(this,"_urlBlocklist",[]),nt(this,"_urlBlocked",!1),nt(this,"_eventTriggers",[]),nt(this,"_removeEventTriggerCaptureHook",void 0),nt(this,"_forceAllowLocalhostNetworkCapture",!1),nt(this,"_onBeforeUnload",()=>{this._flushBuffer()}),nt(this,"_onOffline",()=>{this._tryAddCustomEvent("browser offline",{})}),nt(this,"_onOnline",()=>{this._tryAddCustomEvent("browser online",{})}),nt(this,"_onVisibilityChange",()=>{if(mt!=null&&mt.visibilityState){var s="window "+mt.visibilityState;this._tryAddCustomEvent(s,{})}}),this.instance=t,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw xs.error("started without valid sessionManager"),new Error(Ip+" started without valid sessionManager. This is a bug.");if(this.instance.config.__preview_experimental_cookieless_mode)throw new Error(Ip+" cannot be used with __preview_experimental_cookieless_mode.");var{sessionId:n,windowId:r}=this.sessionManager.checkAndGetSessionAndWindowId();this.sessionId=n,this.windowId=r,this.buffer=this.clearBuffer(),this.sessionIdleThresholdMilliseconds>=this.sessionManager.sessionTimeoutMs&&xs.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),vr(Fe,"beforeunload",this._onBeforeUnload),vr(Fe,"offline",this._onOffline),vr(Fe,"online",this._onOnline),vr(Fe,"visibilitychange",this._onVisibilityChange),this._setupSampling(),this._addEventTriggerListener(),En(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this.instance.on("eventCaptured",n=>{try{if(n.event==="$pageview"){var r=n!=null&&n.properties.$current_url?this._maskUrl(n?.properties.$current_url):"";if(!r)return;this._tryAddCustomEvent("$pageview",{href:r})}}catch(s){xs.error("Could not add $pageview to rrweb session",s)}})),this._onSessionIdListener||(this._onSessionIdListener=this.sessionManager.onSessionId((n,r,s)=>{var i,a,o,l;s&&(this._tryAddCustomEvent("$session_id_change",{sessionId:n,windowId:r,changeReason:s}),(i=this.instance)===null||i===void 0||(a=i.persistence)===null||a===void 0||a.unregister(aC),(o=this.instance)===null||o===void 0||(l=o.persistence)===null||l===void 0||l.unregister(iC))}))):this.stopRecording()}stopRecording(){var t,n,r,s;this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,Fe?.removeEventListener("beforeunload",this._onBeforeUnload),Fe?.removeEventListener("offline",this._onOffline),Fe?.removeEventListener("online",this._onOnline),Fe?.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,(r=this._onSessionIdListener)===null||r===void 0||r.call(this),this._onSessionIdListener=void 0,(s=this._samplingSessionListener)===null||s===void 0||s.call(this),this._samplingSessionListener=void 0,xs.info("stopped"))}_resetSampling(){var t;(t=this.instance.persistence)===null||t===void 0||t.unregister(Dp)}makeSamplingDecision(t){var n,r=this.sessionId!==t,s=this.sampleRate;if(qs(s)){var i=this.isSampled,a=r||!qo(i),o=a?sQ(t,s):i;a&&(o?this._reportStarted("sampled"):xs.warn("Sample rate (".concat(s,") has determined that this sessionId (").concat(t,") will not be sent to the server.")),this._tryAddCustomEvent("samplingDecisionMade",{sampleRate:s,isSampled:o})),(n=this.instance.persistence)===null||n===void 0||n.register({[Dp]:o})}else this._resetSampling()}onRemoteConfig(t){var n,r,s,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,(r=t.sessionRecording)!==null&&r!==void 0&&r.endpoint&&(this._endpoint=(o=t.sessionRecording)===null||o===void 0?void 0:o.endpoint),this._setupSampling(),!En(this._linkedFlag)&&!this._linkedFlagSeen){var l=Ar(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,c=Ar(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags((d,h)=>{var f=lr(h)&&l in h,p=c?h[l]===c:f;p&&this._reportStarted("linked_flag_matched",{linkedFlag:l,linkedVariant:c}),this._linkedFlagSeen=p})}(s=t.sessionRecording)!==null&&s!==void 0&&s.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(){qs(this.sampleRate)&&En(this._samplingSessionListener)&&(this._samplingSessionListener=this.sessionManager.onSessionId(t=>{this.makeSamplingDecision(t)}))}_persistRemoteConfig(t){if(this.instance.persistence){var n,r=this.instance.persistence,s=()=>{var i,a,o,l,c,d,h,f,p,m=(i=t.sessionRecording)===null||i===void 0?void 0:i.sampleRate,v=En(m)?null:parseFloat(m);En(v)&&this._resetSampling();var x=(a=t.sessionRecording)===null||a===void 0?void 0:a.minimumDurationMilliseconds;r.register({[Xy]:!!t.sessionRecording,[kA]:(o=t.sessionRecording)===null||o===void 0?void 0:o.consoleLogRecordingEnabled,[_A]:Oe({capturePerformance:t.capturePerformance},(l=t.sessionRecording)===null||l===void 0?void 0:l.networkPayloadCapture),[TA]:(c=t.sessionRecording)===null||c===void 0?void 0:c.masking,[RA]:{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},[AA]:v,[FA]:ft(x)?null:x,[DA]:(p=t.sessionRecording)===null||p===void 0?void 0:p.scriptConfig})};s(),(n=this._persistDecideOnSessionListener)===null||n===void 0||n.call(this),this._persistDecideOnSessionListener=this.sessionManager.onSessionId(s)}}log(t){var n,r=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:r,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}_startCapture(t){if(!ft(Object.assign)&&!ft(Array.from)&&!(this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut())){var n,r;this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),P0()?this._onScriptLoaded():(n=jt.__PosthogExtensions__)===null||n===void 0||(r=n.loadExternalDependency)===null||r===void 0||r.call(n,this.instance,this.scriptName,s=>{if(s)return xs.error("could not load recorder",s);this._onScriptLoaded()}),xs.info("starting"),this.status==="active"&&this._reportStarted(t||"recording_initialized")}}get scriptName(){var t,n,r;return((t=this.instance)===null||t===void 0||(n=t.persistence)===null||n===void 0||(r=n.get_property(DA))===null||r===void 0?void 0:r.script)||"recorder"}isInteractiveEvent(t){var n;return t.type===3&&aQ.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 r=!1;if(n&&(this._lastActivityTimestamp=t.timestamp,this.isIdle)){var s=this.isIdle==="unknown";this.isIdle=!1,s||(this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:t.type}),r=!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")):r&&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}):xs.warn("could not emit queued rrweb event.",n,t),!1}}_tryAddCustomEvent(t,n){return this._tryRRWebMethod(YA(()=>P0().addCustomEvent(t,n)))}_tryTakeFullSnapshot(){return this._tryRRWebMethod(YA(()=>P0().takeFullSnapshot()))}_onScriptLoaded(){var t,n,r,s,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=Oe({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=(r=this.masking.maskTextSelector)!==null&&r!==void 0?r:void 0,i.blockSelector=(s=this.masking.blockSelector)!==null&&s!==void 0?s:void 0);var c=P0();if(c){this.mutationRateLimiter=(t=this.mutationRateLimiter)!==null&&t!==void 0?t:new KX(c,{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");xs.info(p,{node:f}),this.log(Ip+" "+p,"warn")}});var d=this._gatherRRWebPlugins();this.stopRrweb=c(Oe({emit:h=>{this.onRRwebEmit(h)},plugins:d},i)),this._lastActivityTimestamp=Date.now(),this.isIdle=qo(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 xs.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,r,s,i=[],a=(t=jt.__PosthogExtensions__)===null||t===void 0||(n=t.rrwebPlugins)===null||n===void 0?void 0:n.getRecordConsolePlugin;a&&this.isConsoleLogCaptureEnabled&&i.push(a());var o=(r=jt.__PosthogExtensions__)===null||r===void 0||(s=r.rrwebPlugins)===null||s===void 0?void 0:s.getRecordNetworkPlugin;return this.networkPayloadCapture&&Ta(o)&&(!fX.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?i.push(o(qX(this.instance.config,this.networkPayloadCapture))):xs.info("NetworkCapture not started because we are on localhost.")),i}onRRwebEmit(t){var n;if(this._processQueuedEvents(),t&&lr(t)){if(t.type===$o.Meta){var r=this._maskUrl(t.data.href);if(this._lastHref=r,!r)return;t.data.href=r}else this._pageViewFallBack();if(this._checkUrlTriggerConditions(),!this._urlBlocked||function(h){return h.type===$o.Custom&&h.data.tag==="recording paused"}(t)){t.type===$o.FullSnapshot&&this._scheduleFullSnapshot(),t.type===$o.FullSnapshot&&this.triggerStatus==="trigger_pending"&&this.clearBuffer();var s=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(t):t;if(s){var i=function(h){var f=h;if(f&&lr(f)&&f.type===6&&lr(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}(s);if(this._updateWindowAndSessionIds(i),this.isIdle!==!0||XA(i)){if(XA(i)){var a=i.data.payload;if(a){var o=a.lastActivityTimestamp,l=a.threshold;i.timestamp=o+l}}var c=(n=this.instance.config.session_recording.compress_events)===null||n===void 0||n?function(h){if(hx(h)<1024)return h;try{if(h.type===$o.FullSnapshot)return Oe(Oe({},h),{},{data:qc(h.data),cv:"2024-10"});if(h.type===$o.IncrementalSnapshot&&h.data.source===ba.Mutation)return Oe(Oe({},h),{},{cv:"2024-10",data:Oe(Oe({},h.data),{},{texts:qc(h.data.texts),attributes:qc(h.data.attributes),removes:qc(h.data.removes),adds:qc(h.data.adds)})});if(h.type===$o.IncrementalSnapshot&&h.data.source===ba.StyleSheetRule)return Oe(Oe({},h),{},{cv:"2024-10",data:Oe(Oe({},h.data),{},{adds:h.data.adds?qc(h.data.adds):void 0,removes:h.data.removes?qc(h.data.removes):void 0})})}catch(f){xs.error("could not compress event - will use uncompressed event",f)}return h}(i):i,d={$snapshot_bytes:hx(c),$snapshot_data:c,$session_id:this.sessionId,$window_id:this.windowId};this.status!=="disabled"?this._captureSnapshotBuffered(d):this.clearBuffer()}}}}}_pageViewFallBack(){if(!this.instance.config.capture_pageview&&Fe){var t=this._maskUrl(Fe.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 r,s={url:t};return(r=s=n.maskNetworkRequestFn(s))===null||r===void 0?void 0:r.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,r=qs(n)&&n>=0,s=qs(t)&&r&&n<t;return this.status==="buffering"||this.status==="paused"||this.status==="disabled"||s?(this.flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3),this.buffer):(this.buffer.data.length>0&&oS(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:Wo.LIB_VERSION})}),this.clearBuffer())}_captureSnapshotBuffered(t){var n,r=2+(((n=this.buffer)===null||n===void 0?void 0:n.data.length)||0);!this.isIdle&&(this.buffer.size+t.$snapshot_bytes+r>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(Fe!==void 0&&Fe.location.href){var t=Fe.location.href,n=this._urlBlocked,r=QA(t,this._urlBlocklist);r&&!n?this._pauseRecording():!r&&n&&this._resumeRecording(),QA(t,this._urlTriggers)&&this._activateTrigger("url")}}_activateTrigger(t){var n,r;this.triggerStatus==="trigger_pending"&&((n=this.instance)===null||n===void 0||(r=n.persistence)===null||r===void 0||r.register({[t==="url"?iC:aC]:this.sessionId}),this._flushBuffer(),this._reportStarted(t+"_trigger_matched"))}_pauseRecording(){this._urlBlocked||(this._urlBlocked=!0,clearInterval(this._fullSnapshotTimer),xs.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"}),xs.info("recording resumed"))}_addEventTriggerListener(){this._eventTriggers.length!==0&&En(this._removeEventTriggerCaptureHook)&&(this._removeEventTriggerCaptureHook=this.instance.on("eventCaptured",t=>{try{this._eventTriggers.includes(t.event)&&this._activateTrigger("event")}catch(n){xs.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({[Dp]:!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}),xs.info(t.replace("_"," "),n),Yt(["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 vC=Ds("[SegmentIntegration]");function lQ(e,t){var n=e.config.segment;if(!n)return t();(function(r,s){var i=r.config.segment;if(!i)return s();var a=l=>{var c=()=>l.anonymousId()||Kl();r.config.get_device_id=c,l.id()&&(r.register({distinct_id:l.id(),$device_id:c()}),r.persistence.set_property(Go,"identified")),s()},o=i.user();"then"in o&&Ta(o.then)?o.then(l=>a(l)):a(o)})(e,()=>{n.register((r=>{Promise&&Promise.resolve||vC.warn("This browser does not have Promise support, and can not use the segment integration");var s=(i,a)=>{var o;if(!a)return i;i.event.userId||i.event.anonymousId===r.get_distinct_id()||(vC.info("No userId set, resetting PostHog"),r.reset()),i.event.userId&&i.event.userId!==r.get_distinct_id()&&(vC.info("UserId set, identifying with PostHog"),r.identify(i.event.userId));var l=r._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=>s(i,i.event.event),page:i=>s(i,"$pageview"),identify:i=>s(i,"$identify"),screen:i=>s(i,"$screen")}})(e)).then(()=>{t()})})}var h4="posthog-js";function f4(e){var{organization:t,projectId:n,prefix:r,severityAllowList:s=["error"]}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return i=>{var a,o,l,c,d;if(!(s==="*"||s.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=>Oe(Oe({},v),{},{stacktrace:v.stacktrace?Oe(Oe({},v.stacktrace),{},{type:"raw",frames:(v.stacktrace.frames||[]).map(x=>Oe(Oe({},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:((c=f[0])===null||c===void 0?void 0:c.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=(r||"https://sentry.io/organizations/")+t+"/issues/?project="+n+"&query="+i.event_id),e.exceptions.sendExceptionEvent(m),i}}let cQ=class{constructor(t,n,r,s,i){this.name=h4,this.setupOnce=function(a){a(f4(t,{organization:n,projectId:r,prefix:s,severityAllowList:i}))}}};var Vo,uQ=Fe!=null&&Fe.location?dx(Fe.location.hash,"__posthog")||dx(location.hash,"state"):null,JA="_postHogToolbarParams",ZA=Ds("[Toolbar]");(function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"})(Vo||(Vo={}));class dQ{constructor(t){this.instance=t}setToolbarState(t){jt.ph_toolbar_state=t}getToolbarState(){var t;return(t=jt.ph_toolbar_state)!==null&&t!==void 0?t:Vo.UNINITIALIZED}maybeLoadToolbar(){var t,n,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(!Fe||!mt)return!1;r=(t=r)!==null&&t!==void 0?t:Fe.location,i=(n=i)!==null&&n!==void 0?n:Fe.history;try{if(!s){try{Fe.localStorage.setItem("test","test"),Fe.localStorage.removeItem("test")}catch{return!1}s=Fe?.localStorage}var a,o=uQ||dx(r.hash,"__posthog")||dx(r.hash,"state"),l=o?wA(()=>JSON.parse(atob(decodeURIComponent(o))))||wA(()=>JSON.parse(decodeURIComponent(o))):null;return l&&l.action==="ph_authorize"?((a=l).source="url",a&&Object.keys(a).length>0&&(l.desiredHash?r.hash=l.desiredHash:i?i.replaceState(i.state,"",r.pathname+r.search):r.hash="")):((a=JSON.parse(s.getItem(JA)||"{}")).source="localstorage",delete a.userIntent),!(!a.token||this.instance.config.token!==a.token)&&(this.loadToolbar(a),!0)}catch{return!1}}_callLoadToolbar(t){var n=jt.ph_load_toolbar||jt.ph_load_editor;!En(n)&&Ta(n)?n(t,this.instance):ZA.warn("No toolbar load function found")}loadToolbar(t){var n=!(mt==null||!mt.getElementById($3));if(!Fe||n)return!1;var r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=Oe(Oe({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(Fe.localStorage.setItem(JA,JSON.stringify(Oe(Oe({},s),{},{source:void 0}))),this.getToolbarState()===Vo.LOADED)this._callLoadToolbar(s);else if(this.getToolbarState()===Vo.UNINITIALIZED){var i,a;this.setToolbarState(Vo.LOADING),(i=jt.__PosthogExtensions__)===null||i===void 0||(a=i.loadExternalDependency)===null||a===void 0||a.call(i,this.instance,"toolbar",o=>{if(o)return ZA.error("[Toolbar] Failed to load",o),void this.setToolbarState(Vo.UNINITIALIZED);this.setToolbarState(Vo.LOADED),this._callLoadToolbar(s)}),vr(Fe,"turbolinks:load",()=>{this.setToolbarState(Vo.UNINITIALIZED),this.loadToolbar(s)})}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,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;return this.maybeLoadToolbar(t,n,r)}}var hQ=Ds("[TracingHeaders]");class fQ{constructor(t){nt(this,"_restoreXHRPatch",void 0),nt(this,"_restoreFetchPatch",void 0),nt(this,"_startCapturing",()=>{var n,r,s,i;ft(this._restoreXHRPatch)&&((n=jt.__PosthogExtensions__)===null||n===void 0||(r=n.tracingHeadersPatchFns)===null||r===void 0||r._patchXHR(this.instance.sessionManager)),ft(this._restoreFetchPatch)&&((s=jt.__PosthogExtensions__)===null||s===void 0||(i=s.tracingHeadersPatchFns)===null||i===void 0||i._patchFetch(this.instance.sessionManager))}),this.instance=t}_loadScript(t){var n,r,s;(n=jt.__PosthogExtensions__)!==null&&n!==void 0&&n.tracingHeadersPatchFns&&t(),(r=jt.__PosthogExtensions__)===null||r===void 0||(s=r.loadExternalDependency)===null||s===void 0||s.call(r,this.instance,"tracing-headers",i=>{if(i)return hQ.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 Il=Ds("[Web Vitals]"),eF=9e5;class pQ{constructor(t){var n;nt(this,"_enabledServerSide",!1),nt(this,"_initialized",!1),nt(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),nt(this,"_flushToCapture",()=>{clearTimeout(this._delayedFlushTimer),this.buffer.metrics.length!==0&&(this.instance.capture("$web_vitals",this.buffer.metrics.reduce((r,s)=>Oe(Oe({},r),{},{["$web_vitals_".concat(s.name,"_event")]:Oe({},s),["$web_vitals_".concat(s.name,"_value")]:s.value}),{})),this.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})}),nt(this,"_addToBuffer",r=>{var s,i=(s=this.instance.sessionManager)===null||s===void 0?void 0:s.checkAndGetSessionAndWindowId(!0);if(ft(i))Il.error("Could not read session ID. Dropping metrics!");else{this.buffer=this.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var a=this._currentURL();ft(a)||(En(r?.name)||En(r?.value)?Il.error("Invalid metric received",r):this._maxAllowedValue&&r.value>=this._maxAllowedValue?Il.error("Ignoring metric with value >= "+this._maxAllowedValue,r):(this.buffer.url!==a&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),ft(this.buffer.url)&&(this.buffer.url=a),this.buffer.firstMetricTimestamp=ft(this.buffer.firstMetricTimestamp)?Date.now():this.buffer.firstMetricTimestamp,r.attribution&&r.attribution.interactionTargetElement&&(r.attribution.interactionTargetElement=void 0),this.buffer.metrics.push(Oe(Oe({},r),{},{$current_url:a,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()))}}),nt(this,"_startCapturing",()=>{var r,s,i,a,o=jt.__PosthogExtensions__;ft(o)||ft(o.postHogWebVitalsCallbacks)||({onLCP:r,onCLS:s,onFCP:i,onINP:a}=o.postHogWebVitalsCallbacks),r&&s&&i&&a?(this.allowedMetrics.indexOf("LCP")>-1&&r(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&s(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):Il.error("web vitals callbacks not loaded - not starting")}),this.instance=t,this._enabledServerSide=!((n=this.instance.persistence)===null||n===void 0||!n.props[SA]),this.startIfEnabled()}get allowedMetrics(){var t,n,r=lr(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 ft(r)?((n=this.instance.persistence)===null||n===void 0?void 0:n.props[EA])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(lr(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){var t=lr(this.instance.config.capture_performance)&&qs(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:eF;return 0<t&&t<=6e4?eF:t}get isEnabled(){var t=ti?.protocol;if(t!=="http:"&&t!=="https:")return Il.info("Web Vitals are disabled on non-http/https protocols"),!1;var n=lr(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:qo(this.instance.config.capture_performance)?this.instance.config.capture_performance:void 0;return qo(n)?n:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(Il.info("enabled, starting..."),this.loadScript(this._startCapturing))}onRemoteConfig(t){var n=lr(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=lr(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this.instance.persistence&&(this.instance.persistence.register({[SA]:n}),this.instance.persistence.register({[EA]:r})),this._enabledServerSide=n,this.startIfEnabled()}loadScript(t){var n,r,s;(n=jt.__PosthogExtensions__)!==null&&n!==void 0&&n.postHogWebVitalsCallbacks&&t(),(r=jt.__PosthogExtensions__)===null||r===void 0||(s=r.loadExternalDependency)===null||s===void 0||s.call(r,this.instance,"web-vitals",i=>{i?Il.error("failed to load script",i):t()})}_currentURL(){var t=Fe?Fe.location.href:void 0;return t||Il.error("Could not determine current URL"),t}}var gQ=Ds("[Heatmaps]");function tF(e){return lr(e)&&"clientX"in e&&"clientY"in e&&qs(e.clientX)&&qs(e.clientY)}class mQ{constructor(t){var n;nt(this,"rageclicks",new e4),nt(this,"_enabledServerSide",!1),nt(this,"_initialized",!1),nt(this,"_flushInterval",null),this.instance=t,this._enabledServerSide=!((n=this.instance.persistence)===null||n===void 0||!n.props[Yy])}get flushIntervalMilliseconds(){var t=5e3;return lr(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 ft(this.instance.config.capture_heatmaps)?ft(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;gQ.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({[Yy]: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(){Fe&&mt&&(vr(Fe,"beforeunload",this.flush.bind(this)),vr(mt,"click",t=>this._onClick(t||Fe?.event),{capture:!0}),vr(mt,"mousemove",t=>this._onMouseMove(t||Fe?.event),{capture:!0}),this.deadClicksCapture=new n4(this.instance,AX,this._onDeadClick.bind(this)),this.deadClicksCapture.startIfEnabled(),this._initialized=!0)}_getProperties(t,n){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),a=function(o,l,c){for(var d=o;d&&zb(d)&&!sc(d,"body");){if(d===c)return!1;if(Yt(l,Fe?.getComputedStyle(d).position))return!0;d=K3(d)}return!1}(q3(t),["fixed","sticky"],i);return{x:t.clientX+(a?0:s),y:t.clientY+(a?0:r),target_fixed:a,type:n}}_onClick(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"click";if(!IA(t.target)&&tF(t)){var s=this._getProperties(t,r);(n=this.rageclicks)!==null&&n!==void 0&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this._capture(Oe(Oe({},s),{},{type:"rageclick"})),this._capture(s)}}_onMouseMove(t){!IA(t.target)&&tF(t)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(t,"mousemove"))},500))}_capture(t){if(Fe){var n=Fe.location.href;this.buffer=this.buffer||{},this.buffer[n]||(this.buffer[n]=[]),this.buffer[n].push(t)}}flush(){this.buffer&&!eh(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class vQ{constructor(t){this._instance=t}doPageView(t,n){var r,s=this._previousPageViewProperties(t,n);return this._currentPageview={pathname:(r=Fe?.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),s}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 r=this._currentPageview;if(!r)return{$pageview_id:n};var s={$pageview_id:n,$prev_pageview_id:r.pageViewId},i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:o,maxScrollY:l,maxContentHeight:c,lastContentY:d,maxContentY:h}=i;if(!(ft(a)||ft(o)||ft(l)||ft(c)||ft(d)||ft(h))){a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),c=Math.ceil(c),d=Math.ceil(d),h=Math.ceil(h);var f=a<=1?1:Ki(o/a,0,1),p=a<=1?1:Ki(l/a,0,1),m=c<=1?1:Ki(d/c,0,1),v=c<=1?1:Ki(h/c,0,1);s=gr(s,{$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 r.pathname&&(s.$prev_pageview_pathname=r.pathname),r.timestamp&&(s.$prev_pageview_duration=(t.getTime()-r.timestamp.getTime())/1e3),s}}let xQ=class{constructor(t){this.instance=t}sendExceptionEvent(t){this.instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent"})}};var ea="Mobile",px="iOS",lo="Android",$g="Tablet",p4=lo+" "+$g,g4="iPad",m4="Apple",v4=m4+" Watch",Vg="Safari",$h="BlackBerry",x4="Samsung",b4=x4+"Browser",w4=x4+" Internet",$u="Chrome",bQ=$u+" OS",C4=$u+" "+px,Kk="Internet Explorer",y4=Kk+" "+ea,Yk="Opera",wQ=Yk+" Mini",Xk="Edge",S4="Microsoft "+Xk,fh="Firefox",E4=fh+" "+px,Wg="Nintendo",zg="PlayStation",ph="Xbox",k4=lo+" "+ea,_4=ea+" "+Vg,Np="Windows",pS=Np+" Phone",nF="Nokia",gS="Ouya",T4="Generic",CQ=T4+" "+ea.toLowerCase(),R4=T4+" "+$g.toLowerCase(),mS="Konqueror",Gs="(\\d+(\\.\\d+)?)",xC=new RegExp("Version/"+Gs),yQ=new RegExp(ph,"i"),SQ=new RegExp(zg+" \\w+","i"),EQ=new RegExp(Wg+" \\w+","i"),Qk=new RegExp($h+"|PlayBook|BB10","i"),kQ={"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"},vS,_Q=(e,t)=>t&&Yt(t,m4)||function(n){return Yt(n,Vg)&&!Yt(n,$u)&&!Yt(n,lo)}(e),rF=function(e,t){return t=t||"",Yt(e," OPR/")&&Yt(e,"Mini")?wQ:Yt(e," OPR/")?Yk:Qk.test(e)?$h:Yt(e,"IE"+ea)||Yt(e,"WPDesktop")?y4:Yt(e,b4)?w4:Yt(e,Xk)||Yt(e,"Edg/")?S4:Yt(e,"FBIOS")?"Facebook "+ea:Yt(e,"UCWEB")||Yt(e,"UCBrowser")?"UC Browser":Yt(e,"CriOS")?C4:Yt(e,"CrMo")||Yt(e,$u)?$u:Yt(e,lo)&&Yt(e,Vg)?k4:Yt(e,"FxiOS")?E4:Yt(e.toLowerCase(),mS.toLowerCase())?mS:_Q(e,t)?Yt(e,ea)?_4:Vg:Yt(e,fh)?fh:Yt(e,"MSIE")||Yt(e,"Trident/")?Kk:Yt(e,"Gecko")?fh:""},TQ={[y4]:[new RegExp("rv:"+Gs)],[S4]:[new RegExp(Xk+"?\\/"+Gs)],[$u]:[new RegExp("("+$u+"|CrMo)\\/"+Gs)],[C4]:[new RegExp("CriOS\\/"+Gs)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Gs)],[Vg]:[xC],[_4]:[xC],[Yk]:[new RegExp("(Opera|OPR)\\/"+Gs)],[fh]:[new RegExp(fh+"\\/"+Gs)],[E4]:[new RegExp("FxiOS\\/"+Gs)],[mS]:[new RegExp("Konqueror[:/]?"+Gs,"i")],[$h]:[new RegExp($h+" "+Gs),xC],[k4]:[new RegExp("android\\s"+Gs,"i")],[w4]:[new RegExp(b4+"\\/"+Gs)],[Kk]:[new RegExp("(rv:|MSIE )"+Gs)],Mozilla:[new RegExp("rv:"+Gs)]},sF=[[new RegExp(ph+"; "+ph+" (.*?)[);]","i"),e=>[ph,e&&e[1]||""]],[new RegExp(Wg,"i"),[Wg,""]],[new RegExp(zg,"i"),[zg,""]],[Qk,[$h,""]],[new RegExp(Np,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[pS,""];if(new RegExp(ea).test(t)&&!/IEMobile\b/.test(t))return[Np+" "+ea,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=n[1],s=kQ[r]||"";return/arm/i.test(t)&&(s="RT"),[Np,s]}return[Np,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[px,t.join(".")]}return[px,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=ft(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+lo+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+lo+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[lo,t.join(".")]}return[lo,""]}],[/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/,[bQ,""]],[/Linux|debian/i,["Linux",""]]],iF=function(e){return EQ.test(e)?Wg:SQ.test(e)?zg:yQ.test(e)?ph:new RegExp(gS,"i").test(e)?gS:new RegExp("("+pS+"|WPDesktop)","i").test(e)?pS:/iPad/.test(e)?g4:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?v4:Qk.test(e)?$h:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(nF,"i").test(e)?nF:/(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(ea).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)?lo:p4:lo:new RegExp("(pda|"+ea+")","i").test(e)?CQ:new RegExp($g,"i").test(e)&&!new RegExp($g+" pc","i").test(e)?R4:""},I0="https?://(.*)",Fv=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","irclid","_kx"],RQ=_v(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Fv),bC="<masked>",Yn={campaignParams:function(){var{customTrackedParams:e,maskPersonalDataProperties:t,customPersonalDataProperties:n}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!mt)return{};var r=t?_v([],Fv,n||[]):[];return this._campaignParamsFromUrl(oC(mt.URL,r,bC),e)},_campaignParamsFromUrl:function(e,t){var n=RQ.concat(t||[]),r={};return Fn(n,function(s){var i=ux(e,s);r[s]=i||null}),r},_searchEngine:function(e){return e?e.search(I0+"google.([^/?]*)")===0?"google":e.search(I0+"bing.com")===0?"bing":e.search(I0+"yahoo.com")===0?"yahoo":e.search(I0+"duckduckgo.com")===0?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){var t=Yn._searchEngine(e),n=t!="yahoo"?"q":"p",r={};if(!Tc(t)){r.$search_engine=t;var s=mt?ux(mt.referrer,n):"";s.length&&(r.ph_keyword=s)}return r},searchInfo:function(){var e=mt?.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:rF,browserVersion:function(e,t){var n=rF(e,t),r=TQ[n];if(ft(r))return null;for(var s=0;s<r.length;s++){var i=r[s],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<sF.length;t++){var[n,r]=sF[t],s=n.exec(e),i=s&&(Ta(r)?r(s,e):r);if(i)return i}return["",""]},device:iF,deviceType:function(e){var t=iF(e);return t===g4||t===p4||t==="Kobo"||t==="Kindle Fire"||t===R4?$g:t===Wg||t===ph||t===zg||t===gS?"Console":t===v4?"Wearable":t?ea:"Desktop"},referrer:function(){return mt?.referrer||"$direct"},referringDomain:function(){var e;return mt!=null&&mt.referrer&&((e=hh(mt.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?_v([],Fv,t||[]):[],r=ti?.href.substring(0,1e3);return{r:this.referrer().substring(0,1e3),u:r?oC(r,n,bC):void 0}},personPropsFromInfo:function(e){var t,{r:n,u:r}=e,s={$referrer:n,$referring_domain:n==null?void 0:n=="$direct"?"$direct":(t=hh(n))===null||t===void 0?void 0:t.host};if(r){s.$current_url=r;var i=hh(r);s.$host=i?.host,s.$pathname=i?.pathname;var a=this._campaignParamsFromUrl(r);gr(s,a)}if(n){var o=this._searchInfoFromReferrer(n);gr(s,o)}return s},initialPersonPropsFromInfo:function(e){var t=this.personPropsFromInfo(e),n={};return Fn(t,function(r,s){n["$initial_".concat($k(s))]=r}),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(!Tr)return{};var n=e?_v([],Fv,t||[]):[],[r,s]=Yn.os(Tr);return gr(Gg({$os:r,$os_version:s,$browser:Yn.browser(Tr,navigator.vendor),$device:Yn.device(Tr),$device_type:Yn.deviceType(Tr),$timezone:Yn.timezone(),$timezone_offset:Yn.timezoneOffset()}),{$current_url:oC(ti?.href,n,bC),$host:ti?.host,$pathname:ti?.pathname,$raw_user_agent:Tr.length>1e3?Tr.substring(0,997)+"...":Tr,$browser_version:Yn.browserVersion(Tr,navigator.vendor),$browser_language:Yn.browserLanguage(),$browser_language_prefix:Yn.browserLanguagePrefix(),$screen_height:Fe?.screen.height,$screen_width:Fe?.screen.width,$viewport_height:Fe?.innerHeight,$viewport_width:Fe?.innerWidth,$lib:"web",$lib_version:Wo.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(!Tr)return{};var[e,t]=Yn.os(Tr);return gr(Gg({$os:e,$os_version:t,$browser:Yn.browser(Tr,navigator.vendor)}),{$browser_version:Yn.browserVersion(Tr,navigator.vendor)})}},Ja=Ds("[FeatureFlags]"),wC="$active_feature_flags",Pd="$override_feature_flags",aF="$feature_flag_payloads",ip="$override_feature_flag_payloads",oF="$feature_flag_request_id",lF=e=>{var t={};for(var[n,r]of Tv(e||{}))r&&(t[n]=r);return t},AQ=e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map(n=>{var r;return[n,(r=t[n].variant)!==null&&r!==void 0?r:t[n].enabled]})),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter(n=>t[n].enabled).filter(n=>{var r;return(r=t[n].metadata)===null||r===void 0?void 0:r.payload}).map(n=>{var r;return[n,(r=t[n].metadata)===null||r===void 0?void 0:r.payload]}))):Ja.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"})(vS||(vS={}));class FQ{constructor(t){nt(this,"_override_warning",!1),nt(this,"_hasLoadedFlags",!1),nt(this,"_requestInFlight",!1),nt(this,"_reloadingDisabled",!1),nt(this,"_additionalReloadRequested",!1),nt(this,"_decideCalled",!1),nt(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(Qy),n=this.instance.get_property(Pd),r=this.instance.get_property(ip);if(!r&&!n)return t||{};var s=gr({},t||{}),i=[...new Set([...Object.keys(r||{}),...Object.keys(n||{})])];for(var a of i){var o,l,c=s[a],d=n?.[a],h=ft(d)?(o=c?.enabled)!==null&&o!==void 0&&o:!!d,f=ft(d)?c.variant:typeof d=="string"?d:void 0,p=r?.[a],m=Oe(Oe({},c),{},{enabled:h,variant:h?f??c?.variant:void 0});h!==c?.enabled&&(m.original_enabled=c?.enabled),f!==c?.variant&&(m.original_variant=c?.variant),p&&(m.metadata=Oe(Oe({},c?.metadata),{},{payload:p,original_payload:c==null||(l=c.metadata)===null||l===void 0?void 0:l.payload})),s[a]=m}return this._override_warning||(Ja.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this._override_warning=!0),s}getFlagVariants(){var t=this.instance.get_property(th),n=this.instance.get_property(Pd);if(!n)return t||{};for(var r=gr({},t),s=Object.keys(n),i=0;i<s.length;i++)r[s[i]]=n[s[i]];return this._override_warning||(Ja.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:n,finalFlags:r}),this._override_warning=!0),r}getFlagPayloads(){var t=this.instance.get_property(aF),n=this.instance.get_property(ip);if(!n)return t||{};for(var r=gr({},t||{}),s=Object.keys(n),i=0;i<s.length;i++)r[s[i]]=n[s[i]];return this._override_warning||(Ja.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:n,finalPayloads:r}),this._override_warning=!0),r}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 r={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:Oe(Oe({},((n=this.instance.persistence)===null||n===void 0?void 0:n.get_initial_props())||{}),this.instance.get_property(Pp)||{}),group_properties:this.instance.get_property(Qc)};(t!=null&&t.disableFlags||this.instance.config.advanced_disable_feature_flags)&&(r.disable_flags=!0);var s=this.instance.config.__preview_flags_v2&&this.instance.config.__preview_remote_config;s&&(r.timezone=Yn.timezone()),this._requestInFlight=!0,this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api",s?"/flags/?v=2":"/decide/?v=4"),data:r,compression:this.instance.config.disable_compression?void 0:Sa.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:i=>{var a,o,l,c=!0;i.statusCode===200&&(this._additionalReloadRequested||(this.$anon_distinct_id=void 0),c=!1),this._requestInFlight=!1,this._decideCalled||(this._decideCalled=!0,this.instance._onRemoteConfig((l=i.json)!==null&&l!==void 0?l:{})),r.disable_flags&&!this._additionalReloadRequested||(this._flagsLoadedFromRemote=!c,i.json&&(a=i.json.quotaLimited)!==null&&a!==void 0&&a.includes(vS.FeatureFlags)?Ja.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:{},c),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 r=this.getFlagVariants()[t],s="".concat(r),i=this.instance.get_property(oF)||void 0,a=this.instance.get_property(ox)||{};if((n.send_event||!("send_event"in n))&&(!(t in a)||!a[t].includes(s))){var o,l,c,d,h,f,p,m,v,x,b;or(a[t])?a[t].push(s):a[t]=[s],(o=this.instance.persistence)===null||o===void 0||o.register({[ox]:a});var w=this.getFeatureFlagDetails(t),C={$feature_flag:t,$feature_flag_response:r,$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||(c=l.featureFlags)===null||c===void 0?void 0:c[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};ft(w==null||(f=w.metadata)===null||f===void 0?void 0:f.version)||(C.$feature_flag_version=w.metadata.version);var E,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),ft(w?.original_variant)&&ft(w?.original_enabled)||(C.$feature_flag_original_response=ft(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||(E=w.metadata)===null||E===void 0?void 0:E.original_payload),this.instance.capture("$feature_flag_called",C)}return r}Ja.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 r=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:r},compression:this.instance.config.disable_compression?void 0:Sa.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:s=>{var i,a=(i=s.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);Ja.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 r=this.getFlagVariants(),s=this.getFlagPayloads(),i=this.getFlagsWithDetails();(function(a,o){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},d=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{},h=AQ(a),f=h.flags,p=h.featureFlags,m=h.featureFlagPayloads;if(p){var v=a.requestId;if(or(p)){Ja.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({[wC]:p,[th]:x})}else{var w=p,C=m,E=f;a.errorsWhileComputingFlags&&(w=Oe(Oe({},l),w),C=Oe(Oe({},c),C),E=Oe(Oe({},d),E)),o&&o.register(Oe({[wC]:Object.keys(lF(w)),[th]:w||{},[aF]:C||{},[Qy]:E||{}},v?{[oF]:v}:{}))}}})(t,this.instance.persistence,r,s,i),this._fireFeatureFlagsCallbacks(n)}}override(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];Ja.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:n})}overrideFeatureFlags(t){if(!this.instance.__loaded||!this.instance.persistence)return Ja.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.instance.persistence.unregister(Pd),this.instance.persistence.unregister(ip),void this._fireFeatureFlagsCallbacks();if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var n,r=t;if(this._override_warning=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this.instance.persistence.unregister(Pd);else if(r.flags)if(or(r.flags)){for(var s={},i=0;i<r.flags.length;i++)s[r.flags[i]]=!0;this.instance.persistence.register({[Pd]:s})}else this.instance.persistence.register({[Pd]:r.flags})}return"payloads"in r&&(r.payloads===!1?this.instance.persistence.unregister(ip):r.payloads&&this.instance.persistence.register({[ip]:r.payloads})),void this._fireFeatureFlagsCallbacks()}this._fireFeatureFlagsCallbacks()}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this._hasLoadedFlags){var{flags:n,flagVariants:r}=this._prepareFeatureFlagsForCallbacks();t(n,r)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,n){var r,s=(this.instance.get_property(Rv)||[]).find(l=>l.flagKey===t),i={["$feature_enrollment/".concat(t)]:n},a={$feature_flag:t,$feature_enrollment:n,$set:i};s&&(a.$early_access_feature_name=s.name),this.instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(i,!1);var o=Oe(Oe({},this.getFlagVariants()),{},{[t]:n});(r=this.instance.persistence)===null||r===void 0||r.register({[wC]:Object.keys(lF(o)),[th]:o}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1],r=arguments.length>2?arguments[2]:void 0,s=this.instance.get_property(Rv),i=r?"&".concat(r.map(a=>"stage=".concat(a)).join("&")):"";if(s&&!n)return t(s);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({[Rv]:l}),t(l)}}})}_prepareFeatureFlagsForCallbacks(){var t=this.getFlags(),n=this.getFlagVariants();return{flags:t.filter(r=>n[r]),flagVariants:Object.keys(n).filter(r=>n[r]).reduce((r,s)=>(r[s]=n[s],r),{})}}_fireFeatureFlagsCallbacks(t){var{flags:n,flagVariants:r}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach(s=>s(n,r,{errorsLoading:t}))}setPersonPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],r=this.instance.get_property(Pp)||{};this.instance.register({[Pp]:Oe(Oe({},r),t)}),n&&this.instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this.instance.unregister(Pp)}setGroupPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],r=this.instance.get_property(Qc)||{};Object.keys(r).length!==0&&Object.keys(r).forEach(s=>{r[s]=Oe(Oe({},r[s]),t[s]),delete t[s]}),this.instance.register({[Qc]:Oe(Oe({},r),t)}),n&&this.instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var n=this.instance.get_property(Qc)||{};this.instance.register({[Qc]:Oe(Oe({},n),{},{[t]:{}})})}else this.instance.unregister(Qc)}}var DQ=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class CC{constructor(t){this.config=t,this.props={},this.campaign_params_saved=!1,this.name=(n=>{var r="";return n.token&&(r=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+r+"_posthog"})(t),this.storage=this.buildStorage(t),this.load(),t.debug&&wt.info("Persistence loaded",t.persistence,Oe({},this.props)),this.update_config(t,t),this.save()}buildStorage(t){DQ.indexOf(t.persistence.toLowerCase())===-1&&(wt.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n=t.persistence.toLowerCase();return n==="localstorage"&&Fr.is_supported()?Fr:n==="localstorage+cookie"&&T0.is_supported()?T0:n==="sessionstorage"&&ls.is_supported()?ls:n==="memory"?TX:n==="cookie"?Qo:T0.is_supported()?T0:Qo}properties(){var t={};return Fn(this.props,function(n,r){if(r===th&&lr(n))for(var s=Object.keys(n),i=0;i<s.length;i++)t["$feature/".concat(s[i])]=n[s[i]];else o=r,l=!1,(Tc(a=iX)?l:mA&&a.indexOf===mA?a.indexOf(o)!=-1:(Fn(a,function(c){if(l||(l=c===o))return ix}),l))||(t[r]=n);var a,o,l}),t}load(){if(!this.disabled){var t=this.storage.parse(this.name);t&&(this.props=gr({},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,r){if(lr(t)){ft(n)&&(n="None"),this.expire_days=ft(r)?this.default_expiry:r;var s=!1;if(Fn(t,(i,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==n||(this.props[a]=i,s=!0)}),s)return this.save(),!0}return!1}register(t,n){if(lr(t)){this.expire_days=ft(n)?this.default_expiry:n;var r=!1;if(Fn(t,(s,i)=>{t.hasOwnProperty(i)&&this.props[i]!==s&&(this.props[i]=s,r=!0)}),r)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=Yn.campaignParams({customTrackedParams:this.config.custom_campaign_params,maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});eh(Gg(t))||this.register(t),this.campaign_params_saved=!0}}update_search_keyword(){this.register(Yn.searchInfo())}update_referrer_info(){this.register_once(Yn.referrerInfo(),void 0)}set_initial_person_info(){this.props[tS]||this.props[nS]||this.register_once({[rS]:Yn.personInfo({maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties})},void 0)}get_referrer_info(){return Gg({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}get_initial_props(){var t={};Fn([nS,tS],s=>{var i=this.props[s];i&&Fn(i,function(a,o){t["$initial_"+$k(o)]=a})});var n=this.props[rS];if(n){var r=Yn.initialPersonPropsFromInfo(n);gr(t,r)}return t}safe_merge(t){return Fn(this.props,function(n,r){r in t||(t[r]=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 r=this.buildStorage(t),s=this.props;this.clear(),this.storage=r,this.props=s,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 r=this.props[Fp]||{};r[t]=n,this.props[Fp]=r,this.save()}remove_event_timer(t){var n=(this.props[Fp]||{})[t];return ft(n)||(delete this.props[Fp][t],this.save()),n}get_property(t){return this.props[t]}set_property(t,n){this.props[t]=n,this.save()}}var A4,cr,F4,nu,cF,D4,xS,P4,uF,bS,dF,hF,fF,pF,wS={},I4=[],PQ=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Jk=Array.isArray;function Yl(e,t){for(var n in t)e[n]=t[n];return e}function N4(e){var t=e.parentNode;t&&t.removeChild(e)}function yC(e,t,n,r,s){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:s??++F4,__i:-1,__u:0};return s==null&&cr.vnode!=null&&cr.vnode(i),i}function Zk(e){return e.children}function Dv(e,t){this.props=e,this.context=t}function Vh(e,t){if(t==null)return e.__?Vh(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"?Vh(e):null}function M4(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 M4(e)}}function CS(e){(!e.__d&&(e.__d=!0)&&nu.push(e)&&!gx.__r++||cF!==cr.debounceRendering)&&((cF=cr.debounceRendering)||D4)(gx)}function gx(){var e,t,n,r,s,i,a,o,l;for(nu.sort(xS);e=nu.shift();)e.__d&&(t=nu.length,r=void 0,i=(s=(n=e).__v).__e,o=[],l=[],(a=n.__P)&&((r=Yl({},s)).__v=s.__v+1,cr.vnode&&cr.vnode(r),B4(a,r,s,n.__n,a.ownerSVGElement!==void 0,32&s.__u?[i]:null,o,i??Vh(s),!!(32&s.__u),l),r.__.__k[r.__i]=r,MQ(o,r,l),r.__e!=i&&M4(r)),nu.length>t&&nu.sort(xS));gx.__r=0}function O4(e,t,n,r,s,i,a,o,l,c,d){var h,f,p,m,v,x=r&&r.__k||I4,b=t.length;for(n.__d=l,IQ(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?wS:x[p.__i]||wS,p.__i=h,B4(e,p,f,s,i,a,o,l,c,d),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&e_(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=L4(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 IQ(e,t,n){var r,s,i,a,o,l=t.length,c=n.length,d=c,h=0;for(e.__k=[],r=0;r<l;r++)(s=e.__k[r]=(s=t[r])==null||typeof s=="boolean"||typeof s=="function"?null:typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?yC(null,s,null,null,s):Jk(s)?yC(Zk,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?yC(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s)!=null?(s.__=e,s.__b=e.__b+1,o=NQ(s,n,a=r+h,d),s.__i=o,i=null,o!==-1&&(d--,(i=n[o])&&(i.__u|=131072)),i==null||i.__v===null?(o==-1&&h--,typeof s.type!="function"&&(s.__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!==r+h&&(s.__u|=65536))):(i=n[r])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=Vh(i)),yS(i,i,!1),n[r]=null,d--);if(d)for(r=0;r<c;r++)(i=n[r])!=null&&(131072&i.__u)==0&&(i.__e==e.__d&&(e.__d=Vh(i)),yS(i,i))}function L4(e,t,n){var r,s;if(typeof e.type=="function"){for(r=e.__k,s=0;r&&s<r.length;s++)r[s]&&(r[s].__=e,t=L4(r[s],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function NQ(e,t,n,r){var s=e.key,i=e.type,a=n-1,o=n+1,l=t[n];if(l===null||l&&s==l.key&&i===l.type)return n;if(r>(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&&s==l.key&&i===l.type)return a;a--}if(o<t.length){if((l=t[o])&&(131072&l.__u)==0&&s==l.key&&i===l.type)return o;o++}}return-1}function gF(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||PQ.test(t)?n:n+"px"}function N0(e,t,n,r,s){var i;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||gF(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||gF(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?r?n.u=r.u:(n.u=Date.now(),e.addEventListener(t,i?vF:mF,i)):e.removeEventListener(t,i?vF:mF,i);else{if(s)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 mF(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(cr.event?cr.event(e):e)}function vF(e){return this.l[e.type+!0](cr.event?cr.event(e):e)}function B4(e,t,n,r,s,i,a,o,l,c){var d,h,f,p,m,v,x,b,w,C,E,y,k,_,I,A=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),i=[o=t.__e=n.__e]),(d=cr.__b)&&d(t);e:if(typeof A=="function")try{if(b=t.props,w=(d=A.contextType)&&r[d.__c],C=d?w?w.props.value:d.__:r,n.__c?x=(h=t.__c=n.__c).__=h.__E:("prototype"in A&&A.prototype.render?t.__c=h=new A(b,C):(t.__c=h=new Dv(b,C),h.constructor=A,h.render=LQ),w&&w.sub(h),h.props=b,h.state||(h.state={}),h.context=C,h.__n=r,f=h.__d=!0,h.__h=[],h._sb=[]),h.__s==null&&(h.__s=h.state),A.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=Yl({},h.__s)),Yl(h.__s,A.getDerivedStateFromProps(b,h.__s))),p=h.props,m=h.state,h.__v=t,f)A.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(A.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(P){P&&(P.__=t)}),E=0;E<h._sb.length;E++)h.__h.push(h._sb[E]);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=cr.__r,k=0,"prototype"in A&&A.prototype.render){for(h.state=h.__s,h.__d=!1,y&&y(t),d=h.render(h.props,h.state,h.context),_=0;_<h._sb.length;_++)h.__h.push(h._sb[_]);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&&++k<25);h.state=h.__s,h.getChildContext!=null&&(r=Yl(Yl({},r),h.getChildContext())),f||h.getSnapshotBeforeUpdate==null||(v=h.getSnapshotBeforeUpdate(p,m)),O4(e,Jk(I=d!=null&&d.type===Zk&&d.key==null?d.props.children:d)?I:[I],t,n,r,s,i,a,o,l,c),h.base=t.__e,t.__u&=-161,h.__h.length&&a.push(h),x&&(h.__E=h.__=null)}catch(P){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),cr.__e(P,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=OQ(n.__e,t,n,r,s,i,a,l,c);(d=cr.diffed)&&d(t)}function MQ(e,t,n){t.__d=void 0;for(var r=0;r<n.length;r++)e_(n[r],n[++r],n[++r]);cr.__c&&cr.__c(t,e),e.some(function(s){try{e=s.__h,s.__h=[],e.some(function(i){i.call(s)})}catch(i){cr.__e(i,s.__v)}})}function OQ(e,t,n,r,s,i,a,o,l){var c,d,h,f,p,m,v,x=n.props,b=t.props,w=t.type;if(w==="svg"&&(s=!0),i!=null){for(c=0;c<i.length;c++)if((p=i[c])&&"setAttribute"in p==!!w&&(w?p.localName===w:p.nodeType===3)){e=p,i[c]=null;break}}if(e==null){if(w===null)return document.createTextNode(b);e=s?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&&A4.call(e.childNodes),x=n.props||wS,!o&&i!=null)for(x={},c=0;c<e.attributes.length;c++)x[(p=e.attributes[c]).name]=p.value;for(c in x)p=x[c],c=="children"||(c=="dangerouslySetInnerHTML"?h=p:c==="key"||c in b||N0(e,c,null,p,s));for(c in b)p=b[c],c=="children"?f=p:c=="dangerouslySetInnerHTML"?d=p:c=="value"?m=p:c=="checked"?v=p:c==="key"||o&&typeof p!="function"||x[c]===p||N0(e,c,p,x[c],s);if(d)o||h&&(d.__html===h.__html||d.__html===e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(h&&(e.innerHTML=""),O4(e,Jk(f)?f:[f],t,n,r,s&&w!=="foreignObject",i,a,i?i[0]:n.__k&&Vh(n,0),o,l),i!=null)for(c=i.length;c--;)i[c]!=null&&N4(i[c]);o||(c="value",m!==void 0&&(m!==e[c]||w==="progress"&&!m||w==="option"&&m!==x[c])&&N0(e,c,m,x[c],!1),c="checked",v!==void 0&&v!==e[c]&&N0(e,c,v,x[c],!1))}return e}function e_(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){cr.__e(r,n)}}function yS(e,t,n){var r,s;if(cr.unmount&&cr.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||e_(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){cr.__e(i,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(s=0;s<r.length;s++)r[s]&&yS(r[s],t,n||typeof e.type!="function");n||e.__e==null||N4(e.__e),e.__=e.__e=e.__d=void 0}function LQ(e,t,n){return this.constructor(e,n)}A4=I4.slice,cr={__e:function(e,t,n,r){for(var s,i,a;t=t.__;)if((s=t.__c)&&!s.__)try{if((i=s.constructor)&&i.getDerivedStateFromError!=null&&(s.setState(i.getDerivedStateFromError(e)),a=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(e,r||{}),a=s.__d),a)return s.__E=s}catch(o){e=o}throw e}},F4=0,Dv.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Yl({},this.state),typeof e=="function"&&(e=e(Yl({},n),this.props)),e&&Yl(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),CS(this))},Dv.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),CS(this))},Dv.prototype.render=Zk,nu=[],D4=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,xS=function(e,t){return e.__v.__b-t.__v.__b},gx.__r=0,P4=0,function(e){e.Button="button",e.Tab="tab",e.Selector="selector"}(uF||(uF={})),function(e){e.Left="left",e.Center="center",e.Right="right",e.NextToTrigger="next_to_trigger"}(bS||(bS={})),function(e){e.Popover="popover",e.API="api",e.Widget="widget"}(dF||(dF={})),function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"}(hF||(hF={})),function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"}(fF||(fF={})),function(e){e.Once="once",e.Recurring="recurring",e.Always="always"}(pF||(pF={}));var Wh=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}},as=Ds("[Surveys]"),xF={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=>Wh(t,n)),not_regex:(e,t)=>e.every(n=>!Wh(t,n)),exact:(e,t)=>e.some(n=>t===n),is_not:(e,t)=>e.every(n=>t!==n)};function bF(e){return e??"icontains"}bS.Right;(function(e,t){var n={__c:t="__cC"+P4++,__:e,Consumer:function(r,s){return r.children(s)},Provider:function(r){var s,i;return this.getChildContext||(s=[],(i={})[t]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(a){this.props.value!==a.value&&s.some(function(o){o.__e=!0,CS(o)})},this.sub=function(a){s.push(a);var o=a.componentWillUnmount;a.componentWillUnmount=function(){s.splice(s.indexOf(a),1),o&&o.call(a)}}),r.children}};n.Provider.__=n.Consumer.contextType=n})({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed:()=>{},isPopup:!0,onPreviewSubmit:()=>{}});let j4=class{constructor(){nt(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(r=>r!==n)}}emit(t,n){for(var r of this.events[t]||[])r(n);for(var s of this.events["*"]||[])s(t,n)}},BQ=class Vd{constructor(t){nt(this,"_debugEventEmitter",new j4),nt(this,"checkStep",(n,r)=>this.checkStepEvent(n,r)&&this.checkStepUrl(n,r)&&this.checkStepElement(n,r)),nt(this,"checkStepEvent",(n,r)=>r==null||!r.event||n?.event===r?.event),this.instance=t,this.actionEvents=new Set,this.actionRegistry=new Set}init(){var t;if(!ft((t=this.instance)===null||t===void 0?void 0:t._addCaptureHook)){var n;(n=this.instance)===null||n===void 0||n._addCaptureHook((r,s)=>{this.on(r,s)})}}register(t){var n,r;if(!ft((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(c=>{var d;(d=this.actionEvents)===null||d===void 0||d.add(c?.event||"")})}),(r=this.instance)!==null&&r!==void 0&&r.autocapture)){var s,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)})}),(s=this.instance)===null||s===void 0||s.autocapture.setElementSelectors(i)}}on(t,n){var r;n!=null&&t.length!=0&&(this.actionEvents.has(t)||this.actionEvents.has(n?.event))&&this.actionRegistry&&((r=this.actionRegistry)===null||r===void 0?void 0:r.size)>0&&this.actionRegistry.forEach(s=>{this.checkAction(n,s)&&this._debugEventEmitter.emit("actionCaptured",s.name)})}_addActionHook(t){this.onAction("actionCaptured",n=>t(n))}checkAction(t,n){if(n?.steps==null)return!1;for(var r of n.steps)if(this.checkStep(t,r))return!0;return!1}onAction(t,n){return this._debugEventEmitter.on(t,n)}checkStepUrl(t,n){if(n!=null&&n.url){var r,s=t==null||(r=t.properties)===null||r===void 0?void 0:r.$current_url;if(!s||typeof s!="string"||!Vd.matchString(s,n?.url,n?.url_matching||"contains"))return!1}return!0}static matchString(t,n,r){switch(r){case"regex":return!!Fe&&Wh(t,n);case"exact":return n===t;case"contains":var s=Vd.escapeStringRegexp(n).replace(/_/g,".").replace(/%/g,".*");return Wh(t,s);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&&!Vd.matchString(i.href||"",n?.href,n?.href_matching||"exact"))&&(n==null||!n.tag_name||i.tag_name===n?.tag_name)&&!(n!=null&&n.text&&!Vd.matchString(i.text||"",n?.text,n?.text_matching||"exact")&&!Vd.matchString(i.$el_text||"",n?.text,n?.text_matching||"exact"))))return!1;if(n!=null&&n.selector){var r,s=t==null||(r=t.properties)===null||r===void 0?void 0:r.$element_selectors;if(!s||!s.includes(n?.selector))return!1}return!0}getElementsList(t){return t?.properties.$elements==null?[]:t?.properties.$elements}},SS=class H4{constructor(t){this.instance=t,this.eventToSurveys=new Map,this.actionToSurveys=new Map}register(t){var n;ft((n=this.instance)===null||n===void 0?void 0:n._addCaptureHook)||(this.setupEventBasedSurveys(t),this.setupActionBasedSurveys(t))}setupActionBasedSurveys(t){var n=t.filter(r=>{var s,i,a,o;return((s=r.conditions)===null||s===void 0?void 0:s.actions)&&((i=r.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 BQ(this.instance),this.actionMatcher.init(),this.actionMatcher._addActionHook(r=>{this.onAction(r)})),n.forEach(r=>{var s,i,a,o,l,c,d,h,f,p;r.conditions&&(s=r.conditions)!==null&&s!==void 0&&s.actions&&(i=r.conditions)!==null&&i!==void 0&&(a=i.actions)!==null&&a!==void 0&&a.values&&((o=r.conditions)===null||o===void 0||(l=o.actions)===null||l===void 0||(c=l.values)===null||c===void 0?void 0:c.length)>0&&((d=this.actionMatcher)===null||d===void 0||d.register(r.conditions.actions.values),(h=r.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(r.id),this.actionToSurveys.set(m.name,v||[r.id])}}))}))}setupEventBasedSurveys(t){var n;t.filter(r=>{var s,i,a,o;return((s=r.conditions)===null||s===void 0?void 0:s.events)&&((i=r.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((r,s)=>{this.onEvent(r,s)}),t.forEach(r=>{var s,i,a;(s=r.conditions)===null||s===void 0||(i=s.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(r.id),this.eventToSurveys.set(o.name,l||[r.id])}})}))}onEvent(t,n){var r,s,i=((r=this.instance)===null||r===void 0||(s=r.persistence)===null||s===void 0?void 0:s.props[_0])||[];if(H4.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,r,s=((n=this.instance)===null||n===void 0||(r=n.persistence)===null||r===void 0?void 0:r.props[_0])||[];this.actionToSurveys.has(t)&&this._updateActivatedSurveys(s.concat(this.actionToSurveys.get(t)||[]))}_updateActivatedSurveys(t){var n,r;(n=this.instance)===null||n===void 0||(r=n.persistence)===null||r===void 0||r.register({[_0]:[...new Set(t)]})}getSurveys(){var t,n,r=(t=this.instance)===null||t===void 0||(n=t.persistence)===null||n===void 0?void 0:n.props[_0];return r||[]}getEventToSurveys(){return this.eventToSurveys}_getActionMatcher(){return this.actionMatcher}};nt(SS,"SURVEY_SHOWN_EVENT_NAME","survey shown");let jQ=class{constructor(t){nt(this,"_isFetchingSurveys",!1),nt(this,"_isInitializingSurveys",!1),nt(this,"_surveyCallbacks",[]),this.instance=t,this._surveyEventReceiver=null}onRemoteConfig(t){var n=t.surveys;if(En(n))return as.warn("Decide not loaded yet. Not loading surveys.");var r=or(n);this._hasSurveys=r?n.length>0:n,as.info("decide response received, hasSurveys: ".concat(this._hasSurveys)),this._hasSurveys&&this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");var t=(()=>{for(var n=[],r=0;r<localStorage.length;r++){var s=localStorage.key(r);s!=null&&s.startsWith("seenSurvey_")&&n.push(s)}return n})();t.forEach(n=>localStorage.removeItem(n))}loadIfEnabled(){if(!this._surveyManager)if(this._isInitializingSurveys)as.info("Already initializing surveys, skipping...");else if(this.instance.config.disable_surveys)as.info("Disabled. Not loading surveys.");else{var t=jt?.__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 SS(this.instance),as.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0});else{var r=t.loadExternalDependency;if(r)r(this.instance,"surveys",i=>{if(i||!t.generateSurveys)return as.error("Could not load surveys script",i),void(this._isInitializingSurveys=!1);this._surveyManager=t.generateSurveys(this.instance),this._isInitializingSurveys=!1,this._surveyEventReceiver=new SS(this.instance),as.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})});else{var s="PostHog loadExternalDependency extension not found. Cannot load remote config.";as.error(s),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:s})}}}catch(i){throw as.error("Error initializing surveys",i),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:"Error initializing surveys"}),i}}else as.info("No surveys to load.");else as.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 as.info("Disabled. Not loading surveys."),t([]);var r=this.instance.get_property(Jy);if(r&&!n)return t(r,{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:s=>{var i;this._isFetchingSurveys=!1;var a=s.statusCode;if(a!==200||!s.json){var o="Surveys API could not be loaded, status: ".concat(a);return as.error(o),t([],{isLoaded:!1,error:o})}var l,c=s.json.surveys||[],d=c.filter(h=>{var f,p,m,v,x,b,w,C,E,y,k,_;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||(E=C.actions)===null||E===void 0?void 0:E.values)&&((y=h.conditions)===null||y===void 0||(k=y.actions)===null||k===void 0||(_=k.values)===null||_===void 0?void 0:_.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({[Jy]:c}),t(c,{isLoaded:!0})}})}catch(s){throw this._isFetchingSurveys=!1,s}}_notifySurveyCallbacks(t){for(var n of this._surveyCallbacks)try{t.isLoaded?this.getSurveys(n):n([],t)}catch(r){as.error("Error in survey callback",r)}}isSurveyFeatureFlagEnabled(t){return!t||this.instance.featureFlags.isFeatureEnabled(t)}getActiveMatchingSurveys(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.getSurveys(r=>{var s,i=r.filter(l=>!(!l.start_date||l.end_date)).filter(l=>{var c;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=Fe==null||(v=Fe.location)===null||v===void 0?void 0:v.href;if(!b)return!1;var w=[p.conditions.url];return xF[bF((x=p.conditions)===null||x===void 0?void 0:x.urlMatchType)](w,b)}(l),h=(c=l.conditions)===null||c===void 0||!c.selector||mt?.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(!Tr)return!1;var b=Yn.deviceType(Tr);return xF[bF((x=p.conditions)===null||x===void 0?void 0:x.deviceTypesMatchType)](p.conditions.deviceTypes,b)}(l);return d&&h&&f}),a=(s=this._surveyEventReceiver)===null||s===void 0?void 0:s.getSurveys(),o=i.filter(l=>{var c,d,h,f,p,m,v,x,b;if(!(l.linked_flag_key||l.targeting_flag_key||l.internal_targeting_flag_key||(c=l.feature_flag_keys)!==null&&c!==void 0&&c.length))return!0;var w=this.isSurveyFeatureFlagEnabled(l.linked_flag_key),C=this.isSurveyFeatureFlagEnabled(l.targeting_flag_key),E=((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,k=!E&&!y||a?.includes(l.id),_=this._canActivateRepeatedly(l)||this.isSurveyFeatureFlagEnabled(l.internal_targeting_flag_key),I=this.checkFlags(l);return w&&C&&_&&k&&I});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(r=>{var{key:s,value:i}=r;return!s||!i||this.instance.featureFlags.isFeatureEnabled(i)})}_canActivateRepeatedly(t){var n;return En((n=jt.__PosthogExtensions__)===null||n===void 0?void 0:n.canActivateRepeatedly)?(as.warn("init was not called"),!1):jt.__PosthogExtensions__.canActivateRepeatedly(t)}canRenderSurvey(t){if(En(this._surveyManager))return as.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(r=>{var s=r.filter(i=>i.id===t)[0];n=s?Oe({},this._surveyManager.canRenderSurvey(s)):{visible:!1,disabledReason:"Survey not found"}}),n}renderSurvey(t,n){En(this._surveyManager)?as.warn("init was not called"):this.getSurveys(r=>{var s=r.filter(i=>i.id===t)[0];this._surveyManager.renderSurvey(s,mt?.querySelector(n))})}};var wF=Ds("[RateLimiter]");let HQ=class{constructor(t){var n,r;nt(this,"serverLimits",{}),nt(this,"lastEventRateLimited",!1),nt(this,"checkForLimiting",s=>{var i=s.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(a=>{wF.info("".concat(a||"events"," is quota limited.")),this.serverLimits[a]=new Date().getTime()+6e4})}catch(a){return void wF.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(((r=t.config.rate_limiting)===null||r===void 0?void 0:r.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(){var t,n,r,s=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(eS))!==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||s||(a.tokens=Math.max(0,a.tokens-1)),!o||this.lastEventRateLimited||s||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,(r=this.instance.persistence)===null||r===void 0||r.set_property(eS,a),{isRateLimited:o,remainingTokens:a.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}};var Kc=Ds("[RemoteConfig]");let UQ=class{constructor(t){this.instance=t}get remoteConfig(){var t,n;return(t=jt._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,r,s;(n=jt.__PosthogExtensions__)!==null&&n!==void 0&&n.loadExternalDependency?(r=jt.__PosthogExtensions__)===null||r===void 0||(s=r.loadExternalDependency)===null||s===void 0||s.call(r,this.instance,"remote-config",()=>t(this.remoteConfig)):(Kc.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 Kc.info("Using preloaded remote config",this.remoteConfig),void this.onRemoteConfig(this.remoteConfig);if(this.instance.config.advanced_disable_decide)return void Kc.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(t=>{if(!t)return Kc.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){Kc.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()):Kc.info("__preview_remote_config is disabled. Logging config instead",t):Kc.error("Failed to fetch remote config from PostHog.")}};var GQ=function(e){var t,n,r,s,i="";for(t=n=0,r=(e=(e+"").replace(/\r\n/g,`
4
4
  `).replace(/\r/g,`
5
5
  `)).length,s=0;s<r;s++){var a=e.charCodeAt(s),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),Tc(o)||(n>t&&(i+=e.substring(t,n)),i+=o,t=n=s+1)}return n>t&&(i+=e.substring(t,e.length)),i},$Q=!!qy||!!zy,CF="text/plain",mx=(e,t)=>{var[n,r]=e.split("?"),s=Oe({},t);r?.split("&").forEach(a=>{var[o]=a.split("=");delete s[o]});var i=pX(s);return i=i?(r?r+"&":"")+i:r,"".concat(n,"?").concat(i)},Mp=(e,t)=>JSON.stringify(e,(n,r)=>typeof r=="bigint"?r.toString():r,t),SC=e=>{var{data:t,compression:n}=e;if(t){if(n===Sa.GZipJS){var r=u4(d4(Mp(t)),{mtime:0}),s=new Blob([r],{type:CF});return{contentType:CF,body:s,estimatedSize:s.size}}if(n===Sa.Base64){var i=function(l){var c,d,h,f,p,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",v=0,x=0,b="",w=[];if(!l)return l;l=GQ(l);do c=(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(c)+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}(Mp(t)),a=(l=>"data="+encodeURIComponent(typeof l=="string"?l:Mp(l)))(i);return{contentType:"application/x-www-form-urlencoded",body:a,estimatedSize:new Blob([a]).size}}var o=Mp(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Jp=[];zy&&Jp.push({transport:"fetch",method:e=>{var t,n,{contentType:r,body:s,estimatedSize:i}=(t=SC(e))!==null&&t!==void 0?t:{},a=new Headers;Fn(e.headers,function(d,h){a.append(h,d)}),r&&a.append("Content-Type",r);var o=e.url,l=null;if(vA){var c=new vA;l={signal:c.signal,timeout:setTimeout(()=>c.abort(),e.timeout)}}zy(o,Oe({method:e?.method||"GET",headers:a,keepalive:e.method==="POST"&&(i||0)<52428.8,body:s,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){wt.error(m)}(f=e.callback)===null||f===void 0||f.call(e,p)})).catch(d=>{var h;wt.error(d),(h=e.callback)===null||h===void 0||h.call(e,{statusCode:0,text:d})}).finally(()=>l?clearTimeout(l.timeout):null)}}),qy&&Jp.push({transport:"XHR",method:e=>{var t,n=new qy;n.open(e.method||"GET",e.url,!0);var{contentType:r,body:s}=(t=SC(e))!==null&&t!==void 0?t:{};Fn(e.headers,function(i,a){n.setRequestHeader(a,i)}),r&&n.setRequestHeader("Content-Type",r),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(s)}}),yi!=null&&yi.sendBeacon&&Jp.push({transport:"sendBeacon",method:e=>{var t=mx(e.url,{beacon:"1"});try{var n,{contentType:r,body:s}=(n=SC(e))!==null&&n!==void 0?n:{},i=typeof s=="string"?new Blob([s],{type:r}):s;yi.sendBeacon(t,i)}catch{}}});var ES=3e3;let VQ=class{constructor(t,n){nt(this,"isPaused",!0),nt(this,"queue",[]),this.flushTimeoutMs=Ki(n?.flush_interval_ms||ES,250,5e3,"flush interval",ES),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),r=[...n.filter(s=>s.url.indexOf("/e")===0),...n.filter(s=>s.url.indexOf("/e")!==0)];r.map(s=>{this.sendRequest(Oe(Oe({},s),{},{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(),r=function(i){var a=n[i],o=new Date().getTime();a.data&&or(a.data)&&Fn(a.data,l=>{l.offset=Math.abs(l.timestamp-o),delete l.timestamp}),t.sendRequest(a)};for(var s in n)r(s)}},this.flushTimeoutMs))}clearFlushTimeout(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}formatQueue(){var t={};return Fn(this.queue,n=>{var r,s=n,i=(s?s.batchKey:null)||s.url;ft(t[i])&&(t[i]=Oe(Oe({},s),{},{data:[]})),(r=t[i].data)===null||r===void 0||r.push(s.data)}),this.queue=[],t}};var WQ=["retriesPerformedSoFar"];let zQ=class{constructor(t){nt(this,"isPolling",!1),nt(this,"pollIntervalMs",3e3),nt(this,"queue",[]),this.instance=t,this.queue=[],this.areWeOnline=!0,!ft(Fe)&&"onLine"in Fe.navigator&&(this.areWeOnline=Fe.navigator.onLine,vr(Fe,"online",()=>{this.areWeOnline=!0,this.flush()}),vr(Fe,"offline",()=>{this.areWeOnline=!1}))}retriableRequest(t){var{retriesPerformedSoFar:n}=t,r=j3(t,WQ);qs(n)&&n>0&&(r.url=mx(r.url,{retry_count:n})),this.instance._send_request(Oe(Oe({},r),{},{callback:s=>{var i;s.statusCode!==200&&(s.statusCode<400||s.statusCode>=500)&&(n??0)<10?this.enqueue(Oe({retriesPerformedSoFar:n},r)):(i=r.callback)===null||i===void 0||i.call(r,s)}}))}enqueue(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var r=function(a){var o=3e3*Math.pow(2,a),l=o/2,c=Math.min(18e5,o),d=(Math.random()-.5)*(c-l);return Math.ceil(c+d)}(n),s=Date.now()+r;this.queue.push({retryAt:s,requestOptions:t});var i="Enqueued failed request for retry in ".concat(r);navigator.onLine||(i+=" (Browser is offline)"),wt.warn(i),this.isPolling||(this.isPolling=!0,this.poll())}poll(){this.poller&&clearTimeout(this.poller),this.poller=setTimeout(()=>{this.areWeOnline&&this.queue.length>0&&this.flush(),this.poll()},this.pollIntervalMs)}flush(){var t=Date.now(),n=[],r=this.queue.filter(i=>i.retryAt<t||(n.push(i),!1));if(this.queue=n,r.length>0)for(var{requestOptions:s}of r)this.retriableRequest(s)}unload(){for(var{requestOptions:t}of(this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.queue))try{this.instance._send_request(Oe(Oe({},t),{},{transport:"sendBeacon"}))}catch(n){wt.error(n)}this.queue=[]}},qQ=class{constructor(t){nt(this,"_updateScrollData",()=>{var n,r,s,i;this.context||(this.context={});var a=this.scrollElement(),o=this.scrollY(),l=a?Math.max(0,a.scrollHeight-a.clientHeight):0,c=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,(r=this.context.maxScrollHeight)!==null&&r!==void 0?r:0),this.context.lastContentY=c,this.context.maxContentY=Math.max(c,(s=this.context.maxContentY)!==null&&s!==void 0?s: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(){vr(Fe,"scroll",this._updateScrollData,{capture:!0}),vr(Fe,"scrollend",this._updateScrollData,{capture:!0}),vr(Fe,"resize",this._updateScrollData)}scrollElement(){if(!this.instance.config.scroll_root_selector)return Fe?.document.documentElement;var t=or(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector];for(var n of t){var r=Fe?.document.querySelector(n);if(r)return r}}scrollY(){if(this.instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollTop||0}return Fe&&(Fe.scrollY||Fe.pageYOffset||Fe.document.documentElement.scrollTop)||0}scrollX(){if(this.instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollLeft||0}return Fe&&(Fe.scrollX||Fe.pageXOffset||Fe.document.documentElement.scrollLeft)||0}};var KQ=e=>Yn.personInfo({maskPersonalDataProperties:e?.config.mask_personal_data_properties,customPersonalDataProperties:e?.config.custom_personal_data_properties});let YQ=class{constructor(t,n,r,s){nt(this,"_onSessionIdCallback",i=>{var a=this._getStored();if(!a||a.sessionId!==i){var o={sessionId:i,props:this._sessionSourceParamGenerator(this.instance)};this._persistence.register({[Zy]:o})}}),this.instance=t,this._sessionIdManager=n,this._persistence=r,this._sessionSourceParamGenerator=s||KQ,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[Zy]}getSetOnceProps(){var t,n=(t=this._getStored())===null||t===void 0?void 0:t.props;return n?"r"in n?Yn.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 Fn(Gg(this.getSetOnceProps()),(n,r)=>{r==="$current_url"&&(r="url"),t["$session_entry_".concat($k(r))]=n}),t}};var yF=Ds("[SessionId]");let XQ=class{constructor(t,n,r){var s;if(nt(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||Kl,this._windowIdGenerator=r||Kl;var i=this.config.persistence_name||this.config.token,a=this.config.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Ki(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=ls.parse(this._window_id_storage_key),l=ls.parse(this._primary_window_exists_storage_key);o&&!l?this._windowId=o:ls.remove(this._window_id_storage_key),ls.set(this._primary_window_exists_storage_key,!0)}if((s=this.config.bootstrap)!==null&&s!==void 0&&s.sessionID)try{var c=(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(),c)}catch(d){yF.error("Invalid sessionID in bootstrap",d)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return ft(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&&ls.is_supported()}_setWindowId(t){t!==this._windowId&&(this._windowId=t,this._canUseSessionStorage()&&ls.set(this._window_id_storage_key,t))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?ls.parse(this._window_id_storage_key):null}_setSessionId(t,n,r){t===this._sessionId&&n===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this._sessionId=t,this.persistence.register({[ax]:[n,t,r]}))}_getSessionId(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var t=this.persistence.props[ax];return or(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}_listenToReloadWindow(){vr(Fe,"beforeunload",()=>{this._canUseSessionStorage()&&ls.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 r=n||new Date().getTime(),[s,i,a]=this._getSessionId(),o=this._getWindowId(),l=qs(a)&&a>0&&Math.abs(r-a)>864e5,c=!1,d=!i,h=!t&&Math.abs(r-s)>this.sessionTimeoutMs;d||h||l?(i=this._sessionIdGenerator(),o=this._windowIdGenerator(),yF.info("new session ID generated",{sessionId:i,windowId:o,changeReason:{noSessionId:d,activityTimeout:h,sessionPastMaximumLength:l}}),a=r,c=!0):o||(o=this._windowIdGenerator(),c=!0);var f=s===0||!t||l?r:s,p=a===0?new Date().getTime():a;return this._setWindowId(o),this._setSessionId(i,f,p),t||this.resetIdleTimer(),c&&this._sessionIdChangedHandlers.forEach(m=>m(i,o,c?{noSessionId:d,activityTimeout:h,sessionPastMaximumLength:l}:void 0)),{sessionId:i,windowId:o,sessionStartTimestamp:p,changeReason:c?{noSessionId:d,activityTimeout:h,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:s}}resetIdleTimer(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{this.resetSessionId()},1.1*this.sessionTimeoutMs)}};var QQ=["$set_once","$set"],Nl=Ds("[SiteApps]");let JQ=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 r=this.globalsForEvent(n);this.bufferedInvocations.push(r),this.bufferedInvocations.length>1e3&&(this.bufferedInvocations=this.bufferedInvocations.slice(10))}}get siteAppLoaders(){var t,n;return(t=jt._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,r,s,i,a,o,l;if(!t)throw new Error("Event payload is required");var c={},d=this.instance.get_property("$groups")||[],h=this.instance.get_property("$stored_group_properties")||{};for(var[f,p]of Object.entries(h))c[f]={id:d[f],type:f,properties:p};var{$set_once:m,$set:v}=t;return{event:Oe(Oe({},j3(t,QQ)),{},{properties:Oe(Oe(Oe({},t.properties),v?{$set:Oe(Oe({},(n=(r=t.properties)===null||r===void 0?void 0:r.$set)!==null&&n!==void 0?n:{}),v)}:{}),m?{$set_once:Oe(Oe({},(s=(i=t.properties)===null||i===void 0?void 0:i.$set_once)!==null&&s!==void 0?s:{}),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:c}}setupSiteApp(t){var n=this.apps[t.id],r=()=>{var o;!n.errored&&this.bufferedInvocations.length&&(Nl.info("Processing ".concat(this.bufferedInvocations.length," events for site app with id ").concat(t.id)),this.bufferedInvocations.forEach(l=>{var c;return(c=n.processEvent)===null||c===void 0?void 0:c.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))},s=!1,i=o=>{n.errored=!o,n.loaded=!0,Nl.info("Site app with id ".concat(t.id," ").concat(o?"loaded":"errored")),s&&r()};try{var{processEvent:a}=t.init({posthog:this.instance,callback:o=>{i(o)}});a&&(n.processEvent=a),s=!0}catch(o){Nl.error("Error while initializing PostHog app with config id ".concat(t.id),o),i(!1)}if(s&&n.loaded)try{r()}catch(o){Nl.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 r of t)this.setupSiteApp(r)}onCapturedEvent(t){if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(t);for(var r of Object.values(this.apps))try{var s;(s=r.processEvent)===null||s===void 0||s.call(r,n)}catch(i){Nl.error("Error while processing event ".concat(t.event," for site app ").concat(r.id),i)}}}onRemoteConfig(t){var n,r,s,i=this;if((n=this.siteAppLoaders)!==null&&n!==void 0&&n.length)return this.isEnabled?(this.setupSiteApps(),void this.instance.on("eventCaptured",c=>this.onCapturedEvent(c))):void Nl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this.stopBuffering)===null||r===void 0||r.call(this),(s=t.siteApps)!==null&&s!==void 0&&s.length)if(this.isEnabled){var a=function(c,d){var h,f;jt["__$$ph_site_app_".concat(c)]=i.instance,(h=jt.__PosthogExtensions__)===null||h===void 0||(f=h.loadSiteApp)===null||f===void 0||f.call(h,i.instance,d,p=>{if(p)return Nl.error("Error while initializing PostHog app with config id ".concat(c),p)})};for(var{id:o,url:l}of t.siteApps)a(o,l)}else Nl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}};var du,ZQ=["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"],SF=function(e,t){if(!e)return!1;var n=e.toLowerCase();return ZQ.concat(t||[]).some(r=>{var s=r.toLowerCase();return n.indexOf(s)!==-1})},U4=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&SF(n,t))return!0;try{var r=e?.userAgentData;if(r!=null&&r.brands&&r.brands.some(s=>SF(s?.brand,t)))return!0}catch{}return!!e.webdriver};function EF(e,t,n){return Mp({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}(function(e){e.US="us",e.EU="eu",e.CUSTOM="custom"})(du||(du={}));var kF="i.posthog.com";let eJ=class{constructor(t){nt(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(kF),".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]=du.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=du.EU:this._regionCache[this.apiHost]=du.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===du.CUSTOM)return this.apiHost+n;var r=kF+n;switch(t){case"assets":return"https://".concat(this.region,"-assets.").concat(r);case"api":return"https://".concat(this.region,".").concat(r)}}};var tJ={icontains:(e,t)=>!!Fe&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!Fe&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!Fe&&Wh(t.href,e),not_regex:(e,t)=>!!Fe&&!Wh(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};let nJ=class $s{constructor(t){var n=this;nt(this,"getWebExperimentsAndEvaluateDisplayLogic",function(){var r=arguments.length>0&&arguments[0]!==void 0&&arguments[0];n.getWebExperiments(s=>{$s.logInfo("retrieved web experiments from the server"),n._flagToExperiments=new Map,s.forEach(i=>{if(i.feature_flag_key){var a;n._flagToExperiments&&($s.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);Ar(o)&&i.variants[o]&&n.applyTransforms(i.name,o,i.variants[o].transforms)}else if(i.variants)for(var l in i.variants){var c=i.variants[l];$s.matchesTestVariant(c)&&n.applyTransforms(i.name,l,c.transforms)}})},r)}),this.instance=t,this.instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}onFeatureFlags(t){if(this._is_bot())$s.logInfo("Refusing to render web experiment since the viewer is a likely bot");else if(!this.instance.config.disable_web_experiments){if(En(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();$s.logInfo("applying feature flags",t),t.forEach(n=>{var r;if(this._flagToExperiments&&(r=this._flagToExperiments)!==null&&r!==void 0&&r.has(n)){var s,i=this.instance.getFeatureFlag(n),a=(s=this._flagToExperiments)===null||s===void 0?void 0:s.get(n);i&&a!=null&&a.variants[i]&&this.applyTransforms(a.name,i,a.variants[i].transforms)}})}}previewWebExperiment(){var t=$s.getWindowLocation();if(t!=null&&t.search){var n=ux(t?.search,"__experiment_id"),r=ux(t?.search,"__experiment_variant");n&&r&&($s.logInfo("previewing web experiments ".concat(n," && ").concat(r)),this.getWebExperiments(s=>{this.showPreviewWebExperiment(parseInt(n),r,s)},!1,!0))}}loadIfEnabled(){this.instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,r){if(this.instance.config.disable_web_experiments&&!r)return t([]);var s=this.instance.get_property("$web_experiments");if(s&&!n)return t(s);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,r){var s=r.filter(i=>i.id===t);s&&s.length>0&&($s.logInfo("Previewing web experiment [".concat(s[0].name,"] with variant [").concat(n,"]")),this.applyTransforms(s[0].name,n,s[0].variants[n].transforms))}static matchesTestVariant(t){return!En(t.conditions)&&$s.matchUrlConditions(t)&&$s.matchUTMConditions(t)}static matchUrlConditions(t){var n;if(En(t.conditions)||En((n=t.conditions)===null||n===void 0?void 0:n.url))return!0;var r,s,i,a=$s.getWindowLocation();return!!a&&((r=t.conditions)===null||r===void 0||!r.url||tJ[(s=(i=t.conditions)===null||i===void 0?void 0:i.urlMatchType)!==null&&s!==void 0?s:"icontains"](t.conditions.url,a))}static getWindowLocation(){return Fe?.location}static matchUTMConditions(t){var n;if(En(t.conditions)||En((n=t.conditions)===null||n===void 0?void 0:n.utm))return!0;var r=Yn.campaignParams();if(r.utm_source){var s,i,a,o,l,c,d,h,f,p,m,v,x,b,w,C,E=(s=t.conditions)===null||s===void 0||(i=s.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)==r.utm_campaign,y=(l=t.conditions)===null||l===void 0||(c=l.utm)===null||c===void 0||!c.utm_source||((d=t.conditions)===null||d===void 0||(h=d.utm)===null||h===void 0?void 0:h.utm_source)==r.utm_source,k=(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)==r.utm_medium,_=(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)==r.utm_term;return E&&k&&_&&y}return!1}static logInfo(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];wt.info("[WebExperiments] ".concat(t),r)}applyTransforms(t,n,r){this._is_bot()?$s.logInfo("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?r.forEach(s=>{if(s.selector){var i;$s.logInfo("applying transform of variant ".concat(n," for experiment ").concat(t," "),s);var a=(i=document)===null||i===void 0?void 0:i.querySelectorAll(s.selector);a?.forEach(o=>{var l=o;s.html&&(l.innerHTML=s.html),s.css&&l.setAttribute("style",s.css)})}}):$s.logInfo("Control variants leave the page unmodified.")}_is_bot(){return yi&&this.instance?U4(yi,this.instance.config.custom_blocked_useragents):void 0}};var Zp={},kS=()=>{},Wd="posthog",G4=!$Q&&Tr?.indexOf("MSIE")===-1&&Tr?.indexOf("Mozilla")===-1,_F=()=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:sX(mt?.location),persistence:"localStorage+cookie",persistence_name:"",loaded:kS,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:ti&&Ar(ti?.search)&&ti.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:(Fe==null||(e=Fe.location)===null||e===void 0?void 0:e.protocol)==="https:",ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var n="Bad HTTP status: "+t.statusCode+" "+t.text;wt.error(n)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:ES},_onCapture:kS}},TF=e=>{var t={};ft(e.process_person)||(t.person_profiles=e.process_person),ft(e.xhr_headers)||(t.request_headers=e.xhr_headers),ft(e.cookie_name)||(t.persistence_name=e.cookie_name),ft(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),ft(e.store_google)||(t.save_campaign_params=e.store_google),ft(e.verbose)||(t.debug=e.verbose);var n=gr({},t,e);return or(e.property_blacklist)&&(ft(e.property_denylist)?n.property_denylist=e.property_blacklist:or(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:wt.error("Invalid value for property_denylist config: "+e.property_denylist)),n};class rJ{constructor(){nt(this,"__forceAllowLocalhost",!1)}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(t){wt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Kb{get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){nt(this,"webPerformance",new rJ),nt(this,"_personProcessingSetOncePropertiesSent",!1),nt(this,"version",Wo.LIB_VERSION),nt(this,"_internalEventEmitter",new j4),this.config=_F(),this.SentryIntegration=cQ,this.sentryIntegration=t=>function(n,r){var s=f4(n,r);return{name:h4,processEvent:i=>s(i)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.featureFlags=new FQ(this),this.toolbar=new dQ(this),this.scrollManager=new qQ(this),this.pageViewManager=new vQ(this),this.surveys=new jQ(this),this.experiments=new nJ(this),this.exceptions=new xQ(this),this.rateLimiter=new HQ(this),this.requestRouter=new eJ(this),this.consent=new RX(this),this.people={set:(t,n,r)=>{var s=Ar(t)?{[t]:n}:t;this.setPersonProperties(s),r?.({})},set_once:(t,n,r)=>{var s=Ar(t)?{[t]:n}:t;this.setPersonProperties(void 0,s),r?.({})}},this.on("eventCaptured",t=>wt.info('send "'.concat(t?.event,'"'),t))}init(t,n,r){if(r&&r!==Wd){var s,i=(s=Zp[r])!==null&&s!==void 0?s:new Kb;return i._init(t,n,r),Zp[r]=i,Zp[Wd][r]=i,i}return this._init(t,n,r)}_init(t){var n,r,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if(ft(t)||Ky(t))return wt.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return wt.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this._triggered_notifs=[],s.person_profiles&&(this._initialPersonProfilesConfig=s.person_profiles),this.set_config(gr({},_F(),TF(s),{name:i,token:t})),this.config.on_xhr_error&&wt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=s.disable_compression?void 0:Sa.GZipJS,this.persistence=new CC(this.config),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new CC(Oe(Oe({},this.config),{},{persistence:"sessionStorage"}));var a=Oe({},this.persistence.props),o=Oe({},this.sessionPersistence.props);if(this._requestQueue=new VQ(b=>this._send_retriable_request(b),this.config.request_queue_config),this._retryQueue=new zQ(this),this.__request_queue=[],this.config.__preview_experimental_cookieless_mode||(this.sessionManager=new XQ(this),this.sessionPropsManager=new YQ(this,this.sessionManager,this.persistence)),new fQ(this).startIfEnabledOrStop(),this.siteApps=new JQ(this),(n=this.siteApps)===null||n===void 0||n.init(),this.config.__preview_experimental_cookieless_mode||(this.sessionRecording=new oQ(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new xX(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new mQ(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new pQ(this),this.exceptionObserver=new DX(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new n4(this,FX),this.deadClicksAutocapture.startIfEnabled(),Wo.DEBUG=Wo.DEBUG||this.config.debug,Wo.DEBUG&&wt.info("Starting in debug mode",{this:this,config:s,thisC:Oe({},this.config),p:a,s:o}),this._sync_opt_out_with_persistence(),((r=s.bootstrap)===null||r===void 0?void 0:r.distinctID)!==void 0){var l,c,d=this.config.get_device_id(Kl()),h=(l=s.bootstrap)!==null&&l!==void 0&&l.isIdentifiedID?d:s.bootstrap.distinctID;this.persistence.set_property(Go,(c=s.bootstrap)!==null&&c!==void 0&&c.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:s.bootstrap.distinctID,$device_id:h})}if(this._hasBootstrappedFeatureFlags()){var f,p,m=Object.keys(((f=s.bootstrap)===null||f===void 0?void 0:f.featureFlags)||{}).filter(b=>{var w,C;return!((w=s.bootstrap)===null||w===void 0||(C=w.featureFlags)===null||C===void 0||!C[b])}).reduce((b,w)=>{var C,E;return b[w]=((C=s.bootstrap)===null||C===void 0||(E=C.featureFlags)===null||E===void 0?void 0:E[w])||!1,b},{}),v=Object.keys(((p=s.bootstrap)===null||p===void 0?void 0:p.featureFlagPayloads)||{}).filter(b=>m[b]).reduce((b,w)=>{var C,E,y,k;return(C=s.bootstrap)!==null&&C!==void 0&&(E=C.featureFlagPayloads)!==null&&E!==void 0&&E[w]&&(b[w]=(y=s.bootstrap)===null||y===void 0||(k=y.featureFlagPayloads)===null||k===void 0?void 0:k[w]),b},{});this.featureFlags.receivedFeatureFlags({featureFlags:m,featureFlagPayloads:v})}if(this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:PA,$device_id:null},"");else if(!this.get_distinct_id()){var x=this.config.get_device_id(Kl());this.register_once({distinct_id:x,$device_id:x},""),this.persistence.set_property(Go,"anonymous")}return vr(Fe,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),s.segment?lQ(this,()=>this._loaded()):this._loaded(),Ta(this.config._onCapture)&&this.config._onCapture!==kS&&(wt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",b=>this.config._onCapture(b.event,b))),this}_onRemoteConfig(t){var n,r,s,i,a,o,l,c;if(!mt||!mt.body)return wt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this._onRemoteConfig(t)},500);this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=Yt(t.supportedCompression,Sa.GZipJS)?Sa.GZipJS:Yt(t.supportedCompression,Sa.Base64)?Sa.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"}),(r=this.siteApps)===null||r===void 0||r.onRemoteConfig(t),(s=this.sessionRecording)===null||s===void 0||s.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),(c=this.deadClicksAutocapture)===null||c===void 0||c.onRemoteConfig(t)}_loaded(){try{this.config.loaded(this)}catch(t){wt.critical("`loaded` function failed",t)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout(()=>{this.consent.isOptedIn()&&this._captureInitialPageview()},1),new UQ(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()||rc(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&&(G4?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=mx(t.url,{ip:this.config.ip?1:0}),t.headers=Oe({},this.config.request_headers),t.compression=t.compression==="best-available"?this.compression:t.compression,t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var r,s,i,a=Oe({},n);a.timeout=a.timeout||6e4,a.url=mx(a.url,{_:new Date().getTime().toString(),ver:Wo.LIB_VERSION,compression:a.compression});var o=(r=a.transport)!==null&&r!==void 0?r:"fetch",l=(s=(i=H3(Jp,c=>c.transport===o))===null||i===void 0?void 0:i.method)!==null&&s!==void 0?s:Jp[0].method;if(!l)throw new Error("No available transport method");l(a)})(Oe(Oe({},t),{},{callback:n=>{var r,s,i;this.rateLimiter.checkForLimiting(n),n.statusCode>=400&&((s=(i=this.config).on_request_error)===null||s===void 0||s.call(i,n)),(r=t.callback)===null||r===void 0||r.call(t,n)}}))))}_send_retriable_request(t){this._retryQueue?this._retryQueue.retriableRequest(t):this._send_request(t)}_execute_array(t){var n,r=[],s=[],i=[];rc(t,o=>{o&&(n=o[0],or(n)?i.push(o):Ta(o)?o.call(this):or(o)&&n==="alias"?r.push(o):or(o)&&n.indexOf("capture")!==-1&&Ta(this[n])?i.push(o):s.push(o))});var a=function(o,l){rc(o,function(c){if(or(c[0])){var d=l;Fn(c,function(h){d=d[h[0]].apply(d,h.slice(1))})}else this[c[0]].apply(this,c.slice(1))},l)};a(r,this),a(s,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,r){var s;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(!this.consent.isOptedOut())if(!ft(t)&&Ar(t)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var i=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(i==null||!i.isRateLimited){n!=null&&n.$current_url&&!Ar(n?.$current_url)&&(wt.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var a=new Date,o=r?.timestamp||a,l=Kl(),c={uuid:l,event:t,properties:this._calculate_event_properties(t,n||{},o,l)};i&&(c.properties.$lib_rate_limit_remaining_tokens=i.remainingTokens),r?.$set&&(c.$set=r?.$set);var d=this._calculate_set_once_properties(r?.$set_once);d&&(c.$set_once=d),(c=nX(c,r!=null&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=o,ft(r?.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=a);var h=Oe(Oe({},c.properties.$set),c.$set);if(eh(h)||this.setPersonPropertiesForFlags(h),!En(this.config.before_send)){var f=this._runBeforeSend(c);if(!f)return;c=f}this._internalEventEmitter.emit("eventCaptured",c);var p={method:"POST",url:(s=r?._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",batchKey:r?._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this._send_retriable_request(p):this._requestQueue.enqueue(p),c}wt.critical("This capture call is ignored due to client rate limiting.")}}else wt.error("No event name provided to posthog.capture")}else wt.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",n=>t(n.event,n))}_calculate_event_properties(t,n,r,s){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var i=this.persistence.remove_event_timer(t),a=Oe({},n);if(a.token=this.config.token,this.config.__preview_experimental_cookieless_mode&&(a.$cookieless_mode=!0),t==="$snapshot"){var o=Oe(Oe({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=o.distinct_id,(!Ar(a.distinct_id)&&!qs(a.distinct_id)||Ky(a.distinct_id))&&wt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var l,c=Yn.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&&gr(a,this.sessionPropsManager.getSessionProps());try{var f,p;this.sessionRecording&&gr(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===du.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),l=t==="$pageview"?this.pageViewManager.doPageView(r,s):t==="$pageleave"?this.pageViewManager.doPageLeave(r):this.pageViewManager.doEvent(),a=gr(a,l),t==="$pageview"&&mt&&(a.title=mt.title),!ft(i)){var m=r.getTime()-i;a.$duration=parseFloat((m/1e3).toFixed(3))}Tr&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=gr({},c,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),or(this.config.property_denylist)?Fn(this.config.property_denylist,function(b){delete a[b]}):wt.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&&(wt.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 r=this.persistence.get_initial_props(),s=(n=this.sessionPropsManager)===null||n===void 0?void 0:n.getSetOnceProps(),i=gr({},r,s||{},t||{}),a=this.config.sanitize_properties;return a&&(wt.error("sanitize_properties is deprecated. Use before_send instead"),i=a(i,"$set_once")),this._personProcessingSetOncePropertiesSent=!0,eh(i)?void 0:i}register(t,n){var r;(r=this.persistence)===null||r===void 0||r.register(t,n)}register_once(t,n,r){var s;(s=this.persistence)===null||s===void 0||s.register_once(t,n,r)}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],r=arguments.length>2?arguments[2]:void 0;return this.featureFlags.getEarlyAccessFeatures(t,n,r)}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,r;return(n=(r=this.sessionManager)===null||r===void 0?void 0:r.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,r){if(!this.__loaded||!this.persistence)return wt.uninitializedWarning("posthog.identify");if(qs(t)&&(t=t.toString(),wt.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),t){if(["distinct_id","distinctid"].includes(t.toLowerCase()))wt.critical('The string "'.concat(t,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else if(this._requirePersonProcessing("posthog.identify")){var s=this.get_distinct_id();if(this.register({$user_id:t}),!this.get_property("$device_id")){var i=s;this.register_once({$had_persisted_distinct_id:!0,$device_id:i},"")}t!==s&&t!==this.get_property(Ap)&&(this.unregister(Ap),this.register({distinct_id:t}));var a=(this.persistence.get_property(Go)||"anonymous")==="anonymous";t!==s&&a?(this.persistence.set_property(Go,"identified"),this.setPersonPropertiesForFlags(Oe(Oe({},r||{}),n||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:s},{$set:n||{},$set_once:r||{}}),this._cachedPersonProperties=EF(t,n,r),this.featureFlags.setAnonymousDistinctId(s)):(n||r)&&this.setPersonProperties(n,r),t!==s&&(this.reloadFeatureFlags(),this.unregister(ox))}}else wt.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,n){if((t||n)&&this._requirePersonProcessing("posthog.setPersonProperties")){var r=EF(this.get_distinct_id(),t,n);this._cachedPersonProperties!==r?(this.setPersonPropertiesForFlags(Oe(Oe({},n||{}),t||{})),this.capture("$set",{$set:t||{},$set_once:n||{}}),this._cachedPersonProperties=r):wt.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,n,r){if(t&&n){if(this._requirePersonProcessing("posthog.group")){var s=this.getGroups();s[t]!==n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:Oe(Oe({},s),{},{[t]:n})}),r&&(this.capture("$groupidentify",{$group_type:t,$group_key:n,$group_set:r}),this.setGroupPropertiesForFlags({[t]:r})),s[t]===n||r||this.reloadFeatureFlags()}}else wt.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this.featureFlags.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(t,n)}resetGroupPropertiesForFlags(t){this.featureFlags.resetGroupPropertiesForFlags(t)}reset(t){var n,r,s,i;if(wt.info("reset"),!this.__loaded)return wt.uninitializedWarning("posthog.reset");var a=this.get_property("$device_id");if(this.consent.reset(),(n=this.persistence)===null||n===void 0||n.clear(),(r=this.sessionPersistence)===null||r===void 0||r.clear(),this.surveys.reset(),(s=this.persistence)===null||s===void 0||s.set_property(Go,"anonymous"),(i=this.sessionManager)===null||i===void 0||i.resetSessionId(),this._cachedPersonProperties=null,this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:PA,$device_id:null},"");else{var o=this.config.get_device_id(Kl());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:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(n));if(t!=null&&t.withTimestamp&&r){var i,a=(i=t.timestampLookBack)!==null&&i!==void 0?i:10;if(!r)return s;var o=Math.max(Math.floor((new Date().getTime()-r)/1e3)-a,0);s+="?t=".concat(o)}return s}alias(t,n){return t===this.get_property(U3)?(wt.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(ft(n)&&(n=this.get_distinct_id()),t!==n?(this._register_single(Ap,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(wt.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n,r,s,i,a=Oe({},this.config);lr(t)&&(gr(this.config,TF(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 CC(Oe(Oe({},this.config),{},{persistence:"sessionStorage"})),Fr.is_supported()&&Fr.get("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(Wo.DEBUG=!0,wt.info("set_config",JSON.stringify({config:t,oldConfig:a,newConfig:Oe({},this.config)},null,2))),(r=this.sessionRecording)===null||r===void 0||r.startIfEnabledOrStop(),(s=this.autocapture)===null||s===void 0||s.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,r={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(r).some(Boolean)){var s,i,a,o,l;(s=this.sessionManager)===null||s===void 0||s.checkAndGetSessionAndWindowId(),r.sampling&&((i=this.sessionRecording)===null||i===void 0||i.overrideSampling()),r.linked_flag&&((a=this.sessionRecording)===null||a===void 0||a.overrideLinkedFlag()),r.url_trigger&&((o=this.sessionRecording)===null||o===void 0||o.overrideTrigger("url")),r.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 r=new Error("PostHog syntheticException");this.exceptions.sendExceptionEvent(Oe(Oe({},$X((s=>s instanceof Error)(t)?{error:t,event:t.message}:{event:t},{syntheticException:r})),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:Wd;return n!==Wd&&(n=Wd+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)===null||t===void 0?void 0:t.get_property(Go))==="identified"||((n=this.sessionPersistence)===null||n===void 0?void 0:n.get_property(Go))==="identified"}_hasPersonProcessing(){var t,n,r,s;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&eh(this.getGroups())&&((t=this.persistence)===null||t===void 0||(n=t.props)===null||n===void 0||!n[Ap])&&((r=this.persistence)===null||r===void 0||(s=r.props)===null||s===void 0||!s[lx]))}_shouldCapturePageleave(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}_requirePersonProcessing(t){return this.config.person_profiles==="never"?(wt.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(lx,!0),!0)}_sync_opt_out_with_persistence(){var t,n,r,s,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&&((r=this.persistence)===null||r===void 0||r.set_disabled(o)),((n=this.sessionPersistence)===null||n===void 0?void 0:n.disabled)!==o&&((s=this.sessionPersistence)===null||s===void 0||s.set_disabled(o))}opt_in_capturing(t){var n;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),(ft(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 yi?U4(yi,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){mt&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:mt.title},{send_instantly:!0}))}debug(t){t===!1?(Fe?.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(Fe?.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(En(this.config.before_send))return t;var n=or(this.config.before_send)?this.config.before_send:[this.config.before_send],r=t;for(var s of n){if(r=s(r),En(r)){var i="Event '".concat(t.event,"' was rejected in beforeSend function");return ZY(t.event)?wt.warn("".concat(i,". This can cause unexpected behavior.")):wt.info(i),null}r.properties&&!eh(r.properties)||wt.warn("Event '".concat(t.event,"' has no properties after beforeSend function, this is likely an error."))}return r}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,r){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(r)})}}(function(e,t){for(var n=0;n<t.length;n++)e.prototype[t[n]]=tX(e.prototype[t[n]])})(Kb,["identify"]);var RF,ru=(RF=Zp[Wd]=new Kb,function(){function e(){e.done||(e.done=!0,G4=!1,Fn(Zp,function(t){t._dom_loaded()}))}mt!=null&&mt.addEventListener?mt.readyState==="complete"?e():vr(mt,"DOMContentLoaded",e,{capture:!1}):Fe&&wt.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),RF),t_=g.createContext({client:ru});function $4(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 r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return!1;for(var i=0,a=r;i<a.length;i++){var o=a[i];if(!s.includes(o)||!$4(e[o],t[o],n))return!1}return!0}function sJ(e){var t=e.children,n=e.client,r=e.apiKey,s=e.options,i=g.useRef(null),a=g.useMemo(function(){return n?(r&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),s&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),n):(r||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."),ru)},[n,r,JSON.stringify(s)]);return g.useEffect(function(){if(!n){var o=i.current;o?(r!==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."),s&&!$4(s,o.options)&&ru.set_config(s),i.current={apiKey:r,options:s??{}}):(ru.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),ru.init(r,s),i.current={apiKey:r,options:s??{}})}},[n,r,JSON.stringify(s)]),He.createElement(t_.Provider,{value:{client:a}},t)}var iJ=function(){var e=g.useContext(t_).client;return e};function EC(e){var t=iJ(),n=g.useState(function(){return t.isFeatureEnabled(e)}),r=n[0],s=n[1];return g.useEffect(function(){return t.onFeatureFlags(function(){s(t.isFeatureEnabled(e))})},[t,e]),r}var _S=function(e,t){return _S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(n[s]=r[s])},_S(e,t)};function aJ(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");_S(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var kC=function(e){return typeof e=="function"},oJ={componentStack:null,error:null},lJ={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."};(function(e){aJ(t,e);function t(n){var r=e.call(this,n)||this;return r.state=oJ,r}return t.prototype.componentDidCatch=function(n,r){var s=r.componentStack,i=this.props.additionalProperties;this.setState({error:n,componentStack:s});var a;kC(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,r=n.children,s=n.fallback,i=this.state;if(i.componentStack==null)return kC(r)?r():r;var a=kC(s)?He.createElement(s,{error:i.error,componentStack:i.componentStack}):s;return He.isValidElement(a)?a:(console.warn(lJ.INVALID_FALLBACK),He.createElement(He.Fragment,null))},t.contextType=t_,t})(He.Component);/**
@@ -673,7 +673,7 @@ ${F7(r)}`)}function NHe(e){const t=new Map;for(const n of e){const r=F2(n.path);
673
673
  * LICENSE file in the root directory of this source tree.
674
674
  */var LO;function J7e(){if(LO)return _p;LO=1;var e=He,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,s=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,c){var d,h={},f=null,p=null;c!==void 0&&(f=""+c),l.key!==void 0&&(f=""+l.key),l.ref!==void 0&&(p=l.ref);for(d in l)r.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:s.current}}return _p.Fragment=n,_p.jsx=a,_p.jsxs=a,_p}var BO;function Z7e(){return BO||(BO=1,OO.exports=J7e()),OO.exports}var e9e=Z7e();/*! shepherd.js 14.5.0 */function t9e(e){return e instanceof Element}function uf(e){return e instanceof HTMLElement}function Cc(e){return typeof e=="function"}function Fm(e){return typeof e=="string"}function _s(e){return e===void 0}class yR{on(t,n,r,s=!1){var i;return _s(this.bindings)&&(this.bindings={}),_s(this.bindings[t])&&(this.bindings[t]=[]),(i=this.bindings[t])==null||i.push({handler:n,ctx:r,once:s}),this}once(t,n,r){return this.on(t,n,r,!0)}off(t,n){if(_s(this.bindings)||_s(this.bindings[t]))return this;if(_s(n))delete this.bindings[t];else{var r;(r=this.bindings[t])==null||r.forEach((s,i)=>{if(s.handler===n){var a;(a=this.bindings[t])==null||a.splice(i,1)}})}return this}trigger(t,...n){if(!_s(this.bindings)&&this.bindings[t]){var r;(r=this.bindings[t])==null||r.forEach((s,i)=>{const{ctx:a,handler:o,once:l}=s,c=a||this;if(o.apply(c,n),l){var d;(d=this.bindings[t])==null||d.splice(i,1)}})}return this}}function li(){return li=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},li.apply(null,arguments)}function SR(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}const Nc={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")};Nc.defaultMerge;function n9e(e,t){return t}function r9e(e,t){return e.filter(n=>n!==void 0)}var jO;(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"})(jO||(jO={}));function HO(e){return typeof e!="object"||e===null?0:Array.isArray(e)?2:a9e(e)?1:e instanceof Set?3:e instanceof Map?4:5}function s9e(e){const t=new Set;for(const n of e)for(const r of[...Object.keys(n),...Object.getOwnPropertySymbols(n)])t.add(r);return t}function i9e(e,t){return typeof e=="object"&&Object.prototype.propertyIsEnumerable.call(e,t)}function J7(e){return{*[Symbol.iterator](){for(const t of e)for(const n of t)yield n}}}const UO=new Set(["[object Object]","[object Module]"]);function a9e(e){if(!UO.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"||!UO.has(Object.prototype.toString.call(n))||!n.hasOwnProperty("isPrototypeOf"))}function o9e(e,t,n){const r={};for(const s of s9e(e)){const i=[];for(const l of e)i9e(l,s)&&i.push(l[s]);if(i.length===0)continue;const a=t.metaDataUpdater(n,{key:s,parents:e}),o=Z7(i,t,a);o!==Nc.skip&&(s==="__proto__"?Object.defineProperty(r,s,{value:o,configurable:!0,enumerable:!0,writable:!0}):r[s]=o)}return r}function l9e(e){return e.flat()}function c9e(e){return new Set(J7(e))}function u9e(e){return new Map(J7(e))}function d9e(e){return e.at(-1)}const Cv={mergeRecords:o9e,mergeArrays:l9e,mergeSets:c9e,mergeMaps:u9e,mergeOthers:d9e};function ER(...e){return h9e({})(...e)}function h9e(e,t){const n=f9e(e,r);function r(...s){return Z7(s,n,t)}return r}function f9e(e,t){var n,r,s;return{defaultMergeFunctions:Cv,mergeFunctions:li({},Cv,Object.fromEntries(Object.entries(e).filter(([i,a])=>Object.hasOwn(Cv,i)).map(([i,a])=>a===!1?[i,Cv.mergeOthers]:[i,a]))),metaDataUpdater:(n=e.metaDataUpdater)!=null?n:n9e,deepmerge:t,useImplicitDefaultMerging:(r=e.enableImplicitDefaultMerging)!=null?r:!1,filterValues:e.filterValues===!1?void 0:(s=e.filterValues)!=null?s:r9e,actions:Nc}}function Z7(e,t,n){var r;const s=(r=t.filterValues==null?void 0:t.filterValues(e,n))!=null?r:e;if(s.length===0)return;if(s.length===1)return ky(s,t,n);const i=HO(s[0]);if(i!==0&&i!==5){for(let a=1;a<s.length;a++)if(HO(s[a])!==i)return ky(s,t,n)}switch(i){case 1:return p9e(s,t,n);case 2:return g9e(s,t,n);case 3:return m9e(s,t,n);case 4:return v9e(s,t,n);default:return ky(s,t,n)}}function p9e(e,t,n){const r=t.mergeFunctions.mergeRecords(e,t,n);return r===Nc.defaultMerge||t.useImplicitDefaultMerging&&r===void 0&&t.mergeFunctions.mergeRecords!==t.defaultMergeFunctions.mergeRecords?t.defaultMergeFunctions.mergeRecords(e,t,n):r}function g9e(e,t,n){const r=t.mergeFunctions.mergeArrays(e,t,n);return r===Nc.defaultMerge||t.useImplicitDefaultMerging&&r===void 0&&t.mergeFunctions.mergeArrays!==t.defaultMergeFunctions.mergeArrays?t.defaultMergeFunctions.mergeArrays(e):r}function m9e(e,t,n){const r=t.mergeFunctions.mergeSets(e,t,n);return r===Nc.defaultMerge||t.useImplicitDefaultMerging&&r===void 0&&t.mergeFunctions.mergeSets!==t.defaultMergeFunctions.mergeSets?t.defaultMergeFunctions.mergeSets(e):r}function v9e(e,t,n){const r=t.mergeFunctions.mergeMaps(e,t,n);return r===Nc.defaultMerge||t.useImplicitDefaultMerging&&r===void 0&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps?t.defaultMergeFunctions.mergeMaps(e):r}function ky(e,t,n){const r=t.mergeFunctions.mergeOthers(e,t,n);return r===Nc.defaultMerge||t.useImplicitDefaultMerging&&r===void 0&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(e):r}function kR(e){const t=Object.getOwnPropertyNames(e.constructor.prototype);for(let n=0;n<t.length;n++){const r=t[n],s=e[r];r!=="constructor"&&typeof s=="function"&&(e[r]=s.bind(e))}return e}function x9e(e,t){return n=>{if(e.isOpen()){const r=e.el&&n.currentTarget===e.el;(!_s(t)&&n.currentTarget.matches(t)||r)&&e.tour.next()}}}function b9e(e){const{event:t,selector:n}=e.options.advanceOn||{};if(t){const r=x9e(e,n);let s=null;if(!_s(n)&&(s=document.querySelector(n),!s))return console.error(`No element was found for the selector supplied to advanceOn: ${n}`);s?(s.addEventListener(t,r),e.on("destroy",()=>s.removeEventListener(t,r))):(document.body.addEventListener(t,r,!0),e.on("destroy",()=>document.body.removeEventListener(t,r,!0)))}else return console.error("advanceOn was defined, but no event name was passed.")}class w9e{constructor(t){}}class C9e{constructor(t,n){}}function e9(e){return!Fm(e)||e===""?"":e.charAt(e.length-1)!=="-"?`${e}-`:e}function y9e(e){const t=e.options.attachTo||{},n=Object.assign({},t);if(Cc(n.element)&&(n.element=n.element.call(e)),Fm(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 S9e(e){return e.options.extraHighlights?e.options.extraHighlights.flatMap(t=>Array.from(document.querySelectorAll(t))):[]}function t9(e){return e==null?!0:!e.element||!e.on}function n9(){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 E9e=["top","right","bottom","left"],GO=["start","end"],$O=E9e.reduce((e,t)=>e.concat(t,t+"-"+GO[0],t+"-"+GO[1]),[]),df=Math.min,Mu=Math.max,_b=Math.round,yv=Math.floor,vo=e=>({x:e,y:e}),k9e={left:"right",right:"left",bottom:"top",top:"bottom"},_9e={start:"end",end:"start"};function ok(e,t,n){return Mu(e,df(t,n))}function rd(e,t){return typeof e=="function"?e(t):e}function fl(e){return e.split("-")[0]}function il(e){return e.split("-")[1]}function _R(e){return e==="x"?"y":"x"}function TR(e){return e==="y"?"height":"width"}function hf(e){return["top","bottom"].includes(fl(e))?"y":"x"}function RR(e){return _R(hf(e))}function r9(e,t,n){n===void 0&&(n=!1);const r=il(e),s=RR(e),i=TR(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Rb(a)),[a,Rb(a)]}function T9e(e){const t=Rb(e);return[Tb(e),t,Tb(t)]}function Tb(e){return e.replace(/start|end/g,t=>_9e[t])}function R9e(e,t,n){const r=["left","right"],s=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?s:r:t?r:s;case"left":case"right":return t?i:a;default:return[]}}function A9e(e,t,n,r){const s=il(e);let i=R9e(fl(e),n==="start",r);return s&&(i=i.map(a=>a+"-"+s),t&&(i=i.concat(i.map(Tb)))),i}function Rb(e){return e.replace(/left|right|bottom|top/g,t=>k9e[t])}function F9e(e){return li({top:0,right:0,bottom:0,left:0},e)}function s9(e){return typeof e!="number"?F9e(e):{top:e,right:e,bottom:e,left:e}}function Ab(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}const D9e=["crossAxis","alignment","allowedPlacements","autoAlignment"],P9e=["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"],I9e=["mainAxis","crossAxis","limiter"];function VO(e,t,n){let{reference:r,floating:s}=e;const i=hf(t),a=RR(t),o=TR(a),l=fl(t),c=i==="y",d=r.x+r.width/2-s.width/2,h=r.y+r.height/2-s.height/2,f=r[o]/2-s[o]/2;let p;switch(l){case"top":p={x:d,y:r.y-s.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:h};break;case"left":p={x:r.x-s.width,y:h};break;default:p={x:r.x,y:r.y}}switch(il(t)){case"start":p[a]-=f*(n&&c?-1:1);break;case"end":p[a]+=f*(n&&c?-1:1);break}return p}const N9e=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:a}=n,o=i.filter(Boolean),l=await(a.isRTL==null?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:d,y:h}=VO(c,r,l),f=r,p={},m=0;for(let v=0;v<o.length;v++){const{name:x,fn:b}=o[v],{x:w,y:C,data:E,reset:y}=await b({x:d,y:h,initialPlacement:r,placement:f,strategy:s,middlewareData:p,rects:c,platform:a,elements:{reference:e,floating:t}});d=w??d,h=C??h,p=li({},p,{[x]:li({},p[x],E)}),y&&m<=50&&(m++,typeof y=="object"&&(y.placement&&(f=y.placement),y.rects&&(c=y.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):y.rects),{x:d,y:h}=VO(c,f,l)),v=-1)}return{x:d,y:h,placement:f,strategy:s,middlewareData:p}};async function AR(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:a,elements:o,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:f=!1,padding:p=0}=rd(t,e),m=s9(p),v=o[f?h==="floating"?"reference":"floating":h],x=Ab(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:c,rootBoundary:d,strategy:l})),b=h==="floating"?{x:r,y:s,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},E=Ab(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:b,offsetParent:w,strategy:l}):b);return{top:(x.top-E.top+m.top)/C.y,bottom:(E.bottom-x.bottom+m.bottom)/C.y,left:(x.left-E.left+m.left)/C.x,right:(E.right-x.right+m.right)/C.x}}const M9e=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:a,elements:o,middlewareData:l}=t,{element:c,padding:d=0}=rd(e,t)||{};if(c==null)return{};const h=s9(d),f={x:n,y:r},p=RR(s),m=TR(p),v=await a.getDimensions(c),x=p==="y",b=x?"top":"left",w=x?"bottom":"right",C=x?"clientHeight":"clientWidth",E=i.reference[m]+i.reference[p]-f[p]-i.floating[m],y=f[p]-i.reference[p],k=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c));let _=k?k[C]:0;(!_||!await(a.isElement==null?void 0:a.isElement(k)))&&(_=o.floating[C]||i.floating[m]);const I=E/2-y/2,A=_/2-v[m]/2-1,P=df(h[b],A),N=df(h[w],A),F=P,j=_-v[m]-N,q=_/2-v[m]/2+I,L=ok(F,q,j),ie=!l.arrow&&il(s)!=null&&q!==L&&i.reference[m]/2-(q<F?P:N)-v[m]/2<0,Z=ie?q<F?q-F:q-j:0;return{[p]:f[p]+Z,data:li({[p]:L,centerOffset:q-L-Z},ie&&{alignmentOffset:Z}),reset:ie}}});function O9e(e,t,n){return(e?[...n.filter(r=>il(r)===e),...n.filter(r=>il(r)!==e)]:n.filter(r=>fl(r)===r)).filter(r=>e?il(r)===e||(t?Tb(r)!==r:!1):!0)}const L9e=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,s;const{rects:i,middlewareData:a,placement:o,platform:l,elements:c}=t,d=rd(e,t),{crossAxis:h=!1,alignment:f,allowedPlacements:p=$O,autoAlignment:m=!0}=d,v=SR(d,D9e),x=f!==void 0||p===$O?O9e(f||null,m,p):p,b=await AR(t,v),w=((n=a.autoPlacement)==null?void 0:n.index)||0,C=x[w];if(C==null)return{};const E=r9(C,i,await(l.isRTL==null?void 0:l.isRTL(c.floating)));if(o!==C)return{reset:{placement:x[0]}};const y=[b[fl(C)],b[E[0]],b[E[1]]],k=[...((r=a.autoPlacement)==null?void 0:r.overflows)||[],{placement:C,overflows:y}],_=x[w+1];if(_)return{data:{index:w+1,overflows:k},reset:{placement:_}};const I=k.map(P=>{const N=il(P.placement);return[P.placement,N&&h?P.overflows.slice(0,2).reduce((F,j)=>F+j,0):P.overflows[0],P.overflows]}).sort((P,N)=>P[1]-N[1]),A=((s=I.filter(P=>P[2].slice(0,il(P[0])?2:3).every(N=>N<=0))[0])==null?void 0:s[0])||I[0][0];return A!==o?{data:{index:w+1,overflows:k},reset:{placement:A}}:{}}}},B9e=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:i,rects:a,initialPlacement:o,platform:l,elements:c}=t,d=rd(e,t),{mainAxis:h=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:x=!0}=d,b=SR(d,P9e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=fl(s),C=hf(o),E=fl(o)===o,y=await(l.isRTL==null?void 0:l.isRTL(c.floating)),k=p||(E||!x?[Rb(o)]:T9e(o)),_=v!=="none";!p&&_&&k.push(...A9e(o,x,v,y));const I=[o,...k],A=await AR(t,b),P=[];let N=((r=i.flip)==null?void 0:r.overflows)||[];if(h&&P.push(A[w]),f){const L=r9(s,a,y);P.push(A[L[0]],A[L[1]])}if(N=[...N,{placement:s,overflows:P}],!P.every(L=>L<=0)){var F,j;const L=(((F=i.flip)==null?void 0:F.index)||0)+1,ie=I[L];if(ie)return{data:{index:L,overflows:N},reset:{placement:ie}};let Z=(j=N.filter(J=>J.overflows[0]<=0).sort((J,U)=>J.overflows[1]-U.overflows[1])[0])==null?void 0:j.placement;if(!Z)switch(m){case"bestFit":{var q;const J=(q=N.filter(U=>{if(_){const ne=hf(U.placement);return ne===C||ne==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(ne=>ne>0).reduce((ne,re)=>ne+re,0)]).sort((U,ne)=>U[1]-ne[1])[0])==null?void 0:q[0];J&&(Z=J);break}case"initialPlacement":Z=o;break}if(s!==Z)return{reset:{placement:Z}}}return{}}}},j9e=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s}=t,i=rd(e,t),{mainAxis:a=!0,crossAxis:o=!1,limiter:l={fn:b=>{let{x:w,y:C}=b;return{x:w,y:C}}}}=i,c=SR(i,I9e),d={x:n,y:r},h=await AR(t,c),f=hf(fl(s)),p=_R(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],E=m-h[w];m=ok(C,m,E)}if(o){const b=f==="y"?"top":"left",w=f==="y"?"bottom":"right",C=v+h[b],E=v-h[w];v=ok(C,v,E)}const x=l.fn(li({},t,{[p]:m,[f]:v}));return li({},x,{data:{x:x.x-n,y:x.y-r}})}}},H9e=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:i,middlewareData:a}=t,{offset:o=0,mainAxis:l=!0,crossAxis:c=!0}=rd(e,t),d={x:n,y:r},h=hf(s),f=_R(h);let p=d[f],m=d[h];const v=rd(o,t),x=typeof v=="number"?{mainAxis:v,crossAxis:0}:li({mainAxis:0,crossAxis:0},v);if(l){const C=f==="y"?"height":"width",E=i.reference[f]-i.floating[C]+x.mainAxis,y=i.reference[f]+i.reference[C]-x.mainAxis;p<E?p=E:p>y&&(p=y)}if(c){var b,w;const C=f==="y"?"width":"height",E=["top","left"].includes(fl(s)),y=i.reference[h]-i.floating[C]+(E&&((b=a.offset)==null?void 0:b[h])||0)+(E?0:x.crossAxis),k=i.reference[h]+i.reference[C]+(E?0:((w=a.offset)==null?void 0:w[h])||0)-(E?x.crossAxis:0);m<y?m=y:m>k&&(m=k)}return{[f]:p,[h]:m}}}};function Iw(){return typeof window<"u"}function Mf(e){return i9(e)?(e.nodeName||"").toLowerCase():"#document"}function _i(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function To(e){var t;return(t=(i9(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function i9(e){return Iw()?e instanceof Node||e instanceof _i(e).Node:!1}function Pa(e){return Iw()?e instanceof Element||e instanceof _i(e).Element:!1}function Co(e){return Iw()?e instanceof HTMLElement||e instanceof _i(e).HTMLElement:!1}function WO(e){return!Iw()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof _i(e).ShadowRoot}function d0(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=Ia(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(s)}function U9e(e){return["table","td","th"].includes(Mf(e))}function Nw(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function FR(e){const t=DR(),n=Pa(e)?Ia(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(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function G9e(e){let t=yc(e);for(;Co(t)&&!ff(t);){if(FR(t))return t;if(Nw(t))return null;t=yc(t)}return null}function DR(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ff(e){return["html","body","#document"].includes(Mf(e))}function Ia(e){return _i(e).getComputedStyle(e)}function Mw(e){return Pa(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function yc(e){if(Mf(e)==="html")return e;const t=e.assignedSlot||e.parentNode||WO(e)&&e.host||To(e);return WO(t)?t.host:t}function a9(e){const t=yc(e);return ff(t)?e.ownerDocument?e.ownerDocument.body:e.body:Co(t)&&d0(t)?t:a9(t)}function Dm(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=a9(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),a=_i(s);if(i){const o=lk(a);return t.concat(a,a.visualViewport||[],d0(s)?s:[],o&&n?Dm(o):[])}return t.concat(s,Dm(s,[],n))}function lk(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function o9(e){const t=Ia(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Co(e),i=s?e.offsetWidth:n,a=s?e.offsetHeight:r,o=_b(n)!==i||_b(r)!==a;return o&&(n=i,r=a),{width:n,height:r,$:o}}function PR(e){return Pa(e)?e:e.contextElement}function Mh(e){const t=PR(e);if(!Co(t))return vo(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=o9(t);let a=(i?_b(n.width):n.width)/r,o=(i?_b(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}const $9e=vo(0);function l9(e){const t=_i(e);return!DR()||!t.visualViewport?$9e:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function V9e(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==_i(e)?!1:t}function sd(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=PR(e);let a=vo(1);t&&(r?Pa(r)&&(a=Mh(r)):a=Mh(e));const o=V9e(i,n,r)?l9(i):vo(0);let l=(s.left+o.x)/a.x,c=(s.top+o.y)/a.y,d=s.width/a.x,h=s.height/a.y;if(i){const f=_i(i),p=r&&Pa(r)?_i(r):r;let m=f,v=lk(m);for(;v&&r&&p!==m;){const x=Mh(v),b=v.getBoundingClientRect(),w=Ia(v),C=b.left+(v.clientLeft+parseFloat(w.paddingLeft))*x.x,E=b.top+(v.clientTop+parseFloat(w.paddingTop))*x.y;l*=x.x,c*=x.y,d*=x.x,h*=x.y,l+=C,c+=E,m=_i(v),v=lk(m)}}return Ab({width:d,height:h,x:l,y:c})}function IR(e,t){const n=Mw(e).scrollLeft;return t?t.left+n:sd(To(e)).left+n}function c9(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=r.left+t.scrollLeft-(n?0:IR(e,r)),i=r.top+t.scrollTop;return{x:s,y:i}}function W9e(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",a=To(r),o=t?Nw(t.floating):!1;if(r===a||o&&i)return n;let l={scrollLeft:0,scrollTop:0},c=vo(1);const d=vo(0),h=Co(r);if((h||!h&&!i)&&((Mf(r)!=="body"||d0(a))&&(l=Mw(r)),Co(r))){const p=sd(r);c=Mh(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop}const f=a&&!h&&!i?c9(a,l,!0):vo(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x+f.x,y:n.y*c.y-l.scrollTop*c.y+d.y+f.y}}function z9e(e){return Array.from(e.getClientRects())}function q9e(e){const t=To(e),n=Mw(e),r=e.ownerDocument.body,s=Mu(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Mu(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+IR(e);const o=-n.scrollTop;return Ia(r).direction==="rtl"&&(a+=Mu(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:a,y:o}}function K9e(e,t){const n=_i(e),r=To(e),s=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,o=0,l=0;if(s){i=s.width,a=s.height;const c=DR();(!c||c&&t==="fixed")&&(o=s.offsetLeft,l=s.offsetTop)}return{width:i,height:a,x:o,y:l}}function Y9e(e,t){const n=sd(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=Co(e)?Mh(e):vo(1),a=e.clientWidth*i.x,o=e.clientHeight*i.y,l=s*i.x,c=r*i.y;return{width:a,height:o,x:l,y:c}}function zO(e,t,n){let r;if(t==="viewport")r=K9e(e,n);else if(t==="document")r=q9e(To(e));else if(Pa(t))r=Y9e(t,n);else{const s=l9(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Ab(r)}function u9(e,t){const n=yc(e);return n===t||!Pa(n)||ff(n)?!1:Ia(n).position==="fixed"||u9(n,t)}function X9e(e,t){const n=t.get(e);if(n)return n;let r=Dm(e,[],!1).filter(o=>Pa(o)&&Mf(o)!=="body"),s=null;const i=Ia(e).position==="fixed";let a=i?yc(e):e;for(;Pa(a)&&!ff(a);){const o=Ia(a),l=FR(a);!l&&o.position==="fixed"&&(s=null),(i?!l&&!s:!l&&o.position==="static"&&s&&["absolute","fixed"].includes(s.position)||d0(a)&&!l&&u9(e,a))?r=r.filter(c=>c!==a):s=o,a=yc(a)}return t.set(e,r),r}function Q9e(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const i=[...n==="clippingAncestors"?Nw(t)?[]:X9e(t,this._c):[].concat(n),r],a=i[0],o=i.reduce((l,c)=>{const d=zO(t,c,s);return l.top=Mu(d.top,l.top),l.right=df(d.right,l.right),l.bottom=df(d.bottom,l.bottom),l.left=Mu(d.left,l.left),l},zO(t,a,s));return{width:o.right-o.left,height:o.bottom-o.top,x:o.left,y:o.top}}function J9e(e){const{width:t,height:n}=o9(e);return{width:t,height:n}}function Z9e(e,t,n){const r=Co(t),s=To(t),i=n==="fixed",a=sd(e,!0,i,t);let o={scrollLeft:0,scrollTop:0};const l=vo(0);if(r||!r&&!i)if((Mf(t)!=="body"||d0(s))&&(o=Mw(t)),r){const f=sd(t,!0,i,t);l.x=f.x+t.clientLeft,l.y=f.y+t.clientTop}else s&&(l.x=IR(s));const c=s&&!r&&!i?c9(s,o):vo(0),d=a.left+o.scrollLeft-l.x-c.x,h=a.top+o.scrollTop-l.y-c.y;return{x:d,y:h,width:a.width,height:a.height}}function _y(e){return Ia(e).position==="static"}function qO(e,t){if(!Co(e)||Ia(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return To(e)===n&&(n=n.ownerDocument.body),n}function d9(e,t){const n=_i(e);if(Nw(e))return n;if(!Co(e)){let s=yc(e);for(;s&&!ff(s);){if(Pa(s)&&!_y(s))return s;s=yc(s)}return n}let r=qO(e,t);for(;r&&U9e(r)&&_y(r);)r=qO(r,t);return r&&ff(r)&&_y(r)&&!FR(r)?n:r||G9e(e)||n}const e$e=async function(e){const t=this.getOffsetParent||d9,n=this.getDimensions,r=await n(e.floating);return{reference:Z9e(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function t$e(e){return Ia(e).direction==="rtl"}const n$e={convertOffsetParentRelativeRectToViewportRelativeRect:W9e,getDocumentElement:To,getClippingRect:Q9e,getOffsetParent:d9,getElementRects:e$e,getClientRects:z9e,getDimensions:J9e,getScale:Mh,isElement:Pa,isRTL:t$e};function r$e(e,t){let n=null,r;const s=To(e);function i(){var o;clearTimeout(r),(o=n)==null||o.disconnect(),n=null}function a(o,l){o===void 0&&(o=!1),l===void 0&&(l=1),i();const{left:c,top:d,width:h,height:f}=e.getBoundingClientRect();if(o||t(),!h||!f)return;const p=yv(d),m=yv(s.clientWidth-(c+h)),v=yv(s.clientHeight-(d+f)),x=yv(c),b={rootMargin:-p+"px "+-m+"px "+-v+"px "+-x+"px",threshold:Mu(0,df(1,l))||1};let w=!0;function C(E){const y=E[0].intersectionRatio;if(y!==l){if(!w)return a();y?a(!1,y):r=setTimeout(()=>{a(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(C,li({},b,{root:s.ownerDocument}))}catch{n=new IntersectionObserver(C,b)}n.observe(e)}return a(!0),i}function s$e(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=PR(e),d=s||i?[...c?Dm(c):[],...Dm(t)]:[];d.forEach(b=>{s&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const h=c&&o?r$e(c,n):null;let f=-1,p=null;a&&(p=new ResizeObserver(b=>{let[w]=b;w&&w.target===c&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var C;(C=p)==null||C.observe(t)})),n()}),c&&!l&&p.observe(c),p.observe(t));let m,v=l?sd(e):null;l&&x();function x(){const b=sd(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=>{s&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),h?.(),(b=p)==null||b.disconnect(),p=null,l&&cancelAnimationFrame(m)}}const i$e=L9e,a$e=j9e,o$e=B9e,l$e=M9e,c$e=H9e,u$e=(e,t,n)=>{const r=new Map,s=li({platform:n$e},n),i=li({},s.platform,{_c:r});return N9e(e,t,li({},s,{platform:i}))};function d$e(e){e.cleanup&&e.cleanup();const t=e._getResolvedAttachToOptions();let n=t.element;const r=v$e(t,e),s=t9(t);return s&&(n=document.body,e.shepherdElementComponent.getElement().classList.add("shepherd-centered")),e.cleanup=s$e(n,e.el,()=>{if(!e.el){e.cleanup==null||e.cleanup();return}p$e(n,e,r,s)}),e.target=t.element,r}function h$e(e,t){return{floatingUIOptions:ER(e.floatingUIOptions||{},t.floatingUIOptions||{})}}function f$e(e){e.cleanup&&e.cleanup(),e.cleanup=null}function p$e(e,t,n,r){return u$e(e,t.el,n).then(g$e(t,r)).then(s=>new Promise(i=>{setTimeout(()=>i(s),300)})).then(s=>{s!=null&&s.el&&s.el.focus({preventScroll:!0})})}function g$e(e,t){return({x:n,y:r,placement:s,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:`${r}px`}),e.el.dataset.popperPlacement=s,m$e(e.el,i)),e)}function m$e(e,t){const n=e.querySelector(".shepherd-arrow");if(uf(n)&&t.arrow){const{x:r,y:s}=t.arrow;Object.assign(n.style,{left:r!=null?`${r}px`:"",top:s!=null?`${s}px`:""})}}function v$e(e,t){var n,r,s;const i={strategy:"absolute"};i.middleware=[];const a=x$e(t),o=t9(e),l=(n=e.on)==null?void 0:n.includes("auto"),c=(e==null||(r=e.on)==null?void 0:r.includes("-start"))||(e==null||(s=e.on)==null?void 0:s.includes("-end"));if(!o){if(l){var d;i.middleware.push(i$e({crossAxis:!0,alignment:c?e==null||(d=e.on)==null?void 0:d.split("-").pop():null}))}else i.middleware.push(o$e());if(i.middleware.push(a$e({limiter:c$e(),crossAxis:!0})),a){const h=typeof t.options.arrow=="object"?t.options.arrow:{padding:4};i.middleware.push(l$e({element:a,padding:c?h.padding:0}))}l||(i.placement=e.on)}return ER(i,t.options.floatingUIOptions||{})}function x$e(e){return e.options.arrow&&e.el?e.el.querySelector(".shepherd-arrow"):!1}function Ai(){}function b$e(e,t){for(const n in t)e[n]=t[n];return e}function h9(e){return e()}function KO(){return Object.create(null)}function h0(e){e.forEach(h9)}function NR(e){return typeof e=="function"}function yl(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function w$e(e){return Object.keys(e).length===0}function pf(e,t){e.appendChild(t)}function ja(e,t,n){e.insertBefore(t,n||null)}function ua(e){e.parentNode&&e.parentNode.removeChild(e)}function C$e(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function yo(e){return document.createElement(e)}function YO(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function f9(e){return document.createTextNode(e)}function Fb(){return f9(" ")}function y$e(){return f9("")}function Ow(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function Dn(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}const S$e=["width","height"];function XO(e,t){const n=Object.getOwnPropertyDescriptors(e.__proto__);for(const r in t)t[r]==null?e.removeAttribute(r):r==="style"?e.style.cssText=t[r]:r==="__value"?e.value=e[r]=t[r]:n[r]&&n[r].set&&S$e.indexOf(r)===-1?e[r]=t[r]:Dn(e,r,t[r])}function E$e(e){return Array.from(e.childNodes)}function Ud(e,t,n){e.classList.toggle(t,!!n)}let Pm;function Rg(e){Pm=e}function p9(){if(!Pm)throw new Error("Function called outside component initialization");return Pm}function k$e(e){p9().$$.on_mount.push(e)}function MR(e){p9().$$.after_update.push(e)}const Qd=[],gf=[];let Oh=[];const QO=[],_$e=Promise.resolve();let ck=!1;function T$e(){ck||(ck=!0,_$e.then(g9))}function uk(e){Oh.push(e)}const Ty=new Set;let Gd=0;function g9(){if(Gd!==0)return;const e=Pm;do{try{for(;Gd<Qd.length;){const t=Qd[Gd];Gd++,Rg(t),R$e(t.$$)}}catch(t){throw Qd.length=0,Gd=0,t}for(Rg(null),Qd.length=0,Gd=0;gf.length;)gf.pop()();for(let t=0;t<Oh.length;t+=1){const n=Oh[t];Ty.has(n)||(Ty.add(n),n())}Oh.length=0}while(Qd.length);for(;QO.length;)QO.pop()();ck=!1,Ty.clear(),Rg(e)}function R$e(e){if(e.fragment!==null){e.update(),h0(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(uk)}}function A$e(e){const t=[],n=[];Oh.forEach(r=>e.indexOf(r)===-1?t.push(r):n.push(r)),n.forEach(r=>r()),Oh=t}const Xv=new Set;let gu;function Ou(){gu={r:0,c:[],p:gu}}function Lu(){gu.r||h0(gu.c),gu=gu.p}function Sn(e,t){e&&e.i&&(Xv.delete(e),e.i(t))}function mr(e,t,n,r){if(e&&e.o){if(Xv.has(e))return;Xv.add(e),gu.c.push(()=>{Xv.delete(e),r&&(n&&e.d(1),r())}),e.o(t)}else r&&r()}function JO(e){return e?.length!==void 0?e:Array.from(e)}function F$e(e,t){const n={},r={},s={$$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||(r[l]=1);for(const l in o)s[l]||(n[l]=o[l],s[l]=1);e[i]=o}else for(const l in a)s[l]=1}for(const a in r)a in n||(n[a]=void 0);return n}function wd(e){e&&e.c()}function Mc(e,t,n){const{fragment:r,after_update:s}=e.$$;r&&r.m(t,n),uk(()=>{const i=e.$$.on_mount.map(h9).filter(NR);e.$$.on_destroy?e.$$.on_destroy.push(...i):h0(i),e.$$.on_mount=[]}),s.forEach(uk)}function Oc(e,t){const n=e.$$;n.fragment!==null&&(A$e(n.after_update),h0(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function D$e(e,t){e.$$.dirty[0]===-1&&(Qd.push(e),T$e(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function Sl(e,t,n,r,s,i,a=null,o=[-1]){const l=Pm;Rg(e);const c=e.$$={fragment:null,ctx:[],props:i,update:Ai,not_equal:s,bound:KO(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:KO(),dirty:o,skip_bound:!1,root:t.target||l.$$.root};a&&a(c.root);let d=!1;if(c.ctx=n?n(e,t.props||{},(h,f,...p)=>{const m=p.length?p[0]:f;return c.ctx&&s(c.ctx[h],c.ctx[h]=m)&&(!c.skip_bound&&c.bound[h]&&c.bound[h](m),d&&D$e(e,h)),f}):[],c.update(),d=!0,h0(c.before_update),c.fragment=r?r(c.ctx):!1,t.target){if(t.hydrate){const h=E$e(t.target);c.fragment&&c.fragment.l(h),h.forEach(ua)}else c.fragment&&c.fragment.c();t.intro&&Sn(e.$$.fragment),Mc(e,t.target,t.anchor),g9()}Rg(l)}class El{constructor(){this.$$=void 0,this.$$set=void 0}$destroy(){Oc(this,1),this.$destroy=Ai}$on(t,n){if(!NR(n))return Ai;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{const s=r.indexOf(n);s!==-1&&r.splice(s,1)}}$set(t){this.$$set&&!w$e(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const P$e="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(P$e);function I$e(e){let t,n,r,s,i;return{c(){t=yo("button"),Dn(t,"aria-label",n=e[3]?e[3]:null),Dn(t,"class",r=`${e[1]||""} shepherd-button ${e[4]?"shepherd-button-secondary":""}`),t.disabled=e[2],Dn(t,"tabindex","0"),Dn(t,"type","button")},m(a,o){ja(a,t,o),t.innerHTML=e[5],s||(i=Ow(t,"click",function(){NR(e[0])&&e[0].apply(this,arguments)}),s=!0)},p(a,[o]){e=a,o&32&&(t.innerHTML=e[5]),o&8&&n!==(n=e[3]?e[3]:null)&&Dn(t,"aria-label",n),o&18&&r!==(r=`${e[1]||""} shepherd-button ${e[4]?"shepherd-button-secondary":""}`)&&Dn(t,"class",r),o&4&&(t.disabled=e[2])},i:Ai,o:Ai,d(a){a&&ua(t),s=!1,i()}}}function N$e(e,t,n){let{config:r,step:s}=t,i,a,o,l,c,d;function h(f){return Cc(f)?f=f.call(s):f}return e.$$set=f=>{"config"in f&&n(6,r=f.config),"step"in f&&n(7,s=f.step)},e.$$.update=()=>{e.$$.dirty&192&&(n(0,i=r.action?r.action.bind(s.tour):null),n(1,a=r.classes),n(2,o=r.disabled?h(r.disabled):!1),n(3,l=r.label?h(r.label):null),n(4,c=r.secondary),n(5,d=r.text?h(r.text):null))},[i,a,o,l,c,d,r,s]}class M$e extends El{constructor(t){super(),Sl(this,t,N$e,I$e,yl,{config:6,step:7})}}function ZO(e,t,n){const r=e.slice();return r[2]=t[n],r}function eL(e){let t,n,r=JO(e[1]),s=[];for(let a=0;a<r.length;a+=1)s[a]=tL(ZO(e,r,a));const i=a=>mr(s[a],1,1,()=>{s[a]=null});return{c(){for(let a=0;a<s.length;a+=1)s[a].c();t=y$e()},m(a,o){for(let l=0;l<s.length;l+=1)s[l]&&s[l].m(a,o);ja(a,t,o),n=!0},p(a,o){if(o&3){r=JO(a[1]);let l;for(l=0;l<r.length;l+=1){const c=ZO(a,r,l);s[l]?(s[l].p(c,o),Sn(s[l],1)):(s[l]=tL(c),s[l].c(),Sn(s[l],1),s[l].m(t.parentNode,t))}for(Ou(),l=r.length;l<s.length;l+=1)i(l);Lu()}},i(a){if(!n){for(let o=0;o<r.length;o+=1)Sn(s[o]);n=!0}},o(a){s=s.filter(Boolean);for(let o=0;o<s.length;o+=1)mr(s[o]);n=!1},d(a){a&&ua(t),C$e(s,a)}}}function tL(e){let t,n;return t=new M$e({props:{config:e[2],step:e[0]}}),{c(){wd(t.$$.fragment)},m(r,s){Mc(t,r,s),n=!0},p(r,s){const i={};s&2&&(i.config=r[2]),s&1&&(i.step=r[0]),t.$set(i)},i(r){n||(Sn(t.$$.fragment,r),n=!0)},o(r){mr(t.$$.fragment,r),n=!1},d(r){Oc(t,r)}}}function O$e(e){let t,n,r=e[1]&&eL(e);return{c(){t=yo("footer"),r&&r.c(),Dn(t,"class","shepherd-footer")},m(s,i){ja(s,t,i),r&&r.m(t,null),n=!0},p(s,[i]){s[1]?r?(r.p(s,i),i&2&&Sn(r,1)):(r=eL(s),r.c(),Sn(r,1),r.m(t,null)):r&&(Ou(),mr(r,1,1,()=>{r=null}),Lu())},i(s){n||(Sn(r),n=!0)},o(s){mr(r),n=!1},d(s){s&&ua(t),r&&r.d()}}}function L$e(e,t,n){let r,{step:s}=t;return e.$$set=i=>{"step"in i&&n(0,s=i.step)},e.$$.update=()=>{e.$$.dirty&1&&n(1,r=s.options.buttons)},[s,r]}class B$e extends El{constructor(t){super(),Sl(this,t,L$e,O$e,yl,{step:0})}}function j$e(e){let t,n,r,s,i;return{c(){t=yo("button"),n=yo("span"),n.textContent="×",Dn(n,"aria-hidden","true"),Dn(t,"aria-label",r=e[0].label?e[0].label:"Close Tour"),Dn(t,"class","shepherd-cancel-icon"),Dn(t,"type","button")},m(a,o){ja(a,t,o),pf(t,n),s||(i=Ow(t,"click",e[1]),s=!0)},p(a,[o]){o&1&&r!==(r=a[0].label?a[0].label:"Close Tour")&&Dn(t,"aria-label",r)},i:Ai,o:Ai,d(a){a&&ua(t),s=!1,i()}}}function H$e(e,t,n){let{cancelIcon:r,step:s}=t;const i=a=>{a.preventDefault(),s.cancel()};return e.$$set=a=>{"cancelIcon"in a&&n(0,r=a.cancelIcon),"step"in a&&n(2,s=a.step)},[r,i,s]}class U$e extends El{constructor(t){super(),Sl(this,t,H$e,j$e,yl,{cancelIcon:0,step:2})}}function G$e(e){let t;return{c(){t=yo("h3"),Dn(t,"id",e[1]),Dn(t,"class","shepherd-title")},m(n,r){ja(n,t,r),e[3](t)},p(n,[r]){r&2&&Dn(t,"id",n[1])},i:Ai,o:Ai,d(n){n&&ua(t),e[3](null)}}}function $$e(e,t,n){let{labelId:r,element:s,title:i}=t;MR(()=>{Cc(i)&&n(2,i=i()),n(0,s.innerHTML=i,s)});function a(o){gf[o?"unshift":"push"](()=>{s=o,n(0,s)})}return e.$$set=o=>{"labelId"in o&&n(1,r=o.labelId),"element"in o&&n(0,s=o.element),"title"in o&&n(2,i=o.title)},[s,r,i,a]}class V$e extends El{constructor(t){super(),Sl(this,t,$$e,G$e,yl,{labelId:1,element:0,title:2})}}function nL(e){let t,n;return t=new V$e({props:{labelId:e[0],title:e[2]}}),{c(){wd(t.$$.fragment)},m(r,s){Mc(t,r,s),n=!0},p(r,s){const i={};s&1&&(i.labelId=r[0]),s&4&&(i.title=r[2]),t.$set(i)},i(r){n||(Sn(t.$$.fragment,r),n=!0)},o(r){mr(t.$$.fragment,r),n=!1},d(r){Oc(t,r)}}}function rL(e){let t,n;return t=new U$e({props:{cancelIcon:e[3],step:e[1]}}),{c(){wd(t.$$.fragment)},m(r,s){Mc(t,r,s),n=!0},p(r,s){const i={};s&8&&(i.cancelIcon=r[3]),s&2&&(i.step=r[1]),t.$set(i)},i(r){n||(Sn(t.$$.fragment,r),n=!0)},o(r){mr(t.$$.fragment,r),n=!1},d(r){Oc(t,r)}}}function W$e(e){let t,n,r,s=e[2]&&nL(e),i=e[3]&&e[3].enabled&&rL(e);return{c(){t=yo("header"),s&&s.c(),n=Fb(),i&&i.c(),Dn(t,"class","shepherd-header")},m(a,o){ja(a,t,o),s&&s.m(t,null),pf(t,n),i&&i.m(t,null),r=!0},p(a,[o]){a[2]?s?(s.p(a,o),o&4&&Sn(s,1)):(s=nL(a),s.c(),Sn(s,1),s.m(t,n)):s&&(Ou(),mr(s,1,1,()=>{s=null}),Lu()),a[3]&&a[3].enabled?i?(i.p(a,o),o&8&&Sn(i,1)):(i=rL(a),i.c(),Sn(i,1),i.m(t,null)):i&&(Ou(),mr(i,1,1,()=>{i=null}),Lu())},i(a){r||(Sn(s),Sn(i),r=!0)},o(a){mr(s),mr(i),r=!1},d(a){a&&ua(t),s&&s.d(),i&&i.d()}}}function z$e(e,t,n){let{labelId:r,step:s}=t,i,a;return e.$$set=o=>{"labelId"in o&&n(0,r=o.labelId),"step"in o&&n(1,s=o.step)},e.$$.update=()=>{e.$$.dirty&2&&(n(2,i=s.options.title),n(3,a=s.options.cancelIcon))},[r,s,i,a]}class q$e extends El{constructor(t){super(),Sl(this,t,z$e,W$e,yl,{labelId:0,step:1})}}function K$e(e){let t;return{c(){t=yo("div"),Dn(t,"class","shepherd-text"),Dn(t,"id",e[1])},m(n,r){ja(n,t,r),e[3](t)},p(n,[r]){r&2&&Dn(t,"id",n[1])},i:Ai,o:Ai,d(n){n&&ua(t),e[3](null)}}}function Y$e(e,t,n){let{descriptionId:r,element:s,step:i}=t;MR(()=>{let{text:o}=i.options;Cc(o)&&(o=o.call(i)),uf(o)?s.appendChild(o):n(0,s.innerHTML=o,s)});function a(o){gf[o?"unshift":"push"](()=>{s=o,n(0,s)})}return e.$$set=o=>{"descriptionId"in o&&n(1,r=o.descriptionId),"element"in o&&n(0,s=o.element),"step"in o&&n(2,i=o.step)},[s,r,i,a]}class X$e extends El{constructor(t){super(),Sl(this,t,Y$e,K$e,yl,{descriptionId:1,element:0,step:2})}}function sL(e){let t,n;return t=new q$e({props:{labelId:e[1],step:e[2]}}),{c(){wd(t.$$.fragment)},m(r,s){Mc(t,r,s),n=!0},p(r,s){const i={};s&2&&(i.labelId=r[1]),s&4&&(i.step=r[2]),t.$set(i)},i(r){n||(Sn(t.$$.fragment,r),n=!0)},o(r){mr(t.$$.fragment,r),n=!1},d(r){Oc(t,r)}}}function iL(e){let t,n;return t=new X$e({props:{descriptionId:e[0],step:e[2]}}),{c(){wd(t.$$.fragment)},m(r,s){Mc(t,r,s),n=!0},p(r,s){const i={};s&1&&(i.descriptionId=r[0]),s&4&&(i.step=r[2]),t.$set(i)},i(r){n||(Sn(t.$$.fragment,r),n=!0)},o(r){mr(t.$$.fragment,r),n=!1},d(r){Oc(t,r)}}}function aL(e){let t,n;return t=new B$e({props:{step:e[2]}}),{c(){wd(t.$$.fragment)},m(r,s){Mc(t,r,s),n=!0},p(r,s){const i={};s&4&&(i.step=r[2]),t.$set(i)},i(r){n||(Sn(t.$$.fragment,r),n=!0)},o(r){mr(t.$$.fragment,r),n=!1},d(r){Oc(t,r)}}}function Q$e(e){let t,n=!_s(e[2].options.title)||e[2].options.cancelIcon&&e[2].options.cancelIcon.enabled,r,s=!_s(e[2].options.text),i,a=Array.isArray(e[2].options.buttons)&&e[2].options.buttons.length,o,l=n&&sL(e),c=s&&iL(e),d=a&&aL(e);return{c(){t=yo("div"),l&&l.c(),r=Fb(),c&&c.c(),i=Fb(),d&&d.c(),Dn(t,"class","shepherd-content")},m(h,f){ja(h,t,f),l&&l.m(t,null),pf(t,r),c&&c.m(t,null),pf(t,i),d&&d.m(t,null),o=!0},p(h,[f]){f&4&&(n=!_s(h[2].options.title)||h[2].options.cancelIcon&&h[2].options.cancelIcon.enabled),n?l?(l.p(h,f),f&4&&Sn(l,1)):(l=sL(h),l.c(),Sn(l,1),l.m(t,r)):l&&(Ou(),mr(l,1,1,()=>{l=null}),Lu()),f&4&&(s=!_s(h[2].options.text)),s?c?(c.p(h,f),f&4&&Sn(c,1)):(c=iL(h),c.c(),Sn(c,1),c.m(t,i)):c&&(Ou(),mr(c,1,1,()=>{c=null}),Lu()),f&4&&(a=Array.isArray(h[2].options.buttons)&&h[2].options.buttons.length),a?d?(d.p(h,f),f&4&&Sn(d,1)):(d=aL(h),d.c(),Sn(d,1),d.m(t,null)):d&&(Ou(),mr(d,1,1,()=>{d=null}),Lu())},i(h){o||(Sn(l),Sn(c),Sn(d),o=!0)},o(h){mr(l),mr(c),mr(d),o=!1},d(h){h&&ua(t),l&&l.d(),c&&c.d(),d&&d.d()}}}function J$e(e,t,n){let{descriptionId:r,labelId:s,step:i}=t;return e.$$set=a=>{"descriptionId"in a&&n(0,r=a.descriptionId),"labelId"in a&&n(1,s=a.labelId),"step"in a&&n(2,i=a.step)},[r,s,i]}class Z$e extends El{constructor(t){super(),Sl(this,t,J$e,Q$e,yl,{descriptionId:0,labelId:1,step:2})}}function oL(e){let t;return{c(){t=yo("div"),Dn(t,"class","shepherd-arrow"),Dn(t,"data-popper-arrow","")},m(n,r){ja(n,t,r)},d(n){n&&ua(t)}}}function eVe(e){let t,n,r,s,i,a,o,l,c=e[4].options.arrow&&e[4].options.attachTo&&e[4].options.attachTo.element&&e[4].options.attachTo.on&&oL();r=new Z$e({props:{descriptionId:e[2],labelId:e[3],step:e[4]}});let d=[{"aria-describedby":s=_s(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=b$e(h,d[f]);return{c(){t=yo("dialog"),c&&c.c(),n=Fb(),wd(r.$$.fragment),XO(t,h),Ud(t,"shepherd-has-cancel-icon",e[5]),Ud(t,"shepherd-has-title",e[6]),Ud(t,"shepherd-element",!0)},m(f,p){ja(f,t,p),c&&c.m(t,null),pf(t,n),Mc(r,t,null),e[13](t),a=!0,o||(l=Ow(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?c||(c=oL(),c.c(),c.m(t,n)):c&&(c.d(1),c=null);const m={};p&4&&(m.descriptionId=f[2]),p&8&&(m.labelId=f[3]),p&16&&(m.step=f[4]),r.$set(m),XO(t,h=F$e(d,[(!a||p&20&&s!==(s=_s(f[4].options.text)?null:f[2]))&&{"aria-describedby":s},(!a||p&24&&i!==(i=f[4].options.title?f[3]:null))&&{"aria-labelledby":i},p&2&&f[1],{open:"true"}])),Ud(t,"shepherd-has-cancel-icon",f[5]),Ud(t,"shepherd-has-title",f[6]),Ud(t,"shepherd-element",!0)},i(f){a||(Sn(r.$$.fragment,f),a=!0)},o(f){mr(r.$$.fragment,f),a=!1},d(f){f&&ua(t),c&&c.d(),Oc(r),e[13](null),o=!1,l()}}}const tVe=9,nVe=27,rVe=37,sVe=39;function lL(e){return e.split(" ").filter(t=>!!t.length)}function iVe(e,t,n){let{classPrefix:r,element:s,descriptionId:i,firstFocusableElement:a,focusableElements:o,labelId:l,lastFocusableElement:c,step:d,dataStepId:h}=t,f,p,m;const v=()=>s;k$e(()=>{n(1,h={[`data-${r}shepherd-step-id`]:d.id}),n(9,o=s.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,c=o[o.length-1])}),MR(()=>{m!==d.options.classes&&x()});function x(){b(m),m=d.options.classes,w(m)}function b(y){if(Fm(y)){const k=lL(y);k.length&&s.classList.remove(...k)}}function w(y){if(Fm(y)){const k=lL(y);k.length&&s.classList.add(...k)}}const C=y=>{const{tour:k}=d;switch(y.keyCode){case tVe:if(o.length===0){y.preventDefault();break}y.shiftKey?(document.activeElement===a||document.activeElement.classList.contains("shepherd-element"))&&(y.preventDefault(),c.focus()):document.activeElement===c&&(y.preventDefault(),a.focus());break;case nVe:k.options.exitOnEsc&&(y.preventDefault(),y.stopPropagation(),d.cancel());break;case rVe:k.options.keyboardNavigation&&(y.preventDefault(),y.stopPropagation(),k.back());break;case sVe:k.options.keyboardNavigation&&(y.preventDefault(),y.stopPropagation(),k.next());break}};function E(y){gf[y?"unshift":"push"](()=>{s=y,n(0,s)})}return e.$$set=y=>{"classPrefix"in y&&n(11,r=y.classPrefix),"element"in y&&n(0,s=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,c=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))},[s,h,i,l,d,f,p,C,a,o,c,r,v,E]}class aVe extends El{constructor(t){super(),Sl(this,t,iVe,eVe,yl,{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 dk extends yR{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?e9(this.tour.options.classPrefix):"",this.styles=t.styles,this._resolvedAttachTo=null,kR(this),this._setOptions(n),this}cancel(){this.tour.cancel(),this.trigger("cancel")}complete(){this.tour.complete(),this.trigger("complete")}destroy(){f$e(this),uf(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=S9e(this),this._resolvedExtraHighlightElements}_resolveAttachToOptions(){return this._resolvedAttachTo=y9e(this),this._resolvedAttachTo}_getResolvedAttachToOptions(){return this._resolvedAttachTo===null?this._resolveAttachToOptions():this._resolvedAttachTo}isOpen(){return!!(this.el&&!this.el.hidden)}show(){return Cc(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 aVe({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();Cc(this.options.scrollToHandler)?this.options.scrollToHandler(n):t9e(n)&&typeof n.scrollIntoView=="function"&&n.scrollIntoView(t)}_getClassOptions(t){const n=this.tour&&this.tour.options&&this.tour.options.defaultStepOptions,r=t.classes?t.classes:"",s=n&&n.classes?n.classes:"",i=[...r.split(" "),...s.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=ER({},n||{}),this.options=Object.assign({arrow:!0},n,t,h$e(n,t));const{when:r}=this.options;this.options.classes=this._getClassOptions(t),this.destroy(),this.id=this.options.id||`step-${n9()}`,r&&Object.keys(r).forEach(s=>{this.on(s,r[s],this)})}_setupElements(){_s(this.el)||this.destroy(),this.el=this._createTooltipContent(),this.options.advanceOn&&b9e(this),d$e(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(),r=this.target||document.body,s=this._resolvedExtraHighlightElements;r.classList.add(`${this.classPrefix}shepherd-enabled`),r.classList.add(`${this.classPrefix}shepherd-target`),n.classList.add("shepherd-enabled"),s?.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,r=t._resolvedExtraHighlightElements;if(!n)return;const s=t.options.highlightClass;s&&(n.classList.add(s),r?.forEach(i=>i.classList.add(s))),n.classList.remove("shepherd-target-click-disabled"),r?.forEach(i=>i.classList.remove("shepherd-target-click-disabled")),t.options.canClickTarget===!1&&(n.classList.add("shepherd-target-click-disabled"),r?.forEach(i=>i.classList.add("shepherd-target-click-disabled")))}_updateStepTargetOnHide(){const t=this.target||document.body,n=this._resolvedExtraHighlightElements,r=this.options.highlightClass;r&&(t.classList.remove(r),n?.forEach(s=>s.classList.remove(r))),t.classList.remove("shepherd-target-click-disabled",`${this.classPrefix}shepherd-enabled`,`${this.classPrefix}shepherd-target`),n?.forEach(s=>{s.classList.remove("shepherd-target-click-disabled",`${this.classPrefix}shepherd-enabled`,`${this.classPrefix}shepherd-target`)})}}function oVe(e){if(e){const{steps:t}=e;t.forEach(n=>{n.options&&n.options.canClickTarget===!1&&n.options.attachTo&&(uf(n.target)&&n.target.classList.remove("shepherd-target-click-disabled"),n._resolvedExtraHighlightElements&&n._resolvedExtraHighlightElements.forEach(r=>{uf(r)&&r.classList.remove("shepherd-target-click-disabled")}))})}}function lVe(e){let t="";const{innerWidth:n,innerHeight:r}=window;return e.forEach(s=>{const{width:i,height:a,x:o=0,y:l=0,r:c=0}=s,{topLeft:d=0,topRight:h=0,bottomRight:f=0,bottomLeft:p=0}=typeof c=="number"?{topLeft:c,topRight:c,bottomRight:c,bottomLeft:c}:c;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},${r} H0 V0 H${n} V${r} Z ${t}`.replace(/\s/g,"")}function cVe(e){let t,n,r,s,i;return{c(){t=YO("svg"),n=YO("path"),Dn(n,"d",e[2]),Dn(t,"class",r=`${e[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)},m(a,o){ja(a,t,o),pf(t,n),e[11](t),s||(i=Ow(t,"touchmove",e[3]),s=!0)},p(a,[o]){o&4&&Dn(n,"d",a[2]),o&2&&r!==(r=`${a[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)&&Dn(t,"class",r)},i:Ai,o:Ai,d(a){a&&ua(t),e[11](null),s=!1,i()}}}function m9(e){if(!e)return null;const t=e instanceof HTMLElement&&window.getComputedStyle(e).overflowY;return t!=="hidden"&&t!=="visible"&&e.scrollHeight>=e.clientHeight?e:m9(e.parentElement)}function uVe(e){let t={top:0,left:0};if(!e)return t;let n=e.ownerDocument.defaultView;for(;n!==window.top;){var r;const a=(r=n)==null?void 0:r.frameElement;if(a){var s,i;const o=a.getBoundingClientRect();t.top+=o.top+((s=o.scrollTop)!=null?s:0),t.left+=o.left+((i=o.scrollLeft)!=null?i:0)}n=n.parent}return t}function dVe(e,t){const n=e.getBoundingClientRect();let r=n.y||n.top,s=n.bottom||r+n.height;if(t){const a=t.getBoundingClientRect(),o=a.y||a.top,l=a.bottom||o+a.height;r=Math.max(r,o),s=Math.min(s,l)}const i=Math.max(s-r,0);return{y:r,height:i}}function hVe(e,t,n){let{element:r,openingProperties:s}=t,i=!1,a,o;c();const l=()=>r;function c(){n(4,s=[{width:0,height:0,x:0,y:0,r:0}])}function d(){n(1,i=!1),b()}function h(E=0,y=0,k=0,_=0,I,A,P){if(A){const N=[A,...P||[]];n(4,s=[]);for(const F of N){if(!F||N.indexOf(F)!==N.lastIndexOf(F))continue;const{y:j,height:q}=dVe(F,I),{x:L,width:ie,left:Z}=F.getBoundingClientRect();N.some(J=>{if(J===F)return!1;const U=J.getBoundingClientRect();return L>=U.left&&L+ie<=U.right&&j>=U.top&&j+q<=U.bottom})||s.push({width:ie+E*2,height:q+E*2,x:(L||Z)+k-E,y:j+_-E,r:y})}}else c()}function f(E){b(),E.tour.options.useModalOverlay?(w(E),p()):d()}function p(){n(1,i=!0)}const m=E=>{E.preventDefault()},v=E=>{E.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(E){const{modalOverlayOpeningPadding:y,modalOverlayOpeningRadius:k,modalOverlayOpeningXOffset:_=0,modalOverlayOpeningYOffset:I=0}=E.options,A=uVe(E.target),P=m9(E.target),N=()=>{a=void 0,h(y,k,_+A.left,I+A.top,P,E.target,E._resolvedExtraHighlightElements),a=requestAnimationFrame(N)};N(),x()}function C(E){gf[E?"unshift":"push"](()=>{r=E,n(0,r)})}return e.$$set=E=>{"element"in E&&n(0,r=E.element),"openingProperties"in E&&n(4,s=E.openingProperties)},e.$$.update=()=>{e.$$.dirty&16&&n(2,o=lVe(s))},[r,i,o,v,s,l,c,d,h,f,p,C]}class fVe extends El{constructor(t){super(),Sl(this,t,hVe,cVe,yl,{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 pVe extends yR{constructor(){super(),this.activeTour=void 0,kR(this)}}class gVe extends yR{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,kR(this);const n={exitOnEsc:!0,keyboardNavigation:!0};return this.options=Object.assign({},n,t),this.classPrefix=e9(this.options.classPrefix),this.steps=[],this.addSteps(this.options.steps),["active","cancel","complete","inactive","show","start"].map(r=>{(s=>{this.on(s,i=>{i=i||{},i.tour=this,mu.trigger(s,i)})})(r)}),this._setTourID(t.id),this}addStep(t,n){let r=t;return r instanceof dk?r.tour=this:r=new dk(this,r),_s(n)?this.steps.push(r):this.steps.splice(n,0,r),r}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;Cc(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 mu.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((r,s)=>{if(r.id===t)return r.isOpen()&&r.hide(),r.destroy(),this.steps.splice(s,1),!0}),n&&n.id===t&&(this.currentStep=void 0,this.steps.length?this.show(0):this.cancel())}show(t=0,n=!0){const r=Fm(t)?this.getById(t):this.steps[t];r&&(this._updateStateBeforeShow(),Cc(r.options.showOn)&&!r.options.showOn()?this._skipStep(r,n):(this.currentStep=r,this.trigger("show",{step:r,previous:this.currentStep}),r.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(r=>r.destroy()),oVe(this),this.trigger(t,{index:n}),mu.activeTour=null,this.trigger("inactive",{tour:this}),this.modal&&this.modal.hide(),(t==="cancel"||t==="complete")&&this.modal){const r=document.querySelector(".shepherd-modal-overlay-container");r&&(r.remove(),this.modal=null)}uf(this.focusedElBeforeOpen)&&this.focusedElBeforeOpen.focus()}_setupActiveTour(){this.trigger("active",{tour:this}),mu.activeTour=this}setupModal(){this.modal=new fVe({target:this.options.modalContainer||document.body,props:{styles:this.styles}})}_skipStep(t,n){const r=this.steps.indexOf(t);if(r===this.steps.length-1)this.complete();else{const s=n?r+1:r-1;this.show(s,n)}}_updateStateBeforeShow(){this.currentStep&&this.currentStep.hide(),this.isActive()||this._setupActiveTour()}_setTourID(t){const n=this.options.tourName||"tour",r=t||n9();this.id=`${n}--${r}`}}const mu=new pVe,v9=typeof window>"u";mu.Step=v9?w9e:dk;mu.Tour=v9?C9e:gVe;const Lw=g.createContext(void 0);Lw.Consumer;const mVe=({children:e})=>e9e.jsx(Lw.Provider,{value:{Shepherd:mu},children:e}),vVe=""+new URL("agentic-sequence-CExfswgi.png",import.meta.url).href,xVe=""+new URL("canvas-code-inline-edit-DLji9b0m.png",import.meta.url).href,bVe=""+new URL("canvas-overview-CruGEIRC.png",import.meta.url).href,wVe=""+new URL("canvas-variables-view-DrA20zqs.png",import.meta.url).href,CVe=""+new URL("chat-attachments-_3cRrONU.png",import.meta.url).href,yVe=""+new URL("chat-full-view-e-eJPzrw.png",import.meta.url).href,SVe=""+new URL("chat-input-CU-CA7Se.png",import.meta.url).href,EVe=""+new URL("inline-edit-canvas-O9conTkE.png",import.meta.url).href,kVe=e=>{const t=Array.from(document.querySelectorAll(`[data-tour-tag="${e}"]`));return t.find(n=>n.offsetParent!==null)??t[0]??null},cL=e=>{document.querySelector(`[data-tour-action="${e}"]`)?.click()},uL=[{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="${yVe}" 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="${SVe}" 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="${CVe}" 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="${vVe}" 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}=ct.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>${io("everything",!0)}</code> on Mac and <code>${io("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>&gt;</code> for commands and pages.<br /><br />In a hurry for a conversation? Press <code>${io("chats",!0)}</code> on Mac and <code>${io("chats",!1)}</code> on Windows or Linux and the palette opens already searching your chats, so you can jump straight to one — and <code>${io("commands",!0)}</code> on Mac and <code>${io("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}=ct.getState();e(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const{closeCommandPalette:e}=ct.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}=ct.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="${bVe}" 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="${EVe}" 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.
675
675
  <br /><img src="${xVe}" 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="${wVe}" 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").
676
- 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:()=>kVe("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(){cL("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(()=>{cL("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()}}]}],_Ve=()=>{const e=di(),{completeTourOnboarding:t}=Dg(),n=g.useContext(Lw),r={cancelIcon:{enabled:!0},scrollTo:{behavior:"smooth",block:"center"}},s=!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=Dg.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 c=n?.Shepherd;if(!l&&c&&(l=c.activeTour,!l&&c.Tour&&(console.log("No active Shepherd tour found from context or global. Creating a new one."),l=new c.Tour({useModalOverlay:s,defaultStepOptions:r}))),!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||{},...r},l.options.useModalOverlay=s,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(uL)}else l.steps.length===0&&l.addSteps(uL);typeof l.start=="function"?(e("/"),l.start()):console.warn("Shepherd tour instance does not have a start method.",l)}}},TVe=()=>{const{isModalComplete:e,isTourComplete:t}=Dg(),{startTour:n}=_Ve(),r=He.useContext(Lw),{data:s}=DS(1,1);return g.useEffect(()=>{if(e&&!t&&r){const i=setTimeout(()=>{const a=s?.agents?.[0]?.id;n({firstAgentId:a})},500);return()=>clearTimeout(i)}},[e,t,r,n,s]),null},RVe=({children:e})=>u.jsxs(mVe,{children:[e,u.jsx(TVe,{})]}),AVe=()=>{const{open:e,focusGroup:t,providerId:n,closeConnect:r}=f3(),s=di();return u.jsx(bf,{open:e,onOpenChange:i=>{i||r()},children:u.jsxs(wf,{className:"max-h-[calc(100vh-4rem)] max-w-[min(40rem,calc(100vw-4rem))] gap-4 overflow-y-auto","data-connect-provider-dialog":"",children:[u.jsxs("div",{className:"flex flex-col gap-1",children:[u.jsx(Uu,{className:"text-title",children:"Connect a model provider"}),u.jsx($m,{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?u.jsx(X7,{context:"dialog",featuredOnly:!0,focusGroup:t,initialProviderId:n,onDone:r,onChangeModel:()=>{r(),s("/settings")}}):null]})})},FVe=""+new URL("radient-icon-1024x1024-D_JJedvo.png",import.meta.url).href,x9={all:["radient-prices"],prices:()=>[...x9.all,"prices"]},DVe=()=>{const e=Qr({queryKey:x9.prices(),queryFn:()=>b3({operation:"prices"}),staleTime:36e5,refetchOnWindowFocus:!1,refetchOnMount:!0,refetchInterval:!1,retry:3});return{prices:e.data,isLoading:e.isLoading,isFetching:e.isFetching,error:e.error,pricesQuery:e}},b9=$b()(MY(e=>({hasBeenNotified:!1,setHasBeenNotified:t=>{e({hasBeenNotified:t})}}),{name:"low-credits-storage"})),PVe=({open:e,onClose:t,onGoToConsole:n})=>{const{setHasBeenNotified:r}=b9(),{prices:s,isLoading:i,error:a}=DVe(),o=d=>typeof d!="number"?"$...":`$${d.toFixed(2)} USD`,l=()=>{r(!0),t()},c=()=>{r(!0),n()};return u.jsx(Sc,{open:e,onClose:l,title:u.jsxs(u.Fragment,{children:[u.jsx("img",{src:FVe,alt:"Radient icon",className:"size-7"}),"Running low on Radient credits?"]}),maxWidth:"sm",fullWidth:!1,actions:u.jsxs(u.Fragment,{children:[u.jsx(Nm,{onClick:l,children:"Maybe later"}),u.jsx(Mm,{onClick:c,startIcon:u.jsx(xu,{size:18}),className:"min-w-55",children:"Get more credits"})]}),children:u.jsxs("div",{className:"flex flex-col items-center gap-4 py-2 text-center",children:[u.jsxs("p",{className:"text-body-sm text-ink-muted",children:["Unlock the full power of Local Operator with"," ",u.jsx("span",{className:"font-bold text-accent",children:"Radient Pass"}),"."]}),u.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."}),u.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."}),u.jsxs("p",{className:"text-body-sm text-ink-muted",children:["Plus, get"," ",u.jsx("span",{className:"font-medium text-ink",children:i?u.jsx(Hn,{size:"sm",className:"mr-0.5 align-middle"}):o(s?.default_registration_credits)})," ","in bonus credits with your first purchase.",a&&u.jsx("span",{className:"mt-1 block text-meta text-danger",children:"Could not load bonus credit information."})]}),u.jsx("p",{className:"text-meta text-ink-dim",children:"You can also reach the Radient Console from Settings at any time."})]})})},IVe=(e,t)=>t?Ay(e.filter(n=>n.session_id===t)).length:0;function NVe(e){return Ee(t=>IVe(t.sessions,e))}const MVe=(e,t)=>t?e.some(n=>n.session_id===t&&n.status?.code==="busy"):!1;function OVe(e){return Ee(t=>MVe(t.sessions,e))}const LVe=[];function BVe(){const{state:e}=Zb(),t=e?.pendingConsent??LVe,n=LB(r=>dD(t,r));return g.useEffect(()=>{t.length>0&&m_()},[t]),dD(t,n)}const w9={approvals:["desktop","mesh","approvals"]},jVe=15e3,HVe=new Set(["requested","approved","connecting","failed"]);function UVe(e){return HVe.has(e)}function GVe(e){return e==="requested"}function $Ve(e){return e.filter(t=>GVe(t.state)).length}function Qze(e){return e==="requested"}function Jze(e){return UVe(e)}function Zze(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 vu(e){return typeof e=="object"&&e!==null}function VVe(e){const t=vu(e)?e:{};return{deviceId:kt(t.device_id),name:kt(t.name),host:kt(t.host),user:kt(t.user),transport:kt(t.transport),hostKeyFp:kt(t.host_key_fp)}}function WVe(e){const t=vu(e)?e:{};return{connect:go(t.connect,!1),install:go(t.install,!1),anchor:vu(t.anchor),networkId:kt(t.network_id),role:kt(t.role),unattended:go(t.unattended,!1),grants:Qh(t.grant)}}function zVe(e){const t=Array.isArray(e)?e:e?.approvals??[];if(!Array.isArray(t))return[];const n=[];for(const r of t){if(!vu(r))continue;const s=kt(r.approval_id),i=kt(r.state);if(!s||!i)continue;const a=!vu(r.device)&&vu(r.machine)?"machine":"device",o=vu(r.requested_by)?r.requested_by:{};n.push({approvalId:s,state:i,kind:a,where:VVe(a==="machine"?r.machine:r.device),what:WVe(r.what),requestedBy:{surface:kt(o.surface),sessionId:kt(o.session_id),deviceId:kt(o.device_id)},expiresAt:Ql(r.expires_at)})}return n}function qVe(e){return e.kind==="machine"?"this machine":YB({device_id:e.where.deviceId,name:e.where.name})}function eqe(e,t){const n=KVe(e),r=XVe(e,t).map(s=>s.clause);return r.length?`${n}: ${YVe(r)}.`:`${n}.`}function KVe(e){return e.kind==="machine"?"Set up operator authority on this machine":`Onboard ${qVe(e)}`}function YVe(e){return e.length===1?e[0]:`${e.slice(0,-1).join(", ")}; ${e[e.length-1]}`}function tqe(e){const{user:t,host:n,transport:r,name:s}=e.where,i=[n?t?`${t}@${n}`:n:"",r?`via ${r}`:"",s&&s!==n?`(${s})`:""].filter(Boolean);return i.length?i.join(" "):null}function nqe(e){return e.where.hostKeyFp||null}function rqe(e){const{surface:t,sessionId:n}=e.requestedBy,r=[t||"",n?`session ${n.slice(-6)}`:""].filter(Boolean);return r.length?`asked by ${r.join(" · ")}`:null}function XVe(e,t){const{connect:n,install:r,anchor:s,networkId:i,role:a,unattended:o,grants:l}=e.what,c=[];if(n&&c.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"}),r&&c.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"}),s&&c.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||"?"}`;c.push({term:h,clause:h,consequence:`it joins ${d||i} as ${a||"?"}`})}o&&c.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 QVe(l,o)){const h=JVe[d];c.push({term:h?.term??`grant ${d}`,clause:ZVe[d]??`use the ${d} capability`,consequence:h?.gloss??`you may ${d} on that device`})}return c}function QVe(e,t){const n=new Set;for(const r of e){const s=String(r??"").trim();s&&(t&&s==="unattended"||n.add(s))}return[...n]}const JVe={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"}},ZVe={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 sqe(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 r=Math.ceil(n/60);if(r<90)return r===1?"expires in 1 minute":`expires in ${r} minutes`;const s=Math.ceil(r/60);return s===1?"expires in 1 hour":`expires in ${s} hours`}function eWe(e,{poll:t=!0}={}){return Qr({queryKey:w9.approvals,enabled:e,queryFn:async()=>zVe(await At({op:"approvals.list"})),retry:!1,staleTime:t?1e4:Number.POSITIVE_INFINITY,refetchInterval:e&&t?jVe:!1,refetchOnWindowFocus:t})}function iqe(){const e=Qn();return Fs({mutationFn:async t=>{const n=t.decision==="approve"?{op:"approvals.approve",approvalId:t.approvalId}:{op:"approvals.deny",approvalId:t.approvalId};await At(n)},onSettled:()=>{e.invalidateQueries({queryKey:w9.approvals}),e.invalidateQueries({queryKey:ll.networks}),e.invalidateQueries({queryKey:ll.peers})}})}function aqe(e){const t=e?.message;return typeof t=="string"&&t.trim()?t.trim():"The approvals could not be read."}function oqe(e){const t=e;return{code:kt(t?.code)||"approval_refused",sentence:kt(t?.message)||"The decision could not be answered."}}const dL=e=>{const t=gK(e.type),n=typeof e.percent=="number"?`, ${Math.round(e.percent)}%`:"";return`${t} in progress${n}.`},C9=e=>pK({type:e.type,version:e.offer.version}),tWe=e=>`${e.map(r=>C9(r)).map((r,s)=>s===0?r:`${r.charAt(0).toLowerCase()}${r.slice(1)}`).join(" and ")} available. Show the update notice.`,nWe=({surfaces:e,inflight:t,onShow:n,onDismiss:r})=>{if(t===null&&e.length===0)return null;if(t!==null)return u.jsx(Je,{side:"top",collisionPadding:8,content:dL(t),children:u.jsx("output",{"data-update-foot-icon":"","data-update-foot-icon-state":"inflight","aria-label":dL(t),className:"flex size-8 shrink-0 items-center justify-center text-accent",children:u.jsx(Na,{className:"size-4 shrink-0 motion-safe:animate-spin","aria-hidden":"true"})})});const s=e.find(i=>(i.offer.summary??"").trim()!=="");return u.jsx(Je,{side:"top",collisionPadding:8,content:u.jsxs("div",{className:"flex max-w-64 flex-col gap-0.5",children:[e.map(i=>u.jsxs("span",{className:"truncate text-ink",children:[C9(i)," available"]},i.type)),s?u.jsx("span",{className:"truncate text-ink-muted",children:(s.offer.summary??"").trim()}):null,u.jsx("span",{className:"whitespace-nowrap text-ink-muted",children:"Show the update notice."})]}),children:u.jsx("button",{type:"button","data-update-foot-icon":"","data-update-foot-icon-state":"available","aria-label":tWe(e),onClick:n,onKeyDown:i=>{i.key!=="Escape"||!r||(i.stopPropagation(),r())},className:T("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:u.jsx(KL,{className:"size-4 shrink-0","aria-hidden":"true"})})})},hL=()=>{const e=Vr(p=>p.followed),t=Vr(p=>p.running),n=Vr(p=>p.offers),r=Vr(p=>p.detailOpen),s=Vr(p=>p.inflight),i=Vr(p=>p.downloadPercent),a=Vr(p=>p.openNotice),o=Vr(p=>p.noticeOpen),l=Vr(p=>p.dismissNotice),c=g.useMemo(()=>{const p={followed:e,running:t,offers:n,detailOpen:r};return bL.filter(m=>fK(p,m)).map(m=>{const v=n[m];return v?{type:m,offer:v}:null}).filter(m=>m!==null)},[e,t,n,r]),d=g.useMemo(()=>s[an.BACKEND]?{type:an.BACKEND,percent:null}:s[an.UI]?{type:an.UI,percent:i[an.UI]}:null,[s,i]),h=g.useCallback(()=>a(),[a]),f=g.useCallback(()=>l(),[l]);return u.jsx(nWe,{surfaces:c,inflight:d,onShow:h,onDismiss:o?f:void 0})},fL=({expanded:e})=>u.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[u.jsx(mK,{className:"size-6",label:e?void 0:"Local Operator"}),e&&u.jsx("span",{className:"truncate font-semibold text-body text-ink",children:"Local Operator"})]}),hk=He.memo(({expanded:e,useAuth:t=!1})=>{const n=di(),{user:r,isAuthenticated:s,accountRead:i,signOut:a}=w3(),o=i==="checking"?"Checking account…":$2(i)?"Account unavailable":null,l=r?.name??o??"User",c=$2(i),d=r?.email??"",h=c?"Reconnect Radient":d,f=c?"/settings?section=providers&provider=radient":"/settings",p=c?"Reconnect Radient":"Account settings",m=g.useCallback(async()=>{s&&(await a(),window.location.reload())},[s,a]),v=g.useMemo(()=>{const w=r?.name;return w?w.split(" ").map(C=>C.charAt(0)).join("").toUpperCase().substring(0,2):null},[r?.name]),x=u.jsxs("button",{type:"button",onClick:t?void 0:()=>n(f),"aria-label":e?void 0:p,className:T("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:[u.jsx(R3,{className:"size-7 shrink-0",children:u.jsx(A3,{className:"border border-control bg-elevated text-ink",children:v??u.jsx(Pee,{size:14,"aria-hidden":"true"})})}),e&&l&&u.jsxs("span",{className:"min-w-0 text-left",children:[u.jsx("span",{className:"block truncate text-body-sm text-ink",children:l}),h&&u.jsx("span",{className:T("block truncate text-meta",c?"text-accent":"text-ink-dim"),children:h})]})]}),b=e?x:u.jsx(Je,{content:p,side:"right",children:x});return t?u.jsxs(kc,{children:[e?u.jsx(ol,{asChild:!0,children:x}):u.jsx(Je,{content:p,side:"right",children:u.jsx(ol,{asChild:!0,children:x})}),u.jsxs(_c,{align:"end",side:"top",className:"min-w-50",children:[c?u.jsxs(tn,{onSelect:()=>n(f),children:[u.jsx(Uk,{size:16,"aria-hidden":"true"}),"Reconnect Radient"]}):null,u.jsxs(tn,{onSelect:()=>n("/settings"),children:[u.jsx(Xl,{size:16,"aria-hidden":"true"}),"Settings"]}),u.jsxs(tn,{children:[u.jsx(eee,{size:16,"aria-hidden":"true"}),"Privacy and security"]}),u.jsx(Ei,{}),u.jsxs(tn,{onSelect:m,className:"text-danger focus:bg-danger-wash focus:text-danger",children:[u.jsx(wZ,{size:16,"aria-hidden":"true"}),"Sign out"]})]})]}):b});hk.displayName="UserProfileSidebar";const rWe=()=>{const e=YL(),t=Zr(),n=Ee(o=>o.setCataloguePageable),r=Ee(o=>o.fetchSessions),s=Mt(t.data,"session_catalogue_page");g.useEffect(()=>{n(s)},[s,n]);const i=al(t.data,"session_catalogue",2)==="enabled",a=g.useCallback(()=>r(s?QL:Nb,s),[r,s]);return g.useEffect(()=>{i&&a()},[i,a,e.catalogueRevision]),null},sWe="flex h-[30px] w-full items-center gap-2 rounded-md px-2 text-body-sm transition-colors duration-fast ease-out-quart",iWe=()=>{const e=di(),t=Dne(),{expanded:n,mode:r,onCollapse:s}=vK(),i=ct(te=>te.openCommandPalette),a=Zr(),o=Ee(te=>te.activeSessionId),l=BVe(),c=al(a.data,"peers")==="enabled",d=C_(c),h=al(a.data,"approvals")==="enabled",f=eWe(d==="member"&&h,{poll:!0}),p=$Ve(f.data??[]),m=Mt(a.data,"projects",1),v=Mt(a.data,"aida",1),x=wR(v),b=v&&x.data?.enabled===!0,w=x.data?.name??"Aida",C=wGe(),E=NVe(x.data?.session_id),y=OVe(x.data?.session_id),k=()=>{C(e,x.data).catch(te=>Zt($d(te)))},_=[...b?[{icon:RJ,label:w,path:"/chat",isActive:t==="chat"&&!!x.data?.session_id&&o===x.data?.session_id,tourTag:"nav-item-aida",onSelect:k,attention:E,attentionTag:"nav-aida-badge",attentionName:te=>`${w}, ${te} missed message${te===1?"":"s"}`,working:y,workingName:`${w}, working`}]:[],{icon:fc,label:"Agents",path:"/agents",isActive:t==="agents",tourTag:"nav-item-agents"},...m?[{icon:q4,label:"Projects",path:"/projects",isActive:t==="projects",tourTag:"nav-item-projects"}]:[],{icon:z4,label:"Schedules",path:"/schedules",isActive:t==="schedules",tourTag:"nav-item-schedules"},{icon:Bu,label:"Browser",path:"/browser",isActive:t==="browser",tourTag:"nav-item-browser",attention:l,attentionTag:"nav-browser-badge",attentionName:te=>`Browser, ${te} waiting`},{icon:eB,label:"Agent hub",path:"/agent-hub",isActive:t==="agent-hub",tourTag:"nav-item-agent-hub"},...d==="member"?[{icon:h3,label:"Mesh",path:"/mesh",isActive:t==="mesh",tourTag:"nav-item-mesh",attention:p,attentionTag:"nav-mesh-badge",attentionName:te=>`Mesh, ${te} waiting`}]:[]],I=u.jsx(wHe,{selectedConversation:o??void 0,onSelectConversation:te=>void zm(e,te),onStageDraft:(te,Q)=>{Ee.getState().stageDraft(te,Q),e("/chat")}}),A=te=>{const Q=te.attention??0,ce=Q>0&&te.attentionName?te.attentionName(Q):te.label;return te.working&&te.workingName?te.workingName:ce},P=te=>{const Q=te.attention??0,ce=A(te),B=te.isActive?ya:"text-ink-muted hover:bg-row-hover hover:text-ink";return u.jsx("li",{className:T("flex h-[30px] w-full items-center rounded-md","transition-colors duration-fast ease-out-quart",B),children:u.jsxs("button",{type:"button",onClick:()=>te.onSelect?te.onSelect():e(te.path),"data-tour-tag":te.tourTag,"aria-current":te.isActive?"page":void 0,"aria-label":n&&ce===te.label?void 0:ce,className:T("flex h-full min-w-0 flex-1 items-center gap-2 rounded-md",n?"px-2":"justify-center px-0"),children:[u.jsx(te.icon,{size:16,"aria-hidden":"true",className:T("shrink-0",te.isActive&&"text-accent")}),n&&u.jsx("span",{className:"truncate",children:te.label}),Q>0&&u.jsx("span",{className:T(n&&"ml-auto","inline-flex"),children:u.jsx(Cu,{variant:"attentionQuiet",shape:"pill",size:"count","data-tour-tag":te.attentionTag,children:Q})}),te.working&&u.jsx("span",{className:T(n&&"ml-auto","inline-flex"),children:u.jsx(Na,{size:16,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})})]})},te.tourTag)},N=te=>n?P(te):u.jsx("li",{children:u.jsx(Je,{content:A(te),side:"right",children:P(te)})},te.tourTag),F=r==="overlay"?"Close sidebar":n?"Collapse sidebar":"Expand sidebar",j=r==="overlay"?Un:n?zh:xo,q=navigator.platform.toUpperCase().indexOf("MAC")>=0,L=Mt(a.data,"session_catalogue",2),ie=Ee(te=>te.activeDraftKey),Z=Ee(te=>te.drafts),J=!!ie&&!(ie?Z[ie]:void 0)?.target,U=()=>{Ee.getState().stageDraft(void 0,!0),e("/chat")},ne=`New chat (${yO(q).replace("+","")})`,re=`Search (${io("everything",q)}) — chats (${io("chats",q)})`,D=`Search everything (${io("everything",q)}) · your chats (${io("chats",q)})`,H=(te,Q,ce,B)=>{const ye=te;return u.jsxs("button",{type:"button",...B.attrs,onClick:B.onClick,disabled:B.disabled,"aria-label":B.ariaLabel,"aria-current":B.current?"page":void 0,className:T(sWe,B.current?ya:"text-ink-muted hover:bg-row-hover hover:text-ink","disabled:text-ink-disabled disabled:hover:bg-transparent"),children:[u.jsx(ye,{size:16,"aria-hidden":"true",className:"shrink-0"}),u.jsx("span",{className:"truncate",children:Q}),u.jsx("span",{"aria-hidden":"true",className:"ml-auto",children:u.jsx(Cs,{shortcut:ce,joined:!0})})]})},M=H(AS,"New chat",yO(q),{onClick:U,ariaLabel:ne,current:J,disabled:!L,attrs:{"data-tour-tag":"nav-item-chat","data-new-chat-row":""}}),Y=H(Hu,"Search",KGe("everything",q),{onClick:i,ariaLabel:re,attrs:{"data-command-palette-trigger":"",title:D}}),ee=(te,Q,ce)=>{const B=te;return u.jsx(Je,{content:Q,side:"right",children:u.jsx("button",{type:"button",...ce.attrs,onClick:ce.onClick,disabled:ce.disabled,"aria-label":Q,className:T("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:u.jsx(B,{size:16,"aria-hidden":"true"})})})},ae=u.jsx("div",{className:T(r!=="overlay"&&T("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:u.jsx(Je,{content:F,side:"right",children:u.jsx(ue,{variant:"ghost",size:"icon-sm",onClick:s,"aria-label":F,"aria-expanded":r==="overlay"?void 0:n,"aria-keyshortcuts":hA(q),children:u.jsx(j,{"aria-hidden":"true"})})})}),le=u.jsx(Je,{content:"Settings",side:"top",children:u.jsx("button",{type:"button","data-tour-tag":"nav-item-settings",onClick:()=>e("/settings"),"aria-current":t==="settings"?"page":void 0,"aria-label":"Settings",className:T("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:u.jsx(Xl,{size:16,"aria-hidden":"true"})})});return n?u.jsxs("div",{"data-sidebar-shell":"",className:"group/sidebar flex h-full min-h-0 flex-col overflow-hidden bg-surface",children:[u.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 pr-2 pl-4",children:[u.jsx(fL,{expanded:!0}),u.jsx("span",{className:"ml-auto",children:ae})]}),u.jsxs("div",{className:"flex shrink-0 flex-col gap-2 px-2 pb-2",children:[u.jsxs("div",{className:"flex flex-col gap-0.5",children:[M,Y]}),u.jsx("ul",{className:"flex flex-col gap-0.5",children:_.map(N)})]}),u.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:I}),u.jsxs("div",{className:"flex min-h-10 shrink-0 items-center justify-between gap-1 px-2 pb-2",children:[u.jsx(hk,{expanded:!0}),u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsx(hL,{}),le]})]})]}):u.jsxs("div",{"data-sidebar-strip":"",className:"group/sidebar flex h-full min-h-0 flex-col items-center bg-surface",children:[u.jsx(rWe,{}),u.jsx("div",{className:"flex h-10 shrink-0 items-center justify-center",children:u.jsx(fL,{expanded:!1})}),u.jsxs("ul",{className:"flex flex-col items-center gap-1",children:[u.jsx("li",{children:ee(xo,F,{onClick:s,attrs:{"aria-expanded":!1,"aria-keyshortcuts":hA(q)}})}),u.jsx("li",{children:ee(AS,ne,{onClick:U,disabled:!L,attrs:{"data-tour-tag":"nav-item-chat"}})}),u.jsx("li",{children:ee(Hu,re,{onClick:i,attrs:{"data-command-palette-trigger":""}})})]}),u.jsx("ul",{className:"mt-4 flex flex-col items-center gap-1",children:_.map(N)}),u.jsxs("div",{className:"mt-auto flex flex-col items-center gap-1 pb-2",children:[u.jsx(hL,{}),le,u.jsx(hk,{expanded:!1})]})]})},aWe=1,oWe=()=>{const{isAuthenticated:e,user:t}=w3(),{hasBeenNotified:n,setHasBeenNotified:r}=b9(),[s,i]=g.useState(!1),[a,o]=g.useState(null),l=g.useCallback(async()=>{if(!(!e||!t?.radientUser?.account?.tenant_id))try{const f=await b3({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<aWe?n||i(!0):(i(!1),n&&r(!1)):i(!1)},[e,n,a,r]),{isLowCreditsDialogOpen:s,openRadientConsole:()=>{window.api?.openExternal?window.api.openExternal("https://console.radienthq.com"):window.open("https://console.radienthq.com","_blank"),r(!0),i(!1)},closeLowCreditsDialog:()=>{i(!1)},onLowCreditsDialogClose:()=>{r(!0),i(!1)},currentCredits:a}};function lWe(){const e=di();g.useEffect(()=>{const t=s=>{e(s==="back"?-1:1)},n=s=>{const i=Poe(s);i&&(s.preventDefault(),t(i))},r=s=>{const i=Ioe(s);i&&(s.preventDefault(),t(i))};return window.addEventListener("keydown",n),window.addEventListener("mouseup",r),()=>{window.removeEventListener("keydown",n),window.removeEventListener("mouseup",r)}},[e])}function cWe(){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 uWe(e,t,n){const r=document.documentElement;if(t==="mac"){r.dataset.chromeLeading="true",r.dataset.chromeTrailing="false";return}if(e===null){r.dataset.chromeLeading="false",r.dataset.chromeTrailing="false";return}r.dataset.chromeLeading=e.x<=1?"true":"false",r.dataset.chromeTrailing=Math.abs(e.x+e.width-n)<=1?"true":"false"}function dWe(e){const t=window.api?.windowChrome;if(!t)return;const n=getComputedStyle(document.documentElement),r=n.getPropertyValue("--lo-canvas").trim(),s=n.getPropertyValue("--lo-ink-muted").trim(),i=n.getPropertyValue("--lo-ink-dim").trim();!r||!s||!i||t.report({themeId:e,colors:{ground:r,symbol:s,symbolInactive:i}})}function hWe(){g.useLayoutEffect(()=>{if(!window.api?.windowChrome)return;const t=document.documentElement.dataset.chromePlatform??"linux",n=()=>uWe(cWe(),t,window.innerWidth);n();const r=navigator.windowControlsOverlay;return r?.addEventListener?.("geometrychange",n),window.addEventListener("resize",n),()=>{r?.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 fWe=g.lazy(()=>pl(()=>import("./agent-details-page-CNfFll1o.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]),import.meta.url).then(e=>({default:e.AgentDetailsPage}))),pWe=g.lazy(()=>pl(()=>import("./agent-hub-page-CjbuplrT.js"),__vite__mapDeps([13,1,2,4,5,6,7,14,3,8,9,10,15,16,17,11,12]),import.meta.url).then(e=>({default:e.AgentHubPage}))),pL=g.lazy(()=>pl(()=>import("./agents-page-DfD6fXfN.js"),__vite__mapDeps([18,4,5,1,2,6,7,11,12]),import.meta.url).then(e=>({default:e.AgentsPage}))),gWe=g.lazy(()=>pl(()=>import("./schedules-page-CH-Bi8gk.js"),__vite__mapDeps([19,1,2,14,6,4,5,7,17,9,20,11,12]),import.meta.url).then(e=>({default:e.SchedulesPage}))),gL=g.lazy(()=>pl(()=>import("./projects-page-FnxH_c61.js"),__vite__mapDeps([21,1,2,4,5,6,7,14,22,11,12]),import.meta.url).then(e=>({default:e.ProjectsPage}))),mWe=g.lazy(()=>pl(()=>import("./browser-page-BNpu-nAK.js"),__vite__mapDeps([23,1,2,4,5,6,7,11,12]),import.meta.url).then(e=>({default:e.BrowserPage}))),vWe=g.lazy(()=>pl(()=>import("./mesh-page--4HRhvVR.js"),__vite__mapDeps([24,1,2,4,5,6,7,14,11,12]),import.meta.url).then(e=>({default:e.MeshPage}))),xWe=g.lazy(()=>pl(()=>import("./settings-page-ph6qP9Ie.js"),__vite__mapDeps([25,1,2,4,5,6,7,14,26,15,10,20,9,17,11,12]),import.meta.url).then(e=>({default:e.SettingsPage}))),bWe=g.lazy(()=>pl(()=>import("./browser-webauthn-prompt-DJxesanQ.js"),__vite__mapDeps([27,1,2,4,5,6,7]),import.meta.url).then(e=>({default:e.BrowserWebauthnPrompt}))),wWe=()=>{hWe();const{pathname:e}=Dk(),t=e.startsWith("/chat")||e.startsWith("/browser"),{isOnboardingActive:n}=Ane(),{isLowCreditsDialogOpen:r,openRadientConsole:s,onLowCreditsDialogClose:i}=oWe(),{isCommandPaletteOpen:a,isCreateAgentDialogOpen:o,isSidebarCollapsed:l,closeCreateAgentDialog:c}=ct();uu(a,"command-palette"),uu(o,"create-agent-dialog"),uu(n,"onboarding"),uu(r,"low-credits");const d=di(),h=Zr(),f=Mt(h.data,"session_catalogue",2),p=Mt(h.data,"session_archive");g.useEffect(()=>{Ee.getState().requestArchiveConfirm(null)},[e]);const m=al(h.data,"peers"),v=y=>{Ee.getState().stageDraft({kind:"agent",name:y.name}),d("/chat"),c()};p7e(),lWe(),Koe();const x=Ee(y=>y.setActiveSession),b=Ee(y=>{const k=y.activeDraftKey?y.drafts[y.activeDraftKey]:void 0;return Nk(y.activeDraftKey,k?.sessionId,y.activeSessionId)}),w=ct(y=>y.setConsolePaneOpen),C=ct(y=>y.setBrowserPaneOpen),E=ct(y=>y.setConsoleActiveSurface);return g.useEffect(()=>{const y=window.api?.desktop?.onOpenConversation?.((k,_)=>{k!==null&&performance.mark("lop:open:requested"),x(k),_!==void 0&&k!==null&&(E(_),w(!0)),d("/chat")});return()=>y?.()},[d,x,w,E]),g.useEffect(()=>{const y=window.api?.console?.onReveal?.(k=>{k.mode!=="none"&&(k.mode==="session"&&k.session_id!==b||(k.mode==="open"&&x(k.session_id),E(k.surface),w(!0)))});return()=>y?.()},[b,x,w,E]),Pre(),BGe(),g.useEffect(()=>{const y=window.api?.browser?.onConsentAttention?.(k=>{const _=hre(k.requesterSessionId,Ee.getState().sessions);if(cre(k.entryId),_.kind==="browser"){d("/browser");return}x(_.sessionId),C(!0),d("/chat")});return()=>y?.()},[d,x,C]),g.useEffect(()=>{const y=k=>{n||f&&HGe(k)&&(k.preventDefault(),Ee.getState().stageDraft(void 0,!0),d("/chat"))};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[f,n,d]),u.jsx(RVe,{children:u.jsx("div",{className:"relative flex h-screen flex-col overflow-hidden","data-titlebar-sidebar-collapsed":l?"true":"false",children:u.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[a&&u.jsx(u7e,{}),u.jsx(UGe,{}),u.jsx(xK,{}),u.jsx(g7e,{enabled:m==="enabled"}),u.jsx(Q7e,{open:n}),u.jsx(AVe,{}),p&&u.jsx(Ore,{}),u.jsx(ere,{}),u.jsx(g.Suspense,{fallback:null,children:u.jsx(bWe,{})}),u.jsx(PVe,{open:r,onClose:i,onGoToConsole:s}),u.jsx(Nne,{open:o,onClose:c,onAgentCreated:v}),u.jsx(bK,{sidebar:u.jsx(iWe,{}),content:u.jsxs("main",{className:"flex grow flex-col overflow-hidden",children:[t?null:u.jsx("div",{"data-chrome-route-band":""}),u.jsx(g.Suspense,{fallback:u.jsx("div",{className:"flex grow items-center justify-center",children:u.jsx(Hn,{size:"lg",label:"Loading page"})}),children:u.jsxs(wK,{children:[u.jsx(Qs,{path:"/",element:u.jsx(V2,{to:"/chat",replace:!0})}),u.jsx(Qs,{path:"/chat",element:u.jsx(wO,{})}),u.jsx(Qs,{path:"/chat/:agentId",element:u.jsx(wO,{})}),u.jsx(Qs,{path:"/agents",element:u.jsx(pL,{})}),u.jsx(Qs,{path:"/agents/:agentId",element:u.jsx(pL,{})}),u.jsx(Qs,{path:"/settings",element:u.jsx(xWe,{})}),u.jsx(Qs,{path:"/agent-hub",element:u.jsx(pWe,{})}),u.jsx(Qs,{path:"/agent-hub/:agentId",element:u.jsx(fWe,{})}),u.jsx(Qs,{path:"/schedules",element:u.jsx(gWe,{})}),u.jsx(Qs,{path:"/projects",element:u.jsx(gL,{})}),u.jsx(Qs,{path:"/projects/:projectId",element:u.jsx(gL,{})}),u.jsx(Qs,{path:"/browser",element:u.jsx(mWe,{})}),m==="enabled"&&u.jsx(Qs,{path:"/mesh",element:u.jsx(vWe,{})}),u.jsx(Qs,{path:"*",element:u.jsx(V2,{to:"/chat",replace:!0})})]})})]})})]})})})};function cu(){return new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))})}const CWe=3,yWe=3e3;function SWe(e){return e instanceof CSSTransition&&e.playState==="running"}function EWe(e){const t=e.effect,n=t instanceof KeyframeEffect?t.target:null,r=e.transitionProperty,i=/^[a-z-]+$/.test(r)&&n instanceof Element?getComputedStyle(n).getPropertyValue(r).trim()||"(empty)":"(unreadable)";return`${r||"(unnamed property)"} on ${Im(n)??"an element no longer in the document"} = ${i}`}async function kWe(e=yWe){const t=performance.now();let n=0;for(;;){await cu();const r=Math.round(performance.now()-t),s=document.getAnimations().filter(SWe);if(n=s.length===0?n+1:0,n>=CWe)return{waitedMs:r,timedOut:!1,pending:[]};if(r>e)return{waitedMs:r,timedOut:!0,pending:s.map(EWe)}}}const _We=/^#/;function Ag(){const e=window.location.hash.replace(_We,"");return e===""?"/":e}function Im(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 TWe(e){const t=e.getBoundingClientRect(),n=t.left+t.width/2,r=t.top+t.height/2,s=document.elementFromPoint(n,r),i=s!==null&&(s===e||e.contains(s)),a=document.elementsFromPoint(n,r).slice(0,4).map(l=>Im(l)),o={bubbles:!0,cancelable:!0,composed:!0,button:0,buttons:1,clientX:n,clientY:r,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:Im(s),stack:a,disabled:e instanceof HTMLButtonElement?e.disabled:null,rect:{x:t.x,y:t.y,width:t.width,height:t.height}}}function Tp(e,t){if(typeof e!="string"||e==="")throw new Error(`${t} must be a non-empty string`);return e}async function RWe(e,t=1e4){const n=Date.now();for(;Ag()!==e;){if(Date.now()-n>t)throw new Error(`route did not become ${e} (it is ${Ag()})`);await new Promise(r=>setTimeout(r,50))}return await cu(),Ag()}const fk=["dev-driver","query-fetch-probe"];let Fg=null;function AWe(){if(Fg)return Fg;const e=[],t=W2.prototype.fetch;return W2.prototype.fetch=function(...r){return e.push({at:Date.now(),key:JSON.stringify(this.queryKey),stack:(new Error().stack??"").split(`
676
+ 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:()=>kVe("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(){cL("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(()=>{cL("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()}}]}],_Ve=()=>{const e=di(),{completeTourOnboarding:t}=Dg(),n=g.useContext(Lw),r={cancelIcon:{enabled:!0},scrollTo:{behavior:"smooth",block:"center"}},s=!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=Dg.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 c=n?.Shepherd;if(!l&&c&&(l=c.activeTour,!l&&c.Tour&&(console.log("No active Shepherd tour found from context or global. Creating a new one."),l=new c.Tour({useModalOverlay:s,defaultStepOptions:r}))),!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||{},...r},l.options.useModalOverlay=s,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(uL)}else l.steps.length===0&&l.addSteps(uL);typeof l.start=="function"?(e("/"),l.start()):console.warn("Shepherd tour instance does not have a start method.",l)}}},TVe=()=>{const{isModalComplete:e,isTourComplete:t}=Dg(),{startTour:n}=_Ve(),r=He.useContext(Lw),{data:s}=DS(1,1);return g.useEffect(()=>{if(e&&!t&&r){const i=setTimeout(()=>{const a=s?.agents?.[0]?.id;n({firstAgentId:a})},500);return()=>clearTimeout(i)}},[e,t,r,n,s]),null},RVe=({children:e})=>u.jsxs(mVe,{children:[e,u.jsx(TVe,{})]}),AVe=()=>{const{open:e,focusGroup:t,providerId:n,closeConnect:r}=f3(),s=di();return u.jsx(bf,{open:e,onOpenChange:i=>{i||r()},children:u.jsxs(wf,{className:"max-h-[calc(100vh-4rem)] max-w-[min(40rem,calc(100vw-4rem))] gap-4 overflow-y-auto","data-connect-provider-dialog":"",children:[u.jsxs("div",{className:"flex flex-col gap-1",children:[u.jsx(Uu,{className:"text-title",children:"Connect a model provider"}),u.jsx($m,{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?u.jsx(X7,{context:"dialog",featuredOnly:!0,focusGroup:t,initialProviderId:n,onDone:r,onChangeModel:()=>{r(),s("/settings")}}):null]})})},FVe=""+new URL("radient-icon-1024x1024-D_JJedvo.png",import.meta.url).href,x9={all:["radient-prices"],prices:()=>[...x9.all,"prices"]},DVe=()=>{const e=Qr({queryKey:x9.prices(),queryFn:()=>b3({operation:"prices"}),staleTime:36e5,refetchOnWindowFocus:!1,refetchOnMount:!0,refetchInterval:!1,retry:3});return{prices:e.data,isLoading:e.isLoading,isFetching:e.isFetching,error:e.error,pricesQuery:e}},b9=$b()(MY(e=>({hasBeenNotified:!1,setHasBeenNotified:t=>{e({hasBeenNotified:t})}}),{name:"low-credits-storage"})),PVe=({open:e,onClose:t,onGoToConsole:n})=>{const{setHasBeenNotified:r}=b9(),{prices:s,isLoading:i,error:a}=DVe(),o=d=>typeof d!="number"?"$...":`$${d.toFixed(2)} USD`,l=()=>{r(!0),t()},c=()=>{r(!0),n()};return u.jsx(Sc,{open:e,onClose:l,title:u.jsxs(u.Fragment,{children:[u.jsx("img",{src:FVe,alt:"Radient icon",className:"size-7"}),"Running low on Radient credits?"]}),maxWidth:"sm",fullWidth:!1,actions:u.jsxs(u.Fragment,{children:[u.jsx(Nm,{onClick:l,children:"Maybe later"}),u.jsx(Mm,{onClick:c,startIcon:u.jsx(xu,{size:18}),className:"min-w-55",children:"Get more credits"})]}),children:u.jsxs("div",{className:"flex flex-col items-center gap-4 py-2 text-center",children:[u.jsxs("p",{className:"text-body-sm text-ink-muted",children:["Unlock the full power of Local Operator with"," ",u.jsx("span",{className:"font-bold text-accent",children:"Radient Pass"}),"."]}),u.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."}),u.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."}),u.jsxs("p",{className:"text-body-sm text-ink-muted",children:["Plus, get"," ",u.jsx("span",{className:"font-medium text-ink",children:i?u.jsx(Hn,{size:"sm",className:"mr-0.5 align-middle"}):o(s?.default_registration_credits)})," ","in bonus credits with your first purchase.",a&&u.jsx("span",{className:"mt-1 block text-meta text-danger",children:"Could not load bonus credit information."})]}),u.jsx("p",{className:"text-meta text-ink-dim",children:"You can also reach the Radient Console from Settings at any time."})]})})},IVe=(e,t)=>t?Ay(e.filter(n=>n.session_id===t)).length:0;function NVe(e){return Ee(t=>IVe(t.sessions,e))}const MVe=(e,t)=>t?e.some(n=>n.session_id===t&&n.status?.code==="busy"):!1;function OVe(e){return Ee(t=>MVe(t.sessions,e))}const LVe=[];function BVe(){const{state:e}=Zb(),t=e?.pendingConsent??LVe,n=LB(r=>dD(t,r));return g.useEffect(()=>{t.length>0&&m_()},[t]),dD(t,n)}const w9={approvals:["desktop","mesh","approvals"]},jVe=15e3,HVe=new Set(["requested","approved","connecting","failed"]);function UVe(e){return HVe.has(e)}function GVe(e){return e==="requested"}function $Ve(e){return e.filter(t=>GVe(t.state)).length}function Qze(e){return e==="requested"}function Jze(e){return UVe(e)}function Zze(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 vu(e){return typeof e=="object"&&e!==null}function VVe(e){const t=vu(e)?e:{};return{deviceId:kt(t.device_id),name:kt(t.name),host:kt(t.host),user:kt(t.user),transport:kt(t.transport),hostKeyFp:kt(t.host_key_fp)}}function WVe(e){const t=vu(e)?e:{};return{connect:go(t.connect,!1),install:go(t.install,!1),anchor:vu(t.anchor),networkId:kt(t.network_id),role:kt(t.role),unattended:go(t.unattended,!1),grants:Qh(t.grant)}}function zVe(e){const t=Array.isArray(e)?e:e?.approvals??[];if(!Array.isArray(t))return[];const n=[];for(const r of t){if(!vu(r))continue;const s=kt(r.approval_id),i=kt(r.state);if(!s||!i)continue;const a=!vu(r.device)&&vu(r.machine)?"machine":"device",o=vu(r.requested_by)?r.requested_by:{};n.push({approvalId:s,state:i,kind:a,where:VVe(a==="machine"?r.machine:r.device),what:WVe(r.what),requestedBy:{surface:kt(o.surface),sessionId:kt(o.session_id),deviceId:kt(o.device_id)},expiresAt:Ql(r.expires_at)})}return n}function qVe(e){return e.kind==="machine"?"this machine":YB({device_id:e.where.deviceId,name:e.where.name})}function eqe(e,t){const n=KVe(e),r=XVe(e,t).map(s=>s.clause);return r.length?`${n}: ${YVe(r)}.`:`${n}.`}function KVe(e){return e.kind==="machine"?"Set up operator authority on this machine":`Onboard ${qVe(e)}`}function YVe(e){return e.length===1?e[0]:`${e.slice(0,-1).join(", ")}; ${e[e.length-1]}`}function tqe(e){const{user:t,host:n,transport:r,name:s}=e.where,i=[n?t?`${t}@${n}`:n:"",r?`via ${r}`:"",s&&s!==n?`(${s})`:""].filter(Boolean);return i.length?i.join(" "):null}function nqe(e){return e.where.hostKeyFp||null}function rqe(e){const{surface:t,sessionId:n}=e.requestedBy,r=[t||"",n?`session ${n.slice(-6)}`:""].filter(Boolean);return r.length?`asked by ${r.join(" · ")}`:null}function XVe(e,t){const{connect:n,install:r,anchor:s,networkId:i,role:a,unattended:o,grants:l}=e.what,c=[];if(n&&c.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"}),r&&c.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"}),s&&c.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||"?"}`;c.push({term:h,clause:h,consequence:`it joins ${d||i} as ${a||"?"}`})}o&&c.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 QVe(l,o)){const h=JVe[d];c.push({term:h?.term??`grant ${d}`,clause:ZVe[d]??`use the ${d} capability`,consequence:h?.gloss??`you may ${d} on that device`})}return c}function QVe(e,t){const n=new Set;for(const r of e){const s=String(r??"").trim();s&&(t&&s==="unattended"||n.add(s))}return[...n]}const JVe={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"}},ZVe={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 sqe(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 r=Math.ceil(n/60);if(r<90)return r===1?"expires in 1 minute":`expires in ${r} minutes`;const s=Math.ceil(r/60);return s===1?"expires in 1 hour":`expires in ${s} hours`}function eWe(e,{poll:t=!0}={}){return Qr({queryKey:w9.approvals,enabled:e,queryFn:async()=>zVe(await At({op:"approvals.list"})),retry:!1,staleTime:t?1e4:Number.POSITIVE_INFINITY,refetchInterval:e&&t?jVe:!1,refetchOnWindowFocus:t})}function iqe(){const e=Qn();return Fs({mutationFn:async t=>{const n=t.decision==="approve"?{op:"approvals.approve",approvalId:t.approvalId}:{op:"approvals.deny",approvalId:t.approvalId};await At(n)},onSettled:()=>{e.invalidateQueries({queryKey:w9.approvals}),e.invalidateQueries({queryKey:ll.networks}),e.invalidateQueries({queryKey:ll.peers})}})}function aqe(e){const t=e?.message;return typeof t=="string"&&t.trim()?t.trim():"The approvals could not be read."}function oqe(e){const t=e;return{code:kt(t?.code)||"approval_refused",sentence:kt(t?.message)||"The decision could not be answered."}}const dL=e=>{const t=gK(e.type),n=typeof e.percent=="number"?`, ${Math.round(e.percent)}%`:"";return`${t} in progress${n}.`},C9=e=>pK({type:e.type,version:e.offer.version}),tWe=e=>`${e.map(r=>C9(r)).map((r,s)=>s===0?r:`${r.charAt(0).toLowerCase()}${r.slice(1)}`).join(" and ")} available. Show the update notice.`,nWe=({surfaces:e,inflight:t,onShow:n,onDismiss:r})=>{if(t===null&&e.length===0)return null;if(t!==null)return u.jsx(Je,{side:"top",collisionPadding:8,content:dL(t),children:u.jsx("output",{"data-update-foot-icon":"","data-update-foot-icon-state":"inflight","aria-label":dL(t),className:"flex size-8 shrink-0 items-center justify-center text-accent",children:u.jsx(Na,{className:"size-4 shrink-0 motion-safe:animate-spin","aria-hidden":"true"})})});const s=e.find(i=>(i.offer.summary??"").trim()!=="");return u.jsx(Je,{side:"top",collisionPadding:8,content:u.jsxs("div",{className:"flex max-w-64 flex-col gap-0.5",children:[e.map(i=>u.jsxs("span",{className:"truncate text-ink",children:[C9(i)," available"]},i.type)),s?u.jsx("span",{className:"truncate text-ink-muted",children:(s.offer.summary??"").trim()}):null,u.jsx("span",{className:"whitespace-nowrap text-ink-muted",children:"Show the update notice."})]}),children:u.jsx("button",{type:"button","data-update-foot-icon":"","data-update-foot-icon-state":"available","aria-label":tWe(e),onClick:n,onKeyDown:i=>{i.key!=="Escape"||!r||(i.stopPropagation(),r())},className:T("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:u.jsx(KL,{className:"size-4 shrink-0","aria-hidden":"true"})})})},hL=()=>{const e=Vr(p=>p.followed),t=Vr(p=>p.running),n=Vr(p=>p.offers),r=Vr(p=>p.detailOpen),s=Vr(p=>p.inflight),i=Vr(p=>p.downloadPercent),a=Vr(p=>p.openNotice),o=Vr(p=>p.noticeOpen),l=Vr(p=>p.dismissNotice),c=g.useMemo(()=>{const p={followed:e,running:t,offers:n,detailOpen:r};return bL.filter(m=>fK(p,m)).map(m=>{const v=n[m];return v?{type:m,offer:v}:null}).filter(m=>m!==null)},[e,t,n,r]),d=g.useMemo(()=>s[an.BACKEND]?{type:an.BACKEND,percent:null}:s[an.UI]?{type:an.UI,percent:i[an.UI]}:null,[s,i]),h=g.useCallback(()=>a(),[a]),f=g.useCallback(()=>l(),[l]);return u.jsx(nWe,{surfaces:c,inflight:d,onShow:h,onDismiss:o?f:void 0})},fL=({expanded:e})=>u.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[u.jsx(mK,{className:"size-6",label:e?void 0:"Local Operator"}),e&&u.jsx("span",{className:"truncate font-semibold text-body text-ink",children:"Local Operator"})]}),hk=He.memo(({expanded:e,useAuth:t=!1})=>{const n=di(),{user:r,isAuthenticated:s,accountRead:i,signOut:a}=w3(),o=i==="checking"?"Checking account…":$2(i)?"Account unavailable":null,l=r?.name??o??"User",c=$2(i),d=r?.email??"",h=c?"Reconnect Radient":d,f=c?"/settings?section=providers&provider=radient":"/settings",p=c?"Reconnect Radient":"Account settings",m=g.useCallback(async()=>{s&&(await a(),window.location.reload())},[s,a]),v=g.useMemo(()=>{const w=r?.name;return w?w.split(" ").map(C=>C.charAt(0)).join("").toUpperCase().substring(0,2):null},[r?.name]),x=u.jsxs("button",{type:"button",onClick:t?void 0:()=>n(f),"aria-label":e?void 0:p,className:T("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:[u.jsx(R3,{className:"size-7 shrink-0",children:u.jsx(A3,{className:"border border-control bg-elevated text-ink",children:v??u.jsx(Pee,{size:14,"aria-hidden":"true"})})}),e&&l&&u.jsxs("span",{className:"min-w-0 text-left",children:[u.jsx("span",{className:"block truncate text-body-sm text-ink",children:l}),h&&u.jsx("span",{className:T("block truncate text-meta",c?"text-accent":"text-ink-dim"),children:h})]})]}),b=e?x:u.jsx(Je,{content:p,side:"right",children:x});return t?u.jsxs(kc,{children:[e?u.jsx(ol,{asChild:!0,children:x}):u.jsx(Je,{content:p,side:"right",children:u.jsx(ol,{asChild:!0,children:x})}),u.jsxs(_c,{align:"end",side:"top",className:"min-w-50",children:[c?u.jsxs(tn,{onSelect:()=>n(f),children:[u.jsx(Uk,{size:16,"aria-hidden":"true"}),"Reconnect Radient"]}):null,u.jsxs(tn,{onSelect:()=>n("/settings"),children:[u.jsx(Xl,{size:16,"aria-hidden":"true"}),"Settings"]}),u.jsxs(tn,{children:[u.jsx(eee,{size:16,"aria-hidden":"true"}),"Privacy and security"]}),u.jsx(Ei,{}),u.jsxs(tn,{onSelect:m,className:"text-danger focus:bg-danger-wash focus:text-danger",children:[u.jsx(wZ,{size:16,"aria-hidden":"true"}),"Sign out"]})]})]}):b});hk.displayName="UserProfileSidebar";const rWe=()=>{const e=YL(),t=Zr(),n=Ee(o=>o.setCataloguePageable),r=Ee(o=>o.fetchSessions),s=Mt(t.data,"session_catalogue_page");g.useEffect(()=>{n(s)},[s,n]);const i=al(t.data,"session_catalogue",2)==="enabled",a=g.useCallback(()=>r(s?QL:Nb,s),[r,s]);return g.useEffect(()=>{i&&a()},[i,a,e.catalogueRevision]),null},sWe="flex h-[30px] w-full items-center gap-2 rounded-md px-2 text-body-sm transition-colors duration-fast ease-out-quart",iWe=()=>{const e=di(),t=Dne(),{expanded:n,mode:r,onCollapse:s}=vK(),i=ct(te=>te.openCommandPalette),a=Zr(),o=Ee(te=>te.activeSessionId),l=BVe(),c=al(a.data,"peers")==="enabled",d=C_(c),h=al(a.data,"approvals")==="enabled",f=eWe(d==="member"&&h,{poll:!0}),p=$Ve(f.data??[]),m=Mt(a.data,"projects",1),v=Mt(a.data,"aida",1),x=wR(v),b=v&&x.data?.enabled===!0,w=x.data?.name??"Aida",C=wGe(),E=NVe(x.data?.session_id),y=OVe(x.data?.session_id),k=()=>{C(e,x.data).catch(te=>Zt($d(te)))},_=[...b?[{icon:RJ,label:w,path:"/chat",isActive:t==="chat"&&!!x.data?.session_id&&o===x.data?.session_id,tourTag:"nav-item-aida",onSelect:k,attention:E,attentionTag:"nav-aida-badge",attentionName:te=>`${w}, ${te} missed message${te===1?"":"s"}`,working:y,workingName:`${w}, working`}]:[],{icon:fc,label:"Agents",path:"/agents",isActive:t==="agents",tourTag:"nav-item-agents"},...m?[{icon:q4,label:"Projects",path:"/projects",isActive:t==="projects",tourTag:"nav-item-projects"}]:[],{icon:z4,label:"Schedules",path:"/schedules",isActive:t==="schedules",tourTag:"nav-item-schedules"},{icon:Bu,label:"Browser",path:"/browser",isActive:t==="browser",tourTag:"nav-item-browser",attention:l,attentionTag:"nav-browser-badge",attentionName:te=>`Browser, ${te} waiting`},{icon:eB,label:"Agent hub",path:"/agent-hub",isActive:t==="agent-hub",tourTag:"nav-item-agent-hub"},...d==="member"?[{icon:h3,label:"Mesh",path:"/mesh",isActive:t==="mesh",tourTag:"nav-item-mesh",attention:p,attentionTag:"nav-mesh-badge",attentionName:te=>`Mesh, ${te} waiting`}]:[]],I=u.jsx(wHe,{selectedConversation:o??void 0,onSelectConversation:te=>void zm(e,te),onStageDraft:(te,Q)=>{Ee.getState().stageDraft(te,Q),e("/chat")}}),A=te=>{const Q=te.attention??0,ce=Q>0&&te.attentionName?te.attentionName(Q):te.label;return te.working&&te.workingName?te.workingName:ce},P=te=>{const Q=te.attention??0,ce=A(te),B=te.isActive?ya:"text-ink-muted hover:bg-row-hover hover:text-ink";return u.jsx("li",{className:T("flex h-[30px] w-full items-center rounded-md","transition-colors duration-fast ease-out-quart",B),children:u.jsxs("button",{type:"button",onClick:()=>te.onSelect?te.onSelect():e(te.path),"data-tour-tag":te.tourTag,"aria-current":te.isActive?"page":void 0,"aria-label":n&&ce===te.label?void 0:ce,className:T("flex h-full min-w-0 flex-1 items-center gap-2 rounded-md",n?"px-2":"justify-center px-0"),children:[u.jsx(te.icon,{size:16,"aria-hidden":"true",className:T("shrink-0",te.isActive&&"text-accent")}),n&&u.jsx("span",{className:"truncate",children:te.label}),Q>0&&u.jsx("span",{className:T(n&&"ml-auto","inline-flex"),children:u.jsx(Cu,{variant:"attentionQuiet",shape:"pill",size:"count","data-tour-tag":te.attentionTag,children:Q})}),te.working&&u.jsx("span",{className:T(n&&"ml-auto","inline-flex"),children:u.jsx(Na,{size:16,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})})]})},te.tourTag)},N=te=>n?P(te):u.jsx("li",{children:u.jsx(Je,{content:A(te),side:"right",children:P(te)})},te.tourTag),F=r==="overlay"?"Close sidebar":n?"Collapse sidebar":"Expand sidebar",j=r==="overlay"?Un:n?zh:xo,q=navigator.platform.toUpperCase().indexOf("MAC")>=0,L=Mt(a.data,"session_catalogue",2),ie=Ee(te=>te.activeDraftKey),Z=Ee(te=>te.drafts),J=!!ie&&!(ie?Z[ie]:void 0)?.target,U=()=>{Ee.getState().stageDraft(void 0,!0),e("/chat")},ne=`New chat (${yO(q).replace("+","")})`,re=`Search (${io("everything",q)}) — chats (${io("chats",q)})`,D=`Search everything (${io("everything",q)}) · your chats (${io("chats",q)})`,H=(te,Q,ce,B)=>{const ye=te;return u.jsxs("button",{type:"button",...B.attrs,onClick:B.onClick,disabled:B.disabled,"aria-label":B.ariaLabel,"aria-current":B.current?"page":void 0,className:T(sWe,B.current?ya:"text-ink-muted hover:bg-row-hover hover:text-ink","disabled:text-ink-disabled disabled:hover:bg-transparent"),children:[u.jsx(ye,{size:16,"aria-hidden":"true",className:"shrink-0"}),u.jsx("span",{className:"truncate",children:Q}),u.jsx("span",{"aria-hidden":"true",className:"ml-auto",children:u.jsx(Cs,{shortcut:ce,joined:!0})})]})},M=H(AS,"New chat",yO(q),{onClick:U,ariaLabel:ne,current:J,disabled:!L,attrs:{"data-tour-tag":"nav-item-chat","data-new-chat-row":""}}),Y=H(Hu,"Search",KGe("everything",q),{onClick:i,ariaLabel:re,attrs:{"data-command-palette-trigger":"",title:D}}),ee=(te,Q,ce)=>{const B=te;return u.jsx(Je,{content:Q,side:"right",children:u.jsx("button",{type:"button",...ce.attrs,onClick:ce.onClick,disabled:ce.disabled,"aria-label":Q,className:T("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:u.jsx(B,{size:16,"aria-hidden":"true"})})})},ae=u.jsx("div",{className:T(r!=="overlay"&&T("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:u.jsx(Je,{content:F,side:"right",children:u.jsx(ue,{variant:"ghost",size:"icon-sm",onClick:s,"aria-label":F,"aria-expanded":r==="overlay"?void 0:n,"aria-keyshortcuts":hA(q),children:u.jsx(j,{"aria-hidden":"true"})})})}),le=u.jsx(Je,{content:"Settings",side:"top",children:u.jsx("button",{type:"button","data-tour-tag":"nav-item-settings",onClick:()=>e("/settings"),"aria-current":t==="settings"?"page":void 0,"aria-label":"Settings",className:T("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:u.jsx(Xl,{size:16,"aria-hidden":"true"})})});return n?u.jsxs("div",{"data-sidebar-shell":"",className:"group/sidebar flex h-full min-h-0 flex-col overflow-hidden bg-surface",children:[u.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 pr-2 pl-4",children:[u.jsx(fL,{expanded:!0}),u.jsx("span",{className:"ml-auto",children:ae})]}),u.jsxs("div",{className:"flex shrink-0 flex-col gap-2 px-2 pb-2",children:[u.jsxs("div",{className:"flex flex-col gap-0.5",children:[M,Y]}),u.jsx("ul",{className:"flex flex-col gap-0.5",children:_.map(N)})]}),u.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:I}),u.jsxs("div",{className:"flex min-h-10 shrink-0 items-center justify-between gap-1 px-2 pb-2",children:[u.jsx(hk,{expanded:!0}),u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsx(hL,{}),le]})]})]}):u.jsxs("div",{"data-sidebar-strip":"",className:"group/sidebar flex h-full min-h-0 flex-col items-center bg-surface",children:[u.jsx(rWe,{}),u.jsx("div",{className:"flex h-10 shrink-0 items-center justify-center",children:u.jsx(fL,{expanded:!1})}),u.jsxs("ul",{className:"flex flex-col items-center gap-1",children:[u.jsx("li",{children:ee(xo,F,{onClick:s,attrs:{"aria-expanded":!1,"aria-keyshortcuts":hA(q)}})}),u.jsx("li",{children:ee(AS,ne,{onClick:U,disabled:!L,attrs:{"data-tour-tag":"nav-item-chat"}})}),u.jsx("li",{children:ee(Hu,re,{onClick:i,attrs:{"data-command-palette-trigger":""}})})]}),u.jsx("ul",{className:"mt-4 flex flex-col items-center gap-1",children:_.map(N)}),u.jsxs("div",{className:"mt-auto flex flex-col items-center gap-1 pb-2",children:[u.jsx(hL,{}),le,u.jsx(hk,{expanded:!1})]})]})},aWe=1,oWe=()=>{const{isAuthenticated:e,user:t}=w3(),{hasBeenNotified:n,setHasBeenNotified:r}=b9(),[s,i]=g.useState(!1),[a,o]=g.useState(null),l=g.useCallback(async()=>{if(!(!e||!t?.radientUser?.account?.tenant_id))try{const f=await b3({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<aWe?n||i(!0):(i(!1),n&&r(!1)):i(!1)},[e,n,a,r]),{isLowCreditsDialogOpen:s,openRadientConsole:()=>{window.api?.openExternal?window.api.openExternal("https://console.radienthq.com"):window.open("https://console.radienthq.com","_blank"),r(!0),i(!1)},closeLowCreditsDialog:()=>{i(!1)},onLowCreditsDialogClose:()=>{r(!0),i(!1)},currentCredits:a}};function lWe(){const e=di();g.useEffect(()=>{const t=s=>{e(s==="back"?-1:1)},n=s=>{const i=Poe(s);i&&(s.preventDefault(),t(i))},r=s=>{const i=Ioe(s);i&&(s.preventDefault(),t(i))};return window.addEventListener("keydown",n),window.addEventListener("mouseup",r),()=>{window.removeEventListener("keydown",n),window.removeEventListener("mouseup",r)}},[e])}function cWe(){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 uWe(e,t,n){const r=document.documentElement;if(t==="mac"){r.dataset.chromeLeading="true",r.dataset.chromeTrailing="false";return}if(e===null){r.dataset.chromeLeading="false",r.dataset.chromeTrailing="false";return}r.dataset.chromeLeading=e.x<=1?"true":"false",r.dataset.chromeTrailing=Math.abs(e.x+e.width-n)<=1?"true":"false"}function dWe(e){const t=window.api?.windowChrome;if(!t)return;const n=getComputedStyle(document.documentElement),r=n.getPropertyValue("--lo-canvas").trim(),s=n.getPropertyValue("--lo-ink-muted").trim(),i=n.getPropertyValue("--lo-ink-dim").trim();!r||!s||!i||t.report({themeId:e,colors:{ground:r,symbol:s,symbolInactive:i}})}function hWe(){g.useLayoutEffect(()=>{if(!window.api?.windowChrome)return;const t=document.documentElement.dataset.chromePlatform??"linux",n=()=>uWe(cWe(),t,window.innerWidth);n();const r=navigator.windowControlsOverlay;return r?.addEventListener?.("geometrychange",n),window.addEventListener("resize",n),()=>{r?.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 fWe=g.lazy(()=>pl(()=>import("./agent-details-page-Bwm-2oEG.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]),import.meta.url).then(e=>({default:e.AgentDetailsPage}))),pWe=g.lazy(()=>pl(()=>import("./agent-hub-page-C1EpDhw3.js"),__vite__mapDeps([13,1,2,4,5,6,7,14,3,8,9,10,15,16,17,11,12]),import.meta.url).then(e=>({default:e.AgentHubPage}))),pL=g.lazy(()=>pl(()=>import("./agents-page-PK39vXwB.js"),__vite__mapDeps([18,4,5,1,2,6,7,11,12]),import.meta.url).then(e=>({default:e.AgentsPage}))),gWe=g.lazy(()=>pl(()=>import("./schedules-page-4Pa4fKXg.js"),__vite__mapDeps([19,1,2,14,6,4,5,7,17,9,20,11,12]),import.meta.url).then(e=>({default:e.SchedulesPage}))),gL=g.lazy(()=>pl(()=>import("./projects-page-DIUM-rpH.js"),__vite__mapDeps([21,1,2,4,5,6,7,14,22,11,12]),import.meta.url).then(e=>({default:e.ProjectsPage}))),mWe=g.lazy(()=>pl(()=>import("./browser-page-XHmhbk6T.js"),__vite__mapDeps([23,1,2,4,5,6,7,11,12]),import.meta.url).then(e=>({default:e.BrowserPage}))),vWe=g.lazy(()=>pl(()=>import("./mesh-page-ZyHoot0F.js"),__vite__mapDeps([24,1,2,4,5,6,7,14,11,12]),import.meta.url).then(e=>({default:e.MeshPage}))),xWe=g.lazy(()=>pl(()=>import("./settings-page-6xA1GAGZ.js"),__vite__mapDeps([25,1,2,4,5,6,7,14,26,15,10,20,9,17,11,12]),import.meta.url).then(e=>({default:e.SettingsPage}))),bWe=g.lazy(()=>pl(()=>import("./browser-webauthn-prompt-BCVm2Nam.js"),__vite__mapDeps([27,1,2,4,5,6,7]),import.meta.url).then(e=>({default:e.BrowserWebauthnPrompt}))),wWe=()=>{hWe();const{pathname:e}=Dk(),t=e.startsWith("/chat")||e.startsWith("/browser"),{isOnboardingActive:n}=Ane(),{isLowCreditsDialogOpen:r,openRadientConsole:s,onLowCreditsDialogClose:i}=oWe(),{isCommandPaletteOpen:a,isCreateAgentDialogOpen:o,isSidebarCollapsed:l,closeCreateAgentDialog:c}=ct();uu(a,"command-palette"),uu(o,"create-agent-dialog"),uu(n,"onboarding"),uu(r,"low-credits");const d=di(),h=Zr(),f=Mt(h.data,"session_catalogue",2),p=Mt(h.data,"session_archive");g.useEffect(()=>{Ee.getState().requestArchiveConfirm(null)},[e]);const m=al(h.data,"peers"),v=y=>{Ee.getState().stageDraft({kind:"agent",name:y.name}),d("/chat"),c()};p7e(),lWe(),Koe();const x=Ee(y=>y.setActiveSession),b=Ee(y=>{const k=y.activeDraftKey?y.drafts[y.activeDraftKey]:void 0;return Nk(y.activeDraftKey,k?.sessionId,y.activeSessionId)}),w=ct(y=>y.setConsolePaneOpen),C=ct(y=>y.setBrowserPaneOpen),E=ct(y=>y.setConsoleActiveSurface);return g.useEffect(()=>{const y=window.api?.desktop?.onOpenConversation?.((k,_)=>{k!==null&&performance.mark("lop:open:requested"),x(k),_!==void 0&&k!==null&&(E(_),w(!0)),d("/chat")});return()=>y?.()},[d,x,w,E]),g.useEffect(()=>{const y=window.api?.console?.onReveal?.(k=>{k.mode!=="none"&&(k.mode==="session"&&k.session_id!==b||(k.mode==="open"&&x(k.session_id),E(k.surface),w(!0)))});return()=>y?.()},[b,x,w,E]),Pre(),BGe(),g.useEffect(()=>{const y=window.api?.browser?.onConsentAttention?.(k=>{const _=hre(k.requesterSessionId,Ee.getState().sessions);if(cre(k.entryId),_.kind==="browser"){d("/browser");return}x(_.sessionId),C(!0),d("/chat")});return()=>y?.()},[d,x,C]),g.useEffect(()=>{const y=k=>{n||f&&HGe(k)&&(k.preventDefault(),Ee.getState().stageDraft(void 0,!0),d("/chat"))};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[f,n,d]),u.jsx(RVe,{children:u.jsx("div",{className:"relative flex h-screen flex-col overflow-hidden","data-titlebar-sidebar-collapsed":l?"true":"false",children:u.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[a&&u.jsx(u7e,{}),u.jsx(UGe,{}),u.jsx(xK,{}),u.jsx(g7e,{enabled:m==="enabled"}),u.jsx(Q7e,{open:n}),u.jsx(AVe,{}),p&&u.jsx(Ore,{}),u.jsx(ere,{}),u.jsx(g.Suspense,{fallback:null,children:u.jsx(bWe,{})}),u.jsx(PVe,{open:r,onClose:i,onGoToConsole:s}),u.jsx(Nne,{open:o,onClose:c,onAgentCreated:v}),u.jsx(bK,{sidebar:u.jsx(iWe,{}),content:u.jsxs("main",{className:"flex grow flex-col overflow-hidden",children:[t?null:u.jsx("div",{"data-chrome-route-band":""}),u.jsx(g.Suspense,{fallback:u.jsx("div",{className:"flex grow items-center justify-center",children:u.jsx(Hn,{size:"lg",label:"Loading page"})}),children:u.jsxs(wK,{children:[u.jsx(Qs,{path:"/",element:u.jsx(V2,{to:"/chat",replace:!0})}),u.jsx(Qs,{path:"/chat",element:u.jsx(wO,{})}),u.jsx(Qs,{path:"/chat/:agentId",element:u.jsx(wO,{})}),u.jsx(Qs,{path:"/agents",element:u.jsx(pL,{})}),u.jsx(Qs,{path:"/agents/:agentId",element:u.jsx(pL,{})}),u.jsx(Qs,{path:"/settings",element:u.jsx(xWe,{})}),u.jsx(Qs,{path:"/agent-hub",element:u.jsx(pWe,{})}),u.jsx(Qs,{path:"/agent-hub/:agentId",element:u.jsx(fWe,{})}),u.jsx(Qs,{path:"/schedules",element:u.jsx(gWe,{})}),u.jsx(Qs,{path:"/projects",element:u.jsx(gL,{})}),u.jsx(Qs,{path:"/projects/:projectId",element:u.jsx(gL,{})}),u.jsx(Qs,{path:"/browser",element:u.jsx(mWe,{})}),m==="enabled"&&u.jsx(Qs,{path:"/mesh",element:u.jsx(vWe,{})}),u.jsx(Qs,{path:"*",element:u.jsx(V2,{to:"/chat",replace:!0})})]})})]})})]})})})};function cu(){return new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))})}const CWe=3,yWe=3e3;function SWe(e){return e instanceof CSSTransition&&e.playState==="running"}function EWe(e){const t=e.effect,n=t instanceof KeyframeEffect?t.target:null,r=e.transitionProperty,i=/^[a-z-]+$/.test(r)&&n instanceof Element?getComputedStyle(n).getPropertyValue(r).trim()||"(empty)":"(unreadable)";return`${r||"(unnamed property)"} on ${Im(n)??"an element no longer in the document"} = ${i}`}async function kWe(e=yWe){const t=performance.now();let n=0;for(;;){await cu();const r=Math.round(performance.now()-t),s=document.getAnimations().filter(SWe);if(n=s.length===0?n+1:0,n>=CWe)return{waitedMs:r,timedOut:!1,pending:[]};if(r>e)return{waitedMs:r,timedOut:!0,pending:s.map(EWe)}}}const _We=/^#/;function Ag(){const e=window.location.hash.replace(_We,"");return e===""?"/":e}function Im(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 TWe(e){const t=e.getBoundingClientRect(),n=t.left+t.width/2,r=t.top+t.height/2,s=document.elementFromPoint(n,r),i=s!==null&&(s===e||e.contains(s)),a=document.elementsFromPoint(n,r).slice(0,4).map(l=>Im(l)),o={bubbles:!0,cancelable:!0,composed:!0,button:0,buttons:1,clientX:n,clientY:r,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:Im(s),stack:a,disabled:e instanceof HTMLButtonElement?e.disabled:null,rect:{x:t.x,y:t.y,width:t.width,height:t.height}}}function Tp(e,t){if(typeof e!="string"||e==="")throw new Error(`${t} must be a non-empty string`);return e}async function RWe(e,t=1e4){const n=Date.now();for(;Ag()!==e;){if(Date.now()-n>t)throw new Error(`route did not become ${e} (it is ${Ag()})`);await new Promise(r=>setTimeout(r,50))}return await cu(),Ag()}const fk=["dev-driver","query-fetch-probe"];let Fg=null;function AWe(){if(Fg)return Fg;const e=[],t=W2.prototype.fetch;return W2.prototype.fetch=function(...r){return e.push({at:Date.now(),key:JSON.stringify(this.queryKey),stack:(new Error().stack??"").split(`
677
677
  `).slice(2).join(" | ")}),t.apply(this,r)},Fg=e,e}function FWe(e){const t=Fg??[],n=JSON.stringify(fk),r=t.filter(i=>i.key!==n&&(e===void 0||i.key.includes(e))),s=new Map;for(const i of r){const a=s.get(i.stack)??{key:i.key,count:0,firstAt:i.at,lastAt:i.at};a.count+=1,a.lastAt=i.at,s.set(i.stack,a)}return{armed:Fg!==null,total:r.length,probeRecords:t.filter(i=>i.key===n).length,callers:[...s.entries()].map(([i,a])=>({stack:i,...a})).sort((i,a)=>i.firstAt-a.firstAt)}}function DWe(){const e=window.__loDevDriver;return e?.armed?e.install({hello:()=>({armed:!0,outDir:e.outDir,title:document.title,route:Ag(),href:window.location.href,theme:ct.getState().themeName,viewport:{width:window.innerWidth,height:window.innerHeight,devicePixelRatio:window.devicePixelRatio},visibilityState:document.visibilityState,hasFocus:document.hasFocus(),apiBaseUrl:Jr.baseUrl,userAgent:navigator.userAgent}),state:()=>{const t=ct.getState(),n=Ee.getState();return{route:Ag(),theme:t.themeName,commandPaletteOpen:t.isCommandPaletteOpen,canvasOpen:t.isCanvasOpen,runPanelOpen:t.isRunPanelOpen,browserPaneOpen:t.isBrowserPaneOpen,rightSlotWidth:t.rightSlotWidth,activeSessionId:n.activeSessionId,activeDraftKey:n.activeDraftKey,drafts:Object.fromEntries(Object.entries(n.drafts).map(([r,s])=>[r,{sessionId:s.sessionId??null,error:s.error!==void 0,undelivered:s.undelivered!==void 0,submitted:s.submittedText!==void 0,admissionAttempted:s.admissionAttempted===!0}])),sessionCount:n.sessions.length,scopes:Object.fromEntries(Object.entries(n.scopes).map(([r,s])=>[r,{ids:s.ids.length,nextCursor:s.nextCursor,loading:s.loading,error:s.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:()=>nx.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 FWe(n.key);const r=AWe(),s=JSON.stringify(fk),i=r.length;return await nx.fetchQuery({queryKey:fk,queryFn:()=>null,retry:!1,staleTime:0}),{armed:!0,validated:r.slice(i).some(a=>a.key===s)}},navigate:async t=>{const n=Tp(t,"navigate path");if(!n.startsWith("/"))throw new Error(`navigate path must start with "/" (got "${n}")`);return window.location.hash=`#${n}`,{route:await RWe(n)}},setTheme:async t=>{const n=Tp(t,"theme name");ct.getState().setTheme(n),await cu();const r=document.documentElement.getAttribute("data-theme"),s=await kWe();return{theme:ct.getState().themeName,dataTheme:r,settledAfterMs:s.waitedMs,settleTimedOut:s.timedOut,settlePending:s.pending}},setSidebarWidth:async t=>{const n=Number(t?.width);if(!Number.isFinite(n))throw new Error("sidebar width must be a number");const r=OY(n);return ct.getState().setChatSidebarWidth(r),await cu(),{width:ct.getState().chatSidebarWidth,clamped:r!==n}},measure:async t=>{const n=typeof t=="string"?{selector:t}:t,r=Tp(n?.selector,"measure selector"),s=typeof n?.timeoutMs=="number"?n.timeoutMs:1e4,i=Date.now();let a=null;for(;a===null&&(a=document.querySelector(r),a===null);){if(Date.now()-i>s)throw new Error(`nothing matches ${r} after ${s}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)},c=document.elementFromPoint(l.x,l.y);return{selector:r,target:Im(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:c!==null&&(c===a||a.contains(c)),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,r=Tp(n?.selector,"press selector"),s=typeof n?.timeoutMs=="number"?n.timeoutMs:1e4,i=Date.now();let a=null;for(;a===null&&(a=document.querySelector(r),a===null);){if(Date.now()-i>s)throw new Error(`nothing matches ${r} after ${s}ms of waiting`);await new Promise(l=>setTimeout(l,100))}const o=TWe(a);return await cu(),{selector:r,target:Im(a),...o}},openCanvasDocument:async t=>{const n=t,r=Tp(n?.path,"canvas document path"),s=typeof n?.title=="string"?n.title:void 0,[i]=await window.api.probeFiles([r]);if(!i||!i.exists||!i.isFile)throw new Error(`no file at ${i?.resolved??r}`);const a=i.resolved??r,o=ch(a,{title:s,type:Bh(a),availability:"present",sizeBytes:i.sizeBytes??void 0,lastAgentModified:i.mtimeMs??void 0,readMtimeMs:i.mtimeMs??void 0}),l=Bb[jm(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 c=Ee.getState(),d=Mk(c.activeDraftKey,c.activeSessionId)??c.stageDraft();return ct.getState().setCanvasOpen(!0),pr.getState().addFileAndSelect(d,o),await cu(),{conversationId:d,documentId:o.id,readMtimeMs:o.readMtimeMs??null,contentLength:o.content.length,encoding:l}},stageLiveConsents:async t=>{const r=t?.count;if(typeof r!="number"||!Number.isInteger(r)||r<0)throw new Error(`stageLiveConsents count must be a non-negative integer (got ${JSON.stringify(r)})`);const s=Date.now();return _re({tabs:[],activeTabId:null,url:"",title:"",loading:!1,canGoBack:!1,canGoForward:!1,pendingConsent:Array.from({length:r},(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:s+10*6e4,requesterSessionId:null})),approvals:[],navFailure:null}),await cu(),{count:r}}}):[]}function PWe(){const e=g.useMemo(CK,[]),t=g.useRef(null);return g.useEffect(()=>{const n=window.api?.miniView;if(!n?.onRegistration)return;let r=!1;const s=a=>{if(r)return;const o=t.current;if(t.current=a.status,o===null||a.status===o||a.status==="registered")return;const l=yK(a.value,e);Zt(SK(a.status,l))};n.getRegistration?.()?.then(s)?.catch(()=>{});const i=n.onRegistration(s);return()=>{r=!0,i?.()}},[e]),null}const IWe=`
678
678
  /*
679
679
  * A transition declared on ::-webkit-scrollbar-thumb does not animate in