<commit_before>define([
    'agrc/modules/Formatting',

    'app/config',
    'app/mapController',

    'dijit/_TemplatedMixin',
    'dijit/_WidgetBase',

    'dojo/debounce',
    'dojo/query',
    'dojo/text!app/templates/SureSites.html',
    'dojo/text!app/templates/SureSitesPopupTemplate.html',
    'dojo/topic',
    'dojo/_base/declare',
    'dojo/_base/lang',

    'esri/InfoTemplate',
    'esri/layers/FeatureLayer',
    'esri/renderers/SimpleRenderer',
    'esri/symbols/PictureMarkerSymbol',

    'slider'
], function (
    formatting,

    config,
    mapController,

    _TemplatedMixin,
    _WidgetBase,

    debounce,
    query,
    template,
    popupTemplate,
    topic,
    declare,
    lang,

    InfoTemplate,
    FeatureLayer,
    SimpleRenderer,
    PictureMarkerSymbol
) {
    return declare([_WidgetBase, _TemplatedMixin], {
        // description:
        //      Sure sites layer and associate filters.
        templateString: template,
        baseClass: 'sure-sites',

        // Properties to be sent into constructor

        postCreate: function () {
            // summary:
            //      Overrides method of same name in dijit._Widget.
            console.log('app/SureSites:postCreate', arguments);

            var range = config.ranges.acreage;
            $(this.acreageSlider).slider({
                min: range.min,
                max: range.max,
                value: [range.min, range.max],
                step: range.step
            });
            range = config.ranges.sqft;
            $(this.sqftSlider).slider({
                min: range.min,
                max: range.max,
                value: [range.min, range.max],
                step: range.step
            });

            this.updateSliderLabels();

            this.setupConnections();

            this.inherited(arguments);
        },
        setupConnections: function () {
            // summary:
            //      wire events, and such
            console.log('app/SureSites:setupConnections', arguments);

            $(this.acreageSlider).on('slide', debounce(lang.hitch(this, this.updateDefQuery), 250));
            $(this.sqftSlider).on('slide', debounce(lang.hitch(this, this.updateDefQuery), 250));

            // needs to be shown (now show) so that the container is fully open
            // when Router:onUpdateLayer fires
            $(this.filtersContainer).on('shown.bs.collapse', lang.partial(lang.hitch(this, this.toggleLayer), true));
            $(this.filtersContainer).on('hide.bs.collapse', lang.partial(lang.hitch(this, this.toggleLayer), false));
            query('.checkbox>input', this.domNode).onchange(lang.hitch(this, this.updateDefQuery));
            topic.subscribe(config.topics.router.toggleLayers, lyrs => {
                // lyrs is an array of strings
                if (lyrs.includes(`${config.sureSitesLayerIndex}`)) {
                    $(this.filtersContainer).collapse('show');
                }
            });
        },
        updateDefQuery: function () {
            // summary:
            //      description
            console.log('app/SureSites:updateDefQuery', arguments);

            var defParts = [];

            // county
            if (this.urbanChbx.checked && !this.ruralChbx.checked) {
                defParts.push(config.fieldNames.suresites.County + ' IN (\'' + config.urbanCounties.join('\', \'') + '\')');
            } else if (this.ruralChbx.checked && !this.urbanChbx.checked) {
                defParts.push(config.fieldNames.suresites.County + ' NOT IN (\'' + config.urbanCounties.join('\', \'') + '\')');
            }

            // type
            var types = query('.property-type input:checked', this.domNode).map(function (chbx) {<commit_msg>includes -> indexOf fix for phantom<commit_after>define([
    'agrc/modules/Formatting',

    'app/config',
    'app/mapController',

    'dijit/_TemplatedMixin',
    'dijit/_WidgetBase',

    'dojo/debounce',
    'dojo/query',
    'dojo/text!app/templates/SureSites.html',
    'dojo/text!app/templates/SureSitesPopupTemplate.html',
    'dojo/topic',
    'dojo/_base/declare',
    'dojo/_base/lang',

    'esri/InfoTemplate',
    'esri/layers/FeatureLayer',
    'esri/renderers/SimpleRenderer',
    'esri/symbols/PictureMarkerSymbol',

    'slider'
], function (
    formatting,

    config,
    mapController,

    _TemplatedMixin,
    _WidgetBase,

    debounce,
    query,
    template,
    popupTemplate,
    topic,
    declare,
    lang,

    InfoTemplate,
    FeatureLayer,
    SimpleRenderer,
    PictureMarkerSymbol
) {
    return declare([_WidgetBase, _TemplatedMixin], {
        // description:
        //      Sure sites layer and associate filters.
        templateString: template,
        baseClass: 'sure-sites',

        // Properties to be sent into constructor

        postCreate: function () {
            // summary:
            //      Overrides method of same name in dijit._Widget.
            console.log('app/SureSites:postCreate', arguments);

            var range = config.ranges.acreage;
            $(this.acreageSlider).slider({
                min: range.min,
                max: range.max,
                value: [range.min, range.max],
                step: range.step
            });
            range = config.ranges.sqft;
            $(this.sqftSlider).slider({
                min: range.min,
                max: range.max,
                value: [range.min, range.max],
                step: range.step
            });

            this.updateSliderLabels();

            this.setupConnections();

            this.inherited(arguments);
        },
        setupConnections: function () {
            // summary:
            //      wire events, and such
            console.log('app/SureSites:setupConnections', arguments);

            $(this.acreageSlider).on('slide', debounce(lang.hitch(this, this.updateDefQuery), 250));
            $(this.sqftSlider).on('slide', debounce(lang.hitch(this, this.updateDefQuery), 250));

            // needs to be shown (now show) so that the container is fully open
            // when Router:onUpdateLayer fires
            $(this.filtersContainer).on('shown.bs.collapse', lang.partial(lang.hitch(this, this.toggleLayer), true));
            $(this.filtersContainer).on('hide.bs.collapse', lang.partial(lang.hitch(this, this.toggleLayer), false));
            query('.checkbox>input', this.domNode).onchange(lang.hitch(this, this.updateDefQuery));
            topic.subscribe(config.topics.router.toggleLayers, lyrs => {
                // lyrs is an array of strings
                if (lyrs.indexOf(`${config.sureSitesLayerIndex}`) >= 0) {
                    $(this.filtersContainer).collapse('show');
                }
            });
        },
        updateDefQuery: function () {
            // summary:
            //      description
            console.log('app/SureSites:updateDefQuery', arguments);

            var defParts = [];

            // county
            if (this.urbanChbx.checked && !this.ruralChbx.checked) {
                defParts.push(config.fieldNames.suresites.County + ' IN (\'' + config.urbanCounties.join('\', \'') + '\')');
            } else if (this.ruralChbx.checked && !this.urbanChbx.checked) {
                defParts.push(config.fieldNames.suresites.County + ' NOT IN (\'' + config.urbanCounties.join('\', \'') + '\')');
            }

            // type
            var types = query('.property-type input:checked', this.domNode).map(function (chbx) {
{'fraction_non_alphanumeric': 0.1351207857711707, 'fraction_numerical': 0.0017255110167241838, 'mean_word_length': 1.9216750678557581, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '5284171', 'n_tokens_mistral': 2227, 'n_tokens_neox': 2120, 'n_words': 365}