<commit_before>/* This Source Code Form is subject to the terms of the MIT license
 * If a copy of the MIT license was not distributed with this file, you can
 * obtain one at https://raw.github.com/mozilla/butter/master/LICENSE */

define( [ "util/lang", "util/xhr", "util/keys", "util/mediatypes", "editor/editor",
 "util/time", "util/dragndrop", "text!layouts/media-editor.html" ],
  function( LangUtils, XHR, KeysUtils, MediaUtils, Editor, Time, DragNDrop, EDITOR_LAYOUT ) {

  var _parentElement =  LangUtils.domFragment( EDITOR_LAYOUT,".media-editor" ),
      _addMediaTitle = _parentElement.querySelector( ".add-new-media" ),
      _addMediaPanel = _parentElement.querySelector( ".add-media-panel" ),

      _urlInput = _addMediaPanel.querySelector( ".add-media-input" ),
      _addBtn = _addMediaPanel.querySelector( ".add-media-btn" ),
      _errorMessage = _parentElement.querySelector( ".media-error-message" ),
      _oldValue,
      _loadingSpinner = _parentElement.querySelector( ".media-loading-spinner" ),

      _galleryPanel = _parentElement.querySelector( ".media-gallery" ),
      _galleryList = _galleryPanel.querySelector( ".media-gallery-list" ),
      _GALLERYITEM = LangUtils.domFragment( EDITOR_LAYOUT, ".media-gallery-item" ),

      _durationInput = _parentElement.querySelector( ".media-base-duration" ),

      _butter,
      _media,
      _mediaLoadTimeout,
      _cancelSpinner,
      MEDIA_LOAD_TIMEOUT = 10000,
      TIMEOUT_ERROR = "Your media source is taking too long to load",
      _this,
      TRANSITION_TIME = 2000;

  function toggleAddNewMediaPanel() {
    _parentElement.classList.toggle( "add-media-collapsed" );
  }

  function resetInput() {
    _urlInput.value = "";

    clearTimeout( _mediaLoadTimeout );
    clearTimeout( _cancelSpinner );
    _urlInput.classList.remove( "error" );
    _addMediaPanel.classList.remove( "invalid-field" );
    _errorMessage.classList.add( "hidden" );
    _loadingSpinner.classList.add( "hidden" );

    _addBtn.classList.add( "hidden" );
  }

  function setBaseDuration( duration ) {
    if ( duration === "" ) {
      _durationInput.value = Time.toTimecode( _media.duration );
      return;
    }
    duration = Time.toTimecode( duration );
    if ( _durationInput.value !== duration ) {
      _durationInput.value = Time.toTimecode( duration );
    }
    if ( duration !== _media.duration ) {
      duration = Time.toSeconds( duration );
    }
    if ( duration === _media.duration ) {
      return;
    }
    if ( /[0-9]{1,9}/.test( duration ) ) {
      _media.url = "#t=," + duration;
    } else {
      _media.url = duration;
    }
  }

  function onDenied( error ) {
    clearTimeout( _cancelSpinner );
    clearTimeout( _mediaLoadTimeout );
    _errorMessage.innerHTML = error;
    _loadingSpinner.classList.add( "hidden" );
    _addMediaPanel.classList.add( "invalid-field" );
    setTimeout( function() {
      _errorMessage.classList.remove( "hidden" );
    }, 300 );
  }

  function addElements( data, el ) {
    el = el || _GALLERYITEM.cloneNode( true );

    var deleteBtn = el.querySelector( ".mg-delete-btn" ),
        thumbnailBtn = el.querySelector( ".mg-thumbnail" ),
        thumbnailImg,
        source = data.source;

    DragNDrop.helper( thumbnailBtn, {
      pluginOptions: {
        source: data.source,
        denied: data.denied,
        end: data.duration,
        from: data.from || 0,
        title: data.title,
        duration: data.duration,
        hidden: data.hidden
      },
      start: function() {
        for ( var i = 0, l = _butter.targets.length; i < l; ++i ) {
          _butter.targets[ i ].iframeDiv.style.display = "block";
        }
      },
      stop: function() {
        _butter.currentMedia.pause();
        for ( var i = 0, l = _butter.targets.length; i < l; ++i ) {
          _butter.targets[ i ].iframeDiv.style.display = "none";
        }
      }
    });

    thumbnailBtn.setAttribute( "data-popcorn-plugin-type", "sequencer" );
    thumbnailBtn.setAttribute( "data-butter-draggable-type", "plugin" );
    deleteBtn.addEventListener( "click", function() {

    thumbnailBtn.removeEventListener( "click", addEvent, false );
      _galleryList.removeChild( el );
      _this.scrollbar.update();
      delete _media.clipData[ source ];
      _butter.dispatch( "mediaclipremoved" );
    }, false );

    _loadingSpinner.classList.add( "hidden" );

    el.querySelector( ".mg-title" ).innerHTML = data.title;
    el.querySelector( ".mg-type" ).innerHTML = data.type;
    el.querySelector( ".mg-duration" ).innerHTML = Time.toTimecode( data.duration, 0 );
    if ( data.type === "html5" ) {
      thumbnailImg = data.thumbnail;
    } else {
      thumbnailImg = document.createElement( "img" );
      thumbnailImg.src = data.thumbnail;
    }
    thumbnailBtn.appendChild( thumbnailImg );
    thumbnailBtn.src = data.thumbnail;

    el.classList.add( "mg-" + data.type );

    if ( data.denied ) {
      el.querySelector( ".mg-error" ).innerHTML = "Embedding disabled by request";
    }

    function addEvent() {
      var start = _butter.currentTime,
          end = start + data.duration,
          trackEvent;

      function addTrackEvent() {
        trackEvent = _butter.generateSafeTrackEvent( "sequencer", start, end );

        trackEvent.update({
          source: data.source,
          denied: data.denied,
          start: start,
          end: end,
          from: data.from || 0,
          title: data.title,
          duration: data.duration,
          hidden: data.hidden || false
        });
      }

      if ( end > _media.duration ) {
        _butter.listen( "mediaready", function onMediaReady() {
          _butter.unlisten( "mediaready", onMediaReady );
          addTrackEvent();
        });

        setBaseDuration( end );
      } else {
        addTrackEvent();
      }
    }

    thumbnailBtn.addEventListener( "click", addEvent, false );

    _galleryList.insertBefore( el, _galleryList.firstChild );
    _this.scrollbar.update();
    resetInput();
  }

  function onSuccess( data ) {
    var el = _GALLERYITEM.cloneNode( true ),
        source = data.source;

    if ( !_media.clipData[ source ] ) {
      _media.clipData[ source ] = source;
      _butter.dispatch( "mediaclipadded" );

      el.classList.add( "new" );

      setTimeout(function() {
        el.classList.remove( "new" );
      }, TRANSITION_TIME );

      addElements( data, el );
    } else {
      onDenied( "Your gallery already has that media added to it" );
    }
  }

  function addMediaToGallery( url, onDenied ) {
    var data = {};

    // Don't trigger with empty inputs
    if ( !url ) {
      return;
    }

    data.source = url;
    data.type = "sequencer";
    _mediaLoadTimeout = setTimeout( function() {
      _errorMessage.innerHTML = TIMEOUT_ERROR;
      _errorMessage.classList.remove( "hidden" );
      _addMediaPanel.classList.add( "invalid-field" );
    }, MEDIA_LOAD_TIMEOUT );
    MediaUtils.getMetaData( data.source, onSuccess, onDenied );
  }

  function onFocus() {
    _oldValue = _urlInput.value;
  }

  function onInput() {
    if ( _urlInput.value ) {
      _addBtn.classList.remove( "hidden" );
    } else {
      _addBtn.classList.add( "hidden" );
    }
    _addMediaPanel.classList.remove( "invalid-field" );
    _loadingSpinner.classList.add( "hidden" );
    _errorMessage.classList.add( "hidden" );
  }

  function onEnter( e ) {
    if ( e.keyCode === KeysUtils.ENTER ) {
      e.preventDefault();
      onAddMediaClick();
    }
  }

  function onBlur( e ) {
    e.preventDefault();
    setBaseDuration( _durationInput.value );
  }

  function onAddMediaClick() {
    // transitionend event is not reliable and not cross browser supported.
    _cancelSpinner = setTimeout( function() {
      _loadingSpinner.classList.remove( "hidden" );
    }, 300 );
    _addBtn.classList.add( "hidden" );
    addMediaToGallery( _urlInput.value, onDenied );
  }

  function setup() {
    _addMediaTitle.addEventListener( "click", toggleAddNewMediaPanel, false );

    _urlInput.addEventListener( "focus", onFocus, false );
    _urlInput.addEventListener( "input", onInput, false );
    _urlInput.addEventListener( "keydown", onEnter, false );

    _addBtn.addEventListener( "click", onAddMediaClick, false );

    _durationInput.addEventListener( "keydown", onDurationChange, false );
    _durationInput.addEventListener( "blur", onBlur, false );
  }

  function onDurationChange( e ) {
    if ( e.keyCode === KeysUtils.ENTER ) {
      e.preventDefault();
      setBaseDuration( _durationInput.value );
    }
  }

  Editor.register( "media-editor", null, function( rootElement, butter ) {
    rootElement = _parentElement;
    _this = this;
    _butter = butter;
    _media = _butter.currentMedia;

    // We keep track of clips that are in the media gallery for a project once it is saved
    // and every time after it is saved.
    var clips = _media.clipData;

    for ( var key in clips ) {
      if ( clips.hasOwnProperty( key ) ) {
        MediaUtils.getMetaData( clips[ key ], addElements );
      }
    }

    setup();

    Editor.BaseEditor.extend( _this, butter, rootElement, {
      open: function() {
        setBaseDuration( _media.duration );
      },
      close: function() {}
    });

  }, true );
});
<commit_msg>[#3386] Fix UI quirk in gallery loading.<commit_after>/* This Source Code Form is subject to the terms of the MIT license
 * If a copy of the MIT license was not distributed with this file, you can
 * obtain one at https://raw.github.com/mozilla/butter/master/LICENSE */

define( [ "util/lang", "util/xhr", "util/keys", "util/mediatypes", "editor/editor",
 "util/time", "util/dragndrop", "text!layouts/media-editor.html" ],
  function( LangUtils, XHR, KeysUtils, MediaUtils, Editor, Time, DragNDrop, EDITOR_LAYOUT ) {

  var _parentElement =  LangUtils.domFragment( EDITOR_LAYOUT,".media-editor" ),
      _addMediaTitle = _parentElement.querySelector( ".add-new-media" ),
      _addMediaPanel = _parentElement.querySelector( ".add-media-panel" ),

      _urlInput = _addMediaPanel.querySelector( ".add-media-input" ),
      _addBtn = _addMediaPanel.querySelector( ".add-media-btn" ),
      _errorMessage = _parentElement.querySelector( ".media-error-message" ),
      _oldValue,
      _loadingSpinner = _parentElement.querySelector( ".media-loading-spinner" ),

      _galleryPanel = _parentElement.querySelector( ".media-gallery" ),
      _galleryList = _galleryPanel.querySelector( ".media-gallery-list" ),
      _GALLERYITEM = LangUtils.domFragment( EDITOR_LAYOUT, ".media-gallery-item" ),

      _durationInput = _parentElement.querySelector( ".media-base-duration" ),

      _butter,
      _media,
      _mediaLoadTimeout,
      _cancelSpinner,
      MEDIA_LOAD_TIMEOUT = 10000,
      TIMEOUT_ERROR = "Your media source is taking too long to load",
      _this,
      TRANSITION_TIME = 2000;

  function toggleAddNewMediaPanel() {
    _parentElement.classList.toggle( "add-media-collapsed" );
  }

  function resetInput() {
    _urlInput.value = "";

    clearTimeout( _mediaLoadTimeout );
    clearTimeout( _cancelSpinner );
    _urlInput.classList.remove( "error" );
    _addMediaPanel.classList.remove( "invalid-field" );
    _errorMessage.classList.add( "hidden" );
    _loadingSpinner.classList.add( "hidden" );

    _addBtn.classList.add( "hidden" );
  }

  function setBaseDuration( duration ) {
    if ( duration === "" ) {
      _durationInput.value = Time.toTimecode( _media.duration );
      return;
    }
    duration = Time.toTimecode( duration );
    if ( _durationInput.value !== duration ) {
      _durationInput.value = Time.toTimecode( duration );
    }
    if ( duration !== _media.duration ) {
      duration = Time.toSeconds( duration );
    }
    if ( duration === _media.duration ) {
      return;
    }
    if ( /[0-9]{1,9}/.test( duration ) ) {
      _media.url = "#t=," + duration;
    } else {
      _media.url = duration;
    }
  }

  function onDenied( error ) {
    clearTimeout( _cancelSpinner );
    clearTimeout( _mediaLoadTimeout );
    _errorMessage.innerHTML = error;
    _loadingSpinner.classList.add( "hidden" );
    _addMediaPanel.classList.add( "invalid-field" );
    setTimeout( function() {
      _errorMessage.classList.remove( "hidden" );
    }, 300 );
  }

  function addElements( data, el ) {
    el = el || _GALLERYITEM.cloneNode( true );

    var deleteBtn = el.querySelector( ".mg-delete-btn" ),
        thumbnailBtn = el.querySelector( ".mg-thumbnail" ),
        thumbnailImg,
        source = data.source;

    DragNDrop.helper( thumbnailBtn, {
      pluginOptions: {
        source: data.source,
        denied: data.denied,
        end: data.duration,
        from: data.from || 0,
        title: data.title,
        duration: data.duration,
        hidden: data.hidden
      },
      start: function() {
        for ( var i = 0, l = _butter.targets.length; i < l; ++i ) {
          _butter.targets[ i ].iframeDiv.style.display = "block";
        }
      },
      stop: function() {
        _butter.currentMedia.pause();
        for ( var i = 0, l = _butter.targets.length; i < l; ++i ) {
          _butter.targets[ i ].iframeDiv.style.display = "none";
        }
      }
    });

    thumbnailBtn.setAttribute( "data-popcorn-plugin-type", "sequencer" );
    thumbnailBtn.setAttribute( "data-butter-draggable-type", "plugin" );
    deleteBtn.addEventListener( "click", function() {

    thumbnailBtn.removeEventListener( "click", addEvent, false );
      _galleryList.removeChild( el );
      _this.scrollbar.update();
      delete _media.clipData[ source ];
      _butter.dispatch( "mediaclipremoved" );
    }, false );

    _loadingSpinner.classList.add( "hidden" );

    el.querySelector( ".mg-title" ).innerHTML = data.title;
    el.querySelector( ".mg-type" ).innerHTML = data.type;
    el.querySelector( ".mg-duration" ).innerHTML = Time.toTimecode( data.duration, 0 );
    if ( data.type === "html5" ) {
      thumbnailImg = data.thumbnail;
    } else {
      thumbnailImg = document.createElement( "img" );
      thumbnailImg.src = data.thumbnail;
    }
    thumbnailBtn.appendChild( thumbnailImg );
    thumbnailBtn.src = data.thumbnail;

    el.classList.add( "mg-" + data.type );

    if ( data.denied ) {
      el.querySelector( ".mg-error" ).innerHTML = "Embedding disabled by request";
    }

    function addEvent() {
      var start = _butter.currentTime,
          end = start + data.duration,
          trackEvent;

      function addTrackEvent() {
        trackEvent = _butter.generateSafeTrackEvent( "sequencer", start, end );

        trackEvent.update({
          source: data.source,
          denied: data.denied,
          start: start,
          end: end,
          from: data.from || 0,
          title: data.title,
          duration: data.duration,
          hidden: data.hidden || false
        });
      }

      if ( end > _media.duration ) {
        _butter.listen( "mediaready", function onMediaReady() {
          _butter.unlisten( "mediaready", onMediaReady );
          addTrackEvent();
        });

        setBaseDuration( end );
      } else {
        addTrackEvent();
      }
    }

    thumbnailBtn.addEventListener( "click", addEvent, false );

    _galleryList.insertBefore( el, _galleryList.firstChild );
    _this.scrollbar.update();
    resetInput();
  }

  function onSuccess( data ) {
    var el = _GALLERYITEM.cloneNode( true ),
        source = data.source;

    if ( !_media.clipData[ source ] ) {
      _media.clipData[ source ] = source;
      _butter.dispatch( "mediaclipadded" );

      el.classList.add( "new" );

      setTimeout(function() {
        el.classList.remove( "new" );
      }, TRANSITION_TIME );

      addElements( data, el );
    } else {
      onDenied( "Your gallery already has that media added to it" );
    }
  }

  function addMediaToGallery( url, onDenied ) {
    var data = {};

    // Don't trigger with empty inputs
    if ( !url ) {
      return;
    }

    data.source = url;
    data.type = "sequencer";
    _mediaLoadTimeout = setTimeout( function() {
      _errorMessage.innerHTML = TIMEOUT_ERROR;
      _errorMessage.classList.remove( "hidden" );
      _addMediaPanel.classList.add( "invalid-field" );
    }, MEDIA_LOAD_TIMEOUT );
    MediaUtils.getMetaData( data.source, onSuccess, onDenied );
  }

  function onFocus() {
    _oldValue = _urlInput.value;
  }

  function onInput() {
    if ( _urlInput.value ) {
      _addBtn.classList.remove( "hidden" );
    } else {
      _addBtn.classList.add( "hidden" );
    }
    clearTimeout( _cancelSpinner );
    clearTimeout( _mediaLoadTimeout );
    _addMediaPanel.classList.remove( "invalid-field" );
    _loadingSpinner.classList.add( "hidden" );
    _errorMessage.classList.add( "hidden" );
  }

  function onEnter( e ) {
    if ( e.keyCode === KeysUtils.ENTER ) {
      e.preventDefault();
      onAddMediaClick();
    }
  }

  function onBlur( e ) {
    e.preventDefault();
    setBaseDuration( _durationInput.value );
  }

  function onAddMediaClick() {
    // transitionend event is not reliable and not cross browser supported.
    _cancelSpinner = setTimeout( function() {
      _loadingSpinner.classList.remove( "hidden" );
    }, 300 );
    _addBtn.classList.add( "hidden" );
    addMediaToGallery( _urlInput.value, onDenied );
  }

  function setup() {
    _addMediaTitle.addEventListener( "click", toggleAddNewMediaPanel, false );

    _urlInput.addEventListener( "focus", onFocus, false );
    _urlInput.addEventListener( "input", onInput, false );
    _urlInput.addEventListener( "keydown", onEnter, false );

    _addBtn.addEventListener( "click", onAddMediaClick, false );

    _durationInput.addEventListener( "keydown", onDurationChange, false );
    _durationInput.addEventListener( "blur", onBlur, false );
  }

  function onDurationChange( e ) {
    if ( e.keyCode === KeysUtils.ENTER ) {
      e.preventDefault();
      setBaseDuration( _durationInput.value );
    }
  }

  Editor.register( "media-editor", null, function( rootElement, butter ) {
    rootElement = _parentElement;
    _this = this;
    _butter = butter;
    _media = _butter.currentMedia;

    // We keep track of clips that are in the media gallery for a project once it is saved
    // and every time after it is saved.
    var clips = _media.clipData;

    for ( var key in clips ) {
      if ( clips.hasOwnProperty( key ) ) {
        MediaUtils.getMetaData( clips[ key ], addElements );
      }
    }

    setup();

    Editor.BaseEditor.extend( _this, butter, rootElement, {
      open: function() {
        setBaseDuration( _media.duration );
      },
      close: function() {}
    });

  }, true );
});
<|endoftext|>


<commit_before>'use strict';

jest.unmock('../js/components/game-over');
jest.unmock('material-ui/lib/raised-button');

import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';
import GameOver from '../js/components/game-over';

navigator.__defineGetter__('userAgent', function() {
  return 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2454.85 Safari/537.36'
});

describe('In the game, after the user submits a word...', () => {
  it('if this is the last word available to be submitted we display the component', () => {
    // Render a gameover component in the document
    const gameOver = TestUtils.renderIntoDocument(
      <GameOver status='Game Finished' numberCorrect="5"/>
    );

    const gameOverNode = ReactDOM.findDOMNode(gameOver);
    expect(gameOverNode.style.display).toEqual('flex');
    const titleNode = gameOverNode.children[0].children[0];
    expect(titleNode.textContent).toEqual('You got 5 correct!');

  });

  it('if this is not the last word available to spell, then keep the component hidden', () => {
    // Render a gameover component in the document
    const gameOver = TestUtils.renderIntoDocument(
      <GameOver status='Playing'/>
    );

    const gameOverNode = ReactDOM.findDOMNode(gameOver);
    expect(gameOverNode.style.display).toEqual('none');
  });

});<commit_msg>pass in functions to prevent warnings<commit_after>'use strict';

jest.unmock('../js/components/game-over');
jest.unmock('material-ui/lib/raised-button');

import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';
import GameOver from '../js/components/game-over';

navigator.__defineGetter__('userAgent', function() {
  return 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2454.85 Safari/537.36'
});

describe('In the game, after the user submits a word...', () => {
  it('if this is the last word available to be submitted we display the component', () => {
    const onStartNewGameMockFunc = jest.fn();
    const onStartSameGameMockFunc = jest.fn();
    // Render a gameover component in the document
    const gameOver = TestUtils.renderIntoDocument(
      <GameOver status='Game Finished' numberCorrect="5" onStartNewGame={onStartNewGameMockFunc} onStartSameGame={onStartSameGameMockFunc}/>
    );

    const gameOverNode = ReactDOM.findDOMNode(gameOver);
    expect(gameOverNode.style.display).toEqual('flex');
    const titleNode = gameOverNode.children[0].children[0];
    expect(titleNode.textContent).toEqual('You got 5 correct!');

  });

  it('if this is not the last word available to spell, then keep the component hidden', () => {
    const onStartNewGameMockFunc = jest.fn();
    const onStartSameGameMockFunc = jest.fn();
    // Render a gameover component in the document
    const gameOver = TestUtils.renderIntoDocument(
      <GameOver status='Playing'  onStartNewGame={onStartNewGameMockFunc} onStartSameGame={onStartSameGameMockFunc}/>
    );

    const gameOverNode = ReactDOM.findDOMNode(gameOver);
    expect(gameOverNode.style.display).toEqual('none');
  });
    // Render a gameover component in the document
    const gameOver = TestUtils.renderIntoDocument(
      <GameOver status='Playing'/>
    );

    const gameOverNode = ReactDOM.findDOMNode(gameOver);
    expect(gameOverNode.style.display).toEqual('none');
  });

});<|endoftext|>


