/********************************************************
+*   (c) Mojang. All rights reserved                       *
+*   (c) Microsoft. All rights reserved.                   *
+*********************************************************/
{
  "namespace": "cartography",

  "title_label": {
    "type": "label",
    "text": "tile.cartography_table.name",
    "color": "$title_text_color"
  },

  "arrow_icon": {
    "type": "image",
    "texture": "textures/ui/arrow",
    "size": [ 22, 15 ]
  },

  "plus_sign_icon": {
    "type": "image",
    "texture": "textures/ui/anvil-plus",
    "size": [ 13, 13 ]
  },

  "text_edit_control@common.text_edit_box": {
    "anchor_from": "top_left", // the parent
    "anchor_to": "top_left", // this control
    "size": [ "default", 20 ],
    "max_length": 30,
    "$place_holder_text": "#text_box_placeholder_name",
    "$text_edit_box_placeholder_content_binding_name": "#text_box_placeholder_name",

    "$text_edit_box_label_size": [ "default", 10 ]
  },

  "cartography_output_slot_button@common.no_coalesce_container_slot_button": {
    "button_mappings": [
      {
        "from_button_id": "button.menu_select",
        "to_button_id": "button.cartography_result_take_all_place_all",
        "mapping_type": "pressed"
      },
      {
        "from_button_id": "button.menu_ok",
        "to_button_id": "button.cartography_result_take_all_place_all",
        "mapping_type": "pressed"
      },
      {
        "from_button_id": "button.controller_back",
        "to_button_id": "button.cartography_result_take_all_place_all",
        "mapping_type": "pressed",
        "ignored": "(not $is_ps4)"
      },
      {
        "from_button_id": "button.menu_secondary_select",
        "to_button_id": "button.cartography_result_take_half_place_one",
        "mapping_type": "pressed"
      },
      {
        "from_button_id": "button.controller_select",
        "to_button_id": "button.cartography_result_take_half_place_one",
        "mapping_type": "pressed"
      },
      {
        "from_button_id": "button.menu_auto_place",
        "to_button_id": "button.container_auto_place",
        "mapping_type": "pressed"
      },
      {
        "from_button_id": "button.controller_secondary_select",
        "to_button_id": "button.container_auto_place",
        "mapping_type": "pressed"
      },
      {
        "from_button_id": "button.menu_inventory_drop",
        "to_button_id": "button.drop_one",
        "mapping_type": "pressed"
      },
      {
        "from_button_id": "button.menu_inventory_drop_all",
        "to_button_id": "button.drop_all",
        "mapping_type": "pressed"
      },
      {
        "to_button_id": "button.container_slot_hovered",
        "mapping_type": "pressed"
      }
    ]
  },

  "cartography_item_slot": {
    "type": "panel",
    "size": [ "100%c", "100%c" ],
    "controls": [
      {
        "container_item@common.container_item": {
          "anchor_to": "center",
          "anchor_from": "center"
        }
      }
    ]
  },

  "map_image": {
    "type": "image",
    "texture": "$map_texture",
    "bindings": [
      {
        "binding_name": "$map_binding_name",
        "binding_name_override": "#visible"
      }
    ]
  },

  "map_image_panel": {
    "type": "panel",
    "size": [ 66, 66 ],
    "controls": [
      {
        "none_map@cartography.map_image": {
          "$map_texture": "textures/ui/cartography_table_empty",
          "$map_binding_name": "#is_none_mode"
        }
      },
      {
        "copy_map@cartography.map_image": {
          "$map_texture": "textures/ui/cartography_table_copy",
          "$map_binding_name": "#is_clone_mode"
        }
      },
      {
        "rename_map@cartography.map_image": {
          "$map_texture": "textures/ui/cartography_table_map",
          "$map_binding_name": "#is_rename_mode"
        }
      },
      {
        "map@cartography.map_image": {
          "$map_texture": "textures/ui/cartography_table_map",
          "$map_binding_name": "#is_basic_map_mode"
        }
      },
      {
        "locator_map@cartography.map_image": {
          "$map_texture": "textures/ui/cartography_table_map",
          "$map_binding_name": "#is_locator_map_mode"
        }
      },
      {
        "zoom_map@cartography.map_image": {
          "$map_texture": "textures/ui/cartography_table_zoom",
          "$map_binding_name": "#is_extend_mode"
        }
      },
      {
        "lock_map@cartography.map_image": {
          "$map_texture": "textures/ui/cartography_table_glass",
          "$map_binding_name": "#is_locked_mode"
        }
      }
    ]
  },

  "text_box_panel": {
    "type": "stack_panel",
    "controls": [
      {
        "map_name_label": {
          "type": "label",
          "text": "map.name",
          "color": "$title_text_color"
        }
      },
      {
        "text_edit_control@cartography.text_edit_control": {
        }
      }
    ]
  },

  "input_slots": {
    "type": "stack_panel",
    "size": [ 18, "default" ],
    "controls": [
      {
        "input_item_slot@cartography.cartography_item_slot": {
          "anchor_from": "top_middle",
          "anchor_to": "top_middle",
          "offset": [ 0, 1 ],
          "$item_collection_name": "cartography_input_items",

          "$focus_id_binding_type": "none",
          "$focus_id": "cartography_input",

          "$focus_override_down_binding_type": "none",
          "$focus_override_down": "cartography_additional",

          "$focus_override_right_binding_type": "none",
          "$focus_override_right": "cartography_result"
        }
      },
      {
        "plus_centerer": {
          "type": "panel",
          "size": [ "100%", "100%c + 8px" ],
          "controls": [
            {
              "plus_sign_icon@cartography.plus_sign_icon": {}
            }
          ]
        }
      },
      {
        "additional_item_slot@cartography.cartography_item_slot": {
          "anchor_from": "bottom_middle",
          "anchor_to": "bottom_middle",
          "offset": [ 0, -1 ],
          "$item_collection_name": "cartography_additional_items",

          "$focus_id_binding_type": "none",
          "$focus_id": "cartography_additional",

          "$focus_override_up_binding_type": "none",
          "$focus_override_up": "cartography_input",

          "$focus_override_right_binding_type": "none",
          "$focus_override_right": "cartography_result"
        }
      }
    ]
  },

  "output_description_label": {
    "type": "label",
    "anchor_from": "bottom_middle",
    "anchor_to": "top_middle",
    "text": "#text",
    "size": [ "100%", 10 ],
    "text_alignment": "center",
    "color": "$title_text_color",

    "bindings": [
      {
        "binding_name": "#output_description",
        "binding_name_override": "#text"
      }
    ]
  },

  "main_panel": {
    "type": "panel",
    "size": [ 162, "100%cm" ],
    "controls": [
      {
        "input_slots@cartography.input_slots": {
          "anchor_from": "left_middle",
          "anchor_to": "left_middle"
        }
      },
      {
        "arrow_icon@cartography.arrow_icon": {
          "anchor_from": "left_middle",
          "anchor_to": "left_middle",
          "size": [ 16, 13 ],
          "offset": [ 25, 0 ]
        }
      },
      {
        "map_image_panel@cartography.map_image_panel": {
          "anchor_from": "center",
          "anchor_to": "center"
        }
      },
      {
        "arrow_icon2@cartography.arrow_icon": {
          "anchor_from": "right_middle",
          "anchor_to": "right_middle",
          "size": [ 16, 13 ],
          "offset": [ -29, 0 ]
        }
      },
      {
        "result_item_slot@cartography.cartography_item_slot": {
          "anchor_from": "right_middle",
          "anchor_to": "right_middle",
          "$item_collection_name": "cartography_result_items",
          "$button_ref": "cartography.cartography_output_slot_button",

          "size": [ 26, 26 ],
          "$cell_image_size": [ 26, 26 ],

          "$focus_id_binding_type": "none",
          "$focus_id": "cartography_result",

          "$focus_override_left_binding_type": "none",
          "$focus_override_left": "cartography_additional"
        }
      }
    ]
  },

  "top_half_panel": {
    "type": "stack_panel",
    "anchor_from": "top_middle",
    "anchor_to": "top_middle",
    "size": [ "100% - 12px", "100% - 90px" ],
    "controls": [
      {
        "padding1": {
          "type": "panel",
          "size": [ "100%", 6 ]
        }
      },
      {
        "title_panel": {
          "type": "panel",
          "size": [ "100%", "100%c" ],
          "controls": [
            {
              "title_label@cartography.title_label": {
              }
            }
          ]
        }
      },
      {
        "padding2": {
          "type": "panel",
          "size": [ "100%", 4 ]
        }
      },
      {
        "text_box_panel@cartography.text_box_panel": {
        }
      },
      {
        "padding3": {
          "type": "panel",
          "size": [ "100%", 4 ]
        }
      },
      {
        "padding4": {
          "type": "panel",
          "size": [ "100%", "fill" ]
        }
      },
      {
        "main_panel_wrap": {
          "type": "panel",
          "size": [ "100%", "100%c" ],
          "controls": [
            {
              "main_panel@cartography.main_panel": {}
            }
          ]
        }
      },
      { "output_description_label@cartography.output_description_label": {} },
      {
        "padding5": {
          "type": "panel",
          "size": [ "100%", "fill" ]
        }
      }
    ]
  },

  "cartography_panel": {
    "type": "panel",
    "controls": [
      { "container_gamepad_helpers@common.container_gamepad_helpers": {} },
      { "selected_item_details_factory@common.selected_item_details_factory": {} },
      { "item_lock_notification_factory@common.item_lock_notification_factory": {} },
      {
        "root_panel@common.root_panel": {
          "size": [ "100% - 44px", "100%" ],
          "max_size": [ 176, 220 ],
          "layer": 1,
          "$show_close_button": false,
          "controls": [
            { "common_panel@common.common_panel": {} },
            {
              "cartography_screen_inventory": {
                "type": "panel",
                "layer": 2,
                "controls": [
                  { "top_half_panel@cartography.top_half_panel": {} },
                  { "inventory_panel_bottom_half_with_label@common.inventory_panel_bottom_half_with_label": {} },
                  { "hotbar_grid@common.hotbar_grid_template": {} },
                  { "inventory_take_progress_icon_button@common.inventory_take_progress_icon_button": {} }
                ]
              }
            },
            { "inventory_selected_icon_button@common.inventory_selected_icon_button": {} },
            { "gamepad_cursor@common.gamepad_cursor_button": {} },
            {
              "tab_close_and_help_button@common_tabs.tab_close_and_help_button": {
                "anchor_from": "top_right",
                "anchor_to": "top_left",
                "size": [ 26, "100%c + 7px" ],
                "offset": [ -4, 0 ]
              }
            }
          ]
        }
      },
      { "flying_item_renderer@common.flying_item_renderer": { "layer": 15 } }
    ]
  },

  "cartography_screen@common.inventory_screen_common": {
    "$close_on_player_hurt|default": true,
    "close_on_player_hurt": "$close_on_player_hurt",
    "variables": [
      {
        "requires": "$desktop_screen",
        "$screen_content": "cartography.cartography_panel",
        "$screen_bg_content": "common.screen_background",
        "$screen_background_alpha": 0.4
      },
      {
        "requires": "$pocket_screen",
        "$screen_content": "cartography_pocket.cartography_panel",
        "$screen_bg_content": "common.screen_background",
        "$screen_background_alpha": 0.4
      }
    ]
  }
}
