# Path: folium/raster_layers.py
# class TileLayer(Layer):
#     """
#     Create a tile layer to append on a Map.
# 
#     Parameters
#     ----------
#     tiles: str, default 'OpenStreetMap'
#         Map tileset to use. Can choose from this list of built-in tiles:
#             - "OpenStreetMap"
#             - "Stamen Terrain", "Stamen Toner", "Stamen Watercolor"
#             - "CartoDB positron", "CartoDB dark_matter"
# 
#         You can pass a custom tileset to Folium by passing a Leaflet-style
#         URL to the tiles parameter: ``http://{s}.yourtiles.com/{z}/{x}/{y}.png``.
# 
#         You can find a list of free tile providers here:
#         ``http://leaflet-extras.github.io/leaflet-providers/preview/``.
#         Be sure to check their terms and conditions and to provide attribution
#         with the `attr` keyword.
#     min_zoom: int, default 0
#         Minimum allowed zoom level for this tile layer.
#     max_zoom: int, default 18
#         Maximum allowed zoom level for this tile layer.
#     max_native_zoom: int, default None
#         The highest zoom level at which the tile server can provide tiles.
#         If provided you can zoom in past this level. Else tiles will turn grey.
#     attr: string, default None
#         Map tile attribution; only required if passing custom tile URL.
#     detect_retina: bool, default False
#         If true and user is on a retina display, it will request four
#         tiles of half the specified size and a bigger zoom level in place
#         of one to utilize the high resolution.
#     name : string, default None
#         The name of the Layer, as it will appear in LayerControls
#     overlay : bool, default False
#         Adds the layer as an optional overlay (True) or the base layer (False).
#     control : bool, default True
#         Whether the Layer will be included in LayerControls.
#     show: bool, default True
#         Whether the layer will be shown on opening (only for overlays).
#     subdomains: list of strings, default ['abc']
#         Subdomains of the tile service.
#     tms: bool, default False
#         If true, inverses Y axis numbering for tiles (turn this on for TMS
#         services).
#     opacity: float, default 1
#         Sets the opacity for the layer.
#     **kwargs : additional keyword arguments
#         Other keyword arguments are passed as options to the Leaflet tileLayer
#         object.
#     """
#     _template = Template(u"""
#         {% macro script(this, kwargs) %}
#             var {{ this.get_name() }} = L.tileLayer(
#                 {{ this.tiles|tojson }},
#                 {{ this.options|tojson }}
#             ).addTo({{ this._parent.get_name() }});
#         {% endmacro %}
#         """)
# 
#     def __init__(self, tiles='OpenStreetMap', min_zoom=0, max_zoom=18,
#                  max_native_zoom=None, attr=None,
#                  detect_retina=False, name=None, overlay=False,
#                  control=True, show=True, no_wrap=False, subdomains='abc',
#                  tms=False, opacity=1, **kwargs):
# 
#         self.tile_name = (name if name is not None else
#                           ''.join(tiles.lower().strip().split()))
#         super(TileLayer, self).__init__(name=self.tile_name, overlay=overlay,
#                                         control=control, show=show)
#         self._name = 'TileLayer'
#         self._env = ENV
# 
#         tiles_flat = ''.join(tiles.lower().strip().split())
#         if tiles_flat in {'cloudmade', 'mapbox', 'mapboxbright', 'mapboxcontrolroom'}:
#             # added in May 2020 after v0.11.0, remove in a future release
#             raise ValueError(
#                 'Built-in templates for Mapbox and Cloudmade have been removed. '
#                 'You can still use these providers by passing a URL to the `tiles` '
#                 'argument. See the documentation of the `TileLayer` class.'
#             )
#         templates = list(self._env.list_templates(
#             filter_func=lambda x: x.startswith('tiles/')))
#         tile_template = 'tiles/' + tiles_flat + '/tiles.txt'
#         attr_template = 'tiles/' + tiles_flat + '/attr.txt'
# 
#         if tile_template in templates and attr_template in templates:
#             self.tiles = self._env.get_template(tile_template).render()
#             attr = self._env.get_template(attr_template).render()
#         else:
#             self.tiles = tiles
#             if not attr:
#                 raise ValueError('Custom tiles must have an attribution.')
# 
#         self.options = parse_options(
#             min_zoom=min_zoom,
#             max_zoom=max_zoom,
#             max_native_zoom=max_native_zoom or max_zoom,
#             no_wrap=no_wrap,
#             attribution=attr,
#             subdomains=subdomains,
#             detect_retina=detect_retina,
#             tms=tms,
#             opacity=opacity,
#             **kwargs
#         )


