kepler.gl
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
358 lines (348 loc) • 76.5 kB
JavaScript
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
var _react = _interopRequireWildcard(require("/Users/ihordykhta/Desktop/unfolded/kepler.gl/node_modules/react"));
var _styledComponents = _interopRequireDefault(require("/Users/ihordykhta/Desktop/unfolded/kepler.gl/node_modules/styled-components"));
var _src = require("/Users/ihordykhta/Desktop/unfolded/kepler.gl/src/constants/src");
var _src2 = require("/Users/ihordykhta/Desktop/unfolded/kepler.gl/src/layers/src");
var _src3 = require("/Users/ihordykhta/Desktop/unfolded/kepler.gl/src/localization/src");
var _src4 = require("/Users/ihordykhta/Desktop/unfolded/kepler.gl/src/utils/src");
var _rasterTileColormapListItem = require("./raster-tile-colormap-list-item");
var _styledComponents2 = require("../../common/styled-components");
var _switch = _interopRequireDefault(require("../../common/switch"));
var _infoHelper = _interopRequireDefault(require("../../common/info-helper"));
var _itemSelector = _interopRequireDefault(require("../../common/item-selector/item-selector"));
var _visConfigSlider = _interopRequireDefault(require("../../side-panel/layer-panel/vis-config-slider"));
var _layerConfigGroup = _interopRequireWildcard(require("../../side-panel/layer-panel/layer-config-group"));
var _visConfigSwitch = _interopRequireDefault(require("../../side-panel/layer-panel/vis-config-switch"));
var _templateObject, _templateObject2, _templateObject3; // SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var STAC_SEARCH_UI_ENABLED = true;
var StyledVisConfigSwitch = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n\n .vis-config-switch__title {\n display: flex;\n }\n"])));
var CustomVisConfigSwitch = function CustomVisConfigSwitch(_ref) {
var _ref$layer = _ref.layer,
id = _ref$layer.id,
config = _ref$layer.config,
property = _ref.property,
_onChange2 = _ref.onChange,
label = _ref.label,
disabled = _ref.disabled;
return /*#__PURE__*/_react["default"].createElement(_styledComponents2.SidePanelSection, {
disabled: Boolean(disabled)
}, /*#__PURE__*/_react["default"].createElement(StyledVisConfigSwitch, {
className: "vis-config-switch"
}, /*#__PURE__*/_react["default"].createElement("div", {
className: "vis-config-switch__title"
}, /*#__PURE__*/_react["default"].createElement(_styledComponents2.PanelLabelWrapper, null, label ? /*#__PURE__*/_react["default"].createElement(_styledComponents2.PanelLabel, null, label && /*#__PURE__*/_react["default"].createElement(_src3.FormattedMessage, {
id: label
}) || (0, _src4.capitalizeFirstLetter)(property)) : null)), /*#__PURE__*/_react["default"].createElement("div", {
className: "vis-config-switch__switch"
}, /*#__PURE__*/_react["default"].createElement(_switch["default"], {
checked: config.visConfig[property],
id: "".concat(id, "-").concat(property, "-switch"),
onChange: function onChange() {
return _onChange2((0, _defineProperty2["default"])({}, property, !config.visConfig[property]));
}
}))));
};
var StyledLayerConfigurator = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n margin-top: 12px;\n"])));
var DescriptionText = (0, _styledComponents["default"])(_styledComponents2.PanelLabel)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n text-transform: none;\n display: inline;\n color: ", ";\n\n a {\n text-decoration: underline;\n margin-left: 4px;\n }\n"])), function (props) {
return props.theme.subtextColor;
});
// TODO: combine these two helpers into one
function findVisConfigItemById(layer, prop) {
return layer.visConfigSettings[prop].options.find(function (op) {
return op.id === layer.config.visConfig[prop];
});
}
function findItemById(layer, options, prop) {
// For now it's possible that non-raster metadata will be passed to the raster configurator, so
// options may be null
return options === null || options === void 0 ? void 0 : options.find(function (op) {
return op.id === layer.config.visConfig[prop];
});
}
/**
* Generate drop down labels for single band selector
* @param stac - STAC item metadata object
* @returns array of {id, label} elements
*/
function getBandSelectorOptions(stac) {
var eoBands = (0, _src2.getEOBands)(stac) || [];
return eoBands.map(function (eoBand) {
return {
id: eoBand.name || eoBand.common_name,
label: eoBand.common_name ? "".concat(eoBand.name || eoBand.common_name, " (").concat(eoBand.common_name, ")") : eoBand.name
};
});
}
function getCategoricalColormapListItem(categoricalColorMap) {
var categoricalItem;
if (categoricalColorMap) {
categoricalItem = {
label: 'Categorical',
id: _src2.CATEGORICAL_COLORMAP_ID
};
}
return categoricalItem;
}
/**
* Check if data source global pixel color range is calculated correctly
* @param layer - raster layer
* @param stac - STAC metadata object
* @param preset - preset name
* @param singleBandPresetOptions - options for single band preset
* @returns boolean value
*/
function isDataSourceColorRangeAvailable(layer, stac, preset, singleBandPresetOptions) {
var minPixelValue = null;
var maxPixelValue = null;
var dataSourceParams = layer.getDataSourceParams(stac, preset, {
singleBand: singleBandPresetOptions
});
if (dataSourceParams) {
minPixelValue = dataSourceParams.minPixelValue;
maxPixelValue = dataSourceParams.maxPixelValue;
}
return minPixelValue !== null && maxPixelValue !== null;
}
/**
* Updates color parameters based on a change in visualization preset.
*
* This function adjusts the color processing parameters when the visualization
* preset changes, based on whether the preset is switching to or from a
* single-band. Determines whether to apply color
* enhancements or reset parameters based on the preset transition.
*
* @param stac A STAC (SpatioTemporal Asset Catalog) object representing the dataset.
* @param newPreset The old visualization preset being applied.
* @param newPreset The new visualization preset being applied.
* @returns The updated color parameters to apply.
*/
function updateColorParamsOnPresetChange(stac, oldPreset, newPreset) {
var colorParams = {};
var colorOverrides = _src2.DATA_SOURCE_COLOR_DEFAULTS[stac.id];
if (colorOverrides) return colorParams;
var bandOfInterest = 'singleBand';
if (oldPreset === bandOfInterest && newPreset !== bandOfInterest) {
// enchance colors for multiband combinations
colorParams = colorOverrides;
} else if (oldPreset !== bandOfInterest && newPreset === bandOfInterest) {
// reset image processng params
colorParams = _src2.RASTER_COLOR_RESET_PARAMS;
}
return colorParams;
}
RasterTileLayerConfiguratorFactory.deps = [_layerConfigGroup["default"], _visConfigSlider["default"], _infoHelper["default"], _visConfigSwitch["default"]];
function RasterTileLayerConfiguratorFactory(LayerConfigGroup, VisConfigSlider, InfoHelper, VisConfigSwitch) {
/**
* Wrapper around configurator to check for dataset.metadata being null/undefined
*/
var STACCheckConfiguratorWrapper = function STACCheckConfiguratorWrapper(_ref2) {
var layer = _ref2.layer,
visConfiguratorProps = _ref2.visConfiguratorProps,
dataset = _ref2.dataset;
var stac = dataset === null || dataset === void 0 ? void 0 : dataset.metadata;
// If no dataset is loaded into Kepler, stac can be undefined
if (!stac) {
return null;
}
return /*#__PURE__*/_react["default"].createElement(RasterTileLayerConfigurator, {
layer: layer,
visConfiguratorProps: visConfiguratorProps,
dataset: dataset
});
};
// eslint-disable-next-line complexity
var RasterTileLayerConfigurator = function RasterTileLayerConfigurator(_ref3) {
var _stac$rasterTileServe;
var layer = _ref3.layer,
visConfiguratorProps = _ref3.visConfiguratorProps,
dataset = _ref3.dataset;
var _layer$config$visConf = layer.config.visConfig,
preset = _layer$config$visConf.preset,
nonLinearRescaling = _layer$config$visConf.nonLinearRescaling,
useSTACSearching = _layer$config$visConf.useSTACSearching,
categoricalColorMap = _layer$config$visConf.colorRange.colorMap,
dynamicColor = _layer$config$visConf.dynamicColor,
singleBandName = _layer$config$visConf.singleBandName;
var stac = dataset === null || dataset === void 0 ? void 0 : dataset.metadata;
var availablePresets = (0, _react.useMemo)(function () {
return (0, _src2.filterAvailablePresets)(stac, _src2.PRESET_OPTIONS);
}, [stac]);
var presetOptions = (0, _react.useMemo)(function () {
return layer.visConfigSettings.preset.options.filter(function (_ref4) {
var id = _ref4.id;
return availablePresets === null || availablePresets === void 0 ? void 0 : availablePresets.includes(id);
});
}, [layer.visConfigSettings.preset.options, availablePresets]);
var singleBandOptions = (0, _react.useMemo)(function () {
return getBandSelectorOptions(stac);
}, [stac]);
var colormapOptions = (0, _react.useMemo)(function () {
var options = (0, _toConsumableArray2["default"])(layer.visConfigSettings.colormapId.options);
var categoricalListItem = getCategoricalColormapListItem(categoricalColorMap);
if (categoricalListItem) {
options.push(categoricalListItem);
}
return options;
}, [layer.visConfigSettings.colormapId.options, categoricalColorMap]);
var _ref5 = _src2.PRESET_OPTIONS[preset] || {},
bandCombination = _ref5.bandCombination;
var colormapAllowed = (0, _src2.isColormapAllowed)(bandCombination);
var rescalingAllowed = !categoricalColorMap && (0, _src2.isRescalingAllowed)(bandCombination);
var filterAllowed = (0, _src2.isFilterAllowed)(bandCombination);
// Here we show the UI when useSTACSearching is explicitly set to true so that the UI shows up
var stacSearchAllowed = (0, _src2.isSearchableStac)(stac) || useSTACSearching;
var selectedColormap = findVisConfigItemById(layer, 'colormapId') || getCategoricalColormapListItem(categoricalColorMap);
var selectedPreset = findVisConfigItemById(layer, 'preset');
var selectedSingleBandName = findItemById(layer, singleBandOptions, 'singleBandName');
var singleBandPresetOptions = (0, _src2.getSingleBandPresetOptions)(stac, singleBandName);
var _getRasterStatisticsM = (0, _src2.getRasterStatisticsMinMax)(stac, preset, singleBandPresetOptions),
_getRasterStatisticsM2 = (0, _slicedToArray2["default"])(_getRasterStatisticsM, 2),
minCategoricalBandValue = _getRasterStatisticsM2[0],
maxCategoricalBandValue = _getRasterStatisticsM2[1];
var ColorMapListItem = (0, _react.useMemo)(function () {
return (0, _rasterTileColormapListItem.getColorMapListItemComponent)({
colorMap: categoricalColorMap,
minValue: minCategoricalBandValue,
maxValue: maxCategoricalBandValue
});
}, [categoricalColorMap, minCategoricalBandValue, maxCategoricalBandValue]);
var isDynamicColorsOnly = !isDataSourceColorRangeAvailable(layer, stac, preset, singleBandPresetOptions);
// Default of `dynamicColor` is false. Set it true if it is not possible to get data source
// wide color range
(0, _react.useEffect)(function () {
if (isDynamicColorsOnly && !dynamicColor) {
visConfiguratorProps.onChange({
dynamicColor: true
});
}
}, [visConfiguratorProps, dynamicColor, isDynamicColorsOnly]);
var elevationUI = /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, (0, _src4.getApplicationConfig)().rasterServerSupportsElevation && ((_stac$rasterTileServe = stac.rasterTileServerUrls) === null || _stac$rasterTileServe === void 0 ? void 0 : _stac$rasterTileServe.length) && /*#__PURE__*/_react["default"].createElement(LayerConfigGroup, (0, _extends2["default"])({}, layer.visConfigSettings.enableTerrain || {
label: 'layer.color'
}, visConfiguratorProps, {
collapsible: true
}), /*#__PURE__*/_react["default"].createElement(_layerConfigGroup.ConfigGroupCollapsibleContent, null, /*#__PURE__*/_react["default"].createElement(VisConfigSwitch, (0, _extends2["default"])({}, visConfiguratorProps, layer.visConfigSettings.enableTerrainTopView)))));
// For PMTiles in raster format, only show opacity and terrain options for now
if (stac.pmtilesType === _src.PMTilesType.RASTER) {
return /*#__PURE__*/_react["default"].createElement(StyledLayerConfigurator, null, /*#__PURE__*/_react["default"].createElement(LayerConfigGroup, (0, _extends2["default"])({}, visConfiguratorProps, {
label: "Visual Settings",
collapsible: false
}), /*#__PURE__*/_react["default"].createElement(VisConfigSlider, (0, _extends2["default"])({}, layer.visConfigSettings.opacity, visConfiguratorProps))), elevationUI);
}
return /*#__PURE__*/_react["default"].createElement(StyledLayerConfigurator, null, availablePresets && /*#__PURE__*/_react["default"].createElement(LayerConfigGroup, (0, _extends2["default"])({}, visConfiguratorProps, {
label: "Image Selection",
collapsible: false
}), /*#__PURE__*/_react["default"].createElement(_styledComponents2.SidePanelSection, null, /*#__PURE__*/_react["default"].createElement(_styledComponents2.PanelLabelWrapper, null, /*#__PURE__*/_react["default"].createElement(_styledComponents2.PanelLabel, null, "Preset"), /*#__PURE__*/_react["default"].createElement(InfoHelper, {
id: "preset",
description: "Select a preset to describe how to combine spectral bands."
})), /*#__PURE__*/_react["default"].createElement(_itemSelector["default"], {
selectedItems: selectedPreset,
options: presetOptions,
multiSelect: false,
searchable: false,
displayOption: "label",
getOptionValue: "id",
onChange: function onChange(newPreset) {
var overrides = updateColorParamsOnPresetChange(stac, visConfiguratorProps.layer.config.visConfig.preset, newPreset);
visConfiguratorProps.onChange(_objectSpread(_objectSpread({}, overrides), {}, {
preset: newPreset
}));
}
}), selectedPreset !== null && selectedPreset !== void 0 && selectedPreset.description ? /*#__PURE__*/_react["default"].createElement(DescriptionText, null, selectedPreset === null || selectedPreset === void 0 ? void 0 : selectedPreset.description, selectedPreset !== null && selectedPreset !== void 0 && selectedPreset.infoUrl ? /*#__PURE__*/_react["default"].createElement("a", {
target: "_blank",
rel: "noopener noreferrer",
href: selectedPreset === null || selectedPreset === void 0 ? void 0 : selectedPreset.infoUrl
}, "More Info") : null) : null), selectedPreset.id === 'singleBand' && /*#__PURE__*/_react["default"].createElement(_styledComponents2.SidePanelSection, null, /*#__PURE__*/_react["default"].createElement(_styledComponents2.PanelLabelWrapper, null, /*#__PURE__*/_react["default"].createElement(_styledComponents2.PanelLabel, null, "Single Band Name"), /*#__PURE__*/_react["default"].createElement(InfoHelper, {
id: "".concat(layer.id, "-single-band-name"),
description: "Select a single band."
})), /*#__PURE__*/_react["default"].createElement(_itemSelector["default"], {
selectedItems: selectedSingleBandName,
options: singleBandOptions,
multiSelect: false,
searchable: false,
displayOption: "label",
getOptionValue: "id",
onChange: function onChange(val) {
visConfiguratorProps.onChange({
singleBandName: val
});
}
})), STAC_SEARCH_UI_ENABLED && stacSearchAllowed && /*#__PURE__*/_react["default"].createElement(CustomVisConfigSwitch, (0, _extends2["default"])({}, layer.visConfigSettings.useSTACSearching, visConfiguratorProps)), STAC_SEARCH_UI_ENABLED && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, stacSearchAllowed && useSTACSearching ? /*#__PURE__*/_react["default"].createElement(_styledComponents2.SidePanelSection, null, /*#__PURE__*/_react["default"].createElement(_styledComponents2.PanelLabelWrapper, null, /*#__PURE__*/_react["default"].createElement(_styledComponents2.PanelLabel, null, "STAC Search Provider")), /*#__PURE__*/_react["default"].createElement(_itemSelector["default"], (0, _extends2["default"])({}, layer.visConfigSettings.stacSearchProvider, {
selectedItems: findVisConfigItemById(layer, 'stacSearchProvider'),
placeholder: "Choose search provider",
multiSelect: false,
searchable: false,
displayOption: "label",
getOptionValue: "id",
onChange: function onChange(val) {
// TODO: check when switching layers so that you don't mismatch allowed mosaics with layers
visConfiguratorProps.onChange({
stacSearchProvider: val
});
}
})), /*#__PURE__*/_react["default"].createElement(_styledComponents2.PanelLabelWrapper, null, /*#__PURE__*/_react["default"].createElement(_styledComponents2.PanelLabel, null, "Date Range")), /*#__PURE__*/_react["default"].createElement(_styledComponents2.Input, {
type: "text",
id: "".concat(layer.id, "-startDate"),
onChange: function onChange(_ref6) {
var value = _ref6.target.value;
visConfiguratorProps.onChange({
startDate: value
});
},
value: layer.config.visConfig.startDate
}), /*#__PURE__*/_react["default"].createElement(_styledComponents2.Input, {
type: "text",
id: "".concat(layer.id, "-endDate"),
onChange: function onChange(_ref7) {
var value = _ref7.target.value;
visConfiguratorProps.onChange({
endDate: value
});
},
value: layer.config.visConfig.endDate
}), /*#__PURE__*/_react["default"].createElement(DescriptionText, null, "Date format must be \"YYYY-MM-DD\"")) : null)), /*#__PURE__*/_react["default"].createElement(LayerConfigGroup, (0, _extends2["default"])({}, visConfiguratorProps, {
label: "Visual Settings",
collapsible: false
}), /*#__PURE__*/_react["default"].createElement(VisConfigSlider, (0, _extends2["default"])({}, layer.visConfigSettings.opacity, visConfiguratorProps)), colormapAllowed && /*#__PURE__*/_react["default"].createElement(_styledComponents2.SidePanelSection, null, /*#__PURE__*/_react["default"].createElement(_styledComponents2.PanelLabel, null, "Colormap"), /*#__PURE__*/_react["default"].createElement(_itemSelector["default"], {
selectedItems: selectedColormap,
options: colormapOptions,
multiSelect: false,
displayOption: "label",
getOptionValue: "id",
onChange: function onChange(val) {
visConfiguratorProps.onChange({
colormapId: val
});
},
DropDownLineItemRenderComponent: ColorMapListItem,
filterOption: "label",
searchable: true
}))), rescalingAllowed && /*#__PURE__*/_react["default"].createElement(LayerConfigGroup, (0, _extends2["default"])({}, visConfiguratorProps, {
label: "Rescaling"
}), /*#__PURE__*/_react["default"].createElement(VisConfigSwitch, (0, _extends2["default"])({}, visConfiguratorProps, layer.visConfigSettings.dynamicColor, {
disabled: isDynamicColorsOnly
})), /*#__PURE__*/_react["default"].createElement(VisConfigSwitch, (0, _extends2["default"])({}, layer.visConfigSettings.nonLinearRescaling, visConfiguratorProps, {
label: nonLinearRescaling ? 'Non-Linear Rescaling' : 'Linear Rescaling'
})), nonLinearRescaling ? /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(VisConfigSlider, (0, _extends2["default"])({}, layer.visConfigSettings.gammaContrastFactor, visConfiguratorProps)), /*#__PURE__*/_react["default"].createElement(VisConfigSlider, (0, _extends2["default"])({}, layer.visConfigSettings.sigmoidalContrastFactor, visConfiguratorProps)), /*#__PURE__*/_react["default"].createElement(VisConfigSlider, (0, _extends2["default"])({}, layer.visConfigSettings.sigmoidalBiasFactor, visConfiguratorProps))) : /*#__PURE__*/_react["default"].createElement(VisConfigSlider, (0, _extends2["default"])({}, layer.visConfigSettings.linearRescalingFactor, visConfiguratorProps)), /*#__PURE__*/_react["default"].createElement(VisConfigSlider, (0, _extends2["default"])({}, layer.visConfigSettings.saturationValue, visConfiguratorProps))), filterAllowed && /*#__PURE__*/_react["default"].createElement(LayerConfigGroup, (0, _extends2["default"])({}, layer.visConfigSettings.filterEnabled, visConfiguratorProps, {
collapsible: true
}), /*#__PURE__*/_react["default"].createElement(VisConfigSlider, (0, _extends2["default"])({}, layer.visConfigSettings.filterRange, visConfiguratorProps))), elevationUI);
};
return STACCheckConfiguratorWrapper;
}
var _default = exports["default"] = RasterTileLayerConfiguratorFactory;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfcmVhY3QiLCJfaW50ZXJvcFJlcXVpcmVXaWxkY2FyZCIsInJlcXVpcmUiLCJfc3R5bGVkQ29tcG9uZW50cyIsIl9pbnRlcm9wUmVxdWlyZURlZmF1bHQiLCJfc3JjIiwiX3NyYzIiLCJfc3JjMyIsIl9zcmM0IiwiX3Jhc3RlclRpbGVDb2xvcm1hcExpc3RJdGVtIiwiX3N0eWxlZENvbXBvbmVudHMyIiwiX3N3aXRjaCIsIl9pbmZvSGVscGVyIiwiX2l0ZW1TZWxlY3RvciIsIl92aXNDb25maWdTbGlkZXIiLCJfbGF5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AgICAgLz5cbiAgICAgICAgICAgICAgPC9QYW5lbExhYmVsV3JhcHBlcj5cbiAgICAgICAgICAgICAgPEl0ZW1TZWxlY3RvclxuICAgICAgICAgICAgICAgIHNlbGVjdGVkSXRlbXM9e3NlbGVjdGVkUHJlc2V0fVxuICAgICAgICAgICAgICAgIG9wdGlvbnM9e3ByZXNldE9wdGlvbnN9XG4gICAgICAgICAgICAgICAgbXVsdGlTZWxlY3Q9e2ZhbHNlfVxuICAgICAgICAgICAgICAgIHNlYXJjaGFibGU9e2ZhbHNlfVxuICAgICAgICAgICAgICAgIGRpc3BsYXlPcHRpb249XCJsYWJlbFwiXG4gICAgICAgICAgICAgICAgZ2V0T3B0aW9uVmFsdWU9XCJpZFwiXG4gICAgICAgICAgICAgICAgb25DaGFuZ2U9e25ld1ByZXNldCA9PiB7XG4gICAgICAgICAgICAgICAgICBjb25zdCBvdmVycmlkZXMgPSB1cGRhdGVDb2xvclBhcmFtc09uUHJlc2V0Q2hhbmdlKFxuICAgICAgICAgICAgICAgICAgICBzdGFjLFxuICAgICAgICAgICAgICAgICAgICB2aXNDb25maWd1cmF0b3JQcm9wcy5sYXllci5jb25maWcudmlzQ29uZmlnLnByZXNldCxcbiAgICAgICAgICAgICAgICAgICAgbmV3UHJlc2V0IGFzIHN0cmluZ1xuICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICAgIHZpc0NvbmZpZ3VyYXRvclByb3BzLm9uQ2hhbmdlKHsuLi5vdmVycmlkZXMsIHByZXNldDogbmV3UHJlc2V0fSk7XG4gICAgICAgICAgICAgICAgfX1cbiAgICAgICAgICAgICAgLz5cbiAgICAgICAgICAgICAge3NlbGVjdGVkUHJlc2V0Py5kZXNjcmlwdGlvbiA/IChcbiAgICAgICAgICAgICAgICA8RGVzY3JpcHRpb25UZXh0PlxuICAgICAgICAgICAgICAgICAge3NlbGVjdGVkUHJlc2V0Py5kZXNjcmlwdGlvbn1cbiAgICAgICAgICAgICAgICAgIHtzZWxlY3RlZFByZXNldD8uaW5mb1VybCA/IChcbiAgICAgICAgICAgICAgICAgICAgPGEgdGFyZ2V0PVwiX2JsYW5rXCIgcmVsPVwibm9vcGVuZXIgbm9yZWZlcnJlclwiIGhyZWY9e3NlbGVjdGVkUHJlc2V0Py5pbmZvVXJsfT5cbiAgICAgICAgICAgICAgICAgICAgICBNb3JlIEluZm9cbiAgICAgICAgICAgICAgICAgICAgPC9hPlxuICAgICAgICAgICAgICAgICAgKSA6IG51bGx9XG4gICAgICAgICAgICAgICAgPC9EZXNjcmlwdGlvblRleHQ+XG4gICAgICAgICAgICAgICkgOiBudWxsfVxuICAgICAgICAgICAgPC9TaWRlUGFuZWxTZWN0aW9uPlxuXG4gICAgICAgICAgICB7c2VsZWN0ZWRQcmVzZXQuaWQgPT09ICdzaW5nbGVCYW5kJyAmJiAoXG4gICAgICAgICAgICAgIDxTaWRlUGFuZWxTZWN0aW9uPlxuICAgICAgICAgICAgICAgIDxQYW5lbExhYmVsV3JhcHBlcj5cbiAgICAgICAgICAgICAgICAgIDxQYW5lbExhYmVsPlNpbmdsZSBCYW5kIE5hbWU8L1BhbmVsTGFiZWw+XG4gICAgICAgICAgICAgICAgICA8SW5mb0hlbHBlclxuICAgICAgICAgICAgICAgICAgICBpZD17YCR7bGF5ZXIuaWR9LXNpbmdsZS1iYW5kLW5hbWVgfVxuICAgICAgICAgICAgICAgICAgICBkZXNjcmlwdGlvbj1cIlNlbGVjdCBhIHNpbmdsZSBiYW5kLlwiXG4gICAgICAgICAgICAgICAgICAvPlxuICAgICAgICAgICAgICAgIDwvUGFuZWxMYWJlbFdyYXBwZXI+XG4gICAgICAgICAgICAgICAgPEl0ZW1TZWxlY3RvclxuICAgICAgICAgICAgICAgICAgc2VsZWN0ZWRJdGVtcz17c2VsZWN0ZWRTaW5nbGVCYW5kTmFtZX1cbiAgICAgICAgICAgICAgICAgIG9wdGlvbnM9e3NpbmdsZUJhbmRPcHRpb25zfVxuICAgICAgICAgICAgICAgICAgbXVsdGlTZWxlY3Q9e2ZhbHNlfVxuICAgICAgICAgICAgICAgICAgc2VhcmNoYWJsZT17ZmFsc2V9XG4gICAgICAgICAgICAgICAgICBkaXNwbGF5T3B0aW9uPVwibGFiZWxcIlxuICAgICAgICAgICAgICAgICAgZ2V0T3B0aW9uVmFsdWU9XCJpZFwiXG4gICAgICAgICAgICAgICAgICBvbkNoYW5nZT17dmFsID0+IHtcbiAgICAgICAgICAgICAgICAgICAgdmlzQ29uZmlndXJhdG9yUHJvcHMub25DaGFuZ2Uoe3NpbmdsZUJhbmROYW1lOiB2YWx9KTtcbiAgICAgICAgICAgICAgICAgIH19XG4gICAgICAgICAgICAgICAgLz5cbiAgICAgICAgICAgICAgPC9TaWRlUGFuZWxTZWN0aW9uPlxuICAgICAgICAgICAgKX1cblxuICAgICAgICAgICAge1NUQUNfU0VBUkNIX1VJX0VOQUJMRUQgJiYgc3RhY1NlYXJjaEFsbG93ZWQgJiYgKFxuICAgICAgICAgICAgICA8Q3VzdG9tVmlzQ29uZmlnU3dpdGNoXG4gICAgICAgICAgICAgICAgey4uLmxheWVyLnZpc0NvbmZpZ1NldHRpbmdzLnVzZVNUQUNTZWFyY2hpbmd9XG4gICAgICAgICAgICAgICAgey4uLnZpc0NvbmZpZ3VyYXRvclByb3BzfVxuICAgICAgICAgICAgICAvPlxuICAgICAgICAgICAgKX1cblxuICAgICAgICAgICAge1NUQUNfU0VBUkNIX1VJX0VOQUJMRUQgJiYgKFxuICAgICAgICAgICAgICA8PlxuICAgICAgICAgICAgICAgIHtzdGFjU2VhcmNoQWxsb3dlZCAmJiB1c2VTVEFDU2VhcmNoaW5nID8gKFxuICAgICAgICAgICAgICAgICAgPFNpZGVQYW5lbFNlY3Rpb24+XG4gICAgICAgICAgICAgICAgICAgIDxQYW5lbExhYmVsV3JhcHBlcj5cbiAgICAgICAgICAgICAgICAgICAgICA8UGFuZWxMYWJlbD5TVEFDIFNlYXJjaCBQcm92aWRlcjwvUGFuZWxMYWJlbD5cbiAgICAgICAgICAgICAgICAgICAgPC9QYW5lbExhYmVsV3JhcHBlcj5cbiAgICAgICAgICAgICAgICAgICAgPEl0ZW1TZWxlY3RvclxuICAgICAgICAgICAgICAgICAgICAgIHsuLi5sYXllci52aXNDb25maWdTZXR0aW5ncy5zdGFjU2VhcmNoUHJvdmlkZXJ9XG4gICAgICAgICAgICAgICAgICAgICAgc2VsZWN0ZWRJdGVtcz17ZmluZFZpc0NvbmZpZ0l0ZW1CeUlkKGxheWVyLCAnc3RhY1NlYXJjaFByb3ZpZGVyJyl9XG4gICAgICAgICAgICAgICAgICAgICAgcGxhY2Vob2xkZXI9XCJDaG9vc2Ugc2VhcmNoIHByb3ZpZGVyXCJcbiAgICAgICAgICAgICAgICAgICAgICBtdWx0aVNlbGVjdD17ZmFsc2V9XG4gICAgICAgICAgICAgICAgICAgICAgc2VhcmNoYWJsZT17ZmFsc2V9XG4gICAgICAgICAgICAgICAgICAgICAgZGlzcGxheU9wdGlvbj1cImxhYmVsXCJcbiAgICAgICAgICAgICAgICAgICAgICBnZXRPcHRpb25WYWx1ZT1cImlkXCJcbiAgICAgICAgICAgICAgICAgICAgICBvbkNoYW5nZT17dmFsID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIFRPRE86IGNoZWNrIHdoZW4gc3dpdGNoaW5nIGxheWVycyBzbyB0aGF0IHlvdSBkb24ndCBtaXNtYXRjaCBhbGxvd2VkIG1vc2FpY3Mgd2l0aCBsYXllcnNcbiAgICAgICAgICAgICAgICAgICAgICAgIHZpc0NvbmZpZ3VyYXRvclByb3BzLm9uQ2hhbmdlKHtzdGFjU2VhcmNoUHJvdmlkZXI6IHZhbH0pO1xuICAgICAgICAgICAgICAgICAgICAgIH19XG4gICAgICAgICAgICAgICAgICAgIC8+XG5cbiAgICAgICAgICAgICAgICAgICAgPFBhbmVsTGFiZWxXcmFwcGVyPlxuICAgICAgICAgICAgICAgICAgICAgIDxQYW5lbExhYmVsPkRhdGUgUmFuZ2U8L1BhbmVsTGFiZWw+XG4gICAgIC