shiplightai 0.1.2 → 0.1.3

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.
@@ -1,7 +1,7 @@
1
- "use strict";var Oe=Object.create;var D=Object.defineProperty;var Le=Object.getOwnPropertyDescriptor;var Ie=Object.getOwnPropertyNames;var $e=Object.getPrototypeOf,De=Object.prototype.hasOwnProperty;var Ce=(e,t)=>{for(var i in t)D(e,i,{get:t[i],enumerable:!0})},X=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ie(t))!De.call(e,n)&&n!==i&&D(e,n,{get:()=>t[n],enumerable:!(r=Le(t,n))||r.enumerable});return e};var E=(e,t,i)=>(i=e!=null?Oe($e(e)):{},X(t||!e||!e.__esModule?D(i,"default",{value:e,enumerable:!0}):i,e)),We=e=>X(D({},"__esModule",{value:!0}),e);var ft={};Ce(ft,{resolveLoginConfig:()=>Me,shiplightConfig:()=>be});module.exports=We(ft);var Te=E(require("fs"),1),k=E(require("path"),1),ke=E(require("dotenv"),1);var m=require("fs"),Se=require("path"),_e=require("glob");var C=require("yaml");var J=112;var Ge=1080-J;var j={"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"}};var Y={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"]},O=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),Y[e].map(r=>j[r]).filter(r=>r.defaultBrowserType&&i.includes(r.defaultBrowserType))};var Ke={desktop:{label:"Desktop",type:"desktop",devices:O("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:O("mobile")}},Fe={desktop:{label:"Desktop",type:"desktop",devices:O("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:O("mobile",!0)}};var a=require("zod"),q=a.z.enum(["JS_CODE","AI_MODE"]),F=a.z.object({type:q,expression:a.z.string()}),Z=a.z.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),P=a.z.object({uid:a.z.string(),type:Z}),Q=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(),ee=P.extend({type:a.z.literal("DRAFT"),description:a.z.string()}),te=P.extend({type:a.z.literal("ACTION"),description:a.z.string(),action_entity:Q.optional(),locator:a.z.string().optional(),use_pure_vision:a.z.boolean().optional()}),_=a.z.lazy(()=>a.z.union([ee,te,P.extend({type:a.z.literal("STEP"),description:a.z.string().optional().default(""),statements:a.z.array(_),reference_id:a.z.number().optional()}),P.extend({type:a.z.literal("IF_ELSE"),description:a.z.string().optional(),condition:F,then:a.z.array(_),else:a.z.array(_).optional()}),P.extend({type:a.z.literal("WHILE_LOOP"),description:a.z.string().optional(),condition:F,body:a.z.array(_),timeout_ms:a.z.number().optional()})])),H=a.z.object({version:a.z.string().optional(),goal:a.z.string(),url:a.z.string(),final_feedback:a.z.string().optional(),completed:a.z.boolean().optional(),success:a.z.boolean().optional(),statements:a.z.array(_),teardown:a.z.array(_).optional(),last_modified_at:a.z.string().optional()});var B=require("yaml"),w=require("uuid");var ie=1024*1024;function R(e){if(e.length>ie)throw new Error(`YAML input too large (${e.length} bytes, max ${ie})`);let t=(0,B.parse)(e);if(!t||typeof t!="object")throw new Error("Invalid YAML: expected an object at root level");let i={version:"1.2.0",goal:t.goal,url:t.url,statements:A(t.statements??[])};t.final_feedback&&(i.final_feedback=t.final_feedback),t.teardown&&Array.isArray(t.teardown)&&(i.teardown=A(t.teardown));let r=H.safeParse(i);if(!r.success)throw new Error(`Invalid TestFlow after YAML conversion: ${JSON.stringify(r.error.errors)}`);return r.data}function A(e){if(!Array.isArray(e))throw new Error("Expected an array of statements");return e.map(He)}function He(e){if(typeof e=="string")return Be(e);if(typeof e!="object"||e===null)throw new Error(`Invalid statement: expected string or object, got ${typeof e}`);let t=e;if("IF"in t)return Re(t);if("WHILE"in t)return ze(t);if("STEP"in t)return Ve(t);if("action_entity"in t)return Ue(t);if("description"in t&&typeof t.description=="string")return{uid:(0,w.v4)(),type:"DRAFT",description:t.description};throw new Error(`Cannot infer statement type from object: ${JSON.stringify(t)}`)}function Be(e){let t=e.match(/^VERIFY:\s*(.+)$/i);return t?{uid:(0,w.v4)(),type:"ACTION",description:`Verify: ${t[1]}`,action_entity:{action_description:`Verify: ${t[1]}`,action_data:{action_name:"verify",kwargs:{statement:t[1]}}}}:{uid:(0,w.v4)(),type:"DRAFT",description:e}}function re(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 Re(e){let t=re(e.IF),i=e.THEN;if(!Array.isArray(i))throw new Error("IF_ELSE requires a THEN array");let r={uid:(0,w.v4)(),type:"IF_ELSE",condition:t,then:A(i)};return"ELSE"in e&&Array.isArray(e.ELSE)&&(r.else=A(e.ELSE)),r}function ze(e){let t=re(e.WHILE),i=e.DO;if(!Array.isArray(i))throw new Error("WHILE_LOOP requires a DO array");let r={uid:(0,w.v4)(),type:"WHILE_LOOP",condition:t,body:A(i)};return typeof e.timeout_ms=="number"&&(r.timeout_ms=e.timeout_ms),r}function Ve(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,w.v4)(),type:"STEP",description:t,statements:A(e.statements)};return typeof e.reference_id=="number"&&(i.reference_id=e.reference_id),i}function Ue(e){let t=typeof e.description=="string"?e.description:"",i=e.action_entity,r;i&&(r={action_description:t,...i});let n={uid:(0,w.v4)(),type:"ACTION",description:t};return r&&(n.action_entity=r),typeof e.locator=="string"&&(n.locator=e.locator),typeof e.use_pure_vision=="boolean"&&(n.use_pure_vision=e.use_pure_vision),n}var z=18e4;var oe=require("fs"),I=require("path"),L=require("yaml"),ne=5;function ae(e,t){let i={expandingPaths:new Set([(0,I.resolve)(t)]),depth:0,referencedPaths:new Set},r={...e};return Array.isArray(r.statements)&&(r.statements=y(r.statements,t,i)),Array.isArray(r.teardown)&&(r.teardown=y(r.teardown,t,i)),{doc:r,referencedTemplatePaths:Array.from(i.referencedPaths)}}function y(e,t,i){let r=[];for(let n of e)if(je(n)){let o=Ye(n,t,i);r.push(...o)}else r.push(qe(n,t,i));return r}function je(e){return typeof e=="object"&&e!==null&&typeof e.template=="string"}function Ye(e,t,i){if(i.depth>=ne)throw new Error(`Template expansion exceeded maximum depth of ${ne}. Check for deeply nested or circular template references.`);let r=(0,I.resolve)((0,I.dirname)(t),e.template);if(i.expandingPaths.has(r))throw new Error(`Circular template reference detected: ${r} is already being expanded. Stack: ${Array.from(i.expandingPaths).join(" \u2192 ")} \u2192 ${r}`);i.referencedPaths.add(r);let n;try{n=(0,oe.readFileSync)(r,"utf-8")}catch(h){throw new Error(`Failed to read template file: ${r} (referenced from ${t}): ${h.message}`)}let o=(0,L.parse)(n);if(!o||typeof o!="object")throw new Error(`Invalid template file: ${r} \u2014 expected a YAML object`);let l=o.params||[],u=e.params||{};for(let h of l)if(!(h in u))throw new Error(`Template ${e.template} requires param "${h}" but it was not provided. Required params: [${l.join(", ")}]`);let p=o.statements;if(!Array.isArray(p))throw new Error(`Template ${e.template} must have a "statements" array`);if(Object.keys(u).length>0){let d=(0,L.stringify)(p);for(let[M,K]of Object.entries(u))d=d.replaceAll(`{{${M}}}`,String(K));p=(0,L.parse)(d)}let s={expandingPaths:new Set([...i.expandingPaths,r]),depth:i.depth+1,referencedPaths:i.referencedPaths};return y(p,r,s)}function qe(e,t,i){if(typeof e!="object"||e===null)return e;let r={...e};return Array.isArray(r.statements)&&(r.statements=y(r.statements,t,i)),Array.isArray(r.THEN)&&(r.THEN=y(r.THEN,t,i)),Array.isArray(r.ELSE)&&(r.ELSE=y(r.ELSE,t,i)),Array.isArray(r.DO)&&(r.DO=y(r.DO,t,i)),r}function se(e,t){let i=(0,C.parse)(e),r=i?.name,n=i?.tags,o=i?.use;i&&(i.name!==void 0||i.tags!==void 0||i.use!==void 0)&&(delete i.name,delete i.tags,delete i.use);let l=[];if(t&&i&&typeof i=="object"){let s=ae(i,t);i=s.doc,l=s.referencedTemplatePaths}let u=(0,C.stringify)(i);return{testFlow:R(u),name:r,tags:n,use:o,referencedTemplatePaths:l}}function W(e){return e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function S(e){return e.replace(/\r\n/g," ").replace(/\n/g," ").replace(/\r/g," ").trim()}function Ze(e){let t=e.frame_path;return!t||t.length===0?"page":`page.frameLocator('${t[0]}')`}function Qe(e){let t=e.xpath;return typeof t=="string"&&t.trim()?!t.startsWith("xpath=")&&!t.startsWith("/")&&!t.startsWith("//")?`xpath=//${t}`:t.startsWith("xpath=")?t:`xpath=${t}`:null}function V(e){let t=Ze(e),i=e.locator;if(typeof i=="string"&&i.trim())return i=i.trim(),i.endsWith("first()")?`${t}.${i}`:`${t}.${i}.first()`;let r=Qe(e);if(r){let n=JSON.stringify(r);return`${t}.locator(${n}).first()`}return null}var et=["ai_action","ai_step","ai_assert","ai_extract","ai_wait_until","verify","assert"],tt=["js_code","function","wait","wait_for_download_complete","wait_for_page_ready","extract_email_content","extract_activation_code"];function ce(e){let t=e.action_data?.action_name;return!t||(t==="verify"||t==="ai_assert"||t==="assert")&&e.action_data?.kwargs?.code?!1:et.includes(t)}function le(e){let t=e.action_data?.action_name;return!t||(t==="verify"||t==="ai_assert"||t==="assert")&&e.action_data?.kwargs?.code?!1:!tt.includes(t)}var v=/\{\{([A-Za-z_][A-Za-z0-9_]*)\}\}/g;function ue(e){return v.lastIndex=0,v.test(e)}function he(e){if(v.lastIndex=0,!v.test(e))return JSON.stringify(e);v.lastIndex=0;let t=e.match(/^\{\{([A-Za-z_][A-Za-z0-9_]*)\}\}$/);if(t){let r=t[1];return`(process.env.${r} || '{{${r}}}')`}return`\`${e.replace(v,(r,n)=>`\${process.env.${n} || '{{${n}}}'}`)}\``}var f=new Map;function c(e,t){f.set(e,t)}function fe(e){return f.get(e)}function $(e){return typeof e=="string"&&ue(e)?he(e):JSON.stringify(e)}function T(e,t,i=[]){let r=[...i];return t.locator?r.push(`locator: ${JSON.stringify(t.locator)}`):t.xpath&&r.push(`xpath: ${JSON.stringify(t.xpath)}`),t.frame_path&&t.frame_path.length>0&&r.push(`frame_path: ${JSON.stringify(t.frame_path)}`),r.length===0?[`await agent.execAction("${e}", page, {});`]:[`await agent.execAction("${e}", page, {`,...r.map(n=>` ${n},`),"});"]}c("click",e=>{let t=V(e);return t?[`await ${t}.click({ timeout: ${5e3} });`]:['await agent.execAction("click", page, {});']});c("click_element",f.get("click"));c("click_element_by_index",f.get("click"));c("double_click",e=>T("double_click",e));c("double_click_on_element",f.get("double_click"));c("right_click",e=>T("right_click",e));c("right_click_on_element",f.get("right_click"));c("hover",e=>T("hover",e));c("hover_element_by_index",f.get("hover"));c("input_text",e=>{let t=e.action_data?.kwargs?.text??e.action_data?.kwargs?.value??"";return T("input_text",e,[`action_data: { kwargs: { text: ${$(t)} } }`])});c("fill",f.get("input_text"));c("clear_input",e=>T("clear_input",e));c("press",e=>{let t=e.action_data?.kwargs?.keys;return[`await page.keyboard.press(${JSON.stringify(t)});`]});c("send_keys",f.get("press"));c("send_keys_on_element",e=>{let t=V(e),i=e.action_data?.kwargs?.keys||"";return t?[`await ${t}.press(${JSON.stringify(i)}, { timeout: ${5e3} });`]:['await agent.execAction("send_keys_on_element", page, {',` action_data: { kwargs: { keys: ${JSON.stringify(i)} } },`,"});"]});c("select_dropdown_option",e=>{let t=e.action_data?.kwargs?.text||e.action_data?.kwargs?.option||"";return T("select_dropdown_option",e,[`action_data: { kwargs: { text: ${$(t)} } }`])});c("scroll",e=>{let t=e.action_data?.kwargs?.down??!0;return[`await page.evaluate('window.scrollBy(0, window.innerHeight * ${(e.action_data?.kwargs?.num_pages??1)*(t?1:-1)})');`]});c("scroll_down",f.get("scroll"));c("scroll_up",f.get("scroll"));c("scroll_element",f.get("scroll"));c("scroll_to_text",e=>{let t=e.action_data?.kwargs?.text||"";return[`await page.getByText(${$(t)}, { exact: false }).first().scrollIntoViewIfNeeded();`]});c("scroll_on_element",e=>T("scroll_on_element",e,[`action_data: { kwargs: ${JSON.stringify(e.action_data?.kwargs||{})} }`]));c("go_to_url",e=>{let t=e.action_data?.kwargs?.url||"";return e.action_data?.kwargs?.new_tab===!0?['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { url: ${$(t)}, new_tab: true } },`,"});"]:['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { url: ${$(t)} } },`,"});"]});c("open_tab",f.get("go_to_url"));c("go_back",()=>['await agent.execAction("go_back", page, {});']);c("reload_page",()=>['await agent.execAction("reload_page", page, {});']);c("wait",e=>[`await page.waitForTimeout(${(e.action_data?.kwargs?.seconds||1)*1e3});`]);c("wait_for_page_ready",()=>["await page.waitForLoadState('domcontentloaded');"]);c("verify",(e,t)=>{let i=e.action_data?.kwargs;if(i?.code)return i.code.split(`
1
+ "use strict";var Oe=Object.create;var D=Object.defineProperty;var Le=Object.getOwnPropertyDescriptor;var Ie=Object.getOwnPropertyNames;var $e=Object.getPrototypeOf,De=Object.prototype.hasOwnProperty;var Ce=(e,t)=>{for(var i in t)D(e,i,{get:t[i],enumerable:!0})},X=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ie(t))!De.call(e,n)&&n!==i&&D(e,n,{get:()=>t[n],enumerable:!(r=Le(t,n))||r.enumerable});return e};var E=(e,t,i)=>(i=e!=null?Oe($e(e)):{},X(t||!e||!e.__esModule?D(i,"default",{value:e,enumerable:!0}):i,e)),We=e=>X(D({},"__esModule",{value:!0}),e);var ft={};Ce(ft,{resolveLoginConfig:()=>Me,shiplightConfig:()=>ke});module.exports=We(ft);var Te=E(require("fs"),1),b=E(require("path"),1),be=E(require("dotenv"),1);var m=require("fs"),Se=require("path"),_e=require("glob");var C=require("yaml");var J=112;var Ge=1080-J;var j={"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"}};var Y={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"]},O=(e,t=!1)=>{let i=["chromium"];return t&&i.push("webkit"),Y[e].map(r=>j[r]).filter(r=>r.defaultBrowserType&&i.includes(r.defaultBrowserType))};var Ke={desktop:{label:"Desktop",type:"desktop",devices:O("desktop")},mobile:{label:"Mobile Web",type:"mobile",devices:O("mobile")}},Fe={desktop:{label:"Desktop",type:"desktop",devices:O("desktop",!0)},mobile:{label:"Mobile Web",type:"mobile",devices:O("mobile",!0)}};var a=require("zod"),q=a.z.enum(["JS_CODE","AI_MODE"]),F=a.z.object({type:q,expression:a.z.string()}),Z=a.z.enum(["DRAFT","STEP","ACTION","IF_ELSE","WHILE_LOOP"]),P=a.z.object({uid:a.z.string(),type:Z}),Q=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(),ee=P.extend({type:a.z.literal("DRAFT"),description:a.z.string()}),te=P.extend({type:a.z.literal("ACTION"),description:a.z.string(),action_entity:Q.optional(),locator:a.z.string().optional(),use_pure_vision:a.z.boolean().optional()}),_=a.z.lazy(()=>a.z.union([ee,te,P.extend({type:a.z.literal("STEP"),description:a.z.string().optional().default(""),statements:a.z.array(_),reference_id:a.z.number().optional()}),P.extend({type:a.z.literal("IF_ELSE"),description:a.z.string().optional(),condition:F,then:a.z.array(_),else:a.z.array(_).optional()}),P.extend({type:a.z.literal("WHILE_LOOP"),description:a.z.string().optional(),condition:F,body:a.z.array(_),timeout_ms:a.z.number().optional()})])),H=a.z.object({version:a.z.string().optional(),goal:a.z.string(),url:a.z.string(),final_feedback:a.z.string().optional(),completed:a.z.boolean().optional(),success:a.z.boolean().optional(),statements:a.z.array(_),teardown:a.z.array(_).optional(),last_modified_at:a.z.string().optional()});var B=require("yaml"),w=require("uuid");var ie=1024*1024;function R(e){if(e.length>ie)throw new Error(`YAML input too large (${e.length} bytes, max ${ie})`);let t=(0,B.parse)(e);if(!t||typeof t!="object")throw new Error("Invalid YAML: expected an object at root level");let i={version:"1.2.0",goal:t.goal,url:t.url,statements:A(t.statements??[])};t.final_feedback&&(i.final_feedback=t.final_feedback),t.teardown&&Array.isArray(t.teardown)&&(i.teardown=A(t.teardown));let r=H.safeParse(i);if(!r.success)throw new Error(`Invalid TestFlow after YAML conversion: ${JSON.stringify(r.error.errors)}`);return r.data}function A(e){if(!Array.isArray(e))throw new Error("Expected an array of statements");return e.map(He)}function He(e){if(typeof e=="string")return Be(e);if(typeof e!="object"||e===null)throw new Error(`Invalid statement: expected string or object, got ${typeof e}`);let t=e;if("IF"in t)return Re(t);if("WHILE"in t)return ze(t);if("STEP"in t)return Ve(t);if("action_entity"in t)return Ue(t);if("description"in t&&typeof t.description=="string")return{uid:(0,w.v4)(),type:"DRAFT",description:t.description};throw new Error(`Cannot infer statement type from object: ${JSON.stringify(t)}`)}function Be(e){let t=e.match(/^VERIFY:\s*(.+)$/i);return t?{uid:(0,w.v4)(),type:"ACTION",description:`Verify: ${t[1]}`,action_entity:{action_description:`Verify: ${t[1]}`,action_data:{action_name:"verify",kwargs:{statement:t[1]}}}}:{uid:(0,w.v4)(),type:"DRAFT",description:e}}function re(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 Re(e){let t=re(e.IF),i=e.THEN;if(!Array.isArray(i))throw new Error("IF_ELSE requires a THEN array");let r={uid:(0,w.v4)(),type:"IF_ELSE",condition:t,then:A(i)};return"ELSE"in e&&Array.isArray(e.ELSE)&&(r.else=A(e.ELSE)),r}function ze(e){let t=re(e.WHILE),i=e.DO;if(!Array.isArray(i))throw new Error("WHILE_LOOP requires a DO array");let r={uid:(0,w.v4)(),type:"WHILE_LOOP",condition:t,body:A(i)};return typeof e.timeout_ms=="number"&&(r.timeout_ms=e.timeout_ms),r}function Ve(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,w.v4)(),type:"STEP",description:t,statements:A(e.statements)};return typeof e.reference_id=="number"&&(i.reference_id=e.reference_id),i}function Ue(e){let t=typeof e.description=="string"?e.description:"",i=e.action_entity,r;i&&(r={action_description:t,...i});let n={uid:(0,w.v4)(),type:"ACTION",description:t};return r&&(n.action_entity=r),typeof e.locator=="string"&&(n.locator=e.locator),typeof e.use_pure_vision=="boolean"&&(n.use_pure_vision=e.use_pure_vision),n}var z=18e4;var oe=require("fs"),I=require("path"),L=require("yaml"),ne=5;function ae(e,t){let i={expandingPaths:new Set([(0,I.resolve)(t)]),depth:0,referencedPaths:new Set},r={...e};return Array.isArray(r.statements)&&(r.statements=y(r.statements,t,i)),Array.isArray(r.teardown)&&(r.teardown=y(r.teardown,t,i)),{doc:r,referencedTemplatePaths:Array.from(i.referencedPaths)}}function y(e,t,i){let r=[];for(let n of e)if(je(n)){let o=Ye(n,t,i);r.push(...o)}else r.push(qe(n,t,i));return r}function je(e){return typeof e=="object"&&e!==null&&typeof e.template=="string"}function Ye(e,t,i){if(i.depth>=ne)throw new Error(`Template expansion exceeded maximum depth of ${ne}. Check for deeply nested or circular template references.`);let r=(0,I.resolve)((0,I.dirname)(t),e.template);if(i.expandingPaths.has(r))throw new Error(`Circular template reference detected: ${r} is already being expanded. Stack: ${Array.from(i.expandingPaths).join(" \u2192 ")} \u2192 ${r}`);i.referencedPaths.add(r);let n;try{n=(0,oe.readFileSync)(r,"utf-8")}catch(h){throw new Error(`Failed to read template file: ${r} (referenced from ${t}): ${h.message}`)}let o=(0,L.parse)(n);if(!o||typeof o!="object")throw new Error(`Invalid template file: ${r} \u2014 expected a YAML object`);let l=o.params||[],u=e.params||{};for(let h of l)if(!(h in u))throw new Error(`Template ${e.template} requires param "${h}" but it was not provided. Required params: [${l.join(", ")}]`);let p=o.statements;if(!Array.isArray(p))throw new Error(`Template ${e.template} must have a "statements" array`);if(Object.keys(u).length>0){let d=(0,L.stringify)(p);for(let[M,K]of Object.entries(u))d=d.replaceAll(`{{${M}}}`,String(K));p=(0,L.parse)(d)}let s={expandingPaths:new Set([...i.expandingPaths,r]),depth:i.depth+1,referencedPaths:i.referencedPaths};return y(p,r,s)}function qe(e,t,i){if(typeof e!="object"||e===null)return e;let r={...e};return Array.isArray(r.statements)&&(r.statements=y(r.statements,t,i)),Array.isArray(r.THEN)&&(r.THEN=y(r.THEN,t,i)),Array.isArray(r.ELSE)&&(r.ELSE=y(r.ELSE,t,i)),Array.isArray(r.DO)&&(r.DO=y(r.DO,t,i)),r}function se(e,t){let i=(0,C.parse)(e),r=i?.name,n=i?.tags,o=i?.use;i&&(i.name!==void 0||i.tags!==void 0||i.use!==void 0)&&(delete i.name,delete i.tags,delete i.use);let l=[];if(t&&i&&typeof i=="object"){let s=ae(i,t);i=s.doc,l=s.referencedTemplatePaths}let u=(0,C.stringify)(i);return{testFlow:R(u),name:r,tags:n,use:o,referencedTemplatePaths:l}}function W(e){return e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function S(e){return e.replace(/\r\n/g," ").replace(/\n/g," ").replace(/\r/g," ").trim()}function Ze(e){let t=e.frame_path;return!t||t.length===0?"page":`page.frameLocator('${t[0]}')`}function Qe(e){let t=e.xpath;return typeof t=="string"&&t.trim()?!t.startsWith("xpath=")&&!t.startsWith("/")&&!t.startsWith("//")?`xpath=//${t}`:t.startsWith("xpath=")?t:`xpath=${t}`:null}function V(e){let t=Ze(e),i=e.locator;if(typeof i=="string"&&i.trim())return i=i.trim(),i.endsWith("first()")?`${t}.${i}`:`${t}.${i}.first()`;let r=Qe(e);if(r){let n=JSON.stringify(r);return`${t}.locator(${n}).first()`}return null}var et=["ai_action","ai_step","ai_assert","ai_extract","ai_wait_until","verify","assert"],tt=["js_code","function","wait","wait_for_download_complete","wait_for_page_ready","extract_email_content","extract_activation_code"];function ce(e){let t=e.action_data?.action_name;return!t||(t==="verify"||t==="ai_assert"||t==="assert")&&e.action_data?.kwargs?.code?!1:et.includes(t)}function le(e){let t=e.action_data?.action_name;return!t||(t==="verify"||t==="ai_assert"||t==="assert")&&e.action_data?.kwargs?.code?!1:!tt.includes(t)}var v=/\{\{([A-Za-z_][A-Za-z0-9_]*)\}\}/g;function ue(e){return v.lastIndex=0,v.test(e)}function he(e){if(v.lastIndex=0,!v.test(e))return JSON.stringify(e);v.lastIndex=0;let t=e.match(/^\{\{([A-Za-z_][A-Za-z0-9_]*)\}\}$/);if(t){let r=t[1];return`(process.env.${r} || '{{${r}}}')`}return`\`${e.replace(v,(r,n)=>`\${process.env.${n} || '{{${n}}}'}`)}\``}var f=new Map;function c(e,t){f.set(e,t)}function fe(e){return f.get(e)}function $(e){return typeof e=="string"&&ue(e)?he(e):JSON.stringify(e)}function T(e,t,i=[]){let r=[...i];return t.locator?r.push(`locator: ${JSON.stringify(t.locator)}`):t.xpath&&r.push(`xpath: ${JSON.stringify(t.xpath)}`),t.frame_path&&t.frame_path.length>0&&r.push(`frame_path: ${JSON.stringify(t.frame_path)}`),r.length===0?[`await agent.execAction("${e}", page, {});`]:[`await agent.execAction("${e}", page, {`,...r.map(n=>` ${n},`),"});"]}c("click",e=>{let t=V(e);return t?[`await ${t}.click({ timeout: ${5e3} });`]:['await agent.execAction("click", page, {});']});c("click_element",f.get("click"));c("click_element_by_index",f.get("click"));c("double_click",e=>T("double_click",e));c("double_click_on_element",f.get("double_click"));c("right_click",e=>T("right_click",e));c("right_click_on_element",f.get("right_click"));c("hover",e=>T("hover",e));c("hover_element_by_index",f.get("hover"));c("input_text",e=>{let t=e.action_data?.kwargs?.text??e.action_data?.kwargs?.value??"";return T("input_text",e,[`action_data: { kwargs: { text: ${$(t)} } }`])});c("fill",f.get("input_text"));c("clear_input",e=>T("clear_input",e));c("press",e=>{let t=e.action_data?.kwargs?.keys;return[`await page.keyboard.press(${JSON.stringify(t)});`]});c("send_keys",f.get("press"));c("send_keys_on_element",e=>{let t=V(e),i=e.action_data?.kwargs?.keys||"";return t?[`await ${t}.press(${JSON.stringify(i)}, { timeout: ${5e3} });`]:['await agent.execAction("send_keys_on_element", page, {',` action_data: { kwargs: { keys: ${JSON.stringify(i)} } },`,"});"]});c("select_dropdown_option",e=>{let t=e.action_data?.kwargs?.text||e.action_data?.kwargs?.option||"";return T("select_dropdown_option",e,[`action_data: { kwargs: { text: ${$(t)} } }`])});c("scroll",e=>{let t=e.action_data?.kwargs?.down??!0;return[`await page.evaluate('window.scrollBy(0, window.innerHeight * ${(e.action_data?.kwargs?.num_pages??1)*(t?1:-1)})');`]});c("scroll_down",f.get("scroll"));c("scroll_up",f.get("scroll"));c("scroll_element",f.get("scroll"));c("scroll_to_text",e=>{let t=e.action_data?.kwargs?.text||"";return[`await page.getByText(${$(t)}, { exact: false }).first().scrollIntoViewIfNeeded();`]});c("scroll_on_element",e=>T("scroll_on_element",e,[`action_data: { kwargs: ${JSON.stringify(e.action_data?.kwargs||{})} }`]));c("go_to_url",e=>{let t=e.action_data?.kwargs?.url||"";return e.action_data?.kwargs?.new_tab===!0?['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { url: ${$(t)}, new_tab: true } },`,"});"]:['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { url: ${$(t)} } },`,"});"]});c("open_tab",f.get("go_to_url"));c("go_back",()=>['await agent.execAction("go_back", page, {});']);c("reload_page",()=>['await agent.execAction("reload_page", page, {});']);c("wait",e=>[`await page.waitForTimeout(${(e.action_data?.kwargs?.seconds||1)*1e3});`]);c("wait_for_page_ready",()=>["await page.waitForLoadState('domcontentloaded');"]);c("verify",(e,t)=>{let i=e.action_data?.kwargs;if(i?.code)return i.code.split(`
2
2
  `);let r=i?.statement||e.action_description;return r?[`await agent.assert(page, ${JSON.stringify(r)}, '${t||""}');`]:["// Skipping verify: missing statement or code"]});c("ai_assert",f.get("verify"));c("assert",f.get("verify"));c("ai_action",(e,t)=>{let i=e.action_data?.kwargs?.statement;if(!i)return["// Skipping ai_action: missing statement"];let r=JSON.stringify(i),n=e.action_data?.kwargs?.use_pure_vision;return[`await agent.execute(page, ${r}, '${t||""}', ${n});`]});c("ai_step",(e,t)=>{let i=e.action_data?.kwargs?.statement;return i?[`await agent.run(page, ${JSON.stringify(i)}, '${t||""}');`]:["// Skipping ai_step: missing statement"]});c("ai_extract",(e,t)=>{let i=e.action_data?.kwargs?.element_description,r=e.action_data?.kwargs?.variable_name;if(!i||!r)return["// Skipping ai_extract: missing element_description or variable_name"];let n=JSON.stringify(i),o=JSON.stringify(r);return[`await agent.extract(page, ${n}, ${o}, '${t||""}');`]});c("ai_wait_until",(e,t)=>{let i=e.action_data?.kwargs?.condition,r=e.action_data?.kwargs?.timeout_seconds||60;return i?[`await agent.waitUntilCondition(page, ${JSON.stringify(i)}, ${r}, '${t||""}');`]:["// Skipping ai_wait_until: missing condition"]});c("save_variable",e=>{let t=e.action_data?.kwargs?.name||"",i=e.action_data?.kwargs?.value;return['await agent.execAction("save_variable", page, {',` action_data: { kwargs: { name: ${JSON.stringify(t)}, value: ${JSON.stringify(i)} } },`,"});"]});c("js_code",e=>{let t=e.action_data?.kwargs?.code;if(!t)return["// Skipping js_code: missing code"];let i=["{"],r=t.split(`
3
- `);for(let n of r)i.push(` ${n}`);return i.push("}"),i});c("function",(e,t,i)=>{let r=e.action_data?.kwargs||{},n=r.functionName;if(n&&n.includes("#")){let[l,u]=n.split("#");if(l&&u){let p=l.replace(/\.(ts|js|mjs)$/,""),s=`import { ${u} } from '${p}';`;i?.imports?.add(s);let h={...r,functionName:u},d=pe(h);return d?[d.endsWith(";")?d:`${d};`]:["// Skipping function: invalid export pattern"]}}let o=pe(r);return o?[o.endsWith(";")?o:`${o};`]:["// Skipping function: missing functionName"]});c("generate_2fa_code",e=>{let t=e.action_data?.kwargs?.otp_secret_key||"";return['await agent.execAction("generate_2fa_code", page, {',` action_data: { kwargs: { otp_secret_key: ${JSON.stringify(t)} } },`,"});"]});c("upload_file",e=>{let t=e.action_data?.kwargs||{},i=[],r={};return t.paths?r.paths=t.paths:t.path&&(r.path=t.path),t.use_file_input&&(r.use_file_input=!0),i.push(`action_data: { kwargs: ${JSON.stringify(r)} }`),e.locator?i.push(`locator: ${JSON.stringify(e.locator)}`):e.xpath&&i.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&i.push(`frame_path: ${JSON.stringify(e.frame_path)}`),['await agent.execAction("upload_file", page, {',...i.map(n=>` ${n},`),"});"]});c("wait_for_download_complete",e=>['await agent.execAction("wait_for_download_complete", page, {',` action_data: { kwargs: { timeout_seconds: ${e.action_data?.kwargs?.timeout_seconds||10} } },`,"});"]);c("switch_tab",e=>['await agent.execAction("switch_tab", page, {',` action_data: { kwargs: { page_id: ${e.action_data?.kwargs?.page_id??0} } },`,"});"]);c("close_tab",e=>{let t=e.action_data?.kwargs?.page_id;return t=t??e.action_data?.kwargs?.index,['await agent.execAction("close_tab", page, {',` action_data: { kwargs: { page_id: ${t} } },`,"});"]});c("set_date_for_native_date_picker",e=>{let t=e.action_data?.kwargs?.date??"",i=[];return i.push(`action_data: { kwargs: { date: ${JSON.stringify(t)} } }`),e.locator?i.push(`locator: ${JSON.stringify(e.locator)}`):e.xpath&&i.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&i.push(`frame_path: ${JSON.stringify(e.frame_path)}`),['await agent.execAction("set_date_for_native_date_picker", page, {',...i.map(r=>` ${r},`),"});"]});c("done",()=>["// Done - no action needed"]);function pe(e){let t=e.functionName;if(!t)return null;let i={},r=e.parameterNames||[],n=e.parameterValues||e.args||[];if(r.forEach((p,s)=>{s<n.length&&(i[p]=n[s])}),Object.keys(i).length===0)return`await ${t}()`;let o=["page","testContext","request","agentServices"],l=["undefined","null","true","false"],u=Object.entries(i).map(([p,s])=>{let h=String(s);return s==null?"undefined":o.includes(p)&&o.includes(h)||l.includes(h)||/^-?\d+(\.\d+)?$/.test(h)?h:h.startsWith("$")?`agent.agentServices.readVariable('${h.substring(1)}')`:`"${h}"`});return`await ${t}(${u.join(", ")})`}function g(e,t,i,r="main"){let n=[];for(let o=0;o<e.length;o++){let l=e[o],u=`${r}.${o}`,p=it(l,t,u,i);p.length>0&&(n.push(...p),o<e.length-1&&n.push(""))}return n}function it(e,t,i,r){let n=" ".repeat(t);switch(e.type){case"DRAFT":return rt(e,t,i);case"ACTION":return nt(e,t,i,r);case"STEP":return ot(e,t,i,r);case"IF_ELSE":return at(e,t,i,r);case"WHILE_LOOP":return st(e,t,i,r);default:return[`${n}// Unknown statement type: ${e.type}`]}}function rt(e,t,i){let r=" ".repeat(t),n=e.description?.trim()||"";if(!n)return[`${r}// ${i}: Skipping - no description`];let o=JSON.stringify(n);return[`${r}// ${i}: ${S(n)}`,`${r}page = agent.agentServices.validatePage(page);`,`${r}await agent.run(page, ${o}, '${i}');`]}function nt(e,t,i,r){let n=" ".repeat(t),o=e.description,l=e.uid,p=r.actionEntityStore?.entries[e.uid]?.action_entity??e.action_entity;if(!p){if(!o)return[`${n}// ${i}: Skipping - no description`];let x=JSON.stringify(o),Ee=!!e.use_pure_vision;return[`${n}// ${i}: ${S(o)}`,`${n}page = agent.agentServices.validatePage(page);`,`${n}await agent.execute(page, ${x}, '${i}', ${Ee});`]}let s=e.locator?{...p,locator:e.locator}:p;o&&o!==s.action_description&&(s={...s,action_description:o});let h=s.action_data?.action_name||"",d=s.action_description||"",M=fe(h);if(!M)return[`${n}// ${i}: Unknown action: ${h}`];let K={imports:r.imports},U=M(s,i,K);if(ce(s))return[`${n}// ${i}: ${S(d)}`,`${n}page = agent.agentServices.validatePage(page);`,...U.map(x=>`${n}${x}`)];let Pe=JSON.stringify(d),Ae=U.map(x=>`${n} ${x}`),ve=le(s),xe=l?`'${l}'`:"undefined";return[`${n}// ${i}: ${S(d)}`,`${n}page = agent.agentServices.validatePage(page);`,`${n}await agent.step(page, async () => {`,...Ae,`${n}}, ${Pe}, '${i}', ${xe}, ${ve});`]}function ot(e,t,i,r){let n=" ".repeat(t),o=[];e.description&&e.description.trim()&&o.push(`${n}// Step: ${S(e.description)}`);let l=g(e.statements,t,r,i);return o.push(...l),o}function at(e,t,i,r){let n=" ".repeat(t),o=[];if(o.push(`${n}// ${i}: Conditional check`),e.condition.type==="JS_CODE")o.push(`${n}if (${e.condition.expression}) {`);else{o.push(`${n}// AI Condition: ${S(e.condition.expression)}`);let u=JSON.stringify(e.condition.expression);o.push(`${n}if (await agent.evaluate(page, ${u}, "${i}")) {`)}let l=g(e.then,t+1,r,`${i}.then`);if(o.push(...l),e.else&&e.else.length>0){o.push(`${n}} else {`);let u=g(e.else,t+1,r,`${i}.else`);o.push(...u)}return o.push(`${n}}`),o}function st(e,t,i,r){let n=" ".repeat(t),o=[];o.push(`${n}// ${i}: Loop`);let l=e.timeout_ms??z,u=l/1e3,p=e.timeout_ms?`While loop exceeded timeout of ${u}s`:`While loop exceeded default timeout of ${u}s`,s=`loop_${i.replace(/\./g,"_")}`;if(o.push(`${n}const ${s}_start = Date.now();`),o.push(`${n}const ${s}_timeout = ${l};`),o.push(`${n}const ${s}_check = () => {`),o.push(`${n} if (Date.now() - ${s}_start > ${s}_timeout) {`),o.push(`${n} throw new Error('${p}');`),o.push(`${n} }`),o.push(`${n} return true;`),o.push(`${n}};`),e.condition.type==="JS_CODE")o.push(`${n}while (${s}_check() && (${e.condition.expression})) {`);else{o.push(`${n}// AI Loop Condition: ${S(e.condition.expression)}`);let d=JSON.stringify(e.condition.expression);o.push(`${n}while (${s}_check() && await agent.evaluate(page, ${d}, "${i}")) {`)}let h=g(e.body,t+1,r,`${i}.body`);return o.push(...h),o.push(`${n}}`),o}var ge={name:"shiplightai",version:"0.1.2",type:"module",description:"Shiplight CLI for running and debugging .test.yaml files",main:"dist/index.js",types:"dist/index.d.ts",bin:{shiplight:"./dist/cli.js"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/cjs/index.cjs",default:"./dist/index.js"},"./fixture":{types:"./dist/fixture.d.ts",import:"./dist/fixture.js",require:"./dist/cjs/fixture.cjs",default:"./dist/fixture.js"}},files:["dist","README.md"],publishConfig:{registry:"https://registry.npmjs.org",access:"public"},scripts:{build:"tsup","build:cli":"tsup",clean:"rm -rf dist",dev:"tsup --watch",test:"playwright test",typecheck:"tsc --noEmit"},dependencies:{"@anthropic-ai/claude-agent-sdk":"^0.1.72","@modelcontextprotocol/sdk":"^0.5.0",axios:"^1.6.0",dotenv:"^16.0.3",express:"^4.21.0",glob:"^13.0.0",open:"^10.1.0",sharp:"^0.34.5",uuid:"^11.1.0",yaml:"^2.8.0",zod:"^3.22.0","zod-to-json-schema":"^3.24.6"},devDependencies:{"@playwright/test":"1.55.0","@shiplightai/sdk-pro":"workspace:*","@types/express":"^4.17.21","@types/node":"^24.0.0",copilot3:"workspace:*","mcp-tools":"workspace:*","sdk-core":"workspace:*","sdk-internal":"workspace:*","shiplight-types":"workspace:*",tsup:"^8.3.5",typescript:"5.5.4","web-session":"workspace:*"},peerDependencies:{"@playwright/test":"1.55.0","@shiplightai/sdk-pro":">=0.2.0"},engines:{node:">=22.0.0"},keywords:["playwright","yaml","testing","automation","ai","shiplight","mcp"],author:"Shiplight",license:"MIT"};var N=ge.version;function me(e,t){let i=[];i.push(`// @generated by shiplightai v${N}`),i.push(...lt()),i.push(""),t?.use&&Object.keys(t.use).length>0&&(i.push(`test.use(${JSON.stringify(t.use,null,2)});`),i.push(""));let r=t?.testName||e.goal||"Generated test",n=t?.tags&&t.tags.length>0?t.tags.map(s=>`@${s}`).join(" ")+" ":"";i.push(`test('${n}${W(r)}', async ({ page, agent }) => {`);let o=t?.startingUrl||e.url;if(o){let s;try{s=new URL(o).pathname}catch{s=o}i.push(` await page.goto('${W(s)}', { waitUntil: 'domcontentloaded' });`),i.push("")}let l=new Set,u={imports:l};if(e.teardown&&e.teardown.length>0){if(i.push(" try {"),e.statements&&e.statements.length>0){i.push(" // Test steps");let h=g(e.statements,2,u);i.push(...h)}i.push(" } finally {"),i.push(" // Teardown");let s=g(e.teardown,2,u,"teardown");i.push(...s),i.push(" }")}else if(e.statements&&e.statements.length>0){i.push(" // Test steps");let s=g(e.statements,1,u);i.push(...s)}if(i.push("});"),l.size>0){let s=0;for(let d=0;d<i.length;d++)i[d].startsWith("import ")&&(s=d+1);let h=Array.from(l);i.splice(s,0,...h)}return i.join(`
3
+ `);for(let n of r)i.push(` ${n}`);return i.push("}"),i});c("function",(e,t,i)=>{let r=e.action_data?.kwargs||{},n=r.functionName;if(n&&n.includes("#")){let[l,u]=n.split("#");if(l&&u){let p=l.replace(/\.(ts|js|mjs)$/,""),s=`import { ${u} } from '${p}';`;i?.imports?.add(s);let h={...r,functionName:u},d=pe(h);return d?[d.endsWith(";")?d:`${d};`]:["// Skipping function: invalid export pattern"]}}let o=pe(r);return o?[o.endsWith(";")?o:`${o};`]:["// Skipping function: missing functionName"]});c("generate_2fa_code",e=>{let t=e.action_data?.kwargs?.otp_secret_key||"";return['await agent.execAction("generate_2fa_code", page, {',` action_data: { kwargs: { otp_secret_key: ${JSON.stringify(t)} } },`,"});"]});c("upload_file",e=>{let t=e.action_data?.kwargs||{},i=[],r={};return t.paths?r.paths=t.paths:t.path&&(r.path=t.path),t.use_file_input&&(r.use_file_input=!0),i.push(`action_data: { kwargs: ${JSON.stringify(r)} }`),e.locator?i.push(`locator: ${JSON.stringify(e.locator)}`):e.xpath&&i.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&i.push(`frame_path: ${JSON.stringify(e.frame_path)}`),['await agent.execAction("upload_file", page, {',...i.map(n=>` ${n},`),"});"]});c("wait_for_download_complete",e=>['await agent.execAction("wait_for_download_complete", page, {',` action_data: { kwargs: { timeout_seconds: ${e.action_data?.kwargs?.timeout_seconds||10} } },`,"});"]);c("switch_tab",e=>['await agent.execAction("switch_tab", page, {',` action_data: { kwargs: { page_id: ${e.action_data?.kwargs?.page_id??0} } },`,"});"]);c("close_tab",e=>{let t=e.action_data?.kwargs?.page_id;return t=t??e.action_data?.kwargs?.index,['await agent.execAction("close_tab", page, {',` action_data: { kwargs: { page_id: ${t} } },`,"});"]});c("set_date_for_native_date_picker",e=>{let t=e.action_data?.kwargs?.date??"",i=[];return i.push(`action_data: { kwargs: { date: ${JSON.stringify(t)} } }`),e.locator?i.push(`locator: ${JSON.stringify(e.locator)}`):e.xpath&&i.push(`xpath: ${JSON.stringify(e.xpath)}`),e.frame_path&&e.frame_path.length>0&&i.push(`frame_path: ${JSON.stringify(e.frame_path)}`),['await agent.execAction("set_date_for_native_date_picker", page, {',...i.map(r=>` ${r},`),"});"]});c("done",()=>["// Done - no action needed"]);function pe(e){let t=e.functionName;if(!t)return null;let i={},r=e.parameterNames||[],n=e.parameterValues||e.args||[];if(r.forEach((p,s)=>{s<n.length&&(i[p]=n[s])}),Object.keys(i).length===0)return`await ${t}()`;let o=["page","testContext","request","agentServices"],l=["undefined","null","true","false"],u=Object.entries(i).map(([p,s])=>{let h=String(s);return s==null?"undefined":o.includes(p)&&o.includes(h)||l.includes(h)||/^-?\d+(\.\d+)?$/.test(h)?h:h.startsWith("$")?`agent.agentServices.readVariable('${h.substring(1)}')`:`"${h}"`});return`await ${t}(${u.join(", ")})`}function g(e,t,i,r="main"){let n=[];for(let o=0;o<e.length;o++){let l=e[o],u=`${r}.${o}`,p=it(l,t,u,i);p.length>0&&(n.push(...p),o<e.length-1&&n.push(""))}return n}function it(e,t,i,r){let n=" ".repeat(t);switch(e.type){case"DRAFT":return rt(e,t,i);case"ACTION":return nt(e,t,i,r);case"STEP":return ot(e,t,i,r);case"IF_ELSE":return at(e,t,i,r);case"WHILE_LOOP":return st(e,t,i,r);default:return[`${n}// Unknown statement type: ${e.type}`]}}function rt(e,t,i){let r=" ".repeat(t),n=e.description?.trim()||"";if(!n)return[`${r}// ${i}: Skipping - no description`];let o=JSON.stringify(n);return[`${r}// ${i}: ${S(n)}`,`${r}page = agent.agentServices.validatePage(page);`,`${r}await agent.run(page, ${o}, '${i}');`]}function nt(e,t,i,r){let n=" ".repeat(t),o=e.description,l=e.uid,p=r.actionEntityStore?.entries[e.uid]?.action_entity??e.action_entity;if(!p){if(!o)return[`${n}// ${i}: Skipping - no description`];let x=JSON.stringify(o),Ee=!!e.use_pure_vision;return[`${n}// ${i}: ${S(o)}`,`${n}page = agent.agentServices.validatePage(page);`,`${n}await agent.execute(page, ${x}, '${i}', ${Ee});`]}let s=e.locator?{...p,locator:e.locator}:p;o&&o!==s.action_description&&(s={...s,action_description:o});let h=s.action_data?.action_name||"",d=s.action_description||"",M=fe(h);if(!M)return[`${n}// ${i}: Unknown action: ${h}`];let K={imports:r.imports},U=M(s,i,K);if(ce(s))return[`${n}// ${i}: ${S(d)}`,`${n}page = agent.agentServices.validatePage(page);`,...U.map(x=>`${n}${x}`)];let Pe=JSON.stringify(d),Ae=U.map(x=>`${n} ${x}`),ve=le(s),xe=l?`'${l}'`:"undefined";return[`${n}// ${i}: ${S(d)}`,`${n}page = agent.agentServices.validatePage(page);`,`${n}await agent.step(page, async () => {`,...Ae,`${n}}, ${Pe}, '${i}', ${xe}, ${ve});`]}function ot(e,t,i,r){let n=" ".repeat(t),o=[];e.description&&e.description.trim()&&o.push(`${n}// Step: ${S(e.description)}`);let l=g(e.statements,t,r,i);return o.push(...l),o}function at(e,t,i,r){let n=" ".repeat(t),o=[];if(o.push(`${n}// ${i}: Conditional check`),e.condition.type==="JS_CODE")o.push(`${n}if (${e.condition.expression}) {`);else{o.push(`${n}// AI Condition: ${S(e.condition.expression)}`);let u=JSON.stringify(e.condition.expression);o.push(`${n}if (await agent.evaluate(page, ${u}, "${i}")) {`)}let l=g(e.then,t+1,r,`${i}.then`);if(o.push(...l),e.else&&e.else.length>0){o.push(`${n}} else {`);let u=g(e.else,t+1,r,`${i}.else`);o.push(...u)}return o.push(`${n}}`),o}function st(e,t,i,r){let n=" ".repeat(t),o=[];o.push(`${n}// ${i}: Loop`);let l=e.timeout_ms??z,u=l/1e3,p=e.timeout_ms?`While loop exceeded timeout of ${u}s`:`While loop exceeded default timeout of ${u}s`,s=`loop_${i.replace(/\./g,"_")}`;if(o.push(`${n}const ${s}_start = Date.now();`),o.push(`${n}const ${s}_timeout = ${l};`),o.push(`${n}const ${s}_check = () => {`),o.push(`${n} if (Date.now() - ${s}_start > ${s}_timeout) {`),o.push(`${n} throw new Error('${p}');`),o.push(`${n} }`),o.push(`${n} return true;`),o.push(`${n}};`),e.condition.type==="JS_CODE")o.push(`${n}while (${s}_check() && (${e.condition.expression})) {`);else{o.push(`${n}// AI Loop Condition: ${S(e.condition.expression)}`);let d=JSON.stringify(e.condition.expression);o.push(`${n}while (${s}_check() && await agent.evaluate(page, ${d}, "${i}")) {`)}let h=g(e.body,t+1,r,`${i}.body`);return o.push(...h),o.push(`${n}}`),o}var ge={name:"shiplightai",version:"0.1.3",type:"module",description:"Shiplight CLI for running and debugging .test.yaml files",main:"dist/index.js",types:"dist/index.d.ts",bin:{shiplight:"./dist/cli.js"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/cjs/index.cjs",default:"./dist/index.js"},"./fixture":{types:"./dist/fixture.d.ts",import:"./dist/fixture.js",require:"./dist/cjs/fixture.cjs",default:"./dist/fixture.js"}},files:["dist","README.md"],publishConfig:{registry:"https://registry.npmjs.org",access:"public"},scripts:{build:"tsup","build:cli":"tsup",clean:"rm -rf dist",dev:"tsup --watch",test:"playwright test",typecheck:"tsc --noEmit"},dependencies:{"@babel/plugin-transform-typescript":"^7.27.0","@babel/preset-env":"^7.26.9","@babel/preset-typescript":"^7.27.0","@anthropic-ai/claude-agent-sdk":"^0.1.72","@modelcontextprotocol/sdk":"^0.5.0",axios:"^1.6.0",dotenv:"^16.0.3",express:"^4.21.0",glob:"^13.0.0",open:"^10.1.0",sharp:"^0.34.5",uuid:"^11.1.0",yaml:"^2.8.0",zod:"^3.22.0","zod-to-json-schema":"^3.24.6"},devDependencies:{"@playwright/test":"1.55.0","@shiplightai/sdk-pro":"workspace:*","@types/express":"^4.17.21","@types/node":"^24.0.0",copilot3:"workspace:*","mcp-tools":"workspace:*","sdk-core":"workspace:*","sdk-internal":"workspace:*","shiplight-types":"workspace:*",tsup:"^8.3.5",typescript:"5.5.4","web-session":"workspace:*"},peerDependencies:{"@playwright/test":"1.55.0","@shiplightai/sdk-pro":">=0.2.0"},engines:{node:">=22.0.0"},keywords:["playwright","yaml","testing","automation","ai","shiplight","mcp"],author:"Shiplight",license:"MIT"};var N=ge.version;function me(e,t){let i=[];i.push(`// @generated by shiplightai v${N}`),i.push(...lt()),i.push(""),t?.use&&Object.keys(t.use).length>0&&(i.push(`test.use(${JSON.stringify(t.use,null,2)});`),i.push(""));let r=t?.testName||e.goal||"Generated test",n=t?.tags&&t.tags.length>0?t.tags.map(s=>`@${s}`).join(" ")+" ":"";i.push(`test('${n}${W(r)}', async ({ page, agent }) => {`);let o=t?.startingUrl||e.url;if(o){let s;try{s=new URL(o).pathname}catch{s=o}i.push(` await page.goto('${W(s)}', { waitUntil: 'domcontentloaded' });`),i.push("")}let l=new Set,u={imports:l};if(e.teardown&&e.teardown.length>0){if(i.push(" try {"),e.statements&&e.statements.length>0){i.push(" // Test steps");let h=g(e.statements,2,u);i.push(...h)}i.push(" } finally {"),i.push(" // Teardown");let s=g(e.teardown,2,u,"teardown");i.push(...s),i.push(" }")}else if(e.statements&&e.statements.length>0){i.push(" // Test steps");let s=g(e.statements,1,u);i.push(...s)}if(i.push("});"),l.size>0){let s=0;for(let d=0;d<i.length;d++)i[d].startsWith("import ")&&(s=d+1);let h=Array.from(l);i.splice(s,0,...h)}return i.join(`
4
4
  `)}function lt(){return["import { test, expect } from 'shiplightai/fixture';"]}function we(e){try{return(0,m.statSync)(e).mtimeMs}catch{return 0}}var ut=`// @generated by shiplightai v${N}`;function ht(e,t){if(!(0,m.existsSync)(e)||(0,m.readFileSync)(e,"utf-8").split(`
5
5
  `,1)[0]!==ut)return!1;let r=we(e);for(let n of t)if(we(n)>r)return!1;return!0}function ye(e){let t=(0,_e.globSync)("**/*.test.yaml",{cwd:e.cwd,ignore:["**/node_modules/**"]}),i=[];for(let r of t){let n=(0,Se.resolve)(e.cwd,r),o=n.replace(/\.test\.yaml$/,".yaml.spec.ts"),l=(0,m.readFileSync)(n,"utf-8");try{let{testFlow:u,name:p,tags:s,use:h,referencedTemplatePaths:d}=se(l,n);if(ht(o,[n,...d]))continue;let M=me(u,{testName:p,tags:s,use:h});(0,m.writeFileSync)(o,M)}catch(u){console.error(`[shiplight] Failed to transpile ${r}:`,u),i.push({file:r,error:u})}}if(i.length>0)throw new Error(`[shiplight] Transpilation failed for ${i.length} file(s):
6
6
  `+i.map(r=>` - ${r.file}`).join(`
7
- `))}function be(e={}){return e.dotenv!==!1&&pt(e.scanDir||process.cwd()),ye({cwd:e.scanDir||process.cwd()}),e.apiKey&&(process.env.__SHIPLIGHT_API_KEY=e.apiKey),{}}function pt(e){let t=[],i=k.resolve(e),r=k.resolve(process.cwd());for(;;){let n=k.join(i,".env");if(Te.existsSync(n)&&t.push(n),i===r)break;let o=k.dirname(i);if(o===i)break;i=o}for(let n of t)ke.default.config({path:n})}var G=E(require("fs"),1),b=E(require("path"),1);function Me(e){let t=null,i=process.env.SHIPLIGHT_LOGIN_EMAIL,r=process.env.SHIPLIGHT_LOGIN_PASSWORD;return i&&r&&(t={username:i,password:r}),t||(t=dt(e)),t?(process.env.SHIPLIGHT_LOGIN_URL&&(t.loginUrl=process.env.SHIPLIGHT_LOGIN_URL),process.env.SHIPLIGHT_LOGIN_TOTP_SECRET&&(t.totpSecret=process.env.SHIPLIGHT_LOGIN_TOTP_SECRET),t):null}function dt(e){let t=b.resolve(e),i=b.resolve(process.cwd());for(;;){for(let n of["shiplight.config.json","login.config.json"]){let o=b.join(t,n);if(G.existsSync(o))try{let l=JSON.parse(G.readFileSync(o,"utf-8"));if(l.username&&l.password)return{username:l.username,password:l.password,loginUrl:l.url,totpSecret:l.totp_secret}}catch{}}if(t===i)break;let r=b.dirname(t);if(r===t)break;t=r}return null}0&&(module.exports={resolveLoginConfig,shiplightConfig});
7
+ `))}function ke(e={}){return e.dotenv!==!1&&pt(e.scanDir||process.cwd()),ye({cwd:e.scanDir||process.cwd()}),e.apiKey&&(process.env.__SHIPLIGHT_API_KEY=e.apiKey),{}}function pt(e){let t=[],i=b.resolve(e),r=b.resolve(process.cwd());for(;;){let n=b.join(i,".env");if(Te.existsSync(n)&&t.push(n),i===r)break;let o=b.dirname(i);if(o===i)break;i=o}for(let n of t)be.default.config({path:n})}var G=E(require("fs"),1),k=E(require("path"),1);function Me(e){let t=null,i=process.env.SHIPLIGHT_LOGIN_EMAIL,r=process.env.SHIPLIGHT_LOGIN_PASSWORD;return i&&r&&(t={username:i,password:r}),t||(t=dt(e)),t?(process.env.SHIPLIGHT_LOGIN_URL&&(t.loginUrl=process.env.SHIPLIGHT_LOGIN_URL),process.env.SHIPLIGHT_LOGIN_TOTP_SECRET&&(t.totpSecret=process.env.SHIPLIGHT_LOGIN_TOTP_SECRET),t):null}function dt(e){let t=k.resolve(e),i=k.resolve(process.cwd());for(;;){for(let n of["shiplight.config.json","login.config.json"]){let o=k.join(t,n);if(G.existsSync(o))try{let l=JSON.parse(G.readFileSync(o,"utf-8"));if(l.username&&l.password)return{username:l.username,password:l.password,loginUrl:l.url,totpSecret:l.totp_secret}}catch{}}if(t===i)break;let r=k.dirname(t);if(r===t)break;t=r}return null}0&&(module.exports={resolveLoginConfig,shiplightConfig});