{"version":3,"sources":["jsdelivr-header.js","/npm/leaflet-choropleth@1.1.4/src/choropleth.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,IAAI,EAAI,QAAQ,WACZ,OAAS,QAAQ,aACjB,EAAI,QAAQ,iBAEhB,EAAE,WAAa,OAAO,QAAU,SAAU,EAAS,GACjD,EAAO,GAAQ,CAAC,EAGhB,EAAE,SAAS,EAAM,CACf,cAAe,QACf,MAAO,CAAC,QAAS,OACjB,MAAO,EACP,KAAM,MAIR,IAAI,EAAY,EAAK,MAGjB,EAAS,EAAQ,SAAS,IACE,mBAAvB,EAAK,cACZ,EAAK,cACL,SAAU,GACR,OAAO,EAAK,WAAW,EAAK,cAC9B,GACE,EAAS,OAAO,OAAO,EAAQ,EAAK,KAAM,EAAK,MAAQ,GAGvD,EAAU,EAAK,QAAU,EAAK,OAAO,SAAW,EAAO,OAC7C,EAAK,OACL,OAAO,MAAM,EAAK,OAAO,OAAO,EAAO,QAErD,OAAO,EAAE,QAAQ,EAAS,EAAE,OAAO,EAAM,CACvC,OAAQ,EACR,OAAQ,EACR,MAAO,SAAU,GACf,IACI,EADA,EAAQ,CAAC,EASb,GALE,EADgC,mBAAvB,EAAK,cACC,EAAK,cAAc,GAEnB,EAAQ,WAAW,EAAK,gBAGpC,MAAM,GAET,IAAK,IAAI,EAAI,EAAG,EAAI,EAAO,OAAQ,IACjC,GAAI,GAAgB,EAAO,GAAI,CAC7B,EAAM,UAAY,EAAO,GACzB,KACF,CAKJ,cAAe,GACb,IAAK,WACH,OAAO,EAAE,SAAS,EAAO,EAAU,IACrC,IAAK,SACH,OAAO,EAAE,SAAS,EAAO,GAC3B,QACE,OAAO,EAEb,IAEJ","file":"/npm/leaflet-choropleth@1.1.4/src/choropleth.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.37.0.\n * Original file: /npm/leaflet-choropleth@1.1.4/src/choropleth.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","var L = require('leaflet')\nvar chroma = require('chroma-js')\nvar _ = require('lodash/object')\n\nL.choropleth = module.exports = function (geojson, opts) {\n  opts = opts || {}\n\n  // Set default options in case any weren't passed\n  _.defaults(opts, {\n    valueProperty: 'value',\n    scale: ['white', 'red'],\n    steps: 5,\n    mode: 'q'\n  })\n\n  // Save what the user passed as the style property for later use (since we're overriding it)\n  var userStyle = opts.style\n\n  // Calculate limits\n  var values = geojson.features.map(\n    typeof opts.valueProperty === 'function' ?\n    opts.valueProperty :\n    function (item) {\n      return item.properties[opts.valueProperty]\n    })\n  var limits = chroma.limits(values, opts.mode, opts.steps - 1)\n\n  // Create color buckets\n  var colors = (opts.colors && opts.colors.length === limits.length ?\n                opts.colors :\n                chroma.scale(opts.scale).colors(limits.length))\n\n  return L.geoJson(geojson, _.extend(opts, {\n    limits: limits,\n    colors: colors,\n    style: function (feature) {\n      var style = {}\n      var featureValue\n\n      if (typeof opts.valueProperty === 'function') {\n        featureValue = opts.valueProperty(feature)\n      } else {\n        featureValue = feature.properties[opts.valueProperty]\n      }\n\n      if (!isNaN(featureValue)) {\n        // Find the bucket/step/limit that this value is less than and give it that color\n        for (var i = 0; i < limits.length; i++) {\n          if (featureValue <= limits[i]) {\n            style.fillColor = colors[i]\n            break\n          }\n        }\n      }\n\n      // Return this style, but include the user-defined style if it was passed\n      switch (typeof userStyle) {\n        case 'function':\n          return _.defaults(style, userStyle(feature))\n        case 'object':\n          return _.defaults(style, userStyle)\n        default:\n          return style\n      }\n    }\n  }))\n}\n"]}