shiplightai 0.1.63 → 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.
@@ -134,17 +134,17 @@ To use them, write Jinja-like template syntax: {{ placeholder_name }}
134
134
  `}if(n&&n.length>0){let g=Wh(n);m+=`
135
135
  `+g}return m+=`
136
136
  Based on the above information, please determine the right action to accomplish the task.
137
- `,c.push({type:"text",text:m}),c}var hn=y(()=>{"use strict";Bt()});async function Bh(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 s="(title unavailable)";try{s=await Promise.race([r.title(),new Promise((d,c)=>setTimeout(()=>c(new Error("timeout")),1e3))])}catch{}let l=`Tab ${o}: ${r.url()}`;s&&(l+=` - ${s.slice(0,50)}`),n.push(l)}let a=n.length>0?n.join(`
137
+ `,c.push({type:"text",text:m}),c}var hn=y(()=>{"use strict";Bt()});function mn(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=y(()=>{"use strict"});async function Bh(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 s="(title unavailable)";try{s=await Promise.race([r.title(),new Promise((d,c)=>setTimeout(()=>c(new Error("timeout")),1e3))])}catch{}let l=`Tab ${o}: ${r.url()}`;s&&(l+=` - ${s.slice(0,50)}`),n.push(l)}let a=n.length>0?n.join(`
138
138
  `):"";return{currentTabText:i!==null?`Current tab: ${i}
139
- `:"",tabsText:a}}async function Uh(e,t){let{currentTabText:i,tabsText:n}=await Bh(e);return{elementsText:t,currentUrl:e.url(),currentTitle:await e.title(),currentTabText:i,tabsText:n}}async function mn(e,t){let{page:i,domService:n,agentServices:a}=e,o=typeof t=="boolean"?{useCleanScreenshot:t}:t||{},r=a.getInteractiveClassNames(),s=a.getIframeFallbackDomains(),{domState:l,screenshotBase64:d,slicedScreenshotsBase64:c}=await n.getClickableElementsWithScreenshot(i,{interactiveClassNames:r,playwrightFrameFallbackDomains:s,useCleanScreenshot:o.useCleanScreenshot,useSlicedScreenshots:o.useSlicedScreenshots,resizeSlicedScreenshots:o.resizeSlicedScreenshots,useAccessibilityTree:o.useAccessibilityTree,actionIntent:o.actionIntent}),u=l.elementTree.clickableElementsToString(),m=await Uh(i,u);return c&&(m.slicedScreenshotsBase64=c),{domTree:u,screenshotBase64:d,slicedScreenshotsBase64:c,domState:l,pageContext:m}}var Ut=y(()=>{"use strict"});function pn(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 Gt=y(()=>{"use strict"});var oe,dt,W,Te=y(()=>{"use strict";oe=require("zod"),dt=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),s={...i,actionDescription:a};return await n.execute(r,s)}catch(a){if(a instanceof oe.z.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 oe.z.object({done:oe.z.any()});let i=e.map(r=>{let s=r.schema;if(t&&s instanceof oe.z.ZodObject){let l=s._def.shape();s=oe.z.object({...l,description:oe.z.string().describe("Semantic, human-readable description of the action")})}if(s instanceof oe.z.ZodObject){let l=s._def.shape();Object.keys(l).length===0&&(s=oe.z.object({_empty:oe.z.boolean().optional()}))}return oe.z.object({[r.name]:s})});if(i.length===1)return i[0];let[n,a,...o]=i;return oe.z.union([n,a,...o])}},W=new dt});async function B(e,t){if(t<0)return;let{page:i,domService:n}=e;return(e.domState||await n.getClickableElements(i)).selectorMap.get(t)}function Gh(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 Kh(e,t=!0){try{let i=Gh(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 s=o;o.includes(`
139
+ `:"",tabsText:a}}async function Uh(e,t){let{currentTabText:i,tabsText:n}=await Bh(e);return{elementsText:t,currentUrl:e.url(),currentTitle:await e.title(),currentTabText:i,tabsText:n}}async function pn(e,t){let{page:i,domService:n,agentServices:a}=e,o=typeof t=="boolean"?{useCleanScreenshot:t}:t||{},r=a.getInteractiveClassNames(),s=a.getIframeFallbackDomains(),{domState:l,screenshotBase64:d,slicedScreenshotsBase64:c}=await n.getClickableElementsWithScreenshot(i,{interactiveClassNames:r,playwrightFrameFallbackDomains:s,useCleanScreenshot:o.useCleanScreenshot,useSlicedScreenshots:o.useSlicedScreenshots,resizeSlicedScreenshots:o.resizeSlicedScreenshots,useAccessibilityTree:o.useAccessibilityTree,actionIntent:o.actionIntent}),u=l.elementTree.clickableElementsToString(),m=await Uh(i,u);return c&&(m.slicedScreenshotsBase64=c),{domTree:u,screenshotBase64:d,slicedScreenshotsBase64:c,domState:l,pageContext:m}}var Gt=y(()=>{"use strict"});var oe,dt,W,Te=y(()=>{"use strict";oe=require("zod"),dt=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),s={...i,actionDescription:a};return await n.execute(r,s)}catch(a){if(a instanceof oe.z.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 oe.z.object({done:oe.z.any()});let i=e.map(r=>{let s=r.schema;if(t&&s instanceof oe.z.ZodObject){let l=s._def.shape();s=oe.z.object({...l,description:oe.z.string().describe("Semantic, human-readable description of the action")})}if(s instanceof oe.z.ZodObject){let l=s._def.shape();Object.keys(l).length===0&&(s=oe.z.object({_empty:oe.z.boolean().optional()}))}return oe.z.object({[r.name]:s})});if(i.length===1)return i[0];let[n,a,...o]=i;return oe.z.union([n,a,...o])}},W=new dt});async function B(e,t){if(t<0)return;let{page:i,domService:n}=e;return(e.domState||await n.getClickableElements(i)).selectorMap.get(t)}function Gh(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 Kh(e,t=!0){try{let i=Gh(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 s=o;o.includes(`
140
140
  `)&&(s=o.split(`
141
- `)[0]),s=s.replace(/\s+/g," ").trim();let l=s.replace(/"/g,'\\"');i+=`[${r}*="${l}"]`}else i+=`[${r}="${o}"]`}return i}catch{return`${e.tagName||"*"}[highlight_index='${e.highlightIndex}']`}}function jh(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 Kh(e,!1)}function io(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=jh(o);h.debug("[frame-path] iframe attrs:",JSON.stringify(o.attributes),"\u2192",r),n.push(r)}return n}async function N(e,t){let i=null,n=io(t);return t.xpath&&(i=await Rt(e,t.xpath,n,t.shadowHostXPaths??[])),{locator:i||void 0,xpath:i?void 0:t.xpath,frame_path:n}}var j=y(()=>{"use strict";je();F()});function zh(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 Vh(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 Xh(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=Vh(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 $s(e,t,i={}){let{page:n,agentServices:a}=t,o=a.getModel(),r=i.temperature??0,s=a.retrieveKnowledges(e).catch(Y=>(b.log(`Failed to retrieve knowledges: ${Y.message}`),[])),l=a.isSlicedScreenshotsEnabled(),d=a.isResizeSlicedScreenshotsEnabled(),c=a.isKnowledgeImagesEnabled(),u=a.isAccessibilityTreeEnabled(),m=a.isActionIntentFilteringEnabled(),g=m?zh(e):"all";m&&g!=="all"&&b.log(`Action intent filtering: detected '${g}' intent from statement`);let{screenshotBase64:w,domState:v,pageContext:x}=await mn(t,{useSlicedScreenshots:l,resizeSlicedScreenshots:d,useAccessibilityTree:u,actionIntent:g});t.domState=v;let p=new Ji(W).getToolDefinitions().map(Y=>{let it=Y.function;return`${it.name}: ${it.description}
141
+ `)[0]),s=s.replace(/\s+/g," ").trim();let l=s.replace(/"/g,'\\"');i+=`[${r}*="${l}"]`}else i+=`[${r}="${o}"]`}return i}catch{return`${e.tagName||"*"}[highlight_index='${e.highlightIndex}']`}}function jh(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 Kh(e,!1)}function io(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=jh(o);h.debug("[frame-path] iframe attrs:",JSON.stringify(o.attributes),"\u2192",r),n.push(r)}return n}async function N(e,t){let i=null,n=io(t);return t.xpath&&(i=await Rt(e,t.xpath,n,t.shadowHostXPaths??[])),{locator:i||void 0,xpath:i?void 0:t.xpath,frame_path:n}}var j=y(()=>{"use strict";je();F()});function zh(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 Vh(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 Xh(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=Vh(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 $s(e,t,i={}){let{page:n,agentServices:a}=t,o=a.getModel(),r=i.temperature??0,s=a.retrieveKnowledges(e).catch(Y=>(b.log(`Failed to retrieve knowledges: ${Y.message}`),[])),l=a.isSlicedScreenshotsEnabled(),d=a.isResizeSlicedScreenshotsEnabled(),c=a.isKnowledgeImagesEnabled(),u=a.isAccessibilityTreeEnabled(),m=a.isActionIntentFilteringEnabled(),g=m?zh(e):"all";m&&g!=="all"&&b.log(`Action intent filtering: detected '${g}' intent from statement`);let{screenshotBase64:w,domState:v,pageContext:x}=await pn(t,{useSlicedScreenshots:l,resizeSlicedScreenshots:d,useAccessibilityTree:u,actionIntent:g});t.domState=v;let p=new Ji(W).getToolDefinitions().map(Y=>{let it=Y.function;return`${it.name}: ${it.description}
142
142
  Parameters: ${JSON.stringify(it.parameters,null,2)}`}).join(`
143
143
 
144
- `),f=Cs(p),S=await s,_=Ps(x,e,t.variables,t.executionHistory,S.length>0?S:void 0,w,l,void 0,c,t.sensitiveKeys),k=[];i.chatHistory&&i.chatHistory.length>0&&i.chatHistory.forEach(Y=>{Y.role==="user"?k.push({role:"user",content:Y.content}):Y.role==="assistant"&&k.push({role:"assistant",content:Y.content})}),k.push({role:"user",content:_});let E=Xh(k),I=W.buildActionUnionSchema(),C=Kt.z.object({thought:Kt.z.string().describe("Step by step reasoning of your decision making process").optional().default(""),description:Kt.z.string().describe("Detailed description of the action to be performed").optional().default(""),action:I,completes_instruction:Kt.z.boolean().describe("Whether this action completes the given instruction").optional().default(!0)}),$=Array.isArray(_)?_.filter(Y=>Y.type==="image").length:0,K=be(o,$),X=await(0,gn.generateText)({model:we(o),system:f,messages:k,temperature:r,output:gn.Output.object({schema:C}),providerOptions:K}),_e=X.reasoningText;h.info(`Action Generation Reasoning: ${_e}`);let V=X.output,J=JSON.stringify(V,null,2);h.info(`Generate Action Raw Output: ${J}`);let ke=[],Ge=pn(X.usage,o);Ge&&ke.push(Ge);let Pe={systemPrompt:f,userPrompt:E,rawLlmResponse:J,tokenUsages:ke},$e=V.thought||"",Le=V.description||"",G=V.action||{},q=V.completes_instruction||!1;if(!G||Object.keys(G).length===0)return{status:"error",reasoning:$e||Le||"No action generated",goalAccomplished:q,error:"Agent did not generate any action",debugInfo:Pe};let Z=Object.keys(G)[0];if(Z==="done")return{status:"error",reasoning:$e||Le||"Task marked as done",goalAccomplished:q,error:"Agent indicated task is done without generating an action",debugInfo:Pe};if(Z==="perform_accurate_operation")return await lt(e,t,i);if(!q){let Y="Can't complete the instruction in one action";return{status:"error",reasoning:$e||Le||Y,goalAccomplished:!1,error:Y,debugInfo:Pe}}let de=G[Z]||{},Br={};if(typeof de.element_index=="number"){let Y=de.element_index;if(Y<0)return{status:"error",reasoning:$e||Le||"No action generated",goalAccomplished:q,error:"Agent did not generate any action",debugInfo:Pe};let it=v.selectorMap.get(Y);it&&(Br=await N(n,it))}let Ur=Le;return Z==="verify"&&(Ur=e,de.statement=e),{status:"success",actionEntity:{...Br,action_description:Ur||$e||`${Z}(${JSON.stringify(de)})`,action_data:{action_name:Z,kwargs:de}},reasoning:$e||Le,goalAccomplished:q,debugInfo:Pe}}var gn,Kt,fn=y(()=>{"use strict";qi();ct();hn();Ut();Gt();Te();ie();Ee();j();F();gn=require("ai"),Kt=require("zod")});function Yh(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 no(e,t,i={}){return i.usePureVision?lt(e,t,i):$s(e,t,i)}function qh(){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 Zh(){return`# Role
144
+ `),f=Cs(p),S=await s,_=Ps(x,e,t.variables,t.executionHistory,S.length>0?S:void 0,w,l,void 0,c,t.sensitiveKeys),k=[];i.chatHistory&&i.chatHistory.length>0&&i.chatHistory.forEach(Y=>{Y.role==="user"?k.push({role:"user",content:Y.content}):Y.role==="assistant"&&k.push({role:"assistant",content:Y.content})}),k.push({role:"user",content:_});let E=Xh(k),I=W.buildActionUnionSchema(),C=Kt.z.object({thought:Kt.z.string().describe("Step by step reasoning of your decision making process").optional().default(""),description:Kt.z.string().describe("Detailed description of the action to be performed").optional().default(""),action:I,completes_instruction:Kt.z.boolean().describe("Whether this action completes the given instruction").optional().default(!0)}),$=Array.isArray(_)?_.filter(Y=>Y.type==="image").length:0,K=be(o,$),X=await(0,gn.generateText)({model:we(o),system:f,messages:k,temperature:r,output:gn.Output.object({schema:C}),providerOptions:K}),_e=X.reasoningText;h.info(`Action Generation Reasoning: ${_e}`);let V=X.output,J=JSON.stringify(V,null,2);h.info(`Generate Action Raw Output: ${J}`);let ke=[],Ge=mn(X.usage,o);Ge&&ke.push(Ge);let Pe={systemPrompt:f,userPrompt:E,rawLlmResponse:J,tokenUsages:ke},$e=V.thought||"",Le=V.description||"",G=V.action||{},q=V.completes_instruction||!1;if(!G||Object.keys(G).length===0)return{status:"error",reasoning:$e||Le||"No action generated",goalAccomplished:q,error:"Agent did not generate any action",debugInfo:Pe};let Z=Object.keys(G)[0];if(Z==="done")return{status:"error",reasoning:$e||Le||"Task marked as done",goalAccomplished:q,error:"Agent indicated task is done without generating an action",debugInfo:Pe};if(Z==="perform_accurate_operation")return await lt(e,t,i);if(!q){let Y="Can't complete the instruction in one action";return{status:"error",reasoning:$e||Le||Y,goalAccomplished:!1,error:Y,debugInfo:Pe}}let de=G[Z]||{},Br={};if(typeof de.element_index=="number"){let Y=de.element_index;if(Y<0)return{status:"error",reasoning:$e||Le||"No action generated",goalAccomplished:q,error:"Agent did not generate any action",debugInfo:Pe};let it=v.selectorMap.get(Y);it&&(Br=await N(n,it))}let Ur=Le;return Z==="verify"&&(Ur=e,de.statement=e),{status:"success",actionEntity:{...Br,action_description:Ur||$e||`${Z}(${JSON.stringify(de)})`,action_data:{action_name:Z,kwargs:de}},reasoning:$e||Le,goalAccomplished:q,debugInfo:Pe}}var gn,Kt,fn=y(()=>{"use strict";qi();ct();hn();Ut();Gt();Te();ie();Ee();j();F();gn=require("ai"),Kt=require("zod")});function Yh(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 no(e,t,i={}){return i.usePureVision?lt(e,t,i):$s(e,t,i)}function qh(){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 Zh(){return`# Role
145
145
  You are an experienced QA person for web applications.
146
146
  You are tasked to verify the validity of a given statement based on the screenshot and element tree of a web page.
147
- `}async function Ls(e,t,i={}){let{page:n,executionHistory:a}=t,o=t.agentServices.getModel();try{let r=t.agentServices.isSlicedScreenshotsEnabled(),s=t.agentServices.isResizeSlicedScreenshotsEnabled(),l=t.agentServices.isKnowledgeImagesEnabled(),d=t.agentServices.isAccessibilityTreeEnabled(),{domTree:c,screenshotBase64:u,slicedScreenshotsBase64:m,domState:g,pageContext:w}=await mn(t,{useCleanScreenshot:i.useCleanScreenshotForAssertion,useSlicedScreenshots:r,resizeSlicedScreenshots:s,useAccessibilityTree:d});t.domState=g;let v="";a&&a.length>0&&(v=`
147
+ `}async function Ls(e,t,i={}){let{page:n,executionHistory:a}=t,o=t.agentServices.getModel();try{let r=t.agentServices.isSlicedScreenshotsEnabled(),s=t.agentServices.isResizeSlicedScreenshotsEnabled(),l=t.agentServices.isKnowledgeImagesEnabled(),d=t.agentServices.isAccessibilityTreeEnabled(),{domTree:c,screenshotBase64:u,slicedScreenshotsBase64:m,domState:g,pageContext:w}=await pn(t,{useCleanScreenshot:i.useCleanScreenshotForAssertion,useSlicedScreenshots:r,resizeSlicedScreenshots:s,useAccessibilityTree:d});t.domState=g;let v="";a&&a.length>0&&(v=`
148
148
  # Previous actions in this session:
