<commit_before>// Openlayers preview module

if (typeof proj4 != "undefined" && proj4) {
    window.Proj4js = {
        Proj: function (code) {

            if (Proj4js.defs[code])
                return proj4(Proj4js.defs[code]);

            var shortCode = code.replace(
                /urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, "$1:$3"
            )
            // side-effect : add long-form code as alias
            if (code != shortCode)
                Proj4js.defs(code, Proj4js.defs[shortCode]);
            return Proj4js.defs[shortCode] && proj4(Proj4js.defs[shortCode]);
        },
        defs: proj4.defs,
        transform: proj4
    };
}

if (!ol.source.State) {
    ol.source.State = {
        UNDEFINED: 'undefined',
        LOADING: 'loading',
        READY: 'ready',
        ERROR: 'error'
    };
}

var OLgetState = ol.source.Source.prototype.getState
ol.source.Source.prototype.getState = function() {
    return this.HL_state || OLgetState();
};
ol.source.Source.prototype.setState = function(state) {
    this.HL_state = state;
    this.changed();
};

String.prototype.hashCode = function() {
    var hash = 0, i, chr;
    if (this.length === 0) return hash;
    for (i = 0; i < this.length; i++) {
        chr   = this.charCodeAt(i);
        hash  = ((hash << 5) - hash) + chr;
        hash |= 0; // Convert to 32bit integer
    }
    return hash;
};

if (window.Proj4js) {
    // add your projection definitions here
    // definitions can be found at http://spatialreference.org/ref/epsg/{xxxx}/proj4js/

    proj4.defs['OGC:CRS84'] = proj4.defs['EPSG:4326']

    // add EPSG:4326 as coming from GML, to allow for geometry transforms performed by format.GML
    proj4.defs['http://www.opengis.net/gml/srs/epsg.xml#4326'] = proj4.defs['EPSG:4326']

    // warn : 31370 definition from spatialreference.org is wrong
    proj4.defs("EPSG:31370", "+proj=lcc +lat_1=51.16666723333333 +lat_2=49.8333339 +lat_0=90 +lon_0=4.367486666666666 +x_0=150000.013 +y_0=5400088.438 +ellps=intl +towgs84=-106.868628,52.297783,-103.723893,0.336570,-0.456955,1.842183,-1.2747 +units=m +no_defs");
    //window.Proj4js.defs["EPSG:31370"] = "+proj=lcc +lat_1=51.16666723333333 +lat_2=49.8333339 +lat_0=90 +lon_0=4.367486666666666 +x_0=150000.013 +y_0=5400088.438 +ellps=intl +towgs84=-106.868628,52.297783,-103.723893,0.336570,-0.456955,1.842183,-1.2747 +units=m +no_defs";

    window.Proj4js.defs["EPSG:28992"] = "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.999908 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +towgs84=565.2369,50.0087,465.658,-0.406857330322398,0.350732676542563,-1.8703473836068,4.0812 +no_defs <>";
    window.Proj4js.defs["EPSG:3812"] = "+proj=lcc +lat_1=49.83333333333334 +lat_2=51.16666666666666 +lat_0=50.797815 +lon_0=4.359215833333333 +x_0=649328 +y_0=665262 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs";

}

// duplicate this code to avoid a dependency on internal class ol.<...>.Projection_
var createEPSG4326Proj = function(code, opt_axisOrientation) {
    return new ol.proj.Projection({
        code: code,
        units: ol.proj.get('EPSG:4326').getUnits(),
        extent: ol.proj.get('EPSG:4326').getExtent(),
        axisOrientation: opt_axisOrientation,
        global: true,
        metersPerUnit: ol.proj.get('EPSG:4326').getMetersPerUnit(),
        worldExtent: ol.proj.get('EPSG:4326').getWorldExtent()
    })
}

// redefine GML EPSG:4326 with lon/lat axis order;
// Don't do that. Force usage of EPSG4326_LONLAT in format.GML instead
//ol.proj.addProjection(createEPSG4326Proj('http://www.opengis.net/gml/srs/epsg.xml#4326', 'enu'));

