text: //locales
  // lista de locales
  const locales = {
    data: [
      {
        farmacias: {
          cordoba: {
            farmaciasLider: [
              {
                id: "101",
                name: "Farmacias Lider",
                address: "Av. General Paz 258",
                phone: "351-540-0181",
                coordenates: "-31.412297, -64.185343",
                loc: "Córdoba Capital",
              },
              {
                id: "102",
                name: "Farmacias Lider",
                address: "Humberto Primo 208",
                phone: "351-403-1285",
                coordenates: "-31.409250, -64.184452",
                loc: "Córdoba Capital",
              },
              {
                id: "103",
                name: "Farmacias Lider",
                address: "Belgrano 66",
                phone: "351-402-9924",
                coordenates: "-31.415466, -64.188639",
                loc: "Córdoba Capital",
              },
              {
                id: "104",
                name: "Farmacias Lider",
                address: "Santa Rosa 794",
                phone: "351-402-7227",
                coordenates: "-31.409396, -64.193344",
                loc: "Córdoba Capital",
              },
              {
                id: "105",
                name: "Farmacias Lider",
                address: "Santa Rosa 1565",
                phone: "351-611-4350",
                coordenates: "-31.406312, -64.203893",
                loc: "Córdoba Capital",
              },
              {
                id: "106",
                name: "Farmacias Lider",
                address: "Laprida 41",
                phone: "351-611-4312",
                coordenates: "-31.424189, -64.188168",
                loc: "Córdoba Capital",
              },
              {
                id: "107",
                name: "Farmacias Lider",
                address: "Oncativo 1366",
                phone: "351-611-3307",
                coordenates: "-31.409453, -64.166671",
                loc: "Córdoba Capital",
              },
              {
                id: "108",
                name: "Farmacias Lider",
                address: "Av. O'Higgins 5845",
                phone: "351-403-7281",
                coordenates: "-31.480382, -64.168368",
                loc: "Córdoba Capital",
              },
              {
                id: "109",
                name: "Farmacias Lider",
                address: "Av. Rafael Núñez 4220",
                phone: "351-695-8586",
                coordenates: "-31.369349, -64.232093",
                loc: "Córdoba Capital",
              },
              {
                id: "110",
                name: "Farmacias Lider",
                address: "Jujuy 520",
                phone: "351-611-2178",
                coordenates: "-31.410197, -64.188306",
                loc: "Córdoba Capital",
              },
              {
                id: "111",
                name: "Farmacias Lider",
                address: "Av. Colón 820",
                phone: "351-672-2244",
                coordenates: "-31.410197, -64.194060",
                loc: "Córdoba Capital",
              },
              {
                id: "112",
                name: "Farmacias Lider",
                address: "Av. Pablo Richieri 3316",
                phone: "351-542-9978",
                coordenates: "-31.451174, -64.176315",
                loc: "Córdoba Capital",
              },
              {
                id: "113",
                name: "Farmacias Lider",
                address: "Santa Rosa 167",
                phone: "351-403-3308",
                coordenates: "-31.411776, -64.185023",
                loc: "Córdoba Capital",
              },
            ],
  
            // -----------------------------------------
  
            farmaciasRedGeneralPaz: [
              {
                id: "301",
                name: "Farmacias Red General Paz",
                address: "Duarte Quiróz 1400",
                phone: "351-482-8101",
                coordenates: "-31.412952, -64.204534",
                loc: "Córdoba Capital",
              },
              {
                id: "302",
                name: "Farmacias Red General Paz",
                address: "Av. Pedro Laplace 5890",
                phone: "0810-4444-729",
                coordenates: "-31.357990, -64.241061",
                loc: "Córdoba Capital",
              },
              {
                id: "303",
                name: "Farmacias Red General Paz",
                address: "Rafael Núñez 3686",
                phone: "351-482-5358",
                coordenates: "-31.376383, -64.225938",
                loc: "Córdoba Capital",
              },
              {
                id: "304",
                name: "Farmacias Red General Paz",
                address: "Av. Recta Martinolli 6137",
                phone: "3543-448-880",
                coordenates: "-31.349722, -64.252448",
                loc: "Córdoba Capital",
              },
              {
                id: "305",
                name: "Farmacias Red General Paz",
                address: "Emilio Lamarca 4135",
                phone: "351-366-6948",
                coordenates: "-31.382147, -64.243485",
                loc: "Córdoba Capital",
              },
              {
                id: "306",
                name: "Farmacias Red General Paz",
                address: "Recta Martinolli 8853",
                phone: "351-203-1267",
                coordenates: "-31.344123, -64.287355",
                loc: "Córdoba Capital",
              },
            ],
  
            // -----------------------------------------
  
            farmaciasSanchezAntonioli: [
              {
                id: "401",
                name: "Farmacias Sánchez Antoniolli",
                address: "Av. Pablo Cabrera 4650",
                phone: "",
                coordenates: "-31.361922, -64.203945",
                loc: "Córdoba Capital",
              },
              {
                id: "402",
                name: "Farmacias Sánchez Antoniolli",
                address: "Av. Donato Alvarez 7914",
                phone: "",
                coordenates: "-31.330787, -64.264065",
                loc: "Córdoba Capital",
              },
              {
                id: "403",
                name: "Farmacias Sánchez Antoniolli",
                address: "Av. Leandro Alem 1570",
                phone: "",
                coordenates: "-31.386521, -64.159901",
                loc: "Córdoba Capital",
              },
              {
                id: "404",
                name: "Farmacias Sánchez Antoniolli",
                address: "Av. Carlos Gauss 5904",
                phone: "",
                coordenates: "-31.353769, -64.249622",
                loc: "Córdoba Capital",
              },
              {
                id: "405",
                name: "Farmacias Sánchez Antoniolli",
                address: "Congreso 5476",
                phone: "",
                coordenates: "-31.474231, -64.225256",
                loc: "Córdoba Capital",
              },
              {
                id: "406",
                name: "Farmacias Sánchez Antoniolli",
                address: "Av. Renault 1916",
                phone: "",
                coordenates: "-31.472613, -64.232027",
                loc: "Córdoba Capital",
              },
              {
                id: "407",
                name: "Farmacias Sánchez Antoniolli",
                address: "Defensa 1753",
                phone: "",
                coordenates: "-31.467256, -64.223478",
                loc: "Córdoba Capital",
              },
              {
                id: "408",
                name: "Farmacias Sánchez Antoniolli",
                address: "Av. Vélez Sarsfield 4101",
                phone: "",
                coordenates: "-31.457493, -64.199571",
                loc: "Córdoba Capital",
              },
              {
                id: "409",
                name: "Farmacias Sánchez Antoniolli",
                address: "Av. Vélez Sarsfield 3426",
                phone: "",
                coordenates: "-31.449283, -64.199764",
                loc: "Córdoba Capital",
              },
              {
                id: "410",
                name: "Farmacias Sánchez Antoniolli",
                address: "Leartes 2484",
                phone: "",
                coordenates: "-31.438997, -64.139213",
                loc: "Córdoba Capital",
              },
              {
                id: "411",
                name: "Farmacias Sánchez Antoniolli",
                address: "Rosales 5395",
                phone: "",
                coordenates: "-31.430934, -64.116986",
                loc: "Córdoba Capital",
              },
              {
                id: "412",
                name: "Farmacias Sánchez Antoniolli",
                address: "Av. Fuerza Aérea 3735",
                phone: "",
                coordenates: "-31.432405, -64.237431",
                loc: "Córdoba Capital",
              },
              {
                id: "413",
                name: "Farmacias Sánchez Antoniolli",
                address: "Naciones Unidas 4927",
                phone: "",
                coordenates: "-31.441214, -64.207402",
                loc: "Córdoba Capital",
              },
              {
                id: "414",
                name: "Farmacias Sánchez Antoniolli",
                address: "Av. Fuerza Aérea 4730",
                phone: "",
                coordenates: "-31.432513, -64.248224",
                loc: "Córdoba Capital",
              },
              {
                id: "415",
                name: "Farmacias Sánchez Antoniolli",
                address: "Av. Fuerza Aérea 2804",
                phone: "",
                coordenates: "-31.431109, -64.225906",
                loc: "Córdoba Capital",
              },
              {
                id: "416",
                name: "Farmacias Sánchez Antoniolli",
                address: "Justo José Urquiza 381",
                phone: "",
                coordenates: "-31.424549, -63.045146",
                loc: "Arroyito",
              },
              {
                id: "417",
                name: "Farmacias Sánchez Antoniolli",
                address: "Ruta C 45 km 1",
                phone: "",
                coordenates: "-31.473867, -64.430779",
                loc: "Malagueño",
              },
              {
                id: "418",
                name: "Farmacias Sánchez Antoniolli",
                address: "Av. Carcano 427",
                phone: "",
                coordenates: "-31.429126, -64.496996",
                loc: "Carlos Paz",
              },
            ],
  
            // -----------------------------------------
  
            farmaciasGeneralPaz: [
              {
                id: "201",
                name: "Farmacias General Paz",
                address: "Av. 24 de Septiembre 802",
                phone: "351-542-5470",
                coordenates: "-31.415206, -64.171839",
                loc: "Córdoba Capital",
              },
              {
                id: "202",
                name: "Farmacias General Paz",
                address: "Libertad 207",
                phone: "351-289-3136",
                coordenates: "-31.408430, -64.177830",
                loc: "Córdoba Capital",
              },
              {
                id: "203",
                name: "Farmacias General Paz",
                address: "Roma 557",
                phone: "351-542-5472",
                coordenates: "-31.409553, -64.164724",
                loc: "Córdoba Capital",
              },
              {
                id: "204",
                name: "Farmacias General Paz",
                address: "Humberto 1° esq. Tucumán",
                phone: "351-542-5474",
                coordenates: "-31.408770, -64.185667",
                loc: "Córdoba Capital",
              },
              {
                id: "205",
                name: "Farmacias General Paz",
                address: "Bv. Chacabuco 787",
                phone: "351-542-5512",
                coordenates: "-31.426374, -64.183842",
                loc: "Córdoba Capital",
              },
              {
                id: "206",
                name: "Farmacias General Paz",
                address: "Av. Colón 745",
                phone: "351-541-3231",
                coordenates: "-31.410691, -64.193406",
                loc: "Córdoba Capital",
              },
              {
                id: "209",
                name: "Farmacias General Paz",
                address: "Sarmiento 436",
                phone: "351-541-1999",
                coordenates: "-31.094009, -64.482027",
                loc: "La Falda",
              },
              {
                id: "210",
                name: "Farmacias General Paz",
                address: "Lucas V. Córdoba 240",
                phone: "3547-586-849",
                coordenates: "-31.654952, -64.434216",
                loc: "Alta Gracia",
              },
            ],
  
            // -----------------------------------------
  
            farmaciasGenericas: [
              {
                id: "501",
                name: "Farmacia Lamarca",
                address: "Av. Lamarca 3918",
                phone: "351-482-5206",
                coordenates: "-31.383890, -64.239699",
                loc: "Córdoba Capital",
              },
              {
                id: "502",
                name: "Farmacia Ciudad",
                address: "Av. Pablo Richieri 2657",
                phone: "351-464-7227",
                coordenates: "-31.441894, -64.176762",
                loc: "Córdoba Capital",
              },
              {
                id: "503",
                name: "Farmacia Cristo Redentor",
                address: "Av. Nores Martínez 2836",
                phone: "351-464-5655",
                coordenates: "-31.444584, -64.182843",
                loc: "Córdoba Capital",
              },
            ],
          },
          chaco: {
            farmaciasRedGeneralPaz: [
              {
                id: "601",
                name: "Farmacias Red General Paz",
                address: "Santa Fe 124",
                phone: "362-445-1962",
                coordenates: "-27.448402, -58.985760",
                loc: "Resistencia",
              },
            ],
          },
          misiones: {
            farmaciasRedGeneralPaz: [
              {
                id: "701",
                name: "Farmacias Red General Paz",
                address: "San Martín 2275",
                phone: "376-442-7222",
                coordenates: "-27.365593, -55.898499",
                loc: "Posadas",
              },
              {
                id: "702",
                name: "Farmacias Red General Paz",
                address: "Felix de Azara y Entre Ríos",
                phone: "376-443-1122",
                coordenates: "-27.369743, -55.894005",
                loc: "Posadas",
              },
            ],
            farmaciasGeneralPaz: [
              {
                id: "703",
                name: "Farmacias General Paz",
                address: "HiperLibertad L.16",
                phone: "376-477-6037",
                coordenates: "-27.401787, -55.917162",
                loc: "Posadas",
              },
            ],
          },
        },
        opticas: {
          cordoba: {
            capital: [
              {
                id: "1001",
                name: "Óptica",
                address: "Av. Rafael Núñez 4684",
                coordenates: "-31.362126, -64.237360",
                loc: "Córdoba Capital",
              },
              {
                id: "1002",
                name: "Óptica Megalent",
                address: "9 de julio 460",
                coordenates: "-31.412917, -64.189655",
                loc: "Córdoba Capital",
              },
              {
                id: "1003",
                name: "Óptica",
                address: "Bv. Los Alemanes 5020",
                coordenates: "-31.343297, -64.234090",
                loc: "Córdoba Capital",
              },
              {
                id: "1004",
                name: "Óptica Elvira",
                address: "Deán Funes 328",
                coordenates: "-31.414680, -64.188426",
                loc: "Córdoba Capital",
              },
              {
                id: "1005",
                name: "Óptica",
                address: "Mariano Fragueiro 2143",
                coordenates: "-31.390626, -64.183874",
                loc: "Córdoba Capital",
              },
              {
                id: "1006",
                name: "Óptica",
                address: "Av. Alvarado 3654",
                coordenates: "-31.455809, -64.132416",
                loc: "Córdoba Capital",
              },
              {
                id: "1007",
                name: "Óptica",
                address: "27 de abril 230",
                coordenates: "-31.416183, -64.187686",
                loc: "Córdoba Capital",
              },
              {
                id: "1008",
                name: "Óptica Clinivisión",
                address: "Buenos Aires 1022",
                coordenates: "-31.428058, -64.187612",
                loc: "Córdoba Capital",
              },
              {
                id: "1009",
                name: "Óptica Mediterránea",
                address: "Belgrano 55",
                coordenates: "-31.415323, -64.188309",
                loc: "Córdoba Capital",
              },
              {
                id: "1010",
                name: "Óptica",
                address: "Caseros 561",
                coordenates: "-31.416668, -64.192980",
                loc: "Córdoba Capital",
              },
              {
                id: "1011",
                name: "Óptica Bustos",
                address: "Carlos Gimnénez 64",
                coordenates: "-31.366866, -64.165523",
                loc: "Córdoba Capital",
              },
              {
                id: "1012",
                name: "Óptica",
                address: "Caseros 329",
                coordenates: "-31.417093, -64.189560",
                loc: "Córdoba Capital",
              },
              {
                id: "1013",
                name: "Óptica",
                address: "Ricardo López Cabrera 2950",
                coordenates: "-31.461621, -64.157627",
                loc: "Córdoba Capital",
              },
              {
                id: "1014",
                name: "Óptica",
                address: "Oncativo 1311",
                coordenates: "-31.409374, -64.167411",
                loc: "Córdoba Capital",
              },
              {
                id: "1015",
                name: "Óptica Multiglas",
                address: "Santa Rosa 367",
                coordenates: "-31.411209, -64.187479",
                loc: "Córdoba Capital",
              },
              {
                id: "1016",
                name: "Óptica",
                address: "Sucre 45",
                coordenates: "-31.413948, -64.189329",
                loc: "Córdoba Capital",
              },
              {
                id: "1017",
                name: "Óptica",
                address: "Av. Vélez Sársfield",
                coordenates: "",
                loc: "Córdoba Capital",
              },
              {
                id: "1018",
                name: "Óptica",
                address: "9 de julio 714",
                coordenates: "-31.411972, -64.193337",
                loc: "Córdoba Capital",
              },
              {
                id: "1019",
                name: "Óptica",
                address: "Pje. Güemes 969",
                coordenates: "-31.404494, -64.164425",
                loc: "Córdoba Capital",
              },
              {
                id: "1020",
                name: "Óptica",
                address: "Mariano Fragueiro 2070",
                coordenates: "-31.391730, -64.183847",
                loc: "Córdoba Capital",
              },
              {
                id: "1021",
                name: "Óptica Valle Visión",
                address: "Deán Funes 398",
                coordenates: "-31.414428, -64.189268",
                loc: "Córdoba Capital",
              },
              {
                id: "1022",
                name: "Óptica Ver Bien",
                address: "Av. Colón 3500",
                coordenates: "",
                loc: "Córdoba Capital",
              },
              {
                id: "1023",
                name: "Óptica Planet Gafas",
                address: "Liberta 1051 loc. 430",
                coordenates: "",
                loc: "Córdoba Capital",
              },
            ],
  
            // -----------------------------------------
  
            interior: [
              {
                id: "1022",
                name: "Óptica",
                address: "Salvador Acavuzzo 125",
                coordenates: "-32.197446, -64.253454",
                loc: "Almafuerte",
              },
              {
                id: "1023",
                name: "Óptica +Visión",
                address: "Urquiza 77",
                coordenates: "-31.658663, -64.429680",
                loc: "Alta Gracia",
              },
              {
                id: "1024",
                name: "Óptica",
                address: "Tristán Cornejo 301",
                coordenates: "-31.013476, -62.666089",
                loc: "Balnearia",
              },
              {
                id: "1025",
                name: "Óptica",
                address: "Bv. 9 de julio 1157",
                coordenates: "-31.168285, -62.103229",
                loc: "Freyre",
              },
              {
                id: "1026",
                name: "Óptica Bienteveo",
                address: "Juan B. Justo 9688",
                coordenates: "-31.311319, -64.175886",
                loc: "Guiñazú",
              },
              {
                id: "1027",
                name: "Óptica",
                address: "San Martín 234",
                coordenates: "-32.427656, -63.734096",
                loc: "Hernando",
              },
              {
                id: "1028",
                name: "Óptica",
                address: "Rivadavia 150",
                coordenates: "-31.414764, -64.181803",
                loc: "La Cumbre",
              },
              {
                id: "1029",
                name: "Óptica",
                address: "Rivadavia 906",
                coordenates: "-30.895415, -63.000701",
                loc: "La Para",
              },
              {
                id: "1030",
                name: "Óptica",
                address: "9 de julio 342",
                coordenates: "-31.779273, -63.805960",
                loc: "Laguna Larga",
              },
              {
                id: "1031",
                name: "Óptica",
                address: "J. B. Alberdi 1743",
                coordenates: "-31.676835, -63.883517",
                loc: "Pilar",
              },
              {
                id: "1032",
                name: "Óptica",
                address: "Lamadrid esq. Belgrano",
                coordenates: "-33.124298, -64.344350",
                loc: "Río Cuarto",
              },
              {
                id: "1033",
                name: "Óptica",
                address: "Bélice 326",
                coordenates: "-31.653625, -63.897376",
                loc: "Río Segundo",
              },
              {
                id: "1034",
                name: "Óptica Infinity",
                address: "Sobremonte 887",
                coordenates: "-31.650746, -63.905952",
                loc: "Río Segundo",
              },
              {
                id: "1035",
                name: "Óptica",
                address: "Caseros 780",
                coordenates: "-31.151982, -63.402880",
                loc: "Santa Rosa de Río Primero",
              },
              {
                id: "1036",
                name: "Óptica",
                address: "Av. San Martín 502",
                coordenates: "-32.242852, -63.981798",
                loc: "Tancacha",
              },
              {
                id: "1037",
                name: "Óptica Passeri",
                address: "Av. Padre Mariani esq. Tablada",
                coordenates: "-31.293731, -64.292689",
                loc: "Villa Allende",
              },
              {
                id: "1038",
                name: "Óptica",
                address: "Av. Julio A. Roca 8",
                coordenates: "-31.977740, -64.559323",
                loc: "Villa General Belgrano",
              },
              {
                id: "1039",
                name: "Óptica Pérez",
                address: "Corrientes 1017",
                coordenates: "-32.412606, -63.243635",
                loc: "Villa María",
              },
              {
                id: "1040",
                name: "Óptica Optivisión",
                address: "9 de julio 1830",
                phone: "3468-472-842",
                coordenates: "-33.204706, -62.601392",
                loc: "Monte Maíz",
              },
              {
                id: "1044",
                name: "Óptica Carasa",
                address: "Córdoba 440",
                phone: "3537-425-550",
                coordenates: "-32.629779, -62.691859",
                loc: "Bell Ville",
              },
              {
                id: "1041",
                name: "Óptica Diez Décimas",
                address: "General Paz 342",
                phone: "3472-436-821",
                coordenates: "-32.662093, -62.298533",
                loc: "Leones",
              },
              {
                id: "1042",
                name: "Óptica Llamosas",
                address: "Jujuy 1449",
                phone: "3468-649-003",
                coordenates: "-33.205217, -62.602182",
                loc: "Monte Maíz",
              },
              {
                id: "1043",
                name: "Óptica Bertozzi",
                address: "Belgrano 853",
                phone: "3472-425-465",
                coordenates: "-32.696012, -62.103278",
                loc: "Marcos Juárez",
              },
              {
                id: "1044",
                name: "Óptica Canals",
                address: "Uriburu 553",
                phone: "3463-421-608",
                coordenates: "-31.482484, -64.206070",
                loc: "Canals",
              },
            ],
          },
  
          // -----------------------------------------
  
          buenosAires: [
            {
              id: "1501",
              name: "Óptica Visual",
              address: "Pellegrini 350",
              phone: "3361-430-907",
              coordenates: "-33.335031, -60.219098",
              loc: "San Nicolás",
            },
            {
              id: "1502",
              name: "Óptica Mutual Savio",
              address: "De La Nación 261",
              phone: "3364-427-886",
              coordenates: "-33.332437, -60.218775",
              loc: "San Nicolás",
            },
          ],
  
          // -----------------------------------------
  
          catamarca: [
            {
              id: "1101",
              name: "Óptica",
              address: "Rivadavia 880",
              coordenates: "-28.471754, -65.778101",
              loc: "San Fernando del Valle de Catamarca",
            },
          ],
  
          // -----------------------------------------
  
          corrientes: [
            {
              id: "1601",
              name: "Óptica Pizzio",
              address: "Belgrano 131",
              phone: "3775-498-535",
              coordenates: "-31.416304, -64.188578",
              loc: "Mocoretá",
            },
          ],
  
          // -----------------------------------------
  
          entreRios: [
            {
              id: "1201",
              name: "Óptica",
              address: "9 de julio 3715",
              coordenates: "-30.761778, -57.991836",
              loc: "Chajarí",
            },
            {
              id: "1202",
              name: "Óptica Cristal",
              address: "Av. Belgrano 1243",
              coordenates: "-30.758113, -57.980589",
              loc: "Chajarí",
            },
            {
              id: "1203",
              name: "Óptica",
              address: "Urquiza 1399",
              coordenates: "-30.759104, -57.984560",
              loc: "Chajarí",
            },
            {
              id: "1204",
              name: "Centro Óptico Pizzio",
              address: "San Martín 1110",
              coordenates: "-30.760330, -57.981548",
              loc: "Chajarí",
            },
            {
              id: "1205",
              name: "Óptica",
              address: "San Antonio 6",
              coordenates: "-33.146985, -59.312325",
              loc: "Gualeguay",
            },
            {
              id: "1206",
              name: "Óptica Reflejos",
              address: "Moreno 1170",
              coordenates: "-30.740312, -59.642024",
              loc: "La Paz",
            },
            {
              id: "1207",
              name: "Óptica",
              address: "Hipólito Yrigoyen 740",
              coordenates: "-31.663195, -59.902597",
              loc: "María Grande",
            },
            {
              id: "1208",
              name: "Óptica Ochoteco",
              address: "Alem 1192",
              coordenates: "-32.396024, -59.790358",
              loc: "Nogoyá",
            },
            {
              id: "1209",
              name: "Óptica",
              address: "San Juan 142",
              coordenates: "-31.731949, -60.526863",
              loc: "Paraná",
            },
            {
              id: "1210",
              name: "Óptica Santa Lucía",
              address: "Supremo Entrerrieno esq. Paraná",
              coordenates: "-30.946445, -59.787025",
              loc: "Santa Elena",
            },
            {
              id: "1211",
              name: "Óptica",
              address: "Av. Libertad 368",
              coordenates: "-32.685812, -58.889918",
              loc: "Urdinarrain",
            },
            {
              id: "1212",
              name: "Óptica Foto Óptica Ramírez",
              address: "Libertador 52",
              phone: "343-490-2238",
              coordenates: "-32.175079, -60.196747",
              loc: "General Ramírez",
            },
            {
              id: "1213",
              name: "Óptica Procolor",
              address: "Urquiza 99",
              phone: "345-491-1070",
              coordenates: "-31.625673, -58.504971",
              loc: "San Salvador",
            },
            {
              id: "1214",
              name: "Óptica Gamarra",
              address: "Toscanini 241",
              phone: "343-431-3389",
              coordenates: "-31.726936, -60.511156",
              loc: "Paraná",
            },
            {
              id: "1215",
              name: "Óptica Milena Bovier",
              address: "25 de mayo 1022",
              phone: "343-492-1055",
              coordenates: "-31.865317, -60.003438",
              loc: "Viale",
            },
          ],
  
          // -----------------------------------------
  
          santaFe: [
            {
              id: "1401",
              name: "Optica Focus",
              address: "Calle 9 403",
              coordenates: "-29.116153, -59.659253",
              loc: "Avellaneda",
            },
            {
              id: "1402",
              name: "Óptica",
              address: "Av. Cordoba 2020",
              coordenates: "-31.447787, -60.935181",
              loc: "Esperanza",
            },
            {
              id: "1403",
              name: "Óptica Centro",
              address: "Habegger 856",
              coordenates: "-29.146208, -59.647080",
              loc: "Reconquista",
            },
            {
              id: "1404",
              name: "Óptica",
              address: "General Lopez 898",
              coordenates: "-29.148353, -59.647856",
              loc: "Reconquista",
            },
            {
              id: "1405",
              name: "Óptica Moon",
              address: "Urquiza 190",
              coordenates: "-30.362947, -61.919141",
              loc: "San Guillermo",
            },
            {
              id: "1406",
              name: "Óptica",
              address: "9 de Julio 390",
              coordenates: "-30.536488, -61.962272",
              loc: "Suardi",
            },
            {
              id: "1407",
              name: "Óptica Esperanza",
              address: "Av. Los Colonizadores 1315",
              phone: "3496-545-984",
              coordenates: "-31.449163, -60.928508",
              loc: "Esperanza",
            },
            {
              id: "1408",
              name: "Óptica Cresta",
              address: "Uriburu 553",
              phone: "3402-470-454",
              coordenates: "-33.191950, -60.470010",
              loc: "Fighiera",
            },
            {
              id: "1409",
              name: "Óptica Arévalo",
              address: "Roque Sáenz Peña 1254",
              phone: "3401-448-057",
              coordenates: "-32.368830, -61.353663",
              loc: "San Genaro",
            },
            {
              id: "1410",
              name: "Óptica Rosario",
              address: "Oroño 567",
              phone: "341-425-4667",
              coordenates: "-32.941110, -60.652441",
              loc: "Rosario",
            },
            {
              id: "1411",
              name: "Óptica La Mio Pía",
              address: "Ovidio Lagos 1143",
              phone: "341-421-2381",
              coordenates: "-32.946459, -60.662509",
              loc: "Rosario",
            },
            {
              id: "1412",
              name: "Óptica C. O. Integral",
              address: "Sarmiento 1162",
              phone: "3406-444-336",
              coordenates: "-31.896691, -61.858555",
              loc: "San Jorge",
            },
            {
              id: "1413",
              name: "Óptica Chabas",
              address: "Santa Fe 1665",
              phone: "3464-481-301",
              coordenates: "-33.245096, -61.363467",
              loc: "Chabas",
            },
            {
              id: "1414",
              name: "Óptica Schellhas",
              address: "Buenos Aires 2201",
              phone: "3464-423-216",
              coordenates: "-33.045126, -61.167178",
              loc: "Casilda",
            },
            {
              id: "1415",
              name: "Óptica Solares",
              address: "Roberto Ferrari 9",
              phone: "341-478-3702",
              coordenates: "-32.818088, -60.716412",
              loc: "Capitán Bermúdez",
            },
            {
              id: "1416",
              name: "Óptica La Óptica",
              address: "Belgrano 399",
              phone: "3402-420-511",
              coordenates: "-33.159089, -60.509843",
              loc: "Arroyo Seco",
            },
            {
              id: "1417",
              name: "Óptica Argentina Exp",
              address: "Perón 2193",
              phone: "341-498-5757",
              coordenates: "-33.025295, -60.624482",
              loc: "Villa G. Galvez",
            },
            {
              id: "1418",
              name: "Óptica Focus",
              address: "Zeballos 2191",
              phone: "341-213-4744",
              coordenates: "-32.952388, -60.655294",
              loc: "Rosario",
            },
            {
              id: "1419",
              name: "Óptica Closa",
              address: "Moreno 778",
              phone: "3402-491-404",
              coordenates: "-33.313777, -60.604352",
              loc: "Coronel Bogado",
            },
            {
              id: "1420",
              name: "Óptica Boano",
              address: "Calle 52 116",
              phone: "3462-452-191",
              coordenates: "-34.003462, -61.605706",
              loc: "Villa Cañas",
            },
            {
              id: "1421",
              name: "Óptica San Martín",
              address: "San Martín 180",
              phone: "3462-430-034",
              coordenates: "-33.750522, -61.962083",
              loc: "Venado Tuerto",
            },
            {
              id: "1044",
              name: "Óptica Joaquín",
              address: "Tucumán esq. Mitre",
              phone: "341-649-7790",
              coordenates: "-30.144051, -60.338362",
              loc: "Vera y Pintado",
            },
            {
              id: "1044",
              name: "Óptica Alfieri",
              address: "Caminos 829",
              phone: "3466-498-262",
              coordenates: "-32.352751, -60.942516",
              loc: "Monje",
            },
            {
              id: "1044",
              name: "Óptica Stylovision",
              address: "San Martín 273",
              phone: "2473-481-372",
              coordenates: "-33.791060, -61.210337",
              loc: "Whellwright",
            },
            {
              id: "1044",
              name: "Óptica Argentina",
              address: "Juan B. Justo 2137",
              phone: "341-492-1649",
              coordenates: "-33.025272, -60.622935",
              loc: "Villa Gob. Gálvez",
            },
            {
              id: "1044",
              name: "Óptica Dimensión",
              address: "Mendoza 1595",
              phone: "341-679-9933",
              coordenates: "-32.950422, -60.646255",
              loc: "Rosario",
            },
            {
              id: "1044",
              name: "Óptica Contacto Visual",
              address: "Garibaldi 646",
              phone: "3465-472-435",
              coordenates: "",
              loc: "Alcorta",
            },
          ],
  
          // -----------------------------------------
  
          santiagoDelEstero: [
            {
              id: "1401",
              name: "Óptica Bella Vista",
              address: "Tucumán 227",
              coordenates: "-27.784365, -64.261642",
              loc: "Santiago del Estero",
            },
          ],
        },
      },
    ],
  };
  
  // -----------------------------------------
  
  const DATA = locales.data[0];
  
  //farmacias
  
  //farmacias lider
  const F_LIDER = [];
  DATA.farmacias.cordoba.farmaciasLider.forEach((item) => F_LIDER.push(item));
  
  //farmacias general paz
  const F_GENERAL_PAZ = [];
  DATA.farmacias.cordoba.farmaciasGeneralPaz.forEach((item) =>
    F_GENERAL_PAZ.push(item)
  );
  DATA.farmacias.misiones.farmaciasGeneralPaz.forEach((item) =>
    F_GENERAL_PAZ.push(item)
  );
  
  //farmacias sanchez antonioli
  const F_SANCHEZ_ANTONIOLI = [];
  DATA.farmacias.cordoba.farmaciasSanchezAntonioli.forEach((item) =>
    F_SANCHEZ_ANTONIOLI.push(item)
  );
  
  //farmacias red general paz
  const F_RED_GENERAL_PAZ = [];
  DATA.farmacias.cordoba.farmaciasRedGeneralPaz.forEach((item) =>
    F_RED_GENERAL_PAZ.push(item)
  );
  DATA.farmacias.chaco.farmaciasRedGeneralPaz.forEach((item) =>
    F_RED_GENERAL_PAZ.push(item)
  );
  DATA.farmacias.misiones.farmaciasRedGeneralPaz.forEach((item) =>
    F_RED_GENERAL_PAZ.push(item)
  );
  
  //farmacias genericas
  const F_GENERICAS = [];
  DATA.farmacias.cordoba.farmaciasGenericas.forEach((item) => {
    F_GENERICAS.push(item);
  });
  
  // -----------------------------------------
  
  //opticas
  
  // opticas cordoba
  const O_CBA_CAPITAL = [];
  DATA.opticas.cordoba.capital.forEach((item) => {
    O_CBA_CAPITAL.push(item);
  });
  
  const O_CBA_INTERIOR = [];
  DATA.opticas.cordoba.interior.forEach((item) => {
    O_CBA_INTERIOR.push(item);
  });
  
  // opticas catamarca
  const O_CATAMARCA = [];
  DATA.opticas.catamarca.forEach((item) => O_CATAMARCA.push(item));
  
  // opticas entre rios
  const O_ENTRE_RIOS = [];
  DATA.opticas.entreRios.forEach((item) => O_ENTRE_RIOS.push(item));
  
  // opticas santa fe
  const O_SANTA_FE = [];
  DATA.opticas.santaFe.forEach((item) => O_SANTA_FE.push(item));
  
  // opticas santiago del estero
  const O_SGO_DEL_ESTERO = [];
  DATA.opticas.santiagoDelEstero.forEach((item) => O_SGO_DEL_ESTERO.push(item));
  
  //opticas buenos aires
  const O_BS_AS = [];
  DATA.opticas.buenosAires.forEach((item) => O_BS_AS.push(item));
  
  //opticas corrientes
  const O_CORRIENTES = [];
  DATA.opticas.corrientes.forEach((item) => O_CORRIENTES.push(item));
  
  // -----------------------------------------
  
  // mapa
  
  let map = L.map("id-mapa").setView([-31.409619, -64.187965], 11);
  
  L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
    attribution:
      '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a><br/>JM-Cleaner 2020',
  }).addTo(map);
  
  // agregar marcadores verdes
  let greenIcon = new L.Icon({
    iconUrl: "../img/marker-icon-green.png",
    shadowUrl: "../img/marker-shadow.png",
    iconSize: [25, 41],
    iconAnchor: [12, 41],
    popupAnchor: [1, -34],
    shadowSize: [41, 41],
  });
  
  //marcadores farmacias
  
  //funcion para agregar los marcadores
  function agregarMarcadores(arrayDeLocales, color) {
    for (let i = 0; i < arrayDeLocales.length; i++) {
      if (arrayDeLocales[i].coordenates) {
        const X_COORD = parseFloat(arrayDeLocales[i].coordenates.slice(0, 10));
        const Y_COORD = parseFloat(arrayDeLocales[i].coordenates.slice(-11, -1));
        // console.log(
        //   `las coordenadas del local ${arrayDeLocales[i].id} son: ${X_COORD} ${Y_COORD}`
        // );
  
        switch (color) {
          case "blue":
            L.marker([X_COORD, Y_COORD]).addTo(map);
            break;
  
          case "green":
            L.marker([X_COORD, Y_COORD], { icon: greenIcon }).addTo(map);
            break;
  
          default:
            break;
        }
      }
    }
  }
  
  //funciones especificas para el marcador segun el color
  function agregarMarcadoresAzules(arrayDeLocales) {
    agregarMarcadores(arrayDeLocales, "blue");
  }
  
  function agregarMarcadoresVerdes(arrayDeLocales) {
    agregarMarcadores(arrayDeLocales, "green");
  }
  
  // agregando los marcadores a los distintos arrays de locales
  
  //farmacias
  agregarMarcadoresAzules(F_LIDER);
  agregarMarcadoresAzules(F_GENERAL_PAZ);
  agregarMarcadoresAzules(F_SANCHEZ_ANTONIOLI);
  agregarMarcadoresAzules(F_RED_GENERAL_PAZ);
  agregarMarcadoresAzules(F_GENERICAS);
  
  //opticas
  agregarMarcadoresVerdes(O_CBA_CAPITAL);
  agregarMarcadoresVerdes(O_CBA_INTERIOR);
  agregarMarcadoresVerdes(O_CATAMARCA);
  agregarMarcadoresVerdes(O_ENTRE_RIOS);
  agregarMarcadoresVerdes(O_SANTA_FE);
  agregarMarcadoresVerdes(O_SGO_DEL_ESTERO);
  agregarMarcadoresVerdes(O_BS_AS);
  agregarMarcadoresVerdes(O_CORRIENTES);
  
  // L.marker([-31.410237, -64.199145]).addTo(map);
  // .bindPopup("Aca tenes que elegir donde estan las farmacias, Hugo.")
  // .openPopup();
  
  // -----------------------------------------
  
  // barra de navegacion
  
  const navButton = document.querySelector(".nav-btn");
  const navMenu = document.querySelector(".nav-links");
  const header = document.querySelector("header");
  const tituloPagina = document.querySelector("#titulo-pagina");
  
  navButton.addEventListener("click", () => {
    navButton.classList.toggle("menuAbierto");
    navMenu.classList.toggle("menuAbierto");
    if (navMenu.classList.contains("menuAbierto")) {
      header.style.background = " rgba(255,255,255, .9)";
      header.style.height = "5rem";
      tituloPagina.style.color = "#000";
    }
    if (!navButton.classList.contains("menuAbierto")) {
      header.style.background =
        " linear-gradient(rgba(0, 0, 0, .9) 0%, rgba(255,255,255,0) 100%)";
      tituloPagina.style.color = "#fff";
      header.style.height = "10rem";
    }
  });
  
  // -----------------------------------------
  
  // go up button
  const goUpBtn = document.querySelector(".goTopBtn");
  
  goUpBtn.addEventListener("click", () => {
    window.scrollTo({
      top: 0,
      left: 0,
      behavior: "smooth",
    });
  });
  
  // -----------------------------------------
  
  // stores tab functionality
  
  const grid = document.querySelector(".locales-grilla");
  
  // function that iterates though a stores array and for each of them adds its content to the grid
  function insertTemplate(arrayDeObjetos) {
    arrayDeObjetos.forEach((local) => {
      const templateName = document.createElement("h6");
      const templateAddress = document.createElement("h6");
      const templatePhone = document.createElement("h6");
      const templateLoc = document.createElement("h6");
      const templateItem = document.createElement("div");
  
      templateName.classList.add("template-name");
      templateAddress.classList.add("template-address");
      templatePhone.classList.add("template-phone");
      templateLoc.classList.add("template-loc");
      templateItem.classList.add("template-item");
  
      let nameText = document.createTextNode(local.name);
      let addressText = document.createTextNode(local.address);
      let phoneText = document.createTextNode(local.phone);
      let locText = document.createTextNode(local.loc);
  
      templateName.appendChild(nameText);
      templateAddress.appendChild(addressText);
      templatePhone.appendChild(phoneText);
      templateLoc.appendChild(locText);
  
      templateItem.appendChild(templateName);
      templateItem.appendChild(templateAddress);
      if (local.loc) templateItem.appendChild(templateLoc);
      if (local.phone) templateItem.appendChild(templatePhone);
  
      grid.appendChild(templateItem);
    });
  }
  
  // selectors and menus
  
  const farmaciasTitle = document.querySelectorAll(".locales-titulos_item")[0];
  const opticasTitle = document.querySelectorAll(".locales-titulos_item")[1];
  
  const farmaciasSubtitle = document.querySelectorAll(".local-seccion")[0];
  const opticasSubtitle = document.querySelectorAll(".local-seccion")[1];
  
  function removeClass(element, classToRemove) {
    element.classList.remove(classToRemove);
  }
  function addClass(element, classToAdd) {
    element.classList.add(classToAdd);
  }
  
  farmaciasTitle.addEventListener("click", () => {
    if (!farmaciasTitle.classList.contains("selected-item")) {
      addClass(farmaciasTitle, "selected-item");
      removeClass(opticasTitle, "selected-item");
      removeClass(farmaciasSubtitle, "ocultar");
      addClass(opticasSubtitle, "ocultar");
    }
    subtitulosFarmacias.forEach((item) => {
      removeClass(item, "selected-item");
    });
    addClass(itemsFLider, "selected-item");
    grid.innerHTML = "";
    insertTemplate(F_LIDER);
  });
  
  opticasTitle.addEventListener("click", () => {
    if (!opticasTitle.classList.contains("selected-item")) {
      addClass(opticasTitle, "selected-item");
      removeClass(farmaciasTitle, "selected-item");
      addClass(farmaciasSubtitle, "ocultar");
      removeClass(opticasSubtitle, "ocultar");
    }
    subtitulosOpticas.forEach((item) => {
      removeClass(item, "selected-item");
    });
    addClass(itemsOCCap, "selected-item");
    grid.innerHTML = "";
    insertTemplate(O_CBA_CAPITAL);
  });
  
  // inserting templates with stores in the stores tab
  
  // farmacias
  const itemsFLider = document.querySelectorAll(".local-seccion_cadenas h5")[0];
  const itemsFGralPaz = document.querySelectorAll(".local-seccion_cadenas h5")[1];
  const itemsFSanchezA = document.querySelectorAll(
    ".local-seccion_cadenas h5"
  )[2];
  const itemsFRGralPaz = document.querySelectorAll(
    ".local-seccion_cadenas h5"
  )[3];
  const itemsFIndep = document.querySelectorAll(".local-seccion_cadenas h5")[4];
  
  // opticas
  const itemsOCCap = document.querySelectorAll(".local-seccion_cadenas h5")[5];
  const itemsOCInt = document.querySelectorAll(".local-seccion_cadenas h5")[6];
  const itemsBsAs = document.querySelectorAll(".local-seccion_cadenas h5")[7];
  const itemsOCata = document.querySelectorAll(".local-seccion_cadenas h5")[8];
  const itemsCorri = document.querySelectorAll(".local-seccion_cadenas h5")[9];
  const itemsOEnRi = document.querySelectorAll(".local-seccion_cadenas h5")[10];
  const itemsOSaFe = document.querySelectorAll(".local-seccion_cadenas h5")[11];
  const itemsOSgo = document.querySelectorAll(".local-seccion_cadenas h5")[12];
  
  const subtitulosFarmacias = [];
  subtitulosFarmacias.push(
    itemsFLider,
    itemsFGralPaz,
    itemsFSanchezA,
    itemsFRGralPaz,
    itemsFIndep
  );
  
  const subtitulosOpticas = [];
  subtitulosOpticas.push(
    itemsOCCap,
    itemsOCInt,
    itemsBsAs,
    itemsOCata,
    itemsCorri,
    itemsOEnRi,
    itemsOEnRi,
    itemsOSaFe,
    itemsOSgo
  );
  
  function resaltarTitulo(array) {
    array.forEach((item) => {
      item.addEventListener("click", () => {
        array.forEach((item) => {
          removeClass(item, "selected-item");
        });
        addClass(item, "selected-item");
      });
    });
  }
  
  resaltarTitulo(subtitulosFarmacias);
  resaltarTitulo(subtitulosOpticas);
  
  insertTemplate(F_LIDER);
  
  //farmacias
  itemsFLider.addEventListener("click", () => {
    grid.innerHTML = "";
    insertTemplate(F_LIDER);
  });
  
  itemsFGralPaz.addEventListener("click", () => {
    grid.innerHTML = "";
    insertTemplate(F_GENERAL_PAZ);
  });
  itemsFSanchezA.addEventListener("click", () => {
    grid.innerHTML = "";
    insertTemplate(F_SANCHEZ_ANTONIOLI);
  });
  itemsFRGralPaz.addEventListener("click", () => {
    grid.innerHTML = "";
    insertTemplate(F_RED_GENERAL_PAZ);
  });
  itemsFIndep.addEventListener("click", () => {
    grid.innerHTML = "";
    insertTemplate(F_GENERICAS);
  });
  
  //opticas
  itemsOCCap.addEventListener("click", () => {
    grid.innerHTML = "";
    insertTemplate(O_CBA_CAPITAL);
  });
  itemsOCInt.addEventListener("click", () => {
    grid.innerHTML = "";
    insertTemplate(O_CBA_INTERIOR);
  });
  itemsBsAs.addEventListener("click", () => {
    grid.innerHTML = "";
    insertTemplate(O_BS_AS);
  });
  itemsOCata.addEventListener("click", () => {
    grid.innerHTML = "";
    insertTemplate(O_CATAMARCA);
  });
  itemsCorri.addEventListener("click", () => {
    grid.innerHTML = "";
    insertTemplate(O_CORRIENTES);
  });
  itemsOEnRi.addEventListener("click", () => {
    grid.innerHTML = "";
    insertTemplate(O_ENTRE_RIOS);
  });
  itemsOSaFe.addEventListener("click", () => {
    grid.innerHTML = "";
    insertTemplate(O_SANTA_FE);
  });
  itemsOSgo.addEventListener("click", () => {
    grid.innerHTML = "";
    insertTemplate(O_SGO_DEL_ESTERO);
  });
  