local-operator-ui 0.50.1 → 0.50.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 (99) hide show
  1. package/out/main/index.js +96 -8
  2. package/out/renderer/assets/{_basePickBy-Bsv7r9Jb.js → _basePickBy-B0CGodz5.js} +1 -1
  3. package/out/renderer/assets/{_baseUniq-jyJ-i_Ny.js → _baseUniq-8ysZQvmz.js} +1 -1
  4. package/out/renderer/assets/{agent-details-page-DQXYu_PL.js → agent-details-page-CdnNoAG1.js} +1 -1
  5. package/out/renderer/assets/{agent-hub-page-1bRH8Gbz.js → agent-hub-page-DzJe_j6z.js} +1 -1
  6. package/out/renderer/assets/{agents-page-3iHF3oFj.js → agents-page-B8ehgi1r.js} +3 -3
  7. package/out/renderer/assets/appearance-DxToWtVc.js +65 -0
  8. package/out/renderer/assets/{approvalsOverlay-fAKBFaaS.js → approvalsOverlay-C-vFFJMh.js} +1 -1
  9. package/out/renderer/assets/{arc-D4FKhFvF.js → arc-C6vMPnZo.js} +1 -1
  10. package/out/renderer/assets/{architectureDiagram-IEHRJDOE-D2Wm66Ss.js → architectureDiagram-IEHRJDOE-BaKmVFd8.js} +1 -1
  11. package/out/renderer/assets/{avatar-cropper-BxTkXnUv.js → avatar-cropper-CCvczwaj.js} +1 -1
  12. package/out/renderer/assets/{blockDiagram-JOT3LUYC-Dhx8qL4I.js → blockDiagram-JOT3LUYC-DNJTzz0-.js} +1 -1
  13. package/out/renderer/assets/{book-open-DjYEoRKl.js → book-open-AjJXGzb6.js} +1 -1
  14. package/out/renderer/assets/browser-page-B1LNZlf_.js +1 -0
  15. package/out/renderer/assets/{browser-webauthn-prompt-DhewWTHJ.js → browser-webauthn-prompt-D7ldFLmy.js} +1 -1
  16. package/out/renderer/assets/{building-2-D7Uxv0cT.js → building-2-DrbuKv4e.js} +1 -1
  17. package/out/renderer/assets/{c4Diagram-VJAJSXHY-D78faDhy.js → c4Diagram-VJAJSXHY-CFvnENAF.js} +1 -1
  18. package/out/renderer/assets/channel-C0mudVZF.js +1 -0
  19. package/out/renderer/assets/{chunk-4BMEZGHF-DRKhJ_j1.js → chunk-4BMEZGHF-DSSF88xF.js} +1 -1
  20. package/out/renderer/assets/{chunk-A2AXSNBT-DGSwfWb0.js → chunk-A2AXSNBT-DW2Smd4N.js} +1 -1
  21. package/out/renderer/assets/{chunk-AEK57VVT-B42qalpB.js → chunk-AEK57VVT-vmOkmkFl.js} +1 -1
  22. package/out/renderer/assets/{chunk-D6G4REZN-wUxOb9HP.js → chunk-D6G4REZN-C-1gQ6dD.js} +1 -1
  23. package/out/renderer/assets/{chunk-RZ5BOZE2-Dne7UctW.js → chunk-RZ5BOZE2-CvkHOneP.js} +1 -1
  24. package/out/renderer/assets/{chunk-XZIHB7SX-DXwYr08U.js → chunk-XZIHB7SX-DtVS8cQp.js} +1 -1
  25. package/out/renderer/assets/classDiagram-GIVACNV2-DfsohnxP.js +1 -0
  26. package/out/renderer/assets/classDiagram-v2-COTLJTTW-DfsohnxP.js +1 -0
  27. package/out/renderer/assets/clone-DogRJTvD.js +1 -0
  28. package/out/renderer/assets/{console-mirror-BQHgtoeJ.js → console-mirror-CUiw0R0Z.js} +1 -1
  29. package/out/renderer/assets/{consoleCapture-BZ1Iqw5E.js → consoleCapture-CEIY9xSK.js} +1 -1
  30. package/out/renderer/assets/{conversation-input-sync-D820Mg9t.js → conversation-input-sync-BGfWeOqy.js} +4 -4
  31. package/out/renderer/assets/{dagre-OKDRZEBW-DH78Ufhs.js → dagre-OKDRZEBW-CWzXBwaH.js} +1 -1
  32. package/out/renderer/assets/{diagram-SSKATNLV-CaO0hoO4.js → diagram-SSKATNLV-t868hyXW.js} +1 -1
  33. package/out/renderer/assets/{diagram-VNBRO52H-PrdUVU14.js → diagram-VNBRO52H-DUoOE-bt.js} +1 -1
  34. package/out/renderer/assets/{erDiagram-Q7BY3M3F-Bz3wOSZb.js → erDiagram-Q7BY3M3F-DYWVOUdq.js} +1 -1
  35. package/out/renderer/assets/{error-boundary-DEGyIgpt.js → error-boundary-CtkXM619.js} +1 -1
  36. package/out/renderer/assets/{flowDiagram-4HSFHLVR-DSLF5rPX.js → flowDiagram-4HSFHLVR-BswlGsLM.js} +1 -1
  37. package/out/renderer/assets/{ganttDiagram-APWFNJXF-BYPDtZuf.js → ganttDiagram-APWFNJXF-CCEe3Tdm.js} +1 -1
  38. package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-CG1HY2FR.js → gitGraphDiagram-7IBYFJ6S-Bl10LWvi.js} +1 -1
  39. package/out/renderer/assets/{graph-B8PSktuT.js → graph-DKQjDGox.js} +1 -1
  40. package/out/renderer/assets/{heart-CYS0Evlh.js → heart-mTaKHtD-.js} +1 -1
  41. package/out/renderer/assets/{index-C6QnCGp0.js → index-BcwoLiEJ.js} +1 -1
  42. package/out/renderer/assets/{index-DH5u3QDS.js → index-Bh3nSSKU.js} +3 -3
  43. package/out/renderer/assets/{index-CxIdeYfQ.js → index-CWP3MhTA.js} +1 -1
  44. package/out/renderer/assets/{index-DAPMXH_k.js → index-CfE0tEz7.js} +1 -1
  45. package/out/renderer/assets/infoDiagram-PH2N3AL5-BOATky3y.js +2 -0
  46. package/out/renderer/assets/{installer-CiMEp27D.js → installer-D-_8CWoh.js} +1 -1
  47. package/out/renderer/assets/{journeyDiagram-U35MCT3I-CwL5RIgy.js → journeyDiagram-U35MCT3I-B5JRH6pA.js} +1 -1
  48. package/out/renderer/assets/{kanban-definition-NDS4AKOZ-YjvJCrvZ.js → kanban-definition-NDS4AKOZ-BMQ51i2A.js} +1 -1
  49. package/out/renderer/assets/{layout-MLQtp9YQ.js → layout-BlYEyiLa.js} +1 -1
  50. package/out/renderer/assets/{legacy-agents-page-noAFJiLG.js → legacy-agents-page-Ca9aGS2m.js} +1 -1
  51. package/out/renderer/assets/{library-page-B9cQw_XV.js → library-page-1Q4ToZpC.js} +3 -3
  52. package/out/renderer/assets/{log-in-E6HfPJn1.js → log-in-Cz3YBOsh.js} +1 -1
  53. package/out/renderer/assets/{mermaid.core-CyqGNrTg.js → mermaid.core-D7HsriVr.js} +5 -5
  54. package/out/renderer/assets/{mesh-page-5KrCdgRG.js → mesh-page-B2xAXfjA.js} +1 -1
  55. package/out/renderer/assets/{messages-DRkjMKBJ.js → messages-CvRfSjnp.js} +8 -8
  56. package/out/renderer/assets/{mindmap-definition-ALO5MXBD-DxOaGeQS.js → mindmap-definition-ALO5MXBD-CMk15Uui.js} +1 -1
  57. package/out/renderer/assets/{mini-x7Qw7umA.js → mini-lkT5V9WE.js} +1 -1
  58. package/out/renderer/assets/{notebook-pen-D4l7rOnf.js → notebook-pen-DadCKhKK.js} +1 -1
  59. package/out/renderer/assets/{notifications-page-C23kRJcC.js → notifications-page-DLvG89Rx.js} +1 -1
  60. package/out/renderer/assets/{org-access-CyJbTo13.js → org-access-mvMfl6RO.js} +1 -1
  61. package/out/renderer/assets/{org-surface-gate-gYrpsVF3.js → org-surface-gate-DG0gOjUM.js} +1 -1
  62. package/out/renderer/assets/{page-header-DhaFiERt.js → page-header-CyxvZBjK.js} +1 -1
  63. package/out/renderer/assets/{pieDiagram-IB7DONF6-CL81fv2F.js → pieDiagram-IB7DONF6-B5VgM5cu.js} +1 -1
  64. package/out/renderer/assets/{project-markdown-B0jRuZju.js → project-markdown-C7j9JEv7.js} +1 -1
  65. package/out/renderer/assets/{projects-page-BWH8MFcf.js → projects-page-Cy7ci4iQ.js} +1 -1
  66. package/out/renderer/assets/{publication-validation-DI7vbv0d.js → publication-validation-LHyYGXxk.js} +1 -1
  67. package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-D_sJILsv.js → quadrantDiagram-7GDLP6J5-CabDBOXn.js} +1 -1
  68. package/out/renderer/assets/{radar-MK3ICKWK-CuxaL0km.js → radar-MK3ICKWK-Bs5DDyVg.js} +1 -1
  69. package/out/renderer/assets/{radient-auth-buttons-WMi92Nbu.js → radient-auth-buttons-CjpUv3nP.js} +1 -1
  70. package/out/renderer/assets/{requirementDiagram-KVF5MWMF-ChHTRRQC.js → requirementDiagram-KVF5MWMF-s_UB9693.js} +1 -1
  71. package/out/renderer/assets/{roles-KXyR--wS.js → roles-D1pcbxAx.js} +1 -1
  72. package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-Br2FU_Mu.js → sankeyDiagram-QLVOVGJD-FBDT6-L8.js} +1 -1
  73. package/out/renderer/assets/{schedules-page-Dtrb4iqB.js → schedules-page-DWG-H1tc.js} +1 -1
  74. package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-BYeAipI4.js → sequenceDiagram-X6HHIX6F-Dk2LRARF.js} +1 -1
  75. package/out/renderer/assets/settings-page-Cc3TAlMl.js +296 -0
  76. package/out/renderer/assets/{smartart-DK4xklXS.js → smartart-CZP-KJQm.js} +1 -1
  77. package/out/renderer/assets/{stateDiagram-DGXRK772-HfPPSL57.js → stateDiagram-DGXRK772-nAeHi0Q3.js} +1 -1
  78. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-CdCpeeGq.js +1 -0
  79. package/out/renderer/assets/{team-bridge-page-D--3lHyk.js → team-bridge-page-DyGy6Kbj.js} +1 -1
  80. package/out/renderer/assets/{team-bridge-scope-preference-jREmpkHn.js → team-bridge-scope-preference-DMVpYrdA.js} +1 -1
  81. package/out/renderer/assets/{timeline-definition-BDJGKUSR-4WbDfFTG.js → timeline-definition-BDJGKUSR-pJTYZrUl.js} +1 -1
  82. package/out/renderer/assets/{use-download-agent-mutation-CYiV_Si3.js → use-download-agent-mutation-BimCWRpf.js} +1 -1
  83. package/out/renderer/assets/{use-session-snapshot-CEZUdpvo.js → use-session-snapshot-D90Nwywl.js} +1 -1
  84. package/out/renderer/assets/{xychartDiagram-VJFVF3MP-ClLC2IYI.js → xychartDiagram-VJFVF3MP-CNYZmTD0.js} +1 -1
  85. package/out/renderer/browser-approvals-overlay.html +3 -3
  86. package/out/renderer/console-capture.html +6 -6
  87. package/out/renderer/index.html +8 -8
  88. package/out/renderer/installer.html +4 -4
  89. package/out/renderer/mini.html +8 -8
  90. package/package.json +1 -1
  91. package/out/renderer/assets/appearance-1qSymuJE.js +0 -65
  92. package/out/renderer/assets/browser-page-CbE2J46g.js +0 -1
  93. package/out/renderer/assets/channel-CbmsDNIR.js +0 -1
  94. package/out/renderer/assets/classDiagram-GIVACNV2-Br3BiPxU.js +0 -1
  95. package/out/renderer/assets/classDiagram-v2-COTLJTTW-Br3BiPxU.js +0 -1
  96. package/out/renderer/assets/clone-BUSzjx2V.js +0 -1
  97. package/out/renderer/assets/infoDiagram-PH2N3AL5-CDml2IbJ.js +0 -2
  98. package/out/renderer/assets/settings-page-D68agRqU.js +0 -296
  99. package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-BP4m3n3G.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./agent-details-page-DQXYu_PL.js","./index-C6QnCGp0.js","./messages-DRkjMKBJ.js","./index-CaftKcJ-.css","./publication-validation-DI7vbv0d.js","./appearance-1qSymuJE.js","./roles-KXyR--wS.js","./conversation-input-sync-D820Mg9t.js","./error-boundary-DEGyIgpt.js","./conversation-input-sync-BmGWvjex.css","./use-download-agent-mutation-CYiV_Si3.js","./book-open-DjYEoRKl.js","./en-US-CW_dDnkH.js","./heart-CYS0Evlh.js","./console-mirror-BQHgtoeJ.js","./console-mirror-DOrYoP_4.css","./agent-hub-page-1bRH8Gbz.js","./page-header-DhaFiERt.js","./org-access-CyJbTo13.js","./radient-auth-buttons-WMi92Nbu.js","./org-surface-gate-gYrpsVF3.js","./building-2-D7Uxv0cT.js","./agents-page-3iHF3oFj.js","./avatar-cropper-BxTkXnUv.js","./log-in-E6HfPJn1.js","./project-markdown-B0jRuZju.js","./schedules-page-Dtrb4iqB.js","./parseISO-CxPiCKvF.js","./projects-page-BWH8MFcf.js","./use-session-snapshot-CEZUdpvo.js","./library-page-B9cQw_XV.js","./notifications-page-C23kRJcC.js","./team-bridge-page-D--3lHyk.js","./team-bridge-scope-preference-jREmpkHn.js","./browser-page-CbE2J46g.js","./mesh-page-5KrCdgRG.js","./settings-page-D68agRqU.js","./notebook-pen-D4l7rOnf.js","./browser-webauthn-prompt-DhewWTHJ.js"])))=>i.map(i=>d[i]);
2
- import{r as m,j as c,c as R,b as st,m as zI,x as AQ,E as FQ,w as DQ,F as IQ,u as Fu,G as NQ,H as PQ,I as MQ,R as OQ}from"./index-C6QnCGp0.js";import{t as h,c as $m,a as LQ,L as yl,b as BQ}from"./messages-DRkjMKBJ.js";import{b2 as jQ,b3 as A_,b4 as k5,b5 as E5,u as Rt,b6 as HQ,b7 as UQ,b8 as GQ,b9 as VQ,ba as WQ,bb as $Q,bc as qI,bd as KI,be as zQ,bf as qQ,w as Ie,bg as KQ,bh as YI,bi as wy,bj as Ud,h as Rn,a as Hn,c as gt,e as Gv,n as T5,o as Yr,a0 as R5,bk as La,a9 as fg,ae as A5,F as qa,d as nt,bl as YQ,bm as XI,bn as d1,bo as F5,bp as lE,at as cE,bq as XQ,L as Pi,r as Vv,br as Zf,bs as D5,bt as QQ,g as ea,bu as h1,ac as Wv,K as Wo,E as et,bv as I5,bw as N5,bx as yy,by as uE,bz as JQ,S as zm,bA as P5,bB as ZQ,bC as eJ,bD as tJ,X as qu,bE as nJ,V as wA,Q as $v,bF as f1,bG as Jt,bH as F_,bI as QI,bJ as dE,R as sJ,bK as rJ,bL as iJ,bM as aJ,f as M5,bN as oJ,bO as lJ,bP as cJ,q as vr,bQ as bc,aY as Cy,b as O5,bR as JI,bS as uJ,bT as ZI,bU as dJ,bV as yA,a7 as hJ,bW as fJ,bX as pJ,bY as gJ,bZ as mJ,b_ as eN,v as CA,b$ as L5,ao as vJ,c0 as tN,c1 as Sy,c2 as bJ,c3 as xJ,c4 as _J,c5 as wJ,c6 as yJ,c7 as B5,c8 as p1,c9 as km,ca as CJ,cb as j5,cc as SJ,cd as nN,ce as sN,cf as $x,cg as zx,ch as hE,a4 as SA,ci as H5,cj as kJ,a3 as EJ,a2 as TJ,ck as RJ,cl as rN,cm as AJ,cn as Nd,co as Ib,cp as FJ,cq as DJ,cr as IJ,cs as iN,ct as aN,cu as NJ,cv as PJ,cw as MJ,cx as OJ,cy as oN,cz as lN,cA as cN,cB as uN,cC as LJ,cD as BJ,cE as jJ,cF as HJ,cG as UJ,cH as dN,cI as GJ,cJ as VJ,cK as WJ,cL as D_,cM as $J,cN as hN,cO as zJ,cP as qJ,cQ as KJ,cR as YJ,cS as Nb,cT as XJ,cU as QJ,cV as JJ,cW as ZJ,cX as U5,cY as eZ,a5 as kA,b1 as fN,cZ as tZ,c_ as nZ,c$ as sZ,b0 as rZ,aB as G5,aD as iZ,d0 as pN,t as gN,d1 as qm,d2 as aZ,d3 as oZ,d4 as mN,d5 as lZ,d6 as Pb,d7 as vN,d8 as cZ,d9 as Mb,da as uZ,db as Ob,dc as bN,dd as dZ,de as hZ,df as xN,dg as Lb,dh as _N,di as Bb,dj as qx,x as I_,y as V5,z as fZ,ap as fE,dk as pZ,dl as gZ,dm as mZ,dn as vZ,dp as bZ,dq as xZ,dr as _Z,ds as wZ,dt as W5,du as yZ,a1 as zv,dv as CZ,dw as EA,aa as SZ,dx as kZ,dy as EZ,a8 as TZ,dz as RZ,dA as AZ,dB as wN,aE as FZ,dC as g1,dD as yN,dE as DZ,dF as IZ,dG as NZ,dH as PZ,dI as MZ,dJ as OZ,dK as CN,U as LZ,dL as BZ,dM as jZ,dN as HZ,dO as UZ,A as GZ,dP as VZ,J as Ae,ah as jb,a6 as WZ,dQ as $5,dR as $Z,dS as zZ,dT as qZ,dU as KZ,dV as ky,dW as TA,dX as z5,dY as q5,m as YZ,dZ as XZ,aZ as QZ,d_ as JZ,d$ as SN,e0 as ZZ,e1 as m1,e2 as eee,as as tee,e3 as nee,e4 as see,ag as ree,e5 as kN,e6 as iee,e7 as pr,$ as EN,e8 as aee,e9 as TN,ea as oee,eb as K5,ec as RN,ed as lee,B as Y5,C as cee}from"./appearance-1qSymuJE.js";import{u as Ge,c as vt,z as cd,S as Mn,G as Yo,B as ce,L as cr,K as vs,T as RA,a as Zs,X as Kn,af as pE,ay as uee,n as Hc,o as Uc,p as Dl,J as Qi,k as Di,r as pg,s as jp,aj as qv,w as mt,a6 as gg,y as Ey,A as Ar,F as Ty,R as P0,U as M0,V as O0,W as L0,Y as B0,D as $o,b as ao,d as zo,H as AN,I as Mr,e as en,g as Kv,i as Ku,j as N_,az as v1,am as X5,N as Q5,O as J5,P as gE,f as Kx,aA as cp,ax as dee,a7 as Rh,a8 as Ry,a9 as Yu,aB as hee,_ as P_,t as Z5,ab as Ay,v as Fy,aC as fee,Z as AA,C as FN,aa as pee,ai as mE,h as gee,aD as Kg,at as FA,$ as DA,Q as mee,ac as vee,ad as bee,ae as xee,l as _ee,m as wee,ag as yee,ah as Cee,av as See,aw as kee,aE as e8,ar as ep,q as DN,x as IN,aF as Du,E as Eee}from"./error-boundary-DEGyIgpt.js";import{d4 as Yx,c6 as ju,aB as xa,cD as IA,b6 as co,b7 as er,aH as sn,bx as on,aA as Hs,aW as Gc,bB as Yv,d5 as Tee,bC as Xv,gu as t8,gv as Ree,gw as j0,gx as Aee,gy as Fee,gz as Dee,gA as Iee,gB as b1,gC as x1,a1 as Iu,cL as Dy,fh as ud,e$ as Xx,e_ as Nee,eZ as Er,f0 as kn,gD as n8,gE as Pee,cq as vE,bE as Xh,bF as Iy,f6 as Ny,fB as Mee,gF as NN,gG as Oee,gH as Lee,gI as bE,gJ as Bee,gK as jee,gL as Hee,gM as Uee,gN as M_,a$ as O_,bl as up,gO as PN,gP as MN,X as H0,gQ as Gee,gR as Vee,gS as Wee,gT as s8,gU as $ee,gV as zee,gW as r8,gX as Py,gY as My,gZ as qee,g_ as Kee,g$ as Yee,h0 as ON,h1 as Xee,h2 as Qee,h3 as Jee,h4 as Zee,h5 as ete,h6 as tte,h7 as nte,h8 as ste,cV as i8,h9 as rte,ha as a8,hb as ite,hc as LN,hd as ate,he as ote,cS as ui,hf as U0,ex as o8,hg as lte,hh as cte,hi as BN,hj as ute,hk as dte,hl as hte,hm as fte,hn as pte,a3 as Kd,cg as l8,ho as Km,hp as c8,hq as gte,hr as mte,hs as vte,ht as bte,hu as xte,hv as _te,hw as wte,c4 as Xu,hx as Qu,hy as yte,b3 as mg,hz as jN,hA as Cte,hB as Ste,hC as kte,hD as Ete,hE as Tte,hF as Rte,hG as Wf,ft as Ate,hH as Fte,hI as Dte,fw as Ite,hJ as Nte,hK as Pte,hL as u8,et as _1,hM as Oy,bH as d8,hN as Ly,hO as Mte,cp as xE,bz as NA,fI as Bo,dS as Fi,hP as h8,a2 as xc,hQ as f8,c5 as Ah,cK as By,hR as p8,cJ as G0,hS as Ote,cb as Ju,cN as jy,fo as Lte,hT as w1,hU as Bte,hV as jte,hW as Hte,hX as Ute,hY as Gte,hZ as Vte,h_ as Wte,h$ as $te,i0 as zte,i1 as HN,i2 as qte,i3 as Kte,i4 as PA,i5 as UN,fy as Yte,i6 as Xte,i7 as g8,i8 as Qte,i9 as Jte,ia as m8,ib as _E,ic as Zte,dA as dp,id as vg,ie as GN,ig as y1,ih as ene,cO as Hy,ii as tne,ij as v8,ik as wE,il as nne,im as b8,io as sne,ip as L_,iq as rne,ir as ine,is as ane,it as one,iu as lne,iv as cne,iw as une,bg as Rs,ix as x8,bf as Po,iy as _8,iz as dne,iA as hne,iB as VN,iC as w8,iD as y8,iE as C8,c8 as MA,e3 as S8,iF as Zu,iG as k8,y as ft,iH as Yn,iI as B_,iJ as yn,iK as E8,iL as T8,iM as OA,iN as j_,iO as R8,iP as Uy,iQ as Qv,iR as Fh,O as LA,iS as yE,iT as BA,iU as C1,iV as Gy,iW as fne,iX as uo,iY as pne,iZ as gne,i_ as tp,i$ as CE,j0 as A8,j1 as mne,j2 as V0,j3 as Vy,j4 as jA,j5 as vne,j6 as bne,j7 as xne,j8 as Pn,j9 as W0,ja as F8,jb as Ya,jc as _ne,jd as wne,je as D8,jf as yne,jg as Cne,jh as Sne,ji as kne,jj as Ene,jk as Tne,jl as Rne,jm as Ane,jn as Fne,jo as Dne,jp as Ine,jq as Nne,jr as Pne,js as Mne,jt as One,ju as Lne,jv as Bne,jw as HA,jx as jne,jy as WN,jz as UA,jA as Hne,jB as I8,jC as N8,jD as GA,jE as Une,cU as P8,db as Wy,de as $y,jF as zy,jG as bg,cC as M8,cF as Gne,dM as $N,cc as O8,dQ as Vne,dF as Wne,jH as $ne,dG as zne,dH as qne,dI as Kne,dJ as Yne,dK as Xne,dL as Qne,bj as Ur,dT as Jne,jI as Zne,jJ as ese,jK as tse,dU as nse,dP as sse,dR as rse,jL as ise,jM as L8,jN as ase,jO as ose,jP as $0,jQ as VA,jR as qy,jS as WA,jT as lse,jU as cse,jV as use,jW as B8,jX as dse,jY as zN,jZ as hse,j_ as $A,j$ as fse,k0 as zA,k1 as Jv,k2 as Zv,k3 as pse,k4 as j8,k5 as z0,k6 as gse,k7 as mse,k8 as vse,k9 as bse,ka as xse,kb as _se,kc as qN,fQ as H8,r as U8,fR as wse,kd as yse,ke as Cse,kf as Sse,cR as kse,kg as Ese,kh as gc,ki as KN,kj as Ym,kk as Yg,kl as Tse,km as YN,kn as XN,ko as Rse,ae as G8,cx as Xm,kp as Ase,kq as Fse,kr as Ky,dh as Dse,by as xg,ks as Ise,kt as SE,ku as Nse,kv as Pse,bD as Mi,bw as Yy,dj as _g,dk as V8,kw as qA,cG as W8,kx as Mse,dt as Ose,ky as Lse,kz as Bse,kA as $8,kB as jse,kC as Hu,kD as KA,a5 as YA,kE as Hse,ct as XA,cu as Xy,kF as Use,cs as Hp,di as S1,kG as Gse,kH as Vse,kI as Wse,kJ as $se,fk as zse,fl as qse,fm as Kse,fn as nc,kK as QN,kL as Yse,cA as Xse,kM as Qse,kN as Jse,kO as Zse,kP as ere,kQ as tre,kR as nre,kS as kE,e7 as z8,e8 as H_,kT as sre,kU as q8,cX as rre,cT as ire,kV as are,kW as K8,kX as ore,kY as lre,c$ as cre,kZ as ure,k_ as dre,k$ as hre,l0 as fre,l1 as pre,l2 as gre,fg as mre,a0 as vre,l3 as Y8,l4 as bre,l5 as xre,l6 as Hb,l7 as X8,fd as _re,l8 as wre,l9 as Q8,la as yre,lb as uh,g4 as J8,g5 as QA,lc as Cre,ld as Sre,le as kre,lf as Z8,M as Ere,lg as Tre,bm as eH,g3 as Rre,lh as Are,ca as tH,li as Fre,lj as Dre,a6 as Ire,lk as Nre,ll as Pre,lm as Mre,ln as Ore,lo as Lre,lp as JN,lq as k1,lr as Bre,cd as E1,ce as T1,cf as R1,bk as jre,ls as Hre,lt as Ure,lu as Gre,d1 as kf,lv as Ef,lw as Vre,lx as Wre,ly as $re,lz as zre,lA as qre,lB as Kre,lC as nH,lD as Yre,lE as sH,lF as EE,lG as TE,lH as A1,lI as Xre,lJ as Qre,lK as $f,lL as Jre,b1 as ZN,lM as eP,lN as rH,lO as RE,lP as iH,lQ as aH,lR as Zre,lS as eie,lT as tie,lU as nie,lV as sie,lW as rie,lX as iie,lY as aie,lZ as oie,l_ as lie,l$ as cie,m0 as uie,m1 as die,m2 as hie,m3 as fie,m4 as pie,m5 as gie,m6 as mie,ac as vie,a8 as bie,ad as tP,aa as xie,a9 as _ie,m7 as wie,m8 as yie,m9 as Cie,ma as Sie,mb as kie,mc as Eie,md as Tie,ba as Rie,bb as Aie,bc as Fie,bd as Die,be as Iie,me as Nie,mf as Pie,mg as Mie,mh as nP,dw as Kr,e0 as Bt,dV as oH,aT as Dc,aU as AE,ep as JA,es as ZA,mi as Oie,mj as lH,mk as Lie,ml as Bie,mm as jie,eX as Hie,mn as Uie,mo as Gie,mp as cH,mq as Vie,eY as sP,eu as e2,mr as t2,dv as hp,fx as uH,eE as dH,eB as Wie,ek as $ie,eK as zie,dn as qie,dm as rP,eL as Kie,dp as Yie,el as Xie,eq as Qie,eR as Jie,eS as Zie,eT as hH,ms as n2,mt as eae,bG as fH,mu as pH,mv as tae,mw as nae,mx as sae,my as si,mz as rae,mA as _u,mB as gH,mC as mH,mD as vH,mE as s2,mF as ha,mG as iae,mH as aae,mI as oae,mJ as lae,mK as cae,mL as uae,mM as dae,mN as hae,S as fae,mO as pae,d6 as gae,mP as bH,mQ as mae,mR as vae,mS as bae,mT as xae,mU as _ae,mV as FE,mW as wae,mX as yae,mY as iP,mZ as xH,m_ as Cae,m$ as Sae,n0 as kae,n1 as aP,n2 as Eae,n3 as Tae,n4 as Rae,n5 as Aae,n6 as Fae,n7 as Dae,n8 as Iae,n9 as Nae,na as r2,nb as Pae,nc as oP,nd as Gd,ne as _H,nf as DE,ng as U_,nh as Mae,ni as Oae,nj as Ub,nk as Em,nl as i2,nm as wH,nn as Lae,no as Bae,np as jae,nq as yH,nr as Hae,ns as Uae,ff as G_,nt as Gae,nu as lP,nv as Vae,nw as Wae,nx as $ae,ny as zae,nz as qae,nA as Kae,nB as Yae,fC as cP,nC as CH,nD as SH,nE as Xae,nF as Qae,dx as Jae,nG as Zae,fD as eoe,nH as toe,nI as noe,b4 as soe,cz as ka,nJ as roe,nK as ioe,nL as aoe,nM as ooe,nN as loe,nO as Tf,nP as coe,nQ as uoe,nR as V_,nS as doe,nT as hoe,nU as F1,nV as D1,nW as uP,nX as I1,nY as dP,nZ as kH,n_ as foe,bv as poe,n$ as EH,o0 as goe,bq as moe,br as voe,bo as boe,bp as xoe,o1 as _oe,bs as woe}from"./conversation-input-sync-D820Mg9t.js";import{u as TH,o as wg,b as yoe,c as Coe,r as RH,d as AH,e as q0,f as Soe,g as koe,s as a2,n as W_,h as Eoe,i as Toe,p as Roe,j as Aoe,k as Foe,l as Doe,q as Ioe,v as Noe,w as hP,x as fP,y as Poe,z as Moe,A as Ooe,C as Loe,B as Boe,D as joe,E as FH,F as DH,M as Hoe,G as Uoe,H as Goe}from"./console-mirror-BQHgtoeJ.js";import"./roles-KXyR--wS.js";function pP(e,t){return e.filter(n=>!t.includes(n))}function Voe(e,t,n){const s=e.slice(0);return s[t]=n,s}var Woe=class extends jQ{#s;#e;#r;#i;#t;#n;#a;#o;#l=[];constructor(e,t,n){super(),this.#s=e,this.#i=n,this.#r=[],this.#t=[],this.#e=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(e=>{e.subscribe(t=>{this.#h(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(e=>{e.destroy()})}setQueries(e,t){this.#r=e,this.#i=t,A_.batch(()=>{const n=this.#t,s=this.#d(this.#r);this.#l=s,s.forEach(o=>o.observer.setOptions(o.defaultedQueryOptions));const r=s.map(o=>o.observer),i=r.map(o=>o.getCurrentResult()),a=r.some((o,l)=>o!==n[l]);n.length===r.length&&!a||(this.#t=r,this.#e=i,this.hasListeners()&&(pP(n,r).forEach(o=>{o.destroy()}),pP(r,n).forEach(o=>{o.subscribe(l=>{this.#h(o,l)})}),this.#f()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(e=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,t){const n=this.#d(e),s=n.map(r=>r.observer.getOptimisticResult(r.defaultedQueryOptions));return[s,r=>this.#u(r??s,t),()=>this.#c(s,n)]}#c(e,t){return t.map((n,s)=>{const r=e[s];return n.defaultedQueryOptions.notifyOnChangeProps?r:n.observer.trackResult(r,i=>{t.forEach(a=>{a.observer.trackProp(i)})})})}#u(e,t){return t?((!this.#n||this.#e!==this.#o||t!==this.#a)&&(this.#a=t,this.#o=this.#e,this.#n=k5(this.#n,t(e))),this.#n):e}#d(e){const t=new Map(this.#t.map(s=>[s.options.queryHash,s])),n=[];return e.forEach(s=>{const r=this.#s.defaultQueryOptions(s),i=t.get(r.queryHash);i?n.push({defaultedQueryOptions:r,observer:i}):n.push({defaultedQueryOptions:r,observer:new E5(this.#s,r)})}),n}#h(e,t){const n=this.#t.indexOf(e);n!==-1&&(this.#e=Voe(this.#e,n,t),this.#f())}#f(){if(this.hasListeners()){const e=this.#n,t=this.#c(this.#e,this.#l),n=this.#u(t,this.#i?.combine);e!==n&&A_.batch(()=>{this.listeners.forEach(s=>{s(this.#e)})})}}};function IH({queries:e,...t},n){const s=Rt(n),r=HQ(),i=UQ(),a=m.useMemo(()=>e.map(b=>{const x=s.defaultQueryOptions(b);return x._optimisticResults=r?"isRestoring":"optimistic",x}),[e,s,r]);a.forEach(b=>{GQ(b),VQ(b,i)}),WQ(i);const[o]=m.useState(()=>new Woe(s,a,t)),[l,u,d]=o.getOptimisticResult(a,t.combine),f=!r&&t.subscribed!==!1;m.useSyncExternalStore(m.useCallback(b=>f?o.subscribe(A_.batchCalls(b)):$Q,[o,f]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),m.useEffect(()=>{o.setQueries(a,t)},[a,t,o]);const g=l.some((b,x)=>qI(a[x],b))?l.flatMap((b,x)=>{const _=a[x];if(_){const w=new E5(s,_);if(qI(_,b))return KI(_,w,i);zQ(b,r)&&KI(_,w,i)}return[]}):[];if(g.length>0)throw Promise.all(g);const v=l.find((b,x)=>{const _=a[x];return _&&qQ({result:b,errorResetBoundary:i,throwOnError:_.throwOnError,query:s.getQueryCache().get(_.queryHash),suspense:_.suspense})});if(v?.error)throw v.error;return u(d())}function gP(e,t){return e.findAll(t.filters).map(n=>t.select?t.select(n):n.state)}function $oe(e={},t){const n=Rt(t).getMutationCache(),s=m.useRef(e),r=m.useRef(null);return r.current||(r.current=gP(n,e)),m.useEffect(()=>{s.current=e}),m.useSyncExternalStore(m.useCallback(i=>n.subscribe(()=>{const a=k5(r.current,gP(n,s.current));r.current!==a&&(r.current=a,A_.schedule(i))}),[n]),()=>r.current,()=>r.current)}const Qx=8e3,NH=1e4;function zoe(e){return e?h("ui.notices.chat.archive_offered_title",{title:e}):h("ui.notices.chat.archive_offered_no_name")}const qoe=()=>h("ui.notices.chat.archive_offered_verb");function Koe(e){return Ie.getState().archiveFacts[e]}function Yoe(e){const t=Ie.getState(),n=t.archiveFacts[e];return n?n.archived:t.sessions.find(s=>s.session_id===e)?.archived}function Xoe(){const e=Ie(t=>t.archiveUndo);m.useEffect(()=>{if(e===null)return;let t=!1;const n=()=>{t||(t=!0,r())},s=()=>{n();const i=Ie.getState().archiveUndo;i!==null&&i.sessionId===e.sessionId&&i.at===e.at&&Ie.getState().setArchiveUndo(null)},r=Ie.subscribe(()=>{const i=Koe(e.sessionId);i!==void 0&&!i.answered||KQ(e.archived,Yoe(e.sessionId))||s()});return n},[e])}function Qoe(e){return h("ui.notices.chat.drafts_offered_name",{count:e})}const Joe=e=>h("ui.notices.chat.drafts_offered_verb",{count:e}),Zoe=e=>{const t=YI(e),n=t.length,s=t.filter(o=>!o.active).length,r=n===1?"chat":"chats",i=e.filter(o=>wy(o)!==null&&YI([o]).length===0).length,a=[`Mark ${n} unread ${r} as read${s>0?`, including ${s} in Previous chats`:""}.`];return i>0&&a.push(`${i} unread ${i===1?"mark":"marks"} with no completion token cannot be cleared.`),{count:n,label:`Mark all ${n} read`,scope:a.join(" "),nameSuffix:s>0?`, including ${s} in Previous chats`:""}},PH=e=>h("ui.notices.chat.mark_all_read_deferred",{count:e}),ele=e=>{if(e.attempted===0)return{tone:"success",message:h("ui.notices.chat.mark_all_read_nothing")};const t=e.unknown-e.deferred,n=[e.superseded>0?h("ui.notices.chat.mark_all_read_superseded",{count:e.superseded}):null,t>0?h("ui.notices.chat.mark_all_read_unknown",{count:t}):null,e.deferred>0?PH(e.deferred):null].filter(s=>s!==null);return e.cleared===0?{tone:"warning",message:[h("ui.notices.chat.mark_all_read_none_cleared"),...n].join(" ")}:{tone:"success",message:[h("ui.notices.chat.mark_all_read_cleared",{count:e.cleared}),...n].join(" ")}},N1="archive",mP="drafts-undo",vP="bulk-read-deferral",tle=8e3;function nle(){const e=Ge(),t=Ie(b=>b.archiveFailure),n=Ie(b=>b.archiveUndo),s=Ie(b=>b.draftsUndo),r=Ie(b=>b.bulkReadDeferral),i=Ie(b=>b.clearArchiveFailure),a=Ie(b=>b.setArchiveUndo),o=Ie(b=>b.setSessionArchived),l=Ie(b=>b.restoreDraftsUndo);Xoe();const u=Ud(t?.title),d=m.useRef(null),f=m.useRef(null);m.useEffect(()=>{if(t===null&&n===null){if(d.current===null)return;d.current=null,f.current=null,Yx(N1);return}const b=t&&n?n.at>t.at?"offer":"failure":t?"failure":"offer",x=b==="offer"?n?.at??0:t?.at??0,_=d.current;d.current={kind:b,at:x},_!==null&&_.kind!==b&&x>_.at&&(b==="failure"?a(null):i());const w=(y,S)=>()=>{const C=Ie.getState();y==="offer"?C.archiveUndo?.at===S&&C.setArchiveUndo(null):C.archiveFailure?.at===S&&C.clearArchiveFailure();const E=d.current;E!==null&&E.kind===y&&E.at===S&&(d.current=null)};if(b==="failure"&&t){const y=f.current,S=y!==null&&y.kind==="failure"&&y.at===t.at;if(S&&y.locale===e)return;const C=S?y.raisedAt+y.duration-Date.now():NH;if(C<=0)return;f.current=S?{...y,locale:e}:{kind:"failure",at:t.at,raisedAt:Date.now(),duration:C,locale:e},ju(`${t.archived?h("ui.notices.chat.archive_failed",{title:u}):h("ui.notices.chat.unarchive_failed",{title:u})}${t.detail?` ${t.detail}`:""}`,{id:N1,duration:C,onAutoClose:w("failure",t.at),onDismiss:w("failure",t.at),action:{label:h("ui.common.actions.retry"),onClick:E=>{E.preventDefault(),o(t.sessionId,t.archived,t.title)}}});return}if(n){const y=f.current,S=y!==null&&y.kind==="offer"&&y.at===n.at;if(S&&y.locale===e)return;const C=S?y.raisedAt+y.duration-Date.now():Qx;if(C<=0)return;f.current=S?{...y,locale:e}:{kind:"offer",at:n.at,raisedAt:Date.now(),duration:C,locale:e},xa(c.jsxs("span",{className:R("flex min-w-0 items-baseline gap-1"),children:[c.jsx("span",{className:R("min-w-0 truncate"),children:zoe(n.title)}),c.jsx("span",{className:R("shrink-0"),children:qoe()})]}),{id:N1,duration:C,classNames:{content:"min-w-0"},onAutoClose:w("offer",n.at),onDismiss:w("offer",n.at),action:{label:h("ui.notices.chat.undo"),onClick:E=>{E.preventDefault(),o(n.sessionId,!n.archived,n.title)}}})}},[e,u,t,n,a,i,o]);const p=m.useRef(!1),g=m.useRef(null);m.useEffect(()=>{if(s===null){if(!p.current)return;p.current=!1,g.current=null,Yx(mP);return}p.current=!0;const b=g.current,x=b!==null&&b.at===s.at;if(x&&b.locale===e)return;const _=x?b.raisedAt+Qx-Date.now():Qx;if(_<=0)return;g.current=x?{...b,locale:e}:{at:s.at,raisedAt:Date.now(),locale:e};const w=()=>{const y=Ie.getState();y.draftsUndo?.at===s.at&&(y.setDraftsUndo(null),p.current=!1)};xa(c.jsxs("span",{className:R("flex min-w-0 items-baseline gap-1"),children:[c.jsx("span",{className:R("min-w-0 truncate"),children:Qoe(s.keys.length)}),c.jsx("span",{className:R("shrink-0"),children:Joe(s.keys.length)})]}),{id:mP,duration:_,classNames:{content:"min-w-0"},onAutoClose:w,onDismiss:w,action:{label:h("ui.notices.chat.undo"),onClick:y=>{y.preventDefault(),l();const S=Ie.getState(),C=S.stagedByDiscard;S.setStagedByDiscard(null),s.keys.length===1&&C!==null&&Ie.getState().activeDraftKey===C&&Ie.getState().openDraft(s.keys[0])}}})},[e,s,l]);const v=m.useRef(!1);return m.useEffect(()=>{if(r===null){if(!v.current)return;v.current=!1,Yx(vP);return}v.current=!0;const b=()=>{const x=Ie.getState();x.bulkReadDeferral?.at===r.at&&(x.clearBulkReadDeferral(),v.current=!1)};xa(PH(r.count),{id:vP,duration:tle,onAutoClose:b,onDismiss:b})},[r]),null}var No,qe=typeof window<"u"?window:void 0,qi=typeof globalThis<"u"?globalThis:qe,MH=Array.prototype,bP=MH.forEach,xP=MH.indexOf,va=qi?.navigator,Ft=qi?.document,$i=qi?.location,IE=qi?.fetch,NE=qi!=null&&qi.XMLHttpRequest&&"withCredentials"in new qi.XMLHttpRequest?qi.XMLHttpRequest:void 0,_P=qi?.AbortController,ar=va?.userAgent,nn=qe??{},uc={DEBUG:!1,LIB_VERSION:"1.235.6"},P1="$copy_autocapture",sle=["$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"})(No||(No={}));var rle=["fatal","error","warning","log","info","debug"];function wn(e,t){return e.indexOf(t)!==-1}var Qy=function(e){return e.trim()},o2=function(e){return e.replace(/^\$/,"")},ile=Array.isArray,OH=Object.prototype,LH=OH.hasOwnProperty,Jy=OH.toString,Os=ile||function(e){return Jy.call(e)==="[object Array]"},jo=e=>typeof e=="function",Ls=e=>e===Object(e)&&!Os(e),np=e=>{if(Ls(e)){for(var t in e)if(LH.call(e,t))return!1;return!0}return!1},Et=e=>e===void 0,lr=e=>Jy.call(e)=="[object String]",PE=e=>lr(e)&&e.trim().length===0,dd=e=>e===null,qn=e=>Et(e)||dd(e),Ai=e=>Jy.call(e)=="[object Number]",hc=e=>Jy.call(e)==="[object Boolean]",ale=e=>e instanceof FormData,ole=e=>wn(sle,e),BH=e=>{var t={_log:function(n){if(qe&&(uc.DEBUG||nn.POSTHOG_DEBUG)&&!Et(qe.console)&&qe.console){for(var s=("__rrweb_original__"in qe.console[n])?qe.console[n].__rrweb_original__:qe.console[n],r=arguments.length,i=new Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];s(e,...i)}},info:function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];t._log("log",...s)},warn:function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];t._log("warn",...s)},error:function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];t._log("error",...s)},critical:function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];console.error(e,...s)},uninitializedWarning:n=>{t.error("You must initialize PostHog before calling ".concat(n))},createLogger:n=>BH("".concat(e," ").concat(n))};return t},Lt=BH("[PostHog.js]"),pi=Lt.createLogger,lle=pi("[ExternalScriptsLoader]"),wP=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return lle.warn("".concat(t," was requested but loading of external scripts is disabled.")),n("Loading of external scripts is disabled");var s=Ft?.querySelectorAll("script");if(s){for(var r=0;r<s.length;r++)if(s[r].src===t)return n()}var i=()=>{if(!Ft)return n("document not found");var a=Ft.createElement("script");if(a.type="text/javascript",a.crossOrigin="anonymous",a.src=t,a.onload=u=>n(void 0,u),a.onerror=u=>n(u),e.config.prepare_external_dependency_script&&(a=e.config.prepare_external_dependency_script(a)),!a)return n("prepare_external_dependency_script returned null");var o,l=Ft.querySelectorAll("body > script");l.length>0?(o=l[0].parentNode)===null||o===void 0||o.insertBefore(a,l[0]):Ft.body.appendChild(a)};Ft!=null&&Ft.body?i():Ft?.addEventListener("DOMContentLoaded",i)};function yP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,s)}return n}function Ze(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yP(Object(n),!0).forEach(function(s){yt(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yP(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function yt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jH(e,t){if(e==null)return{};var n,s,r=function(a,o){if(a==null)return{};var l,u,d={},f=Object.keys(a);for(u=0;u<f.length;u++)l=f[u],o.indexOf(l)>=0||(d[l]=a[l]);return d}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}nn.__PosthogExtensions__=nn.__PosthogExtensions__||{},nn.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{var s="/static/".concat(t,".js")+"?v=".concat(e.version);if(t==="remote-config"&&(s="/array/".concat(e.config.token,"/config.js")),t==="toolbar"){var r=3e5,i=Math.floor(Date.now()/r)*r;s="".concat(s,"&t=").concat(i)}var a=e.requestRouter.endpointFor("assets",s);wP(e,a,n)},nn.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var s=e.requestRouter.endpointFor("api",t);wP(e,s,n)};var $_={};function Uu(e,t,n){if(Os(e)){if(bP&&e.forEach===bP)e.forEach(t,n);else if("length"in e&&e.length===+e.length){for(var s=0,r=e.length;s<r;s++)if(s in e&&t.call(n,e[s],s)===$_)return}}}function is(e,t,n){if(!qn(e)){if(Os(e))return Uu(e,t,n);if(ale(e)){for(var s of e.entries())if(t.call(n,s[1],s[0])===$_)return}else for(var r in e)if(LH.call(e,r)&&t.call(n,e[r],r)===$_)return}}var Ks=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];return Uu(n,function(r){for(var i in r)r[i]!==void 0&&(e[i]=r[i])}),e},Jx=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];return Uu(n,function(r){Uu(r,function(i){e.push(i)})}),e};function Zx(e){for(var t=Object.keys(e),n=t.length,s=new Array(n);n--;)s[n]=[t[n],e[t[n]]];return s}var CP=function(e){try{return e()}catch{return}},cle=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return e.apply(this,n)}catch(r){Lt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Lt.critical(r)}}},K0=function(e){var t={};return is(e,function(n,s){lr(n)&&n.length>0&&(t[s]=n)}),t};function ule(e,t){return n=e,s=i=>lr(i)&&!dd(t)?i.slice(0,t):i,r=new Set,function i(a,o){return a!==Object(a)?s?s(a,o):a:r.has(a)?void 0:(r.add(a),Os(a)?(l=[],Uu(a,u=>{l.push(i(u))})):(l={},is(a,(u,d)=>{r.has(u)||(l[d]=i(u,d))})),l);var l}(n);var n,s,r}var dle=["herokuapp.com","vercel.app","netlify.app"];function hle(e){var t=e?.hostname;if(!lr(t))return!1;var n=t.split(".").slice(-2).join(".");for(var s of dle)if(n===s)return!1;return!0}function HH(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function Xs(e,t,n,s){var{capture:r=!1,passive:i=!0}=s??{};e?.addEventListener(t,n,{capture:r,passive:i})}var UH="$people_distinct_id",Tm="__alias",Rm="__timers",SP="$autocapture_disabled_server_side",ME="$heatmaps_enabled_server_side",kP="$exception_capture_enabled_server_side",EP="$web_vitals_enabled_server_side",GH="$dead_clicks_enabled_server_side",TP="$web_vitals_allowed_metrics",OE="$session_recording_enabled_server_side",RP="$console_log_recording_enabled_server_side",AP="$session_recording_network_payload_capture",FP="$session_recording_masking",DP="$session_recording_canvas_recording",IP="$replay_sample_rate",NP="$replay_minimum_duration",PP="$replay_script_config",z_="$sesid",Am="$session_is_sampled",M1="$session_recording_url_trigger_activated_session",O1="$session_recording_event_trigger_activated_session",sp="$enabled_feature_flags",e_="$early_access_features",LE="$feature_flag_details",Fm="$stored_person_properties",Vd="$stored_group_properties",BE="$surveys",Gb="$surveys_activated",q_="$flag_call_reported",oc="$user_state",jE="$client_session_props",HE="$capture_rate_limit",UE="$initial_campaign_params",GE="$initial_referrer_info",VE="$initial_person_info",K_="$epp",VH="__POSTHOG_TOOLBAR__",MP="$posthog_cookieless",fle=[UH,Tm,"__cmpns",Rm,OE,ME,z_,sp,oc,e_,LE,Vd,Fm,BE,q_,jE,HE,UE,GE,K_];function OP(e){var t;return e instanceof Element&&(e.id===VH||!((t=e.closest)===null||t===void 0||!t.call(e,".toolbar-global-fade-container")))}function Zy(e){return!!e&&e.nodeType===1}function Gu(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function WH(e){return!!e&&e.nodeType===3}function $H(e){return!!e&&e.nodeType===11}function l2(e){return e?Qy(e).split(/\s+/):[]}function LP(e){var t=qe?.location.href;return!!(t&&e&&e.some(n=>t.match(n)))}function Y_(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return l2(t)}function zH(e){return qn(e)?null:Qy(e).split(/(\s+)/).filter(t=>Up(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function eC(e){var t="";return $E(e)&&!YH(e)&&e.childNodes&&e.childNodes.length&&is(e.childNodes,function(n){var s;WH(n)&&n.textContent&&(t+=(s=zH(n.textContent))!==null&&s!==void 0?s:"")}),Qy(t)}function qH(e){return Et(e.target)?e.srcElement||null:(t=e.target)!==null&&t!==void 0&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var WE=["a","button","form","input","select","textarea","label"];function KH(e){var t=e.parentNode;return!(!t||!Zy(t))&&t}function ple(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;if(!qe||!e||Gu(e,"html")||!Zy(e)||n!=null&&n.url_allowlist&&!LP(n.url_allowlist)||n!=null&&n.url_ignorelist&&LP(n.url_ignorelist))return!1;if(n!=null&&n.dom_event_allowlist){var i=n.dom_event_allowlist;if(i&&!i.some(g=>t.type===g))return!1}for(var a=!1,o=[e],l=!0,u=e;u.parentNode&&!Gu(u,"body");)if($H(u.parentNode))o.push(u.parentNode.host),u=u.parentNode.host;else{if(!(l=KH(u)))break;if(s||WE.indexOf(l.tagName.toLowerCase())>-1)a=!0;else{var d=qe.getComputedStyle(l);d&&d.getPropertyValue("cursor")==="pointer"&&(a=!0)}o.push(l),u=l}if(!function(g,v){var b=v?.element_allowlist;if(Et(b))return!0;var x=function(y){if(b.some(S=>y.tagName.toLowerCase()===S))return{v:!0}};for(var _ of g){var w=x(_);if(typeof w=="object")return w.v}return!1}(o,n)||!function(g,v){var b=v?.css_selector_allowlist;if(Et(b))return!0;var x=function(y){if(b.some(S=>y.matches(S)))return{v:!0}};for(var _ of g){var w=x(_);if(typeof w=="object")return w.v}return!1}(o,n))return!1;var f=qe.getComputedStyle(e);if(f&&f.getPropertyValue("cursor")==="pointer"&&t.type==="click")return!0;var p=e.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(r||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(t.type)>=0;default:return a?(r||["click"]).indexOf(t.type)>=0:(r||["click"]).indexOf(t.type)>=0&&(WE.indexOf(p)>-1||e.getAttribute("contenteditable")==="true")}}function $E(e){for(var t=e;t.parentNode&&!Gu(t,"body");t=t.parentNode){var n=Y_(t);if(wn(n,"ph-sensitive")||wn(n,"ph-no-capture"))return!1}if(wn(Y_(e),"ph-include"))return!0;var s=e.type||"";if(lr(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";return!(lr(r)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,"")))}function YH(e){return!!(Gu(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Gu(e,"select")||Gu(e,"textarea")||e.getAttribute("contenteditable")==="true")}var XH="(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})",gle=new RegExp("^(?:".concat(XH,")$")),mle=new RegExp(XH),QH="\\d{3}-?\\d{2}-?\\d{4}",vle=new RegExp("^(".concat(QH,")$")),ble=new RegExp("(".concat(QH,")"));function Up(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(qn(e)||lr(e)&&(e=Qy(e),(t?gle:mle).test((e||"").replace(/[- ]/g,""))||(t?vle:ble).test(e)))}function JH(e){var t=eC(e);return Up(t="".concat(t," ").concat(ZH(e)).trim())?t:""}function ZH(e){var t="";return e&&e.childNodes&&e.childNodes.length&&is(e.childNodes,function(n){var s;if(n&&((s=n.tagName)===null||s===void 0?void 0:s.toLowerCase())==="span")try{var r=eC(n);t="".concat(t," ").concat(r).trim(),n.childNodes&&n.childNodes.length&&(t="".concat(t," ").concat(ZH(n)).trim())}catch(i){Lt.error("[AutoCapture]",i)}}),t}function xle(e){return function(t){var n=t.map(s=>{var r,i,a="";if(s.tag_name&&(a+=s.tag_name),s.attr_class)for(var o of(s.attr_class.sort(),s.attr_class))a+=".".concat(o.replace(/"/g,""));var l=Ze(Ze(Ze(Ze({},s.text?{text:s.text}:{}),{},{"nth-child":(r=s.nth_child)!==null&&r!==void 0?r:0,"nth-of-type":(i=s.nth_of_type)!==null&&i!==void 0?i:0},s.href?{href:s.href}:{}),s.attr_id?{attr_id:s.attr_id}:{}),s.attributes),u={};return Zx(l).sort((d,f)=>{var[p]=d,[g]=f;return p.localeCompare(g)}).forEach(d=>{var[f,p]=d;return u[BP(f.toString())]=BP(p.toString())}),a+=":",a+=Zx(l).map(d=>{var[f,p]=d;return"".concat(f,'="').concat(p,'"')}).join("")});return n.join(";")}(function(t){return t.map(n=>{var s,r,i={text:(s=n.$el_text)===null||s===void 0?void 0:s.slice(0,400),tag_name:n.tag_name,href:(r=n.attr__href)===null||r===void 0?void 0:r.slice(0,2048),attr_class:_le(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return Zx(n).filter(a=>{var[o]=a;return o.indexOf("attr__")===0}).forEach(a=>{var[o,l]=a;return i.attributes[o]=l}),i})}(e))}function BP(e){return e.replace(/"|\\"/g,'\\"')}function _le(e){var t=e.attr__class;return t?Os(t)?t:l2(t):void 0}class eU{constructor(){this.clicks=[]}isRageClick(t,n,s){var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(n-r.y)<30&&s-r.timestamp<1e3){if(this.clicks.push({x:t,y:n,timestamp:s}),this.clicks.length===3)return!0}else this.clicks=[{x:t,y:n,timestamp:s}];return!1}}var wle=["localhost","127.0.0.1"],fp=e=>{var t=Ft?.createElement("a");return Et(t)?null:(t.href=e,t)},yle=function(e){var t,n,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",r=[];return is(e,function(i,a){Et(i)||Et(a)||a==="undefined"||(t=encodeURIComponent((o=>o instanceof File)(i)?i.name:i.toString()),n=encodeURIComponent(a),r[r.length]=n+"="+t)}),r.join(s)},X_=function(e,t){for(var n,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;r<s.length;r++){var i=s[r].split("=");if(i[0]===t){n=i;break}}if(!Os(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch{Lt.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},L1=function(e,t,n){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[0]||"",i=s[1],a=r.split("?"),o=a[1],l=a[0],u=(o||"").split("&"),d=[],f=0;f<u.length;f++){var p=u[f].split("=");Os(p)&&(t.includes(p[0])?d.push(p[0]+"="+n):d.push(u[f]))}var g=l;return o!=null&&(g+="?"+d.join("&")),i!=null&&(g+="#"+i),g},Q_=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},jP=pi("[AutoCapture]");function B1(e,t){return t.length>e?t.slice(0,e)+"...":t}function Cle(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!Zy(t));return t}function Sle(e,t,n,s){var r=e.tagName.toLowerCase(),i={tag_name:r};WE.indexOf(r)>-1&&!n&&(r.toLowerCase()==="a"||r.toLowerCase()==="button"?i.$el_text=B1(1024,JH(e)):i.$el_text=B1(1024,eC(e)));var a=Y_(e);a.length>0&&(i.classes=a.filter(function(d){return d!==""})),is(e.attributes,function(d){var f;if((!YH(e)||["name","id","class","aria-label"].indexOf(d.name)!==-1)&&(s==null||!s.includes(d.name))&&!t&&Up(d.value)&&(f=d.name,!lr(f)||f.substring(0,10)!=="_ngcontent"&&f.substring(0,7)!=="_nghost")){var p=d.value;d.name==="class"&&(p=l2(p).join(" ")),i["attr__"+d.name]=B1(1024,p)}});for(var o=1,l=1,u=e;u=Cle(u);)o++,u.tagName===e.tagName&&l++;return i.nth_child=o,i.nth_of_type=l,i}function kle(e,t){for(var n,s,{e:r,maskAllElementAttributes:i,maskAllText:a,elementAttributeIgnoreList:o,elementsChainAsString:l}=t,u=[e],d=e;d.parentNode&&!Gu(d,"body");)$H(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var f,p=[],g={},v=!1,b=!1;if(is(u,S=>{var C=$E(S);S.tagName.toLowerCase()==="a"&&(v=S.getAttribute("href"),v=C&&v&&Up(v)&&v),wn(Y_(S),"ph-no-capture")&&(b=!0),p.push(Sle(S,i,a,o));var E=function(k){if(!$E(k))return{};var F={};return is(k.attributes,function(A){if(A.name&&A.name.indexOf("data-ph-capture-attribute")===0){var I=A.name.replace("data-ph-capture-attribute-",""),N=A.value;I&&N&&Up(N)&&(F[I]=N)}}),F}(S);Ks(g,E)}),b)return{props:{},explicitNoCapture:b};if(a||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?p[0].$el_text=JH(e):p[0].$el_text=eC(e)),v){var x,_;p[0].attr__href=v;var w=(x=fp(v))===null||x===void 0?void 0:x.host,y=qe==null||(_=qe.location)===null||_===void 0?void 0:_.host;w&&y&&w!==y&&(f=v)}return{props:Ks({$event_type:r.type,$ce_version:1},l?{}:{$elements:p},{$elements_chain:xle(p)},(n=p[0])!==null&&n!==void 0&&n.$el_text?{$el_text:(s=p[0])===null||s===void 0?void 0:s.$el_text}:{},f&&r.type==="click"?{$external_click_url:f}:{},g)}}let Ele=class{constructor(t){yt(this,"_initialized",!1),yt(this,"_isDisabledServerSide",null),yt(this,"rageclicks",new eU),yt(this,"_elementsChainAsString",!1),this.instance=t,this._elementSelectors=null}get config(){var t,n,s=Ls(this.instance.config.autocapture)?this.instance.config.autocapture:{};return s.url_allowlist=(t=s.url_allowlist)===null||t===void 0?void 0:t.map(r=>new RegExp(r)),s.url_ignorelist=(n=s.url_ignorelist)===null||n===void 0?void 0:n.map(r=>new RegExp(r)),s}_addDomEventHandlers(){if(this.isBrowserSupported()){if(qe&&Ft){var t=s=>{s=s||qe?.event;try{this._captureEvent(s)}catch(r){jP.error("Failed to capture event",r)}};if(Xs(Ft,"submit",t,{capture:!0}),Xs(Ft,"change",t,{capture:!0}),Xs(Ft,"click",t,{capture:!0}),this.config.capture_copied_text){var n=s=>{s=s||qe?.event,this._captureEvent(s,P1)};Xs(Ft,"copy",n,{capture:!0}),Xs(Ft,"cut",n,{capture:!0})}}}else jP.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({[SP]:!!t.autocapture_opt_out}),this._isDisabledServerSide=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this._elementSelectors=t}getElementSelectors(t){var n,s=[];return(n=this._elementSelectors)===null||n===void 0||n.forEach(r=>{var i=Ft?.querySelectorAll(r);i?.forEach(a=>{t===a&&s.push(r)})}),s}get isEnabled(){var t,n,s=(t=this.instance.persistence)===null||t===void 0?void 0:t.props[SP],r=this._isDisabledServerSide;if(dd(r)&&!hc(s)&&!this.instance.config.advanced_disable_decide)return!1;var i=(n=this._isDisabledServerSide)!==null&&n!==void 0?n:!!s;return!!this.instance.config.autocapture&&!i}_captureEvent(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"$autocapture";if(this.isEnabled){var s,r=qH(t);WH(r)&&(r=r.parentNode||null),n==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(s=this.rageclicks)!==null&&s!==void 0&&s.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this._captureEvent(t,"$rageclick");var i=n===P1;if(r&&ple(r,t,this.config,i,i?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:o}=kle(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString});if(o)return!1;var l=this.getElementSelectors(r);if(l&&l.length>0&&(a.$element_selectors=l),n===P1){var u,d=zH(qe==null||(u=qe.getSelection())===null||u===void 0?void 0:u.toString()),f=t.type||"clipboard";if(!d)return!1;a.$selected_content=d,a.$copy_type=f}return this.instance.capture(n,a),!0}}}isBrowserSupported(){return jo(Ft?.querySelectorAll)}};Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Ai(e)&&isFinite(e)&&Math.floor(e)===e});var HP="0123456789abcdef";let Tle=class zE{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,s,r){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(s)||!Number.isInteger(r)||t<0||n<0||s<0||r<0||t>0xffffffffffff||n>4095||s>1073741823||r>4294967295)throw new RangeError("invalid field value");var i=new Uint8Array(16);return i[0]=t/Math.pow(2,40),i[1]=t/Math.pow(2,32),i[2]=t/Math.pow(2,24),i[3]=t/Math.pow(2,16),i[4]=t/Math.pow(2,8),i[5]=t,i[6]=112|n>>>8,i[7]=n,i[8]=128|s>>>24,i[9]=s>>>16,i[10]=s>>>8,i[11]=s,i[12]=r>>>24,i[13]=r>>>16,i[14]=r>>>8,i[15]=r,new zE(i)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+HP.charAt(this.bytes[n]>>>4)+HP.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 zE(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;n<16;n++){var s=this.bytes[n]-t.bytes[n];if(s!==0)return Math.sign(s)}return 0}},Rle=class{constructor(){yt(this,"timestamp",0),yt(this,"counter",0),yt(this,"random",new Ale)}generate(){var t=this.generateOrAbort();if(Et(t)){this.timestamp=0;var n=this.generateOrAbort();if(Et(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 Tle.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 UP,tU=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};qe&&!Et(qe.crypto)&&crypto.getRandomValues&&(tU=e=>crypto.getRandomValues(e));let Ale=class{constructor(){yt(this,"buffer",new Uint32Array(8)),yt(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(tU(this.buffer),this.cursor=0),this.buffer[this.cursor++]}};var Nu=()=>Fle().toString(),Fle=()=>(UP||(UP=new Rle)).generate(),Dle="Thu, 01 Jan 1970 00:00:00 GMT",Xg="",Ile=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Nle(e,t){if(t){var n=function(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ft;if(Xg)return Xg;if(!i||["localhost","127.0.0.1"].includes(r))return"";for(var a=r.split("."),o=Math.min(a.length,8),l="dmn_chk_"+Nu(),u=new RegExp("(^|;)\\s*"+l+"=1");!Xg&&o--;){var d=a.slice(o).join("."),f=l+"=1;domain=."+d;i.cookie=f,u.test(i.cookie)&&(i.cookie=f+";expires="+Dle,Xg=d)}return Xg}(e);if(!n){var s=(r=>{var i=r.match(Ile);return i?i[0]:""})(e);s!==n&&Lt.info("Warning: cookie subdomain discovery mismatch",s,n),n=s}return n?"; domain=."+n:""}return""}var ku,_c={is_supported:()=>!!Ft,error:function(e){Lt.error("cookieStore error: "+e)},get:function(e){if(Ft){try{for(var t=e+"=",n=Ft.cookie.split(";").filter(i=>i.length),s=0;s<n.length;s++){for(var r=n[s];r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(t)===0)return decodeURIComponent(r.substring(t.length,r.length))}}catch{}return null}},parse:function(e){var t;try{t=JSON.parse(_c.get(e))||{}}catch{}return t},set:function(e,t,n,s,r){if(Ft)try{var i="",a="",o=Nle(Ft.location.hostname,s);if(n){var l=new Date;l.setTime(l.getTime()+24*n*60*60*1e3),i="; expires="+l.toUTCString()}r&&(a="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+i+"; SameSite=Lax; path=/"+o+a;return u.length>3686.4&&Lt.warn("cookieStore warning: large cookie, len="+u.length),Ft.cookie=u,u}catch{return}},remove:function(e,t){try{_c.set(e,"",-1,t)}catch{return}}},j1=null,gr={is_supported:function(){if(!dd(j1))return j1;var e=!0;if(Et(qe))e=!1;else try{var t="__mplssupport__";gr.set(t,"xyz"),gr.get(t)!=='"xyz"'&&(e=!1),gr.remove(t)}catch{e=!1}return e||Lt.error("localStorage unsupported; falling back to cookie store"),j1=e,e},error:function(e){Lt.error("localStorage error: "+e)},get:function(e){try{return qe?.localStorage.getItem(e)}catch(t){gr.error(t)}return null},parse:function(e){try{return JSON.parse(gr.get(e))||{}}catch{}return null},set:function(e,t){try{qe?.localStorage.setItem(e,JSON.stringify(t))}catch(n){gr.error(n)}},remove:function(e){try{qe?.localStorage.removeItem(e)}catch(t){gr.error(t)}}},Ple=["distinct_id",z_,Am,K_,VE],Vb=Ze(Ze({},gr),{},{parse:function(e){try{var t={};try{t=_c.parse(e)||{}}catch{}var n=Ks(t,JSON.parse(gr.get(e)||"{}"));return gr.set(e,n),n}catch{}return null},set:function(e,t,n,s,r,i){try{gr.set(e,t,void 0,void 0,i);var a={};Ple.forEach(o=>{t[o]&&(a[o]=t[o])}),Object.keys(a).length&&_c.set(e,a,n,s,r,i)}catch(o){gr.error(o)}},remove:function(e,t){try{qe?.localStorage.removeItem(e),_c.remove(e,t)}catch(n){gr.error(n)}}}),Wb={},Mle={is_supported:function(){return!0},error:function(e){Lt.error("memoryStorage error: "+e)},get:function(e){return Wb[e]||null},parse:function(e){return Wb[e]||null},set:function(e,t){Wb[e]=t},remove:function(e){delete Wb[e]}},Pd=null,Gr={is_supported:function(){if(!dd(Pd))return Pd;if(Pd=!0,Et(qe))Pd=!1;else try{var e="__support__";Gr.set(e,"xyz"),Gr.get(e)!=='"xyz"'&&(Pd=!1),Gr.remove(e)}catch{Pd=!1}return Pd},error:function(e){Lt.error("sessionStorage error: ",e)},get:function(e){try{return qe?.sessionStorage.getItem(e)}catch(t){Gr.error(t)}return null},parse:function(e){try{return JSON.parse(Gr.get(e))||null}catch{}return null},set:function(e,t){try{qe?.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){Gr.error(n)}},remove:function(e){try{qe?.sessionStorage.removeItem(e)}catch(t){Gr.error(t)}}};(function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"})(ku||(ku={}));let Ole=class{constructor(t){this.instance=t}get config(){return this.instance.config}get consent(){return this.getDnt()?ku.DENIED:this.storedConsent}isOptedOut(){return this.consent===ku.DENIED||this.consent===ku.PENDING&&this.config.opt_out_capturing_by_default}isOptedIn(){return!this.isOptedOut()}optInOut(t){this.storage.set(this.storageKey,t?1:0,this.config.cookie_expiration,this.config.cross_subdomain_cookie,this.config.secure_cookie)}reset(){this.storage.remove(this.storageKey,this.config.cross_subdomain_cookie)}get storageKey(){var{token:t,opt_out_capturing_cookie_prefix:n}=this.instance.config;return(n||"__ph_opt_in_out_")+t}get storedConsent(){var t=this.storage.get(this.storageKey);return t==="1"?ku.GRANTED:t==="0"?ku.DENIED:ku.PENDING}get storage(){if(!this._storage){var t=this.config.opt_out_capturing_persistence_type;this._storage=t==="localStorage"?gr:_c;var n=t==="localStorage"?_c:gr;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&&!!HH([va?.doNotTrack,va?.msDoNotTrack,nn.doNotTrack],t=>wn([!0,1,"1","yes"],t))}};var $b=pi("[Dead Clicks]"),Lle=()=>!0,Ble=e=>{var t,n=!((t=e.instance.persistence)===null||t===void 0||!t.get_property(GH)),s=e.instance.config.capture_dead_clicks;return hc(s)?s:n};let nU=class{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(t,n,s){this.instance=t,this.isEnabled=n,this.onCapture=s,this.startIfEnabled()}onRemoteConfig(t){this.instance.persistence&&this.instance.persistence.register({[GH]:t?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript(()=>{this.start()})}loadScript(t){var n,s,r;(n=nn.__PosthogExtensions__)!==null&&n!==void 0&&n.initDeadClicksAutocapture&&t(),(s=nn.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"dead-clicks-autocapture",i=>{i?$b.error("failed to load script",i):t()})}start(){var t;if(Ft){if(!this._lazyLoadedDeadClicksAutocapture&&(t=nn.__PosthogExtensions__)!==null&&t!==void 0&&t.initDeadClicksAutocapture){var n=Ls(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=nn.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this._lazyLoadedDeadClicksAutocapture.start(Ft),$b.info("starting...")}}else $b.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,$b.info("stopping..."))}};var H1=pi("[ExceptionAutocapture]");let jle=class{constructor(t){var n;yt(this,"startCapturing",()=>{var s;if(qe&&this.isEnabled&&(s=nn.__PosthogExtensions__)!==null&&s!==void 0&&s.errorWrappingFunctions){var r=nn.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=nn.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,a=nn.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.unwrapOnError&&this.config.capture_unhandled_errors&&(this.unwrapOnError=r(this.captureException.bind(this))),!this.unwrapUnhandledRejection&&this.config.capture_unhandled_rejections&&(this.unwrapUnhandledRejection=i(this.captureException.bind(this))),!this.unwrapConsoleError&&this.config.capture_console_errors&&(this.unwrapConsoleError=a(this.captureException.bind(this)))}catch(o){H1.error("failed to start",o),this.stopCapturing()}}}),this.instance=t,this.remoteEnabled=!((n=this.instance.persistence)===null||n===void 0||!n.props[kP]),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 Ls(t)?n=Ze(Ze({},n),t):(Et(t)?this.remoteEnabled:t)&&(n=Ze(Ze({},n),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),n}get isEnabled(){return this.config.capture_console_errors||this.config.capture_unhandled_errors||this.config.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(H1.info("enabled"),this.loadScript(this.startCapturing))}loadScript(t){var n,s,r;(n=nn.__PosthogExtensions__)!==null&&n!==void 0&&n.errorWrappingFunctions&&t(),(s=nn.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"exception-autocapture",i=>{if(i)return H1.error("failed to load script",i);t()})}stopCapturing(){var t,n,s;(t=this.unwrapOnError)===null||t===void 0||t.call(this),this.unwrapOnError=void 0,(n=this.unwrapUnhandledRejection)===null||n===void 0||n.call(this),this.unwrapUnhandledRejection=void 0,(s=this.unwrapConsoleError)===null||s===void 0||s.call(this),this.unwrapConsoleError=void 0}onRemoteConfig(t){var n=t.autocaptureExceptions;this.remoteEnabled=!!n||!1,this.config=this.requiredConfig(),this.instance.persistence&&this.instance.persistence.register({[kP]: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 sU(e){return!Et(Event)&&rU(e,Event)}function rU(e,t){try{return e instanceof t}catch{return!1}}function t_(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function U1(e){return t_(e,"DOMError")}var GP=/\(error: (.*)\)/,VP=50,rp="?";function G1(e,t,n,s){var r={platform:"web:javascript",filename:e,function:t==="<anonymous>"?rp:t,in_app:!0};return Et(n)||(r.lineno=n),Et(s)||(r.colno=s),r}var Hle=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ule=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Gle=/\((\S*)(?::(\d+))(?::(\d+))\)/,Vle=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Wle=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,$le=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var s=t.sort((r,i)=>r[0]-i[0]).map(r=>r[1]);return function(r){for(var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=[],o=r.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./agent-details-page-CdnNoAG1.js","./index-BcwoLiEJ.js","./messages-CvRfSjnp.js","./index-CaftKcJ-.css","./publication-validation-LHyYGXxk.js","./appearance-DxToWtVc.js","./roles-D1pcbxAx.js","./conversation-input-sync-BGfWeOqy.js","./error-boundary-CtkXM619.js","./conversation-input-sync-BmGWvjex.css","./use-download-agent-mutation-BimCWRpf.js","./book-open-AjJXGzb6.js","./en-US-CW_dDnkH.js","./heart-mTaKHtD-.js","./console-mirror-CUiw0R0Z.js","./console-mirror-DOrYoP_4.css","./agent-hub-page-DzJe_j6z.js","./page-header-CyxvZBjK.js","./org-access-mvMfl6RO.js","./radient-auth-buttons-CjpUv3nP.js","./org-surface-gate-DG0gOjUM.js","./building-2-DrbuKv4e.js","./agents-page-B8ehgi1r.js","./avatar-cropper-CCvczwaj.js","./log-in-Cz3YBOsh.js","./project-markdown-C7j9JEv7.js","./schedules-page-DWG-H1tc.js","./parseISO-CxPiCKvF.js","./projects-page-Cy7ci4iQ.js","./use-session-snapshot-D90Nwywl.js","./library-page-1Q4ToZpC.js","./notifications-page-DLvG89Rx.js","./team-bridge-page-DyGy6Kbj.js","./team-bridge-scope-preference-DMVpYrdA.js","./browser-page-B1LNZlf_.js","./mesh-page-B2xAXfjA.js","./settings-page-Cc3TAlMl.js","./notebook-pen-DadCKhKK.js","./browser-webauthn-prompt-D7ldFLmy.js"])))=>i.map(i=>d[i]);
2
+ import{r as m,j as c,c as R,b as st,m as zI,x as AQ,E as FQ,w as DQ,F as IQ,u as Fu,G as NQ,H as PQ,I as MQ,R as OQ}from"./index-BcwoLiEJ.js";import{t as h,c as $m,a as LQ,L as yl,b as BQ}from"./messages-CvRfSjnp.js";import{b4 as jQ,b5 as A_,b6 as k5,b7 as E5,u as Rt,b8 as HQ,b9 as UQ,ba as GQ,bb as VQ,bc as WQ,bd as $Q,be as qI,bf as KI,bg as zQ,bh as qQ,w as Ie,bi as KQ,bj as YI,bk as wy,bl as Ud,h as Rn,a as Hn,c as gt,e as Gv,n as T5,o as Yr,a0 as R5,bm as La,a9 as fg,ae as A5,F as qa,d as nt,bn as YQ,bo as XI,bp as d1,bq as F5,br as lE,at as cE,bs as XQ,L as Pi,r as Vv,bt as Zf,bu as D5,bv as QQ,g as ea,bw as h1,ac as Wv,K as Wo,E as et,bx as I5,by as N5,bz as yy,bA as uE,bB as JQ,S as zm,bC as P5,bD as ZQ,bE as eJ,bF as tJ,X as qu,bG as nJ,V as wA,Q as $v,bH as f1,bI as Jt,bJ as F_,bK as QI,bL as dE,R as sJ,bM as rJ,bN as iJ,bO as aJ,f as M5,bP as oJ,bQ as lJ,bR as cJ,q as vr,bS as bc,aY as Cy,b as O5,bT as JI,bU as uJ,bV as ZI,bW as dJ,bX as yA,a7 as hJ,bY as fJ,bZ as pJ,b_ as gJ,b$ as mJ,c0 as eN,v as CA,c1 as L5,ao as vJ,c2 as tN,c3 as Sy,c4 as bJ,c5 as xJ,c6 as _J,c7 as wJ,c8 as yJ,c9 as B5,ca as p1,cb as km,cc as CJ,cd as j5,ce as SJ,cf as nN,cg as sN,ch as $x,ci as zx,cj as hE,a4 as SA,ck as H5,cl as kJ,a3 as EJ,a2 as TJ,cm as RJ,cn as rN,co as AJ,cp as Nd,cq as Ib,cr as FJ,cs as DJ,ct as IJ,cu as iN,cv as aN,cw as NJ,cx as PJ,cy as MJ,cz as OJ,cA as oN,cB as lN,cC as cN,cD as uN,cE as LJ,cF as BJ,cG as jJ,cH as HJ,cI as UJ,cJ as dN,cK as GJ,cL as VJ,cM as WJ,cN as D_,cO as $J,cP as hN,cQ as zJ,cR as qJ,cS as KJ,cT as YJ,cU as Nb,cV as XJ,cW as QJ,cX as JJ,cY as ZJ,cZ as U5,c_ as eZ,a5 as kA,b3 as fN,c$ as tZ,d0 as nZ,d1 as sZ,b2 as rZ,aB as G5,aD as iZ,d2 as pN,t as gN,d3 as qm,d4 as aZ,d5 as oZ,d6 as mN,d7 as lZ,d8 as Pb,d9 as vN,da as cZ,db as Mb,dc as uZ,dd as Ob,de as bN,df as dZ,dg as hZ,dh as xN,di as Lb,dj as _N,dk as Bb,dl as qx,x as I_,y as V5,z as fZ,ap as fE,dm as pZ,dn as gZ,dp as mZ,dq as vZ,dr as bZ,ds as xZ,dt as _Z,du as wZ,dv as W5,dw as yZ,a1 as zv,dx as CZ,dy as EA,aa as SZ,dz as kZ,dA as EZ,a8 as TZ,dB as RZ,dC as AZ,dD as wN,aE as FZ,dE as g1,dF as yN,dG as DZ,dH as IZ,dI as NZ,dJ as PZ,dK as MZ,dL as OZ,dM as CN,U as LZ,dN as BZ,dO as jZ,dP as HZ,dQ as UZ,A as GZ,dR as VZ,J as Ae,ah as jb,a6 as WZ,dS as $5,dT as $Z,dU as zZ,dV as qZ,dW as KZ,dX as ky,dY as TA,dZ as z5,d_ as q5,m as YZ,d$ as XZ,aZ as QZ,e0 as JZ,e1 as SN,e2 as ZZ,e3 as m1,e4 as eee,as as tee,e5 as nee,e6 as see,ag as ree,e7 as kN,e8 as iee,e9 as pr,$ as EN,ea as aee,eb as TN,ec as oee,ed as K5,ee as RN,ef as lee,B as Y5,C as cee}from"./appearance-DxToWtVc.js";import{u as Ge,c as vt,z as cd,S as Mn,G as Yo,B as ce,L as cr,K as vs,T as RA,a as Zs,X as Kn,af as pE,ay as uee,n as Hc,o as Uc,p as Dl,J as Qi,k as Di,r as pg,s as jp,aj as qv,w as mt,a6 as gg,y as Ey,A as Ar,F as Ty,R as P0,U as M0,V as O0,W as L0,Y as B0,D as $o,b as ao,d as zo,H as AN,I as Mr,e as en,g as Kv,i as Ku,j as N_,az as v1,am as X5,N as Q5,O as J5,P as gE,f as Kx,aA as cp,ax as dee,a7 as Rh,a8 as Ry,a9 as Yu,aB as hee,_ as P_,t as Z5,ab as Ay,v as Fy,aC as fee,Z as AA,C as FN,aa as pee,ai as mE,h as gee,aD as Kg,at as FA,$ as DA,Q as mee,ac as vee,ad as bee,ae as xee,l as _ee,m as wee,ag as yee,ah as Cee,av as See,aw as kee,aE as e8,ar as ep,q as DN,x as IN,aF as Du,E as Eee}from"./error-boundary-CtkXM619.js";import{d4 as Yx,c6 as ju,aB as xa,cD as IA,b6 as co,b7 as er,aH as sn,bx as on,aA as Hs,aW as Gc,bB as Yv,d5 as Tee,bC as Xv,gu as t8,gv as Ree,gw as j0,gx as Aee,gy as Fee,gz as Dee,gA as Iee,gB as b1,gC as x1,a1 as Iu,cL as Dy,fh as ud,e$ as Xx,e_ as Nee,eZ as Er,f0 as kn,gD as n8,gE as Pee,cq as vE,bE as Xh,bF as Iy,f6 as Ny,fB as Mee,gF as NN,gG as Oee,gH as Lee,gI as bE,gJ as Bee,gK as jee,gL as Hee,gM as Uee,gN as M_,a$ as O_,bl as up,gO as PN,gP as MN,X as H0,gQ as Gee,gR as Vee,gS as Wee,gT as s8,gU as $ee,gV as zee,gW as r8,gX as Py,gY as My,gZ as qee,g_ as Kee,g$ as Yee,h0 as ON,h1 as Xee,h2 as Qee,h3 as Jee,h4 as Zee,h5 as ete,h6 as tte,h7 as nte,h8 as ste,cV as i8,h9 as rte,ha as a8,hb as ite,hc as LN,hd as ate,he as ote,cS as ui,hf as U0,ex as o8,hg as lte,hh as cte,hi as BN,hj as ute,hk as dte,hl as hte,hm as fte,hn as pte,a3 as Kd,cg as l8,ho as Km,hp as c8,hq as gte,hr as mte,hs as vte,ht as bte,hu as xte,hv as _te,hw as wte,c4 as Xu,hx as Qu,hy as yte,b3 as mg,hz as jN,hA as Cte,hB as Ste,hC as kte,hD as Ete,hE as Tte,hF as Rte,hG as Wf,ft as Ate,hH as Fte,hI as Dte,fw as Ite,hJ as Nte,hK as Pte,hL as u8,et as _1,hM as Oy,bH as d8,hN as Ly,hO as Mte,cp as xE,bz as NA,fI as Bo,dS as Fi,hP as h8,a2 as xc,hQ as f8,c5 as Ah,cK as By,hR as p8,cJ as G0,hS as Ote,cb as Ju,cN as jy,fo as Lte,hT as w1,hU as Bte,hV as jte,hW as Hte,hX as Ute,hY as Gte,hZ as Vte,h_ as Wte,h$ as $te,i0 as zte,i1 as HN,i2 as qte,i3 as Kte,i4 as PA,i5 as UN,fy as Yte,i6 as Xte,i7 as g8,i8 as Qte,i9 as Jte,ia as m8,ib as _E,ic as Zte,dA as dp,id as vg,ie as GN,ig as y1,ih as ene,cO as Hy,ii as tne,ij as v8,ik as wE,il as nne,im as b8,io as sne,ip as L_,iq as rne,ir as ine,is as ane,it as one,iu as lne,iv as cne,iw as une,bg as Rs,ix as x8,bf as Po,iy as _8,iz as dne,iA as hne,iB as VN,iC as w8,iD as y8,iE as C8,c8 as MA,e3 as S8,iF as Zu,iG as k8,y as ft,iH as Yn,iI as B_,iJ as yn,iK as E8,iL as T8,iM as OA,iN as j_,iO as R8,iP as Uy,iQ as Qv,iR as Fh,O as LA,iS as yE,iT as BA,iU as C1,iV as Gy,iW as fne,iX as uo,iY as pne,iZ as gne,i_ as tp,i$ as CE,j0 as A8,j1 as mne,j2 as V0,j3 as Vy,j4 as jA,j5 as vne,j6 as bne,j7 as xne,j8 as Pn,j9 as W0,ja as F8,jb as Ya,jc as _ne,jd as wne,je as D8,jf as yne,jg as Cne,jh as Sne,ji as kne,jj as Ene,jk as Tne,jl as Rne,jm as Ane,jn as Fne,jo as Dne,jp as Ine,jq as Nne,jr as Pne,js as Mne,jt as One,ju as Lne,jv as Bne,jw as HA,jx as jne,jy as WN,jz as UA,jA as Hne,jB as I8,jC as N8,jD as GA,jE as Une,cU as P8,db as Wy,de as $y,jF as zy,jG as bg,cC as M8,cF as Gne,dM as $N,cc as O8,dQ as Vne,dF as Wne,jH as $ne,dG as zne,dH as qne,dI as Kne,dJ as Yne,dK as Xne,dL as Qne,bj as Ur,dT as Jne,jI as Zne,jJ as ese,jK as tse,dU as nse,dP as sse,dR as rse,jL as ise,jM as L8,jN as ase,jO as ose,jP as $0,jQ as VA,jR as qy,jS as WA,jT as lse,jU as cse,jV as use,jW as B8,jX as dse,jY as zN,jZ as hse,j_ as $A,j$ as fse,k0 as zA,k1 as Jv,k2 as Zv,k3 as pse,k4 as j8,k5 as z0,k6 as gse,k7 as mse,k8 as vse,k9 as bse,ka as xse,kb as _se,kc as qN,fQ as H8,r as U8,fR as wse,kd as yse,ke as Cse,kf as Sse,cR as kse,kg as Ese,kh as gc,ki as KN,kj as Ym,kk as Yg,kl as Tse,km as YN,kn as XN,ko as Rse,ae as G8,cx as Xm,kp as Ase,kq as Fse,kr as Ky,dh as Dse,by as xg,ks as Ise,kt as SE,ku as Nse,kv as Pse,bD as Mi,bw as Yy,dj as _g,dk as V8,kw as qA,cG as W8,kx as Mse,dt as Ose,ky as Lse,kz as Bse,kA as $8,kB as jse,kC as Hu,kD as KA,a5 as YA,kE as Hse,ct as XA,cu as Xy,kF as Use,cs as Hp,di as S1,kG as Gse,kH as Vse,kI as Wse,kJ as $se,fk as zse,fl as qse,fm as Kse,fn as nc,kK as QN,kL as Yse,cA as Xse,kM as Qse,kN as Jse,kO as Zse,kP as ere,kQ as tre,kR as nre,kS as kE,e7 as z8,e8 as H_,kT as sre,kU as q8,cX as rre,cT as ire,kV as are,kW as K8,kX as ore,kY as lre,c$ as cre,kZ as ure,k_ as dre,k$ as hre,l0 as fre,l1 as pre,l2 as gre,fg as mre,a0 as vre,l3 as Y8,l4 as bre,l5 as xre,l6 as Hb,l7 as X8,fd as _re,l8 as wre,l9 as Q8,la as yre,lb as uh,g4 as J8,g5 as QA,lc as Cre,ld as Sre,le as kre,lf as Z8,M as Ere,lg as Tre,bm as eH,g3 as Rre,lh as Are,ca as tH,li as Fre,lj as Dre,a6 as Ire,lk as Nre,ll as Pre,lm as Mre,ln as Ore,lo as Lre,lp as JN,lq as k1,lr as Bre,cd as E1,ce as T1,cf as R1,bk as jre,ls as Hre,lt as Ure,lu as Gre,d1 as kf,lv as Ef,lw as Vre,lx as Wre,ly as $re,lz as zre,lA as qre,lB as Kre,lC as nH,lD as Yre,lE as sH,lF as EE,lG as TE,lH as A1,lI as Xre,lJ as Qre,lK as $f,lL as Jre,b1 as ZN,lM as eP,lN as rH,lO as RE,lP as iH,lQ as aH,lR as Zre,lS as eie,lT as tie,lU as nie,lV as sie,lW as rie,lX as iie,lY as aie,lZ as oie,l_ as lie,l$ as cie,m0 as uie,m1 as die,m2 as hie,m3 as fie,m4 as pie,m5 as gie,m6 as mie,ac as vie,a8 as bie,ad as tP,aa as xie,a9 as _ie,m7 as wie,m8 as yie,m9 as Cie,ma as Sie,mb as kie,mc as Eie,md as Tie,ba as Rie,bb as Aie,bc as Fie,bd as Die,be as Iie,me as Nie,mf as Pie,mg as Mie,mh as nP,dw as Kr,e0 as Bt,dV as oH,aT as Dc,aU as AE,ep as JA,es as ZA,mi as Oie,mj as lH,mk as Lie,ml as Bie,mm as jie,eX as Hie,mn as Uie,mo as Gie,mp as cH,mq as Vie,eY as sP,eu as e2,mr as t2,dv as hp,fx as uH,eE as dH,eB as Wie,ek as $ie,eK as zie,dn as qie,dm as rP,eL as Kie,dp as Yie,el as Xie,eq as Qie,eR as Jie,eS as Zie,eT as hH,ms as n2,mt as eae,bG as fH,mu as pH,mv as tae,mw as nae,mx as sae,my as si,mz as rae,mA as _u,mB as gH,mC as mH,mD as vH,mE as s2,mF as ha,mG as iae,mH as aae,mI as oae,mJ as lae,mK as cae,mL as uae,mM as dae,mN as hae,S as fae,mO as pae,d6 as gae,mP as bH,mQ as mae,mR as vae,mS as bae,mT as xae,mU as _ae,mV as FE,mW as wae,mX as yae,mY as iP,mZ as xH,m_ as Cae,m$ as Sae,n0 as kae,n1 as aP,n2 as Eae,n3 as Tae,n4 as Rae,n5 as Aae,n6 as Fae,n7 as Dae,n8 as Iae,n9 as Nae,na as r2,nb as Pae,nc as oP,nd as Gd,ne as _H,nf as DE,ng as U_,nh as Mae,ni as Oae,nj as Ub,nk as Em,nl as i2,nm as wH,nn as Lae,no as Bae,np as jae,nq as yH,nr as Hae,ns as Uae,ff as G_,nt as Gae,nu as lP,nv as Vae,nw as Wae,nx as $ae,ny as zae,nz as qae,nA as Kae,nB as Yae,fC as cP,nC as CH,nD as SH,nE as Xae,nF as Qae,dx as Jae,nG as Zae,fD as eoe,nH as toe,nI as noe,b4 as soe,cz as ka,nJ as roe,nK as ioe,nL as aoe,nM as ooe,nN as loe,nO as Tf,nP as coe,nQ as uoe,nR as V_,nS as doe,nT as hoe,nU as F1,nV as D1,nW as uP,nX as I1,nY as dP,nZ as kH,n_ as foe,bv as poe,n$ as EH,o0 as goe,bq as moe,br as voe,bo as boe,bp as xoe,o1 as _oe,bs as woe}from"./conversation-input-sync-BGfWeOqy.js";import{u as TH,o as wg,b as yoe,c as Coe,r as RH,d as AH,e as q0,f as Soe,g as koe,s as a2,n as W_,h as Eoe,i as Toe,p as Roe,j as Aoe,k as Foe,l as Doe,q as Ioe,v as Noe,w as hP,x as fP,y as Poe,z as Moe,A as Ooe,C as Loe,B as Boe,D as joe,E as FH,F as DH,M as Hoe,G as Uoe,H as Goe}from"./console-mirror-CUiw0R0Z.js";import"./roles-D1pcbxAx.js";function pP(e,t){return e.filter(n=>!t.includes(n))}function Voe(e,t,n){const s=e.slice(0);return s[t]=n,s}var Woe=class extends jQ{#s;#e;#r;#i;#t;#n;#a;#o;#l=[];constructor(e,t,n){super(),this.#s=e,this.#i=n,this.#r=[],this.#t=[],this.#e=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#t.forEach(e=>{e.subscribe(t=>{this.#h(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#t.forEach(e=>{e.destroy()})}setQueries(e,t){this.#r=e,this.#i=t,A_.batch(()=>{const n=this.#t,s=this.#d(this.#r);this.#l=s,s.forEach(o=>o.observer.setOptions(o.defaultedQueryOptions));const r=s.map(o=>o.observer),i=r.map(o=>o.getCurrentResult()),a=r.some((o,l)=>o!==n[l]);n.length===r.length&&!a||(this.#t=r,this.#e=i,this.hasListeners()&&(pP(n,r).forEach(o=>{o.destroy()}),pP(r,n).forEach(o=>{o.subscribe(l=>{this.#h(o,l)})}),this.#f()))})}getCurrentResult(){return this.#e}getQueries(){return this.#t.map(e=>e.getCurrentQuery())}getObservers(){return this.#t}getOptimisticResult(e,t){const n=this.#d(e),s=n.map(r=>r.observer.getOptimisticResult(r.defaultedQueryOptions));return[s,r=>this.#u(r??s,t),()=>this.#c(s,n)]}#c(e,t){return t.map((n,s)=>{const r=e[s];return n.defaultedQueryOptions.notifyOnChangeProps?r:n.observer.trackResult(r,i=>{t.forEach(a=>{a.observer.trackProp(i)})})})}#u(e,t){return t?((!this.#n||this.#e!==this.#o||t!==this.#a)&&(this.#a=t,this.#o=this.#e,this.#n=k5(this.#n,t(e))),this.#n):e}#d(e){const t=new Map(this.#t.map(s=>[s.options.queryHash,s])),n=[];return e.forEach(s=>{const r=this.#s.defaultQueryOptions(s),i=t.get(r.queryHash);i?n.push({defaultedQueryOptions:r,observer:i}):n.push({defaultedQueryOptions:r,observer:new E5(this.#s,r)})}),n}#h(e,t){const n=this.#t.indexOf(e);n!==-1&&(this.#e=Voe(this.#e,n,t),this.#f())}#f(){if(this.hasListeners()){const e=this.#n,t=this.#c(this.#e,this.#l),n=this.#u(t,this.#i?.combine);e!==n&&A_.batch(()=>{this.listeners.forEach(s=>{s(this.#e)})})}}};function IH({queries:e,...t},n){const s=Rt(n),r=HQ(),i=UQ(),a=m.useMemo(()=>e.map(b=>{const x=s.defaultQueryOptions(b);return x._optimisticResults=r?"isRestoring":"optimistic",x}),[e,s,r]);a.forEach(b=>{GQ(b),VQ(b,i)}),WQ(i);const[o]=m.useState(()=>new Woe(s,a,t)),[l,u,d]=o.getOptimisticResult(a,t.combine),f=!r&&t.subscribed!==!1;m.useSyncExternalStore(m.useCallback(b=>f?o.subscribe(A_.batchCalls(b)):$Q,[o,f]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),m.useEffect(()=>{o.setQueries(a,t)},[a,t,o]);const g=l.some((b,x)=>qI(a[x],b))?l.flatMap((b,x)=>{const _=a[x];if(_){const w=new E5(s,_);if(qI(_,b))return KI(_,w,i);zQ(b,r)&&KI(_,w,i)}return[]}):[];if(g.length>0)throw Promise.all(g);const v=l.find((b,x)=>{const _=a[x];return _&&qQ({result:b,errorResetBoundary:i,throwOnError:_.throwOnError,query:s.getQueryCache().get(_.queryHash),suspense:_.suspense})});if(v?.error)throw v.error;return u(d())}function gP(e,t){return e.findAll(t.filters).map(n=>t.select?t.select(n):n.state)}function $oe(e={},t){const n=Rt(t).getMutationCache(),s=m.useRef(e),r=m.useRef(null);return r.current||(r.current=gP(n,e)),m.useEffect(()=>{s.current=e}),m.useSyncExternalStore(m.useCallback(i=>n.subscribe(()=>{const a=k5(r.current,gP(n,s.current));r.current!==a&&(r.current=a,A_.schedule(i))}),[n]),()=>r.current,()=>r.current)}const Qx=8e3,NH=1e4;function zoe(e){return e?h("ui.notices.chat.archive_offered_title",{title:e}):h("ui.notices.chat.archive_offered_no_name")}const qoe=()=>h("ui.notices.chat.archive_offered_verb");function Koe(e){return Ie.getState().archiveFacts[e]}function Yoe(e){const t=Ie.getState(),n=t.archiveFacts[e];return n?n.archived:t.sessions.find(s=>s.session_id===e)?.archived}function Xoe(){const e=Ie(t=>t.archiveUndo);m.useEffect(()=>{if(e===null)return;let t=!1;const n=()=>{t||(t=!0,r())},s=()=>{n();const i=Ie.getState().archiveUndo;i!==null&&i.sessionId===e.sessionId&&i.at===e.at&&Ie.getState().setArchiveUndo(null)},r=Ie.subscribe(()=>{const i=Koe(e.sessionId);i!==void 0&&!i.answered||KQ(e.archived,Yoe(e.sessionId))||s()});return n},[e])}function Qoe(e){return h("ui.notices.chat.drafts_offered_name",{count:e})}const Joe=e=>h("ui.notices.chat.drafts_offered_verb",{count:e}),Zoe=e=>{const t=YI(e),n=t.length,s=t.filter(o=>!o.active).length,r=n===1?"chat":"chats",i=e.filter(o=>wy(o)!==null&&YI([o]).length===0).length,a=[`Mark ${n} unread ${r} as read${s>0?`, including ${s} in Previous chats`:""}.`];return i>0&&a.push(`${i} unread ${i===1?"mark":"marks"} with no completion token cannot be cleared.`),{count:n,label:`Mark all ${n} read`,scope:a.join(" "),nameSuffix:s>0?`, including ${s} in Previous chats`:""}},PH=e=>h("ui.notices.chat.mark_all_read_deferred",{count:e}),ele=e=>{if(e.attempted===0)return{tone:"success",message:h("ui.notices.chat.mark_all_read_nothing")};const t=e.unknown-e.deferred,n=[e.superseded>0?h("ui.notices.chat.mark_all_read_superseded",{count:e.superseded}):null,t>0?h("ui.notices.chat.mark_all_read_unknown",{count:t}):null,e.deferred>0?PH(e.deferred):null].filter(s=>s!==null);return e.cleared===0?{tone:"warning",message:[h("ui.notices.chat.mark_all_read_none_cleared"),...n].join(" ")}:{tone:"success",message:[h("ui.notices.chat.mark_all_read_cleared",{count:e.cleared}),...n].join(" ")}},N1="archive",mP="drafts-undo",vP="bulk-read-deferral",tle=8e3;function nle(){const e=Ge(),t=Ie(b=>b.archiveFailure),n=Ie(b=>b.archiveUndo),s=Ie(b=>b.draftsUndo),r=Ie(b=>b.bulkReadDeferral),i=Ie(b=>b.clearArchiveFailure),a=Ie(b=>b.setArchiveUndo),o=Ie(b=>b.setSessionArchived),l=Ie(b=>b.restoreDraftsUndo);Xoe();const u=Ud(t?.title),d=m.useRef(null),f=m.useRef(null);m.useEffect(()=>{if(t===null&&n===null){if(d.current===null)return;d.current=null,f.current=null,Yx(N1);return}const b=t&&n?n.at>t.at?"offer":"failure":t?"failure":"offer",x=b==="offer"?n?.at??0:t?.at??0,_=d.current;d.current={kind:b,at:x},_!==null&&_.kind!==b&&x>_.at&&(b==="failure"?a(null):i());const w=(y,S)=>()=>{const C=Ie.getState();y==="offer"?C.archiveUndo?.at===S&&C.setArchiveUndo(null):C.archiveFailure?.at===S&&C.clearArchiveFailure();const E=d.current;E!==null&&E.kind===y&&E.at===S&&(d.current=null)};if(b==="failure"&&t){const y=f.current,S=y!==null&&y.kind==="failure"&&y.at===t.at;if(S&&y.locale===e)return;const C=S?y.raisedAt+y.duration-Date.now():NH;if(C<=0)return;f.current=S?{...y,locale:e}:{kind:"failure",at:t.at,raisedAt:Date.now(),duration:C,locale:e},ju(`${t.archived?h("ui.notices.chat.archive_failed",{title:u}):h("ui.notices.chat.unarchive_failed",{title:u})}${t.detail?` ${t.detail}`:""}`,{id:N1,duration:C,onAutoClose:w("failure",t.at),onDismiss:w("failure",t.at),action:{label:h("ui.common.actions.retry"),onClick:E=>{E.preventDefault(),o(t.sessionId,t.archived,t.title)}}});return}if(n){const y=f.current,S=y!==null&&y.kind==="offer"&&y.at===n.at;if(S&&y.locale===e)return;const C=S?y.raisedAt+y.duration-Date.now():Qx;if(C<=0)return;f.current=S?{...y,locale:e}:{kind:"offer",at:n.at,raisedAt:Date.now(),duration:C,locale:e},xa(c.jsxs("span",{className:R("flex min-w-0 items-baseline gap-1"),children:[c.jsx("span",{className:R("min-w-0 truncate"),children:zoe(n.title)}),c.jsx("span",{className:R("shrink-0"),children:qoe()})]}),{id:N1,duration:C,classNames:{content:"min-w-0"},onAutoClose:w("offer",n.at),onDismiss:w("offer",n.at),action:{label:h("ui.notices.chat.undo"),onClick:E=>{E.preventDefault(),o(n.sessionId,!n.archived,n.title)}}})}},[e,u,t,n,a,i,o]);const p=m.useRef(!1),g=m.useRef(null);m.useEffect(()=>{if(s===null){if(!p.current)return;p.current=!1,g.current=null,Yx(mP);return}p.current=!0;const b=g.current,x=b!==null&&b.at===s.at;if(x&&b.locale===e)return;const _=x?b.raisedAt+Qx-Date.now():Qx;if(_<=0)return;g.current=x?{...b,locale:e}:{at:s.at,raisedAt:Date.now(),locale:e};const w=()=>{const y=Ie.getState();y.draftsUndo?.at===s.at&&(y.setDraftsUndo(null),p.current=!1)};xa(c.jsxs("span",{className:R("flex min-w-0 items-baseline gap-1"),children:[c.jsx("span",{className:R("min-w-0 truncate"),children:Qoe(s.keys.length)}),c.jsx("span",{className:R("shrink-0"),children:Joe(s.keys.length)})]}),{id:mP,duration:_,classNames:{content:"min-w-0"},onAutoClose:w,onDismiss:w,action:{label:h("ui.notices.chat.undo"),onClick:y=>{y.preventDefault(),l();const S=Ie.getState(),C=S.stagedByDiscard;S.setStagedByDiscard(null),s.keys.length===1&&C!==null&&Ie.getState().activeDraftKey===C&&Ie.getState().openDraft(s.keys[0])}}})},[e,s,l]);const v=m.useRef(!1);return m.useEffect(()=>{if(r===null){if(!v.current)return;v.current=!1,Yx(vP);return}v.current=!0;const b=()=>{const x=Ie.getState();x.bulkReadDeferral?.at===r.at&&(x.clearBulkReadDeferral(),v.current=!1)};xa(PH(r.count),{id:vP,duration:tle,onAutoClose:b,onDismiss:b})},[r]),null}var No,qe=typeof window<"u"?window:void 0,qi=typeof globalThis<"u"?globalThis:qe,MH=Array.prototype,bP=MH.forEach,xP=MH.indexOf,va=qi?.navigator,Ft=qi?.document,$i=qi?.location,IE=qi?.fetch,NE=qi!=null&&qi.XMLHttpRequest&&"withCredentials"in new qi.XMLHttpRequest?qi.XMLHttpRequest:void 0,_P=qi?.AbortController,ar=va?.userAgent,nn=qe??{},uc={DEBUG:!1,LIB_VERSION:"1.235.6"},P1="$copy_autocapture",sle=["$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"})(No||(No={}));var rle=["fatal","error","warning","log","info","debug"];function wn(e,t){return e.indexOf(t)!==-1}var Qy=function(e){return e.trim()},o2=function(e){return e.replace(/^\$/,"")},ile=Array.isArray,OH=Object.prototype,LH=OH.hasOwnProperty,Jy=OH.toString,Os=ile||function(e){return Jy.call(e)==="[object Array]"},jo=e=>typeof e=="function",Ls=e=>e===Object(e)&&!Os(e),np=e=>{if(Ls(e)){for(var t in e)if(LH.call(e,t))return!1;return!0}return!1},Et=e=>e===void 0,lr=e=>Jy.call(e)=="[object String]",PE=e=>lr(e)&&e.trim().length===0,dd=e=>e===null,qn=e=>Et(e)||dd(e),Ai=e=>Jy.call(e)=="[object Number]",hc=e=>Jy.call(e)==="[object Boolean]",ale=e=>e instanceof FormData,ole=e=>wn(sle,e),BH=e=>{var t={_log:function(n){if(qe&&(uc.DEBUG||nn.POSTHOG_DEBUG)&&!Et(qe.console)&&qe.console){for(var s=("__rrweb_original__"in qe.console[n])?qe.console[n].__rrweb_original__:qe.console[n],r=arguments.length,i=new Array(r>1?r-1:0),a=1;a<r;a++)i[a-1]=arguments[a];s(e,...i)}},info:function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];t._log("log",...s)},warn:function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];t._log("warn",...s)},error:function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];t._log("error",...s)},critical:function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];console.error(e,...s)},uninitializedWarning:n=>{t.error("You must initialize PostHog before calling ".concat(n))},createLogger:n=>BH("".concat(e," ").concat(n))};return t},Lt=BH("[PostHog.js]"),pi=Lt.createLogger,lle=pi("[ExternalScriptsLoader]"),wP=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return lle.warn("".concat(t," was requested but loading of external scripts is disabled.")),n("Loading of external scripts is disabled");var s=Ft?.querySelectorAll("script");if(s){for(var r=0;r<s.length;r++)if(s[r].src===t)return n()}var i=()=>{if(!Ft)return n("document not found");var a=Ft.createElement("script");if(a.type="text/javascript",a.crossOrigin="anonymous",a.src=t,a.onload=u=>n(void 0,u),a.onerror=u=>n(u),e.config.prepare_external_dependency_script&&(a=e.config.prepare_external_dependency_script(a)),!a)return n("prepare_external_dependency_script returned null");var o,l=Ft.querySelectorAll("body > script");l.length>0?(o=l[0].parentNode)===null||o===void 0||o.insertBefore(a,l[0]):Ft.body.appendChild(a)};Ft!=null&&Ft.body?i():Ft?.addEventListener("DOMContentLoaded",i)};function yP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,s)}return n}function Ze(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?yP(Object(n),!0).forEach(function(s){yt(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yP(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function yt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jH(e,t){if(e==null)return{};var n,s,r=function(a,o){if(a==null)return{};var l,u,d={},f=Object.keys(a);for(u=0;u<f.length;u++)l=f[u],o.indexOf(l)>=0||(d[l]=a[l]);return d}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s<i.length;s++)n=i[s],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}nn.__PosthogExtensions__=nn.__PosthogExtensions__||{},nn.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{var s="/static/".concat(t,".js")+"?v=".concat(e.version);if(t==="remote-config"&&(s="/array/".concat(e.config.token,"/config.js")),t==="toolbar"){var r=3e5,i=Math.floor(Date.now()/r)*r;s="".concat(s,"&t=").concat(i)}var a=e.requestRouter.endpointFor("assets",s);wP(e,a,n)},nn.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var s=e.requestRouter.endpointFor("api",t);wP(e,s,n)};var $_={};function Uu(e,t,n){if(Os(e)){if(bP&&e.forEach===bP)e.forEach(t,n);else if("length"in e&&e.length===+e.length){for(var s=0,r=e.length;s<r;s++)if(s in e&&t.call(n,e[s],s)===$_)return}}}function is(e,t,n){if(!qn(e)){if(Os(e))return Uu(e,t,n);if(ale(e)){for(var s of e.entries())if(t.call(n,s[1],s[0])===$_)return}else for(var r in e)if(LH.call(e,r)&&t.call(n,e[r],r)===$_)return}}var Ks=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];return Uu(n,function(r){for(var i in r)r[i]!==void 0&&(e[i]=r[i])}),e},Jx=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];return Uu(n,function(r){Uu(r,function(i){e.push(i)})}),e};function Zx(e){for(var t=Object.keys(e),n=t.length,s=new Array(n);n--;)s[n]=[t[n],e[t[n]]];return s}var CP=function(e){try{return e()}catch{return}},cle=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return e.apply(this,n)}catch(r){Lt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Lt.critical(r)}}},K0=function(e){var t={};return is(e,function(n,s){lr(n)&&n.length>0&&(t[s]=n)}),t};function ule(e,t){return n=e,s=i=>lr(i)&&!dd(t)?i.slice(0,t):i,r=new Set,function i(a,o){return a!==Object(a)?s?s(a,o):a:r.has(a)?void 0:(r.add(a),Os(a)?(l=[],Uu(a,u=>{l.push(i(u))})):(l={},is(a,(u,d)=>{r.has(u)||(l[d]=i(u,d))})),l);var l}(n);var n,s,r}var dle=["herokuapp.com","vercel.app","netlify.app"];function hle(e){var t=e?.hostname;if(!lr(t))return!1;var n=t.split(".").slice(-2).join(".");for(var s of dle)if(n===s)return!1;return!0}function HH(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function Xs(e,t,n,s){var{capture:r=!1,passive:i=!0}=s??{};e?.addEventListener(t,n,{capture:r,passive:i})}var UH="$people_distinct_id",Tm="__alias",Rm="__timers",SP="$autocapture_disabled_server_side",ME="$heatmaps_enabled_server_side",kP="$exception_capture_enabled_server_side",EP="$web_vitals_enabled_server_side",GH="$dead_clicks_enabled_server_side",TP="$web_vitals_allowed_metrics",OE="$session_recording_enabled_server_side",RP="$console_log_recording_enabled_server_side",AP="$session_recording_network_payload_capture",FP="$session_recording_masking",DP="$session_recording_canvas_recording",IP="$replay_sample_rate",NP="$replay_minimum_duration",PP="$replay_script_config",z_="$sesid",Am="$session_is_sampled",M1="$session_recording_url_trigger_activated_session",O1="$session_recording_event_trigger_activated_session",sp="$enabled_feature_flags",e_="$early_access_features",LE="$feature_flag_details",Fm="$stored_person_properties",Vd="$stored_group_properties",BE="$surveys",Gb="$surveys_activated",q_="$flag_call_reported",oc="$user_state",jE="$client_session_props",HE="$capture_rate_limit",UE="$initial_campaign_params",GE="$initial_referrer_info",VE="$initial_person_info",K_="$epp",VH="__POSTHOG_TOOLBAR__",MP="$posthog_cookieless",fle=[UH,Tm,"__cmpns",Rm,OE,ME,z_,sp,oc,e_,LE,Vd,Fm,BE,q_,jE,HE,UE,GE,K_];function OP(e){var t;return e instanceof Element&&(e.id===VH||!((t=e.closest)===null||t===void 0||!t.call(e,".toolbar-global-fade-container")))}function Zy(e){return!!e&&e.nodeType===1}function Gu(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function WH(e){return!!e&&e.nodeType===3}function $H(e){return!!e&&e.nodeType===11}function l2(e){return e?Qy(e).split(/\s+/):[]}function LP(e){var t=qe?.location.href;return!!(t&&e&&e.some(n=>t.match(n)))}function Y_(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return l2(t)}function zH(e){return qn(e)?null:Qy(e).split(/(\s+)/).filter(t=>Up(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function eC(e){var t="";return $E(e)&&!YH(e)&&e.childNodes&&e.childNodes.length&&is(e.childNodes,function(n){var s;WH(n)&&n.textContent&&(t+=(s=zH(n.textContent))!==null&&s!==void 0?s:"")}),Qy(t)}function qH(e){return Et(e.target)?e.srcElement||null:(t=e.target)!==null&&t!==void 0&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var WE=["a","button","form","input","select","textarea","label"];function KH(e){var t=e.parentNode;return!(!t||!Zy(t))&&t}function ple(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;if(!qe||!e||Gu(e,"html")||!Zy(e)||n!=null&&n.url_allowlist&&!LP(n.url_allowlist)||n!=null&&n.url_ignorelist&&LP(n.url_ignorelist))return!1;if(n!=null&&n.dom_event_allowlist){var i=n.dom_event_allowlist;if(i&&!i.some(g=>t.type===g))return!1}for(var a=!1,o=[e],l=!0,u=e;u.parentNode&&!Gu(u,"body");)if($H(u.parentNode))o.push(u.parentNode.host),u=u.parentNode.host;else{if(!(l=KH(u)))break;if(s||WE.indexOf(l.tagName.toLowerCase())>-1)a=!0;else{var d=qe.getComputedStyle(l);d&&d.getPropertyValue("cursor")==="pointer"&&(a=!0)}o.push(l),u=l}if(!function(g,v){var b=v?.element_allowlist;if(Et(b))return!0;var x=function(y){if(b.some(S=>y.tagName.toLowerCase()===S))return{v:!0}};for(var _ of g){var w=x(_);if(typeof w=="object")return w.v}return!1}(o,n)||!function(g,v){var b=v?.css_selector_allowlist;if(Et(b))return!0;var x=function(y){if(b.some(S=>y.matches(S)))return{v:!0}};for(var _ of g){var w=x(_);if(typeof w=="object")return w.v}return!1}(o,n))return!1;var f=qe.getComputedStyle(e);if(f&&f.getPropertyValue("cursor")==="pointer"&&t.type==="click")return!0;var p=e.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(r||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(t.type)>=0;default:return a?(r||["click"]).indexOf(t.type)>=0:(r||["click"]).indexOf(t.type)>=0&&(WE.indexOf(p)>-1||e.getAttribute("contenteditable")==="true")}}function $E(e){for(var t=e;t.parentNode&&!Gu(t,"body");t=t.parentNode){var n=Y_(t);if(wn(n,"ph-sensitive")||wn(n,"ph-no-capture"))return!1}if(wn(Y_(e),"ph-include"))return!0;var s=e.type||"";if(lr(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";return!(lr(r)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,"")))}function YH(e){return!!(Gu(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Gu(e,"select")||Gu(e,"textarea")||e.getAttribute("contenteditable")==="true")}var XH="(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})",gle=new RegExp("^(?:".concat(XH,")$")),mle=new RegExp(XH),QH="\\d{3}-?\\d{2}-?\\d{4}",vle=new RegExp("^(".concat(QH,")$")),ble=new RegExp("(".concat(QH,")"));function Up(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(qn(e)||lr(e)&&(e=Qy(e),(t?gle:mle).test((e||"").replace(/[- ]/g,""))||(t?vle:ble).test(e)))}function JH(e){var t=eC(e);return Up(t="".concat(t," ").concat(ZH(e)).trim())?t:""}function ZH(e){var t="";return e&&e.childNodes&&e.childNodes.length&&is(e.childNodes,function(n){var s;if(n&&((s=n.tagName)===null||s===void 0?void 0:s.toLowerCase())==="span")try{var r=eC(n);t="".concat(t," ").concat(r).trim(),n.childNodes&&n.childNodes.length&&(t="".concat(t," ").concat(ZH(n)).trim())}catch(i){Lt.error("[AutoCapture]",i)}}),t}function xle(e){return function(t){var n=t.map(s=>{var r,i,a="";if(s.tag_name&&(a+=s.tag_name),s.attr_class)for(var o of(s.attr_class.sort(),s.attr_class))a+=".".concat(o.replace(/"/g,""));var l=Ze(Ze(Ze(Ze({},s.text?{text:s.text}:{}),{},{"nth-child":(r=s.nth_child)!==null&&r!==void 0?r:0,"nth-of-type":(i=s.nth_of_type)!==null&&i!==void 0?i:0},s.href?{href:s.href}:{}),s.attr_id?{attr_id:s.attr_id}:{}),s.attributes),u={};return Zx(l).sort((d,f)=>{var[p]=d,[g]=f;return p.localeCompare(g)}).forEach(d=>{var[f,p]=d;return u[BP(f.toString())]=BP(p.toString())}),a+=":",a+=Zx(l).map(d=>{var[f,p]=d;return"".concat(f,'="').concat(p,'"')}).join("")});return n.join(";")}(function(t){return t.map(n=>{var s,r,i={text:(s=n.$el_text)===null||s===void 0?void 0:s.slice(0,400),tag_name:n.tag_name,href:(r=n.attr__href)===null||r===void 0?void 0:r.slice(0,2048),attr_class:_le(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return Zx(n).filter(a=>{var[o]=a;return o.indexOf("attr__")===0}).forEach(a=>{var[o,l]=a;return i.attributes[o]=l}),i})}(e))}function BP(e){return e.replace(/"|\\"/g,'\\"')}function _le(e){var t=e.attr__class;return t?Os(t)?t:l2(t):void 0}class eU{constructor(){this.clicks=[]}isRageClick(t,n,s){var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(n-r.y)<30&&s-r.timestamp<1e3){if(this.clicks.push({x:t,y:n,timestamp:s}),this.clicks.length===3)return!0}else this.clicks=[{x:t,y:n,timestamp:s}];return!1}}var wle=["localhost","127.0.0.1"],fp=e=>{var t=Ft?.createElement("a");return Et(t)?null:(t.href=e,t)},yle=function(e){var t,n,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",r=[];return is(e,function(i,a){Et(i)||Et(a)||a==="undefined"||(t=encodeURIComponent((o=>o instanceof File)(i)?i.name:i.toString()),n=encodeURIComponent(a),r[r.length]=n+"="+t)}),r.join(s)},X_=function(e,t){for(var n,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;r<s.length;r++){var i=s[r].split("=");if(i[0]===t){n=i;break}}if(!Os(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch{Lt.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},L1=function(e,t,n){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[0]||"",i=s[1],a=r.split("?"),o=a[1],l=a[0],u=(o||"").split("&"),d=[],f=0;f<u.length;f++){var p=u[f].split("=");Os(p)&&(t.includes(p[0])?d.push(p[0]+"="+n):d.push(u[f]))}var g=l;return o!=null&&(g+="?"+d.join("&")),i!=null&&(g+="#"+i),g},Q_=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},jP=pi("[AutoCapture]");function B1(e,t){return t.length>e?t.slice(0,e)+"...":t}function Cle(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!Zy(t));return t}function Sle(e,t,n,s){var r=e.tagName.toLowerCase(),i={tag_name:r};WE.indexOf(r)>-1&&!n&&(r.toLowerCase()==="a"||r.toLowerCase()==="button"?i.$el_text=B1(1024,JH(e)):i.$el_text=B1(1024,eC(e)));var a=Y_(e);a.length>0&&(i.classes=a.filter(function(d){return d!==""})),is(e.attributes,function(d){var f;if((!YH(e)||["name","id","class","aria-label"].indexOf(d.name)!==-1)&&(s==null||!s.includes(d.name))&&!t&&Up(d.value)&&(f=d.name,!lr(f)||f.substring(0,10)!=="_ngcontent"&&f.substring(0,7)!=="_nghost")){var p=d.value;d.name==="class"&&(p=l2(p).join(" ")),i["attr__"+d.name]=B1(1024,p)}});for(var o=1,l=1,u=e;u=Cle(u);)o++,u.tagName===e.tagName&&l++;return i.nth_child=o,i.nth_of_type=l,i}function kle(e,t){for(var n,s,{e:r,maskAllElementAttributes:i,maskAllText:a,elementAttributeIgnoreList:o,elementsChainAsString:l}=t,u=[e],d=e;d.parentNode&&!Gu(d,"body");)$H(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var f,p=[],g={},v=!1,b=!1;if(is(u,S=>{var C=$E(S);S.tagName.toLowerCase()==="a"&&(v=S.getAttribute("href"),v=C&&v&&Up(v)&&v),wn(Y_(S),"ph-no-capture")&&(b=!0),p.push(Sle(S,i,a,o));var E=function(k){if(!$E(k))return{};var F={};return is(k.attributes,function(A){if(A.name&&A.name.indexOf("data-ph-capture-attribute")===0){var I=A.name.replace("data-ph-capture-attribute-",""),N=A.value;I&&N&&Up(N)&&(F[I]=N)}}),F}(S);Ks(g,E)}),b)return{props:{},explicitNoCapture:b};if(a||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?p[0].$el_text=JH(e):p[0].$el_text=eC(e)),v){var x,_;p[0].attr__href=v;var w=(x=fp(v))===null||x===void 0?void 0:x.host,y=qe==null||(_=qe.location)===null||_===void 0?void 0:_.host;w&&y&&w!==y&&(f=v)}return{props:Ks({$event_type:r.type,$ce_version:1},l?{}:{$elements:p},{$elements_chain:xle(p)},(n=p[0])!==null&&n!==void 0&&n.$el_text?{$el_text:(s=p[0])===null||s===void 0?void 0:s.$el_text}:{},f&&r.type==="click"?{$external_click_url:f}:{},g)}}let Ele=class{constructor(t){yt(this,"_initialized",!1),yt(this,"_isDisabledServerSide",null),yt(this,"rageclicks",new eU),yt(this,"_elementsChainAsString",!1),this.instance=t,this._elementSelectors=null}get config(){var t,n,s=Ls(this.instance.config.autocapture)?this.instance.config.autocapture:{};return s.url_allowlist=(t=s.url_allowlist)===null||t===void 0?void 0:t.map(r=>new RegExp(r)),s.url_ignorelist=(n=s.url_ignorelist)===null||n===void 0?void 0:n.map(r=>new RegExp(r)),s}_addDomEventHandlers(){if(this.isBrowserSupported()){if(qe&&Ft){var t=s=>{s=s||qe?.event;try{this._captureEvent(s)}catch(r){jP.error("Failed to capture event",r)}};if(Xs(Ft,"submit",t,{capture:!0}),Xs(Ft,"change",t,{capture:!0}),Xs(Ft,"click",t,{capture:!0}),this.config.capture_copied_text){var n=s=>{s=s||qe?.event,this._captureEvent(s,P1)};Xs(Ft,"copy",n,{capture:!0}),Xs(Ft,"cut",n,{capture:!0})}}}else jP.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({[SP]:!!t.autocapture_opt_out}),this._isDisabledServerSide=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this._elementSelectors=t}getElementSelectors(t){var n,s=[];return(n=this._elementSelectors)===null||n===void 0||n.forEach(r=>{var i=Ft?.querySelectorAll(r);i?.forEach(a=>{t===a&&s.push(r)})}),s}get isEnabled(){var t,n,s=(t=this.instance.persistence)===null||t===void 0?void 0:t.props[SP],r=this._isDisabledServerSide;if(dd(r)&&!hc(s)&&!this.instance.config.advanced_disable_decide)return!1;var i=(n=this._isDisabledServerSide)!==null&&n!==void 0?n:!!s;return!!this.instance.config.autocapture&&!i}_captureEvent(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"$autocapture";if(this.isEnabled){var s,r=qH(t);WH(r)&&(r=r.parentNode||null),n==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(s=this.rageclicks)!==null&&s!==void 0&&s.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this._captureEvent(t,"$rageclick");var i=n===P1;if(r&&ple(r,t,this.config,i,i?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:o}=kle(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString});if(o)return!1;var l=this.getElementSelectors(r);if(l&&l.length>0&&(a.$element_selectors=l),n===P1){var u,d=zH(qe==null||(u=qe.getSelection())===null||u===void 0?void 0:u.toString()),f=t.type||"clipboard";if(!d)return!1;a.$selected_content=d,a.$copy_type=f}return this.instance.capture(n,a),!0}}}isBrowserSupported(){return jo(Ft?.querySelectorAll)}};Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Ai(e)&&isFinite(e)&&Math.floor(e)===e});var HP="0123456789abcdef";let Tle=class zE{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,s,r){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(s)||!Number.isInteger(r)||t<0||n<0||s<0||r<0||t>0xffffffffffff||n>4095||s>1073741823||r>4294967295)throw new RangeError("invalid field value");var i=new Uint8Array(16);return i[0]=t/Math.pow(2,40),i[1]=t/Math.pow(2,32),i[2]=t/Math.pow(2,24),i[3]=t/Math.pow(2,16),i[4]=t/Math.pow(2,8),i[5]=t,i[6]=112|n>>>8,i[7]=n,i[8]=128|s>>>24,i[9]=s>>>16,i[10]=s>>>8,i[11]=s,i[12]=r>>>24,i[13]=r>>>16,i[14]=r>>>8,i[15]=r,new zE(i)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+HP.charAt(this.bytes[n]>>>4)+HP.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 zE(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;n<16;n++){var s=this.bytes[n]-t.bytes[n];if(s!==0)return Math.sign(s)}return 0}},Rle=class{constructor(){yt(this,"timestamp",0),yt(this,"counter",0),yt(this,"random",new Ale)}generate(){var t=this.generateOrAbort();if(Et(t)){this.timestamp=0;var n=this.generateOrAbort();if(Et(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 Tle.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 UP,tU=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};qe&&!Et(qe.crypto)&&crypto.getRandomValues&&(tU=e=>crypto.getRandomValues(e));let Ale=class{constructor(){yt(this,"buffer",new Uint32Array(8)),yt(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(tU(this.buffer),this.cursor=0),this.buffer[this.cursor++]}};var Nu=()=>Fle().toString(),Fle=()=>(UP||(UP=new Rle)).generate(),Dle="Thu, 01 Jan 1970 00:00:00 GMT",Xg="",Ile=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Nle(e,t){if(t){var n=function(r){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ft;if(Xg)return Xg;if(!i||["localhost","127.0.0.1"].includes(r))return"";for(var a=r.split("."),o=Math.min(a.length,8),l="dmn_chk_"+Nu(),u=new RegExp("(^|;)\\s*"+l+"=1");!Xg&&o--;){var d=a.slice(o).join("."),f=l+"=1;domain=."+d;i.cookie=f,u.test(i.cookie)&&(i.cookie=f+";expires="+Dle,Xg=d)}return Xg}(e);if(!n){var s=(r=>{var i=r.match(Ile);return i?i[0]:""})(e);s!==n&&Lt.info("Warning: cookie subdomain discovery mismatch",s,n),n=s}return n?"; domain=."+n:""}return""}var ku,_c={is_supported:()=>!!Ft,error:function(e){Lt.error("cookieStore error: "+e)},get:function(e){if(Ft){try{for(var t=e+"=",n=Ft.cookie.split(";").filter(i=>i.length),s=0;s<n.length;s++){for(var r=n[s];r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(t)===0)return decodeURIComponent(r.substring(t.length,r.length))}}catch{}return null}},parse:function(e){var t;try{t=JSON.parse(_c.get(e))||{}}catch{}return t},set:function(e,t,n,s,r){if(Ft)try{var i="",a="",o=Nle(Ft.location.hostname,s);if(n){var l=new Date;l.setTime(l.getTime()+24*n*60*60*1e3),i="; expires="+l.toUTCString()}r&&(a="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+i+"; SameSite=Lax; path=/"+o+a;return u.length>3686.4&&Lt.warn("cookieStore warning: large cookie, len="+u.length),Ft.cookie=u,u}catch{return}},remove:function(e,t){try{_c.set(e,"",-1,t)}catch{return}}},j1=null,gr={is_supported:function(){if(!dd(j1))return j1;var e=!0;if(Et(qe))e=!1;else try{var t="__mplssupport__";gr.set(t,"xyz"),gr.get(t)!=='"xyz"'&&(e=!1),gr.remove(t)}catch{e=!1}return e||Lt.error("localStorage unsupported; falling back to cookie store"),j1=e,e},error:function(e){Lt.error("localStorage error: "+e)},get:function(e){try{return qe?.localStorage.getItem(e)}catch(t){gr.error(t)}return null},parse:function(e){try{return JSON.parse(gr.get(e))||{}}catch{}return null},set:function(e,t){try{qe?.localStorage.setItem(e,JSON.stringify(t))}catch(n){gr.error(n)}},remove:function(e){try{qe?.localStorage.removeItem(e)}catch(t){gr.error(t)}}},Ple=["distinct_id",z_,Am,K_,VE],Vb=Ze(Ze({},gr),{},{parse:function(e){try{var t={};try{t=_c.parse(e)||{}}catch{}var n=Ks(t,JSON.parse(gr.get(e)||"{}"));return gr.set(e,n),n}catch{}return null},set:function(e,t,n,s,r,i){try{gr.set(e,t,void 0,void 0,i);var a={};Ple.forEach(o=>{t[o]&&(a[o]=t[o])}),Object.keys(a).length&&_c.set(e,a,n,s,r,i)}catch(o){gr.error(o)}},remove:function(e,t){try{qe?.localStorage.removeItem(e),_c.remove(e,t)}catch(n){gr.error(n)}}}),Wb={},Mle={is_supported:function(){return!0},error:function(e){Lt.error("memoryStorage error: "+e)},get:function(e){return Wb[e]||null},parse:function(e){return Wb[e]||null},set:function(e,t){Wb[e]=t},remove:function(e){delete Wb[e]}},Pd=null,Gr={is_supported:function(){if(!dd(Pd))return Pd;if(Pd=!0,Et(qe))Pd=!1;else try{var e="__support__";Gr.set(e,"xyz"),Gr.get(e)!=='"xyz"'&&(Pd=!1),Gr.remove(e)}catch{Pd=!1}return Pd},error:function(e){Lt.error("sessionStorage error: ",e)},get:function(e){try{return qe?.sessionStorage.getItem(e)}catch(t){Gr.error(t)}return null},parse:function(e){try{return JSON.parse(Gr.get(e))||null}catch{}return null},set:function(e,t){try{qe?.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){Gr.error(n)}},remove:function(e){try{qe?.sessionStorage.removeItem(e)}catch(t){Gr.error(t)}}};(function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"})(ku||(ku={}));let Ole=class{constructor(t){this.instance=t}get config(){return this.instance.config}get consent(){return this.getDnt()?ku.DENIED:this.storedConsent}isOptedOut(){return this.consent===ku.DENIED||this.consent===ku.PENDING&&this.config.opt_out_capturing_by_default}isOptedIn(){return!this.isOptedOut()}optInOut(t){this.storage.set(this.storageKey,t?1:0,this.config.cookie_expiration,this.config.cross_subdomain_cookie,this.config.secure_cookie)}reset(){this.storage.remove(this.storageKey,this.config.cross_subdomain_cookie)}get storageKey(){var{token:t,opt_out_capturing_cookie_prefix:n}=this.instance.config;return(n||"__ph_opt_in_out_")+t}get storedConsent(){var t=this.storage.get(this.storageKey);return t==="1"?ku.GRANTED:t==="0"?ku.DENIED:ku.PENDING}get storage(){if(!this._storage){var t=this.config.opt_out_capturing_persistence_type;this._storage=t==="localStorage"?gr:_c;var n=t==="localStorage"?_c:gr;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&&!!HH([va?.doNotTrack,va?.msDoNotTrack,nn.doNotTrack],t=>wn([!0,1,"1","yes"],t))}};var $b=pi("[Dead Clicks]"),Lle=()=>!0,Ble=e=>{var t,n=!((t=e.instance.persistence)===null||t===void 0||!t.get_property(GH)),s=e.instance.config.capture_dead_clicks;return hc(s)?s:n};let nU=class{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(t,n,s){this.instance=t,this.isEnabled=n,this.onCapture=s,this.startIfEnabled()}onRemoteConfig(t){this.instance.persistence&&this.instance.persistence.register({[GH]:t?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript(()=>{this.start()})}loadScript(t){var n,s,r;(n=nn.__PosthogExtensions__)!==null&&n!==void 0&&n.initDeadClicksAutocapture&&t(),(s=nn.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"dead-clicks-autocapture",i=>{i?$b.error("failed to load script",i):t()})}start(){var t;if(Ft){if(!this._lazyLoadedDeadClicksAutocapture&&(t=nn.__PosthogExtensions__)!==null&&t!==void 0&&t.initDeadClicksAutocapture){var n=Ls(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=nn.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this._lazyLoadedDeadClicksAutocapture.start(Ft),$b.info("starting...")}}else $b.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,$b.info("stopping..."))}};var H1=pi("[ExceptionAutocapture]");let jle=class{constructor(t){var n;yt(this,"startCapturing",()=>{var s;if(qe&&this.isEnabled&&(s=nn.__PosthogExtensions__)!==null&&s!==void 0&&s.errorWrappingFunctions){var r=nn.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=nn.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,a=nn.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.unwrapOnError&&this.config.capture_unhandled_errors&&(this.unwrapOnError=r(this.captureException.bind(this))),!this.unwrapUnhandledRejection&&this.config.capture_unhandled_rejections&&(this.unwrapUnhandledRejection=i(this.captureException.bind(this))),!this.unwrapConsoleError&&this.config.capture_console_errors&&(this.unwrapConsoleError=a(this.captureException.bind(this)))}catch(o){H1.error("failed to start",o),this.stopCapturing()}}}),this.instance=t,this.remoteEnabled=!((n=this.instance.persistence)===null||n===void 0||!n.props[kP]),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 Ls(t)?n=Ze(Ze({},n),t):(Et(t)?this.remoteEnabled:t)&&(n=Ze(Ze({},n),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),n}get isEnabled(){return this.config.capture_console_errors||this.config.capture_unhandled_errors||this.config.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(H1.info("enabled"),this.loadScript(this.startCapturing))}loadScript(t){var n,s,r;(n=nn.__PosthogExtensions__)!==null&&n!==void 0&&n.errorWrappingFunctions&&t(),(s=nn.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"exception-autocapture",i=>{if(i)return H1.error("failed to load script",i);t()})}stopCapturing(){var t,n,s;(t=this.unwrapOnError)===null||t===void 0||t.call(this),this.unwrapOnError=void 0,(n=this.unwrapUnhandledRejection)===null||n===void 0||n.call(this),this.unwrapUnhandledRejection=void 0,(s=this.unwrapConsoleError)===null||s===void 0||s.call(this),this.unwrapConsoleError=void 0}onRemoteConfig(t){var n=t.autocaptureExceptions;this.remoteEnabled=!!n||!1,this.config=this.requiredConfig(),this.instance.persistence&&this.instance.persistence.register({[kP]: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 sU(e){return!Et(Event)&&rU(e,Event)}function rU(e,t){try{return e instanceof t}catch{return!1}}function t_(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function U1(e){return t_(e,"DOMError")}var GP=/\(error: (.*)\)/,VP=50,rp="?";function G1(e,t,n,s){var r={platform:"web:javascript",filename:e,function:t==="<anonymous>"?rp:t,in_app:!0};return Et(n)||(r.lineno=n),Et(s)||(r.colno=s),r}var Hle=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ule=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Gle=/\((\S*)(?::(\d+))(?::(\d+))\)/,Vle=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Wle=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,$le=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var s=t.sort((r,i)=>r[0]-i[0]).map(r=>r[1]);return function(r){for(var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=[],o=r.split(`
3
3
  `),l=i;l<o.length;l++){var u=o[l];if(!(u.length>1024)){var d=GP.test(u)?u.replace(GP,"$1"):u;if(!d.match(/\S*Error: /)){for(var f of s){var p=f(d);if(p){a.push(p);break}}if(a.length>=VP)break}}}return function(g){if(!g.length)return[];var v=Array.from(g);return v.reverse(),v.slice(0,VP).map(b=>Ze(Ze({},b),{},{filename:b.filename||zle(v).filename,function:b.function||rp}))}(a)}}([30,e=>{var t=Hle.exec(e);if(t){var[,n,s,r]=t;return G1(n,rp,+s,+r)}var i=Ule.exec(e);if(i){if(i[2]&&i[2].indexOf("eval")===0){var a=Gle.exec(i[2]);a&&(i[2]=a[1],i[3]=a[2],i[4]=a[3])}var[o,l]=$P(i[1]||rp,i[2]);return G1(l,o,i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}}],[50,e=>{var t=Vle.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=Wle.exec(t[3]);n&&(t[1]=t[1]||"eval",t[3]=n[1],t[4]=n[2],t[5]="")}var s=t[3],r=t[1]||rp;return[r,s]=$P(r,s),G1(s,r,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]);function zle(e){return e[e.length-1]||{}}var zb,WP,V1,$P=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,s=e.indexOf("safari-web-extension")!==-1;return n||s?[e.indexOf("@")!==-1?e.split("@")[0]:rp,n?"safari-extension:".concat(t):"safari-web-extension:".concat(t)]:[e,t]},qle=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function c2(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=e.stacktrace||e.stack||"",s=function(a){return a&&Kle.test(a.message)?1:0}(e);try{var r=$le,i=function(a,o){var l=function(u){var d=globalThis._posthogChunkIds;if(!d)return{};var f=Object.keys(d);return V1&&f.length===WP||(WP=f.length,V1=f.reduce((p,g)=>{zb||(zb={});var v=zb[g];if(v)p[v[0]]=v[1];else for(var b=u(g),x=b.length-1;x>=0;x--){var _=b[x],w=_?.filename,y=d[g];if(w&&y){p[w]=y,zb[g]=[w,y];break}}return p},{})),V1}(o);return a.forEach(u=>{u.filename&&(u.chunk_id=l[u.filename])}),a}(r(n,s),r);return i.slice(0,i.length-t)}catch{}return[]}var Kle=/Minified React error #\d+;/i;function W1(e,t){var n,s,r=c2(e),i=(n=t?.handled)===null||n===void 0||n,a=(s=t?.synthetic)!==null&&s!==void 0&&s;return{$exception_list:[{type:t!=null&&t.overrideExceptionType?t.overrideExceptionType:e.name,value:function(o){var l=o.message;return l.error&&typeof l.error.message=="string"?String(l.error.message):String(l)}(e),stacktrace:{frames:r,type:"raw"},mechanism:{handled:i,synthetic:a}}],$exception_level:"error"}}function $1(e,t){var n,s,r,i=(n=t?.handled)===null||n===void 0||n,a=(s=t?.synthetic)===null||s===void 0||s,o={type:t!=null&&t.overrideExceptionType?t.overrideExceptionType:(r=t?.defaultExceptionType)!==null&&r!==void 0?r:"Error",value:e||t?.defaultExceptionMessage,mechanism:{handled:i,synthetic:a}};if(t!=null&&t.syntheticException){var l=c2(t.syntheticException,1);l.length&&(o.stacktrace={frames:l,type:"raw"})}return{$exception_list:[o],$exception_level:"error"}}function Yle(e){return lr(e)&&!PE(e)&&rle.indexOf(e)>=0}function Xle(e,t){var n,s,r=(n=t?.handled)===null||n===void 0||n,i=(s=t?.synthetic)===null||s===void 0||s,a=t!=null&&t.overrideExceptionType?t.overrideExceptionType:sU(e)?e.constructor.name:"Error",o="Non-Error 'exception' captured with keys: ".concat(function(d){var f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:40,p=Object.keys(d);if(p.sort(),!p.length)return"[object has no keys]";for(var g=p.length;g>0;g--){var v=p.slice(0,g).join(", ");if(!(v.length>f))return g===p.length||v.length<=f?v:"".concat(v.slice(0,f),"...")}return""}(e)),l={type:a,value:o,mechanism:{handled:r,synthetic:i}};if(t!=null&&t.syntheticException){var u=c2(t?.syntheticException,1);u.length&&(l.stacktrace={frames:u,type:"raw"})}return{$exception_list:[l],$exception_level:Yle(e.level)?e.level:"error"}}function Qle(e,t){var{error:n,event:s}=e,r={$exception_list:[]},i=n||s;if(U1(i)||function(g){return t_(g,"DOMException")}(i)){var a=i;if(function(g){return"stack"in g}(i))r=W1(i,t);else{var o=a.name||(U1(a)?"DOMError":"DOMException"),l=a.message?"".concat(o,": ").concat(a.message):o,u=U1(a)?"DOMError":"DOMException";r=$1(l,Ze(Ze({},t),{},{overrideExceptionType:u,defaultExceptionMessage:l}))}return"code"in a&&(r.$exception_DOMException_code="".concat(a.code)),r}if(function(g){return t_(g,"ErrorEvent")}(i)&&i.error)return W1(i.error,t);if(function(g){switch(Object.prototype.toString.call(g)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return rU(g,Error)}}(i))return W1(i,t);if(function(g){return t_(g,"Object")}(i)||sU(i))return Xle(i,t);if(Et(n)&&lr(s)){var d="Error",f=s,p=s.match(qle);return p&&(d=p[1],f=p[2]),$1(f,Ze(Ze({},t),{},{overrideExceptionType:d,defaultExceptionMessage:f}))}return $1(i,t)}function J_(e){var t,n;return((t=JSON.stringify(e,(n=[],function(s,r){if(Ls(r)){for(;n.length>0&&n[n.length-1]!==this;)n.pop();return n.includes(r)?"[Circular]":(n.push(r),r)}return r})))===null||t===void 0?void 0:t.length)||0}function qE(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:66060288e-1;if(e.size>=t&&e.data.length>1){var n=Math.floor(e.data.length/2),s=e.data.slice(0,n),r=e.data.slice(n);return[qE({size:J_(s),data:s,sessionId:e.sessionId,windowId:e.windowId}),qE({size:J_(r),data:r,sessionId:e.sessionId,windowId:e.windowId})].flatMap(i=>i)}return[e]}var lc=(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))(lc||{}),Fo=(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))(Fo||{}),KE="[SessionRecording]",YE="redacted",qb={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"]},Jle=["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"],Zle=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],ece=["/s/","/e/","/i/"];function zP(e,t,n,s){if(qn(e))return e;var r=t?.["content-length"]||function(i){return new Blob([i]).size}(e);return lr(r)&&(r=parseInt(r)),r>n?KE+" ".concat(s," body too large to record (").concat(r," bytes)"):e}function qP(e,t){if(qn(e))return e;var n=e;return Up(n,!1)||(n=KE+" "+t+" body "+YE),is(Zle,s=>{var r,i;(r=n)!==null&&r!==void 0&&r.length&&((i=n)===null||i===void 0?void 0:i.indexOf(s))!==-1&&(n=KE+" "+t+" body "+YE+" as might contain: "+s)}),n}var tce=(e,t)=>{var n,s,r,i={payloadSizeLimitBytes:qb.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...qb.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...qb.payloadHostDenyList]},a=e.session_recording.recordHeaders!==!1&&t.recordHeaders,o=e.session_recording.recordBody!==!1&&t.recordBody,l=e.capture_performance!==!1&&t.recordPerformance,u=(n=i,r=Math.min(1e6,(s=n.payloadSizeLimitBytes)!==null&&s!==void 0?s:1e6),p=>(p!=null&&p.requestBody&&(p.requestBody=zP(p.requestBody,p.requestHeaders,r,"Request")),p!=null&&p.responseBody&&(p.responseBody=zP(p.responseBody,p.responseHeaders,r,"Response")),p)),d=p=>{return u(((b,x)=>{var _,w=fp(b.name),y=x.indexOf("http")===0?(_=fp(x))===null||_===void 0?void 0:_.pathname:x;y==="/"&&(y="");var S=w?.pathname.replace(y||"","");if(!(w&&S&&ece.some(C=>S.indexOf(C)===0)))return b})((v=(g=p).requestHeaders,qn(v)||is(Object.keys(v??{}),b=>{Jle.includes(b.toLowerCase())&&(v[b]=YE)}),g),e.api_host));var g,v},f=jo(e.session_recording.maskNetworkRequestFn);return f&&jo(e.session_recording.maskCapturedNetworkRequestFn)&&Lt.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),f&&(e.session_recording.maskCapturedNetworkRequestFn=p=>{var g=e.session_recording.maskNetworkRequestFn({url:p.name});return Ze(Ze({},p),{},{name:g?.url})}),i.maskRequestFn=jo(e.session_recording.maskCapturedNetworkRequestFn)?p=>{var g,v,b,x=d(p);return x&&(g=(v=(b=e.session_recording).maskCapturedNetworkRequestFn)===null||v===void 0?void 0:v.call(b,x))!==null&&g!==void 0?g:void 0}:p=>function(g){if(!Et(g))return g.requestBody=qP(g.requestBody,"Request"),g.responseBody=qP(g.responseBody,"Response"),g}(d(p)),Ze(Ze(Ze({},qb),i),{},{recordHeaders:a,recordBody:o,recordPerformance:l,recordInitialRequests:l})};function Xa(e,t,n,s,r){return t>n&&(Lt.warn("min cannot be greater than max."),t=n),Ai(e)?e>n?(s&&Lt.warn(s+" cannot be greater than max: "+n+". Using max value instead."),n):e<t?(s&&Lt.warn(s+" cannot be less than min: "+t+". Using min value instead."),t):e:(s&&Lt.warn(s+" must be a number. using max or fallback. max: "+n+", fallback: "+r),Xa(r||n,t,n,s))}let nce=class{constructor(t){var n,s,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};yt(this,"bucketSize",100),yt(this,"refillRate",10),yt(this,"mutationBuckets",{}),yt(this,"loggedTracker",{}),yt(this,"refillBuckets",()=>{Object.keys(this.mutationBuckets).forEach(i=>{this.mutationBuckets[i]=this.mutationBuckets[i]+this.refillRate,this.mutationBuckets[i]>=this.bucketSize&&delete this.mutationBuckets[i]})}),yt(this,"getNodeOrRelevantParent",i=>{var a=this.rrweb.mirror.getNode(i);if(a?.nodeName!=="svg"&&a instanceof Element){var o=a.closest("svg");if(o)return[this.rrweb.mirror.getId(o),o]}return[i,a]}),yt(this,"numberOfChanges",i=>{var a,o,l,u,d,f,p,g;return((a=(o=i.removes)===null||o===void 0?void 0:o.length)!==null&&a!==void 0?a:0)+((l=(u=i.attributes)===null||u===void 0?void 0:u.length)!==null&&l!==void 0?l:0)+((d=(f=i.texts)===null||f===void 0?void 0:f.length)!==null&&d!==void 0?d:0)+((p=(g=i.adds)===null||g===void 0?void 0:g.length)!==null&&p!==void 0?p:0)}),yt(this,"throttleMutations",i=>{if(i.type!==3||i.data.source!==0)return i;var a=i.data,o=this.numberOfChanges(a);a.attributes&&(a.attributes=a.attributes.filter(u=>{var d,f,p,[g,v]=this.getNodeOrRelevantParent(u.id);return this.mutationBuckets[g]===0?!1:(this.mutationBuckets[g]=(d=this.mutationBuckets[g])!==null&&d!==void 0?d:this.bucketSize,this.mutationBuckets[g]=Math.max(this.mutationBuckets[g]-1,0),this.mutationBuckets[g]===0&&(this.loggedTracker[g]||(this.loggedTracker[g]=!0,(f=(p=this.options).onBlockedNode)===null||f===void 0||f.call(p,g,v))),u)}));var l=this.numberOfChanges(a);return l!==0||o===l?i:void 0}),this.rrweb=t,this.options=r,this.refillRate=Xa((n=this.options.refillRate)!==null&&n!==void 0?n:this.refillRate,0,100,"mutation throttling refill rate"),this.bucketSize=Xa((s=this.options.bucketSize)!==null&&s!==void 0?s:this.bucketSize,0,100,"mutation throttling bucket size"),setInterval(()=>{this.refillBuckets()},1e3)}};var to=Uint8Array,Ki=Uint16Array,Gp=Uint32Array,u2=new to([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]),d2=new to([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]),KP=new to([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),iU=function(e,t){for(var n=new Ki(31),s=0;s<31;++s)n[s]=t+=1<<e[s-1];var r=new Gp(n[30]);for(s=1;s<30;++s)for(var i=n[s];i<n[s+1];++i)r[i]=i-n[s]<<5|s;return[n,r]},aU=iU(u2,2),sce=aU[0],XE=aU[1];sce[28]=258,XE[258]=28;for(var YP=iU(d2,0)[1],oU=new Ki(32768),hs=0;hs<32768;++hs){var Md=(43690&hs)>>>1|(21845&hs)<<1;Md=(61680&(Md=(52428&Md)>>>2|(13107&Md)<<2))>>>4|(3855&Md)<<4,oU[hs]=((65280&Md)>>>8|(255&Md)<<8)>>>1}var Qm=function(e,t,n){for(var s=e.length,r=0,i=new Ki(t);r<s;++r)++i[e[r]-1];var a,o=new Ki(t);for(r=0;r<t;++r)o[r]=o[r-1]+i[r-1]<<1;for(a=new Ki(s),r=0;r<s;++r)a[r]=oU[o[e[r]-1]++]>>>15-e[r];return a},Dh=new to(288);for(hs=0;hs<144;++hs)Dh[hs]=8;for(hs=144;hs<256;++hs)Dh[hs]=9;for(hs=256;hs<280;++hs)Dh[hs]=7;for(hs=280;hs<288;++hs)Dh[hs]=8;var Z_=new to(32);for(hs=0;hs<32;++hs)Z_[hs]=5;var rce=Qm(Dh,9),ice=Qm(Z_,5),lU=function(e){return(e/8>>0)+(7&e&&1)},cU=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var s=new(e instanceof Ki?Ki:e instanceof Gp?Gp:to)(n-t);return s.set(e.subarray(t,n)),s},sc=function(e,t,n){n<<=7&t;var s=t/8>>0;e[s]|=n,e[s+1]|=n>>>8},Qg=function(e,t,n){n<<=7&t;var s=t/8>>0;e[s]|=n,e[s+1]|=n>>>8,e[s+2]|=n>>>16},z1=function(e,t){for(var n=[],s=0;s<e.length;++s)e[s]&&n.push({s,f:e[s]});var r=n.length,i=n.slice();if(!r)return[new to(0),0];if(r==1){var a=new to(n[0].s+1);return a[n[0].s]=1,[a,1]}n.sort(function(C,E){return C.f-E.f}),n.push({s:-1,f:25001});var o=n[0],l=n[1],u=0,d=1,f=2;for(n[0]={s:-1,f:o.f+l.f,l:o,r:l};d!=r-1;)o=n[n[u].f<n[f].f?u++:f++],l=n[u!=d&&n[u].f<n[f].f?u++:f++],n[d++]={s:-1,f:o.f+l.f,l:o,r:l};var p=i[0].s;for(s=1;s<r;++s)i[s].s>p&&(p=i[s].s);var g=new Ki(p+1),v=QE(n[d-1],g,0);if(v>t){s=0;var b=0,x=v-t,_=1<<x;for(i.sort(function(C,E){return g[E.s]-g[C.s]||C.f-E.f});s<r;++s){var w=i[s].s;if(!(g[w]>t))break;b+=_-(1<<v-g[w]),g[w]=t}for(b>>>=x;b>0;){var y=i[s].s;g[y]<t?b-=1<<t-g[y]++-1:++s}for(;s>=0&&b;--s){var S=i[s].s;g[S]==t&&(--g[S],++b)}v=t}return[new to(g),v]},QE=function(e,t,n){return e.s==-1?Math.max(QE(e.l,t,n+1),QE(e.r,t,n+1)):t[e.s]=n},XP=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Ki(++t),s=0,r=e[0],i=1,a=function(l){n[s++]=l},o=1;o<=t;++o)if(e[o]==r&&o!=t)++i;else{if(!r&&i>2){for(;i>138;i-=138)a(32754);i>2&&(a(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(a(r),--i;i>6;i-=6)a(8304);i>2&&(a(i-3<<5|8208),i=0)}for(;i--;)a(r);i=1,r=e[o]}return[n.subarray(0,s),t]},Jg=function(e,t){for(var n=0,s=0;s<t.length;++s)n+=e[s]*t[s];return n},JE=function(e,t,n){var s=n.length,r=lU(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var i=0;i<s;++i)e[r+i+4]=n[i];return 8*(r+4+s)},QP=function(e,t,n,s,r,i,a,o,l,u,d){sc(t,d++,n),++r[256];for(var f=z1(r,15),p=f[0],g=f[1],v=z1(i,15),b=v[0],x=v[1],_=XP(p),w=_[0],y=_[1],S=XP(b),C=S[0],E=S[1],k=new Ki(19),F=0;F<w.length;++F)k[31&w[F]]++;for(F=0;F<C.length;++F)k[31&C[F]]++;for(var A=z1(k,7),I=A[0],N=A[1],P=19;P>4&&!I[KP[P-1]];--P);var M,z,L,X,J=u+5<<3,re=Jg(r,Dh)+Jg(i,Z_)+a,q=Jg(r,p)+Jg(i,b)+a+14+3*P+Jg(k,I)+(2*k[16]+3*k[17]+7*k[18]);if(J<=re&&J<=q)return JE(t,d,e.subarray(l,l+u));if(sc(t,d,1+(q<re)),d+=2,q<re){M=Qm(p,g),z=p,L=Qm(b,x),X=b;var ee=Qm(I,N);for(sc(t,d,y-257),sc(t,d+5,E-1),sc(t,d+10,P-4),d+=14,F=0;F<P;++F)sc(t,d+3*F,I[KP[F]]);d+=3*P;for(var oe=[w,C],B=0;B<2;++B){var U=oe[B];for(F=0;F<U.length;++F){var G=31&U[F];sc(t,d,ee[G]),d+=I[G],G>15&&(sc(t,d,U[F]>>>5&127),d+=U[F]>>>12)}}}else M=rce,z=Dh,L=ice,X=Z_;for(F=0;F<o;++F)if(s[F]>255){G=s[F]>>>18&31,Qg(t,d,M[G+257]),d+=z[G+257],G>7&&(sc(t,d,s[F]>>>23&31),d+=u2[G]);var K=31&s[F];Qg(t,d,L[K]),d+=X[K],K>3&&(Qg(t,d,s[F]>>>5&8191),d+=d2[K])}else Qg(t,d,M[s[F]]),d+=z[s[F]];return Qg(t,d,M[256]),d+z[256]},ace=new Gp([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),oce=function(){for(var e=new Gp(256),t=0;t<256;++t){for(var n=t,s=9;--s;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),lce=function(){var e=4294967295;return{p:function(t){for(var n=e,s=0;s<t.length;++s)n=oce[255&n^t[s]]^n>>>8;e=n},d:function(){return 4294967295^e}}},cce=function(e,t,n,s,r){return function(i,a,o,l,u,d){var f=i.length,p=new to(l+f+5*(1+Math.floor(f/7e3))+u),g=p.subarray(l,p.length-u),v=0;if(!a||f<8)for(var b=0;b<=f;b+=65535){var x=b+65535;x<f?v=JE(g,v,i.subarray(b,x)):(g[b]=d,v=JE(g,v,i.subarray(b,f)))}else{for(var _=ace[a-1],w=_>>>13,y=8191&_,S=(1<<o)-1,C=new Ki(32768),E=new Ki(S+1),k=Math.ceil(o/3),F=2*k,A=function(ve){return(i[ve]^i[ve+1]<<k^i[ve+2]<<F)&S},I=new Gp(25e3),N=new Ki(288),P=new Ki(32),M=0,z=0,L=(b=0,0),X=0,J=0;b<f;++b){var re=A(b),q=32767&b,ee=E[re];if(C[q]=ee,E[re]=q,X<=b){var oe=f-b;if((M>7e3||L>24576)&&oe>423){v=QP(i,g,0,I,N,P,z,L,J,b-J,v),L=M=z=0,J=b;for(var B=0;B<286;++B)N[B]=0;for(B=0;B<30;++B)P[B]=0}var U=2,G=0,K=y,ne=q-ee&32767;if(oe>2&&re==A(b-ne))for(var he=Math.min(w,oe)-1,te=Math.min(32767,b),Te=Math.min(258,oe);ne<=te&&--K&&q!=ee;){if(i[b+U]==i[b+U-ne]){for(var Z=0;Z<Te&&i[b+Z]==i[b+Z-ne];++Z);if(Z>U){if(U=Z,G=ne,Z>he)break;var ge=Math.min(ne,Z-2),W=0;for(B=0;B<ge;++B){var ye=b-ne+B+32768&32767,De=ye-C[ye]+32768&32767;De>W&&(W=De,ee=ye)}}}ne+=(q=ee)-(ee=C[q])+32768&32767}if(G){I[L++]=268435456|XE[U]<<18|YP[G];var Ne=31&XE[U],pe=31&YP[G];z+=u2[Ne]+d2[pe],++N[257+Ne],++P[pe],X=b+U,++M}else I[L++]=i[b],++N[i[b]]}}v=QP(i,g,d,I,N,P,z,L,J,b-J,v)}return cU(p,0,l+lU(v)+u)}(e,t.level==null?6:t.level,t.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,s,!0)},ZE=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},uce=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&&ZE(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var s=0;s<=n.length;++s)e[s+10]=n.charCodeAt(s)}},dce=function(e){return 10+(e.filename&&e.filename.length+1||0)};function uU(e,t){t===void 0&&(t={});var n=lce(),s=e.length;n.p(e);var r=cce(e,t,dce(t),8),i=r.length;return uce(r,t),ZE(r,i-8,n.d()),ZE(r,i-4,s),r}function dU(e,t){var n=e.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(e);for(var s=new to(e.length+(e.length>>>1)),r=0,i=function(u){s[r++]=u},a=0;a<n;++a){if(r+5>s.length){var o=new to(r+8+(n-a<<1));o.set(s),s=o}var l=e.charCodeAt(a);l<128||t?i(l):l<2048?(i(192|l>>>6),i(128|63&l)):l>55295&&l<57344?(i(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++a))>>>18),i(128|l>>>12&63),i(128|l>>>6&63),i(128|63&l)):(i(224|l>>>12),i(128|l>>>6&63),i(128|63&l))}return cU(s,0,r)}function hce(e,t){return function(n){for(var s=0,r=0;r<n.length;r++)s=(s<<5)-s+n.charCodeAt(r),s|=0;return Math.abs(s)}(e)%100<Xa(100*t,0,100)}var Dm="[SessionRecording]",ei=pi(Dm);function Kb(){var e,t;return nn==null||(e=nn.__PosthogExtensions__)===null||e===void 0||(t=e.rrweb)===null||t===void 0?void 0:t.record}var fce=3e5,pce=[Fo.MouseMove,Fo.MouseInteraction,Fo.Scroll,Fo.ViewportResize,Fo.Input,Fo.TouchMove,Fo.MediaInteraction,Fo.Drag],JP=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function Od(e){return function(t,n){for(var s="",r=0;r<t.length;){var i=t[r++];s+=String.fromCharCode(i)}return s}(uU(dU(JSON.stringify(e))))}function ZP(e){return e.type===lc.Custom&&e.data.tag==="sessionIdle"}function eM(e,t){return t.some(n=>n.matching==="regex"&&new RegExp(n.url).test(e))}let gce=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(Dm+" 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:fce}get isSampled(){var t=this.instance.get_property(Am);return hc(t)?t:null}get sessionDuration(){var t,n,s=(t=this.buffer)===null||t===void 0?void 0:t.data[((n=this.buffer)===null||n===void 0?void 0:n.data.length)-1],{sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0);return s?s.timestamp-r:null}get isRecordingEnabled(){var t=!!this.instance.get_property(OE),n=!this.instance.config.disable_session_recording;return qe&&t&&n}get isConsoleLogCaptureEnabled(){var t=!!this.instance.get_property(RP),n=this.instance.config.enable_recording_console_log;return n??t}get canvasRecording(){var t,n,s,r,i,a,o=this.instance.config.session_recording.captureCanvas,l=this.instance.get_property(DP),u=(t=(n=o?.recordCanvas)!==null&&n!==void 0?n:l?.enabled)!==null&&t!==void 0&&t,d=(s=(r=o?.canvasFps)!==null&&r!==void 0?r:l?.fps)!==null&&s!==void 0?s:4,f=(i=(a=o?.canvasQuality)!==null&&a!==void 0?a:l?.quality)!==null&&i!==void 0?i:.4;if(typeof f=="string"){var p=parseFloat(f);f=isNaN(p)?.4:p}return{enabled:u,fps:Xa(d,0,12,"canvas recording fps",4),quality:Xa(f,0,1,"canvas recording quality",.4)}}get networkPayloadCapture(){var t,n,s=this.instance.get_property(AP),r={recordHeaders:(t=this.instance.config.session_recording)===null||t===void 0?void 0:t.recordHeaders,recordBody:(n=this.instance.config.session_recording)===null||n===void 0?void 0:n.recordBody},i=r?.recordHeaders||s?.recordHeaders,a=r?.recordBody||s?.recordBody,o=Ls(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,l=!!(hc(o)?o:s?.capturePerformance);return i||a||l?{recordHeaders:i,recordBody:a,recordPerformance:l}:void 0}get masking(){var t,n,s,r,i,a,o=this.instance.get_property(FP),l={maskAllInputs:(t=this.instance.config.session_recording)===null||t===void 0?void 0:t.maskAllInputs,maskTextSelector:(n=this.instance.config.session_recording)===null||n===void 0?void 0:n.maskTextSelector,blockSelector:(s=this.instance.config.session_recording)===null||s===void 0?void 0:s.blockSelector},u=(r=l?.maskAllInputs)!==null&&r!==void 0?r:o?.maskAllInputs,d=(i=l?.maskTextSelector)!==null&&i!==void 0?i:o?.maskTextSelector,f=(a=l?.blockSelector)!==null&&a!==void 0?a:o?.blockSelector;return Et(u)&&Et(d)&&Et(f)?void 0:{maskAllInputs:u==null||u,maskTextSelector:d,blockSelector:f}}get sampleRate(){var t=this.instance.get_property(IP);return Ai(t)?t:null}get minimumDuration(){var t=this.instance.get_property(NP);return Ai(t)?t:null}get status(){return this.receivedDecide?this.isRecordingEnabled?this.isSampled===!1?"disabled":this._urlBlocked?"paused":qn(this._linkedFlag)||this._linkedFlagSeen?this.triggerStatus==="trigger_pending"?"buffering":hc(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(M1))===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(O1))===this.sessionId?"trigger_activated":"trigger_pending"}get triggerStatus(){var t=this.eventTriggerStatus==="trigger_activated"||this.urlTriggerStatus==="trigger_activated",n=this.eventTriggerStatus==="trigger_pending"||this.urlTriggerStatus==="trigger_pending";return t?"trigger_activated":n?"trigger_pending":"trigger_disabled"}constructor(t){if(yt(this,"queuedRRWebEvents",[]),yt(this,"isIdle","unknown"),yt(this,"_linkedFlagSeen",!1),yt(this,"_lastActivityTimestamp",Date.now()),yt(this,"_linkedFlag",null),yt(this,"_removePageViewCaptureHook",void 0),yt(this,"_onSessionIdListener",void 0),yt(this,"_persistDecideOnSessionListener",void 0),yt(this,"_samplingSessionListener",void 0),yt(this,"_urlTriggers",[]),yt(this,"_urlBlocklist",[]),yt(this,"_urlBlocked",!1),yt(this,"_eventTriggers",[]),yt(this,"_removeEventTriggerCaptureHook",void 0),yt(this,"_forceAllowLocalhostNetworkCapture",!1),yt(this,"_onBeforeUnload",()=>{this._flushBuffer()}),yt(this,"_onOffline",()=>{this._tryAddCustomEvent("browser offline",{})}),yt(this,"_onOnline",()=>{this._tryAddCustomEvent("browser online",{})}),yt(this,"_onVisibilityChange",()=>{if(Ft!=null&&Ft.visibilityState){var r="window "+Ft.visibilityState;this._tryAddCustomEvent(r,{})}}),this.instance=t,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw ei.error("started without valid sessionManager"),new Error(Dm+" started without valid sessionManager. This is a bug.");if(this.instance.config.__preview_experimental_cookieless_mode)throw new Error(Dm+" cannot be used with __preview_experimental_cookieless_mode.");var{sessionId:n,windowId:s}=this.sessionManager.checkAndGetSessionAndWindowId();this.sessionId=n,this.windowId=s,this.buffer=this.clearBuffer(),this.sessionIdleThresholdMilliseconds>=this.sessionManager.sessionTimeoutMs&&ei.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),Xs(qe,"beforeunload",this._onBeforeUnload),Xs(qe,"offline",this._onOffline),Xs(qe,"online",this._onOnline),Xs(qe,"visibilitychange",this._onVisibilityChange),this._setupSampling(),this._addEventTriggerListener(),qn(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this.instance.on("eventCaptured",n=>{try{if(n.event==="$pageview"){var s=n!=null&&n.properties.$current_url?this._maskUrl(n?.properties.$current_url):"";if(!s)return;this._tryAddCustomEvent("$pageview",{href:s})}}catch(r){ei.error("Could not add $pageview to rrweb session",r)}})),this._onSessionIdListener||(this._onSessionIdListener=this.sessionManager.onSessionId((n,s,r)=>{var i,a,o,l;r&&(this._tryAddCustomEvent("$session_id_change",{sessionId:n,windowId:s,changeReason:r}),(i=this.instance)===null||i===void 0||(a=i.persistence)===null||a===void 0||a.unregister(O1),(o=this.instance)===null||o===void 0||(l=o.persistence)===null||l===void 0||l.unregister(M1))}))):this.stopRecording()}stopRecording(){var t,n,s,r;this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,qe?.removeEventListener("beforeunload",this._onBeforeUnload),qe?.removeEventListener("offline",this._onOffline),qe?.removeEventListener("online",this._onOnline),qe?.removeEventListener("visibilitychange",this._onVisibilityChange),this.clearBuffer(),clearInterval(this._fullSnapshotTimer),(t=this._removePageViewCaptureHook)===null||t===void 0||t.call(this),this._removePageViewCaptureHook=void 0,(n=this._removeEventTriggerCaptureHook)===null||n===void 0||n.call(this),this._removeEventTriggerCaptureHook=void 0,(s=this._onSessionIdListener)===null||s===void 0||s.call(this),this._onSessionIdListener=void 0,(r=this._samplingSessionListener)===null||r===void 0||r.call(this),this._samplingSessionListener=void 0,ei.info("stopped"))}_resetSampling(){var t;(t=this.instance.persistence)===null||t===void 0||t.unregister(Am)}makeSamplingDecision(t){var n,s=this.sessionId!==t,r=this.sampleRate;if(Ai(r)){var i=this.isSampled,a=s||!hc(i),o=a?hce(t,r):i;a&&(o?this._reportStarted("sampled"):ei.warn("Sample rate (".concat(r,") has determined that this sessionId (").concat(t,") will not be sent to the server.")),this._tryAddCustomEvent("samplingDecisionMade",{sampleRate:r,isSampled:o})),(n=this.instance.persistence)===null||n===void 0||n.register({[Am]:o})}else this._resetSampling()}onRemoteConfig(t){var n,s,r,i,a,o;if(this._tryAddCustomEvent("$remote_config_received",t),this._persistRemoteConfig(t),this._linkedFlag=((n=t.sessionRecording)===null||n===void 0?void 0:n.linkedFlag)||null,(s=t.sessionRecording)!==null&&s!==void 0&&s.endpoint&&(this._endpoint=(o=t.sessionRecording)===null||o===void 0?void 0:o.endpoint),this._setupSampling(),!qn(this._linkedFlag)&&!this._linkedFlagSeen){var l=lr(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,u=lr(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags((d,f)=>{var p=Ls(f)&&l in f,g=u?f[l]===u:p;g&&this._reportStarted("linked_flag_matched",{linkedFlag:l,linkedVariant:u}),this._linkedFlagSeen=g})}(r=t.sessionRecording)!==null&&r!==void 0&&r.urlTriggers&&(this._urlTriggers=t.sessionRecording.urlTriggers),(i=t.sessionRecording)!==null&&i!==void 0&&i.urlBlocklist&&(this._urlBlocklist=t.sessionRecording.urlBlocklist),(a=t.sessionRecording)!==null&&a!==void 0&&a.eventTriggers&&(this._eventTriggers=t.sessionRecording.eventTriggers),this.receivedDecide=!0,this.startIfEnabledOrStop()}_setupSampling(){Ai(this.sampleRate)&&qn(this._samplingSessionListener)&&(this._samplingSessionListener=this.sessionManager.onSessionId(t=>{this.makeSamplingDecision(t)}))}_persistRemoteConfig(t){if(this.instance.persistence){var n,s=this.instance.persistence,r=()=>{var i,a,o,l,u,d,f,p,g,v=(i=t.sessionRecording)===null||i===void 0?void 0:i.sampleRate,b=qn(v)?null:parseFloat(v);qn(b)&&this._resetSampling();var x=(a=t.sessionRecording)===null||a===void 0?void 0:a.minimumDurationMilliseconds;s.register({[OE]:!!t.sessionRecording,[RP]:(o=t.sessionRecording)===null||o===void 0?void 0:o.consoleLogRecordingEnabled,[AP]:Ze({capturePerformance:t.capturePerformance},(l=t.sessionRecording)===null||l===void 0?void 0:l.networkPayloadCapture),[FP]:(u=t.sessionRecording)===null||u===void 0?void 0:u.masking,[DP]:{enabled:(d=t.sessionRecording)===null||d===void 0?void 0:d.recordCanvas,fps:(f=t.sessionRecording)===null||f===void 0?void 0:f.canvasFps,quality:(p=t.sessionRecording)===null||p===void 0?void 0:p.canvasQuality},[IP]:b,[NP]:Et(x)?null:x,[PP]:(g=t.sessionRecording)===null||g===void 0?void 0:g.scriptConfig})};r(),(n=this._persistDecideOnSessionListener)===null||n===void 0||n.call(this),this._persistDecideOnSessionListener=this.sessionManager.onSessionId(r)}}log(t){var n,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"log";(n=this.instance.sessionRecording)===null||n===void 0||n.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:s,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}_startCapture(t){if(!Et(Object.assign)&&!Et(Array.from)&&!(this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut())){var n,s;this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),Kb()?this._onScriptLoaded():(n=nn.__PosthogExtensions__)===null||n===void 0||(s=n.loadExternalDependency)===null||s===void 0||s.call(n,this.instance,this.scriptName,r=>{if(r)return ei.error("could not load recorder",r);this._onScriptLoaded()}),ei.info("starting"),this.status==="active"&&this._reportStarted(t||"recording_initialized")}}get scriptName(){var t,n,s;return((t=this.instance)===null||t===void 0||(n=t.persistence)===null||n===void 0||(s=n.get_property(PP))===null||s===void 0?void 0:s.script)||"recorder"}isInteractiveEvent(t){var n;return t.type===3&&pce.indexOf((n=t.data)===null||n===void 0?void 0:n.source)!==-1}_updateWindowAndSessionIds(t){var n=this.isInteractiveEvent(t);n||this.isIdle||t.timestamp-this._lastActivityTimestamp>this.sessionIdleThresholdMilliseconds&&(this.isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this.sessionIdleThresholdMilliseconds,bufferLength:this.buffer.data.length,bufferSize:this.buffer.size}),this._flushBuffer());var s=!1;if(n&&(this._lastActivityTimestamp=t.timestamp,this.isIdle)){var r=this.isIdle==="unknown";this.isIdle=!1,r||(this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:t.type}),s=!0)}if(!this.isIdle){var{windowId:i,sessionId:a}=this.sessionManager.checkAndGetSessionAndWindowId(!n,t.timestamp),o=this.sessionId!==a,l=this.windowId!==i;this.windowId=i,this.sessionId=a,o||l?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):s&&this._scheduleFullSnapshot()}}_tryRRWebMethod(t){try{return t.rrwebMethod(),!0}catch(n){return this.queuedRRWebEvents.length<10?this.queuedRRWebEvents.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt++,rrwebMethod:t.rrwebMethod}):ei.warn("could not emit queued rrweb event.",n,t),!1}}_tryAddCustomEvent(t,n){return this._tryRRWebMethod(JP(()=>Kb().addCustomEvent(t,n)))}_tryTakeFullSnapshot(){return this._tryRRWebMethod(JP(()=>Kb().takeFullSnapshot()))}_onScriptLoaded(){var t,n,s,r,i={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},a=this.instance.config.session_recording;for(var[o,l]of Object.entries(a||{}))o in i&&(o==="maskInputOptions"?i.maskInputOptions=Ze({password:!0},l):i[o]=l);this.canvasRecording&&this.canvasRecording.enabled&&(i.recordCanvas=!0,i.sampling={canvas:this.canvasRecording.fps},i.dataURLOptions={type:"image/webp",quality:this.canvasRecording.quality}),this.masking&&(i.maskAllInputs=(n=this.masking.maskAllInputs)===null||n===void 0||n,i.maskTextSelector=(s=this.masking.maskTextSelector)!==null&&s!==void 0?s:void 0,i.blockSelector=(r=this.masking.blockSelector)!==null&&r!==void 0?r:void 0);var u=Kb();if(u){this.mutationRateLimiter=(t=this.mutationRateLimiter)!==null&&t!==void 0?t:new nce(u,{refillRate:this.instance.config.session_recording.__mutationRateLimiterRefillRate,bucketSize:this.instance.config.session_recording.__mutationRateLimiterBucketSize,onBlockedNode:(f,p)=>{var g="Too many mutations on node '".concat(f,"'. Rate limiting. This could be due to SVG animations or something similar");ei.info(g,{node:p}),this.log(Dm+" "+g,"warn")}});var d=this._gatherRRWebPlugins();this.stopRrweb=u(Ze({emit:f=>{this.onRRwebEmit(f)},plugins:d},i)),this._lastActivityTimestamp=Date.now(),this.isIdle=hc(this.isIdle)?this.isIdle:"unknown",this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:i,activePlugins:d.map(f=>f?.name)}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}else ei.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),this.isIdle!==!0){var t=this.fullSnapshotIntervalMillis;t&&(this._fullSnapshotTimer=setInterval(()=>{this._tryTakeFullSnapshot()},t))}}_gatherRRWebPlugins(){var t,n,s,r,i=[],a=(t=nn.__PosthogExtensions__)===null||t===void 0||(n=t.rrwebPlugins)===null||n===void 0?void 0:n.getRecordConsolePlugin;a&&this.isConsoleLogCaptureEnabled&&i.push(a());var o=(s=nn.__PosthogExtensions__)===null||s===void 0||(r=s.rrwebPlugins)===null||r===void 0?void 0:r.getRecordNetworkPlugin;return this.networkPayloadCapture&&jo(o)&&(!wle.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?i.push(o(tce(this.instance.config,this.networkPayloadCapture))):ei.info("NetworkCapture not started because we are on localhost.")),i}onRRwebEmit(t){var n;if(this._processQueuedEvents(),t&&Ls(t)){if(t.type===lc.Meta){var s=this._maskUrl(t.data.href);if(this._lastHref=s,!s)return;t.data.href=s}else this._pageViewFallBack();if(this._checkUrlTriggerConditions(),!this._urlBlocked||function(f){return f.type===lc.Custom&&f.data.tag==="recording paused"}(t)){t.type===lc.FullSnapshot&&this._scheduleFullSnapshot(),t.type===lc.FullSnapshot&&this.triggerStatus==="trigger_pending"&&this.clearBuffer();var r=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(t):t;if(r){var i=function(f){var p=f;if(p&&Ls(p)&&p.type===6&&Ls(p.data)&&p.data.plugin==="rrweb/console@1"){p.data.payload.payload.length>10&&(p.data.payload.payload=p.data.payload.payload.slice(0,10),p.data.payload.payload.push("...[truncated]"));for(var g=[],v=0;v<p.data.payload.payload.length;v++)p.data.payload.payload[v]&&p.data.payload.payload[v].length>2e3?g.push(p.data.payload.payload[v].slice(0,2e3)+"...[truncated]"):g.push(p.data.payload.payload[v]);return p.data.payload.payload=g,f}return f}(r);if(this._updateWindowAndSessionIds(i),this.isIdle!==!0||ZP(i)){if(ZP(i)){var a=i.data.payload;if(a){var o=a.lastActivityTimestamp,l=a.threshold;i.timestamp=o+l}}var u=(n=this.instance.config.session_recording.compress_events)===null||n===void 0||n?function(f){if(J_(f)<1024)return f;try{if(f.type===lc.FullSnapshot)return Ze(Ze({},f),{},{data:Od(f.data),cv:"2024-10"});if(f.type===lc.IncrementalSnapshot&&f.data.source===Fo.Mutation)return Ze(Ze({},f),{},{cv:"2024-10",data:Ze(Ze({},f.data),{},{texts:Od(f.data.texts),attributes:Od(f.data.attributes),removes:Od(f.data.removes),adds:Od(f.data.adds)})});if(f.type===lc.IncrementalSnapshot&&f.data.source===Fo.StyleSheetRule)return Ze(Ze({},f),{},{cv:"2024-10",data:Ze(Ze({},f.data),{},{adds:f.data.adds?Od(f.data.adds):void 0,removes:f.data.removes?Od(f.data.removes):void 0})})}catch(p){ei.error("could not compress event - will use uncompressed event",p)}return f}(i):i,d={$snapshot_bytes:J_(u),$snapshot_data:u,$session_id:this.sessionId,$window_id:this.windowId};this.status!=="disabled"?this._captureSnapshotBuffered(d):this.clearBuffer()}}}}}_pageViewFallBack(){if(!this.instance.config.capture_pageview&&qe){var t=this._maskUrl(qe.location.href);this._lastHref!==t&&(this._tryAddCustomEvent("$url_changed",{href:t}),this._lastHref=t)}}_processQueuedEvents(){if(this.queuedRRWebEvents.length){var t=[...this.queuedRRWebEvents];this.queuedRRWebEvents=[],t.forEach(n=>{Date.now()-n.enqueuedAt<=2e3&&this._tryRRWebMethod(n)})}}_maskUrl(t){var n=this.instance.config.session_recording;if(n.maskNetworkRequestFn){var s,r={url:t};return(s=r=n.maskNetworkRequestFn(r))===null||s===void 0?void 0:s.url}return t}clearBuffer(){return this.buffer={size:0,data:[],sessionId:this.sessionId,windowId:this.windowId},this.buffer}_flushBuffer(){this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0);var t=this.minimumDuration,n=this.sessionDuration,s=Ai(n)&&n>=0,r=Ai(t)&&s&&n<t;return this.status==="buffering"||this.status==="paused"||this.status==="disabled"||r?(this.flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3),this.buffer):(this.buffer.data.length>0&&qE(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:uc.LIB_VERSION})}),this.clearBuffer())}_captureSnapshotBuffered(t){var n,s=2+(((n=this.buffer)===null||n===void 0?void 0:n.data.length)||0);!this.isIdle&&(this.buffer.size+t.$snapshot_bytes+s>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=t.$snapshot_bytes,this.buffer.data.push(t.$snapshot_data),this.flushBufferTimer||this.isIdle||(this.flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3))}_captureSnapshot(t){this.instance.capture("$snapshot",t,{_url:this.instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}_checkUrlTriggerConditions(){if(qe!==void 0&&qe.location.href){var t=qe.location.href,n=this._urlBlocked,s=eM(t,this._urlBlocklist);s&&!n?this._pauseRecording():!s&&n&&this._resumeRecording(),eM(t,this._urlTriggers)&&this._activateTrigger("url")}}_activateTrigger(t){var n,s;this.triggerStatus==="trigger_pending"&&((n=this.instance)===null||n===void 0||(s=n.persistence)===null||s===void 0||s.register({[t==="url"?M1:O1]:this.sessionId}),this._flushBuffer(),this._reportStarted(t+"_trigger_matched"))}_pauseRecording(){this._urlBlocked||(this._urlBlocked=!0,clearInterval(this._fullSnapshotTimer),ei.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"}),ei.info("recording resumed"))}_addEventTriggerListener(){this._eventTriggers.length!==0&&qn(this._removeEventTriggerCaptureHook)&&(this._removeEventTriggerCaptureHook=this.instance.on("eventCaptured",t=>{try{this._eventTriggers.includes(t.event)&&this._activateTrigger("event")}catch(n){ei.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({[Am]:!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}),ei.info(t.replace("_"," "),n),wn(["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 q1=pi("[SegmentIntegration]");function mce(e,t){var n=e.config.segment;if(!n)return t();(function(s,r){var i=s.config.segment;if(!i)return r();var a=l=>{var u=()=>l.anonymousId()||Nu();s.config.get_device_id=u,l.id()&&(s.register({distinct_id:l.id(),$device_id:u()}),s.persistence.set_property(oc,"identified")),r()},o=i.user();"then"in o&&jo(o.then)?o.then(l=>a(l)):a(o)})(e,()=>{n.register((s=>{Promise&&Promise.resolve||q1.warn("This browser does not have Promise support, and can not use the segment integration");var r=(i,a)=>{var o;if(!a)return i;i.event.userId||i.event.anonymousId===s.get_distinct_id()||(q1.info("No userId set, resetting PostHog"),s.reset()),i.event.userId&&i.event.userId!==s.get_distinct_id()&&(q1.info("UserId set, identifying with PostHog"),s.identify(i.event.userId));var l=s._calculate_event_properties(a,(o=i.event.properties)!==null&&o!==void 0?o:{},new Date);return i.event.properties=Object.assign({},l,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:i=>r(i,i.event.event),page:i=>r(i,"$pageview"),identify:i=>r(i,"$identify"),screen:i=>r(i,"$screen")}})(e)).then(()=>{t()})})}var hU="posthog-js";function fU(e){var{organization:t,projectId:n,prefix:s,severityAllowList:r=["error"]}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return i=>{var a,o,l,u,d;if(!(r==="*"||r.includes(i.level))||!e.__loaded)return i;i.tags||(i.tags={});var f=e.requestRouter.endpointFor("ui","/project/".concat(e.config.token,"/person/").concat(e.get_distinct_id()));i.tags["PostHog Person URL"]=f,e.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p=((a=i.exception)===null||a===void 0?void 0:a.values)||[],g=p.map(b=>Ze(Ze({},b),{},{stacktrace:b.stacktrace?Ze(Ze({},b.stacktrace),{},{type:"raw",frames:(b.stacktrace.frames||[]).map(x=>Ze(Ze({},x),{},{platform:"web:javascript"}))}):void 0})),v={$exception_message:((o=p[0])===null||o===void 0?void 0:o.value)||i.message,$exception_type:(l=p[0])===null||l===void 0?void 0:l.type,$exception_personURL:f,$exception_level:i.level,$exception_list:g,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:((u=p[0])===null||u===void 0?void 0:u.value)||i.message,$sentry_exception_type:(d=p[0])===null||d===void 0?void 0:d.type,$sentry_tags:i.tags};return t&&n&&(v.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+n+"&query="+i.event_id),e.exceptions.sendExceptionEvent(v),i}}let vce=class{constructor(t,n,s,r,i){this.name=hU,this.setupOnce=function(a){a(fU(t,{organization:n,projectId:s,prefix:r,severityAllowList:i}))}}};var cc,bce=qe!=null&&qe.location?Q_(qe.location.hash,"__posthog")||Q_(location.hash,"state"):null,tM="_postHogToolbarParams",nM=pi("[Toolbar]");(function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"})(cc||(cc={}));class xce{constructor(t){this.instance=t}setToolbarState(t){nn.ph_toolbar_state=t}getToolbarState(){var t;return(t=nn.ph_toolbar_state)!==null&&t!==void 0?t:cc.UNINITIALIZED}maybeLoadToolbar(){var t,n,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(!qe||!Ft)return!1;s=(t=s)!==null&&t!==void 0?t:qe.location,i=(n=i)!==null&&n!==void 0?n:qe.history;try{if(!r){try{qe.localStorage.setItem("test","test"),qe.localStorage.removeItem("test")}catch{return!1}r=qe?.localStorage}var a,o=bce||Q_(s.hash,"__posthog")||Q_(s.hash,"state"),l=o?CP(()=>JSON.parse(atob(decodeURIComponent(o))))||CP(()=>JSON.parse(decodeURIComponent(o))):null;return l&&l.action==="ph_authorize"?((a=l).source="url",a&&Object.keys(a).length>0&&(l.desiredHash?s.hash=l.desiredHash:i?i.replaceState(i.state,"",s.pathname+s.search):s.hash="")):((a=JSON.parse(r.getItem(tM)||"{}")).source="localstorage",delete a.userIntent),!(!a.token||this.instance.config.token!==a.token)&&(this.loadToolbar(a),!0)}catch{return!1}}_callLoadToolbar(t){var n=nn.ph_load_toolbar||nn.ph_load_editor;!qn(n)&&jo(n)?n(t,this.instance):nM.warn("No toolbar load function found")}loadToolbar(t){var n=!(Ft==null||!Ft.getElementById(VH));if(!qe||n)return!1;var s=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=Ze(Ze({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(qe.localStorage.setItem(tM,JSON.stringify(Ze(Ze({},r),{},{source:void 0}))),this.getToolbarState()===cc.LOADED)this._callLoadToolbar(r);else if(this.getToolbarState()===cc.UNINITIALIZED){var i,a;this.setToolbarState(cc.LOADING),(i=nn.__PosthogExtensions__)===null||i===void 0||(a=i.loadExternalDependency)===null||a===void 0||a.call(i,this.instance,"toolbar",o=>{if(o)return nM.error("[Toolbar] Failed to load",o),void this.setToolbarState(cc.UNINITIALIZED);this.setToolbarState(cc.LOADED),this._callLoadToolbar(r)}),Xs(qe,"turbolinks:load",()=>{this.setToolbarState(cc.UNINITIALIZED),this.loadToolbar(r)})}return!0}_loadEditor(t){return this.loadToolbar(t)}maybeLoadEditor(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;return this.maybeLoadToolbar(t,n,s)}}var _ce=pi("[TracingHeaders]");class wce{constructor(t){yt(this,"_restoreXHRPatch",void 0),yt(this,"_restoreFetchPatch",void 0),yt(this,"_startCapturing",()=>{var n,s,r,i;Et(this._restoreXHRPatch)&&((n=nn.__PosthogExtensions__)===null||n===void 0||(s=n.tracingHeadersPatchFns)===null||s===void 0||s._patchXHR(this.instance.sessionManager)),Et(this._restoreFetchPatch)&&((r=nn.__PosthogExtensions__)===null||r===void 0||(i=r.tracingHeadersPatchFns)===null||i===void 0||i._patchFetch(this.instance.sessionManager))}),this.instance=t}_loadScript(t){var n,s,r;(n=nn.__PosthogExtensions__)!==null&&n!==void 0&&n.tracingHeadersPatchFns&&t(),(s=nn.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"tracing-headers",i=>{if(i)return _ce.error("failed to load script",i);t()})}startIfEnabledOrStop(){var t,n;this.instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):((t=this._restoreXHRPatch)===null||t===void 0||t.call(this),(n=this._restoreFetchPatch)===null||n===void 0||n.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}var fu=pi("[Web Vitals]"),sM=9e5;class yce{constructor(t){var n;yt(this,"_enabledServerSide",!1),yt(this,"_initialized",!1),yt(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),yt(this,"_flushToCapture",()=>{clearTimeout(this._delayedFlushTimer),this.buffer.metrics.length!==0&&(this.instance.capture("$web_vitals",this.buffer.metrics.reduce((s,r)=>Ze(Ze({},s),{},{["$web_vitals_".concat(r.name,"_event")]:Ze({},r),["$web_vitals_".concat(r.name,"_value")]:r.value}),{})),this.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})}),yt(this,"_addToBuffer",s=>{var r,i=(r=this.instance.sessionManager)===null||r===void 0?void 0:r.checkAndGetSessionAndWindowId(!0);if(Et(i))fu.error("Could not read session ID. Dropping metrics!");else{this.buffer=this.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var a=this._currentURL();Et(a)||(qn(s?.name)||qn(s?.value)?fu.error("Invalid metric received",s):this._maxAllowedValue&&s.value>=this._maxAllowedValue?fu.error("Ignoring metric with value >= "+this._maxAllowedValue,s):(this.buffer.url!==a&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),Et(this.buffer.url)&&(this.buffer.url=a),this.buffer.firstMetricTimestamp=Et(this.buffer.firstMetricTimestamp)?Date.now():this.buffer.firstMetricTimestamp,s.attribution&&s.attribution.interactionTargetElement&&(s.attribution.interactionTargetElement=void 0),this.buffer.metrics.push(Ze(Ze({},s),{},{$current_url:a,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()))}}),yt(this,"_startCapturing",()=>{var s,r,i,a,o=nn.__PosthogExtensions__;Et(o)||Et(o.postHogWebVitalsCallbacks)||({onLCP:s,onCLS:r,onFCP:i,onINP:a}=o.postHogWebVitalsCallbacks),s&&r&&i&&a?(this.allowedMetrics.indexOf("LCP")>-1&&s(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&a(this._addToBuffer.bind(this)),this._initialized=!0):fu.error("web vitals callbacks not loaded - not starting")}),this.instance=t,this._enabledServerSide=!((n=this.instance.persistence)===null||n===void 0||!n.props[EP]),this.startIfEnabled()}get allowedMetrics(){var t,n,s=Ls(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 Et(s)?((n=this.instance.persistence)===null||n===void 0?void 0:n.props[TP])||["CLS","FCP","INP","LCP"]:s}get flushToCaptureTimeoutMs(){return(Ls(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){var t=Ls(this.instance.config.capture_performance)&&Ai(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:sM;return 0<t&&t<=6e4?sM:t}get isEnabled(){var t=$i?.protocol;if(t!=="http:"&&t!=="https:")return fu.info("Web Vitals are disabled on non-http/https protocols"),!1;var n=Ls(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:hc(this.instance.config.capture_performance)?this.instance.config.capture_performance:void 0;return hc(n)?n:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(fu.info("enabled, starting..."),this.loadScript(this._startCapturing))}onRemoteConfig(t){var n=Ls(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=Ls(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this.instance.persistence&&(this.instance.persistence.register({[EP]:n}),this.instance.persistence.register({[TP]:s})),this._enabledServerSide=n,this.startIfEnabled()}loadScript(t){var n,s,r;(n=nn.__PosthogExtensions__)!==null&&n!==void 0&&n.postHogWebVitalsCallbacks&&t(),(s=nn.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"web-vitals",i=>{i?fu.error("failed to load script",i):t()})}_currentURL(){var t=qe?qe.location.href:void 0;return t||fu.error("Could not determine current URL"),t}}var Cce=pi("[Heatmaps]");function rM(e){return Ls(e)&&"clientX"in e&&"clientY"in e&&Ai(e.clientX)&&Ai(e.clientY)}class Sce{constructor(t){var n;yt(this,"rageclicks",new eU),yt(this,"_enabledServerSide",!1),yt(this,"_initialized",!1),yt(this,"_flushInterval",null),this.instance=t,this._enabledServerSide=!((n=this.instance.persistence)===null||n===void 0||!n.props[ME])}get flushIntervalMilliseconds(){var t=5e3;return Ls(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 Et(this.instance.config.capture_heatmaps)?Et(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;Cce.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({[ME]: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(){qe&&Ft&&(Xs(qe,"beforeunload",this.flush.bind(this)),Xs(Ft,"click",t=>this._onClick(t||qe?.event),{capture:!0}),Xs(Ft,"mousemove",t=>this._onMouseMove(t||qe?.event),{capture:!0}),this.deadClicksCapture=new nU(this.instance,Lle,this._onDeadClick.bind(this)),this.deadClicksCapture.startIfEnabled(),this._initialized=!0)}_getProperties(t,n){var s=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),a=function(o,l,u){for(var d=o;d&&Zy(d)&&!Gu(d,"body");){if(d===u)return!1;if(wn(l,qe?.getComputedStyle(d).position))return!0;d=KH(d)}return!1}(qH(t),["fixed","sticky"],i);return{x:t.clientX+(a?0:r),y:t.clientY+(a?0:s),target_fixed:a,type:n}}_onClick(t){var n,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"click";if(!OP(t.target)&&rM(t)){var r=this._getProperties(t,s);(n=this.rageclicks)!==null&&n!==void 0&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this._capture(Ze(Ze({},r),{},{type:"rageclick"})),this._capture(r)}}_onMouseMove(t){!OP(t.target)&&rM(t)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(t,"mousemove"))},500))}_capture(t){if(qe){var n=qe.location.href;this.buffer=this.buffer||{},this.buffer[n]||(this.buffer[n]=[]),this.buffer[n].push(t)}}flush(){this.buffer&&!np(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class kce{constructor(t){this._instance=t}doPageView(t,n){var s,r=this._previousPageViewProperties(t,n);return this._currentPageview={pathname:(s=qe?.location.pathname)!==null&&s!==void 0?s:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var n;return this._previousPageViewProperties(t,(n=this._currentPageview)===null||n===void 0?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this._currentPageview)===null||t===void 0?void 0:t.pageViewId}}_previousPageViewProperties(t,n){var s=this._currentPageview;if(!s)return{$pageview_id:n};var r={$pageview_id:n,$prev_pageview_id:s.pageViewId},i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:o,maxScrollY:l,maxContentHeight:u,lastContentY:d,maxContentY:f}=i;if(!(Et(a)||Et(o)||Et(l)||Et(u)||Et(d)||Et(f))){a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),u=Math.ceil(u),d=Math.ceil(d),f=Math.ceil(f);var p=a<=1?1:Xa(o/a,0,1),g=a<=1?1:Xa(l/a,0,1),v=u<=1?1:Xa(d/u,0,1),b=u<=1?1:Xa(f/u,0,1);r=Ks(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:p,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:g,$prev_pageview_last_content:d,$prev_pageview_last_content_percentage:v,$prev_pageview_max_content:f,$prev_pageview_max_content_percentage:b})}}return s.pathname&&(r.$prev_pageview_pathname=s.pathname),s.timestamp&&(r.$prev_pageview_duration=(t.getTime()-s.timestamp.getTime())/1e3),r}}let Ece=class{constructor(t){this.instance=t}sendExceptionEvent(t){this.instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent"})}};var no="Mobile",ew="iOS",Cl="Android",Y0="Tablet",pU=Cl+" "+Y0,gU="iPad",mU="Apple",vU=mU+" Watch",X0="Safari",Vp="BlackBerry",bU="Samsung",xU=bU+"Browser",_U=bU+" Internet",Ih="Chrome",Tce=Ih+" OS",wU=Ih+" "+ew,h2="Internet Explorer",yU=h2+" "+no,f2="Opera",Rce=f2+" Mini",p2="Edge",CU="Microsoft "+p2,pp="Firefox",SU=pp+" "+ew,Q0="Nintendo",J0="PlayStation",gp="Xbox",kU=Cl+" "+no,EU=no+" "+X0,Im="Windows",eT=Im+" Phone",iM="Nokia",tT="Ouya",TU="Generic",Ace=TU+" "+no.toLowerCase(),RU=TU+" "+Y0.toLowerCase(),nT="Konqueror",ki="(\\d+(\\.\\d+)?)",K1=new RegExp("Version/"+ki),Fce=new RegExp(gp,"i"),Dce=new RegExp(J0+" \\w+","i"),Ice=new RegExp(Q0+" \\w+","i"),g2=new RegExp(Vp+"|PlayBook|BB10","i"),Nce={"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"},sT,Pce=(e,t)=>t&&wn(t,mU)||function(n){return wn(n,X0)&&!wn(n,Ih)&&!wn(n,Cl)}(e),aM=function(e,t){return t=t||"",wn(e," OPR/")&&wn(e,"Mini")?Rce:wn(e," OPR/")?f2:g2.test(e)?Vp:wn(e,"IE"+no)||wn(e,"WPDesktop")?yU:wn(e,xU)?_U:wn(e,p2)||wn(e,"Edg/")?CU:wn(e,"FBIOS")?"Facebook "+no:wn(e,"UCWEB")||wn(e,"UCBrowser")?"UC Browser":wn(e,"CriOS")?wU:wn(e,"CrMo")||wn(e,Ih)?Ih:wn(e,Cl)&&wn(e,X0)?kU:wn(e,"FxiOS")?SU:wn(e.toLowerCase(),nT.toLowerCase())?nT:Pce(e,t)?wn(e,no)?EU:X0:wn(e,pp)?pp:wn(e,"MSIE")||wn(e,"Trident/")?h2:wn(e,"Gecko")?pp:""},Mce={[yU]:[new RegExp("rv:"+ki)],[CU]:[new RegExp(p2+"?\\/"+ki)],[Ih]:[new RegExp("("+Ih+"|CrMo)\\/"+ki)],[wU]:[new RegExp("CriOS\\/"+ki)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ki)],[X0]:[K1],[EU]:[K1],[f2]:[new RegExp("(Opera|OPR)\\/"+ki)],[pp]:[new RegExp(pp+"\\/"+ki)],[SU]:[new RegExp("FxiOS\\/"+ki)],[nT]:[new RegExp("Konqueror[:/]?"+ki,"i")],[Vp]:[new RegExp(Vp+" "+ki),K1],[kU]:[new RegExp("android\\s"+ki,"i")],[_U]:[new RegExp(xU+"\\/"+ki)],[h2]:[new RegExp("(rv:|MSIE )"+ki)],Mozilla:[new RegExp("rv:"+ki)]},oM=[[new RegExp(gp+"; "+gp+" (.*?)[);]","i"),e=>[gp,e&&e[1]||""]],[new RegExp(Q0,"i"),[Q0,""]],[new RegExp(J0,"i"),[J0,""]],[g2,[Vp,""]],[new RegExp(Im,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[eT,""];if(new RegExp(no).test(t)&&!/IEMobile\b/.test(t))return[Im+" "+no,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var s=n[1],r=Nce[s]||"";return/arm/i.test(t)&&(r="RT"),[Im,r]}return[Im,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[ew,t.join(".")]}return[ew,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Et(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Cl+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Cl+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[Cl,t.join(".")]}return[Cl,""]}],[/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/,[Tce,""]],[/Linux|debian/i,["Linux",""]]],lM=function(e){return Ice.test(e)?Q0:Dce.test(e)?J0:Fce.test(e)?gp:new RegExp(tT,"i").test(e)?tT:new RegExp("("+eT+"|WPDesktop)","i").test(e)?eT:/iPad/.test(e)?gU:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?vU:g2.test(e)?Vp:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(iM,"i").test(e)?iM:/(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(no).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)?Cl:pU:Cl:new RegExp("(pda|"+no+")","i").test(e)?Ace:new RegExp(Y0,"i").test(e)&&!new RegExp(Y0+" pc","i").test(e)?RU:""},Yb="https?://(.*)",n_=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","irclid","_kx"],Oce=Jx(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],n_),Y1="<masked>",_s={campaignParams:function(){var{customTrackedParams:e,maskPersonalDataProperties:t,customPersonalDataProperties:n}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!Ft)return{};var s=t?Jx([],n_,n||[]):[];return this._campaignParamsFromUrl(L1(Ft.URL,s,Y1),e)},_campaignParamsFromUrl:function(e,t){var n=Oce.concat(t||[]),s={};return is(n,function(r){var i=X_(e,r);s[r]=i||null}),s},_searchEngine:function(e){return e?e.search(Yb+"google.([^/?]*)")===0?"google":e.search(Yb+"bing.com")===0?"bing":e.search(Yb+"yahoo.com")===0?"yahoo":e.search(Yb+"duckduckgo.com")===0?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){var t=_s._searchEngine(e),n=t!="yahoo"?"q":"p",s={};if(!dd(t)){s.$search_engine=t;var r=Ft?X_(Ft.referrer,n):"";r.length&&(s.ph_keyword=r)}return s},searchInfo:function(){var e=Ft?.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:aM,browserVersion:function(e,t){var n=aM(e,t),s=Mce[n];if(Et(s))return null;for(var r=0;r<s.length;r++){var i=s[r],a=e.match(i);if(a)return parseFloat(a[a.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},browserLanguagePrefix:function(){var e=this.browserLanguage();return typeof e=="string"?e.split("-")[0]:void 0},os:function(e){for(var t=0;t<oM.length;t++){var[n,s]=oM[t],r=n.exec(e),i=r&&(jo(s)?s(r,e):s);if(i)return i}return["",""]},device:lM,deviceType:function(e){var t=lM(e);return t===gU||t===pU||t==="Kobo"||t==="Kindle Fire"||t===RU?Y0:t===Q0||t===gp||t===J0||t===tT?"Console":t===vU?"Wearable":t?no:"Desktop"},referrer:function(){return Ft?.referrer||"$direct"},referringDomain:function(){var e;return Ft!=null&&Ft.referrer&&((e=fp(Ft.referrer))===null||e===void 0?void 0:e.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},personInfo:function(){var{maskPersonalDataProperties:e,customPersonalDataProperties:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e?Jx([],n_,t||[]):[],s=$i?.href.substring(0,1e3);return{r:this.referrer().substring(0,1e3),u:s?L1(s,n,Y1):void 0}},personPropsFromInfo:function(e){var t,{r:n,u:s}=e,r={$referrer:n,$referring_domain:n==null?void 0:n=="$direct"?"$direct":(t=fp(n))===null||t===void 0?void 0:t.host};if(s){r.$current_url=s;var i=fp(s);r.$host=i?.host,r.$pathname=i?.pathname;var a=this._campaignParamsFromUrl(s);Ks(r,a)}if(n){var o=this._searchInfoFromReferrer(n);Ks(r,o)}return r},initialPersonPropsFromInfo:function(e){var t=this.personPropsFromInfo(e),n={};return is(t,function(s,r){n["$initial_".concat(o2(r))]=s}),n},timezone:function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}},timezoneOffset:function(){try{return new Date().getTimezoneOffset()}catch{return}},properties:function(){var{maskPersonalDataProperties:e,customPersonalDataProperties:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!ar)return{};var n=e?Jx([],n_,t||[]):[],[s,r]=_s.os(ar);return Ks(K0({$os:s,$os_version:r,$browser:_s.browser(ar,navigator.vendor),$device:_s.device(ar),$device_type:_s.deviceType(ar),$timezone:_s.timezone(),$timezone_offset:_s.timezoneOffset()}),{$current_url:L1($i?.href,n,Y1),$host:$i?.host,$pathname:$i?.pathname,$raw_user_agent:ar.length>1e3?ar.substring(0,997)+"...":ar,$browser_version:_s.browserVersion(ar,navigator.vendor),$browser_language:_s.browserLanguage(),$browser_language_prefix:_s.browserLanguagePrefix(),$screen_height:qe?.screen.height,$screen_width:qe?.screen.width,$viewport_height:qe?.innerHeight,$viewport_width:qe?.innerWidth,$lib:"web",$lib_version:uc.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(!ar)return{};var[e,t]=_s.os(ar);return Ks(K0({$os:e,$os_version:t,$browser:_s.browser(ar,navigator.vendor)}),{$browser_version:_s.browserVersion(ar,navigator.vendor)})}},fl=pi("[FeatureFlags]"),X1="$active_feature_flags",Rf="$override_feature_flags",cM="$feature_flag_payloads",Zg="$override_feature_flag_payloads",uM="$feature_flag_request_id",dM=e=>{var t={};for(var[n,s]of Zx(e||{}))s&&(t[n]=s);return t},Lce=e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map(n=>{var s;return[n,(s=t[n].variant)!==null&&s!==void 0?s:t[n].enabled]})),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter(n=>t[n].enabled).filter(n=>{var s;return(s=t[n].metadata)===null||s===void 0?void 0:s.payload}).map(n=>{var s;return[n,(s=t[n].metadata)===null||s===void 0?void 0:s.payload]}))):fl.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"})(sT||(sT={}));class Bce{constructor(t){yt(this,"_override_warning",!1),yt(this,"_hasLoadedFlags",!1),yt(this,"_requestInFlight",!1),yt(this,"_reloadingDisabled",!1),yt(this,"_additionalReloadRequested",!1),yt(this,"_decideCalled",!1),yt(this,"_flagsLoadedFromRemote",!1),this.instance=t,this.featureFlagEventHandlers=[]}decide(){if(this.instance.config.__preview_remote_config)this._decideCalled=!0;else{var t=!this._reloadDebouncer&&(this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load);this._callDecideEndpoint({disableFlags:t})}}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.instance.get_property(LE),n=this.instance.get_property(Rf),s=this.instance.get_property(Zg);if(!s&&!n)return t||{};var r=Ks({},t||{}),i=[...new Set([...Object.keys(s||{}),...Object.keys(n||{})])];for(var a of i){var o,l,u=r[a],d=n?.[a],f=Et(d)?(o=u?.enabled)!==null&&o!==void 0&&o:!!d,p=Et(d)?u.variant:typeof d=="string"?d:void 0,g=s?.[a],v=Ze(Ze({},u),{},{enabled:f,variant:f?p??u?.variant:void 0});f!==u?.enabled&&(v.original_enabled=u?.enabled),p!==u?.variant&&(v.original_variant=u?.variant),g&&(v.metadata=Ze(Ze({},u?.metadata),{},{payload:g,original_payload:u==null||(l=u.metadata)===null||l===void 0?void 0:l.payload})),r[a]=v}return this._override_warning||(fl.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:s,finalDetails:r}),this._override_warning=!0),r}getFlagVariants(){var t=this.instance.get_property(sp),n=this.instance.get_property(Rf);if(!n)return t||{};for(var s=Ks({},t),r=Object.keys(n),i=0;i<r.length;i++)s[r[i]]=n[r[i]];return this._override_warning||(fl.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:n,finalFlags:s}),this._override_warning=!0),s}getFlagPayloads(){var t=this.instance.get_property(cM),n=this.instance.get_property(Zg);if(!n)return t||{};for(var s=Ks({},t||{}),r=Object.keys(n),i=0;i<r.length;i++)s[r[i]]=n[r[i]];return this._override_warning||(fl.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:n,finalPayloads:s}),this._override_warning=!0),s}reloadFeatureFlags(){this._reloadingDisabled||this.instance.config.advanced_disable_feature_flags||this._reloadDebouncer||(this._reloadDebouncer=setTimeout(()=>{this._callDecideEndpoint()},5))}clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this._reloadingDisabled=t}_callDecideEndpoint(t){var n;if(this.clearDebouncer(),!this.instance.config.advanced_disable_decide)if(this._requestInFlight)this._additionalReloadRequested=!0;else{var s={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:Ze(Ze({},((n=this.instance.persistence)===null||n===void 0?void 0:n.get_initial_props())||{}),this.instance.get_property(Fm)||{}),group_properties:this.instance.get_property(Vd)};(t!=null&&t.disableFlags||this.instance.config.advanced_disable_feature_flags)&&(s.disable_flags=!0);var r=this.instance.config.__preview_flags_v2&&this.instance.config.__preview_remote_config;r&&(s.timezone=_s.timezone()),this._requestInFlight=!0,this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api",r?"/flags/?v=2":"/decide/?v=4"),data:s,compression:this.instance.config.disable_compression?void 0:No.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:i=>{var a,o,l,u=!0;i.statusCode===200&&(this._additionalReloadRequested||(this.$anon_distinct_id=void 0),u=!1),this._requestInFlight=!1,this._decideCalled||(this._decideCalled=!0,this.instance._onRemoteConfig((l=i.json)!==null&&l!==void 0?l:{})),s.disable_flags&&!this._additionalReloadRequested||(this._flagsLoadedFromRemote=!u,i.json&&(a=i.json.quotaLimited)!==null&&a!==void 0&&a.includes(sT.FeatureFlags)?fl.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(this.receivedFeatureFlags((o=i.json)!==null&&o!==void 0?o:{},u),this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callDecideEndpoint())))}})}}getFeatureFlag(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){var s=this.getFlagVariants()[t],r="".concat(s),i=this.instance.get_property(uM)||void 0,a=this.instance.get_property(q_)||{};if((n.send_event||!("send_event"in n))&&(!(t in a)||!a[t].includes(r))){var o,l,u,d,f,p,g,v,b,x,_;Os(a[t])?a[t].push(r):a[t]=[r],(o=this.instance.persistence)===null||o===void 0||o.register({[q_]:a});var w=this.getFeatureFlagDetails(t),y={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:this.getFeatureFlagPayload(t)||null,$feature_flag_request_id:i,$feature_flag_bootstrapped_response:((l=this.instance.config.bootstrap)===null||l===void 0||(u=l.featureFlags)===null||u===void 0?void 0:u[t])||null,$feature_flag_bootstrapped_payload:((d=this.instance.config.bootstrap)===null||d===void 0||(f=d.featureFlagPayloads)===null||f===void 0?void 0:f[t])||null,$used_bootstrap_value:!this._flagsLoadedFromRemote};Et(w==null||(p=w.metadata)===null||p===void 0?void 0:p.version)||(y.$feature_flag_version=w.metadata.version);var S,C=(g=w==null||(v=w.reason)===null||v===void 0?void 0:v.description)!==null&&g!==void 0?g:w==null||(b=w.reason)===null||b===void 0?void 0:b.code;C&&(y.$feature_flag_reason=C),w!=null&&(x=w.metadata)!==null&&x!==void 0&&x.id&&(y.$feature_flag_id=w.metadata.id),Et(w?.original_variant)&&Et(w?.original_enabled)||(y.$feature_flag_original_response=Et(w.original_variant)?w.original_enabled:w.original_variant),w!=null&&(_=w.metadata)!==null&&_!==void 0&&_.original_payload&&(y.$feature_flag_original_payload=w==null||(S=w.metadata)===null||S===void 0?void 0:S.original_payload),this.instance.capture("$feature_flag_called",y)}return s}fl.warn('getFeatureFlag for key "'+t+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){return this.getFlagPayloads()[t]}getRemoteConfigPayload(t,n){var s=this.instance.config.token;this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=4"),data:{distinct_id:this.instance.get_distinct_id(),token:s},compression:this.instance.config.disable_compression?void 0:No.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:r=>{var i,a=(i=r.json)===null||i===void 0?void 0:i.featureFlagPayloads;n(a?.[t]||void 0)}})}isFeatureEnabled(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(t,n);fl.warn('isFeatureEnabled for key "'+t+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(n=>n!==t)}receivedFeatureFlags(t,n){if(this.instance.persistence){this._hasLoadedFlags=!0;var s=this.getFlagVariants(),r=this.getFlagPayloads(),i=this.getFlagsWithDetails();(function(a,o){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},d=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{},f=Lce(a),p=f.flags,g=f.featureFlags,v=f.featureFlagPayloads;if(g){var b=a.requestId;if(Os(g)){fl.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var x={};if(g)for(var _=0;_<g.length;_++)x[g[_]]=!0;o&&o.register({[X1]:g,[sp]:x})}else{var w=g,y=v,S=p;a.errorsWhileComputingFlags&&(w=Ze(Ze({},l),w),y=Ze(Ze({},u),y),S=Ze(Ze({},d),S)),o&&o.register(Ze({[X1]:Object.keys(dM(w)),[sp]:w||{},[cM]:y||{},[LE]:S||{}},b?{[uM]:b}:{}))}}})(t,this.instance.persistence,s,r,i),this._fireFeatureFlagsCallbacks(n)}}override(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];fl.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:n})}overrideFeatureFlags(t){if(!this.instance.__loaded||!this.instance.persistence)return fl.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.instance.persistence.unregister(Rf),this.instance.persistence.unregister(Zg),void this._fireFeatureFlagsCallbacks();if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var n,s=t;if(this._override_warning=!!((n=s.suppressWarning)!==null&&n!==void 0&&n),"flags"in s){if(s.flags===!1)this.instance.persistence.unregister(Rf);else if(s.flags)if(Os(s.flags)){for(var r={},i=0;i<s.flags.length;i++)r[s.flags[i]]=!0;this.instance.persistence.register({[Rf]:r})}else this.instance.persistence.register({[Rf]:s.flags})}return"payloads"in s&&(s.payloads===!1?this.instance.persistence.unregister(Zg):s.payloads&&this.instance.persistence.register({[Zg]:s.payloads})),void this._fireFeatureFlagsCallbacks()}this._fireFeatureFlagsCallbacks()}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this._hasLoadedFlags){var{flags:n,flagVariants:s}=this._prepareFeatureFlagsForCallbacks();t(n,s)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,n){var s,r=(this.instance.get_property(e_)||[]).find(l=>l.flagKey===t),i={["$feature_enrollment/".concat(t)]:n},a={$feature_flag:t,$feature_enrollment:n,$set:i};r&&(a.$early_access_feature_name=r.name),this.instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(i,!1);var o=Ze(Ze({},this.getFlagVariants()),{},{[t]:n});(s=this.instance.persistence)===null||s===void 0||s.register({[X1]:Object.keys(dM(o)),[sp]:o}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1],s=arguments.length>2?arguments[2]:void 0,r=this.instance.get_property(e_),i=s?"&".concat(s.map(a=>"stage=".concat(a)).join("&")):"";if(r&&!n)return t(r);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/early_access_features/?token=".concat(this.instance.config.token).concat(i)),method:"GET",callback:a=>{var o;if(a.json){var l=a.json.earlyAccessFeatures;return(o=this.instance.persistence)===null||o===void 0||o.register({[e_]:l}),t(l)}}})}_prepareFeatureFlagsForCallbacks(){var t=this.getFlags(),n=this.getFlagVariants();return{flags:t.filter(s=>n[s]),flagVariants:Object.keys(n).filter(s=>n[s]).reduce((s,r)=>(s[r]=n[r],s),{})}}_fireFeatureFlagsCallbacks(t){var{flags:n,flagVariants:s}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach(r=>r(n,s,{errorsLoading:t}))}setPersonPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],s=this.instance.get_property(Fm)||{};this.instance.register({[Fm]:Ze(Ze({},s),t)}),n&&this.instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this.instance.unregister(Fm)}setGroupPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],s=this.instance.get_property(Vd)||{};Object.keys(s).length!==0&&Object.keys(s).forEach(r=>{s[r]=Ze(Ze({},s[r]),t[r]),delete t[r]}),this.instance.register({[Vd]:Ze(Ze({},s),t)}),n&&this.instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var n=this.instance.get_property(Vd)||{};this.instance.register({[Vd]:Ze(Ze({},n),{},{[t]:{}})})}else this.instance.unregister(Vd)}}var jce=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Q1{constructor(t){this.config=t,this.props={},this.campaign_params_saved=!1,this.name=(n=>{var s="";return n.token&&(s=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+s+"_posthog"})(t),this.storage=this.buildStorage(t),this.load(),t.debug&&Lt.info("Persistence loaded",t.persistence,Ze({},this.props)),this.update_config(t,t),this.save()}buildStorage(t){jce.indexOf(t.persistence.toLowerCase())===-1&&(Lt.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n=t.persistence.toLowerCase();return n==="localstorage"&&gr.is_supported()?gr:n==="localstorage+cookie"&&Vb.is_supported()?Vb:n==="sessionstorage"&&Gr.is_supported()?Gr:n==="memory"?Mle:n==="cookie"?_c:Vb.is_supported()?Vb:_c}properties(){var t={};return is(this.props,function(n,s){if(s===sp&&Ls(n))for(var r=Object.keys(n),i=0;i<r.length;i++)t["$feature/".concat(r[i])]=n[r[i]];else o=s,l=!1,(dd(a=fle)?l:xP&&a.indexOf===xP?a.indexOf(o)!=-1:(is(a,function(u){if(l||(l=u===o))return $_}),l))||(t[s]=n);var a,o,l}),t}load(){if(!this.disabled){var t=this.storage.parse(this.name);t&&(this.props=Ks({},t))}}save(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure,this.config.debug)}remove(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}clear(){this.remove(),this.props={}}register_once(t,n,s){if(Ls(t)){Et(n)&&(n="None"),this.expire_days=Et(s)?this.default_expiry:s;var r=!1;if(is(t,(i,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==n||(this.props[a]=i,r=!0)}),r)return this.save(),!0}return!1}register(t,n){if(Ls(t)){this.expire_days=Et(n)?this.default_expiry:n;var s=!1;if(is(t,(r,i)=>{t.hasOwnProperty(i)&&this.props[i]!==r&&(this.props[i]=r,s=!0)}),s)return this.save(),!0}return!1}unregister(t){t in this.props&&(delete this.props[t],this.save())}update_campaign_params(){if(!this.campaign_params_saved){var t=_s.campaignParams({customTrackedParams:this.config.custom_campaign_params,maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});np(K0(t))||this.register(t),this.campaign_params_saved=!0}}update_search_keyword(){this.register(_s.searchInfo())}update_referrer_info(){this.register_once(_s.referrerInfo(),void 0)}set_initial_person_info(){this.props[UE]||this.props[GE]||this.register_once({[VE]:_s.personInfo({maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties})},void 0)}get_referrer_info(){return K0({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}get_initial_props(){var t={};is([GE,UE],r=>{var i=this.props[r];i&&is(i,function(a,o){t["$initial_"+o2(o)]=a})});var n=this.props[VE];if(n){var s=_s.initialPersonPropsFromInfo(n);Ks(t,s)}return t}safe_merge(t){return is(this.props,function(n,s){s in t||(t[s]=n)}),t}update_config(t,n){if(this.default_expiry=this.expire_days=t.cookie_expiration,this.set_disabled(t.disable_persistence),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==n.persistence){var s=this.buildStorage(t),r=this.props;this.clear(),this.storage=s,this.props=r,this.save()}}set_disabled(t){this.disabled=t,this.disabled?this.remove():this.save()}set_cross_subdomain(t){t!==this.cross_subdomain&&(this.cross_subdomain=t,this.remove(),this.save())}get_cross_subdomain(){return!!this.cross_subdomain}set_secure(t){t!==this.secure&&(this.secure=t,this.remove(),this.save())}set_event_timer(t,n){var s=this.props[Rm]||{};s[t]=n,this.props[Rm]=s,this.save()}remove_event_timer(t){var n=(this.props[Rm]||{})[t];return Et(n)||(delete this.props[Rm][t],this.save()),n}get_property(t){return this.props[t]}set_property(t,n){this.props[t]=n,this.save()}}var AU,js,FU,Yd,hM,DU,rT,IU,fM,iT,pM,gM,mM,vM,aT={},NU=[],Hce=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,m2=Array.isArray;function Pu(e,t){for(var n in t)e[n]=t[n];return e}function PU(e){var t=e.parentNode;t&&t.removeChild(e)}function J1(e,t,n,s,r){var i={type:e,props:t,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:r??++FU,__i:-1,__u:0};return r==null&&js.vnode!=null&&js.vnode(i),i}function v2(e){return e.children}function s_(e,t){this.props=e,this.context=t}function Wp(e,t){if(t==null)return e.__?Wp(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Wp(e):null}function MU(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 MU(e)}}function oT(e){(!e.__d&&(e.__d=!0)&&Yd.push(e)&&!tw.__r++||hM!==js.debounceRendering)&&((hM=js.debounceRendering)||DU)(tw)}function tw(){var e,t,n,s,r,i,a,o,l;for(Yd.sort(rT);e=Yd.shift();)e.__d&&(t=Yd.length,s=void 0,i=(r=(n=e).__v).__e,o=[],l=[],(a=n.__P)&&((s=Pu({},r)).__v=r.__v+1,js.vnode&&js.vnode(s),BU(a,s,r,n.__n,a.ownerSVGElement!==void 0,32&r.__u?[i]:null,o,i??Wp(r),!!(32&r.__u),l),s.__.__k[s.__i]=s,Vce(o,s,l),s.__e!=i&&MU(s)),Yd.length>t&&Yd.sort(rT));tw.__r=0}function OU(e,t,n,s,r,i,a,o,l,u,d){var f,p,g,v,b,x=s&&s.__k||NU,_=t.length;for(n.__d=l,Uce(n,t,x),l=n.__d,f=0;f<_;f++)(g=n.__k[f])!=null&&typeof g!="boolean"&&typeof g!="function"&&(p=g.__i===-1?aT:x[g.__i]||aT,g.__i=f,BU(e,g,p,r,i,a,o,l,u,d),v=g.__e,g.ref&&p.ref!=g.ref&&(p.ref&&b2(p.ref,null,g),d.push(g.ref,g.__c||v,g)),b==null&&v!=null&&(b=v),65536&g.__u||p.__k===g.__k?l=LU(g,l,e):typeof g.type=="function"&&g.__d!==void 0?l=g.__d:v&&(l=v.nextSibling),g.__d=void 0,g.__u&=-196609);n.__d=l,n.__e=b}function Uce(e,t,n){var s,r,i,a,o,l=t.length,u=n.length,d=u,f=0;for(e.__k=[],s=0;s<l;s++)(r=e.__k[s]=(r=t[s])==null||typeof r=="boolean"||typeof r=="function"?null:typeof r=="string"||typeof r=="number"||typeof r=="bigint"||r.constructor==String?J1(null,r,null,null,r):m2(r)?J1(v2,{children:r},null,null,null):r.constructor===void 0&&r.__b>0?J1(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)!=null?(r.__=e,r.__b=e.__b+1,o=Gce(r,n,a=s+f,d),r.__i=o,i=null,o!==-1&&(d--,(i=n[o])&&(i.__u|=131072)),i==null||i.__v===null?(o==-1&&f--,typeof r.type!="function"&&(r.__u|=65536)):o!==a&&(o===a+1?f++:o>a?d>l-a?f+=o-a:f--:f=o<a&&o==a-1?o-a:0,o!==s+f&&(r.__u|=65536))):(i=n[s])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=Wp(i)),lT(i,i,!1),n[s]=null,d--);if(d)for(s=0;s<u;s++)(i=n[s])!=null&&(131072&i.__u)==0&&(i.__e==e.__d&&(e.__d=Wp(i)),lT(i,i))}function LU(e,t,n){var s,r;if(typeof e.type=="function"){for(s=e.__k,r=0;s&&r<s.length;r++)s[r]&&(s[r].__=e,t=LU(s[r],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Gce(e,t,n,s){var r=e.key,i=e.type,a=n-1,o=n+1,l=t[n];if(l===null||l&&r==l.key&&i===l.type)return n;if(s>(l!=null&&(131072&l.__u)==0?1:0))for(;a>=0||o<t.length;){if(a>=0){if((l=t[a])&&(131072&l.__u)==0&&r==l.key&&i===l.type)return a;a--}if(o<t.length){if((l=t[o])&&(131072&l.__u)==0&&r==l.key&&i===l.type)return o;o++}}return-1}function bM(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Hce.test(t)?n:n+"px"}function Xb(e,t,n,s,r){var i;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof s=="string"&&(e.style.cssText=s=""),s)for(t in s)n&&t in n||bM(e.style,t,"");if(n)for(t in n)s&&n[t]===s[t]||bM(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?s?n.u=s.u:(n.u=Date.now(),e.addEventListener(t,i?_M:xM,i)):e.removeEventListener(t,i?_M:xM,i);else{if(r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,n))}}function xM(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(js.event?js.event(e):e)}function _M(e){return this.l[e.type+!0](js.event?js.event(e):e)}function BU(e,t,n,s,r,i,a,o,l,u){var d,f,p,g,v,b,x,_,w,y,S,C,E,k,F,A=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),i=[o=t.__e=n.__e]),(d=js.__b)&&d(t);e:if(typeof A=="function")try{if(_=t.props,w=(d=A.contextType)&&s[d.__c],y=d?w?w.props.value:d.__:s,n.__c?x=(f=t.__c=n.__c).__=f.__E:("prototype"in A&&A.prototype.render?t.__c=f=new A(_,y):(t.__c=f=new s_(_,y),f.constructor=A,f.render=$ce),w&&w.sub(f),f.props=_,f.state||(f.state={}),f.context=y,f.__n=s,p=f.__d=!0,f.__h=[],f._sb=[]),f.__s==null&&(f.__s=f.state),A.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Pu({},f.__s)),Pu(f.__s,A.getDerivedStateFromProps(_,f.__s))),g=f.props,v=f.state,f.__v=t,p)A.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(A.getDerivedStateFromProps==null&&_!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(_,y),!f.__e&&(f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(_,f.__s,y)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(f.props=_,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(I){I&&(I.__=t)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&a.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(_,f.__s,y),f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,v,b)})}if(f.context=y,f.props=_,f.__P=e,f.__e=!1,C=js.__r,E=0,"prototype"in A&&A.prototype.render){for(f.state=f.__s,f.__d=!1,C&&C(t),d=f.render(f.props,f.state,f.context),k=0;k<f._sb.length;k++)f.__h.push(f._sb[k]);f._sb=[]}else do f.__d=!1,C&&C(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++E<25);f.state=f.__s,f.getChildContext!=null&&(s=Pu(Pu({},s),f.getChildContext())),p||f.getSnapshotBeforeUpdate==null||(b=f.getSnapshotBeforeUpdate(g,v)),OU(e,m2(F=d!=null&&d.type===v2&&d.key==null?d.props.children:d)?F:[F],t,n,s,r,i,a,o,l,u),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),x&&(f.__E=f.__=null)}catch(I){t.__v=null,l||i!=null?(t.__e=o,t.__u|=l?160:32,i[i.indexOf(o)]=null):(t.__e=n.__e,t.__k=n.__k),js.__e(I,t,n)}else i==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Wce(n.__e,t,n,s,r,i,a,l,u);(d=js.diffed)&&d(t)}function Vce(e,t,n){t.__d=void 0;for(var s=0;s<n.length;s++)b2(n[s],n[++s],n[++s]);js.__c&&js.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(i){i.call(r)})}catch(i){js.__e(i,r.__v)}})}function Wce(e,t,n,s,r,i,a,o,l){var u,d,f,p,g,v,b,x=n.props,_=t.props,w=t.type;if(w==="svg"&&(r=!0),i!=null){for(u=0;u<i.length;u++)if((g=i[u])&&"setAttribute"in g==!!w&&(w?g.localName===w:g.nodeType===3)){e=g,i[u]=null;break}}if(e==null){if(w===null)return document.createTextNode(_);e=r?document.createElementNS("http://www.w3.org/2000/svg",w):document.createElement(w,_.is&&_),i=null,o=!1}if(w===null)x===_||o&&e.data===_||(e.data=_);else{if(i=i&&AU.call(e.childNodes),x=n.props||aT,!o&&i!=null)for(x={},u=0;u<e.attributes.length;u++)x[(g=e.attributes[u]).name]=g.value;for(u in x)g=x[u],u=="children"||(u=="dangerouslySetInnerHTML"?f=g:u==="key"||u in _||Xb(e,u,null,g,r));for(u in _)g=_[u],u=="children"?p=g:u=="dangerouslySetInnerHTML"?d=g:u=="value"?v=g:u=="checked"?b=g:u==="key"||o&&typeof g!="function"||x[u]===g||Xb(e,u,g,x[u],r);if(d)o||f&&(d.__html===f.__html||d.__html===e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(f&&(e.innerHTML=""),OU(e,m2(p)?p:[p],t,n,s,r&&w!=="foreignObject",i,a,i?i[0]:n.__k&&Wp(n,0),o,l),i!=null)for(u=i.length;u--;)i[u]!=null&&PU(i[u]);o||(u="value",v!==void 0&&(v!==e[u]||w==="progress"&&!v||w==="option"&&v!==x[u])&&Xb(e,u,v,x[u],!1),u="checked",b!==void 0&&b!==e[u]&&Xb(e,u,b,x[u],!1))}return e}function b2(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(s){js.__e(s,n)}}function lT(e,t,n){var s,r;if(js.unmount&&js.unmount(e),(s=e.ref)&&(s.current&&s.current!==e.__e||b2(s,null,t)),(s=e.__c)!=null){if(s.componentWillUnmount)try{s.componentWillUnmount()}catch(i){js.__e(i,t)}s.base=s.__P=null,e.__c=void 0}if(s=e.__k)for(r=0;r<s.length;r++)s[r]&&lT(s[r],t,n||typeof e.type!="function");n||e.__e==null||PU(e.__e),e.__=e.__e=e.__d=void 0}function $ce(e,t,n){return this.constructor(e,n)}AU=NU.slice,js={__e:function(e,t,n,s){for(var r,i,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((i=r.constructor)&&i.getDerivedStateFromError!=null&&(r.setState(i.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,s||{}),a=r.__d),a)return r.__E=r}catch(o){e=o}throw e}},FU=0,s_.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Pu({},this.state),typeof e=="function"&&(e=e(Pu({},n),this.props)),e&&Pu(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),oT(this))},s_.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),oT(this))},s_.prototype.render=v2,Yd=[],DU=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,rT=function(e,t){return e.__v.__b-t.__v.__b},tw.__r=0,IU=0,function(e){e.Button="button",e.Tab="tab",e.Selector="selector"}(fM||(fM={})),function(e){e.Left="left",e.Center="center",e.Right="right",e.NextToTrigger="next_to_trigger"}(iT||(iT={})),function(e){e.Popover="popover",e.API="api",e.Widget="widget"}(pM||(pM={})),function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"}(gM||(gM={})),function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"}(mM||(mM={})),function(e){e.Once="once",e.Recurring="recurring",e.Always="always"}(vM||(vM={}));var $p=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}},jr=pi("[Surveys]"),wM={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=>$p(t,n)),not_regex:(e,t)=>e.every(n=>!$p(t,n)),exact:(e,t)=>e.some(n=>t===n),is_not:(e,t)=>e.every(n=>t!==n)};function yM(e){return e??"icontains"}iT.Right;(function(e,t){var n={__c:t="__cC"+IU++,__:e,Consumer:function(s,r){return s.children(r)},Provider:function(s){var r,i;return this.getChildContext||(r=[],(i={})[t]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(a){this.props.value!==a.value&&r.some(function(o){o.__e=!0,oT(o)})},this.sub=function(a){r.push(a);var o=a.componentWillUnmount;a.componentWillUnmount=function(){r.splice(r.indexOf(a),1),o&&o.call(a)}}),s.children}};n.Provider.__=n.Consumer.contextType=n})({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed:()=>{},isPopup:!0,onPreviewSubmit:()=>{}});let jU=class{constructor(){yt(this,"events",{}),this.events={}}on(t,n){return this.events[t]||(this.events[t]=[]),this.events[t].push(n),()=>{this.events[t]=this.events[t].filter(s=>s!==n)}}emit(t,n){for(var s of this.events[t]||[])s(n);for(var r of this.events["*"]||[])r(t,n)}},zce=class zf{constructor(t){yt(this,"_debugEventEmitter",new jU),yt(this,"checkStep",(n,s)=>this.checkStepEvent(n,s)&&this.checkStepUrl(n,s)&&this.checkStepElement(n,s)),yt(this,"checkStepEvent",(n,s)=>s==null||!s.event||n?.event===s?.event),this.instance=t,this.actionEvents=new Set,this.actionRegistry=new Set}init(){var t;if(!Et((t=this.instance)===null||t===void 0?void 0:t._addCaptureHook)){var n;(n=this.instance)===null||n===void 0||n._addCaptureHook((s,r)=>{this.on(s,r)})}}register(t){var n,s;if(!Et((n=this.instance)===null||n===void 0?void 0:n._addCaptureHook)&&(t.forEach(a=>{var o,l;(o=this.actionRegistry)===null||o===void 0||o.add(a),(l=a.steps)===null||l===void 0||l.forEach(u=>{var d;(d=this.actionEvents)===null||d===void 0||d.add(u?.event||"")})}),(s=this.instance)!==null&&s!==void 0&&s.autocapture)){var r,i=new Set;t.forEach(a=>{var o;(o=a.steps)===null||o===void 0||o.forEach(l=>{l!=null&&l.selector&&i.add(l?.selector)})}),(r=this.instance)===null||r===void 0||r.autocapture.setElementSelectors(i)}}on(t,n){var s;n!=null&&t.length!=0&&(this.actionEvents.has(t)||this.actionEvents.has(n?.event))&&this.actionRegistry&&((s=this.actionRegistry)===null||s===void 0?void 0:s.size)>0&&this.actionRegistry.forEach(r=>{this.checkAction(n,r)&&this._debugEventEmitter.emit("actionCaptured",r.name)})}_addActionHook(t){this.onAction("actionCaptured",n=>t(n))}checkAction(t,n){if(n?.steps==null)return!1;for(var s of n.steps)if(this.checkStep(t,s))return!0;return!1}onAction(t,n){return this._debugEventEmitter.on(t,n)}checkStepUrl(t,n){if(n!=null&&n.url){var s,r=t==null||(s=t.properties)===null||s===void 0?void 0:s.$current_url;if(!r||typeof r!="string"||!zf.matchString(r,n?.url,n?.url_matching||"contains"))return!1}return!0}static matchString(t,n,s){switch(s){case"regex":return!!qe&&$p(t,n);case"exact":return n===t;case"contains":var r=zf.escapeStringRegexp(n).replace(/_/g,".").replace(/%/g,".*");return $p(t,r);default:return!1}}static escapeStringRegexp(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}checkStepElement(t,n){if((n!=null&&n.href||n!=null&&n.tag_name||n!=null&&n.text)&&!this.getElementsList(t).some(i=>!(n!=null&&n.href&&!zf.matchString(i.href||"",n?.href,n?.href_matching||"exact"))&&(n==null||!n.tag_name||i.tag_name===n?.tag_name)&&!(n!=null&&n.text&&!zf.matchString(i.text||"",n?.text,n?.text_matching||"exact")&&!zf.matchString(i.$el_text||"",n?.text,n?.text_matching||"exact"))))return!1;if(n!=null&&n.selector){var s,r=t==null||(s=t.properties)===null||s===void 0?void 0:s.$element_selectors;if(!r||!r.includes(n?.selector))return!1}return!0}getElementsList(t){return t?.properties.$elements==null?[]:t?.properties.$elements}},cT=class HU{constructor(t){this.instance=t,this.eventToSurveys=new Map,this.actionToSurveys=new Map}register(t){var n;Et((n=this.instance)===null||n===void 0?void 0:n._addCaptureHook)||(this.setupEventBasedSurveys(t),this.setupActionBasedSurveys(t))}setupActionBasedSurveys(t){var n=t.filter(s=>{var r,i,a,o;return((r=s.conditions)===null||r===void 0?void 0:r.actions)&&((i=s.conditions)===null||i===void 0||(a=i.actions)===null||a===void 0||(o=a.values)===null||o===void 0?void 0:o.length)>0});n.length!==0&&(this.actionMatcher==null&&(this.actionMatcher=new zce(this.instance),this.actionMatcher.init(),this.actionMatcher._addActionHook(s=>{this.onAction(s)})),n.forEach(s=>{var r,i,a,o,l,u,d,f,p,g;s.conditions&&(r=s.conditions)!==null&&r!==void 0&&r.actions&&(i=s.conditions)!==null&&i!==void 0&&(a=i.actions)!==null&&a!==void 0&&a.values&&((o=s.conditions)===null||o===void 0||(l=o.actions)===null||l===void 0||(u=l.values)===null||u===void 0?void 0:u.length)>0&&((d=this.actionMatcher)===null||d===void 0||d.register(s.conditions.actions.values),(f=s.conditions)===null||f===void 0||(p=f.actions)===null||p===void 0||(g=p.values)===null||g===void 0||g.forEach(v=>{if(v&&v.name){var b=this.actionToSurveys.get(v.name);b&&b.push(s.id),this.actionToSurveys.set(v.name,b||[s.id])}}))}))}setupEventBasedSurveys(t){var n;t.filter(s=>{var r,i,a,o;return((r=s.conditions)===null||r===void 0?void 0:r.events)&&((i=s.conditions)===null||i===void 0||(a=i.events)===null||a===void 0||(o=a.values)===null||o===void 0?void 0:o.length)>0}).length!==0&&((n=this.instance)===null||n===void 0||n._addCaptureHook((s,r)=>{this.onEvent(s,r)}),t.forEach(s=>{var r,i,a;(r=s.conditions)===null||r===void 0||(i=r.events)===null||i===void 0||(a=i.values)===null||a===void 0||a.forEach(o=>{if(o&&o.name){var l=this.eventToSurveys.get(o.name);l&&l.push(s.id),this.eventToSurveys.set(o.name,l||[s.id])}})}))}onEvent(t,n){var s,r,i=((s=this.instance)===null||s===void 0||(r=s.persistence)===null||r===void 0?void 0:r.props[Gb])||[];if(HU.SURVEY_SHOWN_EVENT_NAME==t&&n&&i.length>0){var a,o=n==null||(a=n.properties)===null||a===void 0?void 0:a.$survey_id;if(o){var l=i.indexOf(o);l>=0&&(i.splice(l,1),this._updateActivatedSurveys(i))}}else this.eventToSurveys.has(t)&&this._updateActivatedSurveys(i.concat(this.eventToSurveys.get(t)||[]))}onAction(t){var n,s,r=((n=this.instance)===null||n===void 0||(s=n.persistence)===null||s===void 0?void 0:s.props[Gb])||[];this.actionToSurveys.has(t)&&this._updateActivatedSurveys(r.concat(this.actionToSurveys.get(t)||[]))}_updateActivatedSurveys(t){var n,s;(n=this.instance)===null||n===void 0||(s=n.persistence)===null||s===void 0||s.register({[Gb]:[...new Set(t)]})}getSurveys(){var t,n,s=(t=this.instance)===null||t===void 0||(n=t.persistence)===null||n===void 0?void 0:n.props[Gb];return s||[]}getEventToSurveys(){return this.eventToSurveys}_getActionMatcher(){return this.actionMatcher}};yt(cT,"SURVEY_SHOWN_EVENT_NAME","survey shown");let qce=class{constructor(t){yt(this,"_isFetchingSurveys",!1),yt(this,"_isInitializingSurveys",!1),yt(this,"_surveyCallbacks",[]),this.instance=t,this._surveyEventReceiver=null}onRemoteConfig(t){var n=t.surveys;if(qn(n))return jr.warn("Decide not loaded yet. Not loading surveys.");var s=Os(n);this._hasSurveys=s?n.length>0:n,jr.info("decide response received, hasSurveys: ".concat(this._hasSurveys)),this._hasSurveys&&this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");var t=(()=>{for(var n=[],s=0;s<localStorage.length;s++){var r=localStorage.key(s);r!=null&&r.startsWith("seenSurvey_")&&n.push(r)}return n})();t.forEach(n=>localStorage.removeItem(n))}loadIfEnabled(){if(!this._surveyManager)if(this._isInitializingSurveys)jr.info("Already initializing surveys, skipping...");else if(this.instance.config.disable_surveys)jr.info("Disabled. Not loading surveys.");else{var t=nn?.__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 cT(this.instance),jr.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0});else{var s=t.loadExternalDependency;if(s)s(this.instance,"surveys",i=>{if(i||!t.generateSurveys)return jr.error("Could not load surveys script",i),void(this._isInitializingSurveys=!1);this._surveyManager=t.generateSurveys(this.instance),this._isInitializingSurveys=!1,this._surveyEventReceiver=new cT(this.instance),jr.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})});else{var r="PostHog loadExternalDependency extension not found. Cannot load remote config.";jr.error(r),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:r})}}}catch(i){throw jr.error("Error initializing surveys",i),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:"Error initializing surveys"}),i}}else jr.info("No surveys to load.");else jr.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 jr.info("Disabled. Not loading surveys."),t([]);var s=this.instance.get_property(BE);if(s&&!n)return t(s,{isLoaded:!0});if(this._isFetchingSurveys)return t([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this._isFetchingSurveys=!0,this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/surveys/?token=".concat(this.instance.config.token)),method:"GET",timeout:this.instance.config.surveys_request_timeout_ms,callback:r=>{var i;this._isFetchingSurveys=!1;var a=r.statusCode;if(a!==200||!r.json){var o="Surveys API could not be loaded, status: ".concat(a);return jr.error(o),t([],{isLoaded:!1,error:o})}var l,u=r.json.surveys||[],d=u.filter(f=>{var p,g,v,b,x,_,w,y,S,C,E,k;return((p=f.conditions)===null||p===void 0?void 0:p.events)&&((g=f.conditions)===null||g===void 0||(v=g.events)===null||v===void 0?void 0:v.values)&&((b=f.conditions)===null||b===void 0||(x=b.events)===null||x===void 0||(_=x.values)===null||_===void 0?void 0:_.length)>0||((w=f.conditions)===null||w===void 0?void 0:w.actions)&&((y=f.conditions)===null||y===void 0||(S=y.actions)===null||S===void 0?void 0:S.values)&&((C=f.conditions)===null||C===void 0||(E=C.actions)===null||E===void 0||(k=E.values)===null||k===void 0?void 0:k.length)>0});return d.length>0&&((l=this._surveyEventReceiver)===null||l===void 0||l.register(d)),(i=this.instance.persistence)===null||i===void 0||i.register({[BE]:u}),t(u,{isLoaded:!0})}})}catch(r){throw this._isFetchingSurveys=!1,r}}_notifySurveyCallbacks(t){for(var n of this._surveyCallbacks)try{t.isLoaded?this.getSurveys(n):n([],t)}catch(s){jr.error("Error in survey callback",s)}}isSurveyFeatureFlagEnabled(t){return!t||this.instance.featureFlags.isFeatureEnabled(t)}getActiveMatchingSurveys(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.getSurveys(s=>{var r,i=s.filter(l=>!(!l.start_date||l.end_date)).filter(l=>{var u;if(!l.conditions)return!0;var d=function(g){var v,b,x;if((v=g.conditions)===null||v===void 0||!v.url)return!0;var _=qe==null||(b=qe.location)===null||b===void 0?void 0:b.href;if(!_)return!1;var w=[g.conditions.url];return wM[yM((x=g.conditions)===null||x===void 0?void 0:x.urlMatchType)](w,_)}(l),f=(u=l.conditions)===null||u===void 0||!u.selector||Ft?.querySelector(l.conditions.selector),p=function(g){var v,b,x;if((v=g.conditions)===null||v===void 0||!v.deviceTypes||((b=g.conditions)===null||b===void 0?void 0:b.deviceTypes.length)===0)return!0;if(!ar)return!1;var _=_s.deviceType(ar);return wM[yM((x=g.conditions)===null||x===void 0?void 0:x.deviceTypesMatchType)](g.conditions.deviceTypes,_)}(l);return d&&f&&p}),a=(r=this._surveyEventReceiver)===null||r===void 0?void 0:r.getSurveys(),o=i.filter(l=>{var u,d,f,p,g,v,b,x,_;if(!(l.linked_flag_key||l.targeting_flag_key||l.internal_targeting_flag_key||(u=l.feature_flag_keys)!==null&&u!==void 0&&u.length))return!0;var w=this.isSurveyFeatureFlagEnabled(l.linked_flag_key),y=this.isSurveyFeatureFlagEnabled(l.targeting_flag_key),S=((d=(f=l.conditions)===null||f===void 0||(p=f.events)===null||p===void 0||(g=p.values)===null||g===void 0?void 0:g.length)!==null&&d!==void 0?d:0)>0,C=((v=(b=l.conditions)===null||b===void 0||(x=b.actions)===null||x===void 0||(_=x.values)===null||_===void 0?void 0:_.length)!==null&&v!==void 0?v:0)>0,E=!S&&!C||a?.includes(l.id),k=this._canActivateRepeatedly(l)||this.isSurveyFeatureFlagEnabled(l.internal_targeting_flag_key),F=this.checkFlags(l);return w&&y&&k&&E&&F});return t(o)},n)}checkFlags(t){var n;return(n=t.feature_flag_keys)===null||n===void 0||!n.length||t.feature_flag_keys.every(s=>{var{key:r,value:i}=s;return!r||!i||this.instance.featureFlags.isFeatureEnabled(i)})}_canActivateRepeatedly(t){var n;return qn((n=nn.__PosthogExtensions__)===null||n===void 0?void 0:n.canActivateRepeatedly)?(jr.warn("init was not called"),!1):nn.__PosthogExtensions__.canActivateRepeatedly(t)}canRenderSurvey(t){if(qn(this._surveyManager))return jr.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var n=null;return this.getSurveys(s=>{var r=s.filter(i=>i.id===t)[0];n=r?Ze({},this._surveyManager.canRenderSurvey(r)):{visible:!1,disabledReason:"Survey not found"}}),n}renderSurvey(t,n){qn(this._surveyManager)?jr.warn("init was not called"):this.getSurveys(s=>{var r=s.filter(i=>i.id===t)[0];this._surveyManager.renderSurvey(r,Ft?.querySelector(n))})}};var CM=pi("[RateLimiter]");let Kce=class{constructor(t){var n,s;yt(this,"serverLimits",{}),yt(this,"lastEventRateLimited",!1),yt(this,"checkForLimiting",r=>{var i=r.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(a=>{CM.info("".concat(a||"events"," is quota limited.")),this.serverLimits[a]=new Date().getTime()+6e4})}catch(a){return void CM.warn('could not rate limit - continuing. Error: "'.concat(a?.message,'"'),{text:i})}}),this.instance=t,this.captureEventsPerSecond=((n=t.config.rate_limiting)===null||n===void 0?void 0:n.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((s=t.config.rate_limiting)===null||s===void 0?void 0:s.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(){var t,n,s,r=arguments.length>0&&arguments[0]!==void 0&&arguments[0],i=new Date().getTime(),a=(t=(n=this.instance.persistence)===null||n===void 0?void 0:n.get_property(HE))!==null&&t!==void 0?t:{tokens:this.captureEventsBurstLimit,last:i};a.tokens+=(i-a.last)/1e3*this.captureEventsPerSecond,a.last=i,a.tokens>this.captureEventsBurstLimit&&(a.tokens=this.captureEventsBurstLimit);var o=a.tokens<1;return o||r||(a.tokens=Math.max(0,a.tokens-1)),!o||this.lastEventRateLimited||r||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to ".concat(this.captureEventsPerSecond," events per second and ").concat(this.captureEventsBurstLimit," events burst limit.")},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=o,(s=this.instance.persistence)===null||s===void 0||s.set_property(HE,a),{isRateLimited:o,remainingTokens:a.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}};var Ld=pi("[RemoteConfig]");let Yce=class{constructor(t){this.instance=t}get remoteConfig(){var t,n;return(t=nn._POSTHOG_REMOTE_CONFIG)===null||t===void 0||(n=t[this.instance.config.token])===null||n===void 0?void 0:n.config}_loadRemoteConfigJs(t){var n,s,r;(n=nn.__PosthogExtensions__)!==null&&n!==void 0&&n.loadExternalDependency?(s=nn.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this.instance,"remote-config",()=>t(this.remoteConfig)):(Ld.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 Ld.info("Using preloaded remote config",this.remoteConfig),void this.onRemoteConfig(this.remoteConfig);if(this.instance.config.advanced_disable_decide)return void Ld.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(t=>{if(!t)return Ld.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){Ld.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()):Ld.info("__preview_remote_config is disabled. Logging config instead",t):Ld.error("Failed to fetch remote config from PostHog.")}};var Xce=function(e){var t,n,s,r,i="";for(t=n=0,s=(e=(e+"").replace(/\r\n/g,`
4
4
  `).replace(/\r/g,`
5
5
  `)).length,r=0;r<s;r++){var a=e.charCodeAt(r),o=null;a<128?n++:o=a>127&&a<2048?String.fromCharCode(a>>6|192,63&a|128):String.fromCharCode(a>>12|224,a>>6&63|128,63&a|128),dd(o)||(n>t&&(i+=e.substring(t,n)),i+=o,t=n=r+1)}return n>t&&(i+=e.substring(t,e.length)),i},Qce=!!NE||!!IE,SM="text/plain",nw=(e,t)=>{var[n,s]=e.split("?"),r=Ze({},t);s?.split("&").forEach(a=>{var[o]=a.split("=");delete r[o]});var i=yle(r);return i=i?(s?s+"&":"")+i:s,"".concat(n,"?").concat(i)},Nm=(e,t)=>JSON.stringify(e,(n,s)=>typeof s=="bigint"?s.toString():s,t),Z1=e=>{var{data:t,compression:n}=e;if(t){if(n===No.GZipJS){var s=uU(dU(Nm(t)),{mtime:0}),r=new Blob([s],{type:SM});return{contentType:SM,body:r,estimatedSize:r.size}}if(n===No.Base64){var i=function(l){var u,d,f,p,g,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",b=0,x=0,_="",w=[];if(!l)return l;l=Xce(l);do u=(g=l.charCodeAt(b++)<<16|l.charCodeAt(b++)<<8|l.charCodeAt(b++))>>18&63,d=g>>12&63,f=g>>6&63,p=63&g,w[x++]=v.charAt(u)+v.charAt(d)+v.charAt(f)+v.charAt(p);while(b<l.length);switch(_=w.join(""),l.length%3){case 1:_=_.slice(0,-2)+"==";break;case 2:_=_.slice(0,-1)+"="}return _}(Nm(t)),a=(l=>"data="+encodeURIComponent(typeof l=="string"?l:Nm(l)))(i);return{contentType:"application/x-www-form-urlencoded",body:a,estimatedSize:new Blob([a]).size}}var o=Nm(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Jm=[];IE&&Jm.push({transport:"fetch",method:e=>{var t,n,{contentType:s,body:r,estimatedSize:i}=(t=Z1(e))!==null&&t!==void 0?t:{},a=new Headers;is(e.headers,function(d,f){a.append(f,d)}),s&&a.append("Content-Type",s);var o=e.url,l=null;if(_P){var u=new _P;l={signal:u.signal,timeout:setTimeout(()=>u.abort(),e.timeout)}}IE(o,Ze({method:e?.method||"GET",headers:a,keepalive:e.method==="POST"&&(i||0)<52428.8,body:r,signal:(n=l)===null||n===void 0?void 0:n.signal},e.fetchOptions)).then(d=>d.text().then(f=>{var p,g={statusCode:d.status,text:f};if(d.status===200)try{g.json=JSON.parse(f)}catch(v){Lt.error(v)}(p=e.callback)===null||p===void 0||p.call(e,g)})).catch(d=>{var f;Lt.error(d),(f=e.callback)===null||f===void 0||f.call(e,{statusCode:0,text:d})}).finally(()=>l?clearTimeout(l.timeout):null)}}),NE&&Jm.push({transport:"XHR",method:e=>{var t,n=new NE;n.open(e.method||"GET",e.url,!0);var{contentType:s,body:r}=(t=Z1(e))!==null&&t!==void 0?t:{};is(e.headers,function(i,a){n.setRequestHeader(a,i)}),s&&n.setRequestHeader("Content-Type",s),e.timeout&&(n.timeout=e.timeout),n.withCredentials=!0,n.onreadystatechange=()=>{if(n.readyState===4){var i,a={statusCode:n.status,text:n.responseText};if(n.status===200)try{a.json=JSON.parse(n.responseText)}catch{}(i=e.callback)===null||i===void 0||i.call(e,a)}},n.send(r)}}),va!=null&&va.sendBeacon&&Jm.push({transport:"sendBeacon",method:e=>{var t=nw(e.url,{beacon:"1"});try{var n,{contentType:s,body:r}=(n=Z1(e))!==null&&n!==void 0?n:{},i=typeof r=="string"?new Blob([r],{type:s}):r;va.sendBeacon(t,i)}catch{}}});var uT=3e3;let Jce=class{constructor(t,n){yt(this,"isPaused",!0),yt(this,"queue",[]),this.flushTimeoutMs=Xa(n?.flush_interval_ms||uT,250,5e3,"flush interval",uT),this.sendRequest=t}enqueue(t){this.queue.push(t),this.flushTimeout||this.setFlushTimeout()}unload(){this.clearFlushTimeout();var t=this.queue.length>0?this.formatQueue():{},n=Object.values(t),s=[...n.filter(r=>r.url.indexOf("/e")===0),...n.filter(r=>r.url.indexOf("/e")!==0)];s.map(r=>{this.sendRequest(Ze(Ze({},r),{},{transport:"sendBeacon"}))})}enable(){this.isPaused=!1,this.setFlushTimeout()}setFlushTimeout(){var t=this;this.isPaused||(this.flushTimeout=setTimeout(()=>{if(this.clearFlushTimeout(),this.queue.length>0){var n=this.formatQueue(),s=function(i){var a=n[i],o=new Date().getTime();a.data&&Os(a.data)&&is(a.data,l=>{l.offset=Math.abs(l.timestamp-o),delete l.timestamp}),t.sendRequest(a)};for(var r in n)s(r)}},this.flushTimeoutMs))}clearFlushTimeout(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}formatQueue(){var t={};return is(this.queue,n=>{var s,r=n,i=(r?r.batchKey:null)||r.url;Et(t[i])&&(t[i]=Ze(Ze({},r),{},{data:[]})),(s=t[i].data)===null||s===void 0||s.push(r.data)}),this.queue=[],t}};var Zce=["retriesPerformedSoFar"];let eue=class{constructor(t){yt(this,"isPolling",!1),yt(this,"pollIntervalMs",3e3),yt(this,"queue",[]),this.instance=t,this.queue=[],this.areWeOnline=!0,!Et(qe)&&"onLine"in qe.navigator&&(this.areWeOnline=qe.navigator.onLine,Xs(qe,"online",()=>{this.areWeOnline=!0,this.flush()}),Xs(qe,"offline",()=>{this.areWeOnline=!1}))}retriableRequest(t){var{retriesPerformedSoFar:n}=t,s=jH(t,Zce);Ai(n)&&n>0&&(s.url=nw(s.url,{retry_count:n})),this.instance._send_request(Ze(Ze({},s),{},{callback:r=>{var i;r.statusCode!==200&&(r.statusCode<400||r.statusCode>=500)&&(n??0)<10?this.enqueue(Ze({retriesPerformedSoFar:n},s)):(i=s.callback)===null||i===void 0||i.call(s,r)}}))}enqueue(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var s=function(a){var o=3e3*Math.pow(2,a),l=o/2,u=Math.min(18e5,o),d=(Math.random()-.5)*(u-l);return Math.ceil(u+d)}(n),r=Date.now()+s;this.queue.push({retryAt:r,requestOptions:t});var i="Enqueued failed request for retry in ".concat(s);navigator.onLine||(i+=" (Browser is offline)"),Lt.warn(i),this.isPolling||(this.isPolling=!0,this.poll())}poll(){this.poller&&clearTimeout(this.poller),this.poller=setTimeout(()=>{this.areWeOnline&&this.queue.length>0&&this.flush(),this.poll()},this.pollIntervalMs)}flush(){var t=Date.now(),n=[],s=this.queue.filter(i=>i.retryAt<t||(n.push(i),!1));if(this.queue=n,s.length>0)for(var{requestOptions:r}of s)this.retriableRequest(r)}unload(){for(var{requestOptions:t}of(this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.queue))try{this.instance._send_request(Ze(Ze({},t),{},{transport:"sendBeacon"}))}catch(n){Lt.error(n)}this.queue=[]}},tue=class{constructor(t){yt(this,"_updateScrollData",()=>{var n,s,r,i;this.context||(this.context={});var a=this.scrollElement(),o=this.scrollY(),l=a?Math.max(0,a.scrollHeight-a.clientHeight):0,u=o+(a?.clientHeight||0),d=a?.scrollHeight||0;this.context.lastScrollY=Math.ceil(o),this.context.maxScrollY=Math.max(o,(n=this.context.maxScrollY)!==null&&n!==void 0?n:0),this.context.maxScrollHeight=Math.max(l,(s=this.context.maxScrollHeight)!==null&&s!==void 0?s:0),this.context.lastContentY=u,this.context.maxContentY=Math.max(u,(r=this.context.maxContentY)!==null&&r!==void 0?r:0),this.context.maxContentHeight=Math.max(d,(i=this.context.maxContentHeight)!==null&&i!==void 0?i:0)}),this.instance=t}getContext(){return this.context}resetContext(){var t=this.context;return setTimeout(this._updateScrollData,0),t}startMeasuringScrollPosition(){Xs(qe,"scroll",this._updateScrollData,{capture:!0}),Xs(qe,"scrollend",this._updateScrollData,{capture:!0}),Xs(qe,"resize",this._updateScrollData)}scrollElement(){if(!this.instance.config.scroll_root_selector)return qe?.document.documentElement;var t=Os(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector];for(var n of t){var s=qe?.document.querySelector(n);if(s)return s}}scrollY(){if(this.instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollTop||0}return qe&&(qe.scrollY||qe.pageYOffset||qe.document.documentElement.scrollTop)||0}scrollX(){if(this.instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollLeft||0}return qe&&(qe.scrollX||qe.pageXOffset||qe.document.documentElement.scrollLeft)||0}};var nue=e=>_s.personInfo({maskPersonalDataProperties:e?.config.mask_personal_data_properties,customPersonalDataProperties:e?.config.custom_personal_data_properties});let sue=class{constructor(t,n,s,r){yt(this,"_onSessionIdCallback",i=>{var a=this._getStored();if(!a||a.sessionId!==i){var o={sessionId:i,props:this._sessionSourceParamGenerator(this.instance)};this._persistence.register({[jE]:o})}}),this.instance=t,this._sessionIdManager=n,this._persistence=s,this._sessionSourceParamGenerator=r||nue,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[jE]}getSetOnceProps(){var t,n=(t=this._getStored())===null||t===void 0?void 0:t.props;return n?"r"in n?_s.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 is(K0(this.getSetOnceProps()),(n,s)=>{s==="$current_url"&&(s="url"),t["$session_entry_".concat(o2(s))]=n}),t}};var kM=pi("[SessionId]");let rue=class{constructor(t,n,s){var r;if(yt(this,"_sessionIdChangedHandlers",[]),!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.__preview_experimental_cookieless_mode)throw new Error("SessionIdManager cannot be used with __preview_experimental_cookieless_mode");this.config=t.config,this.persistence=t.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=n||Nu,this._windowIdGenerator=s||Nu;var i=this.config.persistence_name||this.config.token,a=this.config.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Xa(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=Gr.parse(this._window_id_storage_key),l=Gr.parse(this._primary_window_exists_storage_key);o&&!l?this._windowId=o:Gr.remove(this._window_id_storage_key),Gr.set(this._primary_window_exists_storage_key,!0)}if((r=this.config.bootstrap)!==null&&r!==void 0&&r.sessionID)try{var u=(d=>{var f=d.replace(/-/g,"");if(f.length!==32)throw new Error("Not a valid UUID");if(f[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(f.substring(0,12),16)})(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,new Date().getTime(),u)}catch(d){kM.error("Invalid sessionID in bootstrap",d)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Et(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&&Gr.is_supported()}_setWindowId(t){t!==this._windowId&&(this._windowId=t,this._canUseSessionStorage()&&Gr.set(this._window_id_storage_key,t))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Gr.parse(this._window_id_storage_key):null}_setSessionId(t,n,s){t===this._sessionId&&n===this._sessionActivityTimestamp&&s===this._sessionStartTimestamp||(this._sessionStartTimestamp=s,this._sessionActivityTimestamp=n,this._sessionId=t,this.persistence.register({[z_]:[n,t,s]}))}_getSessionId(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var t=this.persistence.props[z_];return Os(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}_listenToReloadWindow(){Xs(qe,"beforeunload",()=>{this._canUseSessionStorage()&&Gr.remove(this._primary_window_exists_storage_key)},{capture:!1})}checkAndGetSessionAndWindowId(){var t=arguments.length>0&&arguments[0]!==void 0&&arguments[0],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(this.config.__preview_experimental_cookieless_mode)throw new Error("checkAndGetSessionAndWindowId should not be called in __preview_experimental_cookieless_mode");var s=n||new Date().getTime(),[r,i,a]=this._getSessionId(),o=this._getWindowId(),l=Ai(a)&&a>0&&Math.abs(s-a)>864e5,u=!1,d=!i,f=!t&&Math.abs(s-r)>this.sessionTimeoutMs;d||f||l?(i=this._sessionIdGenerator(),o=this._windowIdGenerator(),kM.info("new session ID generated",{sessionId:i,windowId:o,changeReason:{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:l}}),a=s,u=!0):o||(o=this._windowIdGenerator(),u=!0);var p=r===0||!t||l?s:r,g=a===0?new Date().getTime():a;return this._setWindowId(o),this._setSessionId(i,p,g),t||this.resetIdleTimer(),u&&this._sessionIdChangedHandlers.forEach(v=>v(i,o,u?{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:l}:void 0)),{sessionId:i,windowId:o,sessionStartTimestamp:g,changeReason:u?{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:r}}resetIdleTimer(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{this.resetSessionId()},1.1*this.sessionTimeoutMs)}};var iue=["$set_once","$set"],pu=pi("[SiteApps]");let aue=class{constructor(t){this.instance=t,this.bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this.instance.config.opt_in_site_apps}eventCollector(t,n){if(n){var s=this.globalsForEvent(n);this.bufferedInvocations.push(s),this.bufferedInvocations.length>1e3&&(this.bufferedInvocations=this.bufferedInvocations.slice(10))}}get siteAppLoaders(){var t,n;return(t=nn._POSTHOG_REMOTE_CONFIG)===null||t===void 0||(n=t[this.instance.config.token])===null||n===void 0?void 0:n.siteApps}init(){if(this.isEnabled){var t=this.instance._addCaptureHook(this.eventCollector.bind(this));this.stopBuffering=()=>{t(),this.bufferedInvocations=[],this.stopBuffering=void 0}}}globalsForEvent(t){var n,s,r,i,a,o,l;if(!t)throw new Error("Event payload is required");var u={},d=this.instance.get_property("$groups")||[],f=this.instance.get_property("$stored_group_properties")||{};for(var[p,g]of Object.entries(f))u[p]={id:d[p],type:p,properties:g};var{$set_once:v,$set:b}=t;return{event:Ze(Ze({},jH(t,iue)),{},{properties:Ze(Ze(Ze({},t.properties),b?{$set:Ze(Ze({},(n=(s=t.properties)===null||s===void 0?void 0:s.$set)!==null&&n!==void 0?n:{}),b)}:{}),v?{$set_once:Ze(Ze({},(r=(i=t.properties)===null||i===void 0?void 0:i.$set_once)!==null&&r!==void 0?r:{}),v)}:{}),elements_chain:(a=(o=t.properties)===null||o===void 0?void 0:o.$elements_chain)!==null&&a!==void 0?a:"",distinct_id:(l=t.properties)===null||l===void 0?void 0:l.distinct_id}),person:{properties:this.instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(t){var n=this.apps[t.id],s=()=>{var o;!n.errored&&this.bufferedInvocations.length&&(pu.info("Processing ".concat(this.bufferedInvocations.length," events for site app with id ").concat(t.id)),this.bufferedInvocations.forEach(l=>{var u;return(u=n.processEvent)===null||u===void 0?void 0:u.call(n,l)}),n.processedBuffer=!0),Object.values(this.apps).every(l=>l.processedBuffer||l.errored)&&((o=this.stopBuffering)===null||o===void 0||o.call(this))},r=!1,i=o=>{n.errored=!o,n.loaded=!0,pu.info("Site app with id ".concat(t.id," ").concat(o?"loaded":"errored")),r&&s()};try{var{processEvent:a}=t.init({posthog:this.instance,callback:o=>{i(o)}});a&&(n.processEvent=a),r=!0}catch(o){pu.error("Error while initializing PostHog app with config id ".concat(t.id),o),i(!1)}if(r&&n.loaded)try{s()}catch(o){pu.error("Error while processing buffered events PostHog app with config id ".concat(t.id),o),n.errored=!0}}setupSiteApps(){var t=this.siteAppLoaders||[];for(var n of t)this.apps[n.id]={id:n.id,loaded:!1,errored:!1,processedBuffer:!1};for(var s of t)this.setupSiteApp(s)}onCapturedEvent(t){if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(t);for(var s of Object.values(this.apps))try{var r;(r=s.processEvent)===null||r===void 0||r.call(s,n)}catch(i){pu.error("Error while processing event ".concat(t.event," for site app ").concat(s.id),i)}}}onRemoteConfig(t){var n,s,r,i=this;if((n=this.siteAppLoaders)!==null&&n!==void 0&&n.length)return this.isEnabled?(this.setupSiteApps(),void this.instance.on("eventCaptured",u=>this.onCapturedEvent(u))):void pu.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((s=this.stopBuffering)===null||s===void 0||s.call(this),(r=t.siteApps)!==null&&r!==void 0&&r.length)if(this.isEnabled){var a=function(u,d){var f,p;nn["__$$ph_site_app_".concat(u)]=i.instance,(f=nn.__PosthogExtensions__)===null||f===void 0||(p=f.loadSiteApp)===null||p===void 0||p.call(f,i.instance,d,g=>{if(g)return pu.error("Error while initializing PostHog app with config id ".concat(u),g)})};for(var{id:o,url:l}of t.siteApps)a(o,l)}else pu.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}};var rh,oue=["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"],EM=function(e,t){if(!e)return!1;var n=e.toLowerCase();return oue.concat(t||[]).some(s=>{var r=s.toLowerCase();return n.indexOf(r)!==-1})},UU=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&EM(n,t))return!0;try{var s=e?.userAgentData;if(s!=null&&s.brands&&s.brands.some(r=>EM(r?.brand,t)))return!0}catch{}return!!e.webdriver};function TM(e,t,n){return Nm({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}(function(e){e.US="us",e.EU="eu",e.CUSTOM="custom"})(rh||(rh={}));var RM="i.posthog.com";let lue=class{constructor(t){yt(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(RM),".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]=rh.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=rh.EU:this._regionCache[this.apiHost]=rh.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===rh.CUSTOM)return this.apiHost+n;var s=RM+n;switch(t){case"assets":return"https://".concat(this.region,"-assets.").concat(s);case"api":return"https://".concat(this.region,".").concat(s)}}};var cue={icontains:(e,t)=>!!qe&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!qe&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!qe&&$p(t.href,e),not_regex:(e,t)=>!!qe&&!$p(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};let uue=class Ei{constructor(t){var n=this;yt(this,"getWebExperimentsAndEvaluateDisplayLogic",function(){var s=arguments.length>0&&arguments[0]!==void 0&&arguments[0];n.getWebExperiments(r=>{Ei.logInfo("retrieved web experiments from the server"),n._flagToExperiments=new Map,r.forEach(i=>{if(i.feature_flag_key){var a;n._flagToExperiments&&(Ei.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);lr(o)&&i.variants[o]&&n.applyTransforms(i.name,o,i.variants[o].transforms)}else if(i.variants)for(var l in i.variants){var u=i.variants[l];Ei.matchesTestVariant(u)&&n.applyTransforms(i.name,l,u.transforms)}})},s)}),this.instance=t,this.instance.onFeatureFlags(s=>{this.onFeatureFlags(s)})}onFeatureFlags(t){if(this._is_bot())Ei.logInfo("Refusing to render web experiment since the viewer is a likely bot");else if(!this.instance.config.disable_web_experiments){if(qn(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Ei.logInfo("applying feature flags",t),t.forEach(n=>{var s;if(this._flagToExperiments&&(s=this._flagToExperiments)!==null&&s!==void 0&&s.has(n)){var r,i=this.instance.getFeatureFlag(n),a=(r=this._flagToExperiments)===null||r===void 0?void 0:r.get(n);i&&a!=null&&a.variants[i]&&this.applyTransforms(a.name,i,a.variants[i].transforms)}})}}previewWebExperiment(){var t=Ei.getWindowLocation();if(t!=null&&t.search){var n=X_(t?.search,"__experiment_id"),s=X_(t?.search,"__experiment_variant");n&&s&&(Ei.logInfo("previewing web experiments ".concat(n," && ").concat(s)),this.getWebExperiments(r=>{this.showPreviewWebExperiment(parseInt(n),s,r)},!1,!0))}}loadIfEnabled(){this.instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,s){if(this.instance.config.disable_web_experiments&&!s)return t([]);var r=this.instance.get_property("$web_experiments");if(r&&!n)return t(r);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/web_experiments/?token=".concat(this.instance.config.token)),method:"GET",callback:i=>{if(i.statusCode!==200||!i.json)return t([]);var a=i.json.experiments||[];return t(a)}})}showPreviewWebExperiment(t,n,s){var r=s.filter(i=>i.id===t);r&&r.length>0&&(Ei.logInfo("Previewing web experiment [".concat(r[0].name,"] with variant [").concat(n,"]")),this.applyTransforms(r[0].name,n,r[0].variants[n].transforms))}static matchesTestVariant(t){return!qn(t.conditions)&&Ei.matchUrlConditions(t)&&Ei.matchUTMConditions(t)}static matchUrlConditions(t){var n;if(qn(t.conditions)||qn((n=t.conditions)===null||n===void 0?void 0:n.url))return!0;var s,r,i,a=Ei.getWindowLocation();return!!a&&((s=t.conditions)===null||s===void 0||!s.url||cue[(r=(i=t.conditions)===null||i===void 0?void 0:i.urlMatchType)!==null&&r!==void 0?r:"icontains"](t.conditions.url,a))}static getWindowLocation(){return qe?.location}static matchUTMConditions(t){var n;if(qn(t.conditions)||qn((n=t.conditions)===null||n===void 0?void 0:n.utm))return!0;var s=_s.campaignParams();if(s.utm_source){var r,i,a,o,l,u,d,f,p,g,v,b,x,_,w,y,S=(r=t.conditions)===null||r===void 0||(i=r.utm)===null||i===void 0||!i.utm_campaign||((a=t.conditions)===null||a===void 0||(o=a.utm)===null||o===void 0?void 0:o.utm_campaign)==s.utm_campaign,C=(l=t.conditions)===null||l===void 0||(u=l.utm)===null||u===void 0||!u.utm_source||((d=t.conditions)===null||d===void 0||(f=d.utm)===null||f===void 0?void 0:f.utm_source)==s.utm_source,E=(p=t.conditions)===null||p===void 0||(g=p.utm)===null||g===void 0||!g.utm_medium||((v=t.conditions)===null||v===void 0||(b=v.utm)===null||b===void 0?void 0:b.utm_medium)==s.utm_medium,k=(x=t.conditions)===null||x===void 0||(_=x.utm)===null||_===void 0||!_.utm_term||((w=t.conditions)===null||w===void 0||(y=w.utm)===null||y===void 0?void 0:y.utm_term)==s.utm_term;return S&&E&&k&&C}return!1}static logInfo(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),r=1;r<n;r++)s[r-1]=arguments[r];Lt.info("[WebExperiments] ".concat(t),s)}applyTransforms(t,n,s){this._is_bot()?Ei.logInfo("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?s.forEach(r=>{if(r.selector){var i;Ei.logInfo("applying transform of variant ".concat(n," for experiment ").concat(t," "),r);var a=(i=document)===null||i===void 0?void 0:i.querySelectorAll(r.selector);a?.forEach(o=>{var l=o;r.html&&(l.innerHTML=r.html),r.css&&l.setAttribute("style",r.css)})}}):Ei.logInfo("Control variants leave the page unmodified.")}_is_bot(){return va&&this.instance?UU(va,this.instance.config.custom_blocked_useragents):void 0}};var Zm={},dT=()=>{},qf="posthog",GU=!Qce&&ar?.indexOf("MSIE")===-1&&ar?.indexOf("Mozilla")===-1,AM=()=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:hle(Ft?.location),persistence:"localStorage+cookie",persistence_name:"",loaded:dT,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:$i&&lr($i?.search)&&$i.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:(qe==null||(e=qe.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;Lt.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:uT},_onCapture:dT}},FM=e=>{var t={};Et(e.process_person)||(t.person_profiles=e.process_person),Et(e.xhr_headers)||(t.request_headers=e.xhr_headers),Et(e.cookie_name)||(t.persistence_name=e.cookie_name),Et(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),Et(e.store_google)||(t.save_campaign_params=e.store_google),Et(e.verbose)||(t.debug=e.verbose);var n=Ks({},t,e);return Os(e.property_blacklist)&&(Et(e.property_denylist)?n.property_denylist=e.property_blacklist:Os(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:Lt.error("Invalid value for property_denylist config: "+e.property_denylist)),n};class due{constructor(){yt(this,"__forceAllowLocalhost",!1)}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(t){Lt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class tC{get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){yt(this,"webPerformance",new due),yt(this,"_personProcessingSetOncePropertiesSent",!1),yt(this,"version",uc.LIB_VERSION),yt(this,"_internalEventEmitter",new jU),this.config=AM(),this.SentryIntegration=vce,this.sentryIntegration=t=>function(n,s){var r=fU(n,s);return{name:hU,processEvent:i=>r(i)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.featureFlags=new Bce(this),this.toolbar=new xce(this),this.scrollManager=new tue(this),this.pageViewManager=new kce(this),this.surveys=new qce(this),this.experiments=new uue(this),this.exceptions=new Ece(this),this.rateLimiter=new Kce(this),this.requestRouter=new lue(this),this.consent=new Ole(this),this.people={set:(t,n,s)=>{var r=lr(t)?{[t]:n}:t;this.setPersonProperties(r),s?.({})},set_once:(t,n,s)=>{var r=lr(t)?{[t]:n}:t;this.setPersonProperties(void 0,r),s?.({})}},this.on("eventCaptured",t=>Lt.info('send "'.concat(t?.event,'"'),t))}init(t,n,s){if(s&&s!==qf){var r,i=(r=Zm[s])!==null&&r!==void 0?r:new tC;return i._init(t,n,s),Zm[s]=i,Zm[qf][s]=i,i}return this._init(t,n,s)}_init(t){var n,s,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if(Et(t)||PE(t))return Lt.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 Lt.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this._triggered_notifs=[],r.person_profiles&&(this._initialPersonProfilesConfig=r.person_profiles),this.set_config(Ks({},AM(),FM(r),{name:i,token:t})),this.config.on_xhr_error&&Lt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=r.disable_compression?void 0:No.GZipJS,this.persistence=new Q1(this.config),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Q1(Ze(Ze({},this.config),{},{persistence:"sessionStorage"}));var a=Ze({},this.persistence.props),o=Ze({},this.sessionPersistence.props);if(this._requestQueue=new Jce(_=>this._send_retriable_request(_),this.config.request_queue_config),this._retryQueue=new eue(this),this.__request_queue=[],this.config.__preview_experimental_cookieless_mode||(this.sessionManager=new rue(this),this.sessionPropsManager=new sue(this,this.sessionManager,this.persistence)),new wce(this).startIfEnabledOrStop(),this.siteApps=new aue(this),(n=this.siteApps)===null||n===void 0||n.init(),this.config.__preview_experimental_cookieless_mode||(this.sessionRecording=new gce(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new Ele(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new Sce(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new yce(this),this.exceptionObserver=new jle(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new nU(this,Ble),this.deadClicksAutocapture.startIfEnabled(),uc.DEBUG=uc.DEBUG||this.config.debug,uc.DEBUG&&Lt.info("Starting in debug mode",{this:this,config:r,thisC:Ze({},this.config),p:a,s:o}),this._sync_opt_out_with_persistence(),((s=r.bootstrap)===null||s===void 0?void 0:s.distinctID)!==void 0){var l,u,d=this.config.get_device_id(Nu()),f=(l=r.bootstrap)!==null&&l!==void 0&&l.isIdentifiedID?d:r.bootstrap.distinctID;this.persistence.set_property(oc,(u=r.bootstrap)!==null&&u!==void 0&&u.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:r.bootstrap.distinctID,$device_id:f})}if(this._hasBootstrappedFeatureFlags()){var p,g,v=Object.keys(((p=r.bootstrap)===null||p===void 0?void 0:p.featureFlags)||{}).filter(_=>{var w,y;return!((w=r.bootstrap)===null||w===void 0||(y=w.featureFlags)===null||y===void 0||!y[_])}).reduce((_,w)=>{var y,S;return _[w]=((y=r.bootstrap)===null||y===void 0||(S=y.featureFlags)===null||S===void 0?void 0:S[w])||!1,_},{}),b=Object.keys(((g=r.bootstrap)===null||g===void 0?void 0:g.featureFlagPayloads)||{}).filter(_=>v[_]).reduce((_,w)=>{var y,S,C,E;return(y=r.bootstrap)!==null&&y!==void 0&&(S=y.featureFlagPayloads)!==null&&S!==void 0&&S[w]&&(_[w]=(C=r.bootstrap)===null||C===void 0||(E=C.featureFlagPayloads)===null||E===void 0?void 0:E[w]),_},{});this.featureFlags.receivedFeatureFlags({featureFlags:v,featureFlagPayloads:b})}if(this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:MP,$device_id:null},"");else if(!this.get_distinct_id()){var x=this.config.get_device_id(Nu());this.register_once({distinct_id:x,$device_id:x},""),this.persistence.set_property(oc,"anonymous")}return Xs(qe,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),r.segment?mce(this,()=>this._loaded()):this._loaded(),jo(this.config._onCapture)&&this.config._onCapture!==dT&&(Lt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",_=>this.config._onCapture(_.event,_))),this}_onRemoteConfig(t){var n,s,r,i,a,o,l,u;if(!Ft||!Ft.body)return Lt.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=wn(t.supportedCompression,No.GZipJS)?No.GZipJS:wn(t.supportedCompression,No.Base64)?No.Base64:void 0),(n=t.analytics)!==null&&n!==void 0&&n.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:"identified_only"}),(s=this.siteApps)===null||s===void 0||s.onRemoteConfig(t),(r=this.sessionRecording)===null||r===void 0||r.onRemoteConfig(t),(i=this.autocapture)===null||i===void 0||i.onRemoteConfig(t),(a=this.heatmaps)===null||a===void 0||a.onRemoteConfig(t),this.surveys.onRemoteConfig(t),(o=this.webVitalsAutocapture)===null||o===void 0||o.onRemoteConfig(t),(l=this.exceptionObserver)===null||l===void 0||l.onRemoteConfig(t),(u=this.deadClicksAutocapture)===null||u===void 0||u.onRemoteConfig(t)}_loaded(){try{this.config.loaded(this)}catch(t){Lt.critical("`loaded` function failed",t)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout(()=>{this.consent.isOptedIn()&&this._captureInitialPageview()},1),new Yce(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()||Uu(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&&(GU?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=nw(t.url,{ip:this.config.ip?1:0}),t.headers=Ze({},this.config.request_headers),t.compression=t.compression==="best-available"?this.compression:t.compression,t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var s,r,i,a=Ze({},n);a.timeout=a.timeout||6e4,a.url=nw(a.url,{_:new Date().getTime().toString(),ver:uc.LIB_VERSION,compression:a.compression});var o=(s=a.transport)!==null&&s!==void 0?s:"fetch",l=(r=(i=HH(Jm,u=>u.transport===o))===null||i===void 0?void 0:i.method)!==null&&r!==void 0?r:Jm[0].method;if(!l)throw new Error("No available transport method");l(a)})(Ze(Ze({},t),{},{callback:n=>{var s,r,i;this.rateLimiter.checkForLimiting(n),n.statusCode>=400&&((r=(i=this.config).on_request_error)===null||r===void 0||r.call(i,n)),(s=t.callback)===null||s===void 0||s.call(t,n)}}))))}_send_retriable_request(t){this._retryQueue?this._retryQueue.retriableRequest(t):this._send_request(t)}_execute_array(t){var n,s=[],r=[],i=[];Uu(t,o=>{o&&(n=o[0],Os(n)?i.push(o):jo(o)?o.call(this):Os(o)&&n==="alias"?s.push(o):Os(o)&&n.indexOf("capture")!==-1&&jo(this[n])?i.push(o):r.push(o))});var a=function(o,l){Uu(o,function(u){if(Os(u[0])){var d=l;is(u,function(f){d=d[f[0]].apply(d,f.slice(1))})}else this[u[0]].apply(this,u.slice(1))},l)};a(s,this),a(r,this),a(i,this)}_hasBootstrappedFeatureFlags(){var t,n;return((t=this.config.bootstrap)===null||t===void 0?void 0:t.featureFlags)&&Object.keys((n=this.config.bootstrap)===null||n===void 0?void 0:n.featureFlags).length>0||!1}push(t){this._execute_array([t])}capture(t,n,s){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(!this.consent.isOptedOut())if(!Et(t)&&lr(t)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var i=s!=null&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(i==null||!i.isRateLimited){n!=null&&n.$current_url&&!lr(n?.$current_url)&&(Lt.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var a=new Date,o=s?.timestamp||a,l=Nu(),u={uuid:l,event:t,properties:this._calculate_event_properties(t,n||{},o,l)};i&&(u.properties.$lib_rate_limit_remaining_tokens=i.remainingTokens),s?.$set&&(u.$set=s?.$set);var d=this._calculate_set_once_properties(s?.$set_once);d&&(u.$set_once=d),(u=ule(u,s!=null&&s._noTruncate?null:this.config.properties_string_max_length)).timestamp=o,Et(s?.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=a);var f=Ze(Ze({},u.properties.$set),u.$set);if(np(f)||this.setPersonPropertiesForFlags(f),!qn(this.config.before_send)){var p=this._runBeforeSend(u);if(!p)return;u=p}this._internalEventEmitter.emit("eventCaptured",u);var g={method:"POST",url:(r=s?._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:s?._batchKey};return!this.config.request_batching||s&&(s==null||!s._batchKey)||s!=null&&s.send_instantly?this._send_retriable_request(g):this._requestQueue.enqueue(g),u}Lt.critical("This capture call is ignored due to client rate limiting.")}}else Lt.error("No event name provided to posthog.capture")}else Lt.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",n=>t(n.event,n))}_calculate_event_properties(t,n,s,r){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return n;var i=this.persistence.remove_event_timer(t),a=Ze({},n);if(a.token=this.config.token,this.config.__preview_experimental_cookieless_mode&&(a.$cookieless_mode=!0),t==="$snapshot"){var o=Ze(Ze({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=o.distinct_id,(!lr(a.distinct_id)&&!Ai(a.distinct_id)||PE(a.distinct_id))&&Lt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var l,u=_s.properties({maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});if(this.sessionManager){var{sessionId:d,windowId:f}=this.sessionManager.checkAndGetSessionAndWindowId();a.$session_id=d,a.$window_id=f}this.sessionPropsManager&&Ks(a,this.sessionPropsManager.getSessionProps());try{var p,g;this.sessionRecording&&Ks(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(p=this._retryQueue)===null||p===void 0||(g=p.queue)===null||g===void 0?void 0:g.length}catch(_){a.$sdk_debug_error_capturing_properties=String(_)}if(this.requestRouter.region===rh.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),l=t==="$pageview"?this.pageViewManager.doPageView(s,r):t==="$pageleave"?this.pageViewManager.doPageLeave(s):this.pageViewManager.doEvent(),a=Ks(a,l),t==="$pageview"&&Ft&&(a.title=Ft.title),!Et(i)){var v=s.getTime()-i;a.$duration=parseFloat((v/1e3).toFixed(3))}ar&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Ks({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),Os(this.config.property_denylist)?is(this.config.property_denylist,function(_){delete a[_]}):Lt.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(Lt.error("sanitize_properties is deprecated. Use before_send instead"),a=b(a,t));var x=this._hasPersonProcessing();return a.$process_person_profile=x,x&&this._requirePersonProcessing("_calculate_event_properties"),a}_calculate_set_once_properties(t){var n;if(!this.persistence||!this._hasPersonProcessing()||this._personProcessingSetOncePropertiesSent)return t;var s=this.persistence.get_initial_props(),r=(n=this.sessionPropsManager)===null||n===void 0?void 0:n.getSetOnceProps(),i=Ks({},s,r||{},t||{}),a=this.config.sanitize_properties;return a&&(Lt.error("sanitize_properties is deprecated. Use before_send instead"),i=a(i,"$set_once")),this._personProcessingSetOncePropertiesSent=!0,np(i)?void 0:i}register(t,n){var s;(s=this.persistence)===null||s===void 0||s.register(t,n)}register_once(t,n,s){var r;(r=this.persistence)===null||r===void 0||r.register_once(t,n,s)}register_for_session(t){var n;(n=this.sessionPersistence)===null||n===void 0||n.register(t)}unregister(t){var n;(n=this.persistence)===null||n===void 0||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(t)}_register_single(t,n){this.register({[t]:n})}getFeatureFlag(t,n){return this.featureFlags.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n=this.featureFlags.getFeatureFlagPayload(t);try{return JSON.parse(n)}catch{return n}}isFeatureEnabled(t,n){return this.featureFlags.isFeatureEnabled(t,n)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(t,n){this.featureFlags.updateEarlyAccessFeatureEnrollment(t,n)}getEarlyAccessFeatures(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1],s=arguments.length>2?arguments[2]:void 0;return this.featureFlags.getEarlyAccessFeatures(t,n,s)}on(t,n){return this._internalEventEmitter.on(t,n)}onFeatureFlags(t){return this.featureFlags.onFeatureFlags(t)}onSurveysLoaded(t){return this.surveys.onSurveysLoaded(t)}onSessionId(t){var n,s;return(n=(s=this.sessionManager)===null||s===void 0?void 0:s.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getSurveys(t,n)}getActiveMatchingSurveys(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getActiveMatchingSurveys(t,n)}renderSurvey(t,n){this.surveys.renderSurvey(t,n)}canRenderSurvey(t){return this.surveys.canRenderSurvey(t)}identify(t,n,s){if(!this.__loaded||!this.persistence)return Lt.uninitializedWarning("posthog.identify");if(Ai(t)&&(t=t.toString(),Lt.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()))Lt.critical('The string "'.concat(t,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else if(this._requirePersonProcessing("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:t}),!this.get_property("$device_id")){var i=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:i},"")}t!==r&&t!==this.get_property(Tm)&&(this.unregister(Tm),this.register({distinct_id:t}));var a=(this.persistence.get_property(oc)||"anonymous")==="anonymous";t!==r&&a?(this.persistence.set_property(oc,"identified"),this.setPersonPropertiesForFlags(Ze(Ze({},s||{}),n||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:r},{$set:n||{},$set_once:s||{}}),this._cachedPersonProperties=TM(t,n,s),this.featureFlags.setAnonymousDistinctId(r)):(n||s)&&this.setPersonProperties(n,s),t!==r&&(this.reloadFeatureFlags(),this.unregister(q_))}}else Lt.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,n){if((t||n)&&this._requirePersonProcessing("posthog.setPersonProperties")){var s=TM(this.get_distinct_id(),t,n);this._cachedPersonProperties!==s?(this.setPersonPropertiesForFlags(Ze(Ze({},n||{}),t||{})),this.capture("$set",{$set:t||{},$set_once:n||{}}),this._cachedPersonProperties=s):Lt.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,n,s){if(t&&n){if(this._requirePersonProcessing("posthog.group")){var r=this.getGroups();r[t]!==n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:Ze(Ze({},r),{},{[t]:n})}),s&&(this.capture("$groupidentify",{$group_type:t,$group_key:n,$group_set:s}),this.setGroupPropertiesForFlags({[t]:s})),r[t]===n||s||this.reloadFeatureFlags()}}else Lt.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this.featureFlags.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(t,n)}resetGroupPropertiesForFlags(t){this.featureFlags.resetGroupPropertiesForFlags(t)}reset(t){var n,s,r,i;if(Lt.info("reset"),!this.__loaded)return Lt.uninitializedWarning("posthog.reset");var a=this.get_property("$device_id");if(this.consent.reset(),(n=this.persistence)===null||n===void 0||n.clear(),(s=this.sessionPersistence)===null||s===void 0||s.clear(),this.surveys.reset(),(r=this.persistence)===null||r===void 0||r.set_property(oc,"anonymous"),(i=this.sessionManager)===null||i===void 0||i.resetSessionId(),this._cachedPersonProperties=null,this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:MP,$device_id:null},"");else{var o=this.config.get_device_id(Nu());this.register_once({distinct_id:o,$device_id:t?o:a},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)===null||n===void 0?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:s}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(n));if(t!=null&&t.withTimestamp&&s){var i,a=(i=t.timestampLookBack)!==null&&i!==void 0?i:10;if(!s)return r;var o=Math.max(Math.floor((new Date().getTime()-s)/1e3)-a,0);r+="?t=".concat(o)}return r}alias(t,n){return t===this.get_property(UH)?(Lt.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Et(n)&&(n=this.get_distinct_id()),t!==n?(this._register_single(Tm,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(Lt.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n,s,r,i,a=Ze({},this.config);Ls(t)&&(Ks(this.config,FM(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 Q1(Ze(Ze({},this.config),{},{persistence:"sessionStorage"})),gr.is_supported()&&gr.get("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(uc.DEBUG=!0,Lt.info("set_config",JSON.stringify({config:t,oldConfig:a,newConfig:Ze({},this.config)},null,2))),(s=this.sessionRecording)===null||s===void 0||s.startIfEnabledOrStop(),(r=this.autocapture)===null||r===void 0||r.startIfEnabled(),(i=this.heatmaps)===null||i===void 0||i.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence())}startSessionRecording(t){var n=t===!0,s={sampling:n||!(t==null||!t.sampling),linked_flag:n||!(t==null||!t.linked_flag),url_trigger:n||!(t==null||!t.url_trigger),event_trigger:n||!(t==null||!t.event_trigger)};if(Object.values(s).some(Boolean)){var r,i,a,o,l;(r=this.sessionManager)===null||r===void 0||r.checkAndGetSessionAndWindowId(),s.sampling&&((i=this.sessionRecording)===null||i===void 0||i.overrideSampling()),s.linked_flag&&((a=this.sessionRecording)===null||a===void 0||a.overrideLinkedFlag()),s.url_trigger&&((o=this.sessionRecording)===null||o===void 0||o.overrideTrigger("url")),s.event_trigger&&((l=this.sessionRecording)===null||l===void 0||l.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)===null||t===void 0||!t.started)}captureException(t,n){var s=new Error("PostHog syntheticException");this.exceptions.sendExceptionEvent(Ze(Ze({},Qle((r=>r instanceof Error)(t)?{error:t,event:t.message}:{event:t},{syntheticException:s})),n))}loadToolbar(t){return this.toolbar.loadToolbar(t)}get_property(t){var n;return(n=this.persistence)===null||n===void 0?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)===null||n===void 0?void 0:n.props[t]}toString(){var t,n=(t=this.config.name)!==null&&t!==void 0?t:qf;return n!==qf&&(n=qf+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)===null||t===void 0?void 0:t.get_property(oc))==="identified"||((n=this.sessionPersistence)===null||n===void 0?void 0:n.get_property(oc))==="identified"}_hasPersonProcessing(){var t,n,s,r;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&np(this.getGroups())&&((t=this.persistence)===null||t===void 0||(n=t.props)===null||n===void 0||!n[Tm])&&((s=this.persistence)===null||s===void 0||(r=s.props)===null||r===void 0||!r[K_]))}_shouldCapturePageleave(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}_requirePersonProcessing(t){return this.config.person_profiles==="never"?(Lt.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(K_,!0),!0)}_sync_opt_out_with_persistence(){var t,n,s,r,i=this.consent.isOptedOut(),a=this.config.opt_out_persistence_by_default,o=this.config.disable_persistence||i&&!!a;((t=this.persistence)===null||t===void 0?void 0:t.disabled)!==o&&((s=this.persistence)===null||s===void 0||s.set_disabled(o)),((n=this.sessionPersistence)===null||n===void 0?void 0:n.disabled)!==o&&((r=this.sessionPersistence)===null||r===void 0||r.set_disabled(o))}opt_in_capturing(t){var n;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),(Et(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 va?UU(va,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){Ft&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:Ft.title},{send_instantly:!0}))}debug(t){t===!1?(qe?.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(qe?.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(qn(this.config.before_send))return t;var n=Os(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var r of n){if(s=r(s),qn(s)){var i="Event '".concat(t.event,"' was rejected in beforeSend function");return ole(t.event)?Lt.warn("".concat(i,". This can cause unexpected behavior.")):Lt.info(i),null}s.properties&&!np(s.properties)||Lt.warn("Event '".concat(t.event,"' has no properties after beforeSend function, this is likely an error."))}return s}getPageViewId(){var t;return(t=this.pageViewManager._currentPageview)===null||t===void 0?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,s){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(s)})}}(function(e,t){for(var n=0;n<t.length;n++)e.prototype[t[n]]=cle(e.prototype[t[n]])})(tC,["identify"]);var DM,Xd=(DM=Zm[qf]=new tC,function(){function e(){e.done||(e.done=!0,GU=!1,is(Zm,function(t){t._dom_loaded()}))}Ft!=null&&Ft.addEventListener?Ft.readyState==="complete"?e():Xs(Ft,"DOMContentLoaded",e,{capture:!1}):qe&&Lt.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),DM),x2=m.createContext({client:Xd});function VU(e,t,n){if(n===void 0&&(n=new WeakMap),e===t)return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(n.has(e)&&n.get(e)===t)return!0;n.set(e,t);var s=Object.keys(e),r=Object.keys(t);if(s.length!==r.length)return!1;for(var i=0,a=s;i<a.length;i++){var o=a[i];if(!r.includes(o)||!VU(e[o],t[o],n))return!1}return!0}function hue(e){var t=e.children,n=e.client,s=e.apiKey,r=e.options,i=m.useRef(null),a=m.useMemo(function(){return n?(s&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),r&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),n):(s||console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior."),Xd)},[n,s,JSON.stringify(r)]);return m.useEffect(function(){if(!n){var o=i.current;o?(s!==o.apiKey&&console.warn("[PostHog.js] You have provided a different `apiKey` to `PostHogProvider` than the one that was already initialized. This is not supported by our provider and we'll keep using the previous key. If you need to toggle between API Keys you need to control the `client` yourself and pass it in as a prop rather than an `apiKey` prop."),r&&!VU(r,o.options)&&Xd.set_config(r),i.current={apiKey:s,options:r??{}}):(Xd.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),Xd.init(s,r),i.current={apiKey:s,options:r??{}})}},[n,s,JSON.stringify(r)]),st.createElement(x2.Provider,{value:{client:a}},t)}var fue=function(){var e=m.useContext(x2).client;return e};function eS(e){var t=fue(),n=m.useState(function(){return t.isFeatureEnabled(e)}),s=n[0],r=n[1];return m.useEffect(function(){return t.onFeatureFlags(function(){r(t.isFeatureEnabled(e))})},[t,e]),s}var hT=function(e,t){return hT=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&(n[r]=s[r])},hT(e,t)};function pue(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");hT(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var tS=function(e){return typeof e=="function"},gue={componentStack:null,error:null},mue={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."};(function(e){pue(t,e);function t(n){var s=e.call(this,n)||this;return s.state=gue,s}return t.prototype.componentDidCatch=function(n,s){var r=s.componentStack,i=this.props.additionalProperties;this.setState({error:n,componentStack:r});var a;tS(i)?a=i(n):typeof i=="object"&&(a=i);var o=this.context.client;o.captureException(n,a)},t.prototype.render=function(){var n=this.props,s=n.children,r=n.fallback,i=this.state;if(i.componentStack==null)return tS(s)?s():s;var a=tS(r)?st.createElement(r,{error:i.error,componentStack:i.componentStack}):r;return st.isValidElement(a)?a:(console.warn(mue.INVALID_FALLBACK),st.createElement(st.Fragment,null))},t.contextType=x2,t})(st.Component);/**
@@ -696,7 +696,7 @@ If you are trying to annotate ${s} with application data, use the '${s}.context'
696
696
  *
697
697
  * This source code is licensed under the MIT license found in the
698
698
  * LICENSE file in the root directory of this source tree.
699
- */var R6;function oat(){if(R6)return wm;R6=1;var e=st,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,r=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function a(o,l,u){var d,f={},p=null,g=null;u!==void 0&&(p=""+u),l.key!==void 0&&(p=""+l.key),l.ref!==void 0&&(g=l.ref);for(d in l)s.call(l,d)&&!i.hasOwnProperty(d)&&(f[d]=l[d]);if(o&&o.defaultProps)for(d in l=o.defaultProps,l)f[d]===void 0&&(f[d]=l[d]);return{$$typeof:t,type:o,key:p,ref:g,props:f,_owner:r.current}}return wm.Fragment=n,wm.jsx=a,wm.jsxs=a,wm}var A6;function lat(){return A6||(A6=1,T6.exports=oat()),T6.exports}var cat=lat();/*! shepherd.js 14.5.0 */function uat(e){return e instanceof Element}function og(e){return e instanceof HTMLElement}function od(e){return typeof e=="function"}function Bv(e){return typeof e=="string"}function li(e){return e===void 0}class ZD{on(t,n,s,r=!1){var i;return li(this.bindings)&&(this.bindings={}),li(this.bindings[t])&&(this.bindings[t]=[]),(i=this.bindings[t])==null||i.push({handler:n,ctx:s,once:r}),this}once(t,n,s){return this.on(t,n,s,!0)}off(t,n){if(li(this.bindings)||li(this.bindings[t]))return this;if(li(n))delete this.bindings[t];else{var s;(s=this.bindings[t])==null||s.forEach((r,i)=>{if(r.handler===n){var a;(a=this.bindings[t])==null||a.splice(i,1)}})}return this}trigger(t,...n){if(!li(this.bindings)&&this.bindings[t]){var s;(s=this.bindings[t])==null||s.forEach((r,i)=>{const{ctx:a,handler:o,once:l}=r,u=a||this;if(o.apply(u,n),l){var d;(d=this.bindings[t])==null||d.splice(i,1)}})}return this}}function Zi(){return Zi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)({}).hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Zi.apply(null,arguments)}function eI(e,t){if(e==null)return{};var n={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(t.includes(s))continue;n[s]=e[s]}return n}const xd={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")};xd.defaultMerge;function dat(e,t){return t}function hat(e,t){return e.filter(n=>n!==void 0)}var F6;(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"})(F6||(F6={}));function D6(e){return typeof e!="object"||e===null?0:Array.isArray(e)?2:gat(e)?1:e instanceof Set?3:e instanceof Map?4:5}function fat(e){const t=new Set;for(const n of e)for(const s of[...Object.keys(n),...Object.getOwnPropertySymbols(n)])t.add(s);return t}function pat(e,t){return typeof e=="object"&&Object.prototype.propertyIsEnumerable.call(e,t)}function sX(e){return{*[Symbol.iterator](){for(const t of e)for(const n of t)yield n}}}const I6=new Set(["[object Object]","[object Module]"]);function gat(e){if(!I6.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"||!I6.has(Object.prototype.toString.call(n))||!n.hasOwnProperty("isPrototypeOf"))}function mat(e,t,n){const s={};for(const r of fat(e)){const i=[];for(const l of e)pat(l,r)&&i.push(l[r]);if(i.length===0)continue;const a=t.metaDataUpdater(n,{key:r,parents:e}),o=rX(i,t,a);o!==xd.skip&&(r==="__proto__"?Object.defineProperty(s,r,{value:o,configurable:!0,enumerable:!0,writable:!0}):s[r]=o)}return s}function vat(e){return e.flat()}function bat(e){return new Set(sX(e))}function xat(e){return new Map(sX(e))}function _at(e){return e.at(-1)}const Vx={mergeRecords:mat,mergeArrays:vat,mergeSets:bat,mergeMaps:xat,mergeOthers:_at};function tI(...e){return wat({})(...e)}function wat(e,t){const n=yat(e,s);function s(...r){return rX(r,n,t)}return s}function yat(e,t){var n,s,r;return{defaultMergeFunctions:Vx,mergeFunctions:Zi({},Vx,Object.fromEntries(Object.entries(e).filter(([i,a])=>Object.hasOwn(Vx,i)).map(([i,a])=>a===!1?[i,Vx.mergeOthers]:[i,a]))),metaDataUpdater:(n=e.metaDataUpdater)!=null?n:dat,deepmerge:t,useImplicitDefaultMerging:(s=e.enableImplicitDefaultMerging)!=null?s:!1,filterValues:e.filterValues===!1?void 0:(r=e.filterValues)!=null?r:hat,actions:xd}}function rX(e,t,n){var s;const r=(s=t.filterValues==null?void 0:t.filterValues(e,n))!=null?s:e;if(r.length===0)return;if(r.length===1)return nE(r,t,n);const i=D6(r[0]);if(i!==0&&i!==5){for(let a=1;a<r.length;a++)if(D6(r[a])!==i)return nE(r,t,n)}switch(i){case 1:return Cat(r,t,n);case 2:return Sat(r,t,n);case 3:return kat(r,t,n);case 4:return Eat(r,t,n);default:return nE(r,t,n)}}function Cat(e,t,n){const s=t.mergeFunctions.mergeRecords(e,t,n);return s===xd.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeRecords!==t.defaultMergeFunctions.mergeRecords?t.defaultMergeFunctions.mergeRecords(e,t,n):s}function Sat(e,t,n){const s=t.mergeFunctions.mergeArrays(e,t,n);return s===xd.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeArrays!==t.defaultMergeFunctions.mergeArrays?t.defaultMergeFunctions.mergeArrays(e):s}function kat(e,t,n){const s=t.mergeFunctions.mergeSets(e,t,n);return s===xd.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeSets!==t.defaultMergeFunctions.mergeSets?t.defaultMergeFunctions.mergeSets(e):s}function Eat(e,t,n){const s=t.mergeFunctions.mergeMaps(e,t,n);return s===xd.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps?t.defaultMergeFunctions.mergeMaps(e):s}function nE(e,t,n){const s=t.mergeFunctions.mergeOthers(e,t,n);return s===xd.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(e):s}function nI(e){const t=Object.getOwnPropertyNames(e.constructor.prototype);for(let n=0;n<t.length;n++){const s=t[n],r=e[s];s!=="constructor"&&typeof r=="function"&&(e[s]=r.bind(e))}return e}function Tat(e,t){return n=>{if(e.isOpen()){const s=e.el&&n.currentTarget===e.el;(!li(t)&&n.currentTarget.matches(t)||s)&&e.tour.next()}}}function Rat(e){const{event:t,selector:n}=e.options.advanceOn||{};if(t){const s=Tat(e,n);let r=null;if(!li(n)&&(r=document.querySelector(n),!r))return console.error(`No element was found for the selector supplied to advanceOn: ${n}`);r?(r.addEventListener(t,s),e.on("destroy",()=>r.removeEventListener(t,s))):(document.body.addEventListener(t,s,!0),e.on("destroy",()=>document.body.removeEventListener(t,s,!0)))}else return console.error("advanceOn was defined, but no event name was passed.")}class Aat{constructor(t){}}class Fat{constructor(t,n){}}function iX(e){return!Bv(e)||e===""?"":e.charAt(e.length-1)!=="-"?`${e}-`:e}function Dat(e){const t=e.options.attachTo||{},n=Object.assign({},t);if(od(n.element)&&(n.element=n.element.call(e)),Bv(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 Iat(e){return e.options.extraHighlights?e.options.extraHighlights.flatMap(t=>Array.from(document.querySelectorAll(t))):[]}function aX(e){return e==null?!0:!e.element||!e.on}function oX(){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 Nat=["top","right","bottom","left"],N6=["start","end"],P6=Nat.reduce((e,t)=>e.concat(t,t+"-"+N6[0],t+"-"+N6[1]),[]),lg=Math.min,kh=Math.max,fy=Math.round,Wx=Math.floor,Fl=e=>({x:e,y:e}),Pat={left:"right",right:"left",bottom:"top",top:"bottom"},Mat={start:"end",end:"start"};function cA(e,t,n){return kh(e,lg(t,n))}function Kh(e,t){return typeof e=="function"?e(t):e}function jc(e){return e.split("-")[0]}function Fc(e){return e.split("-")[1]}function sI(e){return e==="x"?"y":"x"}function rI(e){return e==="y"?"height":"width"}function cg(e){return["top","bottom"].includes(jc(e))?"y":"x"}function iI(e){return sI(cg(e))}function lX(e,t,n){n===void 0&&(n=!1);const s=Fc(e),r=iI(e),i=rI(r);let a=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=gy(a)),[a,gy(a)]}function Oat(e){const t=gy(e);return[py(e),t,py(t)]}function py(e){return e.replace(/start|end/g,t=>Mat[t])}function Lat(e,t,n){const s=["left","right"],r=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?r:s:t?s:r;case"left":case"right":return t?i:a;default:return[]}}function Bat(e,t,n,s){const r=Fc(e);let i=Lat(jc(e),n==="start",s);return r&&(i=i.map(a=>a+"-"+r),t&&(i=i.concat(i.map(py)))),i}function gy(e){return e.replace(/left|right|bottom|top/g,t=>Pat[t])}function jat(e){return Zi({top:0,right:0,bottom:0,left:0},e)}function cX(e){return typeof e!="number"?jat(e):{top:e,right:e,bottom:e,left:e}}function my(e){const{x:t,y:n,width:s,height:r}=e;return{width:s,height:r,top:n,left:t,right:t+s,bottom:n+r,x:t,y:n}}const Hat=["crossAxis","alignment","allowedPlacements","autoAlignment"],Uat=["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"],Gat=["mainAxis","crossAxis","limiter"];function M6(e,t,n){let{reference:s,floating:r}=e;const i=cg(t),a=iI(t),o=rI(a),l=jc(t),u=i==="y",d=s.x+s.width/2-r.width/2,f=s.y+s.height/2-r.height/2,p=s[o]/2-r[o]/2;let g;switch(l){case"top":g={x:d,y:s.y-r.height};break;case"bottom":g={x:d,y:s.y+s.height};break;case"right":g={x:s.x+s.width,y:f};break;case"left":g={x:s.x-r.width,y:f};break;default:g={x:s.x,y:s.y}}switch(Fc(t)){case"start":g[a]-=p*(n&&u?-1:1);break;case"end":g[a]+=p*(n&&u?-1:1);break}return g}const Vat=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:i=[],platform:a}=n,o=i.filter(Boolean),l=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:f}=M6(u,s,l),p=s,g={},v=0;for(let b=0;b<o.length;b++){const{name:x,fn:_}=o[b],{x:w,y,data:S,reset:C}=await _({x:d,y:f,initialPlacement:s,placement:p,strategy:r,middlewareData:g,rects:u,platform:a,elements:{reference:e,floating:t}});d=w??d,f=y??f,g=Zi({},g,{[x]:Zi({},g[x],S)}),C&&v<=50&&(v++,typeof C=="object"&&(C.placement&&(p=C.placement),C.rects&&(u=C.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:r}):C.rects),{x:d,y:f}=M6(u,p,l)),b=-1)}return{x:d,y:f,placement:p,strategy:r,middlewareData:g}};async function aI(e,t){var n;t===void 0&&(t={});const{x:s,y:r,platform:i,rects:a,elements:o,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:p=!1,padding:g=0}=Kh(t,e),v=cX(g),b=o[p?f==="floating"?"reference":"floating":f],x=my(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(b)))==null||n?b:b.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:u,rootBoundary:d,strategy:l})),_=f==="floating"?{x:s,y:r,width:a.floating.width,height:a.floating.height}:a.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),y=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},S=my(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:_,offsetParent:w,strategy:l}):_);return{top:(x.top-S.top+v.top)/y.y,bottom:(S.bottom-x.bottom+v.bottom)/y.y,left:(x.left-S.left+v.left)/y.x,right:(S.right-x.right+v.right)/y.x}}const Wat=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:r,rects:i,platform:a,elements:o,middlewareData:l}=t,{element:u,padding:d=0}=Kh(e,t)||{};if(u==null)return{};const f=cX(d),p={x:n,y:s},g=iI(r),v=rI(g),b=await a.getDimensions(u),x=g==="y",_=x?"top":"left",w=x?"bottom":"right",y=x?"clientHeight":"clientWidth",S=i.reference[v]+i.reference[g]-p[g]-i.floating[v],C=p[g]-i.reference[g],E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let k=E?E[y]:0;(!k||!await(a.isElement==null?void 0:a.isElement(E)))&&(k=o.floating[y]||i.floating[v]);const F=S/2-C/2,A=k/2-b[v]/2-1,I=lg(f[_],A),N=lg(f[w],A),P=I,M=k-b[v]-N,z=k/2-b[v]/2+F,L=cA(P,z,M),X=!l.arrow&&Fc(r)!=null&&z!==L&&i.reference[v]/2-(z<P?I:N)-b[v]/2<0,J=X?z<P?z-P:z-M:0;return{[g]:p[g]+J,data:Zi({[g]:L,centerOffset:z-L-J},X&&{alignmentOffset:J}),reset:X}}});function $at(e,t,n){return(e?[...n.filter(s=>Fc(s)===e),...n.filter(s=>Fc(s)!==e)]:n.filter(s=>jc(s)===s)).filter(s=>e?Fc(s)===e||(t?py(s)!==s:!1):!0)}const zat=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,s,r;const{rects:i,middlewareData:a,placement:o,platform:l,elements:u}=t,d=Kh(e,t),{crossAxis:f=!1,alignment:p,allowedPlacements:g=P6,autoAlignment:v=!0}=d,b=eI(d,Hat),x=p!==void 0||g===P6?$at(p||null,v,g):g,_=await aI(t,b),w=((n=a.autoPlacement)==null?void 0:n.index)||0,y=x[w];if(y==null)return{};const S=lX(y,i,await(l.isRTL==null?void 0:l.isRTL(u.floating)));if(o!==y)return{reset:{placement:x[0]}};const C=[_[jc(y)],_[S[0]],_[S[1]]],E=[...((s=a.autoPlacement)==null?void 0:s.overflows)||[],{placement:y,overflows:C}],k=x[w+1];if(k)return{data:{index:w+1,overflows:E},reset:{placement:k}};const F=E.map(I=>{const N=Fc(I.placement);return[I.placement,N&&f?I.overflows.slice(0,2).reduce((P,M)=>P+M,0):I.overflows[0],I.overflows]}).sort((I,N)=>I[1]-N[1]),A=((r=F.filter(I=>I[2].slice(0,Fc(I[0])?2:3).every(N=>N<=0))[0])==null?void 0:r[0])||F[0][0];return A!==o?{data:{index:w+1,overflows:E},reset:{placement:A}}:{}}}},qat=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:l,elements:u}=t,d=Kh(e,t),{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:x=!0}=d,_=eI(d,Uat);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=jc(r),y=cg(o),S=jc(o)===o,C=await(l.isRTL==null?void 0:l.isRTL(u.floating)),E=g||(S||!x?[gy(o)]:Oat(o)),k=b!=="none";!g&&k&&E.push(...Bat(o,x,b,C));const F=[o,...E],A=await aI(t,_),I=[];let N=((s=i.flip)==null?void 0:s.overflows)||[];if(f&&I.push(A[w]),p){const L=lX(r,a,C);I.push(A[L[0]],A[L[1]])}if(N=[...N,{placement:r,overflows:I}],!I.every(L=>L<=0)){var P,M;const L=(((P=i.flip)==null?void 0:P.index)||0)+1,X=F[L];if(X)return{data:{index:L,overflows:N},reset:{placement:X}};let J=(M=N.filter(re=>re.overflows[0]<=0).sort((re,q)=>re.overflows[1]-q.overflows[1])[0])==null?void 0:M.placement;if(!J)switch(v){case"bestFit":{var z;const re=(z=N.filter(q=>{if(k){const ee=cg(q.placement);return ee===y||ee==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(ee=>ee>0).reduce((ee,oe)=>ee+oe,0)]).sort((q,ee)=>q[1]-ee[1])[0])==null?void 0:z[0];re&&(J=re);break}case"initialPlacement":J=o;break}if(r!==J)return{reset:{placement:J}}}return{}}}},Kat=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:r}=t,i=Kh(e,t),{mainAxis:a=!0,crossAxis:o=!1,limiter:l={fn:_=>{let{x:w,y}=_;return{x:w,y}}}}=i,u=eI(i,Gat),d={x:n,y:s},f=await aI(t,u),p=cg(jc(r)),g=sI(p);let v=d[g],b=d[p];if(a){const _=g==="y"?"top":"left",w=g==="y"?"bottom":"right",y=v+f[_],S=v-f[w];v=cA(y,v,S)}if(o){const _=p==="y"?"top":"left",w=p==="y"?"bottom":"right",y=b+f[_],S=b-f[w];b=cA(y,b,S)}const x=l.fn(Zi({},t,{[g]:v,[p]:b}));return Zi({},x,{data:{x:x.x-n,y:x.y-s}})}}},Yat=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:r,rects:i,middlewareData:a}=t,{offset:o=0,mainAxis:l=!0,crossAxis:u=!0}=Kh(e,t),d={x:n,y:s},f=cg(r),p=sI(f);let g=d[p],v=d[f];const b=Kh(o,t),x=typeof b=="number"?{mainAxis:b,crossAxis:0}:Zi({mainAxis:0,crossAxis:0},b);if(l){const y=p==="y"?"height":"width",S=i.reference[p]-i.floating[y]+x.mainAxis,C=i.reference[p]+i.reference[y]-x.mainAxis;g<S?g=S:g>C&&(g=C)}if(u){var _,w;const y=p==="y"?"width":"height",S=["top","left"].includes(jc(r)),C=i.reference[f]-i.floating[y]+(S&&((_=a.offset)==null?void 0:_[f])||0)+(S?0:x.crossAxis),E=i.reference[f]+i.reference[y]+(S?0:((w=a.offset)==null?void 0:w[f])||0)-(S?x.crossAxis:0);v<C?v=C:v>E&&(v=E)}return{[p]:g,[f]:v}}}};function YC(){return typeof window<"u"}function Og(e){return uX(e)?(e.nodeName||"").toLowerCase():"#document"}function wa(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Gl(e){var t;return(t=(uX(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function uX(e){return YC()?e instanceof Node||e instanceof wa(e).Node:!1}function qo(e){return YC()?e instanceof Element||e instanceof wa(e).Element:!1}function Ol(e){return YC()?e instanceof HTMLElement||e instanceof wa(e).HTMLElement:!1}function O6(e){return!YC()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof wa(e).ShadowRoot}function wb(e){const{overflow:t,overflowX:n,overflowY:s,display:r}=Ko(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!["inline","contents"].includes(r)}function Xat(e){return["table","td","th"].includes(Og(e))}function XC(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function oI(e){const t=lI(),n=qo(e)?Ko(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(s=>(n.willChange||"").includes(s))||["paint","layout","strict","content"].some(s=>(n.contain||"").includes(s))}function Qat(e){let t=ld(e);for(;Ol(t)&&!ug(t);){if(oI(t))return t;if(XC(t))return null;t=ld(t)}return null}function lI(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ug(e){return["html","body","#document"].includes(Og(e))}function Ko(e){return wa(e).getComputedStyle(e)}function QC(e){return qo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ld(e){if(Og(e)==="html")return e;const t=e.assignedSlot||e.parentNode||O6(e)&&e.host||Gl(e);return O6(t)?t.host:t}function dX(e){const t=ld(e);return ug(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ol(t)&&wb(t)?t:dX(t)}function jv(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=dX(e),i=r===((s=e.ownerDocument)==null?void 0:s.body),a=wa(r);if(i){const o=uA(a);return t.concat(a,a.visualViewport||[],wb(r)?r:[],o&&n?jv(o):[])}return t.concat(r,jv(r,[],n))}function uA(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function hX(e){const t=Ko(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=Ol(e),i=r?e.offsetWidth:n,a=r?e.offsetHeight:s,o=fy(n)!==i||fy(s)!==a;return o&&(n=i,s=a),{width:n,height:s,$:o}}function cI(e){return qo(e)?e:e.contextElement}function Lp(e){const t=cI(e);if(!Ol(t))return Fl(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:i}=hX(t);let a=(i?fy(n.width):n.width)/s,o=(i?fy(n.height):n.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}const Jat=Fl(0);function fX(e){const t=wa(e);return!lI()||!t.visualViewport?Jat:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Zat(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==wa(e)?!1:t}function Yh(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=cI(e);let a=Fl(1);t&&(s?qo(s)&&(a=Lp(s)):a=Lp(e));const o=Zat(i,n,s)?fX(i):Fl(0);let l=(r.left+o.x)/a.x,u=(r.top+o.y)/a.y,d=r.width/a.x,f=r.height/a.y;if(i){const p=wa(i),g=s&&qo(s)?wa(s):s;let v=p,b=uA(v);for(;b&&s&&g!==v;){const x=Lp(b),_=b.getBoundingClientRect(),w=Ko(b),y=_.left+(b.clientLeft+parseFloat(w.paddingLeft))*x.x,S=_.top+(b.clientTop+parseFloat(w.paddingTop))*x.y;l*=x.x,u*=x.y,d*=x.x,f*=x.y,l+=y,u+=S,v=wa(b),b=uA(v)}}return my({width:d,height:f,x:l,y:u})}function uI(e,t){const n=QC(e).scrollLeft;return t?t.left+n:Yh(Gl(e)).left+n}function pX(e,t,n){n===void 0&&(n=!1);const s=e.getBoundingClientRect(),r=s.left+t.scrollLeft-(n?0:uI(e,s)),i=s.top+t.scrollTop;return{x:r,y:i}}function eot(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const i=r==="fixed",a=Gl(s),o=t?XC(t.floating):!1;if(s===a||o&&i)return n;let l={scrollLeft:0,scrollTop:0},u=Fl(1);const d=Fl(0),f=Ol(s);if((f||!f&&!i)&&((Og(s)!=="body"||wb(a))&&(l=QC(s)),Ol(s))){const g=Yh(s);u=Lp(s),d.x=g.x+s.clientLeft,d.y=g.y+s.clientTop}const p=a&&!f&&!i?pX(a,l,!0):Fl(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-l.scrollTop*u.y+d.y+p.y}}function tot(e){return Array.from(e.getClientRects())}function not(e){const t=Gl(e),n=QC(e),s=e.ownerDocument.body,r=kh(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),i=kh(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let a=-n.scrollLeft+uI(e);const o=-n.scrollTop;return Ko(s).direction==="rtl"&&(a+=kh(t.clientWidth,s.clientWidth)-r),{width:r,height:i,x:a,y:o}}function sot(e,t){const n=wa(e),s=Gl(e),r=n.visualViewport;let i=s.clientWidth,a=s.clientHeight,o=0,l=0;if(r){i=r.width,a=r.height;const u=lI();(!u||u&&t==="fixed")&&(o=r.offsetLeft,l=r.offsetTop)}return{width:i,height:a,x:o,y:l}}function rot(e,t){const n=Yh(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,i=Ol(e)?Lp(e):Fl(1),a=e.clientWidth*i.x,o=e.clientHeight*i.y,l=r*i.x,u=s*i.y;return{width:a,height:o,x:l,y:u}}function L6(e,t,n){let s;if(t==="viewport")s=sot(e,n);else if(t==="document")s=not(Gl(e));else if(qo(t))s=rot(t,n);else{const r=fX(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return my(s)}function gX(e,t){const n=ld(e);return n===t||!qo(n)||ug(n)?!1:Ko(n).position==="fixed"||gX(n,t)}function iot(e,t){const n=t.get(e);if(n)return n;let s=jv(e,[],!1).filter(o=>qo(o)&&Og(o)!=="body"),r=null;const i=Ko(e).position==="fixed";let a=i?ld(e):e;for(;qo(a)&&!ug(a);){const o=Ko(a),l=oI(a);!l&&o.position==="fixed"&&(r=null),(i?!l&&!r:!l&&o.position==="static"&&r&&["absolute","fixed"].includes(r.position)||wb(a)&&!l&&gX(e,a))?s=s.filter(u=>u!==a):r=o,a=ld(a)}return t.set(e,s),s}function aot(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const i=[...n==="clippingAncestors"?XC(t)?[]:iot(t,this._c):[].concat(n),s],a=i[0],o=i.reduce((l,u)=>{const d=L6(t,u,r);return l.top=kh(d.top,l.top),l.right=lg(d.right,l.right),l.bottom=lg(d.bottom,l.bottom),l.left=kh(d.left,l.left),l},L6(t,a,r));return{width:o.right-o.left,height:o.bottom-o.top,x:o.left,y:o.top}}function oot(e){const{width:t,height:n}=hX(e);return{width:t,height:n}}function lot(e,t,n){const s=Ol(t),r=Gl(t),i=n==="fixed",a=Yh(e,!0,i,t);let o={scrollLeft:0,scrollTop:0};const l=Fl(0);if(s||!s&&!i)if((Og(t)!=="body"||wb(r))&&(o=QC(t)),s){const p=Yh(t,!0,i,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else r&&(l.x=uI(r));const u=r&&!s&&!i?pX(r,o):Fl(0),d=a.left+o.scrollLeft-l.x-u.x,f=a.top+o.scrollTop-l.y-u.y;return{x:d,y:f,width:a.width,height:a.height}}function sE(e){return Ko(e).position==="static"}function B6(e,t){if(!Ol(e)||Ko(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Gl(e)===n&&(n=n.ownerDocument.body),n}function mX(e,t){const n=wa(e);if(XC(e))return n;if(!Ol(e)){let r=ld(e);for(;r&&!ug(r);){if(qo(r)&&!sE(r))return r;r=ld(r)}return n}let s=B6(e,t);for(;s&&Xat(s)&&sE(s);)s=B6(s,t);return s&&ug(s)&&sE(s)&&!oI(s)?n:s||Qat(e)||n}const cot=async function(e){const t=this.getOffsetParent||mX,n=this.getDimensions,s=await n(e.floating);return{reference:lot(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function uot(e){return Ko(e).direction==="rtl"}const dot={convertOffsetParentRelativeRectToViewportRelativeRect:eot,getDocumentElement:Gl,getClippingRect:aot,getOffsetParent:mX,getElementRects:cot,getClientRects:tot,getDimensions:oot,getScale:Lp,isElement:qo,isRTL:uot};function hot(e,t){let n=null,s;const r=Gl(e);function i(){var o;clearTimeout(s),(o=n)==null||o.disconnect(),n=null}function a(o,l){o===void 0&&(o=!1),l===void 0&&(l=1),i();const{left:u,top:d,width:f,height:p}=e.getBoundingClientRect();if(o||t(),!f||!p)return;const g=Wx(d),v=Wx(r.clientWidth-(u+f)),b=Wx(r.clientHeight-(d+p)),x=Wx(u),_={rootMargin:-g+"px "+-v+"px "+-b+"px "+-x+"px",threshold:kh(0,lg(1,l))||1};let w=!0;function y(S){const C=S[0].intersectionRatio;if(C!==l){if(!w)return a();C?a(!1,C):s=setTimeout(()=>{a(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(y,Zi({},_,{root:r.ownerDocument}))}catch{n=new IntersectionObserver(y,_)}n.observe(e)}return a(!0),i}function fot(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:l=!1}=s,u=cI(e),d=r||i?[...u?jv(u):[],...jv(t)]:[];d.forEach(_=>{r&&_.addEventListener("scroll",n,{passive:!0}),i&&_.addEventListener("resize",n)});const f=u&&o?hot(u,n):null;let p=-1,g=null;a&&(g=new ResizeObserver(_=>{let[w]=_;w&&w.target===u&&g&&(g.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var y;(y=g)==null||y.observe(t)})),n()}),u&&!l&&g.observe(u),g.observe(t));let v,b=l?Yh(e):null;l&&x();function x(){const _=Yh(e);b&&(_.x!==b.x||_.y!==b.y||_.width!==b.width||_.height!==b.height)&&n(),b=_,v=requestAnimationFrame(x)}return n(),()=>{var _;d.forEach(w=>{r&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),f?.(),(_=g)==null||_.disconnect(),g=null,l&&cancelAnimationFrame(v)}}const pot=zat,got=Kat,mot=qat,vot=Wat,bot=Yat,xot=(e,t,n)=>{const s=new Map,r=Zi({platform:dot},n),i=Zi({},r.platform,{_c:s});return Vat(e,t,Zi({},r,{platform:i}))};function _ot(e){e.cleanup&&e.cleanup();const t=e._getResolvedAttachToOptions();let n=t.element;const s=Eot(t,e),r=aX(t);return r&&(n=document.body,e.shepherdElementComponent.getElement().classList.add("shepherd-centered")),e.cleanup=fot(n,e.el,()=>{if(!e.el){e.cleanup==null||e.cleanup();return}Cot(n,e,s,r)}),e.target=t.element,s}function wot(e,t){return{floatingUIOptions:tI(e.floatingUIOptions||{},t.floatingUIOptions||{})}}function yot(e){e.cleanup&&e.cleanup(),e.cleanup=null}function Cot(e,t,n,s){return xot(e,t.el,n).then(Sot(t,s)).then(r=>new Promise(i=>{setTimeout(()=>i(r),300)})).then(r=>{r!=null&&r.el&&r.el.focus({preventScroll:!0})})}function Sot(e,t){return({x:n,y:s,placement:r,middlewareData:i})=>(e.el&&(t?Object.assign(e.el.style,{position:"fixed",left:"50%",top:"50%",transform:"translate(-50%, -50%)"}):Object.assign(e.el.style,{position:"absolute",left:`${n}px`,top:`${s}px`}),e.el.dataset.popperPlacement=r,kot(e.el,i)),e)}function kot(e,t){const n=e.querySelector(".shepherd-arrow");if(og(n)&&t.arrow){const{x:s,y:r}=t.arrow;Object.assign(n.style,{left:s!=null?`${s}px`:"",top:r!=null?`${r}px`:""})}}function Eot(e,t){var n,s,r;const i={strategy:"absolute"};i.middleware=[];const a=Tot(t),o=aX(e),l=(n=e.on)==null?void 0:n.includes("auto"),u=(e==null||(s=e.on)==null?void 0:s.includes("-start"))||(e==null||(r=e.on)==null?void 0:r.includes("-end"));if(!o){if(l){var d;i.middleware.push(pot({crossAxis:!0,alignment:u?e==null||(d=e.on)==null?void 0:d.split("-").pop():null}))}else i.middleware.push(mot());if(i.middleware.push(got({limiter:bot(),crossAxis:!0})),a){const f=typeof t.options.arrow=="object"?t.options.arrow:{padding:4};i.middleware.push(vot({element:a,padding:u?f.padding:0}))}l||(i.placement=e.on)}return tI(i,t.options.floatingUIOptions||{})}function Tot(e){return e.options.arrow&&e.el?e.el.querySelector(".shepherd-arrow"):!1}function Sa(){}function Rot(e,t){for(const n in t)e[n]=t[n];return e}function vX(e){return e()}function j6(){return Object.create(null)}function yb(e){e.forEach(vX)}function dI(e){return typeof e=="function"}function Xc(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Aot(e){return Object.keys(e).length===0}function dg(e,t){e.appendChild(t)}function el(e,t,n){e.insertBefore(t,n||null)}function po(e){e.parentNode&&e.parentNode.removeChild(e)}function Fot(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function Ll(e){return document.createElement(e)}function H6(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function bX(e){return document.createTextNode(e)}function vy(){return bX(" ")}function Dot(){return bX("")}function JC(e,t,n,s){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n,s)}function as(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}const Iot=["width","height"];function U6(e,t){const n=Object.getOwnPropertyDescriptors(e.__proto__);for(const s in t)t[s]==null?e.removeAttribute(s):s==="style"?e.style.cssText=t[s]:s==="__value"?e.value=e[s]=t[s]:n[s]&&n[s].set&&Iot.indexOf(s)===-1?e[s]=t[s]:as(e,s,t[s])}function Not(e){return Array.from(e.childNodes)}function Bf(e,t,n){e.classList.toggle(t,!!n)}let Hv;function D0(e){Hv=e}function xX(){if(!Hv)throw new Error("Function called outside component initialization");return Hv}function Pot(e){xX().$$.on_mount.push(e)}function hI(e){xX().$$.after_update.push(e)}const Jf=[],hg=[];let Bp=[];const G6=[],Mot=Promise.resolve();let dA=!1;function Oot(){dA||(dA=!0,Mot.then(_X))}function hA(e){Bp.push(e)}const rE=new Set;let jf=0;function _X(){if(jf!==0)return;const e=Hv;do{try{for(;jf<Jf.length;){const t=Jf[jf];jf++,D0(t),Lot(t.$$)}}catch(t){throw Jf.length=0,jf=0,t}for(D0(null),Jf.length=0,jf=0;hg.length;)hg.pop()();for(let t=0;t<Bp.length;t+=1){const n=Bp[t];rE.has(n)||(rE.add(n),n())}Bp.length=0}while(Jf.length);for(;G6.length;)G6.pop()();dA=!1,rE.clear(),D0(e)}function Lot(e){if(e.fragment!==null){e.update(),yb(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(hA)}}function Bot(e){const t=[],n=[];Bp.forEach(s=>e.indexOf(s)===-1?t.push(s):n.push(s)),n.forEach(s=>s()),Bp=t}const E_=new Set;let lh;function Eh(){lh={r:0,c:[],p:lh}}function Th(){lh.r||yb(lh.c),lh=lh.p}function zn(e,t){e&&e.i&&(E_.delete(e),e.i(t))}function Ys(e,t,n,s){if(e&&e.o){if(E_.has(e))return;E_.add(e),lh.c.push(()=>{E_.delete(e),s&&(n&&e.d(1),s())}),e.o(t)}else s&&s()}function V6(e){return e?.length!==void 0?e:Array.from(e)}function jot(e,t){const n={},s={},r={$$scope:1};let i=e.length;for(;i--;){const a=e[i],o=t[i];if(o){for(const l in a)l in o||(s[l]=1);for(const l in o)r[l]||(n[l]=o[l],r[l]=1);e[i]=o}else for(const l in a)r[l]=1}for(const a in s)a in n||(n[a]=void 0);return n}function ff(e){e&&e.c()}function _d(e,t,n){const{fragment:s,after_update:r}=e.$$;s&&s.m(t,n),hA(()=>{const i=e.$$.on_mount.map(vX).filter(dI);e.$$.on_destroy?e.$$.on_destroy.push(...i):yb(i),e.$$.on_mount=[]}),r.forEach(hA)}function wd(e,t){const n=e.$$;n.fragment!==null&&(Bot(n.after_update),yb(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Hot(e,t){e.$$.dirty[0]===-1&&(Jf.push(e),Oot(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function Qc(e,t,n,s,r,i,a=null,o=[-1]){const l=Hv;D0(e);const u=e.$$={fragment:null,ctx:[],props:i,update:Sa,not_equal:r,bound:j6(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:j6(),dirty:o,skip_bound:!1,root:t.target||l.$$.root};a&&a(u.root);let d=!1;if(u.ctx=n?n(e,t.props||{},(f,p,...g)=>{const v=g.length?g[0]:p;return u.ctx&&r(u.ctx[f],u.ctx[f]=v)&&(!u.skip_bound&&u.bound[f]&&u.bound[f](v),d&&Hot(e,f)),p}):[],u.update(),d=!0,yb(u.before_update),u.fragment=s?s(u.ctx):!1,t.target){if(t.hydrate){const f=Not(t.target);u.fragment&&u.fragment.l(f),f.forEach(po)}else u.fragment&&u.fragment.c();t.intro&&zn(e.$$.fragment),_d(e,t.target,t.anchor),_X()}D0(l)}class Jc{constructor(){this.$$=void 0,this.$$set=void 0}$destroy(){wd(this,1),this.$destroy=Sa}$on(t,n){if(!dI(n))return Sa;const s=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return s.push(n),()=>{const r=s.indexOf(n);r!==-1&&s.splice(r,1)}}$set(t){this.$$set&&!Aot(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Uot="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Uot);function Got(e){let t,n,s,r,i;return{c(){t=Ll("button"),as(t,"aria-label",n=e[3]?e[3]:null),as(t,"class",s=`${e[1]||""} shepherd-button ${e[4]?"shepherd-button-secondary":""}`),t.disabled=e[2],as(t,"tabindex","0"),as(t,"type","button")},m(a,o){el(a,t,o),t.innerHTML=e[5],r||(i=JC(t,"click",function(){dI(e[0])&&e[0].apply(this,arguments)}),r=!0)},p(a,[o]){e=a,o&32&&(t.innerHTML=e[5]),o&8&&n!==(n=e[3]?e[3]:null)&&as(t,"aria-label",n),o&18&&s!==(s=`${e[1]||""} shepherd-button ${e[4]?"shepherd-button-secondary":""}`)&&as(t,"class",s),o&4&&(t.disabled=e[2])},i:Sa,o:Sa,d(a){a&&po(t),r=!1,i()}}}function Vot(e,t,n){let{config:s,step:r}=t,i,a,o,l,u,d;function f(p){return od(p)?p=p.call(r):p}return e.$$set=p=>{"config"in p&&n(6,s=p.config),"step"in p&&n(7,r=p.step)},e.$$.update=()=>{e.$$.dirty&192&&(n(0,i=s.action?s.action.bind(r.tour):null),n(1,a=s.classes),n(2,o=s.disabled?f(s.disabled):!1),n(3,l=s.label?f(s.label):null),n(4,u=s.secondary),n(5,d=s.text?f(s.text):null))},[i,a,o,l,u,d,s,r]}class Wot extends Jc{constructor(t){super(),Qc(this,t,Vot,Got,Xc,{config:6,step:7})}}function W6(e,t,n){const s=e.slice();return s[2]=t[n],s}function $6(e){let t,n,s=V6(e[1]),r=[];for(let a=0;a<s.length;a+=1)r[a]=z6(W6(e,s,a));const i=a=>Ys(r[a],1,1,()=>{r[a]=null});return{c(){for(let a=0;a<r.length;a+=1)r[a].c();t=Dot()},m(a,o){for(let l=0;l<r.length;l+=1)r[l]&&r[l].m(a,o);el(a,t,o),n=!0},p(a,o){if(o&3){s=V6(a[1]);let l;for(l=0;l<s.length;l+=1){const u=W6(a,s,l);r[l]?(r[l].p(u,o),zn(r[l],1)):(r[l]=z6(u),r[l].c(),zn(r[l],1),r[l].m(t.parentNode,t))}for(Eh(),l=s.length;l<r.length;l+=1)i(l);Th()}},i(a){if(!n){for(let o=0;o<s.length;o+=1)zn(r[o]);n=!0}},o(a){r=r.filter(Boolean);for(let o=0;o<r.length;o+=1)Ys(r[o]);n=!1},d(a){a&&po(t),Fot(r,a)}}}function z6(e){let t,n;return t=new Wot({props:{config:e[2],step:e[0]}}),{c(){ff(t.$$.fragment)},m(s,r){_d(t,s,r),n=!0},p(s,r){const i={};r&2&&(i.config=s[2]),r&1&&(i.step=s[0]),t.$set(i)},i(s){n||(zn(t.$$.fragment,s),n=!0)},o(s){Ys(t.$$.fragment,s),n=!1},d(s){wd(t,s)}}}function $ot(e){let t,n,s=e[1]&&$6(e);return{c(){t=Ll("footer"),s&&s.c(),as(t,"class","shepherd-footer")},m(r,i){el(r,t,i),s&&s.m(t,null),n=!0},p(r,[i]){r[1]?s?(s.p(r,i),i&2&&zn(s,1)):(s=$6(r),s.c(),zn(s,1),s.m(t,null)):s&&(Eh(),Ys(s,1,1,()=>{s=null}),Th())},i(r){n||(zn(s),n=!0)},o(r){Ys(s),n=!1},d(r){r&&po(t),s&&s.d()}}}function zot(e,t,n){let s,{step:r}=t;return e.$$set=i=>{"step"in i&&n(0,r=i.step)},e.$$.update=()=>{e.$$.dirty&1&&n(1,s=r.options.buttons)},[r,s]}class qot extends Jc{constructor(t){super(),Qc(this,t,zot,$ot,Xc,{step:0})}}function Kot(e){let t,n,s,r,i;return{c(){t=Ll("button"),n=Ll("span"),n.textContent="×",as(n,"aria-hidden","true"),as(t,"aria-label",s=e[0].label?e[0].label:"Close Tour"),as(t,"class","shepherd-cancel-icon"),as(t,"type","button")},m(a,o){el(a,t,o),dg(t,n),r||(i=JC(t,"click",e[1]),r=!0)},p(a,[o]){o&1&&s!==(s=a[0].label?a[0].label:"Close Tour")&&as(t,"aria-label",s)},i:Sa,o:Sa,d(a){a&&po(t),r=!1,i()}}}function Yot(e,t,n){let{cancelIcon:s,step:r}=t;const i=a=>{a.preventDefault(),r.cancel()};return e.$$set=a=>{"cancelIcon"in a&&n(0,s=a.cancelIcon),"step"in a&&n(2,r=a.step)},[s,i,r]}class Xot extends Jc{constructor(t){super(),Qc(this,t,Yot,Kot,Xc,{cancelIcon:0,step:2})}}function Qot(e){let t;return{c(){t=Ll("h3"),as(t,"id",e[1]),as(t,"class","shepherd-title")},m(n,s){el(n,t,s),e[3](t)},p(n,[s]){s&2&&as(t,"id",n[1])},i:Sa,o:Sa,d(n){n&&po(t),e[3](null)}}}function Jot(e,t,n){let{labelId:s,element:r,title:i}=t;hI(()=>{od(i)&&n(2,i=i()),n(0,r.innerHTML=i,r)});function a(o){hg[o?"unshift":"push"](()=>{r=o,n(0,r)})}return e.$$set=o=>{"labelId"in o&&n(1,s=o.labelId),"element"in o&&n(0,r=o.element),"title"in o&&n(2,i=o.title)},[r,s,i,a]}class Zot extends Jc{constructor(t){super(),Qc(this,t,Jot,Qot,Xc,{labelId:1,element:0,title:2})}}function q6(e){let t,n;return t=new Zot({props:{labelId:e[0],title:e[2]}}),{c(){ff(t.$$.fragment)},m(s,r){_d(t,s,r),n=!0},p(s,r){const i={};r&1&&(i.labelId=s[0]),r&4&&(i.title=s[2]),t.$set(i)},i(s){n||(zn(t.$$.fragment,s),n=!0)},o(s){Ys(t.$$.fragment,s),n=!1},d(s){wd(t,s)}}}function K6(e){let t,n;return t=new Xot({props:{cancelIcon:e[3],step:e[1]}}),{c(){ff(t.$$.fragment)},m(s,r){_d(t,s,r),n=!0},p(s,r){const i={};r&8&&(i.cancelIcon=s[3]),r&2&&(i.step=s[1]),t.$set(i)},i(s){n||(zn(t.$$.fragment,s),n=!0)},o(s){Ys(t.$$.fragment,s),n=!1},d(s){wd(t,s)}}}function elt(e){let t,n,s,r=e[2]&&q6(e),i=e[3]&&e[3].enabled&&K6(e);return{c(){t=Ll("header"),r&&r.c(),n=vy(),i&&i.c(),as(t,"class","shepherd-header")},m(a,o){el(a,t,o),r&&r.m(t,null),dg(t,n),i&&i.m(t,null),s=!0},p(a,[o]){a[2]?r?(r.p(a,o),o&4&&zn(r,1)):(r=q6(a),r.c(),zn(r,1),r.m(t,n)):r&&(Eh(),Ys(r,1,1,()=>{r=null}),Th()),a[3]&&a[3].enabled?i?(i.p(a,o),o&8&&zn(i,1)):(i=K6(a),i.c(),zn(i,1),i.m(t,null)):i&&(Eh(),Ys(i,1,1,()=>{i=null}),Th())},i(a){s||(zn(r),zn(i),s=!0)},o(a){Ys(r),Ys(i),s=!1},d(a){a&&po(t),r&&r.d(),i&&i.d()}}}function tlt(e,t,n){let{labelId:s,step:r}=t,i,a;return e.$$set=o=>{"labelId"in o&&n(0,s=o.labelId),"step"in o&&n(1,r=o.step)},e.$$.update=()=>{e.$$.dirty&2&&(n(2,i=r.options.title),n(3,a=r.options.cancelIcon))},[s,r,i,a]}class nlt extends Jc{constructor(t){super(),Qc(this,t,tlt,elt,Xc,{labelId:0,step:1})}}function slt(e){let t;return{c(){t=Ll("div"),as(t,"class","shepherd-text"),as(t,"id",e[1])},m(n,s){el(n,t,s),e[3](t)},p(n,[s]){s&2&&as(t,"id",n[1])},i:Sa,o:Sa,d(n){n&&po(t),e[3](null)}}}function rlt(e,t,n){let{descriptionId:s,element:r,step:i}=t;hI(()=>{let{text:o}=i.options;od(o)&&(o=o.call(i)),og(o)?r.appendChild(o):n(0,r.innerHTML=o,r)});function a(o){hg[o?"unshift":"push"](()=>{r=o,n(0,r)})}return e.$$set=o=>{"descriptionId"in o&&n(1,s=o.descriptionId),"element"in o&&n(0,r=o.element),"step"in o&&n(2,i=o.step)},[r,s,i,a]}class ilt extends Jc{constructor(t){super(),Qc(this,t,rlt,slt,Xc,{descriptionId:1,element:0,step:2})}}function Y6(e){let t,n;return t=new nlt({props:{labelId:e[1],step:e[2]}}),{c(){ff(t.$$.fragment)},m(s,r){_d(t,s,r),n=!0},p(s,r){const i={};r&2&&(i.labelId=s[1]),r&4&&(i.step=s[2]),t.$set(i)},i(s){n||(zn(t.$$.fragment,s),n=!0)},o(s){Ys(t.$$.fragment,s),n=!1},d(s){wd(t,s)}}}function X6(e){let t,n;return t=new ilt({props:{descriptionId:e[0],step:e[2]}}),{c(){ff(t.$$.fragment)},m(s,r){_d(t,s,r),n=!0},p(s,r){const i={};r&1&&(i.descriptionId=s[0]),r&4&&(i.step=s[2]),t.$set(i)},i(s){n||(zn(t.$$.fragment,s),n=!0)},o(s){Ys(t.$$.fragment,s),n=!1},d(s){wd(t,s)}}}function Q6(e){let t,n;return t=new qot({props:{step:e[2]}}),{c(){ff(t.$$.fragment)},m(s,r){_d(t,s,r),n=!0},p(s,r){const i={};r&4&&(i.step=s[2]),t.$set(i)},i(s){n||(zn(t.$$.fragment,s),n=!0)},o(s){Ys(t.$$.fragment,s),n=!1},d(s){wd(t,s)}}}function alt(e){let t,n=!li(e[2].options.title)||e[2].options.cancelIcon&&e[2].options.cancelIcon.enabled,s,r=!li(e[2].options.text),i,a=Array.isArray(e[2].options.buttons)&&e[2].options.buttons.length,o,l=n&&Y6(e),u=r&&X6(e),d=a&&Q6(e);return{c(){t=Ll("div"),l&&l.c(),s=vy(),u&&u.c(),i=vy(),d&&d.c(),as(t,"class","shepherd-content")},m(f,p){el(f,t,p),l&&l.m(t,null),dg(t,s),u&&u.m(t,null),dg(t,i),d&&d.m(t,null),o=!0},p(f,[p]){p&4&&(n=!li(f[2].options.title)||f[2].options.cancelIcon&&f[2].options.cancelIcon.enabled),n?l?(l.p(f,p),p&4&&zn(l,1)):(l=Y6(f),l.c(),zn(l,1),l.m(t,s)):l&&(Eh(),Ys(l,1,1,()=>{l=null}),Th()),p&4&&(r=!li(f[2].options.text)),r?u?(u.p(f,p),p&4&&zn(u,1)):(u=X6(f),u.c(),zn(u,1),u.m(t,i)):u&&(Eh(),Ys(u,1,1,()=>{u=null}),Th()),p&4&&(a=Array.isArray(f[2].options.buttons)&&f[2].options.buttons.length),a?d?(d.p(f,p),p&4&&zn(d,1)):(d=Q6(f),d.c(),zn(d,1),d.m(t,null)):d&&(Eh(),Ys(d,1,1,()=>{d=null}),Th())},i(f){o||(zn(l),zn(u),zn(d),o=!0)},o(f){Ys(l),Ys(u),Ys(d),o=!1},d(f){f&&po(t),l&&l.d(),u&&u.d(),d&&d.d()}}}function olt(e,t,n){let{descriptionId:s,labelId:r,step:i}=t;return e.$$set=a=>{"descriptionId"in a&&n(0,s=a.descriptionId),"labelId"in a&&n(1,r=a.labelId),"step"in a&&n(2,i=a.step)},[s,r,i]}class llt extends Jc{constructor(t){super(),Qc(this,t,olt,alt,Xc,{descriptionId:0,labelId:1,step:2})}}function J6(e){let t;return{c(){t=Ll("div"),as(t,"class","shepherd-arrow"),as(t,"data-popper-arrow","")},m(n,s){el(n,t,s)},d(n){n&&po(t)}}}function clt(e){let t,n,s,r,i,a,o,l,u=e[4].options.arrow&&e[4].options.attachTo&&e[4].options.attachTo.element&&e[4].options.attachTo.on&&J6();s=new llt({props:{descriptionId:e[2],labelId:e[3],step:e[4]}});let d=[{"aria-describedby":r=li(e[4].options.text)?null:e[2]},{"aria-labelledby":i=e[4].options.title?e[3]:null},e[1],{open:"true"}],f={};for(let p=0;p<d.length;p+=1)f=Rot(f,d[p]);return{c(){t=Ll("dialog"),u&&u.c(),n=vy(),ff(s.$$.fragment),U6(t,f),Bf(t,"shepherd-has-cancel-icon",e[5]),Bf(t,"shepherd-has-title",e[6]),Bf(t,"shepherd-element",!0)},m(p,g){el(p,t,g),u&&u.m(t,null),dg(t,n),_d(s,t,null),e[13](t),a=!0,o||(l=JC(t,"keydown",e[7]),o=!0)},p(p,[g]){p[4].options.arrow&&p[4].options.attachTo&&p[4].options.attachTo.element&&p[4].options.attachTo.on?u||(u=J6(),u.c(),u.m(t,n)):u&&(u.d(1),u=null);const v={};g&4&&(v.descriptionId=p[2]),g&8&&(v.labelId=p[3]),g&16&&(v.step=p[4]),s.$set(v),U6(t,f=jot(d,[(!a||g&20&&r!==(r=li(p[4].options.text)?null:p[2]))&&{"aria-describedby":r},(!a||g&24&&i!==(i=p[4].options.title?p[3]:null))&&{"aria-labelledby":i},g&2&&p[1],{open:"true"}])),Bf(t,"shepherd-has-cancel-icon",p[5]),Bf(t,"shepherd-has-title",p[6]),Bf(t,"shepherd-element",!0)},i(p){a||(zn(s.$$.fragment,p),a=!0)},o(p){Ys(s.$$.fragment,p),a=!1},d(p){p&&po(t),u&&u.d(),wd(s),e[13](null),o=!1,l()}}}const ult=9,dlt=27,hlt=37,flt=39;function Z6(e){return e.split(" ").filter(t=>!!t.length)}function plt(e,t,n){let{classPrefix:s,element:r,descriptionId:i,firstFocusableElement:a,focusableElements:o,labelId:l,lastFocusableElement:u,step:d,dataStepId:f}=t,p,g,v;const b=()=>r;Pot(()=>{n(1,f={[`data-${s}shepherd-step-id`]:d.id}),n(9,o=r.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]')),n(8,a=o[0]),n(10,u=o[o.length-1])}),hI(()=>{v!==d.options.classes&&x()});function x(){_(v),v=d.options.classes,w(v)}function _(C){if(Bv(C)){const E=Z6(C);E.length&&r.classList.remove(...E)}}function w(C){if(Bv(C)){const E=Z6(C);E.length&&r.classList.add(...E)}}const y=C=>{const{tour:E}=d;switch(C.keyCode){case ult:if(o.length===0){C.preventDefault();break}C.shiftKey?(document.activeElement===a||document.activeElement.classList.contains("shepherd-element"))&&(C.preventDefault(),u.focus()):document.activeElement===u&&(C.preventDefault(),a.focus());break;case dlt:E.options.exitOnEsc&&(C.preventDefault(),C.stopPropagation(),d.cancel());break;case hlt:E.options.keyboardNavigation&&(C.preventDefault(),C.stopPropagation(),E.back());break;case flt:E.options.keyboardNavigation&&(C.preventDefault(),C.stopPropagation(),E.next());break}};function S(C){hg[C?"unshift":"push"](()=>{r=C,n(0,r)})}return e.$$set=C=>{"classPrefix"in C&&n(11,s=C.classPrefix),"element"in C&&n(0,r=C.element),"descriptionId"in C&&n(2,i=C.descriptionId),"firstFocusableElement"in C&&n(8,a=C.firstFocusableElement),"focusableElements"in C&&n(9,o=C.focusableElements),"labelId"in C&&n(3,l=C.labelId),"lastFocusableElement"in C&&n(10,u=C.lastFocusableElement),"step"in C&&n(4,d=C.step),"dataStepId"in C&&n(1,f=C.dataStepId)},e.$$.update=()=>{e.$$.dirty&16&&(n(5,p=d.options&&d.options.cancelIcon&&d.options.cancelIcon.enabled),n(6,g=d.options&&d.options.title))},[r,f,i,l,d,p,g,y,a,o,u,s,b,S]}class glt extends Jc{constructor(t){super(),Qc(this,t,plt,clt,Xc,{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 fA extends ZD{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?iX(this.tour.options.classPrefix):"",this.styles=t.styles,this._resolvedAttachTo=null,nI(this),this._setOptions(n),this}cancel(){this.tour.cancel(),this.trigger("cancel")}complete(){this.tour.complete(),this.trigger("complete")}destroy(){yot(this),og(this.el)&&(this.el.remove(),this.el=null),this._updateStepTargetOnHide(),this.trigger("destroy")}getTour(){return this.tour}hide(){var t;(t=this.tour.modal)==null||t.hide(),this.trigger("before-hide"),this.el&&(this.el.hidden=!0),this._updateStepTargetOnHide(),this.trigger("hide")}_resolveExtraHiglightElements(){return this._resolvedExtraHighlightElements=Iat(this),this._resolvedExtraHighlightElements}_resolveAttachToOptions(){return this._resolvedAttachTo=Dat(this),this._resolvedAttachTo}_getResolvedAttachToOptions(){return this._resolvedAttachTo===null?this._resolveAttachToOptions():this._resolvedAttachTo}isOpen(){return!!(this.el&&!this.el.hidden)}show(){return od(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 glt({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();od(this.options.scrollToHandler)?this.options.scrollToHandler(n):uat(n)&&typeof n.scrollIntoView=="function"&&n.scrollIntoView(t)}_getClassOptions(t){const n=this.tour&&this.tour.options&&this.tour.options.defaultStepOptions,s=t.classes?t.classes:"",r=n&&n.classes?n.classes:"",i=[...s.split(" "),...r.split(" ")],a=new Set(i);return Array.from(a).join(" ").trim()}_setOptions(t={}){let n=this.tour&&this.tour.options&&this.tour.options.defaultStepOptions;n=tI({},n||{}),this.options=Object.assign({arrow:!0},n,t,wot(n,t));const{when:s}=this.options;this.options.classes=this._getClassOptions(t),this.destroy(),this.id=this.options.id||`step-${oX()}`,s&&Object.keys(s).forEach(r=>{this.on(r,s[r],this)})}_setupElements(){li(this.el)||this.destroy(),this.el=this._createTooltipContent(),this.options.advanceOn&&Rat(this),_ot(this)}_show(){var t;this.trigger("before-show"),this._resolveAttachToOptions(),this._resolveExtraHiglightElements(),this._setupElements(),this.tour.modal||this.tour.setupModal(),(t=this.tour.modal)==null||t.setupForStep(this),this._styleTargetElementForStep(this),this.el&&(this.el.hidden=!1),this.options.scrollTo&&setTimeout(()=>{this._scrollTo(this.options.scrollTo)}),this.el&&(this.el.hidden=!1);const n=this.shepherdElementComponent.getElement(),s=this.target||document.body,r=this._resolvedExtraHighlightElements;s.classList.add(`${this.classPrefix}shepherd-enabled`),s.classList.add(`${this.classPrefix}shepherd-target`),n.classList.add("shepherd-enabled"),r?.forEach(i=>{i.classList.add(`${this.classPrefix}shepherd-enabled`),i.classList.add(`${this.classPrefix}shepherd-target`)}),this.trigger("show")}_styleTargetElementForStep(t){const n=t.target,s=t._resolvedExtraHighlightElements;if(!n)return;const r=t.options.highlightClass;r&&(n.classList.add(r),s?.forEach(i=>i.classList.add(r))),n.classList.remove("shepherd-target-click-disabled"),s?.forEach(i=>i.classList.remove("shepherd-target-click-disabled")),t.options.canClickTarget===!1&&(n.classList.add("shepherd-target-click-disabled"),s?.forEach(i=>i.classList.add("shepherd-target-click-disabled")))}_updateStepTargetOnHide(){const t=this.target||document.body,n=this._resolvedExtraHighlightElements,s=this.options.highlightClass;s&&(t.classList.remove(s),n?.forEach(r=>r.classList.remove(s))),t.classList.remove("shepherd-target-click-disabled",`${this.classPrefix}shepherd-enabled`,`${this.classPrefix}shepherd-target`),n?.forEach(r=>{r.classList.remove("shepherd-target-click-disabled",`${this.classPrefix}shepherd-enabled`,`${this.classPrefix}shepherd-target`)})}}function mlt(e){if(e){const{steps:t}=e;t.forEach(n=>{n.options&&n.options.canClickTarget===!1&&n.options.attachTo&&(og(n.target)&&n.target.classList.remove("shepherd-target-click-disabled"),n._resolvedExtraHighlightElements&&n._resolvedExtraHighlightElements.forEach(s=>{og(s)&&s.classList.remove("shepherd-target-click-disabled")}))})}}function vlt(e){let t="";const{innerWidth:n,innerHeight:s}=window;return e.forEach(r=>{const{width:i,height:a,x:o=0,y:l=0,r:u=0}=r,{topLeft:d=0,topRight:f=0,bottomRight:p=0,bottomLeft:g=0}=typeof u=="number"?{topLeft:u,topRight:u,bottomRight:u,bottomLeft:u}:u;t+=`M${o+d},${l} a${d},${d},0,0,0-${d},${d} V${a+l-g} a${g},${g},0,0,0,${g},${g} H${i+o-p} a${p},${p},0,0,0,${p}-${p} V${l+f} a${f},${f},0,0,0-${f}-${f} Z`}),`M${n},${s} H0 V0 H${n} V${s} Z ${t}`.replace(/\s/g,"")}function blt(e){let t,n,s,r,i;return{c(){t=H6("svg"),n=H6("path"),as(n,"d",e[2]),as(t,"class",s=`${e[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)},m(a,o){el(a,t,o),dg(t,n),e[11](t),r||(i=JC(t,"touchmove",e[3]),r=!0)},p(a,[o]){o&4&&as(n,"d",a[2]),o&2&&s!==(s=`${a[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)&&as(t,"class",s)},i:Sa,o:Sa,d(a){a&&po(t),e[11](null),r=!1,i()}}}function wX(e){if(!e)return null;const t=e instanceof HTMLElement&&window.getComputedStyle(e).overflowY;return t!=="hidden"&&t!=="visible"&&e.scrollHeight>=e.clientHeight?e:wX(e.parentElement)}function xlt(e){let t={top:0,left:0};if(!e)return t;let n=e.ownerDocument.defaultView;for(;n!==window.top;){var s;const a=(s=n)==null?void 0:s.frameElement;if(a){var r,i;const o=a.getBoundingClientRect();t.top+=o.top+((r=o.scrollTop)!=null?r:0),t.left+=o.left+((i=o.scrollLeft)!=null?i:0)}n=n.parent}return t}function _lt(e,t){const n=e.getBoundingClientRect();let s=n.y||n.top,r=n.bottom||s+n.height;if(t){const a=t.getBoundingClientRect(),o=a.y||a.top,l=a.bottom||o+a.height;s=Math.max(s,o),r=Math.min(r,l)}const i=Math.max(r-s,0);return{y:s,height:i}}function wlt(e,t,n){let{element:s,openingProperties:r}=t,i=!1,a,o;u();const l=()=>s;function u(){n(4,r=[{width:0,height:0,x:0,y:0,r:0}])}function d(){n(1,i=!1),_()}function f(S=0,C=0,E=0,k=0,F,A,I){if(A){const N=[A,...I||[]];n(4,r=[]);for(const P of N){if(!P||N.indexOf(P)!==N.lastIndexOf(P))continue;const{y:M,height:z}=_lt(P,F),{x:L,width:X,left:J}=P.getBoundingClientRect();N.some(re=>{if(re===P)return!1;const q=re.getBoundingClientRect();return L>=q.left&&L+X<=q.right&&M>=q.top&&M+z<=q.bottom})||r.push({width:X+S*2,height:z+S*2,x:(L||J)+E-S,y:M+k-S,r:C})}}else u()}function p(S){_(),S.tour.options.useModalOverlay?(w(S),g()):d()}function g(){n(1,i=!0)}const v=S=>{S.preventDefault()},b=S=>{S.stopPropagation()};function x(){window.addEventListener("touchmove",v,{passive:!1})}function _(){a&&(cancelAnimationFrame(a),a=void 0),window.removeEventListener("touchmove",v,{passive:!1})}function w(S){const{modalOverlayOpeningPadding:C,modalOverlayOpeningRadius:E,modalOverlayOpeningXOffset:k=0,modalOverlayOpeningYOffset:F=0}=S.options,A=xlt(S.target),I=wX(S.target),N=()=>{a=void 0,f(C,E,k+A.left,F+A.top,I,S.target,S._resolvedExtraHighlightElements),a=requestAnimationFrame(N)};N(),x()}function y(S){hg[S?"unshift":"push"](()=>{s=S,n(0,s)})}return e.$$set=S=>{"element"in S&&n(0,s=S.element),"openingProperties"in S&&n(4,r=S.openingProperties)},e.$$.update=()=>{e.$$.dirty&16&&n(2,o=vlt(r))},[s,i,o,b,r,l,u,d,f,p,g,y]}class ylt extends Jc{constructor(t){super(),Qc(this,t,wlt,blt,Xc,{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 Clt extends ZD{constructor(){super(),this.activeTour=void 0,nI(this)}}class Slt extends ZD{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,nI(this);const n={exitOnEsc:!0,keyboardNavigation:!0};return this.options=Object.assign({},n,t),this.classPrefix=iX(this.options.classPrefix),this.steps=[],this.addSteps(this.options.steps),["active","cancel","complete","inactive","show","start"].map(s=>{(r=>{this.on(r,i=>{i=i||{},i.tour=this,ch.trigger(r,i)})})(s)}),this._setTourID(t.id),this}addStep(t,n){let s=t;return s instanceof fA?s.tour=this:s=new fA(this,s),li(n)?this.steps.push(s):this.steps.splice(n,0,s),s}addSteps(t){return Array.isArray(t)&&t.forEach(n=>{this.addStep(n)}),this}back(){const t=this.steps.indexOf(this.currentStep);this.show(t-1,!1)}async cancel(){if(this.options.confirmCancel){const t=this.options.confirmCancelMessage||"Are you sure you want to stop the tour?";let n;od(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 ch.activeTour===this}next(){const t=this.steps.indexOf(this.currentStep);t===this.steps.length-1?this.complete():this.show(t+1,!0)}removeStep(t){const n=this.getCurrentStep();this.steps.some((s,r)=>{if(s.id===t)return s.isOpen()&&s.hide(),s.destroy(),this.steps.splice(r,1),!0}),n&&n.id===t&&(this.currentStep=void 0,this.steps.length?this.show(0):this.cancel())}show(t=0,n=!0){const s=Bv(t)?this.getById(t):this.steps[t];s&&(this._updateStateBeforeShow(),od(s.options.showOn)&&!s.options.showOn()?this._skipStep(s,n):(this.currentStep=s,this.trigger("show",{step:s,previous:this.currentStep}),s.show()))}async start(){this.trigger("start"),this.focusedElBeforeOpen=document.activeElement,this.currentStep=null,this.setupModal(),this._setupActiveTour(),this.next()}_done(t){const n=this.steps.indexOf(this.currentStep);if(Array.isArray(this.steps)&&this.steps.forEach(s=>s.destroy()),mlt(this),this.trigger(t,{index:n}),ch.activeTour=null,this.trigger("inactive",{tour:this}),this.modal&&this.modal.hide(),(t==="cancel"||t==="complete")&&this.modal){const s=document.querySelector(".shepherd-modal-overlay-container");s&&(s.remove(),this.modal=null)}og(this.focusedElBeforeOpen)&&this.focusedElBeforeOpen.focus()}_setupActiveTour(){this.trigger("active",{tour:this}),ch.activeTour=this}setupModal(){this.modal=new ylt({target:this.options.modalContainer||document.body,props:{styles:this.styles}})}_skipStep(t,n){const s=this.steps.indexOf(t);if(s===this.steps.length-1)this.complete();else{const r=n?s+1:s-1;this.show(r,n)}}_updateStateBeforeShow(){this.currentStep&&this.currentStep.hide(),this.isActive()||this._setupActiveTour()}_setTourID(t){const n=this.options.tourName||"tour",s=t||oX();this.id=`${n}--${s}`}}const ch=new Clt,yX=typeof window>"u";ch.Step=yX?Aat:fA;ch.Tour=yX?Fat:Slt;const ZC=m.createContext(void 0);ZC.Consumer;const klt=({children:e})=>cat.jsx(ZC.Provider,{value:{Shepherd:ch},children:e}),by=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),Elt=e=>by(e).replace(/"/g,"&quot;"),rt=e=>by(h(e)),Tlt=['<div class="tour-figure-rail" aria-hidden="true">','<span class="tour-figure-dot"></span>','<span class="tour-figure-dot"></span>','<span class="tour-figure-dot"></span>','<span class="tour-figure-rail-line"></span>',"</div>",'<div class="tour-figure-main" aria-hidden="true">','<span class="tour-figure-bubble tour-figure-bubble-in"></span>','<span class="tour-figure-bubble tour-figure-bubble-out"></span>','<span class="tour-figure-composer">','<span class="tour-figure-composer-line"></span>','<span class="tour-figure-send"></span>',"</span>","</div>"].join(""),Rlt=['<div class="tour-figure-flow" aria-hidden="true">','<div class="tour-figure-node">','<span class="tour-figure-node-icon"></span>','<span class="tour-figure-node-bar"></span>','<span class="tour-figure-node-bar tour-figure-node-bar-short"></span>',"</div>",'<span class="tour-figure-connector"></span>','<div class="tour-figure-node">','<span class="tour-figure-node-icon tour-figure-node-icon-round"></span>','<span class="tour-figure-node-bar"></span>','<span class="tour-figure-node-bar tour-figure-node-bar-short"></span>',"</div>",'<span class="tour-figure-connector"></span>','<div class="tour-figure-node">','<span class="tour-figure-node-icon tour-figure-node-icon-end"></span>','<span class="tour-figure-node-bar"></span>','<span class="tour-figure-node-bar tour-figure-node-bar-short"></span>',"</div>","</div>"].join(""),Alt={welcome:Tlt,"agent-capabilities":Rlt},e5=e=>e.map(t=>"key"in t?by(h(t.key)):`<code>${by(t.code)}</code>`).join(""),Flt=e=>{const t="<br/>".repeat(e.breaks??0);return e.kind==="paragraph"?`${e5(e.runs)}${t}`:e.kind==="list"?`<ul>${e.items.map(s=>`<li>${e5(s)}</li>`).join("")}</ul>${t}`:`<div class="tour-figure tour-figure-${e.figure}" role="img" aria-label="${Elt(h(e.altKey))}">${Alt[e.figure]}</div>${t}`},xn=e=>e.map(Flt).join(""),_n={welcome:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.welcome.body.1"}],breaks:1},{kind:"figure",figure:"welcome",altKey:"ui.onboarding.tour.welcome.image.1.alt",breaks:1},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.welcome.body.2"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.welcome.body.3"}],breaks:0},{kind:"list",items:[[{key:"ui.onboarding.tour.welcome.list.1.item.1"}],[{key:"ui.onboarding.tour.welcome.list.1.item.2"}],[{key:"ui.onboarding.tour.welcome.list.1.item.3"}],[{key:"ui.onboarding.tour.welcome.list.1.item.4"}],[{key:"ui.onboarding.tour.welcome.list.1.item.5"}],[{key:"ui.onboarding.tour.welcome.list.1.item.6"}],[{key:"ui.onboarding.tour.welcome.list.1.item.7"}]],breaks:0},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.welcome.body.4"}],breaks:0}],agent_list:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_list.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_list.body.2"}],breaks:0}],select_agent:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.select_agent.body.1"}],breaks:0}],chat_input:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.chat_input.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.chat_input.body.2"}],breaks:2},{kind:"list",items:[[{key:"ui.onboarding.tour.chat_input.list.1.item.1"}],[{key:"ui.onboarding.tour.chat_input.list.1.item.2"}],[{key:"ui.onboarding.tour.chat_input.list.1.item.3"}]],breaks:1},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.chat_input.body.3"}],breaks:0}],attachments:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.attachments.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.attachments.body.2"}],breaks:1},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.attachments.body.3"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.attachments.body.4"}],breaks:0}],agent_capabilities:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_capabilities.body.1"}],breaks:1},{kind:"figure",figure:"agent-capabilities",altKey:"ui.onboarding.tour.agent_capabilities.image.1.alt",breaks:1},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_capabilities.body.2"}],breaks:0}],pre_command_palette_open_canvas:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.1.1"},{code:_l("everything",!0)},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.connector.on_mac_and"},{code:_l("everything",!1)},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.1.3"},{code:"#"},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.1.4"},{code:"@"},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.1.5"},{code:","},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.1.6"},{code:">"},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.1.7"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.2.1"},{code:_l("chats",!0)},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.connector.on_mac_and"},{code:_l("chats",!1)},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.2.3"},{code:_l("commands",!0)},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.connector.on_mac_and"},{code:_l("commands",!1)},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.2.5"}],breaks:0}],canvas_open_button:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_open_button.body.1"}],breaks:0}],canvas_feature:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_feature.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_feature.body.2"}],breaks:0}],canvas_documents_view:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_documents_view.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_documents_view.body.2"}],breaks:1},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_documents_view.body.3"}],breaks:1},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_documents_view.body.4"}],breaks:0}],canvas_files_view:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_files_view.body.1"}],breaks:0}],canvas_variables_view:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_variables_view.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_variables_view.body.2"}],breaks:0}],agent_options:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_options.body.1"}],breaks:0}],click_view_settings_from_chat:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.click_view_settings_from_chat.body.1"}],breaks:0}],view_agent_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.view_agent_settings.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.view_agent_settings.body.2"}],breaks:0}],select_provider:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.select_provider.body.1"}],breaks:0}],select_model:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.select_model.body.1"}],breaks:0}],modify_security_prompt:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.modify_security_prompt.body.1"}],breaks:0}],modify_agent_prompt:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.modify_agent_prompt.body.1"}],breaks:0}],create_new_agent:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.create_new_agent.body.1"}],breaks:0}],agent_naming_guidelines:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_naming_guidelines.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_naming_guidelines.body.2"}],breaks:0}],navigate_agent_hub:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.navigate_agent_hub.body.1"}],breaks:0}],agent_hub_view:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_hub_view.body.1"}],breaks:0}],download_agent:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.download_agent.body.1"}],breaks:0}],upload_agent_hub:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.upload_agent_hub.body.1"}],breaks:0}],upload_agent_hub_dialog:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.upload_agent_hub_dialog.body.1"}],breaks:0}],navigate_schedules:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.navigate_schedules.body.1"}],breaks:0}],schedules_overview:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.schedules_overview.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.schedules_overview.body.2"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.schedules_overview.body.3"}],breaks:0}],create_schedule:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.create_schedule.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.create_schedule.body.2"}],breaks:0}],create_schedule_dialog:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.create_schedule_dialog.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.create_schedule_dialog.body.2"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.create_schedule_dialog.body.3"}],breaks:0}],navigate_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.navigate_settings.body.1"}],breaks:0}],general_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.general_settings.body.1"}],breaks:0}],appearance_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.appearance_settings.body.1"}],breaks:0}],radient_account_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.radient_account_settings.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.radient_account_settings.body.2"}],breaks:0}],integrations_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.integrations_settings.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.integrations_settings.body.2"}],breaks:0}],application_updates_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.application_updates_settings.body.1"}],breaks:0}],tour_complete:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.tour_complete.body.1"}],breaks:0}]},Dlt=e=>{const t=Array.from(document.querySelectorAll(`[data-tour-tag="${e}"]`));return t.find(n=>n.offsetParent!==null)??t[0]??null},t5=e=>{document.querySelector(`[data-tour-action="${e}"]`)?.click()},CX=1340,fI="tour-beside-palette",e1="pre-command-palette-open-canvas",SX='[data-tour-tag="command-palette-dialog"]',us=e=>p8($m())!=="rtl"?e:e==="left"?"right":"left",Ilt=e=>(e.getById(e1)?.options.classes??"").split(" ").includes(fI),kX=(e,t)=>{const n=e.getById(e1);!n||Ilt(e)===t||n.updateStepOptions(t?{attachTo:{element:SX,on:us("right")},classes:fI}:{attachTo:void 0,classes:void 0})},EX=e=>{const t=window.innerWidth>=CX;return kX(e,t),t};let pI=0;const pA=new WeakMap;et.subscribe((e,t)=>{t.isCommandPaletteOpen&&!e.isCommandPaletteOpen&&(pI+=1)});const TX=e=>{const t=pA.get(e);return t===void 0||(pA.delete(e),t!==pI)?!1:(et.getState().closeCommandPalette(),!0)},n5=(e,t)=>{if(!EX(e)){t();return}const n=et.getState();n.isCommandPaletteOpen||(n.openCommandPalette(),pA.set(e,pI)),setTimeout(()=>{e.isActive()&&t()},500)},s5=(e,t)=>{if(!TX(e)){t();return}setTimeout(()=>{e.isActive()&&t()},500)},r5=e=>{const t=e?.step;if(t?.id!==e1)return;(!EX(t.tour)||document.querySelector(SX)===null)&&kX(t.tour,!1)},Nlt=()=>{const e=window.innerWidth>=CX;return{id:e1,...e?{attachTo:{element:'[data-tour-tag="command-palette-dialog"]',on:us("right")},classes:fI}:{},title:rt("ui.onboarding.tour.pre_command_palette_open_canvas.title"),text:xn(_n.pre_command_palette_open_canvas),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){s5(this,()=>this.back())}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){s5(this,()=>this.next())}}]}},RX=()=>[{id:"welcome",title:rt("ui.onboarding.tour.welcome.title"),text:xn(_n.welcome),buttons:[{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"agent-list",attachTo:{element:'[data-tour-tag="agent-list-panel"]',on:us("right")},title:rt("ui.onboarding.tour.agent_list.title"),text:xn(_n.agent_list),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"select-agent",attachTo:{element:'[data-tour-tag="agent-list-item-button-0"]',on:us("right")},title:rt("ui.onboarding.tour.select_agent.title"),text:xn(_n.select_agent),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="agent-list-item-button-0"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"chat-input",attachTo:{element:'[data-tour-tag="chat-input-textarea"]',on:"top"},title:rt("ui.onboarding.tour.chat_input.title"),text:xn(_n.chat_input),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"attachments",attachTo:{element:'button[data-tour-tag="chat-input-attach-file-button"]',on:"top"},title:rt("ui.onboarding.tour.attachments.title"),text:xn(_n.attachments),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"agent-capabilities",attachTo:{element:'[data-tour-tag="chat-header"]',on:"top"},title:rt("ui.onboarding.tour.agent_capabilities.title"),text:xn(_n.agent_capabilities),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){n5(this,()=>this.next())}}]},Nlt(),{id:"canvas-open-button",attachTo:{element:'button[data-tour-tag="open-canvas-button"]',on:us("left")},title:rt("ui.onboarding.tour.canvas_open_button.title"),text:xn(_n.canvas_open_button),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){n5(this,()=>this.back())}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="open-canvas-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-feature",attachTo:{element:'[data-tour-tag="canvas-container"]',on:us("left")},title:rt("ui.onboarding.tour.canvas_feature.title"),text:xn(_n.canvas_feature),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="close-canvas-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-documents-view-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-documents-view",attachTo:{element:'button[data-tour-tag="canvas-documents-view-button"]',on:"top"},title:rt("ui.onboarding.tour.canvas_documents_view.title"),text:xn(_n.canvas_documents_view),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-files-view-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-files-view",attachTo:{element:'button[data-tour-tag="canvas-files-view-button"]',on:"top"},title:rt("ui.onboarding.tour.canvas_files_view.title"),text:xn(_n.canvas_files_view),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-documents-view-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-variables-view-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-variables-view",attachTo:{element:'button[data-tour-tag="canvas-variables-view-button"]',on:"top"},title:rt("ui.onboarding.tour.canvas_variables_view.title"),text:xn(_n.canvas_variables_view),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-files-view-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="close-canvas-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"agent-options",attachTo:{element:'button[data-tour-tag="agent-options-button"]',on:us("right")},title:rt("ui.onboarding.tour.agent_options.title"),text:xn(_n.agent_options),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="open-canvas-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="agent-options-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"click-view-settings-from-chat",attachTo:{element:'[role="menuitem"][data-tour-tag="view-agent-settings-menu-item"]',on:us("right")},title:rt("ui.onboarding.tour.click_view_settings_from_chat.title"),text:xn(_n.click_view_settings_from_chat),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[role="menuitem"][data-tour-tag="view-agent-settings-menu-item"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"view-agent-settings",attachTo:{element:'div[data-tour-tag="agent-settings-details-paper"]',on:us("left")},title:rt("ui.onboarding.tour.view_agent_settings.title"),text:xn(_n.view_agent_settings),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-chat"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('button[data-tour-tag="agent-options-button"]');t&&t.click()},500),setTimeout(()=>{this.back()},1e3)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"select-provider",attachTo:{element:'[data-tour-tag="agent-settings-hosting-select"]',on:us("left")},title:rt("ui.onboarding.tour.select_provider.title"),text:xn(_n.select_provider),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"select-model",attachTo:{element:'[data-tour-tag="agent-settings-model-select"]',on:us("left")},title:rt("ui.onboarding.tour.select_model.title"),text:xn(_n.select_model),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"modify-security-prompt",attachTo:{element:'[data-tour-tag="agent-settings-security"]',on:us("left")},title:rt("ui.onboarding.tour.modify_security_prompt.title"),text:xn(_n.modify_security_prompt),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"modify-agent-prompt",attachTo:{element:'[data-tour-tag="agent-settings-system-prompt"]',on:us("left")},title:rt("ui.onboarding.tour.modify_agent_prompt.title"),text:xn(_n.modify_agent_prompt),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"create-new-agent",attachTo:{element:'button[data-tour-tag="create-new-agent-button"]',on:"bottom"},title:rt("ui.onboarding.tour.create_new_agent.title"),text:xn(_n.create_new_agent),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="agent-list-item-button-0"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('button[data-tour-tag="agent-options-button"]');t&&t.click()},500),setTimeout(()=>{const t=document.querySelector('[role="menuitem"][data-tour-tag="view-agent-settings-menu-item"]');t&&t.click()},1e3),setTimeout(()=>{this.back()},1500)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="create-new-agent-button"]');e&&e.click(),setTimeout(()=>{this.next()},1e3)}}]},{id:"agent-naming-guidelines",attachTo:{element:'[data-tour-tag="create-agent-dialog"]',on:us("right")},title:rt("ui.onboarding.tour.agent_naming_guidelines.title"),text:xn(_n.agent_naming_guidelines),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="create-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="create-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"navigate-agent-hub",attachTo:{element:'[data-tour-tag="nav-item-agent-hub"]',on:us("right")},title:rt("ui.onboarding.tour.navigate_agent_hub.title"),text:xn(_n.navigate_agent_hub),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('[data-tour-tag="create-new-agent-button"]');t&&t.click()},500),setTimeout(()=>{this.back()},1e3)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agent-hub"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"agent-hub-view",attachTo:{element:'[data-tour-tag="agent-hub-sidebar-container"]',on:us("right")},title:rt("ui.onboarding.tour.agent_hub_view.title"),text:xn(_n.agent_hub_view),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"download-agent",attachTo:{element:'button[data-tour-tag="agent-hub-download-button"]',on:"bottom"},title:rt("ui.onboarding.tour.download_agent.title"),text:xn(_n.download_agent),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{this.next()},1e3)}}]},{id:"upload-agent-hub",attachTo:{element:()=>Dlt("upload-to-hub-header-button"),on:"bottom"},title:rt("ui.onboarding.tour.upload_agent_hub.title"),text:xn(_n.upload_agent_hub),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agent-hub"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){t5("open-upload-dialog"),setTimeout(()=>{this.next()},500)}}]},{id:"upload-agent-hub-dialog",attachTo:{element:'[data-tour-tag="upload-agent-dialog"]',on:us("right")},title:rt("ui.onboarding.tour.upload_agent_hub_dialog.title"),text:xn(_n.upload_agent_hub_dialog),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="upload-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="upload-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"navigate-schedules",attachTo:{element:'[data-tour-tag="nav-item-schedules"]',on:us("right")},title:rt("ui.onboarding.tour.navigate_schedules.title"),text:xn(_n.navigate_schedules),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{t5("open-upload-dialog")},500),setTimeout(()=>{this.back()},1e3)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-schedules"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"schedules-overview",title:rt("ui.onboarding.tour.schedules_overview.title"),text:xn(_n.schedules_overview),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"create-schedule",attachTo:{element:'button[data-tour-tag="create-schedule-button"]',on:"bottom"},title:rt("ui.onboarding.tour.create_schedule.title"),text:xn(_n.create_schedule),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="create-schedule-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"create-schedule-dialog",attachTo:{element:'[data-tour-tag="create-schedule-dialog"]',on:us("right")},title:rt("ui.onboarding.tour.create_schedule_dialog.title"),text:xn(_n.create_schedule_dialog),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="create-schedule-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="create-schedule-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"navigate-settings",attachTo:{element:'[data-tour-tag="nav-item-settings"]',on:us("right")},title:rt("ui.onboarding.tour.navigate_settings.title"),text:xn(_n.navigate_settings),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-schedules"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('button[data-tour-tag="create-schedule-button"]');t&&t.click()},500),setTimeout(()=>{this.back()},1e3)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-settings"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"general-settings",attachTo:{element:'div[data-tour-tag="settings-general-section"]',on:us("right")},title:rt("ui.onboarding.tour.general_settings.title"),text:xn(_n.general_settings),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"appearance-settings",attachTo:{element:'[data-tour-tag="settings-appearance-section"]',on:us("right")},title:rt("ui.onboarding.tour.appearance_settings.title"),text:xn(_n.appearance_settings),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"radient-account-settings",attachTo:{element:'[data-tour-tag="settings-radient-account-section"]',on:us("right")},title:rt("ui.onboarding.tour.radient_account_settings.title"),text:xn(_n.radient_account_settings),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"integrations-settings",attachTo:{element:'[data-tour-tag="settings-integrations-section"]',on:us("right")},title:rt("ui.onboarding.tour.integrations_settings.title"),text:xn(_n.integrations_settings),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"application-updates-settings",attachTo:{element:'[data-tour-tag="settings-app-updates-section"]',on:us("right")},title:rt("ui.onboarding.tour.application_updates_settings.title"),text:xn(_n.application_updates_settings),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"tour-complete",title:rt("ui.onboarding.tour.tour_complete.title"),text:xn(_n.tour_complete),buttons:[{text:rt("ui.onboarding.tour.action.finish"),classes:"shepherd-button-primary",action:function(){this.complete()}}]}],AX=()=>({enabled:!0,label:h("ui.onboarding.tour.action.close")}),gA=new WeakMap,Plt=(e,t)=>{gA.set(e,t)},Mlt=(e,t)=>{if(gA.get(e)===t)return;const n=new Map(RX().filter(r=>r.id).map(r=>[r.id,r])),s=AX();for(const r of e.steps){const i=r.id?n.get(r.id):void 0;i&&r.updateStepOptions({title:i.title,text:i.text,buttons:i.buttons,cancelIcon:s})}e.options.defaultStepOptions={...e.options.defaultStepOptions,cancelIcon:s},gA.set(e,t)},i5=new WeakMap,Olt=e=>{const t=i5.get(e);if(t)return t;const n=()=>TX(e);return i5.set(e,n),n},Llt=()=>{const e=Yr(),{completeTourOnboarding:t}=j0(),n=m.useContext(ZC),s=Ge(),r={cancelIcon:AX(),scrollTo:{behavior:"smooth",block:"center"}},i=!0,a=o=>{if(n?.tour?.isActive()&&!o?.forceModalCompleted){console.log("Onboarding tour is already active (from context.tour). Not starting another.");return}const l=j0.getState();if(!o?.forceModalCompleted&&!l.isModalComplete){console.log("Onboarding modal not completed (checked via store). Tour will not start.");return}if(l.isTourComplete&&!o?.forceModalCompleted){console.log("Onboarding tour already completed in store and not forced. Not starting again.");return}let u=n?.tour;const d=n?.Shepherd;if(!u&&d&&(u=d.activeTour,!u&&d.Tour&&(console.log("No active Shepherd tour found from context or global. Creating a new one."),u=new d.Tour({useModalOverlay:i,defaultStepOptions:r}))),!u){console.warn("Failed to get or create a Shepherd tour instance.",n);return}if(u.isActive()){console.log("Tour is already active. Not starting again.");return}u.options.defaultStepOptions={...u.options.defaultStepOptions||{},...r},u.options.useModalOverlay=i,o?.firstAgentId&&(u.options.firstAgentId=o.firstAgentId),u.off("complete",t),u.on("complete",t),u.off("cancel",t),u.on("cancel",t);const f=Olt(u);u.off("complete",f),u.on("complete",f),u.off("cancel",f),u.on("cancel",f),u.off("show",r5),u.on("show",r5);const p=RX();if(o?.forceModalCompleted||!u.isActive()){const g=[...u.steps];for(const v of g)v.id&&u.removeStep(v.id);u.addSteps(p)}else u.steps.length===0&&u.addSteps(p);Plt(u,$m()),typeof u.start=="function"?(e("/"),u.start()):console.warn("Shepherd tour instance does not have a start method.",u)};return m.useEffect(()=>{const o=n?.tour??n?.Shepherd?.activeTour;o?.isActive()&&Mlt(o,s)},[s,n]),{startTour:a}},Blt=()=>{const{isModalComplete:e,isTourComplete:t}=j0(),{startTour:n}=Llt(),s=st.useContext(ZC),{data:r}=mT(1,1);return m.useEffect(()=>{if(e&&!t&&s){const i=setTimeout(()=>{const a=r?.agents?.[0]?.id;n({firstAgentId:a})},500);return()=>clearTimeout(i)}},[e,t,s,n,r]),null},jlt=({children:e})=>c.jsxs(klt,{children:[e,c.jsx(Blt,{})]}),Hlt=()=>{Ge();const{open:e,focusGroup:t,providerId:n,closeConnect:s}=pH(),r=m.useRef(null);m.useEffect(()=>{e&&(r.current=document.activeElement instanceof HTMLElement?document.activeElement:null)},[e]);const i=Yr();return c.jsx(Hc,{open:e,onOpenChange:a=>{a||s()},children:c.jsxs(Uc,{className:"max-h-[calc(100vh-4rem)] max-w-[min(40rem,calc(100vw-4rem))] gap-4 overflow-y-auto","data-connect-provider-dialog":"",onCloseAutoFocus:a=>{const o=r.current;r.current=null,o?.isConnected&&(a.preventDefault(),o.focus())},children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx(Dl,{className:"text-title",children:h("ui.providers.connect_provider_dialog.connect_a_model_provider")}),c.jsx(cd,{className:"text-body-sm text-ink-muted",children:h("ui.providers.connect_provider_dialog.your_agents_need_a_model_to_think")})]}),e?c.jsx(tX,{context:"dialog",featuredOnly:!0,focusGroup:t,initialProviderId:n,onDone:s,onChangeModel:()=>{s(),i("/settings")}}):null]})})};function Ult(){const{visible:e,rows:t,cursor:n,commitAt:s,hoverAt:r}=joe();Fu(e,"session-switcher");const i=n!==null&&e?t[n]??null:null,a=e&&t.length>=2;return c.jsxs(c.Fragment,{children:[c.jsx("output",{"aria-live":"polite",className:"sr-only","data-session-switcher-announcement":"",children:i!==null&&n!==null?c.jsxs(c.Fragment,{children:[FX(i),", ",n+1," / ",t.length]}):null}),a?qv.createPortal(c.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 flex items-start justify-center pt-[18vh]",children:c.jsx("div",{role:"dialog","aria-modal":"false","aria-label":h("ui.command_palette.palette_search.recents"),className:"pointer-events-auto w-160 max-w-[90vw] rounded-lg border border-hairline bg-elevated p-2 shadow-overlay",children:t.map((o,l)=>c.jsx(Wlt,{row:o,active:l===n,onCommit:()=>s(l),onHover:()=>r(l)},o.sessionId))})}),document.body):null]})}function FX(e){return e.title??h("ui.command_palette.palette_search.untitled_chat")}const Glt=1e3;function Vlt(){let e=0;function t(){window.clearTimeout(e),window.removeEventListener("contextmenu",n,!0),window.removeEventListener("pointerup",t,!0)}function n(s){s.preventDefault(),s.stopPropagation(),t()}e=window.setTimeout(t,Glt),window.addEventListener("contextmenu",n,!0),window.addEventListener("pointerup",t,!0)}function Wlt({row:e,active:t,onCommit:n,onHover:s}){return c.jsxs("button",{type:"button",tabIndex:-1,"aria-current":t?"true":void 0,"data-session-id":e.sessionId,onPointerDown:r=>{r.button===0&&(r.preventDefault(),Vlt(),n())},onMouseDown:r=>r.preventDefault(),onContextMenu:r=>r.preventDefault(),onMouseMove:s,className:R("flex h-9 w-full items-center gap-3 rounded-sm px-2 text-left",t?"bg-sunken outline-solid outline-1 -outline-offset-1 outline-control":"bg-transparent"),children:[e.row===null?c.jsx("span",{"aria-hidden":"true",className:"size-4 shrink-0"}):c.jsx(dy,{row:e.row}),c.jsx("span",{className:R("min-w-0 flex-1 truncate text-body-sm",e.title===null?"text-ink-muted":"text-ink"),children:FX(e)})]})}const DX=({title:e,description:t,icon:n,children:s,titleComponent:r,sectionRef:i,dataTourTag:a,className:o,id:l,searchSection:u,searchSectionLabel:d,searchIgnore:f})=>c.jsxs("div",{ref:i,id:l,"data-search-section":u,"data-search-section-label":d,"data-search-ignore":f,tabIndex:l?-1:void 0,"data-tour-tag":a,className:R("w-full",o),children:[r??c.jsxs("h2",{className:"flex items-center gap-2 text-heading text-ink",children:[n&&c.jsx(n,{size:16,className:"shrink-0 text-ink-dim"}),e]}),t&&c.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:t}),c.jsx("div",{className:"mt-4",children:s})]}),ppt=({label:e,value:t,className:n,valueClassName:s})=>c.jsxs("div",{className:R("min-w-0",n),children:[c.jsx("div",{className:"flex items-center gap-1.5 text-meta text-ink-dim",children:e}),c.jsx("div",{className:R("mt-0.5 break-words text-body-sm",s??"text-ink"),children:t})]}),gpt=({children:e,className:t})=>c.jsx("div",{className:R("grid grid-cols-[repeat(auto-fit,minmax(160px,1fr))] gap-x-6 gap-y-4",t),children:e});function IX({id:e,rank:t,action:n,settingKey:s,help:r,hint:i,ariaLabel:a,value:o,fieldRef:l,saving:u,showReset:d,onReset:f,onKeyDown:p,onKeyUp:g,onBlur:v,notes:b,error:x,focusKey:_}){const w=m.useRef(!1);return m.useEffect(()=>{if(_!==s||w.current)return;const y=l.current;y&&(w.current=!0,y.scrollIntoView?.({block:"center"}),y.focus())},[_,s,l]),c.jsxs("div",{className:"group flex min-w-0 flex-col gap-1","data-speech-rank":t,"data-search-row":`keyboard.${s}`,"data-search-label":n,"data-search-terms":s,"data-search-control":!0,children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsxs("div",{className:"flex w-32 flex-col",children:[c.jsx(cr,{htmlFor:e,className:"text-body-sm text-ink",children:t==="primary"?h("ui.settings.shortcuts.speech.primary"):h("ui.settings.shortcuts.speech.secondary")}),c.jsx("span",{className:"text-meta text-ink-muted",children:n})]}),c.jsx(vs,{ref:l,id:e,"aria-label":a,"aria-describedby":`${e}-hint ${e}-notes ${e}-status`,"aria-invalid":x?!0:void 0,"aria-busy":u,"data-shortcut-action":s,className:"w-52 text-left font-mono text-body-sm",value:o,readOnly:!0,onKeyDown:p,onKeyUp:g,onBlur:v}),d&&c.jsx(ce,{variant:"secondary",size:"sm",disabled:u,"aria-label":h("ui.settings.shortcuts.keyboard_shortcuts_section.reset_label_to_its_default",{label:n}),onClick:f,children:h("ui.settings.shortcuts.keyboard_shortcuts_section.reset")})]}),c.jsxs("div",{className:"ml-0 max-w-88 text-meta text-ink-muted sm:ml-34",children:[c.jsx("p",{children:r}),c.jsx("p",{id:`${e}-hint`,className:"hidden group-focus-within:block",children:i}),c.jsx("div",{id:`${e}-notes`,children:b}),c.jsx("output",{id:`${e}-status`,className:"block","aria-live":"polite",children:u?h("ui.settings.configuration.backend_setting_row.saving"):x?c.jsx("span",{className:"text-danger",children:x}):null})]})]})}function NX({settingKey:e,refetch:t,fieldRef:n,onPending:s,onSaved:r}){const[i,a]=m.useState(!1),[o,l]=m.useState(null),[u,d]=m.useState(!1);return m.useEffect(()=>{!u||i||(n.current?.focus(),d(!1))},[u,i,n]),{saving:i,error:o,setError:l,write:async(p,g)=>{if(!(e===void 0||i||p==="settings.edit"&&g===void 0)){a(!0),l(null),s?.(g);try{await nt(p==="settings.edit"?{op:p,key:e,value:g??""}:{op:p,key:e}),r?.(p,g),await t()}catch(v){let b;if(v instanceof Pi){const x=v.detail;typeof x=="object"&&x!==null&&"code"in x&&x.code==="keymap.conflict"&&"label"in x&&typeof x.label=="string"&&(b=h("ui.settings.shortcuts.capture.already_assigned",{label:x.label}))}l(b??(v instanceof Error?v.message:h(p==="settings.edit"?"ui.settings.configuration.backend_settings_section.the_setting_could_not_be_saved":"ui.settings.configuration.backend_settings_section.the_setting_could_not_be_reset")))}finally{s?.(),a(!1),d(!0)}}}}}function PX(e,t,n,s=[]){const r=/^(Alt|Meta|Control)/.exec(e)?.[1],i=o=>r==="Control"?o.includes("ctrl")||o.includes("primary"):r==="Meta"?o.includes("meta")||t==="darwin"&&o.includes("primary"):r==="Alt"&&o.includes("alt"),a=o=>o.split("+").slice(0,-1);return s.find(o=>i(a(o)))??n.find(o=>i(a(o)))??null}function $lt(e,t,n){const s=e.split("+"),r=s.at(-1)??"",i=o=>o==="primary"?t==="Control"||t==="Command"?t:n==="darwin"?"Command":"Control":o==="ctrl"?"Control":o==="shift"?"Shift":o==="alt"?n==="darwin"?"Option":"Alt":o==="meta"?n==="darwin"?"Command":n==="win32"?"Windows":"Super":o,a=r.length===1?r.toUpperCase():r.charAt(0).toUpperCase()+r.slice(1);return[...s.slice(0,-1).map(i),a].join("+")}function zlt(e,t,n,s){for(const r of["AltRight","ControlRight","MetaRight"]){const i=_H(r,t);if(i===null)continue;const a=Gd(i);if(!(!a||a.code===e)&&!PX(r,t,n,s))return a.label}return null}const qlt=/^(Alt|Meta|Control|Shift)(Left|Right)$/,iE=e=>e.split("-").slice(1).join("-");function Klt({setting:e,refetch:t,focusKey:n}){const s=r2(),r=et(F=>F.shortcutBindings),i=m.useRef(null),a=m.useId(),o=m.useMemo(()=>Pae(),[]),l=m.useRef(null),u=typeof e.default=="string"?e.default:oP,{saving:d,error:f,setError:p,write:g}=NX({settingKey:e.key,refetch:t,fieldRef:i,onSaved:(F,A)=>Mae(F==="settings.edit"?A:u)}),v=h("ui.settings.shortcuts.speech.push_to_talk_hold"),b=typeof e.value=="string"?e.value:"",x=Gd(b)??Gd(u)??Gd(oP),_=Gd(b)?.code===Gd(u)?.code,w=ky.flatMap(F=>{const A=TA(F.id,r);return A?[A]:[]}),y=s.canonical?[s.canonical]:[],S=x===null?null:PX(x.code,o,w,y),C=S===null||x===null?null:zlt(x.code,o,w,y),E=h("ui.settings.shortcuts.speech.push_to_talk_letter_pointer"),k=()=>p(h("ui.settings.shortcuts.speech.push_to_talk_refused",{platform:o}));return c.jsx(IX,{id:a,rank:"secondary",action:v,settingKey:e.key,focusKey:n,help:e.help,hint:`${h("ui.settings.shortcuts.speech.push_to_talk_hint")} ${E}`,ariaLabel:h("ui.settings.configuration.setting_control.label_press_the_key_you_want",{label:v}),value:x?.label??"",fieldRef:i,saving:d,showReset:!_,onReset:()=>void g("settings.reset"),onBlur:()=>{l.current=null,p(null)},onKeyDown:F=>{if(d)return;if(F.repeat||F.nativeEvent.isComposing){DE.has(F.key)||F.preventDefault();return}const A=l.current!==null;if(l.current&&(l.current.tainted=!0),DE.has(F.key)){A&&k();return}if(U_.has(F.key)){l.current=null,p(null),F.preventDefault();return}if(F.preventDefault(),A||!qlt.test(F.code)){A||(l.current=null),k();return}p(null),l.current={code:F.code,tainted:!1}},onKeyUp:F=>{const A=l.current;if(!A||F.code!==A.code||(l.current=null,A.tainted||d))return;const I=_H(A.code,o);if(I===null){k();return}Gd(I)?.code!==x?.code&&g("settings.edit",I)},notes:S!==null&&x!==null&&c.jsx("p",{children:h("ui.settings.shortcuts.speech.push_to_talk_overlap",{modifier:iE(x.label),example:$lt(S,iE(x.label),o),alternative:C?iE(C):"none"})}),error:f})}function Ylt({setting:e,refetch:t,focusKey:n}){const s=m.useRef(!1),r=r2(),i=m.useRef(null),a=m.useId(),o=m.useMemo(()=>mg(),[]),{saving:l,error:u,setError:d,write:f}=NX({settingKey:e.key,refetch:t,fieldRef:i,onPending:S=>window.api?.recordingShortcut?.markPending(S)}),p=h("ui.settings.shortcuts.speech.start_recording_press"),g=typeof e.value=="string"?e.value:r.value,v=r.problem?r.value:g,b=typeof e.default=="string"?e.default:Oae,x=Ub(g)===Ub(b),_=S=>h("ui.settings.shortcuts.capture.already_assigned",{label:S}),w=h("ui.chat.composer.start_recording"),y=h("ui.settings.shortcuts.keyboard_shortcuts_section.press_the_keys_you_want_esc_cancels");return c.jsx(IX,{id:a,rank:"primary",action:p,settingKey:e.key,focusKey:n,help:e.help,hint:y,ariaLabel:h("ui.settings.shortcuts.keyboard_shortcuts_section.label_press_the_keys_you_want",{label:p}),value:z5(v,o),fieldRef:i,saving:l,showReset:!x,onReset:()=>void f("settings.reset"),onKeyUp:S=>{!Em.has(S.key)||!s.current||(s.current=!1,d(h("ui.settings.shortcuts.speech.start_recording_needs_key")))},onBlur:()=>{s.current=!1},onKeyDown:S=>{if(l)return;if(S.repeat&&Em.has(S.key)){S.preventDefault();return}if(s.current=Em.has(S.key),U_.has(S.key)||Em.has(S.key)){U_.has(S.key)&&d(null),S.preventDefault();return}const C=i2(S);if(C===null)return;if(S.preventDefault(),Ub(C)===Ub(g)){d(null);return}const E=et.getState().shortcutBindings,k=wH(r,_(w));for(const A of ky){const I=E[A.id]??A.defaultChord;I&&k.set(I,A.label)}const F=q5(C,"panel.console",{},o,k);if(F!==null){d(F);return}f("settings.edit",C)},notes:c.jsxs(c.Fragment,{children:[r.shadowedBy&&!u&&c.jsx("output",{className:"block text-danger",children:h("ui.settings.shortcuts.recording.inactive_claimed",{label:r.shadowedBy})}),r.problem&&!u&&c.jsx("output",{className:"block text-danger",children:h("ui.settings.shortcuts.recording.invalid_stored_value")})]}),error:u})}function Xlt({focusKey:e}){const{client:t,provided:n}=YZ(),s=Rn({queryKey:Wo.settings,queryFn:()=>nt({op:"settings.list"}),enabled:n,staleTime:1e4},t),r=l=>s.data?.settings.find(u=>u.key===l),i=r(Lae),a=r(Bae);if(!n)return null;const o=c.jsx("h3",{className:"pt-1 text-body-sm font-medium text-ink",children:h("ui.settings.shortcuts.category.speech_to_text")});return!i&&!a?s.isPending?c.jsx("div",{className:"min-h-24 space-y-3","aria-busy":"true",children:o}):null:c.jsxs("div",{className:"space-y-3","data-shortcut-recording":!0,children:[o,i&&c.jsx(Ylt,{setting:i,refetch:s.refetch,focusKey:e}),a&&c.jsx(Klt,{setting:a,refetch:s.refetch,focusKey:e})]})}const MX=e=>{switch(e.id){case"panel.console":return h("ui.settings.shortcuts.row.console");case"panel.canvas":return h("ui.settings.shortcuts.row.canvas");case"panel.run":return h("ui.settings.shortcuts.row.execution");case"panel.ask":return h("ui.settings.shortcuts.row.asks");case"panel.browser":return h("ui.settings.shortcuts.row.browser");case"panel.code":return h("ui.settings.shortcuts.row.code_review")}},Qlt=()=>h("ui.chat.composer.start_recording");function Jlt(){m.useEffect(()=>{let e=0;const t=()=>{const r=et.getState().shortcutBindings,i=new Map(XZ);for(const a of ky){const o=TA(a.id,r);if(!o)continue;const l=MX(a);for(const u of jae(o,mg()))i.set(u,l)}window.api?.recordingShortcut?.syncClaims(++e,[...i].map(([a,o])=>({chord:a,label:o})))};t();const n=et.subscribe((r,i)=>{r.shortcutBindings!==i.shortcutBindings&&t()}),s=LQ(t);return()=>{n(),s()}},[])}const Zlt=({action:e})=>{const t=r2(),n=wH(t,Qlt());Ge();const s=m.useId(),r=m.useRef(null),i=et(x=>x.shortcutBindings),a=i[e.id],o=et(x=>x.setShortcutBinding),l=et(x=>x.clearShortcutBinding),[u,d]=m.useState(!1),[f,p]=m.useState(null),g=m.useMemo(mg,[]),v=TA(e.id,i),b=MX(e);return c.jsxs("div",{"data-search-row":`keyboard.${e.id}`,"data-search-control":!0,className:"flex flex-col gap-1",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(cr,{htmlFor:s,className:"w-32 text-body-sm text-ink",children:b}),c.jsx(vs,{id:s,readOnly:!0,value:v===null?h("ui.settings.shortcuts.keyboard_shortcuts_section.no_shortcut"):z5(v,g),"aria-label":h("ui.settings.shortcuts.keyboard_shortcuts_section.label_press_the_keys_you_want",{label:String(b)}),"data-shortcut-action":e.id,ref:r,className:R("w-52",v===null?"text-body-sm":"font-mono text-body-sm"),onFocus:()=>d(!0),onBlur:()=>{d(!1),p(null)},onKeyDown:x=>{if(DE.has(x.key))return;if(U_.has(x.key)){d(!1),p(null);return}if(Em.has(x.key)||x.nativeEvent.isComposing)return;const _=i2({key:x.key,code:x.code,metaKey:x.metaKey,ctrlKey:x.ctrlKey,altKey:x.altKey,shiftKey:x.shiftKey}),w=q5(_,e.id,i,g,n);if(w!==null){x.preventDefault(),d(!0),p(w);return}if(_===v){d(!0),p(null);return}x.preventDefault(),d(!0),p(null),_===e.defaultChord?o(e.id,null,n):_!==null&&o(e.id,_,n)}}),v!==null&&c.jsx(ce,{variant:"secondary",size:"sm","aria-label":h("ui.settings.shortcuts.keyboard_shortcuts_section.clear_label_s_shortcut",{label:String(b)}),onClick:()=>{l(e.id),r.current?.focus()},children:h("ui.settings.shortcuts.keyboard_shortcuts_section.clear")}),a!==void 0&&c.jsx(ce,{variant:"secondary",size:"sm","aria-label":h("ui.settings.shortcuts.keyboard_shortcuts_section.reset_label_to_its_default",{label:String(b)}),onClick:()=>{o(e.id,null,n),r.current?.focus()},children:h("ui.settings.shortcuts.keyboard_shortcuts_section.reset")})]}),u&&c.jsx("span",{className:"text-meta text-ink-dim",children:h("ui.settings.shortcuts.keyboard_shortcuts_section.press_the_keys_you_want_esc_cancels")}),f!==null&&c.jsx("output",{className:"text-meta text-danger",children:f})]})},mpt=({sectionRef:e,focusKey:t})=>(Ge(),c.jsx(DX,{title:h("ui.settings.shortcuts.keyboard_shortcuts_section.keyboard_shortcuts"),icon:XU,description:h("ui.settings.shortcuts.keyboard_shortcuts_section.shortcut_capture_description"),sectionRef:e,searchSection:"keyboard",searchSectionLabel:h("ui.settings.navigation.settings_sidebar.keyboard_shortcuts"),children:c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsx("p",{"data-shortcut-note":"browser-scope",className:"max-w-2xl text-body-sm text-ink-muted",children:h("ui.settings.shortcuts.keyboard_shortcuts_section.browser_shortcuts_answer_only_while_the_browser_has_focus")}),c.jsx(Xlt,{focusKey:t}),c.jsx("h3",{className:"pt-1 text-body-sm font-medium text-ink",children:h("ui.settings.shortcuts.category.panels")}),c.jsx("div",{className:"flex flex-col gap-4",children:ky.map(n=>c.jsx(Zlt,{action:n},n.id))})]})}));async function ect(e){await nt({op:"settings.edit",key:yl,value:e.value}),Gae(e.queryClient)}async function OX(e){await ect(e),e.queryClient.setQueryData(G_.all,t=>t&&{...t,settings:t.settings.map(n=>n.key===yl?{...n,value:e.value,is_default:e.value===n.default}:n)});try{return await e.queryClient.fetchQuery({queryKey:G_.all,queryFn:()=>nt({op:"settings.list"}),staleTime:0,retry:!1}),"confirmed"}catch{return"readback-unknown"}}const vpt=({focus:e=!1,focusNonce:t})=>{Ge();const n=Rt(),s=Hn(),r=gt(s.data,"settings"),i=Rn({queryKey:G_.all,queryFn:()=>nt({op:"settings.list"}),enabled:r,retry:!1,refetchOnReconnect:!0}),a=i.data?.settings.find(I=>I.key===yl),[o,l]=m.useState(!1),[u,d]=m.useState(null),[f,p]=m.useState(!1),[g,v]=m.useState(!1),b=m.useRef(!1),x=m.useRef(null),_=m.useRef(!1),w=m.useRef(t);m.useEffect(()=>{t!==w.current&&(w.current=t,_.current=!1)},[t]),m.useEffect(()=>{if(!e){_.current=!1;return}!a||_.current||(x.current?.querySelector("[role=combobox]")?.focus(),_.current=!0)},[e,t,a]),m.useEffect(()=>{i.isSuccess&&!i.isFetching&&p(!1)},[i.isFetching,i.isSuccess]);const y=async I=>{if(!(!a||b.current||f||!a.choices.some(N=>N.value===I))){b.current=!0,l(!0),d(null),v(!1);try{const N=await OX({value:I,queryClient:n});p(N==="readback-unknown"),v(N==="confirmed")}catch(N){d({value:I,message:N instanceof Error?N.message:""})}finally{b.current=!1,l(!1)}}},S=async()=>{const[I,N]=await Promise.all([i.refetch(),s.refetch()]);!I.isError&&!N.isError&&p(!1)},C=!i.data&&i.error||!s.data&&s.error,E=s.data&&(!r||i.data&&!a),k=!C&&!E&&!a,F=s.data?.features?.i18n?s.data.language:void 0,A=typeof F=="string"&&F!==""?F:void 0;return c.jsx(DX,{title:h("ui.settings.language.dialog.title"),icon:QU,description:h("ui.settings.language.general.description"),children:c.jsxs("div",{ref:x,"data-setting-key":yl,"data-search-row":"general.language","data-search-control":!0,className:"flex flex-col gap-3","aria-busy":o,children:[k&&c.jsx("output",{className:"text-meta text-ink-dim",children:h("ui.settings.language.dialog.loading")}),E&&c.jsx("p",{className:"text-meta text-ink-dim",children:h("ui.settings.language.dialog.unavailable")}),a&&c.jsx(yH,{setting:{...n2(a),label:h("ui.settings.language.dialog.title")},value:String(a.value),onValueChange:I=>{y(I)},disabled:o||f,suppressEffectiveNote:!0}),c.jsx("output",{id:Hae(yl),"aria-live":"polite",className:"text-meta text-ink-dim",children:o?h("ui.settings.language.general.pending"):g?h("ui.settings.language.general.saved"):A?h(f||s.error?"ui.settings.language.general.last_known":"ui.settings.language.general.effective",{locale:Uae(A)?.name??A}):h("ui.settings.language.general.no_resolution")}),(C||u||f)&&c.jsx(Ar,{variant:"danger",children:c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("p",{role:"alert",children:u?h("ui.settings.language.general.write_error",{message:u.message}):f?h("ui.settings.language.general.readback_error"):h("ui.settings.language.dialog.unavailable")}),c.jsx(ce,{variant:"outline",size:"sm",disabled:o||i.isFetching||s.isFetching,onClick:()=>{u?y(u.value):S()},children:h("ui.settings.language.dialog.retry")})]})})]})})},tct=()=>{Ge();const e=C_(L=>L.open),t=C_(L=>L.closeLanguage),n=Rt(),s=Hn(),r=gt(s.data,"settings"),i=Rn({queryKey:G_.all,queryFn:()=>nt({op:"settings.list"}),enabled:e&&r,staleTime:1e4}),a=m.useRef(null),o=tH(),l=(i.data?.settings??[]).find(L=>L.key===yl),u=l?n2(l):void 0,[d,f]=m.useState(!1),[p,g]=m.useState(!1),[v,b]=m.useState(null),[x,_]=m.useState(!1),w=m.useRef(!1);m.useEffect(()=>{e&&(g(!1),b(null))},[e]);const y=String(u?.value??""),S=async L=>{if(!(!u||w.current||x||!u.choices.some(X=>X.value===L))){w.current=!0,f(!0),b(null),g(!1);try{const X=await OX({value:L,queryClient:n});_(X==="readback-unknown"),g(X==="confirmed")}catch(X){const J=X instanceof Error?X.message:"";b({value:L,message:J}),C_.getState().open||sn(h("ui.settings.language.general.write_error",{message:J}))}finally{w.current=!1,f(!1)}}},C=async()=>{const[L,X]=await Promise.all([i.refetch(),s.refetch()]);!L.isError&&!X.isError&&_(!1)},E=!!s.data,k=E&&!r,F=s.error&&!s.data?s.error:null,A=F??(i.data?null:i.error),I=!E&&!A,{sentence:N,remedy:P}=QZ(o??null,h("ui.settings.configuration.language_dialog.your_settings_could_not_be_loaded"),A),M=s.isFetching||i.isFetching,z=u?"combo":A?"retry":"none";return m.useEffect(()=>{!e||z==="none"||requestAnimationFrame(()=>{a.current?.querySelector(z==="combo"?'[role="combobox"]':"[data-language-retry]")?.focus()})},[e,z]),c.jsx(Hc,{open:e,onOpenChange:L=>!L&&t(),children:c.jsxs(Uc,{ref:a,onOpenAutoFocus:L=>L.preventDefault(),className:"max-w-[min(28rem,calc(100vw-4rem))] gap-4",children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx(Dl,{className:"text-title",children:h("ui.settings.language.dialog.title")}),c.jsx(cd,{className:"text-body-sm text-ink-muted",children:h("ui.settings.language.dialog.description")})]}),I?c.jsxs("div",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[c.jsx(Mn,{}),h("ui.settings.language.dialog.loading")]}):k?c.jsx(Ar,{variant:"warning",children:c.jsx("span",{children:h("ui.settings.language.dialog.unavailable")})}):A?c.jsx(Ar,{variant:"warning",children:c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("span",{children:N}),P&&c.jsx(ce,{variant:"secondary",size:"sm",className:"shrink-0","data-language-retry":"",onClick:()=>{F?s.refetch():i.refetch()},disabled:M,children:M?h("ui.settings.language.dialog.retrying"):h("ui.settings.language.dialog.retry")})]})}):i.isPending?c.jsxs("div",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[c.jsx(Mn,{}),h("ui.settings.language.dialog.loading")]}):u?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{id:lP(yl),className:"text-meta text-ink-dim",children:u.help}),c.jsx(yH,{setting:u,value:y,disabled:d||x,helpId:lP(yl),effectiveNoteId:Vae(yl,Wae),onValueChange:L=>{S(L)}})]}),v&&c.jsx(Ar,{variant:"danger",children:c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("p",{role:"alert",children:h("ui.settings.language.general.write_error",{message:v.message})}),c.jsx(ce,{variant:"outline",size:"sm",disabled:d||i.isFetching,onClick:()=>{S(v.value)},children:h("ui.settings.language.dialog.retry")})]})}),x&&c.jsx(Ar,{variant:"danger",children:c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("p",{role:"alert",children:h("ui.settings.language.general.readback_error")}),c.jsx(ce,{variant:"outline",size:"sm",disabled:d||i.isFetching||s.isFetching,onClick:()=>{C()},children:h("ui.settings.language.dialog.retry")})]})}),c.jsx("div",{className:"flex min-h-8 items-center justify-end",children:d?c.jsx("output",{"aria-live":"polite",className:"text-body-sm text-ink-muted",children:h("ui.settings.language.general.pending")}):p?c.jsxs("output",{"data-language-status":"","aria-live":"polite",className:"inline-flex items-center gap-1.5 text-body-sm text-ink",children:[c.jsx(Zs,{"aria-hidden":"true",className:"size-3.5"}),h("ui.settings.language.dialog.saved")]}):null})]}):c.jsx(Ar,{variant:"warning",children:c.jsx("span",{children:h("ui.settings.language.dialog.unavailable")})})]})})},a5=e=>{const t=qae(e.type),n=typeof e.percent=="number"?`, ${Math.round(e.percent)}%`:"";return h("ui.common.updates.update_foot_icon.in_progress",{subject:t,percent:n})},LX=e=>zae({type:e.type,version:e.offer.version}),nct=e=>{const t=e.map(s=>LX(s)),n=t.slice(1).reduce((s,r)=>h("ui.common.updates.update_foot_icon.subject_join",{left:s,right:`${r.charAt(0).toLowerCase()}${r.slice(1)}`}),t[0]);return h("ui.common.updates.update_foot_icon.available_show_the_update_notice",{joined:n})},sct=({surfaces:e,inflight:t,onShow:n,onDismiss:s})=>{if(Ge(),t===null&&e.length===0)return null;if(t!==null)return c.jsx(mt,{side:"top",collisionPadding:8,content:a5(t),children:c.jsx("output",{"data-update-foot-icon":"","data-update-foot-icon-state":"inflight","aria-label":a5(t),className:"flex size-8 shrink-0 items-center justify-center text-accent",children:c.jsx(ui,{className:"size-4 shrink-0 motion-safe:animate-spin","aria-hidden":"true"})})});const r=e.find(i=>(i.offer.summary??"").trim()!=="");return c.jsx(mt,{side:"top",collisionPadding:8,content:c.jsxs("div",{className:"flex max-w-64 flex-col gap-0.5",children:[e.map(i=>c.jsxs("span",{className:"truncate text-ink",children:[LX(i)," ",h("ui.common.updates.update_foot_icon.available")]},i.type)),r?c.jsx("span",{className:"truncate text-ink-muted",children:(r.offer.summary??"").trim()}):null,e.every(i=>i.offer.nonDisruptive===!0)?c.jsx("span",{className:"text-ink-muted",children:h("ui.common.updates.update_foot_icon.sessions_keep_running")}):null,c.jsx("span",{className:"whitespace-nowrap text-ink-muted",children:h("ui.common.updates.update_foot_icon.show_the_update_notice")})]}),children:c.jsx("button",{type:"button","data-update-foot-icon":"","data-update-foot-icon-state":"available","aria-label":nct(e),onClick:n,onKeyDown:i=>{i.key!=="Escape"||!s||(i.stopPropagation(),s())},className:R("flex size-8 shrink-0 items-center justify-center rounded-sm text-accent","transition-colors duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink"),children:c.jsx(qA,{className:"size-4 shrink-0","aria-hidden":"true"})})})},BX=()=>{const e=Er(g=>g.followed),t=Er(g=>g.running),n=Er(g=>g.offers),s=Er(g=>g.detailOpen),r=Er(g=>g.inflight),i=Er(g=>g.downloadPercent),a=Er(g=>g.openNotice),o=Er(g=>g.noticeOpen),l=Er(g=>g.dismissNotice),u=m.useMemo(()=>{const g={followed:e,running:t,offers:n,detailOpen:s};return n8.filter(v=>$ae(g,v)).map(v=>{const b=n[v];return b?{type:v,offer:b}:null}).filter(v=>v!==null)},[e,t,n,s]),d=m.useMemo(()=>r[kn.BACKEND]?{type:kn.BACKEND,percent:null}:r[kn.UI]?{type:kn.UI,percent:i[kn.UI]}:null,[r,i]),f=m.useCallback(()=>a(),[a]),p=m.useCallback(()=>l(),[l]);return c.jsx(sct,{surfaces:u,inflight:d,onShow:f,onDismiss:o?p:void 0})},jX="px-2",mA=new WeakMap,rct=64,ict=1024*1024,act=3e3;function oct(e){const t=mA.get(e);if(t)return t;const n=new Map;mA.set(e,n);let s=hp(e);return e2(e,()=>{const r=hp(e);if(r===s)return;s=r;const i=[...n.values()];n.clear();for(const a of i){a.url&&H_(a.url),a.url=void 0;for(const o of a.listeners)o()}}),n}function lct(e){if(e.size<rct)return!0;for(const[t,n]of e)if(!(n.listeners.size||n.promise))return n.url&&H_(n.url),e.delete(t),!0;return!1}const cct=BY;function bpt(e,t){const n=HX(t),s=uct(),r=e?HY(e):null,i=r?.src?.type==="endpoint"&&!s?null:r?.src,a=i?.type,o=i?.type==="account"?i.accountId:i?.type==="endpoint"?i.endpointId:void 0,l=i?.hash,u=m.useMemo(()=>a==="account"&&o&&l?{type:"account",accountId:o,hash:l}:a==="endpoint"&&o&&l?{type:"endpoint",endpointId:o,hash:l}:null,[a,o,l]);return UX(u,n)}function HX(e){return Kae(e,Yae())}function uct(){return lH("team_bridge_endpoint_avatar")}const dct=/^(?:acc_[A-Za-z0-9_-]{1,64}|[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12})$/,hct=/^[0-9a-f]{16}$/;function fct(e){const t=e?.id,n=e?.profile?.avatar;if(!t||!dct.test(t)||!n||!n.hash||!hct.test(n.hash)||n.source==="none")return null;if(e.avatar_url){const s=cct.exec(e.avatar_url);if(!s||s[1]!==t||s[2]!==n.hash)return null}return{accountId:t,hash:n.hash}}function pct(e,t){const n=_g(),s=e?.id,r=e?.profile?.avatar?.hash,i=e?.profile?.avatar?.source,a=e?.avatar_url,o=m.useMemo(()=>fct({id:s,avatar_url:a,profile:{avatar:{hash:r,source:i}}}),[s,r,i,a]);return gct(o&&o.accountId===n.accountId?o:null,t,{retryOnce:!0})}function gct(e,t,n={}){const s=HX(t),r=m.useMemo(()=>e?{type:"account",...e}:null,[e]);return UX(r,s,n)}function UX(e,t,n={}){const s=n.retryOnce===!0,r=Rt(),i=_g(),a=e?`${i.epoch}:${i.accountId??"none"}:${e.type}:${e.type==="account"?e.accountId:e.endpointId}:${e.hash}:${t}`:null,[,o]=m.useState(0),l=m.useRef(!0);if(m.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]),m.useEffect(()=>{if(!a||!e||!i.accountId)return;const u=oct(r),d=u.get(a),f=d??{failed:!1,listeners:new Set,retried:!1},p=i.epoch,g=i.accountId,v=()=>{f.failed=!1,f.promise=(e.type==="endpoint"?Jn.endpointAvatarBytes({expectedAccountId:g,endpointId:e.endpointId,hash:e.hash,size:t}):Jn.avatarBytes({expectedAccountId:g,accountId:e.accountId,hash:e.hash,size:t})).then(({data:w,mimeType:y})=>{if(u.get(a)!==f)return;const S=Kr(r);if(S.epoch!==p||S.accountId!==g){u.delete(a);return}if(!["image/png","image/jpeg"].includes(y)||w.byteLength===0||w.byteLength>ict)throw new Error("Invalid avatar bytes");f.url=z8(new Blob([w],{type:y}),y)}).catch(()=>{f.failed=!0}).finally(()=>{if(f.promise=void 0,u.get(a)===f)for(const w of f.listeners)w()})};if(!d){if(!lct(u))return;u.set(a,f),v()}let b=!1;const x=()=>{!s||!f.failed||f.promise||f.retried||(f.retried=!0,b=!0,f.retryTimer=setTimeout(()=>{if(f.retryTimer=void 0,b=!1,u.get(a)!==f||!f.failed)return;const w=Kr(r);w.epoch!==p||w.accountId!==g||v()},act))};u.delete(a),u.set(a,f);const _=()=>{x(),l.current&&o(w=>w+1)};return f.listeners.add(_),x(),()=>{f.listeners.delete(_),b&&f.retryTimer&&(clearTimeout(f.retryTimer),f.retryTimer=void 0,f.retried=!1)}},[i.accountId,i.epoch,a,r,s,t,e]),!(!a||!i.accountId))return mA.get(r)?.get(a)?.url}const gI=st.memo(({expanded:e,useAuth:t=!1})=>{const n=Iy(),s=Yr(),{user:r,isAuthenticated:i,accountRead:a,signOut:o}=Yy(),l=a==="checking"?h("ui.shell.user_profile_sidebar.checking_account"):cP(a)?h("ui.shell.user_profile_sidebar.account_unavailable"):null,u=r?.name??l??h("ui.shell.user_profile_sidebar.user"),d=cP(a),f=r?.email??"",p=d?h("ui.shell.user_profile_sidebar.reconnect_radient"):f,g=d?"/settings?section=providers&provider=radient":"/settings",v=d?h("ui.shell.user_profile_sidebar.reconnect_radient"):h("ui.shell.user_profile_sidebar.account_settings"),b=m.useCallback(async()=>{i&&(await o(),window.location.reload())},[i,o]),x=m.useMemo(()=>{const S=r?.name;return S?S.split(" ").map(C=>C.charAt(0)).join("").toUpperCase().substring(0,2):null},[r?.name]),_=pct(r?.radientUser.account,28),w=c.jsxs("button",{type:"button",onClick:t?void 0:()=>s(g),"aria-label":e?void 0:v,className:R("flex w-full min-w-0 items-center gap-2 rounded-sm transition-colors duration-fast ease-out-quart hover:bg-row-hover",e?"px-2 py-1.5":"justify-center py-1.5"),children:[c.jsxs(Z5,{className:"size-7 shrink-0 rounded-full bg-media-surface",children:[_&&c.jsx(Ay,{src:_,alt:"",className:"lo-avatar-arrival"}),c.jsx(Fy,{className:"rounded-full bg-media-surface text-ink-muted",children:x??c.jsx(sG,{size:14,"aria-hidden":"true"})})]}),e&&u&&c.jsxs("span",{className:"min-w-0 text-start",children:[c.jsx("span",{className:"block truncate text-body-sm text-ink",children:u}),p&&c.jsx("span",{className:R("block truncate text-meta",d?"text-accent":"text-ink-dim"),children:p})]})]}),y=e?w:c.jsx(Du,{content:v,side:n==="rtl"?"left":"right",children:w});return t?c.jsxs($o,{children:[e?c.jsx(ao,{asChild:!0,children:w}):c.jsx(Du,{content:v,side:n==="rtl"?"left":"right",children:c.jsx(ao,{asChild:!0,children:w})}),c.jsxs(zo,{align:"end",side:"top",className:"min-w-50",children:[d?c.jsxs(en,{onSelect:()=>s(g),children:[c.jsx(X5,{size:16,"aria-hidden":"true"}),h("ui.shell.user_profile_sidebar.reconnect_radient")]}):null,c.jsxs(en,{onSelect:()=>s("/settings"),children:[c.jsx(Mu,{size:16,"aria-hidden":"true"}),h("ui.shell.user_profile_sidebar.settings")]}),c.jsxs(en,{children:[c.jsx(dhe,{size:16,"aria-hidden":"true"}),h("ui.shell.user_profile_sidebar.privacy_and_security")]}),c.jsx(Mr,{}),c.jsxs(en,{onSelect:b,className:"text-danger focus:bg-danger-wash focus:text-danger",children:[c.jsx(Mde,{size:16,"aria-hidden":"true"}),h("ui.shell.user_profile_sidebar.sign_out")]})]})]}):y});gI.displayName="UserProfileSidebar";const GX=()=>{const e=Yr(),t=TG();return c.jsx(Du,{content:h("ui.shell.sidebar_navigation.settings"),side:"top",children:c.jsx("button",{type:"button","data-tour-tag":"nav-item-settings",onClick:()=>e("/settings"),"aria-current":t==="settings"?"page":void 0,"aria-label":h("ui.shell.sidebar_navigation.settings"),className:R("flex size-8 shrink-0 items-center justify-center rounded-sm text-ink-muted","transition-colors duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink",t==="settings"&&"text-ink"),children:c.jsx(Mu,{size:16,"aria-hidden":"true"})})})},VX=()=>c.jsxs("div",{className:R("flex min-h-10 shrink-0 items-center justify-between gap-1 pb-2",jX),children:[c.jsx(gI,{expanded:!0}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(BX,{}),c.jsx(GX,{})]})]});function WX(e){return Ie(t=>JZ(t.sessions,e))}const mct=[];function $X(){const{state:e}=oC(),t=e?.pendingConsent??mct,n=$G(s=>gO(t,s));return m.useEffect(()=>{t.length>0&&M2()},[t]),gO(t,n)}const zX={approvals:["desktop","mesh","approvals"]},vct=15e3,bct=new Set(["requested","approved","connecting","failed"]);function xct(e){return bct.has(e)}function _ct(e){return e==="requested"}function qX(e){return e.filter(t=>_ct(t.state)).length}function wct(e){return SN.test(e.requestDigest)&&SN.test(e.disclosureDigest)}function mI(e){return e.kind==="credential"&&e.typed!==void 0&&e.typed.action==="approve-credential"&&e.typed.operation!==null&&wct(e.typed)}function o5(e,{credentialApprovals:t=!1}={}){return e.state!=="requested"?!1:e.kind==="credential"?t&&mI(e)&&e.typed.signableHere&&e.typed.disclosure?.operation===e.typed.operation:e.canApproveHere!==!1&&(e.kind==="device"||e.kind==="machine")}function yct(e,{credentialApprovals:t=!1}={},n){return t&&mI(e)&&(e.state==="approved"||e.state==="failed")&&(n??e.typed.applyOutcome?.retryable===!0)}function xpt(e,t,n={},s){const r=e.approvalId;return t==="deny"?{op:"approvals.deny",approvalId:r}:e.kind==="device"||e.kind==="machine"?t==="approve"&&o5(e,n)?{op:"approvals.approve",approvalId:r}:null:!(t==="approve"?o5(e,n):yct(e,n,s))||!mI(e)||e.typed.operation===null?null:{op:t==="approve"?"approvals.approveCredential":"approvals.applyCredential",approvalId:r,operation:e.typed.operation,requestDigest:e.typed.requestDigest,disclosureDigest:e.typed.disclosureDigest}}function _pt(e){return xct(e)}function wpt(e){switch(e){case"requested":return h("ui.mesh.mesh_approvals.waiting_for_you");case"approved":return h("ui.mesh.mesh_approvals.approved");case"connecting":return h("ui.mesh.mesh_approvals.connecting");case"connected":return h("ui.mesh.mesh_approvals.connected");case"denied":return h("ui.mesh.mesh_approvals.denied");case"expired":return h("ui.mesh.mesh_approvals.expired");case"failed":return h("ui.mesh.mesh_approvals.failed");default:return e}}function Nr(e){return typeof e=="object"&&e!==null}function Cct(e){const t=Nr(e)?e:{};return{deviceId:Jt(t.device_id),name:Jt(t.name),host:Jt(t.host),user:Jt(t.user),transport:Jt(t.transport),hostKeyFp:Jt(t.host_key_fp)}}function l5(e){return typeof e=="string"?e:""}function KX(e){return eee.includes(e)?e:null}function Sct(e){if(!Nr(e))return null;const t=KX(e.operation);if(t===null)return null;const n=Nr(e.recipient)?e.recipient:{},s=Nr(e.grant_lifetime)?e.grant_lifetime:{},r=Nr(e.requires_capability)?e.requires_capability:{};return{operation:t,credentialKey:Jt(e.credential_key),provider:Jt(e.provider),account:Jt(e.account),org:Jt(e.org),scope:Jt(e.scope),recipient:{deviceId:Jt(n.device_id),name:Jt(n.name),keyFingerprint:Jt(n.key_fingerprint)},evidence:JSON.stringify(e,null,2),withdrawalCount:Array.isArray(e.withdrawals)?e.withdrawals.length:0,untilRevoked:s.kind==="until_revoked",futureLogins:e.future_logins!==!1,installsOrJoins:e.installs_or_joins!==!1,copiesCredential:typeof e.copies_credential=="boolean"?e.copies_credential:null,requiresCapability:Jt(r.name)}}function YX(e){return Nr(e)?{code:Jt(e.code),retryable:e.retryable===!0,reason:Jt(e.reason),remedy:Jt(e.remedy)}:null}function kct(e){if(Nr(e))return{action:Jt(e.action),operation:KX(e.operation),requestDigest:l5(e.request_digest),disclosureDigest:l5(e.disclosure_digest),disclosure:Sct(e.disclosure),assurance:Jt(e.assurance),unprovenHuman:e.unproven_human!==!1,signableHere:e.signable_here===!0,refusal:Jt(e.refusal),refusalMessage:Jt(e.refusal_message),applyOutcome:YX(e.apply_outcome),...Nr(e.upgrade)?{upgrade:{...e.upgrade}}:{}}}function Ect(e){const t=Nr(e)?e:{};return{connect:m1(t.connect,!1),install:m1(t.install,!1),anchor:Nr(t.anchor),networkId:Jt(t.network_id),role:Jt(t.role),unattended:m1(t.unattended,!1),grants:dE(t.grant)}}function Tct(e){const t=Array.isArray(e)?e:e?.approvals??[];if(!Array.isArray(t))return[];const n=[];for(const s of t){if(!Nr(s))continue;const r=Jt(s.approval_id),i=Jt(s.state);if(!r||!i)continue;const a=kct(s.typed_approval),o=Nr(s.what)&&(Object.prototype.hasOwnProperty.call(s.what,"credential_inheritance")||Object.prototype.hasOwnProperty.call(s.what,"credential_finite_share"))||a?.action==="approve-credential",l=Object.prototype.hasOwnProperty.call(s,"kind")?Jt(s.kind):void 0,u=o||l==="credential_inheritance"?"credential":l!==void 0&&!["device_onboard","local_authority"].includes(l)?"unknown":!Nr(s.device)&&Nr(s.machine)?"machine":"device",d=Nr(s.requested_by)?s.requested_by:{};n.push({approvalId:r,state:i,kind:u,summary:Jt(s.summary)||void 0,details:Array.isArray(s.details)&&s.details.every(f=>typeof f=="string")?s.details.slice():void 0,canApproveHere:Object.prototype.hasOwnProperty.call(s,"can_approve_here")?s.can_approve_here===!0:void 0,approveRemedy:Jt(s.approve_remedy)||void 0,where:Cct(u==="machine"?s.machine:s.device),what:Ect(s.what),requestedBy:{surface:Jt(d.surface),sessionId:Jt(d.session_id),deviceId:Jt(d.device_id)},expiresAt:ZZ(s.expires_at),...a&&u==="credential"?{typed:a}:{}})}return n}function Rct(e){return e.kind==="machine"?h("ui.mesh.mesh_approvals.this_machine"):F_({device_id:e.where.deviceId,name:e.where.name})}function ypt(e,t){if(e.kind==="credential"||e.kind==="unknown"||e.canApproveHere===!1){const r=vI(e);if(r)return r;if(e.summary)return e.summary;if(e.kind==="credential"||e.kind==="unknown")return c5(e)}const n=c5(e),s=Ict(e,t).map(r=>r.clause);return s.length?h("ui.mesh.mesh_approvals.approval_title_with_clauses",{head:n,clauses:Dct(s)}):h("ui.mesh.mesh_approvals.approval_title",{head:n})}function c5(e){return e.kind==="credential"?vI(e)||e.summary||h("ui.mesh.approval.credential_title"):e.kind==="unknown"?e.summary||h("ui.mesh.approval.unknown_title"):e.canApproveHere===!1&&e.summary?e.summary:e.kind==="machine"?h("ui.mesh.mesh_approvals.set_up_operator_authority_on_this_machine"):h("ui.mesh.mesh_approvals.onboard_subject",{subject:Rct(e)})}function Cpt(e){return e.summary?e.kind==="credential"?vI(e)===null:e.kind==="unknown"||e.canApproveHere===!1:!1}const Act={github:"GitHub",gitlab:"GitLab"};function u5(e){return Act[e.toLowerCase()]??e}function XX(e){const t=e.typed?.disclosure?.recipient;return F_({device_id:t?.deviceId??"",name:t?.name??""})}function vI(e){const t=e.kind==="credential"?e.typed?.disclosure:null;if(!t)return null;const n=XX(e);return t.operation==="credential_finite_share"?h("ui.mesh.approval.head_finite_share",{credential:u5(t.credentialKey),device:n}):h("ui.mesh.approval.head_inheritance",{provider:u5(t.provider),account:t.account,device:n})}function Fct(e){const t=e.kind==="credential"?e.typed?.disclosure:null;if(!t)return[];const n=XX(e),s=[];return t.operation==="credential_finite_share"?s.push(t.scope==="session"?h("ui.mesh.approval.scope_session",{device:n}):h("ui.mesh.approval.scope_device",{device:n})):(s.push(t.org?h("ui.mesh.approval.org_limited",{org:t.org}):h("ui.mesh.approval.org_any")),t.copiesCredential===!1&&s.push(h("ui.mesh.approval.not_copied",{device:n}))),t.untilRevoked&&s.push(h("ui.mesh.approval.until_revoked")),s.push(t.futureLogins?h("ui.mesh.approval.future_logins_covered"):h("ui.mesh.approval.future_logins_not_shared")),s.push(t.installsOrJoins?h("ui.mesh.approval.installs_something"):h("ui.mesh.approval.installs_nothing")),t.requiresCapability==="broker_credential"&&s.push(h("ui.mesh.approval.needs_broker",{device:n})),t.withdrawalCount>0&&s.push(h("ui.mesh.approval.undoes_withdrawals",{count:t.withdrawalCount,device:n})),s}function Dct(e){return e.length===1?e[0]:h("ui.mesh.mesh_approvals.join_clauses",{clauses:e.slice(0,-1).join(", "),last:e[e.length-1]})}function Spt(e){if(e.kind==="credential"||e.kind==="unknown")return null;const{user:t,host:n,transport:s,name:r}=e.where,i=[n?t?`${t}@${n}`:n:"",s?h("ui.mesh.mesh_approvals.via_transport",{transport:s}):"",r&&r!==n?`(${r})`:""].filter(Boolean);return i.length?i.join(" "):null}function kpt(e){return e.kind==="credential"||e.kind==="unknown"?null:e.where.hostKeyFp||null}function Ept(e){const{surface:t,sessionId:n}=e.requestedBy,s=[t||"",n?h("ui.mesh.mesh_approvals.session_suffix",{suffix:n.slice(-6)}):""].filter(Boolean);return s.length?h("ui.mesh.mesh_approvals.asked_by",{requester:s.join(" · ")}):null}function Ict(e,t){if(e.kind==="credential"||e.kind==="unknown")return[];const{connect:n,install:s,anchor:r,networkId:i,role:a,unattended:o,grants:l}=e.what,u=[];if(n&&u.push({term:"connect",clause:e.where.transport?h("ui.mesh.mesh_approvals.connect_over",{transport:e.where.transport}):h("ui.mesh.mesh_approvals.connect_to_it"),consequence:e.where.transport?h("ui.mesh.mesh_approvals.may_connect_over",{transport:e.where.transport}):h("ui.mesh.mesh_approvals.this_machine_may_connect_to_it")}),s&&u.push({term:"install",clause:e.kind==="machine"?h("ui.mesh.mesh_approvals.install_local_operator"):h("ui.mesh.mesh_approvals.install_local_operator_there"),consequence:e.kind==="machine"?h("ui.mesh.mesh_approvals.local_operator_is_installed_on_this_machine"):h("ui.mesh.mesh_approvals.local_operator_is_installed_on_it")}),r&&u.push({term:h("ui.mesh.mesh_approvals.install_operator_anchor"),clause:h("ui.mesh.mesh_approvals.check_approvals_signed_on_your_machines"),consequence:h("ui.mesh.mesh_approvals.that_device_can_check_approvals_signed_on")}),i){const d=t?.get(i),f=h("ui.mesh.mesh_approvals.join_network",{network:d||i,role:a||"?"});u.push({term:f,clause:f,consequence:h("ui.mesh.mesh_approvals.joins_network",{network:d||i,role:a||"?"})})}o&&u.push({term:h("ui.mesh.mesh_approvals.trust_unattended_sessions"),clause:h("ui.mesh.mesh_approvals.run_sessions_there_without_an_approval_prompt"),consequence:h("ui.mesh.mesh_approvals.sessions_you_start_on_that_device_run")});for(const d of Nct(l,o)){const f=Pct()[d];u.push({term:f?.term??h("ui.mesh.mesh_approvals.grant_capability",{grant:d}),clause:Mct()[d]??h("ui.mesh.mesh_approvals.use_capability",{grant:d}),consequence:f?.gloss??h("ui.mesh.mesh_approvals.may_use_capability",{grant:d})})}return u}function Nct(e,t){const n=new Set;for(const s of e){const r=String(s??"").trim();r&&(t&&r==="unattended"||n.add(r))}return[...n]}const Pct=()=>({unattended:{term:h("ui.mesh.mesh_approvals.trust_unattended_sessions"),gloss:h("ui.mesh.mesh_approvals.sessions_you_start_on_that_device_run")},broker_credential:{term:h("ui.mesh.mesh_approvals.borrow_logins_there"),gloss:h("ui.mesh.mesh_approvals.your_sessions_may_use_the_logins_stored")}}),Mct=()=>({list:h("ui.mesh.mesh_approvals.see_its_sessions"),view:h("ui.mesh.mesh_approvals.watch_a_session_there"),prompt:h("ui.mesh.mesh_approvals.send_prompts_to_a_session_there"),steer:h("ui.mesh.mesh_approvals.steer_a_running_turn_there"),stop:h("ui.mesh.mesh_approvals.stop_a_session_there"),slash:h("ui.mesh.mesh_approvals.run_slash_commands_there"),delete:h("ui.mesh.mesh_approvals.archive_or_delete_a_session_there"),move:h("ui.mesh.mesh_approvals.move_sessions_to_or_from_there"),broker_credential:h("ui.mesh.mesh_approvals.borrow_the_logins_stored_there"),approve:h("ui.mesh.mesh_approvals.answer_approval_prompts_there"),unattended:h("ui.mesh.mesh_approvals.run_sessions_there_without_an_approval_prompt")});function Tpt(e){return e.kind==="credential"&&e.typed!==void 0&&(e.state==="approved"||e.state==="failed")}function Rpt(e,t){return e.kind==="credential"&&(e.state==="approved"||e.state==="failed")&&(t??e.typed?.applyOutcome?.retryable)===!1}function Apt(e,t,n=!1){if(e===null||e<=t||e<=0)return null;const s=Math.ceil((e-t)/60),r=e-t<60?h("ui.mesh.approval.duration_under_minute"):s<90?h("ui.mesh.approval.duration_minutes",{count:s}):h("ui.mesh.approval.duration_hours",{count:Math.ceil(s/60)});return h(n?"ui.mesh.approval.expires_window":"ui.mesh.approval.answer_window",{duration:r})}function Fpt(e){const t=e.typed?.disclosure;if(!t)return"";const n=Fct(e),s=h("ui.mesh.approval.until_revoked"),r=h(t.futureLogins?"ui.mesh.approval.future_logins_covered":"ui.mesh.approval.future_logins_not_shared");return n.filter((i,a)=>a===0||i===s||i===r).join(" · ")}function QX(e,{poll:t=!0}={}){return Rn({queryKey:zX.approvals,enabled:e,queryFn:async()=>Tct(await nt({op:"approvals.list"})),retry:!1,staleTime:t?1e4:Number.POSITIVE_INFINITY,refetchInterval:e&&t?vct:!1,refetchOnWindowFocus:t})}function Oct(){return{retry:!1,mutationFn:async e=>{const t=await nt(e.request);if(e.request.op==="approvals.approveCredential"){const n=Lct(t);if(n)throw n}}}}function Dpt(){const e=Rt();return on({...Oct(),onSettled:()=>{e.invalidateQueries({queryKey:zX.approvals}),e.invalidateQueries({queryKey:Ic.networks}),e.invalidateQueries({queryKey:Ic.peers})}})}function Ipt(e){const t=e?.message;return typeof t=="string"&&t.trim()?t.trim():h("ui.mesh.mesh_approvals.the_approvals_could_not_be_read")}function Npt(e){const t=e,n=YX(t?.applyOutcome??(Nr(t?.detail)?t.detail.apply_outcome:void 0)),s=n?[n.reason,n.remedy].filter(Boolean).join(" "):"";return{code:n?.code||Jt(t?.code)||"approval_refused",sentence:s||Jt(t?.message)||h("ui.mesh.mesh_approvals.decision_could_not_be_answered"),retryable:n?n.retryable===!0:void 0}}function Lct(e){const t=Nr(e)?e.applied:void 0;return!Nr(t)||t.ok!==!1?null:{code:Jt(t.code),message:Jt(t.message),applyOutcome:t}}const Bct=/(\{request\}|\{reason\})/;function Ppt(e,t){return h("ui.mesh.approval.named_refusal",{request:"{request}",reason:"{reason}"}).split(Bct).filter(Boolean).map(n=>n==="{request}"?{kind:"request",text:e}:n==="{reason}"?{kind:"reason",text:t}:{kind:"literal",text:n})}function Mpt(e,t,n=!1){return e==="request"&&!n?t:"auto"}function Opt({document:e,target:t,refusalTarget:n,origin:s,allowFocus:r,sentence:i}){r&&(e.activeElement===e.body||e.activeElement===s)&&t?.focus({preventScroll:!0});const a=n!==null&&e.activeElement===n;return{focused:a,announcement:a?"":i}}function jct(){const e=Hn(),t=gt(e.data,"aida",1),n=Qh(t),s=t&&n.data?.enabled===!0,r=WX(n.data?.session_id),i=gt(e.data,"notifications",1),a=CH(i),o=$X(),l=uC(vr(e.data,"peers")==="enabled"),u=QX(l==="member"&&vr(e.data,"approvals")==="enabled",{poll:!0}),d=s?r:0,f=i?SH(a.data):0,p=l==="member"?qX(u.data??[]):0,g=[];return d>0&&g.push(h("ui.shell.sidebar_navigation.aida_missed",{name:n.data?.name??"Aida",count:d})),f>0&&g.push(h("ui.notifications.nav.unread",{count:f,countText:String(f)})),o>0&&g.push(h("ui.shell.sidebar_navigation.browser_waiting",{count:o,countText:String(o)})),p>0&&g.push(h("ui.shell.sidebar_navigation.mesh_waiting",{count:p,countText:String(p)})),{total:d+f+o+p,lines:g}}function Hct(e){const t=typeof e=="object"&&e!==null?e.idx:void 0;return typeof t=="number"&&t>0?"history":"/chat"}const Uct=()=>{Ge();const e=Yr(),t=Iy()==="rtl"?Oy:$U,[n,s]=m.useState(!1),{total:r,lines:i}=jct(),a=W_("back",Hoe.test(navigator.platform)),o=r>0?h("ui.teamBridge.leave.name_attention",{count:r}):h("ui.teamBridge.leave.name"),l=m.useCallback(()=>{Hct(window.history.state)==="history"?e(-1):e("/chat")},[e]);return m.useEffect(()=>{const u=f=>{FH(f)==="back"&&(f.preventDefault(),l())},d=f=>{DH(f)==="back"&&(f.preventDefault(),l())};return document.addEventListener("keydown",u),document.addEventListener("mouseup",d),()=>{document.removeEventListener("keydown",u),document.removeEventListener("mouseup",d)}},[l]),c.jsx("div",{"data-team-bridge-back-row":"",className:R("flex h-10 shrink-0 items-center",jX),children:c.jsx(Du,{content:c.jsxs("span",{className:"flex flex-col",children:[c.jsx("span",{children:c.jsx(Bo,{text:h("ui.teamBridge.leave.back_shortcut",{shortcut:Fi(a)})})}),i.map(u=>c.jsx("span",{children:u},u))]}),side:"bottom",align:"start",collisionPadding:8,suppressed:n,discardWhileSuppressed:!0,children:c.jsxs("button",{type:"button","data-team-bridge-back":"",onFocus:u=>{u.currentTarget.hasAttribute("data-focus-handoff")&&(u.currentTarget.removeAttribute("data-focus-handoff"),s(!0))},onBlur:()=>s(!1),onPointerEnter:()=>s(!1),onKeyDown:()=>s(!1),onClick:l,"aria-label":o,"aria-keyshortcuts":a,className:R("inline-flex h-8 items-center gap-1.5 rounded-sm px-2 text-body-sm font-medium text-ink-muted","transition-colors duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink"),children:[c.jsx(t,{size:16,"aria-hidden":"true"}),c.jsx("span",{children:h("ui.teamBridge.leave.back")}),c.jsx(ep,{count:r,"aria-hidden":"true",className:"ms-1"})]})})})},Gct=({children:e,inline:t})=>c.jsxs(Xae,{fallback:t,children:[c.jsx(Uct,{}),e,c.jsx(VX,{})]}),Vct=()=>(Ge(),c.jsxs(Gct,{inline:null,children:[c.jsx("h1",{className:"flex h-10 shrink-0 items-center px-4 text-body-sm font-semibold text-ink",children:h("ui.teamBridge.page.title")}),c.jsx("div",{className:"min-h-0 flex-1"})]})),Wct=140,$ct=/^\s*(```|~~~).*$/gm,zct=/^\s{0,3}#{1,6}\s+/gm,qct=/^\s{0,3}(>\s?)+/gm,Kct=/^\s*([-*+]|\d{1,9}[.)])\s+/gm,Yct=/^\[[ xX]\]\s+/gm,Xct=/^\s{0,3}([-*_])(\s*\1){2,}\s*$/gm,Qct=/!\[([^\]]*)\]\([^)]*\)/g,Jct=/\[([^\]]+)\]\([^)]*\)/g,Zct=/<((?:https?|mailto):[^>\s]+)>/gi,eut=/<\/?[A-Za-z][^>]*>/g,tut=/`+([^`]*)`+/g,nut=/(\*\*|__)(?=\S)([\s\S]*?\S)\1/g,sut=/~~(?=\S)([\s\S]*?\S)~~/g,rut=/(^|[^\w*])\*(?=\S)([^*]*?\S)\*(?!\w)/g,iut=/(^|[^\w])_(?=\S)([^_]*?\S)_(?!\w)/g;function aut(e,t=Wct){if(typeof e!="string"||e.trim().length===0)return null;const n=e.replace($ct," ").replace(Xct," ").replace(zct,"").replace(qct,"").replace(Kct,"").replace(Yct,"").replace(Qct,"$1").replace(Jct,"$1").replace(Zct,"$1").replace(eut,"").replace(tut,"$1").replace(nut,"$2").replace(sut,"$1").replace(rut,"$1$2").replace(iut,"$1$2"),s=Op(n,Number.MAX_SAFE_INTEGER);return s.length===0?null:ZY(s,t)}function out(e,t){const n=e.senderLabel?.trim()||e.conversationName?.trim()||t.untitled,s=e.place.kind==="dm"?t.directMessage:e.place.kind==="channel"?e.place.name?.trim()?t.channel(e.place.name.trim()):e.conversationName?.trim()??t.untitled:e.place.name?.trim()||e.conversationName?.trim()||t.group,r=e.organizationName?t.subtitle(s,e.organizationName):s,i=Math.max(1,Math.floor(e.unreadCount)),a=i>1?e.preview?t.countPreview(i,e.preview):t.count(i):e.preview??t.fallback;return{title:Op(n,Lv)||t.untitled,subtitle:Op(r,yrt)||t.untitled,body:Op(a,wrt)||t.fallback}}const ym=3e4,lut=10;function cut(e,t=lut){return[...e?.organizations??[]].filter(n=>n.eligible&&n.unread>0).sort((n,s)=>s.unread-n.unread||n.tenant_id.localeCompare(s.tenant_id)).slice(0,t)}function uut(e,t){return e.member===!0?!0:e.member===!1||!t?!1:e.members.some(n=>n.kind==="human"&&n.account_id===t&&n.state==="active")}function JX(e,t){return uut(e,t)&&oH(e)==="all"&&e.builtin!=="agents"}function dut(e,t,n){return{conversationName:ZA(e,t),organizationName:dH(e,n),senderLabel:JA(e.last_sender_label??"")}}function hut(e){const t=new Map(e.cursors),n=e.rows;if(!e.seeded){for(const a of n)t.set(a.conversation_id,a.latest_seq);return{candidates:[],cursors:t,seeded:!0}}const r=new Map(e.conversations.map(a=>[a.id,a])),i=[];for(const a of n){const o=t.get(a.conversation_id);if(a.unread_count===0||a.latest_seq<=a.last_read_seq||o!==void 0&&a.latest_seq<=o){(o===void 0||a.latest_seq>o)&&t.set(a.conversation_id,a.latest_seq);continue}const l=r.get(a.conversation_id);l!==void 0&&l.latest_seq===a.latest_seq&&(t.set(a.conversation_id,a.latest_seq),JX(l,e.selfAccountId)&&(e.quiet||i.push({conversationId:l.id,...l.last_thread_root_id?{threadId:l.last_thread_root_id}:{},tenantId:a.tenant_id,seq:a.latest_seq,...dut(l,e.selfAccountId,e.organizations),kind:l.kind,name:l.name?.trim()||null,unreadCount:a.unread_count})))}return{candidates:i,cursors:t,seeded:!0}}function bI(e,t,n,s){return e.getMutationCache().findAll({mutationKey:Bt.notifyMutation(t.accountId,t.epoch),exact:!0,status:"pending"}).some(r=>{const i=r.state.variables;return i?.conversationId===n&&(i.tenantId===void 0||i.tenantId===s)})}function fut(e,t,n,s,r){return new Promise(i=>{const a=()=>{l(),r.removeEventListener("abort",a),i()},o=()=>{(r.aborted||!bI(e,t,n,s))&&a()},l=e.getMutationCache().subscribe(o);r.addEventListener("abort",a,{once:!0}),o()})}function Lpt(e){const t=e.get("tenant"),n=e.get("conversation"),s=e.get("thread");return t&&n&&s?{tenantId:t,conversationId:n,rootId:s}:null}function ZX(e,t){if(e.root.id!==t.rootId||e.root.conversation_id!==t.conversationId||e.root.thread_root_id||e.replies.some(n=>n.conversation_id!==t.conversationId||n.thread_root_id!==t.rootId))throw new Error("Thread response identity mismatch");return e}async function Bpt(e,t,n,s){return ZX(await Jn.listReplies(e.conversationId,e.rootId,{tenantId:e.tenantId,accountId:t,afterSeq:n,...s?{limit:50,...s}:{}}),e)}function jpt(e,t,n){if(typeof IntersectionObserver>"u")return()=>{};const s=new Map(t.map(d=>[d.id,d.seq])),r=new Map,i=e.ownerDocument;let a=!0,o=-1;const l=()=>{if(!a||!e.isConnected||i.visibilityState!=="visible"||!i.hasFocus())return;const d=Math.max(-1,...r.values());d<=o||(o=d,n(d).catch(()=>{a&&o===d&&(o=-1)}))},u=new IntersectionObserver(d=>{if(a){for(const f of d){const p=f.target.dataset.messageId??"",g=s.get(p);g!==void 0&&f.isIntersecting&&f.intersectionRect.height>0?r.set(p,g):r.delete(p)}l()}},{root:e.querySelector("[data-radix-scroll-area-viewport]"),threshold:0});for(const d of e.querySelectorAll("[data-message-id]"))s.has(d.dataset.messageId??"")&&u.observe(d);return i.addEventListener("visibilitychange",l),i.defaultView?.addEventListener("focus",l),()=>{a=!1,u.disconnect(),i.removeEventListener("visibilitychange",l),i.defaultView?.removeEventListener("focus",l)}}let T_=null;function put(){return T_}function Hpt(e){m.useEffect(()=>{const t=e??null;return T_=t,()=>{T_===t&&(T_=null)}},[e])}const gut="display.notifications";function mut(){return{untitled:h("ui.teamBridge.list.untitled"),directMessage:h("ui.teamBridge.kind.dm"),group:h("ui.teamBridge.kind.group"),channel:e=>h("ui.teamBridge.notify.channel",{channel:e}),subtitle:(e,t)=>h("ui.teamBridge.notify.subtitle",{place:e,organization:t}),count:e=>h("ui.teamBridge.notify.count",{count:e}),countPreview:(e,t)=>h("ui.teamBridge.notify.count_preview",{count:e,preview:t}),fallback:h("ui.teamBridge.notify.body_fallback")}}function vut(e){return e.kind==="dm"?{kind:"dm"}:{kind:e.kind,name:e.name}}function but(e,t){return _st(e,t==="person_agent"?"agent":"human")}function vA(e,t){const n=HY(but(e,t)).src,s=n?.type==="account"?n:null,r=n?.type==="endpoint"?n:null;return Rrt({v:1,kind:t,account_id:e.account_id,display_name:Op(e.display_label,Lv),agent_name:Op(e.agent?.name??"",Lv),...s?{avatar:{account_id:s.accountId,hash:s.hash}}:{},...r?{endpoint_avatar:{endpoint_id:r.endpointId,hash:r.hash}}:{}})}function xut(e,t,n){return e.getQueryData(Bt.directory(t,n))?.members??[]}function _ut(e,t,n,s){const r=Bt.replies(t.tenantId,t.conversationId,n);e.setQueryData(r,i=>{const a=i?.pages.at(-1);return!i||!a||a.has_more||i.pages.some(o=>o.replies.some(l=>l.id===s.id))?i:{...i,pages:[...i.pages.slice(0,-1),{...a,replies:[...a.replies,s].sort((o,l)=>o.seq-l.seq)}]}})}function wut(e,t,n,s){return{...KD(e,t,n,s),staleTime:0}}async function yut(e,t,n,s,r){if(!s())return;let i=t.senderLabel,a,o=null,l;const u=Kr(e);if(u.accountId!==n)return;const d={accountId:n,epoch:u.epoch},f=t.threadId;try{let b;if(f)b=ZX(await Jn.listReplies(t.conversationId,f,{tenantId:t.tenantId,accountId:n,afterSeq:t.seq,limit:1}),{tenantId:t.tenantId,conversationId:t.conversationId,rootId:f}).replies.find(x=>x.seq===t.seq),b&&s()&&_ut(e,t,f,b);else{const x=()=>e.fetchQuery(wut(e,t.conversationId,t.tenantId,n));b=(await x().catch(w=>{if(!tee(w))throw w;return x()})).messages.reduce((w,y)=>w===void 0||y.seq>w.seq?y:w,void 0)}if(b&&b.seq>=t.seq){if(f||(l=b.id),b.sender.kind==="human"&&b.sender.account_id===n||!s())return;const x=xut(e,t.tenantId,n);i=Jae(b.sender,x,{named:(w,y)=>h("ui.teamBridge.chief.label",{agent:w,person:y}),unnamed:w=>h("ui.teamBridge.chief.unnamed",{person:w})});const _=x.find(w=>w.account_id===b.sender.account_id);_&&(b.sender.kind==="human"||b.sender.kind==="agent")&&(a=vA(_,b.sender.kind==="human"?"person":"person_agent")),o=aut(b.body)}}catch{}const p=window.api?.desktop?.teamBridge;if(!p)return;const g=out({senderLabel:i,conversationName:t.conversationName,place:vut(t),organizationName:t.organizationName,preview:o,unreadCount:t.unreadCount},mut());for(;bI(e,d,t.conversationId,t.tenantId);)if(await fut(e,d,t.conversationId,t.tenantId,r),r.aborted||!s())return;if(r.aborted||!s())return;const v=e.getQueryData(Bt.conversations(Dc,n))?.conversations.find(b=>b.id===t.conversationId&&b.tenant_id===t.tenantId);!v||!JX(v,n)||await p.notify({owner:{accountId:n,epoch:d.epoch},conversationId:t.conversationId,...f?{threadId:f}:{},...l?{messageId:l}:{},tenantId:t.tenantId,...a?{sender:a}:{},seq:t.seq,title:g.title,subtitle:g.subtitle,body:g.body,viewing:put()===t.conversationId}).catch(()=>{})}function Cut(e,t,n,s,r){fst(e,t,n,s);for(const i of s){const a=`${n}\0${i.conversation_id}`,o=r.get(a);if(r.set(a,i.latest_seq),o===void 0||i.latest_seq<=o)continue;const l=KD(e,i.conversation_id,n,t);e.getQueryState(l.queryKey)?.data!==void 0&&e.fetchQuery({...l,staleTime:0}).catch(()=>{})}}function Sut(e){const t=!!window.api?.desktop?.teamBridge,n=$C(),s=YD(e&&t),r=n.accountId,a=e&&t&&!!r&&s.data?.account_id===r&&s.data?.state==="ready"&&s.data.local.enabled&&!s.data.read_only,o=Rt(),l=$oe({filters:{mutationKey:Bt.notifyMutation(r,n.epoch),exact:!0,status:"pending"},select:U=>U.mutationId});m.useLayoutEffect(()=>{const U=window.api?.desktop?.teamBridge;if(!U?.setAuthority)return;const G=()=>{U.setAuthority({...Kr(o),settling:t2(o)}).catch(()=>{})},K=e2(o,G);return G(),K},[o]);const u=jD({enabled:a}),d=Hn(),f=gt(d.data,"settings"),p=Rn({...u8(),enabled:a&&f}),g=f&&Qae(p.data?.settings,gut)===!1,v=m.useRef(g);v.current=g;const b=m.useRef(r);b.current=r;const x=m.useRef(a);x.current=a;const _=m.useRef(new AbortController);m.useEffect(()=>{const U=new AbortController;return _.current=U,(!a||g||n.token!==hp(o))&&U.abort(),()=>U.abort()},[a,g,n.token,o]),m.useEffect(()=>(x.current=a,()=>{x.current=!1}),[a]);const w=u.data,y=YY(a,Dc,{accountId:r,refetchInterval:ym,refetchIntervalInBackground:!0}),S=m.useMemo(()=>cut(y.data),[y.data]),C=IH({queries:S.map(U=>{const G=AE(U.tenant_id);return{queryKey:Bt.unread(G,r??"unresolved-owner"),queryFn:()=>Bc(o,r,()=>Jn.unread({tenantId:G})),enabled:a,staleTime:ym,refetchInterval:ym,refetchIntervalInBackground:!0,refetchOnWindowFocus:!0,retry:1}})}),E=C.map(U=>`${U.status}:${U.dataUpdatedAt}`).join("|"),k=m.useRef(C);k.current=C;const F=m.useRef(S);F.current=S;const I=KY(S.map(U=>AE(U.tenant_id)),a,r).members,N={};for(const[U,G]of Object.entries(I))N[U]=G.filter(K=>K.account_id!==r).flatMap(K=>[vA(K,"person"),...K.agent?.name?[vA(K,"person_agent")]:[]]).filter(K=>K!==void 0);const P=JSON.stringify(N),M=m.useRef(N);M.current=N;const z=m.useRef(null),L=m.useRef(new Set),X=Rn({queryKey:Bt.conversations(Dc,r??"unresolved-owner"),queryFn:()=>Bc(o,r,()=>Jn.listConversations("account")),enabled:a,staleTime:ym,refetchInterval:ym,refetchIntervalInBackground:!0,refetchOnWindowFocus:!0,retry:1}),J=m.useRef(new Map),re=m.useRef(new Map),q=m.useRef(new Set),ee=m.useRef(void 0),oe=m.useRef(null),B=[a,g,l.join(","),E,y.dataUpdatedAt,X.dataUpdatedAt,(w?.memberships??[]).map(U=>`${U.tenant_id}:${U.tenant_name}`).join(","),r??""].join("#");m.useEffect(()=>{if(z.current===P)return;z.current=P;const U=window.api?.desktop?.teamBridge;if(!U?.syncDirectory)return;const G=M.current;for(const K of L.current)K in G||U.syncDirectory({tenantId:K,members:[]}).catch(()=>{});L.current=new Set(Object.keys(G));for(const[K,ne]of Object.entries(G))U.syncDirectory({tenantId:K,members:ne}).catch(()=>{})},[P]),m.useEffect(()=>{const U=ee.current;ee.current=r,U!==r&&U!==void 0&&(J.current=new Map,re.current=new Map,q.current=new Set,oe.current=null,o.invalidateQueries({queryKey:Bt.unreadPrefix}),o.invalidateQueries({queryKey:Bt.conversationsPrefix}))},[r,o]),m.useEffect(()=>{if(oe.current===B||(oe.current=B,!y.data))return;for(const he of y.data.organizations??[])he.unread===0&&!q.current.has(he.tenant_id)&&q.current.add(he.tenant_id);if(!X.data)return;const U=k.current,G=F.current,K=hH(w?.memberships??[],y.data.organizations,y.data.organizations??null);let ne=J.current;for(let he=0;he<G.length;he+=1){const te=G[he],Te=U[he]?.data;if(!Te)continue;const Z=(Te.conversations??[]).map(Se=>({conversation_id:Se.conversation_id,tenant_id:te.tenant_id,unread_count:Se.unread_count,last_read_seq:Se.last_read_seq,latest_seq:Se.latest_seq}));r&&Cut(o,r,te.tenant_id,Te.conversations??[],re.current);const ge=q.current.has(te.tenant_id),W=Kr(o),ye=Z.filter(Se=>!ge||!x.current||v.current||!W.accountId||W.accountId!==r?!0:!bI(o,{accountId:W.accountId,epoch:W.epoch},Se.conversation_id,Se.tenant_id)),De=hut({conversations:X.data.conversations,rows:ye,organizations:K,selfAccountId:r,cursors:ne,seeded:ge,quiet:!a||g});if(ne=De.cursors,De.seeded&&q.current.add(te.tenant_id),!a||g||!r)continue;const Ne=r,pe=hp(o),ve=IY(o,Ne);for(const Se of De.candidates)yut(o,Se,Ne,()=>b.current===Ne&&hp(o)===pe&&ve()&&x.current&&!v.current&&Lc(o,Ne),_.current.signal)}J.current=ne},[B,a,g,y.data,X.data,w,r,o])}function kut(){const{data:e}=Hn();m.useEffect(()=>{e&&BQ(e)},[e]);const t=KA(),n=Rt(),s=m.useRef(null);m.useEffect(()=>{const r=t.configChange;if(!r)return;const i=`${r.epoch}:${r.seq}`;s.current!==i&&r.changedKeys.includes(yl)&&(s.current=i,n.invalidateQueries({queryKey:Wo.capabilities}),n.invalidateQueries({queryKey:Wo.settings}),!Zae()&&xa(h("ui.settings.language.external_notice",{language:r.language}),{id:"i18n-language-external"}))},[t.configChange,n])}function Eut(e,t){if(e.defaultPrevented||e.repeat||e.isComposing||!(e.metaKey||e.ctrlKey))return null;const n=i2(e);if(n===null)return null;const s=nee(t.bindings).get(n);return s===void 0||kA(e.target)||!_ve(eQ(s),t.route)?null:s}const eQ=e=>e.slice(6);function Tut(e){const t=Ie.getState(),n=t.activeDraftKey?t.drafts[t.activeDraftKey]:void 0,s=zv(t.activeDraftKey,n?.sessionId,t.activeSessionId)??null;Jd(eQ(e),{sessionId:s,askScope:s===null?"fleet":"session",via:"chord"})}function Rut(){m.useEffect(()=>{const e=t=>{const n=et.getState(),s=Eut(t,{bindings:n.shortcutBindings,route:n.rightSlotRoute});s!==null&&(t.preventDefault(),Tut(s))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[])}function Aut(e,t){const n=_g(),s=m.useRef(!1);m.useEffect(()=>{s.current||!e||!n.accountId||window.__loDevDriver?.armed!==!0||window.__loDevDriver.startupScene!=="team-bridge-owner-audit"||(s.current=!0,t("/team-bridge"))},[e,n.accountId,t])}const Fut=""+new URL("radient-icon-1024x1024-D_JJedvo.png",import.meta.url).href,tQ=fg()(A5(e=>({hasBeenNotified:!1,setHasBeenNotified:t=>{e({hasBeenNotified:t})}}),{name:"low-credits-storage"})),Dut=({open:e,onClose:t,onGoToConsole:n})=>{Ge();const{setHasBeenNotified:s}=tQ(),{prices:r,isLoading:i,error:a}=eoe(),o=d=>typeof d!="number"?"$...":h("ui.common.account.low_credits_dialog.detail",{detail:String(d.toFixed(2))}),l=()=>{s(!0),t()},u=()=>{s(!0),n()};return c.jsx(Gc,{open:e,onClose:l,title:c.jsxs(c.Fragment,{children:[c.jsx("img",{src:Fut,alt:h("ui.common.account.low_credits_dialog.radient_icon"),className:"size-7"}),h("ui.common.account.low_credits_dialog.running_low_on_radient_credits")]}),maxWidth:"sm",fullWidth:!1,actions:c.jsxs(c.Fragment,{children:[c.jsx(Yv,{onClick:l,children:h("ui.common.account.low_credits_dialog.maybe_later")}),c.jsx(Xv,{onClick:u,startIcon:c.jsx(Iu,{size:18}),className:"min-w-55",children:h("ui.common.account.low_credits_dialog.get_more_credits")})]}),children:c.jsxs("div",{className:"flex flex-col items-center gap-4 py-2 text-center",children:[c.jsxs("p",{className:"text-body-sm text-ink-muted",children:[h("ui.common.account.low_credits_dialog.unlock_the_full_power_of_local_operator_with")," ",c.jsx("span",{className:"font-bold text-accent",children:h("ui.common.account.low_credits_dialog.radient_pass")}),"."]}),c.jsx("p",{className:"text-body-sm text-ink-muted",children:h("ui.common.account.low_credits_dialog.radient_automatic_is_often_cheaper_than_bringing_your_own_key_its")}),c.jsx("p",{className:"text-body-sm text-ink-muted",children:h("ui.common.account.low_credits_dialog.it_s_pay_as_you_go_with_no_commitments_load_up_what_you_need_star")}),c.jsxs("p",{className:"text-body-sm text-ink-muted",children:[h("ui.common.account.low_credits_dialog.plus_get")," ",c.jsx("span",{className:"font-medium text-ink",children:i?c.jsx(Mn,{size:"sm",className:"me-0.5 align-middle"}):o(r?.default_registration_credits)})," ",h("ui.common.account.low_credits_dialog.in_bonus_credits_with_your_first_purchase"),a&&c.jsx("span",{className:"mt-1 block text-meta text-danger",children:h("ui.common.account.low_credits_dialog.could_not_load_bonus_credit_information")})]}),c.jsx("p",{className:"text-meta text-ink-dim",children:h("ui.common.account.low_credits_dialog.you_can_also_reach_the_radient_console_from_settings_at_any_time")})]})})},Iut=(e,t)=>t?e.some(n=>n.session_id===t&&n.status?.code==="busy"):!1;function Nut(e){return Ie(t=>Iut(t.sessions,e))}const bA={aida:"visible",notifications:"visible",library:"visible",projects:"visible",agents:"visible",schedules:"more",browser:"visible","team-bridge":"more","agent-hub":"more",mesh:"more"},xy=["aida","notifications","library","projects","agents","schedules","browser","team-bridge","agent-hub","mesh"],_y={visible:xy.filter(e=>bA[e]==="visible"),more:xy.filter(e=>bA[e]==="more")},d5=new Map(xy.map((e,t)=>[e,t])),Put=new Map([["notifications","notifications"]]);function Mut(e,t){const n=s=>{const r=Put.get(s);return r===void 0||t(r)};return{visible:e.visible.filter(n),more:e.more.filter(n)}}const Out=new Set(see);function Lut(e){return typeof e=="string"&&Out.has(e)}function aE(e,t){if(e===t)return!0;if(e.visible.length!==t.visible.length||e.more.length!==t.more.length)return!1;for(let n=0;n<e.visible.length;n+=1)if(e.visible[n]!==t.visible[n])return!1;for(let n=0;n<e.more.length;n+=1)if(e.more[n]!==t.more[n])return!1;return!0}function Ao(e,t){return e.visible.includes(t)?"visible":"more"}function R_(e,t,n){return e[t].filter(s=>n.has(s))}function But(e,t,n,s){if(!s.has(t))return null;const r=Ao(e,t),i=R_(e,r,s),a=i.indexOf(t);if(a<0)return null;const o=a+n;if(o<0||o>=i.length)return null;const l=i[o],u=e[r],d=u.indexOf(t),f=u.indexOf(l);if(d<0||f<0)return null;const p=u.slice();p[d]=l,p[f]=t;const g={visible:e.visible.slice(),more:e.more.slice()};return g[r]=p,g}function h5(e,t,n){const s={visible:e.visible.filter(r=>r!==t),more:e.more.filter(r=>r!==t)};return{...s,[n]:[...s[n],t]}}function jut(e,t,n,s,r){if(s===t)return{visible:e.visible.slice(),more:e.more.slice()};if(s!==null&&(!r.has(s)||!e[n].includes(s)))return null;const i={visible:e.visible.filter(l=>l!==t),more:e.more.filter(l=>l!==t)},a=i[n].slice(),o=s===null?a.length:a.indexOf(s);return o<0?null:(a.splice(o,0,t),{...i,[n]:a})}function f5(e,t){for(const n of xy){if(bA[n]!==t||e.visible.includes(n)||e.more.includes(n))continue;const s=d5.get(n)??0,r=e[t];let i=-1,a=-1,o=-1,l=Number.POSITIVE_INFINITY;for(let d=0;d<r.length;d+=1){const f=d5.get(r[d])??0;f<s&&f>a&&(a=f,i=d),f>s&&f<l&&(l=f,o=d)}const u=i>=0?i+1:o>=0?o:r.length;r.splice(u,0,n)}}function xA(e){const t={visible:[],more:[]},n=new Set;if(e&&typeof e=="object"){const s=e;for(const r of["visible","more"]){const i=s[r];if(Array.isArray(i))for(const a of i)Lut(a)&&(n.has(a)||(n.add(a),t[r].push(a)))}}return f5(t,"visible"),f5(t,"more"),t}function Hut(e){return e.reduce((t,n)=>{const s=n.attention??0;return Number.isFinite(s)&&s>0?t+s:t},0)}const Hf={layout:["desktop","sidebar_layout"]};async function Uut(){const e=await nt({op:"sidebar_layout.get"});return xA(e.layout)}function Gut(e,t=()=>!1){const n=Rt(),s=Rn({queryKey:Hf.layout,enabled:e,queryFn:Uut,staleTime:Number.POSITIVE_INFINITY,retry:Vv}),r=m.useRef(0),i=on({scope:{id:"sidebar-layout"},mutationFn:async d=>{const f=await nt({op:"sidebar_layout.set",layout:Mut(d,t)});return xA(f.layout)},retry:ree,onMutate:async d=>{const f=++r.current;await n.cancelQueries({queryKey:Hf.layout});const p=n.getQueryData(Hf.layout);return n.setQueryData(Hf.layout,d),{previous:p,seq:f}},onError:(d,f,p)=>{p?.seq===r.current&&p.previous&&n.setQueryData(Hf.layout,p.previous),sn(h("ui.shell.sidebar_navigation.save_failed"))},onSettled:(d,f,p,g)=>{g?.seq===r.current&&n.invalidateQueries({queryKey:Hf.layout})}}),a=e&&s.data!==void 0;return{layout:a?s.data:_y,canCustomise:a,save:d=>{a&&i.mutate(d)},reset:()=>{a&&i.mutate(xA(_y))}}}const p5=({expanded:e})=>(Ge(),c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(h8,{className:"size-6",label:e?void 0:h("ui.shell.collapsible_app_logo.local_operator")}),e&&c.jsx("span",{className:"truncate font-semibold text-body text-ink",children:h("ui.shell.collapsible_app_logo.local_operator")})]})),nQ=()=>{const e=KA(),t=Hn(),n=Ie(u=>u.setCataloguePageable),s=Ie(u=>u.setCatalogueActivityHead),r=Ie(u=>u.fetchSessions),i=gt(t.data,"session_catalogue_page"),a=gt(t.data,"session_catalogue_sort");m.useEffect(()=>{n(i)},[i,n]),m.useEffect(()=>{s(a)},[a,s]);const o=vr(t.data,"session_catalogue",2)==="enabled",l=m.useCallback(()=>r(i?H5:Cy,i),[r,i]);return m.useEffect(()=>{o&&l()},[o,l,e.catalogueRevision]),null},g5="flex h-[30px] w-full items-center gap-2 rounded-md px-2 text-body-sm transition-colors duration-fast ease-out-quart",Vut=()=>{Ge();const e=Iy()==="rtl",t=Yr(),n=TG(),{expanded:s,onCollapse:r}=toe(),i=et(se=>se.openCommandPalette),a=Hn(),o=vrt(gt(a.data,"team_bridge_conversations")),l=Ie(se=>se.activeSessionId),u=$X(),d=vr(a.data,"peers")==="enabled",f=uC(d),p=vr(a.data,"approvals")==="enabled",g=QX(f==="member"&&p,{poll:!0}),v=qX(g.data??[]),b=gt(a.data,"projects",1),x=gt(a.data,"library",1),_=gt(a.data,"notifications",1),w=CH(_),y=_?SH(w.data):0,S=et(se=>se.sidebarOverflowExpanded),C=et(se=>se.setSidebarOverflowExpanded),E=gt(a.data,"aida",1),k=Qh(E),F=E&&k.data?.enabled===!0,A=k.data?.name??"Aida",I=Tge(),N=WX(k.data?.session_id),P=Nut(k.data?.session_id),M=()=>{I(t,k.data).catch(se=>sn($f(se)))},z=new Map;F&&z.set("aida",{icon:noe,label:A,path:"/chat",isActive:n==="chat"&&!!k.data?.session_id&&l===k.data?.session_id,tourTag:"nav-item-aida",onSelect:M,attention:N,attentionTag:"nav-aida-badge",attentionName:se=>h("ui.shell.sidebar_navigation.aida_missed",{name:A,count:se}),working:P,workingName:h("ui.shell.sidebar_navigation.aida_working",{name:A})}),_&&z.set("notifications",{icon:Fue,label:h("ui.notifications.nav.label"),path:"/notifications",isActive:n==="notifications",tourTag:"nav-item-notifications",attention:y,attentionTag:"nav-notifications-badge",attentionName:se=>h("ui.notifications.nav.unread",{count:se,countText:String(se)})}),x&&z.set("library",{icon:Cde,label:h("ui.library.page.title"),path:"/library",isActive:n==="library",tourTag:"nav-item-library"}),b&&z.set("projects",{icon:YU,label:h("ui.shell.sidebar_navigation.projects"),path:"/projects",isActive:n==="projects",tourTag:"nav-item-projects"}),z.set("agents",{icon:Il,label:h("ui.shell.sidebar_navigation.agents"),path:"/agents",isActive:n==="agents",tourTag:"nav-item-agents"}),z.set("schedules",{icon:qU,label:h("ui.shell.sidebar_navigation.schedules"),path:"/schedules",isActive:n==="schedules",tourTag:"nav-item-schedules"}),z.set("browser",{icon:Ju,label:h("ui.shell.sidebar_navigation.browser"),path:"/browser",isActive:n==="browser",tourTag:"nav-item-browser",attention:u,attentionTag:"nav-browser-badge",attentionName:se=>h("ui.shell.sidebar_navigation.browser_waiting",{count:se,countText:String(se)})}),o&&z.set("team-bridge",{...o,isActive:n==="team-bridge"}),z.set("agent-hub",{icon:nG,label:h("ui.shell.sidebar_navigation.agent_hub"),path:"/agent-hub",isActive:n==="agent-hub",tourTag:"nav-item-agent-hub"}),f==="member"&&z.set("mesh",{icon:fH,label:h("ui.shell.sidebar_navigation.mesh"),path:"/mesh",isActive:n==="mesh",tourTag:"nav-item-mesh",attention:v,attentionTag:"nav-mesh-badge",attentionName:se=>h("ui.shell.sidebar_navigation.mesh_waiting",{count:se,countText:String(se)})});const L=new Set(z.keys()),X=gt(a.data,"sidebar_layout",1),{layout:J,canCustomise:re,save:q,reset:ee}=Gut(X,se=>gt(a.data,se,1)),oe=re?J:_y,B=R_(oe,"visible",L),U=R_(oe,"more",L),[G,K]=m.useState(!1),ne=S||G||U.some(se=>z.get(se)?.isActive),[he,te]=m.useState(""),[Te,Z]=m.useState(null),ge=m.useRef(new Map),W=se=>{requestAnimationFrame(()=>ge.current.get(se)?.focus())},[ye,De]=m.useState(null),[Ne,pe]=m.useState(null),ve=m.useRef(null),Se=m.useRef(null),Ce=m.useRef(null),fe=m.useRef(0),Be=m.useRef(0),ae=m.useRef(null),$e=m.useRef(null),Xe=m.useRef(!1),ue=se=>{const le=ve.current;return le===null?[]:Array.from(le.querySelectorAll("[data-sidebar-row]")).filter(we=>we.dataset.sidebarRow!==se).map(we=>{const Ee=we.getBoundingClientRect();return{id:we.dataset.sidebarRow??"",top:Ee.top,bottom:Ee.bottom}})},Me=(se,le)=>{const we=ve.current;if(we===null)return null;const Ee=we.getBoundingClientRect(),We=ue(le),ke=ot=>We.filter(jt=>Ao(oe,jt.id)===ot);let Ye=null;if(se.kind==="more"){const ot=ke("more").at(-1);if(ot)Ye=ot.bottom;else{const jt=we.querySelector("[data-sidebar-more]");Ye=jt?jt.getBoundingClientRect().bottom:Ee.top+2}}else if(se.kind==="band"){const ot=Ao(oe,le),Gt=ke(ot==="more"?"visible":"more").at(-1);if(Gt)Ye=Gt.bottom;else if(ot==="more"){const tn=we.querySelector("[data-sidebar-more]");Ye=tn?tn.getBoundingClientRect().top:Ee.top+2}}else{const ot=We[se.slot];ot?Ye=ot.top:Ye=We.at(-1)?.bottom??Ee.top+2}return Ye===null?null:Math.round(Ye-Ee.top+we.scrollTop)},Pe=()=>{$e.current!==null&&(window.clearTimeout($e.current),$e.current=null)},je=(se,le)=>{const we=Se.current;if(we===null||!we.armed)return;const Ee=document.elementFromPoint(se,le),We=!!Ee?.closest("[data-sidebar-more]"),ke=!!Ee?.closest("[data-sidebar-drop-band]");let Ye;if(We)Ye={kind:"more"},Ao(oe,we.id)==="visible"&&!ne&&$e.current===null&&($e.current=window.setTimeout(()=>{$e.current=null,K(!0),requestAnimationFrame(()=>at.current(fe.current,Be.current))},400));else if(Pe(),ke)Ye={kind:"band"};else{const ot=ue(we.id),jt=VK(ot,we.id,le),Gt=ot[jt];let tn="visible";if(Gt)tn=Ao(oe,Gt.id);else{const os=ot.at(-1);tn=os?Ao(oe,os.id):"visible"}Ye={kind:"slot",slot:jt,beforeId:Gt?.id??null,region:tn}}Ce.current=Ye,pe(Me(Ye,we.id))},at=m.useRef(je);at.current=je;const bt=()=>{ae.current!==null&&(cancelAnimationFrame(ae.current),ae.current=null)},At=()=>{ae.current=null;const se=Se.current,le=ve.current;if(se===null||!se.armed||le===null)return;const we=le.getBoundingClientRect(),Ee=Be.current,We=le.scrollHeight-le.clientHeight;let ke=0;Ee-we.top<24&&le.scrollTop>0?ke=-1:we.bottom-Ee<24&&le.scrollTop<We&&(ke=1),ke!==0&&(le.scrollTop+=ke*8,at.current(fe.current,Ee)),ae.current=requestAnimationFrame(At)},ln=(se,le)=>{if(re&&le.button===0&&!(le.altKey||le.ctrlKey||le.metaKey||le.shiftKey)){try{le.currentTarget.setPointerCapture(le.pointerId)}catch{}Se.current={pointerId:le.pointerId,id:se,armed:!1,startX:le.clientX,startY:le.clientY},fe.current=le.clientX,Be.current=le.clientY}},Qt=se=>{const le=Se.current;if(!(le===null||le.pointerId!==se.pointerId)){if(fe.current=se.clientX,Be.current=se.clientY,!le.armed){if(Math.hypot(se.clientX-le.startX,se.clientY-le.startY)<5)return;le.armed=!0,Xe.current=!0,De(le.id);const we=z.get(le.id);we&&te(h("ui.shell.sidebar_navigation.drag_armed",{name:we.label})),ae.current===null&&(ae.current=requestAnimationFrame(At))}je(se.clientX,se.clientY)}},ut=(se,le)=>{if(le.kind==="slot")return jut(oe,se,le.region,le.beforeId,L);const we=Ao(oe,se),Ee=le.kind==="more"?"more":we==="more"?"visible":"more";return h5(oe,se,Ee)},cn=(se,le)=>{const we=z.get(se);if(we===void 0)return;const Ee=ut(se,le);if(Ee===null||aE(Ee,oe))return;const We=Ao(Ee,se);if(We==="more"&&C(!0),q(Ee),le.kind==="slot"){Zt(Ee,se);return}te(We==="more"?h("ui.shell.sidebar_navigation.move_to_more_note",{name:we.label}):h("ui.shell.sidebar_navigation.show_in_sidebar_note",{name:we.label}))},Zt=(se,le)=>{const we=z.get(le),Ee=Ao(se,le),We=R_(se,Ee,L);te(h("ui.shell.sidebar_navigation.move_note",{name:we?.label??"",position:String(We.indexOf(le)+1),total:String(We.length)}))},Dt=(se,le=!1)=>{const we=Se.current;if(we===null)return;Se.current=null,bt(),Pe();const Ee=Ce.current;if(Ce.current=null,De(null),pe(null),K(!1),!!we.armed){if(!se){if(le){Xe.current=!1,te("");return}const We=()=>{Xe.current=!1},ke=()=>{window.setTimeout(We,0)},Ye=()=>{window.removeEventListener("pointerup",ot,!0),window.removeEventListener("pointercancel",jt,!0),window.removeEventListener("blur",jt,!0)},ot=()=>{Ye(),ke()},jt=()=>{Ye(),We()};window.addEventListener("pointerup",ot,!0),window.addEventListener("pointercancel",jt,!0),window.addEventListener("blur",jt,!0),te("");return}window.setTimeout(()=>{Xe.current=!1},0),Ee!==null&&cn(we.id,Ee)}},$t=m.useRef(Dt);$t.current=Dt,m.useEffect(()=>{if(ye===null)return;const se=Ee=>{Ee.key==="Escape"&&($t.current(!1),Ee.preventDefault())},le=Ee=>{Se.current?.pointerId===Ee.pointerId&&$t.current(!0)},we=()=>$t.current(!1,!0);return window.addEventListener("keydown",se),window.addEventListener("pointerup",le),window.addEventListener("pointercancel",we),window.addEventListener("blur",we),()=>{window.removeEventListener("keydown",se),window.removeEventListener("pointerup",le),window.removeEventListener("pointercancel",we),window.removeEventListener("blur",we)}},[ye]),m.useEffect(()=>()=>{ae.current!==null&&cancelAnimationFrame(ae.current),$e.current!==null&&window.clearTimeout($e.current)},[]);const Un=(se,le)=>{if(!re)return;const we=z.get(se);if(we===void 0)return;if(le.kind==="reset"){ee(),te(h("ui.shell.sidebar_navigation.reset_note")),W(se);return}if(le.kind==="move"){const We=But(oe,se,le.delta,L);if(We===null)return;q(We),Zt(We,se),W(se);return}const Ee=h5(oe,se,le.region);aE(Ee,oe)||(le.region==="more"&&C(!0),q(Ee),te(le.region==="more"?h("ui.shell.sidebar_navigation.move_to_more_note",{name:we.label}):h("ui.shell.sidebar_navigation.show_in_sidebar_note",{name:we.label})),W(se))},On=c.jsx(Qet,{selectedConversation:l??void 0,onSelectConversation:se=>void wg(t,se),onStageDraft:(se,le)=>{Ie.getState().stageDraft(se,le),t("/chat")}}),Tt=se=>{const le=se.attention??0,we=le>0&&se.attentionName?se.attentionName(le):se.label;return se.working&&se.workingName?se.workingName:we},ys=se=>{const le=z.get(se);if(le===void 0)return null;const we=Ao(oe,se),Ee=we==="more"?U:B,We=Ee.indexOf(se),ke=We<=0,Ye=We===-1||We>=Ee.length-1,ot=le.attention??0,jt=Tt(le),Gt=ye===se,tn=e?"left":"right",os=le.isActive?Io:"text-ink-muted hover:bg-row-hover hover:text-ink",vn=c.jsx(le.icon,{size:16,"aria-hidden":"true",className:R("shrink-0",le.isActive&&"text-accent")}),Cs=c.jsxs("button",{type:"button",ref:dn=>{dn?ge.current.set(se,dn):ge.current.delete(se)},onClick:()=>{if(Xe.current){Xe.current=!1;return}le.onSelect?le.onSelect():t(le.path)},onPointerDown:re?dn=>ln(se,dn):void 0,onPointerMove:re?Qt:void 0,onPointerUp:re?dn=>{Se.current?.pointerId===dn.pointerId&&Dt(!0)}:void 0,onPointerCancel:re?()=>Dt(!1,!0):void 0,onKeyDown:re?dn=>{if(dn.key==="ContextMenu"||dn.shiftKey&&dn.key==="F10"){dn.preventDefault(),Z(se);return}dn.altKey&&(dn.key!=="ArrowUp"&&dn.key!=="ArrowDown"||(dn.preventDefault(),Un(se,{kind:"move",delta:dn.key==="ArrowUp"?-1:1})))}:void 0,"data-tour-tag":le.tourTag,"aria-current":le.isActive?"page":void 0,"aria-haspopup":re?"menu":void 0,"aria-label":s&&jt===le.label?void 0:jt,className:R("flex h-full min-w-0 flex-1 items-center gap-2 rounded-md",s?"px-2":"justify-center px-0"),children:[s?vn:c.jsxs("span",{className:"relative flex size-7 shrink-0 items-center justify-center",children:[vn,ot>0&&c.jsx("span",{className:"pointer-events-none absolute -top-1 -end-1.5 flex",children:c.jsx(ep,{count:ot,placement:"corner","data-tour-tag":le.attentionTag})})]}),!s&&le.working&&c.jsx("span",{className:"inline-flex",children:c.jsx(ui,{size:16,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})}),s&&c.jsx("span",{className:"truncate",children:le.label})]}),Ss=re?c.jsxs($o,{open:Te===se,onOpenChange:dn=>Z(dn?se:null),children:[c.jsx(ao,{asChild:!0,children:s?c.jsx("button",{type:"button","data-sidebar-row-menu":"","aria-label":h("ui.shell.sidebar_navigation.row_actions",{name:le.label}),className:R("me-0.5 flex size-6 shrink-0 items-center justify-center rounded-sm","text-ink-muted opacity-0 transition-opacity duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink","group-hover/row:opacity-100 group-focus-within/row:opacity-100","focus-visible:opacity-100 data-[state=open]:opacity-100",ye!==null&&"pointer-events-none opacity-0!"),children:c.jsx(xc,{size:16,"aria-hidden":"true"})}):c.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-1 end-0 w-0"})}),c.jsxs(zo,{align:"start",side:tn,sideOffset:s?6:16,className:"min-w-44",onCloseAutoFocus:dn=>{dn.preventDefault(),W(se)},children:[c.jsx(en,{disabled:ke,onSelect:()=>Un(se,{kind:"move",delta:-1}),children:h("ui.shell.sidebar_navigation.move_up")}),c.jsx(en,{disabled:Ye,onSelect:()=>Un(se,{kind:"move",delta:1}),children:h("ui.shell.sidebar_navigation.move_down")}),c.jsx(Mr,{}),we==="more"?c.jsx(en,{onSelect:()=>Un(se,{kind:"region",region:"visible"}),children:h("ui.shell.sidebar_navigation.show_in_sidebar")}):c.jsx(en,{onSelect:()=>Un(se,{kind:"region",region:"more"}),children:h("ui.shell.sidebar_navigation.move_to_more")}),!aE(oe,_y)&&c.jsxs(c.Fragment,{children:[c.jsx(Mr,{}),c.jsx(en,{onSelect:()=>Un(se,{kind:"reset"}),children:h("ui.shell.sidebar_navigation.reset_layout")})]})]})]}):null;return c.jsxs("li",{"data-sidebar-row":se,"data-sidebar-region":we,onContextMenu:re?dn=>{dn.preventDefault(),Z(se)}:void 0,className:R("group/row relative flex h-[30px] w-full items-center rounded-md","transition-colors duration-fast ease-out-quart",os,Gt&&hY,Gt&&fY),children:[s?Cs:c.jsx(Du,{content:Tt(le),side:tn,suppressed:ye!==null,children:Cs}),Ss,s&&(ot>0||le.working)&&c.jsxs("span",{"aria-hidden":"true",className:"pointer-events-none inline-flex shrink-0 items-center gap-1 pe-2",children:[ot>0&&c.jsx(ep,{count:ot,"data-tour-tag":le.attentionTag}),le.working&&c.jsx(ui,{size:16,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})]})]},le.tourTag)},Gn=Ne===null?null:c.jsx("span",{"aria-hidden":"true","data-sidebar-drop-indicator":"",className:"pointer-events-none absolute inset-x-1 z-10 h-0.5 -translate-y-px rounded-full bg-accent",style:{top:Ne}}),ns=(ye===null?null:Ao(oe,ye))==="more"?h("ui.shell.sidebar_navigation.show_in_sidebar"):h("ui.shell.sidebar_navigation.move_to_more"),Fn=ye===null?null:s?c.jsx("div",{"data-sidebar-drop-band":"",className:"absolute inset-x-0 top-full z-20 mt-1 flex h-7 items-center justify-center rounded-md border border-dashed border-control bg-surface text-meta text-ink-dim",children:ns}):c.jsx(Du,{content:ns,side:e?"left":"right",children:c.jsx("div",{"data-sidebar-drop-band":"",className:"absolute inset-x-0 top-full z-20 mx-auto mt-1 flex h-6 w-8 items-center justify-center rounded-sm border border-dashed border-control bg-surface",children:c.jsx("span",{"aria-hidden":"true",className:"h-0.5 w-4 rounded-full bg-ink-dim"})})}),Vs=c.jsx("span",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:he}),hn=s?h("ui.shell.sidebar_navigation.collapse_sidebar"):h("ui.shell.sidebar_navigation.expand_sidebar"),rn=s?e?Qi:Xu:e?Xu:Qi,Nt=navigator.platform.toUpperCase().indexOf("MAC")>=0,Ws=gt(a.data,"session_catalogue",2),Dn=Ie(se=>se.activeDraftKey),Cn=Ie(se=>se.drafts),Je=!!Dn&&!(Dn?Cn[Dn]:void 0)?.target,It=()=>{Ie.getState().stageDraft(void 0,!0),t("/chat")},V=h("ui.shell.sidebar_navigation.new_chat_shortcut",{shortcut:Fi(o6(Nt).replace("+",""))}),Q=h("ui.shell.sidebar_navigation.search_accessible",{everything:Fi(_l("everything",Nt)),chats:Fi(_l("chats",Nt))}),j=h("ui.shell.sidebar_navigation.search_tooltip",{everything:Fi(_l("everything",Nt)),chats:Fi(_l("chats",Nt))}),H=(se,le,we,Ee)=>{const We=se;return c.jsxs("button",{type:"button",...Ee.attrs,onClick:Ee.onClick,disabled:Ee.disabled,"aria-label":Ee.ariaLabel,"aria-current":Ee.current?"page":void 0,className:R(g5,Ee.current?Io:"text-ink-muted hover:bg-row-hover hover:text-ink","disabled:text-ink-disabled disabled:hover:bg-transparent"),children:[c.jsx(We,{size:16,"aria-hidden":"true",className:"shrink-0"}),c.jsx("span",{className:"truncate",children:le}),c.jsx("span",{"aria-hidden":"true",className:"ms-auto",children:c.jsx(Ur,{shortcut:we,joined:!0})})]})},O=H(gT,h("ui.shell.sidebar_navigation.new_chat"),o6(Nt),{onClick:It,ariaLabel:V,current:Je,disabled:!Ws,attrs:{"data-tour-tag":"nav-item-chat","data-new-chat-row":""}}),Y=H(Ah,h("ui.shell.sidebar_navigation.search"),Lrt("everything",Nt),{onClick:i,ariaLabel:Q,attrs:{"data-command-palette-trigger":"",title:j}}),xe=(se,le,we)=>{const Ee=se;return c.jsx(Du,{content:c.jsx(Bo,{text:le}),side:e?"left":"right",children:c.jsx("button",{type:"button",...we.attrs,onClick:we.onClick,disabled:we.disabled,"aria-label":le,className:R("flex size-8 items-center justify-center rounded-sm text-ink-muted","transition-colors duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink","disabled:text-ink-disabled disabled:hover:bg-transparent"),children:c.jsxs("span",{className:"relative flex size-7 items-center justify-center",children:[c.jsx(Ee,{size:16,"aria-hidden":"true"}),(we.attention??0)>0&&c.jsx("span",{className:"pointer-events-none absolute -top-1 -end-1.5 flex",children:c.jsx(ep,{count:we.attention??0,placement:"corner","data-tour-tag":we.attentionTag})}),we.working&&c.jsx("span",{className:"pointer-events-none absolute -bottom-0.5 -end-0.5 flex",children:c.jsx(ui,{size:12,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})})]})})})},Re=c.jsx("div",{className:R("pointer-events-none opacity-0 transition-opacity duration-fast ease-out-quart","group-hover/sidebar:pointer-events-auto group-hover/sidebar:opacity-100","group-focus-within/sidebar:pointer-events-auto group-focus-within/sidebar:opacity-100"),children:c.jsx(Du,{content:hn,side:e?"left":"right",children:c.jsx(ce,{variant:"ghost",size:"icon-sm",onClick:r,"aria-label":hn,"aria-expanded":s,"aria-keyshortcuts":kN(Nt),children:c.jsx(rn,{"aria-hidden":"true"})})})}),_e=()=>{if(U.length===0)return null;const se=U.map(ke=>z.get(ke)).filter(ke=>ke!==void 0),le=Hut(se),we=ne?0:le,Ee=se.some(ke=>ke.working===!0),We=le>0?h("ui.shell.sidebar_navigation.more_waiting",{count:le,countText:String(le)}):Ee?h("ui.shell.sidebar_navigation.more_working"):h("ui.library.page.more_destinations");return c.jsxs("li",{className:R("flex flex-col",s?"gap-0.5":"items-center gap-1"),children:[s?c.jsxs("button",{type:"button","data-tour-tag":"nav-item-more","data-sidebar-more":"","aria-expanded":ne,"aria-controls":"sidebar-more-destinations","aria-label":We,onClick:()=>C(!ne),className:R(g5,"text-ink-muted hover:bg-row-hover hover:text-ink"),children:[c.jsx(xc,{size:16,"aria-hidden":"true",className:"shrink-0"}),c.jsx("span",{className:"min-w-0 flex-1 truncate text-start",children:h("ui.library.page.more")}),(we>0||Ee)&&c.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1",children:[we>0&&c.jsx(ep,{count:we,"data-tour-tag":"nav-more-badge"}),Ee&&c.jsx(ui,{size:16,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})]}),c.jsx(Di,{size:14,"aria-hidden":"true",className:R("shrink-0 transition-transform duration-fast",ne&&"rotate-180")})]}):xe(xc,We,{onClick:()=>C(!ne),attention:we,attentionTag:"nav-more-badge",working:Ee,attrs:{"aria-expanded":ne,"aria-controls":"sidebar-more-destinations","data-tour-tag":"nav-item-more","data-sidebar-more":""}}),ne&&c.jsx("ul",{id:"sidebar-more-destinations",className:R("flex flex-col gap-0.5",!s&&"items-center gap-1"),children:U.map(ys)})]},"nav-overflow")};return s?c.jsxs("div",{"data-sidebar-shell":"","data-glass-region":"sidebar",className:"panel-top-pad group/sidebar flex h-full min-h-0 flex-col overflow-hidden bg-surface",children:[c.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 pe-2 ps-4",children:[c.jsx(p5,{expanded:!0}),c.jsx("span",{className:"ms-auto",children:Re})]}),c.jsxs("div",{className:"flex shrink-0 flex-col gap-2 px-2 pb-2",children:[c.jsxs("div",{className:"flex flex-col gap-0.5",children:[O,Y]}),c.jsxs("div",{className:"relative",children:[c.jsxs("div",{ref:ve,"data-sidebar-destinations-area":"","data-sidebar-dragging":ye!==null?"":void 0,className:"relative min-h-0 max-h-[50dvh] overflow-y-auto select-none",children:[c.jsxs("ul",{"data-sidebar-destinations":"",className:"flex flex-col gap-0.5",children:[B.map(ys),_e()]}),Gn]}),Fn]}),Vs]}),c.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:On}),c.jsx(VX,{})]}):c.jsxs("div",{"data-sidebar-strip":"","data-glass-region":"sidebar",className:"panel-top-pad group/sidebar flex h-full min-h-0 flex-col items-center bg-surface",children:[c.jsx(nQ,{}),c.jsx("div",{className:"flex h-10 shrink-0 items-center justify-center",children:c.jsx(p5,{expanded:!1})}),c.jsxs("ul",{className:"flex flex-col items-center gap-1",children:[c.jsx("li",{children:xe(Qi,hn,{onClick:r,attrs:{"aria-expanded":!1,"aria-keyshortcuts":kN(Nt)}})}),c.jsx("li",{children:xe(gT,V,{onClick:It,disabled:!Ws,attrs:{"data-tour-tag":"nav-item-chat"}})}),c.jsx("li",{children:xe(Ah,Q,{onClick:i,attrs:{"data-command-palette-trigger":""}})})]}),c.jsxs("div",{ref:ve,"data-sidebar-destinations-area":"","data-sidebar-dragging":ye!==null?"":void 0,className:"relative mt-4 flex flex-col items-center gap-1 select-none",children:[c.jsxs("ul",{"data-sidebar-destinations":"",className:"flex flex-col items-center gap-1",children:[B.map(ys),_e()]}),Gn,Fn]}),Vs,c.jsxs("div",{className:"mt-auto flex flex-col items-center gap-1 pb-2",children:[c.jsx(BX,{}),c.jsx(GX,{}),c.jsx(gI,{expanded:!1})]})]})},Wut=1,$ut=()=>{const{isAuthenticated:e,user:t}=Yy(),{hasBeenNotified:n,setHasBeenNotified:s}=tQ(),[r,i]=m.useState(!1),[a,o]=m.useState(null),l=m.useCallback(async()=>{if(!(!e||!t?.radientUser?.account?.tenant_id))try{const p=await soe({operation:"credits",tenantId:t.radientUser.account.tenant_id});if(!p||typeof p.balance!="number")throw new Error(h("ui.common.errors.credit_balance_invalid"));o(p.balance)}catch(p){console.error("Failed to fetch Radient credits:",p),o(null)}},[e,t?.radientUser?.account?.tenant_id]);return m.useEffect(()=>{e&&l()},[e,l]),m.useEffect(()=>{e&&a!==null?a<Wut?n||i(!0):(i(!1),n&&s(!1)):i(!1)},[e,n,a,s]),{isLowCreditsDialogOpen:r,openRadientConsole:()=>{window.api?.openExternal?window.api.openExternal("https://console.radienthq.com"):window.open("https://console.radienthq.com","_blank"),s(!0),i(!1)},closeLowCreditsDialog:()=>{i(!1)},onLowCreditsDialogClose:()=>{s(!0),i(!1)},currentCredits:a}};function zut(){const e=Yr();m.useEffect(()=>{const t=r=>{e(r==="back"?-1:1)},n=r=>{const i=FH(r);i&&(r.preventDefault(),t(i))},s=r=>{const i=DH(r);i&&(r.preventDefault(),t(i))};return window.addEventListener("keydown",n),window.addEventListener("mouseup",s),()=>{window.removeEventListener("keydown",n),window.removeEventListener("mouseup",s)}},[e])}function qut(){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 Kut(e,t,n){const s=document.documentElement;if(t==="mac"){s.dataset.chromeLeading="true",s.dataset.chromeTrailing="false";return}if(e===null){s.dataset.chromeLeading="false",s.dataset.chromeTrailing="false";return}s.dataset.chromeLeading=e.x<=1?"true":"false",s.dataset.chromeTrailing=Math.abs(e.x+e.width-n)<=1?"true":"false"}function Yut(e){const t=window.api?.windowChrome;if(!t)return;const n=getComputedStyle(document.documentElement),s=n.getPropertyValue("--lo-canvas").trim(),r=n.getPropertyValue("--lo-ink-muted").trim(),i=n.getPropertyValue("--lo-ink-dim").trim();!s||!r||!i||t.report({themeId:e,colors:{ground:s,symbol:r,symbolInactive:i}})}function Xut(){m.useLayoutEffect(()=>{if(!window.api?.windowChrome)return;const t=document.documentElement.dataset.chromePlatform??"linux",n=()=>Kut(qut(),t,window.innerWidth);n();const s=navigator.windowControlsOverlay;return s?.addEventListener?.("geometrychange",n),window.addEventListener("resize",n),()=>{s?.removeEventListener?.("geometrychange",n),window.removeEventListener("resize",n)}},[]),m.useEffect(()=>{const e=window.api?.windowChrome;if(e)return e.onState(t=>{document.documentElement.dataset.chromeFullscreen=t.fullScreen?"true":"false"})},[])}const Qut=m.lazy(()=>ka(()=>import("./agent-details-page-DQXYu_PL.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url).then(e=>({default:e.AgentDetailsPage}))),Jut=m.lazy(()=>ka(()=>import("./agent-hub-page-1bRH8Gbz.js"),__vite__mapDeps([16,1,2,3,5,6,17,8,7,9,4,10,11,12,13,18,19,20,21,14,15]),import.meta.url).then(e=>({default:e.AgentHubPage}))),m5=m.lazy(()=>ka(()=>import("./agents-page-3iHF3oFj.js").then(e=>e.a),__vite__mapDeps([22,7,1,2,3,5,6,8,9,18,23,24,25]),import.meta.url).then(e=>({default:e.AgentsPage}))),Zut=m.lazy(()=>ka(()=>import("./schedules-page-Dtrb4iqB.js"),__vite__mapDeps([26,1,2,3,5,6,17,8,7,9,27,12,14,15]),import.meta.url).then(e=>({default:e.SchedulesPage}))),v5=m.lazy(()=>ka(()=>import("./projects-page-BWH8MFcf.js"),__vite__mapDeps([28,1,2,3,7,5,6,8,9,17,14,15,25,29]),import.meta.url).then(e=>({default:e.ProjectsPage}))),b5=m.lazy(()=>ka(()=>import("./library-page-B9cQw_XV.js").then(e=>e.l),__vite__mapDeps([30,1,2,3,14,5,6,15,17,7,8,9,13,29]),import.meta.url).then(e=>({default:e.LibraryPage}))),x5=m.lazy(()=>ka(()=>import("./notifications-page-C23kRJcC.js"),__vite__mapDeps([31,1,2,3,14,5,6,15,17,8,7,9,25]),import.meta.url).then(e=>({default:e.NotificationsPage}))),edt=m.lazy(()=>ka(()=>import("./team-bridge-page-D--3lHyk.js"),__vite__mapDeps([32,1,2,3,7,5,6,8,9,33,24,21,14,15]),import.meta.url).then(e=>({default:e.TeamBridgePage}))),tdt=m.lazy(()=>ka(()=>import("./browser-page-CbE2J46g.js"),__vite__mapDeps([34,1,2,3,5,6,8,7,9,14,15]),import.meta.url).then(e=>({default:e.BrowserPage}))),ndt=m.lazy(()=>ka(()=>import("./mesh-page-5KrCdgRG.js"),__vite__mapDeps([35,1,2,3,5,6,17,8,7,9,14,15]),import.meta.url).then(e=>({default:e.MeshPage}))),sdt=m.lazy(()=>ka(()=>import("./settings-page-D68agRqU.js"),__vite__mapDeps([36,1,2,3,5,6,14,15,7,8,9,17,33,19,23,37,11,27,12]),import.meta.url).then(e=>({default:e.SettingsPage}))),rdt=m.lazy(()=>ka(()=>import("./browser-webauthn-prompt-DhewWTHJ.js"),__vite__mapDeps([38,1,2,3,5,6,8,7,9,14,15]),import.meta.url).then(e=>({default:e.BrowserWebauthnPrompt}))),idt=()=>{Ge(),Jlt(),Xut(),kut(),roe();const{pathname:e}=SA(),t=e.startsWith("/chat")||e.startsWith("/browser"),{isOnboardingActive:n}=Tpe(),{isLowCreditsDialogOpen:s,openRadientConsole:r,onLowCreditsDialogClose:i}=$ut(),{isCommandPaletteOpen:a,isCreateAgentDialogOpen:o,isSidebarCollapsed:l,closeCreateAgentDialog:u}=et();Fu(a,"command-palette"),Fu(o,"dialog","create-agent"),Fu(n,"onboarding"),Fu(s,"dialog","low-credits");const d=Yr(),f=Hn(),p=gt(f.data,"session_catalogue",2),g=gt(f.data,"session_archive");m.useEffect(()=>{Ie.getState().requestArchiveConfirm(null)},[e]);const v=vr(f.data,"peers"),b=vr(f.data,"library"),x=vr(f.data,"notifications"),_=vr(f.data,"team_bridge_conversations"),w=_==="enabled"&&e.startsWith(ag);Sut(gt(f.data,"team_bridge_conversations"));const y=P=>{Ie.getState().stageDraft({kind:"agent",name:P.name}),d("/chat"),u()};dit(),Rut(),Uoe(),ioe(),zut(),Owe();const S=Ie(P=>P.setActiveSession),C=Hn(),E=Qh(gt(C.data,"aida",1)),k=Ie(P=>{const M=P.activeDraftKey?P.drafts[P.activeDraftKey]:void 0;return zv(P.activeDraftKey,M?.sessionId,P.activeSessionId)}),F=Cge({displayedSessionId:k,archiveEnabled:g}),A=et(P=>P.setConsolePaneOpen),I=et(P=>P.setBrowserPaneOpen),N=et(P=>P.setConsoleActiveSurface);return m.useEffect(()=>{const P=window.api?.desktop?.onOpenConversation?.((M,z)=>{M!==null&&performance.mark("lop:open:requested"),S(M),z!==void 0&&M!==null&&(N(z),A(!0)),d("/chat")});return()=>P?.()},[d,S,A,N]),Nrt(_==="enabled",d),Aut(_==="enabled",d),m.useEffect(()=>{const P=window.api?.console?.onReveal?.(M=>{if(M.mode!=="none"&&!(M.mode==="session"&&M.session_id!==k)){if(M.mode==="open"){if(!aoe({targetSessionId:M.session_id,displayedSessionId:k,activeElement:document.activeElement,commandPaletteOpen:a}))return;S(M.session_id)}N(M.surface),A(!0)}});return()=>P?.()},[k,a,S,A,N]),Yge(),tst(),m.useEffect(()=>{const P=window.api?.browser?.onConsentAttention?.(M=>{const z=Dge(M.requesterSessionId,Ie.getState().sessions);if(Rge(M.entryId),z.kind==="browser"){d("/browser");return}S(z.sessionId),I(!0),d("/chat")});return()=>P?.()},[d,S,I]),m.useEffect(()=>{const P=M=>{n||p&&sst(M)&&(M.preventDefault(),Ie.getState().stageDraft(void 0,!0),d("/chat"))};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[p,n,d]),c.jsx(jlt,{children:c.jsx("div",{className:"relative flex h-screen flex-col overflow-hidden","data-titlebar-sidebar-collapsed":l&&!w?"true":"false",children:c.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[a&&c.jsx(oit,{}),c.jsx(Ult,{}),c.jsx(rst,{}),c.jsx(ooe,{}),c.jsx(hit,{enabled:v==="enabled"}),c.jsx(aat,{open:n}),c.jsx(Hlt,{}),c.jsx(tct,{}),g&&c.jsx(Zge,{}),c.jsx(ege,{}),c.jsx(m.Suspense,{fallback:null,children:c.jsx(rdt,{})}),c.jsx(vge,{blocked:n||s||a||o||F,sessionId:E.data?.session_id??null}),c.jsx(Dut,{open:s,onClose:i,onGoToConsole:r}),c.jsx(Dpe,{open:o,onClose:u,onAgentCreated:y}),c.jsx(loe,{sidebar:c.jsx(Vut,{}),routeSidebar:w&&{keeper:c.jsx(nQ,{}),label:h("ui.teamBridge.page.title")},content:c.jsxs("main",{"data-glass-region":"canvas-backing",className:"panel-top-pad flex grow flex-col overflow-hidden",children:[t?null:c.jsx("div",{"data-chrome-route-band":""}),c.jsx(m.Suspense,{fallback:c.jsxs(c.Fragment,{children:[w&&c.jsx(Vct,{}),c.jsx("div",{className:"flex grow items-center justify-center",children:c.jsx(Mn,{size:"lg",label:h("ui.common.loading.page")})})]}),children:c.jsxs(iee,{children:[c.jsx(pr,{path:"/",element:c.jsx(EN,{to:"/chat",replace:!0})}),c.jsx(pr,{path:"/chat",element:c.jsx(i6,{})}),c.jsx(pr,{path:"/chat/:agentId",element:c.jsx(i6,{})}),c.jsx(pr,{path:"/agents",element:c.jsx(m5,{})}),c.jsx(pr,{path:"/agents/:agentId",element:c.jsx(m5,{})}),c.jsx(pr,{path:"/settings",element:c.jsx(sdt,{})}),c.jsx(pr,{path:"/agent-hub",element:c.jsx(Jut,{})}),c.jsx(pr,{path:"/agent-hub/:agentId",element:c.jsx(Qut,{})}),c.jsx(pr,{path:"/schedules",element:c.jsx(Zut,{})}),c.jsx(pr,{path:"/projects",element:c.jsx(v5,{})}),c.jsx(pr,{path:"/projects/:projectId",element:c.jsx(v5,{})}),c.jsx(pr,{path:"/browser",element:c.jsx(tdt,{})}),x==="enabled"&&c.jsxs(c.Fragment,{children:[c.jsx(pr,{path:"/notifications",element:c.jsx(x5,{})}),c.jsx(pr,{path:"/notifications/:notificationId",element:c.jsx(x5,{})})]}),b==="enabled"&&c.jsxs(c.Fragment,{children:[c.jsx(pr,{path:"/library",element:c.jsx(b5,{})}),c.jsx(pr,{path:"/library/assets/:assetId",element:c.jsx(b5,{})})]}),_==="enabled"&&c.jsx(pr,{path:"/team-bridge",element:c.jsx(edt,{})}),v==="enabled"&&c.jsx(pr,{path:"/mesh",element:c.jsx(ndt,{})}),c.jsx(pr,{path:"*",element:c.jsx(EN,{to:"/chat",replace:!0})})]})})]})})]})})})};let hl=null,Uf=null,Cm=null,Gf=null,oE=null;const adt={soundsArm:async()=>{if(Tf.getState().element)throw new Error("sounds safety: element already exists");if(hl)throw new Error("sounds safety: graph already armed");return hl=new AudioContext,await hl.resume(),uoe(e=>{if(!hl)throw new Error("sounds safety: no context");const t=hl.createMediaElementSource(e);Cm=hl.createGain(),Cm.gain.value=0,Uf=hl.createAnalyser(),Gf=hl.createAnalyser(),t.connect(Gf),Gf.connect(Cm),Cm.connect(Uf),Uf.connect(hl.destination)}),{armed:!0,contextState:hl.state}},soundsFacts:()=>{const e=Tf.getState(),t=new Float32Array(Uf?.fftSize??32);Uf?.getFloatTimeDomainData(t);const n=new Float32Array(Gf?.fftSize??32);return Gf?.getFloatTimeDomainData(n),{ownerId:e.ownerId,status:e.status,time:e.element?.currentTime??0,duration:e.element?.duration??0,paused:e.element?.paused??!0,gain:Cm?.gain.value??null,inputRms:Gf?Math.sqrt(n.reduce((s,r)=>s+r*r,0)/n.length):null,players:Array.from(document.querySelectorAll("[data-sound-player]")).map(s=>({status:s.getAttribute("data-sound-status"),clock:s.querySelector("[data-sound-time]")?.textContent,clip:s.querySelectorAll("canvas")[1]?.style.clipPath,numeric:getComputedStyle(s.querySelector("[data-sound-time]")??s).fontVariantNumeric})),rms:Uf?Math.sqrt(t.reduce((s,r)=>s+r*r,0)/t.length):null,src:e.element?.src??null,nativeElements:document.querySelectorAll("audio").length,canvas:Object.values(Rs.getState().conversations).map(s=>({selectedTab:s.selectedTabId,files:s.files?.map(r=>({id:r.id,path:r.path,artifact:r.artifact??null}))}))}},soundsScrub:e=>{const t=e,n=document.querySelector(t.selector);if(!n)throw new Error("sounds: no slider");const s=n.getBoundingClientRect(),r=(u,d)=>n.dispatchEvent(new PointerEvent(u,{pointerId:17,pointerType:"mouse",clientX:d,clientY:s.y+s.height/2,bubbles:!0})),i=n.setPointerCapture,a=n.releasePointerCapture;n.setPointerCapture=()=>{},n.releasePointerCapture=()=>{},r("pointerdown",s.left+1),r("pointermove",s.left+s.width*t.fraction);const o=()=>n.closest("[data-sound-player]")?.getAttribute("data-sound-status"),l=performance.now()+1500;return new Promise(u=>{const d=()=>{const f=o();if(f!=="scrubbing"&&performance.now()<l){requestAnimationFrame(d);return}oE=()=>{r("pointerup",s.left+s.width*t.fraction),n.setPointerCapture=i,n.releasePointerCapture=a},u({during:f,seconds:Tf.getState().element?.currentTime})};requestAnimationFrame(d)})},soundsScrubFinish:()=>(oE?.(),oE=null,{committed:!0}),soundsEnd:()=>{const e=Tf.getState();if(!e.ownerId||!e.element)throw new Error("sounds: no active playback");return e.seek(e.ownerId,e.element.duration-.12),{requested:!0}},soundsSpeech:async()=>{const e=Tf.getState();if(!e.element?.src)throw new Error("sounds: fixture not resolved");const{fetchAttachmentBlob:t}=await ka(async()=>{const{fetchAttachmentBlob:r}=await import("./conversation-input-sync-D820Mg9t.js").then(i=>i.o3);return{fetchAttachmentBlob:r}},__vite__mapDeps([7,1,2,3,5,6,8,9]),import.meta.url),n=Ie.getState().activeSessionId,s=e.ownerId?.startsWith("sound:")?e.ownerId.slice(6):null;if(!n||!s)throw new Error("sounds: missing attachment identity");return await coe.getState().speak("sounds-driver",()=>t({sessionId:n,childId:null},s)),{ownerId:Tf.getState().ownerId}}};function sh(){return new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))})}const odt=3,ldt=3e3;function cdt(e){return e instanceof CSSTransition&&e.playState==="running"}function udt(e){const t=e.effect,n=t instanceof KeyframeEffect?t.target:null,s=e.transitionProperty,i=/^[a-z-]+$/.test(s)&&n instanceof Element?getComputedStyle(n).getPropertyValue(s).trim()||"(empty)":"(unreadable)";return`${s||"(unnamed property)"} on ${Uv(n)??"an element no longer in the document"} = ${i}`}async function ddt(e=ldt){const t=performance.now();let n=0;for(;;){await sh();const s=Math.round(performance.now()-t),r=document.getAnimations().filter(cdt);if(n=r.length===0?n+1:0,n>=odt)return{waitedMs:s,timedOut:!1,pending:[]};if(s>e)return{waitedMs:s,timedOut:!0,pending:r.map(udt)}}}const hdt=/^#/;function I0(){const e=window.location.hash.replace(hdt,"");return e===""?"/":e}function Uv(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 fdt(e){const t=e.getBoundingClientRect(),n=t.left+t.width/2,s=t.top+t.height/2,r=document.elementFromPoint(n,s),i=r!==null&&(r===e||e.contains(r)),a=document.elementsFromPoint(n,s).slice(0,4).map(l=>Uv(l)),o={bubbles:!0,cancelable:!0,composed:!0,button:0,buttons:1,clientX:n,clientY:s,view:window};return e.dispatchEvent(new PointerEvent("pointerdown",{...o,pointerId:1,isPrimary:!0})),e.dispatchEvent(new MouseEvent("mousedown",o)),e.dispatchEvent(new PointerEvent("pointerup",{...o,buttons:0,pointerId:1,isPrimary:!0})),e.dispatchEvent(new MouseEvent("mouseup",{...o,buttons:0})),e.dispatchEvent(new MouseEvent("click",{...o,buttons:0})),{hitTest:i,hit:Uv(r),stack:a,disabled:e instanceof HTMLButtonElement?e.disabled:null,rect:{x:t.x,y:t.y,width:t.width,height:t.height}}}function Sm(e,t){if(typeof e!="string"||e==="")throw new Error(`${t} must be a non-empty string`);return e}async function pdt(e,t=1e4){const n=Date.now();for(;I0()!==e;){if(Date.now()-n>t)throw new Error(`route did not become ${e} (it is ${I0()})`);await new Promise(s=>setTimeout(s,50))}return await sh(),I0()}const _A=["dev-driver","query-fetch-probe"];let N0=null;function gdt(){if(N0)return N0;const e=[],t=TN.prototype.fetch;return TN.prototype.fetch=function(...s){return e.push({at:Date.now(),key:JSON.stringify(this.queryKey),stack:(new Error().stack??"").split(`
699
+ */var R6;function oat(){if(R6)return wm;R6=1;var e=st,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,r=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function a(o,l,u){var d,f={},p=null,g=null;u!==void 0&&(p=""+u),l.key!==void 0&&(p=""+l.key),l.ref!==void 0&&(g=l.ref);for(d in l)s.call(l,d)&&!i.hasOwnProperty(d)&&(f[d]=l[d]);if(o&&o.defaultProps)for(d in l=o.defaultProps,l)f[d]===void 0&&(f[d]=l[d]);return{$$typeof:t,type:o,key:p,ref:g,props:f,_owner:r.current}}return wm.Fragment=n,wm.jsx=a,wm.jsxs=a,wm}var A6;function lat(){return A6||(A6=1,T6.exports=oat()),T6.exports}var cat=lat();/*! shepherd.js 14.5.0 */function uat(e){return e instanceof Element}function og(e){return e instanceof HTMLElement}function od(e){return typeof e=="function"}function Bv(e){return typeof e=="string"}function li(e){return e===void 0}class ZD{on(t,n,s,r=!1){var i;return li(this.bindings)&&(this.bindings={}),li(this.bindings[t])&&(this.bindings[t]=[]),(i=this.bindings[t])==null||i.push({handler:n,ctx:s,once:r}),this}once(t,n,s){return this.on(t,n,s,!0)}off(t,n){if(li(this.bindings)||li(this.bindings[t]))return this;if(li(n))delete this.bindings[t];else{var s;(s=this.bindings[t])==null||s.forEach((r,i)=>{if(r.handler===n){var a;(a=this.bindings[t])==null||a.splice(i,1)}})}return this}trigger(t,...n){if(!li(this.bindings)&&this.bindings[t]){var s;(s=this.bindings[t])==null||s.forEach((r,i)=>{const{ctx:a,handler:o,once:l}=r,u=a||this;if(o.apply(u,n),l){var d;(d=this.bindings[t])==null||d.splice(i,1)}})}return this}}function Zi(){return Zi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)({}).hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Zi.apply(null,arguments)}function eI(e,t){if(e==null)return{};var n={};for(var s in e)if({}.hasOwnProperty.call(e,s)){if(t.includes(s))continue;n[s]=e[s]}return n}const xd={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")};xd.defaultMerge;function dat(e,t){return t}function hat(e,t){return e.filter(n=>n!==void 0)}var F6;(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"})(F6||(F6={}));function D6(e){return typeof e!="object"||e===null?0:Array.isArray(e)?2:gat(e)?1:e instanceof Set?3:e instanceof Map?4:5}function fat(e){const t=new Set;for(const n of e)for(const s of[...Object.keys(n),...Object.getOwnPropertySymbols(n)])t.add(s);return t}function pat(e,t){return typeof e=="object"&&Object.prototype.propertyIsEnumerable.call(e,t)}function sX(e){return{*[Symbol.iterator](){for(const t of e)for(const n of t)yield n}}}const I6=new Set(["[object Object]","[object Module]"]);function gat(e){if(!I6.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"||!I6.has(Object.prototype.toString.call(n))||!n.hasOwnProperty("isPrototypeOf"))}function mat(e,t,n){const s={};for(const r of fat(e)){const i=[];for(const l of e)pat(l,r)&&i.push(l[r]);if(i.length===0)continue;const a=t.metaDataUpdater(n,{key:r,parents:e}),o=rX(i,t,a);o!==xd.skip&&(r==="__proto__"?Object.defineProperty(s,r,{value:o,configurable:!0,enumerable:!0,writable:!0}):s[r]=o)}return s}function vat(e){return e.flat()}function bat(e){return new Set(sX(e))}function xat(e){return new Map(sX(e))}function _at(e){return e.at(-1)}const Vx={mergeRecords:mat,mergeArrays:vat,mergeSets:bat,mergeMaps:xat,mergeOthers:_at};function tI(...e){return wat({})(...e)}function wat(e,t){const n=yat(e,s);function s(...r){return rX(r,n,t)}return s}function yat(e,t){var n,s,r;return{defaultMergeFunctions:Vx,mergeFunctions:Zi({},Vx,Object.fromEntries(Object.entries(e).filter(([i,a])=>Object.hasOwn(Vx,i)).map(([i,a])=>a===!1?[i,Vx.mergeOthers]:[i,a]))),metaDataUpdater:(n=e.metaDataUpdater)!=null?n:dat,deepmerge:t,useImplicitDefaultMerging:(s=e.enableImplicitDefaultMerging)!=null?s:!1,filterValues:e.filterValues===!1?void 0:(r=e.filterValues)!=null?r:hat,actions:xd}}function rX(e,t,n){var s;const r=(s=t.filterValues==null?void 0:t.filterValues(e,n))!=null?s:e;if(r.length===0)return;if(r.length===1)return nE(r,t,n);const i=D6(r[0]);if(i!==0&&i!==5){for(let a=1;a<r.length;a++)if(D6(r[a])!==i)return nE(r,t,n)}switch(i){case 1:return Cat(r,t,n);case 2:return Sat(r,t,n);case 3:return kat(r,t,n);case 4:return Eat(r,t,n);default:return nE(r,t,n)}}function Cat(e,t,n){const s=t.mergeFunctions.mergeRecords(e,t,n);return s===xd.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeRecords!==t.defaultMergeFunctions.mergeRecords?t.defaultMergeFunctions.mergeRecords(e,t,n):s}function Sat(e,t,n){const s=t.mergeFunctions.mergeArrays(e,t,n);return s===xd.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeArrays!==t.defaultMergeFunctions.mergeArrays?t.defaultMergeFunctions.mergeArrays(e):s}function kat(e,t,n){const s=t.mergeFunctions.mergeSets(e,t,n);return s===xd.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeSets!==t.defaultMergeFunctions.mergeSets?t.defaultMergeFunctions.mergeSets(e):s}function Eat(e,t,n){const s=t.mergeFunctions.mergeMaps(e,t,n);return s===xd.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps?t.defaultMergeFunctions.mergeMaps(e):s}function nE(e,t,n){const s=t.mergeFunctions.mergeOthers(e,t,n);return s===xd.defaultMerge||t.useImplicitDefaultMerging&&s===void 0&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(e):s}function nI(e){const t=Object.getOwnPropertyNames(e.constructor.prototype);for(let n=0;n<t.length;n++){const s=t[n],r=e[s];s!=="constructor"&&typeof r=="function"&&(e[s]=r.bind(e))}return e}function Tat(e,t){return n=>{if(e.isOpen()){const s=e.el&&n.currentTarget===e.el;(!li(t)&&n.currentTarget.matches(t)||s)&&e.tour.next()}}}function Rat(e){const{event:t,selector:n}=e.options.advanceOn||{};if(t){const s=Tat(e,n);let r=null;if(!li(n)&&(r=document.querySelector(n),!r))return console.error(`No element was found for the selector supplied to advanceOn: ${n}`);r?(r.addEventListener(t,s),e.on("destroy",()=>r.removeEventListener(t,s))):(document.body.addEventListener(t,s,!0),e.on("destroy",()=>document.body.removeEventListener(t,s,!0)))}else return console.error("advanceOn was defined, but no event name was passed.")}class Aat{constructor(t){}}class Fat{constructor(t,n){}}function iX(e){return!Bv(e)||e===""?"":e.charAt(e.length-1)!=="-"?`${e}-`:e}function Dat(e){const t=e.options.attachTo||{},n=Object.assign({},t);if(od(n.element)&&(n.element=n.element.call(e)),Bv(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 Iat(e){return e.options.extraHighlights?e.options.extraHighlights.flatMap(t=>Array.from(document.querySelectorAll(t))):[]}function aX(e){return e==null?!0:!e.element||!e.on}function oX(){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 Nat=["top","right","bottom","left"],N6=["start","end"],P6=Nat.reduce((e,t)=>e.concat(t,t+"-"+N6[0],t+"-"+N6[1]),[]),lg=Math.min,kh=Math.max,fy=Math.round,Wx=Math.floor,Fl=e=>({x:e,y:e}),Pat={left:"right",right:"left",bottom:"top",top:"bottom"},Mat={start:"end",end:"start"};function cA(e,t,n){return kh(e,lg(t,n))}function Kh(e,t){return typeof e=="function"?e(t):e}function jc(e){return e.split("-")[0]}function Fc(e){return e.split("-")[1]}function sI(e){return e==="x"?"y":"x"}function rI(e){return e==="y"?"height":"width"}function cg(e){return["top","bottom"].includes(jc(e))?"y":"x"}function iI(e){return sI(cg(e))}function lX(e,t,n){n===void 0&&(n=!1);const s=Fc(e),r=iI(e),i=rI(r);let a=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=gy(a)),[a,gy(a)]}function Oat(e){const t=gy(e);return[py(e),t,py(t)]}function py(e){return e.replace(/start|end/g,t=>Mat[t])}function Lat(e,t,n){const s=["left","right"],r=["right","left"],i=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?r:s:t?s:r;case"left":case"right":return t?i:a;default:return[]}}function Bat(e,t,n,s){const r=Fc(e);let i=Lat(jc(e),n==="start",s);return r&&(i=i.map(a=>a+"-"+r),t&&(i=i.concat(i.map(py)))),i}function gy(e){return e.replace(/left|right|bottom|top/g,t=>Pat[t])}function jat(e){return Zi({top:0,right:0,bottom:0,left:0},e)}function cX(e){return typeof e!="number"?jat(e):{top:e,right:e,bottom:e,left:e}}function my(e){const{x:t,y:n,width:s,height:r}=e;return{width:s,height:r,top:n,left:t,right:t+s,bottom:n+r,x:t,y:n}}const Hat=["crossAxis","alignment","allowedPlacements","autoAlignment"],Uat=["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"],Gat=["mainAxis","crossAxis","limiter"];function M6(e,t,n){let{reference:s,floating:r}=e;const i=cg(t),a=iI(t),o=rI(a),l=jc(t),u=i==="y",d=s.x+s.width/2-r.width/2,f=s.y+s.height/2-r.height/2,p=s[o]/2-r[o]/2;let g;switch(l){case"top":g={x:d,y:s.y-r.height};break;case"bottom":g={x:d,y:s.y+s.height};break;case"right":g={x:s.x+s.width,y:f};break;case"left":g={x:s.x-r.width,y:f};break;default:g={x:s.x,y:s.y}}switch(Fc(t)){case"start":g[a]-=p*(n&&u?-1:1);break;case"end":g[a]+=p*(n&&u?-1:1);break}return g}const Vat=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:i=[],platform:a}=n,o=i.filter(Boolean),l=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:f}=M6(u,s,l),p=s,g={},v=0;for(let b=0;b<o.length;b++){const{name:x,fn:_}=o[b],{x:w,y,data:S,reset:C}=await _({x:d,y:f,initialPlacement:s,placement:p,strategy:r,middlewareData:g,rects:u,platform:a,elements:{reference:e,floating:t}});d=w??d,f=y??f,g=Zi({},g,{[x]:Zi({},g[x],S)}),C&&v<=50&&(v++,typeof C=="object"&&(C.placement&&(p=C.placement),C.rects&&(u=C.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:r}):C.rects),{x:d,y:f}=M6(u,p,l)),b=-1)}return{x:d,y:f,placement:p,strategy:r,middlewareData:g}};async function aI(e,t){var n;t===void 0&&(t={});const{x:s,y:r,platform:i,rects:a,elements:o,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:p=!1,padding:g=0}=Kh(t,e),v=cX(g),b=o[p?f==="floating"?"reference":"floating":f],x=my(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(b)))==null||n?b:b.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:u,rootBoundary:d,strategy:l})),_=f==="floating"?{x:s,y:r,width:a.floating.width,height:a.floating.height}:a.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),y=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},S=my(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:_,offsetParent:w,strategy:l}):_);return{top:(x.top-S.top+v.top)/y.y,bottom:(S.bottom-x.bottom+v.bottom)/y.y,left:(x.left-S.left+v.left)/y.x,right:(S.right-x.right+v.right)/y.x}}const Wat=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:r,rects:i,platform:a,elements:o,middlewareData:l}=t,{element:u,padding:d=0}=Kh(e,t)||{};if(u==null)return{};const f=cX(d),p={x:n,y:s},g=iI(r),v=rI(g),b=await a.getDimensions(u),x=g==="y",_=x?"top":"left",w=x?"bottom":"right",y=x?"clientHeight":"clientWidth",S=i.reference[v]+i.reference[g]-p[g]-i.floating[v],C=p[g]-i.reference[g],E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let k=E?E[y]:0;(!k||!await(a.isElement==null?void 0:a.isElement(E)))&&(k=o.floating[y]||i.floating[v]);const F=S/2-C/2,A=k/2-b[v]/2-1,I=lg(f[_],A),N=lg(f[w],A),P=I,M=k-b[v]-N,z=k/2-b[v]/2+F,L=cA(P,z,M),X=!l.arrow&&Fc(r)!=null&&z!==L&&i.reference[v]/2-(z<P?I:N)-b[v]/2<0,J=X?z<P?z-P:z-M:0;return{[g]:p[g]+J,data:Zi({[g]:L,centerOffset:z-L-J},X&&{alignmentOffset:J}),reset:X}}});function $at(e,t,n){return(e?[...n.filter(s=>Fc(s)===e),...n.filter(s=>Fc(s)!==e)]:n.filter(s=>jc(s)===s)).filter(s=>e?Fc(s)===e||(t?py(s)!==s:!1):!0)}const zat=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,s,r;const{rects:i,middlewareData:a,placement:o,platform:l,elements:u}=t,d=Kh(e,t),{crossAxis:f=!1,alignment:p,allowedPlacements:g=P6,autoAlignment:v=!0}=d,b=eI(d,Hat),x=p!==void 0||g===P6?$at(p||null,v,g):g,_=await aI(t,b),w=((n=a.autoPlacement)==null?void 0:n.index)||0,y=x[w];if(y==null)return{};const S=lX(y,i,await(l.isRTL==null?void 0:l.isRTL(u.floating)));if(o!==y)return{reset:{placement:x[0]}};const C=[_[jc(y)],_[S[0]],_[S[1]]],E=[...((s=a.autoPlacement)==null?void 0:s.overflows)||[],{placement:y,overflows:C}],k=x[w+1];if(k)return{data:{index:w+1,overflows:E},reset:{placement:k}};const F=E.map(I=>{const N=Fc(I.placement);return[I.placement,N&&f?I.overflows.slice(0,2).reduce((P,M)=>P+M,0):I.overflows[0],I.overflows]}).sort((I,N)=>I[1]-N[1]),A=((r=F.filter(I=>I[2].slice(0,Fc(I[0])?2:3).every(N=>N<=0))[0])==null?void 0:r[0])||F[0][0];return A!==o?{data:{index:w+1,overflows:E},reset:{placement:A}}:{}}}},qat=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:l,elements:u}=t,d=Kh(e,t),{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:x=!0}=d,_=eI(d,Uat);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const w=jc(r),y=cg(o),S=jc(o)===o,C=await(l.isRTL==null?void 0:l.isRTL(u.floating)),E=g||(S||!x?[gy(o)]:Oat(o)),k=b!=="none";!g&&k&&E.push(...Bat(o,x,b,C));const F=[o,...E],A=await aI(t,_),I=[];let N=((s=i.flip)==null?void 0:s.overflows)||[];if(f&&I.push(A[w]),p){const L=lX(r,a,C);I.push(A[L[0]],A[L[1]])}if(N=[...N,{placement:r,overflows:I}],!I.every(L=>L<=0)){var P,M;const L=(((P=i.flip)==null?void 0:P.index)||0)+1,X=F[L];if(X)return{data:{index:L,overflows:N},reset:{placement:X}};let J=(M=N.filter(re=>re.overflows[0]<=0).sort((re,q)=>re.overflows[1]-q.overflows[1])[0])==null?void 0:M.placement;if(!J)switch(v){case"bestFit":{var z;const re=(z=N.filter(q=>{if(k){const ee=cg(q.placement);return ee===y||ee==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(ee=>ee>0).reduce((ee,oe)=>ee+oe,0)]).sort((q,ee)=>q[1]-ee[1])[0])==null?void 0:z[0];re&&(J=re);break}case"initialPlacement":J=o;break}if(r!==J)return{reset:{placement:J}}}return{}}}},Kat=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:r}=t,i=Kh(e,t),{mainAxis:a=!0,crossAxis:o=!1,limiter:l={fn:_=>{let{x:w,y}=_;return{x:w,y}}}}=i,u=eI(i,Gat),d={x:n,y:s},f=await aI(t,u),p=cg(jc(r)),g=sI(p);let v=d[g],b=d[p];if(a){const _=g==="y"?"top":"left",w=g==="y"?"bottom":"right",y=v+f[_],S=v-f[w];v=cA(y,v,S)}if(o){const _=p==="y"?"top":"left",w=p==="y"?"bottom":"right",y=b+f[_],S=b-f[w];b=cA(y,b,S)}const x=l.fn(Zi({},t,{[g]:v,[p]:b}));return Zi({},x,{data:{x:x.x-n,y:x.y-s}})}}},Yat=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:r,rects:i,middlewareData:a}=t,{offset:o=0,mainAxis:l=!0,crossAxis:u=!0}=Kh(e,t),d={x:n,y:s},f=cg(r),p=sI(f);let g=d[p],v=d[f];const b=Kh(o,t),x=typeof b=="number"?{mainAxis:b,crossAxis:0}:Zi({mainAxis:0,crossAxis:0},b);if(l){const y=p==="y"?"height":"width",S=i.reference[p]-i.floating[y]+x.mainAxis,C=i.reference[p]+i.reference[y]-x.mainAxis;g<S?g=S:g>C&&(g=C)}if(u){var _,w;const y=p==="y"?"width":"height",S=["top","left"].includes(jc(r)),C=i.reference[f]-i.floating[y]+(S&&((_=a.offset)==null?void 0:_[f])||0)+(S?0:x.crossAxis),E=i.reference[f]+i.reference[y]+(S?0:((w=a.offset)==null?void 0:w[f])||0)-(S?x.crossAxis:0);v<C?v=C:v>E&&(v=E)}return{[p]:g,[f]:v}}}};function YC(){return typeof window<"u"}function Og(e){return uX(e)?(e.nodeName||"").toLowerCase():"#document"}function wa(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Gl(e){var t;return(t=(uX(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function uX(e){return YC()?e instanceof Node||e instanceof wa(e).Node:!1}function qo(e){return YC()?e instanceof Element||e instanceof wa(e).Element:!1}function Ol(e){return YC()?e instanceof HTMLElement||e instanceof wa(e).HTMLElement:!1}function O6(e){return!YC()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof wa(e).ShadowRoot}function wb(e){const{overflow:t,overflowX:n,overflowY:s,display:r}=Ko(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!["inline","contents"].includes(r)}function Xat(e){return["table","td","th"].includes(Og(e))}function XC(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function oI(e){const t=lI(),n=qo(e)?Ko(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(s=>(n.willChange||"").includes(s))||["paint","layout","strict","content"].some(s=>(n.contain||"").includes(s))}function Qat(e){let t=ld(e);for(;Ol(t)&&!ug(t);){if(oI(t))return t;if(XC(t))return null;t=ld(t)}return null}function lI(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ug(e){return["html","body","#document"].includes(Og(e))}function Ko(e){return wa(e).getComputedStyle(e)}function QC(e){return qo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ld(e){if(Og(e)==="html")return e;const t=e.assignedSlot||e.parentNode||O6(e)&&e.host||Gl(e);return O6(t)?t.host:t}function dX(e){const t=ld(e);return ug(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ol(t)&&wb(t)?t:dX(t)}function jv(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=dX(e),i=r===((s=e.ownerDocument)==null?void 0:s.body),a=wa(r);if(i){const o=uA(a);return t.concat(a,a.visualViewport||[],wb(r)?r:[],o&&n?jv(o):[])}return t.concat(r,jv(r,[],n))}function uA(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function hX(e){const t=Ko(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=Ol(e),i=r?e.offsetWidth:n,a=r?e.offsetHeight:s,o=fy(n)!==i||fy(s)!==a;return o&&(n=i,s=a),{width:n,height:s,$:o}}function cI(e){return qo(e)?e:e.contextElement}function Lp(e){const t=cI(e);if(!Ol(t))return Fl(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:i}=hX(t);let a=(i?fy(n.width):n.width)/s,o=(i?fy(n.height):n.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}const Jat=Fl(0);function fX(e){const t=wa(e);return!lI()||!t.visualViewport?Jat:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Zat(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==wa(e)?!1:t}function Yh(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=cI(e);let a=Fl(1);t&&(s?qo(s)&&(a=Lp(s)):a=Lp(e));const o=Zat(i,n,s)?fX(i):Fl(0);let l=(r.left+o.x)/a.x,u=(r.top+o.y)/a.y,d=r.width/a.x,f=r.height/a.y;if(i){const p=wa(i),g=s&&qo(s)?wa(s):s;let v=p,b=uA(v);for(;b&&s&&g!==v;){const x=Lp(b),_=b.getBoundingClientRect(),w=Ko(b),y=_.left+(b.clientLeft+parseFloat(w.paddingLeft))*x.x,S=_.top+(b.clientTop+parseFloat(w.paddingTop))*x.y;l*=x.x,u*=x.y,d*=x.x,f*=x.y,l+=y,u+=S,v=wa(b),b=uA(v)}}return my({width:d,height:f,x:l,y:u})}function uI(e,t){const n=QC(e).scrollLeft;return t?t.left+n:Yh(Gl(e)).left+n}function pX(e,t,n){n===void 0&&(n=!1);const s=e.getBoundingClientRect(),r=s.left+t.scrollLeft-(n?0:uI(e,s)),i=s.top+t.scrollTop;return{x:r,y:i}}function eot(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const i=r==="fixed",a=Gl(s),o=t?XC(t.floating):!1;if(s===a||o&&i)return n;let l={scrollLeft:0,scrollTop:0},u=Fl(1);const d=Fl(0),f=Ol(s);if((f||!f&&!i)&&((Og(s)!=="body"||wb(a))&&(l=QC(s)),Ol(s))){const g=Yh(s);u=Lp(s),d.x=g.x+s.clientLeft,d.y=g.y+s.clientTop}const p=a&&!f&&!i?pX(a,l,!0):Fl(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-l.scrollTop*u.y+d.y+p.y}}function tot(e){return Array.from(e.getClientRects())}function not(e){const t=Gl(e),n=QC(e),s=e.ownerDocument.body,r=kh(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),i=kh(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let a=-n.scrollLeft+uI(e);const o=-n.scrollTop;return Ko(s).direction==="rtl"&&(a+=kh(t.clientWidth,s.clientWidth)-r),{width:r,height:i,x:a,y:o}}function sot(e,t){const n=wa(e),s=Gl(e),r=n.visualViewport;let i=s.clientWidth,a=s.clientHeight,o=0,l=0;if(r){i=r.width,a=r.height;const u=lI();(!u||u&&t==="fixed")&&(o=r.offsetLeft,l=r.offsetTop)}return{width:i,height:a,x:o,y:l}}function rot(e,t){const n=Yh(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,i=Ol(e)?Lp(e):Fl(1),a=e.clientWidth*i.x,o=e.clientHeight*i.y,l=r*i.x,u=s*i.y;return{width:a,height:o,x:l,y:u}}function L6(e,t,n){let s;if(t==="viewport")s=sot(e,n);else if(t==="document")s=not(Gl(e));else if(qo(t))s=rot(t,n);else{const r=fX(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return my(s)}function gX(e,t){const n=ld(e);return n===t||!qo(n)||ug(n)?!1:Ko(n).position==="fixed"||gX(n,t)}function iot(e,t){const n=t.get(e);if(n)return n;let s=jv(e,[],!1).filter(o=>qo(o)&&Og(o)!=="body"),r=null;const i=Ko(e).position==="fixed";let a=i?ld(e):e;for(;qo(a)&&!ug(a);){const o=Ko(a),l=oI(a);!l&&o.position==="fixed"&&(r=null),(i?!l&&!r:!l&&o.position==="static"&&r&&["absolute","fixed"].includes(r.position)||wb(a)&&!l&&gX(e,a))?s=s.filter(u=>u!==a):r=o,a=ld(a)}return t.set(e,s),s}function aot(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const i=[...n==="clippingAncestors"?XC(t)?[]:iot(t,this._c):[].concat(n),s],a=i[0],o=i.reduce((l,u)=>{const d=L6(t,u,r);return l.top=kh(d.top,l.top),l.right=lg(d.right,l.right),l.bottom=lg(d.bottom,l.bottom),l.left=kh(d.left,l.left),l},L6(t,a,r));return{width:o.right-o.left,height:o.bottom-o.top,x:o.left,y:o.top}}function oot(e){const{width:t,height:n}=hX(e);return{width:t,height:n}}function lot(e,t,n){const s=Ol(t),r=Gl(t),i=n==="fixed",a=Yh(e,!0,i,t);let o={scrollLeft:0,scrollTop:0};const l=Fl(0);if(s||!s&&!i)if((Og(t)!=="body"||wb(r))&&(o=QC(t)),s){const p=Yh(t,!0,i,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else r&&(l.x=uI(r));const u=r&&!s&&!i?pX(r,o):Fl(0),d=a.left+o.scrollLeft-l.x-u.x,f=a.top+o.scrollTop-l.y-u.y;return{x:d,y:f,width:a.width,height:a.height}}function sE(e){return Ko(e).position==="static"}function B6(e,t){if(!Ol(e)||Ko(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Gl(e)===n&&(n=n.ownerDocument.body),n}function mX(e,t){const n=wa(e);if(XC(e))return n;if(!Ol(e)){let r=ld(e);for(;r&&!ug(r);){if(qo(r)&&!sE(r))return r;r=ld(r)}return n}let s=B6(e,t);for(;s&&Xat(s)&&sE(s);)s=B6(s,t);return s&&ug(s)&&sE(s)&&!oI(s)?n:s||Qat(e)||n}const cot=async function(e){const t=this.getOffsetParent||mX,n=this.getDimensions,s=await n(e.floating);return{reference:lot(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function uot(e){return Ko(e).direction==="rtl"}const dot={convertOffsetParentRelativeRectToViewportRelativeRect:eot,getDocumentElement:Gl,getClippingRect:aot,getOffsetParent:mX,getElementRects:cot,getClientRects:tot,getDimensions:oot,getScale:Lp,isElement:qo,isRTL:uot};function hot(e,t){let n=null,s;const r=Gl(e);function i(){var o;clearTimeout(s),(o=n)==null||o.disconnect(),n=null}function a(o,l){o===void 0&&(o=!1),l===void 0&&(l=1),i();const{left:u,top:d,width:f,height:p}=e.getBoundingClientRect();if(o||t(),!f||!p)return;const g=Wx(d),v=Wx(r.clientWidth-(u+f)),b=Wx(r.clientHeight-(d+p)),x=Wx(u),_={rootMargin:-g+"px "+-v+"px "+-b+"px "+-x+"px",threshold:kh(0,lg(1,l))||1};let w=!0;function y(S){const C=S[0].intersectionRatio;if(C!==l){if(!w)return a();C?a(!1,C):s=setTimeout(()=>{a(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(y,Zi({},_,{root:r.ownerDocument}))}catch{n=new IntersectionObserver(y,_)}n.observe(e)}return a(!0),i}function fot(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:l=!1}=s,u=cI(e),d=r||i?[...u?jv(u):[],...jv(t)]:[];d.forEach(_=>{r&&_.addEventListener("scroll",n,{passive:!0}),i&&_.addEventListener("resize",n)});const f=u&&o?hot(u,n):null;let p=-1,g=null;a&&(g=new ResizeObserver(_=>{let[w]=_;w&&w.target===u&&g&&(g.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var y;(y=g)==null||y.observe(t)})),n()}),u&&!l&&g.observe(u),g.observe(t));let v,b=l?Yh(e):null;l&&x();function x(){const _=Yh(e);b&&(_.x!==b.x||_.y!==b.y||_.width!==b.width||_.height!==b.height)&&n(),b=_,v=requestAnimationFrame(x)}return n(),()=>{var _;d.forEach(w=>{r&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),f?.(),(_=g)==null||_.disconnect(),g=null,l&&cancelAnimationFrame(v)}}const pot=zat,got=Kat,mot=qat,vot=Wat,bot=Yat,xot=(e,t,n)=>{const s=new Map,r=Zi({platform:dot},n),i=Zi({},r.platform,{_c:s});return Vat(e,t,Zi({},r,{platform:i}))};function _ot(e){e.cleanup&&e.cleanup();const t=e._getResolvedAttachToOptions();let n=t.element;const s=Eot(t,e),r=aX(t);return r&&(n=document.body,e.shepherdElementComponent.getElement().classList.add("shepherd-centered")),e.cleanup=fot(n,e.el,()=>{if(!e.el){e.cleanup==null||e.cleanup();return}Cot(n,e,s,r)}),e.target=t.element,s}function wot(e,t){return{floatingUIOptions:tI(e.floatingUIOptions||{},t.floatingUIOptions||{})}}function yot(e){e.cleanup&&e.cleanup(),e.cleanup=null}function Cot(e,t,n,s){return xot(e,t.el,n).then(Sot(t,s)).then(r=>new Promise(i=>{setTimeout(()=>i(r),300)})).then(r=>{r!=null&&r.el&&r.el.focus({preventScroll:!0})})}function Sot(e,t){return({x:n,y:s,placement:r,middlewareData:i})=>(e.el&&(t?Object.assign(e.el.style,{position:"fixed",left:"50%",top:"50%",transform:"translate(-50%, -50%)"}):Object.assign(e.el.style,{position:"absolute",left:`${n}px`,top:`${s}px`}),e.el.dataset.popperPlacement=r,kot(e.el,i)),e)}function kot(e,t){const n=e.querySelector(".shepherd-arrow");if(og(n)&&t.arrow){const{x:s,y:r}=t.arrow;Object.assign(n.style,{left:s!=null?`${s}px`:"",top:r!=null?`${r}px`:""})}}function Eot(e,t){var n,s,r;const i={strategy:"absolute"};i.middleware=[];const a=Tot(t),o=aX(e),l=(n=e.on)==null?void 0:n.includes("auto"),u=(e==null||(s=e.on)==null?void 0:s.includes("-start"))||(e==null||(r=e.on)==null?void 0:r.includes("-end"));if(!o){if(l){var d;i.middleware.push(pot({crossAxis:!0,alignment:u?e==null||(d=e.on)==null?void 0:d.split("-").pop():null}))}else i.middleware.push(mot());if(i.middleware.push(got({limiter:bot(),crossAxis:!0})),a){const f=typeof t.options.arrow=="object"?t.options.arrow:{padding:4};i.middleware.push(vot({element:a,padding:u?f.padding:0}))}l||(i.placement=e.on)}return tI(i,t.options.floatingUIOptions||{})}function Tot(e){return e.options.arrow&&e.el?e.el.querySelector(".shepherd-arrow"):!1}function Sa(){}function Rot(e,t){for(const n in t)e[n]=t[n];return e}function vX(e){return e()}function j6(){return Object.create(null)}function yb(e){e.forEach(vX)}function dI(e){return typeof e=="function"}function Xc(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Aot(e){return Object.keys(e).length===0}function dg(e,t){e.appendChild(t)}function el(e,t,n){e.insertBefore(t,n||null)}function po(e){e.parentNode&&e.parentNode.removeChild(e)}function Fot(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function Ll(e){return document.createElement(e)}function H6(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function bX(e){return document.createTextNode(e)}function vy(){return bX(" ")}function Dot(){return bX("")}function JC(e,t,n,s){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n,s)}function as(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}const Iot=["width","height"];function U6(e,t){const n=Object.getOwnPropertyDescriptors(e.__proto__);for(const s in t)t[s]==null?e.removeAttribute(s):s==="style"?e.style.cssText=t[s]:s==="__value"?e.value=e[s]=t[s]:n[s]&&n[s].set&&Iot.indexOf(s)===-1?e[s]=t[s]:as(e,s,t[s])}function Not(e){return Array.from(e.childNodes)}function Bf(e,t,n){e.classList.toggle(t,!!n)}let Hv;function D0(e){Hv=e}function xX(){if(!Hv)throw new Error("Function called outside component initialization");return Hv}function Pot(e){xX().$$.on_mount.push(e)}function hI(e){xX().$$.after_update.push(e)}const Jf=[],hg=[];let Bp=[];const G6=[],Mot=Promise.resolve();let dA=!1;function Oot(){dA||(dA=!0,Mot.then(_X))}function hA(e){Bp.push(e)}const rE=new Set;let jf=0;function _X(){if(jf!==0)return;const e=Hv;do{try{for(;jf<Jf.length;){const t=Jf[jf];jf++,D0(t),Lot(t.$$)}}catch(t){throw Jf.length=0,jf=0,t}for(D0(null),Jf.length=0,jf=0;hg.length;)hg.pop()();for(let t=0;t<Bp.length;t+=1){const n=Bp[t];rE.has(n)||(rE.add(n),n())}Bp.length=0}while(Jf.length);for(;G6.length;)G6.pop()();dA=!1,rE.clear(),D0(e)}function Lot(e){if(e.fragment!==null){e.update(),yb(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(hA)}}function Bot(e){const t=[],n=[];Bp.forEach(s=>e.indexOf(s)===-1?t.push(s):n.push(s)),n.forEach(s=>s()),Bp=t}const E_=new Set;let lh;function Eh(){lh={r:0,c:[],p:lh}}function Th(){lh.r||yb(lh.c),lh=lh.p}function zn(e,t){e&&e.i&&(E_.delete(e),e.i(t))}function Ys(e,t,n,s){if(e&&e.o){if(E_.has(e))return;E_.add(e),lh.c.push(()=>{E_.delete(e),s&&(n&&e.d(1),s())}),e.o(t)}else s&&s()}function V6(e){return e?.length!==void 0?e:Array.from(e)}function jot(e,t){const n={},s={},r={$$scope:1};let i=e.length;for(;i--;){const a=e[i],o=t[i];if(o){for(const l in a)l in o||(s[l]=1);for(const l in o)r[l]||(n[l]=o[l],r[l]=1);e[i]=o}else for(const l in a)r[l]=1}for(const a in s)a in n||(n[a]=void 0);return n}function ff(e){e&&e.c()}function _d(e,t,n){const{fragment:s,after_update:r}=e.$$;s&&s.m(t,n),hA(()=>{const i=e.$$.on_mount.map(vX).filter(dI);e.$$.on_destroy?e.$$.on_destroy.push(...i):yb(i),e.$$.on_mount=[]}),r.forEach(hA)}function wd(e,t){const n=e.$$;n.fragment!==null&&(Bot(n.after_update),yb(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Hot(e,t){e.$$.dirty[0]===-1&&(Jf.push(e),Oot(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function Qc(e,t,n,s,r,i,a=null,o=[-1]){const l=Hv;D0(e);const u=e.$$={fragment:null,ctx:[],props:i,update:Sa,not_equal:r,bound:j6(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:j6(),dirty:o,skip_bound:!1,root:t.target||l.$$.root};a&&a(u.root);let d=!1;if(u.ctx=n?n(e,t.props||{},(f,p,...g)=>{const v=g.length?g[0]:p;return u.ctx&&r(u.ctx[f],u.ctx[f]=v)&&(!u.skip_bound&&u.bound[f]&&u.bound[f](v),d&&Hot(e,f)),p}):[],u.update(),d=!0,yb(u.before_update),u.fragment=s?s(u.ctx):!1,t.target){if(t.hydrate){const f=Not(t.target);u.fragment&&u.fragment.l(f),f.forEach(po)}else u.fragment&&u.fragment.c();t.intro&&zn(e.$$.fragment),_d(e,t.target,t.anchor),_X()}D0(l)}class Jc{constructor(){this.$$=void 0,this.$$set=void 0}$destroy(){wd(this,1),this.$destroy=Sa}$on(t,n){if(!dI(n))return Sa;const s=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return s.push(n),()=>{const r=s.indexOf(n);r!==-1&&s.splice(r,1)}}$set(t){this.$$set&&!Aot(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Uot="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Uot);function Got(e){let t,n,s,r,i;return{c(){t=Ll("button"),as(t,"aria-label",n=e[3]?e[3]:null),as(t,"class",s=`${e[1]||""} shepherd-button ${e[4]?"shepherd-button-secondary":""}`),t.disabled=e[2],as(t,"tabindex","0"),as(t,"type","button")},m(a,o){el(a,t,o),t.innerHTML=e[5],r||(i=JC(t,"click",function(){dI(e[0])&&e[0].apply(this,arguments)}),r=!0)},p(a,[o]){e=a,o&32&&(t.innerHTML=e[5]),o&8&&n!==(n=e[3]?e[3]:null)&&as(t,"aria-label",n),o&18&&s!==(s=`${e[1]||""} shepherd-button ${e[4]?"shepherd-button-secondary":""}`)&&as(t,"class",s),o&4&&(t.disabled=e[2])},i:Sa,o:Sa,d(a){a&&po(t),r=!1,i()}}}function Vot(e,t,n){let{config:s,step:r}=t,i,a,o,l,u,d;function f(p){return od(p)?p=p.call(r):p}return e.$$set=p=>{"config"in p&&n(6,s=p.config),"step"in p&&n(7,r=p.step)},e.$$.update=()=>{e.$$.dirty&192&&(n(0,i=s.action?s.action.bind(r.tour):null),n(1,a=s.classes),n(2,o=s.disabled?f(s.disabled):!1),n(3,l=s.label?f(s.label):null),n(4,u=s.secondary),n(5,d=s.text?f(s.text):null))},[i,a,o,l,u,d,s,r]}class Wot extends Jc{constructor(t){super(),Qc(this,t,Vot,Got,Xc,{config:6,step:7})}}function W6(e,t,n){const s=e.slice();return s[2]=t[n],s}function $6(e){let t,n,s=V6(e[1]),r=[];for(let a=0;a<s.length;a+=1)r[a]=z6(W6(e,s,a));const i=a=>Ys(r[a],1,1,()=>{r[a]=null});return{c(){for(let a=0;a<r.length;a+=1)r[a].c();t=Dot()},m(a,o){for(let l=0;l<r.length;l+=1)r[l]&&r[l].m(a,o);el(a,t,o),n=!0},p(a,o){if(o&3){s=V6(a[1]);let l;for(l=0;l<s.length;l+=1){const u=W6(a,s,l);r[l]?(r[l].p(u,o),zn(r[l],1)):(r[l]=z6(u),r[l].c(),zn(r[l],1),r[l].m(t.parentNode,t))}for(Eh(),l=s.length;l<r.length;l+=1)i(l);Th()}},i(a){if(!n){for(let o=0;o<s.length;o+=1)zn(r[o]);n=!0}},o(a){r=r.filter(Boolean);for(let o=0;o<r.length;o+=1)Ys(r[o]);n=!1},d(a){a&&po(t),Fot(r,a)}}}function z6(e){let t,n;return t=new Wot({props:{config:e[2],step:e[0]}}),{c(){ff(t.$$.fragment)},m(s,r){_d(t,s,r),n=!0},p(s,r){const i={};r&2&&(i.config=s[2]),r&1&&(i.step=s[0]),t.$set(i)},i(s){n||(zn(t.$$.fragment,s),n=!0)},o(s){Ys(t.$$.fragment,s),n=!1},d(s){wd(t,s)}}}function $ot(e){let t,n,s=e[1]&&$6(e);return{c(){t=Ll("footer"),s&&s.c(),as(t,"class","shepherd-footer")},m(r,i){el(r,t,i),s&&s.m(t,null),n=!0},p(r,[i]){r[1]?s?(s.p(r,i),i&2&&zn(s,1)):(s=$6(r),s.c(),zn(s,1),s.m(t,null)):s&&(Eh(),Ys(s,1,1,()=>{s=null}),Th())},i(r){n||(zn(s),n=!0)},o(r){Ys(s),n=!1},d(r){r&&po(t),s&&s.d()}}}function zot(e,t,n){let s,{step:r}=t;return e.$$set=i=>{"step"in i&&n(0,r=i.step)},e.$$.update=()=>{e.$$.dirty&1&&n(1,s=r.options.buttons)},[r,s]}class qot extends Jc{constructor(t){super(),Qc(this,t,zot,$ot,Xc,{step:0})}}function Kot(e){let t,n,s,r,i;return{c(){t=Ll("button"),n=Ll("span"),n.textContent="×",as(n,"aria-hidden","true"),as(t,"aria-label",s=e[0].label?e[0].label:"Close Tour"),as(t,"class","shepherd-cancel-icon"),as(t,"type","button")},m(a,o){el(a,t,o),dg(t,n),r||(i=JC(t,"click",e[1]),r=!0)},p(a,[o]){o&1&&s!==(s=a[0].label?a[0].label:"Close Tour")&&as(t,"aria-label",s)},i:Sa,o:Sa,d(a){a&&po(t),r=!1,i()}}}function Yot(e,t,n){let{cancelIcon:s,step:r}=t;const i=a=>{a.preventDefault(),r.cancel()};return e.$$set=a=>{"cancelIcon"in a&&n(0,s=a.cancelIcon),"step"in a&&n(2,r=a.step)},[s,i,r]}class Xot extends Jc{constructor(t){super(),Qc(this,t,Yot,Kot,Xc,{cancelIcon:0,step:2})}}function Qot(e){let t;return{c(){t=Ll("h3"),as(t,"id",e[1]),as(t,"class","shepherd-title")},m(n,s){el(n,t,s),e[3](t)},p(n,[s]){s&2&&as(t,"id",n[1])},i:Sa,o:Sa,d(n){n&&po(t),e[3](null)}}}function Jot(e,t,n){let{labelId:s,element:r,title:i}=t;hI(()=>{od(i)&&n(2,i=i()),n(0,r.innerHTML=i,r)});function a(o){hg[o?"unshift":"push"](()=>{r=o,n(0,r)})}return e.$$set=o=>{"labelId"in o&&n(1,s=o.labelId),"element"in o&&n(0,r=o.element),"title"in o&&n(2,i=o.title)},[r,s,i,a]}class Zot extends Jc{constructor(t){super(),Qc(this,t,Jot,Qot,Xc,{labelId:1,element:0,title:2})}}function q6(e){let t,n;return t=new Zot({props:{labelId:e[0],title:e[2]}}),{c(){ff(t.$$.fragment)},m(s,r){_d(t,s,r),n=!0},p(s,r){const i={};r&1&&(i.labelId=s[0]),r&4&&(i.title=s[2]),t.$set(i)},i(s){n||(zn(t.$$.fragment,s),n=!0)},o(s){Ys(t.$$.fragment,s),n=!1},d(s){wd(t,s)}}}function K6(e){let t,n;return t=new Xot({props:{cancelIcon:e[3],step:e[1]}}),{c(){ff(t.$$.fragment)},m(s,r){_d(t,s,r),n=!0},p(s,r){const i={};r&8&&(i.cancelIcon=s[3]),r&2&&(i.step=s[1]),t.$set(i)},i(s){n||(zn(t.$$.fragment,s),n=!0)},o(s){Ys(t.$$.fragment,s),n=!1},d(s){wd(t,s)}}}function elt(e){let t,n,s,r=e[2]&&q6(e),i=e[3]&&e[3].enabled&&K6(e);return{c(){t=Ll("header"),r&&r.c(),n=vy(),i&&i.c(),as(t,"class","shepherd-header")},m(a,o){el(a,t,o),r&&r.m(t,null),dg(t,n),i&&i.m(t,null),s=!0},p(a,[o]){a[2]?r?(r.p(a,o),o&4&&zn(r,1)):(r=q6(a),r.c(),zn(r,1),r.m(t,n)):r&&(Eh(),Ys(r,1,1,()=>{r=null}),Th()),a[3]&&a[3].enabled?i?(i.p(a,o),o&8&&zn(i,1)):(i=K6(a),i.c(),zn(i,1),i.m(t,null)):i&&(Eh(),Ys(i,1,1,()=>{i=null}),Th())},i(a){s||(zn(r),zn(i),s=!0)},o(a){Ys(r),Ys(i),s=!1},d(a){a&&po(t),r&&r.d(),i&&i.d()}}}function tlt(e,t,n){let{labelId:s,step:r}=t,i,a;return e.$$set=o=>{"labelId"in o&&n(0,s=o.labelId),"step"in o&&n(1,r=o.step)},e.$$.update=()=>{e.$$.dirty&2&&(n(2,i=r.options.title),n(3,a=r.options.cancelIcon))},[s,r,i,a]}class nlt extends Jc{constructor(t){super(),Qc(this,t,tlt,elt,Xc,{labelId:0,step:1})}}function slt(e){let t;return{c(){t=Ll("div"),as(t,"class","shepherd-text"),as(t,"id",e[1])},m(n,s){el(n,t,s),e[3](t)},p(n,[s]){s&2&&as(t,"id",n[1])},i:Sa,o:Sa,d(n){n&&po(t),e[3](null)}}}function rlt(e,t,n){let{descriptionId:s,element:r,step:i}=t;hI(()=>{let{text:o}=i.options;od(o)&&(o=o.call(i)),og(o)?r.appendChild(o):n(0,r.innerHTML=o,r)});function a(o){hg[o?"unshift":"push"](()=>{r=o,n(0,r)})}return e.$$set=o=>{"descriptionId"in o&&n(1,s=o.descriptionId),"element"in o&&n(0,r=o.element),"step"in o&&n(2,i=o.step)},[r,s,i,a]}class ilt extends Jc{constructor(t){super(),Qc(this,t,rlt,slt,Xc,{descriptionId:1,element:0,step:2})}}function Y6(e){let t,n;return t=new nlt({props:{labelId:e[1],step:e[2]}}),{c(){ff(t.$$.fragment)},m(s,r){_d(t,s,r),n=!0},p(s,r){const i={};r&2&&(i.labelId=s[1]),r&4&&(i.step=s[2]),t.$set(i)},i(s){n||(zn(t.$$.fragment,s),n=!0)},o(s){Ys(t.$$.fragment,s),n=!1},d(s){wd(t,s)}}}function X6(e){let t,n;return t=new ilt({props:{descriptionId:e[0],step:e[2]}}),{c(){ff(t.$$.fragment)},m(s,r){_d(t,s,r),n=!0},p(s,r){const i={};r&1&&(i.descriptionId=s[0]),r&4&&(i.step=s[2]),t.$set(i)},i(s){n||(zn(t.$$.fragment,s),n=!0)},o(s){Ys(t.$$.fragment,s),n=!1},d(s){wd(t,s)}}}function Q6(e){let t,n;return t=new qot({props:{step:e[2]}}),{c(){ff(t.$$.fragment)},m(s,r){_d(t,s,r),n=!0},p(s,r){const i={};r&4&&(i.step=s[2]),t.$set(i)},i(s){n||(zn(t.$$.fragment,s),n=!0)},o(s){Ys(t.$$.fragment,s),n=!1},d(s){wd(t,s)}}}function alt(e){let t,n=!li(e[2].options.title)||e[2].options.cancelIcon&&e[2].options.cancelIcon.enabled,s,r=!li(e[2].options.text),i,a=Array.isArray(e[2].options.buttons)&&e[2].options.buttons.length,o,l=n&&Y6(e),u=r&&X6(e),d=a&&Q6(e);return{c(){t=Ll("div"),l&&l.c(),s=vy(),u&&u.c(),i=vy(),d&&d.c(),as(t,"class","shepherd-content")},m(f,p){el(f,t,p),l&&l.m(t,null),dg(t,s),u&&u.m(t,null),dg(t,i),d&&d.m(t,null),o=!0},p(f,[p]){p&4&&(n=!li(f[2].options.title)||f[2].options.cancelIcon&&f[2].options.cancelIcon.enabled),n?l?(l.p(f,p),p&4&&zn(l,1)):(l=Y6(f),l.c(),zn(l,1),l.m(t,s)):l&&(Eh(),Ys(l,1,1,()=>{l=null}),Th()),p&4&&(r=!li(f[2].options.text)),r?u?(u.p(f,p),p&4&&zn(u,1)):(u=X6(f),u.c(),zn(u,1),u.m(t,i)):u&&(Eh(),Ys(u,1,1,()=>{u=null}),Th()),p&4&&(a=Array.isArray(f[2].options.buttons)&&f[2].options.buttons.length),a?d?(d.p(f,p),p&4&&zn(d,1)):(d=Q6(f),d.c(),zn(d,1),d.m(t,null)):d&&(Eh(),Ys(d,1,1,()=>{d=null}),Th())},i(f){o||(zn(l),zn(u),zn(d),o=!0)},o(f){Ys(l),Ys(u),Ys(d),o=!1},d(f){f&&po(t),l&&l.d(),u&&u.d(),d&&d.d()}}}function olt(e,t,n){let{descriptionId:s,labelId:r,step:i}=t;return e.$$set=a=>{"descriptionId"in a&&n(0,s=a.descriptionId),"labelId"in a&&n(1,r=a.labelId),"step"in a&&n(2,i=a.step)},[s,r,i]}class llt extends Jc{constructor(t){super(),Qc(this,t,olt,alt,Xc,{descriptionId:0,labelId:1,step:2})}}function J6(e){let t;return{c(){t=Ll("div"),as(t,"class","shepherd-arrow"),as(t,"data-popper-arrow","")},m(n,s){el(n,t,s)},d(n){n&&po(t)}}}function clt(e){let t,n,s,r,i,a,o,l,u=e[4].options.arrow&&e[4].options.attachTo&&e[4].options.attachTo.element&&e[4].options.attachTo.on&&J6();s=new llt({props:{descriptionId:e[2],labelId:e[3],step:e[4]}});let d=[{"aria-describedby":r=li(e[4].options.text)?null:e[2]},{"aria-labelledby":i=e[4].options.title?e[3]:null},e[1],{open:"true"}],f={};for(let p=0;p<d.length;p+=1)f=Rot(f,d[p]);return{c(){t=Ll("dialog"),u&&u.c(),n=vy(),ff(s.$$.fragment),U6(t,f),Bf(t,"shepherd-has-cancel-icon",e[5]),Bf(t,"shepherd-has-title",e[6]),Bf(t,"shepherd-element",!0)},m(p,g){el(p,t,g),u&&u.m(t,null),dg(t,n),_d(s,t,null),e[13](t),a=!0,o||(l=JC(t,"keydown",e[7]),o=!0)},p(p,[g]){p[4].options.arrow&&p[4].options.attachTo&&p[4].options.attachTo.element&&p[4].options.attachTo.on?u||(u=J6(),u.c(),u.m(t,n)):u&&(u.d(1),u=null);const v={};g&4&&(v.descriptionId=p[2]),g&8&&(v.labelId=p[3]),g&16&&(v.step=p[4]),s.$set(v),U6(t,f=jot(d,[(!a||g&20&&r!==(r=li(p[4].options.text)?null:p[2]))&&{"aria-describedby":r},(!a||g&24&&i!==(i=p[4].options.title?p[3]:null))&&{"aria-labelledby":i},g&2&&p[1],{open:"true"}])),Bf(t,"shepherd-has-cancel-icon",p[5]),Bf(t,"shepherd-has-title",p[6]),Bf(t,"shepherd-element",!0)},i(p){a||(zn(s.$$.fragment,p),a=!0)},o(p){Ys(s.$$.fragment,p),a=!1},d(p){p&&po(t),u&&u.d(),wd(s),e[13](null),o=!1,l()}}}const ult=9,dlt=27,hlt=37,flt=39;function Z6(e){return e.split(" ").filter(t=>!!t.length)}function plt(e,t,n){let{classPrefix:s,element:r,descriptionId:i,firstFocusableElement:a,focusableElements:o,labelId:l,lastFocusableElement:u,step:d,dataStepId:f}=t,p,g,v;const b=()=>r;Pot(()=>{n(1,f={[`data-${s}shepherd-step-id`]:d.id}),n(9,o=r.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]')),n(8,a=o[0]),n(10,u=o[o.length-1])}),hI(()=>{v!==d.options.classes&&x()});function x(){_(v),v=d.options.classes,w(v)}function _(C){if(Bv(C)){const E=Z6(C);E.length&&r.classList.remove(...E)}}function w(C){if(Bv(C)){const E=Z6(C);E.length&&r.classList.add(...E)}}const y=C=>{const{tour:E}=d;switch(C.keyCode){case ult:if(o.length===0){C.preventDefault();break}C.shiftKey?(document.activeElement===a||document.activeElement.classList.contains("shepherd-element"))&&(C.preventDefault(),u.focus()):document.activeElement===u&&(C.preventDefault(),a.focus());break;case dlt:E.options.exitOnEsc&&(C.preventDefault(),C.stopPropagation(),d.cancel());break;case hlt:E.options.keyboardNavigation&&(C.preventDefault(),C.stopPropagation(),E.back());break;case flt:E.options.keyboardNavigation&&(C.preventDefault(),C.stopPropagation(),E.next());break}};function S(C){hg[C?"unshift":"push"](()=>{r=C,n(0,r)})}return e.$$set=C=>{"classPrefix"in C&&n(11,s=C.classPrefix),"element"in C&&n(0,r=C.element),"descriptionId"in C&&n(2,i=C.descriptionId),"firstFocusableElement"in C&&n(8,a=C.firstFocusableElement),"focusableElements"in C&&n(9,o=C.focusableElements),"labelId"in C&&n(3,l=C.labelId),"lastFocusableElement"in C&&n(10,u=C.lastFocusableElement),"step"in C&&n(4,d=C.step),"dataStepId"in C&&n(1,f=C.dataStepId)},e.$$.update=()=>{e.$$.dirty&16&&(n(5,p=d.options&&d.options.cancelIcon&&d.options.cancelIcon.enabled),n(6,g=d.options&&d.options.title))},[r,f,i,l,d,p,g,y,a,o,u,s,b,S]}class glt extends Jc{constructor(t){super(),Qc(this,t,plt,clt,Xc,{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 fA extends ZD{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?iX(this.tour.options.classPrefix):"",this.styles=t.styles,this._resolvedAttachTo=null,nI(this),this._setOptions(n),this}cancel(){this.tour.cancel(),this.trigger("cancel")}complete(){this.tour.complete(),this.trigger("complete")}destroy(){yot(this),og(this.el)&&(this.el.remove(),this.el=null),this._updateStepTargetOnHide(),this.trigger("destroy")}getTour(){return this.tour}hide(){var t;(t=this.tour.modal)==null||t.hide(),this.trigger("before-hide"),this.el&&(this.el.hidden=!0),this._updateStepTargetOnHide(),this.trigger("hide")}_resolveExtraHiglightElements(){return this._resolvedExtraHighlightElements=Iat(this),this._resolvedExtraHighlightElements}_resolveAttachToOptions(){return this._resolvedAttachTo=Dat(this),this._resolvedAttachTo}_getResolvedAttachToOptions(){return this._resolvedAttachTo===null?this._resolveAttachToOptions():this._resolvedAttachTo}isOpen(){return!!(this.el&&!this.el.hidden)}show(){return od(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 glt({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();od(this.options.scrollToHandler)?this.options.scrollToHandler(n):uat(n)&&typeof n.scrollIntoView=="function"&&n.scrollIntoView(t)}_getClassOptions(t){const n=this.tour&&this.tour.options&&this.tour.options.defaultStepOptions,s=t.classes?t.classes:"",r=n&&n.classes?n.classes:"",i=[...s.split(" "),...r.split(" ")],a=new Set(i);return Array.from(a).join(" ").trim()}_setOptions(t={}){let n=this.tour&&this.tour.options&&this.tour.options.defaultStepOptions;n=tI({},n||{}),this.options=Object.assign({arrow:!0},n,t,wot(n,t));const{when:s}=this.options;this.options.classes=this._getClassOptions(t),this.destroy(),this.id=this.options.id||`step-${oX()}`,s&&Object.keys(s).forEach(r=>{this.on(r,s[r],this)})}_setupElements(){li(this.el)||this.destroy(),this.el=this._createTooltipContent(),this.options.advanceOn&&Rat(this),_ot(this)}_show(){var t;this.trigger("before-show"),this._resolveAttachToOptions(),this._resolveExtraHiglightElements(),this._setupElements(),this.tour.modal||this.tour.setupModal(),(t=this.tour.modal)==null||t.setupForStep(this),this._styleTargetElementForStep(this),this.el&&(this.el.hidden=!1),this.options.scrollTo&&setTimeout(()=>{this._scrollTo(this.options.scrollTo)}),this.el&&(this.el.hidden=!1);const n=this.shepherdElementComponent.getElement(),s=this.target||document.body,r=this._resolvedExtraHighlightElements;s.classList.add(`${this.classPrefix}shepherd-enabled`),s.classList.add(`${this.classPrefix}shepherd-target`),n.classList.add("shepherd-enabled"),r?.forEach(i=>{i.classList.add(`${this.classPrefix}shepherd-enabled`),i.classList.add(`${this.classPrefix}shepherd-target`)}),this.trigger("show")}_styleTargetElementForStep(t){const n=t.target,s=t._resolvedExtraHighlightElements;if(!n)return;const r=t.options.highlightClass;r&&(n.classList.add(r),s?.forEach(i=>i.classList.add(r))),n.classList.remove("shepherd-target-click-disabled"),s?.forEach(i=>i.classList.remove("shepherd-target-click-disabled")),t.options.canClickTarget===!1&&(n.classList.add("shepherd-target-click-disabled"),s?.forEach(i=>i.classList.add("shepherd-target-click-disabled")))}_updateStepTargetOnHide(){const t=this.target||document.body,n=this._resolvedExtraHighlightElements,s=this.options.highlightClass;s&&(t.classList.remove(s),n?.forEach(r=>r.classList.remove(s))),t.classList.remove("shepherd-target-click-disabled",`${this.classPrefix}shepherd-enabled`,`${this.classPrefix}shepherd-target`),n?.forEach(r=>{r.classList.remove("shepherd-target-click-disabled",`${this.classPrefix}shepherd-enabled`,`${this.classPrefix}shepherd-target`)})}}function mlt(e){if(e){const{steps:t}=e;t.forEach(n=>{n.options&&n.options.canClickTarget===!1&&n.options.attachTo&&(og(n.target)&&n.target.classList.remove("shepherd-target-click-disabled"),n._resolvedExtraHighlightElements&&n._resolvedExtraHighlightElements.forEach(s=>{og(s)&&s.classList.remove("shepherd-target-click-disabled")}))})}}function vlt(e){let t="";const{innerWidth:n,innerHeight:s}=window;return e.forEach(r=>{const{width:i,height:a,x:o=0,y:l=0,r:u=0}=r,{topLeft:d=0,topRight:f=0,bottomRight:p=0,bottomLeft:g=0}=typeof u=="number"?{topLeft:u,topRight:u,bottomRight:u,bottomLeft:u}:u;t+=`M${o+d},${l} a${d},${d},0,0,0-${d},${d} V${a+l-g} a${g},${g},0,0,0,${g},${g} H${i+o-p} a${p},${p},0,0,0,${p}-${p} V${l+f} a${f},${f},0,0,0-${f}-${f} Z`}),`M${n},${s} H0 V0 H${n} V${s} Z ${t}`.replace(/\s/g,"")}function blt(e){let t,n,s,r,i;return{c(){t=H6("svg"),n=H6("path"),as(n,"d",e[2]),as(t,"class",s=`${e[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)},m(a,o){el(a,t,o),dg(t,n),e[11](t),r||(i=JC(t,"touchmove",e[3]),r=!0)},p(a,[o]){o&4&&as(n,"d",a[2]),o&2&&s!==(s=`${a[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)&&as(t,"class",s)},i:Sa,o:Sa,d(a){a&&po(t),e[11](null),r=!1,i()}}}function wX(e){if(!e)return null;const t=e instanceof HTMLElement&&window.getComputedStyle(e).overflowY;return t!=="hidden"&&t!=="visible"&&e.scrollHeight>=e.clientHeight?e:wX(e.parentElement)}function xlt(e){let t={top:0,left:0};if(!e)return t;let n=e.ownerDocument.defaultView;for(;n!==window.top;){var s;const a=(s=n)==null?void 0:s.frameElement;if(a){var r,i;const o=a.getBoundingClientRect();t.top+=o.top+((r=o.scrollTop)!=null?r:0),t.left+=o.left+((i=o.scrollLeft)!=null?i:0)}n=n.parent}return t}function _lt(e,t){const n=e.getBoundingClientRect();let s=n.y||n.top,r=n.bottom||s+n.height;if(t){const a=t.getBoundingClientRect(),o=a.y||a.top,l=a.bottom||o+a.height;s=Math.max(s,o),r=Math.min(r,l)}const i=Math.max(r-s,0);return{y:s,height:i}}function wlt(e,t,n){let{element:s,openingProperties:r}=t,i=!1,a,o;u();const l=()=>s;function u(){n(4,r=[{width:0,height:0,x:0,y:0,r:0}])}function d(){n(1,i=!1),_()}function f(S=0,C=0,E=0,k=0,F,A,I){if(A){const N=[A,...I||[]];n(4,r=[]);for(const P of N){if(!P||N.indexOf(P)!==N.lastIndexOf(P))continue;const{y:M,height:z}=_lt(P,F),{x:L,width:X,left:J}=P.getBoundingClientRect();N.some(re=>{if(re===P)return!1;const q=re.getBoundingClientRect();return L>=q.left&&L+X<=q.right&&M>=q.top&&M+z<=q.bottom})||r.push({width:X+S*2,height:z+S*2,x:(L||J)+E-S,y:M+k-S,r:C})}}else u()}function p(S){_(),S.tour.options.useModalOverlay?(w(S),g()):d()}function g(){n(1,i=!0)}const v=S=>{S.preventDefault()},b=S=>{S.stopPropagation()};function x(){window.addEventListener("touchmove",v,{passive:!1})}function _(){a&&(cancelAnimationFrame(a),a=void 0),window.removeEventListener("touchmove",v,{passive:!1})}function w(S){const{modalOverlayOpeningPadding:C,modalOverlayOpeningRadius:E,modalOverlayOpeningXOffset:k=0,modalOverlayOpeningYOffset:F=0}=S.options,A=xlt(S.target),I=wX(S.target),N=()=>{a=void 0,f(C,E,k+A.left,F+A.top,I,S.target,S._resolvedExtraHighlightElements),a=requestAnimationFrame(N)};N(),x()}function y(S){hg[S?"unshift":"push"](()=>{s=S,n(0,s)})}return e.$$set=S=>{"element"in S&&n(0,s=S.element),"openingProperties"in S&&n(4,r=S.openingProperties)},e.$$.update=()=>{e.$$.dirty&16&&n(2,o=vlt(r))},[s,i,o,b,r,l,u,d,f,p,g,y]}class ylt extends Jc{constructor(t){super(),Qc(this,t,wlt,blt,Xc,{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 Clt extends ZD{constructor(){super(),this.activeTour=void 0,nI(this)}}class Slt extends ZD{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,nI(this);const n={exitOnEsc:!0,keyboardNavigation:!0};return this.options=Object.assign({},n,t),this.classPrefix=iX(this.options.classPrefix),this.steps=[],this.addSteps(this.options.steps),["active","cancel","complete","inactive","show","start"].map(s=>{(r=>{this.on(r,i=>{i=i||{},i.tour=this,ch.trigger(r,i)})})(s)}),this._setTourID(t.id),this}addStep(t,n){let s=t;return s instanceof fA?s.tour=this:s=new fA(this,s),li(n)?this.steps.push(s):this.steps.splice(n,0,s),s}addSteps(t){return Array.isArray(t)&&t.forEach(n=>{this.addStep(n)}),this}back(){const t=this.steps.indexOf(this.currentStep);this.show(t-1,!1)}async cancel(){if(this.options.confirmCancel){const t=this.options.confirmCancelMessage||"Are you sure you want to stop the tour?";let n;od(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 ch.activeTour===this}next(){const t=this.steps.indexOf(this.currentStep);t===this.steps.length-1?this.complete():this.show(t+1,!0)}removeStep(t){const n=this.getCurrentStep();this.steps.some((s,r)=>{if(s.id===t)return s.isOpen()&&s.hide(),s.destroy(),this.steps.splice(r,1),!0}),n&&n.id===t&&(this.currentStep=void 0,this.steps.length?this.show(0):this.cancel())}show(t=0,n=!0){const s=Bv(t)?this.getById(t):this.steps[t];s&&(this._updateStateBeforeShow(),od(s.options.showOn)&&!s.options.showOn()?this._skipStep(s,n):(this.currentStep=s,this.trigger("show",{step:s,previous:this.currentStep}),s.show()))}async start(){this.trigger("start"),this.focusedElBeforeOpen=document.activeElement,this.currentStep=null,this.setupModal(),this._setupActiveTour(),this.next()}_done(t){const n=this.steps.indexOf(this.currentStep);if(Array.isArray(this.steps)&&this.steps.forEach(s=>s.destroy()),mlt(this),this.trigger(t,{index:n}),ch.activeTour=null,this.trigger("inactive",{tour:this}),this.modal&&this.modal.hide(),(t==="cancel"||t==="complete")&&this.modal){const s=document.querySelector(".shepherd-modal-overlay-container");s&&(s.remove(),this.modal=null)}og(this.focusedElBeforeOpen)&&this.focusedElBeforeOpen.focus()}_setupActiveTour(){this.trigger("active",{tour:this}),ch.activeTour=this}setupModal(){this.modal=new ylt({target:this.options.modalContainer||document.body,props:{styles:this.styles}})}_skipStep(t,n){const s=this.steps.indexOf(t);if(s===this.steps.length-1)this.complete();else{const r=n?s+1:s-1;this.show(r,n)}}_updateStateBeforeShow(){this.currentStep&&this.currentStep.hide(),this.isActive()||this._setupActiveTour()}_setTourID(t){const n=this.options.tourName||"tour",s=t||oX();this.id=`${n}--${s}`}}const ch=new Clt,yX=typeof window>"u";ch.Step=yX?Aat:fA;ch.Tour=yX?Fat:Slt;const ZC=m.createContext(void 0);ZC.Consumer;const klt=({children:e})=>cat.jsx(ZC.Provider,{value:{Shepherd:ch},children:e}),by=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),Elt=e=>by(e).replace(/"/g,"&quot;"),rt=e=>by(h(e)),Tlt=['<div class="tour-figure-rail" aria-hidden="true">','<span class="tour-figure-dot"></span>','<span class="tour-figure-dot"></span>','<span class="tour-figure-dot"></span>','<span class="tour-figure-rail-line"></span>',"</div>",'<div class="tour-figure-main" aria-hidden="true">','<span class="tour-figure-bubble tour-figure-bubble-in"></span>','<span class="tour-figure-bubble tour-figure-bubble-out"></span>','<span class="tour-figure-composer">','<span class="tour-figure-composer-line"></span>','<span class="tour-figure-send"></span>',"</span>","</div>"].join(""),Rlt=['<div class="tour-figure-flow" aria-hidden="true">','<div class="tour-figure-node">','<span class="tour-figure-node-icon"></span>','<span class="tour-figure-node-bar"></span>','<span class="tour-figure-node-bar tour-figure-node-bar-short"></span>',"</div>",'<span class="tour-figure-connector"></span>','<div class="tour-figure-node">','<span class="tour-figure-node-icon tour-figure-node-icon-round"></span>','<span class="tour-figure-node-bar"></span>','<span class="tour-figure-node-bar tour-figure-node-bar-short"></span>',"</div>",'<span class="tour-figure-connector"></span>','<div class="tour-figure-node">','<span class="tour-figure-node-icon tour-figure-node-icon-end"></span>','<span class="tour-figure-node-bar"></span>','<span class="tour-figure-node-bar tour-figure-node-bar-short"></span>',"</div>","</div>"].join(""),Alt={welcome:Tlt,"agent-capabilities":Rlt},e5=e=>e.map(t=>"key"in t?by(h(t.key)):`<code>${by(t.code)}</code>`).join(""),Flt=e=>{const t="<br/>".repeat(e.breaks??0);return e.kind==="paragraph"?`${e5(e.runs)}${t}`:e.kind==="list"?`<ul>${e.items.map(s=>`<li>${e5(s)}</li>`).join("")}</ul>${t}`:`<div class="tour-figure tour-figure-${e.figure}" role="img" aria-label="${Elt(h(e.altKey))}">${Alt[e.figure]}</div>${t}`},xn=e=>e.map(Flt).join(""),_n={welcome:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.welcome.body.1"}],breaks:1},{kind:"figure",figure:"welcome",altKey:"ui.onboarding.tour.welcome.image.1.alt",breaks:1},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.welcome.body.2"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.welcome.body.3"}],breaks:0},{kind:"list",items:[[{key:"ui.onboarding.tour.welcome.list.1.item.1"}],[{key:"ui.onboarding.tour.welcome.list.1.item.2"}],[{key:"ui.onboarding.tour.welcome.list.1.item.3"}],[{key:"ui.onboarding.tour.welcome.list.1.item.4"}],[{key:"ui.onboarding.tour.welcome.list.1.item.5"}],[{key:"ui.onboarding.tour.welcome.list.1.item.6"}],[{key:"ui.onboarding.tour.welcome.list.1.item.7"}]],breaks:0},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.welcome.body.4"}],breaks:0}],agent_list:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_list.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_list.body.2"}],breaks:0}],select_agent:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.select_agent.body.1"}],breaks:0}],chat_input:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.chat_input.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.chat_input.body.2"}],breaks:2},{kind:"list",items:[[{key:"ui.onboarding.tour.chat_input.list.1.item.1"}],[{key:"ui.onboarding.tour.chat_input.list.1.item.2"}],[{key:"ui.onboarding.tour.chat_input.list.1.item.3"}]],breaks:1},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.chat_input.body.3"}],breaks:0}],attachments:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.attachments.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.attachments.body.2"}],breaks:1},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.attachments.body.3"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.attachments.body.4"}],breaks:0}],agent_capabilities:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_capabilities.body.1"}],breaks:1},{kind:"figure",figure:"agent-capabilities",altKey:"ui.onboarding.tour.agent_capabilities.image.1.alt",breaks:1},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_capabilities.body.2"}],breaks:0}],pre_command_palette_open_canvas:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.1.1"},{code:_l("everything",!0)},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.connector.on_mac_and"},{code:_l("everything",!1)},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.1.3"},{code:"#"},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.1.4"},{code:"@"},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.1.5"},{code:","},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.1.6"},{code:">"},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.1.7"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.2.1"},{code:_l("chats",!0)},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.connector.on_mac_and"},{code:_l("chats",!1)},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.2.3"},{code:_l("commands",!0)},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.connector.on_mac_and"},{code:_l("commands",!1)},{key:"ui.onboarding.tour.pre_command_palette_open_canvas.body.2.5"}],breaks:0}],canvas_open_button:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_open_button.body.1"}],breaks:0}],canvas_feature:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_feature.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_feature.body.2"}],breaks:0}],canvas_documents_view:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_documents_view.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_documents_view.body.2"}],breaks:1},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_documents_view.body.3"}],breaks:1},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_documents_view.body.4"}],breaks:0}],canvas_files_view:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_files_view.body.1"}],breaks:0}],canvas_variables_view:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_variables_view.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.canvas_variables_view.body.2"}],breaks:0}],agent_options:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_options.body.1"}],breaks:0}],click_view_settings_from_chat:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.click_view_settings_from_chat.body.1"}],breaks:0}],view_agent_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.view_agent_settings.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.view_agent_settings.body.2"}],breaks:0}],select_provider:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.select_provider.body.1"}],breaks:0}],select_model:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.select_model.body.1"}],breaks:0}],modify_security_prompt:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.modify_security_prompt.body.1"}],breaks:0}],modify_agent_prompt:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.modify_agent_prompt.body.1"}],breaks:0}],create_new_agent:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.create_new_agent.body.1"}],breaks:0}],agent_naming_guidelines:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_naming_guidelines.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_naming_guidelines.body.2"}],breaks:0}],navigate_agent_hub:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.navigate_agent_hub.body.1"}],breaks:0}],agent_hub_view:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.agent_hub_view.body.1"}],breaks:0}],download_agent:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.download_agent.body.1"}],breaks:0}],upload_agent_hub:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.upload_agent_hub.body.1"}],breaks:0}],upload_agent_hub_dialog:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.upload_agent_hub_dialog.body.1"}],breaks:0}],navigate_schedules:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.navigate_schedules.body.1"}],breaks:0}],schedules_overview:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.schedules_overview.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.schedules_overview.body.2"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.schedules_overview.body.3"}],breaks:0}],create_schedule:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.create_schedule.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.create_schedule.body.2"}],breaks:0}],create_schedule_dialog:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.create_schedule_dialog.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.create_schedule_dialog.body.2"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.create_schedule_dialog.body.3"}],breaks:0}],navigate_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.navigate_settings.body.1"}],breaks:0}],general_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.general_settings.body.1"}],breaks:0}],appearance_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.appearance_settings.body.1"}],breaks:0}],radient_account_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.radient_account_settings.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.radient_account_settings.body.2"}],breaks:0}],integrations_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.integrations_settings.body.1"}],breaks:2},{kind:"paragraph",runs:[{key:"ui.onboarding.tour.integrations_settings.body.2"}],breaks:0}],application_updates_settings:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.application_updates_settings.body.1"}],breaks:0}],tour_complete:[{kind:"paragraph",runs:[{key:"ui.onboarding.tour.tour_complete.body.1"}],breaks:0}]},Dlt=e=>{const t=Array.from(document.querySelectorAll(`[data-tour-tag="${e}"]`));return t.find(n=>n.offsetParent!==null)??t[0]??null},t5=e=>{document.querySelector(`[data-tour-action="${e}"]`)?.click()},CX=1340,fI="tour-beside-palette",e1="pre-command-palette-open-canvas",SX='[data-tour-tag="command-palette-dialog"]',us=e=>p8($m())!=="rtl"?e:e==="left"?"right":"left",Ilt=e=>(e.getById(e1)?.options.classes??"").split(" ").includes(fI),kX=(e,t)=>{const n=e.getById(e1);!n||Ilt(e)===t||n.updateStepOptions(t?{attachTo:{element:SX,on:us("right")},classes:fI}:{attachTo:void 0,classes:void 0})},EX=e=>{const t=window.innerWidth>=CX;return kX(e,t),t};let pI=0;const pA=new WeakMap;et.subscribe((e,t)=>{t.isCommandPaletteOpen&&!e.isCommandPaletteOpen&&(pI+=1)});const TX=e=>{const t=pA.get(e);return t===void 0||(pA.delete(e),t!==pI)?!1:(et.getState().closeCommandPalette(),!0)},n5=(e,t)=>{if(!EX(e)){t();return}const n=et.getState();n.isCommandPaletteOpen||(n.openCommandPalette(),pA.set(e,pI)),setTimeout(()=>{e.isActive()&&t()},500)},s5=(e,t)=>{if(!TX(e)){t();return}setTimeout(()=>{e.isActive()&&t()},500)},r5=e=>{const t=e?.step;if(t?.id!==e1)return;(!EX(t.tour)||document.querySelector(SX)===null)&&kX(t.tour,!1)},Nlt=()=>{const e=window.innerWidth>=CX;return{id:e1,...e?{attachTo:{element:'[data-tour-tag="command-palette-dialog"]',on:us("right")},classes:fI}:{},title:rt("ui.onboarding.tour.pre_command_palette_open_canvas.title"),text:xn(_n.pre_command_palette_open_canvas),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){s5(this,()=>this.back())}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){s5(this,()=>this.next())}}]}},RX=()=>[{id:"welcome",title:rt("ui.onboarding.tour.welcome.title"),text:xn(_n.welcome),buttons:[{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"agent-list",attachTo:{element:'[data-tour-tag="agent-list-panel"]',on:us("right")},title:rt("ui.onboarding.tour.agent_list.title"),text:xn(_n.agent_list),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"select-agent",attachTo:{element:'[data-tour-tag="agent-list-item-button-0"]',on:us("right")},title:rt("ui.onboarding.tour.select_agent.title"),text:xn(_n.select_agent),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="agent-list-item-button-0"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"chat-input",attachTo:{element:'[data-tour-tag="chat-input-textarea"]',on:"top"},title:rt("ui.onboarding.tour.chat_input.title"),text:xn(_n.chat_input),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"attachments",attachTo:{element:'button[data-tour-tag="chat-input-attach-file-button"]',on:"top"},title:rt("ui.onboarding.tour.attachments.title"),text:xn(_n.attachments),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"agent-capabilities",attachTo:{element:'[data-tour-tag="chat-header"]',on:"top"},title:rt("ui.onboarding.tour.agent_capabilities.title"),text:xn(_n.agent_capabilities),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){n5(this,()=>this.next())}}]},Nlt(),{id:"canvas-open-button",attachTo:{element:'button[data-tour-tag="open-canvas-button"]',on:us("left")},title:rt("ui.onboarding.tour.canvas_open_button.title"),text:xn(_n.canvas_open_button),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){n5(this,()=>this.back())}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="open-canvas-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-feature",attachTo:{element:'[data-tour-tag="canvas-container"]',on:us("left")},title:rt("ui.onboarding.tour.canvas_feature.title"),text:xn(_n.canvas_feature),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="close-canvas-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-documents-view-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-documents-view",attachTo:{element:'button[data-tour-tag="canvas-documents-view-button"]',on:"top"},title:rt("ui.onboarding.tour.canvas_documents_view.title"),text:xn(_n.canvas_documents_view),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-files-view-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-files-view",attachTo:{element:'button[data-tour-tag="canvas-files-view-button"]',on:"top"},title:rt("ui.onboarding.tour.canvas_files_view.title"),text:xn(_n.canvas_files_view),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-documents-view-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-variables-view-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-variables-view",attachTo:{element:'button[data-tour-tag="canvas-variables-view-button"]',on:"top"},title:rt("ui.onboarding.tour.canvas_variables_view.title"),text:xn(_n.canvas_variables_view),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-files-view-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="close-canvas-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"agent-options",attachTo:{element:'button[data-tour-tag="agent-options-button"]',on:us("right")},title:rt("ui.onboarding.tour.agent_options.title"),text:xn(_n.agent_options),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="open-canvas-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="agent-options-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"click-view-settings-from-chat",attachTo:{element:'[role="menuitem"][data-tour-tag="view-agent-settings-menu-item"]',on:us("right")},title:rt("ui.onboarding.tour.click_view_settings_from_chat.title"),text:xn(_n.click_view_settings_from_chat),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[role="menuitem"][data-tour-tag="view-agent-settings-menu-item"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"view-agent-settings",attachTo:{element:'div[data-tour-tag="agent-settings-details-paper"]',on:us("left")},title:rt("ui.onboarding.tour.view_agent_settings.title"),text:xn(_n.view_agent_settings),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-chat"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('button[data-tour-tag="agent-options-button"]');t&&t.click()},500),setTimeout(()=>{this.back()},1e3)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"select-provider",attachTo:{element:'[data-tour-tag="agent-settings-hosting-select"]',on:us("left")},title:rt("ui.onboarding.tour.select_provider.title"),text:xn(_n.select_provider),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"select-model",attachTo:{element:'[data-tour-tag="agent-settings-model-select"]',on:us("left")},title:rt("ui.onboarding.tour.select_model.title"),text:xn(_n.select_model),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"modify-security-prompt",attachTo:{element:'[data-tour-tag="agent-settings-security"]',on:us("left")},title:rt("ui.onboarding.tour.modify_security_prompt.title"),text:xn(_n.modify_security_prompt),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"modify-agent-prompt",attachTo:{element:'[data-tour-tag="agent-settings-system-prompt"]',on:us("left")},title:rt("ui.onboarding.tour.modify_agent_prompt.title"),text:xn(_n.modify_agent_prompt),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"create-new-agent",attachTo:{element:'button[data-tour-tag="create-new-agent-button"]',on:"bottom"},title:rt("ui.onboarding.tour.create_new_agent.title"),text:xn(_n.create_new_agent),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="agent-list-item-button-0"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('button[data-tour-tag="agent-options-button"]');t&&t.click()},500),setTimeout(()=>{const t=document.querySelector('[role="menuitem"][data-tour-tag="view-agent-settings-menu-item"]');t&&t.click()},1e3),setTimeout(()=>{this.back()},1500)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="create-new-agent-button"]');e&&e.click(),setTimeout(()=>{this.next()},1e3)}}]},{id:"agent-naming-guidelines",attachTo:{element:'[data-tour-tag="create-agent-dialog"]',on:us("right")},title:rt("ui.onboarding.tour.agent_naming_guidelines.title"),text:xn(_n.agent_naming_guidelines),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="create-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="create-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"navigate-agent-hub",attachTo:{element:'[data-tour-tag="nav-item-agent-hub"]',on:us("right")},title:rt("ui.onboarding.tour.navigate_agent_hub.title"),text:xn(_n.navigate_agent_hub),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('[data-tour-tag="create-new-agent-button"]');t&&t.click()},500),setTimeout(()=>{this.back()},1e3)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agent-hub"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"agent-hub-view",attachTo:{element:'[data-tour-tag="agent-hub-sidebar-container"]',on:us("right")},title:rt("ui.onboarding.tour.agent_hub_view.title"),text:xn(_n.agent_hub_view),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"download-agent",attachTo:{element:'button[data-tour-tag="agent-hub-download-button"]',on:"bottom"},title:rt("ui.onboarding.tour.download_agent.title"),text:xn(_n.download_agent),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{this.next()},1e3)}}]},{id:"upload-agent-hub",attachTo:{element:()=>Dlt("upload-to-hub-header-button"),on:"bottom"},title:rt("ui.onboarding.tour.upload_agent_hub.title"),text:xn(_n.upload_agent_hub),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agent-hub"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){t5("open-upload-dialog"),setTimeout(()=>{this.next()},500)}}]},{id:"upload-agent-hub-dialog",attachTo:{element:'[data-tour-tag="upload-agent-dialog"]',on:us("right")},title:rt("ui.onboarding.tour.upload_agent_hub_dialog.title"),text:xn(_n.upload_agent_hub_dialog),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="upload-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="upload-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"navigate-schedules",attachTo:{element:'[data-tour-tag="nav-item-schedules"]',on:us("right")},title:rt("ui.onboarding.tour.navigate_schedules.title"),text:xn(_n.navigate_schedules),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{t5("open-upload-dialog")},500),setTimeout(()=>{this.back()},1e3)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-schedules"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"schedules-overview",title:rt("ui.onboarding.tour.schedules_overview.title"),text:xn(_n.schedules_overview),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"create-schedule",attachTo:{element:'button[data-tour-tag="create-schedule-button"]',on:"bottom"},title:rt("ui.onboarding.tour.create_schedule.title"),text:xn(_n.create_schedule),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="create-schedule-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"create-schedule-dialog",attachTo:{element:'[data-tour-tag="create-schedule-dialog"]',on:us("right")},title:rt("ui.onboarding.tour.create_schedule_dialog.title"),text:xn(_n.create_schedule_dialog),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="create-schedule-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="create-schedule-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"navigate-settings",attachTo:{element:'[data-tour-tag="nav-item-settings"]',on:us("right")},title:rt("ui.onboarding.tour.navigate_settings.title"),text:xn(_n.navigate_settings),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-schedules"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('button[data-tour-tag="create-schedule-button"]');t&&t.click()},500),setTimeout(()=>{this.back()},1e3)}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-settings"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"general-settings",attachTo:{element:'div[data-tour-tag="settings-general-section"]',on:us("right")},title:rt("ui.onboarding.tour.general_settings.title"),text:xn(_n.general_settings),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"appearance-settings",attachTo:{element:'[data-tour-tag="settings-appearance-section"]',on:us("right")},title:rt("ui.onboarding.tour.appearance_settings.title"),text:xn(_n.appearance_settings),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"radient-account-settings",attachTo:{element:'[data-tour-tag="settings-radient-account-section"]',on:us("right")},title:rt("ui.onboarding.tour.radient_account_settings.title"),text:xn(_n.radient_account_settings),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"integrations-settings",attachTo:{element:'[data-tour-tag="settings-integrations-section"]',on:us("right")},title:rt("ui.onboarding.tour.integrations_settings.title"),text:xn(_n.integrations_settings),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"application-updates-settings",attachTo:{element:'[data-tour-tag="settings-app-updates-section"]',on:us("right")},title:rt("ui.onboarding.tour.application_updates_settings.title"),text:xn(_n.application_updates_settings),buttons:[{text:rt("ui.onboarding.tour.action.back"),classes:"shepherd-button-secondary",action:function(){this.back()}},{text:rt("ui.onboarding.tour.action.next"),classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"tour-complete",title:rt("ui.onboarding.tour.tour_complete.title"),text:xn(_n.tour_complete),buttons:[{text:rt("ui.onboarding.tour.action.finish"),classes:"shepherd-button-primary",action:function(){this.complete()}}]}],AX=()=>({enabled:!0,label:h("ui.onboarding.tour.action.close")}),gA=new WeakMap,Plt=(e,t)=>{gA.set(e,t)},Mlt=(e,t)=>{if(gA.get(e)===t)return;const n=new Map(RX().filter(r=>r.id).map(r=>[r.id,r])),s=AX();for(const r of e.steps){const i=r.id?n.get(r.id):void 0;i&&r.updateStepOptions({title:i.title,text:i.text,buttons:i.buttons,cancelIcon:s})}e.options.defaultStepOptions={...e.options.defaultStepOptions,cancelIcon:s},gA.set(e,t)},i5=new WeakMap,Olt=e=>{const t=i5.get(e);if(t)return t;const n=()=>TX(e);return i5.set(e,n),n},Llt=()=>{const e=Yr(),{completeTourOnboarding:t}=j0(),n=m.useContext(ZC),s=Ge(),r={cancelIcon:AX(),scrollTo:{behavior:"smooth",block:"center"}},i=!0,a=o=>{if(n?.tour?.isActive()&&!o?.forceModalCompleted){console.log("Onboarding tour is already active (from context.tour). Not starting another.");return}const l=j0.getState();if(!o?.forceModalCompleted&&!l.isModalComplete){console.log("Onboarding modal not completed (checked via store). Tour will not start.");return}if(l.isTourComplete&&!o?.forceModalCompleted){console.log("Onboarding tour already completed in store and not forced. Not starting again.");return}let u=n?.tour;const d=n?.Shepherd;if(!u&&d&&(u=d.activeTour,!u&&d.Tour&&(console.log("No active Shepherd tour found from context or global. Creating a new one."),u=new d.Tour({useModalOverlay:i,defaultStepOptions:r}))),!u){console.warn("Failed to get or create a Shepherd tour instance.",n);return}if(u.isActive()){console.log("Tour is already active. Not starting again.");return}u.options.defaultStepOptions={...u.options.defaultStepOptions||{},...r},u.options.useModalOverlay=i,o?.firstAgentId&&(u.options.firstAgentId=o.firstAgentId),u.off("complete",t),u.on("complete",t),u.off("cancel",t),u.on("cancel",t);const f=Olt(u);u.off("complete",f),u.on("complete",f),u.off("cancel",f),u.on("cancel",f),u.off("show",r5),u.on("show",r5);const p=RX();if(o?.forceModalCompleted||!u.isActive()){const g=[...u.steps];for(const v of g)v.id&&u.removeStep(v.id);u.addSteps(p)}else u.steps.length===0&&u.addSteps(p);Plt(u,$m()),typeof u.start=="function"?(e("/"),u.start()):console.warn("Shepherd tour instance does not have a start method.",u)};return m.useEffect(()=>{const o=n?.tour??n?.Shepherd?.activeTour;o?.isActive()&&Mlt(o,s)},[s,n]),{startTour:a}},Blt=()=>{const{isModalComplete:e,isTourComplete:t}=j0(),{startTour:n}=Llt(),s=st.useContext(ZC),{data:r}=mT(1,1);return m.useEffect(()=>{if(e&&!t&&s){const i=setTimeout(()=>{const a=r?.agents?.[0]?.id;n({firstAgentId:a})},500);return()=>clearTimeout(i)}},[e,t,s,n,r]),null},jlt=({children:e})=>c.jsxs(klt,{children:[e,c.jsx(Blt,{})]}),Hlt=()=>{Ge();const{open:e,focusGroup:t,providerId:n,closeConnect:s}=pH(),r=m.useRef(null);m.useEffect(()=>{e&&(r.current=document.activeElement instanceof HTMLElement?document.activeElement:null)},[e]);const i=Yr();return c.jsx(Hc,{open:e,onOpenChange:a=>{a||s()},children:c.jsxs(Uc,{className:"max-h-[calc(100vh-4rem)] max-w-[min(40rem,calc(100vw-4rem))] gap-4 overflow-y-auto","data-connect-provider-dialog":"",onCloseAutoFocus:a=>{const o=r.current;r.current=null,o?.isConnected&&(a.preventDefault(),o.focus())},children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx(Dl,{className:"text-title",children:h("ui.providers.connect_provider_dialog.connect_a_model_provider")}),c.jsx(cd,{className:"text-body-sm text-ink-muted",children:h("ui.providers.connect_provider_dialog.your_agents_need_a_model_to_think")})]}),e?c.jsx(tX,{context:"dialog",featuredOnly:!0,focusGroup:t,initialProviderId:n,onDone:s,onChangeModel:()=>{s(),i("/settings")}}):null]})})};function Ult(){const{visible:e,rows:t,cursor:n,commitAt:s,hoverAt:r}=joe();Fu(e,"session-switcher");const i=n!==null&&e?t[n]??null:null,a=e&&t.length>=2;return c.jsxs(c.Fragment,{children:[c.jsx("output",{"aria-live":"polite",className:"sr-only","data-session-switcher-announcement":"",children:i!==null&&n!==null?c.jsxs(c.Fragment,{children:[FX(i),", ",n+1," / ",t.length]}):null}),a?qv.createPortal(c.jsx("div",{className:"pointer-events-none fixed inset-0 z-50 flex items-start justify-center pt-[18vh]",children:c.jsx("div",{role:"dialog","aria-modal":"false","aria-label":h("ui.command_palette.palette_search.recents"),className:"pointer-events-auto w-160 max-w-[90vw] rounded-lg border border-hairline bg-elevated p-2 shadow-overlay",children:t.map((o,l)=>c.jsx(Wlt,{row:o,active:l===n,onCommit:()=>s(l),onHover:()=>r(l)},o.sessionId))})}),document.body):null]})}function FX(e){return e.title??h("ui.command_palette.palette_search.untitled_chat")}const Glt=1e3;function Vlt(){let e=0;function t(){window.clearTimeout(e),window.removeEventListener("contextmenu",n,!0),window.removeEventListener("pointerup",t,!0)}function n(s){s.preventDefault(),s.stopPropagation(),t()}e=window.setTimeout(t,Glt),window.addEventListener("contextmenu",n,!0),window.addEventListener("pointerup",t,!0)}function Wlt({row:e,active:t,onCommit:n,onHover:s}){return c.jsxs("button",{type:"button",tabIndex:-1,"aria-current":t?"true":void 0,"data-session-id":e.sessionId,onPointerDown:r=>{r.button===0&&(r.preventDefault(),Vlt(),n())},onMouseDown:r=>r.preventDefault(),onContextMenu:r=>r.preventDefault(),onMouseMove:s,className:R("flex h-9 w-full items-center gap-3 rounded-sm px-2 text-left",t?"bg-sunken outline-solid outline-1 -outline-offset-1 outline-control":"bg-transparent"),children:[e.row===null?c.jsx("span",{"aria-hidden":"true",className:"size-4 shrink-0"}):c.jsx(dy,{row:e.row}),c.jsx("span",{className:R("min-w-0 flex-1 truncate text-body-sm",e.title===null?"text-ink-muted":"text-ink"),children:FX(e)})]})}const DX=({title:e,description:t,icon:n,children:s,titleComponent:r,sectionRef:i,dataTourTag:a,className:o,id:l,searchSection:u,searchSectionLabel:d,searchIgnore:f})=>c.jsxs("div",{ref:i,id:l,"data-search-section":u,"data-search-section-label":d,"data-search-ignore":f,tabIndex:l?-1:void 0,"data-tour-tag":a,className:R("w-full",o),children:[r??c.jsxs("h2",{className:"flex items-center gap-2 text-heading text-ink",children:[n&&c.jsx(n,{size:16,className:"shrink-0 text-ink-dim"}),e]}),t&&c.jsx("p",{className:"mt-1 max-w-2xl text-body-sm text-ink-muted",children:t}),c.jsx("div",{className:"mt-4",children:s})]}),ppt=({label:e,value:t,className:n,valueClassName:s})=>c.jsxs("div",{className:R("min-w-0",n),children:[c.jsx("div",{className:"flex items-center gap-1.5 text-meta text-ink-dim",children:e}),c.jsx("div",{className:R("mt-0.5 break-words text-body-sm",s??"text-ink"),children:t})]}),gpt=({children:e,className:t})=>c.jsx("div",{className:R("grid grid-cols-[repeat(auto-fit,minmax(160px,1fr))] gap-x-6 gap-y-4",t),children:e});function IX({id:e,rank:t,action:n,settingKey:s,help:r,hint:i,ariaLabel:a,value:o,fieldRef:l,saving:u,showReset:d,onReset:f,onKeyDown:p,onKeyUp:g,onBlur:v,notes:b,error:x,focusKey:_}){const w=m.useRef(!1);return m.useEffect(()=>{if(_!==s||w.current)return;const y=l.current;y&&(w.current=!0,y.scrollIntoView?.({block:"center"}),y.focus())},[_,s,l]),c.jsxs("div",{className:"group flex min-w-0 flex-col gap-1","data-speech-rank":t,"data-search-row":`keyboard.${s}`,"data-search-label":n,"data-search-terms":s,"data-search-control":!0,children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsxs("div",{className:"flex w-32 flex-col",children:[c.jsx(cr,{htmlFor:e,className:"text-body-sm text-ink",children:t==="primary"?h("ui.settings.shortcuts.speech.primary"):h("ui.settings.shortcuts.speech.secondary")}),c.jsx("span",{className:"text-meta text-ink-muted",children:n})]}),c.jsx(vs,{ref:l,id:e,"aria-label":a,"aria-describedby":`${e}-hint ${e}-notes ${e}-status`,"aria-invalid":x?!0:void 0,"aria-busy":u,"data-shortcut-action":s,className:"w-52 text-left font-mono text-body-sm",value:o,readOnly:!0,onKeyDown:p,onKeyUp:g,onBlur:v}),d&&c.jsx(ce,{variant:"secondary",size:"sm",disabled:u,"aria-label":h("ui.settings.shortcuts.keyboard_shortcuts_section.reset_label_to_its_default",{label:n}),onClick:f,children:h("ui.settings.shortcuts.keyboard_shortcuts_section.reset")})]}),c.jsxs("div",{className:"ml-0 max-w-88 text-meta text-ink-muted sm:ml-34",children:[c.jsx("p",{children:r}),c.jsx("p",{id:`${e}-hint`,className:"hidden group-focus-within:block",children:i}),c.jsx("div",{id:`${e}-notes`,children:b}),c.jsx("output",{id:`${e}-status`,className:"block","aria-live":"polite",children:u?h("ui.settings.configuration.backend_setting_row.saving"):x?c.jsx("span",{className:"text-danger",children:x}):null})]})]})}function NX({settingKey:e,refetch:t,fieldRef:n,onPending:s,onSaved:r}){const[i,a]=m.useState(!1),[o,l]=m.useState(null),[u,d]=m.useState(!1);return m.useEffect(()=>{!u||i||(n.current?.focus(),d(!1))},[u,i,n]),{saving:i,error:o,setError:l,write:async(p,g)=>{if(!(e===void 0||i||p==="settings.edit"&&g===void 0)){a(!0),l(null),s?.(g);try{await nt(p==="settings.edit"?{op:p,key:e,value:g??""}:{op:p,key:e}),r?.(p,g),await t()}catch(v){let b;if(v instanceof Pi){const x=v.detail;typeof x=="object"&&x!==null&&"code"in x&&x.code==="keymap.conflict"&&"label"in x&&typeof x.label=="string"&&(b=h("ui.settings.shortcuts.capture.already_assigned",{label:x.label}))}l(b??(v instanceof Error?v.message:h(p==="settings.edit"?"ui.settings.configuration.backend_settings_section.the_setting_could_not_be_saved":"ui.settings.configuration.backend_settings_section.the_setting_could_not_be_reset")))}finally{s?.(),a(!1),d(!0)}}}}}function PX(e,t,n,s=[]){const r=/^(Alt|Meta|Control)/.exec(e)?.[1],i=o=>r==="Control"?o.includes("ctrl")||o.includes("primary"):r==="Meta"?o.includes("meta")||t==="darwin"&&o.includes("primary"):r==="Alt"&&o.includes("alt"),a=o=>o.split("+").slice(0,-1);return s.find(o=>i(a(o)))??n.find(o=>i(a(o)))??null}function $lt(e,t,n){const s=e.split("+"),r=s.at(-1)??"",i=o=>o==="primary"?t==="Control"||t==="Command"?t:n==="darwin"?"Command":"Control":o==="ctrl"?"Control":o==="shift"?"Shift":o==="alt"?n==="darwin"?"Option":"Alt":o==="meta"?n==="darwin"?"Command":n==="win32"?"Windows":"Super":o,a=r.length===1?r.toUpperCase():r.charAt(0).toUpperCase()+r.slice(1);return[...s.slice(0,-1).map(i),a].join("+")}function zlt(e,t,n,s){for(const r of["AltRight","ControlRight","MetaRight"]){const i=_H(r,t);if(i===null)continue;const a=Gd(i);if(!(!a||a.code===e)&&!PX(r,t,n,s))return a.label}return null}const qlt=/^(Alt|Meta|Control|Shift)(Left|Right)$/,iE=e=>e.split("-").slice(1).join("-");function Klt({setting:e,refetch:t,focusKey:n}){const s=r2(),r=et(F=>F.shortcutBindings),i=m.useRef(null),a=m.useId(),o=m.useMemo(()=>Pae(),[]),l=m.useRef(null),u=typeof e.default=="string"?e.default:oP,{saving:d,error:f,setError:p,write:g}=NX({settingKey:e.key,refetch:t,fieldRef:i,onSaved:(F,A)=>Mae(F==="settings.edit"?A:u)}),v=h("ui.settings.shortcuts.speech.push_to_talk_hold"),b=typeof e.value=="string"?e.value:"",x=Gd(b)??Gd(u)??Gd(oP),_=Gd(b)?.code===Gd(u)?.code,w=ky.flatMap(F=>{const A=TA(F.id,r);return A?[A]:[]}),y=s.canonical?[s.canonical]:[],S=x===null?null:PX(x.code,o,w,y),C=S===null||x===null?null:zlt(x.code,o,w,y),E=h("ui.settings.shortcuts.speech.push_to_talk_letter_pointer"),k=()=>p(h("ui.settings.shortcuts.speech.push_to_talk_refused",{platform:o}));return c.jsx(IX,{id:a,rank:"secondary",action:v,settingKey:e.key,focusKey:n,help:e.help,hint:`${h("ui.settings.shortcuts.speech.push_to_talk_hint")} ${E}`,ariaLabel:h("ui.settings.configuration.setting_control.label_press_the_key_you_want",{label:v}),value:x?.label??"",fieldRef:i,saving:d,showReset:!_,onReset:()=>void g("settings.reset"),onBlur:()=>{l.current=null,p(null)},onKeyDown:F=>{if(d)return;if(F.repeat||F.nativeEvent.isComposing){DE.has(F.key)||F.preventDefault();return}const A=l.current!==null;if(l.current&&(l.current.tainted=!0),DE.has(F.key)){A&&k();return}if(U_.has(F.key)){l.current=null,p(null),F.preventDefault();return}if(F.preventDefault(),A||!qlt.test(F.code)){A||(l.current=null),k();return}p(null),l.current={code:F.code,tainted:!1}},onKeyUp:F=>{const A=l.current;if(!A||F.code!==A.code||(l.current=null,A.tainted||d))return;const I=_H(A.code,o);if(I===null){k();return}Gd(I)?.code!==x?.code&&g("settings.edit",I)},notes:S!==null&&x!==null&&c.jsx("p",{children:h("ui.settings.shortcuts.speech.push_to_talk_overlap",{modifier:iE(x.label),example:$lt(S,iE(x.label),o),alternative:C?iE(C):"none"})}),error:f})}function Ylt({setting:e,refetch:t,focusKey:n}){const s=m.useRef(!1),r=r2(),i=m.useRef(null),a=m.useId(),o=m.useMemo(()=>mg(),[]),{saving:l,error:u,setError:d,write:f}=NX({settingKey:e.key,refetch:t,fieldRef:i,onPending:S=>window.api?.recordingShortcut?.markPending(S)}),p=h("ui.settings.shortcuts.speech.start_recording_press"),g=typeof e.value=="string"?e.value:r.value,v=r.problem?r.value:g,b=typeof e.default=="string"?e.default:Oae,x=Ub(g)===Ub(b),_=S=>h("ui.settings.shortcuts.capture.already_assigned",{label:S}),w=h("ui.chat.composer.start_recording"),y=h("ui.settings.shortcuts.keyboard_shortcuts_section.press_the_keys_you_want_esc_cancels");return c.jsx(IX,{id:a,rank:"primary",action:p,settingKey:e.key,focusKey:n,help:e.help,hint:y,ariaLabel:h("ui.settings.shortcuts.keyboard_shortcuts_section.label_press_the_keys_you_want",{label:p}),value:z5(v,o),fieldRef:i,saving:l,showReset:!x,onReset:()=>void f("settings.reset"),onKeyUp:S=>{!Em.has(S.key)||!s.current||(s.current=!1,d(h("ui.settings.shortcuts.speech.start_recording_needs_key")))},onBlur:()=>{s.current=!1},onKeyDown:S=>{if(l)return;if(S.repeat&&Em.has(S.key)){S.preventDefault();return}if(s.current=Em.has(S.key),U_.has(S.key)||Em.has(S.key)){U_.has(S.key)&&d(null),S.preventDefault();return}const C=i2(S);if(C===null)return;if(S.preventDefault(),Ub(C)===Ub(g)){d(null);return}const E=et.getState().shortcutBindings,k=wH(r,_(w));for(const A of ky){const I=E[A.id]??A.defaultChord;I&&k.set(I,A.label)}const F=q5(C,"panel.console",{},o,k);if(F!==null){d(F);return}f("settings.edit",C)},notes:c.jsxs(c.Fragment,{children:[r.shadowedBy&&!u&&c.jsx("output",{className:"block text-danger",children:h("ui.settings.shortcuts.recording.inactive_claimed",{label:r.shadowedBy})}),r.problem&&!u&&c.jsx("output",{className:"block text-danger",children:h("ui.settings.shortcuts.recording.invalid_stored_value")})]}),error:u})}function Xlt({focusKey:e}){const{client:t,provided:n}=YZ(),s=Rn({queryKey:Wo.settings,queryFn:()=>nt({op:"settings.list"}),enabled:n,staleTime:1e4},t),r=l=>s.data?.settings.find(u=>u.key===l),i=r(Lae),a=r(Bae);if(!n)return null;const o=c.jsx("h3",{className:"pt-1 text-body-sm font-medium text-ink",children:h("ui.settings.shortcuts.category.speech_to_text")});return!i&&!a?s.isPending?c.jsx("div",{className:"min-h-24 space-y-3","aria-busy":"true",children:o}):null:c.jsxs("div",{className:"space-y-3","data-shortcut-recording":!0,children:[o,i&&c.jsx(Ylt,{setting:i,refetch:s.refetch,focusKey:e}),a&&c.jsx(Klt,{setting:a,refetch:s.refetch,focusKey:e})]})}const MX=e=>{switch(e.id){case"panel.console":return h("ui.settings.shortcuts.row.console");case"panel.canvas":return h("ui.settings.shortcuts.row.canvas");case"panel.run":return h("ui.settings.shortcuts.row.execution");case"panel.ask":return h("ui.settings.shortcuts.row.asks");case"panel.browser":return h("ui.settings.shortcuts.row.browser");case"panel.code":return h("ui.settings.shortcuts.row.code_review")}},Qlt=()=>h("ui.chat.composer.start_recording");function Jlt(){m.useEffect(()=>{let e=0;const t=()=>{const r=et.getState().shortcutBindings,i=new Map(XZ);for(const a of ky){const o=TA(a.id,r);if(!o)continue;const l=MX(a);for(const u of jae(o,mg()))i.set(u,l)}window.api?.recordingShortcut?.syncClaims(++e,[...i].map(([a,o])=>({chord:a,label:o})))};t();const n=et.subscribe((r,i)=>{r.shortcutBindings!==i.shortcutBindings&&t()}),s=LQ(t);return()=>{n(),s()}},[])}const Zlt=({action:e})=>{const t=r2(),n=wH(t,Qlt());Ge();const s=m.useId(),r=m.useRef(null),i=et(x=>x.shortcutBindings),a=i[e.id],o=et(x=>x.setShortcutBinding),l=et(x=>x.clearShortcutBinding),[u,d]=m.useState(!1),[f,p]=m.useState(null),g=m.useMemo(mg,[]),v=TA(e.id,i),b=MX(e);return c.jsxs("div",{"data-search-row":`keyboard.${e.id}`,"data-search-control":!0,className:"flex flex-col gap-1",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx(cr,{htmlFor:s,className:"w-32 text-body-sm text-ink",children:b}),c.jsx(vs,{id:s,readOnly:!0,value:v===null?h("ui.settings.shortcuts.keyboard_shortcuts_section.no_shortcut"):z5(v,g),"aria-label":h("ui.settings.shortcuts.keyboard_shortcuts_section.label_press_the_keys_you_want",{label:String(b)}),"data-shortcut-action":e.id,ref:r,className:R("w-52",v===null?"text-body-sm":"font-mono text-body-sm"),onFocus:()=>d(!0),onBlur:()=>{d(!1),p(null)},onKeyDown:x=>{if(DE.has(x.key))return;if(U_.has(x.key)){d(!1),p(null);return}if(Em.has(x.key)||x.nativeEvent.isComposing)return;const _=i2({key:x.key,code:x.code,metaKey:x.metaKey,ctrlKey:x.ctrlKey,altKey:x.altKey,shiftKey:x.shiftKey}),w=q5(_,e.id,i,g,n);if(w!==null){x.preventDefault(),d(!0),p(w);return}if(_===v){d(!0),p(null);return}x.preventDefault(),d(!0),p(null),_===e.defaultChord?o(e.id,null,n):_!==null&&o(e.id,_,n)}}),v!==null&&c.jsx(ce,{variant:"secondary",size:"sm","aria-label":h("ui.settings.shortcuts.keyboard_shortcuts_section.clear_label_s_shortcut",{label:String(b)}),onClick:()=>{l(e.id),r.current?.focus()},children:h("ui.settings.shortcuts.keyboard_shortcuts_section.clear")}),a!==void 0&&c.jsx(ce,{variant:"secondary",size:"sm","aria-label":h("ui.settings.shortcuts.keyboard_shortcuts_section.reset_label_to_its_default",{label:String(b)}),onClick:()=>{o(e.id,null,n),r.current?.focus()},children:h("ui.settings.shortcuts.keyboard_shortcuts_section.reset")})]}),u&&c.jsx("span",{className:"text-meta text-ink-dim",children:h("ui.settings.shortcuts.keyboard_shortcuts_section.press_the_keys_you_want_esc_cancels")}),f!==null&&c.jsx("output",{className:"text-meta text-danger",children:f})]})},mpt=({sectionRef:e,focusKey:t})=>(Ge(),c.jsx(DX,{title:h("ui.settings.shortcuts.keyboard_shortcuts_section.keyboard_shortcuts"),icon:XU,description:h("ui.settings.shortcuts.keyboard_shortcuts_section.shortcut_capture_description"),sectionRef:e,searchSection:"keyboard",searchSectionLabel:h("ui.settings.navigation.settings_sidebar.keyboard_shortcuts"),children:c.jsxs("div",{className:"flex flex-col gap-4",children:[c.jsx("p",{"data-shortcut-note":"browser-scope",className:"max-w-2xl text-body-sm text-ink-muted",children:h("ui.settings.shortcuts.keyboard_shortcuts_section.browser_shortcuts_answer_only_while_the_browser_has_focus")}),c.jsx(Xlt,{focusKey:t}),c.jsx("h3",{className:"pt-1 text-body-sm font-medium text-ink",children:h("ui.settings.shortcuts.category.panels")}),c.jsx("div",{className:"flex flex-col gap-4",children:ky.map(n=>c.jsx(Zlt,{action:n},n.id))})]})}));async function ect(e){await nt({op:"settings.edit",key:yl,value:e.value}),Gae(e.queryClient)}async function OX(e){await ect(e),e.queryClient.setQueryData(G_.all,t=>t&&{...t,settings:t.settings.map(n=>n.key===yl?{...n,value:e.value,is_default:e.value===n.default}:n)});try{return await e.queryClient.fetchQuery({queryKey:G_.all,queryFn:()=>nt({op:"settings.list"}),staleTime:0,retry:!1}),"confirmed"}catch{return"readback-unknown"}}const vpt=({focus:e=!1,focusNonce:t})=>{Ge();const n=Rt(),s=Hn(),r=gt(s.data,"settings"),i=Rn({queryKey:G_.all,queryFn:()=>nt({op:"settings.list"}),enabled:r,retry:!1,refetchOnReconnect:!0}),a=i.data?.settings.find(I=>I.key===yl),[o,l]=m.useState(!1),[u,d]=m.useState(null),[f,p]=m.useState(!1),[g,v]=m.useState(!1),b=m.useRef(!1),x=m.useRef(null),_=m.useRef(!1),w=m.useRef(t);m.useEffect(()=>{t!==w.current&&(w.current=t,_.current=!1)},[t]),m.useEffect(()=>{if(!e){_.current=!1;return}!a||_.current||(x.current?.querySelector("[role=combobox]")?.focus(),_.current=!0)},[e,t,a]),m.useEffect(()=>{i.isSuccess&&!i.isFetching&&p(!1)},[i.isFetching,i.isSuccess]);const y=async I=>{if(!(!a||b.current||f||!a.choices.some(N=>N.value===I))){b.current=!0,l(!0),d(null),v(!1);try{const N=await OX({value:I,queryClient:n});p(N==="readback-unknown"),v(N==="confirmed")}catch(N){d({value:I,message:N instanceof Error?N.message:""})}finally{b.current=!1,l(!1)}}},S=async()=>{const[I,N]=await Promise.all([i.refetch(),s.refetch()]);!I.isError&&!N.isError&&p(!1)},C=!i.data&&i.error||!s.data&&s.error,E=s.data&&(!r||i.data&&!a),k=!C&&!E&&!a,F=s.data?.features?.i18n?s.data.language:void 0,A=typeof F=="string"&&F!==""?F:void 0;return c.jsx(DX,{title:h("ui.settings.language.dialog.title"),icon:QU,description:h("ui.settings.language.general.description"),children:c.jsxs("div",{ref:x,"data-setting-key":yl,"data-search-row":"general.language","data-search-control":!0,className:"flex flex-col gap-3","aria-busy":o,children:[k&&c.jsx("output",{className:"text-meta text-ink-dim",children:h("ui.settings.language.dialog.loading")}),E&&c.jsx("p",{className:"text-meta text-ink-dim",children:h("ui.settings.language.dialog.unavailable")}),a&&c.jsx(yH,{setting:{...n2(a),label:h("ui.settings.language.dialog.title")},value:String(a.value),onValueChange:I=>{y(I)},disabled:o||f,suppressEffectiveNote:!0}),c.jsx("output",{id:Hae(yl),"aria-live":"polite",className:"text-meta text-ink-dim",children:o?h("ui.settings.language.general.pending"):g?h("ui.settings.language.general.saved"):A?h(f||s.error?"ui.settings.language.general.last_known":"ui.settings.language.general.effective",{locale:Uae(A)?.name??A}):h("ui.settings.language.general.no_resolution")}),(C||u||f)&&c.jsx(Ar,{variant:"danger",children:c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("p",{role:"alert",children:u?h("ui.settings.language.general.write_error",{message:u.message}):f?h("ui.settings.language.general.readback_error"):h("ui.settings.language.dialog.unavailable")}),c.jsx(ce,{variant:"outline",size:"sm",disabled:o||i.isFetching||s.isFetching,onClick:()=>{u?y(u.value):S()},children:h("ui.settings.language.dialog.retry")})]})})]})})},tct=()=>{Ge();const e=C_(L=>L.open),t=C_(L=>L.closeLanguage),n=Rt(),s=Hn(),r=gt(s.data,"settings"),i=Rn({queryKey:G_.all,queryFn:()=>nt({op:"settings.list"}),enabled:e&&r,staleTime:1e4}),a=m.useRef(null),o=tH(),l=(i.data?.settings??[]).find(L=>L.key===yl),u=l?n2(l):void 0,[d,f]=m.useState(!1),[p,g]=m.useState(!1),[v,b]=m.useState(null),[x,_]=m.useState(!1),w=m.useRef(!1);m.useEffect(()=>{e&&(g(!1),b(null))},[e]);const y=String(u?.value??""),S=async L=>{if(!(!u||w.current||x||!u.choices.some(X=>X.value===L))){w.current=!0,f(!0),b(null),g(!1);try{const X=await OX({value:L,queryClient:n});_(X==="readback-unknown"),g(X==="confirmed")}catch(X){const J=X instanceof Error?X.message:"";b({value:L,message:J}),C_.getState().open||sn(h("ui.settings.language.general.write_error",{message:J}))}finally{w.current=!1,f(!1)}}},C=async()=>{const[L,X]=await Promise.all([i.refetch(),s.refetch()]);!L.isError&&!X.isError&&_(!1)},E=!!s.data,k=E&&!r,F=s.error&&!s.data?s.error:null,A=F??(i.data?null:i.error),I=!E&&!A,{sentence:N,remedy:P}=QZ(o??null,h("ui.settings.configuration.language_dialog.your_settings_could_not_be_loaded"),A),M=s.isFetching||i.isFetching,z=u?"combo":A?"retry":"none";return m.useEffect(()=>{!e||z==="none"||requestAnimationFrame(()=>{a.current?.querySelector(z==="combo"?'[role="combobox"]':"[data-language-retry]")?.focus()})},[e,z]),c.jsx(Hc,{open:e,onOpenChange:L=>!L&&t(),children:c.jsxs(Uc,{ref:a,onOpenAutoFocus:L=>L.preventDefault(),className:"max-w-[min(28rem,calc(100vw-4rem))] gap-4",children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx(Dl,{className:"text-title",children:h("ui.settings.language.dialog.title")}),c.jsx(cd,{className:"text-body-sm text-ink-muted",children:h("ui.settings.language.dialog.description")})]}),I?c.jsxs("div",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[c.jsx(Mn,{}),h("ui.settings.language.dialog.loading")]}):k?c.jsx(Ar,{variant:"warning",children:c.jsx("span",{children:h("ui.settings.language.dialog.unavailable")})}):A?c.jsx(Ar,{variant:"warning",children:c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("span",{children:N}),P&&c.jsx(ce,{variant:"secondary",size:"sm",className:"shrink-0","data-language-retry":"",onClick:()=>{F?s.refetch():i.refetch()},disabled:M,children:M?h("ui.settings.language.dialog.retrying"):h("ui.settings.language.dialog.retry")})]})}):i.isPending?c.jsxs("div",{className:"flex items-center gap-2 text-body-sm text-ink-muted",children:[c.jsx(Mn,{}),h("ui.settings.language.dialog.loading")]}):u?c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("span",{id:lP(yl),className:"text-meta text-ink-dim",children:u.help}),c.jsx(yH,{setting:u,value:y,disabled:d||x,helpId:lP(yl),effectiveNoteId:Vae(yl,Wae),onValueChange:L=>{S(L)}})]}),v&&c.jsx(Ar,{variant:"danger",children:c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("p",{role:"alert",children:h("ui.settings.language.general.write_error",{message:v.message})}),c.jsx(ce,{variant:"outline",size:"sm",disabled:d||i.isFetching,onClick:()=>{S(v.value)},children:h("ui.settings.language.dialog.retry")})]})}),x&&c.jsx(Ar,{variant:"danger",children:c.jsxs("div",{className:"flex flex-col gap-2",children:[c.jsx("p",{role:"alert",children:h("ui.settings.language.general.readback_error")}),c.jsx(ce,{variant:"outline",size:"sm",disabled:d||i.isFetching||s.isFetching,onClick:()=>{C()},children:h("ui.settings.language.dialog.retry")})]})}),c.jsx("div",{className:"flex min-h-8 items-center justify-end",children:d?c.jsx("output",{"aria-live":"polite",className:"text-body-sm text-ink-muted",children:h("ui.settings.language.general.pending")}):p?c.jsxs("output",{"data-language-status":"","aria-live":"polite",className:"inline-flex items-center gap-1.5 text-body-sm text-ink",children:[c.jsx(Zs,{"aria-hidden":"true",className:"size-3.5"}),h("ui.settings.language.dialog.saved")]}):null})]}):c.jsx(Ar,{variant:"warning",children:c.jsx("span",{children:h("ui.settings.language.dialog.unavailable")})})]})})},a5=e=>{const t=qae(e.type),n=typeof e.percent=="number"?`, ${Math.round(e.percent)}%`:"";return h("ui.common.updates.update_foot_icon.in_progress",{subject:t,percent:n})},LX=e=>zae({type:e.type,version:e.offer.version}),nct=e=>{const t=e.map(s=>LX(s)),n=t.slice(1).reduce((s,r)=>h("ui.common.updates.update_foot_icon.subject_join",{left:s,right:`${r.charAt(0).toLowerCase()}${r.slice(1)}`}),t[0]);return h("ui.common.updates.update_foot_icon.available_show_the_update_notice",{joined:n})},sct=({surfaces:e,inflight:t,onShow:n,onDismiss:s})=>{if(Ge(),t===null&&e.length===0)return null;if(t!==null)return c.jsx(mt,{side:"top",collisionPadding:8,content:a5(t),children:c.jsx("output",{"data-update-foot-icon":"","data-update-foot-icon-state":"inflight","aria-label":a5(t),className:"flex size-8 shrink-0 items-center justify-center text-accent",children:c.jsx(ui,{className:"size-4 shrink-0 motion-safe:animate-spin","aria-hidden":"true"})})});const r=e.find(i=>(i.offer.summary??"").trim()!=="");return c.jsx(mt,{side:"top",collisionPadding:8,content:c.jsxs("div",{className:"flex max-w-64 flex-col gap-0.5",children:[e.map(i=>c.jsxs("span",{className:"truncate text-ink",children:[LX(i)," ",h("ui.common.updates.update_foot_icon.available")]},i.type)),r?c.jsx("span",{className:"truncate text-ink-muted",children:(r.offer.summary??"").trim()}):null,e.every(i=>i.offer.nonDisruptive===!0)?c.jsx("span",{className:"text-ink-muted",children:h("ui.common.updates.update_foot_icon.sessions_keep_running")}):null,c.jsx("span",{className:"whitespace-nowrap text-ink-muted",children:h("ui.common.updates.update_foot_icon.show_the_update_notice")})]}),children:c.jsx("button",{type:"button","data-update-foot-icon":"","data-update-foot-icon-state":"available","aria-label":nct(e),onClick:n,onKeyDown:i=>{i.key!=="Escape"||!s||(i.stopPropagation(),s())},className:R("flex size-8 shrink-0 items-center justify-center rounded-sm text-accent","transition-colors duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink"),children:c.jsx(qA,{className:"size-4 shrink-0","aria-hidden":"true"})})})},BX=()=>{const e=Er(g=>g.followed),t=Er(g=>g.running),n=Er(g=>g.offers),s=Er(g=>g.detailOpen),r=Er(g=>g.inflight),i=Er(g=>g.downloadPercent),a=Er(g=>g.openNotice),o=Er(g=>g.noticeOpen),l=Er(g=>g.dismissNotice),u=m.useMemo(()=>{const g={followed:e,running:t,offers:n,detailOpen:s};return n8.filter(v=>$ae(g,v)).map(v=>{const b=n[v];return b?{type:v,offer:b}:null}).filter(v=>v!==null)},[e,t,n,s]),d=m.useMemo(()=>r[kn.BACKEND]?{type:kn.BACKEND,percent:null}:r[kn.UI]?{type:kn.UI,percent:i[kn.UI]}:null,[r,i]),f=m.useCallback(()=>a(),[a]),p=m.useCallback(()=>l(),[l]);return c.jsx(sct,{surfaces:u,inflight:d,onShow:f,onDismiss:o?p:void 0})},jX="px-2",mA=new WeakMap,rct=64,ict=1024*1024,act=3e3;function oct(e){const t=mA.get(e);if(t)return t;const n=new Map;mA.set(e,n);let s=hp(e);return e2(e,()=>{const r=hp(e);if(r===s)return;s=r;const i=[...n.values()];n.clear();for(const a of i){a.url&&H_(a.url),a.url=void 0;for(const o of a.listeners)o()}}),n}function lct(e){if(e.size<rct)return!0;for(const[t,n]of e)if(!(n.listeners.size||n.promise))return n.url&&H_(n.url),e.delete(t),!0;return!1}const cct=BY;function bpt(e,t){const n=HX(t),s=uct(),r=e?HY(e):null,i=r?.src?.type==="endpoint"&&!s?null:r?.src,a=i?.type,o=i?.type==="account"?i.accountId:i?.type==="endpoint"?i.endpointId:void 0,l=i?.hash,u=m.useMemo(()=>a==="account"&&o&&l?{type:"account",accountId:o,hash:l}:a==="endpoint"&&o&&l?{type:"endpoint",endpointId:o,hash:l}:null,[a,o,l]);return UX(u,n)}function HX(e){return Kae(e,Yae())}function uct(){return lH("team_bridge_endpoint_avatar")}const dct=/^(?:acc_[A-Za-z0-9_-]{1,64}|[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12})$/,hct=/^[0-9a-f]{16}$/;function fct(e){const t=e?.id,n=e?.profile?.avatar;if(!t||!dct.test(t)||!n||!n.hash||!hct.test(n.hash)||n.source==="none")return null;if(e.avatar_url){const s=cct.exec(e.avatar_url);if(!s||s[1]!==t||s[2]!==n.hash)return null}return{accountId:t,hash:n.hash}}function pct(e,t){const n=_g(),s=e?.id,r=e?.profile?.avatar?.hash,i=e?.profile?.avatar?.source,a=e?.avatar_url,o=m.useMemo(()=>fct({id:s,avatar_url:a,profile:{avatar:{hash:r,source:i}}}),[s,r,i,a]);return gct(o&&o.accountId===n.accountId?o:null,t,{retryOnce:!0})}function gct(e,t,n={}){const s=HX(t),r=m.useMemo(()=>e?{type:"account",...e}:null,[e]);return UX(r,s,n)}function UX(e,t,n={}){const s=n.retryOnce===!0,r=Rt(),i=_g(),a=e?`${i.epoch}:${i.accountId??"none"}:${e.type}:${e.type==="account"?e.accountId:e.endpointId}:${e.hash}:${t}`:null,[,o]=m.useState(0),l=m.useRef(!0);if(m.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]),m.useEffect(()=>{if(!a||!e||!i.accountId)return;const u=oct(r),d=u.get(a),f=d??{failed:!1,listeners:new Set,retried:!1},p=i.epoch,g=i.accountId,v=()=>{f.failed=!1,f.promise=(e.type==="endpoint"?Jn.endpointAvatarBytes({expectedAccountId:g,endpointId:e.endpointId,hash:e.hash,size:t}):Jn.avatarBytes({expectedAccountId:g,accountId:e.accountId,hash:e.hash,size:t})).then(({data:w,mimeType:y})=>{if(u.get(a)!==f)return;const S=Kr(r);if(S.epoch!==p||S.accountId!==g){u.delete(a);return}if(!["image/png","image/jpeg"].includes(y)||w.byteLength===0||w.byteLength>ict)throw new Error("Invalid avatar bytes");f.url=z8(new Blob([w],{type:y}),y)}).catch(()=>{f.failed=!0}).finally(()=>{if(f.promise=void 0,u.get(a)===f)for(const w of f.listeners)w()})};if(!d){if(!lct(u))return;u.set(a,f),v()}let b=!1;const x=()=>{!s||!f.failed||f.promise||f.retried||(f.retried=!0,b=!0,f.retryTimer=setTimeout(()=>{if(f.retryTimer=void 0,b=!1,u.get(a)!==f||!f.failed)return;const w=Kr(r);w.epoch!==p||w.accountId!==g||v()},act))};u.delete(a),u.set(a,f);const _=()=>{x(),l.current&&o(w=>w+1)};return f.listeners.add(_),x(),()=>{f.listeners.delete(_),b&&f.retryTimer&&(clearTimeout(f.retryTimer),f.retryTimer=void 0,f.retried=!1)}},[i.accountId,i.epoch,a,r,s,t,e]),!(!a||!i.accountId))return mA.get(r)?.get(a)?.url}const gI=st.memo(({expanded:e,useAuth:t=!1})=>{const n=Iy(),s=Yr(),{user:r,isAuthenticated:i,accountRead:a,signOut:o}=Yy(),l=a==="checking"?h("ui.shell.user_profile_sidebar.checking_account"):cP(a)?h("ui.shell.user_profile_sidebar.account_unavailable"):null,u=r?.name??l??h("ui.shell.user_profile_sidebar.user"),d=cP(a),f=r?.email??"",p=d?h("ui.shell.user_profile_sidebar.reconnect_radient"):f,g=d?"/settings?section=providers&provider=radient":"/settings",v=d?h("ui.shell.user_profile_sidebar.reconnect_radient"):h("ui.shell.user_profile_sidebar.account_settings"),b=m.useCallback(async()=>{i&&(await o(),window.location.reload())},[i,o]),x=m.useMemo(()=>{const S=r?.name;return S?S.split(" ").map(C=>C.charAt(0)).join("").toUpperCase().substring(0,2):null},[r?.name]),_=pct(r?.radientUser.account,28),w=c.jsxs("button",{type:"button",onClick:t?void 0:()=>s(g),"aria-label":e?void 0:v,className:R("flex w-full min-w-0 items-center gap-2 rounded-sm transition-colors duration-fast ease-out-quart hover:bg-row-hover",e?"px-2 py-1.5":"justify-center py-1.5"),children:[c.jsxs(Z5,{className:"size-7 shrink-0 rounded-full bg-media-surface",children:[_&&c.jsx(Ay,{src:_,alt:"",className:"lo-avatar-arrival"}),c.jsx(Fy,{className:"rounded-full bg-media-surface text-ink-muted",children:x??c.jsx(sG,{size:14,"aria-hidden":"true"})})]}),e&&u&&c.jsxs("span",{className:"min-w-0 text-start",children:[c.jsx("span",{className:"block truncate text-body-sm text-ink",children:u}),p&&c.jsx("span",{className:R("block truncate text-meta",d?"text-accent":"text-ink-dim"),children:p})]})]}),y=e?w:c.jsx(Du,{content:v,side:n==="rtl"?"left":"right",children:w});return t?c.jsxs($o,{children:[e?c.jsx(ao,{asChild:!0,children:w}):c.jsx(Du,{content:v,side:n==="rtl"?"left":"right",children:c.jsx(ao,{asChild:!0,children:w})}),c.jsxs(zo,{align:"end",side:"top",className:"min-w-50",children:[d?c.jsxs(en,{onSelect:()=>s(g),children:[c.jsx(X5,{size:16,"aria-hidden":"true"}),h("ui.shell.user_profile_sidebar.reconnect_radient")]}):null,c.jsxs(en,{onSelect:()=>s("/settings"),children:[c.jsx(Mu,{size:16,"aria-hidden":"true"}),h("ui.shell.user_profile_sidebar.settings")]}),c.jsxs(en,{children:[c.jsx(dhe,{size:16,"aria-hidden":"true"}),h("ui.shell.user_profile_sidebar.privacy_and_security")]}),c.jsx(Mr,{}),c.jsxs(en,{onSelect:b,className:"text-danger focus:bg-danger-wash focus:text-danger",children:[c.jsx(Mde,{size:16,"aria-hidden":"true"}),h("ui.shell.user_profile_sidebar.sign_out")]})]})]}):y});gI.displayName="UserProfileSidebar";const GX=()=>{const e=Yr(),t=TG();return c.jsx(Du,{content:h("ui.shell.sidebar_navigation.settings"),side:"top",children:c.jsx("button",{type:"button","data-tour-tag":"nav-item-settings",onClick:()=>e("/settings"),"aria-current":t==="settings"?"page":void 0,"aria-label":h("ui.shell.sidebar_navigation.settings"),className:R("flex size-8 shrink-0 items-center justify-center rounded-sm text-ink-muted","transition-colors duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink",t==="settings"&&"text-ink"),children:c.jsx(Mu,{size:16,"aria-hidden":"true"})})})},VX=()=>c.jsxs("div",{className:R("flex min-h-10 shrink-0 items-center justify-between gap-1 pb-2",jX),children:[c.jsx(gI,{expanded:!0}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx(BX,{}),c.jsx(GX,{})]})]});function WX(e){return Ie(t=>JZ(t.sessions,e))}const mct=[];function $X(){const{state:e}=oC(),t=e?.pendingConsent??mct,n=$G(s=>gO(t,s));return m.useEffect(()=>{t.length>0&&M2()},[t]),gO(t,n)}const zX={approvals:["desktop","mesh","approvals"]},vct=15e3,bct=new Set(["requested","approved","connecting","failed"]);function xct(e){return bct.has(e)}function _ct(e){return e==="requested"}function qX(e){return e.filter(t=>_ct(t.state)).length}function wct(e){return SN.test(e.requestDigest)&&SN.test(e.disclosureDigest)}function mI(e){return e.kind==="credential"&&e.typed!==void 0&&e.typed.action==="approve-credential"&&e.typed.operation!==null&&wct(e.typed)}function o5(e,{credentialApprovals:t=!1}={}){return e.state!=="requested"?!1:e.kind==="credential"?t&&mI(e)&&e.typed.signableHere&&e.typed.disclosure?.operation===e.typed.operation:e.canApproveHere!==!1&&(e.kind==="device"||e.kind==="machine")}function yct(e,{credentialApprovals:t=!1}={},n){return t&&mI(e)&&(e.state==="approved"||e.state==="failed")&&(n??e.typed.applyOutcome?.retryable===!0)}function xpt(e,t,n={},s){const r=e.approvalId;return t==="deny"?{op:"approvals.deny",approvalId:r}:e.kind==="device"||e.kind==="machine"?t==="approve"&&o5(e,n)?{op:"approvals.approve",approvalId:r}:null:!(t==="approve"?o5(e,n):yct(e,n,s))||!mI(e)||e.typed.operation===null?null:{op:t==="approve"?"approvals.approveCredential":"approvals.applyCredential",approvalId:r,operation:e.typed.operation,requestDigest:e.typed.requestDigest,disclosureDigest:e.typed.disclosureDigest}}function _pt(e){return xct(e)}function wpt(e){switch(e){case"requested":return h("ui.mesh.mesh_approvals.waiting_for_you");case"approved":return h("ui.mesh.mesh_approvals.approved");case"connecting":return h("ui.mesh.mesh_approvals.connecting");case"connected":return h("ui.mesh.mesh_approvals.connected");case"denied":return h("ui.mesh.mesh_approvals.denied");case"expired":return h("ui.mesh.mesh_approvals.expired");case"failed":return h("ui.mesh.mesh_approvals.failed");default:return e}}function Nr(e){return typeof e=="object"&&e!==null}function Cct(e){const t=Nr(e)?e:{};return{deviceId:Jt(t.device_id),name:Jt(t.name),host:Jt(t.host),user:Jt(t.user),transport:Jt(t.transport),hostKeyFp:Jt(t.host_key_fp)}}function l5(e){return typeof e=="string"?e:""}function KX(e){return eee.includes(e)?e:null}function Sct(e){if(!Nr(e))return null;const t=KX(e.operation);if(t===null)return null;const n=Nr(e.recipient)?e.recipient:{},s=Nr(e.grant_lifetime)?e.grant_lifetime:{},r=Nr(e.requires_capability)?e.requires_capability:{};return{operation:t,credentialKey:Jt(e.credential_key),provider:Jt(e.provider),account:Jt(e.account),org:Jt(e.org),scope:Jt(e.scope),recipient:{deviceId:Jt(n.device_id),name:Jt(n.name),keyFingerprint:Jt(n.key_fingerprint)},evidence:JSON.stringify(e,null,2),withdrawalCount:Array.isArray(e.withdrawals)?e.withdrawals.length:0,untilRevoked:s.kind==="until_revoked",futureLogins:e.future_logins!==!1,installsOrJoins:e.installs_or_joins!==!1,copiesCredential:typeof e.copies_credential=="boolean"?e.copies_credential:null,requiresCapability:Jt(r.name)}}function YX(e){return Nr(e)?{code:Jt(e.code),retryable:e.retryable===!0,reason:Jt(e.reason),remedy:Jt(e.remedy)}:null}function kct(e){if(Nr(e))return{action:Jt(e.action),operation:KX(e.operation),requestDigest:l5(e.request_digest),disclosureDigest:l5(e.disclosure_digest),disclosure:Sct(e.disclosure),assurance:Jt(e.assurance),unprovenHuman:e.unproven_human!==!1,signableHere:e.signable_here===!0,refusal:Jt(e.refusal),refusalMessage:Jt(e.refusal_message),applyOutcome:YX(e.apply_outcome),...Nr(e.upgrade)?{upgrade:{...e.upgrade}}:{}}}function Ect(e){const t=Nr(e)?e:{};return{connect:m1(t.connect,!1),install:m1(t.install,!1),anchor:Nr(t.anchor),networkId:Jt(t.network_id),role:Jt(t.role),unattended:m1(t.unattended,!1),grants:dE(t.grant)}}function Tct(e){const t=Array.isArray(e)?e:e?.approvals??[];if(!Array.isArray(t))return[];const n=[];for(const s of t){if(!Nr(s))continue;const r=Jt(s.approval_id),i=Jt(s.state);if(!r||!i)continue;const a=kct(s.typed_approval),o=Nr(s.what)&&(Object.prototype.hasOwnProperty.call(s.what,"credential_inheritance")||Object.prototype.hasOwnProperty.call(s.what,"credential_finite_share"))||a?.action==="approve-credential",l=Object.prototype.hasOwnProperty.call(s,"kind")?Jt(s.kind):void 0,u=o||l==="credential_inheritance"?"credential":l!==void 0&&!["device_onboard","local_authority"].includes(l)?"unknown":!Nr(s.device)&&Nr(s.machine)?"machine":"device",d=Nr(s.requested_by)?s.requested_by:{};n.push({approvalId:r,state:i,kind:u,summary:Jt(s.summary)||void 0,details:Array.isArray(s.details)&&s.details.every(f=>typeof f=="string")?s.details.slice():void 0,canApproveHere:Object.prototype.hasOwnProperty.call(s,"can_approve_here")?s.can_approve_here===!0:void 0,approveRemedy:Jt(s.approve_remedy)||void 0,where:Cct(u==="machine"?s.machine:s.device),what:Ect(s.what),requestedBy:{surface:Jt(d.surface),sessionId:Jt(d.session_id),deviceId:Jt(d.device_id)},expiresAt:ZZ(s.expires_at),...a&&u==="credential"?{typed:a}:{}})}return n}function Rct(e){return e.kind==="machine"?h("ui.mesh.mesh_approvals.this_machine"):F_({device_id:e.where.deviceId,name:e.where.name})}function ypt(e,t){if(e.kind==="credential"||e.kind==="unknown"||e.canApproveHere===!1){const r=vI(e);if(r)return r;if(e.summary)return e.summary;if(e.kind==="credential"||e.kind==="unknown")return c5(e)}const n=c5(e),s=Ict(e,t).map(r=>r.clause);return s.length?h("ui.mesh.mesh_approvals.approval_title_with_clauses",{head:n,clauses:Dct(s)}):h("ui.mesh.mesh_approvals.approval_title",{head:n})}function c5(e){return e.kind==="credential"?vI(e)||e.summary||h("ui.mesh.approval.credential_title"):e.kind==="unknown"?e.summary||h("ui.mesh.approval.unknown_title"):e.canApproveHere===!1&&e.summary?e.summary:e.kind==="machine"?h("ui.mesh.mesh_approvals.set_up_operator_authority_on_this_machine"):h("ui.mesh.mesh_approvals.onboard_subject",{subject:Rct(e)})}function Cpt(e){return e.summary?e.kind==="credential"?vI(e)===null:e.kind==="unknown"||e.canApproveHere===!1:!1}const Act={github:"GitHub",gitlab:"GitLab"};function u5(e){return Act[e.toLowerCase()]??e}function XX(e){const t=e.typed?.disclosure?.recipient;return F_({device_id:t?.deviceId??"",name:t?.name??""})}function vI(e){const t=e.kind==="credential"?e.typed?.disclosure:null;if(!t)return null;const n=XX(e);return t.operation==="credential_finite_share"?h("ui.mesh.approval.head_finite_share",{credential:u5(t.credentialKey),device:n}):h("ui.mesh.approval.head_inheritance",{provider:u5(t.provider),account:t.account,device:n})}function Fct(e){const t=e.kind==="credential"?e.typed?.disclosure:null;if(!t)return[];const n=XX(e),s=[];return t.operation==="credential_finite_share"?s.push(t.scope==="session"?h("ui.mesh.approval.scope_session",{device:n}):h("ui.mesh.approval.scope_device",{device:n})):(s.push(t.org?h("ui.mesh.approval.org_limited",{org:t.org}):h("ui.mesh.approval.org_any")),t.copiesCredential===!1&&s.push(h("ui.mesh.approval.not_copied",{device:n}))),t.untilRevoked&&s.push(h("ui.mesh.approval.until_revoked")),s.push(t.futureLogins?h("ui.mesh.approval.future_logins_covered"):h("ui.mesh.approval.future_logins_not_shared")),s.push(t.installsOrJoins?h("ui.mesh.approval.installs_something"):h("ui.mesh.approval.installs_nothing")),t.requiresCapability==="broker_credential"&&s.push(h("ui.mesh.approval.needs_broker",{device:n})),t.withdrawalCount>0&&s.push(h("ui.mesh.approval.undoes_withdrawals",{count:t.withdrawalCount,device:n})),s}function Dct(e){return e.length===1?e[0]:h("ui.mesh.mesh_approvals.join_clauses",{clauses:e.slice(0,-1).join(", "),last:e[e.length-1]})}function Spt(e){if(e.kind==="credential"||e.kind==="unknown")return null;const{user:t,host:n,transport:s,name:r}=e.where,i=[n?t?`${t}@${n}`:n:"",s?h("ui.mesh.mesh_approvals.via_transport",{transport:s}):"",r&&r!==n?`(${r})`:""].filter(Boolean);return i.length?i.join(" "):null}function kpt(e){return e.kind==="credential"||e.kind==="unknown"?null:e.where.hostKeyFp||null}function Ept(e){const{surface:t,sessionId:n}=e.requestedBy,s=[t||"",n?h("ui.mesh.mesh_approvals.session_suffix",{suffix:n.slice(-6)}):""].filter(Boolean);return s.length?h("ui.mesh.mesh_approvals.asked_by",{requester:s.join(" · ")}):null}function Ict(e,t){if(e.kind==="credential"||e.kind==="unknown")return[];const{connect:n,install:s,anchor:r,networkId:i,role:a,unattended:o,grants:l}=e.what,u=[];if(n&&u.push({term:"connect",clause:e.where.transport?h("ui.mesh.mesh_approvals.connect_over",{transport:e.where.transport}):h("ui.mesh.mesh_approvals.connect_to_it"),consequence:e.where.transport?h("ui.mesh.mesh_approvals.may_connect_over",{transport:e.where.transport}):h("ui.mesh.mesh_approvals.this_machine_may_connect_to_it")}),s&&u.push({term:"install",clause:e.kind==="machine"?h("ui.mesh.mesh_approvals.install_local_operator"):h("ui.mesh.mesh_approvals.install_local_operator_there"),consequence:e.kind==="machine"?h("ui.mesh.mesh_approvals.local_operator_is_installed_on_this_machine"):h("ui.mesh.mesh_approvals.local_operator_is_installed_on_it")}),r&&u.push({term:h("ui.mesh.mesh_approvals.install_operator_anchor"),clause:h("ui.mesh.mesh_approvals.check_approvals_signed_on_your_machines"),consequence:h("ui.mesh.mesh_approvals.that_device_can_check_approvals_signed_on")}),i){const d=t?.get(i),f=h("ui.mesh.mesh_approvals.join_network",{network:d||i,role:a||"?"});u.push({term:f,clause:f,consequence:h("ui.mesh.mesh_approvals.joins_network",{network:d||i,role:a||"?"})})}o&&u.push({term:h("ui.mesh.mesh_approvals.trust_unattended_sessions"),clause:h("ui.mesh.mesh_approvals.run_sessions_there_without_an_approval_prompt"),consequence:h("ui.mesh.mesh_approvals.sessions_you_start_on_that_device_run")});for(const d of Nct(l,o)){const f=Pct()[d];u.push({term:f?.term??h("ui.mesh.mesh_approvals.grant_capability",{grant:d}),clause:Mct()[d]??h("ui.mesh.mesh_approvals.use_capability",{grant:d}),consequence:f?.gloss??h("ui.mesh.mesh_approvals.may_use_capability",{grant:d})})}return u}function Nct(e,t){const n=new Set;for(const s of e){const r=String(s??"").trim();r&&(t&&r==="unattended"||n.add(r))}return[...n]}const Pct=()=>({unattended:{term:h("ui.mesh.mesh_approvals.trust_unattended_sessions"),gloss:h("ui.mesh.mesh_approvals.sessions_you_start_on_that_device_run")},broker_credential:{term:h("ui.mesh.mesh_approvals.borrow_logins_there"),gloss:h("ui.mesh.mesh_approvals.your_sessions_may_use_the_logins_stored")}}),Mct=()=>({list:h("ui.mesh.mesh_approvals.see_its_sessions"),view:h("ui.mesh.mesh_approvals.watch_a_session_there"),prompt:h("ui.mesh.mesh_approvals.send_prompts_to_a_session_there"),steer:h("ui.mesh.mesh_approvals.steer_a_running_turn_there"),stop:h("ui.mesh.mesh_approvals.stop_a_session_there"),slash:h("ui.mesh.mesh_approvals.run_slash_commands_there"),delete:h("ui.mesh.mesh_approvals.archive_or_delete_a_session_there"),move:h("ui.mesh.mesh_approvals.move_sessions_to_or_from_there"),broker_credential:h("ui.mesh.mesh_approvals.borrow_the_logins_stored_there"),approve:h("ui.mesh.mesh_approvals.answer_approval_prompts_there"),unattended:h("ui.mesh.mesh_approvals.run_sessions_there_without_an_approval_prompt")});function Tpt(e){return e.kind==="credential"&&e.typed!==void 0&&(e.state==="approved"||e.state==="failed")}function Rpt(e,t){return e.kind==="credential"&&(e.state==="approved"||e.state==="failed")&&(t??e.typed?.applyOutcome?.retryable)===!1}function Apt(e,t,n=!1){if(e===null||e<=t||e<=0)return null;const s=Math.ceil((e-t)/60),r=e-t<60?h("ui.mesh.approval.duration_under_minute"):s<90?h("ui.mesh.approval.duration_minutes",{count:s}):h("ui.mesh.approval.duration_hours",{count:Math.ceil(s/60)});return h(n?"ui.mesh.approval.expires_window":"ui.mesh.approval.answer_window",{duration:r})}function Fpt(e){const t=e.typed?.disclosure;if(!t)return"";const n=Fct(e),s=h("ui.mesh.approval.until_revoked"),r=h(t.futureLogins?"ui.mesh.approval.future_logins_covered":"ui.mesh.approval.future_logins_not_shared");return n.filter((i,a)=>a===0||i===s||i===r).join(" · ")}function QX(e,{poll:t=!0}={}){return Rn({queryKey:zX.approvals,enabled:e,queryFn:async()=>Tct(await nt({op:"approvals.list"})),retry:!1,staleTime:t?1e4:Number.POSITIVE_INFINITY,refetchInterval:e&&t?vct:!1,refetchOnWindowFocus:t})}function Oct(){return{retry:!1,mutationFn:async e=>{const t=await nt(e.request);if(e.request.op==="approvals.approveCredential"){const n=Lct(t);if(n)throw n}}}}function Dpt(){const e=Rt();return on({...Oct(),onSettled:()=>{e.invalidateQueries({queryKey:zX.approvals}),e.invalidateQueries({queryKey:Ic.networks}),e.invalidateQueries({queryKey:Ic.peers})}})}function Ipt(e){const t=e?.message;return typeof t=="string"&&t.trim()?t.trim():h("ui.mesh.mesh_approvals.the_approvals_could_not_be_read")}function Npt(e){const t=e,n=YX(t?.applyOutcome??(Nr(t?.detail)?t.detail.apply_outcome:void 0)),s=n?[n.reason,n.remedy].filter(Boolean).join(" "):"";return{code:n?.code||Jt(t?.code)||"approval_refused",sentence:s||Jt(t?.message)||h("ui.mesh.mesh_approvals.decision_could_not_be_answered"),retryable:n?n.retryable===!0:void 0}}function Lct(e){const t=Nr(e)?e.applied:void 0;return!Nr(t)||t.ok!==!1?null:{code:Jt(t.code),message:Jt(t.message),applyOutcome:t}}const Bct=/(\{request\}|\{reason\})/;function Ppt(e,t){return h("ui.mesh.approval.named_refusal",{request:"{request}",reason:"{reason}"}).split(Bct).filter(Boolean).map(n=>n==="{request}"?{kind:"request",text:e}:n==="{reason}"?{kind:"reason",text:t}:{kind:"literal",text:n})}function Mpt(e,t,n=!1){return e==="request"&&!n?t:"auto"}function Opt({document:e,target:t,refusalTarget:n,origin:s,allowFocus:r,sentence:i}){r&&(e.activeElement===e.body||e.activeElement===s)&&t?.focus({preventScroll:!0});const a=n!==null&&e.activeElement===n;return{focused:a,announcement:a?"":i}}function jct(){const e=Hn(),t=gt(e.data,"aida",1),n=Qh(t),s=t&&n.data?.enabled===!0,r=WX(n.data?.session_id),i=gt(e.data,"notifications",1),a=CH(i),o=$X(),l=uC(vr(e.data,"peers")==="enabled"),u=QX(l==="member"&&vr(e.data,"approvals")==="enabled",{poll:!0}),d=s?r:0,f=i?SH(a.data):0,p=l==="member"?qX(u.data??[]):0,g=[];return d>0&&g.push(h("ui.shell.sidebar_navigation.aida_missed",{name:n.data?.name??"Aida",count:d})),f>0&&g.push(h("ui.notifications.nav.unread",{count:f,countText:String(f)})),o>0&&g.push(h("ui.shell.sidebar_navigation.browser_waiting",{count:o,countText:String(o)})),p>0&&g.push(h("ui.shell.sidebar_navigation.mesh_waiting",{count:p,countText:String(p)})),{total:d+f+o+p,lines:g}}function Hct(e){const t=typeof e=="object"&&e!==null?e.idx:void 0;return typeof t=="number"&&t>0?"history":"/chat"}const Uct=()=>{Ge();const e=Yr(),t=Iy()==="rtl"?Oy:$U,[n,s]=m.useState(!1),{total:r,lines:i}=jct(),a=W_("back",Hoe.test(navigator.platform)),o=r>0?h("ui.teamBridge.leave.name_attention",{count:r}):h("ui.teamBridge.leave.name"),l=m.useCallback(()=>{Hct(window.history.state)==="history"?e(-1):e("/chat")},[e]);return m.useEffect(()=>{const u=f=>{FH(f)==="back"&&(f.preventDefault(),l())},d=f=>{DH(f)==="back"&&(f.preventDefault(),l())};return document.addEventListener("keydown",u),document.addEventListener("mouseup",d),()=>{document.removeEventListener("keydown",u),document.removeEventListener("mouseup",d)}},[l]),c.jsx("div",{"data-team-bridge-back-row":"",className:R("flex h-10 shrink-0 items-center",jX),children:c.jsx(Du,{content:c.jsxs("span",{className:"flex flex-col",children:[c.jsx("span",{children:c.jsx(Bo,{text:h("ui.teamBridge.leave.back_shortcut",{shortcut:Fi(a)})})}),i.map(u=>c.jsx("span",{children:u},u))]}),side:"bottom",align:"start",collisionPadding:8,suppressed:n,discardWhileSuppressed:!0,children:c.jsxs("button",{type:"button","data-team-bridge-back":"",onFocus:u=>{u.currentTarget.hasAttribute("data-focus-handoff")&&(u.currentTarget.removeAttribute("data-focus-handoff"),s(!0))},onBlur:()=>s(!1),onPointerEnter:()=>s(!1),onKeyDown:()=>s(!1),onClick:l,"aria-label":o,"aria-keyshortcuts":a,className:R("inline-flex h-8 items-center gap-1.5 rounded-sm px-2 text-body-sm font-medium text-ink-muted","transition-colors duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink"),children:[c.jsx(t,{size:16,"aria-hidden":"true"}),c.jsx("span",{children:h("ui.teamBridge.leave.back")}),c.jsx(ep,{count:r,"aria-hidden":"true",className:"ms-1"})]})})})},Gct=({children:e,inline:t})=>c.jsxs(Xae,{fallback:t,children:[c.jsx(Uct,{}),e,c.jsx(VX,{})]}),Vct=()=>(Ge(),c.jsxs(Gct,{inline:null,children:[c.jsx("h1",{className:"flex h-10 shrink-0 items-center px-4 text-body-sm font-semibold text-ink",children:h("ui.teamBridge.page.title")}),c.jsx("div",{className:"min-h-0 flex-1"})]})),Wct=140,$ct=/^\s*(```|~~~).*$/gm,zct=/^\s{0,3}#{1,6}\s+/gm,qct=/^\s{0,3}(>\s?)+/gm,Kct=/^\s*([-*+]|\d{1,9}[.)])\s+/gm,Yct=/^\[[ xX]\]\s+/gm,Xct=/^\s{0,3}([-*_])(\s*\1){2,}\s*$/gm,Qct=/!\[([^\]]*)\]\([^)]*\)/g,Jct=/\[([^\]]+)\]\([^)]*\)/g,Zct=/<((?:https?|mailto):[^>\s]+)>/gi,eut=/<\/?[A-Za-z][^>]*>/g,tut=/`+([^`]*)`+/g,nut=/(\*\*|__)(?=\S)([\s\S]*?\S)\1/g,sut=/~~(?=\S)([\s\S]*?\S)~~/g,rut=/(^|[^\w*])\*(?=\S)([^*]*?\S)\*(?!\w)/g,iut=/(^|[^\w])_(?=\S)([^_]*?\S)_(?!\w)/g;function aut(e,t=Wct){if(typeof e!="string"||e.trim().length===0)return null;const n=e.replace($ct," ").replace(Xct," ").replace(zct,"").replace(qct,"").replace(Kct,"").replace(Yct,"").replace(Qct,"$1").replace(Jct,"$1").replace(Zct,"$1").replace(eut,"").replace(tut,"$1").replace(nut,"$2").replace(sut,"$1").replace(rut,"$1$2").replace(iut,"$1$2"),s=Op(n,Number.MAX_SAFE_INTEGER);return s.length===0?null:ZY(s,t)}function out(e,t){const n=e.senderLabel?.trim()||e.conversationName?.trim()||t.untitled,s=e.place.kind==="dm"?t.directMessage:e.place.kind==="channel"?e.place.name?.trim()?t.channel(e.place.name.trim()):e.conversationName?.trim()??t.untitled:e.place.name?.trim()||e.conversationName?.trim()||t.group,r=e.organizationName?t.subtitle(s,e.organizationName):s,i=Math.max(1,Math.floor(e.unreadCount)),a=i>1?e.preview?t.countPreview(i,e.preview):t.count(i):e.preview??t.fallback;return{title:Op(n,Lv)||t.untitled,subtitle:Op(r,yrt)||t.untitled,body:Op(a,wrt)||t.fallback}}const ym=3e4,lut=10;function cut(e,t=lut){return[...e?.organizations??[]].filter(n=>n.eligible&&n.unread>0).sort((n,s)=>s.unread-n.unread||n.tenant_id.localeCompare(s.tenant_id)).slice(0,t)}function uut(e,t){return e.member===!0?!0:e.member===!1||!t?!1:e.members.some(n=>n.kind==="human"&&n.account_id===t&&n.state==="active")}function JX(e,t){return uut(e,t)&&oH(e)==="all"&&e.builtin!=="agents"}function dut(e,t,n){return{conversationName:ZA(e,t),organizationName:dH(e,n),senderLabel:JA(e.last_sender_label??"")}}function hut(e){const t=new Map(e.cursors),n=e.rows;if(!e.seeded){for(const a of n)t.set(a.conversation_id,a.latest_seq);return{candidates:[],cursors:t,seeded:!0}}const r=new Map(e.conversations.map(a=>[a.id,a])),i=[];for(const a of n){const o=t.get(a.conversation_id);if(a.unread_count===0||a.latest_seq<=a.last_read_seq||o!==void 0&&a.latest_seq<=o){(o===void 0||a.latest_seq>o)&&t.set(a.conversation_id,a.latest_seq);continue}const l=r.get(a.conversation_id);l!==void 0&&l.latest_seq===a.latest_seq&&(t.set(a.conversation_id,a.latest_seq),JX(l,e.selfAccountId)&&(e.quiet||i.push({conversationId:l.id,...l.last_thread_root_id?{threadId:l.last_thread_root_id}:{},tenantId:a.tenant_id,seq:a.latest_seq,...dut(l,e.selfAccountId,e.organizations),kind:l.kind,name:l.name?.trim()||null,unreadCount:a.unread_count})))}return{candidates:i,cursors:t,seeded:!0}}function bI(e,t,n,s){return e.getMutationCache().findAll({mutationKey:Bt.notifyMutation(t.accountId,t.epoch),exact:!0,status:"pending"}).some(r=>{const i=r.state.variables;return i?.conversationId===n&&(i.tenantId===void 0||i.tenantId===s)})}function fut(e,t,n,s,r){return new Promise(i=>{const a=()=>{l(),r.removeEventListener("abort",a),i()},o=()=>{(r.aborted||!bI(e,t,n,s))&&a()},l=e.getMutationCache().subscribe(o);r.addEventListener("abort",a,{once:!0}),o()})}function Lpt(e){const t=e.get("tenant"),n=e.get("conversation"),s=e.get("thread");return t&&n&&s?{tenantId:t,conversationId:n,rootId:s}:null}function ZX(e,t){if(e.root.id!==t.rootId||e.root.conversation_id!==t.conversationId||e.root.thread_root_id||e.replies.some(n=>n.conversation_id!==t.conversationId||n.thread_root_id!==t.rootId))throw new Error("Thread response identity mismatch");return e}async function Bpt(e,t,n,s){return ZX(await Jn.listReplies(e.conversationId,e.rootId,{tenantId:e.tenantId,accountId:t,afterSeq:n,...s?{limit:50,...s}:{}}),e)}function jpt(e,t,n){if(typeof IntersectionObserver>"u")return()=>{};const s=new Map(t.map(d=>[d.id,d.seq])),r=new Map,i=e.ownerDocument;let a=!0,o=-1;const l=()=>{if(!a||!e.isConnected||i.visibilityState!=="visible"||!i.hasFocus())return;const d=Math.max(-1,...r.values());d<=o||(o=d,n(d).catch(()=>{a&&o===d&&(o=-1)}))},u=new IntersectionObserver(d=>{if(a){for(const f of d){const p=f.target.dataset.messageId??"",g=s.get(p);g!==void 0&&f.isIntersecting&&f.intersectionRect.height>0?r.set(p,g):r.delete(p)}l()}},{root:e.querySelector("[data-radix-scroll-area-viewport]"),threshold:0});for(const d of e.querySelectorAll("[data-message-id]"))s.has(d.dataset.messageId??"")&&u.observe(d);return i.addEventListener("visibilitychange",l),i.defaultView?.addEventListener("focus",l),()=>{a=!1,u.disconnect(),i.removeEventListener("visibilitychange",l),i.defaultView?.removeEventListener("focus",l)}}let T_=null;function put(){return T_}function Hpt(e){m.useEffect(()=>{const t=e??null;return T_=t,()=>{T_===t&&(T_=null)}},[e])}const gut="display.notifications";function mut(){return{untitled:h("ui.teamBridge.list.untitled"),directMessage:h("ui.teamBridge.kind.dm"),group:h("ui.teamBridge.kind.group"),channel:e=>h("ui.teamBridge.notify.channel",{channel:e}),subtitle:(e,t)=>h("ui.teamBridge.notify.subtitle",{place:e,organization:t}),count:e=>h("ui.teamBridge.notify.count",{count:e}),countPreview:(e,t)=>h("ui.teamBridge.notify.count_preview",{count:e,preview:t}),fallback:h("ui.teamBridge.notify.body_fallback")}}function vut(e){return e.kind==="dm"?{kind:"dm"}:{kind:e.kind,name:e.name}}function but(e,t){return _st(e,t==="person_agent"?"agent":"human")}function vA(e,t){const n=HY(but(e,t)).src,s=n?.type==="account"?n:null,r=n?.type==="endpoint"?n:null;return Rrt({v:1,kind:t,account_id:e.account_id,display_name:Op(e.display_label,Lv),agent_name:Op(e.agent?.name??"",Lv),...s?{avatar:{account_id:s.accountId,hash:s.hash}}:{},...r?{endpoint_avatar:{endpoint_id:r.endpointId,hash:r.hash}}:{}})}function xut(e,t,n){return e.getQueryData(Bt.directory(t,n))?.members??[]}function _ut(e,t,n,s){const r=Bt.replies(t.tenantId,t.conversationId,n);e.setQueryData(r,i=>{const a=i?.pages.at(-1);return!i||!a||a.has_more||i.pages.some(o=>o.replies.some(l=>l.id===s.id))?i:{...i,pages:[...i.pages.slice(0,-1),{...a,replies:[...a.replies,s].sort((o,l)=>o.seq-l.seq)}]}})}function wut(e,t,n,s){return{...KD(e,t,n,s),staleTime:0}}async function yut(e,t,n,s,r){if(!s())return;let i=t.senderLabel,a,o=null,l;const u=Kr(e);if(u.accountId!==n)return;const d={accountId:n,epoch:u.epoch},f=t.threadId;try{let b;if(f)b=ZX(await Jn.listReplies(t.conversationId,f,{tenantId:t.tenantId,accountId:n,afterSeq:t.seq,limit:1}),{tenantId:t.tenantId,conversationId:t.conversationId,rootId:f}).replies.find(x=>x.seq===t.seq),b&&s()&&_ut(e,t,f,b);else{const x=()=>e.fetchQuery(wut(e,t.conversationId,t.tenantId,n));b=(await x().catch(w=>{if(!tee(w))throw w;return x()})).messages.reduce((w,y)=>w===void 0||y.seq>w.seq?y:w,void 0)}if(b&&b.seq>=t.seq){if(f||(l=b.id),b.sender.kind==="human"&&b.sender.account_id===n||!s())return;const x=xut(e,t.tenantId,n);i=Jae(b.sender,x,{named:(w,y)=>h("ui.teamBridge.chief.label",{agent:w,person:y}),unnamed:w=>h("ui.teamBridge.chief.unnamed",{person:w})});const _=x.find(w=>w.account_id===b.sender.account_id);_&&(b.sender.kind==="human"||b.sender.kind==="agent")&&(a=vA(_,b.sender.kind==="human"?"person":"person_agent")),o=aut(b.body)}}catch{}const p=window.api?.desktop?.teamBridge;if(!p)return;const g=out({senderLabel:i,conversationName:t.conversationName,place:vut(t),organizationName:t.organizationName,preview:o,unreadCount:t.unreadCount},mut());for(;bI(e,d,t.conversationId,t.tenantId);)if(await fut(e,d,t.conversationId,t.tenantId,r),r.aborted||!s())return;if(r.aborted||!s())return;const v=e.getQueryData(Bt.conversations(Dc,n))?.conversations.find(b=>b.id===t.conversationId&&b.tenant_id===t.tenantId);!v||!JX(v,n)||await p.notify({owner:{accountId:n,epoch:d.epoch},conversationId:t.conversationId,...f?{threadId:f}:{},...l?{messageId:l}:{},tenantId:t.tenantId,...a?{sender:a}:{},seq:t.seq,title:g.title,subtitle:g.subtitle,body:g.body,viewing:put()===t.conversationId}).catch(()=>{})}function Cut(e,t,n,s,r){fst(e,t,n,s);for(const i of s){const a=`${n}\0${i.conversation_id}`,o=r.get(a);if(r.set(a,i.latest_seq),o===void 0||i.latest_seq<=o)continue;const l=KD(e,i.conversation_id,n,t);e.getQueryState(l.queryKey)?.data!==void 0&&e.fetchQuery({...l,staleTime:0}).catch(()=>{})}}function Sut(e){const t=!!window.api?.desktop?.teamBridge,n=$C(),s=YD(e&&t),r=n.accountId,a=e&&t&&!!r&&s.data?.account_id===r&&s.data?.state==="ready"&&s.data.local.enabled&&!s.data.read_only,o=Rt(),l=$oe({filters:{mutationKey:Bt.notifyMutation(r,n.epoch),exact:!0,status:"pending"},select:U=>U.mutationId});m.useLayoutEffect(()=>{const U=window.api?.desktop?.teamBridge;if(!U?.setAuthority)return;const G=()=>{U.setAuthority({...Kr(o),settling:t2(o)}).catch(()=>{})},K=e2(o,G);return G(),K},[o]);const u=jD({enabled:a}),d=Hn(),f=gt(d.data,"settings"),p=Rn({...u8(),enabled:a&&f}),g=f&&Qae(p.data?.settings,gut)===!1,v=m.useRef(g);v.current=g;const b=m.useRef(r);b.current=r;const x=m.useRef(a);x.current=a;const _=m.useRef(new AbortController);m.useEffect(()=>{const U=new AbortController;return _.current=U,(!a||g||n.token!==hp(o))&&U.abort(),()=>U.abort()},[a,g,n.token,o]),m.useEffect(()=>(x.current=a,()=>{x.current=!1}),[a]);const w=u.data,y=YY(a,Dc,{accountId:r,refetchInterval:ym,refetchIntervalInBackground:!0}),S=m.useMemo(()=>cut(y.data),[y.data]),C=IH({queries:S.map(U=>{const G=AE(U.tenant_id);return{queryKey:Bt.unread(G,r??"unresolved-owner"),queryFn:()=>Bc(o,r,()=>Jn.unread({tenantId:G})),enabled:a,staleTime:ym,refetchInterval:ym,refetchIntervalInBackground:!0,refetchOnWindowFocus:!0,retry:1}})}),E=C.map(U=>`${U.status}:${U.dataUpdatedAt}`).join("|"),k=m.useRef(C);k.current=C;const F=m.useRef(S);F.current=S;const I=KY(S.map(U=>AE(U.tenant_id)),a,r).members,N={};for(const[U,G]of Object.entries(I))N[U]=G.filter(K=>K.account_id!==r).flatMap(K=>[vA(K,"person"),...K.agent?.name?[vA(K,"person_agent")]:[]]).filter(K=>K!==void 0);const P=JSON.stringify(N),M=m.useRef(N);M.current=N;const z=m.useRef(null),L=m.useRef(new Set),X=Rn({queryKey:Bt.conversations(Dc,r??"unresolved-owner"),queryFn:()=>Bc(o,r,()=>Jn.listConversations("account")),enabled:a,staleTime:ym,refetchInterval:ym,refetchIntervalInBackground:!0,refetchOnWindowFocus:!0,retry:1}),J=m.useRef(new Map),re=m.useRef(new Map),q=m.useRef(new Set),ee=m.useRef(void 0),oe=m.useRef(null),B=[a,g,l.join(","),E,y.dataUpdatedAt,X.dataUpdatedAt,(w?.memberships??[]).map(U=>`${U.tenant_id}:${U.tenant_name}`).join(","),r??""].join("#");m.useEffect(()=>{if(z.current===P)return;z.current=P;const U=window.api?.desktop?.teamBridge;if(!U?.syncDirectory)return;const G=M.current;for(const K of L.current)K in G||U.syncDirectory({tenantId:K,members:[]}).catch(()=>{});L.current=new Set(Object.keys(G));for(const[K,ne]of Object.entries(G))U.syncDirectory({tenantId:K,members:ne}).catch(()=>{})},[P]),m.useEffect(()=>{const U=ee.current;ee.current=r,U!==r&&U!==void 0&&(J.current=new Map,re.current=new Map,q.current=new Set,oe.current=null,o.invalidateQueries({queryKey:Bt.unreadPrefix}),o.invalidateQueries({queryKey:Bt.conversationsPrefix}))},[r,o]),m.useEffect(()=>{if(oe.current===B||(oe.current=B,!y.data))return;for(const he of y.data.organizations??[])he.unread===0&&!q.current.has(he.tenant_id)&&q.current.add(he.tenant_id);if(!X.data)return;const U=k.current,G=F.current,K=hH(w?.memberships??[],y.data.organizations,y.data.organizations??null);let ne=J.current;for(let he=0;he<G.length;he+=1){const te=G[he],Te=U[he]?.data;if(!Te)continue;const Z=(Te.conversations??[]).map(Se=>({conversation_id:Se.conversation_id,tenant_id:te.tenant_id,unread_count:Se.unread_count,last_read_seq:Se.last_read_seq,latest_seq:Se.latest_seq}));r&&Cut(o,r,te.tenant_id,Te.conversations??[],re.current);const ge=q.current.has(te.tenant_id),W=Kr(o),ye=Z.filter(Se=>!ge||!x.current||v.current||!W.accountId||W.accountId!==r?!0:!bI(o,{accountId:W.accountId,epoch:W.epoch},Se.conversation_id,Se.tenant_id)),De=hut({conversations:X.data.conversations,rows:ye,organizations:K,selfAccountId:r,cursors:ne,seeded:ge,quiet:!a||g});if(ne=De.cursors,De.seeded&&q.current.add(te.tenant_id),!a||g||!r)continue;const Ne=r,pe=hp(o),ve=IY(o,Ne);for(const Se of De.candidates)yut(o,Se,Ne,()=>b.current===Ne&&hp(o)===pe&&ve()&&x.current&&!v.current&&Lc(o,Ne),_.current.signal)}J.current=ne},[B,a,g,y.data,X.data,w,r,o])}function kut(){const{data:e}=Hn();m.useEffect(()=>{e&&BQ(e)},[e]);const t=KA(),n=Rt(),s=m.useRef(null);m.useEffect(()=>{const r=t.configChange;if(!r)return;const i=`${r.epoch}:${r.seq}`;s.current!==i&&r.changedKeys.includes(yl)&&(s.current=i,n.invalidateQueries({queryKey:Wo.capabilities}),n.invalidateQueries({queryKey:Wo.settings}),!Zae()&&xa(h("ui.settings.language.external_notice",{language:r.language}),{id:"i18n-language-external"}))},[t.configChange,n])}function Eut(e,t){if(e.defaultPrevented||e.repeat||e.isComposing||!(e.metaKey||e.ctrlKey))return null;const n=i2(e);if(n===null)return null;const s=nee(t.bindings).get(n);return s===void 0||kA(e.target)||!_ve(eQ(s),t.route)?null:s}const eQ=e=>e.slice(6);function Tut(e){const t=Ie.getState(),n=t.activeDraftKey?t.drafts[t.activeDraftKey]:void 0,s=zv(t.activeDraftKey,n?.sessionId,t.activeSessionId)??null;Jd(eQ(e),{sessionId:s,askScope:s===null?"fleet":"session",via:"chord"})}function Rut(){m.useEffect(()=>{const e=t=>{const n=et.getState(),s=Eut(t,{bindings:n.shortcutBindings,route:n.rightSlotRoute});s!==null&&(t.preventDefault(),Tut(s))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[])}function Aut(e,t){const n=_g(),s=m.useRef(!1);m.useEffect(()=>{s.current||!e||!n.accountId||window.__loDevDriver?.armed!==!0||window.__loDevDriver.startupScene!=="team-bridge-owner-audit"||(s.current=!0,t("/team-bridge"))},[e,n.accountId,t])}const Fut=""+new URL("radient-icon-1024x1024-D_JJedvo.png",import.meta.url).href,tQ=fg()(A5(e=>({hasBeenNotified:!1,setHasBeenNotified:t=>{e({hasBeenNotified:t})}}),{name:"low-credits-storage"})),Dut=({open:e,onClose:t,onGoToConsole:n})=>{Ge();const{setHasBeenNotified:s}=tQ(),{prices:r,isLoading:i,error:a}=eoe(),o=d=>typeof d!="number"?"$...":h("ui.common.account.low_credits_dialog.detail",{detail:String(d.toFixed(2))}),l=()=>{s(!0),t()},u=()=>{s(!0),n()};return c.jsx(Gc,{open:e,onClose:l,title:c.jsxs(c.Fragment,{children:[c.jsx("img",{src:Fut,alt:h("ui.common.account.low_credits_dialog.radient_icon"),className:"size-7"}),h("ui.common.account.low_credits_dialog.running_low_on_radient_credits")]}),maxWidth:"sm",fullWidth:!1,actions:c.jsxs(c.Fragment,{children:[c.jsx(Yv,{onClick:l,children:h("ui.common.account.low_credits_dialog.maybe_later")}),c.jsx(Xv,{onClick:u,startIcon:c.jsx(Iu,{size:18}),className:"min-w-55",children:h("ui.common.account.low_credits_dialog.get_more_credits")})]}),children:c.jsxs("div",{className:"flex flex-col items-center gap-4 py-2 text-center",children:[c.jsxs("p",{className:"text-body-sm text-ink-muted",children:[h("ui.common.account.low_credits_dialog.unlock_the_full_power_of_local_operator_with")," ",c.jsx("span",{className:"font-bold text-accent",children:h("ui.common.account.low_credits_dialog.radient_pass")}),"."]}),c.jsx("p",{className:"text-body-sm text-ink-muted",children:h("ui.common.account.low_credits_dialog.radient_automatic_is_often_cheaper_than_bringing_your_own_key_its")}),c.jsx("p",{className:"text-body-sm text-ink-muted",children:h("ui.common.account.low_credits_dialog.it_s_pay_as_you_go_with_no_commitments_load_up_what_you_need_star")}),c.jsxs("p",{className:"text-body-sm text-ink-muted",children:[h("ui.common.account.low_credits_dialog.plus_get")," ",c.jsx("span",{className:"font-medium text-ink",children:i?c.jsx(Mn,{size:"sm",className:"me-0.5 align-middle"}):o(r?.default_registration_credits)})," ",h("ui.common.account.low_credits_dialog.in_bonus_credits_with_your_first_purchase"),a&&c.jsx("span",{className:"mt-1 block text-meta text-danger",children:h("ui.common.account.low_credits_dialog.could_not_load_bonus_credit_information")})]}),c.jsx("p",{className:"text-meta text-ink-dim",children:h("ui.common.account.low_credits_dialog.you_can_also_reach_the_radient_console_from_settings_at_any_time")})]})})},Iut=(e,t)=>t?e.some(n=>n.session_id===t&&n.status?.code==="busy"):!1;function Nut(e){return Ie(t=>Iut(t.sessions,e))}const bA={aida:"visible",notifications:"visible",library:"visible",projects:"visible",agents:"visible",schedules:"more",browser:"visible","team-bridge":"more","agent-hub":"more",mesh:"more"},xy=["aida","notifications","library","projects","agents","schedules","browser","team-bridge","agent-hub","mesh"],_y={visible:xy.filter(e=>bA[e]==="visible"),more:xy.filter(e=>bA[e]==="more")},d5=new Map(xy.map((e,t)=>[e,t])),Put=new Map([["notifications","notifications"]]);function Mut(e,t){const n=s=>{const r=Put.get(s);return r===void 0||t(r)};return{visible:e.visible.filter(n),more:e.more.filter(n)}}const Out=new Set(see);function Lut(e){return typeof e=="string"&&Out.has(e)}function aE(e,t){if(e===t)return!0;if(e.visible.length!==t.visible.length||e.more.length!==t.more.length)return!1;for(let n=0;n<e.visible.length;n+=1)if(e.visible[n]!==t.visible[n])return!1;for(let n=0;n<e.more.length;n+=1)if(e.more[n]!==t.more[n])return!1;return!0}function Ao(e,t){return e.visible.includes(t)?"visible":"more"}function R_(e,t,n){return e[t].filter(s=>n.has(s))}function But(e,t,n,s){if(!s.has(t))return null;const r=Ao(e,t),i=R_(e,r,s),a=i.indexOf(t);if(a<0)return null;const o=a+n;if(o<0||o>=i.length)return null;const l=i[o],u=e[r],d=u.indexOf(t),f=u.indexOf(l);if(d<0||f<0)return null;const p=u.slice();p[d]=l,p[f]=t;const g={visible:e.visible.slice(),more:e.more.slice()};return g[r]=p,g}function h5(e,t,n){const s={visible:e.visible.filter(r=>r!==t),more:e.more.filter(r=>r!==t)};return{...s,[n]:[...s[n],t]}}function jut(e,t,n,s,r){if(s===t)return{visible:e.visible.slice(),more:e.more.slice()};if(s!==null&&(!r.has(s)||!e[n].includes(s)))return null;const i={visible:e.visible.filter(l=>l!==t),more:e.more.filter(l=>l!==t)},a=i[n].slice(),o=s===null?a.length:a.indexOf(s);return o<0?null:(a.splice(o,0,t),{...i,[n]:a})}function f5(e,t){for(const n of xy){if(bA[n]!==t||e.visible.includes(n)||e.more.includes(n))continue;const s=d5.get(n)??0,r=e[t];let i=-1,a=-1,o=-1,l=Number.POSITIVE_INFINITY;for(let d=0;d<r.length;d+=1){const f=d5.get(r[d])??0;f<s&&f>a&&(a=f,i=d),f>s&&f<l&&(l=f,o=d)}const u=i>=0?i+1:o>=0?o:r.length;r.splice(u,0,n)}}function xA(e){const t={visible:[],more:[]},n=new Set;if(e&&typeof e=="object"){const s=e;for(const r of["visible","more"]){const i=s[r];if(Array.isArray(i))for(const a of i)Lut(a)&&(n.has(a)||(n.add(a),t[r].push(a)))}}return f5(t,"visible"),f5(t,"more"),t}function Hut(e){return e.reduce((t,n)=>{const s=n.attention??0;return Number.isFinite(s)&&s>0?t+s:t},0)}const Hf={layout:["desktop","sidebar_layout"]};async function Uut(){const e=await nt({op:"sidebar_layout.get"});return xA(e.layout)}function Gut(e,t=()=>!1){const n=Rt(),s=Rn({queryKey:Hf.layout,enabled:e,queryFn:Uut,staleTime:Number.POSITIVE_INFINITY,retry:Vv}),r=m.useRef(0),i=on({scope:{id:"sidebar-layout"},mutationFn:async d=>{const f=await nt({op:"sidebar_layout.set",layout:Mut(d,t)});return xA(f.layout)},retry:ree,onMutate:async d=>{const f=++r.current;await n.cancelQueries({queryKey:Hf.layout});const p=n.getQueryData(Hf.layout);return n.setQueryData(Hf.layout,d),{previous:p,seq:f}},onError:(d,f,p)=>{p?.seq===r.current&&p.previous&&n.setQueryData(Hf.layout,p.previous),sn(h("ui.shell.sidebar_navigation.save_failed"))},onSettled:(d,f,p,g)=>{g?.seq===r.current&&n.invalidateQueries({queryKey:Hf.layout})}}),a=e&&s.data!==void 0;return{layout:a?s.data:_y,canCustomise:a,save:d=>{a&&i.mutate(d)},reset:()=>{a&&i.mutate(xA(_y))}}}const p5=({expanded:e})=>(Ge(),c.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c.jsx(h8,{className:"size-6",label:e?void 0:h("ui.shell.collapsible_app_logo.local_operator")}),e&&c.jsx("span",{className:"truncate font-semibold text-body text-ink",children:h("ui.shell.collapsible_app_logo.local_operator")})]})),nQ=()=>{const e=KA(),t=Hn(),n=Ie(u=>u.setCataloguePageable),s=Ie(u=>u.setCatalogueActivityHead),r=Ie(u=>u.fetchSessions),i=gt(t.data,"session_catalogue_page"),a=gt(t.data,"session_catalogue_sort");m.useEffect(()=>{n(i)},[i,n]),m.useEffect(()=>{s(a)},[a,s]);const o=vr(t.data,"session_catalogue",2)==="enabled",l=m.useCallback(()=>r(i?H5:Cy,i),[r,i]);return m.useEffect(()=>{o&&l()},[o,l,e.catalogueRevision]),null},g5="flex h-[30px] w-full items-center gap-2 rounded-md px-2 text-body-sm transition-colors duration-fast ease-out-quart",Vut=()=>{Ge();const e=Iy()==="rtl",t=Yr(),n=TG(),{expanded:s,onCollapse:r}=toe(),i=et(se=>se.openCommandPalette),a=Hn(),o=vrt(gt(a.data,"team_bridge_conversations")),l=Ie(se=>se.activeSessionId),u=$X(),d=vr(a.data,"peers")==="enabled",f=uC(d),p=vr(a.data,"approvals")==="enabled",g=QX(f==="member"&&p,{poll:!0}),v=qX(g.data??[]),b=gt(a.data,"projects",1),x=gt(a.data,"library",1),_=gt(a.data,"notifications",1),w=CH(_),y=_?SH(w.data):0,S=et(se=>se.sidebarOverflowExpanded),C=et(se=>se.setSidebarOverflowExpanded),E=gt(a.data,"aida",1),k=Qh(E),F=E&&k.data?.enabled===!0,A=k.data?.name??"Aida",I=Tge(),N=WX(k.data?.session_id),P=Nut(k.data?.session_id),M=()=>{I(t,k.data).catch(se=>sn($f(se)))},z=new Map;F&&z.set("aida",{icon:noe,label:A,path:"/chat",isActive:n==="chat"&&!!k.data?.session_id&&l===k.data?.session_id,tourTag:"nav-item-aida",onSelect:M,attention:N,attentionTag:"nav-aida-badge",attentionName:se=>h("ui.shell.sidebar_navigation.aida_missed",{name:A,count:se}),working:P,workingName:h("ui.shell.sidebar_navigation.aida_working",{name:A})}),_&&z.set("notifications",{icon:Fue,label:h("ui.notifications.nav.label"),path:"/notifications",isActive:n==="notifications",tourTag:"nav-item-notifications",attention:y,attentionTag:"nav-notifications-badge",attentionName:se=>h("ui.notifications.nav.unread",{count:se,countText:String(se)})}),x&&z.set("library",{icon:Cde,label:h("ui.library.page.title"),path:"/library",isActive:n==="library",tourTag:"nav-item-library"}),b&&z.set("projects",{icon:YU,label:h("ui.shell.sidebar_navigation.projects"),path:"/projects",isActive:n==="projects",tourTag:"nav-item-projects"}),z.set("agents",{icon:Il,label:h("ui.shell.sidebar_navigation.agents"),path:"/agents",isActive:n==="agents",tourTag:"nav-item-agents"}),z.set("schedules",{icon:qU,label:h("ui.shell.sidebar_navigation.schedules"),path:"/schedules",isActive:n==="schedules",tourTag:"nav-item-schedules"}),z.set("browser",{icon:Ju,label:h("ui.shell.sidebar_navigation.browser"),path:"/browser",isActive:n==="browser",tourTag:"nav-item-browser",attention:u,attentionTag:"nav-browser-badge",attentionName:se=>h("ui.shell.sidebar_navigation.browser_waiting",{count:se,countText:String(se)})}),o&&z.set("team-bridge",{...o,isActive:n==="team-bridge"}),z.set("agent-hub",{icon:nG,label:h("ui.shell.sidebar_navigation.agent_hub"),path:"/agent-hub",isActive:n==="agent-hub",tourTag:"nav-item-agent-hub"}),f==="member"&&z.set("mesh",{icon:fH,label:h("ui.shell.sidebar_navigation.mesh"),path:"/mesh",isActive:n==="mesh",tourTag:"nav-item-mesh",attention:v,attentionTag:"nav-mesh-badge",attentionName:se=>h("ui.shell.sidebar_navigation.mesh_waiting",{count:se,countText:String(se)})});const L=new Set(z.keys()),X=gt(a.data,"sidebar_layout",1),{layout:J,canCustomise:re,save:q,reset:ee}=Gut(X,se=>gt(a.data,se,1)),oe=re?J:_y,B=R_(oe,"visible",L),U=R_(oe,"more",L),[G,K]=m.useState(!1),ne=S||G||U.some(se=>z.get(se)?.isActive),[he,te]=m.useState(""),[Te,Z]=m.useState(null),ge=m.useRef(new Map),W=se=>{requestAnimationFrame(()=>ge.current.get(se)?.focus())},[ye,De]=m.useState(null),[Ne,pe]=m.useState(null),ve=m.useRef(null),Se=m.useRef(null),Ce=m.useRef(null),fe=m.useRef(0),Be=m.useRef(0),ae=m.useRef(null),$e=m.useRef(null),Xe=m.useRef(!1),ue=se=>{const le=ve.current;return le===null?[]:Array.from(le.querySelectorAll("[data-sidebar-row]")).filter(we=>we.dataset.sidebarRow!==se).map(we=>{const Ee=we.getBoundingClientRect();return{id:we.dataset.sidebarRow??"",top:Ee.top,bottom:Ee.bottom}})},Me=(se,le)=>{const we=ve.current;if(we===null)return null;const Ee=we.getBoundingClientRect(),We=ue(le),ke=ot=>We.filter(jt=>Ao(oe,jt.id)===ot);let Ye=null;if(se.kind==="more"){const ot=ke("more").at(-1);if(ot)Ye=ot.bottom;else{const jt=we.querySelector("[data-sidebar-more]");Ye=jt?jt.getBoundingClientRect().bottom:Ee.top+2}}else if(se.kind==="band"){const ot=Ao(oe,le),Gt=ke(ot==="more"?"visible":"more").at(-1);if(Gt)Ye=Gt.bottom;else if(ot==="more"){const tn=we.querySelector("[data-sidebar-more]");Ye=tn?tn.getBoundingClientRect().top:Ee.top+2}}else{const ot=We[se.slot];ot?Ye=ot.top:Ye=We.at(-1)?.bottom??Ee.top+2}return Ye===null?null:Math.round(Ye-Ee.top+we.scrollTop)},Pe=()=>{$e.current!==null&&(window.clearTimeout($e.current),$e.current=null)},je=(se,le)=>{const we=Se.current;if(we===null||!we.armed)return;const Ee=document.elementFromPoint(se,le),We=!!Ee?.closest("[data-sidebar-more]"),ke=!!Ee?.closest("[data-sidebar-drop-band]");let Ye;if(We)Ye={kind:"more"},Ao(oe,we.id)==="visible"&&!ne&&$e.current===null&&($e.current=window.setTimeout(()=>{$e.current=null,K(!0),requestAnimationFrame(()=>at.current(fe.current,Be.current))},400));else if(Pe(),ke)Ye={kind:"band"};else{const ot=ue(we.id),jt=VK(ot,we.id,le),Gt=ot[jt];let tn="visible";if(Gt)tn=Ao(oe,Gt.id);else{const os=ot.at(-1);tn=os?Ao(oe,os.id):"visible"}Ye={kind:"slot",slot:jt,beforeId:Gt?.id??null,region:tn}}Ce.current=Ye,pe(Me(Ye,we.id))},at=m.useRef(je);at.current=je;const bt=()=>{ae.current!==null&&(cancelAnimationFrame(ae.current),ae.current=null)},At=()=>{ae.current=null;const se=Se.current,le=ve.current;if(se===null||!se.armed||le===null)return;const we=le.getBoundingClientRect(),Ee=Be.current,We=le.scrollHeight-le.clientHeight;let ke=0;Ee-we.top<24&&le.scrollTop>0?ke=-1:we.bottom-Ee<24&&le.scrollTop<We&&(ke=1),ke!==0&&(le.scrollTop+=ke*8,at.current(fe.current,Ee)),ae.current=requestAnimationFrame(At)},ln=(se,le)=>{if(re&&le.button===0&&!(le.altKey||le.ctrlKey||le.metaKey||le.shiftKey)){try{le.currentTarget.setPointerCapture(le.pointerId)}catch{}Se.current={pointerId:le.pointerId,id:se,armed:!1,startX:le.clientX,startY:le.clientY},fe.current=le.clientX,Be.current=le.clientY}},Qt=se=>{const le=Se.current;if(!(le===null||le.pointerId!==se.pointerId)){if(fe.current=se.clientX,Be.current=se.clientY,!le.armed){if(Math.hypot(se.clientX-le.startX,se.clientY-le.startY)<5)return;le.armed=!0,Xe.current=!0,De(le.id);const we=z.get(le.id);we&&te(h("ui.shell.sidebar_navigation.drag_armed",{name:we.label})),ae.current===null&&(ae.current=requestAnimationFrame(At))}je(se.clientX,se.clientY)}},ut=(se,le)=>{if(le.kind==="slot")return jut(oe,se,le.region,le.beforeId,L);const we=Ao(oe,se),Ee=le.kind==="more"?"more":we==="more"?"visible":"more";return h5(oe,se,Ee)},cn=(se,le)=>{const we=z.get(se);if(we===void 0)return;const Ee=ut(se,le);if(Ee===null||aE(Ee,oe))return;const We=Ao(Ee,se);if(We==="more"&&C(!0),q(Ee),le.kind==="slot"){Zt(Ee,se);return}te(We==="more"?h("ui.shell.sidebar_navigation.move_to_more_note",{name:we.label}):h("ui.shell.sidebar_navigation.show_in_sidebar_note",{name:we.label}))},Zt=(se,le)=>{const we=z.get(le),Ee=Ao(se,le),We=R_(se,Ee,L);te(h("ui.shell.sidebar_navigation.move_note",{name:we?.label??"",position:String(We.indexOf(le)+1),total:String(We.length)}))},Dt=(se,le=!1)=>{const we=Se.current;if(we===null)return;Se.current=null,bt(),Pe();const Ee=Ce.current;if(Ce.current=null,De(null),pe(null),K(!1),!!we.armed){if(!se){if(le){Xe.current=!1,te("");return}const We=()=>{Xe.current=!1},ke=()=>{window.setTimeout(We,0)},Ye=()=>{window.removeEventListener("pointerup",ot,!0),window.removeEventListener("pointercancel",jt,!0),window.removeEventListener("blur",jt,!0)},ot=()=>{Ye(),ke()},jt=()=>{Ye(),We()};window.addEventListener("pointerup",ot,!0),window.addEventListener("pointercancel",jt,!0),window.addEventListener("blur",jt,!0),te("");return}window.setTimeout(()=>{Xe.current=!1},0),Ee!==null&&cn(we.id,Ee)}},$t=m.useRef(Dt);$t.current=Dt,m.useEffect(()=>{if(ye===null)return;const se=Ee=>{Ee.key==="Escape"&&($t.current(!1),Ee.preventDefault())},le=Ee=>{Se.current?.pointerId===Ee.pointerId&&$t.current(!0)},we=()=>$t.current(!1,!0);return window.addEventListener("keydown",se),window.addEventListener("pointerup",le),window.addEventListener("pointercancel",we),window.addEventListener("blur",we),()=>{window.removeEventListener("keydown",se),window.removeEventListener("pointerup",le),window.removeEventListener("pointercancel",we),window.removeEventListener("blur",we)}},[ye]),m.useEffect(()=>()=>{ae.current!==null&&cancelAnimationFrame(ae.current),$e.current!==null&&window.clearTimeout($e.current)},[]);const Un=(se,le)=>{if(!re)return;const we=z.get(se);if(we===void 0)return;if(le.kind==="reset"){ee(),te(h("ui.shell.sidebar_navigation.reset_note")),W(se);return}if(le.kind==="move"){const We=But(oe,se,le.delta,L);if(We===null)return;q(We),Zt(We,se),W(se);return}const Ee=h5(oe,se,le.region);aE(Ee,oe)||(le.region==="more"&&C(!0),q(Ee),te(le.region==="more"?h("ui.shell.sidebar_navigation.move_to_more_note",{name:we.label}):h("ui.shell.sidebar_navigation.show_in_sidebar_note",{name:we.label})),W(se))},On=c.jsx(Qet,{selectedConversation:l??void 0,onSelectConversation:se=>void wg(t,se),onStageDraft:(se,le)=>{Ie.getState().stageDraft(se,le),t("/chat")}}),Tt=se=>{const le=se.attention??0,we=le>0&&se.attentionName?se.attentionName(le):se.label;return se.working&&se.workingName?se.workingName:we},ys=se=>{const le=z.get(se);if(le===void 0)return null;const we=Ao(oe,se),Ee=we==="more"?U:B,We=Ee.indexOf(se),ke=We<=0,Ye=We===-1||We>=Ee.length-1,ot=le.attention??0,jt=Tt(le),Gt=ye===se,tn=e?"left":"right",os=le.isActive?Io:"text-ink-muted hover:bg-row-hover hover:text-ink",vn=c.jsx(le.icon,{size:16,"aria-hidden":"true",className:R("shrink-0",le.isActive&&"text-accent")}),Cs=c.jsxs("button",{type:"button",ref:dn=>{dn?ge.current.set(se,dn):ge.current.delete(se)},onClick:()=>{if(Xe.current){Xe.current=!1;return}le.onSelect?le.onSelect():t(le.path)},onPointerDown:re?dn=>ln(se,dn):void 0,onPointerMove:re?Qt:void 0,onPointerUp:re?dn=>{Se.current?.pointerId===dn.pointerId&&Dt(!0)}:void 0,onPointerCancel:re?()=>Dt(!1,!0):void 0,onKeyDown:re?dn=>{if(dn.key==="ContextMenu"||dn.shiftKey&&dn.key==="F10"){dn.preventDefault(),Z(se);return}dn.altKey&&(dn.key!=="ArrowUp"&&dn.key!=="ArrowDown"||(dn.preventDefault(),Un(se,{kind:"move",delta:dn.key==="ArrowUp"?-1:1})))}:void 0,"data-tour-tag":le.tourTag,"aria-current":le.isActive?"page":void 0,"aria-haspopup":re?"menu":void 0,"aria-label":s&&jt===le.label?void 0:jt,className:R("flex h-full min-w-0 flex-1 items-center gap-2 rounded-md",s?"px-2":"justify-center px-0"),children:[s?vn:c.jsxs("span",{className:"relative flex size-7 shrink-0 items-center justify-center",children:[vn,ot>0&&c.jsx("span",{className:"pointer-events-none absolute -top-1 -end-1.5 flex",children:c.jsx(ep,{count:ot,placement:"corner","data-tour-tag":le.attentionTag})})]}),!s&&le.working&&c.jsx("span",{className:"inline-flex",children:c.jsx(ui,{size:16,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})}),s&&c.jsx("span",{className:"truncate",children:le.label})]}),Ss=re?c.jsxs($o,{open:Te===se,onOpenChange:dn=>Z(dn?se:null),children:[c.jsx(ao,{asChild:!0,children:s?c.jsx("button",{type:"button","data-sidebar-row-menu":"","aria-label":h("ui.shell.sidebar_navigation.row_actions",{name:le.label}),className:R("me-0.5 flex size-6 shrink-0 items-center justify-center rounded-sm","text-ink-muted opacity-0 transition-opacity duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink","group-hover/row:opacity-100 group-focus-within/row:opacity-100","focus-visible:opacity-100 data-[state=open]:opacity-100",ye!==null&&"pointer-events-none opacity-0!"),children:c.jsx(xc,{size:16,"aria-hidden":"true"})}):c.jsx("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-1 end-0 w-0"})}),c.jsxs(zo,{align:"start",side:tn,sideOffset:s?6:16,className:"min-w-44",onCloseAutoFocus:dn=>{dn.preventDefault(),W(se)},children:[c.jsx(en,{disabled:ke,onSelect:()=>Un(se,{kind:"move",delta:-1}),children:h("ui.shell.sidebar_navigation.move_up")}),c.jsx(en,{disabled:Ye,onSelect:()=>Un(se,{kind:"move",delta:1}),children:h("ui.shell.sidebar_navigation.move_down")}),c.jsx(Mr,{}),we==="more"?c.jsx(en,{onSelect:()=>Un(se,{kind:"region",region:"visible"}),children:h("ui.shell.sidebar_navigation.show_in_sidebar")}):c.jsx(en,{onSelect:()=>Un(se,{kind:"region",region:"more"}),children:h("ui.shell.sidebar_navigation.move_to_more")}),!aE(oe,_y)&&c.jsxs(c.Fragment,{children:[c.jsx(Mr,{}),c.jsx(en,{onSelect:()=>Un(se,{kind:"reset"}),children:h("ui.shell.sidebar_navigation.reset_layout")})]})]})]}):null;return c.jsxs("li",{"data-sidebar-row":se,"data-sidebar-region":we,onContextMenu:re?dn=>{dn.preventDefault(),Z(se)}:void 0,className:R("group/row relative flex h-[30px] w-full items-center rounded-md","transition-colors duration-fast ease-out-quart",os,Gt&&hY,Gt&&fY),children:[s?Cs:c.jsx(Du,{content:Tt(le),side:tn,suppressed:ye!==null,children:Cs}),Ss,s&&(ot>0||le.working)&&c.jsxs("span",{"aria-hidden":"true",className:"pointer-events-none inline-flex shrink-0 items-center gap-1 pe-2",children:[ot>0&&c.jsx(ep,{count:ot,"data-tour-tag":le.attentionTag}),le.working&&c.jsx(ui,{size:16,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})]})]},le.tourTag)},Gn=Ne===null?null:c.jsx("span",{"aria-hidden":"true","data-sidebar-drop-indicator":"",className:"pointer-events-none absolute inset-x-1 z-10 h-0.5 -translate-y-px rounded-full bg-accent",style:{top:Ne}}),ns=(ye===null?null:Ao(oe,ye))==="more"?h("ui.shell.sidebar_navigation.show_in_sidebar"):h("ui.shell.sidebar_navigation.move_to_more"),Fn=ye===null?null:s?c.jsx("div",{"data-sidebar-drop-band":"",className:"absolute inset-x-0 top-full z-20 mt-1 flex h-7 items-center justify-center rounded-md border border-dashed border-control bg-surface text-meta text-ink-dim",children:ns}):c.jsx(Du,{content:ns,side:e?"left":"right",children:c.jsx("div",{"data-sidebar-drop-band":"",className:"absolute inset-x-0 top-full z-20 mx-auto mt-1 flex h-6 w-8 items-center justify-center rounded-sm border border-dashed border-control bg-surface",children:c.jsx("span",{"aria-hidden":"true",className:"h-0.5 w-4 rounded-full bg-ink-dim"})})}),Vs=c.jsx("span",{className:"sr-only","aria-live":"polite","aria-atomic":"true",children:he}),hn=s?h("ui.shell.sidebar_navigation.collapse_sidebar"):h("ui.shell.sidebar_navigation.expand_sidebar"),rn=s?e?Qi:Xu:e?Xu:Qi,Nt=navigator.platform.toUpperCase().indexOf("MAC")>=0,Ws=gt(a.data,"session_catalogue",2),Dn=Ie(se=>se.activeDraftKey),Cn=Ie(se=>se.drafts),Je=!!Dn&&!(Dn?Cn[Dn]:void 0)?.target,It=()=>{Ie.getState().stageDraft(void 0,!0),t("/chat")},V=h("ui.shell.sidebar_navigation.new_chat_shortcut",{shortcut:Fi(o6(Nt).replace("+",""))}),Q=h("ui.shell.sidebar_navigation.search_accessible",{everything:Fi(_l("everything",Nt)),chats:Fi(_l("chats",Nt))}),j=h("ui.shell.sidebar_navigation.search_tooltip",{everything:Fi(_l("everything",Nt)),chats:Fi(_l("chats",Nt))}),H=(se,le,we,Ee)=>{const We=se;return c.jsxs("button",{type:"button",...Ee.attrs,onClick:Ee.onClick,disabled:Ee.disabled,"aria-label":Ee.ariaLabel,"aria-current":Ee.current?"page":void 0,className:R(g5,Ee.current?Io:"text-ink-muted hover:bg-row-hover hover:text-ink","disabled:text-ink-disabled disabled:hover:bg-transparent"),children:[c.jsx(We,{size:16,"aria-hidden":"true",className:"shrink-0"}),c.jsx("span",{className:"truncate",children:le}),c.jsx("span",{"aria-hidden":"true",className:"ms-auto",children:c.jsx(Ur,{shortcut:we,joined:!0})})]})},O=H(gT,h("ui.shell.sidebar_navigation.new_chat"),o6(Nt),{onClick:It,ariaLabel:V,current:Je,disabled:!Ws,attrs:{"data-tour-tag":"nav-item-chat","data-new-chat-row":""}}),Y=H(Ah,h("ui.shell.sidebar_navigation.search"),Lrt("everything",Nt),{onClick:i,ariaLabel:Q,attrs:{"data-command-palette-trigger":"",title:j}}),xe=(se,le,we)=>{const Ee=se;return c.jsx(Du,{content:c.jsx(Bo,{text:le}),side:e?"left":"right",children:c.jsx("button",{type:"button",...we.attrs,onClick:we.onClick,disabled:we.disabled,"aria-label":le,className:R("flex size-8 items-center justify-center rounded-sm text-ink-muted","transition-colors duration-fast ease-out-quart","hover:bg-row-hover hover:text-ink","disabled:text-ink-disabled disabled:hover:bg-transparent"),children:c.jsxs("span",{className:"relative flex size-7 items-center justify-center",children:[c.jsx(Ee,{size:16,"aria-hidden":"true"}),(we.attention??0)>0&&c.jsx("span",{className:"pointer-events-none absolute -top-1 -end-1.5 flex",children:c.jsx(ep,{count:we.attention??0,placement:"corner","data-tour-tag":we.attentionTag})}),we.working&&c.jsx("span",{className:"pointer-events-none absolute -bottom-0.5 -end-0.5 flex",children:c.jsx(ui,{size:12,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})})]})})})},Re=c.jsx("div",{className:R("pointer-events-none opacity-0 transition-opacity duration-fast ease-out-quart","group-hover/sidebar:pointer-events-auto group-hover/sidebar:opacity-100","group-focus-within/sidebar:pointer-events-auto group-focus-within/sidebar:opacity-100"),children:c.jsx(Du,{content:hn,side:e?"left":"right",children:c.jsx(ce,{variant:"ghost",size:"icon-sm",onClick:r,"aria-label":hn,"aria-expanded":s,"aria-keyshortcuts":kN(Nt),children:c.jsx(rn,{"aria-hidden":"true"})})})}),_e=()=>{if(U.length===0)return null;const se=U.map(ke=>z.get(ke)).filter(ke=>ke!==void 0),le=Hut(se),we=ne?0:le,Ee=se.some(ke=>ke.working===!0),We=le>0?h("ui.shell.sidebar_navigation.more_waiting",{count:le,countText:String(le)}):Ee?h("ui.shell.sidebar_navigation.more_working"):h("ui.library.page.more_destinations");return c.jsxs("li",{className:R("flex flex-col",s?"gap-0.5":"items-center gap-1"),children:[s?c.jsxs("button",{type:"button","data-tour-tag":"nav-item-more","data-sidebar-more":"","aria-expanded":ne,"aria-controls":"sidebar-more-destinations","aria-label":We,onClick:()=>C(!ne),className:R(g5,"text-ink-muted hover:bg-row-hover hover:text-ink"),children:[c.jsx(xc,{size:16,"aria-hidden":"true",className:"shrink-0"}),c.jsx("span",{className:"min-w-0 flex-1 truncate text-start",children:h("ui.library.page.more")}),(we>0||Ee)&&c.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1",children:[we>0&&c.jsx(ep,{count:we,"data-tour-tag":"nav-more-badge"}),Ee&&c.jsx(ui,{size:16,"aria-hidden":"true",className:"text-accent motion-safe:animate-spin"})]}),c.jsx(Di,{size:14,"aria-hidden":"true",className:R("shrink-0 transition-transform duration-fast",ne&&"rotate-180")})]}):xe(xc,We,{onClick:()=>C(!ne),attention:we,attentionTag:"nav-more-badge",working:Ee,attrs:{"aria-expanded":ne,"aria-controls":"sidebar-more-destinations","data-tour-tag":"nav-item-more","data-sidebar-more":""}}),ne&&c.jsx("ul",{id:"sidebar-more-destinations",className:R("flex flex-col gap-0.5",!s&&"items-center gap-1"),children:U.map(ys)})]},"nav-overflow")};return s?c.jsxs("div",{"data-sidebar-shell":"","data-glass-region":"sidebar",className:"panel-top-pad group/sidebar flex h-full min-h-0 flex-col overflow-hidden bg-surface",children:[c.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 pe-2 ps-4",children:[c.jsx(p5,{expanded:!0}),c.jsx("span",{className:"ms-auto",children:Re})]}),c.jsxs("div",{className:"flex shrink-0 flex-col gap-2 px-2 pb-2",children:[c.jsxs("div",{className:"flex flex-col gap-0.5",children:[O,Y]}),c.jsxs("div",{className:"relative",children:[c.jsxs("div",{ref:ve,"data-sidebar-destinations-area":"","data-sidebar-dragging":ye!==null?"":void 0,className:"relative min-h-0 max-h-[50dvh] overflow-y-auto select-none",children:[c.jsxs("ul",{"data-sidebar-destinations":"",className:"flex flex-col gap-0.5",children:[B.map(ys),_e()]}),Gn]}),Fn]}),Vs]}),c.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:On}),c.jsx(VX,{})]}):c.jsxs("div",{"data-sidebar-strip":"","data-glass-region":"sidebar",className:"panel-top-pad group/sidebar flex h-full min-h-0 flex-col items-center bg-surface",children:[c.jsx(nQ,{}),c.jsx("div",{className:"flex h-10 shrink-0 items-center justify-center",children:c.jsx(p5,{expanded:!1})}),c.jsxs("ul",{className:"flex flex-col items-center gap-1",children:[c.jsx("li",{children:xe(Qi,hn,{onClick:r,attrs:{"aria-expanded":!1,"aria-keyshortcuts":kN(Nt)}})}),c.jsx("li",{children:xe(gT,V,{onClick:It,disabled:!Ws,attrs:{"data-tour-tag":"nav-item-chat"}})}),c.jsx("li",{children:xe(Ah,Q,{onClick:i,attrs:{"data-command-palette-trigger":""}})})]}),c.jsxs("div",{ref:ve,"data-sidebar-destinations-area":"","data-sidebar-dragging":ye!==null?"":void 0,className:"relative mt-4 flex flex-col items-center gap-1 select-none",children:[c.jsxs("ul",{"data-sidebar-destinations":"",className:"flex flex-col items-center gap-1",children:[B.map(ys),_e()]}),Gn,Fn]}),Vs,c.jsxs("div",{className:"mt-auto flex flex-col items-center gap-1 pb-2",children:[c.jsx(BX,{}),c.jsx(GX,{}),c.jsx(gI,{expanded:!1})]})]})},Wut=1,$ut=()=>{const{isAuthenticated:e,user:t}=Yy(),{hasBeenNotified:n,setHasBeenNotified:s}=tQ(),[r,i]=m.useState(!1),[a,o]=m.useState(null),l=m.useCallback(async()=>{if(!(!e||!t?.radientUser?.account?.tenant_id))try{const p=await soe({operation:"credits",tenantId:t.radientUser.account.tenant_id});if(!p||typeof p.balance!="number")throw new Error(h("ui.common.errors.credit_balance_invalid"));o(p.balance)}catch(p){console.error("Failed to fetch Radient credits:",p),o(null)}},[e,t?.radientUser?.account?.tenant_id]);return m.useEffect(()=>{e&&l()},[e,l]),m.useEffect(()=>{e&&a!==null?a<Wut?n||i(!0):(i(!1),n&&s(!1)):i(!1)},[e,n,a,s]),{isLowCreditsDialogOpen:r,openRadientConsole:()=>{window.api?.openExternal?window.api.openExternal("https://console.radienthq.com"):window.open("https://console.radienthq.com","_blank"),s(!0),i(!1)},closeLowCreditsDialog:()=>{i(!1)},onLowCreditsDialogClose:()=>{s(!0),i(!1)},currentCredits:a}};function zut(){const e=Yr();m.useEffect(()=>{const t=r=>{e(r==="back"?-1:1)},n=r=>{const i=FH(r);i&&(r.preventDefault(),t(i))},s=r=>{const i=DH(r);i&&(r.preventDefault(),t(i))};return window.addEventListener("keydown",n),window.addEventListener("mouseup",s),()=>{window.removeEventListener("keydown",n),window.removeEventListener("mouseup",s)}},[e])}function qut(){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 Kut(e,t,n){const s=document.documentElement;if(t==="mac"){s.dataset.chromeLeading="true",s.dataset.chromeTrailing="false";return}if(e===null){s.dataset.chromeLeading="false",s.dataset.chromeTrailing="false";return}s.dataset.chromeLeading=e.x<=1?"true":"false",s.dataset.chromeTrailing=Math.abs(e.x+e.width-n)<=1?"true":"false"}function Yut(e){const t=window.api?.windowChrome;if(!t)return;const n=getComputedStyle(document.documentElement),s=n.getPropertyValue("--lo-canvas").trim(),r=n.getPropertyValue("--lo-ink-muted").trim(),i=n.getPropertyValue("--lo-ink-dim").trim();!s||!r||!i||t.report({themeId:e,colors:{ground:s,symbol:r,symbolInactive:i}})}function Xut(){m.useLayoutEffect(()=>{if(!window.api?.windowChrome)return;const t=document.documentElement.dataset.chromePlatform??"linux",n=()=>Kut(qut(),t,window.innerWidth);n();const s=navigator.windowControlsOverlay;return s?.addEventListener?.("geometrychange",n),window.addEventListener("resize",n),()=>{s?.removeEventListener?.("geometrychange",n),window.removeEventListener("resize",n)}},[]),m.useEffect(()=>{const e=window.api?.windowChrome;if(e)return e.onState(t=>{document.documentElement.dataset.chromeFullscreen=t.fullScreen?"true":"false"})},[])}const Qut=m.lazy(()=>ka(()=>import("./agent-details-page-CdnNoAG1.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]),import.meta.url).then(e=>({default:e.AgentDetailsPage}))),Jut=m.lazy(()=>ka(()=>import("./agent-hub-page-DzJe_j6z.js"),__vite__mapDeps([16,1,2,3,5,6,17,8,7,9,4,10,11,12,13,18,19,20,21,14,15]),import.meta.url).then(e=>({default:e.AgentHubPage}))),m5=m.lazy(()=>ka(()=>import("./agents-page-B8ehgi1r.js").then(e=>e.a),__vite__mapDeps([22,7,1,2,3,5,6,8,9,18,23,24,25]),import.meta.url).then(e=>({default:e.AgentsPage}))),Zut=m.lazy(()=>ka(()=>import("./schedules-page-DWG-H1tc.js"),__vite__mapDeps([26,1,2,3,5,6,17,8,7,9,27,12,14,15]),import.meta.url).then(e=>({default:e.SchedulesPage}))),v5=m.lazy(()=>ka(()=>import("./projects-page-Cy7ci4iQ.js"),__vite__mapDeps([28,1,2,3,7,5,6,8,9,17,14,15,25,29]),import.meta.url).then(e=>({default:e.ProjectsPage}))),b5=m.lazy(()=>ka(()=>import("./library-page-1Q4ToZpC.js").then(e=>e.l),__vite__mapDeps([30,1,2,3,14,5,6,15,17,7,8,9,13,29]),import.meta.url).then(e=>({default:e.LibraryPage}))),x5=m.lazy(()=>ka(()=>import("./notifications-page-DLvG89Rx.js"),__vite__mapDeps([31,1,2,3,14,5,6,15,17,8,7,9,25]),import.meta.url).then(e=>({default:e.NotificationsPage}))),edt=m.lazy(()=>ka(()=>import("./team-bridge-page-DyGy6Kbj.js"),__vite__mapDeps([32,1,2,3,7,5,6,8,9,33,24,21,14,15]),import.meta.url).then(e=>({default:e.TeamBridgePage}))),tdt=m.lazy(()=>ka(()=>import("./browser-page-B1LNZlf_.js"),__vite__mapDeps([34,1,2,3,5,6,8,7,9,14,15]),import.meta.url).then(e=>({default:e.BrowserPage}))),ndt=m.lazy(()=>ka(()=>import("./mesh-page-B2xAXfjA.js"),__vite__mapDeps([35,1,2,3,5,6,17,8,7,9,14,15]),import.meta.url).then(e=>({default:e.MeshPage}))),sdt=m.lazy(()=>ka(()=>import("./settings-page-Cc3TAlMl.js"),__vite__mapDeps([36,1,2,3,5,6,14,15,7,8,9,17,33,19,23,37,11,27,12]),import.meta.url).then(e=>({default:e.SettingsPage}))),rdt=m.lazy(()=>ka(()=>import("./browser-webauthn-prompt-D7ldFLmy.js"),__vite__mapDeps([38,1,2,3,5,6,8,7,9,14,15]),import.meta.url).then(e=>({default:e.BrowserWebauthnPrompt}))),idt=()=>{Ge(),Jlt(),Xut(),kut(),roe();const{pathname:e}=SA(),t=e.startsWith("/chat")||e.startsWith("/browser"),{isOnboardingActive:n}=Tpe(),{isLowCreditsDialogOpen:s,openRadientConsole:r,onLowCreditsDialogClose:i}=$ut(),{isCommandPaletteOpen:a,isCreateAgentDialogOpen:o,isSidebarCollapsed:l,closeCreateAgentDialog:u}=et();Fu(a,"command-palette"),Fu(o,"dialog","create-agent"),Fu(n,"onboarding"),Fu(s,"dialog","low-credits");const d=Yr(),f=Hn(),p=gt(f.data,"session_catalogue",2),g=gt(f.data,"session_archive");m.useEffect(()=>{Ie.getState().requestArchiveConfirm(null)},[e]);const v=vr(f.data,"peers"),b=vr(f.data,"library"),x=vr(f.data,"notifications"),_=vr(f.data,"team_bridge_conversations"),w=_==="enabled"&&e.startsWith(ag);Sut(gt(f.data,"team_bridge_conversations"));const y=P=>{Ie.getState().stageDraft({kind:"agent",name:P.name}),d("/chat"),u()};dit(),Rut(),Uoe(),ioe(),zut(),Owe();const S=Ie(P=>P.setActiveSession),C=Hn(),E=Qh(gt(C.data,"aida",1)),k=Ie(P=>{const M=P.activeDraftKey?P.drafts[P.activeDraftKey]:void 0;return zv(P.activeDraftKey,M?.sessionId,P.activeSessionId)}),F=Cge({displayedSessionId:k,archiveEnabled:g}),A=et(P=>P.setConsolePaneOpen),I=et(P=>P.setBrowserPaneOpen),N=et(P=>P.setConsoleActiveSurface);return m.useEffect(()=>{const P=window.api?.desktop?.onOpenConversation?.((M,z)=>{M!==null&&performance.mark("lop:open:requested"),S(M),z!==void 0&&M!==null&&(N(z),A(!0)),d("/chat")});return()=>P?.()},[d,S,A,N]),Nrt(_==="enabled",d),Aut(_==="enabled",d),m.useEffect(()=>{const P=window.api?.console?.onReveal?.(M=>{if(M.mode!=="none"&&!(M.mode==="session"&&M.session_id!==k)){if(M.mode==="open"){if(!aoe({targetSessionId:M.session_id,displayedSessionId:k,activeElement:document.activeElement,commandPaletteOpen:a}))return;S(M.session_id)}N(M.surface),A(!0)}});return()=>P?.()},[k,a,S,A,N]),Yge(),tst(),m.useEffect(()=>{const P=window.api?.browser?.onConsentAttention?.(M=>{const z=Dge(M.requesterSessionId,Ie.getState().sessions);if(Rge(M.entryId),z.kind==="browser"){d("/browser");return}S(z.sessionId),I(!0),d("/chat")});return()=>P?.()},[d,S,I]),m.useEffect(()=>{const P=M=>{n||p&&sst(M)&&(M.preventDefault(),Ie.getState().stageDraft(void 0,!0),d("/chat"))};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[p,n,d]),c.jsx(jlt,{children:c.jsx("div",{className:"relative flex h-screen flex-col overflow-hidden","data-titlebar-sidebar-collapsed":l&&!w?"true":"false",children:c.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[a&&c.jsx(oit,{}),c.jsx(Ult,{}),c.jsx(rst,{}),c.jsx(ooe,{}),c.jsx(hit,{enabled:v==="enabled"}),c.jsx(aat,{open:n}),c.jsx(Hlt,{}),c.jsx(tct,{}),g&&c.jsx(Zge,{}),c.jsx(ege,{}),c.jsx(m.Suspense,{fallback:null,children:c.jsx(rdt,{})}),c.jsx(vge,{blocked:n||s||a||o||F,sessionId:E.data?.session_id??null}),c.jsx(Dut,{open:s,onClose:i,onGoToConsole:r}),c.jsx(Dpe,{open:o,onClose:u,onAgentCreated:y}),c.jsx(loe,{sidebar:c.jsx(Vut,{}),routeSidebar:w&&{keeper:c.jsx(nQ,{}),label:h("ui.teamBridge.page.title")},content:c.jsxs("main",{"data-glass-region":"canvas-backing",className:"panel-top-pad flex grow flex-col overflow-hidden",children:[t?null:c.jsx("div",{"data-chrome-route-band":""}),c.jsx(m.Suspense,{fallback:c.jsxs(c.Fragment,{children:[w&&c.jsx(Vct,{}),c.jsx("div",{className:"flex grow items-center justify-center",children:c.jsx(Mn,{size:"lg",label:h("ui.common.loading.page")})})]}),children:c.jsxs(iee,{children:[c.jsx(pr,{path:"/",element:c.jsx(EN,{to:"/chat",replace:!0})}),c.jsx(pr,{path:"/chat",element:c.jsx(i6,{})}),c.jsx(pr,{path:"/chat/:agentId",element:c.jsx(i6,{})}),c.jsx(pr,{path:"/agents",element:c.jsx(m5,{})}),c.jsx(pr,{path:"/agents/:agentId",element:c.jsx(m5,{})}),c.jsx(pr,{path:"/settings",element:c.jsx(sdt,{})}),c.jsx(pr,{path:"/agent-hub",element:c.jsx(Jut,{})}),c.jsx(pr,{path:"/agent-hub/:agentId",element:c.jsx(Qut,{})}),c.jsx(pr,{path:"/schedules",element:c.jsx(Zut,{})}),c.jsx(pr,{path:"/projects",element:c.jsx(v5,{})}),c.jsx(pr,{path:"/projects/:projectId",element:c.jsx(v5,{})}),c.jsx(pr,{path:"/browser",element:c.jsx(tdt,{})}),x==="enabled"&&c.jsxs(c.Fragment,{children:[c.jsx(pr,{path:"/notifications",element:c.jsx(x5,{})}),c.jsx(pr,{path:"/notifications/:notificationId",element:c.jsx(x5,{})})]}),b==="enabled"&&c.jsxs(c.Fragment,{children:[c.jsx(pr,{path:"/library",element:c.jsx(b5,{})}),c.jsx(pr,{path:"/library/assets/:assetId",element:c.jsx(b5,{})})]}),_==="enabled"&&c.jsx(pr,{path:"/team-bridge",element:c.jsx(edt,{})}),v==="enabled"&&c.jsx(pr,{path:"/mesh",element:c.jsx(ndt,{})}),c.jsx(pr,{path:"*",element:c.jsx(EN,{to:"/chat",replace:!0})})]})})]})})]})})})};let hl=null,Uf=null,Cm=null,Gf=null,oE=null;const adt={soundsArm:async()=>{if(Tf.getState().element)throw new Error("sounds safety: element already exists");if(hl)throw new Error("sounds safety: graph already armed");return hl=new AudioContext,await hl.resume(),uoe(e=>{if(!hl)throw new Error("sounds safety: no context");const t=hl.createMediaElementSource(e);Cm=hl.createGain(),Cm.gain.value=0,Uf=hl.createAnalyser(),Gf=hl.createAnalyser(),t.connect(Gf),Gf.connect(Cm),Cm.connect(Uf),Uf.connect(hl.destination)}),{armed:!0,contextState:hl.state}},soundsFacts:()=>{const e=Tf.getState(),t=new Float32Array(Uf?.fftSize??32);Uf?.getFloatTimeDomainData(t);const n=new Float32Array(Gf?.fftSize??32);return Gf?.getFloatTimeDomainData(n),{ownerId:e.ownerId,status:e.status,time:e.element?.currentTime??0,duration:e.element?.duration??0,paused:e.element?.paused??!0,gain:Cm?.gain.value??null,inputRms:Gf?Math.sqrt(n.reduce((s,r)=>s+r*r,0)/n.length):null,players:Array.from(document.querySelectorAll("[data-sound-player]")).map(s=>({status:s.getAttribute("data-sound-status"),clock:s.querySelector("[data-sound-time]")?.textContent,clip:s.querySelectorAll("canvas")[1]?.style.clipPath,numeric:getComputedStyle(s.querySelector("[data-sound-time]")??s).fontVariantNumeric})),rms:Uf?Math.sqrt(t.reduce((s,r)=>s+r*r,0)/t.length):null,src:e.element?.src??null,nativeElements:document.querySelectorAll("audio").length,canvas:Object.values(Rs.getState().conversations).map(s=>({selectedTab:s.selectedTabId,files:s.files?.map(r=>({id:r.id,path:r.path,artifact:r.artifact??null}))}))}},soundsScrub:e=>{const t=e,n=document.querySelector(t.selector);if(!n)throw new Error("sounds: no slider");const s=n.getBoundingClientRect(),r=(u,d)=>n.dispatchEvent(new PointerEvent(u,{pointerId:17,pointerType:"mouse",clientX:d,clientY:s.y+s.height/2,bubbles:!0})),i=n.setPointerCapture,a=n.releasePointerCapture;n.setPointerCapture=()=>{},n.releasePointerCapture=()=>{},r("pointerdown",s.left+1),r("pointermove",s.left+s.width*t.fraction);const o=()=>n.closest("[data-sound-player]")?.getAttribute("data-sound-status"),l=performance.now()+1500;return new Promise(u=>{const d=()=>{const f=o();if(f!=="scrubbing"&&performance.now()<l){requestAnimationFrame(d);return}oE=()=>{r("pointerup",s.left+s.width*t.fraction),n.setPointerCapture=i,n.releasePointerCapture=a},u({during:f,seconds:Tf.getState().element?.currentTime})};requestAnimationFrame(d)})},soundsScrubFinish:()=>(oE?.(),oE=null,{committed:!0}),soundsEnd:()=>{const e=Tf.getState();if(!e.ownerId||!e.element)throw new Error("sounds: no active playback");return e.seek(e.ownerId,e.element.duration-.12),{requested:!0}},soundsSpeech:async()=>{const e=Tf.getState();if(!e.element?.src)throw new Error("sounds: fixture not resolved");const{fetchAttachmentBlob:t}=await ka(async()=>{const{fetchAttachmentBlob:r}=await import("./conversation-input-sync-BGfWeOqy.js").then(i=>i.o3);return{fetchAttachmentBlob:r}},__vite__mapDeps([7,1,2,3,5,6,8,9]),import.meta.url),n=Ie.getState().activeSessionId,s=e.ownerId?.startsWith("sound:")?e.ownerId.slice(6):null;if(!n||!s)throw new Error("sounds: missing attachment identity");return await coe.getState().speak("sounds-driver",()=>t({sessionId:n,childId:null},s)),{ownerId:Tf.getState().ownerId}}};function sh(){return new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))})}const odt=3,ldt=3e3;function cdt(e){return e instanceof CSSTransition&&e.playState==="running"}function udt(e){const t=e.effect,n=t instanceof KeyframeEffect?t.target:null,s=e.transitionProperty,i=/^[a-z-]+$/.test(s)&&n instanceof Element?getComputedStyle(n).getPropertyValue(s).trim()||"(empty)":"(unreadable)";return`${s||"(unnamed property)"} on ${Uv(n)??"an element no longer in the document"} = ${i}`}async function ddt(e=ldt){const t=performance.now();let n=0;for(;;){await sh();const s=Math.round(performance.now()-t),r=document.getAnimations().filter(cdt);if(n=r.length===0?n+1:0,n>=odt)return{waitedMs:s,timedOut:!1,pending:[]};if(s>e)return{waitedMs:s,timedOut:!0,pending:r.map(udt)}}}const hdt=/^#/;function I0(){const e=window.location.hash.replace(hdt,"");return e===""?"/":e}function Uv(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 fdt(e){const t=e.getBoundingClientRect(),n=t.left+t.width/2,s=t.top+t.height/2,r=document.elementFromPoint(n,s),i=r!==null&&(r===e||e.contains(r)),a=document.elementsFromPoint(n,s).slice(0,4).map(l=>Uv(l)),o={bubbles:!0,cancelable:!0,composed:!0,button:0,buttons:1,clientX:n,clientY:s,view:window};return e.dispatchEvent(new PointerEvent("pointerdown",{...o,pointerId:1,isPrimary:!0})),e.dispatchEvent(new MouseEvent("mousedown",o)),e.dispatchEvent(new PointerEvent("pointerup",{...o,buttons:0,pointerId:1,isPrimary:!0})),e.dispatchEvent(new MouseEvent("mouseup",{...o,buttons:0})),e.dispatchEvent(new MouseEvent("click",{...o,buttons:0})),{hitTest:i,hit:Uv(r),stack:a,disabled:e instanceof HTMLButtonElement?e.disabled:null,rect:{x:t.x,y:t.y,width:t.width,height:t.height}}}function Sm(e,t){if(typeof e!="string"||e==="")throw new Error(`${t} must be a non-empty string`);return e}async function pdt(e,t=1e4){const n=Date.now();for(;I0()!==e;){if(Date.now()-n>t)throw new Error(`route did not become ${e} (it is ${I0()})`);await new Promise(s=>setTimeout(s,50))}return await sh(),I0()}const _A=["dev-driver","query-fetch-probe"];let N0=null;function gdt(){if(N0)return N0;const e=[],t=TN.prototype.fetch;return TN.prototype.fetch=function(...s){return e.push({at:Date.now(),key:JSON.stringify(this.queryKey),stack:(new Error().stack??"").split(`
700
700
  `).slice(2).join(" | ")}),t.apply(this,s)},N0=e,e}function mdt(e){const t=N0??[],n=JSON.stringify(_A),s=t.filter(i=>i.key!==n&&(e===void 0||i.key.includes(e))),r=new Map;for(const i of s){const a=r.get(i.stack)??{key:i.key,count:0,firstAt:i.at,lastAt:i.at};a.count+=1,a.lastAt=i.at,r.set(i.stack,a)}return{armed:N0!==null,total:s.length,probeRecords:t.filter(i=>i.key===n).length,callers:[...r.entries()].map(([i,a])=>({stack:i,...a})).sort((i,a)=>i.firstAt-a.firstAt)}}function vdt(){const e=window.__loDevDriver;return e?.armed?e.install({...adt,hello:()=>({armed:!0,outDir:e.outDir,title:document.title,route:I0(),href:window.location.href,theme:et.getState().themeName,viewport:{width:window.innerWidth,height:window.innerHeight,devicePixelRatio:window.devicePixelRatio},visibilityState:document.visibilityState,hasFocus:document.hasFocus(),apiBaseUrl:er.baseUrl,userAgent:navigator.userAgent}),filesFacts:()=>doe(),state:()=>{const t=et.getState(),n=Ie.getState();return{route:I0(),theme:t.themeName,commandPaletteOpen:t.isCommandPaletteOpen,canvasOpen:t.isCanvasOpen,runPanelOpen:t.isRunPanelOpen,browserPaneOpen:t.isBrowserPaneOpen,rightSlotWidth:t.rightSlotWidth,rightSlotKey:t.rightSlotKey??null,rightSlotMemory:t.rightSlotMemory.map(([s,r])=>[s,r]),activeSessionId:n.activeSessionId,activeDraftKey:n.activeDraftKey,drafts:Object.fromEntries(Object.entries(n.drafts).map(([s,r])=>[s,{sessionId:r.sessionId??null,error:r.error!==void 0,undelivered:r.undelivered!==void 0,submitted:r.submittedText!==void 0,admissionAttempted:r.admissionAttempted===!0,model:r.model??null}])),sessionCount:n.sessions.length,cataloguePinnedCount:n.sessions.filter(s=>s.pinned===!0).length,cataloguePageable:n.cataloguePageable,catalogueActivityHead:n.catalogueActivityHead,scopes:Object.fromEntries(Object.entries(n.scopes).map(([s,r])=>[s,{ids:r.ids.length,nextCursor:r.nextCursor,loading:r.loading,error:r.error}])),countsTotal:n.counts?.total??null,archiveAttempts:n.answerSeq,archiveFailure:n.archiveFailure?{sessionId:n.archiveFailure.sessionId,archived:n.archiveFailure.archived}:null,onboardingVisible:!!document.querySelector("[data-onboarding-modal]")}},queries:()=>V_.getQueryCache().getAll().map(t=>({key:JSON.stringify(t.queryKey),status:t.state.status,fetchStatus:t.state.fetchStatus,isLoading:t.state.status==="pending"&&t.state.fetchStatus==="fetching",error:t.state.error instanceof Error?t.state.error.message:null,hasData:t.state.data!==void 0,updatedAt:t.state.dataUpdatedAt,failureCount:t.state.fetchFailureCount,observers:t.getObserversCount()})),queryFetches:async t=>{const n=t??{};if(!n.arm)return mdt(n.key);const s=gdt(),r=JSON.stringify(_A),i=s.length;return await V_.fetchQuery({queryKey:_A,queryFn:()=>null,retry:!1,staleTime:0}),{armed:!0,validated:s.slice(i).some(a=>a.key===r)}},navigate:async t=>{const n=Sm(t,"navigate path");if(!n.startsWith("/"))throw new Error(`navigate path must start with "/" (got "${n}")`);return window.location.hash=`#${n}`,{route:await pdt(n)}},setTheme:async t=>{const n=Sm(t,"theme name");et.getState().setTheme(n),await sh();const s=document.documentElement.getAttribute("data-theme"),r=await ddt();return{theme:et.getState().themeName,dataTheme:s,settledAfterMs:r.waitedMs,settleTimedOut:r.timedOut,settlePending:r.pending}},setSidebarWidth:async t=>{const n=Number(t?.width);if(!Number.isFinite(n))throw new Error("sidebar width must be a number");const s=aee(n);return et.getState().setChatSidebarWidth(s),await sh(),{width:et.getState().chatSidebarWidth,clamped:s!==n}},measure:async t=>{const n=typeof t=="string"?{selector:t}:t,s=Sm(n?.selector,"measure selector"),r=typeof n?.timeoutMs=="number"?n.timeoutMs:1e4,i=Date.now();let a=null;for(;a===null&&(a=document.querySelector(s),a===null);){if(Date.now()-i>r)throw new Error(`nothing matches ${s} after ${r}ms of waiting`);await new Promise(d=>setTimeout(d,100))}const o=a.getBoundingClientRect(),l={x:Math.round(o.left+o.width/2),y:Math.round(o.top+o.height/2)},u=document.elementFromPoint(l.x,l.y);return{selector:s,target:Uv(a),centre:l,rect:{x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height)},hitTest:u!==null&&(u===a||a.contains(u)),focused:a===document.activeElement,inViewport:o.top>=0&&o.left>=0&&o.bottom<=window.innerHeight&&o.right<=window.innerWidth}},press:async t=>{const n=typeof t=="string"?{selector:t}:t,s=Sm(n?.selector,"press selector"),r=typeof n?.timeoutMs=="number"?n.timeoutMs:1e4,i=Date.now();let a=null;for(;a===null&&(a=document.querySelector(s),a===null);){if(Date.now()-i>r)throw new Error(`nothing matches ${s} after ${r}ms of waiting`);await new Promise(l=>setTimeout(l,100))}const o=fdt(a);return await sh(),{selector:s,target:Uv(a),...o}},openCanvasDocument:async t=>{const n=t,s=Sm(n?.path,"canvas document path"),r=typeof n?.title=="string"?n.title:void 0,[i]=await window.api.probeFiles([s]);if(!i||!i.exists||!i.isFile)throw new Error(`no file at ${i?.resolved??s}`);const a=i.resolved??s,o=Po(a,{title:r,type:Zu(a),availability:"present",sizeBytes:i.sizeBytes??void 0,lastAgentModified:i.mtimeMs??void 0,readMtimeMs:i.mtimeMs??void 0}),l=zy[bg(a,o.type)??"code"];if(l==="utf-8"||l==="base64"){const f=await window.api.readFile(o.path,l);if(!f.success)throw new Error(`could not read ${o.path}`);o.content=f.data}const u=Ie.getState(),d=EA(u.activeDraftKey,u.activeSessionId)??u.stageDraft();return et.getState().setCanvasOpen(!0),Rs.getState().addFileAndSelect(d,o),n?.mention===!0&&Rs.getState().addMentionedFile(d,o),await sh(),{conversationId:d,documentId:o.id,readMtimeMs:o.readMtimeMs??null,contentLength:o.content.length,encoding:l}},stageLiveConsents:async t=>{const s=t?.count;if(typeof s!="number"||!Number.isInteger(s)||s<0)throw new Error(`stageLiveConsents count must be a non-negative integer (got ${JSON.stringify(s)})`);const r=Date.now();return Goe({tabs:[],activeTabId:null,url:"",title:"",loading:!1,canGoBack:!1,canGoForward:!1,pendingConsent:Array.from({length:s},(i,a)=>({entryId:`dev-driver-probe-${a+1}`,origin:`https://dev-driver-probe-${a+1}.example.com`,authority:`dev-driver-probe-${a+1}.example.com`,broad:null,expiresAt:r+10*6e4,requesterSessionId:null})),approvals:[],navFailure:null}),await sh(),{count:s}}}):[]}function bdt(){const e=m.useMemo(mg,[]),t=m.useRef(null);return m.useEffect(()=>{const n=window.api?.miniView;if(!n?.onRegistration)return;let s=!1;const r=a=>{if(s)return;const o=t.current;if(t.current=a.status,o===null||a.status===o||a.status==="registered")return;const l=oee(a.value,e);sn(hoe(a.status,l))};n.getRegistration?.()?.then(r)?.catch(()=>{});const i=n.onRegistration(r);return()=>{s=!0,i?.()}},[e]),null}const xdt=`
701
701
  /*
702
702
  * A transition declared on ::-webkit-scrollbar-thumb does not animate in