from branca.element import MacroElement
from folium.elements import JSCSSMixin
from folium.raster_layers import TileLayer
from folium.utilities import parse_options
from jinja2 import Template
                {{ this.options|tojson }}
            );
            {{ this._parent.get_name() }}.addControl({{ this.get_name() }});
        {% endmacro %}
    """)  # noqa

    default_js = [
        ('Control_MiniMap_js',
         'https://cdnjs.cloudflare.com/ajax/libs/leaflet-minimap/3.6.1/Control.MiniMap.js')
    ]
    default_css = [
        ('Control_MiniMap_css',
         'https://cdnjs.cloudflare.com/ajax/libs/leaflet-minimap/3.6.1/Control.MiniMap.css'),
    ]

    def __init__(self, tile_layer=None, position='bottomright', width=150,
                 height=150, collapsed_width=25, collapsed_height=25,
                 zoom_level_offset=-5, zoom_level_fixed=None,
                 center_fixed=False, zoom_animation=False,
                 toggle_display=False, auto_toggle_display=False,
                 minimized=False, **kwargs):

        super(MiniMap, self).__init__()
        self._name = 'MiniMap'

        if tile_layer is None:
            self.tile_layer = TileLayer()
        elif isinstance(tile_layer, TileLayer):
            self.tile_layer = tile_layer
        else:

# Path: folium/raster_layers.py
# class TileLayer(Layer):
#     """
#     Create a tile layer to append on a Map.
# 
#     Parameters
#     ----------
#     tiles: str, default 'OpenStreetMap'
#         Map tileset to use. Can choose from this list of built-in tiles:
#             - "OpenStreetMap"
#             - "Stamen Terrain", "Stamen Toner", "Stamen Watercolor"
#             - "CartoDB positron", "CartoDB dark_matter"
# 
#         You can pass a custom tileset to Folium by passing a Leaflet-style
#         URL to the tiles parameter: ``http://{s}.yourtiles.com/{z}/{x}/{y}.png``.
# 
#         You can find a list of free tile providers here:
#         ``http://leaflet-extras.github.io/leaflet-providers/preview/``.
#         Be sure to check their terms and conditions and to provide attribution
#         with the `attr` keyword.
#     min_zoom: int, default 0
#         Minimum allowed zoom level for this tile layer.
#     max_zoom: int, default 18
#         Maximum allowed zoom level for this tile layer.
#     max_native_zoom: int, default None
#         The highest zoom level at which the tile server can provide tiles.
#         If provided you can zoom in past this level. Else tiles will turn grey.
#     attr: string, default None
#         Map tile attribution; only required if passing custom tile URL.
#     detect_retina: bool, default False
#         If true and user is on a retina display, it will request four
#         tiles of half the specified size and a bigger zoom level in place
#         of one to utilize the high resolution.
#     name : string, default None
#         The name of the Layer, as it will appear in LayerControls
#     overlay : bool, default False
#         Adds the layer as an optional overlay (True) or the base layer (False).
#     control : bool, default True
#         Whether the Layer will be included in LayerControls.
#     show: bool, default True
#         Whether the layer will be shown on opening (only for overlays).
#     subdomains: list of strings, default ['abc']
#         Subdomains of the tile service.
#     tms: bool, default False
#         If true, inverses Y axis numbering for tiles (turn this on for TMS
#         services).
#     opacity: float, default 1
#         Sets the opacity for the layer.
#     **kwargs : additional keyword arguments
#         Other keyword arguments are passed as options to the Leaflet tileLayer
#         object.
#     """
#     _template = Template(u"""
#         {% macro script(this, kwargs) %}
#             var {{ this.get_name() }} = L.tileLayer(
#                 {{ this.tiles|tojson }},
#                 {{ this.options|tojson }}
#             ).addTo({{ this._parent.get_name() }});
#         {% endmacro %}
#         """)
# 
#     def __init__(self, tiles='OpenStreetMap', min_zoom=0, max_zoom=18,
#                  max_native_zoom=None, attr=None,
#                  detect_retina=False, name=None, overlay=False,
#                  control=True, show=True, no_wrap=False, subdomains='abc',
#                  tms=False, opacity=1, **kwargs):
# 
#         self.tile_name = (name if name is not None else
#                           ''.join(tiles.lower().strip().split()))
#         super(TileLayer, self).__init__(name=self.tile_name, overlay=overlay,
#                                         control=control, show=show)
#         self._name = 'TileLayer'
#         self._env = ENV
# 
#         tiles_flat = ''.join(tiles.lower().strip().split())
#         if tiles_flat in {'cloudmade', 'mapbox', 'mapboxbright', 'mapboxcontrolroom'}:
#             # added in May 2020 after v0.11.0, remove in a future release
#             raise ValueError(
#                 'Built-in templates for Mapbox and Cloudmade have been removed. '
#                 'You can still use these providers by passing a URL to the `tiles` '
#                 'argument. See the documentation of the `TileLayer` class.'
#             )
#         templates = list(self._env.list_templates(
#             filter_func=lambda x: x.startswith('tiles/')))
#         tile_template = 'tiles/' + tiles_flat + '/tiles.txt'
#         attr_template = 'tiles/' + tiles_flat + '/attr.txt'
# 
#         if tile_template in templates and attr_template in templates:
#             self.tiles = self._env.get_template(tile_template).render()
#             attr = self._env.get_template(attr_template).render()
#         else:
#             self.tiles = tiles
#             if not attr:
#                 raise ValueError('Custom tiles must have an attribution.')
# 
#         self.options = parse_options(
#             min_zoom=min_zoom,
#             max_zoom=max_zoom,
#             max_native_zoom=max_native_zoom or max_zoom,
#             no_wrap=no_wrap,
#             attribution=attr,
#             subdomains=subdomains,
#             detect_retina=detect_retina,
#             tms=tms,
#             opacity=opacity,
#             **kwargs
#         )


