@checkly/playwright-core 1.48.22-beta → 1.48.22

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 (170) hide show
  1. package/lib/server/trace/recorder/tracing.js +2 -2
  2. package/lib/vite/recorder/assets/{codeMirrorModule-CR6kB851.js → codeMirrorModule-d0KhC1qL.js} +10 -10
  3. package/lib/vite/recorder/assets/{index-BcaUAUCW.js → index-Bxxcmxlu.js} +2 -2
  4. package/lib/vite/recorder/index.html +1 -1
  5. package/lib/vite/traceViewer/assets/codeMirrorModule-pBPtArIT.js +24 -0
  6. package/lib/vite/traceViewer/assets/codeMirrorModule-tzBrK1V4.js +24 -0
  7. package/lib/vite/traceViewer/assets/{inspectorTab-BPzhNk9r.js → inspectorTab-BuJ3wAX_.js} +3 -3
  8. package/lib/vite/traceViewer/assets/inspectorTab-Soeeuvzv.js +64 -0
  9. package/lib/vite/traceViewer/assets/{workbench-DLv_q9ji.js → workbench-DdmJ9AJV.js} +1 -1
  10. package/lib/vite/traceViewer/assets/workbench-lypYlf00.js +9 -0
  11. package/lib/vite/traceViewer/{embedded.BIubxTi3.js → embedded.BkvOrz5Z.js} +1 -1
  12. package/lib/vite/traceViewer/embedded.DInvAijy.js +2 -0
  13. package/lib/vite/traceViewer/embedded.html +3 -3
  14. package/lib/vite/traceViewer/{index.DPD22sZn.js → index.Dha3cgqs.js} +1 -1
  15. package/lib/vite/traceViewer/index._Iolt-uE.js +2 -0
  16. package/lib/vite/traceViewer/index.html +3 -3
  17. package/lib/vite/traceViewer/{recorder.BaRuS6Pc.js → recorder.DNMfnSiu.js} +1 -1
  18. package/lib/vite/traceViewer/recorder.DTSaNaly.js +2 -0
  19. package/lib/vite/traceViewer/recorder.html +2 -2
  20. package/lib/vite/traceViewer/{uiMode.B11wexdJ.js → uiMode.BM7yhjzl.js} +1 -1
  21. package/lib/vite/traceViewer/uiMode.Cr1tvTWS.js +5 -0
  22. package/lib/vite/traceViewer/uiMode.html +3 -3
  23. package/package.json +1 -1
  24. package/lib/cli/cli.js +0 -61
  25. package/lib/common/debugLogger.js +0 -90
  26. package/lib/generated/recorderSource.js +0 -7
  27. package/lib/server/recorder/codeGenerator.js +0 -154
  28. package/lib/server/recorder/csharp.js +0 -311
  29. package/lib/server/recorder/java.js +0 -217
  30. package/lib/server/recorder/javascript.js +0 -230
  31. package/lib/server/recorder/jsonl.js +0 -48
  32. package/lib/server/recorder/language.js +0 -45
  33. package/lib/server/recorder/python.js +0 -276
  34. package/lib/server/recorder/recorderActions.js +0 -6
  35. package/lib/server/recorder/utils.js +0 -46
  36. package/lib/utils/glob.js +0 -84
  37. package/lib/utils/mimeType.js +0 -30
  38. package/lib/vite/traceViewer/assets/codeMirrorModule-75b0ca4f.js +0 -24
  39. package/lib/vite/traceViewer/assets/codeMirrorModule-BTYWvxEC.js +0 -16437
  40. package/lib/vite/traceViewer/assets/codeMirrorModule-CNHvVrFd.js +0 -16437
  41. package/lib/vite/traceViewer/assets/codeMirrorModule-CpGx_S8D.js +0 -16443
  42. package/lib/vite/traceViewer/assets/codeMirrorModule-DGE2kpkE.js +0 -16443
  43. package/lib/vite/traceViewer/assets/codeMirrorModule-DblsdhjA.js +0 -16449
  44. package/lib/vite/traceViewer/assets/codeMirrorModule-DtXZtbmO.js +0 -16437
  45. package/lib/vite/traceViewer/assets/codeMirrorModule-SomGa-Da.js +0 -16443
  46. package/lib/vite/traceViewer/assets/codeMirrorModule-c1454a2e.js +0 -24
  47. package/lib/vite/traceViewer/assets/codeMirrorModule-c9bb9834.js +0 -24
  48. package/lib/vite/traceViewer/assets/codeMirrorModule-cc2329e4.js +0 -15593
  49. package/lib/vite/traceViewer/assets/codeMirrorModule-d2cc7db0.js +0 -15579
  50. package/lib/vite/traceViewer/assets/codeMirrorModule-da915a35.js +0 -15586
  51. package/lib/vite/traceViewer/assets/codeMirrorModule-f03b1a3e.js +0 -15579
  52. package/lib/vite/traceViewer/assets/codeMirrorModule-f333a775.js +0 -24
  53. package/lib/vite/traceViewer/assets/codeMirrorModule-lDjkI8Ax.js +0 -24
  54. package/lib/vite/traceViewer/assets/codeMirrorModule-uWDlVSQz.js +0 -15585
  55. package/lib/vite/traceViewer/assets/codeMirrorModule-yboVpgC0.js +0 -15592
  56. package/lib/vite/traceViewer/assets/inspectorTab-B4ynvyY9.js +0 -17361
  57. package/lib/vite/traceViewer/assets/inspectorTab-BB2Bm-wy.js +0 -17361
  58. package/lib/vite/traceViewer/assets/inspectorTab-CHcHvp_a.js +0 -17361
  59. package/lib/vite/traceViewer/assets/inspectorTab-C_OTuI8x.js +0 -17361
  60. package/lib/vite/traceViewer/assets/inspectorTab-DOc4D3cX.js +0 -17361
  61. package/lib/vite/traceViewer/assets/inspectorTab-Dw0Gnh1T.js +0 -17361
  62. package/lib/vite/traceViewer/assets/inspectorTab-Ywa000c9.js +0 -17361
  63. package/lib/vite/traceViewer/assets/testServerConnection-D-tXL3sj.js +0 -224
  64. package/lib/vite/traceViewer/assets/workbench-CROk6Fcc.js +0 -1473
  65. package/lib/vite/traceViewer/assets/workbench-CWtpwfKK.js +0 -1473
  66. package/lib/vite/traceViewer/assets/workbench-CfXOj3eT.js +0 -1473
  67. package/lib/vite/traceViewer/assets/workbench-D9CTkv-4.js +0 -1473
  68. package/lib/vite/traceViewer/assets/workbench-DNolpp3y.js +0 -1473
  69. package/lib/vite/traceViewer/assets/workbench-DjoIOtwK.js +0 -1473
  70. package/lib/vite/traceViewer/assets/workbench-M-Dh_RgU.js +0 -1473
  71. package/lib/vite/traceViewer/assets/workbench-dnZM5a7x.js +0 -1473
  72. package/lib/vite/traceViewer/assets/wsPort-54626118.js +0 -18361
  73. package/lib/vite/traceViewer/assets/wsPort-57f274c6.js +0 -18361
  74. package/lib/vite/traceViewer/assets/wsPort-762c6840.js +0 -64
  75. package/lib/vite/traceViewer/assets/wsPort-85286e61.js +0 -18361
  76. package/lib/vite/traceViewer/assets/wsPort-98e00a94.js +0 -64
  77. package/lib/vite/traceViewer/assets/wsPort-CAXygIGt.js +0 -18540
  78. package/lib/vite/traceViewer/assets/wsPort-cc0077b5.js +0 -18542
  79. package/lib/vite/traceViewer/assets/wsPort-edfeeb7d.js +0 -64
  80. package/lib/vite/traceViewer/assets/wsPort-ee2830d7.js +0 -64
  81. package/lib/vite/traceViewer/assets/wsPort-peeLnQhT.js +0 -18564
  82. package/lib/vite/traceViewer/assets/xtermModule-443332e6.js +0 -9
  83. package/lib/vite/traceViewer/assets/xtermModule-60687b6b.js +0 -6410
  84. package/lib/vite/traceViewer/assets/xtermModule-DZP0glxx.js +0 -5982
  85. package/lib/vite/traceViewer/assets/xtermModule-_6TC5FYT.js +0 -6529
  86. package/lib/vite/traceViewer/codeMirrorModule.5d0f417c.css +0 -1
  87. package/lib/vite/traceViewer/codeMirrorModule.Cy8X9Wtw.css +0 -344
  88. package/lib/vite/traceViewer/codeMirrorModule.eb494ea9.css +0 -344
  89. package/lib/vite/traceViewer/codeMirrorModule.svF_VrcJ.css +0 -344
  90. package/lib/vite/traceViewer/codicon.79f233d0.ttf +0 -0
  91. package/lib/vite/traceViewer/codicon.zGuYmc9o.ttf +0 -0
  92. package/lib/vite/traceViewer/embedded.6N1v7bZ1.js +0 -106
  93. package/lib/vite/traceViewer/embedded.BaqdbLsy.js +0 -106
  94. package/lib/vite/traceViewer/embedded.CHH7D63q.js +0 -106
  95. package/lib/vite/traceViewer/embedded.CwwTDBzP.js +0 -106
  96. package/lib/vite/traceViewer/embedded.DeCrOtlO.js +0 -106
  97. package/lib/vite/traceViewer/embedded.DjZq4InJ.css +0 -68
  98. package/lib/vite/traceViewer/embedded.DnD_eIZU.js +0 -106
  99. package/lib/vite/traceViewer/embedded.i_k4ceMJ.js +0 -106
  100. package/lib/vite/traceViewer/embedded.ymLJ2mBS.js +0 -106
  101. package/lib/vite/traceViewer/index.1a1fe659.css +0 -1
  102. package/lib/vite/traceViewer/index.1b525c1c.js +0 -181
  103. package/lib/vite/traceViewer/index.55e65778.js +0 -181
  104. package/lib/vite/traceViewer/index.5mge2rY_.css +0 -124
  105. package/lib/vite/traceViewer/index.5nqVcfiC.js +0 -180
  106. package/lib/vite/traceViewer/index.5ooko4n7.js +0 -180
  107. package/lib/vite/traceViewer/index.76e9f312.css +0 -124
  108. package/lib/vite/traceViewer/index.Bfh46hDK.js +0 -197
  109. package/lib/vite/traceViewer/index.Bugo2TbS.js +0 -197
  110. package/lib/vite/traceViewer/index.BzvnAP7t.js +0 -197
  111. package/lib/vite/traceViewer/index.C8ZWP1Qw.js +0 -197
  112. package/lib/vite/traceViewer/index.CM_h9lHr.js +0 -197
  113. package/lib/vite/traceViewer/index.CY13pBr8.js +0 -197
  114. package/lib/vite/traceViewer/index.DblJtEW_.js +0 -197
  115. package/lib/vite/traceViewer/index.QanXxRUb.css +0 -131
  116. package/lib/vite/traceViewer/index.UtHmfPiA.js +0 -197
  117. package/lib/vite/traceViewer/index.a265fbdb.js +0 -2
  118. package/lib/vite/traceViewer/index.c9f6fa8f.js +0 -2
  119. package/lib/vite/traceViewer/index.d86e70ca.js +0 -181
  120. package/lib/vite/traceViewer/index.decad628.js +0 -2
  121. package/lib/vite/traceViewer/index.e8730524.js +0 -181
  122. package/lib/vite/traceViewer/index.ed9a3c58.js +0 -2
  123. package/lib/vite/traceViewer/inspectorTab.DGJWXOSd.css +0 -3145
  124. package/lib/vite/traceViewer/recorder.3Xfrl_zV.js +0 -551
  125. package/lib/vite/traceViewer/recorder.BHq8OXiu.js +0 -551
  126. package/lib/vite/traceViewer/recorder.BWH6blRw.js +0 -551
  127. package/lib/vite/traceViewer/recorder.DBDpiNOK.css +0 -15
  128. package/lib/vite/traceViewer/recorder.Db1aK_DY.js +0 -551
  129. package/lib/vite/traceViewer/recorder.Fwf59ZKh.js +0 -551
  130. package/lib/vite/traceViewer/recorder.uj3cfoMf.js +0 -551
  131. package/lib/vite/traceViewer/recorder.zV_xPHM4.js +0 -551
  132. package/lib/vite/traceViewer/uiMode.08ab2d90.js +0 -4
  133. package/lib/vite/traceViewer/uiMode.0d0d667b.js +0 -4
  134. package/lib/vite/traceViewer/uiMode.216233d5.js +0 -1484
  135. package/lib/vite/traceViewer/uiMode.2c31018f.css +0 -1324
  136. package/lib/vite/traceViewer/uiMode.3ff70f7d.js +0 -4
  137. package/lib/vite/traceViewer/uiMode.4d0a45af.js +0 -1484
  138. package/lib/vite/traceViewer/uiMode.66eb0ce2.js +0 -1484
  139. package/lib/vite/traceViewer/uiMode.8b41a49d.css +0 -1
  140. package/lib/vite/traceViewer/uiMode.8d080c01.js +0 -1486
  141. package/lib/vite/traceViewer/uiMode.BH2Nj2h0.js +0 -1724
  142. package/lib/vite/traceViewer/uiMode.BKrDfnAk.js +0 -1725
  143. package/lib/vite/traceViewer/uiMode.BMYUvsRh.js +0 -1725
  144. package/lib/vite/traceViewer/uiMode.BVpTBGoe.js +0 -1724
  145. package/lib/vite/traceViewer/uiMode.BWhJCEE9.js +0 -1725
  146. package/lib/vite/traceViewer/uiMode.Bg9fACTB.js +0 -1725
  147. package/lib/vite/traceViewer/uiMode.CBRJkC_K.js +0 -1724
  148. package/lib/vite/traceViewer/uiMode.CYBsUhm_.js +0 -1724
  149. package/lib/vite/traceViewer/uiMode.DCSdxlAq.js +0 -1724
  150. package/lib/vite/traceViewer/uiMode.DRmgrHSk.css +0 -1462
  151. package/lib/vite/traceViewer/uiMode.DtleKuGI.js +0 -1724
  152. package/lib/vite/traceViewer/uiMode.UamAvOMX.js +0 -1725
  153. package/lib/vite/traceViewer/uiMode._Kp3dUXk.js +0 -1724
  154. package/lib/vite/traceViewer/uiMode.bBcXYWNF.js +0 -1725
  155. package/lib/vite/traceViewer/uiMode.ca6ec898.js +0 -4
  156. package/lib/vite/traceViewer/uiMode.e-PLonGl.js +0 -1490
  157. package/lib/vite/traceViewer/uiMode.e_-GuqEi.js +0 -1725
  158. package/lib/vite/traceViewer/uiMode.f1YADWIl.js +0 -1724
  159. package/lib/vite/traceViewer/uiMode.kHsXCfV8.js +0 -1490
  160. package/lib/vite/traceViewer/uiMode.xvJHbkzl.css +0 -1324
  161. package/lib/vite/traceViewer/workbench.9Es1K_T7.css +0 -549
  162. package/lib/vite/traceViewer/workbench.BQNDbcQ0.css +0 -550
  163. package/lib/vite/traceViewer/wsPort.162042f9.css +0 -3450
  164. package/lib/vite/traceViewer/wsPort.997c92cf.css +0 -3513
  165. package/lib/vite/traceViewer/wsPort.9c9a6767.css +0 -1
  166. package/lib/vite/traceViewer/wsPort.p5jUwABW.css +0 -3450
  167. package/lib/vite/traceViewer/xtermModule.125f4259.css +0 -191
  168. package/lib/vite/traceViewer/xtermModule.4oRVGWQ-.css +0 -209
  169. package/lib/vite/traceViewer/xtermModule.6428296b.css +0 -32
  170. package/lib/vite/traceViewer/xtermModule.OKEVRlkP.css +0 -209
