<commit_before>/* 
 * Copyright (C) 2012-2013 B3Partners B.V.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
/**
 * Edit component
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 */
Ext.define ("viewer.components.Edit",{
    extend: "viewer.components.Component",
    vectorLayer:null,
    inputContainer:null,
    showGeomType:null,
    newGeomType:null,
    mode:null,
    layerSelector:null,
    toolMapClick:null,
    editingLayer: null,
    currentFID:null,
    geometryEditable:null,
    deActivatedTools: [],
    
    config:{
        title: "",
        iconUrl: "",
        tooltip: "",
        layers:null,
        label: ""
    },
    constructor: function (conf){        
        viewer.components.Edit.superclass.constructor.call(this, conf);
        this.initConfig(conf);     
        var me = this;
        
        Ext.util.Observable.capture(this.viewerController.mapComponent.getMap(), function(event) {
            if(event == viewer.viewercontroller.controller.Event.ON_GET_FEATURE_INFO
            || event == viewer.viewercontroller.controller.Event.ON_MAPTIP) {
                if(me.mode == "new" || me.mode == "edit") {
                    return false;
                }
            }
            return true;
        });
        
        if (this.layers!=null){
            this.layers = Ext.Array.filter(this.layers, function(layerId) {
                // XXX must check editAuthorized in appLayer
                // cannot get that from this layerId
                return true;            
            });
        }
        this.renderButton({
            handler: function(){
                me.showWindow();
            },
            text: me.title,
            icon: me.iconUrl,
            tooltip: me.tooltip,
            label: me.label
        });
        
        this.toolMapClick =  this.viewerController.mapComponent.createTool({
            type: viewer.viewercontroller.controller.Tool.MAP_CLICK,
            id: this.name + "toolMapClick",
            handler:{
                fn: this.mapClicked,
                scope:this
            },
            viewerController: this.viewerController
        });
        
        this.loadWindow(); 
        this.viewerController.addListener(viewer.viewercontroller.controller.Event.ON_SELECTEDCONTENT_CHANGE,this.selectedContentChanged,this );
        return this;
    },
    selectedContentChanged : function (){
        if(this.vectorLayer == null){
            this.createVectorLayer();
        }else{
            this.viewerController.mapComponent.getMap().addLayer(this.vectorLayer);
        }
    },
    createVectorLayer : function (){
         this.vectorLayer=this.viewerController.mapComponent.createVectorLayer({
            name: this.name + 'VectorLayer',
            geometrytypes:["Circle","Polygon","MultiPolygon","Point", "LineString"],
            showmeasures:false,
            viewerController : this.viewerController,
            style: {
                fillcolor: "FF0000",
                fillopacity: 50,
                strokecolor: "FF0000",
                strokeopacity: 50
            }
        });
        this.viewerController.mapComponent.getMap().addLayer(this.vectorLayer);
    },
    showWindow : function(){
        if(this.vectorLayer == null){
            this.createVectorLayer();
        }
        this.layerSelector.initLayers();
        this.popup.popupWin.setTitle(this.title);
        this.popup.show();
    },
    loadWindow : function (){
        var me =this;
        this.maincontainer = Ext.create('Ext.container.Container', {
            id: this.name + 'Container',
            width: '100%',
            height: '100%',
            autoScroll: true,
            layout: {
                type: 'vbox'
            },
            style: {
                backgroundColor: 'White'
            },
            renderTo: this.getContentDiv(),
            items: [{
                id: this.name + 'LayerSelectorPanel',
                xtype: "container",
                padding: "4px",
                width: '100%',
                height: 36
            },
            {
                id: this.name + 'ButtonPanel',
                xtype: "container",
                padding: "4px",
                width: '280px',
                height: MobileManager.isMobile() ? 60 : 36,
                items:[
                {
                    xtype: 'button',
                    id: this.name +"newButton",
                    disabled: true,
                    tooltip: "Nieuw",
                    text: "Nieuw",
                    componentCls: 'mobileLarge',
                    listeners: {
                        click:{
                            scope: me,
                            fn: me.createNew
                        }
                    }
                },
                {
                    xtype: 'button',
                    id : this.name + "editButton",
                    tooltip: "Bewerk",
                    componentCls: 'mobileLarge',
                    disabled: true,
                    text: "Bewerk",
                    listeners: {
                        click:{
                            scope: me,
                            fn: me.edit
                        }
                    }
                },
                {
                    id : this.name + "geomLabel",
                    margin: 5,
                    text: '',
                    xtype: "label"
                }
                ]
            },
            {
                id: this.name + 'InputPanel',
                border: 0,
                xtype: "form",
                autoScroll: true,
                width: '100%',
                flex: 1
            },{
                id: this.name + 'savePanel',
                xtype: "container",
                width: '100%',
                height: MobileManager.isMobile() ? 45 : 30,
                layout: {
                    type: 'hbox',
                    pack: 'end'
                },
                defaults: {
                    xtype: 'button',
                    componentCls: 'mobileLarge'
                },
                items:[
                {
                    id : this.name + "cancelButton",
                    tooltip: "Annuleren",
                    text: "Annuleren",
                    listeners: {
                        click:{
                            scope: me,
                            fn: me.cancel
                        }
                    }
                },
                {
                    id : this.name + "saveButton",
                    tooltip: "Opslaan",
                    text: "Opslaan",
                    listeners: {
                        click:{
                            scope: me,
                            fn: me.save
                        }
                    }
                }
                ]
            }
            ]
        });
        this.inputContainer =  Ext.getCmp(this.name + 'InputPanel');
        
        this.createLayerSelector();
    },
    createLayerSelector: function(){
        var config = {
            viewerController : this.viewerController,
            restriction : "editable",
            id : this.name + "layerSelector",
            layers: this.layers,
            div: this.name + 'LayerSelectorPanel'
        };
        this.layerSelector = Ext.create("viewer.components.LayerSelector",config);
        this.layerSelector.addListener(viewer.viewercontroller.controller.Event.ON_LAYERSELECTOR_CHANGE,this.layerChanged,this);  
    },
            
    layerChanged : function (appLayer,afterLoadAttributes,scope){
        if(appLayer != null){
            this.vectorLayer.removeAllFeatures();
            this.mode=null;
            this.viewerController.mapComponent.getMap().removeMarker("edit");
            if(appLayer.details && appLayer.details["editfunction.title"]){
                this.popup.popupWin.setTitle(appLayer.details["editfunction.title"]);
            }
            this.inputContainer.setLoading("Laad attributen...");
            this.inputContainer.removeAll();
            this.loadAttributes(appLayer,afterLoadAttributes,scope);
            this.inputContainer.setLoading(false);
        }else{
            this.cancel();
        }
    },
    loadAttributes: function(appLayer,afterLoadAttributes,scope) {
        this.appLayer = appLayer;
        
        var me = this;
        if (scope==undefined){
            scope=me;
        }
        if(this.appLayer != null) {
            
            this.featureService = this.viewerController.getAppLayerFeatureService(this.appLayer);
            
            // check if featuretype was loaded
            if(this.appLayer.attributes == undefined) {
                this.featureService.loadAttributes(me.appLayer, function(attributes) {
                    me.initAttributeInputs(me.appLayer);
                    if (afterLoadAttributes){
                        afterLoadAttributes.call(scope);
                    }
                });
            } else {
                this.initAttributeInputs(me.appLayer);
                if (afterLoadAttributes){
                    afterLoadAttributes.call(scope);
                }
            }    
        }
    },
    initAttributeInputs : function (appLayer){
        var attributes = appLayer.attributes;
        var type = "geometry";
        if(appLayer.geometryAttributeIndex != undefined || appLayer.geometryAttributeIndex != null ){
            var geomAttribute = appLayer.attributes[appLayer.geometryAttributeIndex];
            if(geomAttribute.editValues != undefined && geomAttribute.editValues !=null && geomAttribute.editValues.length >= 1){
                type = geomAttribute.editValues[0]
            }else{
                type = geomAttribute.type;
            }
            this.geometryEditable = appLayer.attributes[appLayer.geometryAttributeIndex].editable;
        }else{
            this.geometryEditable = false;
        }
        this.showGeomType = type;
        var possible = true;
        var tekst = "";
        switch(type){
            case "multipolygon":
                this.showGeomType = "MultiPolygon";
                this.newGeomType = "Polygon";
                tekst = "vlak";
                break;
            case "polygon":
                this.showGeomType = "Polygon";
                this.newGeomType = "Polygon";
                tekst = "vlak";
                break;
            case "multipoint":
            case "point":
                this.showGeomType = "Point";
                this.newGeomType = "Point";
                tekst = "punt";
                break;
            case "multilinestring":
            case "linestring":
                this.showGeomType = "LineString";
                this.newGeomType = "LineString";
                tekst = "lijn";
                break;
            case "geometry":
                possible = true;
                this.newGeomType = null;
                break;
            default:
                this.newGeomType = null;
                possible = false;
                break;
        }
        
        var gl = Ext.getCmp( this.name +"geomLabel");
        if(possible){
            if(this.geometryEditable){
                Ext.getCmp(this.name +"editButton").setDisabled(false);
                if(this.newGeomType == null){
                    tekst = "Geometrie mag alleen bewerkt worden";
                }else{ 
                    Ext.getCmp(this.name +"newButton").setDisabled(false);
                    tekst = 'Bewerk een ' + tekst+ " op de kaart";
                }
            }else{
                tekst = 'Geometrie mag niet bewerkt worden.';
            }
            gl.setText(tekst);

            for(var i= 0 ; i < attributes.length ;i++){
                var attribute = attributes[i];
                if(attribute.editable){
                    var allowedEditable = this.allowedEditable(attribute);
                    var values = Ext.clone(attribute.editValues);
                    var input = null;
                    if(i == appLayer.geometryAttributeIndex){
                        continue;
                    }
                    if(values == undefined || values.length == 1){
                        var fieldText = "";
                        if(values!= undefined){
                            fieldText = values[0];
                        }
                        var options={
                            name: attribute.name,
                            fieldLabel: attribute.editAlias || attribute.name,
                            renderTo: this.name + 'InputPanel',
                            value:  fieldText,
                            disabled: !allowedEditable
                        };
                        if (attribute.editHeight){
                            options.rows = attribute.editHeight;                           
                            input = Ext.create("Ext.form.field.TextArea",options)
                        }else{
                            input = Ext.create("Ext.form.field.Text",options);
                        }
                    }else if (values.length > 1){
                        var allBoolean=true;
                        for (var v=0; v < values.length; v++){
                            if (values[v].toLowerCase()!=="true" && values[v].toLowerCase()!=="false"){
                                allBoolean =false;
                                break;
                            }
                        }
                        
                        Ext.each(values,function(value,index,original){
                            if (allBoolean){
                                value= value.toLowerCase() ==="true";
                            }
                            original[index] = {
                                id: value
                            };
                        });
                        var valueStore = Ext.create('Ext.data.Store', {
                            fields: ['id'],
                            data : values
                        });

                        input = Ext.create('viewer.components.FlamingoCombobox', {
                            fieldLabel: attribute.editAlias || attribute.name,
                            store: valueStore,
                            queryMode: 'local',
                            displayField: 'id',
                            name:attribute.name,
                            renderTo: this.name + 'InputPanel',
                            valueField: 'id',
                            disabled: !allowedEditable
                        });
                    }
                    this.inputContainer.add(input);
                }
            }<commit_msg>Enable the edit component to have labels for predefined edit values, instead of the value itself as a label<commit_after>/* 
 * Copyright (C) 2012-2013 B3Partners B.V.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
/**
 * Edit component
 * @author <a href="mailto:<EMAIL>"><NAME></a>
 */
Ext.define ("viewer.components.Edit",{
    extend: "viewer.components.Component",
    vectorLayer:null,
    inputContainer:null,
    showGeomType:null,
    newGeomType:null,
    mode:null,
    layerSelector:null,
    toolMapClick:null,
    editingLayer: null,
    currentFID:null,
    geometryEditable:null,
    deActivatedTools: [],
    
    config:{
        title: "",
        iconUrl: "",
        tooltip: "",
        layers:null,
        label: ""
    },
    constructor: function (conf){        
        viewer.components.Edit.superclass.constructor.call(this, conf);
        this.initConfig(conf);     
        var me = this;
        
        Ext.util.Observable.capture(this.viewerController.mapComponent.getMap(), function(event) {
            if(event == viewer.viewercontroller.controller.Event.ON_GET_FEATURE_INFO
            || event == viewer.viewercontroller.controller.Event.ON_MAPTIP) {
                if(me.mode == "new" || me.mode == "edit") {
                    return false;
                }
            }
            return true;
        });
        
        if (this.layers!=null){
            this.layers = Ext.Array.filter(this.layers, function(layerId) {
                // XXX must check editAuthorized in appLayer
                // cannot get that from this layerId
                return true;            
            });
        }
        this.renderButton({
            handler: function(){
                me.showWindow();
            },
            text: me.title,
            icon: me.iconUrl,
            tooltip: me.tooltip,
            label: me.label
        });
        
        this.toolMapClick =  this.viewerController.mapComponent.createTool({
            type: viewer.viewercontroller.controller.Tool.MAP_CLICK,
            id: this.name + "toolMapClick",
            handler:{
                fn: this.mapClicked,
                scope:this
            },
            viewerController: this.viewerController
        });
        
        this.loadWindow(); 
        this.viewerController.addListener(viewer.viewercontroller.controller.Event.ON_SELECTEDCONTENT_CHANGE,this.selectedContentChanged,this );
        return this;
    },
    selectedContentChanged : function (){
        if(this.vectorLayer == null){
            this.createVectorLayer();
        }else{
            this.viewerController.mapComponent.getMap().addLayer(this.vectorLayer);
        }
    },
    createVectorLayer : function (){
         this.vectorLayer=this.viewerController.mapComponent.createVectorLayer({
            name: this.name + 'VectorLayer',
            geometrytypes:["Circle","Polygon","MultiPolygon","Point", "LineString"],
            showmeasures:false,
            viewerController : this.viewerController,
            style: {
                fillcolor: "FF0000",
                fillopacity: 50,
                strokecolor: "FF0000",
                strokeopacity: 50
            }
        });
        this.viewerController.mapComponent.getMap().addLayer(this.vectorLayer);
    },
    showWindow : function(){
        if(this.vectorLayer == null){
            this.createVectorLayer();
        }
        this.layerSelector.initLayers();
        this.popup.popupWin.setTitle(this.title);
        this.popup.show();
    },
    loadWindow : function (){
        var me =this;
        this.maincontainer = Ext.create('Ext.container.Container', {
            id: this.name + 'Container',
            width: '100%',
            height: '100%',
            autoScroll: true,
            layout: {
                type: 'vbox'
            },
            style: {
                backgroundColor: 'White'
            },
            renderTo: this.getContentDiv(),
            items: [{
                id: this.name + 'LayerSelectorPanel',
                xtype: "container",
                padding: "4px",
                width: '100%',
                height: 36
            },
            {
                id: this.name + 'ButtonPanel',
                xtype: "container",
                padding: "4px",
                width: '280px',
                height: MobileManager.isMobile() ? 60 : 36,
                items:[
                {
                    xtype: 'button',
                    id: this.name +"newButton",
                    disabled: true,
                    tooltip: "Nieuw",
                    text: "Nieuw",
                    componentCls: 'mobileLarge',
                    listeners: {
                        click:{
                            scope: me,
                            fn: me.createNew
                        }
                    }
                },
                {
                    xtype: 'button',
                    id : this.name + "editButton",
                    tooltip: "Bewerk",
                    componentCls: 'mobileLarge',
                    disabled: true,
                    text: "Bewerk",
                    listeners: {
                        click:{
                            scope: me,
                            fn: me.edit
                        }
                    }
                },
                {
                    id : this.name + "geomLabel",
                    margin: 5,
                    text: '',
                    xtype: "label"
                }
                ]
            },
            {
                id: this.name + 'InputPanel',
                border: 0,
                xtype: "form",
                autoScroll: true,
                width: '100%',
                flex: 1
            },{
                id: this.name + 'savePanel',
                xtype: "container",
                width: '100%',
                height: MobileManager.isMobile() ? 45 : 30,
                layout: {
                    type: 'hbox',
                    pack: 'end'
                },
                defaults: {
                    xtype: 'button',
                    componentCls: 'mobileLarge'
                },
                items:[
                {
                    id : this.name + "cancelButton",
                    tooltip: "Annuleren",
                    text: "Annuleren",
                    listeners: {
                        click:{
                            scope: me,
                            fn: me.cancel
                        }
                    }
                },
                {
                    id : this.name + "saveButton",
                    tooltip: "Opslaan",
                    text: "Opslaan",
                    listeners: {
                        click:{
                            scope: me,
                            fn: me.save
                        }
                    }
                }
                ]
            }
            ]
        });
        this.inputContainer =  Ext.getCmp(this.name + 'InputPanel');
        
        this.createLayerSelector();
    },
    createLayerSelector: function(){
        var config = {
            viewerController : this.viewerController,
            restriction : "editable",
            id : this.name + "layerSelector",
            layers: this.layers,
            div: this.name + 'LayerSelectorPanel'
        };
        this.layerSelector = Ext.create("viewer.components.LayerSelector",config);
        this.layerSelector.addListener(viewer.viewercontroller.controller.Event.ON_LAYERSELECTOR_CHANGE,this.layerChanged,this);  
    },
            
    layerChanged : function (appLayer,afterLoadAttributes,scope){
        if(appLayer != null){
            this.vectorLayer.removeAllFeatures();
            this.mode=null;
            this.viewerController.mapComponent.getMap().removeMarker("edit");
            if(appLayer.details && appLayer.details["editfunction.title"]){
                this.popup.popupWin.setTitle(appLayer.details["editfunction.title"]);
            }
            this.inputContainer.setLoading("Laad attributen...");
            this.inputContainer.removeAll();
            this.loadAttributes(appLayer,afterLoadAttributes,scope);
            this.inputContainer.setLoading(false);
        }else{
            this.cancel();
        }
    },
    loadAttributes: function(appLayer,afterLoadAttributes,scope) {
        this.appLayer = appLayer;
        
        var me = this;
        if (scope==undefined){
            scope=me;
        }
        if(this.appLayer != null) {
            
            this.featureService = this.viewerController.getAppLayerFeatureService(this.appLayer);
            
            // check if featuretype was loaded
            if(this.appLayer.attributes == undefined) {
                this.featureService.loadAttributes(me.appLayer, function(attributes) {
                    me.initAttributeInputs(me.appLayer);
                    if (afterLoadAttributes){
                        afterLoadAttributes.call(scope);
                    }
                });
            } else {
                this.initAttributeInputs(me.appLayer);
                if (afterLoadAttributes){
                    afterLoadAttributes.call(scope);
                }
            }    
        }
    },
    initAttributeInputs : function (appLayer){
        var attributes = appLayer.attributes;
        var type = "geometry";
        if(appLayer.geometryAttributeIndex != undefined || appLayer.geometryAttributeIndex != null ){
            var geomAttribute = appLayer.attributes[appLayer.geometryAttributeIndex];
            if(geomAttribute.editValues != undefined && geomAttribute.editValues !=null && geomAttribute.editValues.length >= 1){
                type = geomAttribute.editValues[0]
            }else{
                type = geomAttribute.type;
            }
            this.geometryEditable = appLayer.attributes[appLayer.geometryAttributeIndex].editable;
        }else{
            this.geometryEditable = false;
        }
        this.showGeomType = type;
        var possible = true;
        var tekst = "";
        switch(type){
            case "multipolygon":
                this.showGeomType = "MultiPolygon";
                this.newGeomType = "Polygon";
                tekst = "vlak";
                break;
            case "polygon":
                this.showGeomType = "Polygon";
                this.newGeomType = "Polygon";
                tekst = "vlak";
                break;
            case "multipoint":
            case "point":
                this.showGeomType = "Point";
                this.newGeomType = "Point";
                tekst = "punt";
                break;
            case "multilinestring":
            case "linestring":
                this.showGeomType = "LineString";
                this.newGeomType = "LineString";
                tekst = "lijn";
                break;
            case "geometry":
                possible = true;
                this.newGeomType = null;
                break;
            default:
                this.newGeomType = null;
                possible = false;
                break;
        }
        
        var gl = Ext.getCmp( this.name +"geomLabel");
        if(possible){
            if(this.geometryEditable){
                Ext.getCmp(this.name +"editButton").setDisabled(false);
                if(this.newGeomType == null){
                    tekst = "Geometrie mag alleen bewerkt worden";
                }else{ 
                    Ext.getCmp(this.name +"newButton").setDisabled(false);
                    tekst = 'Bewerk een ' + tekst+ " op de kaart";
                }
            }else{
                tekst = 'Geometrie mag niet bewerkt worden.';
            }
            gl.setText(tekst);

            for(var i= 0 ; i < attributes.length ;i++){
                var attribute = attributes[i];
                if(attribute.editable){
                    var allowedEditable = this.allowedEditable(attribute);
                    var values = Ext.clone(attribute.editValues);
                    var input = null;
                    if(i == appLayer.geometryAttributeIndex){
                        continue;
                    }
                    if(values == undefined || values.length == 1){
                        var fieldText = "";
                        if(values!= undefined){
                            fieldText = values[0];
                        }
                        var options={
                            name: attribute.name,
                            fieldLabel: attribute.editAlias || attribute.name,
                            renderTo: this.name + 'InputPanel',
                            value:  fieldText,
                            disabled: !allowedEditable
                        };
                        if (attribute.editHeight){
                            options.rows = attribute.editHeight;                           
                            input = Ext.create("Ext.form.field.TextArea",options)
                        }else{
                            input = Ext.create("Ext.form.field.Text",options);
                        }
                    }else if (values.length > 1){
                        var allBoolean=true;
                        for (var v=0; v < values.length; v++){
                            
                            var hasLabel = values[v].indexOf(":") !== -1;
                            var val = hasLabel ?  values[v].substring(0, values[v].indexOf(":")) :  values[v];
                            if (val.toLowerCase()!=="true" && val.toLowerCase()!=="false"){
                                allBoolean =false;
                                break;
                            }
                        }
                        
                        Ext.each(values,function(value,index,original){
                            var hasLabel = value.indexOf(":") !== -1;
                            var label = value;
                            if(hasLabel){
                                label = value.substring(value.indexOf(":")+1);
                                value = value.substring(0,value.indexOf(":"));
                            }
                            
                            if (allBoolean){
                                value= value.toLowerCase() ==="true";
                            }
                            original[index] = {
                                id: value,
                                label: label
                            };
                            
                        });
                        var valueStore = Ext.create('Ext.data.Store', {
                            fields: ['id', 'label'],
                            data : values
                        });

                        input = Ext.create('viewer.components.FlamingoCombobox', {
                            fieldLabel: attribute.editAlias || attribute.name,
                            store: valueStore,
                            queryMode: 'local',
                            displayField: 'label',
                            name:attribute.name,
                            renderTo: this.name + 'InputPanel',
                            valueField: 'id',
                            disabled: !allowedEditable
                        });
                    }
                    this.inputContainer.add(input);
                }
            }
{'fraction_non_alphanumeric': 0.09877089323517331, 'fraction_numerical': 0.004075958166134791, 'mean_word_length': 1.1267302781884156, 'pattern_counts': {'":': 19, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6435478', 'n_tokens_mistral': 7786, 'n_tokens_neox': 7340, 'n_words': 1457}