{
  "namespace": "trade2_pocket",

  //---------------------------------------------------------------------------
  // #region Images
  //---------------------------------------------------------------------------

  "chest_item_renderer": {
    "type": "custom",
    "renderer": "inventory_item_renderer",
    "size": [ 16, 16 ],
    "property_bag": {
      "#item_id_aux": 3538944,
      "#collection_name": "inventory_tab",
      "#collection_index": 0
    }
  },

  "trade_icon": {
    "type": "image",
    "texture": "textures/ui/trade_icon",
    "size": [ 18, 17 ]
  },

  "arrow_right_image": {
    "type": "image",
    "size": [ 24, 19 ],
    "texture": "textures/ui/arrow_dark_right"
  },

  // #endregion

  //---------------------------------------------------------------------------
  // #region Right Navigation Tabs
  //---------------------------------------------------------------------------

  "right_navigation_tabs": {
    "type": "stack_panel",
    "orientation": "vertical",
    "size": [ 35, "100%" ],
    "offset": [ -4, 0 ],
    "anchor_from": "top_left",
    "anchor_to": "top_left",
    "controls": [
      { "pocket_tab_close_button@common_tabs.pocket_tab_close_button": {} },
      {
        "fill": {
          "type": "panel",
          "size": [ "100%", "fill" ]
        }
      }
    ]
  },

  // #endregion

  //---------------------------------------------------------------------------
  // #region Right Panel
  //---------------------------------------------------------------------------

  "trade_slots_panel@trade2.scroll_background_image": {
    "layer": 1,
    "controls": [
      {
        "item_slots_stack_panel@trade2.item_slots_stack_panel": {
          "size": [ "100%", "100%cm" ],
          "max_size": [ 104, "100%cm" ],
          "layer": 2
        }
      }
    ]
  },

  "trade_and_help_buttons": {
    "type": "stack_panel",
    "size": [ "100%", 32 ],
    "orientation": "horizontal",
    "controls": [
      {
        "trade_button_holder": {
          "type": "panel",
          "size": [ "fill", "100%" ],
          "controls": [
            {
              "trade_button@trade2.trade_button": {
                "size": [ "100%", "100%" ]
              }
            }
          ]
        }
      },
      {
        "how_to_play_button_holder": {
          "type": "panel",
          "size": [ "100%c - 1px", "100%" ],
          "controls": [
            {
              "how_to_play_button@trade2.how_to_play_button": {
                "size": [ 32, "100%" ],
                "anchor_from": "right_middle",
                "anchor_to": "right_middle",
                "$button_font_size": "large",
                "$button_text_max_size": [ "100%", 16 ]
              }
            }
          ]
        }
      }
    ]
  },

  "name_and_trade_slots_stack_panel": {
    "type": "stack_panel",
    "size": [ "100%", "100%" ],
    "orientation": "vertical",
    "controls": [
      {
        "padding_1": {
          "type": "panel",
          "size": [ 0, 8 ]
        }
      },
      {
        "villager_name_label_holder": {
          "type": "panel",
          "size": [ "100%", "100%c" ],
          "controls": [
            {
              "villager_name_label@trade2.villager_name_label": {
                "offset": [ 0, 0 ],
                "anchor_from": "center",
                "anchor_to": "center"
              }
            }
          ]
        }
      },
      {
        "padding_2": {
          "type": "panel",
          "size": [ 0, 4 ]
        }
      },
      {
        "exp_progress_bar_holder": {
          "type": "panel",
          "size": [ "100%", "100%c" ],
          "controls": [
            {
              "exp_progress_bar@trade2.exp_progress_bar": {
                "size": [ "100% - 16px", 5 ],
                "offset": [ 0, 0 ]
              }
            }
          ]
        }
      },
      {
        "padding_3": {
          "type": "panel",
          "size": [ 0, 8 ]
        }
      },
      {
        "trade_slots_panel@trade2_pocket.trade_slots_panel": {
          "size": [ "100%", "fill" ]
        }
      },
      {
        "padding_4": {
          "type": "panel",
          "size": [ 0, 2 ]
        }
      },
      { "trade_and_help_buttons@trade2_pocket.trade_and_help_buttons": {} }
    ]
  },

  "right_panel": {
    "type": "stack_panel",
    "size": [ "fill", "100%" ],
    "orientation": "horizontal",

    "controls": [
      {
        "content@common.root_panel": {
          "size": [ "fill", "100%" ],
          "controls": [
            {
              "bg@common.common_panel": {
                "size": [ "100%", "100%" ],
                "$show_close_button": false
              }
            },
            {
              "name_and_trade_slots_stack_panel@trade2_pocket.name_and_trade_slots_stack_panel": {
                "size": [ "100% - 12px", "100% - 12px" ],
                "layer": 2
              }
            }
          ]
        }
      },
      {
        "navigation_tabs_holder": {
          "type": "panel",
          "size": [ "100%c - 4px", "100%" ],
          "controls": [
            { "right_navigation_tabs@trade2_pocket.right_navigation_tabs": {} }
          ]
        }
      }
    ]
  },

  // #endregion

  //---------------------------------------------------------------------------
  // Common Left Navigation Tabs
  //---------------------------------------------------------------------------

  "left_tab_trade@common_tabs.pocket_tab_left": {
    "$tab_view_binding_name": "trade_tab_toggle",
    "$toggle_group_forced_index": "$left_tab_index_trades",

    "$tab_content": "trade2_pocket.trade_icon",

    "$toggle_binding_type": "global",
    "$toggle_state_binding_name": "#is_left_tab_trade"
  },

  "left_tab_inventory@common_tabs.pocket_tab_left": {
    "$tab_view_binding_name": "inventory_left_tab_toggle",
    "$toggle_group_forced_index": "$left_tab_index_inventory",

    "$tab_content": "trade2_pocket.chest_item_renderer",

    "$toggle_binding_type": "global",
    "$toggle_state_binding_name": "#is_left_tab_inventory"
  },

  "left_navigation_tabs": {
    "type": "stack_panel",
    "orientation": "vertical",
    "size": [ 35, "default" ],
    "offset": [ 4, 0 ],
    "anchor_from": "top_right",
    "anchor_to": "top_right",
    "controls": [
      { "left_tab_trades@trade2_pocket.left_tab_trade": {} },
      {
        "padding": {
          "type": "panel",
          "size": [ 0, 1 ]
        }
      },
      {
        "left_tab_inventory@trade2_pocket.left_tab_inventory": {
          "$is_bottom_most_tab": true
        }
      }
    ]
  },

  // #endregion

  //---------------------------------------------------------------------------
  // Common Left Panel
  //---------------------------------------------------------------------------

  "arrow_holder": {
    "type": "panel",
    "size": [ 24, 0 ],
    "controls": [
      {
        "arrow_image@trade2_pocket.arrow_right_image": {
          "bindings": [
            {
              "binding_type": "collection_details"
            },
            {
              "binding_name": "#trade_toggle_enabled",
              "binding_name_override": "#visible"
            }
          ]
        }
      },
      {
        "cross_out_image@trade2.cross_out_image": {
          "size": [ 22, 22 ],
          "layer": 2,
          "anchor_from": "right_middle",
          "anchor_to": "right_middle",
          "bindings": [
            {
              "binding_type": "collection_details"
            },
            {
              "binding_name": "#trade_cross_out_visible",
              "binding_name_override": "#visible"
            }
          ]
        }
      },
      {
        "lock_image@trade2.lock_image": {
          "size": [ 16, 16 ],
          "bindings": [
            {
              "binding_type": "collection_details"
            },
            {
              "binding_name": "(not #trade_toggle_enabled)",
              "binding_name_override": "#visible"
            }
          ]
        }
      }
    ]
  },

  "inventory_scroll_panel@common.container_scroll_panel": {
    "size": [ "100% - 12px", "100% - 12px" ],
    "$scrolling_content": "common.pocket_container_grid"
  },

  "toggle_content": {
    "type": "stack_panel",
    "size": [ "100%", "100%cm" ],
    "orientation": "horizontal",

    "controls": [
      {
        "padding_1": {
          "type": "panel",
          "size": [ "fill", 0 ]
        }
      },
      {
        "trade_item_holder": {
          "type": "stack_panel",
          "orientation": "horizontal",
          "size": [ 38, "100%cm" ],
          "layer": 2,
          "controls": [
            {
              "padding_left": {
                "type": "panel",
                "size": [ "fill", 0 ]
              }
            },
            { "trade_item_1@trade2.trade_item_1": {} },
            {
              "padding_middle": {
                "type": "panel",
                "size": [ 2, 0 ],
                "bindings": [
                  {
                    "binding_type": "collection_details"
                  },
                  {
                    "binding_name": "#has_second_buy_item",
                    "binding_name_override": "#visible"
                  }
                ]
              }
            },
            {
              "trade_item_2@trade2.trade_item_2": {
                "bindings": [
                  {
                    "binding_type": "collection_details"
                  },
                  {
                    "binding_name": "#has_second_buy_item",
                    "binding_name_override": "#visible"
                  }
                ]
              }
            },
            {
              "padding_right": {
                "type": "panel",
                "size": [ "fill", 0 ]
              }
            }
          ]
        }
      },
      {
        "padding_2": {
          "type": "panel",
          "size": [ "fill", 0 ],
          "max_size": [ 2, 0 ]
        }
      },
      {
        "arrow_holder@trade2_pocket.arrow_holder": {
          "inherit_max_sibling_height": true
        }
      },
      {
        "padding_3": {
          "type": "panel",
          "size": [ "fill", 0 ],
          "max_size": [ 2, 0 ]
        }
      },
      {
        "sell_item_holder": {
          "type": "panel",
          "size": [ "100%c", "100%c" ],
          "layer": 2,
          "controls": [
            { "sell_item@trade2.sell_item": {} }
          ]
        }
      },
      {
        "padding_4": {
          "type": "panel",
          "size": [ "fill", 0 ]
        }
      }
    ]
  },

  "left_panel": {
    "type": "stack_panel",
    "size": [ "fill", "100%" ],
    "orientation": "horizontal",

    "controls": [
      {
        "gamepad_helpers_and_tabs_holder": {
          "type": "panel",
          "size": [ "100%c", "100%" ],
          "controls": [
            {
              "tabs_left_gamepad_helpers@common.tabs_left_gamepad_helpers": {
                "size": [ 14, 0 ],
                "inherit_max_sibling_height": true,
                "anchor_from": "bottom_left",
                "anchor_to": "bottom_left"
              }
            },
            {
              "navigation_tabs_holder": {
                "type": "panel",
                "size": [ "100%c - 4px", "100%c" ],
                "anchor_from": "bottom_right",
                "anchor_to": "bottom_right",
                "controls": [
                  { "left_navigation_tabs@trade2_pocket.left_navigation_tabs": {} }
                ]
              }
            }
          ]
        }
      },
      {
        "content@common.root_panel": {
          "size": [ "fill", "100%" ],
          "controls": [
            {
              "bg@common.common_panel": {
                "size": [ "100%", "100%" ],
                "$show_close_button": false
              }
            },
            {
              "inventory_scroll_panel@trade2_pocket.inventory_scroll_panel": {
                "layer": 2,
                "bindings": [
                  {
                    "binding_type": "global",
                    "binding_name": "#is_left_tab_inventory",
                    "binding_name_override": "#visible"
                  }
                ]
              }
            },
            {
              "trade_scroll_panel@trade2.trade_scroll_panel": {
                "layer": 2,

                "$toggle_size": [ "100%", 32 ],
                "$item_renderer_size": [ 24, 24 ],
                "$toggle_content_control": "trade2_pocket.toggle_content",

                "bindings": [
                  {
                    "binding_type": "global",
                    "binding_name": "#is_left_tab_trade",
                    "binding_name_override": "#visible"
                  }
                ]
              }
            }
          ]
        }
      }
    ]
  },

  // #endregion

  //---------------------------------------------------------------------------
  // #region Base Panels
  //---------------------------------------------------------------------------

  "pocket_hotbar_and_content_panels@common.pocket_hotbar_and_content_panels": {
    "layer": 2,
    "$left_panel_control": "trade2_pocket.left_panel",
    "$right_panel_control": "trade2_pocket.right_panel"
  },

  "screen_panel": {
    "type": "panel",
    "controls": [
      { "pocket_hotbar_and_content_panels@trade2_pocket.pocket_hotbar_and_content_panels": {} },

      {
        "container_gamepad_helpers@common.container_gamepad_helpers": {
          "size": [ "100%", 40 ],
          "$gamepad_helper_size": [ "100%c", 15 ],
          "$a_b_stack_panel_orientation": "vertical",
          "$x_y_stack_panel_orientation": "vertical",
          "$a_b_stack_panel_size": [ "100%cm", "100%" ],
          "$x_y_stack_panel_size": [ "100%cm", "100%" ],
          "$helper_x_control": "trade2.gamepad_helper_x",
          "$helper_y_control": "trade2.gamepad_helper_y"
        }
      },
      {
        "selected_item_details_factory@common.selected_item_details_factory": {
          "$offset": [ 0, "-37px" ]
        }
      },
      {
        "item_lock_notification_factory@common.item_lock_notification_factory": {
          "$offset": [ 0, "85%" ]
        }
      },
      { "inventory_selected_icon_button@common.inventory_selected_icon_button": {} },
      { "inventory_take_progress_icon_button@common.inventory_take_progress_icon_button": {} },
      { "flying_item_renderer@common.flying_item_renderer": { "layer": 21 } }
    ]
  }

  // #endregion
}
