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