@redus/georedus-ui 0.20.2 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/main.js +1271 -217
  3. package/dist/viewSpecs/presets/index.d.ts +5 -0
  4. package/dist/viewSpecs/presets/raster_categorical/index.d.ts +34 -0
  5. package/dist/viewSpecs/presets/raster_categorical/layers.d.ts +15 -0
  6. package/dist/viewSpecs/presets/raster_categorical/parseStyleSpec.d.ts +12 -0
  7. package/dist/viewSpecs/presets/raster_categorical/sources.d.ts +9 -0
  8. package/dist/viewSpecs/presets/util/components/confInputs/categoricalColorSchemeSelector.d.ts +13 -0
  9. package/dist/viewSpecs/presets/util/components/{confInputs.d.ts → confInputs/colorSelector.d.ts} +0 -16
  10. package/dist/viewSpecs/presets/util/components/confInputs/continuousColorSchemeSelector.d.ts +11 -0
  11. package/dist/viewSpecs/presets/util/components/confInputs/fillPatternSelector.d.ts +16 -0
  12. package/dist/viewSpecs/presets/util/components/confInputs/index.d.ts +7 -0
  13. package/dist/viewSpecs/presets/util/components/confInputs/linePatternSelector.d.ts +18 -0
  14. package/dist/viewSpecs/presets/util/components/confInputs/lineWidthSelector.d.ts +18 -0
  15. package/dist/viewSpecs/presets/util/components/confInputs/opacitySlider.d.ts +11 -0
  16. package/dist/viewSpecs/presets/vector_heatmap/confSchema.d.ts +22 -0
  17. package/dist/viewSpecs/presets/vector_heatmap/download.d.ts +9 -0
  18. package/dist/viewSpecs/presets/vector_heatmap/index.d.ts +70 -0
  19. package/dist/viewSpecs/presets/vector_heatmap/layers.d.ts +12 -0
  20. package/dist/viewSpecs/presets/vector_heatmap/metadata/index.d.ts +9 -0
  21. package/dist/viewSpecs/presets/vector_heatmap/parseStyleSpec.d.ts +17 -0
  22. package/dist/viewSpecs/presets/vector_heatmap/sources.d.ts +8 -0
  23. package/dist/viewSpecs/presets/vector_line/index.d.ts +11 -1
  24. package/dist/viewSpecs/presets/vector_line_categorical/confSchema.d.ts +26 -0
  25. package/dist/viewSpecs/presets/vector_line_categorical/download.d.ts +9 -0
  26. package/dist/viewSpecs/presets/vector_line_categorical/index.d.ts +75 -0
  27. package/dist/viewSpecs/presets/vector_line_categorical/layers.d.ts +11 -0
  28. package/dist/viewSpecs/presets/vector_line_categorical/metadata.d.ts +11 -0
  29. package/dist/viewSpecs/presets/vector_line_categorical/parseStyleSpec.d.ts +15 -0
  30. package/dist/viewSpecs/presets/vector_line_categorical/sources.d.ts +7 -0
  31. package/dist/viewSpecs/presets/vector_line_single/confSchema.d.ts +85 -0
  32. package/dist/viewSpecs/presets/vector_line_single/download.d.ts +9 -0
  33. package/dist/viewSpecs/presets/vector_line_single/index.d.ts +124 -0
  34. package/dist/viewSpecs/presets/vector_line_single/layers.d.ts +11 -0
  35. package/dist/viewSpecs/presets/vector_line_single/metadata.d.ts +1 -0
  36. package/dist/viewSpecs/presets/vector_line_single/parseStyleSpec.d.ts +7 -0
  37. package/dist/viewSpecs/presets/vector_line_single/sources.d.ts +7 -0
  38. package/dist/viewSpecs/presets/vector_point_categorical/download.d.ts +9 -0
  39. package/dist/viewSpecs/presets/vector_point_categorical/index.d.ts +83 -0
  40. package/dist/viewSpecs/presets/vector_point_categorical/layers.d.ts +45 -0
  41. package/dist/viewSpecs/presets/vector_point_categorical/metadata/index.d.ts +11 -0
  42. package/dist/viewSpecs/presets/vector_point_categorical/parseStyleSpec.d.ts +14 -0
  43. package/dist/viewSpecs/presets/vector_point_categorical/sources.d.ts +8 -0
  44. package/dist/viewSpecs/presets/vector_point_continuous/index.d.ts +2 -0
  45. package/dist/viewSpecs/presets/vector_point_single/index.d.ts +2 -0
  46. package/dist/viewSpecs/presets/vector_point_single/parseStyleSpec.d.ts +0 -3
  47. package/dist/viewSpecs/presets/vector_polygon_categorical/confSchema.d.ts +19 -0
  48. package/dist/viewSpecs/presets/vector_polygon_categorical/index.d.ts +21 -0
  49. package/dist/viewSpecs/presets/vector_polygon_categorical/parseStyleSpec.d.ts +1 -1
  50. package/dist/viewSpecs/presets/vector_polygon_continuous/confSchema.d.ts +10 -2
  51. package/dist/viewSpecs/presets/vector_polygon_continuous/index.d.ts +21 -3
  52. package/dist/viewSpecs/presets/vector_polygon_continuous/layers.d.ts +9 -1
  53. package/dist/viewSpecs/presets/vector_polygon_continuous/parseStyleSpec.d.ts +0 -3
  54. package/dist/viewSpecs/presets/vector_polygon_single/confSchema.d.ts +9 -0
  55. package/dist/viewSpecs/presets/vector_polygon_single/index.d.ts +11 -0
  56. package/dist/viewSpecs/util/colorSchemes/d3.d.ts +1 -1
  57. package/dist/viewSpecs/util/colorSchemes/index.d.ts +1 -1
  58. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -2929,10 +2929,7 @@ var D3_SEQUENTIAL = {
2929
2929
  schemeYlOrBr: schemeYlOrBr,
2930
2930
  schemeYlOrRd: schemeYlOrRd
2931
2931
  };