<commit_before>/* eslint-env jest */

jest.unmock('../../src');

import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';
import MarkdownEditor from '../../src';

const value = '';
const onChangeMock = jest.genMockFunction();
const onImageDropMock = jest.genMockFunction();

let markdownEditor;

const validFile = [{ type: 'image/jpeg', name: 'image' }];
const invalidFile = [{ type: 'text/markdown', name: 'markdown' }];
const uploadedImage = { url: 'url', filename: 'image' };

function generateMarkdownEditor(includeOnDropImage = false) {
    const markup = includeOnDropImage ?
        <MarkdownEditor value={value} onChange={onChangeMock} onImageDrop={onImageDropMock} /> :
        <MarkdownEditor value={value} onChange={onChangeMock} />;

    return TestUtils.renderIntoDocument(
        markup
    );
}

function simulateDrop(files, useDataTransfer = true) {
    TestUtils.Simulate.drop(
        TestUtils.findRenderedDOMComponentWithTag(markdownEditor, 'TextArea'),
        { [useDataTransfer ? 'dataTransfer' : 'target']: { files } }
    );
}

describe('MarkdownEditor', () => {
    beforeEach(() => {
        markdownEditor = generateMarkdownEditor();
        onChangeMock.mockClear();
        onImageDropMock.mockClear();
    });

    it('renders', () => {
        const markdownEditorNode = ReactDOM.findDOMNode(markdownEditor);

        expect(markdownEditorNode).toBeDefined();
        expect(markdownEditorNode).not.toBe(null);

        expect(markdownEditor.state.draggingOver).toBe(false);
    });

    describe('onDragEnter', () => {
        it('sets draggingOver to true', () => {
            expect(markdownEditor.state.draggingOver).toBe(false);

            TestUtils.Simulate.dragEnter(TestUtils.findRenderedDOMComponentWithTag(markdownEditor, 'TextArea'));

            expect(markdownEditor.state.draggingOver).toBe(true);
        });
    });

    describe('onDragLeave', () => {
        it('sets draggingOver to false', () => {
            markdownEditor.setState({ draggingOver: true });

            TestUtils.Simulate.dragLeave(TestUtils.findRenderedDOMComponentWithTag(markdownEditor, 'TextArea'));

            expect(markdownEditor.state.draggingOver).toBe(false);
        });
    });

    describe('onDrop', () => {
        it('sets draggingOver to false', () => {
            markdownEditor.setState({ draggingOver: true });

            simulateDrop(validFile);

            expect(markdownEditor.state.draggingOver).toBe(false);
        });

        describe('valid images, but no onImageDrop prop passed', () => {
            it('does not call onChange', () => {
                expect(onChangeMock.mock.calls.length).toBe(0);

                simulateDrop(validFile);

                expect(onChangeMock.mock.calls.length).toBe(0);
            });
        });

        describe('onImageDrop prop passed', () => {
            beforeEach(() => {
                markdownEditor = generateMarkdownEditor(true);

                expect(onChangeMock.mock.calls.length).toBe(0);
                expect(onImageDropMock.mock.calls.length).toBe(0);
            });

            describe('invalid files', () => {
                afterEach(() => {
                    expect(onChangeMock.mock.calls.length).toBe(0);
                    expect(onImageDropMock.mock.calls.length).toBe(0);
                });

                describe('no files passed', () => {
                    it('does not call onChange or onImageDrop', () => {
                        simulateDrop([]);
                    });
                });

                describe('no images passed', () => {
                    it('does not call onChange or onImageDrop', () => {
                        simulateDrop(invalidFile);
                    });
                });
            });

            describe('invalid response from onImageDrop', () => {
                afterEach(() => {
                    expect(onChangeMock.mock.calls.length).toBe(1);
                    expect(onChangeMock).toBeCalledWith({ target: { value: '\n![uploading image...]()' } });

                    expect(onImageDropMock.mock.calls.length).toBe(1);
                    expect(onImageDropMock).toBeCalledWith(validFile[0]);
                });

                describe('no filename', () => {
                    it('does not call onChange twice', () => {
                        onImageDropMock.mockReturnValueOnce({ url: 'url' });

                        simulateDrop(validFile);
                    });
                });

                describe('no url', () => {
                    it('does not call onChange twice', () => {
                        onImageDropMock.mockReturnValueOnce({ filename: 'filename' });

                        simulateDrop(validFile);
                    });
                });
            });

            describe('one image passed', () => {
                afterEach(() => {
                    expect(onChangeMock.mock.calls.length).toBe(1);
                    expect(onChangeMock).toBeCalledWith({ target: { value: '\n![uploading image...]()' } });

                    expect(onImageDropMock.mock.calls.length).toBe(1);
                    expect(onImageDropMock).toBeCalledWith(validFile[0]);
                });

                it('calls onChange and onImageDrop', () => {
                    onImageDropMock.mockReturnValueOnce(uploadedImage);

                    simulateDrop(validFile);
                });

                describe('one image passed with event.target.files', () => {
                    it('calls onChange and onImageDrop', () => {
                        onImageDropMock.mockReturnValueOnce(uploadedImage);

                        simulateDrop(validFile, false);
                    });
                });
            });
        });
    });
});
<commit_msg>some more test refactoring<commit_after>/* eslint-env jest */

jest.unmock('../../src');

import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';
import MarkdownEditor from '../../src';

const value = '';
const onChangeMock = jest.genMockFunction();
const onImageDropMock = jest.genMockFunction();

let markdownEditor;

