shiplightai 0.1.12 → 0.1.13

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,6 +1,6 @@
1
1
  import { createRequire as __createRequire } from "module";
2
2
  const require = __createRequire(import.meta.url);
3
- import{a as Y,b as Me,c as E,d as N,e as te,f as J,g as A,k as D,m as O}from"./chunk-CYBAFQLF.js";import{e as ps,f as ds,g as Oe}from"./chunk-FBJSHHRD.js";import{c as Ki,d as Wi}from"./chunk-CSINHOOD.js";var $i=Ki(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});function Or(a,t){if(a==null)return{};var e={};for(var s in a)if({}.hasOwnProperty.call(a,s)){if(t.indexOf(s)!==-1)continue;e[s]=a[s]}return e}var j=class{constructor(t,e,s){this.line=void 0,this.column=void 0,this.index=void 0,this.line=t,this.column=e,this.index=s}},ne=class{constructor(t,e){this.start=void 0,this.end=void 0,this.filename=void 0,this.identifierName=void 0,this.start=t,this.end=e}};function F(a,t){let{line:e,column:s,index:i}=a;return new j(e,s+t,i+t)}var ci="BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED",Mr={ImportMetaOutsideModule:{message:`import.meta may appear only with 'sourceType: "module"'`,code:ci},ImportOutsideModule:{message:`'import' and 'export' may appear only with 'sourceType: "module"'`,code:ci}},li={ArrayPattern:"array destructuring pattern",AssignmentExpression:"assignment expression",AssignmentPattern:"assignment expression",ArrowFunctionExpression:"arrow function expression",ConditionalExpression:"conditional expression",CatchClause:"catch clause",ForOfStatement:"for-of statement",ForInStatement:"for-in statement",ForStatement:"for-loop",FormalParameters:"function parameter list",Identifier:"identifier",ImportSpecifier:"import specifier",ImportDefaultSpecifier:"import default specifier",ImportNamespaceSpecifier:"import namespace specifier",ObjectPattern:"object destructuring pattern",ParenthesizedExpression:"parenthesized expression",RestElement:"rest element",UpdateExpression:{true:"prefix operation",false:"postfix operation"},VariableDeclarator:"variable declaration",YieldExpression:"yield expression"},ke=a=>a.type==="UpdateExpression"?li.UpdateExpression[`${a.prefix}`]:li[a.type],Fr={AccessorIsGenerator:({kind:a})=>`A ${a}ter cannot be a generator.`,ArgumentsInClass:"'arguments' is only allowed in functions and class methods.",AsyncFunctionInSingleStatementContext:"Async functions can only be declared at the top level or inside a block.",AwaitBindingIdentifier:"Can not use 'await' as identifier inside an async function.",AwaitBindingIdentifierInStaticBlock:"Can not use 'await' as identifier inside a static block.",AwaitExpressionFormalParameter:"'await' is not allowed in async function parameters.",AwaitUsingNotInAsyncContext:"'await using' is only allowed within async functions and at the top levels of modules.",AwaitNotInAsyncContext:"'await' is only allowed within async functions and at the top levels of modules.",BadGetterArity:"A 'get' accessor must not have any formal parameters.",BadSetterArity:"A 'set' accessor must have exactly one formal parameter.",BadSetterRestParameter:"A 'set' accessor function argument must not be a rest parameter.",ConstructorClassField:"Classes may not have a field named 'constructor'.",ConstructorClassPrivateField:"Classes may not have a private field named '#constructor'.",ConstructorIsAccessor:"Class constructor may not be an accessor.",ConstructorIsAsync:"Constructor can't be an async function.",ConstructorIsGenerator:"Constructor can't be a generator.",DeclarationMissingInitializer:({kind:a})=>`Missing initializer in ${a} declaration.`,DecoratorArgumentsOutsideParentheses:"Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",DecoratorBeforeExport:"Decorators must be placed *before* the 'export' keyword. Remove the 'decoratorsBeforeExport: true' option to use the 'export @decorator class {}' syntax.",DecoratorsBeforeAfterExport:"Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.",DecoratorConstructor:"Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",DecoratorExportClass:"Decorators must be placed *after* the 'export' keyword. Remove the 'decoratorsBeforeExport: false' option to use the '@decorator export class {}' syntax.",DecoratorSemicolon:"Decorators must not be followed by a semicolon.",DecoratorStaticBlock:"Decorators can't be used with a static block.",DeferImportRequiresNamespace:'Only `import defer * as x from "./module"` is valid.',DeletePrivateField:"Deleting a private field is not allowed.",DestructureNamedImport:"ES2015 named imports do not destructure. Use another statement for destructuring after the import.",DuplicateConstructor:"Duplicate constructor in the same class.",DuplicateDefaultExport:"Only one default export allowed per module.",DuplicateExport:({exportName:a})=>`\`${a}\` has already been exported. Exported identifiers must be unique.`,DuplicateProto:"Redefinition of __proto__ property.",DuplicateRegExpFlags:"Duplicate regular expression flag.",ElementAfterRest:"Rest element must be last element.",EscapedCharNotAnIdentifier:"Invalid Unicode escape.",ExportBindingIsString:({localName:a,exportName:t})=>`A string literal cannot be used as an exported binding without \`from\`.
3
+ import{a as Y,b as Me,c as E,d as N,e as te,f as J,g as A,k as D,m as O}from"./chunk-QU5HYOUM.js";import{e as ps,f as ds,g as Oe}from"./chunk-FBJSHHRD.js";import{c as Ki,d as Wi}from"./chunk-CSINHOOD.js";var $i=Ki(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});function Or(a,t){if(a==null)return{};var e={};for(var s in a)if({}.hasOwnProperty.call(a,s)){if(t.indexOf(s)!==-1)continue;e[s]=a[s]}return e}var j=class{constructor(t,e,s){this.line=void 0,this.column=void 0,this.index=void 0,this.line=t,this.column=e,this.index=s}},ne=class{constructor(t,e){this.start=void 0,this.end=void 0,this.filename=void 0,this.identifierName=void 0,this.start=t,this.end=e}};function F(a,t){let{line:e,column:s,index:i}=a;return new j(e,s+t,i+t)}var ci="BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED",Mr={ImportMetaOutsideModule:{message:`import.meta may appear only with 'sourceType: "module"'`,code:ci},ImportOutsideModule:{message:`'import' and 'export' may appear only with 'sourceType: "module"'`,code:ci}},li={ArrayPattern:"array destructuring pattern",AssignmentExpression:"assignment expression",AssignmentPattern:"assignment expression",ArrowFunctionExpression:"arrow function expression",ConditionalExpression:"conditional expression",CatchClause:"catch clause",ForOfStatement:"for-of statement",ForInStatement:"for-in statement",ForStatement:"for-loop",FormalParameters:"function parameter list",Identifier:"identifier",ImportSpecifier:"import specifier",ImportDefaultSpecifier:"import default specifier",ImportNamespaceSpecifier:"import namespace specifier",ObjectPattern:"object destructuring pattern",ParenthesizedExpression:"parenthesized expression",RestElement:"rest element",UpdateExpression:{true:"prefix operation",false:"postfix operation"},VariableDeclarator:"variable declaration",YieldExpression:"yield expression"},ke=a=>a.type==="UpdateExpression"?li.UpdateExpression[`${a.prefix}`]:li[a.type],Fr={AccessorIsGenerator:({kind:a})=>`A ${a}ter cannot be a generator.`,ArgumentsInClass:"'arguments' is only allowed in functions and class methods.",AsyncFunctionInSingleStatementContext:"Async functions can only be declared at the top level or inside a block.",AwaitBindingIdentifier:"Can not use 'await' as identifier inside an async function.",AwaitBindingIdentifierInStaticBlock:"Can not use 'await' as identifier inside a static block.",AwaitExpressionFormalParameter:"'await' is not allowed in async function parameters.",AwaitUsingNotInAsyncContext:"'await using' is only allowed within async functions and at the top levels of modules.",AwaitNotInAsyncContext:"'await' is only allowed within async functions and at the top levels of modules.",BadGetterArity:"A 'get' accessor must not have any formal parameters.",BadSetterArity:"A 'set' accessor must have exactly one formal parameter.",BadSetterRestParameter:"A 'set' accessor function argument must not be a rest parameter.",ConstructorClassField:"Classes may not have a field named 'constructor'.",ConstructorClassPrivateField:"Classes may not have a private field named '#constructor'.",ConstructorIsAccessor:"Class constructor may not be an accessor.",ConstructorIsAsync:"Constructor can't be an async function.",ConstructorIsGenerator:"Constructor can't be a generator.",DeclarationMissingInitializer:({kind:a})=>`Missing initializer in ${a} declaration.`,DecoratorArgumentsOutsideParentheses:"Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",DecoratorBeforeExport:"Decorators must be placed *before* the 'export' keyword. Remove the 'decoratorsBeforeExport: true' option to use the 'export @decorator class {}' syntax.",DecoratorsBeforeAfterExport:"Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.",DecoratorConstructor:"Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",DecoratorExportClass:"Decorators must be placed *after* the 'export' keyword. Remove the 'decoratorsBeforeExport: false' option to use the '@decorator export class {}' syntax.",DecoratorSemicolon:"Decorators must not be followed by a semicolon.",DecoratorStaticBlock:"Decorators can't be used with a static block.",DeferImportRequiresNamespace:'Only `import defer * as x from "./module"` is valid.',DeletePrivateField:"Deleting a private field is not allowed.",DestructureNamedImport:"ES2015 named imports do not destructure. Use another statement for destructuring after the import.",DuplicateConstructor:"Duplicate constructor in the same class.",DuplicateDefaultExport:"Only one default export allowed per module.",DuplicateExport:({exportName:a})=>`\`${a}\` has already been exported. Exported identifiers must be unique.`,DuplicateProto:"Redefinition of __proto__ property.",DuplicateRegExpFlags:"Duplicate regular expression flag.",ElementAfterRest:"Rest element must be last element.",EscapedCharNotAnIdentifier:"Invalid Unicode escape.",ExportBindingIsString:({localName:a,exportName:t})=>`A string literal cannot be used as an exported binding without \`from\`.
4
4
  - Did you mean \`export { '${a}' as '${t}' } from 'some-module'\`?`,ExportDefaultFromAsIdentifier:"'from' is not allowed as an identifier after 'export default'.",ForInOfLoopInitializer:({type:a})=>`'${a==="ForInStatement"?"for-in":"for-of"}' loop variable declaration may not have an initializer.`,ForInUsing:"For-in loop may not start with 'using' declaration.",ForOfAsync:"The left-hand side of a for-of loop may not be 'async'.",ForOfLet:"The left-hand side of a for-of loop may not start with 'let'.",GeneratorInSingleStatementContext:"Generators can only be declared at the top level or inside a block.",IllegalBreakContinue:({type:a})=>`Unsyntactic ${a==="BreakStatement"?"break":"continue"}.`,IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list.",IllegalReturn:"'return' outside of function.",ImportAttributesUseAssert:"The `assert` keyword in import attributes is deprecated and it has been replaced by the `with` keyword. You can enable the `deprecatedImportAssert` parser plugin to suppress this error.",ImportBindingIsString:({importName:a})=>`A string literal cannot be used as an imported binding.
5
5
  - Did you mean \`import { "${a}" as foo }\`?`,ImportCallArity:"`import()` requires exactly one or two arguments.",ImportCallNotNewExpression:"Cannot use new with import(...).",ImportCallSpreadArgument:"`...` is not allowed in `import()`.",ImportJSONBindingNotDefault:"A JSON module can only be imported with `default`.",ImportReflectionHasAssertion:"`import module x` cannot have assertions.",ImportReflectionNotBinding:'Only `import module x from "./module"` is valid.',IncompatibleRegExpUVFlags:"The 'u' and 'v' regular expression flags cannot be enabled at the same time.",InvalidBigIntLiteral:"Invalid BigIntLiteral.",InvalidCodePoint:"Code point out of bounds.",InvalidCoverDiscardElement:"'void' must be followed by an expression when not used in a binding position.",InvalidCoverInitializedName:"Invalid shorthand property initializer.",InvalidDecimal:"Invalid decimal.",InvalidDigit:({radix:a})=>`Expected number in radix ${a}.`,InvalidEscapeSequence:"Bad character escape sequence.",InvalidEscapeSequenceTemplate:"Invalid escape sequence in template.",InvalidEscapedReservedWord:({reservedWord:a})=>`Escape sequence in keyword ${a}.`,InvalidIdentifier:({identifierName:a})=>`Invalid identifier ${a}.`,InvalidLhs:({ancestor:a})=>`Invalid left-hand side in ${ke(a)}.`,InvalidLhsBinding:({ancestor:a})=>`Binding invalid left-hand side in ${ke(a)}.`,InvalidLhsOptionalChaining:({ancestor:a})=>`Invalid optional chaining in the left-hand side of ${ke(a)}.`,InvalidNumber:"Invalid number.",InvalidOrMissingExponent:"Floating-point numbers require a valid exponent after the 'e'.",InvalidOrUnexpectedToken:({unexpected:a})=>`Unexpected character '${a}'.`,InvalidParenthesizedAssignment:"Invalid parenthesized assignment pattern.",InvalidPrivateFieldResolution:({identifierName:a})=>`Private name #${a} is not defined.`,InvalidPropertyBindingPattern:"Binding member expression.",InvalidRecordProperty:"Only properties and spread elements are allowed in record definitions.",InvalidRestAssignmentPattern:"Invalid rest operator's argument.",LabelRedeclaration:({labelName:a})=>`Label '${a}' is already declared.`,LetInLexicalBinding:"'let' is disallowed as a lexically bound name.",LineTerminatorBeforeArrow:"No line break is allowed before '=>'.",MalformedRegExpFlags:"Invalid regular expression flag.",MissingClassName:"A class name is required.",MissingEqInAssignment:"Only '=' operator can be used for specifying default value.",MissingSemicolon:"Missing semicolon.",MissingPlugin:({missingPlugin:a})=>`This experimental syntax requires enabling the parser plugin: ${a.map(t=>JSON.stringify(t)).join(", ")}.`,MissingOneOfPlugins:({missingPlugin:a})=>`This experimental syntax requires enabling one of the following parser plugin(s): ${a.map(t=>JSON.stringify(t)).join(", ")}.`,MissingUnicodeEscape:"Expecting Unicode escape sequence \\uXXXX.",MixingCoalesceWithLogical:"Nullish coalescing operator(??) requires parens when mixing with logical operators.",ModuleAttributeDifferentFromType:"The only accepted module attribute is `type`.",ModuleAttributeInvalidValue:"Only string literals are allowed as module attribute values.",ModuleAttributesWithDuplicateKeys:({key:a})=>`Duplicate key "${a}" is not allowed in module attributes.`,ModuleExportNameHasLoneSurrogate:({surrogateCharCode:a})=>`An export name cannot include a lone surrogate, found '\\u${a.toString(16)}'.`,ModuleExportUndefined:({localName:a})=>`Export '${a}' is not defined.`,MultipleDefaultsInSwitch:"Multiple default clauses.",NewlineAfterThrow:"Illegal newline after throw.",NoCatchOrFinally:"Missing catch or finally clause.",NumberIdentifier:"Identifier directly after number.",NumericSeparatorInEscapeSequence:"Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.",ObsoleteAwaitStar:"'await*' has been removed from the async functions proposal. Use Promise.all() instead.",OptionalChainingNoNew:"Constructors in/after an Optional Chain are not allowed.",OptionalChainingNoTemplate:"Tagged Template Literals are not allowed in optionalChain.",OverrideOnConstructor:"'override' modifier cannot appear on a constructor declaration.",ParamDupe:"Argument name clash.",PatternHasAccessor:"Object pattern can't contain getter or setter.",PatternHasMethod:"Object pattern can't contain methods.",PrivateInExpectedIn:({identifierName:a})=>`Private names are only allowed in property accesses (\`obj.#${a}\`) or in \`in\` expressions (\`#${a} in obj\`).`,PrivateNameRedeclaration:({identifierName:a})=>`Duplicate private name #${a}.`,RecordExpressionBarIncorrectEndSyntaxType:"Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionBarIncorrectStartSyntaxType:"Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",RecordExpressionHashIncorrectStartSyntaxType:"Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",RecordNoProto:"'__proto__' is not allowed in Record expressions.",RestTrailingComma:"Unexpected trailing comma after rest element.",SloppyFunction:"In non-strict mode code, functions can only be declared at top level or inside a block.",SloppyFunctionAnnexB:"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.",SourcePhaseImportRequiresDefault:'Only `import source x from "./module"` is valid.',StaticPrototype:"Classes may not have static property named prototype.",SuperNotAllowed:"`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?",SuperPrivateField:"Private fields can't be accessed on super.",TrailingDecorator:"Decorators must be attached to a class element.",TupleExpressionBarIncorrectEndSyntaxType:"Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionBarIncorrectStartSyntaxType:"Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'.",TupleExpressionHashIncorrectStartSyntaxType:"Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'.",UnexpectedArgumentPlaceholder:"Unexpected argument placeholder.",UnexpectedAwaitAfterPipelineBody:'Unexpected "await" after pipeline body; await must have parentheses in minimal proposal.',UnexpectedDigitAfterHash:"Unexpected digit after hash token.",UnexpectedImportExport:"'import' and 'export' may only appear at the top level.",UnexpectedKeyword:({keyword:a})=>`Unexpected keyword '${a}'.`,UnexpectedLeadingDecorator:"Leading decorators must be attached to a class declaration.",UnexpectedLexicalDeclaration:"Lexical declaration cannot appear in a single-statement context.",UnexpectedNewTarget:"`new.target` can only be used in functions or class properties.",UnexpectedNumericSeparator:"A numeric separator is only allowed between two digits.",UnexpectedPrivateField:"Unexpected private name.",UnexpectedReservedWord:({reservedWord:a})=>`Unexpected reserved word '${a}'.`,UnexpectedSuper:"'super' is only allowed in object methods and classes.",UnexpectedToken:({expected:a,unexpected:t})=>`Unexpected token${t?` '${t}'.`:""}${a?`, expected "${a}"`:""}`,UnexpectedTokenUnaryExponentiation:"Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",UnexpectedUsingDeclaration:"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",UnexpectedVoidPattern:"Unexpected void binding.",UnsupportedBind:"Binding should be performed on object property.",UnsupportedDecoratorExport:"A decorated export must export a class declaration.",UnsupportedDefaultExport:"Only expressions, functions or classes are allowed as the `default` export.",UnsupportedImport:"`import` can only be used in `import()` or `import.meta`.",UnsupportedMetaProperty:({target:a,onlyValidPropertyName:t})=>`The only valid meta property for ${a} is ${a}.${t}.`,UnsupportedParameterDecorator:"Decorators cannot be used to decorate parameters.",UnsupportedPropertyDecorator:"Decorators cannot be used to decorate object literal properties.",UnsupportedSuper:"'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).",UnterminatedComment:"Unterminated comment.",UnterminatedRegExp:"Unterminated regular expression.",UnterminatedString:"Unterminated string constant.",UnterminatedTemplate:"Unterminated template.",UsingDeclarationExport:"Using declaration cannot be exported.",UsingDeclarationHasBindingPattern:"Using declaration cannot have destructuring patterns.",VarRedeclaration:({identifierName:a})=>`Identifier '${a}' has already been declared.`,VoidPatternCatchClauseParam:"A void binding can not be the catch clause parameter. Use `try { ... } catch { ... }` if you want to discard the caught error.",VoidPatternInitializer:"A void binding may not have an initializer.",YieldBindingIdentifier:"Can not use 'yield' as identifier inside a generator.",YieldInParameter:"Yield expression is not allowed in formal parameters.",YieldNotInGeneratorFunction:"'yield' is only allowed within generator functions.",ZeroDigitNumericSeparator:"Numeric separator can not be used after leading 0."},$r={StrictDelete:"Deleting local variable in strict mode.",StrictEvalArguments:({referenceName:a})=>`Assigning to '${a}' in strict mode.`,StrictEvalArgumentsBinding:({bindingName:a})=>`Binding '${a}' in strict mode.`,StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block.",StrictNumericEscape:"The only valid numeric escape in strict mode is '\\0'.",StrictOctalLiteral:"Legacy octal literals are not allowed in strict mode.",StrictWith:"'with' in strict mode."},Br={ParseExpressionEmptyInput:"Unexpected parseExpression() input: The input is empty or contains only comments.",ParseExpressionExpectsEOF:({unexpected:a})=>`Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`${String.fromCodePoint(a)}\`.`},Rr=new Set(["ArrowFunctionExpression","AssignmentExpression","ConditionalExpression","YieldExpression"]),Ur=Object.assign({PipeBodyIsTighter:"Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.",PipeTopicRequiresHackPipes:'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.',PipeTopicUnbound:"Topic reference is unbound; it must be inside a pipe body.",PipeTopicUnconfiguredToken:({token:a})=>`Invalid topic token ${a}. In order to use ${a} as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "${a}" }.`,PipeTopicUnused:"Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",PipeUnparenthesizedBody:({type:a})=>`Hack-style pipe body cannot be an unparenthesized ${ke({type:a})}; please wrap it in parentheses.`},{PipelineBodyNoArrow:'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized.',PipelineBodySequenceExpression:"Pipeline body may not be a comma-separated sequence expression.",PipelineHeadSequenceExpression:"Pipeline head should not be a comma-separated sequence expression.",PipelineTopicUnused:"Pipeline is in topic style but does not use topic reference.",PrimaryTopicNotAllowed:"Topic reference was used in a lexical context without topic binding.",PrimaryTopicRequiresSmartPipeline:'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'}),jr=["message"];function hi(a,t,e){Object.defineProperty(a,t,{enumerable:!1,configurable:!0,value:e})}function zr({toMessage:a,code:t,reasonCode:e,syntaxPlugin:s}){let i=e==="MissingPlugin"||e==="MissingOneOfPlugins";{let r={AccessorCannotDeclareThisParameter:"AccesorCannotDeclareThisParameter",AccessorCannotHaveTypeParameters:"AccesorCannotHaveTypeParameters",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference",SetAccessorCannotHaveOptionalParameter:"SetAccesorCannotHaveOptionalParameter",SetAccessorCannotHaveRestParameter:"SetAccesorCannotHaveRestParameter",SetAccessorCannotHaveReturnType:"SetAccesorCannotHaveReturnType"};r[e]&&(e=r[e])}return function r(n,o){let c=new SyntaxError;return c.code=t,c.reasonCode=e,c.loc=n,c.pos=n.index,c.syntaxPlugin=s,i&&(c.missingPlugin=o.missingPlugin),hi(c,"clone",function(h={}){var p;let{line:d,column:f,index:x}=(p=h.loc)!=null?p:n;return r(new j(d,f,x),Object.assign({},o,h.details))}),hi(c,"details",o),Object.defineProperty(c,"message",{configurable:!0,get(){let l=`${a(o)} (${n.line}:${n.column})`;return this.message=l,l},set(l){Object.defineProperty(this,"message",{value:l,writable:!0})}}),c}}function R(a,t){if(Array.isArray(a))return s=>R(s,a[0]);let e={};for(let s of Object.keys(a)){let i=a[s],r=typeof i=="string"?{message:()=>i}:typeof i=="function"?{message:i}:i,{message:n}=r,o=Or(r,jr),c=typeof n=="string"?()=>n:n;e[s]=zr(Object.assign({code:"BABEL_PARSER_SYNTAX_ERROR",reasonCode:s,toMessage:c},t?{syntaxPlugin:t}:{},o))}return e}var u=Object.assign({},R(Mr),R(Fr),R($r),R(Br),R`pipelineOperator`(Ur));function Vr(){return{sourceType:"script",sourceFilename:void 0,startIndex:0,startColumn:0,startLine:1,allowAwaitOutsideFunction:!1,allowReturnOutsideFunction:!1,allowNewTargetOutsideFunction:!1,allowImportExportEverywhere:!1,allowSuperOutsideMethod:!1,allowUndeclaredExports:!1,allowYieldOutsideFunction:!1,plugins:[],strictMode:void 0,ranges:!1,tokens:!1,createImportExpressions:!1,createParenthesizedExpressions:!1,errorRecovery:!1,attachComment:!0,annexB:!0}}function qr(a){let t=Vr();if(a==null)return t;if(a.annexB!=null&&a.annexB!==!1)throw new Error("The `annexB` option can only be set to `false`.");for(let e of Object.keys(t))a[e]!=null&&(t[e]=a[e]);if(t.startLine===1)a.startIndex==null&&t.startColumn>0?t.startIndex=t.startColumn:a.startColumn==null&&t.startIndex>0&&(t.startColumn=t.startIndex);else if((a.startColumn==null||a.startIndex==null)&&a.startIndex!=null)throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");if(t.sourceType==="commonjs"){if(a.allowAwaitOutsideFunction!=null)throw new Error("The `allowAwaitOutsideFunction` option cannot be used with `sourceType: 'commonjs'`.");if(a.allowReturnOutsideFunction!=null)throw new Error("`sourceType: 'commonjs'` implies `allowReturnOutsideFunction: true`, please remove the `allowReturnOutsideFunction` option or use `sourceType: 'script'`.");if(a.allowNewTargetOutsideFunction!=null)throw new Error("`sourceType: 'commonjs'` implies `allowNewTargetOutsideFunction: true`, please remove the `allowNewTargetOutsideFunction` option or use `sourceType: 'script'`.")}return t}var{defineProperty:Jr}=Object,ui=(a,t)=>{a&&Jr(a,t,{enumerable:!1,value:a[t]})};function he(a){return ui(a.loc.start,"index"),ui(a.loc.end,"index"),a}var Hr=a=>class extends a{parse(){let e=he(super.parse());return this.optionFlags&256&&(e.tokens=e.tokens.map(he)),e}parseRegExpLiteral({pattern:e,flags:s}){let i=null;try{i=new RegExp(e,s)}catch{}let r=this.estreeParseLiteral(i);return r.regex={pattern:e,flags:s},r}parseBigIntLiteral(e){let s;try{s=BigInt(e)}catch{s=null}let i=this.estreeParseLiteral(s);return i.bigint=String(i.value||e),i}parseDecimalLiteral(e){let i=this.estreeParseLiteral(null);return i.decimal=String(i.value||e),i}estreeParseLiteral(e){return this.parseLiteral(e,"Literal")}parseStringLiteral(e){return this.estreeParseLiteral(e)}parseNumericLiteral(e){return this.estreeParseLiteral(e)}parseNullLiteral(){return this.estreeParseLiteral(null)}parseBooleanLiteral(e){return this.estreeParseLiteral(e)}estreeParseChainExpression(e,s){let i=this.startNodeAtNode(e);return i.expression=e,this.finishNodeAt(i,"ChainExpression",s)}directiveToStmt(e){let s=e.value;delete e.value,this.castNodeTo(s,"Literal"),s.raw=s.extra.raw,s.value=s.extra.expressionValue;let i=this.castNodeTo(e,"ExpressionStatement");return i.expression=s,i.directive=s.extra.rawValue,delete s.extra,i}fillOptionalPropertiesForTSESLint(e){}cloneEstreeStringLiteral(e){let{start:s,end:i,loc:r,range:n,raw:o,value:c}=e,l=Object.create(e.constructor.prototype);return l.type="Literal",l.start=s,l.end=i,l.loc=r,l.range=n,l.raw=o,l.value=c,l}initFunction(e,s){super.initFunction(e,s),e.expression=!1}checkDeclaration(e){e!=null&&this.isObjectProperty(e)?this.checkDeclaration(e.value):super.checkDeclaration(e)}getObjectOrClassMethodParams(e){return e.value.params}isValidDirective(e){var s;return e.type==="ExpressionStatement"&&e.expression.type==="Literal"&&typeof e.expression.value=="string"&&!((s=e.expression.extra)!=null&&s.parenthesized)}parseBlockBody(e,s,i,r,n){super.parseBlockBody(e,s,i,r,n);let o=e.directives.map(c=>this.directiveToStmt(c));e.body=o.concat(e.body),delete e.directives}parsePrivateName(){let e=super.parsePrivateName();return this.getPluginOption("estree","classFeatures")?this.convertPrivateNameToPrivateIdentifier(e):e}convertPrivateNameToPrivateIdentifier(e){let s=super.getPrivateNameSV(e);return delete e.id,e.name=s,this.castNodeTo(e,"PrivateIdentifier")}isPrivateName(e){return this.getPluginOption("estree","classFeatures")?e.type==="PrivateIdentifier":super.isPrivateName(e)}getPrivateNameSV(e){return this.getPluginOption("estree","classFeatures")?e.name:super.getPrivateNameSV(e)}parseLiteral(e,s){let i=super.parseLiteral(e,s);return i.raw=i.extra.raw,delete i.extra,i}parseFunctionBody(e,s,i=!1){super.parseFunctionBody(e,s,i),e.expression=e.body.type!=="BlockStatement"}parseMethod(e,s,i,r,n,o,c=!1){let l=this.startNode();l.kind=e.kind,l=super.parseMethod(l,s,i,r,n,o,c),delete l.kind;let{typeParameters:h}=e;h&&(delete e.typeParameters,l.typeParameters=h,this.resetStartLocationFromNode(l,h));let p=this.castNodeTo(l,"FunctionExpression");return e.value=p,o==="ClassPrivateMethod"&&(e.computed=!1),o==="ObjectMethod"?(e.kind==="method"&&(e.kind="init"),e.shorthand=!1,this.finishNode(e,"Property")):this.finishNode(e,"MethodDefinition")}nameIsConstructor(e){return e.type==="Literal"?e.value==="constructor":super.nameIsConstructor(e)}parseClassProperty(...e){let s=super.parseClassProperty(...e);return this.getPluginOption("estree","classFeatures")&&this.castNodeTo(s,"PropertyDefinition"),s}parseClassPrivateProperty(...e){let s=super.parseClassPrivateProperty(...e);return this.getPluginOption("estree","classFeatures")&&(this.castNodeTo(s,"PropertyDefinition"),s.computed=!1),s}parseClassAccessorProperty(e){let s=super.parseClassAccessorProperty(e);return this.getPluginOption("estree","classFeatures")&&(s.abstract&&this.hasPlugin("typescript")?(delete s.abstract,this.castNodeTo(s,"TSAbstractAccessorProperty")):this.castNodeTo(s,"AccessorProperty")),s}parseObjectProperty(e,s,i,r){let n=super.parseObjectProperty(e,s,i,r);return n&&(n.kind="init",this.castNodeTo(n,"Property")),n}finishObjectProperty(e){return e.kind="init",this.finishNode(e,"Property")}isValidLVal(e,s,i,r){return e==="Property"?"value":super.isValidLVal(e,s,i,r)}isAssignable(e,s){return e!=null&&this.isObjectProperty(e)?this.isAssignable(e.value,s):super.isAssignable(e,s)}toAssignable(e,s=!1){if(e!=null&&this.isObjectProperty(e)){let{key:i,value:r}=e;this.isPrivateName(i)&&this.classScope.usePrivateName(this.getPrivateNameSV(i),i.loc.start),this.toAssignable(r,s)}else super.toAssignable(e,s)}toAssignableObjectExpressionProp(e,s,i){e.type==="Property"&&(e.kind==="get"||e.kind==="set")?this.raise(u.PatternHasAccessor,e.key):e.type==="Property"&&e.method?this.raise(u.PatternHasMethod,e.key):super.toAssignableObjectExpressionProp(e,s,i)}finishCallExpression(e,s){let i=super.finishCallExpression(e,s);if(i.callee.type==="Import"){var r;this.castNodeTo(i,"ImportExpression"),i.source=i.arguments[0],i.options=(r=i.arguments[1])!=null?r:null;{var n;i.attributes=(n=i.arguments[1])!=null?n:null}delete i.arguments,delete i.callee}else i.type==="OptionalCallExpression"?this.castNodeTo(i,"CallExpression"):i.optional=!1;return i}toReferencedArguments(e){e.type!=="ImportExpression"&&super.toReferencedArguments(e)}parseExport(e,s){let i=this.state.lastTokStartLoc,r=super.parseExport(e,s);switch(r.type){case"ExportAllDeclaration":r.exported=null;break;case"ExportNamedDeclaration":r.specifiers.length===1&&r.specifiers[0].type==="ExportNamespaceSpecifier"&&(this.castNodeTo(r,"ExportAllDeclaration"),r.exported=r.specifiers[0].exported,delete r.specifiers);case"ExportDefaultDeclaration":{var n;let{declaration:o}=r;o?.type==="ClassDeclaration"&&((n=o.decorators)==null?void 0:n.length)>0&&o.start===r.start&&this.resetStartLocation(r,i)}break}return r}stopParseSubscript(e,s){let i=super.stopParseSubscript(e,s);return s.optionalChainMember?this.estreeParseChainExpression(i,e.loc.end):i}parseMember(e,s,i,r,n){let o=super.parseMember(e,s,i,r,n);return o.type==="OptionalMemberExpression"?this.castNodeTo(o,"MemberExpression"):o.optional=!1,o}isOptionalMemberExpression(e){return e.type==="ChainExpression"?e.expression.type==="MemberExpression":super.isOptionalMemberExpression(e)}hasPropertyAsPrivateName(e){return e.type==="ChainExpression"&&(e=e.expression),super.hasPropertyAsPrivateName(e)}isObjectProperty(e){return e.type==="Property"&&e.kind==="init"&&!e.method}isObjectMethod(e){return e.type==="Property"&&(e.method||e.kind==="get"||e.kind==="set")}castNodeTo(e,s){let i=super.castNodeTo(e,s);return this.fillOptionalPropertiesForTSESLint(i),i}cloneIdentifier(e){let s=super.cloneIdentifier(e);return this.fillOptionalPropertiesForTSESLint(s),s}cloneStringLiteral(e){return e.type==="Literal"?this.cloneEstreeStringLiteral(e):super.cloneStringLiteral(e)}finishNodeAt(e,s,i){return he(super.finishNodeAt(e,s,i))}finishNode(e,s){let i=super.finishNode(e,s);return this.fillOptionalPropertiesForTSESLint(i),i}resetStartLocation(e,s){super.resetStartLocation(e,s),he(e)}resetEndLocation(e,s=this.state.lastTokEndLoc){super.resetEndLocation(e,s),he(e)}},Z=class{constructor(t,e){this.token=void 0,this.preserveSpace=void 0,this.token=t,this.preserveSpace=!!e}},C={brace:new Z("{"),j_oTag:new Z("<tag"),j_cTag:new Z("</tag"),j_expr:new Z("<tag>...</tag>",!0)};C.template=new Z("`",!0);var T=!0,m=!0,Ge=!0,ue=!0,H=!0,Kr=!0,Ce=class{constructor(t,e={}){this.label=void 0,this.keyword=void 0,this.beforeExpr=void 0,this.startsExpr=void 0,this.rightAssociative=void 0,this.isLoop=void 0,this.isAssign=void 0,this.prefix=void 0,this.postfix=void 0,this.binop=void 0,this.label=t,this.keyword=e.keyword,this.beforeExpr=!!e.beforeExpr,this.startsExpr=!!e.startsExpr,this.rightAssociative=!!e.rightAssociative,this.isLoop=!!e.isLoop,this.isAssign=!!e.isAssign,this.prefix=!!e.prefix,this.postfix=!!e.postfix,this.binop=e.binop!=null?e.binop:null,this.updateContext=null}},At=new Map;function k(a,t={}){t.keyword=a;let e=g(a,t);return At.set(a,e),e}function M(a,t){return g(a,{beforeExpr:T,binop:t})}var me=-1,V=[],St=[],kt=[],Et=[],It=[],Ct=[];function g(a,t={}){var e,s,i,r;return++me,St.push(a),kt.push((e=t.binop)!=null?e:-1),Et.push((s=t.beforeExpr)!=null?s:!1),It.push((i=t.startsExpr)!=null?i:!1),Ct.push((r=t.prefix)!=null?r:!1),V.push(new Ce(a,t)),me}function S(a,t={}){var e,s,i,r;return++me,At.set(a,me),St.push(a),kt.push((e=t.binop)!=null?e:-1),Et.push((s=t.beforeExpr)!=null?s:!1),It.push((i=t.startsExpr)!=null?i:!1),Ct.push((r=t.prefix)!=null?r:!1),V.push(new Ce("name",t)),me}var Wr={bracketL:g("[",{beforeExpr:T,startsExpr:m}),bracketHashL:g("#[",{beforeExpr:T,startsExpr:m}),bracketBarL:g("[|",{beforeExpr:T,startsExpr:m}),bracketR:g("]"),bracketBarR:g("|]"),braceL:g("{",{beforeExpr:T,startsExpr:m}),braceBarL:g("{|",{beforeExpr:T,startsExpr:m}),braceHashL:g("#{",{beforeExpr:T,startsExpr:m}),braceR:g("}"),braceBarR:g("|}"),parenL:g("(",{beforeExpr:T,startsExpr:m}),parenR:g(")"),comma:g(",",{beforeExpr:T}),semi:g(";",{beforeExpr:T}),colon:g(":",{beforeExpr:T}),doubleColon:g("::",{beforeExpr:T}),dot:g("."),question:g("?",{beforeExpr:T}),questionDot:g("?."),arrow:g("=>",{beforeExpr:T}),template:g("template"),ellipsis:g("...",{beforeExpr:T}),backQuote:g("`",{startsExpr:m}),dollarBraceL:g("${",{beforeExpr:T,startsExpr:m}),templateTail:g("...`",{startsExpr:m}),templateNonTail:g("...${",{beforeExpr:T,startsExpr:m}),at:g("@"),hash:g("#",{startsExpr:m}),interpreterDirective:g("#!..."),eq:g("=",{beforeExpr:T,isAssign:ue}),assign:g("_=",{beforeExpr:T,isAssign:ue}),slashAssign:g("_=",{beforeExpr:T,isAssign:ue}),xorAssign:g("_=",{beforeExpr:T,isAssign:ue}),moduloAssign:g("_=",{beforeExpr:T,isAssign:ue}),incDec:g("++/--",{prefix:H,postfix:Kr,startsExpr:m}),bang:g("!",{beforeExpr:T,prefix:H,startsExpr:m}),tilde:g("~",{beforeExpr:T,prefix:H,startsExpr:m}),doubleCaret:g("^^",{startsExpr:m}),doubleAt:g("@@",{startsExpr:m}),pipeline:M("|>",0),nullishCoalescing:M("??",1),logicalOR:M("||",1),logicalAND:M("&&",2),bitwiseOR:M("|",3),bitwiseXOR:M("^",4),bitwiseAND:M("&",5),equality:M("==/!=/===/!==",6),lt:M("</>/<=/>=",7),gt:M("</>/<=/>=",7),relational:M("</>/<=/>=",7),bitShift:M("<</>>/>>>",8),bitShiftL:M("<</>>/>>>",8),bitShiftR:M("<</>>/>>>",8),plusMin:g("+/-",{beforeExpr:T,binop:9,prefix:H,startsExpr:m}),modulo:g("%",{binop:10,startsExpr:m}),star:g("*",{binop:10}),slash:M("/",10),exponent:g("**",{beforeExpr:T,binop:11,rightAssociative:!0}),_in:k("in",{beforeExpr:T,binop:7}),_instanceof:k("instanceof",{beforeExpr:T,binop:7}),_break:k("break"),_case:k("case",{beforeExpr:T}),_catch:k("catch"),_continue:k("continue"),_debugger:k("debugger"),_default:k("default",{beforeExpr:T}),_else:k("else",{beforeExpr:T}),_finally:k("finally"),_function:k("function",{startsExpr:m}),_if:k("if"),_return:k("return",{beforeExpr:T}),_switch:k("switch"),_throw:k("throw",{beforeExpr:T,prefix:H,startsExpr:m}),_try:k("try"),_var:k("var"),_const:k("const"),_with:k("with"),_new:k("new",{beforeExpr:T,startsExpr:m}),_this:k("this",{startsExpr:m}),_super:k("super",{startsExpr:m}),_class:k("class",{startsExpr:m}),_extends:k("extends",{beforeExpr:T}),_export:k("export"),_import:k("import",{startsExpr:m}),_null:k("null",{startsExpr:m}),_true:k("true",{startsExpr:m}),_false:k("false",{startsExpr:m}),_typeof:k("typeof",{beforeExpr:T,prefix:H,startsExpr:m}),_void:k("void",{beforeExpr:T,prefix:H,startsExpr:m}),_delete:k("delete",{beforeExpr:T,prefix:H,startsExpr:m}),_do:k("do",{isLoop:Ge,beforeExpr:T}),_for:k("for",{isLoop:Ge}),_while:k("while",{isLoop:Ge}),_as:S("as",{startsExpr:m}),_assert:S("assert",{startsExpr:m}),_async:S("async",{startsExpr:m}),_await:S("await",{startsExpr:m}),_defer:S("defer",{startsExpr:m}),_from:S("from",{startsExpr:m}),_get:S("get",{startsExpr:m}),_let:S("let",{startsExpr:m}),_meta:S("meta",{startsExpr:m}),_of:S("of",{startsExpr:m}),_sent:S("sent",{startsExpr:m}),_set:S("set",{startsExpr:m}),_source:S("source",{startsExpr:m}),_static:S("static",{startsExpr:m}),_using:S("using",{startsExpr:m}),_yield:S("yield",{startsExpr:m}),_asserts:S("asserts",{startsExpr:m}),_checks:S("checks",{startsExpr:m}),_exports:S("exports",{startsExpr:m}),_global:S("global",{startsExpr:m}),_implements:S("implements",{startsExpr:m}),_intrinsic:S("intrinsic",{startsExpr:m}),_infer:S("infer",{startsExpr:m}),_is:S("is",{startsExpr:m}),_mixins:S("mixins",{startsExpr:m}),_proto:S("proto",{startsExpr:m}),_require:S("require",{startsExpr:m}),_satisfies:S("satisfies",{startsExpr:m}),_keyof:S("keyof",{startsExpr:m}),_readonly:S("readonly",{startsExpr:m}),_unique:S("unique",{startsExpr:m}),_abstract:S("abstract",{startsExpr:m}),_declare:S("declare",{startsExpr:m}),_enum:S("enum",{startsExpr:m}),_module:S("module",{startsExpr:m}),_namespace:S("namespace",{startsExpr:m}),_interface:S("interface",{startsExpr:m}),_type:S("type",{startsExpr:m}),_opaque:S("opaque",{startsExpr:m}),name:g("name",{startsExpr:m}),placeholder:g("%%",{startsExpr:m}),string:g("string",{startsExpr:m}),num:g("num",{startsExpr:m}),bigint:g("bigint",{startsExpr:m}),decimal:g("decimal",{startsExpr:m}),regexp:g("regexp",{startsExpr:m}),privateName:g("#name",{startsExpr:m}),eof:g("eof"),jsxName:g("jsxName"),jsxText:g("jsxText",{beforeExpr:T}),jsxTagStart:g("jsxTagStart",{startsExpr:m}),jsxTagEnd:g("jsxTagEnd")};function v(a){return a>=93&&a<=133}function Xr(a){return a<=92}function $(a){return a>=58&&a<=133}function Ai(a){return a>=58&&a<=137}function Gr(a){return Et[a]}function de(a){return It[a]}function Yr(a){return a>=29&&a<=33}function pi(a){return a>=129&&a<=131}function Qr(a){return a>=90&&a<=92}function vt(a){return a>=58&&a<=92}function Zr(a){return a>=39&&a<=59}function ea(a){return a===34}function ta(a){return Ct[a]}function sa(a){return a>=121&&a<=123}function ia(a){return a>=124&&a<=130}function X(a){return St[a]}function Ee(a){return kt[a]}function ra(a){return a===57}function ve(a){return a>=24&&a<=25}function z(a){return V[a]}V[8].updateContext=a=>{a.pop()},V[5].updateContext=V[7].updateContext=V[23].updateContext=a=>{a.push(C.brace)},V[22].updateContext=a=>{a[a.length-1]===C.template?a.pop():a.push(C.template)},V[143].updateContext=a=>{a.push(C.j_expr,C.j_oTag)};var Nt="\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088F\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5C\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDC-\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7DC\uA7F1-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC",Si="\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0897-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65",aa=new RegExp("["+Nt+"]"),na=new RegExp("["+Nt+Si+"]");Nt=Si=null;var ki=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],oa=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239];function st(a,t){let e=65536;for(let s=0,i=t.length;s<i;s+=2){if(e+=t[s],e>a)return!1;if(e+=t[s+1],e>=a)return!0}return!1}function U(a){return a<65?a===36:a<=90?!0:a<97?a===95:a<=122?!0:a<=65535?a>=170&&aa.test(String.fromCharCode(a)):st(a,ki)}function ee(a){return a<48?a===36:a<58?!0:a<65?!1:a<=90?!0:a<97?a===95:a<=122?!0:a<=65535?a>=170&&na.test(String.fromCharCode(a)):st(a,ki)||st(a,oa)}var _t={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]},ca=new Set(_t.keyword),la=new Set(_t.strict),ha=new Set(_t.strictBind);function Ei(a,t){return t&&a==="await"||a==="enum"}function Ii(a,t){return Ei(a,t)||la.has(a)}function Ci(a){return ha.has(a)}function vi(a,t){return Ii(a,t)||Ci(a)}function ua(a){return ca.has(a)}function pa(a,t,e){return a===64&&t===64&&U(e)}var da=new Set(["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete","implements","interface","let","package","private","protected","public","static","yield","eval","arguments","enum","await"]);function fa(a){return da.has(a)}var ye=class{constructor(t){this.flags=0,this.names=new Map,this.firstLexicalName="",this.flags=t}},xe=class{constructor(t,e){this.parser=void 0,this.scopeStack=[],this.inModule=void 0,this.undefinedExports=new Map,this.parser=t,this.inModule=e}get inTopLevel(){return(this.currentScope().flags&1)>0}get inFunction(){return(this.currentVarScopeFlags()&2)>0}get allowSuper(){return(this.currentThisScopeFlags()&16)>0}get allowDirectSuper(){return(this.currentThisScopeFlags()&32)>0}get allowNewTarget(){return(this.currentThisScopeFlags()&512)>0}get inClass(){return(this.currentThisScopeFlags()&64)>0}get inClassAndNotInNonArrowFunction(){let t=this.currentThisScopeFlags();return(t&64)>0&&(t&2)===0}get inStaticBlock(){for(let t=this.scopeStack.length-1;;t--){let{flags:e}=this.scopeStack[t];if(e&128)return!0;if(e&1731)return!1}}get inNonArrowFunction(){return(this.currentThisScopeFlags()&2)>0}get inBareCaseStatement(){return(this.currentScope().flags&256)>0}get treatFunctionsAsVar(){return this.treatFunctionsAsVarInScope(this.currentScope())}createScope(t){return new ye(t)}enter(t){this.scopeStack.push(this.createScope(t))}exit(){return this.scopeStack.pop().flags}treatFunctionsAsVarInScope(t){return!!(t.flags&130||!this.parser.inModule&&t.flags&1)}declareName(t,e,s){let i=this.currentScope();if(e&8||e&16){this.checkRedeclarationInScope(i,t,e,s);let r=i.names.get(t)||0;e&16?r=r|4:(i.firstLexicalName||(i.firstLexicalName=t),r=r|2),i.names.set(t,r),e&8&&this.maybeExportDefined(i,t)}else if(e&4)for(let r=this.scopeStack.length-1;r>=0&&(i=this.scopeStack[r],this.checkRedeclarationInScope(i,t,e,s),i.names.set(t,(i.names.get(t)||0)|1),this.maybeExportDefined(i,t),!(i.flags&1667));--r);this.parser.inModule&&i.flags&1&&this.undefinedExports.delete(t)}maybeExportDefined(t,e){this.parser.inModule&&t.flags&1&&this.undefinedExports.delete(e)}checkRedeclarationInScope(t,e,s,i){this.isRedeclaredInScope(t,e,s)&&this.parser.raise(u.VarRedeclaration,i,{identifierName:e})}isRedeclaredInScope(t,e,s){if(!(s&1))return!1;if(s&8)return t.names.has(e);let i=t.names.get(e)||0;return s&16?(i&2)>0||!this.treatFunctionsAsVarInScope(t)&&(i&1)>0:(i&2)>0&&!(t.flags&8&&t.firstLexicalName===e)||!this.treatFunctionsAsVarInScope(t)&&(i&4)>0}checkLocalExport(t){let{name:e}=t;this.scopeStack[0].names.has(e)||this.undefinedExports.set(e,t.loc.start)}currentScope(){return this.scopeStack[this.scopeStack.length-1]}currentVarScopeFlags(){for(let t=this.scopeStack.length-1;;t--){let{flags:e}=this.scopeStack[t];if(e&1667)return e}}currentThisScopeFlags(){for(let t=this.scopeStack.length-1;;t--){let{flags:e}=this.scopeStack[t];if(e&1731&&!(e&4))return e}}},it=class extends ye{constructor(...t){super(...t),this.declareFunctions=new Set}},rt=class extends xe{createScope(t){return new it(t)}declareName(t,e,s){let i=this.currentScope();if(e&2048){this.checkRedeclarationInScope(i,t,e,s),this.maybeExportDefined(i,t),i.declareFunctions.add(t);return}super.declareName(t,e,s)}isRedeclaredInScope(t,e,s){if(super.isRedeclaredInScope(t,e,s))return!0;if(s&2048&&!t.declareFunctions.has(e)){let i=t.names.get(e);return(i&4)>0||(i&2)>0}return!1}checkLocalExport(t){this.scopeStack[0].declareFunctions.has(t.name)||super.checkLocalExport(t)}},ma=new Set(["_","any","bool","boolean","empty","extends","false","interface","mixed","null","number","static","string","true","typeof","void"]),P=R`flow`({AmbiguousConditionalArrow:"Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",AmbiguousDeclareModuleKind:"Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",AssignReservedType:({reservedType:a})=>`Cannot overwrite reserved type ${a}.`,DeclareClassElement:"The `declare` modifier can only appear on class fields.",DeclareClassFieldInitializer:"Initializers are not allowed in fields with the `declare` modifier.",DuplicateDeclareModuleExports:"Duplicate `declare module.exports` statement.",EnumBooleanMemberNotInitialized:({memberName:a,enumName:t})=>`Boolean enum members need to be initialized. Use either \`${a} = true,\` or \`${a} = false,\` in enum \`${t}\`.`,EnumDuplicateMemberName:({memberName:a,enumName:t})=>`Enum member names need to be unique, but the name \`${a}\` has already been used before in enum \`${t}\`.`,EnumInconsistentMemberValues:({enumName:a})=>`Enum \`${a}\` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.`,EnumInvalidExplicitType:({invalidEnumType:a,enumName:t})=>`Enum type \`${a}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${t}\`.`,EnumInvalidExplicitTypeUnknownSupplied:({enumName:a})=>`Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${a}\`.`,EnumInvalidMemberInitializerPrimaryType:({enumName:a,memberName:t,explicitType:e})=>`Enum \`${a}\` has type \`${e}\`, so the initializer of \`${t}\` needs to be a ${e} literal.`,EnumInvalidMemberInitializerSymbolType:({enumName:a,memberName:t})=>`Symbol enum members cannot be initialized. Use \`${t},\` in enum \`${a}\`.`,EnumInvalidMemberInitializerUnknownType:({enumName:a,memberName:t})=>`The enum member initializer for \`${t}\` needs to be a literal (either a boolean, number, or string) in enum \`${a}\`.`,EnumInvalidMemberName:({enumName:a,memberName:t,suggestion:e})=>`Enum member names cannot start with lowercase 'a' through 'z'. Instead of using \`${t}\`, consider using \`${e}\`, in enum \`${a}\`.`,EnumNumberMemberNotInitialized:({enumName:a,memberName:t})=>`Number enum members need to be initialized, e.g. \`${t} = 1\` in enum \`${a}\`.`,EnumStringMemberInconsistentlyInitialized:({enumName:a})=>`String enum members need to consistently either all use initializers, or use no initializers, in enum \`${a}\`.`,GetterMayNotHaveThisParam:"A getter cannot have a `this` parameter.",ImportReflectionHasImportType:"An `import module` declaration can not use `type` or `typeof` keyword.",ImportTypeShorthandOnlyInPureImport:"The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements.",InexactInsideExact:"Explicit inexact syntax cannot appear inside an explicit exact object type.",InexactInsideNonObject:"Explicit inexact syntax cannot appear in class or interface definitions.",InexactVariance:"Explicit inexact syntax cannot have variance.",InvalidNonTypeImportInDeclareModule:"Imports within a `declare module` body must always be `import type` or `import typeof`.",MissingTypeParamDefault:"Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",NestedDeclareModule:"`declare module` cannot be used inside another `declare module`.",NestedFlowComment:"Cannot have a flow comment inside another flow comment.",PatternIsOptional:Object.assign({message:"A binding pattern parameter cannot be optional in an implementation signature."},{reasonCode:"OptionalBindingPattern"}),SetterMayNotHaveThisParam:"A setter cannot have a `this` parameter.",SpreadVariance:"Spread properties cannot have variance.",ThisParamAnnotationRequired:"A type annotation is required for the `this` parameter.",ThisParamBannedInConstructor:"Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",ThisParamMayNotBeOptional:"The `this` parameter cannot be optional.",ThisParamMustBeFirst:"The `this` parameter must be the first function parameter.",ThisParamNoDefault:"The `this` parameter may not have a default value.",TypeBeforeInitializer:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeCastInPattern:"The type cast expression is expected to be wrapped with parenthesis.",UnexpectedExplicitInexactInObject:"Explicit inexact syntax must appear at the end of an inexact object.",UnexpectedReservedType:({reservedType:a})=>`Unexpected reserved type ${a}.`,UnexpectedReservedUnderscore:"`_` is only allowed as a type argument to call or new.",UnexpectedSpaceBetweenModuloChecks:"Spaces between `%` and `checks` are not allowed here.",UnexpectedSpreadType:"Spread operator cannot appear in class or interface definitions.",UnexpectedSubtractionOperand:'Unexpected token, expected "number" or "bigint".',UnexpectedTokenAfterTypeParameter:"Expected an arrow function after this type parameter declaration.",UnexpectedTypeParameterBeforeAsyncArrowFunction:"Type parameters must come after the async keyword, e.g. instead of `<T> async () => {}`, use `async <T>() => {}`.",UnsupportedDeclareExportKind:({unsupportedExportKind:a,suggestion:t})=>`\`declare export ${a}\` is not supported. Use \`${t}\` instead.`,UnsupportedStatementInDeclareModule:"Only declares and type imports are allowed inside declare module.",UnterminatedFlowComment:"Unterminated flow-comment."});function ya(a){return a.type==="DeclareExportAllDeclaration"||a.type==="DeclareExportDeclaration"&&(!a.declaration||a.declaration.type!=="TypeAlias"&&a.declaration.type!=="InterfaceDeclaration")}function di(a){return a.importKind==="type"||a.importKind==="typeof"}var xa={const:"declare export var",let:"declare export var",type:"export type",interface:"export interface"};function ga(a,t){let e=[],s=[];for(let i=0;i<a.length;i++)(t(a[i],i,a)?e:s).push(a[i]);return[e,s]}var wa=/\*?\s*@((?:no)?flow)\b/,Pa=a=>class extends a{constructor(...e){super(...e),this.flowPragma=void 0}getScopeHandler(){return rt}shouldParseTypes(){return this.getPluginOption("flow","all")||this.flowPragma==="flow"}finishToken(e,s){e!==134&&e!==13&&e!==28&&this.flowPragma===void 0&&(this.flowPragma=null),super.finishToken(e,s)}addComment(e){if(this.flowPragma===void 0){let s=wa.exec(e.value);if(s)if(s[1]==="flow")this.flowPragma="flow";else if(s[1]==="noflow")this.flowPragma="noflow";else throw new Error("Unexpected flow pragma")}super.addComment(e)}flowParseTypeInitialiser(e){let s=this.state.inType;this.state.inType=!0,this.expect(e||14);let i=this.flowParseType();return this.state.inType=s,i}flowParsePredicate(){let e=this.startNode(),s=this.state.startLoc;return this.next(),this.expectContextual(110),this.state.lastTokStartLoc.index>s.index+1&&this.raise(P.UnexpectedSpaceBetweenModuloChecks,s),this.eat(10)?(e.value=super.parseExpression(),this.expect(11),this.finishNode(e,"DeclaredPredicate")):this.finishNode(e,"InferredPredicate")}flowParseTypeAndPredicateInitialiser(){let e=this.state.inType;this.state.inType=!0,this.expect(14);let s=null,i=null;return this.match(54)?(this.state.inType=e,i=this.flowParsePredicate()):(s=this.flowParseType(),this.state.inType=e,this.match(54)&&(i=this.flowParsePredicate())),[s,i]}flowParseDeclareClass(e){return this.next(),this.flowParseInterfaceish(e,!0),this.finishNode(e,"DeclareClass")}flowParseDeclareFunction(e){this.next();let s=e.id=this.parseIdentifier(),i=this.startNode(),r=this.startNode();this.match(47)?i.typeParameters=this.flowParseTypeParameterDeclaration():i.typeParameters=null,this.expect(10);let n=this.flowParseFunctionTypeParams();return i.params=n.params,i.rest=n.rest,i.this=n._this,this.expect(11),[i.returnType,e.predicate]=this.flowParseTypeAndPredicateInitialiser(),r.typeAnnotation=this.finishNode(i,"FunctionTypeAnnotation"),s.typeAnnotation=this.finishNode(r,"TypeAnnotation"),this.resetEndLocation(s),this.semicolon(),this.scope.declareName(e.id.name,2048,e.id.loc.start),this.finishNode(e,"DeclareFunction")}flowParseDeclare(e,s){if(this.match(80))return this.flowParseDeclareClass(e);if(this.match(68))return this.flowParseDeclareFunction(e);if(this.match(74))return this.flowParseDeclareVariable(e);if(this.eatContextual(127))return this.match(16)?this.flowParseDeclareModuleExports(e):(s&&this.raise(P.NestedDeclareModule,this.state.lastTokStartLoc),this.flowParseDeclareModule(e));if(this.isContextual(130))return this.flowParseDeclareTypeAlias(e);if(this.isContextual(131))return this.flowParseDeclareOpaqueType(e);if(this.isContextual(129))return this.flowParseDeclareInterface(e);if(this.match(82))return this.flowParseDeclareExportDeclaration(e,s);throw this.unexpected()}flowParseDeclareVariable(e){return this.next(),e.id=this.flowParseTypeAnnotatableIdentifier(!0),this.scope.declareName(e.id.name,5,e.id.loc.start),this.semicolon(),this.finishNode(e,"DeclareVariable")}flowParseDeclareModule(e){this.scope.enter(0),this.match(134)?e.id=super.parseExprAtom():e.id=this.parseIdentifier();let s=e.body=this.startNode(),i=s.body=[];for(this.expect(5);!this.match(8);){let o=this.startNode();this.match(83)?(this.next(),!this.isContextual(130)&&!this.match(87)&&this.raise(P.InvalidNonTypeImportInDeclareModule,this.state.lastTokStartLoc),i.push(super.parseImport(o))):(this.expectContextual(125,P.UnsupportedStatementInDeclareModule),i.push(this.flowParseDeclare(o,!0)))}this.scope.exit(),this.expect(8),this.finishNode(s,"BlockStatement");let r=null,n=!1;return i.forEach(o=>{ya(o)?(r==="CommonJS"&&this.raise(P.AmbiguousDeclareModuleKind,o),r="ES"):o.type==="DeclareModuleExports"&&(n&&this.raise(P.DuplicateDeclareModuleExports,o),r==="ES"&&this.raise(P.AmbiguousDeclareModuleKind,o),r="CommonJS",n=!0)}),e.kind=r||"CommonJS",this.finishNode(e,"DeclareModule")}flowParseDeclareExportDeclaration(e,s){if(this.expect(82),this.eat(65))return this.match(68)||this.match(80)?e.declaration=this.flowParseDeclare(this.startNode()):(e.declaration=this.flowParseType(),this.semicolon()),e.default=!0,this.finishNode(e,"DeclareExportDeclaration");if(this.match(75)||this.isLet()||(this.isContextual(130)||this.isContextual(129))&&!s){let i=this.state.value;throw this.raise(P.UnsupportedDeclareExportKind,this.state.startLoc,{unsupportedExportKind:i,suggestion:xa[i]})}if(this.match(74)||this.match(68)||this.match(80)||this.isContextual(131))return e.declaration=this.flowParseDeclare(this.startNode()),e.default=!1,this.finishNode(e,"DeclareExportDeclaration");if(this.match(55)||this.match(5)||this.isContextual(129)||this.isContextual(130)||this.isContextual(131))return e=this.parseExport(e,null),e.type==="ExportNamedDeclaration"?(e.default=!1,delete e.exportKind,this.castNodeTo(e,"DeclareExportDeclaration")):this.castNodeTo(e,"DeclareExportAllDeclaration");throw this.unexpected()}flowParseDeclareModuleExports(e){return this.next(),this.expectContextual(111),e.typeAnnotation=this.flowParseTypeAnnotation(),this.semicolon(),this.finishNode(e,"DeclareModuleExports")}flowParseDeclareTypeAlias(e){this.next();let s=this.flowParseTypeAlias(e);return this.castNodeTo(s,"DeclareTypeAlias"),s}flowParseDeclareOpaqueType(e){this.next();let s=this.flowParseOpaqueType(e,!0);return this.castNodeTo(s,"DeclareOpaqueType"),s}flowParseDeclareInterface(e){return this.next(),this.flowParseInterfaceish(e,!1),this.finishNode(e,"DeclareInterface")}flowParseInterfaceish(e,s){if(e.id=this.flowParseRestrictedIdentifier(!s,!0),this.scope.declareName(e.id.name,s?17:8201,e.id.loc.start),this.match(47)?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.extends=[],this.eat(81))do e.extends.push(this.flowParseInterfaceExtends());while(!s&&this.eat(12));if(s){if(e.implements=[],e.mixins=[],this.eatContextual(117))do e.mixins.push(this.flowParseInterfaceExtends());while(this.eat(12));if(this.eatContextual(113))do e.implements.push(this.flowParseInterfaceExtends());while(this.eat(12))}e.body=this.flowParseObjectType({allowStatic:s,allowExact:!1,allowSpread:!1,allowProto:s,allowInexact:!1})}flowParseInterfaceExtends(){let e=this.startNode();return e.id=this.flowParseQualifiedTypeIdentifier(),this.match(47)?e.typeParameters=this.flowParseTypeParameterInstantiation():e.typeParameters=null,this.finishNode(e,"InterfaceExtends")}flowParseInterface(e){return this.flowParseInterfaceish(e,!1),this.finishNode(e,"InterfaceDeclaration")}checkNotUnderscore(e){e==="_"&&this.raise(P.UnexpectedReservedUnderscore,this.state.startLoc)}checkReservedType(e,s,i){ma.has(e)&&this.raise(i?P.AssignReservedType:P.UnexpectedReservedType,s,{reservedType:e})}flowParseRestrictedIdentifier(e,s){return this.checkReservedType(this.state.value,this.state.startLoc,s),this.parseIdentifier(e)}flowParseTypeAlias(e){return e.id=this.flowParseRestrictedIdentifier(!1,!0),this.scope.declareName(e.id.name,8201,e.id.loc.start),this.match(47)?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.right=this.flowParseTypeInitialiser(29),this.semicolon(),this.finishNode(e,"TypeAlias")}flowParseOpaqueType(e,s){return this.expectContextual(130),e.id=this.flowParseRestrictedIdentifier(!0,!0),this.scope.declareName(e.id.name,8201,e.id.loc.start),this.match(47)?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.supertype=null,this.match(14)&&(e.supertype=this.flowParseTypeInitialiser(14)),e.impltype=null,s||(e.impltype=this.flowParseTypeInitialiser(29)),this.semicolon(),this.finishNode(e,"OpaqueType")}flowParseTypeParameter(e=!1){let s=this.state.startLoc,i=this.startNode(),r=this.flowParseVariance(),n=this.flowParseTypeAnnotatableIdentifier();return i.name=n.name,i.variance=r,i.bound=n.typeAnnotation,this.match(29)?(this.eat(29),i.default=this.flowParseType()):e&&this.raise(P.MissingTypeParamDefault,s),this.finishNode(i,"TypeParameter")}flowParseTypeParameterDeclaration(){let e=this.state.inType,s=this.startNode();s.params=[],this.state.inType=!0,this.match(47)||this.match(143)?this.next():this.unexpected();let i=!1;do{let r=this.flowParseTypeParameter(i);s.params.push(r),r.default&&(i=!0),this.match(48)||this.expect(12)}while(!this.match(48));return this.expect(48),this.state.inType=e,this.finishNode(s,"TypeParameterDeclaration")}flowInTopLevelContext(e){if(this.curContext()!==C.brace){let s=this.state.context;this.state.context=[s[0]];try{return e()}finally{this.state.context=s}}else return e()}flowParseTypeParameterInstantiationInExpression(){if(this.reScan_lt()===47)return this.flowParseTypeParameterInstantiation()}flowParseTypeParameterInstantiation(){let e=this.startNode(),s=this.state.inType;return this.state.inType=!0,e.params=[],this.flowInTopLevelContext(()=>{this.expect(47);let i=this.state.noAnonFunctionType;for(this.state.noAnonFunctionType=!1;!this.match(48);)e.params.push(this.flowParseType()),this.match(48)||this.expect(12);this.state.noAnonFunctionType=i}),this.state.inType=s,!this.state.inType&&this.curContext()===C.brace&&this.reScan_lt_gt(),this.expect(48),this.finishNode(e,"TypeParameterInstantiation")}flowParseTypeParameterInstantiationCallOrNew(){if(this.reScan_lt()!==47)return null;let e=this.startNode(),s=this.state.inType;for(e.params=[],this.state.inType=!0,this.expect(47);!this.match(48);)e.params.push(this.flowParseTypeOrImplicitInstantiation()),this.match(48)||this.expect(12);return this.expect(48),this.state.inType=s,this.finishNode(e,"TypeParameterInstantiation")}flowParseInterfaceType(){let e=this.startNode();if(this.expectContextual(129),e.extends=[],this.eat(81))do e.extends.push(this.flowParseInterfaceExtends());while(this.eat(12));return e.body=this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!1,allowProto:!1,allowInexact:!1}),this.finishNode(e,"InterfaceTypeAnnotation")}flowParseObjectPropertyKey(){return this.match(135)||this.match(134)?super.parseExprAtom():this.parseIdentifier(!0)}flowParseObjectTypeIndexer(e,s,i){return e.static=s,this.lookahead().type===14?(e.id=this.flowParseObjectPropertyKey(),e.key=this.flowParseTypeInitialiser()):(e.id=null,e.key=this.flowParseType()),this.expect(3),e.value=this.flowParseTypeInitialiser(),e.variance=i,this.finishNode(e,"ObjectTypeIndexer")}flowParseObjectTypeInternalSlot(e,s){return e.static=s,e.id=this.flowParseObjectPropertyKey(),this.expect(3),this.expect(3),this.match(47)||this.match(10)?(e.method=!0,e.optional=!1,e.value=this.flowParseObjectTypeMethodish(this.startNodeAt(e.loc.start))):(e.method=!1,this.eat(17)&&(e.optional=!0),e.value=this.flowParseTypeInitialiser()),this.finishNode(e,"ObjectTypeInternalSlot")}flowParseObjectTypeMethodish(e){for(e.params=[],e.rest=null,e.typeParameters=null,e.this=null,this.match(47)&&(e.typeParameters=this.flowParseTypeParameterDeclaration()),this.expect(10),this.match(78)&&(e.this=this.flowParseFunctionTypeParam(!0),e.this.name=null,this.match(11)||this.expect(12));!this.match(11)&&!this.match(21);)e.params.push(this.flowParseFunctionTypeParam(!1)),this.match(11)||this.expect(12);return this.eat(21)&&(e.rest=this.flowParseFunctionTypeParam(!1)),this.expect(11),e.returnType=this.flowParseTypeInitialiser(),this.finishNode(e,"FunctionTypeAnnotation")}flowParseObjectTypeCallProperty(e,s){let i=this.startNode();return e.static=s,e.value=this.flowParseObjectTypeMethodish(i),this.finishNode(e,"ObjectTypeCallProperty")}flowParseObjectType({allowStatic:e,allowExact:s,allowSpread:i,allowProto:r,allowInexact:n}){let o=this.state.inType;this.state.inType=!0;let c=this.startNode();c.callProperties=[],c.properties=[],c.indexers=[],c.internalSlots=[];let l,h,p=!1;for(s&&this.match(6)?(this.expect(6),l=9,h=!0):(this.expect(5),l=8,h=!1),c.exact=h;!this.match(l);){let f=!1,x=null,I=null,L=this.startNode();if(r&&this.isContextual(118)){let _=this.lookahead();_.type!==14&&_.type!==17&&(this.next(),x=this.state.startLoc,e=!1)}if(e&&this.isContextual(106)){let _=this.lookahead();_.type!==14&&_.type!==17&&(this.next(),f=!0)}let b=this.flowParseVariance();if(this.eat(0))x!=null&&this.unexpected(x),this.eat(0)?(b&&this.unexpected(b.loc.start),c.internalSlots.push(this.flowParseObjectTypeInternalSlot(L,f))):c.indexers.push(this.flowParseObjectTypeIndexer(L,f,b));else if(this.match(10)||this.match(47))x!=null&&this.unexpected(x),b&&this.unexpected(b.loc.start),c.callProperties.push(this.flowParseObjectTypeCallProperty(L,f));else{let _="init";if(this.isContextual(99)||this.isContextual(104)){let q=this.lookahead();Ai(q.type)&&(_=this.state.value,this.next())}let G=this.flowParseObjectTypeProperty(L,f,x,b,_,i,n??!h);G===null?(p=!0,I=this.state.lastTokStartLoc):c.properties.push(G)}this.flowObjectTypeSemicolon(),I&&!this.match(8)&&!this.match(9)&&this.raise(P.UnexpectedExplicitInexactInObject,I)}this.expect(l),i&&(c.inexact=p);let d=this.finishNode(c,"ObjectTypeAnnotation");return this.state.inType=o,d}flowParseObjectTypeProperty(e,s,i,r,n,o,c){if(this.eat(21))return this.match(12)||this.match(13)||this.match(8)||this.match(9)?(o?c||this.raise(P.InexactInsideExact,this.state.lastTokStartLoc):this.raise(P.InexactInsideNonObject,this.state.lastTokStartLoc),r&&this.raise(P.InexactVariance,r),null):(o||this.raise(P.UnexpectedSpreadType,this.state.lastTokStartLoc),i!=null&&this.unexpected(i),r&&this.raise(P.SpreadVariance,r),e.argument=this.flowParseType(),this.finishNode(e,"ObjectTypeSpreadProperty"));{e.key=this.flowParseObjectPropertyKey(),e.static=s,e.proto=i!=null,e.kind=n;let l=!1;return this.match(47)||this.match(10)?(e.method=!0,i!=null&&this.unexpected(i),r&&this.unexpected(r.loc.start),e.value=this.flowParseObjectTypeMethodish(this.startNodeAt(e.loc.start)),(n==="get"||n==="set")&&this.flowCheckGetterSetterParams(e),!o&&e.key.name==="constructor"&&e.value.this&&this.raise(P.ThisParamBannedInConstructor,e.value.this)):(n!=="init"&&this.unexpected(),e.method=!1,this.eat(17)&&(l=!0),e.value=this.flowParseTypeInitialiser(),e.variance=r),e.optional=l,this.finishNode(e,"ObjectTypeProperty")}}flowCheckGetterSetterParams(e){let s=e.kind==="get"?0:1,i=e.value.params.length+(e.value.rest?1:0);e.value.this&&this.raise(e.kind==="get"?P.GetterMayNotHaveThisParam:P.SetterMayNotHaveThisParam,e.value.this),i!==s&&this.raise(e.kind==="get"?u.BadGetterArity:u.BadSetterArity,e),e.kind==="set"&&e.value.rest&&this.raise(u.BadSetterRestParameter,e)}flowObjectTypeSemicolon(){!this.eat(13)&&!this.eat(12)&&!this.match(8)&&!this.match(9)&&this.unexpected()}flowParseQualifiedTypeIdentifier(e,s){e??(e=this.state.startLoc);let i=s||this.flowParseRestrictedIdentifier(!0);for(;this.eat(16);){let r=this.startNodeAt(e);r.qualification=i,r.id=this.flowParseRestrictedIdentifier(!0),i=this.finishNode(r,"QualifiedTypeIdentifier")}return i}flowParseGenericType(e,s){let i=this.startNodeAt(e);return i.typeParameters=null,i.id=this.flowParseQualifiedTypeIdentifier(e,s),this.match(47)&&(i.typeParameters=this.flowParseTypeParameterInstantiation()),this.finishNode(i,"GenericTypeAnnotation")}flowParseTypeofType(){let e=this.startNode();return this.expect(87),e.argument=this.flowParsePrimaryType(),this.finishNode(e,"TypeofTypeAnnotation")}flowParseTupleType(){let e=this.startNode();for(e.types=[],this.expect(0);this.state.pos<this.length&&!this.match(3)&&(e.types.push(this.flowParseType()),!this.match(3));)this.expect(12);return this.expect(3),this.finishNode(e,"TupleTypeAnnotation")}flowParseFunctionTypeParam(e){let s=null,i=!1,r=null,n=this.startNode(),o=this.lookahead(),c=this.state.type===78;return o.type===14||o.type===17?(c&&!e&&this.raise(P.ThisParamMustBeFirst,n),s=this.parseIdentifier(c),this.eat(17)&&(i=!0,c&&this.raise(P.ThisParamMayNotBeOptional,n)),r=this.flowParseTypeInitialiser()):r=this.flowParseType(),n.name=s,n.optional=i,n.typeAnnotation=r,this.finishNode(n,"FunctionTypeParam")}reinterpretTypeAsFunctionTypeParam(e){let s=this.startNodeAt(e.loc.start);return s.name=null,s.optional=!1,s.typeAnnotation=e,this.finishNode(s,"FunctionTypeParam")}flowParseFunctionTypeParams(e=[]){let s=null,i=null;for(this.match(78)&&(i=this.flowParseFunctionTypeParam(!0),i.name=null,this.match(11)||this.expect(12));!this.match(11)&&!this.match(21);)e.push(this.flowParseFunctionTypeParam(!1)),this.match(11)||this.expect(12);return this.eat(21)&&(s=this.flowParseFunctionTypeParam(!1)),{params:e,rest:s,_this:i}}flowIdentToTypeAnnotation(e,s,i){switch(i.name){case"any":return this.finishNode(s,"AnyTypeAnnotation");case"bool":case"boolean":return this.finishNode(s,"BooleanTypeAnnotation");case"mixed":return this.finishNode(s,"MixedTypeAnnotation");case"empty":return this.finishNode(s,"EmptyTypeAnnotation");case"number":return this.finishNode(s,"NumberTypeAnnotation");case"string":return this.finishNode(s,"StringTypeAnnotation");case"symbol":return this.finishNode(s,"SymbolTypeAnnotation");default:return this.checkNotUnderscore(i.name),this.flowParseGenericType(e,i)}}flowParsePrimaryType(){let e=this.state.startLoc,s=this.startNode(),i,r,n=!1,o=this.state.noAnonFunctionType;switch(this.state.type){case 5:return this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!0,allowProto:!1,allowInexact:!0});case 6:return this.flowParseObjectType({allowStatic:!1,allowExact:!0,allowSpread:!0,allowProto:!1,allowInexact:!1});case 0:return this.state.noAnonFunctionType=!1,r=this.flowParseTupleType(),this.state.noAnonFunctionType=o,r;case 47:{let c=this.startNode();return c.typeParameters=this.flowParseTypeParameterDeclaration(),this.expect(10),i=this.flowParseFunctionTypeParams(),c.params=i.params,c.rest=i.rest,c.this=i._this,this.expect(11),this.expect(19),c.returnType=this.flowParseType(),this.finishNode(c,"FunctionTypeAnnotation")}case 10:{let c=this.startNode();if(this.next(),!this.match(11)&&!this.match(21))if(v(this.state.type)||this.match(78)){let l=this.lookahead().type;n=l!==17&&l!==14}else n=!0;if(n){if(this.state.noAnonFunctionType=!1,r=this.flowParseType(),this.state.noAnonFunctionType=o,this.state.noAnonFunctionType||!(this.match(12)||this.match(11)&&this.lookahead().type===19))return this.expect(11),r;this.eat(12)}return r?i=this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(r)]):i=this.flowParseFunctionTypeParams(),c.params=i.params,c.rest=i.rest,c.this=i._this,this.expect(11),this.expect(19),c.returnType=this.flowParseType(),c.typeParameters=null,this.finishNode(c,"FunctionTypeAnnotation")}case 134:return this.parseLiteral(this.state.value,"StringLiteralTypeAnnotation");case 85:case 86:return s.value=this.match(85),this.next(),this.finishNode(s,"BooleanLiteralTypeAnnotation");case 53:if(this.state.value==="-"){if(this.next(),this.match(135))return this.parseLiteralAtNode(-this.state.value,"NumberLiteralTypeAnnotation",s);if(this.match(136))return this.parseLiteralAtNode(-this.state.value,"BigIntLiteralTypeAnnotation",s);throw this.raise(P.UnexpectedSubtractionOperand,this.state.startLoc)}throw this.unexpected();case 135:return this.parseLiteral(this.state.value,"NumberLiteralTypeAnnotation");case 136:return this.parseLiteral(this.state.value,"BigIntLiteralTypeAnnotation");case 88:return this.next(),this.finishNode(s,"VoidTypeAnnotation");case 84:return this.next(),this.finishNode(s,"NullLiteralTypeAnnotation");case 78:return this.next(),this.finishNode(s,"ThisTypeAnnotation");case 55:return this.next(),this.finishNode(s,"ExistsTypeAnnotation");case 87:return this.flowParseTypeofType();default:if(vt(this.state.type)){let c=X(this.state.type);return this.next(),super.createIdentifier(s,c)}else if(v(this.state.type))return this.isContextual(129)?this.flowParseInterfaceType():this.flowIdentToTypeAnnotation(e,s,this.parseIdentifier())}throw this.unexpected()}flowParsePostfixType(){let e=this.state.startLoc,s=this.flowParsePrimaryType(),i=!1;for(;(this.match(0)||this.match(18))&&!this.canInsertSemicolon();){let r=this.startNodeAt(e),n=this.eat(18);i=i||n,this.expect(0),!n&&this.match(3)?(r.elementType=s,this.next(),s=this.finishNode(r,"ArrayTypeAnnotation")):(r.objectType=s,r.indexType=this.flowParseType(),this.expect(3),i?(r.optional=n,s=this.finishNode(r,"OptionalIndexedAccessType")):s=this.finishNode(r,"IndexedAccessType"))}return s}flowParsePrefixType(){let e=this.startNode();return this.eat(17)?(e.typeAnnotation=this.flowParsePrefixType(),this.finishNode(e,"NullableTypeAnnotation")):this.flowParsePostfixType()}flowParseAnonFunctionWithoutParens(){let e=this.flowParsePrefixType();if(!this.state.noAnonFunctionType&&this.eat(19)){let s=this.startNodeAt(e.loc.start);return s.params=[this.reinterpretTypeAsFunctionTypeParam(e)],s.rest=null,s.this=null,s.returnType=this.flowParseType(),s.typeParameters=null,this.finishNode(s,"FunctionTypeAnnotation")}return e}flowParseIntersectionType(){let e=this.startNode();this.eat(45);let s=this.flowParseAnonFunctionWithoutParens();for(e.types=[s];this.eat(45);)e.types.push(this.flowParseAnonFunctionWithoutParens());return e.types.length===1?s:this.finishNode(e,"IntersectionTypeAnnotation")}flowParseUnionType(){let e=this.startNode();this.eat(43);let s=this.flowParseIntersectionType();for(e.types=[s];this.eat(43);)e.types.push(this.flowParseIntersectionType());return e.types.length===1?s:this.finishNode(e,"UnionTypeAnnotation")}flowParseType(){let e=this.state.inType;this.state.inType=!0;let s=this.flowParseUnionType();return this.state.inType=e,s}flowParseTypeOrImplicitInstantiation(){if(this.state.type===132&&this.state.value==="_"){let e=this.state.startLoc,s=this.parseIdentifier();return this.flowParseGenericType(e,s)}else return this.flowParseType()}flowParseTypeAnnotation(){let e=this.startNode();return e.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(e,"TypeAnnotation")}flowParseTypeAnnotatableIdentifier(e){let s=e?this.parseIdentifier():this.flowParseRestrictedIdentifier();return this.match(14)&&(s.typeAnnotation=this.flowParseTypeAnnotation(),this.resetEndLocation(s)),s}typeCastToParameter(e){return e.expression.typeAnnotation=e.typeAnnotation,this.resetEndLocation(e.expression,e.typeAnnotation.loc.end),e.expression}flowParseVariance(){let e=null;return this.match(53)?(e=this.startNode(),this.state.value==="+"?e.kind="plus":e.kind="minus",this.next(),this.finishNode(e,"Variance")):e}parseFunctionBody(e,s,i=!1){if(s){this.forwardNoArrowParamsConversionAt(e,()=>super.parseFunctionBody(e,!0,i));return}super.parseFunctionBody(e,!1,i)}parseFunctionBodyAndFinish(e,s,i=!1){if(this.match(14)){let r=this.startNode();[r.typeAnnotation,e.predicate]=this.flowParseTypeAndPredicateInitialiser(),e.returnType=r.typeAnnotation?this.finishNode(r,"TypeAnnotation"):null}return super.parseFunctionBodyAndFinish(e,s,i)}parseStatementLike(e){if(this.state.strict&&this.isContextual(129)){let i=this.lookahead();if($(i.type)){let r=this.startNode();return this.next(),this.flowParseInterface(r)}}else if(this.isContextual(126)){let i=this.startNode();return this.next(),this.flowParseEnumDeclaration(i)}let s=super.parseStatementLike(e);return this.flowPragma===void 0&&!this.isValidDirective(s)&&(this.flowPragma=null),s}parseExpressionStatement(e,s,i){if(s.type==="Identifier"){if(s.name==="declare"){if(this.match(80)||v(this.state.type)||this.match(68)||this.match(74)||this.match(82))return this.flowParseDeclare(e)}else if(v(this.state.type)){if(s.name==="interface")return this.flowParseInterface(e);if(s.name==="type")return this.flowParseTypeAlias(e);if(s.name==="opaque")return this.flowParseOpaqueType(e,!1)}}return super.parseExpressionStatement(e,s,i)}shouldParseExportDeclaration(){let{type:e}=this.state;return e===126||pi(e)?!this.state.containsEsc:super.shouldParseExportDeclaration()}isExportDefaultSpecifier(){let{type:e}=this.state;return e===126||pi(e)?this.state.containsEsc:super.isExportDefaultSpecifier()}parseExportDefaultExpression(){if(this.isContextual(126)){let e=this.startNode();return this.next(),this.flowParseEnumDeclaration(e)}return super.parseExportDefaultExpression()}parseConditional(e,s,i){if(!this.match(17))return e;if(this.state.maybeInArrowParameters){let d=this.lookaheadCharCode();if(d===44||d===61||d===58||d===41)return this.setOptionalParametersError(i),e}this.expect(17);let r=this.state.clone(),n=this.state.noArrowAt,o=this.startNodeAt(s),{consequent:c,failed:l}=this.tryParseConditionalConsequent(),[h,p]=this.getArrowLikeExpressions(c);if(l||p.length>0){let d=[...n];if(p.length>0){this.state=r,this.state.noArrowAt=d;for(let f=0;f<p.length;f++)d.push(p[f].start);({consequent:c,failed:l}=this.tryParseConditionalConsequent()),[h,p]=this.getArrowLikeExpressions(c)}l&&h.length>1&&this.raise(P.AmbiguousConditionalArrow,r.startLoc),l&&h.length===1&&(this.state=r,d.push(h[0].start),this.state.noArrowAt=d,{consequent:c,failed:l}=this.tryParseConditionalConsequent())}return this.getArrowLikeExpressions(c,!0),this.state.noArrowAt=n,this.expect(14),o.test=e,o.consequent=c,o.alternate=this.forwardNoArrowParamsConversionAt(o,()=>this.parseMaybeAssign(void 0,void 0)),this.finishNode(o,"ConditionalExpression")}tryParseConditionalConsequent(){this.state.noArrowParamsConversionAt.push(this.state.start);let e=this.parseMaybeAssignAllowIn(),s=!this.match(14);return this.state.noArrowParamsConversionAt.pop(),{consequent:e,failed:s}}getArrowLikeExpressions(e,s){let i=[e],r=[];for(;i.length!==0;){let n=i.pop();n.type==="ArrowFunctionExpression"&&n.body.type!=="BlockStatement"?(n.typeParameters||!n.returnType?this.finishArrowValidation(n):r.push(n),i.push(n.body)):n.type==="ConditionalExpression"&&(i.push(n.consequent),i.push(n.alternate))}return s?(r.forEach(n=>this.finishArrowValidation(n)),[r,[]]):ga(r,n=>n.params.every(o=>this.isAssignable(o,!0)))}finishArrowValidation(e){var s;this.toAssignableList(e.params,(s=e.extra)==null?void 0:s.trailingCommaLoc,!1),this.scope.enter(518),super.checkParams(e,!1,!0),this.scope.exit()}forwardNoArrowParamsConversionAt(e,s){let i;return this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(e.start))?(this.state.noArrowParamsConversionAt.push(this.state.start),i=s(),this.state.noArrowParamsConversionAt.pop()):i=s(),i}parseParenItem(e,s){let i=super.parseParenItem(e,s);if(this.eat(17)&&(i.optional=!0,this.resetEndLocation(e)),this.match(14)){let r=this.startNodeAt(s);return r.expression=i,r.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(r,"TypeCastExpression")}return i}assertModuleNodeAllowed(e){e.type==="ImportDeclaration"&&(e.importKind==="type"||e.importKind==="typeof")||e.type==="ExportNamedDeclaration"&&e.exportKind==="type"||e.type==="ExportAllDeclaration"&&e.exportKind==="type"||super.assertModuleNodeAllowed(e)}parseExportDeclaration(e){if(this.isContextual(130)){e.exportKind="type";let s=this.startNode();return this.next(),this.match(5)?(e.specifiers=this.parseExportSpecifiers(!0),super.parseExportFrom(e),null):this.flowParseTypeAlias(s)}else if(this.isContextual(131)){e.exportKind="type";let s=this.startNode();return this.next(),this.flowParseOpaqueType(s,!1)}else if(this.isContextual(129)){e.exportKind="type";let s=this.startNode();return this.next(),this.flowParseInterface(s)}else if(this.isContextual(126)){e.exportKind="value";let s=this.startNode();return this.next(),this.flowParseEnumDeclaration(s)}else return super.parseExportDeclaration(e)}eatExportStar(e){return super.eatExportStar(e)?!0:this.isContextual(130)&&this.lookahead().type===55?(e.exportKind="type",this.next(),this.next(),!0):!1}maybeParseExportNamespaceSpecifier(e){let{startLoc:s}=this.state,i=super.maybeParseExportNamespaceSpecifier(e);return i&&e.exportKind==="type"&&this.unexpected(s),i}parseClassId(e,s,i){super.parseClassId(e,s,i),this.match(47)&&(e.typeParameters=this.flowParseTypeParameterDeclaration())}parseClassMember(e,s,i){let{startLoc:r}=this.state;if(this.isContextual(125)){if(super.parseClassMemberFromModifier(e,s))return;s.declare=!0}super.parseClassMember(e,s,i),s.declare&&(s.type!=="ClassProperty"&&s.type!=="ClassPrivateProperty"&&s.type!=="PropertyDefinition"?this.raise(P.DeclareClassElement,r):s.value&&this.raise(P.DeclareClassFieldInitializer,s.value))}isIterator(e){return e==="iterator"||e==="asyncIterator"}readIterator(){let e=super.readWord1(),s="@@"+e;(!this.isIterator(e)||!this.state.inType)&&this.raise(u.InvalidIdentifier,this.state.curPosition(),{identifierName:s}),this.finishToken(132,s)}getTokenFromCode(e){let s=this.input.charCodeAt(this.state.pos+1);e===123&&s===124?this.finishOp(6,2):this.state.inType&&(e===62||e===60)?this.finishOp(e===62?48:47,1):this.state.inType&&e===63?s===46?this.finishOp(18,2):this.finishOp(17,1):pa(e,s,this.input.charCodeAt(this.state.pos+2))?(this.state.pos+=2,this.readIterator()):super.getTokenFromCode(e)}isAssignable(e,s){return e.type==="TypeCastExpression"?this.isAssignable(e.expression,s):super.isAssignable(e,s)}toAssignable(e,s=!1){!s&&e.type==="AssignmentExpression"&&e.left.type==="TypeCastExpression"&&(e.left=this.typeCastToParameter(e.left)),super.toAssignable(e,s)}toAssignableList(e,s,i){for(let r=0;r<e.length;r++){let n=e[r];n?.type==="TypeCastExpression"&&(e[r]=this.typeCastToParameter(n))}super.toAssignableList(e,s,i)}toReferencedList(e,s){for(let r=0;r<e.length;r++){var i;let n=e[r];n&&n.type==="TypeCastExpression"&&!((i=n.extra)!=null&&i.parenthesized)&&(e.length>1||!s)&&this.raise(P.TypeCastInPattern,n.typeAnnotation)}return e}parseArrayLike(e,s,i){let r=super.parseArrayLike(e,s,i);return i!=null&&!this.state.maybeInArrowParameters&&this.toReferencedList(r.elements),r}isValidLVal(e,s,i,r){return e==="TypeCastExpression"||super.isValidLVal(e,s,i,r)}parseClassProperty(e){return this.match(14)&&(e.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassProperty(e)}parseClassPrivateProperty(e){return this.match(14)&&(e.typeAnnotation=this.flowParseTypeAnnotation()),super.parseClassPrivateProperty(e)}isClassMethod(){return this.match(47)||super.isClassMethod()}isClassProperty(){return this.match(14)||super.isClassProperty()}isNonstaticConstructor(e){return!this.match(14)&&super.isNonstaticConstructor(e)}pushClassMethod(e,s,i,r,n,o){if(s.variance&&this.unexpected(s.variance.loc.start),delete s.variance,this.match(47)&&(s.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassMethod(e,s,i,r,n,o),s.params&&n){let c=s.params;c.length>0&&this.isThisParam(c[0])&&this.raise(P.ThisParamBannedInConstructor,s)}else if(s.type==="MethodDefinition"&&n&&s.value.params){let c=s.value.params;c.length>0&&this.isThisParam(c[0])&&this.raise(P.ThisParamBannedInConstructor,s)}}pushClassPrivateMethod(e,s,i,r){s.variance&&this.unexpected(s.variance.loc.start),delete s.variance,this.match(47)&&(s.typeParameters=this.flowParseTypeParameterDeclaration()),super.pushClassPrivateMethod(e,s,i,r)}parseClassSuper(e){if(super.parseClassSuper(e),e.superClass&&(this.match(47)||this.match(51))&&(e.superTypeParameters=this.flowParseTypeParameterInstantiationInExpression()),this.isContextual(113)){this.next();let s=e.implements=[];do{let i=this.startNode();i.id=this.flowParseRestrictedIdentifier(!0),this.match(47)?i.typeParameters=this.flowParseTypeParameterInstantiation():i.typeParameters=null,s.push(this.finishNode(i,"ClassImplements"))}while(this.eat(12))}}checkGetterSetterParams(e){super.checkGetterSetterParams(e);let s=this.getObjectOrClassMethodParams(e);if(s.length>0){let i=s[0];this.isThisParam(i)&&e.kind==="get"?this.raise(P.GetterMayNotHaveThisParam,i):this.isThisParam(i)&&this.raise(P.SetterMayNotHaveThisParam,i)}}parsePropertyNamePrefixOperator(e){e.variance=this.flowParseVariance()}parseObjPropValue(e,s,i,r,n,o,c){e.variance&&this.unexpected(e.variance.loc.start),delete e.variance;let l;this.match(47)&&!o&&(l=this.flowParseTypeParameterDeclaration(),this.match(10)||this.unexpected());let h=super.parseObjPropValue(e,s,i,r,n,o,c);return l&&((h.value||h).typeParameters=l),h}parseFunctionParamType(e){return this.eat(17)&&(e.type!=="Identifier"&&this.raise(P.PatternIsOptional,e),this.isThisParam(e)&&this.raise(P.ThisParamMayNotBeOptional,e),e.optional=!0),this.match(14)?e.typeAnnotation=this.flowParseTypeAnnotation():this.isThisParam(e)&&this.raise(P.ThisParamAnnotationRequired,e),this.match(29)&&this.isThisParam(e)&&this.raise(P.ThisParamNoDefault,e),this.resetEndLocation(e),e}parseMaybeDefault(e,s){let i=super.parseMaybeDefault(e,s);return i.type==="AssignmentPattern"&&i.typeAnnotation&&i.right.start<i.typeAnnotation.start&&this.raise(P.TypeBeforeInitializer,i.typeAnnotation),i}checkImportReflection(e){super.checkImportReflection(e),e.module&&e.importKind!=="value"&&this.raise(P.ImportReflectionHasImportType,e.specifiers[0].loc.start)}parseImportSpecifierLocal(e,s,i){s.local=di(e)?this.flowParseRestrictedIdentifier(!0,!0):this.parseIdentifier(),e.specifiers.push(this.finishImportSpecifier(s,i))}isPotentialImportPhase(e){if(super.isPotentialImportPhase(e))return!0;if(this.isContextual(130)){if(!e)return!0;let s=this.lookaheadCharCode();return s===123||s===42}return!e&&this.isContextual(87)}applyImportPhase(e,s,i,r){if(super.applyImportPhase(e,s,i,r),s){if(!i&&this.match(65))return;e.exportKind=i==="type"?i:"value"}else i==="type"&&this.match(55)&&this.unexpected(),e.importKind=i==="type"||i==="typeof"?i:"value"}parseImportSpecifier(e,s,i,r,n){let o=e.imported,c=null;o.type==="Identifier"&&(o.name==="type"?c="type":o.name==="typeof"&&(c="typeof"));let l=!1;if(this.isContextual(93)&&!this.isLookaheadContextual("as")){let p=this.parseIdentifier(!0);c!==null&&!$(this.state.type)?(e.imported=p,e.importKind=c,e.local=this.cloneIdentifier(p)):(e.imported=o,e.importKind=null,e.local=this.parseIdentifier())}else{if(c!==null&&$(this.state.type))e.imported=this.parseIdentifier(!0),e.importKind=c;else{if(s)throw this.raise(u.ImportBindingIsString,e,{importName:o.value});e.imported=o,e.importKind=null}this.eatContextual(93)?e.local=this.parseIdentifier():(l=!0,e.local=this.cloneIdentifier(e.imported))}let h=di(e);return i&&h&&this.raise(P.ImportTypeShorthandOnlyInPureImport,e),(i||h)&&this.checkReservedType(e.local.name,e.local.loc.start,!0),l&&!i&&!h&&this.checkReservedWord(e.local.name,e.loc.start,!0,!0),this.finishImportSpecifier(e,"ImportSpecifier")}parseBindingAtom(){switch(this.state.type){case 78:return this.parseIdentifier(!0);default:return super.parseBindingAtom()}}parseFunctionParams(e,s){let i=e.kind;i!=="get"&&i!=="set"&&this.match(47)&&(e.typeParameters=this.flowParseTypeParameterDeclaration()),super.parseFunctionParams(e,s)}parseVarId(e,s){super.parseVarId(e,s),this.match(14)&&(e.id.typeAnnotation=this.flowParseTypeAnnotation(),this.resetEndLocation(e.id))}parseAsyncArrowFromCallExpression(e,s){if(this.match(14)){let i=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0,e.returnType=this.flowParseTypeAnnotation(),this.state.noAnonFunctionType=i}return super.parseAsyncArrowFromCallExpression(e,s)}shouldParseAsyncArrow(){return this.match(14)||super.shouldParseAsyncArrow()}parseMaybeAssign(e,s){var i;let r=null,n;if(this.hasPlugin("jsx")&&(this.match(143)||this.match(47))){if(r=this.state.clone(),n=this.tryParse(()=>super.parseMaybeAssign(e,s),r),!n.error)return n.node;let{context:l}=this.state,h=l[l.length-1];(h===C.j_oTag||h===C.j_expr)&&l.pop()}if((i=n)!=null&&i.error||this.match(47)){var o,c;r=r||this.state.clone();let l,h=this.tryParse(d=>{var f;l=this.flowParseTypeParameterDeclaration();let x=this.forwardNoArrowParamsConversionAt(l,()=>{let L=super.parseMaybeAssign(e,s);return this.resetStartLocationFromNode(L,l),L});(f=x.extra)!=null&&f.parenthesized&&d();let I=this.maybeUnwrapTypeCastExpression(x);return I.type!=="ArrowFunctionExpression"&&d(),I.typeParameters=l,this.resetStartLocationFromNode(I,l),x},r),p=null;if(h.node&&this.maybeUnwrapTypeCastExpression(h.node).type==="ArrowFunctionExpression"){if(!h.error&&!h.aborted)return h.node.async&&this.raise(P.UnexpectedTypeParameterBeforeAsyncArrowFunction,l),h.node;p=h.node}if((o=n)!=null&&o.node)return this.state=n.failState,n.node;if(p)return this.state=h.failState,p;throw(c=n)!=null&&c.thrown?n.error:h.thrown?h.error:this.raise(P.UnexpectedTokenAfterTypeParameter,l)}return super.parseMaybeAssign(e,s)}parseArrow(e){if(this.match(14)){let s=this.tryParse(()=>{let i=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0;let r=this.startNode();return[r.typeAnnotation,e.predicate]=this.flowParseTypeAndPredicateInitialiser(),this.state.noAnonFunctionType=i,this.canInsertSemicolon()&&this.unexpected(),this.match(19)||this.unexpected(),r});if(s.thrown)return null;s.error&&(this.state=s.failState),e.returnType=s.node.typeAnnotation?this.finishNode(s.node,"TypeAnnotation"):null}return super.parseArrow(e)}shouldParseArrow(e){return this.match(14)||super.shouldParseArrow(e)}setArrowFunctionParameters(e,s){this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(e.start))?e.params=s:super.setArrowFunctionParameters(e,s)}checkParams(e,s,i,r=!0){if(!(i&&this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(e.start)))){for(let n=0;n<e.params.length;n++)this.isThisParam(e.params[n])&&n>0&&this.raise(P.ThisParamMustBeFirst,e.params[n]);super.checkParams(e,s,i,r)}}parseParenAndDistinguishExpression(e){return super.parseParenAndDistinguishExpression(e&&!this.state.noArrowAt.includes(this.sourceToOffsetPos(this.state.start)))}parseSubscripts(e,s,i){if(e.type==="Identifier"&&e.name==="async"&&this.state.noArrowAt.includes(s.index)){this.next();let r=this.startNodeAt(s);r.callee=e,r.arguments=super.parseCallExpressionArguments(),e=this.finishNode(r,"CallExpression")}else if(e.type==="Identifier"&&e.name==="async"&&this.match(47)){let r=this.state.clone(),n=this.tryParse(c=>this.parseAsyncArrowWithTypeParameters(s)||c(),r);if(!n.error&&!n.aborted)return n.node;let o=this.tryParse(()=>super.parseSubscripts(e,s,i),r);if(o.node&&!o.error)return o.node;if(n.node)return this.state=n.failState,n.node;if(o.node)return this.state=o.failState,o.node;throw n.error||o.error}return super.parseSubscripts(e,s,i)}parseSubscript(e,s,i,r){if(this.match(18)&&this.isLookaheadToken_lt()){if(r.optionalChainMember=!0,i)return r.stop=!0,e;this.next();let n=this.startNodeAt(s);return n.callee=e,n.typeArguments=this.flowParseTypeParameterInstantiationInExpression(),this.expect(10),n.arguments=this.parseCallExpressionArguments(),n.optional=!0,this.finishCallExpression(n,!0)}else if(!i&&this.shouldParseTypes()&&(this.match(47)||this.match(51))){let n=this.startNodeAt(s);n.callee=e;let o=this.tryParse(()=>(n.typeArguments=this.flowParseTypeParameterInstantiationCallOrNew(),this.expect(10),n.arguments=super.parseCallExpressionArguments(),r.optionalChainMember&&(n.optional=!1),this.finishCallExpression(n,r.optionalChainMember)));if(o.node)return o.error&&(this.state=o.failState),o.node}return super.parseSubscript(e,s,i,r)}parseNewCallee(e){super.parseNewCallee(e);let s=null;this.shouldParseTypes()&&this.match(47)&&(s=this.tryParse(()=>this.flowParseTypeParameterInstantiationCallOrNew()).node),e.typeArguments=s}parseAsyncArrowWithTypeParameters(e){let s=this.startNodeAt(e);if(this.parseFunctionParams(s,!1),!!this.parseArrow(s))return super.parseArrowExpression(s,void 0,!0)}readToken_mult_modulo(e){let s=this.input.charCodeAt(this.state.pos+1);if(e===42&&s===47&&this.state.hasFlowComment){this.state.hasFlowComment=!1,this.state.pos+=2,this.nextToken();return}super.readToken_mult_modulo(e)}readToken_pipe_amp(e){let s=this.input.charCodeAt(this.state.pos+1);if(e===124&&s===125){this.finishOp(9,2);return}super.readToken_pipe_amp(e)}parseTopLevel(e,s){let i=super.parseTopLevel(e,s);return this.state.hasFlowComment&&this.raise(P.UnterminatedFlowComment,this.state.curPosition()),i}skipBlockComment(){if(this.hasPlugin("flowComments")&&this.skipFlowComment()){if(this.state.hasFlowComment)throw this.raise(P.NestedFlowComment,this.state.startLoc);this.hasFlowCommentCompletion();let e=this.skipFlowComment();e&&(this.state.pos+=e,this.state.hasFlowComment=!0);return}return super.skipBlockComment(this.state.hasFlowComment?"*-/":"*/")}skipFlowComment(){let{pos:e}=this.state,s=2;for(;[32,9].includes(this.input.charCodeAt(e+s));)s++;let i=this.input.charCodeAt(s+e),r=this.input.charCodeAt(s+e+1);return i===58&&r===58?s+2:this.input.slice(s+e,s+e+12)==="flow-include"?s+12:i===58&&r!==58?s:!1}hasFlowCommentCompletion(){if(this.input.indexOf("*/",this.state.pos)===-1)throw this.raise(u.UnterminatedComment,this.state.curPosition())}flowEnumErrorBooleanMemberNotInitialized(e,{enumName:s,memberName:i}){this.raise(P.EnumBooleanMemberNotInitialized,e,{memberName:i,enumName:s})}flowEnumErrorInvalidMemberInitializer(e,s){return this.raise(s.explicitType?s.explicitType==="symbol"?P.EnumInvalidMemberInitializerSymbolType:P.EnumInvalidMemberInitializerPrimaryType:P.EnumInvalidMemberInitializerUnknownType,e,s)}flowEnumErrorNumberMemberNotInitialized(e,s){this.raise(P.EnumNumberMemberNotInitialized,e,s)}flowEnumErrorStringMemberInconsistentlyInitialized(e,s){this.raise(P.EnumStringMemberInconsistentlyInitialized,e,s)}flowEnumMemberInit(){let e=this.state.startLoc,s=()=>this.match(12)||this.match(8);switch(this.state.type){case 135:{let i=this.parseNumericLiteral(this.state.value);return s()?{type:"number",loc:i.loc.start,value:i}:{type:"invalid",loc:e}}case 134:{let i=this.parseStringLiteral(this.state.value);return s()?{type:"string",loc:i.loc.start,value:i}:{type:"invalid",loc:e}}case 85:case 86:{let i=this.parseBooleanLiteral(this.match(85));return s()?{type:"boolean",loc:i.loc.start,value:i}:{type:"invalid",loc:e}}default:return{type:"invalid",loc:e}}}flowEnumMemberRaw(){let e=this.state.startLoc,s=this.parseIdentifier(!0),i=this.eat(29)?this.flowEnumMemberInit():{type:"none",loc:e};return{id:s,init:i}}flowEnumCheckExplicitTypeMismatch(e,s,i){let{explicitType:r}=s;r!==null&&r!==i&&this.flowEnumErrorInvalidMemberInitializer(e,s)}flowEnumMembers({enumName:e,explicitType:s}){let i=new Set,r={booleanMembers:[],numberMembers:[],stringMembers:[],defaultedMembers:[]},n=!1;for(;!this.match(8);){if(this.eat(21)){n=!0;break}let o=this.startNode(),{id:c,init:l}=this.flowEnumMemberRaw(),h=c.name;if(h==="")continue;/^[a-z]/.test(h)&&this.raise(P.EnumInvalidMemberName,c,{memberName:h,suggestion:h[0].toUpperCase()+h.slice(1),enumName:e}),i.has(h)&&this.raise(P.EnumDuplicateMemberName,c,{memberName:h,enumName:e}),i.add(h);let p={enumName:e,explicitType:s,memberName:h};switch(o.id=c,l.type){case"boolean":{this.flowEnumCheckExplicitTypeMismatch(l.loc,p,"boolean"),o.init=l.value,r.booleanMembers.push(this.finishNode(o,"EnumBooleanMember"));break}case"number":{this.flowEnumCheckExplicitTypeMismatch(l.loc,p,"number"),o.init=l.value,r.numberMembers.push(this.finishNode(o,"EnumNumberMember"));break}case"string":{this.flowEnumCheckExplicitTypeMismatch(l.loc,p,"string"),o.init=l.value,r.stringMembers.push(this.finishNode(o,"EnumStringMember"));break}case"invalid":throw this.flowEnumErrorInvalidMemberInitializer(l.loc,p);case"none":switch(s){case"boolean":this.flowEnumErrorBooleanMemberNotInitialized(l.loc,p);break;case"number":this.flowEnumErrorNumberMemberNotInitialized(l.loc,p);break;default:r.defaultedMembers.push(this.finishNode(o,"EnumDefaultedMember"))}}this.match(8)||this.expect(12)}return{members:r,hasUnknownMembers:n}}flowEnumStringMembers(e,s,{enumName:i}){if(e.length===0)return s;if(s.length===0)return e;if(s.length>e.length){for(let r of e)this.flowEnumErrorStringMemberInconsistentlyInitialized(r,{enumName:i});return s}else{for(let r of s)this.flowEnumErrorStringMemberInconsistentlyInitialized(r,{enumName:i});return e}}flowEnumParseExplicitType({enumName:e}){if(!this.eatContextual(102))return null;if(!v(this.state.type))throw this.raise(P.EnumInvalidExplicitTypeUnknownSupplied,this.state.startLoc,{enumName:e});let{value:s}=this.state;return this.next(),s!=="boolean"&&s!=="number"&&s!=="string"&&s!=="symbol"&&this.raise(P.EnumInvalidExplicitType,this.state.startLoc,{enumName:e,invalidEnumType:s}),s}flowEnumBody(e,s){let i=s.name,r=s.loc.start,n=this.flowEnumParseExplicitType({enumName:i});this.expect(5);let{members:o,hasUnknownMembers:c}=this.flowEnumMembers({enumName:i,explicitType:n});switch(e.hasUnknownMembers=c,n){case"boolean":return e.explicitType=!0,e.members=o.booleanMembers,this.expect(8),this.finishNode(e,"EnumBooleanBody");case"number":return e.explicitType=!0,e.members=o.numberMembers,this.expect(8),this.finishNode(e,"EnumNumberBody");case"string":return e.explicitType=!0,e.members=this.flowEnumStringMembers(o.stringMembers,o.defaultedMembers,{enumName:i}),this.expect(8),this.finishNode(e,"EnumStringBody");case"symbol":return e.members=o.defaultedMembers,this.expect(8),this.finishNode(e,"EnumSymbolBody");default:{let l=()=>(e.members=[],this.expect(8),this.finishNode(e,"EnumStringBody"));e.explicitType=!1;let h=o.booleanMembers.length,p=o.numberMembers.length,d=o.stringMembers.length,f=o.defaultedMembers.length;if(!h&&!p&&!d&&!f)return l();if(!h&&!p)return e.members=this.flowEnumStringMembers(o.stringMembers,o.defaultedMembers,{enumName:i}),this.expect(8),this.finishNode(e,"EnumStringBody");if(!p&&!d&&h>=f){for(let x of o.defaultedMembers)this.flowEnumErrorBooleanMemberNotInitialized(x.loc.start,{enumName:i,memberName:x.id.name});return e.members=o.booleanMembers,this.expect(8),this.finishNode(e,"EnumBooleanBody")}else if(!h&&!d&&p>=f){for(let x of o.defaultedMembers)this.flowEnumErrorNumberMemberNotInitialized(x.loc.start,{enumName:i,memberName:x.id.name});return e.members=o.numberMembers,this.expect(8),this.finishNode(e,"EnumNumberBody")}else return this.raise(P.EnumInconsistentMemberValues,r,{enumName:i}),l()}}}flowParseEnumDeclaration(e){let s=this.parseIdentifier();return e.id=s,e.body=this.flowEnumBody(this.startNode(),s),this.finishNode(e,"EnumDeclaration")}jsxParseOpeningElementAfterName(e){return this.shouldParseTypes()&&(this.match(47)||this.match(51))&&(e.typeArguments=this.flowParseTypeParameterInstantiationInExpression()),super.jsxParseOpeningElementAfterName(e)}isLookaheadToken_lt(){let e=this.nextTokenStart();if(this.input.charCodeAt(e)===60){let s=this.input.charCodeAt(e+1);return s!==60&&s!==61}return!1}reScan_lt_gt(){let{type:e}=this.state;e===47?(this.state.pos-=1,this.readToken_lt()):e===48&&(this.state.pos-=1,this.readToken_gt())}reScan_lt(){let{type:e}=this.state;return e===51?(this.state.pos-=2,this.finishOp(47,1),47):e}maybeUnwrapTypeCastExpression(e){return e.type==="TypeCastExpression"?e.expression:e}},ba={__proto__:null,quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",fnof:"\u0192",circ:"\u02C6",tilde:"\u02DC",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",bull:"\u2022",hellip:"\u2026",permil:"\u2030",prime:"\u2032",Prime:"\u2033",lsaquo:"\u2039",rsaquo:"\u203A",oline:"\u203E",frasl:"\u2044",euro:"\u20AC",image:"\u2111",weierp:"\u2118",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666"},Ta=/\r\n|[\r\n\u2028\u2029]/,Ae=new RegExp(Ta.source,"g");function re(a){switch(a){case 10:case 13:case 8232:case 8233:return!0;default:return!1}}function fi(a,t,e){for(let s=t;s<e;s++)if(re(a.charCodeAt(s)))return!0;return!1}var Ye=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Qe=/(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/g;function Aa(a){switch(a){case 9:case 11:case 12:case 32:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:case 65279:return!0;default:return!1}}var Q=R`jsx`({AttributeIsEmpty:"JSX attributes must only be assigned a non-empty expression.",MissingClosingTagElement:({openingTagName:a})=>`Expected corresponding JSX closing tag for <${a}>.`,MissingClosingTagFragment:"Expected corresponding JSX closing tag for <>.",UnexpectedSequenceExpression:"Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",UnexpectedToken:({unexpected:a,HTMLEntity:t})=>`Unexpected token \`${a}\`. Did you mean \`${t}\` or \`{'${a}'}\`?`,UnsupportedJsxValue:"JSX value should be either an expression or a quoted JSX text.",UnterminatedJsxContent:"Unterminated JSX contents.",UnwrappedAdjacentJSXElements:"Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"});function K(a){return a?a.type==="JSXOpeningFragment"||a.type==="JSXClosingFragment":!1}function ie(a){if(a.type==="JSXIdentifier")return a.name;if(a.type==="JSXNamespacedName")return a.namespace.name+":"+a.name.name;if(a.type==="JSXMemberExpression")return ie(a.object)+"."+ie(a.property);throw new Error("Node had unexpected type: "+a.type)}var Sa=a=>class extends a{jsxReadToken(){let e="",s=this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(Q.UnterminatedJsxContent,this.state.startLoc);let i=this.input.charCodeAt(this.state.pos);switch(i){case 60:case 123:if(this.state.pos===this.state.start){i===60&&this.state.canStartJSXElement?(++this.state.pos,this.finishToken(143)):super.getTokenFromCode(i);return}e+=this.input.slice(s,this.state.pos),this.finishToken(142,e);return;case 38:e+=this.input.slice(s,this.state.pos),e+=this.jsxReadEntity(),s=this.state.pos;break;case 62:case 125:default:re(i)?(e+=this.input.slice(s,this.state.pos),e+=this.jsxReadNewLine(!0),s=this.state.pos):++this.state.pos}}}jsxReadNewLine(e){let s=this.input.charCodeAt(this.state.pos),i;return++this.state.pos,s===13&&this.input.charCodeAt(this.state.pos)===10?(++this.state.pos,i=e?`
6
6
  `:`\r
@@ -16,16 +16,16 @@ import{a as Y,b as Me,c as E,d as N,e as te,f as J,g as A,k as D,m as O}from"./c
16
16
  return (async () => {
17
17
  ${i}
18
18
  })();
19
- `)(a,e)}transpile(a){let t=this.generateFunctionCallCode(a.action_data?.kwargs||{});return t?[t.endsWith(";")?t:`${t};`]:["// Skipping function: missing functionName"]}generateFunctionCallCode(a){let t=a.functionName;if(!t)return null;let e={},s=a.parameterNames||[],i=a.parameterValues||a.args||[];if(s.forEach((c,l)=>{l<i.length&&(e[c]=i[l])}),Object.keys(e).length===0)return`await ${t}()`;let r=["page","testContext","request","agentServices"],n=["undefined","null","true","false"],o=Object.entries(e).map(([c,l])=>{let h=String(l);return l==null?"undefined":r.includes(c)&&r.includes(h)||n.includes(h)||/^-?\d+(\.\d+)?$/.test(h)?h:h.startsWith("$")?`agent.agentServices.readVariable('${h.substring(1)}')`:`"${h}"`});return`await ${t}(${o.join(", ")})`}};import{z as As}from"zod";var Ss=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.statement;if(!i)throw new Error("Missing statement for ai_action");let r=s.kwargs.use_pure_vision,{executeStep:n}=await import("./agentHelpers-5J4TWLQS.js"),o=await n(i,a,e,{usePureVision:r});if(o.status!=="success")throw new Error(o.error||"Action execution failed")}transpile(a,t){let e=a.action_data?.kwargs?.statement;if(!e)return["// Skipping ai_action: missing statement"];let s=JSON.stringify(e),i=a.action_data?.kwargs?.use_pure_vision;return[`await agent.execute(page, ${s}, '${t||""}', ${i});`]}},Fn=As.object({statement:As.string().describe('The action to perform (e.g., "click the submit button")')});import{z as ks}from"zod";var Es=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.statement;if(!i)throw new Error("Missing statement for ai_step");let{runTask:r}=await import("./agentHelpers-5J4TWLQS.js"),n=await r(i,a,e);if(n.status!=="success")throw new Error(n.error||"Task execution failed")}transpile(a,t){let e=a.action_data?.kwargs?.statement;return e?[`await agent.run(page, ${JSON.stringify(e)}, '${t||""}');`]:["// Skipping ai_step: missing statement"]}},Un=ks.object({statement:ks.string().describe('The complete step to execute (e.g., "fill in the login form and submit")')});import{z as Fe}from"zod";A();var Is=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.date;if(!i)throw new Error("Date value is required");if(!/^\d{4}-\d{2}-\d{2}$/.test(i))throw new Error(`Invalid date format: ${i}. Expected format: YYYY-MM-DD (e.g., 2024-03-15)`);let r=e.replaceVariables(String(i)),n=N(a,t);if(n){let o=await n.getAttribute("type").catch(()=>null);if(o&&o!=="date")throw new Error(`Element is not a native date picker (type="${o}"). This action only works with <input type="date">. For custom date pickers, use AI-powered actions.`);await n.fill(r,{timeout:E(e)})}else throw new Error("No locator found for set_date_for_native_date_picker action")}transpile(a){let t=a.action_data?.kwargs?.date??"",e=[];return e.push(`action_data: { kwargs: { date: ${JSON.stringify(t)} } }`),a.locator?e.push(`locator: ${JSON.stringify(a.locator)}`):a.xpath&&e.push(`xpath: ${JSON.stringify(a.xpath)}`),a.frame_path&&a.frame_path.length>0&&e.push(`frame_path: ${JSON.stringify(a.frame_path)}`),['await agent.execAction("set_date_for_native_date_picker", page, {',...e.map(s=>` ${s},`),"});"]}};async function Gi(a,t,e,s){return{...await O(e,t),action_description:a,action_data:{action_name:"set_date_for_native_date_picker",kwargs:{date:s}}}}function $e(a,t){return{action_description:`${a} (failed - element not found)`,action_data:{action_name:"set_date_for_native_date_picker",kwargs:t},feedback:"Element not found in DOM"}}var Yi=Fe.object({element_index:Fe.number().int().describe("Index of the native date picker input element"),date:Fe.string().regex(/^\d{4}-\d{2}-\d{2}$/).describe("Date in YYYY-MM-DD format (e.g., 2024-03-15)")});function Hn(a,t){a.register({name:"set_date_for_native_date_picker",description:`Set a date in a native HTML date picker input (<input type="date">).
19
+ `)(a,e)}transpile(a){let t=this.generateFunctionCallCode(a.action_data?.kwargs||{});return t?[t.endsWith(";")?t:`${t};`]:["// Skipping function: missing functionName"]}generateFunctionCallCode(a){let t=a.functionName;if(!t)return null;let e={},s=a.parameterNames||[],i=a.parameterValues||a.args||[];if(s.forEach((c,l)=>{l<i.length&&(e[c]=i[l])}),Object.keys(e).length===0)return`await ${t}()`;let r=["page","testContext","request","agentServices"],n=["undefined","null","true","false"],o=Object.entries(e).map(([c,l])=>{let h=String(l);return l==null?"undefined":r.includes(c)&&r.includes(h)||n.includes(h)||/^-?\d+(\.\d+)?$/.test(h)?h:h.startsWith("$")?`agent.agentServices.readVariable('${h.substring(1)}')`:`"${h}"`});return`await ${t}(${o.join(", ")})`}};import{z as As}from"zod";var Ss=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.statement;if(!i)throw new Error("Missing statement for ai_action");let r=s.kwargs.use_pure_vision,{executeStep:n}=await import("./agentHelpers-MOO2YPML.js"),o=await n(i,a,e,{usePureVision:r});if(o.status!=="success")throw new Error(o.error||"Action execution failed")}transpile(a,t){let e=a.action_data?.kwargs?.statement;if(!e)return["// Skipping ai_action: missing statement"];let s=JSON.stringify(e),i=a.action_data?.kwargs?.use_pure_vision;return[`await agent.execute(page, ${s}, '${t||""}', ${i});`]}},Fn=As.object({statement:As.string().describe('The action to perform (e.g., "click the submit button")')});import{z as ks}from"zod";var Es=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.statement;if(!i)throw new Error("Missing statement for ai_step");let{runTask:r}=await import("./agentHelpers-MOO2YPML.js"),n=await r(i,a,e);if(n.status!=="success")throw new Error(n.error||"Task execution failed")}transpile(a,t){let e=a.action_data?.kwargs?.statement;return e?[`await agent.run(page, ${JSON.stringify(e)}, '${t||""}');`]:["// Skipping ai_step: missing statement"]}},Un=ks.object({statement:ks.string().describe('The complete step to execute (e.g., "fill in the login form and submit")')});import{z as Fe}from"zod";A();var Is=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.date;if(!i)throw new Error("Date value is required");if(!/^\d{4}-\d{2}-\d{2}$/.test(i))throw new Error(`Invalid date format: ${i}. Expected format: YYYY-MM-DD (e.g., 2024-03-15)`);let r=e.replaceVariables(String(i)),n=N(a,t);if(n){let o=await n.getAttribute("type").catch(()=>null);if(o&&o!=="date")throw new Error(`Element is not a native date picker (type="${o}"). This action only works with <input type="date">. For custom date pickers, use AI-powered actions.`);await n.fill(r,{timeout:E(e)})}else throw new Error("No locator found for set_date_for_native_date_picker action")}transpile(a){let t=a.action_data?.kwargs?.date??"",e=[];return e.push(`action_data: { kwargs: { date: ${JSON.stringify(t)} } }`),a.locator?e.push(`locator: ${JSON.stringify(a.locator)}`):a.xpath&&e.push(`xpath: ${JSON.stringify(a.xpath)}`),a.frame_path&&a.frame_path.length>0&&e.push(`frame_path: ${JSON.stringify(a.frame_path)}`),['await agent.execAction("set_date_for_native_date_picker", page, {',...e.map(s=>` ${s},`),"});"]}};async function Gi(a,t,e,s){return{...await O(e,t),action_description:a,action_data:{action_name:"set_date_for_native_date_picker",kwargs:{date:s}}}}function $e(a,t){return{action_description:`${a} (failed - element not found)`,action_data:{action_name:"set_date_for_native_date_picker",kwargs:t},feedback:"Element not found in DOM"}}var Yi=Fe.object({element_index:Fe.number().int().describe("Index of the native date picker input element"),date:Fe.string().regex(/^\d{4}-\d{2}-\d{2}$/).describe("Date in YYYY-MM-DD format (e.g., 2024-03-15)")});function Hn(a,t){a.register({name:"set_date_for_native_date_picker",description:`Set a date in a native HTML date picker input (<input type="date">).
20
20
 
21
21
  IMPORTANT: ONLY use this action for input elements that have type="date" attribute (native HTML date picker).
22
22
  Do NOT use it for custom/non-native date pickers
23
23
 
24
- The date must be in YYYY-MM-DD format (e.g., 2024-03-15).`,schema:Yi,usesElementIndex:!0,async execute(e,s){let{element_index:i,date:r}=e,{page:n,agentServices:o}=s;try{let c=await D(s,i);if(!c)return{success:!1,error:`Date picker element with index ${i} not found`,actionEntity:$e(`Set date to ${r} on element ${i}`,{index:i,date:r})};let l=c.attributes.type;if(l!=="date")return{success:!1,error:`Element ${i} is not a native date picker (type="${l}"). This action only works with <input type="date">.`,actionEntity:$e(`Set date to ${r} on element ${i}`,{index:i,date:r})};let h=await Gi(`Set date to ${r} on element ${i}`,c,n,r);return await t.execute(n,h,o),{success:!0,actionEntity:h,message:`Set date to ${r} on element ${i}`}}catch(c){return{success:!1,error:c.message,actionEntity:$e(`Set date to ${r} on element ${i}`,{index:i,date:r})}}}})}import{z as Cs}from"zod";var vs=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.page_id;if(typeof i=="number"){let r=a.context().pages(),n=i===-1?r.length-1:i;if(e){let o=await e.switchTab(n);await o.waitForLoadState("load",{timeout:15e3}),await o.waitForTimeout(500)}}else throw new Error("Missing page_id for switch_tab action")}transpile(a){return['await agent.execAction("switch_tab", page, {',` action_data: { kwargs: { page_id: ${a.action_data?.kwargs?.page_id??0} } },`,"});"]}},Qi=Cs.object({tab_index:Cs.number().int().nonnegative().describe("Index of the tab to switch to (0-based). Use 0 for first tab, 1 for second, etc.")});function Gn(a,t){a.register({name:"switch_tab",description:"Switch to a different browser tab by index (0-based).",schema:Qi,async execute(e,s){let i=e.tab_index??e.index,{page:r,agentServices:n,actionDescription:o}=s;try{let c={action_description:o||`Switch to tab ${i}`,action_data:{action_name:"switch_tab",kwargs:{page_id:i}}};return await t.execute(r,c,n),{success:!0,actionEntity:c,message:`Switched to tab ${i}`}}catch(c){return{success:!1,error:c.message,actionEntity:{action_description:(o||`Switch to tab ${i}`)+" (failed)",action_data:{action_name:"switch_tab",kwargs:{page_id:i}},feedback:c.message}}}}})}import Zi from"fs";import er from"path";async function so(a,t,e,s,i,r){let n=Array.isArray(t)?t:[t];if(n.length===0)throw new Error("No file paths provided for upload");let o=n.map(h=>{if(h.startsWith("/")||h.match(/^[A-Za-z]:\\/))return h;let p=s.testDataDir||process.cwd();return er.join(p,h)});Y.info(`Uploading files: ${o.join(", ")}`);let c=e.timeout||2e4,l={useFileInput:e.useFileInput||!1,timeout:c};if(e.selector&&typeof e.selector!="string"){let h=e.selector;await Pe(a,h,o,l);return}if(e.selector&&typeof e.selector=="string"){let h=e.selector,p=(h.startsWith("xpath="),a.locator(h));await Pe(a,p,o,l);return}if(i){let h=n.map(d=>`"${d}"`).join(", "),p="";e.targetDescription?p=`Upload ${h} to ${e.targetDescription}`:p=`Upload ${h}`,Y.info(`Using AI to handle file upload: ${p}`),await i(a,p,r)}else throw new Error("No selector provided and AI action execution is not available")}async function Pe(a,t,e,s){let{useFileInput:i,timeout:r,mockShowOpenFilePicker:n}=s;if(n){Y.info("Using mockShowOpenFilePicker approach");let o=e.map(c=>({path:c,buffer:new Uint8Array(Zi.readFileSync(c))}));await a.evaluate(c=>{window.__pw_showOpenFilePicker_mock_files=c},o),await t.click({timeout:r}),await a.waitForTimeout(3e3),await a.evaluate(()=>{delete window.__pw_showOpenFilePicker_mock_files})}else if(i)Y.info("Using direct file input approach"),await t.setInputFiles(e,{timeout:r}),await a.waitForTimeout(3e3);else{Y.info("Using file chooser approach");let o=a.waitForEvent("filechooser",{timeout:r});o.catch(()=>{}),await t.click({timeout:r}),await(await o).setFiles(e),await a.waitForTimeout(3e3)}Y.info(`Successfully uploaded ${e.length} file(s)`)}import{z as se}from"zod";A();var _s=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=[];if(s.kwargs.paths?i=Array.isArray(s.kwargs.paths)?s.kwargs.paths:[s.kwargs.paths]:s.kwargs.path&&(i=Array.isArray(s.kwargs.path)?s.kwargs.path:[s.kwargs.path]),i.length===0)throw new Error("No file paths provided for upload_file action");await e.downloadTestDataFiles(i);let r=i.map(l=>e.getTestDataFilePath(l)),n=N(a,t);if(!n)throw new Error("Missing locator for upload_file action");let o=s.kwargs.use_file_input||!1,c=e.getActionSettings().mock_show_open_file_picker??!1;await Pe(a,n,r,{useFileInput:o,timeout:E(e),mockShowOpenFilePicker:c})}transpile(a){let t=a.action_data?.kwargs||{},e=[],s={};return t.paths?s.paths=t.paths:t.path&&(s.path=t.path),t.use_file_input&&(s.use_file_input=!0),e.push(`action_data: { kwargs: ${JSON.stringify(s)} }`),a.locator?e.push(`locator: ${JSON.stringify(a.locator)}`):a.xpath&&e.push(`xpath: ${JSON.stringify(a.xpath)}`),a.frame_path&&a.frame_path.length>0&&e.push(`frame_path: ${JSON.stringify(a.frame_path)}`),['await agent.execAction("upload_file", page, {',...e.map(i=>` ${i},`),"});"]}};async function tr(a,t,e={},s){return{...await O(t,a),action_description:s||"Upload file to element",action_data:{action_name:"upload_file",kwargs:{...e}}}}function Ns(a,t){return{action_description:`${a} (failed - element not found)`,action_data:{action_name:"upload_file",kwargs:t},feedback:"Element not found in DOM"}}var sr=se.object({element_index:se.number().int().describe("Index of the target element to trigger the file upload dialog"),paths:se.string().describe("Paths to the files to upload")});function co(a,t){a.register({name:"upload_file",description:'Click on target element (usually contains hints like "Upload file" or "Choose file" etc.) to trigger the file upload dialog, and choose the files to upload',schema:sr,usesElementIndex:!0,async execute(e,s){let{element_index:i,paths:r}=e,{page:n,agentServices:o,actionDescription:c}=s;try{let l=await D(s,i);if(!l)return{success:!1,error:`File input element with index ${i} not found`,actionEntity:Ns(c||`Upload file to element ${i}`,{index:i,paths:r})};let h=await tr(l,n,{paths:r},c);return await t.execute(n,h,o),{success:!0,actionEntity:h,message:`Uploaded file to element ${i}`}}catch(l){return{success:!1,error:l.message,actionEntity:Ns(c||`Upload file to element ${i}`,{index:i,paths:r})}}}})}var lo=se.object({element_index:se.number().int().describe("Index of the file input element"),paths:se.string().describe("Path to the file to upload (can be relative or absolute)")});import{z as Ls}from"zod";var Ds=class{async execute(a,t){let e=t.action_data;if(!e)throw new Error("Action data not found");let s=e.kwargs.seconds||1;await a.waitForTimeout(s*1e3)}transpile(a){return[`await page.waitForTimeout(${(a.action_data?.kwargs?.seconds||1)*1e3});`]}},ir=Ls.object({seconds:Ls.number().positive().describe("Number of seconds to wait")});function fo(a,t){a.register({name:"wait",description:"Wait for a specified number of seconds before continuing.",schema:ir,async execute(e,s){let{seconds:i}=e,{page:r,agentServices:n,actionDescription:o}=s;try{let c={action_description:o||`Wait ${i} seconds`,action_data:{action_name:"wait",kwargs:{seconds:i}}};return await t.execute(r,c,n),{success:!0,actionEntity:c,message:`Waited ${i} seconds`}}catch(c){return{success:!1,error:c.message,actionEntity:{action_description:(o||`Wait ${i} seconds`)+" (failed)",action_data:{action_name:"wait",kwargs:{seconds:i}},feedback:c.message}}}}})}import{z as Os}from"zod";var Ms=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.timeout_seconds||10;await e.waitForDownloadComplete(a,i)}transpile(a){return['await agent.execAction("wait_for_download_complete", page, {',` action_data: { kwargs: { timeout_seconds: ${a.action_data?.kwargs?.timeout_seconds||10} } },`,"});"]}},rr=Os.object({timeout_seconds:Os.number().positive().optional().describe("Maximum time in seconds to wait for download to complete (default: 10)")});function go(a,t){a.register({name:"wait_for_download_complete",description:"Wait for an in-progress download to complete.",schema:rr,async execute(e,s){let{timeout_seconds:i=10}=e,{page:r,agentServices:n}=s;try{let o={action_description:`Wait for download to complete (timeout: ${i}s)`,action_data:{action_name:"wait_for_download_complete",kwargs:{timeout_seconds:i}}};return await t.execute(r,o,n),{success:!0,actionEntity:o,message:"Download completed"}}catch(o){return{success:!1,error:o.message,actionEntity:{action_description:"Wait for download to complete (failed)",action_data:{action_name:"wait_for_download_complete",kwargs:{timeout_seconds:i}},feedback:o.message}}}}})}import{z as Be}from"zod";var Fs=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.condition;if(!i)throw new Error("Missing condition for ai_wait_until");let r=(s.kwargs.timeout_seconds||60)*1e3,n=1e3,o=Date.now(),{evaluateStatement:c}=await import("./agentHelpers-5J4TWLQS.js");for(;Date.now()-o<r;){if((await c(i,a,e,{})).success)return;await a.waitForTimeout(n)}throw new Error(`Timeout waiting for condition: ${i}`)}transpile(a,t){let e=a.action_data?.kwargs?.condition,s=a.action_data?.kwargs?.timeout_seconds||60;return e?[`await agent.waitUntilCondition(page, ${JSON.stringify(e)}, ${s}, '${t}');`]:["// Skipping ai_wait_until: missing condition"]}},ar=Be.object({condition:Be.string().describe('The condition to wait for (e.g., "the loading spinner disappears")'),timeout_seconds:Be.number().positive().optional().describe("Timeout in seconds (default: 60)")});function To(a,t){a.register({name:"ai_wait_until",description:'Wait until a specific condition is met on the page (e.g., "page loads", "spinner disappears", "button becomes enabled"). Use this instead of wait when the goal is to wait for something to happen rather than waiting a fixed duration.',schema:ar,async execute(e,s){let{condition:i,timeout_seconds:r=60}=e,{page:n,agentServices:o}=s;try{let c={action_description:`Wait until: ${i}`,action_data:{action_name:"ai_wait_until",kwargs:{condition:i,timeout_seconds:r}}};return await t.execute(n,c,o),{success:!0,actionEntity:c,message:`Condition met: ${i}`}}catch(c){return{success:!1,error:c.message,actionEntity:{action_description:`Wait until: ${i} (failed)`,action_data:{action_name:"ai_wait_until",kwargs:{condition:i,timeout_seconds:r}},feedback:c.message}}}}})}import{z as nr}from"zod";A();var $s=class{async execute(a,t){await a.reload({timeout:J}),await a.waitForLoadState("load",{timeout:J}),await a.waitForTimeout(1e3)}transpile(a){return['await agent.execAction("reload_page", page, {});']}},or=nr.object({});function Io(a,t){a.register({name:"reload_page",description:"Reload the current page. WARNING: This will reset any in-progress forms or multi-step flows (like login). Only use when you need to refresh stale data or clear a stuck state. Do NOT use during login, checkout, or form submission flows.",schema:or,async execute(e,s){let{page:i,agentServices:r}=s;try{let n={action_description:"Reload page",action_data:{action_name:"reload_page",kwargs:{}}};return await t.execute(i,n,r),{success:!0,actionEntity:n,message:`Reloaded ${i.url()}`}}catch(n){return{success:!1,error:n.message,actionEntity:{action_description:"Reload page (failed)",action_data:{action_name:"reload_page",kwargs:{}},feedback:n.message}}}}})}import{z as Bs}from"zod";A();var Re=class{async execute(a,t,e){let s=N(a,t),i=E(e);if(s)await s.click({button:"right",timeout:i});else throw new Error("No locator found for right_click action")}transpile(a){let t=[];return a.locator?t.push(`locator: ${JSON.stringify(a.locator)}`):a.xpath&&t.push(`xpath: ${JSON.stringify(a.xpath)}`),a.frame_path&&a.frame_path.length>0&&t.push(`frame_path: ${JSON.stringify(a.frame_path)}`),t.length===0?['await agent.execAction("right_click", page, {});']:['await agent.execAction("right_click", page, {',...t.map(e=>` ${e},`),"});"]}};async function cr(a,t,e,s,i={}){return{...await O(s,e),action_description:t,action_data:{action_name:a,kwargs:{...i}}}}function Rs(a,t,e){return{action_description:`${a} (failed - element not found)`,action_data:{action_name:t,kwargs:e},feedback:"Element not found in DOM"}}var lr=Bs.object({element_index:Bs.number().int().describe("Index of the element to right-click")});function Do(a,t){a.register({name:"right_click",description:"Right-click an interactive element.",schema:lr,usesElementIndex:!0,async execute(e,s){let{element_index:i}=e,{page:r,agentServices:n,actionDescription:o}=s;try{let c=await D(s,i);if(!c)return{success:!1,error:`Element with index ${i} not found.`,actionEntity:Rs(`Right-click element ${i}`,"right_click",{index:i})};let l=o||`Right-click element ${i}`,h=await cr("right_click",l,c,r);return await t.execute(r,h,n),{success:!0,actionEntity:h,message:`Right-clicked element ${i}`}}catch(c){return{success:!1,error:c.message,actionEntity:Rs(`Right-click element ${i}`,"right_click",{index:i})}}}})}import{z as Ue}from"zod";var Us=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.name,r=s.kwargs.value;if(!i||r===void 0)throw new Error("Missing variable name or value for save_variable");i.startsWith("$")&&(i=i.slice(1)),e.saveVariable(i,r)}transpile(a){let t=a.action_data?.kwargs?.name||"",e=a.action_data?.kwargs?.value;return['await agent.execAction("save_variable", page, {',` action_data: { kwargs: { name: ${JSON.stringify(t)}, value: ${JSON.stringify(e)} } },`,"});"]}},hr=Ue.object({name:Ue.string().describe("Variable name to save"),value:Ue.string().describe("Value to save in the variable")});function $o(a,t){a.register({name:"save_variable",description:"Save a value to a named variable for later use in the test.",schema:hr,async execute(e,s){let{name:i,value:r}=e,{page:n,agentServices:o}=s;try{let c={action_description:`Save variable "${i}" = "${r}"`,action_data:{action_name:"save_variable",kwargs:{name:i,value:r}}};return await t.execute(n,c,o),{success:!0,actionEntity:c,message:`Saved variable "${i}"`}}catch(c){return{success:!1,error:c.message,actionEntity:{action_description:`Save variable "${i}" (failed)`,action_data:{action_name:"save_variable",kwargs:{name:i,value:r}},feedback:c.message}}}}})}import{z as je}from"zod";var le=class{async execute(a,t){let e=t.action_data;if(!e)throw new Error("Action data not found");let s=e.kwargs.down??!0,i=e.kwargs.num_pages??1,r=s?1:-1;await a.evaluate(`window.scrollBy(0, window.innerHeight * ${i} * ${r})`)}transpile(a){let t=a.action_data?.kwargs?.down??!0;return[`await page.evaluate('window.scrollBy(0, window.innerHeight * ${(a.action_data?.kwargs?.num_pages??1)*(t?1:-1)})');`]}};async function ur(a,t,e={}){return{action_description:t,action_data:{action_name:a,kwargs:{...e}}}}function pr(a,t,e){return{action_description:`${a} (failed)`,action_data:{action_name:t,kwargs:e},feedback:"Scroll failed!"}}var dr=je.object({down:je.boolean().describe("True to scroll down, False to scroll up"),num_pages:je.number().nonnegative().describe("Number of pages to scroll (0.5 = half page, 1.0 = one page, etc.)")});function jo(a,t){a.register({name:"scroll",description:"Scroll the page by specified number of pages (set down=True to scroll down, down=False to scroll up, num_pages=number of pages to scroll like 0.5 for half page, 1.0 for one page, etc.). ",schema:dr,async execute(e,s){let{down:i,num_pages:r}=e,{page:n,agentServices:o,actionDescription:c}=s;try{let l=c||`Scroll ${i?"down":"up"} ${r} page(s)`,h=await ur("scroll",l,{down:i,num_pages:r});return await t.execute(n,h,o),{success:!0,actionEntity:h,message:`Scrolled ${i?"down":"up"} ${r} page(s)`}}catch(l){return{success:!1,error:l.message,actionEntity:pr(c||`Scroll ${i?"down":"up"} ${r} page(s)`,"scroll",{down:i,num_pages:r})}}}})}import{z as be}from"zod";A();var zs=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.delta_x||0,r=s.kwargs.delta_y||0,n=N(a,t),o=E(e);if(n)await n.hover({timeout:o}),await a.mouse.wheel(i,r);else throw new Error("No locator found for scroll_on_element action")}transpile(a){let t=te(a);if(!t){let i=a.action_data?.kwargs?.delta_x||0,r=a.action_data?.kwargs?.delta_y||0;return['await agent.execAction("scroll_on_element", page, {',` action_data: { kwargs: { delta_x: ${i}, delta_y: ${r} } },`,"});"]}let e=a.action_data?.kwargs?.delta_x||0,s=a.action_data?.kwargs?.delta_y||0;return[`await ${t}.hover({ timeout: ${E()} });`,`await page.mouse.wheel(${e}, ${s});`]}};async function fr(a,t,e,s,i={}){return{...await O(s,e),action_description:t,action_data:{action_name:a,kwargs:{...i}}}}function js(a,t,e){return{action_description:`${a} (failed)`,action_data:{action_name:t,kwargs:e},feedback:"Element not found in DOM"}}var mr=be.object({element_index:be.number().int().describe("Index of the scrollable element"),delta_x:be.number().optional().describe("The number of pixels to scroll horizontally. Positive values scroll right, negative values scroll left."),delta_y:be.number().optional().describe("The number of pixels to scroll vertically. Positive values scroll down, negative values scroll up.")});function Ko(a,t){a.register({name:"scroll_on_element",description:"Scroll on a scrollable element horizontally and vertically.",schema:mr,usesElementIndex:!0,async execute(e,s){let{element_index:i,delta_x:r,delta_y:n}=e,{page:o,agentServices:c}=s;try{let l=await D(s,i);if(!l)return{success:!1,error:`Element with index ${i} not found`,actionEntity:js(`Scroll on element ${i} horizontally: ${r}px, vertically: ${n}px`,"scroll_on_element",{index:i,delta_x:r,delta_y:n})};let h=await fr("scroll_on_element",`Scroll on element ${i} horizontally: ${r}px, vertically: ${n}px`,l,o,{delta_x:r,delta_y:n});return await t.execute(o,h,c),{success:!0,actionEntity:h,message:`Scrolled on element ${i} horizontally: ${r}px, vertically: ${n}px`}}catch(l){return{success:!1,error:l.message,actionEntity:js(`Scroll on element ${i} horizontally: ${r}px, vertically: ${n}px`,"scroll_on_element",{index:i,delta_x:r,delta_y:n})}}}})}import{z as Vs}from"zod";var qs=class{async execute(a,t){let e=t.action_data;if(!e)throw new Error("Action data not found");let s=e.kwargs.text;if(s)await a.getByText(s,{exact:!1}).first().scrollIntoViewIfNeeded(),await a.waitForTimeout(500);else throw new Error("Missing text for scroll_to_text action")}transpile(a){let t=a.action_data?.kwargs?.text||"";return[`await page.getByText(${JSON.stringify(t)}, { exact: false }).first().scrollIntoViewIfNeeded();`]}},yr=Vs.object({text:Vs.string().describe("Text to scroll to on the page")});function Yo(a,t){a.register({name:"scroll_to_text",description:"Scroll the page until specified text becomes visible.",schema:yr,async execute(e,s){let{text:i}=e,{page:r,agentServices:n,actionDescription:o}=s;try{let c={action_description:o||`Scroll to text "${i}"`,action_data:{action_name:"scroll_to_text",kwargs:{text:i}}};return await t.execute(r,c,n),{success:!0,actionEntity:c,message:`Scrolled to text "${i}"`}}catch(c){return{success:!1,error:c.message,actionEntity:{action_description:(o||`Scroll to text "${i}"`)+" (failed)",action_data:{action_name:"scroll_to_text",kwargs:{text:i}},feedback:c.message}}}}})}import{z as ze}from"zod";A();var Hs=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.text||s.kwargs.option,r=N(a,t),n=E(e);if(r&&i)await r.selectOption(i,{timeout:n});else throw new Error("Missing locator or option label for select_dropdown_option action")}transpile(a){let t=a.action_data?.kwargs?.text||a.action_data?.kwargs?.option||"",e=[];return e.push(`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`),a.locator?e.push(`locator: ${JSON.stringify(a.locator)}`):a.xpath&&e.push(`xpath: ${JSON.stringify(a.xpath)}`),a.frame_path&&a.frame_path.length>0&&e.push(`frame_path: ${JSON.stringify(a.frame_path)}`),['await agent.execAction("select_dropdown_option", page, {',...e.map(s=>` ${s},`),"});"]}};async function xr(a,t,e,s){return{...await O(t,a),action_description:s||`Select option "${e}"`,action_data:{action_name:"select_dropdown_option",kwargs:{text:e}}}}function Js(a,t){return{action_description:`${a} (failed - element not found)`,action_data:{action_name:"select_dropdown_option",kwargs:t},feedback:"Element not found in DOM"}}var gr=ze.object({element_index:ze.number().int().describe("Index of the dropdown/select element"),option:ze.string().describe("Option value, label, or index to select")});function ic(a,t){a.register({name:"select_dropdown_option",description:"Select an option from a dropdown/select element by value, label, or index.",schema:gr,usesElementIndex:!0,async execute(e,s){let{element_index:i,option:r}=e,{page:n,agentServices:o,actionDescription:c}=s;try{let l=await D(s,i);if(!l)return{success:!1,error:`Dropdown element with index ${i} not found`,actionEntity:Js(c||`Select option in dropdown ${i}`,{index:i,option:r})};let h=await xr(l,n,r,c);return await t.execute(n,h,o),{success:!0,actionEntity:h,message:`Selected option "${r}" in dropdown ${i}`}}catch(l){return{success:!1,error:l.message,actionEntity:Js(`Select option in dropdown ${i}`,{index:i,option:r})}}}})}import{z as Ks}from"zod";var Xs=class{async execute(a,t,e){if(!t.xpath)throw new Error("XPath not found in action entity");let s=[];for(let i of a.frames())try{let r=await i.evaluate(n=>{let o=document.evaluate(n,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;return o?{options:Array.from(o.options).map(c=>({text:c.text,value:c.value,index:c.index})),id:o.id,name:o.name}:null},t.xpath);if(r){let n=[];for(let o of r.options){let c=JSON.stringify(o.text);n.push(`${o.index}: text=${c}`)}s.push(...n)}}catch{}if(s.length>0){let i=s.join(`
24
+ The date must be in YYYY-MM-DD format (e.g., 2024-03-15).`,schema:Yi,usesElementIndex:!0,async execute(e,s){let{element_index:i,date:r}=e,{page:n,agentServices:o}=s;try{let c=await D(s,i);if(!c)return{success:!1,error:`Date picker element with index ${i} not found`,actionEntity:$e(`Set date to ${r} on element ${i}`,{index:i,date:r})};let l=c.attributes.type;if(l!=="date")return{success:!1,error:`Element ${i} is not a native date picker (type="${l}"). This action only works with <input type="date">.`,actionEntity:$e(`Set date to ${r} on element ${i}`,{index:i,date:r})};let h=await Gi(`Set date to ${r} on element ${i}`,c,n,r);return await t.execute(n,h,o),{success:!0,actionEntity:h,message:`Set date to ${r} on element ${i}`}}catch(c){return{success:!1,error:c.message,actionEntity:$e(`Set date to ${r} on element ${i}`,{index:i,date:r})}}}})}import{z as Cs}from"zod";var vs=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.page_id;if(typeof i=="number"){let r=a.context().pages(),n=i===-1?r.length-1:i;if(e){let o=await e.switchTab(n);await o.waitForLoadState("load",{timeout:15e3}).catch(()=>{}),await o.waitForTimeout(500)}}else throw new Error("Missing page_id for switch_tab action")}transpile(a){return['await agent.execAction("switch_tab", page, {',` action_data: { kwargs: { page_id: ${a.action_data?.kwargs?.page_id??0} } },`,"});"]}},Qi=Cs.object({tab_index:Cs.number().int().nonnegative().describe("Index of the tab to switch to (0-based). Use 0 for first tab, 1 for second, etc.")});function Gn(a,t){a.register({name:"switch_tab",description:"Switch to a different browser tab by index (0-based).",schema:Qi,async execute(e,s){let i=e.tab_index??e.index,{page:r,agentServices:n,actionDescription:o}=s;try{let c={action_description:o||`Switch to tab ${i}`,action_data:{action_name:"switch_tab",kwargs:{page_id:i}}};return await t.execute(r,c,n),{success:!0,actionEntity:c,message:`Switched to tab ${i}`}}catch(c){return{success:!1,error:c.message,actionEntity:{action_description:(o||`Switch to tab ${i}`)+" (failed)",action_data:{action_name:"switch_tab",kwargs:{page_id:i}},feedback:c.message}}}}})}import Zi from"fs";import er from"path";async function so(a,t,e,s,i,r){let n=Array.isArray(t)?t:[t];if(n.length===0)throw new Error("No file paths provided for upload");let o=n.map(h=>{if(h.startsWith("/")||h.match(/^[A-Za-z]:\\/))return h;let p=s.testDataDir||process.cwd();return er.join(p,h)});Y.info(`Uploading files: ${o.join(", ")}`);let c=e.timeout||2e4,l={useFileInput:e.useFileInput||!1,timeout:c};if(e.selector&&typeof e.selector!="string"){let h=e.selector;await Pe(a,h,o,l);return}if(e.selector&&typeof e.selector=="string"){let h=e.selector,p=(h.startsWith("xpath="),a.locator(h));await Pe(a,p,o,l);return}if(i){let h=n.map(d=>`"${d}"`).join(", "),p="";e.targetDescription?p=`Upload ${h} to ${e.targetDescription}`:p=`Upload ${h}`,Y.info(`Using AI to handle file upload: ${p}`),await i(a,p,r)}else throw new Error("No selector provided and AI action execution is not available")}async function Pe(a,t,e,s){let{useFileInput:i,timeout:r,mockShowOpenFilePicker:n}=s;if(n){Y.info("Using mockShowOpenFilePicker approach");let o=e.map(c=>({path:c,buffer:new Uint8Array(Zi.readFileSync(c))}));await a.evaluate(c=>{window.__pw_showOpenFilePicker_mock_files=c},o),await t.click({timeout:r}),await a.waitForTimeout(3e3),await a.evaluate(()=>{delete window.__pw_showOpenFilePicker_mock_files})}else if(i)Y.info("Using direct file input approach"),await t.setInputFiles(e,{timeout:r}),await a.waitForTimeout(3e3);else{Y.info("Using file chooser approach");let o=a.waitForEvent("filechooser",{timeout:r});o.catch(()=>{}),await t.click({timeout:r}),await(await o).setFiles(e),await a.waitForTimeout(3e3)}Y.info(`Successfully uploaded ${e.length} file(s)`)}import{z as se}from"zod";A();var _s=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=[];if(s.kwargs.paths?i=Array.isArray(s.kwargs.paths)?s.kwargs.paths:[s.kwargs.paths]:s.kwargs.path&&(i=Array.isArray(s.kwargs.path)?s.kwargs.path:[s.kwargs.path]),i.length===0)throw new Error("No file paths provided for upload_file action");await e.downloadTestDataFiles(i);let r=i.map(l=>e.getTestDataFilePath(l)),n=N(a,t);if(!n)throw new Error("Missing locator for upload_file action");let o=s.kwargs.use_file_input||!1,c=e.getActionSettings().mock_show_open_file_picker??!1;await Pe(a,n,r,{useFileInput:o,timeout:E(e),mockShowOpenFilePicker:c})}transpile(a){let t=a.action_data?.kwargs||{},e=[],s={};return t.paths?s.paths=t.paths:t.path&&(s.path=t.path),t.use_file_input&&(s.use_file_input=!0),e.push(`action_data: { kwargs: ${JSON.stringify(s)} }`),a.locator?e.push(`locator: ${JSON.stringify(a.locator)}`):a.xpath&&e.push(`xpath: ${JSON.stringify(a.xpath)}`),a.frame_path&&a.frame_path.length>0&&e.push(`frame_path: ${JSON.stringify(a.frame_path)}`),['await agent.execAction("upload_file", page, {',...e.map(i=>` ${i},`),"});"]}};async function tr(a,t,e={},s){return{...await O(t,a),action_description:s||"Upload file to element",action_data:{action_name:"upload_file",kwargs:{...e}}}}function Ns(a,t){return{action_description:`${a} (failed - element not found)`,action_data:{action_name:"upload_file",kwargs:t},feedback:"Element not found in DOM"}}var sr=se.object({element_index:se.number().int().describe("Index of the target element to trigger the file upload dialog"),paths:se.string().describe("Paths to the files to upload")});function co(a,t){a.register({name:"upload_file",description:'Click on target element (usually contains hints like "Upload file" or "Choose file" etc.) to trigger the file upload dialog, and choose the files to upload',schema:sr,usesElementIndex:!0,async execute(e,s){let{element_index:i,paths:r}=e,{page:n,agentServices:o,actionDescription:c}=s;try{let l=await D(s,i);if(!l)return{success:!1,error:`File input element with index ${i} not found`,actionEntity:Ns(c||`Upload file to element ${i}`,{index:i,paths:r})};let h=await tr(l,n,{paths:r},c);return await t.execute(n,h,o),{success:!0,actionEntity:h,message:`Uploaded file to element ${i}`}}catch(l){return{success:!1,error:l.message,actionEntity:Ns(c||`Upload file to element ${i}`,{index:i,paths:r})}}}})}var lo=se.object({element_index:se.number().int().describe("Index of the file input element"),paths:se.string().describe("Path to the file to upload (can be relative or absolute)")});import{z as Ls}from"zod";var Ds=class{async execute(a,t){let e=t.action_data;if(!e)throw new Error("Action data not found");let s=e.kwargs.seconds||1;await a.waitForTimeout(s*1e3)}transpile(a){return[`await page.waitForTimeout(${(a.action_data?.kwargs?.seconds||1)*1e3});`]}},ir=Ls.object({seconds:Ls.number().positive().describe("Number of seconds to wait")});function fo(a,t){a.register({name:"wait",description:"Wait for a specified number of seconds before continuing.",schema:ir,async execute(e,s){let{seconds:i}=e,{page:r,agentServices:n,actionDescription:o}=s;try{let c={action_description:o||`Wait ${i} seconds`,action_data:{action_name:"wait",kwargs:{seconds:i}}};return await t.execute(r,c,n),{success:!0,actionEntity:c,message:`Waited ${i} seconds`}}catch(c){return{success:!1,error:c.message,actionEntity:{action_description:(o||`Wait ${i} seconds`)+" (failed)",action_data:{action_name:"wait",kwargs:{seconds:i}},feedback:c.message}}}}})}import{z as Os}from"zod";var Ms=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.timeout_seconds||10;await e.waitForDownloadComplete(a,i)}transpile(a){return['await agent.execAction("wait_for_download_complete", page, {',` action_data: { kwargs: { timeout_seconds: ${a.action_data?.kwargs?.timeout_seconds||10} } },`,"});"]}},rr=Os.object({timeout_seconds:Os.number().positive().optional().describe("Maximum time in seconds to wait for download to complete (default: 10)")});function go(a,t){a.register({name:"wait_for_download_complete",description:"Wait for an in-progress download to complete.",schema:rr,async execute(e,s){let{timeout_seconds:i=10}=e,{page:r,agentServices:n}=s;try{let o={action_description:`Wait for download to complete (timeout: ${i}s)`,action_data:{action_name:"wait_for_download_complete",kwargs:{timeout_seconds:i}}};return await t.execute(r,o,n),{success:!0,actionEntity:o,message:"Download completed"}}catch(o){return{success:!1,error:o.message,actionEntity:{action_description:"Wait for download to complete (failed)",action_data:{action_name:"wait_for_download_complete",kwargs:{timeout_seconds:i}},feedback:o.message}}}}})}import{z as Be}from"zod";var Fs=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.condition;if(!i)throw new Error("Missing condition for ai_wait_until");let r=(s.kwargs.timeout_seconds||60)*1e3,n=1e3,o=Date.now(),{evaluateStatement:c}=await import("./agentHelpers-MOO2YPML.js");for(;Date.now()-o<r;){if((await c(i,a,e,{})).success)return;await a.waitForTimeout(n)}throw new Error(`Timeout waiting for condition: ${i}`)}transpile(a,t){let e=a.action_data?.kwargs?.condition,s=a.action_data?.kwargs?.timeout_seconds||60;return e?[`await agent.waitUntilCondition(page, ${JSON.stringify(e)}, ${s}, '${t}');`]:["// Skipping ai_wait_until: missing condition"]}},ar=Be.object({condition:Be.string().describe('The condition to wait for (e.g., "the loading spinner disappears")'),timeout_seconds:Be.number().positive().optional().describe("Timeout in seconds (default: 60)")});function To(a,t){a.register({name:"ai_wait_until",description:'Wait until a specific condition is met on the page (e.g., "page loads", "spinner disappears", "button becomes enabled"). Use this instead of wait when the goal is to wait for something to happen rather than waiting a fixed duration.',schema:ar,async execute(e,s){let{condition:i,timeout_seconds:r=60}=e,{page:n,agentServices:o}=s;try{let c={action_description:`Wait until: ${i}`,action_data:{action_name:"ai_wait_until",kwargs:{condition:i,timeout_seconds:r}}};return await t.execute(n,c,o),{success:!0,actionEntity:c,message:`Condition met: ${i}`}}catch(c){return{success:!1,error:c.message,actionEntity:{action_description:`Wait until: ${i} (failed)`,action_data:{action_name:"ai_wait_until",kwargs:{condition:i,timeout_seconds:r}},feedback:c.message}}}}})}import{z as nr}from"zod";A();var $s=class{async execute(a,t){await a.reload({timeout:J}),await a.waitForLoadState("load",{timeout:J}),await a.waitForTimeout(1e3)}transpile(a){return['await agent.execAction("reload_page", page, {});']}},or=nr.object({});function Io(a,t){a.register({name:"reload_page",description:"Reload the current page. WARNING: This will reset any in-progress forms or multi-step flows (like login). Only use when you need to refresh stale data or clear a stuck state. Do NOT use during login, checkout, or form submission flows.",schema:or,async execute(e,s){let{page:i,agentServices:r}=s;try{let n={action_description:"Reload page",action_data:{action_name:"reload_page",kwargs:{}}};return await t.execute(i,n,r),{success:!0,actionEntity:n,message:`Reloaded ${i.url()}`}}catch(n){return{success:!1,error:n.message,actionEntity:{action_description:"Reload page (failed)",action_data:{action_name:"reload_page",kwargs:{}},feedback:n.message}}}}})}import{z as Bs}from"zod";A();var Re=class{async execute(a,t,e){let s=N(a,t),i=E(e);if(s)await s.click({button:"right",timeout:i});else throw new Error("No locator found for right_click action")}transpile(a){let t=[];return a.locator?t.push(`locator: ${JSON.stringify(a.locator)}`):a.xpath&&t.push(`xpath: ${JSON.stringify(a.xpath)}`),a.frame_path&&a.frame_path.length>0&&t.push(`frame_path: ${JSON.stringify(a.frame_path)}`),t.length===0?['await agent.execAction("right_click", page, {});']:['await agent.execAction("right_click", page, {',...t.map(e=>` ${e},`),"});"]}};async function cr(a,t,e,s,i={}){return{...await O(s,e),action_description:t,action_data:{action_name:a,kwargs:{...i}}}}function Rs(a,t,e){return{action_description:`${a} (failed - element not found)`,action_data:{action_name:t,kwargs:e},feedback:"Element not found in DOM"}}var lr=Bs.object({element_index:Bs.number().int().describe("Index of the element to right-click")});function Do(a,t){a.register({name:"right_click",description:"Right-click an interactive element.",schema:lr,usesElementIndex:!0,async execute(e,s){let{element_index:i}=e,{page:r,agentServices:n,actionDescription:o}=s;try{let c=await D(s,i);if(!c)return{success:!1,error:`Element with index ${i} not found.`,actionEntity:Rs(`Right-click element ${i}`,"right_click",{index:i})};let l=o||`Right-click element ${i}`,h=await cr("right_click",l,c,r);return await t.execute(r,h,n),{success:!0,actionEntity:h,message:`Right-clicked element ${i}`}}catch(c){return{success:!1,error:c.message,actionEntity:Rs(`Right-click element ${i}`,"right_click",{index:i})}}}})}import{z as Ue}from"zod";var Us=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.name,r=s.kwargs.value;if(!i||r===void 0)throw new Error("Missing variable name or value for save_variable");i.startsWith("$")&&(i=i.slice(1)),e.saveVariable(i,r)}transpile(a){let t=a.action_data?.kwargs?.name||"",e=a.action_data?.kwargs?.value;return['await agent.execAction("save_variable", page, {',` action_data: { kwargs: { name: ${JSON.stringify(t)}, value: ${JSON.stringify(e)} } },`,"});"]}},hr=Ue.object({name:Ue.string().describe("Variable name to save"),value:Ue.string().describe("Value to save in the variable")});function $o(a,t){a.register({name:"save_variable",description:"Save a value to a named variable for later use in the test.",schema:hr,async execute(e,s){let{name:i,value:r}=e,{page:n,agentServices:o}=s;try{let c={action_description:`Save variable "${i}" = "${r}"`,action_data:{action_name:"save_variable",kwargs:{name:i,value:r}}};return await t.execute(n,c,o),{success:!0,actionEntity:c,message:`Saved variable "${i}"`}}catch(c){return{success:!1,error:c.message,actionEntity:{action_description:`Save variable "${i}" (failed)`,action_data:{action_name:"save_variable",kwargs:{name:i,value:r}},feedback:c.message}}}}})}import{z as je}from"zod";var le=class{async execute(a,t){let e=t.action_data;if(!e)throw new Error("Action data not found");let s=e.kwargs.down??!0,i=e.kwargs.num_pages??1,r=s?1:-1;await a.evaluate(`window.scrollBy(0, window.innerHeight * ${i} * ${r})`)}transpile(a){let t=a.action_data?.kwargs?.down??!0;return[`await page.evaluate('window.scrollBy(0, window.innerHeight * ${(a.action_data?.kwargs?.num_pages??1)*(t?1:-1)})');`]}};async function ur(a,t,e={}){return{action_description:t,action_data:{action_name:a,kwargs:{...e}}}}function pr(a,t,e){return{action_description:`${a} (failed)`,action_data:{action_name:t,kwargs:e},feedback:"Scroll failed!"}}var dr=je.object({down:je.boolean().describe("True to scroll down, False to scroll up"),num_pages:je.number().nonnegative().describe("Number of pages to scroll (0.5 = half page, 1.0 = one page, etc.)")});function jo(a,t){a.register({name:"scroll",description:"Scroll the page by specified number of pages (set down=True to scroll down, down=False to scroll up, num_pages=number of pages to scroll like 0.5 for half page, 1.0 for one page, etc.). ",schema:dr,async execute(e,s){let{down:i,num_pages:r}=e,{page:n,agentServices:o,actionDescription:c}=s;try{let l=c||`Scroll ${i?"down":"up"} ${r} page(s)`,h=await ur("scroll",l,{down:i,num_pages:r});return await t.execute(n,h,o),{success:!0,actionEntity:h,message:`Scrolled ${i?"down":"up"} ${r} page(s)`}}catch(l){return{success:!1,error:l.message,actionEntity:pr(c||`Scroll ${i?"down":"up"} ${r} page(s)`,"scroll",{down:i,num_pages:r})}}}})}import{z as be}from"zod";A();var zs=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.delta_x||0,r=s.kwargs.delta_y||0,n=N(a,t),o=E(e);if(n)await n.hover({timeout:o}),await a.mouse.wheel(i,r);else throw new Error("No locator found for scroll_on_element action")}transpile(a){let t=te(a);if(!t){let i=a.action_data?.kwargs?.delta_x||0,r=a.action_data?.kwargs?.delta_y||0;return['await agent.execAction("scroll_on_element", page, {',` action_data: { kwargs: { delta_x: ${i}, delta_y: ${r} } },`,"});"]}let e=a.action_data?.kwargs?.delta_x||0,s=a.action_data?.kwargs?.delta_y||0;return[`await ${t}.hover({ timeout: ${E()} });`,`await page.mouse.wheel(${e}, ${s});`]}};async function fr(a,t,e,s,i={}){return{...await O(s,e),action_description:t,action_data:{action_name:a,kwargs:{...i}}}}function js(a,t,e){return{action_description:`${a} (failed)`,action_data:{action_name:t,kwargs:e},feedback:"Element not found in DOM"}}var mr=be.object({element_index:be.number().int().describe("Index of the scrollable element"),delta_x:be.number().optional().describe("The number of pixels to scroll horizontally. Positive values scroll right, negative values scroll left."),delta_y:be.number().optional().describe("The number of pixels to scroll vertically. Positive values scroll down, negative values scroll up.")});function Ko(a,t){a.register({name:"scroll_on_element",description:"Scroll on a scrollable element horizontally and vertically.",schema:mr,usesElementIndex:!0,async execute(e,s){let{element_index:i,delta_x:r,delta_y:n}=e,{page:o,agentServices:c}=s;try{let l=await D(s,i);if(!l)return{success:!1,error:`Element with index ${i} not found`,actionEntity:js(`Scroll on element ${i} horizontally: ${r}px, vertically: ${n}px`,"scroll_on_element",{index:i,delta_x:r,delta_y:n})};let h=await fr("scroll_on_element",`Scroll on element ${i} horizontally: ${r}px, vertically: ${n}px`,l,o,{delta_x:r,delta_y:n});return await t.execute(o,h,c),{success:!0,actionEntity:h,message:`Scrolled on element ${i} horizontally: ${r}px, vertically: ${n}px`}}catch(l){return{success:!1,error:l.message,actionEntity:js(`Scroll on element ${i} horizontally: ${r}px, vertically: ${n}px`,"scroll_on_element",{index:i,delta_x:r,delta_y:n})}}}})}import{z as Vs}from"zod";var qs=class{async execute(a,t){let e=t.action_data;if(!e)throw new Error("Action data not found");let s=e.kwargs.text;if(s)await a.getByText(s,{exact:!1}).first().scrollIntoViewIfNeeded(),await a.waitForTimeout(500);else throw new Error("Missing text for scroll_to_text action")}transpile(a){let t=a.action_data?.kwargs?.text||"";return[`await page.getByText(${JSON.stringify(t)}, { exact: false }).first().scrollIntoViewIfNeeded();`]}},yr=Vs.object({text:Vs.string().describe("Text to scroll to on the page")});function Yo(a,t){a.register({name:"scroll_to_text",description:"Scroll the page until specified text becomes visible.",schema:yr,async execute(e,s){let{text:i}=e,{page:r,agentServices:n,actionDescription:o}=s;try{let c={action_description:o||`Scroll to text "${i}"`,action_data:{action_name:"scroll_to_text",kwargs:{text:i}}};return await t.execute(r,c,n),{success:!0,actionEntity:c,message:`Scrolled to text "${i}"`}}catch(c){return{success:!1,error:c.message,actionEntity:{action_description:(o||`Scroll to text "${i}"`)+" (failed)",action_data:{action_name:"scroll_to_text",kwargs:{text:i}},feedback:c.message}}}}})}import{z as ze}from"zod";A();var Hs=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.text||s.kwargs.option,r=N(a,t),n=E(e);if(r&&i)await r.selectOption(i,{timeout:n});else throw new Error("Missing locator or option label for select_dropdown_option action")}transpile(a){let t=a.action_data?.kwargs?.text||a.action_data?.kwargs?.option||"",e=[];return e.push(`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`),a.locator?e.push(`locator: ${JSON.stringify(a.locator)}`):a.xpath&&e.push(`xpath: ${JSON.stringify(a.xpath)}`),a.frame_path&&a.frame_path.length>0&&e.push(`frame_path: ${JSON.stringify(a.frame_path)}`),['await agent.execAction("select_dropdown_option", page, {',...e.map(s=>` ${s},`),"});"]}};async function xr(a,t,e,s){return{...await O(t,a),action_description:s||`Select option "${e}"`,action_data:{action_name:"select_dropdown_option",kwargs:{text:e}}}}function Js(a,t){return{action_description:`${a} (failed - element not found)`,action_data:{action_name:"select_dropdown_option",kwargs:t},feedback:"Element not found in DOM"}}var gr=ze.object({element_index:ze.number().int().describe("Index of the dropdown/select element"),option:ze.string().describe("Option value, label, or index to select")});function ic(a,t){a.register({name:"select_dropdown_option",description:"Select an option from a dropdown/select element by value, label, or index.",schema:gr,usesElementIndex:!0,async execute(e,s){let{element_index:i,option:r}=e,{page:n,agentServices:o,actionDescription:c}=s;try{let l=await D(s,i);if(!l)return{success:!1,error:`Dropdown element with index ${i} not found`,actionEntity:Js(c||`Select option in dropdown ${i}`,{index:i,option:r})};let h=await xr(l,n,r,c);return await t.execute(n,h,o),{success:!0,actionEntity:h,message:`Selected option "${r}" in dropdown ${i}`}}catch(l){return{success:!1,error:l.message,actionEntity:Js(`Select option in dropdown ${i}`,{index:i,option:r})}}}})}import{z as Ks}from"zod";var Xs=class{async execute(a,t,e){if(!t.xpath)throw new Error("XPath not found in action entity");let s=[];for(let i of a.frames())try{let r=await i.evaluate(n=>{let o=document.evaluate(n,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;return o?{options:Array.from(o.options).map(c=>({text:c.text,value:c.value,index:c.index})),id:o.id,name:o.name}:null},t.xpath);if(r){let n=[];for(let o of r.options){let c=JSON.stringify(o.text);n.push(`${o.index}: text=${c}`)}s.push(...n)}}catch{}if(s.length>0){let i=s.join(`
25
25
  `);i+=`
26
- Use the exact text string in select_dropdown_option`,e.addNote(i)}else e.addNote("No options found in any frame for dropdown")}transpile(a){let t=[];return a.xpath&&t.push(`xpath: ${JSON.stringify(a.xpath)}`),a.frame_path&&a.frame_path.length>0&&t.push(`frame_path: ${JSON.stringify(a.frame_path)}`),t.length===0?['await agent.execAction("get_dropdown_options", page, {});']:['await agent.execAction("get_dropdown_options", page, {',...t.map(e=>` ${e},`),"});"]}};async function wr(a,t,e){return{...await O(t,a),action_description:e||"Get dropdown options",action_data:{action_name:"get_dropdown_options",kwargs:{}}}}function Ws(a,t){return{action_description:`${a} (failed - element not found)`,action_data:{action_name:"get_dropdown_options",kwargs:t},feedback:"Element not found in DOM"}}var Pr=Ks.object({element_index:Ks.number().int().describe("Index of the dropdown/select element")});function cc(a,t){a.register({name:"get_dropdown_options",description:"Get all options from a native dropdown",schema:Pr,usesElementIndex:!0,async execute(e,s){let{element_index:i}=e,{page:r,agentServices:n,actionDescription:o}=s;try{let c=await D(s,i);if(!c)return{success:!1,error:`Dropdown element with index ${i} not found`,actionEntity:Ws(o||`Get options from dropdown ${i}`,{index:i})};let l=await wr(c,r,o);return await t.execute(r,l,n),{success:!0,actionEntity:l,message:l.feedback||"No options found"}}catch(c){return{success:!1,error:c.message,actionEntity:Ws(o||`Get options from dropdown ${i}`,{index:i})}}}})}import{z as br}from"zod";A();var Gs=class{async execute(a,t){await a.goBack({timeout:J}),await a.waitForLoadState("load",{timeout:J}),await a.waitForTimeout(1e3)}transpile(a){return['await agent.execAction("go_back", page, {});']}},Tr=br.object({});function dc(a,t){a.register({name:"go_back",description:"Navigate back to the previous page in browser history.",schema:Tr,async execute(e,s){let{page:i,agentServices:r,actionDescription:n}=s;try{let o={action_description:n||"Go back",action_data:{action_name:"go_back",kwargs:{}}};return await t.execute(i,o,r),{success:!0,actionEntity:o,message:"Navigated back"}}catch(o){return{success:!1,error:o.message,actionEntity:{action_description:(n||"Go back")+" (failed)",action_data:{action_name:"go_back",kwargs:{}},feedback:o.message}}}}})}import{z as Te}from"zod";A();var Ve=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.url;if(!i)throw new Error("Missing URL for go_to_url action");let r=s.kwargs.new_tab===!0,n=e.replaceVariables(String(i)),o=s.kwargs.timeout_seconds?s.kwargs.timeout_seconds*1e3:J,c=a;r&&(c=await a.context().newPage(),e.setPage(c)),await c.goto(n,{timeout:o})}transpile(a){let t=a.action_data?.kwargs?.url||"",e=a.action_data?.kwargs?.new_tab===!0,s=a.action_data?.kwargs?.timeout_seconds,i=[`url: ${JSON.stringify(t)}`];return e&&i.push("new_tab: true"),s&&i.push(`timeout_seconds: ${s}`),['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { ${i.join(", ")} } },`,"});"]}},Ar=Te.object({url:Te.string().describe("URL to navigate to (must be a valid HTTP/HTTPS URL)"),new_tab:Te.boolean().optional().describe("If true, open the URL in a new tab instead of the current page. Default is false."),timeout_seconds:Te.number().positive().optional().describe("Navigation timeout in seconds. Default is 20 seconds.")});function gc(a,t){a.register({name:"go_to_url",description:"Navigate to a specific URL. Use this to visit web pages. Set new_tab=true to open in a new tab.",schema:Ar,async execute(e,s){let{url:i,new_tab:r,timeout_seconds:n}=e,{page:o,agentServices:c,actionDescription:l}=s,h={url:i,new_tab:r??!1};n!==void 0&&(h.timeout_seconds=n);let p=n?` (timeout: ${n}s)`:"";try{let d=r?`Open ${i} in new tab`:`Navigate to ${i}`,f={action_description:l||d,action_data:{action_name:"go_to_url",kwargs:h}};return await t.execute(o,f,c),{success:!0,actionEntity:f,message:(r?`Opened ${i} in new tab`:`Navigated to ${i}`)+p}}catch(d){let f=r?`Open ${i} in new tab`:`Navigate to ${i}`;return{success:!1,error:d.message,actionEntity:{action_description:(l||f)+" (failed)",action_data:{action_name:"go_to_url",kwargs:h},feedback:d.message}}}}})}import{z as Ys}from"zod";A();var qe=class{async execute(a,t,e){let s=N(a,t),i=E(e);if(s){await s.waitFor({state:"attached",timeout:i});let r=await s.elementHandle();if(!r)throw new Error("Unable to obtain element handle for hover action");let n=await r.boundingBox();if(!n)throw new Error("Unable to determine bounding box for hover action");let o=n.x+n.width/2,c=n.y+n.height/2;await a.mouse.move(o,c)}else throw new Error("No locator found for hover action")}transpile(a){let t=[];return a.locator?t.push(`locator: ${JSON.stringify(a.locator)}`):a.xpath&&t.push(`xpath: ${JSON.stringify(a.xpath)}`),a.frame_path&&a.frame_path.length>0&&t.push(`frame_path: ${JSON.stringify(a.frame_path)}`),t.length===0?['await agent.execAction("hover", page, {});']:['await agent.execAction("hover", page, {',...t.map(e=>` ${e},`),"});"]}};async function Sr(a,t,e,s,i={}){return{...await O(s,e),action_description:t,action_data:{action_name:a,kwargs:{...i}}}}function Qs(a,t,e){return{action_description:`${a} (failed - element not found)`,action_data:{action_name:t,kwargs:e},feedback:"Element not found in DOM"}}var kr=Ys.object({element_index:Ys.number().int().describe("Index of the element to hover over")});function Sc(a,t){a.register({name:"hover",description:"Hover over an interactive element.",schema:kr,usesElementIndex:!0,async execute(e,s){let{element_index:i}=e,{page:r,agentServices:n,actionDescription:o}=s;try{let c=await D(s,i);if(!c)return{success:!1,error:`Element with index ${i} not found.`,actionEntity:Qs(`Hover element ${i}`,"hover",{index:i})};let l=o||`Hover over element ${i}`,h=await Sr("hover",l,c,r);return await t.execute(r,h,n),{success:!0,actionEntity:h,message:`Hovered over element ${i}`}}catch(c){return{success:!1,error:c.message,actionEntity:Qs(`Hover element ${i}`,"hover",{index:i})}}}})}import{z as Je}from"zod";A();var He=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.text??s.kwargs.value??"",r=e.replaceVariables(String(i)),n=N(a,t),o=E(e);if(n){await n.evaluate(l=>{l.value&&(l.value="")},null,{timeout:o}),await n.click({timeout:o}),await a.waitForTimeout(200);let c=e.getActionSettings().type_delay;c!==void 0?await a.keyboard.type(r,{delay:c}):await a.keyboard.type(r)}else throw new Error("No locator found for input_text action")}transpile(a){let t=a.action_data?.kwargs?.text??a.action_data?.kwargs?.value??"",e=[];return e.push(`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`),a.locator?e.push(`locator: ${JSON.stringify(a.locator)}`):a.xpath&&e.push(`xpath: ${JSON.stringify(a.xpath)}`),a.frame_path&&a.frame_path.length>0&&e.push(`frame_path: ${JSON.stringify(a.frame_path)}`),['await agent.execAction("input_text", page, {',...e.map(s=>` ${s},`),"});"]}};async function Er(a,t,e,s,i={}){return{...await O(s,e),action_description:t,action_data:{action_name:a,kwargs:{...i}}}}function Zs(a,t,e){return{action_description:`${a} (failed - element not found)`,action_data:{action_name:t,kwargs:e},feedback:"Element not found in DOM"}}var Ir=Je.object({element_index:Je.number().int().describe("Index of the input element"),text:Je.string().describe("Text to type into the input. To use a placeholder, write {{ placeholder_name }} using exact placeholder name. Use clear_input first if you want to replace existing content.")});function Nc(a,t){a.register({name:"input_text",description:"Type text into an input field. To replace existing content, use clear_input first.",schema:Ir,usesElementIndex:!0,async execute(e,s){let{element_index:i,text:r}=e,{page:n,agentServices:o,actionDescription:c}=s;try{let l=await D(s,i);if(!l)return{success:!1,error:`Input element with index ${i} not found`,actionEntity:Zs(c||`Input text to element ${i}`,"input_text",{index:i,text:r})};let h=c||`Input text to element ${i}`,p=await Er("input_text",h,l,n,{text:r});return await t.execute(n,p,o),{success:!0,actionEntity:p,message:`Input text to element ${i}`}}catch(l){return{success:!1,error:l.message,actionEntity:Zs(`Input text to element ${i}`,"input_text",{index:i,text:r})}}}})}import{z as ei}from"zod";var Ke=class{async execute(a,t){let e=t.action_data;if(!e)throw new Error("Action data not found");let s=e.kwargs.keys;if(!s||typeof s!="string")throw new Error("Missing or invalid keys for press action");await a.keyboard.press(s),await a.waitForTimeout(500)}transpile(a){let t=a.action_data?.kwargs?.keys;return[`await page.keyboard.press(${JSON.stringify(t)});`]}},Cr=ei.object({keys:ei.string().describe("A single key or key combination to press (e.g. Escape, Backspace, Insert, PageDown, Delete, Tab, Enter). Key combinations like `Control+o`, `Control+Shift+T`, `ControlOrMeta+a` are supported. Note: This does NOT support sequences - to press multiple keys in sequence (e.g., Control+A then Backspace), call this action multiple times.")});function Oc(a,t){a.register({name:"press",description:"Press a single keyboard key or key combination. Supports combinations like `Control+A` for select all. Does NOT support sequences - call this action multiple times to press keys in sequence.",schema:Cr,async execute(e,s){let{keys:i}=e,{page:r,agentServices:n,actionDescription:o}=s;try{let c={action_description:o||`Press keys "${i}"`,action_data:{action_name:"press",kwargs:{keys:i}}};return await t.execute(r,c,n),{success:!0,actionEntity:c,message:`Pressed keys "${i}"`}}catch(c){return{success:!1,error:c.message,actionEntity:{action_description:(o||`Press keys "${i}"`)+" (failed)",action_data:{action_name:"press",kwargs:{keys:i}},feedback:c.message}}}}})}import{z as ti}from"zod";var si=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.page_id??s.kwargs.index;if(i===void 0&&(i=a.context().pages().indexOf(a)),typeof i=="number"){if(i===0)throw new Error("Cannot close the first tab (page_id 0). Skipping close_tab action.");e&&await e.closeTab(i)}else throw new Error("Missing page_id for close_tab action")}transpile(a){let t=a.action_data?.kwargs?.page_id;return t=t??a.action_data?.kwargs?.index,['await agent.execAction("close_tab", page, {',` action_data: { kwargs: { page_id: ${t} } },`,"});"]}},vr=ti.object({index:ti.number().int().nonnegative().optional().describe("Index of the tab to close (0-based). Defaults to current tab if not specified.")});function Bc(a,t){a.register({name:"close_tab",description:"Close a browser tab by index. If no index is specified, closes the current tab.",schema:vr,async execute(e,s){let{index:i}=e,{page:r,agentServices:n,actionDescription:o}=s;try{let c={action_description:o||`Close tab ${i}`,action_data:{action_name:"close_tab",kwargs:{page_id:i}}};return await t.execute(r,c,n),{success:!0,actionEntity:c,message:`Closed tab ${i}`}}catch(c){return{success:!1,error:c.message,actionEntity:{action_description:(o||"Close tab")+" (failed)",action_data:{action_name:"close_tab",kwargs:{}},feedback:c.message}}}}})}import{z as We}from"zod";var ii=class{async execute(a,t){}transpile(a){return["// Done - no action needed"]}},Nr=We.object({success:We.boolean().describe("Whether the task was completed successfully"),summary:We.string().describe("Summary of what was accomplished or why it failed")});function zc(a,t){a.register({name:"done",description:"Mark the current task as complete. Use when you have finished all requested actions.",schema:Nr,async execute(e,s){let{page:i,agentServices:r}=s;try{let n={action_description:"Task completed",action_data:{action_name:"done",kwargs:{}}};return await t.execute(i,n,r),{success:!0,actionEntity:n,message:"Task marked as complete"}}catch(n){return{success:!1,error:n.message,actionEntity:{action_description:"Task completed (failed)",action_data:{action_name:"done",kwargs:{}},feedback:n.message}}}}})}import{z as ri}from"zod";A();var Xe=class{async execute(a,t,e){let s=N(a,t),i=E(e);if(s)await s.dblclick({timeout:i});else throw new Error("No locator found for double_click action")}transpile(a){let t=[];return a.locator?t.push(`locator: ${JSON.stringify(a.locator)}`):a.xpath&&t.push(`xpath: ${JSON.stringify(a.xpath)}`),a.frame_path&&a.frame_path.length>0&&t.push(`frame_path: ${JSON.stringify(a.frame_path)}`),t.length===0?['await agent.execAction("double_click", page, {});']:['await agent.execAction("double_click", page, {',...t.map(e=>` ${e},`),"});"]}};async function _r(a,t,e,s,i={}){return{...await O(s,e),action_description:t,action_data:{action_name:a,kwargs:{...i}}}}function ai(a,t,e){return{action_description:`${a} (failed - element not found)`,action_data:{action_name:t,kwargs:e},feedback:"Element not found in DOM"}}var Lr=ri.object({element_index:ri.number().int().describe("Index of the element to double-click")});function Wc(a,t){a.register({name:"double_click",description:"Double-click an interactive element.",schema:Lr,usesElementIndex:!0,async execute(e,s){let{element_index:i}=e,{page:r,agentServices:n,actionDescription:o}=s;try{let c=await D(s,i);if(!c)return{success:!1,error:`Element with index ${i} not found.`,actionEntity:ai(`Double-click element ${i}`,"double_click",{index:i})};let l=o||`Double-click element ${i}`,h=await _r("double_click",l,c,r);return await t.execute(r,h,n),{success:!0,actionEntity:h,message:`Double-clicked element ${i}`}}catch(c){return{success:!1,error:c.message,actionEntity:ai(`Double-click element ${i}`,"double_click",{index:i})}}}})}import{z as ni}from"zod";var oi=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.otp_secret_key;if(!i)throw new Error("Missing otp_secret_key for generate_2fa_code");let r=e.replaceVariables(String(i)),n=await e.generate2faCode(r);e.saveVariable("otp_code",n)}transpile(a){let t=a.action_data?.kwargs?.otp_secret_key||"";return['await agent.execAction("generate_2fa_code", page, {',` action_data: { kwargs: { otp_secret_key: ${JSON.stringify(t)} } },`,"});"]}},Dr=ni.object({otp_secret_key:ni.string().describe("The OTP secret key to generate the 2FA code from")});function Qc(a,t){a.register({name:"generate_2fa_code",description:'Generate a 2FA code from an OTP secret key. The code is saved to the "otp_code" variable. To use the otp_code, you must use `$otp_code` to access it.',schema:Dr,async execute(e,s){let{otp_secret_key:i}=e,{page:r,agentServices:n}=s;try{let o={action_description:"Generate 2FA code",action_data:{action_name:"generate_2fa_code",kwargs:{otp_secret_key:i}}};return await t.execute(r,o,n),{success:!0,actionEntity:o,message:'Generated 2FA code and saved to variable "otp_code"'}}catch(o){return{success:!1,error:o.message,actionEntity:{action_description:"Generate 2FA code (failed)",action_data:{action_name:"generate_2fa_code",kwargs:{otp_secret_key:i}},feedback:o.message}}}}})}var Bi=Wi($i(),1);function Ri(a){if(!a.trim())return!1;try{return(0,Bi.parse)(a,{sourceType:"module",plugins:["typescript"]}),!0}catch{return!1}}import{z as Ui}from"zod";import*as Qa from"playwright/test";import{default as Za}from"playwright/test";var Lt={};ps(Lt,{default:()=>Za});ds(Lt,Qa);var Le=class{async execute(a,t,e){let s=t.action_data?.kwargs;if(s?.code){await this.executeJSAssertion(a,s.code,e);return}let i=s?.statement||t.action_description;if(!i)throw new Error("Missing statement or code for verify action");let{evaluateStatement:r}=await import("./agentHelpers-5J4TWLQS.js"),n=await r(i,a,e,{useCleanScreenshotForAssertion:!0}),o=n.explanation||n.error||(n.success?`Assertion passed: ${i}`:"Assertion failed");if(e.addNote(o),!n.success)throw new Error(n.error||n.explanation||"Assertion failed")}async executeJSAssertion(a,t,e){try{await new Function("page","expect","agentServices",`
26
+ Use the exact text string in select_dropdown_option`,e.addNote(i)}else e.addNote("No options found in any frame for dropdown")}transpile(a){let t=[];return a.xpath&&t.push(`xpath: ${JSON.stringify(a.xpath)}`),a.frame_path&&a.frame_path.length>0&&t.push(`frame_path: ${JSON.stringify(a.frame_path)}`),t.length===0?['await agent.execAction("get_dropdown_options", page, {});']:['await agent.execAction("get_dropdown_options", page, {',...t.map(e=>` ${e},`),"});"]}};async function wr(a,t,e){return{...await O(t,a),action_description:e||"Get dropdown options",action_data:{action_name:"get_dropdown_options",kwargs:{}}}}function Ws(a,t){return{action_description:`${a} (failed - element not found)`,action_data:{action_name:"get_dropdown_options",kwargs:t},feedback:"Element not found in DOM"}}var Pr=Ks.object({element_index:Ks.number().int().describe("Index of the dropdown/select element")});function cc(a,t){a.register({name:"get_dropdown_options",description:"Get all options from a native dropdown",schema:Pr,usesElementIndex:!0,async execute(e,s){let{element_index:i}=e,{page:r,agentServices:n,actionDescription:o}=s;try{let c=await D(s,i);if(!c)return{success:!1,error:`Dropdown element with index ${i} not found`,actionEntity:Ws(o||`Get options from dropdown ${i}`,{index:i})};let l=await wr(c,r,o);return await t.execute(r,l,n),{success:!0,actionEntity:l,message:l.feedback||"No options found"}}catch(c){return{success:!1,error:c.message,actionEntity:Ws(o||`Get options from dropdown ${i}`,{index:i})}}}})}import{z as br}from"zod";A();var Gs=class{async execute(a,t){await a.goBack({timeout:J}),await a.waitForLoadState("load",{timeout:J}),await a.waitForTimeout(1e3)}transpile(a){return['await agent.execAction("go_back", page, {});']}},Tr=br.object({});function dc(a,t){a.register({name:"go_back",description:"Navigate back to the previous page in browser history.",schema:Tr,async execute(e,s){let{page:i,agentServices:r,actionDescription:n}=s;try{let o={action_description:n||"Go back",action_data:{action_name:"go_back",kwargs:{}}};return await t.execute(i,o,r),{success:!0,actionEntity:o,message:"Navigated back"}}catch(o){return{success:!1,error:o.message,actionEntity:{action_description:(n||"Go back")+" (failed)",action_data:{action_name:"go_back",kwargs:{}},feedback:o.message}}}}})}import{z as Te}from"zod";A();var Ve=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.url;if(!i)throw new Error("Missing URL for go_to_url action");let r=s.kwargs.new_tab===!0,n=e.replaceVariables(String(i)),o=s.kwargs.timeout_seconds?s.kwargs.timeout_seconds*1e3:J,c=a;r&&(c=await a.context().newPage(),e.setPage(c)),await c.goto(n,{timeout:o})}transpile(a){let t=a.action_data?.kwargs?.url||"",e=a.action_data?.kwargs?.new_tab===!0,s=a.action_data?.kwargs?.timeout_seconds,i=[`url: ${JSON.stringify(t)}`];return e&&i.push("new_tab: true"),s&&i.push(`timeout_seconds: ${s}`),['await agent.execAction("go_to_url", page, {',` action_data: { kwargs: { ${i.join(", ")} } },`,"});"]}},Ar=Te.object({url:Te.string().describe("URL to navigate to (must be a valid HTTP/HTTPS URL)"),new_tab:Te.boolean().optional().describe("If true, open the URL in a new tab instead of the current page. Default is false."),timeout_seconds:Te.number().positive().optional().describe("Navigation timeout in seconds. Default is 20 seconds.")});function gc(a,t){a.register({name:"go_to_url",description:"Navigate to a specific URL. Use this to visit web pages. Set new_tab=true to open in a new tab.",schema:Ar,async execute(e,s){let{url:i,new_tab:r,timeout_seconds:n}=e,{page:o,agentServices:c,actionDescription:l}=s,h={url:i,new_tab:r??!1};n!==void 0&&(h.timeout_seconds=n);let p=n?` (timeout: ${n}s)`:"";try{let d=r?`Open ${i} in new tab`:`Navigate to ${i}`,f={action_description:l||d,action_data:{action_name:"go_to_url",kwargs:h}};return await t.execute(o,f,c),{success:!0,actionEntity:f,message:(r?`Opened ${i} in new tab`:`Navigated to ${i}`)+p}}catch(d){let f=r?`Open ${i} in new tab`:`Navigate to ${i}`;return{success:!1,error:d.message,actionEntity:{action_description:(l||f)+" (failed)",action_data:{action_name:"go_to_url",kwargs:h},feedback:d.message}}}}})}import{z as Ys}from"zod";A();var qe=class{async execute(a,t,e){let s=N(a,t),i=E(e);if(s){await s.waitFor({state:"attached",timeout:i});let r=await s.elementHandle();if(!r)throw new Error("Unable to obtain element handle for hover action");let n=await r.boundingBox();if(!n)throw new Error("Unable to determine bounding box for hover action");let o=n.x+n.width/2,c=n.y+n.height/2;await a.mouse.move(o,c)}else throw new Error("No locator found for hover action")}transpile(a){let t=[];return a.locator?t.push(`locator: ${JSON.stringify(a.locator)}`):a.xpath&&t.push(`xpath: ${JSON.stringify(a.xpath)}`),a.frame_path&&a.frame_path.length>0&&t.push(`frame_path: ${JSON.stringify(a.frame_path)}`),t.length===0?['await agent.execAction("hover", page, {});']:['await agent.execAction("hover", page, {',...t.map(e=>` ${e},`),"});"]}};async function Sr(a,t,e,s,i={}){return{...await O(s,e),action_description:t,action_data:{action_name:a,kwargs:{...i}}}}function Qs(a,t,e){return{action_description:`${a} (failed - element not found)`,action_data:{action_name:t,kwargs:e},feedback:"Element not found in DOM"}}var kr=Ys.object({element_index:Ys.number().int().describe("Index of the element to hover over")});function Sc(a,t){a.register({name:"hover",description:"Hover over an interactive element.",schema:kr,usesElementIndex:!0,async execute(e,s){let{element_index:i}=e,{page:r,agentServices:n,actionDescription:o}=s;try{let c=await D(s,i);if(!c)return{success:!1,error:`Element with index ${i} not found.`,actionEntity:Qs(`Hover element ${i}`,"hover",{index:i})};let l=o||`Hover over element ${i}`,h=await Sr("hover",l,c,r);return await t.execute(r,h,n),{success:!0,actionEntity:h,message:`Hovered over element ${i}`}}catch(c){return{success:!1,error:c.message,actionEntity:Qs(`Hover element ${i}`,"hover",{index:i})}}}})}import{z as Je}from"zod";A();var He=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.text??s.kwargs.value??"",r=e.replaceVariables(String(i)),n=N(a,t),o=E(e);if(n){await n.evaluate(l=>{l.value&&(l.value="")},null,{timeout:o}),await n.click({timeout:o}),await a.waitForTimeout(200);let c=e.getActionSettings().type_delay;c!==void 0?await a.keyboard.type(r,{delay:c}):await a.keyboard.type(r)}else throw new Error("No locator found for input_text action")}transpile(a){let t=a.action_data?.kwargs?.text??a.action_data?.kwargs?.value??"",e=[];return e.push(`action_data: { kwargs: { text: ${JSON.stringify(t)} } }`),a.locator?e.push(`locator: ${JSON.stringify(a.locator)}`):a.xpath&&e.push(`xpath: ${JSON.stringify(a.xpath)}`),a.frame_path&&a.frame_path.length>0&&e.push(`frame_path: ${JSON.stringify(a.frame_path)}`),['await agent.execAction("input_text", page, {',...e.map(s=>` ${s},`),"});"]}};async function Er(a,t,e,s,i={}){return{...await O(s,e),action_description:t,action_data:{action_name:a,kwargs:{...i}}}}function Zs(a,t,e){return{action_description:`${a} (failed - element not found)`,action_data:{action_name:t,kwargs:e},feedback:"Element not found in DOM"}}var Ir=Je.object({element_index:Je.number().int().describe("Index of the input element"),text:Je.string().describe("Text to type into the input. To use a placeholder, write {{ placeholder_name }} using exact placeholder name. Use clear_input first if you want to replace existing content.")});function Nc(a,t){a.register({name:"input_text",description:"Type text into an input field. To replace existing content, use clear_input first.",schema:Ir,usesElementIndex:!0,async execute(e,s){let{element_index:i,text:r}=e,{page:n,agentServices:o,actionDescription:c}=s;try{let l=await D(s,i);if(!l)return{success:!1,error:`Input element with index ${i} not found`,actionEntity:Zs(c||`Input text to element ${i}`,"input_text",{index:i,text:r})};let h=c||`Input text to element ${i}`,p=await Er("input_text",h,l,n,{text:r});return await t.execute(n,p,o),{success:!0,actionEntity:p,message:`Input text to element ${i}`}}catch(l){return{success:!1,error:l.message,actionEntity:Zs(`Input text to element ${i}`,"input_text",{index:i,text:r})}}}})}import{z as ei}from"zod";var Ke=class{async execute(a,t){let e=t.action_data;if(!e)throw new Error("Action data not found");let s=e.kwargs.keys;if(!s||typeof s!="string")throw new Error("Missing or invalid keys for press action");await a.keyboard.press(s),await a.waitForTimeout(500)}transpile(a){let t=a.action_data?.kwargs?.keys;return[`await page.keyboard.press(${JSON.stringify(t)});`]}},Cr=ei.object({keys:ei.string().describe("A single key or key combination to press (e.g. Escape, Backspace, Insert, PageDown, Delete, Tab, Enter). Key combinations like `Control+o`, `Control+Shift+T`, `ControlOrMeta+a` are supported. Note: This does NOT support sequences - to press multiple keys in sequence (e.g., Control+A then Backspace), call this action multiple times.")});function Oc(a,t){a.register({name:"press",description:"Press a single keyboard key or key combination. Supports combinations like `Control+A` for select all. Does NOT support sequences - call this action multiple times to press keys in sequence.",schema:Cr,async execute(e,s){let{keys:i}=e,{page:r,agentServices:n,actionDescription:o}=s;try{let c={action_description:o||`Press keys "${i}"`,action_data:{action_name:"press",kwargs:{keys:i}}};return await t.execute(r,c,n),{success:!0,actionEntity:c,message:`Pressed keys "${i}"`}}catch(c){return{success:!1,error:c.message,actionEntity:{action_description:(o||`Press keys "${i}"`)+" (failed)",action_data:{action_name:"press",kwargs:{keys:i}},feedback:c.message}}}}})}import{z as ti}from"zod";var si=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.page_id??s.kwargs.index;if(i===void 0&&(i=a.context().pages().indexOf(a)),typeof i=="number"){if(i===0)throw new Error("Cannot close the first tab (page_id 0). Skipping close_tab action.");e&&await e.closeTab(i)}else throw new Error("Missing page_id for close_tab action")}transpile(a){let t=a.action_data?.kwargs?.page_id;return t=t??a.action_data?.kwargs?.index,['await agent.execAction("close_tab", page, {',` action_data: { kwargs: { page_id: ${t} } },`,"});"]}},vr=ti.object({index:ti.number().int().nonnegative().optional().describe("Index of the tab to close (0-based). Defaults to current tab if not specified.")});function Bc(a,t){a.register({name:"close_tab",description:"Close a browser tab by index. If no index is specified, closes the current tab.",schema:vr,async execute(e,s){let{index:i}=e,{page:r,agentServices:n,actionDescription:o}=s;try{let c={action_description:o||`Close tab ${i}`,action_data:{action_name:"close_tab",kwargs:{page_id:i}}};return await t.execute(r,c,n),{success:!0,actionEntity:c,message:`Closed tab ${i}`}}catch(c){return{success:!1,error:c.message,actionEntity:{action_description:(o||"Close tab")+" (failed)",action_data:{action_name:"close_tab",kwargs:{}},feedback:c.message}}}}})}import{z as We}from"zod";var ii=class{async execute(a,t){}transpile(a){return["// Done - no action needed"]}},Nr=We.object({success:We.boolean().describe("Whether the task was completed successfully"),summary:We.string().describe("Summary of what was accomplished or why it failed")});function zc(a,t){a.register({name:"done",description:"Mark the current task as complete. Use when you have finished all requested actions.",schema:Nr,async execute(e,s){let{page:i,agentServices:r}=s;try{let n={action_description:"Task completed",action_data:{action_name:"done",kwargs:{}}};return await t.execute(i,n,r),{success:!0,actionEntity:n,message:"Task marked as complete"}}catch(n){return{success:!1,error:n.message,actionEntity:{action_description:"Task completed (failed)",action_data:{action_name:"done",kwargs:{}},feedback:n.message}}}}})}import{z as ri}from"zod";A();var Xe=class{async execute(a,t,e){let s=N(a,t),i=E(e);if(s)await s.dblclick({timeout:i});else throw new Error("No locator found for double_click action")}transpile(a){let t=[];return a.locator?t.push(`locator: ${JSON.stringify(a.locator)}`):a.xpath&&t.push(`xpath: ${JSON.stringify(a.xpath)}`),a.frame_path&&a.frame_path.length>0&&t.push(`frame_path: ${JSON.stringify(a.frame_path)}`),t.length===0?['await agent.execAction("double_click", page, {});']:['await agent.execAction("double_click", page, {',...t.map(e=>` ${e},`),"});"]}};async function _r(a,t,e,s,i={}){return{...await O(s,e),action_description:t,action_data:{action_name:a,kwargs:{...i}}}}function ai(a,t,e){return{action_description:`${a} (failed - element not found)`,action_data:{action_name:t,kwargs:e},feedback:"Element not found in DOM"}}var Lr=ri.object({element_index:ri.number().int().describe("Index of the element to double-click")});function Wc(a,t){a.register({name:"double_click",description:"Double-click an interactive element.",schema:Lr,usesElementIndex:!0,async execute(e,s){let{element_index:i}=e,{page:r,agentServices:n,actionDescription:o}=s;try{let c=await D(s,i);if(!c)return{success:!1,error:`Element with index ${i} not found.`,actionEntity:ai(`Double-click element ${i}`,"double_click",{index:i})};let l=o||`Double-click element ${i}`,h=await _r("double_click",l,c,r);return await t.execute(r,h,n),{success:!0,actionEntity:h,message:`Double-clicked element ${i}`}}catch(c){return{success:!1,error:c.message,actionEntity:ai(`Double-click element ${i}`,"double_click",{index:i})}}}})}import{z as ni}from"zod";var oi=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.otp_secret_key;if(!i)throw new Error("Missing otp_secret_key for generate_2fa_code");let r=e.replaceVariables(String(i)),n=await e.generate2faCode(r);e.saveVariable("otp_code",n)}transpile(a){let t=a.action_data?.kwargs?.otp_secret_key||"";return['await agent.execAction("generate_2fa_code", page, {',` action_data: { kwargs: { otp_secret_key: ${JSON.stringify(t)} } },`,"});"]}},Dr=ni.object({otp_secret_key:ni.string().describe("The OTP secret key to generate the 2FA code from")});function Qc(a,t){a.register({name:"generate_2fa_code",description:'Generate a 2FA code from an OTP secret key. The code is saved to the "otp_code" variable. To use the otp_code, you must use `$otp_code` to access it.',schema:Dr,async execute(e,s){let{otp_secret_key:i}=e,{page:r,agentServices:n}=s;try{let o={action_description:"Generate 2FA code",action_data:{action_name:"generate_2fa_code",kwargs:{otp_secret_key:i}}};return await t.execute(r,o,n),{success:!0,actionEntity:o,message:'Generated 2FA code and saved to variable "otp_code"'}}catch(o){return{success:!1,error:o.message,actionEntity:{action_description:"Generate 2FA code (failed)",action_data:{action_name:"generate_2fa_code",kwargs:{otp_secret_key:i}},feedback:o.message}}}}})}var Bi=Wi($i(),1);function Ri(a){if(!a.trim())return!1;try{return(0,Bi.parse)(a,{sourceType:"module",plugins:["typescript"]}),!0}catch{return!1}}import{z as Ui}from"zod";import*as Qa from"playwright/test";import{default as Za}from"playwright/test";var Lt={};ps(Lt,{default:()=>Za});ds(Lt,Qa);var Le=class{async execute(a,t,e){let s=t.action_data?.kwargs;if(s?.code){await this.executeJSAssertion(a,s.code,e);return}let i=s?.statement||t.action_description;if(!i)throw new Error("Missing statement or code for verify action");let{evaluateStatement:r}=await import("./agentHelpers-MOO2YPML.js"),n=await r(i,a,e,{useCleanScreenshotForAssertion:!0}),o=n.explanation||n.error||(n.success?`Assertion passed: ${i}`:"Assertion failed");if(e.addNote(o),!n.success)throw new Error(n.error||n.explanation||"Assertion failed")}async executeJSAssertion(a,t,e){try{await new Function("page","expect","agentServices",`
27
27
  return (async () => {
28
28
  ${t}
29
29
  })();
30
30
  `)(a,Lt.expect,e)}catch(s){throw new Error(`Assertion failed: ${s.message}`)}}transpile(a,t){let e=a.action_data?.kwargs;if(e?.code){let i=e.code;return Ri(i)?i.split(`
31
- `):[`throw new Error("Invalid assertion code syntax: " + ${JSON.stringify(i)});`]}let s=e?.statement||a.action_description;return s?[`await agent.assert(page, ${JSON.stringify(s)}, '${t||""}');`]:["// Skipping verify: missing statement or code"]}},en=Ui.object({statement:Ui.string().describe('The nature language statement to verify (e.g., "The login was successful")')});function dl(a,t){a.register({name:"verify",description:"Verify that a statement is true based on the current page state. Use this to check assertions about the page content, element visibility, or any condition.",schema:en,async execute(e,s){let{statement:i}=e,{page:r,agentServices:n}=s;try{let o={action_description:`${i}`,action_data:{action_name:"verify",kwargs:{statement:i}}};return await t.execute(r,o,n),{success:!0,actionEntity:o,message:`Assertion verified: ${i}`}}catch(o){return{success:!1,error:o.message,actionEntity:{action_description:`Verify: ${i} (failed)`,action_data:{action_name:"verify",kwargs:{statement:i}},feedback:o.message}}}},availability:{openai:!0,mcp:!0}})}import{z as Dt}from"zod";var ji=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.element_description,r=s.kwargs.variable_name;if(!i||!r)throw new Error("Missing element_description or variable_name for ai_extract");let n=`Extract ${i} and save to ${r}`,{executeStep:o}=await import("./agentHelpers-5J4TWLQS.js"),c=await o(n,a,e);if(c.status!=="success")throw new Error(c.error||"Extraction failed")}transpile(a,t){let e=a.action_data?.kwargs?.element_description,s=a.action_data?.kwargs?.variable_name;if(!e||!s)return["// Skipping ai_extract: missing element_description or variable_name"];let i=JSON.stringify(e),r=JSON.stringify(s);return[`await agent.extract(page, ${i}, ${r}, '${t||""}');`]}},tn=Dt.object({element_description:Dt.string().describe('Description of the element to extract (e.g., "the price of the product")'),variable_name:Dt.string().describe("Name of the variable to store the extracted value")});function xl(a,t){a.register({name:"ai_extract",description:"Use AI to extract information from the page and save it to a variable. MCP-only tool.",schema:tn,async execute(e,s){let{element_description:i,variable_name:r}=e,{page:n,agentServices:o}=s;try{let c={action_description:`Extract ${i} to ${r}`,action_data:{action_name:"ai_extract",kwargs:{element_description:i,variable_name:r}}};return await t.execute(n,c,o),{success:!0,actionEntity:c,message:`Extracted ${i} to ${r}`}}catch(c){return{success:!1,error:c.message,actionEntity:{action_description:`Extract ${i} (failed)`,action_data:{action_name:"ai_extract",kwargs:{element_description:i,variable_name:r}},feedback:c.message}}}},availability:{openai:!1,mcp:!0}})}import{z as zi}from"zod";A();var qi=class{async execute(a,t,e){let s=N(a,t),i=E(e);if(s)await s.click({timeout:i}),await a.keyboard.press("ControlOrMeta+a"),await a.waitForTimeout(200),await a.keyboard.press("Backspace"),await a.waitForTimeout(200);else throw new Error("No locator found for clear_input action")}transpile(a){let t=[];return a.locator?t.push(`locator: ${JSON.stringify(a.locator)}`):a.xpath&&t.push(`xpath: ${JSON.stringify(a.xpath)}`),a.frame_path&&a.frame_path.length>0&&t.push(`frame_path: ${JSON.stringify(a.frame_path)}`),t.length===0?['await agent.execAction("clear_input", page, {});']:['await agent.execAction("clear_input", page, {',...t.map(e=>` ${e},`),"});"]}};async function sn(a,t,e,s,i={}){return{...await O(s,e),action_description:t,action_data:{action_name:a,kwargs:{...i}}}}function Vi(a,t,e){return{action_description:`${a} (failed - element not found)`,action_data:{action_name:t,kwargs:e},feedback:"Element not found in DOM"}}var rn=zi.object({element_index:zi.number().int().describe("Index of the input element to clear")});function Al(a,t){a.register({name:"clear_input",description:"Clear the contents of an input field, textarea, or other editable element.",schema:rn,usesElementIndex:!0,async execute(e,s){let{element_index:i}=e,{page:r,agentServices:n,actionDescription:o}=s;try{let c=await D(s,i);if(!c)return{success:!1,error:`Input element with index ${i} not found`,actionEntity:Vi(o||`Clear element ${i}`,"clear_input",{index:i})};let l=o||`Clear element ${i}`,h=await sn("clear_input",l,c,r);return await t.execute(r,h,n),{success:!0,actionEntity:h,message:`Cleared element ${i}`}}catch(c){return{success:!1,error:c.message,actionEntity:Vi(`Clear element ${i}`,"clear_input",{index:i})}}}})}import{z as Ji}from"zod";A();var De=class{async execute(a,t,e){let s=N(a,t),i=E(e);if(s){await s.click({timeout:i});try{await a.waitForTimeout(1e3)}catch{}}else throw new Error("No locator found for click action")}transpile(a){let t=te(a);if(!t)return['await agent.execAction("click", page, {});'];let e=E();return[`await ${t}.click({ timeout: ${e} });`]}};async function an(a,t,e,s,i={}){return{...await O(s,e),action_description:t,action_data:{action_name:a,kwargs:{...i}}}}function Hi(a,t,e){return{action_description:`${a} (failed - element not found)`,action_data:{action_name:t,kwargs:e},feedback:"Element not found in DOM"}}var nn=Ji.object({element_index:Ji.number().int().describe("Index of the element to click (0-based). Return -1 if no element found")});function vl(a,t){a.register({name:"click",description:"Click an interactive element.",schema:nn,usesElementIndex:!0,async execute(e,s){let{element_index:i}=e,{page:r,agentServices:n,actionDescription:o}=s;try{let c=await D(s,i);if(!c)return{success:!1,error:`Element with index ${i} not found.`,actionEntity:Hi(`Click element ${i}`,"click",{index:i})};let l=o||`Click element ${i}`,h=await an("click",l,c,r);return await t.execute(r,h,n),{success:!0,actionEntity:h,message:`Clicked element ${i}`}}catch(c){return{success:!1,error:c.message,actionEntity:Hi(`Click element ${i}`,"click",{index:i})}}}})}var on=["ai_action","ai_step","ai_assert","ai_extract","ai_wait_until","verify","assert"],cn=["js_code","function","wait","wait_for_download_complete","wait_for_page_ready","extract_email_content","extract_activation_code"],Ot=class{static isAiAction(a){let t=a.action_data?.action_name;return!t||(t==="verify"||t==="ai_assert"||t==="assert")&&a.action_data?.kwargs?.code?!1:on.includes(t)}static getAiStatement(a){let t=a.action_data?.action_name;if(!t)return null;let e=a.action_data?.kwargs||{};switch(t){case"ai_action":case"ai_step":return e.statement||null;case"verify":case"ai_assert":case"assert":return e.statement||a.action_description||null;case"ai_extract":let s=e.element_description,i=e.variable_name;return s&&i?`Extract ${s} and save to ${i}`:null;case"ai_wait_until":return e.condition||null;default:return null}}static canSelfHeal(a){let t=a.action_data?.action_name;return!t||(t==="verify"||t==="ai_assert"||t==="assert")&&a.action_data?.kwargs?.code?!1:!cn.includes(t)}};var Mt=class w{static registerAction(t,e){w.actions.set(t,e)}constructor(){w.initialized||(this.registerBuiltinActions(),w.initialized=!0)}registerBuiltinActions(){w.registerAction("go_to_url",new Ve),w.registerAction("go_back",new Gs),w.registerAction("reload_page",new $s),w.registerAction("close_tab",new si),w.registerAction("switch_tab",new vs),w.registerAction("click",new De),w.registerAction("hover",new qe),w.registerAction("right_click",new Re),w.registerAction("double_click",new Xe),w.registerAction("click_by_coordinates",new ws),w.registerAction("right_click_by_coordinates",new ys),w.registerAction("double_click_by_coordinates",new Ps),w.registerAction("drag_drop",new bs),w.registerAction("input_text",new He),w.registerAction("clear_input",new qi),w.registerAction("press",new Ke),w.registerAction("send_keys_on_element",new fs),w.registerAction("scroll_on_element",new zs),w.registerAction("scroll_to_text",new qs),w.registerAction("scroll",new le),w.registerAction("upload_file",new _s),w.registerAction("wait_for_download_complete",new Ms),w.registerAction("get_dropdown_options",new Xs),w.registerAction("select_dropdown_option",new Hs),w.registerAction("set_date_for_native_date_picker",new Is),w.registerAction("verify",new Le),w.registerAction("ai_action",new Ss),w.registerAction("ai_extract",new ji),w.registerAction("ai_step",new Es),w.registerAction("ai_wait_until",new Fs),w.registerAction("generate_2fa_code",new oi),w.registerAction("wait",new Ds),w.registerAction("wait_for_page_ready",new ms),w.registerAction("save_variable",new Us),w.registerAction("js_code",new gs),w.registerAction("function",new Ts),w.registerAction("done",new ii),w.registerAction("click_element",new De),w.registerAction("click_element_by_index",new De),w.registerAction("hover_element_by_index",new qe),w.registerAction("right_click_on_element",new Re),w.registerAction("double_click_on_element",new Xe),w.registerAction("scroll_down",new le),w.registerAction("scroll_up",new le),w.registerAction("scroll_element",new le),w.registerAction("send_keys",new Ke),w.registerAction("open_tab",new Ve),w.registerAction("fill",new He),w.registerAction("ai_assert",new Le),w.registerAction("assert",new Le)}getAction(t){return w.actions.get(t)}hasAction(t){return w.actions.has(t)}getActionNames(){return Array.from(w.actions.keys())}async execute(t,e,s){if(!s)throw new Error("AgentServices not found");let i=e.action_data?.action_name;if(!i)throw new Error("Action name not found in action_data");let r=this.getAction(i);if(!r)throw new Error(`Unknown action: ${i}`);await r.execute(t,e,s)}transpile(t,e,s){let{sanitizeForComment:i}=(A(),Oe(Me)),r=t.action_description||"",n=t.action_data?.action_name||"",o=this.getAction(n);if(!o)return[`// ${e}: Unknown action: ${n}`];let c=o.transpile(t,e);if(Ot.isAiAction(t))return[`// ${e}: ${i(r)}`,"page = agent.agentServices.validatePage(page);",...c];let l=JSON.stringify(r),h=c.map(f=>` ${f}`),p=Ot.canSelfHeal(t),d=s?`'${s}'`:"undefined";return[`// ${e}: ${i(r)}`,"page = agent.agentServices.validatePage(page);","await agent.step(page, async () => {",...h,`}, ${l}, '${e}', ${d}, ${p});`]}transpileUncachedAction(t,e,s=!1,i=!1){let{sanitizeForComment:r}=(A(),Oe(Me));if(!t)return[`// ${e}: Skipping - no description`];let n=JSON.stringify(t);return i?[`// ${e}: ${r(t)}`,"page = agent.agentServices.validatePage(page);",`await agent.run(page, ${n}, '${e}');`]:[`// ${e}: ${r(t)}`,"page = agent.agentServices.validatePage(page);",`await agent.execute(page, ${n}, '${e}', ${s});`]}};Mt.actions=new Map,Mt.initialized=!1;var ln=Mt,Ph=ln;export{Hn as a,Gn as b,so as c,co as d,fo as e,go as f,To as g,Io as h,Do as i,$o as j,jo as k,Ko as l,Yo as m,ic as n,cc as o,dc as p,gc as q,Sc as r,Nc as s,Oc as t,Bc as u,zc as v,Wc as w,Qc as x,dl as y,xl as z,Al as A,vl as B,Ot as C,ln as D,Ph as E};
31
+ `):[`throw new Error("Invalid assertion code syntax: " + ${JSON.stringify(i)});`]}let s=e?.statement||a.action_description;return s?[`await agent.assert(page, ${JSON.stringify(s)}, '${t||""}');`]:["// Skipping verify: missing statement or code"]}},en=Ui.object({statement:Ui.string().describe('The nature language statement to verify (e.g., "The login was successful")')});function dl(a,t){a.register({name:"verify",description:"Verify that a statement is true based on the current page state. Use this to check assertions about the page content, element visibility, or any condition.",schema:en,async execute(e,s){let{statement:i}=e,{page:r,agentServices:n}=s;try{let o={action_description:`${i}`,action_data:{action_name:"verify",kwargs:{statement:i}}};return await t.execute(r,o,n),{success:!0,actionEntity:o,message:`Assertion verified: ${i}`}}catch(o){return{success:!1,error:o.message,actionEntity:{action_description:`Verify: ${i} (failed)`,action_data:{action_name:"verify",kwargs:{statement:i}},feedback:o.message}}}},availability:{openai:!0,mcp:!0}})}import{z as Dt}from"zod";var ji=class{async execute(a,t,e){let s=t.action_data;if(!s)throw new Error("Action data not found");let i=s.kwargs.element_description,r=s.kwargs.variable_name;if(!i||!r)throw new Error("Missing element_description or variable_name for ai_extract");let n=`Extract ${i} and save to ${r}`,{executeStep:o}=await import("./agentHelpers-MOO2YPML.js"),c=await o(n,a,e);if(c.status!=="success")throw new Error(c.error||"Extraction failed")}transpile(a,t){let e=a.action_data?.kwargs?.element_description,s=a.action_data?.kwargs?.variable_name;if(!e||!s)return["// Skipping ai_extract: missing element_description or variable_name"];let i=JSON.stringify(e),r=JSON.stringify(s);return[`await agent.extract(page, ${i}, ${r}, '${t||""}');`]}},tn=Dt.object({element_description:Dt.string().describe('Description of the element to extract (e.g., "the price of the product")'),variable_name:Dt.string().describe("Name of the variable to store the extracted value")});function xl(a,t){a.register({name:"ai_extract",description:"Use AI to extract information from the page and save it to a variable. MCP-only tool.",schema:tn,async execute(e,s){let{element_description:i,variable_name:r}=e,{page:n,agentServices:o}=s;try{let c={action_description:`Extract ${i} to ${r}`,action_data:{action_name:"ai_extract",kwargs:{element_description:i,variable_name:r}}};return await t.execute(n,c,o),{success:!0,actionEntity:c,message:`Extracted ${i} to ${r}`}}catch(c){return{success:!1,error:c.message,actionEntity:{action_description:`Extract ${i} (failed)`,action_data:{action_name:"ai_extract",kwargs:{element_description:i,variable_name:r}},feedback:c.message}}}},availability:{openai:!1,mcp:!0}})}import{z as zi}from"zod";A();var qi=class{async execute(a,t,e){let s=N(a,t),i=E(e);if(s)await s.click({timeout:i}),await a.keyboard.press("ControlOrMeta+a"),await a.waitForTimeout(200),await a.keyboard.press("Backspace"),await a.waitForTimeout(200);else throw new Error("No locator found for clear_input action")}transpile(a){let t=[];return a.locator?t.push(`locator: ${JSON.stringify(a.locator)}`):a.xpath&&t.push(`xpath: ${JSON.stringify(a.xpath)}`),a.frame_path&&a.frame_path.length>0&&t.push(`frame_path: ${JSON.stringify(a.frame_path)}`),t.length===0?['await agent.execAction("clear_input", page, {});']:['await agent.execAction("clear_input", page, {',...t.map(e=>` ${e},`),"});"]}};async function sn(a,t,e,s,i={}){return{...await O(s,e),action_description:t,action_data:{action_name:a,kwargs:{...i}}}}function Vi(a,t,e){return{action_description:`${a} (failed - element not found)`,action_data:{action_name:t,kwargs:e},feedback:"Element not found in DOM"}}var rn=zi.object({element_index:zi.number().int().describe("Index of the input element to clear")});function Al(a,t){a.register({name:"clear_input",description:"Clear the contents of an input field, textarea, or other editable element.",schema:rn,usesElementIndex:!0,async execute(e,s){let{element_index:i}=e,{page:r,agentServices:n,actionDescription:o}=s;try{let c=await D(s,i);if(!c)return{success:!1,error:`Input element with index ${i} not found`,actionEntity:Vi(o||`Clear element ${i}`,"clear_input",{index:i})};let l=o||`Clear element ${i}`,h=await sn("clear_input",l,c,r);return await t.execute(r,h,n),{success:!0,actionEntity:h,message:`Cleared element ${i}`}}catch(c){return{success:!1,error:c.message,actionEntity:Vi(`Clear element ${i}`,"clear_input",{index:i})}}}})}import{z as Ji}from"zod";A();var De=class{async execute(a,t,e){let s=N(a,t),i=E(e);if(s){await s.click({timeout:i});try{await a.waitForTimeout(1e3)}catch{}}else throw new Error("No locator found for click action")}transpile(a){let t=te(a);if(!t)return['await agent.execAction("click", page, {});'];let e=E();return[`await ${t}.click({ timeout: ${e} });`]}};async function an(a,t,e,s,i={}){return{...await O(s,e),action_description:t,action_data:{action_name:a,kwargs:{...i}}}}function Hi(a,t,e){return{action_description:`${a} (failed - element not found)`,action_data:{action_name:t,kwargs:e},feedback:"Element not found in DOM"}}var nn=Ji.object({element_index:Ji.number().int().describe("Index of the element to click (0-based). Return -1 if no element found")});function vl(a,t){a.register({name:"click",description:"Click an interactive element.",schema:nn,usesElementIndex:!0,async execute(e,s){let{element_index:i}=e,{page:r,agentServices:n,actionDescription:o}=s;try{let c=await D(s,i);if(!c)return{success:!1,error:`Element with index ${i} not found.`,actionEntity:Hi(`Click element ${i}`,"click",{index:i})};let l=o||`Click element ${i}`,h=await an("click",l,c,r);return await t.execute(r,h,n),{success:!0,actionEntity:h,message:`Clicked element ${i}`}}catch(c){return{success:!1,error:c.message,actionEntity:Hi(`Click element ${i}`,"click",{index:i})}}}})}var on=["ai_action","ai_step","ai_assert","ai_extract","ai_wait_until","verify","assert"],cn=["js_code","function","wait","wait_for_download_complete","wait_for_page_ready","extract_email_content","extract_activation_code"],Ot=class{static isAiAction(a){let t=a.action_data?.action_name;return!t||(t==="verify"||t==="ai_assert"||t==="assert")&&a.action_data?.kwargs?.code?!1:on.includes(t)}static getAiStatement(a){let t=a.action_data?.action_name;if(!t)return null;let e=a.action_data?.kwargs||{};switch(t){case"ai_action":case"ai_step":return e.statement||null;case"verify":case"ai_assert":case"assert":return e.statement||a.action_description||null;case"ai_extract":let s=e.element_description,i=e.variable_name;return s&&i?`Extract ${s} and save to ${i}`:null;case"ai_wait_until":return e.condition||null;default:return null}}static canSelfHeal(a){let t=a.action_data?.action_name;return!t||(t==="verify"||t==="ai_assert"||t==="assert")&&a.action_data?.kwargs?.code?!1:!cn.includes(t)}};var Mt=class w{static registerAction(t,e){w.actions.set(t,e)}constructor(){w.initialized||(this.registerBuiltinActions(),w.initialized=!0)}registerBuiltinActions(){w.registerAction("go_to_url",new Ve),w.registerAction("go_back",new Gs),w.registerAction("reload_page",new $s),w.registerAction("close_tab",new si),w.registerAction("switch_tab",new vs),w.registerAction("click",new De),w.registerAction("hover",new qe),w.registerAction("right_click",new Re),w.registerAction("double_click",new Xe),w.registerAction("click_by_coordinates",new ws),w.registerAction("right_click_by_coordinates",new ys),w.registerAction("double_click_by_coordinates",new Ps),w.registerAction("drag_drop",new bs),w.registerAction("input_text",new He),w.registerAction("clear_input",new qi),w.registerAction("press",new Ke),w.registerAction("send_keys_on_element",new fs),w.registerAction("scroll_on_element",new zs),w.registerAction("scroll_to_text",new qs),w.registerAction("scroll",new le),w.registerAction("upload_file",new _s),w.registerAction("wait_for_download_complete",new Ms),w.registerAction("get_dropdown_options",new Xs),w.registerAction("select_dropdown_option",new Hs),w.registerAction("set_date_for_native_date_picker",new Is),w.registerAction("verify",new Le),w.registerAction("ai_action",new Ss),w.registerAction("ai_extract",new ji),w.registerAction("ai_step",new Es),w.registerAction("ai_wait_until",new Fs),w.registerAction("generate_2fa_code",new oi),w.registerAction("wait",new Ds),w.registerAction("wait_for_page_ready",new ms),w.registerAction("save_variable",new Us),w.registerAction("js_code",new gs),w.registerAction("function",new Ts),w.registerAction("done",new ii),w.registerAction("click_element",new De),w.registerAction("click_element_by_index",new De),w.registerAction("hover_element_by_index",new qe),w.registerAction("right_click_on_element",new Re),w.registerAction("double_click_on_element",new Xe),w.registerAction("scroll_down",new le),w.registerAction("scroll_up",new le),w.registerAction("scroll_element",new le),w.registerAction("send_keys",new Ke),w.registerAction("open_tab",new Ve),w.registerAction("fill",new He),w.registerAction("ai_assert",new Le),w.registerAction("assert",new Le)}getAction(t){return w.actions.get(t)}hasAction(t){return w.actions.has(t)}getActionNames(){return Array.from(w.actions.keys())}async execute(t,e,s){if(!s)throw new Error("AgentServices not found");let i=e.action_data?.action_name;if(!i)throw new Error("Action name not found in action_data");let r=this.getAction(i);if(!r)throw new Error(`Unknown action: ${i}`);await r.execute(t,e,s)}transpile(t,e,s){let{sanitizeForComment:i}=(A(),Oe(Me)),r=t.action_description||"",n=t.action_data?.action_name||"",o=this.getAction(n);if(!o)return[`// ${e}: Unknown action: ${n}`];let c=o.transpile(t,e);if(Ot.isAiAction(t))return[`// ${e}: ${i(r)}`,"page = agent.agentServices.validatePage(page);",...c];let l=JSON.stringify(r),h=c.map(f=>` ${f}`),p=Ot.canSelfHeal(t),d=s?`'${s}'`:"undefined";return[`// ${e}: ${i(r)}`,"page = agent.agentServices.validatePage(page);","await agent.step(page, async () => {",...h,`}, ${l}, '${e}', ${d}, ${p});`]}transpileUncachedAction(t,e,s=!1,i=!1){let{sanitizeForComment:r}=(A(),Oe(Me));if(!t)return[`// ${e}: Skipping - no description`];let n=JSON.stringify(t);return i?[`// ${e}: ${r(t)}`,"page = agent.agentServices.validatePage(page);",`await agent.run(page, ${n}, '${e}');`]:[`// ${e}: ${r(t)}`,"page = agent.agentServices.validatePage(page);",`await agent.execute(page, ${n}, '${e}', ${s});`]}};Mt.actions=new Map,Mt.initialized=!1;var ln=Mt,Ph=ln;export{Hn as a,Gn as b,so as c,co as d,fo as e,go as f,To as g,Io as h,Do as i,$o as j,jo as k,Ko as l,Yo as m,ic as n,cc as o,dc as p,gc as q,Sc as r,Nc as s,Oc as t,Bc as u,zc as v,Wc as w,Qc as x,dl as y,xl as z,Al as A,vl as B,Ot as C,ln as D,Ph as E};