text:
import React, { Component } from 'react';
import L from 'leaflet';
import classnames from 'classnames';
import Select from 'react-select';
import 'react-select/dist/react-select.css';
import 'react-datetime/css/react-datetime.css'
import DateTime from 'react-datetime';
import { TabContent, TabPane, Nav, NavItem, NavLink, Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap';
import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table';
(function(window, document, undefined) {
    L.MyMarkers = {};
    L.MyMarkers.version = "1.0.1";
    L.MyMarkers.Icon = L.Icon.extend({
        options: {
            iconSize: [ 35, 45 ],
            iconAnchor: [ 17, 42 ],
            popupAnchor: [ 1, -32 ],
            shadowAnchor: [ 10, 12 ],
            shadowSize: [ 36, 16 ],
            className: "my-marker",
            prefix: "",
            extraClasses: "",
            shape: "circle",
            icon: "",
            innerHTML: "",
            color: "red",
            number: "",
            isAnchor:false,
            animation : null
        },
        initialize: function(options) {
            options = L.Util.setOptions(this, options);
        },
        createIcon: function() {
            var div = document.createElement("div"), options = this.options;
            //TODO Set speed by element.setAttribute(speed, "1")

            if (options.icon) {
                div.innerHTML = this._createInner();
            }
            if (options.innerHTML) {
                div.innerHTML = options.innerHTML;
            }
            this._setIconStyles(div);
            return div;
        },
        _createInner: function() {
            var iconColorStyle = "", iconNumber = "", options = this.options;
            if (options.color) {
                iconColorStyle = "style='color: " + options.color + ";' ";
            }
            if (options.number) {
                iconNumber = "number='" + options.number + "' ";
                iconColorStyle = "style='color: " + options.color + ";font-size:12px;'";
            }
            if (options.isAnchor) {
              return "

";
            }else {
              //return "";
              return `<i ${iconNumber} ${iconColorStyle} class="${options.extraClasses} ${options.prefix} ${options.icon}"></i>`
            }

        },
        _setIconStyles: function(img) {
            var options = this.options, size = L.point(options["iconSize"]), anchor, leafletName;
            anchor = L.point(options.iconAnchor);
            leafletName = "icon";
            if (!anchor && size) {
                anchor = size.divideBy(2, true);
            }
            if (!options.isAnchor) img.style.pointerEvents = "auto";
            img.className = "leaflet-marker-" + leafletName  + " " + options.className;
            if(options.animation) img.setAttribute("speed", options.animation);
            if (anchor) {
                img.style.marginLeft = -anchor.x + "px";
                img.style.marginTop = -anchor.y + "px";
            }
            if (options.color){
              img.style.color = options.color;
            }
        }
    });
    L.MyMarkers.icon = function(options) {
        return new L.MyMarkers.Icon(options);
    };
})(window, document);
const config = {
  params: {
    center: [48.836703,2.334345],
    zoomControl: false,
    zoom: 10,
    maxZoom: 18,
    minZoom: 1,
    scrollwheel: false,
    legends: true,
    infoControl: false,
    attributionControl: true
  },
  tileLayer : {
    uri: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
    params: {
      minZoom: 1,
      attribution: '© OpenStreetMap contributors, © CartoDB',
      id: '',
      accessToken: ''
    }
  }
}
const colorList = ["#9c27b0","#303f9f","#ad1457","#8b4aa5","#7f3573","#cbddb8","#f2cc8c","#c984b0","#8b4aa5","#7f3573"];
export default class Map extends Component{
  constructor(props) {
    super(props);
    this.state = {
      activeTab : null,
      map : null,
      isModifierGeofenceModal : false,
      isAddGeofenceModal : false,
      isDeleteGeofenceModal : false,
      geoData : {type:"FeatureCollection",features:[]},
      arretsGeojson :  {type:"FeatureCollection",features:[]},
      routesGeojson : {type:"FeatureCollection",features:[]},
      geojsonLayer : null,
      geofenceLayer : [],
      arretsLayer : null,
      routesLayer : null,
      scooterNumClicked : null,
      isSymbol : true,
      scooterSelected : [],
      scooterList : [],
      geofenceData : [],
      geofenceDataRow : [],
      scooterEnterInfoData : []
    }
    this.toggle = this.toggle.bind(this);
    this.toggleModifierGeofenceModal = this.toggleModifierGeofenceModal.bind(this);
    this.toggleAddGeofenceModal = this.toggleAddGeofenceModal.bind(this);
    this.toggleDeleteGeofenceModal = this.toggleDeleteGeofenceModal.bind(this);
    this.selectGeofence = this.selectGeofence.bind(this);
    this.init = this.init.bind(this);
    this.updateScooterDataInterval;
    this.updateScooterEnterInfoInterval;
    this.afficherArrets = this.afficherArrets.bind(this);
    this.afficherRoutes = this.afficherRoutes.bind(this);
    this.addGeoJSONLayer = this.addGeoJSONLayer.bind(this);
    this.clearArretsLayer = this.clearArretsLayer.bind(this);
    this.addArretsLayer = this.addArretsLayer.bind(this);
    this.addRoutesLayer = this.addRoutesLayer.bind(this);
    this.addGeofenceLayer = this.addGeofenceLayer.bind(this);
    this.clearRoutesLayer = this.clearRoutesLayer.bind(this);
    this.pointToLayer = this.pointToLayer.bind(this);
    this.pointToLayerArret = this.pointToLayerArret.bind(this);
    this.onEachFeature = this.onEachFeature.bind(this);
    this.onEachFeatureArret = this.onEachFeatureArret.bind(this);
    this.filterFeatures = this.filterFeatures.bind(this);
    this.formatArretsPositions = this.formatArretsPositions.bind(this);
    this.formatScooterRoutes = this.formatScooterRoutes.bind(this);
    this.formatGeofence = this.formatGeofence.bind(this);
    this.zoomToFeature = this.zoomToFeature.bind(this);
    this.handleSelectChange = this.handleSelectChange.bind(this);
    this.areaNameFormatter = this.areaNameFormatter.bind(this);
    this.deviceNameFormatter = this.deviceNameFormatter.bind(this);
    this.updateGeofence = this.updateGeofence.bind(this);
    this.addGeofence = this.addGeofence.bind(this);
    this.deleteGeofence = this.deleteGeofence.bind(this);
    this.getGeofencesForEnter = this.getGeofencesForEnter.bind(this);
    this.getLatestEnterInfo = this.getLatestEnterInfo.bind(this);
  }
  componentDidMount() {
    this.init(this._mapNode);
    this.updateScooterDataFromServer();
    this.updateScooterDataInterval = setInterval(()=>{
      this.updateScooterDataFromServer();
    },30000);
  }
  componentDidUpdate(prevProps, prevState) {
    this.addGeoJSONLayer(this.state.geoData);
    if(this.state.scooterSelected.length!==prevState.scooterSelected.length){
      this.zoomToFeature(this.state.geojsonLayer);
    }
  }
  componentWillUnmount() {
    clearInterval(this.updateScooterDataInterval);
    clearInterval(this.updateScooterEnterInfoInterval);
    this.state.map.remove();
  }
  toggle(tab) {
    if(tab!=='3'){
      this.state.geofenceLayer.map((instance)=>{
        instance.remove();
      })
      this.setState({
        geofenceLayer: []
      });
    }
    if(tab!=='4'){
      clearInterval(this.updateScooterEnterInfoInterval)
    }else {
      this.getLatestEnterInfo();
      this.getGeofencesForEnter();
      this.updateScooterDataInterval = setInterval(()=>{
        this.getLatestEnterInfo();
      },30000);
    }
    if (this.state.activeTab !== tab) {
      this.setState({
        activeTab: tab
      });
    }
  }
  toggleModifierGeofenceModal(){
    //console.log("toggleModifierGeofenceModal",this.state.isModifierGeofenceModal);
    this.setState({
      isModifierGeofenceModal: !this.state.isModifierGeofenceModal
    });
  }
  toggleAddGeofenceModal(){
    this.setState({
      isAddGeofenceModal: !this.state.isAddGeofenceModal
    });
  }
  toggleDeleteGeofenceModal(){
    this.setState({
      isDeleteGeofenceModal: !this.state.isDeleteGeofenceModal
    });
  }
  selectGeofence(e){
    this.refs.longitude.disabled = false;
    this.refs.latitude.disabled = false;
    this.refs.radius.disabled = false;
    this.refs.name.disabled = false;
    this.refs.longitude.value = this.state.geofenceData[e.target.value]["area"][0];
    this.refs.latitude.value = this.state.geofenceData[e.target.value]["area"][1];
    this.refs.radius.value = this.state.geofenceData[e.target.value]["area"][2];
    this.refs.name.value = this.state.geofenceData[e.target.value]["name"];
  }
  addGeofence(){
    const queryMethod = "POST";
    let urlGeofences = "http://vps92599.ovh.net:8082/api/geofences";
    let data = {
      "attributes":{},
      "name":this.refs.name.value,
      "description":"",
      "area":"CIRCLE ("+this.refs.longitude.value+" "+this.refs.latitude.value+", "+this.refs.radius.value+")",
      "calendarId":0
    };
    console.log("updateGeofence",data);
    fetch(urlGeofences,{
      method: queryMethod,
      body: JSON.stringify(data),
      headers: new Headers({
    		'Content-Type': 'application/json'
    	}),
      credentials : "include"
    })
    .then(
      (response)=>{
        if(response.status!==200){
          console.log("error");
          this.setState({
            isAddGeofenceSuccess : false
          })
        }else {
          this.state.geofenceLayer.map((instance)=>{
            instance.remove();
          })
          this.toggleAddGeofenceModal();
          this.afficherGeofences();
        }
      }
    )
    .catch((error) => {
      console.error(error);
    });
  }
  updateGeofence(){
    const queryMethod = "PUT";
    let urlGeofences = "http://vps92599.ovh.net:8082/api/geofences/"+this.state.geofenceData[this.refs.geofenceId.value]["id"];
    let data = {
      "id":this.state.geofenceData[this.refs.geofenceId.value]["id"],
      "attributes":this.state.geofenceData[this.refs.geofenceId.value]["attributes"],
      "name":this.refs.name.value,
      "description":this.state.geofenceData[this.refs.geofenceId.value]["description"],
      "area":"CIRCLE ("+this.refs.longitude.value+" "+this.refs.latitude.value+", "+this.refs.radius.value+")",
      "calendarId":this.state.geofenceData[this.refs.geofenceId.value]["calendarId"]
    };
    console.log("updateGeofence",data);
    fetch(urlGeofences,{
      method: queryMethod,
      body: JSON.stringify(data),
      headers: new Headers({
    		'Content-Type': 'application/json'
    	}),
      credentials : "include"
    })
    .then(
      (response)=>{
        if(response.status!==200){
          console.log("error");
          this.setState({
            isModifierGeofenceModalSuccess : false
          })
        }else {
          this.state.geofenceLayer.map((instance)=>{
            instance.remove();
          })
          this.toggleModifierGeofenceModal();
          this.afficherGeofences();
        }
      }
    )
    .catch((error) => {
      console.error(error);
    });
  }
  deleteGeofence(){
    const queryMethod = "DELETE";
    let urlGeofences = "http://vps92599.ovh.net:8082/api/geofences/"+this.state.geofenceData[this.refs.geofenceId.value]["id"];
    fetch(urlGeofences,{
      method: queryMethod,
      headers: new Headers({
    		'Content-Type': 'application/json'
    	}),
      credentials : "include"
    })
    .then(
      (response)=>{
        this.state.geofenceLayer.map((instance)=>{
          instance.remove();
        })
        this.toggleDeleteGeofenceModal();
        this.afficherGeofences();
      }
    )
    .catch((error) => {
      console.error(error);
    });
  }
  getLatestEnterInfo(){
    const queryMethod = "GET";
    let timeNow = new Date();
    let timeTenMintesAgo = new Date();
    timeTenMintesAgo.setMinutes(timeTenMintesAgo.getMinutes()-10);
    let urlEnterInfo = "http://vps92599.ovh.net:8082/api/reports/events?groupId=1&type=geofenceEnter&from=2017-09-01T13%3A42%3A57.000Z&to="+timeNow.toISOString();
    //let urlEnterInfo = "http://vps92599.ovh.net:8082/api/reports/events?groupId=1&type=geofenceEnter&from="+timeTenMintesAgo.toISOString()+"&to="+timeNow.toISOString();
    fetch(urlEnterInfo,{
      method: queryMethod,
      headers: new Headers({
    		'Content-Type': 'application/json'
    	}),
      credentials : "include"
    }).then((response) => response.json())
    .then((responseJson)=>{
      this.setState({
        scooterEnterInfoData : responseJson
      })
    })
    .catch((error) => {
      console.error(error);
    });
  }
  addRoutesLayer(geojson){
    let cur = this;
    let routesLayer;
    console.log("addRoutesLayer",geojson);
    if (!this.state.routesLayer&&geojson["features"].length>0) {
      routesLayer = L.geoJson(geojson, {
        style: this.routeStyle
      });
      routesLayer.addTo(this.state.map);
      geojson["features"].length>0?cur.zoomToFeature(routesLayer):null;
      this.setState({
        routesLayer:routesLayer
      })
    }else if(this.state.routesLayer) {
      this.state.routesLayer.clearLayers();
      this.state.routesLayer.addData(geojson);
      //geojson["features"].length>0?cur.zoomToFeature(geojsonLayer):null;
    }
  }
  clearRoutesLayer(){
    this.state.routesLayer.clearLayers();
    this.setState({
      isSymbol : false
    })
  }
  routeStyle(feature) {
    return {color: feature.geometry.color};
  }
  addGeoJSONLayer(geojson) {
    let cur = this;
    let geojsonLayer;

    if (!this.state.geojsonLayer&&geojson["features"].length>0) {
      geojsonLayer = L.geoJson(geojson, {
        onEachFeature: this.onEachFeature,
        pointToLayer: this.pointToLayer,
        filter: this.filterFeatures
      });
      geojsonLayer.addTo(this.state.map);
      geojson["features"].length>0?cur.zoomToFeature(geojsonLayer):null;
      this.setState({
        geojsonLayer:geojsonLayer
      })
    }else if(this.state.geojsonLayer) {
      this.state.geojsonLayer.clearLayers();
      this.state.geojsonLayer.addData(geojson);
      //geojson["features"].length>0?cur.zoomToFeature(geojsonLayer):null;
    }
  }
  pointToLayer(feature, latlng) {
    var cur = this;
    if(feature.geometry.type ==="Point"){
      var markers = this.markerAndIcons(feature.properties.markerAndIcons?feature.properties.markerAndIcons:null);
      markers = markers + `<div class="scooterNameTag">${feature.properties.name}</div>`;
      var testMarker = L.marker(latlng,{icon: L.divIcon({className: 'markers', html:markers, iconSize:[35,35],iconAnchor : [17,42]}),riseOnHover:true})
                        .on('click',(e)=>{
                          cur.setState({
                            scooterNumClicked : feature.properties.scooterGeodataIndex
                          });
                          this.state.map.setView(e.target.getLatLng(),14);
                        },);
      return testMarker;
    }else{
      return null;
    }
  }
  onEachFeature(feature, marker) {
    var cur = this;
    if (feature.geometry.type ==="Point"&&feature.properties) {
      var isChanged = false;
      marker.on('mouseover', function (e) {
        if(!isChanged) {
          cur.showIcons(marker);
          isChanged = true;
        }
      });
      marker.on('mouseout', function (e) {
        cur.hideIcons(marker);
        isChanged=false;
      });
    }
  }
  filterFeatures(feature, layer) {
    let result = true;
    if(!feature.geometry.coordinates[0]||!feature.geometry.coordinates[1]){
      result = false;
    }if (this.state.scooterSelected.length>0) {
      result = false;
      this.state.scooterSelected.map((instance)=>{
        if(instance["value"]===feature.properties.id){
          result = true;
        }
      });
    }
    return result;
  }
  clearArretsLayer(){
    this.state.arretsLayer.clearLayers();
  }
  addArretsLayer(geojson) {
    let cur = this;
    let arretsLayer;
    console.log("addArretsLayer",geojson);
    if (!this.state.arretsLayer&&geojson["features"].length>0) {
      arretsLayer = L.geoJson(geojson, {
        onEachFeature: this.onEachFeatureArret,
        pointToLayer: this.pointToLayerArret
      });
      arretsLayer.addTo(this.state.map);
      geojson["features"].length>0?cur.zoomToFeature(arretsLayer):null;
      this.setState({
        arretsLayer:arretsLayer
      })
    }else if(this.state.arretsLayer) {
      this.state.arretsLayer.clearLayers();
      this.state.arretsLayer.addData(geojson);
      geojson["features"].length>0?cur.zoomToFeature(this.state.arretsLayer):null;
    }
  }
  pointToLayerArret(feature, latlng) {
    var cur = this;
    let popupContent = `
Device: ${feature.properties.deviceName}

Duree: ${(feature.properties.duration/60000).toFixed(2)} Mins

Date: ${feature.properties.date}

Time: ${feature.properties.time}

                        `;
    if(feature.geometry.type ==="Point"){
      var marker =new L.CircleMarker(latlng, {
                      radius: 5,
                      fillColor: feature.geometry.color,
                      color: "#000",
                      weight: 1,
                      opacity: 0.5,
                      fillOpacity: 1
                    }).bindPopup(popupContent);
      return marker;
    }else{
      return null;
    }
  }
  onEachFeatureArret(feature, marker) {
    var cur = this;
    if (feature.geometry.type ==="Point"&&feature.properties) {
      marker.on('mouseover', function (e) {
        marker.togglePopup();
      });
      marker.on('mouseout', function (e) {
        marker.closePopup();
      });
      marker.on('click',(e)=>{
        this.state.map.setView(e.target.getLatLng(),14);
      },);
    }
  }
  addGeofenceLayer(geofenceData){
    let geofenceLayer = [];
    geofenceData.map((instance)=>{
      let area = instance["area"]
      geofenceLayer.push(L.circle([area[0], area[1]], {radius: area[2]}).bindTooltip(instance["name"],{permanent: true, direction:"center", className : "geofenceName"}).openTooltip());
    });
    geofenceLayer.map((instance)=>{
      instance.addTo(this.state.map);
    })
    this.setState({
      geofenceLayer : geofenceLayer
    })
  }
  zoomToFeature(target) {
    var fitBoundsParams = {
      paddingTopLeft: [20,20],
      paddingBottomRight: [20,20],
      maxZoom : 18
    };
    Object.getOwnPropertyNames(target.getBounds()).length>0?
    this.state.map.fitBounds(target.getBounds(), fitBoundsParams):null;
  }
  afficherArrets(){
    let arretQueryString = '';
    this.state.scooterSelected.map((instance)=>{
      arretQueryString = arretQueryString.concat('deviceId=',instance["value"],'&');
    })
    let dateDebut = this.refs.arrets_date_debut.state.inputValue;
    let dateFin = this.refs.arrets_date_fin.state.inputValue;
    if(dateDebut&&dateFin){
      arretQueryString = arretQueryString + "from="+new Date(dateDebut).toISOString()+'&'+'to='+new Date(dateFin).toISOString();
    }
    let urlsArrets = "http://vps92599.ovh.net:8082/api/reports/stops?"+arretQueryString;
    let urls = [urlsArrets];
    console.log("urlsArrets",urlsArrets);
    var promises = urls.map(url =>fetch(url,{credentials: 'include',headers: {'Accept': 'application/json'}}).then(y => y.json()));
    Promise.all(promises)
    .then(results => {this.formatScooterArrets(results);})
    .catch(err=>{console.log(err);});
  }
  afficherGeofences(){
    let urlsGeofences = "http://vps92599.ovh.net:8082/api/geofences";
    let urls = [urlsGeofences];
    var promises = urls.map(url =>fetch(url,{credentials: 'include',headers: {'Accept': 'application/json'}}).then(y => y.json()));
    Promise.all(promises)
    .then(results => {
      this.setState({
        geofenceDataRow : results[0]
      });
      this.formatGeofence(results[0]);
    })
    .catch(err=>{console.log(err);});
  }
  getGeofencesForEnter(){
    let urlsGeofences = "http://vps92599.ovh.net:8082/api/geofences";
    fetch(urlsGeofences,{credentials: 'include',headers: {'Accept': 'application/json'}})
    .then(y => y.json())
    .then(results => {
      this.setState({
        geofenceDataRow : results
      });
    })
    .catch(err=>{console.log(err);});
  }
  formatGeofence(data){
    let res = data
    console.log(res);
    let nullIndex = [];
    res.map((instance,index)=>{
      if(instance){
        instance["area"] = instance["area"].replace(/\(+|\)+|\CIRCLE|\,/g,'').split(' ');
        instance["area"].splice(0,1);
      }else {
        nullIndex.unshift(index);
      }
    });
    nullIndex.map((instance)=>{
      res.splice(instance,1);
    });
    console.log("format geofence",res);
    this.setState({
      geofenceData : res
    });
    this.addGeofenceLayer(res);
  }
  formatScooterArrets(data){
    console.log(data);
    let urlPositions = "http://vps92599.ovh.net:8082/api/positions?";
    let positionTime = {};
    let deviceName = {};
    data[0].map((instance,index)=>{
      if (index !== 0) {
        urlPositions = urlPositions.concat('&');
      }
      urlPositions = urlPositions.concat('id=',instance["positionId"]);
      positionTime[instance["positionId"]] = instance["duration"];
      deviceName[instance["deviceId"]] = instance["deviceName"];
    })
    console.log(urlPositions);
    let urls = [urlPositions];
    var promises = urls.map(url =>fetch(url,{credentials: 'include',headers: {'Accept': 'application/json'}}).then(y => y.json()));
    Promise.all(promises)
    .then(results => {this.formatArretsPositions(results,positionTime,deviceName);})
    .catch(err=>{console.log(err);});
  }
  formatArretsPositions(data,positionTime,deviceName){
    let arretsGeojson = {
      type:"FeatureCollection",
      features :[]
    };
    let colorMap = {};
    this.state.scooterSelected.map((instance,index)=>{
      colorMap[instance["value"]] = colorList[index];
    });
    data[0].map((instance,index)=>{
      let date = new Date(instance["deviceTime"]);
      let template ={
        "type": "Feature",
        "geometry": {
          "type": "Point",
          "color" : colorMap[instance["deviceId"]],
          "coordinates": [instance["longitude"],instance["latitude"]]
        },
        "properties": {
          "duration" : positionTime[instance["id"]],
          "course" : instance["course"],
          "address" : instance["address"],
          "date" : date.toLocaleDateString(),
          "time" : date.toLocaleTimeString(),
          "deviceName" : deviceName[instance["deviceId"]],
          "positionId" : instance["id"],
          "scooterGeodataIndex" : index,
          "deviceId" : instance["deviceId"]
        }
      }
      arretsGeojson['features'].push(template);
    })
    this.setState({
      arretsGeojson : arretsGeojson
    })
    this.addArretsLayer(arretsGeojson);
  }
  afficherRoutes(){
    let arretQueryString = '';
    this.state.scooterSelected.map((instance)=>{
      arretQueryString = arretQueryString.concat('deviceId=',instance["value"],'&');
    })
    let dateDebut = this.refs.routes_date_debut.state.inputValue;
    let dateFin = this.refs.routes_date_fin.state.inputValue;
    if(dateDebut&&dateFin){
      arretQueryString = arretQueryString + "from="+new Date(dateDebut).toISOString()+'&'+'to='+new Date(dateFin).toISOString();
    }
    let urlsArrets = "http://vps92599.ovh.net:8082/api/reports/route?"+arretQueryString;
    let urls = [urlsArrets];
    console.log("urlsArrets",urlsArrets);
    var promises = urls.map(url =>fetch(url,{credentials: 'include',headers: {'Accept': 'application/json'}}).then(y => y.json()));
    Promise.all(promises)
    .then(results => {this.formatScooterRoutes(results);})
    .catch(err=>{console.log(err);});
  }
  formatScooterRoutes(data){
    let routesGeojson = {
      type:"FeatureCollection",
      features :[]
    };
    let colorMap = {};
    let lineIndex = [];
    this.state.scooterSelected.map((instance,index)=>{
      colorMap[instance["value"]] = colorList[index];
    });
    data[0].map((instance,index)=>{
      let date = new Date(instance["deviceTime"]);
      if(lineIndex.indexOf(instance["deviceId"])===-1){
        lineIndex.push(instance["deviceId"]);
        let template ={
          "type": "Feature",
          "geometry": {
            "type": "LineString",
            "color" : colorMap[instance["deviceId"]],
            "coordinates": [[instance["longitude"],instance["latitude"]]]
          },
          "properties": {
            "deviceId" : instance["deviceId"]
          }
        }
        routesGeojson['features'].push(template);
      }else {
        routesGeojson['features'][lineIndex.indexOf(instance["deviceId"])]["geometry"]["coordinates"].push([instance["longitude"],instance["latitude"]]);
      }
    })
    this.setState({
      routesGeojson : routesGeojson,
      isSymbol : true
    })
    console.log(routesGeojson);
    this.addRoutesLayer(routesGeojson);
  }
  updateScooterDataFromServer(){
    let urls = ["http://vps92599.ovh.net:8082/api/devices","http://vps92599.ovh.net:8082/api/groups","http://vps92599.ovh.net:8082/api/positions"];
    var promises = urls.map(url =>fetch(url,{credentials: 'include',headers: {'Accept': 'application/json'}}).then(y => y.json()));
    Promise.all(promises)
    .then(results => {this.formatScooterDataAll(results);})
    .catch(err=>{console.log(err);});
  }
  findPositonIndex(id,data){
    for (var i = 0; i < data.length; i++) {
      if(data[i]["deviceId"]===id){
        return i;
      }
    }
    return -1;
  }
  findGroupIndex(id,data){
    for (var i = 0; i < data.length; i++) {
      if(data[i]["id"]===id){

        return i;
      }
    }
    return -1;
  }
  formatScooterDataAll(data){
    let scooterData = {
      type:"FeatureCollection",
      features :[]
    }
    let scooterList = []
    let scooterTableList = [];
    //[Devices, Groups, Positions]
    data[0].map((value,index)=>{
      if(value){
        let positionIndex = this.findPositonIndex(value["id"],data[2]);
        let groupIndex = this.findGroupIndex(value["groupId"],data[1]);
        let scooterDetails={
          "mobile":value["uniqueId"]?"imei:"+value["uniqueId"]:"To be getted",
          "mileage" : positionIndex>=0?(data[2][positionIndex]["attributes"]["totalDistance"]/1000).toFixed(2)+" KM":"To be getted",
          "date":positionIndex>=0?data[2][positionIndex]["deviceTime"]:"To be getted",
          "lat":positionIndex>=0?data[2][positionIndex]["latitude"]:null,
          "long":positionIndex>=0?data[2][positionIndex]["longitude"]:null,
          "speed":positionIndex>=0?data[2][positionIndex]["speed"]+"Km/h": "To be getted",
          "address":positionIndex>=0?(data[2][positionIndex]["address"]?data[2][positionIndex]["address"]:"To be getted"):"To be getted",
          "attributes":value["attributes"]?value["attributes"]:"To be getted",
          "category":value["category"]?value["category"]:"To be getted",
          "contact":value["contact"]?value["contact"]:"To be getted",
          "geofenceIds":value["geofenceIds"]?value["geofenceIds"]:"To be getted",
          "groupId":value["groupId"]?value["groupId"]:"To be getted",
          "group":groupIndex>=0?data[1][groupIndex]["name"]:"Unknown Group",
          "id":value["id"]?value["id"]:"To be getted",
          "lastUpdate":value["lastUpdate"]?value["lastUpdate"]:"To be getted",
          "model":value["model"]?value["model"]:"To be getted",
          "name":value["name"]?value["name"].replace( /\D+/g, ''):"To be getted",
          "phone":value["phone"]?value["phone"]:"To be getted",
          "positionId":value["positionId"]?value["positionId"]:"To be getted",
          "status" : value["status"]?value["status"]:"To be getted"
        }
        let template ={
          "type": "Feature",
          "geometry": {
            "type": "Point",
            "coordinates": [scooterDetails["long"],scooterDetails["lat"]]
          },
          "properties": {
            "markerAndIcons" :[{"icon":"motorcycle","color":"CADETBLUE","number":null},{"icon":"number","color":"BLUE","number":scooterDetails['name']}],
            "mileage":scooterDetails["mileage"],
            "speed" : scooterDetails["speed"],
            "name" : scooterDetails["name"],
            "address" : scooterDetails["address"],
            "status" : scooterDetails["status"],
            "scooterGeodataIndex" : index,
            "id" : scooterDetails["id"]
          }
        }
        let timeString = null;
        if(positionIndex>=0){
          let deviceTime = data[2][positionIndex]["deviceTime"];
          let updateTime = new Date(deviceTime);
          let clientTime = new Date();
          let timeDifs = ((clientTime.getTime()-updateTime.getTime())/60/1000).toFixed(1);
          timeString = timeDifs?(timeDifs>=60?(timeDifs>=1440?(timeDifs/1440).toFixed(1)+' Days ago':(timeDifs/60).toFixed(1)+' Hours ago'):(timeDifs)+' Minutes ago'):null;
        }
        let scooterListData = {
          "value":scooterDetails["id"],
          "label":scooterDetails["name"],
          "updateTime":timeString?timeString:"Unknown",
          "status":scooterDetails["status"]?scooterDetails["status"]:"to be getted"
        }
        scooterData["features"].push(template);
        scooterList.push(scooterListData);
      }
    });
    this.setState({
      geoData : scooterData,
      scooterList : scooterList
    });
  }
  areaFormatter(cell,row){
    return (

        {"LON: "+parseFloat(cell[0]).toFixed(2)+'\t'}
        {"LAT: "+parseFloat(cell[1]).toFixed(2)+'\t'}
        {"RD: "+(parseFloat(cell[2])/1000).toFixed(1)+ 'KM'}

    );
  }
  deviceNameFormatter(cell){
    let deveiceName;
    this.state.scooterList.map((instance)=>{
      if(instance["value"]===cell) deveiceName = instance["label"];
    });
    return 'Scooter '+deveiceName;
  }
  areaNameFormatter(cell){
    let areaName;
    this.state.geofenceDataRow.map((instance)=>{
      if(instance&&instance["id"]===cell) areaName = instance["name"];
    });
    return areaName;
  }
  updateTimeFormatter(cell){
    let t = new Date();
    let tt = new Date(cell);
    return ((t.getTime()-tt.getTime())/1000/60).toFixed(1) + ' Minites';
  }
  markerAndIcons(info){
    ////console.log("info",info);
    let markerAndIconsString = "";
    let iconNum = info?info.length:0;
    if(info){
      for(var i=0;i<iconNum;i++){
        markerAndIconsString = markerAndIconsString.concat(this.generateIcon(
          iconNum-1,
          i,
          info[i]['icon'],
          info[i]['color'],
          i===0?null:'surround',
          info[i]['icon']==="number"?info[i]['number']:null));
        //markerAndIconsString = markerAndIconsString.concat(cur.generateIcon(iconNum-1,i,info[i][0],'CADETBLUE','surround',info[i][0]==="number"?info[i][1]:null));
      }
    }else{
      markerAndIconsString = this.generateIcon();
    }
    return markerAndIconsString;
  }
  renderSizePerPageDropDown = props => {
    return (

        {
          [ 1, 2, 3 ].map((n, idx) => {
            const isActive = (n === props.currSizePerPage) ? 'active' : null;
            return (
              <button key={ idx } type='button' className={ `btn btn-info ${isActive}` } onClick={ () => props.changeSizePerPage(n) }>{ n }</button>
            );
          })
        }

    );
  }
  generateIcon(count,iconIndex,iconStyle,color,className,number){
    var template = {
      icon: 'fa-bars',
      color: 'lightcoral',
      shape: 'star',
      prefix: 'fa',
      iconAnchor : [0,0],
      className : 'my-marker',
      iconSize :[35,35],
      number : "",
      animation : null
    }
    var offset = Math.PI*(1-2*(count-1)/count)/2;
    iconStyle?template['icon']='fa-'.concat(iconStyle):null;
    color?template['color']=color:null;
    iconIndex>0?template['iconAnchor'] = [-35*Math.cos(2*Math.PI*(iconIndex-1) /count+offset),35*Math.sin(2*Math.PI*(iconIndex-1) /count+offset)]:null;
    iconIndex>0?template['animation'] = iconIndex:null;
    className?template['className'] = template['className'].concat(" ",className):null;
    number?template['number'] = number :null;
    if(!iconIndex||iconIndex === 0) {
      template['isAnchor'] = true;
    }
    var iconHTMLElement =  L.MyMarkers.icon(template).createIcon();
    var outerHTMLElement = iconHTMLElement.outerHTML;
    return outerHTMLElement;
  }
  showIcons(marker){
    var count = 1;
    for (var obj in marker._icon.children) {
      if(obj>0){
        marker._icon.children[obj].className = marker._icon.children[obj].className.concat(' show');
      }
    }
  }
  hideIcons(marker){
    for (var obj in marker._icon.children) {
      if(obj>0){
        marker._icon.children[obj].className =this.replaceString(' show','',marker._icon.children[obj].className);
      }
    }
  }
  replaceString(oldS, newS, fullS) {
    for (var i = 0; i < fullS.length; ++i) {
      if (fullS.substring(i, i + oldS.length) == oldS) {
        fullS = fullS.substring(0, i) + newS + fullS.substring(i + oldS.length, fullS.length);
      }
    }
    return fullS;
  }
  init(id) {
    if (this.state.map) return;
    let map = L.map(id, config.params);
    L.control.zoom({ position: "bottomleft"}).addTo(map);
    L.control.scale({ position: "bottomleft"}).addTo(map);
    const tileLayer = L.tileLayer(config.tileLayer.uri, config.tileLayer.params).addTo(map);
    this.setState({ map:map});
  }
  handleSelectChange (value) {
		console.log('You\'ve selected scooter:', value);
		this.setState({ scooterSelected : value });
	}
  render(){
    const optionsGeofence = {
      sizePerPage: 3,
      sizePerPageDropDown: this.renderSizePerPageDropDown,
    };
    const optionsEntre = {
      sizePerPage: 3,
      sizePerPageDropDown: this.renderSizePerPageDropDown,
      sortName: "serverTime",
      sortOrder: "desc",
    };
    const mileage = this.state.scooterNumClicked?this.state.geoData["features"][this.state.scooterNumClicked]["properties"]['mileage']:'...';
    const name = this.state.scooterNumClicked?this.state.geoData["features"][this.state.scooterNumClicked]["properties"]['name']:null;
    const address = this.state.scooterNumClicked?this.state.geoData["features"][this.state.scooterNumClicked]["properties"]['address']:'...';
    const status = this.state.scooterNumClicked?this.state.geoData["features"][this.state.scooterNumClicked]["properties"]['status']:'...';
    return (

Carte

              {name?

                {name}

Scooter

:

                Click un Scooter sur la carte

Scooter

}
              <div className={classnames("mt-2",{"col-lg-1" : mileage.length<=7,"col-lg-2" : mileage.length>7})}>
                {mileage}

parcours

                {status}

status

                {address}

address

              Selectionner Scooters
              <Select
                name="scooter_selection"
                id="scooter_selection"
                value={this.state.scooterSelected}
                options={this.state.scooterList}
                optionComponent={SelectOptions}
                multi={true}
                onChange = {this.handleSelectChange}
              />

              <NavItem>
                <NavLink
                  className={classnames({ active: this.state.activeTab === '1' })}
                  onClick={() => { this.toggle('1'); }}
                >
                  Arrêts
                </NavLink>
              </NavItem>
              <NavItem>
                <NavLink
                  className={classnames({ active: this.state.activeTab === '2' })}
                  onClick={() => { this.toggle('2'); }}
                >
                  Parcours
                </NavLink>
              </NavItem>

            <TabContent activeTab={this.state.activeTab}>
              <TabPane tabId="1">

                      Selectionner la date debut
                      <DateTime ref = "arrets_date_debut"/>

                      Selectionner la date fin
                      <DateTime ref = "arrets_date_fin"/>

                      <button type="button" className="btn btn-sm btn-primary" onClick={this.afficherArrets}>Afficher</button>
                      <button type="button" className="btn btn-sm btn-info" onClick={this.clearArretsLayer}>Clear</button>

              </TabPane>
              <TabPane tabId="2">

                      Selectionner la date debut
                      <DateTime ref = "routes_date_debut"/>

                      Selectionner la date fin
                      <DateTime ref = "routes_date_fin"/>

                      <button type="button" className="btn btn-sm btn-primary" onClick={this.afficherRoutes}>Afficher</button>
                      <button type="button" className="btn btn-sm btn-info" onClick={this.clearRoutesLayer}>Clear</button>

                  {this.state.isSymbol?<RouteSymbol scooterSelected={this.state.scooterSelected}/>:null}

              </TabPane>
              <TabPane tabId="3">

                    <button type="button" className="btn col-sm-3 btn-primary" onClick={this.toggleAddGeofenceModal}>Ajouter</button>
                    <button type="button" className="btn col-sm-3 btn-info" onClick={this.toggleModifierGeofenceModal}>Modifier</button>
                    <button type="button" className="btn col-sm-3 btn-success">Assigner</button>
                    <button type="button" className="btn col-sm-3 btn-danger" onClick={this.toggleDeleteGeofenceModal}>Supprimer</button>
                    <BootstrapTable
                      options = {optionsGeofence}
                      data={ this.state.geofenceData }
                      headerStyle = { { "backgroundColor" : "#63c2de" } }
                      height = "250px"
                      pagination>
                      <TableHeaderColumn
                        dataField="name"
                        isKey
                        dataSort
                        tdStyle = {{"textOverflow": "ellipsis"}}
                        width = "30%">
                        Nom
                      </TableHeaderColumn>
                      <TableHeaderColumn
                        dataField="area"
                        dataSort
                        tdStyle = {{"textOverflow": "ellipsis"}}
                        dataFormat = {this.areaFormatter}>
                        Area
                      </TableHeaderColumn>
                    </BootstrapTable>
                    <Modal isOpen={this.state.isModifierGeofenceModal} toggle={this.toggleModifierGeofenceModal}>
                      <ModalHeader toggle={this.toggleModifierGeofenceModal}>Modifier un Geofence</ModalHeader>
                      <ModalBody>

                              Nom
                              <select className="form-control" ref='geofenceId' id="name" placeholder="Nom" defaultValue='selectionner un geofence' onChange = {(e)=>this.selectGeofence(e)}>
                                <option disabled value='selectionner un geofence'> -- selectionner un geofence -- </option>
                                {
                                  this.state.geofenceData.map((instance,index)=>{
                                    return <option value={index}>{'Geofence: '+instance['name']}</option>
                                  })
                                }
                              </select>

                              Nom
                              <input type="text" disabled ref='name' className="form-control" id="name" placeholder="Nom"/>

                              Longitude
                              <input type="text" disabled ref='longitude' className="form-control" id="longitude" placeholder="Longitude"/>

                              Latitude
                              <input type="text" disabled ref='latitude' className="form-control" id="latitude" placeholder="Latitude"/>

                              Radius / Metre
                              <input type="text" disabled ref='radius' className="form-control" id="radius" placeholder="Radius"/>

                      </ModalBody>
                      <ModalFooter>
                        <button type="button" className="btn btn-sm btn-success" onClick={this.updateGeofence}>Submit</button>
                        <button type="button" className="btn btn-sm btn-secondary" onClick={this.toggleModifierGeofenceModal}>Cancel</button>
                      </ModalFooter>
                    </Modal>
                    <Modal isOpen={this.state.isDeleteGeofenceModal} toggle={this.toggleDeleteGeofenceModal}>
                      <ModalHeader toggle={this.toggleDeleteGeofenceModal}>Supprimer un Geofence</ModalHeader>
                      <ModalBody>

                              Nom
                              <select className="form-control" ref='geofenceId' id="name" placeholder="Nom" defaultValue='selectionner un geofence'>
                                <option disabled value='selectionner un geofence'> -- selectionner un geofence -- </option>
                                {
                                  this.state.geofenceData.map((instance,index)=>{
                                    return <option value={index}>{'Geofence: '+instance['name']}</option>
                                  })
                                }
                              </select>

                      </ModalBody>
                      <ModalFooter>
                        <button type="button" className="btn btn-sm btn-success" onClick={this.deleteGeofence}>Submit</button>
                        <button type="button" className="btn btn-sm btn-secondary" onClick={this.toggleDeleteGeofenceModal}>Cancel</button>
                      </ModalFooter>
                    </Modal>
                    <Modal isOpen={this.state.isAddGeofenceModal} toggle={this.toggleAddGeofenceModal}>
                      <ModalHeader toggle={this.toggleAddGeofenceModal}>Ajouter un Geofence</ModalHeader>
                      <ModalBody>

                              Nom
                              <input type="text" ref='name' className="form-control" id="name" placeholder="Nom"/>

                              Longitude
                              <input type="text" ref='longitude' className="form-control" id="longitude" placeholder="Longitude"/>

                              Latitude
                              <input type="text" ref='latitude' className="form-control" id="latitude" placeholder="Latitude"/>

                              Radius / Metre
                              <input type="text" ref='radius' className="form-control" id="radius" placeholder="Radius"/>

                      </ModalBody>
                      <ModalFooter>
                        <button type="button" className="btn btn-sm btn-success" onClick={this.addGeofence}>Submit</button>
                        <button type="button" className="btn btn-sm btn-secondary" onClick={this.toggleAddGeofenceModal}>Cancel</button>
                      </ModalFooter>
                    </Modal>

              </TabPane>
              <TabPane tabId="4">
                <BootstrapTable
                  options = {optionsEntre}
                  data={ this.state.scooterEnterInfoData }
                  headerStyle = { { "backgroundColor" : "#63c2de" } }
                  height = "250px"
                  pagination>
                  <TableHeaderColumn
                    dataField="deviceId"
                    isKey
                    dataSort
                    width = "30%"
                    dataFormat = {this.deviceNameFormatter}>
                    Nom
                  </TableHeaderColumn>
                  <TableHeaderColumn
                    dataField="geofenceId"
                    dataSort
                    dataFormat = {this.areaNameFormatter}>
                    Area
                  </TableHeaderColumn>
                  <TableHeaderColumn
                    dataField="serverTime"
                    dataSort
                    dataFormat = {this.updateTimeFormatter}>
                    Update
                  </TableHeaderColumn>
                </BootstrapTable>
              </TabPane>
            </TabContent>

 { this._mapNode = node}} id="map" />

    );
  }
}
class SelectOptions extends Component{
  constructor(props){
    super(props);
    this.handleMouseDown = this.handleMouseDown.bind(this);
    this.handleMouseEnter = this.handleMouseEnter.bind(this);
    this.handleMouseMove = this.handleMouseMove.bind(this);
  }
	handleMouseDown (event) {
		event.preventDefault();
		event.stopPropagation();
		this.props.onSelect(this.props.option, event);
	}
	handleMouseEnter (event) {
		this.props.onFocus(this.props.option, event);
	}
	handleMouseMove (event) {
		if (this.props.isFocused) return;
		this.props.onFocus(this.props.option, event);
	}
	render () {
		return (

            {this.props.children}

            {this.props.option.updateTime}

              {this.props.option.status}

		);
	}
}
class CountDown extends Component{
  constructor(props){
    super(props);
    this.state = {
      countDown : 30
    }
    this.refreshCountDownInterval;
    this.mapRefreshCountDown = this.mapRefreshCountDown.bind(this);
  }
  componentDidMount(){
    this.refreshCountDownInterval = setInterval(()=>{
      this.mapRefreshCountDown();
    },1000);
  }
  componentWillUnmount(){
    clearInterval(this.refreshCountDownInterval);
  }
  mapRefreshCountDown(){
    let current = this.state.countDown;
    let next = (current-1)<=0?30:(current-1);
    this.setState({
      countDown : next
    })
  }
  render () {
		return (
      {this.state.countDown}
		);
	}
}

