{
  "namespace": "common_tabs",

  "empty_tab_panel": {
    "type": "panel",
    "size": [ 24, 25 ],
    "controls": [
      {
        "img@$tab_icon": {}
      }
    ]
  },

  "empty_tab_content": {
    "type": "panel",
    "size": [ 0, 0 ]
  },

  "tab_image": {
    "type": "image",
    "texture": "$tab_texture"
  },

  "tab_panel": {
    "type": "panel",
    "$tab_content|default": "common_tabs.empty_tab_content",
    "$tab_image|default": "common_tabs.tab_image",

    "controls": [
      {
        "tab_image@$tab_image": {
          "size": [ "100%", "100%" ], // We need to explicitly set the size here.
          "layer": 2
        }
      },
      {
        "tab_content_sizer": {
          "type": "panel",
          "$tab_content_size|default": [ "100% - 4px", "100% - 4px" ],
          "size": "$tab_content_size",
          "controls": [
            {
              "tab_content@$tab_content": {
                "layer": 3
              }
            }
          ]
        }
      }
    ]
  },

  "base_tab": {
    "type": "panel",
    "$unchecked_text_color": "$tab_unchecked_text_color",
    "$unchecked_hover_text_color": "$tab_unchecked_hover_text_color",
    "$unchecked_locked_text_color": "$tab_unchecked_locked_text_color",
    "$unchecked_locked_hover_text_color": "$tab_unchecked_locked_hover_text_color",
    "$checked_text_color": "$tab_checked_text_color",
    "$checked_hover_text_color": "$tab_checked_hover_text_color",
    "$checked_locked_text_color": "$tab_checked_locked_text_color",
    "$checked_locked_hover_text_color": "$tab_checked_locked_hover_text_color",

    "$unchecked_secondary_text_color": "$tab_secondary_unchecked_text_color",
    "$unchecked_hover_secondary_text_color": "$tab_secondary_unchecked_hover_text_color",
    "$unchecked_locked_secondary_text_color": "$tab_secondary_unchecked_locked_text_color",
    "$unchecked_locked_hover_secondary_text_color": "$tab_secondary_unchecked_locked_hover_text_color",
    "$checked_secondary_text_color": "$tab_secondary_checked_text_color",
    "$checked_hover_secondary_text_color": "$tab_secondary_checked_hover_text_color",
    "$checked_locked_secondary_text_color": "$tab_secondary_checked_locked_text_color",
    "$checked_locked_hover_secondary_text_color": "$tab_secondary_checked_locked_hover_text_color",

    "$unchecked_glyph_color": "$tab_unchecked_glyph_color",
    "$unchecked_hover_glyph_color": "$tab_unchecked_hover_glyph_color",
    "$unchecked_locked_glyph_color": "$tab_unchecked_locked_glyph_color",
    "$unchecked_locked_hover_glyph_color": "$tab_unchecked_locked_hover_glyph_color",
    "$checked_glyph_color": "$tab_checked_glyph_color",
    "$checked_hover_glyph_color": "$tab_checked_hover_glyph_color",
    "$checked_locked_glyph_color": "$tab_checked_locked_glyph_color",
    "$checked_locked_hover_glyph_color": "$tab_checked_locked_hover_glyph_color",

    "$tab_view_binding_name|default": "tab",
    "$tab_panel|default": "common_tabs.tab_panel",
    "$is_checked_state|default": false,
    "$is_hover_state|default": false,
    "$tab_ignore_count|default": false,

    "$allow_controller_back_button_mapping|default": false,

    "$top_tab_tts_name|default": "accessibility.tab.tts.title",

    "controls": [
      {
        "$tab_view_binding_name@common.toggle": {
          "$toggle_tts_name": "$top_tab_tts_name",
          "tts_ignore_count": "$tab_ignore_count",
          "$toggle_tts_enabled_binding_type": "global",
          "$toggle_reset_on_focus_lost|default": true,
          "reset_on_focus_lost": "$toggle_reset_on_focus_lost",
          "$allow_controller_back_button_mapping": "$allow_controller_back_button_mapping",

          "controls": [
            {
              "unchecked@$tab_panel": {
                "$text_color": "$unchecked_text_color",
                "$secondary_text_color": "$unchecked_secondary_text_color",
                "$glyph_color": "$unchecked_glyph_color",
                "$tab_texture": "$unchecked_default_image",
                "$tab_state": "unchecked",
                "layer": 1
              }
            },
            {
              "unchecked_hover@$tab_panel": {
                "$text_color": "$unchecked_hover_text_color",
                "$secondary_text_color": "$unchecked_hover_secondary_text_color",
                "$glyph_color": "$unchecked_hover_glyph_color",
                "$tab_texture": "$unchecked_hover_image",
                "$tab_state": "unchecked_hover",
                "$is_hover_state": true,
                "layer": 1
              }
            },
            {
              "unchecked_locked@$tab_panel": {
                "$text_color": "$unchecked_locked_text_color",
                "$secondary_text_color": "$unchecked_locked_secondary_text_color",
                "$glyph_color": "$unchecked_locked_glyph_color",
                "$tab_texture": "$unchecked_locked_image",
                "$tab_state": "unchecked_locked",
                "layer": 1
              }
            },
            {
              "unchecked_locked_hover@$tab_panel": {
                "$text_color": "$unchecked_locked_hover_text_color",
                "$secondary_text_color": "$unchecked_locked_hover_secondary_text_color",
                "$glyph_color": "$unchecked_locked_hover_glyph_color",
                "$tab_texture": "$unchecked_locked_hover_image",
                "$tab_state": "unchecked_locked_hover",
                "layer": 1
              }
            },
            {
              "checked@$tab_panel": {
                "$text_color": "$checked_text_color",
                "$secondary_text_color": "$checked_secondary_text_color",
                "$glyph_color": "$checked_glyph_color",
                "$tab_texture": "$checked_default_image",
                "$tab_state": "checked",
                "$is_checked_state": true,
                "layer": 2
              }
            },
            {
              "checked_hover@$tab_panel": {
                "$text_color": "$checked_hover_text_color",
                "$secondary_text_color": "$checked_hover_secondary_text_color",
                "$glyph_color": "$checked_hover_glyph_color",
                "$tab_texture": "$checked_hover_image",
                "$tab_state": "checked_hover",
                "$is_checked_state": true,
                "$is_hover_state": true,
                "layer": 2
              }
            },
            {
              "checked_locked@$tab_panel": {
                "$text_color": "$checked_locked_text_color",
                "$secondary_text_color": "$checked_locked_secondary_text_color",
                "$glyph_color": "$checked_locked_glyph_color",
                "$tab_texture": "$checked_locked_image",
                "$tab_state": "checked_locked",
                "$is_checked_state": true,
                "layer": 2
              }
            },
            {
              "checked_locked_hover@$tab_panel": {
                "$text_color": "$checked_locked_hover_text_color",
                "$secondary_text_color": "$checked_locked_hover_secondary_text_color",
                "$glyph_color": "$checked_locked_hover_glyph_color",
                "$tab_texture": "$checked_locked_hover_image",
                "$tab_state": "checked_locked_hover",
                "$is_checked_state": true,
                "layer": 2
              }
            }
          ]
        }
      }
    ]
  },

  "tab_top@common_tabs.base_tab": {
    "$is_left_most_tab|default": false,
    "$is_right_most_tab|default": false,

    "variables": [
      {
        "requires": "($is_left_most_tab and not $is_right_most_tab)",
        "$unchecked_default_image": "textures/ui/TabTopBackLeftMost",
        "$unchecked_hover_image": "textures/ui/TabTopBackLeftMostHover",
        "$unchecked_locked_image": "textures/ui/TabTopBackLeftMost",
        "$unchecked_locked_hover_image": "textures/ui/TabTopBackLeftMost",

        "$checked_default_image": "textures/ui/TabTopFrontLeftMost",
        "$checked_hover_image": "textures/ui/TabTopFrontLeftMostHover",
        "$checked_locked_image": "textures/ui/TabTopFrontLeftMost",
        "$checked_locked_hover_image": "textures/ui/TabTopFrontLeftMost"
      },
      {
        "requires": "($is_right_most_tab and not $is_left_most_tab)",
        "$unchecked_default_image": "textures/ui/TabTopBackRightMost",
        "$unchecked_hover_image": "textures/ui/TabTopBackRightMostHover",
        "$unchecked_locked_image": "textures/ui/TabTopBackRightMost",
        "$unchecked_locked_hover_image": "textures/ui/TabTopBackRightMost",

        "$checked_default_image": "textures/ui/TabTopFrontRightMost",
        "$checked_hover_image": "textures/ui/TabTopFrontRightMostHover",
        "$checked_locked_image": "textures/ui/TabTopFrontRightMost",
        "$checked_locked_hover_image": "textures/ui/TabTopFrontRightMost"
      }
    ],

    "$unchecked_default_image": "textures/ui/TabTopBack",
    "$unchecked_hover_image": "textures/ui/TabTopBackHover",
    "$unchecked_locked_image": "textures/ui/TabTopBack",
    "$unchecked_locked_hover_image": "textures/ui/TabTopBack",

    "$checked_default_image|default": "textures/ui/TabTopFront",
    "$checked_hover_image|default": "textures/ui/TabTopFrontHover",
    "$checked_locked_image|default": "textures/ui/TabTopFront",
    "$checked_locked_hover_image|default": "textures/ui/TabTopFront"
  },

  "tab_left@common_tabs.base_tab": {
    "$is_bottom_most_tab|default": false,
    "$is_top_most_tab|default": false,

    "variables": [
      {
        "requires": "($is_bottom_most_tab and not $is_top_most_tab)",
        "$unchecked_default_image": "textures/ui/TabLeftBackBottomMost",
        "$unchecked_hover_image": "textures/ui/TabLeftBackBottomMostHover",
        "$unchecked_locked_image": "textures/ui/TabLeftBackBottomMost",
        "$unchecked_locked_hover_image": "textures/ui/TabLeftBackBottomMost",

        "$checked_default_image": "textures/ui/TabLeftFrontBottomMost",
        "$checked_hover_image": "textures/ui/TabLeftFrontBottomMostHover",
        "$checked_locked_image": "textures/ui/TabLeftFrontBottomMost",
        "$checked_locked_hover_image": "textures/ui/TabLeftFrontBottomMost"
      },
      {
        "requires": "($is_top_most_tab and not $is_bottom_most_tab)",
        "$unchecked_default_image": "textures/ui/TabLeftBackTopMost",
        "$unchecked_hover_image": "textures/ui/TabLeftBackTopMostHover",
        "$unchecked_locked_image": "textures/ui/TabLeftBackTopMost",
        "$unchecked_locked_hover_image": "textures/ui/TabLeftBackTopMost",

        "$checked_default_image": "textures/ui/TabLeftFrontTopMost",
        "$checked_hover_image": "textures/ui/TabLeftFrontTopMostHover",
        "$checked_locked_image": "textures/ui/TabLeftFrontTopMost",
        "$checked_locked_hover_image": "textures/ui/TabLeftFrontTopMost"
      }
    ],


    "$unchecked_default_image": "textures/ui/TabLeftBack",
    "$unchecked_hover_image": "textures/ui/TabLeftBackHover",
    "$unchecked_locked_image": "textures/ui/TabLeftBack",
    "$unchecked_locked_hover_image": "textures/ui/TabLeftBack",

    "$checked_default_image|default": "textures/ui/TabLeftFront",
    "$checked_hover_image|default": "textures/ui/TabLeftFrontHover",
    "$checked_locked_image|default": "textures/ui/TabLeftFront",
    "$checked_locked_hover_image|default": "textures/ui/TabLeftFront"
  },

  "tab_right@common_tabs.base_tab": {
    "$is_bottom_most_tab|default": false,
    "$is_top_most_tab|default": false,

    "variables": [
      {
        "requires": "($is_bottom_most_tab and not $is_top_most_tab)",
        "$unchecked_default_image": "textures/ui/TabRightBackBottomMost",
        "$unchecked_hover_image": "textures/ui/TabRightBackBottomMostHover",
        "$unchecked_locked_image": "textures/ui/TabRightBackBottomMost",
        "$unchecked_locked_hover_image": "textures/ui/TabRightBackBottomMost",

        "$checked_default_image": "textures/ui/TabRightFrontBottomMost",
        "$checked_hover_image": "textures/ui/TabRightFrontBottomMostHover",
        "$checked_locked_image": "textures/ui/TabRightFrontBottomMost",
        "$checked_locked_hover_image": "textures/ui/TabRightFrontBottomMost"
      },
      {
        "requires": "($is_top_most_tab and not $is_bottom_most_tab)",
        "$unchecked_default_image": "textures/ui/TabRightBackTopMost",
        "$unchecked_hover_image": "textures/ui/TabRightBackTopMostHover",
        "$unchecked_locked_image": "textures/ui/TabRightBackTopMost",
        "$unchecked_locked_hover_image": "textures/ui/TabRightBackTopMost",

        "$checked_default_image": "textures/ui/TabRightFrontTopMost",
        "$checked_hover_image": "textures/ui/TabRightFrontTopMostHover",
        "$checked_locked_image": "textures/ui/TabRightFrontTopMost",
        "$checked_locked_hover_image": "textures/ui/TabRightFrontTopMost"
      }
    ],

    "$unchecked_default_image": "textures/ui/TabRightBack",
    "$unchecked_hover_image": "textures/ui/TabRightBackHover",
    "$unchecked_locked_image": "textures/ui/TabRightBack",
    "$unchecked_locked_hover_image": "textures/ui/TabRightBack",

    "$checked_default_image|default": "textures/ui/TabRightFront",
    "$checked_hover_image|default": "textures/ui/TabRightFrontHover",
    "$checked_locked_image|default": "textures/ui/TabRightFront",
    "$checked_locked_hover_image|default": "textures/ui/TabRightFront"
  },

  "tab_wait_anim": {
    "anim_type": "wait",
    "duration": 0.8,
    "next": "@crafting_pocket.tab_offset_anim"
  },

  "tab_offset_anim": {
    "$top_tab_anim_start|default": [ 31, 0 ],
    "$top_tab_anim_end|default": [ 0, 0 ],
    "anim_type": "offset",
    "easing": "out_cubic",
    "from": "$top_tab_anim_start",
    "to": "$top_tab_anim_end",
    "duration": 0.5
  },

  //---------------------------------------------------------------------------
  // Pocket Tabs
  //---------------------------------------------------------------------------

  "pocket_empty_tab_panel": {
    "type": "panel",
    "size": [ 35, 33 ],
    "controls": [
      { "$tab_icon@$tab_icon": {} }
    ]
  },

  "pocket_tab_left@common_tabs.tab_left": {
    "size": [ "100%", 33 ],
    "$toggle_focus_enabled": false,
    "$toggle_name": "left_navigation_tab"
  },

  "pocket_left_tab_v2@common_tabs.tab_left": { // used by furnace and crafting screens
    "anchor_from": "center",
    "anchor_to": "center",
    "alpha": 0.2,
    "$anims|default": [],
    "anims": "$anims",
    "$offset|default": [ 0, 0 ],
    "offset": "$offset",
    "$toggle_focus_enabled": false,
    "$toggle_name": "navigation_tab",
    "$tab_content": "common_tabs.pocket_empty_tab_panel"
  },

  "pocket_tab_right@common_tabs.tab_right": {
    "size": [ "100%", 33 ],
    "$toggle_focus_enabled": false,
    "$toggle_name": "right_navigation_tab"
  },

  "pocket_right_tab_v2@common_tabs.tab_right": { // used by furnace and crafting screens
    "anchor_from": "right_middle",
    "anchor_to": "left_middle",
    "$toggle_focus_enabled": false,
    "$radio_toggle_group": true,
    "$toggle_name": "right_inventory_navigation_tab",
    "$tab_content": "common_tabs.pocket_empty_tab_panel"
  },

  "pocket_tab_close_button": {
    "type": "image",
    "size": [ "100%", 33 ],
    "texture": "textures/ui/TabRightBackTopMost",

    "controls": [
      {
        "close_button@common.light_close_button": {
          "anchor_from": "center",
          "anchor_to": "center",
          "offset": [ 0, 0 ]
        }
      }
    ]
  },

  "pocket_tab_help_button": {
    "type": "image",
    "size": [ "100%", 33 ],
    "texture": "textures/ui/TabRightBackTopMost",

    "controls": [
      {
        "help_button@common.help_button": {
          "anchor_from": "center",
          "anchor_to": "center",
          "offset": [ 0, 0 ]
        }
      }
    ]
  },

  "pocket_tab_close_and_help_button": {
    "type": "image",
    "size": [ "100%", 51 ],
    "texture": "textures/ui/TabRightBackTopMost",

    "controls": [
      {
        "close_button@common.light_close_button": {
          "anchor_from": "top_middle",
          "anchor_to": "top_middle",
          "offset": [ 0, 6 ]
        }
      },
      {
        "help_button@common.help_button": {
          "anchor_from": "bottom_middle",
          "anchor_to": "bottom_middle",
          "offset": [ 0, -8 ]
        }
      }
    ]
  },

  "tab_close_and_help_button": {
    "type": "image",
    "size": [ "100%", "100%c + 7px" ],
    "texture": "textures/ui/TabRightBackTopMost",

    "controls": [
      {
        "close_button@common.light_close_button": {
          "anchor_from": "top_middle",
          "anchor_to": "top_middle",
          "offset": [ 0, 4 ]
        }
      },
      {
        "help_button@common.help_button": {
          "anchor_from": "bottom_middle",
          "anchor_to": "bottom_middle",
          "offset": [ 0, -6 ]
        }
      }
    ]
  }
}
