@testsmith/testblocks 0.9.0 → 0.9.1

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.
@@ -833,7 +833,7 @@ Blockly.YourGeneratorName.nameDB_.setVariableMap(workspace.getVariableMap());`),
833
833
  `))this.quarkIds_=k;else{if(k.length!==C.length)throw RangeError("paramNames and paramIds must be the same length.");this.quarkIds_||(this.quarkConnections_={},this.quarkIds_=[]);for(let fe=0;fe<this.arguments_.length;fe++){var z=this.getInput("ARG"+fe);z&&(z=z.connection.targetConnection,this.quarkConnections_[this.quarkIds_[fe]]=z,M&&z&&!k.includes(this.quarkIds_[fe])&&(z.disconnect(),z.getSourceBlock().bumpNeighbours()))}for(this.arguments_=[].concat(C),this.argumentVarModels_=[],C=0;C<this.arguments_.length;C++)M=a.getOrCreateVariablePackage$$module$build$src$core$variables(this.workspace,null,this.arguments_[C],""),this.argumentVarModels_.push(M);if(this.updateShape_(),this.quarkIds_=k){for(k=0;k<this.arguments_.length;k++)if(C=this.quarkIds_[k],C in this.quarkConnections_){let fe;(fe=this.quarkConnections_[C])!=null&&fe.reconnect(this,"ARG"+k)||delete this.quarkConnections_[C]}}}},updateShape_:function(){for(var C=0;C<this.arguments_.length;C++){var k=this.getField("ARGNAME"+C);if(k){a.disable$$module$build$src$core$events$utils();try{k.setValue(this.arguments_[C])}finally{a.enable$$module$build$src$core$events$utils()}}else k=a.fromJson$$module$build$src$core$field_registry({type:"field_label",text:this.arguments_[C]}),this.appendValueInput("ARG"+C).setAlign(a.Align$$module$build$src$core$inputs$align.RIGHT).appendField(k,"ARGNAME"+C)}for(C=this.arguments_.length;this.getInput("ARG"+C);C++)this.removeInput("ARG"+C);(C=this.getInput("TOPROW"))&&(this.arguments_.length?this.getField("WITH")||C.appendField(a.Msg$$module$build$src$core$msg.PROCEDURES_CALL_BEFORE_PARAMS,"WITH"):this.getField("WITH")&&C.removeField("WITH"))},mutationToDom:function(){const C=a.createElement$$module$build$src$core$utils$xml("mutation");C.setAttribute("name",this.getProcedureCall());for(let k=0;k<this.arguments_.length;k++){const M=a.createElement$$module$build$src$core$utils$xml("arg");M.setAttribute("name",this.arguments_[k]),C.appendChild(M)}return C},domToMutation:function(C){var k=C.getAttribute("name");this.renameProcedure(this.getProcedureCall(),k),k=[];const M=[];for(let z=0,fe;fe=C.childNodes[z];z++)fe.nodeName.toLowerCase()==="arg"&&(k.push(fe.getAttribute("name")),M.push(fe.getAttribute("paramId")));this.setProcedureParameters_(k,M)},saveExtraState:function(){const C=Object.create(null);return C.name=this.getProcedureCall(),this.arguments_.length&&(C.params=this.arguments_),C},loadExtraState:function(C){if(this.renameProcedure(this.getProcedureCall(),C.name),C=C.params){const k=[];k.length=C.length,k.fill(null),this.setProcedureParameters_(C,k)}},getVars:function(){return this.arguments_},getVarModels:function(){return this.argumentVarModels_},onchange:function(C){if(this.workspace&&!this.workspace.isFlyout&&C.recordUndo)if(C.type===a.BLOCK_CREATE$$module$build$src$core$events$events&&C.ids.includes(this.id)){var k=this.getProcedureCall(),M=a.getDefinition$$module$build$src$core$procedures(k,this.workspace);if(!M||M.type===this.defType_&&JSON.stringify(M.getVars())===JSON.stringify(this.arguments_)||(M=null),M)M.isEnabled()||(this.setDisabledReason(!0,we),this.setWarningText(a.Msg$$module$build$src$core$msg.PROCEDURES_CALL_DISABLED_DEF_WARNING.replace("%1",k)));else{a.setGroup$$module$build$src$core$events$utils(C.group),C=a.createElement$$module$build$src$core$utils$xml("xml"),k=a.createElement$$module$build$src$core$utils$xml("block"),k.setAttribute("type",this.defType_),M=this.getRelativeToSurfaceXY();var z=M.y+a.config$$module$build$src$core$config.snapRadius*2;k.setAttribute("x",`${M.x+a.config$$module$build$src$core$config.snapRadius*(this.RTL?-1:1)}`),k.setAttribute("y",`${z}`),M=this.mutationToDom(),k.appendChild(M),M=a.createElement$$module$build$src$core$utils$xml("field"),M.setAttribute("name","NAME"),z=this.getProcedureCall();const fe=a.findLegalName$$module$build$src$core$procedures(z,this);z!==fe&&this.renameProcedure(z,fe),M.appendChild(a.createTextNode$$module$build$src$core$utils$xml(z)),k.appendChild(M),C.appendChild(k),a.domToWorkspace$$module$build$src$core$xml(C,this.workspace),a.setGroup$$module$build$src$core$events$utils(!1)}}else C.type===a.BLOCK_DELETE$$module$build$src$core$events$events?(k=this.getProcedureCall(),a.getDefinition$$module$build$src$core$procedures(k,this.workspace)||(a.setGroup$$module$build$src$core$events$utils(C.group),this.dispose(!0),a.setGroup$$module$build$src$core$events$utils(!1))):C.type===a.BLOCK_CHANGE$$module$build$src$core$events$events&&C.element==="disabled"&&(k=this.getProcedureCall(),(z=a.getDefinition$$module$build$src$core$procedures(k,this.workspace))&&z.id===C.blockId&&((M=a.getGroup$$module$build$src$core$events$utils())&&console.log("Saw an existing group while responding to a definition change"),a.setGroup$$module$build$src$core$events$utils(C.group),C=z.isEnabled(),this.setDisabledReason(!C,we),this.setWarningText(C?null:a.Msg$$module$build$src$core$msg.PROCEDURES_CALL_DISABLED_DEF_WARNING.replace("%1",k)),a.setGroup$$module$build$src$core$events$utils(M)))},customContextMenu:function(C){if(this.workspace.isMovable()){var k=this.getProcedureCall(),M=this.workspace;C.push({enabled:!0,text:a.Msg$$module$build$src$core$msg.PROCEDURES_HIGHLIGHT_DEF,callback:function(){const z=a.getDefinition$$module$build$src$core$procedures(k,M);z&&(M.centerOnBlock(z.id),a.getFocusManager$$module$build$src$core$focus_manager().focusNode(z))}})}}};Be.procedures_callnoreturn=Object.assign({},Ze,{init:function(){this.appendDummyInput("TOPROW").appendField("","NAME"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setHelpUrl(a.Msg$$module$build$src$core$msg.PROCEDURES_CALLNORETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.quarkConnections_={},this.quarkIds_=null},defType_:"procedures_defnoreturn"}),Be.procedures_callreturn=Object.assign({},Ze,{init:function(){this.appendDummyInput("TOPROW").appendField("","NAME"),this.setOutput(!0),this.setStyle("procedure_blocks"),this.setHelpUrl(a.Msg$$module$build$src$core$msg.PROCEDURES_CALLRETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.quarkConnections_={},this.quarkIds_=null},defType_:"procedures_defreturn"});var Le="UNPARENTED_IFRETURN",_e={init:function(){this.appendValueInput("CONDITION").setCheck("Boolean").appendField(a.Msg$$module$build$src$core$msg.CONTROLS_IF_MSG_IF),this.appendValueInput("VALUE").appendField(a.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_RETURN),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setTooltip(a.Msg$$module$build$src$core$msg.PROCEDURES_IFRETURN_TOOLTIP),this.setHelpUrl(a.Msg$$module$build$src$core$msg.PROCEDURES_IFRETURN_HELPURL),this.hasReturnValue_=!0},mutationToDom:function(){const C=a.createElement$$module$build$src$core$utils$xml("mutation");return C.setAttribute("value",String(Number(this.hasReturnValue_))),C},domToMutation:function(C){this.hasReturnValue_=C.getAttribute("value")==="1",this.hasReturnValue_||(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(a.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_RETURN))},onchange:function(C){if(!(this.workspace.isDragging&&this.workspace.isDragging()||C.type!==a.BLOCK_MOVE$$module$build$src$core$events$events&&C.type!==a.BLOCK_CREATE$$module$build$src$core$events$events)){C=!1;var k=this;do{if(this.FUNCTION_TYPES.includes(k.type)){C=!0;break}k=k.getSurroundParent()}while(k);if(C?(k.type==="procedures_defnoreturn"&&this.hasReturnValue_?(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(a.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!1):k.type!=="procedures_defreturn"||this.hasReturnValue_||(this.removeInput("VALUE"),this.appendValueInput("VALUE").appendField(a.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!0),this.setWarningText(null)):this.setWarningText(a.Msg$$module$build$src$core$msg.PROCEDURES_IFRETURN_WARNING),!this.isInFlyout)try{a.setRecordUndo$$module$build$src$core$events$utils(!1),this.setDisabledReason(!C,Le)}finally{a.setRecordUndo$$module$build$src$core$events$utils(!0)}}},FUNCTION_TYPES:["procedures_defnoreturn","procedures_defreturn"]};Be.procedures_ifreturn=_e,a.defineBlocks$$module$build$src$core$common(Be);var ce={blocks:Be},xe=a.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"math_number",message0:"%1",args0:[{type:"field_number",name:"NUM",value:0}],output:"Number",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",style:"math_blocks",tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"math_arithmetic",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Number"},{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ADDITION_SYMBOL}","ADD"],["%{BKY_MATH_SUBTRACTION_SYMBOL}","MINUS"],["%{BKY_MATH_MULTIPLICATION_SYMBOL}","MULTIPLY"],["%{BKY_MATH_DIVISION_SYMBOL}","DIVIDE"],["%{BKY_MATH_POWER_SYMBOL}","POWER"]]},{type:"input_value",name:"B",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ARITHMETIC_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_single",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_SINGLE_OP_ROOT}","ROOT"],["%{BKY_MATH_SINGLE_OP_ABSOLUTE}","ABS"],["-","NEG"],["ln","LN"],["log10","LOG10"],["e^","EXP"],["10^","POW10"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_SINGLE_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_trig",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_TRIG_SIN}","SIN"],["%{BKY_MATH_TRIG_COS}","COS"],["%{BKY_MATH_TRIG_TAN}","TAN"],["%{BKY_MATH_TRIG_ASIN}","ASIN"],["%{BKY_MATH_TRIG_ACOS}","ACOS"],["%{BKY_MATH_TRIG_ATAN}","ATAN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_TRIG_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_constant",message0:"%1",args0:[{type:"field_dropdown",name:"CONSTANT",options:[["π","PI"],["e","E"],["φ","GOLDEN_RATIO"],["sqrt(2)","SQRT2"],["sqrt(½)","SQRT1_2"],["∞","INFINITY"]]}],output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTANT_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTANT_HELPURL}"},{type:"math_number_property",message0:"%1 %2",args0:[{type:"input_value",name:"NUMBER_TO_CHECK",check:"Number"},{type:"field_dropdown",name:"PROPERTY",options:[["%{BKY_MATH_IS_EVEN}","EVEN"],["%{BKY_MATH_IS_ODD}","ODD"],["%{BKY_MATH_IS_PRIME}","PRIME"],["%{BKY_MATH_IS_WHOLE}","WHOLE"],["%{BKY_MATH_IS_POSITIVE}","POSITIVE"],["%{BKY_MATH_IS_NEGATIVE}","NEGATIVE"],["%{BKY_MATH_IS_DIVISIBLE_BY}","DIVISIBLE_BY"]]}],inputsInline:!0,output:"Boolean",style:"math_blocks",tooltip:"%{BKY_MATH_IS_TOOLTIP}",mutator:"math_is_divisibleby_mutator"},{type:"math_change",message0:"%{BKY_MATH_CHANGE_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_MATH_CHANGE_TITLE_ITEM}"},{type:"input_value",name:"DELTA",check:"Number"}],previousStatement:null,nextStatement:null,style:"variable_blocks",helpUrl:"%{BKY_MATH_CHANGE_HELPURL}",extensions:["math_change_tooltip"]},{type:"math_round",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ROUND_OPERATOR_ROUND}","ROUND"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDUP}","ROUNDUP"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDDOWN}","ROUNDDOWN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ROUND_HELPURL}",tooltip:"%{BKY_MATH_ROUND_TOOLTIP}"},{type:"math_on_list",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ONLIST_OPERATOR_SUM}","SUM"],["%{BKY_MATH_ONLIST_OPERATOR_MIN}","MIN"],["%{BKY_MATH_ONLIST_OPERATOR_MAX}","MAX"],["%{BKY_MATH_ONLIST_OPERATOR_AVERAGE}","AVERAGE"],["%{BKY_MATH_ONLIST_OPERATOR_MEDIAN}","MEDIAN"],["%{BKY_MATH_ONLIST_OPERATOR_MODE}","MODE"],["%{BKY_MATH_ONLIST_OPERATOR_STD_DEV}","STD_DEV"],["%{BKY_MATH_ONLIST_OPERATOR_RANDOM}","RANDOM"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ONLIST_HELPURL}",mutator:"math_modes_of_list_mutator",extensions:["math_op_tooltip"]},{type:"math_modulo",message0:"%{BKY_MATH_MODULO_TITLE}",args0:[{type:"input_value",name:"DIVIDEND",check:"Number"},{type:"input_value",name:"DIVISOR",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_MODULO_TOOLTIP}",helpUrl:"%{BKY_MATH_MODULO_HELPURL}"},{type:"math_constrain",message0:"%{BKY_MATH_CONSTRAIN_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"Number"},{type:"input_value",name:"LOW",check:"Number"},{type:"input_value",name:"HIGH",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTRAIN_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTRAIN_HELPURL}"},{type:"math_random_int",message0:"%{BKY_MATH_RANDOM_INT_TITLE}",args0:[{type:"input_value",name:"FROM",check:"Number"},{type:"input_value",name:"TO",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_INT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_INT_HELPURL}"},{type:"math_random_float",message0:"%{BKY_MATH_RANDOM_FLOAT_TITLE_RANDOM}",output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_FLOAT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_FLOAT_HELPURL}"},{type:"math_atan2",message0:"%{BKY_MATH_ATAN2_TITLE}",args0:[{type:"input_value",name:"X",check:"Number"},{type:"input_value",name:"Y",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_ATAN2_TOOLTIP}",helpUrl:"%{BKY_MATH_ATAN2_HELPURL}"}]),se={ADD:"%{BKY_MATH_ARITHMETIC_TOOLTIP_ADD}",MINUS:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MINUS}",MULTIPLY:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MULTIPLY}",DIVIDE:"%{BKY_MATH_ARITHMETIC_TOOLTIP_DIVIDE}",POWER:"%{BKY_MATH_ARITHMETIC_TOOLTIP_POWER}",ROOT:"%{BKY_MATH_SINGLE_TOOLTIP_ROOT}",ABS:"%{BKY_MATH_SINGLE_TOOLTIP_ABS}",NEG:"%{BKY_MATH_SINGLE_TOOLTIP_NEG}",LN:"%{BKY_MATH_SINGLE_TOOLTIP_LN}",LOG10:"%{BKY_MATH_SINGLE_TOOLTIP_LOG10}",EXP:"%{BKY_MATH_SINGLE_TOOLTIP_EXP}",POW10:"%{BKY_MATH_SINGLE_TOOLTIP_POW10}",SIN:"%{BKY_MATH_TRIG_TOOLTIP_SIN}",COS:"%{BKY_MATH_TRIG_TOOLTIP_COS}",TAN:"%{BKY_MATH_TRIG_TOOLTIP_TAN}",ASIN:"%{BKY_MATH_TRIG_TOOLTIP_ASIN}",ACOS:"%{BKY_MATH_TRIG_TOOLTIP_ACOS}",ATAN:"%{BKY_MATH_TRIG_TOOLTIP_ATAN}",SUM:"%{BKY_MATH_ONLIST_TOOLTIP_SUM}",MIN:"%{BKY_MATH_ONLIST_TOOLTIP_MIN}",MAX:"%{BKY_MATH_ONLIST_TOOLTIP_MAX}",AVERAGE:"%{BKY_MATH_ONLIST_TOOLTIP_AVERAGE}",MEDIAN:"%{BKY_MATH_ONLIST_TOOLTIP_MEDIAN}",MODE:"%{BKY_MATH_ONLIST_TOOLTIP_MODE}",STD_DEV:"%{BKY_MATH_ONLIST_TOOLTIP_STD_DEV}",RANDOM:"%{BKY_MATH_ONLIST_TOOLTIP_RANDOM}"};a.register$$module$build$src$core$extensions("math_op_tooltip",a.buildTooltipForDropdown$$module$build$src$core$extensions("OP",se));var ee={mutationToDom:function(){const C=a.createElement$$module$build$src$core$utils$xml("mutation"),k=this.getFieldValue("PROPERTY")==="DIVISIBLE_BY";return C.setAttribute("divisor_input",String(k)),C},domToMutation:function(C){C=C.getAttribute("divisor_input")==="true",this.updateShape_(C)},updateShape_:function(C){const k=this.getInput("DIVISOR");C?k||this.appendValueInput("DIVISOR").setCheck("Number"):k&&this.removeInput("DIVISOR")}},ae=function(){this.getField("PROPERTY").setValidator(function(C){C=C==="DIVISIBLE_BY",this.getSourceBlock().updateShape_(C)})};a.registerMutator$$module$build$src$core$extensions("math_is_divisibleby_mutator",ee,ae),a.register$$module$build$src$core$extensions("math_change_tooltip",a.buildTooltipWithFieldText$$module$build$src$core$extensions("%{BKY_MATH_CHANGE_TOOLTIP}","VAR"));var et={updateType_:function(C){C==="MODE"?this.outputConnection.setCheck("Array"):this.outputConnection.setCheck("Number")},mutationToDom:function(){const C=a.createElement$$module$build$src$core$utils$xml("mutation");return C.setAttribute("op",this.getFieldValue("OP")),C},domToMutation:function(C){if(C=C.getAttribute("op"),C===null)throw new TypeError("xmlElement had no op attribute");this.updateType_(C)}},Ae=function(){this.getField("OP").setValidator((function(C){this.updateType_(C)}).bind(this))};a.registerMutator$$module$build$src$core$extensions("math_modes_of_list_mutator",et,Ae),a.defineBlocks$$module$build$src$core$common(xe);var lt={blocks:xe},Ye=a.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"controls_repeat_ext",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"input_value",name:"TIMES",check:"Number"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_repeat",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"field_number",name:"TIMES",value:10,min:0,precision:1}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_whileUntil",message0:"%1 %2",args0:[{type:"field_dropdown",name:"MODE",options:[["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_WHILE}","WHILE"],["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL}","UNTIL"]]},{type:"input_value",name:"BOOL",check:"Boolean"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_WHILEUNTIL_HELPURL}",extensions:["controls_whileUntil_tooltip"]},{type:"controls_for",message0:"%{BKY_CONTROLS_FOR_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"FROM",check:"Number",align:"RIGHT"},{type:"input_value",name:"TO",check:"Number",align:"RIGHT"},{type:"input_value",name:"BY",check:"Number",align:"RIGHT"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],inputsInline:!0,previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOR_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_for_tooltip"]},{type:"controls_forEach",message0:"%{BKY_CONTROLS_FOREACH_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"LIST",check:"Array"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOREACH_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_forEach_tooltip"]},{type:"controls_flow_statements",message0:"%1",args0:[{type:"field_dropdown",name:"FLOW",options:[["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK}","BREAK"],["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE}","CONTINUE"]]}],previousStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FLOW_STATEMENTS_HELPURL}",suppressPrefixSuffix:!0,extensions:["controls_flow_tooltip","controls_flow_in_loop_check"]}]),gt={WHILE:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_WHILE}",UNTIL:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}"};a.register$$module$build$src$core$extensions("controls_whileUntil_tooltip",a.buildTooltipForDropdown$$module$build$src$core$extensions("MODE",gt));var nt={BREAK:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK}",CONTINUE:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}"};a.register$$module$build$src$core$extensions("controls_flow_tooltip",a.buildTooltipForDropdown$$module$build$src$core$extensions("FLOW",nt));var Ot={customContextMenu:function(C){if(!this.isInFlyout){var k=this.getField("VAR"),M=k.getVariable().getName();this.isCollapsed()||M===null||(k={type:"variables_get",fields:{VAR:k.saveState(!0)}},C.push({enabled:!0,text:a.Msg$$module$build$src$core$msg.VARIABLES_SET_CREATE_GET.replace("%1",M),callback:a.callbackFactory$$module$build$src$core$contextmenu(this,k)}))}}};a.registerMixin$$module$build$src$core$extensions("contextMenu_newGetVariableBlock",Ot),a.register$$module$build$src$core$extensions("controls_for_tooltip",a.buildTooltipWithFieldText$$module$build$src$core$extensions("%{BKY_CONTROLS_FOR_TOOLTIP}","VAR")),a.register$$module$build$src$core$extensions("controls_forEach_tooltip",a.buildTooltipWithFieldText$$module$build$src$core$extensions("%{BKY_CONTROLS_FOREACH_TOOLTIP}","VAR"));var Je=new Set(["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"]),Ut="CONTROL_FLOW_NOT_IN_LOOP",Oe={getSurroundLoop:function(){let C=this;do{if(Je.has(C.type))return C;C=C.getSurroundParent()}while(C);return null},onchange:function(C){const k=this.workspace;if(k.isDragging&&!k.isDragging()&&(C.type===a.BLOCK_MOVE$$module$build$src$core$events$events||C.type===a.BLOCK_CREATE$$module$build$src$core$events$events)&&(C=!!this.getSurroundLoop(),this.setWarningText(C?null:a.Msg$$module$build$src$core$msg.CONTROLS_FLOW_STATEMENTS_WARNING),!this.isInFlyout))try{a.setRecordUndo$$module$build$src$core$events$utils(!1),this.setDisabledReason(!C,Ut)}finally{a.setRecordUndo$$module$build$src$core$events$utils(!0)}}};a.registerMixin$$module$build$src$core$extensions("controls_flow_in_loop_check",Oe),a.defineBlocks$$module$build$src$core$common(Ye);var We={blocks:Ye,loopTypes:Je},U=a.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"logic_boolean",message0:"%1",args0:[{type:"field_dropdown",name:"BOOL",options:[["%{BKY_LOGIC_BOOLEAN_TRUE}","TRUE"],["%{BKY_LOGIC_BOOLEAN_FALSE}","FALSE"]]}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_BOOLEAN_TOOLTIP}",helpUrl:"%{BKY_LOGIC_BOOLEAN_HELPURL}"},{type:"controls_if",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],previousStatement:null,nextStatement:null,style:"logic_blocks",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",suppressPrefixSuffix:!0,mutator:"controls_if_mutator",extensions:["controls_if_tooltip"]},{type:"controls_ifelse",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],message2:"%{BKY_CONTROLS_IF_MSG_ELSE} %1",args2:[{type:"input_statement",name:"ELSE"}],previousStatement:null,nextStatement:null,style:"logic_blocks",tooltip:"%{BKYCONTROLS_IF_TOOLTIP_2}",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",suppressPrefixSuffix:!0,extensions:["controls_if_tooltip"]},{type:"logic_compare",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A"},{type:"field_dropdown",name:"OP",options:[["=","EQ"],["≠","NEQ"],["‏<","LT"],["‏≤","LTE"],["‏>","GT"],["‏≥","GTE"]]},{type:"input_value",name:"B"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_COMPARE_HELPURL}",extensions:["logic_compare","logic_op_tooltip"]},{type:"logic_operation",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Boolean"},{type:"field_dropdown",name:"OP",options:[["%{BKY_LOGIC_OPERATION_AND}","AND"],["%{BKY_LOGIC_OPERATION_OR}","OR"]]},{type:"input_value",name:"B",check:"Boolean"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_OPERATION_HELPURL}",extensions:["logic_op_tooltip"]},{type:"logic_negate",message0:"%{BKY_LOGIC_NEGATE_TITLE}",args0:[{type:"input_value",name:"BOOL",check:"Boolean"}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_NEGATE_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NEGATE_HELPURL}"},{type:"logic_null",message0:"%{BKY_LOGIC_NULL}",output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_NULL_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NULL_HELPURL}"},{type:"logic_ternary",message0:"%{BKY_LOGIC_TERNARY_CONDITION} %1",args0:[{type:"input_value",name:"IF",check:"Boolean"}],message1:"%{BKY_LOGIC_TERNARY_IF_TRUE} %1",args1:[{type:"input_value",name:"THEN"}],message2:"%{BKY_LOGIC_TERNARY_IF_FALSE} %1",args2:[{type:"input_value",name:"ELSE"}],output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_TERNARY_TOOLTIP}",helpUrl:"%{BKY_LOGIC_TERNARY_HELPURL}",extensions:["logic_ternary"]},{type:"controls_if_if",message0:"%{BKY_CONTROLS_IF_IF_TITLE_IF}",nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_IF_TOOLTIP}"},{type:"controls_if_elseif",message0:"%{BKY_CONTROLS_IF_ELSEIF_TITLE_ELSEIF}",previousStatement:null,nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSEIF_TOOLTIP}"},{type:"controls_if_else",message0:"%{BKY_CONTROLS_IF_ELSE_TITLE_ELSE}",previousStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSE_TOOLTIP}"}]),B={EQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_EQ}",NEQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_NEQ}",LT:"%{BKY_LOGIC_COMPARE_TOOLTIP_LT}",LTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_LTE}",GT:"%{BKY_LOGIC_COMPARE_TOOLTIP_GT}",GTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_GTE}",AND:"%{BKY_LOGIC_OPERATION_TOOLTIP_AND}",OR:"%{BKY_LOGIC_OPERATION_TOOLTIP_OR}"};a.register$$module$build$src$core$extensions("logic_op_tooltip",a.buildTooltipForDropdown$$module$build$src$core$extensions("OP",B));var ue={elseifCount_:0,elseCount_:0,mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;const C=a.createElement$$module$build$src$core$utils$xml("mutation");return this.elseifCount_&&C.setAttribute("elseif",String(this.elseifCount_)),this.elseCount_&&C.setAttribute("else","1"),C},domToMutation:function(C){this.elseifCount_=parseInt(C.getAttribute("elseif"),10)||0,this.elseCount_=parseInt(C.getAttribute("else"),10)||0,this.rebuildShape_()},saveExtraState:function(){if(!this.elseifCount_&&!this.elseCount_)return null;const C=Object.create(null);return this.elseifCount_&&(C.elseIfCount=this.elseifCount_),this.elseCount_&&(C.hasElse=!0),C},loadExtraState:function(C){this.elseifCount_=C.elseIfCount||0,this.elseCount_=C.hasElse?1:0,this.updateShape_()},decompose:function(C){const k=C.newBlock("controls_if_if");k.initSvg();let M=k.nextConnection;for(let z=1;z<=this.elseifCount_;z++){const fe=C.newBlock("controls_if_elseif");fe.initSvg(),M.connect(fe.previousConnection),M=fe.nextConnection}return this.elseCount_&&(C=C.newBlock("controls_if_else"),C.initSvg(),M.connect(C.previousConnection)),k},compose:function(C){C=C.nextConnection.targetBlock(),this.elseCount_=this.elseifCount_=0;const k=[null],M=[null];let z=null;for(;C;){if(!C.isInsertionMarker())switch(C.type){case"controls_if_elseif":this.elseifCount_++,k.push(C.valueConnection_),M.push(C.statementConnection_);break;case"controls_if_else":this.elseCount_++,z=C.statementConnection_;break;default:throw TypeError("Unknown block type: "+C.type)}C=C.getNextBlock()}this.updateShape_(),this.reconnectChildBlocks_(k,M,z)},saveConnections:function(C){C=C.nextConnection.targetBlock();let k=1;for(;C;){if(!C.isInsertionMarker())switch(C.type){case"controls_if_elseif":var M=this.getInput("IF"+k);const z=this.getInput("DO"+k);C.valueConnection_=M&&M.connection.targetConnection,C.statementConnection_=z&&z.connection.targetConnection,k++;break;case"controls_if_else":M=this.getInput("ELSE"),C.statementConnection_=M&&M.connection.targetConnection;break;default:throw TypeError("Unknown block type: "+C.type)}C=C.getNextBlock()}},rebuildShape_:function(){const C=[null],k=[null];let M=null;this.getInput("ELSE")&&(M=this.getInput("ELSE").connection.targetConnection);for(let z=1;this.getInput("IF"+z);z++){const fe=this.getInput("IF"+z),$=this.getInput("DO"+z);C.push(fe.connection.targetConnection),k.push($.connection.targetConnection)}this.updateShape_(),this.reconnectChildBlocks_(C,k,M)},updateShape_:function(){this.getInput("ELSE")&&this.removeInput("ELSE");for(var C=1;this.getInput("IF"+C);C++)this.removeInput("IF"+C),this.removeInput("DO"+C);for(C=1;C<=this.elseifCount_;C++)this.appendValueInput("IF"+C).setCheck("Boolean").appendField(a.Msg$$module$build$src$core$msg.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+C).appendField(a.Msg$$module$build$src$core$msg.CONTROLS_IF_MSG_THEN);this.elseCount_&&this.appendStatementInput("ELSE").appendField(a.Msg$$module$build$src$core$msg.CONTROLS_IF_MSG_ELSE)},reconnectChildBlocks_:function(C,k,M){for(let z=1;z<=this.elseifCount_;z++){let fe;(fe=C[z])==null||fe.reconnect(this,"IF"+z);let $;($=k[z])==null||$.reconnect(this,"DO"+z)}M==null||M.reconnect(this,"ELSE")}};a.registerMutator$$module$build$src$core$extensions("controls_if_mutator",ue,null,["controls_if_elseif","controls_if_else"]);var q=function(){this.setTooltip((function(){if(this.elseifCount_||this.elseCount_){if(!this.elseifCount_&&this.elseCount_)return a.Msg$$module$build$src$core$msg.CONTROLS_IF_TOOLTIP_2;if(this.elseifCount_&&!this.elseCount_)return a.Msg$$module$build$src$core$msg.CONTROLS_IF_TOOLTIP_3;if(this.elseifCount_&&this.elseCount_)return a.Msg$$module$build$src$core$msg.CONTROLS_IF_TOOLTIP_4}else return a.Msg$$module$build$src$core$msg.CONTROLS_IF_TOOLTIP_1;return""}).bind(this))};a.register$$module$build$src$core$extensions("controls_if_tooltip",q);var Ue={onchange:function(C){this.prevBlocks_||(this.prevBlocks_=[null,null]);var k=this.getInputTargetBlock("A");const M=this.getInputTargetBlock("B");k&&M&&!this.workspace.connectionChecker.doTypeChecks(k.outputConnection,M.outputConnection)&&(a.setGroup$$module$build$src$core$events$utils(C.group),C=this.prevBlocks_[0],C!==k&&(k.unplug(),!C||C.isDisposed()||C.isShadow()||this.getInput("A").connection.connect(C.outputConnection)),k=this.prevBlocks_[1],k!==M&&(M.unplug(),!k||k.isDisposed()||k.isShadow()||this.getInput("B").connection.connect(k.outputConnection)),this.bumpNeighbours(),a.setGroup$$module$build$src$core$events$utils(!1)),this.prevBlocks_[0]=this.getInputTargetBlock("A"),this.prevBlocks_[1]=this.getInputTargetBlock("B")}},ge=function(){this.mixin(Ue)};a.register$$module$build$src$core$extensions("logic_compare",ge);var me={prevParentConnection_:null,onchange:function(C){const k=this.getInputTargetBlock("THEN"),M=this.getInputTargetBlock("ELSE"),z=this.outputConnection.targetConnection;if((k||M)&&z)for(let fe=0;fe<2;fe++){const $=fe===1?k:M;$&&!$.workspace.connectionChecker.doTypeChecks($.outputConnection,z)&&(a.setGroup$$module$build$src$core$events$utils(C.group),z===this.prevParentConnection_?(this.unplug(),z.getSourceBlock().bumpNeighbours()):($.unplug(),$.bumpNeighbours()),a.setGroup$$module$build$src$core$events$utils(!1))}this.prevParentConnection_=z}};a.registerMixin$$module$build$src$core$extensions("logic_ternary",me),a.defineBlocks$$module$build$src$core$common(U);var $e={blocks:U},he=a.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"lists_create_empty",message0:"%{BKY_LISTS_CREATE_EMPTY_TITLE}",output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_CREATE_EMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_CREATE_EMPTY_HELPURL}"},{type:"lists_repeat",message0:"%{BKY_LISTS_REPEAT_TITLE}",args0:[{type:"input_value",name:"ITEM"},{type:"input_value",name:"NUM",check:"Number"}],output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_LISTS_REPEAT_HELPURL}"},{type:"lists_reverse",message0:"%{BKY_LISTS_REVERSE_MESSAGE0}",args0:[{type:"input_value",name:"LIST",check:"Array"}],output:"Array",inputsInline:!0,style:"list_blocks",tooltip:"%{BKY_LISTS_REVERSE_TOOLTIP}",helpUrl:"%{BKY_LISTS_REVERSE_HELPURL}"},{type:"lists_isEmpty",message0:"%{BKY_LISTS_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",style:"list_blocks",tooltip:"%{BKY_LISTS_ISEMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_ISEMPTY_HELPURL}"},{type:"lists_length",message0:"%{BKY_LISTS_LENGTH_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Number",style:"list_blocks",tooltip:"%{BKY_LISTS_LENGTH_TOOLTIP}",helpUrl:"%{BKY_LISTS_LENGTH_HELPURL}"}]),tt={init:function(){this.setHelpUrl(a.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_HELPURL),this.setStyle("list_blocks"),this.itemCount_=3,this.updateShape_(),this.setOutput(!0,"Array"),this.setMutator(new a.MutatorIcon$$module$build$src$core$icons$mutator_icon(["lists_create_with_item"],this)),this.setTooltip(a.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){const C=a.createElement$$module$build$src$core$utils$xml("mutation");return C.setAttribute("items",String(this.itemCount_)),C},domToMutation:function(C){if(C=C.getAttribute("items"),!C)throw new TypeError("element did not have items");this.itemCount_=parseInt(C,10),this.updateShape_()},saveExtraState:function(){return{itemCount:this.itemCount_}},loadExtraState:function(C){this.itemCount_=C.itemCount,this.updateShape_()},decompose:function(C){const k=C.newBlock("lists_create_with_container");k.initSvg();let M=k.getInput("STACK").connection;for(let z=0;z<this.itemCount_;z++){const fe=C.newBlock("lists_create_with_item");if(fe.initSvg(),!fe.previousConnection)throw Error("itemBlock has no previousConnection");M.connect(fe.previousConnection),M=fe.nextConnection}return k},compose:function(C){var k=C.getInputTargetBlock("STACK");for(C=[];k;)k.isInsertionMarker()||C.push(k.valueConnection_),k=k.getNextBlock();for(k=0;k<this.itemCount_;k++){const M=this.getInput("ADD"+k).connection.targetConnection;M&&!C.includes(M)&&M.disconnect()}for(this.itemCount_=C.length,this.updateShape_(),k=0;k<this.itemCount_;k++){let M;(M=C[k])==null||M.reconnect(this,"ADD"+k)}},saveConnections:function(C){C=C.getInputTargetBlock("STACK");let k=0;for(;C;){if(C.isInsertionMarker()){C=C.getNextBlock();continue}const M=this.getInput("ADD"+k);let z;C.valueConnection_=(z=M)==null?void 0:z.connection.targetConnection,C=C.getNextBlock(),k++}},updateShape_:function(){this.itemCount_&&this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField(a.Msg$$module$build$src$core$msg.LISTS_CREATE_EMPTY_TITLE);for(var C=0;C<this.itemCount_;C++)if(!this.getInput("ADD"+C)){const k=this.appendValueInput("ADD"+C).setAlign(a.Align$$module$build$src$core$inputs$align.RIGHT);C===0&&k.appendField(a.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_INPUT_WITH)}for(C=this.itemCount_;this.getInput("ADD"+C);C++)this.removeInput("ADD"+C)}};he.lists_create_with=tt;var D={init:function(){this.setStyle("list_blocks"),this.appendDummyInput().appendField(a.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD),this.appendStatementInput("STACK"),this.setTooltip(a.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP),this.contextMenu=!1}};he.lists_create_with_container=D;var h={init:function(){this.setStyle("list_blocks"),this.appendDummyInput().appendField(a.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_ITEM_TITLE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(a.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}};he.lists_create_with_item=h;var w={init:function(){var C=[[a.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_FIRST,"FIRST"],[a.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_LAST,"LAST"]];if(this.setHelpUrl(a.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_HELPURL),this.setStyle("list_blocks"),this.setOutput(!0,"Number"),this.appendValueInput("VALUE").setCheck("Array").appendField(a.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_INPUT_IN_LIST),C=a.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:C}),!C)throw Error("field_dropdown not found");this.appendValueInput("FIND").appendField(C,"END"),this.setInputsInline(!0),this.setTooltip(()=>a.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"0":"-1"))}};he.lists_indexOf=w;var J={init:function(){var C=[[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_GET,"GET"],[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_GET_REMOVE,"GET_REMOVE"],[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_REMOVE,"REMOVE"]];this.WHERE_OPTIONS=[[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FIRST,"FIRST"],[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_LAST,"LAST"],[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]],this.setHelpUrl(a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_HELPURL),this.setStyle("list_blocks"),C=a.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:C}),C.setValidator(function(k){k=k==="REMOVE",this.getSourceBlock().updateStatement_(k)}),this.appendValueInput("VALUE").setCheck("Array").appendField(a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_INPUT_IN_LIST),this.appendDummyInput().appendField(C,"MODE").appendField("","SPACE"),C=a.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this.WHERE_OPTIONS}),C.setValidator(function(k){const M=this.getValue();k=k==="FROM_START"||k==="FROM_END",k!==(M==="FROM_START"||M==="FROM_END")&&this.getSourceBlock().updateAt_(k)}),this.appendDummyInput().appendField(C,"WHERE"),this.appendDummyInput("AT"),a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TAIL&&this.appendDummyInput("TAIL").appendField(a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TAIL),this.setInputsInline(!0),this.setOutput(!0),this.updateAt_(!0),this.setTooltip(()=>{const k=this.getFieldValue("MODE"),M=this.getFieldValue("WHERE");let z="";switch(k+" "+M){case"GET FROM_START":case"GET FROM_END":z=a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM;break;case"GET FIRST":z=a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_FIRST;break;case"GET LAST":z=a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_LAST;break;case"GET RANDOM":z=a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM;break;case"GET_REMOVE FROM_START":case"GET_REMOVE FROM_END":z=a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM;break;case"GET_REMOVE FIRST":z=a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST;break;case"GET_REMOVE LAST":z=a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST;break;case"GET_REMOVE RANDOM":z=a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM;break;case"REMOVE FROM_START":case"REMOVE FROM_END":z=a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM;break;case"REMOVE FIRST":z=a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST;break;case"REMOVE LAST":z=a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST;break;case"REMOVE RANDOM":z=a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM}return(M==="FROM_START"||M==="FROM_END")&&(z+=" "+(M==="FROM_START"?a.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_START_TOOLTIP:a.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_END_TOOLTIP).replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0")),z})},mutationToDom:function(){const C=a.createElement$$module$build$src$core$utils$xml("mutation");C.setAttribute("statement",String(!this.outputConnection));const k=this.getInput("AT")instanceof a.ValueInput$$module$build$src$core$inputs$value_input;return C.setAttribute("at",String(k)),C},domToMutation:function(C){const k=C.getAttribute("statement")==="true";this.updateStatement_(k),C=C.getAttribute("at")!=="false",this.updateAt_(C)},saveExtraState:function(){return this.outputConnection?null:{isStatement:!0}},loadExtraState:function(C){C.isStatement?this.updateStatement_(!0):typeof C=="string"&&this.domToMutation(a.textToDom$$module$build$src$core$utils$xml(C))},updateStatement_:function(C){C!==!this.outputConnection&&(this.unplug(!0,!0),C?(this.setOutput(!1),this.setPreviousStatement(!0),this.setNextStatement(!0)):(this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0)))},updateAt_:function(C){this.removeInput("AT"),this.removeInput("ORDINAL",!0),C?(this.appendValueInput("AT").setCheck("Number"),a.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(a.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"),a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TAIL&&this.moveInputBefore("TAIL",null)}};he.lists_getIndex=J;var j={init:function(){var C=[[a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_SET,"SET"],[a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_INSERT,"INSERT"]];this.WHERE_OPTIONS=[[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FIRST,"FIRST"],[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_LAST,"LAST"],[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]],this.setHelpUrl(a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_HELPURL),this.setStyle("list_blocks"),this.appendValueInput("LIST").setCheck("Array").appendField(a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_INPUT_IN_LIST),C=a.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:C}),this.appendDummyInput().appendField(C,"MODE").appendField("","SPACE"),C=a.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this.WHERE_OPTIONS}),C.setValidator(function(k){const M=this.getValue();k=k==="FROM_START"||k==="FROM_END",k!==(M==="FROM_START"||M==="FROM_END")&&this.getSourceBlock().updateAt_(k)}),this.appendDummyInput().appendField(C,"WHERE"),this.appendDummyInput("AT"),this.appendValueInput("TO").appendField(a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_INPUT_TO),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP),this.updateAt_(!0),this.setTooltip(()=>{const k=this.getFieldValue("MODE"),M=this.getFieldValue("WHERE");let z="";switch(k+" "+M){case"SET FROM_START":case"SET FROM_END":z=a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM;break;case"SET FIRST":z=a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_SET_FIRST;break;case"SET LAST":z=a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_SET_LAST;break;case"SET RANDOM":z=a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM;break;case"INSERT FROM_START":case"INSERT FROM_END":z=a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM;break;case"INSERT FIRST":z=a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST;break;case"INSERT LAST":z=a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST;break;case"INSERT RANDOM":z=a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM}return(M==="FROM_START"||M==="FROM_END")&&(z+=" "+a.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0")),z})},mutationToDom:function(){const C=a.createElement$$module$build$src$core$utils$xml("mutation"),k=this.getInput("AT")instanceof a.ValueInput$$module$build$src$core$inputs$value_input;return C.setAttribute("at",String(k)),C},domToMutation:function(C){C=C.getAttribute("at")!=="false",this.updateAt_(C)},saveExtraState:function(){return null},loadExtraState:function(){},updateAt_:function(C){this.removeInput("AT"),this.removeInput("ORDINAL",!0),C?(this.appendValueInput("AT").setCheck("Number"),a.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(a.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"),this.moveInputBefore("AT","TO"),this.getInput("ORDINAL")&&this.moveInputBefore("ORDINAL","TO")}};he.lists_setIndex=j;var be={init:function(){this.WHERE_OPTIONS_1=[[a.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_START_FROM_START,"FROM_START"],[a.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_START_FROM_END,"FROM_END"],[a.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]],this.WHERE_OPTIONS_2=[[a.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[a.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],[a.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_END_LAST,"LAST"]],this.setHelpUrl(a.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_HELPURL),this.setStyle("list_blocks"),this.appendValueInput("LIST").setCheck("Array").appendField(a.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_INPUT_IN_LIST);const C=k=>{const M=a.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this["WHERE_OPTIONS_"+k]});return M.setValidator(function(z){const fe=this.getValue();z=z==="FROM_START"||z==="FROM_END",z!==(fe==="FROM_START"||fe==="FROM_END")&&this.getSourceBlock().updateAt_(k,z)}),M};this.appendDummyInput("WHERE1_INPUT").appendField(C(1),"WHERE1"),this.appendDummyInput("AT1"),this.appendDummyInput("WHERE2_INPUT").appendField(C(2),"WHERE2"),this.appendDummyInput("AT2"),a.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TAIL&&this.appendDummyInput("TAIL").appendField(a.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TAIL),this.setInputsInline(!0),this.setOutput(!0,"Array"),this.updateAt_(1,!0),this.updateAt_(2,!0),this.setTooltip(a.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TOOLTIP)},mutationToDom:function(){const C=a.createElement$$module$build$src$core$utils$xml("mutation");var k=this.getInput("AT1")instanceof a.ValueInput$$module$build$src$core$inputs$value_input;return C.setAttribute("at1",String(k)),k=this.getInput("AT2")instanceof a.ValueInput$$module$build$src$core$inputs$value_input,C.setAttribute("at2",String(k)),C},domToMutation:function(C){const k=C.getAttribute("at1")==="true";C=C.getAttribute("at2")==="true",this.updateAt_(1,k),this.updateAt_(2,C)},saveExtraState:function(){return null},loadExtraState:function(){},updateAt_:function(C,k){this.removeInput("AT"+C),this.removeInput("ORDINAL"+C,!0),k?(this.appendValueInput("AT"+C).setCheck("Number"),a.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+C).appendField(a.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+C),C===1&&(this.moveInputBefore("AT1","WHERE2_INPUT"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","WHERE2_INPUT")),a.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TAIL&&this.moveInputBefore("TAIL",null)}};he.lists_getSublist=be,he.lists_sort={init:function(){this.jsonInit({message0:"%{BKY_LISTS_SORT_TITLE}",args0:[{type:"field_dropdown",name:"TYPE",options:[["%{BKY_LISTS_SORT_TYPE_NUMERIC}","NUMERIC"],["%{BKY_LISTS_SORT_TYPE_TEXT}","TEXT"],["%{BKY_LISTS_SORT_TYPE_IGNORECASE}","IGNORE_CASE"]]},{type:"field_dropdown",name:"DIRECTION",options:[["%{BKY_LISTS_SORT_ORDER_ASCENDING}","1"],["%{BKY_LISTS_SORT_ORDER_DESCENDING}","-1"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_SORT_TOOLTIP}",helpUrl:"%{BKY_LISTS_SORT_HELPURL}"})}},he.lists_split={init:function(){const C=a.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:[[a.Msg$$module$build$src$core$msg.LISTS_SPLIT_LIST_FROM_TEXT,"SPLIT"],[a.Msg$$module$build$src$core$msg.LISTS_SPLIT_TEXT_FROM_LIST,"JOIN"]]});if(!C)throw Error("field_dropdown not found");C.setValidator(k=>{this.updateType_(k)}),this.setHelpUrl(a.Msg$$module$build$src$core$msg.LISTS_SPLIT_HELPURL),this.setStyle("list_blocks"),this.appendValueInput("INPUT").setCheck("String").appendField(C,"MODE"),this.appendValueInput("DELIM").setCheck("String").appendField(a.Msg$$module$build$src$core$msg.LISTS_SPLIT_WITH_DELIMITER),this.setInputsInline(!0),this.setOutput(!0,"Array"),this.setTooltip(()=>{const k=this.getFieldValue("MODE");if(k==="SPLIT")return a.Msg$$module$build$src$core$msg.LISTS_SPLIT_TOOLTIP_SPLIT;if(k==="JOIN")return a.Msg$$module$build$src$core$msg.LISTS_SPLIT_TOOLTIP_JOIN;throw Error("Unknown mode: "+k)})},updateType_:function(C){if(this.getFieldValue("MODE")!==C){const k=this.getInput("INPUT").connection;k.setShadowDom(null);const M=k.targetBlock();M&&(k.disconnect(),M.isShadow()?M.dispose(!1):this.bumpNeighbours())}C==="SPLIT"?(this.outputConnection.setCheck("Array"),this.getInput("INPUT").setCheck("String")):(this.outputConnection.setCheck("String"),this.getInput("INPUT").setCheck("Array"))},mutationToDom:function(){const C=a.createElement$$module$build$src$core$utils$xml("mutation");return C.setAttribute("mode",this.getFieldValue("MODE")),C},domToMutation:function(C){this.updateType_(C.getAttribute("mode"))},saveExtraState:function(){return{mode:this.getFieldValue("MODE")}},loadExtraState:function(C){this.updateType_(C.mode)}},a.defineBlocks$$module$build$src$core$common(he);var ye={blocks:he},He=Object.assign({},he,U,Ye,xe,Be,te,re,v),Ke={blocks:He,lists:ye,logic:$e,loops:We,math:lt,procedures:ce,texts:Ie,variables:X,variablesDynamic:H};return Ke.__namespace__=a,Ke})})(A$)),A$.exports}var PT=N$.exports,D_;function BT(){return D_||(D_=1,(function(f,g){(function(i,a){f.exports=a(Ml(),DT(),FT())})(PT,function(i,a,v){return i.setLocale(a),i})})(N$)),N$.exports}var UT=BT();const VT=F$(UT),{Block:ev,BlockFlyoutInflater:tv,BlockNavigationPolicy:rv,BlockSvg:nv,Blocks:HT,ButtonFlyoutInflater:sv,COLLAPSED_FIELD_NAME:ov,COLLAPSED_INPUT_NAME:iv,COLLAPSE_CHARS:lv,CodeGenerator:av,CollapsibleToolboxCategory:uv,ComponentManager:cv,Connection:dv,ConnectionChecker:hv,ConnectionDB:pv,ConnectionNavigationPolicy:$v,ConnectionType:gv,ContextMenu:fv,ContextMenuItems:mv,ContextMenuRegistry:jr,Css:_v,DELETE_VARIABLE_ID:Ev,DeleteArea:Tv,DragTarget:bv,DropDownDiv:yv,Events:_n,Extensions:vv,Field:Iv,FieldCheckbox:GT,FieldDropdown:jT,FieldImage:Nv,FieldLabel:Cv,FieldLabelSerializable:Sv,FieldNavigationPolicy:Av,FieldNumber:WT,FieldTextInput:rf,FieldVariable:Ov,Flyout:Rv,FlyoutButton:wv,FlyoutButtonNavigationPolicy:kv,FlyoutItem:xv,FlyoutMetricsManager:Lv,FlyoutNavigationPolicy:Dv,FlyoutNavigator:Mv,FlyoutSeparator:Fv,FlyoutSeparatorNavigationPolicy:Pv,FocusManager:Bv,FocusableTreeTraverser:Uv,Generator:Vv,Gesture:Hv,Grid:Gv,HorizontalFlyout:jv,INPUT_VALUE:Wv,Input:Xv,InsertionMarkerPreviewer:zv,KeyboardNavigationController:Yv,LabelFlyoutInflater:Kv,LineCursor:qv,Marker:Jv,MarkerManager:Qv,Menu:Zv,MenuItem:eI,MetricsManager:tI,Msg:rI,NEXT_STATEMENT:nI,Names:sI,Navigator:oI,OPPOSITE_TYPE:iI,OUTPUT_VALUE:lI,Options:aI,PREVIOUS_STATEMENT:uI,PROCEDURE_CATEGORY_NAME:cI,Procedures:dI,RENAME_VARIABLE_ID:hI,RenderedConnection:pI,Scrollbar:$I,ScrollbarPair:gI,SeparatorFlyoutInflater:fI,ShortcutItems:mI,ShortcutRegistry:_I,TOOLBOX_AT_BOTTOM:EI,TOOLBOX_AT_LEFT:TI,TOOLBOX_AT_RIGHT:bI,TOOLBOX_AT_TOP:yI,Theme:vI,ThemeManager:II,Themes:yE,Toast:NI,Toolbox:CI,ToolboxCategory:SI,ToolboxItem:AI,ToolboxSeparator:OI,Tooltip:RI,Touch:wI,Trashcan:kI,UnattachedFieldError:xI,VARIABLE_CATEGORY_NAME:LI,VARIABLE_DYNAMIC_CATEGORY_NAME:DI,VERSION:MI,VariableMap:FI,VariableModel:PI,Variables:BI,VariablesDynamic:UI,VerticalFlyout:VI,WidgetDiv:HI,Workspace:GI,WorkspaceAudio:jI,WorkspaceDragger:WI,WorkspaceNavigationPolicy:XI,WorkspaceSvg:zI,Xml:YI,ZoomControls:KI,blockAnimations:qI,blockRendering:JI,browserEvents:QI,bubbles:ZI,bumpObjects:eN,clipboard:tN,comments:rN,common:M_,config:nN,constants:sN,defineBlocksWithJsonArray:oN,dialog:iN,dragging:lN,fieldRegistry:$f,geras:aN,getFocusManager:uN,getMainWorkspace:cN,getSelected:dN,hasBubble:hN,hideChaff:pN,icons:$N,inject:vE,inputs:lp,isCopyable:gN,isDeletable:fN,isDraggable:mN,isIcon:_N,isObservable:EN,isPaster:TN,isRenderedElement:bN,isSelectable:yN,isSerializable:vN,isVariableBackedParameterModel:IN,keyboardNavigationController:NN,layers:CN,navigateBlock:SN,navigateStacks:AN,procedures:ON,registry:RN,renderManagement:wN,serialization:nd,setLocale:kN,setParentContainer:xN,svgResize:IE,thrasos:LN,uiPosition:DN,utils:MN,zelos:FN}=VT;class XT{add(g,i,a){if(typeof arguments[0]!="string")for(let v in arguments[0])this.add(v,arguments[0][v],arguments[1]);else(Array.isArray(g)?g:[g]).forEach(function(v){this[v]=this[v]||[],i&&this[v][a?"unshift":"push"](i)},this)}run(g,i){this[g]=this[g]||[],this[g].forEach(function(a){a.call(i&&i.context?i.context:i,i)})}}class zT{constructor(g){this.jsep=g,this.registered={}}register(){for(var g=arguments.length,i=new Array(g),a=0;a<g;a++)i[a]=arguments[a];i.forEach(v=>{if(typeof v!="object"||!v.name||!v.init)throw new Error("Invalid JSEP plugin format");this.registered[v.name]||(v.init(this.jsep),this.registered[v.name]=v)})}}class je{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+je.version}static addUnaryOp(g){return je.max_unop_len=Math.max(g.length,je.max_unop_len),je.unary_ops[g]=1,je}static addBinaryOp(g,i,a){return je.max_binop_len=Math.max(g.length,je.max_binop_len),je.binary_ops[g]=i,a?je.right_associative.add(g):je.right_associative.delete(g),je}static addIdentifierChar(g){return je.additional_identifier_chars.add(g),je}static addLiteral(g,i){return je.literals[g]=i,je}static removeUnaryOp(g){return delete je.unary_ops[g],g.length===je.max_unop_len&&(je.max_unop_len=je.getMaxKeyLen(je.unary_ops)),je}static removeAllUnaryOps(){return je.unary_ops={},je.max_unop_len=0,je}static removeIdentifierChar(g){return je.additional_identifier_chars.delete(g),je}static removeBinaryOp(g){return delete je.binary_ops[g],g.length===je.max_binop_len&&(je.max_binop_len=je.getMaxKeyLen(je.binary_ops)),je.right_associative.delete(g),je}static removeAllBinaryOps(){return je.binary_ops={},je.max_binop_len=0,je}static removeLiteral(g){return delete je.literals[g],je}static removeAllLiterals(){return je.literals={},je}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(g){this.expr=g,this.index=0}static parse(g){return new je(g).parse()}static getMaxKeyLen(g){return Math.max(0,...Object.keys(g).map(i=>i.length))}static isDecimalDigit(g){return g>=48&&g<=57}static binaryPrecedence(g){return je.binary_ops[g]||0}static isIdentifierStart(g){return g>=65&&g<=90||g>=97&&g<=122||g>=128&&!je.binary_ops[String.fromCharCode(g)]||je.additional_identifier_chars.has(String.fromCharCode(g))}static isIdentifierPart(g){return je.isIdentifierStart(g)||je.isDecimalDigit(g)}throwError(g){const i=new Error(g+" at character "+this.index);throw i.index=this.index,i.description=g,i}runHook(g,i){if(je.hooks[g]){const a={context:this,node:i};return je.hooks.run(g,a),a.node}return i}searchHook(g){if(je.hooks[g]){const i={context:this};return je.hooks[g].find(function(a){return a.call(i.context,i),i.node}),i.node}}gobbleSpaces(){let g=this.code;for(;g===je.SPACE_CODE||g===je.TAB_CODE||g===je.LF_CODE||g===je.CR_CODE;)g=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const g=this.gobbleExpressions(),i=g.length===1?g[0]:{type:je.COMPOUND,body:g};return this.runHook("after-all",i)}gobbleExpressions(g){let i=[],a,v;for(;this.index<this.expr.length;)if(a=this.code,a===je.SEMCOL_CODE||a===je.COMMA_CODE)this.index++;else if(v=this.gobbleExpression())i.push(v);else if(this.index<this.expr.length){if(a===g)break;this.throwError('Unexpected "'+this.char+'"')}return i}gobbleExpression(){const g=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",g)}gobbleBinaryOp(){this.gobbleSpaces();let g=this.expr.substr(this.index,je.max_binop_len),i=g.length;for(;i>0;){if(je.binary_ops.hasOwnProperty(g)&&(!je.isIdentifierStart(this.code)||this.index+g.length<this.expr.length&&!je.isIdentifierPart(this.expr.charCodeAt(this.index+g.length))))return this.index+=i,g;g=g.substr(0,--i)}return!1}gobbleBinaryExpression(){let g,i,a,v,A,R,V,H,re;if(R=this.gobbleToken(),!R||(i=this.gobbleBinaryOp(),!i))return R;for(A={value:i,prec:je.binaryPrecedence(i),right_a:je.right_associative.has(i)},V=this.gobbleToken(),V||this.throwError("Expected expression after "+i),v=[R,A,V];i=this.gobbleBinaryOp();){if(a=je.binaryPrecedence(i),a===0){this.index-=i.length;break}A={value:i,prec:a,right_a:je.right_associative.has(i)},re=i;const pe=Z=>A.right_a&&Z.right_a?a>Z.prec:a<=Z.prec;for(;v.length>2&&pe(v[v.length-2]);)V=v.pop(),i=v.pop().value,R=v.pop(),g={type:je.BINARY_EXP,operator:i,left:R,right:V},v.push(g);g=this.gobbleToken(),g||this.throwError("Expected expression after "+re),v.push(A,g)}for(H=v.length-1,g=v[H];H>1;)g={type:je.BINARY_EXP,operator:v[H-1].value,left:v[H-2],right:g},H-=2;return g}gobbleToken(){let g,i,a,v;if(this.gobbleSpaces(),v=this.searchHook("gobble-token"),v)return this.runHook("after-token",v);if(g=this.code,je.isDecimalDigit(g)||g===je.PERIOD_CODE)return this.gobbleNumericLiteral();if(g===je.SQUOTE_CODE||g===je.DQUOTE_CODE)v=this.gobbleStringLiteral();else if(g===je.OBRACK_CODE)v=this.gobbleArray();else{for(i=this.expr.substr(this.index,je.max_unop_len),a=i.length;a>0;){if(je.unary_ops.hasOwnProperty(i)&&(!je.isIdentifierStart(this.code)||this.index+i.length<this.expr.length&&!je.isIdentifierPart(this.expr.charCodeAt(this.index+i.length)))){this.index+=a;const A=this.gobbleToken();return A||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:je.UNARY_EXP,operator:i,argument:A,prefix:!0})}i=i.substr(0,--a)}je.isIdentifierStart(g)?(v=this.gobbleIdentifier(),je.literals.hasOwnProperty(v.name)?v={type:je.LITERAL,value:je.literals[v.name],raw:v.name}:v.name===je.this_str&&(v={type:je.THIS_EXP})):g===je.OPAREN_CODE&&(v=this.gobbleGroup())}return v?(v=this.gobbleTokenProperty(v),this.runHook("after-token",v)):this.runHook("after-token",!1)}gobbleTokenProperty(g){this.gobbleSpaces();let i=this.code;for(;i===je.PERIOD_CODE||i===je.OBRACK_CODE||i===je.OPAREN_CODE||i===je.QUMARK_CODE;){let a;if(i===je.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==je.PERIOD_CODE)break;a=!0,this.index+=2,this.gobbleSpaces(),i=this.code}this.index++,i===je.OBRACK_CODE?(g={type:je.MEMBER_EXP,computed:!0,object:g,property:this.gobbleExpression()},g.property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),i=this.code,i!==je.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):i===je.OPAREN_CODE?g={type:je.CALL_EXP,arguments:this.gobbleArguments(je.CPAREN_CODE),callee:g}:(i===je.PERIOD_CODE||a)&&(a&&this.index--,this.gobbleSpaces(),g={type:je.MEMBER_EXP,computed:!1,object:g,property:this.gobbleIdentifier()}),a&&(g.optional=!0),this.gobbleSpaces(),i=this.code}return g}gobbleNumericLiteral(){let g="",i,a;for(;je.isDecimalDigit(this.code);)g+=this.expr.charAt(this.index++);if(this.code===je.PERIOD_CODE)for(g+=this.expr.charAt(this.index++);je.isDecimalDigit(this.code);)g+=this.expr.charAt(this.index++);if(i=this.char,i==="e"||i==="E"){for(g+=this.expr.charAt(this.index++),i=this.char,(i==="+"||i==="-")&&(g+=this.expr.charAt(this.index++));je.isDecimalDigit(this.code);)g+=this.expr.charAt(this.index++);je.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+g+this.char+")")}return a=this.code,je.isIdentifierStart(a)?this.throwError("Variable names cannot start with a number ("+g+this.char+")"):(a===je.PERIOD_CODE||g.length===1&&g.charCodeAt(0)===je.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:je.LITERAL,value:parseFloat(g),raw:g}}gobbleStringLiteral(){let g="";const i=this.index,a=this.expr.charAt(this.index++);let v=!1;for(;this.index<this.expr.length;){let A=this.expr.charAt(this.index++);if(A===a){v=!0;break}else if(A==="\\")switch(A=this.expr.charAt(this.index++),A){case"n":g+=`
834
834
  `;break;case"r":g+="\r";break;case"t":g+=" ";break;case"b":g+="\b";break;case"f":g+="\f";break;case"v":g+="\v";break;default:g+=A}else g+=A}return v||this.throwError('Unclosed quote after "'+g+'"'),{type:je.LITERAL,value:g,raw:this.expr.substring(i,this.index)}}gobbleIdentifier(){let g=this.code,i=this.index;for(je.isIdentifierStart(g)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(g=this.code,je.isIdentifierPart(g));)this.index++;return{type:je.IDENTIFIER,name:this.expr.slice(i,this.index)}}gobbleArguments(g){const i=[];let a=!1,v=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let A=this.code;if(A===g){a=!0,this.index++,g===je.CPAREN_CODE&&v&&v>=i.length&&this.throwError("Unexpected token "+String.fromCharCode(g));break}else if(A===je.COMMA_CODE){if(this.index++,v++,v!==i.length){if(g===je.CPAREN_CODE)this.throwError("Unexpected token ,");else if(g===je.CBRACK_CODE)for(let R=i.length;R<v;R++)i.push(null)}}else if(i.length!==v&&v!==0)this.throwError("Expected comma");else{const R=this.gobbleExpression();(!R||R.type===je.COMPOUND)&&this.throwError("Expected comma"),i.push(R)}}return a||this.throwError("Expected "+String.fromCharCode(g)),i}gobbleGroup(){this.index++;let g=this.gobbleExpressions(je.CPAREN_CODE);if(this.code===je.CPAREN_CODE)return this.index++,g.length===1?g[0]:g.length?{type:je.SEQUENCE_EXP,expressions:g}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:je.ARRAY_EXP,elements:this.gobbleArguments(je.CBRACK_CODE)}}}const YT=new XT;Object.assign(je,{hooks:YT,plugins:new zT(je),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"});je.max_unop_len=je.getMaxKeyLen(je.unary_ops);je.max_binop_len=je.getMaxKeyLen(je.binary_ops);const Xi=f=>new je(f).parse(),KT=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(je).filter(f=>!KT.includes(f)&&Xi[f]===void 0).forEach(f=>{Xi[f]=je[f]});Xi.Jsep=je;const qT="ConditionalExpression";var JT={name:"ternary",init(f){f.hooks.add("after-expression",function(i){if(i.node&&this.code===f.QUMARK_CODE){this.index++;const a=i.node,v=this.gobbleExpression();if(v||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===f.COLON_CODE){this.index++;const A=this.gobbleExpression();if(A||this.throwError("Expected expression"),i.node={type:qT,test:a,consequent:v,alternate:A},a.operator&&f.binary_ops[a.operator]<=.9){let R=a;for(;R.right.operator&&f.binary_ops[R.right.operator]<=.9;)R=R.right;i.node.test=R.right,R.right=i.node,i.node=a}}else this.throwError("Expected :")}})}};Xi.plugins.register(JT);const F_=47,QT=92;var ZT={name:"regex",init(f){f.hooks.add("gobble-token",function(i){if(this.code===F_){const a=++this.index;let v=!1;for(;this.index<this.expr.length;){if(this.code===F_&&!v){const A=this.expr.slice(a,this.index);let R="";for(;++this.index<this.expr.length;){const H=this.code;if(H>=97&&H<=122||H>=65&&H<=90||H>=48&&H<=57)R+=this.char;else break}let V;try{V=new RegExp(A,R)}catch(H){this.throwError(H.message)}return i.node={type:f.LITERAL,value:V,raw:this.expr.slice(a-1,this.index)},i.node=this.gobbleTokenProperty(i.node),i.node}this.code===f.OBRACK_CODE?v=!0:v&&this.code===f.CBRACK_CODE&&(v=!1),this.index+=this.code===QT?2:1}this.throwError("Unclosed Regex")}})}};const qg=43,eb=45,ld={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[qg,eb],assignmentPrecedence:.9,init(f){const g=[f.IDENTIFIER,f.MEMBER_EXP];ld.assignmentOperators.forEach(a=>f.addBinaryOp(a,ld.assignmentPrecedence,!0)),f.hooks.add("gobble-token",function(v){const A=this.code;ld.updateOperators.some(R=>R===A&&R===this.expr.charCodeAt(this.index+1))&&(this.index+=2,v.node={type:"UpdateExpression",operator:A===qg?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},(!v.node.argument||!g.includes(v.node.argument.type))&&this.throwError(`Unexpected ${v.node.operator}`))}),f.hooks.add("after-token",function(v){if(v.node){const A=this.code;ld.updateOperators.some(R=>R===A&&R===this.expr.charCodeAt(this.index+1))&&(g.includes(v.node.type)||this.throwError(`Unexpected ${v.node.operator}`),this.index+=2,v.node={type:"UpdateExpression",operator:A===qg?"++":"--",argument:v.node,prefix:!1})}}),f.hooks.add("after-expression",function(v){v.node&&i(v.node)});function i(a){ld.assignmentOperators.has(a.operator)?(a.type="AssignmentExpression",i(a.left),i(a.right)):a.operator||Object.values(a).forEach(v=>{v&&typeof v=="object"&&i(v)})}}};Xi.plugins.register(ZT,ld);Xi.addUnaryOp("typeof");Xi.addLiteral("null",null);Xi.addLiteral("undefined",void 0);const tb=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),hr={evalAst(f,g){switch(f.type){case"BinaryExpression":case"LogicalExpression":return hr.evalBinaryExpression(f,g);case"Compound":return hr.evalCompound(f,g);case"ConditionalExpression":return hr.evalConditionalExpression(f,g);case"Identifier":return hr.evalIdentifier(f,g);case"Literal":return hr.evalLiteral(f,g);case"MemberExpression":return hr.evalMemberExpression(f,g);case"UnaryExpression":return hr.evalUnaryExpression(f,g);case"ArrayExpression":return hr.evalArrayExpression(f,g);case"CallExpression":return hr.evalCallExpression(f,g);case"AssignmentExpression":return hr.evalAssignmentExpression(f,g);default:throw SyntaxError("Unexpected expression",f)}},evalBinaryExpression(f,g){return{"||":(a,v)=>a||v(),"&&":(a,v)=>a&&v(),"|":(a,v)=>a|v(),"^":(a,v)=>a^v(),"&":(a,v)=>a&v(),"==":(a,v)=>a==v(),"!=":(a,v)=>a!=v(),"===":(a,v)=>a===v(),"!==":(a,v)=>a!==v(),"<":(a,v)=>a<v(),">":(a,v)=>a>v(),"<=":(a,v)=>a<=v(),">=":(a,v)=>a>=v(),"<<":(a,v)=>a<<v(),">>":(a,v)=>a>>v(),">>>":(a,v)=>a>>>v(),"+":(a,v)=>a+v(),"-":(a,v)=>a-v(),"*":(a,v)=>a*v(),"/":(a,v)=>a/v(),"%":(a,v)=>a%v()}[f.operator](hr.evalAst(f.left,g),()=>hr.evalAst(f.right,g))},evalCompound(f,g){let i;for(let a=0;a<f.body.length;a++){f.body[a].type==="Identifier"&&["var","let","const"].includes(f.body[a].name)&&f.body[a+1]&&f.body[a+1].type==="AssignmentExpression"&&(a+=1);const v=f.body[a];i=hr.evalAst(v,g)}return i},evalConditionalExpression(f,g){return hr.evalAst(f.test,g)?hr.evalAst(f.consequent,g):hr.evalAst(f.alternate,g)},evalIdentifier(f,g){if(Object.hasOwn(g,f.name))return g[f.name];throw ReferenceError(`${f.name} is not defined`)},evalLiteral(f){return f.value},evalMemberExpression(f,g){const i=String(f.computed?hr.evalAst(f.property):f.property.name),a=hr.evalAst(f.object,g);if(a==null)throw TypeError(`Cannot read properties of ${a} (reading '${i}')`);if(!Object.hasOwn(a,i)&&tb.has(i))throw TypeError(`Cannot read properties of ${a} (reading '${i}')`);const v=a[i];return typeof v=="function"?v.bind(a):v},evalUnaryExpression(f,g){return{"-":a=>-hr.evalAst(a,g),"!":a=>!hr.evalAst(a,g),"~":a=>~hr.evalAst(a,g),"+":a=>+hr.evalAst(a,g),typeof:a=>typeof hr.evalAst(a,g)}[f.operator](f.argument)},evalArrayExpression(f,g){return f.elements.map(i=>hr.evalAst(i,g))},evalCallExpression(f,g){const i=f.arguments.map(v=>hr.evalAst(v,g));return hr.evalAst(f.callee,g)(...i)},evalAssignmentExpression(f,g){if(f.left.type!=="Identifier")throw SyntaxError("Invalid left-hand side in assignment");const i=f.left.name,a=hr.evalAst(f.right,g);return g[i]=a,g[i]}};class rb{constructor(g){this.code=g,this.ast=Xi(this.code)}runInNewContext(g){const i=Object.assign(Object.create(null),g);return hr.evalAst(this.ast,i)}}function Ll(f,g){return f=f.slice(),f.push(g),f}function nf(f,g){return g=g.slice(),g.unshift(f),g}class nb extends Error{constructor(g){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=g,this.name="NewError"}}function Jt(f,g,i,a,v){if(!(this instanceof Jt))try{return new Jt(f,g,i,a,v)}catch(R){if(!R.avoidNew)throw R;return R.value}typeof f=="string"&&(v=a,a=i,i=g,g=f,f=null);const A=f&&typeof f=="object";if(f=f||{},this.json=f.json||i,this.path=f.path||g,this.resultType=f.resultType||"value",this.flatten=f.flatten||!1,this.wrap=Object.hasOwn(f,"wrap")?f.wrap:!0,this.sandbox=f.sandbox||{},this.eval=f.eval===void 0?"safe":f.eval,this.ignoreEvalErrors=typeof f.ignoreEvalErrors>"u"?!1:f.ignoreEvalErrors,this.parent=f.parent||null,this.parentProperty=f.parentProperty||null,this.callback=f.callback||a||null,this.otherTypeCallback=f.otherTypeCallback||v||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},f.autostart!==!1){const R={path:A?f.path:g};A?"json"in f&&(R.json=f.json):R.json=i;const V=this.evaluate(R);if(!V||typeof V!="object")throw new nb(V);return V}}Jt.prototype.evaluate=function(f,g,i,a){let v=this.parent,A=this.parentProperty,{flatten:R,wrap:V}=this;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,i=i||this.callback,this.currOtherTypeCallback=a||this.otherTypeCallback,g=g||this.json,f=f||this.path,f&&typeof f=="object"&&!Array.isArray(f)){if(!f.path&&f.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Object.hasOwn(f,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:g}=f),R=Object.hasOwn(f,"flatten")?f.flatten:R,this.currResultType=Object.hasOwn(f,"resultType")?f.resultType:this.currResultType,this.currSandbox=Object.hasOwn(f,"sandbox")?f.sandbox:this.currSandbox,V=Object.hasOwn(f,"wrap")?f.wrap:V,this.currEval=Object.hasOwn(f,"eval")?f.eval:this.currEval,i=Object.hasOwn(f,"callback")?f.callback:i,this.currOtherTypeCallback=Object.hasOwn(f,"otherTypeCallback")?f.otherTypeCallback:this.currOtherTypeCallback,v=Object.hasOwn(f,"parent")?f.parent:v,A=Object.hasOwn(f,"parentProperty")?f.parentProperty:A,f=f.path}if(v=v||null,A=A||null,Array.isArray(f)&&(f=Jt.toPathString(f)),!f&&f!==""||!g)return;const H=Jt.toPathArray(f);H[0]==="$"&&H.length>1&&H.shift(),this._hasParentSelector=null;const re=this._trace(H,g,["$"],v,A,i).filter(function(pe){return pe&&!pe.isParentSelector});return re.length?!V&&re.length===1&&!re[0].hasArrExpr?this._getPreferredOutput(re[0]):re.reduce((pe,Z)=>{const W=this._getPreferredOutput(Z);return R&&Array.isArray(W)?pe=pe.concat(W):pe.push(W),pe},[]):V?[]:void 0};Jt.prototype._getPreferredOutput=function(f){const g=this.currResultType;switch(g){case"all":{const i=Array.isArray(f.path)?f.path:Jt.toPathArray(f.path);return f.pointer=Jt.toPointer(i),f.path=typeof f.path=="string"?f.path:Jt.toPathString(f.path),f}case"value":case"parent":case"parentProperty":return f[g];case"path":return Jt.toPathString(f[g]);case"pointer":return Jt.toPointer(f.path);default:throw new TypeError("Unknown result type")}};Jt.prototype._handleCallback=function(f,g,i){if(g){const a=this._getPreferredOutput(f);f.path=typeof f.path=="string"?f.path:Jt.toPathString(f.path),g(a,i,f)}};Jt.prototype._trace=function(f,g,i,a,v,A,R,V){let H;if(!f.length)return H={path:i,value:g,parent:a,parentProperty:v,hasArrExpr:R},this._handleCallback(H,A,"value"),H;const re=f[0],pe=f.slice(1),Z=[];function W(X){Array.isArray(X)?X.forEach(te=>{Z.push(te)}):Z.push(X)}if((typeof re!="string"||V)&&g&&Object.hasOwn(g,re))W(this._trace(pe,g[re],Ll(i,re),g,re,A,R));else if(re==="*")this._walk(g,X=>{W(this._trace(pe,g[X],Ll(i,X),g,X,A,!0,!0))});else if(re==="..")W(this._trace(pe,g,i,a,v,A,R)),this._walk(g,X=>{typeof g[X]=="object"&&W(this._trace(f.slice(),g[X],Ll(i,X),g,X,A,!0))});else{if(re==="^")return this._hasParentSelector=!0,{path:i.slice(0,-1),expr:pe,isParentSelector:!0};if(re==="~")return H={path:Ll(i,re),value:v,parent:a,parentProperty:null},this._handleCallback(H,A,"property"),H;if(re==="$")W(this._trace(pe,g,i,null,null,A,R));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(re))W(this._slice(re,pe,g,i,a,v,A));else if(re.indexOf("?(")===0){if(this.currEval===!1)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");const X=re.replace(/^\?\((.*?)\)$/u,"$1"),te=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(X);te?this._walk(g,ve=>{const De=[te[2]],Me=te[1]?g[ve][te[1]]:g[ve];this._trace(De,Me,i,a,v,A,!0).length>0&&W(this._trace(pe,g[ve],Ll(i,ve),g,ve,A,!0))}):this._walk(g,ve=>{this._eval(X,g[ve],ve,i,a,v)&&W(this._trace(pe,g[ve],Ll(i,ve),g,ve,A,!0))})}else if(re[0]==="("){if(this.currEval===!1)throw new Error("Eval [(expr)] prevented in JSONPath expression.");W(this._trace(nf(this._eval(re,g,i.at(-1),i.slice(0,-1),a,v),pe),g,i,a,v,A,R))}else if(re[0]==="@"){let X=!1;const te=re.slice(1,-2);switch(te){case"scalar":(!g||!["object","function"].includes(typeof g))&&(X=!0);break;case"boolean":case"string":case"undefined":case"function":typeof g===te&&(X=!0);break;case"integer":Number.isFinite(g)&&!(g%1)&&(X=!0);break;case"number":Number.isFinite(g)&&(X=!0);break;case"nonFinite":typeof g=="number"&&!Number.isFinite(g)&&(X=!0);break;case"object":g&&typeof g===te&&(X=!0);break;case"array":Array.isArray(g)&&(X=!0);break;case"other":X=this.currOtherTypeCallback(g,i,a,v);break;case"null":g===null&&(X=!0);break;default:throw new TypeError("Unknown value type "+te)}if(X)return H={path:i,value:g,parent:a,parentProperty:v},this._handleCallback(H,A,"value"),H}else if(re[0]==="`"&&g&&Object.hasOwn(g,re.slice(1))){const X=re.slice(1);W(this._trace(pe,g[X],Ll(i,X),g,X,A,R,!0))}else if(re.includes(",")){const X=re.split(",");for(const te of X)W(this._trace(nf(te,pe),g,i,a,v,A,!0))}else!V&&g&&Object.hasOwn(g,re)&&W(this._trace(pe,g[re],Ll(i,re),g,re,A,R,!0))}if(this._hasParentSelector)for(let X=0;X<Z.length;X++){const te=Z[X];if(te&&te.isParentSelector){const ve=this._trace(te.expr,g,te.path,a,v,A,R);if(Array.isArray(ve)){Z[X]=ve[0];const De=ve.length;for(let Me=1;Me<De;Me++)X++,Z.splice(X,0,ve[Me])}else Z[X]=ve}}return Z};Jt.prototype._walk=function(f,g){if(Array.isArray(f)){const i=f.length;for(let a=0;a<i;a++)g(a)}else f&&typeof f=="object"&&Object.keys(f).forEach(i=>{g(i)})};Jt.prototype._slice=function(f,g,i,a,v,A,R){if(!Array.isArray(i))return;const V=i.length,H=f.split(":"),re=H[2]&&Number.parseInt(H[2])||1;let pe=H[0]&&Number.parseInt(H[0])||0,Z=H[1]&&Number.parseInt(H[1])||V;pe=pe<0?Math.max(0,pe+V):Math.min(V,pe),Z=Z<0?Math.max(0,Z+V):Math.min(V,Z);const W=[];for(let X=pe;X<Z;X+=re)this._trace(nf(X,g),i,a,v,A,R,!0).forEach(ve=>{W.push(ve)});return W};Jt.prototype._eval=function(f,g,i,a,v,A){this.currSandbox._$_parentProperty=A,this.currSandbox._$_parent=v,this.currSandbox._$_property=i,this.currSandbox._$_root=this.json,this.currSandbox._$_v=g;const R=f.includes("@path");R&&(this.currSandbox._$_path=Jt.toPathString(a.concat([i])));const V=this.currEval+"Script:"+f;if(!Jt.cache[V]){let H=f.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(R&&(H=H.replaceAll("@path","_$_path")),this.currEval==="safe"||this.currEval===!0||this.currEval===void 0)Jt.cache[V]=new this.safeVm.Script(H);else if(this.currEval==="native")Jt.cache[V]=new this.vm.Script(H);else if(typeof this.currEval=="function"&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){const re=this.currEval;Jt.cache[V]=new re(H)}else if(typeof this.currEval=="function")Jt.cache[V]={runInNewContext:re=>this.currEval(H,re)};else throw new TypeError(`Unknown "eval" property "${this.currEval}"`)}try{return Jt.cache[V].runInNewContext(this.currSandbox)}catch(H){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+H.message+": "+f)}};Jt.cache={};Jt.toPathString=function(f){const g=f,i=g.length;let a="$";for(let v=1;v<i;v++)/^(~|\^|@.*?\(\))$/u.test(g[v])||(a+=/^[0-9*]+$/u.test(g[v])?"["+g[v]+"]":"['"+g[v]+"']");return a};Jt.toPointer=function(f){const g=f,i=g.length;let a="";for(let v=1;v<i;v++)/^(~|\^|@.*?\(\))$/u.test(g[v])||(a+="/"+g[v].toString().replaceAll("~","~0").replaceAll("/","~1"));return a};Jt.toPathArray=function(f){const{cache:g}=Jt;if(g[f])return g[f].concat();const i=[],v=f.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu,function(A,R){return"[#"+(i.push(R)-1)+"]"}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu,function(A,R){return"['"+R.replaceAll(".","%@%").replaceAll("~","%%@@%%")+"']"}).replaceAll("~",";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replaceAll("%@%",".").replaceAll("%%@@%%","~").replaceAll(/(?:;)?(\^+)(?:;)?/gu,function(A,R){return";"+R.split("").join(";")+";"}).replaceAll(/;;;|;;/gu,";..;").replaceAll(/;$|'?\]|'$/gu,"").split(";").map(function(A){const R=A.match(/#(\d+)/u);return!R||!R[1]?A:i[R[1]]});return g[f]=v,g[f].concat()};Jt.prototype.safeVm={Script:rb};const sb=function(f,g,i){const a=f.length;for(let v=0;v<a;v++){const A=f[v];i(A)&&g.push(f.splice(v--,1)[0])}};class ob{constructor(g){this.code=g}runInNewContext(g){let i=this.code;const a=Object.keys(g),v=[];sb(a,v,re=>typeof g[re]=="function");const A=a.map(re=>g[re]);i=v.reduce((re,pe)=>{let Z=g[pe].toString();return/function/u.test(Z)||(Z="function "+Z),"var "+pe+"="+Z+";"+re},"")+i,!/(['"])use strict\1/u.test(i)&&!a.includes("arguments")&&(i="var arguments = undefined;"+i),i=i.replace(/;\s*$/u,"");const V=i.lastIndexOf(";"),H=V!==-1?i.slice(0,V+1)+" return "+i.slice(V+1):" return "+i;return new Function(...a,H)(...A)}}Jt.prototype.vm={Script:ob};var Jg={},P_;function ib(){return P_||(P_=1,(function(f){var g=f;(function(i){var a="__namespace",v=function(l){return l==null},A=function(l){return l===a||Number.isInteger(l)&&l>=1&&l<=11},R=function(l){return l&&A(l.nodeType)&&typeof l.nodeName=="string"};function V(l){var N=Array.prototype.slice,F=l.length,Q=function(ie,ct){return function(){return ct.apply(this,ie.concat(N.call(arguments)))}},G=function(){var ie=N.call(arguments);return ie.length<F?Q(ie,G):l.apply(this,N.apply(arguments,[0,F]))};return G}var H=function(l,N){for(var F=0;F<N.length;F+=1)l(N[F],F,N)},re=function(l,N,F){var Q=N;return H(function(G,ie){Q=l(Q,G,ie)},F),Q},pe=function(l,N){var F=new Array(N.length);return H(function(Q,G){F[G]=l(Q)},N),F},Z=function(l,N){var F=[];return H(function(Q,G){l(Q,G)&&F.push(Q)},N),F},W=function(l,N){for(var F=0;F<l.length;F+=1)if(l[F]===N)return!0;return!1};function X(l){return function(){return l}}function te(l){return l.toString()}var ve=function(l,N){return N.join(l)},De=function(l,N,F){return l+F+N},Me=Array.prototype.concat,Pe=function(l,N){var F=new j;F.addArray(l);var Q=F.toArray();return N?Q.reverse():Q},ut=32767;function ot(l){for(var N=[],F=0;F<l.length;F+=ut){var Q=l.slice(F,F+ut);N=Me.apply(N,Q)}return N}function $t(l,N){for(var F=Object(l),Q=1;Q<arguments.length;Q++){var G=arguments[Q];if(G!=null)for(var ie in G)Object.prototype.hasOwnProperty.call(G,ie)&&(F[ie]=G[ie])}return F}var Ve={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NAMESPACE_NODE:a};ne.prototype=new Object,ne.prototype.constructor=ne,ne.superclass=Object.prototype;function ne(){this.init()}ne.prototype.init=function(){this.reduceActions=[],this.reduceActions[3]=function(l){return new we(l[0],l[2])},this.reduceActions[5]=function(l){return new Ze(l[0],l[2])},this.reduceActions[7]=function(l){return new Le(l[0],l[2])},this.reduceActions[8]=function(l){return new _e(l[0],l[2])},this.reduceActions[10]=function(l){return new ce(l[0],l[2])},this.reduceActions[11]=function(l){return new xe(l[0],l[2])},this.reduceActions[12]=function(l){return new se(l[0],l[2])},this.reduceActions[13]=function(l){return new ee(l[0],l[2])},this.reduceActions[15]=function(l){return new ae(l[0],l[2])},this.reduceActions[16]=function(l){return new et(l[0],l[2])},this.reduceActions[18]=function(l){return new Ae(l[0],l[2])},this.reduceActions[19]=function(l){return new lt(l[0],l[2])},this.reduceActions[20]=function(l){return new Ye(l[0],l[2])},this.reduceActions[22]=function(l){return new it(l[1])},this.reduceActions[24]=function(l){return new gt(l[0],l[2])},this.reduceActions[25]=function(l){return new nt(void 0,void 0,l[0])},this.reduceActions[27]=function(l){return l[0].locationPath=l[2],l[0]},this.reduceActions[28]=function(l){return l[0].locationPath=l[2],l[0].locationPath.steps.unshift(new B(B.DESCENDANTORSELF,q.nodeTest,[])),l[0]},this.reduceActions[29]=function(l){return new nt(l[0],[],void 0)},this.reduceActions[30]=function(l){return M.instance_of(l[0],nt)?(l[0].filterPredicates==null&&(l[0].filterPredicates=[]),l[0].filterPredicates.push(l[1]),l[0]):new nt(l[0],[l[1]],void 0)},this.reduceActions[32]=function(l){return l[1]},this.reduceActions[33]=function(l){return new $e(l[0])},this.reduceActions[34]=function(l){return new he(l[0])},this.reduceActions[36]=function(l){return new ge(l[0],[])},this.reduceActions[37]=function(l){return new ge(l[0],l[2])},this.reduceActions[38]=function(l){return[l[0]]},this.reduceActions[39]=function(l){return l[2].unshift(l[0]),l[2]},this.reduceActions[43]=function(l){return new U(!0,[])},this.reduceActions[44]=function(l){return l[1].absolute=!0,l[1]},this.reduceActions[46]=function(l){return new U(!1,[l[0]])},this.reduceActions[47]=function(l){return l[0].steps.push(l[2]),l[0]},this.reduceActions[49]=function(l){return new B(l[0],l[1],[])},this.reduceActions[50]=function(l){return new B(B.CHILD,l[0],[])},this.reduceActions[51]=function(l){return new B(l[0],l[1],l[2])},this.reduceActions[52]=function(l){return new B(B.CHILD,l[0],l[1])},this.reduceActions[54]=function(l){return[l[0]]},this.reduceActions[55]=function(l){return l[1].unshift(l[0]),l[1]},this.reduceActions[56]=function(l){return l[0]=="ancestor"?B.ANCESTOR:l[0]=="ancestor-or-self"?B.ANCESTORORSELF:l[0]=="attribute"?B.ATTRIBUTE:l[0]=="child"?B.CHILD:l[0]=="descendant"?B.DESCENDANT:l[0]=="descendant-or-self"?B.DESCENDANTORSELF:l[0]=="following"?B.FOLLOWING:l[0]=="following-sibling"?B.FOLLOWINGSIBLING:l[0]=="namespace"?B.NAMESPACE:l[0]=="parent"?B.PARENT:l[0]=="preceding"?B.PRECEDING:l[0]=="preceding-sibling"?B.PRECEDINGSIBLING:l[0]=="self"?B.SELF:-1},this.reduceActions[57]=function(l){return B.ATTRIBUTE},this.reduceActions[59]=function(l){return l[0]=="comment"?q.commentTest:l[0]=="text"?q.textTest:l[0]=="processing-instruction"?q.anyPiTest:l[0]=="node"?q.nodeTest:new q(-1,void 0)},this.reduceActions[60]=function(l){return new q.PITest(l[2])},this.reduceActions[61]=function(l){return l[1]},this.reduceActions[63]=function(l){return l[1].absolute=!0,l[1].steps.unshift(new B(B.DESCENDANTORSELF,q.nodeTest,[])),l[1]},this.reduceActions[64]=function(l){return l[0].steps.push(new B(B.DESCENDANTORSELF,q.nodeTest,[])),l[0].steps.push(l[2]),l[0]},this.reduceActions[65]=function(l){return new B(B.SELF,q.nodeTest,[])},this.reduceActions[66]=function(l){return new B(B.PARENT,q.nodeTest,[])},this.reduceActions[67]=function(l){return new Ue(l[1])},this.reduceActions[68]=function(l){return q.nameTestAny},this.reduceActions[69]=function(l){return new q.NameTestPrefixAny(l[0].split(":")[0])},this.reduceActions[70]=function(l){return new q.NameTestQName(l[0])}},ne.actionTable=[" s s sssssssss s ss s ss"," s ","r rrrrrrrrr rrrrrrr rr r "," rrrrr "," s s sssssssss s ss s ss","rs rrrrrrrr s sssssrrrrrr rrs rs "," s s sssssssss s ss s ss"," s "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s "," s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr r ","a ","r s rr r ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrs rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r srrrrrrrr rrrrrrs rr sr ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r "," sssss ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrr rrrrr rr r "," s "," s "," rrrrr "," s s sssssssss s sss s ss","r srrrrrrrr rrrrrrs rr r "," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss ss s ss"," s s sssssssss s ss s ss"," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr rr "," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," rr "," s "," rs ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrr rr r "," r "," s ","r srrrrrrrr rrrrrrs rr r ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s s sssssssss s ss s ss","r rrrrrrrrr rrrrrrr rr rr "," r "],ne.actionTableNumber=[` 1 0 /.-,+*)(' & %$ # "!`," J ","a aaaaaaaaa aaaaaaa aa a "," YYYYY ",` 1 0 /.-,+*)(' & %$ # "!`,`K1 KKKKKKKK . +*)('KKKKKK KK# K" `,` 1 0 /.-,+*)(' & %$ # "!`," N "," O ","e eeeeeeeee eeeeeee ee ee ","f fffffffff fffffff ff ff ","d ddddddddd ddddddd dd dd ","B BBBBBBBBB BBBBBBB BB BB ","A AAAAAAAAA AAAAAAA AA AA "," P "," Q ",` 1 . +*)(' # " `,"b bbbbbbbbb bbbbbbb bb b "," ","! S !! ! ",'" T" "" " ',"$ V $$ U $$ $ ","& &ZY&& &XW && & ",") ))))) )))\\[ )) ) ",". ....._^] ..... .. . ","1 11111111 11111 11 1 ","5 55555555 55555` 55 5 ","7 77777777 777777 77 7 ","9 99999999 999999 99 9 ",": c:::::::: ::::::b :: a: ","I fIIIIIIII IIIIIIe II I ","= ========= ======= == == ","? ????????? ??????? ?? ?? ","C CCCCCCCCC CCCCCCC CC CC ","J JJJJJJJJ JJJJJJ JJ J ","M MMMMMMMM MMMMMM MM M ","N NNNNNNNNN NNNNNNN NN N ","P PPPPPPPPP PPPPPPP PP P "," +*)(' ","R RRRRRRRRR RRRRRRR RR aR ","U UUUUUUUUU UUUUUUU UU U ","Z ZZZZZZZZZ ZZZZZZZ ZZ ZZ ","c ccccccccc ccccccc cc cc "," j ","L fLLLLLLLL LLLLLLe LL L ","6 66666666 66666 66 6 "," k "," l "," XXXXX ",` 1 0 /.-,+*)(' & %$m # "!`,"_ f________ ______e __ _ ",` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 . +*)(' # " `,` 1 . +*)(' # " `,"> >>>>>>>>> >>>>>>> >> >> ",` 1 . +*)(' # " `,` 1 . +*)(' # " `,"Q QQQQQQQQQ QQQQQQQ QQ aQ ","V VVVVVVVVV VVVVVVV VV aV ","T TTTTTTTTT TTTTTTT TT T ","@ @@@@@@@@@ @@@@@@@ @@ @@ "," ‡ ","[ [[[[[[[[[ [[[[[[[ [[ [[ ","D DDDDDDDDD DDDDDDD DD DD "," HH "," ˆ "," F‰ ","# T# ## # ","% V %% U %% % ","' 'ZY'' 'XW '' ' ","( (ZY(( (XW (( ( ","+ +++++ +++\\[ ++ + ","* ***** ***\\[ ** * ","- ----- ---\\[ -- - ",", ,,,,, ,,,\\[ ,, , ","0 00000_^] 00000 00 0 ","/ /////_^] ///// // / ","2 22222222 22222 22 2 ","3 33333333 33333 33 3 ","4 44444444 44444 44 4 ","8 88888888 888888 88 8 "," ^ "," Š ","; f;;;;;;;; ;;;;;;e ;; ; ","< f<<<<<<<< <<<<<<e << < ","O OOOOOOOOO OOOOOOO OO O ","` ````````` ``````` `` ` ","S SSSSSSSSS SSSSSSS SS S ","W WWWWWWWWW WWWWWWW WW W ","\\ \\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\ \\\\ \\\\ ","E EEEEEEEEE EEEEEEE EE EE ",` 1 0 /.-,+*)(' & %$ # "!`,"] ]]]]]]]]] ]]]]]]] ]] ]] "," G "],ne.gotoTable=["3456789:;<=>?@ AB CDEFGH IJ "," "," "," ","L456789:;<=>?@ AB CDEFGH IJ "," M EFGH IJ "," N;<=>?@ AB CDEFGH IJ "," "," "," "," "," "," "," "," "," "," S EFGH IJ "," "," "," "," "," "," "," "," "," "," "," "," "," e "," "," "," "," "," "," "," "," "," h J "," i j "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ ABpqCDEFGH IJ "," "," r6789:;<=>?@ AB CDEFGH IJ "," s789:;<=>?@ AB CDEFGH IJ "," t89:;<=>?@ AB CDEFGH IJ "," u89:;<=>?@ AB CDEFGH IJ "," v9:;<=>?@ AB CDEFGH IJ "," w9:;<=>?@ AB CDEFGH IJ "," x9:;<=>?@ AB CDEFGH IJ "," y9:;<=>?@ AB CDEFGH IJ "," z:;<=>?@ AB CDEFGH IJ "," {:;<=>?@ AB CDEFGH IJ "," |;<=>?@ AB CDEFGH IJ "," };<=>?@ AB CDEFGH IJ "," ~;<=>?@ AB CDEFGH IJ "," =>?@ AB CDEFGH IJ ","€456789:;<=>?@ AB CDEFGH IJ"," ‚ EFGH IJ "," ƒ EFGH IJ "," "," „ GH IJ "," … GH IJ "," i † "," i ‡ "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ ABŒqCDEFGH IJ "," "," "],ne.productions=[[1,1,2],[2,1,3],[3,1,4],[3,3,3,-9,4],[4,1,5],[4,3,4,-8,5],[5,1,6],[5,3,5,-22,6],[5,3,5,-5,6],[6,1,7],[6,3,6,-23,7],[6,3,6,-24,7],[6,3,6,-6,7],[6,3,6,-7,7],[7,1,8],[7,3,7,-25,8],[7,3,7,-26,8],[8,1,9],[8,3,8,-12,9],[8,3,8,-11,9],[8,3,8,-10,9],[9,1,10],[9,2,-26,9],[10,1,11],[10,3,10,-27,11],[11,1,12],[11,1,13],[11,3,13,-28,14],[11,3,13,-4,14],[13,1,15],[13,2,13,16],[15,1,17],[15,3,-29,2,-30],[15,1,-15],[15,1,-16],[15,1,18],[18,3,-13,-29,-30],[18,4,-13,-29,19,-30],[19,1,20],[19,3,20,-31,19],[20,1,2],[12,1,14],[12,1,21],[21,1,-28],[21,2,-28,14],[21,1,22],[14,1,23],[14,3,14,-28,23],[14,1,24],[23,2,25,26],[23,1,26],[23,3,25,26,27],[23,2,26,27],[23,1,28],[27,1,16],[27,2,16,27],[25,2,-14,-3],[25,1,-32],[26,1,29],[26,3,-20,-29,-30],[26,4,-21,-29,-15,-30],[16,3,-33,30,-34],[30,1,2],[22,2,-4,14],[24,3,14,-4,23],[28,1,-35],[28,1,-2],[17,2,-36,-18],[29,1,-17],[29,1,-19],[29,1,-18]],ne.DOUBLEDOT=2,ne.DOUBLECOLON=3,ne.DOUBLESLASH=4,ne.NOTEQUAL=5,ne.LESSTHANOREQUAL=6,ne.GREATERTHANOREQUAL=7,ne.AND=8,ne.OR=9,ne.MOD=10,ne.DIV=11,ne.MULTIPLYOPERATOR=12,ne.FUNCTIONNAME=13,ne.AXISNAME=14,ne.LITERAL=15,ne.NUMBER=16,ne.ASTERISKNAMETEST=17,ne.QNAME=18,ne.NCNAMECOLONASTERISK=19,ne.NODETYPE=20,ne.PROCESSINGINSTRUCTIONWITHLITERAL=21,ne.EQUALS=22,ne.LESSTHAN=23,ne.GREATERTHAN=24,ne.PLUS=25,ne.MINUS=26,ne.BAR=27,ne.SLASH=28,ne.LEFTPARENTHESIS=29,ne.RIGHTPARENTHESIS=30,ne.COMMA=31,ne.AT=32,ne.LEFTBRACKET=33,ne.RIGHTBRACKET=34,ne.DOT=35,ne.DOLLAR=36,ne.prototype.tokenize=function(l){for(var N=[],F=[],Q=l+"\0",G=0,ie=Q.charAt(G++);;){for(;ie==" "||ie==" "||ie=="\r"||ie==`
835
835
  `;)ie=Q.charAt(G++);if(ie=="\0"||G>=Q.length)break;if(ie=="("){N.push(ne.LEFTPARENTHESIS),F.push(ie),ie=Q.charAt(G++);continue}if(ie==")"){N.push(ne.RIGHTPARENTHESIS),F.push(ie),ie=Q.charAt(G++);continue}if(ie=="["){N.push(ne.LEFTBRACKET),F.push(ie),ie=Q.charAt(G++);continue}if(ie=="]"){N.push(ne.RIGHTBRACKET),F.push(ie),ie=Q.charAt(G++);continue}if(ie=="@"){N.push(ne.AT),F.push(ie),ie=Q.charAt(G++);continue}if(ie==","){N.push(ne.COMMA),F.push(ie),ie=Q.charAt(G++);continue}if(ie=="|"){N.push(ne.BAR),F.push(ie),ie=Q.charAt(G++);continue}if(ie=="+"){N.push(ne.PLUS),F.push(ie),ie=Q.charAt(G++);continue}if(ie=="-"){N.push(ne.MINUS),F.push(ie),ie=Q.charAt(G++);continue}if(ie=="="){N.push(ne.EQUALS),F.push(ie),ie=Q.charAt(G++);continue}if(ie=="$"){N.push(ne.DOLLAR),F.push(ie),ie=Q.charAt(G++);continue}if(ie=="."){if(ie=Q.charAt(G++),ie=="."){N.push(ne.DOUBLEDOT),F.push(".."),ie=Q.charAt(G++);continue}if(ie>="0"&&ie<="9"){var ct="."+ie;for(ie=Q.charAt(G++);ie>="0"&&ie<="9";)ct+=ie,ie=Q.charAt(G++);N.push(ne.NUMBER),F.push(ct);continue}N.push(ne.DOT),F.push(".");continue}if(ie=="'"||ie=='"'){for(var Mt=ie,Ft="";G<Q.length&&(ie=Q.charAt(G))!==Mt;)Ft+=ie,G+=1;if(ie!==Mt)throw fe.fromMessage("Unterminated string literal: "+Mt+Ft);G+=1,N.push(ne.LITERAL),F.push(Ft),ie=Q.charAt(G++);continue}if(ie>="0"&&ie<="9"){var ct=ie;for(ie=Q.charAt(G++);ie>="0"&&ie<="9";)ct+=ie,ie=Q.charAt(G++);if(ie=="."&&Q.charAt(G)>="0"&&Q.charAt(G)<="9")for(ct+=ie,ct+=Q.charAt(G++),ie=Q.charAt(G++);ie>="0"&&ie<="9";)ct+=ie,ie=Q.charAt(G++);N.push(ne.NUMBER),F.push(ct);continue}if(ie=="*"){if(N.length>0){var ft=N[N.length-1];if(ft!=ne.AT&&ft!=ne.DOUBLECOLON&&ft!=ne.LEFTPARENTHESIS&&ft!=ne.LEFTBRACKET&&ft!=ne.AND&&ft!=ne.OR&&ft!=ne.MOD&&ft!=ne.DIV&&ft!=ne.MULTIPLYOPERATOR&&ft!=ne.SLASH&&ft!=ne.DOUBLESLASH&&ft!=ne.BAR&&ft!=ne.PLUS&&ft!=ne.MINUS&&ft!=ne.EQUALS&&ft!=ne.NOTEQUAL&&ft!=ne.LESSTHAN&&ft!=ne.LESSTHANOREQUAL&&ft!=ne.GREATERTHAN&&ft!=ne.GREATERTHANOREQUAL){N.push(ne.MULTIPLYOPERATOR),F.push(ie),ie=Q.charAt(G++);continue}}N.push(ne.ASTERISKNAMETEST),F.push(ie),ie=Q.charAt(G++);continue}if(ie==":"&&Q.charAt(G)==":"){N.push(ne.DOUBLECOLON),F.push("::"),G++,ie=Q.charAt(G++);continue}if(ie=="/"){if(ie=Q.charAt(G++),ie=="/"){N.push(ne.DOUBLESLASH),F.push("//"),ie=Q.charAt(G++);continue}N.push(ne.SLASH),F.push("/");continue}if(ie=="!"&&Q.charAt(G)=="="){N.push(ne.NOTEQUAL),F.push("!="),G++,ie=Q.charAt(G++);continue}if(ie=="<"){if(Q.charAt(G)=="="){N.push(ne.LESSTHANOREQUAL),F.push("<="),G++,ie=Q.charAt(G++);continue}N.push(ne.LESSTHAN),F.push("<"),ie=Q.charAt(G++);continue}if(ie==">"){if(Q.charAt(G)=="="){N.push(ne.GREATERTHANOREQUAL),F.push(">="),G++,ie=Q.charAt(G++);continue}N.push(ne.GREATERTHAN),F.push(">"),ie=Q.charAt(G++);continue}if(ie=="_"||M.isLetter(ie.charCodeAt(0))){var Nt=ie;for(ie=Q.charAt(G++);M.isNCNameChar(ie.charCodeAt(0));)Nt+=ie,ie=Q.charAt(G++);if(N.length>0){var ft=N[N.length-1];if(ft!=ne.AT&&ft!=ne.DOUBLECOLON&&ft!=ne.LEFTPARENTHESIS&&ft!=ne.LEFTBRACKET&&ft!=ne.AND&&ft!=ne.OR&&ft!=ne.MOD&&ft!=ne.DIV&&ft!=ne.MULTIPLYOPERATOR&&ft!=ne.SLASH&&ft!=ne.DOUBLESLASH&&ft!=ne.BAR&&ft!=ne.PLUS&&ft!=ne.MINUS&&ft!=ne.EQUALS&&ft!=ne.NOTEQUAL&&ft!=ne.LESSTHAN&&ft!=ne.LESSTHANOREQUAL&&ft!=ne.GREATERTHAN&&ft!=ne.GREATERTHANOREQUAL){if(Nt=="and"){N.push(ne.AND),F.push(Nt);continue}if(Nt=="or"){N.push(ne.OR),F.push(Nt);continue}if(Nt=="mod"){N.push(ne.MOD),F.push(Nt);continue}if(Nt=="div"){N.push(ne.DIV),F.push(Nt);continue}}}if(ie==":"){if(Q.charAt(G)=="*"){N.push(ne.NCNAMECOLONASTERISK),F.push(Nt+":*"),G++,ie=Q.charAt(G++);continue}if(Q.charAt(G)=="_"||M.isLetter(Q.charCodeAt(G))){for(Nt+=":",ie=Q.charAt(G++);M.isNCNameChar(ie.charCodeAt(0));)Nt+=ie,ie=Q.charAt(G++);if(ie=="("){N.push(ne.FUNCTIONNAME),F.push(Nt);continue}N.push(ne.QNAME),F.push(Nt);continue}if(Q.charAt(G)==":"){N.push(ne.AXISNAME),F.push(Nt);continue}}if(ie=="("){if(Nt=="comment"||Nt=="text"||Nt=="node"){N.push(ne.NODETYPE),F.push(Nt);continue}if(Nt=="processing-instruction"){Q.charAt(G)==")"?N.push(ne.NODETYPE):N.push(ne.PROCESSINGINSTRUCTIONWITHLITERAL),F.push(Nt);continue}N.push(ne.FUNCTIONNAME),F.push(Nt);continue}N.push(ne.QNAME),F.push(Nt);continue}throw new Error("Unexpected character "+ie)}return N.push(1),F.push("[EOF]"),[N,F]},ne.SHIFT="s",ne.REDUCE="r",ne.ACCEPT="a",ne.prototype.parse=function(Ft){if(!Ft)throw new Error("XPath expression unspecified.");if(typeof Ft!="string")throw new Error("XPath expression must be a string.");var N,F,Q=this.tokenize(Ft);if(Q!=null){N=Q[0],F=Q[1];var G=0,ie=[],ct=[],Mt=[],Ft,ft,Nt;for(ie.push(0),ct.push(1),Mt.push("_S"),ft=N[G],Nt=F[G++];;)switch(Ft=ie[ie.length-1],ne.actionTable[Ft].charAt(ft-1)){case ne.SHIFT:ct.push(-ft),Mt.push(Nt),ie.push(ne.actionTableNumber[Ft].charCodeAt(ft-1)-32),ft=N[G],Nt=F[G++];break;case ne.REDUCE:for(var an=ne.productions[ne.actionTableNumber[Ft].charCodeAt(ft-1)-32][1],Sn=[],Zn=0;Zn<an;Zn++)ct.pop(),Sn.unshift(Mt.pop()),ie.pop();var es=ie[ie.length-1];ct.push(ne.productions[ne.actionTableNumber[Ft].charCodeAt(ft-1)-32][0]),this.reduceActions[ne.actionTableNumber[Ft].charCodeAt(ft-1)-32]==null?Mt.push(Sn[0]):Mt.push(this.reduceActions[ne.actionTableNumber[Ft].charCodeAt(ft-1)-32](Sn)),ie.push(ne.gotoTable[es].charCodeAt(ne.productions[ne.actionTableNumber[Ft].charCodeAt(ft-1)-32][0]-2)-33);break;case ne.ACCEPT:return new Ie(Mt.pop());default:throw new Error("XPath parse error")}}},Ie.prototype=new Object,Ie.prototype.constructor=Ie,Ie.superclass=Object.prototype;function Ie(l){this.expression=l}Ie.prototype.toString=function(){return this.expression.toString()};function Be(l,N,F){N in l||(l[N]=F)}Ie.prototype.evaluate=function(l){var N=l.expressionContextNode;if(!(v(N)||R(N)))throw new Error("Context node does not appear to be a valid DOM node.");return l.contextNode=l.expressionContextNode,l.contextSize=1,l.contextPosition=1,l.isHtml&&(Be(l,"caseInsensitive",!0),Be(l,"allowAnyNamespaceForNoPrefix",!0)),Be(l,"caseInsensitive",!1),this.expression.evaluate(l)},Ie.XML_NAMESPACE_URI="http://www.w3.org/XML/1998/namespace",Ie.XMLNS_NAMESPACE_URI="http://www.w3.org/2000/xmlns/",ze.prototype=new Object,ze.prototype.constructor=ze,ze.superclass=Object.prototype;function ze(){}ze.prototype.init=function(){},ze.prototype.toString=function(){return"<Expression>"},ze.prototype.evaluate=function(l){throw new Error("Could not evaluate expression.")},dt.prototype=new ze,dt.prototype.constructor=dt,dt.superclass=ze.prototype;function dt(l){arguments.length>0&&this.init(l)}dt.prototype.init=function(l){this.rhs=l},it.prototype=new dt,it.prototype.constructor=it,it.superclass=dt.prototype;function it(l){arguments.length>0&&this.init(l)}it.prototype.init=function(l){it.superclass.init.call(this,l)},it.prototype.evaluate=function(l){return this.rhs.evaluate(l).number().negate()},it.prototype.toString=function(){return"-"+this.rhs.toString()},qe.prototype=new ze,qe.prototype.constructor=qe,qe.superclass=ze.prototype;function qe(l,N){arguments.length>0&&this.init(l,N)}qe.prototype.init=function(l,N){this.lhs=l,this.rhs=N},we.prototype=new qe,we.prototype.constructor=we,we.superclass=qe.prototype;function we(l,N){arguments.length>0&&this.init(l,N)}we.prototype.init=function(l,N){we.superclass.init.call(this,l,N)},we.prototype.toString=function(){return"("+this.lhs.toString()+" or "+this.rhs.toString()+")"},we.prototype.evaluate=function(l){var N=this.lhs.evaluate(l).bool();return N.booleanValue()?N:this.rhs.evaluate(l).bool()},Ze.prototype=new qe,Ze.prototype.constructor=Ze,Ze.superclass=qe.prototype;function Ze(l,N){arguments.length>0&&this.init(l,N)}Ze.prototype.init=function(l,N){Ze.superclass.init.call(this,l,N)},Ze.prototype.toString=function(){return"("+this.lhs.toString()+" and "+this.rhs.toString()+")"},Ze.prototype.evaluate=function(l){var N=this.lhs.evaluate(l).bool();return N.booleanValue()?this.rhs.evaluate(l).bool():N},Le.prototype=new qe,Le.prototype.constructor=Le,Le.superclass=qe.prototype;function Le(l,N){arguments.length>0&&this.init(l,N)}Le.prototype.init=function(l,N){Le.superclass.init.call(this,l,N)},Le.prototype.toString=function(){return"("+this.lhs.toString()+" = "+this.rhs.toString()+")"},Le.prototype.evaluate=function(l){return this.lhs.evaluate(l).equals(this.rhs.evaluate(l))},_e.prototype=new qe,_e.prototype.constructor=_e,_e.superclass=qe.prototype;function _e(l,N){arguments.length>0&&this.init(l,N)}_e.prototype.init=function(l,N){_e.superclass.init.call(this,l,N)},_e.prototype.toString=function(){return"("+this.lhs.toString()+" != "+this.rhs.toString()+")"},_e.prototype.evaluate=function(l){return this.lhs.evaluate(l).notequal(this.rhs.evaluate(l))},ce.prototype=new qe,ce.prototype.constructor=ce,ce.superclass=qe.prototype;function ce(l,N){arguments.length>0&&this.init(l,N)}ce.prototype.init=function(l,N){ce.superclass.init.call(this,l,N)},ce.prototype.evaluate=function(l){return this.lhs.evaluate(l).lessthan(this.rhs.evaluate(l))},ce.prototype.toString=function(){return"("+this.lhs.toString()+" < "+this.rhs.toString()+")"},xe.prototype=new qe,xe.prototype.constructor=xe,xe.superclass=qe.prototype;function xe(l,N){arguments.length>0&&this.init(l,N)}xe.prototype.init=function(l,N){xe.superclass.init.call(this,l,N)},xe.prototype.evaluate=function(l){return this.lhs.evaluate(l).greaterthan(this.rhs.evaluate(l))},xe.prototype.toString=function(){return"("+this.lhs.toString()+" > "+this.rhs.toString()+")"},se.prototype=new qe,se.prototype.constructor=se,se.superclass=qe.prototype;function se(l,N){arguments.length>0&&this.init(l,N)}se.prototype.init=function(l,N){se.superclass.init.call(this,l,N)},se.prototype.evaluate=function(l){return this.lhs.evaluate(l).lessthanorequal(this.rhs.evaluate(l))},se.prototype.toString=function(){return"("+this.lhs.toString()+" <= "+this.rhs.toString()+")"},ee.prototype=new qe,ee.prototype.constructor=ee,ee.superclass=qe.prototype;function ee(l,N){arguments.length>0&&this.init(l,N)}ee.prototype.init=function(l,N){ee.superclass.init.call(this,l,N)},ee.prototype.evaluate=function(l){return this.lhs.evaluate(l).greaterthanorequal(this.rhs.evaluate(l))},ee.prototype.toString=function(){return"("+this.lhs.toString()+" >= "+this.rhs.toString()+")"},ae.prototype=new qe,ae.prototype.constructor=ae,ae.superclass=qe.prototype;function ae(l,N){arguments.length>0&&this.init(l,N)}ae.prototype.init=function(l,N){ae.superclass.init.call(this,l,N)},ae.prototype.evaluate=function(l){return this.lhs.evaluate(l).number().plus(this.rhs.evaluate(l).number())},ae.prototype.toString=function(){return"("+this.lhs.toString()+" + "+this.rhs.toString()+")"},et.prototype=new qe,et.prototype.constructor=et,et.superclass=qe.prototype;function et(l,N){arguments.length>0&&this.init(l,N)}et.prototype.init=function(l,N){et.superclass.init.call(this,l,N)},et.prototype.evaluate=function(l){return this.lhs.evaluate(l).number().minus(this.rhs.evaluate(l).number())},et.prototype.toString=function(){return"("+this.lhs.toString()+" - "+this.rhs.toString()+")"},Ae.prototype=new qe,Ae.prototype.constructor=Ae,Ae.superclass=qe.prototype;function Ae(l,N){arguments.length>0&&this.init(l,N)}Ae.prototype.init=function(l,N){Ae.superclass.init.call(this,l,N)},Ae.prototype.evaluate=function(l){return this.lhs.evaluate(l).number().multiply(this.rhs.evaluate(l).number())},Ae.prototype.toString=function(){return"("+this.lhs.toString()+" * "+this.rhs.toString()+")"},lt.prototype=new qe,lt.prototype.constructor=lt,lt.superclass=qe.prototype;function lt(l,N){arguments.length>0&&this.init(l,N)}lt.prototype.init=function(l,N){lt.superclass.init.call(this,l,N)},lt.prototype.evaluate=function(l){return this.lhs.evaluate(l).number().div(this.rhs.evaluate(l).number())},lt.prototype.toString=function(){return"("+this.lhs.toString()+" div "+this.rhs.toString()+")"},Ye.prototype=new qe,Ye.prototype.constructor=Ye,Ye.superclass=qe.prototype;function Ye(l,N){arguments.length>0&&this.init(l,N)}Ye.prototype.init=function(l,N){Ye.superclass.init.call(this,l,N)},Ye.prototype.evaluate=function(l){return this.lhs.evaluate(l).number().mod(this.rhs.evaluate(l).number())},Ye.prototype.toString=function(){return"("+this.lhs.toString()+" mod "+this.rhs.toString()+")"},gt.prototype=new qe,gt.prototype.constructor=gt,gt.superclass=qe.prototype;function gt(l,N){arguments.length>0&&this.init(l,N)}gt.prototype.init=function(l,N){gt.superclass.init.call(this,l,N)},gt.prototype.evaluate=function(l){return this.lhs.evaluate(l).nodeset().union(this.rhs.evaluate(l).nodeset())},gt.prototype.toString=function(){return pe(te,[this.lhs,this.rhs]).join(" | ")},nt.prototype=new ze,nt.prototype.constructor=nt,nt.superclass=ze.prototype;function nt(l,N,F){arguments.length>0&&this.init(l,N,F)}nt.prototype.init=function(l,N,F){nt.superclass.init.call(this),this.filter=l,this.filterPredicates=N,this.locationPath=F};function Ot(l){for(;l&&l.parentNode;)l=l.parentNode;return l}var Je=function(l,N,F,Q){if(l.length===0)return F;var G=N.extend({});return re(function(ie,ct){return G.contextSize=ie.length,Z(function(Mt,Ft){return G.contextNode=Mt,G.contextPosition=Ft+1,nt.predicateMatches(ct,G)},ie)},Pe(F,Q),l)};nt.getRoot=function(l,N){var F=N[0];if(F&&F.nodeType===Ve.DOCUMENT_NODE)return F;if(l.virtualRoot)return l.virtualRoot;if(!F)throw new Error("Context node not found when determining document root.");var Q=F.ownerDocument;if(Q)return Q;for(var G=F;G.parentNode!=null;)G=G.parentNode;return G};var Ut=function(l){var N=String(l.name);return N==="xmlns"?"":N.substring(0,6)==="xmlns:"?N.substring(6,N.length):null};nt.applyStep=function(l,N,F){if(!F)throw new Error("Context node not found when evaluating XPath step: "+l);var Q=[];switch(N.contextNode=F,l.axis){case B.ANCESTOR:if(N.contextNode===N.virtualRoot)break;var G;for(N.contextNode.nodeType==Ve.ATTRIBUTE_NODE?G=nt.getOwnerElement(N.contextNode):G=N.contextNode.parentNode;G!=null&&(l.nodeTest.matches(G,N)&&Q.push(G),G!==N.virtualRoot);)G=G.parentNode;break;case B.ANCESTORORSELF:for(var G=N.contextNode;G!=null&&(l.nodeTest.matches(G,N)&&Q.push(G),G!==N.virtualRoot);G=G.nodeType==Ve.ATTRIBUTE_NODE?nt.getOwnerElement(G):G.parentNode);break;case B.ATTRIBUTE:var ie=N.contextNode.attributes;if(ie!=null)for(var ct=0;ct<ie.length;ct++){var G=ie.item(ct);l.nodeTest.matches(G,N)&&Q.push(G)}break;case B.CHILD:for(var G=N.contextNode.firstChild;G!=null;G=G.nextSibling)l.nodeTest.matches(G,N)&&Q.push(G);break;case B.DESCENDANT:for(var Nt=[N.contextNode.firstChild];Nt.length>0;)for(var G=Nt.pop();G!=null;)l.nodeTest.matches(G,N)&&Q.push(G),G.firstChild!=null?(Nt.push(G.nextSibling),G=G.firstChild):G=G.nextSibling;break;case B.DESCENDANTORSELF:l.nodeTest.matches(N.contextNode,N)&&Q.push(N.contextNode);for(var Nt=[N.contextNode.firstChild];Nt.length>0;)for(var G=Nt.pop();G!=null;)l.nodeTest.matches(G,N)&&Q.push(G),G.firstChild!=null?(Nt.push(G.nextSibling),G=G.firstChild):G=G.nextSibling;break;case B.FOLLOWING:if(N.contextNode===N.virtualRoot)break;var Nt=[];N.contextNode.firstChild!=null?Nt.unshift(N.contextNode.firstChild):Nt.unshift(N.contextNode.nextSibling);for(var G=N.contextNode.parentNode;G!=null&&G.nodeType!=Ve.DOCUMENT_NODE&&G!==N.virtualRoot;G=G.parentNode)Nt.unshift(G.nextSibling);do for(var G=Nt.pop();G!=null;)l.nodeTest.matches(G,N)&&Q.push(G),G.firstChild!=null?(Nt.push(G.nextSibling),G=G.firstChild):G=G.nextSibling;while(Nt.length>0);break;case B.FOLLOWINGSIBLING:if(N.contextNode===N.virtualRoot)break;for(var G=N.contextNode.nextSibling;G!=null;G=G.nextSibling)l.nodeTest.matches(G,N)&&Q.push(G);break;case B.NAMESPACE:var Mt={};if(N.contextNode.nodeType==Ve.ELEMENT_NODE){Mt.xml=new be("xml",null,Ie.XML_NAMESPACE_URI,N.contextNode);for(var G=N.contextNode;G!=null&&G.nodeType==Ve.ELEMENT_NODE;G=G.parentNode)for(var ct=0;ct<G.attributes.length;ct++){var Ft=G.attributes.item(ct),ft=Ut(Ft);ft!=null&&Mt[ft]==null&&(Mt[ft]=new be(ft,Ft,Ft.value,N.contextNode))}for(var ft in Mt){var F=Mt[ft];l.nodeTest.matches(F,N)&&Q.push(F)}}break;case B.PARENT:G=null,N.contextNode!==N.virtualRoot&&(N.contextNode.nodeType==Ve.ATTRIBUTE_NODE?G=nt.getOwnerElement(N.contextNode):G=N.contextNode.parentNode),G!=null&&l.nodeTest.matches(G,N)&&Q.push(G);break;case B.PRECEDING:var Nt;N.virtualRoot!=null?Nt=[N.virtualRoot]:Nt=[Ot(N.contextNode)];e:for(;Nt.length>0;)for(var G=Nt.pop();G!=null;){if(G==N.contextNode)break e;l.nodeTest.matches(G,N)&&Q.unshift(G),G.firstChild!=null?(Nt.push(G.nextSibling),G=G.firstChild):G=G.nextSibling}break;case B.PRECEDINGSIBLING:if(N.contextNode===N.virtualRoot)break;for(var G=N.contextNode.previousSibling;G!=null;G=G.previousSibling)l.nodeTest.matches(G,N)&&Q.push(G);break;case B.SELF:l.nodeTest.matches(N.contextNode,N)&&Q.push(N.contextNode);break}return Q};function Oe(l,N,F){return Je(l.predicates,N,nt.applyStep(l,N,F),W(ue,l.axis))}function We(l,N,F){return ot(pe(Oe.bind(null,F,l),N))}nt.applySteps=function(l,N,F){return re(We.bind(null,N),F,l)},nt.prototype.applyFilter=function(l,N){if(!this.filter)return{nodes:[l.contextNode]};var F=this.filter.evaluate(l);if(!M.instance_of(F,j)){if(this.filterPredicates!=null&&this.filterPredicates.length>0||this.locationPath!=null)throw new Error("Path expression filter must evaluate to a nodeset if predicates or location path are used");return{nonNodes:F}}return{nodes:Je(this.filterPredicates||[],N,F.toUnsortedArray(),!1)}},nt.applyLocationPath=function(l,N,F){if(!l)return F;var Q=l.absolute?[nt.getRoot(N,F)]:F;return nt.applySteps(l.steps,N,Q)},nt.prototype.evaluate=function(l){var N=$t(new ye,l),F=this.applyFilter(l,N);if("nonNodes"in F)return F.nonNodes;var Q=new j;return Q.addArray(nt.applyLocationPath(this.locationPath,N,F.nodes)),Q},nt.predicateMatches=function(l,N){var F=l.evaluate(N);return M.instance_of(F,he)?N.contextPosition===F.numberValue():F.booleanValue()},nt.predicateString=function(l){return De("[","]",l.toString())},nt.predicatesString=function(l){return ve("",pe(nt.predicateString,l))},nt.prototype.toString=function(){if(this.filter!=null){var l=te(this.filter);return M.instance_of(this.filter,$e)?De("'","'",l):this.filterPredicates!=null&&this.filterPredicates.length?De("(",")",l)+nt.predicatesString(this.filterPredicates):this.locationPath!=null?l+(this.locationPath.absolute?"":"/")+te(this.locationPath):l}return te(this.locationPath)},nt.getOwnerElement=function(l){if(l.ownerElement)return l.ownerElement;try{if(l.selectSingleNode)return l.selectSingleNode("..")}catch{}for(var N=l.nodeType==Ve.DOCUMENT_NODE?l:l.ownerDocument,F=N.getElementsByTagName("*"),Q=0;Q<F.length;Q++)for(var G=F.item(Q),ie=G.attributes,ct=0;ct<ie.length;ct++){var Mt=ie.item(ct);if(Mt===l)return G}return null},U.prototype=new Object,U.prototype.constructor=U,U.superclass=Object.prototype;function U(l,N){arguments.length>0&&this.init(l,N)}U.prototype.init=function(l,N){this.absolute=l,this.steps=N},U.prototype.toString=function(){return(this.absolute?"/":"")+pe(te,this.steps).join("/")},B.prototype=new Object,B.prototype.constructor=B,B.superclass=Object.prototype;function B(l,N,F){arguments.length>0&&this.init(l,N,F)}B.prototype.init=function(l,N,F){this.axis=l,this.nodeTest=N,this.predicates=F},B.prototype.toString=function(){return B.STEPNAMES[this.axis]+"::"+this.nodeTest.toString()+nt.predicatesString(this.predicates)},B.ANCESTOR=0,B.ANCESTORORSELF=1,B.ATTRIBUTE=2,B.CHILD=3,B.DESCENDANT=4,B.DESCENDANTORSELF=5,B.FOLLOWING=6,B.FOLLOWINGSIBLING=7,B.NAMESPACE=8,B.PARENT=9,B.PRECEDING=10,B.PRECEDINGSIBLING=11,B.SELF=12,B.STEPNAMES=re(function(l,N){return l[N[0]]=N[1],l},{},[[B.ANCESTOR,"ancestor"],[B.ANCESTORORSELF,"ancestor-or-self"],[B.ATTRIBUTE,"attribute"],[B.CHILD,"child"],[B.DESCENDANT,"descendant"],[B.DESCENDANTORSELF,"descendant-or-self"],[B.FOLLOWING,"following"],[B.FOLLOWINGSIBLING,"following-sibling"],[B.NAMESPACE,"namespace"],[B.PARENT,"parent"],[B.PRECEDING,"preceding"],[B.PRECEDINGSIBLING,"preceding-sibling"],[B.SELF,"self"]]);var ue=[B.ANCESTOR,B.ANCESTORORSELF,B.PARENT,B.PRECEDING,B.PRECEDINGSIBLING];q.prototype=new Object,q.prototype.constructor=q,q.superclass=Object.prototype;function q(l,N){arguments.length>0&&this.init(l,N)}q.prototype.init=function(l,N){this.type=l,this.value=N},q.prototype.toString=function(){return"<unknown nodetest type>"},q.prototype.matches=function(l,N){console.warn("unknown node test type")},q.NAMETESTANY=0,q.NAMETESTPREFIXANY=1,q.NAMETESTQNAME=2,q.COMMENT=3,q.TEXT=4,q.PI=5,q.NODE=6,q.isNodeType=function(l){return function(N){return W(l,N.nodeType)}},q.makeNodeTestType=function(l,N,F){var Q=F||function(){};return Q.prototype=new q(l),Q.prototype.constructor=Q,$t(Q.prototype,N),Q},q.makeNodeTypeTest=function(l,N,F){return new(q.makeNodeTestType(l,{matches:q.isNodeType(N),toString:X(F)}))},q.hasPrefix=function(l){return l.prefix||(l.nodeName||l.tagName).indexOf(":")!==-1},q.isElementOrAttribute=q.isNodeType([1,2]),q.nameSpaceMatches=function(l,N,F){var Q=F.namespaceURI||"";if(!l)return!Q||N.allowAnyNamespaceForNoPrefix&&!q.hasPrefix(F);var G=N.namespaceResolver.getNamespace(l,N.expressionContextNode);if(G==null)throw new Error("Cannot resolve QName "+l);return G===Q},q.localNameMatches=function(l,N,F){var Q=F.localName||F.nodeName;return N.caseInsensitive?l.toLowerCase()===Q.toLowerCase():l===Q},q.NameTestPrefixAny=q.makeNodeTestType(q.NAMETESTPREFIXANY,{matches:function(l,N){return q.isElementOrAttribute(l)&&q.nameSpaceMatches(this.prefix,N,l)},toString:function(){return this.prefix+":*"}},function(N){this.prefix=N}),q.NameTestQName=q.makeNodeTestType(q.NAMETESTQNAME,{matches:function(l,N){return q.isNodeType([Ve.ELEMENT_NODE,Ve.ATTRIBUTE_NODE,Ve.NAMESPACE_NODE])(l)&&q.nameSpaceMatches(this.prefix,N,l)&&q.localNameMatches(this.localName,N,l)},toString:function(){return this.name}},function(N){var F=N.split(":");this.name=N,this.prefix=F.length>1?F[0]:null,this.localName=F[F.length>1?1:0]}),q.PITest=q.makeNodeTestType(q.PI,{matches:function(l,N){return q.isNodeType([Ve.PROCESSING_INSTRUCTION_NODE])(l)&&(l.target||l.nodeName)===this.name},toString:function(){return De('processing-instruction("','")',this.name)}},function(l){this.name=l}),q.nameTestAny=q.makeNodeTypeTest(q.NAMETESTANY,[Ve.ELEMENT_NODE,Ve.ATTRIBUTE_NODE,Ve.NAMESPACE_NODE],"*"),q.textTest=q.makeNodeTypeTest(q.TEXT,[Ve.TEXT_NODE,Ve.CDATA_SECTION_NODE],"text()"),q.commentTest=q.makeNodeTypeTest(q.COMMENT,[Ve.COMMENT_NODE],"comment()"),q.nodeTest=q.makeNodeTypeTest(q.NODE,[Ve.ELEMENT_NODE,Ve.ATTRIBUTE_NODE,Ve.TEXT_NODE,Ve.CDATA_SECTION_NODE,Ve.PROCESSING_INSTRUCTION_NODE,Ve.COMMENT_NODE,Ve.DOCUMENT_NODE],"node()"),q.anyPiTest=q.makeNodeTypeTest(q.PI,[Ve.PROCESSING_INSTRUCTION_NODE],"processing-instruction()"),Ue.prototype=new ze,Ue.prototype.constructor=Ue,Ue.superclass=ze.prototype;function Ue(l){arguments.length>0&&this.init(l)}Ue.prototype.init=function(l){this.variable=l},Ue.prototype.toString=function(){return"$"+this.variable},Ue.prototype.evaluate=function(l){var N=M.resolveQName(this.variable,l.namespaceResolver,l.contextNode,!1);if(N[0]==null)throw new Error("Cannot resolve QName "+fn);var F=l.variableResolver.getVariable(N[1],N[0]);if(!F)throw fe.fromMessage("Undeclared variable: "+this.toString());return F},ge.prototype=new ze,ge.prototype.constructor=ge,ge.superclass=ze.prototype;function ge(l,N){arguments.length>0&&this.init(l,N)}ge.prototype.init=function(l,N){this.functionName=l,this.arguments=N},ge.prototype.toString=function(){for(var l=this.functionName+"(",N=0;N<this.arguments.length;N++)N>0&&(l+=", "),l+=this.arguments[N].toString();return l+")"},ge.prototype.evaluate=function(l){var N=Ke.getFunctionFromContext(this.functionName,l);if(!N)throw new Error("Unknown function "+this.functionName);var F=[l].concat(this.arguments);return N.apply(l.functionResolver.thisArg,F)};var me=new Object;me.equals=function(l,N){return l.equals(N)},me.notequal=function(l,N){return l.notequal(N)},me.lessthan=function(l,N){return l.lessthan(N)},me.greaterthan=function(l,N){return l.greaterthan(N)},me.lessthanorequal=function(l,N){return l.lessthanorequal(N)},me.greaterthanorequal=function(l,N){return l.greaterthanorequal(N)},$e.prototype=new ze,$e.prototype.constructor=$e,$e.superclass=ze.prototype;function $e(l){arguments.length>0&&this.init(l)}$e.prototype.init=function(l){this.str=String(l)},$e.prototype.toString=function(){return this.str},$e.prototype.evaluate=function(l){return this},$e.prototype.string=function(){return this},$e.prototype.number=function(){return new he(this.str)},$e.prototype.bool=function(){return new h(this.str)},$e.prototype.nodeset=function(){throw new Error("Cannot convert string to nodeset")},$e.prototype.stringValue=function(){return this.str},$e.prototype.numberValue=function(){return this.number().numberValue()},$e.prototype.booleanValue=function(){return this.bool().booleanValue()},$e.prototype.equals=function(l){return M.instance_of(l,h)?this.bool().equals(l):M.instance_of(l,he)?this.number().equals(l):M.instance_of(l,j)?l.compareWithString(this,me.equals):new h(this.str==l.str)},$e.prototype.notequal=function(l){return M.instance_of(l,h)?this.bool().notequal(l):M.instance_of(l,he)?this.number().notequal(l):M.instance_of(l,j)?l.compareWithString(this,me.notequal):new h(this.str!=l.str)},$e.prototype.lessthan=function(l){return this.number().lessthan(l)},$e.prototype.greaterthan=function(l){return this.number().greaterthan(l)},$e.prototype.lessthanorequal=function(l){return this.number().lessthanorequal(l)},$e.prototype.greaterthanorequal=function(l){return this.number().greaterthanorequal(l)},he.prototype=new ze,he.prototype.constructor=he,he.superclass=ze.prototype;function he(l){arguments.length>0&&this.init(l)}he.prototype.init=function(l){this.num=typeof l=="string"?this.parse(l):Number(l)},he.prototype.numberFormat=/^\s*-?[0-9]*\.?[0-9]+\s*$/,he.prototype.parse=function(l){return this.numberFormat.test(l)?parseFloat(l):Number.NaN};function tt(l){for(var N=l.split("e-"),F=N[0].replace(".",""),Q=Number(N[1]),G=0;G<Q-1;G+=1)F="0"+F;return"0."+F}function D(l){for(var N=l.split("e"),F=N[0].replace(".",""),Q=Number(N[1]),G=Q+1-F.length,ie=0;ie<G;ie+=1)F+="0";return F}he.prototype.toString=function(){var l=this.num.toString();return l.indexOf("e-")!==-1?tt(l):l.indexOf("e")!==-1?D(l):l},he.prototype.evaluate=function(l){return this},he.prototype.string=function(){return new $e(this.toString())},he.prototype.number=function(){return this},he.prototype.bool=function(){return new h(this.num)},he.prototype.nodeset=function(){throw new Error("Cannot convert number to nodeset")},he.prototype.stringValue=function(){return this.string().stringValue()},he.prototype.numberValue=function(){return this.num},he.prototype.booleanValue=function(){return this.bool().booleanValue()},he.prototype.negate=function(){return new he(-this.num)},he.prototype.equals=function(l){return M.instance_of(l,h)?this.bool().equals(l):M.instance_of(l,$e)?this.equals(l.number()):M.instance_of(l,j)?l.compareWithNumber(this,me.equals):new h(this.num==l.num)},he.prototype.notequal=function(l){return M.instance_of(l,h)?this.bool().notequal(l):M.instance_of(l,$e)?this.notequal(l.number()):M.instance_of(l,j)?l.compareWithNumber(this,me.notequal):new h(this.num!=l.num)},he.prototype.lessthan=function(l){return M.instance_of(l,j)?l.compareWithNumber(this,me.greaterthan):M.instance_of(l,h)||M.instance_of(l,$e)?this.lessthan(l.number()):new h(this.num<l.num)},he.prototype.greaterthan=function(l){return M.instance_of(l,j)?l.compareWithNumber(this,me.lessthan):M.instance_of(l,h)||M.instance_of(l,$e)?this.greaterthan(l.number()):new h(this.num>l.num)},he.prototype.lessthanorequal=function(l){return M.instance_of(l,j)?l.compareWithNumber(this,me.greaterthanorequal):M.instance_of(l,h)||M.instance_of(l,$e)?this.lessthanorequal(l.number()):new h(this.num<=l.num)},he.prototype.greaterthanorequal=function(l){return M.instance_of(l,j)?l.compareWithNumber(this,me.lessthanorequal):M.instance_of(l,h)||M.instance_of(l,$e)?this.greaterthanorequal(l.number()):new h(this.num>=l.num)},he.prototype.plus=function(l){return new he(this.num+l.num)},he.prototype.minus=function(l){return new he(this.num-l.num)},he.prototype.multiply=function(l){return new he(this.num*l.num)},he.prototype.div=function(l){return new he(this.num/l.num)},he.prototype.mod=function(l){return new he(this.num%l.num)},h.prototype=new ze,h.prototype.constructor=h,h.superclass=ze.prototype;function h(l){arguments.length>0&&this.init(l)}h.prototype.init=function(l){this.b=!!l},h.prototype.toString=function(){return this.b.toString()},h.prototype.evaluate=function(l){return this},h.prototype.string=function(){return new $e(this.b)},h.prototype.number=function(){return new he(this.b)},h.prototype.bool=function(){return this},h.prototype.nodeset=function(){throw new Error("Cannot convert boolean to nodeset")},h.prototype.stringValue=function(){return this.string().stringValue()},h.prototype.numberValue=function(){return this.number().numberValue()},h.prototype.booleanValue=function(){return this.b},h.prototype.not=function(){return new h(!this.b)},h.prototype.equals=function(l){return M.instance_of(l,$e)||M.instance_of(l,he)?this.equals(l.bool()):M.instance_of(l,j)?l.compareWithBoolean(this,me.equals):new h(this.b==l.b)},h.prototype.notequal=function(l){return M.instance_of(l,$e)||M.instance_of(l,he)?this.notequal(l.bool()):M.instance_of(l,j)?l.compareWithBoolean(this,me.notequal):new h(this.b!=l.b)},h.prototype.lessthan=function(l){return this.number().lessthan(l)},h.prototype.greaterthan=function(l){return this.number().greaterthan(l)},h.prototype.lessthanorequal=function(l){return this.number().lessthanorequal(l)},h.prototype.greaterthanorequal=function(l){return this.number().greaterthanorequal(l)},h.true_=new h(!0),h.false_=new h(!1),w.prototype=new Object,w.prototype.constructor=w,w.superclass=Object.prototype;function w(l){this.init(l)}w.prototype.init=function(l){this.left=null,this.right=null,this.node=l,this.depth=1},w.prototype.balance=function(){var l=this.left==null?0:this.left.depth,N=this.right==null?0:this.right.depth;if(l>N+1){var F=this.left.left==null?0:this.left.left.depth,Q=this.left.right==null?0:this.left.right.depth;F<Q&&this.left.rotateRR(),this.rotateLL()}else if(l+1<N){var G=this.right.right==null?0:this.right.right.depth,ie=this.right.left==null?0:this.right.left.depth;ie>G&&this.right.rotateLL(),this.rotateRR()}},w.prototype.rotateLL=function(){var l=this.node,N=this.right;this.node=this.left.node,this.right=this.left,this.left=this.left.left,this.right.left=this.right.right,this.right.right=N,this.right.node=l,this.right.updateInNewLocation(),this.updateInNewLocation()},w.prototype.rotateRR=function(){var l=this.node,N=this.left;this.node=this.right.node,this.left=this.right,this.right=this.right.right,this.left.right=this.left.left,this.left.left=N,this.left.node=l,this.left.updateInNewLocation(),this.updateInNewLocation()},w.prototype.updateInNewLocation=function(){this.getDepthFromChildren()},w.prototype.getDepthFromChildren=function(){this.depth=this.node==null?0:1,this.left!=null&&(this.depth=this.left.depth+1),this.right!=null&&this.depth<=this.right.depth&&(this.depth=this.right.depth+1)};function J(l,N){if(l===N)return 0;if(l.compareDocumentPosition){var F=l.compareDocumentPosition(N);return F&1||F&10?1:F&20?-1:0}for(var Q=0,G=0,ie=l;ie!=null;ie=ie.parentNode||ie.ownerElement)Q++;for(var ct=N;ct!=null;ct=ct.parentNode||ct.ownerElement)G++;if(Q>G){for(;Q>G;)l=l.parentNode||l.ownerElement,Q--;if(l===N)return 1}else if(G>Q){for(;G>Q;)N=N.parentNode||N.ownerElement,G--;if(l===N)return-1}for(var Mt=l.parentNode||l.ownerElement,Ft=N.parentNode||N.ownerElement;Mt!==Ft;)l=Mt,N=Ft,Mt=l.parentNode||l.ownerElement,Ft=N.parentNode||N.ownerElement;var ft=z(l),Nt=z(N);if(ft&&!Nt)return-1;if(!ft&&Nt)return 1;if(l.isXPathNamespace){if(l.nodeValue===Ie.XML_NAMESPACE_URI||!N.isXPathNamespace)return-1;if(N.nodeValue===Ie.XML_NAMESPACE_URI)return 1}else if(N.isXPathNamespace)return 1;if(Mt)for(var an=ft?Mt.attributes:Mt.childNodes,Sn=an.length,Zn=l.baseNode||l,es=N.baseNode||N,un=0;un<Sn;un+=1){var Hn=an[un];if(Hn===Zn)return-1;if(Hn===es)return 1}throw new Error("Unexpected: could not determine node order")}w.prototype.add=function(l){if(l===this.node)return!1;var N=J(l,this.node),F=!1;return N==-1?this.left==null?(this.left=new w(l),F=!0):(F=this.left.add(l),F&&this.balance()):N==1&&(this.right==null?(this.right=new w(l),F=!0):(F=this.right.add(l),F&&this.balance())),F&&this.getDepthFromChildren(),F},j.prototype=new ze,j.prototype.constructor=j,j.superclass=ze.prototype;function j(){this.init()}j.prototype.init=function(){this.tree=null,this.nodes=[],this.size=0},j.prototype.toString=function(){var l=this.first();return l==null?"":this.stringForNode(l)},j.prototype.evaluate=function(l){return this},j.prototype.string=function(){return new $e(this.toString())},j.prototype.stringValue=function(){return this.toString()},j.prototype.number=function(){return new he(this.string())},j.prototype.numberValue=function(){return Number(this.string())},j.prototype.bool=function(){return new h(this.booleanValue())},j.prototype.booleanValue=function(){return!!this.size},j.prototype.nodeset=function(){return this},j.prototype.stringForNode=function(l){return l.nodeType==Ve.DOCUMENT_NODE||l.nodeType==Ve.ELEMENT_NODE||l.nodeType===Ve.DOCUMENT_FRAGMENT_NODE?this.stringForContainerNode(l):l.nodeType===Ve.ATTRIBUTE_NODE?l.value||l.nodeValue:l.isNamespaceNode?l.namespace:l.nodeValue},j.prototype.stringForContainerNode=function(l){for(var N="",F=l.firstChild;F!=null;F=F.nextSibling){var Q=F.nodeType;(Q===1||Q===3||Q===4||Q===9||Q===11)&&(N+=this.stringForNode(F))}return N},j.prototype.buildTree=function(){if(!this.tree&&this.nodes.length){this.tree=new w(this.nodes[0]);for(var l=1;l<this.nodes.length;l+=1)this.tree.add(this.nodes[l])}return this.tree},j.prototype.first=function(){var l=this.buildTree();if(l==null)return null;for(;l.left!=null;)l=l.left;return l.node},j.prototype.add=function(l){for(var N=0;N<this.nodes.length;N+=1)if(l===this.nodes[N])return;this.tree=null,this.nodes.push(l),this.size+=1},j.prototype.addArray=function(l){var N=this;H(function(F){N.add(F)},l)},j.prototype.toArray=function(){var l=[];return this.toArrayRec(this.buildTree(),l),l},j.prototype.toArrayRec=function(l,N){l!=null&&(this.toArrayRec(l.left,N),N.push(l.node),this.toArrayRec(l.right,N))},j.prototype.toUnsortedArray=function(){return this.nodes.slice()},j.prototype.compareWithString=function(l,N){for(var F=this.toUnsortedArray(),Q=0;Q<F.length;Q++){var G=F[Q],ie=new $e(this.stringForNode(G)),ct=N(ie,l);if(ct.booleanValue())return ct}return new h(!1)},j.prototype.compareWithNumber=function(l,N){for(var F=this.toUnsortedArray(),Q=0;Q<F.length;Q++){var G=F[Q],ie=new he(this.stringForNode(G)),ct=N(ie,l);if(ct.booleanValue())return ct}return new h(!1)},j.prototype.compareWithBoolean=function(l,N){return N(this.bool(),l)},j.prototype.compareWithNodeSet=function(l,N){for(var F=this.toUnsortedArray(),Q=function(Mt,Ft){return N(Ft,Mt)},G=0;G<F.length;G++){var ie=new $e(this.stringForNode(F[G])),ct=l.compareWithString(ie,Q);if(ct.booleanValue())return ct}return new h(!1)},j.compareWith=V(function(l,N){return M.instance_of(N,$e)?this.compareWithString(N,l):M.instance_of(N,he)?this.compareWithNumber(N,l):M.instance_of(N,h)?this.compareWithBoolean(N,l):this.compareWithNodeSet(N,l)}),j.prototype.equals=j.compareWith(me.equals),j.prototype.notequal=j.compareWith(me.notequal),j.prototype.lessthan=j.compareWith(me.lessthan),j.prototype.greaterthan=j.compareWith(me.greaterthan),j.prototype.lessthanorequal=j.compareWith(me.lessthanorequal),j.prototype.greaterthanorequal=j.compareWith(me.greaterthanorequal),j.prototype.union=function(l){var N=new j;return N.addArray(this.toUnsortedArray()),N.addArray(l.toUnsortedArray()),N},be.prototype=new Object,be.prototype.constructor=be,be.superclass=Object.prototype;function be(l,N,F,Q){this.isXPathNamespace=!0,this.baseNode=N,this.ownerDocument=Q.ownerDocument,this.nodeName=l,this.prefix=l,this.localName=l,this.namespaceURI=null,this.nodeValue=F,this.ownerElement=Q,this.nodeType=Ve.NAMESPACE_NODE}be.prototype.toString=function(){return'{ "'+this.prefix+'", "'+this.namespaceURI+'" }'},ye.prototype=new Object,ye.prototype.constructor=ye,ye.superclass=Object.prototype;function ye(l,N,F){this.variableResolver=l??new He,this.namespaceResolver=N??new C,this.functionResolver=F??new Ke}ye.prototype.extend=function(l){return $t(new ye,this,l)},He.prototype=new Object,He.prototype.constructor=He,He.superclass=Object.prototype;function He(){}He.prototype.getVariable=function(l,N){return null},Ke.prototype=new Object,Ke.prototype.constructor=Ke,Ke.superclass=Object.prototype;function Ke(l){this.thisArg=l??k,this.functions=new Object,this.addStandardFunctions()}Ke.prototype.addStandardFunctions=function(){this.functions["{}last"]=k.last,this.functions["{}position"]=k.position,this.functions["{}count"]=k.count,this.functions["{}id"]=k.id,this.functions["{}local-name"]=k.localName,this.functions["{}namespace-uri"]=k.namespaceURI,this.functions["{}name"]=k.name,this.functions["{}string"]=k.string,this.functions["{}concat"]=k.concat,this.functions["{}starts-with"]=k.startsWith,this.functions["{}contains"]=k.contains,this.functions["{}substring-before"]=k.substringBefore,this.functions["{}substring-after"]=k.substringAfter,this.functions["{}substring"]=k.substring,this.functions["{}string-length"]=k.stringLength,this.functions["{}normalize-space"]=k.normalizeSpace,this.functions["{}translate"]=k.translate,this.functions["{}boolean"]=k.boolean_,this.functions["{}not"]=k.not,this.functions["{}true"]=k.true_,this.functions["{}false"]=k.false_,this.functions["{}lang"]=k.lang,this.functions["{}number"]=k.number,this.functions["{}sum"]=k.sum,this.functions["{}floor"]=k.floor,this.functions["{}ceiling"]=k.ceiling,this.functions["{}round"]=k.round},Ke.prototype.addFunction=function(l,N,F){this.functions["{"+l+"}"+N]=F},Ke.getFunctionFromContext=function(l,N){var F=M.resolveQName(l,N.namespaceResolver,N.contextNode,!1);if(F[0]===null)throw new Error("Cannot resolve QName "+name);return N.functionResolver.getFunction(F[1],F[0])},Ke.prototype.getFunction=function(l,N){return this.functions["{"+N+"}"+l]},C.prototype=new Object,C.prototype.constructor=C,C.superclass=Object.prototype;function C(){}C.prototype.getNamespace=function(l,N){if(l=="xml")return Ie.XML_NAMESPACE_URI;if(l=="xmlns")return Ie.XMLNS_NAMESPACE_URI;for(N.nodeType==Ve.DOCUMENT_NODE?N=N.documentElement:N.nodeType==Ve.ATTRIBUTE_NODE?N=nt.getOwnerElement(N):N.nodeType!=Ve.ELEMENT_NODE&&(N=N.parentNode);N!=null&&N.nodeType==Ve.ELEMENT_NODE;){for(var F=N.attributes,Q=0;Q<F.length;Q++){var G=F.item(Q),ie=G.name||G.nodeName;if(ie==="xmlns"&&l===""||ie==="xmlns:"+l)return String(G.value||G.nodeValue)}N=N.parentNode}return null};var k=new Object;k.last=function(l){if(arguments.length!=1)throw new Error("Function last expects ()");return new he(l.contextSize)},k.position=function(l){if(arguments.length!=1)throw new Error("Function position expects ()");return new he(l.contextPosition)},k.count=function(){var l=arguments[0],N;if(arguments.length!=2||!M.instance_of(N=arguments[1].evaluate(l),j))throw new Error("Function count expects (node-set)");return new he(N.size)},k.id=function(){var l=arguments[0],N;if(arguments.length!=2)throw new Error("Function id expects (object)");N=arguments[1].evaluate(l),M.instance_of(N,j)?N=N.toArray().join(" "):N=N.stringValue();for(var F=N.split(/[\x0d\x0a\x09\x20]+/),Q=new j,G=l.contextNode.nodeType==Ve.DOCUMENT_NODE?l.contextNode:l.contextNode.ownerDocument,ie=0;ie<F.length;ie++){var ct;G.getElementById?ct=G.getElementById(F[ie]):ct=M.getElementById(G,F[ie]),ct!=null&&Q.add(ct)}return Q},k.localName=function(l,N){var F;if(arguments.length==1)F=l.contextNode;else if(arguments.length==2)F=N.evaluate(l).first();else throw new Error("Function local-name expects (node-set?)");return F==null?new $e(""):new $e(F.localName||F.baseName||F.target||F.nodeName||"")},k.namespaceURI=function(){var l=arguments[0],N;if(arguments.length==1)N=l.contextNode;else if(arguments.length==2)N=arguments[1].evaluate(l).first();else throw new Error("Function namespace-uri expects (node-set?)");return N==null?new $e(""):new $e(N.namespaceURI||"")},k.name=function(){var l=arguments[0],N;if(arguments.length==1)N=l.contextNode;else if(arguments.length==2)N=arguments[1].evaluate(l).first();else throw new Error("Function name expects (node-set?)");return N==null?new $e(""):N.nodeType==Ve.ELEMENT_NODE?new $e(N.nodeName):N.nodeType==Ve.ATTRIBUTE_NODE?new $e(N.name||N.nodeName):N.nodeType===Ve.PROCESSING_INSTRUCTION_NODE?new $e(N.target||N.nodeName):N.localName==null?new $e(""):new $e(N.localName)},k.string=function(){var l=arguments[0];if(arguments.length==1)return new $e(j.prototype.stringForNode(l.contextNode));if(arguments.length==2)return arguments[1].evaluate(l).string();throw new Error("Function string expects (object?)")},k.concat=function(l){if(arguments.length<3)throw new Error("Function concat expects (string, string[, string]*)");for(var N="",F=1;F<arguments.length;F++)N+=arguments[F].evaluate(l).stringValue();return new $e(N)},k.startsWith=function(){var l=arguments[0];if(arguments.length!=3)throw new Error("Function startsWith expects (string, string)");var N=arguments[1].evaluate(l).stringValue(),F=arguments[2].evaluate(l).stringValue();return new h(N.substring(0,F.length)==F)},k.contains=function(){var l=arguments[0];if(arguments.length!=3)throw new Error("Function contains expects (string, string)");var N=arguments[1].evaluate(l).stringValue(),F=arguments[2].evaluate(l).stringValue();return new h(N.indexOf(F)!==-1)},k.substringBefore=function(){var l=arguments[0];if(arguments.length!=3)throw new Error("Function substring-before expects (string, string)");var N=arguments[1].evaluate(l).stringValue(),F=arguments[2].evaluate(l).stringValue();return new $e(N.substring(0,N.indexOf(F)))},k.substringAfter=function(){var l=arguments[0];if(arguments.length!=3)throw new Error("Function substring-after expects (string, string)");var N=arguments[1].evaluate(l).stringValue(),F=arguments[2].evaluate(l).stringValue();if(F.length==0)return new $e(N);var Q=N.indexOf(F);return Q==-1?new $e(""):new $e(N.substring(Q+F.length))},k.substring=function(){var l=arguments[0];if(!(arguments.length==3||arguments.length==4))throw new Error("Function substring expects (string, number, number?)");var N=arguments[1].evaluate(l).stringValue(),F=Math.round(arguments[2].evaluate(l).numberValue())-1,Q=arguments.length==4?F+Math.round(arguments[3].evaluate(l).numberValue()):void 0;return new $e(N.substring(F,Q))},k.stringLength=function(){var l=arguments[0],N;if(arguments.length==1)N=j.prototype.stringForNode(l.contextNode);else if(arguments.length==2)N=arguments[1].evaluate(l).stringValue();else throw new Error("Function string-length expects (string?)");return new he(N.length)},k.normalizeSpace=function(){var l=arguments[0],N;if(arguments.length==1)N=j.prototype.stringForNode(l.contextNode);else if(arguments.length==2)N=arguments[1].evaluate(l).stringValue();else throw new Error("Function normalize-space expects (string?)");for(var F=0,Q=N.length-1;M.isSpace(N.charCodeAt(Q));)Q--;for(var G="";F<=Q&&M.isSpace(N.charCodeAt(F));)F++;for(;F<=Q;)if(M.isSpace(N.charCodeAt(F)))for(G+=" ";F<=Q&&M.isSpace(N.charCodeAt(F));)F++;else G+=N.charAt(F),F++;return new $e(G)},k.translate=function(l,N,F,Q){if(arguments.length!=4)throw new Error("Function translate expects (string, string, string)");var G=N.evaluate(l).stringValue(),ie=F.evaluate(l).stringValue(),ct=Q.evaluate(l).stringValue(),Mt=re(function(ft,Nt,an){return Nt in ft||(ft[Nt]=an>ct.length?"":ct[an]),ft},{},ie),Ft=ve("",pe(function(ft){return ft in Mt?Mt[ft]:ft},G));return new $e(Ft)},k.boolean_=function(){var l=arguments[0];if(arguments.length!=2)throw new Error("Function boolean expects (object)");return arguments[1].evaluate(l).bool()},k.not=function(l,N){if(arguments.length!=2)throw new Error("Function not expects (object)");return N.evaluate(l).bool().not()},k.true_=function(){if(arguments.length!=1)throw new Error("Function true expects ()");return h.true_},k.false_=function(){if(arguments.length!=1)throw new Error("Function false expects ()");return h.false_},k.lang=function(){var l=arguments[0];if(arguments.length!=2)throw new Error("Function lang expects (string)");for(var N,F=l.contextNode;F!=null&&F.nodeType!=Ve.DOCUMENT_NODE;F=F.parentNode){var Q=F.getAttributeNS(Ie.XML_NAMESPACE_URI,"lang");if(Q!=null){N=String(Q);break}}if(N==null)return h.false_;var G=arguments[1].evaluate(l).stringValue();return new h(N.substring(0,G.length)==G&&(N.length==G.length||N.charAt(G.length)=="-"))},k.number=function(){var l=arguments[0];if(!(arguments.length==1||arguments.length==2))throw new Error("Function number expects (object?)");return arguments.length==1?new he(j.prototype.stringForNode(l.contextNode)):arguments[1].evaluate(l).number()},k.sum=function(){var l=arguments[0],N;if(arguments.length!=2||!M.instance_of(N=arguments[1].evaluate(l),j))throw new Error("Function sum expects (node-set)");N=N.toUnsortedArray();for(var F=0,Q=0;Q<N.length;Q++)F+=new he(j.prototype.stringForNode(N[Q])).numberValue();return new he(F)},k.floor=function(){var l=arguments[0];if(arguments.length!=2)throw new Error("Function floor expects (number)");return new he(Math.floor(arguments[1].evaluate(l).numberValue()))},k.ceiling=function(){var l=arguments[0];if(arguments.length!=2)throw new Error("Function ceiling expects (number)");return new he(Math.ceil(arguments[1].evaluate(l).numberValue()))},k.round=function(){var l=arguments[0];if(arguments.length!=2)throw new Error("Function round expects (number)");return new he(Math.round(arguments[1].evaluate(l).numberValue()))};var M=new Object,z=function(l){return l&&(l.nodeType===Ve.ATTRIBUTE_NODE||l.ownerElement||l.isXPathNamespace)};M.splitQName=function(l){var N=l.indexOf(":");return N==-1?[null,l]:[l.substring(0,N),l.substring(N+1)]},M.resolveQName=function(l,N,F,Q){var G=M.splitQName(l);return G[0]!=null?G[0]=N.getNamespace(G[0],F):Q?(G[0]=N.getNamespace("",F),G[0]==null&&(G[0]="")):G[0]="",G},M.isSpace=function(l){return l==9||l==13||l==10||l==32},M.isLetter=function(l){return l>=65&&l<=90||l>=97&&l<=122||l>=192&&l<=214||l>=216&&l<=246||l>=248&&l<=255||l>=256&&l<=305||l>=308&&l<=318||l>=321&&l<=328||l>=330&&l<=382||l>=384&&l<=451||l>=461&&l<=496||l>=500&&l<=501||l>=506&&l<=535||l>=592&&l<=680||l>=699&&l<=705||l==902||l>=904&&l<=906||l==908||l>=910&&l<=929||l>=931&&l<=974||l>=976&&l<=982||l==986||l==988||l==990||l==992||l>=994&&l<=1011||l>=1025&&l<=1036||l>=1038&&l<=1103||l>=1105&&l<=1116||l>=1118&&l<=1153||l>=1168&&l<=1220||l>=1223&&l<=1224||l>=1227&&l<=1228||l>=1232&&l<=1259||l>=1262&&l<=1269||l>=1272&&l<=1273||l>=1329&&l<=1366||l==1369||l>=1377&&l<=1414||l>=1488&&l<=1514||l>=1520&&l<=1522||l>=1569&&l<=1594||l>=1601&&l<=1610||l>=1649&&l<=1719||l>=1722&&l<=1726||l>=1728&&l<=1742||l>=1744&&l<=1747||l==1749||l>=1765&&l<=1766||l>=2309&&l<=2361||l==2365||l>=2392&&l<=2401||l>=2437&&l<=2444||l>=2447&&l<=2448||l>=2451&&l<=2472||l>=2474&&l<=2480||l==2482||l>=2486&&l<=2489||l>=2524&&l<=2525||l>=2527&&l<=2529||l>=2544&&l<=2545||l>=2565&&l<=2570||l>=2575&&l<=2576||l>=2579&&l<=2600||l>=2602&&l<=2608||l>=2610&&l<=2611||l>=2613&&l<=2614||l>=2616&&l<=2617||l>=2649&&l<=2652||l==2654||l>=2674&&l<=2676||l>=2693&&l<=2699||l==2701||l>=2703&&l<=2705||l>=2707&&l<=2728||l>=2730&&l<=2736||l>=2738&&l<=2739||l>=2741&&l<=2745||l==2749||l==2784||l>=2821&&l<=2828||l>=2831&&l<=2832||l>=2835&&l<=2856||l>=2858&&l<=2864||l>=2866&&l<=2867||l>=2870&&l<=2873||l==2877||l>=2908&&l<=2909||l>=2911&&l<=2913||l>=2949&&l<=2954||l>=2958&&l<=2960||l>=2962&&l<=2965||l>=2969&&l<=2970||l==2972||l>=2974&&l<=2975||l>=2979&&l<=2980||l>=2984&&l<=2986||l>=2990&&l<=2997||l>=2999&&l<=3001||l>=3077&&l<=3084||l>=3086&&l<=3088||l>=3090&&l<=3112||l>=3114&&l<=3123||l>=3125&&l<=3129||l>=3168&&l<=3169||l>=3205&&l<=3212||l>=3214&&l<=3216||l>=3218&&l<=3240||l>=3242&&l<=3251||l>=3253&&l<=3257||l==3294||l>=3296&&l<=3297||l>=3333&&l<=3340||l>=3342&&l<=3344||l>=3346&&l<=3368||l>=3370&&l<=3385||l>=3424&&l<=3425||l>=3585&&l<=3630||l==3632||l>=3634&&l<=3635||l>=3648&&l<=3653||l>=3713&&l<=3714||l==3716||l>=3719&&l<=3720||l==3722||l==3725||l>=3732&&l<=3735||l>=3737&&l<=3743||l>=3745&&l<=3747||l==3749||l==3751||l>=3754&&l<=3755||l>=3757&&l<=3758||l==3760||l>=3762&&l<=3763||l==3773||l>=3776&&l<=3780||l>=3904&&l<=3911||l>=3913&&l<=3945||l>=4256&&l<=4293||l>=4304&&l<=4342||l==4352||l>=4354&&l<=4355||l>=4357&&l<=4359||l==4361||l>=4363&&l<=4364||l>=4366&&l<=4370||l==4412||l==4414||l==4416||l==4428||l==4430||l==4432||l>=4436&&l<=4437||l==4441||l>=4447&&l<=4449||l==4451||l==4453||l==4455||l==4457||l>=4461&&l<=4462||l>=4466&&l<=4467||l==4469||l==4510||l==4520||l==4523||l>=4526&&l<=4527||l>=4535&&l<=4536||l==4538||l>=4540&&l<=4546||l==4587||l==4592||l==4601||l>=7680&&l<=7835||l>=7840&&l<=7929||l>=7936&&l<=7957||l>=7960&&l<=7965||l>=7968&&l<=8005||l>=8008&&l<=8013||l>=8016&&l<=8023||l==8025||l==8027||l==8029||l>=8031&&l<=8061||l>=8064&&l<=8116||l>=8118&&l<=8124||l==8126||l>=8130&&l<=8132||l>=8134&&l<=8140||l>=8144&&l<=8147||l>=8150&&l<=8155||l>=8160&&l<=8172||l>=8178&&l<=8180||l>=8182&&l<=8188||l==8486||l>=8490&&l<=8491||l==8494||l>=8576&&l<=8578||l>=12353&&l<=12436||l>=12449&&l<=12538||l>=12549&&l<=12588||l>=44032&&l<=55203||l>=19968&&l<=40869||l==12295||l>=12321&&l<=12329},M.isNCNameChar=function(l){return l>=48&&l<=57||l>=1632&&l<=1641||l>=1776&&l<=1785||l>=2406&&l<=2415||l>=2534&&l<=2543||l>=2662&&l<=2671||l>=2790&&l<=2799||l>=2918&&l<=2927||l>=3047&&l<=3055||l>=3174&&l<=3183||l>=3302&&l<=3311||l>=3430&&l<=3439||l>=3664&&l<=3673||l>=3792&&l<=3801||l>=3872&&l<=3881||l==46||l==45||l==95||M.isLetter(l)||l>=768&&l<=837||l>=864&&l<=865||l>=1155&&l<=1158||l>=1425&&l<=1441||l>=1443&&l<=1465||l>=1467&&l<=1469||l==1471||l>=1473&&l<=1474||l==1476||l>=1611&&l<=1618||l==1648||l>=1750&&l<=1756||l>=1757&&l<=1759||l>=1760&&l<=1764||l>=1767&&l<=1768||l>=1770&&l<=1773||l>=2305&&l<=2307||l==2364||l>=2366&&l<=2380||l==2381||l>=2385&&l<=2388||l>=2402&&l<=2403||l>=2433&&l<=2435||l==2492||l==2494||l==2495||l>=2496&&l<=2500||l>=2503&&l<=2504||l>=2507&&l<=2509||l==2519||l>=2530&&l<=2531||l==2562||l==2620||l==2622||l==2623||l>=2624&&l<=2626||l>=2631&&l<=2632||l>=2635&&l<=2637||l>=2672&&l<=2673||l>=2689&&l<=2691||l==2748||l>=2750&&l<=2757||l>=2759&&l<=2761||l>=2763&&l<=2765||l>=2817&&l<=2819||l==2876||l>=2878&&l<=2883||l>=2887&&l<=2888||l>=2891&&l<=2893||l>=2902&&l<=2903||l>=2946&&l<=2947||l>=3006&&l<=3010||l>=3014&&l<=3016||l>=3018&&l<=3021||l==3031||l>=3073&&l<=3075||l>=3134&&l<=3140||l>=3142&&l<=3144||l>=3146&&l<=3149||l>=3157&&l<=3158||l>=3202&&l<=3203||l>=3262&&l<=3268||l>=3270&&l<=3272||l>=3274&&l<=3277||l>=3285&&l<=3286||l>=3330&&l<=3331||l>=3390&&l<=3395||l>=3398&&l<=3400||l>=3402&&l<=3405||l==3415||l==3633||l>=3636&&l<=3642||l>=3655&&l<=3662||l==3761||l>=3764&&l<=3769||l>=3771&&l<=3772||l>=3784&&l<=3789||l>=3864&&l<=3865||l==3893||l==3895||l==3897||l==3902||l==3903||l>=3953&&l<=3972||l>=3974&&l<=3979||l>=3984&&l<=3989||l==3991||l>=3993&&l<=4013||l>=4017&&l<=4023||l==4025||l>=8400&&l<=8412||l==8417||l>=12330&&l<=12335||l==12441||l==12442||l==183||l==720||l==721||l==903||l==1600||l==3654||l==3782||l==12293||l>=12337&&l<=12341||l>=12445&&l<=12446||l>=12540&&l<=12542},M.coalesceText=function(l){for(var N=l.firstChild;N!=null;N=N.nextSibling)if(N.nodeType==Ve.TEXT_NODE||N.nodeType==Ve.CDATA_SECTION_NODE){var F=N.nodeValue,Q=N;for(N=N.nextSibling;N!=null&&(N.nodeType==Ve.TEXT_NODE||N.nodeType==Ve.CDATA_SECTION_NODE);){F+=N.nodeValue;var G=N;N=N.nextSibling,G.parentNode.removeChild(G)}if(Q.nodeType==Ve.CDATA_SECTION_NODE){var ie=Q.parentNode;if(Q.nextSibling==null)ie.removeChild(Q),ie.appendChild(ie.ownerDocument.createTextNode(F));else{var ct=Q.nextSibling;ie.removeChild(Q),ie.insertBefore(ie.ownerDocument.createTextNode(F),ct)}}else Q.nodeValue=F;if(N==null)break}else N.nodeType==Ve.ELEMENT_NODE&&M.coalesceText(N)},M.instance_of=function(l,N){for(;l!=null;){if(l.constructor===N)return!0;if(l===Object)return!1;l=l.constructor.superclass}return!1},M.getElementById=function(l,N){if(l.nodeType==Ve.ELEMENT_NODE&&(l.getAttribute("id")==N||l.getAttributeNS(null,"id")==N))return l;for(var F=l.firstChild;F!=null;F=F.nextSibling){var Q=M.getElementById(F,N);if(Q!=null)return Q}return null};var fe=(function(){function l(F,Q){var G=Q?": "+Q.toString():"";switch(F){case N.INVALID_EXPRESSION_ERR:return"Invalid expression"+G;case N.TYPE_ERR:return"Type error"+G}return null}function N(F,Q,G){var ie=Error.call(this,l(F,Q)||G);return ie.code=F,ie.exception=Q,ie}return N.prototype=Object.create(Error.prototype),N.prototype.constructor=N,N.superclass=Error,N.prototype.toString=function(){return this.message},N.fromMessage=function(F,Q){return new N(null,Q,F)},N.INVALID_EXPRESSION_ERR=51,N.TYPE_ERR=52,N})();$.prototype={},$.prototype.constructor=$,$.superclass=Object.prototype;function $(l,N,F){this.xpath=F.parse(l),this.context=new ye,this.context.namespaceResolver=new y(N)}$.getOwnerDocument=function(l){return l.nodeType===Ve.DOCUMENT_NODE?l:l.ownerDocument},$.detectHtmlDom=function(l){if(!l)return!1;var N=$.getOwnerDocument(l);try{return N.implementation.hasFeature("HTML","2.0")}catch{return!0}},$.prototype.evaluate=function(l,N,F){this.context.expressionContextNode=l,this.context.caseInsensitive=$.detectHtmlDom(l);var Q=this.xpath.evaluate(this.context);return new p(Q,N)},y.prototype={},y.prototype.constructor=y,y.superclass=Object.prototype;function y(l){this.xpathNSResolver=l}y.prototype.getNamespace=function(l,N){return this.xpathNSResolver==null?null:this.xpathNSResolver.lookupNamespaceURI(l)},_.prototype={},_.prototype.constructor=_,_.superclass=Object.prototype;function _(l){this.node=l,this.namespaceResolver=new C}_.prototype.lookupNamespaceURI=function(l){return this.namespaceResolver.getNamespace(l,this.node)},p.prototype={},p.prototype.constructor=p,p.superclass=Object.prototype;function p(l,N){switch(N==p.ANY_TYPE&&(l.constructor===$e?N=p.STRING_TYPE:l.constructor===he?N=p.NUMBER_TYPE:l.constructor===h?N=p.BOOLEAN_TYPE:l.constructor===j&&(N=p.UNORDERED_NODE_ITERATOR_TYPE)),this.resultType=N,N){case p.NUMBER_TYPE:this.numberValue=l.numberValue();return;case p.STRING_TYPE:this.stringValue=l.stringValue();return;case p.BOOLEAN_TYPE:this.booleanValue=l.booleanValue();return;case p.ANY_UNORDERED_NODE_TYPE:case p.FIRST_ORDERED_NODE_TYPE:if(l.constructor===j){this.singleNodeValue=l.first();return}break;case p.UNORDERED_NODE_ITERATOR_TYPE:case p.ORDERED_NODE_ITERATOR_TYPE:if(l.constructor===j){this.invalidIteratorState=!1,this.nodes=l.toArray(),this.iteratorIndex=0;return}break;case p.UNORDERED_NODE_SNAPSHOT_TYPE:case p.ORDERED_NODE_SNAPSHOT_TYPE:if(l.constructor===j){this.nodes=l.toArray(),this.snapshotLength=this.nodes.length;return}break}throw new fe(fe.TYPE_ERR)}p.prototype.iterateNext=function(){if(this.resultType!=p.UNORDERED_NODE_ITERATOR_TYPE&&this.resultType!=p.ORDERED_NODE_ITERATOR_TYPE)throw new fe(fe.TYPE_ERR);return this.nodes[this.iteratorIndex++]},p.prototype.snapshotItem=function(l){if(this.resultType!=p.UNORDERED_NODE_SNAPSHOT_TYPE&&this.resultType!=p.ORDERED_NODE_SNAPSHOT_TYPE)throw new fe(fe.TYPE_ERR);return this.nodes[l]},p.ANY_TYPE=0,p.NUMBER_TYPE=1,p.STRING_TYPE=2,p.BOOLEAN_TYPE=3,p.UNORDERED_NODE_ITERATOR_TYPE=4,p.ORDERED_NODE_ITERATOR_TYPE=5,p.UNORDERED_NODE_SNAPSHOT_TYPE=6,p.ORDERED_NODE_SNAPSHOT_TYPE=7,p.ANY_UNORDERED_NODE_TYPE=8,p.FIRST_ORDERED_NODE_TYPE=9;function d(l,N){l.createExpression=function(F,Q){try{return new $(F,Q,N)}catch(G){throw new fe(fe.INVALID_EXPRESSION_ERR,G)}},l.createNSResolver=function(F){return new _(F)},l.evaluate=function(F,Q,G,ie,ct){if(ie<0||ie>9)throw{code:0,toString:function(){return"Request type not supported"}};return l.createExpression(F,G,N).evaluate(Q,ie,ct)}}try{var T=!0;try{document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("XPath",null)&&(T=!1)}catch{}T&&d(document,new ne)}catch{}d(i,new ne),(function(){var l=new ne,N=new C,F=new Ke,Q=new He;function G(ht){return{getNamespace:function(Pt,kr){var An=ht(Pt,kr);return An||N.getNamespace(Pt,kr)}}}function ie(ht){return G(ht.getNamespace.bind(ht))}function ct(ht){return G(function(Pt){return ht[Pt]})}function Mt(ht){return ht&&typeof ht.getNamespace=="function"?ie(ht):typeof ht=="function"?G(ht):typeof ht=="object"?ct(ht):N}function Ft(ht){if(ht===null||typeof ht>"u"||ht instanceof $e||ht instanceof h||ht instanceof he||ht instanceof j)return ht;switch(typeof ht){case"string":return new $e(ht);case"boolean":return new h(ht);case"number":return new he(ht)}var Pt=new j;return Pt.addArray([].concat(ht)),Pt}function ft(ht){return function(Pt){var kr=Array.prototype.slice.call(arguments,1).map(function(mr){return mr.evaluate(Pt)}),An=ht.apply(this,[].concat(Pt,kr));return Ft(An)}}function Nt(ht){return{getFunction:function(Pt,kr){var An=ht(Pt,kr);return An?ft(An):F.getFunction(Pt,kr)}}}function an(ht){return Nt(ht.getFunction.bind(ht))}function Sn(ht){return Nt(function(Pt){return ht[Pt]})}function Zn(ht){return ht&&typeof ht.getFunction=="function"?an(ht):typeof ht=="function"?Nt(ht):typeof ht=="object"?Sn(ht):F}function es(ht){return{getVariable:function(Pt,kr){var An=ht(Pt,kr);return Ft(An)}}}function un(ht){if(ht){if(typeof ht.getVariable=="function")return es(ht.getVariable.bind(ht));if(typeof ht=="function")return es(ht);if(typeof ht=="object")return es(function(Pt){return ht[Pt]})}return Q}function Hn(ht,Pt,kr){ht in kr&&(Pt[ht]=kr[ht])}function Ws(ht){var Pt=new ye;return ht?(Pt.namespaceResolver=Mt(ht.namespaces),Pt.functionResolver=Zn(ht.functions),Pt.variableResolver=un(ht.variables),Pt.expressionContextNode=ht.node,Hn("allowAnyNamespaceForNoPrefix",Pt,ht),Hn("isHtml",Pt,ht)):Pt.namespaceResolver=N,Pt}function ou(ht,Pt){var kr=Ws(Pt);return ht.evaluate(kr)}var Xs={evaluate:function(ht){return ou(this.expression,ht)},evaluateNumber:function(ht){return this.evaluate(ht).numberValue()},evaluateString:function(ht){return this.evaluate(ht).stringValue()},evaluateBoolean:function(ht){return this.evaluate(ht).booleanValue()},evaluateNodeSet:function(ht){return this.evaluate(ht).nodeset()},select:function(ht){return this.evaluateNodeSet(ht).toArray()},select1:function(ht){return this.select(ht)[0]}};function Fl(ht){var Pt=l.parse(ht);return Object.create(Xs,{expression:{value:Pt}})}i.parse=Fl})(),$t(i,{XPath:Ie,XPathParser:ne,XPathResult:p,Step:B,PathExpr:nt,NodeTest:q,LocationPath:U,OrOperation:we,AndOperation:Ze,BarOperation:gt,EqualsOperation:Le,NotEqualOperation:_e,LessThanOperation:ce,GreaterThanOperation:xe,LessThanOrEqualOperation:se,GreaterThanOrEqualOperation:ee,PlusOperation:ae,MinusOperation:et,MultiplyOperation:Ae,DivOperation:lt,ModOperation:Ye,UnaryMinusOperation:it,FunctionCall:ge,VariableReference:Ue,XPathContext:ye,XNodeSet:j,XBoolean:h,XString:$e,XNumber:he,NamespaceResolver:C,FunctionResolver:Ke,VariableResolver:He,Utilities:M}),i.select=function(l,N,F){return i.selectWithResolver(l,N,null,F)},i.useNamespaces=function(l){var N={mappings:l||{},lookupNamespaceURI:function(F){return this.mappings[F]}};return function(F,Q,G){return i.selectWithResolver(F,Q,N,G)}},i.selectWithResolver=function(l,N,F,Q){var G=new $(l,F,new ne),ie=p.ANY_TYPE,ct=G.evaluate(N,ie,null);return ct.resultType==p.STRING_TYPE?ct=ct.stringValue:ct.resultType==p.NUMBER_TYPE?ct=ct.numberValue:ct.resultType==p.BOOLEAN_TYPE?ct=ct.booleanValue:(ct=ct.nodes,Q&&(ct=ct[0])),ct},i.select1=function(l,N){return i.select(l,N,!0)};var O=function(l){return Array.isArray(l)&&l.every(R)},P=function(l){return function(N){return R(N)&&N.nodeType===l}};$t(i,{isNodeLike:R,isArrayOfNodes:O,isElement:P(Ve.ELEMENT_NODE),isAttribute:P(Ve.ATTRIBUTE_NODE),isTextNode:P(Ve.TEXT_NODE),isCDATASection:P(Ve.CDATA_SECTION_NODE),isProcessingInstruction:P(Ve.PROCESSING_INSTRUCTION_NODE),isComment:P(Ve.COMMENT_NODE),isDocumentNode:P(Ve.DOCUMENT_NODE),isDocumentTypeNode:P(Ve.DOCUMENT_TYPE_NODE),isDocumentFragment:P(Ve.DOCUMENT_FRAGMENT_NODE)})})(g)})(Jg)),Jg}var lb=ib();const ab=F$(lb);var sd={},Qg={},B_;function ub(){return B_||(B_=1,Qg.entityMap={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}),Qg}var y$={},U_;function cb(){if(U_)return y$;U_=1;var f=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,g=new RegExp("[\\-\\.0-9"+f.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),i=new RegExp("^"+f.source+g.source+"*(?::"+f.source+g.source+"*)?$"),a=0,v=1,A=2,R=3,V=4,H=5,re=6,pe=7;function Z(Ie,Be){this.message=Ie,this.locator=Be,Error.captureStackTrace&&Error.captureStackTrace(this,Z)}Z.prototype=new Error,Z.prototype.name=Z.name;function W(){}W.prototype={parse:function(Ie,Be,ze){var dt=this.domBuilder;dt.startDocument(),ut(Be,Be={}),X(Ie,Be,ze,dt,this.errorHandler),dt.endDocument()}};function X(Ie,Be,ze,dt,it){function qe(me){if(me>65535){me-=65536;var $e=55296+(me>>10),he=56320+(me&1023);return String.fromCharCode($e,he)}else return String.fromCharCode(me)}function we(me){var $e=me.slice(1,-1);return $e in ze?ze[$e]:$e.charAt(0)==="#"?qe(parseInt($e.substr(1).replace("x","0x"))):(it.error("entity not found:"+me),me)}function Ze(me){if(me>et){var $e=Ie.substring(et,me).replace(/&#?\w+;/g,we);se&&Le(et),dt.characters($e,0,me-et),et=me}}function Le(me,$e){for(;me>=ce&&($e=xe.exec(Ie));)_e=$e.index,ce=_e+$e[0].length,se.lineNumber++;se.columnNumber=me-_e+1}for(var _e=0,ce=0,xe=/.*(?:\r\n?|\n)|.*$/g,se=dt.locator,ee=[{currentNSMap:Be}],ae={},et=0;;){try{var Ae=Ie.indexOf("<",et);if(Ae<0){if(!Ie.substr(et).match(/^\s*$/)){var lt=dt.doc,Ye=lt.createTextNode(Ie.substr(et));lt.appendChild(Ye),dt.currentElement=Ye}return}switch(Ae>et&&Ze(Ae),Ie.charAt(Ae+1)){case"/":var B=Ie.indexOf(">",Ae+3),gt=Ie.substring(Ae+2,B),nt=ee.pop();B<0?(gt=Ie.substring(Ae+2).replace(/[\s<].*/,""),it.error("end tag name: "+gt+" is not complete:"+nt.tagName),B=Ae+1+gt.length):gt.match(/\s</)&&(gt=gt.replace(/[\s<].*/,""),it.error("end tag name: "+gt+" maybe not complete"),B=Ae+1+gt.length);var Ot=nt.localNSMap,Je=nt.tagName==gt,Ut=Je||nt.tagName&&nt.tagName.toLowerCase()==gt.toLowerCase();if(Ut){if(dt.endElement(nt.uri,nt.localName,gt),Ot)for(var Oe in Ot)dt.endPrefixMapping(Oe);Je||it.fatalError("end tag name: "+gt+" is not match the current start tagName:"+nt.tagName)}else ee.push(nt);B++;break;case"?":se&&Le(Ae),B=$t(Ie,Ae,dt);break;case"!":se&&Le(Ae),B=ot(Ie,Ae,dt,it);break;default:se&&Le(Ae);var We=new Ve,U=ee[ee.length-1].currentNSMap,B=ve(Ie,Ae,We,U,we,it),ue=We.length;if(!We.closed&&Pe(Ie,B,We.tagName,ae)&&(We.closed=!0,ze.nbsp||it.warning("unclosed xml attribute")),se&&ue){for(var q=te(se,{}),Ue=0;Ue<ue;Ue++){var ge=We[Ue];Le(ge.offset),ge.locator=te(se,{})}dt.locator=q,De(We,dt,U)&&ee.push(We),dt.locator=se}else De(We,dt,U)&&ee.push(We);We.uri==="http://www.w3.org/1999/xhtml"&&!We.closed?B=Me(Ie,B,We.tagName,we,dt):B++}}catch(me){if(me instanceof Z)throw me;it.error("element parse error: "+me),B=-1}B>et?et=B:Ze(Math.max(Ae,et)+1)}}function te(Ie,Be){return Be.lineNumber=Ie.lineNumber,Be.columnNumber=Ie.columnNumber,Be}function ve(Ie,Be,ze,dt,it,qe){function we(se,ee,ae){se in ze.attributeNames&&qe.fatalError("Attribute "+se+" redefined"),ze.addValue(se,ee,ae)}for(var Ze,Le,_e=++Be,ce=a;;){var xe=Ie.charAt(_e);switch(xe){case"=":if(ce===v)Ze=Ie.slice(Be,_e),ce=R;else if(ce===A)ce=R;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(ce===R||ce===v)if(ce===v&&(qe.warning('attribute value must after "="'),Ze=Ie.slice(Be,_e)),Be=_e+1,_e=Ie.indexOf(xe,Be),_e>0)Le=Ie.slice(Be,_e).replace(/&#?\w+;/g,it),we(Ze,Le,Be-1),ce=H;else throw new Error("attribute value no end '"+xe+"' match");else if(ce==V)Le=Ie.slice(Be,_e).replace(/&#?\w+;/g,it),we(Ze,Le,Be),qe.warning('attribute "'+Ze+'" missed start quot('+xe+")!!"),Be=_e+1,ce=H;else throw new Error('attribute value must after "="');break;case"/":switch(ce){case a:ze.setTagName(Ie.slice(Be,_e));case H:case re:case pe:ce=pe,ze.closed=!0;case V:case v:case A:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return qe.error("unexpected end of input"),ce==a&&ze.setTagName(Ie.slice(Be,_e)),_e;case">":switch(ce){case a:ze.setTagName(Ie.slice(Be,_e));case H:case re:case pe:break;case V:case v:Le=Ie.slice(Be,_e),Le.slice(-1)==="/"&&(ze.closed=!0,Le=Le.slice(0,-1));case A:ce===A&&(Le=Ze),ce==V?(qe.warning('attribute "'+Le+'" missed quot(")!'),we(Ze,Le.replace(/&#?\w+;/g,it),Be)):((dt[""]!=="http://www.w3.org/1999/xhtml"||!Le.match(/^(?:disabled|checked|selected)$/i))&&qe.warning('attribute "'+Le+'" missed value!! "'+Le+'" instead!!'),we(Le,Le,Be));break;case R:throw new Error("attribute value missed!!")}return _e;case"€":xe=" ";default:if(xe<=" ")switch(ce){case a:ze.setTagName(Ie.slice(Be,_e)),ce=re;break;case v:Ze=Ie.slice(Be,_e),ce=A;break;case V:var Le=Ie.slice(Be,_e).replace(/&#?\w+;/g,it);qe.warning('attribute "'+Le+'" missed quot(")!!'),we(Ze,Le,Be);case H:ce=re;break}else switch(ce){case A:ze.tagName,(dt[""]!=="http://www.w3.org/1999/xhtml"||!Ze.match(/^(?:disabled|checked|selected)$/i))&&qe.warning('attribute "'+Ze+'" missed value!! "'+Ze+'" instead2!!'),we(Ze,Ze,Be),Be=_e,ce=v;break;case H:qe.warning('attribute space is required"'+Ze+'"!!');case re:ce=v,Be=_e;break;case R:ce=V,Be=_e;break;case pe:throw new Error("elements closed character '/' and '>' must be connected to")}}_e++}}function De(Ie,Be,ze){for(var dt=Ie.tagName,it=null,xe=Ie.length;xe--;){var qe=Ie[xe],we=qe.qName,Ze=qe.value,se=we.indexOf(":");if(se>0)var Le=qe.prefix=we.slice(0,se),_e=we.slice(se+1),ce=Le==="xmlns"&&_e;else _e=we,Le=null,ce=we==="xmlns"&&"";qe.localName=_e,ce!==!1&&(it==null&&(it={},ut(ze,ze={})),ze[ce]=it[ce]=Ze,qe.uri="http://www.w3.org/2000/xmlns/",Be.startPrefixMapping(ce,Ze))}for(var xe=Ie.length;xe--;){qe=Ie[xe];var Le=qe.prefix;Le&&(Le==="xml"&&(qe.uri="http://www.w3.org/XML/1998/namespace"),Le!=="xmlns"&&(qe.uri=ze[Le||""]))}var se=dt.indexOf(":");se>0?(Le=Ie.prefix=dt.slice(0,se),_e=Ie.localName=dt.slice(se+1)):(Le=null,_e=Ie.localName=dt);var ee=Ie.uri=ze[Le||""];if(Be.startElement(ee,_e,dt,Ie),Ie.closed){if(Be.endElement(ee,_e,dt),it)for(Le in it)Be.endPrefixMapping(Le)}else return Ie.currentNSMap=ze,Ie.localNSMap=it,!0}function Me(Ie,Be,ze,dt,it){if(/^(?:script|textarea)$/i.test(ze)){var qe=Ie.indexOf("</"+ze+">",Be),we=Ie.substring(Be+1,qe);if(/[&<]/.test(we))return/^script$/i.test(ze)?(it.characters(we,0,we.length),qe):(we=we.replace(/&#?\w+;/g,dt),it.characters(we,0,we.length),qe)}return Be+1}function Pe(Ie,Be,ze,dt){var it=dt[ze];return it==null&&(it=Ie.lastIndexOf("</"+ze+">"),it<Be&&(it=Ie.lastIndexOf("</"+ze)),dt[ze]=it),it<Be}function ut(Ie,Be){for(var ze in Ie)Be[ze]=Ie[ze]}function ot(Ie,Be,ze,dt){var it=Ie.charAt(Be+2);switch(it){case"-":if(Ie.charAt(Be+3)==="-"){var qe=Ie.indexOf("-->",Be+4);return qe>Be?(ze.comment(Ie,Be+4,qe-Be-4),qe+3):(dt.error("Unclosed comment"),-1)}else return-1;default:if(Ie.substr(Be+3,6)=="CDATA["){var qe=Ie.indexOf("]]>",Be+9);return ze.startCDATA(),ze.characters(Ie,Be+9,qe-Be-9),ze.endCDATA(),qe+3}var we=ne(Ie,Be),Ze=we.length;if(Ze>1&&/!doctype/i.test(we[0][0])){var Le=we[1][0],_e=!1,ce=!1;Ze>3&&(/^public$/i.test(we[2][0])?(_e=we[3][0],ce=Ze>4&&we[4][0]):/^system$/i.test(we[2][0])&&(ce=we[3][0]));var xe=we[Ze-1];return ze.startDTD(Le,_e,ce),ze.endDTD(),xe.index+xe[0].length}}return-1}function $t(Ie,Be,ze){var dt=Ie.indexOf("?>",Be);if(dt){var it=Ie.substring(Be,dt).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return it?(it[0].length,ze.processingInstruction(it[1],it[2]),dt+2):-1}return-1}function Ve(){this.attributeNames={}}Ve.prototype={setTagName:function(Ie){if(!i.test(Ie))throw new Error("invalid tagName:"+Ie);this.tagName=Ie},addValue:function(Ie,Be,ze){if(!i.test(Ie))throw new Error("invalid attribute:"+Ie);this.attributeNames[Ie]=this.length,this[this.length++]={qName:Ie,value:Be,offset:ze}},length:0,getLocalName:function(Ie){return this[Ie].localName},getLocator:function(Ie){return this[Ie].locator},getQName:function(Ie){return this[Ie].qName},getURI:function(Ie){return this[Ie].uri},getValue:function(Ie){return this[Ie].value}};function ne(Ie,Be){var ze,dt=[],it=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(it.lastIndex=Be,it.exec(Ie);ze=it.exec(Ie);)if(dt.push(ze),ze[1])return dt}return y$.XMLReader=W,y$.ParseError=Z,y$}var od={},V_;function H_(){if(V_)return od;V_=1;function f(D,h){for(var w in D)h[w]=D[w]}function g(D,h){var w=D.prototype;if(!(w instanceof h)){let j=function(){};var J=j;j.prototype=h.prototype,j=new j,f(w,j),D.prototype=w=j}w.constructor!=D&&(typeof D!="function"&&console.error("unknow Class:"+D),w.constructor=D)}var i="http://www.w3.org/1999/xhtml",a={},v=a.ELEMENT_NODE=1,A=a.ATTRIBUTE_NODE=2,R=a.TEXT_NODE=3,V=a.CDATA_SECTION_NODE=4,H=a.ENTITY_REFERENCE_NODE=5,re=a.ENTITY_NODE=6,pe=a.PROCESSING_INSTRUCTION_NODE=7,Z=a.COMMENT_NODE=8,W=a.DOCUMENT_NODE=9,X=a.DOCUMENT_TYPE_NODE=10,te=a.DOCUMENT_FRAGMENT_NODE=11,ve=a.NOTATION_NODE=12,De={},Me={};De.INDEX_SIZE_ERR=(Me[1]="Index size error",1),De.DOMSTRING_SIZE_ERR=(Me[2]="DOMString size error",2);var Pe=De.HIERARCHY_REQUEST_ERR=(Me[3]="Hierarchy request error",3);De.WRONG_DOCUMENT_ERR=(Me[4]="Wrong document",4),De.INVALID_CHARACTER_ERR=(Me[5]="Invalid character",5),De.NO_DATA_ALLOWED_ERR=(Me[6]="No data allowed",6),De.NO_MODIFICATION_ALLOWED_ERR=(Me[7]="No modification allowed",7);var ut=De.NOT_FOUND_ERR=(Me[8]="Not found",8);De.NOT_SUPPORTED_ERR=(Me[9]="Not supported",9);var ot=De.INUSE_ATTRIBUTE_ERR=(Me[10]="Attribute in use",10);De.INVALID_STATE_ERR=(Me[11]="Invalid state",11),De.SYNTAX_ERR=(Me[12]="Syntax error",12),De.INVALID_MODIFICATION_ERR=(Me[13]="Invalid modification",13),De.NAMESPACE_ERR=(Me[14]="Invalid namespace",14),De.INVALID_ACCESS_ERR=(Me[15]="Invalid access",15);function $t(D,h){if(h instanceof Error)var w=h;else w=this,Error.call(this,Me[D]),this.message=Me[D],Error.captureStackTrace&&Error.captureStackTrace(this,$t);return w.code=D,h&&(this.message=this.message+": "+h),w}$t.prototype=Error.prototype,f(De,$t);function Ve(){}Ve.prototype={length:0,item:function(D){return this[D]||null},toString:function(D,h){for(var w=[],J=0;J<this.length;J++)ge(this[J],w,D,h);return w.join("")}};function ne(D,h){this._node=D,this._refresh=h,Ie(this)}function Ie(D){var h=D._node._inc||D._node.ownerDocument._inc;if(D._inc!=h){var w=D._refresh(D._node);he(D,"length",w.length),f(w,D),D._inc=h}}ne.prototype.item=function(D){return Ie(this),this[D]},g(ne,Ve);function Be(){}function ze(D,h){for(var w=D.length;w--;)if(D[w]===h)return w}function dt(D,h,w,J){if(J?h[ze(h,J)]=w:h[h.length++]=w,D){w.ownerElement=D;var j=D.ownerDocument;j&&(J&&xe(j,D,J),ce(j,D,w))}}function it(D,h,w){var J=ze(h,w);if(J>=0){for(var j=h.length-1;J<j;)h[J]=h[++J];if(h.length=j,D){var be=D.ownerDocument;be&&(xe(be,D,w),w.ownerElement=null)}}else throw $t(ut,new Error(D.tagName+"@"+w))}Be.prototype={length:0,item:Ve.prototype.item,getNamedItem:function(D){for(var h=this.length;h--;){var w=this[h];if(w.nodeName==D)return w}},setNamedItem:function(D){var h=D.ownerElement;if(h&&h!=this._ownerElement)throw new $t(ot);var w=this.getNamedItem(D.nodeName);return dt(this._ownerElement,this,D,w),w},setNamedItemNS:function(D){var h=D.ownerElement,w;if(h&&h!=this._ownerElement)throw new $t(ot);return w=this.getNamedItemNS(D.namespaceURI,D.localName),dt(this._ownerElement,this,D,w),w},removeNamedItem:function(D){var h=this.getNamedItem(D);return it(this._ownerElement,this,h),h},removeNamedItemNS:function(D,h){var w=this.getNamedItemNS(D,h);return it(this._ownerElement,this,w),w},getNamedItemNS:function(D,h){for(var w=this.length;w--;){var J=this[w];if(J.localName==h&&J.namespaceURI==D)return J}return null}};function qe(D){if(this._features={},D)for(var h in D)this._features=D[h]}qe.prototype={hasFeature:function(D,h){var w=this._features[D.toLowerCase()];return!!(w&&(!h||h in w))},createDocument:function(D,h,w){var J=new _e;if(J.implementation=this,J.childNodes=new Ve,J.doctype=w,w&&J.appendChild(w),h){var j=J.createElementNS(D,h);J.appendChild(j)}return J},createDocumentType:function(D,h,w){var J=new Je;return J.name=D,J.nodeName=D,J.publicId=h,J.systemId=w,J}};function we(){}we.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(D,h){return ae(this,D,h)},replaceChild:function(D,h){this.insertBefore(D,h),h&&this.removeChild(h)},removeChild:function(D){return ee(this,D)},appendChild:function(D){return this.insertBefore(D,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(D){return $e(this.ownerDocument||this,this,D)},normalize:function(){for(var D=this.firstChild;D;){var h=D.nextSibling;h&&h.nodeType==R&&D.nodeType==R?(this.removeChild(h),D.appendData(h.data)):(D.normalize(),D=h)}},isSupported:function(D,h){return this.ownerDocument.implementation.hasFeature(D,h)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(D){for(var h=this;h;){var w=h._nsMap;if(w){for(var J in w)if(w[J]==D)return J}h=h.nodeType==A?h.ownerDocument:h.parentNode}return null},lookupNamespaceURI:function(D){for(var h=this;h;){var w=h._nsMap;if(w&&D in w)return w[D];h=h.nodeType==A?h.ownerDocument:h.parentNode}return null},isDefaultNamespace:function(D){var h=this.lookupPrefix(D);return h==null}};function Ze(D){return D=="<"&&"&lt;"||D==">"&&"&gt;"||D=="&"&&"&amp;"||D=='"'&&"&quot;"||"&#"+D.charCodeAt()+";"}f(a,we),f(a,we.prototype);function Le(D,h){if(h(D))return!0;if(D=D.firstChild)do if(Le(D,h))return!0;while(D=D.nextSibling)}function _e(){}function ce(D,h,w){D&&D._inc++;var J=w.namespaceURI;J=="http://www.w3.org/2000/xmlns/"&&(h._nsMap[w.prefix?w.localName:""]=w.value)}function xe(D,h,w,J){D&&D._inc++;var j=w.namespaceURI;j=="http://www.w3.org/2000/xmlns/"&&delete h._nsMap[w.prefix?w.localName:""]}function se(D,h,w){if(D&&D._inc){D._inc++;var J=h.childNodes;if(w)J[J.length++]=w;else{for(var j=h.firstChild,be=0;j;)J[be++]=j,j=j.nextSibling;J.length=be}}}function ee(D,h){var w=h.previousSibling,J=h.nextSibling;return w?w.nextSibling=J:D.firstChild=J,J?J.previousSibling=w:D.lastChild=w,se(D.ownerDocument,D),h}function ae(D,h,w){var J=h.parentNode;if(J&&J.removeChild(h),h.nodeType===te){var j=h.firstChild;if(j==null)return h;var be=h.lastChild}else j=be=h;var ye=w?w.previousSibling:D.lastChild;j.previousSibling=ye,be.nextSibling=w,ye?ye.nextSibling=j:D.firstChild=j,w==null?D.lastChild=be:w.previousSibling=be;do j.parentNode=D;while(j!==be&&(j=j.nextSibling));return se(D.ownerDocument||D,D),h.nodeType==te&&(h.firstChild=h.lastChild=null),h}function et(D,h){var w=h.parentNode;if(w){var J=D.lastChild;w.removeChild(h);var J=D.lastChild}var J=D.lastChild;return h.parentNode=D,h.previousSibling=J,h.nextSibling=null,J?J.nextSibling=h:D.firstChild=h,D.lastChild=h,se(D.ownerDocument,D,h),h}_e.prototype={nodeName:"#document",nodeType:W,doctype:null,documentElement:null,_inc:1,insertBefore:function(D,h){if(D.nodeType==te){for(var w=D.firstChild;w;){var J=w.nextSibling;this.insertBefore(w,h),w=J}return D}return this.documentElement==null&&D.nodeType==v&&(this.documentElement=D),ae(this,D,h),D.ownerDocument=this,D},removeChild:function(D){return this.documentElement==D&&(this.documentElement=null),ee(this,D)},importNode:function(D,h){return me(this,D,h)},getElementById:function(D){var h=null;return Le(this.documentElement,function(w){if(w.nodeType==v&&w.getAttribute("id")==D)return h=w,!0}),h},getElementsByClassName:function(D){var h=new RegExp("(^|\\s)"+D+"(\\s|$)");return new ne(this,function(w){var J=[];return Le(w.documentElement,function(j){j!==w&&j.nodeType==v&&h.test(j.getAttribute("class"))&&J.push(j)}),J})},createElement:function(D){var h=new Ae;h.ownerDocument=this,h.nodeName=D,h.tagName=D,h.childNodes=new Ve;var w=h.attributes=new Be;return w._ownerElement=h,h},createDocumentFragment:function(){var D=new U;return D.ownerDocument=this,D.childNodes=new Ve,D},createTextNode:function(D){var h=new gt;return h.ownerDocument=this,h.appendData(D),h},createComment:function(D){var h=new nt;return h.ownerDocument=this,h.appendData(D),h},createCDATASection:function(D){var h=new Ot;return h.ownerDocument=this,h.appendData(D),h},createProcessingInstruction:function(D,h){var w=new B;return w.ownerDocument=this,w.tagName=w.target=D,w.nodeValue=w.data=h,w},createAttribute:function(D){var h=new lt;return h.ownerDocument=this,h.name=D,h.nodeName=D,h.localName=D,h.specified=!0,h},createEntityReference:function(D){var h=new We;return h.ownerDocument=this,h.nodeName=D,h},createElementNS:function(D,h){var w=new Ae,J=h.split(":"),j=w.attributes=new Be;return w.childNodes=new Ve,w.ownerDocument=this,w.nodeName=h,w.tagName=h,w.namespaceURI=D,J.length==2?(w.prefix=J[0],w.localName=J[1]):w.localName=h,j._ownerElement=w,w},createAttributeNS:function(D,h){var w=new lt,J=h.split(":");return w.ownerDocument=this,w.nodeName=h,w.name=h,w.namespaceURI=D,w.specified=!0,J.length==2?(w.prefix=J[0],w.localName=J[1]):w.localName=h,w}},g(_e,we);function Ae(){this._nsMap={}}Ae.prototype={nodeType:v,hasAttribute:function(D){return this.getAttributeNode(D)!=null},getAttribute:function(D){var h=this.getAttributeNode(D);return h&&h.value||""},getAttributeNode:function(D){return this.attributes.getNamedItem(D)},setAttribute:function(D,h){var w=this.ownerDocument.createAttribute(D);w.value=w.nodeValue=""+h,this.setAttributeNode(w)},removeAttribute:function(D){var h=this.getAttributeNode(D);h&&this.removeAttributeNode(h)},appendChild:function(D){return D.nodeType===te?this.insertBefore(D,null):et(this,D)},setAttributeNode:function(D){return this.attributes.setNamedItem(D)},setAttributeNodeNS:function(D){return this.attributes.setNamedItemNS(D)},removeAttributeNode:function(D){return this.attributes.removeNamedItem(D.nodeName)},removeAttributeNS:function(D,h){var w=this.getAttributeNodeNS(D,h);w&&this.removeAttributeNode(w)},hasAttributeNS:function(D,h){return this.getAttributeNodeNS(D,h)!=null},getAttributeNS:function(D,h){var w=this.getAttributeNodeNS(D,h);return w&&w.value||""},setAttributeNS:function(D,h,w){var J=this.ownerDocument.createAttributeNS(D,h);J.value=J.nodeValue=""+w,this.setAttributeNode(J)},getAttributeNodeNS:function(D,h){return this.attributes.getNamedItemNS(D,h)},getElementsByTagName:function(D){return new ne(this,function(h){var w=[];return Le(h,function(J){J!==h&&J.nodeType==v&&(D==="*"||J.tagName==D)&&w.push(J)}),w})},getElementsByTagNameNS:function(D,h){return new ne(this,function(w){var J=[];return Le(w,function(j){j!==w&&j.nodeType===v&&(D==="*"||j.namespaceURI===D)&&(h==="*"||j.localName==h)&&J.push(j)}),J})}},_e.prototype.getElementsByTagName=Ae.prototype.getElementsByTagName,_e.prototype.getElementsByTagNameNS=Ae.prototype.getElementsByTagNameNS,g(Ae,we);function lt(){}lt.prototype.nodeType=A,g(lt,we);function Ye(){}Ye.prototype={data:"",substringData:function(D,h){return this.data.substring(D,D+h)},appendData:function(D){D=this.data+D,this.nodeValue=this.data=D,this.length=D.length},insertData:function(D,h){this.replaceData(D,0,h)},appendChild:function(D){throw new Error(Me[Pe])},deleteData:function(D,h){this.replaceData(D,h,"")},replaceData:function(D,h,w){var J=this.data.substring(0,D),j=this.data.substring(D+h);w=J+w+j,this.nodeValue=this.data=w,this.length=w.length}},g(Ye,we);function gt(){}gt.prototype={nodeName:"#text",nodeType:R,splitText:function(D){var h=this.data,w=h.substring(D);h=h.substring(0,D),this.data=this.nodeValue=h,this.length=h.length;var J=this.ownerDocument.createTextNode(w);return this.parentNode&&this.parentNode.insertBefore(J,this.nextSibling),J}},g(gt,Ye);function nt(){}nt.prototype={nodeName:"#comment",nodeType:Z},g(nt,Ye);function Ot(){}Ot.prototype={nodeName:"#cdata-section",nodeType:V},g(Ot,Ye);function Je(){}Je.prototype.nodeType=X,g(Je,we);function Ut(){}Ut.prototype.nodeType=ve,g(Ut,we);function Oe(){}Oe.prototype.nodeType=re,g(Oe,we);function We(){}We.prototype.nodeType=H,g(We,we);function U(){}U.prototype.nodeName="#document-fragment",U.prototype.nodeType=te,g(U,we);function B(){}B.prototype.nodeType=pe,g(B,we);function ue(){}ue.prototype.serializeToString=function(D,h,w){return q.call(D,h,w)},we.prototype.toString=q;function q(D,h){var w=[],J=this.nodeType==9&&this.documentElement||this,j=J.prefix,be=J.namespaceURI;if(be&&j==null){var j=J.lookupPrefix(be);if(j==null)var ye=[{namespace:be,prefix:null}]}return ge(this,w,D,h,ye),w.join("")}function Ue(D,h,w){var J=D.prefix||"",j=D.namespaceURI;if(!J&&!j||J==="xml"&&j==="http://www.w3.org/XML/1998/namespace"||j=="http://www.w3.org/2000/xmlns/")return!1;for(var be=w.length;be--;){var ye=w[be];if(ye.prefix==J)return ye.namespace!=j}return!0}function ge(D,h,w,J,j){if(J)if(D=J(D),D){if(typeof D=="string"){h.push(D);return}}else return;switch(D.nodeType){case v:j||(j=[]),j.length;var be=D.attributes,ye=be.length,fe=D.firstChild,He=D.tagName;w=i===D.namespaceURI||w,h.push("<",He);for(var Ke=0;Ke<ye;Ke++){var C=be.item(Ke);C.prefix=="xmlns"?j.push({prefix:C.localName,namespace:C.value}):C.nodeName=="xmlns"&&j.push({prefix:"",namespace:C.value})}for(var Ke=0;Ke<ye;Ke++){var C=be.item(Ke);if(Ue(C,w,j)){var k=C.prefix||"",M=C.namespaceURI,z=k?" xmlns:"+k:" xmlns";h.push(z,'="',M,'"'),j.push({prefix:k,namespace:M})}ge(C,h,w,J,j)}if(Ue(D,w,j)){var k=D.prefix||"",M=D.namespaceURI;if(M){var z=k?" xmlns:"+k:" xmlns";h.push(z,'="',M,'"'),j.push({prefix:k,namespace:M})}}if(fe||w&&!/^(?:meta|link|img|br|hr|input)$/i.test(He)){if(h.push(">"),w&&/^script$/i.test(He))for(;fe;)fe.data?h.push(fe.data):ge(fe,h,w,J,j),fe=fe.nextSibling;else for(;fe;)ge(fe,h,w,J,j),fe=fe.nextSibling;h.push("</",He,">")}else h.push("/>");return;case W:case te:for(var fe=D.firstChild;fe;)ge(fe,h,w,J,j),fe=fe.nextSibling;return;case A:return h.push(" ",D.name,'="',D.value.replace(/[<&"]/g,Ze),'"');case R:return h.push(D.data.replace(/[<&]/g,Ze).replace(/]]>/g,"]]&gt;"));case V:return h.push("<![CDATA[",D.data,"]]>");case Z:return h.push("<!--",D.data,"-->");case X:var $=D.publicId,y=D.systemId;if(h.push("<!DOCTYPE ",D.name),$)h.push(" PUBLIC ",$),y&&y!="."&&h.push(" ",y),h.push(">");else if(y&&y!=".")h.push(" SYSTEM ",y,">");else{var _=D.internalSubset;_&&h.push(" [",_,"]"),h.push(">")}return;case pe:return h.push("<?",D.target," ",D.data,"?>");case H:return h.push("&",D.nodeName,";");default:h.push("??",D.nodeName)}}function me(D,h,w){var J;switch(h.nodeType){case v:J=h.cloneNode(!1),J.ownerDocument=D;case te:break;case A:w=!0;break}if(J||(J=h.cloneNode(!1)),J.ownerDocument=D,J.parentNode=null,w)for(var j=h.firstChild;j;)J.appendChild(me(D,j,w)),j=j.nextSibling;return J}function $e(D,h,w){var J=new h.constructor;for(var j in h){var be=h[j];typeof be!="object"&&be!=J[j]&&(J[j]=be)}switch(h.childNodes&&(J.childNodes=new Ve),J.ownerDocument=D,J.nodeType){case v:var ye=h.attributes,He=J.attributes=new Be,Ke=ye.length;He._ownerElement=J;for(var C=0;C<Ke;C++)J.setAttributeNode($e(D,ye.item(C),!0));break;case A:w=!0}if(w)for(var k=h.firstChild;k;)J.appendChild($e(D,k,w)),k=k.nextSibling;return J}function he(D,h,w){D[h]=w}try{if(Object.defineProperty){let D=function(h){switch(h.nodeType){case v:case te:var w=[];for(h=h.firstChild;h;)h.nodeType!==7&&h.nodeType!==8&&w.push(D(h)),h=h.nextSibling;return w.join("");default:return h.nodeValue}};var tt=D;Object.defineProperty(ne.prototype,"length",{get:function(){return Ie(this),this.$$length}}),Object.defineProperty(we.prototype,"textContent",{get:function(){return D(this)},set:function(h){switch(this.nodeType){case v:case te:for(;this.firstChild;)this.removeChild(this.firstChild);(h||String(h))&&this.appendChild(this.ownerDocument.createTextNode(h));break;default:this.data=h,this.value=h,this.nodeValue=h}}}),he=function(h,w,J){h["$$"+w]=J}}}catch{}return od.Node=we,od.DOMException=$t,od.DOMImplementation=qe,od.XMLSerializer=ue,od}var G_;function db(){if(G_)return sd;G_=1;function f(W){this.options=W||{locator:{}}}f.prototype.parseFromString=function(W,X){var te=this.options,ve=new re,De=te.domBuilder||new i,Me=te.errorHandler,Pe=te.locator,ut=te.xmlns||{},ot=/\/x?html?$/.test(X),$t=ot?V.entityMap:{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};return Pe&&De.setDocumentLocator(Pe),ve.errorHandler=g(Me,De,Pe),ve.domBuilder=te.domBuilder||De,ot&&(ut[""]="http://www.w3.org/1999/xhtml"),ut.xml=ut.xml||"http://www.w3.org/XML/1998/namespace",W&&typeof W=="string"?ve.parse(W,ut,$t):ve.errorHandler.error("invalid doc source"),De.doc};function g(W,X,te){if(!W){if(X instanceof i)return X;W=X}var ve={},De=W instanceof Function;te=te||{};function Me(Pe){var ut=W[Pe];!ut&&De&&(ut=W.length==2?function(ot){W(Pe,ot)}:W),ve[Pe]=ut&&function(ot){ut("[xmldom "+Pe+"] "+ot+v(te))}||function(){}}return Me("warning"),Me("error"),Me("fatalError"),ve}function i(){this.cdata=!1}function a(W,X){X.lineNumber=W.lineNumber,X.columnNumber=W.columnNumber}i.prototype={startDocument:function(){this.doc=new Z().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(W,X,te,ve){var De=this.doc,Me=De.createElementNS(W,te||X),Pe=ve.length;R(this,Me),this.currentElement=Me,this.locator&&a(this.locator,Me);for(var ut=0;ut<Pe;ut++){var W=ve.getURI(ut),ot=ve.getValue(ut),te=ve.getQName(ut),$t=De.createAttributeNS(W,te);this.locator&&a(ve.getLocator(ut),$t),$t.value=$t.nodeValue=ot,Me.setAttributeNode($t)}},endElement:function(W,X,te){var ve=this.currentElement;ve.tagName,this.currentElement=ve.parentNode},startPrefixMapping:function(W,X){},endPrefixMapping:function(W){},processingInstruction:function(W,X){var te=this.doc.createProcessingInstruction(W,X);this.locator&&a(this.locator,te),R(this,te)},ignorableWhitespace:function(W,X,te){},characters:function(W,X,te){if(W=A.apply(this,arguments),W){if(this.cdata)var ve=this.doc.createCDATASection(W);else var ve=this.doc.createTextNode(W);this.currentElement?this.currentElement.appendChild(ve):/^\s*$/.test(W)&&this.doc.appendChild(ve),this.locator&&a(this.locator,ve)}},skippedEntity:function(W){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(W){(this.locator=W)&&(W.lineNumber=0)},comment:function(W,X,te){W=A.apply(this,arguments);var ve=this.doc.createComment(W);this.locator&&a(this.locator,ve),R(this,ve)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(W,X,te){var ve=this.doc.implementation;if(ve&&ve.createDocumentType){var De=ve.createDocumentType(W,X,te);this.locator&&a(this.locator,De),R(this,De)}},warning:function(W){console.warn("[xmldom warning] "+W,v(this.locator))},error:function(W){console.error("[xmldom error] "+W,v(this.locator))},fatalError:function(W){throw new pe(W,this.locator)}};function v(W){if(W)return`
836
- @`+(W.systemId||"")+"#[line:"+W.lineNumber+",col:"+W.columnNumber+"]"}function A(W,X,te){return typeof W=="string"?W.substr(X,te):W.length>=X+te||X?new java.lang.String(W,X,te)+"":W}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(W){i.prototype[W]=function(){return null}});function R(W,X){W.currentElement?W.currentElement.appendChild(X):W.doc.appendChild(X)}var V=ub(),H=cb(),re=H.XMLReader,pe=H.ParseError,Z=sd.DOMImplementation=H_().DOMImplementation;return sd.XMLSerializer=H_().XMLSerializer,sd.DOMParser=f,sd.__DOMHandler=i,sd}var hb=db();function sf(f,g,i,a){if(!g)if(f.softAssertions){const v={message:i,stepId:a==null?void 0:a.stepId,stepType:a==null?void 0:a.stepType,expected:a==null?void 0:a.expected,actual:a==null?void 0:a.actual,timestamp:new Date().toISOString()};f.softAssertionErrors||(f.softAssertionErrors=[]),f.softAssertionErrors.push(v),f.logger.warn(`Soft assertion failed: ${i}`)}else throw new Error(i)}const pb=[{type:"api_set_header",category:"API",color:"#7B1FA2",tooltip:"Set a request header (applies to subsequent requests)",inputs:[{name:"NAME",type:"field",fieldType:"text",required:!0,default:"Authorization"},{name:"VALUE",type:"field",fieldType:"text",required:!0,default:"Bearer token"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.NAME,a=Qn(f.VALUE,g);let v=g.variables.get("__requestHeaders");return v||(v={}),v[i]=a,g.variables.set("__requestHeaders",v),g.logger.info(`Set header: ${i}: ${a.substring(0,30)}${a.length>30?"...":""}`),{_summary:`${i}: ${a.substring(0,30)}${a.length>30?"...":""}`,name:i,value:a}}},{type:"api_set_headers",category:"API",color:"#7B1FA2",tooltip:"Set multiple request headers from JSON object",inputs:[{name:"HEADERS",type:"field",fieldType:"text",required:!0,default:'{"Content-Type": "application/json"}'}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=Qn(f.HEADERS,g);try{const a=JSON.parse(i);let v=g.variables.get("__requestHeaders");v||(v={}),Object.assign(v,a),g.variables.set("__requestHeaders",v);const A=Object.keys(a).join(", ");return g.logger.info(`Set headers: ${A}`),{_summary:`Set ${Object.keys(a).length} headers`,headers:a}}catch{throw new Error(`Invalid JSON for headers: ${i}`)}}},{type:"api_clear_headers",category:"API",color:"#7B1FA2",tooltip:"Clear all request headers",inputs:[],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>(g.variables.delete("__requestHeaders"),g.logger.info("Cleared all request headers"),{_summary:"Headers cleared"})},{type:"api_get",category:"API",color:"#4CAF50",tooltip:"Perform HTTP GET request and store response",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"HEADERS",type:"field",fieldType:"text",default:""}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=Qn(f.URL,g),a=g.variables.get("__requestHeaders")||{},v=np(f.HEADERS,g),A={...a,...v};g.logger.info(`GET ${i}`);const R=await fetch(i,{headers:A,signal:g.abortSignal}),V=await sp(R);return g.variables.set("__lastResponse",V),V}},{type:"api_post",category:"API",color:"#4CAF50",tooltip:"Perform HTTP POST request and store response",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"BODY",type:"field",fieldType:"text",default:"{}"},{name:"HEADERS",type:"field",fieldType:"text",default:""}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=Qn(f.URL,g),a=Qn(f.BODY||"{}",g),v=g.variables.get("__requestHeaders")||{},A=np(f.HEADERS,g);let R;try{R=JSON.parse(a)}catch{R=a}g.logger.info(`POST ${i}`);const V=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json",...v,...A},body:typeof R=="string"?R:JSON.stringify(R),signal:g.abortSignal}),H=await sp(V);return g.variables.set("__lastResponse",H),H}},{type:"api_put",category:"API",color:"#4CAF50",tooltip:"Perform HTTP PUT request and store response",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"BODY",type:"field",fieldType:"text",default:"{}"},{name:"HEADERS",type:"field",fieldType:"text",default:""}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=Qn(f.URL,g),a=Qn(f.BODY||"{}",g),v=g.variables.get("__requestHeaders")||{},A=np(f.HEADERS,g);let R;try{R=JSON.parse(a)}catch{R=a}g.logger.info(`PUT ${i}`);const V=await fetch(i,{method:"PUT",headers:{"Content-Type":"application/json",...v,...A},body:typeof R=="string"?R:JSON.stringify(R),signal:g.abortSignal}),H=await sp(V);return g.variables.set("__lastResponse",H),H}},{type:"api_patch",category:"API",color:"#4CAF50",tooltip:"Perform HTTP PATCH request and store response",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"BODY",type:"field",fieldType:"text",default:"{}"},{name:"HEADERS",type:"field",fieldType:"text",default:""}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=Qn(f.URL,g),a=Qn(f.BODY||"{}",g),v=g.variables.get("__requestHeaders")||{},A=np(f.HEADERS,g);let R;try{R=JSON.parse(a)}catch{R=a}g.logger.info(`PATCH ${i}`);const V=await fetch(i,{method:"PATCH",headers:{"Content-Type":"application/json",...v,...A},body:typeof R=="string"?R:JSON.stringify(R),signal:g.abortSignal}),H=await sp(V);return g.variables.set("__lastResponse",H),H}},{type:"api_delete",category:"API",color:"#4CAF50",tooltip:"Perform HTTP DELETE request and store response",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"HEADERS",type:"field",fieldType:"text",default:""}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=Qn(f.URL,g),a=g.variables.get("__requestHeaders")||{},v=np(f.HEADERS,g),A={...a,...v};g.logger.info(`DELETE ${i}`);const R=await fetch(i,{method:"DELETE",headers:A,signal:g.abortSignal}),V=await sp(R);return g.variables.set("__lastResponse",V),V}},{type:"api_assert_status",category:"API",color:"#FF9800",tooltip:"Assert that response has expected status code",inputs:[{name:"STATUS",type:"field",fieldType:"number",default:200,required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.variables.get("__lastResponse");if(!i)throw new Error("No response available. Make sure to call an API request first.");const a=f.STATUS;return sf(g,i.status===a,`Expected status ${a} but got ${i.status}`,{stepType:"api_assert_status",expected:a,actual:i.status}),g.logger.info(`✓ Status is ${a}`),{_summary:`✓ Status ${i.status} === ${a}`,expected:a,actual:i.status}}},{type:"api_assert_body_contains",category:"API",color:"#FF9800",tooltip:"Assert that response body contains expected value",inputs:[{name:"PATH",type:"field",fieldType:"text",default:""},{name:"VALUE",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.variables.get("__lastResponse");if(!i)throw new Error("No response available. Make sure to call an API request first.");const a=f.PATH,v=Qn(f.VALUE,g),A=a?j_(i.body,a):i.body,R=typeof A=="string"?A:JSON.stringify(A);return sf(g,R.includes(v),`Expected ${a||"body"} to contain "${v}" but got "${R}"`,{stepType:"api_assert_body_contains",expected:v,actual:R}),g.logger.info(`✓ ${a||"body"} contains "${v}"`),{_summary:`✓ ${a||"body"} contains "${v}"`,path:a||"body",expected:v,actual:R.substring(0,100)+(R.length>100?"...":"")}}},{type:"api_extract_jsonpath",category:"API",color:"#2196F3",tooltip:"Extract a value from JSON response using JSONPath expression",inputs:[{name:"JSONPATH",type:"field",fieldType:"text",required:!0,default:"$.data.id"},{name:"VARIABLE",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.variables.get("__lastResponse");if(!i)throw new Error("No response available. Make sure to call an API request first.");const a=f.JSONPATH,v=f.VARIABLE;try{const A=Jt({path:a,json:i.body}),R=A.length===1?A[0]:A;g.variables.set(v,R);const V=JSON.stringify(R);return g.logger.info(`Extracted (JSONPath) ${a} → ${v} = ${V}`),{_summary:`${v} = ${V.substring(0,50)}${V.length>50?"...":""}`,variable:v,jsonPath:a,value:R}}catch(A){throw new Error(`Invalid JSONPath expression: ${a}. Error: ${A.message}`)}}},{type:"api_extract_xpath",category:"API",color:"#2196F3",tooltip:"Extract a value from XML/HTML response using XPath expression",inputs:[{name:"XPATH",type:"field",fieldType:"text",required:!0,default:"//title/text()"},{name:"VARIABLE",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.variables.get("__lastResponse");if(!i)throw new Error("No response available. Make sure to call an API request first.");const a=f.XPATH,v=f.VARIABLE;try{const A=typeof i.body=="string"?i.body:JSON.stringify(i.body),R=new hb.DOMParser().parseFromString(A,"text/xml"),V=ab.select(a,R);let H;Array.isArray(V)?V.length===0?H=null:V.length===1?H=W_(V[0]):H=V.map(W_):H=V,g.variables.set(v,H);const re=JSON.stringify(H);return g.logger.info(`Extracted (XPath) ${a} → ${v} = ${re}`),{_summary:`${v} = ${re.substring(0,50)}${re.length>50?"...":""}`,variable:v,xpath:a,value:H}}catch(A){throw new Error(`XPath extraction failed: ${a}. Error: ${A.message}`)}}},{type:"api_extract",category:"API",color:"#2196F3",tooltip:"Extract a value from response using dot notation (e.g., data.user.name)",inputs:[{name:"PATH",type:"field",fieldType:"text",required:!0},{name:"VARIABLE",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.variables.get("__lastResponse");if(!i)throw new Error("No response available. Make sure to call an API request first.");const a=f.PATH,v=f.VARIABLE,A=j_(i.body,a);g.variables.set(v,A);const R=JSON.stringify(A);return g.logger.info(`Extracted ${a} → ${v} = ${R}`),{_summary:`${v} = ${R.substring(0,50)}${R.length>50?"...":""}`,variable:v,path:a,value:A}}},{type:"api_headers",category:"API",color:"#9C27B0",tooltip:"Create a headers object",inputs:[{name:"AUTH_TYPE",type:"field",fieldType:"dropdown",options:[["None","none"],["Bearer Token","bearer"],["Basic Auth","basic"],["API Key","apikey"]]},{name:"AUTH_VALUE",type:"field",fieldType:"text"},{name:"CUSTOM",type:"value",check:"Object"}],output:{type:"Object"},execute:async(f,g)=>{const i=f.AUTH_TYPE,a=Qn(f.AUTH_VALUE||"",g),A={...f.CUSTOM||{}};switch(i){case"bearer":A.Authorization=`Bearer ${a}`;break;case"basic":A.Authorization=`Basic ${Buffer.from(a).toString("base64")}`;break;case"apikey":A["X-API-Key"]=a;break}return A}},{type:"api_json_body",category:"API",color:"#9C27B0",tooltip:"Create a JSON body from key-value pairs or raw JSON",inputs:[{name:"JSON",type:"field",fieldType:"text",default:"{}"}],output:{type:"Object"},execute:async(f,g)=>{const i=Qn(f.JSON,g);return JSON.parse(i)}}];function Qn(f,g){return f.replace(/\$\{([\w.]+)\}/g,(i,a)=>{const v=a.split("."),A=v[0];let R=g.variables.get(A);if(v.length>1&&R!==void 0&&R!==null)for(let V=1;V<v.length&&R!=null;V++)R=R[v[V]];return R==null?i:typeof R=="object"?JSON.stringify(R):String(R)})}function np(f,g){if(!f||!f.trim())return{};const i=Qn(f,g);try{const A=JSON.parse(i);if(typeof A=="object"&&A!==null)return A}catch{}const a={},v=i.split(/[;\n]/).map(A=>A.trim()).filter(A=>A);for(const A of v){const R=A.indexOf(":");if(R>0){const V=A.slice(0,R).trim(),H=A.slice(R+1).trim();a[V]=H}}return a}async function sp(f){const g={};f.headers.forEach((v,A)=>{g[A]=v});let i;return(f.headers.get("content-type")||"").includes("application/json")?i=await f.json():i=await f.text(),{status:f.status,headers:g,body:i}}function j_(f,g){if(!g)return f;const i=g.split(".");let a=f;for(const v of i){if(a==null)return;const A=v.match(/^(\w+)\[(\d+)\]$/);if(A){const[,R,V]=A;a=a[R],Array.isArray(a)&&(a=a[parseInt(V,10)])}else a=a[v]}return a}function W_(f){if(!f)return null;const g=f;return g.nodeValue!==void 0?g.nodeValue:g.textContent!==void 0?g.textContent:g.toString?g.toString():null}let Zg=null;async function ri(){if(!Zg){const f="@playwright/test",{expect:g}=await import(f);Zg=g}return Zg}async function ni(f,g,i,a){try{await g()}catch(v){if(f.softAssertions){const A={message:v.message||i,stepType:a==null?void 0:a.stepType,expected:a==null?void 0:a.expected,actual:a==null?void 0:a.actual,timestamp:new Date().toISOString()};f.softAssertionErrors||(f.softAssertionErrors=[]),f.softAssertionErrors.push(A),f.logger.warn(`Soft assertion failed: ${A.message}`)}else throw v}}function js(f,g){return f.replace(/\$\{([\w.]+)\}/g,(i,a)=>{const v=a.split("."),A=v[0];let R=g.variables.get(A);if(v.length>1&&R!==void 0&&R!==null)for(let V=1;V<v.length&&R!=null;V++)R=R[v[V]];return R==null?i:typeof R=="object"?JSON.stringify(R):String(R)})}function Kr(f,g){const i=js(f.SELECTOR,g);if(i.startsWith("testid:")){const a=i.substring(7);return`[${g.testIdAttribute||"data-testid"}="${a}"]`}return i}function Dl(f,g){const i=f.SELECTOR;if(i.startsWith("testid:")){const a=i.substring(7);return`[${g.testIdAttribute||"data-testid"}="${a}"]`}return i}const $b=[{type:"web_navigate",category:"Web",color:"#E91E63",tooltip:"Navigate to a URL",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"WAIT_UNTIL",type:"field",fieldType:"dropdown",options:[["Load","load"],["DOM Content Loaded","domcontentloaded"],["Network Idle","networkidle"]],default:"load"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=js(f.URL,g),v=f.WAIT_UNTIL;return g.logger.info(`Navigating to ${a}`),await i.goto(a,{waitUntil:v}),{_summary:a,url:a,waitUntil:v}}},{type:"web_wait_for_element",category:"Web",color:"#9C27B0",tooltip:"Wait for an element to appear/disappear",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"STATE",type:"field",fieldType:"dropdown",options:[["Visible","visible"],["Hidden","hidden"],["Attached","attached"],["Detached","detached"]]},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.STATE,A=f.TIMEOUT;return g.logger.info(`Waiting for ${a} to be ${v}`),await i.waitForSelector(a,{state:v,timeout:A}),{_summary:`${f.SELECTOR} is ${v}`,selector:a,state:v}}},{type:"web_wait_for_url",category:"Web",color:"#9C27B0",tooltip:"Wait for URL to match",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=js(f.URL,g),v=f.TIMEOUT;return g.logger.info(`Waiting for URL to match: ${a}`),await i.waitForURL(a,{timeout:v}),{_summary:a,url:a}}},{type:"web_wait",category:"Web",color:"#9C27B0",tooltip:"Wait for a specified time",inputs:[{name:"MILLISECONDS",type:"field",fieldType:"number",default:1e3}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=f.MILLISECONDS;return g.logger.info(`Waiting ${a}ms`),await i.waitForTimeout(a),{_summary:`${a}ms`,milliseconds:a}}},{type:"web_screenshot",category:"Web",color:"#607D8B",tooltip:"Take a screenshot",inputs:[{name:"NAME",type:"field",fieldType:"text",default:"screenshot"},{name:"FULL_PAGE",type:"field",fieldType:"checkbox",default:!1}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=f.NAME,v=f.FULL_PAGE;g.logger.info(`Taking screenshot: ${a}`);const A=await i.screenshot({fullPage:v});return{_summary:`${a}${v?" (full page)":""}`,name:a,fullPage:v,buffer:A.toString("base64")}}}],gb=[{type:"web_click",category:"Web",color:"#E91E63",tooltip:"Click on an element (auto-waits for element)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.TIMEOUT;return g.logger.info(`Clicking: ${a}`),await i.locator(a).click({timeout:v}),{_summary:f.SELECTOR,selector:a}}},{type:"web_fill",category:"Web",color:"#E91E63",tooltip:"Fill an input field (clears existing value, auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"VALUE",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.VALUE,A=js(v,g),R=f.TIMEOUT;g.logger.info(`Filling ${a} with "${A}"`),await i.locator(a).fill(A,{timeout:R});const H=A.length>30?A.substring(0,30)+"...":A;return{_summary:`${f.SELECTOR} = "${H}"`,selector:a,value:A}}},{type:"web_type",category:"Web",color:"#E91E63",tooltip:"Type text character by character (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TEXT",type:"field",fieldType:"text",required:!0},{name:"DELAY",type:"field",fieldType:"number",default:50},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=js(f.TEXT,g),A=f.DELAY,R=f.TIMEOUT;g.logger.info(`Typing "${v}" into ${a}`),await i.locator(a).pressSequentially(v,{delay:A,timeout:R});const H=v.length>30?v.substring(0,30)+"...":v;return{_summary:`${f.SELECTOR} = "${H}"`,selector:a,text:v,delay:A}}},{type:"web_press_key",category:"Web",color:"#E91E63",tooltip:"Press a keyboard key (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"KEY",type:"field",fieldType:"dropdown",options:[["Enter","Enter"],["Tab","Tab"],["Escape","Escape"],["Backspace","Backspace"],["ArrowUp","ArrowUp"],["ArrowDown","ArrowDown"],["ArrowLeft","ArrowLeft"],["ArrowRight","ArrowRight"]]},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.KEY,A=f.TIMEOUT;return g.logger.info(`Pressing ${v} on ${a}`),await i.locator(a).press(v,{timeout:A}),{_summary:`${v} on ${f.SELECTOR}`,selector:a,key:v}}},{type:"web_select",category:"Web",color:"#E91E63",tooltip:"Select an option from a dropdown (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"VALUE",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=js(f.VALUE,g),A=f.TIMEOUT;return g.logger.info(`Selecting "${v}" in ${a}`),await i.locator(a).selectOption(v,{timeout:A}),{_summary:`${f.SELECTOR} = "${v}"`,selector:a,value:v}}},{type:"web_checkbox",category:"Web",color:"#E91E63",tooltip:"Check or uncheck a checkbox (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"ACTION",type:"field",fieldType:"dropdown",options:[["Check","check"],["Uncheck","uncheck"]]},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.ACTION,A=f.TIMEOUT;g.logger.info(`${v==="check"?"Checking":"Unchecking"} ${a}`);const R=i.locator(a);return v==="check"?await R.check({timeout:A}):await R.uncheck({timeout:A}),{_summary:`${v} ${f.SELECTOR}`,selector:a,action:v}}},{type:"web_hover",category:"Web",color:"#E91E63",tooltip:"Hover over an element (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.TIMEOUT;return g.logger.info(`Hovering over ${a}`),await i.locator(a).hover({timeout:v}),{_summary:f.SELECTOR,selector:a}}}],fb=[{type:"web_get_text",category:"Web",color:"#2196F3",tooltip:"Get text content of an element (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],output:{type:"String"},execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.TIMEOUT,A=i.locator(a);await A.waitFor({state:"visible",timeout:v});const R=await A.textContent({timeout:v});return g.logger.debug(`Text content of ${a}: "${R}"`),{_summary:`"${R&&R.length>40?R.substring(0,40)+"...":R}"`,_value:R,selector:a,text:R}}},{type:"web_get_attribute",category:"Web",color:"#2196F3",tooltip:"Get attribute value of an element (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"ATTRIBUTE",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],output:{type:"String"},execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.ATTRIBUTE,A=f.TIMEOUT,R=i.locator(a);await R.waitFor({state:"attached",timeout:A});const V=await R.getAttribute(v,{timeout:A});return g.logger.debug(`Attribute ${v} of ${a}: "${V}"`),{_summary:`${v} = "${V}"`,_value:V,selector:a,attribute:v,value:V}}},{type:"web_get_input_value",category:"Web",color:"#2196F3",tooltip:"Get current value of an input field (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],output:{type:"String"},execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.TIMEOUT,A=i.locator(a);await A.waitFor({state:"visible",timeout:v});const R=await A.inputValue({timeout:v});return g.logger.debug(`Input value of ${a}: "${R}"`),{_summary:`"${R.length>40?R.substring(0,40)+"...":R}"`,_value:R,selector:a,value:R}}},{type:"web_get_title",category:"Web",color:"#2196F3",tooltip:"Get the page title",inputs:[],output:{type:"String"},execute:async(f,g)=>{const a=await g.page.title();return g.logger.debug(`Page title: "${a}"`),{_summary:`"${a}"`,_value:a,title:a}}},{type:"web_get_url",category:"Web",color:"#2196F3",tooltip:"Get the current URL",inputs:[],output:{type:"String"},execute:async(f,g)=>{const a=g.page.url();return g.logger.debug(`Current URL: "${a}"`),{_summary:a,_value:a,url:a}}},{type:"web_count_elements",category:"Web",color:"#2196F3",tooltip:"Count the number of elements matching a selector",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0}],output:{type:"Number"},execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=await i.locator(a).count();return g.logger.debug(`Found ${v} elements matching ${a}`),{_summary:`${v} elements`,_value:v,selector:a,count:v}}}],mb=[{type:"web_assert_visible",category:"Web",color:"#FF9800",tooltip:"Assert that an element is visible (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=f.TIMEOUT,R=await ri(),V=i.locator(a);return g.logger.info(`Asserting ${v} is visible`),await ni(g,async()=>{await R(V).toBeVisible({timeout:A})},`Expected element ${v} to be visible`,{stepType:"web_assert_visible",expected:"visible",actual:"not visible"}),g.logger.info(`✓ Element ${v} is visible`),{_summary:`${v} is visible`,selector:a,isVisible:!0}}},{type:"web_assert_not_visible",category:"Web",color:"#FF9800",tooltip:"Assert that an element is not visible (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=f.TIMEOUT,R=await ri(),V=i.locator(a);return g.logger.info(`Asserting ${v} is not visible`),await ni(g,async()=>{await R(V).toBeHidden({timeout:A})},`Expected element ${v} to be hidden`,{stepType:"web_assert_not_visible",expected:"hidden",actual:"visible"}),g.logger.info(`✓ Element ${v} is not visible`),{_summary:`${v} is not visible`,selector:a,isVisible:!1}}},{type:"web_assert_text_contains",category:"Web",color:"#FF9800",tooltip:"Assert that element text contains expected value (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TEXT",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=js(f.TEXT,g),R=f.TIMEOUT,V=await ri(),H=i.locator(a);return g.logger.info(`Asserting ${v} contains "${A}"`),await ni(g,async()=>{await V(H).toContainText(A,{timeout:R})},`Expected element ${v} to contain text "${A}"`,{stepType:"web_assert_text_contains",expected:A}),g.logger.info(`✓ Element ${v} contains text "${A}"`),{_summary:`"${A}" found`,selector:a,expectedText:A}}},{type:"web_assert_text_equals",category:"Web",color:"#FF9800",tooltip:"Assert that element text equals expected value (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TEXT",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=js(f.TEXT,g),R=f.TIMEOUT,V=await ri(),H=i.locator(a);return g.logger.info(`Asserting ${v} text equals "${A}"`),await ni(g,async()=>{await V(H).toHaveText(A,{timeout:R})},`Expected element ${v} text to equal "${A}"`,{stepType:"web_assert_text_equals",expected:A}),g.logger.info(`✓ Element ${v} text equals "${A}"`),{_summary:`"${A}" matches`,selector:a,expectedText:A}}},{type:"web_assert_url_contains",category:"Web",color:"#FF9800",tooltip:"Assert that current URL contains expected value (auto-waits)",inputs:[{name:"TEXT",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=js(f.TEXT,g),v=f.TIMEOUT,A=await ri(),R=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),V=new RegExp(R);return g.logger.info(`Asserting URL contains "${a}"`),await ni(g,async()=>{await A(i).toHaveURL(V,{timeout:v})},`Expected URL to contain "${a}"`,{stepType:"web_assert_url_contains",expected:a,actual:i.url()}),g.logger.info(`✓ URL contains "${a}"`),{_summary:`"${a}" in URL`,expectedText:a,actualUrl:i.url()}}},{type:"web_assert_title_contains",category:"Web",color:"#FF9800",tooltip:"Assert that page title contains expected value (auto-waits)",inputs:[{name:"TEXT",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=js(f.TEXT,g),v=f.TIMEOUT,A=await ri(),R=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),V=new RegExp(R);return g.logger.info(`Asserting title contains "${a}"`),await ni(g,async()=>{await A(i).toHaveTitle(V,{timeout:v})},`Expected title to contain "${a}"`,{stepType:"web_assert_title_contains",expected:a}),g.logger.info(`✓ Title contains "${a}"`),{_summary:`"${a}" in title`,expectedText:a}}},{type:"web_assert_enabled",category:"Web",color:"#FF9800",tooltip:"Assert that an element is enabled (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=f.TIMEOUT,R=await ri(),V=i.locator(a);return g.logger.info(`Asserting ${v} is enabled`),await ni(g,async()=>{await R(V).toBeEnabled({timeout:A})},`Expected element ${v} to be enabled`,{stepType:"web_assert_enabled",expected:"enabled",actual:"disabled"}),g.logger.info(`✓ Element ${v} is enabled`),{_summary:`${v} is enabled`,selector:a,isEnabled:!0}}},{type:"web_assert_checked",category:"Web",color:"#FF9800",tooltip:"Assert that a checkbox is checked (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"EXPECTED",type:"field",fieldType:"checkbox",default:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=f.EXPECTED,R=f.TIMEOUT,V=await ri(),H=i.locator(a);return g.logger.info(`Asserting ${v} is ${A?"checked":"unchecked"}`),await ni(g,async()=>{A?await V(H).toBeChecked({timeout:R}):await V(H).not.toBeChecked({timeout:R})},`Expected checkbox ${v} to be ${A?"checked":"unchecked"}`,{stepType:"web_assert_checked",expected:A?"checked":"unchecked"}),g.logger.info(`✓ Checkbox ${v} is ${A?"checked":"unchecked"}`),{_summary:`${v} is ${A?"checked":"unchecked"}`,selector:a,expected:A}}},{type:"web_assert_value",category:"Web",color:"#FF9800",tooltip:"Assert that an input field has a specific value (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"VALUE",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=js(f.VALUE,g),R=f.TIMEOUT,V=await ri(),H=i.locator(a);return g.logger.info(`Asserting ${v} has value "${A}"`),await ni(g,async()=>{await V(H).toHaveValue(A,{timeout:R})},`Expected input ${v} to have value "${A}"`,{stepType:"web_assert_value",expected:A}),g.logger.info(`✓ Input ${v} has value "${A}"`),{_summary:`${v} = "${A}"`,selector:a,expected:A}}},{type:"web_assert_value_contains",category:"Web",color:"#FF9800",tooltip:"Assert that an input field value contains specific text (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"VALUE",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=js(f.VALUE,g),R=f.TIMEOUT,V=await ri(),H=i.locator(a);return g.logger.info(`Asserting ${v} value contains "${A}"`),await ni(g,async()=>{await V(H).toHaveValue(new RegExp(A),{timeout:R})},`Expected input ${v} value to contain "${A}"`,{stepType:"web_assert_value_contains",expected:A}),g.logger.info(`✓ Input ${v} value contains "${A}"`),{_summary:`${v} contains "${A}"`,selector:a,expected:A}}}],_b=[...$b,...gb,...fb,...mb],Eb=[{type:"logic_set_variable",category:"Logic",color:"#795548",tooltip:"Set a variable value",inputs:[{name:"NAME",type:"field",fieldType:"text",required:!0},{name:"VALUE",type:"value",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.NAME;let a=f.VALUE;a&&typeof a=="object"&&"_value"in a&&(a=a._value),g.variables.set(i,a),g.logger.debug(`Set variable ${i} = ${JSON.stringify(a)}`)}},{type:"logic_get_variable",category:"Logic",color:"#795548",tooltip:"Get a variable value",inputs:[{name:"NAME",type:"field",fieldType:"text",required:!0}],output:{type:["String","Number","Boolean","Object","Array"]},execute:async(f,g)=>{const i=f.NAME;return g.variables.get(i)}},{type:"logic_if",category:"Logic",color:"#5C6BC0",tooltip:"Execute blocks if condition is true",inputs:[{name:"CONDITION",type:"value",check:"Boolean",required:!0},{name:"DO",type:"statement"},{name:"ELSE",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.CONDITION;if(i&&f.DO)return{branch:"DO"};if(!i&&f.ELSE)return{branch:"ELSE"}}},{type:"logic_compare",category:"Logic",color:"#5C6BC0",tooltip:"Compare two values",inputs:[{name:"A",type:"value",required:!0},{name:"OP",type:"field",fieldType:"dropdown",options:[["=","eq"],["≠","neq"],["<","lt"],["≤","lte"],[">","gt"],["≥","gte"],["contains","contains"]]},{name:"B",type:"value",required:!0}],output:{type:"Boolean"},execute:async(f,g)=>{const i=f.A,a=f.B;switch(f.OP){case"eq":return JSON.stringify(i)===JSON.stringify(a);case"neq":return JSON.stringify(i)!==JSON.stringify(a);case"lt":return i<a;case"lte":return i<=a;case"gt":return i>a;case"gte":return i>=a;case"contains":return typeof i=="string"||Array.isArray(i)?i.includes(a):!1;default:return!1}}},{type:"logic_boolean_op",category:"Logic",color:"#5C6BC0",tooltip:"Combine boolean values",inputs:[{name:"A",type:"value",check:"Boolean",required:!0},{name:"OP",type:"field",fieldType:"dropdown",options:[["and","and"],["or","or"]]},{name:"B",type:"value",check:"Boolean",required:!0}],output:{type:"Boolean"},execute:async f=>{const g=f.A,i=f.B;return f.OP==="and"?g&&i:g||i}},{type:"logic_not",category:"Logic",color:"#5C6BC0",tooltip:"Negate a boolean value",inputs:[{name:"VALUE",type:"value",check:"Boolean",required:!0}],output:{type:"Boolean"},execute:async f=>!f.VALUE},{type:"logic_repeat",category:"Logic",color:"#5C6BC0",tooltip:"Repeat blocks a specified number of times",inputs:[{name:"TIMES",type:"field",fieldType:"number",default:10,required:!0},{name:"DO",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>({loop:!0,times:f.TIMES,statement:"DO"})},{type:"logic_foreach",category:"Logic",color:"#5C6BC0",tooltip:"Iterate over an array",inputs:[{name:"ARRAY",type:"value",check:"Array",required:!0},{name:"VAR",type:"field",fieldType:"text",default:"item",required:!0},{name:"DO",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.ARRAY,a=f.VAR;return{loop:!0,array:i,varName:a,statement:"DO"}}},{type:"logic_try_catch",category:"Logic",color:"#5C6BC0",tooltip:"Handle errors gracefully",inputs:[{name:"TRY",type:"statement"},{name:"CATCH",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>({tryCatch:!0})},{type:"logic_log",category:"Logic",color:"#607D8B",tooltip:"Log a message",inputs:[{name:"LEVEL",type:"field",fieldType:"dropdown",options:[["Info","info"],["Warning","warn"],["Error","error"],["Debug","debug"]]},{name:"MESSAGE",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.LEVEL||"info",a=id(f.MESSAGE,g);return g.logger[i](a),{_message:a,_summary:a}}},{type:"logic_comment",category:"Logic",color:"#9E9E9E",tooltip:"Add a comment (does nothing)",inputs:[{name:"TEXT",type:"field",fieldType:"text",default:"Comment"}],previousStatement:!0,nextStatement:!0,execute:async()=>{}},{type:"logic_text",category:"Logic",color:"#795548",tooltip:"A text value",inputs:[{name:"TEXT",type:"field",fieldType:"text",default:""}],output:{type:"String"},execute:async(f,g)=>id(f.TEXT,g)},{type:"logic_number",category:"Logic",color:"#795548",tooltip:"A number value",inputs:[{name:"NUM",type:"field",fieldType:"number",default:0}],output:{type:"Number"},execute:async f=>f.NUM},{type:"logic_boolean",category:"Logic",color:"#795548",tooltip:"A boolean value",inputs:[{name:"BOOL",type:"field",fieldType:"dropdown",options:[["true","true"],["false","false"]]}],output:{type:"Boolean"},execute:async f=>f.BOOL==="true"},{type:"logic_object",category:"Logic",color:"#795548",tooltip:"Create a JSON object",inputs:[{name:"JSON",type:"field",fieldType:"text",default:"{}"}],output:{type:"Object"},execute:async(f,g)=>{const i=id(f.JSON,g);return JSON.parse(i)}},{type:"logic_array",category:"Logic",color:"#795548",tooltip:"Create an array",inputs:[{name:"JSON",type:"field",fieldType:"text",default:"[]"}],output:{type:"Array"},execute:async(f,g)=>{const i=id(f.JSON,g);return JSON.parse(i)}},{type:"logic_fail",category:"Logic",color:"#f44336",tooltip:"Fail the test with a message",inputs:[{name:"MESSAGE",type:"field",fieldType:"text",default:"Test failed"}],previousStatement:!0,execute:async(f,g)=>{const i=id(f.MESSAGE,g);throw new Error(i)}},{type:"logic_assert",category:"Logic",color:"#FF9800",tooltip:"Assert a condition is true",inputs:[{name:"CONDITION",type:"value",check:"Boolean",required:!0},{name:"MESSAGE",type:"field",fieldType:"text",default:"Assertion failed"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.CONDITION,a=id(f.MESSAGE,g);sf(g,i,a,{stepType:"logic_assert",expected:!0,actual:i}),g.logger.info("✓ Assertion passed")}}];function id(f,g){return f.replace(/\$\{([\w.]+)\}/g,(i,a)=>{const v=a.split("."),A=v[0];let R=g.variables.get(A);if(v.length>1&&R!==void 0&&R!==null)for(let V=1;V<v.length&&R!=null;V++)R=R[v[V]];return R==null?i:typeof R=="object"?JSON.stringify(R):String(R)})}const Tb=[{type:"test_case",category:"Tests",color:"#1E88E5",tooltip:"A test case containing steps to execute",inputs:[{name:"NAME",type:"field",fieldType:"multiline",default:"Test Case"},{name:"SOFT_ASSERTIONS",type:"field",fieldType:"checkbox",default:!1},{name:"STEPS",type:"statement"}],execute:async(f,g)=>({testCase:!0,name:f.NAME,softAssertions:f.SOFT_ASSERTIONS,statement:"STEPS"})},{type:"test_case_data_driven",category:"Tests",color:"#1565C0",tooltip:"A data-driven test case that runs for each row of data (CSV format: header row, then data rows)",inputs:[{name:"NAME",type:"field",fieldType:"text",default:"Data-Driven Test"},{name:"SOFT_ASSERTIONS",type:"field",fieldType:"checkbox",default:!1},{name:"DATA",type:"field",fieldType:"multiline",default:`username,password,expected
836
+ @`+(W.systemId||"")+"#[line:"+W.lineNumber+",col:"+W.columnNumber+"]"}function A(W,X,te){return typeof W=="string"?W.substr(X,te):W.length>=X+te||X?new java.lang.String(W,X,te)+"":W}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(W){i.prototype[W]=function(){return null}});function R(W,X){W.currentElement?W.currentElement.appendChild(X):W.doc.appendChild(X)}var V=ub(),H=cb(),re=H.XMLReader,pe=H.ParseError,Z=sd.DOMImplementation=H_().DOMImplementation;return sd.XMLSerializer=H_().XMLSerializer,sd.DOMParser=f,sd.__DOMHandler=i,sd}var hb=db();function sf(f,g,i,a){if(!g)if(f.softAssertions){const v={message:i,stepId:a==null?void 0:a.stepId,stepType:a==null?void 0:a.stepType,expected:a==null?void 0:a.expected,actual:a==null?void 0:a.actual,timestamp:new Date().toISOString()};f.softAssertionErrors||(f.softAssertionErrors=[]),f.softAssertionErrors.push(v),f.logger.warn(`Soft assertion failed: ${i}`)}else throw new Error(i)}const pb=[{type:"api_set_header",category:"API",color:"#7B1FA2",tooltip:"Set a request header (applies to subsequent requests)",inputs:[{name:"NAME",type:"field",fieldType:"text",required:!0,default:"Authorization"},{name:"VALUE",type:"field",fieldType:"text",required:!0,default:"Bearer token"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.NAME,a=Qn(f.VALUE,g);let v=g.variables.get("__requestHeaders");return v||(v={}),v[i]=a,g.variables.set("__requestHeaders",v),g.logger.info(`Set header: ${i}: ${a.substring(0,30)}${a.length>30?"...":""}`),{_summary:`${i}: ${a.substring(0,30)}${a.length>30?"...":""}`,name:i,value:a}}},{type:"api_set_headers",category:"API",color:"#7B1FA2",tooltip:"Set multiple request headers from JSON object",inputs:[{name:"HEADERS",type:"field",fieldType:"text",required:!0,default:'{"Content-Type": "application/json"}'}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=Qn(f.HEADERS,g);try{const a=JSON.parse(i);let v=g.variables.get("__requestHeaders");v||(v={}),Object.assign(v,a),g.variables.set("__requestHeaders",v);const A=Object.keys(a).join(", ");return g.logger.info(`Set headers: ${A}`),{_summary:`Set ${Object.keys(a).length} headers`,headers:a}}catch{throw new Error(`Invalid JSON for headers: ${i}`)}}},{type:"api_clear_headers",category:"API",color:"#7B1FA2",tooltip:"Clear all request headers",inputs:[],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>(g.variables.delete("__requestHeaders"),g.logger.info("Cleared all request headers"),{_summary:"Headers cleared"})},{type:"api_get",category:"API",color:"#4CAF50",tooltip:"Perform HTTP GET request and store response",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"HEADERS",type:"field",fieldType:"text",default:""}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=Qn(f.URL,g),a=g.variables.get("__requestHeaders")||{},v=np(f.HEADERS,g),A={...a,...v};g.logger.info(`GET ${i}`);const R=await fetch(i,{headers:A,signal:g.abortSignal}),V=await sp(R);return g.variables.set("__lastResponse",V),V}},{type:"api_post",category:"API",color:"#4CAF50",tooltip:"Perform HTTP POST request and store response",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"BODY",type:"field",fieldType:"text",default:"{}"},{name:"HEADERS",type:"field",fieldType:"text",default:""}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=Qn(f.URL,g),a=Qn(f.BODY||"{}",g),v=g.variables.get("__requestHeaders")||{},A=np(f.HEADERS,g);let R;try{R=JSON.parse(a)}catch{R=a}g.logger.info(`POST ${i}`);const V=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json",...v,...A},body:typeof R=="string"?R:JSON.stringify(R),signal:g.abortSignal}),H=await sp(V);return g.variables.set("__lastResponse",H),H}},{type:"api_put",category:"API",color:"#4CAF50",tooltip:"Perform HTTP PUT request and store response",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"BODY",type:"field",fieldType:"text",default:"{}"},{name:"HEADERS",type:"field",fieldType:"text",default:""}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=Qn(f.URL,g),a=Qn(f.BODY||"{}",g),v=g.variables.get("__requestHeaders")||{},A=np(f.HEADERS,g);let R;try{R=JSON.parse(a)}catch{R=a}g.logger.info(`PUT ${i}`);const V=await fetch(i,{method:"PUT",headers:{"Content-Type":"application/json",...v,...A},body:typeof R=="string"?R:JSON.stringify(R),signal:g.abortSignal}),H=await sp(V);return g.variables.set("__lastResponse",H),H}},{type:"api_patch",category:"API",color:"#4CAF50",tooltip:"Perform HTTP PATCH request and store response",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"BODY",type:"field",fieldType:"text",default:"{}"},{name:"HEADERS",type:"field",fieldType:"text",default:""}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=Qn(f.URL,g),a=Qn(f.BODY||"{}",g),v=g.variables.get("__requestHeaders")||{},A=np(f.HEADERS,g);let R;try{R=JSON.parse(a)}catch{R=a}g.logger.info(`PATCH ${i}`);const V=await fetch(i,{method:"PATCH",headers:{"Content-Type":"application/json",...v,...A},body:typeof R=="string"?R:JSON.stringify(R),signal:g.abortSignal}),H=await sp(V);return g.variables.set("__lastResponse",H),H}},{type:"api_delete",category:"API",color:"#4CAF50",tooltip:"Perform HTTP DELETE request and store response",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"HEADERS",type:"field",fieldType:"text",default:""}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=Qn(f.URL,g),a=g.variables.get("__requestHeaders")||{},v=np(f.HEADERS,g),A={...a,...v};g.logger.info(`DELETE ${i}`);const R=await fetch(i,{method:"DELETE",headers:A,signal:g.abortSignal}),V=await sp(R);return g.variables.set("__lastResponse",V),V}},{type:"api_assert_status",category:"API",color:"#FF9800",tooltip:"Assert that response has expected status code",inputs:[{name:"STATUS",type:"field",fieldType:"number",default:200,required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.variables.get("__lastResponse");if(!i)throw new Error("No response available. Make sure to call an API request first.");const a=f.STATUS;return sf(g,i.status===a,`Expected status ${a} but got ${i.status}`,{stepType:"api_assert_status",expected:a,actual:i.status}),g.logger.info(`✓ Status is ${a}`),{_summary:`✓ Status ${i.status} === ${a}`,expected:a,actual:i.status}}},{type:"api_assert_body_contains",category:"API",color:"#FF9800",tooltip:"Assert that response body contains expected value",inputs:[{name:"PATH",type:"field",fieldType:"text",default:""},{name:"VALUE",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.variables.get("__lastResponse");if(!i)throw new Error("No response available. Make sure to call an API request first.");const a=f.PATH,v=Qn(f.VALUE,g),A=a?j_(i.body,a):i.body,R=typeof A=="string"?A:JSON.stringify(A);return sf(g,R.includes(v),`Expected ${a||"body"} to contain "${v}" but got "${R}"`,{stepType:"api_assert_body_contains",expected:v,actual:R}),g.logger.info(`✓ ${a||"body"} contains "${v}"`),{_summary:`✓ ${a||"body"} contains "${v}"`,path:a||"body",expected:v,actual:R.substring(0,100)+(R.length>100?"...":"")}}},{type:"api_extract_jsonpath",category:"API",color:"#2196F3",tooltip:"Extract a value from JSON response using JSONPath expression",inputs:[{name:"JSONPATH",type:"field",fieldType:"text",required:!0,default:"$.data.id"},{name:"VARIABLE",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.variables.get("__lastResponse");if(!i)throw new Error("No response available. Make sure to call an API request first.");const a=f.JSONPATH,v=f.VARIABLE;try{const A=Jt({path:a,json:i.body}),R=A.length===1?A[0]:A;g.variables.set(v,R);const V=JSON.stringify(R);return g.logger.info(`Extracted (JSONPath) ${a} → ${v} = ${V}`),{_summary:`${v} = ${V.substring(0,50)}${V.length>50?"...":""}`,variable:v,jsonPath:a,value:R}}catch(A){throw new Error(`Invalid JSONPath expression: ${a}. Error: ${A.message}`)}}},{type:"api_extract_xpath",category:"API",color:"#2196F3",tooltip:"Extract a value from XML/HTML response using XPath expression",inputs:[{name:"XPATH",type:"field",fieldType:"text",required:!0,default:"//title/text()"},{name:"VARIABLE",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.variables.get("__lastResponse");if(!i)throw new Error("No response available. Make sure to call an API request first.");const a=f.XPATH,v=f.VARIABLE;try{const A=typeof i.body=="string"?i.body:JSON.stringify(i.body),R=new hb.DOMParser().parseFromString(A,"text/xml"),V=ab.select(a,R);let H;Array.isArray(V)?V.length===0?H=null:V.length===1?H=W_(V[0]):H=V.map(W_):H=V,g.variables.set(v,H);const re=JSON.stringify(H);return g.logger.info(`Extracted (XPath) ${a} → ${v} = ${re}`),{_summary:`${v} = ${re.substring(0,50)}${re.length>50?"...":""}`,variable:v,xpath:a,value:H}}catch(A){throw new Error(`XPath extraction failed: ${a}. Error: ${A.message}`)}}},{type:"api_extract",category:"API",color:"#2196F3",tooltip:"Extract a value from response using dot notation (e.g., data.user.name)",inputs:[{name:"PATH",type:"field",fieldType:"text",required:!0},{name:"VARIABLE",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.variables.get("__lastResponse");if(!i)throw new Error("No response available. Make sure to call an API request first.");const a=f.PATH,v=f.VARIABLE,A=j_(i.body,a);g.variables.set(v,A);const R=JSON.stringify(A);return g.logger.info(`Extracted ${a} → ${v} = ${R}`),{_summary:`${v} = ${R.substring(0,50)}${R.length>50?"...":""}`,variable:v,path:a,value:A}}},{type:"api_headers",category:"API",color:"#9C27B0",tooltip:"Create a headers object",inputs:[{name:"AUTH_TYPE",type:"field",fieldType:"dropdown",options:[["None","none"],["Bearer Token","bearer"],["Basic Auth","basic"],["API Key","apikey"]]},{name:"AUTH_VALUE",type:"field",fieldType:"text"},{name:"CUSTOM",type:"value",check:"Object"}],output:{type:"Object"},execute:async(f,g)=>{const i=f.AUTH_TYPE,a=Qn(f.AUTH_VALUE||"",g),A={...f.CUSTOM||{}};switch(i){case"bearer":A.Authorization=`Bearer ${a}`;break;case"basic":A.Authorization=`Basic ${Buffer.from(a).toString("base64")}`;break;case"apikey":A["X-API-Key"]=a;break}return A}},{type:"api_json_body",category:"API",color:"#9C27B0",tooltip:"Create a JSON body from key-value pairs or raw JSON",inputs:[{name:"JSON",type:"field",fieldType:"text",default:"{}"}],output:{type:"Object"},execute:async(f,g)=>{const i=Qn(f.JSON,g);return JSON.parse(i)}}];function Qn(f,g){return f.replace(/\$\{([\w.]+)\}/g,(i,a)=>{const v=a.split("."),A=v[0];let R=g.variables.get(A);if(v.length>1&&R!==void 0&&R!==null)for(let V=1;V<v.length&&R!=null;V++)R=R[v[V]];return R==null?i:typeof R=="object"?JSON.stringify(R):String(R)})}function np(f,g){if(!f||!f.trim())return{};const i=Qn(f,g);try{const A=JSON.parse(i);if(typeof A=="object"&&A!==null)return A}catch{}const a={},v=i.split(/[;\n]/).map(A=>A.trim()).filter(A=>A);for(const A of v){const R=A.indexOf(":");if(R>0){const V=A.slice(0,R).trim(),H=A.slice(R+1).trim();a[V]=H}}return a}async function sp(f){const g={};f.headers.forEach((v,A)=>{g[A]=v});let i;return(f.headers.get("content-type")||"").includes("application/json")?i=await f.json():i=await f.text(),{status:f.status,headers:g,body:i}}function j_(f,g){if(!g)return f;const i=g.split(".");let a=f;for(const v of i){if(a==null)return;const A=v.match(/^(\w+)\[(\d+)\]$/);if(A){const[,R,V]=A;a=a[R],Array.isArray(a)&&(a=a[parseInt(V,10)])}else a=a[v]}return a}function W_(f){if(!f)return null;const g=f;return g.nodeValue!==void 0?g.nodeValue:g.textContent!==void 0?g.textContent:g.toString?g.toString():null}let Zg=null;async function ri(){if(!Zg){const f="@playwright/test",{expect:g}=await import(f);Zg=g}return Zg}async function ni(f,g,i,a){try{await g()}catch(v){if(f.softAssertions){const A={message:v.message||i,stepType:a==null?void 0:a.stepType,expected:a==null?void 0:a.expected,actual:a==null?void 0:a.actual,timestamp:new Date().toISOString()};f.softAssertionErrors||(f.softAssertionErrors=[]),f.softAssertionErrors.push(A),f.logger.warn(`Soft assertion failed: ${A.message}`)}else throw v}}function js(f,g){return f.replace(/\$\{([\w.]+)\}/g,(i,a)=>{const v=a.split("."),A=v[0];let R=g.variables.get(A);if(v.length>1&&R!==void 0&&R!==null)for(let V=1;V<v.length&&R!=null;V++)R=R[v[V]];return R==null?i:typeof R=="object"?JSON.stringify(R):String(R)})}function Kr(f,g){const i=js(f.SELECTOR,g);if(i.startsWith("testid:")){const a=i.substring(7);return`[${g.testIdAttribute||"data-testid"}="${a}"]`}return i}function Dl(f,g){const i=f.SELECTOR;if(i.startsWith("testid:")){const a=i.substring(7);return`[${g.testIdAttribute||"data-testid"}="${a}"]`}return i}const $b=[{type:"web_navigate",category:"Web",color:"#E91E63",tooltip:"Navigate to a URL",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"WAIT_UNTIL",type:"field",fieldType:"dropdown",options:[["Load","load"],["DOM Content Loaded","domcontentloaded"],["Network Idle","networkidle"]],default:"load"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=js(f.URL,g),v=f.WAIT_UNTIL;return g.logger.info(`Navigating to ${a}`),await i.goto(a,{waitUntil:v}),{_summary:a,url:a,waitUntil:v}}},{type:"web_wait_for_element",category:"Web",color:"#9C27B0",tooltip:"Wait for an element to appear/disappear",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"STATE",type:"field",fieldType:"dropdown",options:[["Visible","visible"],["Hidden","hidden"],["Attached","attached"],["Detached","detached"]]},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.STATE,A=f.TIMEOUT;return g.logger.info(`Waiting for ${a} to be ${v}`),await i.waitForSelector(a,{state:v,timeout:A}),{_summary:`${f.SELECTOR} is ${v}`,selector:a,state:v}}},{type:"web_wait_for_url",category:"Web",color:"#9C27B0",tooltip:"Wait for URL to match",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=js(f.URL,g),v=f.TIMEOUT;return g.logger.info(`Waiting for URL to match: ${a}`),await i.waitForURL(a,{timeout:v}),{_summary:a,url:a}}},{type:"web_wait",category:"Web",color:"#9C27B0",tooltip:"Wait for a specified time",inputs:[{name:"MILLISECONDS",type:"field",fieldType:"number",default:1e3}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=f.MILLISECONDS;return g.logger.info(`Waiting ${a}ms`),await i.waitForTimeout(a),{_summary:`${a}ms`,milliseconds:a}}},{type:"web_screenshot",category:"Web",color:"#607D8B",tooltip:"Take a screenshot",inputs:[{name:"NAME",type:"field",fieldType:"text",default:"screenshot"},{name:"FULL_PAGE",type:"field",fieldType:"checkbox",default:!1}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=f.NAME,v=f.FULL_PAGE;g.logger.info(`Taking screenshot: ${a}`);const A=await i.screenshot({fullPage:v});return{_summary:`${a}${v?" (full page)":""}`,name:a,fullPage:v,buffer:A.toString("base64")}}}],gb=[{type:"web_click",category:"Web",color:"#E91E63",tooltip:"Click on an element (auto-waits for element to be visible and stable)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.TIMEOUT;g.logger.info(`Clicking: ${a}`);const A=i.locator(a);return await A.waitFor({state:"visible",timeout:v}),await A.scrollIntoViewIfNeeded({timeout:v}),await A.click({timeout:v}),{_summary:f.SELECTOR,selector:a}}},{type:"web_fill",category:"Web",color:"#E91E63",tooltip:"Fill an input field (clears existing value, auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"VALUE",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.VALUE,A=js(v,g),R=f.TIMEOUT;g.logger.info(`Filling ${a} with "${A}"`),await i.locator(a).fill(A,{timeout:R});const H=A.length>30?A.substring(0,30)+"...":A;return{_summary:`${f.SELECTOR} = "${H}"`,selector:a,value:A}}},{type:"web_type",category:"Web",color:"#E91E63",tooltip:"Type text character by character (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TEXT",type:"field",fieldType:"text",required:!0},{name:"DELAY",type:"field",fieldType:"number",default:50},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=js(f.TEXT,g),A=f.DELAY,R=f.TIMEOUT;g.logger.info(`Typing "${v}" into ${a}`),await i.locator(a).pressSequentially(v,{delay:A,timeout:R});const H=v.length>30?v.substring(0,30)+"...":v;return{_summary:`${f.SELECTOR} = "${H}"`,selector:a,text:v,delay:A}}},{type:"web_press_key",category:"Web",color:"#E91E63",tooltip:"Press a keyboard key (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"KEY",type:"field",fieldType:"dropdown",options:[["Enter","Enter"],["Tab","Tab"],["Escape","Escape"],["Backspace","Backspace"],["ArrowUp","ArrowUp"],["ArrowDown","ArrowDown"],["ArrowLeft","ArrowLeft"],["ArrowRight","ArrowRight"]]},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.KEY,A=f.TIMEOUT;return g.logger.info(`Pressing ${v} on ${a}`),await i.locator(a).press(v,{timeout:A}),{_summary:`${v} on ${f.SELECTOR}`,selector:a,key:v}}},{type:"web_select",category:"Web",color:"#E91E63",tooltip:"Select an option from a dropdown (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"VALUE",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=js(f.VALUE,g),A=f.TIMEOUT;return g.logger.info(`Selecting "${v}" in ${a}`),await i.locator(a).selectOption(v,{timeout:A}),{_summary:`${f.SELECTOR} = "${v}"`,selector:a,value:v}}},{type:"web_checkbox",category:"Web",color:"#E91E63",tooltip:"Check or uncheck a checkbox (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"ACTION",type:"field",fieldType:"dropdown",options:[["Check","check"],["Uncheck","uncheck"]]},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.ACTION,A=f.TIMEOUT;g.logger.info(`${v==="check"?"Checking":"Unchecking"} ${a}`);const R=i.locator(a);return v==="check"?await R.check({timeout:A}):await R.uncheck({timeout:A}),{_summary:`${v} ${f.SELECTOR}`,selector:a,action:v}}},{type:"web_hover",category:"Web",color:"#E91E63",tooltip:"Hover over an element (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.TIMEOUT;return g.logger.info(`Hovering over ${a}`),await i.locator(a).hover({timeout:v}),{_summary:f.SELECTOR,selector:a}}}],fb=[{type:"web_get_text",category:"Web",color:"#2196F3",tooltip:"Get text content of an element (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],output:{type:"String"},execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.TIMEOUT,A=i.locator(a);await A.waitFor({state:"visible",timeout:v});const R=await A.textContent({timeout:v});return g.logger.debug(`Text content of ${a}: "${R}"`),{_summary:`"${R&&R.length>40?R.substring(0,40)+"...":R}"`,_value:R,selector:a,text:R}}},{type:"web_get_attribute",category:"Web",color:"#2196F3",tooltip:"Get attribute value of an element (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"ATTRIBUTE",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],output:{type:"String"},execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.ATTRIBUTE,A=f.TIMEOUT,R=i.locator(a);await R.waitFor({state:"attached",timeout:A});const V=await R.getAttribute(v,{timeout:A});return g.logger.debug(`Attribute ${v} of ${a}: "${V}"`),{_summary:`${v} = "${V}"`,_value:V,selector:a,attribute:v,value:V}}},{type:"web_get_input_value",category:"Web",color:"#2196F3",tooltip:"Get current value of an input field (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],output:{type:"String"},execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.TIMEOUT,A=i.locator(a);await A.waitFor({state:"visible",timeout:v});const R=await A.inputValue({timeout:v});return g.logger.debug(`Input value of ${a}: "${R}"`),{_summary:`"${R.length>40?R.substring(0,40)+"...":R}"`,_value:R,selector:a,value:R}}},{type:"web_get_title",category:"Web",color:"#2196F3",tooltip:"Get the page title",inputs:[],output:{type:"String"},execute:async(f,g)=>{const a=await g.page.title();return g.logger.debug(`Page title: "${a}"`),{_summary:`"${a}"`,_value:a,title:a}}},{type:"web_get_url",category:"Web",color:"#2196F3",tooltip:"Get the current URL",inputs:[],output:{type:"String"},execute:async(f,g)=>{const a=g.page.url();return g.logger.debug(`Current URL: "${a}"`),{_summary:a,_value:a,url:a}}},{type:"web_count_elements",category:"Web",color:"#2196F3",tooltip:"Count the number of elements matching a selector",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0}],output:{type:"Number"},execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=await i.locator(a).count();return g.logger.debug(`Found ${v} elements matching ${a}`),{_summary:`${v} elements`,_value:v,selector:a,count:v}}}],mb=[{type:"web_assert_visible",category:"Web",color:"#FF9800",tooltip:"Assert that an element is visible (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=f.TIMEOUT,R=await ri(),V=i.locator(a);return g.logger.info(`Asserting ${v} is visible`),await ni(g,async()=>{await R(V).toBeVisible({timeout:A})},`Expected element ${v} to be visible`,{stepType:"web_assert_visible",expected:"visible",actual:"not visible"}),g.logger.info(`✓ Element ${v} is visible`),{_summary:`${v} is visible`,selector:a,isVisible:!0}}},{type:"web_assert_not_visible",category:"Web",color:"#FF9800",tooltip:"Assert that an element is not visible (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=f.TIMEOUT,R=await ri(),V=i.locator(a);return g.logger.info(`Asserting ${v} is not visible`),await ni(g,async()=>{await R(V).toBeHidden({timeout:A})},`Expected element ${v} to be hidden`,{stepType:"web_assert_not_visible",expected:"hidden",actual:"visible"}),g.logger.info(`✓ Element ${v} is not visible`),{_summary:`${v} is not visible`,selector:a,isVisible:!1}}},{type:"web_assert_text_contains",category:"Web",color:"#FF9800",tooltip:"Assert that element text contains expected value (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TEXT",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=js(f.TEXT,g),R=f.TIMEOUT,V=await ri(),H=i.locator(a);return g.logger.info(`Asserting ${v} contains "${A}"`),await ni(g,async()=>{await V(H).toContainText(A,{timeout:R})},`Expected element ${v} to contain text "${A}"`,{stepType:"web_assert_text_contains",expected:A}),g.logger.info(`✓ Element ${v} contains text "${A}"`),{_summary:`"${A}" found`,selector:a,expectedText:A}}},{type:"web_assert_text_equals",category:"Web",color:"#FF9800",tooltip:"Assert that element text equals expected value (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TEXT",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=js(f.TEXT,g),R=f.TIMEOUT,V=await ri(),H=i.locator(a);return g.logger.info(`Asserting ${v} text equals "${A}"`),await ni(g,async()=>{await V(H).toHaveText(A,{timeout:R})},`Expected element ${v} text to equal "${A}"`,{stepType:"web_assert_text_equals",expected:A}),g.logger.info(`✓ Element ${v} text equals "${A}"`),{_summary:`"${A}" matches`,selector:a,expectedText:A}}},{type:"web_assert_url_contains",category:"Web",color:"#FF9800",tooltip:"Assert that current URL contains expected value (auto-waits)",inputs:[{name:"TEXT",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=js(f.TEXT,g),v=f.TIMEOUT,A=await ri(),R=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),V=new RegExp(R);return g.logger.info(`Asserting URL contains "${a}"`),await ni(g,async()=>{await A(i).toHaveURL(V,{timeout:v})},`Expected URL to contain "${a}"`,{stepType:"web_assert_url_contains",expected:a,actual:i.url()}),g.logger.info(`✓ URL contains "${a}"`),{_summary:`"${a}" in URL`,expectedText:a,actualUrl:i.url()}}},{type:"web_assert_title_contains",category:"Web",color:"#FF9800",tooltip:"Assert that page title contains expected value (auto-waits)",inputs:[{name:"TEXT",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=js(f.TEXT,g),v=f.TIMEOUT,A=await ri(),R=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),V=new RegExp(R);return g.logger.info(`Asserting title contains "${a}"`),await ni(g,async()=>{await A(i).toHaveTitle(V,{timeout:v})},`Expected title to contain "${a}"`,{stepType:"web_assert_title_contains",expected:a}),g.logger.info(`✓ Title contains "${a}"`),{_summary:`"${a}" in title`,expectedText:a}}},{type:"web_assert_enabled",category:"Web",color:"#FF9800",tooltip:"Assert that an element is enabled (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=f.TIMEOUT,R=await ri(),V=i.locator(a);return g.logger.info(`Asserting ${v} is enabled`),await ni(g,async()=>{await R(V).toBeEnabled({timeout:A})},`Expected element ${v} to be enabled`,{stepType:"web_assert_enabled",expected:"enabled",actual:"disabled"}),g.logger.info(`✓ Element ${v} is enabled`),{_summary:`${v} is enabled`,selector:a,isEnabled:!0}}},{type:"web_assert_checked",category:"Web",color:"#FF9800",tooltip:"Assert that a checkbox is checked (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"EXPECTED",type:"field",fieldType:"checkbox",default:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=f.EXPECTED,R=f.TIMEOUT,V=await ri(),H=i.locator(a);return g.logger.info(`Asserting ${v} is ${A?"checked":"unchecked"}`),await ni(g,async()=>{A?await V(H).toBeChecked({timeout:R}):await V(H).not.toBeChecked({timeout:R})},`Expected checkbox ${v} to be ${A?"checked":"unchecked"}`,{stepType:"web_assert_checked",expected:A?"checked":"unchecked"}),g.logger.info(`✓ Checkbox ${v} is ${A?"checked":"unchecked"}`),{_summary:`${v} is ${A?"checked":"unchecked"}`,selector:a,expected:A}}},{type:"web_assert_value",category:"Web",color:"#FF9800",tooltip:"Assert that an input field has a specific value (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"VALUE",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=js(f.VALUE,g),R=f.TIMEOUT,V=await ri(),H=i.locator(a);return g.logger.info(`Asserting ${v} has value "${A}"`),await ni(g,async()=>{await V(H).toHaveValue(A,{timeout:R})},`Expected input ${v} to have value "${A}"`,{stepType:"web_assert_value",expected:A}),g.logger.info(`✓ Input ${v} has value "${A}"`),{_summary:`${v} = "${A}"`,selector:a,expected:A}}},{type:"web_assert_value_contains",category:"Web",color:"#FF9800",tooltip:"Assert that an input field value contains specific text (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"VALUE",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=js(f.VALUE,g),R=f.TIMEOUT,V=await ri(),H=i.locator(a);return g.logger.info(`Asserting ${v} value contains "${A}"`),await ni(g,async()=>{await V(H).toHaveValue(new RegExp(A),{timeout:R})},`Expected input ${v} value to contain "${A}"`,{stepType:"web_assert_value_contains",expected:A}),g.logger.info(`✓ Input ${v} value contains "${A}"`),{_summary:`${v} contains "${A}"`,selector:a,expected:A}}}],_b=[...$b,...gb,...fb,...mb],Eb=[{type:"logic_set_variable",category:"Logic",color:"#795548",tooltip:"Set a variable value",inputs:[{name:"NAME",type:"field",fieldType:"text",required:!0},{name:"VALUE",type:"value",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.NAME;let a=f.VALUE;a&&typeof a=="object"&&"_value"in a&&(a=a._value),g.variables.set(i,a),g.logger.debug(`Set variable ${i} = ${JSON.stringify(a)}`)}},{type:"logic_get_variable",category:"Logic",color:"#795548",tooltip:"Get a variable value",inputs:[{name:"NAME",type:"field",fieldType:"text",required:!0}],output:{type:["String","Number","Boolean","Object","Array"]},execute:async(f,g)=>{const i=f.NAME;return g.variables.get(i)}},{type:"logic_if",category:"Logic",color:"#5C6BC0",tooltip:"Execute blocks if condition is true",inputs:[{name:"CONDITION",type:"value",check:"Boolean",required:!0},{name:"DO",type:"statement"},{name:"ELSE",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.CONDITION;if(i&&f.DO)return{branch:"DO"};if(!i&&f.ELSE)return{branch:"ELSE"}}},{type:"logic_compare",category:"Logic",color:"#5C6BC0",tooltip:"Compare two values",inputs:[{name:"A",type:"value",required:!0},{name:"OP",type:"field",fieldType:"dropdown",options:[["=","eq"],["≠","neq"],["<","lt"],["≤","lte"],[">","gt"],["≥","gte"],["contains","contains"]]},{name:"B",type:"value",required:!0}],output:{type:"Boolean"},execute:async(f,g)=>{const i=f.A,a=f.B;switch(f.OP){case"eq":return JSON.stringify(i)===JSON.stringify(a);case"neq":return JSON.stringify(i)!==JSON.stringify(a);case"lt":return i<a;case"lte":return i<=a;case"gt":return i>a;case"gte":return i>=a;case"contains":return typeof i=="string"||Array.isArray(i)?i.includes(a):!1;default:return!1}}},{type:"logic_boolean_op",category:"Logic",color:"#5C6BC0",tooltip:"Combine boolean values",inputs:[{name:"A",type:"value",check:"Boolean",required:!0},{name:"OP",type:"field",fieldType:"dropdown",options:[["and","and"],["or","or"]]},{name:"B",type:"value",check:"Boolean",required:!0}],output:{type:"Boolean"},execute:async f=>{const g=f.A,i=f.B;return f.OP==="and"?g&&i:g||i}},{type:"logic_not",category:"Logic",color:"#5C6BC0",tooltip:"Negate a boolean value",inputs:[{name:"VALUE",type:"value",check:"Boolean",required:!0}],output:{type:"Boolean"},execute:async f=>!f.VALUE},{type:"logic_repeat",category:"Logic",color:"#5C6BC0",tooltip:"Repeat blocks a specified number of times",inputs:[{name:"TIMES",type:"field",fieldType:"number",default:10,required:!0},{name:"DO",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>({loop:!0,times:f.TIMES,statement:"DO"})},{type:"logic_foreach",category:"Logic",color:"#5C6BC0",tooltip:"Iterate over an array",inputs:[{name:"ARRAY",type:"value",check:"Array",required:!0},{name:"VAR",type:"field",fieldType:"text",default:"item",required:!0},{name:"DO",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.ARRAY,a=f.VAR;return{loop:!0,array:i,varName:a,statement:"DO"}}},{type:"logic_try_catch",category:"Logic",color:"#5C6BC0",tooltip:"Handle errors gracefully",inputs:[{name:"TRY",type:"statement"},{name:"CATCH",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>({tryCatch:!0})},{type:"logic_log",category:"Logic",color:"#607D8B",tooltip:"Log a message",inputs:[{name:"LEVEL",type:"field",fieldType:"dropdown",options:[["Info","info"],["Warning","warn"],["Error","error"],["Debug","debug"]]},{name:"MESSAGE",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.LEVEL||"info",a=id(f.MESSAGE,g);return g.logger[i](a),{_message:a,_summary:a}}},{type:"logic_comment",category:"Logic",color:"#9E9E9E",tooltip:"Add a comment (does nothing)",inputs:[{name:"TEXT",type:"field",fieldType:"text",default:"Comment"}],previousStatement:!0,nextStatement:!0,execute:async()=>{}},{type:"logic_text",category:"Logic",color:"#795548",tooltip:"A text value",inputs:[{name:"TEXT",type:"field",fieldType:"text",default:""}],output:{type:"String"},execute:async(f,g)=>id(f.TEXT,g)},{type:"logic_number",category:"Logic",color:"#795548",tooltip:"A number value",inputs:[{name:"NUM",type:"field",fieldType:"number",default:0}],output:{type:"Number"},execute:async f=>f.NUM},{type:"logic_boolean",category:"Logic",color:"#795548",tooltip:"A boolean value",inputs:[{name:"BOOL",type:"field",fieldType:"dropdown",options:[["true","true"],["false","false"]]}],output:{type:"Boolean"},execute:async f=>f.BOOL==="true"},{type:"logic_object",category:"Logic",color:"#795548",tooltip:"Create a JSON object",inputs:[{name:"JSON",type:"field",fieldType:"text",default:"{}"}],output:{type:"Object"},execute:async(f,g)=>{const i=id(f.JSON,g);return JSON.parse(i)}},{type:"logic_array",category:"Logic",color:"#795548",tooltip:"Create an array",inputs:[{name:"JSON",type:"field",fieldType:"text",default:"[]"}],output:{type:"Array"},execute:async(f,g)=>{const i=id(f.JSON,g);return JSON.parse(i)}},{type:"logic_fail",category:"Logic",color:"#f44336",tooltip:"Fail the test with a message",inputs:[{name:"MESSAGE",type:"field",fieldType:"text",default:"Test failed"}],previousStatement:!0,execute:async(f,g)=>{const i=id(f.MESSAGE,g);throw new Error(i)}},{type:"logic_assert",category:"Logic",color:"#FF9800",tooltip:"Assert a condition is true",inputs:[{name:"CONDITION",type:"value",check:"Boolean",required:!0},{name:"MESSAGE",type:"field",fieldType:"text",default:"Assertion failed"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.CONDITION,a=id(f.MESSAGE,g);sf(g,i,a,{stepType:"logic_assert",expected:!0,actual:i}),g.logger.info("✓ Assertion passed")}}];function id(f,g){return f.replace(/\$\{([\w.]+)\}/g,(i,a)=>{const v=a.split("."),A=v[0];let R=g.variables.get(A);if(v.length>1&&R!==void 0&&R!==null)for(let V=1;V<v.length&&R!=null;V++)R=R[v[V]];return R==null?i:typeof R=="object"?JSON.stringify(R):String(R)})}const Tb=[{type:"test_case",category:"Tests",color:"#1E88E5",tooltip:"A test case containing steps to execute",inputs:[{name:"NAME",type:"field",fieldType:"multiline",default:"Test Case"},{name:"SOFT_ASSERTIONS",type:"field",fieldType:"checkbox",default:!1},{name:"STEPS",type:"statement"}],execute:async(f,g)=>({testCase:!0,name:f.NAME,softAssertions:f.SOFT_ASSERTIONS,statement:"STEPS"})},{type:"test_case_data_driven",category:"Tests",color:"#1565C0",tooltip:"A data-driven test case that runs for each row of data (CSV format: header row, then data rows)",inputs:[{name:"NAME",type:"field",fieldType:"text",default:"Data-Driven Test"},{name:"SOFT_ASSERTIONS",type:"field",fieldType:"checkbox",default:!1},{name:"DATA",type:"field",fieldType:"multiline",default:`username,password,expected
837
837
  user1,pass1,true
838
838
  user2,pass2,false`},{name:"STEPS",type:"statement"}],execute:async(f,g)=>{const a=f.DATA.trim().split(`
839
839
  `).map(R=>R.split(",").map(V=>V.trim()));if(a.length<2)return{testCase:!0,name:f.NAME,softAssertions:f.SOFT_ASSERTIONS,dataDriven:!0,data:[],statement:"STEPS"};const v=a[0],A=a.slice(1).map((R,V)=>{const H={};return v.forEach((re,pe)=>{let Z=R[pe]||"";Z==="true"?Z=!0:Z==="false"?Z=!1:!isNaN(Number(Z))&&Z!==""&&(Z=Number(Z)),H[re]=Z}),{name:`Row ${V+1}`,values:H}});return{testCase:!0,name:f.NAME,softAssertions:f.SOFT_ASSERTIONS,dataDriven:!0,data:A,statement:"STEPS"}}},{type:"lifecycle_before_all",category:"Lifecycle",color:"#8E24AA",tooltip:"Steps to run once before all tests in the suite",inputs:[{name:"DO",type:"statement"}],execute:async(f,g)=>({lifecycle:"beforeAll",statement:"DO"})},{type:"lifecycle_after_all",category:"Lifecycle",color:"#8E24AA",tooltip:"Steps to run once after all tests in the suite",inputs:[{name:"DO",type:"statement"}],execute:async(f,g)=>({lifecycle:"afterAll",statement:"DO"})},{type:"lifecycle_before_each",category:"Lifecycle",color:"#8E24AA",tooltip:"Steps to run before each test",inputs:[{name:"DO",type:"statement"}],execute:async(f,g)=>({lifecycle:"beforeEach",statement:"DO"})},{type:"lifecycle_after_each",category:"Lifecycle",color:"#8E24AA",tooltip:"Steps to run after each test",inputs:[{name:"DO",type:"statement"}],execute:async(f,g)=>({lifecycle:"afterEach",statement:"DO"})},{type:"lifecycle_setup",category:"Lifecycle",color:"#8E24AA",tooltip:"Setup steps to run before the test",inputs:[{name:"DESCRIPTION",type:"field",fieldType:"text",default:"Setup"},{name:"DO",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>(g.logger.info(`Setup: ${f.DESCRIPTION}`),{lifecycle:"setup",statement:"DO"})},{type:"lifecycle_teardown",category:"Lifecycle",color:"#8E24AA",tooltip:"Teardown steps to run after the test",inputs:[{name:"DESCRIPTION",type:"field",fieldType:"text",default:"Teardown"},{name:"DO",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>(g.logger.info(`Teardown: ${f.DESCRIPTION}`),{lifecycle:"teardown",statement:"DO"})},{type:"lifecycle_on_failure",category:"Lifecycle",color:"#C62828",tooltip:"Steps to run only if the test fails",inputs:[{name:"DO",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>({lifecycle:"onFailure",statement:"DO"})},{type:"lifecycle_skip_if",category:"Lifecycle",color:"#757575",tooltip:"Skip the rest of the test if condition is true",inputs:[{name:"CONDITION",type:"value",check:"Boolean",required:!0},{name:"REASON",type:"field",fieldType:"text",default:"Condition not met"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.CONDITION,a=f.REASON;if(i)throw{skip:!0,reason:a}}},{type:"lifecycle_retry",category:"Lifecycle",color:"#FF6F00",tooltip:"Retry steps on failure",inputs:[{name:"TIMES",type:"field",fieldType:"number",default:3},{name:"DELAY",type:"field",fieldType:"number",default:1e3},{name:"DO",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.TIMES,a=f.DELAY;return{retry:!0,times:i,delay:a,statement:"DO"}}}],bb=[{type:"data_define",category:"Data",color:"#00897B",tooltip:"Define test data sets for data-driven testing",inputs:[{name:"DATA_JSON",type:"field",fieldType:"text",default:'[{"name": "test1", "value": 1}]'}],output:{type:"Array"},execute:async(f,g)=>{const i=v$(f.DATA_JSON,g);return JSON.parse(i)}},{type:"data_from_variable",category:"Data",color:"#00897B",tooltip:"Get test data from a variable",inputs:[{name:"NAME",type:"field",fieldType:"text",required:!0}],output:{type:"Array"},execute:async(f,g)=>{const i=f.NAME;return g.variables.get(i)||[]}},{type:"data_get_current",category:"Data",color:"#00897B",tooltip:"Get a value from the current data set",inputs:[{name:"KEY",type:"field",fieldType:"text",required:!0}],output:{type:["String","Number","Boolean","Object","Array"]},execute:async(f,g)=>{const i=f.KEY;if(!g.currentData)throw new Error("No data set available. This block must be used inside a data-driven test.");const a=g.currentData.values[i];return a===void 0&&g.logger.warn(`Data key "${i}" not found in current data set`),a}},{type:"data_get_index",category:"Data",color:"#00897B",tooltip:"Get the current data iteration index (0-based)",inputs:[],output:{type:"Number"},execute:async(f,g)=>g.dataIndex??0},{type:"data_get_name",category:"Data",color:"#00897B",tooltip:"Get the name of the current data set",inputs:[],output:{type:"String"},execute:async(f,g)=>{var i;return((i=g.currentData)==null?void 0:i.name)??`Iteration ${(g.dataIndex??0)+1}`}},{type:"data_foreach",category:"Data",color:"#00897B",tooltip:"Run steps for each item in a data set",inputs:[{name:"DATA",type:"value",check:"Array",required:!0},{name:"ITEM_VAR",type:"field",fieldType:"text",default:"item"},{name:"INDEX_VAR",type:"field",fieldType:"text",default:"index"},{name:"DO",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.DATA,a=f.ITEM_VAR,v=f.INDEX_VAR;return{dataLoop:!0,data:i,itemVar:a,indexVar:v,statement:"DO"}}},{type:"data_row",category:"Data",color:"#00897B",tooltip:"Create a single data row with key-value pairs",inputs:[{name:"NAME",type:"field",fieldType:"text",default:""},{name:"JSON",type:"field",fieldType:"text",default:"{}"}],output:{type:"Object"},execute:async(f,g)=>{const i=f.NAME,a=v$(f.JSON,g);return{name:i||void 0,values:JSON.parse(a)}}},{type:"data_table",category:"Data",color:"#00897B",tooltip:"Create a data table with headers and rows",inputs:[{name:"HEADERS",type:"field",fieldType:"text",default:"username, password, expected"},{name:"ROWS",type:"field",fieldType:"text",default:`user1, pass1, true
@@ -2192,4 +2192,4 @@ def ${p.FUNCTION_NAME_PLACEHOLDER_}(msg):
2192
2192
  ]`})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Using Data Values"}),E.jsxs("ol",{children:[E.jsxs("li",{children:["Use ",E.jsx("strong",{children:"Get Current Value"})," block with field name"]}),E.jsxs("li",{children:["Example: Get Current Value ",E.jsx("code",{children:"username"})]}),E.jsxs("li",{children:["Or use in text: ",E.jsx("code",{children:"${data.username}"})]})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Other Data Blocks"}),E.jsxs("ul",{children:[E.jsxs("li",{children:[E.jsx("strong",{children:"Data Table"})," - define data with headers and rows"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"CSV Data"})," - parse CSV-style data"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"Range"})," - generate number sequences (1 to 10)"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"For Each Data"})," - iterate within a test"]})]})]}),E.jsxs("div",{className:"help-tip",children:[E.jsx("strong",{children:"Example Use Case:"})," Test login with valid users, invalid passwords, empty fields, and special characters all in one test."]})]})},{id:"custom-blocks",title:"Custom Blocks",content:E.jsxs(E.Fragment,{children:[E.jsx("h3",{children:"Creating Reusable Blocks"}),E.jsx("p",{children:"Turn any sequence of blocks into a reusable custom block."}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Creating a Custom Block"}),E.jsxs("ol",{children:[E.jsx("li",{children:"Build your block sequence in the workspace"}),E.jsxs("li",{children:[E.jsx("strong",{children:"Select multiple blocks"})," using Shift+Click or Ctrl/Cmd+Click"]}),E.jsxs("li",{children:["Right-click and choose ",E.jsx("strong",{children:'"Create Reusable Block"'})]}),E.jsx("li",{children:'Name your block (e.g., "Login", "Add to Cart")'}),E.jsx("li",{children:"Choose which values should be parameters"}),E.jsxs("li",{children:["Click ",E.jsx("strong",{children:"Create Block"})]})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Using Custom Blocks"}),E.jsxs("ol",{children:[E.jsxs("li",{children:["Find your block in the ",E.jsx("strong",{children:"Custom"})," category in the toolbox"]}),E.jsx("li",{children:"Drag it into any test"}),E.jsx("li",{children:"Fill in the parameter values"})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Editing Custom Blocks"}),E.jsxs("ol",{children:[E.jsx("li",{children:"Right-click on any instance of your custom block"}),E.jsxs("li",{children:["Choose ",E.jsx("strong",{children:'"Edit Reusable Block"'})]}),E.jsx("li",{children:"Modify the steps or parameters"}),E.jsxs("li",{children:["Click ",E.jsx("strong",{children:"Save Changes"})]})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Parameters"}),E.jsx("p",{children:"When creating a custom block, you can choose which field values become parameters:"}),E.jsxs("ul",{children:[E.jsx("li",{children:"Checked = user can customize this value when using the block"}),E.jsx("li",{children:"Unchecked = value is fixed inside the block"})]})]}),E.jsxs("div",{className:"help-tip",children:[E.jsx("strong",{children:"Best Practice:"})," Create custom blocks for common flows like login, navigation, or form filling to keep tests DRY (Don't Repeat Yourself)."]})]})},{id:"lifecycle",title:"Lifecycle Hooks",content:E.jsxs(E.Fragment,{children:[E.jsx("h3",{children:"Setup & Teardown"}),E.jsx("p",{children:"Run code before/after tests using lifecycle hooks."}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Available Hooks"}),E.jsxs("ul",{children:[E.jsxs("li",{children:[E.jsx("strong",{children:"Before All"})," - runs once before all tests start"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"After All"})," - runs once after all tests complete"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"Before Each"})," - runs before each individual test"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"After Each"})," - runs after each individual test"]})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Accessing Lifecycle Tabs"}),E.jsxs("ol",{children:[E.jsxs("li",{children:["Click the tabs above the workspace: ",E.jsx("strong",{children:"Test | Before All | After All | Before Each | After Each"})]}),E.jsx("li",{children:"Add blocks to the selected lifecycle phase"}),E.jsx("li",{children:"Blocks run automatically at the appropriate time"})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Common Use Cases"}),E.jsxs("ul",{children:[E.jsxs("li",{children:[E.jsx("strong",{children:"Before All:"})," Set up test data, authenticate API"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"Before Each:"})," Navigate to starting page, reset state"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"After Each:"})," Take screenshot, log out user"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"After All:"})," Clean up test data, close connections"]})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Special Lifecycle Blocks"}),E.jsxs("ul",{children:[E.jsxs("li",{children:[E.jsx("strong",{children:"On Failure"})," - only runs if the test fails"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"Skip If"})," - skip test based on condition"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"Retry"})," - retry failed steps automatically"]})]})]}),E.jsxs("div",{className:"help-tip",children:[E.jsx("strong",{children:"Tip:"})," Use Before Each to ensure each test starts from a clean state, making tests independent and reliable."]})]})},{id:"logic",title:"Logic & Control Flow",content:E.jsxs(E.Fragment,{children:[E.jsx("h3",{children:"Control Flow"}),E.jsx("p",{children:"Add conditional logic, loops, and error handling to your tests."}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Conditional Execution (If/Else)"}),E.jsxs("ol",{children:[E.jsxs("li",{children:["Use the ",E.jsx("strong",{children:"If"})," block from Logic category"]}),E.jsxs("li",{children:["Connect a condition block (e.g., ",E.jsx("strong",{children:"Compare"}),")"]}),E.jsx("li",{children:'Add blocks inside the "then" section'}),E.jsx("li",{children:'Optionally add blocks to the "else" section'})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Comparisons"}),E.jsxs("p",{children:["Use the ",E.jsx("strong",{children:"Compare"})," block to check:"]}),E.jsxs("ul",{children:[E.jsxs("li",{children:[E.jsx("code",{children:"="})," equals"]}),E.jsxs("li",{children:[E.jsx("code",{children:"≠"})," not equals"]}),E.jsxs("li",{children:[E.jsx("code",{children:"<"})," ",E.jsx("code",{children:">"})," ",E.jsx("code",{children:"≤"})," ",E.jsx("code",{children:"≥"})," numeric comparisons"]}),E.jsxs("li",{children:[E.jsx("code",{children:"contains"})," text contains"]})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Loops"}),E.jsxs("ul",{children:[E.jsxs("li",{children:[E.jsx("strong",{children:"Repeat"})," - run blocks N times"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"For Each"})," - iterate over an array"]})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Error Handling"}),E.jsxs("ol",{children:[E.jsxs("li",{children:["Use ",E.jsx("strong",{children:"Try/Catch"})," to handle potential failures"]}),E.jsx("li",{children:'Blocks in "try" run first'}),E.jsx("li",{children:'If they fail, "catch" blocks run instead'})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Logging & Debugging"}),E.jsxs("ul",{children:[E.jsxs("li",{children:[E.jsx("strong",{children:"Log"})," - output messages (info, warn, error, debug)"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"Comment"})," - add notes (doesn't run)"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"Fail"})," - force test to fail with message"]})]})]})]})},{id:"tips",title:"Tips & Tricks",content:E.jsxs(E.Fragment,{children:[E.jsx("h3",{children:"Pro Tips"}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Selectors"}),E.jsx("p",{children:"Best practices for finding elements:"}),E.jsxs("ul",{children:[E.jsxs("li",{children:[E.jsx("code",{children:"#id"})," - by ID (most reliable)"]}),E.jsxs("li",{children:[E.jsx("code",{children:'[data-testid="value"]'})," - by test ID attribute"]}),E.jsxs("li",{children:[E.jsx("code",{children:".class-name"})," - by CSS class"]}),E.jsxs("li",{children:[E.jsx("code",{children:"text=Click me"})," - by visible text"]}),E.jsxs("li",{children:[E.jsx("code",{children:'button:has-text("Submit")'})," - button containing text"]})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Keyboard Shortcuts"}),E.jsxs("ul",{children:[E.jsxs("li",{children:[E.jsx("strong",{children:"Delete/Backspace"})," - delete selected block"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"Ctrl/Cmd + C/V"})," - copy/paste blocks"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"Ctrl/Cmd + Z"})," - undo"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"Shift + Click"})," - select multiple blocks"]})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Debugging Failed Tests"}),E.jsxs("ol",{children:[E.jsxs("li",{children:["Turn off ",E.jsx("strong",{children:"Headless"})," mode to watch the browser"]}),E.jsxs("li",{children:["Add ",E.jsx("strong",{children:"Wait"})," blocks to slow down execution"]}),E.jsxs("li",{children:["Use ",E.jsx("strong",{children:"Screenshot"})," blocks to capture state"]}),E.jsx("li",{children:"Check the Results panel for error details"})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Test Organization"}),E.jsxs("ul",{children:[E.jsx("li",{children:"One test file per feature or page"}),E.jsx("li",{children:"Use descriptive test names"}),E.jsx("li",{children:"Keep tests independent (don't rely on other tests)"}),E.jsx("li",{children:"Use lifecycle hooks for common setup"})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Performance Tips"}),E.jsxs("ul",{children:[E.jsxs("li",{children:["Avoid fixed ",E.jsx("strong",{children:"Wait"})," blocks - use ",E.jsx("strong",{children:"Wait for Element"})," instead"]}),E.jsxs("li",{children:["Run tests in ",E.jsx("strong",{children:"Headless"})," mode for speed"]}),E.jsx("li",{children:"Use API calls to set up test data (faster than UI)"})]})]})]})}];function By({isOpen:f,onClose:g}){const[i,a]=Re.useState("getting-started");if(!f)return null;const v=EE.find(A=>A.id===i);return E.jsx("div",{className:"modal-overlay",onClick:g,children:E.jsxs("div",{className:"modal help-modal",onClick:A=>A.stopPropagation(),children:[E.jsxs("div",{className:"help-header",children:[E.jsx("h2",{children:"TestBlocks Guide"}),E.jsx("button",{className:"btn-close",onClick:g,children:"×"})]}),E.jsxs("div",{className:"help-layout",children:[E.jsx("nav",{className:"help-nav",children:EE.map(A=>E.jsx("button",{className:`help-nav-item ${i===A.id?"active":""}`,onClick:()=>a(A.id),children:A.title},A.id))}),E.jsx("div",{className:"help-content",children:v==null?void 0:v.content})]})]})})}function Uy(f){switch(f.type){case"web_navigate":return`Navigate → ${f.params.URL}`;case"web_click":return`Click → ${f.params.SELECTOR}`;case"web_fill":return`Fill → ${f.params.SELECTOR}`;case"web_type":return`Type → ${f.params.SELECTOR}`;case"web_checkbox":return`${f.params.ACTION==="check"?"Check":"Uncheck"} → ${f.params.SELECTOR}`;case"web_select":return`Select → ${f.params.SELECTOR}`;case"web_hover":return`Hover → ${f.params.SELECTOR}`;case"web_press_key":return`Press Key → ${f.params.KEY}`;case"web_wait_for_element":return`Wait for → ${f.params.SELECTOR}`;case"web_wait":return`Wait → ${f.params.DURATION}ms`;default:return f.type}}function Vy({isOpen:f,onClose:g,onStepsRecorded:i}){const[a,v]=Re.useState({stage:"url-input",url:"https://",sessionId:null,steps:[],error:null,showAdvanced:!1,options:{testIdAttribute:"data-testid"}}),A=Re.useRef(null);Re.useEffect(()=>(f&&fetch("/api/globals").then(Z=>Z.json()).then(Z=>{v({stage:"url-input",url:"https://",sessionId:null,steps:[],error:null,showAdvanced:!1,options:{testIdAttribute:Z.testIdAttribute||"data-testid"}})}).catch(()=>{v({stage:"url-input",url:"https://",sessionId:null,steps:[],error:null,showAdvanced:!1,options:{testIdAttribute:"data-testid"}})}),()=>{A.current&&(clearInterval(A.current),A.current=null)}),[f]),Re.useEffect(()=>{if(a.stage==="recording"&&a.sessionId)return A.current=setInterval(async()=>{try{const W=await(await fetch(`/api/record/status/${a.sessionId}`)).json();W.status==="completed"?V():W.status==="error"&&(v(X=>({...X,stage:"error",error:W.error||"Recording failed"})),A.current&&(clearInterval(A.current),A.current=null))}catch(Z){console.error("Failed to poll recording status:",Z)}},2e3),()=>{A.current&&(clearInterval(A.current),A.current=null)}},[a.stage,a.sessionId]);const R=Re.useCallback(async()=>{if(!a.url||a.url==="https://"){v(Z=>({...Z,error:"Please enter a valid URL"}));return}v(Z=>({...Z,stage:"processing",error:null}));try{const Z=await fetch("/api/record/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:a.url,testIdAttribute:a.options.testIdAttribute||void 0})}),W=await Z.json();if(!Z.ok)throw new Error(W.message||W.error||"Failed to start recording");v(X=>({...X,stage:"recording",sessionId:W.sessionId}))}catch(Z){v(W=>({...W,stage:"error",error:Z.message}))}},[a.url,a.options.testIdAttribute]),V=Re.useCallback(async()=>{if(a.sessionId){A.current&&(clearInterval(A.current),A.current=null),v(Z=>({...Z,stage:"processing"}));try{const Z=await fetch("/api/record/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:a.sessionId})}),W=await Z.json();if(!Z.ok)throw new Error(W.message||W.error||"Failed to stop recording");v(X=>({...X,stage:"preview",steps:W.steps||[]}))}catch(Z){v(W=>({...W,stage:"error",error:Z.message}))}}},[a.sessionId]),H=Re.useCallback(()=>{i(a.steps,"append"),g()},[a.steps,i,g]),re=Re.useCallback(()=>{i(a.steps,"new"),g()},[a.steps,i,g]),pe=Re.useCallback(()=>{if(a.stage==="recording"){if(!confirm("Recording is in progress. Are you sure you want to cancel?"))return;a.sessionId&&fetch("/api/record/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:a.sessionId})}).catch(()=>{})}g()},[a.stage,a.sessionId,g]);return f?E.jsx("div",{className:"modal-overlay",onClick:pe,children:E.jsxs("div",{className:"modal record-dialog",onClick:Z=>Z.stopPropagation(),children:[E.jsxs("div",{className:"modal-header",children:[E.jsx("h2",{children:"Record Browser Actions"}),E.jsx("button",{className:"btn-close",onClick:pe,children:"×"})]}),E.jsxs("div",{className:"modal-body",children:[a.stage==="url-input"&&E.jsxs("div",{className:"record-url-input",children:[E.jsx("p",{children:"Enter the starting URL for recording:"}),E.jsx("input",{type:"url",className:"url-input",value:a.url,onChange:Z=>v(W=>({...W,url:Z.target.value,error:null})),placeholder:"https://example.com",autoFocus:!0}),a.error&&E.jsx("div",{className:"record-error",children:a.error}),E.jsx("p",{className:"record-hint",children:"A browser window will open where you can perform actions. Close the browser when you're done recording."}),E.jsxs("div",{className:"advanced-options",children:[E.jsxs("button",{type:"button",className:"advanced-toggle",onClick:()=>v(Z=>({...Z,showAdvanced:!Z.showAdvanced})),children:[E.jsx("span",{className:"toggle-icon",children:a.showAdvanced?"▼":"▶"}),"Advanced Options"]}),a.showAdvanced&&E.jsxs("div",{className:"advanced-content",children:[E.jsxs("div",{className:"option-row",children:[E.jsx("label",{htmlFor:"testIdAttribute",children:"Test ID Attribute:"}),E.jsx("input",{id:"testIdAttribute",type:"text",className:"option-input",value:a.options.testIdAttribute,onChange:Z=>{const W=Z.target.value;v(X=>({...X,options:{...X.options,testIdAttribute:W}}))},onBlur:Z=>{const W=Z.target.value.trim();W&&fetch("/api/globals/test-id-attribute",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({testIdAttribute:W})}).catch(console.error)},placeholder:"data-testid"})]}),E.jsx("p",{className:"option-hint",children:"Attribute used to identify elements (e.g., data-testid, data-test, data-cy). This setting is saved globally."})]})]})]}),a.stage==="recording"&&E.jsxs("div",{className:"record-status recording",children:[E.jsx("div",{className:"recording-indicator"}),E.jsxs("div",{className:"recording-info",children:[E.jsx("h3",{children:"Recording in progress..."}),E.jsx("p",{children:"Perform your test actions in the browser window."}),E.jsx("p",{children:'Close the browser or click "Stop Recording" when done.'})]})]}),a.stage==="processing"&&E.jsxs("div",{className:"record-status processing",children:[E.jsx("div",{className:"processing-spinner"}),E.jsx("p",{children:"Processing recorded actions..."})]}),a.stage==="preview"&&E.jsx("div",{className:"record-preview",children:a.steps.length===0?E.jsxs("div",{className:"record-empty",children:[E.jsx("p",{children:"No actions were recorded."}),E.jsx("p",{className:"record-hint",children:"Make sure to interact with elements in the browser (click, type, navigate, etc.)"})]}):E.jsxs(E.Fragment,{children:[E.jsxs("h3",{children:["Recorded ",a.steps.length," action",a.steps.length!==1?"s":"",":"]}),E.jsx("div",{className:"steps-preview",children:a.steps.map((Z,W)=>E.jsxs("div",{className:"step-preview-item",children:[E.jsxs("span",{className:"step-number",children:[W+1,"."]}),E.jsx("span",{className:"step-description",children:Uy(Z)})]},Z.id))})]})}),a.stage==="error"&&E.jsxs("div",{className:"record-error-state",children:[E.jsx("h3",{children:"Recording Failed"}),E.jsx("p",{className:"record-error",children:a.error}),E.jsx("button",{className:"btn btn-secondary",onClick:()=>v(Z=>({...Z,stage:"url-input",error:null})),children:"Try Again"})]})]}),E.jsxs("div",{className:"modal-actions",children:[E.jsx("button",{className:"btn btn-secondary",onClick:pe,children:"Cancel"}),a.stage==="url-input"&&E.jsx("button",{className:"btn btn-primary",onClick:R,children:"Start Recording"}),a.stage==="recording"&&E.jsx("button",{className:"btn btn-warning",onClick:V,children:"Stop Recording"}),a.stage==="preview"&&a.steps.length>0&&E.jsxs(E.Fragment,{children:[E.jsx("button",{className:"btn btn-secondary",onClick:H,children:"Add to Current Test"}),E.jsx("button",{className:"btn btn-primary",onClick:re,children:"Create New Test"})]})]})]})}):null}function Hy({isOpen:f,title:g,fields:i,onSubmit:a,onCancel:v,submitLabel:A="Create"}){const[R,V]=Re.useState({}),H=Re.useRef(null);if(Re.useEffect(()=>{if(f){const Z={};i.forEach(W=>{Z[W.name]=W.defaultValue||""}),V(Z),setTimeout(()=>{var W;return(W=H.current)==null?void 0:W.focus()},50)}},[f,i]),!f)return null;const re=Z=>{Z.preventDefault(),i.every(X=>{var te;return!X.required||((te=R[X.name])==null?void 0:te.trim())})&&a(R)},pe=Z=>{Z.key==="Escape"&&v()};return E.jsx("div",{className:"modal-overlay",onClick:v,children:E.jsxs("div",{className:"modal prompt-dialog",onClick:Z=>Z.stopPropagation(),onKeyDown:pe,children:[E.jsxs("div",{className:"modal-header",children:[E.jsx("h2",{children:g}),E.jsx("button",{className:"btn-close",onClick:v,children:"×"})]}),E.jsxs("form",{onSubmit:re,children:[E.jsx("div",{className:"modal-body",children:i.map((Z,W)=>E.jsxs("div",{className:"prompt-field",children:[E.jsx("label",{htmlFor:`prompt-${Z.name}`,children:Z.label}),E.jsx("input",{ref:W===0?H:void 0,type:"text",id:`prompt-${Z.name}`,value:R[Z.name]||"",onChange:X=>V(te=>({...te,[Z.name]:X.target.value})),placeholder:Z.placeholder,required:Z.required})]},Z.name))}),E.jsxs("div",{className:"modal-actions",children:[E.jsx("button",{type:"button",className:"btn btn-secondary",onClick:v,children:"Cancel"}),E.jsx("button",{type:"submit",className:"btn btn-primary",children:A})]})]})]})})}const Gy=150,jy={global:"#4CAF50",file:"#2196F3",folder:"#9C27B0",test:"#FF9800",procedure:"#607D8B"};function TE({variables:f,onChange:g,title:i="Variables",emptyMessage:a="No variables defined"}){const[v,A]=Re.useState(f),R=Re.useRef(f);Re.useEffect(()=>{JSON.stringify(f)!==JSON.stringify(R.current)&&(v.some(te=>!te.name.trim())||A(f),R.current=f)},[f,v]);const V=Re.useCallback(W=>{const X=W.filter(De=>De.name.trim()!==""),te=new Set;let ve=!1;for(const De of X){const Me=De.name.trim().toLowerCase();if(te.has(Me)){ve=!0;break}te.add(Me)}ve||(R.current=X,g(X))},[g]),H=()=>{const W=[...v,{name:"",value:""}];A(W)},re=(W,X,te)=>{const ve=[...v];ve[W]={...ve[W],[X]:te},A(ve),V(ve)},pe=W=>{const X=v.filter((te,ve)=>ve!==W);A(X),V(X)},Z=Re.useMemo(()=>{const W=new Map;for(const X of v)if(X.name.trim()){const te=X.name.trim().toLowerCase();W.set(te,(W.get(te)||0)+1)}return new Set([...W.entries()].filter(([,X])=>X>1).map(([X])=>X))},[v]);return E.jsxs("div",{className:"variables-editor",children:[i&&E.jsx("div",{className:"variables-section-header",children:E.jsx("h4",{children:i})}),v.length===0?E.jsx("div",{className:"variables-empty",children:a}):v.map((W,X)=>E.jsx(Wy,{variable:W,isDuplicate:Z.has(W.name.trim().toLowerCase()),onUpdate:(te,ve)=>re(X,te,ve),onDelete:()=>pe(X)},X)),E.jsx("button",{className:"add-variable-btn",onClick:H,children:"+ Add Variable"})]})}function Wy({variable:f,isDuplicate:g,onUpdate:i,onDelete:a}){const[v,A]=Re.useState([]),[R,V]=Re.useState(-1),[H,re]=Re.useState(!1),pe=Re.useRef(null),Z=Re.useRef(null);Re.useEffect(()=>{f.name===""&&Z.current&&Z.current.focus()},[]);const W=Re.useCallback((Me,Pe)=>{const ut=Me.substring(0,Pe),ot=ut.lastIndexOf("${");if(ot!==-1){const $t=ut.substring(ot);if(!$t.includes("}")){const Ve=$t.substring(2),ne=P$(Ve);if(ne.length>0){A(ne),V(-1),re(!0);return}}}re(!1),A([])},[]),X=Me=>{const Pe=Me.target.value;i("value",Pe),W(Pe,Me.target.selectionStart||0)},te=Re.useCallback(Me=>{if(Me<0||Me>=v.length||!pe.current)return;const Pe=v[Me],ut=pe.current,ot=ut.selectionStart||0,$t=f.value,ne=$t.substring(0,ot).lastIndexOf("${");if(ne!==-1){const Ie=$t.substring(0,ne)+"${"+Pe.name+"}"+$t.substring(ot);i("value",Ie);const Be=ne+Pe.name.length+3;setTimeout(()=>{ut.setSelectionRange(Be,Be),ut.focus()},0)}re(!1),A([])},[v,f.value,i]),ve=Me=>{if(H)switch(Me.key){case"ArrowDown":Me.preventDefault(),V(Pe=>Pe<v.length-1?Pe+1:0);break;case"ArrowUp":Me.preventDefault(),V(Pe=>Pe>0?Pe-1:v.length-1);break;case"Enter":case"Tab":R>=0?(Me.preventDefault(),te(R)):v.length>0&&Me.key==="Tab"&&(Me.preventDefault(),te(0));break;case"Escape":Me.preventDefault(),re(!1);break}},De=()=>{setTimeout(()=>{re(!1)},Gy)};return E.jsxs("div",{className:`variable-editor-item ${g?"duplicate":""}`,children:[E.jsxs("div",{className:"var-name",children:[E.jsx("input",{ref:Z,type:"text",value:f.name,onChange:Me=>i("name",Me.target.value),onBlur:De,placeholder:"name",style:g?{borderColor:"#f44336"}:void 0}),g&&E.jsx("span",{className:"duplicate-warning",title:"Duplicate variable name",children:"⚠"})]}),E.jsxs("div",{className:"var-value",style:{position:"relative"},children:[E.jsx("input",{ref:pe,type:"text",value:f.value,onChange:X,onKeyDown:ve,onBlur:De,placeholder:"value (use ${var} for references)"}),H&&v.length>0&&E.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,background:"white",border:"1px solid #ccc",borderRadius:"4px",boxShadow:"0 2px 8px rgba(0,0,0,0.15)",maxHeight:"150px",overflowY:"auto",zIndex:1e3},children:v.map((Me,Pe)=>E.jsxs("div",{style:{padding:"6px 10px",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",background:Pe===R?"#e3f2fd":"white",borderBottom:"1px solid #eee",fontSize:"12px"},onMouseEnter:()=>V(Pe),onMouseDown:ut=>{ut.preventDefault(),te(Pe)},children:[E.jsx("span",{style:{background:jy[Me.scope]||"#999",color:"white",padding:"1px 5px",borderRadius:"3px",fontSize:"9px",textTransform:"uppercase"},children:Me.scope.charAt(0)}),E.jsx("span",{style:{fontFamily:"monospace",flex:1},children:"${"+Me.name+"}"})]},Me.name))})]}),E.jsx("div",{className:"var-actions",children:E.jsx("button",{className:"btn-icon delete",onClick:a,title:"Delete variable",children:"×"})})]})}function Xy(f){return f?Object.entries(f).map(([g,i])=>({name:g,value:typeof i=="string"?i:JSON.stringify(i)})):[]}function zy(f){const g={};for(const i of f)if(i.name.trim())try{i.value.startsWith("{")||i.value.startsWith("[")||i.value==="true"||i.value==="false"||!isNaN(Number(i.value))&&i.value!==""?g[i.name]=JSON.parse(i.value):g[i.name]=i.value}catch{g[i.name]=i.value}return g}const Yy="testblocks-storage",cd="handles";async function ME(){return new Promise((f,g)=>{const i=indexedDB.open(Yy,1);i.onerror=()=>g(i.error),i.onsuccess=()=>f(i.result),i.onupgradeneeded=()=>{const a=i.result;a.objectStoreNames.contains(cd)||a.createObjectStore(cd)}})}async function Ky(f){const g=await ME();return new Promise((i,a)=>{const R=g.transaction(cd,"readwrite").objectStore(cd).put(f,"lastDirectory");R.onerror=()=>a(R.error),R.onsuccess=()=>i()})}async function bE(){try{const f=await ME();return new Promise((g,i)=>{const A=f.transaction(cd,"readonly").objectStore(cd).get("lastDirectory");A.onerror=()=>i(A.error),A.onsuccess=()=>g(A.result||null)})}catch{return null}}async function hf(f,g=""){const i={name:f.name,path:g||f.name,type:"folder",children:[],folderHandle:f},a=[];for await(const v of f.values())a.push({name:v.name,kind:v.kind,handle:v});a.sort((v,A)=>v.kind!==A.kind?v.kind==="directory"?-1:1:v.name.localeCompare(A.name));for(const v of a){const A=g?`${g}/${v.name}`:v.name;if(v.kind==="directory"){const R=await hf(v.handle,A);R.children&&R.children.length>0&&i.children.push(R)}else if(v.name==="_hooks.testblocks.json")try{const R=v.handle,H=await(await R.getFile()).text(),re=JSON.parse(H);i.folderHooks=re,i.hooksFileHandle=R}catch(R){console.warn(`Skipping invalid hooks file: ${v.name}`,R)}else if(v.name.endsWith(".testblocks.json")||v.name.endsWith(".json"))try{const R=v.handle,H=await(await R.getFile()).text(),re=JSON.parse(H);re.version&&re.tests&&Array.isArray(re.tests)&&i.children.push({name:v.name,path:A,type:"file",testFile:re,handle:R})}catch(R){console.warn(`Skipping invalid file: ${v.name}`,R)}}return i}async function qy(f){try{const g=await f.getFileHandle("globals.json"),a=await(await g.getFile()).text(),v=JSON.parse(a);return console.log("[loadGlobalsFile] Loaded globals:",v),{variables:v.variables||null,handle:g,fullContent:v}}catch{return console.log("[loadGlobalsFile] No globals.json found"),{variables:null,handle:null,fullContent:null}}}function op(f,g){if(!f||!g)return null;if(f.path===g)return f;if(f.children)for(const i of f.children){const a=op(i,g);if(a)return a}return null}function Jy(f,g,i){const a=JSON.parse(JSON.stringify(f)),v=g.split(".");let A=a;for(let R=0;R<v.length-1;R++)v[R]in A||(A[v[R]]={}),A=A[v[R]];return A[v[v.length-1]]=i,a}const Qy={version:"1.0.0",name:"Untitled Test Suite",description:"",variables:{},tests:[{id:"test-1",name:"Test Case 1",description:"",steps:[],tags:[]}]};function Zy(){var Oe,We;const{toasts:f,dismissToast:g}=by(),[i,a]=Re.useState({projectRoot:null,lastFolderName:null,selectedFilePath:null,globalVariables:null,globalsFileContent:null,testFile:Qy,selectedTestIndex:0,editingFolderHooks:null,folderHooks:{version:"1.0.0"},results:[],isRunning:!1,runningTestId:null,showVariables:!1,showGlobalVariables:!1,headless:localStorage.getItem("testblocks-headless")!=="false",editorTab:"test",sidebarTab:"files",showHelpDialog:!1,showRecordDialog:!1,pluginsLoaded:!1,autoSaveStatus:"idle",resultsPanelCollapsed:!1,sidebarCollapsed:!1,failedFiles:new Set,failedTestsMap:new Map,version:null}),[v,A]=Re.useState(null),R=Re.useCallback((U,B,ue)=>{A({isOpen:!0,title:U,fields:B,onSubmit:ue})},[]),V=Re.useCallback(()=>{A(null)},[]),H=Re.useRef(null),re=Re.useRef(null),pe=Re.useRef(null),Z=Re.useRef(null),W=Re.useRef(null),X=Re.useRef(!0),te=i.testFile.tests[i.selectedTestIndex];Re.useEffect(()=>{if(X.current){X.current=!1;return}if(!(!i.selectedFilePath||!i.projectRoot))return W.current&&clearTimeout(W.current),a(U=>({...U,autoSaveStatus:"saving"})),W.current=setTimeout(async()=>{const U=op(i.projectRoot,i.selectedFilePath);if(U!=null&&U.handle)try{const B=await U.handle.createWritable();await B.write(JSON.stringify(i.testFile,null,2)),await B.close(),U.testFile=i.testFile,console.log("[Auto-save] Saved:",i.selectedFilePath),a(ue=>({...ue,autoSaveStatus:"saved"})),setTimeout(()=>{a(ue=>ue.autoSaveStatus==="saved"?{...ue,autoSaveStatus:"idle"}:ue)},2e3)}catch(B){console.error("[Auto-save] Failed to save:",B),a(ue=>({...ue,autoSaveStatus:"idle"}))}else a(B=>({...B,autoSaveStatus:"idle"}))},1e3),()=>{W.current&&clearTimeout(W.current)}},[i.testFile,i.selectedFilePath,i.projectRoot]),Re.useEffect(()=>{if(i.editingFolderHooks){if(X.current){X.current=!1;return}return W.current&&clearTimeout(W.current),a(U=>({...U,autoSaveStatus:"saving"})),W.current=setTimeout(async()=>{var B,ue,q,Ue;const U=i.editingFolderHooks;if(!(U!=null&&U.folderHandle)){a(ge=>({...ge,autoSaveStatus:"idle"}));return}try{if(((B=i.folderHooks.beforeAll)==null?void 0:B.length)||((ue=i.folderHooks.afterAll)==null?void 0:ue.length)||((q=i.folderHooks.beforeEach)==null?void 0:q.length)||((Ue=i.folderHooks.afterEach)==null?void 0:Ue.length)){const me=U.hooksFileHandle||await U.folderHandle.getFileHandle("_hooks.testblocks.json",{create:!0}),$e=await me.createWritable();await $e.write(JSON.stringify(i.folderHooks,null,2)),await $e.close(),U.folderHooks=i.folderHooks,U.hooksFileHandle=me,console.log("[Auto-save] Saved folder hooks:",U.path)}else if(U.hooksFileHandle)try{await U.folderHandle.removeEntry("_hooks.testblocks.json"),U.folderHooks=void 0,U.hooksFileHandle=void 0,console.log("[Auto-save] Removed empty folder hooks:",U.path)}catch{}a(me=>({...me,autoSaveStatus:"saved"})),setTimeout(()=>{a(me=>me.autoSaveStatus==="saved"?{...me,autoSaveStatus:"idle"}:me)},2e3)}catch(ge){console.error("[Auto-save] Failed to save folder hooks:",ge),a(me=>({...me,autoSaveStatus:"idle"}))}},1e3),()=>{W.current&&clearTimeout(W.current)}}},[i.folderHooks,i.editingFolderHooks]);const ve=Re.useCallback(async U=>{pe.current=U;const[B,ue]=await Promise.all([hf(U),qy(U)]);Z.current=ue.handle,a(q=>({...q,projectRoot:B,globalVariables:ue.variables,globalsFileContent:ue.fullContent,selectedFilePath:null,sidebarTab:"files"}))},[]);Re.useEffect(()=>{(async()=>{try{const B=await bE();B&&(await B.queryPermission({mode:"readwrite"})==="granted"?(await ve(B),console.log("Restored last opened folder:",B.name)):(a(q=>({...q,lastFolderName:B.name})),console.log("Last folder needs permission:",B.name)))}catch(B){console.log("Could not restore last folder:",B.message)}})()},[ve]),Re.useEffect(()=>{fetch("/api/version").then(U=>U.json()).then(U=>{U.version&&a(B=>({...B,version:U.version}))}).catch(()=>{})},[]),Re.useEffect(()=>{(async()=>{try{const B=await fetch("/api/plugins");if(!B.ok){console.warn("Failed to fetch plugins from server"),a(q=>({...q,pluginsLoaded:!0}));return}const ue=await B.json();if(ue.loaded&&Array.isArray(ue.loaded)){for(const q of ue.loaded)q.blocks&&Array.isArray(q.blocks)&&xE({name:q.name,version:q.version,description:q.description,blocks:q.blocks});console.log(`Loaded ${ue.loaded.length} plugin(s) from server`)}}catch(B){console.warn("Could not fetch plugins from server:",B.message)}a(B=>({...B,pluginsLoaded:!0}))})()},[]),Re.useEffect(()=>{Pb(i.globalVariables),i.editingFolderHooks?tE(null):tE(i.testFile.variables||null),Bb(i.editingFolderHooks?"folder":"file");const U=i.testFile.tests[i.selectedTestIndex];if(U!=null&&U.data&&U.data.length>0){const B=Object.keys(U.data[0].values||{});rE(B)}else rE([])},[i.globalVariables,i.testFile.variables,i.editingFolderHooks,i.testFile.tests,i.selectedTestIndex]);const De=Re.useCallback(async()=>{try{const U=await bE();U&&await U.requestPermission({mode:"readwrite"})==="granted"&&(await ve(U),a(ue=>({...ue,lastFolderName:null})))}catch(U){console.error("Failed to reopen folder:",U),a(B=>({...B,lastFolderName:null}))}},[ve]),Me=Re.useCallback(async()=>{var U;if("showDirectoryPicker"in window)try{const B=await window.showDirectoryPicker();await Ky(B),await ve(B),a(ue=>({...ue,lastFolderName:null}))}catch(B){B.name!=="AbortError"&&(console.error("Failed to open folder:",B),Rt.error("Failed to open folder: "+B.message))}else(U=re.current)==null||U.click()},[ve]),Pe=Re.useCallback(U=>{const B=U.target.files;if(!B||B.length===0)return;const ue={name:"Selected Folder",path:"",type:"folder",children:[]},q=new Map;q.set("",ue);const Ue=[];for(let ge=0;ge<B.length;ge++){const me=B[ge],$e=me.webkitRelativePath||me.name;if(!$e.endsWith(".testblocks.json")&&!$e.endsWith(".json"))continue;const he=$e.split("/"),tt=he.pop();let D="",h=ue;for(const j of he){const be=D?`${D}/${j}`:j;if(!q.has(be)){const ye={name:j,path:be,type:"folder",children:[]};h.children.push(ye),q.set(be,ye)}h=q.get(be),D=be}const w=$e,J=me.text().then(j=>{try{const be=JSON.parse(j);be.version&&be.tests&&Array.isArray(be.tests)&&h.children.push({name:tt,path:w,type:"file",testFile:be})}catch(be){console.warn(`Skipping invalid file: ${tt}`,be)}});Ue.push(J)}Promise.all(Ue).then(()=>{var me;const ge=$e=>{$e.children&&($e.children.sort((he,tt)=>he.type!==tt.type?he.type==="folder"?-1:1:he.name.localeCompare(tt.name)),$e.children.forEach(ge))};ge(ue),(me=B[0])!=null&&me.webkitRelativePath&&(ue.name=B[0].webkitRelativePath.split("/")[0]),a($e=>({...$e,projectRoot:ue,selectedFilePath:null,sidebarTab:"files"}))}),U.target.value=""},[]),ut=Re.useCallback(async()=>{if(pe.current)try{const U=await hf(pe.current);a(B=>({...B,projectRoot:U}))}catch(U){console.error("Failed to refresh folder:",U)}},[]),ot=Re.useCallback(U=>{U.type!=="file"||!U.testFile||(U.testFile.procedures?lE(U.testFile.procedures):aE(),X.current=!0,a(B=>({...B,selectedFilePath:U.path,testFile:U.testFile,selectedTestIndex:0,results:[],editorTab:"test",sidebarTab:"tests",editingFolderHooks:null,folderHooks:{version:"1.0.0"}})))},[]),$t=Re.useCallback(U=>{if(U.type!=="folder")return;const B=U.folderHooks||{version:"1.0.0"};a(ue=>({...ue,editingFolderHooks:U,folderHooks:B,selectedFilePath:null,editorTab:"beforeAll",sidebarTab:"files"}))},[]),Ve=Re.useCallback(U=>{if(!U.folderHandle){Rt.error("Cannot create file: folder handle not available");return}R("Create Test File",[{name:"fileName",label:"File name",defaultValue:"new-test",placeholder:"Enter file name",required:!0}],async B=>{const ue=B.fileName;if(!ue)return;const q=ue.endsWith(".testblocks.json")?ue:ue.endsWith(".json")?ue.replace(".json",".testblocks.json"):`${ue}.testblocks.json`;try{const Ue=await U.folderHandle.getFileHandle(q,{create:!0}),ge={version:"1.0.0",name:q.replace(".testblocks.json",""),description:"",variables:{},tests:[{id:`test-${Date.now()}`,name:"New Test",description:"",steps:[],tags:[]}]},me=await Ue.createWritable();await me.write(JSON.stringify(ge,null,2)),await me.close();const $e=`${U.path}/${q}`,he={name:q,path:$e,type:"file",testFile:ge,handle:Ue};a(tt=>{const D=w=>{const J={...w};return w.children&&(J.children=w.children.map(D)),J},h=tt.projectRoot?D(tt.projectRoot):null;if(h){const w=J=>{if(J.path===U.path)return J.children||(J.children=[]),J.children.push(he),J.children.sort((j,be)=>j.type!==be.type?j.type==="folder"?-1:1:j.name.localeCompare(be.name)),!0;if(J.children){for(const j of J.children)if(w(j))return!0}return!1};w(h)}return{...tt,projectRoot:h,selectedFilePath:$e,testFile:ge,selectedTestIndex:0,editorTab:"test",editingFolderHooks:null}}),Rt.success(`Created: ${q}`)}catch(Ue){console.error("Failed to create file:",Ue),Rt.error("Failed to create file")}})},[R]),ne=Re.useCallback(U=>{if(!U.folderHandle){Rt.error("Cannot create folder: folder handle not available");return}R("Create Folder",[{name:"folderName",label:"Folder name",placeholder:"Enter folder name",required:!0}],async B=>{const ue=B.folderName;if(ue)try{const q=await U.folderHandle.getDirectoryHandle(ue,{create:!0}),Ue=`${U.path}/${ue}`,ge={name:ue,path:Ue,type:"folder",children:[],folderHandle:q};a(me=>{const $e=tt=>{const D={...tt};return tt.children&&(D.children=tt.children.map($e)),D},he=me.projectRoot?$e(me.projectRoot):null;if(he){const tt=D=>{if(D.path===U.path)return D.children||(D.children=[]),D.children.push(ge),D.children.sort((h,w)=>h.type!==w.type?h.type==="folder"?-1:1:h.name.localeCompare(w.name)),!0;if(D.children){for(const h of D.children)if(tt(h))return!0}return!1};tt(he)}return{...me,projectRoot:he}}),Rt.success(`Created folder: ${ue}`)}catch(q){console.error("Failed to create folder:",q),Rt.error("Failed to create folder")}})},[R]),Ie=Re.useCallback(U=>{const B=U.type==="folder",ue=B?U.name:U.name.replace(".testblocks.json","");R(B?"Rename Folder":"Rename File",[{name:"newName",label:"New name",defaultValue:ue,placeholder:"Enter new name",required:!0}],async q=>{var tt;const Ue=(tt=q.newName)==null?void 0:tt.trim();if(!Ue||Ue===ue)return;const ge=U.path.split("/");ge.pop();const me=ge.join("/"),$e=(D,h)=>{if(!D)return null;if(D.path===h)return D;if(D.children)for(const w of D.children){const J=$e(w,h);if(J)return J}return null},he=$e(i.projectRoot,me);if(!(he!=null&&he.folderHandle)){Rt.error("Cannot rename: parent folder handle not available");return}try{if(B){const D=await he.folderHandle.getDirectoryHandle(Ue,{create:!0}),h=async(J,j)=>{for await(const be of J.values())if(be.kind==="file"){const ye=await be.getFile(),Ke=await(await j.getFileHandle(be.name,{create:!0})).createWritable();await Ke.write(await ye.arrayBuffer()),await Ke.close()}else if(be.kind==="directory"){const ye=await j.getDirectoryHandle(be.name,{create:!0});await h(be,ye)}};U.folderHandle&&await h(U.folderHandle,D),await he.folderHandle.removeEntry(U.name,{recursive:!0});const w=`${me}/${Ue}`;a(J=>{var He;const j=Ke=>{if(Ke.path===U.path){const C=(k,M,z)=>{const fe={...k,path:k.path.replace(M,z),name:k.path===U.path?Ue:k.name,folderHandle:k.path===U.path?D:k.folderHandle};return k.children&&(fe.children=k.children.map($=>C($,M,z))),fe};return C(Ke,U.path,w)}return Ke.children?{...Ke,children:Ke.children.map(j)}:Ke},be=J.projectRoot?j(J.projectRoot):null;let ye=J.selectedFilePath;return(He=J.selectedFilePath)!=null&&He.startsWith(U.path+"/")?ye=J.selectedFilePath.replace(U.path,w):J.selectedFilePath===U.path&&(ye=w),{...J,projectRoot:be,selectedFilePath:ye}}),Rt.success(`Renamed to: ${Ue}`)}else{const D=Ue.endsWith(".testblocks.json")?Ue:`${Ue}.testblocks.json`;if(!U.handle){Rt.error("Cannot rename: file handle not available");return}const w=await(await U.handle.getFile()).text(),J=await he.folderHandle.getFileHandle(D,{create:!0}),j=await J.createWritable();await j.write(w),await j.close(),await he.folderHandle.removeEntry(U.name);const be=`${me}/${D}`;a(ye=>{const He=k=>k.path===U.path?{...k,name:D,path:be,handle:J}:k.children?{...k,children:k.children.map(He)}:k,Ke=ye.projectRoot?He(ye.projectRoot):null,C=ye.selectedFilePath===U.path?be:ye.selectedFilePath;return{...ye,projectRoot:Ke,selectedFilePath:C}}),Rt.success(`Renamed to: ${D}`)}}catch(D){console.error("Failed to rename:",D),Rt.error(`Failed to rename: ${D instanceof Error?D.message:"Unknown error"}`)}})},[R,i.projectRoot]),Be=Re.useCallback(U=>{const B=U.type==="folder",ue=B?"folder":"file",q=B?U.name:U.name.replace(".testblocks.json","");if(!confirm(`Are you sure you want to delete the ${ue} "${q}"?${B?`
2193
2193
 
2194
2194
  This will delete all files and subfolders inside it.`:""}`))return;const Ue=U.path.split("/");Ue.pop();const ge=Ue.join("/"),me=(he,tt)=>{if(!he)return null;if(he.path===tt)return he;if(he.children)for(const D of he.children){const h=me(D,tt);if(h)return h}return null},$e=me(i.projectRoot,ge);if(!($e!=null&&$e.folderHandle)){Rt.error("Cannot delete: parent folder handle not available");return}(async()=>{try{await $e.folderHandle.removeEntry(U.name,{recursive:B}),a(he=>{var j;const tt=be=>be.children?{...be,children:be.children.filter(ye=>ye.path!==U.path).map(tt)}:be,D=he.projectRoot?tt(he.projectRoot):null;let h=he.selectedFilePath,w=he.selectedTestIndex,J=he.testFile;return(he.selectedFilePath===U.path||(j=he.selectedFilePath)!=null&&j.startsWith(U.path+"/"))&&(h=null,w=0,J=null),{...he,projectRoot:D,selectedFilePath:h,selectedTestIndex:w,testFile:J}}),Rt.success(`Deleted: ${q}`)}catch(he){console.error("Failed to delete:",he),Rt.error(`Failed to delete: ${he instanceof Error?he.message:"Unknown error"}`)}})()},[i.projectRoot]),ze=Re.useCallback(async(U,B)=>{const ue=U.type==="folder",q=U.path.split("/");q.pop();const Ue=q.join("/"),ge=($e,he)=>{if(!$e)return null;if($e.path===he)return $e;if($e.children)for(const tt of $e.children){const D=ge(tt,he);if(D)return D}return null},me=ge(i.projectRoot,Ue);if(!(me!=null&&me.folderHandle)){Rt.error("Cannot move: source parent folder handle not available");return}if(!B.folderHandle){Rt.error("Cannot move: target folder handle not available");return}try{if(ue){const $e=await B.folderHandle.getDirectoryHandle(U.name,{create:!0}),he=async(D,h)=>{for await(const w of D.values())if(w.kind==="file"){const J=await w.getFile(),be=await(await h.getFileHandle(w.name,{create:!0})).createWritable();await be.write(await J.arrayBuffer()),await be.close()}else if(w.kind==="directory"){const J=await h.getDirectoryHandle(w.name,{create:!0});await he(w,J)}};U.folderHandle&&await he(U.folderHandle,$e),await me.folderHandle.removeEntry(U.name,{recursive:!0});const tt=`${B.path}/${U.name}`;a(D=>{var be;const h=ye=>ye.children?{...ye,children:ye.children.filter(He=>He.path!==U.path).map(h)}:ye,w=ye=>{if(ye.path===B.path){const He=(C,k,M)=>{const z={...C,path:C.path.replace(k,M),folderHandle:C.path===U.path?$e:C.folderHandle};return C.children&&(z.children=C.children.map(fe=>He(fe,k,M))),z},Ke=He(U,U.path,tt);return{...ye,children:[...ye.children||[],Ke].sort((C,k)=>C.type!==k.type?C.type==="folder"?-1:1:C.name.localeCompare(k.name))}}return ye.children?{...ye,children:ye.children.map(w)}:ye};let J=D.projectRoot?h(D.projectRoot):null;J=J?w(J):null;let j=D.selectedFilePath;return(be=D.selectedFilePath)!=null&&be.startsWith(U.path+"/")?j=D.selectedFilePath.replace(U.path,tt):D.selectedFilePath===U.path&&(j=tt),{...D,projectRoot:J,selectedFilePath:j}}),Rt.success(`Moved ${U.name} to ${B.name}`)}else{if(!U.handle){Rt.error("Cannot move: file handle not available");return}const he=await(await U.handle.getFile()).text(),tt=await B.folderHandle.getFileHandle(U.name,{create:!0}),D=await tt.createWritable();await D.write(he),await D.close(),await me.folderHandle.removeEntry(U.name);const h=`${B.path}/${U.name}`;a(w=>{const J=He=>He.children?{...He,children:He.children.filter(Ke=>Ke.path!==U.path).map(J)}:He,j=He=>{if(He.path===B.path){const Ke={...U,path:h,handle:tt};return{...He,children:[...He.children||[],Ke].sort((C,k)=>C.type!==k.type?C.type==="folder"?-1:1:C.name.localeCompare(k.name))}}return He.children?{...He,children:He.children.map(j)}:He};let be=w.projectRoot?J(w.projectRoot):null;be=be?j(be):null;const ye=w.selectedFilePath===U.path?h:w.selectedFilePath;return{...w,projectRoot:be,selectedFilePath:ye}}),Rt.success(`Moved ${U.name} to ${B.name}`)}}catch($e){console.error("Failed to move:",$e),Rt.error(`Failed to move: ${$e instanceof Error?$e.message:"Unknown error"}`)}},[i.projectRoot]),dt=Re.useCallback((U,B,ue,q)=>{a(Ue=>{if(Ue.editingFolderHooks){const me=Ue.editorTab;return me==="test"?Ue:{...Ue,folderHooks:{...Ue.folderHooks,[me]:U.length>0?U:void 0}}}if(Ue.editorTab!=="test")return{...Ue,testFile:{...Ue.testFile,[Ue.editorTab]:U}};const ge=[...Ue.testFile.tests];return ge[Ue.selectedTestIndex]={...ge[Ue.selectedTestIndex],steps:U,...B&&{name:B},...ue!==void 0&&{data:ue.length>0?ue:void 0},...q!==void 0&&{softAssertions:q}},{...Ue,testFile:{...Ue.testFile,tests:ge}}})},[]),it=Re.useCallback(async(U,B)=>{const{selectedMatches:ue,config:q}=U;console.log("[handleReplaceMatches] Processing",ue.length,"matches for blockType:",B);const Ue={name:q.name,description:q.description,params:q.parameters.map(ge=>({name:ge.name,type:ge.fieldType==="number"?"number":"string",default:ge.defaultValue,description:`From ${ge.blockType}.${ge.originalFieldName}`})),steps:q.steps};a(ge=>{if(!ge.projectRoot)return console.log("[handleReplaceMatches] No projectRoot, skipping"),ge;const me=new Map;for(const h of ue){const w=me.get(h.filePath)||[];w.push(h),me.set(h.filePath,w)}console.log("[handleReplaceMatches] Grouped into",me.size,"files");const $e=h=>{const w={...h};return h.testFile&&(w.testFile=JSON.parse(JSON.stringify(h.testFile))),h.children&&(w.children=h.children.map($e)),w.handle=h.handle,w},he=$e(ge.projectRoot);let tt=null;const D=(h,w,J)=>{if(h.type==="file"&&h.path===w&&h.testFile){console.log("[handleReplaceMatches] Updating file:",w,"with",J.length,"matches");const j=new Map;for(const He of J){const Ke=`${He.location}:${He.testCaseId}`,C=j.get(Ke)||[];C.push(He),j.set(Ke,C)}const be=[];for(const He of j.values())He.sort((Ke,C)=>C.startIndex-Ke.startIndex),be.push(...He);console.log("[handleReplaceMatches] Sorted matches:",be.map(He=>`${He.testCaseId}:${He.location}:${He.startIndex}-${He.endIndex}`));let ye=h.testFile;for(const He of be)console.log("[handleReplaceMatches] Applying match:",He.testCaseId,He.location,He.startIndex,"-",He.endIndex),ye=hy(ye,He,B,{});if(ye={...ye,procedures:{...ye.procedures,[q.name]:Ue}},console.log("[handleReplaceMatches] Added procedure to file:",q.name),h.testFile=ye,w===ge.selectedFilePath&&(console.log("[handleReplaceMatches] This is the current file, updating testFile state"),tt=ye),h.handle){const He=h.handle,Ke=ye;(async()=>{try{const C=await He.createWritable();await C.write(JSON.stringify(Ke,null,2)),await C.close(),console.log("[handleReplaceMatches] Saved file:",w)}catch(C){console.error("[handleReplaceMatches] Failed to save file",w,":",C)}})()}else console.log("[handleReplaceMatches] No file handle for:",w,"- file will not be saved to disk");return h}if(h.children)for(const j of h.children){const be=D(j,w,J);if(be)return be}return null};for(const[h,w]of me)D(he,h,w)||console.warn("[handleReplaceMatches] Could not find file in tree:",h);if(ge.selectedFilePath){console.log("[handleReplaceMatches] Updating current file:",ge.selectedFilePath);const h=J=>{if(J.type==="file"&&J.path===ge.selectedFilePath)return J;if(J.children)for(const j of J.children){const be=h(j);if(be)return be}return null},w=h(he);if(w&&w.testFile){const J=ge.testFile.tests[ge.selectedTestIndex],j=w.testFile.tests.map((ye,He)=>He===ge.selectedTestIndex?J:ye),be={...w.testFile,tests:j,...ge.editorTab!=="test"&&ge.editorTab!=="beforeAll"&&{beforeAll:ge.testFile.beforeAll},...ge.editorTab!=="test"&&ge.editorTab!=="afterAll"&&{afterAll:ge.testFile.afterAll},...ge.editorTab!=="test"&&ge.editorTab!=="beforeEach"&&{beforeEach:ge.testFile.beforeEach},...ge.editorTab!=="test"&&ge.editorTab!=="afterEach"&&{afterEach:ge.testFile.afterEach},procedures:{...w.testFile.procedures,[q.name]:Ue}};if(ge.editorTab==="beforeAll"?be.beforeAll=ge.testFile.beforeAll:ge.editorTab==="afterAll"?be.afterAll=ge.testFile.afterAll:ge.editorTab==="beforeEach"?be.beforeEach=ge.testFile.beforeEach:ge.editorTab==="afterEach"&&(be.afterEach=ge.testFile.afterEach),w.testFile=be,tt=be,w.handle){const ye=w.handle;(async()=>{try{const He=await ye.createWritable();await He.write(JSON.stringify(be,null,2)),await He.close(),console.log("[handleReplaceMatches] Saved current file:",ge.selectedFilePath)}catch(He){console.error("[handleReplaceMatches] Failed to save current file:",He)}})()}else console.log("[handleReplaceMatches] No file handle for current file - will not auto-save")}}return{...ge,projectRoot:he,...tt&&{testFile:tt}}})},[]),qe=Re.useCallback(()=>{if(i.editingFolderHooks){const U=i.editorTab;return i.folderHooks[U]||[]}return i.editorTab==="test"?te==null?void 0:te.steps:i.testFile[i.editorTab]||[]},[i.editorTab,i.testFile,i.editingFolderHooks,i.folderHooks,te]),we=Re.useCallback(()=>{const U=i.editingFolderHooks?"Folder ":"";switch(i.editorTab){case"beforeAll":return`${U}Before All`;case"afterAll":return`${U}After All`;case"beforeEach":return`${U}Before Each`;case"afterEach":return`${U}After Each`;default:return(te==null?void 0:te.name)||"Test"}},[i.editorTab,i.editingFolderHooks,te]),Ze=Re.useCallback(async()=>{const U=document.querySelector(".blocklySvg"),B=U==null?void 0:U.workspace,ue=ly(),q={...i.testFile,procedures:{...i.testFile.procedures,...ue},tests:i.testFile.tests.map((he,tt)=>{if(tt===i.selectedTestIndex&&B){const D=ad(B);return{...he,steps:D}}return he})},Ue=op(i.projectRoot,i.selectedFilePath);if(Ue!=null&&Ue.handle)try{const he=await Ue.handle.createWritable();await he.write(JSON.stringify(q,null,2)),await he.close(),Ue.testFile=q,a(tt=>({...tt,testFile:q}));return}catch(he){console.error("Failed to save file:",he)}const ge=new Blob([JSON.stringify(q,null,2)],{type:"application/json"}),me=URL.createObjectURL(ge),$e=document.createElement("a");$e.href=me,$e.download=`${i.testFile.name.toLowerCase().replace(/\s+/g,"-")}.testblocks.json`,$e.click(),URL.revokeObjectURL(me)},[i.testFile,i.selectedTestIndex,i.projectRoot,i.selectedFilePath]),Le=Re.useCallback(()=>{var U;(U=H.current)==null||U.click()},[]),_e=Re.useCallback(U=>{var q;const B=(q=U.target.files)==null?void 0:q[0];if(!B)return;const ue=new FileReader;ue.onload=Ue=>{var ge;try{const me=JSON.parse((ge=Ue.target)==null?void 0:ge.result);me.variables||(me.variables={}),me.procedures?lE(me.procedures):aE(),a($e=>({...$e,testFile:me,selectedTestIndex:0,selectedFilePath:null,results:[],sidebarTab:"tests"}))}catch(me){Rt.error("Failed to load test file: "+me.message)}},ue.readAsText(B),U.target.value=""},[]),ce=Re.useCallback(()=>{const U={id:`test-${Date.now()}`,name:`Test Case ${i.testFile.tests.length+1}`,description:"",steps:[],tags:[]};a(B=>({...B,testFile:{...B.testFile,tests:[...B.testFile.tests,U]},selectedTestIndex:B.testFile.tests.length}))},[i.testFile.tests.length]),xe=Re.useCallback(U=>{if(i.testFile.tests.length<=1){Rt.warning("Cannot delete the last test case");return}a(B=>{const ue=B.testFile.tests.filter((q,Ue)=>Ue!==U);return{...B,testFile:{...B.testFile,tests:ue},selectedTestIndex:Math.min(B.selectedTestIndex,ue.length-1)}})},[i.testFile.tests.length]),se=Re.useCallback(U=>{a(B=>{const ue=[...B.testFile.tests];return ue[U]={...ue[U],disabled:!ue[U].disabled},{...B,testFile:{...B.testFile,tests:ue}}})},[]),ee=Re.useCallback(async()=>{a(U=>({...U,isRunning:!0,runningTestId:null,results:[]}));try{const U=tf(i.projectRoot,i.selectedFilePath),B=await fetch(`/api/run?headless=${i.headless}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({testFile:i.testFile,folderHooks:U.length>0?U:void 0})}),ue=await B.json();if(!B.ok||!Array.isArray(ue)){const ge=ue.message||ue.error||"Unknown error";console.error("Test run failed:",ge),a(me=>({...me,isRunning:!1})),Rt.error(`Test run failed: ${ge}`);return}const q=ue.some(ge=>ge.status!=="passed"),Ue=new Set;ue.forEach(ge=>{ge.status!=="passed"&&Ue.add(ge.testId)}),a(ge=>{const me=new Set(ge.failedFiles),$e=new Map(ge.failedTestsMap);return ge.selectedFilePath&&(q?(me.add(ge.selectedFilePath),$e.set(ge.selectedFilePath,Ue)):(me.delete(ge.selectedFilePath),$e.delete(ge.selectedFilePath))),{...ge,results:ue,isRunning:!1,failedFiles:me,failedTestsMap:$e}})}catch(U){console.error("Failed to run tests:",U),a(B=>({...B,isRunning:!1})),Rt.error("Failed to run tests. Make sure the server is running.")}},[i.testFile,i.headless,i.projectRoot,i.selectedFilePath]),ae=Re.useCallback(async(U,B)=>{B&&B.stopPropagation(),a(ue=>({...ue,isRunning:!0,runningTestId:U,results:[]}));try{const ue=tf(i.projectRoot,i.selectedFilePath),q=await fetch(`/api/run?headless=${i.headless}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({testFile:{...i.testFile,tests:i.testFile.tests.filter(ge=>ge.id===U)},folderHooks:ue.length>0?ue:void 0})}),Ue=await q.json();if(!q.ok||!Array.isArray(Ue)){const ge=Ue.message||Ue.error||"Unknown error";console.error("Test run failed:",ge),a(me=>({...me,isRunning:!1,runningTestId:null})),Rt.error(`Test run failed: ${ge}`);return}a(ge=>{const me=new Set(ge.failedFiles),$e=new Map(ge.failedTestsMap);if(ge.selectedFilePath){const he=new Set($e.get(ge.selectedFilePath)||[]);Ue.forEach(tt=>{tt.status!=="passed"?he.add(tt.testId):he.delete(tt.testId)}),he.size>0?($e.set(ge.selectedFilePath,he),me.add(ge.selectedFilePath)):($e.delete(ge.selectedFilePath),me.delete(ge.selectedFilePath))}return{...ge,results:Ue,isRunning:!1,runningTestId:null,failedFiles:me,failedTestsMap:$e}})}catch(ue){console.error("Failed to run test:",ue),a(q=>({...q,isRunning:!1,runningTestId:null})),Rt.error("Failed to run test. Make sure the server is running.")}},[i.testFile,i.headless,i.projectRoot,i.selectedFilePath]),et=Re.useCallback(async U=>{const B=$e=>{const he=[];if($e.type==="file"&&$e.testFile&&he.push($e),$e.children)for(const tt of $e.children)he.push(...B(tt));return he},ue=B(U);if(ue.length===0){Rt.warning("No test files found in this folder");return}a($e=>({...$e,isRunning:!0,runningTestId:null,results:[]})),Rt.info(`Running ${ue.length} test file(s)...`);const q=[],Ue=new Map,ge=new Map;let me=0;try{for(const tt of ue){if(!tt.testFile)continue;me++,Rt.info(`Running ${tt.name} (${me}/${ue.length})...`);const D=tf(i.projectRoot,tt.path),h=await fetch(`/api/run?headless=${i.headless}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({testFile:tt.testFile,folderHooks:D.length>0?D:void 0})}),w=await h.json();if(h.ok&&Array.isArray(w)){const J=w.map(ye=>({...ye,fileName:tt.name.replace(".testblocks.json","")}));q.push(...J);const j=new Set;w.forEach(ye=>{ye.status!=="passed"&&j.add(ye.testId)});const be=j.size>0;Ue.set(tt.path,be),be&&ge.set(tt.path,j)}else q.push({testId:`file-error-${tt.path}`,testName:`${tt.name} (Error)`,status:"error",duration:0,steps:[],error:{message:w.message||w.error||"Unknown error"},startedAt:new Date().toISOString(),finishedAt:new Date().toISOString(),fileName:tt.name.replace(".testblocks.json","")}),Ue.set(tt.path,!0);a(J=>({...J,results:[...q]}))}const $e=q.filter(tt=>tt.status==="passed").length,he=q.filter(tt=>tt.status==="failed"||tt.status==="error").length;he>0?Rt.error(`Completed: ${$e} passed, ${he} failed`):Rt.success(`All ${$e} tests passed!`),a(tt=>{const D=new Set(tt.failedFiles),h=new Map(tt.failedTestsMap);for(const[w,J]of Ue)if(J){D.add(w);const j=ge.get(w);j&&h.set(w,j)}else D.delete(w),h.delete(w);return{...tt,isRunning:!1,failedFiles:D,failedTestsMap:h}})}catch($e){console.error("Failed to run folder tests:",$e),a(he=>({...he,isRunning:!1,results:q})),Rt.error("Failed to run tests. Make sure the server is running.")}},[i.headless,i.projectRoot]),Ae=Re.useCallback(U=>{a(B=>{const ue=[...B.testFile.tests];return ue[B.selectedTestIndex]={...ue[B.selectedTestIndex],name:U},{...B,testFile:{...B.testFile,tests:ue}}})},[]);Re.useCallback(U=>{a(B=>({...B,testFile:{...B.testFile,name:U}}))},[]),Re.useCallback(()=>{R("Add Variable",[{name:"name",label:"Variable name",placeholder:"Enter variable name",required:!0},{name:"defaultValue",label:"Default value",placeholder:"Enter default value"}],U=>{const B=U.name;B&&a(ue=>({...ue,testFile:{...ue.testFile,variables:{...ue.testFile.variables,[B]:{type:"string",default:U.defaultValue||""}}}}))})},[R]),Re.useCallback((U,B)=>{a(ue=>{var q;return{...ue,testFile:{...ue.testFile,variables:{...ue.testFile.variables,[U]:{...(q=ue.testFile.variables)==null?void 0:q[U],type:"string",default:B}}}}})},[]),Re.useCallback(U=>{a(B=>{const ue={...B.testFile.variables};return delete ue[U],{...B,testFile:{...B.testFile,variables:ue}}})},[]),Re.useCallback((U,B)=>{a(ue=>{if(!ue.globalVariables)return ue;const q=Jy(ue.globalVariables,U,B),Ue={...ue.globalsFileContent,variables:q};return Z.current&&(async()=>{try{const ge=await Z.current.createWritable();await ge.write(JSON.stringify(Ue,null,2)),await ge.close(),console.log("[handleUpdateGlobalVariable] Saved globals.json")}catch(ge){console.error("[handleUpdateGlobalVariable] Failed to save globals.json:",ge)}})(),{...ue,globalVariables:q,globalsFileContent:Ue}})},[]);const lt=Re.useCallback(U=>{const B=zy(U);a(ue=>{const q={...ue.globalsFileContent,variables:B};return Z.current&&(async()=>{try{const Ue=await Z.current.createWritable();await Ue.write(JSON.stringify(q,null,2)),await Ue.close(),console.log("[handleGlobalVariablesChange] Saved globals.json")}catch(Ue){console.error("[handleGlobalVariablesChange] Failed to save globals.json:",Ue)}})(),{...ue,globalVariables:B,globalsFileContent:q}})},[]),Ye=Re.useCallback(U=>{a(B=>{const ue={};for(const q of U)if(q.name.trim()){let Ue=q.value;try{(q.value.startsWith("{")||q.value.startsWith("[")||q.value==="true"||q.value==="false"||!isNaN(Number(q.value))&&q.value!=="")&&(Ue=JSON.parse(q.value))}catch{}ue[q.name]={default:Ue}}return{...B,testFile:{...B.testFile,variables:ue}}})},[]),gt=Re.useCallback((U,B)=>{if(B==="append")a(ue=>{const q=[...ue.testFile.tests],Ue=Array.isArray(q[ue.selectedTestIndex].steps)?q[ue.selectedTestIndex].steps:[];q[ue.selectedTestIndex]={...q[ue.selectedTestIndex],steps:[...Ue,...U]};const ge={...ue.testFile,tests:q},me=op(ue.projectRoot,ue.selectedFilePath);return me!=null&&me.handle&&(async()=>{try{const $e=await me.handle.createWritable();await $e.write(JSON.stringify(ge,null,2)),await $e.close(),console.log("[handleStepsRecorded] Saved recorded steps to:",ue.selectedFilePath)}catch($e){console.error("[handleStepsRecorded] Failed to save:",$e)}})(),{...ue,testFile:ge,showRecordDialog:!1}});else{const q=`recorded-${new Date().toISOString().replace(/[:.]/g,"-").slice(0,19)}.testblocks.json`,Ue={id:`test-${Date.now()}`,name:"Recorded Test",description:"Test recorded from browser actions",steps:U,tags:["recorded"]},ge={version:"1.0.0",name:"Recorded Test Suite",description:`Recorded on ${new Date().toLocaleString()}`,variables:{},tests:[Ue]};a(me=>{var tt;let $e=null,he="";if(me.selectedFilePath&&me.projectRoot){const D=me.selectedFilePath.split("/");D.pop();const h=D.join("/");if(h){const w=op(me.projectRoot,h);w!=null&&w.folderHandle&&($e=w.folderHandle,he=h)}}return!$e&&((tt=me.projectRoot)!=null&&tt.folderHandle)&&($e=me.projectRoot.folderHandle,he=me.projectRoot.path),$e?(async()=>{try{const D=await $e.getFileHandle(q,{create:!0}),h=await D.createWritable();await h.write(JSON.stringify(ge,null,2)),await h.close(),console.log("[handleStepsRecorded] Created new file:",q);const w=he?`${he}/${q}`:q,J={name:q,path:w,type:"file",testFile:ge,handle:D},j=ye=>{const He={...ye};return ye.children&&(He.children=ye.children.map(j)),He},be=me.projectRoot?j(me.projectRoot):null;if(be){const ye=He=>{if(He.path===he||He.path===He.name&&he===He.name)return He.children||(He.children=[]),He.children.push(J),He.children.sort((Ke,C)=>Ke.type!==C.type?Ke.type==="folder"?-1:1:Ke.name.localeCompare(C.name)),!0;if(He.children){for(const Ke of He.children)if(ye(Ke))return!0}return!1};ye(be),a(He=>({...He,projectRoot:be,selectedFilePath:w,testFile:ge,selectedTestIndex:0,editorTab:"test"}))}Rt.success(`Created new test file: ${q}`)}catch(D){console.error("[handleStepsRecorded] Failed to create file:",D),Rt.error("Failed to create test file")}})():Rt.warning("No project folder open. Please open a folder first."),{...me,showRecordDialog:!1}})}},[]),nt=U=>i.results.find(B=>B.testId===U),Ot=Re.useCallback(async()=>{if(i.results.length!==0)try{const U=await fetch("/api/reports/html",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({testFile:i.testFile,results:i.results})});if(!U.ok)throw new Error("Failed to generate report");const B=await U.blob(),ue=U.headers.get("Content-Disposition"),q=ue==null?void 0:ue.match(/filename="(.+)"/),Ue=q?q[1]:"report.html",ge=URL.createObjectURL(B),me=document.createElement("a");me.href=ge,me.download=Ue,me.click(),URL.revokeObjectURL(ge)}catch(U){console.error("Failed to download HTML report:",U),Rt.error("Failed to download HTML report")}},[i.testFile,i.results]),Je=Re.useCallback(async()=>{if(i.results.length!==0)try{const U=await fetch("/api/reports/junit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({testFile:i.testFile,results:i.results})});if(!U.ok)throw new Error("Failed to generate report");const B=await U.blob(),ue=U.headers.get("Content-Disposition"),q=ue==null?void 0:ue.match(/filename="(.+)"/),Ue=q?q[1]:"junit.xml",ge=URL.createObjectURL(B),me=document.createElement("a");me.href=ge,me.download=Ue,me.click(),URL.revokeObjectURL(ge)}catch(U){console.error("Failed to download JUnit report:",U),Rt.error("Failed to download JUnit report")}},[i.testFile,i.results]),Ut=Re.useCallback((U,B,ue)=>{if(B==="global"){const q={...i.globalVariables||{},[ue]:U},Ue={...i.globalsFileContent,variables:q};Z.current&&(async()=>{try{const ge=await Z.current.createWritable();await ge.write(JSON.stringify(Ue,null,2)),await ge.close(),console.log("[handleCreateVariable] Saved globals.json")}catch(ge){console.error("[handleCreateVariable] Failed to save globals.json:",ge)}})(),a(ge=>({...ge,globalVariables:q,globalsFileContent:Ue})),Rt.success(`Created global variable: ${ue}`)}else a(q=>({...q,testFile:{...q.testFile,variables:{...q.testFile.variables,[ue]:{default:U}}}})),Rt.success(`Created file variable: ${ue}`)},[i.globalVariables,i.globalsFileContent]);return E.jsxs("div",{className:"app",children:[E.jsxs("header",{className:"header",children:[E.jsxs("h1",{children:[E.jsx("span",{children:"TestBlocks"}),i.version&&E.jsxs("span",{className:"header-version",children:["v",i.version]}),(i.selectedFilePath||i.editingFolderHooks)&&E.jsxs("span",{className:"header-file-path",children:[i.editingFolderHooks?E.jsxs(E.Fragment,{children:[E.jsx("span",{className:"folder-hooks-label",children:"Folder Hooks:"})," ",i.editingFolderHooks.path]}):i.selectedFilePath,i.autoSaveStatus==="saving"&&E.jsx("span",{className:"auto-save-indicator saving",children:"Saving..."}),i.autoSaveStatus==="saved"&&E.jsx("span",{className:"auto-save-indicator saved",children:"Saved"})]})]}),E.jsxs("div",{className:"header-actions",children:[E.jsx("button",{className:"btn btn-secondary",onClick:()=>a(U=>({...U,showHelpDialog:!0})),title:"Help",children:"Help"}),E.jsx("button",{className:"btn btn-secondary",onClick:Me,children:"Open Folder"}),E.jsx("button",{className:"btn btn-secondary",onClick:Le,children:"Open File"}),E.jsx("button",{className:"btn btn-secondary",onClick:Ze,children:"Save"}),E.jsx("button",{className:"btn btn-secondary",onClick:()=>a(U=>({...U,showRecordDialog:!0})),title:"Record browser actions",children:"Record"}),((Oe=i.globalsFileContent)==null?void 0:Oe.testIdAttribute)&&E.jsxs("span",{className:"test-id-indicator",title:"Test ID Attribute (from globals.json)",children:["TestID: ",E.jsx("code",{children:i.globalsFileContent.testIdAttribute})]}),E.jsxs("label",{className:"headless-toggle",children:[E.jsx("input",{type:"checkbox",checked:i.headless,onChange:U=>{localStorage.setItem("testblocks-headless",String(U.target.checked)),a(B=>({...B,headless:U.target.checked}))}}),E.jsx("span",{children:"Headless"})]}),E.jsx("button",{className:"btn btn-primary",onClick:ee,disabled:i.isRunning,children:i.isRunning&&!i.runningTestId?"Running...":"Run All Tests"})]})]}),E.jsx("input",{ref:H,type:"file",accept:".json,.testblocks.json",style:{display:"none"},onChange:_e}),E.jsx("input",{ref:re,type:"file",accept:".json,.testblocks.json",style:{display:"none"},onChange:Pe,webkitdirectory:"",directory:"",multiple:!0}),E.jsxs("main",{className:"main-content",children:[E.jsxs("aside",{className:`sidebar${i.sidebarCollapsed?" collapsed":""}`,children:[E.jsx("div",{className:"sidebar-toggle-header",children:E.jsx("button",{className:"panel-toggle-btn",onClick:()=>{a(U=>({...U,sidebarCollapsed:!U.sidebarCollapsed})),setTimeout(()=>window.dispatchEvent(new Event("resize")),250)},title:i.sidebarCollapsed?"Expand panel":"Collapse panel",children:i.sidebarCollapsed?"▶":"◀"})}),!i.sidebarCollapsed&&E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"sidebar-tabs",children:[E.jsx("button",{className:`sidebar-tab ${i.sidebarTab==="files"?"active":""}`,onClick:()=>a(U=>({...U,sidebarTab:"files"})),children:"Files"}),E.jsx("button",{className:`sidebar-tab ${i.sidebarTab==="tests"?"active":""}`,onClick:()=>a(U=>({...U,sidebarTab:"tests"})),children:"Tests"})]}),i.sidebarTab==="files"?E.jsxs("div",{className:"sidebar-section file-tree-section",children:[!i.projectRoot&&i.lastFolderName&&E.jsxs("div",{className:"reopen-folder-prompt",children:[E.jsxs("span",{children:["Last folder: ",E.jsx("strong",{children:i.lastFolderName})]}),E.jsx("button",{className:"btn btn-small btn-primary",onClick:De,children:"Reopen"})]}),E.jsx(Py,{root:i.projectRoot,selectedPath:i.selectedFilePath,onSelectFile:ot,onSelectFolder:$t,onRefresh:i.projectRoot?ut:void 0,onCreateFile:Ve,onCreateFolder:ne,onRename:Ie,onDelete:Be,onMove:ze,onRunFolder:et,isRunning:i.isRunning,failedFiles:i.failedFiles})]}):E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"sidebar-section",children:[E.jsx("div",{className:"sidebar-header clickable",onClick:()=>a(U=>({...U,showGlobalVariables:!U.showGlobalVariables})),children:E.jsxs("h2",{children:[E.jsx("span",{style:{marginRight:"8px"},children:i.showGlobalVariables?"▼":"▶"}),"Global Variables",E.jsx("span",{className:"global-badge",title:"From globals.json",children:"🌐"})]})}),i.showGlobalVariables&&E.jsx("div",{className:"variables-list global-variables",style:{padding:"8px"},children:E.jsx(TE,{variables:Xy(i.globalVariables),onChange:lt,title:"",emptyMessage:"No global variables. Add variables here to use across all test files."})})]}),E.jsxs("div",{className:"sidebar-section",children:[E.jsx("div",{className:"sidebar-header clickable",onClick:()=>a(U=>({...U,showVariables:!U.showVariables})),children:E.jsxs("h2",{children:[E.jsx("span",{style:{marginRight:"8px"},children:i.showVariables?"▼":"▶"}),"File Variables"]})}),i.showVariables&&E.jsx("div",{className:"variables-list",style:{padding:"8px"},children:E.jsx(TE,{variables:Object.entries(i.testFile.variables||{}).map(([U,B])=>({name:U,value:typeof B.default=="string"?B.default:JSON.stringify(B.default)})),onChange:Ye,title:"",emptyMessage:"No file variables. Add variables specific to this test file."})})]}),E.jsxs("div",{className:"sidebar-section",children:[E.jsx("div",{className:"sidebar-header",children:E.jsx("h2",{children:"Test Cases"})}),E.jsx("div",{className:"test-list",children:i.testFile.tests.map((U,B)=>{var ge;const ue=nt(U.id),q=i.runningTestId===U.id,Ue=U.disabled===!0;return E.jsxs("div",{className:`test-item ${B===i.selectedTestIndex?"active":""} ${(ue==null?void 0:ue.status)||""} ${Ue?"disabled":""}`,onClick:()=>a(me=>({...me,selectedTestIndex:B,editorTab:"test"})),children:[E.jsxs("div",{className:"test-item-content",children:[E.jsxs("div",{className:"test-item-name",children:[Ue?E.jsx("span",{className:"status-dot skipped",title:"Test is disabled"}):ue?E.jsx("span",{className:`status-dot ${ue.status}`}):i.selectedFilePath&&((ge=i.failedTestsMap.get(i.selectedFilePath))!=null&&ge.has(U.id))?E.jsx("span",{className:"status-dot failed",title:"Failed in previous run"}):null,E.jsx("span",{className:Ue?"test-name-disabled":"",children:U.name}),U.data&&U.data.length>0&&E.jsxs("span",{className:"data-driven-badge",title:`Data-driven: ${U.data.length} iterations`,children:["×",U.data.length]})]}),E.jsxs("div",{className:"test-item-steps",children:[Array.isArray(U.steps)?U.steps.length:0," steps"]})]}),E.jsx("button",{className:"btn-run-test",onClick:me=>ae(U.id,me),disabled:i.isRunning||Ue,title:Ue?"Test is disabled":"Run this test",children:q?"...":"▶"})]},U.id)})}),E.jsx("button",{className:"add-test-btn",onClick:ce,children:"+ Add Test Case"})]})]})]})]}),E.jsxs("div",{className:"editor-area",children:[E.jsxs("div",{className:"editor-tabs",children:[E.jsxs("button",{className:`editor-tab ${i.editorTab==="beforeAll"?"active":""}`,onClick:()=>a(U=>({...U,editorTab:"beforeAll"})),children:["Before All",i.editingFolderHooks?i.folderHooks.beforeAll&&i.folderHooks.beforeAll.length>0&&E.jsx("span",{className:"tab-badge",children:i.folderHooks.beforeAll.length}):i.testFile.beforeAll&&i.testFile.beforeAll.length>0&&E.jsx("span",{className:"tab-badge",children:i.testFile.beforeAll.length})]}),E.jsxs("button",{className:`editor-tab ${i.editorTab==="beforeEach"?"active":""}`,onClick:()=>a(U=>({...U,editorTab:"beforeEach"})),children:["Before Each",i.editingFolderHooks?i.folderHooks.beforeEach&&i.folderHooks.beforeEach.length>0&&E.jsx("span",{className:"tab-badge",children:i.folderHooks.beforeEach.length}):i.testFile.beforeEach&&i.testFile.beforeEach.length>0&&E.jsx("span",{className:"tab-badge",children:i.testFile.beforeEach.length})]}),!i.editingFolderHooks&&E.jsx("button",{className:`editor-tab test-tab ${i.editorTab==="test"?"active":""}`,onClick:()=>a(U=>({...U,editorTab:"test"})),children:"Test Steps"}),E.jsxs("button",{className:`editor-tab ${i.editorTab==="afterEach"?"active":""}`,onClick:()=>a(U=>({...U,editorTab:"afterEach"})),children:["After Each",i.editingFolderHooks?i.folderHooks.afterEach&&i.folderHooks.afterEach.length>0&&E.jsx("span",{className:"tab-badge",children:i.folderHooks.afterEach.length}):i.testFile.afterEach&&i.testFile.afterEach.length>0&&E.jsx("span",{className:"tab-badge",children:i.testFile.afterEach.length})]}),E.jsxs("button",{className:`editor-tab ${i.editorTab==="afterAll"?"active":""}`,onClick:()=>a(U=>({...U,editorTab:"afterAll"})),children:["After All",i.editingFolderHooks?i.folderHooks.afterAll&&i.folderHooks.afterAll.length>0&&E.jsx("span",{className:"tab-badge",children:i.folderHooks.afterAll.length}):i.testFile.afterAll&&i.testFile.afterAll.length>0&&E.jsx("span",{className:"tab-badge",children:i.testFile.afterAll.length})]})]}),E.jsx("div",{className:"editor-toolbar",children:i.editorTab==="test"&&!i.editingFolderHooks?E.jsxs(E.Fragment,{children:[E.jsx("input",{type:"text",className:"test-name-input",value:(te==null?void 0:te.name)||"",onChange:U=>Ae(U.target.value),placeholder:"Test name"}),E.jsx("button",{className:"btn btn-success",onClick:()=>ae(te==null?void 0:te.id),disabled:i.isRunning||(te==null?void 0:te.disabled),style:{padding:"6px 12px",fontSize:"12px",marginRight:"8px"},title:te!=null&&te.disabled?"Test is disabled":"Run this test",children:i.runningTestId===(te==null?void 0:te.id)?"Running...":"Run Test"}),E.jsx("button",{className:`btn ${te!=null&&te.disabled?"btn-success":"btn-warning"}`,onClick:()=>se(i.selectedTestIndex),style:{padding:"6px 12px",fontSize:"12px",marginRight:"8px"},title:te!=null&&te.disabled?"Enable this test":"Disable this test",children:te!=null&&te.disabled?"Enable":"Disable"}),E.jsx("button",{className:"btn btn-danger",onClick:()=>xe(i.selectedTestIndex),style:{padding:"6px 12px",fontSize:"12px"},children:"Delete"})]}):E.jsxs("div",{className:"lifecycle-toolbar-info",children:[E.jsx("span",{className:"lifecycle-icon",children:i.editingFolderHooks?"📁":"⚡"}),E.jsx("span",{children:we()}),E.jsx("span",{className:"lifecycle-hint",children:i.editingFolderHooks?E.jsxs(E.Fragment,{children:["— Applies to all tests in this folder",i.editorTab==="beforeAll"||i.editorTab==="afterAll"?"":" and subfolders"]}):E.jsxs(E.Fragment,{children:[i.editorTab==="beforeAll"&&"— Runs once before all tests",i.editorTab==="afterAll"&&"— Runs once after all tests",i.editorTab==="beforeEach"&&"— Runs before each test",i.editorTab==="afterEach"&&"— Runs after each test"]})})]})}),E.jsx("div",{className:"blockly-container",children:E.jsx(wy,{onWorkspaceChange:dt,onReplaceMatches:it,onCreateVariable:Ut,initialSteps:qe(),testName:i.editorTab==="test"?te==null?void 0:te.name:we(),lifecycleType:i.editorTab!=="test"?i.editorTab:void 0,testData:i.editorTab==="test"?te==null?void 0:te.data:void 0,softAssertions:i.editorTab==="test"?te==null?void 0:te.softAssertions:void 0,projectRoot:i.projectRoot,currentFilePath:i.selectedFilePath||void 0},`${i.editorTab}-${i.editorTab==="test"?te==null?void 0:te.id:"lifecycle"}-${i.selectedFilePath||((We=i.editingFolderHooks)==null?void 0:We.path)}-${i.pluginsLoaded}`)})]}),E.jsxs("aside",{className:`results-panel${i.resultsPanelCollapsed?" collapsed":""}`,children:[E.jsxs("div",{className:"results-header",children:[E.jsx("button",{className:"panel-toggle-btn",onClick:()=>{a(U=>({...U,resultsPanelCollapsed:!U.resultsPanelCollapsed})),setTimeout(()=>window.dispatchEvent(new Event("resize")),250)},title:i.resultsPanelCollapsed?"Expand panel":"Collapse panel",children:i.resultsPanelCollapsed?"◀":"▶"}),!i.resultsPanelCollapsed&&E.jsxs(E.Fragment,{children:[E.jsxs("h2",{children:["Results",i.results.length>0&&E.jsxs("span",{className:"results-summary",children:[E.jsxs("span",{className:"passed-count",children:[i.results.filter(U=>U.status==="passed").length," passed"]}),i.results.filter(U=>U.status==="failed"||U.status==="error").length>0&&E.jsxs("span",{className:"failed-count",children:[i.results.filter(U=>U.status==="failed"||U.status==="error").length," failed"]})]})]}),i.results.length>0&&E.jsxs("div",{className:"results-actions",children:[E.jsx("button",{className:"btn-report",onClick:Ot,title:"Download HTML Report",children:"HTML"}),E.jsx("button",{className:"btn-report",onClick:Je,title:"Download JUnit XML Report",children:"xUnit"})]})]})]}),!i.resultsPanelCollapsed&&E.jsx("div",{className:"results-content",children:i.results.length===0?E.jsxs("div",{className:"empty-state",children:[E.jsx("h3",{children:"No results yet"}),E.jsx("p",{children:"Run your tests to see results here"})]}):i.results.map(U=>E.jsxs("div",{className:`result-item ${U.status}${U.isLifecycle?" lifecycle":""}`,children:[E.jsxs("div",{className:"result-test-header",children:[E.jsx("span",{className:`status-indicator ${U.status}`}),U.isLifecycle&&E.jsx("span",{className:"lifecycle-badge",children:U.lifecycleType}),U.fileName&&E.jsxs("span",{className:"result-file-name",children:[U.fileName," /"]}),E.jsx("span",{className:"result-test-name",children:U.testName}),E.jsxs("span",{className:"result-duration",children:[U.duration,"ms"]})]}),U.error&&E.jsx("div",{className:"result-error",children:U.error.message}),U.steps&&U.steps.length>0&&E.jsx("div",{className:"result-steps",children:U.steps.map((B,ue)=>E.jsx(Dy,{step:B},B.stepId||ue))})]},U.testId))})]})]}),E.jsx(By,{isOpen:i.showHelpDialog,onClose:()=>a(U=>({...U,showHelpDialog:!1}))}),E.jsx(Vy,{isOpen:i.showRecordDialog,onClose:()=>a(U=>({...U,showRecordDialog:!1})),onStepsRecorded:gt}),v&&E.jsx(Hy,{isOpen:v.isOpen,title:v.title,fields:v.fields,onSubmit:U=>{v.onSubmit(U),V()},onCancel:V}),E.jsx(Ty,{toasts:f,onDismiss:g})]})}function tf(f,g){if(!f||!g)return[];function i(a,v,A){const R=a.folderHooks?[...A,a.folderHooks]:A;if(a.children)for(const V of a.children){if(V.type==="file"&&V.path===v)return R;if(V.type==="folder"){const H=i(V,v,R);if(H!==null)return H}}return null}return i(f,g,[])||[]}kT.createRoot(document.getElementById("root")).render(E.jsx(NT.StrictMode,{children:E.jsx(Zy,{})}));
2195
- //# sourceMappingURL=index-Ivy7T1Qk.js.map
2195
+ //# sourceMappingURL=index-BCKY2YTp.js.map