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G,EAAI,EAAM,KAAK,GAAG,cAAc,OAAQ,IAAK,CAC3D,IAAI,EAAK,EAAM,KAAK,GAAG,aAAa,GAAG,WACnC,EAAK,EAAM,KAAK,GAAG,aAAa,GAAG,mBAEvC,EAAgB,GAAa,EAAiB,GAAM,KAAK,MAAM,EAAY,GAAM,GACjF,GAChB,CACA,CAQY,GANA,EAAO,eAAiB,GAAa,GACrC,EAAO,UAAY,EAAO,gBAAkB,EAE5C,EAAgB,GAAa,EAAO,YAAY,OAAS,EACzD,EAAO,gBAAkB,GAEpB,EAAQ,aAEX,IADA,EAAO,aAAe,GACjB,EAAI,EAAG,EAAI,EAAM,KAAK,OAAQ,IACjC,IAAK,EAAI,EAAG,EAAI,EAAM,KAAK,GAAG,MAAM,OAAQ,IAC1C,EAAO,EAAM,KAAK,GAAG,MAAM,GAC3B,EAAO,aAAa,KAAK,CACvB,KAAM,EAAK,2BAA2B,EAAK,UAC3C,KAAM,EAAK,aAAa,QAAQ,iBAAkB,IAClD,SAAU,EAAK,SAAS,MACxB,KAAM,EAAK,SAAS,MACpB,MAAO,EAAQ,GAAG,GAClB,KAAM,OAId,OAAO,CACnB,IACU,EAAS,KAAK,GAAW,EAAU,KAAM,EACnD,MACa,EAAS,KAAK,EAAS,CAC1B,OAAQ,EACR,QAAS,GAEnB,IACa,IACb","file":"/npm/lrm-google-router@1.2.0/lrm-google.js/+esm","sourceRoot":"","sourcesContent":["/**\n * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.\n * Original file: /npm/lrm-google-router@1.2.0/lrm-google.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","(function () {\n  L.Routing.Google = L.Class.extend({\n    options: {},\n\n    initialize: function (options) {\n      this.options = L.extend(this.options, {\n        travelMode: google.maps.TravelMode.DRIVING,\n        unitSystem: google.maps.UnitSystem.METRIC,\n        provideRouteAlternatives: true\n      });\n\n      this.directionsService = new google.maps.DirectionsService();\n\n      L.Util.setOptions(this, options);\n    },\n\n    _flatten: function (arrs) {\n      var arr = [],\n        i;\n      for (i = 0; i < arrs.length; i++) arr = arr.concat(arrs[i]);\n      return arr;\n    },\n\n    _decodePolyline: function (geometry) {\n      var coords = polyline.decode(geometry, 5),\n        latlngs = new Array(coords.length),\n        i;\n      for (i = 0; i < coords.length; i++) {\n        latlngs[i] = new L.LatLng(coords[i][0], coords[i][1]);\n      }\n\n      return latlngs;\n    },\n\n    _maneuverToInstructionType: function (maneuver) {\n      switch (maneuver) {\n        case 'turn-right':\n          return 'Right';\n        case 'turn-slight-right':\n        case 'ramp-right':\n        case 'fork-right':\n          return 'SlightRight';\n        case 'turn-sharp-right':\n          return 'SharpRight';\n        case 'turn-left':\n          return 'Left';\n        case 'turn-slight-left':\n        case 'ramp-left':\n        case 'fork-left':\n          return 'SlightLeft';\n        case 'turn-sharp-left':\n          return 'SharpLeft';\n        case 'uturn-right':\n        case 'uturn-left':\n          return 'TurnAround';\n        case 'roundabout-left':\n        case 'roundabout-right':\n          return 'Roundabout';\n        default:\n          return 'Straight';\n      }\n    },\n\n    route: function (waypoints, callback, context, options) {\n      var that = this;\n      var directions = L.extend({}, this.options);\n      if (options.geometryOnly) {\n        directions.provideRouteAlternatives = false;\n      }\n      directions.origin = waypoints[0].latLng.lat + ',' + waypoints[0].latLng.lng;\n      directions.destination = waypoints[waypoints.length - 1].latLng.lat + ',' + waypoints[waypoints.length - 1].latLng.lng;\n      directions.waypoints =\n        waypoints.slice(1, waypoints.length - 1).map(function (waypoint) {\n          return {\n            location: waypoint.latLng.lat + ',' + waypoint.latLng.lng,\n            stopover: false\n          };\n        });\n\n      this.directionsService.route(directions, function (result, status) {\n        if (status == google.maps.DirectionsStatus.OK) {\n          var r = result.routes.map(function (route) {\n            var iroute = {}, i, j, step, points;\n            iroute.name = route.summary;\n            iroute.summary = {\n              totalDistance: that._flatten(route.legs.map(function (leg) {\n                return leg.steps.map(function (step) {\n                  return step.distance.value;\n                });\n              })).reduce(function (previousValue, currentValue) {\n                return previousValue + currentValue;\n              }),\n              totalTime: that._flatten(route.legs.map(function (leg) {\n                return leg.steps.map(function (step) {\n                  return step.duration.value;\n                });\n              })).reduce(function (previousValue, currentValue) {\n                return previousValue + currentValue;\n              })\n            };\n\n            iroute.coordinates = [];\n            var indices = [], indicesSecondary = [];\n\n            var waypointIndices = [0];\n            var nWaypoint = 1;\n\n            for (i = 0; i < route.legs.length; i++) {\n              indicesSecondary = [];\n              var stepsPoints = [];\n\n              for (j = 0; j < route.legs[i].steps.length; j++) {\n                step = route.legs[i].steps[j];\n                points = that._decodePolyline(step.polyline.points);\n                stepsPoints[j] = points.length;\n                indicesSecondary.push(iroute.coordinates.length);\n                iroute.coordinates = iroute.coordinates.concat(points);\n              }\n              indices.push(indicesSecondary);\n\n              for (var j = 0; j < route.legs[i].via_waypoints.length; j++) {\n                var si = route.legs[i].via_waypoint[j].step_index;\n                var sp = route.legs[i].via_waypoint[j].step_interpolation;\n\n                waypointIndices[nWaypoint] = indicesSecondary[si] + Math.floor(stepsPoints[si] * sp);\n                nWaypoint++;\n              }\n            }\n\n            iroute.inputWaypoints = waypoints || [];\n            iroute.waypoints = iroute.actualWaypoints = waypoints;\n\n            waypointIndices[nWaypoint] = iroute.coordinates.length - 1;\n            iroute.waypointIndices = waypointIndices;\n\n            if (!options.geometryOnly) {\n              iroute.instructions = [];\n              for (i = 0; i < route.legs.length; i++)\n                for (j = 0; j < route.legs[i].steps.length; j++) {\n                  step = route.legs[i].steps[j];\n                  iroute.instructions.push({\n                    type: that._maneuverToInstructionType(step.maneuver),\n                    text: step.instructions.replace(/<(?:.|\\n)*?>/gm, ''),\n                    distance: step.distance.value,\n                    time: step.duration.value,\n                    index: indices[i][j],\n                    exit: null//instr.exit_number\n                  });\n                }\n            }\n            return iroute;\n          });\n          callback.call(context || callback, null, r);\n        }\n        else callback.call(context, {\n          status: status,\n          message: result\n        });\n      });\n      return this;\n    }\n  });\n})();\n"]}