<commit_before>import React from 'react';
import MobileDetect from 'mobile-detect';
import TextFieldStyle from 'components/TextField.style';
import SelectFieldStyle from 'components/SelectField.style';
import StepperStyle from 'components/Stepper.style';

export class StyleProvider {

  /**
    Fallback values for server rendering
    https://mydevice.io/devices/
    https://www.w3schools.com/browsers/browsers_display.asp
  */

  static get phoneWidth() {
    return 480;
  }

  static get tabletWidth() {
    return 800;
  }


  static get desktopWidth() {
    return 1200;
  }

  constructor(agent) {
    this.detected = new MobileDetect(agent);
    const deviceOS = this.detected.os();
    if(deviceOS && deviceOS.match('iOS|AndroidOS')){
      const mobile = this.detected.mobile();
      if(mobile){
        if(mobile.match('Tablet|iPad')){
          this.device = 'tablet';
        } else {
          this.device = 'phone';
        }
      } else {
        this.device = 'desktop';
      }
    } else {
      this.device = 'desktop';
    }

    this.getPolyfills();
  }

  getPolyfills(){
    //Intl
    if(this.detected.is('Safari') ||
       (this.detected.ua && this.detected.ua.match('Mac OS'))){
       require('intl');
       require('intl/locale-data/jsonp/en.js');
    }
  }

  loadScreenSizes() {
    const body = document.getElementsByTagName('body')[0];
    this.width = parseInt(body.offsetWidth);
    if(this.device === 'desktop') {
      if(this.width < StyleProvider.tabletWidth &&
         this.width > StyleProvider.phoneWidth) {
        this.device = 'tablet';
      } else if(this.width < StyleProvider.phoneWidth) {
        this.device = 'phone';
      }
    }
    this.loaded = true;
  }

  percent(value) {
    if(this.width){
      return (value / 100) * this.width;
    } else {
      switch(this.device){<commit_msg>Fixing missing Intl on Android Firefox.<commit_after>import React from 'react';
import MobileDetect from 'mobile-detect';
import TextFieldStyle from 'components/TextField.style';
import SelectFieldStyle from 'components/SelectField.style';
import StepperStyle from 'components/Stepper.style';

export class StyleProvider {

  /**
    Fallback values for server rendering
    https://mydevice.io/devices/
    https://www.w3schools.com/browsers/browsers_display.asp
  */

  static get phoneWidth() {
    return 480;
  }

  static get tabletWidth() {
    return 800;
  }


  static get desktopWidth() {
    return 1200;
  }

  constructor(agent) {
    this.detected = new MobileDetect(agent);
    const deviceOS = this.detected.os();
    if(deviceOS && deviceOS.match('iOS|AndroidOS')){
      const mobile = this.detected.mobile();
      if(mobile){
        if(mobile.match('Tablet|iPad')){
          this.device = 'tablet';
        } else {
          this.device = 'phone';
        }
      } else {
        this.device = 'desktop';
      }
    } else {
      this.device = 'desktop';
    }

    this.getPolyfills();
  }

  getPolyfills(){
    //Intl
    if(
      this.detected.is('Safari') ||
      (this.detected.ua &&
       this.detected.ua.match('Mac OS')) ||
      (this.device === 'phone' &&
       this.detected.ua &&
       this.detected.ua.match('Firefox'))
    ){
       require('intl');
       require('intl/locale-data/jsonp/en.js');
    }
  }

  loadScreenSizes() {
    const body = document.getElementsByTagName('body')[0];
    this.width = parseInt(body.offsetWidth);
    if(this.device === 'desktop') {
      if(this.width < StyleProvider.tabletWidth &&
         this.width > StyleProvider.phoneWidth) {
        this.device = 'tablet';
      } else if(this.width < StyleProvider.phoneWidth) {
        this.device = 'phone';
      }
    }
    this.loaded = true;
  }

  percent(value) {
    if(this.width){
      return (value / 100) * this.width;
    } else {
      switch(this.device){
{'fraction_non_alphanumeric': 0.14278296988577363, 'fraction_numerical': 0.00778816199376947, 'mean_word_length': 2.5511520737327187, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3800548', 'n_tokens_mistral': 1268, 'n_tokens_neox': 1208, 'n_words': 225}