<commit_before>"use strict";

var $ = require('jquery'),
    _ = require('lodash'),
    L = require('leaflet'),
    U = require('treemap/utility'),
    addMapFeature = require('treemap/addMapFeature');

require('leafletEditablePolyline');

var activateMode = _.identity,
    deactivateMode = _.identity,
    STEP_CHOOSE_TYPE = 0,
    STEP_LOCATE = 1,
    STEP_OUTLINE_AREA = 2,
    STEP_DETAILS = 3,
    STEP_FINAL = 4;

function init(options) {
    options.onSaveBefore = onSaveBefore;
    var manager = addMapFeature.init(options),
        config = options.config,
        $sidebar = $(options.sidebar),
        $footerStepCounts = U.$find('.footer-total-steps', $sidebar),
        $resourceType = U.$find('input[name="addResourceType"]', $sidebar),
        $form = U.$find(options.formSelector, $sidebar),
        $summaryHead = U.$find('.summaryHead', $sidebar),
        $summarySubhead = U.$find('.summarySubhead', $sidebar),
        mapManager = options.mapManager,
        plotMarker = options.plotMarker,
        areaFieldIdentifier,
        areaPolygon;

    $resourceType.on('change', onResourceTypeChosen);

    manager.addFeatureStream.onValue(initSteps);
    manager.deactivateStream.onValue(initSteps);

    activateMode = function() {
        manager.activate();
        manager.stepControls.enableNext(STEP_CHOOSE_TYPE, false);
        plotMarker.useTreeIcon(false);
        areaPolygon = null;
    };

    deactivateMode = function () {
        removeAreaPolygon();
        manager.deactivate();
    }

    function onResourceTypeChosen() {
        var $option = $resourceType.filter(':checked'),
            type = $option.val(),
            typeName = $option.next().text().trim(),
            areaFieldName = $option.data('area-field-name'),
            addFeatureUrl = config.instance.url + 'features/' + type + '/';
        if (type) {
            manager.setAddFeatureUrl(addFeatureUrl);
            manager.stepControls.enableNext(STEP_CHOOSE_TYPE, true);
            manager.stepControls.enableNext(STEP_OUTLINE_AREA, true);
            manager.stepControls.enableNext(STEP_DETAILS, false);
            $summaryHead.text(typeName);
            $summarySubhead.text("Resource");

            var hasAreaStep = !!areaFieldName;
            activateAreaStep(hasAreaStep);
            if (hasAreaStep) {<commit_msg>Resource -> Watershed Solution<commit_after>"use strict";

var $ = require('jquery'),
    _ = require('lodash'),
    L = require('leaflet'),
    U = require('treemap/utility'),
    addMapFeature = require('treemap/addMapFeature');

require('leafletEditablePolyline');

var activateMode = _.identity,
    deactivateMode = _.identity,
    STEP_CHOOSE_TYPE = 0,
    STEP_LOCATE = 1,
    STEP_OUTLINE_AREA = 2,
    STEP_DETAILS = 3,
    STEP_FINAL = 4;

function init(options) {
    options.onSaveBefore = onSaveBefore;
    var manager = addMapFeature.init(options),
        config = options.config,
        $sidebar = $(options.sidebar),
        $footerStepCounts = U.$find('.footer-total-steps', $sidebar),
        $resourceType = U.$find('input[name="addResourceType"]', $sidebar),
        $form = U.$find(options.formSelector, $sidebar),
        $summaryHead = U.$find('.summaryHead', $sidebar),
        $summarySubhead = U.$find('.summarySubhead', $sidebar),
        mapManager = options.mapManager,
        plotMarker = options.plotMarker,
        areaFieldIdentifier,
        areaPolygon;

    $resourceType.on('change', onResourceTypeChosen);

    manager.addFeatureStream.onValue(initSteps);
    manager.deactivateStream.onValue(initSteps);

    activateMode = function() {
        manager.activate();
        manager.stepControls.enableNext(STEP_CHOOSE_TYPE, false);
        plotMarker.useTreeIcon(false);
        areaPolygon = null;
    };

    deactivateMode = function () {
        removeAreaPolygon();
        manager.deactivate();
    }

    function onResourceTypeChosen() {
        var $option = $resourceType.filter(':checked'),
            type = $option.val(),
            typeName = $option.next().text().trim(),
            areaFieldName = $option.data('area-field-name'),
            addFeatureUrl = config.instance.url + 'features/' + type + '/';
        if (type) {
            manager.setAddFeatureUrl(addFeatureUrl);
            manager.stepControls.enableNext(STEP_CHOOSE_TYPE, true);
            manager.stepControls.enableNext(STEP_OUTLINE_AREA, true);
            manager.stepControls.enableNext(STEP_DETAILS, false);
            $summaryHead.text(typeName);
            $summarySubhead.text("Watershed Solution");

            var hasAreaStep = !!areaFieldName;
            activateAreaStep(hasAreaStep);
            if (hasAreaStep) {
{'fraction_non_alphanumeric': 0.1306660991700362, 'fraction_numerical': 0.0021281123643328366, 'mean_word_length': 2.877887788778878, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5386610', 'n_tokens_mistral': 1393, 'n_tokens_neox': 1363, 'n_words': 217}