const validFile = [{ type: 'image/jpeg', name: 'image' }];
const invalidFile = [{ type: 'text/markdown', name: 'markdown' }];
const uploadedImage = { url: 'url', filename: 'image' };

function generateMarkdownEditor(includeOnDropImage = false) {
    const markup = includeOnDropImage ?
        <MarkdownEditor value={value} onChange={onChangeMock} onImageDrop={onImageDropMock} /> :
        <MarkdownEditor value={value} onChange={onChangeMock} />;

    return TestUtils.renderIntoDocument(
        markup
    );
}

function simulateDrop(files, useDataTransfer = true) {
    TestUtils.Simulate.drop(
        TestUtils.findRenderedDOMComponentWithTag(markdownEditor, 'TextArea'),
        { [useDataTransfer ? 'dataTransfer' : 'target']: { files } }
    );
}

describe('MarkdownEditor', () => {
    beforeEach(() => {
        markdownEditor = generateMarkdownEditor();
        onChangeMock.mockClear();
        onImageDropMock.mockClear();
    });

    it('renders', () => {
        const markdownEditorNode = ReactDOM.findDOMNode(markdownEditor);

        expect(markdownEditorNode).toBeDefined();
        expect(markdownEditorNode).not.toBe(null);

        expect(markdownEditor.state.draggingOver).toBe(false);
    });

    describe('onDragEnter', () => {
        it('sets draggingOver to true', () => {
            expect(markdownEditor.state.draggingOver).toBe(false);

            TestUtils.Simulate.dragEnter(TestUtils.findRenderedDOMComponentWithTag(markdownEditor, 'TextArea'));

            expect(markdownEditor.state.draggingOver).toBe(true);
        });
    });

    describe('onDragLeave', () => {
        it('sets draggingOver to false', () => {
            markdownEditor.setState({ draggingOver: true });

            TestUtils.Simulate.dragLeave(TestUtils.findRenderedDOMComponentWithTag(markdownEditor, 'TextArea'));

            expect(markdownEditor.state.draggingOver).toBe(false);
        });
    });

    describe('onDrop', () => {
        it('sets draggingOver to false', () => {
            markdownEditor.setState({ draggingOver: true });

            simulateDrop(validFile);

            expect(markdownEditor.state.draggingOver).toBe(false);
        });

        describe('valid images, but no onImageDrop prop passed', () => {
            it('does not call onChange', () => {
                expect(onChangeMock).not.toBeCalled();

                simulateDrop(validFile);

                expect(onChangeMock).not.toBeCalled();
            });
        });

        describe('onImageDrop prop passed', () => {
            beforeEach(() => {
                markdownEditor = generateMarkdownEditor(true);

                expect(onChangeMock).not.toBeCalled();
                expect(onImageDropMock).not.toBeCalled();
            });

            describe('invalid files', () => {
                afterEach(() => {
                    expect(onChangeMock).not.toBeCalled();
                    expect(onImageDropMock).not.toBeCalled();
                });

                describe('no files passed', () => {
                    it('does not call onChange or onImageDrop', () => {
                        simulateDrop([]);
                    });
                });

                describe('no images passed', () => {
                    it('does not call onChange or onImageDrop', () => {
                        simulateDrop(invalidFile);
                    });
                });
            });

            describe('invalid response from onImageDrop', () => {
                afterEach(() => {
                    simulateDrop(validFile);

                    expect(onChangeMock.mock.calls.length).toBe(1);
                    expect(onChangeMock).toBeCalledWith({ target: { value: '\n![uploading image...]()' } });

                    expect(onImageDropMock.mock.calls.length).toBe(1);
                    expect(onImageDropMock).toBeCalledWith(validFile[0]);
                });

                describe('no filename', () => {
                    it('does not call onChange twice', () => {
                        onImageDropMock.mockReturnValueOnce({ url: 'url' });
                    });
                });

                describe('no url', () => {
                    it('does not call onChange twice', () => {
                        onImageDropMock.mockReturnValueOnce({ filename: 'filename' });
                    });
                });
            });

            describe('one image passed', () => {
                beforeEach(() => {
                    onImageDropMock.mockReturnValueOnce(uploadedImage);
                });

                afterEach(() => {
                    expect(onChangeMock.mock.calls.length).toBe(1);
                    expect(onChangeMock).toBeCalledWith({ target: { value: '\n![uploading image...]()' } });

                    expect(onImageDropMock.mock.calls.length).toBe(1);
                    expect(onImageDropMock).toBeCalledWith(validFile[0]);
                });

                it('calls onChange and onImageDrop', () => {
                    simulateDrop(validFile);
                });

                describe('one image passed with event.target.files', () => {
                    it('calls onChange and onImageDrop', () => {
                        simulateDrop(validFile, false);
                    });
                });
            });
        });
    });
});
<|endoftext|>


<commit_before>const Tinkerforge = require('tinkerforge');
const { table } = require('table');
const replaceString = require('replace-string');
const { name } = require('./get-name.js');
const { errorText } = require('./error-text.js');

/**
 * Initialize Tinkerforge Connection
 *
 * @param {string} host Tinkerforge connection HOST
 * @param {number} port Tinkerforge connection PORT
 * @returns {object} Tinkerforge IP Connection
 */
function tfinit(host, port) {
	console.log('\nUsed HOST: %s\nUsed PORT: %s\n', host, port);
	const ipcon = new Tinkerforge.IPConnection();
	ipcon.connect(host, port, error => {
		console.error('Error: %s\n', errorText(error));
		process.exit();
	});
	ipcon.on(Tinkerforge.IPConnection.CALLBACK_CONNECTED, () => {
		ipcon.enumerate();
	});
	return ipcon;
}

/**
 * Get Information from the connected Bricks/Bricklets
 *
 * @param {object} ipcon Tinkerforge IP Connection
 * @param {boolean} advanced Show advanced informations
 * @returns {string} Information as String
 */
function tfgetList(ipcon, advanced) {
	return new Promise(resolve => {
		let connectedList = '';
		ipcon.on(Tinkerforge.IPConnection.CALLBACK_ENUMERATE, (uid, connectedUid, position, hardwareVersion, firmwareVersion, deviceIdentifier, enumerationType) => {
			if (advanced) {
				connectedList = connectedList + 'NAME:              ' + name(deviceIdentifier) + '\n' +
					'UID:               ' + uid + '\n' +
					'Enumeration Type:  ' + enumerationType + '\n' +
					'Connected UID:     ' + connectedUid + '\n' +
					'Position:          ' + position + '\n' +
					'Hardware Version:  ' + replaceString(hardwareVersion.toString(), ',', '.') + '\n' +
					'Firmware Version:  ' + replaceString(firmwareVersion.toString(), ',', '.') + '\n' +
					'Device Identifier: ' + deviceIdentifier + '\n\n';
			} else {
				connectedList = connectedList + 'NAME: ' + name(deviceIdentifier) + '\n' +
					'UID:  ' + uid + '\n\n';
			}
		});
		setTimeout(() => {
			resolve(connectedList);
		}, 100);
	});
}

/**
 * Get Information from the connected Bricks/Bricklets
 *
 * @param {object} ipcon Tinkerforge IP Connection
 * @param {boolean} advanced Show advanced informations
 * @returns {string[]} Information as Array
 */
function tfgetTable(ipcon, advanced) {
	const data = [];
	if (advanced) {
		data.push(['NAME', 'UID', 'Enumeration Type', 'Connected UID', 'Position', 'Hardware Version', 'Firmware Version', 'Device Identifier']);
		ipcon.on(Tinkerforge.IPConnection.CALLBACK_ENUMERATE, (uid, connectedUid, position, hardwareVersion, firmwareVersion, deviceIdentifier, enumerationType) => {
			data.push([name(deviceIdentifier), uid, enumerationType, connectedUid, position, replaceString(hardwareVersion.toString(), ',', '.'), replaceString(firmwareVersion.toString(), ',', '.'), deviceIdentifier]);
		});
	} else {
		data.push(['NAME', 'UID']);
		ipcon.on(Tinkerforge.IPConnection.CALLBACK_ENUMERATE, (uid, _connectedUid, _position, _hardwareVersion, _firmwareVersion, deviceIdentifier) => {
			data.push([name(deviceIdentifier), uid]);
		});
	}
	return data;
}

/**
 * @param {string} host Tinkerforge connection HOST
 * @param {number} port Tinkerforge connection PORT
 * @param {boolean} advanced Show advanced informations
 * @param {boolean} tableOutput Show as table
 */
function list(host = 'localhost', port = 4223, advanced = false, tableOutput = false) {
	const ipcon = tfinit(host, port);

	if (tableOutput) {
		const data = tfgetTable(ipcon, advanced);
		setTimeout(() => {
			ipcon.disconnect();
			console.log(table(data));
		}, 25);
	} else {
		tfgetList(ipcon, advanced).then((connectedList) => {
			ipcon.disconnect();
			console.log(connectedList);
		})
	}
}

module.exports.list = list;
<commit_msg>fix lint issues<commit_after>const Tinkerforge = require('tinkerforge');
const {table} = require('table');
const replaceString = require('replace-string');
const {name} = require('./get-name.js');
const {errorText} = require('./error-text.js');

/**
 * Initialize Tinkerforge Connection
 *
 * @param {string} host Tinkerforge connection HOST
 * @param {number} port Tinkerforge connection PORT
 * @returns {object} Tinkerforge IP Connection
 */
function tfinit(host, port) {
	console.log('\nUsed HOST: %s\nUsed PORT: %s\n', host, port);
	const ipcon = new Tinkerforge.IPConnection();
	ipcon.connect(host, port, error => {
		console.error('Error: %s\n', errorText(error));
		process.exit();
	});
	ipcon.on(Tinkerforge.IPConnection.CALLBACK_CONNECTED, () => {
		ipcon.enumerate();
	});
	return ipcon;
}

/**
 * Get Information from the connected Bricks/Bricklets
 *
 * @param {object} ipcon Tinkerforge IP Connection
 * @param {boolean} advanced Show advanced informations
 * @returns {string} Information as String
 */
function tfgetList(ipcon, advanced) {
	return new Promise(resolve => {
		let connectedList = '';
		ipcon.on(Tinkerforge.IPConnection.CALLBACK_ENUMERATE, (uid, connectedUid, position, hardwareVersion, firmwareVersion, deviceIdentifier, enumerationType) => {
			if (advanced) {
				connectedList = connectedList + 'NAME:              ' + name(deviceIdentifier) + '\n' +
					'UID:               ' + uid + '\n' +
					'Enumeration Type:  ' + enumerationType + '\n' +
					'Connected UID:     ' + connectedUid + '\n' +
					'Position:          ' + position + '\n' +
					'Hardware Version:  ' + replaceString(hardwareVersion.toString(), ',', '.') + '\n' +
					'Firmware Version:  ' + replaceString(firmwareVersion.toString(), ',', '.') + '\n' +
					'Device Identifier: ' + deviceIdentifier + '\n\n';
			} else {
				connectedList = connectedList + 'NAME: ' + name(deviceIdentifier) + '\n' +
					'UID:  ' + uid + '\n\n';
			}
		});
		setTimeout(() => {
			resolve(connectedList);
		}, 100);
	});
}

/**
 * Get Information from the connected Bricks/Bricklets
 *
 * @param {object} ipcon Tinkerforge IP Connection
 * @param {boolean} advanced Show advanced informations
 * @returns {string[]} Information as Array
 */
function tfgetTable(ipcon, advanced) {
	const data = [];
	if (advanced) {
		data.push(['NAME', 'UID', 'Enumeration Type', 'Connected UID', 'Position', 'Hardware Version', 'Firmware Version', 'Device Identifier']);
		ipcon.on(Tinkerforge.IPConnection.CALLBACK_ENUMERATE, (uid, connectedUid, position, hardwareVersion, firmwareVersion, deviceIdentifier, enumerationType) => {
			data.push([name(deviceIdentifier), uid, enumerationType, connectedUid, position, replaceString(hardwareVersion.toString(), ',', '.'), replaceString(firmwareVersion.toString(), ',', '.'), deviceIdentifier]);
		});
	} else {
		data.push(['NAME', 'UID']);
		ipcon.on(Tinkerforge.IPConnection.CALLBACK_ENUMERATE, (uid, _connectedUid, _position, _hardwareVersion, _firmwareVersion, deviceIdentifier) => {
			data.push([name(deviceIdentifier), uid]);
		});
	}

	return data;
}

/**
 * @param {string} host Tinkerforge connection HOST
 * @param {number} port Tinkerforge connection PORT
 * @param {boolean} advanced Show advanced informations
 * @param {boolean} tableOutput Show as table
 */
function list(host = 'localhost', port = 4223, advanced = false, tableOutput = false) {
	const ipcon = tfinit(host, port);

	if (tableOutput) {
		const data = tfgetTable(ipcon, advanced);
		setTimeout(() => {
			ipcon.disconnect();
			console.log(table(data));
		}, 25);
	} else {
		tfgetList(ipcon, advanced).then(connectedList => {
			ipcon.disconnect();
			console.log(connectedList);
		});
	}
}

module.exports.list = list;
<|endoftext|>