class RouteSymbol extends Component{
  constructor(props){
    super(props);
  }
  render () {
		return (

          {
            this.props.scooterSelected.length>0?

              Route Legends:

:null
          }
          {
            this.props.scooterSelected.map((value,index)=>{
              return <button type="button" className="btn btn-sm btn-info" style={{ backgroundColor :colorList[index]}}>{value['label']}</button>
            })
          }

		);
	}
}


text:
FROM rroemhild/ejabberd
ENV EJABBERD_HOME /opt/ejabberd
COPY ./scripts $EJABBERD_HOME/scripts

redpajama_set_name: RedPajamaGithub


text:
var appLocale = {lc:{"ar":function(n){
  if (n === 0) {
    return 'zero';
  }
  if (n == 1) {
    return 'one';
  }
  if (n == 2) {
    return 'two';
  }
  if ((n % 100) >= 3 && (n % 100) <= 10 && n == Math.floor(n)) {
    return 'few';
  }
  if ((n % 100) >= 11 && (n % 100) <= 99 && n == Math.floor(n)) {
    return 'many';
  }
  return 'other';
},"en":function(n){return n===1?"one":"other"},"bg":function(n){return n===1?"one":"other"},"bn":function(n){return n===1?"one":"other"},"ca":function(n){return n===1?"one":"other"},"cs":function(n){
  if (n == 1) {
    return 'one';
  }
  if (n == 2 || n == 3 || n == 4) {
    return 'few';
  }
  return 'other';
},"da":function(n){return n===1?"one":"other"},"de":function(n){return n===1?"one":"other"},"el":function(n){return n===1?"one":"other"},"es":function(n){return n===1?"one":"other"},"et":function(n){return n===1?"one":"other"},"eu":function(n){return n===1?"one":"other"},"fa":function(n){return "other"},"fi":function(n){return n===1?"one":"other"},"fil":function(n){return n===0||n==1?"one":"other"},"fr":function(n){return Math.floor(n)===0||Math.floor(n)==1?"one":"other"},"gl":function(n){return n===1?"one":"other"},"he":function(n){return n===1?"one":"other"},"hi":function(n){return n===0||n==1?"one":"other"},"hr":function(n){
  if ((n % 10) == 1 && (n % 100) != 11) {
    return 'one';
  }
  if ((n % 10) >= 2 && (n % 10) <= 4 &&
      ((n % 100) < 12 || (n % 100) > 14) && n == Math.floor(n)) {
    return 'few';
  }
  if ((n % 10) === 0 || ((n % 10) >= 5 && (n % 10) <= 9) ||
      ((n % 100) >= 11 && (n % 100) <= 14) && n == Math.floor(n)) {
    return 'many';
  }
  return 'other';
},"hu":function(n){return "other"},"id":function(n){return "other"},"is":function(n){
    return ((n%10) === 1 && (n%100) !== 11) ? 'one' : 'other';
  },"it":function(n){return n===1?"one":"other"},"ja":function(n){return "other"},"ko":function(n){return "other"},"lt":function(n){
  if ((n % 10) == 1 && ((n % 100) < 11 || (n % 100) > 19)) {
    return 'one';
  }
  if ((n % 10) >= 2 && (n % 10) <= 9 &&
      ((n % 100) < 11 || (n % 100) > 19) && n == Math.floor(n)) {
    return 'few';
  }
  return 'other';
},"lv":function(n){
  if (n === 0) {
    return 'zero';
  }
  if ((n % 10) == 1 && (n % 100) != 11) {
    return 'one';
  }
  return 'other';
},"mk":function(n){return (n%10)==1&&n!=11?"one":"other"},"ms":function(n){return "other"},"mt":function(n){
  if (n == 1) {
    return 'one';
  }
  if (n === 0 || ((n % 100) >= 2 && (n % 100) <= 4 && n == Math.floor(n))) {
    return 'few';
  }
  if ((n % 100) >= 11 && (n % 100) <= 19 && n == Math.floor(n)) {
    return 'many';
  }
  return 'other';
},"nl":function(n){return n===1?"one":"other"},"no":function(n){return n===1?"one":"other"},"pl":function(n){
  if (n == 1) {
    return 'one';
  }
  if ((n % 10) >= 2 && (n % 10) <= 4 &&
      ((n % 100) < 12 || (n % 100) > 14) && n == Math.floor(n)) {
    return 'few';
  }
  if ((n % 10) === 0 || n != 1 && (n % 10) == 1 ||
      ((n % 10) >= 5 && (n % 10) <= 9 || (n % 100) >= 12 && (n % 100) <= 14) &&
      n == Math.floor(n)) {
    return 'many';
  }
  return 'other';
},"pt":function(n){return n===1?"one":"other"},"ro":function(n){
  if (n == 1) {
    return 'one';
  }
  if (n === 0 || n != 1 && (n % 100) >= 1 &&
      (n % 100) <= 19 && n == Math.floor(n)) {
    return 'few';
  }
  return 'other';
},"ru":function(n){
  if ((n % 10) == 1 && (n % 100) != 11) {
    return 'one';
  }
  if ((n % 10) >= 2 && (n % 10) <= 4 &&
      ((n % 100) < 12 || (n % 100) > 14) && n == Math.floor(n)) {
    return 'few';
  }
  if ((n % 10) === 0 || ((n % 10) >= 5 && (n % 10) <= 9) ||
      ((n % 100) >= 11 && (n % 100) <= 14) && n == Math.floor(n)) {
    return 'many';
  }
  return 'other';
},"sk":function(n){
  if (n == 1) {
    return 'one';
  }
  if (n == 2 || n == 3 || n == 4) {
    return 'few';
  }
  return 'other';
},"sl":function(n){
  if ((n % 100) == 1) {
    return 'one';
  }
  if ((n % 100) == 2) {
    return 'two';
  }
  if ((n % 100) == 3 || (n % 100) == 4) {
    return 'few';
  }
  return 'other';
},"sq":function(n){return n===1?"one":"other"},"sr":function(n){
  if ((n % 10) == 1 && (n % 100) != 11) {
    return 'one';
  }
  if ((n % 10) >= 2 && (n % 10) <= 4 &&
      ((n % 100) < 12 || (n % 100) > 14) && n == Math.floor(n)) {
    return 'few';
  }
  if ((n % 10) === 0 || ((n % 10) >= 5 && (n % 10) <= 9) ||
      ((n % 100) >= 11 && (n % 100) <= 14) && n == Math.floor(n)) {
    return 'many';
  }
  return 'other';
},"sv":function(n){return n===1?"one":"other"},"ta":function(n){return n===1?"one":"other"},"th":function(n){return "other"},"tr":function(n){return n===1?"one":"other"},"uk":function(n){
  if ((n % 10) == 1 && (n % 100) != 11) {
    return 'one';
  }
  if ((n % 10) >= 2 && (n % 10) <= 4 &&
      ((n % 100) < 12 || (n % 100) > 14) && n == Math.floor(n)) {
    return 'few';
  }
  if ((n % 10) === 0 || ((n % 10) >= 5 && (n % 10) <= 9) ||
      ((n % 100) >= 11 && (n % 100) <= 14) && n == Math.floor(n)) {
    return 'many';
  }
  return 'other';
},"ur":function(n){return n===1?"one":"other"},"vi":function(n){return "other"},"zh":function(n){return "other"}},
c:function(d,k){if(!d)throw new Error("MessageFormat: Data required for '"+k+"'.")},
n:function(d,k,o){if(isNaN(d[k]))throw new Error("MessageFormat: '"+k+"' isn't a number.");return d[k]-(o||0)},
v:function(d,k){appLocale.c(d,k);return d[k]},
p:function(d,k,o,l,p){appLocale.c(d,k);return d[k] in p?p[d[k]]:(k=appLocale.lc[l](d[k]-o),k in p?p[k]:p.other)},
s:function(d,k,p){appLocale.c(d,k);return d[k] in p?p[d[k]]:p.other}};
(window.blockly = window.blockly || {}).appLocale = {
"bounceBall":function(d){return "quique a bola"},
"bounceBallTooltip":function(d){return "Quique a bola quando bater no objeto."},
"continue":function(d){return "Continuar"},
"dirE":function(d){return "L"},
"dirN":function(d){return "N"},
"dirS":function(d){return "S"},
"dirW":function(d){return "O"},
"doCode":function(d){return "faça"},
"elseCode":function(d){return "senão"},
"finalLevel":function(d){return "Parabéns! Você resolveu o último desafio."},
"heightParameter":function(d){return "altura"},
"ifCode":function(d){return "se"},
"ifPathAhead":function(d){return "se houver caminho à frente"},
"ifTooltip":function(d){return "Se houver um caminho na direção especificada, realize algumas ações."},
"ifelseTooltip":function(d){return "Se houver um caminho na direção especificada, faça o primeiro bloco de ações. Caso contrário, faça o segundo bloco de ações."},
"incrementOpponentScore":function(d){return "marca o ponto do oponente"},
"incrementOpponentScoreTooltip":function(d){return "Soma um ponto à pontuação atual do jogador."},
"incrementPlayerScore":function(d){return "marque o ponto"},
"incrementPlayerScoreTooltip":function(d){return "Some um ponto à pontuação atual do jogador."},
"isWall":function(d){return "isso é uma parede"},
"isWallTooltip":function(d){return "Retorna verdadeiro se houver uma parede aqui"},
"launchBall":function(d){return "lance uma nova bola"},
"launchBallTooltip":function(d){return "Lança uma bola em jogo."},
"makeYourOwn":function(d){return "Crie seu próprio jogo de pingue-pongue"},
"moveDown":function(d){return "mova para baixo"},
"moveDownTooltip":function(d){return "Move a raquete para baixo."},
"moveForward":function(d){return "avance"},
"moveForwardTooltip":function(d){return "Mova-me um espaço para a frente."},
"moveLeft":function(d){return "mova à esquerda"},
"moveLeftTooltip":function(d){return "Move a raquete à esquerda."},
"moveRight":function(d){return "mova à direita"},
"moveRightTooltip":function(d){return "Move a raquete à direita."},
"moveUp":function(d){return "mova para cima"},
"moveUpTooltip":function(d){return "Move a raquete para cima."},
"nextLevel":function(d){return "Parabéns! Você completou o desafio."},
"no":function(d){return "Não"},
"noPathAhead":function(d){return "o caminho está bloqueado"},
"noPathLeft":function(d){return "Não há caminho à esquerda"},
"noPathRight":function(d){return "Não há caminho à direita"},
"numBlocksNeeded":function(d){return "Este desafio pode ser resolvido com %1 blocos."},
"pathAhead":function(d){return "se houver caminho à frente"},
"pathLeft":function(d){return "se houver caminho à esquerda"},
"pathRight":function(d){return "se houver caminho à direita"},
"pilePresent":function(d){return "houver uma pilha"},
"playSoundCrunch":function(d){return "reproduza barulho de trituração"},
"playSoundGoal1":function(d){return "reproduza som de objetivo alcançado 1"},
"playSoundGoal2":function(d){return "reproduza som de objetivo alcançado 2"},
"playSoundHit":function(d){return "reproduza barulho de pancada"},
"playSoundLosePoint":function(d){return "reproduza som de ponto perdido"},
"playSoundLosePoint2":function(d){return "reproduza som de ponto perdido 2"},
"playSoundRetro":function(d){return "reproduza som retrô"},
"playSoundRubber":function(d){return "reproduza som de borracha"},
"playSoundSlap":function(d){return "reproduza som de palmas"},
"playSoundTooltip":function(d){return "Reproduza o som escolhido."},
"playSoundWinPoint":function(d){return "reproduza som de ponto ganho"},
"playSoundWinPoint2":function(d){return "reproduza som de ponto ganho 2"},
"playSoundWood":function(d){return "reproduza som de madeira"},
"putdownTower":function(d){return "derrube a torre"},
"reinfFeedbackMsg":function(d){return "Você pode pressionar o botão de \"Tentar novamente\" para voltar a jogar o seu jogo."},
"removeSquare":function(d){return "remova o quadrado"},
"repeatUntil":function(d){return "repita até"},
"repeatUntilBlocked":function(d){return "enquanto houver caminho em frente"},
"repeatUntilFinish":function(d){return "repita até terminar"},
"scoreText":function(d){return "Pontuação: "+appLocale.v(d,"playerScore")+" : "+appLocale.v(d,"opponentScore")},
"setBackgroundRandom":function(d){return "defina cenário aleatório"},
"setBackgroundHardcourt":function(d){return "defina o tipo de quadra"},
"setBackgroundRetro":function(d){return "defina cenário retrô"},
"setBackgroundTooltip":function(d){return "Define a imagem do plano de fundo"},
"setBallRandom":function(d){return "defina bola aleatória"},
"setBallHardcourt":function(d){return "defina o tipo de bola"},
"setBallRetro":function(d){return "defina bola retrô"},
"setBallTooltip":function(d){return "Define a imagem da bola"},
"setBallSpeedRandom":function(d){return "defina a velocidade da bola aleatoriamente"},
"setBallSpeedVerySlow":function(d){return "defina a velocidade da bola como muito lenta"},
"setBallSpeedSlow":function(d){return "defina a velocidade da bola como lenta"},
"setBallSpeedNormal":function(d){return "defina a velocidade da bola como normal"},
"setBallSpeedFast":function(d){return "defina a velocidade da bola como rápida"},
"setBallSpeedVeryFast":function(d){return "defina a velocidade da bola como muito rápida"},
"setBallSpeedTooltip":function(d){return "Define a velocidade da bola"},
"setPaddleRandom":function(d){return "defina a raquete aleatoriamente"},
"setPaddleHardcourt":function(d){return "defina raquete para quadras rápidas"},
"setPaddleRetro":function(d){return "defina raquete retrô"},
"setPaddleTooltip":function(d){return "Define a imagem da raquete"},
"setPaddleSpeedRandom":function(d){return "defina a velocidade da raquete aleatoriamente"},
"setPaddleSpeedVerySlow":function(d){return "defina a velocidade da raquete como muito lenta"},
"setPaddleSpeedSlow":function(d){return "defina a velocidade da raquete como lenta"},
"setPaddleSpeedNormal":function(d){return "defina a velocidade da raquete como normal"},
"setPaddleSpeedFast":function(d){return "defina a velocidade da raquete como rápida"},
"setPaddleSpeedVeryFast":function(d){return "defina a velocidade da raquete como muito rápida"},
"setPaddleSpeedTooltip":function(d){return "Define a velocidade da raquete"},
"shareBounceTwitter":function(d){return "Veja o jogo de Pingue-pongue que eu fiz. Eu mesmo programei com a @codeorg"},
"shareGame":function(d){return "Compartilhe seu jogo:"},
"turnLeft":function(d){return "vire à esquerda"},
"turnRight":function(d){return "vire à direita"},
"turnTooltip":function(d){return "Vire 90 graus à esquerda ou à direita."},
"whenBallInGoal":function(d){return "quando a bola chega ao alvo"},
"whenBallInGoalTooltip":function(d){return "Execute as ações abaixo quando uma bola chegar ao objetivo."},
"whenBallMissesPaddle":function(d){return "quando a bola não atinge a raquete"},
"whenBallMissesPaddleTooltip":function(d){return "Execute as ações abaixo quando uma bola não atingir a raquete."},
"whenDown":function(d){return "quando a seta para baixo estiver pressionada"},
"whenDownTooltip":function(d){return "Execute as ações abaixo quando a tecla com a seta para baixo estiver pressionada."},
"whenGameStarts":function(d){return "quando o jogo começa"},
"whenGameStartsTooltip":function(d){return "Execute as ações abaixo quando o jogo começar."},
"whenLeft":function(d){return "quando a seta à esquerda estiver pressionada"},
"whenLeftTooltip":function(d){return "Execute as ações abaixo quando a tecla com a seta à esquerda estiver pressionada."},
"whenPaddleCollided":function(d){return "quando a bola atinge a raquete"},
"whenPaddleCollidedTooltip":function(d){return "Execute as ações abaixo quando uma bola atingir uma raquete."},
"whenRight":function(d){return "quando a seta à direita estiver pressionada"},
"whenRightTooltip":function(d){return "Execute as ações abaixo quando a tecla com a seta à direita estiver pressionada."},
"whenUp":function(d){return "quando a seta para cima estiver pressionada"},
"whenUpTooltip":function(d){return "Execute as ações abaixo quando a tecla com a seta para cima estiver pressionada."},
"whenWallCollided":function(d){return "quando a bola atinge a parede"},
"whenWallCollidedTooltip":function(d){return "Execute as ações abaixo quando uma bola atingir uma parede."},
"whileMsg":function(d){return "enquanto"},
"whileTooltip":function(d){return "Repita as ações até satisfazer a condição."},
"yes":function(d){return "Sim"}};