# Path: folium/plugins/minimap.py
from branca.element import MacroElement
from folium.elements import JSCSSMixin
from folium.raster_layers import TileLayer
from folium.utilities import parse_options
from jinja2 import Template

                {{ this.options|tojson }}
            );
            {{ this._parent.get_name() }}.addControl({{ this.get_name() }});
        {% endmacro %}
    """)  # noqa

    default_js = [
        ('Control_MiniMap_js',
         'https://cdnjs.cloudflare.com/ajax/libs/leaflet-minimap/3.6.1/Control.MiniMap.js')
    ]
    default_css = [
        ('Control_MiniMap_css',
         'https://cdnjs.cloudflare.com/ajax/libs/leaflet-minimap/3.6.1/Control.MiniMap.css'),
    ]

    def __init__(self, tile_layer=None, position='bottomright', width=150,
                 height=150, collapsed_width=25, collapsed_height=25,
                 zoom_level_offset=-5, zoom_level_fixed=None,
                 center_fixed=False, zoom_animation=False,
                 toggle_display=False, auto_toggle_display=False,
                 minimized=False, **kwargs):

        super(MiniMap, self).__init__()
        self._name = 'MiniMap'

        if tile_layer is None:
            self.tile_layer = TileLayer()
        elif isinstance(tile_layer, TileLayer):
            self.tile_layer = tile_layer
        else:

            self.tile_layer = TileLayer(tile_layer)