@@ -1,4 +1,4 @@
1
- import{r as d,j as e,L as Mt,k as Vt,l as _t,n as kt,m as F,P as J,f as K,C as Gt,o as Yt,u as ht,p as St,G as qt,q as Kt,v as Jt,w as Qt,x as Zt,h as jt,y as te,z as ee,A as se,N as ie,S as wt,B as ne,D as Nt,T as bt,I as ae,E as re}from"./inspectorTab-BPzhNk9r.js";const ce=Mt;function le({name:t,rootItem:s,render:i,icon:n,isError:c,isVisible:l,selectedItem:a,onAccepted:r,onSelected:o,onHighlighted:x,treeState:h,setTreeState:v,noItemsMessage:m,dataTestId:b,autoExpandDepth:j}){const w=d.useMemo(()=>oe(s,a,h.expandedItems,j||0),[s,a,h,j]),M=d.useMemo(()=>{if(!l)return[...w.keys()];const f=new Map,N=T=>{const L=f.get(T);if(L!==void 0)return L;let R=T.children.some(z=>N(z));for(const z of T.children){const G=N(z);R=R||G}const X=l(T)||R;return f.set(T,X),X};for(const T of w.keys())N(T);const y=[];for(const T of w.keys())l(T)&&y.push(T);return y},[w,l]);return e.jsx(ce,{name:t,items:M,id:f=>f.id,dataTestId:b||t+"-tree",render:f=>{const N=i(f);return e.jsxs(e.Fragment,{children:[n&&e.jsx("div",{className:"codicon "+(n(f)||"blank"),style:{minWidth:16,marginRight:4}}),typeof N=="string"?e.jsx("div",{style:{textOverflow:"ellipsis",overflow:"hidden"},children:N}):N]})},icon:f=>{const N=w.get(f).expanded;if(typeof N=="boolean")return N?"codicon-chevron-down":"codicon-chevron-right"},isError:f=>(c==null?void 0:c(f))||!1,indent:f=>w.get(f).depth,selectedItem:a,onAccepted:f=>r==null?void 0:r(f),onSelected:f=>o==null?void 0:o(f),onHighlighted:f=>x==null?void 0:x(f),onLeftArrow:f=>{const{expanded:N,parent:y}=w.get(f);N?(h.expandedItems.set(f.id,!1),v({...h})):y&&(o==null||o(y))},onRightArrow:f=>{f.children.length&&(h.expandedItems.set(f.id,!0),v({...h}))},onIconClicked:f=>{const{expanded:N}=w.get(f);if(N){for(let y=a;y;y=y.parent)if(y===f){o==null||o(f);break}h.expandedItems.set(f.id,!1)}else h.expandedItems.set(f.id,!0);v({...h})},noItemsMessage:m})}function oe(t,s,i,n){const c=new Map,l=new Set;for(let r=s==null?void 0:s.parent;r;r=r.parent)l.add(r.id);const a=(r,o)=>{for(const x of r.children){const h=l.has(x.id)||i.get(x.id),v=n>o&&c.size<25&&h!==!1,m=x.children.length?h??v:void 0;c.set(x,{depth:o,expanded:m,parent:t===r?null:r}),m&&a(x,o+1)}};return a(t,0),c}const he=le,de=({actions:t,selectedAction:s,selectedTime:i,setSelectedTime:n,sdkLanguage:c,onSelected:l,onHighlighted:a,revealConsole:r,isLive:o})=>{const[x,h]=d.useState({expandedItems:new Map}),{rootItem:v,itemMap:m}=d.useMemo(()=>Vt(t),[t]),{selectedItem:b}=d.useMemo(()=>({selectedItem:s?m.get(s.callId):void 0}),[m,s]);return e.jsxs("div",{className:"vbox",children:[i&&e.jsxs("div",{className:"action-list-show-all",onClick:()=>n(void 0),children:[e.jsx("span",{className:"codicon codicon-triangle-left"}),"Show all"]}),e.jsx(he,{name:"actions",rootItem:v,treeState:x,setTreeState:h,selectedItem:b,onSelected:j=>l==null?void 0:l(j.action),onHighlighted:j=>a==null?void 0:a(j==null?void 0:j.action),onAccepted:j=>n({minimum:j.action.startTime,maximum:j.action.endTime}),isError:j=>{var w,M;return!!((M=(w=j.action)==null?void 0:w.error)!=null&&M.message)},isVisible:j=>!i||j.action.startTime<=i.maximum&&j.action.endTime>=i.minimum,render:j=>dt(j.action,{sdkLanguage:c,revealConsole:r,isLive:o,showDuration:!0,showBadges:!0})})]})},dt=(t,s)=>{const{sdkLanguage:i,revealConsole:n,isLive:c,showDuration:l,showBadges:a}=s,{errors:r,warnings:o}=_t(t),x=t.params.selector?kt(i||"javascript",t.params.selector):void 0;let h="";return t.endTime?h=F(t.endTime-t.startTime):t.error?h="Timed out":c||(h="-"),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"action-title",title:t.apiName,children:[e.jsx("span",{children:t.apiName}),x&&e.jsx("div",{className:"action-selector",title:x,children:x}),t.method==="goto"&&t.params.url&&e.jsx("div",{className:"action-url",title:t.params.url,children:t.params.url}),t.class==="APIRequestContext"&&t.params.url&&e.jsx("div",{className:"action-url",title:t.params.url,children:me(t.params.url)})]}),(l||a)&&e.jsx("div",{className:"spacer"}),l&&e.jsx("div",{className:"action-duration",children:h||e.jsx("span",{className:"codicon codicon-loading"})}),a&&e.jsxs("div",{className:"action-icons",onClick:()=>n==null?void 0:n(),children:[!!r&&e.jsxs("div",{className:"action-icon",children:[e.jsx("span",{className:"codicon codicon-error"}),e.jsx("span",{className:"action-icon-value",children:r})]}),!!o&&e.jsxs("div",{className:"action-icon",children:[e.jsx("span",{className:"codicon codicon-warning"}),e.jsx("span",{className:"action-icon-value",children:o})]})]})]})};function me(t){try{const s=new URL(t);return s.pathname+s.search}catch{return t}}const ue=({action:t,sdkLanguage:s})=>{if(!t)return e.jsx(J,{text:"No action selected"});const i={...t.params};delete i.info;const n=Object.keys(i),c=t.startTime+(t.context.wallTime-t.context.startTime),l=new Date(c).toLocaleString(),a=t.endTime?F(t.endTime-t.startTime):"Timed Out";return e.jsxs("div",{className:"call-tab",children:[e.jsx("div",{className:"call-line",children:t.apiName}),e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"call-section",children:"Time"}),l&&e.jsxs("div",{className:"call-line",children:["wall time:",e.jsx("span",{className:"call-value datetime",title:l,children:l})]}),e.jsxs("div",{className:"call-line",children:["duration:",e.jsx("span",{className:"call-value datetime",title:a,children:a})]})]}),!!n.length&&e.jsx("div",{className:"call-section",children:"Parameters"}),!!n.length&&n.map((r,o)=>yt(Tt(t,r,i[r],s),"param-"+o)),!!t.result&&e.jsx("div",{className:"call-section",children:"Return value"}),!!t.result&&Object.keys(t.result).map((r,o)=>yt(Tt(t,r,t.result[r],s),"result-"+o))]})};function yt(t,s){let i=t.text.replace(/\n/g,"↵");return t.type==="string"&&(i=`"${i}"`),e.jsxs("div",{className:"call-line",children:[t.name,":",e.jsx("span",{className:K("call-value",t.type),title:t.text,children:i}),["string","number","object","locator"].includes(t.type)&&e.jsx(Gt,{value:t.text})]},s)}function Tt(t,s,i,n){const c=t.method.includes("eval")||t.method==="waitForFunction";if(s==="files")return{text:"<files>",type:"string",name:s};if((s==="eventInit"||s==="expectedValue"||s==="arg"&&c)&&(i=tt(i.value,new Array(10).fill({handle:"<handle>"}))),(s==="value"&&c||s==="received"&&t.method==="expect")&&(i=tt(i,new Array(10).fill({handle:"<handle>"}))),s==="selector")return{text:kt(n||"javascript",t.params.selector),type:"locator",name:"locator"};const l=typeof i;return l!=="object"||i===null?{text:String(i),type:l,name:s}:i.guid?{text:"<handle>",type:"handle",name:s}:{text:JSON.stringify(i).slice(0,1e3),type:"object",name:s}}function tt(t,s){if(t.n!==void 0)return t.n;if(t.s!==void 0)return t.s;if(t.b!==void 0)return t.b;if(t.v!==void 0){if(t.v==="undefined")return;if(t.v==="null")return null;if(t.v==="NaN")return NaN;if(t.v==="Infinity")return 1/0;if(t.v==="-Infinity")return-1/0;if(t.v==="-0")return-0}if(t.d!==void 0)return new Date(t.d);if(t.r!==void 0)return new RegExp(t.r.p,t.r.f);if(t.a!==void 0)return t.a.map(i=>tt(i,s));if(t.o!==void 0){const i={};for(const{k:n,v:c}of t.o)i[n]=tt(c,s);return i}return t.h!==void 0?s===void 0?"<object>":s[t.h]:"<object>"}const xe=Mt,fe=({action:t,isLive:s})=>{const i=d.useMemo(()=>{var a;if(!t||!t.log.length)return[];const n=t.log,c=t.context.wallTime-t.context.startTime,l=[];for(let r=0;r<n.length;++r){let o="";if(n[r].time!==-1){const x=(a=n[r])==null?void 0:a.time;r+1<n.length?o=F(n[r+1].time-x):t.endTime>0?o=F(t.endTime-x):s?o=F(Date.now()-c-x):o="-"}l.push({message:n[r].message,time:o})}return l},[t,s]);return i.length?e.jsx(xe,{name:"log",items:i,render:n=>e.jsxs("div",{className:"log-list-item",children:[e.jsx("span",{className:"log-list-duration",children:n.time}),n.message]}),notSelectable:!0}):e.jsx(J,{text:"No log entries"})},pe=({error:t})=>{const s=d.useMemo(()=>Yt(t),[t]);return e.jsx("div",{className:"error-message",dangerouslySetInnerHTML:{__html:s||""}})};function ge(t){return d.useMemo(()=>{if(!t)return{errors:new Map};const s=new Map;for(const i of t.errorDescriptors)s.set(i.message,i);return{errors:s}},[t])}const ve=({errorsModel:t,sdkLanguage:s,revealInSource:i})=>t.errors.size?e.jsx("div",{className:"fill",style:{overflow:"auto"},children:[...t.errors.entries()].map(([n,c])=>{var o;let l,a;const r=(o=c.stack)==null?void 0:o[0];return r&&(l=r.file.replace(/.*[/\\](.*)/,"$1")+":"+r.line,a=r.file+":"+r.line),e.jsxs("div",{children:[e.jsxs("div",{className:"hbox",style:{alignItems:"center",padding:"5px 10px",minHeight:36,fontWeight:"bold",color:"var(--vscode-errorForeground)"},children:[c.action&&dt(c.action,{sdkLanguage:s}),l&&e.jsxs("div",{className:"action-location",children:["@ ",e.jsx("span",{title:a,onClick:()=>i(c),children:l})]})]}),e.jsx(pe,{error:n})]},n)})}):e.jsx(J,{text:"No errors"}),Ct={width:200,height:45},_=2.5,je=Ct.height+_*2,we=({model:t,boundaries:s,previewPoint:i})=>{var h,v;const[n,c]=ht(),l=d.useRef(null);let a=0;if(l.current&&i){const m=l.current.getBoundingClientRect();a=(i.clientY-m.top+l.current.scrollTop)/je|0}const r=(v=(h=t==null?void 0:t.pages)==null?void 0:h[a])==null?void 0:v.screencastFrames;let o,x;if(i!==void 0&&r&&r.length){const m=s.minimum+(s.maximum-s.minimum)*i.x/n.width;o=r[St(r,m,Lt)-1];const b={width:Math.min(800,window.innerWidth/2|0),height:Math.min(800,window.innerHeight/2|0)};x=o?It({width:o.width,height:o.height},b):void 0}return e.jsxs("div",{className:"film-strip",ref:c,children:[e.jsx("div",{className:"film-strip-lanes",ref:l,children:t==null?void 0:t.pages.map((m,b)=>m.screencastFrames.length?e.jsx(Ne,{boundaries:s,page:m,width:n.width},b):null)}),(i==null?void 0:i.x)!==void 0&&e.jsxs("div",{className:"film-strip-hover",style:{top:n.bottom+5,left:Math.min(i.x,n.width-(x?x.width:0)-10)},children:[i.action&&e.jsx("div",{className:"film-strip-hover-title",children:dt(i.action,i)}),o&&x&&e.jsx("div",{style:{width:x.width,height:x.height},children:e.jsx("img",{src:`sha1/${o.sha1}`,width:x.width,height:x.height})})]})]})},Ne=({boundaries:t,page:s,width:i})=>{const n={width:0,height:0},c=s.screencastFrames;for(const w of c)n.width=Math.max(n.width,w.width),n.height=Math.max(n.height,w.height);const l=It(n,Ct),a=c[0].timestamp,r=c[c.length-1].timestamp,o=t.maximum-t.minimum,x=(a-t.minimum)/o*i,h=(t.maximum-r)/o*i,m=(r-a)/o*i/(l.width+2*_)|0,b=(r-a)/m,j=[];for(let w=0;a&&b&&w<m;++w){const M=a+b*w,f=St(c,M,Lt)-1;j.push(e.jsx("div",{className:"film-strip-frame",style:{width:l.width,height:l.height,backgroundImage:`url(sha1/${c[f].sha1})`,backgroundSize:`${l.width}px ${l.height}px`,margin:_,marginRight:_}},w))}return j.push(e.jsx("div",{className:"film-strip-frame",style:{width:l.width,height:l.height,backgroundImage:`url(sha1/${c[c.length-1].sha1})`,backgroundSize:`${l.width}px ${l.height}px`,margin:_,marginRight:_}},j.length)),e.jsx("div",{className:"film-strip-lane",style:{marginLeft:x+"px",marginRight:h+"px"},children:j})};function Lt(t,s){return t-s.timestamp}function It(t,s){const i=Math.max(t.width/s.width,t.height/s.height);return{width:t.width/i|0,height:t.height/i|0}}const be=({model:t,boundaries:s,consoleEntries:i,onSelected:n,highlightedAction:c,highlightedEntry:l,highlightedConsoleEntry:a,selectedTime:r,setSelectedTime:o,sdkLanguage:x})=>{const[h,v]=ht(),[m,b]=d.useState(),[j,w]=d.useState(),{offsets:M,curtainLeft:f,curtainRight:N}=d.useMemo(()=>{let p=r||s;if(m&&m.startX!==m.endX){const k=H(h.width,s,m.startX),I=H(h.width,s,m.endX);p={minimum:Math.min(k,I),maximum:Math.max(k,I)}}const u=W(h.width,s,p.minimum),C=W(h.width,s,s.maximum)-W(h.width,s,p.maximum);return{offsets:ye(h.width,s),curtainLeft:u,curtainRight:C}},[r,s,m,h]),y=d.useMemo(()=>{const p=[];for(const u of(t==null?void 0:t.actions)||[])u.class!=="Test"&&p.push({action:u,leftTime:u.startTime,rightTime:u.endTime||s.maximum,leftPosition:W(h.width,s,u.startTime),rightPosition:W(h.width,s,u.endTime||s.maximum),active:!1,error:!!u.error});for(const u of(t==null?void 0:t.resources)||[]){const S=u._monotonicTime,C=u._monotonicTime+u.time;p.push({resource:u,leftTime:S,rightTime:C,leftPosition:W(h.width,s,S),rightPosition:W(h.width,s,C),active:!1,error:!1})}for(const u of i||[])p.push({consoleMessage:u,leftTime:u.timestamp,rightTime:u.timestamp,leftPosition:W(h.width,s,u.timestamp),rightPosition:W(h.width,s,u.timestamp),active:!1,error:u.isError});return p},[t,i,s,h]);d.useMemo(()=>{for(const p of y)c?p.active=p.action===c:l?p.active=p.resource===l:a?p.active=p.consoleMessage===a:p.active=!1},[y,c,l,a]);const T=d.useCallback(p=>{if(w(void 0),!v.current)return;const u=p.clientX-v.current.getBoundingClientRect().left,S=H(h.width,s,u),C=r?W(h.width,s,r.minimum):0,k=r?W(h.width,s,r.maximum):0;r&&Math.abs(u-C)<10?b({startX:k,endX:u,type:"resize"}):r&&Math.abs(u-k)<10?b({startX:C,endX:u,type:"resize"}):r&&S>r.minimum&&S<r.maximum&&p.clientY-v.current.getBoundingClientRect().top<20?b({startX:C,endX:k,pivot:u,type:"move"}):b({startX:u,endX:u,type:"resize"})},[s,h,v,r]),L=d.useCallback(p=>{if(!v.current)return;const u=p.clientX-v.current.getBoundingClientRect().left,S=H(h.width,s,u),C=t==null?void 0:t.actions.findLast(A=>A.startTime<=S);if(!p.buttons){b(void 0);return}if(C&&n(C),!m)return;let k=m;if(m.type==="resize")k={...m,endX:u};else{const A=u-m.pivot;let U=m.startX+A,$=m.endX+A;U<0&&(U=0,$=U+(m.endX-m.startX)),$>h.width&&($=h.width,U=$-(m.endX-m.startX)),k={...m,startX:U,endX:$,pivot:u}}b(k);const I=H(h.width,s,k.startX),P=H(h.width,s,k.endX);I!==P&&o({minimum:Math.min(I,P),maximum:Math.max(I,P)})},[s,m,h,t,n,v,o]),R=d.useCallback(()=>{if(w(void 0),!!m){if(m.startX!==m.endX){const p=H(h.width,s,m.startX),u=H(h.width,s,m.endX);o({minimum:Math.min(p,u),maximum:Math.max(p,u)})}else{const p=H(h.width,s,m.startX),u=t==null?void 0:t.actions.findLast(S=>S.startTime<=p);u&&n(u),o(void 0)}b(void 0)}},[s,m,h,t,o,n]),X=d.useCallback(p=>{if(!v.current)return;const u=p.clientX-v.current.getBoundingClientRect().left,S=H(h.width,s,u),C=t==null?void 0:t.actions.findLast(k=>k.startTime<=S);w({x:u,clientY:p.clientY,action:C,sdkLanguage:x})},[s,h,t,v,x]),z=d.useCallback(()=>{w(void 0)},[]),G=d.useCallback(()=>{o(void 0)},[o]);return e.jsxs("div",{style:{flex:"none",borderBottom:"1px solid var(--vscode-panel-border)"},children:[!!m&&e.jsx(qt,{cursor:(m==null?void 0:m.type)==="resize"?"ew-resize":"grab",onPaneMouseUp:R,onPaneMouseMove:L,onPaneDoubleClick:G}),e.jsxs("div",{ref:v,className:"timeline-view",onMouseDown:T,onMouseMove:X,onMouseLeave:z,children:[e.jsx("div",{className:"timeline-grid",children:M.map((p,u)=>e.jsx("div",{className:"timeline-divider",style:{left:p.position+"px"},children:e.jsx("div",{className:"timeline-time",children:F(p.time-s.minimum)})},u))}),e.jsx("div",{style:{height:8}}),e.jsx(we,{model:t,boundaries:s,previewPoint:j}),e.jsx("div",{className:"timeline-bars",children:y.map((p,u)=>e.jsx("div",{className:K("timeline-bar",p.action&&"action",p.resource&&"network",p.consoleMessage&&"console-message",p.active&&"active",p.error&&"error"),style:{left:p.leftPosition,width:Math.max(5,p.rightPosition-p.leftPosition),top:Te(p),bottom:0}},u))}),e.jsx("div",{className:"timeline-marker",style:{display:j!==void 0?"block":"none",left:((j==null?void 0:j.x)||0)+"px"}}),r&&e.jsxs("div",{className:"timeline-window",children:[e.jsx("div",{className:"timeline-window-curtain left",style:{width:f}}),e.jsx("div",{className:"timeline-window-resizer",style:{left:-5}}),e.jsx("div",{className:"timeline-window-center",children:e.jsx("div",{className:"timeline-window-drag"})}),e.jsx("div",{className:"timeline-window-resizer",style:{left:5}}),e.jsx("div",{className:"timeline-window-curtain right",style:{width:N}})]})]})]})};function ye(t,s){let n=t/64;const c=s.maximum-s.minimum,l=t/c;let a=c/n;const r=Math.ceil(Math.log(a)/Math.LN10);a=Math.pow(10,r),a*l>=5*64&&(a=a/5),a*l>=2*64&&(a=a/2);const o=s.minimum;let x=s.maximum;x+=64/l,n=Math.ceil((x-o)/a),a||(n=0);const h=[];for(let v=0;v<n;++v){const m=o+a*v;h.push({position:W(t,s,m),time:m})}return h}function W(t,s,i){return(i-s.minimum)/(s.maximum-s.minimum)*t}function H(t,s,i){return i/t*(s.maximum-s.minimum)+s.minimum}function Te(t){return t.resource?25:20}const Me=({model:t})=>{var s,i;return t?e.jsxs("div",{"data-testid":"metadata-view",className:"vbox",style:{flexShrink:0},children:[e.jsx("div",{className:"call-section",style:{paddingTop:2},children:"Time"}),!!t.wallTime&&e.jsxs("div",{className:"call-line",children:["start time:",e.jsx("span",{className:"call-value datetime",title:new Date(t.wallTime).toLocaleString(),children:new Date(t.wallTime).toLocaleString()})]}),e.jsxs("div",{className:"call-line",children:["duration:",e.jsx("span",{className:"call-value number",title:F(t.endTime-t.startTime),children:F(t.endTime-t.startTime)})]}),e.jsx("div",{className:"call-section",children:"Browser"}),e.jsxs("div",{className:"call-line",children:["engine:",e.jsx("span",{className:"call-value string",title:t.browserName,children:t.browserName})]}),t.channel&&e.jsxs("div",{className:"call-line",children:["channel:",e.jsx("span",{className:"call-value string",title:t.channel,children:t.channel})]}),t.platform&&e.jsxs("div",{className:"call-line",children:["platform:",e.jsx("span",{className:"call-value string",title:t.platform,children:t.platform})]}),t.options.userAgent&&e.jsxs("div",{className:"call-line",children:["user agent:",e.jsx("span",{className:"call-value datetime",title:t.options.userAgent,children:t.options.userAgent})]}),t.options.baseURL&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"call-section",style:{paddingTop:2},children:"Config"}),e.jsxs("div",{className:"call-line",children:["baseURL:",e.jsx("a",{className:"call-value string",href:t.options.baseURL,title:t.options.baseURL,target:"_blank",rel:"noopener noreferrer",children:t.options.baseURL})]})]}),e.jsx("div",{className:"call-section",children:"Viewport"}),t.options.viewport&&e.jsxs("div",{className:"call-line",children:["width:",e.jsx("span",{className:"call-value number",title:String(!!((s=t.options.viewport)!=null&&s.width)),children:t.options.viewport.width})]}),t.options.viewport&&e.jsxs("div",{className:"call-line",children:["height:",e.jsx("span",{className:"call-value number",title:String(!!((i=t.options.viewport)!=null&&i.height)),children:t.options.viewport.height})]}),e.jsxs("div",{className:"call-line",children:["is mobile:",e.jsx("span",{className:"call-value boolean",title:String(!!t.options.isMobile),children:String(!!t.options.isMobile)})]}),t.options.deviceScaleFactor&&e.jsxs("div",{className:"call-line",children:["device scale:",e.jsx("span",{className:"call-value number",title:String(t.options.deviceScaleFactor),children:String(t.options.deviceScaleFactor)})]}),e.jsx("div",{className:"call-section",children:"Counts"}),e.jsxs("div",{className:"call-line",children:["pages:",e.jsx("span",{className:"call-value number",children:t.pages.length})]}),e.jsxs("div",{className:"call-line",children:["actions:",e.jsx("span",{className:"call-value number",children:t.actions.length})]}),e.jsxs("div",{className:"call-line",children:["events:",e.jsx("span",{className:"call-value number",children:t.events.length})]})]}):e.jsx(e.Fragment,{})};async function lt(t){const s=new Image;return t&&(s.src=t,await new Promise((i,n)=>{s.onload=i,s.onerror=i})),s}const ot={backgroundImage:`linear-gradient(45deg, #80808020 25%, transparent 25%),
1
+ import{r as d,j as e,L as Mt,k as Vt,l as _t,n as kt,m as F,P as J,f as K,C as Gt,o as Yt,u as ht,p as St,G as qt,q as Kt,v as Jt,w as Qt,x as Zt,h as jt,y as te,z as ee,A as se,N as ie,S as wt,B as ne,D as Nt,T as bt,I as ae,E as re}from"./inspectorTab-BuJ3wAX_.js";const ce=Mt;function le({name:t,rootItem:s,render:i,icon:n,isError:c,isVisible:l,selectedItem:a,onAccepted:r,onSelected:o,onHighlighted:x,treeState:h,setTreeState:v,noItemsMessage:m,dataTestId:b,autoExpandDepth:j}){const w=d.useMemo(()=>oe(s,a,h.expandedItems,j||0),[s,a,h,j]),M=d.useMemo(()=>{if(!l)return[...w.keys()];const f=new Map,N=T=>{const L=f.get(T);if(L!==void 0)return L;let R=T.children.some(z=>N(z));for(const z of T.children){const G=N(z);R=R||G}const X=l(T)||R;return f.set(T,X),X};for(const T of w.keys())N(T);const y=[];for(const T of w.keys())l(T)&&y.push(T);return y},[w,l]);return e.jsx(ce,{name:t,items:M,id:f=>f.id,dataTestId:b||t+"-tree",render:f=>{const N=i(f);return e.jsxs(e.Fragment,{children:[n&&e.jsx("div",{className:"codicon "+(n(f)||"blank"),style:{minWidth:16,marginRight:4}}),typeof N=="string"?e.jsx("div",{style:{textOverflow:"ellipsis",overflow:"hidden"},children:N}):N]})},icon:f=>{const N=w.get(f).expanded;if(typeof N=="boolean")return N?"codicon-chevron-down":"codicon-chevron-right"},isError:f=>(c==null?void 0:c(f))||!1,indent:f=>w.get(f).depth,selectedItem:a,onAccepted:f=>r==null?void 0:r(f),onSelected:f=>o==null?void 0:o(f),onHighlighted:f=>x==null?void 0:x(f),onLeftArrow:f=>{const{expanded:N,parent:y}=w.get(f);N?(h.expandedItems.set(f.id,!1),v({...h})):y&&(o==null||o(y))},onRightArrow:f=>{f.children.length&&(h.expandedItems.set(f.id,!0),v({...h}))},onIconClicked:f=>{const{expanded:N}=w.get(f);if(N){for(let y=a;y;y=y.parent)if(y===f){o==null||o(f);break}h.expandedItems.set(f.id,!1)}else h.expandedItems.set(f.id,!0);v({...h})},noItemsMessage:m})}function oe(t,s,i,n){const c=new Map,l=new Set;for(let r=s==null?void 0:s.parent;r;r=r.parent)l.add(r.id);const a=(r,o)=>{for(const x of r.children){const h=l.has(x.id)||i.get(x.id),v=n>o&&c.size<25&&h!==!1,m=x.children.length?h??v:void 0;c.set(x,{depth:o,expanded:m,parent:t===r?null:r}),m&&a(x,o+1)}};return a(t,0),c}const he=le,de=({actions:t,selectedAction:s,selectedTime:i,setSelectedTime:n,sdkLanguage:c,onSelected:l,onHighlighted:a,revealConsole:r,isLive:o})=>{const[x,h]=d.useState({expandedItems:new Map}),{rootItem:v,itemMap:m}=d.useMemo(()=>Vt(t),[t]),{selectedItem:b}=d.useMemo(()=>({selectedItem:s?m.get(s.callId):void 0}),[m,s]);return e.jsxs("div",{className:"vbox",children:[i&&e.jsxs("div",{className:"action-list-show-all",onClick:()=>n(void 0),children:[e.jsx("span",{className:"codicon codicon-triangle-left"}),"Show all"]}),e.jsx(he,{name:"actions",rootItem:v,treeState:x,setTreeState:h,selectedItem:b,onSelected:j=>l==null?void 0:l(j.action),onHighlighted:j=>a==null?void 0:a(j==null?void 0:j.action),onAccepted:j=>n({minimum:j.action.startTime,maximum:j.action.endTime}),isError:j=>{var w,M;return!!((M=(w=j.action)==null?void 0:w.error)!=null&&M.message)},isVisible:j=>!i||j.action.startTime<=i.maximum&&j.action.endTime>=i.minimum,render:j=>dt(j.action,{sdkLanguage:c,revealConsole:r,isLive:o,showDuration:!0,showBadges:!0})})]})},dt=(t,s)=>{const{sdkLanguage:i,revealConsole:n,isLive:c,showDuration:l,showBadges:a}=s,{errors:r,warnings:o}=_t(t),x=t.params.selector?kt(i||"javascript",t.params.selector):void 0;let h="";return t.endTime?h=F(t.endTime-t.startTime):t.error?h="Timed out":c||(h="-"),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"action-title",title:t.apiName,children:[e.jsx("span",{children:t.apiName}),x&&e.jsx("div",{className:"action-selector",title:x,children:x}),t.method==="goto"&&t.params.url&&e.jsx("div",{className:"action-url",title:t.params.url,children:t.params.url}),t.class==="APIRequestContext"&&t.params.url&&e.jsx("div",{className:"action-url",title:t.params.url,children:me(t.params.url)})]}),(l||a)&&e.jsx("div",{className:"spacer"}),l&&e.jsx("div",{className:"action-duration",children:h||e.jsx("span",{className:"codicon codicon-loading"})}),a&&e.jsxs("div",{className:"action-icons",onClick:()=>n==null?void 0:n(),children:[!!r&&e.jsxs("div",{className:"action-icon",children:[e.jsx("span",{className:"codicon codicon-error"}),e.jsx("span",{className:"action-icon-value",children:r})]}),!!o&&e.jsxs("div",{className:"action-icon",children:[e.jsx("span",{className:"codicon codicon-warning"}),e.jsx("span",{className:"action-icon-value",children:o})]})]})]})};function me(t){try{const s=new URL(t);return s.pathname+s.search}catch{return t}}const ue=({action:t,sdkLanguage:s})=>{if(!t)return e.jsx(J,{text:"No action selected"});const i={...t.params};delete i.info;const n=Object.keys(i),c=t.startTime+(t.context.wallTime-t.context.startTime),l=new Date(c).toLocaleString(),a=t.endTime?F(t.endTime-t.startTime):"Timed Out";return e.jsxs("div",{className:"call-tab",children:[e.jsx("div",{className:"call-line",children:t.apiName}),e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"call-section",children:"Time"}),l&&e.jsxs("div",{className:"call-line",children:["wall time:",e.jsx("span",{className:"call-value datetime",title:l,children:l})]}),e.jsxs("div",{className:"call-line",children:["duration:",e.jsx("span",{className:"call-value datetime",title:a,children:a})]})]}),!!n.length&&e.jsx("div",{className:"call-section",children:"Parameters"}),!!n.length&&n.map((r,o)=>yt(Tt(t,r,i[r],s),"param-"+o)),!!t.result&&e.jsx("div",{className:"call-section",children:"Return value"}),!!t.result&&Object.keys(t.result).map((r,o)=>yt(Tt(t,r,t.result[r],s),"result-"+o))]})};function yt(t,s){let i=t.text.replace(/\n/g,"↵");return t.type==="string"&&(i=`"${i}"`),e.jsxs("div",{className:"call-line",children:[t.name,":",e.jsx("span",{className:K("call-value",t.type),title:t.text,children:i}),["string","number","object","locator"].includes(t.type)&&e.jsx(Gt,{value:t.text})]},s)}function Tt(t,s,i,n){const c=t.method.includes("eval")||t.method==="waitForFunction";if(s==="files")return{text:"<files>",type:"string",name:s};if((s==="eventInit"||s==="expectedValue"||s==="arg"&&c)&&(i=tt(i.value,new Array(10).fill({handle:"<handle>"}))),(s==="value"&&c||s==="received"&&t.method==="expect")&&(i=tt(i,new Array(10).fill({handle:"<handle>"}))),s==="selector")return{text:kt(n||"javascript",t.params.selector),type:"locator",name:"locator"};const l=typeof i;return l!=="object"||i===null?{text:String(i),type:l,name:s}:i.guid?{text:"<handle>",type:"handle",name:s}:{text:JSON.stringify(i).slice(0,1e3),type:"object",name:s}}function tt(t,s){if(t.n!==void 0)return t.n;if(t.s!==void 0)return t.s;if(t.b!==void 0)return t.b;if(t.v!==void 0){if(t.v==="undefined")return;if(t.v==="null")return null;if(t.v==="NaN")return NaN;if(t.v==="Infinity")return 1/0;if(t.v==="-Infinity")return-1/0;if(t.v==="-0")return-0}if(t.d!==void 0)return new Date(t.d);if(t.r!==void 0)return new RegExp(t.r.p,t.r.f);if(t.a!==void 0)return t.a.map(i=>tt(i,s));if(t.o!==void 0){const i={};for(const{k:n,v:c}of t.o)i[n]=tt(c,s);return i}return t.h!==void 0?s===void 0?"<object>":s[t.h]:"<object>"}const xe=Mt,fe=({action:t,isLive:s})=>{const i=d.useMemo(()=>{var a;if(!t||!t.log.length)return[];const n=t.log,c=t.context.wallTime-t.context.startTime,l=[];for(let r=0;r<n.length;++r){let o="";if(n[r].time!==-1){const x=(a=n[r])==null?void 0:a.time;r+1<n.length?o=F(n[r+1].time-x):t.endTime>0?o=F(t.endTime-x):s?o=F(Date.now()-c-x):o="-"}l.push({message:n[r].message,time:o})}return l},[t,s]);return i.length?e.jsx(xe,{name:"log",items:i,render:n=>e.jsxs("div",{className:"log-list-item",children:[e.jsx("span",{className:"log-list-duration",children:n.time}),n.message]}),notSelectable:!0}):e.jsx(J,{text:"No log entries"})},pe=({error:t})=>{const s=d.useMemo(()=>Yt(t),[t]);return e.jsx("div",{className:"error-message",dangerouslySetInnerHTML:{__html:s||""}})};function ge(t){return d.useMemo(()=>{if(!t)return{errors:new Map};const s=new Map;for(const i of t.errorDescriptors)s.set(i.message,i);return{errors:s}},[t])}const ve=({errorsModel:t,sdkLanguage:s,revealInSource:i})=>t.errors.size?e.jsx("div",{className:"fill",style:{overflow:"auto"},children:[...t.errors.entries()].map(([n,c])=>{var o;let l,a;const r=(o=c.stack)==null?void 0:o[0];return r&&(l=r.file.replace(/.*[/\\](.*)/,"$1")+":"+r.line,a=r.file+":"+r.line),e.jsxs("div",{children:[e.jsxs("div",{className:"hbox",style:{alignItems:"center",padding:"5px 10px",minHeight:36,fontWeight:"bold",color:"var(--vscode-errorForeground)"},children:[c.action&&dt(c.action,{sdkLanguage:s}),l&&e.jsxs("div",{className:"action-location",children:["@ ",e.jsx("span",{title:a,onClick:()=>i(c),children:l})]})]}),e.jsx(pe,{error:n})]},n)})}):e.jsx(J,{text:"No errors"}),Ct={width:200,height:45},_=2.5,je=Ct.height+_*2,we=({model:t,boundaries:s,previewPoint:i})=>{var h,v;const[n,c]=ht(),l=d.useRef(null);let a=0;if(l.current&&i){const m=l.current.getBoundingClientRect();a=(i.clientY-m.top+l.current.scrollTop)/je|0}const r=(v=(h=t==null?void 0:t.pages)==null?void 0:h[a])==null?void 0:v.screencastFrames;let o,x;if(i!==void 0&&r&&r.length){const m=s.minimum+(s.maximum-s.minimum)*i.x/n.width;o=r[St(r,m,Lt)-1];const b={width:Math.min(800,window.innerWidth/2|0),height:Math.min(800,window.innerHeight/2|0)};x=o?It({width:o.width,height:o.height},b):void 0}return e.jsxs("div",{className:"film-strip",ref:c,children:[e.jsx("div",{className:"film-strip-lanes",ref:l,children:t==null?void 0:t.pages.map((m,b)=>m.screencastFrames.length?e.jsx(Ne,{boundaries:s,page:m,width:n.width},b):null)}),(i==null?void 0:i.x)!==void 0&&e.jsxs("div",{className:"film-strip-hover",style:{top:n.bottom+5,left:Math.min(i.x,n.width-(x?x.width:0)-10)},children:[i.action&&e.jsx("div",{className:"film-strip-hover-title",children:dt(i.action,i)}),o&&x&&e.jsx("div",{style:{width:x.width,height:x.height},children:e.jsx("img",{src:`sha1/${o.sha1}`,width:x.width,height:x.height})})]})]})},Ne=({boundaries:t,page:s,width:i})=>{const n={width:0,height:0},c=s.screencastFrames;for(const w of c)n.width=Math.max(n.width,w.width),n.height=Math.max(n.height,w.height);const l=It(n,Ct),a=c[0].timestamp,r=c[c.length-1].timestamp,o=t.maximum-t.minimum,x=(a-t.minimum)/o*i,h=(t.maximum-r)/o*i,m=(r-a)/o*i/(l.width+2*_)|0,b=(r-a)/m,j=[];for(let w=0;a&&b&&w<m;++w){const M=a+b*w,f=St(c,M,Lt)-1;j.push(e.jsx("div",{className:"film-strip-frame",style:{width:l.width,height:l.height,backgroundImage:`url(sha1/${c[f].sha1})`,backgroundSize:`${l.width}px ${l.height}px`,margin:_,marginRight:_}},w))}return j.push(e.jsx("div",{className:"film-strip-frame",style:{width:l.width,height:l.height,backgroundImage:`url(sha1/${c[c.length-1].sha1})`,backgroundSize:`${l.width}px ${l.height}px`,margin:_,marginRight:_}},j.length)),e.jsx("div",{className:"film-strip-lane",style:{marginLeft:x+"px",marginRight:h+"px"},children:j})};function Lt(t,s){return t-s.timestamp}function It(t,s){const i=Math.max(t.width/s.width,t.height/s.height);return{width:t.width/i|0,height:t.height/i|0}}const be=({model:t,boundaries:s,consoleEntries:i,onSelected:n,highlightedAction:c,highlightedEntry:l,highlightedConsoleEntry:a,selectedTime:r,setSelectedTime:o,sdkLanguage:x})=>{const[h,v]=ht(),[m,b]=d.useState(),[j,w]=d.useState(),{offsets:M,curtainLeft:f,curtainRight:N}=d.useMemo(()=>{let p=r||s;if(m&&m.startX!==m.endX){const k=H(h.width,s,m.startX),I=H(h.width,s,m.endX);p={minimum:Math.min(k,I),maximum:Math.max(k,I)}}const u=W(h.width,s,p.minimum),C=W(h.width,s,s.maximum)-W(h.width,s,p.maximum);return{offsets:ye(h.width,s),curtainLeft:u,curtainRight:C}},[r,s,m,h]),y=d.useMemo(()=>{const p=[];for(const u of(t==null?void 0:t.actions)||[])u.class!=="Test"&&p.push({action:u,leftTime:u.startTime,rightTime:u.endTime||s.maximum,leftPosition:W(h.width,s,u.startTime),rightPosition:W(h.width,s,u.endTime||s.maximum),active:!1,error:!!u.error});for(const u of(t==null?void 0:t.resources)||[]){const S=u._monotonicTime,C=u._monotonicTime+u.time;p.push({resource:u,leftTime:S,rightTime:C,leftPosition:W(h.width,s,S),rightPosition:W(h.width,s,C),active:!1,error:!1})}for(const u of i||[])p.push({consoleMessage:u,leftTime:u.timestamp,rightTime:u.timestamp,leftPosition:W(h.width,s,u.timestamp),rightPosition:W(h.width,s,u.timestamp),active:!1,error:u.isError});return p},[t,i,s,h]);d.useMemo(()=>{for(const p of y)c?p.active=p.action===c:l?p.active=p.resource===l:a?p.active=p.consoleMessage===a:p.active=!1},[y,c,l,a]);const T=d.useCallback(p=>{if(w(void 0),!v.current)return;const u=p.clientX-v.current.getBoundingClientRect().left,S=H(h.width,s,u),C=r?W(h.width,s,r.minimum):0,k=r?W(h.width,s,r.maximum):0;r&&Math.abs(u-C)<10?b({startX:k,endX:u,type:"resize"}):r&&Math.abs(u-k)<10?b({startX:C,endX:u,type:"resize"}):r&&S>r.minimum&&S<r.maximum&&p.clientY-v.current.getBoundingClientRect().top<20?b({startX:C,endX:k,pivot:u,type:"move"}):b({startX:u,endX:u,type:"resize"})},[s,h,v,r]),L=d.useCallback(p=>{if(!v.current)return;const u=p.clientX-v.current.getBoundingClientRect().left,S=H(h.width,s,u),C=t==null?void 0:t.actions.findLast(A=>A.startTime<=S);if(!p.buttons){b(void 0);return}if(C&&n(C),!m)return;let k=m;if(m.type==="resize")k={...m,endX:u};else{const A=u-m.pivot;let U=m.startX+A,$=m.endX+A;U<0&&(U=0,$=U+(m.endX-m.startX)),$>h.width&&($=h.width,U=$-(m.endX-m.startX)),k={...m,startX:U,endX:$,pivot:u}}b(k);const I=H(h.width,s,k.startX),P=H(h.width,s,k.endX);I!==P&&o({minimum:Math.min(I,P),maximum:Math.max(I,P)})},[s,m,h,t,n,v,o]),R=d.useCallback(()=>{if(w(void 0),!!m){if(m.startX!==m.endX){const p=H(h.width,s,m.startX),u=H(h.width,s,m.endX);o({minimum:Math.min(p,u),maximum:Math.max(p,u)})}else{const p=H(h.width,s,m.startX),u=t==null?void 0:t.actions.findLast(S=>S.startTime<=p);u&&n(u),o(void 0)}b(void 0)}},[s,m,h,t,o,n]),X=d.useCallback(p=>{if(!v.current)return;const u=p.clientX-v.current.getBoundingClientRect().left,S=H(h.width,s,u),C=t==null?void 0:t.actions.findLast(k=>k.startTime<=S);w({x:u,clientY:p.clientY,action:C,sdkLanguage:x})},[s,h,t,v,x]),z=d.useCallback(()=>{w(void 0)},[]),G=d.useCallback(()=>{o(void 0)},[o]);return e.jsxs("div",{style:{flex:"none",borderBottom:"1px solid var(--vscode-panel-border)"},children:[!!m&&e.jsx(qt,{cursor:(m==null?void 0:m.type)==="resize"?"ew-resize":"grab",onPaneMouseUp:R,onPaneMouseMove:L,onPaneDoubleClick:G}),e.jsxs("div",{ref:v,className:"timeline-view",onMouseDown:T,onMouseMove:X,onMouseLeave:z,children:[e.jsx("div",{className:"timeline-grid",children:M.map((p,u)=>e.jsx("div",{className:"timeline-divider",style:{left:p.position+"px"},children:e.jsx("div",{className:"timeline-time",children:F(p.time-s.minimum)})},u))}),e.jsx("div",{style:{height:8}}),e.jsx(we,{model:t,boundaries:s,previewPoint:j}),e.jsx("div",{className:"timeline-bars",children:y.map((p,u)=>e.jsx("div",{className:K("timeline-bar",p.action&&"action",p.resource&&"network",p.consoleMessage&&"console-message",p.active&&"active",p.error&&"error"),style:{left:p.leftPosition,width:Math.max(5,p.rightPosition-p.leftPosition),top:Te(p),bottom:0}},u))}),e.jsx("div",{className:"timeline-marker",style:{display:j!==void 0?"block":"none",left:((j==null?void 0:j.x)||0)+"px"}}),r&&e.jsxs("div",{className:"timeline-window",children:[e.jsx("div",{className:"timeline-window-curtain left",style:{width:f}}),e.jsx("div",{className:"timeline-window-resizer",style:{left:-5}}),e.jsx("div",{className:"timeline-window-center",children:e.jsx("div",{className:"timeline-window-drag"})}),e.jsx("div",{className:"timeline-window-resizer",style:{left:5}}),e.jsx("div",{className:"timeline-window-curtain right",style:{width:N}})]})]})]})};function ye(t,s){let n=t/64;const c=s.maximum-s.minimum,l=t/c;let a=c/n;const r=Math.ceil(Math.log(a)/Math.LN10);a=Math.pow(10,r),a*l>=5*64&&(a=a/5),a*l>=2*64&&(a=a/2);const o=s.minimum;let x=s.maximum;x+=64/l,n=Math.ceil((x-o)/a),a||(n=0);const h=[];for(let v=0;v<n;++v){const m=o+a*v;h.push({position:W(t,s,m),time:m})}return h}function W(t,s,i){return(i-s.minimum)/(s.maximum-s.minimum)*t}function H(t,s,i){return i/t*(s.maximum-s.minimum)+s.minimum}function Te(t){return t.resource?25:20}const Me=({model:t})=>{var s,i;return t?e.jsxs("div",{"data-testid":"metadata-view",className:"vbox",style:{flexShrink:0},children:[e.jsx("div",{className:"call-section",style:{paddingTop:2},children:"Time"}),!!t.wallTime&&e.jsxs("div",{className:"call-line",children:["start time:",e.jsx("span",{className:"call-value datetime",title:new Date(t.wallTime).toLocaleString(),children:new Date(t.wallTime).toLocaleString()})]}),e.jsxs("div",{className:"call-line",children:["duration:",e.jsx("span",{className:"call-value number",title:F(t.endTime-t.startTime),children:F(t.endTime-t.startTime)})]}),e.jsx("div",{className:"call-section",children:"Browser"}),e.jsxs("div",{className:"call-line",children:["engine:",e.jsx("span",{className:"call-value string",title:t.browserName,children:t.browserName})]}),t.channel&&e.jsxs("div",{className:"call-line",children:["channel:",e.jsx("span",{className:"call-value string",title:t.channel,children:t.channel})]}),t.platform&&e.jsxs("div",{className:"call-line",children:["platform:",e.jsx("span",{className:"call-value string",title:t.platform,children:t.platform})]}),t.options.userAgent&&e.jsxs("div",{className:"call-line",children:["user agent:",e.jsx("span",{className:"call-value datetime",title:t.options.userAgent,children:t.options.userAgent})]}),t.options.baseURL&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"call-section",style:{paddingTop:2},children:"Config"}),e.jsxs("div",{className:"call-line",children:["baseURL:",e.jsx("a",{className:"call-value string",href:t.options.baseURL,title:t.options.baseURL,target:"_blank",rel:"noopener noreferrer",children:t.options.baseURL})]})]}),e.jsx("div",{className:"call-section",children:"Viewport"}),t.options.viewport&&e.jsxs("div",{className:"call-line",children:["width:",e.jsx("span",{className:"call-value number",title:String(!!((s=t.options.viewport)!=null&&s.width)),children:t.options.viewport.width})]}),t.options.viewport&&e.jsxs("div",{className:"call-line",children:["height:",e.jsx("span",{className:"call-value number",title:String(!!((i=t.options.viewport)!=null&&i.height)),children:t.options.viewport.height})]}),e.jsxs("div",{className:"call-line",children:["is mobile:",e.jsx("span",{className:"call-value boolean",title:String(!!t.options.isMobile),children:String(!!t.options.isMobile)})]}),t.options.deviceScaleFactor&&e.jsxs("div",{className:"call-line",children:["device scale:",e.jsx("span",{className:"call-value number",title:String(t.options.deviceScaleFactor),children:String(t.options.deviceScaleFactor)})]}),e.jsx("div",{className:"call-section",children:"Counts"}),e.jsxs("div",{className:"call-line",children:["pages:",e.jsx("span",{className:"call-value number",children:t.pages.length})]}),e.jsxs("div",{className:"call-line",children:["actions:",e.jsx("span",{className:"call-value number",children:t.actions.length})]}),e.jsxs("div",{className:"call-line",children:["events:",e.jsx("span",{className:"call-value number",children:t.events.length})]})]}):e.jsx(e.Fragment,{})};async function lt(t){const s=new Image;return t&&(s.src=t,await new Promise((i,n)=>{s.onload=i,s.onerror=i})),s}const ot={backgroundImage:`linear-gradient(45deg, #80808020 25%, transparent 25%),
2
2
  linear-gradient(-45deg, #80808020 25%, transparent 25%),
3
3
  linear-gradient(45deg, transparent 75%, #80808020 75%),
4
4
  linear-gradient(-45deg, transparent 75%, #80808020 75%)`,backgroundSize:"20px 20px",backgroundPosition:"0 0, 0 10px, 10px -10px, -10px 0px",boxShadow:`rgb(0 0 0 / 10%) 0px 1.8px 1.9px,
@@ -0,0 +1,9 @@
1
+ import{r as d,j as e,L as Mt,k as Vt,l as _t,n as kt,m as F,P as J,f as K,C as Gt,o as Yt,u as ht,p as St,G as qt,q as Kt,v as Jt,w as Qt,x as Zt,h as jt,y as te,z as ee,A as se,N as ie,S as wt,B as ne,D as Nt,T as bt,I as ae,E as re}from"./inspectorTab-Soeeuvzv.js";const ce=Mt;function le({name:t,rootItem:s,render:i,icon:n,isError:c,isVisible:l,selectedItem:a,onAccepted:r,onSelected:o,onHighlighted:x,treeState:h,setTreeState:v,noItemsMessage:m,dataTestId:b,autoExpandDepth:j}){const w=d.useMemo(()=>oe(s,a,h.expandedItems,j||0),[s,a,h,j]),M=d.useMemo(()=>{if(!l)return[...w.keys()];const f=new Map,N=T=>{const L=f.get(T);if(L!==void 0)return L;let R=T.children.some(z=>N(z));for(const z of T.children){const G=N(z);R=R||G}const X=l(T)||R;return f.set(T,X),X};for(const T of w.keys())N(T);const y=[];for(const T of w.keys())l(T)&&y.push(T);return y},[w,l]);return e.jsx(ce,{name:t,items:M,id:f=>f.id,dataTestId:b||t+"-tree",render:f=>{const N=i(f);return e.jsxs(e.Fragment,{children:[n&&e.jsx("div",{className:"codicon "+(n(f)||"blank"),style:{minWidth:16,marginRight:4}}),typeof N=="string"?e.jsx("div",{style:{textOverflow:"ellipsis",overflow:"hidden"},children:N}):N]})},icon:f=>{const N=w.get(f).expanded;if(typeof N=="boolean")return N?"codicon-chevron-down":"codicon-chevron-right"},isError:f=>(c==null?void 0:c(f))||!1,indent:f=>w.get(f).depth,selectedItem:a,onAccepted:f=>r==null?void 0:r(f),onSelected:f=>o==null?void 0:o(f),onHighlighted:f=>x==null?void 0:x(f),onLeftArrow:f=>{const{expanded:N,parent:y}=w.get(f);N?(h.expandedItems.set(f.id,!1),v({...h})):y&&(o==null||o(y))},onRightArrow:f=>{f.children.length&&(h.expandedItems.set(f.id,!0),v({...h}))},onIconClicked:f=>{const{expanded:N}=w.get(f);if(N){for(let y=a;y;y=y.parent)if(y===f){o==null||o(f);break}h.expandedItems.set(f.id,!1)}else h.expandedItems.set(f.id,!0);v({...h})},noItemsMessage:m})}function oe(t,s,i,n){const c=new Map,l=new Set;for(let r=s==null?void 0:s.parent;r;r=r.parent)l.add(r.id);const a=(r,o)=>{for(const x of r.children){const h=l.has(x.id)||i.get(x.id),v=n>o&&c.size<25&&h!==!1,m=x.children.length?h??v:void 0;c.set(x,{depth:o,expanded:m,parent:t===r?null:r}),m&&a(x,o+1)}};return a(t,0),c}const he=le,de=({actions:t,selectedAction:s,selectedTime:i,setSelectedTime:n,sdkLanguage:c,onSelected:l,onHighlighted:a,revealConsole:r,isLive:o})=>{const[x,h]=d.useState({expandedItems:new Map}),{rootItem:v,itemMap:m}=d.useMemo(()=>Vt(t),[t]),{selectedItem:b}=d.useMemo(()=>({selectedItem:s?m.get(s.callId):void 0}),[m,s]);return e.jsxs("div",{className:"vbox",children:[i&&e.jsxs("div",{className:"action-list-show-all",onClick:()=>n(void 0),children:[e.jsx("span",{className:"codicon codicon-triangle-left"}),"Show all"]}),e.jsx(he,{name:"actions",rootItem:v,treeState:x,setTreeState:h,selectedItem:b,onSelected:j=>l==null?void 0:l(j.action),onHighlighted:j=>a==null?void 0:a(j==null?void 0:j.action),onAccepted:j=>n({minimum:j.action.startTime,maximum:j.action.endTime}),isError:j=>{var w,M;return!!((M=(w=j.action)==null?void 0:w.error)!=null&&M.message)},isVisible:j=>!i||j.action.startTime<=i.maximum&&j.action.endTime>=i.minimum,render:j=>dt(j.action,{sdkLanguage:c,revealConsole:r,isLive:o,showDuration:!0,showBadges:!0})})]})},dt=(t,s)=>{const{sdkLanguage:i,revealConsole:n,isLive:c,showDuration:l,showBadges:a}=s,{errors:r,warnings:o}=_t(t),x=t.params.selector?kt(i||"javascript",t.params.selector):void 0;let h="";return t.endTime?h=F(t.endTime-t.startTime):t.error?h="Timed out":c||(h="-"),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"action-title",title:t.apiName,children:[e.jsx("span",{children:t.apiName}),x&&e.jsx("div",{className:"action-selector",title:x,children:x}),t.method==="goto"&&t.params.url&&e.jsx("div",{className:"action-url",title:t.params.url,children:t.params.url}),t.class==="APIRequestContext"&&t.params.url&&e.jsx("div",{className:"action-url",title:t.params.url,children:me(t.params.url)})]}),(l||a)&&e.jsx("div",{className:"spacer"}),l&&e.jsx("div",{className:"action-duration",children:h||e.jsx("span",{className:"codicon codicon-loading"})}),a&&e.jsxs("div",{className:"action-icons",onClick:()=>n==null?void 0:n(),children:[!!r&&e.jsxs("div",{className:"action-icon",children:[e.jsx("span",{className:"codicon codicon-error"}),e.jsx("span",{className:"action-icon-value",children:r})]}),!!o&&e.jsxs("div",{className:"action-icon",children:[e.jsx("span",{className:"codicon codicon-warning"}),e.jsx("span",{className:"action-icon-value",children:o})]})]})]})};function me(t){try{const s=new URL(t);return s.pathname+s.search}catch{return t}}const ue=({action:t,sdkLanguage:s})=>{if(!t)return e.jsx(J,{text:"No action selected"});const i={...t.params};delete i.info;const n=Object.keys(i),c=t.startTime+(t.context.wallTime-t.context.startTime),l=new Date(c).toLocaleString(),a=t.endTime?F(t.endTime-t.startTime):"Timed Out";return e.jsxs("div",{className:"call-tab",children:[e.jsx("div",{className:"call-line",children:t.apiName}),e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"call-section",children:"Time"}),l&&e.jsxs("div",{className:"call-line",children:["wall time:",e.jsx("span",{className:"call-value datetime",title:l,children:l})]}),e.jsxs("div",{className:"call-line",children:["duration:",e.jsx("span",{className:"call-value datetime",title:a,children:a})]})]}),!!n.length&&e.jsx("div",{className:"call-section",children:"Parameters"}),!!n.length&&n.map((r,o)=>yt(Tt(t,r,i[r],s),"param-"+o)),!!t.result&&e.jsx("div",{className:"call-section",children:"Return value"}),!!t.result&&Object.keys(t.result).map((r,o)=>yt(Tt(t,r,t.result[r],s),"result-"+o))]})};function yt(t,s){let i=t.text.replace(/\n/g,"↵");return t.type==="string"&&(i=`"${i}"`),e.jsxs("div",{className:"call-line",children:[t.name,":",e.jsx("span",{className:K("call-value",t.type),title:t.text,children:i}),["string","number","object","locator"].includes(t.type)&&e.jsx(Gt,{value:t.text})]},s)}function Tt(t,s,i,n){const c=t.method.includes("eval")||t.method==="waitForFunction";if(s==="files")return{text:"<files>",type:"string",name:s};if((s==="eventInit"||s==="expectedValue"||s==="arg"&&c)&&(i=tt(i.value,new Array(10).fill({handle:"<handle>"}))),(s==="value"&&c||s==="received"&&t.method==="expect")&&(i=tt(i,new Array(10).fill({handle:"<handle>"}))),s==="selector")return{text:kt(n||"javascript",t.params.selector),type:"locator",name:"locator"};const l=typeof i;return l!=="object"||i===null?{text:String(i),type:l,name:s}:i.guid?{text:"<handle>",type:"handle",name:s}:{text:JSON.stringify(i).slice(0,1e3),type:"object",name:s}}function tt(t,s){if(t.n!==void 0)return t.n;if(t.s!==void 0)return t.s;if(t.b!==void 0)return t.b;if(t.v!==void 0){if(t.v==="undefined")return;if(t.v==="null")return null;if(t.v==="NaN")return NaN;if(t.v==="Infinity")return 1/0;if(t.v==="-Infinity")return-1/0;if(t.v==="-0")return-0}if(t.d!==void 0)return new Date(t.d);if(t.r!==void 0)return new RegExp(t.r.p,t.r.f);if(t.a!==void 0)return t.a.map(i=>tt(i,s));if(t.o!==void 0){const i={};for(const{k:n,v:c}of t.o)i[n]=tt(c,s);return i}return t.h!==void 0?s===void 0?"<object>":s[t.h]:"<object>"}const xe=Mt,fe=({action:t,isLive:s})=>{const i=d.useMemo(()=>{var a;if(!t||!t.log.length)return[];const n=t.log,c=t.context.wallTime-t.context.startTime,l=[];for(let r=0;r<n.length;++r){let o="";if(n[r].time!==-1){const x=(a=n[r])==null?void 0:a.time;r+1<n.length?o=F(n[r+1].time-x):t.endTime>0?o=F(t.endTime-x):s?o=F(Date.now()-c-x):o="-"}l.push({message:n[r].message,time:o})}return l},[t,s]);return i.length?e.jsx(xe,{name:"log",items:i,render:n=>e.jsxs("div",{className:"log-list-item",children:[e.jsx("span",{className:"log-list-duration",children:n.time}),n.message]}),notSelectable:!0}):e.jsx(J,{text:"No log entries"})},pe=({error:t})=>{const s=d.useMemo(()=>Yt(t),[t]);return e.jsx("div",{className:"error-message",dangerouslySetInnerHTML:{__html:s||""}})};function ge(t){return d.useMemo(()=>{if(!t)return{errors:new Map};const s=new Map;for(const i of t.errorDescriptors)s.set(i.message,i);return{errors:s}},[t])}const ve=({errorsModel:t,sdkLanguage:s,revealInSource:i})=>t.errors.size?e.jsx("div",{className:"fill",style:{overflow:"auto"},children:[...t.errors.entries()].map(([n,c])=>{var o;let l,a;const r=(o=c.stack)==null?void 0:o[0];return r&&(l=r.file.replace(/.*[/\\](.*)/,"$1")+":"+r.line,a=r.file+":"+r.line),e.jsxs("div",{children:[e.jsxs("div",{className:"hbox",style:{alignItems:"center",padding:"5px 10px",minHeight:36,fontWeight:"bold",color:"var(--vscode-errorForeground)"},children:[c.action&&dt(c.action,{sdkLanguage:s}),l&&e.jsxs("div",{className:"action-location",children:["@ ",e.jsx("span",{title:a,onClick:()=>i(c),children:l})]})]}),e.jsx(pe,{error:n})]},n)})}):e.jsx(J,{text:"No errors"}),Ct={width:200,height:45},_=2.5,je=Ct.height+_*2,we=({model:t,boundaries:s,previewPoint:i})=>{var h,v;const[n,c]=ht(),l=d.useRef(null);let a=0;if(l.current&&i){const m=l.current.getBoundingClientRect();a=(i.clientY-m.top+l.current.scrollTop)/je|0}const r=(v=(h=t==null?void 0:t.pages)==null?void 0:h[a])==null?void 0:v.screencastFrames;let o,x;if(i!==void 0&&r&&r.length){const m=s.minimum+(s.maximum-s.minimum)*i.x/n.width;o=r[St(r,m,Lt)-1];const b={width:Math.min(800,window.innerWidth/2|0),height:Math.min(800,window.innerHeight/2|0)};x=o?It({width:o.width,height:o.height},b):void 0}return e.jsxs("div",{className:"film-strip",ref:c,children:[e.jsx("div",{className:"film-strip-lanes",ref:l,children:t==null?void 0:t.pages.map((m,b)=>m.screencastFrames.length?e.jsx(Ne,{boundaries:s,page:m,width:n.width},b):null)}),(i==null?void 0:i.x)!==void 0&&e.jsxs("div",{className:"film-strip-hover",style:{top:n.bottom+5,left:Math.min(i.x,n.width-(x?x.width:0)-10)},children:[i.action&&e.jsx("div",{className:"film-strip-hover-title",children:dt(i.action,i)}),o&&x&&e.jsx("div",{style:{width:x.width,height:x.height},children:e.jsx("img",{src:`sha1/${o.sha1}`,width:x.width,height:x.height})})]})]})},Ne=({boundaries:t,page:s,width:i})=>{const n={width:0,height:0},c=s.screencastFrames;for(const w of c)n.width=Math.max(n.width,w.width),n.height=Math.max(n.height,w.height);const l=It(n,Ct),a=c[0].timestamp,r=c[c.length-1].timestamp,o=t.maximum-t.minimum,x=(a-t.minimum)/o*i,h=(t.maximum-r)/o*i,m=(r-a)/o*i/(l.width+2*_)|0,b=(r-a)/m,j=[];for(let w=0;a&&b&&w<m;++w){const M=a+b*w,f=St(c,M,Lt)-1;j.push(e.jsx("div",{className:"film-strip-frame",style:{width:l.width,height:l.height,backgroundImage:`url(sha1/${c[f].sha1})`,backgroundSize:`${l.width}px ${l.height}px`,margin:_,marginRight:_}},w))}return j.push(e.jsx("div",{className:"film-strip-frame",style:{width:l.width,height:l.height,backgroundImage:`url(sha1/${c[c.length-1].sha1})`,backgroundSize:`${l.width}px ${l.height}px`,margin:_,marginRight:_}},j.length)),e.jsx("div",{className:"film-strip-lane",style:{marginLeft:x+"px",marginRight:h+"px"},children:j})};function Lt(t,s){return t-s.timestamp}function It(t,s){const i=Math.max(t.width/s.width,t.height/s.height);return{width:t.width/i|0,height:t.height/i|0}}const be=({model:t,boundaries:s,consoleEntries:i,onSelected:n,highlightedAction:c,highlightedEntry:l,highlightedConsoleEntry:a,selectedTime:r,setSelectedTime:o,sdkLanguage:x})=>{const[h,v]=ht(),[m,b]=d.useState(),[j,w]=d.useState(),{offsets:M,curtainLeft:f,curtainRight:N}=d.useMemo(()=>{let p=r||s;if(m&&m.startX!==m.endX){const k=H(h.width,s,m.startX),I=H(h.width,s,m.endX);p={minimum:Math.min(k,I),maximum:Math.max(k,I)}}const u=W(h.width,s,p.minimum),C=W(h.width,s,s.maximum)-W(h.width,s,p.maximum);return{offsets:ye(h.width,s),curtainLeft:u,curtainRight:C}},[r,s,m,h]),y=d.useMemo(()=>{const p=[];for(const u of(t==null?void 0:t.actions)||[])u.class!=="Test"&&p.push({action:u,leftTime:u.startTime,rightTime:u.endTime||s.maximum,leftPosition:W(h.width,s,u.startTime),rightPosition:W(h.width,s,u.endTime||s.maximum),active:!1,error:!!u.error});for(const u of(t==null?void 0:t.resources)||[]){const S=u._monotonicTime,C=u._monotonicTime+u.time;p.push({resource:u,leftTime:S,rightTime:C,leftPosition:W(h.width,s,S),rightPosition:W(h.width,s,C),active:!1,error:!1})}for(const u of i||[])p.push({consoleMessage:u,leftTime:u.timestamp,rightTime:u.timestamp,leftPosition:W(h.width,s,u.timestamp),rightPosition:W(h.width,s,u.timestamp),active:!1,error:u.isError});return p},[t,i,s,h]);d.useMemo(()=>{for(const p of y)c?p.active=p.action===c:l?p.active=p.resource===l:a?p.active=p.consoleMessage===a:p.active=!1},[y,c,l,a]);const T=d.useCallback(p=>{if(w(void 0),!v.current)return;const u=p.clientX-v.current.getBoundingClientRect().left,S=H(h.width,s,u),C=r?W(h.width,s,r.minimum):0,k=r?W(h.width,s,r.maximum):0;r&&Math.abs(u-C)<10?b({startX:k,endX:u,type:"resize"}):r&&Math.abs(u-k)<10?b({startX:C,endX:u,type:"resize"}):r&&S>r.minimum&&S<r.maximum&&p.clientY-v.current.getBoundingClientRect().top<20?b({startX:C,endX:k,pivot:u,type:"move"}):b({startX:u,endX:u,type:"resize"})},[s,h,v,r]),L=d.useCallback(p=>{if(!v.current)return;const u=p.clientX-v.current.getBoundingClientRect().left,S=H(h.width,s,u),C=t==null?void 0:t.actions.findLast(A=>A.startTime<=S);if(!p.buttons){b(void 0);return}if(C&&n(C),!m)return;let k=m;if(m.type==="resize")k={...m,endX:u};else{const A=u-m.pivot;let U=m.startX+A,$=m.endX+A;U<0&&(U=0,$=U+(m.endX-m.startX)),$>h.width&&($=h.width,U=$-(m.endX-m.startX)),k={...m,startX:U,endX:$,pivot:u}}b(k);const I=H(h.width,s,k.startX),P=H(h.width,s,k.endX);I!==P&&o({minimum:Math.min(I,P),maximum:Math.max(I,P)})},[s,m,h,t,n,v,o]),R=d.useCallback(()=>{if(w(void 0),!!m){if(m.startX!==m.endX){const p=H(h.width,s,m.startX),u=H(h.width,s,m.endX);o({minimum:Math.min(p,u),maximum:Math.max(p,u)})}else{const p=H(h.width,s,m.startX),u=t==null?void 0:t.actions.findLast(S=>S.startTime<=p);u&&n(u),o(void 0)}b(void 0)}},[s,m,h,t,o,n]),X=d.useCallback(p=>{if(!v.current)return;const u=p.clientX-v.current.getBoundingClientRect().left,S=H(h.width,s,u),C=t==null?void 0:t.actions.findLast(k=>k.startTime<=S);w({x:u,clientY:p.clientY,action:C,sdkLanguage:x})},[s,h,t,v,x]),z=d.useCallback(()=>{w(void 0)},[]),G=d.useCallback(()=>{o(void 0)},[o]);return e.jsxs("div",{style:{flex:"none",borderBottom:"1px solid var(--vscode-panel-border)"},children:[!!m&&e.jsx(qt,{cursor:(m==null?void 0:m.type)==="resize"?"ew-resize":"grab",onPaneMouseUp:R,onPaneMouseMove:L,onPaneDoubleClick:G}),e.jsxs("div",{ref:v,className:"timeline-view",onMouseDown:T,onMouseMove:X,onMouseLeave:z,children:[e.jsx("div",{className:"timeline-grid",children:M.map((p,u)=>e.jsx("div",{className:"timeline-divider",style:{left:p.position+"px"},children:e.jsx("div",{className:"timeline-time",children:F(p.time-s.minimum)})},u))}),e.jsx("div",{style:{height:8}}),e.jsx(we,{model:t,boundaries:s,previewPoint:j}),e.jsx("div",{className:"timeline-bars",children:y.map((p,u)=>e.jsx("div",{className:K("timeline-bar",p.action&&"action",p.resource&&"network",p.consoleMessage&&"console-message",p.active&&"active",p.error&&"error"),style:{left:p.leftPosition,width:Math.max(5,p.rightPosition-p.leftPosition),top:Te(p),bottom:0}},u))}),e.jsx("div",{className:"timeline-marker",style:{display:j!==void 0?"block":"none",left:((j==null?void 0:j.x)||0)+"px"}}),r&&e.jsxs("div",{className:"timeline-window",children:[e.jsx("div",{className:"timeline-window-curtain left",style:{width:f}}),e.jsx("div",{className:"timeline-window-resizer",style:{left:-5}}),e.jsx("div",{className:"timeline-window-center",children:e.jsx("div",{className:"timeline-window-drag"})}),e.jsx("div",{className:"timeline-window-resizer",style:{left:5}}),e.jsx("div",{className:"timeline-window-curtain right",style:{width:N}})]})]})]})};function ye(t,s){let n=t/64;const c=s.maximum-s.minimum,l=t/c;let a=c/n;const r=Math.ceil(Math.log(a)/Math.LN10);a=Math.pow(10,r),a*l>=5*64&&(a=a/5),a*l>=2*64&&(a=a/2);const o=s.minimum;let x=s.maximum;x+=64/l,n=Math.ceil((x-o)/a),a||(n=0);const h=[];for(let v=0;v<n;++v){const m=o+a*v;h.push({position:W(t,s,m),time:m})}return h}function W(t,s,i){return(i-s.minimum)/(s.maximum-s.minimum)*t}function H(t,s,i){return i/t*(s.maximum-s.minimum)+s.minimum}function Te(t){return t.resource?25:20}const Me=({model:t})=>{var s,i;return t?e.jsxs("div",{"data-testid":"metadata-view",className:"vbox",style:{flexShrink:0},children:[e.jsx("div",{className:"call-section",style:{paddingTop:2},children:"Time"}),!!t.wallTime&&e.jsxs("div",{className:"call-line",children:["start time:",e.jsx("span",{className:"call-value datetime",title:new Date(t.wallTime).toLocaleString(),children:new Date(t.wallTime).toLocaleString()})]}),e.jsxs("div",{className:"call-line",children:["duration:",e.jsx("span",{className:"call-value number",title:F(t.endTime-t.startTime),children:F(t.endTime-t.startTime)})]}),e.jsx("div",{className:"call-section",children:"Browser"}),e.jsxs("div",{className:"call-line",children:["engine:",e.jsx("span",{className:"call-value string",title:t.browserName,children:t.browserName})]}),t.channel&&e.jsxs("div",{className:"call-line",children:["channel:",e.jsx("span",{className:"call-value string",title:t.channel,children:t.channel})]}),t.platform&&e.jsxs("div",{className:"call-line",children:["platform:",e.jsx("span",{className:"call-value string",title:t.platform,children:t.platform})]}),t.options.userAgent&&e.jsxs("div",{className:"call-line",children:["user agent:",e.jsx("span",{className:"call-value datetime",title:t.options.userAgent,children:t.options.userAgent})]}),t.options.baseURL&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"call-section",style:{paddingTop:2},children:"Config"}),e.jsxs("div",{className:"call-line",children:["baseURL:",e.jsx("a",{className:"call-value string",href:t.options.baseURL,title:t.options.baseURL,target:"_blank",rel:"noopener noreferrer",children:t.options.baseURL})]})]}),e.jsx("div",{className:"call-section",children:"Viewport"}),t.options.viewport&&e.jsxs("div",{className:"call-line",children:["width:",e.jsx("span",{className:"call-value number",title:String(!!((s=t.options.viewport)!=null&&s.width)),children:t.options.viewport.width})]}),t.options.viewport&&e.jsxs("div",{className:"call-line",children:["height:",e.jsx("span",{className:"call-value number",title:String(!!((i=t.options.viewport)!=null&&i.height)),children:t.options.viewport.height})]}),e.jsxs("div",{className:"call-line",children:["is mobile:",e.jsx("span",{className:"call-value boolean",title:String(!!t.options.isMobile),children:String(!!t.options.isMobile)})]}),t.options.deviceScaleFactor&&e.jsxs("div",{className:"call-line",children:["device scale:",e.jsx("span",{className:"call-value number",title:String(t.options.deviceScaleFactor),children:String(t.options.deviceScaleFactor)})]}),e.jsx("div",{className:"call-section",children:"Counts"}),e.jsxs("div",{className:"call-line",children:["pages:",e.jsx("span",{className:"call-value number",children:t.pages.length})]}),e.jsxs("div",{className:"call-line",children:["actions:",e.jsx("span",{className:"call-value number",children:t.actions.length})]}),e.jsxs("div",{className:"call-line",children:["events:",e.jsx("span",{className:"call-value number",children:t.events.length})]})]}):e.jsx(e.Fragment,{})};async function lt(t){const s=new Image;return t&&(s.src=t,await new Promise((i,n)=>{s.onload=i,s.onerror=i})),s}const ot={backgroundImage:`linear-gradient(45deg, #80808020 25%, transparent 25%),
2
+ linear-gradient(-45deg, #80808020 25%, transparent 25%),
3
+ linear-gradient(45deg, transparent 75%, #80808020 75%),
4
+ linear-gradient(-45deg, transparent 75%, #80808020 75%)`,backgroundSize:"20px 20px",backgroundPosition:"0 0, 0 10px, 10px -10px, -10px 0px",boxShadow:`rgb(0 0 0 / 10%) 0px 1.8px 1.9px,
5
+ rgb(0 0 0 / 15%) 0px 6.1px 6.3px,
6
+ rgb(0 0 0 / 10%) 0px -2px 4px,
7
+ rgb(0 0 0 / 15%) 0px -6.1px 12px,
8
+ rgb(0 0 0 / 25%) 0px 6px 12px`},ke=({diff:t,noTargetBlank:s})=>{const[i,n]=d.useState(t.diff?"diff":"actual"),[c,l]=d.useState(!1),[a,r]=d.useState(null),[o,x]=d.useState(null),[h,v]=d.useState(null),[m,b]=ht();d.useEffect(()=>{(async()=>{var R,X,z;r(await lt((R=t.expected)==null?void 0:R.attachment.path)),x(await lt((X=t.actual)==null?void 0:X.attachment.path)),v(await lt((z=t.diff)==null?void 0:z.attachment.path))})()},[t]);const j=a&&o&&h,w=j?Math.max(a.naturalWidth,o.naturalWidth,200):500,M=j?Math.max(a.naturalHeight,o.naturalHeight,200):500,f=Math.min(1,(m.width-30)/w),N=Math.min(1,(m.width-50)/w/2),y=w*f,T=M*f,L={flex:"none",margin:"0 10px",cursor:"pointer",userSelect:"none"};return e.jsx("div",{"data-testid":"test-result-image-mismatch",style:{display:"flex",flexDirection:"column",alignItems:"center",flex:"auto"},ref:b,children:j&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-testid":"test-result-image-mismatch-tabs",style:{display:"flex",margin:"10px 0 20px"},children:[t.diff&&e.jsx("div",{style:{...L,fontWeight:i==="diff"?600:"initial"},onClick:()=>n("diff"),children:"Diff"}),e.jsx("div",{style:{...L,fontWeight:i==="actual"?600:"initial"},onClick:()=>n("actual"),children:"Actual"}),e.jsx("div",{style:{...L,fontWeight:i==="expected"?600:"initial"},onClick:()=>n("expected"),children:"Expected"}),e.jsx("div",{style:{...L,fontWeight:i==="sxs"?600:"initial"},onClick:()=>n("sxs"),children:"Side by side"}),e.jsx("div",{style:{...L,fontWeight:i==="slider"?600:"initial"},onClick:()=>n("slider"),children:"Slider"})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"center",flex:"auto",minHeight:T+60},children:[t.diff&&i==="diff"&&e.jsx(E,{image:h,alt:"Diff",canvasWidth:y,canvasHeight:T,scale:f}),t.diff&&i==="actual"&&e.jsx(E,{image:o,alt:"Actual",canvasWidth:y,canvasHeight:T,scale:f}),t.diff&&i==="expected"&&e.jsx(E,{image:a,alt:"Expected",canvasWidth:y,canvasHeight:T,scale:f}),t.diff&&i==="slider"&&e.jsx(Se,{expectedImage:a,actualImage:o,canvasWidth:y,canvasHeight:T,scale:f}),t.diff&&i==="sxs"&&e.jsxs("div",{style:{display:"flex"},children:[e.jsx(E,{image:a,title:"Expected",canvasWidth:N*w,canvasHeight:N*M,scale:N}),e.jsx(E,{image:c?h:o,title:c?"Diff":"Actual",onClick:()=>l(!c),canvasWidth:N*w,canvasHeight:N*M,scale:N})]}),!t.diff&&i==="actual"&&e.jsx(E,{image:o,title:"Actual",canvasWidth:y,canvasHeight:T,scale:f}),!t.diff&&i==="expected"&&e.jsx(E,{image:a,title:"Expected",canvasWidth:y,canvasHeight:T,scale:f}),!t.diff&&i==="sxs"&&e.jsxs("div",{style:{display:"flex"},children:[e.jsx(E,{image:a,title:"Expected",canvasWidth:N*w,canvasHeight:N*M,scale:N}),e.jsx(E,{image:o,title:"Actual",canvasWidth:N*w,canvasHeight:N*M,scale:N})]})]}),e.jsxs("div",{style:{alignSelf:"start",lineHeight:"18px",marginLeft:"15px"},children:[e.jsx("div",{children:t.diff&&e.jsx("a",{target:"_blank",href:t.diff.attachment.path,rel:"noreferrer",children:t.diff.attachment.name})}),e.jsx("div",{children:e.jsx("a",{target:s?"":"_blank",href:t.actual.attachment.path,rel:"noreferrer",children:t.actual.attachment.name})}),e.jsx("div",{children:e.jsx("a",{target:s?"":"_blank",href:t.expected.attachment.path,rel:"noreferrer",children:t.expected.attachment.name})})]})]})})},Se=({expectedImage:t,actualImage:s,canvasWidth:i,canvasHeight:n,scale:c})=>{const l={position:"absolute",top:0,left:0},[a,r]=d.useState(i/2),o=t.naturalWidth===s.naturalWidth&&t.naturalHeight===s.naturalHeight;return e.jsxs("div",{style:{flex:"none",display:"flex",alignItems:"center",flexDirection:"column",userSelect:"none"},children:[e.jsxs("div",{style:{margin:5},children:[!o&&e.jsx("span",{style:{flex:"none",margin:"0 5px"},children:"Expected "}),e.jsx("span",{children:t.naturalWidth}),e.jsx("span",{style:{flex:"none",margin:"0 5px"},children:"x"}),e.jsx("span",{children:t.naturalHeight}),!o&&e.jsx("span",{style:{flex:"none",margin:"0 5px 0 15px"},children:"Actual "}),!o&&e.jsx("span",{children:s.naturalWidth}),!o&&e.jsx("span",{style:{flex:"none",margin:"0 5px"},children:"x"}),!o&&e.jsx("span",{children:s.naturalHeight})]}),e.jsxs("div",{style:{position:"relative",width:i,height:n,margin:15,...ot},children:[e.jsx(Kt,{orientation:"horizontal",offsets:[a],setOffsets:x=>r(x[0]),resizerColor:"#57606a80",resizerWidth:6}),e.jsx("img",{alt:"Expected",style:{width:t.naturalWidth*c,height:t.naturalHeight*c},draggable:"false",src:t.src}),e.jsx("div",{style:{...l,bottom:0,overflow:"hidden",width:a,...ot},children:e.jsx("img",{alt:"Actual",style:{width:s.naturalWidth*c,height:s.naturalHeight*c},draggable:"false",src:s.src})})]})]})},E=({image:t,title:s,alt:i,canvasWidth:n,canvasHeight:c,scale:l,onClick:a})=>e.jsxs("div",{style:{flex:"none",display:"flex",alignItems:"center",flexDirection:"column"},children:[e.jsxs("div",{style:{margin:5},children:[s&&e.jsx("span",{style:{flex:"none",margin:"0 5px"},children:s}),e.jsx("span",{children:t.naturalWidth}),e.jsx("span",{style:{flex:"none",margin:"0 5px"},children:"x"}),e.jsx("span",{children:t.naturalHeight})]}),e.jsx("div",{style:{display:"flex",flex:"none",width:n,height:c,margin:15,...ot},children:e.jsx("img",{width:t.naturalWidth*l,height:t.naturalHeight*l,alt:s||i,style:{cursor:a?"pointer":"initial"},draggable:"false",src:t.src,onClick:a})})]});function Ce(t){return!!t.match(/^(text\/.*?|application\/(json|(x-)?javascript|xml.*?|ecmascript|graphql|x-www-form-urlencoded)|image\/svg(\+xml)?|application\/.*?(\+json|\+xml))(;\s*charset=.*)?$/)}const Le=({title:t,children:s,setExpanded:i,expanded:n,expandOnTitleClick:c})=>e.jsxs("div",{className:K("expandable",n&&"expanded"),children:[e.jsxs("div",{className:"expandable-title",onClick:()=>c&&i(!n),children:[e.jsx("div",{className:K("codicon",n?"codicon-chevron-down":"codicon-chevron-right"),style:{cursor:"pointer",color:"var(--vscode-foreground)",marginLeft:"5px"},onClick:()=>!c&&i(!n)}),t]}),n&&e.jsx("div",{style:{marginLeft:25},children:s})]});function Wt(t){const s=[];let i=0,n;for(;(n=Jt.exec(t))!==null;){const l=t.substring(i,n.index);l&&s.push(l);const a=n[0];s.push(Ie(a)),i=n.index+a.length}const c=t.substring(i);return c&&s.push(c),s}function Ie(t){let s=t;return s.startsWith("www.")&&(s="https://"+s),e.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",children:t})}const We=({attachment:t})=>{const[s,i]=d.useState(!1),[n,c]=d.useState(null),[l,a]=d.useState(null),r=Ce(t.contentType),o=!!t.sha1||!!t.path;d.useEffect(()=>{s&&n===null&&l===null&&(a("Loading ..."),fetch(mt(t)).then(v=>v.text()).then(v=>{c(v),a(null)}).catch(v=>{a("Failed to load: "+v.message)}))},[s,n,l,t]);const x=d.useMemo(()=>{const v=n?n.split(`
9
+ `).length:0;return Math.min(Math.max(5,v),20)*Qt},[n]),h=e.jsxs("span",{style:{marginLeft:5},children:[Wt(t.name)," ",o&&e.jsx("a",{style:{marginLeft:5},href:Z(t),children:"download"})]});return!r||!o?e.jsx("div",{style:{marginLeft:20},children:h}):e.jsxs(e.Fragment,{children:[e.jsx(Le,{title:h,expanded:s,setExpanded:i,expandOnTitleClick:!0,children:l&&e.jsx("i",{children:l})}),s&&n!==null&&e.jsx("div",{className:"vbox",style:{height:x},children:e.jsx(Zt,{text:n,readOnly:!0,mimeType:t.contentType,linkify:!0,lineNumbers:!0,wrapLines:!1})})]})},Re=({model:t})=>{const{diffMap:s,screenshots:i,attachments:n}=d.useMemo(()=>{const c=new Set,l=new Set;for(const r of(t==null?void 0:t.actions)||[]){const o=r.context.traceUrl;for(const x of r.attachments||[])c.add({...x,traceUrl:o})}const a=new Map;for(const r of c){if(!r.path&&!r.sha1)continue;const o=r.name.match(/^(.*)-(expected|actual|diff)\.png$/);if(o){const x=o[1],h=o[2],v=a.get(x)||{expected:void 0,actual:void 0,diff:void 0};v[h]=r,a.set(x,v),c.delete(r)}else r.contentType.startsWith("image/")&&(l.add(r),c.delete(r))}return{diffMap:a,attachments:c,screenshots:l}},[t]);return!s.size&&!i.size&&!n.size?e.jsx(J,{text:"No attachments"}):e.jsxs("div",{className:"attachments-tab",children:[[...s.values()].map(({expected:c,actual:l,diff:a})=>e.jsxs(e.Fragment,{children:[c&&l&&e.jsx("div",{className:"attachments-section",children:"Image diff"}),c&&l&&e.jsx(ke,{noTargetBlank:!0,diff:{name:"Image diff",expected:{attachment:{...c,path:Z(c)},title:"Expected"},actual:{attachment:{...l,path:Z(l)}},diff:a?{attachment:{...a,path:Z(a)}}:void 0}})]})),i.size?e.jsx("div",{className:"attachments-section",children:"Screenshots"}):void 0,[...i.values()].map((c,l)=>{const a=mt(c);return e.jsxs("div",{className:"attachment-item",children:[e.jsx("div",{children:e.jsx("img",{draggable:"false",src:a})}),e.jsx("div",{children:e.jsx("a",{target:"_blank",href:a,rel:"noreferrer",children:c.name})})]},`screenshot-${l}`)}),n.size?e.jsx("div",{className:"attachments-section",children:"Attachments"}):void 0,[...n.values()].map((c,l)=>e.jsx("div",{className:"attachment-item",children:e.jsx(We,{attachment:c})},ze(c,l)))]})};function mt(t,s={}){const i=new URLSearchParams(s);return t.sha1?(i.set("trace",t.traceUrl),"sha1/"+t.sha1+"?"+i.toString()):(i.set("path",t.path),"file?"+i.toString())}function Z(t){const s={dn:t.name};return t.contentType&&(s.dct=t.contentType),mt(t,s)}function ze(t,s){return s+"-"+(t.sha1?"sha1-"+t.sha1:"path-"+t.path)}const He=({annotations:t})=>t.length?e.jsx("div",{className:"annotations-tab",children:t.map((s,i)=>e.jsxs("div",{className:"annotation-item",children:[e.jsx("span",{style:{fontWeight:"bold"},children:s.type}),s.description&&e.jsxs("span",{children:[": ",Wt(s.description)]})]},`annotation-${i}`))}):e.jsx(J,{text:"No annotations"});function Xe(t){return t==="scheduled"?"codicon-clock":t==="running"?"codicon-loading":t==="failed"?"codicon-error":t==="passed"?"codicon-check":t==="skipped"?"codicon-circle-slash":"codicon-circle-outline"}function Ae(t){return t==="scheduled"?"Pending":t==="running"?"Running":t==="failed"?"Failed":t==="passed"?"Passed":t==="skipped"?"Skipped":"Did not run"}const Ee=({model:t,showSourcesFirst:s,rootDir:i,fallbackLocation:n,isLive:c,hideTimeline:l,status:a,annotations:r,inert:o,openPage:x,onOpenExternally:h,revealSource:v,showSettings:m})=>{var vt;const[b,j]=d.useState(void 0),[w,M]=d.useState(void 0),[f,N]=d.useState(),[y,T]=d.useState(),[L,R]=d.useState(),[X,z]=d.useState("actions"),[G,p]=jt("propertiesTab",s?"source":"call"),[u,S]=d.useState(!1),[C,k]=d.useState(""),[I,P]=d.useState(),[A,U]=jt("propertiesSidebarLocation","bottom"),$=!1,et=d.useCallback(g=>{j(g==null?void 0:g.callId),M(void 0)},[]),st=d.useMemo(()=>t==null?void 0:t.actions.find(g=>g.callId===f),[t,f]),it=d.useCallback(g=>{N(g==null?void 0:g.callId)},[]),Rt=d.useMemo(()=>(t==null?void 0:t.sources)||new Map,[t]);d.useEffect(()=>{P(void 0),M(void 0)},[t]);const B=d.useMemo(()=>{if(b){const q=t==null?void 0:t.actions.find(O=>O.callId===b);if(q)return q}const g=t==null?void 0:t.failedAction();if(g)return g;if(t!=null&&t.actions.length){let q=t.actions.length-1;for(let O=0;O<t.actions.length;++O)if(t.actions[O].apiName==="After Hooks"&&O){q=O-1;break}return t.actions[q]}},[t,b]),zt=d.useMemo(()=>w?w.stack:B==null?void 0:B.stack,[B,w]),nt=d.useMemo(()=>st||B,[B,st]),ut=d.useCallback(g=>{et(g),it(void 0)},[et,it]),D=d.useCallback(g=>{p(g),g!=="inspector"&&S(!1)},[p]),xt=d.useCallback(g=>{!u&&g&&D("inspector"),S(g)},[S,D,u]),Ht=d.useCallback(g=>{k(g),D("inspector")},[D]);d.useEffect(()=>{v&&D("source")},[v,D]);const at=te(t,I),ft=ee(t,I),pt=ge(t),Xt=d.useMemo(()=>(t==null?void 0:t.actions.map(g=>g.attachments||[]).flat())||[],[t]),V=(t==null?void 0:t.sdkLanguage)||"javascript",At={id:"inspector",title:"Locator",render:()=>e.jsx(ae,{showScreenshot:$,sdkLanguage:V,setIsInspecting:xt,highlightedLocator:C,setHighlightedLocator:k})},Dt={id:"call",title:"Call",render:()=>e.jsx(ue,{action:nt,sdkLanguage:V})},Et={id:"log",title:"Log",render:()=>e.jsx(fe,{action:nt,isLive:c})},Ft={id:"errors",title:"Errors",errorCount:pt.errors.size,render:()=>e.jsx(ve,{errorsModel:pt,sdkLanguage:V,revealInSource:g=>{g.action?et(g.action):M(g),D("source")}})};let gt;!B&&n&&(gt=(vt=n.source)==null?void 0:vt.errors.length);const rt={id:"source",title:"Source",errorCount:gt,render:()=>e.jsx(re,{stack:zt,sources:Rt,rootDir:i,stackFrameLocation:A==="bottom"?"right":"bottom",fallbackLocation:n,onOpenExternally:h})},Pt={id:"console",title:"Console",count:at.entries.length,render:()=>e.jsx(se,{consoleModel:at,boundaries:ct,selectedTime:I,onAccepted:g=>P({minimum:g.timestamp,maximum:g.timestamp}),onEntryHovered:R})},Ut={id:"network",title:"Network",count:ft.resources.length,render:()=>e.jsx(ie,{boundaries:ct,networkModel:ft,onEntryHovered:T})},Bt={id:"attachments",title:"Attachments",count:Xt.length,render:()=>e.jsx(Re,{model:t})},Y=[At,Dt,Et,Ft,Pt,Ut,rt,Bt];if(r!==void 0){const g={id:"annotations",title:"Annotations",count:r.length,render:()=>e.jsx(He,{annotations:r})};Y.push(g)}if(s){const g=Y.indexOf(rt);Y.splice(g,1),Y.splice(1,0,rt)}const{boundaries:ct}=d.useMemo(()=>{const g={minimum:(t==null?void 0:t.startTime)||0,maximum:(t==null?void 0:t.endTime)||3e4};return g.minimum>g.maximum&&(g.minimum=0,g.maximum=3e4),g.maximum+=(g.maximum-g.minimum)/20,{boundaries:g}},[t]);let Q=0;!c&&t&&t.endTime>=0?Q=t.endTime-t.startTime:t&&t.wallTime&&(Q=Date.now()-t.wallTime);const $t={id:"actions",title:"Actions",component:e.jsxs("div",{className:"vbox",children:[a&&e.jsxs("div",{className:"workbench-run-status",children:[e.jsx("span",{className:K("codicon",Xe(a))}),e.jsx("div",{children:Ae(a)}),e.jsx("div",{className:"spacer"}),e.jsx("div",{className:"workbench-run-duration",children:Q?F(Q):""})]}),e.jsx(de,{sdkLanguage:V,actions:(t==null?void 0:t.actions)||[],selectedAction:t?B:void 0,selectedTime:I,setSelectedTime:P,onSelected:ut,onHighlighted:it,revealConsole:()=>D("console"),isLive:c})]})},Ot={id:"metadata",title:"Metadata",component:e.jsx(Me,{model:t})};return e.jsxs("div",{className:"vbox workbench",...o?{inert:"true"}:{},children:[!l&&e.jsx(be,{model:t,consoleEntries:at.entries,boundaries:ct,highlightedAction:st,highlightedEntry:y,highlightedConsoleEntry:L,onSelected:ut,sdkLanguage:V,selectedTime:I,setSelectedTime:P}),e.jsx(wt,{sidebarSize:250,orientation:A==="bottom"?"vertical":"horizontal",settingName:"propertiesSidebar",main:e.jsx(wt,{sidebarSize:250,orientation:"horizontal",sidebarIsFirst:!0,settingName:"actionListSidebar",main:e.jsx(ne,{action:nt,model:t,sdkLanguage:V,testIdAttributeName:(t==null?void 0:t.testIdAttributeName)||"data-testid",isInspecting:u,setIsInspecting:xt,highlightedLocator:C,setHighlightedLocator:Ht,openPage:x}),sidebar:e.jsx(Nt,{tabs:[$t,Ot],selectedTab:X,setSelectedTab:z})}),sidebar:e.jsx(Nt,{tabs:Y,selectedTab:G,setSelectedTab:D,rightToolbar:[A==="bottom"?e.jsx(bt,{title:"Dock to right",icon:"layout-sidebar-right-off",onClick:()=>{U("right")}}):e.jsx(bt,{title:"Dock to bottom",icon:"layout-panel-off",onClick:()=>{U("bottom")}})],mode:A==="bottom"?"default":"select"})})]})};export{Le as E,le as T,Ee as W,Xe as t};
@@ -1,2 +1,2 @@
1
- import{M as u,r,b as y,t as E,j as o,a as k,c as x}from"./assets/inspectorTab-BPzhNk9r.js";import{W as M}from"./assets/workbench-DLv_q9ji.js";function S(t,e){t&&window.parent.postMessage({method:"openExternal",params:{url:t,target:e}},"*")}function j({file:t,line:e,column:a}){window.parent.postMessage({method:"openSourceLocation",params:{file:t,line:e,column:a}},"*")}const L=()=>{const[t,e]=r.useState([]),[a,g]=r.useState(h),[c,l]=r.useState({done:0,total:0}),[d,m]=r.useState(null);return r.useEffect(()=>{window.addEventListener("message",async({data:{method:s,params:n}})=>{s==="loadTraceRequested"?(e(n.traceUrl?[n.traceUrl]:[]),m(null)):s==="applyTheme"&&y()!==n.theme&&E()}),window.parent.postMessage({type:"loaded"},"*")},[]),r.useEffect(()=>{(async()=>{if(t.length){const s=i=>{i.data.method==="progress"&&l(i.data.params)};navigator.serviceWorker.addEventListener("message",s),l({done:0,total:1});const n=[];for(let i=0;i<t.length;i++){const v=t[i],p=new URLSearchParams;p.set("trace",v),p.set("limit",String(t.length));const w=await fetch(`contexts?${p.toString()}`);if(!w.ok){m((await w.json()).error);return}n.push(...await w.json())}navigator.serviceWorker.removeEventListener("message",s);const f=new u(n);l({done:0,total:0}),g(f)}else g(h)})()},[t]),r.useEffect(()=>{var s;d&&((s=window.parent)==null||s.postMessage({method:"showErrorMessage",params:{message:d}},"*"))},[d]),o.jsxs("div",{className:"vbox workbench-loader",children:[o.jsx("div",{className:"progress",children:o.jsx("div",{className:"inner-progress",style:{width:c.total?100*c.done/c.total+"%":0}})}),o.jsx(M,{model:a,openPage:S,onOpenExternally:j,showSettings:!0}),!t.length&&o.jsx("div",{className:"empty-state",children:o.jsx("div",{className:"title",children:"Select test to see the trace"})})]})},h=new u([]);(async()=>{k();const t=e=>{var a;e.isTrusted&&((a=window.parent)==null||a.postMessage({type:e.type,key:e.key,keyCode:e.keyCode,code:e.code,shiftKey:e.shiftKey,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,repeat:e.repeat},"*"))};if(window.addEventListener("keydown",t),window.addEventListener("keyup",t),window.location.protocol!=="file:"){if(!navigator.serviceWorker)throw new Error(`Service workers are not supported.
1
+ import{M as u,r,b as y,t as E,j as o,a as k,c as x}from"./assets/inspectorTab-Soeeuvzv.js";import{W as M}from"./assets/workbench-lypYlf00.js";function S(t,e){t&&window.parent.postMessage({method:"openExternal",params:{url:t,target:e}},"*")}function j({file:t,line:e,column:a}){window.parent.postMessage({method:"openSourceLocation",params:{file:t,line:e,column:a}},"*")}const L=()=>{const[t,e]=r.useState([]),[a,g]=r.useState(h),[c,l]=r.useState({done:0,total:0}),[d,m]=r.useState(null);return r.useEffect(()=>{window.addEventListener("message",async({data:{method:s,params:n}})=>{s==="loadTraceRequested"?(e(n.traceUrl?[n.traceUrl]:[]),m(null)):s==="applyTheme"&&y()!==n.theme&&E()}),window.parent.postMessage({type:"loaded"},"*")},[]),r.useEffect(()=>{(async()=>{if(t.length){const s=i=>{i.data.method==="progress"&&l(i.data.params)};navigator.serviceWorker.addEventListener("message",s),l({done:0,total:1});const n=[];for(let i=0;i<t.length;i++){const v=t[i],p=new URLSearchParams;p.set("trace",v),p.set("limit",String(t.length));const w=await fetch(`contexts?${p.toString()}`);if(!w.ok){m((await w.json()).error);return}n.push(...await w.json())}navigator.serviceWorker.removeEventListener("message",s);const f=new u(n);l({done:0,total:0}),g(f)}else g(h)})()},[t]),r.useEffect(()=>{var s;d&&((s=window.parent)==null||s.postMessage({method:"showErrorMessage",params:{message:d}},"*"))},[d]),o.jsxs("div",{className:"vbox workbench-loader",children:[o.jsx("div",{className:"progress",children:o.jsx("div",{className:"inner-progress",style:{width:c.total?100*c.done/c.total+"%":0}})}),o.jsx(M,{model:a,openPage:S,onOpenExternally:j,showSettings:!0}),!t.length&&o.jsx("div",{className:"empty-state",children:o.jsx("div",{className:"title",children:"Select test to see the trace"})})]})},h=new u([]);(async()=>{k();const t=e=>{var a;e.isTrusted&&((a=window.parent)==null||a.postMessage({type:e.type,key:e.key,keyCode:e.keyCode,code:e.code,shiftKey:e.shiftKey,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,repeat:e.repeat},"*"))};if(window.addEventListener("keydown",t),window.addEventListener("keyup",t),window.location.protocol!=="file:"){if(!navigator.serviceWorker)throw new Error(`Service workers are not supported.
2
2
  Make sure to serve the Trace Viewer (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(e=>{navigator.serviceWorker.oncontrollerchange=()=>e()}),setInterval(function(){fetch("ping")},1e4)}x(document.querySelector("#root")).render(o.jsx(L,{}))})();
@@ -0,0 +1,2 @@
1
+ import{M as u,r,b as y,t as E,j as o,a as k,c as x}from"./assets/inspectorTab-BuJ3wAX_.js";import{W as M}from"./assets/workbench-DdmJ9AJV.js";function S(t,e){t&&window.parent.postMessage({method:"openExternal",params:{url:t,target:e}},"*")}function j({file:t,line:e,column:a}){window.parent.postMessage({method:"openSourceLocation",params:{file:t,line:e,column:a}},"*")}const L=()=>{const[t,e]=r.useState([]),[a,g]=r.useState(h),[c,l]=r.useState({done:0,total:0}),[d,m]=r.useState(null);return r.useEffect(()=>{window.addEventListener("message",async({data:{method:s,params:n}})=>{s==="loadTraceRequested"?(e(n.traceUrl?[n.traceUrl]:[]),m(null)):s==="applyTheme"&&y()!==n.theme&&E()}),window.parent.postMessage({type:"loaded"},"*")},[]),r.useEffect(()=>{(async()=>{if(t.length){const s=i=>{i.data.method==="progress"&&l(i.data.params)};navigator.serviceWorker.addEventListener("message",s),l({done:0,total:1});const n=[];for(let i=0;i<t.length;i++){const v=t[i],p=new URLSearchParams;p.set("trace",v),p.set("limit",String(t.length));const w=await fetch(`contexts?${p.toString()}`);if(!w.ok){m((await w.json()).error);return}n.push(...await w.json())}navigator.serviceWorker.removeEventListener("message",s);const f=new u(n);l({done:0,total:0}),g(f)}else g(h)})()},[t]),r.useEffect(()=>{var s;d&&((s=window.parent)==null||s.postMessage({method:"showErrorMessage",params:{message:d}},"*"))},[d]),o.jsxs("div",{className:"vbox workbench-loader",children:[o.jsx("div",{className:"progress",children:o.jsx("div",{className:"inner-progress",style:{width:c.total?100*c.done/c.total+"%":0}})}),o.jsx(M,{model:a,openPage:S,onOpenExternally:j,showSettings:!0}),!t.length&&o.jsx("div",{className:"empty-state",children:o.jsx("div",{className:"title",children:"Select test to see the trace"})})]})},h=new u([]);(async()=>{k();const t=e=>{var a;e.isTrusted&&((a=window.parent)==null||a.postMessage({type:e.type,key:e.key,keyCode:e.keyCode,code:e.code,shiftKey:e.shiftKey,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,repeat:e.repeat},"*"))};if(window.addEventListener("keydown",t),window.addEventListener("keyup",t),window.location.protocol!=="file:"){if(!navigator.serviceWorker)throw new Error(`Service workers are not supported.
2
+ Make sure to serve the Trace Viewer (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(e=>{navigator.serviceWorker.oncontrollerchange=()=>e()}),setInterval(function(){fetch("ping")},1e4)}x(document.querySelector("#root")).render(o.jsx(L,{}))})();
@@ -5,9 +5,9 @@
5
5
  <meta charset="UTF-8">
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
7
  <title>Playwright Trace Viewer for VS Code</title>
8
- <script type="module" crossorigin src="./embedded.BIubxTi3.js"></script>
9
- <link rel="modulepreload" crossorigin href="./assets/inspectorTab-BPzhNk9r.js">
10
- <link rel="modulepreload" crossorigin href="./assets/workbench-DLv_q9ji.js">
8
+ <script type="module" crossorigin src="./embedded.BkvOrz5Z.js"></script>
9
+ <link rel="modulepreload" crossorigin href="./assets/inspectorTab-Soeeuvzv.js">
10
+ <link rel="modulepreload" crossorigin href="./assets/workbench-lypYlf00.js">
11
11
  <link rel="stylesheet" crossorigin href="./inspectorTab.DLjBDrQR.css">
12
12
  <link rel="stylesheet" crossorigin href="./workbench.DlsCx8k5.css">
13
13
  <link rel="stylesheet" crossorigin href="./embedded.w7WN2u1R.css">
@@ -1,2 +1,2 @@
1
- import{M as k,r as o,j as e,T as W,t as D,a as M,c as C}from"./assets/inspectorTab-BPzhNk9r.js";import{W as F}from"./assets/workbench-DLv_q9ji.js";import{T as O,W as A}from"./assets/testServerConnection-DeE2kSzz.js";const I=()=>{const[i,N]=o.useState(!1),[c,p]=o.useState([]),[u,E]=o.useState([]),[f,S]=o.useState(L),[v,m]=o.useState({done:0,total:0}),[T,g]=o.useState(!1),[y,w]=o.useState(null),[x,U]=o.useState(null),h=o.useCallback(t=>{const r=[],a=[],s=new URL(window.location.href);for(let n=0;n<t.length;n++){const l=t.item(n);if(!l)continue;const b=URL.createObjectURL(l);r.push(b),a.push(l.name),s.searchParams.append("trace",b),s.searchParams.append("traceFileName",l.name)}const d=s.toString();window.history.pushState({},"",d),p(r),E(a),g(!1),w(null)},[]);o.useEffect(()=>{const t=async r=>{var a;if((a=r.clipboardData)!=null&&a.files.length){for(const s of r.clipboardData.files)if(s.type!=="application/zip")return;r.preventDefault(),h(r.clipboardData.files)}};return document.addEventListener("paste",t),()=>document.removeEventListener("paste",t)});const P=o.useCallback(t=>{t.preventDefault(),h(t.dataTransfer.files)},[h]),R=o.useCallback(t=>{t.preventDefault(),t.target.files&&h(t.target.files)},[h]);o.useEffect(()=>{const t=new URL(window.location.href).searchParams,r=t.getAll("trace");N(t.has("isServer"));for(const a of r)if(a.startsWith("file:")){U(a||null);return}if(t.has("isServer")){const a=new URLSearchParams(window.location.search).get("ws"),s=new URL(`../${a}`,window.location.toString());s.protocol=window.location.protocol==="https:"?"wss:":"ws:";const d=new O(new A(s));d.onLoadTraceRequested(async n=>{p(n.traceUrl?[n.traceUrl]:[]),g(!1),w(null)}),d.initialize({}).catch(()=>{})}else r.some(a=>a.startsWith("blob:"))||p(r)},[]),o.useEffect(()=>{(async()=>{if(c.length){const t=s=>{s.data.method==="progress"&&m(s.data.params)};navigator.serviceWorker.addEventListener("message",t),m({done:0,total:1});const r=[];for(let s=0;s<c.length;s++){const d=c[s],n=new URLSearchParams;n.set("trace",d),u.length&&n.set("traceFileName",u[s]),n.set("limit",String(c.length));const l=await fetch(`contexts?${n.toString()}`);if(!l.ok){i||p([]),w((await l.json()).error);return}r.push(...await l.json())}navigator.serviceWorker.removeEventListener("message",t);const a=new k(r);m({done:0,total:0}),S(a)}else S(L)})()},[i,c,u]);const j=!!(!i&&!T&&!x&&(!c.length||y));return e.jsxs("div",{className:"vbox workbench-loader",onDragOver:t=>{t.preventDefault(),g(!0)},children:[e.jsxs("div",{className:"hbox header",...j?{inert:"true"}:{},children:[e.jsx("div",{className:"logo",children:e.jsx("img",{src:"playwright-logo.svg",alt:"Playwright logo"})}),e.jsx("div",{className:"product",children:"Playwright"}),f.title&&e.jsx("div",{className:"title",children:f.title}),e.jsx("div",{className:"spacer"}),e.jsx(W,{icon:"color-mode",title:"Toggle color mode",toggled:!1,onClick:()=>D()})]}),e.jsx("div",{className:"progress",children:e.jsx("div",{className:"inner-progress",style:{width:v.total?100*v.done/v.total+"%":0}})}),e.jsx(F,{model:f,inert:j,showSettings:!0}),x&&e.jsxs("div",{className:"drop-target",children:[e.jsx("div",{children:"Trace Viewer uses Service Workers to show traces. To view trace:"}),e.jsxs("div",{style:{paddingTop:20},children:[e.jsxs("div",{children:["1. Click ",e.jsx("a",{href:x,children:"here"})," to put your trace into the download shelf"]}),e.jsxs("div",{children:["2. Go to ",e.jsx("a",{href:"https://trace.playwright.dev",children:"trace.playwright.dev"})]}),e.jsx("div",{children:"3. Drop the trace from the download shelf into the page"})]})]}),j&&e.jsxs("div",{className:"drop-target",children:[e.jsx("div",{className:"processing-error",role:"alert",children:y}),e.jsx("div",{className:"title",role:"heading","aria-level":1,children:"Drop Playwright Trace to load"}),e.jsx("div",{children:"or"}),e.jsx("button",{onClick:()=>{const t=document.createElement("input");t.type="file",t.multiple=!0,t.click(),t.addEventListener("change",r=>R(r))},type:"button",children:"Select file(s)"}),e.jsx("div",{style:{maxWidth:400},children:"Playwright Trace Viewer is a Progressive Web App, it does not send your trace anywhere, it opens it locally."})]}),i&&!c.length&&e.jsx("div",{className:"drop-target",children:e.jsx("div",{className:"title",children:"Select test to see the trace"})}),T&&e.jsx("div",{className:"drop-target",onDragLeave:()=>{g(!1)},onDrop:t=>P(t),children:e.jsx("div",{className:"title",children:"Release to analyse the Playwright Trace"})})]})},L=new k([]);(async()=>{if(M(),window.location.protocol!=="file:"){if(window.location.href.includes("isUnderTest=true")&&await new Promise(i=>setTimeout(i,1e3)),!navigator.serviceWorker)throw new Error(`Service workers are not supported.
1
+ import{M as k,r as o,j as e,T as W,t as D,a as M,c as C}from"./assets/inspectorTab-BuJ3wAX_.js";import{W as F}from"./assets/workbench-DdmJ9AJV.js";import{T as O,W as A}from"./assets/testServerConnection-DeE2kSzz.js";const I=()=>{const[i,N]=o.useState(!1),[c,p]=o.useState([]),[u,E]=o.useState([]),[f,S]=o.useState(L),[v,m]=o.useState({done:0,total:0}),[T,g]=o.useState(!1),[y,w]=o.useState(null),[x,U]=o.useState(null),h=o.useCallback(t=>{const r=[],a=[],s=new URL(window.location.href);for(let n=0;n<t.length;n++){const l=t.item(n);if(!l)continue;const b=URL.createObjectURL(l);r.push(b),a.push(l.name),s.searchParams.append("trace",b),s.searchParams.append("traceFileName",l.name)}const d=s.toString();window.history.pushState({},"",d),p(r),E(a),g(!1),w(null)},[]);o.useEffect(()=>{const t=async r=>{var a;if((a=r.clipboardData)!=null&&a.files.length){for(const s of r.clipboardData.files)if(s.type!=="application/zip")return;r.preventDefault(),h(r.clipboardData.files)}};return document.addEventListener("paste",t),()=>document.removeEventListener("paste",t)});const P=o.useCallback(t=>{t.preventDefault(),h(t.dataTransfer.files)},[h]),R=o.useCallback(t=>{t.preventDefault(),t.target.files&&h(t.target.files)},[h]);o.useEffect(()=>{const t=new URL(window.location.href).searchParams,r=t.getAll("trace");N(t.has("isServer"));for(const a of r)if(a.startsWith("file:")){U(a||null);return}if(t.has("isServer")){const a=new URLSearchParams(window.location.search).get("ws"),s=new URL(`../${a}`,window.location.toString());s.protocol=window.location.protocol==="https:"?"wss:":"ws:";const d=new O(new A(s));d.onLoadTraceRequested(async n=>{p(n.traceUrl?[n.traceUrl]:[]),g(!1),w(null)}),d.initialize({}).catch(()=>{})}else r.some(a=>a.startsWith("blob:"))||p(r)},[]),o.useEffect(()=>{(async()=>{if(c.length){const t=s=>{s.data.method==="progress"&&m(s.data.params)};navigator.serviceWorker.addEventListener("message",t),m({done:0,total:1});const r=[];for(let s=0;s<c.length;s++){const d=c[s],n=new URLSearchParams;n.set("trace",d),u.length&&n.set("traceFileName",u[s]),n.set("limit",String(c.length));const l=await fetch(`contexts?${n.toString()}`);if(!l.ok){i||p([]),w((await l.json()).error);return}r.push(...await l.json())}navigator.serviceWorker.removeEventListener("message",t);const a=new k(r);m({done:0,total:0}),S(a)}else S(L)})()},[i,c,u]);const j=!!(!i&&!T&&!x&&(!c.length||y));return e.jsxs("div",{className:"vbox workbench-loader",onDragOver:t=>{t.preventDefault(),g(!0)},children:[e.jsxs("div",{className:"hbox header",...j?{inert:"true"}:{},children:[e.jsx("div",{className:"logo",children:e.jsx("img",{src:"playwright-logo.svg",alt:"Playwright logo"})}),e.jsx("div",{className:"product",children:"Playwright"}),f.title&&e.jsx("div",{className:"title",children:f.title}),e.jsx("div",{className:"spacer"}),e.jsx(W,{icon:"color-mode",title:"Toggle color mode",toggled:!1,onClick:()=>D()})]}),e.jsx("div",{className:"progress",children:e.jsx("div",{className:"inner-progress",style:{width:v.total?100*v.done/v.total+"%":0}})}),e.jsx(F,{model:f,inert:j,showSettings:!0}),x&&e.jsxs("div",{className:"drop-target",children:[e.jsx("div",{children:"Trace Viewer uses Service Workers to show traces. To view trace:"}),e.jsxs("div",{style:{paddingTop:20},children:[e.jsxs("div",{children:["1. Click ",e.jsx("a",{href:x,children:"here"})," to put your trace into the download shelf"]}),e.jsxs("div",{children:["2. Go to ",e.jsx("a",{href:"https://trace.playwright.dev",children:"trace.playwright.dev"})]}),e.jsx("div",{children:"3. Drop the trace from the download shelf into the page"})]})]}),j&&e.jsxs("div",{className:"drop-target",children:[e.jsx("div",{className:"processing-error",role:"alert",children:y}),e.jsx("div",{className:"title",role:"heading","aria-level":1,children:"Drop Playwright Trace to load"}),e.jsx("div",{children:"or"}),e.jsx("button",{onClick:()=>{const t=document.createElement("input");t.type="file",t.multiple=!0,t.click(),t.addEventListener("change",r=>R(r))},type:"button",children:"Select file(s)"}),e.jsx("div",{style:{maxWidth:400},children:"Playwright Trace Viewer is a Progressive Web App, it does not send your trace anywhere, it opens it locally."})]}),i&&!c.length&&e.jsx("div",{className:"drop-target",children:e.jsx("div",{className:"title",children:"Select test to see the trace"})}),T&&e.jsx("div",{className:"drop-target",onDragLeave:()=>{g(!1)},onDrop:t=>P(t),children:e.jsx("div",{className:"title",children:"Release to analyse the Playwright Trace"})})]})},L=new k([]);(async()=>{if(M(),window.location.protocol!=="file:"){if(window.location.href.includes("isUnderTest=true")&&await new Promise(i=>setTimeout(i,1e3)),!navigator.serviceWorker)throw new Error(`Service workers are not supported.
2
2
  Make sure to serve the Trace Viewer (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(i=>{navigator.serviceWorker.oncontrollerchange=()=>i()}),setInterval(function(){fetch("ping")},1e4)}C(document.querySelector("#root")).render(e.jsx(I,{}))})();
@@ -0,0 +1,2 @@
1
+ import{M as k,r as o,j as e,T as W,t as D,a as M,c as C}from"./assets/inspectorTab-Soeeuvzv.js";import{W as F}from"./assets/workbench-lypYlf00.js";import{T as O,W as A}from"./assets/testServerConnection-DeE2kSzz.js";const I=()=>{const[i,N]=o.useState(!1),[c,p]=o.useState([]),[u,E]=o.useState([]),[f,S]=o.useState(L),[v,m]=o.useState({done:0,total:0}),[T,g]=o.useState(!1),[y,w]=o.useState(null),[x,U]=o.useState(null),h=o.useCallback(t=>{const r=[],a=[],s=new URL(window.location.href);for(let n=0;n<t.length;n++){const l=t.item(n);if(!l)continue;const b=URL.createObjectURL(l);r.push(b),a.push(l.name),s.searchParams.append("trace",b),s.searchParams.append("traceFileName",l.name)}const d=s.toString();window.history.pushState({},"",d),p(r),E(a),g(!1),w(null)},[]);o.useEffect(()=>{const t=async r=>{var a;if((a=r.clipboardData)!=null&&a.files.length){for(const s of r.clipboardData.files)if(s.type!=="application/zip")return;r.preventDefault(),h(r.clipboardData.files)}};return document.addEventListener("paste",t),()=>document.removeEventListener("paste",t)});const P=o.useCallback(t=>{t.preventDefault(),h(t.dataTransfer.files)},[h]),R=o.useCallback(t=>{t.preventDefault(),t.target.files&&h(t.target.files)},[h]);o.useEffect(()=>{const t=new URL(window.location.href).searchParams,r=t.getAll("trace");N(t.has("isServer"));for(const a of r)if(a.startsWith("file:")){U(a||null);return}if(t.has("isServer")){const a=new URLSearchParams(window.location.search).get("ws"),s=new URL(`../${a}`,window.location.toString());s.protocol=window.location.protocol==="https:"?"wss:":"ws:";const d=new O(new A(s));d.onLoadTraceRequested(async n=>{p(n.traceUrl?[n.traceUrl]:[]),g(!1),w(null)}),d.initialize({}).catch(()=>{})}else r.some(a=>a.startsWith("blob:"))||p(r)},[]),o.useEffect(()=>{(async()=>{if(c.length){const t=s=>{s.data.method==="progress"&&m(s.data.params)};navigator.serviceWorker.addEventListener("message",t),m({done:0,total:1});const r=[];for(let s=0;s<c.length;s++){const d=c[s],n=new URLSearchParams;n.set("trace",d),u.length&&n.set("traceFileName",u[s]),n.set("limit",String(c.length));const l=await fetch(`contexts?${n.toString()}`);if(!l.ok){i||p([]),w((await l.json()).error);return}r.push(...await l.json())}navigator.serviceWorker.removeEventListener("message",t);const a=new k(r);m({done:0,total:0}),S(a)}else S(L)})()},[i,c,u]);const j=!!(!i&&!T&&!x&&(!c.length||y));return e.jsxs("div",{className:"vbox workbench-loader",onDragOver:t=>{t.preventDefault(),g(!0)},children:[e.jsxs("div",{className:"hbox header",...j?{inert:"true"}:{},children:[e.jsx("div",{className:"logo",children:e.jsx("img",{src:"playwright-logo.svg",alt:"Playwright logo"})}),e.jsx("div",{className:"product",children:"Playwright"}),f.title&&e.jsx("div",{className:"title",children:f.title}),e.jsx("div",{className:"spacer"}),e.jsx(W,{icon:"color-mode",title:"Toggle color mode",toggled:!1,onClick:()=>D()})]}),e.jsx("div",{className:"progress",children:e.jsx("div",{className:"inner-progress",style:{width:v.total?100*v.done/v.total+"%":0}})}),e.jsx(F,{model:f,inert:j,showSettings:!0}),x&&e.jsxs("div",{className:"drop-target",children:[e.jsx("div",{children:"Trace Viewer uses Service Workers to show traces. To view trace:"}),e.jsxs("div",{style:{paddingTop:20},children:[e.jsxs("div",{children:["1. Click ",e.jsx("a",{href:x,children:"here"})," to put your trace into the download shelf"]}),e.jsxs("div",{children:["2. Go to ",e.jsx("a",{href:"https://trace.playwright.dev",children:"trace.playwright.dev"})]}),e.jsx("div",{children:"3. Drop the trace from the download shelf into the page"})]})]}),j&&e.jsxs("div",{className:"drop-target",children:[e.jsx("div",{className:"processing-error",role:"alert",children:y}),e.jsx("div",{className:"title",role:"heading","aria-level":1,children:"Drop Playwright Trace to load"}),e.jsx("div",{children:"or"}),e.jsx("button",{onClick:()=>{const t=document.createElement("input");t.type="file",t.multiple=!0,t.click(),t.addEventListener("change",r=>R(r))},type:"button",children:"Select file(s)"}),e.jsx("div",{style:{maxWidth:400},children:"Playwright Trace Viewer is a Progressive Web App, it does not send your trace anywhere, it opens it locally."})]}),i&&!c.length&&e.jsx("div",{className:"drop-target",children:e.jsx("div",{className:"title",children:"Select test to see the trace"})}),T&&e.jsx("div",{className:"drop-target",onDragLeave:()=>{g(!1)},onDrop:t=>P(t),children:e.jsx("div",{className:"title",children:"Release to analyse the Playwright Trace"})})]})},L=new k([]);(async()=>{if(M(),window.location.protocol!=="file:"){if(window.location.href.includes("isUnderTest=true")&&await new Promise(i=>setTimeout(i,1e3)),!navigator.serviceWorker)throw new Error(`Service workers are not supported.
2
+ Make sure to serve the Trace Viewer (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(i=>{navigator.serviceWorker.oncontrollerchange=()=>i()}),setInterval(function(){fetch("ping")},1e4)}C(document.querySelector("#root")).render(e.jsx(I,{}))})();
@@ -7,9 +7,9 @@
7
7
  <link rel="icon" href="./playwright-logo.svg" type="image/svg+xml">
8
8
  <link rel="manifest" href="./manifest.webmanifest">
9
9
  <title>Playwright Trace Viewer</title>
10
- <script type="module" crossorigin src="./index.DPD22sZn.js"></script>
11
- <link rel="modulepreload" crossorigin href="./assets/inspectorTab-BPzhNk9r.js">
12
- <link rel="modulepreload" crossorigin href="./assets/workbench-DLv_q9ji.js">
10
+ <script type="module" crossorigin src="./index._Iolt-uE.js"></script>
11
+ <link rel="modulepreload" crossorigin href="./assets/inspectorTab-Soeeuvzv.js">
12
+ <link rel="modulepreload" crossorigin href="./assets/workbench-lypYlf00.js">
13
13
  <link rel="modulepreload" crossorigin href="./assets/testServerConnection-DeE2kSzz.js">
14
14
  <link rel="stylesheet" crossorigin href="./inspectorTab.DLjBDrQR.css">
15
15
  <link rel="stylesheet" crossorigin href="./workbench.DlsCx8k5.css">
@@ -1,2 +1,2 @@
1
- var H=Object.defineProperty;var W=(t,e,s)=>e in t?H(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var w=(t,e,s)=>W(t,typeof e!="symbol"?e+"":e,s);import{j as n,r as a,M as B,F as U,n as $,L as z,g as D,T as f,H as J,J as K,t as q,S as C,D as y,y as G,z as Q,h as X,A as Y,N as Z,K as ee,O as te,Q as se,I as oe,E as re,a as ne,c as ce}from"./assets/inspectorTab-BPzhNk9r.js";const ae=({sources:t,fileId:e,setFileId:s})=>n.jsx("select",{className:"source-chooser",hidden:!t.length,title:"Source chooser",value:e,onChange:o=>{s(o.target.selectedOptions[0].value)},children:ie(t)});function ie(t){const e=r=>r.replace(/.*[/\\]([^/\\]+)/,"$1"),s=r=>n.jsx("option",{value:r.id,children:e(r.label)},r.id),o=new Map;for(const r of t){let i=o.get(r.group||"Debugger");i||(i=[],o.set(r.group||"Debugger",i)),i.push(r)}return[...o.entries()].map(([r,i])=>n.jsx("optgroup",{label:r,children:i.filter(c=>(c.group||"Debugger")===r).map(c=>s(c))},r))}const b=a.createContext(void 0),le=({trace:t,children:e})=>{const[s,o]=a.useState(),[r,i]=a.useState(0),c=a.useRef(null);return a.useEffect(()=>(c.current&&clearTimeout(c.current),c.current=setTimeout(async()=>{try{const u=await ue(t);u.sha1!==(s==null?void 0:s.sha1)&&o(u)}catch{o(void 0)}finally{i(r+1)}},500),()=>{c.current&&clearTimeout(c.current)}),[r,s,t]),n.jsx(b.Provider,{value:s==null?void 0:s.model,children:e})};async function ue(t){const e=new URLSearchParams;e.set("trace",t),e.set("limit","1");const o=await(await fetch(`contexts?${e.toString()}`)).json(),r=[];for(const i of o)i.actions.forEach(c=>r.push(c.type+"@"+c.startTime+"-"+c.endTime)),i.events.forEach(c=>r.push(c.type+"@"+c.time));return{model:new B(o),sha1:await U(r.join("|"))}}function de(t,e){return[...t,e].join(" >> internal:control=enter-frame >> ")}function me(t){const{action:e}=t;switch(e.name){case"navigate":return{method:"goto",params:{url:e.url}};case"openPage":case"closePage":throw new Error("Not reached")}const s=de(t.frame.framePath,e.selector);switch(e.name){case"click":return{method:"click",params:{selector:s,strict:!0,modifiers:P(e.modifiers),button:e.button,clickCount:e.clickCount,position:e.position}};case"press":return{method:"press",params:{selector:s,strict:!0,key:[...P(e.modifiers),e.key].join("+")}};case"fill":return{method:"fill",params:{selector:s,strict:!0,value:e.text}};case"setInputFiles":return{method:"setInputFiles",params:{selector:s,strict:!0,localPaths:e.files}};case"check":return{method:"check",params:{selector:s,strict:!0}};case"uncheck":return{method:"uncheck",params:{selector:s,strict:!0}};case"select":return{method:"selectOption",params:{selector:s,strict:!0,options:e.options.map(r=>({value:r}))}};case"assertChecked":return{method:"expect",params:{selector:e.selector,expression:"to.be.checked",isNot:!e.checked}};case"assertText":return{method:"expect",params:{selector:s,expression:"to.have.text",expectedText:[],isNot:!1}};case"assertValue":return{method:"expect",params:{selector:s,expression:"to.have.value",expectedValue:void 0,isNot:!1}};case"assertVisible":return{method:"expect",params:{selector:s,expression:"to.be.visible",isNot:!1}}}}function P(t){const e=[];return t&1&&e.push("Alt"),t&2&&e.push("ControlOrMeta"),t&4&&e.push("ControlOrMeta"),t&8&&e.push("Shift"),e}const he=z,pe=({sdkLanguage:t,actions:e,selectedAction:s,onSelectedAction:o})=>{const r=a.useCallback(i=>xe(t,i),[t]);return n.jsx("div",{className:"vbox",children:n.jsx(he,{name:"actions",items:e,selectedItem:s,onSelected:o,render:r})})},xe=(t,e)=>{const{method:s,params:o}=me(e),r=o.selector?$(t||"javascript",o.selector):void 0,i=`page.${s}`;return n.jsx(n.Fragment,{children:n.jsxs("div",{className:"action-title",title:i,children:[n.jsx("span",{children:i}),r&&n.jsx("div",{className:"action-selector",title:r,children:r}),s==="goto"&&o.url&&n.jsx("div",{className:"action-url",title:o.url,children:o.url})]})})},L=a.createContext(void 0),ge=({guid:t,children:e})=>{const[s,o]=a.useState(void 0),[r,i]=a.useState("none"),[c,u]=a.useState({actions:[],sources:[]}),h=a.useRef({setMode:i,setActions:u});a.useEffect(()=>{const d=new URL(`../${t}`,window.location.toString());d.protocol=window.location.protocol==="https:"?"wss:":"ws:";const x=new WebSocket(d.toString());return o(new fe(x,h.current)),()=>{x.close()}},[t]);const p=a.useMemo(()=>s?{mode:r,actions:c.actions,sources:c.sources,connection:s}:void 0,[c,r,s]);return n.jsx(L.Provider,{value:p,children:e})};class fe{constructor(e,s){w(this,"_lastId",0);w(this,"_webSocket");w(this,"_callbacks",new Map);w(this,"_options");this._webSocket=e,this._callbacks=new Map,this._options=s,this._webSocket.addEventListener("message",o=>{const r=JSON.parse(o.data),{id:i,result:c,error:u,method:h,params:p}=r;if(i){const d=this._callbacks.get(i);if(!d)return;this._callbacks.delete(i),u?d.reject(new Error(u)):d.resolve(c)}else this._dispatchEvent(h,p)})}setMode(e){this._sendMessageNoReply("setMode",{mode:e})}async _sendMessage(e,s){const o=++this._lastId,r={id:o,method:e,params:s};return this._webSocket.send(JSON.stringify(r)),new Promise((i,c)=>{this._callbacks.set(o,{resolve:i,reject:c})})}_sendMessageNoReply(e,s){this._sendMessage(e,s).catch(()=>{})}_dispatchEvent(e,s){if(e==="setMode"){const{mode:o}=s;this._options.setMode(o)}if(e==="setActions"){const{actions:o,sources:r}=s;this._options.setActions({actions:o.filter(i=>i.action.name!=="openPage"&&i.action.name!=="closePage"),sources:r}),window.playwrightSourcesEchoForTest=r}}}const we=()=>{const t=new URLSearchParams(window.location.search),e=t.get("ws"),s=t.get("trace")+".json";return n.jsx(ge,{guid:e,children:n.jsx(le,{trace:s,children:n.jsx(be,{})})})},be=()=>{const t=a.useContext(L),e=a.useContext(b),[s,o]=a.useState(),[r,i]=a.useState(void 0),[c,u]=a.useState(!1),[h,p]=a.useState(""),[d,x]=a.useState(""),[v,S]=a.useState(),T=a.useCallback(l=>{i(l==null?void 0:l.startTime)},[]),g=a.useMemo(()=>t==null?void 0:t.actions.find(l=>l.startTime===r),[t==null?void 0:t.actions,r]);a.useEffect(()=>{var k;const l=(k=e==null?void 0:e.actions.find(M=>M.endTime&&M.endTime===(g==null?void 0:g.endTime)))==null?void 0:k.callId;l&&S(l)},[e,g]);const m=a.useMemo(()=>(t==null?void 0:t.sources.find(l=>l.id===s))||(t==null?void 0:t.sources[0]),[t==null?void 0:t.sources,s]),I=a.useMemo(()=>m?{file:"",line:0,column:0,source:{errors:[],content:m.text}}:void 0,[m]),j=(m==null?void 0:m.language)||"javascript",{boundaries:N}=a.useMemo(()=>{const l={minimum:(e==null?void 0:e.startTime)||0,maximum:(e==null?void 0:e.endTime)||3e4};return l.minimum>l.maximum&&(l.minimum=0,l.maximum=3e4),l.maximum+=(l.maximum-l.minimum)/20,{boundaries:l}},[e]),_=a.useCallback(l=>{p(l),x(""),u(!1)},[]),A=a.useCallback(l=>{x(l),p(l)},[]),E={id:"actions",title:"Actions",component:n.jsx(pe,{sdkLanguage:j,actions:(t==null?void 0:t.actions)||[],selectedAction:g,onSelectedAction:T})},R=n.jsxs(D,{sidebarBackground:!0,children:[n.jsx("div",{style:{width:4}}),n.jsx(f,{icon:"inspect",title:"Pick locator",toggled:c,onClick:()=>{u(!c)}}),n.jsx(f,{icon:"eye",title:"Assert visibility",onClick:()=>{}}),n.jsx(f,{icon:"whole-word",title:"Assert text",onClick:()=>{}}),n.jsx(f,{icon:"symbol-constant",title:"Assert value",onClick:()=>{}}),n.jsx(J,{}),n.jsx(f,{icon:"files",title:"Copy",disabled:!m||!m.text,onClick:()=>{m!=null&&m.text&&K(m.text)}}),n.jsx("div",{style:{flex:"auto"}}),n.jsx("div",{children:"Target:"}),n.jsx(ae,{fileId:s,sources:(t==null?void 0:t.sources)||[],setFileId:l=>{o(l)}}),n.jsx(f,{icon:"color-mode",title:"Toggle color mode",toggled:!1,onClick:()=>q()})]}),F=n.jsx(y,{tabs:[E]}),V=n.jsx(Se,{sdkLanguage:j,callId:v,isInspecting:c,setIsInspecting:u,highlightedLocator:d,setHighlightedLocator:_}),O=n.jsx(ve,{sdkLanguage:j,boundaries:N,setIsInspecting:u,highlightedLocator:h,setHighlightedLocator:A,sourceLocation:I});return n.jsx("div",{className:"vbox workbench",children:n.jsx(C,{sidebarSize:250,orientation:"horizontal",settingName:"recorderActionListSidebar",sidebarIsFirst:!0,main:n.jsx(C,{sidebarSize:250,orientation:"vertical",settingName:"recorderPropertiesSidebar",main:n.jsxs("div",{className:"vbox",children:[R,V]}),sidebar:O}),sidebar:F})})},ve=({sdkLanguage:t,boundaries:e,setIsInspecting:s,highlightedLocator:o,setHighlightedLocator:r,sourceLocation:i})=>{const c=a.useContext(b),u=G(c,e),h=Q(c,e),p=a.useRef(new Map),[d,x]=X("recorderPropertiesTab","source"),v={id:"inspector",title:"Locator",render:()=>n.jsx(oe,{showScreenshot:!1,sdkLanguage:t,setIsInspecting:s,highlightedLocator:o,setHighlightedLocator:r})},S={id:"source",title:"Source",render:()=>n.jsx(re,{sources:p.current,stackFrameLocation:"right",fallbackLocation:i})},T={id:"console",title:"Console",count:u.entries.length,render:()=>n.jsx(Y,{boundaries:e,consoleModel:u})},g={id:"network",title:"Network",count:h.resources.length,render:()=>n.jsx(Z,{boundaries:e,networkModel:h})},m=[S,v,T,g];return n.jsx(y,{tabs:m,selectedTab:d,setSelectedTab:x})},Se=({sdkLanguage:t,callId:e,isInspecting:s,setIsInspecting:o,highlightedLocator:r,setHighlightedLocator:i})=>{const c=a.useContext(b),u=a.useMemo(()=>c==null?void 0:c.actions.find(d=>d.callId===e),[c,e]),h=a.useMemo(()=>{const d=ee(u);return d.action||d.after||d.before},[u]),p=a.useMemo(()=>h?te(h):void 0,[h]);return n.jsx(se,{sdkLanguage:t,testIdAttributeName:"data-testid",isInspecting:s,setIsInspecting:o,highlightedLocator:r,setHighlightedLocator:i,snapshotUrls:p})};(async()=>{if(ne(),window.location.protocol!=="file:"){if(!navigator.serviceWorker)throw new Error(`Service workers are not supported.
1
+ var H=Object.defineProperty;var W=(t,e,s)=>e in t?H(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var w=(t,e,s)=>W(t,typeof e!="symbol"?e+"":e,s);import{j as n,r as a,M as B,F as U,n as $,L as z,g as D,T as f,H as J,J as K,t as q,S as C,D as y,y as G,z as Q,h as X,A as Y,N as Z,K as ee,O as te,Q as se,I as oe,E as re,a as ne,c as ce}from"./assets/inspectorTab-BuJ3wAX_.js";const ae=({sources:t,fileId:e,setFileId:s})=>n.jsx("select",{className:"source-chooser",hidden:!t.length,title:"Source chooser",value:e,onChange:o=>{s(o.target.selectedOptions[0].value)},children:ie(t)});function ie(t){const e=r=>r.replace(/.*[/\\]([^/\\]+)/,"$1"),s=r=>n.jsx("option",{value:r.id,children:e(r.label)},r.id),o=new Map;for(const r of t){let i=o.get(r.group||"Debugger");i||(i=[],o.set(r.group||"Debugger",i)),i.push(r)}return[...o.entries()].map(([r,i])=>n.jsx("optgroup",{label:r,children:i.filter(c=>(c.group||"Debugger")===r).map(c=>s(c))},r))}const b=a.createContext(void 0),le=({trace:t,children:e})=>{const[s,o]=a.useState(),[r,i]=a.useState(0),c=a.useRef(null);return a.useEffect(()=>(c.current&&clearTimeout(c.current),c.current=setTimeout(async()=>{try{const u=await ue(t);u.sha1!==(s==null?void 0:s.sha1)&&o(u)}catch{o(void 0)}finally{i(r+1)}},500),()=>{c.current&&clearTimeout(c.current)}),[r,s,t]),n.jsx(b.Provider,{value:s==null?void 0:s.model,children:e})};async function ue(t){const e=new URLSearchParams;e.set("trace",t),e.set("limit","1");const o=await(await fetch(`contexts?${e.toString()}`)).json(),r=[];for(const i of o)i.actions.forEach(c=>r.push(c.type+"@"+c.startTime+"-"+c.endTime)),i.events.forEach(c=>r.push(c.type+"@"+c.time));return{model:new B(o),sha1:await U(r.join("|"))}}function de(t,e){return[...t,e].join(" >> internal:control=enter-frame >> ")}function me(t){const{action:e}=t;switch(e.name){case"navigate":return{method:"goto",params:{url:e.url}};case"openPage":case"closePage":throw new Error("Not reached")}const s=de(t.frame.framePath,e.selector);switch(e.name){case"click":return{method:"click",params:{selector:s,strict:!0,modifiers:P(e.modifiers),button:e.button,clickCount:e.clickCount,position:e.position}};case"press":return{method:"press",params:{selector:s,strict:!0,key:[...P(e.modifiers),e.key].join("+")}};case"fill":return{method:"fill",params:{selector:s,strict:!0,value:e.text}};case"setInputFiles":return{method:"setInputFiles",params:{selector:s,strict:!0,localPaths:e.files}};case"check":return{method:"check",params:{selector:s,strict:!0}};case"uncheck":return{method:"uncheck",params:{selector:s,strict:!0}};case"select":return{method:"selectOption",params:{selector:s,strict:!0,options:e.options.map(r=>({value:r}))}};case"assertChecked":return{method:"expect",params:{selector:e.selector,expression:"to.be.checked",isNot:!e.checked}};case"assertText":return{method:"expect",params:{selector:s,expression:"to.have.text",expectedText:[],isNot:!1}};case"assertValue":return{method:"expect",params:{selector:s,expression:"to.have.value",expectedValue:void 0,isNot:!1}};case"assertVisible":return{method:"expect",params:{selector:s,expression:"to.be.visible",isNot:!1}}}}function P(t){const e=[];return t&1&&e.push("Alt"),t&2&&e.push("ControlOrMeta"),t&4&&e.push("ControlOrMeta"),t&8&&e.push("Shift"),e}const he=z,pe=({sdkLanguage:t,actions:e,selectedAction:s,onSelectedAction:o})=>{const r=a.useCallback(i=>xe(t,i),[t]);return n.jsx("div",{className:"vbox",children:n.jsx(he,{name:"actions",items:e,selectedItem:s,onSelected:o,render:r})})},xe=(t,e)=>{const{method:s,params:o}=me(e),r=o.selector?$(t||"javascript",o.selector):void 0,i=`page.${s}`;return n.jsx(n.Fragment,{children:n.jsxs("div",{className:"action-title",title:i,children:[n.jsx("span",{children:i}),r&&n.jsx("div",{className:"action-selector",title:r,children:r}),s==="goto"&&o.url&&n.jsx("div",{className:"action-url",title:o.url,children:o.url})]})})},L=a.createContext(void 0),ge=({guid:t,children:e})=>{const[s,o]=a.useState(void 0),[r,i]=a.useState("none"),[c,u]=a.useState({actions:[],sources:[]}),h=a.useRef({setMode:i,setActions:u});a.useEffect(()=>{const d=new URL(`../${t}`,window.location.toString());d.protocol=window.location.protocol==="https:"?"wss:":"ws:";const x=new WebSocket(d.toString());return o(new fe(x,h.current)),()=>{x.close()}},[t]);const p=a.useMemo(()=>s?{mode:r,actions:c.actions,sources:c.sources,connection:s}:void 0,[c,r,s]);return n.jsx(L.Provider,{value:p,children:e})};class fe{constructor(e,s){w(this,"_lastId",0);w(this,"_webSocket");w(this,"_callbacks",new Map);w(this,"_options");this._webSocket=e,this._callbacks=new Map,this._options=s,this._webSocket.addEventListener("message",o=>{const r=JSON.parse(o.data),{id:i,result:c,error:u,method:h,params:p}=r;if(i){const d=this._callbacks.get(i);if(!d)return;this._callbacks.delete(i),u?d.reject(new Error(u)):d.resolve(c)}else this._dispatchEvent(h,p)})}setMode(e){this._sendMessageNoReply("setMode",{mode:e})}async _sendMessage(e,s){const o=++this._lastId,r={id:o,method:e,params:s};return this._webSocket.send(JSON.stringify(r)),new Promise((i,c)=>{this._callbacks.set(o,{resolve:i,reject:c})})}_sendMessageNoReply(e,s){this._sendMessage(e,s).catch(()=>{})}_dispatchEvent(e,s){if(e==="setMode"){const{mode:o}=s;this._options.setMode(o)}if(e==="setActions"){const{actions:o,sources:r}=s;this._options.setActions({actions:o.filter(i=>i.action.name!=="openPage"&&i.action.name!=="closePage"),sources:r}),window.playwrightSourcesEchoForTest=r}}}const we=()=>{const t=new URLSearchParams(window.location.search),e=t.get("ws"),s=t.get("trace")+".json";return n.jsx(ge,{guid:e,children:n.jsx(le,{trace:s,children:n.jsx(be,{})})})},be=()=>{const t=a.useContext(L),e=a.useContext(b),[s,o]=a.useState(),[r,i]=a.useState(void 0),[c,u]=a.useState(!1),[h,p]=a.useState(""),[d,x]=a.useState(""),[v,S]=a.useState(),T=a.useCallback(l=>{i(l==null?void 0:l.startTime)},[]),g=a.useMemo(()=>t==null?void 0:t.actions.find(l=>l.startTime===r),[t==null?void 0:t.actions,r]);a.useEffect(()=>{var k;const l=(k=e==null?void 0:e.actions.find(M=>M.endTime&&M.endTime===(g==null?void 0:g.endTime)))==null?void 0:k.callId;l&&S(l)},[e,g]);const m=a.useMemo(()=>(t==null?void 0:t.sources.find(l=>l.id===s))||(t==null?void 0:t.sources[0]),[t==null?void 0:t.sources,s]),I=a.useMemo(()=>m?{file:"",line:0,column:0,source:{errors:[],content:m.text}}:void 0,[m]),j=(m==null?void 0:m.language)||"javascript",{boundaries:N}=a.useMemo(()=>{const l={minimum:(e==null?void 0:e.startTime)||0,maximum:(e==null?void 0:e.endTime)||3e4};return l.minimum>l.maximum&&(l.minimum=0,l.maximum=3e4),l.maximum+=(l.maximum-l.minimum)/20,{boundaries:l}},[e]),_=a.useCallback(l=>{p(l),x(""),u(!1)},[]),A=a.useCallback(l=>{x(l),p(l)},[]),E={id:"actions",title:"Actions",component:n.jsx(pe,{sdkLanguage:j,actions:(t==null?void 0:t.actions)||[],selectedAction:g,onSelectedAction:T})},R=n.jsxs(D,{sidebarBackground:!0,children:[n.jsx("div",{style:{width:4}}),n.jsx(f,{icon:"inspect",title:"Pick locator",toggled:c,onClick:()=>{u(!c)}}),n.jsx(f,{icon:"eye",title:"Assert visibility",onClick:()=>{}}),n.jsx(f,{icon:"whole-word",title:"Assert text",onClick:()=>{}}),n.jsx(f,{icon:"symbol-constant",title:"Assert value",onClick:()=>{}}),n.jsx(J,{}),n.jsx(f,{icon:"files",title:"Copy",disabled:!m||!m.text,onClick:()=>{m!=null&&m.text&&K(m.text)}}),n.jsx("div",{style:{flex:"auto"}}),n.jsx("div",{children:"Target:"}),n.jsx(ae,{fileId:s,sources:(t==null?void 0:t.sources)||[],setFileId:l=>{o(l)}}),n.jsx(f,{icon:"color-mode",title:"Toggle color mode",toggled:!1,onClick:()=>q()})]}),F=n.jsx(y,{tabs:[E]}),V=n.jsx(Se,{sdkLanguage:j,callId:v,isInspecting:c,setIsInspecting:u,highlightedLocator:d,setHighlightedLocator:_}),O=n.jsx(ve,{sdkLanguage:j,boundaries:N,setIsInspecting:u,highlightedLocator:h,setHighlightedLocator:A,sourceLocation:I});return n.jsx("div",{className:"vbox workbench",children:n.jsx(C,{sidebarSize:250,orientation:"horizontal",settingName:"recorderActionListSidebar",sidebarIsFirst:!0,main:n.jsx(C,{sidebarSize:250,orientation:"vertical",settingName:"recorderPropertiesSidebar",main:n.jsxs("div",{className:"vbox",children:[R,V]}),sidebar:O}),sidebar:F})})},ve=({sdkLanguage:t,boundaries:e,setIsInspecting:s,highlightedLocator:o,setHighlightedLocator:r,sourceLocation:i})=>{const c=a.useContext(b),u=G(c,e),h=Q(c,e),p=a.useRef(new Map),[d,x]=X("recorderPropertiesTab","source"),v={id:"inspector",title:"Locator",render:()=>n.jsx(oe,{showScreenshot:!1,sdkLanguage:t,setIsInspecting:s,highlightedLocator:o,setHighlightedLocator:r})},S={id:"source",title:"Source",render:()=>n.jsx(re,{sources:p.current,stackFrameLocation:"right",fallbackLocation:i})},T={id:"console",title:"Console",count:u.entries.length,render:()=>n.jsx(Y,{boundaries:e,consoleModel:u})},g={id:"network",title:"Network",count:h.resources.length,render:()=>n.jsx(Z,{boundaries:e,networkModel:h})},m=[S,v,T,g];return n.jsx(y,{tabs:m,selectedTab:d,setSelectedTab:x})},Se=({sdkLanguage:t,callId:e,isInspecting:s,setIsInspecting:o,highlightedLocator:r,setHighlightedLocator:i})=>{const c=a.useContext(b),u=a.useMemo(()=>c==null?void 0:c.actions.find(d=>d.callId===e),[c,e]),h=a.useMemo(()=>{const d=ee(u);return d.action||d.after||d.before},[u]),p=a.useMemo(()=>h?te(h):void 0,[h]);return n.jsx(se,{sdkLanguage:t,testIdAttributeName:"data-testid",isInspecting:s,setIsInspecting:o,highlightedLocator:r,setHighlightedLocator:i,snapshotUrls:p})};(async()=>{if(ne(),window.location.protocol!=="file:"){if(!navigator.serviceWorker)throw new Error(`Service workers are not supported.
2
2
  Make sure to serve the Recorder (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(t=>{navigator.serviceWorker.oncontrollerchange=()=>t()}),setInterval(function(){fetch("ping")},1e4)}ce(document.querySelector("#root")).render(n.jsx(we,{}))})();
@@ -0,0 +1,2 @@
1
+ var H=Object.defineProperty;var W=(t,e,s)=>e in t?H(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var w=(t,e,s)=>W(t,typeof e!="symbol"?e+"":e,s);import{j as n,r as a,M as B,F as U,n as $,L as z,g as D,T as f,H as J,J as K,t as q,S as C,D as y,y as G,z as Q,h as X,A as Y,N as Z,K as ee,O as te,Q as se,I as oe,E as re,a as ne,c as ce}from"./assets/inspectorTab-Soeeuvzv.js";const ae=({sources:t,fileId:e,setFileId:s})=>n.jsx("select",{className:"source-chooser",hidden:!t.length,title:"Source chooser",value:e,onChange:o=>{s(o.target.selectedOptions[0].value)},children:ie(t)});function ie(t){const e=r=>r.replace(/.*[/\\]([^/\\]+)/,"$1"),s=r=>n.jsx("option",{value:r.id,children:e(r.label)},r.id),o=new Map;for(const r of t){let i=o.get(r.group||"Debugger");i||(i=[],o.set(r.group||"Debugger",i)),i.push(r)}return[...o.entries()].map(([r,i])=>n.jsx("optgroup",{label:r,children:i.filter(c=>(c.group||"Debugger")===r).map(c=>s(c))},r))}const b=a.createContext(void 0),le=({trace:t,children:e})=>{const[s,o]=a.useState(),[r,i]=a.useState(0),c=a.useRef(null);return a.useEffect(()=>(c.current&&clearTimeout(c.current),c.current=setTimeout(async()=>{try{const u=await ue(t);u.sha1!==(s==null?void 0:s.sha1)&&o(u)}catch{o(void 0)}finally{i(r+1)}},500),()=>{c.current&&clearTimeout(c.current)}),[r,s,t]),n.jsx(b.Provider,{value:s==null?void 0:s.model,children:e})};async function ue(t){const e=new URLSearchParams;e.set("trace",t),e.set("limit","1");const o=await(await fetch(`contexts?${e.toString()}`)).json(),r=[];for(const i of o)i.actions.forEach(c=>r.push(c.type+"@"+c.startTime+"-"+c.endTime)),i.events.forEach(c=>r.push(c.type+"@"+c.time));return{model:new B(o),sha1:await U(r.join("|"))}}function de(t,e){return[...t,e].join(" >> internal:control=enter-frame >> ")}function me(t){const{action:e}=t;switch(e.name){case"navigate":return{method:"goto",params:{url:e.url}};case"openPage":case"closePage":throw new Error("Not reached")}const s=de(t.frame.framePath,e.selector);switch(e.name){case"click":return{method:"click",params:{selector:s,strict:!0,modifiers:P(e.modifiers),button:e.button,clickCount:e.clickCount,position:e.position}};case"press":return{method:"press",params:{selector:s,strict:!0,key:[...P(e.modifiers),e.key].join("+")}};case"fill":return{method:"fill",params:{selector:s,strict:!0,value:e.text}};case"setInputFiles":return{method:"setInputFiles",params:{selector:s,strict:!0,localPaths:e.files}};case"check":return{method:"check",params:{selector:s,strict:!0}};case"uncheck":return{method:"uncheck",params:{selector:s,strict:!0}};case"select":return{method:"selectOption",params:{selector:s,strict:!0,options:e.options.map(r=>({value:r}))}};case"assertChecked":return{method:"expect",params:{selector:e.selector,expression:"to.be.checked",isNot:!e.checked}};case"assertText":return{method:"expect",params:{selector:s,expression:"to.have.text",expectedText:[],isNot:!1}};case"assertValue":return{method:"expect",params:{selector:s,expression:"to.have.value",expectedValue:void 0,isNot:!1}};case"assertVisible":return{method:"expect",params:{selector:s,expression:"to.be.visible",isNot:!1}}}}function P(t){const e=[];return t&1&&e.push("Alt"),t&2&&e.push("ControlOrMeta"),t&4&&e.push("ControlOrMeta"),t&8&&e.push("Shift"),e}const he=z,pe=({sdkLanguage:t,actions:e,selectedAction:s,onSelectedAction:o})=>{const r=a.useCallback(i=>xe(t,i),[t]);return n.jsx("div",{className:"vbox",children:n.jsx(he,{name:"actions",items:e,selectedItem:s,onSelected:o,render:r})})},xe=(t,e)=>{const{method:s,params:o}=me(e),r=o.selector?$(t||"javascript",o.selector):void 0,i=`page.${s}`;return n.jsx(n.Fragment,{children:n.jsxs("div",{className:"action-title",title:i,children:[n.jsx("span",{children:i}),r&&n.jsx("div",{className:"action-selector",title:r,children:r}),s==="goto"&&o.url&&n.jsx("div",{className:"action-url",title:o.url,children:o.url})]})})},L=a.createContext(void 0),ge=({guid:t,children:e})=>{const[s,o]=a.useState(void 0),[r,i]=a.useState("none"),[c,u]=a.useState({actions:[],sources:[]}),h=a.useRef({setMode:i,setActions:u});a.useEffect(()=>{const d=new URL(`../${t}`,window.location.toString());d.protocol=window.location.protocol==="https:"?"wss:":"ws:";const x=new WebSocket(d.toString());return o(new fe(x,h.current)),()=>{x.close()}},[t]);const p=a.useMemo(()=>s?{mode:r,actions:c.actions,sources:c.sources,connection:s}:void 0,[c,r,s]);return n.jsx(L.Provider,{value:p,children:e})};class fe{constructor(e,s){w(this,"_lastId",0);w(this,"_webSocket");w(this,"_callbacks",new Map);w(this,"_options");this._webSocket=e,this._callbacks=new Map,this._options=s,this._webSocket.addEventListener("message",o=>{const r=JSON.parse(o.data),{id:i,result:c,error:u,method:h,params:p}=r;if(i){const d=this._callbacks.get(i);if(!d)return;this._callbacks.delete(i),u?d.reject(new Error(u)):d.resolve(c)}else this._dispatchEvent(h,p)})}setMode(e){this._sendMessageNoReply("setMode",{mode:e})}async _sendMessage(e,s){const o=++this._lastId,r={id:o,method:e,params:s};return this._webSocket.send(JSON.stringify(r)),new Promise((i,c)=>{this._callbacks.set(o,{resolve:i,reject:c})})}_sendMessageNoReply(e,s){this._sendMessage(e,s).catch(()=>{})}_dispatchEvent(e,s){if(e==="setMode"){const{mode:o}=s;this._options.setMode(o)}if(e==="setActions"){const{actions:o,sources:r}=s;this._options.setActions({actions:o.filter(i=>i.action.name!=="openPage"&&i.action.name!=="closePage"),sources:r}),window.playwrightSourcesEchoForTest=r}}}const we=()=>{const t=new URLSearchParams(window.location.search),e=t.get("ws"),s=t.get("trace")+".json";return n.jsx(ge,{guid:e,children:n.jsx(le,{trace:s,children:n.jsx(be,{})})})},be=()=>{const t=a.useContext(L),e=a.useContext(b),[s,o]=a.useState(),[r,i]=a.useState(void 0),[c,u]=a.useState(!1),[h,p]=a.useState(""),[d,x]=a.useState(""),[v,S]=a.useState(),T=a.useCallback(l=>{i(l==null?void 0:l.startTime)},[]),g=a.useMemo(()=>t==null?void 0:t.actions.find(l=>l.startTime===r),[t==null?void 0:t.actions,r]);a.useEffect(()=>{var k;const l=(k=e==null?void 0:e.actions.find(M=>M.endTime&&M.endTime===(g==null?void 0:g.endTime)))==null?void 0:k.callId;l&&S(l)},[e,g]);const m=a.useMemo(()=>(t==null?void 0:t.sources.find(l=>l.id===s))||(t==null?void 0:t.sources[0]),[t==null?void 0:t.sources,s]),I=a.useMemo(()=>m?{file:"",line:0,column:0,source:{errors:[],content:m.text}}:void 0,[m]),j=(m==null?void 0:m.language)||"javascript",{boundaries:N}=a.useMemo(()=>{const l={minimum:(e==null?void 0:e.startTime)||0,maximum:(e==null?void 0:e.endTime)||3e4};return l.minimum>l.maximum&&(l.minimum=0,l.maximum=3e4),l.maximum+=(l.maximum-l.minimum)/20,{boundaries:l}},[e]),_=a.useCallback(l=>{p(l),x(""),u(!1)},[]),A=a.useCallback(l=>{x(l),p(l)},[]),E={id:"actions",title:"Actions",component:n.jsx(pe,{sdkLanguage:j,actions:(t==null?void 0:t.actions)||[],selectedAction:g,onSelectedAction:T})},R=n.jsxs(D,{sidebarBackground:!0,children:[n.jsx("div",{style:{width:4}}),n.jsx(f,{icon:"inspect",title:"Pick locator",toggled:c,onClick:()=>{u(!c)}}),n.jsx(f,{icon:"eye",title:"Assert visibility",onClick:()=>{}}),n.jsx(f,{icon:"whole-word",title:"Assert text",onClick:()=>{}}),n.jsx(f,{icon:"symbol-constant",title:"Assert value",onClick:()=>{}}),n.jsx(J,{}),n.jsx(f,{icon:"files",title:"Copy",disabled:!m||!m.text,onClick:()=>{m!=null&&m.text&&K(m.text)}}),n.jsx("div",{style:{flex:"auto"}}),n.jsx("div",{children:"Target:"}),n.jsx(ae,{fileId:s,sources:(t==null?void 0:t.sources)||[],setFileId:l=>{o(l)}}),n.jsx(f,{icon:"color-mode",title:"Toggle color mode",toggled:!1,onClick:()=>q()})]}),F=n.jsx(y,{tabs:[E]}),V=n.jsx(Se,{sdkLanguage:j,callId:v,isInspecting:c,setIsInspecting:u,highlightedLocator:d,setHighlightedLocator:_}),O=n.jsx(ve,{sdkLanguage:j,boundaries:N,setIsInspecting:u,highlightedLocator:h,setHighlightedLocator:A,sourceLocation:I});return n.jsx("div",{className:"vbox workbench",children:n.jsx(C,{sidebarSize:250,orientation:"horizontal",settingName:"recorderActionListSidebar",sidebarIsFirst:!0,main:n.jsx(C,{sidebarSize:250,orientation:"vertical",settingName:"recorderPropertiesSidebar",main:n.jsxs("div",{className:"vbox",children:[R,V]}),sidebar:O}),sidebar:F})})},ve=({sdkLanguage:t,boundaries:e,setIsInspecting:s,highlightedLocator:o,setHighlightedLocator:r,sourceLocation:i})=>{const c=a.useContext(b),u=G(c,e),h=Q(c,e),p=a.useRef(new Map),[d,x]=X("recorderPropertiesTab","source"),v={id:"inspector",title:"Locator",render:()=>n.jsx(oe,{showScreenshot:!1,sdkLanguage:t,setIsInspecting:s,highlightedLocator:o,setHighlightedLocator:r})},S={id:"source",title:"Source",render:()=>n.jsx(re,{sources:p.current,stackFrameLocation:"right",fallbackLocation:i})},T={id:"console",title:"Console",count:u.entries.length,render:()=>n.jsx(Y,{boundaries:e,consoleModel:u})},g={id:"network",title:"Network",count:h.resources.length,render:()=>n.jsx(Z,{boundaries:e,networkModel:h})},m=[S,v,T,g];return n.jsx(y,{tabs:m,selectedTab:d,setSelectedTab:x})},Se=({sdkLanguage:t,callId:e,isInspecting:s,setIsInspecting:o,highlightedLocator:r,setHighlightedLocator:i})=>{const c=a.useContext(b),u=a.useMemo(()=>c==null?void 0:c.actions.find(d=>d.callId===e),[c,e]),h=a.useMemo(()=>{const d=ee(u);return d.action||d.after||d.before},[u]),p=a.useMemo(()=>h?te(h):void 0,[h]);return n.jsx(se,{sdkLanguage:t,testIdAttributeName:"data-testid",isInspecting:s,setIsInspecting:o,highlightedLocator:r,setHighlightedLocator:i,snapshotUrls:p})};(async()=>{if(ne(),window.location.protocol!=="file:"){if(!navigator.serviceWorker)throw new Error(`Service workers are not supported.
2
+ Make sure to serve the Recorder (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(t=>{navigator.serviceWorker.oncontrollerchange=()=>t()}),setInterval(function(){fetch("ping")},1e4)}ce(document.querySelector("#root")).render(n.jsx(we,{}))})();
@@ -6,8 +6,8 @@
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
7
  <link rel="icon" href="./playwright-logo.svg" type="image/svg+xml">
8
8
  <title>Playwright Recorder</title>
9
- <script type="module" crossorigin src="./recorder.BaRuS6Pc.js"></script>
10
- <link rel="modulepreload" crossorigin href="./assets/inspectorTab-BPzhNk9r.js">
9
+ <script type="module" crossorigin src="./recorder.DTSaNaly.js"></script>
10
+ <link rel="modulepreload" crossorigin href="./assets/inspectorTab-Soeeuvzv.js">
11
11
  <link rel="stylesheet" crossorigin href="./inspectorTab.DLjBDrQR.css">
12
12
  <link rel="stylesheet" crossorigin href="./recorder.B_SY1GJM.css">
13
13
  </head>
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./assets/xtermModule-BeNbaIVa.js","./xtermModule.DSXBckUd.css"])))=>i.map(i=>d[i]);
2
- import{u as Me,r as V,b as De,_ as Le,d as Fe,e as Oe,j as o,R as h,s as me,f as re,m as We,g as $,T as M,M as Ue,h as Ae,i as ze,S as Ve,a as Ke,c as He}from"./assets/inspectorTab-BPzhNk9r.js";import{T as $e,W as qe}from"./assets/testServerConnection-DeE2kSzz.js";import{E as Ye,t as Qe,T as Xe,W as Ge}from"./assets/workbench-DLv_q9ji.js";var Je={};class se{constructor(e,t={}){this.isListing=!1,this._tests=new Map,this._rootSuite=new q("","root"),this._options=t,this._reporter=e}reset(){this._rootSuite._entries=[],this._tests.clear()}dispatch(e){const{method:t,params:s}=e;if(t==="onConfigure"){this._onConfigure(s.config);return}if(t==="onProject"){this._onProject(s.project);return}if(t==="onBegin"){this._onBegin();return}if(t==="onTestBegin"){this._onTestBegin(s.testId,s.result);return}if(t==="onTestEnd"){this._onTestEnd(s.test,s.result);return}if(t==="onStepBegin"){this._onStepBegin(s.testId,s.resultId,s.step);return}if(t==="onStepEnd"){this._onStepEnd(s.testId,s.resultId,s.step);return}if(t==="onError"){this._onError(s.error);return}if(t==="onStdIO"){this._onStdIO(s.type,s.testId,s.resultId,s.data,s.isBase64);return}if(t==="onEnd")return this._onEnd(s.result);if(t==="onExit")return this._onExit()}_onConfigure(e){var t,s;this._rootDir=e.rootDir,this._config=this._parseConfig(e),(s=(t=this._reporter).onConfigure)==null||s.call(t,this._config)}_onProject(e){let t=this._options.mergeProjects?this._rootSuite.suites.find(s=>s.project().name===e.name):void 0;t||(t=new q(e.name,"project"),this._rootSuite._addSuite(t)),t._project=this._parseProject(e);for(const s of e.suites)this._mergeSuiteInto(s,t)}_onBegin(){var e,t;(t=(e=this._reporter).onBegin)==null||t.call(e,this._rootSuite)}_onTestBegin(e,t){var c,a;const s=this._tests.get(e);this._options.clearPreviousResultsWhenTestBegins&&(s.results=[]);const r=s._createTestResult(t.id);r.retry=t.retry,r.workerIndex=t.workerIndex,r.parallelIndex=t.parallelIndex,r.setStartTimeNumber(t.startTime),(a=(c=this._reporter).onTestBegin)==null||a.call(c,s,r)}_onTestEnd(e,t){var c,a,m;const s=this._tests.get(e.testId);s.timeout=e.timeout,s.expectedStatus=e.expectedStatus,s.annotations=e.annotations;const r=s.results.find(l=>l._id===t.id);r.duration=t.duration,r.status=t.status,r.errors=t.errors,r.error=(c=r.errors)==null?void 0:c[0],r.attachments=this._parseAttachments(t.attachments),(m=(a=this._reporter).onTestEnd)==null||m.call(a,s,r),r._stepMap=new Map}_onStepBegin(e,t,s){var _,n;const r=this._tests.get(e),c=r.results.find(f=>f._id===t),a=s.parentStepId?c._stepMap.get(s.parentStepId):void 0,m=this._absoluteLocation(s.location),l=new et(s,a,m);a?a.steps.push(l):c.steps.push(l),c._stepMap.set(s.id,l),(n=(_=this._reporter).onStepBegin)==null||n.call(_,r,c,l)}_onStepEnd(e,t,s){var m,l;const r=this._tests.get(e),c=r.results.find(_=>_._id===t),a=c._stepMap.get(s.id);a.duration=s.duration,a.error=s.error,(l=(m=this._reporter).onStepEnd)==null||l.call(m,r,c,a)}_onError(e){var t,s;(s=(t=this._reporter).onError)==null||s.call(t,e)}_onStdIO(e,t,s,r,c){var _,n,f,S;const a=c?globalThis.Buffer?Buffer.from(r,"base64"):atob(r):r,m=t?this._tests.get(t):void 0,l=m&&s?m.results.find(d=>d._id===s):void 0;e==="stdout"?(l==null||l.stdout.push(a),(n=(_=this._reporter).onStdOut)==null||n.call(_,a,m,l)):(l==null||l.stderr.push(a),(S=(f=this._reporter).onStdErr)==null||S.call(f,a,m,l))}async _onEnd(e){var t,s;await((s=(t=this._reporter).onEnd)==null?void 0:s.call(t,{status:e.status,startTime:new Date(e.startTime),duration:e.duration}))}_onExit(){var e,t;return(t=(e=this._reporter).onExit)==null?void 0:t.call(e)}_parseConfig(e){const t={...st,...e};return this._options.configOverrides&&(t.configFile=this._options.configOverrides.configFile,t.reportSlowTests=this._options.configOverrides.reportSlowTests,t.quiet=this._options.configOverrides.quiet,t.reporter=[...this._options.configOverrides.reporter]),t}_parseProject(e){return{metadata:e.metadata,name:e.name,outputDir:this._absolutePath(e.outputDir),repeatEach:e.repeatEach,retries:e.retries,testDir:this._absolutePath(e.testDir),testIgnore:Z(e.testIgnore),testMatch:Z(e.testMatch),timeout:e.timeout,grep:Z(e.grep),grepInvert:Z(e.grepInvert),dependencies:e.dependencies,teardown:e.teardown,snapshotDir:this._absolutePath(e.snapshotDir),use:{}}}_parseAttachments(e){return e.map(t=>({...t,body:t.base64&&globalThis.Buffer?Buffer.from(t.base64,"base64"):void 0}))}_mergeSuiteInto(e,t){let s=t.suites.find(r=>r.title===e.title);s||(s=new q(e.title,t.type==="project"?"file":"describe"),t._addSuite(s)),s.location=this._absoluteLocation(e.location),e.entries.forEach(r=>{"testId"in r?this._mergeTestInto(r,s):this._mergeSuiteInto(r,s)})}_mergeTestInto(e,t){let s=this._options.mergeTestCases?t.tests.find(r=>r.title===e.title&&r.repeatEachIndex===e.repeatEachIndex):void 0;s||(s=new Ze(e.testId,e.title,this._absoluteLocation(e.location),e.repeatEachIndex),t._addTest(s),this._tests.set(s.id,s)),this._updateTest(e,s)}_updateTest(e,t){return t.id=e.testId,t.location=this._absoluteLocation(e.location),t.retries=e.retries,t.tags=e.tags??[],t.annotations=e.annotations??[],t}_absoluteLocation(e){return e&&{...e,file:this._absolutePath(e.file)}}_absolutePath(e){if(e!==void 0)return this._options.resolvePath?this._options.resolvePath(this._rootDir,e):this._rootDir+"/"+e}}class q{constructor(e,t){this._entries=[],this._requireFile="",this._parallelMode="none",this.title=e,this._type=t}get type(){return this._type}get suites(){return this._entries.filter(e=>e.type!=="test")}get tests(){return this._entries.filter(e=>e.type==="test")}entries(){return this._entries}allTests(){const e=[],t=s=>{for(const r of s.entries())r.type==="test"?e.push(r):t(r)};return t(this),e}titlePath(){const e=this.parent?this.parent.titlePath():[];return(this.title||this._type!=="describe")&&e.push(this.title),e}project(){var e;return this._project??((e=this.parent)==null?void 0:e.project())}_addTest(e){e.parent=this,this._entries.push(e)}_addSuite(e){e.parent=this,this._entries.push(e)}}class Ze{constructor(e,t,s,r){this.fn=()=>{},this.results=[],this.type="test",this.expectedStatus="passed",this.timeout=0,this.annotations=[],this.retries=0,this.tags=[],this.repeatEachIndex=0,this.id=e,this.title=t,this.location=s,this.repeatEachIndex=r}titlePath(){const e=this.parent?this.parent.titlePath():[];return e.push(this.title),e}outcome(){return it(this)}ok(){const e=this.outcome();return e==="expected"||e==="flaky"||e==="skipped"}_createTestResult(e){const t=new tt(this.results.length,e);return this.results.push(t),t}}class et{constructor(e,t,s){this.duration=-1,this.steps=[],this._startTime=0,this.title=e.title,this.category=e.category,this.location=s,this.parent=t,this._startTime=e.startTime}titlePath(){var t;return[...((t=this.parent)==null?void 0:t.titlePath())||[],this.title]}get startTime(){return new Date(this._startTime)}set startTime(e){this._startTime=+e}}class tt{constructor(e,t){this.parallelIndex=-1,this.workerIndex=-1,this.duration=-1,this.stdout=[],this.stderr=[],this.attachments=[],this.status="skipped",this.steps=[],this.errors=[],this._stepMap=new Map,this._startTime=0,this.retry=e,this._id=t}setStartTimeNumber(e){this._startTime=e}get startTime(){return new Date(this._startTime)}set startTime(e){this._startTime=+e}}const st={forbidOnly:!1,fullyParallel:!1,globalSetup:null,globalTeardown:null,globalTimeout:0,grep:/.*/,grepInvert:null,maxFailures:0,metadata:{},preserveOutput:"always",projects:[],reporter:[[Je.CI?"dot":"list"]],reportSlowTests:{max:5,threshold:15e3},configFile:"",rootDir:"",quiet:!1,shard:null,updateSnapshots:"missing",version:"",workers:0,webServer:null};function Z(i){return i.map(e=>e.s!==void 0?e.s:new RegExp(e.r.source,e.r.flags))}function it(i){let e=0,t=0,s=0;for(const r of i.results)r.status==="interrupted"||(r.status==="skipped"&&i.expectedStatus==="skipped"?++e:r.status==="skipped"||(r.status===i.expectedStatus?++t:++s));return t===0&&s===0?"skipped":s===0?"expected":t===0&&e===0?"unexpected":"flaky"}class ie{constructor(e,t,s,r,c){this._treeItemById=new Map,this._treeItemByTestId=new Map;const a=r&&[...r.values()].some(Boolean);this.pathSeparator=c,this.rootItem={kind:"group",subKind:"folder",id:e,title:"",location:{file:"",line:0,column:0},duration:0,parent:void 0,children:[],status:"none",hasLoadErrors:!1},this._treeItemById.set(e,this.rootItem);const m=(l,_,n)=>{for(const f of _.suites){const S=f.title||"<anonymous>";let d=n.children.find(p=>p.kind==="group"&&p.title===S);d||(d={kind:"group",subKind:"describe",id:"suite:"+_.titlePath().join("")+""+S,title:S,location:f.location,duration:0,parent:n,children:[],status:"none",hasLoadErrors:!1},this._addChild(n,d)),m(l,f,d)}for(const f of _.tests){const S=f.title;let d=n.children.find(E=>E.kind!=="group"&&E.title===S);d||(d={kind:"case",id:"test:"+f.titlePath().join(""),title:S,parent:n,children:[],tests:[],location:f.location,duration:0,status:"none",project:void 0,test:void 0,tags:f.tags},this._addChild(n,d));const p=f.results[0];let x="none";(p==null?void 0:p[Y])==="scheduled"?x="scheduled":(p==null?void 0:p[Y])==="running"?x="running":(p==null?void 0:p.status)==="skipped"?x="skipped":(p==null?void 0:p.status)==="interrupted"?x="none":p&&f.outcome()!=="expected"?x="failed":p&&f.outcome()==="expected"&&(x="passed"),d.tests.push(f);const R={kind:"test",id:f.id,title:l.name,location:f.location,test:f,parent:d,children:[],status:x,duration:f.results.length?Math.max(0,f.results[0].duration):0,project:l};this._addChild(d,R),this._treeItemByTestId.set(f.id,R),d.duration=d.children.reduce((E,I)=>E+I.duration,0)}};for(const l of(t==null?void 0:t.suites)||[])if(!(a&&!r.get(l.title)))for(const _ of l.suites){const n=this._fileItem(_.location.file.split(c),!0);m(l.project(),_,n)}for(const l of s){if(!l.location)continue;const _=this._fileItem(l.location.file.split(c),!0);_.hasLoadErrors=!0}}_addChild(e,t){e.children.push(t),t.parent=e,this._treeItemById.set(t.id,t)}filterTree(e,t,s){const r=e.trim().toLowerCase().split(" "),c=[...t.values()].some(Boolean),a=l=>{const _=[...l.tests[0].titlePath(),...l.tests[0].tags].join(" ").toLowerCase();return!r.every(n=>_.includes(n))&&!l.tests.some(n=>s==null?void 0:s.has(n.id))?!1:(l.children=l.children.filter(n=>!c||(s==null?void 0:s.has(n.test.id))||t.get(n.status)),l.tests=l.children.map(n=>n.test),!!l.children.length)},m=l=>{const _=[];for(const n of l.children)n.kind==="case"?a(n)&&_.push(n):(m(n),(n.children.length||n.hasLoadErrors)&&_.push(n));l.children=_};m(this.rootItem)}_fileItem(e,t){if(e.length===0)return this.rootItem;const s=e.join(this.pathSeparator),r=this._treeItemById.get(s);if(r)return r;const c=this._fileItem(e.slice(0,e.length-1),!1),a={kind:"group",subKind:t?"file":"folder",id:s,title:e[e.length-1],location:{file:s,line:0,column:0},duration:0,parent:c,children:[],status:"none",hasLoadErrors:!1};return this._addChild(c,a),a}sortAndPropagateStatus(){_e(this.rootItem)}flattenForSingleProject(){const e=t=>{t.kind==="case"&&t.children.length===1?(t.project=t.children[0].project,t.test=t.children[0].test,t.children=[],this._treeItemByTestId.set(t.test.id,t)):t.children.forEach(e)};e(this.rootItem)}shortenRoot(){let e=this.rootItem;for(;e.children.length===1&&e.children[0].kind==="group"&&e.children[0].subKind==="folder";)e=e.children[0];e.location=this.rootItem.location,this.rootItem=e}testIds(){const e=new Set,t=s=>{s.kind==="case"&&s.tests.forEach(r=>e.add(r.id)),s.children.forEach(t)};return t(this.rootItem),e}fileNames(){const e=new Set,t=s=>{s.kind==="group"&&s.subKind==="file"?e.add(s.id):s.children.forEach(t)};return t(this.rootItem),[...e]}flatTreeItems(){const e=[],t=s=>{e.push(s),s.children.forEach(t)};return t(this.rootItem),e}treeItemById(e){return this._treeItemById.get(e)}collectTestIds(e){return e?rt(e):new Set}}function _e(i){for(const a of i.children)_e(a);i.kind==="group"&&i.children.sort((a,m)=>a.location.file.localeCompare(m.location.file)||a.location.line-m.location.line);let e=i.children.length>0,t=i.children.length>0,s=!1,r=!1,c=!1;for(const a of i.children)t=t&&a.status==="skipped",e=e&&(a.status==="passed"||a.status==="skipped"),s=s||a.status==="failed",r=r||a.status==="running",c=c||a.status==="scheduled";r?i.status="running":c?i.status="scheduled":s?i.status="failed":t?i.status="skipped":e&&(i.status="passed")}function rt(i){const e=new Set,t=s=>{var r;s.kind==="case"?s.tests.map(c=>c.id).forEach(c=>e.add(c)):s.kind==="test"?e.add(s.id):(r=s.children)==null||r.forEach(t)};return t(i),e}const Y=Symbol("statusEx");class ot{constructor(e){this.loadErrors=[],this.progress={total:0,passed:0,failed:0,skipped:0},this._lastRunTestCount=0,this._receiver=new se(this._createReporter(),{mergeProjects:!0,mergeTestCases:!0,resolvePath:(t,s)=>t+e.pathSeparator+s,clearPreviousResultsWhenTestBegins:!0}),this._options=e}_createReporter(){return{version:()=>"v2",onConfigure:e=>{this.config=e,this._lastRunReceiver=new se({version:()=>"v2",onBegin:t=>{this._lastRunTestCount=t.allTests().length,this._lastRunReceiver=void 0}},{mergeProjects:!0,mergeTestCases:!1,resolvePath:(t,s)=>t+this._options.pathSeparator+s})},onBegin:e=>{var t;if(this.rootSuite||(this.rootSuite=e),this._testResultsSnapshot){for(const s of this.rootSuite.allTests())s.results=((t=this._testResultsSnapshot)==null?void 0:t.get(s.id))||s.results;this._testResultsSnapshot=void 0}this.progress.total=this._lastRunTestCount,this.progress.passed=0,this.progress.failed=0,this.progress.skipped=0,this._options.onUpdate(!0)},onEnd:()=>{this._options.onUpdate(!0)},onTestBegin:(e,t)=>{t[Y]="running",this._options.onUpdate()},onTestEnd:(e,t)=>{e.outcome()==="skipped"?++this.progress.skipped:e.outcome()==="unexpected"?++this.progress.failed:++this.progress.passed,t[Y]=t.status,this._options.onUpdate()},onError:e=>this._handleOnError(e),printsToStdio:()=>!1}}processGlobalReport(e){const t=new se({version:()=>"v2",onConfigure:s=>{this.config=s},onError:s=>this._handleOnError(s)});for(const s of e)t.dispatch(s)}processListReport(e){var s;const t=((s=this.rootSuite)==null?void 0:s.allTests())||[];this._testResultsSnapshot=new Map(t.map(r=>[r.id,r.results])),this._receiver.reset();for(const r of e)this._receiver.dispatch(r)}processTestReportEvent(e){var t,s,r;(s=(t=this._lastRunReceiver)==null?void 0:t.dispatch(e))==null||s.catch(()=>{}),(r=this._receiver.dispatch(e))==null||r.catch(()=>{})}_handleOnError(e){var t,s;this.loadErrors.push(e),(s=(t=this._options).onError)==null||s.call(t,e),this._options.onUpdate()}asModel(){return{rootSuite:this.rootSuite||new q("","root"),config:this.config,loadErrors:this.loadErrors,progress:this.progress}}}const nt=({source:i})=>{const[e,t]=Me(),[s,r]=V.useState(De()),[c]=V.useState(Le(()=>import("./assets/xtermModule-BeNbaIVa.js"),__vite__mapDeps([0,1]),import.meta.url).then(m=>m.default)),a=V.useRef(null);return V.useEffect(()=>(Fe(r),()=>Oe(r)),[]),V.useEffect(()=>{const m=i.write,l=i.clear;return(async()=>{const{Terminal:_,FitAddon:n}=await c,f=t.current;if(!f)return;const S=s==="dark-mode"?lt:at;if(a.current&&a.current.terminal.options.theme===S)return;a.current&&(f.textContent="");const d=new _({convertEol:!0,fontSize:13,scrollback:1e4,fontFamily:"var(--vscode-editor-font-family)",theme:S}),p=new n;d.loadAddon(p);for(const x of i.pending)d.write(x);i.write=x=>{i.pending.push(x),d.write(x)},i.clear=()=>{i.pending=[],d.clear()},d.open(f),p.fit(),a.current={terminal:d,fitAddon:p}})(),()=>{i.clear=l,i.write=m}},[c,a,t,i,s]),V.useEffect(()=>{setTimeout(()=>{a.current&&(a.current.fitAddon.fit(),i.resize(a.current.terminal.cols,a.current.terminal.rows))},250)},[e,i]),o.jsx("div",{"data-testid":"output",className:"xterm-wrapper",style:{flex:"auto"},ref:t})},at={foreground:"#383a42",background:"#fafafa",cursor:"#383a42",black:"#000000",red:"#e45649",green:"#50a14f",yellow:"#c18401",blue:"#4078f2",magenta:"#a626a4",cyan:"#0184bc",white:"#a0a0a0",brightBlack:"#000000",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#d19a66",brightBlue:"#4078f2",brightMagenta:"#a626a4",brightCyan:"#0184bc",brightWhite:"#383a42",selectionBackground:"#d7d7d7",selectionForeground:"#383a42"},lt={foreground:"#f8f8f2",background:"#1e1e1e",cursor:"#f8f8f0",black:"#000000",red:"#ff5555",green:"#50fa7b",yellow:"#f1fa8c",blue:"#bd93f9",magenta:"#ff79c6",cyan:"#8be9fd",white:"#bfbfbf",brightBlack:"#4d4d4d",brightRed:"#ff6e6e",brightGreen:"#69ff94",brightYellow:"#ffffa5",brightBlue:"#d6acff",brightMagenta:"#ff92df",brightCyan:"#a4ffff",brightWhite:"#e6e6e6",selectionBackground:"#44475a",selectionForeground:"#f8f8f2"},ct=({filterText:i,setFilterText:e,statusFilters:t,setStatusFilters:s,projectFilters:r,setProjectFilters:c,testModel:a,runTests:m})=>{const[l,_]=h.useState(!1),n=h.useRef(null);h.useEffect(()=>{var d;(d=n.current)==null||d.focus()},[]);const f=[...t.entries()].filter(([d,p])=>p).map(([d])=>d).join(" ")||"all",S=[...r.entries()].filter(([d,p])=>p).map(([d])=>d).join(" ")||"all";return o.jsxs("div",{className:"filters",children:[o.jsx(Ye,{expanded:l,setExpanded:_,title:o.jsx("input",{ref:n,type:"search",placeholder:"Filter (e.g. text, @tag)",spellCheck:!1,value:i,onChange:d=>{e(d.target.value)},onKeyDown:d=>{d.key==="Enter"&&m()}})}),o.jsxs("div",{className:"filter-summary",title:"Status: "+f+`
2
+ import{u as Me,r as V,b as De,_ as Le,d as Fe,e as Oe,j as o,R as h,s as me,f as re,m as We,g as $,T as M,M as Ue,h as Ae,i as ze,S as Ve,a as Ke,c as He}from"./assets/inspectorTab-Soeeuvzv.js";import{T as $e,W as qe}from"./assets/testServerConnection-DeE2kSzz.js";import{E as Ye,t as Qe,T as Xe,W as Ge}from"./assets/workbench-lypYlf00.js";var Je={};class se{constructor(e,t={}){this.isListing=!1,this._tests=new Map,this._rootSuite=new q("","root"),this._options=t,this._reporter=e}reset(){this._rootSuite._entries=[],this._tests.clear()}dispatch(e){const{method:t,params:s}=e;if(t==="onConfigure"){this._onConfigure(s.config);return}if(t==="onProject"){this._onProject(s.project);return}if(t==="onBegin"){this._onBegin();return}if(t==="onTestBegin"){this._onTestBegin(s.testId,s.result);return}if(t==="onTestEnd"){this._onTestEnd(s.test,s.result);return}if(t==="onStepBegin"){this._onStepBegin(s.testId,s.resultId,s.step);return}if(t==="onStepEnd"){this._onStepEnd(s.testId,s.resultId,s.step);return}if(t==="onError"){this._onError(s.error);return}if(t==="onStdIO"){this._onStdIO(s.type,s.testId,s.resultId,s.data,s.isBase64);return}if(t==="onEnd")return this._onEnd(s.result);if(t==="onExit")return this._onExit()}_onConfigure(e){var t,s;this._rootDir=e.rootDir,this._config=this._parseConfig(e),(s=(t=this._reporter).onConfigure)==null||s.call(t,this._config)}_onProject(e){let t=this._options.mergeProjects?this._rootSuite.suites.find(s=>s.project().name===e.name):void 0;t||(t=new q(e.name,"project"),this._rootSuite._addSuite(t)),t._project=this._parseProject(e);for(const s of e.suites)this._mergeSuiteInto(s,t)}_onBegin(){var e,t;(t=(e=this._reporter).onBegin)==null||t.call(e,this._rootSuite)}_onTestBegin(e,t){var c,a;const s=this._tests.get(e);this._options.clearPreviousResultsWhenTestBegins&&(s.results=[]);const r=s._createTestResult(t.id);r.retry=t.retry,r.workerIndex=t.workerIndex,r.parallelIndex=t.parallelIndex,r.setStartTimeNumber(t.startTime),(a=(c=this._reporter).onTestBegin)==null||a.call(c,s,r)}_onTestEnd(e,t){var c,a,m;const s=this._tests.get(e.testId);s.timeout=e.timeout,s.expectedStatus=e.expectedStatus,s.annotations=e.annotations;const r=s.results.find(l=>l._id===t.id);r.duration=t.duration,r.status=t.status,r.errors=t.errors,r.error=(c=r.errors)==null?void 0:c[0],r.attachments=this._parseAttachments(t.attachments),(m=(a=this._reporter).onTestEnd)==null||m.call(a,s,r),r._stepMap=new Map}_onStepBegin(e,t,s){var _,n;const r=this._tests.get(e),c=r.results.find(f=>f._id===t),a=s.parentStepId?c._stepMap.get(s.parentStepId):void 0,m=this._absoluteLocation(s.location),l=new et(s,a,m);a?a.steps.push(l):c.steps.push(l),c._stepMap.set(s.id,l),(n=(_=this._reporter).onStepBegin)==null||n.call(_,r,c,l)}_onStepEnd(e,t,s){var m,l;const r=this._tests.get(e),c=r.results.find(_=>_._id===t),a=c._stepMap.get(s.id);a.duration=s.duration,a.error=s.error,(l=(m=this._reporter).onStepEnd)==null||l.call(m,r,c,a)}_onError(e){var t,s;(s=(t=this._reporter).onError)==null||s.call(t,e)}_onStdIO(e,t,s,r,c){var _,n,f,S;const a=c?globalThis.Buffer?Buffer.from(r,"base64"):atob(r):r,m=t?this._tests.get(t):void 0,l=m&&s?m.results.find(d=>d._id===s):void 0;e==="stdout"?(l==null||l.stdout.push(a),(n=(_=this._reporter).onStdOut)==null||n.call(_,a,m,l)):(l==null||l.stderr.push(a),(S=(f=this._reporter).onStdErr)==null||S.call(f,a,m,l))}async _onEnd(e){var t,s;await((s=(t=this._reporter).onEnd)==null?void 0:s.call(t,{status:e.status,startTime:new Date(e.startTime),duration:e.duration}))}_onExit(){var e,t;return(t=(e=this._reporter).onExit)==null?void 0:t.call(e)}_parseConfig(e){const t={...st,...e};return this._options.configOverrides&&(t.configFile=this._options.configOverrides.configFile,t.reportSlowTests=this._options.configOverrides.reportSlowTests,t.quiet=this._options.configOverrides.quiet,t.reporter=[...this._options.configOverrides.reporter]),t}_parseProject(e){return{metadata:e.metadata,name:e.name,outputDir:this._absolutePath(e.outputDir),repeatEach:e.repeatEach,retries:e.retries,testDir:this._absolutePath(e.testDir),testIgnore:Z(e.testIgnore),testMatch:Z(e.testMatch),timeout:e.timeout,grep:Z(e.grep),grepInvert:Z(e.grepInvert),dependencies:e.dependencies,teardown:e.teardown,snapshotDir:this._absolutePath(e.snapshotDir),use:{}}}_parseAttachments(e){return e.map(t=>({...t,body:t.base64&&globalThis.Buffer?Buffer.from(t.base64,"base64"):void 0}))}_mergeSuiteInto(e,t){let s=t.suites.find(r=>r.title===e.title);s||(s=new q(e.title,t.type==="project"?"file":"describe"),t._addSuite(s)),s.location=this._absoluteLocation(e.location),e.entries.forEach(r=>{"testId"in r?this._mergeTestInto(r,s):this._mergeSuiteInto(r,s)})}_mergeTestInto(e,t){let s=this._options.mergeTestCases?t.tests.find(r=>r.title===e.title&&r.repeatEachIndex===e.repeatEachIndex):void 0;s||(s=new Ze(e.testId,e.title,this._absoluteLocation(e.location),e.repeatEachIndex),t._addTest(s),this._tests.set(s.id,s)),this._updateTest(e,s)}_updateTest(e,t){return t.id=e.testId,t.location=this._absoluteLocation(e.location),t.retries=e.retries,t.tags=e.tags??[],t.annotations=e.annotations??[],t}_absoluteLocation(e){return e&&{...e,file:this._absolutePath(e.file)}}_absolutePath(e){if(e!==void 0)return this._options.resolvePath?this._options.resolvePath(this._rootDir,e):this._rootDir+"/"+e}}class q{constructor(e,t){this._entries=[],this._requireFile="",this._parallelMode="none",this.title=e,this._type=t}get type(){return this._type}get suites(){return this._entries.filter(e=>e.type!=="test")}get tests(){return this._entries.filter(e=>e.type==="test")}entries(){return this._entries}allTests(){const e=[],t=s=>{for(const r of s.entries())r.type==="test"?e.push(r):t(r)};return t(this),e}titlePath(){const e=this.parent?this.parent.titlePath():[];return(this.title||this._type!=="describe")&&e.push(this.title),e}project(){var e;return this._project??((e=this.parent)==null?void 0:e.project())}_addTest(e){e.parent=this,this._entries.push(e)}_addSuite(e){e.parent=this,this._entries.push(e)}}class Ze{constructor(e,t,s,r){this.fn=()=>{},this.results=[],this.type="test",this.expectedStatus="passed",this.timeout=0,this.annotations=[],this.retries=0,this.tags=[],this.repeatEachIndex=0,this.id=e,this.title=t,this.location=s,this.repeatEachIndex=r}titlePath(){const e=this.parent?this.parent.titlePath():[];return e.push(this.title),e}outcome(){return it(this)}ok(){const e=this.outcome();return e==="expected"||e==="flaky"||e==="skipped"}_createTestResult(e){const t=new tt(this.results.length,e);return this.results.push(t),t}}class et{constructor(e,t,s){this.duration=-1,this.steps=[],this._startTime=0,this.title=e.title,this.category=e.category,this.location=s,this.parent=t,this._startTime=e.startTime}titlePath(){var t;return[...((t=this.parent)==null?void 0:t.titlePath())||[],this.title]}get startTime(){return new Date(this._startTime)}set startTime(e){this._startTime=+e}}class tt{constructor(e,t){this.parallelIndex=-1,this.workerIndex=-1,this.duration=-1,this.stdout=[],this.stderr=[],this.attachments=[],this.status="skipped",this.steps=[],this.errors=[],this._stepMap=new Map,this._startTime=0,this.retry=e,this._id=t}setStartTimeNumber(e){this._startTime=e}get startTime(){return new Date(this._startTime)}set startTime(e){this._startTime=+e}}const st={forbidOnly:!1,fullyParallel:!1,globalSetup:null,globalTeardown:null,globalTimeout:0,grep:/.*/,grepInvert:null,maxFailures:0,metadata:{},preserveOutput:"always",projects:[],reporter:[[Je.CI?"dot":"list"]],reportSlowTests:{max:5,threshold:15e3},configFile:"",rootDir:"",quiet:!1,shard:null,updateSnapshots:"missing",version:"",workers:0,webServer:null};function Z(i){return i.map(e=>e.s!==void 0?e.s:new RegExp(e.r.source,e.r.flags))}function it(i){let e=0,t=0,s=0;for(const r of i.results)r.status==="interrupted"||(r.status==="skipped"&&i.expectedStatus==="skipped"?++e:r.status==="skipped"||(r.status===i.expectedStatus?++t:++s));return t===0&&s===0?"skipped":s===0?"expected":t===0&&e===0?"unexpected":"flaky"}class ie{constructor(e,t,s,r,c){this._treeItemById=new Map,this._treeItemByTestId=new Map;const a=r&&[...r.values()].some(Boolean);this.pathSeparator=c,this.rootItem={kind:"group",subKind:"folder",id:e,title:"",location:{file:"",line:0,column:0},duration:0,parent:void 0,children:[],status:"none",hasLoadErrors:!1},this._treeItemById.set(e,this.rootItem);const m=(l,_,n)=>{for(const f of _.suites){const S=f.title||"<anonymous>";let d=n.children.find(p=>p.kind==="group"&&p.title===S);d||(d={kind:"group",subKind:"describe",id:"suite:"+_.titlePath().join("")+""+S,title:S,location:f.location,duration:0,parent:n,children:[],status:"none",hasLoadErrors:!1},this._addChild(n,d)),m(l,f,d)}for(const f of _.tests){const S=f.title;let d=n.children.find(E=>E.kind!=="group"&&E.title===S);d||(d={kind:"case",id:"test:"+f.titlePath().join(""),title:S,parent:n,children:[],tests:[],location:f.location,duration:0,status:"none",project:void 0,test:void 0,tags:f.tags},this._addChild(n,d));const p=f.results[0];let x="none";(p==null?void 0:p[Y])==="scheduled"?x="scheduled":(p==null?void 0:p[Y])==="running"?x="running":(p==null?void 0:p.status)==="skipped"?x="skipped":(p==null?void 0:p.status)==="interrupted"?x="none":p&&f.outcome()!=="expected"?x="failed":p&&f.outcome()==="expected"&&(x="passed"),d.tests.push(f);const R={kind:"test",id:f.id,title:l.name,location:f.location,test:f,parent:d,children:[],status:x,duration:f.results.length?Math.max(0,f.results[0].duration):0,project:l};this._addChild(d,R),this._treeItemByTestId.set(f.id,R),d.duration=d.children.reduce((E,I)=>E+I.duration,0)}};for(const l of(t==null?void 0:t.suites)||[])if(!(a&&!r.get(l.title)))for(const _ of l.suites){const n=this._fileItem(_.location.file.split(c),!0);m(l.project(),_,n)}for(const l of s){if(!l.location)continue;const _=this._fileItem(l.location.file.split(c),!0);_.hasLoadErrors=!0}}_addChild(e,t){e.children.push(t),t.parent=e,this._treeItemById.set(t.id,t)}filterTree(e,t,s){const r=e.trim().toLowerCase().split(" "),c=[...t.values()].some(Boolean),a=l=>{const _=[...l.tests[0].titlePath(),...l.tests[0].tags].join(" ").toLowerCase();return!r.every(n=>_.includes(n))&&!l.tests.some(n=>s==null?void 0:s.has(n.id))?!1:(l.children=l.children.filter(n=>!c||(s==null?void 0:s.has(n.test.id))||t.get(n.status)),l.tests=l.children.map(n=>n.test),!!l.children.length)},m=l=>{const _=[];for(const n of l.children)n.kind==="case"?a(n)&&_.push(n):(m(n),(n.children.length||n.hasLoadErrors)&&_.push(n));l.children=_};m(this.rootItem)}_fileItem(e,t){if(e.length===0)return this.rootItem;const s=e.join(this.pathSeparator),r=this._treeItemById.get(s);if(r)return r;const c=this._fileItem(e.slice(0,e.length-1),!1),a={kind:"group",subKind:t?"file":"folder",id:s,title:e[e.length-1],location:{file:s,line:0,column:0},duration:0,parent:c,children:[],status:"none",hasLoadErrors:!1};return this._addChild(c,a),a}sortAndPropagateStatus(){_e(this.rootItem)}flattenForSingleProject(){const e=t=>{t.kind==="case"&&t.children.length===1?(t.project=t.children[0].project,t.test=t.children[0].test,t.children=[],this._treeItemByTestId.set(t.test.id,t)):t.children.forEach(e)};e(this.rootItem)}shortenRoot(){let e=this.rootItem;for(;e.children.length===1&&e.children[0].kind==="group"&&e.children[0].subKind==="folder";)e=e.children[0];e.location=this.rootItem.location,this.rootItem=e}testIds(){const e=new Set,t=s=>{s.kind==="case"&&s.tests.forEach(r=>e.add(r.id)),s.children.forEach(t)};return t(this.rootItem),e}fileNames(){const e=new Set,t=s=>{s.kind==="group"&&s.subKind==="file"?e.add(s.id):s.children.forEach(t)};return t(this.rootItem),[...e]}flatTreeItems(){const e=[],t=s=>{e.push(s),s.children.forEach(t)};return t(this.rootItem),e}treeItemById(e){return this._treeItemById.get(e)}collectTestIds(e){return e?rt(e):new Set}}function _e(i){for(const a of i.children)_e(a);i.kind==="group"&&i.children.sort((a,m)=>a.location.file.localeCompare(m.location.file)||a.location.line-m.location.line);let e=i.children.length>0,t=i.children.length>0,s=!1,r=!1,c=!1;for(const a of i.children)t=t&&a.status==="skipped",e=e&&(a.status==="passed"||a.status==="skipped"),s=s||a.status==="failed",r=r||a.status==="running",c=c||a.status==="scheduled";r?i.status="running":c?i.status="scheduled":s?i.status="failed":t?i.status="skipped":e&&(i.status="passed")}function rt(i){const e=new Set,t=s=>{var r;s.kind==="case"?s.tests.map(c=>c.id).forEach(c=>e.add(c)):s.kind==="test"?e.add(s.id):(r=s.children)==null||r.forEach(t)};return t(i),e}const Y=Symbol("statusEx");class ot{constructor(e){this.loadErrors=[],this.progress={total:0,passed:0,failed:0,skipped:0},this._lastRunTestCount=0,this._receiver=new se(this._createReporter(),{mergeProjects:!0,mergeTestCases:!0,resolvePath:(t,s)=>t+e.pathSeparator+s,clearPreviousResultsWhenTestBegins:!0}),this._options=e}_createReporter(){return{version:()=>"v2",onConfigure:e=>{this.config=e,this._lastRunReceiver=new se({version:()=>"v2",onBegin:t=>{this._lastRunTestCount=t.allTests().length,this._lastRunReceiver=void 0}},{mergeProjects:!0,mergeTestCases:!1,resolvePath:(t,s)=>t+this._options.pathSeparator+s})},onBegin:e=>{var t;if(this.rootSuite||(this.rootSuite=e),this._testResultsSnapshot){for(const s of this.rootSuite.allTests())s.results=((t=this._testResultsSnapshot)==null?void 0:t.get(s.id))||s.results;this._testResultsSnapshot=void 0}this.progress.total=this._lastRunTestCount,this.progress.passed=0,this.progress.failed=0,this.progress.skipped=0,this._options.onUpdate(!0)},onEnd:()=>{this._options.onUpdate(!0)},onTestBegin:(e,t)=>{t[Y]="running",this._options.onUpdate()},onTestEnd:(e,t)=>{e.outcome()==="skipped"?++this.progress.skipped:e.outcome()==="unexpected"?++this.progress.failed:++this.progress.passed,t[Y]=t.status,this._options.onUpdate()},onError:e=>this._handleOnError(e),printsToStdio:()=>!1}}processGlobalReport(e){const t=new se({version:()=>"v2",onConfigure:s=>{this.config=s},onError:s=>this._handleOnError(s)});for(const s of e)t.dispatch(s)}processListReport(e){var s;const t=((s=this.rootSuite)==null?void 0:s.allTests())||[];this._testResultsSnapshot=new Map(t.map(r=>[r.id,r.results])),this._receiver.reset();for(const r of e)this._receiver.dispatch(r)}processTestReportEvent(e){var t,s,r;(s=(t=this._lastRunReceiver)==null?void 0:t.dispatch(e))==null||s.catch(()=>{}),(r=this._receiver.dispatch(e))==null||r.catch(()=>{})}_handleOnError(e){var t,s;this.loadErrors.push(e),(s=(t=this._options).onError)==null||s.call(t,e),this._options.onUpdate()}asModel(){return{rootSuite:this.rootSuite||new q("","root"),config:this.config,loadErrors:this.loadErrors,progress:this.progress}}}const nt=({source:i})=>{const[e,t]=Me(),[s,r]=V.useState(De()),[c]=V.useState(Le(()=>import("./assets/xtermModule-BeNbaIVa.js"),__vite__mapDeps([0,1]),import.meta.url).then(m=>m.default)),a=V.useRef(null);return V.useEffect(()=>(Fe(r),()=>Oe(r)),[]),V.useEffect(()=>{const m=i.write,l=i.clear;return(async()=>{const{Terminal:_,FitAddon:n}=await c,f=t.current;if(!f)return;const S=s==="dark-mode"?lt:at;if(a.current&&a.current.terminal.options.theme===S)return;a.current&&(f.textContent="");const d=new _({convertEol:!0,fontSize:13,scrollback:1e4,fontFamily:"var(--vscode-editor-font-family)",theme:S}),p=new n;d.loadAddon(p);for(const x of i.pending)d.write(x);i.write=x=>{i.pending.push(x),d.write(x)},i.clear=()=>{i.pending=[],d.clear()},d.open(f),p.fit(),a.current={terminal:d,fitAddon:p}})(),()=>{i.clear=l,i.write=m}},[c,a,t,i,s]),V.useEffect(()=>{setTimeout(()=>{a.current&&(a.current.fitAddon.fit(),i.resize(a.current.terminal.cols,a.current.terminal.rows))},250)},[e,i]),o.jsx("div",{"data-testid":"output",className:"xterm-wrapper",style:{flex:"auto"},ref:t})},at={foreground:"#383a42",background:"#fafafa",cursor:"#383a42",black:"#000000",red:"#e45649",green:"#50a14f",yellow:"#c18401",blue:"#4078f2",magenta:"#a626a4",cyan:"#0184bc",white:"#a0a0a0",brightBlack:"#000000",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#d19a66",brightBlue:"#4078f2",brightMagenta:"#a626a4",brightCyan:"#0184bc",brightWhite:"#383a42",selectionBackground:"#d7d7d7",selectionForeground:"#383a42"},lt={foreground:"#f8f8f2",background:"#1e1e1e",cursor:"#f8f8f0",black:"#000000",red:"#ff5555",green:"#50fa7b",yellow:"#f1fa8c",blue:"#bd93f9",magenta:"#ff79c6",cyan:"#8be9fd",white:"#bfbfbf",brightBlack:"#4d4d4d",brightRed:"#ff6e6e",brightGreen:"#69ff94",brightYellow:"#ffffa5",brightBlue:"#d6acff",brightMagenta:"#ff92df",brightCyan:"#a4ffff",brightWhite:"#e6e6e6",selectionBackground:"#44475a",selectionForeground:"#f8f8f2"},ct=({filterText:i,setFilterText:e,statusFilters:t,setStatusFilters:s,projectFilters:r,setProjectFilters:c,testModel:a,runTests:m})=>{const[l,_]=h.useState(!1),n=h.useRef(null);h.useEffect(()=>{var d;(d=n.current)==null||d.focus()},[]);const f=[...t.entries()].filter(([d,p])=>p).map(([d])=>d).join(" ")||"all",S=[...r.entries()].filter(([d,p])=>p).map(([d])=>d).join(" ")||"all";return o.jsxs("div",{className:"filters",children:[o.jsx(Ye,{expanded:l,setExpanded:_,title:o.jsx("input",{ref:n,type:"search",placeholder:"Filter (e.g. text, @tag)",spellCheck:!1,value:i,onChange:d=>{e(d.target.value)},onKeyDown:d=>{d.key==="Enter"&&m()}})}),o.jsxs("div",{className:"filter-summary",title:"Status: "+f+`
3
3
  Projects: `+S,onClick:()=>_(!l),children:[o.jsx("span",{className:"filter-label",children:"Status:"})," ",f,o.jsx("span",{className:"filter-label",children:"Projects:"})," ",S]}),l&&o.jsxs("div",{className:"hbox",style:{marginLeft:14,maxHeight:200,overflowY:"auto"},children:[o.jsx("div",{className:"filter-list",children:[...t.entries()].map(([d,p])=>o.jsx("div",{className:"filter-entry",children:o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:p,onClick:()=>{const x=new Map(t);x.set(d,!x.get(d)),s(x)}}),o.jsx("div",{children:d})]})},d))}),o.jsx("div",{className:"filter-list",children:[...r.entries()].map(([d,p])=>o.jsx("div",{className:"filter-entry",children:o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:p,onClick:()=>{var E;const x=new Map(r);x.set(d,!x.get(d)),c(x);const R=(E=a==null?void 0:a.config)==null?void 0:E.configFile;R&&me.setObject(R+":projects",[...x.entries()].filter(([I,W])=>W).map(([I])=>I))}}),o.jsx("div",{children:d||"untitled"})]})},d))})]})]})},dt=({tag:i,style:e,onClick:t})=>o.jsx("span",{className:re("tag",`tag-color-${ut(i)}`),onClick:t,style:{margin:"6px 0 0 6px",...e},title:`Click to filter by tag: ${i}`,children:i});function ut(i){let e=0;for(let t=0;t<i.length;t++)e=i.charCodeAt(t)+((e<<8)-e);return Math.abs(e%6)}const ht=Xe,ft=({filterText:i,testModel:e,testServerConnection:t,testTree:s,runTests:r,runningState:c,watchAll:a,watchedTreeIds:m,setWatchedTreeIds:l,isLoading:_,onItemSelected:n,requestedCollapseAllCount:f,setFilterText:S,onRevealSource:d})=>{const[p,x]=h.useState({expandedItems:new Map}),[R,E]=h.useState(),[I,W]=h.useState(f);h.useEffect(()=>{if(I!==f){p.expandedItems.clear();for(const b of s.flatTreeItems())p.expandedItems.set(b.id,!1);W(f),E(void 0),x({...p});return}if(!c||c.itemSelectedByUser)return;let u;const B=b=>{var L;b.children.forEach(B),!u&&b.status==="failed"&&(b.kind==="test"&&c.testIds.has(b.test.id)||b.kind==="case"&&c.testIds.has((L=b.tests[0])==null?void 0:L.id))&&(u=b)};B(s.rootItem),u&&E(u.id)},[c,E,s,I,W,f,p,x]);const{selectedTreeItem:D}=h.useMemo(()=>{if(!e)return{selectedTreeItem:void 0};const u=R?s.treeItemById(R):void 0,B=pt(u,e);let b;return(u==null?void 0:u.kind)==="test"?b=u.test:(u==null?void 0:u.kind)==="case"&&u.tests.length===1&&(b=u.tests[0]),n({treeItem:u,testCase:b,testFile:B}),{selectedTreeItem:u}},[n,R,e,s]);h.useEffect(()=>{if(!_)if(a)t==null||t.watchNoReply({fileNames:s.fileNames()});else{const u=new Set;for(const B of m.value){const b=s.treeItemById(B),L=b==null?void 0:b.location.file;L&&u.add(L)}t==null||t.watchNoReply({fileNames:[...u]})}},[_,s,a,m,t]);const K=u=>{E(u.id),r("bounce-if-busy",s.collectTestIds(u))},N=(u,B)=>{if(u.preventDefault(),u.stopPropagation(),u.metaKey||u.ctrlKey){const b=i.split(" ");b.includes(B)?S(b.filter(L=>L!==B).join(" ").trim()):S((i+" "+B).trim())}else S((i.split(" ").filter(b=>!b.startsWith("@")).join(" ")+" "+B).trim())};return o.jsx(ht,{name:"tests",treeState:p,setTreeState:x,rootItem:s.rootItem,dataTestId:"test-tree",render:u=>o.jsxs("div",{className:"hbox ui-mode-list-item",children:[o.jsxs("div",{className:"ui-mode-list-item-title",children:[o.jsx("span",{title:u.title,children:u.title}),u.kind==="case"?u.tags.map(B=>o.jsx(dt,{tag:B.slice(1),onClick:b=>N(b,B)},B)):null]}),!!u.duration&&u.status!=="skipped"&&o.jsx("div",{className:"ui-mode-list-item-time",children:We(u.duration)}),o.jsxs($,{noMinHeight:!0,noShadow:!0,children:[o.jsx(M,{icon:"play",title:"Run",onClick:()=>K(u),disabled:!!c&&!c.completed}),o.jsx(M,{icon:"go-to-file",title:"Show source",onClick:d,style:u.kind==="group"&&u.subKind==="folder"?{visibility:"hidden"}:{}}),!a&&o.jsx(M,{icon:"eye",title:"Watch",onClick:()=>{m.value.has(u.id)?m.value.delete(u.id):m.value.add(u.id),l({...m})},toggled:m.value.has(u.id)})]})]}),icon:u=>Qe(u.status),selectedItem:D,onAccepted:K,onSelected:u=>{c&&(c.itemSelectedByUser=!0),E(u.id)},isError:u=>u.kind==="group"?u.hasLoadErrors:!1,autoExpandDepth:i?5:1,noItemsMessage:_?"Loading…":"No tests"})};function pt(i,e){if(!(!i||!e))return{file:i.location.file,line:i.location.line,column:i.location.column,source:{errors:e.loadErrors.filter(t=>{var s;return((s=t.location)==null?void 0:s.file)===i.location.file}).map(t=>({line:t.location.line,message:t.message})),content:void 0}}}function gt(i){return`.playwright-artifacts-${i}`}const mt=({item:i,rootDir:e,onOpenExternally:t,revealSource:s,pathSeparator:r})=>{var f,S;const[c,a]=h.useState(),[m,l]=h.useState(0),_=h.useRef(null),{outputDir:n}=h.useMemo(()=>({outputDir:i.testCase?_t(i.testCase):void 0}),[i]);return h.useEffect(()=>{var R,E;_.current&&clearTimeout(_.current);const d=(R=i.testCase)==null?void 0:R.results[0];if(!d){a(void 0);return}const p=d&&d.duration>=0&&d.attachments.find(I=>I.name==="trace");if(p&&p.path){fe(p.path).then(I=>a({model:I,isLive:!1}));return}if(!n){a(void 0);return}const x=[n,gt(d.workerIndex),"traces",`${(E=i.testCase)==null?void 0:E.id}.json`].join(r);return _.current=setTimeout(async()=>{try{const I=await fe(x);a({model:I,isLive:!0})}catch{a(void 0)}finally{l(m+1)}},500),()=>{_.current&&clearTimeout(_.current)}},[n,i,a,m,l,r]),o.jsx(Ge,{model:c==null?void 0:c.model,showSourcesFirst:!0,rootDir:e,fallbackLocation:i.testFile,isLive:c==null?void 0:c.isLive,status:(f=i.treeItem)==null?void 0:f.status,annotations:((S=i.testCase)==null?void 0:S.annotations)||[],onOpenExternally:t,revealSource:s},"workbench")},_t=i=>{var e;for(let t=i.parent;t;t=t.parent)if(t.project())return(e=t.project())==null?void 0:e.outputDir};async function fe(i){const e=new URLSearchParams;e.set("trace",i),e.set("limit","1");const s=await(await fetch(`contexts?${e.toString()}`)).json();return new Ue(s)}const wt=({settings:i})=>o.jsx("div",{className:"vbox settings-view",children:i.map(({value:e,set:t,title:s})=>o.jsx("div",{className:"setting",children:o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:e,onClick:()=>t(!e)}),s]})},s))});let pe={cols:80,rows:24};const A={pending:[],clear:()=>{},write:i=>A.pending.push(i),resize:()=>{}},O=new URLSearchParams(window.location.search),vt=O.get("ws"),we=new URL(`../${vt}`,window.location.toString());we.protocol=window.location.protocol==="https:"?"wss:":"ws:";const y={args:O.getAll("arg"),grep:O.get("grep")||void 0,grepInvert:O.get("grepInvert")||void 0,projects:O.getAll("project"),workers:O.get("workers")||void 0,headed:O.has("headed"),updateSnapshots:O.get("updateSnapshots")||void 0,reporters:O.has("reporter")?O.getAll("reporter"):void 0,pathSeparator:O.get("pathSeparator")||"/"};y.updateSnapshots&&!["all","none","missing"].includes(y.updateSnapshots)&&(y.updateSnapshots=void 0);const ge=navigator.platform==="MacIntel",St=({})=>{var he;const[i,e]=h.useState(""),[t,s]=h.useState(!1),[r,c]=h.useState(!1),[a,m]=h.useState(new Map([["passed",!1],["failed",!1],["skipped",!1]])),[l,_]=h.useState(new Map),[n,f]=h.useState(),[S,d]=h.useState(),[p,x]=h.useState({}),[R,E]=h.useState(new Set),[I,W]=h.useState(!1),[D,K]=h.useState(),N=D&&!D.completed,[u,B]=Ae("watch-all",!1),[b,L]=h.useState({value:new Set}),H=h.useRef(Promise.resolve()),Q=h.useRef(new Set),[oe,ve]=h.useState(0),[Se,xe]=h.useState(!1),[ne,ae]=h.useState(!0),[v,be]=h.useState(),[X,Te]=h.useState(),[G,ke]=h.useState(!1);h.useState(!1);const[je,le]=h.useState(!1),ye=h.useCallback(()=>le(!0),[le]),Ee=!1,[ce,xt]=h.useState(!1),[de,bt]=h.useState(!1),[ue,Tt]=h.useState(!1),[Ie,Re]=ze(),Be=h.useRef(null),J=h.useCallback(()=>{be(new $e(new qe(we)))},[]);h.useEffect(()=>{var w;(w=Be.current)==null||w.focus(),W(!0),J()},[J]),h.useEffect(()=>{if(!v)return;const w=[v.onStdio(g=>{if(g.buffer){const T=atob(g.buffer);A.write(T)}else A.write(g.text);g.type==="stderr"&&c(!0)}),v.onClose(()=>xe(!0))];return A.resize=(g,T)=>{pe={cols:g,rows:T},v.resizeTerminalNoReply({cols:g,rows:T})},()=>{for(const g of w)g.dispose()}},[v]),h.useEffect(()=>{if(!v)return;let w;const g=new ot({onUpdate:T=>{clearTimeout(w),w=void 0,T?f(g.asModel()):w||(w=setTimeout(()=>{f(g.asModel())},250))},onError:T=>{A.write((T.stack||T.value||"")+`
4
4
  `),c(!0)},pathSeparator:y.pathSeparator});return Te(g),f(void 0),W(!0),L({value:new Set}),(async()=>{try{await v.initialize({interceptStdio:!0,watchTestDirs:!0});const{status:T,report:j}=await v.runGlobalSetup({});if(g.processGlobalReport(j),T!=="passed")return;const C=await v.listTests({projects:y.projects,locations:y.args,grep:y.grep,grepInvert:y.grepInvert});g.processListReport(C.report),v.onReport(P=>{g.processTestReportEvent(P)});const{hasBrowsers:F}=await v.checkBrowsers({});ae(F)}finally{W(!1)}})(),()=>{clearTimeout(w)}},[v]),h.useEffect(()=>{if(!n)return;const{config:w,rootSuite:g}=n,T=w.configFile?me.getObject(w.configFile+":projects",void 0):void 0,j=new Map(l);for(const C of j.keys())g.suites.find(F=>F.title===C)||j.delete(C);for(const C of g.suites)j.has(C.title)||j.set(C.title,!!(T!=null&&T.includes(C.title)));!T&&j.size&&![...j.values()].includes(!0)&&j.set(j.entries().next().value[0],!0),(l.size!==j.size||[...l].some(([C,F])=>j.get(C)!==F))&&_(j)},[l,n]),h.useEffect(()=>{N&&(n!=null&&n.progress)?d(n.progress):n||d(void 0)},[n,N]);const{testTree:Ce}=h.useMemo(()=>{if(!n)return{testTree:new ie("",new q("","root"),[],l,y.pathSeparator)};const w=new ie("",n.rootSuite,n.loadErrors,l,y.pathSeparator);return w.filterTree(i,a,N?D==null?void 0:D.testIds:void 0),w.sortAndPropagateStatus(),w.shortenRoot(),w.flattenForSingleProject(),E(w.testIds()),{testTree:w}},[i,n,a,l,E,D,N]),z=h.useCallback((w,g)=>{!v||!n||w==="bounce-if-busy"&&N||(Q.current=new Set([...Q.current,...g]),H.current=H.current.then(async()=>{var C,F,P;const T=Q.current;if(Q.current=new Set,!T.size)return;{for(const k of((C=n.rootSuite)==null?void 0:C.allTests())||[])if(T.has(k.id)){k.results=[];const U=k._createTestResult("pending");U[Y]="scheduled"}f({...n})}const j=" ["+new Date().toLocaleTimeString()+"]";A.write("\x1B[2m—".repeat(Math.max(0,pe.cols-j.length))+j+"\x1B[22m"),d({total:0,passed:0,failed:0,skipped:0}),K({testIds:T}),await v.runTests({locations:y.args,grep:y.grep,grepInvert:y.grepInvert,testIds:[...T],projects:[...l].filter(([k,U])=>U).map(([k])=>k),...ce?{workers:"1"}:{},...de?{headed:!0}:{},...ue?{updateSnapshots:"all"}:{},reporters:y.reporters,trace:"on"});for(const k of((F=n.rootSuite)==null?void 0:F.allTests())||[])((P=k.results[0])==null?void 0:P.duration)===-1&&(k.results=[]);f({...n}),K(k=>k?{...k,completed:!0}:void 0)}))},[l,N,n,v,ce,de,ue]);h.useEffect(()=>{if(!v||!X)return;const w=v.onTestFilesChanged(async g=>{if(H.current=H.current.then(async()=>{W(!0);try{const P=await v.listTests({projects:y.projects,locations:y.args,grep:y.grep,grepInvert:y.grepInvert});X.processListReport(P.report)}catch(P){console.log(P)}finally{W(!1)}}),await H.current,g.testFiles.length===0)return;const T=X.asModel(),j=new ie("",T.rootSuite,T.loadErrors,l,y.pathSeparator),C=[],F=new Set(g.testFiles);if(u){const P=k=>{const U=k.location.file;U&&F.has(U)&&C.push(...j.collectTestIds(k)),k.kind==="group"&&k.subKind==="folder"&&k.children.forEach(P)};P(j.rootItem)}else for(const P of b.value){const k=j.treeItemById(P),U=k==null?void 0:k.location.file;U&&F.has(U)&&C.push(...j.collectTestIds(k))}z("queue-if-busy",new Set(C))});return()=>w.dispose()},[z,v,u,b,X,l]),h.useEffect(()=>{if(!v)return;const w=g=>{g.code==="Backquote"&&g.ctrlKey?(g.preventDefault(),s(!t)):g.code==="F5"&&g.shiftKey?(g.preventDefault(),v==null||v.stopTestsNoReply({})):g.code==="F5"&&(g.preventDefault(),z("bounce-if-busy",R))};return addEventListener("keydown",w),()=>{removeEventListener("keydown",w)}},[z,J,v,R,t]);const ee=h.useRef(null),Ne=h.useCallback(w=>{var g;w.preventDefault(),w.stopPropagation(),(g=ee.current)==null||g.showModal()},[]),te=h.useCallback(w=>{var g;w.preventDefault(),w.stopPropagation(),(g=ee.current)==null||g.close()},[]),Pe=h.useCallback(w=>{te(w),s(!0),v==null||v.installBrowsers({}).then(async()=>{s(!1);const{hasBrowsers:g}=await(v==null?void 0:v.checkBrowsers({}));ae(g)})},[te,v]);return o.jsxs("div",{className:"vbox ui-mode",children:[!ne&&o.jsxs("dialog",{ref:ee,children:[o.jsxs("div",{className:"title",children:[o.jsx("span",{className:"codicon codicon-lightbulb"}),"Install browsers"]}),o.jsxs("div",{className:"body",children:["Playwright did not find installed browsers.",o.jsx("br",{}),"Would you like to run `playwright install`?",o.jsx("br",{}),o.jsx("button",{className:"button",onClick:Pe,children:"Install"}),o.jsx("button",{className:"button secondary",onClick:te,children:"Dismiss"})]})]}),Se&&o.jsxs("div",{className:"disconnected",children:[o.jsx("div",{className:"title",children:"UI Mode disconnected"}),o.jsxs("div",{children:[o.jsx("a",{href:"#",onClick:()=>window.location.href="/",children:"Reload the page"})," to reconnect"]})]}),o.jsx(Ve,{sidebarSize:250,minSidebarSize:150,orientation:"horizontal",sidebarIsFirst:!0,settingName:"testListSidebar",main:o.jsxs("div",{className:"vbox",children:[o.jsxs("div",{className:re("vbox",!t&&"hidden"),children:[o.jsxs($,{children:[o.jsx("div",{className:"section-title",style:{flex:"none"},children:"Output"}),o.jsx(M,{icon:"circle-slash",title:"Clear output",onClick:()=>{A.clear(),c(!1)}}),o.jsx("div",{className:"spacer"}),o.jsx(M,{icon:"close",title:"Close",onClick:()=>s(!1)})]}),o.jsx(nt,{source:A})]}),o.jsx("div",{className:re("vbox",t&&"hidden"),children:o.jsx(mt,{pathSeparator:y.pathSeparator,item:p,rootDir:(he=n==null?void 0:n.config)==null?void 0:he.rootDir,revealSource:je,onOpenExternally:w=>v==null?void 0:v.openNoReply({location:{file:w.file,line:w.line,column:w.column}})})})]}),sidebar:o.jsxs("div",{className:"vbox ui-mode-sidebar",children:[o.jsxs($,{noShadow:!0,noMinHeight:!0,children:[o.jsx("img",{src:"playwright-logo.svg",alt:"Playwright logo"}),o.jsx("div",{className:"section-title",children:"Playwright"}),o.jsx(M,{icon:"refresh",title:"Reload",onClick:()=>J(),disabled:N||I}),o.jsxs("div",{style:{position:"relative"},children:[o.jsx(M,{icon:"terminal",title:"Toggle output — "+(ge?"⌃`":"Ctrl + `"),toggled:t,onClick:()=>{s(!t)}}),r&&o.jsx("div",{title:"Output contains error",style:{position:"absolute",top:2,right:2,width:7,height:7,borderRadius:"50%",backgroundColor:"var(--vscode-notificationsErrorIcon-foreground)"}})]}),!ne&&o.jsx(M,{icon:"lightbulb-autofix",style:{color:"var(--vscode-list-warningForeground)"},title:"Playwright browsers are missing",onClick:Ne})]}),o.jsx(ct,{filterText:i,setFilterText:e,statusFilters:a,setStatusFilters:m,projectFilters:l,setProjectFilters:_,testModel:n,runTests:()=>z("bounce-if-busy",R)}),o.jsxs($,{noMinHeight:!0,children:[!N&&!S&&o.jsx("div",{className:"section-title",children:"Tests"}),!N&&S&&o.jsx("div",{"data-testid":"status-line",className:"status-line",children:o.jsxs("div",{children:[S.passed,"/",S.total," passed (",S.passed/S.total*100|0,"%)"]})}),N&&S&&o.jsx("div",{"data-testid":"status-line",className:"status-line",children:o.jsxs("div",{children:["Running ",S.passed,"/",D.testIds.size," passed (",S.passed/D.testIds.size*100|0,"%)"]})}),o.jsx(M,{icon:"play",title:"Run all — F5",onClick:()=>z("bounce-if-busy",R),disabled:N||I}),o.jsx(M,{icon:"debug-stop",title:"Stop — "+(ge?"⇧F5":"Shift + F5"),onClick:()=>v==null?void 0:v.stopTests({}),disabled:!N||I}),o.jsx(M,{icon:"eye",title:"Watch all",toggled:u,onClick:()=>{L({value:new Set}),B(!u)}}),o.jsx(M,{icon:"collapse-all",title:"Collapse all",onClick:()=>{ve(oe+1)}})]}),o.jsx(ft,{filterText:i,testModel:n,testTree:Ce,testServerConnection:v,runningState:D,runTests:z,onItemSelected:x,watchAll:u,watchedTreeIds:b,setWatchedTreeIds:L,isLoading:I,requestedCollapseAllCount:oe,setFilterText:e,onRevealSource:ye}),Ee,o.jsxs($,{noShadow:!0,noMinHeight:!0,className:"settings-toolbar",onClick:()=>ke(!G),children:[o.jsx("span",{className:`codicon codicon-${G?"chevron-down":"chevron-right"}`,style:{marginLeft:5},title:G?"Hide Settings":"Show Settings"}),o.jsx("div",{className:"section-title",children:"Settings"})]}),G&&o.jsx(wt,{settings:[{value:Ie,set:Re,title:"Dark mode"}]})]})})]})};(async()=>{if(Ke(),window.location.protocol!=="file:"){if(window.location.href.includes("isUnderTest=true")&&await new Promise(i=>setTimeout(i,1e3)),!navigator.serviceWorker)throw new Error(`Service workers are not supported.
5
5
  Make sure to serve the website (${window.location}) via HTTPS or localhost.`);navigator.serviceWorker.register("sw.bundle.js"),navigator.serviceWorker.controller||await new Promise(i=>{navigator.serviceWorker.oncontrollerchange=()=>i()}),setInterval(function(){fetch("ping")},1e4)}He(document.querySelector("#root")).render(o.jsx(St,{}))})();