text:
import re
import logging
import scrapy
from get_all_bip_reports import items
from scrapy.linkextractors import LinkExtractor

DEBUG=False
DEBUG_CNT = 0

class FindReportsSpider(scrapy.Spider):
  name = "find_reports"
  allowed_domains = ["olsztyn.eu"]
  start_urls = (
#    'http://www.olsztyn.eu/',
    'http://www.bip.olsztyn.eu/bip/folder/3098/sesje_rady_miasta/',
  )

  def __init__(self, start=None, start_many=None, *args, **kwargs):
    super(FindReportsSpider, self).__init__(*args, **kwargs)
    if start:
      self.start_urls = [start]
    elif start_many:
      self.start_urls = start_many.split(",")

  def print_links(self, name, links):
    return
    for link in links:
      logging.debug('{} {}[{}]'.format(name, link.text.encode('utf8'), link.url))

  KADENCJA_RE = re.compile(r'http://www.bip.olsztyn.eu/bip/folder/\d+/kadencja_\d+_\d+/.*')
  SESJA_RE = re.compile(r'http://www.bip.olsztyn.eu/bip/dokument/\d+/.*_sesja_rady_miasta_.*/')
  UCHWALA_RE=re.compile(r'http://www.bip.olsztyn.eu/bip/dokument/\d+/.*')
  PLIK_RE = re.compile(r'http://www.bip.olsztyn.eu/bip/plik/\d+/.*')

  def parse_kadencja(self, response):
