const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./assets/xtermModule-CsJ4vdCR.js","./xtermModule.DYP7pi_n.css"])))=>i.map(i=>d[i]); import"./assets/urlMatch-BYQrIQwR.js";import{u as Ht,r as H,g as qt,_ as Yt,h as Qt,i as Xt,j as o,R as d,E as Jt,s as Rt,k as vt,l as Zt,t as Gt,m as te,n as Y,o as M,T as Bt,c as ee,p as q,a as se,W as ie,S as ne,q as oe,b as re,e as ae,f as le}from"./assets/defaultSettingsView-BNmKHKpQ.js";var ce={};class mt{constructor(t,e={}){this.isListing=!1,this._tests=new Map,this._rootSuite=new tt("","root"),this._options=e,this._reporter=t}reset(){this._rootSuite._entries=[],this._tests.clear()}dispatch(t){const{method:e,params:s}=t;if(e==="onConfigure"){this._onConfigure(s.config);return}if(e==="onProject"){this._onProject(s.project);return}if(e==="onBegin"){this._onBegin();return}if(e==="onTestBegin"){this._onTestBegin(s.testId,s.result);return}if(e==="onTestPaused"){this._onTestPaused(s.testId,s.resultId,s.errors);return}if(e==="onTestEnd"){this._onTestEnd(s.test,s.result);return}if(e==="onStepBegin"){this._onStepBegin(s.testId,s.resultId,s.step);return}if(e==="onAttach"){this._onAttach(s.testId,s.resultId,s.attachments);return}if(e==="onStepEnd"){this._onStepEnd(s.testId,s.resultId,s.step);return}if(e==="onError"){this._onError(s.error,s.workerInfo);return}if(e==="onStdIO"){this._onStdIO(s.type,s.testId,s.resultId,s.data,s.isBase64);return}if(e==="onEnd")return this._onEnd(s.result);if(e==="onExit")return this._onExit()}_onConfigure(t){var e,s;this._rootDir=t.rootDir,this._config=this._parseConfig(t),(s=(e=this._reporter).onConfigure)==null||s.call(e,this._config)}_onProject(t){let e=this._options.mergeProjects?this._rootSuite.suites.find(r=>r.project().name===t.name):void 0;e||(e=new tt(t.name,"project"),this._rootSuite._addSuite(e));const s=this._parseProject(t);e._project=s;let n=-1;this._options.mergeProjects&&(n=this._config.projects.findIndex(r=>r.name===t.name)),n===-1?this._config.projects.push(s):this._config.projects[n]=s;for(const r of t.suites)this._mergeSuiteInto(r,e)}_onBegin(){var t,e;(e=(t=this._reporter).onBegin)==null||e.call(t,this._rootSuite)}_onTestBegin(t,e){var r,a;const s=this._tests.get(t);this._options.clearPreviousResultsWhenTestBegins&&(s.results=[]);const n=s._createTestResult(e.id);n.retry=e.retry,n.workerIndex=e.workerIndex,n.parallelIndex=e.parallelIndex,n.setStartTimeNumber(e.startTime),(a=(r=this._reporter).onTestBegin)==null||a.call(r,s,n)}_onTestPaused(t,e,s){var a,p;const n=this._tests.get(t),r=n.results.find(c=>c._id===e);r.errors.push(...s),r.error=r.errors[0],(p=(a=this._reporter).onTestPaused)==null||p.call(a,n,r)}_onTestEnd(t,e){var r,a;const s=this._tests.get(t.testId);s.timeout=t.timeout,s.expectedStatus=t.expectedStatus;const n=s.results.find(p=>p._id===e.id);n.duration=e.duration,n.status=e.status,n.errors.push(...e.errors??[]),n.error=n.errors[0],e.attachments&&(n.attachments=this._parseAttachments(e.attachments)),e.annotations&&(this._absoluteAnnotationLocationsInplace(e.annotations),n.annotations=e.annotations,s.annotations=e.annotations),(a=(r=this._reporter).onTestEnd)==null||a.call(r,s,n),n._stepMap=new Map}_onStepBegin(t,e,s){var g,l;const n=this._tests.get(t),r=n.results.find(w=>w._id===e),a=s.parentStepId?r._stepMap.get(s.parentStepId):void 0,p=this._absoluteLocation(s.location),c=new ue(s,a,p,r);a?a.steps.push(c):r.steps.push(c),r._stepMap.set(s.id,c),(l=(g=this._reporter).onStepBegin)==null||l.call(g,n,r,c)}_onStepEnd(t,e,s){var p,c;const n=this._tests.get(t),r=n.results.find(g=>g._id===e),a=r._stepMap.get(s.id);a._endPayload=s,a.duration=s.duration,a.error=s.error,(c=(p=this._reporter).onStepEnd)==null||c.call(p,n,r,a)}_onAttach(t,e,s){this._tests.get(t).results.find(a=>a._id===e).attachments.push(...s.map(a=>({name:a.name,contentType:a.contentType,path:a.path,body:a.base64&&globalThis.Buffer?Buffer.from(a.base64,"base64"):void 0})))}_onError(t,e){var n,r;let s;if(e){const a=this._config.projects.find(p=>p.name===e.projectName);a&&(s={workerIndex:e.workerIndex,parallelIndex:e.parallelIndex,config:this._config,project:a})}(r=(n=this._reporter).onError)==null||r.call(n,t,s)}_onStdIO(t,e,s,n,r){var g,l,w,k;const a=r?globalThis.Buffer?Buffer.from(n,"base64"):atob(n):n,p=e?this._tests.get(e):void 0,c=p&&s?p.results.find(h=>h._id===s):void 0;t==="stdout"?(c==null||c.stdout.push(a),(l=(g=this._reporter).onStdOut)==null||l.call(g,a,p,c)):(c==null||c.stderr.push(a),(k=(w=this._reporter).onStdErr)==null||k.call(w,a,p,c))}async _onEnd(t){var e,s;await((s=(e=this._reporter).onEnd)==null?void 0:s.call(e,ge(t)))}_onExit(){var t,e;return(e=(t=this._reporter).onExit)==null?void 0:e.call(t)}_parseConfig(t){const e=me(t);return this._options.configOverrides&&(e.configFile=this._options.configOverrides.configFile,e.reportSlowTests=this._options.configOverrides.reportSlowTests,e.quiet=this._options.configOverrides.quiet,e.reporter=[...this._options.configOverrides.reporter]),e}_parseProject(t){return{metadata:t.metadata,name:t.name,outputDir:this._absolutePath(t.outputDir),repeatEach:t.repeatEach,retries:t.retries,testDir:this._absolutePath(t.testDir),testIgnore:ct(t.testIgnore),testMatch:ct(t.testMatch),timeout:t.timeout,grep:ct(t.grep),grepInvert:ct(t.grepInvert),dependencies:t.dependencies,teardown:t.teardown,snapshotDir:this._absolutePath(t.snapshotDir),ignoreSnapshots:t.ignoreSnapshots??!1,use:t.use}}_parseAttachments(t){return t.map(e=>({...e,body:e.base64&&globalThis.Buffer?Buffer.from(e.base64,"base64"):void 0}))}_mergeSuiteInto(t,e){let s=e.suites.find(n=>n.title===t.title);s||(s=new tt(t.title,e.type==="project"?"file":"describe"),e._addSuite(s)),s.location=this._absoluteLocation(t.location),t.entries.forEach(n=>{"testId"in n?this._mergeTestInto(n,s):this._mergeSuiteInto(n,s)})}_mergeTestInto(t,e){let s=this._options.mergeTestCases?e.tests.find(n=>n.title===t.title&&n.repeatEachIndex===t.repeatEachIndex):void 0;s||(s=new de(t.testId,t.title,this._absoluteLocation(t.location),t.repeatEachIndex),e._addTest(s),this._tests.set(s.id,s)),this._updateTest(t,s)}_updateTest(t,e){return e.id=t.testId,e.location=this._absoluteLocation(t.location),e.retries=t.retries,e.tags=t.tags??[],e.annotations=t.annotations??[],this._absoluteAnnotationLocationsInplace(e.annotations),e}_absoluteAnnotationLocationsInplace(t){for(const e of t)e.location&&(e.location=this._absoluteLocation(e.location))}_absoluteLocation(t){return t&&{...t,file:this._absolutePath(t.file)}}_absolutePath(t){if(t!==void 0)return this._options.resolvePath?this._options.resolvePath(this._rootDir,t):this._rootDir+"/"+t}}class tt{constructor(t,e){this._entries=[],this._requireFile="",this._parallelMode="none",this.title=t,this._type=e}get type(){return this._type}get suites(){return this._entries.filter(t=>t.type!=="test")}get tests(){return this._entries.filter(t=>t.type==="test")}entries(){return this._entries}allTests(){const t=[],e=s=>{for(const n of s.entries())n.type==="test"?t.push(n):e(n)};return e(this),t}titlePath(){const t=this.parent?this.parent.titlePath():[];return(this.title||this._type!=="describe")&&t.push(this.title),t}project(){var t;return this._project??((t=this.parent)==null?void 0:t.project())}_addTest(t){t.parent=this,this._entries.push(t)}_addSuite(t){t.parent=this,this._entries.push(t)}}class de{constructor(t,e,s,n){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=t,this.title=e,this.location=s,this.repeatEachIndex=n}titlePath(){const t=this.parent?this.parent.titlePath():[];return t.push(this.title),t}outcome(){return pe(this)}ok(){const t=this.outcome();return t==="expected"||t==="flaky"||t==="skipped"}_createTestResult(t){const e=new he(this.results.length,t);return this.results.push(e),e}}class ue{constructor(t,e,s,n){this.duration=-1,this.steps=[],this._startTime=0,this.title=t.title,this.category=t.category,this.location=s,this.parent=e,this._startTime=t.startTime,this._result=n}titlePath(){var e;return[...((e=this.parent)==null?void 0:e.titlePath())||[],this.title]}get startTime(){return new Date(this._startTime)}set startTime(t){this._startTime=+t}get attachments(){var t,e;return((e=(t=this._endPayload)==null?void 0:t.attachments)==null?void 0:e.map(s=>this._result.attachments[s]))??[]}get annotations(){var t;return((t=this._endPayload)==null?void 0:t.annotations)??[]}}class he{constructor(t,e){this.parallelIndex=-1,this.workerIndex=-1,this.duration=-1,this.stdout=[],this.stderr=[],this.attachments=[],this.annotations=[],this.status="skipped",this.steps=[],this.errors=[],this._stepMap=new Map,this._startTime=0,this.retry=t,this._id=e}setStartTimeNumber(t){this._startTime=t}get startTime(){return new Date(this._startTime)}set startTime(t){this._startTime=+t}}const fe={argv:[],failOnFlakyTests:!1,forbidOnly:!1,fullyParallel:!1,globalSetup:null,globalTeardown:null,globalTimeout:0,grep:/.*/,grepInvert:null,maxFailures:0,metadata:{},preserveOutput:"always",projects:[],reporter:[[ce.CI?"dot":"list"]],reportSlowTests:{max:5,threshold:3e5},configFile:"",rootDir:"",quiet:!1,shard:null,tags:[],updateSnapshots:"missing",updateSourceMethod:"patch",version:"",workers:0,webServer:null};function ct(i){return i.map(t=>t.s!==void 0?t.s:new RegExp(t.r.source,t.r.flags))}function pe(i){let t=0,e=0,s=0;for(const n of i.results)n.status==="interrupted"||(n.status==="skipped"&&i.expectedStatus==="skipped"?++t:n.status==="skipped"||(n.status===i.expectedStatus?++e:++s));return e===0&&s===0?"skipped":s===0?"expected":e===0&&t===0?"unexpected":"flaky"}function ge(i){return{status:i.status,startTime:new Date(i.startTime),duration:i.duration}}function me(i){return{...fe,...i}}class _t{constructor(t,e,s,n,r,a){this._treeItemById=new Map,this._treeItemByTestId=new Map;const p=n&&[...n.values()].some(Boolean);this.pathSeparator=r,this.rootItem={kind:"group",subKind:"folder",id:t,title:"",location:{file:"",line:0,column:0},duration:0,parent:void 0,children:[],status:"none",hasLoadErrors:!1},this._treeItemById.set(t,this.rootItem);const c=(g,l,w,k)=>{for(const h of k==="tests"?[]:l.suites){if(!h.title){c(g,h,w,"all");continue}let I=w.children.find(u=>u.kind==="group"&&u.title===h.title);I||(I={kind:"group",subKind:"describe",id:"suite:"+l.titlePath().join("")+""+h.title,title:h.title,location:h.location,duration:0,parent:w,children:[],status:"none",hasLoadErrors:!1},this._addChild(w,I)),c(g,h,I,"all")}for(const h of k==="suites"?[]:l.tests){const I=h.title;let u=w.children.find(E=>E.kind!=="group"&&E.title===I);u||(u={kind:"case",id:"test:"+h.titlePath().join(""),title:I,parent:w,children:[],tests:[],location:h.location,duration:0,status:"none",project:void 0,test:void 0,tags:h.tags},this._addChild(w,u));const b=h.results[0];let x="none";(b==null?void 0:b[et])==="scheduled"?x="scheduled":(b==null?void 0:b[et])==="running"?x="running":(b==null?void 0:b.status)==="skipped"?x="skipped":(b==null?void 0:b.status)==="interrupted"?x="none":b&&h.outcome()!=="expected"?x="failed":b&&h.outcome()==="expected"&&(x="passed"),u.tests.push(h);const j={kind:"test",id:h.id,title:g.name,location:h.location,test:h,parent:u,children:[],status:x,duration:h.results.length?Math.max(0,h.results[0].duration):0,project:g};this._addChild(u,j),this._treeItemByTestId.set(h.id,j),u.duration=u.children.reduce((E,y)=>E+y.duration,0)}};for(const g of(e==null?void 0:e.suites)||[])if(!(p&&!n.get(g.title)))for(const l of g.suites)if(a){if(c(g.project(),l,this.rootItem,"suites"),l.tests.length){const w=this._defaultDescribeItem();c(g.project(),l,w,"tests")}}else{const w=this._fileItem(l.location.file.split(r),!0);c(g.project(),l,w,"all")}for(const g of s){if(!g.location)continue;const l=this._fileItem(g.location.file.split(r),!0);l.hasLoadErrors=!0}}_addChild(t,e){t.children.push(e),e.parent=t,this._treeItemById.set(e.id,e)}filterTree(t,e,s){const n=t.trim().toLowerCase().split(" "),r=[...e.values()].some(Boolean),a=c=>{const g=[...c.tests[0].titlePath(),...c.tests[0].tags].join(" ").toLowerCase();return!n.every(l=>g.includes(l))&&!c.tests.some(l=>s==null?void 0:s.has(l.id))?!1:(c.children=c.children.filter(l=>!r||(s==null?void 0:s.has(l.test.id))||e.get(l.status)),c.tests=c.children.map(l=>l.test),!!c.children.length)},p=c=>{const g=[];for(const l of c.children)l.kind==="case"?a(l)&&g.push(l):(p(l),(l.children.length||l.hasLoadErrors)&&g.push(l));c.children=g};p(this.rootItem)}_fileItem(t,e){if(t.length===0)return this.rootItem;const s=t.join(this.pathSeparator),n=this._treeItemById.get(s);if(n)return n;const r=this._fileItem(t.slice(0,t.length-1),!1),a={kind:"group",subKind:e?"file":"folder",id:s,title:t[t.length-1],location:{file:s,line:0,column:0},duration:0,parent:r,children:[],status:"none",hasLoadErrors:!1};return this._addChild(r,a),a}_defaultDescribeItem(){let t=this._treeItemById.get("");return t||(t={kind:"group",subKind:"describe",id:"",title:"",location:{file:"",line:0,column:0},duration:0,parent:this.rootItem,children:[],status:"none",hasLoadErrors:!1},this._addChild(this.rootItem,t)),t}sortAndPropagateStatus(){Ct(this.rootItem)}flattenForSingleProject(){const t=e=>{e.kind==="case"&&e.children.length===1?(e.project=e.children[0].project,e.test=e.children[0].test,e.children=[],this._treeItemByTestId.set(e.test.id,e)):e.children.forEach(t)};t(this.rootItem)}shortenRoot(){let t=this.rootItem;for(;t.children.length===1&&t.children[0].kind==="group"&&t.children[0].subKind==="folder";)t=t.children[0];t.location=this.rootItem.location,this.rootItem=t}fileNames(){const t=new Set,e=s=>{s.kind==="group"&&s.subKind==="file"?t.add(s.id):s.children.forEach(e)};return e(this.rootItem),[...t]}flatTreeItems(){const t=[],e=s=>{t.push(s),s.children.forEach(e)};return e(this.rootItem),t}treeItemById(t){return this._treeItemById.get(t)}collectTestIds(t){return _e(t)}}function Ct(i){for(const a of i.children)Ct(a);i.kind==="group"&&i.children.sort((a,p)=>a.location.file.localeCompare(p.location.file)||a.location.line-p.location.line);let t=i.children.length>0,e=i.children.length>0,s=!1,n=!1,r=!1;for(const a of i.children)e=e&&a.status==="skipped",t=t&&(a.status==="passed"||a.status==="skipped"),s=s||a.status==="failed",n=n||a.status==="running",r=r||a.status==="scheduled";n?i.status="running":r?i.status="scheduled":s?i.status="failed":e?i.status="skipped":t&&(i.status="passed")}function _e(i){const t=new Set,e=new Set,s=n=>{if(n.kind!=="test"&&n.kind!=="case"){n.children.forEach(s);return}let r=n;for(;r&&r.parent&&!(r.kind==="group"&&r.subKind==="file");)r=r.parent;e.add(r.location.file),n.kind==="case"?n.tests.forEach(a=>t.add(a.id)):t.add(n.id)};return s(i),{testIds:t,locations:e}}const et=Symbol("statusEx");class ve{constructor(t){this.loadErrors=[],this.progress={total:0,passed:0,failed:0,skipped:0},this._lastRunTestCount=0,this._receiver=new mt(this._createReporter(),{mergeProjects:!0,mergeTestCases:!0,resolvePath:jt(t.pathSeparator),clearPreviousResultsWhenTestBegins:!0}),this._options=t}_createReporter(){return{version:()=>"v2",onConfigure:t=>{this.config=t,this._lastRunReceiver=new mt({version:()=>"v2",onBegin:e=>{this._lastRunTestCount=e.allTests().length,this._lastRunReceiver=void 0}},{mergeProjects:!0,mergeTestCases:!1,resolvePath:jt(this._options.pathSeparator)}),this._lastRunReceiver.dispatch({method:"onConfigure",params:{config:t}})},onBegin:t=>{var e;if(this.rootSuite||(this.rootSuite=t),this._testResultsSnapshot){for(const s of this.rootSuite.allTests())s.results=((e=this._testResultsSnapshot)==null?void 0:e.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:(t,e)=>{e[et]="running",this._options.onUpdate()},onTestEnd:(t,e)=>{t.outcome()==="skipped"?++this.progress.skipped:t.outcome()==="unexpected"?++this.progress.failed:++this.progress.passed,e[et]=e.status,this._options.onUpdate()},onError:t=>this._handleOnError(t),printsToStdio:()=>!1}}processGlobalReport(t){const e=new mt({version:()=>"v2",onConfigure:s=>{this.config=s},onError:s=>this._handleOnError(s)});for(const s of t)e.dispatch(s)}processListReport(t){var s;const e=((s=this.rootSuite)==null?void 0:s.allTests())||[];this._testResultsSnapshot=new Map(e.map(n=>[n.id,n.results])),this._receiver.reset();for(const n of t)this._receiver.dispatch(n)}processTestReportEvent(t){var e,s,n;(s=(e=this._lastRunReceiver)==null?void 0:e.dispatch(t))==null||s.catch(()=>{}),(n=this._receiver.dispatch(t))==null||n.catch(()=>{})}_handleOnError(t){var e,s;this.loadErrors.push(t),(s=(e=this._options).onError)==null||s.call(e,t),this._options.onUpdate()}asModel(){return{rootSuite:this.rootSuite||new tt("","root"),config:this.config,loadErrors:this.loadErrors,progress:this.progress}}}function jt(i){return(t,e)=>{const s=[];for(const n of[...t.split(i),...e.split(i)]){const r=i==="\\"&&s.length===1&&s[0].endsWith(":"),a=!s.length;if(!(!n&&!a&&!r)&&n!=="."){if(n===".."){s.pop();continue}s.push(n)}}return s.join(i)}}const we=({source:i})=>{const[t,e]=Ht(),[s,n]=H.useState(qt()),[r]=H.useState(Yt(()=>import("./assets/xtermModule-CsJ4vdCR.js"),__vite__mapDeps([0,1]),import.meta.url).then(p=>p.default)),a=H.useRef(null);return H.useEffect(()=>(Qt(n),()=>Xt(n)),[]),H.useEffect(()=>{const p=i.write,c=i.clear;return(async()=>{const{Terminal:g,FitAddon:l}=await r,w=e.current;if(!w)return;const k=s==="dark-mode"?xe:be;if(a.current&&a.current.terminal.options.theme===k)return;a.current&&(w.textContent="");const h=new g({convertEol:!0,fontSize:13,scrollback:1e4,fontFamily:"monospace",theme:k}),I=new l;h.loadAddon(I);for(const u of i.pending)h.write(u);i.write=(u=>{i.pending.push(u),h.write(u)}),i.clear=()=>{i.pending=[],h.clear()},h.open(w),I.fit(),a.current={terminal:h,fitAddon:I}})(),()=>{i.clear=c,i.write=p}},[r,a,e,i,s]),H.useEffect(()=>{setTimeout(()=>{a.current&&(a.current.fitAddon.fit(),i.resize(a.current.terminal.cols,a.current.terminal.rows))},250)},[t,i]),o.jsx("div",{"data-testid":"output",className:"xterm-wrapper",style:{flex:"auto"},ref:e})},be={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"},xe={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"},Se=({filterText:i,setFilterText:t,statusFilters:e,setStatusFilters:s,projectFilters:n,setProjectFilters:r,onlyChanged:a,setOnlyChanged:p,testModel:c,runTests:g})=>{const[l,w]=d.useState(!1),k=d.useRef(null);d.useEffect(()=>{var u;(u=k.current)==null||u.focus()},[]);const h=[...e.entries()].filter(([u,b])=>b).map(([u])=>u).join(" ")||"all",I=[...n.entries()].filter(([u,b])=>b).map(([u])=>u).join(" ")||"all";return o.jsxs("div",{className:"filters",children:[o.jsx(Jt,{expanded:l,setExpanded:w,title:o.jsx("input",{ref:k,type:"search",placeholder:"Filter (e.g. text, @tag)",spellCheck:!1,value:i,onChange:u=>{t(u.target.value)},onKeyDown:u=>{u.key==="Enter"&&g()}})}),o.jsxs("div",{className:"filter-summary",title:"Status: "+h+` Projects: `+I+(a?` Only changed`:""),onClick:()=>w(!l),children:[o.jsx("span",{className:"filter-label",children:"Status:"})," ",h,o.jsx("span",{className:"filter-label",children:"Projects:"})," ",I,a&&o.jsx(o.Fragment,{children:o.jsx("span",{className:"filter-label",children:"Only changed"})})]}),l&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"hbox",style:{marginLeft:14,maxHeight:200,overflowY:"auto"},children:[o.jsx("div",{className:"filter-list",role:"list","data-testid":"status-filters",children:[...e.entries()].map(([u,b])=>o.jsx("div",{className:"filter-entry",role:"listitem",children:o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:b,onChange:()=>{const x=new Map(e);x.set(u,!x.get(u)),s(x)}}),o.jsx("div",{children:u})]})},u))}),o.jsx("div",{className:"filter-list",role:"list","data-testid":"project-filters",children:[...n.entries()].map(([u,b])=>o.jsx("div",{className:"filter-entry",role:"listitem",children:o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:b,onChange:()=>{var E;const x=new Map(n);x.set(u,!x.get(u)),r(x);const j=(E=c==null?void 0:c.config)==null?void 0:E.configFile;j&&Rt.setObject(j+":projects",[...x.entries()].filter(([y,W])=>W).map(([y])=>y))}}),o.jsx("div",{children:u||"untitled"})]})},u))})]}),o.jsx("div",{className:"filter-entry",style:{marginLeft:24},children:o.jsxs("label",{children:[o.jsx("input",{type:"checkbox",checked:a,onChange:()=>p(!a)}),o.jsx("div",{children:"Show only changed files"})]})})]})]})},Te=({tag:i,style:t,onClick:e})=>o.jsx("span",{className:vt("tag",`tag-color-${ke(i)}`),onClick:e,style:{margin:"6px 0 0 6px",...t},title:`Click to filter by tag: ${i}`,children:i});function ke(i){let t=0;for(let e=0;e{const[u,b]=d.useState({expandedItems:new Map}),[x,j]=d.useState(),[E,y]=d.useState(w),[W,st]=d.useState(k);d.useEffect(()=>{if(E!==w){u.expandedItems.clear();for(const T of s.flatTreeItems())u.expandedItems.set(T.id,!1);y(w),j(void 0),b({...u});return}if(W!==k){u.expandedItems.clear();for(const T of s.flatTreeItems())u.expandedItems.set(T.id,!0);st(k),j(void 0),b({...u});return}if(!r||r.itemSelectedByUser)return;let f;const C=T=>{var F;T.children.forEach(C),!f&&T.status==="failed"&&(T.kind==="test"&&r.testIds.has(T.test.id)||T.kind==="case"&&r.testIds.has((F=T.tests[0])==null?void 0:F.id))&&(f=T)};C(s.rootItem),f&&j(f.id)},[r,j,s,E,y,w,W,st,k,u,b]);const N=d.useMemo(()=>{if(x)return s.treeItemById(x)},[x,s]);d.useEffect(()=>{if(!t)return;const f=Ie(N,t);let C;(N==null?void 0:N.kind)==="test"?C=N.test:(N==null?void 0:N.kind)==="case"&&N.tests.length===1&&(C=N.tests[0]),l({treeItem:N,testCase:C,testFile:f})},[t,N,l]),d.useEffect(()=>{if(!g)if(a)e==null||e.watchNoReply({fileNames:s.fileNames()});else{const f=new Set;for(const C of p.value){const T=s.treeItemById(C),F=T==null?void 0:T.location.file;F&&f.add(F)}e==null||e.watchNoReply({fileNames:[...f]})}},[g,s,a,p,e]);const z=f=>{j(f.id),n("bounce-if-busy",s.collectTestIds(f))},V=(f,C)=>{if(f.preventDefault(),f.stopPropagation(),f.metaKey||f.ctrlKey){const T=i.split(" ");T.includes(C)?h(T.filter(F=>F!==C).join(" ").trim()):h((i+" "+C).trim())}else h((i.split(" ").filter(T=>!T.startsWith("@")).join(" ")+" "+C).trim())};return o.jsx(je,{name:"tests",treeState:u,setTreeState:b,rootItem:s.rootItem,dataTestId:"test-tree",render:f=>{const C=f.id.replace(/[^\w\d-_]/g,"-"),T=C+"-label",F=C+"-time";return o.jsxs("div",{className:"hbox ui-mode-tree-item","aria-labelledby":`${T} ${F}`,children:[o.jsxs("div",{id:T,className:"ui-mode-tree-item-title",children:[o.jsx("span",{children:f.title}),f.kind==="case"?f.tags.map(Q=>o.jsx(Te,{tag:Q.slice(1),onClick:dt=>V(dt,Q)},Q)):null]}),!!f.duration&&f.status!=="skipped"&&o.jsx("div",{id:F,className:"ui-mode-tree-item-time",children:te(f.duration)}),o.jsxs(Y,{noMinHeight:!0,noShadow:!0,children:[o.jsx(M,{icon:"play",title:"Run",onClick:()=>z(f),disabled:!!r&&!r.completed}),o.jsx(M,{icon:"go-to-file",title:"Show source",onClick:I,style:f.kind==="group"&&f.subKind==="folder"?{visibility:"hidden"}:{}}),!a&&o.jsx(M,{icon:"eye",title:"Watch",onClick:()=>{p.value.has(f.id)?p.value.delete(f.id):p.value.add(f.id),c({...p})},toggled:p.value.has(f.id)})]})]})},icon:f=>Gt(f.status),title:f=>f.title,selectedItem:N,onAccepted:z,onSelected:f=>{r&&(r.itemSelectedByUser=!0),j(f.id)},isError:f=>f.kind==="group"?f.hasLoadErrors:!1,autoExpandDepth:i?5:1,noItemsMessage:g?"Loading…":"No tests"})};function Ie(i,t){if(!(!i||!t))return{file:i.location.file,line:i.location.line,column:i.location.column,source:{errors:t.loadErrors.filter(e=>{var s;return((s=e.location)==null?void 0:s.file)===i.location.file}).map(e=>({line:e.location.line,message:e.message})),content:void 0}}}function Ee(i){return`.playwright-artifacts-${i}`}const Re=({item:i,rootDir:t,onOpenExternally:e,revealSource:s,pathSeparator:n})=>{var w,k;const[r,a]=d.useState(void 0),[p,c]=d.useState(0),g=d.useRef(null),{outputDir:l}=d.useMemo(()=>({outputDir:i.testCase?Be(i.testCase):void 0}),[i]);return d.useEffect(()=>{var b,x,j;g.current&&clearTimeout(g.current);const h=(b=i.testCase)==null?void 0:b.results[0];if(!h||((x=i.treeItem)==null?void 0:x.status)==="scheduled"){a(void 0);return}const I=h&&h.duration>=0&&h.attachments.find(E=>E.name==="trace");if(I&&I.path){yt(I.path,h.startTime.getTime()).then(E=>a({model:E,isLive:!1}));return}if(!l){a(void 0);return}const u=[l,Ee(h.workerIndex),"traces",`${(j=i.testCase)==null?void 0:j.id}.json`].join(n);return g.current=setTimeout(async()=>{try{const E=await yt(u,Date.now());a({model:E,isLive:!0})}catch{const E=new Bt("",[]);E.errorDescriptors.push(...h.errors.flatMap(y=>y.message?[{message:y.message}]:[])),a({model:E,isLive:!1})}finally{c(p+1)}},500),()=>{g.current&&clearTimeout(g.current)}},[l,i,a,p,c,n]),o.jsx(ee,{model:r==null?void 0:r.model,showSourcesFirst:!0,rootDir:t,fallbackLocation:i.testFile,isLive:r==null?void 0:r.isLive,status:(w=i.treeItem)==null?void 0:w.status,annotations:((k=i.testCase)==null?void 0:k.annotations)??[],onOpenExternally:e,revealSource:s},"workbench")},Be=i=>{var t;for(let e=i.parent;e;e=e.parent)if(e.project())return(t=e.project())==null?void 0:t.outputDir};async function yt(i,t){const e=`file?path=${encodeURIComponent(i)}×tamp=${t}`,s=new URLSearchParams;s.set("trace",e);const r=await(await fetch(`contexts?${s.toString()}`)).json();return new Bt(e,r)}let It={cols:80};const K={pending:[],clear:()=>{},write:i=>K.pending.push(i),resize:()=>{}},A=new URLSearchParams(window.location.search),Ce=new URL(A.get("server")??"../",window.location.href),wt=new URL(A.get("ws"),Ce);wt.protocol=wt.protocol==="https:"?"wss:":"ws:";const P={args:A.getAll("arg"),grep:A.get("grep")||void 0,grepInvert:A.get("grepInvert")||void 0,projects:A.getAll("project"),workers:A.get("workers")||void 0,headed:A.has("headed"),updateSnapshots:A.get("updateSnapshots")||void 0,reporters:A.has("reporter")?A.getAll("reporter"):void 0,pathSeparator:A.get("pathSeparator")||"/"};P.updateSnapshots&&!["all","changed","none","missing"].includes(P.updateSnapshots)&&(P.updateSnapshots=void 0);const Et=navigator.platform==="MacIntel";function Pe(i){return i.startsWith("/")&&(i=i.substring(1)),i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ne(i,t,e){const s=i.passed+i.failed+i.skipped,n=t?s/t*100|0:0,r=[];return i.passed>0&&r.push(`${i.passed} passed`),i.failed>0&&r.push(o.jsxs("span",{className:"status-line-failed",children:[i.failed," failed"]},"failed")),i.skipped>0&&r.push(`${i.skipped} skipped`),o.jsx("div",{"data-testid":"status-line",className:"status-line",children:o.jsxs("div",{children:[e&&"Running ",s,"/",t," (",n,"%)",r.length>0&&" — ",r.map((a,p)=>o.jsxs(d.Fragment,{children:[p>0?", ":"",a]},p))]})})}const Le=({})=>{var Tt;const[i,t]=d.useState(""),[e,s]=d.useState(!1),[n,r]=d.useState(!1),[a,p]=d.useState(new Map([["passed",!1],["failed",!1],["skipped",!1]])),[c,g]=d.useState(new Map),[l,w]=d.useState(),[k,h]=d.useState(),[I,u]=d.useState({}),[b,x]=d.useState(!1),[j,E]=d.useState(),y=j&&!j.completed,[W,st]=q("watch-all",!1),[N,z]=d.useState({value:new Set}),V=d.useRef(Promise.resolve()),f=d.useRef({testIds:new Set,locations:new Set}),[C,T]=d.useState(0),[F,Q]=d.useState(0),[dt,Pt]=d.useState(!1),[bt,xt]=d.useState(!0),[v,Nt]=d.useState(),[it,Lt]=d.useState(),[nt,Dt]=d.useState(!1),[ot,Ft]=d.useState(!1),[Mt,St]=d.useState(!1),Ot=d.useCallback(()=>St(!0),[St]),[ut,At]=q("single-worker",!1),[ht,Ut]=q("updateSnapshots","missing"),[X,Wt]=q("only-changed",!1),[ft,Kt]=q("stop-on-failure",!1),[J]=q("mergeFiles",!1),Vt=d.useRef(null),rt=d.useCallback(()=>{Nt(m=>(m==null||m.close(),new se(new ie(wt))))},[]);d.useEffect(()=>{var m;(m=Vt.current)==null||m.focus(),x(!0),rt()},[rt]),d.useEffect(()=>{if(!v)return;const m=[v.onStdio(_=>{if(_.buffer){const S=atob(_.buffer);K.write(S)}else K.write(_.text);_.type==="stderr"&&r(!0)}),v.onClose(()=>Pt(!0))];return K.resize=(_,S)=>{It={cols:_,rows:S},v.resizeTerminalNoReply({cols:_,rows:S})},()=>{for(const _ of m)_.dispose()}},[v]),d.useEffect(()=>{if(!v)return;let m;const _=new ve({onUpdate:S=>{clearTimeout(m),m=void 0,S?w(_.asModel()):m||(m=setTimeout(()=>{w(_.asModel())},250))},onError:S=>{K.write((S.stack||S.value||"")+` `),r(!0)},pathSeparator:P.pathSeparator});return Lt(_),w(void 0),x(!0),z({value:new Set}),(async()=>{try{await v.initialize({interceptStdio:!0,watchTestDirs:!0});const{status:S,report:B}=await v.runGlobalSetup({});if(_.processGlobalReport(B),S!=="passed")return;const L=await v.listTests({projects:P.projects,locations:P.args,grep:P.grep,grepInvert:P.grepInvert,onlyChanged:X});_.processListReport(L.report),v.onReport($=>{_.processTestReportEvent($)});const{hasBrowsers:O}=await v.checkBrowsers({});xt(O)}finally{x(!1)}})(),()=>{clearTimeout(m)}},[X,v]),d.useEffect(()=>{if(!l)return;const{config:m,rootSuite:_}=l,S=m.configFile?Rt.getObject(m.configFile+":projects",void 0):void 0,B=new Map(c);for(const L of B.keys())_.suites.find(O=>O.title===L)||B.delete(L);for(const L of _.suites)B.has(L.title)||B.set(L.title,!!(S!=null&&S.includes(L.title)));!S&&B.size&&![...B.values()].includes(!0)&&B.set(B.entries().next().value[0],!0),(c.size!==B.size||[...c].some(([L,O])=>B.get(L)!==O))&&g(B)},[c,l]),d.useEffect(()=>{y&&(l!=null&&l.progress)?h(l.progress):l||h(void 0)},[l,y]);const{testTree:at}=d.useMemo(()=>{if(!l)return{testTree:new _t("",new tt("","root"),[],c,P.pathSeparator,J)};const m=new _t("",l.rootSuite,l.loadErrors,c,P.pathSeparator,J);return m.filterTree(i,a,y?j==null?void 0:j.testIds:void 0),m.sortAndPropagateStatus(),m.shortenRoot(),m.flattenForSingleProject(),{testTree:m}},[i,l,a,c,j,y,J]),Z=d.useCallback((m,_)=>{if(!(!v||!l)&&!(m==="bounce-if-busy"&&y)){for(const S of _.testIds)f.current.testIds.add(S);for(const S of _.locations)f.current.locations.add(S);V.current=V.current.then(async()=>{var O,$,U;const{testIds:S,locations:B}=f.current;if(f.current={testIds:new Set,locations:new Set},!S.size)return;{for(const R of((O=l.rootSuite)==null?void 0:O.allTests())||[])if(S.has(R.id)){R.results=[];const D=R._createTestResult("pending");D[et]="scheduled"}w({...l})}const L=" ["+new Date().toLocaleTimeString()+"]";K.write("\x1B[2m—".repeat(Math.max(0,It.cols-L.length))+L+"\x1B[22m"),h({total:0,passed:0,failed:0,skipped:0}),E({testIds:S}),await v.runTests({locations:[...B].map(Pe),grep:P.grep,grepInvert:P.grepInvert,testIds:[...S],projects:[...c].filter(([R,D])=>D).map(([R])=>R),updateSnapshots:ht,reporters:P.reporters,workers:ut?1:void 0,maxFailures:ft?1:void 0,trace:"on"});for(const R of(($=l.rootSuite)==null?void 0:$.allTests())||[])((U=R.results[0])==null?void 0:U.duration)===-1&&(R.results=[]);w({...l}),E(R=>R?{...R,completed:!0}:void 0)})}},[c,y,l,v,ht,ut,ft]),lt=d.useCallback(()=>Z("bounce-if-busy",at.collectTestIds(at.rootItem)),[Z,at]);d.useEffect(()=>{if(!v||!it)return;const m=v.onTestFilesChanged(async _=>{if(V.current=V.current.then(async()=>{x(!0);try{const U=await v.listTests({projects:P.projects,locations:P.args,grep:P.grep,grepInvert:P.grepInvert,onlyChanged:X});it.processListReport(U.report)}catch(U){console.log(U)}finally{x(!1)}}),await V.current,_.testFiles.length===0)return;const S=it.asModel(),B=new _t("",S.rootSuite,S.loadErrors,c,P.pathSeparator,J),L=[],O=[],$=new Set(_.testFiles);if(W){const U=R=>{const D=R.location.file;if(D&&$.has(D)){const G=B.collectTestIds(R);L.push(...G.locations),O.push(...G.testIds)}R.kind==="group"&&R.subKind==="folder"&&R.children.forEach(U)};U(B.rootItem)}else for(const U of N.value){const R=B.treeItemById(U);if(!R)continue;let D=R;for(;!(D.kind==="group"&&(D.subKind==="file"||D.subKind==="folder"))&&D.parent;)D=D.parent;const G=D==null?void 0:D.location.file;if(G&&$.has(G)){const kt=B.collectTestIds(R);L.push(...kt.locations),O.push(...kt.testIds)}}Z("queue-if-busy",{locations:L,testIds:O})});return()=>m.dispose()},[Z,v,W,N,it,c,J,X]),d.useEffect(()=>{if(!v)return;const m=_=>{_.code==="Backquote"&&_.ctrlKey?(_.preventDefault(),s(!e)):_.code==="F5"&&_.shiftKey?(_.preventDefault(),v==null||v.stopTestsNoReply({})):_.code==="F5"&&(_.preventDefault(),lt())};return addEventListener("keydown",m),()=>{removeEventListener("keydown",m)}},[lt,rt,v,e]);const pt=d.useRef(null),$t=d.useCallback(m=>{var _;m.preventDefault(),m.stopPropagation(),(_=pt.current)==null||_.showModal()},[]),gt=d.useCallback(m=>{var _;m.preventDefault(),m.stopPropagation(),(_=pt.current)==null||_.close()},[]),zt=d.useCallback(m=>{gt(m),s(!0),v==null||v.installBrowsers({}).then(async()=>{s(!1);const{hasBrowsers:_}=await(v==null?void 0:v.checkBrowsers({}));xt(_)})},[gt,v]);return o.jsxs("div",{className:"vbox ui-mode",children:[!bt&&o.jsxs("dialog",{ref:pt,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:zt,children:"Install"}),o.jsx("button",{className:"button secondary",onClick:gt,children:"Dismiss"})]})]}),dt&&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(ne,{sidebarSize:250,minSidebarSize:150,orientation:"horizontal",sidebarIsFirst:!0,settingName:"testListSidebar",main:o.jsxs("div",{className:"vbox",children:[o.jsxs("div",{className:vt("vbox",!e&&"hidden"),children:[o.jsxs(Y,{children:[o.jsx("div",{className:"section-title",style:{flex:"none"},children:"Output"}),o.jsx(M,{icon:"circle-slash",title:"Clear output",onClick:()=>{K.clear(),r(!1)}}),o.jsx("div",{className:"spacer"}),o.jsx(M,{icon:"close",title:"Close",onClick:()=>s(!1)})]}),o.jsx(we,{source:K})]}),o.jsx("div",{className:vt("vbox",e&&"hidden"),children:o.jsx(Re,{pathSeparator:P.pathSeparator,item:I,rootDir:(Tt=l==null?void 0:l.config)==null?void 0:Tt.rootDir,revealSource:Mt,onOpenExternally:m=>v==null?void 0:v.openNoReply({location:{file:m.file,line:m.line,column:m.column}})})})]}),sidebar:o.jsxs("div",{className:"vbox ui-mode-sidebar",children:[o.jsxs(Y,{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:()=>rt(),disabled:y||b}),o.jsx("div",{style:{position:"relative"},children:o.jsx(M,{icon:"terminal",title:"Toggle output — "+(Et?"⌃`":"Ctrl + `"),toggled:e,errorBadge:n?"Output contains error":void 0,onClick:()=>{s(!e)}})}),!bt&&o.jsx(M,{icon:"lightbulb-autofix",style:{color:"var(--vscode-list-warningForeground)"},title:"Playwright browsers are missing",onClick:$t})]}),o.jsx(Se,{filterText:i,setFilterText:t,statusFilters:a,setStatusFilters:p,projectFilters:c,setProjectFilters:g,onlyChanged:X,setOnlyChanged:Wt,testModel:l,runTests:lt}),o.jsxs(Y,{className:"section-toolbar",noMinHeight:!0,children:[!y&&!k&&o.jsx("div",{className:"section-title",children:"Tests"}),k&&Ne(k,y?j.testIds.size:k.total,!!y),o.jsx(M,{icon:"play",title:"Run all — F5",onClick:lt,disabled:y||b}),o.jsx(M,{icon:"debug-stop",title:"Stop — "+(Et?"⇧F5":"Shift + F5"),onClick:()=>v==null?void 0:v.stopTests({}),disabled:!y||b,testId:"stop-button"}),o.jsx(M,{icon:"eye",title:"Watch all",toggled:W,onClick:()=>{z({value:new Set}),st(!W)}}),o.jsx(M,{icon:"collapse-all",title:"Collapse all",onClick:()=>{T(C+1)}}),o.jsx(M,{icon:"expand-all",title:"Expand all",onClick:()=>{Q(F+1)}})]}),o.jsx(ye,{filterText:i,testModel:l,testTree:at,testServerConnection:v,runningState:j,runTests:Z,onItemSelected:u,watchAll:W,watchedTreeIds:N,setWatchedTreeIds:z,isLoading:b,requestedCollapseAllCount:C,requestedExpandAllCount:F,setFilterText:t,onRevealSource:Ot}),o.jsxs(Y,{noShadow:!0,noMinHeight:!0,className:"settings-toolbar",onClick:()=>Ft(!ot),children:[o.jsx("span",{className:`codicon codicon-${ot?"chevron-down":"chevron-right"}`,style:{marginLeft:5},title:ot?"Hide Testing Options":"Show Testing Options"}),o.jsx("div",{className:"section-title",children:"Testing Options"})]}),ot&&o.jsx(oe,{settings:[{type:"check",value:ut,set:At,name:"Single worker"},{type:"check",value:ft,set:Kt,name:"Stop on first failure"},{type:"select",options:[{label:"All",value:"all"},{label:"Changed",value:"changed"},{label:"Missing",value:"missing"},{label:"None",value:"none"}],value:ht,set:Ut,name:"Update snapshots"}]}),o.jsxs(Y,{noShadow:!0,noMinHeight:!0,className:"settings-toolbar",onClick:()=>Dt(!nt),children:[o.jsx("span",{className:`codicon codicon-${nt?"chevron-down":"chevron-right"}`,style:{marginLeft:5},title:nt?"Hide Settings":"Show Settings"}),o.jsx("div",{className:"section-title",children:"Settings"})]}),nt&&o.jsx(re,{location:"ui-mode"})]})})]})};(async()=>{if(ae(),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. 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)}le.createRoot(document.querySelector("#root")).render(o.jsx(Le,{}))})();