149
149
  ${a.map(([G,q],Z)=>`${Z+1}. Action: ${G}
150
150
  Result: ${q}`).join(`
@@ -178,7 +178,7 @@ ${v}
178
178
 
179
179
  Today is ${x}. Current local time is ${p}.
180
180
  Based on the above information, please determine if the statement is true.
181
- `,k=await t.agentServices.retrieveKnowledges(e),E=[{type:"text",text:f}],I=0;if(r&&m&&m.length>0)for(let G of m)E.push({type:"image",image:G}),I++;else E.push({type:"image",image:u}),I=1;if(k&&k.length>0){let G=un(k,l);E.push(...G)}E.push({type:"text",text:_});let C=k?Is(k,l):0,$=I+C,K=be(o,$),X=Zh(),_e=await(0,wn.generateText)({model:we(o),system:X,messages:[{role:"user",content:E}],output:wn.Output.object({schema:Jh}),temperature:0,providerOptions:K}),{conclusion:V,explanation:J}=_e.output,ke=JSON.stringify(_e.output,null,2),Ge=[],Pe=pn(_e.usage,o);Pe&&Ge.push(Pe);let $e=[{role:"user",content:E.map(G=>{if(G.type==="text")return{type:"text",text:G.text};if(G.type==="image"){let q=G.image,Z=Yh(q);if(Z)return{type:"image",file:Z};let de=typeof q=="string"?q:"";return{type:"image",file:de.startsWith("data:")?de:`data:image/png;base64,${de}`}}return{type:"text",text:"[unknown content type]"}})}],Le={systemPrompt:X,userPrompt:$e,rawLlmResponse:ke,screenshotWithSom:u,tokenUsages:Ge,retrievedKnowledges:k&&k.length>0?k:void 0,elementTree:c};return{success:V==="true",explanation:J,debugInfo:Le}}catch(r){return{success:!1,error:r.message}}}var wn,jt,Jh,bn=y(()=>{"use strict";fn();ct();Ut();Gt();Bt();Ee();wn=require("ai"),jt=require("zod");Jh=jt.z.object({screenshotDescription:jt.z.string().describe(`Description of the screenshot content, listing out key elements along with their Set of Mark indices,
181
+ `,k=await t.agentServices.retrieveKnowledges(e),E=[{type:"text",text:f}],I=0;if(r&&m&&m.length>0)for(let G of m)E.push({type:"image",image:G}),I++;else E.push({type:"image",image:u}),I=1;if(k&&k.length>0){let G=un(k,l);E.push(...G)}E.push({type:"text",text:_});let C=k?Is(k,l):0,$=I+C,K=be(o,$),X=Zh(),_e=await(0,wn.generateText)({model:we(o),system:X,messages:[{role:"user",content:E}],output:wn.Output.object({schema:Jh}),temperature:0,providerOptions:K}),{conclusion:V,explanation:J}=_e.output,ke=JSON.stringify(_e.output,null,2),Ge=[],Pe=mn(_e.usage,o);Pe&&Ge.push(Pe);let $e=[{role:"user",content:E.map(G=>{if(G.type==="text")return{type:"text",text:G.text};if(G.type==="image"){let q=G.image,Z=Yh(q);if(Z)return{type:"image",file:Z};let de=typeof q=="string"?q:"";return{type:"image",file:de.startsWith("data:")?de:`data:image/png;base64,${de}`}}return{type:"text",text:"[unknown content type]"}})}],Le={systemPrompt:X,userPrompt:$e,rawLlmResponse:ke,screenshotWithSom:u,tokenUsages:Ge,retrievedKnowledges:k&&k.length>0?k:void 0,elementTree:c};return{success:V==="true",explanation:J,debugInfo:Le}}catch(r){return{success:!1,error:r.message}}}var wn,jt,Jh,bn=y(()=>{"use strict";fn();ct();Ut();Gt();Bt();Ee();wn=require("ai"),jt=require("zod");Jh=jt.z.object({screenshotDescription:jt.z.string().describe(`Description of the screenshot content, listing out key elements along with their Set of Mark indices,
182
182
  and a description of their location: formatting example: [12] A red button with text "Submit", next to [11]
183
183
  [45] A modal dialog titled "Confirmation",
184
184
  in the center of the screen`),explanation:jt.z.string().describe("Step by step reasoning explaining your conclusion about the statement"),conclusion:jt.z.enum(["true","false","unknown"]).describe("Whether the statement is true, false, or unknown if you cannot make a conclusion")})});async function Os(){let{default:e}=await import("sharp");return e}async function ao(e,t){let i=await Os(),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,s=0,l=Math.floor((a-r)/2),d=Math.max(0,a-r),c=(w,v)=>{let x=i(e).extract({left:w,top:0,width:v,height:r});return t?.resize&&(x=x.resize(Ds,Ds)),x.png().toBuffer()},[u,m,g]=await Promise.all([c(s,Math.min(r,a)),c(l,Math.min(r,a-l)),c(d,Math.min(r,a-d))]);return[u,m,g]}async function Ns(e){let t=(await Os())(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 s=0;s<a;s++){r[s]=[];for(let l=0;l<n;l++)r[s][l]=o[s*n+l]}return{pixels:r,width:n,height:a}}var Ds,zt=y(()=>{"use strict";Ds=768});function Rs(e){return e?Vt.has(e):!1}function Fs(e){return ut.has(e)}function Hs(e){return e.filter(t=>ut.has(t.type))}var Vt,ut,yn,xn,Xt=y(()=>{"use strict";Vt=new Set(["button","link","textbox","checkbox","radio","combobox","listbox","menuitem","menuitemcheckbox","menuitemradio","option","tab","switch","slider","spinbutton","searchbox","scrollbar","treeitem","gridcell"]),ut=new Set(["click","mousedown","mouseup","dblclick","pointerdown","pointerup","touchstart","touchend"]),yn=["[onclick]","[onmousedown]","[ontouchstart]","div","span","li","tr","td","[role]",'[class*="btn"]','[class*="button"]','[class*="click"]',"[data-action]","[data-click]"],xn=500});function Ws(e,t){return e.length>t?e.slice(0,t)+"...":e}var Yt=y(()=>{"use strict"});var Bs,Us,Jt=y(()=>{"use strict";Bs=["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"],Us={"react-flow__(\\S+)":"$1"}});var Gs,qt,ye,ht=y(()=>{"use strict";Yt();Jt();Gs=class{constructor(e,t=null){this.isVisible=e,this.parent=t}},qt=class extends Gs{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}},ye=class vn extends Gs{constructor(t,i,n,a,o,r=!1,s=!1,l=!1,d=!1,c=!1,u=!1,m=null,g=null,w=null,v=null,x=[],p=null){super(o,p),this.tagName=t,this.xpath=i,this.attributes=n,this.children=a,this.isInteractive=r,this.isScrollable=s,this.markAsClickable=l,this.isTopElement=d,this.isInViewport=c,this.shadowRoot=u,this.highlightIndex=m,this.viewportCoordinates=g,this.pageCoordinates=w,this.viewportInfo=v,this.isNew=null,this.shadowHostXPaths=x}getAllTextTillNextClickableElement(t=-1){let i=[],n=(a,o)=>{if(!(t!==-1&&o>t)&&!(a instanceof vn&&a!==this&&a.highlightIndex!==null)){if(a instanceof qt)i.push(a.text);else if(a instanceof vn)for(let r of a.children)n(r,o+1)}};return n(this,0),i.join(`
@@ -4432,7 +4432,7 @@ Date: ${m.date}
4432
4432
  Body:
4433
4433
  ${m.body}`,w=await dp(g,a,t.model);h.info(`Extracted content: ${w}`),w&&w!=="NOT_FOUND"&&u.push({content:w,email_subject:m.subject,email_from:m.from,email_date:m.date})}if(u.length>0){let m=u[0],g=`$email_${t.extraction_type}`;t.extraction_type==="custom"?g="$email_extracted_content":t.extraction_type==="activation_link"?g="$email_magic_link":t.extraction_type==="verification_code"&&(g="$email_otp_code");let w=(new Date().getTime()-o.getTime())/1e3;return h.info(`Successfully extracted content after ${s} attempts in ${w.toFixed(1)} seconds`),{data:m.content,result_variable:g,status:"success",message:`Successfully extracted content from email: ${m.email_subject.substring(0,50)}... (attempts: ${s})`}}else h.info(`Found emails but no extractable content in attempt ${s}`)}else h.info(`No emails found in attempt ${s}`)}catch(d){h.warn(`Error in polling attempt ${s}: ${d.message}`)}if(new Date(Date.now()+n*1e3)>=r){h.info("Not enough time for another polling attempt");break}h.info(`Waiting ${n} seconds before next attempt...`),await new Promise(d=>setTimeout(d,n*1e3))}let l=(new Date().getTime()-o.getTime())/1e3;return{data:void 0,status:"error",message:`No emails with extractable content found after ${s} attempts over ${l.toFixed(1)} seconds`}}catch(a){return h.error(`Error extracting email content: ${a.message}`),{data:void 0,status:"error",message:`Error extracting email content: ${a.message}`}}}var Sc,Ec,$o=y(()=>{"use strict";Ee();F();Sc=require("ai"),Ec=require("html-to-text")});function Ac(e){switch(e){case"verification_code":return"email_otp_code";case"activation_link":return"email_magic_link";case"custom":return"email_extracted_content";default:return"email_content"}}function Ic(e,t){e.register({name:"extract_email_content",description:"Extract verification codes, magic links, or custom content from emails received via Mailgun. Polls the Mailgun inbox for matching emails and uses AI to extract the requested content.",schema:up,async execute(i,n){let{forward_email:a,extraction_type:o,prompt:r,filter_from_email:s,filter_to_email:l,filter_subject:d,filter_body_contains:c,timeout:u}=i,{page:m,agentServices:g}=n;h.info(`[extract_email_content] Extracting ${o} from ${a}`);try{let w={action_description:`Extract ${o} from email`,action_data:{action_name:"extract_email_content",kwargs:{forward_email:a,extraction_type:o,prompt:r,filter_from_email:s,filter_to_email:l,filter_subject:d,filter_body_contains:c,timeout:u}}};await t.execute(m,w,g);let v=Ac(o);return{success:!0,actionEntity:w,message:`Extracted ${o} and saved to $${v}`}}catch(w){return{success:!1,error:w.message,actionEntity:{action_description:`Extract ${o} from email (failed)`,action_data:{action_name:"extract_email_content",kwargs:{forward_email:a,extraction_type:o,prompt:r,filter_from_email:s,filter_to_email:l,filter_subject:d,filter_body_contains:c,timeout:u}},feedback:w.message}}}}})}var xe,Mc,up,Lo=y(()=>{"use strict";$o();F();te();xe=require("zod");Mc=class{getMailgunConfig(){let e=U().env||{};if(e.MAILGUN_API_KEY)return{apiKey:e.MAILGUN_API_KEY,domain:e.MAILGUN_DOMAIN||""}}async execute(e,t,i){let n=t.action_data;if(!n)throw new Error("Action data not found");let a=this.getMailgunConfig();if(!a)throw new Error("Mailgun configuration not provided. Please configure MAILGUN_API_KEY and MAILGUN_DOMAIN in SDK config.");let o=n.kwargs,r=i.getModel?.()||"gemini-2.5-pro",s=await Tc(a,{model:r,forward_email:o.forward_email,extraction_type:o.extraction_type,prompt:o.prompt,filters:{from_email:o.filter_from_email,to_email:o.filter_to_email,subject:o.filter_subject,body_contains:o.filter_body_contains},timeout:o.timeout});if(s.status==="success"&&s.data){let l=s.result_variable?.replace(/^\$/,"")||Ac(o.extraction_type);i.variableStore.set(l,s.data),h.info(`[extract_email_content] Extracted and saved to ${l}`)}else throw new Error(s.message||"Failed to extract email content")}transpile(e){let t=e.action_data?.kwargs||{};return['await agent.execAction("extract_email_content", page, {',` action_data: { kwargs: ${JSON.stringify(t)} },`,"});"]}},up=xe.z.object({forward_email:xe.z.string().describe("Email address where emails are forwarded to (Mailgun inbox)"),extraction_type:xe.z.enum(["verification_code","activation_link","custom"]).describe("Type of content to extract: verification_code for OTP codes, activation_link for magic links, custom for custom prompts"),prompt:xe.z.string().optional().describe("Custom extraction prompt (required when extraction_type is custom)"),filter_from_email:xe.z.string().optional().describe("Filter emails by sender address"),filter_to_email:xe.z.string().optional().describe("Filter emails by recipient address"),filter_subject:xe.z.string().optional().describe("Filter emails by subject (partial match)"),filter_body_contains:xe.z.string().optional().describe("Filter emails by body content (partial match)"),timeout:xe.z.number().optional().describe("Timeout in seconds for polling (default: 60)")})});async function ve(){if(aa)return aa;let e=(await Promise.resolve().then(()=>(xt(),yt))).default;return aa=new e,aa}async function oa(e){let t=await ve(),i=t.getAction("click"),n=t.getAction("hover"),a=t.getAction("right_click"),o=t.getAction("double_click");return ec(e,i),Vl(e,n),Ll(e,a),rc(e,o),"Click, hover, double-click, right-click, or drag elements"}async function ra(e){let t=await ve(),i=t.getAction("go_to_url"),n=t.getAction("go_back"),a=t.getAction("reload_page");return jl(e,i),Kl(e,n),Pl(e,a),"Navigate to URLs, go back, or reload the page"}async function sa(e){let t=await ve(),i=t.getAction("clear_input"),n=t.getAction("input_text"),a=t.getAction("press");return Zl(e,i),Yl(e,n),Ml(e,a),"Type text into inputs, clear input values, or press keyboard keys"}async function la(e){let t=await ve(),i=t.getAction("scroll_on_element"),n=t.getAction("scroll_to_text"),a=t.getAction("scroll");return dl(e,i),hl(e,n),Nl(e,a),"Scroll the page or scroll to specific text/elements"}async function ca(e){let t=await ve(),i=t.getAction("close_tab"),n=t.getAction("switch_tab");return ic(e,i),yl(e,n),"Switch between browser tabs or close tabs"}async function da(e){let t=await ve(),i=t.getAction("upload_file"),n=t.getAction("wait_for_download_complete");return El(e,i),ol(e,n),"Upload files or wait for downloads to complete"}async function ua(e){let t=await ve(),i=t.getAction("get_dropdown_options"),n=t.getAction("select_dropdown_option"),a=t.getAction("set_date_for_native_date_picker");return Bl(e,i),gl(e,n),wl(e,a),"Get dropdown options, select dropdown values, or set date for native date picker input"}async function ha(e){let t=await ve(),i=t.getAction("wait"),n=t.getAction("save_variable"),a=t.getAction("done");return Al(e,i),Ol(e,n),ac(e,a),kc(e),"Wait for conditions, save variables, or complete tasks"}async function ma(e){let t=(await ve()).getAction("generate_2fa_code");Fl(e,t);let i=new Mc;return(await Promise.resolve().then(()=>(xt(),yt))).default.registerAction("extract_email_content",i),Ic(e,i),"Generate 2FA codes or extract email/activation codes"}async function pa(e){let t=await ve(),i=t.getAction("verify"),n=t.getAction("ai_extract"),a=t.getAction("ai_wait_until");return cc(e,i),uc(e,n),sl(e,a),"Perform AI-powered assertions, extractions, or wait conditions"}async function Cc(e){let[t,i,n,a,o,r,s,l,d,c]=await Promise.all([oa(e),ra(e),sa(e),la(e),ca(e),da(e),ua(e),ha(e),ma(e),pa(e)]);return{mouse:t,navigation:i,input:n,scroll:a,tabs:o,files:r,forms:s,utility:l,auth:d,ai:c}}function Pc(e){return[`- Mouse: ${e.mouse}`,`- Navigation: ${e.navigation}`,`- Input: ${e.input}`,`- Scroll: ${e.scroll}`,`- Tabs: ${e.tabs}`,`- Files: ${e.files}`,`- Forms: ${e.forms}`,`- Utility: ${e.utility}`,`- Auth: ${e.auth}`,`- AI: ${e.ai}`].join(`
4434
4434
  `)}var aa,Do=y(()=>{"use strict";Po();Lo();ti();ii();ni();ai();ri();li();ci();ui();hi();mi();pi();gi();fi();bi();yi();xi();vi();ki();Si();Ti();Ai();Mi();Ii();Ci();Pi();$i();Li();aa=null});async function $c(){await mp}function Lc(){return W}function Dc(e=!0){let t=new dt;return e&&(oa(t),ra(t),sa(t),la(t),ca(t),da(t),ua(t),ma(t),ha(t),pa(t)),t}async function Oc(){let e=new dt,t=await Cc(e),i=Pc(t);return{registry:e,capabilities:t,summary:i}}function Nc(){return["- Mouse: Click, hover, double-click, right-click or drag on elements","- Navigation: Navigate to URLs, go back, or reload the page","- Input: Type text into inputs, clear input fields, or press keyboard keys","- Scroll: Scroll the page or scroll to specific text/elements","- Tabs: Switch between browser tabs or close tabs","- Files: Upload files or wait for downloads to complete","- Forms: Get dropdown options or select dropdown values","- Utility: Wait for conditions, save variables, or complete tasks","- Auth: Generate 2FA codes or extract email/activation codes","- AI: Perform AI-powered verifications, extractions, or wait conditions"].join(`
4435
- `)}var hp,mp,Rc=y(()=>{"use strict";Do();Te();hp=[oa(W),ra(W),sa(W),la(W),ca(W),da(W),ua(W),ha(W),pa(W),ma(W)],mp=Promise.all(hp)});function Hc(e){return e.getTools().map(t=>({name:t.name,description:t.description,inputSchema:Yi(t.schema)}))}var Fc,Wc=y(()=>{"use strict";Ot();Fc=class{constructor(e,t){this.registry=e,this.getContext=t}getToolDefinitions(){return this.registry.getTools().filter(e=>e.availability.mcp).map(e=>({name:e.name,description:e.description,inputSchema:Yi(e.schema)}))}getToolDefinitionsFiltered(e){let t=new Set(e);return this.registry.getTools().filter(i=>t.has(i.name)&&i.availability.mcp).map(i=>({name:i.name,description:i.description,inputSchema:Yi(i.schema)}))}async createServer(e="web-sdk-tools"){throw new Error("MCP server creation not yet implemented. Install and configure an MCP SDK like @modelcontextprotocol/sdk")}async executeTool(e,t){let i=await this.getContext(),n=await this.registry.execute(e,t,i);return{content:[{type:"text",text:n.success?n.message||"Tool executed successfully":n.error||"Tool execution failed"}]}}getToolCount(){return this.registry.size()}getToolNames(){return this.registry.getToolNames()}}});var Bc=y(()=>{"use strict"});function Uc(){let e=process.env.SHIPLIGHT_REGISTRY_URL;return e?e.replace(/\/$/,""):null}async function kt(e){let t=Uc();if(!t)return null;try{let i=await fetch(`${t}/browsers`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)});return i.ok?(await i.json()).id??null:null}catch{return null}}async function St(e){if(!e)return;let t=Uc();if(t)try{await fetch(`${t}/browsers/${encodeURIComponent(e)}`,{method:"DELETE"})}catch{}}var Oo=y(()=>{"use strict"});function ba(e,t){if(!e||typeof e!="string")return e;let i=t instanceof Map?Object.fromEntries(t):t,n=o=>{let r=o.startsWith("$")?o.slice(1):o,s=i[r]??i[`$${r}`];return s!=null?String(s):void 0},a=e;return a=a.replace(/\{\{\s*\$?([^}]+?)\s*\}\}/g,(o,r)=>{let s=n(r.trim());return s!==void 0?s:o}),a=a.replace(/<secret>\$?([\w-]+)<\/secret>/g,(o,r)=>{let s=n(r);return s!==void 0?s:o}),a=a.replace(/\$\{([^}]+)\}/g,(o,r)=>{let s=n(r.trim());return s!==void 0?s:o}),a=a.replace(/\$([a-zA-Z_]\w*)/g,(o,r)=>{let s=n(r);return s!==void 0?s:o}),a}var T,X_,ik,ok,lk,pp,fa,gp,fp,wp,bp,yp,xp,vp,_p,qe,Et,Kc,kp,ga,Ni,j_,z_,wa,jc,zc,Vc,Xc,Ri,No,Ro,Sp,Gc,Ep,Oi,Tp,Ap,Mp,re,Ip,Cp,V_,ak,Tt=y(()=>{"use strict";pe();T=require("zod"),X_=require("yaml"),ik=require("uuid"),ok=require("yaml"),lk=require("uuid"),pp="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36",fa=112,gp=1920,fp=1080,wp=1920,bp=1080-fa,yp=1280,xp=720,vp=500,_p=500,qe="Desktop Chrome",Et=(e=>(e.Chromium="chromium",e.Firefox="firefox",e.Webkit="webkit",e))(Et||{}),Kc={"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"}},kp={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"]},ga=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),kp[e].map(n=>Kc[n]).filter(n=>n.defaultBrowserType&&i.includes(n.defaultBrowserType))},Ni=e=>Kc[e],j_={desktop:{label:"Desktop",type:"desktop",devices:ga("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:ga("mobile")}},z_={desktop:{label:"Desktop",type:"desktop",devices:ga("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:ga("mobile",!0)}},wa=(e,t=!1)=>{let i={userAgent:pp,viewport:{width:wp,height:bp},isMobile:!1,hasTouch:!1};if(!e||e===qe)return i;let n=Ni(e);if(!n)return i;let{width:a,height:o}=n.viewport,r=Math.max(vp/a,1),s=Math.max(_p/o,1),l=Math.max(r,s),d={width:Math.round(a*l),height:Math.round(o*l)};return{userAgent:n.userAgent,viewport:t?d:n.viewport,isMobile:n.isMobile,hasTouch:n.hasTouch}},jc=e=>{let t={width:gp,height:fp};if(!e||e===qe)return t;let i=wa(e);return i.viewport?{width:i.viewport.width,height:i.viewport.height+fa}:t},zc=e=>{let t={width:yp,height:xp};if(!e||e===qe)return t;let i=wa(e);return i.viewport?{width:i.viewport.width,height:i.viewport.height}:t},Vc=e=>!e||e===qe?void 0:Ni(e)?.channel,Xc=e=>!e||e===qe?"chromium":Ni(e)?.defaultBrowserType??"chromium",Ri=(e=>(e.PASSWORD="password",e.OAUTH2="oauth2",e.SSO="sso",e.API="api",e))(Ri||{}),No=(e=>(e.SMS="sms",e.EMAIL="email",e.TOTP="totp",e))(No||{});Ro=class Yc{constructor(){Xa(this,"data",{}),Xa(this,"sensitive",new Set)}get(t){return this.data[t]}set(t,i,n=!1){this.data[t]=i,n?this.sensitive.add(t):this.sensitive.has(t)&&this.sensitive.delete(t)}getAll(){return{...this.data}}isSensitive(t){return this.sensitive.has(t)}getAllSensitiveKeys(){return new Set(this.sensitive)}delete(t){return this.sensitive.delete(t),delete this.data[t]}clear(){this.data={},this.sensitive.clear()}has(t){return t in this.data}get size(){return Object.keys(this.data).length}merge(t){for(let[i,n]of Object.entries(t.getAll()))this.set(i,n,t.isSensitive(i))}toJSON(){return{data:{...this.data},sensitiveKeys:Array.from(this.sensitive)}}static fromJSON(t){let i=new Yc;if(t.data){let n=new Set(t.sensitiveKeys||[]);for(let[a,o]of Object.entries(t.data))i.set(a,o,n.has(a))}return i}},Sp=T.z.enum(["JS_CODE","AI_MODE"]),Gc=T.z.object({type:Sp,expression:T.z.string()}),Ep=T.z.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),Oi=T.z.object({uid:T.z.string(),type:Ep,comment:T.z.string().optional()}),Tp=T.z.object({action_data:T.z.object({action_name:T.z.string(),kwargs:T.z.record(T.z.any()).optional(),args:T.z.array(T.z.any()).optional()}),action_description:T.z.string().optional(),url:T.z.string().optional(),xpath:T.z.string().nullable().optional(),locator:T.z.string().nullable().optional(),css_selector:T.z.string().nullable().optional(),unique_selector:T.z.string().nullable().optional(),element_index:T.z.number().nullable().optional(),frame_path:T.z.array(T.z.any()).optional(),artifacts:T.z.record(T.z.any()).optional(),feedback:T.z.string().optional(),original_browser_use_action:T.z.any().optional()}).passthrough(),Ap=Oi.extend({type:T.z.literal("DRAFT"),description:T.z.string()}),Mp=Oi.extend({type:T.z.literal("ACTION"),description:T.z.string(),action_entity:Tp.optional(),locator:T.z.string().optional(),use_pure_vision:T.z.boolean().optional()}),re=T.z.lazy(()=>T.z.union([Ap,Mp,Oi.extend({type:T.z.literal("STEP"),description:T.z.string().optional().default(""),statements:T.z.array(re),reference_id:T.z.number().optional(),template_path:T.z.string().optional(),template_params:T.z.record(T.z.string()).optional()}),Oi.extend({type:T.z.literal("IF_ELSE"),description:T.z.string().optional(),condition:Gc,then:T.z.array(re),else:T.z.array(re).optional()}),Oi.extend({type:T.z.literal("WHILE_LOOP"),description:T.z.string().optional(),condition:Gc,body:T.z.array(re),timeout_ms:T.z.number().optional()})])),Ip=T.z.object({name:T.z.string(),statements:T.z.array(re),teardown:T.z.array(re).optional(),skip:T.z.union([T.z.boolean(),T.z.string()]).optional(),timeout:T.z.number().optional(),fail:T.z.union([T.z.boolean(),T.z.string()]).optional(),only:T.z.boolean().optional(),slow:T.z.boolean().optional()}),Cp=T.z.object({tests:T.z.array(Ip).min(1),beforeAll:T.z.array(re).optional(),afterAll:T.z.array(re).optional(),beforeEach:T.z.array(re).optional(),afterEach:T.z.array(re).optional()}),V_=T.z.object({comment:T.z.string().optional(),version:T.z.string().optional(),goal:T.z.string().optional(),url:T.z.string().optional(),baseURL:T.z.string().optional(),final_feedback:T.z.string().optional(),completed:T.z.boolean().optional(),success:T.z.boolean().optional(),statements:T.z.array(re).optional(),teardown:T.z.array(re).optional(),last_modified_at:T.z.string().optional(),testGroup:Cp.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"}),ak=1024*1024});async function Pp(e,t){let i=JSON.parse(Ne.default.readFileSync(t,"utf-8"));i.cookies?.length&&await e.addCookies(i.cookies)}var Ne,Jc,At,Ze,qc,Zc=y(()=>{"use strict";Oo();Tt();Ie();_t();F();Ne=R(require("fs"),1),Jc=R(require("os"),1),At=R(require("path"),1),Ze=require("playwright");qc=class{constructor(e={}){e.testDir&&(this.testDir=e.testDir,this.videoBasePath=At.default.join(e.testDir,"videos"),this.statesBasePath=At.default.join(e.testDir,"states"),this.downloadsBasePath=At.default.join(e.testDir,"downloads"),Ne.default.mkdirSync(this.videoBasePath,{recursive:!0}),Ne.default.mkdirSync(this.statesBasePath,{recursive:!0}),Ne.default.mkdirSync(this.downloadsBasePath,{recursive:!0})),this.terminationTimeout=e.terminationTimeout??null,this.defaultHeadless=e.headless??!1,this.additionalArgs=e.additionalArgs??[]}async launchBrowser(e={}){let t=e.debugPort,i=e.headless??this.defaultHeadless,n=Xc(e.deviceName),a=Vc(e.deviceName),o=n===Et.Chromium,r=!!e.extensionPath;h.info(`[BrowserManager] Launching ${n} browser for device: ${e.deviceName||"default"}${t?` on port ${t}`:""}`);let s={headless:i};if(o){r&&i&&(h.warn("[BrowserManager] Extension requested in headless mode; forcing headed mode to load extension."),i=!1,s.headless=!1);let k=[];(e.enableCamera||e.enableMicrophone)&&(k.push("--use-fake-device-for-media-stream","--use-fake-ui-for-media-stream"),e.enableMicrophone&&e.fakeAudioCapturePath&&(k.push(`--use-file-for-fake-audio-capture=${e.fakeAudioCapturePath}`),h.info(`[BrowserManager] Using fake audio capture file: ${e.fakeAudioCapturePath}`)));let E=r&&e.extensionPath?[`--disable-extensions-except=${e.extensionPath}`,`--load-extension=${e.extensionPath}`]:[];s.args=[...mc(t,e.disableSecurity??!0,i),...k,...E,...this.additionalArgs],a&&(s.channel=a,h.debug(`[BrowserManager] Launching browser with channel: ${a}`))}let l=wa(e.deviceName),d=zc(e.deviceName),c={acceptDownloads:!0,...l,timezoneId:e.timezoneId||"America/Los_Angeles",locale:e.locale||"en-US"};e.viewport&&(c.viewport=e.viewport,c.screen=e.viewport),e.isMobile!==void 0&&(c.isMobile=e.isMobile),e.hasTouch!==void 0&&(c.hasTouch=e.hasTouch),e.userAgent&&(c.userAgent=e.userAgent),e.colorScheme&&(c.colorScheme=e.colorScheme),e.geolocation&&(c.geolocation=e.geolocation,c.permissions=[...c.permissions||[],"geolocation"]);let u=r&&o?e.localStorageStatePath:void 0;e.localStorageStatePath&&!u&&(c.storageState=e.localStorageStatePath),e.recordVideo&&this.videoBasePath&&(c.recordVideo={dir:this.videoBasePath,size:{width:d.width,height:d.height}}),e.proxy&&(c.proxy=e.proxy),e.extraHTTPHeaders&&Object.keys(e.extraHTTPHeaders).length>0&&(c.extraHTTPHeaders=e.extraHTTPHeaders);let m,g,w,v=!1;if(o&&(r||e.userDataDir)){if(e.userDataDir)w=e.userDataDir;else{let E=this.testDir||Ne.default.mkdtempSync(At.default.join(Jc.default.tmpdir(),"shiplight-"));w=At.default.join(E,`ext-profile-${Date.now()}`),Ne.default.mkdirSync(w,{recursive:!0}),v=!0}let k={...s,...c};g=await Ze.chromium.launchPersistentContext(w,k),u&&(await Pp(g,u),h.info(`[BrowserManager] Loaded storage state into persistent context from ${u}`)),m=g.browser(),h.info(`[BrowserManager] Launched persistent context${e.extensionPath?` for extension at ${e.extensionPath}`:` with profile at ${w}`}`)}else{switch(n){case Et.Firefox:m=await Ze.firefox.launch(s);break;case Et.Webkit:m=await Ze.webkit.launch(s);break;case Et.Chromium:default:m=await Ze.chromium.launch(s);break}g=await m.newContext(c)}if(g.addInitScript(Oe),o){let k=["clipboard-read","clipboard-write"];e.enableCamera&&k.push("camera"),e.enableMicrophone&&k.push("microphone");try{await g.grantPermissions(k),h.info(`[BrowserManager] Granted permissions: ${k.join(", ")}`)}catch(E){h.warn("[BrowserManager] Failed to grant permissions:",E)}}else(e.enableCamera||e.enableMicrophone)&&h.warn("[BrowserManager] Camera/microphone enabled but browser is not Chromium; ignoring.");if(e.cookies&&e.cookies.length>0){let k=(Date.now()+31536e6)/1e3,E=e.cookies.map(I=>({...I,expires:k}));await g.addCookies(E),h.info(`[BrowserManager] Added ${e.cookies.length} cookies to browser context with expires=${k}`)}let x=e.viewport,p=x?{width:x.width,height:x.height+fa}:jc(e.deviceName);if(h.info(`[BrowserManager] windowSize=${JSON.stringify(p)}`),o){let k=async E=>{try{await ia(E,p.width,p.height),x&&await E.setViewportSize(x)}catch(I){h.warn("[BrowserManager] Failed to set window bounds via CDP:",I)}};for(let E of g.pages())await k(E);g.on("page",k)}let f="";if(o&&t!==void 0)try{f=await ta(t)}catch(k){h.warn("[BrowserManager] Failed to get CDP WebSocket URL:",k)}let S=null;f&&(S=await kt({cdpUrl:f,label:`agent ${e.deviceName??n}`,pid:process.pid}),S&&h.info(`[BrowserManager] Registered browser with dev-box registry id=${S}`));let _={debugPort:t,browser:m,context:g,startTime:new Date,timeout:null,browserWsUrl:f,downloadsBasePath:this.downloadsBasePath,browserType:n,userDataDir:w,isTempUserDataDir:v,registryId:S};if(this.terminationTimeout!==null){let k=setTimeout(()=>{h.info(`[BrowserManager] Browser auto-terminated after ${this.terminationTimeout}ms`),this.terminateBrowser(_).catch(E=>h.error("[BrowserManager] Error terminating browser:",E))},this.terminationTimeout);_.timeout=k}return _}async terminateBrowser(e){if(e.timeout&&clearTimeout(e.timeout),await St(e.registryId??null),await e.context.close(),await e.browser.close(),e.isTempUserDataDir&&e.userDataDir)try{Ne.default.rmSync(e.userDataDir,{recursive:!0,force:!0})}catch(t){h.warn("[BrowserManager] Failed to clean up temp user data dir:",e.userDataDir,t)}}getVideoBasePath(){return this.videoBasePath}getStatesBasePath(){return this.statesBasePath}getDownloadsBasePath(){return this.downloadsBasePath}}});function $p(e){let t=(0,Qc.execFileSync)("ps",["-axo","pid=,ppid=,args="],{encoding:"utf-8"}),i=[];for(let o of t.split(`
4435
+ `)}var hp,mp,Rc=y(()=>{"use strict";Do();Te();hp=[oa(W),ra(W),sa(W),la(W),ca(W),da(W),ua(W),ha(W),pa(W),ma(W)],mp=Promise.all(hp)});function Hc(e){return e.getTools().map(t=>({name:t.name,description:t.description,inputSchema:Yi(t.schema)}))}var Fc,Wc=y(()=>{"use strict";Ot();Fc=class{constructor(e,t){this.registry=e,this.getContext=t}getToolDefinitions(){return this.registry.getTools().filter(e=>e.availability.mcp).map(e=>({name:e.name,description:e.description,inputSchema:Yi(e.schema)}))}getToolDefinitionsFiltered(e){let t=new Set(e);return this.registry.getTools().filter(i=>t.has(i.name)&&i.availability.mcp).map(i=>({name:i.name,description:i.description,inputSchema:Yi(i.schema)}))}async createServer(e="web-sdk-tools"){throw new Error("MCP server creation not yet implemented. Install and configure an MCP SDK like @modelcontextprotocol/sdk")}async executeTool(e,t){let i=await this.getContext(),n=await this.registry.execute(e,t,i);return{content:[{type:"text",text:n.success?n.message||"Tool executed successfully":n.error||"Tool execution failed"}]}}getToolCount(){return this.registry.size()}getToolNames(){return this.registry.getToolNames()}}});var Bc=y(()=>{"use strict"});function Uc(){let e=process.env.SHIPLIGHT_REGISTRY_URL;return e?e.replace(/\/$/,""):null}async function kt(e){let t=Uc();if(!t)return null;try{let i=await fetch(`${t}/browsers`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)});return i.ok?(await i.json()).id??null:null}catch{return null}}async function St(e){if(!e)return;let t=Uc();if(t)try{await fetch(`${t}/browsers/${encodeURIComponent(e)}`,{method:"DELETE"})}catch{}}var Oo=y(()=>{"use strict"});function fa(e,t){if(!e||typeof e!="string")return e;let i=t instanceof Map?Object.fromEntries(t):t,n=o=>{let r=o.startsWith("$")?o.slice(1):o,s=i[r]??i[`$${r}`];return s!=null?String(s):void 0},a=e;return a=a.replace(/\{\{\s*\$?([^}]+?)\s*\}\}/g,(o,r)=>{let s=n(r.trim());return s!==void 0?s:o}),a=a.replace(/<secret>\$?([\w-]+)<\/secret>/g,(o,r)=>{let s=n(r);return s!==void 0?s:o}),a=a.replace(/\$\{([^}]+)\}/g,(o,r)=>{let s=n(r.trim());return s!==void 0?s:o}),a=a.replace(/\$([a-zA-Z_]\w*)/g,(o,r)=>{let s=n(r);return s!==void 0?s:o}),a}var V_,T,J_,ak,sk,pp,wa,gp,fp,wp,bp,yp,xp,vp,_p,qe,Et,Kc,kp,ga,Ni,j_,z_,ba,jc,zc,Vc,Xc,Ri,No,Ro,Sp,Gc,Ep,Oi,Tp,Ap,Mp,re,Ip,Cp,Y_,rk,Tt=y(()=>{"use strict";pe();V_=require("uuid"),T=require("zod"),J_=require("yaml"),ak=require("uuid"),sk=require("yaml");pp="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36",wa=112,gp=1920,fp=1080,wp=1920,bp=1080-wa,yp=1280,xp=720,vp=500,_p=500,qe="Desktop Chrome",Et=(e=>(e.Chromium="chromium",e.Firefox="firefox",e.Webkit="webkit",e))(Et||{}),Kc={"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"}},kp={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"]},ga=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),kp[e].map(n=>Kc[n]).filter(n=>n.defaultBrowserType&&i.includes(n.defaultBrowserType))},Ni=e=>Kc[e],j_={desktop:{label:"Desktop",type:"desktop",devices:ga("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:ga("mobile")}},z_={desktop:{label:"Desktop",type:"desktop",devices:ga("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:ga("mobile",!0)}},ba=(e,t=!1)=>{let i={userAgent:pp,viewport:{width:wp,height:bp},isMobile:!1,hasTouch:!1};if(!e||e===qe)return i;let n=Ni(e);if(!n)return i;let{width:a,height:o}=n.viewport,r=Math.max(vp/a,1),s=Math.max(_p/o,1),l=Math.max(r,s),d={width:Math.round(a*l),height:Math.round(o*l)};return{userAgent:n.userAgent,viewport:t?d:n.viewport,isMobile:n.isMobile,hasTouch:n.hasTouch}},jc=e=>{let t={width:gp,height:fp};if(!e||e===qe)return t;let i=ba(e);return i.viewport?{width:i.viewport.width,height:i.viewport.height+wa}:t},zc=e=>{let t={width:yp,height:xp};if(!e||e===qe)return t;let i=ba(e);return i.viewport?{width:i.viewport.width,height:i.viewport.height}:t},Vc=e=>!e||e===qe?void 0:Ni(e)?.channel,Xc=e=>!e||e===qe?"chromium":Ni(e)?.defaultBrowserType??"chromium",Ri=(e=>(e.PASSWORD="password",e.OAUTH2="oauth2",e.SSO="sso",e.API="api",e))(Ri||{}),No=(e=>(e.SMS="sms",e.EMAIL="email",e.TOTP="totp",e))(No||{}),Ro=class Yc{constructor(){Xa(this,"data",{}),Xa(this,"sensitive",new Set)}get(t){return this.data[t]}set(t,i,n=!1){this.data[t]=i,n?this.sensitive.add(t):this.sensitive.has(t)&&this.sensitive.delete(t)}getAll(){return{...this.data}}isSensitive(t){return this.sensitive.has(t)}getAllSensitiveKeys(){return new Set(this.sensitive)}delete(t){return this.sensitive.delete(t),delete this.data[t]}clear(){this.data={},this.sensitive.clear()}has(t){return t in this.data}get size(){return Object.keys(this.data).length}merge(t){for(let[i,n]of Object.entries(t.getAll()))this.set(i,n,t.isSensitive(i))}toJSON(){return{data:{...this.data},sensitiveKeys:Array.from(this.sensitive)}}static fromJSON(t){let i=new Yc;if(t.data){let n=new Set(t.sensitiveKeys||[]);for(let[a,o]of Object.entries(t.data))i.set(a,o,n.has(a))}return i}},Sp=T.z.enum(["JS_CODE","AI_MODE"]),Gc=T.z.object({type:Sp,expression:T.z.string()}),Ep=T.z.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),Oi=T.z.object({uid:T.z.string(),type:Ep,comment:T.z.string().optional()}),Tp=T.z.object({action_data:T.z.object({action_name:T.z.string(),kwargs:T.z.record(T.z.any()).optional(),args:T.z.array(T.z.any()).optional()}),action_description:T.z.string().optional(),url:T.z.string().optional(),xpath:T.z.string().nullable().optional(),locator:T.z.string().nullable().optional(),css_selector:T.z.string().nullable().optional(),unique_selector:T.z.string().nullable().optional(),element_index:T.z.number().nullable().optional(),frame_path:T.z.array(T.z.any()).optional(),artifacts:T.z.record(T.z.any()).optional(),feedback:T.z.string().optional(),original_browser_use_action:T.z.any().optional()}).passthrough(),Ap=Oi.extend({type:T.z.literal("DRAFT"),description:T.z.string()}),Mp=Oi.extend({type:T.z.literal("ACTION"),description:T.z.string(),action_entity:Tp.optional(),locator:T.z.string().optional(),use_pure_vision:T.z.boolean().optional()}),re=T.z.lazy(()=>T.z.union([Ap,Mp,Oi.extend({type:T.z.literal("STEP"),description:T.z.string().optional().default(""),statements:T.z.array(re),reference_id:T.z.number().optional(),template_path:T.z.string().optional(),template_params:T.z.record(T.z.string()).optional()}),Oi.extend({type:T.z.literal("IF_ELSE"),description:T.z.string().optional(),condition:Gc,then:T.z.array(re),else:T.z.array(re).optional()}),Oi.extend({type:T.z.literal("WHILE_LOOP"),description:T.z.string().optional(),condition:Gc,body:T.z.array(re),timeout_ms:T.z.number().optional()})])),Ip=T.z.object({name:T.z.string(),statements:T.z.array(re),teardown:T.z.array(re).optional(),skip:T.z.union([T.z.boolean(),T.z.string()]).optional(),timeout:T.z.number().optional(),fail:T.z.union([T.z.boolean(),T.z.string()]).optional(),only:T.z.boolean().optional(),slow:T.z.boolean().optional()}),Cp=T.z.object({tests:T.z.array(Ip).min(1),beforeAll:T.z.array(re).optional(),afterAll:T.z.array(re).optional(),beforeEach:T.z.array(re).optional(),afterEach:T.z.array(re).optional()}),Y_=T.z.object({comment:T.z.string().optional(),version:T.z.string().optional(),goal:T.z.string().optional(),url:T.z.string().optional(),baseURL:T.z.string().optional(),final_feedback:T.z.string().optional(),completed:T.z.boolean().optional(),success:T.z.boolean().optional(),statements:T.z.array(re).optional(),teardown:T.z.array(re).optional(),last_modified_at:T.z.string().optional(),testGroup:Cp.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"}),rk=1024*1024});async function Pp(e,t){let i=JSON.parse(Ne.default.readFileSync(t,"utf-8"));i.cookies?.length&&await e.addCookies(i.cookies)}var Ne,Jc,At,Ze,qc,Zc=y(()=>{"use strict";Oo();Tt();Ie();_t();F();Ne=R(require("fs"),1),Jc=R(require("os"),1),At=R(require("path"),1),Ze=require("playwright");qc=class{constructor(e={}){e.testDir&&(this.testDir=e.testDir,this.videoBasePath=At.default.join(e.testDir,"videos"),this.statesBasePath=At.default.join(e.testDir,"states"),this.downloadsBasePath=At.default.join(e.testDir,"downloads"),Ne.default.mkdirSync(this.videoBasePath,{recursive:!0}),Ne.default.mkdirSync(this.statesBasePath,{recursive:!0}),Ne.default.mkdirSync(this.downloadsBasePath,{recursive:!0})),this.terminationTimeout=e.terminationTimeout??null,this.defaultHeadless=e.headless??!1,this.additionalArgs=e.additionalArgs??[]}async launchBrowser(e={}){let t=e.debugPort,i=e.headless??this.defaultHeadless,n=Xc(e.deviceName),a=Vc(e.deviceName),o=n===Et.Chromium,r=!!e.extensionPath;h.info(`[BrowserManager] Launching ${n} browser for device: ${e.deviceName||"default"}${t?` on port ${t}`:""}`);let s={headless:i};if(o){r&&i&&(h.warn("[BrowserManager] Extension requested in headless mode; forcing headed mode to load extension."),i=!1,s.headless=!1);let k=[];(e.enableCamera||e.enableMicrophone)&&(k.push("--use-fake-device-for-media-stream","--use-fake-ui-for-media-stream"),e.enableMicrophone&&e.fakeAudioCapturePath&&(k.push(`--use-file-for-fake-audio-capture=${e.fakeAudioCapturePath}`),h.info(`[BrowserManager] Using fake audio capture file: ${e.fakeAudioCapturePath}`)));let E=r&&e.extensionPath?[`--disable-extensions-except=${e.extensionPath}`,`--load-extension=${e.extensionPath}`]:[];s.args=[...mc(t,e.disableSecurity??!0,i),...k,...E,...this.additionalArgs],a&&(s.channel=a,h.debug(`[BrowserManager] Launching browser with channel: ${a}`))}let l=ba(e.deviceName),d=zc(e.deviceName),c={acceptDownloads:!0,...l,timezoneId:e.timezoneId||"America/Los_Angeles",locale:e.locale||"en-US"};e.viewport&&(c.viewport=e.viewport,c.screen=e.viewport),e.isMobile!==void 0&&(c.isMobile=e.isMobile),e.hasTouch!==void 0&&(c.hasTouch=e.hasTouch),e.userAgent&&(c.userAgent=e.userAgent),e.colorScheme&&(c.colorScheme=e.colorScheme),e.geolocation&&(c.geolocation=e.geolocation,c.permissions=[...c.permissions||[],"geolocation"]);let u=r&&o?e.localStorageStatePath:void 0;e.localStorageStatePath&&!u&&(c.storageState=e.localStorageStatePath),e.recordVideo&&this.videoBasePath&&(c.recordVideo={dir:this.videoBasePath,size:{width:d.width,height:d.height}}),e.proxy&&(c.proxy=e.proxy),e.extraHTTPHeaders&&Object.keys(e.extraHTTPHeaders).length>0&&(c.extraHTTPHeaders=e.extraHTTPHeaders);let m,g,w,v=!1;if(o&&(r||e.userDataDir)){if(e.userDataDir)w=e.userDataDir;else{let E=this.testDir||Ne.default.mkdtempSync(At.default.join(Jc.default.tmpdir(),"shiplight-"));w=At.default.join(E,`ext-profile-${Date.now()}`),Ne.default.mkdirSync(w,{recursive:!0}),v=!0}let k={...s,...c};g=await Ze.chromium.launchPersistentContext(w,k),u&&(await Pp(g,u),h.info(`[BrowserManager] Loaded storage state into persistent context from ${u}`)),m=g.browser(),h.info(`[BrowserManager] Launched persistent context${e.extensionPath?` for extension at ${e.extensionPath}`:` with profile at ${w}`}`)}else{switch(n){case Et.Firefox:m=await Ze.firefox.launch(s);break;case Et.Webkit:m=await Ze.webkit.launch(s);break;case Et.Chromium:default:m=await Ze.chromium.launch(s);break}g=await m.newContext(c)}if(g.addInitScript(Oe),o){let k=["clipboard-read","clipboard-write"];e.enableCamera&&k.push("camera"),e.enableMicrophone&&k.push("microphone");try{await g.grantPermissions(k),h.info(`[BrowserManager] Granted permissions: ${k.join(", ")}`)}catch(E){h.warn("[BrowserManager] Failed to grant permissions:",E)}}else(e.enableCamera||e.enableMicrophone)&&h.warn("[BrowserManager] Camera/microphone enabled but browser is not Chromium; ignoring.");if(e.cookies&&e.cookies.length>0){let k=(Date.now()+31536e6)/1e3,E=e.cookies.map(I=>({...I,expires:k}));await g.addCookies(E),h.info(`[BrowserManager] Added ${e.cookies.length} cookies to browser context with expires=${k}`)}let x=e.viewport,p=x?{width:x.width,height:x.height+wa}:jc(e.deviceName);if(h.info(`[BrowserManager] windowSize=${JSON.stringify(p)}`),o){let k=async E=>{try{await ia(E,p.width,p.height),x&&await E.setViewportSize(x)}catch(I){h.warn("[BrowserManager] Failed to set window bounds via CDP:",I)}};for(let E of g.pages())await k(E);g.on("page",k)}let f="";if(o&&t!==void 0)try{f=await ta(t)}catch(k){h.warn("[BrowserManager] Failed to get CDP WebSocket URL:",k)}let S=null;f&&(S=await kt({cdpUrl:f,label:`agent ${e.deviceName??n}`,pid:process.pid}),S&&h.info(`[BrowserManager] Registered browser with dev-box registry id=${S}`));let _={debugPort:t,browser:m,context:g,startTime:new Date,timeout:null,browserWsUrl:f,downloadsBasePath:this.downloadsBasePath,browserType:n,userDataDir:w,isTempUserDataDir:v,registryId:S};if(this.terminationTimeout!==null){let k=setTimeout(()=>{h.info(`[BrowserManager] Browser auto-terminated after ${this.terminationTimeout}ms`),this.terminateBrowser(_).catch(E=>h.error("[BrowserManager] Error terminating browser:",E))},this.terminationTimeout);_.timeout=k}return _}async terminateBrowser(e){if(e.timeout&&clearTimeout(e.timeout),await St(e.registryId??null),await e.context.close(),await e.browser.close(),e.isTempUserDataDir&&e.userDataDir)try{Ne.default.rmSync(e.userDataDir,{recursive:!0,force:!0})}catch(t){h.warn("[BrowserManager] Failed to clean up temp user data dir:",e.userDataDir,t)}}getVideoBasePath(){return this.videoBasePath}getStatesBasePath(){return this.statesBasePath}getDownloadsBasePath(){return this.downloadsBasePath}}});function $p(e){let t=(0,Qc.execFileSync)("ps",["-axo","pid=,ppid=,args="],{encoding:"utf-8"}),i=[];for(let o of t.split(`
4436
4436
  `)){let r=o.trimStart().match(/^(\d+)\s+(\d+)\s+(.*)$/);r&&i.push({pid:parseInt(r[1],10),ppid:parseInt(r[2],10),args:r[3]})}let n=new Set([e]),a=!0;for(;a;){a=!1;for(let o of i)!n.has(o.pid)&&n.has(o.ppid)&&(n.add(o.pid),a=!0)}for(let o of i){if(o.pid===e||!n.has(o.pid)||!/chrome|chromium/i.test(o.args))continue;let r=o.args.match(/--user-data-dir=([^\s]+)/);if(r)return r[1]}return null}async function Lp(e,t){let i=td.join(e,"DevToolsActivePort"),n=Date.now()+t;for(;Date.now()<n;){try{let a=ed.readFileSync(i,"utf-8").trim(),[o,r]=a.split(`
4437
4437
  `),s=parseInt(o,10);if(Number.isFinite(s)&&s>0&&typeof r=="string"&&r.startsWith("/"))return{port:s,wsPath:r}}catch{}await new Promise(a=>setTimeout(a,100))}throw new Error(`Timed out waiting for ${i} \u2014 Chromium never exposed DevTools`)}async function ya(e,t=3e4){let i=$p(e);if(!i)throw new Error(`No Chromium descendant of pid ${e} with --user-data-dir found. Did you launch with --remote-debugging-port=0 and is the browser still running?`);let{port:n,wsPath:a}=await Lp(i,t);return`ws://127.0.0.1:${n}${a}`}var Qc,ed,td,id=y(()=>{"use strict";Qc=require("child_process"),ed=R(require("fs"),1),td=R(require("path"),1)});var nd,ad=y(()=>{"use strict";Tt();nd=e=>{if(!e||e===qe)return"desktop";let t=Ni(e);return t&&t.isMobile?"mobile":"desktop"}});var Dp,od=y(()=>{"use strict";Dp=(e=>(e.Desktop="desktop",e.Mobile="mobile",e))(Dp||{})});async function rd(e,t){let i=Object.getPrototypeOf(async()=>{}).constructor,n=`
4438
4438
  return await (${t});
@@ -4492,7 +4492,7 @@ ${m.join(`
4492
4492
 
4493
4493
  `,u.some(g=>g)){b.log(`Locator validation on unsigned-in page failed (some passed when should fail). Results: ${JSON.stringify(u)}`),b.log(`Validation logs:
4494
4494
  ${m.join(`
4495
- `)}`);continue}}return b.log("Generated validation locators passed dual validation"),c}catch(c){b.log(`Failed to generate validation expressions (attempt ${d+1}/${s}): ${c.message}`)}return b.log("Failed to generate valid locators after max retries"),null}finally{o&&await o.close()}}var Op,Np,va=y(()=>{"use strict";ie();Ie();Op=5e3,Np=1e4});var sd,Bo=y(()=>{"use strict";sd=class{constructor(e){this.currentPage=null,this.currentIndex=-1,this.context=e,this.initialize()}initialize(){this.context.on("page",async t=>{await this.handleNewPage(t)});let e=this.context.pages();e.length>0&&(this.currentPage=e[0],this.currentIndex=0);for(let t of e)this.setupPageListeners(t)}async handleNewPage(e){try{this.setupPageListeners(e);let t=this.context.pages().indexOf(e);await this.setCurrentPage(e,t)}catch{}}setupPageListeners(e){e.on("close",async()=>{await this.handlePageClose(e)})}async handlePageClose(e){try{if(this.currentPage===e){let t=this.context.pages(),i=t.slice().reverse().find(n=>!n.isClosed());i&&await this.setCurrentPage(i,t.indexOf(i))}}catch{}}async setCurrentPage(e,t){let i=this.currentPage!==e;this.currentPage=e,this.currentIndex=t,i&&await e.bringToFront()}async switchToPage(e){let t=this.context.pages();if(e<0||e>=t.length)throw new Error(`Invalid page index: ${e}. Available pages: 0-${t.length-1}`);let i=t[e];if(i.isClosed())throw new Error(`Page at index ${e} is closed`);return await this.setCurrentPage(i,e),i}async closePage(e){let t=this.context.pages();if(e<0||e>=t.length)throw new Error(`Invalid page index: ${e}. Available pages: 0-${t.length-1}`);let i=t[e];if(i.isClosed())throw new Error(`Page at index ${e} is already closed`);await i.close()}getCurrentPage(){return this.currentPage}getCurrentIndex(){return this.currentIndex}getAllPages(){return this.context.pages()}getPageCount(){return this.context.pages().length}}});async function ld(e,t=3e3,i=1e3){try{await Me(e,t,i)}catch{}}async function cd(e,t,i){let n=i*1e3,a=100,o=Date.now();for(;!t.downloadStatus||t.downloadStatus.status==="inProgress";){if(Date.now()-o>n){let r;throw t.downloadStatus?r=`Timed out after ${n}ms waiting for download to complete`:r="No download in progress or completed",h.error(r),new Error(r)}await e.waitForTimeout(a)}if(t.downloadStatus.status==="failed"){let r=`Download failed: ${t.downloadStatus.error||"Unknown error"}`;throw h.error(r),new Error(r)}t.agentNote=`Download completed: ${t.downloadStatus.filename}`}async function dd(e,t,i,n=60,a){let o=Math.min(n,300),r=Math.max(10,o/10)*1e3,s=Date.now()+o*1e3;for(h.info(`Waiting for condition: "${t}" (timeout: ${o}s)`);;){let l=Date.now();try{if(await i(e,t,a))return h.info(`Condition met: "${t}"`),!0}catch(c){h.warn(`Error evaluating condition: ${c.message}`)}if(Date.now()>s)return h.warn(`Timeout waiting for condition: "${t}"`),!1;let d=r-(Date.now()-l);d>0&&await e.waitForTimeout(d)}}var _a=y(()=>{"use strict";Ie();F()});function hd(e){return e.url()===":"}var ud,Wi,ka,Rp,Sa,Uo=y(()=>{"use strict";Bo();Tt();_a();Ie();F();ud=R(require("fs"),1),Wi=R(require("path"),1),ka=require("otplib"),Rp=(0,ka.createGuardrails)({MIN_SECRET_BYTES:1});Sa=class{constructor(e){this.context=e,this.testDataFileNames=[],this.extensionEnabled=!1}setTestDataDownloader(e,t){this.testDataDownloader=e,this.testDataFileNames=t??[]}setupPageTracking(e){this.tabManager=new sd(e)}async switchTab(e){if(!this.tabManager)throw new Error("Tab manager not initialized");return await this.tabManager.switchToPage(e)}async closeTab(e){if(!this.tabManager)throw new Error("Tab manager not initialized");await this.tabManager.closePage(e)}getCurrentPage(){return this.tabManager?this.tabManager.getCurrentPage():null}validatePage(e){let t=this.getCurrentPage();if(t&&t!==e&&!t.isClosed())return h.info(`[validatePage] Page changed, switching to ${t.url()}`),t;if(e.isClosed()){let i=e.context().pages().filter(n=>!n.isClosed());if(i.length>0){let n=i[i.length-1];return h.info(`[validatePage] Page closed, switching to ${n.url()}`),n}h.error("[validatePage] No valid pages found")}return e}replaceVariables(e){return ba(e,this.context.variableStore.getAll())}getTestDataFileNames(){return this.testDataFileNames}getTestDataFilePath(e){let t=this.context.testDataDir||process.cwd();return Wi.join(t,e)}async downloadTestDataFiles(e){if(e.length===0){h.debug("[AgentServices] No file paths provided for download");return}let t=this.context.testDataDir||process.cwd(),i=e.filter(n=>{let a=Wi.basename(n),o=Wi.join(t,a),r=ud.existsSync(o);return r&&h.debug(`[AgentServices] File already exists locally: ${a}`),!r});if(i.length===0){h.debug("[AgentServices] All files exist locally, no download needed");return}if(!this.testDataDownloader){h.debug("[AgentServices] No test data downloader configured, assuming files are pre-populated");return}h.info(`[AgentServices] Downloading ${i.length} test data files: ${i.join(", ")}`),await this.testDataDownloader(i,t)}async waitForDownloadComplete(e,t){return cd(e,this.context,t)}getRecentDownloadedFilePath(){return this.context.downloadStatus?this.context.downloadStatus.status!=="completed"?(h.debug(`Download is ${this.context.downloadStatus.status}, not completed`),null):this.context.downloadStatus.filePath?(h.info(`Retrieved recent download path: ${this.context.downloadStatus.filePath}`),this.context.downloadStatus.filePath):(h.warn("Download completed but file path is missing"),null):(h.debug("No download found"),null)}addSensitive(e,t){this.context.variableStore.set(e,t,!0)}saveVariable(e,t){let i=e.startsWith("$")?e.slice(1):e;this.context.variableStore.set(i,t),h.debug(`Saved variable: ${i} = ${JSON.stringify(t)}`),this.context.agentNote=`A new value is saved to the variable "${i}".`}addNote(e){!e||e.trim()===""||(this.context.agentNote?this.context.agentNote+=`
4495
+ `)}`);continue}}return b.log("Generated validation locators passed dual validation"),c}catch(c){b.log(`Failed to generate validation expressions (attempt ${d+1}/${s}): ${c.message}`)}return b.log("Failed to generate valid locators after max retries"),null}finally{o&&await o.close()}}var Op,Np,va=y(()=>{"use strict";ie();Ie();Op=5e3,Np=1e4});var sd,Bo=y(()=>{"use strict";sd=class{constructor(e){this.currentPage=null,this.currentIndex=-1,this.context=e,this.initialize()}initialize(){this.context.on("page",async t=>{await this.handleNewPage(t)});let e=this.context.pages();e.length>0&&(this.currentPage=e[0],this.currentIndex=0);for(let t of e)this.setupPageListeners(t)}async handleNewPage(e){try{this.setupPageListeners(e);let t=this.context.pages().indexOf(e);await this.setCurrentPage(e,t)}catch{}}setupPageListeners(e){e.on("close",async()=>{await this.handlePageClose(e)})}async handlePageClose(e){try{if(this.currentPage===e){let t=this.context.pages(),i=t.slice().reverse().find(n=>!n.isClosed());i&&await this.setCurrentPage(i,t.indexOf(i))}}catch{}}async setCurrentPage(e,t){let i=this.currentPage!==e;this.currentPage=e,this.currentIndex=t,i&&await e.bringToFront()}async switchToPage(e){let t=this.context.pages();if(e<0||e>=t.length)throw new Error(`Invalid page index: ${e}. Available pages: 0-${t.length-1}`);let i=t[e];if(i.isClosed())throw new Error(`Page at index ${e} is closed`);return await this.setCurrentPage(i,e),i}async closePage(e){let t=this.context.pages();if(e<0||e>=t.length)throw new Error(`Invalid page index: ${e}. Available pages: 0-${t.length-1}`);let i=t[e];if(i.isClosed())throw new Error(`Page at index ${e} is already closed`);await i.close()}getCurrentPage(){return this.currentPage}getCurrentIndex(){return this.currentIndex}getAllPages(){return this.context.pages()}getPageCount(){return this.context.pages().length}}});async function ld(e,t=3e3,i=1e3){try{await Me(e,t,i)}catch{}}async function cd(e,t,i){let n=i*1e3,a=100,o=Date.now();for(;!t.downloadStatus||t.downloadStatus.status==="inProgress";){if(Date.now()-o>n){let r;throw t.downloadStatus?r=`Timed out after ${n}ms waiting for download to complete`:r="No download in progress or completed",h.error(r),new Error(r)}await e.waitForTimeout(a)}if(t.downloadStatus.status==="failed"){let r=`Download failed: ${t.downloadStatus.error||"Unknown error"}`;throw h.error(r),new Error(r)}t.agentNote=`Download completed: ${t.downloadStatus.filename}`}async function dd(e,t,i,n=60,a){let o=Math.min(n,300),r=Math.max(10,o/10)*1e3,s=Date.now()+o*1e3;for(h.info(`Waiting for condition: "${t}" (timeout: ${o}s)`);;){let l=Date.now();try{if(await i(e,t,a))return h.info(`Condition met: "${t}"`),!0}catch(c){h.warn(`Error evaluating condition: ${c.message}`)}if(Date.now()>s)return h.warn(`Timeout waiting for condition: "${t}"`),!1;let d=r-(Date.now()-l);d>0&&await e.waitForTimeout(d)}}var _a=y(()=>{"use strict";Ie();F()});function hd(e){return e.url()===":"}var ud,Wi,ka,Rp,Sa,Uo=y(()=>{"use strict";Bo();Tt();_a();Ie();F();ud=R(require("fs"),1),Wi=R(require("path"),1),ka=require("otplib"),Rp=(0,ka.createGuardrails)({MIN_SECRET_BYTES:1});Sa=class{constructor(e){this.context=e,this.testDataFileNames=[],this.extensionEnabled=!1}setTestDataDownloader(e,t){this.testDataDownloader=e,this.testDataFileNames=t??[]}setupPageTracking(e){this.tabManager=new sd(e)}async switchTab(e){if(!this.tabManager)throw new Error("Tab manager not initialized");return await this.tabManager.switchToPage(e)}async closeTab(e){if(!this.tabManager)throw new Error("Tab manager not initialized");await this.tabManager.closePage(e)}getCurrentPage(){return this.tabManager?this.tabManager.getCurrentPage():null}validatePage(e){let t=this.getCurrentPage();if(t&&t!==e&&!t.isClosed())return h.info(`[validatePage] Page changed, switching to ${t.url()}`),t;if(e.isClosed()){let i=e.context().pages().filter(n=>!n.isClosed());if(i.length>0){let n=i[i.length-1];return h.info(`[validatePage] Page closed, switching to ${n.url()}`),n}h.error("[validatePage] No valid pages found")}return e}replaceVariables(e){return fa(e,this.context.variableStore.getAll())}getTestDataFileNames(){return this.testDataFileNames}getTestDataFilePath(e){let t=this.context.testDataDir||process.cwd();return Wi.join(t,e)}async downloadTestDataFiles(e){if(e.length===0){h.debug("[AgentServices] No file paths provided for download");return}let t=this.context.testDataDir||process.cwd(),i=e.filter(n=>{let a=Wi.basename(n),o=Wi.join(t,a),r=ud.existsSync(o);return r&&h.debug(`[AgentServices] File already exists locally: ${a}`),!r});if(i.length===0){h.debug("[AgentServices] All files exist locally, no download needed");return}if(!this.testDataDownloader){h.debug("[AgentServices] No test data downloader configured, assuming files are pre-populated");return}h.info(`[AgentServices] Downloading ${i.length} test data files: ${i.join(", ")}`),await this.testDataDownloader(i,t)}async waitForDownloadComplete(e,t){return cd(e,this.context,t)}getRecentDownloadedFilePath(){return this.context.downloadStatus?this.context.downloadStatus.status!=="completed"?(h.debug(`Download is ${this.context.downloadStatus.status}, not completed`),null):this.context.downloadStatus.filePath?(h.info(`Retrieved recent download path: ${this.context.downloadStatus.filePath}`),this.context.downloadStatus.filePath):(h.warn("Download completed but file path is missing"),null):(h.debug("No download found"),null)}addSensitive(e,t){this.context.variableStore.set(e,t,!0)}saveVariable(e,t){let i=e.startsWith("$")?e.slice(1):e;this.context.variableStore.set(i,t),h.debug(`Saved variable: ${i} = ${JSON.stringify(t)}`),this.context.agentNote=`A new value is saved to the variable "${i}".`}addNote(e){!e||e.trim()===""||(this.context.agentNote?this.context.agentNote+=`
4496
4496
  ${e.trim()}`:this.context.agentNote=e.trim())}readVariable(e){let t=e.startsWith("$")?e.slice(1):e,i=this.context.variableStore.get(t);return h.debug(`Read variable: ${t} = ${JSON.stringify(i)}`),i}async generate2faCode(e){try{let t=(0,ka.generateSync)({secret:e,guardrails:Rp});return h.info(`Generated 2FA code: ${t}`),t}catch(t){throw h.error(`Failed to generate 2FA code: ${t.message}`),new Error(`Failed to generate 2FA code: ${t.message}`)}}async getDOMText(e){return await e.evaluate(()=>document.body.innerText)}async waitUntilStable(e,t){return Me(e,t)}setPage(e){this.context.setPage?(h.info("[AgentServices] Calling setPage callback"),this.context.setPage(e)):h.debug("[AgentServices] setPage callback not configured")}getModel(){if(!this.context.model)throw new Error("No LLM model configured. An LLM model is required for AI-powered actions (login, verify, ai_extract, ai_wait_until, etc.). Set GOOGLE_API_KEY or ANTHROPIC_API_KEY in your MCP server configuration.");return this.context.model}getComputerUseModel(){return this.context.computer_use_model}get variableStore(){return this.context.variableStore}getDownloadDir(){return this.context.downloadDir}getActionSettings(){return this.context.organizationSettings?.action_code_conversion_settings||{}}getInteractiveClassNames(){return this.context.organizationSettings?.agent_settings?.interactive_class_names||[]}getIframeFallbackDomains(){return this.context.organizationSettings?.agent_settings?.iframe_fallback_domains||[]}isUseCleanScreenshotForAssertion(){return this.context.organizationSettings?.use_clean_screenshot_for_assertion??!0}isKnowledgeImagesEnabled(){return this.context.organizationSettings?.agent_settings?.enable_knowledge_images||!1}isSlicedScreenshotsEnabled(){return this.context.organizationSettings?.agent_settings?.use_sliced_screenshots||!1}isResizeSlicedScreenshotsEnabled(){return this.context.organizationSettings?.agent_settings?.resize_sliced_screenshots||!1}isAccessibilityTreeEnabled(){return this.context.organizationSettings?.agent_settings?.use_accessibility_tree||!1}isActionIntentFilteringEnabled(){return this.context.organizationSettings?.agent_settings?.use_action_intent_filtering||!1}isDomTreeTsEnabled(){let e=process.env.USE_DOM_TREE_TS;return e!==void 0?e==="true"||e==="1":this.context.organizationSettings?.agent_settings?.use_dom_tree_ts||!1}setExtensionEnabled(e){this.extensionEnabled=e}getDomServiceOptions(){return{useDomTreeTs:this.isDomTreeTsEnabled(),domTreeRoot:this.extensionEnabled?"document":"body"}}setKnowledgeRetriever(e){this.knowledgeRetriever=e}hasKnowledgeRetriever(){return this.knowledgeRetriever!==void 0}async retrieveKnowledges(e,t,i,n){if(!this.knowledgeRetriever)return h.debug("[AgentServices] No knowledge retriever configured"),[];try{let a=await this.knowledgeRetriever(e,t,i,n);return h.debug(`[AgentServices] Retrieved ${a.length} knowledges for statement`),a}catch(a){return h.warn(`[AgentServices] Failed to retrieve knowledges: ${a.message}`),[]}}}});var Go,Ea,Ko=y(()=>{"use strict";Go=(e=>(e.Started="started",e.Action="action",e.Completion="completion",e.Error="error",e.Aborted="aborted",e.Keepalive="keepalive",e))(Go||{}),Ea=class extends Error{constructor(e){super(e),this.name="AgentTaskFailedError",this.details=e}}});var md={};Ke(md,{LoginType:()=>Ri,checkLocators:()=>Fi,createUnsignedInContext:()=>Ho,generateAndValidateLoginLocators:()=>xa,generateValidationLocators:()=>Wo,validateLogin:()=>Hi,validateLoginLocators:()=>Fo});var pd=y(()=>{"use strict";va();ie();Tt();Ie();_t();F();te();pt();pe()});function Hp(e){try{let t=e.toString(),i,n=t.indexOf("=>");if(n!==-1){let s=t.slice(n+2).trim();if(s.startsWith("{")){let l=s.lastIndexOf("}");i=s.slice(1,l)}else return s.trim()}else{let s=t.indexOf("{"),l=t.lastIndexOf("}");s!==-1&&l>s&&(i=t.slice(s+1,l))}if(!i)return;let a=i.split(`
4497
4497
  `),o=a.filter(s=>s.trim().length>0);if(o.length===0)return;let r=Math.min(...o.map(s=>s.match(/^(\s*)/)?.[1].length??0));return a.map(s=>s.slice(r)).join(`
4498
4498
  `).trim()}catch{return}}function Mt(e,t){let i={};for(let[n,a]of Object.entries(e))i[n]=t.has(n)?"*****":a;return i}var z,Q,Fp,Wp,Bp,jo,gd=y(()=>{"use strict";ei();Ve();va();ie();Uo();_a();Ko();di();F();z=R(require("fs"),1),Q=R(require("path"),1),Fp=1;Wp=3,Bp=40;jo=class{constructor(e){this.context=e,this._newActionEntities=new Map,this.agentServices=new Sa(e),this.agentServices.agent=this,this.context.tokenUsages||(this.context.tokenUsages=[])}getNewActionEntities(){return this._newActionEntities}getAgentNote(){return this.context.agentNote||void 0}async getActionHandler(){if(!this._actionHandler){let{default:e}=await Promise.resolve().then(()=>(xt(),yt));this._actionHandler=new e}return this._actionHandler}async execAction(e,t,i){let n=(await this.getActionHandler()).getAction(e);if(!n)throw new Error(`Unknown action: ${e}`);await n.execute(t,i,this.agentServices)}async dismissModalIfPresent(e,t){try{let i=await this.execute(e,`TASK: Check if there is an INTRUSIVE POPUP blocking the page, and dismiss it if present.
@@ -4529,9 +4529,7 @@ If the page is not signed in, sign in with the OAuth provider "${l.provider_name
4529
4529
  `}t.additional_prompt&&(s+=`
4530
4530
  Additional instructions: ${t.additional_prompt}
4531
4531
  `);try{b.log("Level 3: Attempting agent-based login"),b.log(`Login prompt:
4532
- ${s}`);let l=this.agentServices.knowledgeRetriever,d=!1;this.agentServices.hasKnowledgeRetriever()&&l&&(b.log("Setting up login knowledge retriever..."),this.agentServices.setKnowledgeRetriever(async(v,x,p,f)=>await l(v,x,p,"login")),d=!0,b.log("Login knowledge retriever configured"));let c;try{if(c=await this.run(e,s,"login"),!c.success)return b.log("Level 3 FAILED: Agent login failed"),h.info("Login: Failed"),{success:!1,page:e}}finally{d&&l&&(this.agentServices.setKnowledgeRetriever(l),b.log("Restored original knowledge retriever"))}let u=await e.context().storageState(),m;if(a)b.log("Skipping validation locator generation (AI verification mode enabled)");else if(t.num_verification_exprs!==0)try{b.log("Generating validation locators for future login verification...");let v=await xa(e,t.site_url,{verification_hint:t.verification_hint,num_verification_exprs:t.num_verification_exprs},async(x,p)=>this.run(x,p),async x=>this.getDOMText(x));v?(m=v,b.log(`Generated ${m.length} validation locator(s): ${JSON.stringify(m)}`)):b.log("Failed to generate validation locators, login will still succeed")}catch(v){b.log(`Error generating validation locators: ${v.message}`)}else b.log("Skipping validation locator generation (num_verification_exprs=0)");b.log("Level 3 SUCCESS: Agent login succeeded"),h.info("Login: Agent login succeeded");let g=c.actions||[],w=g.length>0?g:i?.cached_actions;return{success:!0,page:e,storage_state:u,cached_actions:w,validation_exprs:m}}catch(l){return b.error(`Agent login failed: ${l.message}`),h.info("Login: Failed"),{success:!1,page:e}}}async executeCachedLogin(e,t,i){let n=(await Promise.resolve().then(()=>(xt(),yt))).default,a=new n;for(let o=0;o<t.length;o++){let r=t[o];b.log(`Executing cached action ${o+1}/${t.length}: ${r.action_description||r.action_data?.action_name}`);try{if(!r.action_data){b.log(`Action ${o+1} missing action_data, skipping`);continue}await a.execute(e,r,this.agentServices),await this.waitUntilStable(e,5e3)}catch(s){return b.error(`Cached action ${o+1} failed: ${s.message}`),{success:!1}}}return i?.aiVerificationStatement?(b.log("Verifying cached login result with AI verification statement"),await this.evaluate(e,i.aiVerificationStatement)?{success:!0}:{success:!1}):i?.validationExprs&&i.validationExprs.length>0?await Hi(e,i.validationExprs)?{success:!0}:{success:!1}:(b.log("Cached login cannot be verified: missing AI verification statement and validation expressions"),{success:!1})}getCompletedExecutionHistory(){if(!this.context.executionHistory||this.context.executionHistory.length===0)return[];let e=this.context.executionHistory[this.context.executionHistory.length-1];return!e[1]||e[1].trim()===""?this.context.executionHistory.slice(0,-1):this.context.executionHistory}addToExecutionHistory(e,t){this.context.executionHistory||(this.context.executionHistory=[]),this.context.executionHistory.push([e,t])}async createStepResult(e,t,i,n){if(this.context.stepTracking&&!this.context.stepTracking.results[t]){this.context.stepTracking.currentStepId=t,this.context.stepTracking.onStepChange&&this.context.stepTracking.onStepChange(t);try{e=this.agentServices.validatePage(e),await this.waitUntilStable(e);let a={description:i,startTime:Date.now(),artifacts:[],type:n,code:i};if(this.context.stepTracking.artifactsDir){let o=Q.join(this.context.stepTracking.artifactsDir,t.replace(/\./g,"-"));z.mkdirSync(o,{recursive:!0});let r=Q.join(o,"screenshot.png");e=this.agentServices.validatePage(e),await e.screenshot({type:"png",path:r}),a.screenshot=r}a.contextBefore=this.snapshotVariables(),this.context.stepTracking.results[t]=a}catch(a){h.warn(`createStepResult failed for step ${t}: ${a}`),this.context.stepTracking.results[t]={description:i,startTime:Date.now(),artifacts:[],contextBefore:this.snapshotVariables()}}}}snapshotVariables(){return Mt(this.context.variableStore.getAll(),this.context.variableStore.getAllSensitiveKeys())}saveDebugInfoToFiles(e,t,i,n=0){let a={};if(!this.context.stepTracking?.artifactsDir)return h.debug("[saveDebugInfoToFiles] No artifacts directory configured, skipping debug info save"),a;let o=Q.join(this.context.stepTracking.artifactsDir,e.replace(/\./g,"-"));try{if(z.mkdirSync(o,{recursive:!0}),t.systemPrompt){let r=Q.join(o,`system_prompt_${n}.txt`);z.writeFileSync(r,t.systemPrompt),a.system_prompt_path=r,h.debug(`[saveDebugInfoToFiles] Saved system prompt to: ${r}`)}if(t.userPrompt)if(typeof t.userPrompt=="string"){let r=Q.join(o,`user_prompt_${n}.txt`);z.writeFileSync(r,t.userPrompt),a.user_prompt_path=r,h.debug(`[saveDebugInfoToFiles] Saved user prompt to: ${r}`)}else{let r=t.userPrompt.map(d=>Array.isArray(d.content)?{...d,content:d.content.map(c=>c.type==="image"&&c.file?.startsWith("data:")?{...c,file:"[base64 image data stripped]"}:c)}:d),s=Q.join(o,`messages_${n}.json`),l={system:t.systemPrompt,messages:r};z.writeFileSync(s,JSON.stringify(l,null,2)),a.messages_path=s,h.debug(`[saveDebugInfoToFiles] Saved messages to: ${s}`)}if(t.rawLlmResponse){let r=i?i.replace(/[\/\\:]/g,"-"):"llm",s=Q.join(o,`${r}_response_${n}.txt`);z.writeFileSync(s,t.rawLlmResponse),a.response_path=s,h.debug(`[saveDebugInfoToFiles] Saved LLM response to: ${s}`)}if(t.screenshotWithSom){let r=Q.join(o,`screenshot_${n}.png`);z.writeFileSync(r,Buffer.from(t.screenshotWithSom,"base64")),a.screenshot_path=r,h.debug(`[saveDebugInfoToFiles] Saved SOM screenshot to: ${r}`)}if(t.reasoningContent){let r=Q.join(o,`reasoning_${n}.txt`);z.writeFileSync(r,t.reasoningContent),a.reasoning_path=r,h.debug(`[saveDebugInfoToFiles] Saved reasoning to: ${r}`)}h.debug(`[saveDebugInfoToFiles] Saved ${Object.keys(a).length} artifacts for step ${e}`)}catch(r){h.error(`[saveDebugInfoToFiles] Failed to save debug info for step ${e}:`,r)}return a}async updateStepResult(e,t,i,n,a){if(!this.context.stepTracking)return;let o=this.context.stepTracking.results[e];if(o){if(t&&(o.status=t,o.contextAfter=this.snapshotVariables(),this.context.stepTracking.currentStepId=void 0,this.context.stepTracking.onStepChange&&this.context.stepTracking.onStepChange(void 0)),i!==void 0&&(o.message=i),n&&o.artifacts.push(n),a){let r=a.tokenUsages?.[0]?.model,s=o.artifacts.length,l=this.saveDebugInfoToFiles(e,a,r,s);Object.keys(l).length>0&&o.artifacts.push(l)}o.duration=Date.now()-o.startTime,this.context.stepTracking.onStepComplete&&this.context.stepTracking.onStepComplete(e,o)}}async writeExecutionResults(e,t){try{if(await z.promises.mkdir(e,{recursive:!0}),this.context.stepTracking?.results&&Object.keys(this.context.stepTracking.results).length>0){let i=Q.join(e,"test-results.json");await z.promises.writeFile(i,JSON.stringify(this.context.stepTracking.results,null,2)),h.debug(`Test results written to: ${i}`)}if(t?.tokenUsages&&this.context.tokenUsages&&this.context.tokenUsages.length>0){let i=Q.join(e,"token-usages.json");await z.promises.writeFile(i,JSON.stringify(this.context.tokenUsages,null,2)),h.debug(`Token usages written to: ${i}`)}if(this.context.aiActionDetails&&this.context.aiActionDetails.length>0){let i=Q.join(e,"ai-actions.json");await z.promises.writeFile(i,JSON.stringify(this.context.aiActionDetails,null,2)),h.debug(`AI action details written to: ${i}`)}}catch(i){throw h.error("Failed to write execution results:",i),i}}}});function Up(){let e=new Date,t=new Intl.DateTimeFormat("en-US",{timeZone:"America/Los_Angeles",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(e),i=t.find(p=>p.type==="year").value,n=t.find(p=>p.type==="month").value,a=t.find(p=>p.type==="day").value,o=t.find(p=>p.type==="hour").value,r=t.find(p=>p.type==="minute").value,s=t.find(p=>p.type==="second").value,l=String(e.getMilliseconds()).padStart(3,"0"),d=`${i}-${n}-${a}T${o}:${r}:${s}.${l}`,c=e.toISOString().slice(0,-1),u=Date.parse(d+"Z"),m=Date.parse(c+"Z"),g=Math.round((m-u)/(1e3*60)),w=String(Math.floor(Math.abs(g)/60)).padStart(2,"0"),v=String(Math.abs(g)%60).padStart(2,"0"),x=g<=0?"+":"-";return`${i}-${n}-${a}T${o}:${r}:${s}.${l}${x}${w}:${v}`}function zo(e){let t=e.variableStore;return t.has("currentTime")||t.set("currentTime",Up()),{model:e.model,computer_use_model:e.computer_use_model,variableStore:t,organizationId:e.organizationId,organizationSettings:e.organizationSettings,executionHistory:e.executionHistory||[],testDataDir:e.testDataDir,downloadDir:e.downloadDir,useNativeGenerator:e.useNativeGenerator,autoDismissModal:e.autoDismissModal,tokenUsages:[],aiActionDetails:[]}}var fd=y(()=>{"use strict"});var wd={};Ke(wd,{ActionHandler:()=>Jn,ActionHelper:()=>Di,Agent:()=>jo,AgentServices:()=>Sa,AgentStepEventTypes:()=>Go,AgentTaskFailedError:()=>Ea,BrowserManager:()=>qc,DEFAULT_EVENT_LISTENER_LIMIT:()=>xn,DomService:()=>ue,EVENT_LISTENER_CANDIDATE_SELECTORS:()=>yn,HistoryTreeProcessor:()=>tl,INIT_SCRIPT:()=>Oe,INTERACTION_EVENT_TYPES:()=>ut,INTERACTIVE_ROLES:()=>Vt,LogLevel:()=>ro,LoginType:()=>Ri,MCPToolProvider:()=>Fc,OpenAIToolProvider:()=>Ji,SDK_VERSION:()=>Kp,ToolRegistry:()=>dt,TwoFactorAuthType:()=>No,VariableStore:()=>Ro,WebAgent:()=>jo,configureSdk:()=>Yr,createAgent:()=>Gp,createAgentContext:()=>zo,createToolRegistry:()=>Dc,createToolRegistryWithCapabilities:()=>Oc,discoverChromiumCdpUrl:()=>ya,ensureToolsRegistered:()=>$c,evaluateStatement:()=>Ye,executeStep:()=>Xe,exportMCPTools:()=>Hc,filterInteractionListeners:()=>Hs,generateActionStep:()=>wt,getActionEntityLocatorInfo:()=>N,getBrowserCdpUrl:()=>ta,getCapabilitySummary:()=>Nc,getFramePath:()=>io,getModel:()=>we,getPageInfo:()=>fc,getPageWsUrl:()=>gc,getPlatformFromDeviceName:()=>nd,getProviderOptions:()=>be,getSdkConfig:()=>U,getToolRegistry:()=>Lc,injectUserFunction:()=>Ua,isInteractionEventType:()=>Fs,isInteractiveRole:()=>Rs,loadKnowledgeMappings:()=>ts,loadKnowledges:()=>es,loadUserFunctions:()=>Zr,logger:()=>h,newBrowserContext:()=>pc,parseSSEStream:()=>Vr,parseSdkLogLevelFromEnv:()=>Jr,pickBestLocator:()=>Rt,pickBestLocatorForElement:()=>tn,pickBestLocators:()=>rs,registerBrowser:()=>kt,replaceVariables:()=>ba,runTask:()=>Je,setWindowBounds:()=>ia,toolRegistry:()=>W,unregisterBrowser:()=>St});function Gp(e){let t=new Ro,i=new Set(e.sensitiveKeys||[]);if(e.variables)for(let[a,o]of Object.entries(e.variables))t.set(a,o,i.has(a));let n=zo({model:e.model,variableStore:t,testDataDir:e.testDataDir,downloadDir:e.downloadDir});return new jo(n)}var Kp,Vo=y(()=>{"use strict";Xr();Qr();is();Rc();Wc();Bc();Do();Po();Lo();$o();Zc();id();ad();od();Oo();gd();ei();bn();fn();qi();ct();sn();cn();ot();ln();hn();Ut();Gt();Te();Ot();Bt();$n();Ve();zt();Xt();ht();Yt();Jt();va();ie();Uo();Bo();Tt();_a();Ie();_t();Ee();Ht();rt();Wt();ze();Ko();Mo();_n();kn();Sn();En();Tn();An();Mn();In();Cn();Ln();Dn();ti();ii();ni();ai();ri();li();ci();ui();hi();mi();pi();gi();fi();bi();yi();xi();vi();ki();Si();Ti();Ai();Mi();Ii();Ci();Pi();$i();Zt();Li();zn();di();j();je();F();te();pt();Yn();H();fd();pe();Kp="1.0.0"});var A,Yo,Ta,Jo,Qe,qo,Zo,Qo,ne,er,Bi,Aa,tr=y(()=>{"use strict";A=require("zod"),Yo=A.z.enum(["JS_CODE","AI_MODE"]),Ta=A.z.object({type:Yo,expression:A.z.string()}),Jo=A.z.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),Qe=A.z.object({uid:A.z.string(),type:Jo,comment:A.z.string().optional()}),qo=A.z.object({action_data:A.z.object({action_name:A.z.string(),kwargs:A.z.record(A.z.any()).optional(),args:A.z.array(A.z.any()).optional()}),action_description:A.z.string().optional(),url:A.z.string().optional(),xpath:A.z.string().nullable().optional(),locator:A.z.string().nullable().optional(),css_selector:A.z.string().nullable().optional(),unique_selector:A.z.string().nullable().optional(),element_index:A.z.number().nullable().optional(),frame_path:A.z.array(A.z.any()).optional(),artifacts:A.z.record(A.z.any()).optional(),feedback:A.z.string().optional(),original_browser_use_action:A.z.any().optional()}).passthrough(),Zo=Qe.extend({type:A.z.literal("DRAFT"),description:A.z.string()}),Qo=Qe.extend({type:A.z.literal("ACTION"),description:A.z.string(),action_entity:qo.optional(),locator:A.z.string().optional(),use_pure_vision:A.z.boolean().optional()}),ne=A.z.lazy(()=>A.z.union([Zo,Qo,Qe.extend({type:A.z.literal("STEP"),description:A.z.string().optional().default(""),statements:A.z.array(ne),reference_id:A.z.number().optional(),template_path:A.z.string().optional(),template_params:A.z.record(A.z.string()).optional()}),Qe.extend({type:A.z.literal("IF_ELSE"),description:A.z.string().optional(),condition:Ta,then:A.z.array(ne),else:A.z.array(ne).optional()}),Qe.extend({type:A.z.literal("WHILE_LOOP"),description:A.z.string().optional(),condition:Ta,body:A.z.array(ne),timeout_ms:A.z.number().optional()})])),er=A.z.object({name:A.z.string(),statements:A.z.array(ne),teardown:A.z.array(ne).optional(),skip:A.z.union([A.z.boolean(),A.z.string()]).optional(),timeout:A.z.number().optional(),fail:A.z.union([A.z.boolean(),A.z.string()]).optional(),only:A.z.boolean().optional(),slow:A.z.boolean().optional()}),Bi=A.z.object({tests:A.z.array(er).min(1),beforeAll:A.z.array(ne).optional(),afterAll:A.z.array(ne).optional(),beforeEach:A.z.array(ne).optional(),afterEach:A.z.array(ne).optional()}),Aa=A.z.object({comment:A.z.string().optional(),version:A.z.string().optional(),goal:A.z.string().optional(),url:A.z.string().optional(),baseURL:A.z.string().optional(),final_feedback:A.z.string().optional(),completed:A.z.boolean().optional(),success:A.z.boolean().optional(),statements:A.z.array(ne).optional(),teardown:A.z.array(ne).optional(),last_modified_at:A.z.string().optional(),testGroup:Bi.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"})});function nr(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(le)};return e.final_feedback&&(i.final_feedback=e.final_feedback),e.teardown&&e.teardown.length>0&&(i.teardown=e.teardown.map(le)),i}function vd(e,t){if(e.testGroup)return ar(e,t);let i=nr(e,t),n=new L.Document(i);return e.comment&&(n.commentBefore=e.comment),bd(n,e.statements??[]),e.teardown&&bd(n,e.teardown,"teardown"),n.toString(Ct)}function bd(e,t,i="statements"){let n=e.contents;if(!n||!(0,L.isMap)(n))return;let a=n.get(i,!0);(0,L.isSeq)(a)&&Ui(a,t)}function Ui(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),(0,L.isMap)(a)){let o=a;if(n.type==="STEP"){let r=o.get("statements",!0);(0,L.isSeq)(r)&&Ui(r,n.statements)}else if(n.type==="IF_ELSE"){let r=o.get("THEN",!0);(0,L.isSeq)(r)&&Ui(r,n.then);let s=o.get("ELSE",!0);(0,L.isSeq)(s)&&n.else&&Ui(s,n.else)}else if(n.type==="WHILE_LOOP"){let r=o.get("DO",!0);(0,L.isSeq)(r)&&Ui(r,n.body)}}}}function ar(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(le)),i.beforeEach&&i.beforeEach.length>0&&(a.beforeEach=i.beforeEach.map(le)),i.afterEach&&i.afterEach.length>0&&(a.afterEach=i.afterEach.map(le)),i.afterAll&&i.afterAll.length>0&&(a.afterAll=i.afterAll.map(le)),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(le),o.teardown&&o.teardown.length>0&&(r.teardown=o.teardown.map(le)),r}),n.suite=a,(0,L.stringify)(n,Ct)}function _d(e){return e.map(t=>(0,L.stringify)(t,Ct)).join(`---
4533
- `)}function le(e){switch(e.type){case"DRAFT":return Xp(e);case"ACTION":return kd(e);case"STEP":return Jp(e);case"IF_ELSE":return qp(e);case"WHILE_LOOP":return Zp(e)}}function Xp(e){return{intent:e.description}}function kd(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 s=i?.statement;if(typeof s=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let l=i?.code;return typeof l=="string"?{VERIFY:s,js:l}:{VERIFY:s}}}if(t==="go_to_url"){let s=i?.url;if(typeof s=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let l={URL:s};return i?.new_tab===!0&&(l.new_tab=!0),typeof i?.timeout_seconds=="number"&&(l.timeout_seconds=i.timeout_seconds),l}}if(t==="js_action"){let s=i?.code;if(typeof s=="string"&&e.description)return{intent:e.description,js:s}}if(t==="ai_wait_until"){let s=i?.condition;if(typeof s=="string"){let l={WAIT_UNTIL:s};return typeof i?.timeout_seconds=="number"&&i.timeout_seconds!==60&&(l.timeout_seconds=i.timeout_seconds),l}}if(t==="wait"){let s=i?.seconds,d={WAIT:e.description||`Wait ${s}s`};return typeof s=="number"&&(d.seconds=s),d}if(t==="js_code"){let s=i?.code;if(typeof s=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath)return{CODE:s}}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[s,l]of Object.entries(n.kwargs))a[s]=l;return n.args&&n.args.length>0&&(a.args=n.args),a}function Sd(e,t,i){let n={uid:"",type:"ACTION",description:t||e.action_description||"",action_entity:e,locator:i},a=kd(n);if(typeof a=="object"&&a!==null){let o={...a};return delete o.intent,delete o.VERIFY,delete o.WAIT_UNTIL,delete o.WAIT,delete o.statement,Object.keys(o).length>0?(0,L.stringify)(o,Ct).trim():""}return(0,L.stringify)(a,Ct).trim()}function Ed(e){let t=(0,L.parse)(e);if(!t||typeof t!="object")throw new Error("Invalid YAML: expected an object");if("VERIFY"in t){let c=String(t.VERIFY),u=typeof t.js=="string"?t.js:void 0;return{description:c,actionEntity:{action_description:c,action_data:{action_name:"verify",kwargs:{statement:c,...u?{code:u}:{}}}}}}if("URL"in t){let c=String(t.URL),u={url:c};return t.new_tab===!0&&(u.new_tab=!0),typeof t.timeout_seconds=="number"&&(u.timeout_seconds=t.timeout_seconds),{description:`Navigate to ${c}`,actionEntity:{action_description:`Navigate to ${c}`,action_data:{action_name:"go_to_url",kwargs:u}}}}if("CODE"in t){let c=String(t.CODE);return{description:c,actionEntity:{action_description:c,action_data:{action_name:"js_code",kwargs:{code:c}}}}}if("WAIT_UNTIL"in t){let c=String(t.WAIT_UNTIL),u={condition:c};return typeof t.timeout_seconds=="number"&&(u.timeout_seconds=t.timeout_seconds),{description:`Wait until ${c}`,actionEntity:{action_description:`Wait until ${c}`,action_data:{action_name:"ai_wait_until",kwargs:u}}}}if("WAIT"in t){let c=String(t.WAIT),u={};return typeof t.seconds=="number"&&(u.seconds=t.seconds),{description:c,actionEntity:{action_description:c,action_data:{action_name:"wait",kwargs:u}}}}let i=typeof t.intent=="string"?t.intent:void 0,n=typeof t.action=="string"?t.action:void 0,a=typeof t.locator=="string"?t.locator:void 0,o=typeof t.xpath=="string"?t.xpath:void 0,r=Array.isArray(t.frame_path)?t.frame_path:void 0,s=Array.isArray(t.args)?t.args:void 0,l={};for(let[c,u]of Object.entries(t))Yp.has(c)||(l[c]=u);return!n&&t.js?{description:i,actionEntity:{action_description:i||"",action_data:{action_name:"js_action",kwargs:{code:t.js}}}}:n?{actionEntity:{action_description:i||"",action_data:{action_name:n,kwargs:l,...s&&s.length>0?{args:s}:{}},...a?{locator:a}:{},...o?{xpath:o}:{},...r?{frame_path:r}:{}},description:i,locator:a}:{description:i,actionEntity:{action_description:i||""}}}function Jp(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(le)};return e.reference_id!==void 0&&(t.reference_id=e.reference_id),t}function qp(e){let t={IF:Td(e.condition),THEN:e.then.map(le)};return e.else&&e.else.length>0&&(t.ELSE=e.else.map(le)),t}function Zp(e){let t={WHILE:Td(e.condition),DO:e.body.map(le)};return e.timeout_ms!==void 0&&(t.timeout_ms=e.timeout_ms),t}function Td(e){return e.type==="JS_CODE"?`js:${e.expression}`:e.expression}function Ad(e){let t=(0,L.parseAllDocuments)(e),i;if(t.length>1||t.length===1&&!Array.isArray(t[0]?.toJSON()))i=t.map((n,a)=>n.errors.length>0?{__parseError:`Document ${a+1}: ${n.errors[0].message}`}:n.toJSON());else{let n;try{n=(0,L.parse)(e)}catch(a){throw new Error(`Invalid YAML: ${a instanceof Error?a.message:String(a)}`)}if(!Array.isArray(n))throw new Error("Expected a YAML array or multi-document YAML (separated by ---)");i=n}return i.map((n,a)=>{try{if(n&&typeof n=="object"&&"__parseError"in n)return{error:n.__parseError};if(!n||typeof n!="object")return{error:`Item ${a+1}: expected an object`};let o=n,r=typeof o.name=="string"&&o.name.trim()||void 0,s=typeof o.goal=="string"?o.goal.trim():"";if(!s)return{error:`Item ${a+1}: missing "goal" field`};if(Array.isArray(o.statements))try{let l=(0,L.stringify)(o,Ct),d=et(l);return{name:r,goal:d.goal??s,testFlow:d}}catch{}return{name:r,goal:s}}catch(o){return{error:`Item ${a+1}: ${o instanceof Error?o.message:String(o)}`}}})}function Md(e){try{let t=(0,L.parse)(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 ir(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(ir);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]=ir(o);return n}function et(e){if(e.length>yd)throw new Error(`YAML input too large (${e.length} bytes, max ${yd})`);let t=ir((0,L.parse)(e));if(!t||typeof t!="object")throw new Error("Invalid YAML: expected an object at root level");if(t.suite)return Qp(t);let i={version:"1.3.0",goal:t.goal,url:t.url,baseURL:t.base_url,statements:ce(t.statements??[])};t.final_feedback&&(i.final_feedback=t.final_feedback),t.teardown&&Array.isArray(t.teardown)&&(i.teardown=ce(t.teardown));let n=Aa.safeParse(i);if(!n.success)throw new Error(`Invalid TestFlow after YAML conversion: ${JSON.stringify(n.error.errors)}`);let a=n.data;return or(e,a),a}function Qp(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(s=>{if(!s.name)throw new Error('Each test in a suite must have a "name" field');if(!Array.isArray(s.statements)||s.statements.length===0)throw new Error(`Suite test "${s.name}" must have a non-empty "statements" array`);let l={name:s.name,statements:ce(s.statements)};return Array.isArray(s.teardown)&&s.teardown.length>0&&(l.teardown=ce(s.teardown)),s.skip!==void 0&&(l.skip=s.skip),typeof s.timeout=="number"&&(l.timeout=s.timeout),s.fail!==void 0&&(l.fail=s.fail),s.only===!0&&(l.only=!0),s.slow===!0&&(l.slow=!0),l})};Array.isArray(t.beforeAll)&&t.beforeAll.length>0&&(a.beforeAll=ce(t.beforeAll)),Array.isArray(t.afterAll)&&t.afterAll.length>0&&(a.afterAll=ce(t.afterAll)),Array.isArray(t.beforeEach)&&t.beforeEach.length>0&&(a.beforeEach=ce(t.beforeEach)),Array.isArray(t.afterEach)&&t.afterEach.length>0&&(a.afterEach=ce(t.afterEach));let o=Bi.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 ce(e){if(!Array.isArray(e))throw new Error("Expected an array of statements");return e.map(eg)}function eg(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 tg(t);if("WHILE"in t)return ig(t);if("STEP"in t)return ng(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:(0,se.v4)(),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:(0,se.v4)(),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:(0,se.v4)(),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:(0,se.v4)(),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:(0,se.v4)(),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:(0,se.v4)(),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 xd({...n,action:"function",functionName:i})}if("action"in t)return xd(t);if("intent"in t&&typeof t.intent=="string"||"desc"in t&&typeof t.desc=="string")return{uid:(0,se.v4)(),type:"DRAFT",description:typeof t.intent=="string"?t.intent:t.desc};throw new Error(`Cannot infer statement type from object: ${JSON.stringify(t)}`)}function Id(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 tg(e){let t=Id(e.IF),i=e.THEN;if(!Array.isArray(i))throw new Error("IF_ELSE requires a THEN array");let n={uid:(0,se.v4)(),type:"IF_ELSE",condition:t,then:ce(i)};return"ELSE"in e&&Array.isArray(e.ELSE)&&(n.else=ce(e.ELSE)),n}function ig(e){let t=Id(e.WHILE),i=e.DO;if(!Array.isArray(i))throw new Error("WHILE_LOOP requires a DO array");let n={uid:(0,se.v4)(),type:"WHILE_LOOP",condition:t,body:ce(i)};return typeof e.timeout_ms=="number"&&(n.timeout_ms=e.timeout_ms),n}function ng(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:(0,se.v4)(),type:"STEP",description:t,statements:ce(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 xd(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[d,c]of Object.entries(e))ag.has(d)||(r[d]=c);t==="verify"&&typeof r.js=="string"&&(r.code=r.js,delete r.js);let s={action_description:i,action_data:{action_name:t,kwargs:Object.keys(r).length>0?r:{}}};n&&(s.locator=n),a&&(s.xpath=a);let l={uid:(0,se.v4)(),type:"ACTION",description:i,action_entity:s};return o&&(l.use_pure_vision=!0),l}function or(e,t){let i;try{i=(0,L.parseDocument)(e)}catch{return}let n=i.contents;if(!n||!(0,L.isMap)(n))return;if(i.commentBefore)t.comment=i.commentBefore;else{let l=n.items?.[0];l?.key&&l.key.commentBefore&&(t.comment=l.key.commentBefore)}let a=n,o=a.get("statements",!0);(0,L.isSeq)(o)&&t.statements&&It(o,t.statements);let r=a.get("teardown",!0);(0,L.isSeq)(r)&&t.teardown&&It(r,t.teardown)}function It(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"&&(0,L.isMap)(n)){let o=n.get("statements",!0);(0,L.isSeq)(o)&&It(o,a.statements)}else if(a.type==="IF_ELSE"&&(0,L.isMap)(n)){let o=n.get("THEN",!0);(0,L.isSeq)(o)&&It(o,a.then);let r=n.get("ELSE",!0);(0,L.isSeq)(r)&&a.else&&It(r,a.else)}else if(a.type==="WHILE_LOOP"&&(0,L.isMap)(n)){let o=n.get("DO",!0);(0,L.isSeq)(o)&&It(o,a.body)}}}var L,se,Ct,Yp,yd,ag,Ma=y(()=>{"use strict";tr();L=require("yaml"),se=require("uuid");Ct={lineWidth:120,defaultKeyType:"PLAIN",defaultStringType:"PLAIN"};Yp=new Set(["intent","action","locator","xpath","frame_path","args"]);yd=1024*1024;ag=new Set(["action","intent","desc","locator","xpath","use_pure_vision"])});function rr(e,t){let i=[];t.version!=="1.0"&&i.push(`Unsupported patch version: ${t.version}`),(!Array.isArray(t.operations)||t.operations.length===0)&&i.push("Patch must have at least one operation");for(let n=0;n<t.operations.length;n++){let a=t.operations[n],o=`operations[${n}]`;switch(a.reason||i.push(`${o}: missing reason`),a.op){case"remove":{(typeof a.index!="number"||a.index<0||a.index>=e.length)&&i.push(`${o}: index ${a.index} out of bounds (0..${e.length-1})`);break}case"modify":{(typeof a.index!="number"||a.index<0||a.index>=e.length)&&i.push(`${o}: index ${a.index} out of bounds (0..${e.length-1})`),(a.statement===void 0||a.statement===null)&&i.push(`${o}: missing statement`);break}case"insert":{(typeof a.index!="number"||a.index<0||a.index>=e.length)&&i.push(`${o}: index ${a.index} out of bounds (0..${e.length-1})`),a.position!=="before"&&a.position!=="after"&&i.push(`${o}: position must be 'before' or 'after'`),(a.statement===void 0||a.statement===null)&&i.push(`${o}: missing statement`);break}default:i.push(`${o}: unknown operation type "${a.op}"`)}}return{valid:i.length===0,errors:i}}function sr(e,t){let i=rr(e,t);if(!i.valid)throw new Error(`Invalid patch: ${i.errors.join("; ")}`);let n=[...e],a=t.operations.map((s,l)=>({...s,originalOrder:l})),o={remove:0,modify:1,insert:2},r=[...a].sort((s,l)=>s.index!==l.index?l.index-s.index:o[s.op]-o[l.op]);for(let s of r)switch(s.op){case"remove":n.splice(s.index,1);break;case"modify":n[s.index]=s.statement;break;case"insert":s.position==="before"?n.splice(s.index,0,s.statement):n.splice(s.index+1,0,s.statement);break}return n}function Cd(e,t){let i=(0,Ia.parse)(e);if(!i||typeof i!="object")throw new Error("Invalid YAML: expected an object at root level");let n=i.statements;if(!Array.isArray(n))throw new Error('YAML must have a "statements" array');let a=sr(n,t);i.statements=a;let o=(0,Ia.stringify)(i,{lineWidth:120,defaultKeyType:"PLAIN",defaultStringType:"PLAIN"});return et(o),{modifiedYaml:o,modifiedStatements:a}}var Ia,Pd=y(()=>{"use strict";Ma();Ia=require("yaml")});function lr(e){for(let t of e){if(t.type==="STEP"){let n=t;if(n.reference_id||n.template_path)return!0}let i=Ce(t);for(let n of i)if(lr(n.statements))return!0}return!1}function Dd(e){let t=new Set;function i(n){for(let a of n){if(a.type==="STEP"){let r=a;r.reference_id&&t.add(r.reference_id)}let o=Ce(a);for(let r of o)i(r.statements)}}return i(e),Array.from(t)}function Rd(e){if(!e?.statements||!Array.isArray(e.statements))return{};let t={};return Be(e.statements,"main",t),e.teardown&&Array.isArray(e.teardown)&&Be(e.teardown,"teardown",t),t}function Re(e,t,i){let n=e+".",a=t.filter(([c])=>c===e||c.startsWith(n));if(a.length===0)return[];let o=[],r=new Set;for(let[c]of a){let u=c===e?"":c.slice(n.length);if(!u)continue;let m=u.split(".")[0];r.has(m)||r.add(m)}let s=Array.from(r);s.sort((c,u)=>{let m=/^\d+$/.test(c)?parseInt(c,10):-1,g=/^\d+$/.test(u)?parseInt(u,10):-1;return m>=0&&g>=0?m-g:c==="then"&&u==="else"?-1:c==="else"&&u==="then"||c==="body"?1:u==="body"?-1:c.localeCompare(u)});function l(c){return i[c]}function d(c){let u=c.match(/^(IF|WHILE)\s+([\s\S]+)$/);return{type:"AI_MODE",expression:(u?u[2].trim():c)||"true"}}for(let c of s){let u=e?`${e}.${c}`:c,m=l(u),g=m?.description??"",w=u;if(c==="then"){let _=`${e}.then`,k=`${e}.else`,E=Re(_,t,i),I=Re(k,t,i),C=l(e),$=C?d(C.description):{type:"JS_CODE",expression:"true"};o.push({uid:e,type:"IF_ELSE",condition:$,then:E,...I.length>0?{else:I}:{}});continue}if(c==="else")continue;if(c==="body"){let _=`${e}.body`,k=Re(_,t,i),E=l(e),I=E?d(E.description):{type:"JS_CODE",expression:"true"};o.push({uid:e,type:"WHILE_LOOP",condition:I,body:k});continue}let v=`${e}.${c}`,x=t.some(([_])=>_.startsWith(v+".then.")||_===v+".then"),p=t.some(([_])=>_.startsWith(v+".else.")||_===v+".else"),f=t.some(([_])=>_.startsWith(v+".body.")||_===v+".body"),S=t.filter(([_])=>{if(!_.startsWith(v+"."))return!1;let E=_.slice(v.length+1).split(".")[0];return/^\d+$/.test(E)&&E!=="then"&&E!=="else"&&E!=="body"});if(x||p){let _=v+".then",k=v+".else",E=Re(_,t,i),I=Re(k,t,i),C=m?d(g):{type:"JS_CODE",expression:"true"};o.push({uid:u,type:"IF_ELSE",condition:C,then:E,...I.length>0?{else:I}:{}})}else if(f){let _=v+".body",k=Re(_,t,i),E=m?d(g):{type:"JS_CODE",expression:"true"};o.push({uid:u,type:"WHILE_LOOP",condition:E,body:k})}else if(S.length>0){let _=Re(v,t,i);o.push({uid:u,type:"STEP",description:g||"Group",statements:_})}else o.push({uid:u,type:"ACTION",description:g||"Action",action_entity:m?.action_entity})}return o}function Fd(e){let t=Object.entries(e),i=n=>{let a=n+".";return t.some(([r])=>r===n||r.startsWith(a))?Re(n,t,e):[]};return{before:i("before"),main:i("main"),teardown:i("teardown"),after:i("after")}}var Ce,ae,Fe,He,We,Gi,$d,Ld,og,rg,Od,Nd,Be,Ca=y(()=>{"use strict";Ce=e=>{let t=[];switch(e.type){case"STEP":e.statements&&t.push({key:"statements",statements:e.statements});break;case"IF_ELSE":e.then&&t.push({key:"then",statements:e.then}),e.else&&t.push({key:"else",statements:e.else});break;case"WHILE_LOOP":e.body&&t.push({key:"body",statements:e.body});break}return t},ae=(e,t,i=void 0,n="root")=>{for(let a=0;a<e.length;a++){let o=e[a],r=o.uid;if(r===t)return{stableId:r,path:[a],statement:o,parent:i,containerKey:n,index:a};let s=Ce(o);for(let l of s){let d=ae(l.statements,t,o,l.key);if(d)return{...d,path:[a,l.key,...d.path]}}}return null},Fe=(e,t,i)=>{let n=ae(e,t);if(!n)return null;let{statement:a,parent:o,containerKey:r,index:s}=n,l=null;switch(a.type){case"DRAFT":case"ACTION":l=He(e,n)||We(e,n);break;case"STEP":if(a.statements&&a.statements.length>0)return a.statements[0];l=He(e,n)||We(e,n);break;case"IF_ELSE":if(i===!0&&a.then&&a.then.length>0)return a.then[0];if(i===!1&&a.else&&a.else.length>0)return a.else[0];l=He(e,n)||We(e,n);break;case"WHILE_LOOP":if(i===!0&&a.body&&a.body.length>0)return a.body[0];l=He(e,n)||We(e,n);break;default:l=He(e,n)||We(e,n);break}if(o&&o.type==="WHILE_LOOP"&&r==="body"){if(!l)return o;let d=ae(e,l.uid);if(!d||d.parent!==o)return o}return l},He=(e,t)=>{if(!t.parent)return e[t.index+1]||null;let n=Ce(t.parent).find(a=>a.key===t.containerKey);return n&&t.index+1<n.statements.length?n.statements[t.index+1]:null},We=(e,t)=>{if(!t.parent)return null;let i=t.parent.uid,n=ae(e,i);return n?He(e,n)||We(e,n):null},Gi=e=>{let t=[],i=n=>{for(let a of n){t.push(a);let o=Ce(a);for(let r of o)i(r.statements)}};return i(e),t},$d=e=>{switch(e.type){case"DRAFT":case"ACTION":return!0;case"STEP":return!0;case"IF_ELSE":case"WHILE_LOOP":return!0;default:return!1}},Ld=(e,t,i)=>{if(!ae(e,t))return null;if(i===null){let s=[],l=t;for(;l!==null&&ae(e,l);)if(s.push(l),l=Fe(e,l)?.uid||null,s.length>1e3)return null;return s}if(!ae(e,i))return null;if(t===i)return[];let o=[],r=t;for(;r&&r!==i;){let s=ae(e,r);if(!s)break;if(o.push(r),s.statement.type==="IF_ELSE"){let l=og(s.statement,i);l?r=Fe(e,r,l==="then")?.uid||null:r=Fe(e,r)?.uid||null}else s.statement.type==="WHILE_LOOP"?rg(s.statement,i)?r=Fe(e,r,!0)?.uid||null:r=Fe(e,r,!1)?.uid||null:r=Fe(e,r)?.uid||null;if(o.length>1e3)return null}return r===i?o:null},og=(e,t)=>{if(e.type!=="IF_ELSE")return null;let i=e;return i.then&&ae(i.then,t)?"then":i.else&&ae(i.else,t)?"else":null},rg=(e,t)=>{if(e.type!=="WHILE_LOOP")return!1;let i=e;return!!(i.body&&ae(i.body,t))};Od=e=>e.startsWith("ai_")?!0:["js_code","function","assert","verify","wait_for_download_complete","extract_activation_code","extract_email_content"].includes(e),Nd=e=>!["js_code","function","assert","ai_assert","verify","ai_extract","ai_wait_until","upload_file","login","extract_activation_code","extract_email_content","ai_step"].includes(e),Be=(e,t,i)=>{e.forEach((n,a)=>{let o=`${t}.${a}`;n.type==="DRAFT"?i[o]={description:n.description||"Draft",action_entity:void 0}:n.type==="ACTION"?i[o]={description:n.description||"Action",action_entity:n.action_entity,locator:n.locator}:n.type==="STEP"&&n.statements?Be(n.statements,o,i):n.type==="IF_ELSE"?(i[o]={description:"IF "+(n.condition?.expression||""),action_entity:void 0},n.then&&Be(n.then,`${o}.then`,i),n.else&&Be(n.else,`${o}.else`,i)):n.type==="WHILE_LOOP"&&(i[o]={description:"WHILE "+(n.condition?.expression||""),action_entity:void 0},n.body&&Be(n.body,`${o}.body`,i))})}});function dr(e){let t=0,i=0;for(let n of e)if(n.type==="DRAFT")i++;else if(n.type==="ACTION"){let a=n.action_entity?.action_data?.action_name??"";cr.has(a)||t++}return{action:t,draft:i}}function lg(e){try{return new Function(`return async function() { ${e} }`),null}catch(t){return t.message}}function Bd(e){try{return new Function(`return async function() { return (${e}) }`),null}catch(t){return t.message}}function cg(e){let t=e.split(/\r?\n/).map(a=>a.trim()).filter(a=>a.length>0&&!a.startsWith("//")).length,i=e.match(/\bawait\b/g),n=i?i.length:0;return t<=Hd&&n<=Wd?null:`${t} non-blank line(s), ${n} await(s) \u2014 limits are ${Hd} lines and ${Wd} awaits. The js: field is a cache for one natural-language intent, not a place for multi-step logic. Break this into multiple statements \u2014 one VERIFY or intent+js per UI interaction or assertion \u2014 so each step is visible in the debugger and self-healable.`}function Ud(e,t){let i=t?.coverageThreshold??sg,n=[],a=[],o;try{o=et(e)}catch(m){return{valid:!1,errors:[`Invalid YAML: ${m.message}`],warnings:[],stats:{total:0,action:0,draft:0,coverage:0}}}o.goal||n.push('Missing required field: "goal"'),o.statements?.length||n.push('Missing required field: "statements"');let r=[...Gi(o.statements??[]),...o.teardown?Gi(o.teardown):[]],{action:s,draft:l}=dr(r),d="Hint: in YAML double-quoted strings, backslashes are escape characters \u2014 use \\\\/ instead of \\/ for regex, or use single quotes.";for(let m of r){let g=m;if(g.reference_id!==void 0){let w=g.description||m.uid;n.push(`Unresolved cloud template reference on statement "${w}" (reference_id: ${g.reference_id}). Local YAML tests cannot use reference_id \u2014 inline the template statements or use the local "template:" key instead.`)}if(m.type==="ACTION"){let w=m,v=w.action_entity?.action_data?.action_name??"";if(v==="js_code"||v==="js_action"||v==="verify"||v==="ai_assert"){let x=w.action_entity?.action_data?.kwargs?.code;if(typeof x=="string"){let p=lg(x);if(p){let f=w.description||v;n.push(`Invalid JS in "${f}": ${p}. ${d}`)}else if(v==="verify"||v==="js_action"){let f=cg(x);if(f){let S=w.description||v;n.push(`JS cache for "${S}" is too complex: ${f}`)}}}}}if(m.type==="IF_ELSE"){let w=m;if(w.condition.type==="JS_CODE"){let v=Bd(w.condition.expression);v&&n.push(`Invalid JS in IF condition "${w.condition.expression}": ${v}. ${d}`)}}if(m.type==="WHILE_LOOP"){let w=m;if(w.condition.type==="JS_CODE"){let v=Bd(w.condition.expression);v&&n.push(`Invalid JS in WHILE condition "${w.condition.expression}": ${v}. ${d}`)}}}let c=s+l,u=c>0?Math.round(s/c*100):0;return c>0&&u/100<i&&a.push(`Low action coverage: ${s}/${c} statements (${u}%) are enriched with action/js. ${l} draft statement(s) still need enrichment. Use MCP tools (act, get_locators) to convert drafts to actions.`),{valid:n.length===0,errors:n,warnings:a,stats:{total:c,action:s,draft:l,coverage:u}}}var sg,Hd,Wd,cr,Gd=y(()=>{"use strict";Ma();Ca();sg=.5,Hd=5,Wd=3,cr=new Set(["verify","ai_assert","done","go_to_url","ai_wait_until","wait","js_code"])});function Kd(){return{version:"1.0",entries:{}}}function jd(e,t){return{action_entity:e,updated_at:new Date().toISOString(),updated_by:{source:"runner",test_run_id:t}}}function zd(e,t){let i=t?.entries[e.uid],n=i?.action_entity??e.action_entity;return e.locator&&n?{...n,locator:e.locator}:i?i.action_entity:e.action_entity?e.action_entity:null}function Vd(e,t,i,n){return e.entries[t]={action_entity:i,updated_at:new Date().toISOString(),updated_by:n},e}function Xd(e,t){let i=e??{version:"1.0",entries:{}};for(let[n,a]of t)i.entries[n]=a;return i}function Yd(e){return e?Object.keys(e.entries).length===0:!0}function Jd(e){return e?Object.keys(e.entries).length:0}function qd(e,t){if(!t||Object.keys(t.entries).length===0)return e;let i=ur(e.statements??[],t),n=e.teardown?ur(e.teardown,t):void 0;return{...e,statements:i,teardown:n}}function ur(e,t){return e.map(i=>dg(i,t))}function dg(e,t){if(e.type==="ACTION"){let a=e,o=t.entries[a.uid];return o?{...a,action_entity:o.action_entity}:a}let i=Ce(e);if(i.length===0)return e;let n={};for(let a of i)n[a.key]=ur(a.statements,t);return{...e,...n}}var Zd=y(()=>{"use strict";Ca()});function mr(e){let t=e.match(/\.getByRole\(['"]([^'"]+)['"]/);if(t&&t[1]){let p=e.match(/\.filter\(\{\s*hasText:\s*['"]([^'"]*(?:\\.[^'"]*)*)['"]\s*\}\)/);if(p&&p[1]){let S=p[1].replace(/\\(.)/g,"$1");return`${t[1]} element with text "${S}"`}let f=e.match(/\.filter\(\{\s*hasText:\s*(\/.*?\/[gimuy]*)\s*\}\)/);if(f&&f[1]){let S=f[1].replace(/^\/|\/$/g,""),_=S.length>30?`${S.substring(0,27)}...`:S;return`${t[1]} element with text matching "${_}"`}return`${t[1]} element`}let i=e.match(/\.filter\(\{\s*hasText:\s*['"]([^'"]*(?:\\.[^'"]*)*)['"]\s*\}\)/);if(i&&i[1]){let p=Pt(e),f=i[1].replace(/\\(.)/g,"$1");return`${p} with text "${f}"`}let n=e.match(/\.filter\(\{\s*hasText:\s*(\/.*?\/[gimuy]*)\s*\}\)/);if(n&&n[1])return`${Pt(e)} with text matching ${n[1]}`;let a=e.match(/\.filter\(\{\s*has:\s*[^}]+getByText\('((?:[^'\\]|\\.)*)'(?:,\s*\{[^}]*\})?\)/);if(a&&a[1]){let p=Pt(e),f=a[1].replace(/\\(.)/g,"$1");return`${p} containing "${f}"`}let o=e.match(/\.filter\(\{\s*has:\s*[^}]+getByText\("((?:[^"\\]|\\.)*)"(?:,\s*\{[^}]*\})?\)/);if(o&&o[1]){let p=Pt(e),f=o[1].replace(/\\(.)/g,"$1");return`${p} containing "${f}"`}let r=e.match(/\.filter\(\{\s*hasNot:\s*[^}]+getByText\('((?:[^'\\]|\\.)*)'(?:,\s*\{[^}]*\})?\)/);if(r&&r[1]){let p=Pt(e),f=r[1].replace(/\\(.)/g,"$1");return`${p} not containing "${f}"`}let s=e.match(/\.filter\(\{\s*hasNot:\s*[^}]+getByText\("((?:[^"\\]|\\.)*)"(?:,\s*\{[^}]*\})?\)/);if(s&&s[1]){let p=Pt(e),f=s[1].replace(/\\(.)/g,"$1");return`${p} not containing "${f}"`}let l=e.match(/name:\s*'((?:[^'\\]|\\.)*)'/);if(l&&l[1])return`"${l[1].replace(/\\(.)/g,"$1")}"`;let d=e.match(/name:\s*"((?:[^"\\]|\\.)*)"/);if(d&&d[1])return`"${d[1].replace(/\\(.)/g,"$1")}"`;let c=e.match(/getByText\('((?:[^'\\]|\\.)*)'(?:,\s*\{[^}]*\})?\)/);if(c&&c[1])return`"${c[1].replace(/\\(.)/g,"$1")}"`;let u=e.match(/getByText\("((?:[^"\\]|\\.)*)"(?:,\s*\{[^}]*\})?\)/);if(u&&u[1])return`"${u[1].replace(/\\(.)/g,"$1")}"`;let m=e.match(/getByPlaceholder\('((?:[^'\\]|\\.)*)'(?:,\s*\{[^}]*\})?\)/);if(m&&m[1])return`input with placeholder "${m[1].replace(/\\(.)/g,"$1")}"`;let g=e.match(/getByPlaceholder\("((?:[^"\\]|\\.)*)"(?:,\s*\{[^}]*\})?\)/);if(g&&g[1])return`input with placeholder "${g[1].replace(/\\(.)/g,"$1")}"`;let w=e.match(/getByLabel\('((?:[^'\\]|\\.)*)'(?:,\s*\{[^}]*\})?\)/);if(w&&w[1])return`"${w[1].replace(/\\(.)/g,"$1")}"`;let v=e.match(/getByLabel\("((?:[^"\\]|\\.)*)"(?:,\s*\{[^}]*\})?\)/);if(v&&v[1])return`"${v[1].replace(/\\(.)/g,"$1")}"`;let x=e.match(/getByRole\(['"]([^'"]+)['"]/);return x&&x[1]?`${x[1]} element`:e.length>50?`${e.substring(0,47)}...`:e}function pr(e,t){if(!e||!t)return null;let i=t.replace(/^ref=/,""),n=e.split(`
4534
- `);for(let a of n){if(!a.includes(`[ref=${i}]`))continue;let s=a.replace(/\s+\[[^\]]+\](?:\s*\[[^\]]+\])*.*$/,"").trim().replace(/^[-–—]\s*/,"").trim().replace(/\\"/g,'"');return s.length>0?s:null}return null}function gr(e,t=""){let i=e.match(/page\d*\.(.+?)\.(click|fill|press|check|uncheck|hover|selectOption|dragTo|dblclick|screenshot|setInputFiles|locator|frameLocator)/);if(i&&i[1])return i[1].trim();let n=e.match(/page\d*\.locator\(([^)]+)\)/);if(n&&n[1])return`locator(${n[1]})`;let a=e.match(/page\d*\.frameLocator\(([^)]+)\)/);return a&&a[1]?`frameLocator(${a[1]})`:t}function Pt(e){let t=e.match(/^locator\(['"]([^'"]+)['"]\)/);if(t&&t[1]){let a=t[1],o=a.match(/^([a-zA-Z][\w-]*)/);return o?o[1]:a.length>20?`${a.substring(0,17)}...`:a}let i=e.match(/getByRole\(['"]([^'"]+)['"]/);if(i&&i[1])return i[1];let n=e.match(/getByTestId\(['"]([^'"]+)['"]/);return n&&n[1]?`element with testId "${n[1]}"`:"element"}function hr(e){let t=e.match(/\.fill\(['"]([^'"]*)['"]\)/);if(t&&t[1]!==void 0)return t[1];let i=e.match(/\.press\(['"]([^'"]+)['"]\)/);if(i&&i[1])return i[1];let n=e.match(/\.selectOption\(['"]([^'"]+)['"]\)/);return n&&n[1]?n[1]:""}function ug(e){let t=e.match(/button:\s*['"]([^'"]+)['"]/);return t?t[1]:void 0}function hg(e){let t=e.match(/modifiers:\s*\[([^\]]+)\]/);if(t&&t[1])return t[1].split(",").map(i=>i.trim().replace(/['"]/g,""))}function tu(e,t){let i=e.name||"unknown",n=gr(t,e.selector||""),a=e.ariaSnapshot??e.arIAaSnapshot??"",o=e.ref,r=/getByTestId\s*\(/.test(n),l=(o&&a&&r?pr(a,o):null)??mr(n),d,c,u={};switch(i){case"click":{let m=ug(t),g=hg(t);m==="right"?(d="right_click_on_element",c=`Right click on ${l}`):(d="click_element",c=`Click on ${l}`),u={index:0},m&&m!=="left"&&(u.button=m),g&&(u.modifiers=g);break}case"fill":{let m=e.text||e.value||hr(t)||"";d="fill",c=m?`Fill ${l} with '${m}'`:`Fill ${l}`,u={value:m,index:0};break}case"press":{let m=e.key||hr(t)||"";d="press",c=`Press '${m}' on ${l}`,u={keyComb:m,index:0};break}case"selectOption":{let m=e.options?.[0]||hr(t)||"";d="select_dropdown_option",c=`Select '${m}' from ${l}`,u={text:m,index:0};break}case"check":d="click_element",c=`Check ${l}`,u={index:0};break;case"uncheck":d="click_element",c=`Uncheck ${l}`,u={index:0};break;case"setInputFiles":{let m=e.files||[];d="upload_file",c=m.length>0?`Upload file(s) to ${l}`:`Upload file to ${l}`,u={paths:m,index:0};break}case"navigate":case"goto":d="go_to_url",c=`Navigate to ${e.url||"URL"}`,u={url:e.url||"",new_tab:!1};break;case"dblclick":d="double_click_on_element",c=`Double click on ${l}`,u={index:0};break;case"hover":d="hover",c=`Hover over ${l}`,u={index:0};break;case"wheel":case"scroll":d="scroll",c=`Scroll on ${l}`,u={x:e.deltaX||0,y:e.deltaY||0,index:e.selector?0:-1};break;case"dragTo":d="drag_drop",c=`Drag ${l} to target`,u={index:0};break;case"screenshot":d="wait",c="Take screenshot",u={seconds:.5};break;case"wait":d="wait",c=`Wait for ${e.timeout||1e3}ms`,u={seconds:(e.timeout||1e3)/1e3};break;default:d="click_element",c=`${i} on ${l}`,u={index:0};break}return{locator:n,xpath:e.xpath||"",css_selector:e.css_selector||"",unique_selector:e.selector||e.css_selector||"",frame_path:e.frame_path||[],action_data:{action_name:d,args:[],kwargs:u},action_description:c,url:"",feedback:""}}var Qd,eu,iu=y(()=>{"use strict";Qd=require("uuid"),eu=()=>(0,Qd.v4)()});var fr,wr,nu,au=y(()=>{"use strict";fr=(e=>(e.DRAFT="DRAFT",e.STEP="STEP",e.ACTION="ACTION",e.IF_ELSE="IF_ELSE",e.WHILE_LOOP="WHILE_LOOP",e))(fr||{}),wr=(e=>(e.JS_CODE="JS_CODE",e.AI_MODE="AI_MODE",e))(wr||{}),nu=18e4});function ou(e){return e?e.startsWith(he)?"android":e.startsWith(me)?"ios":"web":"web"}function ru(e){return e?e.startsWith(he)||e.startsWith(me):!1}function su(e){return!!e&&e.startsWith(he)}function lu(e){return!!e&&e.startsWith(me)}function cu(e){return e.startsWith(he)?e.slice(he.length):e.startsWith(me)?e.slice(me.length):e}function du(e){return`${he}${e}`}function uu(e){return`${me}${e}`}function Pa(e){return e?e.startsWith("http://")||e.startsWith("https://"):!1}function hu(e){return e?!Pa(e):!1}function br(e){return e?Pa(e)?["web"]:["android","ios"]:["web","android","ios"]}function mu(e,t){if(!t)return!0;let i=br(t);return e==="desktop"||e==="mobile"?i.includes("web"):i.includes(e)}var he,me,$a=y(()=>{"use strict";he="android:",me="ios:"});function pu(e){return e.startsWith(me)?e:`${me}${e}`}function gu(e){let t=e.iosVersion?` (iOS ${e.iosVersion})`:"";return e.deviceType==="simulator"?`${e.name}${t} - Simulator`:`${e.name}${t}`}function fu(e){return!!(/^[0-9a-fA-F]{40}$/.test(e)||/^[0-9a-fA-F]{8}-[0-9a-fA-F]{16}$/.test(e))}var wu=y(()=>{"use strict";$a()});var yr,La,xr,vr,_r,kr,Sr,Er,Tr,Ar,tt,Mr,Ki,Ir,Cr,$t,bu,ji,yu,xu,Da,vu,_u,ku,Su,Eu=y(()=>{"use strict";yr="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36",La=112,xr=1920,vr=1080,_r=1920,kr=1080-La,Sr=1280,Er=720,Tr=500,Ar=500,tt="Desktop Chrome",Mr=(e=>(e.Chromium="chromium",e.Firefox="firefox",e.Webkit="webkit",e))(Mr||{}),Ki={"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"}},Ir=(e=>(e.Desktop="desktop",e.Mobile="mobile",e))(Ir||{}),Cr={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"]},$t=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),Cr[e].map(n=>Ki[n]).filter(n=>n.defaultBrowserType&&i.includes(n.defaultBrowserType))},bu=()=>Object.keys(Ki),ji=e=>Ki[e],yu={desktop:{label:"Desktop",type:"desktop",devices:$t("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:$t("mobile")}},xu={desktop:{label:"Desktop",type:"desktop",devices:$t("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:$t("mobile",!0)}},Da=(e,t=!1)=>{let i={userAgent:yr,viewport:{width:_r,height:kr},isMobile:!1,hasTouch:!1};if(!e||e===tt)return i;let n=ji(e);if(!n)return i;let{width:a,height:o}=n.viewport,r=Math.max(Tr/a,1),s=Math.max(Ar/o,1),l=Math.max(r,s),d={width:Math.round(a*l),height:Math.round(o*l)};return{userAgent:n.userAgent,viewport:t?d:n.viewport,isMobile:n.isMobile,hasTouch:n.hasTouch}},vu=e=>{let t={width:xr,height:vr};if(!e||e===tt)return t;let i=Da(e);return i.viewport?{width:i.viewport.width,height:i.viewport.height+La}:t},_u=e=>{let t={width:Sr,height:Er};if(!e||e===tt)return t;let i=Da(e);return i.viewport?{width:i.viewport.width,height:i.viewport.height}:t},ku=e=>!e||e===tt?void 0:ji(e)?.channel,Su=e=>!e||e===tt?"chromium":ji(e)?.defaultBrowserType??"chromium"});var Pr,$r,Tu=y(()=>{"use strict";Pr=(e=>(e.PASSWORD="password",e.OAUTH2="oauth2",e.SSO="sso",e.API="api",e))(Pr||{}),$r=(e=>(e.SMS="sms",e.EMAIL="email",e.TOTP="totp",e))($r||{})});function Au(e,t){if(!e||typeof e!="string")return e;let i=t instanceof Map?Object.fromEntries(t):t,n=o=>{let r=o.startsWith("$")?o.slice(1):o,s=i[r]??i[`$${r}`];return s!=null?String(s):void 0},a=e;return a=a.replace(/\{\{\s*\$?([^}]+?)\s*\}\}/g,(o,r)=>{let s=n(r.trim());return s!==void 0?s:o}),a=a.replace(/<secret>\$?([\w-]+)<\/secret>/g,(o,r)=>{let s=n(r);return s!==void 0?s:o}),a=a.replace(/\$\{([^}]+)\}/g,(o,r)=>{let s=n(r.trim());return s!==void 0?s:o}),a=a.replace(/\$([a-zA-Z_]\w*)/g,(o,r)=>{let s=n(r);return s!==void 0?s:o}),a}var Mu=y(()=>{"use strict"});var Iu,Cu=y(()=>{"use strict";Iu=class{version;goal;url;constructor(e,t){this.version=e,this.goal=t.goal,this.url=t.url}generatePrelude(){let e=`// version ${this.version}
4532
+ ${s}`);let l=this.agentServices.knowledgeRetriever,d=!1;this.agentServices.hasKnowledgeRetriever()&&l&&(b.log("Setting up login knowledge retriever..."),this.agentServices.setKnowledgeRetriever(async(v,x,p,f)=>await l(v,x,p,"login")),d=!0,b.log("Login knowledge retriever configured"));let c;try{if(c=await this.run(e,s,"login"),!c.success)return b.log("Level 3 FAILED: Agent login failed"),h.info("Login: Failed"),{success:!1,page:e}}finally{d&&l&&(this.agentServices.setKnowledgeRetriever(l),b.log("Restored original knowledge retriever"))}let u=await e.context().storageState(),m;if(a)b.log("Skipping validation locator generation (AI verification mode enabled)");else if(t.num_verification_exprs!==0)try{b.log("Generating validation locators for future login verification...");let v=await xa(e,t.site_url,{verification_hint:t.verification_hint,num_verification_exprs:t.num_verification_exprs},async(x,p)=>this.run(x,p),async x=>this.getDOMText(x));v?(m=v,b.log(`Generated ${m.length} validation locator(s): ${JSON.stringify(m)}`)):b.log("Failed to generate validation locators, login will still succeed")}catch(v){b.log(`Error generating validation locators: ${v.message}`)}else b.log("Skipping validation locator generation (num_verification_exprs=0)");b.log("Level 3 SUCCESS: Agent login succeeded"),h.info("Login: Agent login succeeded");let g=c.actions||[],w=g.length>0?g:i?.cached_actions;return{success:!0,page:e,storage_state:u,cached_actions:w,validation_exprs:m}}catch(l){return b.error(`Agent login failed: ${l.message}`),h.info("Login: Failed"),{success:!1,page:e}}}async executeCachedLogin(e,t,i){let n=(await Promise.resolve().then(()=>(xt(),yt))).default,a=new n;for(let o=0;o<t.length;o++){let r=t[o];b.log(`Executing cached action ${o+1}/${t.length}: ${r.action_description||r.action_data?.action_name}`);try{if(!r.action_data){b.log(`Action ${o+1} missing action_data, skipping`);continue}await a.execute(e,r,this.agentServices),await this.waitUntilStable(e,5e3)}catch(s){return b.error(`Cached action ${o+1} failed: ${s.message}`),{success:!1}}}return i?.aiVerificationStatement?(b.log("Verifying cached login result with AI verification statement"),await this.evaluate(e,i.aiVerificationStatement)?{success:!0}:{success:!1}):i?.validationExprs&&i.validationExprs.length>0?await Hi(e,i.validationExprs)?{success:!0}:{success:!1}:(b.log("Cached login cannot be verified: missing AI verification statement and validation expressions"),{success:!1})}getCompletedExecutionHistory(){if(!this.context.executionHistory||this.context.executionHistory.length===0)return[];let e=this.context.executionHistory[this.context.executionHistory.length-1];return!e[1]||e[1].trim()===""?this.context.executionHistory.slice(0,-1):this.context.executionHistory}addToExecutionHistory(e,t){this.context.executionHistory||(this.context.executionHistory=[]),this.context.executionHistory.push([e,t])}async createStepResult(e,t,i,n){if(this.context.stepTracking&&!this.context.stepTracking.results[t]){this.context.stepTracking.currentStepId=t,this.context.stepTracking.onStepChange&&this.context.stepTracking.onStepChange(t);try{e=this.agentServices.validatePage(e),await this.waitUntilStable(e);let a={description:i,startTime:Date.now(),artifacts:[],type:n,code:i};if(this.context.stepTracking.artifactsDir){let o=Q.join(this.context.stepTracking.artifactsDir,t.replace(/\./g,"-"));z.mkdirSync(o,{recursive:!0});let r=Q.join(o,"screenshot.png");e=this.agentServices.validatePage(e),await e.screenshot({type:"png",path:r}),a.screenshot=r}a.contextBefore=this.snapshotVariables(),this.context.stepTracking.results[t]=a}catch(a){h.warn(`createStepResult failed for step ${t}: ${a}`),this.context.stepTracking.results[t]={description:i,startTime:Date.now(),artifacts:[],contextBefore:this.snapshotVariables()}}}}snapshotVariables(){return Mt(this.context.variableStore.getAll(),this.context.variableStore.getAllSensitiveKeys())}saveDebugInfoToFiles(e,t,i,n=0){let a={};if(!this.context.stepTracking?.artifactsDir)return h.debug("[saveDebugInfoToFiles] No artifacts directory configured, skipping debug info save"),a;let o=Q.join(this.context.stepTracking.artifactsDir,e.replace(/\./g,"-"));try{if(z.mkdirSync(o,{recursive:!0}),t.systemPrompt){let r=Q.join(o,`system_prompt_${n}.txt`);z.writeFileSync(r,t.systemPrompt),a.system_prompt_path=r,h.debug(`[saveDebugInfoToFiles] Saved system prompt to: ${r}`)}if(t.userPrompt)if(typeof t.userPrompt=="string"){let r=Q.join(o,`user_prompt_${n}.txt`);z.writeFileSync(r,t.userPrompt),a.user_prompt_path=r,h.debug(`[saveDebugInfoToFiles] Saved user prompt to: ${r}`)}else{let r=t.userPrompt.map(d=>Array.isArray(d.content)?{...d,content:d.content.map(c=>c.type==="image"&&c.file?.startsWith("data:")?{...c,file:"[base64 image data stripped]"}:c)}:d),s=Q.join(o,`messages_${n}.json`),l={system:t.systemPrompt,messages:r};z.writeFileSync(s,JSON.stringify(l,null,2)),a.messages_path=s,h.debug(`[saveDebugInfoToFiles] Saved messages to: ${s}`)}if(t.rawLlmResponse){let r=i?i.replace(/[\/\\:]/g,"-"):"llm",s=Q.join(o,`${r}_response_${n}.txt`);z.writeFileSync(s,t.rawLlmResponse),a.response_path=s,h.debug(`[saveDebugInfoToFiles] Saved LLM response to: ${s}`)}if(t.screenshotWithSom){let r=Q.join(o,`screenshot_${n}.png`);z.writeFileSync(r,Buffer.from(t.screenshotWithSom,"base64")),a.screenshot_path=r,h.debug(`[saveDebugInfoToFiles] Saved SOM screenshot to: ${r}`)}if(t.reasoningContent){let r=Q.join(o,`reasoning_${n}.txt`);z.writeFileSync(r,t.reasoningContent),a.reasoning_path=r,h.debug(`[saveDebugInfoToFiles] Saved reasoning to: ${r}`)}h.debug(`[saveDebugInfoToFiles] Saved ${Object.keys(a).length} artifacts for step ${e}`)}catch(r){h.error(`[saveDebugInfoToFiles] Failed to save debug info for step ${e}:`,r)}return a}async updateStepResult(e,t,i,n,a){if(!this.context.stepTracking)return;let o=this.context.stepTracking.results[e];if(o){if(t&&(o.status=t,o.contextAfter=this.snapshotVariables(),this.context.stepTracking.currentStepId=void 0,this.context.stepTracking.onStepChange&&this.context.stepTracking.onStepChange(void 0)),i!==void 0&&(o.message=i),n&&o.artifacts.push(n),a){let r=a.tokenUsages?.[0]?.model,s=o.artifacts.length,l=this.saveDebugInfoToFiles(e,a,r,s);Object.keys(l).length>0&&o.artifacts.push(l)}o.duration=Date.now()-o.startTime,this.context.stepTracking.onStepComplete&&this.context.stepTracking.onStepComplete(e,o)}}async writeExecutionResults(e,t){try{if(await z.promises.mkdir(e,{recursive:!0}),this.context.stepTracking?.results&&Object.keys(this.context.stepTracking.results).length>0){let i=Q.join(e,"test-results.json");await z.promises.writeFile(i,JSON.stringify(this.context.stepTracking.results,null,2)),h.debug(`Test results written to: ${i}`)}if(t?.tokenUsages&&this.context.tokenUsages&&this.context.tokenUsages.length>0){let i=Q.join(e,"token-usages.json");await z.promises.writeFile(i,JSON.stringify(this.context.tokenUsages,null,2)),h.debug(`Token usages written to: ${i}`)}if(this.context.aiActionDetails&&this.context.aiActionDetails.length>0){let i=Q.join(e,"ai-actions.json");await z.promises.writeFile(i,JSON.stringify(this.context.aiActionDetails,null,2)),h.debug(`AI action details written to: ${i}`)}}catch(i){throw h.error("Failed to write execution results:",i),i}}}});function Up(){let e=new Date,t=new Intl.DateTimeFormat("en-US",{timeZone:"America/Los_Angeles",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(e),i=t.find(p=>p.type==="year").value,n=t.find(p=>p.type==="month").value,a=t.find(p=>p.type==="day").value,o=t.find(p=>p.type==="hour").value,r=t.find(p=>p.type==="minute").value,s=t.find(p=>p.type==="second").value,l=String(e.getMilliseconds()).padStart(3,"0"),d=`${i}-${n}-${a}T${o}:${r}:${s}.${l}`,c=e.toISOString().slice(0,-1),u=Date.parse(d+"Z"),m=Date.parse(c+"Z"),g=Math.round((m-u)/(1e3*60)),w=String(Math.floor(Math.abs(g)/60)).padStart(2,"0"),v=String(Math.abs(g)%60).padStart(2,"0"),x=g<=0?"+":"-";return`${i}-${n}-${a}T${o}:${r}:${s}.${l}${x}${w}:${v}`}function zo(e){let t=e.variableStore;return t.has("currentTime")||t.set("currentTime",Up()),{model:e.model,computer_use_model:e.computer_use_model,variableStore:t,organizationId:e.organizationId,organizationSettings:e.organizationSettings,executionHistory:e.executionHistory||[],testDataDir:e.testDataDir,downloadDir:e.downloadDir,useNativeGenerator:e.useNativeGenerator,autoDismissModal:e.autoDismissModal,tokenUsages:[],aiActionDetails:[]}}var fd=y(()=>{"use strict"});var wd={};Ke(wd,{ActionHandler:()=>Jn,ActionHelper:()=>Di,Agent:()=>jo,AgentServices:()=>Sa,AgentStepEventTypes:()=>Go,AgentTaskFailedError:()=>Ea,BrowserManager:()=>qc,DEFAULT_EVENT_LISTENER_LIMIT:()=>xn,DomService:()=>ue,EVENT_LISTENER_CANDIDATE_SELECTORS:()=>yn,HistoryTreeProcessor:()=>tl,INIT_SCRIPT:()=>Oe,INTERACTION_EVENT_TYPES:()=>ut,INTERACTIVE_ROLES:()=>Vt,LogLevel:()=>ro,LoginType:()=>Ri,MCPToolProvider:()=>Fc,OpenAIToolProvider:()=>Ji,SDK_VERSION:()=>Kp,ToolRegistry:()=>dt,TwoFactorAuthType:()=>No,VariableStore:()=>Ro,WebAgent:()=>jo,configureSdk:()=>Yr,createAgent:()=>Gp,createAgentContext:()=>zo,createToolRegistry:()=>Dc,createToolRegistryWithCapabilities:()=>Oc,discoverChromiumCdpUrl:()=>ya,ensureToolsRegistered:()=>$c,evaluateStatement:()=>Ye,executeStep:()=>Xe,exportMCPTools:()=>Hc,filterInteractionListeners:()=>Hs,generateActionStep:()=>wt,getActionEntityLocatorInfo:()=>N,getBrowserCdpUrl:()=>ta,getCapabilitySummary:()=>Nc,getFramePath:()=>io,getModel:()=>we,getPageInfo:()=>fc,getPageWsUrl:()=>gc,getPlatformFromDeviceName:()=>nd,getProviderOptions:()=>be,getSdkConfig:()=>U,getToolRegistry:()=>Lc,injectUserFunction:()=>Ua,isInteractionEventType:()=>Fs,isInteractiveRole:()=>Rs,loadKnowledgeMappings:()=>ts,loadKnowledges:()=>es,loadUserFunctions:()=>Zr,logger:()=>h,newBrowserContext:()=>pc,parseSSEStream:()=>Vr,parseSdkLogLevelFromEnv:()=>Jr,pickBestLocator:()=>Rt,pickBestLocatorForElement:()=>tn,pickBestLocators:()=>rs,registerBrowser:()=>kt,replaceVariables:()=>fa,runTask:()=>Je,setWindowBounds:()=>ia,toolRegistry:()=>W,unregisterBrowser:()=>St});function Gp(e){let t=new Ro,i=new Set(e.sensitiveKeys||[]);if(e.variables)for(let[a,o]of Object.entries(e.variables))t.set(a,o,i.has(a));let n=zo({model:e.model,variableStore:t,testDataDir:e.testDataDir,downloadDir:e.downloadDir});return new jo(n)}var Kp,Vo=y(()=>{"use strict";Xr();Qr();is();Rc();Wc();Bc();Do();Po();Lo();$o();Zc();id();ad();od();Oo();gd();ei();bn();fn();qi();ct();sn();cn();ot();ln();hn();Ut();Gt();Te();Ot();Bt();$n();Ve();zt();Xt();ht();Yt();Jt();va();ie();Uo();Bo();Tt();_a();Ie();_t();Ee();Ht();rt();Wt();ze();Ko();Mo();_n();kn();Sn();En();Tn();An();Mn();In();Cn();Ln();Dn();ti();ii();ni();ai();ri();li();ci();ui();hi();mi();pi();gi();fi();bi();yi();xi();vi();ki();Si();Ti();Ai();Mi();Ii();Ci();Pi();$i();Zt();Li();zn();di();j();je();F();te();pt();Yn();H();fd();pe();Kp="1.0.0"});var bd,yd=y(()=>{"use strict";bd=class{version;goal;url;constructor(e,t){this.version=e,this.goal=t.goal,this.url=t.url}generatePrelude(){let e=`// version ${this.version}
4535
4533
  `,t=this.goal,i=this.url;e+=`// Navigate to the specified URL
4536
4534
  const targetUrl = process.env.PLAYWRIGHT_STARTING_URL || '${i}';
4537
4535
  if (targetUrl !== null) {
@@ -4545,4 +4543,7 @@ await page.waitForTimeout(2000);
4545
4543
  `,e+=` // Goal:
4546
4544
  `;let n=t.trim().split(`
4547
4545
  `);for(let a of n)e+=` // ${a}
4548
- `;return e}generatePostlude(){return""}}});function Pu(e){if(!e)return"desktop";for(let t of mg)if(t.test(e))return"mobile";return"desktop"}var mg,$u=y(()=>{"use strict";mg=[/iphone/i,/ipad/i,/android/i,/pixel/i,/galaxy/i,/mobile/i,/nexus/i,/blackberry/i,/kindle/i]});var Lu,Ou=y(()=>{"use strict";Lu=class Du{data={};sensitive=new Set;get(t){return this.data[t]}set(t,i,n=!1){this.data[t]=i,n?this.sensitive.add(t):this.sensitive.has(t)&&this.sensitive.delete(t)}getAll(){return{...this.data}}isSensitive(t){return this.sensitive.has(t)}getAllSensitiveKeys(){return new Set(this.sensitive)}delete(t){return this.sensitive.delete(t),delete this.data[t]}clear(){this.data={},this.sensitive.clear()}has(t){return t in this.data}get size(){return Object.keys(this.data).length}merge(t){for(let[i,n]of Object.entries(t.getAll()))this.set(i,n,t.isSensitive(i))}toJSON(){return{data:{...this.data},sensitiveKeys:Array.from(this.sensitive)}}static fromJSON(t){let i=new Du;if(t.data){let n=new Set(t.sensitiveKeys||[]);for(let[a,o]of Object.entries(t.data))i.set(a,o,n.has(a))}return i}}});function Nu(e,t=pg()){return{copilot:e?.models?.copilot||t.COPILOT_MODEL||Ra,webagent:e?.models?.webagent||t.WEB_AGENT_MODEL||Nr,computer_use:e?.models?.computer_use||t.COMPUTER_USE_MODEL||Rr}}function Ru(e){if(e){if(e.WEB_AGENT_MODEL)return e.WEB_AGENT_MODEL;if(e.GOOGLE_API_KEY)return Oa;if(e.ANTHROPIC_API_KEY)return Lr;if(e.OPENAI_API_KEY)return Dr;if(e.SHIPLIGHT_API_TOKEN)return Ra}}function Fu(e){if(e){if(e.COMPUTER_USE_MODEL)return e.COMPUTER_USE_MODEL;if(e.GOOGLE_API_KEY)return Na;if(e.OPENAI_API_KEY)return Or}}var Lr,Oa,Dr,Na,Or,Ra,Nr,Rr,pg,Hu=y(()=>{"use strict";Lr="claude-haiku-4-5",Oa="gemini-3.1-flash-lite-preview",Dr="gpt-5.4-mini",Na="gemini-3-flash-preview",Or="gpt-5.4",Ra="claude-sonnet-4-6",Nr=Oa,Rr=Na,pg=()=>typeof process<"u"?process.env:{}});var Fr,Wu=y(()=>{"use strict";Fr=(e=>(e.INITIALIZING="initializing",e.READY="ready",e.PROCESSING="processing",e.STOPPING="stopping",e.WAITING_USER="waiting_user",e.COMPLETED="completed",e.FAILED="failed",e))(Fr||{})});function Bu(e){let t=e.trim();if(!t||t.startsWith("List of devices"))return null;let i=t.split(/\s+/);if(i.length<2)return null;let n=i[0],a=i[1],o="usb";return n.startsWith("emulator-")?o="emulator":n.includes(":")&&(o="wifi"),{id:n,state:a,connectionType:o}}function Uu(e){return e.startsWith(he)?e:`${he}${e}`}function Gu(e){return e.model?`${e.model} (${e.id})`:e.connectionType==="emulator"?`Android Emulator (${e.id})`:e.id}var Ku=y(()=>{"use strict";$a()});var Hr={};Ke(Hr,{ADDRESS_BAR_HEIGHT:()=>La,ANDROID_DEVICE_PREFIX:()=>he,ActionEntitySchema:()=>qo,ActionSchema:()=>Qo,AgentStatus:()=>Fr,BaseStatementSchema:()=>Qe,BrowserType:()=>Mr,ConditionSchema:()=>Ta,ConditionType:()=>wr,ConditionTypeSchema:()=>Yo,DEFAULT_ANTHROPIC_MODEL:()=>Lr,DEFAULT_COMPUTER_USE_MODEL:()=>Rr,DEFAULT_COPILOT_MODEL:()=>Ra,DEFAULT_DEVICE_NAME:()=>tt,DEFAULT_GEMINI_COMPUTER_USE_MODEL:()=>Na,DEFAULT_GOOGLE_MODEL:()=>Oa,DEFAULT_OPENAI_COMPUTER_USE_MODEL:()=>Or,DEFAULT_OPENAI_MODEL:()=>Dr,DEFAULT_WEBAGENT_MODEL:()=>Nr,DEFAULT_WHILE_LOOP_TIMEOUT_MS:()=>nu,DEVICE_CATEGORIES:()=>Cr,DeviceType:()=>Ir,DraftSchema:()=>Zo,IOS_DEVICE_PREFIX:()=>me,LoginType:()=>Pr,MIN_WINDOW_HEIGHT:()=>Ar,MIN_WINDOW_WIDTH:()=>Tr,NON_INTENT_ACTIONS:()=>cr,NodeJSCodeCommon:()=>Iu,PLAYWRIGHT_DEVICES:()=>Ki,RECORD_VIDEO_HEIGHT:()=>Er,RECORD_VIDEO_WIDTH:()=>Sr,StatementSchema:()=>ne,StatementType:()=>fr,StatementTypeSchema:()=>Jo,TestFlowSchema:()=>Aa,TestGroupEntrySchema:()=>er,TestGroupSchema:()=>Bi,TwoFactorAuthType:()=>$r,UI_DEVICE_CATEGORIES:()=>yu,UI_DEVICE_CATEGORIES_ELECTRON:()=>xu,USER_AGENT:()=>yr,VIEWPORT_HEIGHT:()=>kr,VIEWPORT_WIDTH:()=>_r,VariableStore:()=>Lu,WINDOW_HEIGHT:()=>vr,WINDOW_WIDTH:()=>xr,actionEntityToYaml:()=>Sd,actionStepsMapToTestFlowSections:()=>Fd,allowPureVisionAction:()=>Nd,applyPatchToYaml:()=>sr,applyPatchToYamlString:()=>Cd,collectActionSteps:()=>Be,convertPlaywrightActionToEntity:()=>tu,countIntentStatements:()=>dr,createAndroidDeviceName:()=>du,createEmptyStore:()=>Kd,createIOSDeviceName:()=>uu,createRunnerStoreEntry:()=>jd,extractActionStepsFromTestFlow:()=>Rd,extractAndAttachComments:()=>or,extractDeviceIdentifier:()=>cu,extractElementDescription:()=>mr,extractElementDescriptionFromAriaSnapshot:()=>pr,extractLocatorFromCode:()=>gr,extractYamlMetadata:()=>Md,findNextAfterContainer:()=>We,findNextSibling:()=>He,findNextStatement:()=>Fe,findPathBetweenStatements:()=>Ld,findStatementPathById:()=>ae,generateUid:()=>eu,getAllDeviceNames:()=>bu,getAllReferenceIds:()=>Dd,getAllStatementsInOrder:()=>Gi,getAndroidDeviceDisplayName:()=>Gu,getBrowserWindowSize:()=>vu,getCompatiblePlatforms:()=>br,getDeviceBrowserType:()=>Su,getDeviceByName:()=>ji,getDeviceChannel:()=>ku,getDeviceOptions:()=>Da,getDevicesByCategory:()=>$t,getIOSDeviceDisplayName:()=>gu,getLoginConfigPlatform:()=>Pu,getRecordVideoSize:()=>_u,getStatementContainers:()=>Ce,getStoreSize:()=>Jd,getTestPlatformFromDeviceName:()=>ou,hasReferenceIds:()=>lr,isAndroidDevice:()=>su,isAppPackage:()=>hu,isDynamicAction:()=>Od,isExecutableStatement:()=>$d,isIOSDevice:()=>lu,isNativeDevice:()=>ru,isPhysicalDeviceUDID:()=>fu,isPlatformCompatibleWithUrl:()=>mu,isStoreEmpty:()=>Yd,isWebUrl:()=>Pa,mergeActionEntitiesIntoTestFlow:()=>qd,mergeStoreUpdates:()=>Xd,parseAdbDeviceLine:()=>Bu,parseYamlArrayItems:()=>Ad,replaceVariables:()=>Au,resolveActionEntity:()=>zd,resolveComputerUseModelFromEnv:()=>Fu,resolveModels:()=>Nu,resolveWebAgentModelFromEnv:()=>Ru,suiteToYaml:()=>ar,testFlowToYaml:()=>vd,testFlowToYamlObject:()=>nr,toAndroidDeviceName:()=>Uu,toIOSDeviceName:()=>pu,updateStoreEntry:()=>Vd,validatePatch:()=>rr,validateTestYaml:()=>Ud,yamlObjectsToString:()=>_d,yamlToActionEntity:()=>Ed,yamlToTestFlow:()=>et});var Wr=y(()=>{"use strict";Pd();Gd();Ma();tr();Zd();iu();Ca();au();wu();Eu();Tu();Mu();Cu();$u();Ou();Hu();Wu();Ku();$a()});var wg={};Ke(wg,{SDK_ENV_ALLOWLIST:()=>Zu,buildSdkEnv:()=>Qu,createTestContext:()=>qu,expect:()=>Lt.expect,resolveAuthState:()=>Yu,test:()=>fg});module.exports=oh(wg);var Ue=R(require("path"),1),Xu=R(require("fs"),1),Lt=require("@playwright/test");var ee=R(require("fs"),1),nt=R(require("path"),1),Ha=require("crypto"),Wa=require("os");function Kr(e){return[`--disable-extensions-except=${e}`,`--load-extension=${e}`,"--no-first-run","--disable-default-apps"]}function jr(e){if(!ee.existsSync(e))return console.warn(`[fixture] extensionStorageState file not found: ${e}`),null;let t;try{t=JSON.parse(ee.readFileSync(e,"utf-8"))}catch(o){throw new Error(`[fixture] Failed to parse extensionStorageState at ${e}: ${o}`)}let i=t;if(!Array.isArray(i.cookies))return null;let n=(Date.now()+365*24*60*60*1e3)/1e3,a=i.cookies.filter(o=>o&&typeof o=="object"&&typeof o.name=="string"&&typeof o.domain=="string");return a.length<i.cookies.length&&console.warn(`[fixture] Skipped ${i.cookies.length-a.length} malformed cookies (missing name or domain)`),a.map(o=>({...o,expires:n}))}function zr(e){if(e){let i=nt.resolve(process.cwd(),e),n=nt.join((0,Wa.tmpdir)(),`ext-profile-${(0,Ha.randomUUID)()}`);if(ee.existsSync(i)){try{ee.cpSync(i,n,{recursive:!0})}catch(o){try{ee.rmSync(n,{recursive:!0,force:!0})}catch(r){console.warn("[fixture] Failed to clean up partial profile copy:",n,r)}throw new Error(`[fixture] Failed to copy extension profile from ${i}: ${o}`)}let a=nt.join(n,"SingletonLock");ee.existsSync(a)&&ee.rmSync(a,{force:!0})}else ee.mkdirSync(n,{recursive:!0});return n}let t=nt.join((0,Wa.tmpdir)(),`ext-profile-${(0,Ha.randomUUID)()}`);return ee.mkdirSync(t,{recursive:!0}),t}Vo();var jp=R(require("dotenv"),1),zp="__shiplightDotenvCache__";function Vp(){return globalThis[zp]}function Xo(){let e=Vp();return e===void 0?process.env:e}async function Yu(e){let i=await import(Ue.resolve(process.cwd(),e.auth)),n=i.login||i.default;if(typeof n!="function")throw new Error(`auth module "${e.auth}" must export a login(args) function that returns a storageState file path`);let a=await n(e.args||{});if(typeof a!="string")throw new Error(`auth module "${e.auth}" login() must return a storageState file path (got ${typeof a})`);return a}function ju(e){return!(!e||e==="off")}function Ju(e,t){return!e||e==="off"?!1:e==="on"?!0:e==="retain-on-failure"?t.status!==t.expectedStatus:e==="on-first-retry"?t.retry>0:typeof e=="object"&&e!==null&&"mode"in e?Ju(e.mode,t):!0}async function zu(e,t,i){let n=Ju(t,i);for(let a of e)try{if(n){let o=await a.path();await i.attach("video",{path:o,contentType:"video/webm"})}else await a.delete()}catch(o){console.warn("[fixture] Failed to process video:",o)}}var Fa;async function Vu(){return Fa||(Fa=await Promise.resolve().then(()=>(Vo(),wd)),Fa)}var gg=new Set(["get","set","getAll","has","__variableStore"]);function qu(e){let t={__variableStore:e,get(i){return e.get(i)},set(i,n,a=!1){e.set(i,n,a)},getAll(){return e.getAll()}};return new Proxy(t,{get(i,n,a){if(n in i)return Reflect.get(i,n,a);if(typeof n=="string")return i.get(n)},set(i,n,a){return typeof n!="string"||gg.has(n)?Reflect.set(i,n,a):(i.set(n,a),!0)},has(i,n){return n in i?!0:typeof n=="string"?e.has?.(n)??!1:!1}})}var Zu=["GOOGLE_API_KEY","ANTHROPIC_API_KEY","OPENAI_API_KEY","OPENAI_BASE_URL","ANTHROPIC_MODELS_USE_VERTEXAI","GOOGLE_GENAI_USE_VERTEXAI","GOOGLE_CLOUD_PROJECT","GOOGLE_CLOUD_LOCATION","MAILGUN_API_KEY","MAILGUN_DOMAIN","SHIPLIGHT_API_TOKEN","SHIPLIGHT_API_URL"];function Qu(e=Xo()){let t={};for(let i of Zu)t[i]=e[i]??"";return t}var fg=Lt.test.extend({account:[void 0,{option:!0}],autoDismissModal:[!1,{option:!0}],extensionDir:[void 0,{option:!0}],userDataDir:[void 0,{option:!0}],extensionStorageState:[void 0,{option:!0}],launchOptions:async({launchOptions:e},t)=>{if(!process.env.SHIPLIGHT_REGISTRY_URL){await t(e);return}let i=e?.args??[],n={...e,args:[...i,"--remote-debugging-port=0"]};await t(n)},browser:async({browser:e},t)=>{let i=null;if(process.env.SHIPLIGHT_REGISTRY_URL)try{let n=await ya(process.pid),a=process.env.TEST_WORKER_INDEX??"?";i=await kt({cdpUrl:n,label:`shiplight test w${a}`,pid:process.pid})}catch{}await t(e),await St(i)},context:async({browser:e,account:t,extensionDir:i,userDataDir:n,extensionStorageState:a},o,r)=>{if(i||n){if(t||r.project.use.auth)throw new Error('Cannot use both "extensionDir"/"userDataDir" and "auth" \u2014 persistent context tests manage their own context. Use extensionStorageState for authentication instead.');let l=r.project.use?.browserName;l&&l!=="chromium"&&console.warn(`[fixture] Persistent context requires Chromium but project is configured for "${l}". Forcing Chromium.`);let d=process.env.PLAYWRIGHT_HEADLESS==="true";i&&d&&console.warn("[fixture] PLAYWRIGHT_HEADLESS=true with extensionDir \u2014 Chrome extensions will not function in headless mode.");let c=zr(n),u=i?Kr(Ue.resolve(process.cwd(),i)):[],m={...r.project.use},{storageState:g,account:w,extensionDir:v,userDataDir:x,extensionStorageState:p,autoDismissModal:f,video:S,..._}=m,k=ju(S)?{dir:r.outputDir}:void 0,E;try{if(E=await Lt.chromium.launchPersistentContext(c,{..._,headless:d,args:u,viewport:_.viewport??{width:1280,height:720},...k?{recordVideo:k}:{}}),a){let I=Ue.resolve(process.cwd(),a),C=jr(I);C&&await E.addCookies(C)}await o(E)}finally{let I=E?.pages().map(C=>C.video()).filter(C=>C!==null)??[];if(await E?.close().catch(C=>{console.warn("[fixture] Failed to close persistent context:",C)}),await zu(I,S,r),!n)try{Xu.rmSync(c,{recursive:!0,force:!0})}catch(C){console.warn("[fixture] Failed to clean up temp profile dir:",c,C)}}}else{let l={...r.project.use},d=r.project.use,c=d.auth?{auth:d.auth,args:d.args}:t;if(c){if(!c.auth)throw new Error("Auth is declared but missing the script path. Provide auth in playwright.config.ts: use: { auth: './auth.login.ts' }");l.storageState=await Yu(c)}let u=l.video;ju(u)&&!l.recordVideo&&(l.recordVideo={dir:r.outputDir});let m=await e.newContext(l);m.addInitScript(Oe);try{await o(m)}finally{let g=m.pages().map(w=>w.video()).filter(w=>w!==null);await m.close(),await zu(g,u,r)}}},page:async({context:e},t)=>{let i=await e.newPage();await t(i)},testContext:async({},e,t)=>{let{VariableStore:i}=await Vu(),n=new i,a=t.project.use.variables;if(a)for(let[r,s]of Object.entries(a))typeof s=="string"?n.set(r,s,!1):s&&typeof s=="object"&&"value"in s&&n.set(r,s.value,s.sensitive===!0);let o=qu(n);global.testContext=o,global.$=o,global.ctx=o,await e(o),delete global.testContext,delete global.$,delete global.ctx},$:async({testContext:e},t)=>{await t(e)},ctx:async({testContext:e},t)=>{await t(e)},agent:async({page:e,testContext:t,autoDismissModal:i},n,a)=>{let{WebAgent:o,createAgentContext:r,configureSdk:s,parseSdkLogLevelFromEnv:l}=await Vu(),d=l();s({env:Qu(),...d!==void 0&&{logLevel:d}});let{resolveWebAgentModelFromEnv:c,resolveComputerUseModelFromEnv:u}=await Promise.resolve().then(()=>(Wr(),Hr)),m=Xo(),g=c(m);if(!g)throw new Error("No AI model configured. Set WEB_AGENT_MODEL, GOOGLE_API_KEY, ANTHROPIC_API_KEY, OPENAI_API_KEY, or SHIPLIGHT_API_TOKEN in your .env file (or in the runner environment for CI).");let w=u(m),v=t.__variableStore,x=r({model:g,computer_use_model:w,variableStore:v,autoDismissModal:i}),p=Ue.join(a.outputDir,"artifacts");x.stepTracking={results:{},artifactsDir:p};let f=new o(x),S=e.context();f.agentServices.setupPageTracking(S);for(let _ of S.pages())f.setupDownloadTracking(_),f.setupDialogHandling(_);S.on("page",_=>{f.setupDownloadTracking(_),f.setupDialogHandling(_)}),global.agent=f,await n(f),delete global.agent;try{let _=a.outputDir;await f.writeExecutionResults(_);let k=Ue.join(_,"test-results.json");await(await import("fs/promises")).stat(k).catch(()=>null)&&await a.attach("shiplight-results",{path:k,contentType:"application/json"})}catch(_){console.error("[Shiplight] Failed to attach step results:",_)}try{let _=f.getNewActionEntities();if(_.size>0&&a.status==="passed"){let{createEmptyStore:k,createRunnerStoreEntry:E}=await Promise.resolve().then(()=>(Wr(),Hr)),I=await import("fs/promises"),C=k();for(let[K,X]of _)C.entries[K]=E(X,0);let $=Ue.join(a.outputDir,"new-action-entities.json");await I.writeFile($,JSON.stringify(C,null,2)),await a.attach("shiplight-new-action-entities",{path:$,contentType:"application/json"}),console.log(`[Shiplight] ${_.size} healed action entit${_.size===1?"y":"ies"} saved`)}}catch(_){console.warn("[Shiplight] Failed to persist new action entities:",_)}}});0&&(module.exports={SDK_ENV_ALLOWLIST,buildSdkEnv,createTestContext,expect,resolveAuthState,test});
4546
+ `;return e}generatePostlude(){return""}}});function xd(e){if(!e)return"desktop";for(let t of Xp)if(t.test(e))return"mobile";return"desktop"}var Xp,vd=y(()=>{"use strict";Xp=[/iphone/i,/ipad/i,/android/i,/pixel/i,/galaxy/i,/mobile/i,/nexus/i,/blackberry/i,/kindle/i]});function _d(e,t){if(!e||typeof e!="string")return e;let i=t instanceof Map?Object.fromEntries(t):t,n=o=>{let r=o.startsWith("$")?o.slice(1):o,s=i[r]??i[`$${r}`];return s!=null?String(s):void 0},a=e;return a=a.replace(/\{\{\s*\$?([^}]+?)\s*\}\}/g,(o,r)=>{let s=n(r.trim());return s!==void 0?s:o}),a=a.replace(/<secret>\$?([\w-]+)<\/secret>/g,(o,r)=>{let s=n(r);return s!==void 0?s:o}),a=a.replace(/\$\{([^}]+)\}/g,(o,r)=>{let s=n(r.trim());return s!==void 0?s:o}),a=a.replace(/\$([a-zA-Z_]\w*)/g,(o,r)=>{let s=n(r);return s!==void 0?s:o}),a}var kd=y(()=>{"use strict"});function Jo(e){let t=e.match(/\.getByRole\(['"]([^'"]+)['"]/);if(t&&t[1]){let p=e.match(/\.filter\(\{\s*hasText:\s*['"]([^'"]*(?:\\.[^'"]*)*)['"]\s*\}\)/);if(p&&p[1]){let S=p[1].replace(/\\(.)/g,"$1");return`${t[1]} element with text "${S}"`}let f=e.match(/\.filter\(\{\s*hasText:\s*(\/.*?\/[gimuy]*)\s*\}\)/);if(f&&f[1]){let S=f[1].replace(/^\/|\/$/g,""),_=S.length>30?`${S.substring(0,27)}...`:S;return`${t[1]} element with text matching "${_}"`}return`${t[1]} element`}let i=e.match(/\.filter\(\{\s*hasText:\s*['"]([^'"]*(?:\\.[^'"]*)*)['"]\s*\}\)/);if(i&&i[1]){let p=It(e),f=i[1].replace(/\\(.)/g,"$1");return`${p} with text "${f}"`}let n=e.match(/\.filter\(\{\s*hasText:\s*(\/.*?\/[gimuy]*)\s*\}\)/);if(n&&n[1])return`${It(e)} with text matching ${n[1]}`;let a=e.match(/\.filter\(\{\s*has:\s*[^}]+getByText\('((?:[^'\\]|\\.)*)'(?:,\s*\{[^}]*\})?\)/);if(a&&a[1]){let p=It(e),f=a[1].replace(/\\(.)/g,"$1");return`${p} containing "${f}"`}let o=e.match(/\.filter\(\{\s*has:\s*[^}]+getByText\("((?:[^"\\]|\\.)*)"(?:,\s*\{[^}]*\})?\)/);if(o&&o[1]){let p=It(e),f=o[1].replace(/\\(.)/g,"$1");return`${p} containing "${f}"`}let r=e.match(/\.filter\(\{\s*hasNot:\s*[^}]+getByText\('((?:[^'\\]|\\.)*)'(?:,\s*\{[^}]*\})?\)/);if(r&&r[1]){let p=It(e),f=r[1].replace(/\\(.)/g,"$1");return`${p} not containing "${f}"`}let s=e.match(/\.filter\(\{\s*hasNot:\s*[^}]+getByText\("((?:[^"\\]|\\.)*)"(?:,\s*\{[^}]*\})?\)/);if(s&&s[1]){let p=It(e),f=s[1].replace(/\\(.)/g,"$1");return`${p} not containing "${f}"`}let l=e.match(/name:\s*'((?:[^'\\]|\\.)*)'/);if(l&&l[1])return`"${l[1].replace(/\\(.)/g,"$1")}"`;let d=e.match(/name:\s*"((?:[^"\\]|\\.)*)"/);if(d&&d[1])return`"${d[1].replace(/\\(.)/g,"$1")}"`;let c=e.match(/getByText\('((?:[^'\\]|\\.)*)'(?:,\s*\{[^}]*\})?\)/);if(c&&c[1])return`"${c[1].replace(/\\(.)/g,"$1")}"`;let u=e.match(/getByText\("((?:[^"\\]|\\.)*)"(?:,\s*\{[^}]*\})?\)/);if(u&&u[1])return`"${u[1].replace(/\\(.)/g,"$1")}"`;let m=e.match(/getByPlaceholder\('((?:[^'\\]|\\.)*)'(?:,\s*\{[^}]*\})?\)/);if(m&&m[1])return`input with placeholder "${m[1].replace(/\\(.)/g,"$1")}"`;let g=e.match(/getByPlaceholder\("((?:[^"\\]|\\.)*)"(?:,\s*\{[^}]*\})?\)/);if(g&&g[1])return`input with placeholder "${g[1].replace(/\\(.)/g,"$1")}"`;let w=e.match(/getByLabel\('((?:[^'\\]|\\.)*)'(?:,\s*\{[^}]*\})?\)/);if(w&&w[1])return`"${w[1].replace(/\\(.)/g,"$1")}"`;let v=e.match(/getByLabel\("((?:[^"\\]|\\.)*)"(?:,\s*\{[^}]*\})?\)/);if(v&&v[1])return`"${v[1].replace(/\\(.)/g,"$1")}"`;let x=e.match(/getByRole\(['"]([^'"]+)['"]/);return x&&x[1]?`${x[1]} element`:e.length>50?`${e.substring(0,47)}...`:e}function qo(e,t){if(!e||!t)return null;let i=t.replace(/^ref=/,""),n=e.split(`
4547
+ `);for(let a of n){if(!a.includes(`[ref=${i}]`))continue;let s=a.replace(/\s+\[[^\]]+\](?:\s*\[[^\]]+\])*.*$/,"").trim().replace(/^[-–—]\s*/,"").trim().replace(/\\"/g,'"');return s.length>0?s:null}return null}function Zo(e,t=""){let i=e.match(/page\d*\.(.+?)\.(click|fill|press|check|uncheck|hover|selectOption|dragTo|dblclick|screenshot|setInputFiles|locator|frameLocator)/);if(i&&i[1])return i[1].trim();let n=e.match(/page\d*\.locator\(([^)]+)\)/);if(n&&n[1])return`locator(${n[1]})`;let a=e.match(/page\d*\.frameLocator\(([^)]+)\)/);return a&&a[1]?`frameLocator(${a[1]})`:t}function It(e){let t=e.match(/^locator\(['"]([^'"]+)['"]\)/);if(t&&t[1]){let a=t[1],o=a.match(/^([a-zA-Z][\w-]*)/);return o?o[1]:a.length>20?`${a.substring(0,17)}...`:a}let i=e.match(/getByRole\(['"]([^'"]+)['"]/);if(i&&i[1])return i[1];let n=e.match(/getByTestId\(['"]([^'"]+)['"]/);return n&&n[1]?`element with testId "${n[1]}"`:"element"}function Yo(e){let t=e.match(/\.fill\(['"]([^'"]*)['"]\)/);if(t&&t[1]!==void 0)return t[1];let i=e.match(/\.press\(['"]([^'"]+)['"]\)/);if(i&&i[1])return i[1];let n=e.match(/\.selectOption\(['"]([^'"]+)['"]\)/);return n&&n[1]?n[1]:""}function Yp(e){let t=e.match(/button:\s*['"]([^'"]+)['"]/);return t?t[1]:void 0}function Jp(e){let t=e.match(/modifiers:\s*\[([^\]]+)\]/);if(t&&t[1])return t[1].split(",").map(i=>i.trim().replace(/['"]/g,""))}function Td(e,t){let i=e.name||"unknown",n=Zo(t,e.selector||""),a=e.ariaSnapshot??e.arIAaSnapshot??"",o=e.ref,r=/getByTestId\s*\(/.test(n),l=(o&&a&&r?qo(a,o):null)??Jo(n),d,c,u={};switch(i){case"click":{let m=Yp(t),g=Jp(t);m==="right"?(d="right_click_on_element",c=`Right click on ${l}`):(d="click_element",c=`Click on ${l}`),u={index:0},m&&m!=="left"&&(u.button=m),g&&(u.modifiers=g);break}case"fill":{let m=e.text||e.value||Yo(t)||"";d="fill",c=m?`Fill ${l} with '${m}'`:`Fill ${l}`,u={value:m,index:0};break}case"press":{let m=e.key||Yo(t)||"";d="press",c=`Press '${m}' on ${l}`,u={keyComb:m,index:0};break}case"selectOption":{let m=e.options?.[0]||Yo(t)||"";d="select_dropdown_option",c=`Select '${m}' from ${l}`,u={text:m,index:0};break}case"check":d="click_element",c=`Check ${l}`,u={index:0};break;case"uncheck":d="click_element",c=`Uncheck ${l}`,u={index:0};break;case"setInputFiles":{let m=e.files||[];d="upload_file",c=m.length>0?`Upload file(s) to ${l}`:`Upload file to ${l}`,u={paths:m,index:0};break}case"navigate":case"goto":d="go_to_url",c=`Navigate to ${e.url||"URL"}`,u={url:e.url||"",new_tab:!1};break;case"dblclick":d="double_click_on_element",c=`Double click on ${l}`,u={index:0};break;case"hover":d="hover",c=`Hover over ${l}`,u={index:0};break;case"wheel":case"scroll":d="scroll",c=`Scroll on ${l}`,u={x:e.deltaX||0,y:e.deltaY||0,index:e.selector?0:-1};break;case"dragTo":d="drag_drop",c=`Drag ${l} to target`,u={index:0};break;case"screenshot":d="wait",c="Take screenshot",u={seconds:.5};break;case"wait":d="wait",c=`Wait for ${e.timeout||1e3}ms`,u={seconds:(e.timeout||1e3)/1e3};break;default:d="click_element",c=`${i} on ${l}`,u={index:0};break}return{locator:n,xpath:e.xpath||"",css_selector:e.css_selector||"",unique_selector:e.selector||e.css_selector||"",frame_path:e.frame_path||[],action_data:{action_name:d,args:[],kwargs:u},action_description:c,url:"",feedback:""}}var Sd,Ed,Ad=y(()=>{"use strict";Sd=require("uuid"),Ed=()=>(0,Sd.v4)()});var A,Qo,Ta,er,Qe,tr,ir,nr,ne,ar,Bi,Aa,or=y(()=>{"use strict";A=require("zod"),Qo=A.z.enum(["JS_CODE","AI_MODE"]),Ta=A.z.object({type:Qo,expression:A.z.string()}),er=A.z.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),Qe=A.z.object({uid:A.z.string(),type:er,comment:A.z.string().optional()}),tr=A.z.object({action_data:A.z.object({action_name:A.z.string(),kwargs:A.z.record(A.z.any()).optional(),args:A.z.array(A.z.any()).optional()}),action_description:A.z.string().optional(),url:A.z.string().optional(),xpath:A.z.string().nullable().optional(),locator:A.z.string().nullable().optional(),css_selector:A.z.string().nullable().optional(),unique_selector:A.z.string().nullable().optional(),element_index:A.z.number().nullable().optional(),frame_path:A.z.array(A.z.any()).optional(),artifacts:A.z.record(A.z.any()).optional(),feedback:A.z.string().optional(),original_browser_use_action:A.z.any().optional()}).passthrough(),ir=Qe.extend({type:A.z.literal("DRAFT"),description:A.z.string()}),nr=Qe.extend({type:A.z.literal("ACTION"),description:A.z.string(),action_entity:tr.optional(),locator:A.z.string().optional(),use_pure_vision:A.z.boolean().optional()}),ne=A.z.lazy(()=>A.z.union([ir,nr,Qe.extend({type:A.z.literal("STEP"),description:A.z.string().optional().default(""),statements:A.z.array(ne),reference_id:A.z.number().optional(),template_path:A.z.string().optional(),template_params:A.z.record(A.z.string()).optional()}),Qe.extend({type:A.z.literal("IF_ELSE"),description:A.z.string().optional(),condition:Ta,then:A.z.array(ne),else:A.z.array(ne).optional()}),Qe.extend({type:A.z.literal("WHILE_LOOP"),description:A.z.string().optional(),condition:Ta,body:A.z.array(ne),timeout_ms:A.z.number().optional()})])),ar=A.z.object({name:A.z.string(),statements:A.z.array(ne),teardown:A.z.array(ne).optional(),skip:A.z.union([A.z.boolean(),A.z.string()]).optional(),timeout:A.z.number().optional(),fail:A.z.union([A.z.boolean(),A.z.string()]).optional(),only:A.z.boolean().optional(),slow:A.z.boolean().optional()}),Bi=A.z.object({tests:A.z.array(ar).min(1),beforeAll:A.z.array(ne).optional(),afterAll:A.z.array(ne).optional(),beforeEach:A.z.array(ne).optional(),afterEach:A.z.array(ne).optional()}),Aa=A.z.object({comment:A.z.string().optional(),version:A.z.string().optional(),goal:A.z.string().optional(),url:A.z.string().optional(),baseURL:A.z.string().optional(),final_feedback:A.z.string().optional(),completed:A.z.boolean().optional(),success:A.z.boolean().optional(),statements:A.z.array(ne).optional(),teardown:A.z.array(ne).optional(),last_modified_at:A.z.string().optional(),testGroup:Bi.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"})});function sr(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(le)};return e.final_feedback&&(i.final_feedback=e.final_feedback),e.teardown&&e.teardown.length>0&&(i.teardown=e.teardown.map(le)),i}function Pd(e,t){if(e.testGroup)return lr(e,t);let i=sr(e,t),n=new L.Document(i);return e.comment&&(n.commentBefore=e.comment),Md(n,e.statements??[]),e.teardown&&Md(n,e.teardown,"teardown"),n.toString(Pt)}function Md(e,t,i="statements"){let n=e.contents;if(!n||!(0,L.isMap)(n))return;let a=n.get(i,!0);(0,L.isSeq)(a)&&Ui(a,t)}function Ui(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),(0,L.isMap)(a)){let o=a;if(n.type==="STEP"){let r=o.get("statements",!0);(0,L.isSeq)(r)&&Ui(r,n.statements)}else if(n.type==="IF_ELSE"){let r=o.get("THEN",!0);(0,L.isSeq)(r)&&Ui(r,n.then);let s=o.get("ELSE",!0);(0,L.isSeq)(s)&&n.else&&Ui(s,n.else)}else if(n.type==="WHILE_LOOP"){let r=o.get("DO",!0);(0,L.isSeq)(r)&&Ui(r,n.body)}}}}function lr(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(le)),i.beforeEach&&i.beforeEach.length>0&&(a.beforeEach=i.beforeEach.map(le)),i.afterEach&&i.afterEach.length>0&&(a.afterEach=i.afterEach.map(le)),i.afterAll&&i.afterAll.length>0&&(a.afterAll=i.afterAll.map(le)),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(le),o.teardown&&o.teardown.length>0&&(r.teardown=o.teardown.map(le)),r}),n.suite=a,(0,L.stringify)(n,Pt)}function $d(e){return e.map(t=>(0,L.stringify)(t,Pt)).join(`---
4548
+ `)}function le(e){switch(e.type){case"DRAFT":return qp(e);case"ACTION":return Ld(e);case"STEP":return Qp(e);case"IF_ELSE":return eg(e);case"WHILE_LOOP":return tg(e)}}function qp(e){return{intent:e.description}}function Ld(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 s=i?.statement;if(typeof s=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let l=i?.code;return typeof l=="string"?{VERIFY:s,js:l}:{VERIFY:s}}}if(t==="go_to_url"){let s=i?.url;if(typeof s=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath){let l={URL:s};return i?.new_tab===!0&&(l.new_tab=!0),typeof i?.timeout_seconds=="number"&&(l.timeout_seconds=i.timeout_seconds),l}}if(t==="js_action"){let s=i?.code;if(typeof s=="string"&&e.description)return{intent:e.description,js:s}}if(t==="ai_wait_until"){let s=i?.condition;if(typeof s=="string"){let l={WAIT_UNTIL:s};return typeof i?.timeout_seconds=="number"&&i.timeout_seconds!==60&&(l.timeout_seconds=i.timeout_seconds),l}}if(t==="wait"){let s=i?.seconds,d={WAIT:e.description||`Wait ${s}s`};return typeof s=="number"&&(d.seconds=s),d}if(t==="js_code"){let s=i?.code;if(typeof s=="string"&&!e.action_entity?.locator&&!e.action_entity?.xpath)return{CODE:s}}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[s,l]of Object.entries(n.kwargs))a[s]=l;return n.args&&n.args.length>0&&(a.args=n.args),a}function Dd(e,t,i){let n={uid:"",type:"ACTION",description:t||e.action_description||"",action_entity:e,locator:i},a=Ld(n);if(typeof a=="object"&&a!==null){let o={...a};return delete o.intent,delete o.VERIFY,delete o.WAIT_UNTIL,delete o.WAIT,delete o.statement,Object.keys(o).length>0?(0,L.stringify)(o,Pt).trim():""}return(0,L.stringify)(a,Pt).trim()}function Od(e){let t=(0,L.parse)(e);if(!t||typeof t!="object")throw new Error("Invalid YAML: expected an object");if("VERIFY"in t){let c=String(t.VERIFY),u=typeof t.js=="string"?t.js:void 0;return{description:c,actionEntity:{action_description:c,action_data:{action_name:"verify",kwargs:{statement:c,...u?{code:u}:{}}}}}}if("URL"in t){let c=String(t.URL),u={url:c};return t.new_tab===!0&&(u.new_tab=!0),typeof t.timeout_seconds=="number"&&(u.timeout_seconds=t.timeout_seconds),{description:`Navigate to ${c}`,actionEntity:{action_description:`Navigate to ${c}`,action_data:{action_name:"go_to_url",kwargs:u}}}}if("CODE"in t){let c=String(t.CODE);return{description:c,actionEntity:{action_description:c,action_data:{action_name:"js_code",kwargs:{code:c}}}}}if("WAIT_UNTIL"in t){let c=String(t.WAIT_UNTIL),u={condition:c};return typeof t.timeout_seconds=="number"&&(u.timeout_seconds=t.timeout_seconds),{description:`Wait until ${c}`,actionEntity:{action_description:`Wait until ${c}`,action_data:{action_name:"ai_wait_until",kwargs:u}}}}if("WAIT"in t){let c=String(t.WAIT),u={};return typeof t.seconds=="number"&&(u.seconds=t.seconds),{description:c,actionEntity:{action_description:c,action_data:{action_name:"wait",kwargs:u}}}}let i=typeof t.intent=="string"?t.intent:void 0,n=typeof t.action=="string"?t.action:void 0,a=typeof t.locator=="string"?t.locator:void 0,o=typeof t.xpath=="string"?t.xpath:void 0,r=Array.isArray(t.frame_path)?t.frame_path:void 0,s=Array.isArray(t.args)?t.args:void 0,l={};for(let[c,u]of Object.entries(t))Zp.has(c)||(l[c]=u);return!n&&t.js?{description:i,actionEntity:{action_description:i||"",action_data:{action_name:"js_action",kwargs:{code:t.js}}}}:n?{actionEntity:{action_description:i||"",action_data:{action_name:n,kwargs:l,...s&&s.length>0?{args:s}:{}},...a?{locator:a}:{},...o?{xpath:o}:{},...r?{frame_path:r}:{}},description:i,locator:a}:{description:i,actionEntity:{action_description:i||""}}}function Qp(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(le)};return e.reference_id!==void 0&&(t.reference_id=e.reference_id),t}function eg(e){let t={IF:Nd(e.condition),THEN:e.then.map(le)};return e.else&&e.else.length>0&&(t.ELSE=e.else.map(le)),t}function tg(e){let t={WHILE:Nd(e.condition),DO:e.body.map(le)};return e.timeout_ms!==void 0&&(t.timeout_ms=e.timeout_ms),t}function Nd(e){return e.type==="JS_CODE"?`js:${e.expression}`:e.expression}function Rd(e){let t=(0,L.parseAllDocuments)(e),i;if(t.length>1||t.length===1&&!Array.isArray(t[0]?.toJSON()))i=t.map((n,a)=>n.errors.length>0?{__parseError:`Document ${a+1}: ${n.errors[0].message}`}:n.toJSON());else{let n;try{n=(0,L.parse)(e)}catch(a){throw new Error(`Invalid YAML: ${a instanceof Error?a.message:String(a)}`)}if(!Array.isArray(n))throw new Error("Expected a YAML array or multi-document YAML (separated by ---)");i=n}return i.map((n,a)=>{try{if(n&&typeof n=="object"&&"__parseError"in n)return{error:n.__parseError};if(!n||typeof n!="object")return{error:`Item ${a+1}: expected an object`};let o=n,r=typeof o.name=="string"&&o.name.trim()||void 0,s=typeof o.goal=="string"?o.goal.trim():"";if(!s)return{error:`Item ${a+1}: missing "goal" field`};if(Array.isArray(o.statements))try{let l=(0,L.stringify)(o,Pt),d=et(l);return{name:r,goal:d.goal??s,testFlow:d}}catch{}return{name:r,goal:s}}catch(o){return{error:`Item ${a+1}: ${o instanceof Error?o.message:String(o)}`}}})}function Fd(e){try{let t=(0,L.parse)(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 rr(e){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(rr);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]=rr(o);return n}function et(e){if(e.length>Id)throw new Error(`YAML input too large (${e.length} bytes, max ${Id})`);let t=rr((0,L.parse)(e));if(!t||typeof t!="object")throw new Error("Invalid YAML: expected an object at root level");if(t.suite)return ig(t);let i={version:"1.3.0",goal:t.goal,url:t.url,baseURL:t.base_url,statements:ce(t.statements??[])};t.final_feedback&&(i.final_feedback=t.final_feedback),t.teardown&&Array.isArray(t.teardown)&&(i.teardown=ce(t.teardown));let n=Aa.safeParse(i);if(!n.success)throw new Error(`Invalid TestFlow after YAML conversion: ${JSON.stringify(n.error.errors)}`);let a=n.data;return cr(e,a),a}function ig(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(s=>{if(!s.name)throw new Error('Each test in a suite must have a "name" field');if(!Array.isArray(s.statements)||s.statements.length===0)throw new Error(`Suite test "${s.name}" must have a non-empty "statements" array`);let l={name:s.name,statements:ce(s.statements)};return Array.isArray(s.teardown)&&s.teardown.length>0&&(l.teardown=ce(s.teardown)),s.skip!==void 0&&(l.skip=s.skip),typeof s.timeout=="number"&&(l.timeout=s.timeout),s.fail!==void 0&&(l.fail=s.fail),s.only===!0&&(l.only=!0),s.slow===!0&&(l.slow=!0),l})};Array.isArray(t.beforeAll)&&t.beforeAll.length>0&&(a.beforeAll=ce(t.beforeAll)),Array.isArray(t.afterAll)&&t.afterAll.length>0&&(a.afterAll=ce(t.afterAll)),Array.isArray(t.beforeEach)&&t.beforeEach.length>0&&(a.beforeEach=ce(t.beforeEach)),Array.isArray(t.afterEach)&&t.afterEach.length>0&&(a.afterEach=ce(t.afterEach));let o=Bi.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 ce(e){if(!Array.isArray(e))throw new Error("Expected an array of statements");return e.map(ng)}function ng(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 ag(t);if("WHILE"in t)return og(t);if("STEP"in t)return rg(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:(0,se.v4)(),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:(0,se.v4)(),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:(0,se.v4)(),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:(0,se.v4)(),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:(0,se.v4)(),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:(0,se.v4)(),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 Cd({...n,action:"function",functionName:i})}if("action"in t)return Cd(t);if("intent"in t&&typeof t.intent=="string"||"desc"in t&&typeof t.desc=="string")return{uid:(0,se.v4)(),type:"DRAFT",description:typeof t.intent=="string"?t.intent:t.desc};throw new Error(`Cannot infer statement type from object: ${JSON.stringify(t)}`)}function Hd(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 ag(e){let t=Hd(e.IF),i=e.THEN;if(!Array.isArray(i))throw new Error("IF_ELSE requires a THEN array");let n={uid:(0,se.v4)(),type:"IF_ELSE",condition:t,then:ce(i)};return"ELSE"in e&&Array.isArray(e.ELSE)&&(n.else=ce(e.ELSE)),n}function og(e){let t=Hd(e.WHILE),i=e.DO;if(!Array.isArray(i))throw new Error("WHILE_LOOP requires a DO array");let n={uid:(0,se.v4)(),type:"WHILE_LOOP",condition:t,body:ce(i)};return typeof e.timeout_ms=="number"&&(n.timeout_ms=e.timeout_ms),n}function rg(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:(0,se.v4)(),type:"STEP",description:t,statements:ce(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 Cd(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[d,c]of Object.entries(e))sg.has(d)||(r[d]=c);t==="verify"&&typeof r.js=="string"&&(r.code=r.js,delete r.js);let s={action_description:i,action_data:{action_name:t,kwargs:Object.keys(r).length>0?r:{}}};n&&(s.locator=n),a&&(s.xpath=a);let l={uid:(0,se.v4)(),type:"ACTION",description:i,action_entity:s};return o&&(l.use_pure_vision=!0),l}function cr(e,t){let i;try{i=(0,L.parseDocument)(e)}catch{return}let n=i.contents;if(!n||!(0,L.isMap)(n))return;if(i.commentBefore)t.comment=i.commentBefore;else{let l=n.items?.[0];l?.key&&l.key.commentBefore&&(t.comment=l.key.commentBefore)}let a=n,o=a.get("statements",!0);(0,L.isSeq)(o)&&t.statements&&Ct(o,t.statements);let r=a.get("teardown",!0);(0,L.isSeq)(r)&&t.teardown&&Ct(r,t.teardown)}function Ct(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"&&(0,L.isMap)(n)){let o=n.get("statements",!0);(0,L.isSeq)(o)&&Ct(o,a.statements)}else if(a.type==="IF_ELSE"&&(0,L.isMap)(n)){let o=n.get("THEN",!0);(0,L.isSeq)(o)&&Ct(o,a.then);let r=n.get("ELSE",!0);(0,L.isSeq)(r)&&a.else&&Ct(r,a.else)}else if(a.type==="WHILE_LOOP"&&(0,L.isMap)(n)){let o=n.get("DO",!0);(0,L.isSeq)(o)&&Ct(o,a.body)}}}var L,se,Pt,Zp,Id,sg,Ma=y(()=>{"use strict";or();L=require("yaml"),se=require("uuid");Pt={lineWidth:120,defaultKeyType:"PLAIN",defaultStringType:"PLAIN"};Zp=new Set(["intent","action","locator","xpath","frame_path","args"]);Id=1024*1024;sg=new Set(["action","intent","desc","locator","xpath","use_pure_vision"])});function dr(e,t){let i=[];t.version!=="1.0"&&i.push(`Unsupported patch version: ${t.version}`),(!Array.isArray(t.operations)||t.operations.length===0)&&i.push("Patch must have at least one operation");for(let n=0;n<t.operations.length;n++){let a=t.operations[n],o=`operations[${n}]`;switch(a.reason||i.push(`${o}: missing reason`),a.op){case"remove":{(typeof a.index!="number"||a.index<0||a.index>=e.length)&&i.push(`${o}: index ${a.index} out of bounds (0..${e.length-1})`);break}case"modify":{(typeof a.index!="number"||a.index<0||a.index>=e.length)&&i.push(`${o}: index ${a.index} out of bounds (0..${e.length-1})`),(a.statement===void 0||a.statement===null)&&i.push(`${o}: missing statement`);break}case"insert":{(typeof a.index!="number"||a.index<0||a.index>=e.length)&&i.push(`${o}: index ${a.index} out of bounds (0..${e.length-1})`),a.position!=="before"&&a.position!=="after"&&i.push(`${o}: position must be 'before' or 'after'`),(a.statement===void 0||a.statement===null)&&i.push(`${o}: missing statement`);break}default:i.push(`${o}: unknown operation type "${a.op}"`)}}return{valid:i.length===0,errors:i}}function ur(e,t){let i=dr(e,t);if(!i.valid)throw new Error(`Invalid patch: ${i.errors.join("; ")}`);let n=[...e],a=t.operations.map((s,l)=>({...s,originalOrder:l})),o={remove:0,modify:1,insert:2},r=[...a].sort((s,l)=>s.index!==l.index?l.index-s.index:o[s.op]-o[l.op]);for(let s of r)switch(s.op){case"remove":n.splice(s.index,1);break;case"modify":n[s.index]=s.statement;break;case"insert":s.position==="before"?n.splice(s.index,0,s.statement):n.splice(s.index+1,0,s.statement);break}return n}function Wd(e,t){let i=(0,Ia.parse)(e);if(!i||typeof i!="object")throw new Error("Invalid YAML: expected an object at root level");let n=i.statements;if(!Array.isArray(n))throw new Error('YAML must have a "statements" array');let a=ur(n,t);i.statements=a;let o=(0,Ia.stringify)(i,{lineWidth:120,defaultKeyType:"PLAIN",defaultStringType:"PLAIN"});return et(o),{modifiedYaml:o,modifiedStatements:a}}var Ia,Bd=y(()=>{"use strict";Ma();Ia=require("yaml")});function hr(e){for(let t of e){if(t.type==="STEP"){let n=t;if(n.reference_id||n.template_path)return!0}let i=Ce(t);for(let n of i)if(hr(n.statements))return!0}return!1}function Kd(e){let t=new Set;function i(n){for(let a of n){if(a.type==="STEP"){let r=a;r.reference_id&&t.add(r.reference_id)}let o=Ce(a);for(let r of o)i(r.statements)}}return i(e),Array.from(t)}function Vd(e){if(!e?.statements||!Array.isArray(e.statements))return{};let t={};return Be(e.statements,"main",t),e.teardown&&Array.isArray(e.teardown)&&Be(e.teardown,"teardown",t),t}function Re(e,t,i){let n=e+".",a=t.filter(([c])=>c===e||c.startsWith(n));if(a.length===0)return[];let o=[],r=new Set;for(let[c]of a){let u=c===e?"":c.slice(n.length);if(!u)continue;let m=u.split(".")[0];r.has(m)||r.add(m)}let s=Array.from(r);s.sort((c,u)=>{let m=/^\d+$/.test(c)?parseInt(c,10):-1,g=/^\d+$/.test(u)?parseInt(u,10):-1;return m>=0&&g>=0?m-g:c==="then"&&u==="else"?-1:c==="else"&&u==="then"||c==="body"?1:u==="body"?-1:c.localeCompare(u)});function l(c){return i[c]}function d(c){let u=c.match(/^(IF|WHILE)\s+([\s\S]+)$/);return{type:"AI_MODE",expression:(u?u[2].trim():c)||"true"}}for(let c of s){let u=e?`${e}.${c}`:c,m=l(u),g=m?.description??"",w=u;if(c==="then"){let _=`${e}.then`,k=`${e}.else`,E=Re(_,t,i),I=Re(k,t,i),C=l(e),$=C?d(C.description):{type:"JS_CODE",expression:"true"};o.push({uid:e,type:"IF_ELSE",condition:$,then:E,...I.length>0?{else:I}:{}});continue}if(c==="else")continue;if(c==="body"){let _=`${e}.body`,k=Re(_,t,i),E=l(e),I=E?d(E.description):{type:"JS_CODE",expression:"true"};o.push({uid:e,type:"WHILE_LOOP",condition:I,body:k});continue}let v=`${e}.${c}`,x=t.some(([_])=>_.startsWith(v+".then.")||_===v+".then"),p=t.some(([_])=>_.startsWith(v+".else.")||_===v+".else"),f=t.some(([_])=>_.startsWith(v+".body.")||_===v+".body"),S=t.filter(([_])=>{if(!_.startsWith(v+"."))return!1;let E=_.slice(v.length+1).split(".")[0];return/^\d+$/.test(E)&&E!=="then"&&E!=="else"&&E!=="body"});if(x||p){let _=v+".then",k=v+".else",E=Re(_,t,i),I=Re(k,t,i),C=m?d(g):{type:"JS_CODE",expression:"true"};o.push({uid:u,type:"IF_ELSE",condition:C,then:E,...I.length>0?{else:I}:{}})}else if(f){let _=v+".body",k=Re(_,t,i),E=m?d(g):{type:"JS_CODE",expression:"true"};o.push({uid:u,type:"WHILE_LOOP",condition:E,body:k})}else if(S.length>0){let _=Re(v,t,i);o.push({uid:u,type:"STEP",description:g||"Group",statements:_})}else o.push({uid:u,type:"ACTION",description:g||"Action",action_entity:m?.action_entity})}return o}function Xd(e){let t=Object.entries(e),i=n=>{let a=n+".";return t.some(([r])=>r===n||r.startsWith(a))?Re(n,t,e):[]};return{before:i("before"),main:i("main"),teardown:i("teardown"),after:i("after")}}var Ce,ae,Fe,He,We,Gi,Ud,Gd,lg,cg,jd,zd,Be,Ca=y(()=>{"use strict";Ce=e=>{let t=[];switch(e.type){case"STEP":e.statements&&t.push({key:"statements",statements:e.statements});break;case"IF_ELSE":e.then&&t.push({key:"then",statements:e.then}),e.else&&t.push({key:"else",statements:e.else});break;case"WHILE_LOOP":e.body&&t.push({key:"body",statements:e.body});break}return t},ae=(e,t,i=void 0,n="root")=>{for(let a=0;a<e.length;a++){let o=e[a],r=o.uid;if(r===t)return{stableId:r,path:[a],statement:o,parent:i,containerKey:n,index:a};let s=Ce(o);for(let l of s){let d=ae(l.statements,t,o,l.key);if(d)return{...d,path:[a,l.key,...d.path]}}}return null},Fe=(e,t,i)=>{let n=ae(e,t);if(!n)return null;let{statement:a,parent:o,containerKey:r,index:s}=n,l=null;switch(a.type){case"DRAFT":case"ACTION":l=He(e,n)||We(e,n);break;case"STEP":if(a.statements&&a.statements.length>0)return a.statements[0];l=He(e,n)||We(e,n);break;case"IF_ELSE":if(i===!0&&a.then&&a.then.length>0)return a.then[0];if(i===!1&&a.else&&a.else.length>0)return a.else[0];l=He(e,n)||We(e,n);break;case"WHILE_LOOP":if(i===!0&&a.body&&a.body.length>0)return a.body[0];l=He(e,n)||We(e,n);break;default:l=He(e,n)||We(e,n);break}if(o&&o.type==="WHILE_LOOP"&&r==="body"){if(!l)return o;let d=ae(e,l.uid);if(!d||d.parent!==o)return o}return l},He=(e,t)=>{if(!t.parent)return e[t.index+1]||null;let n=Ce(t.parent).find(a=>a.key===t.containerKey);return n&&t.index+1<n.statements.length?n.statements[t.index+1]:null},We=(e,t)=>{if(!t.parent)return null;let i=t.parent.uid,n=ae(e,i);return n?He(e,n)||We(e,n):null},Gi=e=>{let t=[],i=n=>{for(let a of n){t.push(a);let o=Ce(a);for(let r of o)i(r.statements)}};return i(e),t},Ud=e=>{switch(e.type){case"DRAFT":case"ACTION":return!0;case"STEP":return!0;case"IF_ELSE":case"WHILE_LOOP":return!0;default:return!1}},Gd=(e,t,i)=>{if(!ae(e,t))return null;if(i===null){let s=[],l=t;for(;l!==null&&ae(e,l);)if(s.push(l),l=Fe(e,l)?.uid||null,s.length>1e3)return null;return s}if(!ae(e,i))return null;if(t===i)return[];let o=[],r=t;for(;r&&r!==i;){let s=ae(e,r);if(!s)break;if(o.push(r),s.statement.type==="IF_ELSE"){let l=lg(s.statement,i);l?r=Fe(e,r,l==="then")?.uid||null:r=Fe(e,r)?.uid||null}else s.statement.type==="WHILE_LOOP"?cg(s.statement,i)?r=Fe(e,r,!0)?.uid||null:r=Fe(e,r,!1)?.uid||null:r=Fe(e,r)?.uid||null;if(o.length>1e3)return null}return r===i?o:null},lg=(e,t)=>{if(e.type!=="IF_ELSE")return null;let i=e;return i.then&&ae(i.then,t)?"then":i.else&&ae(i.else,t)?"else":null},cg=(e,t)=>{if(e.type!=="WHILE_LOOP")return!1;let i=e;return!!(i.body&&ae(i.body,t))};jd=e=>e.startsWith("ai_")?!0:["js_code","function","assert","verify","wait_for_download_complete","extract_activation_code","extract_email_content"].includes(e),zd=e=>!["js_code","function","assert","ai_assert","verify","ai_extract","ai_wait_until","upload_file","login","extract_activation_code","extract_email_content","ai_step"].includes(e),Be=(e,t,i)=>{e.forEach((n,a)=>{let o=`${t}.${a}`;n.type==="DRAFT"?i[o]={description:n.description||"Draft",action_entity:void 0}:n.type==="ACTION"?i[o]={description:n.description||"Action",action_entity:n.action_entity,locator:n.locator}:n.type==="STEP"&&n.statements?Be(n.statements,o,i):n.type==="IF_ELSE"?(i[o]={description:"IF "+(n.condition?.expression||""),action_entity:void 0},n.then&&Be(n.then,`${o}.then`,i),n.else&&Be(n.else,`${o}.else`,i)):n.type==="WHILE_LOOP"&&(i[o]={description:"WHILE "+(n.condition?.expression||""),action_entity:void 0},n.body&&Be(n.body,`${o}.body`,i))})}});function pr(e){let t=0,i=0;for(let n of e)if(n.type==="DRAFT")i++;else if(n.type==="ACTION"){let a=n.action_entity?.action_data?.action_name??"";mr.has(a)||t++}return{action:t,draft:i}}function ug(e){try{return new Function(`return async function() { ${e} }`),null}catch(t){return t.message}}function qd(e){try{return new Function(`return async function() { return (${e}) }`),null}catch(t){return t.message}}function hg(e){let t=e.split(/\r?\n/).map(o=>o.trim()).filter(o=>o.length>0&&!o.startsWith("//")),i=t.length,n=t.join(`
4549
+ `).match(/\bawait\b/g),a=n?n.length:0;return i<=Yd&&a<=Jd?null:`${i} non-blank line(s), ${a} await(s) \u2014 limits are ${Yd} lines and ${Jd} awaits. The js: field is a cache for one natural-language intent, not a place for multi-step logic. Break this into multiple statements \u2014 one VERIFY or intent+js per UI interaction or assertion \u2014 so each step is visible in the debugger and self-healable.`}function Zd(e,t){let i=t?.coverageThreshold??dg,n=[],a=[],o;try{o=et(e)}catch(m){return{valid:!1,errors:[`Invalid YAML: ${m.message}`],warnings:[],stats:{total:0,action:0,draft:0,coverage:0}}}o.goal||n.push('Missing required field: "goal"'),o.statements?.length||n.push('Missing required field: "statements"');let r=[...Gi(o.statements??[]),...o.teardown?Gi(o.teardown):[]],{action:s,draft:l}=pr(r),d="Hint: in YAML double-quoted strings, backslashes are escape characters \u2014 use \\\\/ instead of \\/ for regex, or use single quotes.";for(let m of r){let g=m;if(g.reference_id!==void 0){let w=g.description||m.uid;n.push(`Unresolved cloud template reference on statement "${w}" (reference_id: ${g.reference_id}). Local YAML tests cannot use reference_id \u2014 inline the template statements or use the local "template:" key instead.`)}if(m.type==="ACTION"){let w=m,v=w.action_entity?.action_data?.action_name??"";if(v==="js_code"||v==="js_action"||v==="verify"||v==="ai_assert"){let x=w.action_entity?.action_data?.kwargs?.code;if(typeof x=="string"){let p=ug(x);if(p){let f=w.description||v;n.push(`Invalid JS in "${f}": ${p}. ${d}`)}else if(v==="verify"||v==="js_action"){let f=hg(x);if(f){let S=w.description||v;n.push(`JS cache for "${S}" is too complex: ${f}`)}}}}}if(m.type==="IF_ELSE"){let w=m;if(w.condition.type==="JS_CODE"){let v=qd(w.condition.expression);v&&n.push(`Invalid JS in IF condition "${w.condition.expression}": ${v}. ${d}`)}}if(m.type==="WHILE_LOOP"){let w=m;if(w.condition.type==="JS_CODE"){let v=qd(w.condition.expression);v&&n.push(`Invalid JS in WHILE condition "${w.condition.expression}": ${v}. ${d}`)}}}let c=s+l,u=c>0?Math.round(s/c*100):0;return c>0&&u/100<i&&a.push(`Low action coverage: ${s}/${c} statements (${u}%) are enriched with action/js. ${l} draft statement(s) still need enrichment. Use MCP tools (act, get_locators) to convert drafts to actions.`),{valid:n.length===0,errors:n,warnings:a,stats:{total:c,action:s,draft:l,coverage:u}}}var dg,Yd,Jd,mr,Qd=y(()=>{"use strict";Ma();Ca();dg=.5,Yd=5,Jd=3,mr=new Set(["verify","ai_assert","done","go_to_url","ai_wait_until","wait","js_code"])});function eu(e){return e?e.startsWith(he)?"android":e.startsWith(me)?"ios":"web":"web"}function tu(e){return e?e.startsWith(he)||e.startsWith(me):!1}function iu(e){return!!e&&e.startsWith(he)}function nu(e){return!!e&&e.startsWith(me)}function au(e){return e.startsWith(he)?e.slice(he.length):e.startsWith(me)?e.slice(me.length):e}function ou(e){return`${he}${e}`}function ru(e){return`${me}${e}`}function Pa(e){return e?e.startsWith("http://")||e.startsWith("https://"):!1}function su(e){return e?!Pa(e):!1}function gr(e){return e?Pa(e)?["web"]:["android","ios"]:["web","android","ios"]}function lu(e,t){if(!t)return!0;let i=gr(t);return e==="desktop"||e==="mobile"?i.includes("web"):i.includes(e)}var he,me,$a=y(()=>{"use strict";he="android:",me="ios:"});function cu(e){return e.startsWith(me)?e:`${me}${e}`}function du(e){let t=e.iosVersion?` (iOS ${e.iosVersion})`:"";return e.deviceType==="simulator"?`${e.name}${t} - Simulator`:`${e.name}${t}`}function uu(e){return!!(/^[0-9a-fA-F]{40}$/.test(e)||/^[0-9a-fA-F]{8}-[0-9a-fA-F]{16}$/.test(e))}var hu=y(()=>{"use strict";$a()});var fr,La,wr,br,yr,xr,vr,_r,kr,Sr,tt,Er,Ki,Tr,Ar,$t,mu,ji,pu,gu,Da,fu,wu,bu,yu,xu=y(()=>{"use strict";fr="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36",La=112,wr=1920,br=1080,yr=1920,xr=1080-La,vr=1280,_r=720,kr=500,Sr=500,tt="Desktop Chrome",Er=(e=>(e.Chromium="chromium",e.Firefox="firefox",e.Webkit="webkit",e))(Er||{}),Ki={"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"}},Tr=(e=>(e.Desktop="desktop",e.Mobile="mobile",e))(Tr||{}),Ar={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"]},$t=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),Ar[e].map(n=>Ki[n]).filter(n=>n.defaultBrowserType&&i.includes(n.defaultBrowserType))},mu=()=>Object.keys(Ki),ji=e=>Ki[e],pu={desktop:{label:"Desktop",type:"desktop",devices:$t("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:$t("mobile")}},gu={desktop:{label:"Desktop",type:"desktop",devices:$t("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:$t("mobile",!0)}},Da=(e,t=!1)=>{let i={userAgent:fr,viewport:{width:yr,height:xr},isMobile:!1,hasTouch:!1};if(!e||e===tt)return i;let n=ji(e);if(!n)return i;let{width:a,height:o}=n.viewport,r=Math.max(kr/a,1),s=Math.max(Sr/o,1),l=Math.max(r,s),d={width:Math.round(a*l),height:Math.round(o*l)};return{userAgent:n.userAgent,viewport:t?d:n.viewport,isMobile:n.isMobile,hasTouch:n.hasTouch}},fu=e=>{let t={width:wr,height:br};if(!e||e===tt)return t;let i=Da(e);return i.viewport?{width:i.viewport.width,height:i.viewport.height+La}:t},wu=e=>{let t={width:vr,height:_r};if(!e||e===tt)return t;let i=Da(e);return i.viewport?{width:i.viewport.width,height:i.viewport.height}:t},bu=e=>!e||e===tt?void 0:ji(e)?.channel,yu=e=>!e||e===tt?"chromium":ji(e)?.defaultBrowserType??"chromium"});var Mr,Ir,vu=y(()=>{"use strict";Mr=(e=>(e.PASSWORD="password",e.OAUTH2="oauth2",e.SSO="sso",e.API="api",e))(Mr||{}),Ir=(e=>(e.SMS="sms",e.EMAIL="email",e.TOTP="totp",e))(Ir||{})});function _u(){return{version:"1.0",entries:{}}}function ku(e,t){return{action_entity:e,updated_at:new Date().toISOString(),updated_by:{source:"runner",test_run_id:t}}}function Su(e,t){let i=t?.entries[e.uid],n=i?.action_entity??e.action_entity;return e.locator&&n?{...n,locator:e.locator}:i?i.action_entity:e.action_entity?e.action_entity:null}function Eu(e,t,i,n){return e.entries[t]={action_entity:i,updated_at:new Date().toISOString(),updated_by:n},e}function Tu(e,t){let i=e??{version:"1.0",entries:{}};for(let[n,a]of t)i.entries[n]=a;return i}function Au(e){return e?Object.keys(e.entries).length===0:!0}function Mu(e){return e?Object.keys(e.entries).length:0}function Iu(e,t){if(!t||Object.keys(t.entries).length===0)return e;let i=Cr(e.statements??[],t),n=e.teardown?Cr(e.teardown,t):void 0;return{...e,statements:i,teardown:n}}function Cr(e,t){return e.map(i=>mg(i,t))}function mg(e,t){if(e.type==="ACTION"){let a=e,o=t.entries[a.uid];return o?{...a,action_entity:o.action_entity}:a}let i=Ce(e);if(i.length===0)return e;let n={};for(let a of i)n[a.key]=Cr(a.statements,t);return{...e,...n}}var Cu=y(()=>{"use strict";Ca()});var Pr,$r,Pu,$u=y(()=>{"use strict";Pr=(e=>(e.DRAFT="DRAFT",e.STEP="STEP",e.ACTION="ACTION",e.IF_ELSE="IF_ELSE",e.WHILE_LOOP="WHILE_LOOP",e))(Pr||{}),$r=(e=>(e.JS_CODE="JS_CODE",e.AI_MODE="AI_MODE",e))($r||{}),Pu=18e4});var Lu,Ou=y(()=>{"use strict";Lu=class Du{data={};sensitive=new Set;get(t){return this.data[t]}set(t,i,n=!1){this.data[t]=i,n?this.sensitive.add(t):this.sensitive.has(t)&&this.sensitive.delete(t)}getAll(){return{...this.data}}isSensitive(t){return this.sensitive.has(t)}getAllSensitiveKeys(){return new Set(this.sensitive)}delete(t){return this.sensitive.delete(t),delete this.data[t]}clear(){this.data={},this.sensitive.clear()}has(t){return t in this.data}get size(){return Object.keys(this.data).length}merge(t){for(let[i,n]of Object.entries(t.getAll()))this.set(i,n,t.isSensitive(i))}toJSON(){return{data:{...this.data},sensitiveKeys:Array.from(this.sensitive)}}static fromJSON(t){let i=new Du;if(t.data){let n=new Set(t.sensitiveKeys||[]);for(let[a,o]of Object.entries(t.data))i.set(a,o,n.has(a))}return i}}});function Nu(e,t=pg()){return{copilot:e?.models?.copilot||t.COPILOT_MODEL||Ra,webagent:e?.models?.webagent||t.WEB_AGENT_MODEL||Nr,computer_use:e?.models?.computer_use||t.COMPUTER_USE_MODEL||Rr}}function Ru(e){if(e){if(e.WEB_AGENT_MODEL)return e.WEB_AGENT_MODEL;if(e.GOOGLE_API_KEY)return Oa;if(e.ANTHROPIC_API_KEY)return Lr;if(e.OPENAI_API_KEY)return Dr;if(e.SHIPLIGHT_API_TOKEN)return Ra}}function Fu(e){if(e){if(e.COMPUTER_USE_MODEL)return e.COMPUTER_USE_MODEL;if(e.GOOGLE_API_KEY)return Na;if(e.OPENAI_API_KEY)return Or}}var Lr,Oa,Dr,Na,Or,Ra,Nr,Rr,pg,Hu=y(()=>{"use strict";Lr="claude-haiku-4-5",Oa="gemini-3.1-flash-lite-preview",Dr="gpt-5.4-mini",Na="gemini-3-flash-preview",Or="gpt-5.4",Ra="claude-sonnet-4-6",Nr=Oa,Rr=Na,pg=()=>typeof process<"u"?process.env:{}});var Fr,Wu=y(()=>{"use strict";Fr=(e=>(e.INITIALIZING="initializing",e.READY="ready",e.PROCESSING="processing",e.STOPPING="stopping",e.WAITING_USER="waiting_user",e.COMPLETED="completed",e.FAILED="failed",e))(Fr||{})});function Bu(e){let t=e.trim();if(!t||t.startsWith("List of devices"))return null;let i=t.split(/\s+/);if(i.length<2)return null;let n=i[0],a=i[1],o="usb";return n.startsWith("emulator-")?o="emulator":n.includes(":")&&(o="wifi"),{id:n,state:a,connectionType:o}}function Uu(e){return e.startsWith(he)?e:`${he}${e}`}function Gu(e){return e.model?`${e.model} (${e.id})`:e.connectionType==="emulator"?`Android Emulator (${e.id})`:e.id}var Ku=y(()=>{"use strict";$a()});var Hr={};Ke(Hr,{ADDRESS_BAR_HEIGHT:()=>La,ANDROID_DEVICE_PREFIX:()=>he,ActionEntitySchema:()=>tr,ActionSchema:()=>nr,AgentStatus:()=>Fr,BaseStatementSchema:()=>Qe,BrowserType:()=>Er,ConditionSchema:()=>Ta,ConditionType:()=>$r,ConditionTypeSchema:()=>Qo,DEFAULT_ANTHROPIC_MODEL:()=>Lr,DEFAULT_COMPUTER_USE_MODEL:()=>Rr,DEFAULT_COPILOT_MODEL:()=>Ra,DEFAULT_DEVICE_NAME:()=>tt,DEFAULT_GEMINI_COMPUTER_USE_MODEL:()=>Na,DEFAULT_GOOGLE_MODEL:()=>Oa,DEFAULT_OPENAI_COMPUTER_USE_MODEL:()=>Or,DEFAULT_OPENAI_MODEL:()=>Dr,DEFAULT_WEBAGENT_MODEL:()=>Nr,DEFAULT_WHILE_LOOP_TIMEOUT_MS:()=>Pu,DEVICE_CATEGORIES:()=>Ar,DeviceType:()=>Tr,DraftSchema:()=>ir,IOS_DEVICE_PREFIX:()=>me,LoginType:()=>Mr,MIN_WINDOW_HEIGHT:()=>Sr,MIN_WINDOW_WIDTH:()=>kr,NON_INTENT_ACTIONS:()=>mr,NodeJSCodeCommon:()=>bd,PLAYWRIGHT_DEVICES:()=>Ki,RECORD_VIDEO_HEIGHT:()=>_r,RECORD_VIDEO_WIDTH:()=>vr,StatementSchema:()=>ne,StatementType:()=>Pr,StatementTypeSchema:()=>er,TestFlowSchema:()=>Aa,TestGroupEntrySchema:()=>ar,TestGroupSchema:()=>Bi,TwoFactorAuthType:()=>Ir,UI_DEVICE_CATEGORIES:()=>pu,UI_DEVICE_CATEGORIES_ELECTRON:()=>gu,USER_AGENT:()=>fr,VIEWPORT_HEIGHT:()=>xr,VIEWPORT_WIDTH:()=>yr,VariableStore:()=>Lu,WINDOW_HEIGHT:()=>br,WINDOW_WIDTH:()=>wr,actionEntityToYaml:()=>Dd,actionStepsMapToTestFlowSections:()=>Xd,allowPureVisionAction:()=>zd,applyPatchToYaml:()=>ur,applyPatchToYamlString:()=>Wd,collectActionSteps:()=>Be,convertPlaywrightActionToEntity:()=>Td,countIntentStatements:()=>pr,createAndroidDeviceName:()=>ou,createEmptyStore:()=>_u,createIOSDeviceName:()=>ru,createRunnerStoreEntry:()=>ku,extractActionStepsFromTestFlow:()=>Vd,extractAndAttachComments:()=>cr,extractDeviceIdentifier:()=>au,extractElementDescription:()=>Jo,extractElementDescriptionFromAriaSnapshot:()=>qo,extractLocatorFromCode:()=>Zo,extractYamlMetadata:()=>Fd,findNextAfterContainer:()=>We,findNextSibling:()=>He,findNextStatement:()=>Fe,findPathBetweenStatements:()=>Gd,findStatementPathById:()=>ae,generateUid:()=>Ed,getAllDeviceNames:()=>mu,getAllReferenceIds:()=>Kd,getAllStatementsInOrder:()=>Gi,getAndroidDeviceDisplayName:()=>Gu,getBrowserWindowSize:()=>fu,getCompatiblePlatforms:()=>gr,getDeviceBrowserType:()=>yu,getDeviceByName:()=>ji,getDeviceChannel:()=>bu,getDeviceOptions:()=>Da,getDevicesByCategory:()=>$t,getIOSDeviceDisplayName:()=>du,getLoginConfigPlatform:()=>xd,getRecordVideoSize:()=>wu,getStatementContainers:()=>Ce,getStoreSize:()=>Mu,getTestPlatformFromDeviceName:()=>eu,hasReferenceIds:()=>hr,isAndroidDevice:()=>iu,isAppPackage:()=>su,isDynamicAction:()=>jd,isExecutableStatement:()=>Ud,isIOSDevice:()=>nu,isNativeDevice:()=>tu,isPhysicalDeviceUDID:()=>uu,isPlatformCompatibleWithUrl:()=>lu,isStoreEmpty:()=>Au,isWebUrl:()=>Pa,mergeActionEntitiesIntoTestFlow:()=>Iu,mergeStoreUpdates:()=>Tu,parseAdbDeviceLine:()=>Bu,parseYamlArrayItems:()=>Rd,replaceVariables:()=>_d,resolveActionEntity:()=>Su,resolveComputerUseModelFromEnv:()=>Fu,resolveModels:()=>Nu,resolveWebAgentModelFromEnv:()=>Ru,suiteToYaml:()=>lr,testFlowToYaml:()=>Pd,testFlowToYamlObject:()=>sr,toAndroidDeviceName:()=>Uu,toIOSDeviceName:()=>cu,updateStoreEntry:()=>Eu,validatePatch:()=>dr,validateTestYaml:()=>Zd,yamlObjectsToString:()=>$d,yamlToActionEntity:()=>Od,yamlToTestFlow:()=>et});var Wr=y(()=>{"use strict";yd();vd();kd();Ad();Bd();Qd();Ma();or();hu();xu();vu();Cu();Ca();$u();Ou();Hu();Wu();Ku();$a()});var wg={};Ke(wg,{SDK_ENV_ALLOWLIST:()=>Zu,buildSdkEnv:()=>Qu,createTestContext:()=>qu,expect:()=>Lt.expect,resolveAuthState:()=>Yu,test:()=>fg});module.exports=oh(wg);var Ue=R(require("path"),1),Xu=R(require("fs"),1),Lt=require("@playwright/test");var ee=R(require("fs"),1),nt=R(require("path"),1),Ha=require("crypto"),Wa=require("os");function Kr(e){return[`--disable-extensions-except=${e}`,`--load-extension=${e}`,"--no-first-run","--disable-default-apps"]}function jr(e){if(!ee.existsSync(e))return console.warn(`[fixture] extensionStorageState file not found: ${e}`),null;let t;try{t=JSON.parse(ee.readFileSync(e,"utf-8"))}catch(o){throw new Error(`[fixture] Failed to parse extensionStorageState at ${e}: ${o}`)}let i=t;if(!Array.isArray(i.cookies))return null;let n=(Date.now()+365*24*60*60*1e3)/1e3,a=i.cookies.filter(o=>o&&typeof o=="object"&&typeof o.name=="string"&&typeof o.domain=="string");return a.length<i.cookies.length&&console.warn(`[fixture] Skipped ${i.cookies.length-a.length} malformed cookies (missing name or domain)`),a.map(o=>({...o,expires:n}))}function zr(e){if(e){let i=nt.resolve(process.cwd(),e),n=nt.join((0,Wa.tmpdir)(),`ext-profile-${(0,Ha.randomUUID)()}`);if(ee.existsSync(i)){try{ee.cpSync(i,n,{recursive:!0})}catch(o){try{ee.rmSync(n,{recursive:!0,force:!0})}catch(r){console.warn("[fixture] Failed to clean up partial profile copy:",n,r)}throw new Error(`[fixture] Failed to copy extension profile from ${i}: ${o}`)}let a=nt.join(n,"SingletonLock");ee.existsSync(a)&&ee.rmSync(a,{force:!0})}else ee.mkdirSync(n,{recursive:!0});return n}let t=nt.join((0,Wa.tmpdir)(),`ext-profile-${(0,Ha.randomUUID)()}`);return ee.mkdirSync(t,{recursive:!0}),t}Vo();var jp=R(require("dotenv"),1),zp="__shiplightDotenvCache__";function Vp(){return globalThis[zp]}function Xo(){let e=Vp();return e===void 0?process.env:e}async function Yu(e){let i=await import(Ue.resolve(process.cwd(),e.auth)),n=i.login||i.default;if(typeof n!="function")throw new Error(`auth module "${e.auth}" must export a login(args) function that returns a storageState file path`);let a=await n(e.args||{});if(typeof a!="string")throw new Error(`auth module "${e.auth}" login() must return a storageState file path (got ${typeof a})`);return a}function ju(e){return!(!e||e==="off")}function Ju(e,t){return!e||e==="off"?!1:e==="on"?!0:e==="retain-on-failure"?t.status!==t.expectedStatus:e==="on-first-retry"?t.retry>0:typeof e=="object"&&e!==null&&"mode"in e?Ju(e.mode,t):!0}async function zu(e,t,i){let n=Ju(t,i);for(let a of e)try{if(n){let o=await a.path();await i.attach("video",{path:o,contentType:"video/webm"})}else await a.delete()}catch(o){console.warn("[fixture] Failed to process video:",o)}}var Fa;async function Vu(){return Fa||(Fa=await Promise.resolve().then(()=>(Vo(),wd)),Fa)}var gg=new Set(["get","set","getAll","has","__variableStore"]);function qu(e){let t={__variableStore:e,get(i){return e.get(i)},set(i,n,a=!1){e.set(i,n,a)},getAll(){return e.getAll()}};return new Proxy(t,{get(i,n,a){if(n in i)return Reflect.get(i,n,a);if(typeof n=="string")return i.get(n)},set(i,n,a){return typeof n!="string"||gg.has(n)?Reflect.set(i,n,a):(i.set(n,a),!0)},has(i,n){return n in i?!0:typeof n=="string"?e.has?.(n)??!1:!1}})}var Zu=["GOOGLE_API_KEY","ANTHROPIC_API_KEY","OPENAI_API_KEY","OPENAI_BASE_URL","ANTHROPIC_MODELS_USE_VERTEXAI","GOOGLE_GENAI_USE_VERTEXAI","GOOGLE_CLOUD_PROJECT","GOOGLE_CLOUD_LOCATION","MAILGUN_API_KEY","MAILGUN_DOMAIN","SHIPLIGHT_API_TOKEN","SHIPLIGHT_API_URL"];function Qu(e=Xo()){let t={};for(let i of Zu)t[i]=e[i]??"";return t}var fg=Lt.test.extend({account:[void 0,{option:!0}],autoDismissModal:[!1,{option:!0}],extensionDir:[void 0,{option:!0}],userDataDir:[void 0,{option:!0}],extensionStorageState:[void 0,{option:!0}],launchOptions:async({launchOptions:e},t)=>{if(!process.env.SHIPLIGHT_REGISTRY_URL){await t(e);return}let i=e?.args??[],n={...e,args:[...i,"--remote-debugging-port=0"]};await t(n)},browser:async({browser:e},t)=>{let i=null;if(process.env.SHIPLIGHT_REGISTRY_URL)try{let n=await ya(process.pid),a=process.env.TEST_WORKER_INDEX??"?";i=await kt({cdpUrl:n,label:`shiplight test w${a}`,pid:process.pid})}catch{}await t(e),await St(i)},context:async({browser:e,account:t,extensionDir:i,userDataDir:n,extensionStorageState:a},o,r)=>{if(i||n){if(t||r.project.use.auth)throw new Error('Cannot use both "extensionDir"/"userDataDir" and "auth" \u2014 persistent context tests manage their own context. Use extensionStorageState for authentication instead.');let l=r.project.use?.browserName;l&&l!=="chromium"&&console.warn(`[fixture] Persistent context requires Chromium but project is configured for "${l}". Forcing Chromium.`);let d=process.env.PLAYWRIGHT_HEADLESS==="true";i&&d&&console.warn("[fixture] PLAYWRIGHT_HEADLESS=true with extensionDir \u2014 Chrome extensions will not function in headless mode.");let c=zr(n),u=i?Kr(Ue.resolve(process.cwd(),i)):[],m={...r.project.use},{storageState:g,account:w,extensionDir:v,userDataDir:x,extensionStorageState:p,autoDismissModal:f,video:S,..._}=m,k=ju(S)?{dir:r.outputDir}:void 0,E;try{if(E=await Lt.chromium.launchPersistentContext(c,{..._,headless:d,args:u,viewport:_.viewport??{width:1280,height:720},...k?{recordVideo:k}:{}}),a){let I=Ue.resolve(process.cwd(),a),C=jr(I);C&&await E.addCookies(C)}await o(E)}finally{let I=E?.pages().map(C=>C.video()).filter(C=>C!==null)??[];if(await E?.close().catch(C=>{console.warn("[fixture] Failed to close persistent context:",C)}),await zu(I,S,r),!n)try{Xu.rmSync(c,{recursive:!0,force:!0})}catch(C){console.warn("[fixture] Failed to clean up temp profile dir:",c,C)}}}else{let l={...r.project.use},d=r.project.use,c=d.auth?{auth:d.auth,args:d.args}:t;if(c){if(!c.auth)throw new Error("Auth is declared but missing the script path. Provide auth in playwright.config.ts: use: { auth: './auth.login.ts' }");l.storageState=await Yu(c)}let u=l.video;ju(u)&&!l.recordVideo&&(l.recordVideo={dir:r.outputDir});let m=await e.newContext(l);m.addInitScript(Oe);try{await o(m)}finally{let g=m.pages().map(w=>w.video()).filter(w=>w!==null);await m.close(),await zu(g,u,r)}}},page:async({context:e},t)=>{let i=await e.newPage();await t(i)},testContext:async({},e,t)=>{let{VariableStore:i}=await Vu(),n=new i,a=t.project.use.variables;if(a)for(let[r,s]of Object.entries(a))typeof s=="string"?n.set(r,s,!1):s&&typeof s=="object"&&"value"in s&&n.set(r,s.value,s.sensitive===!0);let o=qu(n);global.testContext=o,global.$=o,global.ctx=o,await e(o),delete global.testContext,delete global.$,delete global.ctx},$:async({testContext:e},t)=>{await t(e)},ctx:async({testContext:e},t)=>{await t(e)},agent:async({page:e,testContext:t,autoDismissModal:i},n,a)=>{let{WebAgent:o,createAgentContext:r,configureSdk:s,parseSdkLogLevelFromEnv:l}=await Vu(),d=l();s({env:Qu(),...d!==void 0&&{logLevel:d}});let{resolveWebAgentModelFromEnv:c,resolveComputerUseModelFromEnv:u}=await Promise.resolve().then(()=>(Wr(),Hr)),m=Xo(),g=c(m);if(!g)throw new Error("No AI model configured. Set WEB_AGENT_MODEL, GOOGLE_API_KEY, ANTHROPIC_API_KEY, OPENAI_API_KEY, or SHIPLIGHT_API_TOKEN in your .env file (or in the runner environment for CI).");let w=u(m),v=t.__variableStore,x=r({model:g,computer_use_model:w,variableStore:v,autoDismissModal:i}),p=Ue.join(a.outputDir,"artifacts");x.stepTracking={results:{},artifactsDir:p};let f=new o(x),S=e.context();f.agentServices.setupPageTracking(S);for(let _ of S.pages())f.setupDownloadTracking(_),f.setupDialogHandling(_);S.on("page",_=>{f.setupDownloadTracking(_),f.setupDialogHandling(_)}),global.agent=f,await n(f),delete global.agent;try{let _=a.outputDir;await f.writeExecutionResults(_);let k=Ue.join(_,"test-results.json");await(await import("fs/promises")).stat(k).catch(()=>null)&&await a.attach("shiplight-results",{path:k,contentType:"application/json"})}catch(_){console.error("[Shiplight] Failed to attach step results:",_)}try{let _=f.getNewActionEntities();if(_.size>0&&a.status==="passed"){let{createEmptyStore:k,createRunnerStoreEntry:E}=await Promise.resolve().then(()=>(Wr(),Hr)),I=await import("fs/promises"),C=k();for(let[K,X]of _)C.entries[K]=E(X,0);let $=Ue.join(a.outputDir,"new-action-entities.json");await I.writeFile($,JSON.stringify(C,null,2)),await a.attach("shiplight-new-action-entities",{path:$,contentType:"application/json"}),console.log(`[Shiplight] ${_.size} healed action entit${_.size===1?"y":"ies"} saved`)}}catch(_){console.warn("[Shiplight] Failed to persist new action entities:",_)}}});0&&(module.exports={SDK_ENV_ALLOWLIST,buildSdkEnv,createTestContext,expect,resolveAuthState,test});