// Define a special projection with lon/lat axis order to be used in format.GML hack
ol.proj.addProjection(createEPSG4326Proj('EPSG:4326:LONLAT', 'enu'));

(function() {

    // Establish the root object, `window` in the browser, or `global` on the server.
    var root = this;
    var OL_HELPERS = root.OL_HELPERS = {}

    var $_ = _ // keep pointer to underscore, as '_' will may be overridden by a closure variable when down the stack

    var EPSG4326 = OL_HELPERS.EPSG4326 = ol.proj.get("EPSG:4326")
    var EPSG4326_LONG = OL_HELPERS.EPSG4326_LONG = ol.proj.get('urn:ogc:def:crs:EPSG:6.6:4326')
    var EPSG4326_LONLAT = OL_HELPERS.EPSG4326_LONLAT = createEPSG4326Proj('EPSG:4326', 'enu')
    var Mercator = OL_HELPERS.Mercator = ol.proj.get("EPSG:3857")
    var WORLD_BBOX = OL_HELPERS.WORLD_BBOX = [-180, -90, 180, 90]
    var MAX_FEATURES = 300

    var isNumeric = function(n) {
        return !isNaN(parseFloat(n)) && isFinite(n);
    }

    // When possible, override decimal parsers, as some capabilities use commas as decimal separator
    // (e.g. http://geoservices.wallonie.be/arcgis/services/EAU/ALEA_2016/MapServer/WMSServer)
    var originalReadDecimal = ol.format.XSD.readDecimalString;
    if (originalReadDecimal) {
        ol.format.XSD.readDecimalString = function (string) {
            if (string) {
                string = string.replace(',', '.');
            }
            return originalReadDecimal(string);
        };
    }


    ol.Map.prototype.addLayerWithExtent = function (layer) {<commit_msg>fix dependency on debug version of OL<commit_after>// Openlayers preview module

if (typeof proj4 != "undefined" && proj4) {
    window.Proj4js = {
        Proj: function (code) {

            if (Proj4js.defs[code])
                return proj4(Proj4js.defs[code]);

            var shortCode = code.replace(
                /urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, "$1:$3"
            )
            // side-effect : add long-form code as alias
            if (code != shortCode)
                Proj4js.defs(code, Proj4js.defs[shortCode]);
            return Proj4js.defs[shortCode] && proj4(Proj4js.defs[shortCode]);
        },
        defs: proj4.defs,
        transform: proj4
    };
}

if (!ol.source.State) {
    ol.source.State = {
        UNDEFINED: 'undefined',
        LOADING: 'loading',
        READY: 'ready',
        ERROR: 'error'
    };
}

var OLgetState = ol.source.Source.prototype.getState
ol.source.Source.prototype.getState = function() {
    return this.HL_state || OLgetState();
};
ol.source.Source.prototype.setState = function(state) {
    this.HL_state = state;
    this.changed();
};

String.prototype.hashCode = function() {
    var hash = 0, i, chr;
    if (this.length === 0) return hash;
    for (i = 0; i < this.length; i++) {
        chr   = this.charCodeAt(i);
        hash  = ((hash << 5) - hash) + chr;
        hash |= 0; // Convert to 32bit integer
    }
    return hash;
};

if (window.Proj4js) {
    // add your projection definitions here
    // definitions can be found at http://spatialreference.org/ref/epsg/{xxxx}/proj4js/

    proj4.defs['OGC:CRS84'] = proj4.defs['EPSG:4326']

    // add EPSG:4326 as coming from GML, to allow for geometry transforms performed by format.GML
    proj4.defs['http://www.opengis.net/gml/srs/epsg.xml#4326'] = proj4.defs['EPSG:4326']

    // warn : 31370 definition from spatialreference.org is wrong
    proj4.defs("EPSG:31370", "+proj=lcc +lat_1=51.16666723333333 +lat_2=49.8333339 +lat_0=90 +lon_0=4.367486666666666 +x_0=150000.013 +y_0=5400088.438 +ellps=intl +towgs84=-106.868628,52.297783,-103.723893,0.336570,-0.456955,1.842183,-1.2747 +units=m +no_defs");
    //window.Proj4js.defs["EPSG:31370"] = "+proj=lcc +lat_1=51.16666723333333 +lat_2=49.8333339 +lat_0=90 +lon_0=4.367486666666666 +x_0=150000.013 +y_0=5400088.438 +ellps=intl +towgs84=-106.868628,52.297783,-103.723893,0.336570,-0.456955,1.842183,-1.2747 +units=m +no_defs";

    window.Proj4js.defs["EPSG:28992"] = "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.999908 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +towgs84=565.2369,50.0087,465.658,-0.406857330322398,0.350732676542563,-1.8703473836068,4.0812 +no_defs <>";
    window.Proj4js.defs["EPSG:3812"] = "+proj=lcc +lat_1=49.83333333333334 +lat_2=51.16666666666666 +lat_0=50.797815 +lon_0=4.359215833333333 +x_0=649328 +y_0=665262 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs";

}

// duplicate this code to avoid a dependency on internal class ol.<...>.Projection_
var createEPSG4326Proj = function(code, opt_axisOrientation) {
    return new ol.proj.Projection({
        code: code,
        units: ol.proj.get('EPSG:4326').getUnits(),
        extent: ol.proj.get('EPSG:4326').getExtent(),
        axisOrientation: opt_axisOrientation,
        global: true,
        metersPerUnit: ol.proj.get('EPSG:4326').getMetersPerUnit(),
        worldExtent: ol.proj.get('EPSG:4326').getWorldExtent()
    })
}

// redefine GML EPSG:4326 with lon/lat axis order;
// Don't do that. Force usage of EPSG4326_LONLAT in format.GML instead
//ol.proj.addProjection(createEPSG4326Proj('http://www.opengis.net/gml/srs/epsg.xml#4326', 'enu'));

// Define a special projection with lon/lat axis order to be used in format.GML hack
ol.proj.addProjection(createEPSG4326Proj('EPSG:4326:LONLAT', 'enu'));

(function() {

    // Establish the root object, `window` in the browser, or `global` on the server.
    var root = this;
    var OL_HELPERS = root.OL_HELPERS = {}

    var $_ = _ // keep pointer to underscore, as '_' will may be overridden by a closure variable when down the stack

    var EPSG4326 = OL_HELPERS.EPSG4326 = ol.proj.get("EPSG:4326")
    var EPSG4326_LONG = OL_HELPERS.EPSG4326_LONG = ol.proj.get('urn:ogc:def:crs:EPSG:6.6:4326')
    var EPSG4326_LONLAT = OL_HELPERS.EPSG4326_LONLAT = createEPSG4326Proj('EPSG:4326', 'enu')
    var Mercator = OL_HELPERS.Mercator = ol.proj.get("EPSG:3857")
    var WORLD_BBOX = OL_HELPERS.WORLD_BBOX = [-180, -90, 180, 90]
    var MAX_FEATURES = 300

    var isNumeric = function(n) {
        return !isNaN(parseFloat(n)) && isFinite(n);
    }

    // When possible, override decimal parsers, as some capabilities use commas as decimal separator
    // (e.g. http://geoservices.wallonie.be/arcgis/services/EAU/ALEA_2016/MapServer/WMSServer)
    var originalReadDecimal = ol.format && ol.format.XSD && ol.format.XSD.readDecimalString;
    if (originalReadDecimal) {
        ol.format.XSD.readDecimalString = function (string) {
            if (string) {
                string = string.replace(',', '.');
            }
            return originalReadDecimal(string);
        };
    }


    ol.Map.prototype.addLayerWithExtent = function (layer) {
{'fraction_non_alphanumeric': 0.1502415458937198, 'fraction_numerical': 0.12289855072463768, 'mean_word_length': 3.221451876019576, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 18, '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': '1012334', 'n_tokens_mistral': 4791, 'n_tokens_neox': 3989, 'n_words': 712}