#    'LIX Sesja Rady Miasta 24 września 2014 r.'
#    'http://www.bip.olsztyn.eu/bip/dokument/305103/lix_sesja_rady_miasta_24_wrzesnia_2014_r_/'
    le = LinkExtractor(allow=FindReportsSpider.SESJA_RE)
    links = le.extract_links(response)
    self.print_links('sesje', links)
    cnt = 0
    for link in links:
      yield scrapy.Request(link.url, callback=self.parse_sesja)
      k = items.PageItem()
      k['text'] = link.text.encode('utf8')
      k['url'] = link.url
      k['ref'] = response.url
      k['order'] = cnt
      yield k
      if cnt >= DEBUG_CNT and DEBUG:
        break
      cnt += 1

  def parse_uchwala(self, response):
    # generate list of files to download
    le = LinkExtractor(allow=FindReportsSpider.PLIK_RE)
    links = le.extract_links(response)
    self.print_links('files', links)
    cnt = 0
    for link in links:
      fi = items.FiledownloadItem()
      fi['file_urls'] = [link.url]
      fi['text'] = link.text.encode('utf8')
      fi['url'] = link.url
      fi['ref'] = response.url
      fi['order'] = cnt
      yield fi
      if cnt >= DEBUG_CNT and DEBUG:
        break
      cnt += 1

  def parse_sesja(self, response):
    # uchwaly
    uchwaly_le = LinkExtractor(
         allow=FindReportsSpider.UCHWALA_RE,
         restrict_xpaths='//table')
    links = uchwaly_le.extract_links(response)
    self.print_links('uchwaly', links)
    cnt = 0
    for link in links:
      yield scrapy.Request(link.url, callback=self.parse_uchwala)
      k = items.PageItem()
      k['text'] = link.text.encode('utf8')
      k['url'] = link.url
      k['ref'] = response.url
      k['order'] = cnt
      yield k
      if cnt >= DEBUG_CNT and DEBUG:
        break
      cnt += 1

    # files (glosowania, obecnosc)
    le = LinkExtractor(allow=FindReportsSpider.PLIK_RE)
    links = le.extract_links(response)
    self.print_links('glosowania', links)
    cnt = 0
    for link in links:
      fi = items.FiledownloadItem()
      fi['file_urls'] = [link.url]
      fi['text'] = link.text.encode('utf8')
      fi['url'] = link.url
      fi['ref'] = response.url
      fi['order'] = cnt
      yield fi
      if cnt >= DEBUG_CNT and DEBUG:
        break
      cnt += 1

  def parse_main(self, response):
    le = LinkExtractor(allow=KADENCJA_RE)
    links = le.extract_links(response)
    self.print_links('kadencje', links)
    cnt = 0

    for link in links:
      yield scrapy.Request(link.url, callback=self.parse_kadencja)
      k = items.PageItem()
      k['text'] = link.text.encode('utf8')
      k['url'] = link.url
      k['ref'] = response.url
      k['order'] = cnt
      yield k
      if cnt >= DEBUG_CNT and DEBUG:
        break
      cnt += 1

  def find_document_name(self, response):
    '''
Rejestr zmian

                    Nazwa dokumentu:
                    XI Sesja Rady Miasta 24 czerwca 2015 r.

'''
    name = response.selector.css('.change-log-container').xpath('.//td/text()')
    if name:
      return name[0].extract()
    return response.selector.xpath('//title/text()')[0].extract()

  def parse(self, response):
    k = items.PageItem()
    k['text'] = self.find_document_name(response)
    k['url'] = response.url
    k['ref'] = '<entry point>'
    f = None
    if response.url == 'http://www.bip.olsztyn.eu/bip/folder/3098/sesje_rady_miasta/':
      f = self.parse_main
      k['text'] = 'Sesje Rady Miasta'
    elif FindReportsSpider.KADENCJA_RE.match(response.url):
      f = self.parse_kadencja
    elif FindReportsSpider.SESJA_RE.match(response.url):
      f = self.parse_sesja
    elif FindReportsSpider.UCHWALA_RE.match(response.url):
      f = self.parse_uchwala
    else:
      logging.warning('don\'t recognize url: {}', response.url)
      return

    yield k

    for y in f(response):
      yield y


