<workflow wfd_version="1.0" critical="false" reporting="true" id="component_db492073-4201-49c0-b87b-c4cd2f8ab97f" descriptor="Workflow Template" startstep="start" name="Revisión Diagrama" layoutCatalogName="9b9ea1ef-35ec-4f9c-b6f0-d12949e12a47">
  <rules>
    <rule _class=".RulePojo" id="exit_component">
      <expression>#{event(MENU_SELECTION):command} == 'RETURN' || #{event(MENU_SELECTION):command} == 'CONTINUE'</expression>
      <actions>
        <action _class=".ActionRefPojo" ref="finish"/>
      </actions>
    </rule>
    <rule _class=".RulePojo" id="info_menu">
      <expression>#{event(MENU_SELECTION):command} == 'MENU' || #{event:command} == 'INFO'</expression>
      <actions>
        <action _class=".ActionRefPojo" ref="start_info"/>
      </actions>
    </rule>
  </rules>
  <actions>
    <start_workflow _class=".ActionPojo" id="start_info" wf="info_menu"/>
    <finish_workflow _class=".ActionPojo" id="finish">
      <output>
        <param name="selected_button" type="string">#{event:command}</param>
      </output>
    </finish_workflow>
    <action _class=".ActionPojo" id="speech_add_go_to_page" type="speech_modify_commands_in_grammar">
      <param name="grammar">xGuide</param>
      <param name="slot">wf_editor_slot</param>
      <param name="modification">add_commands</param>
      <param name="commands">?{
                    var cmds = [];
                    var i;
                    for(i = 1; i &lt;= event.PAGE_COUNT; i++){
                        cmds.push("ANDRRES_go_to_page " + i);
                    }
                    cmds}?
                </param>
      <param name="reset_before" type="bool">false</param>
    </action>
    <action _class=".ActionPojo" id="speech_add_commands" type="speech_modify_commands_in_grammar">
      <param name="grammar">xGuide</param>
      <param name="slot">wf_editor_slot</param>
      <param name="modification">add_commands</param>
      <param name="commands">?{
                    var cmds = [];
                    var i;

                    cmds.push({ 'name': 'ANDRRES_freeze', 'description': 'ANDRRES_freeze'});
                    cmds.push({ 'name': 'ANDRRES_move', 'description': 'ANDRRES_move'});
                    cmds.push({ 'name': 'ANDRRES_show_preview', 'description': 'ANDRRES_show_preview'});
                    cmds.push({ 'name': 'ANDRRES_hide_preview', 'description': 'ANDRRES_hide_preview'});
                    cmds.push({ 'name': 'ANDRRES_next_page', 'description': 'ANDRRES_next_page'});
                    cmds.push({ 'name': 'ANDRRES_previous_page', 'description': 'ANDRRES_previous_page'});

                    for(i = 1; i &lt;= 5; i++){
                        cmds.push({ 'name': "ANDRRES_zoom_level " + i, 'description': `ANDRRES_zoom_level [1-5]`});
                    }

                    for(i = 1; i &lt;= 20; i++){
                        var j;
                        cmds.push({ 'name': 'ANDRRES_zoom_factor ' + i, 'description': `ANDRRES_zoom_factor [1.0-20.0]`});
                        for(j = 1; j &lt;= 9; j++){
                            cmds.push({ 'name': 'ANDRRES_zoom_factor ' + i + "." + j, 'description': `ANDRRES_zoom_factor [1.0-20.0]`});
                        }
                    }
                    cmds
            }?</param>
      <param name="reset_before" type="bool">false</param>
    </action>
    <action _class=".ActionPojo" id="speech_remove_commands" type="speech_modify_commands_in_grammar">
      <param name="grammar">xGuide</param>
      <param name="slot">wf_editor_slot</param>
      <param name="modification">remove_commands</param>
      <param name="commands">?{
                    var cmds = [];
                    var i;

                    cmds.push({ 'name': 'ANDRRES_freeze', 'description': 'ANDRRES_freeze'});
                    cmds.push({ 'name': 'ANDRRES_move', 'description': 'ANDRRES_move'});
                    cmds.push({ 'name': 'ANDRRES_show_preview', 'description': 'ANDRRES_show_preview'});
                    cmds.push({ 'name': 'ANDRRES_hide_preview', 'description': 'ANDRRES_hide_preview'});
                    cmds.push({ 'name': 'ANDRRES_next_page', 'description': 'ANDRRES_next_page'});
                    cmds.push({ 'name': 'ANDRRES_previous_page', 'description': 'ANDRRES_previous_page'});

                    for(i = 1; i &lt;= 5; i++){
                        cmds.push({ 'name': "ANDRRES_zoom_level " + i, 'description': `ANDRRES_zoom_level [1-5]`});
                    }

                    for(i = 1; i &lt;= 20; i++){
                        var j;
                        cmds.push({ 'name': 'ANDRRES_zoom_factor ' + i, 'description': `ANDRRES_zoom_factor [1.0-20.0]`});
                        for(j = 1; j &lt;= 9; j++){
                            cmds.push({ 'name': 'ANDRRES_zoom_factor ' + i + "." + j, 'description': `ANDRRES_zoom_factor [1.0-20.0]`});
                        }
                    }
                    cmds
            }?</param>
      <param name="reset_before" type="bool">false</param>
    </action>
    <action _class=".ActionPojo" id="zoom_factor_mapping_action_add" type="speech_word_mapping">
      <param name="action">add</param>
      <param name="input">ANDRRES_zoom_factor ([1-9].*)</param>
      <param name="output">ZOOM FACTOR $1</param>
      <param name="is_regex">true</param>
      <param name="sub_mapping">1</param>
    </action>
    <action _class=".ActionPojo" id="zoom_factor_mapping_action_remove" type="speech_word_mapping">
      <param name="action">remove</param>
      <param name="input">ANDRRES_zoom_factor ([1-9].*)</param>
      <param name="output">ZOOM FACTOR $1</param>
      <param name="is_regex">true</param>
      <param name="sub_mapping">1</param>
    </action>
    <action _class=".ActionPojo" id="go_to_page_mapping_action_add" type="speech_word_mapping">
      <param name="action">add</param>
      <param name="input">ANDRRES_go_to_page ([0-9]+)</param>
      <param name="output">GO TO PAGE $1</param>
      <param name="is_regex">true</param>
      <param name="sub_mapping">1</param>
    </action>
    <action _class=".ActionPojo" id="go_to_page_mapping_action_remove" type="speech_word_mapping">
      <param name="action">remove</param>
      <param name="input">ANDRRES_go_to_page ([0-9]+)</param>
      <param name="output">GO TO PAGE $1</param>
      <param name="is_regex">true</param>
      <param name="sub_mapping">1</param>
    </action>
    <action _class=".ActionPojo" id="zoom_level_mapping_action_add" type="speech_word_mapping">
      <param name="action">add</param>
      <param name="input">ANDRRES_zoom_level ([1-5])</param>
      <param name="output">ZOOM LEVEL $1</param>
      <param name="is_regex">true</param>
      <param name="sub_mapping">1</param>
    </action>
    <action _class=".ActionPojo" id="zoom_level_mapping_action_remove" type="speech_word_mapping">
      <param name="action">remove</param>
      <param name="input">ANDRRES_zoom_level ([1-5])</param>
      <param name="output">ZOOM LEVEL $1</param>
      <param name="is_regex">true</param>
      <param name="sub_mapping">1</param>
    </action>
    <action _class=".ActionPojo" id="add_speech_action_freeze" type="speech_word_mapping">
      <param name="action">add</param>
      <param name="input">ANDRRES_freeze</param>
      <param name="output">FREEZE</param>
      <param name="is_regex">false</param>
    </action>
    <action _class=".ActionPojo" id="remove_speech_action_freeze" type="speech_word_mapping">
      <param name="action">remove</param>
      <param name="input">ANDRRES_freeze</param>
      <param name="output">MOVE</param>
      <param name="is_regex">false</param>
    </action>
    <action _class=".ActionPojo" id="add_speech_action_move" type="speech_word_mapping">
      <param name="action">add</param>
      <param name="input">ANDRRES_move</param>
      <param name="output">MOVE</param>
      <param name="is_regex">false</param>
    </action>
    <action _class=".ActionPojo" id="remove_speech_action_move" type="speech_word_mapping">
      <param name="action">remove</param>
      <param name="input">ANDRRES_move</param>
      <param name="output">MOVE</param>
      <param name="is_regex">false</param>
    </action>
    <action _class=".ActionPojo" id="add_speech_action_show_preview" type="speech_word_mapping">
      <param name="action">add</param>
      <param name="input">ANDRRES_show_preview</param>
      <param name="output">SHOW PREVIEW</param>
      <param name="is_regex">false</param>
    </action>
    <action _class=".ActionPojo" id="remove_speech_action_show_preview" type="speech_word_mapping">
      <param name="action">remove</param>
      <param name="input">ANDRRES_show_preview</param>
      <param name="output">SHOW PREVIEW</param>
      <param name="is_regex">false</param>
    </action>
    <action _class=".ActionPojo" id="add_speech_action_hide_preview" type="speech_word_mapping">
      <param name="action">add</param>
      <param name="input">ANDRRES_hide_preview</param>
      <param name="output">HIDE PREVIEW</param>
      <param name="is_regex">false</param>
    </action>
    <action _class=".ActionPojo" id="remove_speech_action_hide_preview" type="speech_word_mapping">
      <param name="action">remove</param>
      <param name="input">ANDRRES_hide_preview</param>
      <param name="output">HIDE PREVIEW</param>
      <param name="is_regex">false</param>
    </action>
    <action _class=".ActionPojo" id="add_speech_action_next_page" type="speech_word_mapping">
      <param name="action">add</param>
      <param name="input">ANDRRES_next_page</param>
      <param name="output">NEXT PAGE</param>
      <param name="is_regex">false</param>
    </action>
    <action _class=".ActionPojo" id="remove_speech_action_next_page" type="speech_word_mapping">
      <param name="action">remove</param>
      <param name="input">ANDRRES_next_page</param>
      <param name="output">NEXT PAGE</param>
      <param name="is_regex">false</param>
    </action>
    <action _class=".ActionPojo" id="add_speech_action_previous_page" type="speech_word_mapping">
      <param name="action">add</param>
      <param name="input">ANDRRES_previous_page</param>
      <param name="output">PREVIOUS PAGE</param>
      <param name="is_regex">false</param>
    </action>
    <action _class=".ActionPojo" id="remove_speech_action_previous_page" type="speech_word_mapping">
      <param name="action">remove</param>
      <param name="input">ANDRRES_previous_page</param>
      <param name="output">PREVIOUS PAGE</param>
      <param name="is_regex">false</param>
    </action>
  </actions>
  <steps>
    <step id="start" descriptor="step" uitemplate="DOCUMENT_VIEW">
      <states>
        <onresume>
          <rule _class=".RulePojo" id="always_fire">
            <expression>1</expression>
            <actions>
              <action _class=".ActionRefPojo" ref="speech_add_commands"/>
              <action _class=".ActionRefPojo" ref="zoom_factor_mapping_action_add"/>
              <action _class=".ActionRefPojo" ref="go_to_page_mapping_action_add"/>
              <action _class=".ActionRefPojo" ref="zoom_level_mapping_action_add"/>
              <action _class=".ActionRefPojo" ref="add_speech_action_freeze"/>
              <action _class=".ActionRefPojo" ref="add_speech_action_move"/>
              <action _class=".ActionRefPojo" ref="add_speech_action_show_preview"/>
              <action _class=".ActionRefPojo" ref="add_speech_action_hide_preview"/>
              <action _class=".ActionRefPojo" ref="add_speech_action_next_page"/>
              <action _class=".ActionRefPojo" ref="add_speech_action_previous_page"/>
              <ui_update _class=".ActionPojo" id="738b5488-96a5-46b1-bf5f-323561800946">
                <widget_params>
                  <map name="DOCUMENT">
                    <param name="zoomlevel">2</param>
                    <param name="previewvisible">true</param>
                    <param name="isfrozen">false</param>
                    <param name="previewgravity">TOP_LEFT</param>
                    <param name="moveinzoomlevel1">true</param>
                    <param name="content">xai:/wf-editor/e71379d6-7009-4ff9-99f2-ac6446029cf3/component_db492073-4201-49c0-b87b-c4cd2f8ab97f_Schematic+-+ASUS+FX506LI+FX506LH+FX706LI+N18P-G62+G61+P.pdf?version=1</param>
                    <param name="startpage">1</param>
                  </map>
                </widget_params>
              </ui_update>
            </actions>
          </rule>
        </onresume>
        <onevent>
          <rule _class=".RulePojo" id="zoom_level">
            <expression>startsWith(#{event:command}, 'ZOOM LEVEL')</expression>
            <actions>
              <ui_update _class=".ActionPojo" id="35df226c-a9fe-4700-b4a3-74fdda963b0d">
                <widget_params>
                  <map name="DOCUMENT">
                    <param name="zoomlevel">#{event:command}</param>
                  </map>
                </widget_params>
              </ui_update>
            </actions>
          </rule>
          <rule _class=".RulePojo" id="zoom_factor">
            <expression>startsWith(#{event:command}, 'ZOOM FACTOR')</expression>
            <actions>
              <ui_update _class=".ActionPojo" id="682b75e7-cc0d-448a-a661-a3341fccb312">
                <widget_params>
                  <map name="DOCUMENT">
                    <param name="zoomfactor">#{event:command}</param>
                  </map>
                </widget_params>
              </ui_update>
            </actions>
          </rule>
          <rule _class=".RulePojo" id="freeze">
            <expression>#{event:command} == 'FREEZE'</expression>
            <actions>
              <ui_update _class=".ActionPojo" id="09b688ae-f891-4c9e-a4fa-96b503850640">
                <widget_params>
                  <map name="DOCUMENT">
                    <param name="isfrozen">true</param>
                  </map>
                </widget_params>
              </ui_update>
            </actions>
          </rule>
          <rule _class=".RulePojo" id="move">
            <expression>#{event(SPEECH):command} == 'MOVE'</expression>
            <actions>
              <ui_update _class=".ActionPojo" id="0ff4082d-d346-4b9f-b1c1-24c15ef27564">
                <widget_params>
                  <map name="DOCUMENT">
                    <param name="isfrozen">false</param>
                  </map>
                </widget_params>
              </ui_update>
            </actions>
          </rule>
          <rule _class=".RulePojo" id="next_pdf_page">
            <expression>#{event(SPEECH):command} == 'NEXT PAGE' || #{event(SPEECH):command} == 'NEXT_PAGE'</expression>
            <actions>
              <ui_update _class=".ActionPojo" id="d41c07b2-b4e4-449e-a87f-b4d2737edb29">
                <widget_params>
                  <map name="DOCUMENT">
                    <param name="navigate">NEXT PAGE</param>
                  </map>
                </widget_params>
              </ui_update>
            </actions>
          </rule>
          <rule _class=".RulePojo" id="previous_pdf_page">
            <expression>#{event(SPEECH):command} == 'PREVIOUS PAGE' || #{event(SPEECH):command} == 'PREVIOUS_PAGE'</expression>
            <actions>
              <ui_update _class=".ActionPojo" id="d07aebbc-d685-4047-8200-ca05f6867d32">
                <widget_params>
                  <map name="DOCUMENT">
                    <param name="navigate">PREVIOUS PAGE</param>
                  </map>
                </widget_params>
              </ui_update>
            </actions>
          </rule>
          <rule _class=".RulePojo" id="go_to_pdf_page">
            <expression>startsWith(#{event:command}, 'GO TO PAGE')</expression>
            <actions>
              <ui_update _class=".ActionPojo" id="40c390f9-ac15-4638-a015-615239478866">
                <widget_params>
                  <map name="DOCUMENT">
                    <param name="navigate">?{
                                        var cmd = event.command;
                                        var result = cmd.match(/\d+/);
                                        var final = "GO TO PAGE " + result[0];
                                        final
                                        }?</param>
                  </map>
                </widget_params>
              </ui_update>
            </actions>
          </rule>
          <rule _class=".RulePojo" id="page_count">
            <expression>#{event(INPUT_EVENT):command} == 'PAGE_COUNT'</expression>
            <actions>
              <action _class=".ActionRefPojo" ref="speech_add_go_to_page"/>
            </actions>
          </rule>
          <rule _class=".RulePojo" id="show_preview">
            <expression>#{event(SPEECH):command} == 'SHOW PREVIEW'</expression>
            <actions>
              <ui_update _class=".ActionPojo" id="20f73798-40fa-480c-8199-716eec854385">
                <widget_params>
                  <map name="DOCUMENT">
                    <param name="previewvisible">true</param>
                  </map>
                </widget_params>
              </ui_update>
            </actions>
          </rule>
          <rule _class=".RulePojo" id="hide_preview">
            <expression>#{event(SPEECH):command} == 'HIDE PREVIEW'</expression>
            <actions>
              <ui_update _class=".ActionPojo" id="ed792e87-48f0-436a-bb18-a3bef213da9d">
                <widget_params>
                  <map name="DOCUMENT">
                    <param name="previewvisible">false</param>
                  </map>
                </widget_params>
              </ui_update>
            </actions>
          </rule>
          <rule _class=".RuleRefPojo" ref="info_menu"/>
          <rule _class=".RuleRefPojo" ref="exit_component"/>
        </onevent>
        <onpause>
          <rule _class=".RulePojo" id="always_fire">
            <expression>1</expression>
            <actions>
              <action _class=".ActionRefPojo" ref="speech_remove_commands"/>
              <action _class=".ActionRefPojo" ref="zoom_factor_mapping_action_add"/>
              <action _class=".ActionRefPojo" ref="go_to_page_mapping_action_add"/>
              <action _class=".ActionRefPojo" ref="zoom_level_mapping_action_add"/>
              <action _class=".ActionRefPojo" ref="remove_speech_action_freeze"/>
              <action _class=".ActionRefPojo" ref="remove_speech_action_move"/>
              <action _class=".ActionRefPojo" ref="remove_speech_action_show_preview"/>
              <action _class=".ActionRefPojo" ref="remove_speech_action_hide_preview"/>
              <action _class=".ActionRefPojo" ref="remove_speech_action_next_page"/>
              <action _class=".ActionRefPojo" ref="remove_speech_action_previous_page"/>
            </actions>
          </rule>
        </onpause>
      </states>
      <mapping>
        <ui_element name="RETURN">
          <param name="menu_id">0</param>
        </ui_element>
        <ui_element name="CONTINUE">
          <param name="menu_id">1</param>
        </ui_element>
        <ui_element name="MORE">
          <param name="menu_id">2</param>
        </ui_element>
        <ui_element name="DOCUMENTATION">
          <param name="menu_id">3</param>
        </ui_element>
        <ui_element name="ASSIST">
          <param name="menu_id">4</param>
        </ui_element>
        <ui_element name="PAUSE_TASK">
          <param name="menu_id">5</param>
        </ui_element>
        <ui_element name="CANCEL_TASK">
          <param name="menu_id">6</param>
        </ui_element>
      </mapping>
      <context>
        <param name="more_button_pause_task" type="bool">true</param>
        <param name="more_button_cancel_task" type="bool">true</param>
        <param name="more_button_documentation" type="bool">true</param>
        <param name="more_button_assist" type="bool">true</param>
      </context>
      <handlers>
        <handler type="MoreButtonStepHandler"/>
      </handlers>
    </step>
  </steps>
</workflow>