2932
- var SCHEME_GEOREDUS = ['#FF7F00', '#CAB2D6', '#FFE551', '#39BBA7', '#FB9A99', '#B15928', '#FDBF6F', '#DA5AD8', '#B4B282', '#6A3D9A'];
2933
- var D3_COLOR_SCHEMES = __assign(__assign(__assign(__assign(__assign({
2934
- schemeGeoReDUS: SCHEME_GEOREDUS
2935
- }, _objMap(D3_CATEGORICAL, function (_a) {
2932
+ var D3_COLOR_SCHEMES = __assign(__assign(__assign(__assign(__assign({}, _objMap(D3_CATEGORICAL, function (_a) {
2936
2933
  var id = _a[0],
2937
2934
  scheme = _a[1];
2938
2935
  return [id, _categoricalScheme(scheme)];
@@ -3053,9 +3050,21 @@ function colorScheme(path) {
3053
3050
  function resolveColor(colorInput) {
3054
3051
  return colorInput ? get(COLOR_SCHEMES, colorInput) || colorInput : colorInput;
3055
3052
  }
3056
- function resolveSchemeColor(colorSchemeId, indexOrId) {
3053
+ function resolveCategoricalSchemeColor(colorSchemeId, indexOrId) {
3057
3054
  var colorScheme = COLOR_SCHEMES[colorSchemeId];
3058
- return typeof indexOrId === 'string' ? colorScheme[indexOrId] : (Array.isArray(colorScheme) ? colorScheme : Object.values(colorScheme))[indexOrId];
3055
+ // return typeof indexOrId === 'string'
3056
+ // ? colorScheme[indexOrId]
3057
+ // : (Array.isArray(colorScheme) ? colorScheme : Object.values(colorScheme))[
3058
+ // indexOrId
3059
+ // ]
3060
+ if (typeof indexOrId === 'string') {
3061
+ return colorScheme[indexOrId];
3062
+ }
3063
+ var values = Array.isArray(colorScheme) ? colorScheme : Array.isArray(colorScheme === null || colorScheme === void 0 ? void 0 : colorScheme.colors) ? colorScheme.colors : Object.values(colorScheme);
3064
+ if (typeof indexOrId === 'number' && indexOrId > values.length - 1) {
3065
+ console.warn('Index is higher than colorScheme size: will repeat colors');
3066
+ }
3067
+ return values[indexOrId % values.length];
3059
3068
  }
3060
3069
 
3061
3070
  //
@@ -3729,12 +3738,12 @@ function influenceAreaLayers(_a) {
3729
3738
  };
3730
3739
  }
3731
3740
 
3732
- var _excluded$e = ["version"];
3741
+ var _excluded$j = ["version"];
3733
3742
  function tableVectorSource(context, tableId) {
3734
3743
  var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
3735
3744
  _ref$version = _ref.version,
3736
3745
  version = _ref$version === void 0 ? '1' : _ref$version,
3737
- override = _objectWithoutProperties(_ref, _excluded$e);
3746
+ override = _objectWithoutProperties(_ref, _excluded$j);
3738
3747
  var VECTOR_TILE_SERVER_ENDPOINT = context.VECTOR_TILE_SERVER_ENDPOINT;
3739
3748
  return _objectSpread2({
3740
3749
  type: 'vector',
@@ -4067,7 +4076,7 @@ function cem_escolas_2022(config, allViewSpecs, context) {
4067
4076
  clearable: false,
4068
4077
  defaultValue: indicator_id
4069
4078
  },
4070
- showSize: sizing_variable_id ? {
4079
+ showSize: sizing_variable_id && sizing_variable_id != variable_id ? {
4071
4080
  label: 'Matrículas',
4072
4081
  type: 'booleanCheckbox',
4073
4082
  description: 'Tamanho proporcional à quantidade de matrículas',
@@ -4221,7 +4230,7 @@ function cem_escolas_2022(config, allViewSpecs, context) {
4221
4230
  key = _ref5[0],
4222
4231
  value = _ref5[1];
4223
4232
  return (
4224
- // Verifica se o nome da coluna termina com algum dos sufixos mapeados
4233
+ // Verifica se o nome da coluna termina com algum dos sufixos mapeados
4225
4234
  // E se o valor da coluna é "truthy" (maior que 0, true, etc)
4226
4235
  sufixos.some(function (sufixo) {
4227
4236
  return key.endsWith(sufixo);
@@ -4376,7 +4385,7 @@ function chartUtil(viewSpec, allViewSpecs, context) {
4376
4385
  }
4377
4386
 
4378
4387
  var DEFAULT_BUFFER_SIZE$1 = 200;
4379
- function confSchema$4(viewSpec, allViewSpecs, context, _ref) {
4388
+ function confSchema$7(viewSpec, allViewSpecs, context, _ref) {
4380
4389
  var PARSED_SCHEMA = _ref.PARSED_SCHEMA;
4381
4390
  var variable_id = viewSpec.variable_id;
4382
4391
  return {
@@ -4512,7 +4521,7 @@ var _resolveSourceBounds = resolve.fn(function (context) {
4512
4521
  return UNBOUNDED_BOUNDS;
4513
4522
  }
4514
4523
  });
4515
- function metadata$8(viewSpec, allViewSpecs, context, _ref2) {
4524
+ function metadata$c(viewSpec, allViewSpecs, context, _ref2) {
4516
4525
  var PARSED_SCHEMA = _ref2.PARSED_SCHEMA,
4517
4526
  DATA_UTIL = _ref2.DATA_UTIL,
4518
4527
  CHART_UTIL = _ref2.CHART_UTIL;
@@ -4973,7 +4982,7 @@ function setor_censitario(viewSpec, allViewSpecs, context, _ref) {
4973
4982
  };
4974
4983
  }
4975
4984
 
4976
- function download$6(viewSpec, allViewSpecs, context, _ref) {
4985
+ function download$a(viewSpec, allViewSpecs, context, _ref) {
4977
4986
  var PARSED_SCHEMA = _ref.PARSED_SCHEMA;
4978
4987
  var METADATA_API_ENDPOINT = context.METADATA_API_ENDPOINT;
4979
4988
  return downloadResolver({
@@ -5043,7 +5052,7 @@ function cem_censo_2010_2022(viewSpec, allViewSpecs, context) {
5043
5052
  PARSED_SCHEMA: PARSED_SCHEMA,
5044
5053
  DATA_UTIL: DATA_UTIL
5045
5054
  });
5046
- var DOWNLOAD = download$6(viewSpec, allViewSpecs, context, {
5055
+ var DOWNLOAD = download$a(viewSpec, allViewSpecs, context, {
5047
5056
  PARSED_SCHEMA: PARSED_SCHEMA
5048
5057
  });
5049
5058
  return {
@@ -5055,10 +5064,10 @@ function cem_censo_2010_2022(viewSpec, allViewSpecs, context) {
5055
5064
  sourceLabel: PARSED_SCHEMA.sourceLabel,
5056
5065
  keywords: PARSED_SCHEMA.keywords,
5057
5066
  viewType: VIEW_TYPE_SURFACE_CHOROPLETH,
5058
- confSchema: confSchema$4(viewSpec, allViewSpecs, context, {
5067
+ confSchema: confSchema$7(viewSpec, allViewSpecs, context, {
5059
5068
  PARSED_SCHEMA: PARSED_SCHEMA
5060
5069
  }),
5061
- metadata: metadata$8(viewSpec, allViewSpecs, context, {
5070
+ metadata: metadata$c(viewSpec, allViewSpecs, context, {
5062
5071
  PARSED_SCHEMA: PARSED_SCHEMA,
5063
5072
  CHART_UTIL: CHART_UTIL,
5064
5073
  DATA_UTIL: DATA_UTIL
@@ -5076,7 +5085,7 @@ function cem_censo_2010_2022(viewSpec, allViewSpecs, context) {
5076
5085
  };
5077
5086
  }
5078
5087
 
5079
- function download$5(context, _ref) {
5088
+ function download$9(context, _ref) {
5080
5089
  var PARSED_SCHEMA = _ref.PARSED_SCHEMA;
5081
5090
  var METADATA_API_ENDPOINT = context.METADATA_API_ENDPOINT;
5082
5091
  return downloadResolver({
@@ -5437,7 +5446,7 @@ function customGeoJson_layers(opts) {
5437
5446
  };
5438
5447
  }
5439
5448
 
5440
- function metadata$7(opts) {
5449
+ function metadata$b(opts) {
5441
5450
  return resolveAsync.fn(/*#__PURE__*/function () {
5442
5451
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(context) {
5443
5452
  var _context$view;
@@ -5711,7 +5720,7 @@ function setor_censitario_layers(opts) {
5711
5720
  }
5712
5721
 
5713
5722
  var intramun = {
5714
- metadata: metadata$7,
5723
+ metadata: metadata$b,
5715
5724
  sources: function sources(opts) {
5716
5725
  return _objectSpread2(_objectSpread2(_objectSpread2({}, setor_censitario_sources(opts)), buildings_sources(opts)), customGeoJson_sources());
5717
5726
  },
@@ -5721,7 +5730,7 @@ var intramun = {
5721
5730
  };
5722
5731
 
5723
5732
  var DEFAULT_COLOR_SCHEME$1 = COLOR_SCHEMES.schemeOranges;
5724
- function metadata$6(_ref) {
5733
+ function metadata$a(_ref) {
5725
5734
  var GLOBAL_CONTEXT = _ref.GLOBAL_CONTEXT,
5726
5735
  PARSED_SCHEMA = _ref.PARSED_SCHEMA;
5727
5736
  var METADATA_API_ENDPOINT = GLOBAL_CONTEXT.METADATA_API_ENDPOINT;
@@ -5846,7 +5855,7 @@ function municipio_layers$1() {
5846
5855
  }
5847
5856
 
5848
5857
  var intrauf = {
5849
- metadata: metadata$6,
5858
+ metadata: metadata$a,
5850
5859
  sources: function sources(opts) {
5851
5860
  return _objectSpread2({}, municipio_sources$1(opts));
5852
5861
  },
@@ -5856,7 +5865,7 @@ var intrauf = {
5856
5865
  };
5857
5866
 
5858
5867
  var DEFAULT_COLOR_SCHEME = COLOR_SCHEMES.schemeOranges;
5859
- function metadata$5(_ref) {
5868
+ function metadata$9(_ref) {
5860
5869
  var GLOBAL_CONTEXT = _ref.GLOBAL_CONTEXT,
5861
5870
  PARSED_SCHEMA = _ref.PARSED_SCHEMA;
5862
5871
  var METADATA_API_ENDPOINT = GLOBAL_CONTEXT.METADATA_API_ENDPOINT;
@@ -5976,7 +5985,7 @@ function municipio_layers() {
5976
5985
  }
5977
5986
 
5978
5987
  var intrabr = {
5979
- metadata: metadata$5,
5988
+ metadata: metadata$9,
5980
5989
  sources: function sources(opts) {
5981
5990
  return _objectSpread2({}, municipio_sources(opts));
5982
5991
  },
@@ -6011,14 +6020,14 @@ function cem_censo_2022(viewSpec, allViewSpecs, context) {
6011
6020
  if (!PARSED_SCHEMA) {
6012
6021
  return null;
6013
6022
  }
6014
- var DOWNLOAD = download$5(context, {
6023
+ var DOWNLOAD = download$9(context, {
6015
6024
  PARSED_SCHEMA: PARSED_SCHEMA
6016
6025
  });
6017
6026
  var CHOROPLETH = choropleth({
6018
6027
  GLOBAL_CONTEXT: context,
6019
6028
  PARSED_SCHEMA: PARSED_SCHEMA
6020
6029
  });
6021
- var CONF_SCHEMA = confSchema$4(viewSpec, allViewSpecs, context, {
6030
+ var CONF_SCHEMA = confSchema$7(viewSpec, allViewSpecs, context, {
6022
6031
  PARSED_SCHEMA: PARSED_SCHEMA
6023
6032
  });
6024
6033
  return {
@@ -6418,8 +6427,11 @@ function cem_saude_2024(viewSpec, allViewSpecs, context) {
6418
6427
  }));
6419
6428
  }
6420
6429
 
6421
- var DEFAULT_FILL_OPACITY$1 = 0.5;
6430
+ var DEFAULT_FILL_OPACITY$2 = 0.5;
6422
6431
  function applyOpacity(color, alpha) {
6432
+ if (alpha === void 0) {
6433
+ alpha = 1;
6434
+ }
6423
6435
  if (color.startsWith('#')) {
6424
6436
  var hex = color;
6425
6437
  if (hex.length === 4) {
@@ -6655,6 +6667,7 @@ function colorSelector(_initialColor) {
6655
6667
  })
6656
6668
  };
6657
6669
  }
6670
+
6658
6671
  function svgBgImage$2(svg) {
6659
6672
  return "url(\"data:image/svg+xml,".concat(encodeURIComponent(svg), "\")");
6660
6673
  }
@@ -6691,12 +6704,13 @@ var FILL_PATTERN_OPTIONS$1 = [{
6691
6704
  value: 'lines_1'
6692
6705
  }];
6693
6706
  function fillPatternSelector() {
6694
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6707
+ var _defaultValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : FILL_PATTERN_SOLID;
6708
+ var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
6695
6709
  return _objectSpread2({
6696
6710
  label: 'Textura',
6697
6711
  type: 'select',
6698
6712
  clearable: false,
6699
- defaultValue: FILL_PATTERN_SOLID,
6713
+ defaultValue: _defaultValue,
6700
6714
  options: FILL_PATTERN_OPTIONS$1.map(function (opt) {
6701
6715
  var pattern = opt.value === FILL_PATTERN_SOLID ? null : svgBgImage$2(SVG_PATTERNS[opt.value]({
6702
6716
  scale: '0.25'
@@ -6725,9 +6739,207 @@ function fillPatternSelector() {
6725
6739
  }, props);
6726
6740
  }
6727
6741
 
6728
- var _excluded$d = ["label", "color", "line", "fill", "tiles", "source_layer", "sources", "layers", "fill_pattern"];
6742
+ var GEOREDUS_CATEGORICAL_SAFE_COLORS = Object.values(GEOREDUS_LABELED_SAFE_COLORS).map(function (color) {
6743
+ return color.value;
6744
+ });
6745
+ var GEOREDUS_CATEGORICAL_COLORS = Object.values(GEOREDUS_LABELED_COLORS).map(function (color) {
6746
+ return color.value;
6747
+ });
6748
+ var CATEGORICAL_SCHEMES = _objectSpread2({
6749
+ schemeGeoReDUSSafe: GEOREDUS_CATEGORICAL_SAFE_COLORS,
6750
+ schemeGeoReDUS: GEOREDUS_CATEGORICAL_COLORS
6751
+ }, D3_CATEGORICAL);
6752
+ function categoricalColorSchemeSelector(_ref) {
6753
+ var _ref$clearable = _ref.clearable,
6754
+ clearable = _ref$clearable === void 0 ? false : _ref$clearable,
6755
+ _ref$defaultValue = _ref.defaultValue,
6756
+ defaultValue = _ref$defaultValue === void 0 ? 'schemeGeoReDUSSafe' : _ref$defaultValue;
6757
+ return {
6758
+ label: 'Esquema de cores',
6759
+ type: 'select',
6760
+ clearable: clearable,
6761
+ defaultValue: defaultValue,
6762
+ options: Object.entries(CATEGORICAL_SCHEMES).map(function (_ref2) {
6763
+ var _ref3 = _slicedToArray(_ref2, 2),
6764
+ name = _ref3[0],
6765
+ scheme = _ref3[1];
6766
+ return {
6767
+ value: name,
6768
+ label: /*#__PURE__*/jsx(Flex, {
6769
+ direction: "row",
6770
+ gap: "2",
6771
+ alignItems: "center",
6772
+ children: /*#__PURE__*/jsx("div", {
6773
+ style: {
6774
+ display: 'flex',
6775
+ gap: '2px'
6776
+ },
6777
+ children: scheme.map(function (color, idx) {
6778
+ return /*#__PURE__*/jsx("div", {
6779
+ style: {
6780
+ width: 15,
6781
+ height: 15,
6782
+ backgroundColor: color,
6783
+ border: 'none'
6784
+ }
6785
+ }, idx);
6786
+ })
6787
+ })
6788
+ })
6789
+ };
6790
+ })
6791
+ };
6792
+ }
6793
+
6794
+ var continuousIds = [].concat(_toConsumableArray(Object.keys(D3_SEQUENTIAL)), _toConsumableArray(Object.keys(D3_SEQUENTIAL).map(function (id) {
6795
+ return "-".concat(id);
6796
+ })), _toConsumableArray(Object.keys(D3_DIVERGING)), _toConsumableArray(Object.keys(D3_DIVERGING).map(function (id) {
6797
+ return "-".concat(id);
6798
+ })));
6799
+ var CONTINUOUS_SCHEMES = Object.fromEntries(continuousIds.map(function (id) {
6800
+ return [id, D3_COLOR_SCHEMES[id]];
6801
+ }));
6802
+ function continuousColorSchemeSelector(_ref) {
6803
+ var _ref$defaultValue = _ref.defaultValue,
6804
+ defaultValue = _ref$defaultValue === void 0 ? 'schemeOrRd' : _ref$defaultValue;
6805
+ return {
6806
+ label: 'Esquema de cores',
6807
+ type: 'select',
6808
+ defaultValue: defaultValue,
6809
+ options: Object.entries(CONTINUOUS_SCHEMES).map(function (_ref2) {
6810
+ var _ref3 = _slicedToArray(_ref2, 2),
6811
+ name = _ref3[0],
6812
+ scheme = _ref3[1];
6813
+ var colors = scheme.scalesByK[scheme.maxK];
6814
+ return {
6815
+ value: name,
6816
+ label: /*#__PURE__*/jsx(Flex, {
6817
+ direction: "row",
6818
+ gap: "2",
6819
+ alignItems: "center",
6820
+ children: /*#__PURE__*/jsx("div", {
6821
+ style: {
6822
+ display: 'flex',
6823
+ gap: '2px'
6824
+ },
6825
+ children: colors.map(function (color, idx) {
6826
+ return /*#__PURE__*/jsx("div", {
6827
+ style: {
6828
+ width: 15,
6829
+ height: 15,
6830
+ backgroundColor: color,
6831
+ border: 'none'
6832
+ }
6833
+ }, idx);
6834
+ })
6835
+ })
6836
+ })
6837
+ };
6838
+ })
6839
+ };
6840
+ }
6841
+
6842
+ var LINE_PATTERN_SOLID = 'solid';
6843
+ var LINE_PATTERN_OPTIONS$1 = [{
6844
+ label: 'Sólido',
6845
+ value: 'solid'
6846
+ }, {
6847
+ label: 'Tracejado',
6848
+ value: 'dashed'
6849
+ }, {
6850
+ label: 'Pontilhado',
6851
+ value: 'dotted'
6852
+ }];
6853
+ function linePatternSelector() {
6854
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
6855
+ _ref$defaultValue = _ref.defaultValue,
6856
+ defaultValue = _ref$defaultValue === void 0 ? LINE_PATTERN_SOLID : _ref$defaultValue;
6857
+ return {
6858
+ label: 'Padrão da linha',
6859
+ helperText: 'Selecione o padrão de linha para a camada',
6860
+ type: 'select',
6861
+ clearable: false,
6862
+ defaultValue: defaultValue,
6863
+ options: LINE_PATTERN_OPTIONS$1.map(function (opt) {
6864
+ return _objectSpread2(_objectSpread2({}, opt), {}, {
6865
+ label: /*#__PURE__*/jsxs(Flex, {
6866
+ direction: "row",
6867
+ alignItems: "center",
6868
+ gap: "2",
6869
+ children: [/*#__PURE__*/jsx("div", {
6870
+ style: {
6871
+ width: 15,
6872
+ height: 0,
6873
+ borderTop: "2px ".concat(opt.value, " black")
6874
+ }
6875
+ }), /*#__PURE__*/jsxs("div", {
6876
+ children: [" ", opt.label]
6877
+ })]
6878
+ })
6879
+ });
6880
+ })
6881
+ };
6882
+ }
6883
+
6884
+ var LINE_WIDTH_1 = 1;
6885
+ var LINE_WIDTH_OPTIONS = Array.from({
6886
+ length: 5
6887
+ }, function (_, i) {
6888
+ return i + 1;
6889
+ }).map(function (v) {
6890
+ return {
6891
+ label: "".concat(v, "px"),
6892
+ value: v
6893
+ };
6894
+ });
6895
+ function lineWidthSelector() {
6896
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
6897
+ _ref$defaultValue = _ref.defaultValue,
6898
+ defaultValue = _ref$defaultValue === void 0 ? LINE_WIDTH_1 : _ref$defaultValue;
6899
+ return {
6900
+ label: 'Espessura da linha',
6901
+ helperText: 'Selecione a expessura da linha para a camada',
6902
+ type: 'select',
6903
+ clearable: false,
6904
+ defaultValue: defaultValue,
6905
+ options: LINE_WIDTH_OPTIONS.map(function (opt) {
6906
+ return _objectSpread2(_objectSpread2({}, opt), {}, {
6907
+ label: /*#__PURE__*/jsxs(Flex, {
6908
+ direction: "row",
6909
+ alignItems: "center",
6910
+ gap: "2",
6911
+ children: [/*#__PURE__*/jsx("div", {
6912
+ style: {
6913
+ width: 15,
6914
+ height: 0,
6915
+ borderTop: "".concat(opt.value, "px solid black")
6916
+ }
6917
+ }), /*#__PURE__*/jsxs("div", {
6918
+ children: [" ", opt.label]
6919
+ })]
6920
+ })
6921
+ });
6922
+ })
6923
+ };
6924
+ }
6925
+
6926
+ function opacitySlider(_ref) {
6927
+ var _ref$defaultValue = _ref.defaultValue,
6928
+ defaultValue = _ref$defaultValue === void 0 ? DEFAULT_FILL_OPACITY$2 : _ref$defaultValue;
6929
+ return {
6930
+ type: 'slider',
6931
+ label: 'Opacidade da camada',
6932
+ size: '1',
6933
+ min: 0,
6934
+ max: 1,
6935
+ step: 0.01,
6936
+ defaultValue: defaultValue
6937
+ };
6938
+ }
6939
+
6940
+ var _excluded$i = ["label", "color", "line", "fill", "tiles", "source_layer", "sources", "layers", "fill_pattern"];
6729
6941
  var SOLID = 'solid';
6730
- var DEFAULT_FILL_OPACITY = 0.5;
6942
+ var DEFAULT_FILL_OPACITY$1 = 0.5;
6731
6943
  var FILL_PATTERN_OPTIONS = [{
6732
6944
  label: 'Preenchido',
6733
6945
  value: SOLID
@@ -6785,7 +6997,7 @@ function vector_polygon(_ref, allViewSpecs, context) {
6785
6997
  _ref$layers = _ref.layers,
6786
6998
  layers = _ref$layers === void 0 ? {} : _ref$layers,
6787
6999
  fill_pattern = _ref.fill_pattern,
6788
- props = _objectWithoutProperties(_ref, _excluded$d);
7000
+ props = _objectWithoutProperties(_ref, _excluded$i);
6789
7001
  if (!source_layer) {
6790
7002
  throw new Error('source_layer must be defined');
6791
7003
  }
@@ -6825,7 +7037,7 @@ function vector_polygon(_ref, allViewSpecs, context) {
6825
7037
  var resolvedFillPattern = ((_ctx$view3 = ctx.view) === null || _ctx$view3 === void 0 || (_ctx$view3 = _ctx$view3.conf) === null || _ctx$view3 === void 0 || (_ctx$view3 = _ctx$view3.style) === null || _ctx$view3 === void 0 ? void 0 : _ctx$view3.fillPattern) || fill_pattern;
6826
7038
  var resolvedFillPatternStr = resolvedFillPattern && resolvedFillPattern !== SOLID ? "".concat(resolvedFillPattern, "({ stroke: \"").concat(_resolvedColor, "\", scale: 0.5 })") : null;
6827
7039
  return _objectSpread2(_objectSpread2({
6828
- 'fill-opacity': fill.paint && fill.paint['fill-opacity'] ? fill.paint['fill-opacity'] : DEFAULT_FILL_OPACITY,
7040
+ 'fill-opacity': fill.paint && fill.paint['fill-opacity'] ? fill.paint['fill-opacity'] : DEFAULT_FILL_OPACITY$1,
6829
7041
  'fill-color': _color
6830
7042
  }, fill['paint']), resolvedFillPatternStr ? {
6831
7043
  'fill-pattern': resolvedFillPatternStr
@@ -6908,15 +7120,23 @@ function vector_polygon(_ref, allViewSpecs, context) {
6908
7120
  });
6909
7121
  }
6910
7122
 
6911
- function confSchema$3(viewSpec, allViewSpecs, context) {
7123
+ function confSchema$6(viewSpec, allViewSpecs, context) {
7124
+ var _viewSpec$style, _viewSpec$style2;
6912
7125
  return {
6913
7126
  style: {
6914
- fillPattern: fillPatternSelector()
7127
+ fillPattern: fillPatternSelector(),
7128
+ colorScheme: categoricalColorSchemeSelector({
7129
+ defaultValue: (_viewSpec$style = viewSpec.style) === null || _viewSpec$style === void 0 ? void 0 : _viewSpec$style.colorScheme,
7130
+ clearable: ((_viewSpec$style2 = viewSpec.style) === null || _viewSpec$style2 === void 0 ? void 0 : _viewSpec$style2.colorScheme) === null
7131
+ }),
7132
+ opacity: opacitySlider({
7133
+ defaultValue: DEFAULT_FILL_OPACITY$2
7134
+ })
6915
7135
  }
6916
7136
  };
6917
7137
  }
6918
7138
 
6919
- function metadata$4(viewSpec, allViewSpecs, context) {
7139
+ function metadata$8(viewSpec, allViewSpecs, context) {
6920
7140
  var style = viewSpec.style;
6921
7141
  var categories = resolveAsync.fn(/*#__PURE__*/function () {
6922
7142
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(ctx) {
@@ -6926,7 +7146,7 @@ function metadata$4(viewSpec, allViewSpecs, context) {
6926
7146
  while (1) switch (_context.prev = _context.next) {
6927
7147
  case 0:
6928
7148
  // Resolve color scheme
6929
- colorSchemeId = ((_ctx$view = ctx.view) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.conf) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.style) === null || _ctx$view === void 0 ? void 0 : _ctx$view.colorScheme) || 'schemeGeoReDUSSafe'; // resolve categories
7149
+ colorSchemeId = ((_ctx$view = ctx.view) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.conf) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.style) === null || _ctx$view === void 0 ? void 0 : _ctx$view.colorScheme) || style.colorScheme; // resolve categories
6930
7150
  if (!(typeof style.categories === 'string')) {
6931
7151
  _context.next = 7;
6932
7152
  break;
@@ -6939,6 +7159,8 @@ function metadata$4(viewSpec, allViewSpecs, context) {
6939
7159
  }).then(function (categories) {
6940
7160
  return uniqBy(categories, function (cat) {
6941
7161
  return cat.value;
7162
+ }).filter(function (cat) {
7163
+ return cat.value !== null;
6942
7164
  });
6943
7165
  });
6944
7166
  case 4:
@@ -6960,7 +7182,7 @@ function metadata$4(viewSpec, allViewSpecs, context) {
6960
7182
  throw new Error('could not resolve categories ' + viewSpec.id);
6961
7183
  case 11:
6962
7184
  return _context.abrupt("return", resolvedCategories.map(function (cat, index) {
6963
- var color = cat.color || resolveSchemeColor(colorSchemeId, index);
7185
+ var color = cat.color || resolveCategoricalSchemeColor(colorSchemeId, index);
6964
7186
  if (!color) {
6965
7187
  throw new Error("Could not resolve color for ".concat(cat.value));
6966
7188
  }
@@ -6984,17 +7206,17 @@ function metadata$4(viewSpec, allViewSpecs, context) {
6984
7206
  };
6985
7207
  }
6986
7208
 
6987
- var MAIN_SOURCE_ID$3 = 'main';
6988
- function sources$4(viewSpec, allViewSpecs, context) {
7209
+ var MAIN_SOURCE_ID$6 = 'main';
7210
+ function sources$9(viewSpec, allViewSpecs, context) {
6989
7211
  var tiles = viewSpec.tiles;
6990
- return _defineProperty({}, MAIN_SOURCE_ID$3, {
7212
+ return _defineProperty({}, MAIN_SOURCE_ID$6, {
6991
7213
  promoteId: 'id',
6992
7214
  type: 'vector',
6993
7215
  tiles: parseTiles(tiles, context)
6994
7216
  });
6995
7217
  }
6996
7218
 
6997
- function _main_line$2(_ref, viewSpec, allViewSpecs, context) {
7219
+ function _main_line$4(_ref, viewSpec, allViewSpecs, context) {
6998
7220
  var _viewSpec$style;
6999
7221
  var _maplibreColorExp = _ref._maplibreColorExp;
7000
7222
  var source_layer = viewSpec.source_layer;
@@ -7015,7 +7237,7 @@ function _main_line$2(_ref, viewSpec, allViewSpecs, context) {
7015
7237
  }[borderStyle];
7016
7238
  return {
7017
7239
  zIndex: Z_OVERLAY_BASE_1000,
7018
- source: MAIN_SOURCE_ID$3,
7240
+ source: MAIN_SOURCE_ID$6,
7019
7241
  'source-layer': source_layer,
7020
7242
  type: 'line',
7021
7243
  layout: borderStyle === 'dotted' ? {
@@ -7028,20 +7250,32 @@ function _main_line$2(_ref, viewSpec, allViewSpecs, context) {
7028
7250
  };
7029
7251
  }
7030
7252
  function _main_fill_legends$2(props, viewSpec, allViewSpecs, context) {
7031
- var _legends = resolve.fn(function (context) {
7032
- var categories = context.view.metadata.categories;
7253
+ var _fillPattern = props._fillPattern;
7254
+ var _legends = resolve.fn([_fillPattern], function (_ref2, ctx) {
7255
+ var _ctx$view;
7256
+ var _ref3 = _slicedToArray(_ref2, 1),
7257
+ resolvedFillPattern = _ref3[0];
7258
+ var categories = ctx.view.metadata.categories;
7259
+ var _confOpacity = (_ctx$view = ctx.view) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.conf) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.style) === null || _ctx$view === void 0 ? void 0 : _ctx$view.opacity;
7033
7260
  return [{
7034
7261
  type: 'CategoricalLegend',
7035
7262
  title: viewSpec.label,
7036
7263
  items: categories.map(function (cat) {
7264
+ var boxStyle = resolvedFillPattern && resolvedFillPattern !== FILL_PATTERN_SOLID ? {
7265
+ backgroundColor: 'transparent',
7266
+ backgroundImage: typeof SVG_PATTERNS[resolvedFillPattern] === 'function' ? svgBgImage$2(SVG_PATTERNS[resolvedFillPattern]({
7267
+ stroke: resolveColor(cat.color),
7268
+ scale: '0.25'
7269
+ })) : ''
7270
+ } : {
7271
+ backgroundColor: applyOpacity(resolveColor(cat.color), typeof _confOpacity === 'number' ? _confOpacity : DEFAULT_FILL_OPACITY$2)
7272
+ };
7037
7273
  return {
7038
7274
  id: cat.value,
7039
7275
  label: cat.label,
7040
- color: cat.color,
7276
+ color: resolveColor(cat.color),
7041
7277
  box: {
7042
- style: {
7043
- backgroundColor: applyOpacity(cat.color, DEFAULT_FILL_OPACITY$1)
7044
- }
7278
+ style: boxStyle
7045
7279
  }
7046
7280
  };
7047
7281
  })
@@ -7053,22 +7287,24 @@ function _main_fill$2(props, viewSpec, allViewSpecs, context) {
7053
7287
  var _maplibreColorExp = props._maplibreColorExp,
7054
7288
  _fillPattern = props._fillPattern;
7055
7289
  var source_layer = viewSpec.source_layer;
7056
- var _fillPaint = resolve.fn([_fillPattern], function (_ref2, ctx) {
7057
- var _ref3 = _slicedToArray(_ref2, 1),
7058
- resolvedFillPattern = _ref3[0];
7290
+ var _fillPaint = resolve.fn([_fillPattern], function (_ref4, ctx) {
7291
+ var _ctx$view2;
7292
+ var _ref5 = _slicedToArray(_ref4, 1),
7293
+ resolvedFillPattern = _ref5[0];
7059
7294
  var resolvedFillPatternStr = resolvedFillPattern && resolvedFillPattern !== FILL_PATTERN_SOLID ? ['match', ['get', viewSpec.style.categoryKey]].concat(_toConsumableArray(ctx.view.metadata.categories.map(function (cat) {
7060
- return [cat.value, "".concat(resolvedFillPattern, "({ stroke: \"").concat(cat.color, "\", scale: 0.5 })")];
7295
+ return [cat.value, "".concat(resolvedFillPattern, "({ stroke: \"").concat(resolveColor(cat.color), "\", scale: 0.5 })")];
7061
7296
  }).flat()), ['#CCCCCC']) : null;
7297
+ var _confOpacity = (_ctx$view2 = ctx.view) === null || _ctx$view2 === void 0 || (_ctx$view2 = _ctx$view2.conf) === null || _ctx$view2 === void 0 || (_ctx$view2 = _ctx$view2.style) === null || _ctx$view2 === void 0 ? void 0 : _ctx$view2.opacity;
7062
7298
  return _objectSpread2({
7063
7299
  'fill-color': _maplibreColorExp,
7064
- 'fill-opacity': DEFAULT_FILL_OPACITY$1
7300
+ 'fill-opacity': typeof _confOpacity === 'number' ? _confOpacity : DEFAULT_FILL_OPACITY$2
7065
7301
  }, resolvedFillPatternStr ? {
7066
7302
  'fill-pattern': resolvedFillPatternStr
7067
7303
  } : {});
7068
7304
  });
7069
7305
  return {
7070
7306
  zIndex: Z_OVERLAY_BASE_1000,
7071
- source: MAIN_SOURCE_ID$3,
7307
+ source: MAIN_SOURCE_ID$6,
7072
7308
  'source-layer': source_layer,
7073
7309
  type: 'fill',
7074
7310
  paint: _fillPaint,
@@ -7076,7 +7312,7 @@ function _main_fill$2(props, viewSpec, allViewSpecs, context) {
7076
7312
  tooltip: basicTooltip(viewSpec.tooltip)
7077
7313
  };
7078
7314
  }
7079
- function layers$4(viewSpec, allViewSpecs, context) {
7315
+ function layers$9(viewSpec, allViewSpecs, context) {
7080
7316
  var styleSpec = viewSpec.style;
7081
7317
  var source_layer = viewSpec.source_layer;
7082
7318
  if (!source_layer) {
@@ -7084,14 +7320,14 @@ function layers$4(viewSpec, allViewSpecs, context) {
7084
7320
  }
7085
7321
  var _maplibreColorExp = resolve.fn(function (ctx) {
7086
7322
  return ['match', ['get', viewSpec.style.categoryKey]].concat(_toConsumableArray(ctx.view.metadata.categories.map(function (cat) {
7087
- return [cat.value, cat.color];
7323
+ return [cat.value, resolveColor(cat.color)];
7088
7324
  }).flat()), ['#CCCCCC']);
7089
7325
  });
7090
7326
  var _fillPattern = resolve.fn(function (ctx) {
7091
- var _ctx$view;
7092
- return ((_ctx$view = ctx.view) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.conf) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.style) === null || _ctx$view === void 0 ? void 0 : _ctx$view.fillPattern) || styleSpec.fillPattern;
7327
+ var _ctx$view3;
7328
+ return ((_ctx$view3 = ctx.view) === null || _ctx$view3 === void 0 || (_ctx$view3 = _ctx$view3.conf) === null || _ctx$view3 === void 0 || (_ctx$view3 = _ctx$view3.style) === null || _ctx$view3 === void 0 ? void 0 : _ctx$view3.fillPattern) || styleSpec.fillPattern;
7093
7329
  });
7094
- return _defineProperty(_defineProperty({}, "main_line", _main_line$2({
7330
+ return _defineProperty(_defineProperty({}, "main_line", _main_line$4({
7095
7331
  _maplibreColorExp: _maplibreColorExp
7096
7332
  }, viewSpec)), "main_fill", _main_fill$2({
7097
7333
  _maplibreColorExp: _maplibreColorExp,
@@ -7099,7 +7335,7 @@ function layers$4(viewSpec, allViewSpecs, context) {
7099
7335
  }, viewSpec));
7100
7336
  }
7101
7337
 
7102
- function download$4(viewSpec, allViewSpecs, context) {
7338
+ function download$8(viewSpec, allViewSpecs, context) {
7103
7339
  return basicDownload({
7104
7340
  fileName: slugify(viewSpec.label),
7105
7341
  downloadUrl: interpolate(viewSpec.download_url, {
@@ -7108,43 +7344,46 @@ function download$4(viewSpec, allViewSpecs, context) {
7108
7344
  });
7109
7345
  }
7110
7346
 
7111
- var DEFAULT_COLOR_SCHEME_ID$1 = 'schemeGeoReDUSSafe';
7112
- function parseStyleSpec$4(styleInput) {
7347
+ var DEFAULT_COLOR_SCHEME_ID$4 = 'schemeGeoReDUSSafe';
7348
+ function parseStyleSpec$9(styleInput) {
7113
7349
  if (!styleInput) {
7114
7350
  throw new Error('expected existing styleInput');
7115
7351
  }
7116
7352
  return __assign({
7117
- colorScheme: DEFAULT_COLOR_SCHEME_ID$1
7353
+ colorScheme: DEFAULT_COLOR_SCHEME_ID$4
7118
7354
  }, styleInput);
7119
7355
  }
7120
7356
 
7121
- var _excluded$c = ["style"];
7357
+ var _excluded$h = ["style"];
7122
7358
  function vector_polygon_categorical(_ref, allViewSpecs, context) {
7123
7359
  var style = _ref.style,
7124
- viewSpec = _objectWithoutProperties(_ref, _excluded$c);
7360
+ viewSpec = _objectWithoutProperties(_ref, _excluded$h);
7125
7361
  viewSpec = _objectSpread2(_objectSpread2({}, viewSpec), {}, {
7126
- style: parseStyleSpec$4(style)
7362
+ style: parseStyleSpec$9(style)
7127
7363
  });
7128
- return _objectSpread2(_objectSpread2({}, pick(viewSpec, ['id', 'path', 'label', 'sourceLabel'])), {}, {
7129
- confSchema: confSchema$3(),
7130
- metadata: metadata$4(viewSpec, allViewSpecs, context),
7131
- sources: sources$4(viewSpec, allViewSpecs, context),
7132
- layers: layers$4(viewSpec),
7133
- download: download$4(viewSpec, allViewSpecs, context)
7364
+ return _objectSpread2(_objectSpread2({}, pick(viewSpec, ['id', 'path', 'label', 'sourceLabel', 'metodology', 'shortDescription'])), {}, {
7365
+ confSchema: confSchema$6(viewSpec),
7366
+ metadata: metadata$8(viewSpec, allViewSpecs, context),
7367
+ sources: sources$9(viewSpec, allViewSpecs, context),
7368
+ layers: layers$9(viewSpec),
7369
+ download: download$8(viewSpec, allViewSpecs, context)
7134
7370
  });
7135
7371
  }
7136
7372
 
7137
- function confSchema$2(viewSpec, allViewSpecs, context) {
7373
+ function confSchema$5(viewSpec, allViewSpecs, context) {
7138
7374
  var styleSpec = viewSpec.style;
7139
7375
  return {
7140
7376
  style: {
7141
7377
  color: colorSelector(styleSpec.color),
7142
- fillPattern: fillPatternSelector()
7378
+ fillPattern: fillPatternSelector(styleSpec.fillPattern),
7379
+ opacity: opacitySlider({
7380
+ defaultValue: DEFAULT_FILL_OPACITY$2
7381
+ })
7143
7382
  }
7144
7383
  };
7145
7384
  }
7146
7385
 
7147
- function metadata$3(viewSpec, allViewSpecs, context) {
7386
+ function metadata$7(viewSpec, allViewSpecs, context) {
7148
7387
  viewSpec.style;
7149
7388
  return {};
7150
7389
  }
@@ -7153,10 +7392,11 @@ function _main_fill_legends$1(_ref, viewSpec, allViewSpecs, context) {
7153
7392
  var _color = _ref._color,
7154
7393
  _fillPattern = _ref._fillPattern;
7155
7394
  var _legend = resolve.fn([_color, _fillPattern], function (_ref2, ctx) {
7156
- var _viewSpec$style;
7395
+ var _ctx$view, _viewSpec$style;
7157
7396
  var _ref3 = _slicedToArray(_ref2, 2),
7158
7397
  resolvedColor = _ref3[0],
7159
7398
  resolvedFillPattern = _ref3[1];
7399
+ var _opacity = ((_ctx$view = ctx.view) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.conf) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.style) === null || _ctx$view === void 0 ? void 0 : _ctx$view.opacity) || DEFAULT_FILL_OPACITY$2;
7160
7400
  var patternProps = resolvedFillPattern && resolvedFillPattern !== FILL_PATTERN_SOLID ? {
7161
7401
  color: resolvedColor,
7162
7402
  backgroundColor: 'transparent',
@@ -7165,7 +7405,7 @@ function _main_fill_legends$1(_ref, viewSpec, allViewSpecs, context) {
7165
7405
  scale: '0.25'
7166
7406
  })) : ''
7167
7407
  } : {
7168
- backgroundColor: applyOpacity(resolvedColor, DEFAULT_FILL_OPACITY$1)
7408
+ backgroundColor: applyOpacity(resolvedColor, _opacity)
7169
7409
  };
7170
7410
  var legendItemProps = {
7171
7411
  box: {
@@ -7191,12 +7431,14 @@ function _main_fill$1(props, viewSpec, allViewSpecs, context) {
7191
7431
  _fillPattern = props._fillPattern;
7192
7432
  var source_layer = viewSpec.source_layer;
7193
7433
  var _fillPaint = resolve.fn([_color, _fillPattern], function (_ref4, ctx) {
7434
+ var _ctx$view2;
7194
7435
  var _ref5 = _slicedToArray(_ref4, 2),
7195
7436
  resolvedColor = _ref5[0],
7196
7437
  resolvedFillPattern = _ref5[1];
7197
7438
  var resolvedFillPatternStr = resolvedFillPattern && resolvedFillPattern !== FILL_PATTERN_SOLID ? "".concat(resolvedFillPattern, "({ stroke: \"").concat(resolvedColor, "\", scale: 0.5 })") : null;
7439
+ var _opacity = ((_ctx$view2 = ctx.view) === null || _ctx$view2 === void 0 || (_ctx$view2 = _ctx$view2.conf) === null || _ctx$view2 === void 0 || (_ctx$view2 = _ctx$view2.style) === null || _ctx$view2 === void 0 ? void 0 : _ctx$view2.opacity) || DEFAULT_FILL_OPACITY$2;
7198
7440
  return _objectSpread2({
7199
- 'fill-opacity': DEFAULT_FILL_OPACITY$1,
7441
+ 'fill-opacity': _opacity,
7200
7442
  'fill-color': resolvedColor
7201
7443
  }, resolvedFillPatternStr ? {
7202
7444
  'fill-pattern': resolvedFillPatternStr
@@ -7212,7 +7454,7 @@ function _main_fill$1(props, viewSpec, allViewSpecs, context) {
7212
7454
  tooltip: basicTooltip(viewSpec.tooltip)
7213
7455
  };
7214
7456
  }
7215
- function _main_line$1(_ref6, viewSpec, allViewSpecs, context) {
7457
+ function _main_line$3(_ref6, viewSpec, allViewSpecs, context) {
7216
7458
  var _viewSpec$style2;
7217
7459
  var _color = _ref6._color;
7218
7460
  var source_layer = viewSpec.source_layer;
@@ -7244,28 +7486,28 @@ function _main_line$1(_ref6, viewSpec, allViewSpecs, context) {
7244
7486
  }, paint)
7245
7487
  };
7246
7488
  }
7247
- function layers$3(viewSpec, allViewSpecs, context) {
7489
+ function layers$8(viewSpec, allViewSpecs, context) {
7248
7490
  var styleSpec = viewSpec.style;
7249
7491
  var source_layer = viewSpec.source_layer;
7250
7492
  if (!source_layer) {
7251
7493
  throw new Error('source_layer must be defined');
7252
7494
  }
7253
7495
  var _color = resolve.fn(function (ctx) {
7254
- var _ctx$view;
7255
- return resolveColor(((_ctx$view = ctx.view) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.conf) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.style) === null || _ctx$view === void 0 ? void 0 : _ctx$view.color) || styleSpec.color);
7496
+ var _ctx$view3;
7497
+ return resolveColor(((_ctx$view3 = ctx.view) === null || _ctx$view3 === void 0 || (_ctx$view3 = _ctx$view3.conf) === null || _ctx$view3 === void 0 || (_ctx$view3 = _ctx$view3.style) === null || _ctx$view3 === void 0 ? void 0 : _ctx$view3.color) || styleSpec.color);
7256
7498
  });
7257
7499
  var _fillPattern = resolve.fn(function (ctx) {
7258
- var _ctx$view2;
7259
- return ((_ctx$view2 = ctx.view) === null || _ctx$view2 === void 0 || (_ctx$view2 = _ctx$view2.conf) === null || _ctx$view2 === void 0 || (_ctx$view2 = _ctx$view2.style) === null || _ctx$view2 === void 0 ? void 0 : _ctx$view2.fillPattern) || styleSpec.fillPattern;
7500
+ var _ctx$view4;
7501
+ return ((_ctx$view4 = ctx.view) === null || _ctx$view4 === void 0 || (_ctx$view4 = _ctx$view4.conf) === null || _ctx$view4 === void 0 || (_ctx$view4 = _ctx$view4.style) === null || _ctx$view4 === void 0 ? void 0 : _ctx$view4.fillPattern) || styleSpec.fillPattern;
7260
7502
  });
7261
- return _defineProperty(_defineProperty({}, "main_line", _main_line$1({
7503
+ return _defineProperty(_defineProperty({}, "main_line", _main_line$3({
7262
7504
  _color: _color}, viewSpec)), "main_fill", _main_fill$1({
7263
7505
  _color: _color,
7264
7506
  _fillPattern: _fillPattern
7265
7507
  }, viewSpec));
7266
7508
  }
7267
7509
 
7268
- function sources$3(viewSpec, allViewSpecs, context) {
7510
+ function sources$8(viewSpec, allViewSpecs, context) {
7269
7511
  var tiles = viewSpec.tiles;
7270
7512
  return {
7271
7513
  main: {
@@ -7276,25 +7518,25 @@ function sources$3(viewSpec, allViewSpecs, context) {
7276
7518
  };
7277
7519
  }
7278
7520
 
7279
- function _defaultColor$1(inputColor) {
7521
+ function _defaultColor$2(inputColor) {
7280
7522
  return inputColor ? resolveColor(inputColor) : schemeGeoReDUS.laranja;
7281
7523
  }
7282
- function parseStyleSpec$3(styleInput) {
7524
+ function parseStyleSpec$8(styleInput) {
7283
7525
  if (!styleInput) {
7284
7526
  return {};
7285
7527
  }
7286
7528
  if (typeof styleInput === 'string') {
7287
7529
  return {
7288
- color: _defaultColor$1(styleInput)
7530
+ color: _defaultColor$2(styleInput)
7289
7531
  };
7290
7532
  } else {
7291
7533
  return __assign(__assign({}, styleInput), {
7292
- color: _defaultColor$1(styleInput.color)
7534
+ color: _defaultColor$2(styleInput.color)
7293
7535
  });
7294
7536
  }
7295
7537
  }
7296
7538
 
7297
- function download$3(viewSpec, allViewSpecs, context) {
7539
+ function download$7(viewSpec, allViewSpecs, context) {
7298
7540
  return basicDownload({
7299
7541
  fileName: slugify(viewSpec.label),
7300
7542
  downloadUrl: interpolate(viewSpec.download_url, {
@@ -7303,26 +7545,26 @@ function download$3(viewSpec, allViewSpecs, context) {
7303
7545
  });
7304
7546
  }
7305
7547
 
7306
- var _excluded$b = ["style"];
7548
+ var _excluded$g = ["style"];
7307
7549
  function vector_polygon_single(_ref, allViewSpecs, context) {
7308
7550
  var style = _ref.style,
7309
- viewSpec = _objectWithoutProperties(_ref, _excluded$b);
7551
+ viewSpec = _objectWithoutProperties(_ref, _excluded$g);
7310
7552
  viewSpec = _objectSpread2(_objectSpread2({}, viewSpec), {}, {
7311
- style: parseStyleSpec$3(style)
7553
+ style: parseStyleSpec$8(style)
7312
7554
  });
7313
- return _objectSpread2(_objectSpread2({}, pick(viewSpec, ['id', 'path', 'label', 'sourceLabel'])), {}, {
7314
- confSchema: confSchema$2(viewSpec),
7315
- metadata: metadata$3(viewSpec),
7316
- sources: sources$3(viewSpec, allViewSpecs, context),
7317
- layers: layers$3(viewSpec),
7318
- download: download$3(viewSpec, allViewSpecs, context)
7555
+ return _objectSpread2(_objectSpread2({}, pick(viewSpec, ['id', 'path', 'label', 'sourceLabel', 'metodology', 'shortDescription'])), {}, {
7556
+ confSchema: confSchema$5(viewSpec),
7557
+ metadata: metadata$7(viewSpec),
7558
+ sources: sources$8(viewSpec, allViewSpecs, context),
7559
+ layers: layers$8(viewSpec),
7560
+ download: download$7(viewSpec, allViewSpecs, context)
7319
7561
  });
7320
7562
  }
7321
7563
 
7322
- var DEFAULT_COLOR_SCHEME_ID = 'schemeOrRd';
7323
- function parseStyleSpec$2(styleInput) {
7564
+ var DEFAULT_COLOR_SCHEME_ID$3 = 'schemeOrRd';
7565
+ function parseStyleSpec$7(styleInput) {
7324
7566
  return __assign(__assign({
7325
- colorScheme: DEFAULT_COLOR_SCHEME_ID
7567
+ colorScheme: DEFAULT_COLOR_SCHEME_ID$3
7326
7568
  }, styleInput), {
7327
7569
  classificationMethod: !styleInput.classificationMethod ? {
7328
7570
  type: 'naturalBreaks',
@@ -7334,41 +7576,7 @@ function parseStyleSpec$2(styleInput) {
7334
7576
  });
7335
7577
  }
7336
7578
 
7337
- var getLargestColorArray = function getLargestColorArray(scheme) {
7338
- return scheme[scheme.length - 1];
7339
- };
7340
- var D3_SCHEMES = _objectSpread2(_objectSpread2({}, D3_SEQUENTIAL), D3_DIVERGING);
7341
- var COLOR_SCHEME_OPTIONS = Object.entries(D3_SCHEMES).map(function (_ref) {
7342
- var _ref2 = _slicedToArray(_ref, 2),
7343
- name = _ref2[0],
7344
- scheme = _ref2[1];
7345
- var colors = getLargestColorArray(scheme);
7346
- return {
7347
- value: name,
7348
- label: /*#__PURE__*/jsx(Flex, {
7349
- direction: "row",
7350
- gap: "2",
7351
- alignItems: "center",
7352
- children: /*#__PURE__*/jsx("div", {
7353
- style: {
7354
- display: 'flex',
7355
- gap: '2px'
7356
- },
7357
- children: colors.map(function (color, idx) {
7358
- return /*#__PURE__*/jsx("div", {
7359
- style: {
7360
- width: 15,
7361
- height: 15,
7362
- backgroundColor: color,
7363
- border: 'none'
7364
- }
7365
- }, idx);
7366
- })
7367
- })
7368
- })
7369
- };
7370
- });
7371
- function confSchema$1(viewSpec, allViewSpecs, context) {
7579
+ function confSchema$4(viewSpec, allViewSpecs, context) {
7372
7580
  var _viewSpec$style, _viewSpec$style2;
7373
7581
  return {
7374
7582
  style: {
@@ -7385,13 +7593,12 @@ function confSchema$1(viewSpec, allViewSpecs, context) {
7385
7593
  label: 'Quantis'
7386
7594
  }]
7387
7595
  },
7388
- colorScheme: {
7389
- label: 'Esquema de cores',
7390
- type: 'select',
7391
- clearable: false,
7392
- defaultValue: ((_viewSpec$style2 = viewSpec.style) === null || _viewSpec$style2 === void 0 ? void 0 : _viewSpec$style2.colorScheme) || DEFAULT_COLOR_SCHEME_ID,
7393
- options: COLOR_SCHEME_OPTIONS
7394
- }
7596
+ colorScheme: continuousColorSchemeSelector({
7597
+ defaultValue: ((_viewSpec$style2 = viewSpec.style) === null || _viewSpec$style2 === void 0 ? void 0 : _viewSpec$style2.colorScheme) || DEFAULT_COLOR_SCHEME_ID$3
7598
+ }),
7599
+ opacity: opacitySlider({
7600
+ defaultValue: DEFAULT_FILL_OPACITY$2
7601
+ })
7395
7602
  }
7396
7603
  };
7397
7604
  }
@@ -7457,7 +7664,7 @@ var COLOR_SCALE_STOPS_RESOLVERS = {
7457
7664
  naturalBreaks: naturalBreaks
7458
7665
  };
7459
7666
 
7460
- function metadata$2(viewSpec, allViewSpecs, context) {
7667
+ function metadata$6(viewSpec, allViewSpecs, context) {
7461
7668
  var style = viewSpec.style;
7462
7669
  return resolveAsync.fn(/*#__PURE__*/function () {
7463
7670
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(ctx) {
@@ -7516,17 +7723,17 @@ function metadata$2(viewSpec, allViewSpecs, context) {
7516
7723
  }());
7517
7724
  }
7518
7725
 
7519
- var MAIN_SOURCE_ID$2 = 'main';
7520
- function sources$2(viewSpec, allViewSpecs, context) {
7726
+ var MAIN_SOURCE_ID$5 = 'main';
7727
+ function sources$7(viewSpec, allViewSpecs, context) {
7521
7728
  var tiles = viewSpec.tiles;
7522
- return _defineProperty({}, MAIN_SOURCE_ID$2, {
7729
+ return _defineProperty({}, MAIN_SOURCE_ID$5, {
7523
7730
  promoteId: 'id',
7524
7731
  type: 'vector',
7525
7732
  tiles: parseTiles(tiles, context)
7526
7733
  });
7527
7734
  }
7528
7735
 
7529
- function _main_line(props, viewSpec, allViewSpecs, context) {
7736
+ function _main_line$2(props, viewSpec, allViewSpecs, context) {
7530
7737
  var source_layer = viewSpec.source_layer;
7531
7738
 
7532
7739
  //
@@ -7535,7 +7742,7 @@ function _main_line(props, viewSpec, allViewSpecs, context) {
7535
7742
  var colorScheme = COLOR_SCHEMES[viewSpec.style.colorScheme];
7536
7743
  return {
7537
7744
  zIndex: Z_OVERLAY_BASE_1000,
7538
- source: MAIN_SOURCE_ID$2,
7745
+ source: MAIN_SOURCE_ID$5,
7539
7746
  'source-layer': source_layer,
7540
7747
  type: 'line',
7541
7748
  interactive: true,
@@ -7549,13 +7756,19 @@ function _main_line(props, viewSpec, allViewSpecs, context) {
7549
7756
  var DEFAULT_NUMBER_FORMAT = ['pt-BR', {}];
7550
7757
  function _main_fill_legends(props, viewSpec, allViewSpecs, context) {
7551
7758
  var _legends = resolve.fn(function (ctx) {
7552
- var _viewSpec$style$legen;
7553
- console.log('ctx', ctx);
7759
+ var _ctx$view, _viewSpec$style$legen;
7760
+ var _confOpacity = (_ctx$view = ctx.view) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.conf) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.style) === null || _ctx$view === void 0 ? void 0 : _ctx$view.opacity;
7761
+ // OBS: stopsWithOpacity foi feito para aplicar na legenda a opacidade que também é aplicada no mapa
7762
+ // colorScaleStops retorna um array cuja estrutura é [cor, valor, cor, valor, ..., valor, cor]
7763
+ // por isso a opacidade está sendo aplicada somente nos indexes pares
7764
+ var stopsWithOpacity = ctx.view.metadata.colorScaleStops.map(function (entry, index) {
7765
+ return index % 2 === 0 ? applyOpacity(entry, typeof _confOpacity === 'number' ? _confOpacity : DEFAULT_FILL_OPACITY$2) : entry;
7766
+ });
7554
7767
  return [{
7555
7768
  type: 'SequentialColorLegend',
7556
7769
  title: viewSpec.label,
7557
7770
  unit: viewSpec.unit,
7558
- steps: ctx.view.metadata.colorScaleStops,
7771
+ steps: stopsWithOpacity,
7559
7772
  format: _objectSpread2({
7560
7773
  number: viewSpec.style.numberFormat || DEFAULT_NUMBER_FORMAT,
7561
7774
  below: 'Sem dados',
@@ -7568,21 +7781,25 @@ function _main_fill_legends(props, viewSpec, allViewSpecs, context) {
7568
7781
  function _main_fill(props, viewSpec, allViewSpecs, context) {
7569
7782
  var _maplibreColorExp = props._maplibreColorExp;
7570
7783
  var source_layer = viewSpec.source_layer;
7784
+ var _opacity = resolve.fn(function (ctx) {
7785
+ var _ctx$view2;
7786
+ return typeof ((_ctx$view2 = ctx.view) === null || _ctx$view2 === void 0 || (_ctx$view2 = _ctx$view2.conf) === null || _ctx$view2 === void 0 || (_ctx$view2 = _ctx$view2.style) === null || _ctx$view2 === void 0 ? void 0 : _ctx$view2.opacity) === 'number' ? ctx.view.conf.style.opacity : DEFAULT_FILL_OPACITY$2;
7787
+ });
7571
7788
  return {
7572
7789
  zIndex: Z_OVERLAY_BASE_1000,
7573
- source: MAIN_SOURCE_ID$2,
7790
+ source: MAIN_SOURCE_ID$5,
7574
7791
  'source-layer': source_layer,
7575
7792
  interactive: true,
7576
7793
  type: 'fill',
7577
7794
  paint: {
7578
7795
  'fill-color': _maplibreColorExp,
7579
- 'fill-opacity': DEFAULT_FILL_OPACITY$1
7796
+ 'fill-opacity': _opacity
7580
7797
  },
7581
7798
  legends: _main_fill_legends(props, viewSpec),
7582
7799
  tooltip: basicTooltip(viewSpec.tooltip)
7583
7800
  };
7584
7801
  }
7585
- function layers$2(viewSpec, allViewSpecs, context) {
7802
+ function layers$7(viewSpec, allViewSpecs, context) {
7586
7803
  viewSpec.style;
7587
7804
  var source_layer = viewSpec.source_layer;
7588
7805
  if (!source_layer) {
@@ -7600,13 +7817,13 @@ function layers$2(viewSpec, allViewSpecs, context) {
7600
7817
  // (ctx) => ctx.view?.conf?.style?.fillPattern || styleSpec.fillPattern,
7601
7818
  // )
7602
7819
 
7603
- return _defineProperty(_defineProperty({}, "main_line", _main_line({
7820
+ return _defineProperty(_defineProperty({}, "main_line", _main_line$2({
7604
7821
  }, viewSpec)), "main_fill", _main_fill({
7605
7822
  _maplibreColorExp: _maplibreColorExp
7606
7823
  }, viewSpec));
7607
7824
  }
7608
7825
 
7609
- function download$2(viewSpec, allViewSpecs, context) {
7826
+ function download$6(viewSpec, allViewSpecs, context) {
7610
7827
  return basicDownload({
7611
7828
  fileName: slugify(viewSpec.label),
7612
7829
  downloadUrl: interpolate(viewSpec.download_url, {
@@ -7615,23 +7832,23 @@ function download$2(viewSpec, allViewSpecs, context) {
7615
7832
  });
7616
7833
  }
7617
7834
 
7618
- var _excluded$a = ["style"];
7835
+ var _excluded$f = ["style"];
7619
7836
  function vector_polygon_continuous(_ref, allViewSpecs, context) {
7620
7837
  var style = _ref.style,
7621
- viewSpec = _objectWithoutProperties(_ref, _excluded$a);
7838
+ viewSpec = _objectWithoutProperties(_ref, _excluded$f);
7622
7839
  viewSpec = _objectSpread2(_objectSpread2({}, viewSpec), {}, {
7623
- style: parseStyleSpec$2(style)
7840
+ style: parseStyleSpec$7(style)
7624
7841
  });
7625
- return _objectSpread2(_objectSpread2({}, pick(viewSpec, ['id', 'path', 'label', 'sourceLabel'])), {}, {
7626
- confSchema: confSchema$1(viewSpec),
7627
- metadata: metadata$2(viewSpec, allViewSpecs, context),
7628
- sources: sources$2(viewSpec, allViewSpecs, context),
7629
- layers: layers$2(viewSpec),
7630
- download: download$2(viewSpec, allViewSpecs, context)
7842
+ return _objectSpread2(_objectSpread2({}, pick(viewSpec, ['id', 'path', 'label', 'sourceLabel', 'metodology', 'shortDescription'])), {}, {
7843
+ confSchema: confSchema$4(viewSpec),
7844
+ metadata: metadata$6(viewSpec, allViewSpecs, context),
7845
+ sources: sources$7(viewSpec, allViewSpecs, context),
7846
+ layers: layers$7(viewSpec),
7847
+ download: download$6(viewSpec, allViewSpecs, context)
7631
7848
  });
7632
7849
  }
7633
7850
 
7634
- var _excluded$9 = ["label", "line", "color", "tiles", "source_layer", "sources", "layers", "tooltip"];
7851
+ var _excluded$e = ["label", "line", "color", "tiles", "source_layer", "sources", "layers", "tooltip", "download_url"];
7635
7852
  var LINE_PATTERN_OPTIONS = [{
7636
7853
  label: 'Continua',
7637
7854
  value: 'line'
@@ -7661,7 +7878,9 @@ function vector_line(_ref, allViewSpecs, context) {
7661
7878
  layers = _ref$layers === void 0 ? {} : _ref$layers,
7662
7879
  _ref$tooltip = _ref.tooltip,
7663
7880
  tooltip = _ref$tooltip === void 0 ? {} : _ref$tooltip,
7664
- props = _objectWithoutProperties(_ref, _excluded$9);
7881
+ _ref$download_url = _ref.download_url,
7882
+ download_url = _ref$download_url === void 0 ? "" : _ref$download_url,
7883
+ props = _objectWithoutProperties(_ref, _excluded$e);
7665
7884
  if (!source_layer) {
7666
7885
  throw new Error('source_layer must be defined');
7667
7886
  }
@@ -7747,11 +7966,17 @@ function vector_line(_ref, allViewSpecs, context) {
7747
7966
  paint: _linePattern,
7748
7967
  legends: [_legend],
7749
7968
  tooltip: basicTooltip(tooltip)
7750
- })), layers)
7969
+ })), layers),
7970
+ download: basicDownload({
7971
+ fileName: slugify(label),
7972
+ downloadUrl: interpolate(download_url || '', {
7973
+ METADATA_API_ENDPOINT: context.METADATA_API_ENDPOINT
7974
+ })
7975
+ })
7751
7976
  });
7752
7977
  }
7753
7978
 
7754
- var _excluded$8 = ["label", "circle", "color", "tiles", "source_layer", "sources", "layers"];
7979
+ var _excluded$d = ["label", "circle", "color", "tiles", "source_layer", "sources", "layers"];
7755
7980
  function _parseTiles(tiles, context) {
7756
7981
  tiles = Array.isArray(tiles) ? tiles : typeof tiles === 'string' ? [tiles] : null;
7757
7982
  if (!tiles) {
@@ -7772,7 +7997,7 @@ function vector_circle(_ref, allViewSpecs, context) {
7772
7997
  sources = _ref$sources === void 0 ? {} : _ref$sources,
7773
7998
  _ref$layers = _ref.layers,
7774
7999
  layers = _ref$layers === void 0 ? {} : _ref$layers,
7775
- props = _objectWithoutProperties(_ref, _excluded$8);
8000
+ props = _objectWithoutProperties(_ref, _excluded$d);
7776
8001
  if (!source_layer) {
7777
8002
  throw new Error('source_layer must be defined');
7778
8003
  }
@@ -7839,7 +8064,7 @@ function vector_circle(_ref, allViewSpecs, context) {
7839
8064
  });
7840
8065
  }
7841
8066
 
7842
- function confSchema(viewSpec, allViewSpecs, context) {
8067
+ function confSchema$3(viewSpec, allViewSpecs, context) {
7843
8068
  var styleSpec = viewSpec.style;
7844
8069
  return {
7845
8070
  style: {
@@ -7848,21 +8073,21 @@ function confSchema(viewSpec, allViewSpecs, context) {
7848
8073
  };
7849
8074
  }
7850
8075
 
7851
- function metadata$1(viewSpec, allViewSpecs, context) {
8076
+ function metadata$5(viewSpec, allViewSpecs, context) {
7852
8077
  return {};
7853
8078
  }
7854
8079
 
7855
- var MAIN_SOURCE_ID$1 = 'main';
7856
- function sources$1(viewSpec, allViewSpecs, context) {
8080
+ var MAIN_SOURCE_ID$4 = 'main';
8081
+ function sources$6(viewSpec, allViewSpecs, context) {
7857
8082
  var tiles = viewSpec.tiles;
7858
- return _defineProperty({}, MAIN_SOURCE_ID$1, {
8083
+ return _defineProperty({}, MAIN_SOURCE_ID$4, {
7859
8084
  promoteId: 'id',
7860
8085
  type: 'vector',
7861
8086
  tiles: parseTiles(tiles, context)
7862
8087
  });
7863
8088
  }
7864
8089
 
7865
- function _main_circle_legends$1(props, viewSpec, allViewSpecs, context) {
8090
+ function _main_circle_legends$2(props, viewSpec, allViewSpecs, context) {
7866
8091
  var _legends = resolve.fn(function (ctx) {
7867
8092
  var _ctx$view, _viewSpec$style, _viewSpec$style2;
7868
8093
  var _resolvedColor = resolveColor(((_ctx$view = ctx.view) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.conf) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.style) === null || _ctx$view === void 0 ? void 0 : _ctx$view.color) || ((_viewSpec$style = viewSpec.style) === null || _viewSpec$style === void 0 ? void 0 : _viewSpec$style.color)) || schemeGeoReDUS.laranja;
@@ -7883,13 +8108,13 @@ function _main_circle_legends$1(props, viewSpec, allViewSpecs, context) {
7883
8108
  });
7884
8109
  return _legends;
7885
8110
  }
7886
- function _main_circle$1(props, viewSpec, allViewSpecs, context) {
8111
+ function _main_circle$3(props, viewSpec, allViewSpecs, context) {
7887
8112
  var _viewSpec$style4, _viewSpec$style5, _viewSpec$style6;
7888
8113
  _objectDestructuringEmpty(props);
7889
8114
  var source_layer = viewSpec.source_layer;
7890
8115
  return {
7891
8116
  zIndex: Z_OVERLAY_BASE_1000,
7892
- source: MAIN_SOURCE_ID$1,
8117
+ source: MAIN_SOURCE_ID$4,
7893
8118
  'source-layer': source_layer,
7894
8119
  interactive: true,
7895
8120
  type: 'circle',
@@ -7904,40 +8129,40 @@ function _main_circle$1(props, viewSpec, allViewSpecs, context) {
7904
8129
  'circle-stroke-color': '#ffffff',
7905
8130
  'circle-stroke-width': (_viewSpec$style6 = viewSpec.style) !== null && _viewSpec$style6 !== void 0 && _viewSpec$style6.border ? 2 : 0
7906
8131
  },
7907
- legends: _main_circle_legends$1(props, viewSpec),
8132
+ legends: _main_circle_legends$2(props, viewSpec),
7908
8133
  tooltip: basicTooltip(viewSpec.tooltip)
7909
8134
  };
7910
8135
  }
7911
- function layers$1(viewSpec, allViewSpecs, context) {
8136
+ function layers$6(viewSpec, allViewSpecs, context) {
7912
8137
  var source_layer = viewSpec.source_layer;
7913
8138
  if (!source_layer) {
7914
8139
  throw new Error('source_layer must be defined');
7915
8140
  }
7916
- return _defineProperty({}, "main_circle", _main_circle$1({}, viewSpec));
8141
+ return _defineProperty({}, "main_circle", _main_circle$3({}, viewSpec));
7917
8142
  }
7918
8143
 
7919
- function _defaultColor(inputColor) {
8144
+ function _defaultColor$1(inputColor) {
7920
8145
  return inputColor ? resolveColor(inputColor) : schemeGeoReDUS.laranja;
7921
8146
  }
7922
- function parseStyleSpec$1(styleInput) {
8147
+ function parseStyleSpec$6(styleInput) {
7923
8148
  if (!styleInput) {
7924
8149
  return {};
7925
8150
  }
7926
8151
  if (typeof styleInput === 'string') {
7927
8152
  return {
7928
- color: _defaultColor(styleInput),
8153
+ color: _defaultColor$1(styleInput),
7929
8154
  border: true
7930
8155
  };
7931
8156
  } else {
7932
8157
  return __assign(__assign({
7933
8158
  border: true
7934
8159
  }, styleInput), {
7935
- color: _defaultColor(styleInput.color)
8160
+ color: _defaultColor$1(styleInput.color)
7936
8161
  });
7937
8162
  }
7938
8163
  }
7939
8164
 
7940
- function download$1(viewSpec, allViewSpecs, context) {
8165
+ function download$5(viewSpec, allViewSpecs, context) {
7941
8166
  return basicDownload({
7942
8167
  fileName: slugify(viewSpec.label),
7943
8168
  downloadUrl: interpolate(viewSpec.download_url || "", {
@@ -7946,23 +8171,23 @@ function download$1(viewSpec, allViewSpecs, context) {
7946
8171
  });
7947
8172
  }
7948
8173
 
7949
- var _excluded$7 = ["style"];
8174
+ var _excluded$c = ["style"];
7950
8175
  function vector_point_single(_ref, allViewSpecs, context) {
7951
8176
  var style = _ref.style,
7952
- viewSpec = _objectWithoutProperties(_ref, _excluded$7);
8177
+ viewSpec = _objectWithoutProperties(_ref, _excluded$c);
7953
8178
  viewSpec = _objectSpread2(_objectSpread2({}, viewSpec), {}, {
7954
- style: parseStyleSpec$1(style)
8179
+ style: parseStyleSpec$6(style)
7955
8180
  });
7956
- return _objectSpread2(_objectSpread2({}, pick(viewSpec, ['id', 'path', 'label', 'sourceLabel'])), {}, {
7957
- confSchema: confSchema(viewSpec),
7958
- metadata: metadata$1(),
7959
- sources: sources$1(viewSpec, allViewSpecs, context),
7960
- layers: layers$1(viewSpec),
7961
- download: download$1(viewSpec, allViewSpecs, context)
8181
+ return _objectSpread2(_objectSpread2({}, pick(viewSpec, ['id', 'path', 'label', 'sourceLabel', 'metodology', 'shortDescription'])), {}, {
8182
+ confSchema: confSchema$3(viewSpec),
8183
+ metadata: metadata$5(),
8184
+ sources: sources$6(viewSpec, allViewSpecs, context),
8185
+ layers: layers$6(viewSpec),
8186
+ download: download$5(viewSpec, allViewSpecs, context)
7962
8187
  });
7963
8188
  }
7964
8189
 
7965
- function metadata(viewSpec, allViewSpecs, context) {
8190
+ function metadata$4(viewSpec, allViewSpecs, context) {
7966
8191
  var _style$radius;
7967
8192
  var style = viewSpec.style;
7968
8193
  var radiusData = (_style$radius = style.radius) !== null && _style$radius !== void 0 && _style$radius.values ? resolveAsync.fn(/*#__PURE__*/function () {
@@ -8014,10 +8239,10 @@ function metadata(viewSpec, allViewSpecs, context) {
8014
8239
  };
8015
8240
  }
8016
8241
 
8017
- var MAIN_SOURCE_ID = 'main';
8018
- function sources(viewSpec, allViewSpecs, context) {
8242
+ var MAIN_SOURCE_ID$3 = 'main';
8243
+ function sources$5(viewSpec, allViewSpecs, context) {
8019
8244
  var tiles = viewSpec.tiles;
8020
- return _defineProperty({}, MAIN_SOURCE_ID, {
8245
+ return _defineProperty({}, MAIN_SOURCE_ID$3, {
8021
8246
  promoteId: 'id',
8022
8247
  type: 'vector',
8023
8248
  tiles: parseTiles(tiles, context)
@@ -8032,7 +8257,7 @@ function _validNumericalValues(values) {
8032
8257
  });
8033
8258
  }
8034
8259
  var NO_DATA_COLOR = GEOREDUS_LABELED_RESTRICTED_USE_COLORS.cinza_claro.value;
8035
- function _main_circle_legends(props, viewSpec, allViewSpecs, context) {
8260
+ function _main_circle_legends$1(props, viewSpec, allViewSpecs, context) {
8036
8261
  var _legends = resolve.fn(function (ctx) {
8037
8262
  var _viewSpec$style;
8038
8263
  var _values = _validNumericalValues(ctx.view.metadata.radiusData.values);
@@ -8062,12 +8287,12 @@ function _main_circle_legends(props, viewSpec, allViewSpecs, context) {
8062
8287
  });
8063
8288
  return _legends;
8064
8289
  }
8065
- function _main_circle(props, viewSpec, allViewSpecs, context) {
8290
+ function _main_circle$2(props, viewSpec, allViewSpecs, context) {
8066
8291
  _objectDestructuringEmpty(props);
8067
8292
  var source_layer = viewSpec.source_layer;
8068
8293
  return {
8069
8294
  zIndex: Z_OVERLAY_BASE_1000,
8070
- source: MAIN_SOURCE_ID,
8295
+ source: MAIN_SOURCE_ID$3,
8071
8296
  'source-layer': source_layer,
8072
8297
  interactive: true,
8073
8298
  type: 'circle',
@@ -8105,23 +8330,23 @@ function _main_circle(props, viewSpec, allViewSpecs, context) {
8105
8330
  });
8106
8331
  })
8107
8332
  },
8108
- legends: _main_circle_legends(props, viewSpec),
8333
+ legends: _main_circle_legends$1(props, viewSpec),
8109
8334
  tooltip: basicTooltip(viewSpec.tooltip)
8110
8335
  };
8111
8336
  }
8112
- function layers(viewSpec, allViewSpecs, context) {
8337
+ function layers$5(viewSpec, allViewSpecs, context) {
8113
8338
  var source_layer = viewSpec.source_layer;
8114
8339
  if (!source_layer) {
8115
8340
  throw new Error('source_layer must be defined');
8116
8341
  }
8117
- return _defineProperty({}, "main_circle", _main_circle({}, viewSpec));
8342
+ return _defineProperty({}, "main_circle", _main_circle$2({}, viewSpec));
8118
8343
  }
8119
8344
 
8120
- function parseStyleSpec(styleInput) {
8345
+ function parseStyleSpec$5(styleInput) {
8121
8346
  return __assign({}, styleInput);
8122
8347
  }
8123
8348
 
8124
- function download(viewSpec, allViewSpecs, context) {
8349
+ function download$4(viewSpec, allViewSpecs, context) {
8125
8350
  return basicDownload({
8126
8351
  fileName: slugify(viewSpec.label),
8127
8352
  downloadUrl: interpolate(viewSpec.download_url || "", {
@@ -8130,16 +8355,835 @@ function download(viewSpec, allViewSpecs, context) {
8130
8355
  });
8131
8356
  }
8132
8357
 
8133
- var _excluded$6 = ["style"];
8358
+ var _excluded$b = ["style"];
8134
8359
  function vector_point_continuous(_ref, allViewSpecs, context) {
8135
8360
  var style = _ref.style,
8136
- viewSpec = _objectWithoutProperties(_ref, _excluded$6);
8361
+ viewSpec = _objectWithoutProperties(_ref, _excluded$b);
8137
8362
  viewSpec = _objectSpread2(_objectSpread2({}, viewSpec), {}, {
8138
- style: parseStyleSpec(style)
8363
+ style: parseStyleSpec$5(style)
8139
8364
  });
8140
- return _objectSpread2(_objectSpread2({}, pick(viewSpec, ['id', 'path', 'label', 'sourceLabel'])), {}, {
8365
+ return _objectSpread2(_objectSpread2({}, pick(viewSpec, ['id', 'path', 'label', 'sourceLabel', 'metodology', 'shortDescription'])), {}, {
8141
8366
  // confSchema: confSchema(viewSpec, allViewSpecs, context),
8142
- metadata: metadata(viewSpec, allViewSpecs, context),
8367
+ metadata: metadata$4(viewSpec, allViewSpecs, context),
8368
+ sources: sources$5(viewSpec, allViewSpecs, context),
8369
+ layers: layers$5(viewSpec),
8370
+ download: download$4(viewSpec, allViewSpecs, context)
8371
+ });
8372
+ }
8373
+
8374
+ function confSchema$2(viewSpec, allViewSpecs, context) {
8375
+ var styleSpec = viewSpec.style;
8376
+ return {
8377
+ style: {
8378
+ color: colorSelector(styleSpec.color),
8379
+ linePattern: linePatternSelector({
8380
+ defaultValue: styleSpec.linePattern
8381
+ }),
8382
+ lineWidth: lineWidthSelector({
8383
+ defaultValue: styleSpec.lineWidth
8384
+ })
8385
+ }
8386
+ };
8387
+ }
8388
+
8389
+ function metadata$3(viewSpec, allViewSpecs, context) {
8390
+ viewSpec.style;
8391
+ return {};
8392
+ }
8393
+
8394
+ function _main_line_legends$1(_ref, viewSpec, allViewSpecs, context) {
8395
+ var _color = _ref._color;
8396
+ var _legend = resolve.fn([_color], function (resolvedColor, ctx) {
8397
+ var _ctx$view, _ctx$view2, _viewSpec$style;
8398
+ return {
8399
+ type: 'CategoricalLegend',
8400
+ items: [{
8401
+ label: viewSpec.label,
8402
+ box: {
8403
+ style: {
8404
+ height: 0,
8405
+ borderColor: resolvedColor,
8406
+ borderTopStyle: ((_ctx$view = ctx.view) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.conf) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.style) === null || _ctx$view === void 0 ? void 0 : _ctx$view.linePattern) || styleSpec.linePattern || LINE_PATTERN_SOLID,
8407
+ borderBottomStyle: 'none',
8408
+ borderWidth: ((_ctx$view2 = ctx.view) === null || _ctx$view2 === void 0 || (_ctx$view2 = _ctx$view2.conf) === null || _ctx$view2 === void 0 || (_ctx$view2 = _ctx$view2.style) === null || _ctx$view2 === void 0 ? void 0 : _ctx$view2.lineWidth) || ((_viewSpec$style = viewSpec.style) === null || _viewSpec$style === void 0 ? void 0 : _viewSpec$style.lineWidth) || LINE_WIDTH_1
8409
+ }
8410
+ }
8411
+ }]
8412
+ };
8413
+ });
8414
+ return [_legend];
8415
+ }
8416
+ function _main_line$1(_ref2, viewSpec, allViewSpecs, context) {
8417
+ var _color = _ref2._color;
8418
+ var source_layer = viewSpec.source_layer;
8419
+ var line = resolve.fn([_color], function (resolvedColor, ctx) {
8420
+ var _ctx$view3, _viewSpec$style2, _ctx$view4, _viewSpec$style3;
8421
+ var _linePattern = ((_ctx$view3 = ctx.view) === null || _ctx$view3 === void 0 || (_ctx$view3 = _ctx$view3.conf) === null || _ctx$view3 === void 0 || (_ctx$view3 = _ctx$view3.style) === null || _ctx$view3 === void 0 ? void 0 : _ctx$view3.linePattern) || ((_viewSpec$style2 = viewSpec.style) === null || _viewSpec$style2 === void 0 ? void 0 : _viewSpec$style2.linePattern) || LINE_PATTERN_SOLID;
8422
+ if (_linePattern === 'none') {
8423
+ return null;
8424
+ }
8425
+ var _lineWidth = ((_ctx$view4 = ctx.view) === null || _ctx$view4 === void 0 || (_ctx$view4 = _ctx$view4.conf) === null || _ctx$view4 === void 0 || (_ctx$view4 = _ctx$view4.style) === null || _ctx$view4 === void 0 ? void 0 : _ctx$view4.lineWidth) || ((_viewSpec$style3 = viewSpec.style) === null || _viewSpec$style3 === void 0 ? void 0 : _viewSpec$style3.lineWidth) || LINE_WIDTH_1;
8426
+ var paint = {
8427
+ dashed: {
8428
+ 'line-dasharray': [4, 2],
8429
+ 'line-width': _lineWidth
8430
+ },
8431
+ dotted: {
8432
+ 'line-dasharray': [0.5, 2],
8433
+ 'line-width': _lineWidth
8434
+ },
8435
+ solid: {
8436
+ 'line-width': _lineWidth
8437
+ }
8438
+ }[_linePattern];
8439
+ return {
8440
+ zIndex: Z_OVERLAY_BASE_1000,
8441
+ source: 'main',
8442
+ 'source-layer': source_layer,
8443
+ type: 'line',
8444
+ layout: _linePattern === 'dotted' ? {
8445
+ 'line-cap': 'round'
8446
+ } : {},
8447
+ paint: _objectSpread2({
8448
+ 'line-color': _color
8449
+ }, paint),
8450
+ legends: _main_line_legends$1({
8451
+ _color: _color
8452
+ }, viewSpec),
8453
+ tooltip: basicTooltip(viewSpec.tooltip)
8454
+ };
8455
+ });
8456
+ return line;
8457
+ }
8458
+ function layers$4(viewSpec, allViewSpecs, context) {
8459
+ var styleSpec = viewSpec.style;
8460
+ var source_layer = viewSpec.source_layer;
8461
+ if (!source_layer) {
8462
+ throw new Error('source_layer must be defined');
8463
+ }
8464
+ var _color = resolve.fn(function (ctx) {
8465
+ var _ctx$view5;
8466
+ return resolveColor(((_ctx$view5 = ctx.view) === null || _ctx$view5 === void 0 || (_ctx$view5 = _ctx$view5.conf) === null || _ctx$view5 === void 0 || (_ctx$view5 = _ctx$view5.style) === null || _ctx$view5 === void 0 ? void 0 : _ctx$view5.color) || styleSpec.color);
8467
+ });
8468
+ return _defineProperty({}, "main_line", _main_line$1({
8469
+ _color: _color
8470
+ }, viewSpec));
8471
+ }
8472
+
8473
+ function sources$4(viewSpec, allViewSpecs, context) {
8474
+ var tiles = viewSpec.tiles;
8475
+ return {
8476
+ main: {
8477
+ promoteId: 'id',
8478
+ type: 'vector',
8479
+ tiles: parseTiles(tiles, context)
8480
+ }
8481
+ };
8482
+ }
8483
+
8484
+ function _defaultColor(inputColor) {
8485
+ return inputColor ? resolveColor(inputColor) : resolveColor('schemeGeoReDUS.laranja');
8486
+ }
8487
+ function parseStyleSpec$4(styleInput) {
8488
+ if (!styleInput) {
8489
+ return {};
8490
+ }
8491
+ if (typeof styleInput === 'string') {
8492
+ return {
8493
+ color: _defaultColor(styleInput)
8494
+ };
8495
+ } else {
8496
+ return __assign(__assign({}, styleInput), {
8497
+ color: _defaultColor(styleInput.color),
8498
+ linePattern: styleInput.linePattern || LINE_PATTERN_SOLID
8499
+ });
8500
+ }
8501
+ }
8502
+
8503
+ function download$3(viewSpec, allViewSpecs, context) {
8504
+ return basicDownload({
8505
+ fileName: slugify(viewSpec.label),
8506
+ downloadUrl: interpolate(viewSpec.download_url, {
8507
+ METADATA_API_ENDPOINT: context.METADATA_API_ENDPOINT
8508
+ })
8509
+ });
8510
+ }
8511
+
8512
+ var _excluded$a = ["style"];
8513
+ function vector_line_single(_ref, allViewSpecs, context) {
8514
+ var style = _ref.style,
8515
+ viewSpec = _objectWithoutProperties(_ref, _excluded$a);
8516
+ viewSpec = _objectSpread2(_objectSpread2({}, viewSpec), {}, {
8517
+ style: parseStyleSpec$4(style)
8518
+ });
8519
+ return _objectSpread2(_objectSpread2({}, pick(viewSpec, ['id', 'path', 'label', 'sourceLabel', 'metodology', 'shortDescription'])), {}, {
8520
+ confSchema: confSchema$2(viewSpec),
8521
+ metadata: metadata$3(viewSpec),
8522
+ sources: sources$4(viewSpec, allViewSpecs, context),
8523
+ layers: layers$4(viewSpec),
8524
+ download: download$3(viewSpec, allViewSpecs, context)
8525
+ });
8526
+ }
8527
+
8528
+ function confSchema$1(viewSpec, allViewSpecs, context) {
8529
+ var styleSpec = viewSpec.style;
8530
+ return {
8531
+ style: {
8532
+ linePattern: linePatternSelector({
8533
+ defaultValue: styleSpec.linePattern
8534
+ }),
8535
+ lineWidth: lineWidthSelector({
8536
+ defaultValue: styleSpec.lineWidth
8537
+ })
8538
+ }
8539
+ };
8540
+ }
8541
+
8542
+ function metadata$2(viewSpec, allViewSpecs, context) {
8543
+ var style = viewSpec.style;
8544
+ var categories = resolveAsync.fn(/*#__PURE__*/function () {
8545
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(ctx) {
8546
+ var _ctx$view;
8547
+ var colorSchemeId, resolvedCategories;
8548
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
8549
+ while (1) switch (_context.prev = _context.next) {
8550
+ case 0:
8551
+ // Resolve color scheme
8552
+ colorSchemeId = ((_ctx$view = ctx.view) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.conf) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.style) === null || _ctx$view === void 0 ? void 0 : _ctx$view.colorScheme) || 'schemeGeoReDUSSafe'; // resolve categories
8553
+ if (!(typeof style.categories === 'string')) {
8554
+ _context.next = 7;
8555
+ break;
8556
+ }
8557
+ _context.next = 4;
8558
+ return fetch(interpolate(style.categories, {
8559
+ METADATA_API_ENDPOINT: context.METADATA_API_ENDPOINT
8560
+ })).then(function (res) {
8561
+ return res.json();
8562
+ }).then(function (categories) {
8563
+ return uniqBy(categories, function (cat) {
8564
+ return cat.value;
8565
+ });
8566
+ });
8567
+ case 4:
8568
+ _context.t0 = _context.sent;
8569
+ _context.next = 8;
8570
+ break;
8571
+ case 7:
8572
+ _context.t0 = Array.isArray(style.categories) ? style.categories.map(function (categoryInput) {
8573
+ return typeof categoryInput === 'string' ? {
8574
+ value: categoryInput
8575
+ } : categoryInput;
8576
+ }) : null;
8577
+ case 8:
8578
+ resolvedCategories = _context.t0;
8579
+ if (resolvedCategories) {
8580
+ _context.next = 11;
8581
+ break;
8582
+ }
8583
+ throw new Error('could not resolve categories ' + viewSpec.id);
8584
+ case 11:
8585
+ return _context.abrupt("return", resolvedCategories.map(function (cat, index) {
8586
+ var color = cat.color || resolveCategoricalSchemeColor(colorSchemeId, index);
8587
+ if (!color) {
8588
+ throw new Error("Could not resolve color for ".concat(cat.value));
8589
+ }
8590
+ return _objectSpread2(_objectSpread2({}, cat), {}, {
8591
+ color: color,
8592
+ label: cat.label || humanize(cat.value)
8593
+ });
8594
+ }));
8595
+ case 12:
8596
+ case "end":
8597
+ return _context.stop();
8598
+ }
8599
+ }, _callee);
8600
+ }));
8601
+ return function (_x) {
8602
+ return _ref.apply(this, arguments);
8603
+ };
8604
+ }());
8605
+ return {
8606
+ categories: categories
8607
+ };
8608
+ }
8609
+
8610
+ function _main_line_legends(props, viewSpec, allViewSpecs, context) {
8611
+ var _legend = resolve.fn(function (ctx) {
8612
+ var categories = ctx.view.metadata.categories;
8613
+ return {
8614
+ type: 'CategoricalLegend',
8615
+ title: viewSpec.label,
8616
+ items: categories.map(function (cat) {
8617
+ var _ctx$view, _ctx$view2, _viewSpec$style;
8618
+ return {
8619
+ id: cat.value,
8620
+ label: cat.label,
8621
+ box: {
8622
+ style: {
8623
+ height: 0,
8624
+ borderColor: cat.color,
8625
+ borderTopStyle: ((_ctx$view = ctx.view) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.conf) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.style) === null || _ctx$view === void 0 ? void 0 : _ctx$view.linePattern) || styleSpec.linePattern || LINE_PATTERN_SOLID,
8626
+ borderBottomStyle: 'none',
8627
+ borderWidth: ((_ctx$view2 = ctx.view) === null || _ctx$view2 === void 0 || (_ctx$view2 = _ctx$view2.conf) === null || _ctx$view2 === void 0 || (_ctx$view2 = _ctx$view2.style) === null || _ctx$view2 === void 0 ? void 0 : _ctx$view2.lineWidth) || ((_viewSpec$style = viewSpec.style) === null || _viewSpec$style === void 0 ? void 0 : _viewSpec$style.lineWidth) || LINE_WIDTH_1
8628
+ }
8629
+ }
8630
+ };
8631
+ })
8632
+ };
8633
+ });
8634
+ return [_legend];
8635
+ }
8636
+ function _main_line(_ref, viewSpec, allViewSpecs, context) {
8637
+ var _maplibreColorExp = _ref._maplibreColorExp;
8638
+ var source_layer = viewSpec.source_layer;
8639
+ var line = resolve.fn(function (ctx) {
8640
+ var _ctx$view3, _viewSpec$style2, _ctx$view4, _viewSpec$style3;
8641
+ var _linePattern = ((_ctx$view3 = ctx.view) === null || _ctx$view3 === void 0 || (_ctx$view3 = _ctx$view3.conf) === null || _ctx$view3 === void 0 || (_ctx$view3 = _ctx$view3.style) === null || _ctx$view3 === void 0 ? void 0 : _ctx$view3.linePattern) || ((_viewSpec$style2 = viewSpec.style) === null || _viewSpec$style2 === void 0 ? void 0 : _viewSpec$style2.linePattern) || LINE_PATTERN_SOLID;
8642
+ if (_linePattern === 'none') {
8643
+ return null;
8644
+ }
8645
+ var _lineWidth = ((_ctx$view4 = ctx.view) === null || _ctx$view4 === void 0 || (_ctx$view4 = _ctx$view4.conf) === null || _ctx$view4 === void 0 || (_ctx$view4 = _ctx$view4.style) === null || _ctx$view4 === void 0 ? void 0 : _ctx$view4.lineWidth) || ((_viewSpec$style3 = viewSpec.style) === null || _viewSpec$style3 === void 0 ? void 0 : _viewSpec$style3.lineWidth) || LINE_WIDTH_1;
8646
+ var paint = {
8647
+ dashed: {
8648
+ 'line-dasharray': [4, 2],
8649
+ 'line-width': _lineWidth
8650
+ },
8651
+ dotted: {
8652
+ 'line-dasharray': [0.5, 2],
8653
+ 'line-width': _lineWidth
8654
+ },
8655
+ solid: {
8656
+ 'line-width': _lineWidth
8657
+ }
8658
+ }[_linePattern];
8659
+ return {
8660
+ zIndex: Z_OVERLAY_BASE_1000,
8661
+ source: 'main',
8662
+ 'source-layer': source_layer,
8663
+ type: 'line',
8664
+ layout: _linePattern === 'dotted' ? {
8665
+ 'line-cap': 'round'
8666
+ } : {},
8667
+ paint: _objectSpread2({
8668
+ 'line-color': _maplibreColorExp
8669
+ }, paint),
8670
+ legends: _main_line_legends({}, viewSpec),
8671
+ tooltip: basicTooltip(viewSpec.tooltip)
8672
+ };
8673
+ });
8674
+ return line;
8675
+ }
8676
+ function layers$3(viewSpec, allViewSpecs, context) {
8677
+ var styleSpec = viewSpec.style;
8678
+ var source_layer = viewSpec.source_layer;
8679
+ if (!source_layer) {
8680
+ throw new Error('source_layer must be defined');
8681
+ }
8682
+ var _maplibreColorExp = resolve.fn(function (ctx) {
8683
+ return ['match', ['get', styleSpec.categoryKey]].concat(_toConsumableArray(ctx.view.metadata.categories.map(function (cat) {
8684
+ return [cat.value, resolveColor(cat.color)];
8685
+ }).flat()), ['#CCCCCC']);
8686
+ });
8687
+ return _defineProperty({}, "main_line", _main_line({
8688
+ _maplibreColorExp: _maplibreColorExp
8689
+ }, viewSpec));
8690
+ }
8691
+
8692
+ function sources$3(viewSpec, allViewSpecs, context) {
8693
+ var tiles = viewSpec.tiles;
8694
+ return {
8695
+ main: {
8696
+ promoteId: 'id',
8697
+ type: 'vector',
8698
+ tiles: parseTiles(tiles, context)
8699
+ }
8700
+ };
8701
+ }
8702
+
8703
+ var DEFAULT_COLOR_SCHEME_ID$2 = 'schemeGeoReDUSSafe';
8704
+ function parseStyleSpec$3(styleInput) {
8705
+ if (!styleInput) {
8706
+ throw new Error('expected existing styleInput');
8707
+ }
8708
+ return __assign({
8709
+ colorScheme: DEFAULT_COLOR_SCHEME_ID$2
8710
+ }, styleInput);
8711
+ }
8712
+
8713
+ function download$2(viewSpec, allViewSpecs, context) {
8714
+ return basicDownload({
8715
+ fileName: slugify(viewSpec.label),
8716
+ downloadUrl: interpolate(viewSpec.download_url, {
8717
+ METADATA_API_ENDPOINT: context.METADATA_API_ENDPOINT
8718
+ })
8719
+ });
8720
+ }
8721
+
8722
+ var _excluded$9 = ["style"];
8723
+ function vector_line_categorical(_ref, allViewSpecs, context) {
8724
+ var style = _ref.style,
8725
+ viewSpec = _objectWithoutProperties(_ref, _excluded$9);
8726
+ viewSpec = _objectSpread2(_objectSpread2({}, viewSpec), {}, {
8727
+ style: parseStyleSpec$3(style)
8728
+ });
8729
+ return _objectSpread2(_objectSpread2({}, pick(viewSpec, ['id', 'path', 'label', 'sourceLabel', 'metodology', 'shortDescription'])), {}, {
8730
+ confSchema: confSchema$1(viewSpec),
8731
+ metadata: metadata$2(viewSpec, allViewSpecs, context),
8732
+ sources: sources$3(viewSpec, allViewSpecs, context),
8733
+ layers: layers$3(viewSpec),
8734
+ download: download$2(viewSpec, allViewSpecs, context)
8735
+ });
8736
+ }
8737
+
8738
+ var MAIN_SOURCE_ID$2 = 'main';
8739
+ function _formatColorMapQueryParamValue(categories) {
8740
+ return JSON.stringify(Object.fromEntries(categories.map(function (cat) {
8741
+ return ["".concat(cat.value), cat.color];
8742
+ })));
8743
+ }
8744
+ function sources$2(viewSpec, allViewSpecs, context) {
8745
+ var tiles = viewSpec.tiles,
8746
+ style = viewSpec.style;
8747
+ var _tiles = parseTiles(tiles, context).map(function (url) {
8748
+ var queryIndex = url.indexOf('?');
8749
+ var base = queryIndex === -1 ? url : url.slice(0, queryIndex);
8750
+ var query = queryIndex === -1 ? '' : url.slice(queryIndex + 1);
8751
+ var params = new URLSearchParams(query);
8752
+ var colormap = params.get('colormap') || _formatColorMapQueryParamValue(style.categories);
8753
+ params.set('colormap', colormap);
8754
+ return "".concat(base, "?").concat(params.toString());
8755
+ });
8756
+ return _defineProperty({}, MAIN_SOURCE_ID$2, {
8757
+ minzoom: 9,
8758
+ maxzoom: 14,
8759
+ type: 'raster',
8760
+ tiles: _tiles
8761
+ });
8762
+ }
8763
+
8764
+ var DEFAULT_RASTER_FILL_OPACITY = 0.7;
8765
+ function layers$2(viewSpec, allViewSpecs, context) {
8766
+ var categories = viewSpec.style.categories;
8767
+ var _legends = [{
8768
+ type: 'CategoricalLegend',
8769
+ title: viewSpec.label,
8770
+ items: categories.map(function (cat) {
8771
+ return {
8772
+ id: cat.value,
8773
+ label: cat.label || cat.value,
8774
+ color: cat.color,
8775
+ box: {
8776
+ style: {
8777
+ backgroundColor: cat.color
8778
+ }
8779
+ }
8780
+ };
8781
+ })
8782
+ }];
8783
+ return _defineProperty({}, "main_raster", {
8784
+ minzoom: 3,
8785
+ type: 'raster',
8786
+ source: MAIN_SOURCE_ID$2,
8787
+ paint: {
8788
+ 'raster-opacity': DEFAULT_RASTER_FILL_OPACITY
8789
+ },
8790
+ legends: _legends
8791
+ });
8792
+ }
8793
+
8794
+ var DEFAULT_COLOR_SCHEME_ID$1 = 'schemeGeoReDUSSafe';
8795
+ function parseStyleSpec$2(styleInput) {
8796
+ if (!styleInput) {
8797
+ throw new Error('expected existing styleInput');
8798
+ }
8799
+ var colorScheme = styleInput.colorScheme || DEFAULT_COLOR_SCHEME_ID$1;
8800
+ var categories = styleInput.categories.map(function (category, index) {
8801
+ return __assign(__assign({}, category), {
8802
+ color: category.color ? resolveColor(category.color) : resolveCategoricalSchemeColor(colorScheme, index)
8803
+ });
8804
+ });
8805
+ return __assign(__assign({}, styleInput), {
8806
+ colorScheme: DEFAULT_COLOR_SCHEME_ID$1,
8807
+ categories: categories
8808
+ });
8809
+ }
8810
+
8811
+ var _excluded$8 = ["style"];
8812
+ function raster_categorical(_ref, allViewSpecs, context) {
8813
+ var style = _ref.style,
8814
+ viewSpec = _objectWithoutProperties(_ref, _excluded$8);
8815
+ viewSpec = _objectSpread2(_objectSpread2({}, viewSpec), {}, {
8816
+ style: parseStyleSpec$2(style)
8817
+ });
8818
+ return _objectSpread2(_objectSpread2({}, pick(viewSpec, ['id', 'path', 'label', 'sourceLabel', 'metodology', 'shortDescription'])), {}, {
8819
+ sources: sources$2(viewSpec, allViewSpecs, context),
8820
+ layers: layers$2(viewSpec)
8821
+ // download: download(viewSpec, allViewSpecs, context),
8822
+ });
8823
+ }
8824
+
8825
+ function metadata$1(viewSpec, allViewSpecs, context) {
8826
+ var style = viewSpec.style;
8827
+ var categories = resolveAsync.fn(/*#__PURE__*/function () {
8828
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(ctx) {
8829
+ var _ctx$view;
8830
+ var colorSchemeId, resolvedCategories;
8831
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
8832
+ while (1) switch (_context.prev = _context.next) {
8833
+ case 0:
8834
+ // Resolve color scheme
8835
+ colorSchemeId = ((_ctx$view = ctx.view) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.conf) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.style) === null || _ctx$view === void 0 ? void 0 : _ctx$view.colorScheme) || 'schemeGeoReDUSSafe'; // resolve categories
8836
+ if (!(typeof style.categories === 'string')) {
8837
+ _context.next = 7;
8838
+ break;
8839
+ }
8840
+ _context.next = 4;
8841
+ return fetch(interpolate(style.categories, {
8842
+ METADATA_API_ENDPOINT: context.METADATA_API_ENDPOINT
8843
+ })).then(function (res) {
8844
+ return res.json();
8845
+ }).then(function (categories) {
8846
+ return uniqBy(categories, function (cat) {
8847
+ return cat.value;
8848
+ }).filter(function (cat) {
8849
+ return cat.value !== null;
8850
+ });
8851
+ });
8852
+ case 4:
8853
+ _context.t0 = _context.sent;
8854
+ _context.next = 8;
8855
+ break;
8856
+ case 7:
8857
+ _context.t0 = Array.isArray(style.categories) ? style.categories.map(function (categoryInput) {
8858
+ return typeof categoryInput === 'string' ? {
8859
+ value: categoryInput
8860
+ } : categoryInput;
8861
+ }) : null;
8862
+ case 8:
8863
+ resolvedCategories = _context.t0;
8864
+ if (resolvedCategories) {
8865
+ _context.next = 11;
8866
+ break;
8867
+ }
8868
+ throw new Error('could not resolve categories ' + viewSpec.id);
8869
+ case 11:
8870
+ return _context.abrupt("return", resolvedCategories.map(function (cat, index) {
8871
+ var color = cat.color || resolveCategoricalSchemeColor(colorSchemeId, index);
8872
+ if (!color) {
8873
+ throw new Error("Could not resolve color for ".concat(cat.value));
8874
+ }
8875
+ return _objectSpread2(_objectSpread2({}, cat), {}, {
8876
+ color: color,
8877
+ label: cat.label || humanize(cat.value)
8878
+ });
8879
+ }));
8880
+ case 12:
8881
+ case "end":
8882
+ return _context.stop();
8883
+ }
8884
+ }, _callee);
8885
+ }));
8886
+ return function (_x) {
8887
+ return _ref.apply(this, arguments);
8888
+ };
8889
+ }());
8890
+ return {
8891
+ categories: categories
8892
+ };
8893
+ }
8894
+
8895
+ var MAIN_SOURCE_ID$1 = 'main';
8896
+ function sources$1(viewSpec, allViewSpecs, context) {
8897
+ var tiles = viewSpec.tiles;
8898
+ return _defineProperty({}, MAIN_SOURCE_ID$1, {
8899
+ promoteId: 'id',
8900
+ type: 'vector',
8901
+ tiles: parseTiles(tiles, context)
8902
+ });
8903
+ }
8904
+
8905
+ function _main_circle_legends(props, viewSpec, allViewSpecs, context) {
8906
+ var _legends = resolve.fn(function (ctx) {
8907
+ var categories = ctx.view.metadata.categories;
8908
+ return [{
8909
+ type: 'CategoricalLegend',
8910
+ title: viewSpec.label,
8911
+ items: categories.map(function (cat) {
8912
+ var _viewSpec$style;
8913
+ return {
8914
+ id: cat.value,
8915
+ label: cat.label,
8916
+ color: resolveColor(cat.color),
8917
+ box: {
8918
+ style: {
8919
+ backgroundColor: resolveColor(cat.color),
8920
+ border: 'none',
8921
+ borderRadius: '30px',
8922
+ opacity: ((_viewSpec$style = viewSpec.style) === null || _viewSpec$style === void 0 ? void 0 : _viewSpec$style.opacity) || 1
8923
+ }
8924
+ }
8925
+ };
8926
+ })
8927
+ }];
8928
+ });
8929
+ return _legends;
8930
+ }
8931
+ function _main_circle$1(props, viewSpec, allViewSpecs, context) {
8932
+ var _viewSpec$style2, _viewSpec$style3;
8933
+ var _maplibreColorExp = props._maplibreColorExp;
8934
+ var source_layer = viewSpec.source_layer;
8935
+ return {
8936
+ zIndex: Z_OVERLAY_BASE_1000,
8937
+ source: MAIN_SOURCE_ID$1,
8938
+ 'source-layer': source_layer,
8939
+ interactive: true,
8940
+ type: 'circle',
8941
+ paint: {
8942
+ 'circle-color': _maplibreColorExp,
8943
+ 'circle-opacity': 1,
8944
+ 'circle-radius': ((_viewSpec$style2 = viewSpec.style) === null || _viewSpec$style2 === void 0 ? void 0 : _viewSpec$style2.radius) || 10,
8945
+ 'circle-stroke-color': '#ffffff',
8946
+ 'circle-stroke-width': (_viewSpec$style3 = viewSpec.style) !== null && _viewSpec$style3 !== void 0 && _viewSpec$style3.border ? 2 : 0
8947
+ },
8948
+ legends: _main_circle_legends(props, viewSpec),
8949
+ tooltip: basicTooltip(viewSpec.tooltip)
8950
+ };
8951
+ }
8952
+ function layers$1(viewSpec, allViewSpecs, context) {
8953
+ var source_layer = viewSpec.source_layer;
8954
+ if (!source_layer) {
8955
+ throw new Error('source_layer must be defined');
8956
+ }
8957
+ var _maplibreColorExp = resolve.fn(function (ctx) {
8958
+ return ['match', ['get', viewSpec.style.categoryKey]].concat(_toConsumableArray(ctx.view.metadata.categories.map(function (cat) {
8959
+ return [cat.value, resolveColor(cat.color)];
8960
+ }).flat()), ['#CCCCCC']);
8961
+ });
8962
+ return _defineProperty({}, "main_circle", _main_circle$1({
8963
+ _maplibreColorExp: _maplibreColorExp
8964
+ }, viewSpec));
8965
+ }
8966
+
8967
+ var DEFAULT_COLOR_SCHEME_ID = 'schemeGeoReDUSSafe';
8968
+ function parseStyleSpec$1(styleInput) {
8969
+ if (!styleInput) {
8970
+ throw new Error('expected existing styleInput');
8971
+ }
8972
+ return __assign({
8973
+ colorScheme: DEFAULT_COLOR_SCHEME_ID,
8974
+ border: true
8975
+ }, styleInput);
8976
+ }
8977
+
8978
+ function download$1(viewSpec, allViewSpecs, context) {
8979
+ return basicDownload({
8980
+ fileName: slugify(viewSpec.label),
8981
+ downloadUrl: interpolate(viewSpec.download_url || "", {
8982
+ METADATA_API_ENDPOINT: context.METADATA_API_ENDPOINT
8983
+ })
8984
+ });
8985
+ }
8986
+
8987
+ var _excluded$7 = ["style"];
8988
+ function vector_point_categorical(_ref, allViewSpecs, context) {
8989
+ var style = _ref.style,
8990
+ viewSpec = _objectWithoutProperties(_ref, _excluded$7);
8991
+ viewSpec = _objectSpread2(_objectSpread2({}, viewSpec), {}, {
8992
+ style: parseStyleSpec$1(style)
8993
+ });
8994
+ return _objectSpread2(_objectSpread2({}, pick(viewSpec, ['id', 'path', 'label', 'sourceLabel', 'metodology', 'shortDescription'])), {}, {
8995
+ metadata: metadata$1(viewSpec, allViewSpecs, context),
8996
+ sources: sources$1(viewSpec, allViewSpecs, context),
8997
+ layers: layers$1(viewSpec),
8998
+ download: download$1(viewSpec, allViewSpecs, context)
8999
+ });
9000
+ }
9001
+
9002
+ var DEFAULT_STEPS = [{
9003
+ step: 0.2,
9004
+ label: 'Muito Baixa'
9005
+ }, {
9006
+ step: 0.4,
9007
+ label: 'Baixa'
9008
+ }, {
9009
+ step: 0.6,
9010
+ label: 'Média'
9011
+ }, {
9012
+ step: 0.8,
9013
+ label: 'Alta'
9014
+ }, {
9015
+ step: 1,
9016
+ label: 'Muito Alta'
9017
+ }];
9018
+ var DEFAULT_HEATMAP_COLOR_SCHEME_ID = '-schemeSpectral';
9019
+ function parseStyleSpec(styleInput) {
9020
+ if (styleInput === void 0) {
9021
+ styleInput = {};
9022
+ }
9023
+ var steps = styleInput.steps || DEFAULT_STEPS;
9024
+ var colorSchemeId = styleInput.colorScheme || DEFAULT_HEATMAP_COLOR_SCHEME_ID;
9025
+ return __assign(__assign({
9026
+ circle: false
9027
+ }, styleInput), {
9028
+ steps: steps.map(function (step, index) {
9029
+ return __assign(__assign({}, step), {
9030
+ color: step.color ? resolveColor(step.color) : COLOR_SCHEMES[colorSchemeId].scalesByK[steps.length][index]
9031
+ });
9032
+ }),
9033
+ colorScheme: colorSchemeId
9034
+ });
9035
+ }
9036
+
9037
+ function confSchema(viewSpec, allViewSpecs, context) {
9038
+ var _viewSpec$style;
9039
+ return {
9040
+ style: {
9041
+ colorScheme: continuousColorSchemeSelector({
9042
+ defaultValue: ((_viewSpec$style = viewSpec.style) === null || _viewSpec$style === void 0 ? void 0 : _viewSpec$style.colorScheme) || DEFAULT_HEATMAP_COLOR_SCHEME_ID
9043
+ }),
9044
+ opacity: viewSpec.style.circle ? null : opacitySlider({
9045
+ defaultValue: 1
9046
+ })
9047
+ }
9048
+ };
9049
+ }
9050
+
9051
+ function metadata(viewSpec, allViewSpecs, context) {
9052
+ var style = viewSpec.style;
9053
+ return resolveAsync.fn(/*#__PURE__*/function () {
9054
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(ctx) {
9055
+ var _ctx$view$conf;
9056
+ var colorSchemeId, steps;
9057
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
9058
+ while (1) switch (_context.prev = _context.next) {
9059
+ case 0:
9060
+ colorSchemeId = ((_ctx$view$conf = ctx.view.conf) === null || _ctx$view$conf === void 0 || (_ctx$view$conf = _ctx$view$conf.style) === null || _ctx$view$conf === void 0 ? void 0 : _ctx$view$conf.colorScheme) || style.colorScheme;
9061
+ steps = style.steps.map(function (step, index) {
9062
+ return _objectSpread2(_objectSpread2({}, step), {}, {
9063
+ color: COLOR_SCHEMES[colorSchemeId].scalesByK[style.steps.length][index]
9064
+ });
9065
+ });
9066
+ return _context.abrupt("return", {
9067
+ steps: steps
9068
+ });
9069
+ case 3:
9070
+ case "end":
9071
+ return _context.stop();
9072
+ }
9073
+ }, _callee);
9074
+ }));
9075
+ return function (_x) {
9076
+ return _ref.apply(this, arguments);
9077
+ };
9078
+ }());
9079
+ }
9080
+
9081
+ var MAIN_SOURCE_ID = 'main';
9082
+ function sources(viewSpec, allViewSpecs, context) {
9083
+ var tiles = viewSpec.tiles;
9084
+ return _defineProperty({}, MAIN_SOURCE_ID, {
9085
+ promoteId: 'id',
9086
+ type: 'vector',
9087
+ tiles: parseTiles(tiles, context)
9088
+ });
9089
+ }
9090
+
9091
+ var DEFAULT_FILL_OPACITY = 1;
9092
+ function _main_heatmap_legends(props, viewSpec, allViewSpecs, context) {
9093
+ var _legends = resolve.fn(function (ctx) {
9094
+ return [{
9095
+ type: 'CategoricalLegend',
9096
+ title: viewSpec.label,
9097
+ items: ctx.view.metadata.steps.map(function (item) {
9098
+ return {
9099
+ id: item.label,
9100
+ label: item.label,
9101
+ color: resolveColor(item.color)
9102
+ };
9103
+ })
9104
+ }];
9105
+ });
9106
+ return _legends;
9107
+ }
9108
+ function _main_heatmap(props, viewSpec, allViewSpecs, context) {
9109
+ _objectDestructuringEmpty(props);
9110
+ var source_layer = viewSpec.source_layer;
9111
+ var heatmap = resolve.fn(function (ctx) {
9112
+ var _ctx$view;
9113
+ var _confOpacity = (_ctx$view = ctx.view) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.conf) === null || _ctx$view === void 0 || (_ctx$view = _ctx$view.style) === null || _ctx$view === void 0 ? void 0 : _ctx$view.opacity;
9114
+ return _objectSpread2(_objectSpread2({
9115
+ zIndex: Z_OVERLAY_BASE_1000,
9116
+ source: MAIN_SOURCE_ID,
9117
+ 'source-layer': source_layer,
9118
+ interactive: true,
9119
+ type: 'heatmap',
9120
+ minzoom: viewSpec.style.minzoom || 7
9121
+ }, viewSpec.style.maxzoom ? {
9122
+ maxzoom: viewSpec.style.maxzoom
9123
+ } : {}), {}, {
9124
+ paint: {
9125
+ 'heatmap-weight': viewSpec.style.weight || 1,
9126
+ 'heatmap-color': ['interpolate', ['linear'], ['heatmap-density'], 0, 'transparent'].concat(_toConsumableArray(ctx.view.metadata.steps.flatMap(function (item) {
9127
+ return [item.step, resolveColor(item.color)];
9128
+ }))),
9129
+ 'heatmap-radius': viewSpec.style.radius && Array.isArray(viewSpec.style.radius) ? ['interpolate', ['linear'], ['zoom']].concat(_toConsumableArray(viewSpec.style.radius)) : viewSpec.style.radius || ['interpolate', ['linear'], ['zoom'], 9, 2, 17, 30],
9130
+ 'heatmap-opacity': viewSpec.style.circle ? ['interpolate', ['linear'], ['zoom'], 12, 1, 16, 0] : typeof _confOpacity === 'number' ? _confOpacity : viewSpec.style.opacity ? viewSpec.style.opacity : DEFAULT_FILL_OPACITY
9131
+ },
9132
+ legends: _main_heatmap_legends(props, viewSpec)
9133
+ });
9134
+ });
9135
+ return heatmap;
9136
+ }
9137
+ function _main_circle(props, viewSpec, allViewSpecs, context) {
9138
+ var source_layer = viewSpec.source_layer;
9139
+ var circle = resolve.fn(function (ctx) {
9140
+ var _opacity = viewSpec.style.opacity ? viewSpec.style.opacity : viewSpec.style.opacity || ['interpolate', ['linear'], ['zoom'], 14, 0, 17, 1];
9141
+ return {
9142
+ zIndex: Z_OVERLAY_BASE_1000,
9143
+ source: MAIN_SOURCE_ID,
9144
+ 'source-layer': source_layer,
9145
+ type: 'circle',
9146
+ interactive: true,
9147
+ minzoom: 14,
9148
+ paint: {
9149
+ 'circle-color': resolveColor(ctx.view.metadata.steps[Math.floor(ctx.view.metadata.steps.length / 2)].color),
9150
+ 'circle-stroke-color': '#FFFFFF',
9151
+ 'circle-stroke-width': 2,
9152
+ 'circle-stroke-opacity': _opacity,
9153
+ 'circle-radius': viewSpec.style.radius && Array.isArray(viewSpec.style.radius) ? ['interpolate', ['linear'], ['zoom']].concat(_toConsumableArray(viewSpec.style.radius)) : viewSpec.style.radius || ['interpolate', ['linear'], ['zoom'], 11, 2, 17, 10],
9154
+ 'circle-opacity': _opacity
9155
+ }
9156
+ };
9157
+ });
9158
+ return circle;
9159
+ }
9160
+ function layers(viewSpec, allViewSpecs, context) {
9161
+ var source_layer = viewSpec.source_layer;
9162
+ if (!source_layer) {
9163
+ throw new Error('source_layer must be defined');
9164
+ }
9165
+ return _defineProperty(_defineProperty({}, "main_heatmap", _main_heatmap({}, viewSpec)), "main_circle", viewSpec.style.circle && _main_circle({}, viewSpec));
9166
+ }
9167
+
9168
+ function download(viewSpec, allViewSpecs, context) {
9169
+ return basicDownload({
9170
+ fileName: slugify(viewSpec.label),
9171
+ downloadUrl: interpolate(viewSpec.download_url || "", {
9172
+ METADATA_API_ENDPOINT: context.METADATA_API_ENDPOINT
9173
+ })
9174
+ });
9175
+ }
9176
+
9177
+ var _excluded$6 = ["style"];
9178
+ function vector_heatmap(_ref, allViewSpecs, context) {
9179
+ var style = _ref.style,
9180
+ viewSpec = _objectWithoutProperties(_ref, _excluded$6);
9181
+ viewSpec = _objectSpread2(_objectSpread2({}, viewSpec), {}, {
9182
+ style: parseStyleSpec(style)
9183
+ });
9184
+ return _objectSpread2(_objectSpread2({}, pick(viewSpec, ['id', 'path', 'label', 'sourceLabel', 'metodology', 'shortDescription'])), {}, {
9185
+ confSchema: confSchema(viewSpec),
9186
+ metadata: metadata(viewSpec),
8143
9187
  sources: sources(viewSpec, allViewSpecs, context),
8144
9188
  layers: layers(viewSpec),
8145
9189
  download: download(viewSpec, allViewSpecs, context)
@@ -8152,8 +9196,13 @@ var PRESETS = /*#__PURE__*/Object.freeze({
8152
9196
  cem_censo_2022: cem_censo_2022,
8153
9197
  cem_escolas_2022: cem_escolas_2022,
8154
9198
  cem_saude_2024: cem_saude_2024,
9199
+ raster_categorical: raster_categorical,
8155
9200
  vector_circle: vector_circle,
9201
+ vector_heatmap: vector_heatmap,
8156
9202
  vector_line: vector_line,
9203
+ vector_line_categorical: vector_line_categorical,
9204
+ vector_line_single: vector_line_single,
9205
+ vector_point_categorical: vector_point_categorical,
8157
9206
  vector_point_continuous: vector_point_continuous,
8158
9207
  vector_point_single: vector_point_single,
8159
9208
  vector_polygon: vector_polygon,
@@ -8343,7 +9392,7 @@ var resolveControls = _stageResolver('controls', function (controls, _a) {
8343
9392
  var layerLegends = view.layers ? Object.entries(view.layers).flatMap(function (_a) {
8344
9393
  var layerRelativeId = _a[0],
8345
9394
  layer = _a[1];
8346
- return layer.hidden || layer.visibility === 'none' ? [] : (layer.legends || []).map(function (legend, index) {
9395
+ return layer.hidden || layer.visibility === 'none' ? [] : (layer.legends || []).filter(Boolean).map(function (legend, index) {
8347
9396
  return __assign(__assign({}, legend), {
8348
9397
  //
8349
9398
  // TODO: review if there is a better approach
@@ -8354,7 +9403,7 @@ var resolveControls = _stageResolver('controls', function (controls, _a) {
8354
9403
  });
8355
9404
  }) : [];
8356
9405
  return __assign(__assign({}, controls || {}), {
8357
- legends: __spreadArray(__spreadArray([], controls.legends || [], true), layerLegends, true)
9406
+ legends: __spreadArray(__spreadArray([], (controls.legends || []).filter(Boolean), true), layerLegends, true)
8358
9407
  });
8359
9408
  });
8360
9409
  var resolveDownload = _stageResolver('download');
@@ -9992,6 +11041,7 @@ var index = /*#__PURE__*/Object.freeze({
9992
11041
  hand: hand,
9993
11042
  overture_places_poc: overture_places_poc,
9994
11043
  piloto_mobilidade_stops: piloto_mobilidade_stops,
11044
+ raster_categorical: raster_categorical,
9995
11045
  redus_mutirao_cop_2025: redus_mutirao_cop_2025,
9996
11046
  resolveConfSchema: resolveConfSchema,
9997
11047
  resolveControls: resolveControls,
@@ -10003,7 +11053,11 @@ var index = /*#__PURE__*/Object.freeze({
10003
11053
  resolveViewSpecs: resolveViewSpecs,
10004
11054
  temperatura_superficie: temperatura_superficie,
10005
11055
  vector_circle: vector_circle,
11056
+ vector_heatmap: vector_heatmap,
10006
11057
  vector_line: vector_line,
11058
+ vector_line_categorical: vector_line_categorical,
11059
+ vector_line_single: vector_line_single,
11060
+ vector_point_categorical: vector_point_categorical,
10007
11061
  vector_point_continuous: vector_point_continuous,
10008
11062
  vector_point_single: vector_point_single,
10009
11063
  vector_polygon: vector_polygon,