text:
#define EditView 1
#define VarsField 2
#define ExprField 3
#define EvalButton 4
#define ResultField 5
#define ListView 6
#define NewButton 8
#define MemoCalc 9
#define AppVersion 1000
#define ExprTable 11
#define UpButton 12
#define DownButton 13
#define DoneButton 14
#define ListViewMenu 15
#define EditViewMenu 16
#define Pulldown17 17
#define ListViewRecordNewMenu 18
#define ListViewRecordDeleteMenu 19
#define Pulldown20 20
#define ListViewOptionsAboutMenu 21
#define Pulldown22 22
#define EditViewEditCutMenu 23
#define EditViewEditCopyMenu 24
#define EditViewEditPasteMenu 25
#define Pulldown26 26
#define EditViewOptionsAboutMenu 27
#define AboutDialog 28
#define MemoCalc01bpp 29
#define AboutLabel 30
#define AboutOkButton 31
#define MemoCalcHelpString 32
#define B0 33
#define B1 34
#define B2 35
#define B3 36
#define B4 37
#define B5 38
#define B6 39
#define B7 40
#define B8 41
#define B9 42
#define Bdot 43
#define Bpls 44
#define Bmin 45
#define Btim 46
#define Bdiv 47
#define Bexp 48
#define Bopn 49
#define Bcls 50
#define ListViewRecordQuitMenu 51
#define VarsList 52
#define FunctionsTrigger 53
#define FunctionsList 54
#define ExprScrollBar 55
#define Bdel 56
#define Bclr 57
#define VarsLabel 58
#define EditViewEditSeparator 59
#define EditViewEditSelectAllMenu 60
#define EditViewEditUndoMenu 61
#define Pulldown62 62
#define EditViewRecordNewMenu 64
#define EditViewRecordDeleteMenu 65
#define EditViewRecordDiscardMenu 66
#define VarsButton 67
#define VarsScrollBar 68
#define Bequ 69
#define EditViewRecordOpenMenu 70
#define EditViewRecordEditMenu 71
#define TitleSeparator 72
#define RecTitleSeparator 73
#define MemoView 74
#define MemoViewOkButton 76
#define MemoViewEditField 77
#define MemoViewScrollBar 78
#define EditViewEditKeyboardMenu 79
#define EditViewOptionsHexMenu 1001
#define EditViewOptionsDecMenu 1002


