(0,i);let l=s.indexOf(` `,this.pos);if(l!==-1){for(;l!==-1;){const o=this.continueScalar(l+1);if(o===-1)break;l=s.indexOf(` `,o)}l!==-1&&(i=l-(s[l-1]==="\r"?2:1))}if(i===-1){if(!this.atEnd)return this.setNext("quoted-scalar");i=this.buffer.length}return yield*this.pushToIndex(i+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){const i=this.buffer[++e];if(i==="+")this.blockScalarKeep=!0;else if(i>"0"&&i<="9")this.blockScalarIndent=Number(i)-1;else if(i!=="-")break}return yield*this.pushUntil(i=>pn(i)||i==="#")}*parseBlockScalar(){let e=this.pos-1,i=0,s;e:for(let o=this.pos;s=this.buffer[o];++o)switch(s){case" ":i+=1;break;case` `:e=o,i=0;break;case"\r":{const u=this.buffer[o+1];if(!u&&!this.atEnd)return this.setNext("block-scalar");if(u===` `)break}default:break e}if(!s&&!this.atEnd)return this.setNext("block-scalar");if(i>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=i:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{const o=this.continueScalar(e+1);if(o===-1)break;e=this.buffer.indexOf(` `,o)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let l=e+1;for(s=this.buffer[l];s===" ";)s=this.buffer[++l];if(s===" "){for(;s===" "||s===" "||s==="\r"||s===` `;)s=this.buffer[++l];e=l-1}else if(!this.blockScalarKeep)do{let o=e-1,u=this.buffer[o];u==="\r"&&(u=this.buffer[--o]);const f=o;for(;u===" ";)u=this.buffer[--o];if(u===` `&&o>=this.pos&&o+1+i>f)e=o;else break}while(!0);return yield rl,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const e=this.flowLevel>0;let i=this.pos-1,s=this.pos-1,l;for(;l=this.buffer[++s];)if(l===":"){const o=this.buffer[s+1];if(pn(o)||e&&jo.has(o))break;i=s}else if(pn(l)){let o=this.buffer[s+1];if(l==="\r"&&(o===` `?(s+=1,l=` `,o=this.buffer[s+1]):i=s),o==="#"||e&&jo.has(o))break;if(l===` `){const u=this.continueScalar(s+1);if(u===-1)break;s=Math.max(s,u-2)}}else{if(e&&jo.has(l))break;i=s}return!l&&!this.atEnd?this.setNext("plain-scalar"):(yield rl,yield*this.pushToIndex(i+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,i){const s=this.buffer.slice(this.pos,e);return s?(yield s,this.pos+=s.length,s.length):(i&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(gh))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{const e=this.flowLevel>0,i=this.charAt(1);if(pn(i)||e&&jo.has(i))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,i=this.buffer[e];for(;!pn(i)&&i!==">";)i=this.buffer[++e];return yield*this.pushToIndex(i===">"?e+1:e,!1)}else{let e=this.pos+1,i=this.buffer[e];for(;i;)if(EN.has(i))i=this.buffer[++e];else if(i==="%"&&wb.has(this.buffer[e+1])&&wb.has(this.buffer[e+2]))i=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){const e=this.buffer[this.pos];return e===` `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===` `?yield*this.pushCount(2):0}*pushSpaces(e){let i=this.pos-1,s;do s=this.buffer[++i];while(s===" "||e&&s===" ");const l=i-this.pos;return l>0&&(yield this.buffer.substr(this.pos,l),this.pos=i),l}*pushUntil(e){let i=this.pos,s=this.buffer[i];for(;!e(s);)s=this.buffer[++i];return yield*this.pushToIndex(i,!1)}}class oS{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let i=0,s=this.lineStarts.length;for(;i>1;this.lineStarts[o]=0;)switch(n[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((i=n[++e])==null?void 0:i.type)==="space";);return n.splice(e,n.length)}function _b(n){if(n.start.type==="flow-seq-start")for(const e of n.items)e.sep&&!e.value&&!ns(e.start,"explicit-key-ind")&&!ns(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,cS(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}class kd{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new lS,this.onNewLine=e}*parse(e,i=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(const s of this.lexer.lex(e,i))yield*this.next(s);i||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}const i=aS(e);if(i)if(i==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=i,yield*this.step(),i){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{const s=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:s,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const e=this.peek(1);if(this.type==="doc-end"&&(!e||e.type!=="doc-end")){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){const i=e??this.stack.pop();if(!i)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield i;else{const s=this.peek(1);switch(i.type==="block-scalar"?i.indent="indent"in s?s.indent:0:i.type==="flow-collection"&&s.type==="document"&&(i.indent=0),i.type==="flow-collection"&&_b(i),s.type){case"document":s.value=i;break;case"block-scalar":s.props.push(i);break;case"block-map":{const l=s.items[s.items.length-1];if(l.value){s.items.push({start:[],key:i,sep:[]}),this.onKeyLine=!0;return}else if(l.sep)l.value=i;else{Object.assign(l,{key:i,sep:[]}),this.onKeyLine=!l.explicitKey;return}break}case"block-seq":{const l=s.items[s.items.length-1];l.value?s.items.push({start:[],value:i}):l.value=i;break}case"flow-collection":{const l=s.items[s.items.length-1];!l||l.value?s.items.push({start:[],key:i,sep:[]}):l.sep?l.value=i:Object.assign(l,{key:i,sep:[]});return}default:yield*this.pop(),yield*this.pop(i)}if((s.type==="document"||s.type==="block-map"||s.type==="block-seq")&&(i.type==="block-map"||i.type==="block-seq")){const l=i.items[i.items.length-1];l&&!l.sep&&!l.value&&l.start.length>0&&xb(l.start)===-1&&(i.indent===0||l.start.every(o=>o.type!=="comment"||o.indent=e.indent){const l=!this.onKeyLine&&this.indent===e.indent,o=l&&(i.sep||i.explicitKey)&&this.type!=="seq-item-ind";let u=[];if(o&&i.sep&&!i.value){const f=[];for(let d=0;de.indent&&(f.length=0);break;default:f.length=0}}f.length>=2&&(u=i.sep.splice(f[1]))}switch(this.type){case"anchor":case"tag":o||i.value?(u.push(this.sourceToken),e.items.push({start:u}),this.onKeyLine=!0):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"explicit-key-ind":!i.sep&&!i.explicitKey?(i.start.push(this.sourceToken),i.explicitKey=!0):o||i.value?(u.push(this.sourceToken),e.items.push({start:u,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(i.explicitKey)if(i.sep)if(i.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ns(i.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:u,key:null,sep:[this.sourceToken]}]});else if(cS(i.key)&&!ns(i.sep,"newline")){const f=ar(i.start),d=i.key,p=i.sep;p.push(this.sourceToken),delete i.key,delete i.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:f,key:d,sep:p}]})}else u.length>0?i.sep=i.sep.concat(u,this.sourceToken):i.sep.push(this.sourceToken);else if(ns(i.start,"newline"))Object.assign(i,{key:null,sep:[this.sourceToken]});else{const f=ar(i.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:f,key:null,sep:[this.sourceToken]}]})}else i.sep?i.value||o?e.items.push({start:u,key:null,sep:[this.sourceToken]}):ns(i.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const f=this.flowScalar(this.type);o||i.value?(e.items.push({start:u,key:f,sep:[]}),this.onKeyLine=!0):i.sep?this.stack.push(f):(Object.assign(i,{key:f,sep:[]}),this.onKeyLine=!0);return}default:{const f=this.startBlockValue(e);if(f){l&&f.type!=="block-seq"&&e.items.push({start:u}),this.stack.push(f);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){var s;const i=e.items[e.items.length-1];switch(this.type){case"newline":if(i.value){const l="end"in i.value?i.value.end:void 0,o=Array.isArray(l)?l[l.length-1]:void 0;(o==null?void 0:o.type)==="comment"?l==null||l.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else i.start.push(this.sourceToken);return;case"space":case"comment":if(i.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(i.start,e.indent)){const l=e.items[e.items.length-2],o=(s=l==null?void 0:l.value)==null?void 0:s.end;if(Array.isArray(o)){Array.prototype.push.apply(o,i.start),o.push(this.sourceToken),e.items.pop();return}}i.start.push(this.sourceToken)}return;case"anchor":case"tag":if(i.value||this.indent<=e.indent)break;i.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;i.value||ns(i.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return}if(this.indent>e.indent){const l=this.startBlockValue(e);if(l){this.stack.push(l);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){const i=e.items[e.items.length-1];if(this.type==="flow-error-end"){let s;do yield*this.pop(),s=this.peek(1);while(s&&s.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!i||i.sep?e.items.push({start:[this.sourceToken]}):i.start.push(this.sourceToken);return;case"map-value-ind":!i||i.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):Object.assign(i,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!i||i.value?e.items.push({start:[this.sourceToken]}):i.sep?i.sep.push(this.sourceToken):i.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const l=this.flowScalar(this.type);!i||i.value?e.items.push({start:[],key:l,sep:[]}):i.sep?this.stack.push(l):Object.assign(i,{key:l,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}const s=this.startBlockValue(e);s?this.stack.push(s):(yield*this.pop(),yield*this.step())}else{const s=this.peek(2);if(s.type==="block-map"&&(this.type==="map-value-ind"&&s.indent===e.indent||this.type==="newline"&&!s.items[s.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&s.type!=="flow-collection"){const l=Lo(s),o=ar(l);_b(e);const u=e.end.splice(1,e.end.length);u.push(this.sourceToken);const f={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:o,key:e,sep:u}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=f}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let i=this.source.indexOf(` `)+1;for(;i!==0;)this.onNewLine(this.offset+i),i=this.source.indexOf(` `,i)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const i=Lo(e),s=ar(i);return s.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const i=Lo(e),s=ar(i);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,i){return this.type!=="comment"||this.indent<=i?!1:e.every(s=>s.type==="newline"||s.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function uS(n){const e=n.prettyErrors!==!1;return{lineCounter:n.lineCounter||e&&new oS||null,prettyErrors:e}}function NN(n,e={}){const{lineCounter:i,prettyErrors:s}=uS(e),l=new kd(i==null?void 0:i.addNewLine),o=new Cd(e),u=Array.from(o.compose(l.parse(n)));if(s&&i)for(const f of u)f.errors.forEach(lc(n,i)),f.warnings.forEach(lc(n,i));return u.length>0?u:Object.assign([],{empty:!0},o.streamInfo())}function fS(n,e={}){const{lineCounter:i,prettyErrors:s}=uS(e),l=new kd(i==null?void 0:i.addNewLine),o=new Cd(e);let u=null;for(const f of o.compose(l.parse(n),!0,n.length))if(!u)u=f;else if(u.options.logLevel!=="silent"){u.errors.push(new rs(f.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&i&&(u.errors.forEach(lc(n,i)),u.warnings.forEach(lc(n,i))),u}function CN(n,e,i){let s;typeof e=="function"?s=e:i===void 0&&e&&typeof e=="object"&&(i=e);const l=fS(n,i);if(!l)return null;if(l.warnings.forEach(o=>Ov(l.options.logLevel,o)),l.errors.length>0){if(l.options.logLevel!=="silent")throw l.errors[0];l.errors=[]}return l.toJS(Object.assign({reviver:s},i))}function kN(n,e,i){let s=null;if(typeof e=="function"||Array.isArray(e)?s=e:i===void 0&&e&&(i=e),typeof i=="string"&&(i=i.length),typeof i=="number"){const l=Math.round(i);i=l<1?void 0:l>8?{indent:8}:{indent:l}}if(n===void 0){const{keepUndefined:l}=i??e??{};if(!l)return}return hs(n)&&!s?n.toString(i):new Rr(n,s,i).toString(i)}const hS=Object.freeze(Object.defineProperty({__proto__:null,Alias:yc,CST:TN,Composer:Cd,Document:Rr,Lexer:lS,LineCounter:oS,Pair:mt,Parser:kd,Scalar:he,Schema:Ac,YAMLError:Ad,YAMLMap:Vt,YAMLParseError:rs,YAMLSeq:Ni,YAMLWarning:Qv,isAlias:fs,isCollection:He,isDocument:hs,isMap:Cr,isNode:qe,isPair:Be,isScalar:Re,isSeq:kr,parse:CN,parseAllDocuments:NN,parseDocument:fS,stringify:kN,visit:Ai,visitAsync:mc},Symbol.toStringTag,{value:"Module"})),MN=({action:n,model:e,sdkLanguage:i,testIdAttributeName:s,isInspecting:l,setIsInspecting:o,highlightedElement:u,setHighlightedElement:f})=>{const[d,p]=H.useState("action"),[m]=rn("shouldPopulateCanvasFromScreenshot",!1),y=H.useMemo(()=>LN(n),[n]),{snapshotInfoUrl:v,snapshotUrl:S,popoutUrl:E}=H.useMemo(()=>{const T=y[d];return e&&T?DN(e.traceUrl,T,m):{snapshotInfoUrl:void 0,snapshotUrl:void 0,popoutUrl:void 0}},[y,d,m,e]),x=H.useMemo(()=>v!==void 0?{snapshotInfoUrl:v,snapshotUrl:S,popoutUrl:E}:void 0,[v,S,E]);return b.jsxs("div",{className:"snapshot-tab vbox",children:[b.jsxs(Gh,{children:[b.jsx(Dt,{className:"pick-locator",title:"Pick locator",icon:"target",toggled:l,onClick:()=>o(!l)}),b.jsx("div",{className:"hbox",style:{height:"100%"},role:"tablist",children:["action","before","after"].map(T=>b.jsx(p0,{id:T,title:jN(T),selected:d===T,onSelect:()=>p(T)},T))}),b.jsx("div",{style:{flex:"auto"}}),b.jsx(Dt,{icon:"link-external",title:"Open snapshot in a new tab",disabled:!(x!=null&&x.popoutUrl),onClick:()=>{const T=window.open((x==null?void 0:x.popoutUrl)||"","_blank");T==null||T.addEventListener("DOMContentLoaded",()=>{new pv(T,{isUnderTest:pS,sdkLanguage:i,testIdAttributeName:s,stableRafCount:1,browserName:"chromium",customEngines:[]}).consoleApi.install()})}})]}),b.jsx(ON,{snapshotUrls:x,sdkLanguage:i,testIdAttributeName:s,isInspecting:l,setIsInspecting:o,highlightedElement:u,setHighlightedElement:f})]})},ON=({snapshotUrls:n,sdkLanguage:e,testIdAttributeName:i,isInspecting:s,setIsInspecting:l,highlightedElement:o,setHighlightedElement:u})=>{const f=H.useRef(null),d=H.useRef(null),[p,m]=H.useState({viewport:gS,url:""}),y=H.useRef({iteration:0,visibleIframe:0});return H.useEffect(()=>{(async()=>{const v=y.current.iteration+1,S=1-y.current.visibleIframe;y.current.iteration=v;const E=await BN(n==null?void 0:n.snapshotInfoUrl);if(y.current.iteration!==v)return;const x=[f,d][S].current;if(x){let T=()=>{};const C=new Promise(k=>T=k);try{x.addEventListener("load",T),x.addEventListener("error",T);const k=(n==null?void 0:n.snapshotUrl)||UN;x.contentWindow?x.contentWindow.location.replace(k):x.src=k,await C}catch{}finally{x.removeEventListener("load",T),x.removeEventListener("error",T)}}y.current.iteration===v&&(y.current.visibleIframe=S,m(E))})()},[n]),b.jsxs("div",{className:"vbox",tabIndex:0,onKeyDown:v=>{v.key==="Escape"&&s&&l(!1)},children:[b.jsx(Tb,{isInspecting:s,sdkLanguage:e,testIdAttributeName:i,highlightedElement:o,setHighlightedElement:u,iframe:f.current,iteration:y.current.iteration}),b.jsx(Tb,{isInspecting:s,sdkLanguage:e,testIdAttributeName:i,highlightedElement:o,setHighlightedElement:u,iframe:d.current,iteration:y.current.iteration}),b.jsx(RN,{snapshotInfo:p,children:b.jsxs("div",{className:"snapshot-switcher",children:[b.jsx("iframe",{ref:f,name:"snapshot",title:"DOM Snapshot",className:Ye(y.current.visibleIframe===0&&"snapshot-visible")}),b.jsx("iframe",{ref:d,name:"snapshot",title:"DOM Snapshot",className:Ye(y.current.visibleIframe===1&&"snapshot-visible")})]})})]})},RN=({snapshotInfo:n,children:e})=>{const[i,s]=cs(),l=40,o={width:n.viewport.width,height:n.viewport.height},u={width:Math.max(o.width,480),height:Math.max(o.height+l,320)},f=Math.min(i.width/u.width,i.height/u.height,1),d={x:(i.width-u.width)/2,y:(i.height-u.height)/2};return b.jsx("div",{ref:s,className:"snapshot-wrapper",children:b.jsxs("div",{className:"snapshot-container",style:{width:u.width+"px",height:u.height+"px",transform:`translate(${d.x}px, ${d.y}px) scale(${f})`},children:[b.jsx(SA,{url:n.url}),b.jsx("div",{className:"snapshot-browser-body",children:b.jsx("div",{style:{width:o.width+"px",height:o.height+"px"},children:e})})]})})};function jN(n){return n==="before"?"Before":n==="after"?"After":n==="action"?"Action":n}const Tb=({iframe:n,isInspecting:e,sdkLanguage:i,testIdAttributeName:s,highlightedElement:l,setHighlightedElement:o,iteration:u})=>(H.useEffect(()=>{const f=l.lastEdited==="ariaSnapshot"?l.ariaSnapshot:void 0,d=l.lastEdited==="locator"?l.locator:void 0,p=!!f||!!d||e,m=[],y=new URLSearchParams(window.location.search).get("isUnderTest")==="true";try{dS(m,p,i,s,y,"",n==null?void 0:n.contentWindow)}catch{}const v=f?Kh(hS,f):void 0,S=d?bA(i,d,s):void 0;for(const{recorder:E,frameSelector:x}of m){const T=S!=null&&S.startsWith(x)?S.substring(x.length).trim():void 0,C=(v==null?void 0:v.errors.length)===0?v.fragment:void 0;E.setUIState({mode:e?"inspecting":"none",actionSelector:T,ariaTemplate:C,language:i,testIdAttributeName:s,overlay:{offsetX:0}},{async elementPicked(k){o({locator:ls(i,x+k.selector),ariaSnapshot:k.ariaSnapshot,lastEdited:"none"})},highlightUpdated(){for(const k of m)k.recorder!==E&&k.recorder.clearHighlight()}})}},[n,e,l,o,i,s,u]),b.jsx(b.Fragment,{}));function dS(n,e,i,s,l,o,u){if(!u)return;const f=u;if(!f._recorder&&e){const d=new pv(u,{isUnderTest:l,sdkLanguage:i,testIdAttributeName:s,stableRafCount:1,browserName:"chromium",customEngines:[]}),p=new hA(d);f._injectedScript=d,f._recorder={recorder:p,frameSelector:o},l&&(window._weakRecordersForTest=window._weakRecordersForTest||new Set,window._weakRecordersForTest.add(new WeakRef(p)))}f._recorder&&n.push(f._recorder);for(let d=0;d> internal:control=enter-frame >> ":"";dS(n,e,i,s,l,o+m,p)}}const za=(n,e,i=!1)=>{if(!n)return;const s=n[e];if(s){if(!n.pageId){console.error("snapshot action must have a pageId");return}return{action:n,snapshotName:s,pageId:n.pageId,point:n.point,hasInputTarget:i}}};function LN(n){if(!n)return{};let e=za(n,"beforeSnapshot");if(!e){for(let l=Oy(n);l;l=Oy(l))if(l.endTime<=n.startTime&&l.afterSnapshot){e=za(l,"afterSnapshot");break}}let i=za(n,"afterSnapshot");if(!i){let l;for(let o=Ry(n);o&&o.startTime<=n.endTime;o=Ry(o))o.endTime>n.endTime||!o.afterSnapshot||l&&l.endTime>o.endTime||(l=o);l?i=za(l,"afterSnapshot"):i=e}const s=za(n,"inputSnapshot",!0)??i;return s&&(s.point=n.point),{action:s,before:e,after:i}}const pS=new URLSearchParams(window.location.search).has("isUnderTest");function DN(n,e,i){const s=new URLSearchParams;s.set("trace",n),s.set("name",e.snapshotName),pS&&s.set("isUnderTest","true"),e.point&&(s.set("pointX",String(e.point.x)),s.set("pointY",String(e.point.y)),e.hasInputTarget&&s.set("hasInputTarget","1")),i&&s.set("shouldPopulateCanvasFromScreenshot","1");const l=new URL(`snapshot/${e.pageId}?${s.toString()}`,window.location.href).toString(),o=new URL(`snapshotInfo/${e.pageId}?${s.toString()}`,window.location.href).toString(),u=new URLSearchParams;u.set("r",l),u.set("trace",n);const f=new URL(`snapshot.html?${u.toString()}`,window.location.href).toString();return{snapshotInfoUrl:o,snapshotUrl:l,popoutUrl:f}}async function BN(n){const e={url:"",viewport:gS,timestamp:void 0,wallTime:void 0};if(n){const s=await(await fetch(n)).json();s.error||(e.url=s.url,e.viewport=s.viewport,e.timestamp=s.timestamp,e.wallTime=s.wallTime)}return e}const gS={width:1280,height:720},UN='data:text/html,',mS={width:200,height:45},ur=2.5,zN=mS.height+ur*2,HN=({boundaries:n,previewPoint:e})=>{var m,y;const i=Ci(),[s,l]=cs(),o=H.useRef(null);let u=0;if(o.current&&e){const v=o.current.getBoundingClientRect();u=(e.clientY-v.top+o.current.scrollTop)/zN|0}const f=(y=(m=i==null?void 0:i.pages)==null?void 0:m[u])==null?void 0:y.screencastFrames;let d,p;if(e!==void 0&&f&&f.length){const v=n.minimum+(n.maximum-n.minimum)*e.x/s.width;d=f[Ab(f,v,yS)-1];const S={width:Math.min(800,window.innerWidth/2|0),height:Math.min(800,window.innerHeight/2|0)};p=d?bS({width:d.width,height:d.height},S):void 0}return b.jsxs("div",{className:"film-strip",ref:l,children:[b.jsx("div",{className:"film-strip-lanes",ref:o,children:i==null?void 0:i.pages.map((v,S)=>v.screencastFrames.length?b.jsx(qN,{boundaries:n,page:v,width:s.width},S):null)}),i&&(e==null?void 0:e.x)!==void 0&&b.jsxs("div",{className:"film-strip-hover",style:{top:s.bottom+5,left:Math.min(e.x,s.width-(p?p.width:0)-10)},children:[e.action&&b.jsx("div",{className:"film-strip-hover-title",children:Ih(e.action,e)}),d&&p&&b.jsx("div",{style:{width:p.width,height:p.height},children:b.jsx("img",{src:i.createRelativeUrl(`sha1/${d.sha1}`),width:p.width,height:p.height})})]})]})},qN=({boundaries:n,page:e,width:i})=>{const s=Ci(),l={width:0,height:0},o=e.screencastFrames;for(const T of o)l.width=Math.max(l.width,T.width),l.height=Math.max(l.height,T.height);const u=bS(l,mS),f=o[0].timestamp,d=o[o.length-1].timestamp,p=n.maximum-n.minimum,m=(f-n.minimum)/p*i,y=(n.maximum-d)/p*i,S=(d-f)/p*i/(u.width+2*ur)|0,E=(d-f)/S,x=[];for(let T=0;f&&E&&T{const[y,v]=cs(),[S,E]=H.useState(),[x,T]=H.useState(),[C]=rn("actionsFilter",[]),{offsets:k,curtainLeft:$,curtainRight:V}=H.useMemo(()=>{let F=d||e;if(S&&S.startX!==S.endX){const Q=xn(y.width,e,S.startX),se=xn(y.width,e,S.endX);F={minimum:Math.min(Q,se),maximum:Math.max(Q,se)}}const ee=nn(y.width,e,F.minimum),z=nn(y.width,e,e.maximum)-nn(y.width,e,F.maximum);return{offsets:IN(y.width,e),curtainLeft:ee,curtainRight:z}},[d,e,S,y]),R=H.useMemo(()=>n==null?void 0:n.filteredActions(C),[n,C]),G=H.useMemo(()=>{const F=[];for(const ee of R||[])F.push({action:ee,leftTime:ee.startTime,rightTime:ee.endTime||e.maximum,leftPosition:nn(y.width,e,ee.startTime),rightPosition:nn(y.width,e,ee.endTime||e.maximum),active:!1,error:!!ee.error});for(const ee of(n==null?void 0:n.resources)||[]){const ve=ee._monotonicTime,z=ee._monotonicTime+ee.time;F.push({resource:ee,leftTime:ve,rightTime:z,leftPosition:nn(y.width,e,ve),rightPosition:nn(y.width,e,z),active:!1,error:!1})}for(const ee of i||[])F.push({consoleMessage:ee,leftTime:ee.timestamp,rightTime:ee.timestamp,leftPosition:nn(y.width,e,ee.timestamp),rightPosition:nn(y.width,e,ee.timestamp),active:!1,error:ee.isError});return F},[n,R,i,e,y]);H.useMemo(()=>{for(const F of G)o?F.active=F.action===o:u!==void 0?F.active=F.resource===(s==null?void 0:s[u]):f!==void 0?F.active=F.consoleMessage===(i==null?void 0:i[f]):F.active=!1},[G,o,u,f,i,s]);const Z=H.useCallback(F=>{if(T(void 0),!v.current)return;const ee=F.clientX-v.current.getBoundingClientRect().left,ve=xn(y.width,e,ee),z=d?nn(y.width,e,d.minimum):0,Q=d?nn(y.width,e,d.maximum):0;d&&Math.abs(ee-z)<10?E({startX:Q,endX:ee,type:"resize"}):d&&Math.abs(ee-Q)<10?E({startX:z,endX:ee,type:"resize"}):d&&ve>d.minimum&&ve{if(!v.current)return;const ee=F.clientX-v.current.getBoundingClientRect().left,ve=xn(y.width,e,ee),z=R==null?void 0:R.findLast(N=>N.startTime<=ve);if(!F.buttons){E(void 0);return}if(z&&l(z),!S)return;let Q=S;if(S.type==="resize")Q={...S,endX:ee};else{const N=ee-S.pivot;let P=S.startX+N,W=S.endX+N;P<0&&(P=0,W=P+(S.endX-S.startX)),W>y.width&&(W=y.width,P=W-(S.endX-S.startX)),Q={...S,startX:P,endX:W,pivot:ee}}E(Q);const se=xn(y.width,e,Q.startX),we=xn(y.width,e,Q.endX);se!==we&&p({minimum:Math.min(se,we),maximum:Math.max(se,we)})},[e,S,y,R,l,v,p]),j=H.useCallback(()=>{if(T(void 0),!!S){if(S.startX!==S.endX){const F=xn(y.width,e,S.startX),ee=xn(y.width,e,S.endX);p({minimum:Math.min(F,ee),maximum:Math.max(F,ee)})}else{const F=xn(y.width,e,S.startX),ee=R==null?void 0:R.findLast(ve=>ve.startTime<=F);ee&&l(ee),p(void 0)}E(void 0)}},[e,S,y,R,p,l]),ie=H.useCallback(F=>{if(!v.current)return;const ee=F.clientX-v.current.getBoundingClientRect().left,ve=xn(y.width,e,ee),z=R==null?void 0:R.findLast(Q=>Q.startTime<=ve);T({x:ee,clientY:F.clientY,action:z,sdkLanguage:m})},[e,y,R,v,m]),le=H.useCallback(()=>{T(void 0)},[]),I=H.useCallback(()=>{p(void 0)},[p]);return b.jsxs("div",{className:"timeline-view-container",children:[!!S&&b.jsx(l0,{cursor:(S==null?void 0:S.type)==="resize"?"ew-resize":"grab",onPaneMouseUp:j,onPaneMouseMove:q,onPaneDoubleClick:I}),b.jsxs("div",{ref:v,className:"timeline-view",onMouseDown:Z,onMouseMove:ie,onMouseLeave:le,children:[b.jsx("div",{className:"timeline-grid",children:k.map((F,ee)=>b.jsx("div",{className:"timeline-divider",style:{left:F.position+"px"},children:b.jsx("div",{className:"timeline-time",children:_t(F.time-e.minimum)})},ee))}),b.jsx("div",{style:{height:8}}),b.jsx(HN,{boundaries:e,previewPoint:x}),b.jsx("div",{className:"timeline-bars",children:G.filter(F=>!F.action||F.action.class!=="Test").map((F,ee)=>b.jsx("div",{className:Ye("timeline-bar",F.action&&"action",F.resource&&"network",F.consoleMessage&&"console-message",F.active&&"active",F.error&&"error"),style:{left:F.leftPosition,width:Math.max(5,F.rightPosition-F.leftPosition),top:VN(F),bottom:0}},ee))}),b.jsx("div",{className:"timeline-marker",style:{display:x!==void 0?"block":"none",left:((x==null?void 0:x.x)||0)+"px"}}),d&&b.jsxs("div",{className:"timeline-window",children:[b.jsx("div",{className:"timeline-window-curtain left",style:{width:$}}),b.jsx("div",{className:"timeline-window-resizer",style:{left:-5}}),b.jsx("div",{className:"timeline-window-center",children:b.jsx("div",{className:"timeline-window-drag"})}),b.jsx("div",{className:"timeline-window-resizer",style:{left:5}}),b.jsx("div",{className:"timeline-window-curtain right",style:{width:V}})]})]})]})};function IN(n,e){let s=n/64;const l=e.maximum-e.minimum,o=n/l;let u=l/s;const f=Math.ceil(Math.log(u)/Math.LN10);u=Math.pow(10,f),u*o>=320&&(u=u/5),u*o>=128&&(u=u/2);const d=e.minimum;let p=e.maximum;p+=64/o,s=Math.ceil((p-d)/u),u||(s=0);const m=[];for(let y=0;y{var i,s;if(!n)return b.jsx(b.Fragment,{});const e=n.wallTime!==void 0?new Date(n.wallTime).toLocaleString(void 0,{timeZoneName:"short"}):void 0;return b.jsxs("div",{style:{flex:"auto",display:"block",overflow:"hidden auto"},children:[b.jsx("div",{className:"call-section",style:{paddingTop:2},children:"Time"}),!!e&&b.jsxs("div",{className:"call-line",children:["start time:",b.jsx("span",{className:"call-value datetime",title:e,children:e})]}),b.jsxs("div",{className:"call-line",children:["duration:",b.jsx("span",{className:"call-value number",title:_t(n.endTime-n.startTime),children:_t(n.endTime-n.startTime)})]}),b.jsx("div",{className:"call-section",children:"Browser"}),b.jsxs("div",{className:"call-line",children:["engine:",b.jsx("span",{className:"call-value string",title:n.browserName,children:n.browserName})]}),n.channel&&b.jsxs("div",{className:"call-line",children:["channel:",b.jsx("span",{className:"call-value string",title:n.channel,children:n.channel})]}),n.platform&&b.jsxs("div",{className:"call-line",children:["platform:",b.jsx("span",{className:"call-value string",title:n.platform,children:n.platform})]}),n.playwrightVersion&&b.jsxs("div",{className:"call-line",children:["playwright version:",b.jsx("span",{className:"call-value string",title:n.playwrightVersion,children:n.playwrightVersion})]}),n.options.userAgent&&b.jsxs("div",{className:"call-line",children:["user agent:",b.jsx("span",{className:"call-value datetime",title:n.options.userAgent,children:n.options.userAgent})]}),n.options.baseURL&&b.jsxs(b.Fragment,{children:[b.jsx("div",{className:"call-section",style:{paddingTop:2},children:"Config"}),b.jsxs("div",{className:"call-line",children:["baseURL:",b.jsx("a",{className:"call-value string",href:n.options.baseURL,title:n.options.baseURL,target:"_blank",rel:"noopener noreferrer",children:n.options.baseURL})]})]}),b.jsx("div",{className:"call-section",children:"Viewport"}),n.options.viewport&&b.jsxs("div",{className:"call-line",children:["width:",b.jsx("span",{className:"call-value number",title:String(!!((i=n.options.viewport)!=null&&i.width)),children:n.options.viewport.width})]}),n.options.viewport&&b.jsxs("div",{className:"call-line",children:["height:",b.jsx("span",{className:"call-value number",title:String(!!((s=n.options.viewport)!=null&&s.height)),children:n.options.viewport.height})]}),b.jsxs("div",{className:"call-line",children:["is mobile:",b.jsx("span",{className:"call-value boolean",title:String(!!n.options.isMobile),children:String(!!n.options.isMobile)})]}),n.options.deviceScaleFactor&&b.jsxs("div",{className:"call-line",children:["device scale:",b.jsx("span",{className:"call-value number",title:String(n.options.deviceScaleFactor),children:String(n.options.deviceScaleFactor)})]}),b.jsx("div",{className:"call-section",children:"Counts"}),b.jsxs("div",{className:"call-line",children:["pages:",b.jsx("span",{className:"call-value number",children:n.pages.length})]}),b.jsxs("div",{className:"call-line",children:["actions:",b.jsx("span",{className:"call-value number",children:n.actions.length})]}),b.jsxs("div",{className:"call-line",children:["events:",b.jsx("span",{className:"call-value number",children:n.events.length})]})]})},KN=({annotations:n})=>n.length?b.jsx("div",{className:"annotations-tab",children:n.map((e,i)=>b.jsxs("div",{className:"annotation-item",children:[b.jsx("span",{style:{fontWeight:"bold"},children:e.type}),e.description&&b.jsxs("span",{children:[": ",u0(e.description)]})]},`annotation-${i}`))}):b.jsx(us,{text:"No annotations"}),YN=({sdkLanguage:n,isInspecting:e,setIsInspecting:i,highlightedElement:s,setHighlightedElement:l})=>{const[o,u]=H.useState(),f=H.useCallback(d=>{const{errors:p}=Kh(hS,d,{prettyErrors:!1}),m=p.map(y=>({message:y.message,line:y.range[1].line,column:y.range[1].col,type:"subtle-error"}));u(m),l({...s,ariaSnapshot:d,lastEdited:"ariaSnapshot"}),i(!1)},[s,l,i]);return b.jsxs("div",{style:{flex:"auto",backgroundColor:"var(--vscode-sideBar-background)",padding:"0 10px 10px 10px",overflow:"auto"},children:[b.jsxs("div",{className:"hbox",style:{lineHeight:"28px",color:"var(--vscode-editorCodeLens-foreground)"},children:[b.jsx("div",{children:"Locator"}),b.jsx(Dt,{style:{margin:"0 4px"},title:"Pick locator",icon:"target",toggled:e,onClick:()=>i(!e)}),b.jsx("div",{style:{flex:"auto"}}),b.jsx(Dt,{icon:"files",title:"Copy locator",onClick:()=>{wy(s.locator||"")}})]}),b.jsx("div",{style:{height:50},children:b.jsx(Sr,{text:s.locator||"",highlighter:n,isFocused:!0,wrapLines:!0,onChange:d=>{l({...s,locator:d,lastEdited:"locator"}),i(!1)}})}),b.jsxs("div",{className:"hbox",style:{lineHeight:"28px",color:"var(--vscode-editorCodeLens-foreground)"},children:[b.jsx("div",{style:{flex:"auto"},children:"Aria snapshot"}),b.jsx(Dt,{icon:"files",title:"Copy snapshot",onClick:()=>{wy(s.ariaSnapshot||"")}})]}),b.jsx("div",{style:{height:150},children:b.jsx(Sr,{text:s.ariaSnapshot||"",highlighter:"yaml",wrapLines:!1,highlight:o,onChange:f})})]})},XN=({className:n,style:e,open:i,isModal:s,minWidth:l,verticalOffset:o,requestClose:u,anchor:f,dataTestId:d,children:p})=>{const m=H.useRef(null),[y,v]=H.useState(0),[S]=mh(m),[E,x]=mh(f),T=PN(S,E,o);return H.useEffect(()=>{const C=$=>{!m.current||!($.target instanceof Node)||m.current.contains($.target)||u==null||u()},k=$=>{$.key==="Escape"&&(u==null||u())};return i?(document.addEventListener("mousedown",C),document.addEventListener("keydown",k),()=>{document.removeEventListener("mousedown",C),document.removeEventListener("keydown",k)}):()=>{}},[i,u]),H.useLayoutEffect(()=>x(),[i,x]),H.useEffect(()=>{const C=()=>v(k=>k+1);return window.addEventListener("resize",C),()=>{window.removeEventListener("resize",C)}},[]),H.useLayoutEffect(()=>{m.current&&(i?s?m.current.showModal():m.current.show():m.current.close())},[i,s]),b.jsx("dialog",{ref:m,style:{position:"fixed",margin:0,zIndex:110,top:T.top,left:T.left,minWidth:l||0,...e},className:n,"data-testid":d,children:p})};function PN(n,e,i=4,s=4){let l=Math.max(s,e.left);l+n.width>window.innerWidth-s&&(l=window.innerWidth-n.width-s);let o=Math.max(0,e.bottom)+i;return o+n.height>window.innerHeight-i&&(Math.max(0,e.top)>n.height+i?o=Math.max(0,e.top)-n.height-i:o=window.innerHeight-i-n.height),{left:l,top:o}}const FN=({title:n,icon:e,buttonChildren:i,anchorRef:s,dialogDataTestId:l,children:o})=>{const u=H.useRef(null),f=s??u,[d,p]=H.useState(!1);return b.jsxs(b.Fragment,{children:[b.jsx(Dt,{ref:u,icon:e,title:n,onClick:()=>p(m=>!m),children:i}),b.jsx(XN,{style:{backgroundColor:"var(--vscode-sideBar-background)",padding:"4px 8px"},open:d,verticalOffset:8,requestClose:()=>p(!1),anchor:f,dataTestId:l,children:o})]})},vS=({settings:n})=>b.jsx("div",{className:"vbox settings-view",children:n.map(e=>{const i=`setting-${e.name.replaceAll(/\s+/g,"-")}`;return b.jsx("div",{className:`setting setting-${e.type}`,title:e.title,children:QN(e,i)},e.name)})}),QN=(n,e)=>{switch(n.type){case"check":return b.jsxs(b.Fragment,{children:[b.jsx("input",{type:"checkbox",id:e,checked:n.value,onChange:()=>n.set(!n.value)}),b.jsxs("label",{htmlFor:e,children:[n.name,!!n.count&&b.jsx("span",{className:"setting-counter",children:n.count})]})]});case"select":return b.jsxs(b.Fragment,{children:[b.jsxs("label",{htmlFor:e,children:[n.name,":",!!n.count&&b.jsx("span",{className:"setting-counter",children:n.count})]}),b.jsx("select",{id:e,value:n.value,onChange:i=>n.set(i.target.value),children:n.options.map(i=>b.jsx("option",{value:i.value,children:i.label},i.value))})]});default:return null}},l2=n=>{var i;const e=((i=n.model)==null?void 0:i.traceUrl)??"default";return b.jsx(f0.Provider,{value:n.model,children:b.jsx(ZN,{partition:e,...n})})},ZN=n=>{var dl;const{partition:e,model:i,showSourcesFirst:s,rootDir:l,fallbackLocation:o,isLive:u,hideTimeline:f,status:d,annotations:p,inert:m,onOpenExternally:y,revealSource:v,testRunMetadata:S}=n,[E,x]=rn("navigatorTab","actions"),[T,C]=rn("propertiesTab",s?"source":"call"),[k,$]=rn("propertiesSidebarLocation","bottom"),[V]=rn("actionsFilter",[]),[R,G]=xi("selectedCallId"),[Z,q]=xi("selectedTime"),[j,ie]=xi("highlightedCallId"),[le,I]=xi("revealedErrorKey"),[F,ee]=xi("highlightedConsoleMessageOrdinal"),[ve,z]=xi("revealedAttachmentCallId"),[Q,se]=xi("highlightedResourceOrdinal"),[we,N]=xi("treeState",{expandedItems:new Map});H1(e);const[P,W]=H.useState({lastEdited:"none"}),[J,ae]=H.useState(!1),be=H.useCallback(ce=>{G(ce==null?void 0:ce.callId),I(void 0)},[G,I]),te=H.useMemo(()=>i==null?void 0:i.filteredActions(V),[i,V]),yt=((i==null?void 0:i.actions.length)??0)-((te==null?void 0:te.length)??0),Ne=H.useMemo(()=>te==null?void 0:te.find(ce=>ce.callId===j),[te,j]),Gt=H.useCallback(ce=>{ie(ce==null?void 0:ce.callId)},[ie]),jr=H.useMemo(()=>(i==null?void 0:i.sources)||new Map,[i]);H.useEffect(()=>{q(void 0),I(void 0)},[i,q,I]);const En=H.useMemo(()=>{if(R){const Jn=te==null?void 0:te.find(un=>un.callId===R);if(Jn)return Jn}const ce=i==null?void 0:i.failedAction();if(ce)return ce;if(te!=null&&te.length){let Jn=te.length-1;for(let un=0;unNe||En,[En,Ne]),ds=H.useCallback(ce=>{be(ce),Gt(void 0)},[be,Gt]),bt=H.useCallback(ce=>{C(ce),ce!=="inspector"&&ae(!1)},[C]),fl=H.useCallback(ce=>{!J&&ce&&bt("inspector"),ae(ce)},[ae,bt,J]),Mc=H.useCallback(ce=>{W(ce),bt("inspector")},[bt]),Kt=H.useCallback(ce=>{bt("attachments"),z({callId:ce})},[bt,z]);H.useEffect(()=>{v&&bt("source")},[v,bt]);const Lr=k_(i,Z),ps=eT(i,Z),Mi=T_(i),gs=H.useMemo(()=>{var ce;return le!==void 0?(ce=Mi.errors.get(le))==null?void 0:ce.stack:cn==null?void 0:cn.stack},[cn,le,Mi]),Qn=(i==null?void 0:i.sdkLanguage)||"javascript",hl={id:"inspector",title:"Locator",render:()=>b.jsx(YN,{sdkLanguage:Qn,isInspecting:J,setIsInspecting:fl,highlightedElement:P,setHighlightedElement:W})},Oc={id:"call",title:"Call",render:()=>b.jsx(Yx,{action:cn,startTimeOffset:(i==null?void 0:i.startTime)??0,sdkLanguage:Qn})},Rc={id:"log",title:"Log",render:()=>b.jsx(Fx,{action:cn,isLive:u})},Oi={id:"errors",title:"Errors",errorCount:Mi.errors.size,render:()=>b.jsx(A_,{errorsModel:Mi,testRunMetadata:S,sdkLanguage:Qn,revealInSource:ce=>{ce.action?be(ce.action):I(ce.message),bt("source")},wallTime:(i==null?void 0:i.wallTime)??0})};let ut;!En&&o&&(ut=(dl=o.source)==null?void 0:dl.errors.length);const Yt={id:"source",title:"Source",errorCount:ut,render:()=>b.jsx(w_,{stack:gs,sources:jr,rootDir:l,stackFrameLocation:k==="bottom"?"right":"bottom",fallbackLocation:o,onOpenExternally:y})},vt={id:"console",title:"Console",count:Lr.entries.length,render:()=>b.jsx(M_,{consoleModel:Lr,boundaries:Zn,selectedTime:Z,onAccepted:ce=>q({minimum:ce.timestamp,maximum:ce.timestamp}),onEntryHovered:ee})},jc={id:"network",title:"Network",count:ps.resources.length,render:()=>b.jsx(tT,{boundaries:Zn,networkModel:ps,onResourceHovered:se,sdkLanguage:(i==null?void 0:i.sdkLanguage)??"javascript"})},Lc={id:"attachments",title:"Attachments",count:i==null?void 0:i.visibleAttachments.length,render:()=>b.jsx(d_,{revealedAttachmentCallId:ve})},Ri=[hl,Oc,Rc,Oi,vt,jc,Yt,Lc];if(p!==void 0){const ce={id:"annotations",title:"Annotations",count:p.length,render:()=>b.jsx(KN,{annotations:p})};Ri.push(ce)}if(s){const ce=Ri.indexOf(Yt);Ri.splice(ce,1),Ri.splice(1,0,Yt)}const{boundaries:Zn}=H.useMemo(()=>{const ce={minimum:(i==null?void 0:i.startTime)||0,maximum:(i==null?void 0:i.endTime)||3e4};return ce.minimum>ce.maximum&&(ce.minimum=0,ce.maximum=3e4),ce.maximum+=(ce.maximum-ce.minimum)/20,{boundaries:ce}},[i]);let An=0;!u&&i&&i.endTime>=0?An=i.endTime-i.startTime:i&&i.wallTime&&(An=Date.now()-i.wallTime);const Nn={id:"actions",title:"Actions",component:b.jsxs("div",{className:"vbox",children:[d&&b.jsxs("div",{className:"workbench-run-status",children:[b.jsx("span",{className:Ye("codicon",r0(d))}),b.jsx("div",{children:Vx(d)}),b.jsx("div",{className:"spacer"}),b.jsx("div",{className:"workbench-run-duration",children:An?_t(An):""})]}),b.jsx(Kx,{sdkLanguage:Qn,actions:te||[],selectedAction:i?En:void 0,selectedTime:Z,setSelectedTime:q,treeState:we,setTreeState:N,onSelected:ds,onHighlighted:Gt,revealActionAttachment:Kt,revealConsole:()=>bt("console"),isLive:u})]})},ms={id:"metadata",title:"Metadata",component:b.jsx(GN,{model:i})},ji=E==="actions"&&b.jsx(JN,{counters:i==null?void 0:i.actionCounters,hiddenActionsCount:yt});return b.jsxs("div",{className:"vbox workbench",...m?{inert:!0}:{},children:[!f&&b.jsx($N,{model:i,consoleEntries:Lr.entries,networkResources:ps.resources,boundaries:Zn,highlightedAction:Ne,highlightedResourceOrdinal:Q,highlightedConsoleEntryOrdinal:F,onSelected:ds,sdkLanguage:Qn,selectedTime:Z,setSelectedTime:q}),b.jsx(Qo,{sidebarSize:250,orientation:k==="bottom"?"vertical":"horizontal",settingName:"propertiesSidebar",main:b.jsx(Qo,{sidebarSize:250,orientation:"horizontal",sidebarIsFirst:!0,settingName:"actionListSidebar",main:b.jsx(MN,{action:cn,model:i,sdkLanguage:Qn,testIdAttributeName:(i==null?void 0:i.testIdAttributeName)||"data-testid",isInspecting:J,setIsInspecting:fl,highlightedElement:P,setHighlightedElement:Mc}),sidebar:b.jsx(xh,{tabs:[Nn,ms],rightToolbar:[ji],selectedTab:E,setSelectedTab:x})}),sidebar:b.jsx(xh,{tabs:Ri,selectedTab:T,setSelectedTab:bt,rightToolbar:[k==="bottom"?b.jsx(Dt,{title:"Dock to right",icon:"layout-sidebar-right-off",onClick:()=>{$("right")}}):b.jsx(Dt,{title:"Dock to bottom",icon:"layout-panel-off",onClick:()=>{$("bottom")}})],mode:k==="bottom"?"default":"select"})})]})},JN=({counters:n,hiddenActionsCount:e})=>{const[i,s]=rn("actionsFilter",[]),l=H.useRef(null),o=b.jsxs(b.Fragment,{children:[e>0&&b.jsxs("span",{className:"workbench-actions-hidden-count",title:e+" actions hidden by filters",children:[e," hidden"]}),b.jsx("span",{ref:l,className:"codicon codicon-filter"})]});return b.jsx(FN,{title:"Filter actions",dialogDataTestId:"actions-filter-dialog",buttonChildren:o,anchorRef:l,children:b.jsx(vS,{settings:[{type:"check",value:i.includes("getter"),set:u=>s(u?[...i,"getter"]:i.filter(f=>f!=="getter")),name:"Getters",count:n==null?void 0:n.get("getter")},{type:"check",value:i.includes("route"),set:u=>s(u?[...i,"route"]:i.filter(f=>f!=="route")),name:"Network routes",count:n==null?void 0:n.get("route")},{type:"check",value:i.includes("configuration"),set:u=>s(u?[...i,"configuration"]:i.filter(f=>f!=="configuration")),name:"Configuration",count:n==null?void 0:n.get("configuration")}]})})};var Eb;(n=>{function e(i){for(const s of i.splice(0))s.dispose()}n.disposeAll=e})(Eb||(Eb={}));class lr{constructor(){this._listeners=new Set,this.event=(e,i)=>{this._listeners.add(e);let s=!1;const l=this,o={dispose(){s||(s=!0,l._listeners.delete(e))}};return i&&i.push(o),o}}fire(e){const i=!this._deliveryQueue;this._deliveryQueue||(this._deliveryQueue=[]);for(const s of this._listeners)this._deliveryQueue.push({listener:s,event:e});if(i){for(let s=0;se(i.data.toString()))}onopen(e){this._ws.addEventListener("open",e)}onerror(e){this._ws.addEventListener("error",e)}onclose(e){this._ws.addEventListener("close",e)}send(e){this._ws.send(e)}close(){this._ws.close()}}class c2{constructor(e){this._onCloseEmitter=new lr,this._onReportEmitter=new lr,this._onStdioEmitter=new lr,this._onTestFilesChangedEmitter=new lr,this._onLoadTraceRequestedEmitter=new lr,this._onTestPausedEmitter=new lr,this._lastId=0,this._callbacks=new Map,this._isClosed=!1,this.onClose=this._onCloseEmitter.event,this.onReport=this._onReportEmitter.event,this.onStdio=this._onStdioEmitter.event,this.onTestFilesChanged=this._onTestFilesChangedEmitter.event,this.onLoadTraceRequested=this._onLoadTraceRequestedEmitter.event,this.onTestPaused=this._onTestPausedEmitter.event,this._transport=e,this._transport.onmessage(s=>{const l=JSON.parse(s),{id:o,result:u,error:f,method:d,params:p}=l;if(o){const m=this._callbacks.get(o);if(!m)return;this._callbacks.delete(o),f?m.reject(new Error(f)):m.resolve(u)}else this._dispatchEvent(d,p)});const i=setInterval(()=>this._sendMessage("ping").catch(()=>{}),3e4);this._connectedPromise=new Promise((s,l)=>{this._transport.onopen(s),this._transport.onerror(l)}),this._transport.onclose(()=>{this._isClosed=!0,this._onCloseEmitter.fire(),clearInterval(i);for(const s of this._callbacks.values())s.reject(new WN);this._callbacks.clear()})}isClosed(){return this._isClosed}async _sendMessage(e,i){const s=globalThis.__logForTest;s==null||s({method:e,params:i}),await this._connectedPromise;const l=++this._lastId,o={id:l,method:e,params:i};return this._transport.send(JSON.stringify(o)),new Promise((u,f)=>{this._callbacks.set(l,{resolve:u,reject:f})})}_sendMessageNoReply(e,i){this._sendMessage(e,i).catch(()=>{})}_dispatchEvent(e,i){e==="report"?this._onReportEmitter.fire(i):e==="stdio"?this._onStdioEmitter.fire(i):e==="testFilesChanged"?this._onTestFilesChangedEmitter.fire(i):e==="loadTraceRequested"?this._onLoadTraceRequestedEmitter.fire(i):e==="testPaused"&&this._onTestPausedEmitter.fire(i)}async initialize(e){await this._sendMessage("initialize",e)}async ping(e){await this._sendMessage("ping",e)}async pingNoReply(e){this._sendMessageNoReply("ping",e)}async watch(e){await this._sendMessage("watch",e)}watchNoReply(e){this._sendMessageNoReply("watch",e)}async open(e){await this._sendMessage("open",e)}openNoReply(e){this._sendMessageNoReply("open",e)}async resizeTerminal(e){await this._sendMessage("resizeTerminal",e)}resizeTerminalNoReply(e){this._sendMessageNoReply("resizeTerminal",e)}async checkBrowsers(e){return await this._sendMessage("checkBrowsers",e)}async installBrowsers(e){await this._sendMessage("installBrowsers",e)}async runGlobalSetup(e){return await this._sendMessage("runGlobalSetup",e)}async runGlobalTeardown(e){return await this._sendMessage("runGlobalTeardown",e)}async startDevServer(e){return await this._sendMessage("startDevServer",e)}async stopDevServer(e){return await this._sendMessage("stopDevServer",e)}async clearCache(e){return await this._sendMessage("clearCache",e)}async listFiles(e){return await this._sendMessage("listFiles",e)}async listTests(e){return await this._sendMessage("listTests",e)}async runTests(e){return await this._sendMessage("runTests",e)}async findRelatedTestFiles(e){return await this._sendMessage("findRelatedTestFiles",e)}async stopTests(e){await this._sendMessage("stopTests",e)}stopTestsNoReply(e){this._sendMessageNoReply("stopTests",e)}async closeGracefully(e){await this._sendMessage("closeGracefully",e)}close(){try{this._transport.close()}catch{}}}const u2=({location:n})=>{const[e,i]=rn("shouldPopulateCanvasFromScreenshot",!1),[s,l]=V1(),[o,u]=rn("mergeFiles",!1);return b.jsx(vS,{settings:[{type:"check",value:s,set:l,name:"Dark mode"},...n==="ui-mode"?[{type:"check",value:o,set:u,name:"Merge files"}]:[],{type:"check",value:e,set:i,name:"Display canvas content",title:"Attempt to display the captured canvas appearance in the snapshot preview. May not be accurate."}]})};export{FN as D,c0 as E,r2 as M,gt as R,Qo as S,c2 as T,o2 as W,s_ as _,u2 as a,l2 as b,XN as c,t2 as d,s2 as e,bh as f,n2 as g,i2 as h,Ye as i,b as j,$x as k,Gh as l,_t as m,Dt as n,rn as o,vS as p,L1 as q,H as r,es as s,r0 as t,cs as u};