shiplightai 0.1.64 → 0.1.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -133,17 +133,17 @@ To use them, write Jinja-like template syntax: {{ placeholder_name }}
133
133
  `}if(n&&n.length>0){let p=Ul(n);m+=`
134
134
  `+p}return m+=`
135
135
  Based on the above information, please determine the right action to accomplish the task.
136
- `,d.push({type:"text",text:m}),d}var vi=v(()=>{"use strict";dt()});async function jl(e){let t=e.context().pages(),i=null,n=[];for(let o=0;o<t.length;o++){let r=t[o];r===e&&(i=o);let l="(title unavailable)";try{l=await Promise.race([r.title(),new Promise((c,d)=>setTimeout(()=>d(new Error("timeout")),1e3))])}catch{}let s=`Tab ${o}: ${r.url()}`;l&&(s+=` - ${l.slice(0,50)}`),n.push(s)}let a=n.length>0?n.join(`
136
+ `,d.push({type:"text",text:m}),d}var vi=v(()=>{"use strict";dt()});function xi(e,t){return e?{prompt_tokens:e.promptTokens||e.inputTokens||0,completion_tokens:e.completionTokens||e.outputTokens||0,total_tokens:e.totalTokens||0,model:t}:null}var ut=v(()=>{"use strict"});async function jl(e){let t=e.context().pages(),i=null,n=[];for(let o=0;o<t.length;o++){let r=t[o];r===e&&(i=o);let l="(title unavailable)";try{l=await Promise.race([r.title(),new Promise((c,d)=>setTimeout(()=>d(new Error("timeout")),1e3))])}catch{}let s=`Tab ${o}: ${r.url()}`;l&&(s+=` - ${l.slice(0,50)}`),n.push(s)}let a=n.length>0?n.join(`
137
137
  `):"";return{currentTabText:i!==null?`Current tab: ${i}