text:
package com.jackie.loader.impl;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import com.jackie.loader.CloseUtils;
import com.jackie.loader.ImageCache;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

/**
 * 对{@link ImageCache}的实现类,把网络路径对应的图片缓存到本地存储器当中
 * Created by on 16/5/19.
 *
 * @author Jackie Zhu
 * @version 1.0
 */
public class DiskCache implements ImageCache {
    String cacheDir = "/sdcard/picture/";

    @Override
    public Bitmap put(String url, Bitmap bitmap) {
        int index = url.lastIndexOf(File.separator);
        String name = url.substring(index + 1);
        FileOutputStream fileOutputStream = null;
        try {
            fileOutputStream = new FileOutputStream(cacheDir + url);
            bitmap.compress(Bitmap.CompressFormat.PNG, 100, fileOutputStream);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } finally {
            CloseUtils.closeQuietly(fileOutputStream);
        }
        return bitmap;
    }

    @Override
    public Bitmap get(String url) {
        Bitmap result = null;
        FileInputStream fileInputStream = null;
        try {
            fileInputStream = new FileInputStream(cacheDir + url);
            result = BitmapFactory.decodeStream(fileInputStream);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } finally {
            CloseUtils.closeQuietly(fileInputStream);
        }
        return result;
    }
}


text:
using ShoppingCart.Models;
using System.Threading.Tasks;

namespace ShoppingCart.Services
{
    public interface ILoginService
    {
        Task<bool> IsLoggedIn();

        Task<User> LoginAsync(string username, string password);

        Task LogOutAsync();
    }
}


text:
var scaffold = require('<scaffold>');
var controller_t = require('./controller_t.js');
var events = require('../../models/events/events.js');
var models = require('../../models/models.js');

var input_t = function input_t(observee, node)
{
	var input;

	scaffold.check(arguments.length === 2);
	scaffold.check.type(observee, models.string_t);
	scaffold.check.type(node, global.Node);

	this.observee = observee;
	this.node = node;

	controller_t.call(this);

	input = function (event)
	{
		observee.set(node.value);
	};

	node.addEventListener('input', input);

	observee.on('change', this.change.bind(this));

	this.change(new events.change_t(observee, observee));
};

scaffold.types.extend(input_t, controller_t);

input_t.prototype.change = function (event)
{
	var json;

	scaffold.check(arguments.length === 1);
	scaffold.check.type(event, events.change_t);

	json = this.observee.json();

	this.node.setAttribute('value', json);
	this.node.value = json;
};

module.exports = input_t;


text:
const axios = require('axios');
const resource = {
  text: 'Systemd - ArchWiki',
  url: 'https://wiki.archlinux.org/index.php/systemd',
  category: 'wiki',
  parentID: 4696,
};

axios.post(
  'https://learn-anything.xyz/api/resources/',
  resource,
  {
    headers: {
      Authorization: `Bearer ${access_token}`
    }
  }
).then(({ status, data }) => {
  console.log(status, data);
});


text:
<!DOCTYPE html>

    <title>Motivation</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.3/normalize.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.css">
    <link href="../styles/main.css" rel="stylesheet" type="text/css">

About Me

Projects

Contact Me

Motivation

How does life look through the "Pleasure, Passion and Purpose" lens?

Life through the Pleasure lens, happiness comes in short bursts. This is sadly the form of happiness that most people seek. It is
      the kind of happiness that is unsustainable. Passion is more sustainable then Pleasure as a form of happiness, and is often called 'the flow.' It's when you get satisfaction from the job, and time just flies by. You get lost in your work, so much to the point where it becomes your only focus and you gain satisfactoin from completing it. The final form of happiness - Purpose, is the most sustainable form of happiness. It's the form we should all be striving for. It's when Happiness comes from knowing that what you are doing is bigger then yourself. It's knowing that you are making a difference, and you love where you are in life, work, and your inner self.

From the 'discovering values and higher purpose exercise, what are your core values?

My Core Values are probably Kindness, Friendship, Goodwill, and Assistance. I like to help others, I get along with anyone and everyone. I'm friendly and kind, and like to look for ways to help and assist others.

From the 'discovering values and higher purpose exercise, what do you stand for?

I stand for Freedom, Fairness, Justice, Goodwill to all, Equality, and Peace. I just want the best for the world and everyone and thing on it.

How did you find the resilience ideas and meditation exercise?

I found the exercise and ideas very helpful. I've really gotten into meditating, especially with the headspace app that we were introduced to. I've managed to do it every morning and I find it wakes me up and prepares me for the new day.

Any other musings?

A good chapter, and really enjoying 'Search Inside Yourself.' Ideas, studies and information from the book are things you never really think about. You often take all these things for granted and don't ever question what drives you, or why you are the way you are. This book is very enlightening.

Back


text:
/*
 * Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
 * other than GPL or LGPL is available it will apply instead, Oracle elects to use only
 * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
 * a choice of LGPL license versions is made available with the language indicating
 * that LGPLv2 or any later version may be used, or where a choice of which version
 * of the LGPL is applied is otherwise unspecified.
 */

#ifndef __WINE_WINE_WINGDI16_H
#define __WINE_WINE_WINGDI16_H

#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <wingdi.h>
#include <wine/winbase16.h>

#include <pshpack1.h>

typedef HANDLE16 HPQ16;
typedef HANDLE16 HPJOB16;

typedef struct
{
    WORD   wFirst;
    WORD   wSecond;
    INT16  iKernAmount;
} KERNINGPAIR16, *LPKERNINGPAIR16;

typedef struct
{
    INT16  bmType;
    INT16  bmWidth;
    INT16  bmHeight;
    INT16  bmWidthBytes;
    BYTE   bmPlanes;
    BYTE   bmBitsPixel;
    SEGPTR bmBits;
} BITMAP16, *LPBITMAP16;

typedef struct
{
    UINT16     lbStyle;
    COLORREF   lbColor;
    INT16      lbHatch;
} LOGBRUSH16, *LPLOGBRUSH16;

typedef struct
{
    INT16  lfHeight;
    INT16  lfWidth;
    INT16  lfEscapement;
    INT16  lfOrientation;
    INT16  lfWeight;
    BYTE   lfItalic;
    BYTE   lfUnderline;
    BYTE   lfStrikeOut;
    BYTE   lfCharSet;
    BYTE   lfOutPrecision;
    BYTE   lfClipPrecision;
    BYTE   lfQuality;
    BYTE   lfPitchAndFamily;
    CHAR   lfFaceName[LF_FACESIZE];
} LOGFONT16, *LPLOGFONT16;

typedef struct
{
  LOGFONT16  elfLogFont;
  BYTE       elfFullName[LF_FULLFACESIZE];
  BYTE       elfStyle[LF_FACESIZE];
} ENUMLOGFONT16, *LPENUMLOGFONT16;

typedef struct
{
  LOGFONT16  elfLogFont;
  BYTE       elfFullName[LF_FULLFACESIZE];
  BYTE       elfStyle[LF_FACESIZE];
  BYTE       elfScript[LF_FACESIZE];
} ENUMLOGFONTEX16, *LPENUMLOGFONTEX16;

typedef struct
{
    INT16  txfHeight;
    INT16  txfWidth;
    INT16  txfEscapement;
    INT16  txfOrientation;
    INT16  txfWeight;
    CHAR   txfItalic;
    CHAR   txfUnderline;
    CHAR   txfStrikeOut;
    CHAR   txfOutPrecision;
    CHAR   txfClipPrecision;
    INT16  txfAccelerator;
    INT16  txfOverhang;
} TEXTXFORM16, *LPTEXTXFORM16;

typedef struct
{
    INT16 dfType;
    INT16 dfPoints;
    INT16 dfVertRes;
    INT16 dfHorizRes;
    INT16 dfAscent;
    INT16 dfInternalLeading;
    INT16 dfExternalLeading;
    CHAR  dfItalic;
    CHAR  dfUnderline;
    CHAR  dfStrikeOut;
    INT16 dfWeight;
    BYTE  dfCharSet;
    INT16 dfPixWidth;
    INT16 dfPixHeight;
    CHAR  dfPitchAndFamily;
    INT16 dfAvgWidth;
    INT16 dfMaxWidth;
    CHAR  dfFirstChar;
    CHAR  dfLastChar;
    CHAR  dfDefaultChar;
    CHAR  dfBreakChar;
    INT16 dfWidthBytes;
    LONG  dfDevice;
    LONG  dfFace;
    LONG  dfBitsPointer;
    LONG  dfBitsOffset;
    CHAR  dfReserved;
    /* Fields, introduced for Windows 3.x fonts */
    LONG  dfFlags;
    INT16 dfAspace;
    INT16 dfBspace;
    INT16 dfCspace;
    LONG  dfColorPointer;
    LONG  dfReserved1[4];
} FONTINFO16, *LPFONTINFO16;

typedef struct {
    WORD   dfVersion;
    DWORD  dfSize;
    CHAR   dfCopyright[60];
    WORD   dfType;
    WORD   dfPoints;
    WORD   dfVertRes;
    WORD   dfHorizRes;
    WORD   dfAscent;
    WORD   dfInternalLeading;
    WORD   dfExternalLeading;
    BYTE   dfItalic;
    BYTE   dfUnderline;
    BYTE   dfStrikeOut;
    WORD   dfWeight;
    BYTE   dfCharSet;
    WORD   dfPixWidth;
    WORD   dfPixHeight;
    BYTE   dfPitchAndFamily;
    WORD   dfAvgWidth;
    WORD   dfMaxWidth;
    BYTE   dfFirstChar;
    BYTE   dfLastChar;
    BYTE   dfDefaultChar;
    BYTE   dfBreakChar;
    WORD   dfWidthBytes;
    DWORD  dfDevice;
    DWORD  dfFace;
    DWORD  dfReserved;
    CHAR   szDeviceName[60]; /* FIXME: length unknown */
    CHAR   szFaceName[60];   /* ditto */
} FONTDIR16, *LPFONTDIR16;

typedef struct
{
    INT16     tmHeight;
    INT16     tmAscent;
    INT16     tmDescent;
    INT16     tmInternalLeading;
    INT16     tmExternalLeading;
    INT16     tmAveCharWidth;
    INT16     tmMaxCharWidth;
    INT16     tmWeight;
    BYTE      tmItalic;
    BYTE      tmUnderlined;
    BYTE      tmStruckOut;
    BYTE      tmFirstChar;
    BYTE      tmLastChar;
    BYTE      tmDefaultChar;
    BYTE      tmBreakChar;
    BYTE      tmPitchAndFamily;
    BYTE      tmCharSet;
    INT16     tmOverhang;
    INT16     tmDigitizedAspectX;
    INT16     tmDigitizedAspectY;
} TEXTMETRIC16, *LPTEXTMETRIC16;

typedef struct _OUTLINETEXTMETRIC16
{
    UINT16          otmSize;
    TEXTMETRIC16    otmTextMetrics;
    BYTE            otmFiller;
    PANOSE          otmPanoseNumber;
    UINT16          otmfsSelection;
    UINT16          otmfsType;
    INT16           otmsCharSlopeRise;
    INT16           otmsCharSlopeRun;
    INT16           otmItalicAngle;
    UINT16          otmEMSquare;
    INT16           otmAscent;
    INT16           otmDescent;
    UINT16          otmLineGap;
    UINT16          otmsCapEmHeight;
    UINT16          otmsXHeight;
    RECT16          otmrcFontBox;
    INT16           otmMacAscent;
    INT16           otmMacDescent;
    UINT16          otmMacLineGap;
    UINT16          otmusMinimumPPEM;
    POINT16         otmptSubscriptSize;
    POINT16         otmptSubscriptOffset;
    POINT16         otmptSuperscriptSize;
    POINT16         otmptSuperscriptOffset;
    UINT16          otmsStrikeoutSize;
    INT16           otmsStrikeoutPosition;
    INT16           otmsUnderscoreSize;
    INT           otmsUnderscorePosition;
    LPSTR           otmpFamilyName;
    LPSTR           otmpFaceName;
    LPSTR           otmpStyleName;
    LPSTR           otmpFullName;
} OUTLINETEXTMETRIC16,*LPOUTLINETEXTMETRIC16;