<commit_before>var LockScreenLoggerCDVPlugin = {
	init: function (resultCallback, cancelCallback, errorCallback) {
cordova.exec(function (arg) {
            if (arg == null) {
                cancelCallback();
            } else {
                resultCallback(arg);
            }, errorCallback, "LockScreenLoggerCDVPlugin", “getLocks”, []);
},
    getLocks: function (resultCallback, cancelCallback, errorCallback) {
        cordova.exec(function (arg) {
            if (arg == null) {
                cancelCallback();
            } else {
                resultCallback(arg);
            }
        }, errorCallback, "LockScreenLoggerCDVPlugin", “getLocks”, []);
    }

};

module.exports = LockScreenLoggerCDVPlugin;<commit_msg>no message<commit_after>var LockScreenLoggerCDVPlugin = {
	init: function (resultCallback, cancelCallback, errorCallback) {
        cordova.exec(function (arg) {
                    if (arg == null) {
                        cancelCallback();
                    } else {
                        resultCallback(arg);
                    }
        }, errorCallback, "LockScreenLoggerCDVPlugin", "getLocks", []);
        },
    getLocks: function (resultCallback, cancelCallback, errorCallback) {
        cordova.exec(function (arg) {
            if (arg == null) {
                cancelCallback();
            } else {
                resultCallback(arg);
            }
        }, errorCallback, "LockScreenLoggerCDVPlugin", "getLocks", []);
    }

};

module.exports = LockScreenLoggerCDVPlugin;<|endoftext|>


<commit_before>// ACTIONS project
export const NEW_PROJECT = 'NEW_PROJECT';
export const LOAD_PROJECT = 'LOAD_PROJECT';
export const SAVE_PROJECT = 'SAVE_PROJECT';
export const OPEN_CATALOG = 'OPEN_CATALOG';
export const SELECT_TOOL_EDIT = 'SELECT_TOOL_EDIT';
export const UNSELECT_ALL = 'UNSELECT_ALL';
export const SET_PROPERTIES = 'SET_PROPERTIES';
export const SET_ITEMS_ATTRIBUTES = 'SET_ITEMS_ATTRIBUTES';
export const SET_LINES_ATTRIBUTES = 'SET_LINES_ATTRIBUTES';
export const SET_HOLES_ATTRIBUTES = 'SET_HOLES_ATTRIBUTES';
export const REMOVE = 'REMOVE';
export const UNDO = 'UNDO';
export const ROLLBACK = 'ROLLBACK';
export const SET_PROJECT_PROPERTIES = 'SET_PROJECT_PROPERTIES';
export const OPEN_PROJECT_CONFIGURATOR = 'OPEN_PROJECT_CONFIGURATOR';
export const INIT_CATALOG = 'INIT_CATALOG';

// ACTIONS viewer2D
export const SELECT_TOOL_ZOOM_IN = 'SELECT_TOOL_ZOOM_IN';
export const SELECT_TOOL_ZOOM_OUT = 'SELECT_TOOL_ZOOM_OUT';
export const SELECT_TOOL_PAN = 'SELECT_TOOL_PAN';
export const UPDATE_2D_CAMERA = 'UPDATE_2D_CAMERA';

//ACTIONS viewer3D
export const SELECT_TOOL_3D_VIEW = 'SELECT_TOOL_3D_VIEW';
export const SELECT_TOOL_3D_FIRST_PERSON = 'SELECT_TOOL_3D_FIRST_PERSON';

//ACTIONS items
export const SELECT_TOOL_DRAWING_ITEM = 'SELECT_TOOL_DRAWING_ITEM';
export const UPDATE_DRAWING_ITEM = 'UPDATE_DRAWING_ITEM';
export const END_DRAWING_ITEM = 'END_DRAWING_ITEM';
export const BEGIN_DRAGGING_ITEM = 'BEGIN_DRAGGING_ITEM';
export const UPDATE_DRAGGING_ITEM = 'UPDATE_DRAGGING_ITEM';
export const END_DRAGGING_ITEM = 'END_DRAGGING_ITEM';
export const BEGIN_ROTATING_ITEM = 'BEGIN_ROTATING_ITEM';
export const UPDATE_ROTATING_ITEM = 'UPDATE_ROTATING_ITEM';
export const END_ROTATING_ITEM = 'END_ROTATING_ITEM';

//ACTION drawings
export const SELECT_HOLE = 'SELECT_HOLE';
export const SELECT_AREA = 'SELECT_AREA';
export const SELECT_ITEM = 'SELECT_ITEM';
export const SELECT_LINE = 'SELECT_LINE';
export const SELECT_TOOL_DRAWING_LINE = 'SELECT_TOOL_DRAWING_LINE';
export const BEGIN_DRAWING_LINE = 'BEGIN_DRAWING_LINE';
export const UPDATE_DRAWING_LINE = 'UPDATE_DRAWING_LINE';
export const END_DRAWING_LINE = 'END_DRAWING_LINE';
export const SELECT_TOOL_DRAWING_HOLE = 'SELECT_TOOL_DRAWING_HOLE';
export const UPDATE_DRAWING_HOLE = 'UPDATE_DRAWING_HOLE';
export const END_DRAWING_HOLE = 'END_DRAWING_HOLE';
export const BEGIN_DRAGGING_LINE = 'BEGIN_DRAGGING_LINE';
export const UPDATE_DRAGGING_LINE = 'UPDATE_DRAGGING_LINE';
export const END_DRAGGING_LINE = 'END_DRAGGING_LINE';
export const SELECT_TOOL_UPLOAD_IMAGE = 'SELECT_TOOL_UPLOAD_IMAGE';
export const BEGIN_UPLOADING_IMAGE = 'BEGIN_UPLOADING_IMAGE';
export const END_UPLOADING_IMAGE = 'END_UPLOADING_IMAGE';
export const BEGIN_FITTING_IMAGE = 'BEGIN_FITTING_IMAGE';
export const END_FITTING_IMAGE = 'END_FITTING_IMAGE';
export const BEGIN_DRAGGING_HOLE = 'BEGIN_DRAGGING_HOLE';
export const UPDATE_DRAGGING_HOLE = 'UPDATE_DRAGGING_HOLE';
export const END_DRAGGING_HOLE = 'END_DRAGGING_HOLE';

//ACTIONS vertices
export const BEGIN_DRAGGING_VERTEX = 'BEGIN_DRAGGING_VERTEX';
export const UPDATE_DRAGGING_VERTEX = 'UPDATE_DRAGGING_VERTEX';
export const END_DRAGGING_VERTEX = 'END_DRAGGING_VERTEX';

//ACTIONS scene
export const SET_LAYER_PROPERTIES = 'SET_LAYER_PROPERTIES';
export const ADD_LAYER = 'ADD_LAYER';
export const SELECT_LAYER = 'SELECT_LAYER';
export const OPEN_LAYER_CONFIGURATOR = 'OPEN_LAYER_CONFIGURATOR';
export const REMOVE_LAYER = 'REMOVE_LAYER';

//MODES
export const MODE_IDLE = 'IDLE';
export const MODE_2D_ZOOM_IN = 'MODE_2D_ZOOM_IN';
export const MODE_2D_ZOOM_OUT = 'MODE_2D_ZOOM_OUT';
export const MODE_2D_PAN = 'MODE_2D_PAN';
export const MODE_3D_VIEW = 'MODE_3D_VIEW';
export const MODE_3D_FIRST_PERSON = 'MODE_3D_FIRST_PERSON';
export const MODE_WAITING_DRAWING_LINE = 'MODE_WAITING_DRAWING_LINE';
export const MODE_DRAGGING_LINE = 'MODE_DRAGGING_LINE';
export const MODE_DRAGGING_VERTEX = 'MODE_DRAGGING_VERTEX';
export const MODE_DRAGGING_ITEM = 'MODE_DRAGGING_ITEM';
export const MODE_DRAGGING_HOLE = 'MODE_DRAGGING_HOLE';
export const MODE_DRAWING_LINE = 'MODE_DRAWING_LINE';
export const MODE_DRAWING_HOLE = 'MODE_DRAWING_HOLE';
export const MODE_DRAWING_ITEM = 'MODE_DRAWING_ITEM';
export const MODE_ROTATING_ITEM = 'MODE_ROTATING_ITEM';
export const MODE_UPLOADING_IMAGE = 'MODE_UPLOADING_IMAGE';
export const MODE_FITTING_IMAGE = 'MODE_FITTING_IMAGE';
export const MODE_VIEWING_CATALOG = 'MODE_VIEWING_CATALOG';
export const MODE_CONFIGURING_PROJECT = 'MODE_CONFIGURING_PROJECT';
export const MODE_CONFIGURING_LAYER = 'MODE_CONFIGURING_LAYER';

//unit
export const UNIT_MILLIMETER = 'mm';
export const UNIT_CENTIMETER = 'cm';
export const UNIT_METER = 'm';
export const UNIT_INCH = 'in';
export const UNIT_FOOT = 'ft';
export const UNIT_MILE = 'mi';

export const UNITS_LENGTH = [
  UNIT_MILLIMETER,
  UNIT_CENTIMETER,
  UNIT_METER,
  UNIT_INCH,
  UNIT_FOOT,
  UNIT_MILE
];

export const EPSILON = 1e-6;
<commit_msg>groupped actions<commit_after>// ACTIONS project
export const NEW_PROJECT = 'NEW_PROJECT';
export const LOAD_PROJECT = 'LOAD_PROJECT';
export const SAVE_PROJECT = 'SAVE_PROJECT';
export const OPEN_CATALOG = 'OPEN_CATALOG';
export const SELECT_TOOL_EDIT = 'SELECT_TOOL_EDIT';
export const UNSELECT_ALL = 'UNSELECT_ALL';
export const SET_PROPERTIES = 'SET_PROPERTIES';
export const SET_ITEMS_ATTRIBUTES = 'SET_ITEMS_ATTRIBUTES';
export const SET_LINES_ATTRIBUTES = 'SET_LINES_ATTRIBUTES';
export const SET_HOLES_ATTRIBUTES = 'SET_HOLES_ATTRIBUTES';
export const REMOVE = 'REMOVE';
export const UNDO = 'UNDO';
export const ROLLBACK = 'ROLLBACK';
export const SET_PROJECT_PROPERTIES = 'SET_PROJECT_PROPERTIES';
export const OPEN_PROJECT_CONFIGURATOR = 'OPEN_PROJECT_CONFIGURATOR';
export const INIT_CATALOG = 'INIT_CATALOG';

// ACTIONS viewer2D
export const SELECT_TOOL_ZOOM_IN = 'SELECT_TOOL_ZOOM_IN';
export const SELECT_TOOL_ZOOM_OUT = 'SELECT_TOOL_ZOOM_OUT';
export const SELECT_TOOL_PAN = 'SELECT_TOOL_PAN';
export const UPDATE_2D_CAMERA = 'UPDATE_2D_CAMERA';

//ACTIONS viewer3D
export const SELECT_TOOL_3D_VIEW = 'SELECT_TOOL_3D_VIEW';
export const SELECT_TOOL_3D_FIRST_PERSON = 'SELECT_TOOL_3D_FIRST_PERSON';

//ACTIONS items
export const SELECT_TOOL_DRAWING_ITEM = 'SELECT_TOOL_DRAWING_ITEM';
export const UPDATE_DRAWING_ITEM = 'UPDATE_DRAWING_ITEM';
export const END_DRAWING_ITEM = 'END_DRAWING_ITEM';
export const BEGIN_DRAGGING_ITEM = 'BEGIN_DRAGGING_ITEM';
export const UPDATE_DRAGGING_ITEM = 'UPDATE_DRAGGING_ITEM';
export const END_DRAGGING_ITEM = 'END_DRAGGING_ITEM';
export const BEGIN_ROTATING_ITEM = 'BEGIN_ROTATING_ITEM';
export const UPDATE_ROTATING_ITEM = 'UPDATE_ROTATING_ITEM';
export const END_ROTATING_ITEM = 'END_ROTATING_ITEM';

//ACTION drawings
export const SELECT_HOLE = 'SELECT_HOLE';
export const SELECT_AREA = 'SELECT_AREA';
export const SELECT_ITEM = 'SELECT_ITEM';
export const SELECT_LINE = 'SELECT_LINE';
export const SELECT_TOOL_DRAWING_LINE = 'SELECT_TOOL_DRAWING_LINE';
export const BEGIN_DRAWING_LINE = 'BEGIN_DRAWING_LINE';
export const UPDATE_DRAWING_LINE = 'UPDATE_DRAWING_LINE';
export const END_DRAWING_LINE = 'END_DRAWING_LINE';
export const SELECT_TOOL_DRAWING_HOLE = 'SELECT_TOOL_DRAWING_HOLE';
export const UPDATE_DRAWING_HOLE = 'UPDATE_DRAWING_HOLE';
export const END_DRAWING_HOLE = 'END_DRAWING_HOLE';
export const BEGIN_DRAGGING_LINE = 'BEGIN_DRAGGING_LINE';
export const UPDATE_DRAGGING_LINE = 'UPDATE_DRAGGING_LINE';
export const END_DRAGGING_LINE = 'END_DRAGGING_LINE';
export const SELECT_TOOL_UPLOAD_IMAGE = 'SELECT_TOOL_UPLOAD_IMAGE';
export const BEGIN_UPLOADING_IMAGE = 'BEGIN_UPLOADING_IMAGE';
export const END_UPLOADING_IMAGE = 'END_UPLOADING_IMAGE';
export const BEGIN_FITTING_IMAGE = 'BEGIN_FITTING_IMAGE';
export const END_FITTING_IMAGE = 'END_FITTING_IMAGE';
export const BEGIN_DRAGGING_HOLE = 'BEGIN_DRAGGING_HOLE';
export const UPDATE_DRAGGING_HOLE = 'UPDATE_DRAGGING_HOLE';
export const END_DRAGGING_HOLE = 'END_DRAGGING_HOLE';

//ACTIONS vertices
export const BEGIN_DRAGGING_VERTEX = 'BEGIN_DRAGGING_VERTEX';
export const UPDATE_DRAGGING_VERTEX = 'UPDATE_DRAGGING_VERTEX';
export const END_DRAGGING_VERTEX = 'END_DRAGGING_VERTEX';

//ACTIONS scene
export const SET_LAYER_PROPERTIES = 'SET_LAYER_PROPERTIES';
export const ADD_LAYER = 'ADD_LAYER';
export const SELECT_LAYER = 'SELECT_LAYER';
export const OPEN_LAYER_CONFIGURATOR = 'OPEN_LAYER_CONFIGURATOR';
export const REMOVE_LAYER = 'REMOVE_LAYER';

//GROUPING ACTIONS
export const PROJECT_ACTIONS = {
  NEW_PROJECT,
  LOAD_PROJECT,
  SAVE_PROJECT,
  OPEN_CATALOG,
  SELECT_TOOL_EDIT,
  UNSELECT_ALL,
  SET_PROPERTIES,
  SET_ITEMS_ATTRIBUTES,
  SET_LINES_ATTRIBUTES,
  SET_HOLES_ATTRIBUTES,
  REMOVE,
  UNDO,
  ROLLBACK,
  SET_PROJECT_PROPERTIES,
  OPEN_PROJECT_CONFIGURATOR,
  INIT_CATALOG
};

export const VIEWER2D_ACTIONS = {
  SELECT_TOOL_ZOOM_IN,
  SELECT_TOOL_ZOOM_OUT,
  SELECT_TOOL_PAN,
  UPDATE_2D_CAMERA
};

export const VIEWER3D_ACTIONS = {
  SELECT_TOOL_3D_VIEW,
  SELECT_TOOL_3D_FIRST_PERSON
};

export const ITEMS_ACTIONS = {
  SELECT_TOOL_DRAWING_ITEM,
  UPDATE_DRAWING_ITEM,
  END_DRAWING_ITEM,
  BEGIN_DRAGGING_ITEM,
  UPDATE_DRAGGING_ITEM,
  END_DRAGGING_ITEM,
  BEGIN_ROTATING_ITEM,
  UPDATE_ROTATING_ITEM,
  END_ROTATING_ITEM
};

export const HOLE_ACTIONS = {
  SELECT_HOLE,
  SELECT_TOOL_DRAWING_HOLE,
  UPDATE_DRAWING_HOLE,
  END_DRAWING_HOLE,
  BEGIN_DRAGGING_HOLE,
  UPDATE_DRAGGING_HOLE,
  END_DRAGGING_HOLE
};

export const LINE_ACTIONS = {
  SELECT_LINE,
  SELECT_TOOL_DRAWING_LINE,
  BEGIN_DRAWING_LINE,
  UPDATE_DRAWING_LINE,
  END_DRAWING_LINE,
  BEGIN_DRAGGING_LINE,
  UPDATE_DRAGGING_LINE,
  END_DRAGGING_LINE
}

export const AREA_ACTIONS = {
  SELECT_AREA
}

export const SCENE_ACTIONS = {
  ADD_LAYER,
  SET_LAYER_PROPERTIES,
  SELECT_LAYER,
  OPEN_LAYER_CONFIGURATOR,
  REMOVE_LAYER
};

export const VERTEX_ACTIONS = {
  BEGIN_DRAGGING_VERTEX,
  UPDATE_DRAGGING_VERTEX,
  END_DRAGGING_VERTEX
};

//MODES
export const MODE_IDLE = 'IDLE';
export const MODE_2D_ZOOM_IN = 'MODE_2D_ZOOM_IN';
export const MODE_2D_ZOOM_OUT = 'MODE_2D_ZOOM_OUT';
export const MODE_2D_PAN = 'MODE_2D_PAN';
export const MODE_3D_VIEW = 'MODE_3D_VIEW';
export const MODE_3D_FIRST_PERSON = 'MODE_3D_FIRST_PERSON';
export const MODE_WAITING_DRAWING_LINE = 'MODE_WAITING_DRAWING_LINE';
export const MODE_DRAGGING_LINE = 'MODE_DRAGGING_LINE';
export const MODE_DRAGGING_VERTEX = 'MODE_DRAGGING_VERTEX';
export const MODE_DRAGGING_ITEM = 'MODE_DRAGGING_ITEM';
export const MODE_DRAGGING_HOLE = 'MODE_DRAGGING_HOLE';
export const MODE_DRAWING_LINE = 'MODE_DRAWING_LINE';
export const MODE_DRAWING_HOLE = 'MODE_DRAWING_HOLE';
export const MODE_DRAWING_ITEM = 'MODE_DRAWING_ITEM';
export const MODE_ROTATING_ITEM = 'MODE_ROTATING_ITEM';
export const MODE_UPLOADING_IMAGE = 'MODE_UPLOADING_IMAGE';
export const MODE_FITTING_IMAGE = 'MODE_FITTING_IMAGE';
export const MODE_VIEWING_CATALOG = 'MODE_VIEWING_CATALOG';
export const MODE_CONFIGURING_PROJECT = 'MODE_CONFIGURING_PROJECT';
export const MODE_CONFIGURING_LAYER = 'MODE_CONFIGURING_LAYER';

//UNITS
export const UNIT_MILLIMETER = 'mm';
export const UNIT_CENTIMETER = 'cm';
export const UNIT_METER = 'm';
export const UNIT_INCH = 'in';
export const UNIT_FOOT = 'ft';
export const UNIT_MILE = 'mi';

export const UNITS_LENGTH = [
  UNIT_MILLIMETER,
  UNIT_CENTIMETER,
  UNIT_METER,
  UNIT_INCH,
  UNIT_FOOT,
  UNIT_MILE
];

export const EPSILON = 1e-6;
<|endoftext|>


<commit_before>import deepFreeze from 'deep-freeze';

export const actions = deepFreeze({
  ASSIGN_WORK: 'ASSIGN_WORK',
  AUTHENTICATE: 'AUTHENTICATE',
  AUTH_FAILED: 'AUTH_FAILED',
  CONNECT: 'CONNECT',
  CONNECTION_CLOSED: 'CONNECTION_CLOSED',
  UPDATE_WORKER_STATE: 'UPDATE_WORKER_STATE',
  LOG_MESSAGE: 'LOG_MESSAGE',
  ICON_CLICKED: 'ICON_CLICKED',
  WORK_STARTED: 'WORK_STARTED',
  WORK_FINISHED: 'WORK_FINISHED',
  SET_PLUGIN_VERSION: 'SET_PLUGIN_VERSION',
  START_POLLING: 'START_POLLING',
  STOP_POLLING: 'STOP_POLLING',
  SET_POLLING_INTERVAL: 'SET_POLLING_INTERVAL',
  CAPTCHA_REQUIRED: 'CAPTCHA_REQUIRED',
  SET_WORKER_PROFILE: 'SET_WORKER_PROFILE',
  RATE_LIMIT_EXCEEDED: 'RATE_LIMIT_EXCEEDED',
  CHANNEL_LEFT: 'CHANNEL_LEFT',
  SET_OPTIONS: 'SET_OPTIONS',
  RELOAD_PLUGIN: 'RELOAD_PLUGIN',
});

export const colors = deepFreeze({
  RED: [255, 0, 0, 230],
  GREEN: 'green',
  GREY: [0, 0, 0, 230],
});

export const REDUCERS = deepFreeze(['worker', 'socket', 'plugin', 'polling']);

export const DEFAULT_POLLING_INTERVAL = 30 * 1000;

export const NOTIFICATION_SOUND_URL = 'notificationSoundUrl';
export const NOTIFICATION_SOUND_REPEAT = 'notificationSoundRepeat';

const getChromeConfig = () => (
  {
    notificationIconUrl: window.CHROME_NOTIFICATION_ICON_URL,
    greyIcon: window.CHROME_GREY_ICON,
    colorIcon: window.CHROME_COLOR_ICON,
  }
);

const getConfig = () => {
  switch (window.ENV) {
    case 'dev':
      return {
        env: 'dev',
        socketURL: 'ws://localhost:4000/socket',
        profileUrl: 'http://portal.rainforest.dev/profile',
        workAvailableEndpoint: 'http://portal.rainforest.dev/api/1/testers',
        chrome: getChromeConfig(),
        ravenURL: 'BOGUS',
      };
    case 'staging':
      return {
        env: 'staging',
        socketURL: 'wss://schrute.rnfrst.com/socket',
        profileUrl: 'https://portal.rnfrst.com/profile',
        workAvailableEndpoint: 'https://portal.rainforestqa.com/api/1/testers',
        chrome: getChromeConfig(),
        ravenURL: 'https://0f911298f80c47d9b53d3e6a53d236e5@app.getsentry.com/88435',
      };
    case 'prod':
      return {
        env: 'prod',
        socketURL: 'wss://schrute.rainforestqa.com/socket',
        profileUrl: 'https://portal.rainforestqa.com/profile',
        workAvailableEndpoint: 'https://bouncer.rainforestqa.com/1/testers',
        chrome: getChromeConfig(),
        ravenURL: 'https://a7b0c76390cc47208e38b884fd60ff3d@sentry.io/68477',
      };
    default:
      return {
        env: 'test',
        socketURL: 'ws://localhost:4000/socket',
        profileUrl: 'http://portal.rainforest.dev/profile',
        workAvailableEndpoint: 'http://portal.rainforest.dev/api/1/testers',
        chrome: {
          notificationIconUrl: 'bogusNotifications.png',
          greyIcon: { path: 'GREY' },
          colorIcon: { path: 'COLOR' },
        },
        ravenURL: 'BOGUS',
      };
  }
};

export const CONFIG = deepFreeze(getConfig());
<commit_msg>Update sentry DSN<commit_after>import deepFreeze from 'deep-freeze';

export const actions = deepFreeze({
  ASSIGN_WORK: 'ASSIGN_WORK',
  AUTHENTICATE: 'AUTHENTICATE',
  AUTH_FAILED: 'AUTH_FAILED',
  CONNECT: 'CONNECT',
  CONNECTION_CLOSED: 'CONNECTION_CLOSED',
  UPDATE_WORKER_STATE: 'UPDATE_WORKER_STATE',
  LOG_MESSAGE: 'LOG_MESSAGE',
  ICON_CLICKED: 'ICON_CLICKED',
  WORK_STARTED: 'WORK_STARTED',
  WORK_FINISHED: 'WORK_FINISHED',
  SET_PLUGIN_VERSION: 'SET_PLUGIN_VERSION',
  START_POLLING: 'START_POLLING',
  STOP_POLLING: 'STOP_POLLING',
  SET_POLLING_INTERVAL: 'SET_POLLING_INTERVAL',
  CAPTCHA_REQUIRED: 'CAPTCHA_REQUIRED',
  SET_WORKER_PROFILE: 'SET_WORKER_PROFILE',
  RATE_LIMIT_EXCEEDED: 'RATE_LIMIT_EXCEEDED',
  CHANNEL_LEFT: 'CHANNEL_LEFT',
  SET_OPTIONS: 'SET_OPTIONS',
  RELOAD_PLUGIN: 'RELOAD_PLUGIN',
});

export const colors = deepFreeze({
  RED: [255, 0, 0, 230],
  GREEN: 'green',
  GREY: [0, 0, 0, 230],
});

export const REDUCERS = deepFreeze(['worker', 'socket', 'plugin', 'polling']);

export const DEFAULT_POLLING_INTERVAL = 30 * 1000;

export const NOTIFICATION_SOUND_URL = 'notificationSoundUrl';
export const NOTIFICATION_SOUND_REPEAT = 'notificationSoundRepeat';

const getChromeConfig = () => (
  {
    notificationIconUrl: window.CHROME_NOTIFICATION_ICON_URL,
    greyIcon: window.CHROME_GREY_ICON,
    colorIcon: window.CHROME_COLOR_ICON,
  }
);

const getConfig = () => {
  switch (window.ENV) {
    case 'dev':
      return {
        env: 'dev',
        socketURL: 'ws://localhost:4000/socket',
        profileUrl: 'http://portal.rainforest.dev/profile',
        workAvailableEndpoint: 'http://portal.rainforest.dev/api/1/testers',
        chrome: getChromeConfig(),
        ravenURL: 'BOGUS',
      };
    case 'staging':
      return {
        env: 'staging',
        socketURL: 'wss://schrute.rnfrst.com/socket',
        profileUrl: 'https://portal.rnfrst.com/profile',
        workAvailableEndpoint: 'https://portal.rainforestqa.com/api/1/testers',
        chrome: getChromeConfig(),
        ravenURL: 'https://7f2a3dc2e6644d98a2411c6883724589@sentry.io/68477',
      };
    case 'prod':
      return {
        env: 'prod',
        socketURL: 'wss://schrute.rainforestqa.com/socket',
        profileUrl: 'https://portal.rainforestqa.com/profile',
        workAvailableEndpoint: 'https://bouncer.rainforestqa.com/1/testers',
        chrome: getChromeConfig(),
        ravenURL: 'https://a7b0c76390cc47208e38b884fd60ff3d@sentry.io/68477',
      };
    default:
      return {
        env: 'test',
        socketURL: 'ws://localhost:4000/socket',
        profileUrl: 'http://portal.rainforest.dev/profile',
        workAvailableEndpoint: 'http://portal.rainforest.dev/api/1/testers',
        chrome: {
          notificationIconUrl: 'bogusNotifications.png',
          greyIcon: { path: 'GREY' },
          colorIcon: { path: 'COLOR' },
        },
        ravenURL: 'BOGUS',
      };
  }
};

export const CONFIG = deepFreeze(getConfig());
<|endoftext|>


<commit_before>import { get, set, observer, computed } from '@ember/object';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import C from 'ui/utils/constants';
import layout from './template';

export default Component.extend({
  layout,

  // Inputs
  instance:           null,
  errors:             null,
  editing:            true,
  service:            null,

  intl: service(),

  init() {
    this._super(...arguments);
    this.initTerminal();
  },

  // ----------------------------------
  // Terminal
  // ----------------------------------
  terminal: null, //'both',
  initTerminal: function() {
    var instance = get(this, 'instance');
    var tty = get(instance, 'tty');
    var stdin = get(instance, 'stdin');
    var out = {
      type: 'both',
      name: get(this, 'intl').tHtml('formCommand.console.both'),
    };

    if ( tty !== undefined || stdin !== undefined )
    {
      if ( tty && stdin )
      {
        out.type = 'both';
        out.name = get(this, 'intl').tHtml('formCommand.console.both');
      }
      else if ( tty )
      {
        out.type = 'terminal';
        out.name = get(this, 'intl').tHtml('formCommand.console.terminal');
      }
      else if ( stdin )
      {
        out.type = 'interactive';
        out.name = get(this, 'intl').tHtml('formCommand.console.interactive');
      }
      else
      {
        out.type = 'none';
        out.name = get(this, 'intl').tHtml('formCommand.console.none');
      }
    }

    set(this, 'terminal', out);
    this.terminalDidChange();
  },

  terminalDidChange: observer('terminal.type', function() {
    var val = get(this, 'terminal.type');
    var stdin = ( val === 'interactive' || val === 'both' );
    var tty = (val === 'terminal' || val === 'both');
    set(this, 'instance.tty', tty);
    set(this, 'instance.stdin', stdin);
  }),

  statusClass: null,
  status: null,
});
<commit_msg>Fix eslint issue<commit_after>import { get, set, observer } from '@ember/object';
import { inject as service } from '@ember/service';
import Component from '@ember/component';
import layout from './template';

export default Component.extend({
  layout,

  // Inputs
  instance:           null,
  errors:             null,
  editing:            true,
  service:            null,

  intl: service(),

  init() {
    this._super(...arguments);
    this.initTerminal();
  },

  // ----------------------------------
  // Terminal
  // ----------------------------------
  terminal: null, //'both',
  initTerminal: function() {
    var instance = get(this, 'instance');
    var tty = get(instance, 'tty');
    var stdin = get(instance, 'stdin');
    var out = {
      type: 'both',
      name: get(this, 'intl').tHtml('formCommand.console.both'),
    };

    if ( tty !== undefined || stdin !== undefined )
    {
      if ( tty && stdin )
      {
        out.type = 'both';
        out.name = get(this, 'intl').tHtml('formCommand.console.both');
      }
      else if ( tty )
      {
        out.type = 'terminal';
        out.name = get(this, 'intl').tHtml('formCommand.console.terminal');
      }
      else if ( stdin )
      {
        out.type = 'interactive';
        out.name = get(this, 'intl').tHtml('formCommand.console.interactive');
      }
      else
      {
        out.type = 'none';
        out.name = get(this, 'intl').tHtml('formCommand.console.none');
      }
    }

    set(this, 'terminal', out);
    this.terminalDidChange();
  },

  terminalDidChange: observer('terminal.type', function() {
    var val = get(this, 'terminal.type');
    var stdin = ( val === 'interactive' || val === 'both' );
    var tty = (val === 'terminal' || val === 'both');
    set(this, 'instance.tty', tty);
    set(this, 'instance.stdin', stdin);
  }),

  statusClass: null,
  status: null,
});
<|endoftext|>


<commit_before>export const REVISION = 'r129dev';
export const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
export const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
export const CullFaceNone = 0;
export const CullFaceBack = 1;
export const CullFaceFront = 2;
export const CullFaceFrontBack = 3;
export const BasicShadowMap = 0;
export const PCFShadowMap = 1;
export const PCFSoftShadowMap = 2;
export const VSMShadowMap = 3;
export const FrontSide = 0;
export const BackSide = 1;
export const DoubleSide = 2;
export const FlatShading = 1;
export const SmoothShading = 2;
export const NoBlending = 0;
export const NormalBlending = 1;
export const AdditiveBlending = 2;
export const SubtractiveBlending = 3;
export const MultiplyBlending = 4;
export const CustomBlending = 5;
export const AddEquation = 100;
export const SubtractEquation = 101;
export const ReverseSubtractEquation = 102;
export const MinEquation = 103;
export const MaxEquation = 104;
export const ZeroFactor = 200;
export const OneFactor = 201;
export const SrcColorFactor = 202;
export const OneMinusSrcColorFactor = 203;
export const SrcAlphaFactor = 204;
export const OneMinusSrcAlphaFactor = 205;
export const DstAlphaFactor = 206;
export const OneMinusDstAlphaFactor = 207;
export const DstColorFactor = 208;
export const OneMinusDstColorFactor = 209;
export const SrcAlphaSaturateFactor = 210;
export const NeverDepth = 0;
export const AlwaysDepth = 1;
export const LessDepth = 2;
export const LessEqualDepth = 3;
export const EqualDepth = 4;
export const GreaterEqualDepth = 5;
export const GreaterDepth = 6;
export const NotEqualDepth = 7;
export const MultiplyOperation = 0;
export const MixOperation = 1;
export const AddOperation = 2;
export const NoToneMapping = 0;
export const LinearToneMapping = 1;
export const ReinhardToneMapping = 2;
export const CineonToneMapping = 3;
export const ACESFilmicToneMapping = 4;
export const CustomToneMapping = 5;

export const UVMapping = 300;
export const CubeReflectionMapping = 301;
export const CubeRefractionMapping = 302;
export const EquirectangularReflectionMapping = 303;
export const EquirectangularRefractionMapping = 304;
export const CubeUVReflectionMapping = 306;
export const CubeUVRefractionMapping = 307;
export const RepeatWrapping = 1000;
export const ClampToEdgeWrapping = 1001;
export const MirroredRepeatWrapping = 1002;
export const NearestFilter = 1003;
export const NearestMipmapNearestFilter = 1004;
export const NearestMipMapNearestFilter = 1004;
export const NearestMipmapLinearFilter = 1005;
export const NearestMipMapLinearFilter = 1005;
export const LinearFilter = 1006;
export const LinearMipmapNearestFilter = 1007;
export const LinearMipMapNearestFilter = 1007;
export const LinearMipmapLinearFilter = 1008;
export const LinearMipMapLinearFilter = 1008;
export const UnsignedByteType = 1009;
export const ByteType = 1010;
export const ShortType = 1011;
export const UnsignedShortType = 1012;
export const IntType = 1013;
export const UnsignedIntType = 1014;
export const FloatType = 1015;
export const HalfFloatType = 1016;
export const UnsignedShort4444Type = 1017;
export const UnsignedShort5551Type = 1018;
export const UnsignedShort565Type = 1019;
export const UnsignedInt248Type = 1020;
export const AlphaFormat = 1021;
export const RGBFormat = 1022;
export const RGBAFormat = 1023;
export const LuminanceFormat = 1024;
export const LuminanceAlphaFormat = 1025;
export const RGBEFormat = RGBAFormat;
export const DepthFormat = 1026;
export const DepthStencilFormat = 1027;
export const RedFormat = 1028;
export const RedIntegerFormat = 1029;
export const RGFormat = 1030;
export const RGIntegerFormat = 1031;
export const RGBIntegerFormat = 1032;
export const RGBAIntegerFormat = 1033;

export const RGB_S3TC_DXT1_Format = 33776;
export const RGBA_S3TC_DXT1_Format = 33777;
export const RGBA_S3TC_DXT3_Format = 33778;
export const RGBA_S3TC_DXT5_Format = 33779;
export const RGB_PVRTC_4BPPV1_Format = 35840;
export const RGB_PVRTC_2BPPV1_Format = 35841;
export const RGBA_PVRTC_4BPPV1_Format = 35842;
export const RGBA_PVRTC_2BPPV1_Format = 35843;
export const RGB_ETC1_Format = 36196;
export const RGB_ETC2_Format = 37492;
export const RGBA_ETC2_EAC_Format = 37496;
export const RGBA_ASTC_4x4_Format = 37808;
export const RGBA_ASTC_5x4_Format = 37809;
export const RGBA_ASTC_5x5_Format = 37810;
export const RGBA_ASTC_6x5_Format = 37811;
export const RGBA_ASTC_6x6_Format = 37812;
export const RGBA_ASTC_8x5_Format = 37813;
export const RGBA_ASTC_8x6_Format = 37814;
export const RGBA_ASTC_8x8_Format = 37815;
export const RGBA_ASTC_10x5_Format = 37816;
export const RGBA_ASTC_10x6_Format = 37817;
export const RGBA_ASTC_10x8_Format = 37818;
export const RGBA_ASTC_10x10_Format = 37819;
export const RGBA_ASTC_12x10_Format = 37820;
export const RGBA_ASTC_12x12_Format = 37821;
export const RGBA_BPTC_Format = 36492;
export const SRGB8_ALPHA8_ASTC_4x4_Format = 37840;
export const SRGB8_ALPHA8_ASTC_5x4_Format = 37841;
export const SRGB8_ALPHA8_ASTC_5x5_Format = 37842;
export const SRGB8_ALPHA8_ASTC_6x5_Format = 37843;
export const SRGB8_ALPHA8_ASTC_6x6_Format = 37844;
export const SRGB8_ALPHA8_ASTC_8x5_Format = 37845;
export const SRGB8_ALPHA8_ASTC_8x6_Format = 37846;
export const SRGB8_ALPHA8_ASTC_8x8_Format = 37847;
export const SRGB8_ALPHA8_ASTC_10x5_Format = 37848;
export const SRGB8_ALPHA8_ASTC_10x6_Format = 37849;
export const SRGB8_ALPHA8_ASTC_10x8_Format = 37850;
export const SRGB8_ALPHA8_ASTC_10x10_Format = 37851;
export const SRGB8_ALPHA8_ASTC_12x10_Format = 37852;
export const SRGB8_ALPHA8_ASTC_12x12_Format = 37853;
export const LoopOnce = 2200;
export const LoopRepeat = 2201;
export const LoopPingPong = 2202;
export const InterpolateDiscrete = 2300;
export const InterpolateLinear = 2301;
export const InterpolateSmooth = 2302;
export const ZeroCurvatureEnding = 2400;
export const ZeroSlopeEnding = 2401;
export const WrapAroundEnding = 2402;
export const NormalAnimationBlendMode = 2500;
export const AdditiveAnimationBlendMode = 2501;
export const TrianglesDrawMode = 0;
export const TriangleStripDrawMode = 1;
export const TriangleFanDrawMode = 2;
export const LinearEncoding = 3000;
export const sRGBEncoding = 3001;
export const GammaEncoding = 3007;
export const RGBEEncoding = 3002;
export const LogLuvEncoding = 3003;
export const RGBM7Encoding = 3004;
export const RGBM16Encoding = 3005;
export const RGBDEncoding = 3006;
export const BasicDepthPacking = 3200;
export const RGBADepthPacking = 3201;
export const TangentSpaceNormalMap = 0;
export const ObjectSpaceNormalMap = 1;

export const ZeroStencilOp = 0;
export const KeepStencilOp = 7680;
export const ReplaceStencilOp = 7681;
export const IncrementStencilOp = 7682;
export const DecrementStencilOp = 7683;
export const IncrementWrapStencilOp = 34055;
export const DecrementWrapStencilOp = 34056;
export const InvertStencilOp = 5386;

export const NeverStencilFunc = 512;
export const LessStencilFunc = 513;
export const EqualStencilFunc = 514;
export const LessEqualStencilFunc = 515;
export const GreaterStencilFunc = 516;
export const NotEqualStencilFunc = 517;
export const GreaterEqualStencilFunc = 518;
export const AlwaysStencilFunc = 519;

export const StaticDrawUsage = 35044;
export const DynamicDrawUsage = 35048;
export const StreamDrawUsage = 35040;
export const StaticReadUsage = 35045;
export const DynamicReadUsage = 35049;
export const StreamReadUsage = 35041;
export const StaticCopyUsage = 35046;
export const DynamicCopyUsage = 35050;
export const StreamCopyUsage = 35042;

export const GLSL1 = '100';
export const GLSL3 = '300 es';
<commit_msg>Update constants.js<commit_after>export const REVISION = '129dev';
export const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
export const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
export const CullFaceNone = 0;
export const CullFaceBack = 1;
export const CullFaceFront = 2;
export const CullFaceFrontBack = 3;
export const BasicShadowMap = 0;
export const PCFShadowMap = 1;
export const PCFSoftShadowMap = 2;
export const VSMShadowMap = 3;
export const FrontSide = 0;
export const BackSide = 1;
export const DoubleSide = 2;
export const FlatShading = 1;
export const SmoothShading = 2;
export const NoBlending = 0;
export const NormalBlending = 1;
export const AdditiveBlending = 2;
export const SubtractiveBlending = 3;
export const MultiplyBlending = 4;
export const CustomBlending = 5;
export const AddEquation = 100;
export const SubtractEquation = 101;
export const ReverseSubtractEquation = 102;
export const MinEquation = 103;
export const MaxEquation = 104;
export const ZeroFactor = 200;
export const OneFactor = 201;
export const SrcColorFactor = 202;
export const OneMinusSrcColorFactor = 203;
export const SrcAlphaFactor = 204;
export const OneMinusSrcAlphaFactor = 205;
export const DstAlphaFactor = 206;
export const OneMinusDstAlphaFactor = 207;
export const DstColorFactor = 208;
export const OneMinusDstColorFactor = 209;
export const SrcAlphaSaturateFactor = 210;
export const NeverDepth = 0;
export const AlwaysDepth = 1;
export const LessDepth = 2;
export const LessEqualDepth = 3;
export const EqualDepth = 4;
export const GreaterEqualDepth = 5;
export const GreaterDepth = 6;
export const NotEqualDepth = 7;
export const MultiplyOperation = 0;
export const MixOperation = 1;
export const AddOperation = 2;
export const NoToneMapping = 0;
export const LinearToneMapping = 1;
export const ReinhardToneMapping = 2;
export const CineonToneMapping = 3;
export const ACESFilmicToneMapping = 4;
export const CustomToneMapping = 5;

export const UVMapping = 300;
export const CubeReflectionMapping = 301;
export const CubeRefractionMapping = 302;
export const EquirectangularReflectionMapping = 303;
export const EquirectangularRefractionMapping = 304;
export const CubeUVReflectionMapping = 306;
export const CubeUVRefractionMapping = 307;
export const RepeatWrapping = 1000;
export const ClampToEdgeWrapping = 1001;
export const MirroredRepeatWrapping = 1002;
export const NearestFilter = 1003;
export const NearestMipmapNearestFilter = 1004;
export const NearestMipMapNearestFilter = 1004;
export const NearestMipmapLinearFilter = 1005;
export const NearestMipMapLinearFilter = 1005;
export const LinearFilter = 1006;
export const LinearMipmapNearestFilter = 1007;
export const LinearMipMapNearestFilter = 1007;
export const LinearMipmapLinearFilter = 1008;
export const LinearMipMapLinearFilter = 1008;
export const UnsignedByteType = 1009;
export const ByteType = 1010;
export const ShortType = 1011;
export const UnsignedShortType = 1012;
export const IntType = 1013;
export const UnsignedIntType = 1014;
export const FloatType = 1015;
export const HalfFloatType = 1016;
export const UnsignedShort4444Type = 1017;
export const UnsignedShort5551Type = 1018;
export const UnsignedShort565Type = 1019;
export const UnsignedInt248Type = 1020;
export const AlphaFormat = 1021;
export const RGBFormat = 1022;
export const RGBAFormat = 1023;
export const LuminanceFormat = 1024;
export const LuminanceAlphaFormat = 1025;
export const RGBEFormat = RGBAFormat;
export const DepthFormat = 1026;
export const DepthStencilFormat = 1027;
export const RedFormat = 1028;
export const RedIntegerFormat = 1029;
export const RGFormat = 1030;
export const RGIntegerFormat = 1031;
export const RGBIntegerFormat = 1032;
export const RGBAIntegerFormat = 1033;

export const RGB_S3TC_DXT1_Format = 33776;
export const RGBA_S3TC_DXT1_Format = 33777;
export const RGBA_S3TC_DXT3_Format = 33778;
export const RGBA_S3TC_DXT5_Format = 33779;
export const RGB_PVRTC_4BPPV1_Format = 35840;
export const RGB_PVRTC_2BPPV1_Format = 35841;
export const RGBA_PVRTC_4BPPV1_Format = 35842;
export const RGBA_PVRTC_2BPPV1_Format = 35843;
export const RGB_ETC1_Format = 36196;
export const RGB_ETC2_Format = 37492;
export const RGBA_ETC2_EAC_Format = 37496;
export const RGBA_ASTC_4x4_Format = 37808;
export const RGBA_ASTC_5x4_Format = 37809;
export const RGBA_ASTC_5x5_Format = 37810;
export const RGBA_ASTC_6x5_Format = 37811;
export const RGBA_ASTC_6x6_Format = 37812;
export const RGBA_ASTC_8x5_Format = 37813;
export const RGBA_ASTC_8x6_Format = 37814;
export const RGBA_ASTC_8x8_Format = 37815;
export const RGBA_ASTC_10x5_Format = 37816;
export const RGBA_ASTC_10x6_Format = 37817;
export const RGBA_ASTC_10x8_Format = 37818;
export const RGBA_ASTC_10x10_Format = 37819;
export const RGBA_ASTC_12x10_Format = 37820;
export const RGBA_ASTC_12x12_Format = 37821;
export const RGBA_BPTC_Format = 36492;
export const SRGB8_ALPHA8_ASTC_4x4_Format = 37840;
export const SRGB8_ALPHA8_ASTC_5x4_Format = 37841;
export const SRGB8_ALPHA8_ASTC_5x5_Format = 37842;
export const SRGB8_ALPHA8_ASTC_6x5_Format = 37843;
export const SRGB8_ALPHA8_ASTC_6x6_Format = 37844;
export const SRGB8_ALPHA8_ASTC_8x5_Format = 37845;
export const SRGB8_ALPHA8_ASTC_8x6_Format = 37846;
export const SRGB8_ALPHA8_ASTC_8x8_Format = 37847;
export const SRGB8_ALPHA8_ASTC_10x5_Format = 37848;
export const SRGB8_ALPHA8_ASTC_10x6_Format = 37849;
export const SRGB8_ALPHA8_ASTC_10x8_Format = 37850;
export const SRGB8_ALPHA8_ASTC_10x10_Format = 37851;
export const SRGB8_ALPHA8_ASTC_12x10_Format = 37852;
export const SRGB8_ALPHA8_ASTC_12x12_Format = 37853;
export const LoopOnce = 2200;
export const LoopRepeat = 2201;
export const LoopPingPong = 2202;
export const InterpolateDiscrete = 2300;
export const InterpolateLinear = 2301;
export const InterpolateSmooth = 2302;
export const ZeroCurvatureEnding = 2400;
export const ZeroSlopeEnding = 2401;
export const WrapAroundEnding = 2402;
export const NormalAnimationBlendMode = 2500;
export const AdditiveAnimationBlendMode = 2501;
export const TrianglesDrawMode = 0;
export const TriangleStripDrawMode = 1;
export const TriangleFanDrawMode = 2;
export const LinearEncoding = 3000;
export const sRGBEncoding = 3001;
export const GammaEncoding = 3007;
export const RGBEEncoding = 3002;
export const LogLuvEncoding = 3003;
export const RGBM7Encoding = 3004;
export const RGBM16Encoding = 3005;
export const RGBDEncoding = 3006;
export const BasicDepthPacking = 3200;
export const RGBADepthPacking = 3201;
export const TangentSpaceNormalMap = 0;
export const ObjectSpaceNormalMap = 1;

export const ZeroStencilOp = 0;
export const KeepStencilOp = 7680;
export const ReplaceStencilOp = 7681;
export const IncrementStencilOp = 7682;
export const DecrementStencilOp = 7683;
export const IncrementWrapStencilOp = 34055;
export const DecrementWrapStencilOp = 34056;
export const InvertStencilOp = 5386;

export const NeverStencilFunc = 512;
export const LessStencilFunc = 513;
export const EqualStencilFunc = 514;
export const LessEqualStencilFunc = 515;
export const GreaterStencilFunc = 516;
export const NotEqualStencilFunc = 517;
export const GreaterEqualStencilFunc = 518;
export const AlwaysStencilFunc = 519;

export const StaticDrawUsage = 35044;
export const DynamicDrawUsage = 35048;
export const StreamDrawUsage = 35040;
export const StaticReadUsage = 35045;
export const DynamicReadUsage = 35049;
export const StreamReadUsage = 35041;
export const StaticCopyUsage = 35046;
export const DynamicCopyUsage = 35050;
export const StreamCopyUsage = 35042;

export const GLSL1 = '100';
export const GLSL3 = '300 es';
<|endoftext|>


<commit_before>/*#ifndef(UMD)*/
"use strict";
/*jshint -W098*/ // This is a constant list, they won't be used in here
/*jshint -W079*/ // Globals are also copied here
/*#endif*/

// TODO find a way to organize this list: either sorting or per source
/*global gpfSourcesPath*/ // Global source path
/*global _gpfVersion*/ // GPF version
/*global _gpfHost*/ // Host type
/*global _gpfDosPath*/ // DOS-like path
/*global _gpfContext*/ // Main context object
/*global _gpfExit*/ // Exit function
/*global _gpfResolveScope*/ // Translate the parameter into a valid scope
/*global _gpfBuildParamArray*/ // Build a parameter array
/*global _gpfDoApply*/ // Apply the parameter array through a function
/*global _gpfStringCapitalize*/ // Capitalize the string
/*global _gpfStringReplaceEx*/ // String replacement using dictionary map
/*global _gpfStringEscapeFor*/ // Make the string content compatible with lang
/*global _gpfIsArrayLike*/ // Return true if the parameter looks like an array
/*global _gpfInNode*/ // The current host is a nodeJS like
/*global _gpfInBrowser*/ // The current host is a browser like
/*global _gpfWebWindow*/ // Browser window object
/*global _gpfWebDocument*/ // Browser document object
/*global _gpfWebHead*/ // Browser head tag
/*global _gpfMsFSO*/ // Scripting.FileSystemObject activeX
/*global _gpfNodeFS*/ // Node FS module
/*global _gpfFSRead*/ // Phantom/Node File System read text file method (boot)
/*global _gpfEmptyFunc*/ // An empty function
/*global _gpfIgnore*/ // Helper to remove unused parameter warning
/*global _gpfFalseFunc*/ // An empty function returning false
/*global _gpfFunc*/ // Create a new function using the source
/*global _gpfMax31*/ // Max value on 31 bits
/*global _gpfMax32*/ // Max value on 32 bits
/*global _gpfAlpha*/ // Letters (lowercase)
/*global _gpfALPHA*/ // Letters (uppercase)
/*global _gpfDigit*/ // Digits
/*global _gpfIdentifierFirstChar*/ // allowed first char in an identifier
/*global _gpfIdentifierOtherChars*/ // allowed other chars in an identifier
/*global _gpfArraySlice*/ // Shortcut on Array.prototype.slice
/*global _gpfArrayOrItem*/ // Common way to code IReadOnlyArray::getItem
/*global _gpfJsKeywords*/ //  List of JavaScript keywords
/*global _gpfDefer*/ // Defer the execution of the callback
/*global _gpfJsonStringify*/ // JSON.stringify
/*global _gpfJsonParse*/ // JSON.parse
/*global _gpfErrorDeclare*/ // Declare new gpf.Error names
/*global _gpfGetClassDefinition*/ // Get GPF class definition for a constructor
/*global _gpfGenDefHandler*/ // Class handler for class types (interfaces...)
/*global _gpfA*/ // gpf.attributes
/*global _gpfDefAttr*/ // gpf.define for attributes
/*global _gpfANoSerial*/ // gpf.attributes.ClassNonSerializedAttribute
/*global _gpfArrayEachWithResult*/ //gpf.each implementation on array
/*global _gpfDictionaryEachWithResult*/ //gpf.each implementation on dictionary
/*global _gpfI*/ // gpf.interfaces
/*global _gpfDefIntrf*/ // gpf.define for interfaces
/*global _gpfArrayEnumerator*/ // Create an IEnumerator from an array
/*global _gpfEventsFire*/ // gpf.events.fire (internal, parameters must match)
/*global _GPF_EVENT_ANY*/ // gpf.events.EVENT_ANY
/*global _GPF_EVENT_ERROR*/ // gpf.events.EVENT_ERROR
/*global _GPF_EVENT_READY*/ // gpf.events.EVENT_READY
/*global _GPF_EVENT_DATA*/ // gpf.events.EVENT_DATA
/*global _GPF_EVENT_END_OF_DATA*/ // gpf.events.EVENT_END_OF_DATA
/*global _GPF_EVENT_CONTINUE*/ // gpf.events.EVENT_CONTINUE
/*global _GPF_EVENT_STOP*/ // gpf.events.EVENT_STOP
/*global _GPF_EVENT_STOPPED*/ // gpf.events.EVENT_STOPPED
/*global _gpfSetReadOnlyProperty*/ // gpf.setReadOnlyProperty

var
/*#ifdef(RELEASE)*/
    _gpfTypeofBoolean = "boolean",
    _gpfTypeofFunction = "function",
    _gpfTypeofNumber = "number",
    _gpfTypeofObject = "object",
    _gpfTypeofString = "string",
    _gpfTypeofUndefined = "undefined",
    _gpfUndefined = void 0,
    _gpfTrue = !!1,
    _gpfFalse = !_gpfTrue,
    _gpfNull = null,

    /*#define "boolean" _gpfTypeofBoolean*/
    /*#define "function" _gpfTypeofFunction*/
    /*#define "number" _gpfTypeofNumber*/
    /*#define "object" _gpfTypeofObject*/
    /*#define "string" _gpfTypeofString*/
    /*#define "undefined" _gpfTypeofUndefined*/
    /*#define undefined _gpfUndefined*/
    /*#define true _gpfTrue*/
    /*#define false _gpfFalse*/
    /*#define null _gpfNull*/
/*#endif*/

    //region Events

    _GPF_EVENT_ANY                 = "*",
    _GPF_EVENT_ERROR               = "error",
    _GPF_EVENT_READY               = "ready",
    _GPF_EVENT_DATA                = "data",
    _GPF_EVENT_END_OF_DATA         = "endOfData",
    _GPF_EVENT_CONTINUE            = "continue",
    _GPF_EVENT_STOP                = "stop",
    _GPF_EVENT_STOPPED             = "stopped",

    //endregion

    /**
     * @inheritdoc gpf#setReadOnlyProperty
     */
    _gpfSetReadOnlyProperty = gpf.setReadOnlyProperty,

    // https://github.com/jshint/jshint/issues/525
    _GpfFunc = Function, // avoid JSHint error

    /**
     * Helper to ignore unused parameter
     *
     * @param {*} param
     * @private
     */
    _gpfIgnore = _gpfEmptyFunc,

    /**
     * An empty function returning false
     *
     * @result {Boolean} False
     * @private
     */
    _gpfFalseFunc = function () {
        return false;
    },

    /**
     * Create a new function using the source
     * In DEBUG mode, it catches any error to signal the problem
     *
     * @param {String[]} [params=undefined] params Parameter names list
     * @param {String} source
     * @return {Function}
     * @private
     */
    _gpfFunc = function (params, source) {
        var args;
        if (undefined === source) {
            source = params;
            params = [];
        }
        gpf.ASSERT("string" === typeof source && source.length,
            "Source expected (or use _gpfEmptyFunc)");
/*#ifdef(DEBUG)*/
        try {
/*#endif*/
            if (0 === params.length) {
                return _GpfFunc(source);
            } else {
                args = [].concat(params);
                args.push(source);
                return _GpfFunc.apply(null, args);
            }
/*#ifdef(DEBUG)*/
        } catch (e) {
            console.error("An exception occurred compiling:\r\n" + source);
            return null;
        }
/*#endif*/
    },

    /**
     * Max value on 31 bits
     *
     * @type {Number}
     * @private
     */
    _gpfMax31 = 0x7FFFFFFF,

    /**
     * Max value on 32 bits
     *
     * @type {Number}
     * @private
     */
    _gpfMax32 =  0xFFFFFFFF,

    /**
     * Letters (lowercase)
     *
     * @type {String}
     * @private
     */
    _gpfAlpha = "abcdefghijklmnopqrstuvwxyz",

    /**
     * Letters (uppercase)
     *
     * @type {String}
     * @private
     */
    _gpfALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ",

    /**
     * Digits
     *
     * @type {String}
     * @private
     */
    _gpfDigit = "0123456789",

    /**
     * List of allowed first char in an identifier
     *
     * @type {String}
     * @private
     */
    _gpfIdentifierFirstChar = _gpfAlpha + _gpfALPHA + "_$",

    /**
     * List of allowed other chars in an identifier
     *
     * @type {String}
     * @private
     */
    _gpfIdentifierOtherChars = _gpfAlpha + _gpfALPHA + _gpfDigit + "_$",

    /**
     * List of JavaScript keywords
     *
     * @type {String[]}
     * @private
     */
    _gpfJsKeywords = ("break,case,catch,continue,debugger,default,delete,do,"
        + "else,finally,for,function,if,in,instanceof,new,return,switch,"
        + "this,throw,try,typeof,var,void,while,with").split(",")

    ;

/*#ifndef(UMD)*/
// Mandatory to support boot loading in a browser (removed when UMD is used)
gpf._constants = true;
/*#endif*/<commit_msg>FS constants<commit_after>/*#ifndef(UMD)*/
"use strict";
/*jshint -W098*/ // This is a constant list, they won't be used in here
/*jshint -W079*/ // Globals are also copied here
/*#endif*/

// TODO find a way to organize this list: either sorting or per source
/*global gpfSourcesPath*/ // Global source path
/*global _gpfVersion*/ // GPF version
/*global _gpfHost*/ // Host type
/*global _gpfDosPath*/ // DOS-like path
/*global _gpfContext*/ // Main context object
/*global _gpfExit*/ // Exit function
/*global _gpfResolveScope*/ // Translate the parameter into a valid scope
/*global _gpfBuildParamArray*/ // Build a parameter array
/*global _gpfDoApply*/ // Apply the parameter array through a function
/*global _gpfStringCapitalize*/ // Capitalize the string
/*global _gpfStringReplaceEx*/ // String replacement using dictionary map
/*global _gpfStringEscapeFor*/ // Make the string content compatible with lang
/*global _gpfIsArrayLike*/ // Return true if the parameter looks like an array
/*global _gpfInNode*/ // The current host is a nodeJS like
/*global _gpfInBrowser*/ // The current host is a browser like
/*global _gpfWebWindow*/ // Browser window object
/*global _gpfWebDocument*/ // Browser document object
/*global _gpfWebHead*/ // Browser head tag
/*global _gpfMsFSO*/ // Scripting.FileSystemObject activeX
/*global _gpfNodeFS*/ // Node FS module
/*global _gpfFSRead*/ // Phantom/Node File System read text file method (boot)
/*global _gpfEmptyFunc*/ // An empty function
/*global _gpfIgnore*/ // Helper to remove unused parameter warning
/*global _gpfFalseFunc*/ // An empty function returning false
/*global _gpfFunc*/ // Create a new function using the source
/*global _gpfMax31*/ // Max value on 31 bits
/*global _gpfMax32*/ // Max value on 32 bits
/*global _gpfAlpha*/ // Letters (lowercase)
/*global _gpfALPHA*/ // Letters (uppercase)
/*global _gpfDigit*/ // Digits
/*global _gpfIdentifierFirstChar*/ // allowed first char in an identifier
/*global _gpfIdentifierOtherChars*/ // allowed other chars in an identifier
/*global _gpfArraySlice*/ // Shortcut on Array.prototype.slice
/*global _gpfArrayOrItem*/ // Common way to code IReadOnlyArray::getItem
/*global _gpfJsKeywords*/ //  List of JavaScript keywords
/*global _gpfDefer*/ // Defer the execution of the callback
/*global _gpfJsonStringify*/ // JSON.stringify
/*global _gpfJsonParse*/ // JSON.parse
/*global _gpfErrorDeclare*/ // Declare new gpf.Error names
/*global _gpfGetClassDefinition*/ // Get GPF class definition for a constructor
/*global _gpfGenDefHandler*/ // Class handler for class types (interfaces...)
/*global _gpfA*/ // gpf.attributes
/*global _gpfDefAttr*/ // gpf.define for attributes
/*global _gpfANoSerial*/ // gpf.attributes.ClassNonSerializedAttribute
/*global _gpfArrayEachWithResult*/ //gpf.each implementation on array
/*global _gpfDictionaryEachWithResult*/ //gpf.each implementation on dictionary
/*global _gpfI*/ // gpf.interfaces
/*global _gpfDefIntrf*/ // gpf.define for interfaces
/*global _gpfArrayEnumerator*/ // Create an IEnumerator from an array
/*global _gpfEventsFire*/ // gpf.events.fire (internal, parameters must match)
/*global _GPF_EVENT_ANY*/ // gpf.events.EVENT_ANY
/*global _GPF_EVENT_ERROR*/ // gpf.events.EVENT_ERROR
/*global _GPF_EVENT_READY*/ // gpf.events.EVENT_READY
/*global _GPF_EVENT_DATA*/ // gpf.events.EVENT_DATA
/*global _GPF_EVENT_END_OF_DATA*/ // gpf.events.EVENT_END_OF_DATA
/*global _GPF_EVENT_CONTINUE*/ // gpf.events.EVENT_CONTINUE
/*global _GPF_EVENT_STOP*/ // gpf.events.EVENT_STOP
/*global _GPF_EVENT_STOPPED*/ // gpf.events.EVENT_STOPPED
/*global _GPF_FS_TYPE_NOT_FOUND*/ // gpf.fs.TYPE_NOT_FOUND
/*global _GPF_FS_TYPE_FILE*/ // gpf.fs.TYPE_FILE
/*global _GPF_FS_TYPE_DIRECTORY*/ // gpf.fs.TYPE_DIRECTORY
/*global _GPF_FS_TYPE_UNKNOWN*/ // gpf.fs.TYPE_UNKNOWN
/*global _gpfSetReadOnlyProperty*/ // gpf.setReadOnlyProperty

var
/*#ifdef(RELEASE)*/
    _gpfTypeofBoolean = "boolean",
    _gpfTypeofFunction = "function",
    _gpfTypeofNumber = "number",
    _gpfTypeofObject = "object",
    _gpfTypeofString = "string",
    _gpfTypeofUndefined = "undefined",
    _gpfUndefined = void 0,
    _gpfTrue = !!1,
    _gpfFalse = !_gpfTrue,
    _gpfNull = null,

    /*#define "boolean" _gpfTypeofBoolean*/
    /*#define "function" _gpfTypeofFunction*/
    /*#define "number" _gpfTypeofNumber*/
    /*#define "object" _gpfTypeofObject*/
    /*#define "string" _gpfTypeofString*/
    /*#define "undefined" _gpfTypeofUndefined*/
    /*#define undefined _gpfUndefined*/
    /*#define true _gpfTrue*/
    /*#define false _gpfFalse*/
    /*#define null _gpfNull*/
/*#endif*/

    //region Events

    _GPF_EVENT_ANY                  = "*",
    _GPF_EVENT_ERROR                = "error",
    _GPF_EVENT_READY                = "ready",
    _GPF_EVENT_DATA                 = "data",
    _GPF_EVENT_END_OF_DATA          = "endOfData",
    _GPF_EVENT_CONTINUE             = "continue",
    _GPF_EVENT_STOP                 = "stop",
    _GPF_EVENT_STOPPED              = "stopped",

    //endregion

    //region File system constants

    _GPF_FS_TYPE_NOT_FOUND          = 0,
    _GPF_FS_TYPE_FILE               = 1,
    _GPF_FS_TYPE_DIRECTORY          = 2,
    _GPF_FS_TYPE_UNKNOWN            = 99,

    //endregion

    /**
     * @inheritdoc gpf#setReadOnlyProperty
     */
    _gpfSetReadOnlyProperty = gpf.setReadOnlyProperty,

    // https://github.com/jshint/jshint/issues/525
    _GpfFunc = Function, // avoid JSHint error

    /**
     * Helper to ignore unused parameter
     *
     * @param {*} param
     * @private
     */
    _gpfIgnore = _gpfEmptyFunc,

    /**
     * An empty function returning false
     *
     * @result {Boolean} False
     * @private
     */
    _gpfFalseFunc = function () {
        return false;
    },

    /**
     * Create a new function using the source
     * In DEBUG mode, it catches any error to signal the problem
     *
     * @param {String[]} [params=undefined] params Parameter names list
     * @param {String} source
     * @return {Function}
     * @private
     */
    _gpfFunc = function (params, source) {
        var args;
        if (undefined === source) {
            source = params;
            params = [];
        }
        gpf.ASSERT("string" === typeof source && source.length,
            "Source expected (or use _gpfEmptyFunc)");
/*#ifdef(DEBUG)*/
        try {
/*#endif*/
            if (0 === params.length) {
                return _GpfFunc(source);
            } else {
                args = [].concat(params);
                args.push(source);
                return _GpfFunc.apply(null, args);
            }
/*#ifdef(DEBUG)*/
        } catch (e) {
            console.error("An exception occurred compiling:\r\n" + source);
            return null;
        }
/*#endif*/
    },

    /**
     * Max value on 31 bits
     *
     * @type {Number}
     * @private
     */
    _gpfMax31 = 0x7FFFFFFF,

    /**
     * Max value on 32 bits
     *
     * @type {Number}
     * @private
     */
    _gpfMax32 =  0xFFFFFFFF,

    /**
     * Letters (lowercase)
     *
     * @type {String}
     * @private
     */
    _gpfAlpha = "abcdefghijklmnopqrstuvwxyz",

    /**
     * Letters (uppercase)
     *
     * @type {String}
     * @private
     */
    _gpfALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ",

    /**
     * Digits
     *
     * @type {String}
     * @private
     */
    _gpfDigit = "0123456789",

    /**
     * List of allowed first char in an identifier
     *
     * @type {String}
     * @private
     */
    _gpfIdentifierFirstChar = _gpfAlpha + _gpfALPHA + "_$",

    /**
     * List of allowed other chars in an identifier
     *
     * @type {String}
     * @private
     */
    _gpfIdentifierOtherChars = _gpfAlpha + _gpfALPHA + _gpfDigit + "_$",

    /**
     * List of JavaScript keywords
     *
     * @type {String[]}
     * @private
     */
    _gpfJsKeywords = ("break,case,catch,continue,debugger,default,delete,do,"
        + "else,finally,for,function,if,in,instanceof,new,return,switch,"
        + "this,throw,try,typeof,var,void,while,with").split(",")

    ;

/*#ifndef(UMD)*/
// Mandatory to support boot loading in a browser (removed when UMD is used)
gpf._constants = true;
/*#endif*/<|endoftext|>


<commit_before>module.exports = {
  // version of widgets.css to use
  // https://c3-static.kambi.com/sb-mobileclient/widget-api/{widgetCssVersion}/resources/css/kambi/kambi/widgets.css
  widgetCssVersion: '1.0.0.58',
}
<commit_msg>updated widget css version<commit_after>module.exports = {
  // version of widgets.css to use
  // https://c3-static.kambi.com/sb-mobileclient/widget-api/{widgetCssVersion}/resources/css/kambi/kambi/widgets.css
  widgetCssVersion: '1.0.0.64',
}
<|endoftext|>


<commit_before>'use strict';

exports.API_BASE = 'https://discordapp.com/api';

/* May be changed with discord updates */
exports.EMOJI_PICKER_PATH = '#app-mount > div > div:nth-child(7)';
exports.EMOJI_BUTTON_CLASS = n(2367).emojiButton;
exports.CHANNEL_TEXTAREA_CLASS = n(2117).channelTextArea;
exports.LOCAL_STORAGE_MODULE = n(1786);
exports.EMOJI_STORAGE_MODULE = n(174).default;
exports.TRANSLATION_MODULE = n(3);
exports.TOKEN_KEY = n(0).TOKEN_KEY;
/* May be changed with discord updates.END */

exports.ELEMENT_SCROLLER_WRAP = '

';

exports.ELEMENT_SEARCH_INPUT = '<input type="text" placeholder="Find the perfect emoji" value="">';

exports.ELEMENT_SERVER_EMOJI_LIST = '
server.name
';
exports.ELEMENT_SERVER_EMOJI_LIST_ROW = '

';
exports.ELEMENT_SERVER_EMOJI_LIST_ROW_ENTRY = '

'; // max 10 per row

exports.REACTION_POPOUT_REGEX = /TOGGLE_REACTION_POPOUT_(\d+)/;
exports.CURRENT_SELECTED_CHANNEL_REGEX = /.*\/.+\/(\d+)/;
exports.IS_INBOX_REGEX = /\/channels\/@me\/\d+/;

exports.IS_NUMBER_REGEX = /\d+/;

exports.BETTER_EMOJIS_KEY = 'better-emojis';

/**
 * Default options HTTP Fetch jQuery
 *
 * @type {Object}
 */
exports.defaultFetchOptions = {
	method: 'GET'
};

function n(id) {
	return webpackJsonp([], [], [id]);
}
<commit_msg>Fixed textarea class<commit_after>'use strict';

exports.API_BASE = 'https://discordapp.com/api';

/* May be changed with discord updates */
exports.EMOJI_PICKER_PATH = '#app-mount > div > div:nth-child(7)';
exports.EMOJI_BUTTON_CLASS = n(2367).emojiButton;
exports.CHANNEL_TEXTAREA_CLASS = n(2367).channelTextArea;
exports.LOCAL_STORAGE_MODULE = n(1786);
exports.EMOJI_STORAGE_MODULE = n(174).default;
exports.TRANSLATION_MODULE = n(3);
exports.TOKEN_KEY = n(0).TOKEN_KEY;
/* May be changed with discord updates.END */

exports.ELEMENT_SCROLLER_WRAP = '

';

exports.ELEMENT_SEARCH_INPUT = '<input type="text" placeholder="Find the perfect emoji" value="">';

exports.ELEMENT_SERVER_EMOJI_LIST = '
server.name
';
exports.ELEMENT_SERVER_EMOJI_LIST_ROW = '

';
exports.ELEMENT_SERVER_EMOJI_LIST_ROW_ENTRY = '

'; // max 10 per row

exports.REACTION_POPOUT_REGEX = /TOGGLE_REACTION_POPOUT_(\d+)/;
exports.CURRENT_SELECTED_CHANNEL_REGEX = /.*\/.+\/(\d+)/;
exports.IS_INBOX_REGEX = /\/channels\/@me\/\d+/;

exports.IS_NUMBER_REGEX = /\d+/;

exports.BETTER_EMOJIS_KEY = 'better-emojis';

/**
 * Default options HTTP Fetch jQuery
 *
 * @type {Object}
 */
exports.defaultFetchOptions = {
	method: 'GET'
};

function n(id) {
	return webpackJsonp([], [], [id]);
}
<|endoftext|>