138
- `:"",tabsText:a}}async function Bl(e,t){let{currentTabText:i,tabsText:n}=await jl(e);return{elementsText:t,currentUrl:e.url(),currentTitle:await e.title(),currentTabText:i,tabsText:n}}async function xi(e,t){let{page:i,domService:n,agentServices:a}=e,o=typeof t=="boolean"?{useCleanScreenshot:t}:t||{},r=a.getInteractiveClassNames(),l=a.getIframeFallbackDomains(),{domState:s,screenshotBase64:c,slicedScreenshotsBase64:d}=await n.getClickableElementsWithScreenshot(i,{interactiveClassNames:r,playwrightFrameFallbackDomains:l,useCleanScreenshot:o.useCleanScreenshot,useSlicedScreenshots:o.useSlicedScreenshots,resizeSlicedScreenshots:o.resizeSlicedScreenshots,useAccessibilityTree:o.useAccessibilityTree,actionIntent:o.actionIntent}),u=s.elementTree.clickableElementsToString(),m=await Bl(i,u);return d&&(m.slicedScreenshotsBase64=d),{domTree:u,screenshotBase64:c,slicedScreenshotsBase64:d,domState:s,pageContext:m}}var ut=v(()=>{"use strict"});function _i(e,t){return e?{prompt_tokens:e.promptTokens||e.inputTokens||0,completion_tokens:e.completionTokens||e.outputTokens||0,total_tokens:e.totalTokens||0,model:t}:null}var ht=v(()=>{"use strict"});import{z as le}from"zod";var Mn,U,xe=v(()=>{"use strict";Mn=class{constructor(){this.tools=new Map}register(e){if(this.tools.has(e.name))throw new Error(`Tool '${e.name}' is already registered`);let t={name:e.name,description:e.description,schema:e.schema,execute:e.execute,usesElementIndex:e.usesElementIndex??!1,availability:{openai:e.availability?.openai??!0,mcp:e.availability?.mcp??!0}};this.tools.set(e.name,t)}get(e){return this.tools.get(e)}has(e){return this.tools.has(e)}getToolNames(){return Array.from(this.tools.keys())}getTools(){return Array.from(this.tools.values())}async execute(e,t,i){let n=this.tools.get(e);if(!n)throw new Error(`Tool not found: ${e}`);try{let a=t?.description,o={...t};delete o.description;let r=n.schema.parse(o),l={...i,actionDescription:a};return await n.execute(r,l)}catch(a){if(a instanceof le.ZodError){let o=a.issues.map(r=>`${r.path.join(".")}: ${r.message}`).join(", ");return{success:!1,error:`Invalid arguments for tool '${e}': ${o}`,actionEntity:{action_description:t?.description||`${e} (validation failed)`,action_data:{action_name:e,kwargs:t},feedback:`Validation error: ${o}`}}}throw a}}clear(){this.tools.clear()}size(){return this.tools.size}buildActionUnionSchema(){let e=this.getTools().filter(t=>t.availability.openai);return this.buildUnionSchemaFromTools(e)}buildActionUnionSchemaForTools(e,t=!1){let i=new Set(e),n=this.getTools().filter(a=>i.has(a.name));return this.buildUnionSchemaFromTools(n,t)}buildUnionSchemaFromTools(e,t=!1){if(e.length===0)return le.object({done:le.any()});let i=e.map(r=>{let l=r.schema;if(t&&l instanceof le.ZodObject){let s=l._def.shape();l=le.object({...s,description:le.string().describe("Semantic, human-readable description of the action")})}if(l instanceof le.ZodObject){let s=l._def.shape();Object.keys(s).length===0&&(l=le.object({_empty:le.boolean().optional()}))}return le.object({[r.name]:l})});if(i.length===1)return i[0];let[n,a,...o]=i;return le.union([n,a,...o])}},U=new Mn});async function j(e,t){if(t<0)return;let{page:i,domService:n}=e;return(e.domState||await n.getClickableElements(i)).selectorMap.get(t)}function Gl(e){let t=e.split("/").filter(a=>a);if(t.length===0)return"*";let i=t[t.length-1],n=i.match(/^(\w+)(?:\[(\d+)\])?$/);if(n){let[,a,o]=n;return o?`${a}:nth-of-type(${o})`:a}return i}function Kl(e,t=!0){try{let i=Gl(e.xpath);if(e.attributes.class&&t){let a=/^[a-zA-Z_][a-zA-Z0-9_-]*$/,o=e.attributes.class.split(/\s+/);for(let r of o)r.trim()&&a.test(r)&&(i+=`.${r}`)}let n=new Set(["id","name","type","placeholder","aria-label","aria-labelledby","aria-describedby","role","for","autocomplete","required","readonly","alt","title","target"]);t&&["data-id","data-qa","data-cy","data-testid","data-handlepos"].forEach(a=>n.add(a));for(let[a,o]of Object.entries(e.attributes)){if(a==="class"||!a.trim()||!n.has(a))continue;let r=a.replace(/:/g,"\\:");if(o==="")i+=`[${r}]`;else if(/["'<>`\n\r\t]/.test(o)){let l=o;o.includes(`
138
+ `:"",tabsText:a}}async function Bl(e,t){let{currentTabText:i,tabsText:n}=await jl(e);return{elementsText:t,currentUrl:e.url(),currentTitle:await e.title(),currentTabText:i,tabsText:n}}async function _i(e,t){let{page:i,domService:n,agentServices:a}=e,o=typeof t=="boolean"?{useCleanScreenshot:t}:t||{},r=a.getInteractiveClassNames(),l=a.getIframeFallbackDomains(),{domState:s,screenshotBase64:c,slicedScreenshotsBase64:d}=await n.getClickableElementsWithScreenshot(i,{interactiveClassNames:r,playwrightFrameFallbackDomains:l,useCleanScreenshot:o.useCleanScreenshot,useSlicedScreenshots:o.useSlicedScreenshots,resizeSlicedScreenshots:o.resizeSlicedScreenshots,useAccessibilityTree:o.useAccessibilityTree,actionIntent:o.actionIntent}),u=s.elementTree.clickableElementsToString(),m=await Bl(i,u);return d&&(m.slicedScreenshotsBase64=d),{domTree:u,screenshotBase64:c,slicedScreenshotsBase64:d,domState:s,pageContext:m}}var ht=v(()=>{"use strict"});import{z as le}from"zod";var Mn,U,xe=v(()=>{"use strict";Mn=class{constructor(){this.tools=new Map}register(e){if(this.tools.has(e.name))throw new Error(`Tool '${e.name}' is already registered`);let t={name:e.name,description:e.description,schema:e.schema,execute:e.execute,usesElementIndex:e.usesElementIndex??!1,availability:{openai:e.availability?.openai??!0,mcp:e.availability?.mcp??!0}};this.tools.set(e.name,t)}get(e){return this.tools.get(e)}has(e){return this.tools.has(e)}getToolNames(){return Array.from(this.tools.keys())}getTools(){return Array.from(this.tools.values())}async execute(e,t,i){let n=this.tools.get(e);if(!n)throw new Error(`Tool not found: ${e}`);try{let a=t?.description,o={...t};delete o.description;let r=n.schema.parse(o),l={...i,actionDescription:a};return await n.execute(r,l)}catch(a){if(a instanceof le.ZodError){let o=a.issues.map(r=>`${r.path.join(".")}: ${r.message}`).join(", ");return{success:!1,error:`Invalid arguments for tool '${e}': ${o}`,actionEntity:{action_description:t?.description||`${e} (validation failed)`,action_data:{action_name:e,kwargs:t},feedback:`Validation error: ${o}`}}}throw a}}clear(){this.tools.clear()}size(){return this.tools.size}buildActionUnionSchema(){let e=this.getTools().filter(t=>t.availability.openai);return this.buildUnionSchemaFromTools(e)}buildActionUnionSchemaForTools(e,t=!1){let i=new Set(e),n=this.getTools().filter(a=>i.has(a.name));return this.buildUnionSchemaFromTools(n,t)}buildUnionSchemaFromTools(e,t=!1){if(e.length===0)return le.object({done:le.any()});let i=e.map(r=>{let l=r.schema;if(t&&l instanceof le.ZodObject){let s=l._def.shape();l=le.object({...s,description:le.string().describe("Semantic, human-readable description of the action")})}if(l instanceof le.ZodObject){let s=l._def.shape();Object.keys(s).length===0&&(l=le.object({_empty:le.boolean().optional()}))}return le.object({[r.name]:l})});if(i.length===1)return i[0];let[n,a,...o]=i;return le.union([n,a,...o])}},U=new Mn});async function j(e,t){if(t<0)return;let{page:i,domService:n}=e;return(e.domState||await n.getClickableElements(i)).selectorMap.get(t)}function Gl(e){let t=e.split("/").filter(a=>a);if(t.length===0)return"*";let i=t[t.length-1],n=i.match(/^(\w+)(?:\[(\d+)\])?$/);if(n){let[,a,o]=n;return o?`${a}:nth-of-type(${o})`:a}return i}function Kl(e,t=!0){try{let i=Gl(e.xpath);if(e.attributes.class&&t){let a=/^[a-zA-Z_][a-zA-Z0-9_-]*$/,o=e.attributes.class.split(/\s+/);for(let r of o)r.trim()&&a.test(r)&&(i+=`.${r}`)}let n=new Set(["id","name","type","placeholder","aria-label","aria-labelledby","aria-describedby","role","for","autocomplete","required","readonly","alt","title","target"]);t&&["data-id","data-qa","data-cy","data-testid","data-handlepos"].forEach(a=>n.add(a));for(let[a,o]of Object.entries(e.attributes)){if(a==="class"||!a.trim()||!n.has(a))continue;let r=a.replace(/:/g,"\\:");if(o==="")i+=`[${r}]`;else if(/["'<>`\n\r\t]/.test(o)){let l=o;o.includes(`
139
139
  `)&&(l=o.split(`
140
- `)[0]),l=l.replace(/\s+/g," ").trim();let s=l.replace(/"/g,'\\"');i+=`[${r}*="${s}"]`}else i+=`[${r}="${o}"]`}return i}catch{return`${e.tagName||"*"}[highlight_index='${e.highlightIndex}']`}}function zl(e){let t=e.attributes;if(t.title)return`iframe[title="${t.title.replace(/"/g,'\\"')}"]`;if(t.id)return`iframe#${t.id}`;if(t.name)return`iframe[name="${t.name.replace(/"/g,'\\"')}"]`;if(t.src){try{let i=new URL(t.src);if(i.protocol==="chrome-extension:")return`iframe[src^="${i.origin}"]`}catch{}return`iframe[src="${t.src.replace(/"/g,'\\"')}"]`}return Kl(e,!1)}function Va(e){let t=[],i=e;for(;i&&i.parent!==null;){let o=i.parent;t.push(o),i=o}t.reverse();let n=[],a=t.filter(o=>o.tagName==="iframe");for(let o of a){let r=zl(o);w.debug("[frame-path] iframe attrs:",JSON.stringify(o.attributes),"\u2192",r),n.push(r)}return n}async function R(e,t){let i=null,n=Va(t);return t.xpath&&(i=await En(e,t.xpath,n,t.shadowHostXPaths??[])),{locator:i||void 0,xpath:i?void 0:t.xpath,frame_path:n}}var K=v(()=>{"use strict";Oe();W()});import{generateText as Vl,Output as Xl}from"ai";import{z as ki}from"zod";function Yl(e){let t=e.toLowerCase();return[/\b(type|enter|input|fill|write|set)\b/,/\b(text|value|field|box)\b.*\b(to|with|as)\b/,/\b(username|password|email|search|query)\b/].some(i=>i.test(t))?"input":[/\bscroll\b/,/\b(scroll|swipe)\s*(up|down|left|right)\b/,/\b(page|move)\s*(down|up)\b/].some(i=>i.test(t))?"scroll":[/\b(click|tap|press|select|choose|pick|check|toggle)\b/,/\b(open|close|submit|confirm|cancel|dismiss)\b/,/\b(button|link|menu|dropdown|checkbox|radio)\b/].some(i=>i.test(t))?"click":"all"}function Jl(e){if(!e)return null;if(e instanceof URL)return e.href;if(typeof e=="object"&&e.href)return String(e.href);if(typeof e=="object"&&typeof e.toString=="function"){let t=e.toString();if(t.startsWith("http://")||t.startsWith("https://"))return t}return typeof e=="string"&&(e.startsWith("http://")||e.startsWith("https://"))?e:null}function ql(e){return e.map(t=>({role:t.role,content:Array.isArray(t.content)?t.content.map(i=>{if(i.type==="image"){let n=i.image,a=Jl(n);if(a)return{type:"image",file:a};let o=typeof n=="string"?n:"";return{type:"image",file:o.startsWith("data:")?o:`data:image/png;base64,${o}`}}return{type:"text",text:i.text}}):t.content}))}async function Xa(e,t,i={}){let{page:n,agentServices:a}=t,o=a.getModel(),r=i.temperature??0,l=a.retrieveKnowledges(e).catch(X=>(S.log(`Failed to retrieve knowledges: ${X.message}`),[])),s=a.isSlicedScreenshotsEnabled(),c=a.isResizeSlicedScreenshotsEnabled(),d=a.isKnowledgeImagesEnabled(),u=a.isAccessibilityTreeEnabled(),m=a.isActionIntentFilteringEnabled(),p=m?Yl(e):"all";m&&p!=="all"&&S.log(`Action intent filtering: detected '${p}' intent from statement`);let{screenshotBase64:g,domState:f,pageContext:b}=await xi(t,{useSlicedScreenshots:s,resizeSlicedScreenshots:c,useAccessibilityTree:u,actionIntent:p});t.domState=f;let h=new yn(U).getToolDefinitions().map(X=>{let Ue=X.function;return`${Ue.name}: ${Ue.description}
140
+ `)[0]),l=l.replace(/\s+/g," ").trim();let s=l.replace(/"/g,'\\"');i+=`[${r}*="${s}"]`}else i+=`[${r}="${o}"]`}return i}catch{return`${e.tagName||"*"}[highlight_index='${e.highlightIndex}']`}}function zl(e){let t=e.attributes;if(t.title)return`iframe[title="${t.title.replace(/"/g,'\\"')}"]`;if(t.id)return`iframe#${t.id}`;if(t.name)return`iframe[name="${t.name.replace(/"/g,'\\"')}"]`;if(t.src){try{let i=new URL(t.src);if(i.protocol==="chrome-extension:")return`iframe[src^="${i.origin}"]`}catch{}return`iframe[src="${t.src.replace(/"/g,'\\"')}"]`}return Kl(e,!1)}function Va(e){let t=[],i=e;for(;i&&i.parent!==null;){let o=i.parent;t.push(o),i=o}t.reverse();let n=[],a=t.filter(o=>o.tagName==="iframe");for(let o of a){let r=zl(o);w.debug("[frame-path] iframe attrs:",JSON.stringify(o.attributes),"\u2192",r),n.push(r)}return n}async function R(e,t){let i=null,n=Va(t);return t.xpath&&(i=await En(e,t.xpath,n,t.shadowHostXPaths??[])),{locator:i||void 0,xpath:i?void 0:t.xpath,frame_path:n}}var K=v(()=>{"use strict";Oe();W()});import{generateText as Vl,Output as Xl}from"ai";import{z as ki}from"zod";function Yl(e){let t=e.toLowerCase();return[/\b(type|enter|input|fill|write|set)\b/,/\b(text|value|field|box)\b.*\b(to|with|as)\b/,/\b(username|password|email|search|query)\b/].some(i=>i.test(t))?"input":[/\bscroll\b/,/\b(scroll|swipe)\s*(up|down|left|right)\b/,/\b(page|move)\s*(down|up)\b/].some(i=>i.test(t))?"scroll":[/\b(click|tap|press|select|choose|pick|check|toggle)\b/,/\b(open|close|submit|confirm|cancel|dismiss)\b/,/\b(button|link|menu|dropdown|checkbox|radio)\b/].some(i=>i.test(t))?"click":"all"}function Jl(e){if(!e)return null;if(e instanceof URL)return e.href;if(typeof e=="object"&&e.href)return String(e.href);if(typeof e=="object"&&typeof e.toString=="function"){let t=e.toString();if(t.startsWith("http://")||t.startsWith("https://"))return t}return typeof e=="string"&&(e.startsWith("http://")||e.startsWith("https://"))?e:null}function ql(e){return e.map(t=>({role:t.role,content:Array.isArray(t.content)?t.content.map(i=>{if(i.type==="image"){let n=i.image,a=Jl(n);if(a)return{type:"image",file:a};let o=typeof n=="string"?n:"";return{type:"image",file:o.startsWith("data:")?o:`data:image/png;base64,${o}`}}return{type:"text",text:i.text}}):t.content}))}async function Xa(e,t,i={}){let{page:n,agentServices:a}=t,o=a.getModel(),r=i.temperature??0,l=a.retrieveKnowledges(e).catch(X=>(S.log(`Failed to retrieve knowledges: ${X.message}`),[])),s=a.isSlicedScreenshotsEnabled(),c=a.isResizeSlicedScreenshotsEnabled(),d=a.isKnowledgeImagesEnabled(),u=a.isAccessibilityTreeEnabled(),m=a.isActionIntentFilteringEnabled(),p=m?Yl(e):"all";m&&p!=="all"&&S.log(`Action intent filtering: detected '${p}' intent from statement`);let{screenshotBase64:g,domState:f,pageContext:b}=await _i(t,{useSlicedScreenshots:s,resizeSlicedScreenshots:c,useAccessibilityTree:u,actionIntent:p});t.domState=f;let h=new yn(U).getToolDefinitions().map(X=>{let Ue=X.function;return`${Ue.name}: ${Ue.description}
141
141
  Parameters: ${JSON.stringify(Ue.parameters,null,2)}`}).join(`
142
142
 
143
- `),y=Ka(h),x=await l,E=za(b,e,t.variables,t.executionHistory,x.length>0?x:void 0,g,s,void 0,d,t.sensitiveKeys),A=[];i.chatHistory&&i.chatHistory.length>0&&i.chatHistory.forEach(X=>{X.role==="user"?A.push({role:"user",content:X.content}):X.role==="assistant"&&A.push({role:"assistant",content:X.content})}),A.push({role:"user",content:E});let $=ql(A),D=U.buildActionUnionSchema(),F=ki.object({thought:ki.string().describe("Step by step reasoning of your decision making process").optional().default(""),description:ki.string().describe("Detailed description of the action to be performed").optional().default(""),action:D,completes_instruction:ki.boolean().describe("Whether this action completes the given instruction").optional().default(!0)}),L=Array.isArray(E)?E.filter(X=>X.type==="image").length:0,V=ye(o,L),Z=await Vl({model:be(o),system:y,messages:A,temperature:r,output:Xl.object({schema:F}),providerOptions:V}),pe=Z.reasoningText;w.info(`Action Generation Reasoning: ${pe}`);let z=Z.output,Y=JSON.stringify(z,null,2);w.info(`Generate Action Raw Output: ${Y}`);let ge=[],Ne=_i(Z.usage,o);Ne&&ge.push(Ne);let Ee={systemPrompt:y,userPrompt:$,rawLlmResponse:Y,tokenUsages:ge},Te=z.thought||"",Ae=z.description||"",B=z.action||{},J=z.completes_instruction||!1;if(!B||Object.keys(B).length===0)return{status:"error",reasoning:Te||Ae||"No action generated",goalAccomplished:J,error:"Agent did not generate any action",debugInfo:Ee};let q=Object.keys(B)[0];if(q==="done")return{status:"error",reasoning:Te||Ae||"Task marked as done",goalAccomplished:J,error:"Agent indicated task is done without generating an action",debugInfo:Ee};if(q==="perform_accurate_operation")return await Ke(e,t,i);if(!J){let X="Can't complete the instruction in one action";return{status:"error",reasoning:Te||Ae||X,goalAccomplished:!1,error:X,debugInfo:Ee}}let se=B[q]||{},ga={};if(typeof se.element_index=="number"){let X=se.element_index;if(X<0)return{status:"error",reasoning:Te||Ae||"No action generated",goalAccomplished:J,error:"Agent did not generate any action",debugInfo:Ee};let Ue=f.selectorMap.get(X);Ue&&(ga=await R(n,Ue))}let fa=Ae;return q==="verify"&&(fa=e,se.statement=e),{status:"success",actionEntity:{...ga,action_description:fa||Te||`${q}(${JSON.stringify(se)})`,action_data:{action_name:q,kwargs:se}},reasoning:Te||Ae,goalAccomplished:J,debugInfo:Ee}}var Si=v(()=>{"use strict";ci();ze();vi();ut();ht();xe();te();ve();K();W()});import{generateText as Zl,Output as Ql}from"ai";import{z as Ei}from"zod";function ec(e){if(!e)return null;if(e instanceof URL)return e.href;if(typeof e=="object"&&e.href)return String(e.href);if(typeof e=="object"&&typeof e.toString=="function"){let t=e.toString();if(t.startsWith("http://")||t.startsWith("https://"))return t}return typeof e=="string"&&(e.startsWith("http://")||e.startsWith("https://"))?e:null}async function In(e,t,i={}){return i.usePureVision?Ke(e,t,i):Xa(e,t,i)}function ic(){let e=new Date,t=e.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric",timeZone:"America/Los_Angeles"}),i=e.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3,timeZoneName:"short",timeZone:"America/Los_Angeles"});return{dateString:t,timeString:i}}function nc(){return`# Role
143
+ `),y=Ka(h),x=await l,E=za(b,e,t.variables,t.executionHistory,x.length>0?x:void 0,g,s,void 0,d,t.sensitiveKeys),A=[];i.chatHistory&&i.chatHistory.length>0&&i.chatHistory.forEach(X=>{X.role==="user"?A.push({role:"user",content:X.content}):X.role==="assistant"&&A.push({role:"assistant",content:X.content})}),A.push({role:"user",content:E});let $=ql(A),D=U.buildActionUnionSchema(),F=ki.object({thought:ki.string().describe("Step by step reasoning of your decision making process").optional().default(""),description:ki.string().describe("Detailed description of the action to be performed").optional().default(""),action:D,completes_instruction:ki.boolean().describe("Whether this action completes the given instruction").optional().default(!0)}),L=Array.isArray(E)?E.filter(X=>X.type==="image").length:0,V=ye(o,L),Z=await Vl({model:be(o),system:y,messages:A,temperature:r,output:Xl.object({schema:F}),providerOptions:V}),pe=Z.reasoningText;w.info(`Action Generation Reasoning: ${pe}`);let z=Z.output,Y=JSON.stringify(z,null,2);w.info(`Generate Action Raw Output: ${Y}`);let ge=[],Ne=xi(Z.usage,o);Ne&&ge.push(Ne);let Ee={systemPrompt:y,userPrompt:$,rawLlmResponse:Y,tokenUsages:ge},Te=z.thought||"",Ae=z.description||"",B=z.action||{},J=z.completes_instruction||!1;if(!B||Object.keys(B).length===0)return{status:"error",reasoning:Te||Ae||"No action generated",goalAccomplished:J,error:"Agent did not generate any action",debugInfo:Ee};let q=Object.keys(B)[0];if(q==="done")return{status:"error",reasoning:Te||Ae||"Task marked as done",goalAccomplished:J,error:"Agent indicated task is done without generating an action",debugInfo:Ee};if(q==="perform_accurate_operation")return await Ke(e,t,i);if(!J){let X="Can't complete the instruction in one action";return{status:"error",reasoning:Te||Ae||X,goalAccomplished:!1,error:X,debugInfo:Ee}}let se=B[q]||{},ga={};if(typeof se.element_index=="number"){let X=se.element_index;if(X<0)return{status:"error",reasoning:Te||Ae||"No action generated",goalAccomplished:J,error:"Agent did not generate any action",debugInfo:Ee};let Ue=f.selectorMap.get(X);Ue&&(ga=await R(n,Ue))}let fa=Ae;return q==="verify"&&(fa=e,se.statement=e),{status:"success",actionEntity:{...ga,action_description:fa||Te||`${q}(${JSON.stringify(se)})`,action_data:{action_name:q,kwargs:se}},reasoning:Te||Ae,goalAccomplished:J,debugInfo:Ee}}var Si=v(()=>{"use strict";ci();ze();vi();ut();ht();xe();te();ve();K();W()});import{generateText as Zl,Output as Ql}from"ai";import{z as Ei}from"zod";function ec(e){if(!e)return null;if(e instanceof URL)return e.href;if(typeof e=="object"&&e.href)return String(e.href);if(typeof e=="object"&&typeof e.toString=="function"){let t=e.toString();if(t.startsWith("http://")||t.startsWith("https://"))return t}return typeof e=="string"&&(e.startsWith("http://")||e.startsWith("https://"))?e:null}async function In(e,t,i={}){return i.usePureVision?Ke(e,t,i):Xa(e,t,i)}function ic(){let e=new Date,t=e.toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric",timeZone:"America/Los_Angeles"}),i=e.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3,timeZoneName:"short",timeZone:"America/Los_Angeles"});return{dateString:t,timeString:i}}function nc(){return`# Role
144
144
  You are an experienced QA person for web applications.
145
145
  You are tasked to verify the validity of a given statement based on the screenshot and element tree of a web page.
146
- `}async function Ya(e,t,i={}){let{page:n,executionHistory:a}=t,o=t.agentServices.getModel();try{let r=t.agentServices.isSlicedScreenshotsEnabled(),l=t.agentServices.isResizeSlicedScreenshotsEnabled(),s=t.agentServices.isKnowledgeImagesEnabled(),c=t.agentServices.isAccessibilityTreeEnabled(),{domTree:d,screenshotBase64:u,slicedScreenshotsBase64:m,domState:p,pageContext:g}=await xi(t,{useCleanScreenshot:i.useCleanScreenshotForAssertion,useSlicedScreenshots:r,resizeSlicedScreenshots:l,useAccessibilityTree:c});t.domState=p;let f="";a&&a.length>0&&(f=`
146
+ `}async function Ya(e,t,i={}){let{page:n,executionHistory:a}=t,o=t.agentServices.getModel();try{let r=t.agentServices.isSlicedScreenshotsEnabled(),l=t.agentServices.isResizeSlicedScreenshotsEnabled(),s=t.agentServices.isKnowledgeImagesEnabled(),c=t.agentServices.isAccessibilityTreeEnabled(),{domTree:d,screenshotBase64:u,slicedScreenshotsBase64:m,domState:p,pageContext:g}=await _i(t,{useCleanScreenshot:i.useCleanScreenshotForAssertion,useSlicedScreenshots:r,resizeSlicedScreenshots:l,useAccessibilityTree:c});t.domState=p;let f="";a&&a.length>0&&(f=`
147
147
  # Previous actions in this session:
148
148
  ${a.map(([B,J],q)=>`${q+1}. Action: ${B}
149
149
  Result: ${J}`).join(`
@@ -177,7 +177,7 @@ ${f}
177
177
 
178
178
  Today is ${b}. Current local time is ${h}.
179
179
  Based on the above information, please determine if the statement is true.
180
- `,A=await t.agentServices.retrieveKnowledges(e),$=[{type:"text",text:y}],D=0;if(r&&m&&m.length>0)for(let B of m)$.push({type:"image",image:B}),D++;else $.push({type:"image",image:u}),D=1;if(A&&A.length>0){let B=yi(A,s);$.push(...B)}$.push({type:"text",text:E});let F=A?Ga(A,s):0,L=D+F,V=ye(o,L),Z=nc(),pe=await Zl({model:be(o),system:Z,messages:[{role:"user",content:$}],output:Ql.object({schema:tc}),temperature:0,providerOptions:V}),{conclusion:z,explanation:Y}=pe.output,ge=JSON.stringify(pe.output,null,2),Ne=[],Ee=_i(pe.usage,o);Ee&&Ne.push(Ee);let Te=[{role:"user",content:$.map(B=>{if(B.type==="text")return{type:"text",text:B.text};if(B.type==="image"){let J=B.image,q=ec(J);if(q)return{type:"image",file:q};let se=typeof J=="string"?J:"";return{type:"image",file:se.startsWith("data:")?se:`data:image/png;base64,${se}`}}return{type:"text",text:"[unknown content type]"}})}],Ae={systemPrompt:Z,userPrompt:Te,rawLlmResponse:ge,screenshotWithSom:u,tokenUsages:Ne,retrievedKnowledges:A&&A.length>0?A:void 0,elementTree:d};return{success:z==="true",explanation:Y,debugInfo:Ae}}catch(r){return{success:!1,error:r.message}}}var tc,Ti=v(()=>{"use strict";Si();ze();ut();ht();dt();ve();tc=Ei.object({screenshotDescription:Ei.string().describe(`Description of the screenshot content, listing out key elements along with their Set of Mark indices,
180
+ `,A=await t.agentServices.retrieveKnowledges(e),$=[{type:"text",text:y}],D=0;if(r&&m&&m.length>0)for(let B of m)$.push({type:"image",image:B}),D++;else $.push({type:"image",image:u}),D=1;if(A&&A.length>0){let B=yi(A,s);$.push(...B)}$.push({type:"text",text:E});let F=A?Ga(A,s):0,L=D+F,V=ye(o,L),Z=nc(),pe=await Zl({model:be(o),system:Z,messages:[{role:"user",content:$}],output:Ql.object({schema:tc}),temperature:0,providerOptions:V}),{conclusion:z,explanation:Y}=pe.output,ge=JSON.stringify(pe.output,null,2),Ne=[],Ee=xi(pe.usage,o);Ee&&Ne.push(Ee);let Te=[{role:"user",content:$.map(B=>{if(B.type==="text")return{type:"text",text:B.text};if(B.type==="image"){let J=B.image,q=ec(J);if(q)return{type:"image",file:q};let se=typeof J=="string"?J:"";return{type:"image",file:se.startsWith("data:")?se:`data:image/png;base64,${se}`}}return{type:"text",text:"[unknown content type]"}})}],Ae={systemPrompt:Z,userPrompt:Te,rawLlmResponse:ge,screenshotWithSom:u,tokenUsages:Ne,retrievedKnowledges:A&&A.length>0?A:void 0,elementTree:d};return{success:z==="true",explanation:Y,debugInfo:Ae}}catch(r){return{success:!1,error:r.message}}}var tc,Ti=v(()=>{"use strict";Si();ze();ut();ht();dt();ve();tc=Ei.object({screenshotDescription:Ei.string().describe(`Description of the screenshot content, listing out key elements along with their Set of Mark indices,
181
181
  and a description of their location: formatting example: [12] A red button with text "Submit", next to [11]
182
182
  [45] A modal dialog titled "Confirmation",
183
183
  in the center of the screen`),explanation:Ei.string().describe("Step by step reasoning explaining your conclusion about the statement"),conclusion:Ei.enum(["true","false","unknown"]).describe("Whether the statement is true, false, or unknown if you cannot make a conclusion")})});async function qa(){let{default:e}=await import("sharp");return e}async function Pn(e,t){let i=await qa(),n=await i(e).metadata(),a=n.width||0,o=n.height||0;if(a===0||o===0)throw new Error("Invalid image dimensions");let r=o,l=0,s=Math.floor((a-r)/2),c=Math.max(0,a-r),d=(g,f)=>{let b=i(e).extract({left:g,top:0,width:f,height:r});return t?.resize&&(b=b.resize(Ja,Ja)),b.png().toBuffer()},[u,m,p]=await Promise.all([d(l,Math.min(r,a)),d(s,Math.min(r,a-s)),d(c,Math.min(r,a-c))]);return[u,m,p]}async function Za(e){let t=(await qa())(e),i=await t.metadata(),n=i.width||0,a=i.height||0;if(n===0||a===0)throw new Error("Invalid image dimensions");let{data:o}=await t.grayscale().raw().toBuffer({resolveWithObject:!0}),r=[];for(let l=0;l<a;l++){r[l]=[];for(let s=0;s<n;s++)r[l][s]=o[l*n+s]}return{pixels:r,width:n,height:a}}var Ja,mt=v(()=>{"use strict";Ja=768});var Cn,Nn,On,Dn,pt=v(()=>{"use strict";Cn=new Set(["button","link","textbox","checkbox","radio","combobox","listbox","menuitem","menuitemcheckbox","menuitemradio","option","tab","switch","slider","spinbutton","searchbox","scrollbar","treeitem","gridcell"]),Nn=new Set(["click","mousedown","mouseup","dblclick","pointerdown","pointerup","touchstart","touchend"]),On=["[onclick]","[onmousedown]","[ontouchstart]","div","span","li","tr","td","[role]",'[class*="btn"]','[class*="button"]','[class*="click"]',"[data-action]","[data-click]"],Dn=500});function Qa(e,t){return e.length>t?e.slice(0,t)+"...":e}var gt=v(()=>{"use strict"});var eo,to,ft=v(()=>{"use strict";eo=["title","type","checked","name","role","value","placeholder","data-date-format","alt","aria-label","aria-expanded","data-state","aria-checked","data-id","data-testid","data-test-id","data-handlepos","data-item-id"],to={"react-flow__(\\S+)":"$1"}});var io,wt,_e,Ve=v(()=>{"use strict";gt();ft();io=class{constructor(e,t=null){this.isVisible=e,this.parent=t}},wt=class extends io{constructor(e,t,i=null){super(t,i),this.text=e,this.type="TEXT_NODE"}hasParentWithHighlightIndex(){let e=this.parent;for(;e!==null;){if(e.highlightIndex!==null)return!0;e=e.parent}return!1}isParentInViewport(){return this.parent===null?!1:this.parent.isInViewport}isParentTopElement(){return this.parent===null?!1:this.parent.isTopElement}},_e=class Ai extends io{constructor(t,i,n,a,o,r=!1,l=!1,s=!1,c=!1,d=!1,u=!1,m=null,p=null,g=null,f=null,b=[],h=null){super(o,h),this.tagName=t,this.xpath=i,this.attributes=n,this.children=a,this.isInteractive=r,this.isScrollable=l,this.markAsClickable=s,this.isTopElement=c,this.isInViewport=d,this.shadowRoot=u,this.highlightIndex=m,this.viewportCoordinates=p,this.pageCoordinates=g,this.viewportInfo=f,this.isNew=null,this.shadowHostXPaths=b}getAllTextTillNextClickableElement(t=-1){let i=[],n=(a,o)=>{if(!(t!==-1&&o>t)&&!(a instanceof Ai&&a!==this&&a.highlightIndex!==null)){if(a instanceof wt)i.push(a.text);else if(a instanceof Ai)for(let r of a.children)n(r,o+1)}};return n(this,0),i.join(`
@@ -4298,7 +4298,7 @@ ${p.join(`
4298
4298
  `,n+=`- Use the EXACT placeholder name as shown above
4299
4299
  `,n+=`- Do NOT use the actual value directly in the action
4300
4300
  `,n+=`- The values shown are for context only to help you understand what data is available
4301
- `,n+='- In action descriptions, describe what the placeholder represents in natural language (e.g., "Type the first user name" instead of "Type {{ firstUserName }}")',n}}});var Qt=v(()=>{"use strict"});async function sd(e,t){let i=new Set,n=Date.now(),a=new Set(["document","stylesheet","image","font","script","iframe"]),o=new Set(["text/html","text/css","application/javascript","image/","font/","application/json"]),r=["analytics","tracking","telemetry","beacon","metrics","doubleclick","adsystem","adserver","advertising","facebook.com/plugins","platform.twitter","linkedin.com/embed","livechat","zendesk","intercom","crisp.chat","hotjar","push-notifications","onesignal","pushwoosh","heartbeat","ping","alive","webrtc","rtmp://","wss://","cloudfront.net","fastly.net"],l=u=>{let m=u.toLowerCase();return m.startsWith("data:")||m.startsWith("blob:")?!0:r.some(p=>m.includes(p))},s=u=>{let m=u.resourceType(),p=u.url();if(!a.has(m)||l(p))return;let g=u.headers();g.purpose==="prefetch"||["video","audio"].includes(g["sec-fetch-dest"])||(i.add(u),n=Date.now())},c=async u=>{let m=u.request();if(!i.has(m))return;let p=(u.headers()["content-type"]||"").toLowerCase();if(["streaming","video","audio","webm","mp4","event-stream","websocket","protobuf"].some(f=>p.includes(f))){i.delete(m);return}if(![...o].some(f=>p.startsWith(f))){i.delete(m);return}let g=u.headers()["content-length"];if(g)try{if(parseInt(g,10)>5*1024*1024){i.delete(m);return}}catch{}i.delete(m),n=Date.now()},d=Date.now()-rd;for(let u of await e.requests()){let m=u.resourceType(),p=u.url(),g=u.timing();a.has(m)&&!l(p)&&g.responseEnd===-1&&g.startTime>=d&&(i.add(u),n=Date.now())}w.debug(`[waitForStableNetwork] Pre-populated ${i.size} in-flight requests`),e.on("request",s),e.on("response",c);try{let u=Date.now(),m=od;for(;;){await new Promise(g=>setTimeout(g,100));let p=Date.now();if(i.size===0&&p-n>=m){w.debug(`[waitForStableNetwork] Network idle after ${p-u}ms`);break}if(p-u>t){w.debug(`[waitForStableNetwork] Max wait time exceeded (${t}ms), pending: ${i.size}`);break}}}finally{e.removeListener("request",s),e.removeListener("response",c)}}async function qe(e,t=ad,i=nd){let n=Date.now();try{await Promise.all([e.waitForLoadState("load",{timeout:t}).catch(()=>{}),sd(e,t)])}catch(r){throw r instanceof Error?new Error(`Failed during network stabilization: ${r.message}`):new Error("An unknown error occurred during network stabilization.")}let a=Date.now()-n,o=Math.max(i-a,0);o>0&&await new Promise(r=>setTimeout(r,o))}var nd,ad,od,rd,Pe=v(()=>{"use strict";Qt();W();nd=.5*1e3,ad=30*1e3,od=1*1e3,rd=3*1e3});import{generateText as ld}from"ai";function cd(e,t){return e?{prompt_tokens:e.promptTokens||e.inputTokens||0,completion_tokens:e.completionTokens||e.outputTokens||0,total_tokens:e.totalTokens||0,model:t}:null}async function Or(e,t,i={}){let n=Date.now();if(i.maxSteps!==void 0&&i.maxSteps<=0)throw new Error(`maxSteps must be >= 1, got ${i.maxSteps}`);let a=i.maxSteps??15,o=3,r=t.agentServices.getModel(),l=t.domService||new Me(t.agentServices.getDomServiceOptions()),s={...t,domService:l};S.init(),S.section("Task Execution Started"),S.log(`Task: ${e}`),S.log(`Max steps: ${a}`),S.log(`Model: ${r}`);let c={currentStep:0,maxSteps:a,consecutiveFailures:0,maxFailures:o,lastFailReason:null,stepHistory:[],memory:[],lastGoal:null,lastEvaluation:null},d=[],u=tn(i.customPrompt),m=new an(u);S.log(`System prompt length: ${u.length} chars`);let p=!1,g="",f=[];try{for(i.onEvent?.({type:"start",task:e,maxSteps:a});c.currentStep<a;){if(i.abortSignal?.aborted)throw new Error("Task aborted by user");c.currentStep++;let b=Date.now();S.section(`Step ${c.currentStep}/${a}`),S.log(`URL: ${s.page.url()}`),i.onEvent?.({type:"step_start",step:c.currentStep});try{S.log("Waiting for page to stabilize..."),await qe(s.page),S.log("Page stabilized")}catch{S.log("Page stabilization timed out, continuing anyway")}let h;try{S.log("Preparing context (DOM + screenshot)...");let D=s.agentServices.getInteractiveClassNames(),F=s.agentServices.getIframeFallbackDomains();h=await Nr(s.page,s.domService,D,F),S.log("Context prepared")}catch(D){if(D.message.includes("Execution context was destroyed")){S.log("Page navigating, waiting for load..."),await qe(s.page);let F=s.agentServices.getInteractiveClassNames(),L=s.agentServices.getIframeFallbackDomains();h=await Nr(s.page,s.domService,F,L)}else throw S.error("Error preparing context",D),D}m.addStateMessage(e,h.currentUrl,h.domTree,h.screenshotBase64,c,{isFinalStep:c.currentStep===a-1,placeholderData:t.variables,sensitiveKeys:t.sensitiveKeys});let y=await ud(m,r,i,h.screenshotBase64);if(y.tokenUsages&&y.tokenUsages.length>0&&d.push(...y.tokenUsages),!y.stepOutput){if(S.error("Failed to get valid LLM response"),c.consecutiveFailures++,c.consecutiveFailures>=o){g="Reached the maximum allowed consecutive failures. Most recent error: Unable to get a valid response from the language model.";break}continue}let x=y.stepOutput;gd(c.currentStep,a,x);let E=await md(x,s,h.domState,c.currentStep,i.onEvent,h.screenshotBase64,y.debugInfo);f.push(...E.actionEntities);let A=pd(c.currentStep,x,E,c,b,y.debugInfo,y.tokenUsages),$=Date.now()-b;if(i.onEvent?.({type:"step_complete",step:c.currentStep,duration:$}),c.consecutiveFailures>=o){S.error(`Too many consecutive failures (${c.consecutiveFailures}), stopping`),g=`Reached the maximum allowed consecutive failures. Most recent error: ${c.lastFailReason}`;break}if(E.doneResult){p=E.doneResult.success,g=E.doneResult.summary;break}if(E.completesInstruction){p=!0,g="Instruction completed";break}}return c.currentStep>=a&&!p&&(g="Reached the maximum allowed steps."),i.onEvent?.({type:"complete",totalSteps:c.currentStep,duration:Date.now()-n}),S.log(`Build success result: summary=${g}, completed=${p}, actions=${f.length}, tokens=${d.length}`),fd(c,f,p,g,n,d,r)}catch(b){let h=b.message;return S.error(`Task execution failed: ${h}`,b),i.onEvent?.({type:"error",error:h,recoverable:!1}),wd(c,h,n,d,r)}}async function Nr(e,t,i,n){let{domState:a,screenshotBase64:o}=await t.getClickableElementsWithScreenshot(e,{interactiveClassNames:i,playwrightFrameFallbackDomains:n}),r=a.elementTree.clickableElementsToString();return{currentUrl:e.url(),domTree:r,screenshotBase64:o,domState:a}}function dd(e){return e.map(t=>({role:t.role,content:Array.isArray(t.content)?t.content.map(i=>{if(i.type==="image"){let n=i.image,a=typeof n=="string"?n:"";return{type:"image",file:a.startsWith("data:")?a:`data:image/png;base64,${a}`}}return{type:"text",text:i.text}}):t.content}))}async function ud(e,t,i,n){let a=i.temperature??0,{system:o,messages:r}=e.getMessages(),l=0;for(let u of r)Array.isArray(u.content)&&(l+=u.content.filter(m=>m.type==="image").length);let s=ye(t,l),c={model:be(t),system:o,messages:r,temperature:a,providerOptions:s},d=3;for(let u=0;u<d;u++)try{let m=Date.now();S.log(`Calling LLM (${t})...`);let p=await ld(c),g=Date.now()-m,f=p,b=f.usage;S.llmCall(t,g,b);let h=f.reasoningText;h&&(S.thinking(h),i.onEvent?.({type:"thinking",text:h})),e.addAssistantMessage(p.text);let y={systemPrompt:o,userPrompt:dd(r),rawLlmResponse:p.text,reasoningContent:h,screenshotWithSom:n},x=[],E=cd(b,t);E&&x.push(E);let A=hd(p.text);if(!A)if(u<d-1){S.log(`Attempt ${u+1}/${d}: Failed to parse response, retrying...`),e.addTextMessage("user","Your response was not valid JSON. Please respond with a properly formatted JSON object according to the expected format."),await new Promise($=>setTimeout($,i.retryDelay||1e3));continue}else return S.error("All parsing attempts failed"),{stepOutput:null,debugInfo:y,tokenUsages:x};return{stepOutput:A,debugInfo:y,tokenUsages:x}}catch(m){if(u<d-1){S.log(`Attempt ${u+1}/${d}: LLM call failed (${m.message}), retrying...`),await new Promise(p=>setTimeout(p,i.retryDelay||1e3));continue}else throw S.error("All LLM call attempts failed",m),m}return{stepOutput:null}}function hd(e){let t=e.trim();t.startsWith("```json")?t=t.replace(/^```json\s*/,"").replace(/\s*```\s*$/,""):t.startsWith("```")&&(t=t.replace(/^```\s*/,"").replace(/\s*```\s*$/,""));try{let i=JSON.parse(t);if(!i.current_goal)return S.error("Missing required field: current_goal"),null;if(!i.actions||!Array.isArray(i.actions)||i.actions.length===0)return S.error("Missing required field: actions (must be non-empty array)"),null;for(let n of i.actions){if(!n.action_name)return S.error("Action missing required field: action_name"),null;if(!n.description)return S.error("Action missing required field: description"),null}return i}catch(i){return S.error(`Failed to parse LLM JSON response: ${t.substring(0,500)}`),S.error(`Parse error: ${i.message}`),null}}async function md(e,t,i,n,a,o,r){let l=[],s=!0,c=null;S.log(`Using pre-captured DOM state with ${i.selectorMap.size} elements for ${e.actions.length} action(s)`);let d=null,u={...t,domState:i},m=o;for(let p of e.actions){if(p.action_name==="done"){d={success:p.kwargs.success??!0,summary:p.kwargs.summary||p.kwargs.text||"Task completed"};break}let g={},f=p.kwargs?.element_index??p.kwargs?.index;if(typeof f=="number"){let h=i.selectorMap.get(f);h&&(g=await R(t.page,h))}let b={...g,action_description:p.description,action_data:{action_name:p.action_name,kwargs:p.kwargs}};try{let h=await U.execute(p.action_name,p.kwargs,u);p.action_name==="perform_accurate_operation"&&(b=h.actionEntity);let y=await u.agentServices.getCurrentPage();if(y&&(u.page=y,t.page=u.page),h?.success===!1){s=!1,S.log("Action failed, stopping execution of remaining actions in this step"),c=h.error||"Action execution failed";break}l.push(b),a?.({type:"action",action_entity:b,step:n,debugInfo:r})}catch(h){s=!1,c=h.message,S.error(`Action execution failed: ${h.message}`);break}}return{allSuccess:s,failReason:c,actionEntities:l,doneResult:d,completesInstruction:e.completes_instruction??!1}}function pd(e,t,i,n,a,o,r){let l={stepNumber:e,thinking:t.thinking,evaluation:t.evaluation_previous_goal,memory:t.memory,goal:t.current_goal,actions:i.actionEntities,timestamp:a,duration:Date.now()-a,outcome:{success:i.allSuccess},debugInfo:o,tokenUsages:r};if(n.lastGoal=t.current_goal,t.evaluation_previous_goal&&(n.lastEvaluation=t.evaluation_previous_goal),t.memory&&t.memory.trim()){let s=t.memory.trim();n.memory.includes(s)||(n.memory.push(s),n.memory.length>10&&(n.memory=n.memory.slice(-10)))}return i.allSuccess?(n.consecutiveFailures=0,n.lastFailReason=null):(n.consecutiveFailures++,n.lastFailReason=i.failReason),n.stepHistory.push(l),l}function gd(e,t,i){if(S.log(`Step ${e}/${t}`),i.thinking&&S.log(`Thinking: ${i.thinking}`),i.evaluation_previous_goal&&S.log(`Evaluation: ${i.evaluation_previous_goal}`),i.memory&&S.log(`Memory: ${i.memory}`),S.log(`Goal: ${i.current_goal}`),i.actions.length===1){let n=i.actions[0];S.log(`Action: ${n.action_name}(${JSON.stringify(n.kwargs)}) - ${n.description}`)}else S.log(`Actions (${i.actions.length}):`),i.actions.forEach((n,a)=>{S.log(` ${a+1}. ${n.action_name}(${JSON.stringify(n.kwargs)}) - ${n.description}`)})}function fd(e,t,i,n,a,o,r){let l=o.reduce((d,u)=>d+u.prompt_tokens,0),s=o.reduce((d,u)=>d+u.completion_tokens,0),c=o.reduce((d,u)=>d+u.total_tokens,0);return{success:!0,completed:i,summary:n,trajectory:{steps:e.currentStep,actions:t,stepRecords:e.stepHistory},metadata:{totalSteps:e.currentStep,totalDuration:Date.now()-a,model:r,successfulSteps:e.stepHistory.filter(d=>d.outcome.success).length,failedSteps:e.stepHistory.filter(d=>!d.outcome.success).length,promptTokens:l,completionTokens:s,totalTokens:c,tokenUsages:o}}}function wd(e,t,i,n,a){let o=n.reduce((s,c)=>s+c.prompt_tokens,0),r=n.reduce((s,c)=>s+c.completion_tokens,0),l=n.reduce((s,c)=>s+c.total_tokens,0);return{success:!1,completed:!1,error:t,trajectory:{steps:e.currentStep,actions:[],stepRecords:e.stepHistory},metadata:{totalSteps:e.currentStep,totalDuration:Date.now()-i,model:a,successfulSteps:e.stepHistory.filter(s=>s.outcome.success).length,failedSteps:e.stepHistory.filter(s=>!s.outcome.success).length,promptTokens:o,completionTokens:r,totalTokens:l,tokenUsages:n}}}var Dr=v(()=>{"use strict";na();nn();xe();Le();te();Pe();ve();K()});var Lr={};nt(Lr,{TaskMessageManager:()=>an,formatFinalStepWarning:()=>Pr,formatTaskContext:()=>en,getBrowserTaskJSONPrompt:()=>tn,runTaskLoop:()=>Or});var Rr=v(()=>{"use strict";Dr();na();nn();xe();Ri();Le();mt();pt();Ve();gt();ft();te();Pe();Qt();ve();lt();Be();ct();De();K();Oe();W();ee();yt();H();fe()});async function vt(e,t){try{if(!e.action_data)return{success:!1,error:"Action entity missing action_data"};let{action_name:i,kwargs:n}=e.action_data;if(U.has(i)){let a=await U.execute(i,n,t),o=a?.success!==!1,r=a?.error||a?.message;return{success:o,error:o?void 0:r}}else{let{page:a,agentServices:o}=t;return await(await bd()).execute(a,e,o),{success:!0,error:void 0}}}catch(i){return{success:!1,error:i.message}}}async function bd(){if(on)return on;let e=await Promise.resolve().then(()=>(Qi(),Zi));return on=new e.default,on}async function Fi(e,t,i,n={},a){let o=a||{page:t,agentServices:i,domService:new Me(i.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},r=i.replaceVariables(e),l=await In(r,o,n);return l.status==="error"?{status:"error",completed:l.goalAccomplished||!1,actionEntities:[],explanation:l.reasoning,error:l.error,debugInfo:l.debugInfo}:{status:"success",completed:l.goalAccomplished||!1,actionEntities:l.actionEntity?[l.actionEntity]:[],explanation:l.reasoning,debugInfo:l.debugInfo}}async function Hi(e,t,i,n={},a){let o=a||{page:t,agentServices:i,domService:new Me(i.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},r=i.replaceVariables(e),l=await In(r,o,n);if(l.status==="error"||!l.actionEntity)return{status:"error",completed:l.goalAccomplished||!1,actionEntities:[],explanation:l.reasoning,error:l.error||"No action generated",debugInfo:l.debugInfo};let{actionEntity:s,reasoning:c,goalAccomplished:d,debugInfo:u}=l,m=await vt(s,o);return m.success?(c&&i.addNote(c),{status:"success",completed:d||!1,actionEntities:[s],explanation:c,debugInfo:u}):{status:"error",completed:!1,actionEntities:[s],error:m.error||"Action execution failed",debugInfo:u}}async function Wi(e,t,i,n={}){let a={page:t,agentServices:i,domService:new Me(i.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},o=i.replaceVariables(e);return n.useCleanScreenshotForAssertion??(n.useCleanScreenshotForAssertion=i.isUseCleanScreenshotForAssertion()),Ya(o,a,n)}async function Ui(e,t,i,n,a={}){let{runTaskLoop:o}=await Promise.resolve().then(()=>(Rr(),Lr)),r=n?s=>{n(s)}:void 0,l=await o(e,{page:t,agentServices:i,domService:void 0,executionHistory:a.executionHistory,variables:a.variables,sensitiveKeys:a.sensitiveKeys},{maxSteps:a.maxSteps,onEvent:r,abortSignal:a.abortSignal});return{status:l.success?"success":"error",completed:l.completed,actionEntities:l.trajectory.actions,explanation:l.summary,error:l.error,tokenUsages:l.metadata.tokenUsages}}var on,xt=v(()=>{"use strict";Ti();xe();Le();on=null});import{z as _}from"zod";import"yaml";import"uuid";import"yaml";import"uuid";var ts,hx,is,Ad,$d,sn,mx,px,ns,as,Md,es,Id,ei,Pd,Cd,Nd,ae,Od,Dd,fx,Ax,ti=v(()=>{"use strict";fe();ts=112,hx=1080-ts,is=(e=>(e.Chromium="chromium",e.Firefox="firefox",e.Webkit="webkit",e))(is||{}),Ad={"Blackberry PlayBook":{name:"Blackberry PlayBook",userAgent:"Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/26.0 Safari/536.2+",screen:{width:600,height:1024},viewport:{width:600,height:1024},deviceScaleFactor:1,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"BlackBerry Z30":{name:"BlackBerry Z30",userAgent:"Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/26.0 Mobile Safari/537.10+",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy Note 3":{name:"Galaxy Note 3",userAgent:"Mozilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy Note II":{name:"Galaxy Note II",userAgent:"Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy S III":{name:"Galaxy S III",userAgent:"Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy S5":{name:"Galaxy S5",userAgent:"Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S8":{name:"Galaxy S8",userAgent:"Mozilla/5.0 (Linux; Android 7.0; SM-G950U Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:740},viewport:{width:360,height:740},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S9+":{name:"Galaxy S9+",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; SM-G965U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:320,height:658},viewport:{width:320,height:658},deviceScaleFactor:4.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S24":{name:"Galaxy S24",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-S921U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:780},viewport:{width:360,height:780},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy A55":{name:"Galaxy A55",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-A556B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:480,height:1040},viewport:{width:480,height:1040},deviceScaleFactor:2.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy Tab S4":{name:"Galaxy Tab S4",userAgent:"Mozilla/5.0 (Linux; Android 8.1.0; SM-T837A) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:712,height:1138},viewport:{width:712,height:1138},deviceScaleFactor:2.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy Tab S9":{name:"Galaxy Tab S9",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-X710) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:640,height:1024},viewport:{width:640,height:1024},deviceScaleFactor:2.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"iPad (gen 5)":{name:"iPad (gen 5)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 6)":{name:"iPad (gen 6)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 7)":{name:"iPad (gen 7)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:810,height:1080},viewport:{width:810,height:1080},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 11)":{name:"iPad (gen 11)",userAgent:"Mozilla/5.0 (iPad; CPU OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/19E241 Safari/604.1",screen:{width:656,height:944},viewport:{width:656,height:944},deviceScaleFactor:2.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad Mini":{name:"iPad Mini",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad Pro 11":{name:"iPad Pro 11",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:834,height:1194},viewport:{width:834,height:1194},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 6":{name:"iPhone 6",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 6 Plus":{name:"iPhone 6 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 7":{name:"iPhone 7",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 7 Plus":{name:"iPhone 7 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 8":{name:"iPhone 8",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 8 Plus":{name:"iPhone 8 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone SE":{name:"iPhone SE",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/26.0 Mobile/14E304 Safari/602.1",screen:{width:320,height:568},viewport:{width:320,height:568},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone SE (3rd gen)":{name:"iPhone SE (3rd gen)",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/26.0 Mobile/19E241 Safari/602.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone X":{name:"iPhone X",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:812},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone XR":{name:"iPhone XR",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:896},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11":{name:"iPhone 11",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:715},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11 Pro":{name:"iPhone 11 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:635},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11 Pro Max":{name:"iPhone 11 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:715},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12":{name:"iPhone 12",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Pro":{name:"iPhone 12 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Pro Max":{name:"iPhone 12 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Mini":{name:"iPhone 12 Mini",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:629},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13":{name:"iPhone 13",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Pro":{name:"iPhone 13 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Pro Max":{name:"iPhone 13 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Mini":{name:"iPhone 13 Mini",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:629},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14":{name:"iPhone 14",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Plus":{name:"iPhone 14 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Pro":{name:"iPhone 14 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:660},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Pro Max":{name:"iPhone 14 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:740},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15":{name:"iPhone 15",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:659},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Plus":{name:"iPhone 15 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:739},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Pro":{name:"iPhone 15 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:659},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Pro Max":{name:"iPhone 15 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:739},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Kindle Fire HDX":{name:"Kindle Fire HDX",userAgent:"Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true",screen:{width:800,height:1280},viewport:{width:800,height:1280},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"LG Optimus L70":{name:"LG Optimus L70",userAgent:"Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:384,height:640},viewport:{width:384,height:640},deviceScaleFactor:1.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Microsoft Lumia 550":{name:"Microsoft Lumia 550",userAgent:"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 550) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36 Edge/14.14263",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Microsoft Lumia 950":{name:"Microsoft Lumia 950",userAgent:"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36 Edge/14.14263",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:4,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 10":{name:"Nexus 10",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:800,height:1280},viewport:{width:800,height:1280},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 4":{name:"Nexus 4",userAgent:"Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:384,height:640},viewport:{width:384,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 5":{name:"Nexus 5",userAgent:"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 5X":{name:"Nexus 5X",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 6":{name:"Nexus 6",userAgent:"Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 6P":{name:"Nexus 6P",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 7":{name:"Nexus 7",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:600,height:960},viewport:{width:600,height:960},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nokia Lumia 520":{name:"Nokia Lumia 520",userAgent:"Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)",screen:{width:320,height:533},viewport:{width:320,height:533},deviceScaleFactor:1.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nokia N9":{name:"Nokia N9",userAgent:"Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13",screen:{width:480,height:854},viewport:{width:480,height:854},deviceScaleFactor:1,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Pixel 2":{name:"Pixel 2",userAgent:"Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:411,height:731},viewport:{width:411,height:731},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 2 XL":{name:"Pixel 2 XL",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:411,height:823},viewport:{width:411,height:823},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 3":{name:"Pixel 3",userAgent:"Mozilla/5.0 (Linux; Android 9; Pixel 3 Build/PQ1A.181105.017.A1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:393,height:786},viewport:{width:393,height:786},deviceScaleFactor:2.75,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 4":{name:"Pixel 4",userAgent:"Mozilla/5.0 (Linux; Android 10; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:353,height:745},viewport:{width:353,height:745},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 4a (5G)":{name:"Pixel 4a (5G)",userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 4a (5G)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:892},viewport:{width:412,height:765},deviceScaleFactor:2.63,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 5":{name:"Pixel 5",userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:393,height:851},viewport:{width:393,height:727},deviceScaleFactor:2.75,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 7":{name:"Pixel 7",userAgent:"Mozilla/5.0 (Linux; Android 14; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:915},viewport:{width:412,height:839},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Moto G4":{name:"Moto G4",userAgent:"Mozilla/5.0 (Linux; Android 7.0; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Desktop Chrome HiDPI":{name:"Desktop Chrome HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Edge HiDPI":{name:"Desktop Edge HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Firefox HiDPI":{name:"Desktop Firefox HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0.1) Gecko/20100101 Firefox/142.0.1",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"firefox"},"Desktop Safari":{name:"Desktop Safari",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Safari/605.1.15",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"webkit"},"Desktop Chrome":{name:"Desktop Chrome",displayName:"Playwright Chromium",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Chrome Medium Resolution":{name:"Desktop Chrome Medium Resolution",displayName:"Playwright Chromium",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Chrome (Branded)":{name:"Desktop Chrome (Branded)",displayName:"Google Chrome",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"chrome"},"Desktop Chrome Medium Resolution (Branded)":{name:"Desktop Chrome Medium Resolution (Branded)",displayName:"Google Chrome",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"chrome"},"Desktop Edge":{name:"Desktop Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1920,height:1080},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Edge (Branded)":{name:"Desktop Edge (Branded)",displayName:"Microsoft Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"msedge"},"Desktop Edge Medium Resolution (Branded)":{name:"Desktop Edge Medium Resolution (Branded)",displayName:"Microsoft Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"msedge"},"Desktop Firefox":{name:"Desktop Firefox",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0.1) Gecko/20100101 Firefox/142.0.1",screen:{width:1920,height:1080},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"firefox"}},$d={desktop:["Desktop Chrome","Desktop Chrome Medium Resolution","Desktop Chrome (Branded)","Desktop Chrome Medium Resolution (Branded)","Desktop Edge (Branded)","Desktop Edge Medium Resolution (Branded)","Desktop Safari"],mobile:["iPhone 15 Pro Max","iPhone 15 Pro","iPhone 15 Plus","iPhone 15","iPhone 14 Pro Max","iPhone 14 Pro","iPhone 14 Plus","iPhone 14","iPhone 13 Pro Max","iPhone 13 Pro","iPhone 13","iPhone 13 Mini","iPhone 12 Pro Max","iPhone 12 Pro","iPhone 12","iPhone 12 Mini","iPhone 11 Pro Max","iPhone 11 Pro","iPhone 11","iPhone XR","iPhone X","iPhone SE (3rd gen)","iPhone SE","iPhone 8 Plus","iPhone 8","iPhone 7 Plus","iPhone 7","iPhone 6 Plus","iPhone 6","Galaxy S24","Galaxy A55","Galaxy S9+","Galaxy S8","Galaxy S5","Galaxy Note 3","Galaxy Note II","Galaxy S III","Pixel 7","Pixel 5","Pixel 4a (5G)","Pixel 4","Pixel 3","Pixel 2 XL","Pixel 2","Nexus 6P","Nexus 6","Nexus 5X","Nexus 5","Nexus 4","Moto G4","LG Optimus L70","Microsoft Lumia 950","Microsoft Lumia 550","Nokia Lumia 520","Nokia N9","BlackBerry Z30"]},sn=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),$d[e].map(n=>Ad[n]).filter(n=>n.defaultBrowserType&&i.includes(n.defaultBrowserType))},mx={desktop:{label:"Desktop",type:"desktop",devices:sn("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:sn("mobile")}},px={desktop:{label:"Desktop",type:"desktop",devices:sn("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:sn("mobile",!0)}},ns=(e=>(e.PASSWORD="password",e.OAUTH2="oauth2",e.SSO="sso",e.API="api",e))(ns||{}),as=(e=>(e.SMS="sms",e.EMAIL="email",e.TOTP="totp",e))(as||{}),Md=_.enum(["JS_CODE","AI_MODE"]),es=_.object({type:Md,expression:_.string()}),Id=_.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),ei=_.object({uid:_.string(),type:Id,comment:_.string().optional()}),Pd=_.object({action_data:_.object({action_name:_.string(),kwargs:_.record(_.any()).optional(),args:_.array(_.any()).optional()}),action_description:_.string().optional(),url:_.string().optional(),xpath:_.string().nullable().optional(),locator:_.string().nullable().optional(),css_selector:_.string().nullable().optional(),unique_selector:_.string().nullable().optional(),element_index:_.number().nullable().optional(),frame_path:_.array(_.any()).optional(),artifacts:_.record(_.any()).optional(),feedback:_.string().optional(),original_browser_use_action:_.any().optional()}).passthrough(),Cd=ei.extend({type:_.literal("DRAFT"),description:_.string()}),Nd=ei.extend({type:_.literal("ACTION"),description:_.string(),action_entity:Pd.optional(),locator:_.string().optional(),use_pure_vision:_.boolean().optional()}),ae=_.lazy(()=>_.union([Cd,Nd,ei.extend({type:_.literal("STEP"),description:_.string().optional().default(""),statements:_.array(ae),reference_id:_.number().optional(),template_path:_.string().optional(),template_params:_.record(_.string()).optional()}),ei.extend({type:_.literal("IF_ELSE"),description:_.string().optional(),condition:es,then:_.array(ae),else:_.array(ae).optional()}),ei.extend({type:_.literal("WHILE_LOOP"),description:_.string().optional(),condition:es,body:_.array(ae),timeout_ms:_.number().optional()})])),Od=_.object({name:_.string(),statements:_.array(ae),teardown:_.array(ae).optional(),skip:_.union([_.boolean(),_.string()]).optional(),timeout:_.number().optional(),fail:_.union([_.boolean(),_.string()]).optional(),only:_.boolean().optional(),slow:_.boolean().optional()}),Dd=_.object({tests:_.array(Od).min(1),beforeAll:_.array(ae).optional(),afterAll:_.array(ae).optional(),beforeEach:_.array(ae).optional(),afterEach:_.array(ae).optional()}),fx=_.object({comment:_.string().optional(),version:_.string().optional(),goal:_.string().optional(),url:_.string().optional(),baseURL:_.string().optional(),final_feedback:_.string().optional(),completed:_.boolean().optional(),success:_.boolean().optional(),statements:_.array(ae).optional(),teardown:_.array(ae).optional(),last_modified_at:_.string().optional(),testGroup:Dd.optional()}).refine(e=>e.testGroup!==void 0?e.goal===void 0&&(e.statements===void 0||e.statements.length===0):e.goal!==void 0,{message:"TestFlow must have either goal/statements (single test) or testGroup (suite), not both"}),Ax=1024*1024});var oa=v(()=>{"use strict";te();Pe()});import{z as k}from"zod";var ls,ra,cs,Ze,ds,us,hs,ne,ms,cn,sa,la=v(()=>{"use strict";ls=k.enum(["JS_CODE","AI_MODE"]),ra=k.object({type:ls,expression:k.string()}),cs=k.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),Ze=k.object({uid:k.string(),type:cs,comment:k.string().optional()}),ds=k.object({action_data:k.object({action_name:k.string(),kwargs:k.record(k.any()).optional(),args:k.array(k.any()).optional()}),action_description:k.string().optional(),url:k.string().optional(),xpath:k.string().nullable().optional(),locator:k.string().nullable().optional(),css_selector:k.string().nullable().optional(),unique_selector:k.string().nullable().optional(),element_index:k.number().nullable().optional(),frame_path:k.array(k.any()).optional(),artifacts:k.record(k.any()).optional(),feedback:k.string().optional(),original_browser_use_action:k.any().optional()}).passthrough(),us=Ze.extend({type:k.literal("DRAFT"),description:k.string()}),hs=Ze.extend({type:k.literal("ACTION"),description:k.string(),action_entity:ds.optional(),locator:k.string().optional(),use_pure_vision:k.boolean().optional()}),ne=k.lazy(()=>k.union([us,hs,Ze.extend({type:k.literal("STEP"),description:k.string().optional().default(""),statements:k.array(ne),reference_id:k.number().optional(),template_path:k.string().optional(),template_params:k.record(k.string()).optional()}),Ze.extend({type:k.literal("IF_ELSE"),description:k.string().optional(),condition:ra,then:k.array(ne),else:k.array(ne).optional()}),Ze.extend({type:k.literal("WHILE_LOOP"),description:k.string().optional(),condition:ra,body:k.array(ne),timeout_ms:k.number().optional()})])),ms=k.object({name:k.string(),statements:k.array(ne),teardown:k.array(ne).optional(),skip:k.union([k.boolean(),k.string()]).optional(),timeout:k.number().optional(),fail:k.union([k.boolean(),k.string()]).optional(),only:k.boolean().optional(),slow:k.boolean().optional()}),cn=k.object({tests:k.array(ms).min(1),beforeAll:k.array(ne).optional(),afterAll:k.array(ne).optional(),beforeEach:k.array(ne).optional(),afterEach:k.array(ne).optional()}),sa=k.object({comment:k.string().optional(),version:k.string().optional(),goal:k.string().optional(),url:k.string().optional(),baseURL:k.string().optional(),final_feedback:k.string().optional(),completed:k.boolean().optional(),success:k.boolean().optional(),statements:k.array(ne).optional(),teardown:k.array(ne).optional(),last_modified_at:k.string().optional(),testGroup:cn.optional()}).refine(e=>e.testGroup!==void 0?e.goal===void 0&&(e.statements===void 0||e.statements.length===0):e.goal!==void 0,{message:"TestFlow must have either goal/statements (single test) or testGroup (suite), not both"})});import{stringify as Yd,parse as ws,parseAllDocuments as gS,parseDocument as Jd,Document as qd,isMap as et,isSeq as de}from"yaml";import{v4 as ce}from"uuid";function dn(e,t){let i={...t?.test_case_id!==void 0?{test_case_id:t.test_case_id}:{},...t?.name?{name:t.name}:{},goal:e.goal??"",url:e.url,base_url:e.baseURL,...t?.timeout!==void 0?{timeout:t.timeout}:{},...t?.settings&&Object.keys(t.settings).length>0?{settings:t.settings}:{},statements:(e.statements??[]).map(oe)};return e.final_feedback&&(i.final_feedback=e.final_feedback),e.teardown&&e.teardown.length>0&&(i.teardown=e.teardown.map(oe)),i}function un(e,t){if(e.testGroup)return ys(e,t);let i=dn(e,t),n=new qd(i);return e.comment&&(n.commentBefore=e.comment),ps(n,e.statements??[]),e.teardown&&ps(n,e.teardown,"teardown"),n.toString(bs)}function ps(e,t,i="statements"){let n=e.contents;if(!n||!et(n))return;let a=n.get(i,!0);de(a)&&ai(a,t)}function ai(e,t){for(let i=0;i<Math.min(e.items.length,t.length);i++){let n=t[i],a=e.items[i];if(i>0&&(a.spaceBefore=!0),n.comment&&(i===0?e.commentBefore=n.comment:a.commentBefore=n.comment),et(a)){let o=a;if(n.type==="STEP"){let r=o.get("statements",!0);de(r)&&ai(r,n.statements)}else if(n.type==="IF_ELSE"){let r=o.get("THEN",!0);de(r)&&ai(r,n.then);let l=o.get("ELSE",!0);de(l)&&n.else&&ai(l,n.else)}else if(n.type==="WHILE_LOOP"){let r=o.get("DO",!0);de(r)&&ai(r,n.body)}}}}function ys(e,t){let i=e.testGroup;if(!i)throw new Error("suiteToYaml requires a TestFlow with testGroup");let n={};t?.test_case_id!==void 0&&(n.test_case_id=t.test_case_id),t?.name&&(n.name=t.name),t?.tags&&t.tags.length>0&&(n.tags=t.tags),t?.use&&Object.keys(t.use).length>0&&(n.use=t.use),t?.settings&&Object.keys(t.settings).length>0&&(n.settings=t.settings);let a={};return e.baseURL&&(a.base_url=e.baseURL),i.beforeAll&&i.beforeAll.length>0&&(a.beforeAll=i.beforeAll.map(oe)),i.beforeEach&&i.beforeEach.length>0&&(a.beforeEach=i.beforeEach.map(oe)),i.afterEach&&i.afterEach.length>0&&(a.afterEach=i.afterEach.map(oe)),i.afterAll&&i.afterAll.length>0&&(a.afterAll=i.afterAll.map(oe)),a.tests=i.tests.map(o=>{let r={name:o.name};return o.skip!==void 0&&(r.skip=o.skip),o.timeout!==void 0&&(r.timeout=o.timeout),o.fail!==void 0&&(r.fail=o.fail),o.only!==void 0&&(r.only=o.only),o.slow!==void 0&&(r.slow=o.slow),r.statements=o.statements.map(oe),o.teardown&&o.teardown.length>0&&(r.teardown=o.teardown.map(oe)),r}),n.suite=a,Yd(n,bs)}function oe(e){switch(e.type){case"DRAFT":return Zd(e);case"ACTION":return Qd(e);case"STEP":return eu(e);case"IF_ELSE":return tu(e);case"WHILE_LOOP":return iu(e)}}function Zd(e){return{intent:e.description}}function Qd(e){let t=e.action_entity?.action_data?.action_name??e.action_entity?.action?.action_name,i=e.action_entity?.action_data?.kwargs??e.action_entity?.action?.kwargs;if(t==="verify"){let l=i?.statement;if(typeof l=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let s=i?.code;return typeof s=="string"?{VERIFY:l,js:s}:{VERIFY:l}}}if(t==="go_to_url"){let l=i?.url;if(typeof l=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let s={URL:l};return i?.new_tab===!0&&(s.new_tab=!0),typeof i?.timeout_seconds=="number"&&(s.timeout_seconds=i.timeout_seconds),s}}if(t==="js_action"){let l=i?.code;if(typeof l=="string"&&e.description)return{intent:e.description,js:l}}if(t==="ai_wait_until"){let l=i?.condition;if(typeof l=="string"){let s={WAIT_UNTIL:l};return typeof i?.timeout_seconds=="number"&&i.timeout_seconds!==60&&(s.timeout_seconds=i.timeout_seconds),s}}if(t==="wait"){let l=i?.seconds,c={WAIT:e.description||`Wait ${l}s`};return typeof l=="number"&&(c.seconds=l),c}if(t==="js_code"){let l=i?.code;if(typeof l=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath)return{CODE:l}}if(!e.action_entity)return{intent:e.description};let n=e.action_entity.action_data??e.action_entity.action;if(!n)return{intent:e.description};let a={intent:e.description,action:n.action_name},o=e.locator??e.action_entity.locator;o&&(a.locator=o);let r=e.action_entity.xpath;if(r&&(a.xpath=r),e.use_pure_vision&&(a.use_pure_vision=!0),n.kwargs&&Object.keys(n.kwargs).length>0)for(let[l,s]of Object.entries(n.kwargs))a[l]=s;return n.args&&n.args.length>0&&(a.args=n.args),a}function eu(e){if(e.template_path){let i={template:e.template_path};return e.template_params&&Object.keys(e.template_params).length>0&&(i.params=e.template_params),i}let t={STEP:e.description,statements:e.statements.map(oe)};return e.reference_id!==void 0&&(t.reference_id=e.reference_id),t}function tu(e){let t={IF:vs(e.condition),THEN:e.then.map(oe)};return e.else&&e.else.length>0&&(t.ELSE=e.else.map(oe)),t}function iu(e){let t={WHILE:vs(e.condition),DO:e.body.map(oe)};return e.timeout_ms!==void 0&&(t.timeout_ms=e.timeout_ms),t}function vs(e){return e.type==="JS_CODE"?`js:${e.expression}`:e.expression}function da(e){try{let t=ws(e);if(!t||typeof t!="object")return{};let i={};return typeof t.test_case_id=="number"&&Number.isFinite(t.test_case_id)&&(i.test_case_id=t.test_case_id),typeof t.template_id=="number"&&Number.isFinite(t.template_id)&&(i.template_id=t.template_id),typeof t.name=="string"&&t.name.trim()&&(i.name=t.name.trim()),typeof t.timeout=="number"&&Number.isFinite(t.timeout)&&(i.timeout=t.timeout),t.settings&&typeof t.settings=="object"&&!Array.isArray(t.settings)&&(i.settings=t.settings),i}catch{return{}}}function ca(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(ca);let t=e,i=Object.keys(t);if(i.length===1){let a=i[0];if(a.startsWith("{ ")&&a.endsWith(" }")&&t[a]===null)return`{{${a.slice(2,-2)}}}`}let n={};for(let[a,o]of Object.entries(t))n[a]=ca(o);return n}function Se(e){if(e.length>gs)throw new Error(`YAML input too large (${e.length} bytes, max ${gs})`);let t=ca(ws(e));if(!t||typeof t!="object")throw new Error("Invalid YAML: expected an object at root level");if(t.suite)return nu(t);let i={version:"1.3.0",goal:t.goal,url:t.url,baseURL:t.base_url,statements:re(t.statements??[])};t.final_feedback&&(i.final_feedback=t.final_feedback),t.teardown&&Array.isArray(t.teardown)&&(i.teardown=re(t.teardown));let n=sa.safeParse(i);if(!n.success)throw new Error(`Invalid TestFlow after YAML conversion: ${JSON.stringify(n.error.errors)}`);let a=n.data;return hn(e,a),a}function nu(e){let t=e.suite;if(!t||typeof t!="object")throw new Error("Invalid suite: expected an object");let i=t.tests;if(!Array.isArray(i)||i.length===0)throw new Error('Suite must have a non-empty "tests" array');let a={tests:i.map(l=>{if(!l.name)throw new Error('Each test in a suite must have a "name" field');if(!Array.isArray(l.statements)||l.statements.length===0)throw new Error(`Suite test "${l.name}" must have a non-empty "statements" array`);let s={name:l.name,statements:re(l.statements)};return Array.isArray(l.teardown)&&l.teardown.length>0&&(s.teardown=re(l.teardown)),l.skip!==void 0&&(s.skip=l.skip),typeof l.timeout=="number"&&(s.timeout=l.timeout),l.fail!==void 0&&(s.fail=l.fail),l.only===!0&&(s.only=!0),l.slow===!0&&(s.slow=!0),s})};Array.isArray(t.beforeAll)&&t.beforeAll.length>0&&(a.beforeAll=re(t.beforeAll)),Array.isArray(t.afterAll)&&t.afterAll.length>0&&(a.afterAll=re(t.afterAll)),Array.isArray(t.beforeEach)&&t.beforeEach.length>0&&(a.beforeEach=re(t.beforeEach)),Array.isArray(t.afterEach)&&t.afterEach.length>0&&(a.afterEach=re(t.afterEach));let o=cn.safeParse(a);if(!o.success)throw new Error(`Invalid TestGroup: ${JSON.stringify(o.error.errors)}`);return{version:"1.3.0",baseURL:t.base_url||void 0,testGroup:o.data}}function re(e){if(!Array.isArray(e))throw new Error("Expected an array of statements");return e.map(au)}function au(e){if(typeof e=="string")throw new Error(`Plain string statements are not supported. Use an object with a "desc" key instead. Example: { "desc": "${e}" }`);if(typeof e!="object"||e===null)throw new Error(`Invalid statement: expected object, got ${typeof e}`);let t=e;if("IF"in t)return ou(t);if("WHILE"in t)return ru(t);if("STEP"in t)return su(t);if("VERIFY"in t){let i=t.VERIFY,n={statement:typeof i=="string"?i:String(i)};return typeof t.js=="string"&&(n.code=t.js),{uid:ce(),type:"ACTION",description:String(i),action_entity:{action_description:String(i),action_data:{action_name:"verify",kwargs:n}}}}if("URL"in t){let i=t.URL,n=t.new_tab===!0?!0:void 0,a=typeof t.timeout_seconds=="number"?t.timeout_seconds:void 0,o={url:typeof i=="string"?i:String(i)};return n&&(o.new_tab=!0),a!==void 0&&(o.timeout_seconds=a),{uid:ce(),type:"ACTION",description:`Navigate to ${i}`,action_entity:{action_description:`Navigate to ${i}`,action_data:{action_name:"go_to_url",kwargs:o}}}}if("WAIT_UNTIL"in t){let i=t.WAIT_UNTIL,n=typeof t.timeout_seconds=="number"?t.timeout_seconds:60;return{uid:ce(),type:"ACTION",description:`Wait until: ${i}`,action_entity:{action_description:`Wait until: ${i}`,action_data:{action_name:"ai_wait_until",kwargs:{condition:typeof i=="string"?i:String(i),timeout_seconds:n}}}}}if("WAIT"in t){let i=t.WAIT,n=typeof t.seconds=="number"?t.seconds:3;return{uid:ce(),type:"ACTION",description:typeof i=="string"?i:`Wait ${n}s`,action_entity:{action_description:typeof i=="string"?i:`Wait ${n}s`,action_data:{action_name:"wait",kwargs:{seconds:n}}}}}if("CODE"in t){let i=t.CODE;if(i==null)throw new Error('CODE statement has no code. Use "CODE: |" followed by indented code on the next line.');return{uid:ce(),type:"ACTION",description:"Code block",action_entity:{action_description:"Code block",action_data:{action_name:"js_code",kwargs:{code:typeof i=="string"?i:String(i)}}}}}if("js"in t&&("intent"in t||"desc"in t)&&!("VERIFY"in t)&&t.action!=="verify"){let i=t.js,n=typeof t.intent=="string"?t.intent:typeof t.desc=="string"?t.desc:"";return{uid:ce(),type:"ACTION",description:n,action_entity:{action_description:n,action_data:{action_name:"js_action",kwargs:{code:typeof i=="string"?i:String(i)}}}}}if("call"in t&&typeof t.call=="string"){let{call:i,...n}=t;return fs({...n,action:"function",functionName:i})}if("action"in t)return fs(t);if("intent"in t&&typeof t.intent=="string"||"desc"in t&&typeof t.desc=="string")return{uid:ce(),type:"DRAFT",description:typeof t.intent=="string"?t.intent:t.desc};throw new Error(`Cannot infer statement type from object: ${JSON.stringify(t)}`)}function xs(e){if(typeof e!="string")throw new Error(`Condition must be a string, got ${typeof e}`);return e.startsWith("js:")?{type:"JS_CODE",expression:e.slice(3)}:{type:"AI_MODE",expression:e}}function ou(e){let t=xs(e.IF),i=e.THEN;if(!Array.isArray(i))throw new Error("IF_ELSE requires a THEN array");let n={uid:ce(),type:"IF_ELSE",condition:t,then:re(i)};return"ELSE"in e&&Array.isArray(e.ELSE)&&(n.else=re(e.ELSE)),n}function ru(e){let t=xs(e.WHILE),i=e.DO;if(!Array.isArray(i))throw new Error("WHILE_LOOP requires a DO array");let n={uid:ce(),type:"WHILE_LOOP",condition:t,body:re(i)};return typeof e.timeout_ms=="number"&&(n.timeout_ms=e.timeout_ms),n}function su(e){let t=typeof e.STEP=="string"?e.STEP:"";if(!Array.isArray(e.statements))throw new Error("STEP requires a statements array");let i={uid:ce(),type:"STEP",description:t,statements:re(e.statements)};if(typeof e.reference_id=="number"&&(i.reference_id=e.reference_id),typeof e.template_path=="string"&&(i.template_path=e.template_path),e.template_params&&typeof e.template_params=="object"&&!Array.isArray(e.template_params)){let n=e.template_params,a={};for(let[o,r]of Object.entries(n))a[o]=String(r);i.template_params=a}return i}function fs(e){let t=typeof e.action=="string"?e.action:String(e.action),i=typeof e.intent=="string"?e.intent:typeof e.desc=="string"?e.desc:"",n=typeof e.locator=="string"?e.locator:void 0,a=typeof e.xpath=="string"?e.xpath:void 0,o=typeof e.use_pure_vision=="boolean"?e.use_pure_vision:void 0,r={};for(let[c,d]of Object.entries(e))lu.has(c)||(r[c]=d);t==="verify"&&typeof r.js=="string"&&(r.code=r.js,delete r.js);let l={action_description:i,action_data:{action_name:t,kwargs:Object.keys(r).length>0?r:{}}};n&&(l.locator=n),a&&(l.xpath=a);let s={uid:ce(),type:"ACTION",description:i,action_entity:l};return o&&(s.use_pure_vision=!0),s}function hn(e,t){let i;try{i=Jd(e)}catch{return}let n=i.contents;if(!n||!et(n))return;if(i.commentBefore)t.comment=i.commentBefore;else{let s=n.items?.[0];s?.key&&s.key.commentBefore&&(t.comment=s.key.commentBefore)}let a=n,o=a.get("statements",!0);de(o)&&t.statements&&Qe(o,t.statements);let r=a.get("teardown",!0);de(r)&&t.teardown&&Qe(r,t.teardown)}function Qe(e,t){e.commentBefore&&t.length>0&&(t[0].comment=e.commentBefore);for(let i=0;i<Math.min(e.items.length,t.length);i++){let n=e.items[i];n.commentBefore&&!(i===0&&e.commentBefore)&&(t[i].comment=n.commentBefore);let a=t[i];if(a.type==="STEP"&&et(n)){let o=n.get("statements",!0);de(o)&&Qe(o,a.statements)}else if(a.type==="IF_ELSE"&&et(n)){let o=n.get("THEN",!0);de(o)&&Qe(o,a.then);let r=n.get("ELSE",!0);de(r)&&a.else&&Qe(r,a.else)}else if(a.type==="WHILE_LOOP"&&et(n)){let o=n.get("DO",!0);de(o)&&Qe(o,a.body)}}}var bs,gs,lu,mn=v(()=>{"use strict";la();bs={lineWidth:120,defaultKeyType:"PLAIN",defaultStringType:"PLAIN"};gs=1024*1024;lu=new Set(["action","intent","desc","locator","xpath","use_pure_vision"])});import{parse as vS,stringify as xS}from"yaml";var _s=v(()=>{"use strict";mn()});var pn=v(()=>{"use strict"});var ks=v(()=>{"use strict";mn();pn()});var Ss=v(()=>{"use strict";pn()});import{v4 as IS}from"uuid";var Es=v(()=>{"use strict"});var Fe,Ts=v(()=>{"use strict";Fe=(e=>(e.DRAFT="DRAFT",e.STEP="STEP",e.ACTION="ACTION",e.IF_ELSE="IF_ELSE",e.WHILE_LOOP="WHILE_LOOP",e))(Fe||{})});var gn=v(()=>{"use strict"});var As=v(()=>{"use strict";gn()});var $s,hu,Ms,Is,oi,mu,pu,Ps=v(()=>{"use strict";$s=112,hu=1080-$s,Ms={"Blackberry PlayBook":{name:"Blackberry PlayBook",userAgent:"Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/26.0 Safari/536.2+",screen:{width:600,height:1024},viewport:{width:600,height:1024},deviceScaleFactor:1,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"BlackBerry Z30":{name:"BlackBerry Z30",userAgent:"Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/26.0 Mobile Safari/537.10+",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy Note 3":{name:"Galaxy Note 3",userAgent:"Mozilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy Note II":{name:"Galaxy Note II",userAgent:"Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy S III":{name:"Galaxy S III",userAgent:"Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy S5":{name:"Galaxy S5",userAgent:"Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S8":{name:"Galaxy S8",userAgent:"Mozilla/5.0 (Linux; Android 7.0; SM-G950U Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:740},viewport:{width:360,height:740},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S9+":{name:"Galaxy S9+",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; SM-G965U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:320,height:658},viewport:{width:320,height:658},deviceScaleFactor:4.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S24":{name:"Galaxy S24",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-S921U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:780},viewport:{width:360,height:780},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy A55":{name:"Galaxy A55",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-A556B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:480,height:1040},viewport:{width:480,height:1040},deviceScaleFactor:2.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy Tab S4":{name:"Galaxy Tab S4",userAgent:"Mozilla/5.0 (Linux; Android 8.1.0; SM-T837A) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:712,height:1138},viewport:{width:712,height:1138},deviceScaleFactor:2.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy Tab S9":{name:"Galaxy Tab S9",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-X710) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:640,height:1024},viewport:{width:640,height:1024},deviceScaleFactor:2.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"iPad (gen 5)":{name:"iPad (gen 5)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 6)":{name:"iPad (gen 6)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 7)":{name:"iPad (gen 7)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:810,height:1080},viewport:{width:810,height:1080},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 11)":{name:"iPad (gen 11)",userAgent:"Mozilla/5.0 (iPad; CPU OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/19E241 Safari/604.1",screen:{width:656,height:944},viewport:{width:656,height:944},deviceScaleFactor:2.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad Mini":{name:"iPad Mini",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad Pro 11":{name:"iPad Pro 11",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:834,height:1194},viewport:{width:834,height:1194},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 6":{name:"iPhone 6",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 6 Plus":{name:"iPhone 6 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 7":{name:"iPhone 7",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 7 Plus":{name:"iPhone 7 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 8":{name:"iPhone 8",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 8 Plus":{name:"iPhone 8 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone SE":{name:"iPhone SE",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/26.0 Mobile/14E304 Safari/602.1",screen:{width:320,height:568},viewport:{width:320,height:568},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone SE (3rd gen)":{name:"iPhone SE (3rd gen)",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/26.0 Mobile/19E241 Safari/602.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone X":{name:"iPhone X",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:812},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone XR":{name:"iPhone XR",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:896},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11":{name:"iPhone 11",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:715},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11 Pro":{name:"iPhone 11 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:635},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11 Pro Max":{name:"iPhone 11 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:715},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12":{name:"iPhone 12",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Pro":{name:"iPhone 12 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Pro Max":{name:"iPhone 12 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Mini":{name:"iPhone 12 Mini",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:629},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13":{name:"iPhone 13",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Pro":{name:"iPhone 13 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Pro Max":{name:"iPhone 13 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Mini":{name:"iPhone 13 Mini",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:629},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14":{name:"iPhone 14",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Plus":{name:"iPhone 14 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Pro":{name:"iPhone 14 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:660},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Pro Max":{name:"iPhone 14 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:740},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15":{name:"iPhone 15",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:659},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Plus":{name:"iPhone 15 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:739},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Pro":{name:"iPhone 15 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:659},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Pro Max":{name:"iPhone 15 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:739},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Kindle Fire HDX":{name:"Kindle Fire HDX",userAgent:"Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true",screen:{width:800,height:1280},viewport:{width:800,height:1280},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"LG Optimus L70":{name:"LG Optimus L70",userAgent:"Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:384,height:640},viewport:{width:384,height:640},deviceScaleFactor:1.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Microsoft Lumia 550":{name:"Microsoft Lumia 550",userAgent:"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 550) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36 Edge/14.14263",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Microsoft Lumia 950":{name:"Microsoft Lumia 950",userAgent:"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36 Edge/14.14263",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:4,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 10":{name:"Nexus 10",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:800,height:1280},viewport:{width:800,height:1280},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 4":{name:"Nexus 4",userAgent:"Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:384,height:640},viewport:{width:384,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 5":{name:"Nexus 5",userAgent:"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 5X":{name:"Nexus 5X",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 6":{name:"Nexus 6",userAgent:"Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 6P":{name:"Nexus 6P",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 7":{name:"Nexus 7",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:600,height:960},viewport:{width:600,height:960},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nokia Lumia 520":{name:"Nokia Lumia 520",userAgent:"Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)",screen:{width:320,height:533},viewport:{width:320,height:533},deviceScaleFactor:1.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nokia N9":{name:"Nokia N9",userAgent:"Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13",screen:{width:480,height:854},viewport:{width:480,height:854},deviceScaleFactor:1,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Pixel 2":{name:"Pixel 2",userAgent:"Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:411,height:731},viewport:{width:411,height:731},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 2 XL":{name:"Pixel 2 XL",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:411,height:823},viewport:{width:411,height:823},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 3":{name:"Pixel 3",userAgent:"Mozilla/5.0 (Linux; Android 9; Pixel 3 Build/PQ1A.181105.017.A1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:393,height:786},viewport:{width:393,height:786},deviceScaleFactor:2.75,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 4":{name:"Pixel 4",userAgent:"Mozilla/5.0 (Linux; Android 10; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:353,height:745},viewport:{width:353,height:745},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 4a (5G)":{name:"Pixel 4a (5G)",userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 4a (5G)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:892},viewport:{width:412,height:765},deviceScaleFactor:2.63,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 5":{name:"Pixel 5",userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:393,height:851},viewport:{width:393,height:727},deviceScaleFactor:2.75,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 7":{name:"Pixel 7",userAgent:"Mozilla/5.0 (Linux; Android 14; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:915},viewport:{width:412,height:839},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Moto G4":{name:"Moto G4",userAgent:"Mozilla/5.0 (Linux; Android 7.0; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Desktop Chrome HiDPI":{name:"Desktop Chrome HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Edge HiDPI":{name:"Desktop Edge HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Firefox HiDPI":{name:"Desktop Firefox HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0.1) Gecko/20100101 Firefox/142.0.1",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"firefox"},"Desktop Safari":{name:"Desktop Safari",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Safari/605.1.15",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"webkit"},"Desktop Chrome":{name:"Desktop Chrome",displayName:"Playwright Chromium",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Chrome Medium Resolution":{name:"Desktop Chrome Medium Resolution",displayName:"Playwright Chromium",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Chrome (Branded)":{name:"Desktop Chrome (Branded)",displayName:"Google Chrome",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"chrome"},"Desktop Chrome Medium Resolution (Branded)":{name:"Desktop Chrome Medium Resolution (Branded)",displayName:"Google Chrome",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"chrome"},"Desktop Edge":{name:"Desktop Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1920,height:1080},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Edge (Branded)":{name:"Desktop Edge (Branded)",displayName:"Microsoft Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"msedge"},"Desktop Edge Medium Resolution (Branded)":{name:"Desktop Edge Medium Resolution (Branded)",displayName:"Microsoft Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"msedge"},"Desktop Firefox":{name:"Desktop Firefox",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0.1) Gecko/20100101 Firefox/142.0.1",screen:{width:1920,height:1080},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"firefox"}},Is={desktop:["Desktop Chrome","Desktop Chrome Medium Resolution","Desktop Chrome (Branded)","Desktop Chrome Medium Resolution (Branded)","Desktop Edge (Branded)","Desktop Edge Medium Resolution (Branded)","Desktop Safari"],mobile:["iPhone 15 Pro Max","iPhone 15 Pro","iPhone 15 Plus","iPhone 15","iPhone 14 Pro Max","iPhone 14 Pro","iPhone 14 Plus","iPhone 14","iPhone 13 Pro Max","iPhone 13 Pro","iPhone 13","iPhone 13 Mini","iPhone 12 Pro Max","iPhone 12 Pro","iPhone 12","iPhone 12 Mini","iPhone 11 Pro Max","iPhone 11 Pro","iPhone 11","iPhone XR","iPhone X","iPhone SE (3rd gen)","iPhone SE","iPhone 8 Plus","iPhone 8","iPhone 7 Plus","iPhone 7","iPhone 6 Plus","iPhone 6","Galaxy S24","Galaxy A55","Galaxy S9+","Galaxy S8","Galaxy S5","Galaxy Note 3","Galaxy Note II","Galaxy S III","Pixel 7","Pixel 5","Pixel 4a (5G)","Pixel 4","Pixel 3","Pixel 2 XL","Pixel 2","Nexus 6P","Nexus 6","Nexus 5X","Nexus 5","Nexus 4","Moto G4","LG Optimus L70","Microsoft Lumia 950","Microsoft Lumia 550","Nokia Lumia 520","Nokia N9","BlackBerry Z30"]},oi=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),Is[e].map(n=>Ms[n]).filter(n=>n.defaultBrowserType&&i.includes(n.defaultBrowserType))},mu={desktop:{label:"Desktop",type:"desktop",devices:oi("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:oi("mobile")}},pu={desktop:{label:"Desktop",type:"desktop",devices:oi("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:oi("mobile",!0)}}});var Cs=v(()=>{"use strict"});var Ns=v(()=>{"use strict"});var Os=v(()=>{"use strict"});var Ds=v(()=>{"use strict"});var Ls=v(()=>{"use strict"});var Rs=v(()=>{"use strict"});var Fs=v(()=>{"use strict"});var Hs=v(()=>{"use strict";gn()});var tt=v(()=>{"use strict";_s();ks();mn();la();Ss();Es();pn();Ts();As();Ps();Cs();Ns();Os();Ds();Ls();Rs();Fs();Hs();gn()});import{stringify as YT}from"yaml";import{createHash as vu}from"crypto";import{parse as xu,stringify as Ks}from"yaml";import{readFileSync as _u,existsSync as ku}from"fs";import{resolve as ua,dirname as Su}from"path";import{parse as Us,stringify as Eu}from"yaml";function bu(e){let t=e.frame_path;return!t||t.length===0?"page":`page.frameLocator('${t[0]}')`}function yu(e){let t=e.xpath;return typeof t=="string"&&t.trim()?!t.startsWith("xpath=")&&!t.startsWith("/")&&!t.startsWith("//")?`xpath=//${t}`:t.startsWith("xpath=")?t:`xpath=${t}`:null}function Gs(e){let t=bu(e),i=e.locator;if(typeof i=="string"&&i.trim())return i=i.trim(),i.endsWith("first()")?`${t}.${i}`:`${t}.${i}.first()`;let n=yu(e);if(n){let a=JSON.stringify(n);return`${t}.locator(${a}).first()`}return null}function M(e,t){Q.set(e,t)}function He(e,t,i=[]){let n=[...i];return t.locator?n.push(`locator: ${JSON.stringify(t.locator)}`):t.xpath&&n.push(`xpath: ${JSON.stringify(t.xpath)}`),t.frame_path&&t.frame_path.length>0&&n.push(`frame_path: ${JSON.stringify(t.frame_path)}`),n.length===0?[`await agent.execAction("${e}", page, {});`]:[`await agent.execAction("${e}", page, {`,...n.map(a=>` ${a},`),"});"]}function Ws(e){let t=e.functionName;if(!t)return null;let i=Array.isArray(e.args)?e.args.map(String):[];if(i.length===0)return`await ${t}()`;let n=["page","testContext","request","agent"],a=["undefined","null","true","false"],o=i.map(r=>n.includes(r)||a.includes(r)||/^-?\d+(\.\d+)?$/.test(r)?r:r.startsWith("$")?`agent.agentServices.readVariable('${r.substring(1)}')`:`"${r}"`);return`await ${t}(${o.join(", ")})`}function zs(e,t,i){let n={expandingPaths:new Set([ua(t)]),depth:0,referencedPaths:new Set,basePath:i},a={...e};Array.isArray(a.statements)&&(a.statements=Ce(a.statements,t,n)),Array.isArray(a.teardown)&&(a.teardown=Ce(a.teardown,t,n));for(let o of["beforeAll","afterAll","beforeEach","afterEach"])Array.isArray(a[o])&&(a[o]=Ce(a[o],t,n));return{doc:a,referencedTemplatePaths:Array.from(n.referencedPaths)}}function Ce(e,t,i){let n=[];for(let a of e)if(Tu(a)){let o=Au(a,t,i);n.push(o)}else n.push($u(a,t,i));return n}function Tu(e){return typeof e=="object"&&e!==null&&typeof e.template=="string"}function Au(e,t,i){if(i.depth>=js)throw new Error(`Template expansion exceeded maximum depth of ${js}. Check for deeply nested or circular template references.`);let n=ua(Su(t),e.template),a=!ku(n)&&i.basePath?ua(i.basePath,e.template):n;if(i.expandingPaths.has(a))throw new Error(`Circular template reference detected: ${a} is already being expanded. Stack: ${Array.from(i.expandingPaths).join(" \u2192 ")} \u2192 ${a}`);i.referencedPaths.add(a);let o;try{o=_u(a,"utf-8")}catch(g){throw new Error(`Failed to read template file: ${a} (referenced from ${t}): ${g.message}`)}let r=Us(o);if(!r||typeof r!="object")throw new Error(`Invalid template file: ${a} \u2014 expected a YAML object`);let l=r.params||[],s=e.params||{};for(let g of l)if(!(g in s))throw new Error(`Template ${e.template} requires param "${g}" but it was not provided. Required params: [${l.join(", ")}]`);let c=r.statements;if(!Array.isArray(c))throw new Error(`Template ${e.template} must have a "statements" array`);if(Object.keys(s).length>0){let f=Eu(c);for(let[b,h]of Object.entries(s))f=f.split(`<<${b}>>`).join(String(h));c=Us(f)}let d={expandingPaths:new Set([...i.expandingPaths,a]),depth:i.depth+1,referencedPaths:i.referencedPaths},u=Ce(c,a,d),p={STEP:r.name||e.template.replace(/\.yaml$/,"").split("/").pop()||e.template,template_path:e.template,statements:u};return Object.keys(s).length>0&&(p.template_params=s),p}function $u(e,t,i){if(typeof e!="object"||e===null)return e;let n={...e};return Array.isArray(n.statements)&&(n.statements=Ce(n.statements,t,i)),Array.isArray(n.THEN)&&(n.THEN=Ce(n.THEN,t,i)),Array.isArray(n.ELSE)&&(n.ELSE=Ce(n.ELSE,t,i)),Array.isArray(n.DO)&&(n.DO=Ce(n.DO,t,i)),n}function Xs(e,t,i){let n=xu(e),a=n?.name,o=n?.tags,r=n?.use;if(n&&(n.name!==void 0||n.tags!==void 0||n.use!==void 0)&&(delete n.name,delete n.tags,delete n.use),n?.suite){if(n.goal||n.statements)throw new Vs('YAML file cannot have both "suite" and top-level "goal"/"statements". Use either suite format or single-test format.');return Iu(n,a,o,r,t,i)}return Mu(n,a,o,r,t,i)}function Mu(e,t,i,n,a,o){let r=e?.beforeEach,l=e?.afterEach,s=Ys(e?.parameters),c=e?.timeout,d=e?.skip,u=e?.fail,m=e?.only,p=e?.slow,g=e?.settings,f=n;if(g){let x={};g.auto_dismiss_modal!==void 0&&(x.autoDismissModal=!!g.auto_dismiss_modal),g.browser_timezone!==void 0&&g.browser_timezone!==null&&(x.timezoneId=String(g.browser_timezone)),g.browser_language!==void 0&&g.browser_language!==null&&(x.locale=String(g.browser_language)),g.extra_http_headers!==void 0&&g.extra_http_headers!==null&&typeof g.extra_http_headers=="object"&&(x.extraHTTPHeaders=g.extra_http_headers),Object.keys(x).length>0&&(f={...f,...x})}if(e&&(delete e.beforeEach,delete e.afterEach,delete e.parameters,delete e.timeout,delete e.skip,delete e.fail,delete e.only,delete e.slow,delete e.settings),e?.url)throw new Vs(`The "url" field is not supported in local YAML tests. Use "base_url: ${e.url}" and add "- URL: /" as the first statement instead.`);e&&!e.goal&&t&&(e.goal=t);let b=[];if(a&&e&&typeof e=="object"){let x=zs(e,a,o);e=x.doc,b=x.referencedTemplatePaths}let h=Ks(e),y=Se(h);return a&&(it(y.statements??[],a,"main"),y.teardown&&it(y.teardown,a,"teardown")),{testFlow:y,name:t,tags:i,use:f,beforeEach:r,afterEach:l,parameters:s,timeout:c,skip:d,fail:u,only:m,slow:p,referencedTemplatePaths:b}}function Iu(e,t,i,n,a,o){let r=e.suite;if(!Array.isArray(r.tests)||r.tests.length===0)throw new Error('Suite must have a non-empty "tests" array.');let l=r.beforeAll,s=r.afterAll,c=r.beforeEach,d=r.afterEach,u=[],m=r.tests.map(f=>{if(!f.name)throw new Error('Each test in a suite must have a "name" field.');if(!Array.isArray(f.statements)||f.statements.length===0)throw new Error(`Suite test "${f.name}" must have a non-empty "statements" array.`);let b={goal:f.name,statements:f.statements};f.teardown&&(b.teardown=f.teardown);let h=[],y=b;if(a&&typeof b=="object"){let $=zs(b,a,o);y=$.doc,h=$.referencedTemplatePaths,u.push(...h)}let x=Ks(y),E=Se(x),A=Ys(f.parameters);return{testFlow:E,name:f.name,tags:Array.isArray(f.tags)?f.tags:void 0,parameters:A,timeout:f.timeout,skip:f.skip,fail:f.fail,only:f.only,slow:f.slow}}),p=r.base_url,g=p?{...n,baseURL:p}:n;return{suite:{beforeAll:l,afterAll:s,beforeEach:c,afterEach:d,tests:m},name:t,tags:i,use:g,referencedTemplatePaths:u}}function Ys(e){if(!(!Array.isArray(e)||e.length===0))return e.map((t,i)=>{if(!t.name)throw new Error(`Parameter set at index ${i} must have a "name" field.`);if(!t.values||typeof t.values!="object")throw new Error(`Parameter set "${t.name}" must have a "values" object.`);return{name:t.name,values:t.values}})}function it(e,t,i){for(let n=0;n<e.length;n++){let a=e[n],o=`${i}.${n}`,r=a.description||"";if(a.uid=Pu(t,o,r),a.type===Fe.STEP)it(a.statements,t,o);else if(a.type===Fe.IF_ELSE){let l=a;it(l.then,t,`${o}.then`),l.else&&it(l.else,t,`${o}.else`)}else a.type===Fe.WHILE_LOOP&&it(a.body,t,`${o}.body`)}}function Pu(e,t,i){let n=vu("sha256").update(`${e}:${t}:${i}`).digest("hex");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20,32)}`}var Bs,Q,js,Vs,Js=v(()=>{"use strict";tt();tt();tt();tt();Bs=5e3;Q=new Map;M("click",e=>{let t=Gs(e);if(!t)return['await agent.execAction("click", page, {});'];let i=e.action_data?.kwargs?.timeout_ms??Bs;return[`await ${t}.click({ timeout: ${i} });`]});M("click_element",Q.get("click"));M("click_element_by_index",Q.get("click"));M("double_click",e=>He("double_click",e));M("double_click_on_element",Q.get("double_click"));M("right_click",e=>He("right_click",e));M("right_click_on_element",Q.get("right_click"));M("hover",e=>He("hover",e));M("hover_element_by_index",Q.get("hover"));M("input_text",e=>{let t=e.action_data?.kwargs?.text??e.action_data?.kwargs?.value??"";return He("input_text",e,[`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`])});M("fill",Q.get("input_text"));M("clear_input",e=>He("clear_input",e));M("press",e=>{let t=e.action_data?.kwargs?.keys;return[`await page.keyboard.press(${JSON.stringify(t)});`]});M("send_keys",Q.get("press"));M("send_keys_on_element",e=>{let t=Gs(e),i=e.action_data?.kwargs?.keys||"";if(!t)return['await agent.execAction("send_keys_on_element", page, {',` action_data: { kwargs: { keys: ${JSON.stringify(i)} } },`,"});"];let n=e.action_data?.kwargs?.timeout_ms??Bs;return[`await ${t}.press(${JSON.stringify(i)}, { timeout: ${n} });`]});M("select_dropdown_option",e=>{let t=e.action_data?.kwargs?.text||e.action_data?.kwargs?.option||"";return He("select_dropdown_option",e,[`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`])});M("scroll",e=>{let t=e.action_data?.kwargs?.down??!0;return[`await page.evaluate('window.scrollBy(0, window.innerHeight * ${(e.action_data?.kwargs?.num_pages??1)*(t?1:-1)})');`]});M("scroll_down",Q.get("scroll"));M("scroll_up",Q.get("scroll"));M("scroll_element",Q.get("scroll"));M("scroll_to_text",e=>{let t=e.action_data?.kwargs?.text||"";return[`await page.getByText(${JSON.stringify(t)}, { exact: false }).first().scrollIntoViewIfNeeded();`]});M("scroll_on_element",e=>He("scroll_on_element",e,[`action_data: { kwargs: ${JSON.stringify(e.action_data?.kwargs||{})} }`]));M("go_to_url",e=>{let t=e.action_data?.kwargs?.url||"";return e.action_data?.kwargs?.new_tab===!0?['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { url: ${JSON.stringify(t)}, new_tab: true } },`,"});"]:['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { url: ${JSON.stringify(t)} } },`,"});"]});M("open_tab",Q.get("go_to_url"));M("go_back",()=>['await agent.execAction("go_back", page, {});']);M("reload_page",()=>['await agent.execAction("reload_page", page, {});']);M("wait",e=>[`await page.waitForTimeout(${(e.action_data?.kwargs?.seconds||1)*1e3});`]);M("wait_for_page_ready",()=>["await page.waitForLoadState('domcontentloaded');"]);M("verify",(e,t)=>{let i=e.action_data?.kwargs,n=typeof i?.code=="string",a=n?i?.statement||e.action_description:e.action_description||i?.statement;if(n&&a){let r=i.code.split(`
4301
+ `,n+='- In action descriptions, describe what the placeholder represents in natural language (e.g., "Type the first user name" instead of "Type {{ firstUserName }}")',n}}});var Qt=v(()=>{"use strict"});async function sd(e,t){let i=new Set,n=Date.now(),a=new Set(["document","stylesheet","image","font","script","iframe"]),o=new Set(["text/html","text/css","application/javascript","image/","font/","application/json"]),r=["analytics","tracking","telemetry","beacon","metrics","doubleclick","adsystem","adserver","advertising","facebook.com/plugins","platform.twitter","linkedin.com/embed","livechat","zendesk","intercom","crisp.chat","hotjar","push-notifications","onesignal","pushwoosh","heartbeat","ping","alive","webrtc","rtmp://","wss://","cloudfront.net","fastly.net"],l=u=>{let m=u.toLowerCase();return m.startsWith("data:")||m.startsWith("blob:")?!0:r.some(p=>m.includes(p))},s=u=>{let m=u.resourceType(),p=u.url();if(!a.has(m)||l(p))return;let g=u.headers();g.purpose==="prefetch"||["video","audio"].includes(g["sec-fetch-dest"])||(i.add(u),n=Date.now())},c=async u=>{let m=u.request();if(!i.has(m))return;let p=(u.headers()["content-type"]||"").toLowerCase();if(["streaming","video","audio","webm","mp4","event-stream","websocket","protobuf"].some(f=>p.includes(f))){i.delete(m);return}if(![...o].some(f=>p.startsWith(f))){i.delete(m);return}let g=u.headers()["content-length"];if(g)try{if(parseInt(g,10)>5*1024*1024){i.delete(m);return}}catch{}i.delete(m),n=Date.now()},d=Date.now()-rd;for(let u of await e.requests()){let m=u.resourceType(),p=u.url(),g=u.timing();a.has(m)&&!l(p)&&g.responseEnd===-1&&g.startTime>=d&&(i.add(u),n=Date.now())}w.debug(`[waitForStableNetwork] Pre-populated ${i.size} in-flight requests`),e.on("request",s),e.on("response",c);try{let u=Date.now(),m=od;for(;;){await new Promise(g=>setTimeout(g,100));let p=Date.now();if(i.size===0&&p-n>=m){w.debug(`[waitForStableNetwork] Network idle after ${p-u}ms`);break}if(p-u>t){w.debug(`[waitForStableNetwork] Max wait time exceeded (${t}ms), pending: ${i.size}`);break}}}finally{e.removeListener("request",s),e.removeListener("response",c)}}async function qe(e,t=ad,i=nd){let n=Date.now();try{await Promise.all([e.waitForLoadState("load",{timeout:t}).catch(()=>{}),sd(e,t)])}catch(r){throw r instanceof Error?new Error(`Failed during network stabilization: ${r.message}`):new Error("An unknown error occurred during network stabilization.")}let a=Date.now()-n,o=Math.max(i-a,0);o>0&&await new Promise(r=>setTimeout(r,o))}var nd,ad,od,rd,Pe=v(()=>{"use strict";Qt();W();nd=.5*1e3,ad=30*1e3,od=1*1e3,rd=3*1e3});import{generateText as ld}from"ai";function cd(e,t){return e?{prompt_tokens:e.promptTokens||e.inputTokens||0,completion_tokens:e.completionTokens||e.outputTokens||0,total_tokens:e.totalTokens||0,model:t}:null}async function Or(e,t,i={}){let n=Date.now();if(i.maxSteps!==void 0&&i.maxSteps<=0)throw new Error(`maxSteps must be >= 1, got ${i.maxSteps}`);let a=i.maxSteps??15,o=3,r=t.agentServices.getModel(),l=t.domService||new Me(t.agentServices.getDomServiceOptions()),s={...t,domService:l};S.init(),S.section("Task Execution Started"),S.log(`Task: ${e}`),S.log(`Max steps: ${a}`),S.log(`Model: ${r}`);let c={currentStep:0,maxSteps:a,consecutiveFailures:0,maxFailures:o,lastFailReason:null,stepHistory:[],memory:[],lastGoal:null,lastEvaluation:null},d=[],u=tn(i.customPrompt),m=new an(u);S.log(`System prompt length: ${u.length} chars`);let p=!1,g="",f=[];try{for(i.onEvent?.({type:"start",task:e,maxSteps:a});c.currentStep<a;){if(i.abortSignal?.aborted)throw new Error("Task aborted by user");c.currentStep++;let b=Date.now();S.section(`Step ${c.currentStep}/${a}`),S.log(`URL: ${s.page.url()}`),i.onEvent?.({type:"step_start",step:c.currentStep});try{S.log("Waiting for page to stabilize..."),await qe(s.page),S.log("Page stabilized")}catch{S.log("Page stabilization timed out, continuing anyway")}let h;try{S.log("Preparing context (DOM + screenshot)...");let D=s.agentServices.getInteractiveClassNames(),F=s.agentServices.getIframeFallbackDomains();h=await Nr(s.page,s.domService,D,F),S.log("Context prepared")}catch(D){if(D.message.includes("Execution context was destroyed")){S.log("Page navigating, waiting for load..."),await qe(s.page);let F=s.agentServices.getInteractiveClassNames(),L=s.agentServices.getIframeFallbackDomains();h=await Nr(s.page,s.domService,F,L)}else throw S.error("Error preparing context",D),D}m.addStateMessage(e,h.currentUrl,h.domTree,h.screenshotBase64,c,{isFinalStep:c.currentStep===a-1,placeholderData:t.variables,sensitiveKeys:t.sensitiveKeys});let y=await ud(m,r,i,h.screenshotBase64);if(y.tokenUsages&&y.tokenUsages.length>0&&d.push(...y.tokenUsages),!y.stepOutput){if(S.error("Failed to get valid LLM response"),c.consecutiveFailures++,c.consecutiveFailures>=o){g="Reached the maximum allowed consecutive failures. Most recent error: Unable to get a valid response from the language model.";break}continue}let x=y.stepOutput;gd(c.currentStep,a,x);let E=await md(x,s,h.domState,c.currentStep,i.onEvent,h.screenshotBase64,y.debugInfo);f.push(...E.actionEntities);let A=pd(c.currentStep,x,E,c,b,y.debugInfo,y.tokenUsages),$=Date.now()-b;if(i.onEvent?.({type:"step_complete",step:c.currentStep,duration:$}),c.consecutiveFailures>=o){S.error(`Too many consecutive failures (${c.consecutiveFailures}), stopping`),g=`Reached the maximum allowed consecutive failures. Most recent error: ${c.lastFailReason}`;break}if(E.doneResult){p=E.doneResult.success,g=E.doneResult.summary;break}if(E.completesInstruction){p=!0,g="Instruction completed";break}}return c.currentStep>=a&&!p&&(g="Reached the maximum allowed steps."),i.onEvent?.({type:"complete",totalSteps:c.currentStep,duration:Date.now()-n}),S.log(`Build success result: summary=${g}, completed=${p}, actions=${f.length}, tokens=${d.length}`),fd(c,f,p,g,n,d,r)}catch(b){let h=b.message;return S.error(`Task execution failed: ${h}`,b),i.onEvent?.({type:"error",error:h,recoverable:!1}),wd(c,h,n,d,r)}}async function Nr(e,t,i,n){let{domState:a,screenshotBase64:o}=await t.getClickableElementsWithScreenshot(e,{interactiveClassNames:i,playwrightFrameFallbackDomains:n}),r=a.elementTree.clickableElementsToString();return{currentUrl:e.url(),domTree:r,screenshotBase64:o,domState:a}}function dd(e){return e.map(t=>({role:t.role,content:Array.isArray(t.content)?t.content.map(i=>{if(i.type==="image"){let n=i.image,a=typeof n=="string"?n:"";return{type:"image",file:a.startsWith("data:")?a:`data:image/png;base64,${a}`}}return{type:"text",text:i.text}}):t.content}))}async function ud(e,t,i,n){let a=i.temperature??0,{system:o,messages:r}=e.getMessages(),l=0;for(let u of r)Array.isArray(u.content)&&(l+=u.content.filter(m=>m.type==="image").length);let s=ye(t,l),c={model:be(t),system:o,messages:r,temperature:a,providerOptions:s},d=3;for(let u=0;u<d;u++)try{let m=Date.now();S.log(`Calling LLM (${t})...`);let p=await ld(c),g=Date.now()-m,f=p,b=f.usage;S.llmCall(t,g,b);let h=f.reasoningText;h&&(S.thinking(h),i.onEvent?.({type:"thinking",text:h})),e.addAssistantMessage(p.text);let y={systemPrompt:o,userPrompt:dd(r),rawLlmResponse:p.text,reasoningContent:h,screenshotWithSom:n},x=[],E=cd(b,t);E&&x.push(E);let A=hd(p.text);if(!A)if(u<d-1){S.log(`Attempt ${u+1}/${d}: Failed to parse response, retrying...`),e.addTextMessage("user","Your response was not valid JSON. Please respond with a properly formatted JSON object according to the expected format."),await new Promise($=>setTimeout($,i.retryDelay||1e3));continue}else return S.error("All parsing attempts failed"),{stepOutput:null,debugInfo:y,tokenUsages:x};return{stepOutput:A,debugInfo:y,tokenUsages:x}}catch(m){if(u<d-1){S.log(`Attempt ${u+1}/${d}: LLM call failed (${m.message}), retrying...`),await new Promise(p=>setTimeout(p,i.retryDelay||1e3));continue}else throw S.error("All LLM call attempts failed",m),m}return{stepOutput:null}}function hd(e){let t=e.trim();t.startsWith("```json")?t=t.replace(/^```json\s*/,"").replace(/\s*```\s*$/,""):t.startsWith("```")&&(t=t.replace(/^```\s*/,"").replace(/\s*```\s*$/,""));try{let i=JSON.parse(t);if(!i.current_goal)return S.error("Missing required field: current_goal"),null;if(!i.actions||!Array.isArray(i.actions)||i.actions.length===0)return S.error("Missing required field: actions (must be non-empty array)"),null;for(let n of i.actions){if(!n.action_name)return S.error("Action missing required field: action_name"),null;if(!n.description)return S.error("Action missing required field: description"),null}return i}catch(i){return S.error(`Failed to parse LLM JSON response: ${t.substring(0,500)}`),S.error(`Parse error: ${i.message}`),null}}async function md(e,t,i,n,a,o,r){let l=[],s=!0,c=null;S.log(`Using pre-captured DOM state with ${i.selectorMap.size} elements for ${e.actions.length} action(s)`);let d=null,u={...t,domState:i},m=o;for(let p of e.actions){if(p.action_name==="done"){d={success:p.kwargs.success??!0,summary:p.kwargs.summary||p.kwargs.text||"Task completed"};break}let g={},f=p.kwargs?.element_index??p.kwargs?.index;if(typeof f=="number"){let h=i.selectorMap.get(f);h&&(g=await R(t.page,h))}let b={...g,action_description:p.description,action_data:{action_name:p.action_name,kwargs:p.kwargs}};try{let h=await U.execute(p.action_name,p.kwargs,u);p.action_name==="perform_accurate_operation"&&(b=h.actionEntity);let y=await u.agentServices.getCurrentPage();if(y&&(u.page=y,t.page=u.page),h?.success===!1){s=!1,S.log("Action failed, stopping execution of remaining actions in this step"),c=h.error||"Action execution failed";break}l.push(b),a?.({type:"action",action_entity:b,step:n,debugInfo:r})}catch(h){s=!1,c=h.message,S.error(`Action execution failed: ${h.message}`);break}}return{allSuccess:s,failReason:c,actionEntities:l,doneResult:d,completesInstruction:e.completes_instruction??!1}}function pd(e,t,i,n,a,o,r){let l={stepNumber:e,thinking:t.thinking,evaluation:t.evaluation_previous_goal,memory:t.memory,goal:t.current_goal,actions:i.actionEntities,timestamp:a,duration:Date.now()-a,outcome:{success:i.allSuccess},debugInfo:o,tokenUsages:r};if(n.lastGoal=t.current_goal,t.evaluation_previous_goal&&(n.lastEvaluation=t.evaluation_previous_goal),t.memory&&t.memory.trim()){let s=t.memory.trim();n.memory.includes(s)||(n.memory.push(s),n.memory.length>10&&(n.memory=n.memory.slice(-10)))}return i.allSuccess?(n.consecutiveFailures=0,n.lastFailReason=null):(n.consecutiveFailures++,n.lastFailReason=i.failReason),n.stepHistory.push(l),l}function gd(e,t,i){if(S.log(`Step ${e}/${t}`),i.thinking&&S.log(`Thinking: ${i.thinking}`),i.evaluation_previous_goal&&S.log(`Evaluation: ${i.evaluation_previous_goal}`),i.memory&&S.log(`Memory: ${i.memory}`),S.log(`Goal: ${i.current_goal}`),i.actions.length===1){let n=i.actions[0];S.log(`Action: ${n.action_name}(${JSON.stringify(n.kwargs)}) - ${n.description}`)}else S.log(`Actions (${i.actions.length}):`),i.actions.forEach((n,a)=>{S.log(` ${a+1}. ${n.action_name}(${JSON.stringify(n.kwargs)}) - ${n.description}`)})}function fd(e,t,i,n,a,o,r){let l=o.reduce((d,u)=>d+u.prompt_tokens,0),s=o.reduce((d,u)=>d+u.completion_tokens,0),c=o.reduce((d,u)=>d+u.total_tokens,0);return{success:!0,completed:i,summary:n,trajectory:{steps:e.currentStep,actions:t,stepRecords:e.stepHistory},metadata:{totalSteps:e.currentStep,totalDuration:Date.now()-a,model:r,successfulSteps:e.stepHistory.filter(d=>d.outcome.success).length,failedSteps:e.stepHistory.filter(d=>!d.outcome.success).length,promptTokens:l,completionTokens:s,totalTokens:c,tokenUsages:o}}}function wd(e,t,i,n,a){let o=n.reduce((s,c)=>s+c.prompt_tokens,0),r=n.reduce((s,c)=>s+c.completion_tokens,0),l=n.reduce((s,c)=>s+c.total_tokens,0);return{success:!1,completed:!1,error:t,trajectory:{steps:e.currentStep,actions:[],stepRecords:e.stepHistory},metadata:{totalSteps:e.currentStep,totalDuration:Date.now()-i,model:a,successfulSteps:e.stepHistory.filter(s=>s.outcome.success).length,failedSteps:e.stepHistory.filter(s=>!s.outcome.success).length,promptTokens:o,completionTokens:r,totalTokens:l,tokenUsages:n}}}var Dr=v(()=>{"use strict";na();nn();xe();Le();te();Pe();ve();K()});var Lr={};nt(Lr,{TaskMessageManager:()=>an,formatFinalStepWarning:()=>Pr,formatTaskContext:()=>en,getBrowserTaskJSONPrompt:()=>tn,runTaskLoop:()=>Or});var Rr=v(()=>{"use strict";Dr();na();nn();xe();Ri();Le();mt();pt();Ve();gt();ft();te();Pe();Qt();ve();lt();Be();ct();De();K();Oe();W();ee();yt();H();fe()});async function vt(e,t){try{if(!e.action_data)return{success:!1,error:"Action entity missing action_data"};let{action_name:i,kwargs:n}=e.action_data;if(U.has(i)){let a=await U.execute(i,n,t),o=a?.success!==!1,r=a?.error||a?.message;return{success:o,error:o?void 0:r}}else{let{page:a,agentServices:o}=t;return await(await bd()).execute(a,e,o),{success:!0,error:void 0}}}catch(i){return{success:!1,error:i.message}}}async function bd(){if(on)return on;let e=await Promise.resolve().then(()=>(Qi(),Zi));return on=new e.default,on}async function Fi(e,t,i,n={},a){let o=a||{page:t,agentServices:i,domService:new Me(i.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},r=i.replaceVariables(e),l=await In(r,o,n);return l.status==="error"?{status:"error",completed:l.goalAccomplished||!1,actionEntities:[],explanation:l.reasoning,error:l.error,debugInfo:l.debugInfo}:{status:"success",completed:l.goalAccomplished||!1,actionEntities:l.actionEntity?[l.actionEntity]:[],explanation:l.reasoning,debugInfo:l.debugInfo}}async function Hi(e,t,i,n={},a){let o=a||{page:t,agentServices:i,domService:new Me(i.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},r=i.replaceVariables(e),l=await In(r,o,n);if(l.status==="error"||!l.actionEntity)return{status:"error",completed:l.goalAccomplished||!1,actionEntities:[],explanation:l.reasoning,error:l.error||"No action generated",debugInfo:l.debugInfo};let{actionEntity:s,reasoning:c,goalAccomplished:d,debugInfo:u}=l,m=await vt(s,o);return m.success?(c&&i.addNote(c),{status:"success",completed:d||!1,actionEntities:[s],explanation:c,debugInfo:u}):{status:"error",completed:!1,actionEntities:[s],error:m.error||"Action execution failed",debugInfo:u}}async function Wi(e,t,i,n={}){let a={page:t,agentServices:i,domService:new Me(i.getDomServiceOptions()),executionHistory:n.executionHistory,variables:n.variables,sensitiveKeys:n.sensitiveKeys},o=i.replaceVariables(e);return n.useCleanScreenshotForAssertion??(n.useCleanScreenshotForAssertion=i.isUseCleanScreenshotForAssertion()),Ya(o,a,n)}async function Ui(e,t,i,n,a={}){let{runTaskLoop:o}=await Promise.resolve().then(()=>(Rr(),Lr)),r=n?s=>{n(s)}:void 0,l=await o(e,{page:t,agentServices:i,domService:void 0,executionHistory:a.executionHistory,variables:a.variables,sensitiveKeys:a.sensitiveKeys},{maxSteps:a.maxSteps,onEvent:r,abortSignal:a.abortSignal});return{status:l.success?"success":"error",completed:l.completed,actionEntities:l.trajectory.actions,explanation:l.summary,error:l.error,tokenUsages:l.metadata.tokenUsages}}var on,xt=v(()=>{"use strict";Ti();xe();Le();on=null});import"uuid";import{z as _}from"zod";import"yaml";import"uuid";import"yaml";var ts,hx,is,Ad,$d,sn,mx,px,ns,as,Md,es,Id,ei,Pd,Cd,Nd,ae,Od,Dd,bx,Mx,ti=v(()=>{"use strict";fe();ts=112,hx=1080-ts,is=(e=>(e.Chromium="chromium",e.Firefox="firefox",e.Webkit="webkit",e))(is||{}),Ad={"Blackberry PlayBook":{name:"Blackberry PlayBook",userAgent:"Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/26.0 Safari/536.2+",screen:{width:600,height:1024},viewport:{width:600,height:1024},deviceScaleFactor:1,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"BlackBerry Z30":{name:"BlackBerry Z30",userAgent:"Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/26.0 Mobile Safari/537.10+",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy Note 3":{name:"Galaxy Note 3",userAgent:"Mozilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy Note II":{name:"Galaxy Note II",userAgent:"Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy S III":{name:"Galaxy S III",userAgent:"Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy S5":{name:"Galaxy S5",userAgent:"Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S8":{name:"Galaxy S8",userAgent:"Mozilla/5.0 (Linux; Android 7.0; SM-G950U Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:740},viewport:{width:360,height:740},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S9+":{name:"Galaxy S9+",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; SM-G965U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:320,height:658},viewport:{width:320,height:658},deviceScaleFactor:4.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S24":{name:"Galaxy S24",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-S921U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:780},viewport:{width:360,height:780},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy A55":{name:"Galaxy A55",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-A556B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:480,height:1040},viewport:{width:480,height:1040},deviceScaleFactor:2.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy Tab S4":{name:"Galaxy Tab S4",userAgent:"Mozilla/5.0 (Linux; Android 8.1.0; SM-T837A) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:712,height:1138},viewport:{width:712,height:1138},deviceScaleFactor:2.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy Tab S9":{name:"Galaxy Tab S9",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-X710) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:640,height:1024},viewport:{width:640,height:1024},deviceScaleFactor:2.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"iPad (gen 5)":{name:"iPad (gen 5)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 6)":{name:"iPad (gen 6)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 7)":{name:"iPad (gen 7)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:810,height:1080},viewport:{width:810,height:1080},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 11)":{name:"iPad (gen 11)",userAgent:"Mozilla/5.0 (iPad; CPU OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/19E241 Safari/604.1",screen:{width:656,height:944},viewport:{width:656,height:944},deviceScaleFactor:2.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad Mini":{name:"iPad Mini",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad Pro 11":{name:"iPad Pro 11",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:834,height:1194},viewport:{width:834,height:1194},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 6":{name:"iPhone 6",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 6 Plus":{name:"iPhone 6 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 7":{name:"iPhone 7",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 7 Plus":{name:"iPhone 7 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 8":{name:"iPhone 8",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 8 Plus":{name:"iPhone 8 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone SE":{name:"iPhone SE",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/26.0 Mobile/14E304 Safari/602.1",screen:{width:320,height:568},viewport:{width:320,height:568},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone SE (3rd gen)":{name:"iPhone SE (3rd gen)",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/26.0 Mobile/19E241 Safari/602.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone X":{name:"iPhone X",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:812},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone XR":{name:"iPhone XR",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:896},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11":{name:"iPhone 11",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:715},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11 Pro":{name:"iPhone 11 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:635},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11 Pro Max":{name:"iPhone 11 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:715},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12":{name:"iPhone 12",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Pro":{name:"iPhone 12 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Pro Max":{name:"iPhone 12 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Mini":{name:"iPhone 12 Mini",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:629},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13":{name:"iPhone 13",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Pro":{name:"iPhone 13 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Pro Max":{name:"iPhone 13 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Mini":{name:"iPhone 13 Mini",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:629},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14":{name:"iPhone 14",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Plus":{name:"iPhone 14 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Pro":{name:"iPhone 14 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:660},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Pro Max":{name:"iPhone 14 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:740},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15":{name:"iPhone 15",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:659},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Plus":{name:"iPhone 15 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:739},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Pro":{name:"iPhone 15 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:659},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Pro Max":{name:"iPhone 15 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:739},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Kindle Fire HDX":{name:"Kindle Fire HDX",userAgent:"Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true",screen:{width:800,height:1280},viewport:{width:800,height:1280},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"LG Optimus L70":{name:"LG Optimus L70",userAgent:"Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:384,height:640},viewport:{width:384,height:640},deviceScaleFactor:1.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Microsoft Lumia 550":{name:"Microsoft Lumia 550",userAgent:"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 550) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36 Edge/14.14263",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Microsoft Lumia 950":{name:"Microsoft Lumia 950",userAgent:"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36 Edge/14.14263",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:4,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 10":{name:"Nexus 10",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:800,height:1280},viewport:{width:800,height:1280},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 4":{name:"Nexus 4",userAgent:"Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:384,height:640},viewport:{width:384,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 5":{name:"Nexus 5",userAgent:"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 5X":{name:"Nexus 5X",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 6":{name:"Nexus 6",userAgent:"Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 6P":{name:"Nexus 6P",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 7":{name:"Nexus 7",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:600,height:960},viewport:{width:600,height:960},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nokia Lumia 520":{name:"Nokia Lumia 520",userAgent:"Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)",screen:{width:320,height:533},viewport:{width:320,height:533},deviceScaleFactor:1.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nokia N9":{name:"Nokia N9",userAgent:"Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13",screen:{width:480,height:854},viewport:{width:480,height:854},deviceScaleFactor:1,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Pixel 2":{name:"Pixel 2",userAgent:"Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:411,height:731},viewport:{width:411,height:731},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 2 XL":{name:"Pixel 2 XL",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:411,height:823},viewport:{width:411,height:823},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 3":{name:"Pixel 3",userAgent:"Mozilla/5.0 (Linux; Android 9; Pixel 3 Build/PQ1A.181105.017.A1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:393,height:786},viewport:{width:393,height:786},deviceScaleFactor:2.75,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 4":{name:"Pixel 4",userAgent:"Mozilla/5.0 (Linux; Android 10; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:353,height:745},viewport:{width:353,height:745},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 4a (5G)":{name:"Pixel 4a (5G)",userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 4a (5G)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:892},viewport:{width:412,height:765},deviceScaleFactor:2.63,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 5":{name:"Pixel 5",userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:393,height:851},viewport:{width:393,height:727},deviceScaleFactor:2.75,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 7":{name:"Pixel 7",userAgent:"Mozilla/5.0 (Linux; Android 14; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:915},viewport:{width:412,height:839},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Moto G4":{name:"Moto G4",userAgent:"Mozilla/5.0 (Linux; Android 7.0; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Desktop Chrome HiDPI":{name:"Desktop Chrome HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Edge HiDPI":{name:"Desktop Edge HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Firefox HiDPI":{name:"Desktop Firefox HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0.1) Gecko/20100101 Firefox/142.0.1",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"firefox"},"Desktop Safari":{name:"Desktop Safari",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Safari/605.1.15",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"webkit"},"Desktop Chrome":{name:"Desktop Chrome",displayName:"Playwright Chromium",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Chrome Medium Resolution":{name:"Desktop Chrome Medium Resolution",displayName:"Playwright Chromium",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Chrome (Branded)":{name:"Desktop Chrome (Branded)",displayName:"Google Chrome",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"chrome"},"Desktop Chrome Medium Resolution (Branded)":{name:"Desktop Chrome Medium Resolution (Branded)",displayName:"Google Chrome",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"chrome"},"Desktop Edge":{name:"Desktop Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1920,height:1080},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Edge (Branded)":{name:"Desktop Edge (Branded)",displayName:"Microsoft Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"msedge"},"Desktop Edge Medium Resolution (Branded)":{name:"Desktop Edge Medium Resolution (Branded)",displayName:"Microsoft Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"msedge"},"Desktop Firefox":{name:"Desktop Firefox",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0.1) Gecko/20100101 Firefox/142.0.1",screen:{width:1920,height:1080},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"firefox"}},$d={desktop:["Desktop Chrome","Desktop Chrome Medium Resolution","Desktop Chrome (Branded)","Desktop Chrome Medium Resolution (Branded)","Desktop Edge (Branded)","Desktop Edge Medium Resolution (Branded)","Desktop Safari"],mobile:["iPhone 15 Pro Max","iPhone 15 Pro","iPhone 15 Plus","iPhone 15","iPhone 14 Pro Max","iPhone 14 Pro","iPhone 14 Plus","iPhone 14","iPhone 13 Pro Max","iPhone 13 Pro","iPhone 13","iPhone 13 Mini","iPhone 12 Pro Max","iPhone 12 Pro","iPhone 12","iPhone 12 Mini","iPhone 11 Pro Max","iPhone 11 Pro","iPhone 11","iPhone XR","iPhone X","iPhone SE (3rd gen)","iPhone SE","iPhone 8 Plus","iPhone 8","iPhone 7 Plus","iPhone 7","iPhone 6 Plus","iPhone 6","Galaxy S24","Galaxy A55","Galaxy S9+","Galaxy S8","Galaxy S5","Galaxy Note 3","Galaxy Note II","Galaxy S III","Pixel 7","Pixel 5","Pixel 4a (5G)","Pixel 4","Pixel 3","Pixel 2 XL","Pixel 2","Nexus 6P","Nexus 6","Nexus 5X","Nexus 5","Nexus 4","Moto G4","LG Optimus L70","Microsoft Lumia 950","Microsoft Lumia 550","Nokia Lumia 520","Nokia N9","BlackBerry Z30"]},sn=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),$d[e].map(n=>Ad[n]).filter(n=>n.defaultBrowserType&&i.includes(n.defaultBrowserType))},mx={desktop:{label:"Desktop",type:"desktop",devices:sn("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:sn("mobile")}},px={desktop:{label:"Desktop",type:"desktop",devices:sn("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:sn("mobile",!0)}},ns=(e=>(e.PASSWORD="password",e.OAUTH2="oauth2",e.SSO="sso",e.API="api",e))(ns||{}),as=(e=>(e.SMS="sms",e.EMAIL="email",e.TOTP="totp",e))(as||{}),Md=_.enum(["JS_CODE","AI_MODE"]),es=_.object({type:Md,expression:_.string()}),Id=_.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),ei=_.object({uid:_.string(),type:Id,comment:_.string().optional()}),Pd=_.object({action_data:_.object({action_name:_.string(),kwargs:_.record(_.any()).optional(),args:_.array(_.any()).optional()}),action_description:_.string().optional(),url:_.string().optional(),xpath:_.string().nullable().optional(),locator:_.string().nullable().optional(),css_selector:_.string().nullable().optional(),unique_selector:_.string().nullable().optional(),element_index:_.number().nullable().optional(),frame_path:_.array(_.any()).optional(),artifacts:_.record(_.any()).optional(),feedback:_.string().optional(),original_browser_use_action:_.any().optional()}).passthrough(),Cd=ei.extend({type:_.literal("DRAFT"),description:_.string()}),Nd=ei.extend({type:_.literal("ACTION"),description:_.string(),action_entity:Pd.optional(),locator:_.string().optional(),use_pure_vision:_.boolean().optional()}),ae=_.lazy(()=>_.union([Cd,Nd,ei.extend({type:_.literal("STEP"),description:_.string().optional().default(""),statements:_.array(ae),reference_id:_.number().optional(),template_path:_.string().optional(),template_params:_.record(_.string()).optional()}),ei.extend({type:_.literal("IF_ELSE"),description:_.string().optional(),condition:es,then:_.array(ae),else:_.array(ae).optional()}),ei.extend({type:_.literal("WHILE_LOOP"),description:_.string().optional(),condition:es,body:_.array(ae),timeout_ms:_.number().optional()})])),Od=_.object({name:_.string(),statements:_.array(ae),teardown:_.array(ae).optional(),skip:_.union([_.boolean(),_.string()]).optional(),timeout:_.number().optional(),fail:_.union([_.boolean(),_.string()]).optional(),only:_.boolean().optional(),slow:_.boolean().optional()}),Dd=_.object({tests:_.array(Od).min(1),beforeAll:_.array(ae).optional(),afterAll:_.array(ae).optional(),beforeEach:_.array(ae).optional(),afterEach:_.array(ae).optional()}),bx=_.object({comment:_.string().optional(),version:_.string().optional(),goal:_.string().optional(),url:_.string().optional(),baseURL:_.string().optional(),final_feedback:_.string().optional(),completed:_.boolean().optional(),success:_.boolean().optional(),statements:_.array(ae).optional(),teardown:_.array(ae).optional(),last_modified_at:_.string().optional(),testGroup:Dd.optional()}).refine(e=>e.testGroup!==void 0?e.goal===void 0&&(e.statements===void 0||e.statements.length===0):e.goal!==void 0,{message:"TestFlow must have either goal/statements (single test) or testGroup (suite), not both"}),Mx=1024*1024});var oa=v(()=>{"use strict";te();Pe()});var ls=v(()=>{"use strict"});var cs=v(()=>{"use strict"});var ds=v(()=>{"use strict"});import{v4 as gS}from"uuid";var us=v(()=>{"use strict"});import{z as k}from"zod";var hs,ra,ms,Ze,ps,gs,fs,ne,ws,cn,sa,la=v(()=>{"use strict";hs=k.enum(["JS_CODE","AI_MODE"]),ra=k.object({type:hs,expression:k.string()}),ms=k.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),Ze=k.object({uid:k.string(),type:ms,comment:k.string().optional()}),ps=k.object({action_data:k.object({action_name:k.string(),kwargs:k.record(k.any()).optional(),args:k.array(k.any()).optional()}),action_description:k.string().optional(),url:k.string().optional(),xpath:k.string().nullable().optional(),locator:k.string().nullable().optional(),css_selector:k.string().nullable().optional(),unique_selector:k.string().nullable().optional(),element_index:k.number().nullable().optional(),frame_path:k.array(k.any()).optional(),artifacts:k.record(k.any()).optional(),feedback:k.string().optional(),original_browser_use_action:k.any().optional()}).passthrough(),gs=Ze.extend({type:k.literal("DRAFT"),description:k.string()}),fs=Ze.extend({type:k.literal("ACTION"),description:k.string(),action_entity:ps.optional(),locator:k.string().optional(),use_pure_vision:k.boolean().optional()}),ne=k.lazy(()=>k.union([gs,fs,Ze.extend({type:k.literal("STEP"),description:k.string().optional().default(""),statements:k.array(ne),reference_id:k.number().optional(),template_path:k.string().optional(),template_params:k.record(k.string()).optional()}),Ze.extend({type:k.literal("IF_ELSE"),description:k.string().optional(),condition:ra,then:k.array(ne),else:k.array(ne).optional()}),Ze.extend({type:k.literal("WHILE_LOOP"),description:k.string().optional(),condition:ra,body:k.array(ne),timeout_ms:k.number().optional()})])),ws=k.object({name:k.string(),statements:k.array(ne),teardown:k.array(ne).optional(),skip:k.union([k.boolean(),k.string()]).optional(),timeout:k.number().optional(),fail:k.union([k.boolean(),k.string()]).optional(),only:k.boolean().optional(),slow:k.boolean().optional()}),cn=k.object({tests:k.array(ws).min(1),beforeAll:k.array(ne).optional(),afterAll:k.array(ne).optional(),beforeEach:k.array(ne).optional(),afterEach:k.array(ne).optional()}),sa=k.object({comment:k.string().optional(),version:k.string().optional(),goal:k.string().optional(),url:k.string().optional(),baseURL:k.string().optional(),final_feedback:k.string().optional(),completed:k.boolean().optional(),success:k.boolean().optional(),statements:k.array(ne).optional(),teardown:k.array(ne).optional(),last_modified_at:k.string().optional(),testGroup:cn.optional()}).refine(e=>e.testGroup!==void 0?e.goal===void 0&&(e.statements===void 0||e.statements.length===0):e.goal!==void 0,{message:"TestFlow must have either goal/statements (single test) or testGroup (suite), not both"})});import{stringify as Yd,parse as xs,parseAllDocuments as xS,parseDocument as Jd,Document as qd,isMap as et,isSeq as de}from"yaml";import{v4 as ce}from"uuid";function dn(e,t){let i={...t?.test_case_id!==void 0?{test_case_id:t.test_case_id}:{},...t?.name?{name:t.name}:{},goal:e.goal??"",url:e.url,base_url:e.baseURL,...t?.timeout!==void 0?{timeout:t.timeout}:{},...t?.settings&&Object.keys(t.settings).length>0?{settings:t.settings}:{},statements:(e.statements??[]).map(oe)};return e.final_feedback&&(i.final_feedback=e.final_feedback),e.teardown&&e.teardown.length>0&&(i.teardown=e.teardown.map(oe)),i}function un(e,t){if(e.testGroup)return ks(e,t);let i=dn(e,t),n=new qd(i);return e.comment&&(n.commentBefore=e.comment),bs(n,e.statements??[]),e.teardown&&bs(n,e.teardown,"teardown"),n.toString(_s)}function bs(e,t,i="statements"){let n=e.contents;if(!n||!et(n))return;let a=n.get(i,!0);de(a)&&ai(a,t)}function ai(e,t){for(let i=0;i<Math.min(e.items.length,t.length);i++){let n=t[i],a=e.items[i];if(i>0&&(a.spaceBefore=!0),n.comment&&(i===0?e.commentBefore=n.comment:a.commentBefore=n.comment),et(a)){let o=a;if(n.type==="STEP"){let r=o.get("statements",!0);de(r)&&ai(r,n.statements)}else if(n.type==="IF_ELSE"){let r=o.get("THEN",!0);de(r)&&ai(r,n.then);let l=o.get("ELSE",!0);de(l)&&n.else&&ai(l,n.else)}else if(n.type==="WHILE_LOOP"){let r=o.get("DO",!0);de(r)&&ai(r,n.body)}}}}function ks(e,t){let i=e.testGroup;if(!i)throw new Error("suiteToYaml requires a TestFlow with testGroup");let n={};t?.test_case_id!==void 0&&(n.test_case_id=t.test_case_id),t?.name&&(n.name=t.name),t?.tags&&t.tags.length>0&&(n.tags=t.tags),t?.use&&Object.keys(t.use).length>0&&(n.use=t.use),t?.settings&&Object.keys(t.settings).length>0&&(n.settings=t.settings);let a={};return e.baseURL&&(a.base_url=e.baseURL),i.beforeAll&&i.beforeAll.length>0&&(a.beforeAll=i.beforeAll.map(oe)),i.beforeEach&&i.beforeEach.length>0&&(a.beforeEach=i.beforeEach.map(oe)),i.afterEach&&i.afterEach.length>0&&(a.afterEach=i.afterEach.map(oe)),i.afterAll&&i.afterAll.length>0&&(a.afterAll=i.afterAll.map(oe)),a.tests=i.tests.map(o=>{let r={name:o.name};return o.skip!==void 0&&(r.skip=o.skip),o.timeout!==void 0&&(r.timeout=o.timeout),o.fail!==void 0&&(r.fail=o.fail),o.only!==void 0&&(r.only=o.only),o.slow!==void 0&&(r.slow=o.slow),r.statements=o.statements.map(oe),o.teardown&&o.teardown.length>0&&(r.teardown=o.teardown.map(oe)),r}),n.suite=a,Yd(n,_s)}function oe(e){switch(e.type){case"DRAFT":return Zd(e);case"ACTION":return Qd(e);case"STEP":return eu(e);case"IF_ELSE":return tu(e);case"WHILE_LOOP":return iu(e)}}function Zd(e){return{intent:e.description}}function Qd(e){let t=e.action_entity?.action_data?.action_name??e.action_entity?.action?.action_name,i=e.action_entity?.action_data?.kwargs??e.action_entity?.action?.kwargs;if(t==="verify"){let l=i?.statement;if(typeof l=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let s=i?.code;return typeof s=="string"?{VERIFY:l,js:s}:{VERIFY:l}}}if(t==="go_to_url"){let l=i?.url;if(typeof l=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let s={URL:l};return i?.new_tab===!0&&(s.new_tab=!0),typeof i?.timeout_seconds=="number"&&(s.timeout_seconds=i.timeout_seconds),s}}if(t==="js_action"){let l=i?.code;if(typeof l=="string"&&e.description)return{intent:e.description,js:l}}if(t==="ai_wait_until"){let l=i?.condition;if(typeof l=="string"){let s={WAIT_UNTIL:l};return typeof i?.timeout_seconds=="number"&&i.timeout_seconds!==60&&(s.timeout_seconds=i.timeout_seconds),s}}if(t==="wait"){let l=i?.seconds,c={WAIT:e.description||`Wait ${l}s`};return typeof l=="number"&&(c.seconds=l),c}if(t==="js_code"){let l=i?.code;if(typeof l=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath)return{CODE:l}}if(!e.action_entity)return{intent:e.description};let n=e.action_entity.action_data??e.action_entity.action;if(!n)return{intent:e.description};let a={intent:e.description,action:n.action_name},o=e.locator??e.action_entity.locator;o&&(a.locator=o);let r=e.action_entity.xpath;if(r&&(a.xpath=r),e.use_pure_vision&&(a.use_pure_vision=!0),n.kwargs&&Object.keys(n.kwargs).length>0)for(let[l,s]of Object.entries(n.kwargs))a[l]=s;return n.args&&n.args.length>0&&(a.args=n.args),a}function eu(e){if(e.template_path){let i={template:e.template_path};return e.template_params&&Object.keys(e.template_params).length>0&&(i.params=e.template_params),i}let t={STEP:e.description,statements:e.statements.map(oe)};return e.reference_id!==void 0&&(t.reference_id=e.reference_id),t}function tu(e){let t={IF:Ss(e.condition),THEN:e.then.map(oe)};return e.else&&e.else.length>0&&(t.ELSE=e.else.map(oe)),t}function iu(e){let t={WHILE:Ss(e.condition),DO:e.body.map(oe)};return e.timeout_ms!==void 0&&(t.timeout_ms=e.timeout_ms),t}function Ss(e){return e.type==="JS_CODE"?`js:${e.expression}`:e.expression}function da(e){try{let t=xs(e);if(!t||typeof t!="object")return{};let i={};return typeof t.test_case_id=="number"&&Number.isFinite(t.test_case_id)&&(i.test_case_id=t.test_case_id),typeof t.template_id=="number"&&Number.isFinite(t.template_id)&&(i.template_id=t.template_id),typeof t.name=="string"&&t.name.trim()&&(i.name=t.name.trim()),typeof t.timeout=="number"&&Number.isFinite(t.timeout)&&(i.timeout=t.timeout),t.settings&&typeof t.settings=="object"&&!Array.isArray(t.settings)&&(i.settings=t.settings),i}catch{return{}}}function ca(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(ca);let t=e,i=Object.keys(t);if(i.length===1){let a=i[0];if(a.startsWith("{ ")&&a.endsWith(" }")&&t[a]===null)return`{{${a.slice(2,-2)}}}`}let n={};for(let[a,o]of Object.entries(t))n[a]=ca(o);return n}function Se(e){if(e.length>ys)throw new Error(`YAML input too large (${e.length} bytes, max ${ys})`);let t=ca(xs(e));if(!t||typeof t!="object")throw new Error("Invalid YAML: expected an object at root level");if(t.suite)return nu(t);let i={version:"1.3.0",goal:t.goal,url:t.url,baseURL:t.base_url,statements:re(t.statements??[])};t.final_feedback&&(i.final_feedback=t.final_feedback),t.teardown&&Array.isArray(t.teardown)&&(i.teardown=re(t.teardown));let n=sa.safeParse(i);if(!n.success)throw new Error(`Invalid TestFlow after YAML conversion: ${JSON.stringify(n.error.errors)}`);let a=n.data;return hn(e,a),a}function nu(e){let t=e.suite;if(!t||typeof t!="object")throw new Error("Invalid suite: expected an object");let i=t.tests;if(!Array.isArray(i)||i.length===0)throw new Error('Suite must have a non-empty "tests" array');let a={tests:i.map(l=>{if(!l.name)throw new Error('Each test in a suite must have a "name" field');if(!Array.isArray(l.statements)||l.statements.length===0)throw new Error(`Suite test "${l.name}" must have a non-empty "statements" array`);let s={name:l.name,statements:re(l.statements)};return Array.isArray(l.teardown)&&l.teardown.length>0&&(s.teardown=re(l.teardown)),l.skip!==void 0&&(s.skip=l.skip),typeof l.timeout=="number"&&(s.timeout=l.timeout),l.fail!==void 0&&(s.fail=l.fail),l.only===!0&&(s.only=!0),l.slow===!0&&(s.slow=!0),s})};Array.isArray(t.beforeAll)&&t.beforeAll.length>0&&(a.beforeAll=re(t.beforeAll)),Array.isArray(t.afterAll)&&t.afterAll.length>0&&(a.afterAll=re(t.afterAll)),Array.isArray(t.beforeEach)&&t.beforeEach.length>0&&(a.beforeEach=re(t.beforeEach)),Array.isArray(t.afterEach)&&t.afterEach.length>0&&(a.afterEach=re(t.afterEach));let o=cn.safeParse(a);if(!o.success)throw new Error(`Invalid TestGroup: ${JSON.stringify(o.error.errors)}`);return{version:"1.3.0",baseURL:t.base_url||void 0,testGroup:o.data}}function re(e){if(!Array.isArray(e))throw new Error("Expected an array of statements");return e.map(au)}function au(e){if(typeof e=="string")throw new Error(`Plain string statements are not supported. Use an object with a "desc" key instead. Example: { "desc": "${e}" }`);if(typeof e!="object"||e===null)throw new Error(`Invalid statement: expected object, got ${typeof e}`);let t=e;if("IF"in t)return ou(t);if("WHILE"in t)return ru(t);if("STEP"in t)return su(t);if("VERIFY"in t){let i=t.VERIFY,n={statement:typeof i=="string"?i:String(i)};return typeof t.js=="string"&&(n.code=t.js),{uid:ce(),type:"ACTION",description:String(i),action_entity:{action_description:String(i),action_data:{action_name:"verify",kwargs:n}}}}if("URL"in t){let i=t.URL,n=t.new_tab===!0?!0:void 0,a=typeof t.timeout_seconds=="number"?t.timeout_seconds:void 0,o={url:typeof i=="string"?i:String(i)};return n&&(o.new_tab=!0),a!==void 0&&(o.timeout_seconds=a),{uid:ce(),type:"ACTION",description:`Navigate to ${i}`,action_entity:{action_description:`Navigate to ${i}`,action_data:{action_name:"go_to_url",kwargs:o}}}}if("WAIT_UNTIL"in t){let i=t.WAIT_UNTIL,n=typeof t.timeout_seconds=="number"?t.timeout_seconds:60;return{uid:ce(),type:"ACTION",description:`Wait until: ${i}`,action_entity:{action_description:`Wait until: ${i}`,action_data:{action_name:"ai_wait_until",kwargs:{condition:typeof i=="string"?i:String(i),timeout_seconds:n}}}}}if("WAIT"in t){let i=t.WAIT,n=typeof t.seconds=="number"?t.seconds:3;return{uid:ce(),type:"ACTION",description:typeof i=="string"?i:`Wait ${n}s`,action_entity:{action_description:typeof i=="string"?i:`Wait ${n}s`,action_data:{action_name:"wait",kwargs:{seconds:n}}}}}if("CODE"in t){let i=t.CODE;if(i==null)throw new Error('CODE statement has no code. Use "CODE: |" followed by indented code on the next line.');return{uid:ce(),type:"ACTION",description:"Code block",action_entity:{action_description:"Code block",action_data:{action_name:"js_code",kwargs:{code:typeof i=="string"?i:String(i)}}}}}if("js"in t&&("intent"in t||"desc"in t)&&!("VERIFY"in t)&&t.action!=="verify"){let i=t.js,n=typeof t.intent=="string"?t.intent:typeof t.desc=="string"?t.desc:"";return{uid:ce(),type:"ACTION",description:n,action_entity:{action_description:n,action_data:{action_name:"js_action",kwargs:{code:typeof i=="string"?i:String(i)}}}}}if("call"in t&&typeof t.call=="string"){let{call:i,...n}=t;return vs({...n,action:"function",functionName:i})}if("action"in t)return vs(t);if("intent"in t&&typeof t.intent=="string"||"desc"in t&&typeof t.desc=="string")return{uid:ce(),type:"DRAFT",description:typeof t.intent=="string"?t.intent:t.desc};throw new Error(`Cannot infer statement type from object: ${JSON.stringify(t)}`)}function Es(e){if(typeof e!="string")throw new Error(`Condition must be a string, got ${typeof e}`);return e.startsWith("js:")?{type:"JS_CODE",expression:e.slice(3)}:{type:"AI_MODE",expression:e}}function ou(e){let t=Es(e.IF),i=e.THEN;if(!Array.isArray(i))throw new Error("IF_ELSE requires a THEN array");let n={uid:ce(),type:"IF_ELSE",condition:t,then:re(i)};return"ELSE"in e&&Array.isArray(e.ELSE)&&(n.else=re(e.ELSE)),n}function ru(e){let t=Es(e.WHILE),i=e.DO;if(!Array.isArray(i))throw new Error("WHILE_LOOP requires a DO array");let n={uid:ce(),type:"WHILE_LOOP",condition:t,body:re(i)};return typeof e.timeout_ms=="number"&&(n.timeout_ms=e.timeout_ms),n}function su(e){let t=typeof e.STEP=="string"?e.STEP:"";if(!Array.isArray(e.statements))throw new Error("STEP requires a statements array");let i={uid:ce(),type:"STEP",description:t,statements:re(e.statements)};if(typeof e.reference_id=="number"&&(i.reference_id=e.reference_id),typeof e.template_path=="string"&&(i.template_path=e.template_path),e.template_params&&typeof e.template_params=="object"&&!Array.isArray(e.template_params)){let n=e.template_params,a={};for(let[o,r]of Object.entries(n))a[o]=String(r);i.template_params=a}return i}function vs(e){let t=typeof e.action=="string"?e.action:String(e.action),i=typeof e.intent=="string"?e.intent:typeof e.desc=="string"?e.desc:"",n=typeof e.locator=="string"?e.locator:void 0,a=typeof e.xpath=="string"?e.xpath:void 0,o=typeof e.use_pure_vision=="boolean"?e.use_pure_vision:void 0,r={};for(let[c,d]of Object.entries(e))lu.has(c)||(r[c]=d);t==="verify"&&typeof r.js=="string"&&(r.code=r.js,delete r.js);let l={action_description:i,action_data:{action_name:t,kwargs:Object.keys(r).length>0?r:{}}};n&&(l.locator=n),a&&(l.xpath=a);let s={uid:ce(),type:"ACTION",description:i,action_entity:l};return o&&(s.use_pure_vision=!0),s}function hn(e,t){let i;try{i=Jd(e)}catch{return}let n=i.contents;if(!n||!et(n))return;if(i.commentBefore)t.comment=i.commentBefore;else{let s=n.items?.[0];s?.key&&s.key.commentBefore&&(t.comment=s.key.commentBefore)}let a=n,o=a.get("statements",!0);de(o)&&t.statements&&Qe(o,t.statements);let r=a.get("teardown",!0);de(r)&&t.teardown&&Qe(r,t.teardown)}function Qe(e,t){e.commentBefore&&t.length>0&&(t[0].comment=e.commentBefore);for(let i=0;i<Math.min(e.items.length,t.length);i++){let n=e.items[i];n.commentBefore&&!(i===0&&e.commentBefore)&&(t[i].comment=n.commentBefore);let a=t[i];if(a.type==="STEP"&&et(n)){let o=n.get("statements",!0);de(o)&&Qe(o,a.statements)}else if(a.type==="IF_ELSE"&&et(n)){let o=n.get("THEN",!0);de(o)&&Qe(o,a.then);let r=n.get("ELSE",!0);de(r)&&a.else&&Qe(r,a.else)}else if(a.type==="WHILE_LOOP"&&et(n)){let o=n.get("DO",!0);de(o)&&Qe(o,a.body)}}}var _s,ys,lu,mn=v(()=>{"use strict";la();_s={lineWidth:120,defaultKeyType:"PLAIN",defaultStringType:"PLAIN"};ys=1024*1024;lu=new Set(["action","intent","desc","locator","xpath","use_pure_vision"])});import{parse as TS,stringify as AS}from"yaml";var Ts=v(()=>{"use strict";mn()});var pn=v(()=>{"use strict"});var As=v(()=>{"use strict";mn();pn()});var gn=v(()=>{"use strict"});var $s=v(()=>{"use strict";gn()});var Ms,uu,Is,Ps,oi,hu,mu,Cs=v(()=>{"use strict";Ms=112,uu=1080-Ms,Is={"Blackberry PlayBook":{name:"Blackberry PlayBook",userAgent:"Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML like Gecko) Version/26.0 Safari/536.2+",screen:{width:600,height:1024},viewport:{width:600,height:1024},deviceScaleFactor:1,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"BlackBerry Z30":{name:"BlackBerry Z30",userAgent:"Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/26.0 Mobile Safari/537.10+",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy Note 3":{name:"Galaxy Note 3",userAgent:"Mozilla/5.0 (Linux; U; Android 4.3; en-us; SM-N900T Build/JSS15J) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy Note II":{name:"Galaxy Note II",userAgent:"Mozilla/5.0 (Linux; U; Android 4.1; en-us; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy S III":{name:"Galaxy S III",userAgent:"Mozilla/5.0 (Linux; U; Android 4.0; en-us; GT-I9300 Build/IMM76D) AppleWebKit/534.30 (KHTML, like Gecko) Version/26.0 Mobile Safari/534.30",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Galaxy S5":{name:"Galaxy S5",userAgent:"Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S8":{name:"Galaxy S8",userAgent:"Mozilla/5.0 (Linux; Android 7.0; SM-G950U Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:740},viewport:{width:360,height:740},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S9+":{name:"Galaxy S9+",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; SM-G965U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:320,height:658},viewport:{width:320,height:658},deviceScaleFactor:4.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy S24":{name:"Galaxy S24",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-S921U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:780},viewport:{width:360,height:780},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy A55":{name:"Galaxy A55",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-A556B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:480,height:1040},viewport:{width:480,height:1040},deviceScaleFactor:2.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy Tab S4":{name:"Galaxy Tab S4",userAgent:"Mozilla/5.0 (Linux; Android 8.1.0; SM-T837A) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:712,height:1138},viewport:{width:712,height:1138},deviceScaleFactor:2.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Galaxy Tab S9":{name:"Galaxy Tab S9",userAgent:"Mozilla/5.0 (Linux; Android 14; SM-X710) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:640,height:1024},viewport:{width:640,height:1024},deviceScaleFactor:2.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"iPad (gen 5)":{name:"iPad (gen 5)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 6)":{name:"iPad (gen 6)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 7)":{name:"iPad (gen 7)",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:810,height:1080},viewport:{width:810,height:1080},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad (gen 11)":{name:"iPad (gen 11)",userAgent:"Mozilla/5.0 (iPad; CPU OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/19E241 Safari/604.1",screen:{width:656,height:944},viewport:{width:656,height:944},deviceScaleFactor:2.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad Mini":{name:"iPad Mini",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:768,height:1024},viewport:{width:768,height:1024},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPad Pro 11":{name:"iPad Pro 11",userAgent:"Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:834,height:1194},viewport:{width:834,height:1194},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 6":{name:"iPhone 6",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 6 Plus":{name:"iPhone 6 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 7":{name:"iPhone 7",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 7 Plus":{name:"iPhone 7 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 8":{name:"iPhone 8",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 8 Plus":{name:"iPhone 8 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:414,height:736},viewport:{width:414,height:736},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone SE":{name:"iPhone SE",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/26.0 Mobile/14E304 Safari/602.1",screen:{width:320,height:568},viewport:{width:320,height:568},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone SE (3rd gen)":{name:"iPhone SE (3rd gen)",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/26.0 Mobile/19E241 Safari/602.1",screen:{width:375,height:667},viewport:{width:375,height:667},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone X":{name:"iPhone X",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/26.0 Mobile/15A372 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:812},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone XR":{name:"iPhone XR",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:896},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11":{name:"iPhone 11",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:715},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11 Pro":{name:"iPhone 11 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:635},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 11 Pro Max":{name:"iPhone 11 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:414,height:896},viewport:{width:414,height:715},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12":{name:"iPhone 12",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Pro":{name:"iPhone 12 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Pro Max":{name:"iPhone 12 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 12 Mini":{name:"iPhone 12 Mini",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:629},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13":{name:"iPhone 13",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Pro":{name:"iPhone 13 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Pro Max":{name:"iPhone 13 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 13 Mini":{name:"iPhone 13 Mini",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:375,height:812},viewport:{width:375,height:629},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14":{name:"iPhone 14",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:390,height:844},viewport:{width:390,height:664},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Plus":{name:"iPhone 14 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:428,height:926},viewport:{width:428,height:746},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Pro":{name:"iPhone 14 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:660},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 14 Pro Max":{name:"iPhone 14 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:740},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15":{name:"iPhone 15",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:659},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Plus":{name:"iPhone 15 Plus",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:739},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Pro":{name:"iPhone 15 Pro",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:393,height:852},viewport:{width:393,height:659},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"iPhone 15 Pro Max":{name:"iPhone 15 Pro Max",userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1",screen:{width:430,height:932},viewport:{width:430,height:739},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Kindle Fire HDX":{name:"Kindle Fire HDX",userAgent:"Mozilla/5.0 (Linux; U; en-us; KFAPWI Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.13 Safari/535.19 Silk-Accelerated=true",screen:{width:800,height:1280},viewport:{width:800,height:1280},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"LG Optimus L70":{name:"LG Optimus L70",userAgent:"Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LGMS323 Build/KOT49I.MS32310c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:384,height:640},viewport:{width:384,height:640},deviceScaleFactor:1.25,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Microsoft Lumia 550":{name:"Microsoft Lumia 550",userAgent:"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 550) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36 Edge/14.14263",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Microsoft Lumia 950":{name:"Microsoft Lumia 950",userAgent:"Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 950) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36 Edge/14.14263",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:4,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 10":{name:"Nexus 10",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 10 Build/MOB31T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:800,height:1280},viewport:{width:800,height:1280},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 4":{name:"Nexus 4",userAgent:"Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:384,height:640},viewport:{width:384,height:640},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 5":{name:"Nexus 5",userAgent:"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 5X":{name:"Nexus 5X",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 6":{name:"Nexus 6",userAgent:"Mozilla/5.0 (Linux; Android 7.1.1; Nexus 6 Build/N6F26U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 6P":{name:"Nexus 6P",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Nexus 6P Build/OPP3.170518.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:732},viewport:{width:412,height:732},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nexus 7":{name:"Nexus 7",userAgent:"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 7 Build/MOB30X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:600,height:960},viewport:{width:600,height:960},deviceScaleFactor:2,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nokia Lumia 520":{name:"Nokia Lumia 520",userAgent:"Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 520)",screen:{width:320,height:533},viewport:{width:320,height:533},deviceScaleFactor:1.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Nokia N9":{name:"Nokia N9",userAgent:"Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13",screen:{width:480,height:854},viewport:{width:480,height:854},deviceScaleFactor:1,isMobile:!0,hasTouch:!0,defaultBrowserType:"webkit"},"Pixel 2":{name:"Pixel 2",userAgent:"Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:411,height:731},viewport:{width:411,height:731},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 2 XL":{name:"Pixel 2 XL",userAgent:"Mozilla/5.0 (Linux; Android 8.0.0; Pixel 2 XL Build/OPD1.170816.004) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:411,height:823},viewport:{width:411,height:823},deviceScaleFactor:3.5,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 3":{name:"Pixel 3",userAgent:"Mozilla/5.0 (Linux; Android 9; Pixel 3 Build/PQ1A.181105.017.A1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:393,height:786},viewport:{width:393,height:786},deviceScaleFactor:2.75,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 4":{name:"Pixel 4",userAgent:"Mozilla/5.0 (Linux; Android 10; Pixel 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:353,height:745},viewport:{width:353,height:745},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 4a (5G)":{name:"Pixel 4a (5G)",userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 4a (5G)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:892},viewport:{width:412,height:765},deviceScaleFactor:2.63,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 5":{name:"Pixel 5",userAgent:"Mozilla/5.0 (Linux; Android 11; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:393,height:851},viewport:{width:393,height:727},deviceScaleFactor:2.75,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Pixel 7":{name:"Pixel 7",userAgent:"Mozilla/5.0 (Linux; Android 14; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:412,height:915},viewport:{width:412,height:839},deviceScaleFactor:2.625,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Moto G4":{name:"Moto G4",userAgent:"Mozilla/5.0 (Linux; Android 7.0; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Mobile Safari/537.36",screen:{width:360,height:640},viewport:{width:360,height:640},deviceScaleFactor:3,isMobile:!0,hasTouch:!0,defaultBrowserType:"chromium"},"Desktop Chrome HiDPI":{name:"Desktop Chrome HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Edge HiDPI":{name:"Desktop Edge HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Firefox HiDPI":{name:"Desktop Firefox HiDPI",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0.1) Gecko/20100101 Firefox/142.0.1",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"firefox"},"Desktop Safari":{name:"Desktop Safari",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Safari/605.1.15",screen:{width:1792,height:1120},viewport:{width:1280,height:720},deviceScaleFactor:2,isMobile:!1,hasTouch:!1,defaultBrowserType:"webkit"},"Desktop Chrome":{name:"Desktop Chrome",displayName:"Playwright Chromium",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Chrome Medium Resolution":{name:"Desktop Chrome Medium Resolution",displayName:"Playwright Chromium",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Chrome (Branded)":{name:"Desktop Chrome (Branded)",displayName:"Google Chrome",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"chrome"},"Desktop Chrome Medium Resolution (Branded)":{name:"Desktop Chrome Medium Resolution (Branded)",displayName:"Google Chrome",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"chrome"},"Desktop Edge":{name:"Desktop Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1920,height:1080},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium"},"Desktop Edge (Branded)":{name:"Desktop Edge (Branded)",displayName:"Microsoft Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1920,height:1080},viewport:{width:1920,height:1080},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"msedge"},"Desktop Edge Medium Resolution (Branded)":{name:"Desktop Edge Medium Resolution (Branded)",displayName:"Microsoft Edge",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.7390.16 Safari/537.36 Edg/141.0.7390.16",screen:{width:1280,height:720},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"chromium",channel:"msedge"},"Desktop Firefox":{name:"Desktop Firefox",userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:142.0.1) Gecko/20100101 Firefox/142.0.1",screen:{width:1920,height:1080},viewport:{width:1280,height:720},deviceScaleFactor:1,isMobile:!1,hasTouch:!1,defaultBrowserType:"firefox"}},Ps={desktop:["Desktop Chrome","Desktop Chrome Medium Resolution","Desktop Chrome (Branded)","Desktop Chrome Medium Resolution (Branded)","Desktop Edge (Branded)","Desktop Edge Medium Resolution (Branded)","Desktop Safari"],mobile:["iPhone 15 Pro Max","iPhone 15 Pro","iPhone 15 Plus","iPhone 15","iPhone 14 Pro Max","iPhone 14 Pro","iPhone 14 Plus","iPhone 14","iPhone 13 Pro Max","iPhone 13 Pro","iPhone 13","iPhone 13 Mini","iPhone 12 Pro Max","iPhone 12 Pro","iPhone 12","iPhone 12 Mini","iPhone 11 Pro Max","iPhone 11 Pro","iPhone 11","iPhone XR","iPhone X","iPhone SE (3rd gen)","iPhone SE","iPhone 8 Plus","iPhone 8","iPhone 7 Plus","iPhone 7","iPhone 6 Plus","iPhone 6","Galaxy S24","Galaxy A55","Galaxy S9+","Galaxy S8","Galaxy S5","Galaxy Note 3","Galaxy Note II","Galaxy S III","Pixel 7","Pixel 5","Pixel 4a (5G)","Pixel 4","Pixel 3","Pixel 2 XL","Pixel 2","Nexus 6P","Nexus 6","Nexus 5X","Nexus 5","Nexus 4","Moto G4","LG Optimus L70","Microsoft Lumia 950","Microsoft Lumia 550","Nokia Lumia 520","Nokia N9","BlackBerry Z30"]},oi=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),Ps[e].map(n=>Is[n]).filter(n=>n.defaultBrowserType&&i.includes(n.defaultBrowserType))},hu={desktop:{label:"Desktop",type:"desktop",devices:oi("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:oi("mobile")}},mu={desktop:{label:"Desktop",type:"desktop",devices:oi("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:oi("mobile",!0)}}});var Ns=v(()=>{"use strict"});var Os=v(()=>{"use strict";pn()});var Fe,Ds=v(()=>{"use strict";Fe=(e=>(e.DRAFT="DRAFT",e.STEP="STEP",e.ACTION="ACTION",e.IF_ELSE="IF_ELSE",e.WHILE_LOOP="WHILE_LOOP",e))(Fe||{})});var Ls=v(()=>{"use strict"});var Rs=v(()=>{"use strict"});var Fs=v(()=>{"use strict"});var Hs=v(()=>{"use strict";gn()});var tt=v(()=>{"use strict";ls();cs();ds();us();Ts();As();mn();la();$s();Cs();Ns();Os();pn();Ds();Ls();Rs();Fs();Hs();gn()});import{stringify as YT}from"yaml";import{createHash as vu}from"crypto";import{parse as xu,stringify as Ks}from"yaml";import{readFileSync as _u,existsSync as ku}from"fs";import{resolve as ua,dirname as Su}from"path";import{parse as Us,stringify as Eu}from"yaml";function bu(e){let t=e.frame_path;return!t||t.length===0?"page":`page.frameLocator('${t[0]}')`}function yu(e){let t=e.xpath;return typeof t=="string"&&t.trim()?!t.startsWith("xpath=")&&!t.startsWith("/")&&!t.startsWith("//")?`xpath=//${t}`:t.startsWith("xpath=")?t:`xpath=${t}`:null}function Gs(e){let t=bu(e),i=e.locator;if(typeof i=="string"&&i.trim())return i=i.trim(),i.endsWith("first()")?`${t}.${i}`:`${t}.${i}.first()`;let n=yu(e);if(n){let a=JSON.stringify(n);return`${t}.locator(${a}).first()`}return null}function M(e,t){Q.set(e,t)}function He(e,t,i=[]){let n=[...i];return t.locator?n.push(`locator: ${JSON.stringify(t.locator)}`):t.xpath&&n.push(`xpath: ${JSON.stringify(t.xpath)}`),t.frame_path&&t.frame_path.length>0&&n.push(`frame_path: ${JSON.stringify(t.frame_path)}`),n.length===0?[`await agent.execAction("${e}", page, {});`]:[`await agent.execAction("${e}", page, {`,...n.map(a=>` ${a},`),"});"]}function Ws(e){let t=e.functionName;if(!t)return null;let i=Array.isArray(e.args)?e.args.map(String):[];if(i.length===0)return`await ${t}()`;let n=["page","testContext","request","agent"],a=["undefined","null","true","false"],o=i.map(r=>n.includes(r)||a.includes(r)||/^-?\d+(\.\d+)?$/.test(r)?r:r.startsWith("$")?`agent.agentServices.readVariable('${r.substring(1)}')`:`"${r}"`);return`await ${t}(${o.join(", ")})`}function zs(e,t,i){let n={expandingPaths:new Set([ua(t)]),depth:0,referencedPaths:new Set,basePath:i},a={...e};Array.isArray(a.statements)&&(a.statements=Ce(a.statements,t,n)),Array.isArray(a.teardown)&&(a.teardown=Ce(a.teardown,t,n));for(let o of["beforeAll","afterAll","beforeEach","afterEach"])Array.isArray(a[o])&&(a[o]=Ce(a[o],t,n));return{doc:a,referencedTemplatePaths:Array.from(n.referencedPaths)}}function Ce(e,t,i){let n=[];for(let a of e)if(Tu(a)){let o=Au(a,t,i);n.push(o)}else n.push($u(a,t,i));return n}function Tu(e){return typeof e=="object"&&e!==null&&typeof e.template=="string"}function Au(e,t,i){if(i.depth>=js)throw new Error(`Template expansion exceeded maximum depth of ${js}. Check for deeply nested or circular template references.`);let n=ua(Su(t),e.template),a=!ku(n)&&i.basePath?ua(i.basePath,e.template):n;if(i.expandingPaths.has(a))throw new Error(`Circular template reference detected: ${a} is already being expanded. Stack: ${Array.from(i.expandingPaths).join(" \u2192 ")} \u2192 ${a}`);i.referencedPaths.add(a);let o;try{o=_u(a,"utf-8")}catch(g){throw new Error(`Failed to read template file: ${a} (referenced from ${t}): ${g.message}`)}let r=Us(o);if(!r||typeof r!="object")throw new Error(`Invalid template file: ${a} \u2014 expected a YAML object`);let l=r.params||[],s=e.params||{};for(let g of l)if(!(g in s))throw new Error(`Template ${e.template} requires param "${g}" but it was not provided. Required params: [${l.join(", ")}]`);let c=r.statements;if(!Array.isArray(c))throw new Error(`Template ${e.template} must have a "statements" array`);if(Object.keys(s).length>0){let f=Eu(c);for(let[b,h]of Object.entries(s))f=f.split(`<<${b}>>`).join(String(h));c=Us(f)}let d={expandingPaths:new Set([...i.expandingPaths,a]),depth:i.depth+1,referencedPaths:i.referencedPaths},u=Ce(c,a,d),p={STEP:r.name||e.template.replace(/\.yaml$/,"").split("/").pop()||e.template,template_path:e.template,statements:u};return Object.keys(s).length>0&&(p.template_params=s),p}function $u(e,t,i){if(typeof e!="object"||e===null)return e;let n={...e};return Array.isArray(n.statements)&&(n.statements=Ce(n.statements,t,i)),Array.isArray(n.THEN)&&(n.THEN=Ce(n.THEN,t,i)),Array.isArray(n.ELSE)&&(n.ELSE=Ce(n.ELSE,t,i)),Array.isArray(n.DO)&&(n.DO=Ce(n.DO,t,i)),n}function Xs(e,t,i){let n=xu(e),a=n?.name,o=n?.tags,r=n?.use;if(n&&(n.name!==void 0||n.tags!==void 0||n.use!==void 0)&&(delete n.name,delete n.tags,delete n.use),n?.suite){if(n.goal||n.statements)throw new Vs('YAML file cannot have both "suite" and top-level "goal"/"statements". Use either suite format or single-test format.');return Iu(n,a,o,r,t,i)}return Mu(n,a,o,r,t,i)}function Mu(e,t,i,n,a,o){let r=e?.beforeEach,l=e?.afterEach,s=Ys(e?.parameters),c=e?.timeout,d=e?.skip,u=e?.fail,m=e?.only,p=e?.slow,g=e?.settings,f=n;if(g){let x={};g.auto_dismiss_modal!==void 0&&(x.autoDismissModal=!!g.auto_dismiss_modal),g.browser_timezone!==void 0&&g.browser_timezone!==null&&(x.timezoneId=String(g.browser_timezone)),g.browser_language!==void 0&&g.browser_language!==null&&(x.locale=String(g.browser_language)),g.extra_http_headers!==void 0&&g.extra_http_headers!==null&&typeof g.extra_http_headers=="object"&&(x.extraHTTPHeaders=g.extra_http_headers),Object.keys(x).length>0&&(f={...f,...x})}if(e&&(delete e.beforeEach,delete e.afterEach,delete e.parameters,delete e.timeout,delete e.skip,delete e.fail,delete e.only,delete e.slow,delete e.settings),e?.url)throw new Vs(`The "url" field is not supported in local YAML tests. Use "base_url: ${e.url}" and add "- URL: /" as the first statement instead.`);e&&!e.goal&&t&&(e.goal=t);let b=[];if(a&&e&&typeof e=="object"){let x=zs(e,a,o);e=x.doc,b=x.referencedTemplatePaths}let h=Ks(e),y=Se(h);return a&&(it(y.statements??[],a,"main"),y.teardown&&it(y.teardown,a,"teardown")),{testFlow:y,name:t,tags:i,use:f,beforeEach:r,afterEach:l,parameters:s,timeout:c,skip:d,fail:u,only:m,slow:p,referencedTemplatePaths:b}}function Iu(e,t,i,n,a,o){let r=e.suite;if(!Array.isArray(r.tests)||r.tests.length===0)throw new Error('Suite must have a non-empty "tests" array.');let l=r.beforeAll,s=r.afterAll,c=r.beforeEach,d=r.afterEach,u=[],m=r.tests.map(f=>{if(!f.name)throw new Error('Each test in a suite must have a "name" field.');if(!Array.isArray(f.statements)||f.statements.length===0)throw new Error(`Suite test "${f.name}" must have a non-empty "statements" array.`);let b={goal:f.name,statements:f.statements};f.teardown&&(b.teardown=f.teardown);let h=[],y=b;if(a&&typeof b=="object"){let $=zs(b,a,o);y=$.doc,h=$.referencedTemplatePaths,u.push(...h)}let x=Ks(y),E=Se(x),A=Ys(f.parameters);return{testFlow:E,name:f.name,tags:Array.isArray(f.tags)?f.tags:void 0,parameters:A,timeout:f.timeout,skip:f.skip,fail:f.fail,only:f.only,slow:f.slow}}),p=r.base_url,g=p?{...n,baseURL:p}:n;return{suite:{beforeAll:l,afterAll:s,beforeEach:c,afterEach:d,tests:m},name:t,tags:i,use:g,referencedTemplatePaths:u}}function Ys(e){if(!(!Array.isArray(e)||e.length===0))return e.map((t,i)=>{if(!t.name)throw new Error(`Parameter set at index ${i} must have a "name" field.`);if(!t.values||typeof t.values!="object")throw new Error(`Parameter set "${t.name}" must have a "values" object.`);return{name:t.name,values:t.values}})}function it(e,t,i){for(let n=0;n<e.length;n++){let a=e[n],o=`${i}.${n}`,r=a.description||"";if(a.uid=Pu(t,o,r),a.type===Fe.STEP)it(a.statements,t,o);else if(a.type===Fe.IF_ELSE){let l=a;it(l.then,t,`${o}.then`),l.else&&it(l.else,t,`${o}.else`)}else a.type===Fe.WHILE_LOOP&&it(a.body,t,`${o}.body`)}}function Pu(e,t,i){let n=vu("sha256").update(`${e}:${t}:${i}`).digest("hex");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20,32)}`}var Bs,Q,js,Vs,Js=v(()=>{"use strict";tt();tt();tt();tt();Bs=5e3;Q=new Map;M("click",e=>{let t=Gs(e);if(!t)return['await agent.execAction("click", page, {});'];let i=e.action_data?.kwargs?.timeout_ms??Bs;return[`await ${t}.click({ timeout: ${i} });`]});M("click_element",Q.get("click"));M("click_element_by_index",Q.get("click"));M("double_click",e=>He("double_click",e));M("double_click_on_element",Q.get("double_click"));M("right_click",e=>He("right_click",e));M("right_click_on_element",Q.get("right_click"));M("hover",e=>He("hover",e));M("hover_element_by_index",Q.get("hover"));M("input_text",e=>{let t=e.action_data?.kwargs?.text??e.action_data?.kwargs?.value??"";return He("input_text",e,[`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`])});M("fill",Q.get("input_text"));M("clear_input",e=>He("clear_input",e));M("press",e=>{let t=e.action_data?.kwargs?.keys;return[`await page.keyboard.press(${JSON.stringify(t)});`]});M("send_keys",Q.get("press"));M("send_keys_on_element",e=>{let t=Gs(e),i=e.action_data?.kwargs?.keys||"";if(!t)return['await agent.execAction("send_keys_on_element", page, {',` action_data: { kwargs: { keys: ${JSON.stringify(i)} } },`,"});"];let n=e.action_data?.kwargs?.timeout_ms??Bs;return[`await ${t}.press(${JSON.stringify(i)}, { timeout: ${n} });`]});M("select_dropdown_option",e=>{let t=e.action_data?.kwargs?.text||e.action_data?.kwargs?.option||"";return He("select_dropdown_option",e,[`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`])});M("scroll",e=>{let t=e.action_data?.kwargs?.down??!0;return[`await page.evaluate('window.scrollBy(0, window.innerHeight * ${(e.action_data?.kwargs?.num_pages??1)*(t?1:-1)})');`]});M("scroll_down",Q.get("scroll"));M("scroll_up",Q.get("scroll"));M("scroll_element",Q.get("scroll"));M("scroll_to_text",e=>{let t=e.action_data?.kwargs?.text||"";return[`await page.getByText(${JSON.stringify(t)}, { exact: false }).first().scrollIntoViewIfNeeded();`]});M("scroll_on_element",e=>He("scroll_on_element",e,[`action_data: { kwargs: ${JSON.stringify(e.action_data?.kwargs||{})} }`]));M("go_to_url",e=>{let t=e.action_data?.kwargs?.url||"";return e.action_data?.kwargs?.new_tab===!0?['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { url: ${JSON.stringify(t)}, new_tab: true } },`,"});"]:['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { url: ${JSON.stringify(t)} } },`,"});"]});M("open_tab",Q.get("go_to_url"));M("go_back",()=>['await agent.execAction("go_back", page, {});']);M("reload_page",()=>['await agent.execAction("reload_page", page, {});']);M("wait",e=>[`await page.waitForTimeout(${(e.action_data?.kwargs?.seconds||1)*1e3});`]);M("wait_for_page_ready",()=>["await page.waitForLoadState('domcontentloaded');"]);M("verify",(e,t)=>{let i=e.action_data?.kwargs,n=typeof i?.code=="string",a=n?i?.statement||e.action_description:e.action_description||i?.statement;if(n&&a){let r=i.code.split(`
4302
4302
  `),l=JSON.stringify(a);return["{ const _t = Date.now(); try {",...r.map(s=>` ${s}`),` console.log(\`[VERIFY:JS] \u2713 \${((Date.now()-_t)/1000).toFixed(1)}s: ${l}\`);`,"} catch (_e) {",` console.log(\`[VERIFY:JS\u2192AI] JS failed \${((Date.now()-_t)/1000).toFixed(1)}s: (\${_e instanceof Error ? _e.message : String(_e)}), falling back to AI: ${l}\`);`,` await agent.assert(page, ${l}, ${JSON.stringify(t||"")});`,"} }"]}return n?i.code.split(`
4303
4303
  `):a?[`await agent.assert(page, ${JSON.stringify(a)}, ${JSON.stringify(t||"")});`]:["// Skipping verify: missing statement or code"]});M("ai_assert",Q.get("verify"));M("assert",Q.get("verify"));M("ai_action",(e,t)=>{let i=e.action_data?.kwargs?.statement;if(!i)return["// Skipping ai_action: missing statement"];let n=JSON.stringify(i),a=e.action_data?.kwargs?.use_pure_vision;return[`await agent.execute(page, ${n}, '${t||""}', ${a});`]});M("ai_step",(e,t)=>{let i=e.action_data?.kwargs?.statement;return i?[`await agent.run(page, ${JSON.stringify(i)}, '${t||""}');`]:["// Skipping ai_step: missing statement"]});M("ai_extract",(e,t)=>{let i=e.action_data?.kwargs?.element_description,n=e.action_data?.kwargs?.variable_name;if(!i||!n)return["// Skipping ai_extract: missing element_description or variable_name"];let a=JSON.stringify(i),o=JSON.stringify(n);return[`await agent.extract(page, ${a}, ${o}, '${t||""}');`]});M("ai_wait_until",(e,t)=>{let i=e.action_data?.kwargs?.condition,n=e.action_data?.kwargs?.timeout_seconds||60;return i?[`await agent.waitUntilCondition(page, ${JSON.stringify(i)}, ${n}, '${t||""}');`]:["// Skipping ai_wait_until: missing condition"]});M("save_variable",e=>{let t=e.action_data?.kwargs?.name||"",i=e.action_data?.kwargs?.value;return['await agent.execAction("save_variable", page, {',` action_data: { kwargs: { name: ${JSON.stringify(t)}, value: ${JSON.stringify(i)} } },`,"});"]});M("js_code",e=>{let t=e.action_data?.kwargs?.code;if(!t)return["// Skipping js_code: missing code"];let i=["{"],n=t.split(`
4304
4304
  `);for(let a of n)i.push(` ${a}`);return i.push("}"),i});M("function",(e,t,i)=>{let n=e.action_data?.kwargs||{},a=n.functionName;if(a&&a.includes("#")){let[r,l]=a.split("#");if(r&&l){let s=r.replace(/\.(ts|js|mjs)$/,""),c=`import { ${l} } from '${s}';`;i?.imports?.add(c);let d={...n,functionName:l},u=Ws(d);return u?[u.endsWith(";")?u:`${u};`]:["// Skipping function: invalid export pattern"]}}let o=Ws(n);return o?[o.endsWith(";")?o:`${o};`]:["// Skipping function: missing functionName"]});M("generate_2fa_code",e=>{let t=e.action_data?.kwargs?.otp_secret_key||"";return['await agent.execAction("generate_2fa_code", page, {',` action_data: { kwargs: { otp_secret_key: ${JSON.stringify(t)} } },`,"});"]});M("upload_file",e=>{let t=e.action_data?.kwargs||{},i=[],n={};return t.paths?n.paths=t.paths:t.path&&(n.path=t.path),t.use_file_input&&(n.use_file_input=!0),i.push(`action_data: { kwargs: ${JSON.stringify(n)} }`),e.locator?i.push(`locator: ${JSON.stringify(e.locator)}`):e.xpath&&i.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&i.push(`frame_path: ${JSON.stringify(e.frame_path)}`),['await agent.execAction("upload_file", page, {',...i.map(a=>` ${a},`),"});"]});M("wait_for_download_complete",e=>['await agent.execAction("wait_for_download_complete", page, {',` action_data: { kwargs: { timeout_seconds: ${e.action_data?.kwargs?.timeout_seconds||10} } },`,"});"]);M("switch_tab",e=>['await agent.execAction("switch_tab", page, {',` action_data: { kwargs: { page_id: ${e.action_data?.kwargs?.page_id??e.action_data?.kwargs?.tab_index??0} } },`,"});"]);M("close_tab",e=>{let t=e.action_data?.kwargs?.page_id;return t=t??e.action_data?.kwargs?.index,['await agent.execAction("close_tab", page, {',` action_data: { kwargs: { page_id: ${t} } },`,"});"]});M("set_date_for_native_date_picker",e=>{let t=e.action_data?.kwargs?.date??"",i=[];return i.push(`action_data: { kwargs: { date: ${JSON.stringify(t)} } }`),e.locator?i.push(`locator: ${JSON.stringify(e.locator)}`):e.xpath&&i.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&i.push(`frame_path: ${JSON.stringify(e.frame_path)}`),['await agent.execAction("set_date_for_native_date_picker", page, {',...i.map(n=>` ${n},`),"});"]});M("done",()=>["// Done - no action needed"]);M("js_action",e=>{let t=e.action_data?.kwargs?.code;return t?t.split(`