typedef struct
{
    INT16     tmHeight;
    INT16     tmAscent;
    INT16     tmDescent;
    INT16     tmInternalLeading;
    INT16     tmExternalLeading;
    INT16     tmAveCharWidth;
    INT16     tmMaxCharWidth;
    INT16     tmWeight;
    BYTE      tmItalic;
    BYTE      tmUnderlined;
    BYTE      tmStruckOut;
    BYTE      tmFirstChar;
    BYTE      tmLastChar;
    BYTE      tmDefaultChar;
    BYTE      tmBreakChar;
    BYTE      tmPitchAndFamily;
    BYTE      tmCharSet;
    INT16     tmOverhang;
    INT16     tmDigitizedAspectX;
    INT16     tmDigitizedAspectY;
    DWORD     ntmFlags;
    UINT16    ntmSizeEM;
    UINT16    ntmCellHeight;
    UINT16    ntmAvgWidth;
} NEWTEXTMETRIC16,*LPNEWTEXTMETRIC16;

typedef struct
{
    NEWTEXTMETRIC16	ntmTm;
    FONTSIGNATURE       ntmFontSig;
} NEWTEXTMETRICEX16,*LPNEWTEXTMETRICEX16;

typedef INT16 (CALLBACK *FONTENUMPROC16)(SEGPTR,SEGPTR,UINT16,LPARAM);
typedef VOID  (CALLBACK *LINEDDAPROC16)(INT16,INT16,LPARAM);
typedef INT16 (CALLBACK *GOBJENUMPROC16)(SEGPTR,LPARAM);

typedef struct
{
    UINT16	gmBlackBoxX;
    UINT16	gmBlackBoxY;
    POINT16	gmptGlyphOrigin;
    INT16	gmCellIncX;
    INT16	gmCellIncY;
} GLYPHMETRICS16, *LPGLYPHMETRICS16;

typedef struct
{
    INT16   abcA;
    UINT16  abcB;
    INT16   abcC;
} ABC16, *LPABC16;

typedef struct
{
    UINT16   lopnStyle;
    POINT16  lopnWidth;
    COLORREF lopnColor;
} LOGPEN16, *LPLOGPEN16;

typedef struct
{
    HGDIOBJ16 objectHandle[1];
} HANDLETABLE16, *LPHANDLETABLE16;

typedef struct
{
    INT16        mm;
    INT16        xExt;
    INT16        yExt;
    HMETAFILE16  hMF;
} METAFILEPICT16, *LPMETAFILEPICT16;

typedef INT16 (CALLBACK *MFENUMPROC16)(HDC16,HANDLETABLE16*,METARECORD*,
                                       INT16,LPARAM);
typedef struct
{
    INT16    cbSize;
    SEGPTR   lpszDocName;
    SEGPTR   lpszOutput;
    SEGPTR   lpszDatatype;
    DWORD    fwType;
} DOCINFO16, *LPDOCINFO16;

typedef BOOL16 (CALLBACK *ABORTPROC16)(HDC16, INT16);

#define INT_PD_DEFAULT_DEVMODE  1
#define INT_PD_DEFAULT_MODEL    2

/* Escape: CLIP_TO_PATH modes */
#define CLIP_SAVE 0
#define CLIP_RESTORE 1
#define CLIP_INCLUSIVE 2
#define CLIP_EXCLUSIVE 3

/* Escape: END_PATH info */
struct PATH_INFO {
    short RenderMode;
    BYTE FillMode;
    BYTE BkMode;
    LOGPEN16 Pen;
    LOGBRUSH16 Brush;
    DWORD BkColor;
};

/* RenderMode */
#define RENDERMODE_NO_DISPLAY 0
#define RENDERMODE_OPEN 1
#define RENDERMODE_CLOSED 2

/* For DRAWPATTERNRECT Escape, 16bit mode */
typedef struct _DRAWPATRECT16
{
    POINT16	ptPosition;
    POINT16	ptSize;
    WORD	wStyle;
    WORD	wPattern;
} DRAWPATRECT16, *PDRAWPATRECT16;

#include <poppack.h>

INT16       WINAPI AbortDoc16(HDC16);
BOOL16      WINAPI AbortPath16(HDC16);
INT16       WINAPI AddFontResource16(LPCSTR);
void        WINAPI AnimatePalette16(HPALETTE16,UINT16,UINT16,const PALETTEENTRY*);
BOOL16      WINAPI Arc16(HDC16,INT16,INT16,INT16,INT16,INT16,INT16,INT16,INT16);
BOOL16      WINAPI BeginPath16(HDC16);
BOOL16      WINAPI BitBlt16(HDC16,INT16,INT16,INT16,INT16,HDC16,INT16,INT16,DWORD);
BOOL16      WINAPI Chord16(HDC16,INT16,INT16,INT16,INT16,INT16,INT16,INT16,INT16);
BOOL16      WINAPI CloseFigure16(HDC16);
INT16       WINAPI CloseJob16(HPJOB16);
HMETAFILE16 WINAPI CloseMetaFile16(HDC16);
INT16       WINAPI CombineRgn16(HRGN16,HRGN16,HRGN16,INT16);
HMETAFILE16 WINAPI CopyMetaFile16(HMETAFILE16,LPCSTR);
HBITMAP16   WINAPI CreateBitmap16(INT16,INT16,UINT16,UINT16,LPCVOID);
HBITMAP16   WINAPI CreateBitmapIndirect16(const BITMAP16*);
HBRUSH16    WINAPI CreateBrushIndirect16(const LOGBRUSH16*);
HBITMAP16   WINAPI CreateCompatibleBitmap16(HDC16,INT16,INT16);
HDC16       WINAPI CreateCompatibleDC16(HDC16);
HDC16       WINAPI CreateDC16(LPCSTR,LPCSTR,LPCSTR,const DEVMODEA*);
HBITMAP16   WINAPI CreateDIBitmap16(HDC16,const BITMAPINFOHEADER*,DWORD,
                                    LPCVOID,const BITMAPINFO*,UINT16);
HBRUSH16    WINAPI CreateDIBPatternBrush16(HGLOBAL16,UINT16);
HBITMAP16   WINAPI CreateDIBSection16 (HDC16, const BITMAPINFO *, UINT16,
				       SEGPTR *, HANDLE, DWORD offset);
HBITMAP16   WINAPI CreateDiscardableBitmap16(HDC16,INT16,INT16);
HRGN16      WINAPI CreateEllipticRgn16(INT16,INT16,INT16,INT16);
HRGN16      WINAPI CreateEllipticRgnIndirect16(const RECT16 *);
HFONT16     WINAPI CreateFont16(INT16,INT16,INT16,INT16,INT16,BYTE,BYTE,BYTE,
                                BYTE,BYTE,BYTE,BYTE,BYTE,LPCSTR);
HFONT16     WINAPI CreateFontIndirect16(const LOGFONT16*);
HPALETTE16  WINAPI CreateHalftonePalette16(HDC16);
HBRUSH16    WINAPI CreateHatchBrush16(INT16,COLORREF);
HDC16       WINAPI CreateIC16(LPCSTR,LPCSTR,LPCSTR,const DEVMODEA*);
HDC16       WINAPI CreateMetaFile16(LPCSTR);
HPALETTE16  WINAPI CreatePalette16(const LOGPALETTE*);
HBRUSH16    WINAPI CreatePatternBrush16(HBITMAP16);
HPEN16      WINAPI CreatePen16(INT16,INT16,COLORREF);
HPEN16      WINAPI CreatePenIndirect16(const LOGPEN16*);
HRGN16      WINAPI CreatePolyPolygonRgn16(const POINT16*,const INT16*,INT16,INT16);
HRGN16      WINAPI CreatePolygonRgn16(const POINT16*,INT16,INT16);
HRGN16      WINAPI CreateRectRgn16(INT16,INT16,INT16,INT16);
HRGN16      WINAPI CreateRectRgnIndirect16(const RECT16*);
HRGN16      WINAPI CreateRoundRectRgn16(INT16,INT16,INT16,INT16,INT16,INT16);
BOOL16      WINAPI CreateScalableFontResource16(UINT16,LPCSTR,LPCSTR,LPCSTR);
HBRUSH16    WINAPI CreateSolidBrush16(COLORREF);
VOID        WINAPI Death16(HDC16);
BOOL16      WINAPI DeleteDC16(HDC16);
INT16       WINAPI DeleteJob16(HPJOB16,INT16);
BOOL16      WINAPI DeleteMetaFile16(HMETAFILE16);
BOOL16      WINAPI DeleteObject16(HGDIOBJ16);
BOOL16      WINAPI DPtoLP16(HDC16,LPPOINT16,INT16);
DWORD       WINAPI DrvGetPrinterData16(LPSTR,LPSTR,LPDWORD,LPBYTE,int cbData,LPDWORD);
DWORD       WINAPI DrvSetPrinterData16(LPSTR,LPSTR,DWORD,LPBYTE,DWORD);
BOOL16      WINAPI Ellipse16(HDC16,INT16,INT16,INT16,INT16);
INT16       WINAPI EndDoc16(HDC16);
INT16       WINAPI EndPage16(HDC16);
BOOL16      WINAPI EndPath16(HDC16);
INT16       WINAPI EndSpoolPage16(HPJOB16);
INT16       WINAPI EnumFontFamilies16(HDC16,LPCSTR,FONTENUMPROC16,LPARAM);
INT16       WINAPI EnumFontFamiliesEx16(HDC16,LPLOGFONT16,FONTENUMPROC16,LPARAM,DWORD);
INT16       WINAPI EnumFonts16(HDC16,LPCSTR,FONTENUMPROC16,LPARAM);
BOOL16      WINAPI EnumMetaFile16(HDC16,HMETAFILE16,MFENUMPROC16,LPARAM);
INT16       WINAPI EnumObjects16(HDC16,INT16,GOBJENUMPROC16,LPARAM);
BOOL16      WINAPI EqualRgn16(HRGN16,HRGN16);
INT16       WINAPI Escape16(HDC16,INT16,INT16,SEGPTR,LPVOID);
INT16       WINAPI ExcludeClipRect16(HDC16,INT16,INT16,INT16,INT16);
INT16       WINAPI ExcludeVisRect16(HDC16,INT16,INT16,INT16,INT16);
HPEN16      WINAPI ExtCreatePen16(DWORD,DWORD,const LOGBRUSH16*,DWORD,const DWORD*);
BOOL16      WINAPI ExtFloodFill16(HDC16,INT16,INT16,COLORREF,UINT16);
BOOL16      WINAPI ExtTextOut16(HDC16,INT16,INT16,UINT16,const RECT16*,
                                LPCSTR,UINT16,const INT16*);
BOOL16      WINAPI FastWindowFrame16(HDC16,const RECT16*,INT16,INT16,DWORD);
BOOL16      WINAPI FillPath16(HDC16);
BOOL16      WINAPI FillRgn16(HDC16,HRGN16,HBRUSH16);
BOOL16      WINAPI FlattenPath16(HDC16);
BOOL16      WINAPI FloodFill16(HDC16,INT16,INT16,COLORREF);
BOOL16      WINAPI FrameRgn16(HDC16,HRGN16,HBRUSH16,INT16,INT16);
UINT16      WINAPI GDIRealizePalette16(HDC16);
DWORD       WINAPI GdiSeeGdiDo16(WORD,WORD,WORD,WORD);
HPALETTE16  WINAPI GDISelectPalette16(HDC16,HPALETTE16,WORD);
INT16       WINAPI GetArcDirection16(HDC16);
BOOL16      WINAPI GetAspectRatioFilterEx16(HDC16,LPSIZE16);
LONG        WINAPI GetBitmapBits16(HBITMAP16,LONG,LPVOID);
DWORD       WINAPI GetBitmapDimension16(HBITMAP16);
BOOL16      WINAPI GetBitmapDimensionEx16(HBITMAP16,LPSIZE16);
DWORD       WINAPI GetBrushOrg16(HDC16);
BOOL16      WINAPI GetBrushOrgEx16(HDC16,LPPOINT16);
COLORREF    WINAPI GetBkColor16(HDC16);
INT16       WINAPI GetBkMode16(HDC16);
UINT16      WINAPI GetBoundsRect16(HDC16,LPRECT16,UINT16);
BOOL16      WINAPI GetCharABCWidths16(HDC16,UINT16,UINT16,LPABC16);
BOOL16      WINAPI GetCharWidth16(HDC16,UINT16,UINT16,LPINT16);
INT16       WINAPI GetClipBox16(HDC16,LPRECT16);
HRGN16      WINAPI GetClipRgn16(HDC16);
HFONT16     WINAPI GetCurLogFont16(HDC16);
DWORD       WINAPI GetCurrentPosition16(HDC16);
BOOL16      WINAPI GetCurrentPositionEx16(HDC16,LPPOINT16);
DWORD       WINAPI GetDCHook16(HDC16,FARPROC16*);
DWORD       WINAPI GetDCOrg16(HDC16);
HDC16       WINAPI GetDCState16(HDC16);
INT16       WINAPI GetDeviceCaps16(HDC16,INT16);
UINT16      WINAPI GetDIBColorTable16(HDC16,UINT16,UINT16,RGBQUAD*);
INT16       WINAPI GetDIBits16(HDC16,HBITMAP16,UINT16,UINT16,LPVOID,LPBITMAPINFO,UINT16);
INT16       WINAPI GetEnvironment16(LPCSTR,LPDEVMODEA,UINT16);
DWORD       WINAPI GetFontData16(HDC16,DWORD,DWORD,LPVOID,DWORD);
DWORD       WINAPI GetFontLanguageInfo16(HDC16);
DWORD       WINAPI GetGlyphOutline16(HDC16,UINT16,UINT16,LPGLYPHMETRICS16,DWORD,LPVOID,const MAT2*);
INT16       WINAPI GetKerningPairs16(HDC16,INT16,LPKERNINGPAIR16);
INT16       WINAPI GetMapMode16(HDC16);
HMETAFILE16 WINAPI GetMetaFile16(LPCSTR);
HGLOBAL16   WINAPI GetMetaFileBits16(HMETAFILE16);
DWORD       WINAPI GetNearestColor16(HDC16,DWORD);
UINT16      WINAPI GetNearestPaletteIndex16(HPALETTE16,COLORREF);
INT16       WINAPI GetObject16(HANDLE16,INT16,LPVOID);
UINT16      WINAPI GetOutlineTextMetrics16(HDC16,UINT16,LPOUTLINETEXTMETRIC16);
UINT16      WINAPI GetPaletteEntries16(HPALETTE16,UINT16,UINT16,LPPALETTEENTRY);
INT16       WINAPI GetPath16(HDC16,LPPOINT16,LPBYTE,INT16);
COLORREF    WINAPI GetPixel16(HDC16,INT16,INT16);
INT16       WINAPI GetPolyFillMode16(HDC16);
BOOL16      WINAPI GetRasterizerCaps16(LPRASTERIZER_STATUS,UINT16);
DWORD       WINAPI GetRegionData16(HRGN16,DWORD,LPRGNDATA);
INT16       WINAPI GetRelAbs16(HDC16);
INT16       WINAPI GetRgnBox16(HRGN16,LPRECT16);
INT16       WINAPI GetROP216(HDC16);
DWORD       WINAPI GetSpoolJob16(int,LONG);
HGDIOBJ16   WINAPI GetStockObject16(INT16);
INT16       WINAPI GetStretchBltMode16(HDC16);
UINT16      WINAPI GetSystemPaletteEntries16(HDC16,UINT16,UINT16,LPPALETTEENTRY);
UINT16      WINAPI GetSystemPaletteUse16(HDC16);
UINT16      WINAPI GetTextAlign16(HDC16);
INT16       WINAPI GetTextCharacterExtra16(HDC16);
UINT16      WINAPI GetTextCharset16(HDC16);
COLORREF    WINAPI GetTextColor16(HDC16);
DWORD       WINAPI GetTextExtent16(HDC16,LPCSTR,INT16);
BOOL16      WINAPI GetTextExtentPoint16(HDC16,LPCSTR,INT16,LPSIZE16);
INT16       WINAPI GetTextFace16(HDC16,INT16,LPSTR);
BOOL16      WINAPI GetTextMetrics16(HDC16,LPTEXTMETRIC16);
DWORD       WINAPI GetViewportExt16(HDC16);
BOOL16      WINAPI GetViewportExtEx16(HDC16,LPSIZE16);
BOOL16      WINAPI GetViewportOrgEx16(HDC16,LPPOINT16);
DWORD       WINAPI GetViewportOrg16(HDC16);
DWORD       WINAPI GetWindowExt16(HDC16);
DWORD       WINAPI GetWindowOrg16(HDC16);
BOOL16      WINAPI GetWindowExtEx16(HDC16,LPSIZE16);
BOOL16      WINAPI GetWindowOrgEx16(HDC16,LPPOINT16);
HRGN16      WINAPI InquireVisRgn16(HDC16);
INT16       WINAPI IntersectClipRect16(HDC16,INT16,INT16,INT16,INT16);
INT16       WINAPI IntersectVisRect16(HDC16,INT16,INT16,INT16,INT16);
BOOL16      WINAPI InvertRgn16(HDC16,HRGN16);
BOOL16      WINAPI IsDCCurrentPalette16(HDC16);
BOOL16      WINAPI IsGDIObject16(HGDIOBJ16);
BOOL16      WINAPI IsValidMetaFile16(HMETAFILE16);
VOID        WINAPI LineDDA16(INT16,INT16,INT16,INT16,LINEDDAPROC16,LPARAM);
BOOL16      WINAPI LineTo16(HDC16,INT16,INT16);
BOOL16      WINAPI LPtoDP16(HDC16,LPPOINT16,INT16);
DWORD       WINAPI MoveTo16(HDC16,INT16,INT16);
BOOL16      WINAPI MoveToEx16(HDC16,INT16,INT16,LPPOINT16);
INT16       WINAPI MulDiv16(INT16,INT16,INT16);
INT16       WINAPI OffsetClipRgn16(HDC16,INT16,INT16);
INT16       WINAPI OffsetRgn16(HRGN16,INT16,INT16);
DWORD       WINAPI OffsetViewportOrg16(HDC16,INT16,INT16);
BOOL16      WINAPI OffsetViewportOrgEx16(HDC16,INT16,INT16,LPPOINT16);
INT16       WINAPI OffsetVisRgn16(HDC16,INT16,INT16);
DWORD       WINAPI OffsetWindowOrg16(HDC16,INT16,INT16);
BOOL16      WINAPI OffsetWindowOrgEx16(HDC16,INT16,INT16,LPPOINT16);
HANDLE16    WINAPI OpenJob16(LPCSTR,LPCSTR,HDC16);
BOOL16      WINAPI PaintRgn16(HDC16,HRGN16);
BOOL16      WINAPI PatBlt16(HDC16,INT16,INT16,INT16,INT16,DWORD);
HRGN16      WINAPI PathToRegion16(HDC16);
BOOL16      WINAPI Pie16(HDC16,INT16,INT16,INT16,INT16,INT16,INT16,INT16,INT16);
BOOL16      WINAPI PlayMetaFile16(HDC16,HMETAFILE16);
VOID        WINAPI PlayMetaFileRecord16(HDC16,LPHANDLETABLE16,LPMETARECORD,UINT16);
BOOL16      WINAPI PolyBezier16(HDC16,const POINT16*,INT16);
BOOL16      WINAPI PolyBezierTo16(HDC16,const POINT16*,INT16);
BOOL16      WINAPI PolyPolygon16(HDC16,const POINT16*,const INT16*,UINT16);
BOOL16      WINAPI Polygon16(HDC16,const POINT16*,INT16);
BOOL16      WINAPI Polyline16(HDC16,const POINT16*,INT16);
BOOL16      WINAPI PtInRegion16(HRGN16,INT16,INT16);
BOOL16      WINAPI PtVisible16(HDC16,INT16,INT16);
BOOL16      WINAPI QueryAbort16(HDC16,INT16);
UINT16      WINAPI RealizeDefaultPalette16(HDC16);
BOOL16      WINAPI Rectangle16(HDC16,INT16,INT16,INT16,INT16);
BOOL16      WINAPI RectInRegion16(HRGN16,const RECT16 *);
BOOL16      WINAPI RectVisible16(HDC16,const RECT16*);
BOOL16      WINAPI RemoveFontResource16(LPCSTR);
HDC16       WINAPI ResetDC16(HDC16,const DEVMODEA *);
BOOL16      WINAPI ResizePalette16(HPALETTE16,UINT16);
BOOL16      WINAPI RestoreDC16(HDC16,INT16);
INT16       WINAPI RestoreVisRgn16(HDC16);
VOID        WINAPI Resurrection16(HDC16,WORD,WORD,WORD,WORD,WORD,WORD);
BOOL16      WINAPI RoundRect16(HDC16,INT16,INT16,INT16,INT16,INT16,INT16);
INT16       WINAPI SaveDC16(HDC16);
HRGN16      WINAPI SaveVisRgn16(HDC16);
DWORD       WINAPI ScaleViewportExt16(HDC16,INT16,INT16,INT16,INT16);
BOOL16      WINAPI ScaleViewportExtEx16(HDC16,INT16,INT16,INT16,INT16,LPSIZE16);
DWORD       WINAPI ScaleWindowExt16(HDC16,INT16,INT16,INT16,INT16);
BOOL16      WINAPI ScaleWindowExtEx16(HDC16,INT16,INT16,INT16,INT16,LPSIZE16);
BOOL16      WINAPI SelectClipPath16(HDC16,INT16);
INT16       WINAPI SelectClipRgn16(HDC16,HRGN16);
HGDIOBJ16   WINAPI SelectObject16(HDC16,HGDIOBJ16);
INT16       WINAPI SelectVisRgn16(HDC16,HRGN16);
INT16       WINAPI SetAbortProc16(HDC16,ABORTPROC16);
INT16       WINAPI SetArcDirection16(HDC16,INT16);
LONG        WINAPI SetBitmapBits16(HBITMAP16,LONG,LPCVOID);
DWORD       WINAPI SetBitmapDimension16(HBITMAP16,INT16,INT16);
BOOL16      WINAPI SetBitmapDimensionEx16(HBITMAP16,INT16,INT16,LPSIZE16);
COLORREF    WINAPI SetBkColor16(HDC16,COLORREF);
INT16       WINAPI SetBkMode16(HDC16,INT16);
UINT16      WINAPI SetBoundsRect16(HDC16,const RECT16*,UINT16);
DWORD       WINAPI SetBrushOrg16(HDC16,INT16,INT16);
BOOL16      WINAPI SetDCHook16(HDC16,FARPROC16,DWORD);
DWORD       WINAPI SetDCOrg16(HDC16,INT16,INT16);
VOID        WINAPI SetDCState16(HDC16,HDC16);
UINT16      WINAPI SetDIBColorTable16(HDC16,UINT16,UINT16,RGBQUAD*);
INT16       WINAPI SetDIBits16(HDC16,HBITMAP16,UINT16,UINT16,LPCVOID,const BITMAPINFO*,UINT16);
INT16       WINAPI SetDIBitsToDevice16(HDC16,INT16,INT16,INT16,INT16,INT16,
                         INT16,UINT16,UINT16,LPCVOID,const BITMAPINFO*,UINT16);
INT16       WINAPI SetEnvironment16(LPCSTR,LPDEVMODEA,UINT16);
WORD        WINAPI SetHookFlags16(HDC16,WORD);
INT16       WINAPI SetMapMode16(HDC16,INT16);
DWORD       WINAPI SetMapperFlags16(HDC16,DWORD);
HMETAFILE16 WINAPI SetMetaFileBits16(HGLOBAL16);
UINT16      WINAPI SetPaletteEntries16(HPALETTE16,UINT16,UINT16,const PALETTEENTRY*);
COLORREF    WINAPI SetPixel16(HDC16,INT16,INT16,COLORREF);
INT16       WINAPI SetPolyFillMode16(HDC16,INT16);
VOID        WINAPI SetRectRgn16(HRGN16,INT16,INT16,INT16,INT16);
INT16       WINAPI SetRelAbs16(HDC16,INT16);
INT16       WINAPI SetROP216(HDC16,INT16);
INT16       WINAPI SetStretchBltMode16(HDC16,INT16);
UINT16      WINAPI SetSystemPaletteUse16(HDC16,UINT16);
UINT16      WINAPI SetTextAlign16(HDC16,UINT16);
INT16       WINAPI SetTextCharacterExtra16(HDC16,INT16);
COLORREF    WINAPI SetTextColor16(HDC16,COLORREF);
INT16       WINAPI SetTextJustification16(HDC16,INT16,INT16);
DWORD       WINAPI SetViewportExt16(HDC16,INT16,INT16);
BOOL16      WINAPI SetViewportExtEx16(HDC16,INT16,INT16,LPSIZE16);
DWORD       WINAPI SetViewportOrg16(HDC16,INT16,INT16);
BOOL16      WINAPI SetViewportOrgEx16(HDC16,INT16,INT16,LPPOINT16);
DWORD       WINAPI SetWindowExt16(HDC16,INT16,INT16);
BOOL16      WINAPI SetWindowExtEx16(HDC16,INT16,INT16,LPSIZE16);
DWORD       WINAPI SetWindowOrg16(HDC16,INT16,INT16);
BOOL16      WINAPI SetWindowOrgEx16(HDC16,INT16,INT16,LPPOINT16);
INT16       WINAPI StartDoc16(HDC16,const DOCINFO16*);
INT16       WINAPI StartPage16(HDC16);
INT16       WINAPI StartSpoolPage16(HPJOB16);
BOOL16      WINAPI StretchBlt16(HDC16,INT16,INT16,INT16,INT16,HDC16,INT16,
                                INT16,INT16,INT16,DWORD);
INT16       WINAPI StretchDIBits16(HDC16,INT16,INT16,INT16,INT16,INT16,INT16,
                       INT16,INT16,const VOID*,const BITMAPINFO*,UINT16,DWORD);
BOOL16      WINAPI StrokeAndFillPath16(HDC16);
BOOL16      WINAPI StrokePath16(HDC16);
BOOL16      WINAPI TextOut16(HDC16,INT16,INT16,LPCSTR,INT16);
BOOL16      WINAPI UnrealizeObject16(HGDIOBJ16);
INT16       WINAPI UpdateColors16(HDC16);
BOOL16      WINAPI WidenPath16(HDC16);
INT16       WINAPI WriteDialog16(HPJOB16,LPSTR,INT16);
INT16       WINAPI WriteSpool16(HPJOB16,LPSTR,INT16);

#endif /* __WINE_WINE_WINGDI16_H */


text:
<?php

namespace Menulib\Bundle\MbBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;

/**
 * This is the class that loads and manages your bundle configuration
 *
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
 */
class MenulibMbExtension extends Extension
{
    /**
     * {@inheritdoc}
     */
    public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('services.yml');
        $loader->load('normalizers.yml');
        $loader->load('serializer.yml');

        $container->setParameter('mb_api_host', $config['api_host']);
    }
}