%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/bitrix/www/bitrix/js/main/imageeditor/external/photoeditorsdk/js/
Upload File :
Create Path :
Current File : /home/bitrix/www/bitrix/js/main/imageeditor/external/photoeditorsdk/js/photo-editor-sdk.js

(function webpackUniversalModuleDefinition(root, factory) {
	if(typeof exports === 'object' && typeof module === 'object')
		module.exports = factory();
	else if(typeof define === 'function' && define.amd)
		define([], factory);
	else if(typeof exports === 'object')
		exports["PhotoEditorSDK"] = factory();
	else
		root["PhotoEditorSDK"] = factory();
})(typeof self !== 'undefined' ? self : this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, {
/******/ 				configurable: false,
/******/ 				enumerable: true,
/******/ 				get: getter
/******/ 			});
/******/ 		}
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = 157);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {

module.exports = { "default": __webpack_require__(177), __esModule: true };

/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {

module.exports = { "default": __webpack_require__(194), __esModule: true };

/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {

module.exports = { "default": __webpack_require__(179), __esModule: true };

/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {

module.exports = { "default": __webpack_require__(182), __esModule: true };

/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */

module.exports = __webpack_require__(158).default;

/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {

module.exports = { "default": __webpack_require__(214), __esModule: true };

/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {

module.exports = { "default": __webpack_require__(202), __esModule: true };

/***/ }),
/* 7 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__primitives_stack__ = __webpack_require__(269);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* jshint unused: false */
/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * Base class for filters. Extendable via {@link PhotoEditorSDK.Filter#extend}
 * @class
 * @memberof PhotoEditorSDK
 */

var Filter = function (_Configurable) {
  _inherits(Filter, _Configurable);

  function Filter() {
    var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

    _classCallCheck(this, Filter);

    var _this = _possibleConstructorReturn(this, (Filter.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(Filter)).call(this, options, {
      intensity: {
        type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER,
        default: 1.0,
        setter: function setter(intensity) {
          this._stack && this._stack.setIntensity(intensity);
          return intensity;
        }
      },
      dirty: {
        type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].BOOLEAN,
        default: true
      }
    }));

    _this._stack = new __WEBPACK_IMPORTED_MODULE_5__primitives_stack__["a" /* default */](_this._options.intensity);
    return _this;
  }

  /**
   * Renders the filter
   * @param  {PhotoEditorSDK} sdk
   * @param  {PhotoEditorSDK.Engine.Texture} inputTexture
   * @param  {PhotoEditorSDK.Engine.RenderTexture} outputTexture
   * @return {Promise}
   */


  _createClass(Filter, [{
    key: 'render',
    value: function render(sdk, inputTexture, outputTexture) {
      var _this2 = this;

      return this._stack.render(sdk, inputTexture, outputTexture).then(function (response) {
        _this2.setDirty(false);
        return response;
      });
    }

    /**
     * Sets the dirtiness for the given renderer
     * @param {Boolean} dirty
     * @param {PhotoEditorSDK.Engine.BaseRenderer} renderer
     */

  }, {
    key: 'setDirtyForRenderer',
    value: function setDirtyForRenderer(dirty, renderer) {
      this._stack.setDirtyForRenderer(dirty, renderer);
    }

    /**
     * Frees the memory
     */

  }, {
    key: 'disposeRenderTextures',
    value: function disposeRenderTextures() {
      this._stack.disposeRenderTextures();
    }

    /**
     * Cleans this instance up
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      this._stack.dispose();
    }
  }]);

  return Filter;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Configurable"]);

/**
 * A unique string that identifies this filter
 * @type {String}
 */


Filter.identifier = null;

/**
 * If `isIdentity` is true, this filter does not do anything and can be seen as
 * the default filter.
 * @type {Boolean}
 */
Filter.isIdentity = false;

/**
 * This string is used by the UI
 * @type {String}
 */
Filter.displayName = null;

// Exposed classes
Filter.PrimitivesStack = __WEBPACK_IMPORTED_MODULE_5__primitives_stack__["a" /* default */];

/* harmony default export */ __webpack_exports__["a"] = (Filter);

/***/ }),
/* 8 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__brightness__ = __webpack_require__(271);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Brightness", function() { return __WEBPACK_IMPORTED_MODULE_0__brightness__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__contrast__ = __webpack_require__(273);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Contrast", function() { return __WEBPACK_IMPORTED_MODULE_1__contrast__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__color_matrix__ = __webpack_require__(275);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "ColorMatrixPrimitive", function() { return __WEBPACK_IMPORTED_MODULE_2__color_matrix__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__desaturation__ = __webpack_require__(277);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Desaturation", function() { return __WEBPACK_IMPORTED_MODULE_3__desaturation__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__gamma__ = __webpack_require__(279);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Gamma", function() { return __WEBPACK_IMPORTED_MODULE_4__gamma__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__glow__ = __webpack_require__(281);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Glow", function() { return __WEBPACK_IMPORTED_MODULE_5__glow__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__gobblin__ = __webpack_require__(283);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Gobblin", function() { return __WEBPACK_IMPORTED_MODULE_6__gobblin__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__grayscale__ = __webpack_require__(285);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Grayscale", function() { return __WEBPACK_IMPORTED_MODULE_7__grayscale__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__lookup_table__ = __webpack_require__(146);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "LookupTable", function() { return __WEBPACK_IMPORTED_MODULE_8__lookup_table__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__lookup_table_image__ = __webpack_require__(288);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "LookupTableImage", function() { return __WEBPACK_IMPORTED_MODULE_9__lookup_table_image__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__saturation__ = __webpack_require__(290);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Saturation", function() { return __WEBPACK_IMPORTED_MODULE_10__saturation__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__soft_color_overlay__ = __webpack_require__(292);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "SoftColorOverlay", function() { return __WEBPACK_IMPORTED_MODULE_11__soft_color_overlay__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__tone_curve__ = __webpack_require__(294);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "ToneCurve", function() { return __WEBPACK_IMPORTED_MODULE_12__tone_curve__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__x400__ = __webpack_require__(295);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "X400", function() { return __WEBPACK_IMPORTED_MODULE_13__x400__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__3d_lookup_table_image__ = __webpack_require__(297);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "ThreeDLookupTableImage", function() { return __WEBPACK_IMPORTED_MODULE_14__3d_lookup_table_image__["a"]; });
/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */

/**
 * Filter primitives are the core of filters. One filter consists of multiple filter primitives.
 * For an example, look at the implementation of a filter, e.g. {@link PhotoEditorSDK.Filters.A15Filter}
 * or see our documentation at {@link https://www.photoeditorsdk.com/documentation}.
 * @namespace PhotoEditorSDK.FilterPrimitives
 */
















/***/ }),
/* 9 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BATCH_SIZE; });
/* unused harmony export VERTEX_SIZE */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return VERTEX_BYTE_SIZE; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shared_log__ = __webpack_require__(30);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__lib_color__ = __webpack_require__(51);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__lib_math_matrix__ = __webpack_require__(125);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__lib_math_rectangle__ = __webpack_require__(126);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__lib_math_vector2__ = __webpack_require__(42);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__lib_event_emitter__ = __webpack_require__(52);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__lib_utils__ = __webpack_require__(22);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__lib_gl_utils__ = __webpack_require__(127);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__constants__ = __webpack_require__(31);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_1__lib_color__["a"]; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return __WEBPACK_IMPORTED_MODULE_2__lib_math_matrix__["a"]; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return __WEBPACK_IMPORTED_MODULE_4__lib_math_vector2__["a"]; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return __WEBPACK_IMPORTED_MODULE_3__lib_math_rectangle__["a"]; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_5__lib_event_emitter__["a"]; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return __WEBPACK_IMPORTED_MODULE_0__shared_log__["a"]; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return __WEBPACK_IMPORTED_MODULE_6__lib_utils__["a"]; });
/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_8__constants__; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return __WEBPACK_IMPORTED_MODULE_7__lib_gl_utils__["a"]; });
/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */











var BATCH_SIZE = 2000;
var VERTEX_SIZE = 5;
var VERTEX_BYTE_SIZE = VERTEX_SIZE * 4;



/***/ }),
/* 10 */
/***/ (function(module, exports) {

var core = module.exports = { version: '2.5.3' };
if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef


/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {

var store = __webpack_require__(84)('wks');
var uid = __webpack_require__(64);
var Symbol = __webpack_require__(14).Symbol;
var USE_SYMBOL = typeof Symbol == 'function';

var $exports = module.exports = function (name) {
  return store[name] || (store[name] =
    USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
};

$exports.store = store;


/***/ }),
/* 12 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* jshint unused: false */
/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



/**
 * Base class for filter primitives.
 * @class
 * @memberof PhotoEditorSDK.FilterPrimitives
 */

var Primitive = function (_Configurable) {
  _inherits(Primitive, _Configurable);

  function Primitive() {
    _classCallCheck(this, Primitive);

    return _possibleConstructorReturn(this, (Primitive.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(Primitive)).apply(this, arguments));
  }

  _createClass(Primitive, [{
    key: 'update',

    /**
     * Gets called before this primitive's filter is being applied
     */
    value: function update() {}

    /**
     * Returns this primitive's filter
     * @return {PhotoEditorSDK.Engine.Filter}
     */

  }, {
    key: 'getFilter',
    value: function getFilter() {
      return this._filter;
    }

    /**
     * Cleans up this instance
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      if (this._filter) {
        this._filter.dispose();
        this._filter = null;
      }
    }
  }]);

  return Primitive;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Configurable"]);

/* harmony default export */ __webpack_exports__["a"] = (Primitive);

/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__(14);
var core = __webpack_require__(10);
var ctx = __webpack_require__(36);
var hide = __webpack_require__(26);
var PROTOTYPE = 'prototype';

var $export = function (type, name, source) {
  var IS_FORCED = type & $export.F;
  var IS_GLOBAL = type & $export.G;
  var IS_STATIC = type & $export.S;
  var IS_PROTO = type & $export.P;
  var IS_BIND = type & $export.B;
  var IS_WRAP = type & $export.W;
  var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
  var expProto = exports[PROTOTYPE];
  var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
  var key, own, out;
  if (IS_GLOBAL) source = name;
  for (key in source) {
    // contains in native
    own = !IS_FORCED && target && target[key] !== undefined;
    if (own && key in exports) continue;
    // export native or passed
    out = own ? target[key] : source[key];
    // prevent global pollution for namespaces
    exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
    // bind timers to global for call from export context
    : IS_BIND && own ? ctx(out, global)
    // wrap global constructors for prevent change them in library
    : IS_WRAP && target[key] == out ? (function (C) {
      var F = function (a, b, c) {
        if (this instanceof C) {
          switch (arguments.length) {
            case 0: return new C();
            case 1: return new C(a);
            case 2: return new C(a, b);
          } return new C(a, b, c);
        } return C.apply(this, arguments);
      };
      F[PROTOTYPE] = C[PROTOTYPE];
      return F;
    // make static versions for prototype methods
    })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
    // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
    if (IS_PROTO) {
      (exports.virtual || (exports.virtual = {}))[key] = out;
      // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
      if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
    }
  }
};
// type bitmap
$export.F = 1;   // forced
$export.G = 2;   // global
$export.S = 4;   // static
$export.P = 8;   // proto
$export.B = 16;  // bind
$export.W = 32;  // wrap
$export.U = 64;  // safe
$export.R = 128; // real proto method for `library`
module.exports = $export;


/***/ }),
/* 14 */
/***/ (function(module, exports) {

// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math
  ? window : typeof self != 'undefined' && self.Math == Math ? self
  // eslint-disable-next-line no-new-func
  : Function('return this')();
if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef


/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {

module.exports = { "default": __webpack_require__(197), __esModule: true };

/***/ }),
/* 16 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Randomizer; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */
/* global Date */

var Randomizer = function () {
  function Randomizer(seed) {
    _classCallCheck(this, Randomizer);

    this._seed = seed === undefined ? Randomizer.TimeSeed() : seed;
  }

  _createClass(Randomizer, [{
    key: "seed",
    value: function seed(value) {
      this._seed = value === undefined ? Randomizer.TimeSeed() : value;
    }
  }, {
    key: "next",
    value: function next() {
      var seed = this._seed | 0;
      var highPass = seed / Randomizer.SEED_DIVIDER | 0;
      var lowPass = seed % Randomizer.SEED_DIVIDER | 0;

      seed = Randomizer.SEED_LOW_MULTIPLY * lowPass - Randomizer.SEED_HIGH_MULTIPLY * highPass;

      if (seed <= 0) {
        seed += Randomizer.MAX;
      }

      if (seed === -1) {
        seed = Randomizer.MAX - 1;
      }

      this._seed = seed;

      return seed;
    }
  }, {
    key: "nextInRange",
    value: function nextInRange(min, max) {
      if (max === undefined) {
        max = min;
        min = 0;
      }

      return min + this.next() % (max - min + 1);
    }
  }, {
    key: "nextBool",
    value: function nextBool() {
      var falseChance = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
      var trueChance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;

      return this.nextInRange(falseChance + trueChance - 1) >= falseChance;
    }
  }, {
    key: "pickNext",
    value: function pickNext(array) {
      if (!Array.isArray(array)) {
        return null;
      }

      return array[this.next() % array.length];
    }
  }], [{
    key: "TimeSeed",
    value: function TimeSeed() {
      return Date.now();
    }
  }]);

  return Randomizer;
}();
Randomizer.MAX = 2147483647;
Randomizer.SEED_DIVIDER = 127773;
Randomizer.SEED_LOW_MULTIPLY = 16807;
Randomizer.SEED_HIGH_MULTIPLY = 2836;

/***/ }),
/* 17 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return RectangleInsets; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_photoeditorsdk_core__);



var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */


var Rectangle = __WEBPACK_IMPORTED_MODULE_2_photoeditorsdk_core__["Math"].Rectangle;


var RectangleInsets = function () {
  function RectangleInsets() {
    var top = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
    var left = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
    var bottom = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
    var right = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;

    _classCallCheck(this, RectangleInsets);

    this.top = top;
    this.left = left;
    this.bottom = bottom;
    this.right = right;
  }

  _createClass(RectangleInsets, [{
    key: 'multiply',
    value: function multiply(a) {
      this.top *= a;
      this.left *= a;
      this.bottom *= a;
      this.right *= a;
    }
  }, {
    key: 'toObject',
    value: function toObject() {
      return _extends({}, this);
    }
  }, {
    key: 'equals',
    value: function equals(r) {
      var eps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;

      return Math.abs(r.top - this.top) <= eps && Math.abs(r.left - this.left) <= eps && Math.abs(r.bottom - this.bottom) <= eps && Math.abs(r.right - this.right) <= eps;
    }
  }, {
    key: 'scale',
    value: function scale() {
      var sx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
      var sy = arguments[1];

      if (sy === undefined) {
        sy = sx;
      }

      this.top *= sy;
      this.bottom *= sy;
      this.left *= sx;
      this.right *= sx;

      return this;
    }
  }, {
    key: 'clone',
    value: function clone() {
      return new RectangleInsets(this.top, this.left, this.bottom, this.right);
    }
  }, {
    key: 'applyToRectangle',
    value: function applyToRectangle(rect) {
      return new Rectangle(rect.x + this.left, rect.y + this.top, rect.width - this.left - this.right, rect.height - this.top - this.bottom);
    }
  }], [{
    key: 'ZERO',
    get: function get() {
      return new RectangleInsets(0, 0, 0, 0);
    }
  }]);

  return RectangleInsets;
}();

/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {

var isObject = __webpack_require__(24);
module.exports = function (it) {
  if (!isObject(it)) throw TypeError(it + ' is not an object!');
  return it;
};


/***/ }),
/* 19 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignRowSingle; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__text_design_row__ = __webpack_require__(59);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__rectangle_insets__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__text_text_design_font__ = __webpack_require__(60);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__text_design_element__ = __webpack_require__(43);






var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */







var TextDesignRowSingle = function (_TextDesignRow) {
  _inherits(TextDesignRowSingle, _TextDesignRow);

  function TextDesignRowSingle() {
    _classCallCheck(this, TextDesignRowSingle);

    return _possibleConstructorReturn(this, (TextDesignRowSingle.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignRowSingle)).apply(this, arguments));
  }

  _createClass(TextDesignRowSingle, [{
    key: '_calculateLayoutElements',
    value: function _calculateLayoutElements() {
      var _serializeOptions = this.serializeOptions(),
          attributes = _serializeOptions.attributes,
          imageInsets = _serializeOptions.imageInsets,
          size = _serializeOptions.size,
          width = _serializeOptions.width;
      // Get the line as a single string


      var text = this.getWords().joined(1)[0] || '';

      // Create a TextDesignFont and calculate dimensions to fit the text in the
      // row width
      var fontIdentifier = attributes.fontIdentifier;
      var font = new __WEBPACK_IMPORTED_MODULE_8__text_text_design_font__["a" /* TextDesignFont */]({ text: text, fontIdentifier: fontIdentifier });
      font.fitWidth(this._getTextFrame().width);

      // Update the row's height in _size
      var height = font.getTextMetrics().height + imageInsets.top + imageInsets.bottom;
      size.height = height;

      // Offset the text frame
      var frame = this._getTextFrame();

      var layoutElement = new __WEBPACK_IMPORTED_MODULE_9__text_design_element__["a" /* TextDesignElement */]({ text: text, frame: frame, font: font });

      return [layoutElement];
    }
  }]);

  return TextDesignRowSingle;
}(__WEBPACK_IMPORTED_MODULE_6__text_design_row__["a" /* TextDesignRow */]);

TextDesignRowSingle.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_6__text_design_row__["a" /* TextDesignRow */].prototype.availableOptions, {
  imageInsets: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].OBJECT, default: new __WEBPACK_IMPORTED_MODULE_7__rectangle_insets__["a" /* RectangleInsets */]() }
});

/***/ }),
/* 20 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AssetManager; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_promise__ = __webpack_require__(29);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_promise___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_promise__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_regenerator__ = __webpack_require__(356);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_regenerator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_regenerator__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__);







var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_promise___default.a(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_promise___default.a.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* global HTMLImageElement, WEBPACK */
/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



var Image = void 0;
if (true) {
  Image = window.Image;
}

var TextDesignAssetManager = function (_Configurable) {
  _inherits(TextDesignAssetManager, _Configurable);

  function TextDesignAssetManager() {
    _classCallCheck(this, TextDesignAssetManager);

    return _possibleConstructorReturn(this, (TextDesignAssetManager.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignAssetManager)).apply(this, arguments));
  }

  _createClass(TextDesignAssetManager, [{
    key: 'loadImages',
    value: function () {
      var _ref = _asyncToGenerator(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_regenerator___default.a.mark(function _callee(images) {
        var loaded, i, image;
        return __WEBPACK_IMPORTED_MODULE_4_babel_runtime_regenerator___default.a.wrap(function _callee$(_context) {
          while (1) {
            switch (_context.prev = _context.next) {
              case 0:
                loaded = [];
                i = 0;

              case 2:
                if (!(i < images.length)) {
                  _context.next = 10;
                  break;
                }

                image = images[i];
                _context.next = 6;
                return this.addImage(image.path, image.fullPath, image.image);

              case 6:
                loaded.push(image);

              case 7:
                i++;
                _context.next = 2;
                break;

              case 10:
                return _context.abrupt('return', loaded);

              case 11:
              case 'end':
                return _context.stop();
            }
          }
        }, _callee, this);
      }));

      function loadImages(_x) {
        return _ref.apply(this, arguments);
      }

      return loadImages;
    }()
  }, {
    key: 'addImage',
    value: function addImage(path, fullPath, image) {
      var crossOrigin = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'anonymous';

      var images = this.getImages();

      if (!image) {
        return new __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_promise___default.a(function (resolve, reject) {
          image = new Image();
          image.onload = function () {
            images[path] = { fullPath: fullPath, image: image };
            resolve({ fullPath: fullPath, image: image });
          };
          image.crossOrigin = __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Utils"].getCrossOriginValue(crossOrigin);
          image.onerror = reject;
          image.src = fullPath;
        });
      } else {
        images[path] = { fullPath: fullPath, image: image };
        return __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_promise___default.a.resolve({ fullPath: fullPath, image: image });
      }
    }
  }, {
    key: 'getImage',
    value: function getImage(path) {
      var images = this.getImages();
      var image = images[path];
      return image ? image.image : null;
    }
  }, {
    key: 'getVariation',
    value: function getVariation(identifier) {
      return this.getFonts()[identifier];
    }
  }, {
    key: 'addFont',
    value: function addFont(identifier, fontVariation) {
      var fonts = this.getFonts();
      fonts[identifier] = fontVariation;

      return fontVariation;
    }
  }]);

  return TextDesignAssetManager;
}(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Configurable"]);

TextDesignAssetManager.prototype.availableOptions = {
  images: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].OBJECT, default: {} },
  fonts: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].OBJECT, default: {} }
};

var AssetManager = new TextDesignAssetManager();

/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {

var anObject = __webpack_require__(18);
var IE8_DOM_DEFINE = __webpack_require__(110);
var toPrimitive = __webpack_require__(80);
var dP = Object.defineProperty;

exports.f = __webpack_require__(25) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  anObject(O);
  P = toPrimitive(P, true);
  anObject(Attributes);
  if (IE8_DOM_DEFINE) try {
    return dP(O, P, Attributes);
  } catch (e) { /* empty */ }
  if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
  if ('value' in Attributes) O[P] = Attributes.value;
  return O;
};


/***/ }),
/* 22 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_array_from__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_array_from___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_array_from__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_symbol_iterator__ = __webpack_require__(35);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_symbol_iterator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_symbol_iterator__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_symbol__ = __webpack_require__(39);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_symbol___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_symbol__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_promise__ = __webpack_require__(29);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_promise___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_promise__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_keys__ = __webpack_require__(69);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_keys___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_keys__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__base64__ = __webpack_require__(50);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__array_utils__ = __webpack_require__(207);









var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _typeof = typeof __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_symbol___default.a === "function" && typeof __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_symbol_iterator___default.a === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_symbol___default.a === "function" && obj.constructor === __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_symbol___default.a && obj !== __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_symbol___default.a.prototype ? "symbol" : typeof obj; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_array_from___default()(arr); } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* global HTMLElement, WEBPACK */
/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



/**
 * Provides utility functions for internal use
 * @class
 * @memberof PhotoEditorSDK
 * @private
 */

var Utils = function () {
  function Utils() {
    _classCallCheck(this, Utils);
  }

  _createClass(Utils, null, [{
    key: 'isArray',

    /**
     * Checks if the given object is an Array
     * @param  {Object}  object
     * @return {Boolean}
     */
    value: function isArray(object) {
      return Object.prototype.toString.call(object) === '[object Array]';
    }

    /**
     * Checks if a given object is a plain object (i.e., a literal object) or not.
     * @param {any} object
     * @returns Boolean
     */

  }, {
    key: 'isPlainObject',
    value: function isPlainObject(object) {
      if ((typeof object === 'undefined' ? 'undefined' : _typeof(object)) !== 'object' || !object) {
        return false;
      }

      if (typeof __WEBPACK_IMPORTED_MODULE_7_babel_runtime_core_js_object_get_prototype_of___default.a === 'function') {
        var proto = __WEBPACK_IMPORTED_MODULE_7_babel_runtime_core_js_object_get_prototype_of___default()(object);
        return proto === Object.prototype || proto === null;
      }

      return Object.prototype.toString.call(object) === '[object Object]';
    }

    /**
     * Checks whether the user agent represents a mobile device
     * @return {Boolean}
     */

  }, {
    key: 'isMobile',
    value: function isMobile() {
      if (typeof navigator === 'undefined') return false;

      var a = navigator.userAgent || navigator.vendor || window.opera;
      /* eslint-disable */
      return (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))
      );
      /* eslint-enable */
    }

    /**
     * Checks wether the platform target is a browser
     * @return {Boolean}
     */

  }, {
    key: 'isBrowser',
    value: function isBrowser() {
      return typeof window !== 'undefined';
    }

    /**
     * Checks wether the platform target is Nodejs
     * @return {Boolean}
     */

  }, {
    key: 'isNode',
    value: function isNode() {
      return typeof window === 'undefined' && typeof global !== 'undefined';
    }

    /**
     * Returns the given object's values as an array
     * @param {Object} object
     * @returns {Array<*>}
     */

  }, {
    key: 'values',
    value: function values(object) {
      var values = [];
      for (var key in object) {
        values.push(object[key]);
      }
      return values;
    }

    /**
     * Checks if the given object is a DOM element
     * @param  {Object}  o
     * @return {Boolean}
     */
    /* istanbul ignore next */

  }, {
    key: 'isDOMElement',
    value: function isDOMElement(o) {
      return (typeof HTMLElement === 'undefined' ? 'undefined' : _typeof(HTMLElement)) === 'object' ? o instanceof HTMLElement : o && (typeof o === 'undefined' ? 'undefined' : _typeof(o)) === 'object' && o !== null && o.nodeType === 1 && typeof o.nodeName === 'string';
    }

    /**
     * Checks if th given event is a touch event
     * @param  {Event}  e
     * @return {Boolean}
     */

  }, {
    key: 'isTouchEvent',
    value: function isTouchEvent(e) {
      return e.type.indexOf('touch') !== -1;
    }

    /**
     * Resizes the given vector to fit inside the given max size while maintaining
     * the aspect ratio
     * @param  {Vector2} vector
     * @param  {Vector2} max
     * @return {Vector2}
     */

  }, {
    key: 'resizeVectorToFit',
    value: function resizeVectorToFit(vector, max) {
      var scale = Math.min(max.x / vector.x, max.y / vector.y);
      var newSize = vector.clone().multiply(scale);
      return newSize;
    }
  }, {
    key: 'resizeVectorToFill',
    value: function resizeVectorToFill(vector, container) {
      var vectorRatio = vector.x / vector.y;
      var containerRatio = container.x / container.y;
      if (vectorRatio > containerRatio) {
        return container.clone().set(container.y * vectorRatio, container.y);
      } else {
        return container.clone().set(container.x, container.x / vectorRatio);
      }
    }

    /**
     * Checks if this value is extendable / can have keys
     * @param  {*}  val
     * @return {Boolean}
     */

  }, {
    key: 'isExtendable',
    value: function isExtendable(val) {
      return typeof val !== 'undefined' && val !== null && ((typeof val === 'undefined' ? 'undefined' : _typeof(val)) === 'object' || typeof val === 'function');
    }

    /**
     * Assigns own enumerable properties of source object(s) to the destination
     * object for all destination properties that resolve to undefined. Once a
     * property is set, additional values of the same property are ignored.
     * @param  {Object} object
     * @param  {Object} ...sources
     * @return {Object}
     */

  }, {
    key: 'defaults',
    value: function defaults(object) {
      // Shallow clone
      var newObject = {};
      for (var key in object) {
        newObject[key] = object[key];
      }

      // Clone sources

      for (var _len = arguments.length, sources = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
        sources[_key - 1] = arguments[_key];
      }

      for (var i = 0; i < sources.length; i++) {
        var source = sources[i];
        for (var _key2 in source) {
          if (typeof newObject[_key2] === 'undefined') {
            newObject[_key2] = source[_key2];
          }
        }
      }

      return newObject;
    }

    /**
     * Does a deep merge between a set of objects, from left to right. The merge is
     * deep in the sense that it goes recurseviley trough the objects own
     * properties. When it encounters an array, it only does a shallow copy of it.
     *
     * @param {Object} dest
     * @param {Object[]} sources
     * @returns {Object}
     */

  }, {
    key: 'deepMerge',
    value: function deepMerge(dest) {
      // deep merge between two objects only
      var _deepMerge = function _deepMerge(dest, source) {
        // If the source is undefined, return a copy of dest
        if (source === undefined) {
          return _deepMerge(null, dest);
        }

        // If the source is an array, return a shallow copy
        if (Array.isArray(source)) {
          return [].concat(_toConsumableArray(source));
        }

        // If the source is not a plain object, just return it
        if (!Utils.isPlainObject(source)) {
          return source;
        }

        // If dest is an not a plain object, return a shallow copy of the source
        if (!Utils.isPlainObject(dest)) {
          return _extends({}, source);
        }

        // Shallow-copy the original object
        var result = _extends({}, dest);

        // Go trough each source key
        __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_keys___default()(source).forEach(function (key) {
          var value = source[key];
          if (value === undefined) {
            return;
          }
          result[key] = _deepMerge(dest[key], value);
        });
        return result;
      };

      for (var _len2 = arguments.length, sources = Array(_len2 > 1 ? _len2 - 1 : 0), _key3 = 1; _key3 < _len2; _key3++) {
        sources[_key3 - 1] = arguments[_key3];
      }

      return sources.reduce(_deepMerge, dest);
    }

    /**
     * Assigns own enumerable properties of source object(s) to the destination
     * object for all destination properties and their properties that resolve to
     * undefined. Once a property is set, additional value sof the same property
     * are ignored.
     * @param  {Object} object
     * @param  {Object} ...sources
     * @return {Object}
     */

  }, {
    key: 'deepDefaults',
    value: function deepDefaults(object) {
      for (var _len3 = arguments.length, sources = Array(_len3 > 1 ? _len3 - 1 : 0), _key4 = 1; _key4 < _len3; _key4++) {
        sources[_key4 - 1] = arguments[_key4];
      }

      var reversedSources = [].concat(sources).reverse();
      return Utils.deepMerge.apply(Utils, _toConsumableArray(reversedSources).concat([object]));
    }

    /**
     * Creates a deep clone of the given object
     * @param  {Object}    object
     * @return {Object}
     */

  }, {
    key: 'deepClone',
    value: function deepClone(object) {
      var newObject = {};
      for (var key in object) {
        if (Utils.isExtendable(object[key])) {
          newObject[key] = Utils.deepClone(object[key]);
        } else {
          newObject[key] = object[key];
        }
      }
      return newObject;
    }

    /**
     * Get a deep property inside an object.
     *
     * @param {Object} object - the object
     * @param {String[]} path - Either a string with the prop's
     *  name, or an array of prop names and/or functions describing a path in a
     *  nested object. Any function passed in the array should function as a getter
     *  for a prop.
     *
     * @returns {(any|undefined)} - The prop's value, or undefined if the prop is
     * not found
     */

  }, {
    key: 'getDeepProperty',
    value: function getDeepProperty(object, path) {
      if (typeof path === 'string') {
        return object[path];
      }

      if (!Array.isArray(path)) {
        return undefined;
      }

      // When we have a getter function inside the array, call it as a getter,
      // ignoring any type errors thrown by it (just return undefined.)
      var callPropName = function callPropName(object, propName) {
        var value = void 0;
        try {
          value = propName(object);
        } catch (e) {
          if (!(e instanceof TypeError)) {
            throw e;
          }
        }

        return value;
      };

      return path.reduce(function (object, propName) {
        return object ? typeof propName === 'function' ? callPropName(object, propName) : object[propName] : null;
      }, object);
    }

    /**
     * Assigns own enumerable properties of source object(s) to the destination
     * object. Subsequent sources overwrite property assignments of previous
     * sources.
     * @param {Object} object
     * @param {Object} ...sources
     * @return {Object}
     */

  }, {
    key: 'extend',
    value: function extend(object) {
      // Shallow clone
      var newObject = {};
      for (var key in object) {
        newObject[key] = object[key];
      }

      // Extend sources

      for (var _len4 = arguments.length, sources = Array(_len4 > 1 ? _len4 - 1 : 0), _key5 = 1; _key5 < _len4; _key5++) {
        sources[_key5 - 1] = arguments[_key5];
      }

      for (var i = 0; i < sources.length; i++) {
        var source = sources[i];
        for (var _key6 in source) {
          newObject[_key6] = source[_key6];
        }
      }

      return newObject;
    }

    /**
     * Creates a shallow clone of the given object
     * @param {Object} object
     * @returns {Object}
     */

  }, {
    key: 'clone',
    value: function clone(object) {
      return this.extend({}, object);
    }

    /**
     * Creates a Blob URI from the given Data URI
     * @param {String} data
     */

  }, {
    key: 'createBlobURIFromDataURI',
    value: function createBlobURIFromDataURI(data) {
      var root = typeof window === 'undefined' ? global : window;
      if (!root.Blob || !root.URL || !ArrayBuffer || !Uint8Array) {
        return data;
      }

      var rawData = __WEBPACK_IMPORTED_MODULE_8__base64__["a" /* default */].decode(data.split(',')[1]);
      var mimeString = data.split(',')[0].split(':')[1].split(';')[0];

      // write the bytes of the string to an ArrayBuffer
      var arrayBuffer = new ArrayBuffer(rawData.length);
      var intArray = new Uint8Array(arrayBuffer);
      for (var i = 0; i < rawData.length; i++) {
        intArray[i] = rawData[i];
      }

      // write the ArrayBuffer to a blob, and you're done
      var blob = new root.Blob([arrayBuffer], {
        type: mimeString
      });
      return root.URL.createObjectURL(blob);
    }

    /**
     * Generates a UUID
     * @return {String}
     */

  }, {
    key: 'getUUID',
    value: function getUUID() {
      return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
        var r = Math.random() * 16 | 0;
        var v = c === 'x' ? r : r & 0x3 | 0x8;
        return v.toString(16);
      });
    }

    /**
     * Creates a canvas DOM element (browser) or a node-canvas canvas (node)
     * @return {Canvas}
     */

  }, {
    key: 'createCanvas',
    value: function createCanvas() {
      return document.createElement('canvas');
    }

    /**
     * Checks if the given dimensions are POT
     * @param  {PhotoEditorSDK.Math.Vector2}  dimensions
     * @return {Boolean}
     */

  }, {
    key: 'isPowerOfTwo',
    value: function isPowerOfTwo(dimensions) {
      return (dimensions.x & dimensions.x - 1) === 0 && (dimensions.y & dimensions.y - 1) === 0;
    }

    /**
     * Returns the next lowest power of two of the given number
     * @param  {Number} x
     * @return {Number}
     */

  }, {
    key: 'nextLowestPOT',
    value: function nextLowestPOT(x) {
      for (var i = 1; i < 32; i <<= 1) {
        x = x | x >> i;
      }
      return x - (x >> 1);
    }

    /**
     * Returns the next highest power of two of the given number
     * @param  {Number} x
     * @return {Number}
     */

  }, {
    key: 'nextHighestPOT',
    value: function nextHighestPOT(x) {
      x--;
      for (var i = 1; i < 32; i <<= 1) {
        x = x | x >> i;
      }
      return x + 1;
    }

    /**
     * Moves the array item at `oldIndex` to `newIndex`
     * @param  {Array} arr
     * @param  {Number} oldIndex
     * @param  {Number} newIndex
     */

  }, {
    key: 'moveArrayItem',
    value: function moveArrayItem(arr, oldIndex, newIndex) {
      if (newIndex >= arr.length) {
        var k = newIndex - arr.length;
        while (k-- + 1) {
          arr.push(undefined);
        }
      }
      arr.splice(newIndex, 0, arr.splice(oldIndex, 1)[0]);
    }

    /**
     * Makes sure the given canvas has the given dimensions. If not, it does not change the
     * canvas dimensions.
     * @param  {Canvas} canvas
     * @param  {PhotoEditorSDK.Math.Vector2} dimensions
     */

  }, {
    key: 'ensureCanvasDimensions',
    value: function ensureCanvasDimensions(canvas, dimensions) {
      if (canvas.width !== dimensions.x || canvas.height !== dimensions.y) {
        canvas.width = dimensions.x;
        canvas.height = dimensions.y;
      }
    }

    /**
     * Converts the given array of bytes to a string
     * @param  {Number[]} byteArray
     * @return {String}
     */

  }, {
    key: 'byteArrayToString',
    value: function byteArrayToString(byteArray) {
      return byteArray.map(function (byte) {
        return String.fromCharCode(byte);
      }).join('');
    }

    /**
     * Clamps the given `number` into `min` and `max`
     * @param  {Number} number
     * @param  {Number} min
     * @param  {Number} max
     * @return {Number}
     */

  }, {
    key: 'clamp',
    value: function clamp(number, min, max) {
      return Math.max(min, Math.min(number, max));
    }

    /**
     * Checks if the given string matches the given wildcard
     * @param  {String} str
     * @param  {String} rule
     * @return {Boolean}
     */

  }, {
    key: 'wildCardMatch',
    value: function wildCardMatch(str, rule) {
      return new RegExp('^' + rule.split('*').join('.*') + '$').test(str);
    }

    /**
     * Returns a new object with flipped values and keys
     * @param  {Object} obj
     * @return {Object}
     */

  }, {
    key: 'flipObject',
    value: function flipObject(obj) {
      var newObj = {};
      for (var key in obj) {
        newObj[obj[key]] = key;
      }
      return newObj;
    }

    /**
     * Returns a clone of the given options object
     * @param  {Object} options
     * @return {Object}
     */

  }, {
    key: 'cloneOptions',
    value: function cloneOptions(options) {
      var newOptions = {};
      for (var key in options) {
        var value = options[key];
        if (Array.isArray(value)) {
          value = value.slice();
        } else if (value.clone) {
          value = value.clone();
        }
        newOptions[key] = value;
      }
      return newOptions;
    }

    /**
     * Returns the given date as RFC 3339
     * @param {Date} date
     * @return {String}
     */

  }, {
    key: 'ISODateString',
    value: function ISODateString(date) {
      function pad(n) {
        return n < 10 ? '0' + n : n;
      }
      return date.getUTCFullYear() + '-' + pad(date.getUTCMonth() + 1) + '-' + pad(date.getUTCDate()) + 'T' + pad(date.getUTCHours()) + ':' + pad(date.getUTCMinutes()) + ':' + pad(date.getUTCSeconds()) + 'Z';
    }
  }, {
    key: 'getCrossOriginValue',
    value: function getCrossOriginValue(crossOrigin) {
      if (!crossOrigin) {
        return 'anonymous';
      }

      if (crossOrigin === 'none') {
        return undefined;
      }

      return crossOrigin;
    }

    /**
     * Shallow equal compare two objects
     * @param {*} objA
     * @param {*} objB
     * @returns {Boolean}
     */

  }, {
    key: 'shallowEqual',
    value: function shallowEqual(objA, objB) {
      if (objA === objB) {
        return true;
      }

      if ((typeof objA === 'undefined' ? 'undefined' : _typeof(objA)) !== 'object' || objA === null || (typeof objB === 'undefined' ? 'undefined' : _typeof(objB)) !== 'object' || objB === null) {
        return false;
      }

      var keysA = __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_keys___default()(objA);
      var keysB = __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_keys___default()(objB);

      if (keysA.length !== keysB.length) {
        return false;
      }
      // Test for A's keys different from B.
      var bHasOwnProperty = hasOwnProperty.bind(objB);
      for (var i = 0; i < keysA.length; i++) {
        if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
          return false;
        }
      }
      return true;
    }

    /**
     * Returns 'value' if condition is met else returns 'undefined'
     * @param {Boolean} condition
     * @param {*} value
     * @returns {*}
     */

  }, {
    key: 'enableIf',
    value: function enableIf(condition, value) {
      return condition ? value : undefined;
    }

    /**
      Throws an error if condition is not met
      @param {Boolean} condition
     */

  }, {
    key: 'invariant',
    value: function invariant(condition, message) {
      if (!condition) {
        var error = new Error(message);
        throw error;
      }
    }

    /**
     * Exectues all Promises in an array, returning a new Promise which
     * will fulfill with an array of the values returned by all promises in
     * the case all of them are resolved, or, with one or more are rejected,
     * rejects with an array containing all the error values.
     *
     * @param {Array<Promise>} promises
     * @returns {Promise<Array>}
     */

  }, {
    key: 'executePromises',
    // eslint-disable-line
    value: function executePromises(promises) {
      var count = promises.length;
      var counter = 0;

      var values = [];
      var errors = [];

      return new __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_promise___default.a(function (resolve, reject) {
        var onFinnish = function onFinnish() {
          counter++;
          if (counter >= count) {
            if (errors.length <= 0) {
              resolve(values);
            } else {
              reject(errors);
            }
          }
        };

        var onSuccess = function onSuccess(value) {
          values.push(value);
          onFinnish();
        };

        var onError = function onError(value) {
          errors.push(value);
          onFinnish();
        };

        promises.forEach(function (promise) {
          promise.then(onSuccess).catch(onError);
        });
      });
    }
  }]);

  return Utils;
}();

Utils.Array = __WEBPACK_IMPORTED_MODULE_9__array_utils__["a" /* default */];


/* harmony default export */ __webpack_exports__["a"] = (Utils);
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(41)))

/***/ }),
/* 23 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SizeValue; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



var Rectangle = __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__["Math"].Rectangle;


var SizeValue = function () {
  function SizeValue() {
    var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
    var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;

    _classCallCheck(this, SizeValue);

    this.width = width;
    this.height = height;
  }

  _createClass(SizeValue, [{
    key: 'set',
    value: function set(width, height) {
      this.width = width;
      this.height = height;
    }
  }, {
    key: 'aspect',
    value: function aspect() {
      return this.width / this.height;
    }
  }, {
    key: 'rectangle',
    value: function rectangle(x, y) {
      return new Rectangle(x, y, this.width, this.height);
    }
  }, {
    key: 'clone',
    value: function clone() {
      return new SizeValue(this.width, this.height);
    }
  }, {
    key: 'scale',
    value: function scale(sx, sy) {
      if (sy === undefined) {
        sy = sx;
      }

      this.width *= sx;
      this.height *= sy;

      return this;
    }
  }, {
    key: 'copy',
    value: function copy(size) {
      this.width = size.width;
      this.height = size.height;

      return this;
    }
  }, {
    key: 'fitInWidthWithOther',
    value: function fitInWidthWithOther(width) {
      var otherSizeValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new SizeValue();

      this.copy(SizeValue.fitTwoInWidth(width, this, otherSizeValue)[0]);
      return this;
    }
  }], [{
    key: 'fitTwoInWidth',
    value: function fitTwoInWidth(width, size1, size2) {
      var crossRatio = size1.width * size2.height + size1.height * size2.width;
      var a = size2.height * width / crossRatio;

      var newWidth1 = size1.width * a;
      var newHeight = size1.height * a;

      return [new SizeValue(newWidth1, newHeight), new SizeValue(width - newWidth1, newHeight)];
    }
  }]);

  return SizeValue;
}();

/***/ }),
/* 24 */
/***/ (function(module, exports) {

module.exports = function (it) {
  return typeof it === 'object' ? it !== null : typeof it === 'function';
};


/***/ }),
/* 25 */
/***/ (function(module, exports, __webpack_require__) {

// Thank's IE8 for his funny defineProperty
module.exports = !__webpack_require__(37)(function () {
  return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
});


/***/ }),
/* 26 */
/***/ (function(module, exports, __webpack_require__) {

var dP = __webpack_require__(21);
var createDesc = __webpack_require__(46);
module.exports = __webpack_require__(25) ? function (object, key, value) {
  return dP.f(object, key, createDesc(1, value));
} : function (object, key, value) {
  object[key] = value;
  return object;
};


/***/ }),
/* 27 */
/***/ (function(module, exports) {

var hasOwnProperty = {}.hasOwnProperty;
module.exports = function (it, key) {
  return hasOwnProperty.call(it, key);
};


/***/ }),
/* 28 */
/***/ (function(module, exports, __webpack_require__) {

// to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject = __webpack_require__(113);
var defined = __webpack_require__(78);
module.exports = function (it) {
  return IObject(defined(it));
};


/***/ }),
/* 29 */
/***/ (function(module, exports, __webpack_require__) {

module.exports = { "default": __webpack_require__(184), __esModule: true };

/***/ }),
/* 30 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(process) {/* unused harmony export Logger */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_json_stringify__ = __webpack_require__(200);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_json_stringify___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_json_stringify__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__sdk_core_lib_utils__ = __webpack_require__(22);




var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from___default()(arr); } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



var defaultLevels = [{ name: 'trace', type: 'trace', background: '#EEEEEE', color: '#AAAAAA' }, { name: 'info', type: 'log', background: '#BDE5F8', color: '#00529B' }, { name: 'warn', type: 'warn', background: '#FEEFB3', color: '#9F6000' }, { name: 'error', type: 'error', background: '#FFBABA', color: '#D8000C' }, { name: 'log', type: 'log', background: '#EEEEEE', color: '#1f4f6b' }];

var hasConsoleGroups = function hasConsoleGroups() {
  return console && console.group && console.groupCollapsed && console.groupEnd;
};

var hasColorOutput = function hasColorOutput() {
  return (!process || process && process.browser) && typeof navigator !== 'undefined' && navigator.userAgent.match(/Gecko|WebKit/i) && !navigator.userAgent.match(/Trident/);
};

/* eslint-disable */
var getLogStyles = function getLogStyles(background, color) {
  return ['background: #2D7BFF; line-height: 20px; padding: 4px 0', 'background: #2B2B2B; color: white; line-height: 20px; padding: 4px 0', 'background: #2D7BFF; line-height: 20px; padding: 4px 0', 'background: ' + background + '; color: ' + color + '; line-height: 20px; padding: 4px 0; font-weight: bold', 'background: #2B2B2B; color: white; line-height: 20px; padding: 4px 0', 'background: #2D7BFF; line-height: 20px; padding: 4px 0'];
};
/* eslint-enable */

var Logger = function () {
  function Logger() {
    var _this = this;

    var maxLevel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'warn';
    var levels = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultLevels;

    _classCallCheck(this, Logger);

    this._levels = [].concat(_toConsumableArray(levels));
    this._maxLevel = this.getLevelIndexByName(maxLevel);

    this._consoleFuncs = {
      trace: function trace() {
        if (hasConsoleGroups()) {
          var _console;

          (_console = console).groupCollapsed.apply(_console, arguments);
          console.trace();
          console.groupEnd();
        } else {
          var _console2;

          (_console2 = console).trace.apply(_console2, arguments);
        }
      }
    };

    this._levels.forEach(function (_ref) {
      var name = _ref.name;

      _this[name] = function (tag) {
        for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
          args[_key - 1] = arguments[_key];
        }

        _this._log.apply(_this, [name, tag].concat(args));
      };
    });
  }

  _createClass(Logger, [{
    key: 'getLevelIndexByName',
    value: function getLevelIndexByName(levelName) {
      return __WEBPACK_IMPORTED_MODULE_3__sdk_core_lib_utils__["a" /* default */].Array.findIndex(this._levels, function (l) {
        return l.name === levelName;
      });
    }
  }, {
    key: 'getLevelObjectByName',
    value: function getLevelObjectByName(levelName) {
      return __WEBPACK_IMPORTED_MODULE_3__sdk_core_lib_utils__["a" /* default */].Array.find(this._levels, function (l) {
        return l.name === levelName;
      });
    }

    /**
     * Checks if the given log level is currently enabled or not.
     *
     * @param {string} levelName
     */

  }, {
    key: 'canLog',
    value: function canLog(levelName) {
      var level = this.getLevelIndexByName(levelName);

      if (level < 0) {
        return false;
      }

      return level >= this._maxLevel;
    }

    /**
     * Sets the current log level.
     *
     * @param {string} levelName
     * @memberof Logger
     */

  }, {
    key: 'setLevel',
    value: function setLevel(levelName) {
      var level = this.getLevelIndexByName(levelName);

      if (level < 0) {
        return;
      }

      this._maxLevel = level;
    }

    /**
     * Create an entry in the console. The specific console method is determined
     * by the level `levelName`. If color is available, use colorized output. If
     * more than one argument is supplied in `args`, a console group is created.
     *
     * @param {Number} levelName
     * @param {String} tag
     * @param {Array<string>} args
     *
     */

  }, {
    key: '_log',
    value: function _log(levelName, tag) {
      var level = this.getLevelObjectByName(levelName);

      if (!level || !this.canLog(levelName)) {
        return;
      }

      var name = level.name,
          type = level.type,
          background = level.background,
          color = level.color;

      for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
        args[_key2 - 2] = arguments[_key2];
      }

      var outputs = args.filter(function (arg) {
        return arg !== undefined;
      }).map(function (arg) {
        if (arg.toObject) {
          return JSON.parse(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_json_stringify___default()(arg.toObject()));
        }

        return arg;
      });

      var consoleFunc = this._consoleFuncs[type] || console[type] || console.log;
      var outputsLen = outputs.length;
      var styles = getLogStyles(background, color);

      if (!hasColorOutput()) {
        var _outputsLen = outputs.length;
        if (_outputsLen <= 0) {
          consoleFunc('PhotoEditorSDK | ' + tag + ' ');
          return;
        }

        if (_outputsLen === 1 && typeof outputs[0] === 'string') {
          consoleFunc('PhotoEditorSDK | ' + tag + ' | ' + outputs[0]);
          return;
        }

        consoleFunc.apply(undefined, ['PhotoEditorSDK | ' + tag + ' | '].concat(_toConsumableArray(outputs)));
        return;
      }

      if (outputsLen <= 0) {
        consoleFunc.apply(undefined, ['%c  %c PhotoEditorSDK %c  %c ' + tag + ' %c %c  '].concat(_toConsumableArray(styles)));
        return;
      }

      if (outputsLen === 1 && typeof outputs[0] === 'string') {
        consoleFunc.apply(undefined, ['%c  %c PhotoEditorSDK %c  %c ' + tag + ' %c  ' + outputs[0] + '  %c  '].concat(_toConsumableArray(styles)));
        return;
      }

      // If there is more than one argument, try to group the log
      if (hasConsoleGroups()) {
        var _console3;

        (_console3 = console).groupCollapsed.apply(_console3, ['%c  %c PhotoEditorSDK %c  %c ' + tag + ' %c'].concat(_toConsumableArray(__WEBPACK_IMPORTED_MODULE_3__sdk_core_lib_utils__["a" /* default */].Array.init(styles))));
        consoleFunc.apply(undefined, _toConsumableArray(outputs));
        console.groupEnd();
      } else {
        consoleFunc.apply(undefined, ['%c  %c PhotoEditorSDK %c  %c ' + tag + ' %c'].concat(_toConsumableArray(__WEBPACK_IMPORTED_MODULE_3__sdk_core_lib_utils__["a" /* default */].Array.init(styles)), _toConsumableArray(outputs)));
      }
    }

    /**
     * Logs an image into the browser's console. Does
     * nothing in a node environment.
     *
     * @param {Canvas|string} source
     * @param {string} tag
     */

  }, {
    key: 'image',
    value: function image() {
      var tag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
      var source = arguments[1];

      var image = new window.Image();

      var onload = function onload() {
        var width = image.width;
        var height = image.height;
        tag && console.log(tag);
        console.log('%c+', '\n        font-size: 1px;\n        padding: 0px ' + Math.floor(width / 2) + 'px;\n        line-height: ' + height + 'px;\n        background: url(' + image.src + ');\n        color: transparent;\n        background-repeat: no-repeat;\n        background-size: ' + width + 'px ' + height + 'px;');
      };

      image.onload = onload;

      if (source instanceof window.HTMLCanvasElement) {
        image.src = source.toDataURL();
      } else if (source instanceof window.Image) {
        image = source;
        onload();
      } else if (typeof source === 'string') {
        image.src = source;
      } else {
        this.log(tag, source);
      }
      return image;
    }

    /**
     * Logs a `PhotoEditorSDK.Engine.Texture` into the browser's console. Does
     * nothing in a node environment.
     *
     * @param {PhotoEditorSDK.Engine.Texture`} texture
     * @param {string} tag
     *
     */

  }, {
    key: 'texture',
    value: function texture() {
      var tag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
      var _texture = arguments[1];

      if (!_texture) {
        this.log(tag, 'texture: null or undefined');
        return;
      }

      var baseTexture = _texture.getBaseTexture();
      var renderers = baseTexture.getRenderers();

      var glRenderer = __WEBPACK_IMPORTED_MODULE_3__sdk_core_lib_utils__["a" /* default */].Array.find(renderers, function (r) {
        return r && r.constructor.type === 'WebGL';
      });

      var _baseTexture$getFrame = baseTexture.getFrame(),
          width = _baseTexture$getFrame.width,
          height = _baseTexture$getFrame.height;

      if (glRenderer) {
        var gl = glRenderer.getContext();
        var glTexture = baseTexture.getGLTextureForRenderer(glRenderer);
        this.logGlTexture(gl, glTexture, width, height, tag);
      } else {
        Log.image(tag, baseTexture.getSource());
      }
    }

    /**
     * Logs a WebGLTexture into the browser's console. Does
     * nothing in a node environment.
     *
     * @param {WebGLRenderingContext} gl
     * @param {WebGLTexture} texture
     * @param {number} [width=150]
     * @param {number} [height=150]
     * @param {string} tag
     */

  }, {
    key: 'logGlTexture',
    value: function logGlTexture(gl, texture) {
      var width = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 150;
      var height = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 150;
      var tag = arguments[4];

      gl.bindTexture(gl.TEXTURE_2D, texture);
      var framebuffer = gl.createFramebuffer();
      gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
      gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);

      // Read the contents of the framebuffer
      var data = new Uint8Array(width * height * 4);
      gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, data);

      gl.deleteFramebuffer(framebuffer);

      var canvas = document.createElement('canvas');
      canvas.width = width;
      canvas.height = height;

      var context = canvas.getContext('2d');

      // Copy the pixels to a 2D canvas
      var imageData = context.createImageData(width, height);
      imageData.data.set(data);
      context.putImageData(imageData, 0, 0);

      return Log.image(tag, canvas);
    }
  }]);

  return Logger;
}();




var Log = new Logger('warn');

/* harmony default export */ __webpack_exports__["a"] = (Log);
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(124)))

/***/ }),
/* 31 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RenderType", function() { return RenderType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ImageFormat", function() { return ImageFormat; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Events", function() { return Events; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OptionType", function() { return OptionType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UniformType", function() { return UniformType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RendererType", function() { return RendererType; });
/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */

/**
* The available render types
* @enum {String} RenderType
* @property {string} IMAGE image
* @property {string} DATAURL data-url
* @property {string} BUFFER buffer
* @property {string} BLOB blob
* @property {string} MSBLOB ms-blob
* @memberof PhotoEditorSDK
*/
var RenderType = {
  IMAGE: 'image',
  DATAURL: 'data-url',
  BUFFER: 'buffer',
  BLOB: 'blob',
  MSBLOB: 'ms-blob'

  /**
   * The available image types
   * @enum {String} ImageFormat
   * @property {string} PNG  image/png
   * @property {string} JPEG image/jpg
   * @memberof PhotoEditorSDK
   */
};var ImageFormat = {
  PNG: 'image/png',
  JPEG: 'image/jpeg'

  /**
   * Events used by the UI
   * @enum {String}
   * @alias Events
   * @property {string} OPERATION_UPDATED
   * @memberof PhotoEditorSDK
   */
};var Events = {
  OPERATION_UPDATED: 'operation:update'

  /**
   * The available option types for classes inheriting {@link PhotoEditorSDK.Configurable}
   * @enum {String}
   * @alias OptionType
   * @property {string} NUMBER
   * @property {string} VECTOR2
   * @property {string} COLOR_MATRIX
   * @property {string} COLOR
   * @property {string} ARRAY
   * @property {string} OBJECT
   * @property {string} STRING
   * @property {string} BOOLEAN
   * @property {string} CONFIGURABLE
   * @property {string} IMAGE
   * @property {string} FUNCTION
   * @property {string} TEXTURE
   * @property {string} ALL
   * @memberof PhotoEditorSDK
   */
};var OptionType = {
  NUMBER: 'number',
  VECTOR2: 'vector2',
  COLOR_MATRIX: 'color-matrix',
  COLOR: 'color',
  ARRAY: 'array',
  OBJECT: 'object',
  STRING: 'string',
  BOOLEAN: 'boolean',
  CONFIGURABLE: 'configurable',
  IMAGE: 'image',
  FUNCTION: 'function',
  TEXTURE: 'texture',
  ALL: '*'

  /**
   * The available uniform types for WebGL shaders
   * @enum {String}
   * @alias UniformType
   * @property {string} SAMPLER2D
   * @property {string} INT
   * @property {string} INT1
   * @property {string} FLOAT
   * @property {string} FLOAT1
   * @property {string} FLOAT2
   * @property {string} FLOAT_VECTOR2
   * @property {string} FLOAT3
   * @property {string} FLOAT4
   * @property {string} MAT3
   * @property {string} MAT3FV
   * @property {string} MAT4
   * @memberof PhotoEditorSDK
   */
};var UniformType = {
  SAMPLER2D: 'sampler2d',
  INT: 'i',
  INT1: '1i',
  FLOAT: 'f',
  FLOAT1: '1f',
  FLOAT2: '2f',
  FLOAT_VECTOR2: '2fv',
  FLOAT3: '3f',
  FLOAT4: '4f',
  MAT3: 'mat3',
  MAT3FV: 'mat3fv',
  MAT4: 'mat4'

  /**
   * The available renderer types
   * @enum {String}
   * @alias RendererType
   * @property {string} WEBGL
   * @property {string} CANVAS
   * @memberOf PhotoEditorSDK
   */
};var RendererType = {
  WEBGL: 'webgl',
  CANVAS: 'canvas'
};

/***/ }),
/* 32 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_symbol_iterator__ = __webpack_require__(35);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_symbol_iterator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_symbol_iterator__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol__ = __webpack_require__(39);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_promise__ = __webpack_require__(29);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_promise___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_promise__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_set_immediate__ = __webpack_require__(225);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_set_immediate___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_set_immediate__);






var _typeof = typeof __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default.a === "function" && typeof __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_symbol_iterator___default.a === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default.a === "function" && obj.constructor === __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default.a && obj !== __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default.a.prototype ? "symbol" : typeof obj; };

/* eslint-disable */

/*!
 * Native Promise Only
 * v0.8.0-a (c) Kyle Simpson
 * MIT License: http://getify.mit-license.org
 */

/* istanbul ignore next */
var promiseFactory = function DEF() {
  /*jshint validthis:true */
  "use strict";

  var builtInProp,
      cycle,
      scheduling_queue,
      ToString = Object.prototype.toString,
      timer = typeof __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_set_immediate___default.a != "undefined" ? function timer(fn) {
    return __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_set_immediate___default()(fn);
  } : setTimeout;

  // dammit, IE8.
  try {
    Object.defineProperty({}, "x", {});
    builtInProp = function builtInProp(obj, name, val, config) {
      return __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_define_property___default()(obj, name, {
        value: val,
        writable: true,
        configurable: config !== false
      });
    };
  } catch (err) {
    builtInProp = function builtInProp(obj, name, val) {
      obj[name] = val;
      return obj;
    };
  }

  // Note: using a queue instead of array for efficiency
  scheduling_queue = function Queue() {
    var first, last, item;

    function Item(fn, self) {
      this.fn = fn;
      this.self = self;
      this.next = void 0;
    }

    return {
      add: function add(fn, self) {
        item = new Item(fn, self);
        if (last) {
          last.next = item;
        } else {
          first = item;
        }
        last = item;
        item = void 0;
      },
      drain: function drain() {
        var f = first;
        first = last = cycle = void 0;

        while (f) {
          f.fn.call(f.self);
          f = f.next;
        }
      }
    };
  }();

  function schedule(fn, self) {
    scheduling_queue.add(fn, self);
    if (!cycle) {
      cycle = timer(scheduling_queue.drain);
    }
  }

  // promise duck typing
  function isThenable(o) {
    var _then,
        o_type = typeof o === "undefined" ? "undefined" : _typeof(o);

    if (o != null && (o_type == "object" || o_type == "function")) {
      _then = o.then;
    }
    return typeof _then == "function" ? _then : false;
  }

  function notify() {
    for (var i = 0; i < this.chain.length; i++) {
      notifyIsolated(this, this.state === 1 ? this.chain[i].success : this.chain[i].failure, this.chain[i]);
    }
    this.chain.length = 0;
  }

  // NOTE: This is a separate function to isolate
  // the `try..catch` so that other code can be
  // optimized better
  function notifyIsolated(self, cb, chain) {
    var ret, _then;
    try {
      if (cb === false) {
        chain.reject(self.msg);
      } else {
        if (cb === true) {
          ret = self.msg;
        } else {
          ret = cb.call(void 0, self.msg);
        }

        if (ret === chain.promise) {
          chain.reject(TypeError("Promise-chain cycle"));
        } else if (_then = isThenable(ret)) {
          _then.call(ret, chain.resolve, chain.reject);
        } else {
          chain.resolve(ret);
        }
      }
    } catch (err) {
      chain.reject(err);
    }
  }

  function resolve(msg) {
    var _then,
        self = this;

    // already triggered?
    if (self.triggered) {
      return;
    }

    self.triggered = true;

    // unwrap
    if (self.def) {
      self = self.def;
    }

    try {
      if (_then = isThenable(msg)) {
        schedule(function () {
          var def_wrapper = new MakeDefWrapper(self);
          try {
            _then.call(msg, function $resolve$() {
              resolve.apply(def_wrapper, arguments);
            }, function $reject$() {
              reject.apply(def_wrapper, arguments);
            });
          } catch (err) {
            reject.call(def_wrapper, err);
          }
        });
      } else {
        self.msg = msg;
        self.state = 1;
        if (self.chain.length > 0) {
          schedule(notify, self);
        }
      }
    } catch (err) {
      reject.call(new MakeDefWrapper(self), err);
    }
  }

  function reject(msg) {
    var self = this;

    // already triggered?
    if (self.triggered) {
      return;
    }

    self.triggered = true;

    // unwrap
    if (self.def) {
      self = self.def;
    }

    self.msg = msg;
    self.state = 2;
    if (self.chain.length > 0) {
      schedule(notify, self);
    }
  }

  function iteratePromises(Constructor, arr, resolver, rejecter) {
    for (var idx = 0; idx < arr.length; idx++) {
      (function IIFE(idx) {
        Constructor.resolve(arr[idx]).then(function $resolver$(msg) {
          resolver(idx, msg);
        }, rejecter);
      })(idx);
    }
  }

  function MakeDefWrapper(self) {
    this.def = self;
    this.triggered = false;
  }

  function MakeDef(self) {
    this.promise = self;
    this.state = 0;
    this.triggered = false;
    this.chain = [];
    this.msg = void 0;
  }

  function Promise(executor) {
    if (typeof executor != "function") {
      throw TypeError("Not a function");
    }

    if (this.__NPO__ !== 0) {
      throw TypeError("Not a promise");
    }

    // instance shadowing the inherited "brand"
    // to signal an already "initialized" promise
    this.__NPO__ = 1;

    var def = new MakeDef(this);

    this["then"] = function then(success, failure) {
      var o = {
        success: typeof success == "function" ? success : true,
        failure: typeof failure == "function" ? failure : false
      };
      // Note: `then(..)` itself can be borrowed to be used against
      // a different promise constructor for making the chained promise,
      // by substituting a different `this` binding.
      o.promise = new this.constructor(function extractChain(resolve, reject) {
        if (typeof resolve != "function" || typeof reject != "function") {
          throw TypeError("Not a function");
        }

        o.resolve = resolve;
        o.reject = reject;
      });
      def.chain.push(o);

      if (def.state !== 0) {
        schedule(notify, def);
      }

      return o.promise;
    };
    this["catch"] = function $catch$(failure) {
      return this.then(void 0, failure);
    };

    try {
      executor.call(void 0, function publicResolve(msg) {
        resolve.call(def, msg);
      }, function publicReject(msg) {
        reject.call(def, msg);
      });
    } catch (err) {
      reject.call(def, err);
    }
  }

  var PromisePrototype = builtInProp({}, "constructor", Promise,
  /*configurable=*/false);

  // Note: Android 4 cannot use `Object.defineProperty(..)` here
  Promise.prototype = PromisePrototype;

  // built-in "brand" to signal an "uninitialized" promise
  builtInProp(PromisePrototype, "__NPO__", 0,
  /*configurable=*/false);

  builtInProp(Promise, "resolve", function Promise$resolve(msg) {
    var Constructor = this;

    // spec mandated checks
    // note: best "isPromise" check that's practical for now
    if (msg && (typeof msg === "undefined" ? "undefined" : _typeof(msg)) == "object" && msg.__NPO__ === 1) {
      return msg;
    }

    return new Constructor(function executor(resolve, reject) {
      if (typeof resolve != "function" || typeof reject != "function") {
        throw TypeError("Not a function");
      }

      resolve(msg);
    });
  });

  builtInProp(Promise, "reject", function Promise$reject(msg) {
    return new this(function executor(resolve, reject) {
      if (typeof resolve != "function" || typeof reject != "function") {
        throw TypeError("Not a function");
      }

      reject(msg);
    });
  });

  builtInProp(Promise, "all", function Promise$all(arr) {
    var Constructor = this;

    // spec mandated checks
    if (ToString.call(arr) != "[object Array]") {
      return Constructor.reject(TypeError("Not an array"));
    }
    if (arr.length === 0) {
      return Constructor.resolve([]);
    }

    return new Constructor(function executor(resolve, reject) {
      if (typeof resolve != "function" || typeof reject != "function") {
        throw TypeError("Not a function");
      }

      var len = arr.length,
          msgs = Array(len),
          count = 0;

      iteratePromises(Constructor, arr, function resolver(idx, msg) {
        msgs[idx] = msg;
        if (++count === len) {
          resolve(msgs);
        }
      }, reject);
    });
  });

  builtInProp(Promise, "race", function Promise$race(arr) {
    var Constructor = this;

    // spec mandated checks
    if (ToString.call(arr) != "[object Array]") {
      return Constructor.reject(TypeError("Not an array"));
    }

    return new Constructor(function executor(resolve, reject) {
      if (typeof resolve != "function" || typeof reject != "function") {
        throw TypeError("Not a function");
      }

      iteratePromises(Constructor, arr, function resolver(idx, msg) {
        resolve(msg);
      }, reject);
    });
  });

  return Promise;
};

var root = typeof global === 'undefined' ? window : global;
var _Promise = typeof __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_promise___default.a !== 'undefined' ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_promise___default.a : promiseFactory();
root.Promise = root.Promise || _Promise;
/* harmony default export */ __webpack_exports__["a"] = (_Promise);
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(41)))

/***/ }),
/* 33 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Words; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_photoeditorsdk_core__);



var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from___default()(arr); } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */


var Words = function () {
  function Words(text) {
    _classCallCheck(this, Words);

    this.words = [];

    if (text) {
      this.splitIntoWords(text);
    }
  }

  /**
   * Splits the given text into words, which are stores in the `words` array,
   * and returned a copy.
   *
   * @param {String} text
   * @returns {Array<String>}
   */


  _createClass(Words, [{
    key: 'splitIntoWords',
    value: function splitIntoWords(text) {
      this.words = text.match(/\S+/g) || [];

      return [].concat(_toConsumableArray(this.words));
    }

    /**
     * Gets the list of words.
     *
     * @returns {Array<String>}
     */

  }, {
    key: 'get',
    value: function get() {
      return [].concat(_toConsumableArray(this.words));
    }
  }, {
    key: 'getWord',
    value: function getWord(index) {
      return this.words[index];
    }
  }, {
    key: 'set',
    value: function set(words) {
      this.words = [].concat(_toConsumableArray(words));

      return this;
    }

    /**
     * Returns a new Words instance, initialized with the sliced words of the
     * current instance, from `start` (including) to `end` (excluding).
     *
     * @param {Number} start
     * @param {Number} end
     * @returns Words
     * @memberof Words
     */

  }, {
    key: 'slice',
    value: function slice(start, end) {
      return Words.fromWords(this.words.slice(start, end));
    }

    /**
     * Gets the list of words converted to lower case characters.
     *
     * @returns {Array<String>}
     * @memberof Words
     */

  }, {
    key: 'getLowerCase',
    value: function getLowerCase() {
      return this.words.map(function (w) {
        return w.toLowerCase();
      });
    }

    /**
     * Gets the list of words converted to upper case characters.
     *
     * @returns {Array<String>}
     * @memberof Words
     */

  }, {
    key: 'getUpperCase',
    value: function getUpperCase() {
      return this.words.map(function (w) {
        return w.toUpperCase();
      });
    }

    /**
     * Returns the number of words.
     *
     * @returns {Number}
     */

  }, {
    key: 'size',
    value: function size() {
      return this.words.length;
    }

    /**
     * Returns the number of characters contained in all the words.
     *
     * @returns {Number}
     * @memberof Words
     */

  }, {
    key: 'countNumberOfCharacters',
    value: function countNumberOfCharacters() {
      return this.words.reduce(function (acc, s) {
        return acc + s.length;
      }, 0);
    }

    /**
     *  Divides the list of words into a list of a given number of lines.
     *
     * @param {Number} numberOfLines
     * @returns {Array<String>}
     * @memberof Words
     */

  }, {
    key: 'joined',
    value: function joined(numberOfLines) {
      var _this = this;

      var numberOfWords = this.size();
      var wordsPerLine = Math.floor(numberOfWords / numberOfLines);
      var extraWords = numberOfWords % numberOfLines;

      var lineStartPos = 0;
      var lineEndPos = 0;
      return __WEBPACK_IMPORTED_MODULE_2_photoeditorsdk_core__["Utils"].Array.range(0, numberOfLines).map(function (i) {
        lineStartPos = lineEndPos;
        var numOfWordsInLine = wordsPerLine + (i < extraWords ? 1 : 0);
        lineEndPos = Math.min(lineStartPos + numOfWordsInLine, numberOfWords);

        return __WEBPACK_IMPORTED_MODULE_2_photoeditorsdk_core__["Utils"].Array.range(lineStartPos, lineEndPos).reduce(function (line, j) {
          return line + (j === lineStartPos ? '' : ' ') + _this.words[j];
        }, '');
      });
    }

    /**
     * Returns a Words instance with the given words.∑
     *
     * @static
     * @param {Array<String>} words
     * @returns Words
     */

  }], [{
    key: 'fromWords',
    value: function fromWords(words) {
      var result = new Words();
      result.words = [].concat(_toConsumableArray(words));

      return result;
    }
  }]);

  return Words;
}();

/***/ }),
/* 34 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* unused harmony export drawImageRect */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return fillRect; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return strokeRect; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return fillRectPunctuated; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return drawImageWithCapInsets; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return drawImageFrame; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_is_iterable__ = __webpack_require__(70);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_is_iterable___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_is_iterable__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_get_iterator__ = __webpack_require__(71);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_get_iterator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_get_iterator__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_photoeditorsdk_core__);



var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_get_iterator___default()(arr), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_is_iterable___default()(Object(arr))) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */


var Rectangle = __WEBPACK_IMPORTED_MODULE_2_photoeditorsdk_core__["Math"].Rectangle,
    Vector2 = __WEBPACK_IMPORTED_MODULE_2_photoeditorsdk_core__["Math"].Vector2;


var drawImageRect = function drawImageRect(context, image, srcRect, destRect) {
  context.drawImage(image, srcRect.x, srcRect.y, srcRect.width, srcRect.height, destRect.x, destRect.y, destRect.width, destRect.height);
};

var fillRect = function fillRect(context, rect, color) {
  var compositeOperation = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'source-over';

  context.save();
  context.fillStyle = color.toRGBA();
  context.globalCompositeOperation = compositeOperation;
  context.fillRect(rect.x, rect.y, rect.width, rect.height);
  context.restore();
};

var strokeRect = function strokeRect(context, rect, color) {
  var lineWidth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 4;

  context.save();
  context.strokeStyle = color.toRGBA();
  context.lineWidth = lineWidth;
  context.strokeRect(rect.x, rect.y, rect.width, rect.height);
  context.restore();
};

var fillRectPunctuated = function fillRectPunctuated(context, rect, color) {
  var compositeOperation = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'source-over';

  context.save();

  var radius = rect.height / 2;

  var centerY = rect.y + radius;
  var centerX = rect.x + radius;
  var endX = rect.x + rect.width;

  context.fillStyle = color.toRGBA();
  context.globalCompositeOperation = compositeOperation;

  while (centerX < endX) {
    context.beginPath();
    context.arc(centerX, centerY, radius, 0, 2 * Math.PI);
    context.fill();

    centerX += radius * 4;
  }

  context.restore();
};

var buildCapRectangle = function buildCapRectangle(rectangle, capInsets) {
  var center = capInsets.applyToRectangle(rectangle);
  var x = rectangle.x,
      y = rectangle.y,
      width = rectangle.width,
      height = rectangle.height;


  var corners = [Rectangle.FromDiagonalPoints(new Vector2(0, 0), new Vector2(center.x, center.y)), Rectangle.FromDiagonalPoints(new Vector2(0, center.y + center.height), new Vector2(center.x, height)), Rectangle.FromDiagonalPoints(new Vector2(center.x + center.width, center.y + center.height), new Vector2(width, height)), Rectangle.FromDiagonalPoints(new Vector2(center.x + center.width, 0), new Vector2(width, center.y))].map(function (r) {
    return r.translate(x, y);
  });

  var bars = [Rectangle.FromDiagonalPoints(new Vector2(center.x, 0), new Vector2(center.x + center.width, center.y)), Rectangle.FromDiagonalPoints(new Vector2(0, center.y), new Vector2(center.x, center.y + center.height)), Rectangle.FromDiagonalPoints(new Vector2(center.x, center.y + center.height), new Vector2(center.x + center.width, height)), Rectangle.FromDiagonalPoints(new Vector2(center.x + center.width, center.y), new Vector2(width, center.y + center.height))].map(function (r) {
    return r.translate(x, y);
  });

  return { corners: corners, bars: bars, center: center };
};

var drawImageWithCapInsets = function drawImageWithCapInsets(context, image, destRect, capInsets) {
  var imageWidth = image.naturalWidth || image.width;
  var imageHeight = image.naturalHeight || image.height;

  // Divide the source rectangle into cap sections
  var capSource = buildCapRectangle(new Rectangle(0, 0, imageWidth, imageHeight), capInsets);

  // Divide the destination rect into cap sections
  var capDest = buildCapRectangle(destRect, capInsets);

  drawImageRect(context, image, capSource.center, capDest.center);
  __WEBPACK_IMPORTED_MODULE_2_photoeditorsdk_core__["Utils"].Array.zip(capSource.corners, capDest.corners).forEach(function (_ref) {
    var _ref2 = _slicedToArray(_ref, 2),
        src = _ref2[0],
        dst = _ref2[1];

    return drawImageRect(context, image, src, dst);
  });
  __WEBPACK_IMPORTED_MODULE_2_photoeditorsdk_core__["Utils"].Array.zip(capSource.bars, capDest.bars).forEach(function (_ref3) {
    var _ref4 = _slicedToArray(_ref3, 2),
        src = _ref4[0],
        dst = _ref4[1];

    return drawImageRect(context, image, src, dst);
  });
};

var drawImageFrame = function drawImageFrame(context, image, frame, color) {
  var compositeMode = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'source-atop';

  context.save();

  if (color) {
    context.globalAlpha = color.a;
  }

  context.drawImage(image, frame.x, frame.y, frame.width, frame.height);

  if (color) {
    context.globalAlpha = 1;
  }

  if (color) {
    var c = color.clone();
    c.a = 1;
    fillRect(context, frame, c, compositeMode);
  }

  context.restore();
};

/***/ }),
/* 35 */
/***/ (function(module, exports, __webpack_require__) {

module.exports = { "default": __webpack_require__(160), __esModule: true };

/***/ }),
/* 36 */
/***/ (function(module, exports, __webpack_require__) {

// optional / simple context binding
var aFunction = __webpack_require__(63);
module.exports = function (fn, that, length) {
  aFunction(fn);
  if (that === undefined) return fn;
  switch (length) {
    case 1: return function (a) {
      return fn.call(that, a);
    };
    case 2: return function (a, b) {
      return fn.call(that, a, b);
    };
    case 3: return function (a, b, c) {
      return fn.call(that, a, b, c);
    };
  }
  return function (/* ...args */) {
    return fn.apply(that, arguments);
  };
};


/***/ }),
/* 37 */
/***/ (function(module, exports) {

module.exports = function (exec) {
  try {
    return !!exec();
  } catch (e) {
    return true;
  }
};


/***/ }),
/* 38 */
/***/ (function(module, exports) {

module.exports = {};


/***/ }),
/* 39 */
/***/ (function(module, exports, __webpack_require__) {

module.exports = { "default": __webpack_require__(169), __esModule: true };

/***/ }),
/* 40 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__engine__ = __webpack_require__(68);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__constants__ = __webpack_require__(31);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__lib_base64__ = __webpack_require__(50);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__lib_event_emitter__ = __webpack_require__(52);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__lib_utils__ = __webpack_require__(22);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__lib_configurable__ = __webpack_require__(55);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__lib_color__ = __webpack_require__(51);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__shared_log__ = __webpack_require__(30);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__shared_vendor_promise__ = __webpack_require__(32);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__lib_gl_utils__ = __webpack_require__(127);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__lib_license_checker__ = __webpack_require__(237);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__shared_async_animation_frame__ = __webpack_require__(247);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "requestAnimationFrame", function() { return __WEBPACK_IMPORTED_MODULE_11__shared_async_animation_frame__["b"]; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "cancelAnimationFrame", function() { return __WEBPACK_IMPORTED_MODULE_11__shared_async_animation_frame__["a"]; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Engine", function() { return __WEBPACK_IMPORTED_MODULE_0__engine__["a"]; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "EventEmitter", function() { return __WEBPACK_IMPORTED_MODULE_3__lib_event_emitter__["a"]; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Utils", function() { return __WEBPACK_IMPORTED_MODULE_4__lib_utils__["a"]; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Configurable", function() { return __WEBPACK_IMPORTED_MODULE_5__lib_configurable__["a"]; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Color", function() { return __WEBPACK_IMPORTED_MODULE_6__lib_color__["a"]; });
/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "Constants", function() { return __WEBPACK_IMPORTED_MODULE_1__constants__; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Log", function() { return __WEBPACK_IMPORTED_MODULE_7__shared_log__["a"]; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Promise", function() { return __WEBPACK_IMPORTED_MODULE_8__shared_vendor_promise__["a"]; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "GLUtils", function() { return __WEBPACK_IMPORTED_MODULE_9__lib_gl_utils__["a"]; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Base64", function() { return __WEBPACK_IMPORTED_MODULE_2__lib_base64__["a"]; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "LicenseChecker", function() { return __WEBPACK_IMPORTED_MODULE_10__lib_license_checker__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__lib_math___ = __webpack_require__(137);
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "Vector2", function() { return __WEBPACK_IMPORTED_MODULE_12__lib_math___["Vector2"]; });
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "Vector3", function() { return __WEBPACK_IMPORTED_MODULE_12__lib_math___["Vector3"]; });
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "Rectangle", function() { return __WEBPACK_IMPORTED_MODULE_12__lib_math___["Rectangle"]; });
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "Matrix", function() { return __WEBPACK_IMPORTED_MODULE_12__lib_math___["Matrix"]; });
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "ColorMatrix", function() { return __WEBPACK_IMPORTED_MODULE_12__lib_math___["ColorMatrix"]; });
/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */

/* eslint-disable import/first */





















/***/ }),
/* 41 */
/***/ (function(module, exports) {

var g;

// This works in non-strict mode
g = (function() {
	return this;
})();

try {
	// This works if eval is allowed (see CSP)
	g = g || Function("return this")() || (1,eval)("this");
} catch(e) {
	// This works if the window reference is available
	if(typeof window === "object")
		g = window;
}

// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}

module.exports = g;


/***/ }),
/* 42 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */

/**
 * Represents a 2-dimensional vector while providing math functions to
 * modify / clone the vector. Fully chainable.
 * @class
 * @memberof PhotoEditorSDK.Math
 */
var Vector2 = function () {
  /**
   * Creates a Vector2
   * @param  {Number} x
   * @param  {Number} y
   */
  function Vector2(x, y) {
    _classCallCheck(this, Vector2);

    this.x = x;
    this.y = y;
    if (typeof this.x === 'undefined') {
      this.x = 0;
    }
    if (typeof this.y === 'undefined') {
      this.y = 0;
    }
  }

  /**
   * Sets the given values
   * @param {Number} x
   * @param {Number} y
   * @return {PhotoEditorSDK.Math.Vector2}
   */


  _createClass(Vector2, [{
    key: 'set',
    value: function set(x, y) {
      this.x = x;
      this.y = y;
      return this;
    }

    /**
     * Creates a clone of this vector
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'clone',
    value: function clone() {
      return new Vector2(this.x, this.y);
    }

    /**
     * Copies the values of the given vector
     * @param  {PhotoEditorSDK.Math.Vector2} other
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'copy',
    value: function copy(other) {
      this.x = other.x;
      this.y = other.y;
      return this;
    }

    /**
     * Clamps this vector with the given Vector2 / Number
     * @param  {(Number|PhotoEditorSDK.Math.Vector2)} minimum
     * @param  {(Number|PhotoEditorSDK.Math.Vector2)} maximum
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'clamp',
    value: function clamp(minimum, maximum) {
      var minimumSet = minimum !== null && typeof minimum !== 'undefined';
      var maximumSet = maximum !== null && typeof maximum !== 'undefined';

      /* istanbul ignore else  */
      if (!(minimum instanceof Vector2) && minimumSet) {
        minimum = new Vector2(minimum, minimum);
      }
      /* istanbul ignore else  */
      if (!(maximum instanceof Vector2) && maximumSet) {
        maximum = new Vector2(maximum, maximum);
      }

      if (minimumSet) {
        this.x = Math.max(minimum.x, this.x);
        this.y = Math.max(minimum.y, this.y);
      }

      if (maximumSet) {
        this.x = Math.min(maximum.x, this.x);
        this.y = Math.min(maximum.y, this.y);
      }
      return this;
    }

    /**
     * Divides this vector by the given Vector2 / Number
     * @param  {(Number|PhotoEditorSDK.Math.Vector2)} divisor
     * @param  {Number} [y]
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'divide',
    value: function divide(divisor, y) {
      if (divisor instanceof Vector2) {
        this.x /= divisor.x;
        this.y /= divisor.y;
      } else {
        this.x /= divisor;
        this.y /= typeof y === 'undefined' ? divisor : y;
      }
      return this;
    }

    /**
     * Subtracts the given Vector2 / Number from this vector
     * @param  {(Number|PhotoEditorSDK.Math.Vector2)} subtrahend
     * @param  {Number} [y]
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'subtract',
    value: function subtract(subtrahend, y) {
      if (subtrahend instanceof Vector2) {
        this.x -= subtrahend.x;
        this.y -= subtrahend.y;
      } else {
        this.x -= subtrahend;
        this.y -= typeof y === 'undefined' ? subtrahend : y;
      }
      return this;
    }

    /**
     * Multiplies the given Vector2 / Number with this vector
     * @param  {(Number|PhotoEditorSDK.Math.Vector2)} subtrahend
     * @param  {Number} [y]
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'multiply',
    value: function multiply(factor, y) {
      if (factor instanceof Vector2) {
        this.x *= factor.x;
        this.y *= factor.y;
      } else {
        this.x *= factor;
        this.y *= typeof y === 'undefined' ? factor : y;
      }
      return this;
    }

    /**
     * Adds the given Vector2 / Numbers to this vector
     * @param {(Number|PhotoEditorSDK.Math.Vector2)} addend
     * @param {Number} [y]
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'add',
    value: function add(addend, y) {
      if (addend instanceof Vector2) {
        this.x += addend.x;
        this.y += addend.y;
      } else {
        this.x += addend;
        this.y += typeof y === 'undefined' ? addend : y;
      }
      return this;
    }

    /**
     * Checks whether the x and y value are the same as the given ones
     * @param  {(Number|PhotoEditorSDK.Math.Vector2)} vec
     * @param  {Number} y
     * @return {Boolean}
     */

  }, {
    key: 'equals',
    value: function equals(vec, y) {
      if (vec instanceof Vector2) {
        return vec.x === this.x && vec.y === this.y;
      } else {
        return vec === this.x && y === this.y;
      }
    }

    /**
     * Flips the x and y values of this vector
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'flip',
    value: function flip() {
      var tempX = this.x;
      this.x = this.y;
      this.y = tempX;
      return this;
    }

    /**
     * Rounds the values of this vector
     * @returns {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'round',
    value: function round() {
      this.x = Math.round(this.x);
      this.y = Math.round(this.y);
      return this;
    }

    /**
     * Rounds up the values of this vector
     * @returns {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'ceil',
    value: function ceil() {
      this.x = Math.ceil(this.x);
      this.y = Math.ceil(this.y);
      return this;
    }

    /**
     * Rounds down the values of this vector
     * @returns {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'floor',
    value: function floor() {
      this.x = this.x | 0;
      this.y = this.y | 0;
      return this;
    }

    /**
     * Makes both numbers of this vector positive
     * @returns {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'abs',
    value: function abs() {
      this.x = Math.abs(this.x);
      this.y = Math.abs(this.y);
      return this;
    }

    /**
     * Returns the euclidean length of this vector
     * @return {Number}
     */

  }, {
    key: 'len',
    value: function len() {
      return Math.sqrt(this.x * this.x + this.y * this.y);
    }

    /**
     * Returns the smallest number in this vector
     * @return {Number}
     */

  }, {
    key: 'min',
    value: function min() {
      return Math.min(this.x, this.y);
    }

    /**
     * Returns the largest number in this vector
     * @return {Number}
     */

  }, {
    key: 'max',
    value: function max() {
      return Math.max(this.x, this.y);
    }

    /**
     * Returns a POJO of this Vector2
     * @return {Object}
     */

  }, {
    key: 'toObject',
    value: function toObject() {
      return { x: this.x, y: this.y };
    }

    /**
     * Returns a string representation of this vector
     * @return {String}
     */

  }, {
    key: 'toString',
    value: function toString() {
      return 'Vector2({ x: ' + this.x + ', y: ' + this.y + ' })';
    }

    /**
     * Rounds this vector's values to the given number of decimals
     * @param  {Number} decimals
     * @return {Number}
     */

  }, {
    key: 'roundDecimal',
    value: function roundDecimal(decimals) {
      this.x = parseFloat(this.x.toFixed(decimals));
      this.y = parseFloat(this.y.toFixed(decimals));
      return this;
    }

    /**
     * Creates a new Vector2 instance from the given Object
     * @param  {Object} object
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }], [{
    key: 'fromObject',
    value: function fromObject(object) {
      return new Vector2(object.x, object.y);
    }

    /**
     * Returns a null vector
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'NULL',
    get: function get() {
      return new Vector2(0, 0);
    }
  }]);

  return Vector2;
}();

/* harmony default export */ __webpack_exports__["a"] = (Vector2);

/***/ }),
/* 43 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignElement; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



var TextDesignElement = function (_Configurable) {
  _inherits(TextDesignElement, _Configurable);

  function TextDesignElement() {
    _classCallCheck(this, TextDesignElement);

    return _possibleConstructorReturn(this, (TextDesignElement.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignElement)).apply(this, arguments));
  }

  return TextDesignElement;
}(__WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__["Configurable"]);

TextDesignElement.prototype.availableOptions = {
  text: { type: __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__["OptionType"].STRING, default: '' },
  frame: { type: __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__["OptionType"].OBJECT, default: null },
  font: { type: __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__["OptionType"].OBJECT, default: null }
};

/***/ }),
/* 44 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignMasked; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__text_design__ = __webpack_require__(58);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__text_words__ = __webpack_require__(33);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__models_masked_row_type__ = __webpack_require__(61);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__models_rows_masked_text_design_row_multiline__ = __webpack_require__(106);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__text_design_asset_manager__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__models_randomizer__ = __webpack_require__(16);







var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */









// TODO: TextDesignRowMultiline

var TextDesignMasked = function (_TextDesign) {
  _inherits(TextDesignMasked, _TextDesign);

  function TextDesignMasked() {
    var _ref;

    _classCallCheck(this, TextDesignMasked);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = TextDesignMasked.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignMasked)).call.apply(_ref, [this].concat(args)));

    _this._rowType = __WEBPACK_IMPORTED_MODULE_9__models_masked_row_type__["a" /* RowType */].Box;

    _this._alignmentRandomizer = new __WEBPACK_IMPORTED_MODULE_12__models_randomizer__["a" /* Randomizer */](0);
    _this._isMaskedRandomizer = new __WEBPACK_IMPORTED_MODULE_12__models_randomizer__["a" /* Randomizer */](0);

    _this._seedPool.push(_this._alignmentRandomizer);
    _this._seedPool.push(_this._isMaskedRandomizer);
    return _this;
  }

  _createClass(TextDesignMasked, [{
    key: 'getImagePaths',
    value: function getImagePaths() {
      return [__WEBPACK_IMPORTED_MODULE_9__models_masked_row_type__["a" /* RowType */].Box.getImagePath()];
    }
  }, {
    key: '_modifiedText',
    value: function _modifiedText(text) {
      return _get(TextDesignMasked.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignMasked.prototype), '_modifiedText', this).call(this, text).toLowerCase();
    }
  }, {
    key: '_modifiedLines',
    value: function _modifiedLines(lines) {
      var words = new __WEBPACK_IMPORTED_MODULE_8__text_words__["a" /* Words */]();
      words.set([lines.reduce(function (acc, line) {
        return '' + acc + (acc === '' ? '' : '\n') + line.joined(1)[0];
      }, '')]);
      return [words];
    }
  }, {
    key: '_layoutRows',
    value: function _layoutRows(lines, width) {
      var rows = _get(TextDesignMasked.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignMasked.prototype), '_layoutRows', this).call(this, lines, width);
      var firstRow = rows[0];

      if (firstRow && this.getSquareLayout()) {
        var size = firstRow.getSize();
        size.height = size.width;
      }

      return rows;
    }
  }, {
    key: 'getAlignment',
    value: function getAlignment() {
      return this._alignmentRandomizer.pickNext(this.constructor.ValidAlignments || TextDesignMasked.ValidAlignments);
    }
  }, {
    key: '_randomLayoutRow',
    value: function _randomLayoutRow(words, index, width, attributes) {
      var alignment = this.getAlignment();
      var rowType = this._rowType;
      var image = __WEBPACK_IMPORTED_MODULE_11__text_design_asset_manager__["a" /* AssetManager */].getImage(rowType.getImagePath());

      attributes.setAlignment(alignment);

      var row = new __WEBPACK_IMPORTED_MODULE_10__models_rows_masked_text_design_row_multiline__["a" /* TextDesignRowMultiline */]({
        words: words,
        width: width,
        attributes: attributes,
        image: image,
        imageInsets: rowType.insetsForWidth(width),
        capInsets: rowType.getCapInsets(),
        backgroundColor: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Color"].WHITE,
        centerOffset: 0,
        textScaleFactor: 0.7,
        isMasked: this._isMaskedRandomizer.nextBool()
      });

      if (this._rowType === __WEBPACK_IMPORTED_MODULE_9__models_masked_row_type__["a" /* RowType */].Box) {
        row.serverImageSmoothingFix = true;
      }

      var rowSize = row.getSize();

      if (this.getSquareLayout()) {
        rowSize.height = rowSize.width;
      } else {
        rowSize.height = Math.max(rowSize.height, rowSize.width * rowType.getMinimumHeightRatio());
      }

      return row;
    }
  }]);

  return TextDesignMasked;
}(__WEBPACK_IMPORTED_MODULE_7__text_design__["a" /* TextDesign */]);

TextDesignMasked.defaultFontIdentifiers = ['imgly_font_galano_grotesque_bold'];
TextDesignMasked.Alignment = {
  Left: 'left',
  Center: 'center',
  Right: 'right'
};
TextDesignMasked.ValidAlignments = [TextDesignMasked.Alignment.Left, TextDesignMasked.Alignment.Center, TextDesignMasked.Alignment.Right];
TextDesignMasked.identifier = 'imgly_text_design_masked';
TextDesignMasked.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_7__text_design__["a" /* TextDesign */].prototype.availableOptions, {
  fontIdentifiers: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].ARRAY, default: TextDesignMasked.defaultFontIdentifiers },
  squareLayout: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].BOOLEAN, default: true }
});

/***/ }),
/* 45 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $at = __webpack_require__(161)(true);

// 21.1.3.27 String.prototype[@@iterator]()
__webpack_require__(109)(String, 'String', function (iterated) {
  this._t = String(iterated); // target
  this._i = 0;                // next index
// 21.1.5.2.1 %StringIteratorPrototype%.next()
}, function () {
  var O = this._t;
  var index = this._i;
  var point;
  if (index >= O.length) return { value: undefined, done: true };
  point = $at(O, index);
  this._i += point.length;
  return { value: point, done: false };
});


/***/ }),
/* 46 */
/***/ (function(module, exports) {

module.exports = function (bitmap, value) {
  return {
    enumerable: !(bitmap & 1),
    configurable: !(bitmap & 2),
    writable: !(bitmap & 4),
    value: value
  };
};


/***/ }),
/* 47 */
/***/ (function(module, exports, __webpack_require__) {

// 19.1.2.14 / 15.2.3.14 Object.keys(O)
var $keys = __webpack_require__(112);
var enumBugKeys = __webpack_require__(85);

module.exports = Object.keys || function keys(O) {
  return $keys(O, enumBugKeys);
};


/***/ }),
/* 48 */
/***/ (function(module, exports) {

var toString = {}.toString;

module.exports = function (it) {
  return toString.call(it).slice(8, -1);
};


/***/ }),
/* 49 */
/***/ (function(module, exports, __webpack_require__) {

// 7.1.13 ToObject(argument)
var defined = __webpack_require__(78);
module.exports = function (it) {
  return Object(defined(it));
};


/***/ }),
/* 50 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/*
 * Extracted from MinifyJpeg (Copyright (c) 2014 Hiroaki Matoba, MIT License):
 * https://github.com/hMatoba/MinifyJpeg
 * @license
 */

var KEY_STR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';

/**
 * Provides Base64 encode and decode methods
 * @type {Object}
 * @ignore
 */
/* istanbul ignore next */
var Base64 = {
  /**
   * Encodes the given input into a Base64 string
   * @param  {String} input
   * @return {String}
   */
  encode: function encode(input) {
    var output = '';
    var chr1 = void 0,
        chr2 = void 0,
        chr3 = void 0;
    var enc1 = void 0,
        enc2 = void 0,
        enc3 = void 0,
        enc4 = void 0;
    var i = 0;

    do {
      chr1 = input[i++];
      chr2 = input[i++];
      chr3 = input[i++];

      enc1 = chr1 >> 2;
      enc2 = (chr1 & 3) << 4 | chr2 >> 4;
      enc3 = (chr2 & 15) << 2 | chr3 >> 6;
      enc4 = chr3 & 63;

      if (isNaN(chr2)) {
        enc3 = enc4 = 64;
      } else if (isNaN(chr3)) {
        enc4 = 64;
      }

      output = output + KEY_STR.charAt(enc1) + KEY_STR.charAt(enc2) + KEY_STR.charAt(enc3) + KEY_STR.charAt(enc4);
      chr1 = chr2 = chr3 = '';
      enc1 = enc2 = enc3 = enc4 = '';
    } while (i < input.length);

    return output;
  },


  /**
   * Decodes the given Base64 string
   * @param  {String} input
   * @return {String}
   */
  decode: function decode(input) {
    var chr1 = void 0,
        chr2 = void 0,
        chr3 = void 0;
    var enc1 = void 0,
        enc2 = void 0,
        enc3 = void 0,
        enc4 = void 0;
    var i = 0;
    var buf = [];

    // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
    var base64test = /[^A-Za-z0-9+/=]/g;
    if (base64test.exec(input)) {
      throw new Error('There were invalid base64 characters in the input text.\n' + 'Valid base64 characters are A-Z, a-z, 0-9, \'+\', \'/\',and \'=\'\n' + 'Expect errors in decoding.');
    }
    input = input.replace(/[^A-Za-z0-9+/=]/g, '');

    do {
      enc1 = KEY_STR.indexOf(input.charAt(i++));
      enc2 = KEY_STR.indexOf(input.charAt(i++));
      enc3 = KEY_STR.indexOf(input.charAt(i++));
      enc4 = KEY_STR.indexOf(input.charAt(i++));

      chr1 = enc1 << 2 | enc2 >> 4;
      chr2 = (enc2 & 15) << 4 | enc3 >> 2;
      chr3 = (enc3 & 3) << 6 | enc4;

      buf.push(chr1);

      if (enc3 !== 64) {
        buf.push(chr2);
      }
      if (enc4 !== 64) {
        buf.push(chr3);
      }

      chr1 = chr2 = chr3 = '';
      enc1 = enc2 = enc3 = enc4 = '';
    } while (i < input.length);

    return buf;
  }
};

/* harmony default export */ __webpack_exports__["a"] = (Base64);

/***/ }),
/* 51 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_is_iterable__ = __webpack_require__(70);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_is_iterable___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_is_iterable__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_get_iterator__ = __webpack_require__(71);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_get_iterator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_get_iterator__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property__);




var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_get_iterator___default()(arr), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_is_iterable___default()(Object(arr))) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */

/**
 * Represents a color
 * @class
 * @memberof PhotoEditorSDK
 */
var Color = function () {
  /**
   * Creates a color
   * @param  {Number} r
   * @param  {Number} g
   * @param  {Number} b
   * @param  {Number} [a = 1]
   */
  function Color(r, g, b) {
    var a = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1.0;

    _classCallCheck(this, Color);

    this.r = r;
    this.g = g;
    this.b = b;
    this.a = a;
  }

  /**
   * Returns an rgba() representation of this color
   * @return {String}
   */


  _createClass(Color, [{
    key: 'toRGBA',
    value: function toRGBA() {
      var colors = [Math.round(this.r * 255), Math.round(this.g * 255), Math.round(this.b * 255), this.a.toFixed(2)];
      return 'rgba(' + colors.join(',') + ')';
    }

    /**
     * Sets this color's values to the given RGBA values
     * @param {Number} r
     * @param {Number} g
     * @param {Number} b
     * @param {Number} [a]
     * @return {PhotoEditorSDK.Color}
     */

  }, {
    key: 'set',
    value: function set(r, g, b) {
      var a = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : this.a;

      this.r = r;
      this.g = g;
      this.b = b;
      this.a = a;
      return this;
    }

    /**
     * Returns an array with 3 values (0...255)
     * @return {Number[]}
     */

  }, {
    key: 'toRGB',
    value: function toRGB() {
      return [Math.round(this.r * 255), Math.round(this.g * 255), Math.round(this.b * 255)];
    }

    /**
     * Returns a hex representation of this color
     * @return {String}
     */

  }, {
    key: 'toHex',
    value: function toHex() {
      var components = [this._componentToHex(Math.round(this.r * 255)), this._componentToHex(Math.round(this.g * 255)), this._componentToHex(Math.round(this.b * 255))];
      return '#' + components.join('');
    }

    /**
     * Returns an array with 4 values (0...1)
     * @return {Number[]}
     */

  }, {
    key: 'toGLColor',
    value: function toGLColor() {
      return [this.r, this.g, this.b, this.a];
    }

    /**
     * Returns an array with 4 values (0...1)
     * @return {Number[]}
     */

  }, {
    key: 'toArray',
    value: function toArray() {
      return this.toGLColor();
    }

    /**
     * Returns an array with 3 values (0...1)
     * @return {Number[]}
     */

  }, {
    key: 'toRGBGLColor',
    value: function toRGBGLColor() {
      return [this.r, this.g, this.b];
    }

    /**
     * Converts the RGB value to HSV
     * @return {Number[]}
     */

  }, {
    key: 'toHSV',
    value: function toHSV() {
      var max = Math.max(this.r, this.g, this.b);
      var min = Math.min(this.r, this.g, this.b);
      var h = void 0;
      var s = void 0;
      var v = max;
      var d = max - min;
      s = max === 0 ? 0 : d / max;

      if (max === min) {
        h = 0; // achromatic
      } else {
        switch (max) {
          case this.r:
            h = (this.g - this.b) / d;
            if (this.g < this.b) {
              h += 6;
            }
            break;
          case this.g:
            h = (this.b - this.r) / d + 2;
            break;
          case this.b:
            h = (this.r - this.g) / d + 4;
            break;
        }
        h /= 6;
      }

      return [h, s, v];
    }

    /**
     * Sets the RGB values according to the given HSV values
     * @param  {Number} h
     * @param  {Number} s
     * @param  {Number} v
     */

  }, {
    key: 'fromHSV',
    value: function fromHSV(h, s, v) {
      this.copy(Color.fromHSV(h, s, v));
      return this;
    }

    /**
     * Creates an RGBA color from the given HSV and alpha values
     * @param {Number} h
     * @param {Number} s
     * @param {Number} v
     * @param {Number} [a = 1]
     */

  }, {
    key: 'clone',


    /**
     * Returns a clone of the current color
     * @return {PhotoEditorSDK.Color}
     */
    value: function clone() {
      return new Color(this.r, this.g, this.b, this.a);
    }

    /**
     * Adds another color
     * @param {PhotoEditorSDK.Color} color
     * @return {PhotoEditorSDK.Color}
     */

  }, {
    key: 'add',
    value: function add(color) {
      this.r += color.r;
      this.g += color.g;
      this.b += color.b;
      this.a += color.a;
      return this;
    }

    /**
     * Subtract another color
     * @param {PhotoEditorSDK.Color} color
     * @return {PhotoEditorSDK.Color}
     */

  }, {
    key: 'minus',
    value: function minus(color) {
      this.r -= color.r;
      this.g -= color.g;
      this.b -= color.b;
      this.a -= color.a;
      return this;
    }

    /**
     * Multiply with a scalar
     * @param {Number} val
     * @return {PhotoEditorSDK.Color}
     */

  }, {
    key: 'multiplyScalar',
    value: function multiplyScalar(val) {
      this.r *= val;
      this.g *= val;
      this.b *= val;
      this.a *= val;
      return this;
    }

    /**
     * Divide with a scalar
     * @param {Number} val
     * @return {PhotoEditorSDK.Color}
     */

  }, {
    key: 'divideScalar',
    value: function divideScalar(val) {
      this.r /= val;
      this.g /= val;
      this.b /= val;
      this.a /= val;
      return this;
    }

    /**
     * clamp
     * @param {Number} minVal
     * @param {Number} maxVal
     * @return {PhotoEditorSDK.Color}
     */

  }, {
    key: 'clamp',
    value: function clamp(minVal, maxVal) {
      this.r = Math.min(Math.max(this.r, minVal), maxVal);
      this.g = Math.min(Math.max(this.g, minVal), maxVal);
      this.b = Math.min(Math.max(this.b, minVal), maxVal);
      this.a = Math.min(Math.max(this.a, minVal), maxVal);
      return this;
    }

    /**
     * Copies the values from the given color
     * @param  {PhotoEditorSDK.Color} color
     * @return {PhotoEditorSDK.Color}
     */

  }, {
    key: 'copy',
    value: function copy(color) {
      this.r = color.r;
      this.g = color.g;
      this.b = color.b;
      this.a = color.a;
      return this;
    }

    /**
     * Checks if this color equals the given one
     * @param  {PhotoEditorSDK.Color} color
     * @return {Boolean}
     */

  }, {
    key: 'equals',
    value: function equals(color) {
      return this.r === color.r && this.g === color.g && this.b === color.b && this.a === color.a;
    }

    /**
     * Returns the given number as hex
     * @param  {Number} component
     * @return {String}
     * @private
     */

  }, {
    key: '_componentToHex',
    value: function _componentToHex(component) {
      var hex = component.toString(16);
      return hex.length === 1 ? '0' + hex : hex;
    }

    /**
     * Returns the string representation of this color
     * @returns {String}
     */

  }, {
    key: 'toString',
    value: function toString() {
      return 'Color(' + this.r + ', ' + this.g + ', ' + this.b + ', ' + this.a + ')';
    }

    /**
     * @type {PhotoEditorSDK.Color}
     */

  }], [{
    key: 'fromHSV',
    value: function fromHSV(h, s, v) {
      var a = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
      var _ref = [],
          r = _ref[0],
          g = _ref[1],
          b = _ref[2];


      var i = Math.floor(h * 6);
      var f = h * 6 - i;
      var p = v * (1 - s);
      var q = v * (1 - f * s);
      var t = v * (1 - (1 - f) * s);

      switch (i % 6) {
        case 0:
          r = v;
          g = t;
          b = p;
          break;
        case 1:
          r = q;
          g = v;
          b = p;
          break;
        case 2:
          r = p;
          g = v;
          b = t;
          break;
        case 3:
          r = p;
          g = q;
          b = v;
          break;
        case 4:
          r = t;
          g = p;
          b = v;
          break;
        case 5:
          r = v;
          g = p;
          b = q;
          break;
      }

      return new Color(r, g, b, a);
    }

    /**
     * Creates a new Color object from the given array of numbers
     * @param  {Number[]} arr
     * @return {PhotoEditorSDK.Color}
     */

  }, {
    key: 'fromArray',
    value: function fromArray(arr) {
      return new Color(arr[0], arr[1], arr[2], arr[3]);
    }

    /**
     * Creates a new color object from the given hex string
     * @param  {String} hex
     * @return {PhotoEditorSDK.Color}
     */

  }, {
    key: 'fromHex',
    value: function fromHex(hex) {
      var _hex$match = hex.match(/.{1,2}/g),
          _hex$match2 = _slicedToArray(_hex$match, 3),
          r = _hex$match2[0],
          g = _hex$match2[1],
          b = _hex$match2[2];

      return new Color(parseInt(r, 16) / 255, parseInt(g, 16) / 255, parseInt(b, 16) / 255, 1.0);
    }
  }, {
    key: 'TRANSPARENT',
    get: function get() {
      return new Color(0, 0, 0, 0);
    }

    /**
     * @type {PhotoEditorSDK.Color}
     */

  }, {
    key: 'WHITE',
    get: function get() {
      return new Color(1, 1, 1, 1);
    }

    /**
     * @type {PhotoEditorSDK.Color}
     */

  }, {
    key: 'BLACK',
    get: function get() {
      return new Color(0, 0, 0, 1);
    }

    /**
     * @type {PhotoEditorSDK.Color}
     */

  }, {
    key: 'RED',
    get: function get() {
      return new Color(1, 0, 0, 1);
    }

    /**
     * @type {PhotoEditorSDK.Color}
     */

  }, {
    key: 'BLUE',
    get: function get() {
      return new Color(0, 0, 1, 1);
    }

    /**
     * @type {PhotoEditorSDK.Color}
     */

  }, {
    key: 'GREEN',
    get: function get() {
      return new Color(0, 1, 0, 1);
    }
  }]);

  return Color;
}();

/* harmony default export */ __webpack_exports__["a"] = (Color);

/***/ }),
/* 52 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__shared_log__ = __webpack_require__(30);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 * EventEmitter (ES6) from:
 * https://gist.github.com/bloodyowl/41b1de3388c626796eca
 */


var DEFAULT_MAX_LISTENERS = 12;

/**
 * Receives and emits events
 * @class
 * @memberof PhotoEditorSDK
 */

var EventEmitter = function () {
  /**
   * Creates an EventEmitter
   */
  function EventEmitter() {
    _classCallCheck(this, EventEmitter);

    this._maxListeners = DEFAULT_MAX_LISTENERS;
    this._events = {};
    this._pipeDestinations = [];
  }

  /**
   * Pipes all events to the given EventEmitter
   * @param  {EventEmitter} destination
   */


  _createClass(EventEmitter, [{
    key: 'pipeEvents',
    value: function pipeEvents(destination) {
      this._pipeDestinations.push(destination);
    }

    /**
     * Stops piping events to the given EventEmitter
     * @param  {EventEmitter} destination
     */

  }, {
    key: 'unpipeEvents',
    value: function unpipeEvents(destination) {
      var i = this._pipeDestinations.indexOf(destination);
      if (i === -1) {
        return;
      }
      this._pipeDestinations.splice(i, 1);
    }

    /**
     * Adds the given listener to the given type of events
     * @param  {String} type
     * @param  {Function} listener
     */

  }, {
    key: 'on',
    value: function on(type, listener) {
      if (typeof type === 'undefined') {
        throw new Error('Invalid event type: `' + type + '`');
      }

      if (typeof listener !== 'function') {
        throw new TypeError();
      }

      var listeners = this._events[type] || (this._events[type] = []);
      if (listeners.indexOf(listener) !== -1) {
        return this;
      }
      listeners.push(listener);

      if (this._maxListeners && listeners.length > this._maxListeners) {
        __WEBPACK_IMPORTED_MODULE_1__shared_log__["a" /* default */].warn('EventEmitter', 'Possible memory leak detected, added ' + listeners.length + ' `' + type + '` listeners (current limit is ' + this._maxListeners + ')');
        if (typeof console !== 'undefined') {
          console.trace();
        }
      }
      return this;
    }

    /**
     * Adds the given listener to the given type of events and removes it
     * once it has been triggered
     * @param  {String} type
     * @param  {Function} listener
     */

  }, {
    key: 'once',
    value: function once(type, listener) {
      if (typeof type === 'undefined') {
        throw new Error('Invalid event type: `' + type + '`');
      }

      var eventsInstance = this;
      function onceCallback() {
        eventsInstance.off(type, onceCallback);
        listener.apply(null, arguments);
      }
      return this.on(type, onceCallback);
    }

    /**
     * Removes the given listener from the given type of events
     * @param  {String} type
     * @param  {*} ...args
     */

  }, {
    key: 'off',
    value: function off(type) {
      if (typeof type === 'undefined') {
        throw new Error('Invalid event type: `' + type + '`');
      }

      if ((arguments.length <= 1 ? 0 : arguments.length - 1) === 0) {
        this._events[type] = null;
        return this;
      }

      var listener = arguments.length <= 1 ? undefined : arguments[1];
      if (typeof listener !== 'function') {
        throw new TypeError();
      }

      var listeners = this._events[type];
      if (!listeners || !listeners.length) {
        return this;
      }

      var indexOfListener = listeners.indexOf(listener);
      if (indexOfListener === -1) {
        return this;
      }

      listeners.splice(indexOfListener, 1);
      return this;
    }

    /**
     * Emits an event with the given type and arguments
     * @param  {String} type
     * @param  {*} ...args
     */

  }, {
    key: 'emit',
    value: function emit(type) {
      for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
        args[_key - 1] = arguments[_key];
      }

      if (typeof type === 'undefined') {
        throw new Error('Invalid event type: `' + type + '`');
      }

      this._pipeDestinations.forEach(function (dest) {
        dest.emit.apply(dest, [type].concat(args));
      });

      var listeners = this._events[type];
      if (!listeners || !listeners.length) {
        return false;
      }

      listeners.slice(0).forEach(function (fn) {
        return fn.apply(null, args);
      });

      return true;
    }

    /**
     * Sets the maximum amonut of listeners before a warning is printed
     * @param {Number} newMaxListeners
     */

  }, {
    key: 'setMaxListeners',
    value: function setMaxListeners(newMaxListeners) {
      if (parseInt(newMaxListeners, 10) !== newMaxListeners) {
        throw new TypeError();
      }

      this._maxListeners = newMaxListeners;
    }
  }]);

  return EventEmitter;
}();

/* harmony default export */ __webpack_exports__["a"] = (EventEmitter);

/***/ }),
/* 53 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__globals__ = __webpack_require__(9);






var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from___default()(arr); } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



/**
 * A BaseTexture holds and handles the raw source of a texture
 * @class
 * @extends EventEmitter
 * @memberof PhotoEditorSDK.Engine
 */

var BaseTexture = function (_EventEmitter) {
  _inherits(BaseTexture, _EventEmitter);

  /**
   * Creates a BaseTexture
   * @param  {*} source
   */
  function BaseTexture(source) {
    _classCallCheck(this, BaseTexture);

    var _this = _possibleConstructorReturn(this, (BaseTexture.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(BaseTexture)).call(this));

    _this.id = BaseTexture.id++;
    _this._onSourceLoaded = _this._onSourceLoaded.bind(_this);

    _this._renderers = [];
    _this._glTextures = {};
    _this._source = source;
    _this._dirty = true;

    _this._glUnit = 0;
    _this._mipMapping = false;
    _this._magFilter = BaseTexture.DefaultMagFilter;
    _this._minFilter = BaseTexture.DefaultMinFilter;
    _this._repeatX = BaseTexture.ClampToEdge;
    _this._repeatY = BaseTexture.ClampToEdge;

    _this._pixelRatio = 1;
    _this._loaded = false;
    _this._frame = new __WEBPACK_IMPORTED_MODULE_5__globals__["h" /* Rectangle */](0, 0, 100, 100);

    if (source) {
      _this._loadSource();
    }
    return _this;
  }

  /**
   * Resizes this BaseTexture to the given dimensions
   * @param  {PhotoEditorSDK.Math.Vector2} dimensions
   */


  _createClass(BaseTexture, [{
    key: 'resizeTo',
    value: function resizeTo(dimensions) {
      if (this._frame.width === dimensions.x && this._frame.height === dimensions.y) {
        return;
      }

      this._frame.width = dimensions.x;
      this._frame.height = dimensions.y;
      this._dirty = true;
    }

    /**
     * Loads the source
     * @private
     */

  }, {
    key: '_loadSource',
    value: function _loadSource() {
      var source = this._source;

      var sourceLoaded = source.complete;
      var sourceIsCanvas = source.constructor.name === 'Canvas' || source.tagName && source.tagName.toUpperCase() === 'CANVAS';
      if (sourceLoaded || sourceIsCanvas) {
        return this._onSourceLoaded();
      }

      source.addEventListener('load', this._onSourceLoaded);
    }

    /**
     * Gets called when the source of this BaseTexture has been loaded
     * @private
     */

  }, {
    key: '_onSourceLoaded',
    value: function _onSourceLoaded() {
      this._loaded = true;
      this.emit('loaded');
      this.update();
    }

    /**
     * If mip-mapping is available, update GL filters accordingly
     * @private
     */
    /* istanbul ignore next */

  }, {
    key: '_updateGLFilters',
    value: function _updateGLFilters() {
      var sourceDimensions = new __WEBPACK_IMPORTED_MODULE_5__globals__["k" /* Vector2 */](this._source.width, this._source.height);
      if (__WEBPACK_IMPORTED_MODULE_5__globals__["i" /* Utils */].isPowerOfTwo(sourceDimensions)) {
        __WEBPACK_IMPORTED_MODULE_5__globals__["f" /* Log */].info(this.constructor.name, 'Mip-mapping enabled');
        this._minFilter = BaseTexture.TrilinearFilter;
        this._mipMapping = true;
      } else {
        this._minFilter = BaseTexture.LinearFilter;
        this._mipMapping = false;
      }
    }

    /**
     * Updates the cached dimensions of this BaseTexture's source
     */

  }, {
    key: 'update',
    value: function update() {
      if (this._frame.width !== this._source.width || this._frame.height !== this._source.height) {
        this._frame = new __WEBPACK_IMPORTED_MODULE_5__globals__["h" /* Rectangle */](0, 0, this._source.width, this._source.height);
        this._dirty = true;
      }

      this._updateGLFilters();
      this.emit('update');
    }
  }, {
    key: 'getRenderers',
    value: function getRenderers() {
      return [].concat(_toConsumableArray(this._renderers));
    }

    /**
     * Returns the filter for the given direction from the given WebGL context
     * @param  {WebGLRenderingContext} gl
     * @param  {String} minOrMag
     * @return {Number}
     */
    /* istanbul ignore next */

  }, {
    key: 'getGLFilter',
    value: function getGLFilter(gl, minOrMag) {
      switch (minOrMag) {
        case 'min':
          return this.constructor.getGLFilter(gl, this._minFilter);
        case 'mag':
          return this.constructor.getGLFilter(gl, this._magFilter);
      }
    }

    /**
     * Returns the filter for the given enum value from the given WebGL context
     * @param  {WebGLRenderingContext} gl
     * @param  {Number} filterEnum
     * @return {Number}
     */
    /* istanbul ignore next */

  }, {
    key: 'isLoaded',


    /**
     * Checks if this BaseTexture has been loaded
     * @return {Boolean}
     */
    value: function isLoaded() {
      return this._loaded;
    }

    /**
     * Sets the loaded state
     * @param {Boolean} loaded
     */

  }, {
    key: 'setLoaded',
    value: function setLoaded(loaded) {
      this._loaded = loaded;
    }

    /**
     * Returns the source
     * @return {*} s
     */

  }, {
    key: 'getSource',
    value: function getSource() {
      return this._source;
    }

    /**
     * Sets the source
     * @param {*} source
     */

  }, {
    key: 'setSource',
    value: function setSource(source) {
      this._source = source;
    }

    /**
     * Returns the WebGL texture for the given renderer ID
     * @param  {PhotoEditorSDK.Engine.Renderer} renderer
     * @return {WebGLTexture}
     */
    /* istanbul ignore next */

  }, {
    key: 'getGLTextureForRenderer',
    value: function getGLTextureForRenderer(renderer) {
      return this._glTextures[renderer.id];
    }

    /**
     * Sets the WebGLTexture for the given renderer ID
     * @param {WebGLTexture} texture
     * @param {PhotoEditorSDK.Engine.WebGLRenderer} renderer
     */
    /* istanbul ignore next */

  }, {
    key: 'setGLTextureForRenderer',
    value: function setGLTextureForRenderer(texture, renderer) {
      this._renderers[renderer.id] = renderer;
      this._glTextures[renderer.id] = texture;
    }

    /**
     * Returns the frame
     * @return {PhotoEditorSDK.Math.Rectangle}
     */

  }, {
    key: 'getFrame',
    value: function getFrame() {
      return this._frame;
    }

    /**
     * Sets the frame
     * @param {PhotoEditorSDK.Math.Rectangle} frame
     */

  }, {
    key: 'setFrame',
    value: function setFrame(frame) {
      this._frame = frame;
    }

    /**
     * Returns the dimensions
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'getDimensions',
    value: function getDimensions() {
      return new __WEBPACK_IMPORTED_MODULE_5__globals__["k" /* Vector2 */](this._frame.width, this._frame.height);
    }

    /**
     * Returns the pixel ratio
     * @return {Number}
     */

  }, {
    key: 'getPixelRatio',
    value: function getPixelRatio() {
      return this._pixelRatio;
    }

    /**
     * Sets the pixel ratio
     * @param {Number} pixelRatio
     */

  }, {
    key: 'setPixelRatio',
    value: function setPixelRatio(pixelRatio) {
      this._pixelRatio = pixelRatio;
    }

    /**
     * Returns the WebGL texture unit
     * @return {Number}
     */
    /* istanbul ignore next */

  }, {
    key: 'getGLUnit',
    value: function getGLUnit() {
      return this._glUnit;
    }

    /**
     * Sets the WebGL texture unit
     * @param {Number} glUnit
     */
    /* istanbul ignore next */

  }, {
    key: 'setGLUnit',
    value: function setGLUnit(glUnit) {
      this._glUnit = glUnit;
    }

    /**
     * Sets the min filter to the given one
     * @param {Number} minFilter
     */
    /* istanbul ignore next */

  }, {
    key: 'setMinFilter',
    value: function setMinFilter(minFilter) {
      this._minFilter = minFilter;
    }

    /**
     * Returns this texture's min filter
     * @return {Number}
     */
    /* istanbul ignore next */

  }, {
    key: 'getMinFilter',
    value: function getMinFilter() {
      return this._minFilter;
    }

    /**
     * Sets the mag filter to the given one
     * @param {Number} magFilter
     */
    /* istanbul ignore next */

  }, {
    key: 'setMagFilter',
    value: function setMagFilter(magFilter) {
      this._magFilter = magFilter;
    }

    /**
     * Returns this texture's mag filter
     * @return {Number}
     */
    /* istanbul ignore next */

  }, {
    key: 'getMagFilter',
    value: function getMagFilter() {
      return this._magFilter;
    }

    /**
     * Sets the way the texture is repeated on the X axis
     * @param {Number} repeat
     */

  }, {
    key: 'setRepeatX',
    value: function setRepeatX(repeat) {
      this._repeatX = repeat;
    }

    /**
     * Returns the way the texture is repeated on the X axis
     * @return {Number}
     */

  }, {
    key: 'getRepeatX',
    value: function getRepeatX() {
      return this._repeatX;
    }

    /**
     * Sets the way the texture is repeated on the Y axis
     * @param {Number} repeat
     */

  }, {
    key: 'setRepeatY',
    value: function setRepeatY(repeat) {
      this._repeatY = repeat;
    }

    /**
     * Returns the way the texture is repeated on the Y axis
     * @return {Number}
     */

  }, {
    key: 'getRepeatY',
    value: function getRepeatY() {
      return this._repeatY;
    }

    /**
     * Returns the correct ENUM value for the given repeat direction
     * @param  {WebGLRenderingContext} gl
     * @param  {String} direction
     * @return {Number}
     */

  }, {
    key: 'getGLRepeat',
    value: function getGLRepeat(gl, direction) {
      var value = direction === 'x' ? this.getRepeatX() : this.getRepeatY();
      switch (value) {
        case BaseTexture.ClampToEdge:
          return gl.CLAMP_TO_EDGE;
        case BaseTexture.Repeat:
          return gl.REPEAT;
        case BaseTexture.MirroredRepeat:
          return gl.MIRRORED_REPEAT;
      }
    }

    /**
     * Checks if this base texture needs to be updated
     * @return {Boolean}
     */
    /* istanbul ignore next */

  }, {
    key: 'isDirty',
    value: function isDirty() {
      return this._dirty;
    }

    /**
     * Sets the dirtiness of this base texture
     * @param {Boolean} dirty
     */
    /* istanbul ignore next */

  }, {
    key: 'setDirty',
    value: function setDirty(dirty) {
      this._dirty = dirty;
    }

    /**
     * Disposes the WebGL textures for all renderers
     */
    /* istanbul ignore next */

  }, {
    key: 'disposeGLTextures',
    value: function disposeGLTextures() {
      for (var rendererId in this._renderers) {
        this.disposeGLTexturesForRenderer(this._renderers[rendererId]);
      }
    }

    /**
     * Disposes the WebGL textures for the given renderer
     * @param {PhotoEditorSDK.Engine.WebGLRenderer} renderer
     */
    /* istanbul ignore next */

  }, {
    key: 'disposeGLTexturesForRenderer',
    value: function disposeGLTexturesForRenderer(renderer) {
      if (!this._glTextures[renderer.id]) return;

      var gl = renderer.getContext();
      gl.deleteTexture(this._glTextures[renderer.id]);
      delete this._glTextures[renderer.id];

      if (!this._renderers[renderer.id]) {
        delete this._renderers[renderer.id];
      }
    }

    /**
     * Checks if mip-mapping is enabled for this texture
     * @return {Boolean}
     */

  }, {
    key: 'isMipMappingEnabled',
    value: function isMipMappingEnabled() {
      return this._mipMapping;
    }

    /**
     * Sets the state for mip mapping
     * @param {Boolean} enabled
     */

  }, {
    key: 'setMipMappingEnabled',
    value: function setMipMappingEnabled(enabled) {
      this._mipMapping = enabled;
    }

    /**
     * Cleans up this object
     * @param  {PhotoEditorSDK.Engine.WebGLRenderer} renderer
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      var renderer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;

      this.disposeGLTextures();
    }
  }], [{
    key: 'getGLFilter',
    value: function getGLFilter(gl, filterEnum) {
      switch (filterEnum) {
        case BaseTexture.LinearFilter:
          return gl.LINEAR;
        case BaseTexture.NearestFilter:
          return gl.NEAREST;
        case BaseTexture.BilinearFilter:
          return gl.LINEAR_MIPMAP_NEAREST;
        case BaseTexture.TrilinearFilter:
          return gl.LINEAR_MIPMAP_LINEAR;
      }
    }
  }]);

  return BaseTexture;
}(__WEBPACK_IMPORTED_MODULE_5__globals__["d" /* EventEmitter */]);

BaseTexture.NearestFilter = 0;
BaseTexture.LinearFilter = 1;
BaseTexture.BilinearFilter = 2;
BaseTexture.TrilinearFilter = 3;

BaseTexture.DefaultMagFilter = BaseTexture.NearestFilter;
BaseTexture.DefaultMinFilter = BaseTexture.LinearFilter;

BaseTexture.ClampToEdge = 0;
BaseTexture.Repeat = 1;
BaseTexture.MirroredRepeat = 2;

BaseTexture.id = 0;

/* harmony default export */ __webpack_exports__["a"] = (BaseTexture);

/***/ }),
/* 54 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__globals__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__lib_configurable__ = __webpack_require__(55);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__shaders_shader__ = __webpack_require__(97);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__shaders_texture_shader__ = __webpack_require__(96);






var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */





var OptionType = __WEBPACK_IMPORTED_MODULE_5__globals__["c" /* Constants */].OptionType,
    UniformType = __WEBPACK_IMPORTED_MODULE_5__globals__["c" /* Constants */].UniformType,
    RendererType = __WEBPACK_IMPORTED_MODULE_5__globals__["c" /* Constants */].RendererType;

/**
 * A filter can be attached to a DisplayObject and affects the way it is displayed.
 * @class
 * @extends PhotoEditorSDK.Configurable
 * @memberof PhotoEditorSDK.Engine
 */

var Filter = function (_Configurable) {
  _inherits(Filter, _Configurable);

  function Filter() {
    _classCallCheck(this, Filter);

    return _possibleConstructorReturn(this, (Filter.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(Filter)).apply(this, arguments));
  }

  _createClass(Filter, [{
    key: '_initOptions',

    /**
     * Goes through the available options, sets _options defaults
     * @param {Object} userOptions
     * @override
     * @protected
     */
    value: function _initOptions() {
      var userOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

      this._shaders = [];
      this._availableUniforms = __WEBPACK_IMPORTED_MODULE_8__shaders_texture_shader__["a" /* default */].defaultUniforms;
      this._attributes = __WEBPACK_IMPORTED_MODULE_8__shaders_texture_shader__["a" /* default */].defaultAttributes;
      this._vertexSource = __WEBPACK_IMPORTED_MODULE_8__shaders_texture_shader__["a" /* default */].defaultVertexSource;
      this._fragmentSource = __WEBPACK_IMPORTED_MODULE_8__shaders_texture_shader__["a" /* default */].defaultFragmentSource;

      this._initUniforms();
      _get(Filter.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(Filter.prototype), '_initOptions', this).call(this, userOptions);
    }

    /**
     * Initializes the uniforms
     * @private
     */

  }, {
    key: '_initUniforms',
    value: function _initUniforms() {
      this._uniforms = {};
      for (var name in this._availableUniforms) {
        var uniform = this._availableUniforms[name];
        this._uniforms[name] = {
          type: uniform.type,
          value: uniform.default || null
        };
      }

      // Options are also turned into uniforms
      for (var optionName in this.availableOptions) {
        var optionConfig = this.availableOptions[optionName];

        if (!optionConfig.uniformType) {
          __WEBPACK_IMPORTED_MODULE_5__globals__["f" /* Log */].trace(this.constructor.name, 'Option `' + optionName + '` is missing a `uniformType`!');
        } else {
          this._uniforms['u_' + optionName] = {
            type: optionConfig.uniformType,
            value: optionConfig.default || null
          };
        }
      }
    }

    /**
     * Sets the value for the given option, validates it
     * @param {String} optionName
     * @param {*} value
     * @param {Boolean} update = true
     * @override
     */

  }, {
    key: 'setOption',
    value: function setOption(optionName, value) {
      var update = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;

      _get(Filter.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(Filter.prototype), 'setOption', this).call(this, optionName, value, update);

      var uniformValue = value;
      var optionConfig = this.availableOptions[optionName];

      if (!optionConfig.uniformType) {
        return;
      }

      var uniformName = 'u_' + optionName;

      switch (optionConfig.type) {
        case OptionType.COLOR:
          if (optionConfig.uniformType === UniformType.FLOAT4) {
            uniformValue = value.toGLColor();
          } else if (optionConfig.uniformType === UniformType.FLOAT3) {
            uniformValue = value.toRGBGLColor();
          }
          break;
        case OptionType.VECTOR2:
          uniformValue = [value.x, value.y];
          break;
        case OptionType.COLOR_MATRIX:
          // a color matrix splits into 4x4 matrix and tranlation vector
          uniformValue = [value.a, value.b, value.c, value.d, value.f, value.g, value.h, value.i, value.k, value.l, value.m, value.n, value.p, value.q, value.r, value.s];
          var vectorValue = [value.e, value.j, value.o, value.t];
          this._uniforms[uniformName + '_vec'] = {
            value: vectorValue,
            type: UniformType.FLOAT4
          };
      }

      this.setUniform(uniformName, uniformValue);
    }

    /**
     * Sets the given uniform to the given value
     * @param {String} name
     * @param {*} value
     * @param {Boolean} sync = false
     */

  }, {
    key: 'setUniform',
    value: function setUniform(name, value) {
      var sync = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

      this._uniforms[name].value = value;
    }

    /**
     * Sets the given uniforms to their values
     * @param {Object}  uniforms
     * @param {Boolean} sync = false
     */
    /* istanbul ignore next */

  }, {
    key: 'setUniforms',
    value: function setUniforms(uniforms) {
      var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

      for (var name in uniforms) {
        this._uniforms[name].value = uniforms[name];
        if (sync) {
          this.syncUniform(name);
        }
      }
    }

    /**
     * Synchronizes the uniform with the given name
     * @param  {String} name
     */
    /* istanbul ignore next */

  }, {
    key: 'syncUniform',
    value: function syncUniform(name) {
      this._shaders.forEach(function (shader) {
        shader.syncUniform(name);
      });
    }

    /**
     * Synchronizes all uniforms with WebGL
     */
    /* istanbul ignore next */

  }, {
    key: 'syncUniforms',
    value: function syncUniforms() {
      this._shaders.forEach(function (shader) {
        shader.syncUniforms();
      });
    }

    /**
     * Returns the shader for the given renderer
     * @param  {PhotoEditorSDK.Engine.WebGLRenderer} renderer
     * @return {PhotoEditorSDK.Engine.Shader}
     */
    /* istanbul ignore next */

  }, {
    key: 'getShaderForRenderer',
    value: function getShaderForRenderer(renderer) {
      var gl = renderer.getContext();
      var shader = this._shaders[gl.id];

      if (!shader) {
        shader = new __WEBPACK_IMPORTED_MODULE_7__shaders_shader__["a" /* default */](renderer, this._vertexSource, this._fragmentSource, this._uniforms, this._attributes);

        this._shaders[gl.id] = shader;
      }

      return shader;
    }

    /**
     * Applies this filter to the given inputTarget and renders it to
     * the given outputTarget
     * @param  {PhotoEditorSDK.Engine.BaseRenderer} renderer
     * @param  {PhotoEditorSDK.Engine.RenderTarget} inputTarget
     * @param  {PhotoEditorSDK.Engine.RenderTarget} outputTarget
     * @param  {Boolean} clear = false
     */

  }, {
    key: 'apply',
    value: function apply(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      /* istanbul ignore if */
      if (renderer.isOfType(RendererType.WEBGL)) {
        this._applyWebGL(renderer, inputTarget, outputTarget, clear);
      } else if (renderer.isOfType(RendererType.CANVAS)) {
        this._applyCanvas(renderer, inputTarget, outputTarget, clear);
      }
    }

    /**
     * Applies this filter to the given inputTarget and renders it to
     * the given outputTarget using the WebGLRenderer
     * @param  {PhotoEditorSDK.Engine.WebGLRenderer} renderer
     * @param  {PhotoEditorSDK.Engine.WebGLRenderTarget} inputTarget
     * @param  {PhotoEditorSDK.Engine.WebGLRenderTarget} outputTarget
     * @param  {Boolean} clear = false
     * @private
     */
    /* istanbul ignore next */

  }, {
    key: '_applyWebGL',
    value: function _applyWebGL(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var gl = renderer.getContext();
      var shader = this.getShaderForRenderer(renderer);

      renderer.setRenderTarget(outputTarget);
      if (clear) {
        outputTarget.clear();
      }

      renderer.setShader(shader);

      var projectionMatrix = renderer.getCurrentRenderTarget().getProjectionMatrix().toArray();
      shader.setUniform('u_projMatrix', projectionMatrix);
      shader.syncUniforms();

      // Render!
      gl.activeTexture(gl.TEXTURE0);
      gl.bindTexture(gl.TEXTURE_2D, inputTarget.getTexture());
      gl.drawElements(gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0);
    }

    /**
     * Applies this filter to the given inputTarget and renders it to
     * the given outputTarget using the CanvasRenderer
     * @param  {PhotoEditorSDK.Engine.CanvasRenderer} renderer
     * @param  {PhotoEditorSDK.Engine.RenderTarget} inputTarget
     * @param  {PhotoEditorSDK.Engine.RenderTarget} outputTarget
     * @param  {Boolean} clear = false
     * @private
     */

  }, {
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var canvas = inputTarget.getCanvas();
      var outputContext = outputTarget.getContext();

      __WEBPACK_IMPORTED_MODULE_5__globals__["f" /* Log */].warn(this.constructor.name, '`_applyCanvas` is not implemented. Just copying image data from `inputTarget` to `outputTarget`.');

      outputContext.clearRect(0, 0, canvas.width, canvas.height);
      outputContext.drawImage(canvas, 0, 0);
    }

    /**
     * Disposes this Filter
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      this._shaders.forEach(function (shader) {
        return shader.dispose();
      });
      this._shaders = [];
    }
  }]);

  return Filter;
}(__WEBPACK_IMPORTED_MODULE_6__lib_configurable__["a" /* default */]);

/* harmony default export */ __webpack_exports__["a"] = (Filter);

/***/ }),
/* 55 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_symbol_iterator__ = __webpack_require__(35);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_symbol_iterator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_symbol_iterator__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol__ = __webpack_require__(39);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_keys__ = __webpack_require__(69);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_keys___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_keys__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__shared_vendor_promise__ = __webpack_require__(32);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__shared_log_js__ = __webpack_require__(30);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__event_emitter__ = __webpack_require__(52);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__math_vector2__ = __webpack_require__(42);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__color__ = __webpack_require__(51);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__utils__ = __webpack_require__(22);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__image__ = __webpack_require__(74);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__math_color_matrix__ = __webpack_require__(135);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__constants__ = __webpack_require__(31);








var _typeof = typeof __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default.a === "function" && typeof __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_symbol_iterator___default.a === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default.a === "function" && obj.constructor === __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default.a && obj !== __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default.a.prototype ? "symbol" : typeof obj; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _defineProperty(obj, key, value) { if (key in obj) { __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property___default()(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* global HTMLImageElement */
/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */

/* eslint-disable valid-typeof */











/**
 * Adds `set{OptionName}` and `get{OptionName}` methods to an object. Method names
 * are specified via the `availableOptions` object.
 * @class
 * @extends EventEmitter
 * @memberof PhotoEditorSDK
 */

var Configurable = function (_EventEmitter) {
  _inherits(Configurable, _EventEmitter);

  function Configurable() {
    var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    var additionalAvailableOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

    _classCallCheck(this, Configurable);

    var _this = _possibleConstructorReturn(this, (Configurable.__proto__ || __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of___default()(Configurable)).call(this));

    _this.availableOptions = _this.availableOptions || {};
    _this.availableOptions = __WEBPACK_IMPORTED_MODULE_12__utils__["a" /* default */].extend(_this.availableOptions, additionalAvailableOptions);

    _this._onConfigurableUpdate = _this._onConfigurableUpdate.bind(_this);

    _this._initOptions(options);
    return _this;
  }

  /**
   * Builds an error message from the given string
   * @param  {String} message
   * @return {Error}
   * @private
   */


  _createClass(Configurable, [{
    key: '_buildConfigError',
    value: function _buildConfigError(message) {
      var errorMessage = '';
      if (this.constructor.name) {
        errorMessage = this.constructor.name + ': ';
      }
      errorMessage += message;
      return new Error(errorMessage);
    }

    /**
     * Gets called when options have been changed
     * @protected
     */

  }, {
    key: '_onOptionsChange',
    value: function _onOptionsChange() {}

    /**
     * Checks whether all required options are specified
     * @return {Promise}
     */

  }, {
    key: 'validateSettings',
    value: function validateSettings() {
      var _this2 = this;

      return new __WEBPACK_IMPORTED_MODULE_7__shared_vendor_promise__["a" /* default */](function (resolve, reject) {
        // Check for required options
        for (var optionName in _this2.availableOptions) {
          var optionConfig = _this2.availableOptions[optionName];
          if (optionConfig.required && typeof _this2._options[optionName] === 'undefined') {
            return reject(_this2._buildConfigError('Option `' + optionName + '` is required.'));
          }
        }

        resolve();
      });
    }

    /**
     * Goes through the available options, sets _options defaults
     * @param {Object} userOptions
     * @protected
     */

  }, {
    key: '_initOptions',
    value: function _initOptions() {
      var userOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

      this._options = {};

      // Set defaults, create getters and setters
      var optionName, option, capitalized;
      var self = this;
      for (optionName in this.availableOptions) {
        capitalized = optionName.charAt(0).toUpperCase() + optionName.slice(1);
        option = this.availableOptions[optionName];

        if ([__WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].STRING, __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].NUMBER, __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].BOOLEAN, __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].OBJECT, __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].VECTOR2, __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].COLOR, __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].CONFIGURABLE, __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].COLOR_MATRIX, __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].ARRAY, __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].IMAGE, __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].FUNCTION, __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].ALL].indexOf(option.type) === -1) {
          throw this._buildConfigError('Unknown option type: `' + option.type + '`');
        }

        // Create setter and getter
        var fn = function fn(optionName, option) {
          self['set' + capitalized] = function (value, update, initial) {
            self.setOption(optionName, value, update, initial);
          };

          // Default getter
          self['get' + capitalized] = function () {
            return self.getOption(optionName);
          };
        };
        fn(optionName, option);

        // Handle configurable initialization
        if (option.type === __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].CONFIGURABLE) {
          this._options[optionName] = new Configurable(undefined, option.structure || {});
          this._options[optionName].on('update', this._onConfigurableUpdate);
        }

        // Set default if available
        if (!(optionName in userOptions) || typeof userOptions[optionName] === 'undefined') {
          if (typeof option.default !== 'undefined') {
            var defaultValue = option.default;
            if (typeof option.default === 'function') {
              defaultValue = option.default();
            }
            this['set' + capitalized](defaultValue, false, true);
          } else if (option.type !== __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].CONFIGURABLE) {
            this._options[optionName] = undefined;
          }
        }
      }

      // Overwrite options with the ones given by user
      for (optionName in userOptions) {
        // Check if option is available
        if (typeof this.availableOptions[optionName] === 'undefined') {
          throw new Error('Invalid option: ' + optionName);
        }

        if (typeof userOptions[optionName] !== 'undefined') {
          // Call setter
          capitalized = optionName.charAt(0).toUpperCase() + optionName.slice(1);
          this['set' + capitalized](userOptions[optionName], false, true);
        }
      }
    }

    /**
     * Sets the given options
     * @param {Object} options
     */

  }, {
    key: 'set',
    value: function set(options) {
      var emitUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;

      for (var optionName in options) {
        this.setOption(optionName, options[optionName], false);
      }
      this._onOptionsChange();

      if (emitUpdate) {
        this.emit('update', this, options);
      }
    }

    /**
     * Returns the value for the given option
     * @param {String} optionName
     * @return {*}
     */

  }, {
    key: 'getOption',
    value: function getOption(optionName) {
      return this._options[optionName];
    }

    /**
     * Checks if this configurable has an option with the given name
     * @param  {String}  optionName
     * @return {Boolean}
     */

  }, {
    key: 'hasOption',
    value: function hasOption(optionName) {
      return !!this.availableOptions[optionName];
    }

    /**
     * Returns the default value for the given option
     * @param  {String} optionName
     * @return {*}
     */

  }, {
    key: 'getOptionDefault',
    value: function getOptionDefault(optionName) {
      var option = this.availableOptions[optionName];
      if (!option) {
        throw new Error('Invalid option: ' + optionName);
      }
      return option.default;
    }

    /**
     * Resets the options of the configurable to the default
     * ones.
     */

  }, {
    key: 'resetOptions',
    value: function resetOptions() {
      this.set(this.getDefaultOptions());
    }

    /**
     * Returns a hash with the default options
     * @return {Object}
     */

  }, {
    key: 'getDefaultOptions',
    value: function getDefaultOptions() {
      var options = {};
      for (var optionName in this.availableOptions) {
        var defaultValue = this.availableOptions[optionName].default;
        if (typeof defaultValue === 'undefined') continue;

        options[optionName] = defaultValue;
      }
      return options;
    }

    /**
     * Check if the current options equal the given ones
     * @param  {Object} options
     * @return {Boolean}
     */

  }, {
    key: 'optionsEqual',
    value: function optionsEqual(options) {
      for (var optionName in options) {
        var value = options[optionName];
        if (!this._optionEquals(optionName, value)) {
          return false;
        }
      }
      return true;
    }

    /**
     * Checks if the given option has the given value
     * @param  {String} optionName
     * @param  {*} value
     * @return {Boolean}
     * @private
     */

  }, {
    key: '_optionEquals',
    value: function _optionEquals(optionName, value) {
      var option = this.availableOptions[optionName];
      if (typeof option === 'undefined') {
        throw new Error('Invalid option: ' + optionName);
      }

      var optionType = this.availableOptions[optionName].type;
      var currentValue = this._options[optionName];
      if (currentValue === value) return true;

      if (typeof value === 'undefined' || typeof currentValue === 'undefined') return false;

      switch (optionType) {
        case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].OBJECT:
          if (typeof currentValue.optionsEqual === 'function') {
            return currentValue.optionsEqual(value._options);
          } else {
            return currentValue === value;
          }
        case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].STRING:
        case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].NUMBER:
        case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].BOOLEAN:
        case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].FUNCTION:
        case '*':
          return currentValue === value;
        case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].VECTOR2:
          return currentValue.equals(value);
        case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].COLOR:
        case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].COLOR_MATRIX:
          return value.equals(currentValue);
        case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].CONFIGURABLE:
          return currentValue.optionsEqual(value);
        case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].ARRAY:
          return this._arrayOptionEquals(optionName, value);
        case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].IMAGE:
          return currentValue.src === value.src;
      }
    }

    /**
     * Checks if the given option of type `array` matches the given value
     * @param  {String} optionName
     * @param  {Array} arr
     * @return {Boolean}
     * @private
     */

  }, {
    key: '_arrayOptionEquals',
    value: function _arrayOptionEquals(optionName, arr) {
      var thisArr = this._options[optionName];

      if (arr.length !== thisArr.length) {
        return false;
      }

      var equal = true;
      for (var i = 0; i < thisArr.length; i++) {
        var thisValue = thisArr[i];
        var value = arr[i];
        if (thisValue instanceof Configurable) {
          if (typeof value === 'undefined' || !thisValue.optionsEqual(value)) {
            equal = false;
            break;
          }
        } else if (value !== thisValue) {
          equal = false;
          break;
        }
      }
      return equal;
    }

    /**
     * Returns a serialized version of this configurable
     * @param {Boolean} toObject = false
     * @return {Object}
     */

  }, {
    key: 'serializeOptions',
    value: function serializeOptions() {
      var _this3 = this;

      var keys = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_keys___default()(this._options);
      var toObject = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

      var options = {};
      keys.forEach(function (key) {
        if (typeof _this3.availableOptions[key] === 'undefined') {
          return __WEBPACK_IMPORTED_MODULE_8__shared_log_js__["a" /* default */].warn('Trying to serialize a key that does not exist: ' + key);
        }
        if (_this3.availableOptions[key].serializable === false) return;
        options[key] = _this3.serializeOption(key, toObject);
      });
      return options;
    }

    /**
     * Returns a serialized version of the given option
     * @param {String} optionName
     * @param {Boolean} toObject = false
     * @return {*}
     */

  }, {
    key: 'serializeOption',
    value: function serializeOption(optionName) {
      var toObject = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

      var option = this.availableOptions[optionName];
      var optionType = option.type;
      var value = this._options[optionName];
      if (!value) return value;
      if (option.serializable === false) {
        throw new Error('Option `' + optionName + '` is not serializable.');
      }

      switch (optionType) {
        case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].STRING:
        case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].NUMBER:
        case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].BOOLEAN:
        case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].OBJECT:
        case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].FUNCTION:
        case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].ALL:
          return value;
        case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].VECTOR2:
          return toObject ? value.toObject() : value.clone();
        case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].COLOR:
        case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].COLOR_MATRIX:
          return toObject ? value.toArray() : value.clone();
        case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].CONFIGURABLE:
          return value.serializeOptions(undefined, toObject);
        case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].ARRAY:
          return value.slice(0);
        case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].IMAGE:
          return toObject ? value.src : value;
      }
    }

    /**
     * Sets the value for the given option, validates it
     * @param {String} optionName
     * @param {*} value
     * @param {Boolean} [update = true] - Should an `update` event be emitted?
     * @param {Boolean} [initial = false] - Is this the first time this option is set?
     */

  }, {
    key: 'setOption',
    value: function setOption(optionName, value) {
      var update = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
      var initial = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var optionConfig = this.availableOptions[optionName];
      if (!optionConfig) {
        throw new Error('Invalid option: ' + optionName);
      }

      if (typeof optionConfig.setter !== 'undefined') {
        value = optionConfig.setter.call(this, value, initial);
      }

      if (typeof optionConfig.validation !== 'undefined') {
        optionConfig.validation(value);
      }

      if (value === null || typeof value === 'undefined') {
        if (optionConfig.required) {
          throw this._buildConfigError('Option `' + optionName + '` is required.');
        }
        this._options[optionName] = value;
      } else {
        switch (optionConfig.type) {
          // String options
          case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].STRING:
            if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) !== __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].STRING) {
              throw this._buildConfigError('Option `' + optionName + '` has to be a string.');
            }

            // String value restrictions
            var available = optionConfig.available;
            if (typeof available !== 'undefined' && available.indexOf(value) === -1) {
              throw this._buildConfigError('Invalid value for `' + optionName + '` (valid values are: ' + optionConfig.available.join(', ') + ')');
            }

            this._options[optionName] = value;
            break;

          // Number options
          case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].NUMBER:
            if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) !== __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].NUMBER) {
              throw this._buildConfigError('Option `' + optionName + '` has to be a number.');
            }

            this._options[optionName] = value;
            break;

          // Boolean options
          case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].BOOLEAN:
            if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) !== __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].BOOLEAN) {
              throw this._buildConfigError('Option `' + optionName + '` has to be a boolean.');
            }

            this._options[optionName] = value;

            break;

          // Vector2 options
          case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].VECTOR2:
            if (!(value instanceof __WEBPACK_IMPORTED_MODULE_10__math_vector2__["a" /* default */]) && !((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && 'x' in value && 'y' in value)) {
              throw this._buildConfigError('Option `' + optionName + '` has to be an instance of Vector2 or an Object holding x and y values.');
            }

            if (value instanceof __WEBPACK_IMPORTED_MODULE_10__math_vector2__["a" /* default */]) {
              this._options[optionName] = value.clone();
            } else {
              this._options[optionName] = __WEBPACK_IMPORTED_MODULE_10__math_vector2__["a" /* default */].fromObject(value);
            }

            break;

          // Color options
          case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].COLOR:
            if (!(value instanceof __WEBPACK_IMPORTED_MODULE_11__color__["a" /* default */])) {
              throw this._buildConfigError('Option `' + optionName + '` has to be an instance of Color.');
            }

            this._options[optionName] = value;
            break;

          // ColorMatrix options
          case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].COLOR_MATRIX:
            if (!(value instanceof __WEBPACK_IMPORTED_MODULE_14__math_color_matrix__["a" /* default */])) {
              throw this._buildConfigError('Option `' + optionName + '` has to be an instance of ColorMatrix.');
            }

            this._options[optionName] = value.clone();

            break;

          // Function options
          case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].FUNCTION:
            if (typeof value !== 'function') {
              throw this._buildConfigError('Option `' + optionName + '` has to be a function.');
            }

            this._options[optionName] = value;

            break;

          // Object options
          case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].OBJECT:
          case '*':
            this._options[optionName] = value;
            break;

          case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].IMAGE:
            if (typeof value === 'string') {
              var image = new __WEBPACK_IMPORTED_MODULE_13__image__["a" /* default */]();
              image.crossOrigin = __WEBPACK_IMPORTED_MODULE_12__utils__["a" /* default */].getCrossOriginValue(optionConfig.crossOrigin);
              image.src = value;
              this._options[optionName] = image;
            } else if (value instanceof __WEBPACK_IMPORTED_MODULE_13__image__["a" /* default */] || typeof HTMLImageElement !== 'undefined' && value instanceof HTMLImageElement) {
              this._options[optionName] = value;
            } else {
              throw this._buildConfigError('Option `' + optionName + '` has to be an Image or String.');
            }
            break;

          // Configurable options
          case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].CONFIGURABLE:
            if (value instanceof Configurable) {
              this._options[optionName] = value;
            } else {
              this._options[optionName].set(value);
            }
            break;

          // Array options
          case __WEBPACK_IMPORTED_MODULE_15__constants__["OptionType"].ARRAY:
            if (!(value instanceof Array)) {
              throw this._buildConfigError('Option `' + optionName + '` has to be an Array.');
            }
            this._options[optionName] = value.slice(0);
            break;

          // Unknown option type
          default:
            throw this._buildConfigError('Unknown option type: `' + optionConfig.type + '`');
        }
      }

      if (update) {
        this._onOptionsChange();
        this.emit('update', this, _defineProperty({}, optionName, value));
      }
    }

    /**
     * Gets called when a `configurable` option has been updated
     * @param  {*} ...args
     * @private
     */

  }, {
    key: '_onConfigurableUpdate',
    value: function _onConfigurableUpdate() {
      for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }

      this.emit.apply(this, ['update'].concat(args));
    }

    /**
     * Check if the configurable has any options that differ from the default options
     * @return {Boolean}
     */

  }, {
    key: 'hasChanges',
    value: function hasChanges() {
      var defaultOptions = this.getDefaultOptions();
      return !this.optionsEqual(defaultOptions);
    }
  }]);

  return Configurable;
}(__WEBPACK_IMPORTED_MODULE_9__event_emitter__["a" /* default */]);

/* harmony default export */ __webpack_exports__["a"] = (Configurable);

/***/ }),
/* 56 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);






var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */


var Vector2 = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Math"].Vector2;

var Sprite = function (_Configurable) {
  _inherits(Sprite, _Configurable);

  function Sprite(operation, options) {
    _classCallCheck(this, Sprite);

    var _this = _possibleConstructorReturn(this, (Sprite.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(Sprite)).call(this, options));

    _this._operation = operation;
    _this._dirtiness = {};
    _this.id = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].getUUID();

    _this._renderTextures = {};
    _this._identitySprite = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].Sprite();
    _this._sprite = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].Sprite();

    // Performing hit testing on sprites without a texture doesn't work,
    // so we need to create one that is empty, but does not look empty.
    // Dirty workaround!
    _this._dummyImage = {
      addEventListener: function addEventListener() {},
      removeEventListener: function removeEventListener() {}
    };
    _this._hitTestSprite = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].Sprite();
    _this._renderers = [];
    return _this;
  }

  /**
   * Applies the given scale to this sprite
   * @param  {PhotoEditorSDK.Math.Vector2} scale
   */


  _createClass(Sprite, [{
    key: 'applyScale',
    value: function applyScale(scale) {}

    /**
     * Applies a rotation with the given degrees
     * @param  {Number} degrees
     */

  }, {
    key: 'applyRotation',
    value: function applyRotation(degrees) {
      var inputDimensions = this._operation.getInputDimensions();

      // Update sprite rotation
      var spriteDegrees = this.getRotation() * 180 / Math.PI;
      spriteDegrees += degrees;
      this.setRotation(spriteDegrees * Math.PI / 180);

      var actualDegrees = (degrees + 360) % 360;
      var radians = actualDegrees * Math.PI / 180;

      var cos = Math.cos(radians);
      var sin = Math.sin(radians);

      var relativePosition = this._options.position.clone().subtract(0.5).multiply(inputDimensions);

      var newRelativePosition = new Vector2(relativePosition.x * cos - relativePosition.y * sin, relativePosition.x * sin + relativePosition.y * cos).divide(inputDimensions.clone().flip());

      this.setPosition(new Vector2(0.5, 0.5).add(newRelativePosition));
    }

    /**
     * Applies a flip in the given direction
     * @param  {String} direction
     */

  }, {
    key: 'applyFlip',
    value: function applyFlip(direction) {
      var position = this.getPosition().clone();
      switch (direction) {
        case 'horizontal':
          position.x = 1 - this._options.position.x;
          break;
        case 'vertical':
          position.y = 1 - this._options.position.y;
          break;
      }

      this.setPosition(position);
    }

    /**
     * Applies a transform with the given options
     * @param  {PhotoEditorSDK.Operations.TransformOperation.TransformChange} transformChange
     */

  }, {
    key: 'applyTransform',
    value: function applyTransform(transformChange) {
      var newOptions = {};
      newOptions.rotation = transformChange.applyToRotation(this.getRotation());
      newOptions.position = transformChange.applyToRelativePoint(this.getPosition());
      if (this._options.dimensions) {
        newOptions.dimensions = transformChange.applyToDimensions(this.getDimensions());
      }
      this.set(newOptions, false);
    }

    // -------------------------------------------------------------------------- EVENTS

    /**
     * Returns the DisplayObject of this Sprite
     * @return {PhotoEditorSDK.Engine.Sprite}
     */

  }, {
    key: 'getDisplayObject',
    value: function getDisplayObject() {
      return this._sprite;
    }
  }, {
    key: 'getHitTestDisplayObject',
    value: function getHitTestDisplayObject() {
      return this._sprite;
    }

    /**
     * Returns the texture for the sprite that should be rendered
     * @return {PhotoEditorSDK.Engine.Texture}
     * @private
     * @abstract
     */

  }, {
    key: '_getTexture',
    value: function _getTexture() {
      throw new Error('Sprite#_getTexture is abstract and not implemented in child class.');
    }

    /**
     * Prepares for rendering this sprite to a render texture
     * @param {PhotoEditorSDK} sdk
     * @private
     */

  }, {
    key: '_prepareRenderTexture',
    value: function _prepareRenderTexture(sdk) {
      if (!this._renderTexture) {
        var texture = this._getTexture();
        this._renderTextureContainer = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].Container();
        this._renderTextureSprite = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].Sprite(texture);
        this._renderTextureContainer.addChild(this._renderTextureSprite);
        this._renderTexture = this._getRenderTexture(sdk.getRenderer(), texture.getDimensions());
      } else {
        this._renderTexture.clear();
      }
    }

    /**
     * Checks if this sprite should be rendered to a render texture
     * @param  {PhotoEditorSDK} sdk
     * @return {Boolean}
     * @private
     */

  }, {
    key: '_rendersToRenderTexture',
    value: function _rendersToRenderTexture(sdk) {
      return sdk.getOptions().smoothDownscaling && sdk.getRenderer().isOfType(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["RendererType"].WEBGL);
    }

    /**
     * Checks if the given option has the given value
     * @param  {String} optionName
     * @param  {*} value
     * @return {Boolean}
     * @private
     */

  }, {
    key: '_optionEquals',
    value: function _optionEquals(optionName, value) {
      if (optionName === 'type') {
        return true;
      }

      return _get(Sprite.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(Sprite.prototype), '_optionEquals', this).call(this, optionName, value);
    }

    /**
     * Updates this sprite
     * @param  {PhotoEditorSDK} sdk
     * @param  {PhotoEditorSDK.Math.Vector2} inputDimensions
     */

  }, {
    key: 'update',
    value: function update(sdk, inputDimensions) {
      if (this._rendersToRenderTexture(sdk)) {
        this._prepareRenderTexture(sdk);
        this._renderToRenderTexture(sdk);
      }

      this._updateSprite(inputDimensions);
    }

    /**
     * Updates the sprite's properties according to the options
     * @param {PhotoEditorSDK.Math.Vector2} inputDimensions
     * @private
     */

  }, {
    key: '_updateSprite',
    value: function _updateSprite(inputDimensions) {
      var _this2 = this;

      var sprites = [this._sprite, this._hitTestSprite];
      sprites.forEach(function (sprite) {
        if (!sprite.getTexture()) return;

        sprite.setAnchor(_this2._options.anchor);
        sprite.setPosition(_this2._options.position.clone().multiply(inputDimensions));
        if (typeof _this2._options.alpha !== 'undefined') {
          sprite.setAlpha(_this2._options.alpha);
        }

        var dimensions = _this2._options.dimensions;

        if (dimensions) {
          dimensions = dimensions.clone().multiply(_this2._operation.getSDK().getTextureScale());
          sprite.setWidth(dimensions.x);
          sprite.setHeight(dimensions.y);
        }
        sprite.updateTransform();

        var frame = sprite.getTexture().getFrame();
        var spriteDimensions = new Vector2(frame.width, frame.height);

        sprite.setPivot(_this2._options.pivot.clone().multiply(spriteDimensions));
        sprite.setRotation(_this2._options.rotation);
        sprite.updateTransform();
      });
    }

    /**
     * Renders this sprite to the render texture. If power-of-two textures are enforced,
     * it automatically resizes the texture and updates its UV coordinates accordingly.
     * @param  {PhotoEditorSDK} sdk
     * @private
     */

  }, {
    key: '_renderToRenderTexture',
    value: function _renderToRenderTexture(sdk) {
      var textureDimensions = this._getTexture().getDimensions();
      var renderTexture = this._getRenderTexture(sdk.getRenderer(), textureDimensions);

      var finalDimensions = textureDimensions.clone();
      if (this._options.smoothDownscaling) {
        finalDimensions.x = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].nextHighestPOT(finalDimensions.x);
        finalDimensions.y = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].nextHighestPOT(finalDimensions.y);
      }

      this._renderTexture.resizeTo(finalDimensions);
      this._renderTexture.render(this._renderTextureContainer);

      if (this._options.smoothDownscaling) {
        var relativeDifference = finalDimensions.clone().subtract(textureDimensions.x, textureDimensions.y).divide(finalDimensions);

        var uvs = renderTexture.getUVs().getUVs();
        uvs[0].x = uvs[3].x = 0;
        uvs[1].x = uvs[2].x = 1 - relativeDifference.x;
        uvs[0].y = uvs[1].y = 0;
        uvs[2].y = uvs[3].y = 1 - relativeDifference.y;
      }

      this._sprite.setTexture(renderTexture);
    }

    /**
     * Checks if this operation is dirty for the given renderer
     * @param  {PhotoEditorSDK.Engine.BaseRenderer}  renderer
     * @return {Boolean}
     */

  }, {
    key: 'isDirtyForRenderer',
    value: function isDirtyForRenderer(renderer) {
      if (!(renderer.id in this._dirtiness)) {
        this._dirtiness[renderer.id] = true;
      }
      return this._dirtiness[renderer.id];
    }

    /**
     * Sets the dirtiness for the given renderer
     * @param {Boolean} dirty
     * @param {PhotoEditorSDK.Engine.BaseRenderer} renderer
     */

  }, {
    key: 'setDirtyForRenderer',
    value: function setDirtyForRenderer(dirty, renderer) {
      this._renderers[renderer.id] = renderer;
      this._dirtiness[renderer.id] = dirty;
    }

    /**
     * Sets the dirtiness for all renderers
     * @param {Boolean} dirty
     */

  }, {
    key: 'setDirty',
    value: function setDirty(dirty) {
      for (var rendererId in this._dirtiness) {
        this.setDirtyForRenderer(dirty, this._renderers[rendererId]);
      }
    }

    /**
     * Creates and/or returns a RenderTexture
     * @param {PhotoEditorSDK.Engine.BaseRenderer} renderer
     * @param {PhotoEditorSDK.Math.Vector2} dimensions = new Vector(100, 100)
     * @return {PhotoEditorSDK.Engine.RenderTexture}
     * @private
     */

  }, {
    key: '_getRenderTexture',
    value: function _getRenderTexture(renderer) {
      var dimensions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Vector2(100, 100);

      if (!this._renderTextures[renderer.id]) {
        this._renderTextures[renderer.id] = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].RenderTexture(renderer, dimensions.x, dimensions.y, 1);
      }
      return this._renderTextures[renderer.id];
    }

    /**
     * Cleans up this Sprite
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      for (var rendererId in this._renderTextures) {
        this._renderTextures[rendererId].dispose();
      }
    }
  }]);

  return Sprite;
}(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Configurable"]);

/* harmony default export */ __webpack_exports__["a"] = (Sprite);

/***/ }),
/* 57 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignBlocks; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_array_from__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_array_from___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_array_from__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__text_design__ = __webpack_require__(58);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__models_rows_blocks_text_design_row_triple__ = __webpack_require__(359);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__models_text_design_banderole__ = __webpack_require__(103);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__models_rows_default_text_design_row_single__ = __webpack_require__(19);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__models_rows_masked_text_design_row_masked__ = __webpack_require__(104);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__models_text_design_attributes__ = __webpack_require__(76);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__text_design_asset_manager__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__models_randomizer__ = __webpack_require__(16);








var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_array_from___default()(arr); } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */










var TextDesignBlocks = function (_TextDesign) {
  _inherits(TextDesignBlocks, _TextDesign);

  function TextDesignBlocks() {
    _classCallCheck(this, TextDesignBlocks);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (TextDesignBlocks.__proto__ || __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignBlocks)).call(this, args));

    _this.getImagePaths = function () {
      var banderoles = _this.getBanderoles();
      return banderoles && banderoles.map(function (b) {
        return b.getImagePath();
      }) || [];
    };

    _this.onImagesLoaded = function () {
      var banderoles = _this.getBanderoles();
      banderoles && banderoles.forEach(function (b) {
        var image = __WEBPACK_IMPORTED_MODULE_14__text_design_asset_manager__["a" /* AssetManager */].getImage(b.getImagePath());
        if (!image) {
          __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["Log"].warn('TextDesignBlocks#onImagesLoaded: Image not found \'' + b.getImagePath() + '\'');
          return;
        }

        b.setImage(image);
      });
    };

    _this._rowTypeLessThan3WordsRandomizer = new __WEBPACK_IMPORTED_MODULE_15__models_randomizer__["a" /* Randomizer */](0);
    _this._rowTypeMoreThan3WordsRandomizer = new __WEBPACK_IMPORTED_MODULE_15__models_randomizer__["a" /* Randomizer */](0);
    _this._banderolesRandomizer = new __WEBPACK_IMPORTED_MODULE_15__models_randomizer__["a" /* Randomizer */](0);

    _this._seedPool = [].concat(_toConsumableArray(_this._seedPool), [_this._rowTypeLessThan3WordsRandomizer, _this._rowTypeMoreThan3WordsRandomizer, _this._banderolesRandomizer]);
    return _this;
  }

  _createClass(TextDesignBlocks, [{
    key: '_modifiedText',
    value: function _modifiedText(text) {
      return _get(TextDesignBlocks.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignBlocks.prototype), '_modifiedText', this).call(this, text).toUpperCase();
    }
  }, {
    key: 'generateLayoutData',
    value: function generateLayoutData(text, width) {
      this._options.hasMaskedText = false;
      return _get(TextDesignBlocks.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignBlocks.prototype), 'generateLayoutData', this).call(this, text, width);
    }
  }, {
    key: '_randomLayoutRow',
    value: function _randomLayoutRow(words, index, width, attributes) {
      if (words.size() < 3) {
        var isMasked = this._rowTypeLessThan3WordsRandomizer.nextInRange(0, 2) === 0;
        return this._layoutRow(words, width, attributes, isMasked);
      } else {
        var randomValue = this._rowTypeMoreThan3WordsRandomizer.nextInRange(0, 3);

        switch (randomValue) {
          case 0:
            return new __WEBPACK_IMPORTED_MODULE_9__models_rows_blocks_text_design_row_triple__["a" /* TextDesignRowTriple */]({
              words: words,
              width: width,
              attributes: attributes,
              orientation: __WEBPACK_IMPORTED_MODULE_9__models_rows_blocks_text_design_row_triple__["a" /* TextDesignRowTriple */].Orientations.Left
            });

          case 1:
            return new __WEBPACK_IMPORTED_MODULE_9__models_rows_blocks_text_design_row_triple__["a" /* TextDesignRowTriple */]({
              words: words,
              width: width,
              attributes: attributes,
              orientation: __WEBPACK_IMPORTED_MODULE_9__models_rows_blocks_text_design_row_triple__["a" /* TextDesignRowTriple */].Orientations.Right
            });

          case 2:
            return this._layoutRow(words, width, attributes, true);

          case 3:
            return new __WEBPACK_IMPORTED_MODULE_11__models_rows_default_text_design_row_single__["a" /* TextDesignRowSingle */]({ words: words, width: width, attributes: attributes });

          default:
            throw new Error('TextDesignBlocks#_randomLayoutRow: Invalid randomValue generated: ' + randomValue + '.');
        }
      }
    }
  }, {
    key: '_layoutRow',
    value: function _layoutRow(words, width, attributes, isMasked) {
      if (this.getHasMaskedText()) {
        isMasked = false;
      }

      if (isMasked) {
        this.setHasMaskedText(true);
        var banderole = this._banderolesRandomizer.pickNext(this.getBanderoles());

        var row = new __WEBPACK_IMPORTED_MODULE_12__models_rows_masked_text_design_row_masked__["a" /* TextDesignRowMasked */]({
          words: words,
          width: width,
          attributes: new __WEBPACK_IMPORTED_MODULE_13__models_text_design_attributes__["a" /* TextDesignAttributes */]({ alignment: 'left', fontIdentifier: banderole.getFontIdentifier() }),
          image: banderole.getImage(),
          imageInsets: banderole.insetsForWidth(width),
          capInsets: null,
          backgroundColor: __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["Color"].WHITE
        });

        // Fix: We need to disable image smoothing on server to render the rectangle
        if (banderole.getNeedsImageSmoothingFix()) {
          row.serverImageSmoothingFix = true;
        }

        return row;
      } else {
        return new __WEBPACK_IMPORTED_MODULE_11__models_rows_default_text_design_row_single__["a" /* TextDesignRowSingle */]({ words: words, width: width, attributes: attributes });
      }
    }
  }]);

  return TextDesignBlocks;
}(__WEBPACK_IMPORTED_MODULE_8__text_design__["a" /* TextDesign */]);

TextDesignBlocks.defaultFontIdentifiers = ['imgly_font_campton_bold'];
TextDesignBlocks.identifier = 'imgly_text_design_blocks';
TextDesignBlocks.defaultBanderoles = [__WEBPACK_IMPORTED_MODULE_10__models_text_design_banderole__["a" /* TextDesignBanderole */].Rectangle, __WEBPACK_IMPORTED_MODULE_10__models_text_design_banderole__["a" /* TextDesignBanderole */].Small];
TextDesignBlocks.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_8__text_design__["a" /* TextDesign */].prototype.availableOptions, {
  fontIdentifiers: { type: __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["OptionType"].ARRAY, default: TextDesignBlocks.defaultFontIdentifiers },
  relativeLineSpacing: { type: __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.025 / 3 },
  hasMaskedText: { type: __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["OptionType"].BOOLEAN, default: false },
  banderoles: { type: __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["OptionType"].ARRAY, default: TextDesignBlocks.defaultBanderoles }
});

/***/ }),
/* 58 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesign; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_number_max_safe_integer__ = __webpack_require__(352);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_number_max_safe_integer___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_number_max_safe_integer__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__models_randomizer__ = __webpack_require__(16);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__models_rectangle_insets__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__text_words__ = __webpack_require__(33);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__models_text_design_layout_data__ = __webpack_require__(355);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__models_text_design_attributes__ = __webpack_require__(76);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__models_rows_default_text_design_row_single__ = __webpack_require__(19);







var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from___default()(arr); } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */









var MAXIMUM_NUMBER_OF_TRIES = 10;
var MIN_LINE_COUNT_OF_RANDOM = 4;
var RANDOM_ADDITIONAL_LINE_PERCENTAGE = 0.4;

var TextDesign = function (_Configurable) {
  _inherits(TextDesign, _Configurable);

  function TextDesign(options) {
    _classCallCheck(this, TextDesign);

    var _this = _possibleConstructorReturn(this, (TextDesign.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesign)).call(this, options));

    _this._relativeInsets = new __WEBPACK_IMPORTED_MODULE_8__models_rectangle_insets__["a" /* RectangleInsets */]();

    _this._background = null;

    _this._fontRandomizer = new __WEBPACK_IMPORTED_MODULE_7__models_randomizer__["a" /* Randomizer */](0);
    _this._lineNumberRandomizer = new __WEBPACK_IMPORTED_MODULE_7__models_randomizer__["a" /* Randomizer */](0);
    _this._wordsPerLineRandomizer = new __WEBPACK_IMPORTED_MODULE_7__models_randomizer__["a" /* Randomizer */](0);

    _this._seedPool = [_this._fontRandomizer, _this._lineNumberRandomizer, _this._wordsPerLineRandomizer];
    return _this;
  }

  _createClass(TextDesign, [{
    key: 'seed',
    value: function seed(value) {
      this._seedPool.forEach(function (s) {
        return s.seed(value);
      });
    }
  }, {
    key: 'getImagePaths',
    value: function getImagePaths() {
      return [];
    }
  }, {
    key: 'onImagesLoaded',
    value: function onImagesLoaded() {}
  }, {
    key: 'getMaximumNumberOfTries',
    value: function getMaximumNumberOfTries() {
      return MAXIMUM_NUMBER_OF_TRIES;
    }
  }, {
    key: 'getMinLineCountOfRandom',
    value: function getMinLineCountOfRandom() {
      return MIN_LINE_COUNT_OF_RANDOM;
    }
  }, {
    key: 'getRandomAdditionalLinePercentage',
    value: function getRandomAdditionalLinePercentage() {
      return RANDOM_ADDITIONAL_LINE_PERCENTAGE;
    }
  }, {
    key: '_fontForRow',
    value: function _fontForRow(index, words) {
      return this._fontRandomizer.pickNext(this.getFontIdentifiers());
    }
  }, {
    key: '_modifiedText',
    value: function _modifiedText(text) {
      return text.replace('\n', ' ').replace('\t', ' ');
    }
  }, {
    key: '_minimumNumberOfLines',
    value: function _minimumNumberOfLines(words) {
      return Math.ceil(Math.sqrt(words.size()));
    }
  }, {
    key: '_maximumNumberOfLines',
    value: function _maximumNumberOfLines(words) {
      return words.size();
    }
  }, {
    key: '_calculatedNumberOfLines',
    value: function _calculatedNumberOfLines(words) {
      var lineCount = this._minimumNumberOfLines(words);

      if (words.size() >= this.getMinLineCountOfRandom()) {
        var max = Math.floor(Math.max(1, lineCount * this.getRandomAdditionalLinePercentage()));
        lineCount += this._lineNumberRandomizer.nextInRange(0, max);
      }

      return Math.min(lineCount, this._maximumNumberOfLines(words));
    }
  }, {
    key: '_randomizedNumberOfWordsPerLine',
    value: function _randomizedNumberOfWordsPerLine(numberOfLines, numberOfWords) {
      var _this2 = this;

      if (numberOfLines > numberOfWords) {
        __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Log"].warn('TextDesign#_randomizedNumberOfWordsPerLine: Invalid number of lines');
        return numberOfWords;
      }

      var wordsPerLine = __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Utils"].Array.repeat(1, numberOfLines);

      __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Utils"].Array.range(numberOfLines, numberOfWords).forEach(function (_) {
        var index = _this2._wordsPerLineRandomizer.nextInRange(0, numberOfLines - 1);
        wordsPerLine[index] += 1;
      });

      return wordsPerLine;
    }
  }, {
    key: '_textLines',
    value: function _textLines(text) {
      var words = new __WEBPACK_IMPORTED_MODULE_9__text_words__["a" /* Words */](text);

      var numberOfLines = this._calculatedNumberOfLines(words);
      var numberOfWordsPerLine = this._randomizedNumberOfWordsPerLine(numberOfLines, words.size());

      return numberOfWordsPerLine.reduce(function (acc, numOfWordsInLine) {
        return {
          index: acc.index + numOfWordsInLine,
          lines: [].concat(_toConsumableArray(acc.lines), [words.slice(acc.index, Math.min(acc.index + numOfWordsInLine, words.size()))])
        };
      }, { index: 0, lines: [] }).lines;
    }
  }, {
    key: '_validTextLines',
    value: function _validTextLines(text) {
      var textLines = this._textLines(text);

      var indexOfLineWithLassThan3Chars = 0;
      do {
        indexOfLineWithLassThan3Chars = __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Utils"].Array.findIndex(textLines, function (words) {
          return words.countNumberOfCharacters() < 3;
        });

        if (indexOfLineWithLassThan3Chars >= 0) {
          var lineBefore = textLines[indexOfLineWithLassThan3Chars - 1];
          var lineAfter = textLines[indexOfLineWithLassThan3Chars + 1];

          var charCountOfLineBefore = lineBefore ? lineBefore.countNumberOfCharacters() : __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_number_max_safe_integer___default.a;
          var charCountOfLineAfter = lineAfter ? lineAfter.countNumberOfCharacters() : __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_number_max_safe_integer___default.a;

          if (charCountOfLineBefore < charCountOfLineAfter && lineBefore) {
            lineBefore.words = [].concat(_toConsumableArray(lineBefore.words), _toConsumableArray(textLines[indexOfLineWithLassThan3Chars].words));
            textLines = [].concat(_toConsumableArray(textLines.slice(0, indexOfLineWithLassThan3Chars)), _toConsumableArray(textLines.slice(indexOfLineWithLassThan3Chars + 1)));
          } else if (lineAfter) {
            lineAfter.words = [].concat(_toConsumableArray(textLines[indexOfLineWithLassThan3Chars].words), _toConsumableArray(lineAfter.words));
            textLines = [].concat(_toConsumableArray(textLines.slice(0, indexOfLineWithLassThan3Chars)), _toConsumableArray(textLines.slice(indexOfLineWithLassThan3Chars + 1)));
          }
        }
      } while (indexOfLineWithLassThan3Chars > -1 && textLines.length > 1);

      return textLines;
    }
  }, {
    key: '_modifiedLines',
    value: function _modifiedLines(lines) {
      return lines;
    }
  }, {
    key: '_getBackground',
    value: function _getBackground() {
      return this._background;
    }
  }, {
    key: 'generateLayoutData',
    value: function generateLayoutData(text, width) {
      var updatedText = this._modifiedText(text);
      var lines = this._modifiedLines(this._validTextLines(updatedText));

      var insetWidth = width * (1 - this._relativeInsets.left - this._relativeInsets.right);
      var rows = this._layoutRows(lines, insetWidth);

      return new __WEBPACK_IMPORTED_MODULE_10__models_text_design_layout_data__["a" /* TextDesignLayoutData */]({
        text: updatedText,
        relativeInsets: this._relativeInsets.clone(),
        relativeLineSpacing: this.getRelativeLineSpacing(),
        background: this._background || this._getBackground(),
        lines: lines,
        rows: rows,
        width: width
      });
    }
  }, {
    key: '_layoutRows',
    value: function _layoutRows(lines, width) {
      var _this3 = this;

      return lines.map(function (line, index) {
        return _this3._randomLayoutRow(line, index, width, new __WEBPACK_IMPORTED_MODULE_11__models_text_design_attributes__["a" /* TextDesignAttributes */]({ fontIdentifier: _this3._fontForRow(index, line) })).layout();
      });
    }
  }, {
    key: '_randomLayoutRow',
    value: function _randomLayoutRow(words, index, width, attributes) {
      return new __WEBPACK_IMPORTED_MODULE_12__models_rows_default_text_design_row_single__["a" /* TextDesignRowSingle */]({ words: words, width: width, attributes: attributes });
    }
  }]);

  return TextDesign;
}(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Configurable"]);

TextDesign.defaultFontIdentifiers = [];
TextDesign.identifier = 'text-design';
TextDesign.prototype.availableOptions = {
  fontIdentifiers: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].ARRAY, default: [] },
  relativeLineSpacing: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].NUMBER, default: 0 }
};

/***/ }),
/* 59 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignRow; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__size_value__ = __webpack_require__(23);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__text_design_attributes__ = __webpack_require__(76);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */





var Rectangle = __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Math"].Rectangle;


var TextDesignRow = function (_Configurable) {
  _inherits(TextDesignRow, _Configurable);

  function TextDesignRow(options) {
    _classCallCheck(this, TextDesignRow);

    var _this = _possibleConstructorReturn(this, (TextDesignRow.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignRow)).call(this, options));

    _this.setSize(new __WEBPACK_IMPORTED_MODULE_5__size_value__["a" /* SizeValue */](_this.getWidth(), 0));

    _this.serverImageSmoothingFix = false;
    return _this;
  }

  /**
   * Returns the full-frame of the row; origin is always (0, 0).
   *
   * @returns {PhotoEditorSDK.Math.Rectangle}
   * @memberof TextDesignRow
   */


  _createClass(TextDesignRow, [{
    key: '_getFrame',
    value: function _getFrame() {
      var size = this.getSize();
      return new Rectangle(0, 0, size.width, size.height);
    }

    /**
     * Returns the text-drawable portion of the frame.
     *
     * @returns {PhotoEditorSDK.Math.Rectangle}
     * @memberof TextDesignRow
     */

  }, {
    key: '_getTextFrame',
    value: function _getTextFrame() {
      return this._getFrame();
    }

    /**
     * Returns the textFrame for a given element.
     *
     * @param {TextDesignElement} element
     * @returns {PhotoEditorSDK.Math.Rectangle}
     */

  }, {
    key: '_getTextFrameForElement',
    value: function _getTextFrameForElement(element) {
      return element.getFrame().clone();
    }
  }, {
    key: '_calculateLayoutElements',
    value: function _calculateLayoutElements() {
      __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Log"].warn('TextDesignRow is an abstract class.');
    }
  }, {
    key: '_getLayoutElements',
    value: function _getLayoutElements() {
      if (this._options.elements.length <= 0) {
        this.layout();
      }

      return this.getElements();
    }
  }, {
    key: '_fontSize',
    value: function _fontSize(element) {
      __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Log"].warn('TextDesignRow#_fontSize not implemented. @TODO: Is it necessary?');
      return 0;
    }
  }, {
    key: 'layout',
    value: function layout() {
      this.setElements(this._calculateLayoutElements());
      return this;
    }
  }, {
    key: 'textFrame',
    value: function textFrame(element, fontSize) {
      return element.getFrame().clone();
    }
  }, {
    key: 'willRender',
    value: function willRender(context) {}
  }, {
    key: 'didRender',
    value: function didRender(context) {}
  }, {
    key: 'render',
    value: function render(context) {
      var _this2 = this;

      context.save();

      this._getLayoutElements().forEach(function (element) {
        var _element$serializeOpt = element.serializeOptions(),
            text = _element$serializeOpt.text,
            frame = _element$serializeOpt.frame,
            font = _element$serializeOpt.font;

        var attributes = _this2.getAttributes();

        font.draw(context, frame.x, frame.y, {
          textColor: attributes.getTextColor().toRGBA(),
          alignment: attributes.getAlignment()
        });
      });

      context.restore();
    }
  }]);

  return TextDesignRow;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Configurable"]);

TextDesignRow.prototype.availableOptions = {
  words: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].OBJECT, default: null },
  width: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 100 },
  attributes: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].CONFIGURABLE, default: new __WEBPACK_IMPORTED_MODULE_6__text_design_attributes__["a" /* TextDesignAttributes */]() },
  shearingAngle: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 0 },
  elements: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].ARRAY, default: [] },
  size: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].OBJECT, default: null }
};

/***/ }),
/* 60 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignFont; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__models_size_value__ = __webpack_require__(23);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__text_design_asset_manager__ = __webpack_require__(20);







var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */





var TextDesignFont = function (_Configurable) {
  _inherits(TextDesignFont, _Configurable);

  function TextDesignFont(options) {
    _classCallCheck(this, TextDesignFont);

    var _this = _possibleConstructorReturn(this, (TextDesignFont.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignFont)).call(this, options));

    var fontVariation = __WEBPACK_IMPORTED_MODULE_8__text_design_asset_manager__["a" /* AssetManager */].getVariation(_this.getFontIdentifier());
    if (!fontVariation) {
      __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Log"].warn('TextDesignFont: Unable to find font \'' + _this._fontIdentifier + '\'');
    }

    _this.set({ fontVariation: fontVariation });

    _this._metrics = null;

    _this._canvas = __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Utils"].createCanvas();
    _this._context = _this._canvas.getContext('2d');

    _this._isDirty = true;
    return _this;
  }

  _createClass(TextDesignFont, [{
    key: '_onOptionsChange',
    value: function _onOptionsChange() {
      this._isDirty = true;
    }
  }, {
    key: 'setOption',
    value: function setOption(optionName, value) {
      var update = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
      var initial = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      _get(TextDesignFont.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignFont.prototype), 'setOption', this).call(this, optionName, value, update, initial);

      if (optionName === 'fontIdentifier' && !initial) {
        this.updateFontVariation();
      }
    }

    /**
     * Updates the font variation for the current font identifier.
     *
     */

  }, {
    key: 'updateFontVariation',
    value: function updateFontVariation() {
      var fontVariation = __WEBPACK_IMPORTED_MODULE_8__text_design_asset_manager__["a" /* AssetManager */].getVariation(this.getFontIdentifier());
      if (!fontVariation) {
        __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Log"].warn('TextDesignFont: Unable to find font \'' + this._fontIdentifier + '\'');
      }

      this.setFontVariation(fontVariation);
      return fontVariation;
    }
  }, {
    key: 'setOptions',
    value: function setOptions() {
      var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

      this._options = _extends({}, this._options, options);

      this._isDirty = true;
    }
  }, {
    key: '_applyTextOptions',
    value: function _applyTextOptions() {
      var ctx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._context;
      var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

      var _options$options = _extends({}, this._options, options),
          fontSize = _options$options.fontSize,
          fontVariation = _options$options.fontVariation,
          lineHeight = _options$options.lineHeight,
          textColor = _options$options.textColor,
          alignment = _options$options.alignment;

      var _fontVariation$serial = fontVariation.serializeOptions(),
          fontStyle = _fontVariation$serial.fontStyle,
          fontWeight = _fontVariation$serial.fontWeight,
          fontFamily = _fontVariation$serial.fontFamily;

      ctx.font = fontStyle + ' ' + fontWeight + ' ' + fontSize + 'px/' + lineHeight + ' ' + fontFamily;

      ctx.fillStyle = textColor;
      ctx.textBaseline = 'alphabetic'; // textBaseline
      ctx.textAlign = alignment || 'left';
    }
  }, {
    key: 'getTextMetrics',
    value: function getTextMetrics() {
      if (!this._metrics || this._isDirty) {
        this._calculateTextMetrics();
      }

      return _extends({}, this._metrics);
    }
  }, {
    key: 'getSizeValue',
    value: function getSizeValue() {
      if (!this._metrics || this._isDirty) {
        this._calculateTextMetrics();
      }

      return new __WEBPACK_IMPORTED_MODULE_7__models_size_value__["a" /* SizeValue */](this._metrics.width, this._metrics.height);
    }
  }, {
    key: 'fitWidth',
    value: function fitWidth(width) {
      var variation = this.getFontVariation();

      if (!variation) {
        __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Log"].warn('TextDesignFont#fitText: missing font variation');
        return;
      }

      this._applyTextOptions(this._context, { fontSize: 50 });

      var measuredWidth = this._context.measureText(this.getText()).width;
      var scale = width / measuredWidth;
      var fontSize = Math.floor(scale * 50);

      this.setFontSize(fontSize);

      this._calculateTextMetrics();

      return this.getTextMetrics();
    }
  }, {
    key: 'fitHeight',
    value: function fitHeight(height) {
      var variation = this.getFontVariation();

      if (!variation) {
        __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Log"].warn('TextDesignFont#fitText: missing font variation');
        return;
      }

      var measuredHeight = this._calculateTextMetrics({ fontSize: 50 }).height;
      var scale = height / measuredHeight;
      var fontSize = Math.floor(scale * 50);

      this.setFontSize(fontSize);
      this._calculateTextMetrics();

      return this.getTextMetrics();
    }
  }, {
    key: '_calculateTextMetrics',
    value: function _calculateTextMetrics() {
      var overrideOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

      var canvas = this._canvas;
      var ctx = this._context;
      var options = _extends({}, this._options, overrideOptions);
      var text = this.getText();

      this._applyTextOptions(ctx, options);

      var textWidth = Math.ceil(ctx.measureText(text).width);
      var canvasWidth = Math.floor(textWidth + options.fontSize * 2);
      var canvasHeight = Math.floor(options.fontSize * 3);

      canvas.width = canvasWidth;
      canvas.height = canvasHeight;

      var xPos = Math.floor(options.fontSize);
      var yPos = Math.floor(canvasHeight * (3 / 5));

      this._applyTextOptions(ctx, options);
      ctx.fillText(text, xPos, yPos);

      var pixels = ctx.getImageData(0, 0, canvas.width, canvas.height).data;

      var ascender = getAscender(pixels, canvasWidth, canvasHeight, yPos, this._options.excludeAccents);
      var descender = getDescender(pixels, canvasWidth, canvasHeight, yPos, this._options.excludeAccents);
      var width = textWidth;
      var height = ascender + descender;

      this._metrics = {
        width: width,
        height: height,
        ascender: ascender,
        descender: descender
      };

      this._isDirty = false;

      return _extends({}, this._metrics);
    }
  }, {
    key: 'draw',
    value: function draw() {
      var ctx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._context;
      var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
      var y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
      var options = arguments[3];
      var debug = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;

      ctx.save();

      if (!this._metrics || this._isDirty) {
        this._calculateTextMetrics();
      }

      this._applyTextOptions(ctx, options);

      ctx.fillText(this.getText(), x, y + this._metrics.ascender);

      if (debug) {
        drawRect(ctx, x, y, this._metrics.width, this._metrics.height);
        hLine(ctx, y + this._metrics.ascender, x, x + this._metrics.width);
      }

      ctx.restore();
    }
  }]);

  return TextDesignFont;
}(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Configurable"]);

var getPixel = function getPixel(data, x, y, width) {
  var index = y * (width * 4) + x * 4;
  var pixel = {
    r: data[index],
    g: data[index + 1],
    b: data[index + 2],
    a: data[index + 3]
  };
  return pixel;
};

var isTransparent = function isTransparent(pixel) {
  return pixel.a <= 254;
};

var isBlankScanline = function isBlankScanline(data, y, width) {
  var isBlank = true;
  for (var x = 0; x < width; x++) {
    var pixel = getPixel(data, x, y, width);
    if (!isTransparent(pixel)) {
      isBlank = false;
      break;
    }
  }

  return isBlank;
};

var getDescender = function getDescender(pixels, width, height, startY) {
  var exitOnFirstBlank = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;

  var descender = 0;
  for (var y = startY + 1; y < height; y++) {
    if (!isBlankScanline(pixels, y, width)) {
      descender = y - startY + 1;
    } else if (exitOnFirstBlank) {
      break;
    }
  }

  return descender;
};

var getAscender = function getAscender(pixels, width, height, startY) {
  var exitOnFirstBlank = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;

  var ascender = 0;
  for (var y = startY - 1; y >= 0; y--) {
    if (!isBlankScanline(pixels, y, width)) {
      ascender = startY - y;
    } else if (exitOnFirstBlank) {
      break;
    }
  }

  return ascender;
};

var strokeLine = function strokeLine(ctx, fromX, fromY, toX, toY) {
  ctx.beginPath();
  ctx.moveTo(fromX, fromY);
  ctx.lineTo(toX, toY);
  ctx.stroke();
};

var hLine = function hLine(ctx, y, xmin, xmax) {
  var color = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'red';

  ctx.save();
  ctx.strokeStyle = color;
  strokeLine(ctx, xmin, y, xmax, y);
  ctx.restore();
};

var drawRect = function drawRect(ctx, x, y, width, height) {
  var color = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'blue';

  ctx.save();
  ctx.strokeStyle = color;
  ctx.strokeRect(x, y, width, height);
  ctx.restore();
};

TextDesignFont.prototype.availableOptions = {
  text: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].STRING, default: '' },
  fontIdentifier: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].STRING, default: 'imgly_font_open_sans_bold' },
  fontVariation: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].OBJECT, default: null },
  lineHeight: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].NUMBER, default: 1 },
  fontSize: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].NUMBER, default: 22 },
  textColor: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].STRING, default: 'black' },
  strokeStyle: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].STRING, default: 'black' },
  outlineWidth: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].NUMBER, default: 0 },
  textBaseline: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].STRING, default: 'alphabetic' },
  excludeAccents: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].BOOLEAN, default: false }
};

/***/ }),
/* 61 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return RowType; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__ = __webpack_require__(17);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var RowType = function (_Configurable) {
  _inherits(RowType, _Configurable);

  function RowType() {
    _classCallCheck(this, RowType);

    return _possibleConstructorReturn(this, (RowType.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(RowType)).apply(this, arguments));
  }

  _createClass(RowType, [{
    key: 'insetsForWidth',
    value: function insetsForWidth(width) {
      var insets = this.getRelativeInsets().clone();
      return insets.scale(width);
    }
  }]);

  return RowType;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Configurable"]);

RowType.prototype.availableOptions = {
  imagePath: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].STRING, default: '' },
  minimumHeightRatio: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 0 },
  sizeToFitContent: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].BOOLEAN, default: true },
  capInsets: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].OBJECT, default: new __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__["a" /* RectangleInsets */]() },
  relativeInsets: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].OBJECT, default: new __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__["a" /* RectangleInsets */]() }
};

RowType.Box = new RowType({
  imagePath: 'text-design/images/imgly_text_design_asset_black_background.png',
  relativeInsets: new __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__["a" /* RectangleInsets */](0.1, 0.1, 0.1, 0.1)
});

RowType.Badge1 = new RowType({
  imagePath: 'text-design/images/imgly_text_design_asset_badge1.png',
  relativeInsets: new __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__["a" /* RectangleInsets */](0.3, 0.18, 0.2, 0.18)
});

RowType.Badge2 = new RowType({
  imagePath: 'text-design/images/imgly_text_design_asset_badge2.png',
  relativeInsets: new __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__["a" /* RectangleInsets */](0.3, 0.18, 0.2, 0.18)
});

RowType.Badge3 = new RowType({
  imagePath: 'text-design/images/imgly_text_design_asset_badge3.png',
  relativeInsets: new __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__["a" /* RectangleInsets */](0.3, 0.18, 0.2, 0.18)
});

RowType.Badge4 = new RowType({
  imagePath: 'text-design/images/imgly_text_design_asset_badge4.png',
  relativeInsets: new __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__["a" /* RectangleInsets */](0.3, 0.18, 0.2, 0.18)
});

RowType.SpeechBubble1 = new RowType({
  imagePath: 'text-design/images/imgly_text_design_asset_speech_bubble_small2.png',
  relativeInsets: new __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__["a" /* RectangleInsets */](0.04, 0.07, 0.12, 0.07),
  capInsets: new __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__["a" /* RectangleInsets */](19 * 3, 57 * 3, 41 * 3, 17 * 3)
});

RowType.SpeechBubble2 = new RowType({
  imagePath: 'text-design/images/imgly_text_design_asset_speech_bubble3.png',
  relativeInsets: new __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__["a" /* RectangleInsets */](0.04, 0.07, 0.12, 0.07),
  capInsets: new __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__["a" /* RectangleInsets */](2 * 3, 35 * 3, 29 * 3, 5 * 3)
});

RowType.SpeechBubble3 = new RowType({
  imagePath: 'text-design/images/imgly_text_design_asset_speech_bubble_small.png',
  relativeInsets: new __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__["a" /* RectangleInsets */](0.165664675, 0.2, 0.165664675, 0.2),
  minimumHeightRatio: 0.7
});

RowType.SpeechBubble4 = new RowType({
  imagePath: 'text-design/images/imgly_text_design_asset_speech_bubble4.png',
  relativeInsets: new __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__["a" /* RectangleInsets */](0.124800224, 0.2, 0.291200523, 0.2),
  minimumHeightRatio: 0.7
});

RowType.SpeechBubble5 = new RowType({
  imagePath: 'text-design/images/imgly_text_design_asset_speech_bubble5.png',
  relativeInsets: new __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__["a" /* RectangleInsets */](0.114892823, 0.27, 0.15984926, 0.27)
});

RowType.Watercolor1 = new RowType({
  imagePath: 'text-design/images/imgly_text_design_asset_watercolor_01.png',
  minimumHeightRatio: 0.7,
  relativeInsets: new __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__["a" /* RectangleInsets */](0.2, 0.25, 0.2, 0.25)
});

RowType.Watercolor2 = new RowType({
  imagePath: 'text-design/images/imgly_text_design_asset_watercolor_02.png',
  minimumHeightRatio: 0.7,
  relativeInsets: new __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__["a" /* RectangleInsets */](0.08, 0.25, 0.3, 0.25)
});

RowType.Watercolor3 = new RowType({
  imagePath: 'text-design/images/imgly_text_design_asset_watercolor_03.png',
  minimumHeightRatio: 0.7,
  relativeInsets: new __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__["a" /* RectangleInsets */](0.1, 0.2, 0.15, 0.2)
});

/***/ }),
/* 62 */
/***/ (function(module, exports) {

module.exports = true;


/***/ }),
/* 63 */
/***/ (function(module, exports) {

module.exports = function (it) {
  if (typeof it != 'function') throw TypeError(it + ' is not a function!');
  return it;
};


/***/ }),
/* 64 */
/***/ (function(module, exports) {

var id = 0;
var px = Math.random();
module.exports = function (key) {
  return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
};


/***/ }),
/* 65 */
/***/ (function(module, exports, __webpack_require__) {

var def = __webpack_require__(21).f;
var has = __webpack_require__(27);
var TAG = __webpack_require__(11)('toStringTag');

module.exports = function (it, tag, stat) {
  if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
};


/***/ }),
/* 66 */
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(166);
var global = __webpack_require__(14);
var hide = __webpack_require__(26);
var Iterators = __webpack_require__(38);
var TO_STRING_TAG = __webpack_require__(11)('toStringTag');

var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +
  'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +
  'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +
  'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +
  'TextTrackList,TouchList').split(',');

for (var i = 0; i < DOMIterables.length; i++) {
  var NAME = DOMIterables[i];
  var Collection = global[NAME];
  var proto = Collection && Collection.prototype;
  if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
  Iterators[NAME] = Iterators.Array;
}


/***/ }),
/* 67 */
/***/ (function(module, exports) {

exports.f = {}.propertyIsEnumerable;


/***/ }),
/* 68 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__renderers_canvas_canvas_renderer__ = __webpack_require__(196);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__renderers_webgl_webgl_renderer__ = __webpack_require__(213);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__managers_canvas_filter_manager__ = __webpack_require__(95);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__managers_webgl_filter_manager__ = __webpack_require__(99);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__display_display_object__ = __webpack_require__(98);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__display_container__ = __webpack_require__(133);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__textures_base_texture__ = __webpack_require__(53);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__textures_texture__ = __webpack_require__(134);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__textures_render_texture__ = __webpack_require__(221);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_webgl_render_target__ = __webpack_require__(73);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__utils_canvas_render_target__ = __webpack_require__(72);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__sprites_sprite__ = __webpack_require__(222);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__shaders___ = __webpack_require__(224);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__shaders_shader__ = __webpack_require__(97);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__filters_filter__ = __webpack_require__(54);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__filters__ = __webpack_require__(228);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__utils_pixel_array_image__ = __webpack_require__(132);
/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



















/**
 * The heart of PhotoEditorSDK. Handles all the rendering in a scene-graph fashion
 * @namespace PhotoEditorSDK.Engine
 */
var Engine = {
  WebGLRenderer: __WEBPACK_IMPORTED_MODULE_1__renderers_webgl_webgl_renderer__["a" /* default */],
  CanvasRenderer: __WEBPACK_IMPORTED_MODULE_0__renderers_canvas_canvas_renderer__["a" /* default */],
  WebGLFilterManager: __WEBPACK_IMPORTED_MODULE_3__managers_webgl_filter_manager__["a" /* default */],
  CanvasFilterManager: __WEBPACK_IMPORTED_MODULE_2__managers_canvas_filter_manager__["a" /* default */],
  DisplayObject: __WEBPACK_IMPORTED_MODULE_4__display_display_object__["a" /* default */],
  Container: __WEBPACK_IMPORTED_MODULE_5__display_container__["a" /* default */],
  BaseTexture: __WEBPACK_IMPORTED_MODULE_6__textures_base_texture__["a" /* default */],
  Texture: __WEBPACK_IMPORTED_MODULE_7__textures_texture__["a" /* default */],
  RenderTexture: __WEBPACK_IMPORTED_MODULE_8__textures_render_texture__["a" /* default */],
  WebGLRenderTarget: __WEBPACK_IMPORTED_MODULE_9__utils_webgl_render_target__["a" /* default */],
  CanvasRenderTarget: __WEBPACK_IMPORTED_MODULE_10__utils_canvas_render_target__["a" /* default */],
  Sprite: __WEBPACK_IMPORTED_MODULE_11__sprites_sprite__["a" /* default */],
  Shaders: __WEBPACK_IMPORTED_MODULE_12__shaders___["a" /* default */],
  Shader: __WEBPACK_IMPORTED_MODULE_13__shaders_shader__["a" /* default */],
  Filter: __WEBPACK_IMPORTED_MODULE_14__filters_filter__["a" /* default */],
  Filters: __WEBPACK_IMPORTED_MODULE_15__filters__,
  PixelArrayImage: __WEBPACK_IMPORTED_MODULE_16__utils_pixel_array_image__["a" /* default */],

  /**
   * If WebGL is supported, this returns a WebGLRenderer and falls back to CanvasRenderer
   * @param  {Number} width
   * @param  {Number} height
   * @param  {Object} [options = {} ]
   * @return {(PhotoEditorSDK.Engine.WebGLRenderer|PhotoEditorSDK.Engine.CanvasRenderer)}
   */
  autoDetectRenderer: function autoDetectRenderer(width, height) {
    var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

    if (__WEBPACK_IMPORTED_MODULE_1__renderers_webgl_webgl_renderer__["a" /* default */].isSupported()) {
      return new __WEBPACK_IMPORTED_MODULE_1__renderers_webgl_webgl_renderer__["a" /* default */](width, height, options);
    } else {
      return new __WEBPACK_IMPORTED_MODULE_0__renderers_canvas_canvas_renderer__["a" /* default */](width, height, options);
    }
  }
};

/* harmony default export */ __webpack_exports__["a"] = (Engine);

/***/ }),
/* 69 */
/***/ (function(module, exports, __webpack_require__) {

module.exports = { "default": __webpack_require__(205), __esModule: true };

/***/ }),
/* 70 */
/***/ (function(module, exports, __webpack_require__) {

module.exports = { "default": __webpack_require__(208), __esModule: true };

/***/ }),
/* 71 */
/***/ (function(module, exports, __webpack_require__) {

module.exports = { "default": __webpack_require__(210), __esModule: true };

/***/ }),
/* 72 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__globals__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__textures_base_texture__ = __webpack_require__(53);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * A canvas render target that you can render to.
 * Canvas equivalent of {@link PhotoEditorSDK.Engine.WebGLRenderTarget}
 * @class
 * @memberof PhotoEditorSDK.Engine
 */

var CanvasRenderTarget = function () {
  /**
   * Creates a CanvasRenderTarget
   * @param  {Number} width
   * @param  {Number} height
   * @param  {Number} pixelRatio
   * @param  {HTMLCanvasElement} canvas
   * @param  {CanvasRenderingContext2D} context
   */
  function CanvasRenderTarget(width, height, pixelRatio, canvas, context) {
    _classCallCheck(this, CanvasRenderTarget);

    this._width = width;
    this._height = height;
    this._pixelRatio = pixelRatio;

    this._baseTexture = new __WEBPACK_IMPORTED_MODULE_2__textures_base_texture__["a" /* default */]();
    this._canvas = canvas || this._createCanvas();
    this._context = context || this._canvas.getContext('2d');
    this._baseTexture.setSource(this._canvas);

    this._canvas.width = this._width * this._pixelRatio;
    this._canvas.height = this._height * this._pixelRatio;
    this._filterStack = [{
      renderTarget: this,
      filter: []
    }];
  }

  /**
   * Creates a canvas
   * @return {Canvas}
   * @private
   */


  _createClass(CanvasRenderTarget, [{
    key: '_createCanvas',
    value: function _createCanvas() {
      return __WEBPACK_IMPORTED_MODULE_1__globals__["i" /* Utils */].createCanvas();
    }

    /**
     * Clears this CanvasRenderTarget
     */

  }, {
    key: 'clear',
    value: function clear() {
      var ctx = this._context;
      ctx.setTransform(1, 0, 0, 1, 0, 0);
      ctx.clearRect(0, 0, this._width * this._pixelRatio, this._height * this._pixelRatio);
    }

    /**
     * Resizes this canvas buffer to the given dimensions
     * @param  {PhotoEditorSDK.Math.Vector2} dimensions
     */

  }, {
    key: 'resizeTo',
    value: function resizeTo(dimensions) {
      this._baseTexture.resizeTo(dimensions);

      if (this._width !== dimensions.x) {
        this._width = dimensions.x;
        this._canvas.width = this._width * this._pixelRatio;
      }

      if (this._height !== dimensions.y) {
        this._height = dimensions.y;
        this._canvas.height = this._height * this._pixelRatio;
      }
    }

    /**
     * Returns the canvas
     * @return {HTMLCanvasElement}
     */

  }, {
    key: 'getCanvas',
    value: function getCanvas() {
      return this._canvas;
    }

    /**
     * Returns the rendering context
     * @return {CanvasRenderingContext2D} [description]
     */

  }, {
    key: 'getContext',
    value: function getContext() {
      return this._context;
    }

    /**
     * Returns the filter stack
     * @return {Object[]}
     */

  }, {
    key: 'getFilterStack',
    value: function getFilterStack() {
      return this._filterStack;
    }

    /**
     * Returns the width
     * @return {Number}
     */

  }, {
    key: 'getWidth',
    value: function getWidth() {
      return this._width;
    }

    /**
     * Returns the height
     * @return {Number}
     */

  }, {
    key: 'getHeight',
    value: function getHeight() {
      return this._height;
    }

    /**
     * Returns the pixel ratio
     * @return {Number}
     */

  }, {
    key: 'getPixelRatio',
    value: function getPixelRatio() {
      return this._pixelRatio;
    }

    /**
     * Sets the pixel ratio
     * @param {Number} pixelRatio
     */

  }, {
    key: 'setPixelRatio',
    value: function setPixelRatio(pixelRatio) {
      this._pixelRatio = pixelRatio;
    }

    /**
     * Returns the dimensions
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'getDimensions',
    value: function getDimensions() {
      return new __WEBPACK_IMPORTED_MODULE_1__globals__["k" /* Vector2 */](this._width, this._height);
    }

    /**
     * Returns the base texture
     * @return {PhotoEditorSDK.Engine.BaseTexture}
     */

  }, {
    key: 'getBaseTexture',
    value: function getBaseTexture() {
      return this._baseTexture;
    }

    /**
     * Cleans up this canvas buffer
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      this._canvas = null;
      this._context = null;
    }
  }]);

  return CanvasRenderTarget;
}();

/* harmony default export */ __webpack_exports__["a"] = (CanvasRenderTarget);

/***/ }),
/* 73 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__globals__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__textures_base_texture__ = __webpack_require__(53);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * An object that you can render to. WebGL equivalent of {@link PhotoEditorSDK.Engine.CanvasRenderTarget}
 * @class
 * @memberof PhotoEditorSDK.Engine
 */
/* istanbul ignore next */

var WebGLRenderTarget = function () {
  /**
   * Creates a WebGLRenderTarget
   * @param  {PhotoEditorSDK.Engine.BaseRenderer}  renderer
   * @param  {Number}  width
   * @param  {Number}  height
   * @param  {Number}  pixelRatio
   * @param  {Boolean} [isRoot = false]
   */
  function WebGLRenderTarget(renderer, width, height, pixelRatio) {
    var isRoot = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;

    _classCallCheck(this, WebGLRenderTarget);

    this._renderer = renderer;
    this._gl = renderer.getContext();
    this._width = width;
    this._height = height;
    this._frame = null;
    this._pixelRatio = pixelRatio;
    this._projectionMatrix = new __WEBPACK_IMPORTED_MODULE_1__globals__["g" /* Matrix */]();
    this._mipMapping = false;

    this._baseTexture = new __WEBPACK_IMPORTED_MODULE_2__textures_base_texture__["a" /* default */]();
    var frame = this._baseTexture.getFrame();
    frame.width = width;
    frame.height = height;
    this._baseTexture.setPixelRatio(pixelRatio);
    this._baseTexture.setLoaded(true);

    // `null` means render to canvas directly
    this._framebuffer = null;
    this._isRoot = isRoot;
    this._filterStack = [{
      renderTarget: this,
      filter: []
    }];

    if (!isRoot) {
      this._initFrameBuffer();
    }
  }

  /**
   * Resizes this WebGLRenderTarget to the given dimensions
   * @param  {PhotoEditorSDK.Math.Vector2} dimensions
   */


  _createClass(WebGLRenderTarget, [{
    key: 'resizeTo',
    value: function resizeTo(dimensions) {
      this._width = dimensions.x | 0; // rounded
      this._height = dimensions.y | 0; // rounded

      this._baseTexture.resizeTo(dimensions);

      if (!this._isRoot) {
        this._resizeTexture();
      }

      this._baseTexture.setMinFilter(this._getMinFilter());
      this._baseTexture.setMagFilter(this._getMagFilter());

      this._calculateProjectionMatrix();
    }

    /**
     * Returns the downsampling filter
     * @return {Number}
     * @private
     */

  }, {
    key: '_getMinFilter',
    value: function _getMinFilter() {
      var minFilter = __WEBPACK_IMPORTED_MODULE_2__textures_base_texture__["a" /* default */].DefaultMinFilter;
      if (this._mipMapping) {
        minFilter = __WEBPACK_IMPORTED_MODULE_2__textures_base_texture__["a" /* default */].TrilinearFilter;
      }
      return minFilter;
    }

    /**
     * Returns the upsampling filter
     * @return {Number}
     * @private
     */

  }, {
    key: '_getMagFilter',
    value: function _getMagFilter() {
      return __WEBPACK_IMPORTED_MODULE_2__textures_base_texture__["a" /* default */].DefaultMagFilter;
    }

    /**
     * Resizes the FBO's texture to the current dimensions
     * @private
     */

  }, {
    key: '_resizeTexture',
    value: function _resizeTexture() {
      var gl = this._gl;
      gl.bindTexture(gl.TEXTURE_2D, this._texture);

      var realWidth = this._width * this._pixelRatio;
      var realHeight = this._height * this._pixelRatio;
      gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, realWidth, realHeight, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);

      var dimensions = new __WEBPACK_IMPORTED_MODULE_1__globals__["k" /* Vector2 */](this._width, this._height);
      if (__WEBPACK_IMPORTED_MODULE_1__globals__["i" /* Utils */].isPowerOfTwo(dimensions)) {
        __WEBPACK_IMPORTED_MODULE_1__globals__["f" /* Log */].info('WebGLRenderTarget', 'Mip-mapping enabled');
        this._mipMapping = true;
      } else {
        this._mipMapping = false;
      }

      this._baseTexture.setMipMappingEnabled(this._mipMapping);
    }

    /**
     * Binds the framebuffer and resizes the viewport
     */

  }, {
    key: 'activate',
    value: function activate() {
      var gl = this._gl;
      gl.bindFramebuffer(gl.FRAMEBUFFER, this._framebuffer);

      this._calculateProjectionMatrix();

      gl.viewport(0, 0, this._width * this._pixelRatio, this._height * this._pixelRatio);
      gl.disable(gl.STENCIL_TEST);
    }

    /**
     * Clears the framebuffer
     */

  }, {
    key: 'clear',
    value: function clear() {
      var color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : __WEBPACK_IMPORTED_MODULE_1__globals__["b" /* Color */].TRANSPARENT;

      var gl = this._gl;
      gl.bindFramebuffer(gl.FRAMEBUFFER, this._framebuffer);

      __WEBPACK_IMPORTED_MODULE_1__globals__["e" /* GLUtils */].checkFramebufferStatus('WebGLRenderTarget#clear', gl);

      gl.clearColor.apply(gl, color.toGLColor());
      gl.clear(gl.COLOR_BUFFER_BIT);
    }

    /**
     * Calculates the projection matrix for this render target
     * @private
     */

  }, {
    key: '_calculateProjectionMatrix',
    value: function _calculateProjectionMatrix() {
      var projectionMatrix = this._projectionMatrix;
      projectionMatrix.reset();

      var frame = this._frame || new __WEBPACK_IMPORTED_MODULE_1__globals__["h" /* Rectangle */](0, 0, this._width, this._height);

      var x = frame.x,
          y = frame.y;

      if (!this._isRoot) {
        projectionMatrix.a = 1 / this._width * 2;
        projectionMatrix.d = 1 / this._height * 2;

        projectionMatrix.tx = -1 - x * projectionMatrix.a;
        projectionMatrix.ty = -1 - y * projectionMatrix.d;
      } else {
        projectionMatrix.a = 1 / this._width * 2;
        projectionMatrix.d = -1 / this._height * 2;

        projectionMatrix.tx = -1 - x * projectionMatrix.a;
        projectionMatrix.ty = 1 - y * projectionMatrix.d;
      }
    }

    /**
     * Initializes the WebGL FBO and Texture for this WebGLRenderTarget
     * @private
     */

  }, {
    key: '_initFrameBuffer',
    value: function _initFrameBuffer() {
      var gl = this._gl;

      // Init the FBO
      this._framebuffer = gl.createFramebuffer();

      // Create the texture
      this._texture = gl.createTexture();
      gl.bindTexture(gl.TEXTURE_2D, this._texture);

      // Bind texture to FBO
      gl.bindFramebuffer(gl.FRAMEBUFFER, this._framebuffer);
      gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this._texture, 0);

      this._baseTexture.setGLTextureForRenderer(this._texture, this._renderer);
      this.resizeTo(new __WEBPACK_IMPORTED_MODULE_1__globals__["k" /* Vector2 */](this._width, this._height));

      __WEBPACK_IMPORTED_MODULE_1__globals__["e" /* GLUtils */].checkFramebufferStatus('WebGLRenderTarget#_initFramebuffer', gl);
    }

    /**
     * Returns the projection matrix
     * @return {PhotoEditorSDK.Math.Matrix}
     */

  }, {
    key: 'getProjectionMatrix',
    value: function getProjectionMatrix() {
      return this._projectionMatrix;
    }

    /**
     * Returns the texture
     * @return {PhotoEditorSDK.Engine.Texture}
     */

  }, {
    key: 'getTexture',
    value: function getTexture() {
      return this._texture;
    }

    /**
     * Returns the frame
     * @return {PhotoEditorSDK.Math.Rectangle}
     */

  }, {
    key: 'getFrame',
    value: function getFrame() {
      return this._frame;
    }

    /**
     * Sets the frame
     * @param {PhotoEditorSDK.Math.Rectangle} frame
     */

  }, {
    key: 'setFrame',
    value: function setFrame(frame) {
      this._frame = frame;
    }

    /**
     * Returns the filter stack
     * @return {Object[]}
     */

  }, {
    key: 'getFilterStack',
    value: function getFilterStack() {
      return this._filterStack;
    }

    /**
     * Returns the current pixel ratio
     * @return {Number}
     */

  }, {
    key: 'getPixelRatio',
    value: function getPixelRatio() {
      return this._pixelRatio;
    }

    /**
     * Sets the pixel ratio
     * @param {Number} pixelRatio
     */

  }, {
    key: 'setPixelRatio',
    value: function setPixelRatio(pixelRatio) {
      this._pixelRatio = pixelRatio;

      if (!this._isRoot) {
        this._resizeTexture();
      }
    }

    /**
     * Returns the base texture
     * @return {PhotoEditorSDK.Engine.BaseTexture}
     */

  }, {
    key: 'getBaseTexture',
    value: function getBaseTexture() {
      return this._baseTexture;
    }

    /**
     * Disposes this WebGLRenderTarget
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      var gl = this._gl;
      this._baseTexture.disposeGLTexturesForRenderer(this._renderer);
      gl.deleteTexture(this._texture);
      gl.deleteFramebuffer(this._framebuffer);
    }
  }]);

  return WebGLRenderTarget;
}();

/* harmony default export */ __webpack_exports__["a"] = (WebGLRenderTarget);

/***/ }),
/* 74 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";

var Image = void 0;
if (true) {
  Image = window.Image;
}

/* harmony default export */ __webpack_exports__["a"] = (Image);

/***/ }),
/* 75 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* eslint-disable */

/*!
StackBlur - a fast almost Gaussian Blur For Canvas

Version:  0.5
Author:   Mario Klingemann
Contact:  mario@quasimondo.com
Website:  http://www.quasimondo.com/StackBlurForCanvas
Twitter:  @quasimondo

In case you find this class useful - especially in commercial projects -
I am not totally unhappy for a small donation to my PayPal account
mario@quasimondo.de

Or support me on flattr:
https://flattr.com/thing/72791/StackBlur-a-fast-almost-Gaussian-Blur-Effect-for-CanvasJavascript

Copyright (c) 2010 Mario Klingemann

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
@license
*/

var mul_table = [512, 512, 456, 512, 328, 456, 335, 512, 405, 328, 271, 456, 388, 335, 292, 512, 454, 405, 364, 328, 298, 271, 496, 456, 420, 388, 360, 335, 312, 292, 273, 512, 482, 454, 428, 405, 383, 364, 345, 328, 312, 298, 284, 271, 259, 496, 475, 456, 437, 420, 404, 388, 374, 360, 347, 335, 323, 312, 302, 292, 282, 273, 265, 512, 497, 482, 468, 454, 441, 428, 417, 405, 394, 383, 373, 364, 354, 345, 337, 328, 320, 312, 305, 298, 291, 284, 278, 271, 265, 259, 507, 496, 485, 475, 465, 456, 446, 437, 428, 420, 412, 404, 396, 388, 381, 374, 367, 360, 354, 347, 341, 335, 329, 323, 318, 312, 307, 302, 297, 292, 287, 282, 278, 273, 269, 265, 261, 512, 505, 497, 489, 482, 475, 468, 461, 454, 447, 441, 435, 428, 422, 417, 411, 405, 399, 394, 389, 383, 378, 373, 368, 364, 359, 354, 350, 345, 341, 337, 332, 328, 324, 320, 316, 312, 309, 305, 301, 298, 294, 291, 287, 284, 281, 278, 274, 271, 268, 265, 262, 259, 257, 507, 501, 496, 491, 485, 480, 475, 470, 465, 460, 456, 451, 446, 442, 437, 433, 428, 424, 420, 416, 412, 408, 404, 400, 396, 392, 388, 385, 381, 377, 374, 370, 367, 363, 360, 357, 354, 350, 347, 344, 341, 338, 335, 332, 329, 326, 323, 320, 318, 315, 312, 310, 307, 304, 302, 299, 297, 294, 292, 289, 287, 285, 282, 280, 278, 275, 273, 271, 269, 267, 265, 263, 261, 259];

var shg_table = [9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24];

function stackBlurCanvasRGBA(imageData, top_x, top_y, width, height, radius) {
  if (isNaN(radius) || radius < 1) {
    return;
  }
  radius |= 0;

  var pixels = imageData.data;

  var x, y, i, p, yp, yi, yw, r_sum, g_sum, b_sum, a_sum, r_out_sum, g_out_sum, b_out_sum, a_out_sum, r_in_sum, g_in_sum, b_in_sum, a_in_sum, pr, pg, pb, pa, rbs;

  var div = radius + radius + 1;
  var widthMinus1 = width - 1;
  var heightMinus1 = height - 1;
  var radiusPlus1 = radius + 1;
  var sumFactor = radiusPlus1 * (radiusPlus1 + 1) / 2;

  var stackStart = new BlurStack();
  var stackEnd;
  var stack = stackStart;
  for (i = 1; i < div; i++) {
    stack = stack.next = new BlurStack();
    if (i == radiusPlus1) stackEnd = stack;
  }
  stack.next = stackStart;
  var stackIn = null;
  var stackOut = null;

  yw = yi = 0;

  var mul_sum = mul_table[radius];
  var shg_sum = shg_table[radius];

  for (y = 0; y < height; y++) {
    r_in_sum = g_in_sum = b_in_sum = a_in_sum = r_sum = g_sum = b_sum = a_sum = 0;

    r_out_sum = radiusPlus1 * (pr = pixels[yi]);
    g_out_sum = radiusPlus1 * (pg = pixels[yi + 1]);
    b_out_sum = radiusPlus1 * (pb = pixels[yi + 2]);
    a_out_sum = radiusPlus1 * (pa = pixels[yi + 3]);

    r_sum += sumFactor * pr;
    g_sum += sumFactor * pg;
    b_sum += sumFactor * pb;
    a_sum += sumFactor * pa;

    stack = stackStart;

    for (i = 0; i < radiusPlus1; i++) {
      stack.r = pr;
      stack.g = pg;
      stack.b = pb;
      stack.a = pa;
      stack = stack.next;
    }

    for (i = 1; i < radiusPlus1; i++) {
      p = yi + ((widthMinus1 < i ? widthMinus1 : i) << 2);
      r_sum += (stack.r = pr = pixels[p]) * (rbs = radiusPlus1 - i);
      g_sum += (stack.g = pg = pixels[p + 1]) * rbs;
      b_sum += (stack.b = pb = pixels[p + 2]) * rbs;
      a_sum += (stack.a = pa = pixels[p + 3]) * rbs;

      r_in_sum += pr;
      g_in_sum += pg;
      b_in_sum += pb;
      a_in_sum += pa;

      stack = stack.next;
    }

    stackIn = stackStart;
    stackOut = stackEnd;
    for (x = 0; x < width; x++) {
      pixels[yi + 3] = pa = a_sum * mul_sum >> shg_sum;
      if (pa !== 0) {
        pa = 255 / pa;
        pixels[yi] = (r_sum * mul_sum >> shg_sum) * pa;
        pixels[yi + 1] = (g_sum * mul_sum >> shg_sum) * pa;
        pixels[yi + 2] = (b_sum * mul_sum >> shg_sum) * pa;
      } else {
        pixels[yi] = pixels[yi + 1] = pixels[yi + 2] = 0;
      }

      r_sum -= r_out_sum;
      g_sum -= g_out_sum;
      b_sum -= b_out_sum;
      a_sum -= a_out_sum;

      r_out_sum -= stackIn.r;
      g_out_sum -= stackIn.g;
      b_out_sum -= stackIn.b;
      a_out_sum -= stackIn.a;

      p = yw + ((p = x + radius + 1) < widthMinus1 ? p : widthMinus1) << 2;

      r_in_sum += stackIn.r = pixels[p];
      g_in_sum += stackIn.g = pixels[p + 1];
      b_in_sum += stackIn.b = pixels[p + 2];
      a_in_sum += stackIn.a = pixels[p + 3];

      r_sum += r_in_sum;
      g_sum += g_in_sum;
      b_sum += b_in_sum;
      a_sum += a_in_sum;

      stackIn = stackIn.next;

      r_out_sum += pr = stackOut.r;
      g_out_sum += pg = stackOut.g;
      b_out_sum += pb = stackOut.b;
      a_out_sum += pa = stackOut.a;

      r_in_sum -= pr;
      g_in_sum -= pg;
      b_in_sum -= pb;
      a_in_sum -= pa;

      stackOut = stackOut.next;

      yi += 4;
    }
    yw += width;
  }

  for (x = 0; x < width; x++) {
    g_in_sum = b_in_sum = a_in_sum = r_in_sum = g_sum = b_sum = a_sum = r_sum = 0;

    yi = x << 2;
    r_out_sum = radiusPlus1 * (pr = pixels[yi]);
    g_out_sum = radiusPlus1 * (pg = pixels[yi + 1]);
    b_out_sum = radiusPlus1 * (pb = pixels[yi + 2]);
    a_out_sum = radiusPlus1 * (pa = pixels[yi + 3]);

    r_sum += sumFactor * pr;
    g_sum += sumFactor * pg;
    b_sum += sumFactor * pb;
    a_sum += sumFactor * pa;

    stack = stackStart;

    for (i = 0; i < radiusPlus1; i++) {
      stack.r = pr;
      stack.g = pg;
      stack.b = pb;
      stack.a = pa;
      stack = stack.next;
    }

    yp = width;

    for (i = 1; i <= radius; i++) {
      yi = yp + x << 2;

      r_sum += (stack.r = pr = pixels[yi]) * (rbs = radiusPlus1 - i);
      g_sum += (stack.g = pg = pixels[yi + 1]) * rbs;
      b_sum += (stack.b = pb = pixels[yi + 2]) * rbs;
      a_sum += (stack.a = pa = pixels[yi + 3]) * rbs;

      r_in_sum += pr;
      g_in_sum += pg;
      b_in_sum += pb;
      a_in_sum += pa;

      stack = stack.next;

      if (i < heightMinus1) {
        yp += width;
      }
    }

    yi = x;
    stackIn = stackStart;
    stackOut = stackEnd;
    for (y = 0; y < height; y++) {
      p = yi << 2;
      pixels[p + 3] = pa = a_sum * mul_sum >> shg_sum;
      if (pa > 0) {
        pa = 255 / pa;
        pixels[p] = (r_sum * mul_sum >> shg_sum) * pa;
        pixels[p + 1] = (g_sum * mul_sum >> shg_sum) * pa;
        pixels[p + 2] = (b_sum * mul_sum >> shg_sum) * pa;
      } else {
        pixels[p] = pixels[p + 1] = pixels[p + 2] = 0;
      }

      r_sum -= r_out_sum;
      g_sum -= g_out_sum;
      b_sum -= b_out_sum;
      a_sum -= a_out_sum;

      r_out_sum -= stackIn.r;
      g_out_sum -= stackIn.g;
      b_out_sum -= stackIn.b;
      a_out_sum -= stackIn.a;

      p = x + ((p = y + radiusPlus1) < heightMinus1 ? p : heightMinus1) * width << 2;

      r_sum += r_in_sum += stackIn.r = pixels[p];
      g_sum += g_in_sum += stackIn.g = pixels[p + 1];
      b_sum += b_in_sum += stackIn.b = pixels[p + 2];
      a_sum += a_in_sum += stackIn.a = pixels[p + 3];

      stackIn = stackIn.next;

      r_out_sum += pr = stackOut.r;
      g_out_sum += pg = stackOut.g;
      b_out_sum += pb = stackOut.b;
      a_out_sum += pa = stackOut.a;

      r_in_sum -= pr;
      g_in_sum -= pg;
      b_in_sum -= pb;
      a_in_sum -= pa;

      stackOut = stackOut.next;

      yi += width;
    }
  }
}

function BlurStack() {
  this.r = 0;
  this.g = 0;
  this.b = 0;
  this.a = 0;
  this.next = null;
}

module.exports = {
  stackBlurCanvasRGBA: stackBlurCanvasRGBA
};

/***/ }),
/* 76 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignAttributes; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



var TextDesignAttributes = function (_Configurable) {
  _inherits(TextDesignAttributes, _Configurable);

  function TextDesignAttributes() {
    _classCallCheck(this, TextDesignAttributes);

    return _possibleConstructorReturn(this, (TextDesignAttributes.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignAttributes)).apply(this, arguments));
  }

  return TextDesignAttributes;
}(__WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__["Configurable"]);

TextDesignAttributes.prototype.availableOptions = {
  tintColor: { type: __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__["OptionType"].COLOR, default: __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__["Color"].BLACK },
  textColor: { type: __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__["OptionType"].COLOR, default: __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__["Color"].BLACK },
  alignment: { type: __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__["OptionType"].STRING, default: 'left', available: ['left', 'center', 'right'] },
  lineSpacing: { type: __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__["OptionType"].NUMBER, default: 1 },
  fontIdentifier: { type: __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__["OptionType"].STRING, default: 'imgly_font_open_sans_bold' }
};

/***/ }),
/* 77 */
/***/ (function(module, exports) {

// 7.1.4 ToInteger
var ceil = Math.ceil;
var floor = Math.floor;
module.exports = function (it) {
  return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
};


/***/ }),
/* 78 */
/***/ (function(module, exports) {

// 7.2.1 RequireObjectCoercible(argument)
module.exports = function (it) {
  if (it == undefined) throw TypeError("Can't call method on  " + it);
  return it;
};


/***/ }),
/* 79 */
/***/ (function(module, exports, __webpack_require__) {

var isObject = __webpack_require__(24);
var document = __webpack_require__(14).document;
// typeof document.createElement is 'object' in old IE
var is = isObject(document) && isObject(document.createElement);
module.exports = function (it) {
  return is ? document.createElement(it) : {};
};


/***/ }),
/* 80 */
/***/ (function(module, exports, __webpack_require__) {

// 7.1.1 ToPrimitive(input [, PreferredType])
var isObject = __webpack_require__(24);
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
module.exports = function (it, S) {
  if (!isObject(it)) return it;
  var fn, val;
  if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
  if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
  if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
  throw TypeError("Can't convert object to primitive value");
};


/***/ }),
/* 81 */
/***/ (function(module, exports, __webpack_require__) {

// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
var anObject = __webpack_require__(18);
var dPs = __webpack_require__(163);
var enumBugKeys = __webpack_require__(85);
var IE_PROTO = __webpack_require__(83)('IE_PROTO');
var Empty = function () { /* empty */ };
var PROTOTYPE = 'prototype';

// Create object with fake `null` prototype: use iframe Object with cleared prototype
var createDict = function () {
  // Thrash, waste and sodomy: IE GC bug
  var iframe = __webpack_require__(79)('iframe');
  var i = enumBugKeys.length;
  var lt = '<';
  var gt = '>';
  var iframeDocument;
  iframe.style.display = 'none';
  __webpack_require__(114).appendChild(iframe);
  iframe.src = 'javascript:'; // eslint-disable-line no-script-url
  // createDict = iframe.contentWindow.Object;
  // html.removeChild(iframe);
  iframeDocument = iframe.contentWindow.document;
  iframeDocument.open();
  iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
  iframeDocument.close();
  createDict = iframeDocument.F;
  while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
  return createDict();
};

module.exports = Object.create || function create(O, Properties) {
  var result;
  if (O !== null) {
    Empty[PROTOTYPE] = anObject(O);
    result = new Empty();
    Empty[PROTOTYPE] = null;
    // add "__proto__" for Object.getPrototypeOf polyfill
    result[IE_PROTO] = O;
  } else result = createDict();
  return Properties === undefined ? result : dPs(result, Properties);
};


/***/ }),
/* 82 */
/***/ (function(module, exports, __webpack_require__) {

// 7.1.15 ToLength
var toInteger = __webpack_require__(77);
var min = Math.min;
module.exports = function (it) {
  return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
};


/***/ }),
/* 83 */
/***/ (function(module, exports, __webpack_require__) {

var shared = __webpack_require__(84)('keys');
var uid = __webpack_require__(64);
module.exports = function (key) {
  return shared[key] || (shared[key] = uid(key));
};


/***/ }),
/* 84 */
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__(14);
var SHARED = '__core-js_shared__';
var store = global[SHARED] || (global[SHARED] = {});
module.exports = function (key) {
  return store[key] || (store[key] = {});
};


/***/ }),
/* 85 */
/***/ (function(module, exports) {

// IE 8- don't enum bug keys
module.exports = (
  'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
).split(',');


/***/ }),
/* 86 */
/***/ (function(module, exports, __webpack_require__) {

exports.f = __webpack_require__(11);


/***/ }),
/* 87 */
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__(14);
var core = __webpack_require__(10);
var LIBRARY = __webpack_require__(62);
var wksExt = __webpack_require__(86);
var defineProperty = __webpack_require__(21).f;
module.exports = function (name) {
  var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
  if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });
};


/***/ }),
/* 88 */
/***/ (function(module, exports) {

exports.f = Object.getOwnPropertySymbols;


/***/ }),
/* 89 */
/***/ (function(module, exports, __webpack_require__) {

var pIE = __webpack_require__(67);
var createDesc = __webpack_require__(46);
var toIObject = __webpack_require__(28);
var toPrimitive = __webpack_require__(80);
var has = __webpack_require__(27);
var IE8_DOM_DEFINE = __webpack_require__(110);
var gOPD = Object.getOwnPropertyDescriptor;

exports.f = __webpack_require__(25) ? gOPD : function getOwnPropertyDescriptor(O, P) {
  O = toIObject(O);
  P = toPrimitive(P, true);
  if (IE8_DOM_DEFINE) try {
    return gOPD(O, P);
  } catch (e) { /* empty */ }
  if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
};


/***/ }),
/* 90 */
/***/ (function(module, exports, __webpack_require__) {

// getting tag from 19.1.3.6 Object.prototype.toString()
var cof = __webpack_require__(48);
var TAG = __webpack_require__(11)('toStringTag');
// ES3 wrong here
var ARG = cof(function () { return arguments; }()) == 'Arguments';

// fallback for IE11 Script Access Denied error
var tryGet = function (it, key) {
  try {
    return it[key];
  } catch (e) { /* empty */ }
};

module.exports = function (it) {
  var O, T, B;
  return it === undefined ? 'Undefined' : it === null ? 'Null'
    // @@toStringTag case
    : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
    // builtinTag case
    : ARG ? cof(O)
    // ES3 arguments fallback
    : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
};


/***/ }),
/* 91 */
/***/ (function(module, exports, __webpack_require__) {

var classof = __webpack_require__(90);
var ITERATOR = __webpack_require__(11)('iterator');
var Iterators = __webpack_require__(38);
module.exports = __webpack_require__(10).getIteratorMethod = function (it) {
  if (it != undefined) return it[ITERATOR]
    || it['@@iterator']
    || Iterators[classof(it)];
};


/***/ }),
/* 92 */
/***/ (function(module, exports, __webpack_require__) {

var ctx = __webpack_require__(36);
var invoke = __webpack_require__(188);
var html = __webpack_require__(114);
var cel = __webpack_require__(79);
var global = __webpack_require__(14);
var process = global.process;
var setTask = global.setImmediate;
var clearTask = global.clearImmediate;
var MessageChannel = global.MessageChannel;
var Dispatch = global.Dispatch;
var counter = 0;
var queue = {};
var ONREADYSTATECHANGE = 'onreadystatechange';
var defer, channel, port;
var run = function () {
  var id = +this;
  // eslint-disable-next-line no-prototype-builtins
  if (queue.hasOwnProperty(id)) {
    var fn = queue[id];
    delete queue[id];
    fn();
  }
};
var listener = function (event) {
  run.call(event.data);
};
// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
if (!setTask || !clearTask) {
  setTask = function setImmediate(fn) {
    var args = [];
    var i = 1;
    while (arguments.length > i) args.push(arguments[i++]);
    queue[++counter] = function () {
      // eslint-disable-next-line no-new-func
      invoke(typeof fn == 'function' ? fn : Function(fn), args);
    };
    defer(counter);
    return counter;
  };
  clearTask = function clearImmediate(id) {
    delete queue[id];
  };
  // Node.js 0.8-
  if (__webpack_require__(48)(process) == 'process') {
    defer = function (id) {
      process.nextTick(ctx(run, id, 1));
    };
  // Sphere (JS game engine) Dispatch API
  } else if (Dispatch && Dispatch.now) {
    defer = function (id) {
      Dispatch.now(ctx(run, id, 1));
    };
  // Browsers with MessageChannel, includes WebWorkers
  } else if (MessageChannel) {
    channel = new MessageChannel();
    port = channel.port2;
    channel.port1.onmessage = listener;
    defer = ctx(port.postMessage, port, 1);
  // Browsers with postMessage, skip WebWorkers
  // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
  } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {
    defer = function (id) {
      global.postMessage(id + '', '*');
    };
    global.addEventListener('message', listener, false);
  // IE8-
  } else if (ONREADYSTATECHANGE in cel('script')) {
    defer = function (id) {
      html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () {
        html.removeChild(this);
        run.call(id);
      };
    };
  // Rest old browsers
  } else {
    defer = function (id) {
      setTimeout(ctx(run, id, 1), 0);
    };
  }
}
module.exports = {
  set: setTask,
  clear: clearTask
};


/***/ }),
/* 93 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// 25.4.1.5 NewPromiseCapability(C)
var aFunction = __webpack_require__(63);

function PromiseCapability(C) {
  var resolve, reject;
  this.promise = new C(function ($$resolve, $$reject) {
    if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
    resolve = $$resolve;
    reject = $$reject;
  });
  this.resolve = aFunction(resolve);
  this.reject = aFunction(reject);
}

module.exports.f = function (C) {
  return new PromiseCapability(C);
};


/***/ }),
/* 94 */
/***/ (function(module, exports, __webpack_require__) {

// most Object methods by ES6 should accept primitives
var $export = __webpack_require__(13);
var core = __webpack_require__(10);
var fails = __webpack_require__(37);
module.exports = function (KEY, exec) {
  var fn = (core.Object || {})[KEY] || Object[KEY];
  var exp = {};
  exp[KEY] = exec(fn);
  $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);
};


/***/ }),
/* 95 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__globals__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_canvas_render_target__ = __webpack_require__(72);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * Manages the filters for a {@link PhotoEditorSDK.Engine.CanvasRenderer}
 * @class
 * @memberof PhotoEditorSDK.Engine
 */

var CanvasFilterManager = function () {
  function CanvasFilterManager(renderer) {
    _classCallCheck(this, CanvasFilterManager);

    this._renderer = renderer;
    this._filterStack = [{
      renderTarget: renderer.getCurrentRenderTarget(),
      filters: []
    }];

    this._currentFrame = null;
    this._textures = [];
    this._textureFrame = new __WEBPACK_IMPORTED_MODULE_1__globals__["h" /* Rectangle */](0, 0, renderer.getWidth(), renderer.getHeight());
  }

  /**
   * Resizes this FilterManager and its textures to the given dimensions
   * @param  {PhotoEditorSDK.Math.Vector2} dimensions
   */


  _createClass(CanvasFilterManager, [{
    key: 'resizeTo',
    value: function resizeTo(dimensions) {
      this._textureFrame.width = dimensions.x;
      this._textureFrame.height = dimensions.y;

      this._textures.forEach(function (texture) {
        return texture.resizeTo(dimensions);
      });
    }

    /**
     * Pushes the given filters to the
     * @param  {PhotoEditorSDK.Engine.DisplayObject} displayObject
     * @param  {Array.<Filter>} filters
     */

  }, {
    key: 'pushFilters',
    value: function pushFilters(displayObject, filters) {
      var bounds = displayObject.getBounds();
      this._currentFrame = bounds;

      var renderTarget = this._getOrCreateRenderTarget();
      this._renderer.setRenderTarget(renderTarget);
      this._filterStack.push({ renderTarget: renderTarget, filters: filters });
      renderTarget.clear();
    }

    /**
     * Removes, applies and returns the last filters from the stack
     * @return {Object}
     */

  }, {
    key: 'popFilters',
    value: function popFilters() {
      var _filterStack$pop = this._filterStack.pop(),
          filters = _filterStack$pop.filters,
          renderTarget = _filterStack$pop.renderTarget;

      var lastFilter = this._filterStack[this._filterStack.length - 1];

      var inputRenderTarget = renderTarget;
      var outputRenderTarget = lastFilter.renderTarget;

      if (filters.length === 1) {
        filters[0].apply(this._renderer, inputRenderTarget, outputRenderTarget);
        this._textures.push(inputRenderTarget);
      } else {
        this._applyFilters(filters, inputRenderTarget, outputRenderTarget);
      }
      return filters;
    }

    /**
     * Applies the given filters to the given inputRenderTarget and outputs
     * the filtered content to the outputRenderTarget
     * @param  {PhotoEditorSDK.Engine.Filter[]} filters
     * @param  {PhotoEditorSDK.Engine.CanvasRenderTarget} inputRenderTarget
     * @param  {PhotoEditorSDK.Engine.CanvasRenderTarget} outputRenderTarget
     * @private
     */

  }, {
    key: '_applyFilters',
    value: function _applyFilters(filters, inputRenderTarget, outputRenderTarget) {
      var _this = this;

      var flipRenderTarget = inputRenderTarget;
      var flopRenderTarget = this._getOrCreateRenderTarget(true);

      var lastFilter = filters[filters.length - 1];
      filters.forEach(function (filter, i) {
        var isLastFilter = filter === lastFilter;

        if (!isLastFilter) {
          // Render from flip to flop with filter
          filter.apply(_this._renderer, flipRenderTarget, flopRenderTarget);

          // Flip the render buffers
          var temp = flipRenderTarget;
          flipRenderTarget = flopRenderTarget;
          flopRenderTarget = temp;
        } else {
          // Render to output
          filter.apply(_this._renderer, flipRenderTarget, outputRenderTarget);
        }
      });

      // Push the textures back into the texture pool to use them again later
      this._textures.push(flipRenderTarget);
      this._textures.push(flopRenderTarget);
    }

    /**
     * Returns a render buffer from the pool or creates a new one
     * @param  {Boolean} clear
     * @return {PhotoEditorSDK.Engine.RenderTexture}
     * @private
     */

  }, {
    key: '_getOrCreateRenderTarget',
    value: function _getOrCreateRenderTarget(clear) {
      var renderTarget = this._textures.pop();
      if (!renderTarget) {
        renderTarget = new __WEBPACK_IMPORTED_MODULE_2__utils_canvas_render_target__["a" /* default */](this._textureFrame.width, this._textureFrame.height, 1);
      }

      if (clear) {
        renderTarget.clear();
      }

      return renderTarget;
    }

    /**
     * Sets the filter stack to the given stack
     * @param {Object[]} filterStack
     */

  }, {
    key: 'setFilterStack',
    value: function setFilterStack(filterStack) {
      this._filterStack = filterStack;
    }

    /**
     * Disposes this CanvasFilterManager
     */

  }, {
    key: 'dispose',
    value: function dispose() {}
  }]);

  return CanvasFilterManager;
}();

/* harmony default export */ __webpack_exports__["a"] = (CanvasFilterManager);

/***/ }),
/* 96 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__globals__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__shader__ = __webpack_require__(97);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var UniformType = __WEBPACK_IMPORTED_MODULE_3__globals__["c" /* Constants */].UniformType;

/**
 * The default texture shader
 * @class
 * @extends PhotoEditorSDK.Engine.Shader
 * @memberof PhotoEditorSDK.Engine
 */
/* istanbul ignore next */

var TextureShader = function (_Shader) {
  _inherits(TextureShader, _Shader);

  /**
   * Creates a TextureShader
   * @param  {PhotoEditorSDK.Engine.BaseRenderer} renderer
   * @param  {String} vertexSource
   * @param  {String} fragmentSource
   */
  function TextureShader(renderer, vertexSource, fragmentSource) {
    _classCallCheck(this, TextureShader);

    vertexSource = vertexSource || TextureShader.defaultVertexSource;
    fragmentSource = fragmentSource || TextureShader.defaultFragmentSource;

    return _possibleConstructorReturn(this, (TextureShader.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(TextureShader)).call(this, renderer, vertexSource, fragmentSource, TextureShader.defaultUniforms, TextureShader.defaultAttributes));
  }

  return TextureShader;
}(__WEBPACK_IMPORTED_MODULE_4__shader__["a" /* default */]);

/**
 * The default vertex shader source code
 * @type {String}
 */


TextureShader.defaultVertexSource = __webpack_require__(217);

/**
 * The default fragment shader source code
 * @type {String}
 */
TextureShader.defaultFragmentSource = __webpack_require__(218);

var matrix = new __WEBPACK_IMPORTED_MODULE_3__globals__["g" /* Matrix */]();

/**
 * The default uniforms
 * @type {Object}
 */
TextureShader.defaultUniforms = {
  u_image: {
    type: UniformType.SAMPLER2D,
    value: 0
  },
  u_projMatrix: {
    type: UniformType.MAT3,
    value: matrix.toArray()
  }

  /**
   * The default WebGL attributes
   * @type {String[]}
   */
};TextureShader.defaultAttributes = ['a_position', 'a_texCoord', 'a_color'];

/* harmony default export */ __webpack_exports__["a"] = (TextureShader);

/***/ }),
/* 97 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_keys__ = __webpack_require__(69);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_keys___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_keys__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__globals__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__constants__ = __webpack_require__(31);



var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



var Log = __WEBPACK_IMPORTED_MODULE_2__globals__["f" /* Log */],
    Utils = __WEBPACK_IMPORTED_MODULE_2__globals__["i" /* Utils */];

/**
 * Represents a WebGL shader with a vertex shader, a fragment shader, uniforms and attributes
 * @class
 * @memberof PhotoEditorSDK.Engine
 */
/* istanbul ignore next */

var Shader = function () {
  /**
   * Creates a Shader
   * @param  {PhotoEditorSDK.Engine.BaseRenderer} renderer
   * @param  {String} vertexSource
   * @param  {String} fragmentSource
   * @param  {Object} uniforms
   * @param  {String[]} attributes
   */
  function Shader(renderer, vertexSource, fragmentSource, uniforms, attributes) {
    _classCallCheck(this, Shader);

    this._renderer = renderer;
    this._vertexSource = vertexSource;
    this._fragmentSource = fragmentSource;
    this._uniforms = uniforms || {};
    this._uniformLocations = {};
    this._attributes = attributes || [];
    this._attributeLocations = {};

    this._onContextChange = this._onContextChange.bind(this);
    this._renderer.on('context', this._onContextChange);

    this._init();
  }

  /**
   * Compiles this shader and caches the uniform locations
   * @private
   */


  _createClass(Shader, [{
    key: '_init',
    value: function _init() {
      this._compile();

      var gl = this._renderer.getContext();
      gl.useProgram(this._program);

      this._cacheUniformLocations();
      this._cacheAttributeLocations();
    }

    /**
     * Gets called when the attached Renderer changes its context
     * @private
     */

  }, {
    key: '_onContextChange',
    value: function _onContextChange() {
      this._init();
    }

    /**
     * Binds the given buffers for this shader
     * @param {WebGLBuffer} vertexBuffer
     * @param {WebGLBuffer} indexBuffer
     */

  }, {
    key: 'setupBuffers',
    value: function setupBuffers(vertexBuffer, indexBuffer) {
      var gl = this._renderer.getContext();
      gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
      gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer);

      gl.vertexAttribPointer(this._attributeLocations.a_position, 2, gl.FLOAT, false, __WEBPACK_IMPORTED_MODULE_2__globals__["j" /* VERTEX_BYTE_SIZE */], 0);
      gl.vertexAttribPointer(this._attributeLocations.a_texCoord, 2, gl.FLOAT, false, __WEBPACK_IMPORTED_MODULE_2__globals__["j" /* VERTEX_BYTE_SIZE */], 2 * 4);
      gl.vertexAttribPointer(this._attributeLocations.a_color, 4, gl.UNSIGNED_BYTE, true, __WEBPACK_IMPORTED_MODULE_2__globals__["j" /* VERTEX_BYTE_SIZE */], 4 * 4);
    }

    /**
     * Synchronizes all uniforms with WebGL
     */

  }, {
    key: 'syncUniforms',
    value: function syncUniforms() {
      var _this = this;

      __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_keys___default()(this._uniforms).forEach(function (key) {
        _this.syncUniform(key);
      });
    }

    /**
     * Synchronizes the uniform with the given name
     * @param  {String} name
     */

  }, {
    key: 'syncUniform',
    value: function syncUniform(name) {
      var gl = this._renderer.getContext();
      var uniform = this._uniforms[name];
      var location = this._uniformLocations[name];
      switch (uniform.type) {
        case __WEBPACK_IMPORTED_MODULE_3__constants__["UniformType"].SAMPLER2D:
          gl.uniform1i(location, uniform.value);
          break;
        case __WEBPACK_IMPORTED_MODULE_3__constants__["UniformType"].INT:
        case __WEBPACK_IMPORTED_MODULE_3__constants__["UniformType"].INT1:
          gl.uniform1i(location, uniform.value);
          break;
        case __WEBPACK_IMPORTED_MODULE_3__constants__["UniformType"].FLOAT:
        case __WEBPACK_IMPORTED_MODULE_3__constants__["UniformType"].FLOAT1:
          gl.uniform1f(location, uniform.value);
          break;
        case __WEBPACK_IMPORTED_MODULE_3__constants__["UniformType"].FLOAT2:
          gl.uniform2f(location, uniform.value[0], uniform.value[1]);
          break;
        case __WEBPACK_IMPORTED_MODULE_3__constants__["UniformType"].FLOAT3:
          gl.uniform3f(location, uniform.value[0], uniform.value[1], uniform.value[2]);
          break;
        case __WEBPACK_IMPORTED_MODULE_3__constants__["UniformType"].FLOAT4:
          gl.uniform4f(location, uniform.value[0], uniform.value[1], uniform.value[2], uniform.value[3]);
          break;
        case __WEBPACK_IMPORTED_MODULE_3__constants__["UniformType"].FLOAT_VECTOR2:
          gl.uniform2fv(location, uniform.value);
          break;
        case __WEBPACK_IMPORTED_MODULE_3__constants__["UniformType"].MAT3:
        case __WEBPACK_IMPORTED_MODULE_3__constants__["UniformType"].MAT3FV:
          gl.uniformMatrix3fv(location, false, uniform.value);
          break;
        case __WEBPACK_IMPORTED_MODULE_3__constants__["UniformType"].MAT4:
          gl.uniformMatrix4fv(location, false, uniform.value);
          break;
        default:
          Log.warn(this.constructor.name, 'Unknown uniform type: ' + uniform.type);
      }
    }

    /**
     * Caches the locations for all attributes
     * @private
     */

  }, {
    key: '_cacheAttributeLocations',
    value: function _cacheAttributeLocations() {
      var _this2 = this;

      var gl = this._renderer.getContext();
      this._attributes.forEach(function (name) {
        _this2._attributeLocations[name] = gl.getAttribLocation(_this2._program, name);
      });
    }

    /**
     * Caches the locations for all uniforms
     * @private
     */

  }, {
    key: '_cacheUniformLocations',
    value: function _cacheUniformLocations() {
      var _this3 = this;

      var gl = this._renderer.getContext();
      var keys = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_keys___default()(this._uniforms);
      keys.forEach(function (key) {
        _this3._uniformLocations[key] = gl.getUniformLocation(_this3._program, key);
      });
    }

    /**
     * Adds the preferred precision for the current device to the given shader source
     * @param  {String} source
     * @return {String}
     */

  }, {
    key: '_addPrecisionToSource',
    value: function _addPrecisionToSource(source) {
      var maxFloatPrecision = this._renderer.getMaxFloatPrecision();

      var precision = 'mediump';
      if (Utils.isMobile() && maxFloatPrecision === 'highp') {
        precision = 'highp';
      }

      return 'precision ' + precision + ' float;\n' + source;
    }

    /**
     * Compiles the vertex and fragment sources of this shader
     * @private
     */

  }, {
    key: '_compile',
    value: function _compile() {
      var gl = this._renderer.getContext();

      var vertexShader = this._compileShader(gl.VERTEX_SHADER, this._vertexSource);
      this._vertexShader = vertexShader;

      var fragmentSource = this._addPrecisionToSource(this._fragmentSource);
      var fragmentShader = this._compileShader(gl.FRAGMENT_SHADER, fragmentSource);
      this._fragmentShader = fragmentShader;

      // Create the WebGL program and attach the shaders
      var program = gl.createProgram();
      gl.attachShader(program, vertexShader);
      gl.attachShader(program, fragmentShader);

      // Link the program
      gl.linkProgram(program);

      // Check linking status
      // Check linking status
      var linked = gl.getProgramParameter(program, gl.LINK_STATUS);
      if (!linked) {
        var errorMessage = gl.getProgramInfoLog(program);
        if (gl.isContextLost()) errorMessage = 'WebGL context lost';
        gl.deleteProgram(program);
        Log.error(this.constructor.name, 'WebGL program linking error: ' + errorMessage);
      }

      this._program = program;
    }

    /**
     * Creates and compiles a shader with the given type and source
     * @param  {Number} shaderType
     * @param  {String} shaderSource
     * @return {WebGLShader}
     * @private
     */

  }, {
    key: '_compileShader',
    value: function _compileShader(shaderType, shaderSource) {
      var gl = this._renderer.getContext();

      // Create the shader and compile it
      var shader = gl.createShader(shaderType);
      gl.shaderSource(shader, shaderSource);
      gl.compileShader(shader);

      // Check compilation status
      var compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS);
      if (!compiled) {
        var errorMessage = gl.getShaderInfoLog(shader);
        if (gl.isContextLost()) errorMessage = 'WebGL context lost';
        gl.deleteShader(shader);
        Log.error(this.constructor.name, 'WebGL shader compilation error: ' + errorMessage);
      }

      return shader;
    }

    /**
     * Sets the given uniform to the given value
     * @param {String} name
     * @param {*} value
     * @param {Boolean} sync = false
     */

  }, {
    key: 'setUniform',
    value: function setUniform(name, value) {
      var sync = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

      this._uniforms[name].value = value;
      if (sync) {
        this.syncUniform(name);
      }
    }

    /**
     * Sets the given uniforms to their values
     * @param {Object}  uniforms
     * @param {Boolean} sync = false
     */

  }, {
    key: 'setUniforms',
    value: function setUniforms(uniforms) {
      var sync = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

      for (var name in uniforms) {
        this._uniforms[name].value = uniforms[name];
        if (sync) {
          this.syncUniform(name);
        }
      }
    }

    /**
     * Returns the uniforms
     * @return {Object}
     */

  }, {
    key: 'getUniforms',
    value: function getUniforms() {
      return this._uniforms;
    }

    /**
     * Returns the attributes
     * @return {String[]}
     */

  }, {
    key: 'getAttributes',
    value: function getAttributes() {
      return this._attributes;
    }

    /**
     * Returns the attribute locations
     * @return {Object}
     */

  }, {
    key: 'getAttributeLocations',
    value: function getAttributeLocations() {
      return this._attributeLocations;
    }

    /**
     * Returns this shader's WebGL program
     * @return {WebGLProgram}
     */

  }, {
    key: 'getProgram',
    value: function getProgram() {
      return this._program;
    }

    /**
     * Cleans up this shader
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      var gl = this._renderer.getContext();
      gl.deleteProgram(this._program);

      gl.deleteShader(this._vertexShader);
      gl.deleteShader(this._fragmentShader);

      this._uniforms = null;
      this._uniformLocations = null;
      this._attributes = null;
      this._attributeLocations = null;

      this._renderer.off('context', this._onContextChange);
    }
  }]);

  return Shader;
}();

/* harmony default export */ __webpack_exports__["a"] = (Shader);

/***/ }),
/* 98 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__globals__ = __webpack_require__(9);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



/**
 * The base class for all objects that can be displayed
 * on the screen
 * @class
 * @memberof PhotoEditorSDK.Engine
 */

var DisplayObject = function () {
  /**
   * Creates a DisplayObject
   */
  function DisplayObject() {
    _classCallCheck(this, DisplayObject);

    this._position = new __WEBPACK_IMPORTED_MODULE_1__globals__["k" /* Vector2 */](0, 0);
    this._scale = new __WEBPACK_IMPORTED_MODULE_1__globals__["k" /* Vector2 */](1, 1);
    this._pivot = new __WEBPACK_IMPORTED_MODULE_1__globals__["k" /* Vector2 */](0, 0);
    this._rotation = 0;
    this._lastRotation = null;
    this._alpha = 1;
    this._visible = true;
    this._worldTransform = new __WEBPACK_IMPORTED_MODULE_1__globals__["g" /* Matrix */]();
    this._parent = null;
    this._shaders = [];
    this._boundsNeedUpdate = true;
    this._bounds = new __WEBPACK_IMPORTED_MODULE_1__globals__["h" /* Rectangle */](0, 0, 1, 1);
    this._localBoundsNeedUpdate = true;
    this._localBounds = new __WEBPACK_IMPORTED_MODULE_1__globals__["h" /* Rectangle */](0, 0, 1, 1);
    this._tint = 0xffffff;
    this._filterRectangle = new __WEBPACK_IMPORTED_MODULE_1__globals__["h" /* Rectangle */](0, 0, 0, 0);
  }

  /**
   * Renders this DisplayObject using the given WebGLRenderer
   * @param  {PhotoEditorSDK.Engine.WebGLRenderer} renderer
   * @abstract
   */


  _createClass(DisplayObject, [{
    key: 'renderWebGL',
    value: function renderWebGL(renderer) {
      __WEBPACK_IMPORTED_MODULE_1__globals__["f" /* Log */].warn(this.constructor.name, '`renderWebGL` is abstract and not implemented in inherited class');
    }

    /**
     * Renders this DisplayObject using the given CanvasRenderer
     * @param  {PhotoEditorSDK.Engine.CanvasRenderer} renderer
     * @abstract
     */

  }, {
    key: 'renderCanvas',
    value: function renderCanvas(renderer) {
      __WEBPACK_IMPORTED_MODULE_1__globals__["f" /* Log */].warn(this.constructor.name, '`renderCanvas` is abstract and not implemented in inherited class');
    }

    /**
     * Updates the world transform for this DisplayObject
     */

  }, {
    key: 'updateTransform',
    value: function updateTransform() {
      var parentTransform = this._parent ? this._parent.getWorldTransform() : __WEBPACK_IMPORTED_MODULE_1__globals__["g" /* Matrix */].IDENTITY;
      var worldTransform = this._worldTransform;

      // Only build rotation matrix if rotation has changed since last update
      var rotationChanged = this._rotation !== this._lastRotation;
      if (rotationChanged) {
        this._sinRotation = Math.sin(this._rotation);
        this._cosRotation = Math.cos(this._rotation);
        this._lastRotation = this._rotation;
      }

      worldTransform.a = this._cosRotation * this._scale.x;
      worldTransform.b = this._sinRotation * this._scale.x;
      worldTransform.c = -this._sinRotation * this._scale.y;
      worldTransform.d = this._cosRotation * this._scale.y;
      worldTransform.tx = this._position.x;
      worldTransform.ty = this._position.y;

      if (this._pivot.x || this._pivot.y) {
        worldTransform.tx -= this._pivot.x * worldTransform.a + this._pivot.y * worldTransform.c;
        worldTransform.ty -= this._pivot.x * worldTransform.b + this._pivot.y * worldTransform.d;
      }

      // Floor
      worldTransform.tx |= 0;
      worldTransform.ty |= 0;

      worldTransform.multiply(parentTransform);

      this._boundsNeedUpdate = true;
      this._localBoundsNeedUpdate = true;
    }

    // -------------------------------------------------------------------------- SHADERS

    /**
     * Pushes the given shader to the list of shaders
     * @param {PhotoEditorSDK.Engine.Shader} shader
     */

  }, {
    key: 'addShader',
    value: function addShader(shader) {
      this._shaders.push(shader);
    }

    /**
     * Removes the given shader from the list of shaders
     * @param  {PhotoEditorSDK.Engine.Shader} shader
     * @return {Boolean}
     */

  }, {
    key: 'removeShader',
    value: function removeShader(shader) {
      var index = this._shaders.indexOf(shader);
      if (index !== -1) {
        this._shaders.splice(index, 1);
        return true;
      }
      return false;
    }

    /**
     * Removes the shader at the given index from the list of shaders
     * @param  {Number} index
     * @return {Boolean}
     */

  }, {
    key: 'removeShaderAt',
    value: function removeShaderAt(index) {
      if (!this._shaders[index]) {
        return false;
      }
      this._shaders.splice(index, 1);
      return true;
    }

    /**
     * Returns the bounds for this DisplayObject
     * @return {PhotoEditorSDK.Math.Rectangle}
     */

  }, {
    key: 'getBounds',
    value: function getBounds() {
      return this._bounds.clone();
    }

    // -------------------------------------------------------------------------- GETTERS / SETTERS

    /**
     * Returns the current position
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'getPosition',
    value: function getPosition() {
      return this._position;
    }

    /**
     * Sets the position to the given one
     * @param {PhotoEditorSDK.Math.Vector2|Number} x
     * @param {Number} [y]
     */

  }, {
    key: 'setPosition',
    value: function setPosition(position, y) {
      if (position instanceof __WEBPACK_IMPORTED_MODULE_1__globals__["k" /* Vector2 */]) {
        this._position.copy(position);
      } else {
        this._position.set(position, y);
      }
      this._boundsNeedUpdate = true;
      this._localBoundsNeedUpdate = true;
    }

    /**
     * Returns the current scale
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'getScale',
    value: function getScale() {
      return this._scale;
    }

    /**
     * Sets the scale to the given one
     * @param {PhotoEditorSDK.Math.Vector2|Number} x
     * @param {Number} [y]
     */

  }, {
    key: 'setScale',
    value: function setScale(scale, y) {
      if (scale instanceof __WEBPACK_IMPORTED_MODULE_1__globals__["k" /* Vector2 */]) {
        this._scale.copy(scale);
      } else {
        this._scale.set(scale, y);
      }
      this._boundsNeedUpdate = true;
      this._localBoundsNeedUpdate = true;
    }

    /**
     * Returns the current pivot (The point that this Displayobject rotates around)
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'getPivot',
    value: function getPivot() {
      return this._pivot;
    }

    /**
     * Sets the pivot (The point that this DisplayObject rotates around)
     * @param {PhotoEditorSDK.Math.Vector2|Number} pivot
     * @param {Number} [y]
     */

  }, {
    key: 'setPivot',
    value: function setPivot(pivot, y) {
      if (pivot instanceof __WEBPACK_IMPORTED_MODULE_1__globals__["k" /* Vector2 */]) {
        this._pivot.copy(pivot);
      } else {
        this._pivot.set(pivot, y);
      }
      this._boundsNeedUpdate = true;
      this._localBoundsNeedUpdate = true;
    }

    /**
     * Returns the current rotation in radians
     * @return {Number}
     */

  }, {
    key: 'getRotation',
    value: function getRotation() {
      return this._rotation;
    }

    /**
     * Sets this object's rotation (in radians)
     * @param {Number} rotation
     */

  }, {
    key: 'setRotation',
    value: function setRotation(rotation) {
      this._rotation = rotation;
      this._boundsNeedUpdate = true;
      this._localBoundsNeedUpdate = true;
    }

    /**
     * Returns the current alpha (0...1)
     * @return {Number}
     */

  }, {
    key: 'getAlpha',
    value: function getAlpha() {
      return this._alpha;
    }

    /**
     * Sets the alpha (0...1)
     * @param {Number} alpha
     */

  }, {
    key: 'setAlpha',
    value: function setAlpha(alpha) {
      this._alpha = alpha;
    }

    /**
     * Returns the computed alpha of this DisplayObject
     * @return {Number}
     */

  }, {
    key: 'getWorldAlpha',
    value: function getWorldAlpha() {
      if (this._parent) {
        return this._parent.getAlpha() * this._alpha;
      } else {
        return this._alpha;
      }
    }

    /**
     * Returns the current world transformation matrix
     * @return {PhotoEditorSDK.Math.Matrix}
     */

  }, {
    key: 'getWorldTransform',
    value: function getWorldTransform() {
      return this._worldTransform;
    }

    /**
     * Returns the parent object
     * @return {PhotoEditorSDK.Engine.DisplayObject}
     */

  }, {
    key: 'getParent',
    value: function getParent() {
      return this._parent;
    }

    /**
     * Sets this object's parent object
     * @param {PhotoEditorSDK.Engine.DisplayObject} parent
     */

  }, {
    key: 'setParent',
    value: function setParent(parent) {
      this._parent = parent;
    }

    /**
     * Returns the filter rectangle
     * @return {PhotoEditorSDK.Math.Rectangle} rectangle
     */

  }, {
    key: 'getFilterRectangle',
    value: function getFilterRectangle() {
      return this._filterRectangle;
    }

    /**
     * Sets the filter rectangle
     * @param {PhotoEditorSDK.Math.Rectangle} rectangle
     */

  }, {
    key: 'setFilterRectangle',
    value: function setFilterRectangle(rectangle) {
      this._filterRectangle.copy(rectangle);
    }

    /**
     * Returns the current tint color
     * @return {Number}
     */

  }, {
    key: 'getTint',
    value: function getTint() {
      return this._tint;
    }

    /**
     * Sets the tint color
     * @param {Number} tint
     */

  }, {
    key: 'setTint',
    value: function setTint(tint) {
      this._tint = tint;
    }

    /**
     * Checks whether this object is currently visible
     * @return {Boolean} [description]
     */

  }, {
    key: 'isVisible',
    value: function isVisible() {
      return this._visible;
    }

    /**
     * Sets this object's visibility
     * @param {Boolean} visible
     */

  }, {
    key: 'setVisible',
    value: function setVisible(visible) {
      this._visible = visible;
    }
  }]);

  return DisplayObject;
}();

/* harmony default export */ __webpack_exports__["a"] = (DisplayObject);

/***/ }),
/* 99 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__globals__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_webgl_render_target__ = __webpack_require__(73);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_quad__ = __webpack_require__(219);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */





var RendererType = __WEBPACK_IMPORTED_MODULE_1__globals__["c" /* Constants */].RendererType;

/**
 * Manages the filters for a {@link PhotoEditorSDK.Engine.WebGLRenderer}
 * @class
 * @memberof PhotoEditorSDK.Engine
 */
/* istanbul ignore next */

var WebGLFilterManager = function () {
  function WebGLFilterManager(renderer) {
    _classCallCheck(this, WebGLFilterManager);

    this._renderer = renderer;
    this._filterStack = [{
      filters: []
    }];

    this._currentFrame = null;
    this._renderTargets = [];
    this._textureFrame = new __WEBPACK_IMPORTED_MODULE_1__globals__["h" /* Rectangle */](0, 0, renderer.getWidth(), renderer.getHeight());

    this._onContextChange = this._onContextChange.bind(this);
    this._renderer.on('context', this._onContextChange);

    // Initial context
    this._onContextChange();
  }

  /**
   * Resizes this FilterManager and its textures to the given dimensions
   * @param  {PhotoEditorSDK.Math.Vector2} dimensions
   */


  _createClass(WebGLFilterManager, [{
    key: 'resizeTo',
    value: function resizeTo(dimensions) {
      this._textureFrame.width = dimensions.x;
      this._textureFrame.height = dimensions.y;

      this._renderTargets.forEach(function (texture) {
        return texture.resizeTo(dimensions);
      });
    }

    /**
     * Returns the filter stack
     * @return {Object[]}
     */

  }, {
    key: 'getFilterStack',
    value: function getFilterStack() {
      return this._filterStack;
    }

    /**
     * Sets the filter stack to the given stack
     * @param {Object[]} filterStack
     */

  }, {
    key: 'setFilterStack',
    value: function setFilterStack(filterStack) {
      this._filterStack = filterStack;
    }

    /**
     * Returns a render target from the pool or creates a new one
     * @param  {Boolean} clear
     * @return {PhotoEditorSDK.Engine.WebGLRenderTarget}
     * @private
     */

  }, {
    key: '_getOrCreateRenderTarget',
    value: function _getOrCreateRenderTarget(clear) {
      var renderTarget = this._renderTargets.pop();
      if (!renderTarget) {
        renderTarget = new __WEBPACK_IMPORTED_MODULE_2__utils_webgl_render_target__["a" /* default */](this._renderer, this._textureFrame.width, this._textureFrame.height, 1);
      }
      renderTarget.setFrame(this._currentFrame);

      if (clear) {
        renderTarget.clear();
      }

      return renderTarget;
    }

    /**
     * Pushes the given filters to the
     * @param  {PhotoEditorSDK.Engine.DisplayObject} displayObject
     * @param  {PhotoEditorSDK.Engine.Filter[]} filters
     */

  }, {
    key: 'pushFilters',
    value: function pushFilters(displayObject, filters) {
      var bounds = displayObject.getBounds();
      this._currentFrame = bounds;

      var filterRectangle = displayObject.getFilterRectangle();
      if (filterRectangle.width > 0 && filterRectangle.height > 0) {
        this._currentFrame = filterRectangle;
      }

      var renderTarget = this._getOrCreateRenderTarget();
      this._renderer.setRenderTarget(renderTarget);
      renderTarget.clear();

      this._filterStack.push({ renderTarget: renderTarget, filters: filters });
    }

    /**
     * Removes, applies and returns the last filters from the stack
     * @return {Object}
     */

  }, {
    key: 'popFilters',
    value: function popFilters() {
      var _filterStack$pop = this._filterStack.pop(),
          filters = _filterStack$pop.filters,
          renderTarget = _filterStack$pop.renderTarget;

      var lastFilter = this._filterStack[this._filterStack.length - 1];

      var inputRenderTarget = renderTarget;
      var outputRenderTarget = lastFilter.renderTarget;

      // Update the Quad's buffers
      this._quad.map(this._textureFrame, inputRenderTarget.getFrame());

      var shader = filters[0].getShaderForRenderer(this._renderer);
      var vertexBuffer = this._quad.getVertexBuffer();
      var indexBuffer = this._quad.getIndexBuffer();

      var gl = this._renderer.getContext();
      gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
      gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer);

      var attributeLocations = shader.getAttributeLocations();
      gl.vertexAttribPointer(attributeLocations.a_position, 2, gl.FLOAT, false, 0, 0);
      gl.vertexAttribPointer(attributeLocations.a_texCoord, 2, gl.FLOAT, false, 0, 2 * 4 * 4);
      gl.vertexAttribPointer(attributeLocations.a_color, 4, gl.FLOAT, false, 0, 4 * 4 * 4);

      this._renderer.updateTexture(inputRenderTarget.getBaseTexture(), false);

      if (filters.length === 1) {
        filters[0].apply(this._renderer, inputRenderTarget, outputRenderTarget);
        this._renderTargets.push(inputRenderTarget);
      } else {
        this._applyFilters(filters, inputRenderTarget, outputRenderTarget);
      }

      return filters;
    }

    /**
     * Applies the given filters to the given inputRenderTarget and outputs
     * the filtered content to the outputRenderTarget
     * @param  {PhotoEditorSDK.Engine.Filter[]} filters
     * @param  {PhotoEditorSDK.Engine.WebGLRenderTarget} inputRenderTarget
     * @param  {PhotoEditorSDK.Engine.WebGLRenderTarget} outputRenderTarget
     */

  }, {
    key: '_applyFilters',
    value: function _applyFilters(filters, inputRenderTarget, outputRenderTarget) {
      var _this = this;

      var flipRenderTarget = inputRenderTarget;
      var flopRenderTarget = this._getOrCreateRenderTarget(true);

      this._renderer.updateTexture(flopRenderTarget.getBaseTexture(), false);

      var lastFilter = filters[filters.length - 1];
      filters.forEach(function (filter, i) {
        var isLastFilter = filter === lastFilter;

        if (!isLastFilter) {
          // Render from flip to flop with filter
          filter.apply(_this._renderer, flipRenderTarget, flopRenderTarget);

          // Flip the render targets
          var temp = flipRenderTarget;
          flipRenderTarget = flopRenderTarget;
          flopRenderTarget = temp;
        } else {
          // Render to output
          filter.apply(_this._renderer, flipRenderTarget, outputRenderTarget);
        }
      });

      // Push the textures back into the texture pool to use them again later
      this._renderTargets.push(flipRenderTarget);
      this._renderTargets.push(flopRenderTarget);
    }

    /**
     * Gets called when the WebGL context has been changed
     * @private
     */

  }, {
    key: '_onContextChange',
    value: function _onContextChange() {
      this._renderTargets.length = 0;
      /* istanbul ignore next */
      if (this._renderer.isOfType(RendererType.WEBGL)) {
        if (this._quad) {
          this._quad.dispose();
        }
        this._quad = new __WEBPACK_IMPORTED_MODULE_3__utils_quad__["a" /* default */](this._renderer);
      }
    }

    /**
     * Disposes this WebGLFilterManager
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      this._renderer.off('context', this._onContextChange);
      if (this._quad) {
        this._quad.dispose();
      }
      this._renderTargets.forEach(function (target) {
        target.dispose();
      });
    }
  }]);

  return WebGLFilterManager;
}();

/* harmony default export */ __webpack_exports__["a"] = (WebGLFilterManager);

/***/ }),
/* 100 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__base64__ = __webpack_require__(50);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__array_stream__ = __webpack_require__(101);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils__ = __webpack_require__(22);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__jpeg_constants__ = __webpack_require__(102);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__jpeg_jfif_data__ = __webpack_require__(251);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__jpeg_exif_data__ = __webpack_require__(252);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/*
 * Based on https://github.com/exif-js/exif-js by Jacob Seidelin
 * Licensed under MIT
 * @license
 */

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */








var invariant = __WEBPACK_IMPORTED_MODULE_3__utils__["a" /* default */].invariant;
var MARKERS = __WEBPACK_IMPORTED_MODULE_4__jpeg_constants__["a" /* default */].MARKERS;


var DATA_JPEG_PREFIX = 'data:image/jpeg;base64,';
var JPEG_REGEX = new RegExp('^' + DATA_JPEG_PREFIX, 'i');

/**
 * Reads EXIF tags from the given byte array and restores them
 * @class
 * @memberof PhotoEditorSDK
 * @ignore
 */

var EXIF = function () {
  /**
   * Creates an EXIF object
   * @param  {Array} buf
   */
  function EXIF(buf) {
    _classCallCheck(this, EXIF);

    this._buf = buf;
    this._stream = new __WEBPACK_IMPORTED_MODULE_2__array_stream__["a" /* default */](this._buf);
    this._stream.setHead(0);

    this._segments = this._sliceIntoSegments(this._buf);

    this._exifData = new __WEBPACK_IMPORTED_MODULE_6__jpeg_exif_data__["a" /* default */](this._getMarkerBuffer(MARKERS.EXIF));
    this._jfifData = new __WEBPACK_IMPORTED_MODULE_5__jpeg_jfif_data__["a" /* default */](this._getMarkerBuffer(MARKERS.JFIF));
  }

  /**
   * Convert raw data buffer to base64 encoded data url
   * @param {Uint8Array}
   * @returns {String}
   */


  _createClass(EXIF, [{
    key: 'restoreSegments',


    /**
     * Restores the header segments into the given data url
     * @return {string} data
     */
    value: function restoreSegments(base64String) {
      var data = EXIF.fromDataURL(base64String);
      data = this.restoreExifTagsToImageData(data);
      data = this.restoreJfifSegmentToImageData(data);
      return EXIF.toDataURL(data);
    }

    /**
     * Restores the exif tags into the given data url
     * @return {Uint8Array} data
     */

  }, {
    key: 'restoreExifTagsToImageData',
    value: function restoreExifTagsToImageData(data) {
      if (!this._exifData.isValid()) {
        return data;
      }
      var segments = this._sliceIntoSegments(data);
      var segmentStart = segments[1][0];
      var dataBefore = data.slice(0, segmentStart);
      var dataAfter = data.slice(segmentStart);
      var newData = dataBefore.concat(this._exifData.getBuffer()); // copy exifdata
      newData = newData.concat(dataAfter);
      return newData;
    }

    /**
     * Restores the JFIF Header data into the given data url
     * @return {Uint8Array} base64String
     */

  }, {
    key: 'restoreJfifSegmentToImageData',
    value: function restoreJfifSegmentToImageData(data) {
      if (!this._jfifData.isValid()) {
        return data;
      }
      // First, make the given string a data array
      var segments = this._sliceIntoSegments(data);

      var segment = this._findSegment(MARKERS.JFIF, segments);
      invariant(segment, 'JFIF Data Error: Segment not found');

      // we have one and just need to update it
      var offset = segment[0];
      var end = segment[1];
      var dataBefore = data.slice(0, offset);
      var dataBuf = data.slice(offset, end);
      var dataAfter = data.slice(end);

      var jfifData = new __WEBPACK_IMPORTED_MODULE_5__jpeg_jfif_data__["a" /* default */](dataBuf);
      jfifData.setDensityX(this._jfifData.getDensityX());
      jfifData.setDensityY(this._jfifData.getDensityY());
      jfifData.setUnitDensity(this._jfifData.getUnitDensity());

      // update DataBuf
      var newData = dataBefore.concat(dataBuf);
      newData = newData.concat(dataAfter);
      return newData;
    }

    /**
     * Restores the exif tags into the given data url
     * @return {String} base64String
     */

  }, {
    key: 'restoreExifTags',
    value: function restoreExifTags(base64String) {
      // First, make the given string a data array
      var data = EXIF.fromDataURL(base64String);
      var newData = this.restoreExifTagsToImageData(data);
      return EXIF.toDataURL(newData);
    }

    /**
     * Restores the JFIF Header data into the given data url
     * @return {String} base64String
     */

  }, {
    key: 'restoreJfifSegment',
    value: function restoreJfifSegment(base64String) {
      if (!this._jfifData.isValid()) {
        return base64String;
      }
      var data = EXIF.fromDataURL(base64String);
      var newData = this.restoreJfifSegmentToImageData(data);
      return EXIF.toDataURL(newData);
    }

    /**
     * Overwrites the orientation with the given 16 bit integer
     * @param {Number} orientation
     */

  }, {
    key: 'setOrientation',
    value: function setOrientation(orientation) {
      return this._exifData.setOrientation(orientation);
    }

    /**
     * Checks whether the given base64 data url is a jpeg image
     * @param  {String}  base64String
     * @return {Boolean}
     */

  }, {
    key: '_findSegment',


    /**
     *
     * @param {String} identifier
     * @param {Object[]} segments
     */
    value: function _findSegment(identifier) {
      var segments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this._segments;

      for (var i = 0; i < segments.length; i++) {
        var offset = segments[i][0];
        var end = segments[i][1];
        this._stream.setHead(offset);
        var marker = this._stream.peekInt16();
        if (marker === identifier) {
          return [offset, end];
        }
      }
      return false;
    }

    /**
     * Returns a new buffer containing the Exif segment
     * @return {Array}
     * @private
     */

  }, {
    key: '_getMarkerBuffer',
    value: function _getMarkerBuffer(identifier) {
      var segments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this._segments;

      var segment = this._findSegment(identifier, segments);
      if (segment) {
        var offset = segment[0];
        var end = segment[1];
        return this._buf.slice(offset, end);
      }
      return false;
    }

    /**
     * Slices the array into segments
     * @param  {Array.<Number>} buf
     * @return {Array}
     * @private
     */

  }, {
    key: '_sliceIntoSegments',
    value: function _sliceIntoSegments(buf) {
      var stream = new __WEBPACK_IMPORTED_MODULE_2__array_stream__["a" /* default */](buf);
      var segments = [];
      while (stream.getHead() < buf.length) {
        var marker = stream.readInt16();
        if (marker === MARKERS.SOI) {
          continue;
        } // SOI
        if (marker === MARKERS.SOS) {
          break;
        } // SOS Marker

        if (marker >= 0xff00 && marker <= 0xffff) {
          // Marker (FF-XX-HL-LL)
          var length = stream.readInt16();
          var end = stream.getHead() + length - 2;
          segments.push([stream.getHead() - 4, end]);
          stream.setHead(end);
        } else {
          throw new Error('Invalid marker: 0x' + marker.toString(16));
        }
      }

      this._stream.setHead(0);

      return segments;
    }

    /**
     * Returns the tags
     * @return {Object}
     */

  }, {
    key: 'getTags',
    value: function getTags() {
      return this._exifData.getTags();
    }

    /**
     * Returns the tag data (key, value, byte position etc.)
     * @return {Object[]}
     */

  }, {
    key: 'getTagData',
    value: function getTagData() {
      return this._exifData.getTagData();
    }

    /**
     * Disposes this EXIF object
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      this._buf = [];
      this._segments = [];
    }
  }], [{
    key: 'toDataURL',
    value: function toDataURL(data) {
      return DATA_JPEG_PREFIX + __WEBPACK_IMPORTED_MODULE_1__base64__["a" /* default */].encode(data);
    }

    /**
     * Convert base64 encoded data url to raw binary data
     * @param {String} dataURL
     * @returns {Uint8Array}
     */

  }, {
    key: 'fromDataURL',
    value: function fromDataURL(dataURL) {
      var raw = dataURL.replace(DATA_JPEG_PREFIX, '');
      var data = __WEBPACK_IMPORTED_MODULE_1__base64__["a" /* default */].decode(raw);
      return data;
    }
  }, {
    key: 'isJPEG',
    value: function isJPEG(base64String) {
      return JPEG_REGEX.test(base64String);
    }

    /**
     * Checks whether the given buffer is a JPEG image
     * @param  {Buffer} data
     * @return {Boolean}
     */

  }, {
    key: 'bufferIsJPEG',
    value: function bufferIsJPEG(data) {
      return data.slice(6, 10).toString() === 'JFIF';
    }

    /**
     * Creates a new instance of Exif from the given base64-encoded
     * string
     * @param  {String} base64String
     * @return {PhotoEditorSDK.Exif}
     */

  }, {
    key: 'fromBase64String',
    value: function fromBase64String(base64String) {
      var raw = base64String.replace(DATA_JPEG_PREFIX, '');
      var data = __WEBPACK_IMPORTED_MODULE_1__base64__["a" /* default */].decode(raw);
      return new EXIF(data);
    }
  }]);

  return EXIF;
}();

/* harmony default export */ __webpack_exports__["a"] = (EXIF);

/***/ }),
/* 101 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */

/**
 * An ArrayStream provides methods for working with a byte array
 * @class
 * @memberof PhotoEditorSDK
 * @ignore
 */
/* istanbul ignore next */
var ArrayStream = function () {
  /**
   * Creates an ArrayStream
   * @param  {Array} buf
   */
  function ArrayStream(buf) {
    _classCallCheck(this, ArrayStream);

    this._head = 0;
    this._buf = buf;
  }

  /**
   * Returns the value of the following 8 bit integer
   * @return {Number}
   */


  _createClass(ArrayStream, [{
    key: 'peekInt8',
    value: function peekInt8() {
      return this._buf[this._head];
    }

    /**
     * Returns the value of the following 16 bit integer
     * @param  {Boolean} [littleEndian = false]
     * @return {Number}
     */

  }, {
    key: 'peekInt16',
    value: function peekInt16() {
      var littleEndian = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;

      var a = this._buf[this._head];
      var b = this._buf[this._head + 1];
      if (!littleEndian) {
        return (a << 8) + b;
      } else {
        return (b << 8) + a;
      }
    }

    /**
     * Returns the value of the following 24 bit integer
     * @param  {Boolean} [littleEndian = false]
     * @return {Number}
     */

  }, {
    key: 'peekInt24',
    value: function peekInt24() {
      var littleEndian = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;

      var a = this._buf[this._head];
      var b = this._buf[this._head + 1];
      var c = this._buf[this._head + 2];
      if (!littleEndian) {
        return (a << 16) + (b << 8) + c;
      } else {
        return (c << 16) + (b << 8) + a;
      }
    }

    /**
     * Returns the value of the following 32 bit integer
     * @param  {Boolean} [littleEndian = false]
     * @return {Number}
     */

  }, {
    key: 'peekInt32',
    value: function peekInt32() {
      var littleEndian = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;

      var a = this._buf[this._head];
      var b = this._buf[this._head + 1];
      var c = this._buf[this._head + 2];
      var d = this._buf[this._head + 3];
      if (!littleEndian) {
        return (a << 32) + (b << 16) + (c << 8) + d;
      } else {
        return (d << 32) + (c << 16) + (b << 8) + a;
      }
    }

    /**
     * Writes the given 16 bit integer at the current head position
     * @param  {Number} num
     */

  }, {
    key: 'writeInt8',
    value: function writeInt8(num) {
      this._buf[this._head] = num & 0xff;
    }
    /**
     * Writes the given 16 bit integer at the current head position
     * @param  {Number} num
     */

  }, {
    key: 'writeInt16',
    value: function writeInt16(num) {
      this._buf[this._head] = num >> 8; // upper
      this._buf[this._head + 1] = num & 0xff; // lower
    }

    /**
     * Returns the value of the following 8 bit integer and moves the head by 1 byte
     * @return {Number}
     */

  }, {
    key: 'readInt8',
    value: function readInt8() {
      var num = this.peekInt8();
      this._head += 1;
      return num;
    }

    /**
     * Returns the value of the following 16 bit integer and moves the head by 2 bytes
     * @param  {Boolean} [littleEndian = false]
     * @return {Number}
     */

  }, {
    key: 'readInt16',
    value: function readInt16() {
      var littleEndian = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;

      var num = this.peekInt16(littleEndian);
      this._head += 2;
      return num;
    }

    /**
     * Returns the value of the following 24 bit integer and moves the head by 3 bytes
     * @param  {Boolean} [littleEndian = false]
     * @return {Number}
     */

  }, {
    key: 'readInt24',
    value: function readInt24() {
      var littleEndian = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;

      var num = this.peekInt24(littleEndian);
      this._head += 3;
      return num;
    }

    /**
     * Returns the value of the following 32 bit integer and moves the head by 4 bytes
     * @param  {Boolean} [littleEndian = false]
     * @return {Number}
     */

  }, {
    key: 'readInt32',
    value: function readInt32() {
      var littleEndian = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;

      var num = this.peekInt32(littleEndian);
      this._head += 4;
      return num;
    }

    /**
     * Reads a string with the given length
     * @param  {Number} length
     * @return {String}
     */

  }, {
    key: 'readString',
    value: function readString(length) {
      var str = '';
      for (var i = 0; i < length; i++) {
        var character = this.readInt8();
        str += String.fromCharCode(character);
      }
      return str;
    }

    /**
     * Returns the current head position
     * @return {Number}
     */

  }, {
    key: 'getHead',
    value: function getHead() {
      return this._head;
    }

    /**
     * Sets the head position
     * @param {Number} head
     */

  }, {
    key: 'setHead',
    value: function setHead(head) {
      this._head = head;
    }
  }]);

  return ArrayStream;
}();

/* harmony default export */ __webpack_exports__["a"] = (ArrayStream);

/***/ }),
/* 102 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */

/**
 * http://vip.sugovica.hu/Sardi/kepnezo/JPEG%20File%20Layout%20and%20Format.htm
 */

var MARKERS = {
  SOI: 0xffd8,
  SOS: 0xffda,
  APP0: 0xffe0,
  APP1: 0xffe1,
  JFIF: 0xffe0,
  EXIF: 0xffe1
};

var EXIF_TAGS = {
  0x0100: 'ImageWidth',
  0x0101: 'ImageHeight',
  0x8769: 'ExifIFDPointer',
  0x8825: 'GPSInfoIFDPointer',
  0xA005: 'InteroperabilityIFDPointer',
  0x0102: 'BitsPerSample',
  0x0103: 'Compression',
  0x0106: 'PhotometricInterpretation',
  0x0112: 'Orientation',
  0x0115: 'SamplesPerPixel',
  0x011C: 'PlanarConfiguration',
  0x0212: 'YCbCrSubSampling',
  0x0213: 'YCbCrPositioning',
  0x011A: 'XResolution',
  0x011B: 'YResolution',
  0x0128: 'ResolutionUnit',
  0x0111: 'StripOffsets',
  0x0116: 'RowsPerStrip',
  0x0117: 'StripByteCounts',
  0x0201: 'JPEGInterchangeFormat',
  0x0202: 'JPEGInterchangeFormatLength',
  0x012D: 'TransferFunction',
  0x013E: 'WhitePoint',
  0x013F: 'PrimaryChromaticities',
  0x0211: 'YCbCrCoefficients',
  0x0214: 'ReferenceBlackWhite',
  0x0132: 'DateTime',
  0x010E: 'ImageDescription',
  0x010F: 'Make',
  0x0110: 'Model',
  0x0131: 'Software',
  0x013B: 'Artist',
  0x8298: 'Copyright'
};

/* harmony default export */ __webpack_exports__["a"] = ({
  MARKERS: MARKERS,
  EXIF_TAGS: EXIF_TAGS
});

/***/ }),
/* 103 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignBanderole; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__ = __webpack_require__(17);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



var TextDesignBanderole = function (_Configurable) {
  _inherits(TextDesignBanderole, _Configurable);

  function TextDesignBanderole() {
    _classCallCheck(this, TextDesignBanderole);

    return _possibleConstructorReturn(this, (TextDesignBanderole.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignBanderole)).apply(this, arguments));
  }

  _createClass(TextDesignBanderole, [{
    key: 'insetsForWidth',
    value: function insetsForWidth(width) {
      return this.getRelativeInsets().clone().scale(width);
    }
  }], [{
    key: 'Small',
    get: function get() {
      return new TextDesignBanderole({
        imagePath: 'text-design/images/imgly_text_design_asset_banderole_small.png',
        fontIdentifier: 'imgly_font_campton_bold',
        relativeInsets: new __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__["a" /* RectangleInsets */](0.05, 0.2, 0.05, 0.2)
      });
    }
  }, {
    key: 'Rectangle',
    get: function get() {
      return new TextDesignBanderole({
        imagePath: 'text-design/images/imgly_text_design_asset_black_background.png',
        fontIdentifier: 'imgly_font_campton_bold',
        relativeInsets: new __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__["a" /* RectangleInsets */](0.05, 0.05, 0.05, 0.05),
        needsImageSmoothingFix: true
      });
    }
  }, {
    key: 'Celebrate1',
    get: function get() {
      return new TextDesignBanderole({
        imagePath: 'text-design/images/imgly_text_design_asset_celebrate_01.png',
        fontIdentifier: 'imgly_font_rasa_500',
        relativeInsets: new __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__["a" /* RectangleInsets */](0.05, 0.2, 0.05, 0.2)
      });
    }
  }, {
    key: 'Celebrate2',
    get: function get() {
      return new TextDesignBanderole({
        imagePath: 'text-design/images/imgly_text_design_asset_celebrate_02.png',
        fontIdentifier: 'imgly_font_rasa_500',
        relativeInsets: new __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__["a" /* RectangleInsets */](0.05, 0.2, 0.05, 0.2)
      });
    }
  }]);

  return TextDesignBanderole;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Configurable"]);

TextDesignBanderole.prototype.availableOptions = {
  image: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].IMAGE, default: null },
  imagePath: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].STRING, default: null },
  relativeInsets: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].OBJECT, default: new __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__["a" /* RectangleInsets */]() },
  fontIdentifier: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].STRING, default: 'imgly_font_open_sans_bold' },
  needsImageSmoothingFix: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].BOOLEAN, default: false }
};

/***/ }),
/* 104 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignRowMasked; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__rectangle_insets__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__default_text_design_row_single__ = __webpack_require__(19);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_canvas__ = __webpack_require__(34);







var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */






var TextDesignRowMasked = function (_TextDesignRowSingle) {
  _inherits(TextDesignRowMasked, _TextDesignRowSingle);

  function TextDesignRowMasked() {
    _classCallCheck(this, TextDesignRowMasked);

    return _possibleConstructorReturn(this, (TextDesignRowMasked.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignRowMasked)).apply(this, arguments));
  }

  _createClass(TextDesignRowMasked, [{
    key: '_getTextColor',
    value: function _getTextColor() {
      if (this.getAutoAdjustTextColor() && !this.getIsMasked()) {
        if (this.getBackgroundColor().equals(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Color"].WHITE)) {
          return __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Color"].BLACK;
        } else {
          return __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Color"].WHITE;
        }
      }

      return this.getAttributes().getTextColor().clone();
    }
  }, {
    key: '_getTextFrame',
    value: function _getTextFrame() {
      return this.getImageInsets().applyToRectangle(this._getFrame());
    }
  }, {
    key: '_getTextFrameForElement',
    value: function _getTextFrameForElement(element) {
      var frame = _get(TextDesignRowMasked.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignRowMasked.prototype), '_getTextFrameForElement', this).call(this, element);
      var imageInsets = this.getImageInsets();

      if (this.getIsMasked() || this.getIsUsedInInvertedLayout()) {
        frame.y -= imageInsets.top;
      }

      return frame;
    }
  }, {
    key: 'willRender',
    value: function willRender(context) {
      // If needed, disable smoothing on server

      var attributes = this.getAttributes();
      attributes.setTextColor(this._getTextColor());

      var image = this.getImage();

      if (image) {
        var capInsets = this.getCapInsets();
        var frame = this._getFrame();

        if (capInsets && !capInsets.equals(__WEBPACK_IMPORTED_MODULE_7__rectangle_insets__["a" /* RectangleInsets */].ZERO)) {
          Object(__WEBPACK_IMPORTED_MODULE_9__utils_canvas__["b" /* drawImageWithCapInsets */])(context, image, frame, capInsets);
        } else {
          context.drawImage(image, frame.x, frame.y, frame.width, frame.height);
        }

        Object(__WEBPACK_IMPORTED_MODULE_9__utils_canvas__["c" /* fillRect */])(context, frame, this.getBackgroundColor(), 'source-atop');
      }

      if ((this.getIsMasked() || this.getIsUsedInInvertedLayout()) && image) {
        context.save();
        context.globalCompositeOperation = 'destination-out';
      }
    }
  }, {
    key: 'didRender',
    value: function didRender(context) {
      _get(TextDesignRowMasked.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignRowMasked.prototype), 'didRender', this).call(this, context);

      if (this.getIsMasked() || this.getIsUsedInInvertedLayout()) {
        context.restore();
      }
    }
  }]);

  return TextDesignRowMasked;
}(__WEBPACK_IMPORTED_MODULE_8__default_text_design_row_single__["a" /* TextDesignRowSingle */]);

TextDesignRowMasked.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_8__default_text_design_row_single__["a" /* TextDesignRowSingle */].prototype.availableOptions, {
  image: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].IMAGE, default: null },
  capInsets: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].OBJECT, default: new __WEBPACK_IMPORTED_MODULE_7__rectangle_insets__["a" /* RectangleInsets */]() },
  backgroundColor: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].COLOR, default: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Color"].WHITE },
  autoAdjustTextColor: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].BOOLEAN, default: true },
  isMasked: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].BOOLEAN, default: true },
  isUsedInInvertedLayout: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].BOOLEAN, default: false }
});

/***/ }),
/* 105 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignRowImage; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__default_text_design_row_single__ = __webpack_require__(19);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__text_text_design_font__ = __webpack_require__(60);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__text_design_element__ = __webpack_require__(43);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__size_value__ = __webpack_require__(23);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__utils_canvas__ = __webpack_require__(34);







var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */








var Rectangle = __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Math"].Rectangle;


var TextDesignRowImage = function (_TextDesignRowSingle) {
  _inherits(TextDesignRowImage, _TextDesignRowSingle);

  function TextDesignRowImage() {
    _classCallCheck(this, TextDesignRowImage);

    return _possibleConstructorReturn(this, (TextDesignRowImage.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignRowImage)).apply(this, arguments));
  }

  _createClass(TextDesignRowImage, [{
    key: 'getImageSize',
    value: function getImageSize() {
      var leftImage = this.getLeftImage();
      var rightImage = this.getRightImage();
      var words = this.getWords();
      var attributes = this.getAttributes();
      var fontIdentifier = attributes.getFontIdentifier();

      var imageSize = leftImage ? new __WEBPACK_IMPORTED_MODULE_10__size_value__["a" /* SizeValue */](leftImage.width, leftImage.height) : new __WEBPACK_IMPORTED_MODULE_10__size_value__["a" /* SizeValue */]();
      var text = words.joined(1)[0];

      if (!text) {
        return imageSize;
      }

      var font = new __WEBPACK_IMPORTED_MODULE_8__text_text_design_font__["a" /* TextDesignFont */]({ text: text, fontIdentifier: fontIdentifier, fontSize: 50 });
      var textSize = font.getSizeValue();

      var imageCount = rightImage ? 2 : 1;
      imageSize.scale(imageCount, 1);

      var newImageSize = imageSize.clone().fitInWidthWithOther(this._getFrame().width, textSize);

      newImageSize.scale(1 / imageCount, 1);

      return newImageSize;
    }
  }, {
    key: '_getTextFrame',
    value: function _getTextFrame() {
      var textFrame = _get(TextDesignRowImage.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignRowImage.prototype), '_getTextFrame', this).call(this).clone();
      var imageSize = this.getImageSize();
      var rightImage = this.getRightImage();
      var imagePosition = this.getImagePosition();

      if (!rightImage) {
        if (imagePosition === TextDesignRowImage.ImagePosition.Left) {
          textFrame.x += imageSize.width;
        }
      } else {
        textFrame.x += imageSize.width;
        textFrame.width -= 2 * imageSize.width;
      }
      return textFrame;
    }
  }, {
    key: '_calculateLayoutElements',
    value: function _calculateLayoutElements() {
      var elements = _get(TextDesignRowImage.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignRowImage.prototype), '_calculateLayoutElements', this).call(this);
      var frame = this._getFrame();
      var rightImage = this.getRightImage();
      var imageSize = this.getImageSize();
      var imagePosition = this.getImagePosition();
      var textFrame = this._getTextFrame();
      var attributes = this.getAttributes();
      var fontIdentifier = attributes.getFontIdentifier();

      var font = new __WEBPACK_IMPORTED_MODULE_8__text_text_design_font__["a" /* TextDesignFont */]({ text: 'stickerClock', fontIdentifier: fontIdentifier });
      font.fitWidth(this._getTextFrame().width);

      var leftImageRect = new Rectangle().set(frame.x, frame.y, imageSize.width, imageSize.height);

      if (!rightImage && imagePosition === TextDesignRowImage.ImagePosition.Right) {
        leftImageRect.x += textFrame.width;
      }

      elements.push(new __WEBPACK_IMPORTED_MODULE_9__text_design_element__["a" /* TextDesignElement */]({ text: 'stickerClock', frame: leftImageRect, font: font }));

      if (rightImage) {
        var firstElement = elements[0];

        if (firstElement) {
          var rightImageRect = leftImageRect.clone();
          rightImageRect.translate(firstElement.getFrame().width + rightImageRect.width, 0);
          elements.push(new __WEBPACK_IMPORTED_MODULE_9__text_design_element__["a" /* TextDesignElement */]({ text: 'stickerClock', frame: rightImageRect, font: font }));
        }
      }

      return elements;
    }
  }, {
    key: 'render',
    value: function render(context) {
      var elements = this._getLayoutElements();
      var attributes = this.getAttributes();
      var textColor = attributes.getTextColor();
      var leftImage = this.getLeftImage();
      var rightImage = this.getRightImage();

      var layoutElement = elements[0];
      var secondElement = elements[1];

      var _layoutElement$serial = layoutElement.serializeOptions(),
          font = _layoutElement$serial.font;

      var textFrame = this._getTextFrameForElement(layoutElement);

      font.draw(context, textFrame.x, textFrame.y, {
        textColor: attributes.getTextColor().toRGBA(),
        alignment: attributes.getAlignment()
      });

      if (leftImage) {
        var dest = secondElement.getFrame();
        context.drawImage(leftImage, dest.x, dest.y, dest.width, dest.height);
        Object(__WEBPACK_IMPORTED_MODULE_11__utils_canvas__["c" /* fillRect */])(context, dest, textColor, 'source-atop');
      }

      if (elements.length > 2) {
        var rightElement = elements[2];
        var rightElementFrame = rightElement.getFrame().clone();

        context.drawImage(rightImage, rightElementFrame.x, rightElementFrame.y, rightElementFrame.width, rightElementFrame.height);
        Object(__WEBPACK_IMPORTED_MODULE_11__utils_canvas__["c" /* fillRect */])(context, rightElementFrame, textColor, 'source-atop');
      }
    }
  }]);

  return TextDesignRowImage;
}(__WEBPACK_IMPORTED_MODULE_7__default_text_design_row_single__["a" /* TextDesignRowSingle */]);

TextDesignRowImage.ImagePosition = {
  Left: 'LEFT',
  right: 'RIGHT'
};
TextDesignRowImage.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_7__default_text_design_row_single__["a" /* TextDesignRowSingle */].prototype.availableOptions, {
  leftImage: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].IMAGE, default: null },
  rightImage: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].IMAGE, default: null },
  imagePosition: {
    type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].STRING,
    default: TextDesignRowImage.ImagePosition.Left,
    available: [TextDesignRowImage.ImagePosition.Left, TextDesignRowImage.ImagePosition.Right]
  }
});

/***/ }),
/* 106 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignRowMultiline; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__text_design_row_masked__ = __webpack_require__(104);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__text_design_element__ = __webpack_require__(43);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__text_text_design_font__ = __webpack_require__(60);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__text_text_renderer__ = __webpack_require__(150);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__text_text_design_font_multiline__ = __webpack_require__(365);






var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */








var TextDesignRowMultiline = function (_TextDesignRowMasked) {
  _inherits(TextDesignRowMultiline, _TextDesignRowMasked);

  function TextDesignRowMultiline() {
    _classCallCheck(this, TextDesignRowMultiline);

    return _possibleConstructorReturn(this, (TextDesignRowMultiline.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignRowMultiline)).apply(this, arguments));
  }

  _createClass(TextDesignRowMultiline, [{
    key: '_calculateLayoutElements',
    value: function _calculateLayoutElements() {
      var words = this.getWords();
      var textFrame = this._getTextFrame();
      var attributes = this.getAttributes();
      var fontIdentifier = attributes.getFontIdentifier();
      var imageInsets = this.getImageInsets();

      var font = new __WEBPACK_IMPORTED_MODULE_8__text_text_design_font__["a" /* TextDesignFont */]({ text: words.getWord(0), fontIdentifier: fontIdentifier });
      font.fitWidth(textFrame.width);

      var element = new __WEBPACK_IMPORTED_MODULE_7__text_design_element__["a" /* TextDesignElement */]({ text: words.getWord(0), frame: textFrame, font: font });

      element.setFrame(this._getTextFrameForElement(element));

      // is  this.getSize().height already calculated here?
      var size = this.getSize();
      if (this.getSizeToFitContent() || size.height <= 1) {
        size.height = imageInsets.top + element.getFrame().height + imageInsets.bottom;
      }

      size.height = Math.max(size.height, this.getMinimumHeight());

      return [element];
    }
  }, {
    key: '_getTextFrameForElement',
    value: function _getTextFrameForElement(element) {
      var words = this.getWords();
      var text = words.getWord(0);
      var attributes = this.getAttributes();
      var fontIdentifier = attributes.getFontIdentifier();
      var imageInsets = this.getImageInsets();

      var insettedRect = this.getImageInsets().applyToRectangle(this._getFrame()).scale(this.getTextScaleFactor());

      var font = new __WEBPACK_IMPORTED_MODULE_10__text_text_design_font_multiline__["a" /* TextDesignFontMultiline */]({
        text: text,
        fontIdentifier: fontIdentifier,
        alignment: attributes.getAlignment(),
        lineHeight: 1 // attributes.getLineSpacing()
      });

      font.fitInFrame(insettedRect);

      var textSize = font.getSize();

      insettedRect.height = textSize.height;

      var stringHeight = textSize.height * this.getRowScaleFactor();

      if (this.getSizeToFitContent()) {
        stringHeight += imageInsets.top + imageInsets.bottom;
      }

      var frame = this._getFrame();
      var alignment = attributes.getAlignment();
      if (this.getCenteredVertically()) {
        insettedRect.y = frame.height / 2 - stringHeight / 2 + imageInsets.top;
      } else {
        switch (alignment) {
          case 'left':
            insettedRect.y = frame.height - stringHeight - imageInsets.bottom;
            break;

          case 'center':
            insettedRect.y = frame.height / 2 - stringHeight / 2 + stringHeight * this.getCenterOffset();
            insettedRect.x = (frame.width - insettedRect.width) / 2;
            break;

          case 'right':
            insettedRect.x = frame.width - insettedRect.width - imageInsets.right;
            break;

          default:
            break;
        }
      }

      return insettedRect; // insettedRect.scale(this.getTextScaleFactor())
    }
  }, {
    key: 'render',
    value: function render(context) {
      var _this2 = this;

      context.save();

      this._getLayoutElements().forEach(function (element) {
        var _element$serializeOpt = element.serializeOptions(),
            text = _element$serializeOpt.text,
            frame = _element$serializeOpt.frame;

        var attributes = _this2.getAttributes();
        var fontIdentifier = attributes.getFontIdentifier();

        var fontMultiline = new __WEBPACK_IMPORTED_MODULE_10__text_text_design_font_multiline__["a" /* TextDesignFontMultiline */]({
          text: text,
          fontIdentifier: fontIdentifier,
          alignment: attributes.getAlignment(),
          lineHeight: 1, // attributes.getLineSpacing(),
          textColor: attributes.getTextColor().toRGBA()
        });

        frame = _this2._getTextFrameForElement(element);

        fontMultiline.fitInFrame(frame);

        fontMultiline.draw(context, frame.x, frame.y);
      });

      context.restore();
    }
  }]);

  return TextDesignRowMultiline;
}(__WEBPACK_IMPORTED_MODULE_6__text_design_row_masked__["a" /* TextDesignRowMasked */]);

TextDesignRowMultiline.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_6__text_design_row_masked__["a" /* TextDesignRowMasked */].prototype.availableOptions, {
  centerOffset: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0 },
  sizeToFitContent: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].BOOLEAN, default: false },
  textScaleFactor: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.95 },
  rowScaleFactor: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 1 },
  minimumHeight: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0 },
  centeredVertically: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].BOOLEAN, default: false }
});

/***/ }),
/* 107 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignMaskedSpeechBubble; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__models_masked_row_type__ = __webpack_require__(61);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__text_design_masked__ = __webpack_require__(44);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__models_randomizer__ = __webpack_require__(16);







var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */






var TextDesignMaskedSpeechBubble = function (_TextDesignMasked) {
  _inherits(TextDesignMaskedSpeechBubble, _TextDesignMasked);

  function TextDesignMaskedSpeechBubble() {
    var _ref;

    _classCallCheck(this, TextDesignMaskedSpeechBubble);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = TextDesignMaskedSpeechBubble.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignMaskedSpeechBubble)).call.apply(_ref, [this].concat(args)));

    _this._possibleRowTypes = [__WEBPACK_IMPORTED_MODULE_7__models_masked_row_type__["a" /* RowType */].SpeechBubble1, __WEBPACK_IMPORTED_MODULE_7__models_masked_row_type__["a" /* RowType */].SpeechBubble3];

    _this._rowTypesRandomizer = new __WEBPACK_IMPORTED_MODULE_9__models_randomizer__["a" /* Randomizer */](0);
    _this._isMaskedRandomizer = new __WEBPACK_IMPORTED_MODULE_9__models_randomizer__["a" /* Randomizer */](0);

    _this._seedPool.push(_this._rowTypesRandomizer);
    _this._seedPool.push(_this._isMaskedRandomizer);
    return _this;
  }

  _createClass(TextDesignMaskedSpeechBubble, [{
    key: 'getImagePaths',
    value: function getImagePaths() {
      return this._possibleRowTypes.map(function (rowType) {
        return rowType.getImagePath();
      });
    }
  }, {
    key: '_rowTypes',
    value: function _rowTypes(words) {
      return this._possibleRowTypes;
    }
  }, {
    key: '_randomLayoutRow',
    value: function _randomLayoutRow(words, index, width, attributes) {
      this._rowType = this._rowTypesRandomizer.pickNext(this._rowTypes(words));

      attributes.setLineSpacing(0.9);

      var row = _get(TextDesignMaskedSpeechBubble.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignMaskedSpeechBubble.prototype), '_randomLayoutRow', this).call(this, words, index, width, attributes);

      row.set({
        textScaleFactor: 1,
        minimumHeight: width * this._rowType.getMinimumHeightRatio(),
        sizeToFitContent: this._rowType.getSizeToFitContent(),
        centeredVertically: true
      });

      return row;
    }
  }]);

  return TextDesignMaskedSpeechBubble;
}(__WEBPACK_IMPORTED_MODULE_8__text_design_masked__["a" /* TextDesignMasked */]);

TextDesignMaskedSpeechBubble.defaultFontIdentifiers = ['imgly_font_panton_black_caps', 'imgly_font_panton_light_caps', 'imgly_font_panton_black_italic_caps', 'imgly_font_panton_light_italic_caps'];
TextDesignMaskedSpeechBubble.identifier = 'imgly_text_design_masked_speech_bubble';
TextDesignMaskedSpeechBubble.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_8__text_design_masked__["a" /* TextDesignMasked */].prototype.availableOptions, {
  fontIdentifiers: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].ARRAY, default: TextDesignMaskedSpeechBubble.defaultFontIdentifiers },
  squareLayout: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].BOOLEAN, default: false },
  alignment: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].STRING, default: 'left', available: __WEBPACK_IMPORTED_MODULE_8__text_design_masked__["a" /* TextDesignMasked */].ValidAlignments }
});

/***/ }),
/* 108 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignParticlesBackground; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__text_design_background__ = __webpack_require__(155);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__text_design_asset_manager__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_canvas__ = __webpack_require__(34);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__text_design_particle__ = __webpack_require__(372);






var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */







var Rectangle = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Math"].Rectangle;


var TextDesignParticlesBackground = function (_TextDesignBackground) {
  _inherits(TextDesignParticlesBackground, _TextDesignBackground);

  function TextDesignParticlesBackground() {
    var _ref;

    _classCallCheck(this, TextDesignParticlesBackground);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = TextDesignParticlesBackground.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignParticlesBackground)).call.apply(_ref, [this].concat(args)));

    _this._MAX_TRIES = 1000;
    _this._PRECISION = 1000;
    return _this;
  }

  _createClass(TextDesignParticlesBackground, [{
    key: 'render',
    value: function render(context, size, relativeInsets, color, randomizer) {
      var _options = this._options,
          imagePaths = _options.imagePaths,
          relativeParticleSize = _options.relativeParticleSize;


      if (imagePaths.length <= 0) {
        return;
      }

      var aspect = size.width / size.height;

      var textRect = new Rectangle(Math.round(relativeInsets.left * this._PRECISION), Math.round(relativeInsets.top * this._PRECISION * aspect), this._PRECISION, this._PRECISION);

      textRect.width -= textRect.x + Math.round(relativeInsets.right * this._PRECISION);
      textRect.height -= textRect.y + Math.round(relativeInsets.bottom * this._PRECISION * aspect);

      var particles = [];

      var count = 0;
      var tryCount = 0;

      while (count < this.getParticleCount() && tryCount < this._MAX_TRIES) {
        var radius = relativeParticleSize / 2;
        var minX = Math.round(radius * this._PRECISION);
        var minY = Math.round(radius * this._PRECISION * aspect);

        var maxX = Math.floor(this._PRECISION) - minX;
        var maxY = Math.floor(this._PRECISION) - minY;

        var randomValueX = randomizer.nextInRange(minX, maxX);
        var randomValueY = randomizer.nextInRange(minY, maxY);

        var frame = new Rectangle(randomValueX - minX, randomValueY - minY, 2 * minX, 2 * minY);

        if (!frame.intersects(textRect) && !this.hasCollision(particles, frame)) {
          particles.push(new __WEBPACK_IMPORTED_MODULE_9__text_design_particle__["a" /* TextDesignParticle */]({ frame: frame }));
          count += 1;
        }

        tryCount += 1;
      }

      for (var i = 0; i < particles.length; i++) {
        var particle = particles[i];
        var randomImagePath = randomizer.pickNext(imagePaths);
        var randomImage = __WEBPACK_IMPORTED_MODULE_7__text_design_asset_manager__["a" /* AssetManager */].getImage(randomImagePath);
        var opacity = randomizer.nextInRange(140, 230) / 255; // (55 + randomizer.next() % 35) / 100

        var scaleX = size.width / this._PRECISION;
        var scaleY = size.height / this._PRECISION;

        var destination = particle.getContentFrame();
        destination.x *= scaleX;
        destination.y *= scaleY;
        destination.width *= scaleX;
        destination.height *= scaleY;

        var finalColor = color.clone();
        finalColor.a = opacity;

        Object(__WEBPACK_IMPORTED_MODULE_8__utils_canvas__["a" /* drawImageFrame */])(context, randomImage, destination, finalColor, 'source-atop');
      }
    }
  }, {
    key: 'hasCollision',
    value: function hasCollision(particles, rect) {
      for (var i = 0; i < particles.length; i++) {
        if (rect.intersects(particles[i].getFrame())) {
          return true;
        }
      }

      return false;
    }
  }]);

  return TextDesignParticlesBackground;
}(__WEBPACK_IMPORTED_MODULE_6__text_design_background__["a" /* TextDesignBackground */]);

TextDesignParticlesBackground.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_6__text_design_background__["a" /* TextDesignBackground */].prototype.availableOptions, {
  particleCount: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 50 },
  relativeParticleSize: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.08 },
  imagePaths: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].ARRAY, default: [] }
});

/***/ }),
/* 109 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var LIBRARY = __webpack_require__(62);
var $export = __webpack_require__(13);
var redefine = __webpack_require__(111);
var hide = __webpack_require__(26);
var has = __webpack_require__(27);
var Iterators = __webpack_require__(38);
var $iterCreate = __webpack_require__(162);
var setToStringTag = __webpack_require__(65);
var getPrototypeOf = __webpack_require__(115);
var ITERATOR = __webpack_require__(11)('iterator');
var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
var FF_ITERATOR = '@@iterator';
var KEYS = 'keys';
var VALUES = 'values';

var returnThis = function () { return this; };

module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
  $iterCreate(Constructor, NAME, next);
  var getMethod = function (kind) {
    if (!BUGGY && kind in proto) return proto[kind];
    switch (kind) {
      case KEYS: return function keys() { return new Constructor(this, kind); };
      case VALUES: return function values() { return new Constructor(this, kind); };
    } return function entries() { return new Constructor(this, kind); };
  };
  var TAG = NAME + ' Iterator';
  var DEF_VALUES = DEFAULT == VALUES;
  var VALUES_BUG = false;
  var proto = Base.prototype;
  var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
  var $default = (!BUGGY && $native) || getMethod(DEFAULT);
  var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
  var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
  var methods, key, IteratorPrototype;
  // Fix native
  if ($anyNative) {
    IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
    if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
      // Set @@toStringTag to native iterators
      setToStringTag(IteratorPrototype, TAG, true);
      // fix for some old engines
      if (!LIBRARY && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis);
    }
  }
  // fix Array#{values, @@iterator}.name in V8 / FF
  if (DEF_VALUES && $native && $native.name !== VALUES) {
    VALUES_BUG = true;
    $default = function values() { return $native.call(this); };
  }
  // Define iterator
  if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
    hide(proto, ITERATOR, $default);
  }
  // Plug for library
  Iterators[NAME] = $default;
  Iterators[TAG] = returnThis;
  if (DEFAULT) {
    methods = {
      values: DEF_VALUES ? $default : getMethod(VALUES),
      keys: IS_SET ? $default : getMethod(KEYS),
      entries: $entries
    };
    if (FORCED) for (key in methods) {
      if (!(key in proto)) redefine(proto, key, methods[key]);
    } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
  }
  return methods;
};


/***/ }),
/* 110 */
/***/ (function(module, exports, __webpack_require__) {

module.exports = !__webpack_require__(25) && !__webpack_require__(37)(function () {
  return Object.defineProperty(__webpack_require__(79)('div'), 'a', { get: function () { return 7; } }).a != 7;
});


/***/ }),
/* 111 */
/***/ (function(module, exports, __webpack_require__) {

module.exports = __webpack_require__(26);


/***/ }),
/* 112 */
/***/ (function(module, exports, __webpack_require__) {

var has = __webpack_require__(27);
var toIObject = __webpack_require__(28);
var arrayIndexOf = __webpack_require__(164)(false);
var IE_PROTO = __webpack_require__(83)('IE_PROTO');

module.exports = function (object, names) {
  var O = toIObject(object);
  var i = 0;
  var result = [];
  var key;
  for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
  // Don't enum bug & hidden keys
  while (names.length > i) if (has(O, key = names[i++])) {
    ~arrayIndexOf(result, key) || result.push(key);
  }
  return result;
};


/***/ }),
/* 113 */
/***/ (function(module, exports, __webpack_require__) {

// fallback for non-array-like ES3 and non-enumerable old V8 strings
var cof = __webpack_require__(48);
// eslint-disable-next-line no-prototype-builtins
module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
  return cof(it) == 'String' ? it.split('') : Object(it);
};


/***/ }),
/* 114 */
/***/ (function(module, exports, __webpack_require__) {

var document = __webpack_require__(14).document;
module.exports = document && document.documentElement;


/***/ }),
/* 115 */
/***/ (function(module, exports, __webpack_require__) {

// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
var has = __webpack_require__(27);
var toObject = __webpack_require__(49);
var IE_PROTO = __webpack_require__(83)('IE_PROTO');
var ObjectProto = Object.prototype;

module.exports = Object.getPrototypeOf || function (O) {
  O = toObject(O);
  if (has(O, IE_PROTO)) return O[IE_PROTO];
  if (typeof O.constructor == 'function' && O instanceof O.constructor) {
    return O.constructor.prototype;
  } return O instanceof Object ? ObjectProto : null;
};


/***/ }),
/* 116 */
/***/ (function(module, exports, __webpack_require__) {

// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
var $keys = __webpack_require__(112);
var hiddenKeys = __webpack_require__(85).concat('length', 'prototype');

exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  return $keys(O, hiddenKeys);
};


/***/ }),
/* 117 */
/***/ (function(module, exports) {



/***/ }),
/* 118 */
/***/ (function(module, exports, __webpack_require__) {

// call something on iterator step with safe closing on error
var anObject = __webpack_require__(18);
module.exports = function (iterator, fn, value, entries) {
  try {
    return entries ? fn(anObject(value)[0], value[1]) : fn(value);
  // 7.4.6 IteratorClose(iterator, completion)
  } catch (e) {
    var ret = iterator['return'];
    if (ret !== undefined) anObject(ret.call(iterator));
    throw e;
  }
};


/***/ }),
/* 119 */
/***/ (function(module, exports, __webpack_require__) {

// check on default Array iterator
var Iterators = __webpack_require__(38);
var ITERATOR = __webpack_require__(11)('iterator');
var ArrayProto = Array.prototype;

module.exports = function (it) {
  return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
};


/***/ }),
/* 120 */
/***/ (function(module, exports, __webpack_require__) {

// 7.3.20 SpeciesConstructor(O, defaultConstructor)
var anObject = __webpack_require__(18);
var aFunction = __webpack_require__(63);
var SPECIES = __webpack_require__(11)('species');
module.exports = function (O, D) {
  var C = anObject(O).constructor;
  var S;
  return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
};


/***/ }),
/* 121 */
/***/ (function(module, exports) {

module.exports = function (exec) {
  try {
    return { e: false, v: exec() };
  } catch (e) {
    return { e: true, v: e };
  }
};


/***/ }),
/* 122 */
/***/ (function(module, exports, __webpack_require__) {

var anObject = __webpack_require__(18);
var isObject = __webpack_require__(24);
var newPromiseCapability = __webpack_require__(93);

module.exports = function (C, x) {
  anObject(C);
  if (isObject(x) && x.constructor === C) return x;
  var promiseCapability = newPromiseCapability.f(C);
  var resolve = promiseCapability.resolve;
  resolve(x);
  return promiseCapability.promise;
};


/***/ }),
/* 123 */
/***/ (function(module, exports, __webpack_require__) {

var ITERATOR = __webpack_require__(11)('iterator');
var SAFE_CLOSING = false;

try {
  var riter = [7][ITERATOR]();
  riter['return'] = function () { SAFE_CLOSING = true; };
  // eslint-disable-next-line no-throw-literal
  Array.from(riter, function () { throw 2; });
} catch (e) { /* empty */ }

module.exports = function (exec, skipClosing) {
  if (!skipClosing && !SAFE_CLOSING) return false;
  var safe = false;
  try {
    var arr = [7];
    var iter = arr[ITERATOR]();
    iter.next = function () { return { done: safe = true }; };
    arr[ITERATOR] = function () { return iter; };
    exec(arr);
  } catch (e) { /* empty */ }
  return safe;
};


/***/ }),
/* 124 */
/***/ (function(module, exports) {

// shim for using process in browser
var process = module.exports = {};

// cached from whatever global is present so that test runners that stub it
// don't break things.  But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals.  It's inside a
// function because try/catches deoptimize in certain engines.

var cachedSetTimeout;
var cachedClearTimeout;

function defaultSetTimout() {
    throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
    throw new Error('clearTimeout has not been defined');
}
(function () {
    try {
        if (typeof setTimeout === 'function') {
            cachedSetTimeout = setTimeout;
        } else {
            cachedSetTimeout = defaultSetTimout;
        }
    } catch (e) {
        cachedSetTimeout = defaultSetTimout;
    }
    try {
        if (typeof clearTimeout === 'function') {
            cachedClearTimeout = clearTimeout;
        } else {
            cachedClearTimeout = defaultClearTimeout;
        }
    } catch (e) {
        cachedClearTimeout = defaultClearTimeout;
    }
} ())
function runTimeout(fun) {
    if (cachedSetTimeout === setTimeout) {
        //normal enviroments in sane situations
        return setTimeout(fun, 0);
    }
    // if setTimeout wasn't available but was latter defined
    if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
        cachedSetTimeout = setTimeout;
        return setTimeout(fun, 0);
    }
    try {
        // when when somebody has screwed with setTimeout but no I.E. maddness
        return cachedSetTimeout(fun, 0);
    } catch(e){
        try {
            // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
            return cachedSetTimeout.call(null, fun, 0);
        } catch(e){
            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
            return cachedSetTimeout.call(this, fun, 0);
        }
    }


}
function runClearTimeout(marker) {
    if (cachedClearTimeout === clearTimeout) {
        //normal enviroments in sane situations
        return clearTimeout(marker);
    }
    // if clearTimeout wasn't available but was latter defined
    if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
        cachedClearTimeout = clearTimeout;
        return clearTimeout(marker);
    }
    try {
        // when when somebody has screwed with setTimeout but no I.E. maddness
        return cachedClearTimeout(marker);
    } catch (e){
        try {
            // When we are in I.E. but the script has been evaled so I.E. doesn't  trust the global object when called normally
            return cachedClearTimeout.call(null, marker);
        } catch (e){
            // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
            // Some versions of I.E. have different rules for clearTimeout vs setTimeout
            return cachedClearTimeout.call(this, marker);
        }
    }



}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;

function cleanUpNextTick() {
    if (!draining || !currentQueue) {
        return;
    }
    draining = false;
    if (currentQueue.length) {
        queue = currentQueue.concat(queue);
    } else {
        queueIndex = -1;
    }
    if (queue.length) {
        drainQueue();
    }
}

function drainQueue() {
    if (draining) {
        return;
    }
    var timeout = runTimeout(cleanUpNextTick);
    draining = true;

    var len = queue.length;
    while(len) {
        currentQueue = queue;
        queue = [];
        while (++queueIndex < len) {
            if (currentQueue) {
                currentQueue[queueIndex].run();
            }
        }
        queueIndex = -1;
        len = queue.length;
    }
    currentQueue = null;
    draining = false;
    runClearTimeout(timeout);
}

process.nextTick = function (fun) {
    var args = new Array(arguments.length - 1);
    if (arguments.length > 1) {
        for (var i = 1; i < arguments.length; i++) {
            args[i - 1] = arguments[i];
        }
    }
    queue.push(new Item(fun, args));
    if (queue.length === 1 && !draining) {
        runTimeout(drainQueue);
    }
};

// v8 likes predictible objects
function Item(fun, array) {
    this.fun = fun;
    this.array = array;
}
Item.prototype.run = function () {
    this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};

function noop() {}

process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.prependListener = noop;
process.prependOnceListener = noop;

process.listeners = function (name) { return [] }

process.binding = function (name) {
    throw new Error('process.binding is not supported');
};

process.cwd = function () { return '/' };
process.chdir = function (dir) {
    throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };


/***/ }),
/* 125 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__vector2__ = __webpack_require__(42);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



/**
 * Represents a 3-dimensional matrix
 * @class
 * @memberof PhotoEditorSDK.Math
 */

var Matrix = function () {
  /**
   * Creates a Matrix
   */
  function Matrix() {
    _classCallCheck(this, Matrix);

    this.reset();
  }

  /**
   * Multiplies this matrix with the given one
   * @param  {PhotoEditorSDK.Math.Matrix} matrix
   * @return {PhotoEditorSDK.Math.Matrix}
   */


  _createClass(Matrix, [{
    key: 'multiply',
    value: function multiply(matrix) {
      var a = void 0,
          b = void 0,
          c = void 0,
          d = void 0,
          tx = void 0,
          ty = void 0;
      a = this.a * matrix.a + this.b * matrix.c;
      b = this.a * matrix.b + this.b * matrix.d;
      c = this.c * matrix.a + this.d * matrix.c;
      d = this.c * matrix.b + this.d * matrix.d;
      tx = this.tx * matrix.a + this.ty * matrix.c + matrix.tx;
      ty = this.tx * matrix.b + this.ty * matrix.d + matrix.ty;

      this.a = a;
      this.b = b;
      this.c = c;
      this.d = d;
      this.tx = tx;
      this.ty = ty;
      return this;
    }

    /**
     * Applies this matrix to the given vector
     * @param  {PhotoEditorSDK.Math.Vector2} position
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'applyToVector',
    value: function applyToVector(position) {
      var _position = position,
          x = _position.x,
          y = _position.y;

      position = position.clone();
      position.x = this.a * x + this.c * y + this.tx;
      position.y = this.b * x + this.d * y + this.tx;
      return position;
    }

    /**
     * Applies the inverse of this matrix to the given vector
     * @param  {PhotoEditorSDK.Math.Vector2} position
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'applyInverseToVector',
    value: function applyInverseToVector(position) {
      var determinant = 1 / (this.a * this.d + this.c * -this.b);

      var _position2 = position,
          x = _position2.x,
          y = _position2.y;

      position = position.clone();
      position.x = this.d * determinant * x + -this.c * determinant * y + (this.ty * this.c - this.tx * this.d) * determinant;
      position.y = this.a * determinant * y + -this.b * determinant * x + (-this.ty * this.a + this.tx * this.b) * determinant;

      return position;
    }

    /**
     * Turns the given rectangle into vector coordinates by applying this Matrix
     * @param  {PhotoEditorSDK.Math.Rectangle} rectangle
     * @param  {PhotoEditorSDK.Math.Vector2} anchor
     * @return {PhotoEditorSDK.Math.Vector2[]}
     */

  }, {
    key: 'rectangleToCoordinates',
    value: function rectangleToCoordinates(rectangle) {
      var anchor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new __WEBPACK_IMPORTED_MODULE_1__vector2__["a" /* default */](0, 0);

      // Anchor offsets (w0 = right, w1 = left, h0 = up, h1 = down)
      var w0 = rectangle.width * (1 - anchor.x);
      var w1 = rectangle.width * -anchor.x;
      var h0 = rectangle.height * (1 - anchor.y);
      var h1 = rectangle.height * -anchor.y;

      var positions = [];

      // Bottom Left
      positions.push(new __WEBPACK_IMPORTED_MODULE_1__vector2__["a" /* default */](this.a * w1 + this.c * h1 + this.tx, this.d * h1 + this.b * w1 + this.ty));

      // Bottom Right
      positions.push(new __WEBPACK_IMPORTED_MODULE_1__vector2__["a" /* default */](this.a * w0 + this.c * h1 + this.tx, this.d * h1 + this.b * w0 + this.ty));

      // Top Right
      positions.push(new __WEBPACK_IMPORTED_MODULE_1__vector2__["a" /* default */](this.a * w0 + this.c * h0 + this.tx, this.d * h0 + this.b * w0 + this.ty));

      // Top Left
      positions.push(new __WEBPACK_IMPORTED_MODULE_1__vector2__["a" /* default */](this.a * w1 + this.c * h0 + this.tx, this.d * h0 + this.b * w1 + this.ty));

      return positions;
    }

    /**
     * Resets this matrix to the identity matrix
     */

  }, {
    key: 'reset',
    value: function reset() {
      this.a = 1;
      this.b = 0;
      this.c = 0;
      this.d = 1;
      this.tx = 0;
      this.ty = 0;
    }

    /**
     * Returns an array representation of this matrix
     * @return {Float32Array}
     */

  }, {
    key: 'toArray',
    value: function toArray() {
      var arr = [this.a, this.b, 0, this.c, this.d, 0, this.tx, this.ty, 1];
      /* istanbul ignore next */
      if (typeof Float32Array === 'undefined') {
        return arr;
      }
      return new Float32Array(arr);
    }

    /**
     * Returns a string representation of this matrix
     * @return {String}
     */

  }, {
    key: 'toString',
    value: function toString() {
      return 'Matrix({ a: ' + this.a + ', b: ' + this.b + ', c: ' + this.c + ', d: ' + this.d + ', tx: ' + this.tx + ', ty: ' + this.ty + ' })';
    }

    /**
     * The identity matrix
     * @static
     * @type {PhotoEditorSDK.Math.Matrix}
     */

  }], [{
    key: 'IDENTITY',
    get: function get() {
      return new Matrix();
    }
  }]);

  return Matrix;
}();

/* harmony default export */ __webpack_exports__["a"] = (Matrix);

/***/ }),
/* 126 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__vector2__ = __webpack_require__(42);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



/**
 * Represents a Rectangle
 * @class
 * @memberof PhotoEditorSDK.Math
 */

var Rectangle = function () {
  /**
   * Creartes a Rectangle
   * @param {Number} [x = 0]
   * @param {Number} [y = 0]
   * @param {Number} [width  = 0]
   * @param {Number} [height = 0]
   */
  function Rectangle() {
    var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
    var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
    var width = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
    var height = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;

    _classCallCheck(this, Rectangle);

    this.x = x;
    this.y = y;
    this.width = width;
    this.height = height;
  }

  /**
   * Sets the given values
   * @param {Number} x
   * @param {Number} y
   * @return {PhotoEditorSDK.Math.Rectangle}
   */


  _createClass(Rectangle, [{
    key: 'set',
    value: function set(x, y, width, height) {
      this.x = x;
      this.y = y;
      this.width = width;
      this.height = height;
      return this;
    }

    /**
     * Creates a clone of this rectangle
     * @return {PhotoEditorSDK.Math.Rectangle}
     */

  }, {
    key: 'clone',
    value: function clone() {
      return new Rectangle(this.x, this.y, this.width, this.height);
    }

    /**
     * Copies the values of the given rectangle
     * @param  {PhotoEditorSDK.Math.Rectangle} other
     * @return {PhotoEditorSDK.Math.Rectangle}
     */

  }, {
    key: 'copy',
    value: function copy(other) {
      this.x = other.x;
      this.y = other.y;
      this.width = other.width;
      this.height = other.height;
      return this;
    }

    /**
     * Checks whether this rectangle's values are the same as the given ones
     * @param  {(Number|PhotoEditorSDK.Math.Rectangle)} rect
     * @param  {Number} y
     * @param  {Number} width
     * @param  {Number} height
     * @return {Boolean}
     */

  }, {
    key: 'equals',
    value: function equals(rect, y, width, height) {
      if (rect instanceof Rectangle) {
        return rect.x === this.x && rect.y === this.y && rect.width === this.width && rect.height === this.height;
      } else {
        var x = rect;
        return x === this.x && y === this.y && width === this.width && height === this.height;
      }
    }
  }, {
    key: 'translate',
    value: function translate(tx, ty) {
      if (tx instanceof __WEBPACK_IMPORTED_MODULE_1__vector2__["a" /* default */]) {
        ty = tx.y;
        tx = tx.x;
      }

      this.x += tx;
      this.y += ty;

      return this;
    }
  }, {
    key: 'scale',
    value: function scale(sx, sy) {
      if (sx instanceof __WEBPACK_IMPORTED_MODULE_1__vector2__["a" /* default */]) {
        sy = sx.y;
        sx = sx.x;
      } else if (sy === undefined) {
        sy = sx;
      }

      this.width *= sx;
      this.height *= sy;

      return this;
    }

    /**
     * Rounds this rectangle's values
     * @return {PhotoEditorSDK.Math.Rectangle}
     */

  }, {
    key: 'round',
    value: function round() {
      this.x = Math.round(this.x);
      this.y = Math.round(this.y);
      this.width = Math.round(this.width);
      this.height = Math.round(this.height);
      return this;
    }
  }, {
    key: 'getPosition',
    value: function getPosition() {
      return new __WEBPACK_IMPORTED_MODULE_1__vector2__["a" /* default */](this.x, this.y);
    }
  }, {
    key: 'getSize',
    value: function getSize() {
      return new __WEBPACK_IMPORTED_MODULE_1__vector2__["a" /* default */](this.width, this.height);
    }
  }, {
    key: 'insetBy',
    value: function insetBy(dx, dy) {
      this.x += dx;
      this.y += dy;

      this.width -= 2 * dx;
      this.height -= 2 * dy;

      return this;
    }
  }, {
    key: 'intersects',
    value: function intersects(rect) {
      var p1 = new __WEBPACK_IMPORTED_MODULE_1__vector2__["a" /* default */](this.x, this.y);
      var p2 = new __WEBPACK_IMPORTED_MODULE_1__vector2__["a" /* default */](this.x + this.width, this.y + this.height);

      var q1 = new __WEBPACK_IMPORTED_MODULE_1__vector2__["a" /* default */](rect.x, rect.y);
      var q2 = new __WEBPACK_IMPORTED_MODULE_1__vector2__["a" /* default */](rect.x + rect.width, rect.y + rect.height);

      if (q1.x > p2.x || p1.x > q2.x || q2.y < p1.y || p2.y < q1.y) {
        return false;
      }

      return true;
    }

    /**
     * Returns a string representation of this rectangle
     * @return {String}
     */

  }, {
    key: 'toString',
    value: function toString() {
      return 'Rectangle({ x: ' + this.x + ', y: ' + this.y + ', width: ' + this.width + ', height: ' + this.height + ' })';
    }
  }], [{
    key: 'FromDiagonalPoints',
    value: function FromDiagonalPoints(p1, p2) {
      var inverted = false;

      if (p2.x - p1.x < 0) {
        inverted = true;
      }

      var topLeft = inverted ? p2 : p1;
      var bottomRight = inverted ? p1 : p2;
      var width = bottomRight.x - topLeft.x;
      var height = bottomRight.y - topLeft.y;

      return new Rectangle(topLeft.x, topLeft.y, width, height);
    }
  }]);

  return Rectangle;
}();

/* harmony default export */ __webpack_exports__["a"] = (Rectangle);

/***/ }),
/* 127 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__shared_log__ = __webpack_require__(30);


function _defineProperty(obj, key, value) { if (key in obj) { __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



/* istanbul ignore next */
/* harmony default export */ __webpack_exports__["a"] = ({
  /**
   * Checks if the currently bound framebuffer is complete
   * @param  {String} tag
   * @param  {WebGLRenderingContext} gl
   * @ignore
   */
  checkFramebufferStatus: function checkFramebufferStatus(tag, gl) {
    var _possibleStatuses;

    var fboStatus = gl.checkFramebufferStatus(gl.FRAMEBUFFER);

    var possibleStatuses = (_possibleStatuses = {}, _defineProperty(_possibleStatuses, gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT, 'Incomplete attachment'), _defineProperty(_possibleStatuses, gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT, 'Missing attachment'), _defineProperty(_possibleStatuses, gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS, 'Incomplete dimensions'), _defineProperty(_possibleStatuses, gl.FRAMEBUFFER_UNSUPPORTED, 'Framebuffer unsupported'), _possibleStatuses);

    if (fboStatus !== gl.FRAMEBUFFER_COMPLETE) {
      __WEBPACK_IMPORTED_MODULE_1__shared_log__["a" /* default */].warn(tag, 'Framebuffer incomplete: ' + possibleStatuses[fboStatus]);
    }
  }
});

/***/ }),
/* 128 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__globals__ = __webpack_require__(9);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */


var now = typeof window !== 'undefined' && window.performance && window.performance.now ? window.performance.now.bind(window.performance) : __webpack_require__(129);

/**
 * Hooks into a rendering context (WebGLRenderingContext or CanvasRenderingContext2D),
 * mocks its methods and measures the time consumed by the method calls. When `endFrame`
 * is called, it prints a performance report
 * @class
 * @memberof PhotoEditorSDK.Engine
 * @ignore
 */

var ContextPerformanceHook = function () {
  function ContextPerformanceHook(context) {
    var _this = this;

    _classCallCheck(this, ContextPerformanceHook);

    this._context = context;
    this._tracking = false;

    var self = this;

    var _loop = function _loop(key) {
      var value = context[key];
      if (typeof value === 'function') {
        _this[key] = function () {
          for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
            args[_key] = arguments[_key];
          }

          var fn = context[key];
          if (!self._tracking) {
            return fn.apply(context, args);
          }

          var start = now();
          var result = fn.apply(context, args);
          var time = now() - start;

          var call = {
            functionName: key,
            arguments: args,
            duration: time
          };
          self._trackedCalls.push(call);

          return result;
        };
      } else {
        _this._makePropertyWrapper(key);
      }
    };

    for (var key in context) {
      _loop(key);
    }
  }

  /**
   * Creates the getter and setter for the given property
   * @param  {String} property
   * @private
   */


  _createClass(ContextPerformanceHook, [{
    key: '_makePropertyWrapper',
    value: function _makePropertyWrapper(property) {
      var insecureProperties = ['_context', '_trackedCalls', '_tracking'];
      if (insecureProperties.indexOf(property) !== -1) return;

      var context = this._context;

      this.__defineGetter__(property, function () {
        return context[property];
      });

      this.__defineSetter__(property, function (value) {
        context[property] = value;
      });
    }

    /**
     * Starts tracking a frame
     */

  }, {
    key: 'startFrame',
    value: function startFrame() {
      this._tracking = true;
      this._trackedCalls = [];
    }

    /**
     * Stops tracking a frame and prints a performance report
     */

  }, {
    key: 'endFrame',
    value: function endFrame() {
      var tag = 'Rendering';
      __WEBPACK_IMPORTED_MODULE_1__globals__["f" /* Log */].log(tag, 'Frame rendering results:');
      __WEBPACK_IMPORTED_MODULE_1__globals__["f" /* Log */].log(tag, 'Context calls: ' + this._trackedCalls.length);

      var groupedCalls = {};
      this._trackedCalls.forEach(function (_ref) {
        var functionName = _ref.functionName,
            duration = _ref.duration;

        groupedCalls[functionName] = groupedCalls[functionName] || {
          totalDuration: 0,
          calls: 0
        };

        groupedCalls[functionName].totalDuration += duration;
        groupedCalls[functionName].calls++;
      });

      var callsArray = [];
      for (var key in groupedCalls) {
        var data = groupedCalls[key];
        data.averageDuration = data.totalDuration / data.calls;

        callsArray.push({ functionName: key, data: data });
      }

      callsArray.sort(function (a, b) {
        return b.data.totalDuration - a.data.totalDuration;
      });
      callsArray = callsArray.slice(0, 3);

      callsArray.forEach(function (item) {
        __WEBPACK_IMPORTED_MODULE_1__globals__["f" /* Log */].log(tag, item.functionName + ': ' + item.data.calls + ' calls, ' + item.data.totalDuration.toFixed(2) + 'ms');
      });
    }
  }]);

  return ContextPerformanceHook;
}();

/* harmony default export */ __webpack_exports__["a"] = (ContextPerformanceHook);

/***/ }),
/* 129 */
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(process) {// Generated by CoffeeScript 1.7.1
(function() {
  var getNanoSeconds, hrtime, loadTime;

  if ((typeof performance !== "undefined" && performance !== null) && performance.now) {
    module.exports = function() {
      return performance.now();
    };
  } else if ((typeof process !== "undefined" && process !== null) && process.hrtime) {
    module.exports = function() {
      return (getNanoSeconds() - loadTime) / 1e6;
    };
    hrtime = process.hrtime;
    getNanoSeconds = function() {
      var hr;
      hr = hrtime();
      return hr[0] * 1e9 + hr[1];
    };
    loadTime = getNanoSeconds();
  } else if (Date.now) {
    module.exports = function() {
      return Date.now() - loadTime;
    };
    loadTime = Date.now();
  } else {
    module.exports = function() {
      return new Date().getTime() - loadTime;
    };
    loadTime = new Date().getTime();
  }

}).call(this);

/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(124)))

/***/ }),
/* 130 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__globals__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_utils__ = __webpack_require__(212);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * The base class for all renderers
 * @class
 * @memberof PhotoEditorSDK.Engine
 */

var BaseRenderer = function (_EventEmitter) {
  _inherits(BaseRenderer, _EventEmitter);

  /**
   * Create a BaseRenderer instance
   * @param  {Number} width
   * @param  {Number} height
   * @param  {Object} options = {}
   * @param  {Number} [options.pixelRatio = 1]
   * @param  {PhotoEditorSDK.Color} [options.clearColor = PhotoEditorSDK.Color.TRANSPARENT]
   * @param  {Boolean} [options.debug = false]
   */
  function BaseRenderer(width, height) {
    var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

    _classCallCheck(this, BaseRenderer);

    var _this = _possibleConstructorReturn(this, (BaseRenderer.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(BaseRenderer)).call(this));

    _this._options = __WEBPACK_IMPORTED_MODULE_5__utils_utils__["a" /* default */].defaults(options, {
      pixelRatio: 1,
      transparent: false,
      clearColor: __WEBPACK_IMPORTED_MODULE_4__globals__["b" /* Color */].BLACK,
      debug: false
    });

    _this.setMaxListeners(0);
    _this._width = width || 800;
    _this._height = height || 600;
    _this._dimensions = new __WEBPACK_IMPORTED_MODULE_4__globals__["k" /* Vector2 */](_this._width, _this._height);
    _this._maxTextureSize = null;
    _this._pixelRatio = _this._options.pixelRatio;
    _this._clearColor = _this._options.transparent ? __WEBPACK_IMPORTED_MODULE_4__globals__["b" /* Color */].TRANSPARENT : _this._options.clearColor || __WEBPACK_IMPORTED_MODULE_4__globals__["b" /* Color */].BLACK;
    return _this;
  }

  /**
   * Sets the canvas to the given one
   * @param {HTMLCanvasElement} canvas
   */


  _createClass(BaseRenderer, [{
    key: 'setCanvas',
    value: function setCanvas(canvas) {
      var previousCanvas = this._canvas;
      this._canvas = canvas;

      if (previousCanvas !== canvas) {
        this._createContext();
        this._onBeforeContext();
        this._setupContext();
      }

      this.resizeTo(new __WEBPACK_IMPORTED_MODULE_4__globals__["k" /* Vector2 */](this._width, this._height));
    }

    /**
     * Returns the current canvas
     * @return {HTMLCanvasElement}
     */

  }, {
    key: 'getCanvas',
    value: function getCanvas() {
      return this._canvas;
    }

    /**
     * Gets called before the context has been set up
     * @protected
     */

  }, {
    key: '_onBeforeContext',
    value: function _onBeforeContext() {}

    /**
     * Resizes the context and view to the given size
     * @param  {PhotoEditorSDK.Math.Vector2} dimensions
     * @param  {Boolean} resizeCanvas = true
     */

  }, {
    key: 'resizeTo',
    value: function resizeTo(dimensions) {
      var resizeCanvas = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;

      this._width = dimensions.x * this._pixelRatio;
      this._height = dimensions.y * this._pixelRatio;

      if (resizeCanvas) {
        this._canvas.width = this._width;
        this._canvas.height = this._height;

        if (this._canvas.style) {
          this._canvas.style.width = this._width / this._pixelRatio + 'px';
          this._canvas.style.height = this._height / this._pixelRatio + 'px';
        }
      }

      this._dimensions = dimensions.clone();
    }

    /**
     * Gets the rendering context for this renderer
     * @returns {Object}
     * @protected
     * @abstract
     */
    /* istanbul ignore next */

  }, {
    key: '_createContext',
    value: function _createContext() {
      __WEBPACK_IMPORTED_MODULE_4__globals__["f" /* Log */].warn(this.constructor.name, '`_createContext` is abstract and not implemented in inherited class');
    }

    /**
     * Sets up the rendering context for this renderer
     * @protected
     * @abstract
     */
    /* istanbul ignore next */

  }, {
    key: '_setupContext',
    value: function _setupContext() {
      __WEBPACK_IMPORTED_MODULE_4__globals__["f" /* Log */].warn(this.constructor.name, '`_setupContext` is abstract and not implemented in inherited class');
    }

    /**
     * Renders the given displayObject
     * @param  {PhotoEditorSDK.Engine.DisplayObject} displayObject
     * @abstract
     */
    /* istanbul ignore next */

  }, {
    key: 'render',
    value: function render(displayObject) {
      __WEBPACK_IMPORTED_MODULE_4__globals__["f" /* Log */].warn(this.constructor.name, '`render` is abstract and not implemented in inherited class');
    }

    /**
     * Returns the maximum dimensions
     * @return {Number}
     */
    /* istanbul ignore next */

  }, {
    key: 'getMaxDimensions',
    value: function getMaxDimensions() {
      return null;
    }

    /**
     * Returns the current rendering context
     * @return {RenderingContext}
     */

  }, {
    key: 'getContext',
    value: function getContext() {
      return this._context;
    }

    /**
     * Returns the current width
     * @return {Number}
     */

  }, {
    key: 'getWidth',
    value: function getWidth() {
      return this._dimensions.x;
    }

    /**
     * Returns the current height
     * @return {Number}
     */

  }, {
    key: 'getHeight',
    value: function getHeight() {
      return this._dimensions.y;
    }

    /**
     * Returns the current dimensions
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'getDimensions',
    value: function getDimensions() {
      return this._dimensions;
    }

    /**
     * Returns the current pixel ratio
     * @return {Number}
     */

  }, {
    key: 'getPixelRatio',
    value: function getPixelRatio() {
      return this._pixelRatio;
    }

    /**
     * Sets the pixel ratio
     * @return {Number}
     */

  }, {
    key: 'setPixelRatio',
    value: function setPixelRatio(pixelRatio) {
      this._pixelRatio = pixelRatio;
      if (this._defaultRenderTarget) {
        this._defaultRenderTarget.setPixelRatio(pixelRatio);
      }
    }

    /**
     * Returns the maximum texture size
     * @return {Number}
     */

  }, {
    key: 'getMaxTextureSize',
    value: function getMaxTextureSize() {
      return this._maxTextureSize;
    }

    /**
     * Returns the current filter manager
     * @return {PhotoEditorSDK.Engine.FilterManager}
     */

  }, {
    key: 'getFilterManager',
    value: function getFilterManager() {
      return this._filterManager;
    }

    /**
     * Sets the filter manager
     * @param {PhotoEditorSDK.Engine.FilterManager} filterManager
     */

  }, {
    key: 'setFilterManager',
    value: function setFilterManager(filterManager) {
      this._filterManager = filterManager;
    }

    /**
     * Checks if this renderer is supported on the current device and browser
     * @return {Boolean}
     */

  }, {
    key: 'isOfType',


    /**
     * Checks if this renderer's type is equal to the given one
     * @param  {String}  type
     * @return {Boolean}
     */
    value: function isOfType(type) {
      return this._type === type;
    }

    /**
     * Disposes this Renderer
     * @abstract
     */
    /* istanbul ignore next */

  }, {
    key: 'dispose',
    value: function dispose() {
      __WEBPACK_IMPORTED_MODULE_4__globals__["f" /* Log */].warn(this.constructor.name, '`dispose` is abstract and not implemented in inherited class');
    }
  }], [{
    key: 'isSupported',
    value: function isSupported() {
      return true;
    }
  }]);

  return BaseRenderer;
}(__WEBPACK_IMPORTED_MODULE_4__globals__["d" /* EventEmitter */]);

/* harmony default export */ __webpack_exports__["a"] = (BaseRenderer);

/***/ }),
/* 131 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */

/**
 * The base class for all ObjectRenderer classes
 * @class
 * @memberof PhotoEditorSDK.Engine
 */
/* istanbul ignore next */
var ObjectRenderer = function () {
  /**
   * Creates an ObjectRenderer
   * @param  {PhotoEditorSDK.Engine.BaseRenderer} renderer
   */
  function ObjectRenderer(renderer) {
    _classCallCheck(this, ObjectRenderer);

    this._renderer = renderer;

    this._onContextChange = this._onContextChange.bind(this);
    this._renderer.on('context', this._onContextChange);
  }

  /**
   * Gets called when the rendering context changes
   * @private
   */


  _createClass(ObjectRenderer, [{
    key: '_onContextChange',
    value: function _onContextChange() {}

    /**
     * Gets called when this object renderer is activated
     */

  }, {
    key: 'start',
    value: function start() {}

    /**
     * Gets called when this object renderer is deactivated
     */

  }, {
    key: 'stop',
    value: function stop() {
      this.flush();
    }

    /**
     * Renders whatever has been queued
     */

  }, {
    key: 'flush',
    value: function flush() {}

    /**
     * Disposes this ObjectRenderer
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      this._renderer.off('context', this._onContextChange);
      this._renderer = null;
    }
  }]);

  return ObjectRenderer;
}();

/* harmony default export */ __webpack_exports__["a"] = (ObjectRenderer);

/***/ }),
/* 132 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */

/**
 * This class represents an image in pixel array form.
 * @ignore
 */
var PixelArrayImage = function () {
  /**
   * @param  {Number} width
   * @param  {Number} height
   * @param  {UInt8Array} data
   * @constructor
   */
  function PixelArrayImage(width, height, data) {
    _classCallCheck(this, PixelArrayImage);

    this.width = width;
    this.height = height;
    this.data = data;
  }

  /**
   * Creates a PixelArrayImage from the given `node-canvas` Image object by rendering the image
   * to a canvas and reading the pixel data
   * @param  {Canvas.Image} image
   * @return {PixelArrayImage}
   */


  _createClass(PixelArrayImage, null, [{
    key: 'fromNodeCanvasImage',
    value: function fromNodeCanvasImage(image) {
      var canvas = new Canvas(image.width, image.height);
      var context = canvas.getContext('2d');

      context.drawImage(image, 0, 0);
      var imageData = context.getImageData(0, 0, image.width, image.height);
      return new PixelArrayImage(image.width, image.height, imageData.data);
    }
  }]);

  return PixelArrayImage;
}();

/* harmony default export */ __webpack_exports__["a"] = (PixelArrayImage);

/***/ }),
/* 133 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__globals__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__display_object__ = __webpack_require__(98);






var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * A container for DisplayObject instances
 * @class
 * @extends PhotoEditorSDK.Engine.DisplayObject
 * @memberof PhotoEditorSDK.Engine
 */

var Container = function (_DisplayObject) {
  _inherits(Container, _DisplayObject);

  /**
   * Creates a Container
   * @override
   */
  function Container() {
    var _ref;

    _classCallCheck(this, Container);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = Container.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(Container)).call.apply(_ref, [this].concat(args)));

    _this._children = [];
    _this._filters = [];
    return _this;
  }

  /**
   * Adds the given filter to the filter stack
   * @param {PhotoEditorSDK.Engine.Filter} filter
   */


  _createClass(Container, [{
    key: 'addFilter',
    value: function addFilter(filter) {
      this._filters.push(filter);
    }

    /**
     * Removes the given filter from the filter stack
     * @param  {PhotoEditorSDK.Engine.Filter} filter
     * @return {Boolean} - Whether the filter has been removed
     */

  }, {
    key: 'removeFilter',
    value: function removeFilter(filter) {
      var index = this._filters.indexOf(filter);
      if (index !== -1) {
        this._filters.splice(index, 1);
        return true;
      }
      return false;
    }

    /**
     * Sets the filters
     * @param {Array.<PhotoEditorSDK.Engine.Filter>} filters
     */

  }, {
    key: 'setFilters',
    value: function setFilters(filters) {
      this._filters = filters;
    }

    /**
     * Adds the given DisplayObject to the list of children
     * @param {PhotoEditorSDK.Engine.DisplayObject} child
     */

  }, {
    key: 'addChild',
    value: function addChild(child) {
      // Remove from previous parent
      var originalParent = child.getParent();
      if (originalParent !== null) {
        originalParent.removeChild(child);
      }
      child.setParent(this);

      this._children.push(child);
    }

    /**
     * Prepends the given DisplayObject to the list of children
     * @param  {PhotoEditorSDK.Engine.DisplayObject} child
     */

  }, {
    key: 'prependChild',
    value: function prependChild(child) {
      // Remove from previous parent
      var originalParent = child.getParent();
      if (originalParent !== null) {
        originalParent.removeChild(child);
      }
      child.setParent(this);

      this._children.unshift(child);
    }

    /**
     * Checks whether this container has the given child
     * @param  {PhotoEditorSDK.Engine.DisplayObject}  child
     * @return {Boolean}
     */

  }, {
    key: 'hasChild',
    value: function hasChild(child) {
      var index = this._children.indexOf(child);
      return index !== -1;
    }

    /**
     * Removes the given object from the list of children
     * @param  {PhotoEditorSDK.Engine.DisplayObject} child
     */

  }, {
    key: 'removeChild',
    value: function removeChild(child) {
      var index = this._children.indexOf(child);
      if (index !== -1) {
        this._children.splice(index, 1);
        child.setParent(null);
      } else {
        __WEBPACK_IMPORTED_MODULE_5__globals__["f" /* Log */].info(this.constructor.name, 'Tried to remove a child that does not exist');
      }
    }

    /**
     * Removes all children
     */

  }, {
    key: 'clearChildren',
    value: function clearChildren() {
      this._children = [];
    }

    /**
     * Renders this DisplayObject using the given WebGLRenderer
     * @param  {PhotoEditorSDK.Engine.WebGLRenderer} renderer
     * @override
     */

  }, {
    key: 'renderWebGL',
    value: function renderWebGL(renderer) {
      if (!this._visible) {
        return;
      }

      var filterManager = renderer.getFilterManager();
      if (this._filters && this._filters.length) {
        filterManager.pushFilters(this, this._filters);
      }

      renderer.getCurrentObjectRenderer().start();

      this._renderWebGL(renderer);

      this._children.forEach(function (child) {
        child.renderWebGL(renderer);
      });

      renderer.getCurrentObjectRenderer().flush();

      if (this._filters && this._filters.length) {
        filterManager.popFilters();
      }
      renderer.getCurrentObjectRenderer().start();
    }

    /**
     * Renders the contents of this container
     * @param {PhotoEditorSDK.Engine.WebGLRenderer} renderer
     * @protected
     */

  }, {
    key: '_renderWebGL',
    value: function _renderWebGL(renderer) {}

    /**
     * Renders this DisplayObject using the given CanvasRenderer
     * @param  {PhotoEditorSDK.Engine.CanvasRenderer} renderer
     * @override
     */

  }, {
    key: 'renderCanvas',
    value: function renderCanvas(renderer) {
      if (!this._visible) {
        return;
      }

      var filterManager = renderer.getFilterManager();
      if (this._filters && this._filters.length) {
        filterManager.pushFilters(this, this._filters);
      }

      this._renderCanvas(renderer);
      this._children.forEach(function (child) {
        child.renderCanvas(renderer);
      });

      if (this._filters && this._filters.length) {
        filterManager.popFilters();
      }
    }

    /**
     * Renders the contents of this container
     * @param {PhotoEditorSDK.Engine.CanvasRenderer} renderer
     * @protected
     */

  }, {
    key: '_renderCanvas',
    value: function _renderCanvas(renderer) {}

    /**
     * Updates the world transform for this DisplayObject
     */

  }, {
    key: 'updateTransform',
    value: function updateTransform() {
      _get(Container.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(Container.prototype), 'updateTransform', this).call(this);
      this._children.forEach(function (child) {
        child.updateTransform();
      });
    }

    /**
     * Returns the non-global bounds of this DisplayObject
     * @return {PhotoEditorSDK.Math.Rectangle}
     */

  }, {
    key: 'getLocalBounds',
    value: function getLocalBounds() {
      if (this._localBoundsNeedUpdate) {
        // @TODO Calculate bounds by looking at children
        this._localBoundsNeedUpdate = false;
      }
      return this._localBounds.clone();
    }

    /**
     * Returns the bounds for this DisplayObject
     * @return {PhotoEditorSDK.Math.Rectangle}
     */

  }, {
    key: 'getBounds',
    value: function getBounds() {
      if (this._boundsNeedUpdate) {
        // @TODO Calculate bounds by looking at children
        this._boundsNeedUpdate = false;
      }
      return this._bounds.clone();
    }

    /**
     * Returns this Container's children
     * @return {PhotoEditorSDK.Engine.DisplayObject[]}
     */

  }, {
    key: 'getChildren',
    value: function getChildren() {
      return this._children;
    }

    /**
     * Returns this Container's filters
     * @return {PhotoEditorSDK.Engine.Filter[]}
     */

  }, {
    key: 'getFilters',
    value: function getFilters() {
      return this._filters;
    }

    /**
     * Disposes this Container
     */

  }, {
    key: 'dispose',
    value: function dispose() {}
  }]);

  return Container;
}(__WEBPACK_IMPORTED_MODULE_6__display_object__["a" /* default */]);

/* harmony default export */ __webpack_exports__["a"] = (Container);

/***/ }),
/* 134 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__globals__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__base_texture__ = __webpack_require__(53);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils_texture_uvs__ = __webpack_require__(220);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */





/**
 * A texture that can be applied to a {@link PhotoEditorSDK.Engine.Sprite}
 * @class
 * @extends EventEmitter
 * @memberof PhotoEditorSDK.Engine
 */

var Texture = function (_EventEmitter) {
  _inherits(Texture, _EventEmitter);

  function Texture(baseTexture, frame) {
    _classCallCheck(this, Texture);

    var _this = _possibleConstructorReturn(this, (Texture.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(Texture)).call(this));

    if (!(baseTexture instanceof __WEBPACK_IMPORTED_MODULE_5__base_texture__["a" /* default */])) {
      throw new Error('`baseTexture` should be an instance of BaseTexture');
    }

    _this._uvs = new __WEBPACK_IMPORTED_MODULE_6__utils_texture_uvs__["a" /* default */]();
    _this._frame = frame ? frame.clone() : null;
    _this._frameLocked = !!frame;

    // Bind event handlers
    _this._onBaseTextureLoaded = _this._onBaseTextureLoaded.bind(_this);
    _this._onBaseTextureUpdated = _this._onBaseTextureUpdated.bind(_this);

    // A texture NEEDS to have a frame
    if (!_this._frame) {
      _this._frame = new __WEBPACK_IMPORTED_MODULE_4__globals__["h" /* Rectangle */](0, 0, 1, 1);
    }
    _this.setBaseTexture(baseTexture);
    return _this;
  }

  /**
   * Creates a texture from the given image
   * @param  {Image} image
   */


  _createClass(Texture, [{
    key: '_onBaseTextureLoaded',


    /**
     * Gets called when the base texture has been loaded
     * @private
     */
    value: function _onBaseTextureLoaded() {
      if (!this._frameLocked) {
        var frame = this._baseTexture.getFrame().clone();
        this.setFrame(frame);
      }

      this._baseTexture.on('update', this._onBaseTextureUpdated);
    }

    /**
     * Gets called when the base texture has been updated
     * @private
     */

  }, {
    key: '_onBaseTextureUpdated',
    value: function _onBaseTextureUpdated() {
      var _baseTexture$getFrame = this._baseTexture.getFrame(),
          width = _baseTexture$getFrame.width,
          height = _baseTexture$getFrame.height;

      this._frame.width = width;
      this._frame.height = height;
      this.emit('update');
    }

    /**
     * Updates the UV coordinates of this texture
     * @private
     */

  }, {
    key: '_updateUVs',
    value: function _updateUVs() {
      this._uvs.update(this._frame, this._baseTexture.getFrame());
    }

    /**
     * Returns the base texture
     * @return {PhotoEditorSDK.Engine.BaseTexture}
     */

  }, {
    key: 'getBaseTexture',
    value: function getBaseTexture() {
      return this._baseTexture;
    }

    /**
     * Sets the base texture
     * @param {PhotoEditorSDK.Engine.BaseTexture} baseTexture
     */

  }, {
    key: 'setBaseTexture',
    value: function setBaseTexture(baseTexture) {
      this._baseTexture = baseTexture;

      if (!this._baseTexture.isLoaded()) {
        this._baseTexture.once('loaded', this._onBaseTextureLoaded);
      } else {
        var _baseTexture$getFrame2 = baseTexture.getFrame(),
            width = _baseTexture$getFrame2.width,
            height = _baseTexture$getFrame2.height;

        if (!this._frameLocked) {
          this._frame = new __WEBPACK_IMPORTED_MODULE_4__globals__["h" /* Rectangle */](0, 0, width, height);
        }
        this._onBaseTextureLoaded();
      }
    }

    /**
     * Returns the frame
     * @return {PhotoEditorSDK.Math.Rectangle}
     */

  }, {
    key: 'getFrame',
    value: function getFrame() {
      return this._frame;
    }

    /**
     * Sets the frame
     * @param {PhotoEditorSDK.Math.Rectangle} frame
     */

  }, {
    key: 'setFrame',
    value: function setFrame(frame) {
      this._frame = frame;
      this._updateUVs();
    }

    /**
     * Returns the width
     * @return {Number}
     */

  }, {
    key: 'getWidth',
    value: function getWidth() {
      return this._frame.width;
    }

    /**
     * Returns the height
     * @return {Number}
     */

  }, {
    key: 'getHeight',
    value: function getHeight() {
      return this._frame.height;
    }

    /**
     * Returns the texture UVs
     * @return {PhotoEditorSDK.Engine.TextureUVs}
     */

  }, {
    key: 'getUVs',
    value: function getUVs() {
      return this._uvs;
    }

    /**
     * Returns the dimensions of this texture
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'getDimensions',
    value: function getDimensions() {
      return new __WEBPACK_IMPORTED_MODULE_4__globals__["k" /* Vector2 */](this._frame.width, this._frame.height);
    }

    /**
     * Disposes this texture
     * @param  {Boolean} baseTexture
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      var baseTexture = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;

      baseTexture && this._baseTexture.dispose();
    }
  }], [{
    key: 'fromImage',
    value: function fromImage(image) {
      var baseTexture = new __WEBPACK_IMPORTED_MODULE_5__base_texture__["a" /* default */](image);
      return new Texture(baseTexture);
    }

    /**
     * Creates a texture from the given canvas
     * @param  {HTMLCanvasElement} canvas
     */

  }, {
    key: 'fromCanvas',
    value: function fromCanvas(canvas) {
      var baseTexture = new __WEBPACK_IMPORTED_MODULE_5__base_texture__["a" /* default */](canvas);
      return new Texture(baseTexture);
    }
  }]);

  return Texture;
}(__WEBPACK_IMPORTED_MODULE_4__globals__["d" /* EventEmitter */]);

/* harmony default export */ __webpack_exports__["a"] = (Texture);

/***/ }),
/* 135 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__color__ = __webpack_require__(51);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



/*
 * [ a, b, c, d, e,
 *   f, g, h, i, j,
 *   k, l, m, n, o,
 *   p, q, r, s, t ]
 *
 */

/**
 * Represents a 4 by 5 matrix that is used to preform color manipulations.
 * The members are names a, b, c,..,t. The vector formed by e, j, o, t
 * represents the offset.
 * @class
 * @memberof PhotoEditorSDK.Math
 */

var ColorMatrix = function () {
  /**
   * Creates a color matrix, and defaults the values to the identity.
   * @return {PhotoEditorSDK.Math.ColorMatrix}
   */
  function ColorMatrix() {
    var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
    var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
    var c = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
    var d = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
    var e = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
    var f = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
    var g = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 1;
    var h = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 0;
    var i = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : 0;
    var j = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : 0;
    var k = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : 0;
    var l = arguments.length > 11 && arguments[11] !== undefined ? arguments[11] : 0;
    var m = arguments.length > 12 && arguments[12] !== undefined ? arguments[12] : 1;
    var n = arguments.length > 13 && arguments[13] !== undefined ? arguments[13] : 0;
    var o = arguments.length > 14 && arguments[14] !== undefined ? arguments[14] : 0;
    var p = arguments.length > 15 && arguments[15] !== undefined ? arguments[15] : 0;
    var q = arguments.length > 16 && arguments[16] !== undefined ? arguments[16] : 0;
    var r = arguments.length > 17 && arguments[17] !== undefined ? arguments[17] : 0;
    var s = arguments.length > 18 && arguments[18] !== undefined ? arguments[18] : 1;
    var t = arguments.length > 19 && arguments[19] !== undefined ? arguments[19] : 0;

    _classCallCheck(this, ColorMatrix);

    this.set(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t);
  }

  /**
   * Sets the values of the color matrix.
   * @param  {number} a
   * @param  {number} b
   * @param  {number} c
   * @param  {number} d
   * @param  {number} e
   * @param  {number} f
   * @param  {number} g
   * @param  {number} h
   * @param  {number} i
   * @param  {number} j
   * @param  {number} k
   * @param  {number} l
   * @param  {number} m
   * @param  {number} n
   * @param  {number} o
   * @param  {number} p
   * @param  {number} q
   * @param  {number} r
   * @param  {number} s
   * @param  {number} t
   * @return {PhotoEditorSDK.Math.ColorMatrix}
   */


  _createClass(ColorMatrix, [{
    key: 'set',
    value: function set(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) {
      this.a = a;
      this.b = b;
      this.c = c;
      this.d = d;
      this.e = e;
      this.f = f;
      this.g = g;
      this.h = h;
      this.i = i;
      this.j = j;
      this.k = k;
      this.l = l;
      this.m = m;
      this.n = n;
      this.o = o;
      this.p = p;
      this.q = q;
      this.r = r;
      this.s = s;
      this.t = t;
    }

    /**
     * Returns an identity color matrix.
     * @return {ColorMatrix}
     */

  }, {
    key: 'reset',
    value: function reset() {
      this.a = 1;
      this.b = 0;
      this.c = 0;
      this.d = 0;
      this.e = 0;

      this.f = 0;
      this.g = 1;
      this.h = 0;
      this.i = 0;
      this.j = 0;

      this.k = 0;
      this.l = 0;
      this.m = 1;
      this.n = 0;
      this.o = 0;

      this.p = 0;
      this.q = 0;
      this.r = 0;
      this.s = 1;
      this.t = 0;
    }

    /**
     * Applies the color matrix to the given color, and returns the resulting color.
     * @param  {Color} color
     * @return {Color}
     */

  }, {
    key: 'apply',
    value: function apply(color) {
      var r = this.a * color.r + this.b * color.g + this.c * color.b + this.d * color.a + this.e;
      var g = this.f * color.r + this.g * color.g + this.h * color.b + this.i * color.a + this.j;
      var b = this.k * color.r + this.l * color.g + this.m * color.b + this.n * color.a + this.o;
      var a = this.p * color.r + this.q * color.g + this.r * color.b + this.s * color.a + this.t;
      return new __WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */](r, g, b, a);
    }

    /**
    * Multiplies the given matrix with this matrix.
    * @param  {PhotoEditorSDK.Math.ColorMatrix} matrix
    * @return {PhotoEditorSDK.Math.ColorMatrix}
    */

  }, {
    key: 'multiply',
    value: function multiply(matrix) {
      var a = void 0,
          b = void 0,
          c = void 0,
          d = void 0,
          e = void 0,
          f = void 0,
          g = void 0,
          h = void 0,
          i = void 0,
          j = void 0,
          k = void 0,
          l = void 0,
          m = void 0,
          n = void 0,
          o = void 0,
          p = void 0,
          q = void 0,
          r = void 0,
          s = void 0,
          t = void 0;
      // store both factors, so we can swap them easily
      var A = matrix;
      var B = this;

      // transformation
      a = A.a * B.a + A.b * B.f + A.c * B.k + A.d * B.p;
      b = A.a * B.b + A.b * B.g + A.c * B.l + A.d * B.q;
      c = A.a * B.c + A.b * B.h + A.c * B.m + A.d * B.r;
      d = A.a * B.d + A.b * B.i + A.c * B.n + A.d * B.s;

      f = A.f * B.a + A.g * B.f + A.h * B.k + A.i * B.p;
      g = A.f * B.b + A.g * B.g + A.h * B.l + A.i * B.q;
      h = A.f * B.c + A.g * B.h + A.h * B.m + A.i * B.r;
      i = A.f * B.d + A.g * B.i + A.h * B.n + A.i * B.s;

      k = A.k * B.a + A.l * B.f + A.m * B.k + A.n * B.p;
      l = A.k * B.b + A.l * B.g + A.m * B.l + A.n * B.q;
      m = A.k * B.c + A.l * B.h + A.m * B.m + A.n * B.r;
      n = A.k * B.d + A.l * B.i + A.m * B.n + A.n * B.s;

      p = A.p * B.a + A.q * B.f + A.r * B.k + A.s * B.p;
      q = A.p * B.b + A.q * B.g + A.r * B.l + A.s * B.q;
      r = A.p * B.c + A.q * B.h + A.r * B.m + A.s * B.r;
      s = A.p * B.d + A.q * B.i + A.r * B.n + A.s * B.s;

      // translation
      e = A.a * B.e + A.b * B.j + A.c * B.o + A.d * B.t + A.e;
      j = A.f * B.e + A.g * B.j + A.h * B.o + A.i * B.t + A.j;
      o = A.k * B.e + A.l * B.j + A.m * B.o + A.n * B.t + A.o;
      t = A.p * B.e + A.q * B.j + A.r * B.o + A.s * B.t + A.t;

      this.a = a;
      this.b = b;
      this.c = c;
      this.d = d;
      this.e = e;
      this.f = f;
      this.g = g;
      this.h = h;
      this.i = i;
      this.j = j;
      this.k = k;
      this.l = l;
      this.m = m;
      this.n = n;
      this.o = o;
      this.p = p;
      this.q = q;
      this.r = r;
      this.s = s;
      this.t = t;

      return this;
    }

    /**
     * Retuns a clone of the current matrix/
     * @return {PhotoEditorSDK.Math.ColorMatrix}
     */

  }, {
    key: 'clone',
    value: function clone() {
      var matrix = new ColorMatrix();
      matrix.set(this.a, this.b, this.c, this.d, this.e, this.f, this.g, this.h, this.i, this.j, this.k, this.l, this.m, this.n, this.o, this.p, this.q, this.r, this.s, this.t);
      return matrix;
    }

    /**
     * Checks if the values of the given matrix match this matrix's values.
     * @param  {PhotoEditorSDK.Math.ColorMatrix} matrix
     * @return {Boolean}
     */

  }, {
    key: 'equals',
    value: function equals(matrix) {
      return this.a === matrix.a && this.b === matrix.b && this.c === matrix.c && this.d === matrix.d && this.e === matrix.e && this.f === matrix.f && this.g === matrix.g && this.h === matrix.h && this.i === matrix.i && this.j === matrix.j && this.k === matrix.k && this.l === matrix.l && this.m === matrix.m && this.n === matrix.n && this.o === matrix.o && this.p === matrix.p && this.q === matrix.q && this.r === matrix.r && this.s === matrix.s && this.t === matrix.t;
    }

    /**
     * Returns the offset values of this matrix
     * @return {Number[]}
     */

  }, {
    key: 'getOffsets',
    value: function getOffsets() {
      return [this.e, this.j, this.o, this.t];
    }

    /**
     * Returns a string representation of this color matrix
     * @return {String}
     */

  }, {
    key: 'toString',
    value: function toString() {
      return 'ColorMatrix( ' + this.a + ', ' + this.b + ', ' + this.c + ', ' + this.d + ', ' + this.e + ',\n      ' + this.f + ', ' + this.g + ', ' + this.h + ', ' + this.i + ', ' + this.j + ',\n      ' + this.k + ', ' + this.l + ', ' + this.m + ', ' + this.n + ', ' + this.o + ',\n      ' + this.p + ', ' + this.q + ', ' + this.r + ', ' + this.s + ', ' + this.t + ' )';
    }

    /**
     * Returns an array of numbers
     * @return {Number[]}
     */

  }, {
    key: 'toArray',
    value: function toArray() {
      var _this = this;

      return 'abcdefghijklmnopqrst'.split('').map(function (v) {
        return _this[v];
      });
    }

    /**
     * The identity matrix
     * @static
     * @type {PhotoEditorSDK.Math.ColorMatrix}
     */

  }], [{
    key: 'createBrightnessMatrix',


    /**
     * Returns a color matrix that can be used to change the brightness.
     * @param {Number} brightness
     * @return {PhotoEditorSDK.Math.ColorMatrix}
     */
    value: function createBrightnessMatrix(brightness) {
      var matrix = new ColorMatrix();
      matrix.e = brightness;
      matrix.j = brightness;
      matrix.o = brightness;
      return matrix;
    }

    /**
     * Returns a color matrix that can be used to change the contrast.
     * @param {Number} contrast
     * @return {PhotoEditorSDK.Math.ColorMatrix}
     */

  }, {
    key: 'createContrastMatrix',
    value: function createContrastMatrix(contrast) {
      var matrix = new ColorMatrix();
      var t = (1.0 - contrast) / 2.0;
      matrix.a = matrix.g = matrix.m = contrast;
      matrix.e = matrix.j = matrix.o = t;
      return matrix;
    }

    /**
     * Returns a color matrix that can be used to change the saturation.
     * @param {Number} saturation
     * @return {PhotoEditorSDK.Math.ColorMatrix}
     */

  }, {
    key: 'createSaturationMatrix',
    value: function createSaturationMatrix() {
      var saturation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1.0;

      var matrix = new ColorMatrix();
      var invSat = 1 - saturation;
      var r = 0.213 * invSat;
      var g = 0.715 * invSat;
      var b = 0.072 * invSat;

      // first row
      matrix.a = r + saturation;
      matrix.b = g;
      matrix.c = b;
      // second row
      matrix.f = r;
      matrix.g = g + saturation;
      matrix.h = b;
      // third row
      matrix.k = r;
      matrix.l = g;
      matrix.m = b + saturation;
      return matrix;
    }

    /**
     * Returns a color matrix that can be used to change the exposure.
     * @param {Number} saturation
     * @return {PhotoEditorSDK.Math.ColorMatrix}
     */

  }, {
    key: 'createExposureMatrix',
    value: function createExposureMatrix() {
      var exposure = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;

      var scale = Math.pow(2, exposure);
      return new ColorMatrix(scale, 0, 0, 0, 0, 0, scale, 0, 0, 0, 0, 0, scale, 0, 0, 0, 0, 0, 1, 0);
    }

    /**
     * Returns a color matrix that can be used to apply linear changes.
     * @static
     * @param {Number} slope
     * @param {Number} intercept
     * @return {PhotoEditorSDK.Math.ColorMatrix}
     */

  }, {
    key: 'createLinearMatrix',
    value: function createLinearMatrix() {
      var slope = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1.0;
      var intercept = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.0;

      var matrix = new ColorMatrix();
      matrix.a = matrix.g = matrix.m = slope;
      matrix.e = matrix.j = matrix.o = intercept;
      return matrix;
    }
  }, {
    key: 'IDENTITY',
    get: function get() {
      return new ColorMatrix();
    }
  }]);

  return ColorMatrix;
}();

/* harmony default export */ __webpack_exports__["a"] = (ColorMatrix);

/***/ }),
/* 136 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__vendor_promise__ = __webpack_require__(32);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_url__ = __webpack_require__(239);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_url___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_url__);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* global XMLHttpRequest */
/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var TIMEOUT = 5000;

var root = typeof window !== 'undefined' ? window : global;

var JSONLoader = function () {
  function JSONLoader(url) {
    _classCallCheck(this, JSONLoader);

    this._url = url;
    this._parsedUrl = __WEBPACK_IMPORTED_MODULE_2_url___default.a.parse(this._url, true);
  }

  /**
   * Checks if this request is a JSONP request
   * @return {Boolean}
   */


  _createClass(JSONLoader, [{
    key: '_isJSONPRequest',
    value: function _isJSONPRequest() {
      var query = this._parsedUrl.query;

      for (var key in query) {
        var value = query[key];
        if (value === '?') {
          return true;
        }
      }
      return false;
    }

    /**
     * Loads the JSON(P) from the given URL
     * @return {Promise}
     */

  }, {
    key: 'load',
    value: function load() {
      if (this._isJSONPRequest()) {
        return this._loadJSONP();
      } else {
        return this._loadJSON();
      }
    }

    /**
     * Loads the URL as JSON
     * @return {Promise}
     */

  }, {
    key: '_loadJSON',
    value: function _loadJSON() {
      var _this = this;

      return new __WEBPACK_IMPORTED_MODULE_1__vendor_promise__["a" /* default */](function (resolve, reject) {
        var xhr = void 0;
        if (root.XDomainRequest) {
          xhr = new root.XDomainRequest();

          xhr.onload = function () {
            var json = JSON.parse(xhr.responseText);
            resolve(json);
          };
          xhr.onerror = function (e) {
            reject(e);
          };
          xhr.open('GET', _this._url, true);
          xhr.send();
        } else if (root.XMLHttpRequest) {
          xhr = new XMLHttpRequest();

          xhr.onreadystatechange = function (oEvent) {
            if (xhr.readyState === 4) {
              if (xhr.status === 200) {
                var json = JSON.parse(xhr.responseText);
                resolve(json);
              } else {
                reject(new Error('HTTP Status ' + xhr.status));
              }
            }
          };
          xhr.open('GET', _this._url, true);
          xhr.send();
        }
      });
    }

    /**
     * Loads the URL as JSONP
     * @return {Promise}
     */

  }, {
    key: '_loadJSONP',
    value: function _loadJSONP() {
      var _this2 = this;

      var failed = false;
      var succeeded = false;

      var fnName = 'pesdk' + Math.round(Math.random() * 99999999999999);
      return new __WEBPACK_IMPORTED_MODULE_1__vendor_promise__["a" /* default */](function (resolve, reject) {
        var node = _this2._createJSONPNode(fnName);
        root[fnName] = function (result) {
          _this2._removeJSONPNode(node);
          if (!failed) {
            succeeded = true;
            resolve(result);
          }
        };

        root.setTimeout(function () {
          if (!succeeded) {
            _this2._removeJSONPNode(node);
            failed = true;
            reject(new Error('Timeout of 5 seconds exceeded.'));
          }
        }, TIMEOUT);
      });
    }

    /**
     * Creates a JSONP <script> node inside the <head> element
     * @param  {String} fnName
     * @return {DOMElement}
     * @private
     */

  }, {
    key: '_createJSONPNode',
    value: function _createJSONPNode(fnName) {
      var JSONPUrl = this._buildJSONPUrl(fnName);
      var headNode = document.querySelector('head');
      var scriptNode = document.createElement('script');
      scriptNode.src = JSONPUrl;
      headNode.appendChild(scriptNode);
      return scriptNode;
    }

    /**
     * Removes the JSONP <script> node from the <head> element
     * @param  {DOMElement} node
     * @private
     */

  }, {
    key: '_removeJSONPNode',
    value: function _removeJSONPNode(node) {
      node.parentNode.removeChild(node);
    }

    /**
     * Builds a JSONP url for the given function name
     * @param  {String} fnName
     * @return {String}
     */

  }, {
    key: '_buildJSONPUrl',
    value: function _buildJSONPUrl(fnName) {
      // Find JSONP parameter
      var query = this._parsedUrl.query;

      var parameter = null;
      for (var param in query) {
        if (query[param] === '?') {
          parameter = param;
          break;
        }
      }

      delete this._parsedUrl.search;
      query[parameter] = fnName;

      return __WEBPACK_IMPORTED_MODULE_2_url___default.a.format(this._parsedUrl);
    }
  }]);

  return JSONLoader;
}();

/* harmony default export */ __webpack_exports__["a"] = (JSONLoader);
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(41)))

/***/ }),
/* 137 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__vector2__ = __webpack_require__(42);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__vector3__ = __webpack_require__(248);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__rectangle__ = __webpack_require__(126);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__matrix__ = __webpack_require__(125);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__color_matrix__ = __webpack_require__(135);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Vector2", function() { return __WEBPACK_IMPORTED_MODULE_0__vector2__["a"]; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Vector3", function() { return __WEBPACK_IMPORTED_MODULE_1__vector3__["a"]; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Rectangle", function() { return __WEBPACK_IMPORTED_MODULE_2__rectangle__["a"]; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Matrix", function() { return __WEBPACK_IMPORTED_MODULE_3__matrix__["a"]; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "ColorMatrix", function() { return __WEBPACK_IMPORTED_MODULE_4__color_matrix__["a"]; });
/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */







/**
 * Some classes that help us do the math
 * @namespace PhotoEditorSDK.Math
 */


/***/ }),
/* 138 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__exif_orientation_operation__ = __webpack_require__(249);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "ExifOrientationOperation", function() { return __WEBPACK_IMPORTED_MODULE_0__exif_orientation_operation__["a"]; });
/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */

/**
 * @namespace PhotoEditorSDK.Operations
 * @memberof  PhotoEditorSDK
 */


/***/ }),
/* 139 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__constants__ = __webpack_require__(31);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__shared_vendor_promise__ = __webpack_require__(32);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__shared_log__ = __webpack_require__(30);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__engine___ = __webpack_require__(68);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__lib_configurable__ = __webpack_require__(55);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__lib_performance_test__ = __webpack_require__(140);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* jshint unused:false */
/* jshint -W083 */
/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */








/**
 * Base class for Operations
 * @class
 * @alias Operation
 * @extends PhotoEditorSDK.Configurable
 * @memberof PhotoEditorSDK
 */

var Operation = function (_Configurable) {
  _inherits(Operation, _Configurable);

  /**
   * Creates an Operation
   * @param  {PhotoEditorSDK} sdk
   * @param  {Object} [options]
   */
  function Operation(sdk) {
    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

    _classCallCheck(this, Operation);

    var _this = _possibleConstructorReturn(this, (Operation.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(Operation)).call(this, options, {
      enabled: { type: __WEBPACK_IMPORTED_MODULE_4__constants__["OptionType"].BOOLEAN, default: true, serializable: false }
    }));

    _this._sdk = sdk;
    _this._cacheEnabled = false;
    _this._dirtiness = {};

    _this._sprite = new __WEBPACK_IMPORTED_MODULE_7__engine___["a" /* default */].Sprite();
    _this._container = new __WEBPACK_IMPORTED_MODULE_7__engine___["a" /* default */].Container();
    _this._container.addChild(_this._sprite);
    return _this;
  }

  // -------------------------------------------------------------------------- EVENTS

  /**
   * Gets called when options have been changed. Sets this operation to dirty.
   * @private
   */


  _createClass(Operation, [{
    key: '_onOptionsChange',
    value: function _onOptionsChange() {
      this.setDirty(true);
    }

    // -------------------------------------------------------------------------- RENDERING

    /**
     * Applies this operation
     * @param  {PhotoEditorSDK.Engine.RenderTexture} inputTexture
     * @return {Promise}
     * @abstract
     */

  }, {
    key: 'render',
    value: function render(inputTexture) {
      var _this2 = this;

      if (!this.getEnabled()) {
        __WEBPACK_IMPORTED_MODULE_6__shared_log__["a" /* default */].info(this.constructor.name, 'Disabled - skipping');
        return __WEBPACK_IMPORTED_MODULE_5__shared_vendor_promise__["a" /* default */].resolve(inputTexture);
      }

      if (!this._renderTexture) {
        var frame = this._sdk.getSprite().getTexture().getFrame();
        this._renderTexture = new __WEBPACK_IMPORTED_MODULE_7__engine___["a" /* default */].RenderTexture(this._sdk.getRenderer(), frame.width, frame.height);
      }

      var renderer = this._sdk.getRenderer();
      var promise = void 0;
      var perf = void 0;
      if (__WEBPACK_IMPORTED_MODULE_6__shared_log__["a" /* default */].canLog('info')) {
        perf = new __WEBPACK_IMPORTED_MODULE_9__lib_performance_test__["a" /* default */](this.constructor.name, 'Rendering');
      }

      // Handle caching
      if (this.isDirtyForRenderer(renderer)) {
        // Make sure that this Operation's internal sprite has the input texture and that
        // the RenderTexture we're rendering to has the same dimensions
        this._sprite.setTexture(inputTexture);

        var newDimensions = this.getNewDimensions(inputTexture.getDimensions()).floor();
        this._renderTexture.resizeTo(newDimensions);
        this._renderTexture.clear();

        // Let the operation do its work
        promise = this._render(inputTexture).then(function () {
          // Operation has been rendered - not dirty anymore
          _this2.setDirtyForRenderer(false, renderer);
          return _this2._renderTexture;
        });
      } else {
        __WEBPACK_IMPORTED_MODULE_6__shared_log__["a" /* default */].info(this.constructor.name, 'Rendering from cache');
        promise = __WEBPACK_IMPORTED_MODULE_5__shared_vendor_promise__["a" /* default */].resolve(this._renderTexture);
      }

      return promise.then(function (outputTexture) {
        if (perf) perf.stop();
        return outputTexture;
      });
    }

    /**
     * Renders this operation
     * @param  {PhotoEditorSDK.Engine.Texture} inputTexture
     * @return {Promise}
     * @private
     */

  }, {
    key: '_render',
    value: function _render(inputTexture) {
      var renderFn = void 0;
      if (this._sdk.getRenderer().isOfType(__WEBPACK_IMPORTED_MODULE_4__constants__["RendererType"].WEBGL)) {
        /* istanbul ignore next */
        renderFn = this._renderWebGL.bind(this);
      } else {
        renderFn = this._renderCanvas.bind(this);
      }

      return renderFn(inputTexture);
    }

    /**
     * Applies this operation using WebGL
     * @param  {PhotoEditorSDK.Engine.Texture} inputTexture
     * @protected
     * @abstract
     */

  }, {
    key: '_renderWebGL',
    value: function _renderWebGL(inputTexture) {
      throw new Error('Operation#_renderWebGL is abstract and not implemented in inherited class.');
    }

    /**
     * Applies this operation using Canvas2D
     * @param  {PhotoEditorSDK.Engine.Texture} inputTexture
     * @protected
     * @abstract
     */

  }, {
    key: '_renderCanvas',
    value: function _renderCanvas(inputTexture) {
      throw new Error('Operation#_renderCanvas is abstract and not implemented in inherited class.');
    }

    /**
     * Returns the dimensions that an image with the given `dimensions`
     * would have after this operation has been applied
     * @param  {PhotoEditorSDK.Math.Vector2} dimensions
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'getNewDimensions',
    value: function getNewDimensions(dimensions) {
      return dimensions.clone();
    }

    /**
     * Resets this operation
     */

  }, {
    key: 'reset',
    value: function reset() {
      this._dirty = true;
      this._glslPrograms = {};
    }

    // -------------------------------------------------------------------------- DIRTINESS

    /**
     * Checks if this operation is dirty for the given renderer
     * @param  {PhotoEditorSDK.Engine.BaseRenderer}  renderer
     * @return {Boolean}
     */

  }, {
    key: 'isDirtyForRenderer',
    value: function isDirtyForRenderer(renderer) {
      var dirty = this._dirtiness[renderer.id];
      return typeof dirty === 'undefined' ? true : dirty;
    }

    /**
     * Sets the dirtiness for the given renderer
     * @param {Boolean} dirty
     * @param {PhotoEditorSDK.Engine.BaseRenderer} renderer
     * @param {Boolean} dimensionsChanged = false
     */

  }, {
    key: 'setDirtyForRenderer',
    value: function setDirtyForRenderer(dirty, renderer) {
      var dimensionsChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

      this._dirtiness[renderer.id] = dirty;
    }

    /**
     * Sets the dirtiness for all renderers
     * @param {Boolean} dirty
     * @param {Boolean} dimensionsChanged = false
     */

  }, {
    key: 'setDirty',
    value: function setDirty(dirty) {
      var dimensionsChanged = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

      for (var rendererId in this._dirtiness) {
        this.setDirtyForRenderer(dirty, { id: rendererId }, dimensionsChanged);
      }
    }

    /**
     * Returns the instance of {@link PhotoEditorSDK} that this operation belongs to
     * @return {PhotoEditorSDK}
     */

  }, {
    key: 'getSDK',
    value: function getSDK() {
      return this._sdk;
    }

    /**
     * Returns the input dimensions for this operation
     * @param {Boolean} incorporateZoom = true
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'getInputDimensions',
    value: function getInputDimensions() {
      var _this3 = this;

      var incorporateZoom = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;

      var dimensions = this._sdk.getInputDimensions();
      if (incorporateZoom) {
        dimensions.multiply(this._sdk.getZoom()).floor();
      }
      var opFound = void 0;
      this._sdk.getOperationsStack().forEach(function (op) {
        if (opFound) return;
        if (op === _this3) {
          opFound = true;
          return;
        }
        dimensions = op.getNewDimensions(dimensions);
      });
      return dimensions.floor();
    }

    /**
     * Creates a clone of this operation
     * @return {PhotoEditorSDK.Operation}
     */

  }, {
    key: 'clone',
    value: function clone() {
      var Operation = this.constructor;
      return new Operation(this._sdk, this.serializeOptions());
    }

    /**
     * Disposes the RenderTexture
     */

  }, {
    key: 'disposeRenderTextures',
    value: function disposeRenderTextures() {
      if (this._renderTexture) {
        this._renderTexture.dispose();
      }
      this._renderTexture = null;
    }

    /**
     * Disposes this operation
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      this.disposeRenderTextures();
      this._sprite.dispose();
    }
  }]);

  return Operation;
}(__WEBPACK_IMPORTED_MODULE_8__lib_configurable__["a" /* default */]);

/**
 * A unique string that identifies this operation. Can be used to select
 * operations.
 * @type {String}
 */


Operation.identifier = null;

/* harmony default export */ __webpack_exports__["a"] = (Operation);

/***/ }),
/* 140 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__globals__ = __webpack_require__(40);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */


/* istanbul ignore next */
var now = typeof window !== 'undefined' && window.performance && window.performance.now ? window.performance.now.bind(window.performance) : __webpack_require__(129);

/**
 * A simple class that tracks the time between start and end and renders it as FPS
 * @class
 * @memberof PhotoEditorSDK
 * @ignore
 */
/* istanbul ignore next */

var PerformanceTest = function () {
  /**
   * Creates a PerformanceTest
   * @param  {String} tag
   * @param  {String} name
   */
  function PerformanceTest(tag, name) {
    _classCallCheck(this, PerformanceTest);

    this._tag = tag;
    this._name = name;
    this._start = now();
  }

  /**
   * Stops the performance test and prints the result
   */


  _createClass(PerformanceTest, [{
    key: 'stop',
    value: function stop() {
      var end = now();
      var ms = end - this._start;
      var fps = Math.round(1000 / ms);
      __WEBPACK_IMPORTED_MODULE_1__globals__["Log"].info(this._tag, this._name + ' took ' + ms.toFixed(2) + 'ms (' + fps + ' FPS)');
    }
  }]);

  return PerformanceTest;
}();

/* harmony default export */ __webpack_exports__["a"] = (PerformanceTest);

/***/ }),
/* 141 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__globals__ = __webpack_require__(40);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__shared_vendor_promise__ = __webpack_require__(32);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__event_emitter__ = __webpack_require__(52);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */





/**
 * Holds an array of {@link PhotoEditorSDK.Operation} instances and handles their dirtiness
 * @class
 * @memberof PhotoEditorSDK
 */

var OperationsStack = function (_EventEmitter) {
  _inherits(OperationsStack, _EventEmitter);

  /**
   * Creates an OperationsStack
   * @param  {PhotoEditorSDK.Operation[]} [operations = []]
   */
  function OperationsStack() {
    var operations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];

    _classCallCheck(this, OperationsStack);

    var _this = _possibleConstructorReturn(this, (OperationsStack.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(OperationsStack)).call(this));

    _this._onOperationUpdate = _this._onOperationUpdate.bind(_this);

    _this._cacheEnabled = true;
    _this._stack = operations;
    _this._stack.forEach(function (operation) {
      operation.on('update', _this._onOperationUpdate);
    });
    return _this;
  }

  /**
   * Clears this operations stack
   */


  _createClass(OperationsStack, [{
    key: 'clear',
    value: function clear() {
      var _this2 = this;

      this.forEach(function (operation) {
        return _this2.remove(operation);
      });
      this._stack = [];
    }

    /**
     * Checks if the operation has changes/modifications
     * @return {Boolean}
     */

  }, {
    key: 'hasChanges',
    value: function hasChanges() {
      return this._stack.filter(function (op) {
        return !!op;
      }).some(function (op) {
        return op.hasChanges();
      });
    }

    /**
     * Gets called when an operation is about to be updated
     * @param  {PhotoEditorSDK.Operation} operation
     * @param  {Object} options
     * @private
     */

  }, {
    key: '_onOperationUpdate',
    value: function _onOperationUpdate(operation, options) {
      this.emit(__WEBPACK_IMPORTED_MODULE_4__globals__["Constants"].Events.OPERATION_UPDATED, operation, options);
    }

    /**
     * Enables the cache on all operations
     */

  }, {
    key: 'enableCache',
    value: function enableCache() {
      this._cacheEnabled = true;
    }

    /**
     * Disables the cache on all operations
     */

  }, {
    key: 'disableCache',
    value: function disableCache() {
      this._cacheEnabled = false;
    }

    /**
     * Passes Array#forEach
     * @param  {Function} iterator
     * @return {Array}
     */

  }, {
    key: 'forEach',
    value: function forEach(iterator) {
      return this._stack.filter(function (op) {
        return !!op;
      }).forEach(iterator);
    }

    /**
     * Renders all operations
     * @param  {PhotoEditorSDK} sdk
     * @param  {PhotoEditorSDK.Engine.Texture} inputTexture
     * @return {Promise}
     */

  }, {
    key: 'render',
    value: function render(sdk, inputTexture) {
      var _this3 = this;

      var currentTexture = inputTexture;
      var operations = this._stack.filter(function (op) {
        return !!op;
      }).filter(function (op) {
        return op.getEnabled();
      });

      // Find first operation from end of array that is not dirty
      operations.reverse();
      var firstUndirtyOperation = operations.filter(function (o) {
        return !o.isDirtyForRenderer(sdk.getRenderer());
      })[0];
      var firstUndirtyIndex = operations.indexOf(firstUndirtyOperation);

      operations.reverse();

      // Skip operations that would be overwritten by succeeding operations
      var startIndex = 0;
      if (firstUndirtyIndex !== -1) {
        startIndex = operations.length - firstUndirtyIndex - 1;
      }

      for (var index = 0; index < startIndex; index++) {
        __WEBPACK_IMPORTED_MODULE_4__globals__["Log"].info(this.constructor.name, 'Skipping ' + operations[index].constructor.name);
      }

      var promise = __WEBPACK_IMPORTED_MODULE_5__shared_vendor_promise__["a" /* default */].resolve(currentTexture);

      var _loop = function _loop(_index) {
        var operation = operations[_index];
        var lastTexture = void 0,
            lastTextureOperation = void 0;
        promise = promise.then(function (inputTexture) {
          return operation.render(inputTexture).then(function (outputTexture) {
            // If cache is disabled, flush textures of previous operation
            if (lastTexture && outputTexture !== lastTexture && !_this3._cacheEnabled) {
              lastTextureOperation.disposeRenderTextures();
            }
            lastTexture = outputTexture;
            lastTextureOperation = operation;
            return outputTexture;
          });
        });
      };

      for (var _index = startIndex; _index < operations.length; _index++) {
        _loop(_index);
      }

      return promise;
    }

    /**
     * Validates the settings of all operations
     * @return {Promise}
     */

  }, {
    key: 'validateSettings',
    value: function validateSettings() {
      return __WEBPACK_IMPORTED_MODULE_5__shared_vendor_promise__["a" /* default */].all(this._stack.filter(function (op) {
        return !!op;
      }).map(function (op) {
        return op.validateSettings();
      }));
    }

    /**
     * Sets all operations to dirty
     * @param {Boolean} dimensionsChanged = falses
     */

  }, {
    key: 'setAllToDirty',
    value: function setAllToDirty() {
      var dimensionsChanged = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;

      this.forEach(function (op) {
        return op.setDirty(true, dimensionsChanged);
      });
    }

    /**
     * Finds the first dirty operation and sets all following operations to dirty
     * @param {PhotoEditorSDK.Engine.BaseRenderer} renderer
     */

  }, {
    key: 'updateDirtinessForRenderer',
    value: function updateDirtinessForRenderer(renderer) {
      var dirtyFound = false;
      for (var i = 0; i < this._stack.length; i++) {
        var _operation = this._stack[i];
        if (!_operation) continue;
        if (_operation.isDirtyForRenderer(renderer)) {
          dirtyFound = true;
        }

        if (dirtyFound) {
          _operation.setDirtyForRenderer(true, renderer);
        }
      }
    }

    /**
     * Adds the given operation to this stack
     * @param {PhotoEditorSDK.Operation} operation
     */

  }, {
    key: 'push',
    value: function push(operation) {
      this._stack.push(operation);
      operation.on('update', this._onOperationUpdate);
    }

    /**
     * Adds the given operation before all existing operations
     * @param  {PhotoEditorSDK.Operation} operation
     */

  }, {
    key: 'unshift',
    value: function unshift(operation) {
      this._stack.unshift(operation);
      operation.on('update', this._onOperationUpdate);
    }

    /**
     * Returns a cloned instance of this stack
     * @return {PhotoEditorSDK.OperationsStack}
     */

  }, {
    key: 'clone',
    value: function clone() {
      return new OperationsStack(this._stack.slice(0));
    }

    /**
     * Returns the operation at the given index
     * @param  {Number} index
     * @return {PhotoEditorSDK.Operation}
     */

  }, {
    key: 'get',
    value: function get(index) {
      return this._stack[index];
    }

    /**
     * Returns the first operation found with the given identifier
     * @param  {identifier} string
     * @return {PhotoEditorSDK.Operation}
     */

  }, {
    key: 'getByIdentifier',
    value: function getByIdentifier(identifier) {
      return __WEBPACK_IMPORTED_MODULE_4__globals__["Utils"].Array.find(this._stack, function (item) {
        return item && item.constructor.identifier === identifier;
      });
    }

    /**
     * Sets the operation at the given index to the given one
     * @param  {Number} index
     * @param  {PhotoEditorSDK.Operation} operation
     */

  }, {
    key: 'set',
    value: function set(index, operation) {
      if (this._stack[index]) {
        this._stack[index].off('update', this._onOperationUpdate);
        this._stack[index].dispose();
      }
      this._stack[index] = operation;
      operation.on('update', this._onOperationUpdate);
    }

    /**
     * Removes the given operation
     * @param  {PhotoEditorSDK.Operation} operation
     */

  }, {
    key: 'remove',
    value: function remove(operation) {
      var index = this._stack.indexOf(operation);
      if (index === -1) {
        return;
      }
      if (this._stack[index]) {
        this._stack[index].off('update', this._onOperationUpdate);
        this._stack[index].dispose();
      }
      this._stack.splice(index, 1);
    }

    /**
     * Removes the operation at the given index
     * @param  {Number} index
     */

  }, {
    key: 'removeAt',
    value: function removeAt(index) {
      if (this._stack[index]) {
        this._stack[index].off('update', this._onOperationUpdate);
        this._stack[index].dispose();
      }
      delete this._stack[index];
    }

    /**
     * Returns the stack
     * @return {PhotoEditorSDK.Operation[]}
     */

  }, {
    key: 'getStack',
    value: function getStack() {
      return this._stack;
    }
  }, {
    key: 'dispose',
    value: function dispose() {
      this.forEach(function (operation) {
        operation.dispose();
      });
    }
  }]);

  return OperationsStack;
}(__WEBPACK_IMPORTED_MODULE_6__event_emitter__["a" /* default */]);

/* harmony default export */ __webpack_exports__["a"] = (OperationsStack);

/***/ }),
/* 142 */
/***/ (function(module, exports) {

module.exports = {"name":"photoeditorsdk","version":"4.10.0","description":"The most comprehensive photo editor SDK for HTML5","repository":"http://github.com/imgly/pesdk-html5","author":"PhotoEditorSDK (9elements GmbH) <contact@photoeditorsdk.com>","license":"SEE LICENSE IN LICENSE.md","bin":{},"scripts":{"start":"npm run watch","release":"cross-env PESDK_CLEAN=true PESDK_ASSETS=true PESDK_RELEASE=true webpack --progress --colors && cross-env npm run prerender-desktop-css && rimraf build/examples/qa-* && rimraf build/examples/ci-* && rimraf build/**/dev.*","release:production":"cross-env ENV=production npm run release && rm -rf build/examples/shared","release:test":"cross-env ENV=test PESDK_CLEAN=true PESDK_ASSETS=true webpack && npm run prerender-desktop-css","release:development":"cross-env ENV=development PESDK_CLEAN=true PESDK_ASSETS=true npm run release","lint":"eslint --ext .jsx,.js src/js","lint:test":"eslint --ext .jsx,.js test","lint:sdk":"eslint --ext .jsx,.js src/js/sdk","lint:ui":"eslint --ext .jsx,.js src/js/ui","lint:ui:react-ui":"eslint --ext .jsx,.js src/js/ui/react-ui","lint:ui:desktop-ui":"eslint --ext .jsx,.js src/js/ui/desktop-ui","build":"cross-env PESDK_CLEAN=true PESDK_ASSETS=true webpack","rebuild":"cross-env PESDK_ASSETS=true webpack --progress --color","clean":"rimraf build/* doc/* dist/*","watch":"cross-env PESDK_CLEAN=true PESDK_ASSETS=true PESDK_SERVE=true webpack --watch --progress --colors","watch:test":"cross-env PESDK_CLEAN=true PESDK_ASSETS=true ENV=test webpack --watch --progress --colors","watch:production":"cross-env PESDK_CLEAN=true PESDK_ASSETS=true PESDK_SERVE=true webpack --watch --progress --colors","test":"npm run test:sdk && npm run test:ui && npm run test:ui:react-ui && npm run test:desktop-ui && npm run server","test:ui":"cross-env ENV=test node_modules/.bin/mocha --require test/sdk/support/modules --require test/sdk/support/helpers test/ui","test:sdk":"cross-env ENV=test node_modules/.bin/mocha --require test/sdk/support/modules --require test/sdk/support/helpers test/sdk","test:ui:react-ui":"cross-env ENV=test node --stack-size=65500 node_modules/.bin/mocha --require test/react-ui/support/helpers test/shared/run-server.js \"test/react-ui/*.test.js\" \"test/react-ui/**/*.test.js\"","test:ui:desktop-ui":"cross-env ENV=test node --stack-size=65500  node_modules/.bin/mocha --require test/desktop-ui/support/helpers test/shared/run-server.js \"test/desktop-ui/*.test.js\" \"test/desktop-ui/**/*.test.js\"","test:server":"cross-env ENV=test node --stack-size=65500 node_modules/.bin/mocha --require test/sdk/support/modules --require test/server/support/helpers test/shared/run-server.js \"test/server/*.test.js\" \"test/server/**/*.test.js\"","test:comparison":"cross-env ENV=test node --stack-size=65500 node_modules/.bin/mocha --require test/sdk/support/modules --require test/comparison/support/helpers \"test/comparison/*.test.js\" \"test/comparison/**/*.test.js\"","test:webgl":"cross-env RENDERER=webgl ENV=test node_modules/.bin/mocha --require test/sdk/support/modules --require test/sdk/support/helpers test/sdk","jsdoc":"rimraf doc/photoeditorsdk && jsdoc -c config/jsdoc/jsdoc.json -r","jsdoc:server":"rimraf doc/photoeditorsdk-server && jsdoc -c config/jsdoc/jsdoc.server.json -r","render-filter-previews":"node scripts/run render-filter-previews","prerender-desktop-css":"node scripts/run render-desktop-ui-css","dist:sdk":"rimraf dist/photoeditorsdk && cp -r build/photoeditorsdk/ dist/photoeditorsdk && find dist/photoeditorsdk -d 2 -name '*.min.*'  | sed 'p;s/.min././' | xargs -n2 cp && npm run jsdoc","dist:server":"rimraf dist/photoeditorsdk-server && cp -r build/photoeditorsdk-server/ dist/photoeditorsdk-server && find dist/photoeditorsdk-server -d 2 -name '*.min.*'  | sed 's/.min././' | xargs -n1 rm && npm run jsdoc:server","precommit":"true","prepush":"npm run lint"},"devDependencies":{"adonis":"git://github.com/imgly/adonis.git#v1.0.1","ajv":"^5.5.1","babel-core":"^6.26.0","babel-eslint":"^8.2.1","babel-loader":"^7.1.2","babel-minify-webpack-plugin":"^0.2.0","babel-plugin-external-helpers":"^6.22.0","babel-plugin-transform-adonis-hash":"^0.4.0","babel-plugin-transform-class-properties":"^6.19.0","babel-plugin-transform-es2015-classes":"^6.6.4","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-plugin-transform-proto-to-assign":"^6.26.0","babel-plugin-transform-runtime":"^6.6.0","babel-preset-env":"^1.6.1","babel-preset-es2015":"^6.6.0","babel-preset-minify":"^0.2.0","babel-preset-react":"^6.5.0","babel-preset-stage-3":"^6.24.1","babel-register":"^6.26.0","babel-runtime":"^6.26.0","chai":"^3.4.0","chai-as-promised":"^5.1.0","chalk":"^2.4.1","chromedriver":"^2.37.0","circular-json-es6":"^2.0.2","classnames":"^2.1.3","clean-webpack-plugin":"^0.1.16","compass-mixins":"^0.12.8","copy-webpack-plugin":"^4.3.0","cross-env":"^5.1.1","css-loader":"^0.28.7","del":"^2.0.0","djv":"^1.2.0","eslint":"^4.16.0","eslint-config-standard":"^11.0.0","eslint-plugin-import":"^2.10.0","eslint-plugin-mocha":"^5.0.0","eslint-plugin-node":"^6.0.1","eslint-plugin-promise":"^3.7.0","eslint-plugin-standard":"^3.0.1","express":"^4.16.2","extract-text-webpack-plugin":"^3.0.2","husky":"^0.14.3","inquirer":"^0.11.4","inquirer-path":"^1.0.0-beta5","isomorphic-fetch":"^2.2.1","jaguarjs-jsdoc":"git://github.com/imgly/jaguarjs-jsdoc.git#master","jsdoc":"^3.5.5","json-loader":"^0.5.7","lodash":"^4.17.4","minimist":"^1.2.0","mkdirp":"^0.5.1","mocha":"^3.5.3","nightwatch":"git://github.com/imgly/nightwatch.git#feature/file-upload-and-multiple-selectors","node-sass":"^4.7.2","node-static":"^0.7.10","optimize-css-assets-webpack-plugin":"^3.2.0","performance-now":"^0.2.0","pixelmatch":"^4.0.2","pngjs":"^3.3.2","preprocess-loader":"^0.2.2","pretty-error":"^2.0.0","prompt":"^1.0.0","prop-types":"^15.6.0","raw-loader":"^0.5.1","react":"^16.2.0","react-dom":"^16.2.0","rembrandt":"^0.1.3","rimraf":"^2.6.2","sass-loader":"^6.0.6","selenium-server-standalone-jar":"3.4.0","should":"^4.3.0","sinon":"^1.17.3","sinon-chai":"^2.14.0","standard":"^9.0.2","standard-loader":"^6.0.1","stats.js":"^0.16.0","style-loader":"^0.13.1","term-img2":"^2.0.1","transform-loader":"^0.2.2","uglifyjs-webpack-plugin":"^1.2.5","vinyl-source-stream":"0.1.1","webpack":"^3.10.0","webpack-notifier":"^1.2.1"},"standard":{"globals":["describe","context","before","beforeEach","after","afterEach","it","expect"],"parser":"babel-eslint"},"dependencies":{"canvas":"git://github.com/Automattic/node-canvas.git#v2.0.0-alpha.12","gl":"^4.0.4","opn":"^5.3.0","request":"^2.83.0"}}

/***/ }),
/* 143 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */


var ColorMatrix = __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Math"].ColorMatrix;

var EPSILON = 0.0000001;

var AdjustmentsFilter = function (_Engine$Filter) {
  _inherits(AdjustmentsFilter, _Engine$Filter);

  function AdjustmentsFilter() {
    _classCallCheck(this, AdjustmentsFilter);

    var _this = _possibleConstructorReturn(this, (AdjustmentsFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(AdjustmentsFilter)).call(this));

    _this._fragmentSource = __webpack_require__(263);
    return _this;
  }

  /**
   * Applies this filter to the given inputTarget and renders it to
   * the given outputTarget using the CanvasRenderer
   * @param  {CanvasRenderer} renderer
   * @param  {RenderTarget} inputTarget
   * @param  {RenderTarget} outputTarget
   * @param  {Boolean} clear = false
   * @private
   */


  _createClass(AdjustmentsFilter, [{
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var canvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();
      var outputContext = outputTarget.getContext();

      var imageData = inputContext.getImageData(0, 0, canvas.width, canvas.height);

      var _options = this._options,
          colorMatrix = _options.colorMatrix,
          gamma = _options.gamma,
          shadows = _options.shadows,
          highlights = _options.highlights;

      var applyGamma = gamma !== 1;
      var applyShadowsAndHighlights = shadows !== 0 || highlights !== 0;

      var color = new __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Color"](0, 0, 0, 0);

      for (var i = 0; i < canvas.width * canvas.height; i++) {
        var index = i * 4;

        color.r = imageData.data[index] / 255;
        color.g = imageData.data[index + 1] / 255;
        color.b = imageData.data[index + 2] / 255;

        // Gamma
        if (applyGamma) {
          color.r = Math.pow(color.r, 1.0 / Math.max(gamma, EPSILON));
          color.g = Math.pow(color.g, 1.0 / Math.max(gamma, EPSILON));
          color.b = Math.pow(color.b, 1.0 / Math.max(gamma, EPSILON));
        }

        // Apply shadows and highlights
        if (applyShadowsAndHighlights) {
          var luminance = color.r * 0.2125 + color.g * 0.7154 + color.b * 0.0721;

          var shadow = shadows >= 0 ? __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Utils"].clamp(Math.pow(luminance, 1 / (shadows + 1)) + Math.pow(luminance, 2 / (shadows + 1)) * -0.76 - luminance, 0, Math.max(shadows, 1)) : -__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Utils"].clamp(Math.pow(luminance, 1 / (-shadows + 1)) + Math.pow(luminance, 2 / (-shadows + 1)) * -0.76 - luminance, 0, Math.max(-shadows, 1));

          var highlight = highlights < 0 ? __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Utils"].clamp(1 - Math.pow(1 - luminance, 1 / (1 - highlights)) - Math.pow(1 - luminance, 2 / (1 - highlights)) * -0.8 - luminance, -1, 0) : -__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Utils"].clamp(1 - Math.pow(1 - luminance, 1 / (1 + highlights)) - Math.pow(1 - luminance, 2 / (1 + highlights)) * -0.8 - luminance, -1, 0);

          var shadowContrast = shadow * luminance * luminance;
          var shadowBrightness = shadow - shadowContrast;

          var offset = luminance + shadowContrast + highlight;
          color.r = __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Utils"].clamp(offset * ((color.r + shadowBrightness) / Math.max(luminance, EPSILON)), 0, 1);
          color.g = __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Utils"].clamp(offset * ((color.g + shadowBrightness) / Math.max(luminance, EPSILON)), 0, 1);
          color.b = __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Utils"].clamp(offset * ((color.b + shadowBrightness) / Math.max(luminance, EPSILON)), 0, 1);
        }

        // Brightness, saturation, contrast, exposire
        color = colorMatrix.apply(color);

        // Apply colors
        imageData.data[index] = color.r * 255;
        imageData.data[index + 1] = color.g * 255;
        imageData.data[index + 2] = color.b * 255;
      }

      outputContext.putImageData(imageData, 0, 0);
    }
  }]);

  return AdjustmentsFilter;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].Filter);

AdjustmentsFilter.prototype.availableOptions = {
  gamma: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 1, uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT },
  shadows: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 0, uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT },
  highlights: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 1, uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT },
  colorMatrix: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].COLOR_MATRIX, default: new ColorMatrix(), uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].MAT4 },
  colorOffset: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].ARRAY, default: [], uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT4 }
};

/* harmony default export */ __webpack_exports__["a"] = (AdjustmentsFilter);

/***/ }),
/* 144 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__vendor_stack_blur__ = __webpack_require__(75);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__vendor_stack_blur___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6__vendor_stack_blur__);






var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var Vector2 = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Math"].Vector2;

var BlurFilter = function (_Engine$Filter) {
  _inherits(BlurFilter, _Engine$Filter);

  function BlurFilter() {
    var _ref;

    _classCallCheck(this, BlurFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = BlurFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(BlurFilter)).call.apply(_ref, [this].concat(args)));

    _this._fragmentSource = __webpack_require__(267);

    _this._lastBlurRadius = null;
    _this._lastDimensions = new Vector2(0, 0);

    _this._blurredRenderTarget = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].CanvasRenderTarget(100, 100, 1);
    return _this;
  }

  /**
   * Applies this filter to the given inputTarget and renders it to
   * the given outputTarget using the CanvasRenderer
   * @param  {CanvasRenderer} renderer
   * @param  {RenderTarget} inputTarget
   * @param  {RenderTarget} outputTarget
   * @param  {Boolean} clear = false
   * @private
   */


  _createClass(BlurFilter, [{
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var inputDimensions = inputTarget.getDimensions();
      var dimensionsChanged = !this._lastDimensions.equals(inputDimensions);

      this._blurredRenderTarget.setPixelRatio(inputTarget.getPixelRatio());
      this._blurredRenderTarget.resizeTo(inputTarget.getDimensions());

      outputTarget.setPixelRatio(inputTarget.getPixelRatio());
      outputTarget.resizeTo(inputTarget.getDimensions());

      if (this._lastBlurRadius !== this._options.blurRadius || dimensionsChanged) {
        this._blurImage(inputTarget);
        this._lastBlurRadius = this._options.blurRadius;
      }

      var outputContext = outputTarget.getContext();
      outputContext.drawImage(this._blurredRenderTarget.getCanvas(), 0, 0);

      this._lastDimensions.copy(inputDimensions);
    }

    /**
     * Creates a blurred copy of the image
     * @param  {CanvasRenderTarget} inputTarget
     * @return {Canvas}
     * @private
     */

  }, {
    key: '_blurImage',
    value: function _blurImage(inputTarget) {
      var inputCanvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();

      var inputDimensions = new Vector2(inputCanvas.width, inputCanvas.height);
      var blurryImageData = inputContext.getImageData(0, 0, inputCanvas.width, inputCanvas.height);
      __WEBPACK_IMPORTED_MODULE_6__vendor_stack_blur___default.a.stackBlurCanvasRGBA(blurryImageData, 0, 0, inputCanvas.width, inputCanvas.height, this._options.blurRadius * inputDimensions.min());

      var outputContext = this._blurredRenderTarget.getContext();
      outputContext.putImageData(blurryImageData, 0, 0);
    }

    /**
     * Disposes this filter
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      _get(BlurFilter.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(BlurFilter.prototype), 'dispose', this).call(this);
      this._blurredRenderTarget.dispose();
    }
  }]);

  return BlurFilter;
}(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].Filter);

BlurFilter.prototype.availableOptions = {
  blurRadius: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 30, uniformType: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["UniformType"].FLOAT },
  delta: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(1, 1), uniformType: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["UniformType"].FLOAT2 },
  texSize: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(100, 100), uniformType: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["UniformType"].FLOAT2 }
};

/* harmony default export */ __webpack_exports__["a"] = (BlurFilter);

/***/ }),
/* 145 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__filter__ = __webpack_require__(7);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * Identity Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var IdentityFilter = function (_Filter) {
  _inherits(IdentityFilter, _Filter);

  function IdentityFilter() {
    _classCallCheck(this, IdentityFilter);

    return _possibleConstructorReturn(this, (IdentityFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(IdentityFilter)).apply(this, arguments));
  }

  _createClass(IdentityFilter, [{
    key: 'render',

    /**
     * Renders the filter
     * @param  {PhotoEditorSDK} sdk
     * @param  {Engine.RenderTexture}
     * @return {Promise}
     */
    value: function render(sdk, inputTexture, outputTexture) {
      return __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Promise"].resolve(outputTexture);
    }

    /**
     * Checks if the operation has changes/modifications
     * @return {Boolean}
     */

  }, {
    key: 'hasChanges',
    value: function hasChanges() {
      return false;
    }
  }]);

  return IdentityFilter;
}(__WEBPACK_IMPORTED_MODULE_5__filter__["a" /* default */]);

IdentityFilter.isIdentity = true;

/**
 * This filter's identifier
 * @type {String}
 * @default
 */
IdentityFilter.identifier = 'identity';

/* harmony default export */ __webpack_exports__["a"] = (IdentityFilter);

/***/ }),
/* 146 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__primitive__ = __webpack_require__(12);






var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var LookupTableFilter = function (_Engine$Filter) {
  _inherits(LookupTableFilter, _Engine$Filter);

  function LookupTableFilter() {
    var _ref;

    _classCallCheck(this, LookupTableFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = LookupTableFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(LookupTableFilter)).call.apply(_ref, [this].concat(args)));

    _this._fragmentSource = __webpack_require__(287);
    return _this;
  }

  /**
   * Applies this filter to the given inputTarget and renders it to
   * the given outputTarget using the CanvasRenderer
   * @param  {CanvasRenderer} renderer
   * @param  {RenderTarget} inputTarget
   * @param  {RenderTarget} outputTarget
   * @param  {Boolean} clear = false
   * @private
   */


  _createClass(LookupTableFilter, [{
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var canvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();
      var outputContext = outputTarget.getContext();

      var imageData = inputContext.getImageData(0, 0, canvas.width, canvas.height);

      var table = this._options.lookupTableData;
      for (var i = 0; i < canvas.width * canvas.height; i++) {
        var index = i * 4;

        var r = imageData.data[index];
        imageData.data[index] = table[r * 4];
        var g = imageData.data[index + 1];
        imageData.data[index + 1] = table[1 + g * 4];
        var b = imageData.data[index + 2];
        imageData.data[index + 2] = table[2 + b * 4];
      }

      outputContext.putImageData(imageData, 0, 0);
    }
  }]);

  return LookupTableFilter;
}(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].Filter);

/**
 * Specifies the available options for this filter
 * @type {Object}
 * @ignore
 */


LookupTableFilter.prototype.availableOptions = {
  lookupTable: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 1, uniformType: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["UniformType"].INT },
  lookupTableData: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].ARRAY, default: [] }

  /**
   * Stores a 256 byte long lookup table in a 2d texture which will be
   * used to look up the corresponding value for each channel.
   * @class
   * @extends PhotoEditorSDK.Filters.Primitive
   * @memberof PhotoEditorSDK.FilterPrimitives
   */
};
var LookupTable = function (_Primitive) {
  _inherits(LookupTable, _Primitive);

  function LookupTable() {
    var _ref2;

    _classCallCheck(this, LookupTable);

    for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
      args[_key2] = arguments[_key2];
    }

    var _this2 = _possibleConstructorReturn(this, (_ref2 = LookupTable.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(LookupTable)).call.apply(_ref2, [this].concat(args)));

    _this2._filter = new LookupTableFilter({
      lookupTable: _this2._options.textureGLUnit
    });
    _this2._textures = {};
    _this2._renderers = {};
    return _this2;
  }

  /**
   * Gets called before this primitive's filter is being applied
   * @param {PhotoEditorSDK} sdk
   */


  _createClass(LookupTable, [{
    key: 'update',
    value: function update(sdk) {
      var renderer = sdk.getRenderer();

      /* istanbul ignore if */
      if (renderer.isOfType(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["RendererType"].WEBGL)) {
        this._updateWebGLTexture(sdk);
      } else if (renderer.isOfType(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["RendererType"].CANVAS)) {
        this._filter.setLookupTableData(this._options.data);
      }
    }

    /**
     * Updates the lookup table texture (WebGL only)
     * @param {PhotoEditorSDK} sdk
     * @private
     */
    /* istanbul ignore next */

  }, {
    key: '_updateWebGLTexture',
    value: function _updateWebGLTexture(sdk) {
      if (typeof this._options.data === 'undefined') {
        throw new Error('LookupTable: No data specified.');
      }

      var data = new Uint8Array(this._options.data);

      var renderer = sdk.getRenderer();
      var id = renderer.id;

      this._renderers[id] = renderer;
      if (!this._textures[id]) {
        this._textures[id] = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].BaseTexture();
      }

      var texture = this._textures[id];
      var pixelArrayImage = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].PixelArrayImage(256, 1, data);
      texture.setSource(pixelArrayImage);
      texture.setGLUnit(this._options.textureGLUnit);

      /* istanbul ignore next */
      if (renderer.isOfType(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["RendererType"].WEBGL)) {
        renderer.updateTexture(texture);
      }
    }

    /**
     * Cleans up this primitive
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      _get(LookupTable.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(LookupTable.prototype), 'dispose', this).call(this);
      for (var id in this._textures) {
        this._textures[id].dispose();
        delete this._textures[id];
      }
      delete this._options.data;
    }
  }]);

  return LookupTable;
}(__WEBPACK_IMPORTED_MODULE_6__primitive__["a" /* default */]);

/* harmony default export */ __webpack_exports__["a"] = (LookupTable);

/***/ }),
/* 147 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__brush_path__ = __webpack_require__(344);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__sprite__ = __webpack_require__(56);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__brush_brushes_brush__ = __webpack_require__(148);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__brush_brushes_radial_brush__ = __webpack_require__(346);






var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */







var Vector2 = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Math"].Vector2;

/**
 * A Brush that can be drawn by SpriteOperation. Should only be created via {@link PhotoEditorSDK.Operations.SpriteOperation#createBrush}
 * @class
 * @memberof PhotoEditorSDK.Operations.SpriteOperation
 */

var BrushSprite = function (_Sprite) {
  _inherits(BrushSprite, _Sprite);

  /**
   * Creates a new Sticker
   * @param  {PhotoEditorSDK.Operations.SpriteOperation} operation
   * @param  {Object} [options]
   */
  function BrushSprite() {
    var _ref;

    _classCallCheck(this, BrushSprite);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = BrushSprite.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(BrushSprite)).call.apply(_ref, [this].concat(args)));

    _this._persistedPaths = [];
    _this._outputCanvasDirty = true;
    _this._outputCanvas = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].createCanvas();
    _this._outputContext = _this._outputCanvas.getContext('2d');
    _this._persistCanvas = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].createCanvas();
    _this._persistContext = _this._persistCanvas.getContext('2d');
    _this._nextCanvas = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].createCanvas();

    _this._texture = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].Texture.fromCanvas(_this._outputCanvas);
    _this._sprite.setTexture(_this._texture);

    _this._onPathUpdate = _this._onPathUpdate.bind(_this);
    return _this;
  }

  /**
   * Applies a flip in the given direction
   * @param  {String} direction
   */


  _createClass(BrushSprite, [{
    key: 'applyFlip',
    value: function applyFlip(direction) {
      this._options.paths.forEach(function (path) {
        path.forEachControlPoint(function (controlPoint) {
          var position = controlPoint.getPosition().clone();
          switch (direction) {
            case 'horizontal':
              position.x = 1 - position.x;
              break;
            case 'vertical':
              position.y = 1 - position.y;
              break;
          }
          controlPoint.setPosition(position);
        });
        path.setDirty(true);
      });

      this._reset();
    }

    /**
     * Applies a rotation with the given degrees
     * @param  {Number} degrees
     */

  }, {
    key: 'applyRotation',
    value: function applyRotation(degrees) {
      this._options.paths.forEach(function (path) {
        path.forEachControlPoint(function (controlPoint) {
          var position = controlPoint.getPosition().clone();
          if (degrees === 90) {
            position.flip();
            position.x = 1 - position.x;
          } else if (degrees === -90) {
            position.flip();
            position.y = 1 - position.y;
          }
          controlPoint.setPosition(position);
        });

        path.setDirty(true);
      });

      this._reset();
    }

    /**
     * Applies the given transform change
     * @param  {PhotoEditorSDK.Operations.TransformOperation.TransformChange} transformChange
     * @private
     */

  }, {
    key: 'applyTransform',
    value: function applyTransform(transformChange) {
      var lastBrush = null;
      this._options.paths.forEach(function (path) {
        path.forEachControlPoint(function (controlPoint) {
          controlPoint.setPosition(transformChange.applyToRelativePoint(controlPoint.getPosition()));
        });

        // Brushes can be re-used across paths
        var brush = path.getBrush();
        if (brush !== lastBrush) {
          brush.setSize(transformChange.applyToRelativeSize(brush.getSize()));
          lastBrush = brush;
        }
        path.setDirty(true);
      });

      // Update
      this._reset();
    }

    /**
     * Clears the canvas
     */

  }, {
    key: 'clearCanvas',
    value: function clearCanvas() {
      if (!this._outputCanvas) {
        // `clearCanvas` is called when paths are set in Sprite's constructor. At this
        // point, `this._outputCanvas` does not exist yet.
        return;
      }

      this._outputCanvasDirty = true;

      var _outputCanvas = this._outputCanvas,
          width = _outputCanvas.width,
          height = _outputCanvas.height;

      this._outputContext.clearRect(0, 0, width, height);
    }

    /**
     * Clears the persist canvas
     */

  }, {
    key: 'clearPersistCanvas',
    value: function clearPersistCanvas() {
      if (!this._persistCanvas) {
        // `clearCanvas` is called when paths are set in Sprite's constructor. At this
        // point, `this._persistCanvas` does not exist yet.
        return;
      }

      var _persistCanvas = this._persistCanvas,
          width = _persistCanvas.width,
          height = _persistCanvas.height;

      this._persistContext.clearRect(0, 0, width, height);
    }

    /**
     * Returns a serialized version of this configurable
     * @param {String[]} keys
     * @param {Boolean} toObject = false
     * @return {Object}
     */

  }, {
    key: 'serializeOptions',
    value: function serializeOptions(keys) {
      var toObject = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

      var options = _get(BrushSprite.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(BrushSprite.prototype), 'serializeOptions', this).call(this, keys, toObject);
      if (!keys) options.type = 'brush';
      return options;
    }

    /**
     * Returns a serialized version of the given option
     * @param {String} optionName
     * @param {Boolean} toObject = false
     * @return {*}
     */

  }, {
    key: 'serializeOption',
    value: function serializeOption(optionName) {
      var toObject = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

      if (optionName === 'paths') {
        return this._options.paths.map(function (path) {
          return path.serializeOptions(undefined, toObject);
        });
      }

      return _get(BrushSprite.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(BrushSprite.prototype), 'serializeOption', this).call(this, optionName, toObject);
    }

    /**
     * Creates and adds a new path
     * @param {PhotoEditorSDK.Operations.SpriteOperation.BrushSprite.Brush} brush
     * @return {PhotoEditorSDK.Operations.SpriteOperation.BrushSprite.Path}
     */

  }, {
    key: 'createPath',
    value: function createPath(brush) {
      var path = new __WEBPACK_IMPORTED_MODULE_6__brush_path__["a" /* default */](this._operation, { brush: brush }, this._nextCanvas);
      path.on('update', this._onPathUpdate);
      this._options.paths.push(path);
      this.setDirty(true);
      return path;
    }

    /**
     * Gets called when a path has been updated
     * @private
     */

  }, {
    key: '_onPathUpdate',
    value: function _onPathUpdate() {
      this._operation.setDirty(true);
      this.setDirty(true);
    }

    /**
     * Gets called when a path has been closed / persisted
     * @param  {PhotoEditorSDK.Operations.SpriteOperation.BrushSprite.Path} path
     * @private
     */

  }, {
    key: '_onPathPersist',
    value: function _onPathPersist(path) {
      path.renderToCanvas(this._persistCanvas);
      this._nextCanvas = path.getCanvas();

      var context = this._nextCanvas.getContext('2d');
      context.clearRect(0, 0, this._nextCanvas.width, this._nextCanvas.height);

      this._persistedPaths.push(path);
    }

    /**
     * Returns the Texture for the sprite that should be rendered
     * @return {PhotoEditorSDK.Engine.Texture}
     * @private
     * @abstract
     */

  }, {
    key: '_getTexture',
    value: function _getTexture() {
      return this._texture;
    }

    /**
     * Sets the dirtiness for the given renderer
     * @param {Boolean} dirty
     * @param {PhotoEditorSDK.Engine.BaseRenderer} renderer
     * @param {Boolean} dimensionsChanged = false
     */

  }, {
    key: 'setDirtyForRenderer',
    value: function setDirtyForRenderer(dirty, renderer) {
      var dimensionsChanged = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;

      _get(BrushSprite.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(BrushSprite.prototype), 'setDirtyForRenderer', this).call(this, dirty, renderer, dimensionsChanged);
      if (dirty && dimensionsChanged) {
        this._persistedPaths = [];
        this._options.paths.forEach(function (path) {
          path.setDirty(true);
        });
      }
    }

    /**
     * Sets this brush to dirty
     * @param {Boolean} dirty
     * @param {Boolean} dimensionsChanged = false
     */

  }, {
    key: 'setDirty',
    value: function setDirty(dirty) {
      var dimensionsChanged = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

      for (var rendererId in this._dirtiness) {
        this.setDirtyForRenderer(dirty, this._renderers[rendererId], dimensionsChanged);
      }
    }

    /**
     * Renders all paths to the canvas
     * @param {PhotoEditorSDK.Math.Vector2} inputDimensions
     */

  }, {
    key: 'render',
    value: function render(inputDimensions) {
      var _this2 = this;

      var renderer = this._operation.getSDK().getRenderer();

      if (!this.isDirtyForRenderer(renderer)) {
        return;
      }

      __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].ensureCanvasDimensions(this._outputCanvas, inputDimensions);
      __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].ensureCanvasDimensions(this._persistCanvas, inputDimensions);

      // Make sure all paths are rendered to their canvases
      this._options.paths.forEach(function (path) {
        path.render(inputDimensions);

        if (path.getClosed() && _this2._persistedPaths.indexOf(path) === -1) {
          _this2._onPathPersist(path);
        }
      });

      // Render persisted paths to output in one go
      this.clearCanvas();
      this._outputContext.drawImage(this._persistCanvas, 0, 0);

      // Render unpersisted paths to output
      this._options.paths.forEach(function (path) {
        if (!path.getClosed()) {
          path.renderToCanvas(_this2._outputCanvas);
        }
      });

      this.setDirtyForRenderer(false, renderer);
    }

    /**
     * Updates this sprite
     * @param  {PhotoEditorSDK} sdk
     * @param  {PhotoEditorSDK.Math.Vector2} inputDimensions
     */

  }, {
    key: 'update',
    value: function update(sdk, inputDimensions) {
      if (inputDimensions) {
        __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].ensureCanvasDimensions(this._outputCanvas, inputDimensions);
        __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].ensureCanvasDimensions(this._persistCanvas, inputDimensions);

        // Update texture dimensions
        this._texture.getBaseTexture().update();
      }

      // Render paths and control points
      this.render(inputDimensions);

      // Upload canvas to texture
      var renderer = sdk.getRenderer();
      /* istanbul ignore next */
      if (renderer.isOfType(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["RendererType"].WEBGL)) {
        renderer.updateTexture(this._texture.getBaseTexture());
      }

      _get(BrushSprite.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(BrushSprite.prototype), 'update', this).call(this, sdk, inputDimensions);
    }

    /**
     * Resets this brush so that it can be re-rendered
     * @private
     */

  }, {
    key: '_reset',
    value: function _reset() {
      this._persistedPaths = [];
      if (this._operation) {
        this._operation.setDirty(true);
      }
      this.setDirty(true);
      this.clearCanvas();
      this.clearPersistCanvas();
    }

    // -------------------------------------------------------------------------- GETTERS / SETTERS

    /**
     * Returns the canvas we're rendering brushes to
     * @return {CanvasElement}
     */

  }, {
    key: 'getCanvas',
    value: function getCanvas() {
      return this._outputCanvas;
    }

    // -------------------------------------------------------------------------- DISPOSAL

    /**
     * Disposes this Brush
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      _get(BrushSprite.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(BrushSprite.prototype), 'dispose', this).call(this);
      this._texture && this._texture.getBaseTexture().dispose();
    }
  }]);

  return BrushSprite;
}(__WEBPACK_IMPORTED_MODULE_7__sprite__["a" /* default */]);

BrushSprite.prototype.availableOptions = {
  id: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].STRING, default: function _default() {
      return __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].getUUID();
    } },
  position: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(0, 0) },
  scale: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(1.0, 1.0) },
  anchor: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(0.0, 0.0) },
  pivot: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(0.0, 0.0) },
  rotation: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0 },
  paths: {
    type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].ARRAY,
    default: [],
    setter: function setter(paths) {
      var _this3 = this;

      paths = paths.map(function (path) {
        if (path instanceof __WEBPACK_IMPORTED_MODULE_6__brush_path__["a" /* default */]) return path;

        var brush = path.brush,
            closed = path.closed;

        var newPath = new __WEBPACK_IMPORTED_MODULE_6__brush_path__["a" /* default */](_this3._operation, { brush: brush, closed: closed }, _this3._nextCanvas);
        path.controlPoints.forEach(function (position) {
          newPath.addControlPoint(position);
        });
        return newPath;
      });

      this._reset();
      return paths;
    }
  }
};

BrushSprite.type = 'brush';
BrushSprite.Brush = __WEBPACK_IMPORTED_MODULE_8__brush_brushes_brush__["a" /* default */];
BrushSprite.Path = __WEBPACK_IMPORTED_MODULE_6__brush_path__["a" /* default */];
BrushSprite.Brushes = {
  RadialBrush: __WEBPACK_IMPORTED_MODULE_9__brush_brushes_radial_brush__["a" /* default */]
};

/* harmony default export */ __webpack_exports__["a"] = (BrushSprite);

/***/ }),
/* 148 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */


var Vector2 = __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Math"].Vector2;

var Brush = function (_Configurable) {
  _inherits(Brush, _Configurable);

  function Brush() {
    var _ref;

    _classCallCheck(this, Brush);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = Brush.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(Brush)).call.apply(_ref, [this].concat(args)));

    _this._lastOptions = {};
    _this._lastInputDimensions = new Vector2(0, 0);
    _this._brush = null;
    return _this;
  }

  /**
   * Returns the prepared brush image (colored and resized)
   * @param  {PhotoEditorSDK.Math.Vector2} inputDimensions
   * @return {HTMLImageElement|HTMLCanvasElement}
   */


  _createClass(Brush, [{
    key: 'getBrushImage',
    value: function getBrushImage(inputDimensions) {
      if (this._brush && this.optionsEqual(this._lastOptions) && inputDimensions.equals(this._lastInputDimensions)) {
        return this._brush;
      }

      var _options = this._options,
          image = _options.image,
          size = _options.size;

      image.width = image.height = Math.ceil(size * inputDimensions.min());

      var canvas = __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Utils"].createCanvas();
      canvas.width = image.width;
      canvas.height = image.height;

      var context = canvas.getContext('2d');
      context.drawImage(image, 0, 0, canvas.width, canvas.height);

      var tintedBrush = this._tintImageData(context.getImageData(0, 0, canvas.width, canvas.height), canvas.width, canvas.height);
      context.putImageData(tintedBrush, 0, 0);

      this._lastOptions = this.serializeOptions(['size', 'color']);
      this._brush = canvas;
      this._lastInputDimensions = inputDimensions.clone();

      return canvas;
    }

    /**
     * Tints the given image data in the current color
     * @param  {ImageData} imageData
     * @return {ImageData}
     * @private
     */

  }, {
    key: '_tintImageData',
    value: function _tintImageData(imageData) {
      var color = this._options.color;


      for (var i = 0; i < imageData.data.length; i += 4) {
        imageData.data[i] += (color.r * 255 - imageData.data[i]) * color.a;
        imageData.data[i + 1] += (color.g * 255 - imageData.data[i + 1]) * color.a;
        imageData.data[i + 2] += (color.b * 255 - imageData.data[i + 2]) * color.a;
      }

      return imageData;
    }

    /**
     * Returns a clone of this brush
     * @return {PhotoEditorSDK.Operations.SpriteOperation.BrushSprite.Brush}
     */

  }, {
    key: 'clone',
    value: function clone() {
      var Constructor = this.constructor;
      return new Constructor(this._options);
    }
  }]);

  return Brush;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Configurable"]);

/* harmony default export */ __webpack_exports__["a"] = (Brush);


Brush.prototype.availableOptions = {
  identifier: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].STRING },
  image: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].IMAGE },
  size: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.05 },
  color: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].COLOR, default: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Color"].RED }
};

/***/ }),
/* 149 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016 9elements GbmH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



var MaskFilter = function (_Engine$Filter) {
  _inherits(MaskFilter, _Engine$Filter);

  function MaskFilter() {
    _classCallCheck(this, MaskFilter);

    var _this = _possibleConstructorReturn(this, (MaskFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(MaskFilter)).call(this));

    _this._fragmentSource = __webpack_require__(347);
    return _this;
  }

  /**
   * Applies this filter to the given inputTarget and renders it to
   * the given outputTarget using the CanvasRenderer
   * @param  {PhotoEditorSDK.Engine.CanvasRenderer} renderer
   * @param  {PhotoEditorSDK.Engine.RenderTarget} inputTarget
   * @param  {PhotoEditorSDK.Engine.RenderTarget} outputTarget
   * @param  {Boolean} clear = false
   * @private
   */


  _createClass(MaskFilter, [{
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var inputCanvas = inputTarget.getCanvas();

      var inputContext = inputTarget.getContext();
      var outputContext = outputTarget.getContext();

      var _options = this._options,
          maskCanvas = _options.maskCanvas,
          filterCanvas = _options.filterCanvas;

      var maskContext = maskCanvas.getContext('2d');
      var filterContext = filterCanvas.getContext('2d');

      var maskPixels = maskContext.getImageData(0, 0, inputCanvas.width, inputCanvas.height).data;
      var existingImageData = inputContext.getImageData(0, 0, inputCanvas.width, inputCanvas.height);
      var existingPixels = existingImageData.data;
      var newPixels = filterContext.getImageData(0, 0, inputCanvas.width, inputCanvas.height).data;

      var alpha = void 0;
      for (var i = 0; i < inputCanvas.width * inputCanvas.height * 4; i += 4) {
        alpha = maskPixels[i] / 255;

        existingPixels[i] = alpha * newPixels[i] + (1 - alpha) * existingPixels[i];
        existingPixels[i + 1] = alpha * newPixels[i + 1] + (1 - alpha) * existingPixels[i + 1];
        existingPixels[i + 2] = alpha * newPixels[i + 2] + (1 - alpha) * existingPixels[i + 2];
      }

      outputContext.putImageData(existingImageData, 0, 0);
    }
  }]);

  return MaskFilter;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].Filter);

MaskFilter.prototype.availableOptions = {
  maskImage: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 1, uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].INT },
  maskCanvas: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].OBJECT, default: null },
  filterImage: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 2, uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].INT },
  filterCanvas: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].OBJECT, default: null }
};

/* harmony default export */ __webpack_exports__["a"] = (MaskFilter);

/***/ }),
/* 150 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__text_splitter__ = __webpack_require__(151);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



var Vector2 = __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__["Math"].Vector2;

var TextRenderer = function () {
  function TextRenderer(text, operation) {
    _classCallCheck(this, TextRenderer);

    this._text = text;
    this._operation = operation;
    this._textOptions = {};

    this.rotation = 0;

    this._createCanvas();
    this._createTexture();
  }

  /**
   * Creates the canvas and initializes the text splitter
   * @private
   */


  _createClass(TextRenderer, [{
    key: '_createCanvas',
    value: function _createCanvas() {
      this._canvas = __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__["Utils"].createCanvas();
      this._context = this._canvas.getContext('2d');
      this._textSplitter = new __WEBPACK_IMPORTED_MODULE_2__text_splitter__["a" /* default */](this._context);

      this._finalCanvas = __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__["Utils"].createCanvas();
      this._finalContext = this._finalCanvas.getContext('2d');
    }

    /**
     * Creates the texture
     * @private
     */

  }, {
    key: '_createTexture',
    value: function _createTexture() {
      this._texture = __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__["Engine"].Texture.fromCanvas(this._canvas);
      this._finalTexture = __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__["Engine"].Texture.fromCanvas(this._finalCanvas);
    }

    /**
     * Applies the text options on the given context
     * @param  {Object} textOptions
     * @param  {CanvasRenderingContext2D} context
     * @private
     */

  }, {
    key: '_applyTextOptions',
    value: function _applyTextOptions(textOptions, context) {
      context.font = this._text.getFontStyle() + ' ' + this._text.getFontWeight() + ' ' + textOptions.fontSize + 'px ' + '"' + this._text.getFontFamily() + '"';

      context.textBaseline = 'top';
      context.textAlign = this._text.getAlignment();
      context.fillStyle = this._text.getColor().toRGBA();

      context.strokeStyle = this._text.getOutlineColor().toRGBA();
      var outlineWidth = this._text.getOutlineWidth();
      if (outlineWidth > 0) {
        context.lineWidth = outlineWidth;
      }
    }

    /**
     * Iterate over all lines and split them into multiple lines, depending
     * on the width they need
     * @param {Number} maxWidth
     * @return {Array.<string>}
     * @private
     */

  }, {
    key: '_buildOutputLines',
    value: function _buildOutputLines(maxWidth) {
      this._textSplitter.setText(this._text.getText());
      this._textSplitter.setMaxWidth(maxWidth);
      return this._textSplitter.getLines();
    }

    /**
     * Draws the given line onto context at the given Y position
     * @param  {String} text
     * @param  {Number} y
     * @private
     */

  }, {
    key: '_renderTextLine',
    value: function _renderTextLine(text, y) {
      var textAlignment = this._text.getAlignment();
      var drawPosition = new Vector2(0, y); // Left alignment

      switch (textAlignment) {
        case 'center':
          drawPosition.x = this._canvas.width / 2;
          break;
        case 'right':
          drawPosition.x = this._canvas.width;
          break;
      }

      this._context.fillText(text, drawPosition.x, drawPosition.y);
      var outlineWidth = this._text.getOutlineWidth();
      if (outlineWidth > 0) {
        this._context.miterLimit = 2;
        this._context.strokeText(text, drawPosition.x, drawPosition.y);
      }
    }

    /**
     * Renders this sprite
     * @param  {PhotoEditorSDK} sdk
     * @param  {PhotoEditorSDK.Math.Vector2} inputDimensions
     */

  }, {
    key: 'update',
    value: function update(sdk, inputDimensions) {
      var textOptions = this.calculateFontStyles(sdk, inputDimensions);
      if (textOptions) {
        var _calculateText2 = this._calculateText(sdk, textOptions, inputDimensions),
            dimensions = _calculateText2.dimensions,
            lines = _calculateText2.lines;

        this._renderText(sdk, dimensions, lines, textOptions, inputDimensions);
        this._updateFinalTexture();
      }
    }

    /**
     * Renders the rotated text on the final texture
     * @private
     */

  }, {
    key: '_updateFinalTexture',
    value: function _updateFinalTexture() {
      var _canvas = this._canvas,
          width = _canvas.width,
          height = _canvas.height;

      var rotation = this.rotation;
      var cos = Math.cos(rotation);
      var sin = Math.sin(rotation);

      var finalDimensions = new Vector2(Math.abs(width * cos) + Math.abs(height * sin), Math.abs(width * sin) + Math.abs(height * cos));

      this._finalCanvas.width = finalDimensions.x;
      this._finalCanvas.height = finalDimensions.y;

      this._finalContext.save();
      this._finalContext.translate(this._finalCanvas.width / 2, this._finalCanvas.height / 2);
      this._finalContext.rotate(rotation);
      this._finalContext.drawImage(this._canvas, -width / 2, -height / 2);
      this._finalContext.restore();
    }

    /**
     * Renders the text
     * @param  {PhotoEditorSDK} sdk
     * @param  {Vector2} dimensions
     * @param  {Array.<String>} lines
     * @param  {Object} textOptions
     * @param  {PhotoEditorSDK.Math.Vector2} inputDimensions
     * @private
     */

  }, {
    key: '_renderText',
    value: function _renderText(sdk, dimensions, lines, textOptions, inputDimensions) {
      // Resize the canvas
      this._canvas.width = dimensions.x;
      this._canvas.height = dimensions.y;

      if (this._text.getMaxHeight()) {
        this._canvas.height = Math.min(this._text.getMaxHeight() * inputDimensions.y, this._canvas.height);
      }

      // Update the context
      this._context = this._canvas.getContext('2d');

      // Render background color
      this._context.fillStyle = this._text.getBackgroundColor().toRGBA();
      this._context.fillRect(0, 0, dimensions.x, dimensions.y);

      // Apply text options
      this._applyTextOptions(textOptions, this._context);

      // Draw lines
      for (var lineNum = 0; lineNum < lines.length; lineNum++) {
        var line = lines[lineNum];
        this._renderTextLine(line, textOptions.topPadding + textOptions.lineHeight * lineNum);
      }
    }

    /**
     * Calculates the actual font size and line height
     * @param  {PhotoEditorSDK} sdk
     * @param  {PhotoEditorSDK.Math.Vector2} inputDimensions
     */

  }, {
    key: 'calculateFontStyles',
    value: function calculateFontStyles(sdk, inputDimensions) {
      var fontFamily = this._text.getFontFamily();
      var fontSize = this._text.getFontSize() * inputDimensions.y;
      var textHeight = this._text.getAbsoluteTextHeight(inputDimensions);
      var lineHeight = textHeight * this._text.getLineHeight();
      var topPadding = textHeight * (this._text.getLineHeight() - 1.0) / 2.0;

      var textOptions = { fontFamily: fontFamily, fontSize: fontSize, lineHeight: lineHeight, topPadding: topPadding };
      if (this._textOptions.fontFamily !== fontFamily || this._textOptions.fontSize !== fontSize || this._textOptions.lineHeight !== lineHeight) {
        this._textOptions = textOptions;
      }

      return textOptions;
    }

    /**
     * Calculates the dimensions and new lines according to max width
     * @param  {PhotoEditorSDK} sdk
     * @param  {Object} textOptions
     * @param  {PhotoEditorSDK.Math.Vector2} inputDimensions
     * @return {Object}
     * @private
     */

  }, {
    key: '_calculateText',
    value: function _calculateText(sdk, textOptions, inputDimensions) {
      // Calculate max width
      var maxWidth = this._text.getMaxWidth() * inputDimensions.x;

      // Apply text options
      this._applyTextOptions(textOptions, this._context);

      // Calculate bounding box
      var dimensions = new Vector2();
      var lines = this._text.getText().split('\n');
      if (typeof maxWidth !== 'undefined') {
        // Calculate the bounding box
        dimensions.x = maxWidth;
        lines = this._buildOutputLines(maxWidth);
      } else {
        for (var lineNum = 0; lineNum < lines.length; lineNum++) {
          var line = lines[lineNum];
          dimensions.x = Math.max(dimensions.x, this._context.measureText(line).width);
        }
      }

      // Calculate boundingbox height
      var lineHeight = textOptions.lineHeight;

      dimensions.y = lines.length * lineHeight;

      return { dimensions: dimensions, lines: lines };
    }

    /**
     * Returns this renderer's texture
     * @return {Engine.Texture}
     */

  }, {
    key: 'getTexture',
    value: function getTexture() {
      return this._texture;
    }

    /**
     * Returns this renderer's final texture containing the rotated text
     * @return {Engine.Texture}
     */

  }, {
    key: 'getFinalTexture',
    value: function getFinalTexture() {
      return this._finalTexture;
    }

    /**
     * Returns the dimensions for this text
     * @param  {PhotoEditorSDK} sdk
     * @param  {PhotoEditorSDK.Math.Vector2} inputDimensions
     * @return {Vector2}
     */

  }, {
    key: 'getDimensions',
    value: function getDimensions(sdk, inputDimensions) {
      var textOptions = this.calculateFontStyles(sdk, inputDimensions);

      var _calculateText3 = this._calculateText(sdk, textOptions, inputDimensions),
          dimensions = _calculateText3.dimensions;

      return dimensions;
    }

    /**
     * Disposes this text renderer
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      if (this._measurementElement) {
        document.body.removeChild(this._measurementElement);
      }

      if (this._texture) {
        this._texture.getBaseTexture().dispose();
        this._texture = null;
      }

      if (this._finalTexture) {
        this._finalTexture.getBaseTexture().dispose();
        this._finalTexture = null;
      }
    }
  }]);

  return TextRenderer;
}();

/* harmony default export */ __webpack_exports__["a"] = (TextRenderer);

/***/ }),
/* 151 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */

var TextSplitter = function () {
  function TextSplitter(context) {
    _classCallCheck(this, TextSplitter);

    this._context = context;
    this._lastFontStyle = {};
  }

  /**
   * Returns the lines that fit the maxWidth
   * @return {Array.<String>}
   */


  _createClass(TextSplitter, [{
    key: 'getLines',
    value: function getLines() {
      var _this = this;

      var lines = [];
      var newLineWords = [];

      // Iterate over lines
      var linesCount = this._lines.length;
      for (var l = 0; l < linesCount; l++) {
        var line = this._lines[l];

        // Iterate over words
        var words = this._buildWords(line);
        var wordsCount = words.length;
        for (var w = 0; w < wordsCount; w++) {
          var word = words[w];

          // Check if line is too wide for the maxwidth
          var currentLine = newLineWords.concat(word).join('').replace(/\s+$/i, '');
          var width = this._getWidth(currentLine);
          if (width > this._maxWidth) {
            // If there have been words before this one, start
            // a new line
            if (newLineWords.length > 0) {
              // Line too long -> line ended
              lines.push(newLineWords.join(''));

              // Start a new line with the word
              newLineWords = [word];
            }

            // If the next word is too long (without trailing spaces), split it up
            var _word = word.replace(/\s+$/i, '');
            if (this._getWidth(_word) > this._maxWidth) {
              var splitWord = this._splitWord(word);
              lines = lines.concat(splitWord.lines);
              if (splitWord.rest) {
                newLineWords = [splitWord.rest];
              }
            }
          } else {
            newLineWords.push(word);
          }
        }

        lines.push(newLineWords.join(''));

        newLineWords = [];
      }

      return lines.map(function (line) {
        return _this._trimLine(line, _this._context.textAlign);
      });
    }

    /**
     * Removes whitespaces based on alignment.
     * If the newline ends or begins with one or more whitespaces than remove the first/last depending on the aligment.
     * @param {String} line
     * @param {String} alignment
     * @return {String} line
     */

  }, {
    key: '_trimLine',
    value: function _trimLine(line, alignment) {
      return line; // FIXME: not supported by textarea yet. Enable later
      // switch (alignment) {
      //   case 'right':
      //     return line.replace(/\s{1}$/, '')
      //   case 'left':
      //     return line.replace(/^\s{1}/, '')
      //   case 'center':
      //   default:
      //     return line
      // }
    }

    /**
     * Builds an array of words from the given line
     * @param  {String} line
     * @return {Array.<String>}
     * @private
     */

  }, {
    key: '_buildWords',
    value: function _buildWords(line) {
      var words = [];
      var word = '';

      var len = line.length;
      for (var i = 0; i < len; i++) {
        var char = line[i];
        word += char;
        if (char === ' ' || char === '-' || i === len - 1) {
          words.push(word);
          word = '';
        }
      }

      return words;
    }

    /**
     * Splits up the given word to fit the max width
     * @param  {String} word
     * @return {Object}
     * @private
     */

  }, {
    key: '_splitWord',
    value: function _splitWord(word) {
      var response = {
        lines: [],
        rest: null
      };

      var wordLength = word.length;
      var chars = [];
      for (var c = 0; c < wordLength; c++) {
        var char = word[c];
        if (this._getWidth(chars.concat(char).join('')) > this._maxWidth) {
          if (chars.length > 0) {
            response.lines.push(chars.join(''));
          }
          chars = [char];
        } else {
          chars.push(char);
        }

        if (c === wordLength - 1 && chars.length > 0) {
          response.rest = chars.join('');
        }
      }

      return response;
    }

    /**
     * Checks if the font style changed from the last call
     * @return {Boolean}
     * @private
     */

  }, {
    key: '_fontStyleChanged',
    value: function _fontStyleChanged() {
      if (this._context.font !== this._lastFontStyle) {
        this._lastFontStyle = this._context.font;
        return true;
      }
      return false;
    }

    /**
     * Returns the measured width for the given string
     * @param  {String} string
     * @return {Number}
     * @private
     */

  }, {
    key: '_getWidth',
    value: function _getWidth(string) {
      return this._context.measureText(string).width;
    }

    /**
     * Sets the text
     * @param {String} text
     */

  }, {
    key: 'setText',
    value: function setText(text) {
      this._text = text;
      this._lines = text.split('\n');
    }

    /**
     * Sets the max width
     * @param {Number} maxWidth
     */

  }, {
    key: 'setMaxWidth',
    value: function setMaxWidth(maxWidth) {
      this._maxWidth = maxWidth;
    }
  }]);

  return TextSplitter;
}();

/* harmony default export */ __webpack_exports__["a"] = (TextSplitter);

/***/ }),
/* 152 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignCelebrate; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__text_design_blocks__ = __webpack_require__(57);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__models_rows_default_text_design_row_single__ = __webpack_require__(19);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__models_text_design_banderole__ = __webpack_require__(103);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__text_words__ = __webpack_require__(33);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__models_rows_image_text_design_row_image__ = __webpack_require__(105);







var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */








var TextDesignCelebrate = function (_TextDesignBlocks) {
  _inherits(TextDesignCelebrate, _TextDesignBlocks);

  function TextDesignCelebrate() {
    _classCallCheck(this, TextDesignCelebrate);

    return _possibleConstructorReturn(this, (TextDesignCelebrate.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignCelebrate)).apply(this, arguments));
  }

  _createClass(TextDesignCelebrate, [{
    key: '_fontForRow',
    value: function _fontForRow(index, words) {
      var fonts = this.getFontIdentifiers();
      return fonts[index % fonts.length];
    }
  }, {
    key: '_minimumNumberOfLines',
    value: function _minimumNumberOfLines(words) {
      return Math.max(Math.floor(_get(TextDesignCelebrate.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignCelebrate.prototype), '_minimumNumberOfLines', this).call(this, words) * 0.7), 1);
    }
  }, {
    key: '_maximumNumberOfLines',
    value: function _maximumNumberOfLines(words) {
      return Math.max(Math.floor(words.countNumberOfCharacters() / 5), 1);
    }
  }, {
    key: '_randomLayoutRow',
    value: function _randomLayoutRow(words, index, width, attributes) {
      return this._createSingleRow(TextDesignCelebrate.RowType.Single, words, width, attributes);
    }
  }, {
    key: '_createSingleRow',
    value: function _createSingleRow(rowType, words, width, attributes) {
      var fontIdentifier = attributes.getFontIdentifier();

      var updatedWords = fontIdentifier === 'imgly_font_amberlight' || fontIdentifier === 'imgly_font_handycheera_regular' ? new __WEBPACK_IMPORTED_MODULE_10__text_words__["a" /* Words */]().set(words.getLowerCase()) : words;

      // TODO: SingleImage
      switch (rowType) {
        case TextDesignCelebrate.RowType.Single:
          return new __WEBPACK_IMPORTED_MODULE_8__models_rows_default_text_design_row_single__["a" /* TextDesignRowSingle */]({ words: updatedWords, width: width, attributes: attributes });
        case TextDesignCelebrate.RowType.SingleImage:
          return new __WEBPACK_IMPORTED_MODULE_11__models_rows_image_text_design_row_image__["a" /* TextDesignRowImage */]({ words: updatedWords, width: width, attributes: attributes });
        default:
          __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Log"].warn('TextDesignCelebrate#_createSingleRow: Invalid row type \'' + rowType + '\'');
          return null;
      }
    }
  }]);

  return TextDesignCelebrate;
}(__WEBPACK_IMPORTED_MODULE_7__text_design_blocks__["a" /* TextDesignBlocks */]);

TextDesignCelebrate.defaultFontIdentifiers = ['imgly_font_handycheera_regular', 'imgly_font_rasa_regular'];
TextDesignCelebrate.defaultBanderoles = [__WEBPACK_IMPORTED_MODULE_9__models_text_design_banderole__["a" /* TextDesignBanderole */].Celebrate1, __WEBPACK_IMPORTED_MODULE_9__models_text_design_banderole__["a" /* TextDesignBanderole */].Celebrate2];
TextDesignCelebrate.identifier = 'imgly_text_design_celebrate';
TextDesignCelebrate.RowType = {
  Single: 'SINGLE',
  SingleImage: 'SINGLE_IMAGE'
};
TextDesignCelebrate.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_7__text_design_blocks__["a" /* TextDesignBlocks */].prototype.availableOptions, {
  relativeLineSpacing: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.01875 },
  fontIdentifiers: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].ARRAY, default: TextDesignCelebrate.defaultFontIdentifiers },
  banderoles: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].ARRAY, default: TextDesignCelebrate.defaultBanderoles }
});

/***/ }),
/* 153 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignRowSingleImage; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__default_text_design_row__ = __webpack_require__(59);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__text_words__ = __webpack_require__(33);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__text_design_attributes__ = __webpack_require__(76);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__text_design_element__ = __webpack_require__(43);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__text_text_design_font__ = __webpack_require__(60);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__utils_canvas__ = __webpack_require__(34);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__size_value__ = __webpack_require__(23);






var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */










var TextDesignRowSingleImage = function (_TextDesignRow) {
  _inherits(TextDesignRowSingleImage, _TextDesignRow);

  function TextDesignRowSingleImage() {
    var _ref;

    _classCallCheck(this, TextDesignRowSingleImage);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = TextDesignRowSingleImage.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignRowSingleImage)).call.apply(_ref, [this].concat(args)));

    _this.setSize(new __WEBPACK_IMPORTED_MODULE_12__size_value__["a" /* SizeValue */](_this.getWidth(), _this.getHeight()));
    return _this;
  }

  _createClass(TextDesignRowSingleImage, [{
    key: '_getImageFrame',
    value: function _getImageFrame() {
      var imageRect = this._getTextFrame().clone();
      var image = this.getImage();
      // TODO: drawingModeAspectFit
      if (this.getDrawingModeAspectFit() && image) {
        var ratio = Math.min(imageRect.width / image.width, imageRect.height / image.height);
        var newWidth = image.width * ratio;
        var newHeight = image.height * ratio;

        imageRect.x += (imageRect.width - newWidth) / 2;
        imageRect.y += (imageRect.height - newHeight) / 2;
        imageRect.width = newWidth;
        imageRect.height = newHeight;
      }

      return imageRect;
    }
  }, {
    key: '_calculateLayoutElements',
    value: function _calculateLayoutElements() {
      return [new __WEBPACK_IMPORTED_MODULE_9__text_design_element__["a" /* TextDesignElement */]({
        text: '', frame: this._getImageFrame(), font: new __WEBPACK_IMPORTED_MODULE_10__text_text_design_font__["a" /* TextDesignFont */]()
      })];
    }
  }, {
    key: 'render',
    value: function render(context) {
      var image = this.getImage();
      var imageFrame = this._getImageFrame();
      var attributes = this.getAttributes();
      var textColor = attributes.getTextColor();

      Object(__WEBPACK_IMPORTED_MODULE_11__utils_canvas__["a" /* drawImageFrame */])(context, image, imageFrame, textColor);
    }
  }]);

  return TextDesignRowSingleImage;
}(__WEBPACK_IMPORTED_MODULE_6__default_text_design_row__["a" /* TextDesignRow */]);

TextDesignRowSingleImage.RowImages = {
  decorative1: 'text-design/images/imgly_text_design_asset_decorative_01.png',
  decorative2: 'text-design/images/imgly_text_design_asset_decorative_02.png',
  decorative3: 'text-design/images/imgly_text_design_asset_decorative_05.png',
  decorative4: 'text-design/images/imgly_text_design_asset_decorative_06.png',
  celebrate1: 'text-design/images/imgly_text_design_asset_celebrate_03.png',
  celebrate2: 'text-design/images/imgly_text_design_asset_celebrate_04.png',
  celebrate3: 'text-design/images/imgly_text_design_asset_celebrate_05.png'
};
TextDesignRowSingleImage.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_6__default_text_design_row__["a" /* TextDesignRow */].prototype.availableOptions, {
  words: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].OBJECT, default: new __WEBPACK_IMPORTED_MODULE_7__text_words__["a" /* Words */]() },
  height: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0 },
  image: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].IMAGE, default: null },
  imagePath: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].STRING, default: TextDesignRowSingleImage.RowImages.decorative1 },
  drawingModeAspectFit: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].BOOLEAN, default: false },
  attributes: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].CONFIGURABLE, default: new __WEBPACK_IMPORTED_MODULE_8__text_design_attributes__["a" /* TextDesignAttributes */]() }
});

/***/ }),
/* 154 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignEqualWidth; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__text_design__ = __webpack_require__(58);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__models_rows_default_text_design_row_single__ = __webpack_require__(19);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__models_rectangle_insets__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__models_background_text_design_equal_width_background__ = __webpack_require__(363);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__text_words__ = __webpack_require__(33);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__models_randomizer__ = __webpack_require__(16);







var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */









var TextDesignEqualWidth = function (_TextDesign) {
  _inherits(TextDesignEqualWidth, _TextDesign);

  function TextDesignEqualWidth() {
    var _ref;

    _classCallCheck(this, TextDesignEqualWidth);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = TextDesignEqualWidth.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignEqualWidth)).call.apply(_ref, [this].concat(args)));

    _this._relativeInsets = new __WEBPACK_IMPORTED_MODULE_9__models_rectangle_insets__["a" /* RectangleInsets */](0.1, 0.1, 0.1, 0.1);
    _this._alreadyContainsARowWithScriptFont = false;

    _this._backgroundsRandomizer = new __WEBPACK_IMPORTED_MODULE_12__models_randomizer__["a" /* Randomizer */](0);

    _this._seedPool.push(_this._backgroundsRandomizer);
    return _this;
  }

  _createClass(TextDesignEqualWidth, [{
    key: 'getImagePaths',
    value: function getImagePaths() {
      return __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Utils"].Array.flatten(__WEBPACK_IMPORTED_MODULE_10__models_background_text_design_equal_width_background__["a" /* TextDesignEqualWidthBackground */].Backgrounds.map(function (b) {
        return b.getImagePaths();
      }));
    }
  }, {
    key: '_getBackground',
    value: function _getBackground() {
      return this._backgroundsRandomizer.pickNext(__WEBPACK_IMPORTED_MODULE_10__models_background_text_design_equal_width_background__["a" /* TextDesignEqualWidthBackground */].Backgrounds);
    }
  }, {
    key: 'generateLayoutData',
    value: function generateLayoutData(text, width) {
      this._alreadyContainsARowWithScriptFont = false;
      this._background = this._getBackground();
      return _get(TextDesignEqualWidth.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignEqualWidth.prototype), 'generateLayoutData', this).call(this, text, width);
    }
  }, {
    key: '_modifiedText',
    value: function _modifiedText(text) {
      return _get(TextDesignEqualWidth.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignEqualWidth.prototype), '_modifiedText', this).call(this, text).toUpperCase();
    }
  }, {
    key: '_fontForRow',
    value: function _fontForRow(index, words) {
      var fontIdentifier = _get(TextDesignEqualWidth.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignEqualWidth.prototype), '_fontForRow', this).call(this, index, words);

      if (fontIdentifier === 'imgly_font_petit_formal_script') {
        if (this._alreadyContainsARowWithScriptFont) {
          fontIdentifier = 'imgly_font_bungee_inline';
        }
        this._alreadyContainsARowWithScriptFont = true;
      }

      return fontIdentifier;
    }
  }, {
    key: '_randomLayoutRow',
    value: function _randomLayoutRow(words, index, width, attributes) {
      var lowercase = attributes.getFontIdentifier() === 'imgly_font_petit_formal_script';

      return new __WEBPACK_IMPORTED_MODULE_8__models_rows_default_text_design_row_single__["a" /* TextDesignRowSingle */]({
        words: lowercase ? new __WEBPACK_IMPORTED_MODULE_11__text_words__["a" /* Words */]().set(words.getLowerCase()) : words,
        width: width,
        attributes: attributes
      });
    }
  }]);

  return TextDesignEqualWidth;
}(__WEBPACK_IMPORTED_MODULE_7__text_design__["a" /* TextDesign */]);

TextDesignEqualWidth.identifier = 'imgly_text_design_equal_width';
TextDesignEqualWidth.defaultFontIdentifiers = ['imgly_font_ultra', 'imgly_font_bungee_inline', 'imgly_font_petit_formal_script'];
TextDesignEqualWidth.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_7__text_design__["a" /* TextDesign */].prototype.availableOptions, {
  fontIdentifiers: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].ARRAY, default: TextDesignEqualWidth.defaultFontIdentifiers },
  relativeLineSpacing: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.025 }
});

/***/ }),
/* 155 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignBackground; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



var TextDesignBackground = function (_Configurable) {
  _inherits(TextDesignBackground, _Configurable);

  function TextDesignBackground() {
    _classCallCheck(this, TextDesignBackground);

    return _possibleConstructorReturn(this, (TextDesignBackground.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignBackground)).apply(this, arguments));
  }

  _createClass(TextDesignBackground, [{
    key: 'render',
    value: function render(context, size, relativeInsets, color, randomizer) {
      __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Log"].warn('TextDesignBackground#render: Abstract class');
    }
  }]);

  return TextDesignBackground;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Configurable"]);

TextDesignBackground.prototype.availableOptions = {};

/***/ }),
/* 156 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignSunshine; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_is_iterable__ = __webpack_require__(70);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_is_iterable___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_is_iterable__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_get_iterator__ = __webpack_require__(71);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_get_iterator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_get_iterator__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_array_from__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_array_from___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_array_from__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_9_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__text_design__ = __webpack_require__(58);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__models_rows_default_text_design_row_single__ = __webpack_require__(19);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__text_design_asset_manager__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__models_rectangle_insets__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__text_words__ = __webpack_require__(33);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__models_rows_image_text_design_row_single_image__ = __webpack_require__(153);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__models_rows_image_text_design_row_image__ = __webpack_require__(105);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__models_randomizer__ = __webpack_require__(16);










var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_get_iterator___default()(arr), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_is_iterable___default()(Object(arr))) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_8_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_array_from___default()(arr); } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_7_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */










var TextDesignSunshine = function (_TextDesign) {
  _inherits(TextDesignSunshine, _TextDesign);

  function TextDesignSunshine() {
    var _ref;

    _classCallCheck(this, TextDesignSunshine);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = TextDesignSunshine.__proto__ || __WEBPACK_IMPORTED_MODULE_8_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignSunshine)).call.apply(_ref, [this].concat(args)));

    _this._relativeInsets = new __WEBPACK_IMPORTED_MODULE_13__models_rectangle_insets__["a" /* RectangleInsets */](0, 0.3, 0, 0.3);

    _this._INVALID_FONTS_IF_LESS_THEN_5_CHARS = ['imgly_font_montserrat_light'];

    _this._INVALID_FONTS_IF_LESS_THEN_4_CHARS = ['imgly_font_montserrat_light', 'imgly_font_hello_sunshine', 'imgly_font_hello_sunshine_italic'];

    _this._lineCount = 0;

    _this._decorativeRowCreated = false;

    _this._useImageRowRandomizer = new __WEBPACK_IMPORTED_MODULE_17__models_randomizer__["a" /* Randomizer */](0);
    _this._rowTypeRandomizer = new __WEBPACK_IMPORTED_MODULE_17__models_randomizer__["a" /* Randomizer */](0);
    _this._lineDecorativeTypeRandomizer = new __WEBPACK_IMPORTED_MODULE_17__models_randomizer__["a" /* Randomizer */](0);

    _this._seedPool.push(_this._useImageRowRandomizer);
    _this._seedPool.push(_this._rowTypeRandomizer);
    _this._seedPool.push(_this._lineDecorativeTypeRandomizer);
    return _this;
  }

  _createClass(TextDesignSunshine, [{
    key: 'getImagePaths',
    value: function getImagePaths() {
      return [].concat(_toConsumableArray(TextDesignSunshine.DecoratorImages), _toConsumableArray(TextDesignSunshine.RowImages));
    }
  }, {
    key: '_fontForRow',
    value: function _fontForRow(index, words) {
      var _this2 = this;

      var numOfCharacters = words.countNumberOfCharacters();

      var fonts = this.getFontIdentifiers();

      if (numOfCharacters < 4) {
        fonts = fonts.filter(function (font) {
          return _this2._INVALID_FONTS_IF_LESS_THEN_4_CHARS.indexOf(font) < 0;
        });
      } else if (numOfCharacters < 5) {
        fonts = fonts.filter(function (font) {
          return _this2._INVALID_FONTS_IF_LESS_THEN_5_CHARS.indexOf(font) < 0;
        });
      }

      return fonts[index % fonts.length];
    }
  }, {
    key: '_modifiedText',
    value: function _modifiedText(text) {
      return _get(TextDesignSunshine.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_8_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignSunshine.prototype), '_modifiedText', this).call(this, text).toUpperCase();
    }
  }, {
    key: '_modifiedLines',
    value: function _modifiedLines(lines) {
      this._lineCount = lines.length;
      return lines;
    }
  }, {
    key: 'generateLayoutData',
    value: function generateLayoutData(text, width) {
      this._decorativeRowCreated = false;
      return _get(TextDesignSunshine.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_8_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignSunshine.prototype), 'generateLayoutData', this).call(this, text, width);
    }
  }, {
    key: '_randomLayoutRow',
    value: function _randomLayoutRow(words, index, width, attributes) {
      var fontIdentifier = attributes.getFontIdentifier();

      var modifiedWords = words;

      switch (fontIdentifier) {
        case 'imgly_font_hello_sunshine':
          modifiedWords = new __WEBPACK_IMPORTED_MODULE_14__text_words__["a" /* Words */]().set(words.getLowerCase());
          break;

        case 'imgly_font_hello_sunshine_italic':
          modifiedWords = new __WEBPACK_IMPORTED_MODULE_14__text_words__["a" /* Words */]().set(words.getLowerCase());
          break;

        case 'imgly_font_hello_sunshine_marker':
          modifiedWords = new __WEBPACK_IMPORTED_MODULE_14__text_words__["a" /* Words */]().set(words.getUpperCase());
          break;

        default:
          break;
      }

      // const modifiedWords = R.cond([
      //   [R.equals('imgly_font_hello_sunshine'), R.always(new Words().set(words.getLowerCase()))],
      //   [R.equals('imgly_font_hello_sunshine_italic'), R.always(new Words().set(words.getLowerCase()))],
      //   [R.equals('imgly_font_hello_sunshine_marker'), R.always(new Words().set(words.getUpperCase()))],
      //   [R.T, R.always(words)]
      // ])(fontIdentifier)

      var noDecorations = this.getDecorativeRowsInTheMiddleOnly() && (index === 0 || index === this._lineCount - 1);

      if (this._useImageRowRandomizer.nextBool() || this._decorativeRowCreated || noDecorations) {
        return new __WEBPACK_IMPORTED_MODULE_11__models_rows_default_text_design_row_single__["a" /* TextDesignRowSingle */]({ words: modifiedWords, width: width, attributes: attributes });
      } else {
        this._decorativeRowCreated = true;

        var _randomDecoratorImage = this._randomDecoratorImages(),
            _randomDecoratorImage2 = _slicedToArray(_randomDecoratorImage, 2),
            leftImage = _randomDecoratorImage2[0],
            rightImage = _randomDecoratorImage2[1];

        return new __WEBPACK_IMPORTED_MODULE_16__models_rows_image_text_design_row_image__["a" /* TextDesignRowImage */]({
          words: words,
          width: width,
          attributes: attributes,
          leftImage: leftImage,
          rightImage: rightImage
        });
      }
    }
  }, {
    key: '_layoutRows',
    value: function _layoutRows(lines, width) {
      var elements = _get(TextDesignSunshine.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_8_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignSunshine.prototype), '_layoutRows', this).call(this, lines, width);

      if (!this.getDecorationsVisible()) {
        return elements;
      }

      var formHeight = 25;
      var firstRow = new __WEBPACK_IMPORTED_MODULE_15__models_rows_image_text_design_row_single_image__["a" /* TextDesignRowSingleImage */]({
        width: width,
        height: formHeight,
        image: __WEBPACK_IMPORTED_MODULE_12__text_design_asset_manager__["a" /* AssetManager */].getImage(this._rowTypeRandomizer.pickNext(TextDesignSunshine.RowImages))
      }).layout();

      var lastRow = new __WEBPACK_IMPORTED_MODULE_15__models_rows_image_text_design_row_single_image__["a" /* TextDesignRowSingleImage */]({
        width: width,
        height: formHeight,
        image: __WEBPACK_IMPORTED_MODULE_12__text_design_asset_manager__["a" /* AssetManager */].getImage(this._rowTypeRandomizer.pickNext(TextDesignSunshine.RowImages))
      }).layout();

      return [firstRow].concat(_toConsumableArray(elements), [lastRow]);
    }
  }, {
    key: '_randomDecoratorImages',
    value: function _randomDecoratorImages() {
      if (this._lineDecorativeTypeRandomizer.nextInRange(0, 1)) {
        return TextDesignSunshine.DecoratorImages.slice(0, 2).map(function (path) {
          return __WEBPACK_IMPORTED_MODULE_12__text_design_asset_manager__["a" /* AssetManager */].getImage(path);
        });
      } else {
        return TextDesignSunshine.DecoratorImages.slice(2).map(function (path) {
          return __WEBPACK_IMPORTED_MODULE_12__text_design_asset_manager__["a" /* AssetManager */].getImage(path);
        });
      }
    }
  }]);

  return TextDesignSunshine;
}(__WEBPACK_IMPORTED_MODULE_10__text_design__["a" /* TextDesign */]);

TextDesignSunshine.defaultFontIdentifiers = ['imgly_font_hello_sunshine_marker', 'imgly_font_hello_sunshine', 'imgly_font_hello_sunshine_italic', 'imgly_font_montserrat_light'];
TextDesignSunshine.identifier = 'imgly_text_design_sunshine';
TextDesignSunshine.RowImages = [__WEBPACK_IMPORTED_MODULE_15__models_rows_image_text_design_row_single_image__["a" /* TextDesignRowSingleImage */].RowImages.decorative1, __WEBPACK_IMPORTED_MODULE_15__models_rows_image_text_design_row_single_image__["a" /* TextDesignRowSingleImage */].RowImages.decorative2, __WEBPACK_IMPORTED_MODULE_15__models_rows_image_text_design_row_single_image__["a" /* TextDesignRowSingleImage */].RowImages.decorative3, __WEBPACK_IMPORTED_MODULE_15__models_rows_image_text_design_row_single_image__["a" /* TextDesignRowSingleImage */].RowImages.decorative4];
TextDesignSunshine.DecoratorImages = ['text-design/images/imgly_text_design_asset_decorative_03.png', 'text-design/images/imgly_text_design_asset_decorative_04.png', 'text-design/images/imgly_text_design_asset_decorative_07.png', 'text-design/images/imgly_text_design_asset_decorative_08.png'];
TextDesignSunshine.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_10__text_design__["a" /* TextDesign */].prototype.availableOptions, {
  fontIdentifiers: { type: __WEBPACK_IMPORTED_MODULE_9_photoeditorsdk_core__["OptionType"].ARRAY, default: TextDesignSunshine.defaultFontIdentifiers },
  relativeLineSpacing: { type: __WEBPACK_IMPORTED_MODULE_9_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.025 / 3 * 4 },
  decorationsVisible: { type: __WEBPACK_IMPORTED_MODULE_9_photoeditorsdk_core__["OptionType"].BOOLEAN, default: true },
  decorativeRowsInTheMiddleOnly: { type: __WEBPACK_IMPORTED_MODULE_9_photoeditorsdk_core__["OptionType"].BOOLEAN, default: false }
});

/***/ }),
/* 157 */
/***/ (function(module, exports, __webpack_require__) {

/* @module */
/*!
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */

/**
 * @namespace PhotoEditorSDK.UI
 */
module.exports = __webpack_require__(4);
__webpack_require__(261);

/***/ }),
/* 158 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__sdk__ = __webpack_require__(159);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__lib_math___ = __webpack_require__(137);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__operations___ = __webpack_require__(138);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__engine___ = __webpack_require__(68);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__lib_color__ = __webpack_require__(51);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__operations_operation__ = __webpack_require__(139);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__lib_event_emitter__ = __webpack_require__(52);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__lib_utils__ = __webpack_require__(22);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__lib_env__ = __webpack_require__(258);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__lib_operations_stack__ = __webpack_require__(141);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__lib_exif__ = __webpack_require__(100);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__lib_image__ = __webpack_require__(74);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__shared_vendor_promise__ = __webpack_require__(32);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__lib_configurable__ = __webpack_require__(55);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__shared_log__ = __webpack_require__(30);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__shared_loaders__ = __webpack_require__(259);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__constants__ = __webpack_require__(31);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__lib_base64__ = __webpack_require__(50);
/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 * @license
 */

/* eslint-disable import/first */



/**
 * The current version of the SDK
 * @name PhotoEditorSDK.version
 * @internal Keep in sync with package.json
 */
__WEBPACK_IMPORTED_MODULE_0__sdk__["a" /* default */].version = __webpack_require__(142).version;

// Namespaces

__WEBPACK_IMPORTED_MODULE_0__sdk__["a" /* default */].Math = __WEBPACK_IMPORTED_MODULE_1__lib_math___;


__WEBPACK_IMPORTED_MODULE_0__sdk__["a" /* default */].Operations = __WEBPACK_IMPORTED_MODULE_2__operations___;


__WEBPACK_IMPORTED_MODULE_0__sdk__["a" /* default */].Engine = __WEBPACK_IMPORTED_MODULE_3__engine___["a" /* default */];

// Classes

__WEBPACK_IMPORTED_MODULE_0__sdk__["a" /* default */].Color = __WEBPACK_IMPORTED_MODULE_4__lib_color__["a" /* default */];


__WEBPACK_IMPORTED_MODULE_0__sdk__["a" /* default */].Operation = __WEBPACK_IMPORTED_MODULE_5__operations_operation__["a" /* default */];


__WEBPACK_IMPORTED_MODULE_0__sdk__["a" /* default */].EventEmitter = __WEBPACK_IMPORTED_MODULE_6__lib_event_emitter__["a" /* default */];


__WEBPACK_IMPORTED_MODULE_0__sdk__["a" /* default */].Utils = __WEBPACK_IMPORTED_MODULE_7__lib_utils__["a" /* default */];


__WEBPACK_IMPORTED_MODULE_0__sdk__["a" /* default */].Env = __WEBPACK_IMPORTED_MODULE_8__lib_env__["a" /* default */];


__WEBPACK_IMPORTED_MODULE_0__sdk__["a" /* default */].OperationsStack = __WEBPACK_IMPORTED_MODULE_9__lib_operations_stack__["a" /* default */];


__WEBPACK_IMPORTED_MODULE_0__sdk__["a" /* default */].EXIF = __WEBPACK_IMPORTED_MODULE_10__lib_exif__["a" /* default */];


__WEBPACK_IMPORTED_MODULE_0__sdk__["a" /* default */].Image = __WEBPACK_IMPORTED_MODULE_11__lib_image__["a" /* default */];


__WEBPACK_IMPORTED_MODULE_0__sdk__["a" /* default */].Promise = __WEBPACK_IMPORTED_MODULE_12__shared_vendor_promise__["a" /* default */];


__WEBPACK_IMPORTED_MODULE_0__sdk__["a" /* default */].Configurable = __WEBPACK_IMPORTED_MODULE_13__lib_configurable__["a" /* default */];


__WEBPACK_IMPORTED_MODULE_0__sdk__["a" /* default */].Log = __WEBPACK_IMPORTED_MODULE_14__shared_log__["a" /* default */];


__WEBPACK_IMPORTED_MODULE_0__sdk__["a" /* default */].Loaders = __WEBPACK_IMPORTED_MODULE_15__shared_loaders__;
// Constants

__WEBPACK_IMPORTED_MODULE_0__sdk__["a" /* default */].RenderType = __WEBPACK_IMPORTED_MODULE_16__constants__["RenderType"];
__WEBPACK_IMPORTED_MODULE_0__sdk__["a" /* default */].ImageFormat = __WEBPACK_IMPORTED_MODULE_16__constants__["ImageFormat"];
__WEBPACK_IMPORTED_MODULE_0__sdk__["a" /* default */].OptionType = __WEBPACK_IMPORTED_MODULE_16__constants__["OptionType"];
__WEBPACK_IMPORTED_MODULE_0__sdk__["a" /* default */].RendererType = __WEBPACK_IMPORTED_MODULE_16__constants__["RendererType"];
__WEBPACK_IMPORTED_MODULE_0__sdk__["a" /* default */].UniformType = __WEBPACK_IMPORTED_MODULE_16__constants__["UniformType"];

// Libs

__WEBPACK_IMPORTED_MODULE_0__sdk__["a" /* default */].Base64 = __WEBPACK_IMPORTED_MODULE_17__lib_base64__["a" /* default */];

__WEBPACK_IMPORTED_MODULE_0__sdk__["a" /* default */].UI = {};

/* harmony default export */ __webpack_exports__["default"] = (__WEBPACK_IMPORTED_MODULE_0__sdk__["a" /* default */]);

/***/ }),
/* 159 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_symbol_iterator__ = __webpack_require__(35);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_symbol_iterator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_symbol_iterator__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol__ = __webpack_require__(39);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_promise__ = __webpack_require__(29);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_promise___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_promise__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__globals__ = __webpack_require__(40);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__operations___ = __webpack_require__(138);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__lib_operations_stack__ = __webpack_require__(141);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__lib_version_checker__ = __webpack_require__(250);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__lib_exif__ = __webpack_require__(100);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__lib_image__ = __webpack_require__(74);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__lib_image_exporter__ = __webpack_require__(253);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__lib_performance_test__ = __webpack_require__(140);








var _typeof = typeof __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default.a === "function" && typeof __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_symbol_iterator___default.a === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default.a === "function" && obj.constructor === __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default.a && obj !== __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default.a.prototype ? "symbol" : typeof obj; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 * @license
 */









var bd = function bd(str) {
  return Utils.byteArrayToString(Base64.decode(str));
};

var Rectangle = __WEBPACK_IMPORTED_MODULE_7__globals__["Rectangle"],
    Constants = __WEBPACK_IMPORTED_MODULE_7__globals__["Constants"],
    Engine = __WEBPACK_IMPORTED_MODULE_7__globals__["Engine"],
    Utils = __WEBPACK_IMPORTED_MODULE_7__globals__["Utils"],
    EventEmitter = __WEBPACK_IMPORTED_MODULE_7__globals__["EventEmitter"],
    Vector2 = __WEBPACK_IMPORTED_MODULE_7__globals__["Vector2"],
    Log = __WEBPACK_IMPORTED_MODULE_7__globals__["Log"],
    Base64 = __WEBPACK_IMPORTED_MODULE_7__globals__["Base64"],
    Color = __WEBPACK_IMPORTED_MODULE_7__globals__["Color"];
var RenderType = Constants.RenderType,
    ImageFormat = Constants.ImageFormat,
    Events = Constants.Events,
    RendererType = Constants.RendererType;

/**
 * The main SDK class which handles rendering and manages
 * operations.
 * @class
 * @alias PhotoEditorSDK
 */

var PhotoEditorSDK = function (_EventEmitter) {
  _inherits(PhotoEditorSDK, _EventEmitter);

  /**
   * Creates a PhotoEditorSDK instance
   * @param  {String} [preferredRenderer = webgl] - `webgl` or `canvas`
   * @param  {Object} options
   * @param  {String} options.license - Your license
   * @param  {Image} [options.image] - The image that should be rendered
   * @param  {String} [options.renderMode = dynamic] - `dynamic` or `export`
   * @param  {Boolean} [options.versionCheck = true] - Should a version check be performed?
   * @param  {Boolean} [options.displayWelcomeMessage = true] - Should a welcome message be printed
   *   in the console?
   * @param  {Boolean} [options.transparent = false] - Should the canvas background be transparent?
   * @param  {HTMLCanvasElement} [options.canvas] - The canvas element the SDK should render to
   * @param  {Number} [options.zoom = 1] - The zoom level. Only available in `dynamic` mode
   * @param  {Number} [options.spriteScale = 1] - The output sprite's scale. Only available in `dynamic` mode
   * @param  {String} [options.logLevel = warn] - `trace`, `info`, `warn`, `error` or `log`
   * @param  {Number} [options.pixelRatio = 1] - If none is given, PhotoEditorSDK automatically
   * @param  {String} [options.crossOrigin = 'anonymous'] - 'anonymous', 'use-credentials' or 'none'
   *   detects the current device's pixel ratio
   * @param  {Boolean} [options.smoothDownscaling = false] - Toggles smooth downscaling
   * @param  {Boolean} [options.smoothUpscaling = false] - Toggles smooth upscaling
   */
  function PhotoEditorSDK(preferredRenderer) {
    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

    _classCallCheck(this, PhotoEditorSDK);

    var _this = _possibleConstructorReturn(this, (PhotoEditorSDK.__proto__ || __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of___default()(PhotoEditorSDK)).call(this));

    _this._onOperationUpdate = _this._onOperationUpdate.bind(_this);
    _this._onContextRestored = _this._onContextRestored.bind(_this);

    var _require = __webpack_require__(142),
        version = _require.version;

    _this.version = version;

    _this[bd('VG04Z1lHRndhVXRsZVdBZ2IzQjBhVzl1SUdkcGRtVnU=')] = true;
    _this._preferredRenderer = preferredRenderer;
    _this._options = Utils.defaults(options, {
      extensions: {},
      renderMode: 'dynamic',
      versionCheck: true,
      displayWelcomeMessage: true,
      image: null,
      canvas: null,
      transparent: false,
      clearColor: Color.TRANSPARENT,
      textureQuality: 1,
      zoom: 1,
      spriteScale: 1,
      rotation: 0,
      smoothDownscaling: false,
      smoothUpscaling: false,
      crossOrigin: 'anonymous',
      logLevel: 'warn',
      pixelRatio: typeof window !== 'undefined' && window.devicePixelRatio || 1
    });

    if (_this._options.smoothUpscaling) {
      Engine.BaseTexture.DefaultMagFilter = Engine.BaseTexture.LinearFilter;
    }

    _this._options.extensions = Utils.defaults(_this._options.extensions, {
      operations: [],
      controls: [],
      languages: []
    });

    Log.setLevel(_this._options.logLevel);

    if (!_this._v()) return _possibleConstructorReturn(_this);

    // const L = globals.LicenseChecker
    var L = __WEBPACK_IMPORTED_MODULE_7__globals__[bd('TGljZW5zZUNoZWNrZXI=')];
    // this._l = new LicenseChecker(this._options.license)
    _this._l = new L(_this[bd('X29wdGlvbnM=')][bd('bGljZW5zZQ==')]);
    _this._cv(true).then(function () {
      _this._ct();
    }).catch(function (e) {
      Log.error(bd('TGljZW5zaW5n'), e.message);
    });

    _this._defaultRenderMode = _this._options.renderMode;
    _this._renderMode = _this._options.renderMode;

    _this._textureQuality = _this._options.textureQuality;
    _this._offset = new Vector2();
    _this._zoom = _this._options.zoom;
    _this._spriteScale = _this._options.spriteScale;
    _this._rotation = _this._options.rotation;
    _this._operations = {};
    _this._operationsStack = null;
    _this.setOperationsStack(new __WEBPACK_IMPORTED_MODULE_9__lib_operations_stack__["a" /* default */]());

    // Engine stuff
    _this._container = new Engine.Container();
    _this._sprite = new Engine.Sprite();
    _this._container.addChild(_this._sprite);

    _this._inputTexture = _this._options.inputTexture;
    _this._currentInputTexture = null;
    _this._currentTexture = null;

    _this._resizedTexture = null;
    _this._resizedContainer = new Engine.Container();
    _this._resizedSprite = new Engine.Sprite();
    _this._resizedContainer.addChild(_this._resizedSprite);

    _this.setSmoothDownscaling(_this._options.smoothDownscaling);

    _this._checkForUpdates();
    _this._registerOperations();
    _this._initRenderer();

    var renderer = _this._renderer.constructor.type;
    if (_this._options.displayWelcomeMessage) {
      Log.log('Version:', _this.version + ' (' + renderer + ') - https://www.photoeditorsdk.com');
    }

    // Async image handling
    if (_this._options.image) {
      _this.setImage(_this._options.image);
    }
    return _this;
  }

  /**
   * Validates presence of the license
   * @return {Boolean}
   * @private
   */


  _createClass(PhotoEditorSDK, [{
    key: '_v',
    value: function _v() {
      // this._options.license
      if (!this[bd('X29wdGlvbnM=')][bd('bGljZW5zZQ==')]) {
        // Log.error('license', 'No `license` option given.')
        Log.error(bd('TGljZW5zaW5n'), bd('Tm8gYGxpY2Vuc2VgIG9wdGlvbiBnaXZlbi4='));
        Log.error(bd('TGljZW5zaW5n'), bd('SW4gY2FzZSB5b3UgZG9uJ3QgaGF2ZSBhIGxpY2Vuc2UgeWV0LCBwbGVhc2UgY29udGFjdCBvdXIgc2FsZXMgc3RhZmYgYXQgc2FsZXNAcGhvdG9lZGl0b3JzZGsuY29tIHRvIG9idGFpbiBhIGxpY2Vuc2Ugb3IgbG9nIGluIHRvIHlvdXIgY3VzdG9tZXIgZGFzaGJvYXJkLg=='));
        return false;
      }
      return true;
    }

    /**
     * Checks if license expires at some point, prints message about days left
     * @private
     */

  }, {
    key: '_ct',
    value: function _ct() {
      if (this._l.exp()) {
        var expired = this._l.isExp();
        if (expired) {
          Log.error(bd('TGljZW5zaW5n'), bd('WW91ciB0cmlhbCBsaWNlbnNlIGhhcyBleHBpcmVkLiBQbGVhc2UgY29udGFjdCB1cyBhdCBzYWxlc0BwaG90b2VkaXRvcnNkay5jb20gdG8gb2J0YWluIGEgbGljZW5zZS4='));
        } else {
          Log.warn(bd('TGljZW5zaW5n'), bd('WW91ciB0cmlhbCBsaWNlbnNlIHdpbGwgZXhwaXJlIGluICVkIGRheXMu').replace('%d', this._l.dl()));
        }
      }
    }

    /**
     * Checks for valid license
     * @return {Promise}
     * @private
     */

  }, {
    key: '_cv',
    value: function _cv() {
      var _this2 = this;

      var print = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;

      return this._l.c().catch(function (e) {
        _this2[bd('VG04Z1lHRndhVXRsZVdBZ2IzQjBhVzl1SUdkcGRtVnU=')] = false;
        var errorMessage = bd('SW52YWxpZCBsaWNlbnNlLg==');
        if (print) {
          if (e.code === 'ELICEXP') {
            // 'Your trial license has expired. Please contact us at sales@photoeditorsdk.com to obtain a license.'
            errorMessage = bd('WW91ciB0cmlhbCBsaWNlbnNlIGhhcyBleHBpcmVkLiBQbGVhc2UgY29udGFjdCB1cyBhdCBzYWxlc0BwaG90b2VkaXRvcnNkay5jb20gdG8gb2J0YWluIGEgbGljZW5zZS4=');
          } else if (e.code === 'ELICINVHOST') {
            // 'This license is not valid for the hostname ...'
            errorMessage = bd('VGhpcyBsaWNlbnNlIGlzIG5vdCB2YWxpZCBmb3IgdGhlIGhvc3RuYW1lIA==') + window.location.hostname + '.';
          } else if (e.code === 'ELICINVPLAT') {
            // 'This license is not valid for the current platform.'
            errorMessage = bd('VGhpcyBsaWNlbnNlIGlzIG5vdCB2YWxpZCBmb3IgdGhlIGN1cnJlbnQgcGxhdGZvcm0u');
          } else if (e.code === 'ELICINVFMT') {
            // 'Invalid license format. Please make sure you're passing your license as a string, not as \`$format\`.'
            errorMessage = bd('SW52YWxpZCBsaWNlbnNlIGZvcm1hdC4gUGxlYXNlIG1ha2Ugc3VyZSB5b3UncmUgcGFzc2luZyB5b3VyIGxpY2Vuc2UgYXMgYSBzdHJpbmcsIG5vdCBhcyBgJGZvcm1hdGAu').replace('$format', _typeof(_this2._options.license));
          } else if (e.code === 'ELICINV') {
            // 'Invalid license! Please contact our sales staff at support@photoeditorsdk.com to obtain a license or log in to your customer dashboard.'
            errorMessage = bd('SW52YWxpZCBsaWNlbnNlISBQbGVhc2UgY29udGFjdCBvdXIgc2FsZXMgc3RhZmYgYXQgc3VwcG9ydEBwaG90b2VkaXRvcnNkay5jb20gdG8gb2J0YWluIGEgbGljZW5zZSBvciBsb2cgaW4gdG8geW91ciBjdXN0b21lciBkYXNoYm9hcmQu');
          } else {
            // 'In case you don't have a license yet, please contact our sales staff at sales@photoeditorsdk.com to obtain a license or log in to your customer dashboard.'
            errorMessage = bd('SW4gY2FzZSB5b3UgZG9uJ3QgaGF2ZSBhIGxpY2Vuc2UgeWV0LCBwbGVhc2UgY29udGFjdCBvdXIgc2FsZXMgc3RhZmYgYXQgc2FsZXNAcGhvdG9lZGl0b3JzZGsuY29tIHRvIG9idGFpbiBhIGxpY2Vuc2Ugb3IgbG9nIGluIHRvIHlvdXIgY3VzdG9tZXIgZGFzaGJvYXJkLg==');
          }
        }
        e.message = errorMessage;
        throw new Error(e);
      });
    }

    /**
     * Tracks an export / edit
     * @private
     */

  }, {
    key: '_t',
    value: function _t() {
      this._l.t();
    }

    // -------------------------------------------------------------------------- EVENTS

    /**
     * Gets called when an operation is updated. Delegates the event.
     * @private
     */

  }, {
    key: '_onOperationUpdate',
    value: function _onOperationUpdate() {
      for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }

      this.emit.apply(this, [Events.OPERATION_UPDATED].concat(args));
    }

    /**
     * Gets called when the WebGL context has been restored. Re-triggers a render.
     * @private
     */
    /* istanbul ignore next */

  }, {
    key: '_onContextRestored',
    value: function _onContextRestored() {
      Log.warn(this.constructor.name, 'Trying to re-render after WebGL context has been restored.');
      this.setAllOperationsToDirty();
      this._operationsStack.forEach(function (operation) {
        operation.disposeRenderTextures();
      });
      this.render();
    }

    // -------------------------------------------------------------------------- RENDERING

    /**
     * Exports the image with the given options. Result of the Promise is the exported image or data url.
     * @param  {PhotoEditorSDK.RenderType} [renderType=PhotoEditorSDK.RenderType.DATAURL] - The output type
     * @param  {PhotoEditorSDK.ImageFormat} [imageFormat=PhotoEditorSDK.ImageFormat.PNG] - The output image format
     * @param  {Number} [quality=0.8] - The image quality, between 0 and 1
     * @return {Promise}
     */

  }, {
    key: 'export',
    value: function _export() {
      var renderType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : RenderType.DATAURL;

      var _this3 = this;

      var imageFormat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ImageFormat.PNG;
      var quality = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.8;

      return this._cv(true).then(function () {
        if (_this3.hasChanges()) {
          _this3._t(); // track exports
        }
        var imageExporter = new __WEBPACK_IMPORTED_MODULE_13__lib_image_exporter__["a" /* default */](_this3, {
          renderType: renderType, imageFormat: imageFormat, quality: quality
        });
        return imageExporter.export();
      });
    }

    /**
     * Renders the current image to the canvas
     * @param {Boolean} renderOutput = true
     * @return {Promise}
     */

  }, {
    key: 'render',
    value: function render() {
      var _this4 = this;

      var renderOutput = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;

      if (!this._inputTexture) {
        throw new Error('You need to set an image before calling PhotoEditorSDK#render.');
      }

      var context = this._renderer.getContext();
      if (context.startFrame) {
        context.startFrame();
      }

      var perfTest = void 0;
      if (Log.canLog('info')) {
        perfTest = new __WEBPACK_IMPORTED_MODULE_14__lib_performance_test__["a" /* default */]('âš¡âš¡âš¡', 'Frame rendering');
      }
      Log.info('âš¡âš¡âš¡', 'Rendering starts');

      var stack = this._operationsStack;
      stack.updateDirtinessForRenderer(this._renderer);

      return this._prepareTexture().then(function (texture) {
        if (_this4._renderMode === 'export') {
          texture = _this4._inputTexture;
        }

        _this4._currentTexture = texture;
        _this4._sprite.setTexture(texture);
        _this4._container.updateTransform();
      }).then(function () {
        return stack.validateSettings();
      }).then(function () {
        return stack.render(_this4, _this4._currentTexture);
      }).then(function (outputTexture) {
        // Input texture has been passed through all operations which return
        // a new RenderTexture. Use this texture for the Sprite and render it
        // to the output canvas.
        _this4._currentTexture = outputTexture;
        _this4._sprite.setTexture(_this4._currentTexture);

        switch (_this4._renderMode) {
          case 'dynamic':
            // Always center image, set scale to zoom level
            var center = _this4._renderer.getDimensions().clone().divide(2).add(_this4._offset);

            _this4._container.setScale(_this4._zoom / _this4.getTextureScale(), _this4._zoom / _this4.getTextureScale());
            _this4._container.setPosition(center);
            _this4._sprite.setAnchor(0.5, 0.5);
            _this4._sprite.setScale(_this4._spriteScale, _this4._spriteScale);
            _this4._sprite.setRotation(_this4._rotation);
            break;
          case 'export':
            // Move sprite to upper left hand corner, render at full scale
            _this4._container.setScale(1, 1);
            _this4._container.setPosition(0, 0);
            _this4._sprite.setAnchor(0, 0);
            _this4._sprite.setPosition(0, 0);
            _this4._sprite.setScale(_this4._spriteScale, _this4._spriteScale);
            _this4._sprite.setRotation(0);
            break;
        }

        // This renders to the output
        if (renderOutput) {
          _this4._renderer.render(_this4._container);
        }

        return outputTexture;
      }).then(function (texture) {
        if (perfTest) {
          perfTest.stop();
        }
        if (context.endFrame) {
          context.endFrame();
        }
        return texture;
      });
    }
  }, {
    key: 'getTextureScale',
    value: function getTextureScale() {
      return Math.min(1, this._textureQuality * this._options.pixelRatio);
    }

    /**
     * Prepares the input texture for the current zoom level
     * @private
     */

  }, {
    key: '_prepareTexture',
    value: function _prepareTexture() {
      var _this5 = this;

      return new __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_promise___default.a(function (resolve, reject) {
        var textureScale = _this5.getTextureScale();
        if (_this5._textureQuality === 1) {
          return resolve(_this5._inputTexture);
        }

        var dimensions = _this5.getInputDimensions().multiply(textureScale).floor();

        var needsRerender = void 0;
        if (!_this5._resizedTexture) {
          _this5._resizedTexture = new Engine.RenderTexture(_this5._renderer, dimensions.x, dimensions.y);
          needsRerender = true;
        } else if (!_this5._resizedTexture.getDimensions().equals(dimensions)) {
          _this5._resizedTexture.resizeTo(dimensions);
          needsRerender = true;
        }

        if (needsRerender) {
          _this5._resizedSprite.setScale(textureScale, textureScale);
          _this5._resizedSprite.setTexture(_this5._inputTexture);
          _this5._resizedTexture.render(_this5._resizedContainer);
        }

        resolve(_this5._resizedTexture);
      });
    }

    // -------------------------------------------------------------------------- OPERATIONS

    /**
     * Registers all default operations
     * @private
     */

  }, {
    key: '_registerOperations',
    value: function _registerOperations() {
      this._operations = {};

      for (var operationName in __WEBPACK_IMPORTED_MODULE_8__operations___) {
        var operation = __WEBPACK_IMPORTED_MODULE_8__operations___[operationName];
        this._operations[operation.identifier] = operation;
      }

      this._operations = Utils.extend(this._operations, this._options.extensions.operations);
    }

    /**
     * Registers the given operations
     * @param  {PhotoEditorSDK.Operation[]} operations
     */

  }, {
    key: 'registerOperations',
    value: function registerOperations(operations) {
      var _this6 = this;

      operations.forEach(function (operation) {
        _this6._operations[operation.identifier] = operation;
      });
    }

    /**
     * Sets all operations in the stack to dirty
     * @param {Boolean} dimensionsChanged = false
     */

  }, {
    key: 'setAllOperationsToDirty',
    value: function setAllOperationsToDirty() {
      var dimensionsChanged = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;

      this._operationsStack.setAllToDirty(dimensionsChanged);
    }

    /**
     * Creates an operation with the given identifier
     * @param {String} identifier
     * @param {Object} [options = {}]
     * @param {Boolean} [addToStack = true]
     * @returns {PhotoEditorSDK.Operation}
     */

  }, {
    key: 'createOperation',
    value: function createOperation(identifier) {
      var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      var addToStack = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;

      var Operation = this._operations[identifier];
      if (!Operation) {
        throw new Error('No operation with identifier `' + identifier + '` found.');
      }

      var operation = new Operation(this, options);
      if (addToStack) {
        this.addOperation(operation);
      }
      return operation;
    }

    /**
     * Adds the given operation to the operations stack
     * @param {PhotoEditorSDK.Operation} operation
     */

  }, {
    key: 'addOperation',
    value: function addOperation(operation) {
      this._operationsStack.push(operation);
    }

    /**
     * Removes the given operation from the operations stack
     * @param  {PhotoEditorSDK.Operation} operation
     */

  }, {
    key: 'removeOperation',
    value: function removeOperation(operation) {
      this._operationsStack.remove(operation);
    }

    // -------------------------------------------------------------------------- DIMENSIONS

    /**
     * Returns the initial image dimensions
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'getInputDimensions',
    value: function getInputDimensions() {
      var frame = this._inputTexture.getFrame();
      return new Vector2(frame.width, frame.height);
    }

    /**
     * Returns the final dimensions that the input image would have
     * after all existing operations have been applied
     * @param {Boolean} incorporateSpriteScale = false
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'getFinalDimensions',
    value: function getFinalDimensions() {
      var incorporateSpriteScale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;

      var dimensions = this.getInputDimensions();
      var operationsStack = this._operationsStack;

      operationsStack.forEach(function (operation) {
        if (!operation.getEnabled()) return;
        dimensions = operation.getNewDimensions(dimensions);
      });

      if (incorporateSpriteScale) {
        dimensions.multiply(this._spriteScale);
      }

      return dimensions.floor();
    }

    /**
     * Returns the current sprite dimensions
     * @param {Boolean} incorporateSpriteScale = false
     * @return {Vector2}
     */

  }, {
    key: 'getOutputDimensions',
    value: function getOutputDimensions() {
      var incorporateSpriteScale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;

      return this.getFinalDimensions(incorporateSpriteScale).clone().multiply(this._zoom).floor();
    }

    /**
     * Returns the dimensions of the output texture
     * @param  {Boolean} incorporateSpriteScale = false
     * @return {Vector2}
     */

  }, {
    key: 'getOutputTextureDimensions',
    value: function getOutputTextureDimensions() {
      var incorporateSpriteScale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;

      var textureScale = this.getTextureScale();
      var dimensions = this.getInputDimensions().multiply(textureScale).floor();
      this._operationsStack.forEach(function (op) {
        dimensions = op.getNewDimensions(dimensions);
      });
      return dimensions;
    }
  }, {
    key: 'getCrossOrigin',
    value: function getCrossOrigin() {
      return Utils.getCrossOrigin(this._options.crossOrigin || 'Anonymous');
    }

    // -------------------------------------------------------------------------- MISC

    /**
     * Checks for version updates
     * @private
     */

  }, {
    key: '_checkForUpdates',
    value: function _checkForUpdates() {
      if (!this._l.isENT()) {
        this._versionChecker = new __WEBPACK_IMPORTED_MODULE_10__lib_version_checker__["a" /* default */](this.version);
      }
    }

    /**
     * Initializes the renderer
     * @private
     */

  }, {
    key: '_initRenderer',
    value: function _initRenderer() {
      var rendererOptions = {
        canvas: this._options.canvas,
        pixelRatio: this._options.pixelRatio,
        debug: this._options.debug,
        transparent: this._options.transparent,
        clearColor: this._options.clearColor
      };

      var width = void 0,
          height = void 0;
      if (this._renderMode === 'dynamic' && this._options.canvas) {
        var canvas = this._options.canvas;

        width = canvas.width;
        height = canvas.height;
      } else if (this._inputTexture) {
        var dimensions = this.getFinalDimensions();
        width = dimensions.x;
        height = dimensions.y;
      } else {
        width = 1;
        height = 1;
      }

      switch (this._preferredRenderer) {
        /* istanbul ignore next */
        case RendererType.WEBGL:
          this._renderer = Engine.autoDetectRenderer(width, height, rendererOptions);
          this._renderer.on('context-restored', this._onContextRestored);
          break;
        case RendererType.CANVAS:
          this._renderer = new Engine.CanvasRenderer(width, height, rendererOptions);
          this._renderer.on('context-restored', this._onContextRestored);
          break;
        default:
          Log.warn('PhotoEditorSDK', 'PhotoEditorSDK Error: Renderer `' + this._preferredRenderer + '` not supported. Falling back to automatically detected renderer.');
          this._renderer = Engine.autoDetectRenderer(width, height, rendererOptions);
      }
    }

    /**
     * Resizes the renderer to the given dimensions
     * @param  {PhotoEditorSDK.Math.Vector2} dimensions
     */

  }, {
    key: 'resizeTo',
    value: function resizeTo(dimensions) {
      this._renderer.resizeTo(dimensions, true);
    }

    /**
     * Resets all custom and selected operations
     */

  }, {
    key: 'reset',
    value: function reset() {
      this._operationsStack.clear();
    }

    // -------------------------------------------------------------------------- EXIF

    /**
     * Parses the exif data and fixes the orientation if necessary
     * @param {Image} image
     * @private
     * @TODO Move this somewhere else
     */

  }, {
    key: 'parseExif',
    value: function parseExif(image) {
      if (!image) {
        return;
      }
      var src = image.src;

      var isJPEG = false;
      var base64String = null;

      if (true) {
        isJPEG = __WEBPACK_IMPORTED_MODULE_11__lib_exif__["a" /* default */].isJPEG(src);
        base64String = src;
      } else {
        if (image instanceof Image && image.rawSource) {
          var buf = image.rawSource;
          if (!(image.rawSource instanceof Buffer)) {
            var source = image.rawSource.replace('data:image/jpeg;base64,', '');
            buf = Buffer.from(source, 'base64');
            src = image.rawSource;
          } else {
            src = image.rawSource.toString('base64');
          }
          isJPEG = Exif.bufferIsJPEG(buf);
          if (isJPEG) {
            base64String = src;
          }
        }
      }

      if (isJPEG) {
        var exif = null;
        try {
          exif = __WEBPACK_IMPORTED_MODULE_11__lib_exif__["a" /* default */].fromBase64String(base64String);
        } catch (e) {}
        if (!exif) {
          return;
        }

        return exif;
      }
    }

    /**
     * Reads the EXIF orientation tag and fixes it with the OrientationOperation
     * @private
     */

  }, {
    key: '_handleExifOrientation',
    value: function _handleExifOrientation() {
      var exifTags = this._exif.getTags();

      if (exifTags && exifTags.Orientation) {
        var rotationNeedsChange = exifTags.Orientation !== 1 && exifTags.Orientation !== 2;
        var flipNeedsChange = [2, 4, 5, 7].indexOf(exifTags.Orientation) !== -1;

        if (rotationNeedsChange || flipNeedsChange) {
          if (!this._exifOperation) {
            this._exifOperation = this.createOperation('exif-orientation');
          }
          this._exifOperation.setTags(exifTags);

          // We fixed the orientation, new EXIF orientation is 1
          this._exif.setOrientation(1);
        }
      }
    }

    // -------------------------------------------------------------------------- GETTERS / SETTERS

    /**
     * Checks if an image is provided
     * @return {Boolean} [description]
     */

  }, {
    key: 'hasImage',
    value: function hasImage() {
      return this._image !== null && typeof this._image !== 'undefined';
    }

    /**
     * Returns the image
     * @return {Image}
     */

  }, {
    key: 'getImage',
    value: function getImage() {
      return this._image;
    }

    /**
     * Sets the image and parses the exif data
     * @param {Image} image
     * @param {PhotoEditorSDK.Exif} [exif = null]
     * @param {PhotoEditorSDK.Math.Vector2} [dimensions]
     */

  }, {
    key: 'setImage',
    value: function setImage(image) {
      var exif = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
      var dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;

      // Reset exif orientation compensation
      if (this._exifOperation) {
        this.removeOperation(this._exifOperation);
        this._exifOperation = null;
      }

      this._options.image = image;
      this._image = image;

      this._exif = exif || this.parseExif(image);
      if (this._exif) {
        this._handleExifOrientation();
      }

      var baseTexture = new Engine.BaseTexture(this._image);
      var frame = new Rectangle(0, 0, this._image.naturalWidth || this._image.width, this._image.naturalHeight || this._image.height);
      if (dimensions) {
        frame.width = dimensions.x;
        frame.height = dimensions.y;
      }

      if (this._resizedTexture) {
        this._resizedTexture.dispose();
      }
      this._resizedTexture = null;

      if (this._inputTexture) {
        this._inputTexture.getBaseTexture().dispose();
      }
      this._inputTexture = new Engine.Texture(baseTexture, frame);
      this._currentTexture = this._inputTexture;
      this._sprite.clearTexture();
      this._sprite.setTexture(this._inputTexture);

      this.setAllOperationsToDirty(true);
    }

    /**
     * Set the input texture for this SDK as an alternative to passing in an image
     * @param {PhotoEditorSDK.Engine.Texture} texture
     */

  }, {
    key: 'setInputTexture',
    value: function setInputTexture(texture) {
      this._inputTexture = texture;
    }

    /**
     * Returns the canvas
     * @return {HTMLCanvasElement}
     */

  }, {
    key: 'getCanvas',
    value: function getCanvas() {
      return this._renderer.getCanvas();
    }

    /**
     * Sets the canvas
     * @param {HTMLCanvasElement} canvas
     */

  }, {
    key: 'setCanvas',
    value: function setCanvas(canvas) {
      this._renderer.setCanvas(canvas);
    }

    /**
     * Returns the sprite
     * @return {PhotoEditorSDK.Engine.Sprite}
     */

  }, {
    key: 'getSprite',
    value: function getSprite() {
      return this._sprite;
    }

    /**
     * Returns the container
     * @return {PhotoEditorSDK.Engine.Container}
     */

  }, {
    key: 'getContainer',
    value: function getContainer() {
      return this._container;
    }

    /**
     * Returns the operation stack
     * @return {PhotoEditorSDK.OperationsStack}
     */

  }, {
    key: 'getOperationsStack',
    value: function getOperationsStack() {
      return this._operationsStack;
    }

    /**
     * Sets the operations stack
     * @param {PhotoEditorSDK.OperationsStack} operationsStack
     */

  }, {
    key: 'setOperationsStack',
    value: function setOperationsStack(operationsStack) {
      if (this._operationsStack) {
        this._operationsStack.off(Events.OPERATION_UPDATED, this._onOperationUpdate);
      }

      this._operationsStack = operationsStack;
      this._operationsStack.on(Events.OPERATION_UPDATED, this._onOperationUpdate);
    }

    /**
     * Returns the available operations
     * @return {Operation[]}
     */

  }, {
    key: 'getOperations',
    value: function getOperations() {
      return this._operations;
    }

    /**
     * Returns the renderer
     * @return {PhotoEditorSDK.Engine.BaseRenderer}
     */

  }, {
    key: 'getRenderer',
    value: function getRenderer() {
      return this._renderer;
    }

    /**
     * Returns the rendering offset
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'getOffset',
    value: function getOffset() {
      return this._offset;
    }

    /**
     * Sets the rendering offset
     * @param {PhotoEditorSDK.Math.Vector2|Number} offset
     * @param {Number} y
     */

  }, {
    key: 'setOffset',
    value: function setOffset(offset, y) {
      if (offset instanceof Vector2) {
        this._offset.copy(offset);
      } else {
        this._offset.set(offset, y);
      }
    }

    /**
     * Returns the current render mode
     * @return {String}
     */

  }, {
    key: 'getRenderMode',
    value: function getRenderMode() {
      return this._renderMode;
    }

    /**
     * Sets the render mode
     * @param {String} renderMode
     */

  }, {
    key: 'setRenderMode',
    value: function setRenderMode(renderMode) {
      this._renderMode = renderMode;
    }

    /**
     * Returns the zoom level
     * @return {Number}
     */

  }, {
    key: 'getZoom',
    value: function getZoom() {
      return this._zoom;
    }

    /**
     * Sets the zoom level
     * @param {Number} zoom
     */

  }, {
    key: 'setZoom',
    value: function setZoom(zoom) {
      this._zoom = zoom;
      this._container.setScale(this._zoom, this._zoom);
      this._container.updateTransform();
    }

    /**
     * Returns the texture quality
     * @return {Number}
     */

  }, {
    key: 'getTextureQuality',
    value: function getTextureQuality() {
      if (this._renderMode === 'export') {
        return 1;
      }

      return this._textureQuality;
    }

    /**
     * Sets the texture quality
     * @param {Number} textureQuality
     */

  }, {
    key: 'setTextureQuality',
    value: function setTextureQuality(textureQuality) {
      if (textureQuality !== this._textureQuality) {
        this.setAllOperationsToDirty(true);
      }
      this._textureQuality = Math.min(1, textureQuality);

      // Clean up resized texture, not needed right now
      if (this._textureQuality === 1 && this._resizedTexture) {
        this._resizedTexture.dispose();
        this._resizedTexture = null;
      }
    }

    /**
     * Returns the output sprite's scale
     * @return {Number}
     */

  }, {
    key: 'getSpriteScale',
    value: function getSpriteScale() {
      return this._spriteScale;
    }

    /**
     * Sets the sprite scale to the given value
     * @param {Number} spriteScale
     */

  }, {
    key: 'setSpriteScale',
    value: function setSpriteScale(spriteScale) {
      this._spriteScale = spriteScale;
      this._sprite.setScale(spriteScale, spriteScale);
      this._sprite.updateTransform();
    }

    /**
     * Returns the pixel ratio
     * @return {Number}
     */

  }, {
    key: 'getPixelRatio',
    value: function getPixelRatio() {
      return this._options.pixelRatio;
    }

    /**
     * Returns the Exif instance
     * @return {PhotoEditorSDK.Exif} [description]
     */

  }, {
    key: 'getExif',
    value: function getExif() {
      return this._exif;
    }

    /**
     * Returns the options
     * @return {Object}
     */

  }, {
    key: 'getOptions',
    value: function getOptions() {
      return this._options;
    }

    /**
     * Returns the input texture
     * @return {PhotoEditorSDK.Engine.Texture}
     */

  }, {
    key: 'getInputTexture',
    value: function getInputTexture() {
      return this._inputTexture;
    }

    /**
     * Sets the smooth downscaling flag for the output sprite
     * @param {Boolean} smoothDownscaling
     */

  }, {
    key: 'setSmoothDownscaling',
    value: function setSmoothDownscaling(smoothDownscaling) {
      this._options.smoothDownscaling = smoothDownscaling;
      this._sprite.setSmoothDownscaling(smoothDownscaling);
      this._resizedSprite.setSmoothDownscaling(smoothDownscaling);
    }

    /**
     * Sets the rotation to the given value
     * @param {Number} rotation
     */

  }, {
    key: 'setRotation',
    value: function setRotation(rotation) {
      this._rotation = rotation;
    }

    /**
     * Returns the current rotation
     */

  }, {
    key: 'getRotation',
    value: function getRotation() {
      return this._rotation;
    }

    /**
     * Check if the OperationsStack has changes
     * @return {Boolean}
     */

  }, {
    key: 'hasChanges',
    value: function hasChanges() {
      return this.getOperationsStack().hasChanges();
    }
    // -------------------------------------------------------------------------- DISPOSAL

    /**
     * Disposes the SDK
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      this._operationsStack.dispose();
      this._renderer.dispose();
      if (this._exif) {
        this._exif.dispose();
      }
      if (this._resizedTexture) {
        this._resizedTexture.dispose();
      }
    }
  }]);

  return PhotoEditorSDK;
}(EventEmitter);

/* harmony default export */ __webpack_exports__["a"] = (PhotoEditorSDK);

/***/ }),
/* 160 */
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(45);
__webpack_require__(66);
module.exports = __webpack_require__(86).f('iterator');


/***/ }),
/* 161 */
/***/ (function(module, exports, __webpack_require__) {

var toInteger = __webpack_require__(77);
var defined = __webpack_require__(78);
// true  -> String#at
// false -> String#codePointAt
module.exports = function (TO_STRING) {
  return function (that, pos) {
    var s = String(defined(that));
    var i = toInteger(pos);
    var l = s.length;
    var a, b;
    if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
    a = s.charCodeAt(i);
    return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
      ? TO_STRING ? s.charAt(i) : a
      : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  };
};


/***/ }),
/* 162 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var create = __webpack_require__(81);
var descriptor = __webpack_require__(46);
var setToStringTag = __webpack_require__(65);
var IteratorPrototype = {};

// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
__webpack_require__(26)(IteratorPrototype, __webpack_require__(11)('iterator'), function () { return this; });

module.exports = function (Constructor, NAME, next) {
  Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });
  setToStringTag(Constructor, NAME + ' Iterator');
};


/***/ }),
/* 163 */
/***/ (function(module, exports, __webpack_require__) {

var dP = __webpack_require__(21);
var anObject = __webpack_require__(18);
var getKeys = __webpack_require__(47);

module.exports = __webpack_require__(25) ? Object.defineProperties : function defineProperties(O, Properties) {
  anObject(O);
  var keys = getKeys(Properties);
  var length = keys.length;
  var i = 0;
  var P;
  while (length > i) dP.f(O, P = keys[i++], Properties[P]);
  return O;
};


/***/ }),
/* 164 */
/***/ (function(module, exports, __webpack_require__) {

// false -> Array#indexOf
// true  -> Array#includes
var toIObject = __webpack_require__(28);
var toLength = __webpack_require__(82);
var toAbsoluteIndex = __webpack_require__(165);
module.exports = function (IS_INCLUDES) {
  return function ($this, el, fromIndex) {
    var O = toIObject($this);
    var length = toLength(O.length);
    var index = toAbsoluteIndex(fromIndex, length);
    var value;
    // Array#includes uses SameValueZero equality algorithm
    // eslint-disable-next-line no-self-compare
    if (IS_INCLUDES && el != el) while (length > index) {
      value = O[index++];
      // eslint-disable-next-line no-self-compare
      if (value != value) return true;
    // Array#indexOf ignores holes, Array#includes - not
    } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
      if (O[index] === el) return IS_INCLUDES || index || 0;
    } return !IS_INCLUDES && -1;
  };
};


/***/ }),
/* 165 */
/***/ (function(module, exports, __webpack_require__) {

var toInteger = __webpack_require__(77);
var max = Math.max;
var min = Math.min;
module.exports = function (index, length) {
  index = toInteger(index);
  return index < 0 ? max(index + length, 0) : min(index, length);
};


/***/ }),
/* 166 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var addToUnscopables = __webpack_require__(167);
var step = __webpack_require__(168);
var Iterators = __webpack_require__(38);
var toIObject = __webpack_require__(28);

// 22.1.3.4 Array.prototype.entries()
// 22.1.3.13 Array.prototype.keys()
// 22.1.3.29 Array.prototype.values()
// 22.1.3.30 Array.prototype[@@iterator]()
module.exports = __webpack_require__(109)(Array, 'Array', function (iterated, kind) {
  this._t = toIObject(iterated); // target
  this._i = 0;                   // next index
  this._k = kind;                // kind
// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
}, function () {
  var O = this._t;
  var kind = this._k;
  var index = this._i++;
  if (!O || index >= O.length) {
    this._t = undefined;
    return step(1);
  }
  if (kind == 'keys') return step(0, index);
  if (kind == 'values') return step(0, O[index]);
  return step(0, [index, O[index]]);
}, 'values');

// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
Iterators.Arguments = Iterators.Array;

addToUnscopables('keys');
addToUnscopables('values');
addToUnscopables('entries');


/***/ }),
/* 167 */
/***/ (function(module, exports) {

module.exports = function () { /* empty */ };


/***/ }),
/* 168 */
/***/ (function(module, exports) {

module.exports = function (done, value) {
  return { value: value, done: !!done };
};


/***/ }),
/* 169 */
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(170);
__webpack_require__(117);
__webpack_require__(175);
__webpack_require__(176);
module.exports = __webpack_require__(10).Symbol;


/***/ }),
/* 170 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// ECMAScript 6 symbols shim
var global = __webpack_require__(14);
var has = __webpack_require__(27);
var DESCRIPTORS = __webpack_require__(25);
var $export = __webpack_require__(13);
var redefine = __webpack_require__(111);
var META = __webpack_require__(171).KEY;
var $fails = __webpack_require__(37);
var shared = __webpack_require__(84);
var setToStringTag = __webpack_require__(65);
var uid = __webpack_require__(64);
var wks = __webpack_require__(11);
var wksExt = __webpack_require__(86);
var wksDefine = __webpack_require__(87);
var enumKeys = __webpack_require__(172);
var isArray = __webpack_require__(173);
var anObject = __webpack_require__(18);
var isObject = __webpack_require__(24);
var toIObject = __webpack_require__(28);
var toPrimitive = __webpack_require__(80);
var createDesc = __webpack_require__(46);
var _create = __webpack_require__(81);
var gOPNExt = __webpack_require__(174);
var $GOPD = __webpack_require__(89);
var $DP = __webpack_require__(21);
var $keys = __webpack_require__(47);
var gOPD = $GOPD.f;
var dP = $DP.f;
var gOPN = gOPNExt.f;
var $Symbol = global.Symbol;
var $JSON = global.JSON;
var _stringify = $JSON && $JSON.stringify;
var PROTOTYPE = 'prototype';
var HIDDEN = wks('_hidden');
var TO_PRIMITIVE = wks('toPrimitive');
var isEnum = {}.propertyIsEnumerable;
var SymbolRegistry = shared('symbol-registry');
var AllSymbols = shared('symbols');
var OPSymbols = shared('op-symbols');
var ObjectProto = Object[PROTOTYPE];
var USE_NATIVE = typeof $Symbol == 'function';
var QObject = global.QObject;
// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;

// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
var setSymbolDesc = DESCRIPTORS && $fails(function () {
  return _create(dP({}, 'a', {
    get: function () { return dP(this, 'a', { value: 7 }).a; }
  })).a != 7;
}) ? function (it, key, D) {
  var protoDesc = gOPD(ObjectProto, key);
  if (protoDesc) delete ObjectProto[key];
  dP(it, key, D);
  if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);
} : dP;

var wrap = function (tag) {
  var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
  sym._k = tag;
  return sym;
};

var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) {
  return typeof it == 'symbol';
} : function (it) {
  return it instanceof $Symbol;
};

var $defineProperty = function defineProperty(it, key, D) {
  if (it === ObjectProto) $defineProperty(OPSymbols, key, D);
  anObject(it);
  key = toPrimitive(key, true);
  anObject(D);
  if (has(AllSymbols, key)) {
    if (!D.enumerable) {
      if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));
      it[HIDDEN][key] = true;
    } else {
      if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
      D = _create(D, { enumerable: createDesc(0, false) });
    } return setSymbolDesc(it, key, D);
  } return dP(it, key, D);
};
var $defineProperties = function defineProperties(it, P) {
  anObject(it);
  var keys = enumKeys(P = toIObject(P));
  var i = 0;
  var l = keys.length;
  var key;
  while (l > i) $defineProperty(it, key = keys[i++], P[key]);
  return it;
};
var $create = function create(it, P) {
  return P === undefined ? _create(it) : $defineProperties(_create(it), P);
};
var $propertyIsEnumerable = function propertyIsEnumerable(key) {
  var E = isEnum.call(this, key = toPrimitive(key, true));
  if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;
  return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
};
var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
  it = toIObject(it);
  key = toPrimitive(key, true);
  if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;
  var D = gOPD(it, key);
  if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
  return D;
};
var $getOwnPropertyNames = function getOwnPropertyNames(it) {
  var names = gOPN(toIObject(it));
  var result = [];
  var i = 0;
  var key;
  while (names.length > i) {
    if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
  } return result;
};
var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
  var IS_OP = it === ObjectProto;
  var names = gOPN(IS_OP ? OPSymbols : toIObject(it));
  var result = [];
  var i = 0;
  var key;
  while (names.length > i) {
    if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);
  } return result;
};

// 19.4.1.1 Symbol([description])
if (!USE_NATIVE) {
  $Symbol = function Symbol() {
    if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
    var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
    var $set = function (value) {
      if (this === ObjectProto) $set.call(OPSymbols, value);
      if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
      setSymbolDesc(this, tag, createDesc(1, value));
    };
    if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set });
    return wrap(tag);
  };
  redefine($Symbol[PROTOTYPE], 'toString', function toString() {
    return this._k;
  });

  $GOPD.f = $getOwnPropertyDescriptor;
  $DP.f = $defineProperty;
  __webpack_require__(116).f = gOPNExt.f = $getOwnPropertyNames;
  __webpack_require__(67).f = $propertyIsEnumerable;
  __webpack_require__(88).f = $getOwnPropertySymbols;

  if (DESCRIPTORS && !__webpack_require__(62)) {
    redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
  }

  wksExt.f = function (name) {
    return wrap(wks(name));
  };
}

$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol });

for (var es6Symbols = (
  // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
  'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]);

for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]);

$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
  // 19.4.2.1 Symbol.for(key)
  'for': function (key) {
    return has(SymbolRegistry, key += '')
      ? SymbolRegistry[key]
      : SymbolRegistry[key] = $Symbol(key);
  },
  // 19.4.2.5 Symbol.keyFor(sym)
  keyFor: function keyFor(sym) {
    if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
    for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;
  },
  useSetter: function () { setter = true; },
  useSimple: function () { setter = false; }
});

$export($export.S + $export.F * !USE_NATIVE, 'Object', {
  // 19.1.2.2 Object.create(O [, Properties])
  create: $create,
  // 19.1.2.4 Object.defineProperty(O, P, Attributes)
  defineProperty: $defineProperty,
  // 19.1.2.3 Object.defineProperties(O, Properties)
  defineProperties: $defineProperties,
  // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
  getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
  // 19.1.2.7 Object.getOwnPropertyNames(O)
  getOwnPropertyNames: $getOwnPropertyNames,
  // 19.1.2.8 Object.getOwnPropertySymbols(O)
  getOwnPropertySymbols: $getOwnPropertySymbols
});

// 24.3.2 JSON.stringify(value [, replacer [, space]])
$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {
  var S = $Symbol();
  // MS Edge converts symbol values to JSON as {}
  // WebKit converts symbol values to JSON as null
  // V8 throws on boxed symbols
  return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
})), 'JSON', {
  stringify: function stringify(it) {
    var args = [it];
    var i = 1;
    var replacer, $replacer;
    while (arguments.length > i) args.push(arguments[i++]);
    $replacer = replacer = args[1];
    if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
    if (!isArray(replacer)) replacer = function (key, value) {
      if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
      if (!isSymbol(value)) return value;
    };
    args[1] = replacer;
    return _stringify.apply($JSON, args);
  }
});

// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
$Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(26)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
// 19.4.3.5 Symbol.prototype[@@toStringTag]
setToStringTag($Symbol, 'Symbol');
// 20.2.1.9 Math[@@toStringTag]
setToStringTag(Math, 'Math', true);
// 24.3.3 JSON[@@toStringTag]
setToStringTag(global.JSON, 'JSON', true);


/***/ }),
/* 171 */
/***/ (function(module, exports, __webpack_require__) {

var META = __webpack_require__(64)('meta');
var isObject = __webpack_require__(24);
var has = __webpack_require__(27);
var setDesc = __webpack_require__(21).f;
var id = 0;
var isExtensible = Object.isExtensible || function () {
  return true;
};
var FREEZE = !__webpack_require__(37)(function () {
  return isExtensible(Object.preventExtensions({}));
});
var setMeta = function (it) {
  setDesc(it, META, { value: {
    i: 'O' + ++id, // object ID
    w: {}          // weak collections IDs
  } });
};
var fastKey = function (it, create) {
  // return primitive with prefix
  if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  if (!has(it, META)) {
    // can't set metadata to uncaught frozen object
    if (!isExtensible(it)) return 'F';
    // not necessary to add metadata
    if (!create) return 'E';
    // add missing metadata
    setMeta(it);
  // return object ID
  } return it[META].i;
};
var getWeak = function (it, create) {
  if (!has(it, META)) {
    // can't set metadata to uncaught frozen object
    if (!isExtensible(it)) return true;
    // not necessary to add metadata
    if (!create) return false;
    // add missing metadata
    setMeta(it);
  // return hash weak collections IDs
  } return it[META].w;
};
// add metadata on freeze-family methods calling
var onFreeze = function (it) {
  if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
  return it;
};
var meta = module.exports = {
  KEY: META,
  NEED: false,
  fastKey: fastKey,
  getWeak: getWeak,
  onFreeze: onFreeze
};


/***/ }),
/* 172 */
/***/ (function(module, exports, __webpack_require__) {

// all enumerable object keys, includes symbols
var getKeys = __webpack_require__(47);
var gOPS = __webpack_require__(88);
var pIE = __webpack_require__(67);
module.exports = function (it) {
  var result = getKeys(it);
  var getSymbols = gOPS.f;
  if (getSymbols) {
    var symbols = getSymbols(it);
    var isEnum = pIE.f;
    var i = 0;
    var key;
    while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);
  } return result;
};


/***/ }),
/* 173 */
/***/ (function(module, exports, __webpack_require__) {

// 7.2.2 IsArray(argument)
var cof = __webpack_require__(48);
module.exports = Array.isArray || function isArray(arg) {
  return cof(arg) == 'Array';
};


/***/ }),
/* 174 */
/***/ (function(module, exports, __webpack_require__) {

// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
var toIObject = __webpack_require__(28);
var gOPN = __webpack_require__(116).f;
var toString = {}.toString;

var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
  ? Object.getOwnPropertyNames(window) : [];

var getWindowNames = function (it) {
  try {
    return gOPN(it);
  } catch (e) {
    return windowNames.slice();
  }
};

module.exports.f = function getOwnPropertyNames(it) {
  return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
};


/***/ }),
/* 175 */
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(87)('asyncIterator');


/***/ }),
/* 176 */
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(87)('observable');


/***/ }),
/* 177 */
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(178);
var $Object = __webpack_require__(10).Object;
module.exports = function defineProperty(it, key, desc) {
  return $Object.defineProperty(it, key, desc);
};


/***/ }),
/* 178 */
/***/ (function(module, exports, __webpack_require__) {

var $export = __webpack_require__(13);
// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
$export($export.S + $export.F * !__webpack_require__(25), 'Object', { defineProperty: __webpack_require__(21).f });


/***/ }),
/* 179 */
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(180);
module.exports = __webpack_require__(10).Object.setPrototypeOf;


/***/ }),
/* 180 */
/***/ (function(module, exports, __webpack_require__) {

// 19.1.3.19 Object.setPrototypeOf(O, proto)
var $export = __webpack_require__(13);
$export($export.S, 'Object', { setPrototypeOf: __webpack_require__(181).set });


/***/ }),
/* 181 */
/***/ (function(module, exports, __webpack_require__) {

// Works with __proto__ only. Old v8 can't work with null proto objects.
/* eslint-disable no-proto */
var isObject = __webpack_require__(24);
var anObject = __webpack_require__(18);
var check = function (O, proto) {
  anObject(O);
  if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!");
};
module.exports = {
  set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
    function (test, buggy, set) {
      try {
        set = __webpack_require__(36)(Function.call, __webpack_require__(89).f(Object.prototype, '__proto__').set, 2);
        set(test, []);
        buggy = !(test instanceof Array);
      } catch (e) { buggy = true; }
      return function setPrototypeOf(O, proto) {
        check(O, proto);
        if (buggy) O.__proto__ = proto;
        else set(O, proto);
        return O;
      };
    }({}, false) : undefined),
  check: check
};


/***/ }),
/* 182 */
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(183);
var $Object = __webpack_require__(10).Object;
module.exports = function create(P, D) {
  return $Object.create(P, D);
};


/***/ }),
/* 183 */
/***/ (function(module, exports, __webpack_require__) {

var $export = __webpack_require__(13);
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
$export($export.S, 'Object', { create: __webpack_require__(81) });


/***/ }),
/* 184 */
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(117);
__webpack_require__(45);
__webpack_require__(66);
__webpack_require__(185);
__webpack_require__(192);
__webpack_require__(193);
module.exports = __webpack_require__(10).Promise;


/***/ }),
/* 185 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var LIBRARY = __webpack_require__(62);
var global = __webpack_require__(14);
var ctx = __webpack_require__(36);
var classof = __webpack_require__(90);
var $export = __webpack_require__(13);
var isObject = __webpack_require__(24);
var aFunction = __webpack_require__(63);
var anInstance = __webpack_require__(186);
var forOf = __webpack_require__(187);
var speciesConstructor = __webpack_require__(120);
var task = __webpack_require__(92).set;
var microtask = __webpack_require__(189)();
var newPromiseCapabilityModule = __webpack_require__(93);
var perform = __webpack_require__(121);
var promiseResolve = __webpack_require__(122);
var PROMISE = 'Promise';
var TypeError = global.TypeError;
var process = global.process;
var $Promise = global[PROMISE];
var isNode = classof(process) == 'process';
var empty = function () { /* empty */ };
var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;
var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f;

var USE_NATIVE = !!function () {
  try {
    // correct subclassing with @@species support
    var promise = $Promise.resolve(1);
    var FakePromise = (promise.constructor = {})[__webpack_require__(11)('species')] = function (exec) {
      exec(empty, empty);
    };
    // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
    return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise;
  } catch (e) { /* empty */ }
}();

// helpers
var isThenable = function (it) {
  var then;
  return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
};
var notify = function (promise, isReject) {
  if (promise._n) return;
  promise._n = true;
  var chain = promise._c;
  microtask(function () {
    var value = promise._v;
    var ok = promise._s == 1;
    var i = 0;
    var run = function (reaction) {
      var handler = ok ? reaction.ok : reaction.fail;
      var resolve = reaction.resolve;
      var reject = reaction.reject;
      var domain = reaction.domain;
      var result, then;
      try {
        if (handler) {
          if (!ok) {
            if (promise._h == 2) onHandleUnhandled(promise);
            promise._h = 1;
          }
          if (handler === true) result = value;
          else {
            if (domain) domain.enter();
            result = handler(value);
            if (domain) domain.exit();
          }
          if (result === reaction.promise) {
            reject(TypeError('Promise-chain cycle'));
          } else if (then = isThenable(result)) {
            then.call(result, resolve, reject);
          } else resolve(result);
        } else reject(value);
      } catch (e) {
        reject(e);
      }
    };
    while (chain.length > i) run(chain[i++]); // variable length - can't use forEach
    promise._c = [];
    promise._n = false;
    if (isReject && !promise._h) onUnhandled(promise);
  });
};
var onUnhandled = function (promise) {
  task.call(global, function () {
    var value = promise._v;
    var unhandled = isUnhandled(promise);
    var result, handler, console;
    if (unhandled) {
      result = perform(function () {
        if (isNode) {
          process.emit('unhandledRejection', value, promise);
        } else if (handler = global.onunhandledrejection) {
          handler({ promise: promise, reason: value });
        } else if ((console = global.console) && console.error) {
          console.error('Unhandled promise rejection', value);
        }
      });
      // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
      promise._h = isNode || isUnhandled(promise) ? 2 : 1;
    } promise._a = undefined;
    if (unhandled && result.e) throw result.v;
  });
};
var isUnhandled = function (promise) {
  return promise._h !== 1 && (promise._a || promise._c).length === 0;
};
var onHandleUnhandled = function (promise) {
  task.call(global, function () {
    var handler;
    if (isNode) {
      process.emit('rejectionHandled', promise);
    } else if (handler = global.onrejectionhandled) {
      handler({ promise: promise, reason: promise._v });
    }
  });
};
var $reject = function (value) {
  var promise = this;
  if (promise._d) return;
  promise._d = true;
  promise = promise._w || promise; // unwrap
  promise._v = value;
  promise._s = 2;
  if (!promise._a) promise._a = promise._c.slice();
  notify(promise, true);
};
var $resolve = function (value) {
  var promise = this;
  var then;
  if (promise._d) return;
  promise._d = true;
  promise = promise._w || promise; // unwrap
  try {
    if (promise === value) throw TypeError("Promise can't be resolved itself");
    if (then = isThenable(value)) {
      microtask(function () {
        var wrapper = { _w: promise, _d: false }; // wrap
        try {
          then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
        } catch (e) {
          $reject.call(wrapper, e);
        }
      });
    } else {
      promise._v = value;
      promise._s = 1;
      notify(promise, false);
    }
  } catch (e) {
    $reject.call({ _w: promise, _d: false }, e); // wrap
  }
};

// constructor polyfill
if (!USE_NATIVE) {
  // 25.4.3.1 Promise(executor)
  $Promise = function Promise(executor) {
    anInstance(this, $Promise, PROMISE, '_h');
    aFunction(executor);
    Internal.call(this);
    try {
      executor(ctx($resolve, this, 1), ctx($reject, this, 1));
    } catch (err) {
      $reject.call(this, err);
    }
  };
  // eslint-disable-next-line no-unused-vars
  Internal = function Promise(executor) {
    this._c = [];             // <- awaiting reactions
    this._a = undefined;      // <- checked in isUnhandled reactions
    this._s = 0;              // <- state
    this._d = false;          // <- done
    this._v = undefined;      // <- value
    this._h = 0;              // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
    this._n = false;          // <- notify
  };
  Internal.prototype = __webpack_require__(190)($Promise.prototype, {
    // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
    then: function then(onFulfilled, onRejected) {
      var reaction = newPromiseCapability(speciesConstructor(this, $Promise));
      reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
      reaction.fail = typeof onRejected == 'function' && onRejected;
      reaction.domain = isNode ? process.domain : undefined;
      this._c.push(reaction);
      if (this._a) this._a.push(reaction);
      if (this._s) notify(this, false);
      return reaction.promise;
    },
    // 25.4.5.1 Promise.prototype.catch(onRejected)
    'catch': function (onRejected) {
      return this.then(undefined, onRejected);
    }
  });
  OwnPromiseCapability = function () {
    var promise = new Internal();
    this.promise = promise;
    this.resolve = ctx($resolve, promise, 1);
    this.reject = ctx($reject, promise, 1);
  };
  newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
    return C === $Promise || C === Wrapper
      ? new OwnPromiseCapability(C)
      : newGenericPromiseCapability(C);
  };
}

$export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise });
__webpack_require__(65)($Promise, PROMISE);
__webpack_require__(191)(PROMISE);
Wrapper = __webpack_require__(10)[PROMISE];

// statics
$export($export.S + $export.F * !USE_NATIVE, PROMISE, {
  // 25.4.4.5 Promise.reject(r)
  reject: function reject(r) {
    var capability = newPromiseCapability(this);
    var $$reject = capability.reject;
    $$reject(r);
    return capability.promise;
  }
});
$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
  // 25.4.4.6 Promise.resolve(x)
  resolve: function resolve(x) {
    return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x);
  }
});
$export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(123)(function (iter) {
  $Promise.all(iter)['catch'](empty);
})), PROMISE, {
  // 25.4.4.1 Promise.all(iterable)
  all: function all(iterable) {
    var C = this;
    var capability = newPromiseCapability(C);
    var resolve = capability.resolve;
    var reject = capability.reject;
    var result = perform(function () {
      var values = [];
      var index = 0;
      var remaining = 1;
      forOf(iterable, false, function (promise) {
        var $index = index++;
        var alreadyCalled = false;
        values.push(undefined);
        remaining++;
        C.resolve(promise).then(function (value) {
          if (alreadyCalled) return;
          alreadyCalled = true;
          values[$index] = value;
          --remaining || resolve(values);
        }, reject);
      });
      --remaining || resolve(values);
    });
    if (result.e) reject(result.v);
    return capability.promise;
  },
  // 25.4.4.4 Promise.race(iterable)
  race: function race(iterable) {
    var C = this;
    var capability = newPromiseCapability(C);
    var reject = capability.reject;
    var result = perform(function () {
      forOf(iterable, false, function (promise) {
        C.resolve(promise).then(capability.resolve, reject);
      });
    });
    if (result.e) reject(result.v);
    return capability.promise;
  }
});


/***/ }),
/* 186 */
/***/ (function(module, exports) {

module.exports = function (it, Constructor, name, forbiddenField) {
  if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
    throw TypeError(name + ': incorrect invocation!');
  } return it;
};


/***/ }),
/* 187 */
/***/ (function(module, exports, __webpack_require__) {

var ctx = __webpack_require__(36);
var call = __webpack_require__(118);
var isArrayIter = __webpack_require__(119);
var anObject = __webpack_require__(18);
var toLength = __webpack_require__(82);
var getIterFn = __webpack_require__(91);
var BREAK = {};
var RETURN = {};
var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
  var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable);
  var f = ctx(fn, that, entries ? 2 : 1);
  var index = 0;
  var length, step, iterator, result;
  if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
  // fast case for arrays with default iterator
  if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {
    result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
    if (result === BREAK || result === RETURN) return result;
  } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
    result = call(iterator, f, step.value, entries);
    if (result === BREAK || result === RETURN) return result;
  }
};
exports.BREAK = BREAK;
exports.RETURN = RETURN;


/***/ }),
/* 188 */
/***/ (function(module, exports) {

// fast apply, http://jsperf.lnkit.com/fast-apply/5
module.exports = function (fn, args, that) {
  var un = that === undefined;
  switch (args.length) {
    case 0: return un ? fn()
                      : fn.call(that);
    case 1: return un ? fn(args[0])
                      : fn.call(that, args[0]);
    case 2: return un ? fn(args[0], args[1])
                      : fn.call(that, args[0], args[1]);
    case 3: return un ? fn(args[0], args[1], args[2])
                      : fn.call(that, args[0], args[1], args[2]);
    case 4: return un ? fn(args[0], args[1], args[2], args[3])
                      : fn.call(that, args[0], args[1], args[2], args[3]);
  } return fn.apply(that, args);
};


/***/ }),
/* 189 */
/***/ (function(module, exports, __webpack_require__) {

var global = __webpack_require__(14);
var macrotask = __webpack_require__(92).set;
var Observer = global.MutationObserver || global.WebKitMutationObserver;
var process = global.process;
var Promise = global.Promise;
var isNode = __webpack_require__(48)(process) == 'process';

module.exports = function () {
  var head, last, notify;

  var flush = function () {
    var parent, fn;
    if (isNode && (parent = process.domain)) parent.exit();
    while (head) {
      fn = head.fn;
      head = head.next;
      try {
        fn();
      } catch (e) {
        if (head) notify();
        else last = undefined;
        throw e;
      }
    } last = undefined;
    if (parent) parent.enter();
  };

  // Node.js
  if (isNode) {
    notify = function () {
      process.nextTick(flush);
    };
  // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339
  } else if (Observer && !(global.navigator && global.navigator.standalone)) {
    var toggle = true;
    var node = document.createTextNode('');
    new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new
    notify = function () {
      node.data = toggle = !toggle;
    };
  // environments with maybe non-completely correct, but existent Promise
  } else if (Promise && Promise.resolve) {
    var promise = Promise.resolve();
    notify = function () {
      promise.then(flush);
    };
  // for other environments - macrotask based on:
  // - setImmediate
  // - MessageChannel
  // - window.postMessag
  // - onreadystatechange
  // - setTimeout
  } else {
    notify = function () {
      // strange IE + webpack dev server bug - use .call(global)
      macrotask.call(global, flush);
    };
  }

  return function (fn) {
    var task = { fn: fn, next: undefined };
    if (last) last.next = task;
    if (!head) {
      head = task;
      notify();
    } last = task;
  };
};


/***/ }),
/* 190 */
/***/ (function(module, exports, __webpack_require__) {

var hide = __webpack_require__(26);
module.exports = function (target, src, safe) {
  for (var key in src) {
    if (safe && target[key]) target[key] = src[key];
    else hide(target, key, src[key]);
  } return target;
};


/***/ }),
/* 191 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var global = __webpack_require__(14);
var core = __webpack_require__(10);
var dP = __webpack_require__(21);
var DESCRIPTORS = __webpack_require__(25);
var SPECIES = __webpack_require__(11)('species');

module.exports = function (KEY) {
  var C = typeof core[KEY] == 'function' ? core[KEY] : global[KEY];
  if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {
    configurable: true,
    get: function () { return this; }
  });
};


/***/ }),
/* 192 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
// https://github.com/tc39/proposal-promise-finally

var $export = __webpack_require__(13);
var core = __webpack_require__(10);
var global = __webpack_require__(14);
var speciesConstructor = __webpack_require__(120);
var promiseResolve = __webpack_require__(122);

$export($export.P + $export.R, 'Promise', { 'finally': function (onFinally) {
  var C = speciesConstructor(this, core.Promise || global.Promise);
  var isFunction = typeof onFinally == 'function';
  return this.then(
    isFunction ? function (x) {
      return promiseResolve(C, onFinally()).then(function () { return x; });
    } : onFinally,
    isFunction ? function (e) {
      return promiseResolve(C, onFinally()).then(function () { throw e; });
    } : onFinally
  );
} });


/***/ }),
/* 193 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// https://github.com/tc39/proposal-promise-try
var $export = __webpack_require__(13);
var newPromiseCapability = __webpack_require__(93);
var perform = __webpack_require__(121);

$export($export.S, 'Promise', { 'try': function (callbackfn) {
  var promiseCapability = newPromiseCapability.f(this);
  var result = perform(callbackfn);
  (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v);
  return promiseCapability.promise;
} });


/***/ }),
/* 194 */
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(195);
module.exports = __webpack_require__(10).Object.getPrototypeOf;


/***/ }),
/* 195 */
/***/ (function(module, exports, __webpack_require__) {

// 19.1.2.9 Object.getPrototypeOf(O)
var toObject = __webpack_require__(49);
var $getPrototypeOf = __webpack_require__(115);

__webpack_require__(94)('getPrototypeOf', function () {
  return function getPrototypeOf(it) {
    return $getPrototypeOf(toObject(it));
  };
});


/***/ }),
/* 196 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__globals__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__utils_context_performance_hook__ = __webpack_require__(128);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__base_renderer__ = __webpack_require__(130);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_canvas_render_target__ = __webpack_require__(72);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__managers_canvas_filter_manager__ = __webpack_require__(95);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */







var RendererType = __WEBPACK_IMPORTED_MODULE_4__globals__["c" /* Constants */].RendererType;

/**
 * The renderer that is used for Canvas2D rendering
 * @class
 * @extends PhotoEditorSDK.Engine.BaseRenderer
 * @memberof PhotoEditorSDK.Engine
 */

var CanvasRenderer = function (_BaseRenderer) {
  _inherits(CanvasRenderer, _BaseRenderer);

  /**
   * Creates a CanvasRenderer
   * @override
   */
  function CanvasRenderer() {
    var _ref;

    _classCallCheck(this, CanvasRenderer);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = CanvasRenderer.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(CanvasRenderer)).call.apply(_ref, [this].concat(args)));

    _this._type = RendererType.CANVAS;

    _this.setCanvas(_this._options.canvas || _this._createCanvas());
    return _this;
  }

  /**
   * Creates a canvas element
   * @return {Canvas}
   * @private
   */


  _createClass(CanvasRenderer, [{
    key: '_createCanvas',
    value: function _createCanvas() {
      return __WEBPACK_IMPORTED_MODULE_4__globals__["i" /* Utils */].createCanvas();
    }

    /**
     * Gets the rendering context for this renderer
     * @returns {Object}
     * @private
     */

  }, {
    key: '_createContext',
    value: function _createContext() {
      var canvas = this._canvas;
      var ctx = canvas.getContext('2d');

      if (this._options.debug) {
        ctx = new __WEBPACK_IMPORTED_MODULE_5__utils_context_performance_hook__["a" /* default */](ctx);
      }

      this.id = ctx.id = CanvasRenderer.contextId++;
      this._context = ctx;
      ctx.renderer = this;

      this.emit('context', ctx);

      return ctx;
    }

    /**
     * Sets up the rendering context for this renderer
     * @private
     */

  }, {
    key: '_setupContext',
    value: function _setupContext() {
      var ctx = this._context;

      // Enable image smoothing if available
      if (!('imageSmoothingEnabled' in ctx)) {
        ['moz', 'webkit', 'ms'].forEach(function (prop) {
          if (ctx[prop]) {
            ctx[prop] = true;
          }
        });
      } else {
        ctx.imageSmoothingEnabled = true;
      }

      this._defaultRenderTarget = new __WEBPACK_IMPORTED_MODULE_7__utils_canvas_render_target__["a" /* default */](this._width, this._height, this._pixelRatio, this._canvas, this._context);
      this.setRenderTarget(this._defaultRenderTarget);

      this._filterManager = new __WEBPACK_IMPORTED_MODULE_8__managers_canvas_filter_manager__["a" /* default */](this);
    }

    /**
     * Renders the given DisplayObject
     * @param  {PhotoEditorSDK.Engine.DisplayObject} displayObject
     */

  }, {
    key: 'render',
    value: function render(displayObject) {
      var ctx = this._renderTarget.getContext();

      // Since the given displayObject is the "root" object
      // right now, we need to give it a dummy / fake object
      // as parent with the default world transform and alpha
      var originalParent = displayObject.getParent();
      displayObject.setParent(this._fakeObject);

      // Update transforms and render this object
      displayObject.updateTransform();

      // Reset parent
      displayObject.setParent(originalParent);

      // Reset transform
      ctx.setTransform(1, 0, 0, 1, 0, 0);

      // Reset alpha
      ctx.globalAlpha = 1;

      // Clear the view
      var _canvas = this._canvas,
          width = _canvas.width,
          height = _canvas.height;

      ctx.clearRect(0, 0, width, height);
      if (this._clearColor.a !== 0) {
        ctx.save();
        ctx.fillStyle = this._clearColor.toRGBA();
        ctx.fillRect(0, 0, width, height);
        ctx.restore();
      }

      this.renderDisplayObject(displayObject, this._renderTarget);
    }

    /**
     * Renders the given DisplayObject
     * @param  {PhotoEditorSDK.Engine.DisplayObject} displayObject
     * @param  {PhotoEditorSDK.Engine.RenderTarget} renderTarget
     */

  }, {
    key: 'renderDisplayObject',
    value: function renderDisplayObject(displayObject, renderTarget) {
      var originalRenderTarget = this._renderTarget;
      this._filterManager.setFilterStack(renderTarget.getFilterStack());
      this.setRenderTarget(renderTarget);
      displayObject.renderCanvas(this);
      this.setRenderTarget(originalRenderTarget);
    }

    /**
     * Returns the current render target
     * @return {PhotoEditorSDK.Engine.RenderTarget}
     */

  }, {
    key: 'getCurrentRenderTarget',
    value: function getCurrentRenderTarget() {
      return this._renderTarget;
    }

    /**
     * Sets the render target
     * @param {PhotoEditorSDK.Engine.RenderTarget} renderTarget
     */

  }, {
    key: 'setRenderTarget',
    value: function setRenderTarget(renderTarget) {
      this._renderTarget = renderTarget;
    }

    /**
     * Returns the current rendering context
     * @return {RenderingContext}
     */

  }, {
    key: 'getContext',
    value: function getContext() {
      return this._renderTarget.getContext();
    }

    /**
     * Disposes this Renderer
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      this._filterManager.dispose();
    }
  }]);

  return CanvasRenderer;
}(__WEBPACK_IMPORTED_MODULE_6__base_renderer__["a" /* default */]);

CanvasRenderer.contextId = 0;
CanvasRenderer.type = 'Canvas2D';

/* harmony default export */ __webpack_exports__["a"] = (CanvasRenderer);

/***/ }),
/* 197 */
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(45);
__webpack_require__(198);
module.exports = __webpack_require__(10).Array.from;


/***/ }),
/* 198 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var ctx = __webpack_require__(36);
var $export = __webpack_require__(13);
var toObject = __webpack_require__(49);
var call = __webpack_require__(118);
var isArrayIter = __webpack_require__(119);
var toLength = __webpack_require__(82);
var createProperty = __webpack_require__(199);
var getIterFn = __webpack_require__(91);

$export($export.S + $export.F * !__webpack_require__(123)(function (iter) { Array.from(iter); }), 'Array', {
  // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
  from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
    var O = toObject(arrayLike);
    var C = typeof this == 'function' ? this : Array;
    var aLen = arguments.length;
    var mapfn = aLen > 1 ? arguments[1] : undefined;
    var mapping = mapfn !== undefined;
    var index = 0;
    var iterFn = getIterFn(O);
    var length, result, step, iterator;
    if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);
    // if object isn't iterable or it's array with default iterator - use simple case
    if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) {
      for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {
        createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);
      }
    } else {
      length = toLength(O.length);
      for (result = new C(length); length > index; index++) {
        createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
      }
    }
    result.length = index;
    return result;
  }
});


/***/ }),
/* 199 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var $defineProperty = __webpack_require__(21);
var createDesc = __webpack_require__(46);

module.exports = function (object, index, value) {
  if (index in object) $defineProperty.f(object, index, createDesc(0, value));
  else object[index] = value;
};


/***/ }),
/* 200 */
/***/ (function(module, exports, __webpack_require__) {

module.exports = { "default": __webpack_require__(201), __esModule: true };

/***/ }),
/* 201 */
/***/ (function(module, exports, __webpack_require__) {

var core = __webpack_require__(10);
var $JSON = core.JSON || (core.JSON = { stringify: JSON.stringify });
module.exports = function stringify(it) { // eslint-disable-line no-unused-vars
  return $JSON.stringify.apply($JSON, arguments);
};


/***/ }),
/* 202 */
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(203);
module.exports = __webpack_require__(10).Object.assign;


/***/ }),
/* 203 */
/***/ (function(module, exports, __webpack_require__) {

// 19.1.3.1 Object.assign(target, source)
var $export = __webpack_require__(13);

$export($export.S + $export.F, 'Object', { assign: __webpack_require__(204) });


/***/ }),
/* 204 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

// 19.1.2.1 Object.assign(target, source, ...)
var getKeys = __webpack_require__(47);
var gOPS = __webpack_require__(88);
var pIE = __webpack_require__(67);
var toObject = __webpack_require__(49);
var IObject = __webpack_require__(113);
var $assign = Object.assign;

// should work with symbols and should have deterministic property order (V8 bug)
module.exports = !$assign || __webpack_require__(37)(function () {
  var A = {};
  var B = {};
  // eslint-disable-next-line no-undef
  var S = Symbol();
  var K = 'abcdefghijklmnopqrst';
  A[S] = 7;
  K.split('').forEach(function (k) { B[k] = k; });
  return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
}) ? function assign(target, source) { // eslint-disable-line no-unused-vars
  var T = toObject(target);
  var aLen = arguments.length;
  var index = 1;
  var getSymbols = gOPS.f;
  var isEnum = pIE.f;
  while (aLen > index) {
    var S = IObject(arguments[index++]);
    var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
    var length = keys.length;
    var j = 0;
    var key;
    while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];
  } return T;
} : $assign;


/***/ }),
/* 205 */
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(206);
module.exports = __webpack_require__(10).Object.keys;


/***/ }),
/* 206 */
/***/ (function(module, exports, __webpack_require__) {

// 19.1.2.14 Object.keys(O)
var toObject = __webpack_require__(49);
var $keys = __webpack_require__(47);

__webpack_require__(94)('keys', function () {
  return function keys(it) {
    return $keys(toObject(it));
  };
});


/***/ }),
/* 207 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */

var ArrayUtils = function () {
  function ArrayUtils() {
    _classCallCheck(this, ArrayUtils);
  }

  _createClass(ArrayUtils, null, [{
    key: "head",

    /**
     * Returns the first element in an array
     * @param {Array<A>} arr
     * @returns {A}
     */
    value: function head(arr) {
      return arr[0];
    }

    /**
     * Returns a shallow copy of the array excluding the first element
     * @param {Array<A>} arr
     * @returns {Array<A>}
     */

  }, {
    key: "tail",
    value: function tail(arr) {
      return arr.slice(1);
    }

    /**
     * Returns the last element of an array
     * @param {Array<A>} arr
     * @returns {A}
     */

  }, {
    key: "last",
    value: function last(arr) {
      return arr[arr.length - 1];
    }

    /**
     * Returns a shallow copy of the array excluding the last element
     * @param {Array<A>} arr
     * @returns {Array<A>}
     */

  }, {
    key: "init",
    value: function init(arr) {
      return arr.slice(0, arr.length - 1);
    }

    /**
     * Returns a shallow copy of the array with the elements tha pass
     * the test function removed.
     * @param {Array<A>} arr
     * @param {Function} func - A test function
     */

  }, {
    key: "remove",
    value: function remove(arr, func) {
      return arr.filter(function (v, i, arr) {
        return !func(v, i, arr);
      });
    }

    /**
     * Finds the index first element of the Array to which the supplied function returns
     * a true value. If the element is not found it returns -1.
     *
     * @param {Array} array
     * @param {Function} func
     * @returns {number}
     */

  }, {
    key: "findIndex",
    value: function findIndex(array, func) {
      for (var i = 0; i < array.length; i++) {
        if (func(array[i])) {
          return i;
        }
      }

      return -1;
    }

    /**
     * Finds the first element of the Array to which the supplied function returns
     * a true value and returns it. Otherwise it returns undefined.
     *
     * @param {Array} array
     * @param {Function} func
     * @returns {any}
     */

  }, {
    key: "find",
    value: function find(array, func) {
      for (var i = 0; i < array.length; i++) {
        if (func(array[i])) {
          return array[i];
        }
      }

      return undefined;
    }

    /**
     * Flattens the given multidimensional array
     *
     * @return {Array}
     */

  }, {
    key: "flatten",
    value: function flatten(array) {
      return array.reduce(function (flat, toFlatten) {
        return flat.concat(Array.isArray(toFlatten) ? ArrayUtils.flatten(toFlatten) : toFlatten);
      }, []);
    }

    /**
     * Returns and array containing the numbers going from `start` (inclusive) to
     * `end` (exclusive)
     *
     * @param {number} start
     * @param {number} end
     * @returns Array
     */

  }, {
    key: "range",
    value: function range(start, end) {
      var arr = [];

      if (end > start) {
        for (var i = start; i < end; i++) {
          arr.push(i);
        }
      }

      return arr;
    }

    /**
     * Returns an array consisting of the value `val` repeated `n` times.
     *
     * @param {any} val
     * @param {number} n
     * @returns {Array}
     */

  }, {
    key: "repeat",
    value: function repeat(val, n) {
      var arr = [];

      for (var i = 0; i < n; i++) {
        arr[i] = val;
      }

      return arr;
    }

    /**
     * Returns an array which is an array of arrays of equally positioned items in both arrays,
     * e.g, zip([1, 2, 3], [4, 5, 6]) = [[1, 4], [2, 5], [3, 6]]
     *
     * @param {Array} a
     * @param {Array} b
     * @returns {Array}
     */

  }, {
    key: "zip",
    value: function zip(a, b) {
      var len = Math.min(a.length, b.length);
      var arr = [];

      for (var i = 0; i < len; i++) {
        arr[i] = [a[i], b[i]];
      }

      return arr;
    }
  }]);

  return ArrayUtils;
}();

/* harmony default export */ __webpack_exports__["a"] = (ArrayUtils);

/***/ }),
/* 208 */
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(66);
__webpack_require__(45);
module.exports = __webpack_require__(209);


/***/ }),
/* 209 */
/***/ (function(module, exports, __webpack_require__) {

var classof = __webpack_require__(90);
var ITERATOR = __webpack_require__(11)('iterator');
var Iterators = __webpack_require__(38);
module.exports = __webpack_require__(10).isIterable = function (it) {
  var O = Object(it);
  return O[ITERATOR] !== undefined
    || '@@iterator' in O
    // eslint-disable-next-line no-prototype-builtins
    || Iterators.hasOwnProperty(classof(O));
};


/***/ }),
/* 210 */
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(66);
__webpack_require__(45);
module.exports = __webpack_require__(211);


/***/ }),
/* 211 */
/***/ (function(module, exports, __webpack_require__) {

var anObject = __webpack_require__(18);
var get = __webpack_require__(91);
module.exports = __webpack_require__(10).getIterator = function (it) {
  var iterFn = get(it);
  if (typeof iterFn != 'function') throw TypeError(it + ' is not iterable!');
  return anObject(iterFn.call(it));
};


/***/ }),
/* 212 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */

/**
 * A couple of utility functions
 * @type {Object}
 */
var Utils = {
  /**
   * Assigns own enumerable properties of source object(s) to the destination
   * object for all destination properties that resolve to undefined. Once a
   * property is set, additional values of the same property are ignored.
   * @param  {Object} object
   * @param  {Object} ...sources
   * @return {Object}
   */
  defaults: function defaults(object) {
    for (var _len = arguments.length, sources = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
      sources[_key - 1] = arguments[_key];
    }

    // Shallow clone
    var newObject = {};
    for (var key in object) {
      newObject[key] = object[key];
    }

    // Clone sources
    for (var i = 0; i < sources.length; i++) {
      var source = sources[i];
      for (var _key2 in source) {
        if (typeof newObject[_key2] === 'undefined') {
          newObject[_key2] = source[_key2];
        }
      }
    }

    return newObject;
  },

  /**
   * Assigns own enumerable properties of source object(s) to the destination
   * object. Subsequent sources overwrite property assignments of previous
   * sources.
   * @param {Object} object
   * @param {Object} ...sources
   * @return {Object}
   */
  extend: function extend(object) {
    for (var _len2 = arguments.length, sources = Array(_len2 > 1 ? _len2 - 1 : 0), _key3 = 1; _key3 < _len2; _key3++) {
      sources[_key3 - 1] = arguments[_key3];
    }

    // Shallow clone
    var newObject = {};
    for (var key in object) {
      newObject[key] = object[key];
    }

    // Extend sources
    for (var i = 0; i < sources.length; i++) {
      var source = sources[i];
      for (var _key4 in source) {
        newObject[_key4] = source[_key4];
      }
    }

    return newObject;
  }
};

/* harmony default export */ __webpack_exports__["a"] = (Utils);

/***/ }),
/* 213 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__globals__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__base_renderer__ = __webpack_require__(130);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_webgl_render_target__ = __webpack_require__(73);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__object_renderers_object_renderer__ = __webpack_require__(131);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__object_renderers_sprite_renderer__ = __webpack_require__(216);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__shaders_texture_shader__ = __webpack_require__(96);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__display_display_object__ = __webpack_require__(98);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__managers_webgl_filter_manager__ = __webpack_require__(99);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__utils_context_performance_hook__ = __webpack_require__(128);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__utils_pixel_array_image__ = __webpack_require__(132);






var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* global WEBPACK */
/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */












var RendererType = __WEBPACK_IMPORTED_MODULE_5__globals__["c" /* Constants */].RendererType;

// For server-side environments

/**
 * The renderer that is used for WebGL rendering
 * @class
 * @extends PhotoEditorSDK.Engine.BaseRenderer
 * @memberof PhotoEditorSDK.Engine
 */
/* istanbul ignore next */

var WebGLRenderer = function (_BaseRenderer) {
  _inherits(WebGLRenderer, _BaseRenderer);

  /**
   * Creates a WebGLRenderer
   * @override
   */
  function WebGLRenderer() {
    var _ref;

    _classCallCheck(this, WebGLRenderer);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = WebGLRenderer.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(WebGLRenderer)).call.apply(_ref, [this].concat(args)));

    _this._type = RendererType.WEBGL;

    _this._textures = [];
    _this._fakeObject = new __WEBPACK_IMPORTED_MODULE_11__display_display_object__["a" /* default */]();
    _this._onContextLost = _this._onContextLost.bind(_this);
    _this._onContextRestored = _this._onContextRestored.bind(_this);

    _this.setCanvas(_this._options.canvas || __WEBPACK_IMPORTED_MODULE_5__globals__["i" /* Utils */].createCanvas());

    _this.shaders = _this._initShaders();
    _this.renderers = _this._initRenderers();
    return _this;
  }

  // -------------------------------------------------------------------------- CONTEXT LOSS

  /**
   * Gets called when the WebGL context has been lost
   * @param  {Event} e
   * @private
   */


  _createClass(WebGLRenderer, [{
    key: '_onContextLost',
    value: function _onContextLost(e) {
      e.preventDefault();
      __WEBPACK_IMPORTED_MODULE_5__globals__["f" /* Log */].warn(this.constructor.name, 'WebGL context has been lost - trying to restore.');
    }

    /**
     * Gets called when the WebGL context could not be created
     * @param  {Object} e
     * @private
     */

  }, {
    key: '_onContextCreationError',
    value: function _onContextCreationError(e) {
      e.preventDefault();
      __WEBPACK_IMPORTED_MODULE_5__globals__["f" /* Log */].warn(this.constructor.name, 'Failed to create WebGL context: ' + (e.statusMessage || 'Unknown error'));
    }

    /**
     * Gets called when the WebGL context has been restored. Cleans up and resets everything.
     * @private
     */

  }, {
    key: '_onContextRestored',
    value: function _onContextRestored() {
      var _this2 = this;

      __WEBPACK_IMPORTED_MODULE_5__globals__["f" /* Log */].warn(this.constructor.name, 'WebGL context has been restored. Clearing all textures.');

      this._textures.forEach(function (texture) {
        texture.disposeGLTexturesForRenderer(_this2);
      });

      this._createContext();
      this._setupContext();
      this.emit('context-restored');
    }

    /**
     * Gets called before the context has been set up
     * @private
     */

  }, {
    key: '_onBeforeContext',
    value: function _onBeforeContext() {
      if (this._filterManager) {
        this._filterManager.dispose();
      }
      this._filterManager = new __WEBPACK_IMPORTED_MODULE_12__managers_webgl_filter_manager__["a" /* default */](this);
      this._currentObjectRenderer = new __WEBPACK_IMPORTED_MODULE_8__object_renderers_object_renderer__["a" /* default */](this);
    }

    /**
     * Sets the given shader to active
     * @param {PhotoEditorSDK.Engine.Shader} shader
     */

  }, {
    key: 'setShader',
    value: function setShader(shader) {
      this._currentShader = shader;
      this._context.useProgram(shader.getProgram());
      this._setAttributesForShader(shader);
    }

    /**
     * Sets the canvas to the given one
     * @param {HTMLCanvasElement} canvas
     */

  }, {
    key: 'setCanvas',
    value: function setCanvas(canvas) {
      if (this._canvas) {
        this._removeContextEventListeners();
      }

      _get(WebGLRenderer.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(WebGLRenderer.prototype), 'setCanvas', this).call(this, canvas);

      if (this._canvas.addEventListener) {
        // node-canvas doesn't have events
        this._addContextEventListeners();
      }
    }

    /**
     * Adds the context lost / restored / creation error event handlers
     * @private
     */

  }, {
    key: '_addContextEventListeners',
    value: function _addContextEventListeners() {
      this._canvas.addEventListener('webglcontextlost', this._onContextLost);
      this._canvas.addEventListener('webglcontextrestored', this._onContextRestored);
      this._canvas.addEventListener('webglcontextcreationerror', this._onContextCreationError);
    }

    /**
     * Removes the context lost / restored / creation error event handlers
     * @private
     */

  }, {
    key: '_removeContextEventListeners',
    value: function _removeContextEventListeners() {
      this._canvas.removeEventListener('webglcontextlost', this._onContextLost);
      this._canvas.removeEventListener('webglcontextrestored', this._onContextRestored);
      this._canvas.removeEventListener('webglcontextcreationerror', this._onContextCreationError);
    }

    /**
     * Uploads the given shader's attributes to the GPU
     * @param {PhotoEditorSDK.Engine.Shader} shader
     */

  }, {
    key: '_setAttributesForShader',
    value: function _setAttributesForShader(shader) {
      var gl = this._context;
      var attributes = shader.getAttributes();
      var attributeLocations = shader.getAttributeLocations();

      attributes.forEach(function (attributeName) {
        var attributeLocation = attributeLocations[attributeName];
        gl.enableVertexAttribArray(attributeLocation);
      });
    }

    /**
     * Initializes the default shaders
     * @return {Object}
     * @private
     */

  }, {
    key: '_initShaders',
    value: function _initShaders() {
      return {
        default: new __WEBPACK_IMPORTED_MODULE_10__shaders_texture_shader__["a" /* default */](this)
      };
    }

    /**
     * Initializes the available object renderers
     * @return {Object}
     * @private
     */

  }, {
    key: '_initRenderers',
    value: function _initRenderers() {
      return {
        sprite: new __WEBPACK_IMPORTED_MODULE_9__object_renderers_sprite_renderer__["a" /* default */](this)
      };
    }

    /**
     * Gets the rendering context for this renderer
     * @returns {Object}
     * @private
     */

  }, {
    key: '_createContext',
    value: function _createContext() {
      var canvas = this._canvas;
      var gl = null;

      var contextOptions = {
        preserveDrawingBuffer: true
      };

      if (true) {
        gl = canvas.getContext('webgl', contextOptions) || canvas.getContext('experimental-webgl', contextOptions);
      }

      // Hook up WebGLDebugUtils if present
      if (typeof window !== 'undefined' && window.WebGLDebugUtils && this._options.debug) {
        var logGL = function logGL(functionName, args) {
          console.error('gl.' + functionName + '(' + window.WebGLDebugUtils.glFunctionArgsToString(functionName, args) + ')');
        };
        gl = window.WebGLDebugUtils.makeDebugContext(gl, null, logGL);
      }

      // Hook up ContextPerformanceHook if debug is enabled
      if (this._options.debug) {
        gl = new __WEBPACK_IMPORTED_MODULE_13__utils_context_performance_hook__["a" /* default */](gl);
      }

      this.id = gl.id = WebGLRenderer.contextId++;
      this._context = gl;
      gl.renderer = this;

      this._maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);

      this.emit('context', gl);

      return gl;
    }

    /**
     * Sets up the rendering context for this renderer
     * @private
     */

  }, {
    key: '_setupContext',
    value: function _setupContext() {
      var gl = this._context;

      gl.disable(gl.DEPTH_TEST);
      gl.disable(gl.CULL_FACE);
      gl.enable(gl.BLEND);
      gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);

      this._defaultRenderTarget = new __WEBPACK_IMPORTED_MODULE_7__utils_webgl_render_target__["a" /* default */](this, this._width, this._height, this._pixelRatio, true);
      this.setRenderTarget(this._defaultRenderTarget);
      this._getMaxPrecision();
    }

    /**
     * Finds the maximum int / float precision for this device
     * @private
     */

  }, {
    key: '_getMaxPrecision',
    value: function _getMaxPrecision() {
      var gl = this._context;
      var highFloat = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);
      this._maxFloatPrecision = highFloat.precision !== 0 ? 'highp' : 'mediump';

      var highInt = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_INT);
      this._maxIntPrecision = highInt.rangeMax !== 0 ? 'highp' : 'lowp';
    }

    /**
     * Resizes the context and view to the given size
     * @param  {PhotoEditorSDK.Math.Vector2} dimensions
     * @param  {Boolean} resizeCanvas = true
     */

  }, {
    key: 'resizeTo',
    value: function resizeTo(dimensions) {
      var resizeCanvas = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;

      _get(WebGLRenderer.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(WebGLRenderer.prototype), 'resizeTo', this).call(this, dimensions, resizeCanvas);

      if (this._currentRenderTarget) {
        this._currentRenderTarget.resizeTo(dimensions);
      }
    }

    /**
     * Sets the current render target to the passed one and activates
     * it for rendering
     * @param {PhotoEditorSDK.Engine.RenderTarget} renderTarget
     */

  }, {
    key: 'setRenderTarget',
    value: function setRenderTarget() {
      var renderTarget = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._defaultRenderTarget;

      this._currentRenderTarget = renderTarget;
      this._currentRenderTarget.activate();
    }

    /**
     * Sets the current object renderer to the given one
     * @param {PhotoEditorSDK.Engine.ObjectRenderer} objectRenderer
     */

  }, {
    key: 'setObjectRenderer',
    value: function setObjectRenderer(objectRenderer) {
      this._currentObjectRenderer.stop();
      this._currentObjectRenderer = objectRenderer;
      this._currentObjectRenderer.start();
    }

    /**
     * Renders the given DisplayObject
     * @param  {PhotoEditorSDK.Engine.DisplayObject} displayObject
     */

  }, {
    key: 'render',
    value: function render(displayObject) {
      this.setRenderTarget(this._defaultRenderTarget);
      this._defaultRenderTarget.clear(this._clearColor);

      // Since the given displayObject is the "root" object
      // right now, we need to give it a dummy / fake object
      // as parent with the default world transform and alpha
      var originalParent = displayObject.getParent();
      displayObject.setParent(this._fakeObject);

      // Update transforms and render this object
      displayObject.updateTransform();

      // Reset parent
      displayObject.setParent(originalParent);

      this.renderDisplayObject(displayObject, this._defaultRenderTarget);
    }

    /**
     * Renders the given DisplayObject
     * @param  {PhotoEditorSDK.Engine.DisplayObject} displayObject
     * @param  {PhotoEditorSDK.Engine.RenderTarget} renderTarget
     */

  }, {
    key: 'renderDisplayObject',
    value: function renderDisplayObject(displayObject, renderTarget) {
      this.setRenderTarget(renderTarget);
      this._filterManager.setFilterStack(renderTarget.getFilterStack());
      displayObject.renderWebGL(this);
      this._currentObjectRenderer.flush();
    }

    /**
     * Clears the context
     */

  }, {
    key: 'clear',
    value: function clear() {
      var gl = this._context;

      gl.clearColor.apply(gl, this._clearColor.toGLColor());
      gl.clear(gl.COLOR_BUFFER_BIT);
    }

    /**
     * Saves the renderer state and returns the state object
     * @return {Object}
     */

  }, {
    key: 'save',
    value: function save() {
      return {
        renderTarget: this._currentRenderTarget,
        objectRenderer: this._currentObjectRenderer,
        filterStack: this._filterManager.getFilterStack()
      };
    }

    /**
     * Restores the given renderer state
     * @param  {Object} save
     */

  }, {
    key: 'restore',
    value: function restore(save) {
      this.setRenderTarget(save.renderTarget);
      this._filterManager.setFilterStack(save.filterStack);
      this._currentObjectRenderer = save.objectRenderer;
    }

    /**
     * Returns and/or creates a WebGLTexture for the given BaseTexture object
     * @param  {PhotoEditorSDK.Engine.BaseTexture} texture
     * @return {PhotoEditorSDK.Engine.WebGLTexture}
     */

  }, {
    key: 'getOrCreateGLTexture',
    value: function getOrCreateGLTexture(texture) {
      var gl = this._context;

      var glTexture = texture.getGLTextureForRenderer(this);
      if (!glTexture) {
        glTexture = gl.createTexture();
        texture.setGLTextureForRenderer(glTexture, this);

        // Hold reference to texture for easier disposal
        this._textures.push(texture);
      }

      return glTexture;
    }

    /**
     * Updates the given texture
     * @param  {PhotoEditorSDK.Engine.BaseTexture} texture
     * @param  {Boolean} [upload = true]
     */

  }, {
    key: 'updateTexture',
    value: function updateTexture(texture) {
      var upload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;

      var source = texture.getSource();
      var hasSource = !!source;

      var gl = this._context;
      var glUnit = texture.getGLUnit();
      var glTexture = this.getOrCreateGLTexture(texture);

      gl.activeTexture(gl.TEXTURE0 + glUnit);
      gl.bindTexture(gl.TEXTURE_2D, glTexture);

      gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);

      if (upload && hasSource) {
        if (source instanceof __WEBPACK_IMPORTED_MODULE_14__utils_pixel_array_image__["a" /* default */]) {
          gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, source.width, source.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, source.data);
        } else {
          gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, source);
        }
      }

      if (texture.isMipMappingEnabled()) {
        gl.generateMipmap(gl.TEXTURE_2D);
      } else {
        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, texture.getGLRepeat(gl, 'x'));
        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, texture.getGLRepeat(gl, 'y'));
      }
      gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, texture.getGLFilter(gl, 'min'));
      gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, texture.getGLFilter(gl, 'mag'));
      gl.activeTexture(gl.TEXTURE0);
    }

    /**
     * Returns the maximum dimensions
     * @return {Number}
     */

  }, {
    key: 'getMaxDimensions',
    value: function getMaxDimensions() {
      // node-gl support
      var canvas = __WEBPACK_IMPORTED_MODULE_5__globals__["i" /* Utils */].createCanvas();
      var gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
      if (!gl) {
        return null;
      } else {
        var maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);
        var loseContextExtension = gl.getExtension('WEBGL_lose_context');
        if (loseContextExtension) {
          loseContextExtension.loseContext();
        }
        return maxTextureSize;
      }
    }

    /**
     * Returns the current render target
     * @return {PhotoEditorSDK.Engine.RenderTarget}
     */

  }, {
    key: 'getCurrentRenderTarget',
    value: function getCurrentRenderTarget() {
      return this._currentRenderTarget;
    }

    /**
     * Returns the current object renderer
     * @return {PhotoEditorSDK.Engine.ObjectRenderer}
     */

  }, {
    key: 'getCurrentObjectRenderer',
    value: function getCurrentObjectRenderer() {
      return this._currentObjectRenderer;
    }

    /**
     * Checks if this renderer is supported on the current device and browser
     * @return {Boolean}
     */

  }, {
    key: 'getMaxFloatPrecision',


    /**
     * Returns the maximum float precision for this device (lowp/mediump/highp)
     * @return {String}
     */
    value: function getMaxFloatPrecision() {
      return this._maxFloatPrecision;
    }

    /**
     * Returns the maximum int precision for this device (lowp/mediump/highp)
     * @return {String}
     */

  }, {
    key: 'getMaxIntPrecision',
    value: function getMaxIntPrecision() {
      return this._maxIntPrecision;
    }

    /**
     * Disposes this Renderer
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      var _this3 = this;

      this._filterManager.dispose();
      this._currentObjectRenderer.dispose();
      this._defaultRenderTarget.dispose();
      this._textures.forEach(function (texture) {
        texture.disposeGLTexturesForRenderer(_this3);
      });
      for (var shader in this.shaders) {
        this.shaders[shader].dispose();
        delete this.shaders[shader];
      }

      this._removeContextEventListeners();

      var gl = this._context;
      var loseContextExtension = gl.getExtension('WEBGL_lose_context');
      if (loseContextExtension) {
        loseContextExtension.loseContext();
      }
    }
  }], [{
    key: 'isSupported',
    value: function isSupported() {
      var canvas = __WEBPACK_IMPORTED_MODULE_5__globals__["i" /* Utils */].createCanvas();
      canvas.addEventListener('webglcontextcreationerror', this.prototype._onContextCreationError);
      var gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
      canvas.removeEventListener('webglcontextcreationerror', this.prototype._onContextCreationError);
      return !!gl;
    }
  }]);

  return WebGLRenderer;
}(__WEBPACK_IMPORTED_MODULE_6__base_renderer__["a" /* default */]);

WebGLRenderer.contextId = 0;
WebGLRenderer.type = 'WebGL';

/* harmony default export */ __webpack_exports__["a"] = (WebGLRenderer);

/***/ }),
/* 214 */
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(215);
var $Object = __webpack_require__(10).Object;
module.exports = function getOwnPropertyDescriptor(it, key) {
  return $Object.getOwnPropertyDescriptor(it, key);
};


/***/ }),
/* 215 */
/***/ (function(module, exports, __webpack_require__) {

// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
var toIObject = __webpack_require__(28);
var $getOwnPropertyDescriptor = __webpack_require__(89).f;

__webpack_require__(94)('getOwnPropertyDescriptor', function () {
  return function getOwnPropertyDescriptor(it, key) {
    return $getOwnPropertyDescriptor(toIObject(it), key);
  };
});


/***/ }),
/* 216 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__globals__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__object_renderer__ = __webpack_require__(131);






var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* eslint constructor-super: 0 */
/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * The ObjectRenderer that is responsible for rendering Sprite instances
 * @class
 * @extends PhotoEditorSDK.Engine.ObjectRenderer
 * @memberof PhotoEditorSDK.Engine
 */
/* istanbul ignore next */

var SpriteRenderer = function (_ObjectRenderer) {
  _inherits(SpriteRenderer, _ObjectRenderer);

  /**
   * Creates a SpriteRenderer
   * @override
   */
  function SpriteRenderer() {
    var _ref;

    _classCallCheck(this, SpriteRenderer);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = SpriteRenderer.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(SpriteRenderer)).call.apply(_ref, [this].concat(args)));

    _this._maxBatchSize = __WEBPACK_IMPORTED_MODULE_5__globals__["a" /* BATCH_SIZE */];
    _this._vertices = new ArrayBuffer(__WEBPACK_IMPORTED_MODULE_5__globals__["a" /* BATCH_SIZE */] * 4 * __WEBPACK_IMPORTED_MODULE_5__globals__["j" /* VERTEX_BYTE_SIZE */]);
    _this._positions = new Float32Array(_this._vertices);
    _this._colors = new Uint32Array(_this._vertices);
    _this._indices = new Uint16Array(__WEBPACK_IMPORTED_MODULE_5__globals__["a" /* BATCH_SIZE */] * 6);

    // Fill vertex position indices
    for (var i = 0, j = 0; i < __WEBPACK_IMPORTED_MODULE_5__globals__["a" /* BATCH_SIZE */] * 6; i += 6, j += 4) {
      _this._indices[i + 0] = j + 0;
      _this._indices[i + 1] = j + 1;
      _this._indices[i + 2] = j + 2;
      _this._indices[i + 3] = j + 0;
      _this._indices[i + 4] = j + 2;
      _this._indices[i + 5] = j + 3;
    }

    _this._shaders = [];
    _this._sprites = [];

    _this._currentBatchSize = 0;
    _this._currentBaseTexture = null;

    _this._onContextChange();
    return _this;
  }

  /**
   * Adds the given sprite to the batch
   * @param  {PhotoEditorSDK.Engine.Sprite} sprite
   */


  _createClass(SpriteRenderer, [{
    key: 'render',
    value: function render(sprite) {
      var texture = sprite.getTexture();
      var textureFrame = texture.getFrame();
      var baseTexture = texture.getBaseTexture();

      // Has the maximum batch size been reached? Flush!
      if (this._currentBatchSize >= this._maxBatchSize) {
        this.flush();
        this._currentBaseTexture = baseTexture;
      }

      // No updated UVs => No rendering
      var uvs = texture.getUVs();
      if (!uvs) {
        return;
      }

      // Fill positions array
      var index = this._currentBatchSize * __WEBPACK_IMPORTED_MODULE_5__globals__["j" /* VERTEX_BYTE_SIZE */];
      this._addVertexCoordinates(sprite, index, textureFrame);
      this._addTextureUVs(sprite, index, uvs);
      this._addColors(sprite, index);

      // Add the sprite to the list of sprites
      this._sprites[this._currentBatchSize] = sprite;
      this._currentBatchSize++;
    }

    /**
     * Adds the color to the positions array for the given sprite
     * @param {PhotoEditorSDK.Engine.Sprite} sprite
     * @param {Number} index
     * @private
     */

  }, {
    key: '_addColors',
    value: function _addColors(sprite, index) {
      var colors = this._colors;
      var tint = sprite.getTint();
      var color = (tint >> 16) + (tint & 0xff00) + ((tint & 0xff) << 16) + (sprite.getWorldAlpha() * 255 << 24);
      colors[index + 4] = colors[index + 9] = colors[index + 14] = colors[index + 19] = color;
    }

    /**
     * Adds the texture UV coordinates to the positions array for the given sprite
     * @param {PhotoEditorSDK.Engine.Sprite} sprite
     * @param {Number} index
     * @param {PhotoEditorSDK.Engine.TextureUVs} uvs
     * @private
     */

  }, {
    key: '_addTextureUVs',
    value: function _addTextureUVs(sprite, index, uvs) {
      var positions = this._positions;

      // Add UVs
      var uvCoords = uvs.getUVsAt(0);
      positions[index + 2] = uvCoords.x;
      positions[index + 3] = uvCoords.y;

      uvCoords = uvs.getUVsAt(1);
      positions[index + 7] = uvCoords.x;
      positions[index + 8] = uvCoords.y;

      uvCoords = uvs.getUVsAt(2);
      positions[index + 12] = uvCoords.x;
      positions[index + 13] = uvCoords.y;

      uvCoords = uvs.getUVsAt(3);
      positions[index + 17] = uvCoords.x;
      positions[index + 18] = uvCoords.y;
    }

    /**
     * Adds the vertex coordinates to the positions array for the given
     * sprite and texture frame
     * @param {PhotoEditorSDK.Engine.Sprite} sprite
     * @param {Number} index
     * @param {PhotoEditorSDK.Math.Rectangle} textureFrame
     * @private
     */

  }, {
    key: '_addVertexCoordinates',
    value: function _addVertexCoordinates(sprite, index, textureFrame) {
      var positions = this._positions;
      var worldTransform = sprite.getWorldTransform();

      // Transform sprite coords with anchor in mind
      var anchor = sprite.getAnchor();
      var rectPositions = worldTransform.rectangleToCoordinates(textureFrame, anchor);

      var stride = 5;
      for (var i = 0; i < 4; i++) {
        positions[index + i * stride] = rectPositions[i].x;
        positions[index + i * stride + 1] = rectPositions[i].y;
      }
    }

    /**
     * Gets called when the rendering context changes
     * @private
     */

  }, {
    key: '_onContextChange',
    value: function _onContextChange() {
      var gl = this._renderer.getContext();

      this._shader = this._renderer.shaders.default;

      this._vertexBuffer = gl.createBuffer();
      this._indexBuffer = gl.createBuffer();

      gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer);
      gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._indices, gl.STATIC_DRAW);

      gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer);
      gl.bufferData(gl.ARRAY_BUFFER, this._vertices, gl.DYNAMIC_DRAW);
    }

    /**
     * Gets called when this object renderer is activated
     */

  }, {
    key: 'start',
    value: function start() {
      this._shader.setupBuffers(this._vertexBuffer, this._indexBuffer);
    }

    /**
     * Renders the queued sprites in batches, every time the base texture has changed,
     * it flushes the current batch to the graphics card
     */

  }, {
    key: 'flush',
    value: function flush() {
      var renderer = this._renderer;
      var gl = renderer.getContext();

      if (this._currentBatchSize === 0) {
        return;
      }

      if (this._currentBatchSize > __WEBPACK_IMPORTED_MODULE_5__globals__["a" /* BATCH_SIZE */] * 0.5) {
        // Upload whole ArrayBuffer
        gl.bufferSubData(gl.ARRAY_BUFFER, 0, this._vertices);
      } else {
        // Only upload sub array
        var subArray = this._positions.subarray(0, this._currentBatchSize * __WEBPACK_IMPORTED_MODULE_5__globals__["j" /* VERTEX_BYTE_SIZE */]);
        gl.bufferSubData(gl.ARRAY_BUFFER, 0, subArray);
      }

      // Init variables
      var currentBatchSize = 0;
      var currentBaseTexture = null;
      var nextBaseTexture = null;
      var currentShader = null;
      var nextShader = null;
      var shaderChanged = false;
      var textureChanged = false;
      var sprite = null;
      var batchStartIndex = 0;

      for (var i = 0, j = this._currentBatchSize; i < j; i++) {
        sprite = this._sprites[i];

        nextBaseTexture = sprite.getTexture().getBaseTexture();
        nextShader = sprite.getShader() || this._shader;
        shaderChanged = currentShader !== nextShader;
        textureChanged = currentBaseTexture !== nextBaseTexture;

        if (textureChanged || shaderChanged) {
          this._renderBatch(currentBaseTexture, currentBatchSize, batchStartIndex);

          batchStartIndex = i;
          currentBatchSize = 0;
          currentBaseTexture = nextBaseTexture;

          // Shader has changed, set it
          if (shaderChanged) {
            currentShader = nextShader;
            renderer.setShader(currentShader);

            var renderTarget = renderer.getCurrentRenderTarget();
            var projectionMatrix = renderTarget.getProjectionMatrix().toArray();
            currentShader.setUniform('u_projMatrix', projectionMatrix);
            currentShader.syncUniforms();

            gl.activeTexture(gl.TEXTURE0);
          }
        }

        currentBatchSize++;
      }

      this._renderBatch(currentBaseTexture, currentBatchSize, batchStartIndex);

      // Reset the batch
      this._currentBatchSize = 0;
      this._sprites = [];
    }

    /**
     * Renders the current batch
     * @param  {PhotoEditorSDK.Engine.BaseTexture} baseTexture
     * @param  {Number} batchSize
     * @param  {Number} batchStartIndex
     * @private
     */

  }, {
    key: '_renderBatch',
    value: function _renderBatch(baseTexture, batchSize, batchStartIndex) {
      if (batchSize === 0) {
        return;
      }

      var renderer = this._renderer;
      var gl = renderer.getContext();

      var glTexture = baseTexture.getGLTextureForRenderer(renderer);
      if (!glTexture) {
        glTexture = renderer.getOrCreateGLTexture(baseTexture);
      }

      if (baseTexture.isDirty()) {
        renderer.updateTexture(baseTexture);
        baseTexture.setDirty(false);
      }

      gl.activeTexture(gl.TEXTURE0 + baseTexture.getGLUnit());
      gl.bindTexture(gl.TEXTURE_2D, glTexture);

      var verticesCount = batchSize * 6;
      var vertexOffset = batchStartIndex * 6 * 2;
      gl.drawElements(gl.TRIANGLES, verticesCount, gl.UNSIGNED_SHORT, vertexOffset);
    }

    /**
     * Disposes this ObjectRenderer
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      var renderer = this._renderer;
      var gl = renderer.getContext();

      gl.deleteBuffer(this._vertexBuffer);
      gl.deleteBuffer(this._indexBuffer);

      this._vertices = null;
      this._positions = null;
      this._colors = null;
      this._indices = null;

      _get(SpriteRenderer.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(SpriteRenderer.prototype), 'dispose', this).call(this);
    }
  }]);

  return SpriteRenderer;
}(__WEBPACK_IMPORTED_MODULE_6__object_renderer__["a" /* default */]);

/* harmony default export */ __webpack_exports__["a"] = (SpriteRenderer);

/***/ }),
/* 217 */
/***/ (function(module, exports) {

module.exports = "attribute vec2 a_position;\nattribute vec2 a_texCoord;\nattribute vec4 a_color;\nvarying vec2 v_texCoord;\nvarying vec4 v_color;\nuniform mat3 u_projMatrix;\n\nvoid main() {\n  gl_Position = vec4((u_projMatrix * vec3(a_position, 1)).xy, 0, 1);\n  v_texCoord = a_texCoord;\n  v_color = vec4(a_color.rgb * a_color.a, a_color.a);\n}\n"

/***/ }),
/* 218 */
/***/ (function(module, exports) {

module.exports = "uniform sampler2D u_image;\nvarying vec2 v_texCoord;\nvarying vec4 v_color;\n\nvoid main() {\n  gl_FragColor = texture2D(u_image, v_texCoord) * v_color;\n}\n"

/***/ }),
/* 219 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */

/**
 * Represents a rectangle that is rendered using WebGL
 * @class
 * @memberof PhotoEditorSDK.Engine
 * @ignore
 */
/* istanbul ignore next */
var Quad = function () {
  function Quad(renderer) {
    _classCallCheck(this, Quad);

    this._renderer = renderer;
    this._context = this._renderer.getContext();

    this._vertices = new Float32Array([0, 0, 100, 0, 100, 100, 0, 100]);

    this._uvs = new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]);

    this._indices = new Uint16Array([0, 1, 2, 0, 3, 2]);

    this._colors = new Float32Array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]);

    this._initBuffers();
    this._uploadBuffers();
  }

  /**
   * Maps the given rectangles to the quad
   * @param  {Rectangle} rect1
   * @param  {Rectangle} rect2
   */


  _createClass(Quad, [{
    key: "map",
    value: function map(rect1, rect2) {
      var x = rect2.x,
          y = rect2.y;

      // Update the UVs
      // We don't have any translation, so these four
      // values are all we need

      this._uvs[2] = rect2.width / rect1.width;
      this._uvs[4] = this._uvs[2];
      this._uvs[5] = rect2.height / rect1.height;
      this._uvs[7] = this._uvs[5];

      // Update the vertices
      this._vertices[0] = x;
      this._vertices[1] = y;

      this._vertices[2] = x + rect2.width;
      this._vertices[3] = y;

      this._vertices[4] = this._vertices[2];
      this._vertices[5] = y + rect2.height;

      this._vertices[6] = x;
      this._vertices[7] = this._vertices[5];

      this._uploadBuffers();
    }

    /**
     * Initializes the buffers
     * @private
     */

  }, {
    key: "_initBuffers",
    value: function _initBuffers() {
      var gl = this._context;

      // Init vertex buffer
      this._vertexBuffer = gl.createBuffer();
      gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer);
      gl.bufferData(gl.ARRAY_BUFFER, (8 + 8 + 16) * 4, gl.DYNAMIC_DRAW);

      this._indexBuffer = gl.createBuffer();
      gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer);
      gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this._indices, gl.STATIC_DRAW);
    }

    /**
     * Uploads the buffers
     * @private
     */

  }, {
    key: "_uploadBuffers",
    value: function _uploadBuffers() {
      var gl = this._context;

      gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer);
      gl.bufferSubData(gl.ARRAY_BUFFER, 0, this._vertices);
      gl.bufferSubData(gl.ARRAY_BUFFER, 8 * 4, this._uvs);
      gl.bufferSubData(gl.ARRAY_BUFFER, (8 + 8) * 4, this._colors);
    }
  }, {
    key: "getVertexBuffer",
    value: function getVertexBuffer() {
      return this._vertexBuffer;
    }
  }, {
    key: "getIndexBuffer",
    value: function getIndexBuffer() {
      return this._indexBuffer;
    }

    /**
     * Cleans up this Quad's buffers
     */

  }, {
    key: "dispose",
    value: function dispose() {
      var gl = this._context;
      gl.deleteBuffer(this._vertexBuffer);
      gl.deleteBuffer(this._indexBuffer);
    }
  }]);

  return Quad;
}();

/* harmony default export */ __webpack_exports__["a"] = (Quad);

/***/ }),
/* 220 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__globals__ = __webpack_require__(9);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



/**
 * Represents the UV coordinates of a texture
 * @class
 * @memberof PhotoEditorSDK.Engine
 */

var TextureUVs = function () {
  /**
   * Creates a TextureUVs instance
   */
  function TextureUVs() {
    _classCallCheck(this, TextureUVs);

    this._uvs = [new __WEBPACK_IMPORTED_MODULE_1__globals__["k" /* Vector2 */](0, 0), new __WEBPACK_IMPORTED_MODULE_1__globals__["k" /* Vector2 */](1, 0), new __WEBPACK_IMPORTED_MODULE_1__globals__["k" /* Vector2 */](1, 1), new __WEBPACK_IMPORTED_MODULE_1__globals__["k" /* Vector2 */](0, 1)];
  }

  /**
   * Updates the UVs based on the given baseframe
   * @param  {Rectangle} frame
   * @param  {Rectangle} baseFrame
   */


  _createClass(TextureUVs, [{
    key: 'update',
    value: function update(frame, baseFrame) {
      // Upper left
      var uv = this._uvs[0];
      uv.x = frame.x / baseFrame.width;
      uv.y = frame.y / baseFrame.height;

      // Upper right
      uv = this._uvs[1];
      uv.x = (frame.x + frame.width) / baseFrame.width;
      uv.y = frame.y / baseFrame.height;

      // Lower right
      uv = this._uvs[2];
      uv.x = (frame.x + frame.width) / baseFrame.width;
      uv.y = (frame.y + frame.height) / baseFrame.height;

      // Lower left
      uv = this._uvs[3];
      uv.x = frame.x / baseFrame.width;
      uv.y = (frame.y + frame.height) / baseFrame.height;
    }

    /**
     * Returns the UV coordinates for the given index
     * @param  {Number} index
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'getUVsAt',
    value: function getUVsAt(index) {
      return this._uvs[index];
    }

    /**
     * Returns the UV coordinates
     * @return {Array.<PhotoEditorSDK.Math.Vector2>}
     */

  }, {
    key: 'getUVs',
    value: function getUVs() {
      return this._uvs;
    }
  }]);

  return TextureUVs;
}();

/* harmony default export */ __webpack_exports__["a"] = (TextureUVs);

/***/ }),
/* 221 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__globals__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__texture__ = __webpack_require__(134);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__base_texture__ = __webpack_require__(53);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_webgl_render_target__ = __webpack_require__(73);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils_canvas_render_target__ = __webpack_require__(72);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__managers_webgl_filter_manager__ = __webpack_require__(99);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__managers_canvas_filter_manager__ = __webpack_require__(95);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */









var RendererType = __WEBPACK_IMPORTED_MODULE_4__globals__["c" /* Constants */].RendererType;

/**
 * A texture that you can render to
 * @class
 * @extends PhotoEditorSDK.Engine.Texture
 * @memberof PhotoEditorSDK.Engine
 */

var RenderTexture = function (_Texture) {
  _inherits(RenderTexture, _Texture);

  /**
   * Creates a RenderTexture
   * @param  {PhotoEditorSDK.Engine.BaseRenderer} renderer
   * @param  {Number} [width = 100]
   * @param  {Number} [height = 100]
   * @param  {Number} [pixelRatio = 1]
   */
  function RenderTexture(renderer) {
    var width = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;
    var height = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
    var pixelRatio = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;

    _classCallCheck(this, RenderTexture);

    // RenderTexture is always loaded!
    var _this = _possibleConstructorReturn(this, (RenderTexture.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(RenderTexture)).call(this, new __WEBPACK_IMPORTED_MODULE_6__base_texture__["a" /* default */](), new __WEBPACK_IMPORTED_MODULE_4__globals__["h" /* Rectangle */](0, 0, width, height)));

    _this._loaded = true;
    _this._width = width;
    _this._height = height;
    _this._pixelRatio = pixelRatio;
    _this._renderer = renderer;

    _this._setupFilterManager();
    _this._setupBuffer();

    _this.setBaseTexture(_this._renderTarget.getBaseTexture());

    _this._updateUVs();
    return _this;
  }

  /**
   * Sets up the filter manager
   * @private
   */


  _createClass(RenderTexture, [{
    key: '_setupFilterManager',
    value: function _setupFilterManager() {
      /* istanbul ignore if */
      if (this._renderer.isOfType(RendererType.WEBGL)) {
        this._filterManager = new __WEBPACK_IMPORTED_MODULE_9__managers_webgl_filter_manager__["a" /* default */](this._renderer);
      } else if (this._renderer.isOfType(RendererType.CANVAS)) {
        this._filterManager = new __WEBPACK_IMPORTED_MODULE_10__managers_canvas_filter_manager__["a" /* default */](this._renderer);
      }

      this._filterManager.resizeTo(new __WEBPACK_IMPORTED_MODULE_4__globals__["k" /* Vector2 */](this._width, this._height));
    }

    /**
     * Sets up the buffer that we're rendering to
     * @private
     */

  }, {
    key: '_setupBuffer',
    value: function _setupBuffer() {
      /* istanbul ignore if */
      if (this._renderer.isOfType(RendererType.WEBGL)) {
        this._setupWebGLRenderTarget();
      } else if (this._renderer.isOfType(RendererType.CANVAS)) {
        this._setupCanvasRenderTarget();
      }
    }

    /**
     * Sets up the WebGLRenderTarget for this RenderTexture
     * @private
     */
    /* istanbul ignore next */

  }, {
    key: '_setupWebGLRenderTarget',
    value: function _setupWebGLRenderTarget() {
      this._renderTarget = new __WEBPACK_IMPORTED_MODULE_7__utils_webgl_render_target__["a" /* default */](this._renderer, this._width, this._height, this._pixelRatio);
    }

    /**
     * Sets up the CanvasRenderTarget for this RenderTexture
     * @private
     */

  }, {
    key: '_setupCanvasRenderTarget',
    value: function _setupCanvasRenderTarget() {
      this._renderTarget = new __WEBPACK_IMPORTED_MODULE_8__utils_canvas_render_target__["a" /* default */](this._width, this._height, this._pixelRatio);
    }

    /**
     * Clears this texture's render buffer
     * @param {PhotoEditorSDK.Color} color
     */

  }, {
    key: 'clear',
    value: function clear(color) {
      this._renderTarget.clear(color);
    }

    /**
     * Resizes this RenderTexture to the given dimensions
     * @param  {PhotoEditorSDK.Math.Vector2} dimensions
     */

  }, {
    key: 'resizeTo',
    value: function resizeTo(dimensions) {
      if (this._width === dimensions.x && this._height === dimensions.y) {
        return;
      }

      this._width = dimensions.x;
      this._height = dimensions.y;
      this._frame.width = dimensions.x;
      this._frame.height = dimensions.y;

      this._renderTarget.resizeTo(dimensions);
      this._filterManager.resizeTo(dimensions);
    }

    /**
     * Renders the given DisplayObject
     * @param  {PhotoEditorSDK.Engine.DisplayObject} displayObject
     */

  }, {
    key: 'render',
    value: function render(displayObject) {
      /* istanbul ignore if */
      if (this._renderer.isOfType(RendererType.WEBGL)) {
        this._renderWebGL(displayObject);
      } else if (this._renderer.isOfType(RendererType.CANVAS)) {
        this._renderCanvas(displayObject);
      } else {
        throw new Error('RenderTexture does not support rendering via ' + this._renderer.constructor.name);
      }
    }

    /**
     * Renders the given DisplayObject using WebGL
     * @param  {PhotoEditorSDK.Engine.DisplayObject} displayObject
     * @private
     */
    /* istanbul ignore next */

  }, {
    key: '_renderWebGL',
    value: function _renderWebGL(displayObject) {
      this._renderTarget.activate();

      displayObject.getWorldTransform().reset();
      displayObject.getChildren().forEach(function (child) {
        child.updateTransform();
      });

      var tempFilterManager = this._renderer.getFilterManager();
      this._renderer.setFilterManager(this._filterManager);
      this._renderer.renderDisplayObject(displayObject, this._renderTarget);
      // this._renderTarget.updateMipMap()
      this._renderer.setFilterManager(tempFilterManager);
    }

    /**
     * Renders the given DisplayObject using Canvas2D
     * @param  {PhotoEditorSDK.Engine.DisplayObject} displayObject
     * @private
     */

  }, {
    key: '_renderCanvas',
    value: function _renderCanvas(displayObject) {
      displayObject.getWorldTransform().reset();
      displayObject.getChildren().forEach(function (child) {
        child.updateTransform();
      });

      var tempFilterManager = this._renderer.getFilterManager();
      this._renderer.setFilterManager(this._filterManager);
      this._renderer.renderDisplayObject(displayObject, this._renderTarget);
      this._renderer.setFilterManager(tempFilterManager);
    }

    /**
     * Returns the render target
     * @return {PhotoEditorSDK.Engine.WebGLRenderTarget}
     */

  }, {
    key: 'getRenderTarget',
    value: function getRenderTarget() {
      return this._renderTarget;
    }

    /**
     * Disposes this RenderTexture
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      this._renderTarget.dispose();
      this._filterManager.dispose();
    }
  }]);

  return RenderTexture;
}(__WEBPACK_IMPORTED_MODULE_5__texture__["a" /* default */]);

/* harmony default export */ __webpack_exports__["a"] = (RenderTexture);

/***/ }),
/* 222 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__globals__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__display_container__ = __webpack_require__(133);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__lib_pot_renderer__ = __webpack_require__(223);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */





/**
 * A drawable rectangle with a texture
 * @class
 * @extends PhotoEditorSDK.Engine.Container
 * @memberof PhotoEditorSDK.Engine
 */

var Sprite = function (_Container) {
  _inherits(Sprite, _Container);

  /**
   * Creates a Sprite
   * @param  {PhotoEditorSDK.Engine.Texture} texture
   */
  function Sprite(texture) {
    _classCallCheck(this, Sprite);

    var _this = _possibleConstructorReturn(this, (Sprite.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(Sprite)).call(this));

    _this._onTextureUpdate = _this._onTextureUpdate.bind(_this);

    _this._texture = texture;
    _this._shader = null;

    // Cached dimensions
    _this._width = 0;
    _this._height = 0;

    _this._anchor = new __WEBPACK_IMPORTED_MODULE_4__globals__["k" /* Vector2 */](0, 0);

    _this.setTexture(texture);
    return _this;
  }

  // -------------------------------------------------------------------------- EVENTS

  /**
   * Gets called when this sprite's texture has been updated
   * @private
   */


  _createClass(Sprite, [{
    key: '_onTextureUpdate',
    value: function _onTextureUpdate() {
      this._boundsNeedUpdate = true;
      this._localBoundsNeedUpdate = true;
    }

    // -------------------------------------------------------------------------- RENDERING

    /**
     * Renders the contents of this container
     * @param {WebGLRenderer} renderer
     * @private
     */
    /* istanbul ignore next */

  }, {
    key: '_renderWebGL',
    value: function _renderWebGL(renderer) {
      var save = renderer.save();
      if (this._smoothDownscaling) {
        if (!this._potRenderer) {
          this._potRenderer = new __WEBPACK_IMPORTED_MODULE_6__lib_pot_renderer__["a" /* default */]();
        }

        this._potRenderer.render(renderer, this, this._texture);
      }
      renderer.restore(save);

      renderer.setObjectRenderer(renderer.renderers.sprite);
      renderer.renderers.sprite.render(this);
    }

    /**
     * Renders the contents of this container
     * @param  {CanvasRenderer} renderer
     * @private
     */

  }, {
    key: '_renderCanvas',
    value: function _renderCanvas(renderer) {
      // @TODO Move this to SpriteRenderer
      var transform = this._worldTransform;
      var textureFrame = this._texture.getFrame();

      var width = textureFrame.width,
          height = textureFrame.height;

      var pixelRatio = renderer.getCurrentRenderTarget().getPixelRatio();

      // Apply transform
      var dx = this._anchor.x * -width | 0;
      var dy = this._anchor.y * -height | 0;
      var ctx = renderer.getContext();
      ctx.setTransform(transform.a, transform.b, transform.c, transform.d, transform.tx * pixelRatio, transform.ty * pixelRatio);

      ctx.globalAlpha = this.getWorldAlpha();

      var baseTexture = this._texture.getBaseTexture();
      var texturePixelRatio = baseTexture.getPixelRatio();
      var source = baseTexture.getSource();
      ctx.drawImage(this._texture.getBaseTexture().getSource(),

      // Source x, y, width, height
      0, 0, (source.naturalWidth || width) * texturePixelRatio, (source.naturalHeight || height) * texturePixelRatio,

      // Destination x, y, width, height
      dx * pixelRatio, dy * pixelRatio, width * pixelRatio, height * pixelRatio);
    }

    // -------------------------------------------------------------------------- PUBLIC API

    /**
     * Checks if this sprite is located at the given position
     * @param  {PhotoEditorSDK.Math.Vector2}  position
     * @return {Boolean}
     */

  }, {
    key: 'isAtPosition',
    value: function isAtPosition(position) {
      var localPosition = this._worldTransform.applyInverseToVector(position);
      var textureFrame = this._texture.getFrame();
      var width = textureFrame.width,
          height = textureFrame.height;


      var upperLeft = new __WEBPACK_IMPORTED_MODULE_4__globals__["k" /* Vector2 */](-width, -height);
      upperLeft.multiply(this._anchor);
      var lowerRight = upperLeft.clone().add(width, height);

      if (localPosition.x < upperLeft.x || localPosition.x > lowerRight.x || localPosition.y < upperLeft.y || localPosition.y > lowerRight.y) {
        return false;
      }

      return true;
    }

    /**
     * Returns the non-global bounds of this DisplayObject
     * @return {PhotoEditorSDK.Math.Rectangle}
     */

  }, {
    key: 'getLocalBounds',
    value: function getLocalBounds() {
      if (this._localBoundsNeedUpdate) {
        var bounds = this._localBounds;
        var textureFrame = this._texture.getFrame();

        bounds.x = -textureFrame.width * this._anchor.x;
        bounds.y = -textureFrame.height * this._anchor.y;
        bounds.width = textureFrame.width;
        bounds.height = textureFrame.height;

        this._localBoundsNeedUpdate = false;
      }
      return this._localBounds.clone();
    }

    /**
     * Returns the bounds for this DisplayObject
     * @return {PhotoEditorSDK.Math.Rectangle}
     */

  }, {
    key: 'getBounds',
    value: function getBounds() {
      if (this._boundsNeedUpdate) {
        var bounds = this._bounds;
        var textureFrame = this._texture.getFrame();

        // @TODO Optimize this (if necessary). We could skip matrix application
        //       when there's no rotation
        var worldTransform = this._worldTransform;
        var anchor = this._anchor;
        var positions = worldTransform.rectangleToCoordinates(textureFrame, anchor);

        var minX = positions[0].x;
        var minY = positions[0].y;
        var maxX = minX;
        var maxY = minY;

        positions.forEach(function (_ref) {
          var x = _ref.x,
              y = _ref.y;

          minX = Math.min(minX, x);
          minY = Math.min(minY, y);
          maxX = Math.max(maxX, x);
          maxY = Math.max(maxY, y);
        });

        bounds.x = minX;
        bounds.width = Math.abs(maxX - minX);
        bounds.y = minY;
        bounds.height = Math.abs(maxY - minY);

        this._boundsNeedUpdate = false;
      }
      return this._bounds.clone();
    }

    // -------------------------------------------------------------------------- GETTERS / SETTERS

    /**
     * Returns the current texture
     * @return {PhotoEditorSDK.Engine.Texture} [description]
     */

  }, {
    key: 'getTexture',
    value: function getTexture() {
      return this._texture;
    }
  }, {
    key: 'clearTexture',
    value: function clearTexture() {
      if (!this._texture) {
        return;
      }

      this._texture.off('update', this._onTextureUpdate);
      this._texture.dispose();
      this._texture = null;

      if (this._potRenderer) {
        this._potRenderer.dispose();
        this._potRenderer = null;
      }
    }

    /**
     * Sets the texture
     * @param {PhotoEditorSDK.Engine.Texture} texture
     */

  }, {
    key: 'setTexture',
    value: function setTexture(texture) {
      if (!texture) {
        return;
      }

      if (this._texture) {
        this._texture.off('update', this._onTextureUpdate);
      }

      if (this._potRenderer) {
        this._potRenderer.getRenderTexture().getBaseTexture().setDirty(true);
      }

      this._texture = texture;
      if (texture.getBaseTexture().isLoaded()) {
        this._onTextureUpdate();
      }
      texture.on('update', this._onTextureUpdate);
    }

    /**
     * Returns the shader
     * @return {PhotoEditorSDK.Engine.Shader}
     */

  }, {
    key: 'getShader',
    value: function getShader() {
      return this._shader;
    }

    /**
     * Sets the shader
     * @param {PhotoEditorSDK.Engine.Shader} shader
     */

  }, {
    key: 'setShader',
    value: function setShader(shader) {
      this._shader = shader;
    }

    /**
     * Returns the width
     * @return {Number}
     */

  }, {
    key: 'getWidth',
    value: function getWidth() {
      return this._width;
    }

    /**
     * Sets the width
     * @param {Number} width
     */

  }, {
    key: 'setWidth',
    value: function setWidth(width) {
      this._scale.x = width / this._texture.getFrame().width;
      this._width = width;
      this._boundsNeedUpdate = true;
      this._localBoundsNeedUpdate = true;
    }

    /**
     * Returns the height
     * @return {Number}
     */

  }, {
    key: 'getHeight',
    value: function getHeight() {
      return this._height;
    }

    /**
     * Sets the height
     * @param {Number} height
     */

  }, {
    key: 'setHeight',
    value: function setHeight(height) {
      this._scale.y = height / this._texture.getFrame().height;
      this._height = height;
      this._boundsNeedUpdate = true;
      this._localBoundsNeedUpdate = true;
    }

    /**
     * Returns the current width and height of this sprite
     * @return {PhotoEditor.Math.Vector2}
     */

  }, {
    key: 'getDimensions',
    value: function getDimensions() {
      return new __WEBPACK_IMPORTED_MODULE_4__globals__["k" /* Vector2 */](this._width, this._height);
    }

    /**
     * Returns the anchor
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'getAnchor',
    value: function getAnchor() {
      return this._anchor;
    }

    /**
     * Sets the anchor
     * @param {PhotoEditorSDK.Math.Vector2} anchor
     */

  }, {
    key: 'setAnchor',
    value: function setAnchor(anchor, y) {
      if (anchor instanceof __WEBPACK_IMPORTED_MODULE_4__globals__["k" /* Vector2 */]) {
        this._anchor.copy(anchor);
      } else {
        this._anchor.set(anchor, y);
      }
      this._boundsNeedUpdate = true;
      this._localBoundsNeedUpdate = true;
    }

    /**
     * Returns whether smooth downscaling is enabled
     * @return {Boolean}
     */

  }, {
    key: 'isSmoothDownscaling',
    value: function isSmoothDownscaling() {
      return this._smoothDownscaling;
    }

    /**
     * Sets the smooth downscaling flag
     * @param {Boolean} smoothDownscaling
     */

  }, {
    key: 'setSmoothDownscaling',
    value: function setSmoothDownscaling(smoothDownscaling) {
      this._smoothDownscaling = smoothDownscaling;
    }

    /**
     * Disposes this Sprite
     * @param {Boolean} texture = false - Should the texture be disposed?
     * @param {Boolean} baseTexture = false - Should the base texture be disposed?
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      var texture = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
      var baseTexture = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

      if (this._texture) {
        this._texture.off('update', this._onTextureUpdate);
      }
      (texture || baseTexture) && this._texture.dispose(baseTexture);
      if (this._potRenderer) {
        this._potRenderer.dispose();
      }
    }
  }]);

  return Sprite;
}(__WEBPACK_IMPORTED_MODULE_5__display_container__["a" /* default */]);

/* harmony default export */ __webpack_exports__["a"] = (Sprite);

/***/ }),
/* 223 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__globals__ = __webpack_require__(40);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



/* istanbul ignore next */

var POTRenderer = function () {
  function POTRenderer() {
    _classCallCheck(this, POTRenderer);

    this._container = new __WEBPACK_IMPORTED_MODULE_1__globals__["Engine"].Container();
    this._sprite = new __WEBPACK_IMPORTED_MODULE_1__globals__["Engine"].Sprite();
    this._container.addChild(this._sprite);
  }

  /**
   * Renders the given input texture to a POT texture
   * @param  {PhotoEditorSDK.Engine.BaseRenderer} renderer
   * @param  {PhotoEditorSDK.Engine.Sprite} inputSprite
   * @param  {PhotoEditorSDK.Engine.Texture} inputTexture
   */


  _createClass(POTRenderer, [{
    key: 'render',
    value: function render(renderer, inputSprite, inputTexture) {
      var textureDimensions = inputTexture.getDimensions();
      var nextPOT = this._getNextHighestPOT(textureDimensions);

      if (!this._renderTexture) {
        this._renderTexture = new __WEBPACK_IMPORTED_MODULE_1__globals__["Engine"].RenderTexture(renderer, nextPOT.x, nextPOT.y);
      } else {
        this._renderTexture.resizeTo(nextPOT);
      }

      var newDimensions = this._renderTexture.getDimensions();
      this._sprite.setTexture(inputTexture);
      this._sprite.updateTransform();
      this._renderTexture.clear();
      this._renderTexture.render(this._container);

      this._updateSprite(renderer, inputSprite, textureDimensions, newDimensions);
    }

    /**
     * Sets the input sprite's texture and makes sure only the relevant part of the
     * render texture is rendered
     * @param  {PhotoEditorSDK.Engine.Sprite} inputSprite
     * @param  {PhotoEditorSDK.Math.Vector2} initialDimensions
     * @param  {PhotoEditorSDK.Math.Vector2} newDimensions
     * @private
     */

  }, {
    key: '_updateSprite',
    value: function _updateSprite(renderer, inputSprite, initialDimensions, newDimensions) {
      inputSprite.setTexture(this._renderTexture);

      this._renderTexture.setFrame(new __WEBPACK_IMPORTED_MODULE_1__globals__["Rectangle"](0, 0, initialDimensions.x, initialDimensions.y));
    }

    /**
     * Returns the next highest POT dimensions for the given dimensions
     * @param  {PhotoEditorSDK.Math.Vector2} dimensions
     * @private
     */

  }, {
    key: '_getNextHighestPOT',
    value: function _getNextHighestPOT(dimensions) {
      return new __WEBPACK_IMPORTED_MODULE_1__globals__["Vector2"](__WEBPACK_IMPORTED_MODULE_1__globals__["Utils"].nextHighestPOT(dimensions.x), __WEBPACK_IMPORTED_MODULE_1__globals__["Utils"].nextHighestPOT(dimensions.y));
    }

    /**
     * Returns the render texture
     * @return {PhotoEditorSDK.Engine.RenderTexture}
     */

  }, {
    key: 'getRenderTexture',
    value: function getRenderTexture() {
      return this._renderTexture;
    }

    /**
     * Disposes this POT renderers
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      if (!this._renderTexture) {
        return;
      }

      this._renderTexture.dispose();
      this._renderTexture = null;
    }
  }]);

  return POTRenderer;
}();

/* harmony default export */ __webpack_exports__["a"] = (POTRenderer);

/***/ }),
/* 224 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__texture_shader__ = __webpack_require__(96);
/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



/* harmony default export */ __webpack_exports__["a"] = ({
  TextureShader: __WEBPACK_IMPORTED_MODULE_0__texture_shader__["a" /* default */]
});

/***/ }),
/* 225 */
/***/ (function(module, exports, __webpack_require__) {

module.exports = { "default": __webpack_require__(226), __esModule: true };

/***/ }),
/* 226 */
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(227);
module.exports = __webpack_require__(10).setImmediate;


/***/ }),
/* 227 */
/***/ (function(module, exports, __webpack_require__) {

var $export = __webpack_require__(13);
var $task = __webpack_require__(92);
$export($export.G + $export.B, {
  setImmediate: $task.set,
  clearImmediate: $task.clear
});


/***/ }),
/* 228 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__unpremultiply_filter__ = __webpack_require__(229);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "UnpremultiplyFilter", function() { return __WEBPACK_IMPORTED_MODULE_0__unpremultiply_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__color_overlay_filter__ = __webpack_require__(231);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "ColorOverlayFilter", function() { return __WEBPACK_IMPORTED_MODULE_1__color_overlay_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__tint_filter__ = __webpack_require__(233);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "TintFilter", function() { return __WEBPACK_IMPORTED_MODULE_2__tint_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__overlay_filter__ = __webpack_require__(235);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "OverlayFilter", function() { return __WEBPACK_IMPORTED_MODULE_3__overlay_filter__["a"]; });
/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */

/**
 * @namespace PhotoEditorSDK.Engine.Filters
 */





/***/ }),
/* 229 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(54);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



/* istanbul ignore next */

var UnpremultiplyFilter = function (_Filter) {
  _inherits(UnpremultiplyFilter, _Filter);

  function UnpremultiplyFilter() {
    _classCallCheck(this, UnpremultiplyFilter);

    var _this = _possibleConstructorReturn(this, (UnpremultiplyFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(UnpremultiplyFilter)).call(this));

    _this._fragmentSource = __webpack_require__(230);
    return _this;
  }

  return UnpremultiplyFilter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/* harmony default export */ __webpack_exports__["a"] = (UnpremultiplyFilter);

/***/ }),
/* 230 */
/***/ (function(module, exports) {

module.exports = "uniform sampler2D u_image;\nvarying vec2 v_texCoord;\nvarying vec4 v_color;\n\nvoid main() {\n  vec4 color = texture2D(u_image, v_texCoord);\n  gl_FragColor = vec4(color.a > 0. ? color.rgb / color.a : vec3(0), color.a);\n}\n"

/***/ }),
/* 231 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__globals__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__filter__ = __webpack_require__(54);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var OptionType = __WEBPACK_IMPORTED_MODULE_4__globals__["c" /* Constants */].OptionType,
    UniformType = __WEBPACK_IMPORTED_MODULE_4__globals__["c" /* Constants */].UniformType;

/* istanbul ignore next */

var ColorOverlayFilter = function (_Filter) {
  _inherits(ColorOverlayFilter, _Filter);

  function ColorOverlayFilter() {
    var _ref;

    _classCallCheck(this, ColorOverlayFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = ColorOverlayFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(ColorOverlayFilter)).call.apply(_ref, [this].concat(args)));

    _this._fragmentSource = __webpack_require__(232);
    return _this;
  }

  /**
   * Applies this filter to the given inputTarget and renders it to
   * the given outputTarget using the CanvasRenderer
   * @param  {CanvasRenderer} renderer
   * @param  {RenderTarget} inputTarget
   * @param  {RenderTarget} outputTarget
   * @param  {Boolean} clear = false
   * @private
   */


  _createClass(ColorOverlayFilter, [{
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var canvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();
      var outputContext = outputTarget.getContext();
      var color = this._options.color;


      var inputImageData = inputContext.getImageData(0, 0, canvas.width, canvas.height);
      var outputImageData = outputContext.getImageData(0, 0, canvas.width, canvas.height);
      var pixelCount = canvas.width * canvas.height;

      var inputColor = new __WEBPACK_IMPORTED_MODULE_4__globals__["b" /* Color */]();
      var outputColor = new __WEBPACK_IMPORTED_MODULE_4__globals__["b" /* Color */]();
      for (var i = 0; i < pixelCount * 4; i += 4) {
        inputColor.set(inputImageData.data[i] / 255, inputImageData.data[i + 1] / 255, inputImageData.data[i + 2] / 255, inputImageData.data[i + 3] / 255);
        outputColor.set(outputImageData.data[i] / 255, outputImageData.data[i + 1] / 255, outputImageData.data[i + 2] / 255, outputImageData.data[i + 3] / 255);

        var newR = outputColor.r + inputColor.a * (inputColor.r - outputColor.r);
        outputImageData.data[i] = (newR + inputColor.a * (color.r - newR)) * 255;

        var newG = outputColor.g + inputColor.a * (inputColor.g - outputColor.g);
        outputImageData.data[i + 1] = (newG + inputColor.a * (color.g - newG)) * 255;

        var newB = outputColor.b + inputColor.a * (inputColor.b - outputColor.b);
        outputImageData.data[i + 2] = (newB + inputColor.a * (color.b - newB)) * 255;
      }

      outputContext.putImageData(outputImageData, 0, 0);
    }
  }]);

  return ColorOverlayFilter;
}(__WEBPACK_IMPORTED_MODULE_5__filter__["a" /* default */]);

/**
 * Specifies the available options for this filter
 * @type {Object}
 * @ignore
 */


ColorOverlayFilter.prototype.availableOptions = {
  color: { type: OptionType.COLOR, default: __WEBPACK_IMPORTED_MODULE_4__globals__["b" /* Color */].WHITE, uniformType: UniformType.FLOAT4 }
};

/* harmony default export */ __webpack_exports__["a"] = (ColorOverlayFilter);

/***/ }),
/* 232 */
/***/ (function(module, exports) {

module.exports = "uniform sampler2D u_image;\nvarying vec2 v_texCoord;\nuniform vec4 u_color;\n\nvoid main() {\n  vec4 color = texture2D(u_image, v_texCoord);\n  gl_FragColor = vec4(mix(color.rgb, u_color.rgb, u_color.a), color.a) * color.a;\n}\n"

/***/ }),
/* 233 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__globals__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__filter__ = __webpack_require__(54);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var OptionType = __WEBPACK_IMPORTED_MODULE_4__globals__["c" /* Constants */].OptionType,
    UniformType = __WEBPACK_IMPORTED_MODULE_4__globals__["c" /* Constants */].UniformType;

/* istanbul ignore next */

var TintFilter = function (_Filter) {
  _inherits(TintFilter, _Filter);

  function TintFilter() {
    var _ref;

    _classCallCheck(this, TintFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = TintFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(TintFilter)).call.apply(_ref, [this].concat(args)));

    _this._fragmentSource = __webpack_require__(234);
    return _this;
  }

  /**
   * Applies this filter to the given inputTarget and renders it to
   * the given outputTarget using the CanvasRenderer
   * @param  {CanvasRenderer} renderer
   * @param  {RenderTarget} inputTarget
   * @param  {RenderTarget} outputTarget
   * @param  {Boolean} clear = false
   * @private
   */


  _createClass(TintFilter, [{
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var canvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();
      var outputContext = outputTarget.getContext();

      var imageData = inputContext.getImageData(0, 0, canvas.width, canvas.height);
      var _options = this._options,
          mode = _options.mode,
          color = _options.color;
      var r = color.r,
          g = color.g,
          b = color.b,
          a = color.a;


      var W = [0.2125, 0.7154, 0.0721];

      switch (mode) {
        case TintFilter.MODES.SOLID:
          for (var i = 0; i < canvas.width * canvas.height; i++) {
            var index = i * 4;
            imageData.data[index] += (r * 255 - imageData.data[index]) * a;
            imageData.data[index + 1] += (g * 255 - imageData.data[index + 1]) * a;
            imageData.data[index + 2] += (b * 255 - imageData.data[index + 2]) * a;
          }
          break;
        case TintFilter.MODES.COLORIZED:
          for (var _i = 0; _i < canvas.width * canvas.height; _i++) {
            var _index = _i * 4;

            var luminance = imageData.data[_index] / 255 * W[0] + imageData.data[_index + 1] / 255 * W[1] + imageData.data[_index + 2] / 255 * W[2];
            var colorized = new __WEBPACK_IMPORTED_MODULE_4__globals__["b" /* Color */](luminance * r, luminance * g, luminance * b);
            imageData.data[_index] += (colorized.r * 255 - imageData.data[_index]) * a;
            imageData.data[_index + 1] += (colorized.g * 255 - imageData.data[_index + 1]) * a;
            imageData.data[_index + 2] += (colorized.b * 255 - imageData.data[_index + 2]) * a;
          }
          break;
      }

      outputContext.putImageData(imageData, 0, 0);
    }
  }]);

  return TintFilter;
}(__WEBPACK_IMPORTED_MODULE_5__filter__["a" /* default */]);

/**
 * Specifies the available tint modes
 * @type {Object}
 */


TintFilter.MODES = {
  NONE: 0,
  SOLID: 1,
  COLORIZED: 2

  /**
   * Specifies the available options for this filter
   * @type {Object}
   * @ignore
   */
};TintFilter.prototype.availableOptions = {
  color: { type: OptionType.COLOR, default: __WEBPACK_IMPORTED_MODULE_4__globals__["b" /* Color */].WHITE, uniformType: UniformType.FLOAT4 },
  mode: { type: OptionType.NUMBER, default: TintFilter.MODES.NONE, uniformType: UniformType.INT }
};

/* harmony default export */ __webpack_exports__["a"] = (TintFilter);

/***/ }),
/* 234 */
/***/ (function(module, exports) {

module.exports = "uniform sampler2D u_image;\nvarying vec2 v_texCoord;\nuniform vec4 u_color;\nuniform int u_mode;\n\nvec3 W = vec3(0.2125, 0.7154, 0.0721);\n\nvoid main() {\n  vec4 color = texture2D(u_image, v_texCoord);\n  if (u_mode == 0) {\n    gl_FragColor = color * color.a;\n  } else if (u_mode == 1) {\n    gl_FragColor = vec4(mix(color.rgb, u_color.rgb, u_color.a), color.a) * color.a;\n  } else if (u_mode == 2) {\n    float luminance = dot(color.rgb, W);\n    vec3 colorized = vec3(luminance) * u_color.rgb;\n    gl_FragColor = vec4(mix(color.rgb, colorized, u_color.a), color.a) * color.a;\n  }\n}\n"

/***/ }),
/* 235 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__globals__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__filter__ = __webpack_require__(54);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var OptionType = __WEBPACK_IMPORTED_MODULE_4__globals__["c" /* Constants */].OptionType,
    UniformType = __WEBPACK_IMPORTED_MODULE_4__globals__["c" /* Constants */].UniformType;


var EPSILON = 0.000001;

/* istanbul ignore next */

var OverlayFilter = function (_Filter) {
  _inherits(OverlayFilter, _Filter);

  function OverlayFilter() {
    var _ref;

    _classCallCheck(this, OverlayFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = OverlayFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(OverlayFilter)).call.apply(_ref, [this].concat(args)));

    _this._fragmentSource = __webpack_require__(236);

    _this._lastImage = null;
    return _this;
  }

  /**
   * Applies this filter to the given inputTarget and renders it to
   * the given outputTarget using the CanvasRenderer
   * @param  {CanvasRenderer} renderer
   * @param  {RenderTarget} inputTarget
   * @param  {RenderTarget} outputTarget
   * @param  {Boolean} clear = false
   * @private
   */


  _createClass(OverlayFilter, [{
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      // @todo Add support for non-rendertextures (usual textures)
      var overlayContext = this._options.overlayTexture.getRenderTarget().getContext();

      var canvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();
      var outputContext = outputTarget.getContext();

      var imageData = inputContext.getImageData(0, 0, canvas.width, canvas.height);
      var overlayImageData = overlayContext.getImageData(0, 0, canvas.width, canvas.height);
      var _options = this._options,
          blendMode = _options.blendMode,
          alpha = _options.alpha;


      var inputColor = new __WEBPACK_IMPORTED_MODULE_4__globals__["b" /* Color */]();
      var overlayColor = new __WEBPACK_IMPORTED_MODULE_4__globals__["b" /* Color */]();
      var outputColor = new __WEBPACK_IMPORTED_MODULE_4__globals__["b" /* Color */]();
      for (var i = 0; i < canvas.width * canvas.height * 4; i += 4) {
        inputColor.set(imageData.data[i] / 255, imageData.data[i + 1] / 255, imageData.data[i + 2] / 255, imageData.data[i + 3] / 255);
        overlayColor.set(overlayImageData.data[i] / 255, overlayImageData.data[i + 1] / 255, overlayImageData.data[i + 2] / 255, overlayImageData.data[i + 3] / 255);

        var rA = void 0,
            rB = void 0,
            newR = void 0;
        var gA = void 0,
            gB = void 0,
            newG = void 0;
        var bA = void 0,
            bB = void 0,
            newB = void 0;
        switch (blendMode) {
          case OverlayFilter.BLEND_MODES.NORMAL:
            outputColor.set(inputColor.r + overlayColor.a * alpha * (overlayColor.r - inputColor.r), inputColor.g + overlayColor.a * alpha * (overlayColor.g - inputColor.g), inputColor.b + overlayColor.a * alpha * (overlayColor.b - inputColor.b), inputColor.a);
            break;
          case OverlayFilter.BLEND_MODES.OVERLAY:
            rA = 1 - 2 * (1 - inputColor.r) * (1 - overlayColor.r);
            rB = 2 * inputColor.r * overlayColor.r;
            newR = rA + (inputColor.r < 0.5 ? 1 : 0) * (rB - rA);

            gA = 1 - 2 * (1 - inputColor.g) * (1 - overlayColor.g);
            gB = 2 * inputColor.g * overlayColor.g;
            newG = gA + (inputColor.g < 0.5 ? 1 : 0) * (gB - gA);

            bA = 1 - 2 * (1 - inputColor.b) * (1 - overlayColor.b);
            bB = 2 * inputColor.b * overlayColor.b;
            newB = bA + (inputColor.b < 0.5 ? 1 : 0) * (bB - bA);

            outputColor.set(inputColor.r + overlayColor.a * alpha * (newR - inputColor.r), inputColor.g + overlayColor.a * alpha * (newG - inputColor.g), inputColor.b + overlayColor.a * alpha * (newB - inputColor.b), inputColor.a);
            break;
          case OverlayFilter.BLEND_MODES.HARD_LIGHT:
            rA = 1 - 2 * (1 - overlayColor.r) * (1 - inputColor.r);
            rB = 2 * overlayColor.r * inputColor.r;
            newR = rA + (overlayColor.r < 0.5 ? 1 : 0) * (rB - rA);

            gA = 1 - 2 * (1 - overlayColor.g) * (1 - inputColor.g);
            gB = 2 * overlayColor.g * inputColor.g;
            newG = gA + (overlayColor.g < 0.5 ? 1 : 0) * (gB - gA);

            bA = 1 - 2 * (1 - overlayColor.b) * (1 - inputColor.b);
            bB = 2 * overlayColor.b * inputColor.b;
            newB = bA + (overlayColor.b < 0.5 ? 1 : 0) * (bB - bA);

            outputColor.set(inputColor.r + overlayColor.a * alpha * (newR - inputColor.r), inputColor.g + overlayColor.a * alpha * (newG - inputColor.g), inputColor.b + overlayColor.a * alpha * (newB - inputColor.b), inputColor.a);
            break;
          case OverlayFilter.BLEND_MODES.SOFT_LIGHT:
            rA = 2 * inputColor.r * (1 - overlayColor.r) + (2 * overlayColor.r - 1) * Math.sqrt(inputColor.r);
            rB = 2 * inputColor.r * overlayColor.r + inputColor.r * inputColor.r * (1 - 2 * overlayColor.r);
            newR = rA + (overlayColor.r < 0.5 ? 1 : 0) * (rB - rA);

            gA = 2 * inputColor.g * (1 - overlayColor.g) + (2 * overlayColor.g - 1) * Math.sqrt(inputColor.g);
            gB = 2 * inputColor.g * overlayColor.g + inputColor.g * inputColor.g * (1 - 2 * overlayColor.g);
            newG = gA + (overlayColor.g < 0.5 ? 1 : 0) * (gB - gA);

            bA = 2 * inputColor.b * (1 - overlayColor.b) + (2 * overlayColor.b - 1) * Math.sqrt(inputColor.b);
            bB = 2 * inputColor.b * overlayColor.b + inputColor.b * inputColor.b * (1 - 2 * overlayColor.b);
            newB = bA + (overlayColor.b < 0.5 ? 1 : 0) * (bB - bA);

            outputColor.set(inputColor.r + overlayColor.a * alpha * (newR - inputColor.r), inputColor.g + overlayColor.a * alpha * (newG - inputColor.g), inputColor.b + overlayColor.a * alpha * (newB - inputColor.b), inputColor.a);
            break;
          case OverlayFilter.BLEND_MODES.MULTIPLY:
            newR = inputColor.r * overlayColor.r;
            newG = inputColor.g * overlayColor.g;
            newB = inputColor.b * overlayColor.b;

            outputColor.set(inputColor.r + overlayColor.a * alpha * (newR - inputColor.r), inputColor.g + overlayColor.a * alpha * (newG - inputColor.g), inputColor.b + overlayColor.a * alpha * (newB - inputColor.b), inputColor.a);
            break;
          case OverlayFilter.BLEND_MODES.DARKEN:
            newR = Math.min(inputColor.r, overlayColor.r);
            newG = Math.min(inputColor.g, overlayColor.g);
            newB = Math.min(inputColor.b, overlayColor.b);

            outputColor.set(inputColor.r + overlayColor.a * alpha * (newR - inputColor.r), inputColor.g + overlayColor.a * alpha * (newG - inputColor.g), inputColor.b + overlayColor.a * alpha * (newB - inputColor.b), inputColor.a);
            break;
          case OverlayFilter.BLEND_MODES.LIGHTEN:
            newR = Math.max(inputColor.r, overlayColor.r);
            newG = Math.max(inputColor.g, overlayColor.g);
            newB = Math.max(inputColor.b, overlayColor.b);

            outputColor.set(inputColor.r + overlayColor.a * alpha * (newR - inputColor.r), inputColor.g + overlayColor.a * alpha * (newG - inputColor.g), inputColor.b + overlayColor.a * alpha * (newB - inputColor.b), inputColor.a);
            break;
          case OverlayFilter.BLEND_MODES.SCREEN:
            newR = 1 - (1 - inputColor.r) * (1 - overlayColor.r);
            newG = 1 - (1 - inputColor.g) * (1 - overlayColor.g);
            newB = 1 - (1 - inputColor.b) * (1 - overlayColor.b);

            outputColor.set(inputColor.r + overlayColor.a * alpha * (newR - inputColor.r), inputColor.g + overlayColor.a * alpha * (newG - inputColor.g), inputColor.b + overlayColor.a * alpha * (newB - inputColor.b), inputColor.a);
            break;
          case OverlayFilter.BLEND_MODES.COLOR_BURN:
            newR = Math.max(0, Math.min(1, 1 - (1 - inputColor.r) / Math.max(overlayColor.r, EPSILON)));
            newG = Math.max(0, Math.min(1, 1 - (1 - inputColor.g) / Math.max(overlayColor.g, EPSILON)));
            newB = Math.max(0, Math.min(1, 1 - (1 - inputColor.b) / Math.max(overlayColor.b, EPSILON)));

            outputColor.set(inputColor.r + overlayColor.a * alpha * (newR - inputColor.r), inputColor.g + overlayColor.a * alpha * (newG - inputColor.g), inputColor.b + overlayColor.a * alpha * (newB - inputColor.b), inputColor.a);
            break;
        }

        imageData.data[i] = outputColor.r * 255;
        imageData.data[i + 1] = outputColor.g * 255;
        imageData.data[i + 2] = outputColor.b * 255;
        imageData.data[i + 3] = outputColor.a * 255;
      }

      outputContext.putImageData(imageData, 0, 0);
    }
  }]);

  return OverlayFilter;
}(__WEBPACK_IMPORTED_MODULE_5__filter__["a" /* default */]);

/**
 * Specifies the available tint modes
 * @type {Object}
 */


OverlayFilter.BLEND_MODES = {
  NORMAL: 0,
  OVERLAY: 1,
  HARD_LIGHT: 2,
  SOFT_LIGHT: 3,
  MULTIPLY: 4,
  DARKEN: 5,
  LIGHTEN: 6,
  SCREEN: 7,
  COLOR_BURN: 8

  /**
   * Specifies the available options for this filter
   * @type {Object}
   * @ignore
   */
};OverlayFilter.prototype.availableOptions = {
  blendMode: { type: OptionType.NUMBER, default: OverlayFilter.BLEND_MODES.NORMAL, uniformType: UniformType.INT },
  overlayImage: { type: OptionType.NUMBER, required: true, uniformType: UniformType.SAMPLER2D },
  overlayTexture: { type: OptionType.OBJECT, required: true },
  alpha: { type: OptionType.NUMBER, default: 1, uniformType: UniformType.FLOAT }
};

/* harmony default export */ __webpack_exports__["a"] = (OverlayFilter);

/***/ }),
/* 236 */
/***/ (function(module, exports) {

module.exports = "uniform sampler2D u_image;\nvarying vec2 v_texCoord;\nuniform sampler2D u_overlayImage;\nuniform int u_blendMode;\nuniform float u_alpha;\n\nconst float EPSILON = 0.000001;\n\nvec4 overlay(vec4 a, vec4 b) {\n    vec3 result = mix(\n          1.0 - 2.0 * (1.0 - a.rgb) * (1.0 - b.rgb),\n          2.0 * a.rgb * b.rgb,\n          vec3(a.r < 0.5, a.g < 0.5, a.b < 0.5)\n      );\n    return mix(a, vec4(result, a.a), u_alpha * b.a);\n}\n\nvec4 hardLight(vec4 b, vec4 a) {\n    vec3 result = mix(\n          1.0 - 2.0 * (1.0 - a.rgb) * (1.0 - b.rgb),\n          2.0 * a.rgb * b.rgb,\n          vec3(a.r < 0.5, a.g < 0.5, a.b < 0.5)\n      );\n    return mix(b, vec4(result, b.a), u_alpha * a.a);\n}\n\nvec4 softLight(vec4 a, vec4 b) {\n    vec3 result = mix(\n          2.0 * a.rgb * (1.0 - b.rgb) + (2.0 * b.rgb - 1.0) * sqrt(a.rgb),\n          2.0 * a.rgb * b.rgb + a.rgb * a.rgb * (1.0 - 2.0 * b.rgb),\n          vec3(b.r < 0.5, b.g < 0.5, b.b < 0.5)\n      );\n    return mix(a, vec4(result, a.a), u_alpha * b.a);\n}\n\nvec4 multiply(vec4 a, vec4 b) {\n    vec3 result = a.rgb * b.rgb;\n    return mix(a, vec4(result, a.a), u_alpha * b.a);\n}\n\nvec4 darken(vec4 a, vec4 b) {\n    vec3 result = min(a.rgb, b.rgb);\n    return mix(a, vec4(result, a.a), u_alpha * b.a);\n}\n\nvec4 lighten(vec4 a, vec4 b) {\n    vec3 result = max(a.rgb, b.rgb);\n    return mix(a, vec4(result, a.a), u_alpha * b.a);\n}\n\nvec4 screen(vec4 a, vec4 b) {\n    vec3 result = 1.0 - (1.0 - a.rgb) * (1.0 - b.rgb);\n    return mix(a, vec4(result, a.a), u_alpha * b.a);\n}\n\nvec4 colorBurn(vec4 a, vec4 b) {\n    vec3 result = clamp(1.0 - (1.0 - a.rgb) / max(b.rgb, EPSILON), 0.0, 1.0);\n    return mix(a, vec4(result, a.a), u_alpha * b.a);\n}\n\nvec4 normal(vec4 a, vec4 b) {\n    return mix(a, vec4(b.rgb, a.a), 1.0);\n}\n\nvoid main() {\n  vec4 color = texture2D(u_image, v_texCoord);\n  vec4 overlayColor = texture2D(u_overlayImage, v_texCoord);\n\n  vec4 resultColor;\n  if (u_blendMode == 0) {\n    resultColor = normal(color, overlayColor);\n  } else if (u_blendMode == 1) {\n    resultColor = overlay(color, overlayColor);\n  } else if (u_blendMode == 2) {\n    resultColor = hardLight(color, overlayColor);\n  } else if (u_blendMode == 3) {\n    resultColor = softLight(color, overlayColor);\n  } else if (u_blendMode == 4) {\n    resultColor = multiply(color, overlayColor);\n  } else if (u_blendMode == 5) {\n    resultColor = darken(color, overlayColor);\n  } else if (u_blendMode == 6) {\n    resultColor = lighten(color, overlayColor);\n  } else if (u_blendMode == 7) {\n    resultColor = screen(color, overlayColor);\n  } else if (u_blendMode == 8) {\n    resultColor = colorBurn(color, overlayColor);\n  }\n  gl_FragColor = vec4(resultColor.rgb * resultColor.a, resultColor.a);\n}\n"

/***/ }),
/* 237 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_symbol_iterator__ = __webpack_require__(35);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_symbol_iterator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_symbol_iterator__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol__ = __webpack_require__(39);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_promise__ = __webpack_require__(29);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_promise___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_promise__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils__ = __webpack_require__(22);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__vendor_jsbn__ = __webpack_require__(238);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__lib_base64__ = __webpack_require__(50);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__shared_loaders_json_loader__ = __webpack_require__(136);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__vendor_sha256__ = __webpack_require__(246);





var _typeof = typeof __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default.a === "function" && typeof __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_symbol_iterator___default.a === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default.a === "function" && obj.constructor === __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default.a && obj !== __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default.a.prototype ? "symbol" : typeof obj; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */






var bd = function bd(str) {
  return __WEBPACK_IMPORTED_MODULE_4__utils__["a" /* default */].byteArrayToString(__WEBPACK_IMPORTED_MODULE_6__lib_base64__["a" /* default */].decode(str));
};

function byteArraytoHexString(byteArray) {
  return byteArray.map(function (byte) {
    return ('0' + (byte & 0xFF).toString(16)).slice(-2);
  }).join('');
}

// /track?apiKey= (hashed twice)
var TRACK_PATH = 'TDNSeVlXTnJQMkZ3YVV0bGVUMD0=';
var ENTERPRISE_LICENSE = 'ZW50ZXJwcmlzZV9saWNlbnNl';
var APP_IDENTIFIERS = 'YXBwX2lkZW50aWZpZXJz';
var PLATFORM = 'cGxhdGZvcm0=';
var FEATURES = 'ZmVhdHVyZXM=';
var EXPIRES_AT = 'ZXhwaXJlc19hdA==';
var DOMAINS = 'ZG9tYWlucw==';
var API_TOKEN = 'YXBpX3Rva2Vu';
var SIGNATURE = 'c2lnbmF0dXJl';

/**
 * Checks whether the license of the SDK is valid
 * @class
 * @ignore
 */

var L = function () {
  /**
   * Creates a new VersionChecker
   */
  function L(license) {
    _classCallCheck(this, L);

    this._version = '2.0';
    this._l = typeof license === 'string' ? license.trim() : license;
    this._e = this._parseBigInt('65537', 10);
    this._n = this._parseBigInt('6819840423824240913788063375448466721602926474225172236787752309' + '8336604672061187336820404073576669839528249293719278301686716477' + '3742859209434481353888637963692711665138989982680829529436715362' + '5667358136346796192740590402327288838945110996697754005565843294' + '3537572395130934093465857147866505940324185122919531106934589987' + '0108307225910988692123234379186643268583453907260879685992156955' + '9365611423142339833978193569371093431275044410769200884553375977' + '3647508667624675016897621976339835025479716831395476245954274644' + '0628077261880980924552698138857743609502132632199713575442848784' + '2713045032260453199916894132342284390445225837907138900931659124' + '5542868850746377306421632875326596323793099870689104267910598717' + '5588970202082466871461192706070321938250462103821558100761330890' + '2281356202089358012868786573841087212687618786944368951946284113' + '9745420290435157777150691674661228996405349021099034285740903017' + '9406810634136188751670648983222653319056818302012063874664196648' + '8681563056966446643621715425036653214559713359559486988289399487' + '8672019313267274977616291309200066795329980321640466408798804658' + '4107737900256954976744353601826341965438148646041640662195744770' + '5440947482959458441845074598088031149173011240880824583060864734' + '90516969815873631', 10);
    this._parseLicense();
  }

  /**
   * Checks if the license is valid
   * @return {Boolean}
   */


  _createClass(L, [{
    key: 'v',
    value: function v() {
      return this._sigValid() && !this.isExp();
    }

    /**
     * Checks if the license is a valid JSON
     */

  }, {
    key: '_jsonValid',
    value: function _jsonValid() {
      try {
        this._decLic = JSON.parse(this._l);
      } catch (e) {
        this._decLic = {};
        return false; // not a valid json
      }
      return true;
    }

    /**
     * Checks if this license is valid for the current hostname
     * @return {Boolean}
     * @private
     */

  }, {
    key: '_hostnameValid',
    value: function _hostnameValid() {
      if (typeof window === 'undefined') return true;
      if (!this._decLic[bd(APP_IDENTIFIERS)].length) return true;

      var hostname = window.location.hostname;

      var valid = false;
      this._decLic[bd(APP_IDENTIFIERS)].forEach(function (appIdentifier) {
        if (__WEBPACK_IMPORTED_MODULE_4__utils__["a" /* default */].wildCardMatch(hostname, appIdentifier)) {
          valid = true;
        }
      });
      return valid;
    }

    /**
     * Checks if this license is valid for the current platform
     * @return {Boolean}
     * @private
     */

  }, {
    key: '_platformValid',
    value: function _platformValid() {
      var licensePlatform = this._decLic[bd(PLATFORM)];
      var systemPlatform =  false ? 'Server' : 'HTML5';
      return systemPlatform === licensePlatform;
    }

    /**
     * Throws an error if the license is not valid
     */

  }, {
    key: 'c',
    value: function c() {
      var _this = this;

      return new __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_promise___default.a(function (resolve, reject) {
        var licenseType = _typeof(_this._l);
        if (licenseType !== 'string' || !_this._jsonValid()) {
          var error = new Error();
          error.code = 'ELICINVFMT';
          return reject(error);
        }

        if (!_this._sigValid()) {
          var _error = new Error();
          _error.code = 'ELICINV';
          return reject(_error);
        }

        if (!_this._hostnameValid()) {
          var _error2 = new Error();
          _error2.code = 'ELICINVHOST';
          return reject(_error2);
        }

        if (!_this._platformValid()) {
          var _error3 = new Error();
          _error3.code = 'ELICINVPLAT';
          return reject(_error3);
        }

        if (_this.isExp()) {
          var _error4 = new Error();
          _error4.code = 'ELICEXP';
          return reject(_error4);
        }

        resolve();
      });
    }

    /**
     * Checks if the given tool identifier is available per license
     * @param  {String}  identifier
     * @return {Boolean}
     */

  }, {
    key: 'isToolAllowed',
    value: function isToolAllowed(identifier) {
      return this._decLic[bd(FEATURES)] && this._decLic[bd(FEATURES)].indexOf(identifier) !== -1;
    }

    /**
     * Tracks an edit
     * @return {Promise}
     */

  }, {
    key: 't',
    value: function t() {
      if (this._decLic.enterprise_license) return __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_promise___default.a.resolve();

      var trackPath = this._decLic[bd(DOMAINS)][0] + bd(bd(TRACK_PATH)) + this._decLic[bd(API_TOKEN)];
      var jsonLoader = new __WEBPACK_IMPORTED_MODULE_7__shared_loaders_json_loader__["a" /* default */](trackPath);
      return jsonLoader.load();
    }

    /**
     * Checks if this license is an enterprise license
     * @return {Boolean}
     */

  }, {
    key: 'isENT',
    value: function isENT() {
      if (!this._decLic) return false;
      return this._decLic[bd(ENTERPRISE_LICENSE)];
    }

    /**
     * Checks if the license signature is valid
     * @return {Boolean}
     * @private
     */

  }, {
    key: '_sigValid',
    value: function _sigValid() {
      return this._verify(this._message, this._sig);
    }
  }, {
    key: 'exp',
    value: function exp() {
      return !!this._decLic[bd(EXPIRES_AT)];
    }
  }, {
    key: 'dl',
    value: function dl() {
      return Math.ceil((this._expAt() - Date.now()) / (60 * 60 * 24 * 1000));
    }

    /**
     * Check if license is expired now
     * @param {number} current_time
     * @private
     */

  }, {
    key: 'isExp',
    value: function isExp() {
      var now = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Date.now();

      if (this._decLic[bd(EXPIRES_AT)] === null) return false;
      return now > this._expAt();
    }

    /**
     * Returns the datetime that the license will expire at in milliseconds
     * @return {Number}
     * @private
     */

  }, {
    key: '_expAt',
    value: function _expAt() {
      return this._decLic[bd(EXPIRES_AT)] * 1000;
    }

    /**
     * Verify the signature
     * @param  {String} message
     * @param  {String} signature
     * @return {Boolean}
     * @private
     */

  }, {
    key: '_verify',
    value: function _verify(message, signature) {
      var verification = void 0;
      var messageDigest = void 0;
      // Encode message to messageDigest with sha256
      messageDigest = this._encodeMessage(message);
      // Decode signature
      verification = this._decodeSignature(signature);

      // Cut to correct length of sha256 hash
      verification = verification.substr(-64);
      var isValid = messageDigest === verification;
      return isValid;
    }

    /**
     * Encode the message to sha256 messageDigest
     * @param {String} message
     * @return {String}
     * @private
     */

  }, {
    key: '_encodeMessage',
    value: function _encodeMessage(message) {
      var messageDigest = Object(__WEBPACK_IMPORTED_MODULE_8__vendor_sha256__["a" /* sha256 */])(message);
      return messageDigest;
    }

    /**
     * Decode signature and extract messageDigest
     * @param  {String} signature
     */

  }, {
    key: '_decodeSignature',
    value: function _decodeSignature(signature) {
      var verification = void 0;
      // Decode Base64 to ByteArray
      signature = __WEBPACK_IMPORTED_MODULE_6__lib_base64__["a" /* default */].decode(signature);
      // Convert ByteArray to HexString
      signature = byteArraytoHexString(signature);
      // Convert hex to BigInteger
      signature = this._parseBigInt(signature, 16);
      // Calculate verification
      verification = signature.modPowInt(this._e, this._n);
      // convert to hex
      verification = verification.toString(16);
      return verification;
    }

    /**
     * Parse the given string as a BigInteger with the given base
     * @param {String} str
     * @param {Number} base
     * @return {BigInteger}
     * @private
     */

  }, {
    key: '_parseBigInt',
    value: function _parseBigInt(str, base) {
      return new __WEBPACK_IMPORTED_MODULE_5__vendor_jsbn__["a" /* default */](str, base);
    }

    /**
     * Parses the license
     * @private
     */

  }, {
    key: '_parseLicense',
    value: function _parseLicense() {
      if (typeof this._l !== 'string') return;
      if (!this._jsonValid()) return;

      this._sig = this._decLic[bd(SIGNATURE)] || '';
      delete this._decLic[bd(SIGNATURE)];

      // Replace invalid base64 characters. This includes newlines
      this._sig = this._sig.replace(/[^A-Za-z0-9+/=]/g, '');
      this._message = this._l.replace(new RegExp(',"' + bd(SIGNATURE) + '":"([^"]*)"'), '');
    }
  }]);

  return L;
}();

/* harmony default export */ __webpack_exports__["a"] = (L);

/***/ }),
/* 238 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* unused harmony export int2char */
/* eslint-disable */
/*!
 * Copyright (c) 2003-2005  Tom Wu
 * All Rights Reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
 *
 * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
 * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF
 * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT
 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 * In addition, the following condition applies:
 *
 * All redistributions must retain an intact copy of this copyright notice
 * and disclaimer.
 */

// Polyfill navigator
var navigator = navigator || {};

// Basic JavaScript BN library - subset useful for RSA encryption.

// Bits per digit
var dbits;

// JavaScript engine analysis
var canary = 0xdeadbeefcafe;
var j_lm = (canary & 0xffffff) == 0xefcafe;

// (public) Constructor
function BigInteger(a, b, c) {
  if (a != null) if ("number" == typeof a) this.fromNumber(a, b, c);else if (b == null && "string" != typeof a) this.fromString(a, 256);else this.fromString(a, b);
}

// return new, unset BigInteger
function nbi() {
  return new BigInteger(null);
}

// am: Compute w_j += (x*this_i), propagate carries,
// c is initial carry, returns final carry.
// c < 3*dvalue, x < 2*dvalue, this_i < dvalue
// We need to select the fastest one that works in this environment.

// am1: use a single mult and divide to get the high bits,
// max digit bits should be 26 because
// max internal value = 2*dvalue^2-2*dvalue (< 2^53)
function am1(i, x, w, j, c, n) {
  while (--n >= 0) {
    var v = x * this[i++] + w[j] + c;
    c = Math.floor(v / 0x4000000);
    w[j++] = v & 0x3ffffff;
  }
  return c;
}
// am2 avoids a big mult-and-extract completely.
// Max digit bits should be <= 30 because we do bitwise ops
// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)
function am2(i, x, w, j, c, n) {
  var xl = x & 0x7fff,
      xh = x >> 15;
  while (--n >= 0) {
    var l = this[i] & 0x7fff;
    var h = this[i++] >> 15;
    var m = xh * l + h * xl;
    l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff);
    c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30);
    w[j++] = l & 0x3fffffff;
  }
  return c;
}
// Alternately, set max digit bits to 28 since some
// browsers slow down when dealing with 32-bit numbers.
function am3(i, x, w, j, c, n) {
  var xl = x & 0x3fff,
      xh = x >> 14;
  while (--n >= 0) {
    var l = this[i] & 0x3fff;
    var h = this[i++] >> 14;
    var m = xh * l + h * xl;
    l = xl * l + ((m & 0x3fff) << 14) + w[j] + c;
    c = (l >> 28) + (m >> 14) + xh * h;
    w[j++] = l & 0xfffffff;
  }
  return c;
}

if (j_lm && navigator.appName == "Microsoft Internet Explorer") {
  BigInteger.prototype.am = am2;
  dbits = 30;
} else if (j_lm && navigator.appName != "Netscape") {
  BigInteger.prototype.am = am1;
  dbits = 26;
} else {
  // Mozilla/Netscape seems to prefer am3
  BigInteger.prototype.am = am3;
  dbits = 28;
}

BigInteger.prototype.DB = dbits;
BigInteger.prototype.DM = (1 << dbits) - 1;
BigInteger.prototype.DV = 1 << dbits;

var BI_FP = 52;
BigInteger.prototype.FV = Math.pow(2, BI_FP);
BigInteger.prototype.F1 = BI_FP - dbits;
BigInteger.prototype.F2 = 2 * dbits - BI_FP;

// Digit conversions
var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz";
var BI_RC = new Array();
var rr, vv;
rr = "0".charCodeAt(0);
for (vv = 0; vv <= 9; ++vv) {
  BI_RC[rr++] = vv;
}rr = "a".charCodeAt(0);
for (vv = 10; vv < 36; ++vv) {
  BI_RC[rr++] = vv;
}rr = "A".charCodeAt(0);
for (vv = 10; vv < 36; ++vv) {
  BI_RC[rr++] = vv;
}function int2char(n) {
  return BI_RM.charAt(n);
}
function intAt(s, i) {
  var c = BI_RC[s.charCodeAt(i)];
  return c == null ? -1 : c;
}

// (protected) copy this to r
function bnpCopyTo(r) {
  for (var i = this.t - 1; i >= 0; --i) {
    r[i] = this[i];
  }r.t = this.t;
  r.s = this.s;
}

// (protected) set from integer value x, -DV <= x < DV
function bnpFromInt(x) {
  this.t = 1;
  this.s = x < 0 ? -1 : 0;
  if (x > 0) this[0] = x;else if (x < -1) this[0] = x + this.DV;else this.t = 0;
}

// return bigint initialized to value
function nbv(i) {
  var r = nbi();r.fromInt(i);return r;
}

// (protected) set from string and radix
function bnpFromString(s, b) {
  var k;
  if (b == 16) k = 4;else if (b == 8) k = 3;else if (b == 256) k = 8; // byte array
  else if (b == 2) k = 1;else if (b == 32) k = 5;else if (b == 4) k = 2;else {
      this.fromRadix(s, b);return;
    }
  this.t = 0;
  this.s = 0;
  var i = s.length,
      mi = false,
      sh = 0;
  while (--i >= 0) {
    var x = k == 8 ? s[i] & 0xff : intAt(s, i);
    if (x < 0) {
      if (s.charAt(i) == "-") mi = true;
      continue;
    }
    mi = false;
    if (sh == 0) this[this.t++] = x;else if (sh + k > this.DB) {
      this[this.t - 1] |= (x & (1 << this.DB - sh) - 1) << sh;
      this[this.t++] = x >> this.DB - sh;
    } else this[this.t - 1] |= x << sh;
    sh += k;
    if (sh >= this.DB) sh -= this.DB;
  }
  if (k == 8 && (s[0] & 0x80) != 0) {
    this.s = -1;
    if (sh > 0) this[this.t - 1] |= (1 << this.DB - sh) - 1 << sh;
  }
  this.clamp();
  if (mi) BigInteger.ZERO.subTo(this, this);
}

// (protected) clamp off excess high words
function bnpClamp() {
  var c = this.s & this.DM;
  while (this.t > 0 && this[this.t - 1] == c) {
    --this.t;
  }
}

// (public) return string representation in given radix
function bnToString(b) {
  if (this.s < 0) return "-" + this.negate().toString(b);
  var k;
  if (b == 16) k = 4;else if (b == 8) k = 3;else if (b == 2) k = 1;else if (b == 32) k = 5;else if (b == 4) k = 2;else return this.toRadix(b);
  var km = (1 << k) - 1,
      d,
      m = false,
      r = "",
      i = this.t;
  var p = this.DB - i * this.DB % k;
  if (i-- > 0) {
    if (p < this.DB && (d = this[i] >> p) > 0) {
      m = true;r = int2char(d);
    }
    while (i >= 0) {
      if (p < k) {
        d = (this[i] & (1 << p) - 1) << k - p;
        d |= this[--i] >> (p += this.DB - k);
      } else {
        d = this[i] >> (p -= k) & km;
        if (p <= 0) {
          p += this.DB;--i;
        }
      }
      if (d > 0) m = true;
      if (m) r += int2char(d);
    }
  }
  return m ? r : "0";
}

// (public) -this
function bnNegate() {
  var r = nbi();BigInteger.ZERO.subTo(this, r);return r;
}

// (public) |this|
function bnAbs() {
  return this.s < 0 ? this.negate() : this;
}

// (public) return + if this > a, - if this < a, 0 if equal
function bnCompareTo(a) {
  var r = this.s - a.s;
  if (r != 0) return r;
  var i = this.t;
  r = i - a.t;
  if (r != 0) return this.s < 0 ? -r : r;
  while (--i >= 0) {
    if ((r = this[i] - a[i]) != 0) return r;
  }return 0;
}

// returns bit length of the integer x
function nbits(x) {
  var r = 1,
      t;
  if ((t = x >>> 16) != 0) {
    x = t;r += 16;
  }
  if ((t = x >> 8) != 0) {
    x = t;r += 8;
  }
  if ((t = x >> 4) != 0) {
    x = t;r += 4;
  }
  if ((t = x >> 2) != 0) {
    x = t;r += 2;
  }
  if ((t = x >> 1) != 0) {
    x = t;r += 1;
  }
  return r;
}

// (public) return the number of bits in "this"
function bnBitLength() {
  if (this.t <= 0) return 0;
  return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ this.s & this.DM);
}

// (protected) r = this << n*DB
function bnpDLShiftTo(n, r) {
  var i;
  for (i = this.t - 1; i >= 0; --i) {
    r[i + n] = this[i];
  }for (i = n - 1; i >= 0; --i) {
    r[i] = 0;
  }r.t = this.t + n;
  r.s = this.s;
}

// (protected) r = this >> n*DB
function bnpDRShiftTo(n, r) {
  for (var i = n; i < this.t; ++i) {
    r[i - n] = this[i];
  }r.t = Math.max(this.t - n, 0);
  r.s = this.s;
}

// (protected) r = this << n
function bnpLShiftTo(n, r) {
  var bs = n % this.DB;
  var cbs = this.DB - bs;
  var bm = (1 << cbs) - 1;
  var ds = Math.floor(n / this.DB),
      c = this.s << bs & this.DM,
      i;
  for (i = this.t - 1; i >= 0; --i) {
    r[i + ds + 1] = this[i] >> cbs | c;
    c = (this[i] & bm) << bs;
  }
  for (i = ds - 1; i >= 0; --i) {
    r[i] = 0;
  }r[ds] = c;
  r.t = this.t + ds + 1;
  r.s = this.s;
  r.clamp();
}

// (protected) r = this >> n
function bnpRShiftTo(n, r) {
  r.s = this.s;
  var ds = Math.floor(n / this.DB);
  if (ds >= this.t) {
    r.t = 0;return;
  }
  var bs = n % this.DB;
  var cbs = this.DB - bs;
  var bm = (1 << bs) - 1;
  r[0] = this[ds] >> bs;
  for (var i = ds + 1; i < this.t; ++i) {
    r[i - ds - 1] |= (this[i] & bm) << cbs;
    r[i - ds] = this[i] >> bs;
  }
  if (bs > 0) r[this.t - ds - 1] |= (this.s & bm) << cbs;
  r.t = this.t - ds;
  r.clamp();
}

// (protected) r = this - a
function bnpSubTo(a, r) {
  var i = 0,
      c = 0,
      m = Math.min(a.t, this.t);
  while (i < m) {
    c += this[i] - a[i];
    r[i++] = c & this.DM;
    c >>= this.DB;
  }
  if (a.t < this.t) {
    c -= a.s;
    while (i < this.t) {
      c += this[i];
      r[i++] = c & this.DM;
      c >>= this.DB;
    }
    c += this.s;
  } else {
    c += this.s;
    while (i < a.t) {
      c -= a[i];
      r[i++] = c & this.DM;
      c >>= this.DB;
    }
    c -= a.s;
  }
  r.s = c < 0 ? -1 : 0;
  if (c < -1) r[i++] = this.DV + c;else if (c > 0) r[i++] = c;
  r.t = i;
  r.clamp();
}

// (protected) r = this * a, r != this,a (HAC 14.12)
// "this" should be the larger one if appropriate.
function bnpMultiplyTo(a, r) {
  var x = this.abs(),
      y = a.abs();
  var i = x.t;
  r.t = i + y.t;
  while (--i >= 0) {
    r[i] = 0;
  }for (i = 0; i < y.t; ++i) {
    r[i + x.t] = x.am(0, y[i], r, i, 0, x.t);
  }r.s = 0;
  r.clamp();
  if (this.s != a.s) BigInteger.ZERO.subTo(r, r);
}

// (protected) r = this^2, r != this (HAC 14.16)
function bnpSquareTo(r) {
  var x = this.abs();
  var i = r.t = 2 * x.t;
  while (--i >= 0) {
    r[i] = 0;
  }for (i = 0; i < x.t - 1; ++i) {
    var c = x.am(i, x[i], r, 2 * i, 0, 1);
    if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) {
      r[i + x.t] -= x.DV;
      r[i + x.t + 1] = 1;
    }
  }
  if (r.t > 0) r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1);
  r.s = 0;
  r.clamp();
}

// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)
// r != q, this != m.  q or r may be null.
function bnpDivRemTo(m, q, r) {
  var pm = m.abs();
  if (pm.t <= 0) return;
  var pt = this.abs();
  if (pt.t < pm.t) {
    if (q != null) q.fromInt(0);
    if (r != null) this.copyTo(r);
    return;
  }
  if (r == null) r = nbi();
  var y = nbi(),
      ts = this.s,
      ms = m.s;
  var nsh = this.DB - nbits(pm[pm.t - 1]); // normalize modulus
  if (nsh > 0) {
    pm.lShiftTo(nsh, y);pt.lShiftTo(nsh, r);
  } else {
    pm.copyTo(y);pt.copyTo(r);
  }
  var ys = y.t;
  var y0 = y[ys - 1];
  if (y0 == 0) return;
  var yt = y0 * (1 << this.F1) + (ys > 1 ? y[ys - 2] >> this.F2 : 0);
  var d1 = this.FV / yt,
      d2 = (1 << this.F1) / yt,
      e = 1 << this.F2;
  var i = r.t,
      j = i - ys,
      t = q == null ? nbi() : q;
  y.dlShiftTo(j, t);
  if (r.compareTo(t) >= 0) {
    r[r.t++] = 1;
    r.subTo(t, r);
  }
  BigInteger.ONE.dlShiftTo(ys, t);
  t.subTo(y, y); // "negative" y so we can replace sub with am later
  while (y.t < ys) {
    y[y.t++] = 0;
  }while (--j >= 0) {
    // Estimate quotient digit
    var qd = r[--i] == y0 ? this.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2);
    if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) {
      // Try it out
      y.dlShiftTo(j, t);
      r.subTo(t, r);
      while (r[i] < --qd) {
        r.subTo(t, r);
      }
    }
  }
  if (q != null) {
    r.drShiftTo(ys, q);
    if (ts != ms) BigInteger.ZERO.subTo(q, q);
  }
  r.t = ys;
  r.clamp();
  if (nsh > 0) r.rShiftTo(nsh, r); // Denormalize remainder
  if (ts < 0) BigInteger.ZERO.subTo(r, r);
}

// (public) this mod a
function bnMod(a) {
  var r = nbi();
  this.abs().divRemTo(a, null, r);
  if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r, r);
  return r;
}

// Modular reduction using "classic" algorithm
function Classic(m) {
  this.m = m;
}
function cConvert(x) {
  if (x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m);else return x;
}
function cRevert(x) {
  return x;
}
function cReduce(x) {
  x.divRemTo(this.m, null, x);
}
function cMulTo(x, y, r) {
  x.multiplyTo(y, r);this.reduce(r);
}
function cSqrTo(x, r) {
  x.squareTo(r);this.reduce(r);
}

Classic.prototype.convert = cConvert;
Classic.prototype.revert = cRevert;
Classic.prototype.reduce = cReduce;
Classic.prototype.mulTo = cMulTo;
Classic.prototype.sqrTo = cSqrTo;

// (protected) return "-1/this % 2^DB"; useful for Mont. reduction
// justification:
//         xy == 1 (mod m)
//         xy =  1+km
//   xy(2-xy) = (1+km)(1-km)
// x[y(2-xy)] = 1-k^2m^2
// x[y(2-xy)] == 1 (mod m^2)
// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2
// should reduce x and y(2-xy) by m^2 at each step to keep size bounded.
// JS multiply "overflows" differently from C/C++, so care is needed here.
function bnpInvDigit() {
  if (this.t < 1) return 0;
  var x = this[0];
  if ((x & 1) == 0) return 0;
  var y = x & 3; // y == 1/x mod 2^2
  y = y * (2 - (x & 0xf) * y) & 0xf; // y == 1/x mod 2^4
  y = y * (2 - (x & 0xff) * y) & 0xff; // y == 1/x mod 2^8
  y = y * (2 - ((x & 0xffff) * y & 0xffff)) & 0xffff; // y == 1/x mod 2^16
  // last step - calculate inverse mod DV directly;
  // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints
  y = y * (2 - x * y % this.DV) % this.DV; // y == 1/x mod 2^dbits
  // we really want the negative inverse, and -DV < y < DV
  return y > 0 ? this.DV - y : -y;
}

// Montgomery reduction
function Montgomery(m) {
  this.m = m;
  this.mp = m.invDigit();
  this.mpl = this.mp & 0x7fff;
  this.mph = this.mp >> 15;
  this.um = (1 << m.DB - 15) - 1;
  this.mt2 = 2 * m.t;
}

// xR mod m
function montConvert(x) {
  var r = nbi();
  x.abs().dlShiftTo(this.m.t, r);
  r.divRemTo(this.m, null, r);
  if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r, r);
  return r;
}

// x/R mod m
function montRevert(x) {
  var r = nbi();
  x.copyTo(r);
  this.reduce(r);
  return r;
}

// x = x/R mod m (HAC 14.32)
function montReduce(x) {
  while (x.t <= this.mt2) {
    // pad x so am has enough room later
    x[x.t++] = 0;
  }for (var i = 0; i < this.m.t; ++i) {
    // faster way of calculating u0 = x[i]*mp mod DV
    var j = x[i] & 0x7fff;
    var u0 = j * this.mpl + ((j * this.mph + (x[i] >> 15) * this.mpl & this.um) << 15) & x.DM;
    // use am to combine the multiply-shift-add into one call
    j = i + this.m.t;
    x[j] += this.m.am(0, u0, x, i, 0, this.m.t);
    // propagate carry
    while (x[j] >= x.DV) {
      x[j] -= x.DV;x[++j]++;
    }
  }
  x.clamp();
  x.drShiftTo(this.m.t, x);
  if (x.compareTo(this.m) >= 0) x.subTo(this.m, x);
}

// r = "x^2/R mod m"; x != r
function montSqrTo(x, r) {
  x.squareTo(r);this.reduce(r);
}

// r = "xy/R mod m"; x,y != r
function montMulTo(x, y, r) {
  x.multiplyTo(y, r);this.reduce(r);
}

Montgomery.prototype.convert = montConvert;
Montgomery.prototype.revert = montRevert;
Montgomery.prototype.reduce = montReduce;
Montgomery.prototype.mulTo = montMulTo;
Montgomery.prototype.sqrTo = montSqrTo;

// (protected) true iff this is even
function bnpIsEven() {
  return (this.t > 0 ? this[0] & 1 : this.s) == 0;
}

// (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
function bnpExp(e, z) {
  if (e > 0xffffffff || e < 1) return BigInteger.ONE;
  var r = nbi(),
      r2 = nbi(),
      g = z.convert(this),
      i = nbits(e) - 1;
  g.copyTo(r);
  while (--i >= 0) {
    z.sqrTo(r, r2);
    if ((e & 1 << i) > 0) z.mulTo(r2, g, r);else {
      var t = r;r = r2;r2 = t;
    }
  }
  return z.revert(r);
}

// (public) this^e % m, 0 <= e < 2^32
function bnModPowInt(e, m) {
  var z;
  if (e < 256 || m.isEven()) z = new Classic(m);else z = new Montgomery(m);
  return this.exp(e, z);
}

// protected
BigInteger.prototype.copyTo = bnpCopyTo;
BigInteger.prototype.fromInt = bnpFromInt;
BigInteger.prototype.fromString = bnpFromString;
BigInteger.prototype.clamp = bnpClamp;
BigInteger.prototype.dlShiftTo = bnpDLShiftTo;
BigInteger.prototype.drShiftTo = bnpDRShiftTo;
BigInteger.prototype.lShiftTo = bnpLShiftTo;
BigInteger.prototype.rShiftTo = bnpRShiftTo;
BigInteger.prototype.subTo = bnpSubTo;
BigInteger.prototype.multiplyTo = bnpMultiplyTo;
BigInteger.prototype.squareTo = bnpSquareTo;
BigInteger.prototype.divRemTo = bnpDivRemTo;
BigInteger.prototype.invDigit = bnpInvDigit;
BigInteger.prototype.isEven = bnpIsEven;
BigInteger.prototype.exp = bnpExp;

// public
BigInteger.prototype.toString = bnToString;
BigInteger.prototype.negate = bnNegate;
BigInteger.prototype.abs = bnAbs;
BigInteger.prototype.compareTo = bnCompareTo;
BigInteger.prototype.bitLength = bnBitLength;
BigInteger.prototype.mod = bnMod;
BigInteger.prototype.modPowInt = bnModPowInt;

// "constants"
BigInteger.ZERO = nbv(0);
BigInteger.ONE = nbv(1);

// Copyright (c) 2005-2009  Tom Wu
// All Rights Reserved.
// See "LICENSE" for details.

// Extended JavaScript BN functions, required for RSA private ops.

// Version 1.1: new BigInteger("0", 10) returns "proper" zero
// Version 1.2: square() API, isProbablePrime fix

// (public)
function bnClone() {
  var r = nbi();this.copyTo(r);return r;
}

// (public) return value as integer
function bnIntValue() {
  if (this.s < 0) {
    if (this.t == 1) return this[0] - this.DV;else if (this.t == 0) return -1;
  } else if (this.t == 1) return this[0];else if (this.t == 0) return 0;
  // assumes 16 < DB < 32
  return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0];
}

// (public) return value as byte
function bnByteValue() {
  return this.t == 0 ? this.s : this[0] << 24 >> 24;
}

// (public) return value as short (assumes DB>=16)
function bnShortValue() {
  return this.t == 0 ? this.s : this[0] << 16 >> 16;
}

// (protected) return x s.t. r^x < DV
function bnpChunkSize(r) {
  return Math.floor(Math.LN2 * this.DB / Math.log(r));
}

// (public) 0 if this == 0, 1 if this > 0
function bnSigNum() {
  if (this.s < 0) return -1;else if (this.t <= 0 || this.t == 1 && this[0] <= 0) return 0;else return 1;
}

// (protected) convert to radix string
function bnpToRadix(b) {
  if (b == null) b = 10;
  if (this.signum() == 0 || b < 2 || b > 36) return "0";
  var cs = this.chunkSize(b);
  var a = Math.pow(b, cs);
  var d = nbv(a),
      y = nbi(),
      z = nbi(),
      r = "";
  this.divRemTo(d, y, z);
  while (y.signum() > 0) {
    r = (a + z.intValue()).toString(b).substr(1) + r;
    y.divRemTo(d, y, z);
  }
  return z.intValue().toString(b) + r;
}

// (protected) convert from radix string
function bnpFromRadix(s, b) {
  this.fromInt(0);
  if (b == null) b = 10;
  var cs = this.chunkSize(b);
  var d = Math.pow(b, cs),
      mi = false,
      j = 0,
      w = 0;
  for (var i = 0; i < s.length; ++i) {
    var x = intAt(s, i);
    if (x < 0) {
      if (s.charAt(i) == "-" && this.signum() == 0) mi = true;
      continue;
    }
    w = b * w + x;
    if (++j >= cs) {
      this.dMultiply(d);
      this.dAddOffset(w, 0);
      j = 0;
      w = 0;
    }
  }
  if (j > 0) {
    this.dMultiply(Math.pow(b, j));
    this.dAddOffset(w, 0);
  }
  if (mi) BigInteger.ZERO.subTo(this, this);
}

// (protected) alternate constructor
function bnpFromNumber(a, b, c) {
  if ("number" == typeof b) {
    // new BigInteger(int,int,RNG)
    if (a < 2) this.fromInt(1);else {
      this.fromNumber(a, c);
      if (!this.testBit(a - 1)) // force MSB set
        this.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, this);
      if (this.isEven()) this.dAddOffset(1, 0); // force odd
      while (!this.isProbablePrime(b)) {
        this.dAddOffset(2, 0);
        if (this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a - 1), this);
      }
    }
  } else {
    // new BigInteger(int,RNG)
    var x = new Array(),
        t = a & 7;
    x.length = (a >> 3) + 1;
    b.nextBytes(x);
    if (t > 0) x[0] &= (1 << t) - 1;else x[0] = 0;
    this.fromString(x, 256);
  }
}

// (public) convert to bigendian byte array
function bnToByteArray() {
  var i = this.t,
      r = new Array();
  r[0] = this.s;
  var p = this.DB - i * this.DB % 8,
      d,
      k = 0;
  if (i-- > 0) {
    if (p < this.DB && (d = this[i] >> p) != (this.s & this.DM) >> p) r[k++] = d | this.s << this.DB - p;
    while (i >= 0) {
      if (p < 8) {
        d = (this[i] & (1 << p) - 1) << 8 - p;
        d |= this[--i] >> (p += this.DB - 8);
      } else {
        d = this[i] >> (p -= 8) & 0xff;
        if (p <= 0) {
          p += this.DB;--i;
        }
      }
      if ((d & 0x80) != 0) d |= -256;
      if (k == 0 && (this.s & 0x80) != (d & 0x80)) ++k;
      if (k > 0 || d != this.s) r[k++] = d;
    }
  }
  return r;
}

function bnEquals(a) {
  return this.compareTo(a) == 0;
}
function bnMin(a) {
  return this.compareTo(a) < 0 ? this : a;
}
function bnMax(a) {
  return this.compareTo(a) > 0 ? this : a;
}

// (protected) r = this op a (bitwise)
function bnpBitwiseTo(a, op, r) {
  var i,
      f,
      m = Math.min(a.t, this.t);
  for (i = 0; i < m; ++i) {
    r[i] = op(this[i], a[i]);
  }if (a.t < this.t) {
    f = a.s & this.DM;
    for (i = m; i < this.t; ++i) {
      r[i] = op(this[i], f);
    }r.t = this.t;
  } else {
    f = this.s & this.DM;
    for (i = m; i < a.t; ++i) {
      r[i] = op(f, a[i]);
    }r.t = a.t;
  }
  r.s = op(this.s, a.s);
  r.clamp();
}

// (public) this & a
function op_and(x, y) {
  return x & y;
}
function bnAnd(a) {
  var r = nbi();this.bitwiseTo(a, op_and, r);return r;
}

// (public) this | a
function op_or(x, y) {
  return x | y;
}
function bnOr(a) {
  var r = nbi();this.bitwiseTo(a, op_or, r);return r;
}

// (public) this ^ a
function op_xor(x, y) {
  return x ^ y;
}
function bnXor(a) {
  var r = nbi();this.bitwiseTo(a, op_xor, r);return r;
}

// (public) this & ~a
function op_andnot(x, y) {
  return x & ~y;
}
function bnAndNot(a) {
  var r = nbi();this.bitwiseTo(a, op_andnot, r);return r;
}

// (public) ~this
function bnNot() {
  var r = nbi();
  for (var i = 0; i < this.t; ++i) {
    r[i] = this.DM & ~this[i];
  }r.t = this.t;
  r.s = ~this.s;
  return r;
}

// (public) this << n
function bnShiftLeft(n) {
  var r = nbi();
  if (n < 0) this.rShiftTo(-n, r);else this.lShiftTo(n, r);
  return r;
}

// (public) this >> n
function bnShiftRight(n) {
  var r = nbi();
  if (n < 0) this.lShiftTo(-n, r);else this.rShiftTo(n, r);
  return r;
}

// return index of lowest 1-bit in x, x < 2^31
function lbit(x) {
  if (x == 0) return -1;
  var r = 0;
  if ((x & 0xffff) == 0) {
    x >>= 16;r += 16;
  }
  if ((x & 0xff) == 0) {
    x >>= 8;r += 8;
  }
  if ((x & 0xf) == 0) {
    x >>= 4;r += 4;
  }
  if ((x & 3) == 0) {
    x >>= 2;r += 2;
  }
  if ((x & 1) == 0) ++r;
  return r;
}

// (public) returns index of lowest 1-bit (or -1 if none)
function bnGetLowestSetBit() {
  for (var i = 0; i < this.t; ++i) {
    if (this[i] != 0) return i * this.DB + lbit(this[i]);
  }if (this.s < 0) return this.t * this.DB;
  return -1;
}

// return number of 1 bits in x
function cbit(x) {
  var r = 0;
  while (x != 0) {
    x &= x - 1;++r;
  }
  return r;
}

// (public) return number of set bits
function bnBitCount() {
  var r = 0,
      x = this.s & this.DM;
  for (var i = 0; i < this.t; ++i) {
    r += cbit(this[i] ^ x);
  }return r;
}

// (public) true iff nth bit is set
function bnTestBit(n) {
  var j = Math.floor(n / this.DB);
  if (j >= this.t) return this.s != 0;
  return (this[j] & 1 << n % this.DB) != 0;
}

// (protected) this op (1<<n)
function bnpChangeBit(n, op) {
  var r = BigInteger.ONE.shiftLeft(n);
  this.bitwiseTo(r, op, r);
  return r;
}

// (public) this | (1<<n)
function bnSetBit(n) {
  return this.changeBit(n, op_or);
}

// (public) this & ~(1<<n)
function bnClearBit(n) {
  return this.changeBit(n, op_andnot);
}

// (public) this ^ (1<<n)
function bnFlipBit(n) {
  return this.changeBit(n, op_xor);
}

// (protected) r = this + a
function bnpAddTo(a, r) {
  var i = 0,
      c = 0,
      m = Math.min(a.t, this.t);
  while (i < m) {
    c += this[i] + a[i];
    r[i++] = c & this.DM;
    c >>= this.DB;
  }
  if (a.t < this.t) {
    c += a.s;
    while (i < this.t) {
      c += this[i];
      r[i++] = c & this.DM;
      c >>= this.DB;
    }
    c += this.s;
  } else {
    c += this.s;
    while (i < a.t) {
      c += a[i];
      r[i++] = c & this.DM;
      c >>= this.DB;
    }
    c += a.s;
  }
  r.s = c < 0 ? -1 : 0;
  if (c > 0) r[i++] = c;else if (c < -1) r[i++] = this.DV + c;
  r.t = i;
  r.clamp();
}

// (public) this + a
function bnAdd(a) {
  var r = nbi();this.addTo(a, r);return r;
}

// (public) this - a
function bnSubtract(a) {
  var r = nbi();this.subTo(a, r);return r;
}

// (public) this * a
function bnMultiply(a) {
  var r = nbi();this.multiplyTo(a, r);return r;
}

// (public) this^2
function bnSquare() {
  var r = nbi();this.squareTo(r);return r;
}

// (public) this / a
function bnDivide(a) {
  var r = nbi();this.divRemTo(a, r, null);return r;
}

// (public) this % a
function bnRemainder(a) {
  var r = nbi();this.divRemTo(a, null, r);return r;
}

// (public) [this/a,this%a]
function bnDivideAndRemainder(a) {
  var q = nbi(),
      r = nbi();
  this.divRemTo(a, q, r);
  return new Array(q, r);
}

// (protected) this *= n, this >= 0, 1 < n < DV
function bnpDMultiply(n) {
  this[this.t] = this.am(0, n - 1, this, 0, 0, this.t);
  ++this.t;
  this.clamp();
}

// (protected) this += n << w words, this >= 0
function bnpDAddOffset(n, w) {
  if (n == 0) return;
  while (this.t <= w) {
    this[this.t++] = 0;
  }this[w] += n;
  while (this[w] >= this.DV) {
    this[w] -= this.DV;
    if (++w >= this.t) this[this.t++] = 0;
    ++this[w];
  }
}

// A "null" reducer
function NullExp() {}
function nNop(x) {
  return x;
}
function nMulTo(x, y, r) {
  x.multiplyTo(y, r);
}
function nSqrTo(x, r) {
  x.squareTo(r);
}

NullExp.prototype.convert = nNop;
NullExp.prototype.revert = nNop;
NullExp.prototype.mulTo = nMulTo;
NullExp.prototype.sqrTo = nSqrTo;

// (public) this^e
function bnPow(e) {
  return this.exp(e, new NullExp());
}

// (protected) r = lower n words of "this * a", a.t <= n
// "this" should be the larger one if appropriate.
function bnpMultiplyLowerTo(a, n, r) {
  var i = Math.min(this.t + a.t, n);
  r.s = 0; // assumes a,this >= 0
  r.t = i;
  while (i > 0) {
    r[--i] = 0;
  }var j;
  for (j = r.t - this.t; i < j; ++i) {
    r[i + this.t] = this.am(0, a[i], r, i, 0, this.t);
  }for (j = Math.min(a.t, n); i < j; ++i) {
    this.am(0, a[i], r, i, 0, n - i);
  }r.clamp();
}

// (protected) r = "this * a" without lower n words, n > 0
// "this" should be the larger one if appropriate.
function bnpMultiplyUpperTo(a, n, r) {
  --n;
  var i = r.t = this.t + a.t - n;
  r.s = 0; // assumes a,this >= 0
  while (--i >= 0) {
    r[i] = 0;
  }for (i = Math.max(n - this.t, 0); i < a.t; ++i) {
    r[this.t + i - n] = this.am(n - i, a[i], r, 0, 0, this.t + i - n);
  }r.clamp();
  r.drShiftTo(1, r);
}

// Barrett modular reduction
function Barrett(m) {
  // setup Barrett
  this.r2 = nbi();
  this.q3 = nbi();
  BigInteger.ONE.dlShiftTo(2 * m.t, this.r2);
  this.mu = this.r2.divide(m);
  this.m = m;
}

function barrettConvert(x) {
  if (x.s < 0 || x.t > 2 * this.m.t) return x.mod(this.m);else if (x.compareTo(this.m) < 0) return x;else {
    var r = nbi();x.copyTo(r);this.reduce(r);return r;
  }
}

function barrettRevert(x) {
  return x;
}

// x = x mod m (HAC 14.42)
function barrettReduce(x) {
  x.drShiftTo(this.m.t - 1, this.r2);
  if (x.t > this.m.t + 1) {
    x.t = this.m.t + 1;x.clamp();
  }
  this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3);
  this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2);
  while (x.compareTo(this.r2) < 0) {
    x.dAddOffset(1, this.m.t + 1);
  }x.subTo(this.r2, x);
  while (x.compareTo(this.m) >= 0) {
    x.subTo(this.m, x);
  }
}

// r = x^2 mod m; x != r
function barrettSqrTo(x, r) {
  x.squareTo(r);this.reduce(r);
}

// r = x*y mod m; x,y != r
function barrettMulTo(x, y, r) {
  x.multiplyTo(y, r);this.reduce(r);
}

Barrett.prototype.convert = barrettConvert;
Barrett.prototype.revert = barrettRevert;
Barrett.prototype.reduce = barrettReduce;
Barrett.prototype.mulTo = barrettMulTo;
Barrett.prototype.sqrTo = barrettSqrTo;

// (public) this^e % m (HAC 14.85)
function bnModPow(e, m) {
  var i = e.bitLength(),
      k,
      r = nbv(1),
      z;
  if (i <= 0) return r;else if (i < 18) k = 1;else if (i < 48) k = 3;else if (i < 144) k = 4;else if (i < 768) k = 5;else k = 6;
  if (i < 8) z = new Classic(m);else if (m.isEven()) z = new Barrett(m);else z = new Montgomery(m);

  // precomputation
  var g = new Array(),
      n = 3,
      k1 = k - 1,
      km = (1 << k) - 1;
  g[1] = z.convert(this);
  if (k > 1) {
    var g2 = nbi();
    z.sqrTo(g[1], g2);
    while (n <= km) {
      g[n] = nbi();
      z.mulTo(g2, g[n - 2], g[n]);
      n += 2;
    }
  }

  var j = e.t - 1,
      w,
      is1 = true,
      r2 = nbi(),
      t;
  i = nbits(e[j]) - 1;
  while (j >= 0) {
    if (i >= k1) w = e[j] >> i - k1 & km;else {
      w = (e[j] & (1 << i + 1) - 1) << k1 - i;
      if (j > 0) w |= e[j - 1] >> this.DB + i - k1;
    }

    n = k;
    while ((w & 1) == 0) {
      w >>= 1;--n;
    }
    if ((i -= n) < 0) {
      i += this.DB;--j;
    }
    if (is1) {
      // ret == 1, don't bother squaring or multiplying it
      g[w].copyTo(r);
      is1 = false;
    } else {
      while (n > 1) {
        z.sqrTo(r, r2);z.sqrTo(r2, r);n -= 2;
      }
      if (n > 0) z.sqrTo(r, r2);else {
        t = r;r = r2;r2 = t;
      }
      z.mulTo(r2, g[w], r);
    }

    while (j >= 0 && (e[j] & 1 << i) == 0) {
      z.sqrTo(r, r2);t = r;r = r2;r2 = t;
      if (--i < 0) {
        i = this.DB - 1;--j;
      }
    }
  }
  return z.revert(r);
}

// (public) gcd(this,a) (HAC 14.54)
function bnGCD(a) {
  var x = this.s < 0 ? this.negate() : this.clone();
  var y = a.s < 0 ? a.negate() : a.clone();
  if (x.compareTo(y) < 0) {
    var t = x;x = y;y = t;
  }
  var i = x.getLowestSetBit(),
      g = y.getLowestSetBit();
  if (g < 0) return x;
  if (i < g) g = i;
  if (g > 0) {
    x.rShiftTo(g, x);
    y.rShiftTo(g, y);
  }
  while (x.signum() > 0) {
    if ((i = x.getLowestSetBit()) > 0) x.rShiftTo(i, x);
    if ((i = y.getLowestSetBit()) > 0) y.rShiftTo(i, y);
    if (x.compareTo(y) >= 0) {
      x.subTo(y, x);
      x.rShiftTo(1, x);
    } else {
      y.subTo(x, y);
      y.rShiftTo(1, y);
    }
  }
  if (g > 0) y.lShiftTo(g, y);
  return y;
}

// (protected) this % n, n < 2^26
function bnpModInt(n) {
  if (n <= 0) return 0;
  var d = this.DV % n,
      r = this.s < 0 ? n - 1 : 0;
  if (this.t > 0) if (d == 0) r = this[0] % n;else for (var i = this.t - 1; i >= 0; --i) {
    r = (d * r + this[i]) % n;
  }return r;
}

// (public) 1/this % m (HAC 14.61)
function bnModInverse(m) {
  var ac = m.isEven();
  if (this.isEven() && ac || m.signum() == 0) return BigInteger.ZERO;
  var u = m.clone(),
      v = this.clone();
  var a = nbv(1),
      b = nbv(0),
      c = nbv(0),
      d = nbv(1);
  while (u.signum() != 0) {
    while (u.isEven()) {
      u.rShiftTo(1, u);
      if (ac) {
        if (!a.isEven() || !b.isEven()) {
          a.addTo(this, a);b.subTo(m, b);
        }
        a.rShiftTo(1, a);
      } else if (!b.isEven()) b.subTo(m, b);
      b.rShiftTo(1, b);
    }
    while (v.isEven()) {
      v.rShiftTo(1, v);
      if (ac) {
        if (!c.isEven() || !d.isEven()) {
          c.addTo(this, c);d.subTo(m, d);
        }
        c.rShiftTo(1, c);
      } else if (!d.isEven()) d.subTo(m, d);
      d.rShiftTo(1, d);
    }
    if (u.compareTo(v) >= 0) {
      u.subTo(v, u);
      if (ac) a.subTo(c, a);
      b.subTo(d, b);
    } else {
      v.subTo(u, v);
      if (ac) c.subTo(a, c);
      d.subTo(b, d);
    }
  }
  if (v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO;
  if (d.compareTo(m) >= 0) return d.subtract(m);
  if (d.signum() < 0) d.addTo(m, d);else return d;
  if (d.signum() < 0) return d.add(m);else return d;
}

var lowprimes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997];
var lplim = (1 << 26) / lowprimes[lowprimes.length - 1];

// (public) test primality with certainty >= 1-.5^t
function bnIsProbablePrime(t) {
  var i,
      x = this.abs();
  if (x.t == 1 && x[0] <= lowprimes[lowprimes.length - 1]) {
    for (i = 0; i < lowprimes.length; ++i) {
      if (x[0] == lowprimes[i]) return true;
    }return false;
  }
  if (x.isEven()) return false;
  i = 1;
  while (i < lowprimes.length) {
    var m = lowprimes[i],
        j = i + 1;
    while (j < lowprimes.length && m < lplim) {
      m *= lowprimes[j++];
    }m = x.modInt(m);
    while (i < j) {
      if (m % lowprimes[i++] == 0) return false;
    }
  }
  return x.millerRabin(t);
}

// (protected) true if probably prime (HAC 4.24, Miller-Rabin)
function bnpMillerRabin(t) {
  var n1 = this.subtract(BigInteger.ONE);
  var k = n1.getLowestSetBit();
  if (k <= 0) return false;
  var r = n1.shiftRight(k);
  t = t + 1 >> 1;
  if (t > lowprimes.length) t = lowprimes.length;
  var a = nbi();
  for (var i = 0; i < t; ++i) {
    //Pick bases at random, instead of starting at 2
    a.fromInt(lowprimes[Math.floor(Math.random() * lowprimes.length)]);
    var y = a.modPow(r, this);
    if (y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {
      var j = 1;
      while (j++ < k && y.compareTo(n1) != 0) {
        y = y.modPowInt(2, this);
        if (y.compareTo(BigInteger.ONE) == 0) return false;
      }
      if (y.compareTo(n1) != 0) return false;
    }
  }
  return true;
}

// protected
BigInteger.prototype.chunkSize = bnpChunkSize;
BigInteger.prototype.toRadix = bnpToRadix;
BigInteger.prototype.fromRadix = bnpFromRadix;
BigInteger.prototype.fromNumber = bnpFromNumber;
BigInteger.prototype.bitwiseTo = bnpBitwiseTo;
BigInteger.prototype.changeBit = bnpChangeBit;
BigInteger.prototype.addTo = bnpAddTo;
BigInteger.prototype.dMultiply = bnpDMultiply;
BigInteger.prototype.dAddOffset = bnpDAddOffset;
BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo;
BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo;
BigInteger.prototype.modInt = bnpModInt;
BigInteger.prototype.millerRabin = bnpMillerRabin;

// public
BigInteger.prototype.clone = bnClone;
BigInteger.prototype.intValue = bnIntValue;
BigInteger.prototype.byteValue = bnByteValue;
BigInteger.prototype.shortValue = bnShortValue;
BigInteger.prototype.signum = bnSigNum;
BigInteger.prototype.toByteArray = bnToByteArray;
BigInteger.prototype.equals = bnEquals;
BigInteger.prototype.min = bnMin;
BigInteger.prototype.max = bnMax;
BigInteger.prototype.and = bnAnd;
BigInteger.prototype.or = bnOr;
BigInteger.prototype.xor = bnXor;
BigInteger.prototype.andNot = bnAndNot;
BigInteger.prototype.not = bnNot;
BigInteger.prototype.shiftLeft = bnShiftLeft;
BigInteger.prototype.shiftRight = bnShiftRight;
BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit;
BigInteger.prototype.bitCount = bnBitCount;
BigInteger.prototype.testBit = bnTestBit;
BigInteger.prototype.setBit = bnSetBit;
BigInteger.prototype.clearBit = bnClearBit;
BigInteger.prototype.flipBit = bnFlipBit;
BigInteger.prototype.add = bnAdd;
BigInteger.prototype.subtract = bnSubtract;
BigInteger.prototype.multiply = bnMultiply;
BigInteger.prototype.divide = bnDivide;
BigInteger.prototype.remainder = bnRemainder;
BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder;
BigInteger.prototype.modPow = bnModPow;
BigInteger.prototype.modInverse = bnModInverse;
BigInteger.prototype.pow = bnPow;
BigInteger.prototype.gcd = bnGCD;
BigInteger.prototype.isProbablePrime = bnIsProbablePrime;

// JSBN-specific extension
BigInteger.prototype.square = bnSquare;

// BigInteger interfaces not implemented in jsbn:

// BigInteger(int signum, byte[] magnitude)
// double doubleValue()
// float floatValue()
// int hashCode()
// long longValue()
// static BigInteger valueOf(long val)


/* harmony default export */ __webpack_exports__["a"] = (BigInteger);

/***/ }),
/* 239 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.



var punycode = __webpack_require__(240);
var util = __webpack_require__(242);

exports.parse = urlParse;
exports.resolve = urlResolve;
exports.resolveObject = urlResolveObject;
exports.format = urlFormat;

exports.Url = Url;

function Url() {
  this.protocol = null;
  this.slashes = null;
  this.auth = null;
  this.host = null;
  this.port = null;
  this.hostname = null;
  this.hash = null;
  this.search = null;
  this.query = null;
  this.pathname = null;
  this.path = null;
  this.href = null;
}

// Reference: RFC 3986, RFC 1808, RFC 2396

// define these here so at least they only have to be
// compiled once on the first module load.
var protocolPattern = /^([a-z0-9.+-]+:)/i,
    portPattern = /:[0-9]*$/,

    // Special case for a simple path URL
    simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,

    // RFC 2396: characters reserved for delimiting URLs.
    // We actually just auto-escape these.
    delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],

    // RFC 2396: characters not allowed for various reasons.
    unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),

    // Allowed by RFCs, but cause of XSS attacks.  Always escape these.
    autoEscape = ['\''].concat(unwise),
    // Characters that are never ever allowed in a hostname.
    // Note that any invalid chars are also handled, but these
    // are the ones that are *expected* to be seen, so we fast-path
    // them.
    nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),
    hostEndingChars = ['/', '?', '#'],
    hostnameMaxLen = 255,
    hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
    hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
    // protocols that can allow "unsafe" and "unwise" chars.
    unsafeProtocol = {
      'javascript': true,
      'javascript:': true
    },
    // protocols that never have a hostname.
    hostlessProtocol = {
      'javascript': true,
      'javascript:': true
    },
    // protocols that always contain a // bit.
    slashedProtocol = {
      'http': true,
      'https': true,
      'ftp': true,
      'gopher': true,
      'file': true,
      'http:': true,
      'https:': true,
      'ftp:': true,
      'gopher:': true,
      'file:': true
    },
    querystring = __webpack_require__(243);

function urlParse(url, parseQueryString, slashesDenoteHost) {
  if (url && util.isObject(url) && url instanceof Url) return url;

  var u = new Url;
  u.parse(url, parseQueryString, slashesDenoteHost);
  return u;
}

Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
  if (!util.isString(url)) {
    throw new TypeError("Parameter 'url' must be a string, not " + typeof url);
  }

  // Copy chrome, IE, opera backslash-handling behavior.
  // Back slashes before the query string get converted to forward slashes
  // See: https://code.google.com/p/chromium/issues/detail?id=25916
  var queryIndex = url.indexOf('?'),
      splitter =
          (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',
      uSplit = url.split(splitter),
      slashRegex = /\\/g;
  uSplit[0] = uSplit[0].replace(slashRegex, '/');
  url = uSplit.join(splitter);

  var rest = url;

  // trim before proceeding.
  // This is to support parse stuff like "  http://foo.com  \n"
  rest = rest.trim();

  if (!slashesDenoteHost && url.split('#').length === 1) {
    // Try fast path regexp
    var simplePath = simplePathPattern.exec(rest);
    if (simplePath) {
      this.path = rest;
      this.href = rest;
      this.pathname = simplePath[1];
      if (simplePath[2]) {
        this.search = simplePath[2];
        if (parseQueryString) {
          this.query = querystring.parse(this.search.substr(1));
        } else {
          this.query = this.search.substr(1);
        }
      } else if (parseQueryString) {
        this.search = '';
        this.query = {};
      }
      return this;
    }
  }

  var proto = protocolPattern.exec(rest);
  if (proto) {
    proto = proto[0];
    var lowerProto = proto.toLowerCase();
    this.protocol = lowerProto;
    rest = rest.substr(proto.length);
  }

  // figure out if it's got a host
  // user@server is *always* interpreted as a hostname, and url
  // resolution will treat //foo/bar as host=foo,path=bar because that's
  // how the browser resolves relative URLs.
  if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
    var slashes = rest.substr(0, 2) === '//';
    if (slashes && !(proto && hostlessProtocol[proto])) {
      rest = rest.substr(2);
      this.slashes = true;
    }
  }

  if (!hostlessProtocol[proto] &&
      (slashes || (proto && !slashedProtocol[proto]))) {

    // there's a hostname.
    // the first instance of /, ?, ;, or # ends the host.
    //
    // If there is an @ in the hostname, then non-host chars *are* allowed
    // to the left of the last @ sign, unless some host-ending character
    // comes *before* the @-sign.
    // URLs are obnoxious.
    //
    // ex:
    // http://a@b@c/ => user:a@b host:c
    // http://a@b?@c => user:a host:c path:/?@c

    // v0.12 TODO(isaacs): This is not quite how Chrome does things.
    // Review our test case against browsers more comprehensively.

    // find the first instance of any hostEndingChars
    var hostEnd = -1;
    for (var i = 0; i < hostEndingChars.length; i++) {
      var hec = rest.indexOf(hostEndingChars[i]);
      if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
        hostEnd = hec;
    }

    // at this point, either we have an explicit point where the
    // auth portion cannot go past, or the last @ char is the decider.
    var auth, atSign;
    if (hostEnd === -1) {
      // atSign can be anywhere.
      atSign = rest.lastIndexOf('@');
    } else {
      // atSign must be in auth portion.
      // http://a@b/c@d => host:b auth:a path:/c@d
      atSign = rest.lastIndexOf('@', hostEnd);
    }

    // Now we have a portion which is definitely the auth.
    // Pull that off.
    if (atSign !== -1) {
      auth = rest.slice(0, atSign);
      rest = rest.slice(atSign + 1);
      this.auth = decodeURIComponent(auth);
    }

    // the host is the remaining to the left of the first non-host char
    hostEnd = -1;
    for (var i = 0; i < nonHostChars.length; i++) {
      var hec = rest.indexOf(nonHostChars[i]);
      if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
        hostEnd = hec;
    }
    // if we still have not hit it, then the entire thing is a host.
    if (hostEnd === -1)
      hostEnd = rest.length;

    this.host = rest.slice(0, hostEnd);
    rest = rest.slice(hostEnd);

    // pull out port.
    this.parseHost();

    // we've indicated that there is a hostname,
    // so even if it's empty, it has to be present.
    this.hostname = this.hostname || '';

    // if hostname begins with [ and ends with ]
    // assume that it's an IPv6 address.
    var ipv6Hostname = this.hostname[0] === '[' &&
        this.hostname[this.hostname.length - 1] === ']';

    // validate a little.
    if (!ipv6Hostname) {
      var hostparts = this.hostname.split(/\./);
      for (var i = 0, l = hostparts.length; i < l; i++) {
        var part = hostparts[i];
        if (!part) continue;
        if (!part.match(hostnamePartPattern)) {
          var newpart = '';
          for (var j = 0, k = part.length; j < k; j++) {
            if (part.charCodeAt(j) > 127) {
              // we replace non-ASCII char with a temporary placeholder
              // we need this to make sure size of hostname is not
              // broken by replacing non-ASCII by nothing
              newpart += 'x';
            } else {
              newpart += part[j];
            }
          }
          // we test again with ASCII char only
          if (!newpart.match(hostnamePartPattern)) {
            var validParts = hostparts.slice(0, i);
            var notHost = hostparts.slice(i + 1);
            var bit = part.match(hostnamePartStart);
            if (bit) {
              validParts.push(bit[1]);
              notHost.unshift(bit[2]);
            }
            if (notHost.length) {
              rest = '/' + notHost.join('.') + rest;
            }
            this.hostname = validParts.join('.');
            break;
          }
        }
      }
    }

    if (this.hostname.length > hostnameMaxLen) {
      this.hostname = '';
    } else {
      // hostnames are always lower case.
      this.hostname = this.hostname.toLowerCase();
    }

    if (!ipv6Hostname) {
      // IDNA Support: Returns a punycoded representation of "domain".
      // It only converts parts of the domain name that
      // have non-ASCII characters, i.e. it doesn't matter if
      // you call it with a domain that already is ASCII-only.
      this.hostname = punycode.toASCII(this.hostname);
    }

    var p = this.port ? ':' + this.port : '';
    var h = this.hostname || '';
    this.host = h + p;
    this.href += this.host;

    // strip [ and ] from the hostname
    // the host field still retains them, though
    if (ipv6Hostname) {
      this.hostname = this.hostname.substr(1, this.hostname.length - 2);
      if (rest[0] !== '/') {
        rest = '/' + rest;
      }
    }
  }

  // now rest is set to the post-host stuff.
  // chop off any delim chars.
  if (!unsafeProtocol[lowerProto]) {

    // First, make 100% sure that any "autoEscape" chars get
    // escaped, even if encodeURIComponent doesn't think they
    // need to be.
    for (var i = 0, l = autoEscape.length; i < l; i++) {
      var ae = autoEscape[i];
      if (rest.indexOf(ae) === -1)
        continue;
      var esc = encodeURIComponent(ae);
      if (esc === ae) {
        esc = escape(ae);
      }
      rest = rest.split(ae).join(esc);
    }
  }


  // chop off from the tail first.
  var hash = rest.indexOf('#');
  if (hash !== -1) {
    // got a fragment string.
    this.hash = rest.substr(hash);
    rest = rest.slice(0, hash);
  }
  var qm = rest.indexOf('?');
  if (qm !== -1) {
    this.search = rest.substr(qm);
    this.query = rest.substr(qm + 1);
    if (parseQueryString) {
      this.query = querystring.parse(this.query);
    }
    rest = rest.slice(0, qm);
  } else if (parseQueryString) {
    // no query string, but parseQueryString still requested
    this.search = '';
    this.query = {};
  }
  if (rest) this.pathname = rest;
  if (slashedProtocol[lowerProto] &&
      this.hostname && !this.pathname) {
    this.pathname = '/';
  }

  //to support http.request
  if (this.pathname || this.search) {
    var p = this.pathname || '';
    var s = this.search || '';
    this.path = p + s;
  }

  // finally, reconstruct the href based on what has been validated.
  this.href = this.format();
  return this;
};

// format a parsed object into a url string
function urlFormat(obj) {
  // ensure it's an object, and not a string url.
  // If it's an obj, this is a no-op.
  // this way, you can call url_format() on strings
  // to clean up potentially wonky urls.
  if (util.isString(obj)) obj = urlParse(obj);
  if (!(obj instanceof Url)) return Url.prototype.format.call(obj);
  return obj.format();
}

Url.prototype.format = function() {
  var auth = this.auth || '';
  if (auth) {
    auth = encodeURIComponent(auth);
    auth = auth.replace(/%3A/i, ':');
    auth += '@';
  }

  var protocol = this.protocol || '',
      pathname = this.pathname || '',
      hash = this.hash || '',
      host = false,
      query = '';

  if (this.host) {
    host = auth + this.host;
  } else if (this.hostname) {
    host = auth + (this.hostname.indexOf(':') === -1 ?
        this.hostname :
        '[' + this.hostname + ']');
    if (this.port) {
      host += ':' + this.port;
    }
  }

  if (this.query &&
      util.isObject(this.query) &&
      Object.keys(this.query).length) {
    query = querystring.stringify(this.query);
  }

  var search = this.search || (query && ('?' + query)) || '';

  if (protocol && protocol.substr(-1) !== ':') protocol += ':';

  // only the slashedProtocols get the //.  Not mailto:, xmpp:, etc.
  // unless they had them to begin with.
  if (this.slashes ||
      (!protocol || slashedProtocol[protocol]) && host !== false) {
    host = '//' + (host || '');
    if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
  } else if (!host) {
    host = '';
  }

  if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
  if (search && search.charAt(0) !== '?') search = '?' + search;

  pathname = pathname.replace(/[?#]/g, function(match) {
    return encodeURIComponent(match);
  });
  search = search.replace('#', '%23');

  return protocol + host + pathname + search + hash;
};

function urlResolve(source, relative) {
  return urlParse(source, false, true).resolve(relative);
}

Url.prototype.resolve = function(relative) {
  return this.resolveObject(urlParse(relative, false, true)).format();
};

function urlResolveObject(source, relative) {
  if (!source) return relative;
  return urlParse(source, false, true).resolveObject(relative);
}

Url.prototype.resolveObject = function(relative) {
  if (util.isString(relative)) {
    var rel = new Url();
    rel.parse(relative, false, true);
    relative = rel;
  }

  var result = new Url();
  var tkeys = Object.keys(this);
  for (var tk = 0; tk < tkeys.length; tk++) {
    var tkey = tkeys[tk];
    result[tkey] = this[tkey];
  }

  // hash is always overridden, no matter what.
  // even href="" will remove it.
  result.hash = relative.hash;

  // if the relative url is empty, then there's nothing left to do here.
  if (relative.href === '') {
    result.href = result.format();
    return result;
  }

  // hrefs like //foo/bar always cut to the protocol.
  if (relative.slashes && !relative.protocol) {
    // take everything except the protocol from relative
    var rkeys = Object.keys(relative);
    for (var rk = 0; rk < rkeys.length; rk++) {
      var rkey = rkeys[rk];
      if (rkey !== 'protocol')
        result[rkey] = relative[rkey];
    }

    //urlParse appends trailing / to urls like http://www.example.com
    if (slashedProtocol[result.protocol] &&
        result.hostname && !result.pathname) {
      result.path = result.pathname = '/';
    }

    result.href = result.format();
    return result;
  }

  if (relative.protocol && relative.protocol !== result.protocol) {
    // if it's a known url protocol, then changing
    // the protocol does weird things
    // first, if it's not file:, then we MUST have a host,
    // and if there was a path
    // to begin with, then we MUST have a path.
    // if it is file:, then the host is dropped,
    // because that's known to be hostless.
    // anything else is assumed to be absolute.
    if (!slashedProtocol[relative.protocol]) {
      var keys = Object.keys(relative);
      for (var v = 0; v < keys.length; v++) {
        var k = keys[v];
        result[k] = relative[k];
      }
      result.href = result.format();
      return result;
    }

    result.protocol = relative.protocol;
    if (!relative.host && !hostlessProtocol[relative.protocol]) {
      var relPath = (relative.pathname || '').split('/');
      while (relPath.length && !(relative.host = relPath.shift()));
      if (!relative.host) relative.host = '';
      if (!relative.hostname) relative.hostname = '';
      if (relPath[0] !== '') relPath.unshift('');
      if (relPath.length < 2) relPath.unshift('');
      result.pathname = relPath.join('/');
    } else {
      result.pathname = relative.pathname;
    }
    result.search = relative.search;
    result.query = relative.query;
    result.host = relative.host || '';
    result.auth = relative.auth;
    result.hostname = relative.hostname || relative.host;
    result.port = relative.port;
    // to support http.request
    if (result.pathname || result.search) {
      var p = result.pathname || '';
      var s = result.search || '';
      result.path = p + s;
    }
    result.slashes = result.slashes || relative.slashes;
    result.href = result.format();
    return result;
  }

  var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),
      isRelAbs = (
          relative.host ||
          relative.pathname && relative.pathname.charAt(0) === '/'
      ),
      mustEndAbs = (isRelAbs || isSourceAbs ||
                    (result.host && relative.pathname)),
      removeAllDots = mustEndAbs,
      srcPath = result.pathname && result.pathname.split('/') || [],
      relPath = relative.pathname && relative.pathname.split('/') || [],
      psychotic = result.protocol && !slashedProtocol[result.protocol];

  // if the url is a non-slashed url, then relative
  // links like ../.. should be able
  // to crawl up to the hostname, as well.  This is strange.
  // result.protocol has already been set by now.
  // Later on, put the first path part into the host field.
  if (psychotic) {
    result.hostname = '';
    result.port = null;
    if (result.host) {
      if (srcPath[0] === '') srcPath[0] = result.host;
      else srcPath.unshift(result.host);
    }
    result.host = '';
    if (relative.protocol) {
      relative.hostname = null;
      relative.port = null;
      if (relative.host) {
        if (relPath[0] === '') relPath[0] = relative.host;
        else relPath.unshift(relative.host);
      }
      relative.host = null;
    }
    mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
  }

  if (isRelAbs) {
    // it's absolute.
    result.host = (relative.host || relative.host === '') ?
                  relative.host : result.host;
    result.hostname = (relative.hostname || relative.hostname === '') ?
                      relative.hostname : result.hostname;
    result.search = relative.search;
    result.query = relative.query;
    srcPath = relPath;
    // fall through to the dot-handling below.
  } else if (relPath.length) {
    // it's relative
    // throw away the existing file, and take the new path instead.
    if (!srcPath) srcPath = [];
    srcPath.pop();
    srcPath = srcPath.concat(relPath);
    result.search = relative.search;
    result.query = relative.query;
  } else if (!util.isNullOrUndefined(relative.search)) {
    // just pull out the search.
    // like href='?foo'.
    // Put this after the other two cases because it simplifies the booleans
    if (psychotic) {
      result.hostname = result.host = srcPath.shift();
      //occationaly the auth can get stuck only in host
      //this especially happens in cases like
      //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
      var authInHost = result.host && result.host.indexOf('@') > 0 ?
                       result.host.split('@') : false;
      if (authInHost) {
        result.auth = authInHost.shift();
        result.host = result.hostname = authInHost.shift();
      }
    }
    result.search = relative.search;
    result.query = relative.query;
    //to support http.request
    if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
      result.path = (result.pathname ? result.pathname : '') +
                    (result.search ? result.search : '');
    }
    result.href = result.format();
    return result;
  }

  if (!srcPath.length) {
    // no path at all.  easy.
    // we've already handled the other stuff above.
    result.pathname = null;
    //to support http.request
    if (result.search) {
      result.path = '/' + result.search;
    } else {
      result.path = null;
    }
    result.href = result.format();
    return result;
  }

  // if a url ENDs in . or .., then it must get a trailing slash.
  // however, if it ends in anything else non-slashy,
  // then it must NOT get a trailing slash.
  var last = srcPath.slice(-1)[0];
  var hasTrailingSlash = (
      (result.host || relative.host || srcPath.length > 1) &&
      (last === '.' || last === '..') || last === '');

  // strip single dots, resolve double dots to parent dir
  // if the path tries to go above the root, `up` ends up > 0
  var up = 0;
  for (var i = srcPath.length; i >= 0; i--) {
    last = srcPath[i];
    if (last === '.') {
      srcPath.splice(i, 1);
    } else if (last === '..') {
      srcPath.splice(i, 1);
      up++;
    } else if (up) {
      srcPath.splice(i, 1);
      up--;
    }
  }

  // if the path is allowed to go above the root, restore leading ..s
  if (!mustEndAbs && !removeAllDots) {
    for (; up--; up) {
      srcPath.unshift('..');
    }
  }

  if (mustEndAbs && srcPath[0] !== '' &&
      (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
    srcPath.unshift('');
  }

  if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {
    srcPath.push('');
  }

  var isAbsolute = srcPath[0] === '' ||
      (srcPath[0] && srcPath[0].charAt(0) === '/');

  // put the host back
  if (psychotic) {
    result.hostname = result.host = isAbsolute ? '' :
                                    srcPath.length ? srcPath.shift() : '';
    //occationaly the auth can get stuck only in host
    //this especially happens in cases like
    //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
    var authInHost = result.host && result.host.indexOf('@') > 0 ?
                     result.host.split('@') : false;
    if (authInHost) {
      result.auth = authInHost.shift();
      result.host = result.hostname = authInHost.shift();
    }
  }

  mustEndAbs = mustEndAbs || (result.host && srcPath.length);

  if (mustEndAbs && !isAbsolute) {
    srcPath.unshift('');
  }

  if (!srcPath.length) {
    result.pathname = null;
    result.path = null;
  } else {
    result.pathname = srcPath.join('/');
  }

  //to support request.http
  if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
    result.path = (result.pathname ? result.pathname : '') +
                  (result.search ? result.search : '');
  }
  result.auth = relative.auth || result.auth;
  result.slashes = result.slashes || relative.slashes;
  result.href = result.format();
  return result;
};

Url.prototype.parseHost = function() {
  var host = this.host;
  var port = portPattern.exec(host);
  if (port) {
    port = port[0];
    if (port !== ':') {
      this.port = port.substr(1);
    }
    host = host.substr(0, host.length - port.length);
  }
  if (host) this.hostname = host;
};


/***/ }),
/* 240 */
/***/ (function(module, exports, __webpack_require__) {

/* WEBPACK VAR INJECTION */(function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;/*! https://mths.be/punycode v1.4.1 by @mathias */
;(function(root) {

	/** Detect free variables */
	var freeExports = typeof exports == 'object' && exports &&
		!exports.nodeType && exports;
	var freeModule = typeof module == 'object' && module &&
		!module.nodeType && module;
	var freeGlobal = typeof global == 'object' && global;
	if (
		freeGlobal.global === freeGlobal ||
		freeGlobal.window === freeGlobal ||
		freeGlobal.self === freeGlobal
	) {
		root = freeGlobal;
	}

	/**
	 * The `punycode` object.
	 * @name punycode
	 * @type Object
	 */
	var punycode,

	/** Highest positive signed 32-bit float value */
	maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1

	/** Bootstring parameters */
	base = 36,
	tMin = 1,
	tMax = 26,
	skew = 38,
	damp = 700,
	initialBias = 72,
	initialN = 128, // 0x80
	delimiter = '-', // '\x2D'

	/** Regular expressions */
	regexPunycode = /^xn--/,
	regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
	regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators

	/** Error messages */
	errors = {
		'overflow': 'Overflow: input needs wider integers to process',
		'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
		'invalid-input': 'Invalid input'
	},

	/** Convenience shortcuts */
	baseMinusTMin = base - tMin,
	floor = Math.floor,
	stringFromCharCode = String.fromCharCode,

	/** Temporary variable */
	key;

	/*--------------------------------------------------------------------------*/

	/**
	 * A generic error utility function.
	 * @private
	 * @param {String} type The error type.
	 * @returns {Error} Throws a `RangeError` with the applicable error message.
	 */
	function error(type) {
		throw new RangeError(errors[type]);
	}

	/**
	 * A generic `Array#map` utility function.
	 * @private
	 * @param {Array} array The array to iterate over.
	 * @param {Function} callback The function that gets called for every array
	 * item.
	 * @returns {Array} A new array of values returned by the callback function.
	 */
	function map(array, fn) {
		var length = array.length;
		var result = [];
		while (length--) {
			result[length] = fn(array[length]);
		}
		return result;
	}

	/**
	 * A simple `Array#map`-like wrapper to work with domain name strings or email
	 * addresses.
	 * @private
	 * @param {String} domain The domain name or email address.
	 * @param {Function} callback The function that gets called for every
	 * character.
	 * @returns {Array} A new string of characters returned by the callback
	 * function.
	 */
	function mapDomain(string, fn) {
		var parts = string.split('@');
		var result = '';
		if (parts.length > 1) {
			// In email addresses, only the domain name should be punycoded. Leave
			// the local part (i.e. everything up to `@`) intact.
			result = parts[0] + '@';
			string = parts[1];
		}
		// Avoid `split(regex)` for IE8 compatibility. See #17.
		string = string.replace(regexSeparators, '\x2E');
		var labels = string.split('.');
		var encoded = map(labels, fn).join('.');
		return result + encoded;
	}

	/**
	 * Creates an array containing the numeric code points of each Unicode
	 * character in the string. While JavaScript uses UCS-2 internally,
	 * this function will convert a pair of surrogate halves (each of which
	 * UCS-2 exposes as separate characters) into a single code point,
	 * matching UTF-16.
	 * @see `punycode.ucs2.encode`
	 * @see <https://mathiasbynens.be/notes/javascript-encoding>
	 * @memberOf punycode.ucs2
	 * @name decode
	 * @param {String} string The Unicode input string (UCS-2).
	 * @returns {Array} The new array of code points.
	 */
	function ucs2decode(string) {
		var output = [],
		    counter = 0,
		    length = string.length,
		    value,
		    extra;
		while (counter < length) {
			value = string.charCodeAt(counter++);
			if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
				// high surrogate, and there is a next character
				extra = string.charCodeAt(counter++);
				if ((extra & 0xFC00) == 0xDC00) { // low surrogate
					output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
				} else {
					// unmatched surrogate; only append this code unit, in case the next
					// code unit is the high surrogate of a surrogate pair
					output.push(value);
					counter--;
				}
			} else {
				output.push(value);
			}
		}
		return output;
	}

	/**
	 * Creates a string based on an array of numeric code points.
	 * @see `punycode.ucs2.decode`
	 * @memberOf punycode.ucs2
	 * @name encode
	 * @param {Array} codePoints The array of numeric code points.
	 * @returns {String} The new Unicode string (UCS-2).
	 */
	function ucs2encode(array) {
		return map(array, function(value) {
			var output = '';
			if (value > 0xFFFF) {
				value -= 0x10000;
				output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
				value = 0xDC00 | value & 0x3FF;
			}
			output += stringFromCharCode(value);
			return output;
		}).join('');
	}

	/**
	 * Converts a basic code point into a digit/integer.
	 * @see `digitToBasic()`
	 * @private
	 * @param {Number} codePoint The basic numeric code point value.
	 * @returns {Number} The numeric value of a basic code point (for use in
	 * representing integers) in the range `0` to `base - 1`, or `base` if
	 * the code point does not represent a value.
	 */
	function basicToDigit(codePoint) {
		if (codePoint - 48 < 10) {
			return codePoint - 22;
		}
		if (codePoint - 65 < 26) {
			return codePoint - 65;
		}
		if (codePoint - 97 < 26) {
			return codePoint - 97;
		}
		return base;
	}

	/**
	 * Converts a digit/integer into a basic code point.
	 * @see `basicToDigit()`
	 * @private
	 * @param {Number} digit The numeric value of a basic code point.
	 * @returns {Number} The basic code point whose value (when used for
	 * representing integers) is `digit`, which needs to be in the range
	 * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
	 * used; else, the lowercase form is used. The behavior is undefined
	 * if `flag` is non-zero and `digit` has no uppercase form.
	 */
	function digitToBasic(digit, flag) {
		//  0..25 map to ASCII a..z or A..Z
		// 26..35 map to ASCII 0..9
		return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
	}

	/**
	 * Bias adaptation function as per section 3.4 of RFC 3492.
	 * https://tools.ietf.org/html/rfc3492#section-3.4
	 * @private
	 */
	function adapt(delta, numPoints, firstTime) {
		var k = 0;
		delta = firstTime ? floor(delta / damp) : delta >> 1;
		delta += floor(delta / numPoints);
		for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
			delta = floor(delta / baseMinusTMin);
		}
		return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
	}

	/**
	 * Converts a Punycode string of ASCII-only symbols to a string of Unicode
	 * symbols.
	 * @memberOf punycode
	 * @param {String} input The Punycode string of ASCII-only symbols.
	 * @returns {String} The resulting string of Unicode symbols.
	 */
	function decode(input) {
		// Don't use UCS-2
		var output = [],
		    inputLength = input.length,
		    out,
		    i = 0,
		    n = initialN,
		    bias = initialBias,
		    basic,
		    j,
		    index,
		    oldi,
		    w,
		    k,
		    digit,
		    t,
		    /** Cached calculation results */
		    baseMinusT;

		// Handle the basic code points: let `basic` be the number of input code
		// points before the last delimiter, or `0` if there is none, then copy
		// the first basic code points to the output.

		basic = input.lastIndexOf(delimiter);
		if (basic < 0) {
			basic = 0;
		}

		for (j = 0; j < basic; ++j) {
			// if it's not a basic code point
			if (input.charCodeAt(j) >= 0x80) {
				error('not-basic');
			}
			output.push(input.charCodeAt(j));
		}

		// Main decoding loop: start just after the last delimiter if any basic code
		// points were copied; start at the beginning otherwise.

		for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {

			// `index` is the index of the next character to be consumed.
			// Decode a generalized variable-length integer into `delta`,
			// which gets added to `i`. The overflow checking is easier
			// if we increase `i` as we go, then subtract off its starting
			// value at the end to obtain `delta`.
			for (oldi = i, w = 1, k = base; /* no condition */; k += base) {

				if (index >= inputLength) {
					error('invalid-input');
				}

				digit = basicToDigit(input.charCodeAt(index++));

				if (digit >= base || digit > floor((maxInt - i) / w)) {
					error('overflow');
				}

				i += digit * w;
				t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);

				if (digit < t) {
					break;
				}

				baseMinusT = base - t;
				if (w > floor(maxInt / baseMinusT)) {
					error('overflow');
				}

				w *= baseMinusT;

			}

			out = output.length + 1;
			bias = adapt(i - oldi, out, oldi == 0);

			// `i` was supposed to wrap around from `out` to `0`,
			// incrementing `n` each time, so we'll fix that now:
			if (floor(i / out) > maxInt - n) {
				error('overflow');
			}

			n += floor(i / out);
			i %= out;

			// Insert `n` at position `i` of the output
			output.splice(i++, 0, n);

		}

		return ucs2encode(output);
	}

	/**
	 * Converts a string of Unicode symbols (e.g. a domain name label) to a
	 * Punycode string of ASCII-only symbols.
	 * @memberOf punycode
	 * @param {String} input The string of Unicode symbols.
	 * @returns {String} The resulting Punycode string of ASCII-only symbols.
	 */
	function encode(input) {
		var n,
		    delta,
		    handledCPCount,
		    basicLength,
		    bias,
		    j,
		    m,
		    q,
		    k,
		    t,
		    currentValue,
		    output = [],
		    /** `inputLength` will hold the number of code points in `input`. */
		    inputLength,
		    /** Cached calculation results */
		    handledCPCountPlusOne,
		    baseMinusT,
		    qMinusT;

		// Convert the input in UCS-2 to Unicode
		input = ucs2decode(input);

		// Cache the length
		inputLength = input.length;

		// Initialize the state
		n = initialN;
		delta = 0;
		bias = initialBias;

		// Handle the basic code points
		for (j = 0; j < inputLength; ++j) {
			currentValue = input[j];
			if (currentValue < 0x80) {
				output.push(stringFromCharCode(currentValue));
			}
		}

		handledCPCount = basicLength = output.length;

		// `handledCPCount` is the number of code points that have been handled;
		// `basicLength` is the number of basic code points.

		// Finish the basic string - if it is not empty - with a delimiter
		if (basicLength) {
			output.push(delimiter);
		}

		// Main encoding loop:
		while (handledCPCount < inputLength) {

			// All non-basic code points < n have been handled already. Find the next
			// larger one:
			for (m = maxInt, j = 0; j < inputLength; ++j) {
				currentValue = input[j];
				if (currentValue >= n && currentValue < m) {
					m = currentValue;
				}
			}

			// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
			// but guard against overflow
			handledCPCountPlusOne = handledCPCount + 1;
			if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
				error('overflow');
			}

			delta += (m - n) * handledCPCountPlusOne;
			n = m;

			for (j = 0; j < inputLength; ++j) {
				currentValue = input[j];

				if (currentValue < n && ++delta > maxInt) {
					error('overflow');
				}

				if (currentValue == n) {
					// Represent delta as a generalized variable-length integer
					for (q = delta, k = base; /* no condition */; k += base) {
						t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
						if (q < t) {
							break;
						}
						qMinusT = q - t;
						baseMinusT = base - t;
						output.push(
							stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
						);
						q = floor(qMinusT / baseMinusT);
					}

					output.push(stringFromCharCode(digitToBasic(q, 0)));
					bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
					delta = 0;
					++handledCPCount;
				}
			}

			++delta;
			++n;

		}
		return output.join('');
	}

	/**
	 * Converts a Punycode string representing a domain name or an email address
	 * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
	 * it doesn't matter if you call it on a string that has already been
	 * converted to Unicode.
	 * @memberOf punycode
	 * @param {String} input The Punycoded domain name or email address to
	 * convert to Unicode.
	 * @returns {String} The Unicode representation of the given Punycode
	 * string.
	 */
	function toUnicode(input) {
		return mapDomain(input, function(string) {
			return regexPunycode.test(string)
				? decode(string.slice(4).toLowerCase())
				: string;
		});
	}

	/**
	 * Converts a Unicode string representing a domain name or an email address to
	 * Punycode. Only the non-ASCII parts of the domain name will be converted,
	 * i.e. it doesn't matter if you call it with a domain that's already in
	 * ASCII.
	 * @memberOf punycode
	 * @param {String} input The domain name or email address to convert, as a
	 * Unicode string.
	 * @returns {String} The Punycode representation of the given domain name or
	 * email address.
	 */
	function toASCII(input) {
		return mapDomain(input, function(string) {
			return regexNonASCII.test(string)
				? 'xn--' + encode(string)
				: string;
		});
	}

	/*--------------------------------------------------------------------------*/

	/** Define the public API */
	punycode = {
		/**
		 * A string representing the current Punycode.js version number.
		 * @memberOf punycode
		 * @type String
		 */
		'version': '1.4.1',
		/**
		 * An object of methods to convert from JavaScript's internal character
		 * representation (UCS-2) to Unicode code points, and back.
		 * @see <https://mathiasbynens.be/notes/javascript-encoding>
		 * @memberOf punycode
		 * @type Object
		 */
		'ucs2': {
			'decode': ucs2decode,
			'encode': ucs2encode
		},
		'decode': decode,
		'encode': encode,
		'toASCII': toASCII,
		'toUnicode': toUnicode
	};

	/** Expose `punycode` */
	// Some AMD build optimizers, like r.js, check for specific condition patterns
	// like the following:
	if (
		true
	) {
		!(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
			return punycode;
		}).call(exports, __webpack_require__, exports, module),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
	} else if (freeExports && freeModule) {
		if (module.exports == freeExports) {
			// in Node.js, io.js, or RingoJS v0.8.0+
			freeModule.exports = punycode;
		} else {
			// in Narwhal or RingoJS v0.7.0-
			for (key in punycode) {
				punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
			}
		}
	} else {
		// in Rhino or a web browser
		root.punycode = punycode;
	}

}(this));

/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(241)(module), __webpack_require__(41)))

/***/ }),
/* 241 */
/***/ (function(module, exports) {

module.exports = function(module) {
	if(!module.webpackPolyfill) {
		module.deprecate = function() {};
		module.paths = [];
		// module.parent = undefined by default
		if(!module.children) module.children = [];
		Object.defineProperty(module, "loaded", {
			enumerable: true,
			get: function() {
				return module.l;
			}
		});
		Object.defineProperty(module, "id", {
			enumerable: true,
			get: function() {
				return module.i;
			}
		});
		module.webpackPolyfill = 1;
	}
	return module;
};


/***/ }),
/* 242 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = {
  isString: function(arg) {
    return typeof(arg) === 'string';
  },
  isObject: function(arg) {
    return typeof(arg) === 'object' && arg !== null;
  },
  isNull: function(arg) {
    return arg === null;
  },
  isNullOrUndefined: function(arg) {
    return arg == null;
  }
};


/***/ }),
/* 243 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


exports.decode = exports.parse = __webpack_require__(244);
exports.encode = exports.stringify = __webpack_require__(245);


/***/ }),
/* 244 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.



// If obj.hasOwnProperty has been overridden, then calling
// obj.hasOwnProperty(prop) will break.
// See: https://github.com/joyent/node/issues/1707
function hasOwnProperty(obj, prop) {
  return Object.prototype.hasOwnProperty.call(obj, prop);
}

module.exports = function(qs, sep, eq, options) {
  sep = sep || '&';
  eq = eq || '=';
  var obj = {};

  if (typeof qs !== 'string' || qs.length === 0) {
    return obj;
  }

  var regexp = /\+/g;
  qs = qs.split(sep);

  var maxKeys = 1000;
  if (options && typeof options.maxKeys === 'number') {
    maxKeys = options.maxKeys;
  }

  var len = qs.length;
  // maxKeys <= 0 means that we should not limit keys count
  if (maxKeys > 0 && len > maxKeys) {
    len = maxKeys;
  }

  for (var i = 0; i < len; ++i) {
    var x = qs[i].replace(regexp, '%20'),
        idx = x.indexOf(eq),
        kstr, vstr, k, v;

    if (idx >= 0) {
      kstr = x.substr(0, idx);
      vstr = x.substr(idx + 1);
    } else {
      kstr = x;
      vstr = '';
    }

    k = decodeURIComponent(kstr);
    v = decodeURIComponent(vstr);

    if (!hasOwnProperty(obj, k)) {
      obj[k] = v;
    } else if (isArray(obj[k])) {
      obj[k].push(v);
    } else {
      obj[k] = [obj[k], v];
    }
  }

  return obj;
};

var isArray = Array.isArray || function (xs) {
  return Object.prototype.toString.call(xs) === '[object Array]';
};


/***/ }),
/* 245 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.



var stringifyPrimitive = function(v) {
  switch (typeof v) {
    case 'string':
      return v;

    case 'boolean':
      return v ? 'true' : 'false';

    case 'number':
      return isFinite(v) ? v : '';

    default:
      return '';
  }
};

module.exports = function(obj, sep, eq, name) {
  sep = sep || '&';
  eq = eq || '=';
  if (obj === null) {
    obj = undefined;
  }

  if (typeof obj === 'object') {
    return map(objectKeys(obj), function(k) {
      var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
      if (isArray(obj[k])) {
        return map(obj[k], function(v) {
          return ks + encodeURIComponent(stringifyPrimitive(v));
        }).join(sep);
      } else {
        return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
      }
    }).join(sep);

  }

  if (!name) return '';
  return encodeURIComponent(stringifyPrimitive(name)) + eq +
         encodeURIComponent(stringifyPrimitive(obj));
};

var isArray = Array.isArray || function (xs) {
  return Object.prototype.toString.call(xs) === '[object Array]';
};

function map (xs, f) {
  if (xs.map) return xs.map(f);
  var res = [];
  for (var i = 0; i < xs.length; i++) {
    res.push(f(xs[i], i));
  }
  return res;
}

var objectKeys = Object.keys || function (obj) {
  var res = [];
  for (var key in obj) {
    if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
  }
  return res;
};


/***/ }),
/* 246 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return sha256; });
/* eslint-disable */
/*!
 *  Secure Hash Algorithm (SHA256)
 *  http://www.webtoolkit.info/
 *
 *  Original code by Angel Marin, Paul Johnston.
 */

function sha256(s) {

  var chrsz = 8;

  var hexcase = 0;

  function safe_add(x, y) {

    var lsw = (x & 0xFFFF) + (y & 0xFFFF);

    var msw = (x >> 16) + (y >> 16) + (lsw >> 16);

    return msw << 16 | lsw & 0xFFFF;
  }

  function S(X, n) {
    return X >>> n | X << 32 - n;
  }

  function R(X, n) {
    return X >>> n;
  }

  function Ch(x, y, z) {
    return x & y ^ ~x & z;
  }

  function Maj(x, y, z) {
    return x & y ^ x & z ^ y & z;
  }

  function Sigma0256(x) {
    return S(x, 2) ^ S(x, 13) ^ S(x, 22);
  }

  function Sigma1256(x) {
    return S(x, 6) ^ S(x, 11) ^ S(x, 25);
  }

  function Gamma0256(x) {
    return S(x, 7) ^ S(x, 18) ^ R(x, 3);
  }

  function Gamma1256(x) {
    return S(x, 17) ^ S(x, 19) ^ R(x, 10);
  }

  function core_sha256(m, l) {

    var K = new Array(0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, 0xE49B69C1, 0xEFBE4786, 0xFC19DC6, 0x240CA1CC, 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, 0xC6E00BF3, 0xD5A79147, 0x6CA6351, 0x14292967, 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2);

    var HASH = new Array(0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19);

    var W = new Array(64);

    var a, b, c, d, e, f, g, h, i, j;

    var T1, T2;

    m[l >> 5] |= 0x80 << 24 - l % 32;

    m[(l + 64 >> 9 << 4) + 15] = l;

    for (var i = 0; i < m.length; i += 16) {

      a = HASH[0];

      b = HASH[1];

      c = HASH[2];

      d = HASH[3];

      e = HASH[4];

      f = HASH[5];

      g = HASH[6];

      h = HASH[7];

      for (var j = 0; j < 64; j++) {

        if (j < 16) W[j] = m[j + i];else W[j] = safe_add(safe_add(safe_add(Gamma1256(W[j - 2]), W[j - 7]), Gamma0256(W[j - 15])), W[j - 16]);

        T1 = safe_add(safe_add(safe_add(safe_add(h, Sigma1256(e)), Ch(e, f, g)), K[j]), W[j]);

        T2 = safe_add(Sigma0256(a), Maj(a, b, c));

        h = g;

        g = f;

        f = e;

        e = safe_add(d, T1);

        d = c;

        c = b;

        b = a;

        a = safe_add(T1, T2);
      }

      HASH[0] = safe_add(a, HASH[0]);

      HASH[1] = safe_add(b, HASH[1]);

      HASH[2] = safe_add(c, HASH[2]);

      HASH[3] = safe_add(d, HASH[3]);

      HASH[4] = safe_add(e, HASH[4]);

      HASH[5] = safe_add(f, HASH[5]);

      HASH[6] = safe_add(g, HASH[6]);

      HASH[7] = safe_add(h, HASH[7]);
    }

    return HASH;
  }

  function str2binb(str) {

    var bin = Array();

    var mask = (1 << chrsz) - 1;

    for (var i = 0; i < str.length * chrsz; i += chrsz) {

      bin[i >> 5] |= (str.charCodeAt(i / chrsz) & mask) << 24 - i % 32;
    }

    return bin;
  }

  function Utf8Encode(string) {

    string = string.replace(/\r\n/g, "\n");

    var utftext = "";

    for (var n = 0; n < string.length; n++) {

      var c = string.charCodeAt(n);

      if (c < 128) {

        utftext += String.fromCharCode(c);
      } else if (c > 127 && c < 2048) {

        utftext += String.fromCharCode(c >> 6 | 192);

        utftext += String.fromCharCode(c & 63 | 128);
      } else {

        utftext += String.fromCharCode(c >> 12 | 224);

        utftext += String.fromCharCode(c >> 6 & 63 | 128);

        utftext += String.fromCharCode(c & 63 | 128);
      }
    }

    return utftext;
  }

  function binb2hex(binarray) {

    var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";

    var str = "";

    for (var i = 0; i < binarray.length * 4; i++) {

      str += hex_tab.charAt(binarray[i >> 2] >> (3 - i % 4) * 8 + 4 & 0xF) + hex_tab.charAt(binarray[i >> 2] >> (3 - i % 4) * 8 & 0xF);
    }

    return str;
  }

  s = Utf8Encode(s);

  return binb2hex(core_sha256(str2binb(s), s.length * chrsz));
}



/***/ }),
/* 247 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return rAF; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return cAF; });
/*
 * http://paulirish.com/2011/requestanimationframe-for-smart-animating/
 * http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
 * requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
 * MIT license
 * @license
 */

/* eslint-disable standard/no-callback-literal */

var root = typeof window === 'undefined' ? global : window;
var rAF = root.requestAnimationFrame;
var cAF = root.cancelAnimationFrame;

var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for (var x = 0; x < vendors.length && !rAF; ++x) {
  rAF = root[vendors[x] + 'RequestAnimationFrame'];
  cAF = root[vendors[x] + 'CancelAnimationFrame'] || root[vendors[x] + 'CancelRequestAnimationFrame'];
}

/* Bind to root is necessary as the context must be valid */
if (rAF) {
  rAF = rAF.bind(root);
}
if (cAF) {
  cAF = cAF.bind(root);
}

/* istanbul ignore next */
if (!rAF) {
  rAF = function rAF(callback, element) {
    var currTime = new Date().getTime();
    var timeToCall = Math.max(0, 16 - (currTime - lastTime));
    var id = setTimeout(function () {
      callback(currTime + timeToCall);
    }, timeToCall);
    lastTime = currTime + timeToCall;
    return id;
  };
}

/* istanbul ignore next */
if (!cAF) {
  cAF = function cAF(id) {
    clearTimeout(id);
  };
}


/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(41)))

/***/ }),
/* 248 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */

/**
 * Represents a 3-dimensional vector while providing math functions to
 * modify / clone the vector. Fully chainable.
 * @class
 * @memberof PhotoEditorSDK.Math
 */
var Vector3 = function () {
  /**
   * Creates a Vector3
   * @param  {Number} x
   * @param  {Number} y
   * @param  {Number} z
   */
  function Vector3(x, y, z) {
    _classCallCheck(this, Vector3);

    this.x = x;
    this.y = y;
    this.z = z;

    if (typeof this.x === 'undefined') {
      this.x = 0;
    }
    if (typeof this.y === 'undefined') {
      this.y = 0;
    }
    if (typeof this.z === 'undefined') {
      this.z = 0;
    }
  }

  /**
   * Sets the given values
   * @param {Number} x
   * @param {Number} y
   * @param {Number} z
   * @return {PhotoEditorSDK.Math.Vectorz}
   */


  _createClass(Vector3, [{
    key: 'set',
    value: function set(x, y, z) {
      this.x = x;
      this.y = y;
      this.z = z;
      return this;
    }

    /**
     * Creates a clone of this vector
     * @return {PhotoEditorSDK.Math.Vector3}
     */

  }, {
    key: 'clone',
    value: function clone() {
      return new Vector3(this.x, this.y, this.z);
    }

    /**
     * Copies the values of the given vector
     * @param  {PhotoEditorSDK.Math.Vector3} other
     * @return {PhotoEditorSDK.Math.Vector3}
     */

  }, {
    key: 'copy',
    value: function copy(other) {
      this.x = other.x;
      this.y = other.y;
      this.z = other.z;
      return this;
    }

    /**
     * Clamps this vector with the given Vector3 / Number
     * @param  {(Number|PhotoEditorSDK.Math.Vector3)} minimum
     * @param  {(Number|PhotoEditorSDK.Math.Vector3)} maximum
     * @return {PhotoEditorSDK.Math.Vector3}
     */

  }, {
    key: 'clamp',
    value: function clamp(minimum, maximum) {
      var minimumSet = minimum !== null && typeof minimum !== 'undefined';
      var maximumSet = maximum !== null && typeof maximum !== 'undefined';

      /* istanbul ignore else  */
      if (!(minimum instanceof Vector3) && minimumSet) {
        minimum = new Vector3(minimum, minimum, minimum);
      }
      /* istanbul ignore else  */
      if (!(maximum instanceof Vector3) && maximumSet) {
        maximum = new Vector3(maximum, maximum, maximum);
      }

      if (minimumSet) {
        this.x = Math.max(minimum.x, this.x);
        this.y = Math.max(minimum.y, this.y);
        this.z = Math.max(minimum.z, this.z);
      }

      if (maximumSet) {
        this.x = Math.min(maximum.x, this.x);
        this.y = Math.min(maximum.y, this.y);
        this.z = Math.min(maximum.z, this.z);
      }
      return this;
    }

    /**
     * Divides this vector by the given Vector3 / Number
     * @param  {(Number|PhotoEditorSDK.Math.Vector3)} divisor
     * @return {PhotoEditorSDK.Math.Vector3}
     */

  }, {
    key: 'divide',
    value: function divide(divisor) {
      if (divisor instanceof Vector3) {
        this.x /= divisor.x;
        this.y /= divisor.y;
        this.z /= divisor.z;
      } else {
        this.x /= divisor;
        this.y /= divisor;
        this.z /= divisor;
      }
      return this;
    }

    /**
     * Subtracts the given Vector3 / Number from this vector
     * @param  {(Number|PhotoEditorSDK.Math.Vector3)} subtrahend
     * @return {PhotoEditorSDK.Math.Vector3}
     */

  }, {
    key: 'subtract',
    value: function subtract(subtrahend) {
      if (subtrahend instanceof Vector3) {
        this.x -= subtrahend.x;
        this.y -= subtrahend.y;
        this.z -= subtrahend.z;
      } else {
        this.x -= subtrahend;
        this.y -= subtrahend;
        this.z -= subtrahend;
      }
      return this;
    }

    /**
     * Multiplies the given Vector3 / Number with this vector
     * @param  {(Number|PhotoEditorSDK.Math.Vector3)} factor
     * @return {PhotoEditorSDK.Math.Vector3}
     */

  }, {
    key: 'multiply',
    value: function multiply(factor) {
      if (factor instanceof Vector3) {
        this.x *= factor.x;
        this.y *= factor.y;
        this.z *= factor.z;
      } else {
        this.x *= factor;
        this.y *= factor;
        this.z *= factor;
      }
      return this;
    }

    /**
     * Adds the given Vector3 / Numbers to this vector
     * @param {(Number|PhotoEditorSDK.Math.Vector3)} addend
     * @return {PhotoEditorSDK.Math.Vector3}
     */

  }, {
    key: 'add',
    value: function add(addend) {
      if (addend instanceof Vector3) {
        this.x += addend.x;
        this.y += addend.y;
        this.z += addend.z;
      } else {
        this.x += addend;
        this.y += addend;
        this.z += addend;
      }
      return this;
    }

    /**
     * Checks whether the x and y value are the same as the given ones
     * @param  {(Number|PhotoEditorSDK.Math.Vector3)} vec
     * @return {Boolean}
     */

  }, {
    key: 'equals',
    value: function equals(vec) {
      if (vec instanceof Vector3) {
        return vec.x === this.x && vec.y === this.y && vec.z === this.z;
      } else {
        return vec === this.x && vec === this.y && vec === this.z;
      }
    }

    /**
     * Rounds the values of this vector
     * @returns {PhotoEditorSDK.Math.Vector3}
     */

  }, {
    key: 'round',
    value: function round() {
      this.x = Math.round(this.x);
      this.y = Math.round(this.y);
      this.z = Math.round(this.z);
      return this;
    }

    /**
     * Rounds up the values of this vector
     * @returns {PhotoEditorSDK.Math.Vector3}
     */

  }, {
    key: 'ceil',
    value: function ceil() {
      this.x = Math.ceil(this.x);
      this.y = Math.ceil(this.y);
      this.z = Math.ceil(this.z);
      return this;
    }

    /**
     * Rounds down the values of this vector
     * @returns {PhotoEditorSDK.Math.Vector3}
     */

  }, {
    key: 'floor',
    value: function floor() {
      this.x = Math.floor(this.x);
      this.y = Math.floor(this.y);
      this.z = Math.floor(this.z);
      return this;
    }

    /**
     * Fractional part of  the values of this vector
     * @returns {PhotoEditorSDK.Math.Vector3}
     */

  }, {
    key: 'fract',
    value: function fract() {
      this.x = this.x % 1;
      this.y = this.y % 1;
      this.z = this.z % 1;
      return this;
    }

    /**
     * Convert the values of this vector to integer
     * @returns {PhotoEditorSDK.Math.Vector3}
     */

  }, {
    key: 'toInt',
    value: function toInt() {
      this.x = this.x | 0;
      this.y = this.y | 0;
      this.z = this.z | 0;
      return this;
    }

    /**
     * Makes both numbers of this vector positive
     * @returns {PhotoEditorSDK.Math.Vector3}
     */

  }, {
    key: 'abs',
    value: function abs() {
      this.x = Math.abs(this.x);
      this.y = Math.abs(this.y);
      this.z = Math.abs(this.z);
      return this;
    }

    /**
     * Returns the euclidean length of this vector
     * @return {Number}
     */

  }, {
    key: 'len',
    value: function len() {
      return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
    }

    /**
     * Returns the smallest number in this vector
     * @return {Number}
     */

  }, {
    key: 'min',
    value: function min() {
      return Math.min(Math.min(this.x, this.y), this.z);
    }

    /**
     * Returns the largest number in this vector
     * @return {Number}
     */

  }, {
    key: 'max',
    value: function max() {
      return Math.max(Math.max(this.x, this.y), this.z);
    }

    /**
     * Returns a POJO of this Vector3
     * @return {Object}
     */

  }, {
    key: 'toObject',
    value: function toObject() {
      return { x: this.x, y: this.y, z: this.z };
    }

    /**
     * Returns a string representation of this vector
     * @return {String}
     */

  }, {
    key: 'toString',
    value: function toString() {
      return 'Vector3({ x: ' + this.x + ', y: ' + this.y + ', z: ' + this.z + ' })';
    }

    /**
     * Rounds this vector's values to the given number of decimals
     * @param  {Number} decimals
     * @return {Number}
     */

  }, {
    key: 'roundDecimal',
    value: function roundDecimal(decimals) {
      this.x = parseFloat(this.x.toFixed(decimals));
      this.y = parseFloat(this.y.toFixed(decimals));
      this.z = parseFloat(this.z.toFixed(decimals));
      return this;
    }

    /**
     * Creates a new Vector3 instance from the given Object
     * @param  {Object} object
     * @return {PhotoEditorSDK.Math.Vector3}
     */

  }], [{
    key: 'fromObject',
    value: function fromObject(object) {
      return new Vector3(object.x, object.y, object.z);
    }

    /**
     * Returns a null vector
     * @return {PhotoEditorSDK.Math.Vector3}
     */

  }, {
    key: 'NULL',
    get: function get() {
      return new Vector3(0, 0, 0);
    }
  }]);

  return Vector3;
}();

/* harmony default export */ __webpack_exports__["a"] = (Vector3);

/***/ }),
/* 249 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__globals__ = __webpack_require__(40);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__shared_vendor_promise__ = __webpack_require__(32);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__lib_math_vector2__ = __webpack_require__(42);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__operation__ = __webpack_require__(139);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */





var OptionType = __WEBPACK_IMPORTED_MODULE_4__globals__["Constants"].OptionType;

/**
 * An operation that can rotate and flip an image depending on the given EXIF information
 * @class
 * @extends PhotoEditorSDK.Operation
 * @memberof PhotoEditorSDK.Operations
 */

var ExifOrientationOperation = function (_Operation) {
  _inherits(ExifOrientationOperation, _Operation);

  function ExifOrientationOperation() {
    _classCallCheck(this, ExifOrientationOperation);

    return _possibleConstructorReturn(this, (ExifOrientationOperation.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(ExifOrientationOperation)).apply(this, arguments));
  }

  _createClass(ExifOrientationOperation, [{
    key: '_getRotation',

    /**
     * Returns the rotation
     * @return {Number}
     * @private
     */
    value: function _getRotation() {
      var degrees = 0;
      switch (this.getTags().Orientation) {
        case 7:
        case 8:
          degrees = -90;
          break;
        case 3:
        case 4:
          degrees = -180;
          break;
        case 5:
        case 6:
          degrees = 90;
          break;
      }
      return degrees;
    }

    /**
     * Checks if the image needs to be flipped vertically
     * @return {Boolean}
     * @private
     */

  }, {
    key: '_getFlipVertically',
    value: function _getFlipVertically() {
      var _getTags = this.getTags(),
          Orientation = _getTags.Orientation;

      return [5, 7].indexOf(Orientation) !== -1;
    }

    /**
     * Checks if the image needs to be flipped horizontally
     * @return {Boolean}
     * @private
     */

  }, {
    key: '_getFlipHorizontally',
    value: function _getFlipHorizontally() {
      var _getTags2 = this.getTags(),
          Orientation = _getTags2.Orientation;

      return [2, 4].indexOf(Orientation) !== -1;
    }

    /**
     * Returns the options based on the EXIF orientation
     * @return {Object}
     * @private
     */

  }, {
    key: '_getFinalOptions',
    value: function _getFinalOptions() {
      return {
        rotation: this._getRotation(),
        flipVertically: this._getFlipVertically(),
        flipHorizontally: this._getFlipHorizontally()
      };
    }

    /**
     * Rotates and/or flips the image
     * @param  {PhotoEditorSDK} sdk
     * @returns {Promise}
     * @override
     * @private
     */

  }, {
    key: '_render',
    value: function _render(sdk) {
      var options = this._getFinalOptions();
      var actualDegrees = options.rotation % 360;
      var radians = actualDegrees * (Math.PI / 180);

      this._sprite.setScale(options.flipHorizontally ? -1 : 1, options.flipVertically ? -1 : 1);
      this._sprite.setRotation(radians);
      this._sprite.setAnchor(0.5, 0.5);
      this._sprite.updateTransform();

      var bounds = this._sprite.getBounds();
      this._renderTexture.resizeTo(new __WEBPACK_IMPORTED_MODULE_6__lib_math_vector2__["a" /* default */](bounds.width, bounds.height));

      // Make sure we're rendering to top left corner
      this._sprite.setPosition(this._renderTexture.getDimensions().divide(2));

      // Draw
      this._renderTexture.render(this._container);

      return __WEBPACK_IMPORTED_MODULE_5__shared_vendor_promise__["a" /* default */].resolve();
    }

    /**
     * Returns the dimensions the given dimensions will have after this operation
     * has been applied
     * @param {PhotoEditorSDK.Math.Vector2} dimensions
     * @return {PhotoEditorSDK.Math.Vector2}
     * @override
     */

  }, {
    key: 'getNewDimensions',
    value: function getNewDimensions(dimensions) {
      var options = this._getFinalOptions();
      dimensions = dimensions.clone();
      if (options.rotation % 180) {
        dimensions.flip();
      }
      return dimensions;
    }
  }]);

  return ExifOrientationOperation;
}(__WEBPACK_IMPORTED_MODULE_7__operation__["a" /* default */]);

/**
 * A unique string that identifies this operation. Can be used to select
 * operations.
 * @type {String}
 * @default
 */


ExifOrientationOperation.identifier = 'exif-orientation';

/**
 * Specifies the available options for this operation
 * @type {Object}
 * @ignore
 */
ExifOrientationOperation.prototype.availableOptions = {
  tags: { type: OptionType.OBJECT, default: {} }
};

/* harmony default export */ __webpack_exports__["a"] = (ExifOrientationOperation);

/***/ }),
/* 250 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__globals__ = __webpack_require__(40);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



var VERSION_CHECK_FN = 'imglySDKVersionCallback';
var VERSION_CHECK_URL = 'https://www.photoeditorsdk.com/version.json?sdk=html5&jsoncallback=' + VERSION_CHECK_FN;

/**
 * Checks whether there is a new version of the SDK available
 * @class
 * @memberof PhotoEditorSDK
 * @ignore
 */
/* istanbul ignore next */

var VersionChecker = function () {
  /**
   * Creates a new VersionChecker
   * @param  {String} version
   */
  function VersionChecker(version) {
    _classCallCheck(this, VersionChecker);

    this._version = version;
    this._check();
  }

  /**
   * Checks if this version of the SDK is outdated
   * @private
   */


  _createClass(VersionChecker, [{
    key: '_check',
    value: function _check() {
      var _this = this;

      if (typeof document === 'undefined') {
        return __WEBPACK_IMPORTED_MODULE_1__globals__["Log"].info(this.constructor.name, 'Not in browser environment. Version check skipped.');
      }

      var self = this;
      window[VERSION_CHECK_FN] = function (response) {
        if (response.outdated) {
          __WEBPACK_IMPORTED_MODULE_1__globals__["Log"].warn(_this.constructor.name, 'Your Version ' + self._version + ' is outdated. Current version is ' + response.version + '.');
        }
      };

      var script = document.createElement('script');
      script.src = VERSION_CHECK_URL + '&version=' + this._version;
      script.async = true;
      document.getElementsByTagName('head')[0].appendChild(script);
    }
  }]);

  return VersionChecker;
}();

/* harmony default export */ __webpack_exports__["a"] = (VersionChecker);

/***/ }),
/* 251 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__array_stream__ = __webpack_require__(101);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constants__ = __webpack_require__(102);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var MARKERS = __WEBPACK_IMPORTED_MODULE_2__constants__["a" /* default */].MARKERS;

/**
 * JFIFData provides access to the JFIF Information inside the JPEG Header
 * @class
 * @memberof PhotoEditorSDK
 * @ignore
 */

var JFIFData = function () {
  /**
   * Creates an JFIFData instance
   * @param {Uint8Array} buf
   */
  function JFIFData(buf) {
    _classCallCheck(this, JFIFData);

    this._buf = buf;
    this._stream = new __WEBPACK_IMPORTED_MODULE_1__array_stream__["a" /* default */](this._buf);
    this._stream.setHead(0);
  }

  /**
   * Check if buf contains valid JFIF Segment
   * @returns {Boolean}
   */


  _createClass(JFIFData, [{
    key: 'isValid',
    value: function isValid() {
      this._stream.setHead(0);
      var marker = this._stream.readInt16();
      if (marker !== MARKERS.APP0) {
        return false;
      }
      // Skip length
      var length = this._stream.readInt16();
      if (!(length >= 16)) {
        return false;
      }
      var fileIdentifier = this._stream.readString(4);
      var fileIdentifierEndMarker = this._stream.readInt8();
      if (!(fileIdentifier === 'JFIF')) {
        return false;
      }
      if (!(fileIdentifierEndMarker === 0x00)) {
        return false;
      }
      return true;
    }

    /**
     * Set the unit density. Valid params are 0..
     * @param {Number} val
     */

  }, {
    key: 'setUnitDensity',
    value: function setUnitDensity(val) {
      this._stream.setHead(11);
      this._stream.writeInt8(val);
    }

    /**
     * Set the density x value
     * @param {Number} val
     */

  }, {
    key: 'setDensityX',
    value: function setDensityX(val) {
      this._stream.setHead(12);
      this._stream.writeInt16(val);
    }

    /**
     * Set the density y value
     * @param {Number} val
     */

  }, {
    key: 'setDensityY',
    value: function setDensityY(val) {
      this._stream.setHead(13);
      this._stream.writeInt16(val);
    }

    /**
     * Returns the xDensity
     * @returns {Number}
     */

  }, {
    key: 'getUnitDensity',
    value: function getUnitDensity() {
      this._stream.setHead(11);
      return this._stream.readInt8();
    }

    /**
     * Returns the xDensity
     * @returns {Number}
     */

  }, {
    key: 'getDensityX',
    value: function getDensityX() {
      this._stream.setHead(12);
      return this._stream.readInt16();
    }

    /**
     * Returns the y notDensity
     * @returns {Number}
     */

  }, {
    key: 'getDensityY',
    value: function getDensityY() {
      this._stream.setHead(14);
      return this._stream.readInt16();
    }
  }]);

  return JFIFData;
}();

/* harmony default export */ __webpack_exports__["a"] = (JFIFData);

/***/ }),
/* 252 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__array_stream__ = __webpack_require__(101);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constants__ = __webpack_require__(102);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils__ = __webpack_require__(22);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */





var invariant = __WEBPACK_IMPORTED_MODULE_3__utils__["a" /* default */].invariant;
var MARKERS = __WEBPACK_IMPORTED_MODULE_2__constants__["a" /* default */].MARKERS,
    EXIF_TAGS = __WEBPACK_IMPORTED_MODULE_2__constants__["a" /* default */].EXIF_TAGS;

/**
 * EXIFData provides access to the Exif Information inside the JPEG Header
 * @class
 * @memberof PhotoEditorSDK
 * @ignore
 */

var EXIFData = function () {
  /**
   * Creates an ExifData instance
   * @param {Uint8Array} buf
   */
  function EXIFData(buf) {
    _classCallCheck(this, EXIFData);

    this._buf = buf;
    this._stream = new __WEBPACK_IMPORTED_MODULE_1__array_stream__["a" /* default */](this._buf);
    this._stream.setHead(0);
    this._parse();
  }

  /**
   * Check if buf contains valid EXIF Segment
   * @returns {Boolean}
   */


  _createClass(EXIFData, [{
    key: 'isValid',
    value: function isValid() {
      this._stream.setHead(0);
      // Skip marker
      var marker = this._stream.readInt16();
      if (marker !== MARKERS.EXIF) {
        return false;
      }
      // Skip length
      var length = this._stream.readInt16();
      if (!(length > 0)) {
        return false;
      }
      var header = this._stream.readString(4);
      if (header !== 'Exif') {
        return false;
      }
      return true;
    }
    /**
     * Parses the exif tags
     * @return {Object}
     * @private
     */

  }, {
    key: '_parse',
    value: function _parse() {
      if (!this.isValid()) {
        return;
      }

      this._stream.setHead(10);
      var tiffOffset = this._stream.getHead();

      // Find endian type
      var bigEndian = false;
      var endian = this._stream.readInt16();
      if (endian === 0x4949) {
        bigEndian = false;
      } else if (endian === 0x4d4d) {
        bigEndian = true;
      } else {
        invariant(false, 'Invalid TIFF data: No endian type found');
      }

      invariant(this._stream.readInt16(!bigEndian) === 0x002A, 'Invalid TIFF data: No 0x002A');

      var firstIFDOffset = this._stream.readInt32(!bigEndian);
      invariant(firstIFDOffset >= 8, 'Invalid TIFF data: First IFD offset < 8');

      var ifdOffset = tiffOffset + firstIFDOffset;
      var tags = this._readTags(this._stream, tiffOffset, ifdOffset, bigEndian);
      this._tags = tags.tags;
      this._tagData = tags.tagData;
    }

    /**
     * Returns the tags
     * @return {Object}
     */

  }, {
    key: 'getTags',
    value: function getTags() {
      return this._tags;
    }

    /**
     * Returns the tag data (key, value, byte position etc.)
     * @return {Object[]}
     */

  }, {
    key: 'getTagData',
    value: function getTagData() {
      return this._tagData;
    }
  }, {
    key: 'setOrientation',
    value: function setOrientation(orientation) {
      if (this._tagData.Orientation) {
        var entryOffset = this._tagData.Orientation.entryOffset;
        // Replace value in buffer

        this._stream.setHead(entryOffset + 8);
        this._stream.writeInt16(orientation);
      }
    }

    /**
     * Reads the TIFF tags from the stream
     * @param  {ArrayBuffer} stream
     * @param  {Number} tiffStart The position where tiff data starts
     * @param  {Number} ifdStart  The position where the IFD starts
     * @param  {Boolean} bigEndian
     * @return {Object}
     * @private
     */

  }, {
    key: '_readTags',
    value: function _readTags(stream, tiffStart, ifdStart, bigEndian) {
      stream.setHead(ifdStart);
      var entriesCount = stream.readInt16(!bigEndian);
      var tags = {};
      var tagData = [];

      for (var i = 0; i < entriesCount; i++) {
        var entryOffset = ifdStart + i * 12 + 2;
        stream.setHead(entryOffset);
        var tag = stream.readInt16(!bigEndian);
        var type = void 0;
        var numValues = void 0;
        var valueOffset = void 0;
        if (EXIF_TAGS[tag]) {
          tag = EXIF_TAGS[tag];
          type = stream.readInt16(!bigEndian);
          numValues = stream.readInt32(!bigEndian);
          valueOffset = stream.readInt32(!bigEndian) + tiffStart;
          var value = null;

          switch (type) {
            case 1: // byte, 8-bit unsigned int
            case 7:
              // undefined, 8-bit byte, value depending on field
              if (numValues === 1) {
                value = stream.readInt8(!bigEndian);
              } else {
                value = [];
                for (var _i = 0; _i < numValues; _i++) {
                  value.push(stream.readInt8(!bigEndian));
                }
              }
              break;
            case 2:
              // 8-bit ascii char
              stream.setHead(numValues > 4 ? valueOffset : entryOffset + 8);
              value = stream.readString(numValues);
              break;
            case 3:
              // short
              stream.setHead(numValues > 2 ? valueOffset : entryOffset + 8);
              if (numValues === 1) {
                value = stream.readInt16(!bigEndian);
              } else {
                value = [];
                for (var _i2 = 0; _i2 < numValues; _i2++) {
                  value.push(stream.readInt16(!bigEndian));
                }
              }
              break;
            case 4: // long
            case 9:
              // slong
              stream.setHead(numValues > 1 ? valueOffset : entryOffset + 8);
              if (numValues === 1) {
                value = stream.readInt32(!bigEndian);
              } else {
                value = [];
                for (var _i3 = 0; _i3 < numValues; _i3++) {
                  value.push(stream.readInt32(!bigEndian));
                }
              }
              break;
            case 5: // rational (two long values, first numerator, second denominator)
            case 10:
              // rational (two slongs)
              stream.setHead(valueOffset);
              if (numValues === 1) {
                var numerator = stream.readInt32(!bigEndian);
                var denominator = stream.readInt32(!bigEndian);
                value = numerator / denominator;
              } else {
                value = [];
                for (var _i4 = 0; _i4 < numValues; _i4++) {
                  var _numerator = stream.readInt32(!bigEndian);
                  var _denominator = stream.readInt32(!bigEndian);
                  var val = _numerator / _denominator;
                  value.push(val);
                }
              }
              break;
          }

          tags[tag] = value;
          tagData[tag] = {
            value: value,
            numValues: numValues,
            entryOffset: entryOffset,
            valueOffset: valueOffset,
            type: type
          };
        }
      }

      return { tags: tags, tagData: tagData };
    }

    /**
     * Returns internal buffer
     * @returns {Uint8Array}
     */

  }, {
    key: 'getBuffer',
    value: function getBuffer() {
      return this._buf;
    }
  }]);

  return EXIFData;
}();

/* harmony default export */ __webpack_exports__["a"] = (EXIFData);

/***/ }),
/* 253 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(Buffer) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_promise__ = __webpack_require__(29);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_promise___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_promise__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__constants__ = __webpack_require__(31);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__engine__ = __webpack_require__(68);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils__ = __webpack_require__(22);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__image__ = __webpack_require__(74);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__exif__ = __webpack_require__(100);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__configurable__ = __webpack_require__(55);






var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */








/**
 * @class
 * @alias PhotoEditorSDK.ImageExporter
 * @private
 */

var ImageExporter = function (_Configurable) {
  _inherits(ImageExporter, _Configurable);

  function ImageExporter(sdk) {
    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

    _classCallCheck(this, ImageExporter);

    var _this = _possibleConstructorReturn(this, (ImageExporter.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(ImageExporter)).call(this, options));

    _this._sdk = sdk;
    return _this;
  }

  /**
   * Exports the image from the given canvas with the given options
   * @return {Promise}
   */


  _createClass(ImageExporter, [{
    key: 'export',
    value: function _export() {
      var _this2 = this;

      var renderer = this._sdk.getRenderer();
      var _options = this._options,
          renderType = _options.renderType,
          imageFormat = _options.imageFormat,
          quality = _options.quality;


      return this.validateSettings().then(function () {
        return _this2._prepareSDK();
      }).then(function (texture) {
        var canvas = renderer.getCanvas();
        if (renderer.isOfType(__WEBPACK_IMPORTED_MODULE_5__constants__["RendererType"].WEBGL)) {
          canvas = _this2._createCanvasFromTexture(texture);
        }

        var result = void 0;
        if (renderType === __WEBPACK_IMPORTED_MODULE_5__constants__["RenderType"].IMAGE || renderType === __WEBPACK_IMPORTED_MODULE_5__constants__["RenderType"].DATAURL) {
          if (typeof window === 'undefined') {
            // Quality not supported in node environment / node-canvas
            result = canvas.toDataURL(imageFormat);
          } else {
            result = canvas.toDataURL(imageFormat, quality);
          }

          // When image's `src` attribute is a jpeg data url, we can restore
          // the exif information
          var image = _this2._sdk.getImage();
          var imageIsJPEG = __WEBPACK_IMPORTED_MODULE_9__exif__["a" /* default */].isJPEG(image.src);
          var resultIsJPEG = __WEBPACK_IMPORTED_MODULE_9__exif__["a" /* default */].isJPEG(result);
          if (imageIsJPEG && resultIsJPEG) {
            var exif = _this2._sdk.getExif(); // This is basically the JPEG Header
            if (exif) {
              result = exif.restoreSegments(result);
            }
          }
        }

        if (renderType === __WEBPACK_IMPORTED_MODULE_5__constants__["RenderType"].IMAGE) {
          var outputImage = void 0;
          outputImage = new __WEBPACK_IMPORTED_MODULE_8__image__["a" /* default */]();
          outputImage.src = result;
          return outputImage;
        } else if (renderType === __WEBPACK_IMPORTED_MODULE_5__constants__["RenderType"].DATAURL) {
          return result;
        } else if (renderType === __WEBPACK_IMPORTED_MODULE_5__constants__["RenderType"].BUFFER) {
          // https://github.com/Automattic/node-canvas#canvastobuffer
          switch (imageFormat) {
            case __WEBPACK_IMPORTED_MODULE_5__constants__["ImageFormat"].JPEG:
              {
                var promise = new __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_promise___default.a(function (resolve, reject) {
                  var stream = canvas.createJPEGStream({ bufsize: 2048, quality: quality * 100 | 0 });
                  var chunks = [];
                  stream.on('data', function (chunk) {
                    return chunks.push(chunk);
                  });
                  stream.on('end', function () {
                    return resolve(Buffer.concat(chunks));
                  });
                });
                return promise;
              }
            case __WEBPACK_IMPORTED_MODULE_5__constants__["ImageFormat"].PNG:
              {
                return __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_promise___default.a.resolve(canvas.toBuffer());
              }
            default:
              {
                return __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_promise___default.a.reject(new Error('Invalid ImageFormat: ' + imageFormat));
              }
          }
        } else if (renderType === __WEBPACK_IMPORTED_MODULE_5__constants__["RenderType"].MSBLOB) {
          return canvas.msToBlob();
        } else if (renderType === __WEBPACK_IMPORTED_MODULE_5__constants__["RenderType"].BLOB) {
          return new __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_promise___default.a(function (resolve, reject) {
            canvas.toBlob(function (blob) {
              resolve(blob);
            }, imageFormat, quality);
          });
        }
      }).then(function (result) {
        return _this2._restoreSDK().then(function () {
          return result;
        });
      });
    }

    /**
     * Prepares the SDK for exporting
     * @private
     */

  }, {
    key: '_prepareSDK',
    value: function _prepareSDK() {
      var renderer = this._sdk.getRenderer();

      this._sdkSettings = {
        dimensions: renderer.getDimensions().clone(),
        textureQuality: this._sdk.getTextureQuality(),
        pixelRatio: this._sdk.getPixelRatio(),
        renderMode: this._sdk.getRenderMode()
      };

      this._sdk.setRenderMode('export');
      this._sdk.setTextureQuality(1);

      var resizeCanvas = renderer.isOfType(__WEBPACK_IMPORTED_MODULE_5__constants__["RendererType"].CANVAS);
      renderer.setPixelRatio(1);
      renderer.resizeTo(this._sdk.getFinalDimensions(), resizeCanvas);

      this._sdk.setAllOperationsToDirty(true);

      var stack = this._sdk.getOperationsStack();
      stack.forEach(function (operation) {
        operation.disposeRenderTextures();
      });
      stack.disableCache();

      return this._sdk.render();
    }

    /**
     * Restores the previous SDK options
     * @private
     */

  }, {
    key: '_restoreSDK',
    value: function _restoreSDK() {
      var stack = this._sdk.getOperationsStack();
      stack.enableCache();

      this._sdk.setRenderMode(this._sdkSettings.renderMode);
      var renderer = this._sdk.getRenderer();

      var resizeCanvas = renderer.isOfType(__WEBPACK_IMPORTED_MODULE_5__constants__["RendererType"].CANVAS);
      renderer.setPixelRatio(this._sdkSettings.pixelRatio);
      renderer.resizeTo(this._sdkSettings.dimensions, resizeCanvas);

      this._sdk.setTextureQuality(this._sdkSettings.textureQuality);
      this._sdk.setAllOperationsToDirty(true);
      return this._sdk.render();
    }

    /**
     * Creates a canvas from the given Texture by attaching it to an FBO and using
     * gl.readPixels() to read the pixels. It then writes the pixel data to a new
     * 2D (not hardware-accelerated) canvas and calls .toDataURL() on it.
     * @param  {PhotoEditorSDK.Engine.Texture} texture
     * @return {HTMLCanvasElement}
     * @private
     */

  }, {
    key: '_createCanvasFromTexture',
    value: function _createCanvasFromTexture(texture) {
      var renderer = this._sdk.getRenderer();
      var finalDimensions = this._sdk.getFinalDimensions();

      var gl = this._sdk.getRenderer().getContext();

      // Create temporary framebuffer
      var fbo = gl.createFramebuffer();
      gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);

      // Attach output texture to FBO
      var glTexture = texture.getBaseTexture().getGLTextureForRenderer(renderer);
      gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, glTexture, 0);

      // Read pixels from FBO
      var pixels = new Uint8Array(finalDimensions.x * finalDimensions.y * 4);
      gl.readPixels(0, 0, finalDimensions.x, finalDimensions.y, gl.RGBA, gl.UNSIGNED_BYTE, pixels);

      // Check if we have any semi-transparent pixels
      var hasTransparency = this._checkPixelsForTransparency(pixels);

      var renderTexture = void 0;
      if (hasTransparency) {
        // Since our textures have premultiplied RGB values, we need to un-premultiply the
        // values before reading them from the texture and passing them to a canvas
        var sprite = new __WEBPACK_IMPORTED_MODULE_6__engine__["a" /* default */].Sprite(texture);
        sprite.setFilters([new __WEBPACK_IMPORTED_MODULE_6__engine__["a" /* default */].Filters.UnpremultiplyFilter()]);
        var container = new __WEBPACK_IMPORTED_MODULE_6__engine__["a" /* default */].Container();
        container.addChild(sprite);
        renderTexture = new __WEBPACK_IMPORTED_MODULE_6__engine__["a" /* default */].RenderTexture(renderer, finalDimensions.x, finalDimensions.y);
        renderTexture.render(container);

        // Attach the new texture
        var _glTexture = renderTexture.getBaseTexture().getGLTextureForRenderer(renderer);
        gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, _glTexture, 0);

        // Read pixels from FBO
        gl.readPixels(0, 0, finalDimensions.x, finalDimensions.y, gl.RGBA, gl.UNSIGNED_BYTE, pixels);

        // Switch back to default render target, dispose the texture
        renderer.setRenderTarget();
        renderTexture.dispose();
      }

      // Create canvas with dimensions of output texture
      var canvas = __WEBPACK_IMPORTED_MODULE_7__utils__["a" /* default */].createCanvas();
      canvas.width = finalDimensions.x;
      canvas.height = finalDimensions.y;

      // Copy pixel data over
      var context = canvas.getContext('2d');
      var imageData = context.createImageData(finalDimensions.x, finalDimensions.y);

      imageData.data.set(pixels);

      // Render to canvas
      context.putImageData(imageData, 0, 0);

      // Delete FBO
      gl.deleteFramebuffer(fbo);

      return canvas;
    }

    /**
     * Checks if any of the given RGBA pixels has transparency
     * @param  {Uint8Array} pixels
     * @return {Boolean}
     */

  }, {
    key: '_checkPixelsForTransparency',
    value: function _checkPixelsForTransparency(pixels) {
      var finalDimensions = this._sdk.getFinalDimensions();
      var maxIndex = finalDimensions.x * finalDimensions.y * 4;
      var value = void 0;
      for (var i = 3; i < maxIndex; i += 4) {
        value = pixels[i];
        if (value !== 255) {
          return true;
        }
      }
      return false;
    }
  }]);

  return ImageExporter;
}(__WEBPACK_IMPORTED_MODULE_10__configurable__["a" /* default */]);

ImageExporter.prototype.availableOptions = {
  renderType: { type: __WEBPACK_IMPORTED_MODULE_5__constants__["OptionType"].STRING, available: __WEBPACK_IMPORTED_MODULE_7__utils__["a" /* default */].values(__WEBPACK_IMPORTED_MODULE_5__constants__["RenderType"]), default: __WEBPACK_IMPORTED_MODULE_5__constants__["RenderType"].IMAGE },
  imageFormat: { type: __WEBPACK_IMPORTED_MODULE_5__constants__["OptionType"].STRING, available: __WEBPACK_IMPORTED_MODULE_7__utils__["a" /* default */].values(__WEBPACK_IMPORTED_MODULE_5__constants__["ImageFormat"]), default: __WEBPACK_IMPORTED_MODULE_5__constants__["ImageFormat"].PNG },
  quality: { type: __WEBPACK_IMPORTED_MODULE_5__constants__["OptionType"].NUMBER, default: 0.8 }
};

/* harmony default export */ __webpack_exports__["a"] = (ImageExporter);
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(254).Buffer))

/***/ }),
/* 254 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
/* WEBPACK VAR INJECTION */(function(global) {/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
 * @license  MIT
 */
/* eslint-disable no-proto */



var base64 = __webpack_require__(255)
var ieee754 = __webpack_require__(256)
var isArray = __webpack_require__(257)

exports.Buffer = Buffer
exports.SlowBuffer = SlowBuffer
exports.INSPECT_MAX_BYTES = 50

/**
 * If `Buffer.TYPED_ARRAY_SUPPORT`:
 *   === true    Use Uint8Array implementation (fastest)
 *   === false   Use Object implementation (most compatible, even IE6)
 *
 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
 * Opera 11.6+, iOS 4.2+.
 *
 * Due to various browser bugs, sometimes the Object implementation will be used even
 * when the browser supports typed arrays.
 *
 * Note:
 *
 *   - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
 *     See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
 *
 *   - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
 *
 *   - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
 *     incorrect length in some situations.

 * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
 * get the Object implementation, which is slower but behaves correctly.
 */
Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  ? global.TYPED_ARRAY_SUPPORT
  : typedArraySupport()

/*
 * Export kMaxLength after typed array support is determined.
 */
exports.kMaxLength = kMaxLength()

function typedArraySupport () {
  try {
    var arr = new Uint8Array(1)
    arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
    return arr.foo() === 42 && // typed array instances can be augmented
        typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
        arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  } catch (e) {
    return false
  }
}

function kMaxLength () {
  return Buffer.TYPED_ARRAY_SUPPORT
    ? 0x7fffffff
    : 0x3fffffff
}

function createBuffer (that, length) {
  if (kMaxLength() < length) {
    throw new RangeError('Invalid typed array length')
  }
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    // Return an augmented `Uint8Array` instance, for best performance
    that = new Uint8Array(length)
    that.__proto__ = Buffer.prototype
  } else {
    // Fallback: Return an object instance of the Buffer class
    if (that === null) {
      that = new Buffer(length)
    }
    that.length = length
  }

  return that
}

/**
 * The Buffer constructor returns instances of `Uint8Array` that have their
 * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
 * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
 * and the `Uint8Array` methods. Square bracket notation works as expected -- it
 * returns a single octet.
 *
 * The `Uint8Array` prototype remains unmodified.
 */

function Buffer (arg, encodingOrOffset, length) {
  if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
    return new Buffer(arg, encodingOrOffset, length)
  }

  // Common case.
  if (typeof arg === 'number') {
    if (typeof encodingOrOffset === 'string') {
      throw new Error(
        'If encoding is specified then the first argument must be a string'
      )
    }
    return allocUnsafe(this, arg)
  }
  return from(this, arg, encodingOrOffset, length)
}

Buffer.poolSize = 8192 // not used by this implementation

// TODO: Legacy, not needed anymore. Remove in next major version.
Buffer._augment = function (arr) {
  arr.__proto__ = Buffer.prototype
  return arr
}

function from (that, value, encodingOrOffset, length) {
  if (typeof value === 'number') {
    throw new TypeError('"value" argument must not be a number')
  }

  if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
    return fromArrayBuffer(that, value, encodingOrOffset, length)
  }

  if (typeof value === 'string') {
    return fromString(that, value, encodingOrOffset)
  }

  return fromObject(that, value)
}

/**
 * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
 * if value is a number.
 * Buffer.from(str[, encoding])
 * Buffer.from(array)
 * Buffer.from(buffer)
 * Buffer.from(arrayBuffer[, byteOffset[, length]])
 **/
Buffer.from = function (value, encodingOrOffset, length) {
  return from(null, value, encodingOrOffset, length)
}

if (Buffer.TYPED_ARRAY_SUPPORT) {
  Buffer.prototype.__proto__ = Uint8Array.prototype
  Buffer.__proto__ = Uint8Array
  if (typeof Symbol !== 'undefined' && Symbol.species &&
      Buffer[Symbol.species] === Buffer) {
    // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
    Object.defineProperty(Buffer, Symbol.species, {
      value: null,
      configurable: true
    })
  }
}

function assertSize (size) {
  if (typeof size !== 'number') {
    throw new TypeError('"size" argument must be a number')
  } else if (size < 0) {
    throw new RangeError('"size" argument must not be negative')
  }
}

function alloc (that, size, fill, encoding) {
  assertSize(size)
  if (size <= 0) {
    return createBuffer(that, size)
  }
  if (fill !== undefined) {
    // Only pay attention to encoding if it's a string. This
    // prevents accidentally sending in a number that would
    // be interpretted as a start offset.
    return typeof encoding === 'string'
      ? createBuffer(that, size).fill(fill, encoding)
      : createBuffer(that, size).fill(fill)
  }
  return createBuffer(that, size)
}

/**
 * Creates a new filled Buffer instance.
 * alloc(size[, fill[, encoding]])
 **/
Buffer.alloc = function (size, fill, encoding) {
  return alloc(null, size, fill, encoding)
}

function allocUnsafe (that, size) {
  assertSize(size)
  that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  if (!Buffer.TYPED_ARRAY_SUPPORT) {
    for (var i = 0; i < size; ++i) {
      that[i] = 0
    }
  }
  return that
}

/**
 * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
 * */
Buffer.allocUnsafe = function (size) {
  return allocUnsafe(null, size)
}
/**
 * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
 */
Buffer.allocUnsafeSlow = function (size) {
  return allocUnsafe(null, size)
}

function fromString (that, string, encoding) {
  if (typeof encoding !== 'string' || encoding === '') {
    encoding = 'utf8'
  }

  if (!Buffer.isEncoding(encoding)) {
    throw new TypeError('"encoding" must be a valid string encoding')
  }

  var length = byteLength(string, encoding) | 0
  that = createBuffer(that, length)

  var actual = that.write(string, encoding)

  if (actual !== length) {
    // Writing a hex string, for example, that contains invalid characters will
    // cause everything after the first invalid character to be ignored. (e.g.
    // 'abxxcd' will be treated as 'ab')
    that = that.slice(0, actual)
  }

  return that
}

function fromArrayLike (that, array) {
  var length = array.length < 0 ? 0 : checked(array.length) | 0
  that = createBuffer(that, length)
  for (var i = 0; i < length; i += 1) {
    that[i] = array[i] & 255
  }
  return that
}

function fromArrayBuffer (that, array, byteOffset, length) {
  array.byteLength // this throws if `array` is not a valid ArrayBuffer

  if (byteOffset < 0 || array.byteLength < byteOffset) {
    throw new RangeError('\'offset\' is out of bounds')
  }

  if (array.byteLength < byteOffset + (length || 0)) {
    throw new RangeError('\'length\' is out of bounds')
  }

  if (byteOffset === undefined && length === undefined) {
    array = new Uint8Array(array)
  } else if (length === undefined) {
    array = new Uint8Array(array, byteOffset)
  } else {
    array = new Uint8Array(array, byteOffset, length)
  }

  if (Buffer.TYPED_ARRAY_SUPPORT) {
    // Return an augmented `Uint8Array` instance, for best performance
    that = array
    that.__proto__ = Buffer.prototype
  } else {
    // Fallback: Return an object instance of the Buffer class
    that = fromArrayLike(that, array)
  }
  return that
}

function fromObject (that, obj) {
  if (Buffer.isBuffer(obj)) {
    var len = checked(obj.length) | 0
    that = createBuffer(that, len)

    if (that.length === 0) {
      return that
    }

    obj.copy(that, 0, 0, len)
    return that
  }

  if (obj) {
    if ((typeof ArrayBuffer !== 'undefined' &&
        obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
      if (typeof obj.length !== 'number' || isnan(obj.length)) {
        return createBuffer(that, 0)
      }
      return fromArrayLike(that, obj)
    }

    if (obj.type === 'Buffer' && isArray(obj.data)) {
      return fromArrayLike(that, obj.data)
    }
  }

  throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
}

function checked (length) {
  // Note: cannot use `length < kMaxLength()` here because that fails when
  // length is NaN (which is otherwise coerced to zero.)
  if (length >= kMaxLength()) {
    throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
                         'size: 0x' + kMaxLength().toString(16) + ' bytes')
  }
  return length | 0
}

function SlowBuffer (length) {
  if (+length != length) { // eslint-disable-line eqeqeq
    length = 0
  }
  return Buffer.alloc(+length)
}

Buffer.isBuffer = function isBuffer (b) {
  return !!(b != null && b._isBuffer)
}

Buffer.compare = function compare (a, b) {
  if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
    throw new TypeError('Arguments must be Buffers')
  }

  if (a === b) return 0

  var x = a.length
  var y = b.length

  for (var i = 0, len = Math.min(x, y); i < len; ++i) {
    if (a[i] !== b[i]) {
      x = a[i]
      y = b[i]
      break
    }
  }

  if (x < y) return -1
  if (y < x) return 1
  return 0
}

Buffer.isEncoding = function isEncoding (encoding) {
  switch (String(encoding).toLowerCase()) {
    case 'hex':
    case 'utf8':
    case 'utf-8':
    case 'ascii':
    case 'latin1':
    case 'binary':
    case 'base64':
    case 'ucs2':
    case 'ucs-2':
    case 'utf16le':
    case 'utf-16le':
      return true
    default:
      return false
  }
}

Buffer.concat = function concat (list, length) {
  if (!isArray(list)) {
    throw new TypeError('"list" argument must be an Array of Buffers')
  }

  if (list.length === 0) {
    return Buffer.alloc(0)
  }

  var i
  if (length === undefined) {
    length = 0
    for (i = 0; i < list.length; ++i) {
      length += list[i].length
    }
  }

  var buffer = Buffer.allocUnsafe(length)
  var pos = 0
  for (i = 0; i < list.length; ++i) {
    var buf = list[i]
    if (!Buffer.isBuffer(buf)) {
      throw new TypeError('"list" argument must be an Array of Buffers')
    }
    buf.copy(buffer, pos)
    pos += buf.length
  }
  return buffer
}

function byteLength (string, encoding) {
  if (Buffer.isBuffer(string)) {
    return string.length
  }
  if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
      (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
    return string.byteLength
  }
  if (typeof string !== 'string') {
    string = '' + string
  }

  var len = string.length
  if (len === 0) return 0

  // Use a for loop to avoid recursion
  var loweredCase = false
  for (;;) {
    switch (encoding) {
      case 'ascii':
      case 'latin1':
      case 'binary':
        return len
      case 'utf8':
      case 'utf-8':
      case undefined:
        return utf8ToBytes(string).length
      case 'ucs2':
      case 'ucs-2':
      case 'utf16le':
      case 'utf-16le':
        return len * 2
      case 'hex':
        return len >>> 1
      case 'base64':
        return base64ToBytes(string).length
      default:
        if (loweredCase) return utf8ToBytes(string).length // assume utf8
        encoding = ('' + encoding).toLowerCase()
        loweredCase = true
    }
  }
}
Buffer.byteLength = byteLength

function slowToString (encoding, start, end) {
  var loweredCase = false

  // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  // property of a typed array.

  // This behaves neither like String nor Uint8Array in that we set start/end
  // to their upper/lower bounds if the value passed is out of range.
  // undefined is handled specially as per ECMA-262 6th Edition,
  // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  if (start === undefined || start < 0) {
    start = 0
  }
  // Return early if start > this.length. Done here to prevent potential uint32
  // coercion fail below.
  if (start > this.length) {
    return ''
  }

  if (end === undefined || end > this.length) {
    end = this.length
  }

  if (end <= 0) {
    return ''
  }

  // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  end >>>= 0
  start >>>= 0

  if (end <= start) {
    return ''
  }

  if (!encoding) encoding = 'utf8'

  while (true) {
    switch (encoding) {
      case 'hex':
        return hexSlice(this, start, end)

      case 'utf8':
      case 'utf-8':
        return utf8Slice(this, start, end)

      case 'ascii':
        return asciiSlice(this, start, end)

      case 'latin1':
      case 'binary':
        return latin1Slice(this, start, end)

      case 'base64':
        return base64Slice(this, start, end)

      case 'ucs2':
      case 'ucs-2':
      case 'utf16le':
      case 'utf-16le':
        return utf16leSlice(this, start, end)

      default:
        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
        encoding = (encoding + '').toLowerCase()
        loweredCase = true
    }
  }
}

// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
// Buffer instances.
Buffer.prototype._isBuffer = true

function swap (b, n, m) {
  var i = b[n]
  b[n] = b[m]
  b[m] = i
}

Buffer.prototype.swap16 = function swap16 () {
  var len = this.length
  if (len % 2 !== 0) {
    throw new RangeError('Buffer size must be a multiple of 16-bits')
  }
  for (var i = 0; i < len; i += 2) {
    swap(this, i, i + 1)
  }
  return this
}

Buffer.prototype.swap32 = function swap32 () {
  var len = this.length
  if (len % 4 !== 0) {
    throw new RangeError('Buffer size must be a multiple of 32-bits')
  }
  for (var i = 0; i < len; i += 4) {
    swap(this, i, i + 3)
    swap(this, i + 1, i + 2)
  }
  return this
}

Buffer.prototype.swap64 = function swap64 () {
  var len = this.length
  if (len % 8 !== 0) {
    throw new RangeError('Buffer size must be a multiple of 64-bits')
  }
  for (var i = 0; i < len; i += 8) {
    swap(this, i, i + 7)
    swap(this, i + 1, i + 6)
    swap(this, i + 2, i + 5)
    swap(this, i + 3, i + 4)
  }
  return this
}

Buffer.prototype.toString = function toString () {
  var length = this.length | 0
  if (length === 0) return ''
  if (arguments.length === 0) return utf8Slice(this, 0, length)
  return slowToString.apply(this, arguments)
}

Buffer.prototype.equals = function equals (b) {
  if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  if (this === b) return true
  return Buffer.compare(this, b) === 0
}

Buffer.prototype.inspect = function inspect () {
  var str = ''
  var max = exports.INSPECT_MAX_BYTES
  if (this.length > 0) {
    str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
    if (this.length > max) str += ' ... '
  }
  return '<Buffer ' + str + '>'
}

Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  if (!Buffer.isBuffer(target)) {
    throw new TypeError('Argument must be a Buffer')
  }

  if (start === undefined) {
    start = 0
  }
  if (end === undefined) {
    end = target ? target.length : 0
  }
  if (thisStart === undefined) {
    thisStart = 0
  }
  if (thisEnd === undefined) {
    thisEnd = this.length
  }

  if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
    throw new RangeError('out of range index')
  }

  if (thisStart >= thisEnd && start >= end) {
    return 0
  }
  if (thisStart >= thisEnd) {
    return -1
  }
  if (start >= end) {
    return 1
  }

  start >>>= 0
  end >>>= 0
  thisStart >>>= 0
  thisEnd >>>= 0

  if (this === target) return 0

  var x = thisEnd - thisStart
  var y = end - start
  var len = Math.min(x, y)

  var thisCopy = this.slice(thisStart, thisEnd)
  var targetCopy = target.slice(start, end)

  for (var i = 0; i < len; ++i) {
    if (thisCopy[i] !== targetCopy[i]) {
      x = thisCopy[i]
      y = targetCopy[i]
      break
    }
  }

  if (x < y) return -1
  if (y < x) return 1
  return 0
}

// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
//
// Arguments:
// - buffer - a Buffer to search
// - val - a string, Buffer, or number
// - byteOffset - an index into `buffer`; will be clamped to an int32
// - encoding - an optional encoding, relevant is val is a string
// - dir - true for indexOf, false for lastIndexOf
function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  // Empty buffer means no match
  if (buffer.length === 0) return -1

  // Normalize byteOffset
  if (typeof byteOffset === 'string') {
    encoding = byteOffset
    byteOffset = 0
  } else if (byteOffset > 0x7fffffff) {
    byteOffset = 0x7fffffff
  } else if (byteOffset < -0x80000000) {
    byteOffset = -0x80000000
  }
  byteOffset = +byteOffset  // Coerce to Number.
  if (isNaN(byteOffset)) {
    // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
    byteOffset = dir ? 0 : (buffer.length - 1)
  }

  // Normalize byteOffset: negative offsets start from the end of the buffer
  if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  if (byteOffset >= buffer.length) {
    if (dir) return -1
    else byteOffset = buffer.length - 1
  } else if (byteOffset < 0) {
    if (dir) byteOffset = 0
    else return -1
  }

  // Normalize val
  if (typeof val === 'string') {
    val = Buffer.from(val, encoding)
  }

  // Finally, search either indexOf (if dir is true) or lastIndexOf
  if (Buffer.isBuffer(val)) {
    // Special case: looking for empty string/buffer always fails
    if (val.length === 0) {
      return -1
    }
    return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  } else if (typeof val === 'number') {
    val = val & 0xFF // Search for a byte value [0-255]
    if (Buffer.TYPED_ARRAY_SUPPORT &&
        typeof Uint8Array.prototype.indexOf === 'function') {
      if (dir) {
        return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
      } else {
        return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
      }
    }
    return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  }

  throw new TypeError('val must be string, number or Buffer')
}

function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  var indexSize = 1
  var arrLength = arr.length
  var valLength = val.length

  if (encoding !== undefined) {
    encoding = String(encoding).toLowerCase()
    if (encoding === 'ucs2' || encoding === 'ucs-2' ||
        encoding === 'utf16le' || encoding === 'utf-16le') {
      if (arr.length < 2 || val.length < 2) {
        return -1
      }
      indexSize = 2
      arrLength /= 2
      valLength /= 2
      byteOffset /= 2
    }
  }

  function read (buf, i) {
    if (indexSize === 1) {
      return buf[i]
    } else {
      return buf.readUInt16BE(i * indexSize)
    }
  }

  var i
  if (dir) {
    var foundIndex = -1
    for (i = byteOffset; i < arrLength; i++) {
      if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
        if (foundIndex === -1) foundIndex = i
        if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
      } else {
        if (foundIndex !== -1) i -= i - foundIndex
        foundIndex = -1
      }
    }
  } else {
    if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
    for (i = byteOffset; i >= 0; i--) {
      var found = true
      for (var j = 0; j < valLength; j++) {
        if (read(arr, i + j) !== read(val, j)) {
          found = false
          break
        }
      }
      if (found) return i
    }
  }

  return -1
}

Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  return this.indexOf(val, byteOffset, encoding) !== -1
}

Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
}

Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
}

function hexWrite (buf, string, offset, length) {
  offset = Number(offset) || 0
  var remaining = buf.length - offset
  if (!length) {
    length = remaining
  } else {
    length = Number(length)
    if (length > remaining) {
      length = remaining
    }
  }

  // must be an even number of digits
  var strLen = string.length
  if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')

  if (length > strLen / 2) {
    length = strLen / 2
  }
  for (var i = 0; i < length; ++i) {
    var parsed = parseInt(string.substr(i * 2, 2), 16)
    if (isNaN(parsed)) return i
    buf[offset + i] = parsed
  }
  return i
}

function utf8Write (buf, string, offset, length) {
  return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
}

function asciiWrite (buf, string, offset, length) {
  return blitBuffer(asciiToBytes(string), buf, offset, length)
}

function latin1Write (buf, string, offset, length) {
  return asciiWrite(buf, string, offset, length)
}

function base64Write (buf, string, offset, length) {
  return blitBuffer(base64ToBytes(string), buf, offset, length)
}

function ucs2Write (buf, string, offset, length) {
  return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
}

Buffer.prototype.write = function write (string, offset, length, encoding) {
  // Buffer#write(string)
  if (offset === undefined) {
    encoding = 'utf8'
    length = this.length
    offset = 0
  // Buffer#write(string, encoding)
  } else if (length === undefined && typeof offset === 'string') {
    encoding = offset
    length = this.length
    offset = 0
  // Buffer#write(string, offset[, length][, encoding])
  } else if (isFinite(offset)) {
    offset = offset | 0
    if (isFinite(length)) {
      length = length | 0
      if (encoding === undefined) encoding = 'utf8'
    } else {
      encoding = length
      length = undefined
    }
  // legacy write(string, encoding, offset, length) - remove in v0.13
  } else {
    throw new Error(
      'Buffer.write(string, encoding, offset[, length]) is no longer supported'
    )
  }

  var remaining = this.length - offset
  if (length === undefined || length > remaining) length = remaining

  if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
    throw new RangeError('Attempt to write outside buffer bounds')
  }

  if (!encoding) encoding = 'utf8'

  var loweredCase = false
  for (;;) {
    switch (encoding) {
      case 'hex':
        return hexWrite(this, string, offset, length)

      case 'utf8':
      case 'utf-8':
        return utf8Write(this, string, offset, length)

      case 'ascii':
        return asciiWrite(this, string, offset, length)

      case 'latin1':
      case 'binary':
        return latin1Write(this, string, offset, length)

      case 'base64':
        // Warning: maxLength not taken into account in base64Write
        return base64Write(this, string, offset, length)

      case 'ucs2':
      case 'ucs-2':
      case 'utf16le':
      case 'utf-16le':
        return ucs2Write(this, string, offset, length)

      default:
        if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
        encoding = ('' + encoding).toLowerCase()
        loweredCase = true
    }
  }
}

Buffer.prototype.toJSON = function toJSON () {
  return {
    type: 'Buffer',
    data: Array.prototype.slice.call(this._arr || this, 0)
  }
}

function base64Slice (buf, start, end) {
  if (start === 0 && end === buf.length) {
    return base64.fromByteArray(buf)
  } else {
    return base64.fromByteArray(buf.slice(start, end))
  }
}

function utf8Slice (buf, start, end) {
  end = Math.min(buf.length, end)
  var res = []

  var i = start
  while (i < end) {
    var firstByte = buf[i]
    var codePoint = null
    var bytesPerSequence = (firstByte > 0xEF) ? 4
      : (firstByte > 0xDF) ? 3
      : (firstByte > 0xBF) ? 2
      : 1

    if (i + bytesPerSequence <= end) {
      var secondByte, thirdByte, fourthByte, tempCodePoint

      switch (bytesPerSequence) {
        case 1:
          if (firstByte < 0x80) {
            codePoint = firstByte
          }
          break
        case 2:
          secondByte = buf[i + 1]
          if ((secondByte & 0xC0) === 0x80) {
            tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
            if (tempCodePoint > 0x7F) {
              codePoint = tempCodePoint
            }
          }
          break
        case 3:
          secondByte = buf[i + 1]
          thirdByte = buf[i + 2]
          if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
            tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
            if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
              codePoint = tempCodePoint
            }
          }
          break
        case 4:
          secondByte = buf[i + 1]
          thirdByte = buf[i + 2]
          fourthByte = buf[i + 3]
          if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
            tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
            if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
              codePoint = tempCodePoint
            }
          }
      }
    }

    if (codePoint === null) {
      // we did not generate a valid codePoint so insert a
      // replacement char (U+FFFD) and advance only 1 byte
      codePoint = 0xFFFD
      bytesPerSequence = 1
    } else if (codePoint > 0xFFFF) {
      // encode to utf16 (surrogate pair dance)
      codePoint -= 0x10000
      res.push(codePoint >>> 10 & 0x3FF | 0xD800)
      codePoint = 0xDC00 | codePoint & 0x3FF
    }

    res.push(codePoint)
    i += bytesPerSequence
  }

  return decodeCodePointsArray(res)
}

// Based on http://stackoverflow.com/a/22747272/680742, the browser with
// the lowest limit is Chrome, with 0x10000 args.
// We go 1 magnitude less, for safety
var MAX_ARGUMENTS_LENGTH = 0x1000

function decodeCodePointsArray (codePoints) {
  var len = codePoints.length
  if (len <= MAX_ARGUMENTS_LENGTH) {
    return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  }

  // Decode in chunks to avoid "call stack size exceeded".
  var res = ''
  var i = 0
  while (i < len) {
    res += String.fromCharCode.apply(
      String,
      codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
    )
  }
  return res
}

function asciiSlice (buf, start, end) {
  var ret = ''
  end = Math.min(buf.length, end)

  for (var i = start; i < end; ++i) {
    ret += String.fromCharCode(buf[i] & 0x7F)
  }
  return ret
}

function latin1Slice (buf, start, end) {
  var ret = ''
  end = Math.min(buf.length, end)

  for (var i = start; i < end; ++i) {
    ret += String.fromCharCode(buf[i])
  }
  return ret
}

function hexSlice (buf, start, end) {
  var len = buf.length

  if (!start || start < 0) start = 0
  if (!end || end < 0 || end > len) end = len

  var out = ''
  for (var i = start; i < end; ++i) {
    out += toHex(buf[i])
  }
  return out
}

function utf16leSlice (buf, start, end) {
  var bytes = buf.slice(start, end)
  var res = ''
  for (var i = 0; i < bytes.length; i += 2) {
    res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  }
  return res
}

Buffer.prototype.slice = function slice (start, end) {
  var len = this.length
  start = ~~start
  end = end === undefined ? len : ~~end

  if (start < 0) {
    start += len
    if (start < 0) start = 0
  } else if (start > len) {
    start = len
  }

  if (end < 0) {
    end += len
    if (end < 0) end = 0
  } else if (end > len) {
    end = len
  }

  if (end < start) end = start

  var newBuf
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    newBuf = this.subarray(start, end)
    newBuf.__proto__ = Buffer.prototype
  } else {
    var sliceLen = end - start
    newBuf = new Buffer(sliceLen, undefined)
    for (var i = 0; i < sliceLen; ++i) {
      newBuf[i] = this[i + start]
    }
  }

  return newBuf
}

/*
 * Need to make sure that buffer isn't trying to write out of bounds.
 */
function checkOffset (offset, ext, length) {
  if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
}

Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  offset = offset | 0
  byteLength = byteLength | 0
  if (!noAssert) checkOffset(offset, byteLength, this.length)

  var val = this[offset]
  var mul = 1
  var i = 0
  while (++i < byteLength && (mul *= 0x100)) {
    val += this[offset + i] * mul
  }

  return val
}

Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  offset = offset | 0
  byteLength = byteLength | 0
  if (!noAssert) {
    checkOffset(offset, byteLength, this.length)
  }

  var val = this[offset + --byteLength]
  var mul = 1
  while (byteLength > 0 && (mul *= 0x100)) {
    val += this[offset + --byteLength] * mul
  }

  return val
}

Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 1, this.length)
  return this[offset]
}

Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 2, this.length)
  return this[offset] | (this[offset + 1] << 8)
}

Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 2, this.length)
  return (this[offset] << 8) | this[offset + 1]
}

Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 4, this.length)

  return ((this[offset]) |
      (this[offset + 1] << 8) |
      (this[offset + 2] << 16)) +
      (this[offset + 3] * 0x1000000)
}

Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 4, this.length)

  return (this[offset] * 0x1000000) +
    ((this[offset + 1] << 16) |
    (this[offset + 2] << 8) |
    this[offset + 3])
}

Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  offset = offset | 0
  byteLength = byteLength | 0
  if (!noAssert) checkOffset(offset, byteLength, this.length)

  var val = this[offset]
  var mul = 1
  var i = 0
  while (++i < byteLength && (mul *= 0x100)) {
    val += this[offset + i] * mul
  }
  mul *= 0x80

  if (val >= mul) val -= Math.pow(2, 8 * byteLength)

  return val
}

Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  offset = offset | 0
  byteLength = byteLength | 0
  if (!noAssert) checkOffset(offset, byteLength, this.length)

  var i = byteLength
  var mul = 1
  var val = this[offset + --i]
  while (i > 0 && (mul *= 0x100)) {
    val += this[offset + --i] * mul
  }
  mul *= 0x80

  if (val >= mul) val -= Math.pow(2, 8 * byteLength)

  return val
}

Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 1, this.length)
  if (!(this[offset] & 0x80)) return (this[offset])
  return ((0xff - this[offset] + 1) * -1)
}

Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 2, this.length)
  var val = this[offset] | (this[offset + 1] << 8)
  return (val & 0x8000) ? val | 0xFFFF0000 : val
}

Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 2, this.length)
  var val = this[offset + 1] | (this[offset] << 8)
  return (val & 0x8000) ? val | 0xFFFF0000 : val
}

Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 4, this.length)

  return (this[offset]) |
    (this[offset + 1] << 8) |
    (this[offset + 2] << 16) |
    (this[offset + 3] << 24)
}

Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 4, this.length)

  return (this[offset] << 24) |
    (this[offset + 1] << 16) |
    (this[offset + 2] << 8) |
    (this[offset + 3])
}

Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 4, this.length)
  return ieee754.read(this, offset, true, 23, 4)
}

Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 4, this.length)
  return ieee754.read(this, offset, false, 23, 4)
}

Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 8, this.length)
  return ieee754.read(this, offset, true, 52, 8)
}

Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  if (!noAssert) checkOffset(offset, 8, this.length)
  return ieee754.read(this, offset, false, 52, 8)
}

function checkInt (buf, value, offset, ext, max, min) {
  if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  if (offset + ext > buf.length) throw new RangeError('Index out of range')
}

Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  value = +value
  offset = offset | 0
  byteLength = byteLength | 0
  if (!noAssert) {
    var maxBytes = Math.pow(2, 8 * byteLength) - 1
    checkInt(this, value, offset, byteLength, maxBytes, 0)
  }

  var mul = 1
  var i = 0
  this[offset] = value & 0xFF
  while (++i < byteLength && (mul *= 0x100)) {
    this[offset + i] = (value / mul) & 0xFF
  }

  return offset + byteLength
}

Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  value = +value
  offset = offset | 0
  byteLength = byteLength | 0
  if (!noAssert) {
    var maxBytes = Math.pow(2, 8 * byteLength) - 1
    checkInt(this, value, offset, byteLength, maxBytes, 0)
  }

  var i = byteLength - 1
  var mul = 1
  this[offset + i] = value & 0xFF
  while (--i >= 0 && (mul *= 0x100)) {
    this[offset + i] = (value / mul) & 0xFF
  }

  return offset + byteLength
}

Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  value = +value
  offset = offset | 0
  if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  this[offset] = (value & 0xff)
  return offset + 1
}

function objectWriteUInt16 (buf, value, offset, littleEndian) {
  if (value < 0) value = 0xffff + value + 1
  for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
    buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
      (littleEndian ? i : 1 - i) * 8
  }
}

Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  value = +value
  offset = offset | 0
  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    this[offset] = (value & 0xff)
    this[offset + 1] = (value >>> 8)
  } else {
    objectWriteUInt16(this, value, offset, true)
  }
  return offset + 2
}

Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  value = +value
  offset = offset | 0
  if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    this[offset] = (value >>> 8)
    this[offset + 1] = (value & 0xff)
  } else {
    objectWriteUInt16(this, value, offset, false)
  }
  return offset + 2
}

function objectWriteUInt32 (buf, value, offset, littleEndian) {
  if (value < 0) value = 0xffffffff + value + 1
  for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
    buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  }
}

Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  value = +value
  offset = offset | 0
  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    this[offset + 3] = (value >>> 24)
    this[offset + 2] = (value >>> 16)
    this[offset + 1] = (value >>> 8)
    this[offset] = (value & 0xff)
  } else {
    objectWriteUInt32(this, value, offset, true)
  }
  return offset + 4
}

Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  value = +value
  offset = offset | 0
  if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    this[offset] = (value >>> 24)
    this[offset + 1] = (value >>> 16)
    this[offset + 2] = (value >>> 8)
    this[offset + 3] = (value & 0xff)
  } else {
    objectWriteUInt32(this, value, offset, false)
  }
  return offset + 4
}

Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  value = +value
  offset = offset | 0
  if (!noAssert) {
    var limit = Math.pow(2, 8 * byteLength - 1)

    checkInt(this, value, offset, byteLength, limit - 1, -limit)
  }

  var i = 0
  var mul = 1
  var sub = 0
  this[offset] = value & 0xFF
  while (++i < byteLength && (mul *= 0x100)) {
    if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
      sub = 1
    }
    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  }

  return offset + byteLength
}

Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  value = +value
  offset = offset | 0
  if (!noAssert) {
    var limit = Math.pow(2, 8 * byteLength - 1)

    checkInt(this, value, offset, byteLength, limit - 1, -limit)
  }

  var i = byteLength - 1
  var mul = 1
  var sub = 0
  this[offset + i] = value & 0xFF
  while (--i >= 0 && (mul *= 0x100)) {
    if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
      sub = 1
    }
    this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  }

  return offset + byteLength
}

Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  value = +value
  offset = offset | 0
  if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  if (value < 0) value = 0xff + value + 1
  this[offset] = (value & 0xff)
  return offset + 1
}

Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  value = +value
  offset = offset | 0
  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    this[offset] = (value & 0xff)
    this[offset + 1] = (value >>> 8)
  } else {
    objectWriteUInt16(this, value, offset, true)
  }
  return offset + 2
}

Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  value = +value
  offset = offset | 0
  if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    this[offset] = (value >>> 8)
    this[offset + 1] = (value & 0xff)
  } else {
    objectWriteUInt16(this, value, offset, false)
  }
  return offset + 2
}

Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  value = +value
  offset = offset | 0
  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    this[offset] = (value & 0xff)
    this[offset + 1] = (value >>> 8)
    this[offset + 2] = (value >>> 16)
    this[offset + 3] = (value >>> 24)
  } else {
    objectWriteUInt32(this, value, offset, true)
  }
  return offset + 4
}

Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  value = +value
  offset = offset | 0
  if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  if (value < 0) value = 0xffffffff + value + 1
  if (Buffer.TYPED_ARRAY_SUPPORT) {
    this[offset] = (value >>> 24)
    this[offset + 1] = (value >>> 16)
    this[offset + 2] = (value >>> 8)
    this[offset + 3] = (value & 0xff)
  } else {
    objectWriteUInt32(this, value, offset, false)
  }
  return offset + 4
}

function checkIEEE754 (buf, value, offset, ext, max, min) {
  if (offset + ext > buf.length) throw new RangeError('Index out of range')
  if (offset < 0) throw new RangeError('Index out of range')
}

function writeFloat (buf, value, offset, littleEndian, noAssert) {
  if (!noAssert) {
    checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  }
  ieee754.write(buf, value, offset, littleEndian, 23, 4)
  return offset + 4
}

Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  return writeFloat(this, value, offset, true, noAssert)
}

Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  return writeFloat(this, value, offset, false, noAssert)
}

function writeDouble (buf, value, offset, littleEndian, noAssert) {
  if (!noAssert) {
    checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  }
  ieee754.write(buf, value, offset, littleEndian, 52, 8)
  return offset + 8
}

Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  return writeDouble(this, value, offset, true, noAssert)
}

Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  return writeDouble(this, value, offset, false, noAssert)
}

// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  if (!start) start = 0
  if (!end && end !== 0) end = this.length
  if (targetStart >= target.length) targetStart = target.length
  if (!targetStart) targetStart = 0
  if (end > 0 && end < start) end = start

  // Copy 0 bytes; we're done
  if (end === start) return 0
  if (target.length === 0 || this.length === 0) return 0

  // Fatal error conditions
  if (targetStart < 0) {
    throw new RangeError('targetStart out of bounds')
  }
  if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  if (end < 0) throw new RangeError('sourceEnd out of bounds')

  // Are we oob?
  if (end > this.length) end = this.length
  if (target.length - targetStart < end - start) {
    end = target.length - targetStart + start
  }

  var len = end - start
  var i

  if (this === target && start < targetStart && targetStart < end) {
    // descending copy from end
    for (i = len - 1; i >= 0; --i) {
      target[i + targetStart] = this[i + start]
    }
  } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
    // ascending copy from start
    for (i = 0; i < len; ++i) {
      target[i + targetStart] = this[i + start]
    }
  } else {
    Uint8Array.prototype.set.call(
      target,
      this.subarray(start, start + len),
      targetStart
    )
  }

  return len
}

// Usage:
//    buffer.fill(number[, offset[, end]])
//    buffer.fill(buffer[, offset[, end]])
//    buffer.fill(string[, offset[, end]][, encoding])
Buffer.prototype.fill = function fill (val, start, end, encoding) {
  // Handle string cases:
  if (typeof val === 'string') {
    if (typeof start === 'string') {
      encoding = start
      start = 0
      end = this.length
    } else if (typeof end === 'string') {
      encoding = end
      end = this.length
    }
    if (val.length === 1) {
      var code = val.charCodeAt(0)
      if (code < 256) {
        val = code
      }
    }
    if (encoding !== undefined && typeof encoding !== 'string') {
      throw new TypeError('encoding must be a string')
    }
    if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
      throw new TypeError('Unknown encoding: ' + encoding)
    }
  } else if (typeof val === 'number') {
    val = val & 255
  }

  // Invalid ranges are not set to a default, so can range check early.
  if (start < 0 || this.length < start || this.length < end) {
    throw new RangeError('Out of range index')
  }

  if (end <= start) {
    return this
  }

  start = start >>> 0
  end = end === undefined ? this.length : end >>> 0

  if (!val) val = 0

  var i
  if (typeof val === 'number') {
    for (i = start; i < end; ++i) {
      this[i] = val
    }
  } else {
    var bytes = Buffer.isBuffer(val)
      ? val
      : utf8ToBytes(new Buffer(val, encoding).toString())
    var len = bytes.length
    for (i = 0; i < end - start; ++i) {
      this[i + start] = bytes[i % len]
    }
  }

  return this
}

// HELPER FUNCTIONS
// ================

var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g

function base64clean (str) {
  // Node strips out invalid characters like \n and \t from the string, base64-js does not
  str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  // Node converts strings with length < 2 to ''
  if (str.length < 2) return ''
  // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  while (str.length % 4 !== 0) {
    str = str + '='
  }
  return str
}

function stringtrim (str) {
  if (str.trim) return str.trim()
  return str.replace(/^\s+|\s+$/g, '')
}

function toHex (n) {
  if (n < 16) return '0' + n.toString(16)
  return n.toString(16)
}

function utf8ToBytes (string, units) {
  units = units || Infinity
  var codePoint
  var length = string.length
  var leadSurrogate = null
  var bytes = []

  for (var i = 0; i < length; ++i) {
    codePoint = string.charCodeAt(i)

    // is surrogate component
    if (codePoint > 0xD7FF && codePoint < 0xE000) {
      // last char was a lead
      if (!leadSurrogate) {
        // no lead yet
        if (codePoint > 0xDBFF) {
          // unexpected trail
          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
          continue
        } else if (i + 1 === length) {
          // unpaired lead
          if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
          continue
        }

        // valid lead
        leadSurrogate = codePoint

        continue
      }

      // 2 leads in a row
      if (codePoint < 0xDC00) {
        if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
        leadSurrogate = codePoint
        continue
      }

      // valid surrogate pair
      codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
    } else if (leadSurrogate) {
      // valid bmp char, but last char was a lead
      if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
    }

    leadSurrogate = null

    // encode utf8
    if (codePoint < 0x80) {
      if ((units -= 1) < 0) break
      bytes.push(codePoint)
    } else if (codePoint < 0x800) {
      if ((units -= 2) < 0) break
      bytes.push(
        codePoint >> 0x6 | 0xC0,
        codePoint & 0x3F | 0x80
      )
    } else if (codePoint < 0x10000) {
      if ((units -= 3) < 0) break
      bytes.push(
        codePoint >> 0xC | 0xE0,
        codePoint >> 0x6 & 0x3F | 0x80,
        codePoint & 0x3F | 0x80
      )
    } else if (codePoint < 0x110000) {
      if ((units -= 4) < 0) break
      bytes.push(
        codePoint >> 0x12 | 0xF0,
        codePoint >> 0xC & 0x3F | 0x80,
        codePoint >> 0x6 & 0x3F | 0x80,
        codePoint & 0x3F | 0x80
      )
    } else {
      throw new Error('Invalid code point')
    }
  }

  return bytes
}

function asciiToBytes (str) {
  var byteArray = []
  for (var i = 0; i < str.length; ++i) {
    // Node's code seems to be doing this and not & 0x7F..
    byteArray.push(str.charCodeAt(i) & 0xFF)
  }
  return byteArray
}

function utf16leToBytes (str, units) {
  var c, hi, lo
  var byteArray = []
  for (var i = 0; i < str.length; ++i) {
    if ((units -= 2) < 0) break

    c = str.charCodeAt(i)
    hi = c >> 8
    lo = c % 256
    byteArray.push(lo)
    byteArray.push(hi)
  }

  return byteArray
}

function base64ToBytes (str) {
  return base64.toByteArray(base64clean(str))
}

function blitBuffer (src, dst, offset, length) {
  for (var i = 0; i < length; ++i) {
    if ((i + offset >= dst.length) || (i >= src.length)) break
    dst[i + offset] = src[i]
  }
  return i
}

function isnan (val) {
  return val !== val // eslint-disable-line no-self-compare
}

/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(41)))

/***/ }),
/* 255 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


exports.byteLength = byteLength
exports.toByteArray = toByteArray
exports.fromByteArray = fromByteArray

var lookup = []
var revLookup = []
var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array

var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
for (var i = 0, len = code.length; i < len; ++i) {
  lookup[i] = code[i]
  revLookup[code.charCodeAt(i)] = i
}

revLookup['-'.charCodeAt(0)] = 62
revLookup['_'.charCodeAt(0)] = 63

function placeHoldersCount (b64) {
  var len = b64.length
  if (len % 4 > 0) {
    throw new Error('Invalid string. Length must be a multiple of 4')
  }

  // the number of equal signs (place holders)
  // if there are two placeholders, than the two characters before it
  // represent one byte
  // if there is only one, then the three characters before it represent 2 bytes
  // this is just a cheap hack to not do indexOf twice
  return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0
}

function byteLength (b64) {
  // base64 is 4/3 + up to two characters of the original data
  return b64.length * 3 / 4 - placeHoldersCount(b64)
}

function toByteArray (b64) {
  var i, j, l, tmp, placeHolders, arr
  var len = b64.length
  placeHolders = placeHoldersCount(b64)

  arr = new Arr(len * 3 / 4 - placeHolders)

  // if there are placeholders, only get up to the last complete 4 chars
  l = placeHolders > 0 ? len - 4 : len

  var L = 0

  for (i = 0, j = 0; i < l; i += 4, j += 3) {
    tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]
    arr[L++] = (tmp >> 16) & 0xFF
    arr[L++] = (tmp >> 8) & 0xFF
    arr[L++] = tmp & 0xFF
  }

  if (placeHolders === 2) {
    tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)
    arr[L++] = tmp & 0xFF
  } else if (placeHolders === 1) {
    tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)
    arr[L++] = (tmp >> 8) & 0xFF
    arr[L++] = tmp & 0xFF
  }

  return arr
}

function tripletToBase64 (num) {
  return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
}

function encodeChunk (uint8, start, end) {
  var tmp
  var output = []
  for (var i = start; i < end; i += 3) {
    tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
    output.push(tripletToBase64(tmp))
  }
  return output.join('')
}

function fromByteArray (uint8) {
  var tmp
  var len = uint8.length
  var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  var output = ''
  var parts = []
  var maxChunkLength = 16383 // must be multiple of 3

  // go through the array every three bytes, we'll deal with trailing stuff later
  for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
    parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
  }

  // pad the end with zeros, but make sure to not forget the extra bytes
  if (extraBytes === 1) {
    tmp = uint8[len - 1]
    output += lookup[tmp >> 2]
    output += lookup[(tmp << 4) & 0x3F]
    output += '=='
  } else if (extraBytes === 2) {
    tmp = (uint8[len - 2] << 8) + (uint8[len - 1])
    output += lookup[tmp >> 10]
    output += lookup[(tmp >> 4) & 0x3F]
    output += lookup[(tmp << 2) & 0x3F]
    output += '='
  }

  parts.push(output)

  return parts.join('')
}


/***/ }),
/* 256 */
/***/ (function(module, exports) {

exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  var e, m
  var eLen = nBytes * 8 - mLen - 1
  var eMax = (1 << eLen) - 1
  var eBias = eMax >> 1
  var nBits = -7
  var i = isLE ? (nBytes - 1) : 0
  var d = isLE ? -1 : 1
  var s = buffer[offset + i]

  i += d

  e = s & ((1 << (-nBits)) - 1)
  s >>= (-nBits)
  nBits += eLen
  for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}

  m = e & ((1 << (-nBits)) - 1)
  e >>= (-nBits)
  nBits += mLen
  for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}

  if (e === 0) {
    e = 1 - eBias
  } else if (e === eMax) {
    return m ? NaN : ((s ? -1 : 1) * Infinity)
  } else {
    m = m + Math.pow(2, mLen)
    e = e - eBias
  }
  return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
}

exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  var e, m, c
  var eLen = nBytes * 8 - mLen - 1
  var eMax = (1 << eLen) - 1
  var eBias = eMax >> 1
  var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  var i = isLE ? 0 : (nBytes - 1)
  var d = isLE ? 1 : -1
  var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0

  value = Math.abs(value)

  if (isNaN(value) || value === Infinity) {
    m = isNaN(value) ? 1 : 0
    e = eMax
  } else {
    e = Math.floor(Math.log(value) / Math.LN2)
    if (value * (c = Math.pow(2, -e)) < 1) {
      e--
      c *= 2
    }
    if (e + eBias >= 1) {
      value += rt / c
    } else {
      value += rt * Math.pow(2, 1 - eBias)
    }
    if (value * c >= 2) {
      e++
      c /= 2
    }

    if (e + eBias >= eMax) {
      m = 0
      e = eMax
    } else if (e + eBias >= 1) {
      m = (value * c - 1) * Math.pow(2, mLen)
      e = e + eBias
    } else {
      m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
      e = 0
    }
  }

  for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}

  e = (e << mLen) | m
  eLen += mLen
  for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}

  buffer[offset + i - d] |= s * 128
}


/***/ }),
/* 257 */
/***/ (function(module, exports) {

var toString = {}.toString;

module.exports = Array.isArray || function (arr) {
  return toString.call(arr) == '[object Array]';
};


/***/ }),
/* 258 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */

/**
 * Provides environment functions for internal use
 * @class
 * @memberof PhotoEditorSDK
 * @private
 */
var Env = function () {
  function Env() {
    _classCallCheck(this, Env);
  }

  _createClass(Env, null, [{
    key: 'current',

    /**
     * Return current environment
     * @returns {Boolean}
     */
    value: function current() {
      return ("production");
    }

    /**
     * Returns True if testing environment
     * @returns {Boolean}
     */

  }, {
    key: 'isTest',
    value: function isTest() {
      return ("production") === 'test';
    }

    /**
     * Returns True if development environment
     * @returns {Boolean}
     */

  }, {
    key: 'isDevelopment',
    value: function isDevelopment() {
      return ("production") === 'development';
    }

    /**
     * Returns True if production environment
     * @returns {Boolean}
     */

  }, {
    key: 'isProduction',
    value: function isProduction() {
      return ("production") === 'production' || !this.isTest() && !this.isDevelopment();
    }
  }]);

  return Env;
}();

/* harmony default export */ __webpack_exports__["a"] = (Env);

/***/ }),
/* 259 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__image_loader__ = __webpack_require__(260);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "ImageLoader", function() { return __WEBPACK_IMPORTED_MODULE_0__image_loader__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__json_loader__ = __webpack_require__(136);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "JSONLoader", function() { return __WEBPACK_IMPORTED_MODULE_1__json_loader__["a"]; });
// export { default as FileLoader } from './file-loader'



/***/ }),
/* 260 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_is_iterable__ = __webpack_require__(70);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_is_iterable___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_is_iterable__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_get_iterator__ = __webpack_require__(71);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_get_iterator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_get_iterator__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_promise__ = __webpack_require__(29);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_promise___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_promise__);




var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_get_iterator___default()(arr), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_is_iterable___default()(Object(arr))) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */

/* eslint-disable brace-style */

/* harmony default export */ __webpack_exports__["a"] = ({
  load: function load(url) {
    var _this = this;

    var crossOrigin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { cors: true, value: 'anonymous' };

    var loadPromise = function loadPromise() {
      if (url.substr(0, 5) === 'data:' || "boolean" !== 'undefined') {
        return __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_promise___default.a.resolve([url, url]);
      }
    };

    return loadPromise().then(function (_ref) {
      var _ref2 = _slicedToArray(_ref, 2),
          originalSrc = _ref2[0],
          src = _ref2[1];

      return _this._createAndLoadImage(originalSrc, src, crossOrigin);
    });
  },
  _createAndLoadImage: function _createAndLoadImage(originalSrc, src) {
    var crossOrigin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { cors: true, value: 'anonymous' };

    if (true) {
      return new __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_promise___default.a(function (resolve, reject) {
        var image = new window.Image();
        image.addEventListener('load', function () {
          resolve(image);
        });
        image.addEventListener('error', function () {
          reject(new Error('Failed to load image at ' + src));
        });

        if (crossOrigin.cors) {
          image.crossOrigin = crossOrigin.value;
        }

        image.src = src;
      });
    }
  },
  loadXHR: function loadXHR(url, mime) {
    return new __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_promise___default.a(function (resolve, reject) {
      var xhr = void 0;
      if (window.XDomainRequest) {
        xhr = new window.XDomainRequest();
        if (mime) xhr.overrideMimeType(mime);

        xhr.onload = function () {
          resolve(xhr);
        };
        xhr.onerror = function (e) {
          reject(e);
        };
      } else if (window.XMLHttpRequest) {
        xhr = new window.XMLHttpRequest();
        if (mime) xhr.overrideMimeType(mime);

        xhr.onreadystatechange = function (oEvent) {
          if (xhr.readyState === 4) {
            if (xhr.status === 200) {
              resolve(xhr);
            } else {
              reject(new Error('HTTP Status ' + xhr.status));
            }
          }
        };
      }

      xhr.open('GET', url, true);
      xhr.send();
    });
  }
});

/***/ }),
/* 261 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__adjustments_operation__ = __webpack_require__(262);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__blur_operation__ = __webpack_require__(266);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter_operation__ = __webpack_require__(268);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__frame_operation__ = __webpack_require__(331);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__linear_focus_operation__ = __webpack_require__(332);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__mirrored_focus_operation__ = __webpack_require__(335);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__orientation_operation__ = __webpack_require__(338);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__overlay_operation__ = __webpack_require__(339);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__radial_focus_operation__ = __webpack_require__(340);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__selective_blur_operation__ = __webpack_require__(343);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__sprite_operation__ = __webpack_require__(348);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__transform_operation__ = __webpack_require__(378);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__watermark_operation__ = __webpack_require__(380);
/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */
















var Operations = [__WEBPACK_IMPORTED_MODULE_1__adjustments_operation__["a" /* default */], __WEBPACK_IMPORTED_MODULE_2__blur_operation__["a" /* default */], __WEBPACK_IMPORTED_MODULE_3__filter_operation__["a" /* default */], __WEBPACK_IMPORTED_MODULE_4__frame_operation__["a" /* default */], __WEBPACK_IMPORTED_MODULE_5__linear_focus_operation__["a" /* default */], __WEBPACK_IMPORTED_MODULE_6__mirrored_focus_operation__["a" /* default */], __WEBPACK_IMPORTED_MODULE_7__orientation_operation__["a" /* default */], __WEBPACK_IMPORTED_MODULE_8__overlay_operation__["a" /* default */], __WEBPACK_IMPORTED_MODULE_9__radial_focus_operation__["a" /* default */], __WEBPACK_IMPORTED_MODULE_10__selective_blur_operation__["a" /* default */], __WEBPACK_IMPORTED_MODULE_11__sprite_operation__["a" /* default */], __WEBPACK_IMPORTED_MODULE_12__transform_operation__["a" /* default */], __WEBPACK_IMPORTED_MODULE_13__watermark_operation__["a" /* default */]];

__WEBPACK_IMPORTED_MODULE_0_photoeditorsdk_core___default.a.AllOperations = Operations;

/* harmony default export */ __webpack_exports__["default"] = (Operations);

/***/ }),
/* 262 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__shared_filters_adjustments_filter__ = __webpack_require__(143);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__clarity_filter__ = __webpack_require__(264);






var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var ColorMatrix = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Math"].ColorMatrix;

/**
 * Applies adjustments (brightness, saturation, contrast) to the image
 * @class
 * @alias Operations.AdjustmentsOperation
 * @extends PhotoEditorSDK.Operation
 * @memberof PhotoEditorSDK
 */

var AdjustmentsOperation = function (_Operation) {
  _inherits(AdjustmentsOperation, _Operation);

  /**
   * Creates a new AdjustmentsOperation
   * @param  {PhotoEditorSDK} sdk
   * @param  {Object} [options]
   * @param  {Number} [options.brightness = 0]
   * @param  {Number} [options.saturation = 1]
   * @param  {Number} [options.exposure = 0]
   * @param  {Number} [options.contrast = 1]
   * @param  {Number} [options.shadows = 0]
   * @param  {Number} [options.highlights = 1]
   */
  function AdjustmentsOperation() {
    var _ref;

    _classCallCheck(this, AdjustmentsOperation);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = AdjustmentsOperation.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(AdjustmentsOperation)).call.apply(_ref, [this].concat(args)));

    _this._clarityFilter = new __WEBPACK_IMPORTED_MODULE_7__clarity_filter__["a" /* default */]();
    _this._filter = new __WEBPACK_IMPORTED_MODULE_6__shared_filters_adjustments_filter__["a" /* default */]();
    _this._sprite.setFilters([_this._clarityFilter, _this._filter]);
    return _this;
  }

  /**
   * Applies this operation
   * @param  {PhotoEditorSDK} sdk
   * @return {Promise} renderer
   * @private
   */


  _createClass(AdjustmentsOperation, [{
    key: '_render',
    value: function _render(sdk) {
      var dimensions = sdk.getDimensions();
      dimensions.x = 1.0 / dimensions.x;
      dimensions.y = 1.0 / dimensions.y;
      var clarityColorMatrix = new ColorMatrix();
      clarityColorMatrix.multiply(ColorMatrix.createSaturationMatrix(-0.3 * this._options.clarity + 1));
      clarityColorMatrix.multiply(ColorMatrix.createContrastMatrix(0.1 * this._options.clarity + 1));

      this._clarityFilter.set({
        clarity: this._options.clarity,
        pixelDimension: dimensions,
        colorMatrix: clarityColorMatrix,
        colorOffset: clarityColorMatrix.getOffsets()
      });

      var colorMatrix = new ColorMatrix();
      colorMatrix.multiply(ColorMatrix.createExposureMatrix(this._options.exposure));
      colorMatrix.multiply(ColorMatrix.createSaturationMatrix(this._options.saturation + 1));
      colorMatrix.multiply(ColorMatrix.createContrastMatrix((this._options.contrast > 0 ? this._options.contrast * 2 : this._options.contrast) + 1));
      colorMatrix.multiply(ColorMatrix.createBrightnessMatrix(this._options.brightness));

      this._filter.set({
        gamma: this._options.gamma,
        shadows: this._options.shadows,
        highlights: this._options.highlights,
        colorMatrix: colorMatrix,
        colorOffset: colorMatrix.getOffsets()
      });

      if (this._options.clarity !== 0) {
        this._sprite.setFilters([this._clarityFilter, this._filter]);
      } else {
        this._sprite.setFilters([this._filter]);
      }

      this._renderTexture.render(this._container);

      return __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Promise"].resolve();
    }

    /**
     * Disposes this operation
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      _get(AdjustmentsOperation.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(AdjustmentsOperation.prototype), 'dispose', this).call(this);
      this._filter.dispose();
      this._clarityFilter.dispose();
    }
  }]);

  return AdjustmentsOperation;
}(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Operation"]);

/**
 * A unique string that identifies this operation. Can be used to select
 * operations.
 * @type {String}
 * @default
 */


AdjustmentsOperation.identifier = 'adjustments';

/**
 * Specifies the available options for this operation
 * @type {Object}
 * @ignore
 */
AdjustmentsOperation.prototype.availableOptions = {
  brightness: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0, minValue: -1, midValue: 0, maxValue: 1 },
  saturation: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.0, minValue: -1, midValue: 0, maxValue: 1 },
  contrast: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.0, minValue: -1, midValue: 0, maxValue: 1 },
  gamma: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 1.0, minValue: 0.5, midValue: 1, maxValue: 2 },
  exposure: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.0, minValue: -1, midValue: 0, maxValue: 1 },
  shadows: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.0, minValue: -2, midValue: 0, maxValue: 2 },
  highlights: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.0, minValue: -1, midValue: 0, maxValue: 1 },
  clarity: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.0, minValue: -1, midValue: 0, maxValue: 1 }
};

__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default.a.Operations.AdjustmentsOperation = AdjustmentsOperation;

/* harmony default export */ __webpack_exports__["a"] = (AdjustmentsOperation);

/***/ }),
/* 263 */
/***/ (function(module, exports) {

module.exports = "precision highp float;\n\nvarying vec2 v_texCoord;\nuniform sampler2D u_image;\n\nuniform float u_gamma;\nuniform float u_shadows;\nuniform float u_highlights;\n\nuniform mat4 u_colorMatrix;\nuniform vec4 u_colorOffset;\n\nconst float EPSILON = 0.0000001;\n\nfloat calculateLuminance(vec3 rgb) {\n    // This is the luminance calculation part of the RGB to HSL formular.\n    vec4 p = mix(\n        vec4(rgb.gb, 0.0, -1.0 / 3.0),\n        vec4(rgb.bg, -1.0, 2.0 / 3.0),\n        vec4(rgb.g < rgb.b)\n    );\n\n    vec4 q = mix(\n        vec4(rgb.r, p.yzx),\n        vec4(p.xyw, rgb.r),\n        vec4(rgb.r < p.x)\n    );\n\n    float croma = q.x - min(q.w, q.y);\n    float luminance = q.x - croma * 0.5;\n    return luminance;\n}\n\nvoid main() {\n\n  vec4 color = clamp(texture2D(u_image, v_texCoord), 0.0, 1.0);\n  color.rgb /= max(color.a, EPSILON); // Revert premultiplied alpha\n\n  // Apply gamma\n  if (u_gamma != 1.0) {\n    color.rgb = pow(color.rgb, vec3(1.0 / max(u_gamma, EPSILON)));\n  }\n\n  // Apply shadows and highlights\n  float luminance = calculateLuminance(color.rgb);\n\n  float shadow = u_shadows >= 0.0\n    ? clamp(\n          pow(luminance, 1.0 / (u_shadows + 1.0))\n          + pow(luminance, 2.0 / (u_shadows + 1.0)) * -0.76\n          - luminance\n    , 0.0, max(u_shadows, 1.0))\n    : -clamp(\n          pow(luminance, 1.0 / (-u_shadows + 1.0))\n          + pow(luminance, 2.0 / (-u_shadows + 1.0)) * -0.76\n          - luminance\n    , 0.0, max(-u_shadows, 1.0));\n\n  float highlight = u_highlights < 0.0\n    ? clamp(\n          1.0\n          - pow(1.0 - luminance, 1.0 / (1.0 - u_highlights))\n          - pow(1.0 - luminance, 2.0 / (1.0 - u_highlights)) * -0.8\n          - luminance\n     , -1.0, 0.0)\n    : -clamp(\n          1.0\n          - pow(1.0 - luminance, 1.0 / (1.0 + u_highlights))\n          - pow(1.0 - luminance, 2.0 / (1.0 + u_highlights)) * -0.8\n          - luminance\n     , -1.0, 0.0);\n\n  // Bright color need more contrast and dark color need more brightness.\n  // This is to keep saturatation because the color information of a dark colors is lost.\n  float shadowContrast   = shadow * luminance * luminance;\n  float shadowBrightness = shadow - shadowContrast;\n  color.rgb = clamp((luminance + highlight + shadowContrast) * ((color.rgb + shadowBrightness) / max(luminance, EPSILON)), 0.0, 1.0);\n\n  // Apply Color Matrix\n  color = clamp(color * u_colorMatrix + u_colorOffset, 0.0, 1.0);\n\n  color.rgb *= color.a; // Do premultiplie alpha\n\n  gl_FragColor = color;\n}\n"

/***/ }),
/* 264 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */


var Vector2 = __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Math"].Vector2,
    ColorMatrix = __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Math"].ColorMatrix;

var ClarityFilter = function (_Engine$Filter) {
  _inherits(ClarityFilter, _Engine$Filter);

  function ClarityFilter() {
    _classCallCheck(this, ClarityFilter);

    var _this = _possibleConstructorReturn(this, (ClarityFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(ClarityFilter)).call(this));

    _this._fragmentSource = __webpack_require__(265);
    return _this;
  }

  /**
   * Applies this filter to the given inputTarget and renders it to
   * the given outputTarget using the CanvasRenderer.
   * @param  {CanvasRenderer} renderer
   * @param  {RenderTarget} inputTarget
   * @param  {RenderTarget} outputTarget
   * @param  {Boolean} clear = false
   * @private
   */


  _createClass(ClarityFilter, [{
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      // const inputDimensions = inputTarget.getDimensions()
      var outputContext = outputTarget.getContext();
      var inputCanvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();

      var clarity = this._options.clarity;
      var colorMatrix = this._options.colorMatrix;
      var colorOffset = new __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Color"](this._options.colorOffset[0], this._options.colorOffset[1], this._options.colorOffset[2], this._options.colorOffset[3]);
      var width = inputCanvas.width;
      var height = inputCanvas.height;
      var inputImageData = inputContext.getImageData(0, 0, width, height);
      var outputImageData = outputContext.createImageData(width, height);

      this.canvasShader(inputImageData, outputImageData, clarity, colorMatrix, colorOffset);

      outputContext.putImageData(outputImageData, 0, 0);
    }

    /**
     *
     *
     * @param {ImageData} inputImageData
     * @param {ImageData} outputImageData
     * @param {Number} clarity
     * @param {ColorMatrix} colorMatrix
     * @param {Color} colorOffset
     * @memberof ClarityFilter
     */

  }, {
    key: 'canvasShader',
    value: function canvasShader(inputImageData, outputImageData, clarity, colorMatrix, colorOffset) {
      var clamp = function clamp(x, minVal, maxVal) {
        return Math.min(Math.max(x, minVal), maxVal);
      };
      var smoothstep = function smoothstep(edge0, edge1, x) {
        var t = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
        return t * t * (3.0 - 2.0 * t);
      };

      var stride = inputImageData.width * 4;
      var length = inputImageData.data.length;
      var maxIdx = length - 1;
      var minIdx = 0;
      var inData = inputImageData.data;
      var outData = outputImageData.data;

      var tmpColor = new __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Color"]();
      var divisor = 255 * 9;
      var sampleEdge = function sampleEdge(idx) {
        idx = idx < minIdx ? minIdx : idx;
        idx = idx > maxIdx ? maxIdx : idx;
        return inData[idx];
      };

      for (var idx = 0; idx < length; idx += 4) {
        var colorR = sampleEdge(idx + 0);
        var colorG = sampleEdge(idx + 1);
        var colorB = sampleEdge(idx + 2);
        var colorA = sampleEdge(idx + 3);

        var mergedR = (colorR + sampleEdge(idx - 4 - stride + 0) + sampleEdge(idx - 4 + 0) + sampleEdge(idx - 4 + stride + 0) + sampleEdge(idx - stride + 0) + sampleEdge(idx + stride + 0) + sampleEdge(idx + 4 - stride + 0) + sampleEdge(idx + 4 + 0) + sampleEdge(idx + 4 + stride)) / divisor;

        var mergedG = (colorG + sampleEdge(idx - 4 - stride + 1) + sampleEdge(idx - 4 + 1) + sampleEdge(idx - 4 + stride + 1) + sampleEdge(idx - stride + 1) + sampleEdge(idx + stride + 1) + sampleEdge(idx + 4 - stride + 1) + sampleEdge(idx + 4 + 1) + sampleEdge(idx + 4 + stride + 1)) / divisor;

        var mergedB = (colorB + sampleEdge(idx - 4 - stride + 2) + sampleEdge(idx - 4 + 2) + sampleEdge(idx - 4 + stride + 2) + sampleEdge(idx - stride + 2) + sampleEdge(idx + stride + 2) + sampleEdge(idx + 4 - stride + 2) + sampleEdge(idx + 4 + 2) + sampleEdge(idx + 4 + stride + 2)) / divisor;

        var mergedA = (colorA + sampleEdge(idx - 4 - stride + 3) + sampleEdge(idx - 4 + 3) + sampleEdge(idx - 4 + stride + 3) + sampleEdge(idx - stride + 3) + sampleEdge(idx + stride + 3) + sampleEdge(idx + 4 - stride + 3) + sampleEdge(idx + 4 + 3) + sampleEdge(idx + 4 + stride + 3)) / divisor;

        colorR /= 255;
        colorG /= 255;
        colorB /= 255;
        colorA /= 255;

        var grayValue = clamp(colorR * 0.3 + colorG * 0.59 + colorB * 0.1, 0.111111, 0.999999);

        var frequenceFactor = Math.min(smoothstep(1.0 - grayValue, 0.0, 0.11), smoothstep(grayValue, 0.0, 0.11));
        var scalar = clarity * 3.7 * frequenceFactor;
        var scale = Math.pow(2.0, clarity * 0.27 * frequenceFactor);
        var outR = clamp(colorR + clamp((colorR - mergedR) * scalar, 0.0, 10.0), 0.0, 1.0) * scale;
        var outG = clamp(colorG + clamp((colorG - mergedG) * scalar, 0.0, 10.0), 0.0, 1.0) * scale;
        var outB = clamp(colorB + clamp((colorB - mergedB) * scalar, 0.0, 10.0), 0.0, 1.0) * scale;
        var outA = clamp(colorA + clamp((colorA - mergedA) * scalar, 0.0, 10.0), 0.0, 1.0);

        tmpColor.set(outR, outG, outB, outA);

        var outColor = colorMatrix.apply(tmpColor).add(colorOffset);
        // .clamp(0.0, 1.0)

        outData[idx + 0] = outColor.r * 255;
        outData[idx + 1] = outColor.g * 255;
        outData[idx + 2] = outColor.b * 255;
        outData[idx + 3] = outColor.a * 255;
      }
    }
  }]);

  return ClarityFilter;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].Filter);

ClarityFilter.prototype.availableOptions = {
  clarity: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 0, uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT },
  pixelDimension: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(100, 100), uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT2 },
  colorMatrix: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].COLOR_MATRIX, default: new ColorMatrix(), uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].MAT4 },
  colorOffset: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].ARRAY, default: [], uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT4 }
};

/* harmony default export */ __webpack_exports__["a"] = (ClarityFilter);

/***/ }),
/* 265 */
/***/ (function(module, exports) {

module.exports = "precision mediump float;\n\n// Input Image with config WRAP_S and WRAP_T: CLAMP_TO_EDGE\nuniform sampler2D u_image;\n\n// Size of one pixel == vec2(1.0 / u_image.width, 1.0 / u_image.height)\nuniform vec2 u_pixelDimension;\n\n// Range (-1.0 - 1.0)\nuniform float u_clarity;\n\nvarying vec2 v_texCoord;\n\nuniform mat4 u_colorMatrix;\nuniform vec4 u_colorOffset;\n\nconst float EPSILON = 0.000001;\n\nvoid main() {\n    vec4 color = texture2D(u_image, v_texCoord);\n\n    vec4 mergedColor = color;\n    mergedColor += texture2D(u_image, v_texCoord + vec2(-u_pixelDimension.x, -u_pixelDimension.y));\n    mergedColor += texture2D(u_image, v_texCoord + vec2(-u_pixelDimension.x,                 0.0));\n    mergedColor += texture2D(u_image, v_texCoord + vec2(-u_pixelDimension.x,  u_pixelDimension.y));\n\n    mergedColor += texture2D(u_image, v_texCoord + vec2(                0.0, -u_pixelDimension.y));\n    mergedColor += texture2D(u_image, v_texCoord + vec2(                0.0,  u_pixelDimension.y));\n\n    mergedColor += texture2D(u_image, v_texCoord + vec2( u_pixelDimension.x, -u_pixelDimension.y));\n    mergedColor += texture2D(u_image, v_texCoord + vec2( u_pixelDimension.x,                 0.0));\n    mergedColor += texture2D(u_image, v_texCoord + vec2( u_pixelDimension.x,  u_pixelDimension.y));\n\n    mergedColor /= 9.0;\n\n    color.rgb /= max(color.a, EPSILON);       // Revert premultiplied alpha\n    mergedColor.rgb /= max(mergedColor.a, EPSILON); // Revert premultiplied alpha\n\n    float grayValue = clamp(color.r * 0.3 + color.g * 0.59 + color.b * 0.1, 0.111111, 0.999999);\n    // 1.0 and 0.0 result in white not black, therefore we clamp\n\n    // Here we create a function that will map values below 0.1 to 0. Values above 0.2 will be mapped to 1,\n    // and for values between 0.1 and 0.2 it will produce a gradient.\n    // The funtion is mirror at 0.5, meaning values between 0.8 and 0.9 will result in a decending gradient.\n    // And values above 0.9 will be mapped to 0.\n    float frequenceFactor = min(smoothstep(1.0 - grayValue, 0.0, 0.11), smoothstep(grayValue, 0.0, 0.11));\n\n    // here we apply the high pass filter. Its strength is determined by the uniform ,\n    // and the frequence factor. That means the only the mid tones are affected by this filter.\n    // Clarity input is ranging from -1 to 1. But we want to strengthen the effect.\n    // Therefore we see this little magic number '3.7'.\n    color = clamp(color + clamp((color - mergedColor) * u_clarity * 3.7 * frequenceFactor, 0.0, 10.0), 0.0, 1.0);\n\n    // apply exposure but only to the mid tones.\n    color.rgb = color.rgb * pow(2.0, u_clarity * 0.27 * frequenceFactor);\n\n    // apply contrast and desaturation matrix\n\n\n    color = clamp(color * u_colorMatrix + u_colorOffset, 0.0, 1.0);\n\n    color.rgb *= color.a; // Do premultiplie alpha\n\n    gl_FragColor = clamp(color, 0.0, 1.0);\n}\n"

/***/ }),
/* 266 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__shared_filters_blur_filter__ = __webpack_require__(144);






var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



var Vector2 = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Math"].Vector2;

/**
 * An operation that can draw a radial focus
 * @class
 * @extends PhotoEditorSDK.Operation
 * @memberof PhotoEditorSDK.Operations
 */

var BlurOperation = function (_Operation) {
  _inherits(BlurOperation, _Operation);

  /**
   * Creates a new BlurOperation
   * @param  {PhotoEditorSDK} sdk
   * @param  {Object} [options]
   */
  function BlurOperation() {
    var _ref;

    _classCallCheck(this, BlurOperation);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = BlurOperation.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(BlurOperation)).call.apply(_ref, [this].concat(args)));

    _this._lastBlurRadius = _this._options.blurRadius;

    _this._horizontalFilter = new __WEBPACK_IMPORTED_MODULE_6__shared_filters_blur_filter__["a" /* default */]();
    _this._verticalFilter = new __WEBPACK_IMPORTED_MODULE_6__shared_filters_blur_filter__["a" /* default */]();
    _this._sprite.setFilters([_this._horizontalFilter, _this._verticalFilter]);

    _this._horizontalFilter.setDelta(new Vector2(0.5, 0.5));
    _this._verticalFilter.setDelta(new Vector2(-0.5, 0.5));

    _this._filter = new __WEBPACK_IMPORTED_MODULE_6__shared_filters_blur_filter__["a" /* default */]();
    return _this;
  }

  /**
   * Renders the radial blur using WebGL
   * @param  {PhotoEditorSDK.Engine.Texture} inputTexture
   * @private
   * @override
   */
  /* istanbul ignore next */


  _createClass(BlurOperation, [{
    key: '_renderWebGL',
    value: function _renderWebGL(inputTexture) {
      var inputDimensions = inputTexture.getDimensions();
      var shortestSide = inputDimensions.min();

      var blurRadius = this._options.blurRadius;


      var commonOptions = {
        blurRadius: blurRadius * shortestSide,
        texSize: inputDimensions
      };

      this._horizontalFilter.set(commonOptions);
      this._verticalFilter.set(commonOptions);

      this._renderTexture.render(this._container);

      return __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Promise"].resolve();
    }

    /**
     * Renders the radial blur using Canvas2D
     * @param  {PhotoEditorSDK.Engine.Texture} inputTexture
     * @private
     * @override
     */

  }, {
    key: '_renderCanvas',
    value: function _renderCanvas(inputTexture) {
      var blurRadius = this._options.blurRadius;

      var inputDimensions = inputTexture.getDimensions();

      this._filter.set({
        blurRadius: blurRadius,
        texSize: inputDimensions
      });

      this._sprite.setFilters([this._filter]);

      this._renderTexture.render(this._container);

      return __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Promise"].resolve();
    }

    /**
     * Applies the given transform change
     * @param  {PhotoEditorSDK.Operations.TransformOperation.TransformChange} transformChange
     * @private
     */

  }, {
    key: 'transform',
    value: function transform(transformChange) {
      var size = this.getBlurRadius();
      var blurRadius = transformChange.applyToRelativeSize(size);

      this.set({ blurRadius: blurRadius }, false);
    }

    /**
     * Disposes this operation
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      _get(BlurOperation.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(BlurOperation.prototype), 'dispose', this).call(this);
      this._filter.dispose();
      this._verticalFilter.dispose();
      this._horizontalFilter.dispose();
    }

    /**
     * Checks if the operation has changes/modifications
     * @return {Boolean}
     */

  }, {
    key: 'hasChanges',
    value: function hasChanges() {
      return true;
    }
  }]);

  return BlurOperation;
}(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Operation"]);

/**
 * A unique string that identifies this operation. Can be used to select
 * operations.
 * @type {String}
 * @default
 */


BlurOperation.identifier = 'blur';

/**
 * Specifies the available options for this operation
 * @type {Object}
 * @ignore
 */
BlurOperation.prototype.availableOptions = {
  blurRadius: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.025 }
};

__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default.a.Operations.BlurOperation = BlurOperation;

/* harmony default export */ __webpack_exports__["a"] = (BlurOperation);

/***/ }),
/* 267 */
/***/ (function(module, exports) {

module.exports = "/*\n * Based on evanw's glfx.js tilt shift shader:\n * https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js\n * @license\n */\n\nuniform sampler2D u_image;\nuniform float u_blurRadius;\nuniform vec2 u_delta;\nuniform vec2 u_texSize;\nvarying vec2 v_texCoord;\n\nfloat random(vec2 co)\n{\n    highp float a = 12.9898;\n    highp float b = 78.233;\n    highp float c = 43758.5453;\n    highp float dt = dot(co.xy,vec2(a,b));\n    highp float sn = mod(dt, 3.14);\n    return fract(sin(sn) * c);\n}\n\nvoid main() {\n    vec4 color = vec4(0.0);\n    float total = 0.0;\n\n    float offset = random(gl_FragCoord.xy / u_texSize.xy);\n    float radius = u_blurRadius;\n\n    for (float t = -30.0; t <= 30.0; t++) {\n        float percent = (t + offset - 0.5) / 30.0;\n        float weight = 1.0 - abs(percent);\n\n        // Somehow `sample` is a keyword in headless-gl\n        vec4 _sample = texture2D(u_image, v_texCoord + u_delta * percent * radius / u_texSize);\n\n        _sample.rgb *= _sample.a;\n\n        color += _sample * weight;\n        total += weight;\n    }\n\n    gl_FragColor = color / total;\n    gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\n}\n"

/***/ }),
/* 268 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__filters_identity_filter__ = __webpack_require__(145);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__filters_primitives__ = __webpack_require__(8);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__filters__ = __webpack_require__(299);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__filters_filter__ = __webpack_require__(7);







var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */







/**
 * An operation that can apply a selected filter
 * @class
 * @extends PhotoEditorSDK.Operation
 * @memberof PhotoEditorSDK.Operations
 */

var FilterOperation = function (_Operation) {
  _inherits(FilterOperation, _Operation);

  function FilterOperation() {
    _classCallCheck(this, FilterOperation);

    return _possibleConstructorReturn(this, (FilterOperation.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(FilterOperation)).apply(this, arguments));
  }

  _createClass(FilterOperation, [{
    key: '_render',

    /**
     * Renders this operation
     * @param {PhotoEditorSDK.Engine.Texture} inputTexture
     * @return {Promise}
     * @private
     */
    value: function _render(inputTexture) {
      return this._selectedFilter.render(this._sdk, inputTexture, this._renderTexture);
    }

    /**
     * Applies this operation
     * @param  {PhotoEditorSDK.Engine.Texture} inputTexture
     * @return {Promise}
     * @override
     */

  }, {
    key: 'render',
    value: function render(inputTexture) {
      if (this._selectedFilter.getDirty()) {
        this.setDirty(true);
      }

      if (!this.getEnabled() || this._selectedFilter.constructor.isIdentity) {
        return __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Promise"].resolve(inputTexture);
      }

      return _get(FilterOperation.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(FilterOperation.prototype), 'render', this).call(this, inputTexture);
    }

    /**
     * Sets the dirtiness for the given renderer
     * @param {Boolean} dirty
     * @param {PhotoEditorSDK.Engine.BaseRenderer} renderer
     * @override
     */

  }, {
    key: 'setDirtyForRenderer',
    value: function setDirtyForRenderer(dirty, renderer) {
      _get(FilterOperation.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(FilterOperation.prototype), 'setDirtyForRenderer', this).call(this, dirty, renderer);
      this._selectedFilter.setDirtyForRenderer(dirty, renderer);
    }

    /**
     * Frees the memory
     */

  }, {
    key: 'disposeRenderTextures',
    value: function disposeRenderTextures() {
      _get(FilterOperation.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(FilterOperation.prototype), 'disposeRenderTextures', this).call(this);
      if (this._selectedFilter) {
        this._selectedFilter.disposeRenderTextures();
      }
    }

    /**
     * Disposes this operation
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      _get(FilterOperation.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(FilterOperation.prototype), 'dispose', this).call(this);
      if (this._selectedFilter) {
        this._selectedFilter.dispose();
      }
    }
  }, {
    key: 'restoreSnapshot',
    value: function restoreSnapshot(serializedOptions) {
      var options = _extends({}, serializedOptions);
      delete options.filter;

      if (serializedOptions.filter) {
        var FilterConstructor = serializedOptions.filter.constructor;
        if (FilterConstructor.identifier === '3d-lut') {
          this.setFilter(new FilterConstructor({
            image: serializedOptions.filter.getImage(),
            resolution: serializedOptions.filter.getResolution(),
            horizontalTileCount: serializedOptions.filter.getHorizontalTileCount(),
            verticalTileCount: serializedOptions.filter.getVerticalTileCount()
          }));
        } else {
          this.setFilter(new FilterConstructor());
        }
      }
      this.set(options);
    }
  }]);

  return FilterOperation;
}(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Operation"]);

/**
 * A unique string that identifies this operation. Can be used to select
 * operations.
 * @type {String}
 * @default
 */


FilterOperation.identifier = 'filter';

/**
 * Specifies the available options for this operation
 * @type {Object}
 * @ignore
 */
FilterOperation.prototype.availableOptions = {
  identifier: {
    type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].STRING,
    default: 'identity'
  },
  intensity: {
    type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].NUMBER,
    default: 1,
    setter: function setter(intensity) {
      this._selectedFilter && this._selectedFilter.setIntensity(intensity);
      return intensity;
    }
  },
  filter: {
    type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].OBJECT,
    default: new __WEBPACK_IMPORTED_MODULE_7__filters_identity_filter__["a" /* default */](),
    setter: function setter(Filter) {
      if (this._selectedFilter) {
        this._selectedFilter.dispose();
        this._selectedFilter = null;
      }

      this._selectedFilter = Filter;
      if (typeof this._options.intensity !== 'undefined') {
        this._selectedFilter.set({
          intensity: this._options.intensity
        });
      }
      return Filter;
    }
  }
};

FilterOperation.FilterPrimitives = __WEBPACK_IMPORTED_MODULE_8__filters_primitives__;
FilterOperation.Filters = __WEBPACK_IMPORTED_MODULE_9__filters__;
FilterOperation.Filter = __WEBPACK_IMPORTED_MODULE_10__filters_filter__["a" /* default */];
__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core___default.a.Operations.FilterOperation = FilterOperation;

/* harmony default export */ __webpack_exports__["a"] = (FilterOperation);

/***/ }),
/* 269 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



var BlendFilter = function (_Engine$Filter) {
  _inherits(BlendFilter, _Engine$Filter);

  function BlendFilter() {
    _classCallCheck(this, BlendFilter);

    var _this = _possibleConstructorReturn(this, (BlendFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(BlendFilter)).call(this));

    _this._fragmentSource = __webpack_require__(270);
    return _this;
  }

  /**
   * Applies this filter to the given inputTarget and renders it to
   * the given outputTarget using the CanvasRenderer
   * @param  {PhotoEditorSDK.Engine.CanvasRenderer} renderer
   * @param  {PhotoEditorSDK.Engine.RenderTarget} inputTarget
   * @param  {PhotoEditorSDK.Engine.RenderTarget} outputTarget
   * @param  {Boolean} clear = false
   * @private
   */


  _createClass(BlendFilter, [{
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var canvas = inputTarget.getCanvas();
      var outputContext = outputTarget.getContext();

      var filteredCanvas = this._options.filteredCanvas;


      outputContext.save();
      outputContext.drawImage(canvas, 0, 0);
      outputContext.globalAlpha = this._options.intensity;
      outputContext.drawImage(filteredCanvas, 0, 0);
      outputContext.restore();
    }
  }]);

  return BlendFilter;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].Filter);

BlendFilter.prototype.availableOptions = {
  filteredImage: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 1, uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].INT },
  filteredCanvas: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].OBJECT, default: null },
  intensity: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 1, uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT }

  /**
   * A helper class that can collect {@link Primitive} instances and render
   * the stack
   * @class
   * @memberof PhotoEditorSDK.Filter
   */
};
var PrimitivesStack = function () {
  function PrimitivesStack() {
    var intensity = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;

    _classCallCheck(this, PrimitivesStack);

    this._intensity = intensity;

    this._stack = [];
    this._dirtiness = {};
    this._renderTextures = {};
    this._container = new __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].Container();
    this._sprite = new __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].Sprite();
    this._container.addChild(this._sprite);

    this._blendFilter = new BlendFilter();
  }

  /**
   * Adds the given primitive to the stack
   * @param {PhotoEditorSDK.Filter.Primitive} primitive
   */


  _createClass(PrimitivesStack, [{
    key: 'push',
    value: function push(primitive) {
      this._stack.push(primitive);
    }

    /**
     * Clears the stack
     */

  }, {
    key: 'clear',
    value: function clear() {
      this._stack = [];
    }

    /**
     * Renders this stack
     * @param  {PhotoEditorSDK} sdk
     * @param  {PhotoEditorSDK.Engine.Texture} inputTexture
     * @param  {PhotoEditorSDK.Engine.RenderTexture} outputTexture
     * @return {Promise}
     * @description This takes the output sprite's current texture and renders
     *              it to this stack's internal render texture. It then uses the
     *              internal texture as a uniform for a blend shader and renders
     *              the sprite with the original texture and the blend shader to
     *              the outputTexture
     */

  }, {
    key: 'render',
    value: function render(sdk, inputTexture, outputTexture) {
      if (this._stack.length === 0) {
        return __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Promise"].resolve();
      }
      var renderer = sdk.getRenderer();

      this._sprite.setTexture(inputTexture);

      // Make sure we have a RenderTexture we can render the filtered image to
      var filteredRenderTexture = this._renderTextures[renderer.id];
      if (!filteredRenderTexture) {
        var frame = sdk.getSprite().getTexture().getFrame();
        filteredRenderTexture = new __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].RenderTexture(sdk.getRenderer(), frame.width, frame.height);
        this._renderTextures[renderer.id] = filteredRenderTexture;
      }

      // Resize filtered render texture to output texture dimensions
      var textureDimensions = outputTexture.getDimensions();
      filteredRenderTexture.resizeTo(textureDimensions);

      var shouldRender = this.isDirtyForRenderer(renderer);
      if (shouldRender) {
        // Update primitives
        this._stack.forEach(function (p) {
          p.update(sdk);
        });

        // Set filters
        var filters = this._stack.map(function (p) {
          return p.getFilter();
        });
        this._sprite.setFilters(filters);

        // Render to RenderTexture
        filteredRenderTexture.render(this._container);
        this.setDirtyForRenderer(false, renderer);
      }

      // Use filteredRenderTexture as uniform for blend shader, blend the two
      // to achieve intensity
      this._blendFilter.setIntensity(this._intensity);
      if (renderer.isOfType(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["RendererType"].CANVAS)) {
        this._blendFilter.setFilteredCanvas(filteredRenderTexture.getRenderTarget().getCanvas());
      } else if (renderer.isOfType(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["RendererType"].WEBGL)) {
        var baseTexture = filteredRenderTexture.getBaseTexture();
        baseTexture.setGLUnit(this._blendFilter.getFilteredImage());
        renderer.updateTexture(baseTexture, false);
      }
      this._sprite.setFilters([this._blendFilter]);

      outputTexture.clear(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Color"].TRANSPARENT);
      outputTexture.render(this._container);

      if (shouldRender) {
        this.disposeRenderTextures();
      }

      return __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Promise"].resolve(outputTexture);
    }
  }, {
    key: 'setIntensity',
    value: function setIntensity(intensity) {
      this._intensity = intensity;
    }

    /**
     * Checks if this operation is dirty for the given renderer
     * @param  {PhotoEditorSDK.Engine.BaseRenderer}  renderer
     * @return {Boolean}
     */

  }, {
    key: 'isDirtyForRenderer',
    value: function isDirtyForRenderer(renderer) {
      if (!(renderer.id in this._dirtiness)) {
        this._dirtiness[renderer.id] = true;
      }
      return this._dirtiness[renderer.id];
    }

    /**
     * Sets the dirtiness for the given renderer
     * @param {Boolean} dirty
     * @param {PhotoEditorSDK.Engine.BaseRenderer} renderer
     */

  }, {
    key: 'setDirtyForRenderer',
    value: function setDirtyForRenderer(dirty, renderer) {
      this._dirtiness[renderer.id] = dirty;
    }

    /**
     * Sets the dirtiness for all renderers
     * @param {Boolean} dirty
     */

  }, {
    key: 'setDirty',
    value: function setDirty(dirty) {
      for (var rendererId in this._dirtiness) {
        this._dirtiness[rendererId] = dirty;
      }
    }

    /**
     * Disposes the render textures, frees some memory
     */

  }, {
    key: 'disposeRenderTextures',
    value: function disposeRenderTextures() {
      for (var rendererId in this._renderTextures) {
        this._renderTextures[rendererId].dispose();
        delete this._renderTextures[rendererId];
      }
    }

    /**
     * Cleans up this instance
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      this.disposeRenderTextures();
      this._stack.forEach(function (primitive) {
        return primitive.dispose();
      });
      this._stack = [];
      this._blendFilter.dispose();

      this._sprite.dispose();
    }
  }]);

  return PrimitivesStack;
}();

/* harmony default export */ __webpack_exports__["a"] = (PrimitivesStack);

/***/ }),
/* 270 */
/***/ (function(module, exports) {

module.exports = "varying vec2 v_texCoord;\nuniform sampler2D u_image;\nuniform sampler2D u_filteredImage;\nuniform float u_intensity;\n\nvoid main() {\n  vec4 color0 = texture2D(u_image, v_texCoord);\n  vec4 color1 = texture2D(u_filteredImage, v_texCoord);\n  gl_FragColor = mix(color0, color1, u_intensity);\n}\n"

/***/ }),
/* 271 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__primitive__ = __webpack_require__(12);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var BrightnessFilter = function (_Engine$Filter) {
  _inherits(BrightnessFilter, _Engine$Filter);

  function BrightnessFilter() {
    _classCallCheck(this, BrightnessFilter);

    var _this = _possibleConstructorReturn(this, (BrightnessFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(BrightnessFilter)).call(this));

    _this._fragmentSource = __webpack_require__(272);
    return _this;
  }

  /**
   * Applies this filter to the given inputTarget and renders it to
   * the given outputTarget using the CanvasRenderer
   * @param  {CanvasRenderer} renderer
   * @param  {RenderTarget} inputTarget
   * @param  {RenderTarget} outputTarget
   * @param  {Boolean} clear = false
   * @private
   */


  _createClass(BrightnessFilter, [{
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var canvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();
      var outputContext = outputTarget.getContext();

      var imageData = inputContext.getImageData(0, 0, canvas.width, canvas.height);

      var brightness = this._options.brightness;


      if (brightness === 0) {
        return;
      }
      brightness = brightness * 255;

      for (var i = 0; i < canvas.width * canvas.height; i++) {
        var index = i * 4;
        imageData.data[index] += brightness;
        imageData.data[index + 1] += brightness;
        imageData.data[index + 2] += brightness;
      }

      outputContext.putImageData(imageData, 0, 0);
    }
  }]);

  return BrightnessFilter;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].Filter);

/**
 * Specifies the available options for this filter
 * @type {Object}
 * @ignore
 */


BrightnessFilter.prototype.availableOptions = {
  brightness: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 0, uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT }

  /**
   * Brightness primitive
   * @class
   * @extends PhotoEditorSDK.Filters.Primitive
   * @memberof PhotoEditorSDK.FilterPrimitives
   */
};
var Brightness = function (_Primitive) {
  _inherits(Brightness, _Primitive);

  function Brightness() {
    var _ref;

    _classCallCheck(this, Brightness);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this2 = _possibleConstructorReturn(this, (_ref = Brightness.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(Brightness)).call.apply(_ref, [this].concat(args)));

    _this2._filter = new BrightnessFilter();
    return _this2;
  }

  /**
   * Updates the filter's uniforms
   */


  _createClass(Brightness, [{
    key: 'update',
    value: function update() {
      this._filter.setBrightness(this._options.brightness);
    }
  }]);

  return Brightness;
}(__WEBPACK_IMPORTED_MODULE_5__primitive__["a" /* default */]);

/**
 * Specifies the available options for this primitive
 * @type {Object}
 * @ignore
 */


Brightness.prototype.availableOptions = BrightnessFilter.prototype.availableOptions;

/* harmony default export */ __webpack_exports__["a"] = (Brightness);

/***/ }),
/* 272 */
/***/ (function(module, exports) {

module.exports = "varying vec2 v_texCoord;\nuniform sampler2D u_image;\nuniform float u_brightness;\n\nvoid main() {\n  vec4 texColor = texture2D(u_image, v_texCoord);\n  gl_FragColor = vec4((texColor.rgb + vec3(u_brightness) * texColor.a), texColor.a);;\n}\n"

/***/ }),
/* 273 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__primitive__ = __webpack_require__(12);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var ContrastFilter = function (_Engine$Filter) {
  _inherits(ContrastFilter, _Engine$Filter);

  function ContrastFilter() {
    _classCallCheck(this, ContrastFilter);

    var _this = _possibleConstructorReturn(this, (ContrastFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(ContrastFilter)).call(this));

    _this._fragmentSource = __webpack_require__(274);
    return _this;
  }

  /**
   * Applies this filter to the given inputTarget and renders it to
   * the given outputTarget using the CanvasRenderer
   * @param  {CanvasRenderer} renderer
   * @param  {RenderTarget} inputTarget
   * @param  {RenderTarget} outputTarget
   * @param  {Boolean} clear = false
   * @private
   */


  _createClass(ContrastFilter, [{
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var canvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();
      var outputContext = outputTarget.getContext();

      var imageData = inputContext.getImageData(0, 0, canvas.width, canvas.height);

      var contrast = this._options.contrast;

      if (contrast === 1) {
        return;
      }

      for (var i = 0; i < canvas.width * canvas.height; i++) {
        var index = i * 4;
        imageData.data[index] = (imageData.data[index] - 127) * contrast + 127;
        imageData.data[index + 1] = (imageData.data[index + 1] - 127) * contrast + 127;
        imageData.data[index + 2] = (imageData.data[index + 2] - 127) * contrast + 127;
      }

      outputContext.putImageData(imageData, 0, 0);
    }
  }]);

  return ContrastFilter;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].Filter);

/**
 * Specifies the available options for this filter
 * @type {Object}
 * @ignore
 */


ContrastFilter.prototype.availableOptions = {
  contrast: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 1, uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT }

  /**
   * Contrast primitive
   * @class
   * @extends PhotoEditorSDK.Filters.Primitive
   * @memberof PhotoEditorSDK.FilterPrimitives
   */
};
var Contrast = function (_Primitive) {
  _inherits(Contrast, _Primitive);

  function Contrast() {
    var _ref;

    _classCallCheck(this, Contrast);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this2 = _possibleConstructorReturn(this, (_ref = Contrast.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(Contrast)).call.apply(_ref, [this].concat(args)));

    _this2._filter = new ContrastFilter();
    return _this2;
  }

  /**
   * Updates the filter's uniforms
   */


  _createClass(Contrast, [{
    key: 'update',
    value: function update() {
      this._filter.setContrast(this._options.contrast);
    }
  }]);

  return Contrast;
}(__WEBPACK_IMPORTED_MODULE_5__primitive__["a" /* default */]);

/**
 * Specifies the available options for this primitive
 * @type {Object}
 * @ignore
 */


Contrast.prototype.availableOptions = ContrastFilter.prototype.availableOptions;

/* harmony default export */ __webpack_exports__["a"] = (Contrast);

/***/ }),
/* 274 */
/***/ (function(module, exports) {

module.exports = "varying vec2 v_texCoord;\nuniform sampler2D u_image;\nuniform float u_contrast;\n\nvoid main() {\n  vec4 texColor = texture2D(u_image, v_texCoord);\n  gl_FragColor = vec4(((texColor.rgb - vec3(0.5)) * u_contrast + vec3(0.5) * texColor.a), texColor.a);\n}\n"

/***/ }),
/* 275 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__primitive__ = __webpack_require__(12);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



var ColorMatrix = __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Math"].ColorMatrix;

var ColorMatrixFilter = function (_Engine$Filter) {
  _inherits(ColorMatrixFilter, _Engine$Filter);

  function ColorMatrixFilter() {
    _classCallCheck(this, ColorMatrixFilter);

    var _this = _possibleConstructorReturn(this, (ColorMatrixFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(ColorMatrixFilter)).call(this));

    _this._fragmentSource = __webpack_require__(276);
    return _this;
  }

  /**
   * Applies this filter to the given inputTarget and renders it to
   * the given outputTarget using the CanvasRenderer
   * @param  {CanvasRenderer} renderer
   * @param  {RenderTarget} inputTarget
   * @param  {RenderTarget} outputTarget
   * @param  {Boolean} clear = false
   * @private
   */


  _createClass(ColorMatrixFilter, [{
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var canvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();
      var outputContext = outputTarget.getContext();

      var imageData = inputContext.getImageData(0, 0, canvas.width, canvas.height);

      var colorMatrix = this._options.colorMatrix;

      var color = new __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Color"](0, 0, 0, 0);

      for (var i = 0; i < canvas.width * canvas.height; i++) {
        var index = i * 4;
        color.r = imageData.data[index] / 255;
        color.g = imageData.data[index + 1] / 255;
        color.b = imageData.data[index + 2] / 255;
        color = colorMatrix.apply(color);
        imageData.data[index] = color.r * 255;
        imageData.data[index + 1] = color.g * 255;
        imageData.data[index + 2] = color.b * 255;
      }

      outputContext.putImageData(imageData, 0, 0);
    }
  }]);

  return ColorMatrixFilter;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].Filter);

/**
 * Specifies the available options for this filter
 * @type {Object}
 * @ignore
 */


ColorMatrixFilter.prototype.availableOptions = {
  colorMatrix: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].COLOR_MATRIX, default: new ColorMatrix(), uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].MAT4 },
  colorMatrixOffset: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].ARRAY, default: [], uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT4 }

  /**
   * ColorMatrix primitive
   * @class
   * @extends PhotoEditorSDK.Filters.Primitive
   * @memberof PhotoEditorSDK.FilterPrimitives
   */
};
var ColorMatrixPrimitive = function (_Primitive) {
  _inherits(ColorMatrixPrimitive, _Primitive);

  function ColorMatrixPrimitive() {
    var _ref;

    _classCallCheck(this, ColorMatrixPrimitive);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this2 = _possibleConstructorReturn(this, (_ref = ColorMatrixPrimitive.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(ColorMatrixPrimitive)).call.apply(_ref, [this].concat(args)));

    _this2._filter = new ColorMatrixFilter();
    return _this2;
  }

  /**
   * Updates the filter's uniforms
   */


  _createClass(ColorMatrixPrimitive, [{
    key: 'update',
    value: function update() {
      this._filter.setColorMatrix(this._options.colorMatrix);
    }
  }]);

  return ColorMatrixPrimitive;
}(__WEBPACK_IMPORTED_MODULE_5__primitive__["a" /* default */]);

/**
 * Specifies the available options for this primitive
 * @type {Object}
 * @ignore
 */


ColorMatrixPrimitive.prototype.availableOptions = ColorMatrixFilter.prototype.availableOptions;

/* harmony default export */ __webpack_exports__["a"] = (ColorMatrixPrimitive);

/***/ }),
/* 276 */
/***/ (function(module, exports) {

module.exports = "varying vec2 v_texCoord;\nuniform sampler2D u_image;\nuniform mat4 u_colorMatrix;\nuniform vec4 u_colorMatrixOffset;\n\nvoid main() {\n  vec4 texColor = texture2D(u_image, v_texCoord);\n  gl_FragColor = texColor * u_colorMatrix + u_colorMatrixOffset;\n}\n"

/***/ }),
/* 277 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__primitive__ = __webpack_require__(12);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var DesaturationFilter = function (_Engine$Filter) {
  _inherits(DesaturationFilter, _Engine$Filter);

  function DesaturationFilter() {
    _classCallCheck(this, DesaturationFilter);

    var _this = _possibleConstructorReturn(this, (DesaturationFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(DesaturationFilter)).call(this));

    _this._fragmentSource = __webpack_require__(278);
    return _this;
  }

  /**
   * Applies this filter to the given inputTarget and renders it to
   * the given outputTarget using the CanvasRenderer
   * @param  {CanvasRenderer} renderer
   * @param  {RenderTarget} inputTarget
   * @param  {RenderTarget} outputTarget
   * @param  {Boolean} clear = false
   * @private
   */


  _createClass(DesaturationFilter, [{
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var canvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();
      var outputContext = outputTarget.getContext();

      var imageData = inputContext.getImageData(0, 0, canvas.width, canvas.height);

      var grayXfer = [0.3, 0.59, 0.11];
      var desaturation = this._options.desaturation;


      for (var i = 0; i < canvas.width * canvas.height; i++) {
        var index = i * 4;
        var gray = grayXfer[0] * imageData.data[index] / 255 + grayXfer[1] * imageData.data[index + 1] / 255 + grayXfer[2] * imageData.data[index + 2] / 255;

        imageData.data[index] += (gray * 255 - imageData.data[index]) * desaturation;
        imageData.data[index + 1] += (gray * 255 - imageData.data[index + 1]) * desaturation;
        imageData.data[index + 2] += (gray * 255 - imageData.data[index + 2]) * desaturation;
      }

      outputContext.putImageData(imageData, 0, 0);
    }
  }]);

  return DesaturationFilter;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].Filter);

/**
 * Specifies the available options for this filter
 * @type {Object}
 * @ignore
 */


DesaturationFilter.prototype.availableOptions = {
  desaturation: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 1, uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT }

  /**
   * Desaturation primitive
   * @class
   * @extends PhotoEditorSDK.Filters.Primitive
   * @memberof PhotoEditorSDK.FilterPrimitives
   */
};
var Desaturation = function (_Primitive) {
  _inherits(Desaturation, _Primitive);

  function Desaturation() {
    var _ref;

    _classCallCheck(this, Desaturation);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this2 = _possibleConstructorReturn(this, (_ref = Desaturation.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(Desaturation)).call.apply(_ref, [this].concat(args)));

    _this2._filter = new DesaturationFilter();
    return _this2;
  }

  /**
   * Updates the filter's uniforms
   */


  _createClass(Desaturation, [{
    key: 'update',
    value: function update() {
      this._filter.setDesaturation(this._options.desaturation);
    }
  }]);

  return Desaturation;
}(__WEBPACK_IMPORTED_MODULE_5__primitive__["a" /* default */]);

/**
 * Specifies the available options for this primitive
 * @type {Object}
 * @ignore
 */


Desaturation.prototype.availableOptions = DesaturationFilter.prototype.availableOptions;

/* harmony default export */ __webpack_exports__["a"] = (Desaturation);

/***/ }),
/* 278 */
/***/ (function(module, exports) {

module.exports = "varying vec2 v_texCoord;\nuniform sampler2D u_image;\nuniform float u_desaturation;\n\nvoid main() {\n  vec4 texColor = texture2D(u_image, v_texCoord);\n  vec3 grayXfer = vec3(0.3, 0.59, 0.11);\n  vec3 gray = vec3(dot(grayXfer, texColor.xyz));\n  gl_FragColor = vec4(mix(texColor.xyz, gray, u_desaturation) * texColor.a, texColor.a);\n}\n"

/***/ }),
/* 279 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__primitive__ = __webpack_require__(12);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/*
* This file is part of PhotoEditorSDK.
*
* Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, without
* modification, are permitted provided that the following license agreement
* is approved and a legal/financial contract was signed by the user.
* The license agreement can be found under following link:
*
* https://www.photoeditorsdk.com/LICENSE.txt
*/




var GammaFilter = function (_Engine$Filter) {
  _inherits(GammaFilter, _Engine$Filter);

  function GammaFilter() {
    _classCallCheck(this, GammaFilter);

    var _this = _possibleConstructorReturn(this, (GammaFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(GammaFilter)).call(this));

    _this._fragmentSource = __webpack_require__(280);
    return _this;
  }

  /**
  * Applies this filter to the given inputTarget and renders it to
  * the given outputTarget using the CanvasRenderer
  * @param  {CanvasRenderer} renderer
  * @param  {RenderTarget} inputTarget
  * @param  {RenderTarget} outputTarget
  * @param  {Boolean} clear = false
  * @private
  */


  _createClass(GammaFilter, [{
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var canvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();
      var outputContext = outputTarget.getContext();

      var imageData = inputContext.getImageData(0, 0, canvas.width, canvas.height);

      var gamma = this._options.gamma;
      // pre calculate lookup tables for each channel

      var gammaArrayRed = new Float32Array(256);
      for (var i = 0; i < 256; i++) {
        gammaArrayRed[i] = 255.0 * Math.pow(i / 255.0, gamma.r);
      }

      var gammaArrayGreen = new Float32Array(256);
      for (var _i = 0; _i < 256; _i++) {
        gammaArrayGreen[_i] = 255.0 * Math.pow(_i / 255.0, gamma.g);
      }

      var gammaArrayBlue = new Float32Array(256);
      for (var _i2 = 0; _i2 < 256; _i2++) {
        gammaArrayBlue[_i2] = 255.0 * Math.pow(_i2 / 255.0, gamma.b);
      }

      for (var _i3 = 0; _i3 < canvas.width * canvas.height; _i3++) {
        var index = _i3 * 4;
        imageData.data[index] = gammaArrayRed[imageData.data[index]];
        imageData.data[index + 1] = gammaArrayGreen[imageData.data[index + 1]];
        imageData.data[index + 2] = gammaArrayBlue[imageData.data[index + 2]];
      }

      outputContext.putImageData(imageData, 0, 0);
    }
  }]);

  return GammaFilter;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].Filter);

/**
* Specifies the available options for this filter
* @type {Object}
* @ignore
*/


GammaFilter.prototype.availableOptions = {
  gamma: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].COLOR, default: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Color"].WHITE, uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT3 }

  /**
  * Gamma primitive
  * @class
  * @extends PhotoEditorSDK.Filters.Primitive
  * @memberof PhotoEditorSDK.FilterPrimitives
  */
};
var Gamma = function (_Primitive) {
  _inherits(Gamma, _Primitive);

  function Gamma() {
    var _ref;

    _classCallCheck(this, Gamma);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this2 = _possibleConstructorReturn(this, (_ref = Gamma.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(Gamma)).call.apply(_ref, [this].concat(args)));

    _this2._filter = new GammaFilter();
    return _this2;
  }

  /**
  * Updates the filter's uniforms
  */


  _createClass(Gamma, [{
    key: 'update',
    value: function update() {
      this._filter.setGamma(this._options.gamma);
    }
  }]);

  return Gamma;
}(__WEBPACK_IMPORTED_MODULE_5__primitive__["a" /* default */]);

/**
* Specifies the available options for this primitive
* @type {Object}
* @ignore
*/


Gamma.prototype.availableOptions = GammaFilter.prototype.availableOptions;

/* harmony default export */ __webpack_exports__["a"] = (Gamma);

/***/ }),
/* 280 */
/***/ (function(module, exports) {

module.exports = "varying vec2 v_texCoord;\nuniform sampler2D u_image;\nuniform vec3 u_gamma;\n\nvoid main() {\n  vec4 texColor = texture2D(u_image, v_texCoord);\n  vec3 rgb = vec3(texColor.r, texColor.g, texColor.b);\n  rgb = pow(rgb, u_gamma);\n  gl_FragColor = vec4(rgb * texColor.a, texColor.a);;\n}\n"

/***/ }),
/* 281 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__primitive__ = __webpack_require__(12);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var GlowFilter = function (_Engine$Filter) {
  _inherits(GlowFilter, _Engine$Filter);

  function GlowFilter() {
    _classCallCheck(this, GlowFilter);

    var _this = _possibleConstructorReturn(this, (GlowFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(GlowFilter)).call(this));

    _this._fragmentSource = __webpack_require__(282);
    return _this;
  }

  /**
   * Applies this filter to the given inputTarget and renders it to
   * the given outputTarget using the CanvasRenderer
   * @param  {CanvasRenderer} renderer
   * @param  {RenderTarget} inputTarget
   * @param  {RenderTarget} outputTarget
   * @param  {Boolean} clear = false
   * @private
   */


  _createClass(GlowFilter, [{
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var canvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();
      var outputContext = outputTarget.getContext();

      var imageData = inputContext.getImageData(0, 0, canvas.width, canvas.height);

      var color = this._options.color;


      var d;
      for (var x = 0; x < canvas.width; x++) {
        for (var y = 0; y < canvas.height; y++) {
          var index = (canvas.width * y + x) * 4;

          var x01 = x / canvas.width;
          var y01 = y / canvas.height;

          var nx = (x01 - 0.5) / 0.75;
          var ny = (y01 - 0.5) / 0.75;

          var scalarX = nx * nx;
          var scalarY = ny * ny;
          d = 1 - (scalarX + scalarY);
          d = Math.min(Math.max(d, 0.1), 1.0);

          imageData.data[index] = imageData.data[index] * (d * color.r);
          imageData.data[index + 1] = imageData.data[index + 1] * (d * color.g);
          imageData.data[index + 2] = imageData.data[index + 2] * (d * color.b);
          imageData.data[index + 3] = 255;
        }
      }

      outputContext.putImageData(imageData, 0, 0);
    }
  }]);

  return GlowFilter;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].Filter);

/**
 * Specifies the available options for this filter
 * @type {Object}
 * @ignore
 */


GlowFilter.prototype.availableOptions = {
  color: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].COLOR, default: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Color"].WHITE, uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT3 }

  /**
   * Glow primitive
   * @class
   * @extends PhotoEditorSDK.Filters.Primitive
   * @memberof PhotoEditorSDK.FilterPrimitives
   */
};
var Glow = function (_Primitive) {
  _inherits(Glow, _Primitive);

  function Glow() {
    var _ref;

    _classCallCheck(this, Glow);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this2 = _possibleConstructorReturn(this, (_ref = Glow.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(Glow)).call.apply(_ref, [this].concat(args)));

    _this2._filter = new GlowFilter();
    return _this2;
  }

  /**
   * Updates the filter's uniforms
   */


  _createClass(Glow, [{
    key: 'update',
    value: function update() {
      this._filter.setColor(this._options.color);
    }
  }]);

  return Glow;
}(__WEBPACK_IMPORTED_MODULE_5__primitive__["a" /* default */]);

/**
 * Specifies the available options for this primitive
 * @type {Object}
 * @ignore
 */


Glow.prototype.availableOptions = GlowFilter.prototype.availableOptions;

/* harmony default export */ __webpack_exports__["a"] = (Glow);

/***/ }),
/* 282 */
/***/ (function(module, exports) {

module.exports = "varying vec2 v_texCoord;\nuniform sampler2D u_image;\n\nuniform vec3 u_color;\n\nvoid main() {\n  vec4 texColor = texture2D(u_image, v_texCoord);\n\n  vec2 textureCoord = v_texCoord - vec2(0.5, 0.5);\n  textureCoord /= 0.75;\n\n  float d = 1.0 - dot(textureCoord, textureCoord);\n  d = clamp(d, 0.2, 1.0);\n  vec3 newColor = texColor.rgb * d * u_color.rgb;\n  gl_FragColor = vec4(vec3(newColor) * texColor.a, texColor.a);\n}\n"

/***/ }),
/* 283 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__primitive__ = __webpack_require__(12);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var GobblinFilter = function (_Engine$Filter) {
  _inherits(GobblinFilter, _Engine$Filter);

  function GobblinFilter() {
    _classCallCheck(this, GobblinFilter);

    var _this = _possibleConstructorReturn(this, (GobblinFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(GobblinFilter)).call(this));

    _this._fragmentSource = __webpack_require__(284);
    return _this;
  }

  /**
   * Applies this filter to the given inputTarget and renders it to
   * the given outputTarget using the CanvasRenderer
   * @param  {CanvasRenderer} renderer
   * @param  {RenderTarget} inputTarget
   * @param  {RenderTarget} outputTarget
   * @param  {Boolean} clear = false
   * @private
   */


  _createClass(GobblinFilter, [{
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var canvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();
      var outputContext = outputTarget.getContext();

      var imageData = inputContext.getImageData(0, 0, canvas.width, canvas.height);

      for (var x = 0; x < canvas.width; x++) {
        for (var y = 0; y < canvas.height; y++) {
          var index = (canvas.width * y + x) * 4;

          imageData.data[index + 2] = imageData.data[index + 1] * 0.33;
          imageData.data[index] = imageData.data[index] * 0.6;
          imageData.data[index + 2] += imageData.data[index] * 0.33;
          imageData.data[index + 1] = imageData.data[index + 1] * 0.7;
          imageData.data[index + 3] = 255;
        }
      }

      outputContext.putImageData(imageData, 0, 0);
    }
  }]);

  return GobblinFilter;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].Filter);

/**
 * Gobblin primitive
 * @class
 * @extends PhotoEditorSDK.Filters.Primitive
 * @memberof PhotoEditorSDK.FilterPrimitives
 */


var Gobblin = function (_Primitive) {
  _inherits(Gobblin, _Primitive);

  function Gobblin() {
    var _ref;

    _classCallCheck(this, Gobblin);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this2 = _possibleConstructorReturn(this, (_ref = Gobblin.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(Gobblin)).call.apply(_ref, [this].concat(args)));

    _this2._filter = new GobblinFilter();
    return _this2;
  }

  return Gobblin;
}(__WEBPACK_IMPORTED_MODULE_5__primitive__["a" /* default */]);

/* harmony default export */ __webpack_exports__["a"] = (Gobblin);

/***/ }),
/* 284 */
/***/ (function(module, exports) {

module.exports = "varying vec2 v_texCoord;\nuniform sampler2D u_image;\n\nvoid main() {\n  vec4 texColor = texture2D(u_image, v_texCoord);\n  texColor.b = texColor.g * 0.33;\n  texColor.r = texColor.r * 0.6;\n  texColor.b += texColor.r * 0.33;\n  texColor.g = texColor.g * 0.7;\n  gl_FragColor = texColor;\n}\n"

/***/ }),
/* 285 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__primitive__ = __webpack_require__(12);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var GrayscaleFilter = function (_Engine$Filter) {
  _inherits(GrayscaleFilter, _Engine$Filter);

  function GrayscaleFilter() {
    _classCallCheck(this, GrayscaleFilter);

    var _this = _possibleConstructorReturn(this, (GrayscaleFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(GrayscaleFilter)).call(this));

    _this._fragmentSource = __webpack_require__(286);
    return _this;
  }

  /**
   * Applies this filter to the given inputTarget and renders it to
   * the given outputTarget using the CanvasRenderer
   * @param  {CanvasRenderer} renderer
   * @param  {RenderTarget} inputTarget
   * @param  {RenderTarget} outputTarget
   * @param  {Boolean} clear = false
   * @private
   */


  _createClass(GrayscaleFilter, [{
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var canvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();
      var outputContext = outputTarget.getContext();

      var imageData = inputContext.getImageData(0, 0, canvas.width, canvas.height);

      for (var x = 0; x < canvas.width; x++) {
        for (var y = 0; y < canvas.height; y++) {
          var index = (canvas.width * y + x) * 4;

          var luminance = imageData.data[index] * 0.2125 + imageData.data[index + 1] * 0.7154 + imageData.data[index + 2] * 0.0721;

          imageData.data[index] = luminance;
          imageData.data[index + 1] = luminance;
          imageData.data[index + 2] = luminance;
        }
      }

      outputContext.putImageData(imageData, 0, 0);
    }
  }]);

  return GrayscaleFilter;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].Filter);

/**
 * Grayscale primitive
 * @class
 * @extends PhotoEditorSDK.Filters.Primitive
 * @memberof PhotoEditorSDK.FilterPrimitives
 */


var Grayscale = function (_Primitive) {
  _inherits(Grayscale, _Primitive);

  function Grayscale() {
    var _ref;

    _classCallCheck(this, Grayscale);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this2 = _possibleConstructorReturn(this, (_ref = Grayscale.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(Grayscale)).call.apply(_ref, [this].concat(args)));

    _this2._filter = new GrayscaleFilter();
    return _this2;
  }

  return Grayscale;
}(__WEBPACK_IMPORTED_MODULE_5__primitive__["a" /* default */]);

/* harmony default export */ __webpack_exports__["a"] = (Grayscale);

/***/ }),
/* 286 */
/***/ (function(module, exports) {

module.exports = "varying vec2 v_texCoord;\nuniform sampler2D u_image;\nvec3 W = vec3(0.2125, 0.7154, 0.0721);\n\nvoid main() {\n  vec4 texColor = texture2D(u_image, v_texCoord);\n  float luminance = dot(texColor.rgb, W);\n  gl_FragColor = vec4(vec3(luminance) * texColor.a, texColor.a);\n}\n"

/***/ }),
/* 287 */
/***/ (function(module, exports) {

module.exports = "varying vec2 v_texCoord;\nuniform sampler2D u_image;\nuniform sampler2D u_lookupTable;\n\nvoid main() {\n  vec4 texColor = texture2D(u_image, v_texCoord);\n  float r = texture2D(u_lookupTable, vec2(texColor.r, 0.0)).r;\n  float g = texture2D(u_lookupTable, vec2(texColor.g, 0.0)).g;\n  float b = texture2D(u_lookupTable, vec2(texColor.b, 0.0)).b;\n\n  gl_FragColor = vec4(vec3(r, g, b) * texColor.a, texColor.a);\n}\n"

/***/ }),
/* 288 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__primitive__ = __webpack_require__(12);






var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



var Vector2 = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Math"].Vector2;


var TEXTURE_GL_UNIT = 3;

var LookupTableImageFilter = function (_Engine$Filter) {
  _inherits(LookupTableImageFilter, _Engine$Filter);

  function LookupTableImageFilter() {
    _classCallCheck(this, LookupTableImageFilter);

    var _this = _possibleConstructorReturn(this, (LookupTableImageFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(LookupTableImageFilter)).call(this));

    _this._precomputeQuads();
    _this._fragmentSource = __webpack_require__(289);
    return _this;
  }

  /**
   * This function pre-calculates an array that holds quads for each
   * of the 256 possible values of the blue channel
   * @private
   */


  _createClass(LookupTableImageFilter, [{
    key: '_precomputeQuads',
    value: function _precomputeQuads() {
      this._quads = [];
      for (var i = 0; i < 256; i++) {
        var blueColor = i / 255 * 63;
        var quad = new Vector2();

        quad.y = (blueColor | 0) * 0.125 | 0;
        quad.x = (blueColor | 0) - quad.y * 8;
        this._quads.push(quad);
      }
    }

    /**
     * Applies this filter to the given inputTarget and renders it to
     * the given outputTarget using the CanvasRenderer
     * @param  {CanvasRenderer} renderer
     * @param  {RenderTarget} inputTarget
     * @param  {RenderTarget} outputTarget
     * @param  {Boolean} clear = false
     * @private
     */

  }, {
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var canvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();
      var outputContext = outputTarget.getContext();

      var lutImage = this._options.lookupTableImage;
      var lutCanvas = this._createImageCanvas(lutImage);
      var lutContext = lutCanvas.getContext('2d');

      var inputImageData = inputContext.getImageData(0, 0, canvas.width, canvas.height);
      var filterImageData = lutContext.getImageData(0, 0, lutImage.width, lutImage.height);

      var texCoord = new Vector2();
      for (var index = 0; index < canvas.width * canvas.height * 4; index += 4) {
        var r = inputImageData.data[index];
        var g = inputImageData.data[index + 1];
        var b = inputImageData.data[index + 2];
        var a = inputImageData.data[index + 3] / 255;
        var quad = this._quads[b];

        // 64 since we have 8x8 tiles on a 512x512 texture.
        var tileSideLength = 64;

        // calculate pixel position of the coordinate origin.
        texCoord.x = quad.x * tileSideLength;
        texCoord.y = quad.y * tileSideLength;

        // now lookup the correct color within the tile.
        // the position of the pixel is indicated by the vector,
        // induced by the combination of the red and green vector.
        texCoord.x += Math.floor(r / 4); // r / 256 * 64 = r / 4
        texCoord.y += Math.floor(g / 4); // g / 256 * 64 = r / 4

        var texCoordIndex = (lutImage.width * texCoord.y + texCoord.x) * 4 | 0;
        var newR = filterImageData.data[texCoordIndex];
        newR = r * (1 - a) + newR * a;
        var newG = filterImageData.data[texCoordIndex + 1];
        newG = g * (1 - a) + newG * a;
        var newB = filterImageData.data[texCoordIndex + 2];
        newB = b * (1 - a) + newB * a;
        inputImageData.data[index] = newR;
        inputImageData.data[index + 1] = newG;
        inputImageData.data[index + 2] = newB;
      }
      outputContext.putImageData(inputImageData, 0, 0);
    }

    /**
     * Creates a canvas with the given image
     * @param  {Image} image
     * @return {HTMLCanvasElement}
     * @private
     */

  }, {
    key: '_createImageCanvas',
    value: function _createImageCanvas(image) {
      var canvas = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].createCanvas();
      canvas.width = image.width;
      canvas.height = image.height;

      var context = canvas.getContext('2d');
      context.drawImage(image, 0, 0);

      return canvas;
    }
  }]);

  return LookupTableImageFilter;
}(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].Filter);

/**
 * Specifies the available options for this filter
 * @type {Object}
 * @ignore
 */


LookupTableImageFilter.prototype.availableOptions = {
  lookupTable: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: TEXTURE_GL_UNIT, uniformType: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["UniformType"].INT },
  lookupTableImage: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].IMAGE, uniformType: null }

  /**
   * Stores a 256 byte long lookup table in a 2d texture which will be
   * used to look up the corresponding value for each channel.
   * @class
   * @extends PhotoEditorSDK.Filters.Primitive
   * @memberof PhotoEditorSDK.FilterPrimitives
   */
};
var LookupTableImage = function (_Primitive) {
  _inherits(LookupTableImage, _Primitive);

  function LookupTableImage() {
    var _ref;

    _classCallCheck(this, LookupTableImage);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this2 = _possibleConstructorReturn(this, (_ref = LookupTableImage.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(LookupTableImage)).call.apply(_ref, [this].concat(args)));

    _this2._filter = new LookupTableImageFilter();
    _this2._textures = {};
    return _this2;
  }

  /**
   * Gets called before this primitive's filter is being applied
   * @param {PhotoEditorSDK} sdk
   */


  _createClass(LookupTableImage, [{
    key: 'update',
    value: function update(sdk) {
      var renderer = sdk.getRenderer();
      /* istanbul ignore if */
      if (renderer.isOfType(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["RendererType"].WEBGL)) {
        this._updateWebGLTexture(sdk);
      } else if (renderer.isOfType(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["RendererType"].CANVAS)) {
        this._filter.setLookupTableImage(this._options.image);
      }
    }

    /**
     * Updates the lookup table texture (WebGL only)
     * @param {PhotoEditorSDK} sdk
     * @private
     */
    /* istanbul ignore next */

  }, {
    key: '_updateWebGLTexture',
    value: function _updateWebGLTexture(sdk) {
      var renderer = sdk.getRenderer();
      var id = renderer.id;

      if (!this._textures[id]) {
        this._textures[id] = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].BaseTexture();
      }

      var texture = this._textures[id];
      texture.setSource(this._options.image);
      texture.setGLUnit(TEXTURE_GL_UNIT);

      renderer.updateTexture(texture);
    }

    /**
     * Cleans up this primitive
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      _get(LookupTableImage.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(LookupTableImage.prototype), 'dispose', this).call(this);
      for (var id in this._textures) {
        delete this._textures[id];
      }
    }
  }]);

  return LookupTableImage;
}(__WEBPACK_IMPORTED_MODULE_6__primitive__["a" /* default */]);

LookupTableImage.prototype.availableOptions = {
  image: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].IMAGE }
};

/* harmony default export */ __webpack_exports__["a"] = (LookupTableImage);

/***/ }),
/* 289 */
/***/ (function(module, exports) {

module.exports = "/**\n * Based off of GPUImage's LookupFilter:\n * https://github.com/BradLarson/GPUImage/blob/master/framework/Source/GPUImageLookupFilter.m\n */\n\nvarying vec2 v_texCoord;\nuniform sampler2D u_image;\nuniform sampler2D u_lookupTable;\n\nvoid main() {\n  vec4 texColor = texture2D(u_image, v_texCoord);\n  float blueColor = texColor.b * 63.0;\n\n  vec2 quad1;\n  quad1.y = floor(floor(blueColor) / 8.0);\n  quad1.x = floor(blueColor) - (quad1.y * 8.0);\n\n  vec2 quad2;\n  quad2.y = floor(ceil(blueColor) / 8.0);\n  quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n\n  vec2 texCoord1;\n  texCoord1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * texColor.r);\n  texCoord1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * texColor.g);\n\n  vec2 texCoord2;\n  texCoord2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * texColor.r);\n  texCoord2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * texColor.g);\n\n  vec4 newColor1 = texture2D(u_lookupTable, texCoord1);\n  vec4 newColor2 = texture2D(u_lookupTable, texCoord2);\n\n  vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n  gl_FragColor = mix(texColor, vec4(newColor.rgb, texColor.w), texColor.a);\n}\n"

/***/ }),
/* 290 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__primitive__ = __webpack_require__(12);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var SaturationFilter = function (_Engine$Filter) {
  _inherits(SaturationFilter, _Engine$Filter);

  function SaturationFilter() {
    _classCallCheck(this, SaturationFilter);

    var _this = _possibleConstructorReturn(this, (SaturationFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(SaturationFilter)).call(this));

    _this._fragmentSource = __webpack_require__(291);
    return _this;
  }

  /**
   * Applies this filter to the given inputTarget and renders it to
   * the given outputTarget using the CanvasRenderer
   * @param  {CanvasRenderer} renderer
   * @param  {RenderTarget} inputTarget
   * @param  {RenderTarget} outputTarget
   * @param  {Boolean} clear = false
   * @private
   */


  _createClass(SaturationFilter, [{
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var canvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();
      var outputContext = outputTarget.getContext();

      var imageData = inputContext.getImageData(0, 0, canvas.width, canvas.height);
      var saturation = this._options.saturation;


      for (var x = 0; x < canvas.width; x++) {
        for (var y = 0; y < canvas.height; y++) {
          var index = (canvas.width * y + x) * 4;

          var luminance = imageData.data[index] * 0.2125 + imageData.data[index + 1] * 0.7154 + imageData.data[index + 2] * 0.0721;
          imageData.data[index] = luminance * (1 - saturation) + imageData.data[index] * saturation;
          imageData.data[index + 1] = luminance * (1 - saturation) + imageData.data[index + 1] * saturation;
          imageData.data[index + 2] = luminance * (1 - saturation) + imageData.data[index + 2] * saturation;
        }
      }

      outputContext.putImageData(imageData, 0, 0);
    }
  }]);

  return SaturationFilter;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].Filter);

/**
 * Specifies the available options for this filter
 * @type {Object}
 * @ignore
 */


SaturationFilter.prototype.availableOptions = {
  saturation: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 0, uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT }

  /**
   * Saturation primitive
   * @class
   * @extends PhotoEditorSDK.Filters.Primitive
   * @memberof PhotoEditorSDK.FilterPrimitives
   */
};
var Saturation = function (_Primitive) {
  _inherits(Saturation, _Primitive);

  function Saturation() {
    var _ref;

    _classCallCheck(this, Saturation);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this2 = _possibleConstructorReturn(this, (_ref = Saturation.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(Saturation)).call.apply(_ref, [this].concat(args)));

    _this2._filter = new SaturationFilter();
    return _this2;
  }

  /**
   * Updates the filter's uniforms
   */


  _createClass(Saturation, [{
    key: 'update',
    value: function update() {
      this._filter.setSaturation(this._options.saturation);
    }
  }]);

  return Saturation;
}(__WEBPACK_IMPORTED_MODULE_5__primitive__["a" /* default */]);

/**
 * Specifies the available options for this primitive
 * @type {Object}
 * @ignore
 */


Saturation.prototype.availableOptions = SaturationFilter.prototype.availableOptions;

/* harmony default export */ __webpack_exports__["a"] = (Saturation);

/***/ }),
/* 291 */
/***/ (function(module, exports) {

module.exports = "varying vec2 v_texCoord;\nuniform sampler2D u_image;\nuniform float u_saturation;\n\nconst vec3 luminanceWeighting = vec3(0.2125, 0.7154, 0.0721);\n\nvoid main() {\n  vec4 texColor = texture2D(u_image, v_texCoord);\n  float luminance = dot(texColor.rgb, luminanceWeighting);\n\n  vec3 greyScaleColor = vec3(luminance);\n\n  gl_FragColor = vec4(mix(greyScaleColor, texColor.rgb, u_saturation) * texColor.a, texColor.a);\n}\n"

/***/ }),
/* 292 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__primitive__ = __webpack_require__(12);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var SoftColorOverlayFilter = function (_Engine$Filter) {
  _inherits(SoftColorOverlayFilter, _Engine$Filter);

  function SoftColorOverlayFilter() {
    _classCallCheck(this, SoftColorOverlayFilter);

    var _this = _possibleConstructorReturn(this, (SoftColorOverlayFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(SoftColorOverlayFilter)).call(this));

    _this._fragmentSource = __webpack_require__(293);
    return _this;
  }

  /**
   * Applies this filter to the given inputTarget and renders it to
   * the given outputTarget using the CanvasRenderer
   * @param  {CanvasRenderer} renderer
   * @param  {RenderTarget} inputTarget
   * @param  {RenderTarget} outputTarget
   * @param  {Boolean} clear = false
   * @private
   */


  _createClass(SoftColorOverlayFilter, [{
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var canvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();
      var outputContext = outputTarget.getContext();

      var imageData = inputContext.getImageData(0, 0, canvas.width, canvas.height);

      for (var x = 0; x < canvas.width; x++) {
        for (var y = 0; y < canvas.height; y++) {
          var index = (canvas.width * y + x) * 4;

          imageData.data[index] = Math.max(this._options.color.r * 255, imageData.data[index]);
          imageData.data[index + 1] = Math.max(this._options.color.g * 255, imageData.data[index + 1]);
          imageData.data[index + 2] = Math.max(this._options.color.b * 255, imageData.data[index + 2]);
        }
      }

      outputContext.putImageData(imageData, 0, 0);
    }
  }]);

  return SoftColorOverlayFilter;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].Filter);

/**
 * Specifies the available options for this filter
 * @type {Object}
 * @ignore
 */


SoftColorOverlayFilter.prototype.availableOptions = {
  color: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].COLOR, default: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Color"].WHITE, uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT3 }

  /**
   * SoftColorOverlay primitive
   * @class
   * @extends PhotoEditorSDK.Filters.Primitive
   * @memberof PhotoEditorSDK.FilterPrimitives
   */
};
var SoftColorOverlay = function (_Primitive) {
  _inherits(SoftColorOverlay, _Primitive);

  function SoftColorOverlay() {
    var _ref;

    _classCallCheck(this, SoftColorOverlay);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this2 = _possibleConstructorReturn(this, (_ref = SoftColorOverlay.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(SoftColorOverlay)).call.apply(_ref, [this].concat(args)));

    _this2._filter = new SoftColorOverlayFilter();
    return _this2;
  }

  /**
   * Updates the filter's uniforms
   */


  _createClass(SoftColorOverlay, [{
    key: 'update',
    value: function update() {
      this._filter.setColor(this._options.color);
    }
  }]);

  return SoftColorOverlay;
}(__WEBPACK_IMPORTED_MODULE_5__primitive__["a" /* default */]);

/**
 * Specifies the available options for this primitive
 * @type {Object}
 * @ignore
 */


SoftColorOverlay.prototype.availableOptions = SoftColorOverlayFilter.prototype.availableOptions;

/* harmony default export */ __webpack_exports__["a"] = (SoftColorOverlay);

/***/ }),
/* 293 */
/***/ (function(module, exports) {

module.exports = "varying vec2 v_texCoord;\nuniform sampler2D u_image;\nuniform vec3 u_color;\n\nvoid main() {\n  vec4 texColor = texture2D(u_image, v_texCoord);\n  vec4 overlayVec4 = vec4(u_color, texColor.a);\n  gl_FragColor = max(overlayVec4 * texColor.a, texColor);\n}\n"

/***/ }),
/* 294 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__lookup_table__ = __webpack_require__(146);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * Tone curve primitive
 * @class
 * @extends PhotoEditorSDK.Filters.Primitives.LookupTable
 * @memberof PhotoEditorSDK.FilterPrimitives
 */

var ToneCurve = function (_LookupTable) {
  _inherits(ToneCurve, _LookupTable);

  function ToneCurve() {
    var _ref;

    _classCallCheck(this, ToneCurve);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = ToneCurve.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(ToneCurve)).call.apply(_ref, [this].concat(args)));

    if (!_this._options.rgbControlPoints) {
      _this._options.rgbControlPoints = {
        red: _this._options.controlPoints,
        green: _this._options.controlPoints,
        blue: _this._options.controlPoints
      };
    }

    _this._updateLookupTable();
    return _this;
  }

  /**
   * Calculates the lookup table
   * @private
   */


  _createClass(ToneCurve, [{
    key: '_updateLookupTable',
    value: function _updateLookupTable() {
      var r = this._calculateSplineCurve(this._options.rgbControlPoints.red);
      var g = this._calculateSplineCurve(this._options.rgbControlPoints.green);
      var b = this._calculateSplineCurve(this._options.rgbControlPoints.blue);

      this._options.data = this._buildLookupTable(r, g, b);
    }

    /**
     * Builds the lookup table
     * @param  {Array} r
     * @param  {Array} g
     * @param  {Array} b
     * @return {Array}
     * @private
     */

  }, {
    key: '_buildLookupTable',
    value: function _buildLookupTable(r, g, b) {
      var data = [];

      for (var i = 0; i < 256; i++) {
        data.push(Math.min(Math.max(i + r[i], 0), 255));
        data.push(Math.min(Math.max(i + g[i], 0), 255));
        data.push(Math.min(Math.max(i + b[i], 0), 255));
        data.push(255);
      }

      return data;
    }

    /**
     * Calculates the spline curve data for the given points
     * @param  {Array.<Array.<Number>>} points
     * @return {Array.<Number>}
     */

  }, {
    key: '_calculateSplineCurve',
    value: function _calculateSplineCurve(points) {
      points = points.sort(function (a, b) {
        return a[0] > b[0];
      });

      var splinePoints = this._getSplineCurve(points);
      var firstSplinePoint = splinePoints[0];
      var i;

      if (firstSplinePoint[0] > 0) {
        for (i = 0; i < firstSplinePoint[0]; i++) {
          splinePoints.unshift([0, 0]);
        }
      }

      var preparedPoints = [];
      for (i = 0; i < splinePoints.length; i++) {
        var newPoint = splinePoints[i];
        var origPoint = [newPoint[0], newPoint[0]];

        var distance = Math.sqrt(Math.pow(origPoint[0] - newPoint[0], 2) + Math.pow(origPoint[1] - newPoint[1], 2));

        if (origPoint[1] > newPoint[1]) {
          distance = -distance;
        }

        preparedPoints.push(distance);
      }

      return preparedPoints;
    }
  }, {
    key: '_getSplineCurve',
    value: function _getSplineCurve(points) {
      var sdA = this._secondDerivative(points);

      var n = sdA.length;
      var sd = [];
      var i;

      for (i = 0; i < n; i++) {
        sd[i] = sdA[i];
      }

      var output = [];

      for (i = 0; i < n - 1; i++) {
        var cur = points[i];
        var next = points[i + 1];

        for (var x = cur[0]; x < next[0]; x++) {
          var t = (x - cur[0]) / (next[0] - cur[0]);

          var a = 1 - t;
          var b = t;
          var h = next[0] - cur[0];

          var y = a * cur[1] + b * next[1] + h * h / 6 * ((a * a * a - a) * sd[i] + (b * b * b - b) * sd[i + 1]);

          if (y > 255) {
            y = 255;
          } else if (y < 0) {
            y = 0;
          }

          output.push([x, y]);
        }
      }

      if (output.length === 255) {
        output.push(points[points.length - 1]);
      }

      return output;
    }
  }, {
    key: '_secondDerivative',
    value: function _secondDerivative(points) {
      var n = points.length;
      if (n <= 0 || n === 1) {
        return null;
      }

      var matrix = [];
      var result = [];
      var i, k;

      matrix[0] = [0, 1, 0];

      for (i = 1; i < n - 1; i++) {
        var P1 = points[i - 1];
        var P2 = points[i];
        var P3 = points[i + 1];

        matrix[i] = matrix[i] || [];
        matrix[i][0] = (P2[0] - P1[0]) / 6;
        matrix[i][1] = (P3[0] - P1[0]) / 3;
        matrix[i][2] = (P3[0] - P2[0]) / 6;
        result[i] = (P3[1] - P2[1]) / (P3[0] - P2[0]) - (P2[1] - P1[1]) / (P2[0] - P1[0]);
      }

      result[0] = 0;
      result[n - 1] = 0;

      matrix[n - 1] = [0, 1, 0];

      // Pass 1
      for (i = 1; i < n; i++) {
        k = matrix[1][0] / matrix[i - 1][1];
        matrix[i][1] -= k * matrix[i - 1][2];
        matrix[i][0] = 0;
        result[i] -= k * result[i - 1];
      }

      // Pass 2
      for (i = n - 2; i > 0; i--) {
        k = matrix[i][2] / matrix[i + 1][1];
        matrix[i][1] -= k * matrix[i + 1][0];
        matrix[i][2] = 0;
        result[i] -= k * result[i + 1];
      }

      var y2 = [];
      for (i = 0; i < n; i++) {
        y2[i] = result[i] / matrix[i][1];
      }

      return y2;
    }
  }]);

  return ToneCurve;
}(__WEBPACK_IMPORTED_MODULE_5__lookup_table__["a" /* default */]);

/**
 * Specifies the available options for this primitive
 * @type {Object}
 * @ignore
 */


ToneCurve.prototype.availableOptions = {
  rgbControlPoints: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].OBJECT },
  controlPoints: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].ARRAY, default: [] },
  textureGLUnit: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 1 }
};

/* harmony default export */ __webpack_exports__["a"] = (ToneCurve);

/***/ }),
/* 295 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__primitive__ = __webpack_require__(12);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var X400Filter = function (_Engine$Filter) {
  _inherits(X400Filter, _Engine$Filter);

  function X400Filter() {
    _classCallCheck(this, X400Filter);

    var _this = _possibleConstructorReturn(this, (X400Filter.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(X400Filter)).call(this));

    _this._fragmentSource = __webpack_require__(296);
    return _this;
  }

  /**
   * Applies this filter to the given inputTarget and renders it to
   * the given outputTarget using the CanvasRenderer
   * @param  {CanvasRenderer} renderer
   * @param  {RenderTarget} inputTarget
   * @param  {RenderTarget} outputTarget
   * @param  {Boolean} clear = false
   * @private
   */


  _createClass(X400Filter, [{
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var canvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();
      var outputContext = outputTarget.getContext();

      var imageData = inputContext.getImageData(0, 0, canvas.width, canvas.height);

      for (var x = 0; x < canvas.width; x++) {
        for (var y = 0; y < canvas.height; y++) {
          var index = (canvas.width * y + x) * 4;

          var gray = imageData.data[index] / 255 * 0.3 + imageData.data[index + 1] / 255 * 0.3 + imageData.data[index + 2] / 255 * 0.3;
          gray -= 0.2;
          gray = Math.max(0.0, Math.min(1.0, gray));
          gray += 0.15;
          gray *= 1.4;

          gray *= 255;
          imageData.data[index] = gray;
          imageData.data[index + 1] = gray;
          imageData.data[index + 2] = gray;
        }
      }

      outputContext.putImageData(imageData, 0, 0);
    }
  }]);

  return X400Filter;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].Filter);

/**
 * X400 primitive
 * @class
 * @extends PhotoEditorSDK.Filters.Primitive
 * @memberof PhotoEditorSDK.FilterPrimitives
 */


var X400 = function (_Primitive) {
  _inherits(X400, _Primitive);

  function X400() {
    var _ref;

    _classCallCheck(this, X400);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this2 = _possibleConstructorReturn(this, (_ref = X400.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(X400)).call.apply(_ref, [this].concat(args)));

    _this2._filter = new X400Filter();
    return _this2;
  }

  return X400;
}(__WEBPACK_IMPORTED_MODULE_5__primitive__["a" /* default */]);

/* harmony default export */ __webpack_exports__["a"] = (X400);

/***/ }),
/* 296 */
/***/ (function(module, exports) {

module.exports = "varying vec2 v_texCoord;\nuniform sampler2D u_image;\n\nvoid main() {\n  vec4 texColor = texture2D(u_image, v_texCoord);\n  float gray = texColor.r * 0.3 + texColor.g * 0.3 + texColor.b * 0.3;\n  gray -= 0.2;\n  gray = clamp(gray, 0.0, 1.0);\n  gray += 0.15;\n  gray *= 1.4;\n  gl_FragColor = vec4(vec3(gray) * texColor.a, texColor.a);\n}\n"

/***/ }),
/* 297 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__primitive__ = __webpack_require__(12);






var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



var Vector2 = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Math"].Vector2,
    Vector3 = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Math"].Vector3;


var TEXTURE_GL_UNIT = 3;

var ThreeDLookupTableImageFilter = function (_Engine$Filter) {
  _inherits(ThreeDLookupTableImageFilter, _Engine$Filter);

  function ThreeDLookupTableImageFilter() {
    _classCallCheck(this, ThreeDLookupTableImageFilter);

    var _this = _possibleConstructorReturn(this, (ThreeDLookupTableImageFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(ThreeDLookupTableImageFilter)).call(this));

    _this._precomputeQuads();
    _this._fragmentSource = __webpack_require__(298);
    return _this;
  }

  /**
   * This function pre-calculates an array that holds quads for each
   * of the 256 possible values of the blue channel
   * @private
   */


  _createClass(ThreeDLookupTableImageFilter, [{
    key: '_precomputeQuads',
    value: function _precomputeQuads() {
      this._quads = [];
      for (var i = 0; i < 256; i++) {
        var blueColor = i / 255 * 63;
        var quad = new Vector2();

        quad.y = (blueColor | 0) * 0.125 | 0;
        quad.x = (blueColor | 0) - quad.y * 8;
        this._quads.push(quad);
      }
    }

    /**
     * Applies this filter to the given inputTarget and renders it to
     * the given outputTarget using the CanvasRenderer
     * @param  {CanvasRenderer} renderer
     * @param  {RenderTarget} inputTarget
     * @param  {RenderTarget} outputTarget
     * @param  {Boolean} clear = false
     * @private
     */

  }, {
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
      var _options = this._options,
          resolution = _options.resolution,
          horizontalTileCount = _options.horizontalTileCount,
          verticalTileCount = _options.verticalTileCount;


      var canvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();
      var outputContext = outputTarget.getContext();

      var lutImage = this._options.lookupTableImage;
      var lutCanvas = this._createImageCanvas(lutImage);
      var lutContext = lutCanvas.getContext('2d');

      var inputImageData = inputContext.getImageData(0, 0, canvas.width, canvas.height);
      var lutImageData = lutContext.getImageData(0, 0, lutImage.width, lutImage.height);

      // const rRange = Math.floor(resolution / horizontalTileCount - 1)
      // const gRange = Math.floor(resolution / verticalTileCount - 1)
      // const bRange = Math.floor(horizontalTileCount * verticalTileCount - 1)

      var ranges = new Vector3(resolution / horizontalTileCount - 1 | 0, resolution / verticalTileCount - 1 | 0, horizontalTileCount * verticalTileCount - 1 | 0);

      var inputColor = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Color"]();
      var outputColor = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Color"]();
      var lutColorFB = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Color"]();
      var lutColorCB = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Color"]();

      var cRfGf = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Color"]();
      var cRfGc = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Color"]();
      var cRcGf = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Color"]();
      var cRcGc = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Color"]();

      var tileFloor = new Vector2();
      var tileCeil = new Vector2();

      var mix = function mix(target, x, y, a) {
        target.r = x.r * (1 - a) + y.r * a;
        target.g = x.g * (1 - a) + y.g * a;
        target.b = x.b * (1 - a) + y.b * a;
      };

      var lookup = function lookup(target, x, y) {
        x = 0.5 + x | 0;
        y = 0.5 + y | 0;
        var index = (y * resolution + x) * 4;
        target.r = lutImageData.data[index] / 255;
        target.g = lutImageData.data[index + 1] / 255;
        target.b = lutImageData.data[index + 2] / 255;
        target.a = lutImageData.data[index + 3] / 255;
      };

      var interpolateTempA = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Color"]();
      var interpolateTempB = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Color"]();
      var bilinearInterpolate = function bilinearInterpolate(target, cRfGf, cRfGc, cRcGf, cRcGc, redFract, greenFract) {
        mix(interpolateTempA, cRfGf, cRcGf, redFract);
        mix(interpolateTempB, cRfGc, cRcGc, redFract);
        mix(target, interpolateTempA, interpolateTempB, greenFract);
      };

      var pixelsPerTile = new Vector2(resolution, resolution).divide(horizontalTileCount, verticalTileCount).floor();
      for (var index = 0; index < canvas.width * canvas.height * 4; index += 4) {
        inputColor.set(inputImageData.data[index] / 255, inputImageData.data[index + 1] / 255, inputImageData.data[index + 2] / 255, inputImageData.data[index + 3] / 255);

        var tmp = new Vector3(inputColor.r * ranges.x, inputColor.g * ranges.y, inputColor.b * ranges.z);

        var floors = tmp.clone().floor().toInt();
        var ceils = tmp.clone().ceil().toInt();
        var fracts = tmp.clone().fract();

        tileFloor.y = floors.z / horizontalTileCount | 0;
        tileFloor.x = floors.z - tileFloor.y * horizontalTileCount | 0;

        tileCeil.y = ceils.z / horizontalTileCount | 0;
        tileCeil.x = ceils.z - tileCeil.y * horizontalTileCount | 0;

        tileFloor.multiply(pixelsPerTile);
        tileCeil.multiply(pixelsPerTile);

        lookup(cRfGf, tileFloor.x + floors.x, tileFloor.y + floors.y);
        lookup(cRfGc, tileFloor.x + floors.x, tileFloor.y + ceils.y);
        lookup(cRcGf, tileFloor.x + ceils.x, tileFloor.y + floors.y);
        lookup(cRcGc, tileFloor.x + ceils.x, tileFloor.y + ceils.y);

        bilinearInterpolate(lutColorFB, cRfGf, cRfGc, cRcGf, cRcGc, fracts.x, fracts.y);

        lookup(cRfGf, tileCeil.x + floors.x, tileCeil.y + floors.y);
        lookup(cRfGc, tileCeil.x + floors.x, tileCeil.y + ceils.y);
        lookup(cRcGf, tileCeil.x + ceils.x, tileCeil.y + floors.y);
        lookup(cRcGc, tileCeil.x + ceils.x, tileCeil.y + ceils.y);

        bilinearInterpolate(lutColorCB, cRfGf, cRfGc, cRcGf, cRcGc, fracts.x, fracts.y);

        mix(outputColor, lutColorFB, lutColorCB, fracts.z);

        // interpolation = clamp(Math.floor(outputColor * 255. + .5) / 255., 0.0, 1.0);

        inputImageData.data[index] = Math.ceil(outputColor.r * 255);
        inputImageData.data[index + 1] = Math.ceil(outputColor.g * 255);
        inputImageData.data[index + 2] = Math.ceil(outputColor.b * 255);
      }
      outputContext.putImageData(inputImageData, 0, 0);
    }

    /**
     * Creates a canvas with the given image
     * @param  {Image} image
     * @return {HTMLCanvasElement}
     * @private
     */

  }, {
    key: '_createImageCanvas',
    value: function _createImageCanvas(image) {
      var canvas = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].createCanvas();
      canvas.width = image.width;
      canvas.height = image.height;

      var context = canvas.getContext('2d');
      context.drawImage(image, 0, 0);

      return canvas;
    }
  }]);

  return ThreeDLookupTableImageFilter;
}(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].Filter);

/**
 * Specifies the available options for this filter
 * @type {Object}
 * @ignore
 */


ThreeDLookupTableImageFilter.prototype.availableOptions = {
  lookupTable: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: TEXTURE_GL_UNIT, uniformType: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["UniformType"].INT },
  lookupTableImage: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].IMAGE, uniformType: null },
  resolution: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 128, uniformType: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["UniformType"].FLOAT },
  horizontalTileCount: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 5, uniformType: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["UniformType"].FLOAT },
  verticalTileCount: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 5, uniformType: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["UniformType"].FLOAT }

  /**
   * Stores a 256 byte long lookup table in a 2d texture which will be
   * used to look up the corresponding value for each channel.
   * @class
   * @extends PhotoEditorSDK.Filters.Primitive
   * @memberof PhotoEditorSDK.FilterPrimitives
   */
};
var LookupTableImage = function (_Primitive) {
  _inherits(LookupTableImage, _Primitive);

  function LookupTableImage() {
    var _ref;

    _classCallCheck(this, LookupTableImage);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this2 = _possibleConstructorReturn(this, (_ref = LookupTableImage.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(LookupTableImage)).call.apply(_ref, [this].concat(args)));

    _this2._filter = new ThreeDLookupTableImageFilter();
    _this2._textures = {};
    return _this2;
  }

  /**
   * Gets called before this primitive's filter is being applied
   * @param {PhotoEditorSDK} sdk
   */


  _createClass(LookupTableImage, [{
    key: 'update',
    value: function update(sdk) {
      var renderer = sdk.getRenderer();
      /* istanbul ignore if */
      if (renderer.isOfType(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["RendererType"].WEBGL)) {
        this._updateWebGLTexture(sdk);
      } else if (renderer.isOfType(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["RendererType"].CANVAS)) {
        this._filter.setLookupTableImage(this._options.image);
      }

      var _options2 = this._options,
          resolution = _options2.resolution,
          verticalTileCount = _options2.verticalTileCount,
          horizontalTileCount = _options2.horizontalTileCount;

      this._filter.set({
        resolution: resolution, verticalTileCount: verticalTileCount, horizontalTileCount: horizontalTileCount
      });
    }

    /**
     * Updates the lookup table texture (WebGL only)
     * @param {PhotoEditorSDK} sdk
     * @private
     */
    /* istanbul ignore next */

  }, {
    key: '_updateWebGLTexture',
    value: function _updateWebGLTexture(sdk) {
      var renderer = sdk.getRenderer();
      var id = renderer.id;

      if (!this._textures[id]) {
        this._textures[id] = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].BaseTexture();
      }

      var texture = this._textures[id];
      texture.setSource(this._options.image);
      texture.setGLUnit(TEXTURE_GL_UNIT);
      texture.setMinFilter(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].BaseTexture.NearestFilter);

      renderer.updateTexture(texture);
    }

    /**
     * Cleans up this primitive
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      _get(LookupTableImage.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(LookupTableImage.prototype), 'dispose', this).call(this);
      for (var id in this._textures) {
        delete this._textures[id];
      }
    }
  }]);

  return LookupTableImage;
}(__WEBPACK_IMPORTED_MODULE_6__primitive__["a" /* default */]);

LookupTableImage.prototype.availableOptions = {
  image: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].IMAGE },
  resolution: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 128 },
  horizontalTileCount: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 5 },
  verticalTileCount: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 5 }
};

/* harmony default export */ __webpack_exports__["a"] = (LookupTableImage);

/***/ }),
/* 298 */
/***/ (function(module, exports) {

module.exports = "precision highp float;\n\nuniform sampler2D u_image;\n\nuniform sampler2D u_lookupTable;\n\nuniform float u_resolution;     // Texture-Resolution, must be power of 2: 64, 128, 256, 512, 1024, 2048, 4096\nuniform float u_horizontalTileCount; // Horizontal Blue Tiles\nuniform float u_verticalTileCount; // Vertical Blue Tiles\n\nvarying vec2 v_texCoord;\n\nconst float EPSILON = 0.000001;\n\n// Try to get the exact pixel of the lut map image\nvec3 lutColor(int texPosX, int texPosY) {\n    return texture2D(u_lookupTable, (0.5 / u_resolution) + vec2(float(texPosX), float(texPosY)) / u_resolution).rgb;\n}\n\nvec3 bilinearInterpolate(vec3 cRfGf, vec3 cRfGc, vec3 cRcGf, vec3 cRcGc, float redFract, float greenFract) {\n    return mix(mix(cRfGf, cRcGf, redFract), mix(cRfGc, cRcGc, redFract), greenFract);\n}\n\nvoid main() {\n    vec4 inputColor = clamp(texture2D(u_image, v_texCoord.xy), 0.0, 1.0);\n\n    vec3 sourceColor = vec3(inputColor.rgb / max(inputColor.a, EPSILON)); \n\n    vec3 ranges = vec3(\n        floor(u_resolution / u_horizontalTileCount - 1.0),\n        floor(u_resolution / u_verticalTileCount - 1.0),\n        floor(u_horizontalTileCount * u_horizontalTileCount - 1.0)\n    );\n    \n    vec3 tmp = sourceColor * ranges;\n    ivec3 floors = ivec3(tmp);\n    ivec3 ceils = ivec3(ceil(tmp));\n    vec3 fracts = fract(tmp);\n\n    // Map tile index to tile pixel pos.\n    ivec2 pixelsPerTile = ivec2(\n        u_resolution / u_horizontalTileCount, \n        u_resolution / u_verticalTileCount\n      );\n\n    ivec2 tileFloor; // Blue tile index\n    tileFloor.y = floors.z / int(u_horizontalTileCount);\n    tileFloor.x = (floors.z - (tileFloor.y * int(u_horizontalTileCount)));\n\n    ivec2 tileCeil; // Blue tile index\n    tileCeil.y = ceils.z / int(u_horizontalTileCount);\n    tileCeil.x = (ceils.z - (tileCeil.y * int(u_horizontalTileCount)));\n    \n    tileFloor *= pixelsPerTile;\n    tileCeil *= pixelsPerTile; \n    \n    \n    // Interpolate between red and green\n    vec3 lutColorFB = bilinearInterpolate(\n        lutColor(tileFloor.x + floors.x, tileFloor.y + floors.y),\n        lutColor(tileFloor.x + floors.x, tileFloor.y + ceils.y),\n        lutColor(tileFloor.x + ceils.x,  tileFloor.y + floors.y),\n        lutColor(tileFloor.x + ceils.x,  tileFloor.y + ceils.y),\n        fracts.x, fracts.y\n    );\n    vec3 lutColorCB = bilinearInterpolate(\n        lutColor(tileCeil.x + floors.x, tileCeil.y + floors.y),\n        lutColor(tileCeil.x + floors.x, tileCeil.y + ceils.y),\n        lutColor(tileCeil.x + ceils.x,  tileCeil.y + floors.y),\n        lutColor(tileCeil.x + ceils.x,  tileCeil.y + ceils.y),\n        fracts.x, fracts.y\n    );\n\n    // Interpolate between the blue values\n    vec3 interpolation = mix(lutColorFB, lutColorCB, fracts.z);\n\n    // Round Color Values to prevent that for ex. 254.999999 is cutting to 254 instead of 255;\n    interpolation = clamp(floor(interpolation * 255. + .5) / 255., 0.0, 1.0);\n\n    gl_FragColor = vec4(interpolation.rgb * inputColor.a, inputColor.a);\n}\n"

/***/ }),
/* 299 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__identity_filter__ = __webpack_require__(145);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "IdentityFilter", function() { return __WEBPACK_IMPORTED_MODULE_0__identity_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__a15_filter__ = __webpack_require__(300);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "A15Filter", function() { return __WEBPACK_IMPORTED_MODULE_1__a15_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__breeze_filter__ = __webpack_require__(301);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "BreezeFilter", function() { return __WEBPACK_IMPORTED_MODULE_2__breeze_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__bw_filter__ = __webpack_require__(302);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "BWFilter", function() { return __WEBPACK_IMPORTED_MODULE_3__bw_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__bwhard_filter__ = __webpack_require__(303);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "BWHardFilter", function() { return __WEBPACK_IMPORTED_MODULE_4__bwhard_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__celsius_filter__ = __webpack_require__(304);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "CelsiusFilter", function() { return __WEBPACK_IMPORTED_MODULE_5__celsius_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__chest_filter__ = __webpack_require__(305);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "ChestFilter", function() { return __WEBPACK_IMPORTED_MODULE_6__chest_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__fixie_filter__ = __webpack_require__(306);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "FixieFilter", function() { return __WEBPACK_IMPORTED_MODULE_7__fixie_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__food_filter__ = __webpack_require__(307);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "FoodFilter", function() { return __WEBPACK_IMPORTED_MODULE_8__food_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__fridge_filter__ = __webpack_require__(308);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "FridgeFilter", function() { return __WEBPACK_IMPORTED_MODULE_9__fridge_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__front_filter__ = __webpack_require__(309);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "FrontFilter", function() { return __WEBPACK_IMPORTED_MODULE_10__front_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__glam_filter__ = __webpack_require__(310);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "GlamFilter", function() { return __WEBPACK_IMPORTED_MODULE_11__glam_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__gobblin_filter__ = __webpack_require__(311);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "GobblinFilter", function() { return __WEBPACK_IMPORTED_MODULE_12__gobblin_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__k1_filter__ = __webpack_require__(312);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "K1Filter", function() { return __WEBPACK_IMPORTED_MODULE_13__k1_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__k2_filter__ = __webpack_require__(313);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "K2Filter", function() { return __WEBPACK_IMPORTED_MODULE_14__k2_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__k6_filter__ = __webpack_require__(314);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "K6Filter", function() { return __WEBPACK_IMPORTED_MODULE_15__k6_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__kdynamic_filter__ = __webpack_require__(315);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "KDynamicFilter", function() { return __WEBPACK_IMPORTED_MODULE_16__kdynamic_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__lenin_filter__ = __webpack_require__(316);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "LeninFilter", function() { return __WEBPACK_IMPORTED_MODULE_17__lenin_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__lomo_filter__ = __webpack_require__(317);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "LomoFilter", function() { return __WEBPACK_IMPORTED_MODULE_18__lomo_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__mellow_filter__ = __webpack_require__(318);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MellowFilter", function() { return __WEBPACK_IMPORTED_MODULE_19__mellow_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__metal_filter__ = __webpack_require__(319);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MetalFilter", function() { return __WEBPACK_IMPORTED_MODULE_20__metal_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__morning_filter__ = __webpack_require__(320);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MorningFilter", function() { return __WEBPACK_IMPORTED_MODULE_21__morning_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__orchid_filter__ = __webpack_require__(321);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "OrchidFilter", function() { return __WEBPACK_IMPORTED_MODULE_22__orchid_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__pola_filter__ = __webpack_require__(322);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "PolaFilter", function() { return __WEBPACK_IMPORTED_MODULE_23__pola_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__pola669_filter__ = __webpack_require__(323);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Pola669Filter", function() { return __WEBPACK_IMPORTED_MODULE_24__pola669_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__quozi_filter__ = __webpack_require__(324);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "QuoziFilter", function() { return __WEBPACK_IMPORTED_MODULE_25__quozi_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__semired_filter__ = __webpack_require__(325);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "SemiredFilter", function() { return __WEBPACK_IMPORTED_MODULE_26__semired_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__sunny_filter__ = __webpack_require__(326);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "SunnyFilter", function() { return __WEBPACK_IMPORTED_MODULE_27__sunny_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__texas_filter__ = __webpack_require__(327);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "TexasFilter", function() { return __WEBPACK_IMPORTED_MODULE_28__texas_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__x400_filter__ = __webpack_require__(328);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "X400Filter", function() { return __WEBPACK_IMPORTED_MODULE_29__x400_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__lut_filter__ = __webpack_require__(329);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "LUTFilter", function() { return __WEBPACK_IMPORTED_MODULE_30__lut_filter__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__3d_lut_filter__ = __webpack_require__(330);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "ThreeDLUTFilter", function() { return __WEBPACK_IMPORTED_MODULE_31__3d_lut_filter__["a"]; });
/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */

/**
 * @namespace PhotoEditorSDK.Filters
 */































// Special lookup table filter



/***/ }),
/* 300 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * A15 Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var A15Filter = function (_Filter) {
  _inherits(A15Filter, _Filter);

  function A15Filter() {
    var _ref;

    _classCallCheck(this, A15Filter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = A15Filter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(A15Filter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["Contrast"]({
      contrast: 0.63
    }));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["Brightness"]({
      brightness: 0.12
    }));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["ToneCurve"]({
      rgbControlPoints: {
        red: [[0, 38], [94, 94], [148, 142], [175, 187], [255, 255]],
        green: [[0, 0], [77, 53], [171, 190], [255, 255]],
        blue: [[0, 10], [48, 85], [174, 228], [255, 255]]
      }
    }));
    return _this;
  }

  return A15Filter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


A15Filter.identifier = 'a15';

/* harmony default export */ __webpack_exports__["a"] = (A15Filter);

/***/ }),
/* 301 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * Breeze Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var BreezeFilter = function (_Filter) {
  _inherits(BreezeFilter, _Filter);

  function BreezeFilter() {
    var _ref;

    _classCallCheck(this, BreezeFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    // Desaturation
    var _this = _possibleConstructorReturn(this, (_ref = BreezeFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(BreezeFilter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["Desaturation"]({
      desaturation: 0.5
    }));

    // Tone curve
    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["ToneCurve"]({
      rgbControlPoints: {
        red: [[0, 0], [170, 170], [212, 219], [234, 242], [255, 255]],
        green: [[0, 0], [170, 168], [234, 231], [255, 255]],
        blue: [[0, 0], [170, 170], [212, 208], [255, 255]]
      }
    }));
    return _this;
  }

  return BreezeFilter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


BreezeFilter.identifier = 'breeze';

/* harmony default export */ __webpack_exports__["a"] = (BreezeFilter);

/***/ }),
/* 302 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * BW Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var BWFilter = function (_Filter) {
  _inherits(BWFilter, _Filter);

  function BWFilter() {
    var _ref;

    _classCallCheck(this, BWFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = BWFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(BWFilter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["Grayscale"]());
    return _this;
  }

  return BWFilter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


BWFilter.identifier = 'bw';

/* harmony default export */ __webpack_exports__["a"] = (BWFilter);

/***/ }),
/* 303 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * BWHard Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var BWHardFilter = function (_Filter) {
  _inherits(BWHardFilter, _Filter);

  function BWHardFilter() {
    var _ref;

    _classCallCheck(this, BWHardFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = BWHardFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(BWHardFilter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["Grayscale"]());
    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["Contrast"]({
      contrast: 1.5
    }));
    return _this;
  }

  return BWHardFilter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


BWHardFilter.identifier = 'bwhard';

/* harmony default export */ __webpack_exports__["a"] = (BWHardFilter);

/***/ }),
/* 304 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * Celsius Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var CelsiusFilter = function (_Filter) {
  _inherits(CelsiusFilter, _Filter);

  function CelsiusFilter() {
    var _ref;

    _classCallCheck(this, CelsiusFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = CelsiusFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(CelsiusFilter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["ToneCurve"]({
      rgbControlPoints: {
        red: [[0, 69], [55, 110], [202, 230], [255, 255]],
        green: [[0, 44], [89, 93], [185, 141], [255, 189]],
        blue: [[0, 76], [39, 82], [218, 138], [255, 171]]
      }
    }));
    return _this;
  }

  return CelsiusFilter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


CelsiusFilter.identifier = 'celsius';

/* harmony default export */ __webpack_exports__["a"] = (CelsiusFilter);

/***/ }),
/* 305 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * Chest Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var ChestFilter = function (_Filter) {
  _inherits(ChestFilter, _Filter);

  function ChestFilter() {
    var _ref;

    _classCallCheck(this, ChestFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    // Tone curve
    var _this = _possibleConstructorReturn(this, (_ref = ChestFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(ChestFilter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["ToneCurve"]({
      rgbControlPoints: {
        red: [[0, 0], [44, 44], [124, 143], [221, 204], [255, 255]],
        green: [[0, 0], [130, 127], [213, 199], [255, 255]],
        blue: [[0, 0], [51, 52], [219, 204], [255, 255]]
      }
    }));
    return _this;
  }

  return ChestFilter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


ChestFilter.identifier = 'chest';

/* harmony default export */ __webpack_exports__["a"] = (ChestFilter);

/***/ }),
/* 306 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * Fixie Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var FixieFilter = function (_Filter) {
  _inherits(FixieFilter, _Filter);

  function FixieFilter() {
    var _ref;

    _classCallCheck(this, FixieFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    // Tone curve
    var _this = _possibleConstructorReturn(this, (_ref = FixieFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(FixieFilter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["ToneCurve"]({
      rgbControlPoints: {
        red: [[0, 0], [44, 28], [63, 48], [128, 132], [235, 248], [255, 255]],
        green: [[0, 0], [20, 10], [60, 45], [190, 209], [211, 231], [255, 255]],
        blue: [[0, 31], [41, 62], [150, 142], [234, 212], [255, 224]]
      }
    }));
    return _this;
  }

  return FixieFilter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


FixieFilter.identifier = 'fixie';

/* harmony default export */ __webpack_exports__["a"] = (FixieFilter);

/***/ }),
/* 307 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * Food Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var FoodFilter = function (_Filter) {
  _inherits(FoodFilter, _Filter);

  function FoodFilter() {
    var _ref;

    _classCallCheck(this, FoodFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = FoodFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(FoodFilter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["Saturation"]({
      saturation: 1.35
    }));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["Contrast"]({
      contrast: 1.1
    }));
    return _this;
  }

  return FoodFilter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


FoodFilter.identifier = 'food';

/* harmony default export */ __webpack_exports__["a"] = (FoodFilter);

/***/ }),
/* 308 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * Fridge Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var FridgeFilter = function (_Filter) {
  _inherits(FridgeFilter, _Filter);

  function FridgeFilter() {
    var _ref;

    _classCallCheck(this, FridgeFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    // Tone curve
    var _this = _possibleConstructorReturn(this, (_ref = FridgeFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(FridgeFilter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["ToneCurve"]({
      rgbControlPoints: {
        red: [[0, 9], [21, 11], [45, 24], [255, 220]],
        green: [[0, 12], [21, 21], [42, 42], [150, 150], [170, 173], [255, 210]],
        blue: [[0, 28], [43, 72], [128, 185], [255, 220]]
      }
    }));
    return _this;
  }

  return FridgeFilter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


FridgeFilter.identifier = 'fridge';

/* harmony default export */ __webpack_exports__["a"] = (FridgeFilter);

/***/ }),
/* 309 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * Front Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var FrontFilter = function (_Filter) {
  _inherits(FrontFilter, _Filter);

  function FrontFilter() {
    var _ref;

    _classCallCheck(this, FrontFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    // Tone curve
    var _this = _possibleConstructorReturn(this, (_ref = FrontFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(FrontFilter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["ToneCurve"]({
      rgbControlPoints: {
        red: [[0, 65], [28, 67], [67, 113], [125, 183], [187, 217], [255, 229]],
        green: [[0, 52], [42, 59], [104, 134], [169, 209], [255, 240]],
        blue: [[0, 52], [65, 68], [93, 104], [150, 153], [255, 198]]
      }
    }));
    return _this;
  }

  return FrontFilter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


FrontFilter.identifier = 'front';

/* harmony default export */ __webpack_exports__["a"] = (FrontFilter);

/***/ }),
/* 310 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * Glam Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var GlamFilter = function (_Filter) {
  _inherits(GlamFilter, _Filter);

  function GlamFilter() {
    var _ref;

    _classCallCheck(this, GlamFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = GlamFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(GlamFilter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["Contrast"]({
      contrast: 1.1
    }));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["ToneCurve"]({
      rgbControlPoints: {
        red: [[0, 0], [94, 74], [181, 205], [255, 255]],
        green: [[0, 0], [127, 127], [255, 255]],
        blue: [[0, 0], [102, 73], [227, 213], [255, 255]]
      }
    }));
    return _this;
  }

  return GlamFilter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


GlamFilter.identifier = 'glam';

/* harmony default export */ __webpack_exports__["a"] = (GlamFilter);

/***/ }),
/* 311 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * Gobblin Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var GobblinFilter = function (_Filter) {
  _inherits(GobblinFilter, _Filter);

  function GobblinFilter() {
    var _ref;

    _classCallCheck(this, GobblinFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = GobblinFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(GobblinFilter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["Gobblin"]());
    return _this;
  }

  return GobblinFilter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


GobblinFilter.identifier = 'gobblin';

/* harmony default export */ __webpack_exports__["a"] = (GobblinFilter);

/***/ }),
/* 312 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * K1 Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var K1Filter = function (_Filter) {
  _inherits(K1Filter, _Filter);

  function K1Filter() {
    var _ref;

    _classCallCheck(this, K1Filter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    // Tone curve
    var _this = _possibleConstructorReturn(this, (_ref = K1Filter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(K1Filter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["ToneCurve"]({
      controlPoints: [[0, 0], [53, 32], [91, 80], [176, 205], [255, 255]]
    }));

    // Saturation
    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["Saturation"]({
      saturation: 0.9
    }));
    return _this;
  }

  return K1Filter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


K1Filter.identifier = 'k1';

/* harmony default export */ __webpack_exports__["a"] = (K1Filter);

/***/ }),
/* 313 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */





/**
 * K2 Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var K2Filter = function (_Filter) {
  _inherits(K2Filter, _Filter);

  function K2Filter() {
    var _ref;

    _classCallCheck(this, K2Filter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    // Tone curve
    var _this = _possibleConstructorReturn(this, (_ref = K2Filter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(K2Filter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_5__primitives__["ToneCurve"]({
      controlPoints: [[0, 0], [54, 33], [77, 82], [94, 103], [122, 126], [177, 193], [229, 232], [255, 255]]
    }));

    // Soft color overlay
    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_5__primitives__["SoftColorOverlay"]({
      color: new __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__["Color"](40 / 255, 40 / 255, 40 / 255)
    }));
    return _this;
  }

  return K2Filter;
}(__WEBPACK_IMPORTED_MODULE_4__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


K2Filter.identifier = 'k2';

/* harmony default export */ __webpack_exports__["a"] = (K2Filter);

/***/ }),
/* 314 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * K6 Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var K6Filter = function (_Filter) {
  _inherits(K6Filter, _Filter);

  function K6Filter() {
    var _ref;

    _classCallCheck(this, K6Filter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    // Saturation
    var _this = _possibleConstructorReturn(this, (_ref = K6Filter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(K6Filter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["Saturation"]({
      saturation: 0.5
    }));
    return _this;
  }

  return K6Filter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


K6Filter.identifier = 'k6';

/* harmony default export */ __webpack_exports__["a"] = (K6Filter);

/***/ }),
/* 315 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * KDynamic Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var KDynamicFilter = function (_Filter) {
  _inherits(KDynamicFilter, _Filter);

  function KDynamicFilter() {
    var _ref;

    _classCallCheck(this, KDynamicFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    // Tone curve
    var _this = _possibleConstructorReturn(this, (_ref = KDynamicFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(KDynamicFilter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["ToneCurve"]({
      controlPoints: [[0, 0], [17, 27], [46, 69], [90, 112], [156, 200], [203, 243], [255, 255]]
    }));

    // Saturation
    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["Saturation"]({
      saturation: 0.7
    }));
    return _this;
  }

  return KDynamicFilter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


KDynamicFilter.identifier = 'kdynamic';

/* harmony default export */ __webpack_exports__["a"] = (KDynamicFilter);

/***/ }),
/* 316 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * Lenin Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var LeninFilter = function (_Filter) {
  _inherits(LeninFilter, _Filter);

  function LeninFilter() {
    var _ref;

    _classCallCheck(this, LeninFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    // Desaturation
    var _this = _possibleConstructorReturn(this, (_ref = LeninFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(LeninFilter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["Desaturation"]({
      desaturation: 0.4
    }));

    // Tone curve
    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["ToneCurve"]({
      rgbControlPoints: {
        red: [[0, 20], [40, 20], [106, 111], [129, 153], [190, 223], [255, 255]],
        green: [[0, 20], [40, 20], [62, 41], [106, 108], [132, 159], [203, 237], [255, 255]],
        blue: [[0, 40], [40, 40], [73, 60], [133, 160], [191, 297], [203, 237], [237, 239], [255, 255]]
      }
    }));
    return _this;
  }

  return LeninFilter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


LeninFilter.identifier = 'lenin';

/* harmony default export */ __webpack_exports__["a"] = (LeninFilter);

/***/ }),
/* 317 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * Lomo Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var LomoFilter = function (_Filter) {
  _inherits(LomoFilter, _Filter);

  function LomoFilter() {
    var _ref;

    _classCallCheck(this, LomoFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = LomoFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(LomoFilter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["ToneCurve"]({
      controlPoints: [[0, 0], [87, 20], [131, 156], [183, 205], [255, 200]]
    }));
    return _this;
  }

  return LomoFilter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


LomoFilter.identifier = 'lomo';

/* harmony default export */ __webpack_exports__["a"] = (LomoFilter);

/***/ }),
/* 318 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * Mellow Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var MellowFilter = function (_Filter) {
  _inherits(MellowFilter, _Filter);

  function MellowFilter() {
    var _ref;

    _classCallCheck(this, MellowFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = MellowFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(MellowFilter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["ToneCurve"]({
      rgbControlPoints: {
        red: [[0, 0], [41, 84], [87, 134], [255, 255]],
        green: [[0, 0], [255, 216]],
        blue: [[0, 0], [255, 131]]
      }
    }));
    return _this;
  }

  return MellowFilter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


MellowFilter.identifier = 'mellow';

/* harmony default export */ __webpack_exports__["a"] = (MellowFilter);

/***/ }),
/* 319 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var ColorMatrix = __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__["Math"].ColorMatrix;

/**
 * Metal Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var MetalFilter = function (_Filter) {
  _inherits(MetalFilter, _Filter);

  function MetalFilter() {
    var _ref;

    _classCallCheck(this, MetalFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = MetalFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(MetalFilter)).call.apply(_ref, [this].concat(args)));

    var matrix1 = new ColorMatrix(0.8158218291630716, 0, 0, 0, -0.01779810181190647, 0, 0.8098360655737704, 0, 0, 0.0916393442622953, 0, 0, 0.4596336773932402, 0, 0.12760574782432707, 0, 0, 0, 1, 0);
    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_5__primitives__["ColorMatrixPrimitive"]({
      colorMatrix: matrix1
    }));
    var gammaColor = new __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__["Color"](0.8, 0.6, 0.9);
    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_5__primitives__["Gamma"]({
      gamma: gammaColor
    }));
    return _this;
  }

  return MetalFilter;
}(__WEBPACK_IMPORTED_MODULE_4__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


MetalFilter.identifier = 'metal';

/* harmony default export */ __webpack_exports__["a"] = (MetalFilter);

/***/ }),
/* 320 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * Morning Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var MorningFilter = function (_Filter) {
  _inherits(MorningFilter, _Filter);

  function MorningFilter() {
    var _ref;

    _classCallCheck(this, MorningFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = MorningFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(MorningFilter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["ToneCurve"]({
      rgbControlPoints: {
        red: [[0, 40], [255, 230]],
        green: [[0, 10], [255, 225]],
        blue: [[0, 20], [255, 181]]
      }
    }));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["Glow"]());
    return _this;
  }

  return MorningFilter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


MorningFilter.identifier = 'morning';

/* harmony default export */ __webpack_exports__["a"] = (MorningFilter);

/***/ }),
/* 321 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * Orchid Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var OrchidFilter = function (_Filter) {
  _inherits(OrchidFilter, _Filter);

  function OrchidFilter() {
    var _ref;

    _classCallCheck(this, OrchidFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    // Tone curve
    var _this = _possibleConstructorReturn(this, (_ref = OrchidFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(OrchidFilter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["ToneCurve"]({
      rgbControlPoints: {
        red: [[0, 0], [115, 130], [195, 215], [255, 255]],
        green: [[0, 0], [148, 153], [172, 215], [255, 255]],
        blue: [[0, 46], [58, 75], [178, 205], [255, 255]]
      },
      textureGLUnit: 2
    }));

    // Tone curve
    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["ToneCurve"]({
      controlPoints: [[0, 0], [117, 151], [189, 217], [255, 255]],
      textureGLUnit: 3
    }));

    // Desaturation
    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["Desaturation"]({
      desaturation: 0.65
    }));
    return _this;
  }

  return OrchidFilter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


OrchidFilter.identifier = 'orchid';

/* harmony default export */ __webpack_exports__["a"] = (OrchidFilter);

/***/ }),
/* 322 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * Pola Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var PolaFilter = function (_Filter) {
  _inherits(PolaFilter, _Filter);

  function PolaFilter() {
    var _ref;

    _classCallCheck(this, PolaFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = PolaFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(PolaFilter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["ToneCurve"]({
      rgbControlPoints: {
        red: [[0, 0], [94, 74], [181, 205], [255, 255]],
        green: [[0, 0], [34, 34], [99, 76], [176, 190], [255, 255]],
        blue: [[0, 0], [102, 73], [227, 213], [255, 255]]
      }
    }));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["Saturation"]({
      saturation: 0.8
    }));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["Contrast"]({
      contrast: 1.5
    }));
    return _this;
  }

  return PolaFilter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


PolaFilter.identifier = 'pola';

/* harmony default export */ __webpack_exports__["a"] = (PolaFilter);

/***/ }),
/* 323 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * Pola669 Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var Pola669Filter = function (_Filter) {
  _inherits(Pola669Filter, _Filter);

  function Pola669Filter() {
    var _ref;

    _classCallCheck(this, Pola669Filter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = Pola669Filter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(Pola669Filter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["ToneCurve"]({
      rgbControlPoints: {
        red: [[0, 0], [56, 18], [196, 209], [255, 255]],
        green: [[0, 38], [71, 84], [255, 255]],
        blue: [[0, 0], [131, 133], [204, 211], [255, 255]]
      }
    }));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["Saturation"]({
      saturation: 0.8
    }));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["Contrast"]({
      contrast: 1.5
    }));
    return _this;
  }

  return Pola669Filter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


Pola669Filter.identifier = 'pola669';

/* harmony default export */ __webpack_exports__["a"] = (Pola669Filter);

/***/ }),
/* 324 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * Quozi Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var QuoziFilter = function (_Filter) {
  _inherits(QuoziFilter, _Filter);

  function QuoziFilter() {
    var _ref;

    _classCallCheck(this, QuoziFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    // Desaturation
    var _this = _possibleConstructorReturn(this, (_ref = QuoziFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(QuoziFilter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["Desaturation"]({
      desaturation: 0.65
    }));

    // Tone curve
    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["ToneCurve"]({
      rgbControlPoints: {
        red: [[0, 50], [40, 78], [118, 170], [181, 211], [255, 255]],
        green: [[0, 27], [28, 45], [109, 157], [157, 195], [179, 208], [206, 212], [255, 240]],
        blue: [[0, 50], [12, 55], [46, 103], [103, 162], [194, 182], [241, 201], [255, 219]]
      }
    }));
    return _this;
  }

  return QuoziFilter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


QuoziFilter.identifier = 'quozi';

/* harmony default export */ __webpack_exports__["a"] = (QuoziFilter);

/***/ }),
/* 325 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * Semired Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var SemiredFilter = function (_Filter) {
  _inherits(SemiredFilter, _Filter);

  function SemiredFilter() {
    var _ref;

    _classCallCheck(this, SemiredFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = SemiredFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(SemiredFilter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["ToneCurve"]({
      rgbControlPoints: {
        red: [[0, 129], [75, 153], [181, 227], [255, 255]],
        green: [[0, 8], [111, 85], [212, 158], [255, 226]],
        blue: [[0, 5], [75, 22], [193, 90], [255, 229]]
      }
    }));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["Glow"]());
    return _this;
  }

  return SemiredFilter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


SemiredFilter.identifier = 'semired';

/* harmony default export */ __webpack_exports__["a"] = (SemiredFilter);

/***/ }),
/* 326 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * Sunny Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var SunnyFilter = function (_Filter) {
  _inherits(SunnyFilter, _Filter);

  function SunnyFilter() {
    var _ref;

    _classCallCheck(this, SunnyFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = SunnyFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(SunnyFilter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["ToneCurve"]({
      rgbControlPoints: {
        red: [[0, 0], [62, 82], [141, 154], [255, 255]],
        green: [[0, 39], [56, 96], [192, 176], [255, 255]],
        blue: [[0, 0], [174, 99], [255, 235]]
      },
      textureGLUnit: 2
    }));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["ToneCurve"]({
      controlPoints: [[0, 0], [55, 20], [158, 191], [255, 255]],
      textureGLUnit: 3
    }));
    return _this;
  }

  return SunnyFilter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


SunnyFilter.identifier = 'sunny';

/* harmony default export */ __webpack_exports__["a"] = (SunnyFilter);

/***/ }),
/* 327 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * Texas Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var TexasFilter = function (_Filter) {
  _inherits(TexasFilter, _Filter);

  function TexasFilter() {
    var _ref;

    _classCallCheck(this, TexasFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = TexasFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(TexasFilter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["ToneCurve"]({
      rgbControlPoints: {
        red: [[0, 72], [89, 99], [176, 212], [255, 237]],
        green: [[0, 49], [255, 192]],
        blue: [[0, 72], [255, 151]]
      }
    }));
    return _this;
  }

  return TexasFilter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


TexasFilter.identifier = 'texas';

/* harmony default export */ __webpack_exports__["a"] = (TexasFilter);

/***/ }),
/* 328 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * X400 Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var X400Filter = function (_Filter) {
  _inherits(X400Filter, _Filter);

  function X400Filter() {
    var _ref;

    _classCallCheck(this, X400Filter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = X400Filter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(X400Filter)).call.apply(_ref, [this].concat(args)));

    _this._stack.push(new __WEBPACK_IMPORTED_MODULE_4__primitives__["X400"]());
    return _this;
  }

  return X400Filter;
}(__WEBPACK_IMPORTED_MODULE_3__filter__["a" /* default */]);

/**
 * This filter's identifier
 * @type {String}
 * @default
 */


X400Filter.identifier = 'x400';

/* harmony default export */ __webpack_exports__["a"] = (X400Filter);

/***/ }),
/* 329 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */





/**
 * Lomo Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var LUTFilter = function (_Filter) {
  _inherits(LUTFilter, _Filter);

  function LUTFilter() {
    var _ref;

    _classCallCheck(this, LUTFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = LUTFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(LUTFilter)).call.apply(_ref, [this].concat(args)));

    _this._lutPrimitive = new __WEBPACK_IMPORTED_MODULE_5__primitives__["LookupTableImage"]({
      image: _this._options.image
    });
    _this._stack.push(_this._lutPrimitive);
    return _this;
  }

  return LUTFilter;
}(__WEBPACK_IMPORTED_MODULE_4__filter__["a" /* default */]);

/**
 * Specifies the available options for this filter
 * @type {Object}
 * @ignore
 */


LUTFilter.prototype.availableOptions = {
  image: {
    type: __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__["OptionType"].IMAGE,
    required: true,
    setter: function setter(image) {
      if (this._lutPrimitive) {
        this._lutPrimitive.setImage(image);
      }
      this.setDirty(true);
      return image;
    }
  }

  /**
   * This filter's identifier
   * @type {String}
   * @default
   */
};LUTFilter.identifier = 'lut';

/* harmony default export */ __webpack_exports__["a"] = (LUTFilter);

/***/ }),
/* 330 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__filter__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__primitives__ = __webpack_require__(8);




function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */





/**
 * 3D LUT Filter
 * @class
 * @extends PhotoEditorSDK.Filter
 * @memberof PhotoEditorSDK.Filters
 */

var ThreeDLUTFilter = function (_Filter) {
  _inherits(ThreeDLUTFilter, _Filter);

  function ThreeDLUTFilter() {
    var _ref;

    _classCallCheck(this, ThreeDLUTFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = ThreeDLUTFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_prototype_of___default()(ThreeDLUTFilter)).call.apply(_ref, [this].concat(args)));

    var _this$_options = _this._options,
        image = _this$_options.image,
        resolution = _this$_options.resolution,
        verticalTileCount = _this$_options.verticalTileCount,
        horizontalTileCount = _this$_options.horizontalTileCount;

    _this._lutPrimitive = new __WEBPACK_IMPORTED_MODULE_5__primitives__["ThreeDLookupTableImage"]({
      image: image, resolution: resolution, verticalTileCount: verticalTileCount, horizontalTileCount: horizontalTileCount
    });
    _this._stack.push(_this._lutPrimitive);
    return _this;
  }

  return ThreeDLUTFilter;
}(__WEBPACK_IMPORTED_MODULE_4__filter__["a" /* default */]);

/**
 * Specifies the available options for this filter
 * @type {Object}
 * @ignore
 */


ThreeDLUTFilter.prototype.availableOptions = {
  image: {
    type: __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__["OptionType"].IMAGE,
    required: true,
    setter: function setter(image) {
      if (this._lutPrimitive) {
        this._lutPrimitive.setImage(image);
      }
      this.setDirty(true);
      return image;
    }
  },
  resolution: { type: __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__["OptionType"].NUMBER, default: 128 },
  horizontalTileCount: { type: __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__["OptionType"].NUMBER, default: 5 },
  verticalTileCount: { type: __WEBPACK_IMPORTED_MODULE_3_photoeditorsdk_core__["OptionType"].NUMBER, default: 5 }

  /**
   * This filter's identifier
   * @type {String}
   * @default
   */
};ThreeDLUTFilter.identifier = '3d-lut';

/* harmony default export */ __webpack_exports__["a"] = (ThreeDLUTFilter);

/***/ }),
/* 331 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_symbol_iterator__ = __webpack_require__(35);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_symbol_iterator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_symbol_iterator__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol__ = __webpack_require__(39);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__);








var _typeof = typeof __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default.a === "function" && typeof __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_symbol_iterator___default.a === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default.a === "function" && obj.constructor === __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default.a && obj !== __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_symbol___default.a.prototype ? "symbol" : typeof obj; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* global HTMLImageElement */
/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */


var Vector2 = __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["Math"].Vector2;

/**
 * An operation that can draw a frame around the image
 * @class
 * @extends PhotoEditorSDK.Operation
 * @memberof PhotoEditorSDK.Operations
 */

var FrameOperation = function (_Operation) {
  _inherits(FrameOperation, _Operation);

  /**
   * Creates a new FrameOperation
   * @param  {PhotoEditorSDK} sdk
   * @param  {Object} [options]
   */
  function FrameOperation() {
    var _ref;

    _classCallCheck(this, FrameOperation);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = FrameOperation.__proto__ || __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of___default()(FrameOperation)).call.apply(_ref, [this].concat(args)));

    _this._colorOverlayFilter = new __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["Engine"].Filters.ColorOverlayFilter({
      color: _this.getTintColor()
    });

    _this._frameContainer = new __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["Engine"].Container();

    _this._resetSprites();
    if (_this._options.frame) {
      _this._createSpritesForFrame(_this._options.frame);
    }
    return _this;
  }

  /**
   * Resets the spriteGroups and sprites attributes
   * @private
   */


  _createClass(FrameOperation, [{
    key: '_resetSprites',
    value: function _resetSprites() {
      this._spriteGroups = {
        top: {},
        left: {},
        right: {},
        bottom: {}
      };
      this._sprites = [];
      this._repeatSprites = {
        top: [],
        left: [],
        right: [],
        bottom: []
      };
    }

    /**
     * Creates the sprites and image groups for the given frame object
     * @param  {Object} frame
     * @private
     */

  }, {
    key: '_createSpritesForFrame',
    value: function _createSpritesForFrame(frame) {
      var _this2 = this;

      if (!frame) return this._disposeSprites();

      var imageGroups = frame.imageGroups,
          layoutMode = frame.layoutMode;

      this._layoutMode = layoutMode || 'horizontal-inside';

      this._disposeSprites();

      ['top', 'left', 'right', 'bottom'].forEach(function (group) {
        if (typeof imageGroups[group] === 'undefined') return;

        ['start', 'mid', 'end'].forEach(function (part) {
          if (typeof imageGroups[group][part] === 'undefined') return;

          // In case object is passed, pick attributes
          var image = imageGroups[group][part];
          if ('image' in image) {
            image = image.image;
          }

          // Create texture and sprites
          var texture = __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["Engine"].Texture.fromImage(image);
          var sprite = new __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["Engine"].Sprite(texture);
          _this2._spriteGroups[group][part] = sprite;
          _this2._sprites.push(sprite);
          _this2._frameContainer.addChild(sprite);
        });
      });
    }

    /**
     * Renders the frame operation
     * @param  {PhotoEditorSDK.Engine.Texture} inputTexture
     * @private
     */

  }, {
    key: '_render',
    value: function _render(inputTexture) {
      var dimensions = this._renderTexture.getDimensions();

      // Create and position sprites
      if (this._options.frame) {
        this._colorOverlayFilter.setColor(this.getTintColor());
        this._updateSprites(inputTexture);
      }

      // Prepare render texture for frame
      if (!this._frameRenderTexture) {
        this._frameRenderTexture = new __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["Engine"].RenderTexture(this._sdk.getRenderer(), dimensions.x, dimensions.y);
        this._frameSprite = new __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["Engine"].Sprite(this._frameRenderTexture);
        this._container.addChild(this._frameSprite);
      } else {
        this._frameRenderTexture.resizeTo(dimensions);
      }

      this._frameSprite.setAlpha(this._options.alpha);

      // Handle tinting
      if (this._options.frame && this._options.frame.tintable) {
        this._frameSprite.setFilters([this._colorOverlayFilter]);
      } else {
        this._frameSprite.setFilters([]);
      }

      // Render frame
      this._frameRenderTexture.clear();
      this._frameRenderTexture.render(this._frameContainer);

      // Render everything
      this._renderTexture.render(this._container);
      return __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["Promise"].resolve(this._renderTexture);
    }

    /**
     * Updates the sprite positions and scalings
     * @param {PhotoEditorSDK.Engine.Texture} inputTexture
     * @private
     */

  }, {
    key: '_updateSprites',
    value: function _updateSprites(inputTexture) {
      var dimensions = inputTexture.getDimensions();
      this._frameWidth = Math.ceil(inputTexture.getDimensions().min() * this._options.scale);

      this._updateHorizontalSpriteGroup(inputTexture, 'top', 0);
      this._updateHorizontalSpriteGroup(inputTexture, 'bottom', dimensions.y - this._frameWidth);
      this._updateVerticalSpriteGroup(inputTexture, 'left', 0);
      this._updateVerticalSpriteGroup(inputTexture, 'right', dimensions.x - this._frameWidth);
    }

    /**
     * Updates the sprite positions and scale for the given horizontal sprite group
     * @param {PhotoEditorSDK.Engine.Texture} inputTexture
     * @param {String} group
     * @param {Number} offset = 0
     * @private
     */

  }, {
    key: '_updateHorizontalSpriteGroup',
    value: function _updateHorizontalSpriteGroup(inputTexture, group) {
      var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;

      var dimensions = inputTexture.getDimensions();
      var verticalInside = this._layoutMode === 'vertical-inside';

      var startSprite = this._spriteGroups[group].start;
      var midSprite = this._spriteGroups[group].mid;
      var endSprite = this._spriteGroups[group].end;

      var startWidth = 0;
      var endWidth = 0;

      var textureDimensions = void 0,
          textureRatio = void 0;
      if (startSprite) {
        textureDimensions = startSprite.getTexture().getDimensions();
        textureRatio = textureDimensions.y / textureDimensions.x;

        startWidth = Math.floor(this._frameWidth / textureRatio);

        var startPosition = new Vector2(0, offset);
        startPosition.x = verticalInside ? this._frameWidth : 0;

        startSprite.setPosition(startPosition);
        startSprite.setHeight(this._frameWidth);
        startSprite.setWidth(startWidth);
      }

      if (endSprite) {
        textureDimensions = endSprite.getTexture().getDimensions();
        textureRatio = textureDimensions.y / textureDimensions.x;

        endWidth = Math.floor(this._frameWidth * textureRatio);

        var endPosition = new Vector2(dimensions.x - endWidth, offset);
        endPosition.x -= verticalInside ? this._frameWidth : 0;

        endSprite.setPosition(endPosition);
        endSprite.setHeight(this._frameWidth);
        endSprite.setWidth(endWidth);
      }

      if (midSprite) {
        textureDimensions = midSprite.getTexture().getDimensions();
        textureRatio = textureDimensions.y / textureDimensions.x;

        var midPosition = new Vector2(startWidth, offset);
        var midWidth = dimensions.x - startWidth - endWidth;

        if (verticalInside) {
          midPosition.x += this._frameWidth;
          midWidth -= this._frameWidth * 2;
        }

        midSprite.setPosition(midPosition);
        midSprite.setWidth(midWidth);
        midSprite.setHeight(this._frameWidth);

        // Handle repeat
        if (this._options.frame.imageGroups[group].mid.mode === 'repeat') {
          // Make sure we have exactly the right amount of sprites we need
          var defaultSpriteWidth = this._frameWidth / textureRatio;
          var requiredRepeatSprites = Math.ceil(midWidth / defaultSpriteWidth);
          var consumedWidth = 0;

          if (requiredRepeatSprites !== -1) {
            var spriteWidth = Math.round(midWidth / requiredRepeatSprites);
            midSprite.setWidth(spriteWidth);
            consumedWidth += spriteWidth;

            this._ensureRepeatSpritesExist(requiredRepeatSprites - 1, group, midSprite);

            // Reposition all repeat sprites
            for (var i = 0; i < requiredRepeatSprites - 1; i++) {
              // Divide the remaining height by the remaining amount of sprites to be placed
              spriteWidth = Math.round((midWidth - consumedWidth) / (requiredRepeatSprites - i - 1));

              var sprite = this._repeatSprites[group][i];
              var spritePosition = midPosition.clone().add(consumedWidth, 0).floor();
              sprite.setPosition(spritePosition);
              sprite.setWidth(spriteWidth);
              sprite.setHeight(this._frameWidth);

              consumedWidth += spriteWidth;
            }
          }
        }
      }
    }
  }, {
    key: '_ensureRepeatSpritesExist',
    value: function _ensureRepeatSpritesExist(requiredSpritesCount, group, sourceSprite) {
      var _this3 = this;

      // Make sure we don't get an EventEmitter warning
      sourceSprite.getTexture().setMaxListeners(requiredSpritesCount + 1);

      var existingSpritesCount = this._repeatSprites[group].length;
      if (requiredSpritesCount > existingSpritesCount) {
        // We need more sprites
        var missingRepeatSprites = requiredSpritesCount - existingSpritesCount;
        for (var i = 0; i < missingRepeatSprites; i++) {
          var sprite = new __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["Engine"].Sprite(sourceSprite.getTexture());
          this._repeatSprites[group].push(sprite);
          this._frameContainer.addChild(sprite);
          this._sprites.push(sprite);
        }
      } else if (requiredSpritesCount < existingSpritesCount) {
        // We need less sprites
        var spareRepeatSprites = this._repeatSprites[group].splice(requiredSpritesCount);
        spareRepeatSprites.forEach(function (sprite) {
          var index = _this3._sprites.indexOf(sprite);
          if (index === -1) return;

          _this3._sprites.splice(index, 1);
          _this3._frameContainer.removeChild(sprite);
          sprite.dispose();
        });
      }
    }

    /**
     * Updates the sprite positions and scale for given vertical column
     * @param {PhotoEditorSDK.Engine.Texture} inputTexture
     * @param {String} group
     * @param {Number} offset = 0
     * @private
     */

  }, {
    key: '_updateVerticalSpriteGroup',
    value: function _updateVerticalSpriteGroup(inputTexture, group) {
      var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;

      var dimensions = inputTexture.getDimensions();
      var horizontalInside = this._layoutMode === 'horizontal-inside';

      var startSprite = this._spriteGroups[group].start;
      var midSprite = this._spriteGroups[group].mid;
      var endSprite = this._spriteGroups[group].end;

      var startHeight = 0;
      var endHeight = 0;

      var textureDimensions = void 0,
          textureRatio = void 0;
      if (startSprite) {
        textureDimensions = startSprite.getTexture().getDimensions();
        textureRatio = textureDimensions.y / textureDimensions.x;

        startHeight = Math.floor(this._frameWidth * textureRatio);

        var startPosition = new Vector2(offset, 0);
        startPosition.y = horizontalInside ? this._frameWidth : 0;

        startSprite.setPosition(startPosition);
        startSprite.setWidth(this._frameWidth);
        startSprite.setHeight(startHeight);
      }

      if (endSprite) {
        textureDimensions = endSprite.getTexture().getDimensions();
        textureRatio = textureDimensions.y / textureDimensions.x;

        endHeight = Math.floor(this._frameWidth * textureRatio);

        var endPosition = new Vector2(offset, dimensions.y - endHeight);
        endPosition.y -= horizontalInside ? this._frameWidth : 0;

        endSprite.setPosition(endPosition);
        endSprite.setWidth(this._frameWidth);
        endSprite.setHeight(endHeight);
      }

      if (midSprite) {
        textureDimensions = midSprite.getTexture().getDimensions();
        textureRatio = textureDimensions.y / textureDimensions.x;

        var midPosition = new Vector2(offset, startHeight);
        var midHeight = dimensions.y - startHeight - endHeight;

        if (horizontalInside) {
          midPosition.y += this._frameWidth;
          midHeight -= this._frameWidth * 2;
        }

        midSprite.setPosition(midPosition);
        midSprite.setHeight(midHeight);
        midSprite.setWidth(this._frameWidth);

        // Handle repeat
        if (this._options.frame.imageGroups[group].mid.mode === 'repeat') {
          // Make sure we have exactly the right amount of sprites we need
          var defaultSpriteHeight = this._frameWidth * textureRatio;
          var requiredRepeatSprites = Math.ceil(midHeight / defaultSpriteHeight);
          var consumedHeight = 0;

          if (requiredRepeatSprites !== -1) {
            var spriteHeight = Math.round(midHeight / requiredRepeatSprites);
            midSprite.setHeight(spriteHeight);
            consumedHeight += spriteHeight;

            this._ensureRepeatSpritesExist(requiredRepeatSprites - 1, group, midSprite);

            // Reposition all repeat sprites
            for (var i = 0; i < requiredRepeatSprites - 1; i++) {
              // Divide the remaining height by the remaining amount of sprites to be placed
              spriteHeight = Math.round((midHeight - consumedHeight) / (requiredRepeatSprites - i - 1));

              var sprite = this._repeatSprites[group][i];
              var spritePosition = midPosition.clone().add(0, consumedHeight).floor();
              sprite.setPosition(spritePosition);
              sprite.setHeight(spriteHeight);
              sprite.setWidth(this._frameWidth);

              consumedHeight += spriteHeight;
            }
          }
        }
      }
    }

    /**
     * Disposes all sprites
     * @private
     */

  }, {
    key: '_disposeSprites',
    value: function _disposeSprites() {
      var _this4 = this;

      this._sprites.forEach(function (sprite) {
        _this4._frameContainer.removeChild(sprite);
        var baseTexture = sprite.getTexture().getBaseTexture();
        baseTexture.dispose();

        sprite.dispose();
      });
      this._resetSprites();
    }

    /**
     * Disposes this operation
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      _get(FrameOperation.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of___default()(FrameOperation.prototype), 'dispose', this).call(this);
      this._disposeSprites();
    }

    /**
     * Validates the given frame object
     * @param  {Object} frame
     */

  }], [{
    key: 'validateFrame',
    value: function validateFrame(frame) {
      if (!frame) return;
      var imageGroups = frame.imageGroups,
          layoutMode = frame.layoutMode;


      if (typeof frame.identifier !== 'string') {
        throw new Error('Frame needs a property `identifier` of type String.');
      }

      if (_typeof(frame.imageGroups) !== 'object') {
        throw new Error('Frame needs a property `imageGroups` of type Object.');
      }

      var validateImageGroup = function validateImageGroup(group) {
        var _imageGroups$group = imageGroups[group],
            start = _imageGroups$group.start,
            end = _imageGroups$group.end,
            mid = _imageGroups$group.mid;


        if (typeof imageGroups[group] === 'undefined') return;
        if (_typeof(imageGroups[group]) !== 'object') {
          throw new Error('Frame: `imageGroups.' + group + '` needs to be of type Object.');
        }

        if (typeof start !== 'undefined' && !(start instanceof __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["Image"] || typeof HTMLImageElement !== 'undefined' && start instanceof HTMLImageElement)) {
          throw new Error('Frame: `imageGroups.' + group + '.start` needs to be of type Image.');
        }

        if (typeof mid !== 'undefined' && !(start instanceof __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["Image"] || typeof HTMLImageElement !== 'undefined' && start instanceof HTMLImageElement) && (typeof mid === 'undefined' ? 'undefined' : _typeof(mid)) !== 'object') {
          throw new Error('Frame: `imageGroups.' + group + '.mid` needs to be of type Image or Object.');
        }

        if (typeof end !== 'undefined' && !(end instanceof __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["Image"] || typeof HTMLImageElement !== 'undefined' && end instanceof HTMLImageElement)) {
          throw new Error('Frame: `imageGroups.' + group + '.end` needs to be of type Image.');
        }
      };

      if (typeof layoutMode !== 'undefined' && ['vertical-inside', 'horizontal-inside'].indexOf(layoutMode) === -1) {
        throw new Error('Frame: `layoutMode` must be one of vertical-inside, horizontal-inside');
      }

      if (typeof tintable !== 'undefined' && typeof tintable !== 'boolean') {
        throw new Error('Frame: `tintable` needs to be of type Boolean.');
      }

      validateImageGroup('top');
      validateImageGroup('left');
      validateImageGroup('right');
      validateImageGroup('bottom');
    }
  }]);

  return FrameOperation;
}(__WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["Operation"]);

/**
 * A unique string that identifies this operation. Can be used to select
 * operations.
 * @type {String}
 * @default
 */


FrameOperation.identifier = 'frame';

/**
 * Specifies the available options for this operation
 * @type {Object}
 * @ignore
 */
FrameOperation.prototype.availableOptions = {
  frame: {
    type: __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["OptionType"].OBJECT,
    validation: FrameOperation.validateFrame,
    setter: function setter(frame, initial) {
      if (!initial) {
        this._createSpritesForFrame(frame);
      }
      return frame;
    },
    default: null
  },
  alpha: { type: __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["OptionType"].NUMBER, default: 1 },
  tintColor: { type: __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["OptionType"].COLOR, default: new __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["Color"](1, 1, 1, 0) },
  scale: { type: __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.1 }
};

__WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core___default.a.Operations.FrameOperation = FrameOperation;

/* harmony default export */ __webpack_exports__["a"] = (FrameOperation);

/***/ }),
/* 332 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__linear_focus_filter__ = __webpack_require__(333);






var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



var Vector2 = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Math"].Vector2;

/**
 * An operation that can draw a linear focus
 * @class
 * @extends PhotoEditorSDK.Operation
 * @memberof PhotoEditorSDK.Operations
 */

var LinearFocusOperation = function (_Operation) {
  _inherits(LinearFocusOperation, _Operation);

  /**
   * Creates a new LinearFocusOperation
   * @param  {PhotoEditorSDK} sdk
   * @param  {Object} [options]
   */
  function LinearFocusOperation() {
    var _ref;

    _classCallCheck(this, LinearFocusOperation);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = LinearFocusOperation.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(LinearFocusOperation)).call.apply(_ref, [this].concat(args)));

    _this._lastBlurRadius = _this._options.blurRadius;
    _this._lastControlPoint1 = _this._options.controlPoint1.clone();
    _this._lastControlPoint2 = _this._options.controlPoint2.clone();

    _this._horizontalFilter = new __WEBPACK_IMPORTED_MODULE_6__linear_focus_filter__["a" /* default */]();
    _this._verticalFilter = new __WEBPACK_IMPORTED_MODULE_6__linear_focus_filter__["a" /* default */]();
    _this._sprite.setFilters([_this._horizontalFilter, _this._verticalFilter]);

    _this._horizontalFilter.setDelta(new Vector2(0.5, 0.5));
    _this._verticalFilter.setDelta(new Vector2(-0.5, 0.5));

    _this._filter = new __WEBPACK_IMPORTED_MODULE_6__linear_focus_filter__["a" /* default */]();
    return _this;
  }

  /**
   * Applies the given rotation change
   * @param  {PhotoEditorSDK.Operations.RotationOperation} operation
   * @param  {Number} degrees
   */


  _createClass(LinearFocusOperation, [{
    key: 'rotate',
    value: function rotate(degrees) {
      var controlPoint1 = this._options.controlPoint1;
      var controlPoint2 = this._options.controlPoint2;

      if (degrees === 90) {
        controlPoint1.flip();
        controlPoint1.x = 1 - controlPoint1.x;
        controlPoint2.flip();
        controlPoint2.x = 1 - controlPoint2.x;
      } else if (degrees === -90) {
        controlPoint1.flip();
        controlPoint1.y = 1 - controlPoint1.y;
        controlPoint2.flip();
        controlPoint2.y = 1 - controlPoint2.y;
      }

      this.set({ controlPoint1: controlPoint1, controlPoint2: controlPoint2 });
    }

    /**
     * Applies a flip with the given direction
     * @param  {String} direction
     */

  }, {
    key: 'flip',
    value: function flip(direction) {
      var controlPoint1 = this._options.controlPoint1;
      var controlPoint2 = this._options.controlPoint2;

      switch (direction) {
        case 'horizontal':
          controlPoint1.x = 1 - controlPoint1.x;
          controlPoint2.x = 1 - controlPoint2.x;
          break;
        case 'vertical':
          controlPoint1.y = 1 - controlPoint1.y;
          controlPoint2.y = 1 - controlPoint2.y;
          break;
      }

      this.set({ controlPoint1: controlPoint1, controlPoint2: controlPoint2 });
    }

    /**
     * Applies the given transform change
     * @param  {PhotoEditorSDK.Operations.TransformOperation.TransformChange} transformChange
     * @private
     */

  }, {
    key: 'transform',
    value: function transform(transformChange) {
      var _this2 = this;

      var newOptions = {};

      ['controlPoint1', 'controlPoint2'].forEach(function (optionName) {
        var vector = _this2.getOption(optionName);
        newOptions[optionName] = transformChange.applyToRelativePoint(vector);
      });

      ['blurRadius'].forEach(function (optionName) {
        var size = _this2.getOption(optionName);
        newOptions[optionName] = transformChange.applyToRelativeSize(size);
      });

      this.set(newOptions, false);
    }

    /**
     * Renders the linear focus using WebGL
     * @param  {PhotoEditorSDK.Engine.Texture} inputTexture
     * @override
     * @private
     */
    /* istanbul ignore next */

  }, {
    key: '_renderWebGL',
    value: function _renderWebGL(inputTexture) {
      var inputDimensions = inputTexture.getDimensions();
      var shortestSide = inputDimensions.min();

      var _options = this._options,
          blurRadius = _options.blurRadius,
          controlPoint1 = _options.controlPoint1,
          controlPoint2 = _options.controlPoint2;

      var commonOptions = {
        blurRadius: blurRadius * shortestSide,

        controlPoint1: controlPoint1,
        controlPoint2: controlPoint2,
        texSize: inputDimensions
      };

      this._horizontalFilter.set(commonOptions);
      this._verticalFilter.set(commonOptions);

      this._renderTexture.render(this._container);

      return __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Promise"].resolve();
    }

    /**
     * Renders the linear blur using Canvas2D
     * @param  {PhotoEditorSDK.Engine.Texture} inputTexture
     * @override
     * @private
     */

  }, {
    key: '_renderCanvas',
    value: function _renderCanvas(inputTexture) {
      var inputDimensions = inputTexture.getDimensions();

      var _options2 = this._options,
          blurRadius = _options2.blurRadius,
          controlPoint1 = _options2.controlPoint1,
          controlPoint2 = _options2.controlPoint2;

      this._filter.set({
        blurRadius: blurRadius,
        controlPoint1: controlPoint1.clone(),
        controlPoint2: controlPoint2.clone(),
        texSize: inputDimensions
      });

      this._sprite.setFilters([this._filter]);

      this._renderTexture.render(this._container);

      return __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Promise"].resolve();
    }

    /**
     * Disposes this operation
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      _get(LinearFocusOperation.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(LinearFocusOperation.prototype), 'dispose', this).call(this);
      this._filter.dispose();
      this._verticalFilter.dispose();
      this._horizontalFilter.dispose();
    }

    /**
     * Checks if the operation has changes/modifications
     * @return {Boolean}
     */

  }, {
    key: 'hasChanges',
    value: function hasChanges() {
      return true;
    }
  }]);

  return LinearFocusOperation;
}(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Operation"]);

/**
 * A unique string that identifies this operation. Can be used to select
 * operations.
 * @type {String}
 * @default
 */


LinearFocusOperation.identifier = 'linear-focus';

/**
 * Specifies the available options for this operation
 * @type {Object}
 * @ignore
 */
LinearFocusOperation.prototype.availableOptions = {
  controlPoint1: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(0.0, 0.5) },
  controlPoint2: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(1.0, 0.5) },
  blurRadius: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.025 }
};

__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default.a.Operations.LinearFocusOperation = LinearFocusOperation;

/* harmony default export */ __webpack_exports__["a"] = (LinearFocusOperation);

/***/ }),
/* 333 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__shared_vendor_stack_blur__ = __webpack_require__(75);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__shared_vendor_stack_blur___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5__shared_vendor_stack_blur__);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



var Vector2 = __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Math"].Vector2;

var LinearFocusFilter = function (_Engine$Filter) {
  _inherits(LinearFocusFilter, _Engine$Filter);

  function LinearFocusFilter() {
    var _ref;

    _classCallCheck(this, LinearFocusFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = LinearFocusFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(LinearFocusFilter)).call.apply(_ref, [this].concat(args)));

    _this._fragmentSource = __webpack_require__(334);

    _this._lastBlurRadius = null;
    _this._lastControlPoint1 = new Vector2();
    _this._lastControlPoint2 = new Vector2();

    _this._blurredRenderTarget = new __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].CanvasRenderTarget(100, 100, 1);

    _this._maskRenderTarget = new __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].CanvasRenderTarget(100, 100, 1);
    return _this;
  }

  /**
   * Applies this filter to the given inputTarget and renders it to
   * the given outputTarget using the CanvasRenderer
   * @param  {CanvasRenderer} renderer
   * @param  {RenderTarget} inputTarget
   * @param  {RenderTarget} outputTarget
   * @param  {Boolean} clear = false
   * @private
   */


  _createClass(LinearFocusFilter, [{
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var inputDimensions = inputTarget.getDimensions();
      var dimensionsChanged = !this._blurredRenderTarget.getDimensions().equals(inputDimensions);

      this._blurredRenderTarget.setPixelRatio(inputTarget.getPixelRatio());
      this._blurredRenderTarget.resizeTo(inputTarget.getDimensions());

      this._maskRenderTarget.setPixelRatio(inputTarget.getPixelRatio());
      this._maskRenderTarget.resizeTo(inputTarget.getDimensions());

      if (!this._lastControlPoint1.equals(this._options.controlPoint1) || !this._lastControlPoint2.equals(this._options.controlPoint2) || dimensionsChanged) {
        this._renderMask();

        this._lastControlPoint1 = this._options.controlPoint1.clone();
        this._lastControlPoint2 = this._options.controlPoint2.clone();
      }

      if (this._lastBlurRadius !== this._options.blurRadius || dimensionsChanged) {
        this._blurImage(inputTarget);
        this._lastBlurRadius = this._options.blurRadius;
      }

      this._applyMask(inputTarget, outputTarget);
    }

    /**
     * Creates a blurred copy of the image
     * @param  {CanvasRenderTarget} inputTarget
     * @return {Canvas}
     * @private
     */

  }, {
    key: '_blurImage',
    value: function _blurImage(inputTarget) {
      var inputCanvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();

      var inputDimensions = new Vector2(inputCanvas.width, inputCanvas.height);
      var blurryImageData = inputContext.getImageData(0, 0, inputCanvas.width, inputCanvas.height);
      __WEBPACK_IMPORTED_MODULE_5__shared_vendor_stack_blur___default.a.stackBlurCanvasRGBA(blurryImageData, 0, 0, inputCanvas.width, inputCanvas.height, this._options.blurRadius * inputDimensions.min());

      var blurryContext = this._blurredRenderTarget.getContext();
      blurryContext.putImageData(blurryImageData, 0, 0);
    }

    /**
     * Renders the mask canvas
     * @private
     */

  }, {
    key: '_renderMask',
    value: function _renderMask() {
      var canvas = this._maskRenderTarget.getCanvas();
      var context = this._maskRenderTarget.getContext();

      var canvasDimensions = new Vector2(canvas.width, canvas.height);

      var controlPoint1 = this._options.controlPoint1.clone().multiply(canvasDimensions);
      var controlPoint2 = this._options.controlPoint2.clone().multiply(canvasDimensions);

      // Build gradient
      var gradient = context.createLinearGradient(controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y);
      gradient.addColorStop(0, '#FFFFFF');
      gradient.addColorStop(1, '#000000');

      // Draw gradient
      context.fillStyle = gradient;
      context.fillRect(0, 0, canvas.width, canvas.height);
    }

    /**
     * Applies the blur and mask to the input canvas
     * @param {CanvasRenderTarget} inputTarget
     * @param {CanvasRenderTarget} outputTarget
     * @private
     */

  }, {
    key: '_applyMask',
    value: function _applyMask(inputTarget, outputTarget) {
      var outputContext = outputTarget.getContext();
      var inputCanvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();
      var blurredContext = this._blurredRenderTarget.getContext();
      var maskContext = this._maskRenderTarget.getContext();

      var inputImageData = inputContext.getImageData(0, 0, inputCanvas.width, inputCanvas.height);
      var pixels = inputImageData.data;
      var blurredPixels = blurredContext.getImageData(0, 0, inputCanvas.width, inputCanvas.height).data;
      var maskPixels = maskContext.getImageData(0, 0, inputCanvas.width, inputCanvas.height).data;

      var alpha = void 0;
      for (var i = 0; i < inputCanvas.width * inputCanvas.height * 4; i += 4) {
        alpha = maskPixels[i] / 255;

        pixels[i] = alpha * pixels[i] + (1 - alpha) * blurredPixels[i];
        pixels[i + 1] = alpha * pixels[i + 1] + (1 - alpha) * blurredPixels[i + 1];
        pixels[i + 2] = alpha * pixels[i + 2] + (1 - alpha) * blurredPixels[i + 2];
      }

      outputContext.putImageData(inputImageData, 0, 0);
    }
  }]);

  return LinearFocusFilter;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].Filter);

LinearFocusFilter.prototype.availableOptions = {
  blurRadius: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 30, uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT },
  controlPoint1: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(0, 0.5), uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT2 },
  controlPoint2: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(1, 0.5), uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT2 },
  delta: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(1, 1), uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT2 },
  texSize: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(100, 100), uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT2 }
};

/* harmony default export */ __webpack_exports__["a"] = (LinearFocusFilter);

/***/ }),
/* 334 */
/***/ (function(module, exports) {

module.exports = "/*!\n * Based on evanw's glfx.js tilt shift shader:\n * https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js\n */\n\nuniform sampler2D u_image;\nuniform float u_blurRadius;\nuniform vec2 u_controlPoint1;\nuniform vec2 u_controlPoint2;\nuniform vec2 u_delta;\nuniform vec2 u_texSize;\nvarying vec2 v_texCoord;\n\nfloat random(vec2 co)\n{\n    highp float a = 12.9898;\n    highp float b = 78.233;\n    highp float c = 43758.5453;\n    highp float dt = dot(co.xy,vec2(a,b));\n    highp float sn = mod(dt, 3.14);\n    return fract(sin(sn) * c);\n}\n\nvoid main() {\n    vec4 color = vec4(0.0);\n    float total = 0.0;\n\n    vec2 vector = u_controlPoint2 - u_controlPoint1;\n    float offset = random(gl_FragCoord.xy / u_texSize.xy);\n\n    float radius = smoothstep(0.0, 1.0,\n      abs(\n        clamp(dot(v_texCoord - u_controlPoint1, vector) / dot(vector, vector), 0.0, 1.0)\n      )\n    ) * u_blurRadius;\n\n    for (float t = -30.0; t <= 30.0; t++) {\n      float percent = (t + offset - 0.5) / 30.0;\n      float weight = 1.0 - abs(percent);\n      vec4 _sample = texture2D(u_image, v_texCoord + u_delta * percent * radius / u_texSize);\n\n      _sample.rgb *= _sample.a;\n\n      color += _sample * weight;\n      total += weight;\n    }\n\n    gl_FragColor = color / total;\n    gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\n}\n"

/***/ }),
/* 335 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__mirrored_focus_filter__ = __webpack_require__(336);






var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



var Vector2 = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Math"].Vector2;

/**
 * An operation that can draw a mirrored focus
 * @class
 * @extends PhotoEditorSDK.Operation
 * @memberof PhotoEditorSDK.Operations
 */

var MirroredFocusOperation = function (_Operation) {
  _inherits(MirroredFocusOperation, _Operation);

  /**
   * Creates a new MirroredFocusOperation
   * @param  {PhotoEditorSDK} sdk
   * @param  {Object} [options]
   */
  function MirroredFocusOperation() {
    var _ref;

    _classCallCheck(this, MirroredFocusOperation);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = MirroredFocusOperation.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(MirroredFocusOperation)).call.apply(_ref, [this].concat(args)));

    _this._lastBlurRadius = _this._options.blurRadius;
    _this._lastSize = _this._options.size;
    _this._lastGradientSize = _this._options.gradientSize;

    _this._horizontalFilter = new __WEBPACK_IMPORTED_MODULE_6__mirrored_focus_filter__["a" /* default */]();
    _this._verticalFilter = new __WEBPACK_IMPORTED_MODULE_6__mirrored_focus_filter__["a" /* default */]();
    _this._sprite.setFilters([_this._horizontalFilter, _this._verticalFilter]);

    _this._horizontalFilter.setDelta(new Vector2(0.5, 0.5));
    _this._verticalFilter.setDelta(new Vector2(-0.5, 0.5));

    _this._filter = new __WEBPACK_IMPORTED_MODULE_6__mirrored_focus_filter__["a" /* default */]();
    return _this;
  }

  /**
   * Applies the given rotation change
   * @param  {PhotoEditorSDK.Operations.RotationOperation} operation
   * @param  {Number} degrees
   */


  _createClass(MirroredFocusOperation, [{
    key: 'rotate',
    value: function rotate(degrees) {
      var start = this._options.start;
      var end = this._options.end;

      if (degrees === 90) {
        start.flip();
        start.x = 1 - start.x;
        end.flip();
        end.x = 1 - end.x;
      } else if (degrees === -90) {
        start.flip();
        start.y = 1 - start.y;
        end.flip();
        end.y = 1 - end.y;
      }

      this.set({ start: start, end: end });
    }

    /**
     * Applies a flip with the given direction
     * @param  {String} direction
     */

  }, {
    key: 'flip',
    value: function flip(direction) {
      var start = this._options.start;
      var end = this._options.end;

      switch (direction) {
        case 'horizontal':
          start.x = 1 - start.x;
          end.x = 1 - end.x;
          break;
        case 'vertical':
          start.y = 1 - start.y;
          end.y = 1 - end.y;
          break;
      }

      this.set({ start: start, end: end });
    }

    /**
     * Applies the given transform change
     * @param  {PhotoEditorSDK.Operations.TransformOperation.TransformChange} transformChange
     * @private
     */

  }, {
    key: 'transform',
    value: function transform(transformChange) {
      var _this2 = this;

      var newOptions = {};

      ['start', 'end'].forEach(function (optionName) {
        var vector = _this2.getOption(optionName);
        newOptions[optionName] = transformChange.applyToRelativePoint(vector);
      });

      ['blurRadius', 'size', 'gradientSize'].forEach(function (optionName) {
        var size = _this2.getOption(optionName);
        newOptions[optionName] = transformChange.applyToRelativeSize(size);
      });

      this.set(newOptions, false);
    }

    /**
     * Transforms this image using WebGL
     * @param  {PhotoEditorSDK.Engine.Texture} inputTexture
     * @override
     * @private
     */
    /* istanbul ignore next */

  }, {
    key: '_renderWebGL',
    value: function _renderWebGL(inputTexture) {
      var inputDimensions = inputTexture.getDimensions();
      var shortestSide = inputDimensions.min();

      var start = this._options.start.clone();
      var end = this._options.end.clone();

      var _options = this._options,
          blurRadius = _options.blurRadius,
          size = _options.size,
          gradientSize = _options.gradientSize;

      var commonOptions = {
        blurRadius: blurRadius * shortestSide,
        size: size * shortestSide,
        gradientSize: gradientSize * shortestSide,

        start: start.clone().multiply(inputDimensions),
        end: end.clone().multiply(inputDimensions),
        texSize: inputDimensions
      };

      this._horizontalFilter.set(commonOptions);
      this._verticalFilter.set(commonOptions);

      this._renderTexture.render(this._container);

      return __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Promise"].resolve();
    }

    /**
     * Renders the radial blur using Canvas2D
     * @param  {PhotoEditorSDK.Engine.Texture} inputTexture
     * @override
     * @private
     */

  }, {
    key: '_renderCanvas',
    value: function _renderCanvas(inputTexture) {
      var inputDimensions = inputTexture.getDimensions();

      var _options2 = this._options,
          blurRadius = _options2.blurRadius,
          size = _options2.size,
          gradientSize = _options2.gradientSize,
          start = _options2.start,
          end = _options2.end;

      this._filter.set({
        blurRadius: blurRadius,
        gradientSize: gradientSize,
        size: size,
        start: start.clone(),
        end: end.clone(),
        texSize: inputDimensions
      });

      this._sprite.setFilters([this._filter]);

      this._renderTexture.render(this._container);

      return __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Promise"].resolve();
    }

    /**
     * Disposes this operation
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      _get(MirroredFocusOperation.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(MirroredFocusOperation.prototype), 'dispose', this).call(this);
      this._filter.dispose();
      this._verticalFilter.dispose();
      this._horizontalFilter.dispose();
    }

    /**
     * Checks if the operation has changes/modifications
     * @return {Boolean}
     */

  }, {
    key: 'hasChanges',
    value: function hasChanges() {
      return true;
    }
  }]);

  return MirroredFocusOperation;
}(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Operation"]);

/**
 * A unique string that identifies this operation. Can be used to select
 * operations.
 * @type {String}
 * @default
 */


MirroredFocusOperation.identifier = 'mirrored-focus';

/**
 * Specifies the available options for this operation
 * @type {Object}
 * @ignore
 */
MirroredFocusOperation.prototype.availableOptions = {
  start: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(0.0, 0.5) },
  end: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(1.0, 0.5) },
  blurRadius: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.025 },
  size: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.1 },
  gradientSize: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.1 }
};

__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default.a.Operations.MirroredFocusOperation = MirroredFocusOperation;

/* harmony default export */ __webpack_exports__["a"] = (MirroredFocusOperation);

/***/ }),
/* 336 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__shared_vendor_stack_blur__ = __webpack_require__(75);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__shared_vendor_stack_blur___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5__shared_vendor_stack_blur__);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



var Vector2 = __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Math"].Vector2;

var MirroredFocusFilter = function (_Engine$Filter) {
  _inherits(MirroredFocusFilter, _Engine$Filter);

  function MirroredFocusFilter() {
    var _ref;

    _classCallCheck(this, MirroredFocusFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = MirroredFocusFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(MirroredFocusFilter)).call.apply(_ref, [this].concat(args)));

    _this._fragmentSource = __webpack_require__(337);

    _this._lastBlurRadius = null;
    _this._lastGradientRadius = null;
    _this._lastStart = new Vector2();
    _this._lastEnd = new Vector2();

    _this._blurredRenderTarget = new __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].CanvasRenderTarget(100, 100, 1);

    _this._maskRenderTarget = new __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].CanvasRenderTarget(100, 100, 1);
    return _this;
  }

  /**
   * Applies this filter to the given inputTarget and renders it to
   * the given outputTarget using the CanvasRenderer
   * @param  {CanvasRenderer} renderer
   * @param  {RenderTarget} inputTarget
   * @param  {RenderTarget} outputTarget
   * @param  {Boolean} clear = false
   * @private
   */


  _createClass(MirroredFocusFilter, [{
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var inputDimensions = inputTarget.getDimensions();
      var dimensionsChanged = !this._blurredRenderTarget.getDimensions().equals(inputDimensions);

      this._blurredRenderTarget.setPixelRatio(inputTarget.getPixelRatio());
      this._blurredRenderTarget.resizeTo(inputTarget.getDimensions());

      this._maskRenderTarget.setPixelRatio(inputTarget.getPixelRatio());
      this._maskRenderTarget.resizeTo(inputTarget.getDimensions());

      if (!this._lastStart.equals(this._options.start) || !this._lastEnd.equals(this._options.end) || this._lastGradientRadius !== this._options.size || dimensionsChanged) {
        this._renderMask();

        this._lastStart = this._options.start.clone();
        this._lastEnd = this._options.end.clone();
        this._lastGradientRadius = this._options.size;
      }

      if (this._lastBlurRadius !== this._options.blurRadius || dimensionsChanged) {
        this._blurImage(inputTarget);
        this._lastBlurRadius = this._options.blurRadius;
      }

      this._applyMask(inputTarget, outputTarget);
    }

    /**
     * Creates a blurred copy of the image
     * @param  {CanvasRenderTarget} inputTarget
     * @return {Canvas}
     * @private
     */

  }, {
    key: '_blurImage',
    value: function _blurImage(inputTarget) {
      var inputCanvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();

      var inputDimensions = new Vector2(inputCanvas.width, inputCanvas.height);
      var blurryImageData = inputContext.getImageData(0, 0, inputCanvas.width, inputCanvas.height);
      __WEBPACK_IMPORTED_MODULE_5__shared_vendor_stack_blur___default.a.stackBlurCanvasRGBA(blurryImageData, 0, 0, inputCanvas.width, inputCanvas.height, this._options.blurRadius * inputDimensions.min());

      var blurryContext = this._blurredRenderTarget.getContext();
      blurryContext.putImageData(blurryImageData, 0, 0);
    }

    /**
     * Renders the mask canvas
     * @private
     */

  }, {
    key: '_renderMask',
    value: function _renderMask() {
      var canvas = this._maskRenderTarget.getCanvas();
      var context = this._maskRenderTarget.getContext();
      var pixelRatio = this._maskRenderTarget.getPixelRatio();

      var canvasDimensions = new Vector2(canvas.width, canvas.height);

      var size = this._options.size * canvasDimensions.min() * pixelRatio;
      var gradientSize = this._options.gradientSize * canvasDimensions.min() * pixelRatio;
      var start = this._options.start.clone().multiply(canvasDimensions);
      var end = this._options.end.clone().multiply(canvasDimensions);
      var dist = end.clone().subtract(start);
      var middle = start.clone().add(dist.clone().divide(2));

      var totalDist = dist.len();
      var factor = dist.clone().divide(totalDist);

      var gradientStart = middle.clone().add((size + gradientSize) * factor.y, -(size + gradientSize) * factor.x);
      var gradientEnd = middle.clone().add(-(size + gradientSize) * factor.y, (size + gradientSize) * factor.x);

      // Build gradient
      var gradient = context.createLinearGradient(gradientStart.x, gradientStart.y, gradientEnd.x, gradientEnd.y);
      var fullGradientSize = gradientEnd.clone().subtract(gradientStart).len();
      gradient.addColorStop(0, '#000000');
      gradient.addColorStop(gradientSize / 2 / fullGradientSize, '#FFFFFF');
      gradient.addColorStop(1.0 - gradientSize / 2 / fullGradientSize, '#FFFFFF');
      gradient.addColorStop(1, '#000000');

      // Draw gradient
      context.fillStyle = gradient;
      context.fillRect(0, 0, canvas.width, canvas.height);
    }

    /**
     * Applies the blur and mask to the input canvas
     * @param {CanvasRenderTarget} inputTarget
     * @param {CanvasRenderTarget} outputTarget
     * @private
     */

  }, {
    key: '_applyMask',
    value: function _applyMask(inputTarget, outputTarget) {
      var outputContext = outputTarget.getContext();
      var inputCanvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();
      var blurredContext = this._blurredRenderTarget.getContext();
      var maskContext = this._maskRenderTarget.getContext();

      var inputImageData = inputContext.getImageData(0, 0, inputCanvas.width, inputCanvas.height);
      var pixels = inputImageData.data;
      var blurredPixels = blurredContext.getImageData(0, 0, inputCanvas.width, inputCanvas.height).data;
      var maskPixels = maskContext.getImageData(0, 0, inputCanvas.width, inputCanvas.height).data;

      var alpha = void 0;
      for (var i = 0; i < inputCanvas.width * inputCanvas.height * 4; i += 4) {
        alpha = maskPixels[i] / 255;

        pixels[i] = alpha * pixels[i] + (1 - alpha) * blurredPixels[i];
        pixels[i + 1] = alpha * pixels[i + 1] + (1 - alpha) * blurredPixels[i + 1];
        pixels[i + 2] = alpha * pixels[i + 2] + (1 - alpha) * blurredPixels[i + 2];
      }

      outputContext.putImageData(inputImageData, 0, 0);
    }
  }]);

  return MirroredFocusFilter;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].Filter);

MirroredFocusFilter.prototype.availableOptions = {
  blurRadius: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 30, uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT },
  size: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 50, uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT },
  gradientSize: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 50, uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT },
  start: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(0, 0.5), uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT2 },
  end: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(1, 0.5), uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT2 },
  delta: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(1, 1), uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT2 },
  texSize: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(100, 100), uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT2 }
};

/* harmony default export */ __webpack_exports__["a"] = (MirroredFocusFilter);

/***/ }),
/* 337 */
/***/ (function(module, exports) {

module.exports = "/*\n * Based on evanw's glfx.js tilt shift shader:\n * https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js\n * @license\n */\n\nuniform sampler2D u_image;\nuniform float u_blurRadius;\nuniform float u_gradientSize;\nuniform float u_size;\nuniform vec2 u_start;\nuniform vec2 u_end;\nuniform vec2 u_delta;\nuniform vec2 u_texSize;\nvarying vec2 v_texCoord;\n\nfloat random(vec2 co)\n{\n    highp float a = 12.9898;\n    highp float b = 78.233;\n    highp float c = 43758.5453;\n    highp float dt = dot(co.xy,vec2(a,b));\n    highp float sn = mod(dt, 3.14);\n    return fract(sin(sn) * c);\n}\n\nvoid main() {\n    vec4 color = vec4(0.0);\n    float total = 0.0;\n\n    float offset = random(gl_FragCoord.xy / u_texSize.xy);\n\n    vec2 normal = normalize(vec2(u_start.y - u_end.y, u_end.x - u_start.x));\n    float radius = smoothstep(0.0, 1.0,\n      (abs(\n        dot(v_texCoord * u_texSize - u_start, normal)\n      ) - u_size) / u_gradientSize\n    ) * u_blurRadius;\n\n    for (float t = -30.0; t <= 30.0; t++) {\n        float percent = (t + offset - 0.5) / 30.0;\n        float weight = 1.0 - abs(percent);\n        vec4 _sample = texture2D(u_image, v_texCoord + u_delta * percent * radius / u_texSize);\n\n        _sample.rgb *= _sample.a;\n\n        color += _sample * weight;\n        total += weight;\n    }\n\n    gl_FragColor = color / total;\n    gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\n}\n"

/***/ }),
/* 338 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */


var Vector2 = __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Math"].Vector2;

/**
 * An operation that can rotate and flip an image
 * @class
 * @extends PhotoEditorSDK.Operation
 * @memberof PhotoEditorSDK.Operations
 */

var OrientationOperation = function (_Operation) {
  _inherits(OrientationOperation, _Operation);

  function OrientationOperation() {
    _classCallCheck(this, OrientationOperation);

    return _possibleConstructorReturn(this, (OrientationOperation.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(OrientationOperation)).apply(this, arguments));
  }

  _createClass(OrientationOperation, [{
    key: '_render',

    /**
     * Rotates and/or flips the image
     * @param  {PhotoEditorSDK} sdk
     * @returns {Promise}
     * @override
     * @private
     */
    value: function _render(sdk) {
      var actualDegrees = this._options.rotation % 360;
      var radians = actualDegrees * (Math.PI / 180);

      this._sprite.setScale(this._options.flipHorizontally ? -1 : 1, this._options.flipVertically ? -1 : 1);
      this._sprite.setRotation(radians);
      this._sprite.setAnchor(0.5, 0.5);
      this._sprite.updateTransform();

      var bounds = this._sprite.getBounds();
      this._renderTexture.resizeTo(new Vector2(bounds.width, bounds.height));

      // Make sure we're rendering to top left corner
      this._sprite.setPosition(this._renderTexture.getDimensions().divide(2).round());

      // Draw
      this._renderTexture.render(this._container);

      return __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Promise"].resolve();
    }

    /**
     * Returns the dimensions the given dimensions will have after this operation
     * has been applied
     * @param {PhotoEditorSDK.Math.Vector2} dimensions
     * @return {PhotoEditorSDK.Math.Vector2}
     * @override
     */

  }, {
    key: 'getNewDimensions',
    value: function getNewDimensions(dimensions) {
      dimensions = dimensions.clone();
      if (this._options.rotation % 180) {
        dimensions.flip();
      }
      return dimensions;
    }

    /**
     * Flips the image while incorporating the current rotation
     * @param {String} direction
     */

  }, {
    key: 'flip',
    value: function flip(direction) {
      var rotation = this._options.rotation;

      if (rotation === 90 || rotation === 270) {
        if (direction === 'vertical') {
          direction = 'horizontal';
        } else {
          direction = 'vertical';
        }
      }

      switch (direction) {
        case 'vertical':
          this.setFlipVertically(!this.getFlipVertically());
          break;
        case 'horizontal':
          this.setFlipHorizontally(!this.getFlipHorizontally());
          break;
      }
    }
  }]);

  return OrientationOperation;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Operation"]);

/**
 * A unique string that identifies this operation. Can be used to select
 * operations.
 * @type {String}
 * @default
 */


OrientationOperation.identifier = 'orientation';

/**
 * Specifies the available options for this operation
 * @type {Object}
 * @ignore
 */
OrientationOperation.prototype.availableOptions = {
  rotation: {
    type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER,
    default: 0,
    validation: function validation(value) {
      if (value % 90 !== 0) {
        throw new Error('OrientationOperation: `rotation` has to be a multiple of 90.');
      }
    },
    setter: function setter(value) {
      return (value + 360) % 360;
    }
  },
  flipVertically: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].BOOLEAN, default: false },
  flipHorizontally: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].BOOLEAN, default: false }
};

__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default.a.Operations.OrientationOperation = OrientationOperation;

/* harmony default export */ __webpack_exports__["a"] = (OrientationOperation);

/***/ }),
/* 339 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_keys__ = __webpack_require__(69);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_keys___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_keys__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__);







var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */


var OverlayFilter = __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Engine"].Filters.OverlayFilter;
var Vector2 = __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Math"].Vector2;

var GL_UNIT = 4;

/**
 * An operation that can draw a watermark on top of the image
 * @class
 * @extends PhotoEditorSDK.Operation
 * @memberof PhotoEditorSDK.Operations
 */

var OverlayOperation = function (_Operation) {
  _inherits(OverlayOperation, _Operation);

  /**
   * Creates a new OverlayOperation
   * @param  {PhotoEditorSDK} sdk
   * @param  {Object} [options]
   */
  function OverlayOperation() {
    var _ref;

    _classCallCheck(this, OverlayOperation);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = OverlayOperation.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(OverlayOperation)).call.apply(_ref, [this].concat(args)));

    _this._overlayTexture = __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Engine"].Texture.fromImage(_this._options.image);
    _this._overlayContainer = new __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Engine"].Container();
    _this._overlaySprite = new __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Engine"].Sprite();
    _this._overlaySprite.setTexture(_this._overlayTexture);
    _this._overlaySprite.setAnchor(0, 0);
    _this._overlayContainer.addChild(_this._overlaySprite);

    _this._overlayFilter = new __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Engine"].Filters.OverlayFilter({
      overlayImage: _this._overlayTexture.getBaseTexture().getGLUnit(),
      overlayTexture: _this._overlayTexture
    });
    _this._sprite.setFilters([_this._overlayFilter]);

    _this._renderedOverlaySprite = new __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Engine"].Sprite();
    _this._renderedOverlayContainer = new __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Engine"].Container();
    _this._renderedOverlayContainer.addChild(_this._renderedOverlaySprite);

    _this._overlayRendered = false;
    _this._lastInputDimensions = new Vector2(0, 0);
    return _this;
  }

  _createClass(OverlayOperation, [{
    key: 'setOption',
    value: function setOption(name, value) {
      _get(OverlayOperation.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(OverlayOperation.prototype), 'setOption', this).call(this, name, value);

      if (name === 'image' && value && this._sdk) {
        var renderer = this._sdk.getRenderer();
        var baseTexture = this._overlayTexture.getBaseTexture();
        baseTexture.setSource(value);

        if (renderer.isOfType(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["RendererType"].WEBGL)) {
          renderer.updateTexture(baseTexture);
        }

        this._overlayRendered = false;
      }
    }

    /**
     * Renders the watermark
     * @param  {PhotoEditorSDK.Engine.Texture} inputTexture
     * @private
     * @override
     */

  }, {
    key: '_render',
    value: function _render(inputTexture) {
      var inputDimensions = inputTexture.getDimensions();
      var _options = this._options,
          image = _options.image,
          alpha = _options.alpha,
          blendMode = _options.blendMode;

      if (!image) {
        this._sprite.setFilters([]);
        this._renderTexture.render(this._container);
        return __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Promise"].resolve();
      }

      if (!this._overlayRendered || !this._lastInputDimensions.equals(inputDimensions)) {
        this._renderOverlayToRenderTexture(inputTexture);
        this._overlayRendered = true;
        this._lastInputDimensions.copy(inputDimensions);
      }

      this._overlayFilter.set({
        blendMode: blendMode,
        overlayImage: this._overlayRenderTexture.getBaseTexture().getGLUnit(),
        overlayTexture: this._overlayRenderTexture,
        alpha: alpha
      });
      this._sprite.setFilters([this._overlayFilter]);

      this._renderTexture.render(this._container);

      return __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Promise"].resolve(this._renderTexture);
    }

    /**
     * Renders the overlay to a render texture that has the same dimensions as the input texture
     * @param  {PhotoEditorSDK.Engine.Texture} inputTexture
     * @private
     */

  }, {
    key: '_renderOverlayToRenderTexture',
    value: function _renderOverlayToRenderTexture(inputTexture) {
      var renderer = this._sdk.getRenderer();
      var textureDimensions = inputTexture.getDimensions();

      if (!this._overlayRenderTexture) {
        this._overlayRenderTexture = new __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Engine"].RenderTexture(renderer, textureDimensions.x, textureDimensions.y);
        this._renderedOverlaySprite.setTexture(this._overlayRenderTexture);
      }

      var _options$image = this._options.image,
          width = _options$image.width,
          height = _options$image.height;

      var dimensions = __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Utils"].resizeVectorToFill(new Vector2(width, height), textureDimensions);
      this._overlaySprite.setWidth(dimensions.x);
      this._overlaySprite.setHeight(dimensions.y);

      var baseTexture = this._overlayRenderTexture.getBaseTexture();

      if (renderer.isOfType(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["RendererType"].WEBGL)) {
        baseTexture.setGLUnit(GL_UNIT);
        renderer.updateTexture(baseTexture, false);
      }
      this._overlayRenderTexture.resizeTo(textureDimensions);
      this._overlayRenderTexture.render(this._overlayContainer);
    }

    /**
     * Disposes this operation
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      _get(OverlayOperation.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(OverlayOperation.prototype), 'dispose', this).call(this);
      this._overlaySprite.dispose();
    }
  }]);

  return OverlayOperation;
}(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Operation"]);

/**
 * A unique string that identifies this operation. Can be used to select
 * operations.
 * @type {String}
 * @default
 */


OverlayOperation.identifier = 'overlay';

/**
 * The available blend modes
 * @type {Object}
 */
OverlayOperation.BLEND_MODES = OverlayFilter.BLEND_MODES;

/**
 * Specifies the available options for this operation
 * @type {Object}
 * @ignore
 */
OverlayOperation.prototype.availableOptions = {
  identifier: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].STRING },
  image: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].IMAGE },
  blendMode: {
    type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].NUMBER,
    default: OverlayFilter.BLEND_MODES.MULTIPLY,
    available: __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_keys___default()(OverlayFilter.BLEND_MODES).map(function (o) {
      return OverlayFilter.BLEND_MODES[o];
    })
  },
  alpha: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].NUMBER, default: 1 }
};

__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core___default.a.Operations.OverlayOperation = OverlayOperation;

/* harmony default export */ __webpack_exports__["a"] = (OverlayOperation);

/***/ }),
/* 340 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__radial_focus_filter__ = __webpack_require__(341);






var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



var Vector2 = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Math"].Vector2;

/**
 * An operation that can draw a radial focus
 * @class
 * @extends PhotoEditorSDK.Operation
 * @memberof PhotoEditorSDK.Operations
 */

var RadialFocusOperation = function (_Operation) {
  _inherits(RadialFocusOperation, _Operation);

  /**
   * Creates a new RadialFocusOperation
   * @param  {PhotoEditorSDK} sdk
   * @param  {Object} [options]
   */
  function RadialFocusOperation() {
    var _ref;

    _classCallCheck(this, RadialFocusOperation);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = RadialFocusOperation.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(RadialFocusOperation)).call.apply(_ref, [this].concat(args)));

    _this._lastBlurRadius = _this._options.blurRadius;
    _this._lastGradientRadius = _this._options.gradientRadius;

    _this._horizontalFilter = new __WEBPACK_IMPORTED_MODULE_6__radial_focus_filter__["a" /* default */]();
    _this._verticalFilter = new __WEBPACK_IMPORTED_MODULE_6__radial_focus_filter__["a" /* default */]();
    _this._sprite.setFilters([_this._horizontalFilter, _this._verticalFilter]);

    _this._horizontalFilter.setDelta(new Vector2(0.5, 0.5));
    _this._verticalFilter.setDelta(new Vector2(-0.5, 0.5));

    _this._filter = new __WEBPACK_IMPORTED_MODULE_6__radial_focus_filter__["a" /* default */]();
    return _this;
  }

  /**
   * Applies the given rotation change
   * @param  {Number} degrees
   */


  _createClass(RadialFocusOperation, [{
    key: 'rotate',
    value: function rotate(degrees) {
      var position = this._options.position;

      if (degrees === 90) {
        position.flip();
        position.x = 1 - position.x;
      } else if (degrees === -90) {
        position.flip();
        position.y = 1 - position.y;
      }

      this.set({ position: position });
    }

    /**
     * Applies a flip with the given direction
     * @param  {String} direction
     */

  }, {
    key: 'flip',
    value: function flip(direction) {
      var position = this._options.position;

      switch (direction) {
        case 'horizontal':
          position.x = 1 - position.x;
          break;
        case 'vertical':
          position.y = 1 - position.y;
          break;
      }

      this.set({ position: position });
    }

    /**
     * Applies the given transform change
     * @param  {PhotoEditorSDK.Operations.TransformOperation.TransformChange} transformChange
     * @private
     */

  }, {
    key: 'transform',
    value: function transform(transformChange) {
      var _this2 = this;

      var newOptions = {};

      var vector = this.getPosition();
      newOptions.position = transformChange.applyToRelativePoint(vector);

      ['radius', 'blurRadius', 'gradientRadius'].forEach(function (optionName) {
        var size = _this2.getOption(optionName);
        newOptions[optionName] = transformChange.applyToRelativeSize(size);
      });

      this.set(newOptions, false);
    }

    /**
     * Renders the radial blur using WebGL
     * @param  {PhotoEditorSDK.Engine.Texture} inputTexture
     * @private
     * @override
     */
    /* istanbul ignore next */

  }, {
    key: '_renderWebGL',
    value: function _renderWebGL(inputTexture) {
      var inputDimensions = inputTexture.getDimensions();
      var shortestSide = inputDimensions.min();

      var _options = this._options,
          position = _options.position,
          blurRadius = _options.blurRadius,
          radius = _options.radius,
          gradientRadius = _options.gradientRadius;


      var commonOptions = {
        blurRadius: blurRadius * shortestSide,
        radius: radius * shortestSide,
        gradientRadius: gradientRadius * shortestSide,
        position: position.clone().multiply(inputDimensions),
        texSize: inputDimensions
      };

      this._horizontalFilter.set(commonOptions);
      this._verticalFilter.set(commonOptions);

      this._renderTexture.render(this._container);

      return __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Promise"].resolve();
    }

    /**
     * Renders the radial blur using Canvas2D
     * @param  {PhotoEditorSDK.Engine.Texture} inputTexture
     * @private
     * @override
     */

  }, {
    key: '_renderCanvas',
    value: function _renderCanvas(inputTexture) {
      var _options2 = this._options,
          blurRadius = _options2.blurRadius,
          radius = _options2.radius,
          gradientRadius = _options2.gradientRadius,
          position = _options2.position;

      var inputDimensions = inputTexture.getDimensions();

      this._filter.set({
        blurRadius: blurRadius,
        radius: radius,
        gradientRadius: gradientRadius,
        position: position,
        texSize: inputDimensions
      });

      this._sprite.setFilters([this._filter]);

      this._renderTexture.render(this._container);

      return __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Promise"].resolve();
    }

    /**
     * Disposes this operation
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      _get(RadialFocusOperation.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(RadialFocusOperation.prototype), 'dispose', this).call(this);
      this._filter.dispose();
      this._verticalFilter.dispose();
      this._horizontalFilter.dispose();
    }

    /**
     * Checks if the operation has changes/modifications
     * @return {Boolean}
     */

  }, {
    key: 'hasChanges',
    value: function hasChanges() {
      return true;
    }
  }]);

  return RadialFocusOperation;
}(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Operation"]);

/**
 * A unique string that identifies this operation. Can be used to select
 * operations.
 * @type {String}
 * @default
 */


RadialFocusOperation.identifier = 'radial-focus';

/**
 * Specifies the available options for this operation
 * @type {Object}
 * @ignore
 */
RadialFocusOperation.prototype.availableOptions = {
  position: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(0.5, 0.5) },
  radius: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.25 },
  gradientRadius: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.125 },
  blurRadius: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.025 }
};

__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default.a.Operations.RadialFocusOperation = RadialFocusOperation;

/* harmony default export */ __webpack_exports__["a"] = (RadialFocusOperation);

/***/ }),
/* 341 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__shared_vendor_stack_blur__ = __webpack_require__(75);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__shared_vendor_stack_blur___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5__shared_vendor_stack_blur__);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



var Vector2 = __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Math"].Vector2;

var RadialFocusFilter = function (_Engine$Filter) {
  _inherits(RadialFocusFilter, _Engine$Filter);

  function RadialFocusFilter() {
    var _ref;

    _classCallCheck(this, RadialFocusFilter);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = RadialFocusFilter.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(RadialFocusFilter)).call.apply(_ref, [this].concat(args)));

    _this._fragmentSource = __webpack_require__(342);

    _this._lastBlurRadius = null;
    _this._lastGradientRadius = null;
    _this._lastPosition = new Vector2();

    _this._blurredRenderTarget = new __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].CanvasRenderTarget(100, 100, 1);

    _this._maskRenderTarget = new __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].CanvasRenderTarget(100, 100, 1);
    return _this;
  }

  /**
   * Applies this filter to the given inputTarget and renders it to
   * the given outputTarget using the CanvasRenderer
   * @param  {CanvasRenderer} renderer
   * @param  {RenderTarget} inputTarget
   * @param  {RenderTarget} outputTarget
   * @param  {Boolean} clear = false
   * @private
   */


  _createClass(RadialFocusFilter, [{
    key: '_applyCanvas',
    value: function _applyCanvas(renderer, inputTarget, outputTarget) {
      var clear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      var inputDimensions = inputTarget.getDimensions();
      var dimensionsChanged = !this._blurredRenderTarget.getDimensions().equals(inputDimensions);

      this._blurredRenderTarget.setPixelRatio(inputTarget.getPixelRatio());
      this._blurredRenderTarget.resizeTo(inputTarget.getDimensions());

      this._maskRenderTarget.setPixelRatio(inputTarget.getPixelRatio());
      this._maskRenderTarget.resizeTo(inputTarget.getDimensions());

      if (!this._lastPosition.equals(this._options.position) || this._lastGradientRadius !== this._options.gradientRadius || dimensionsChanged) {
        this._renderMask();

        this._lastPosition = this._options.position.clone();
        this._lastGradientRadius = this._options.gradientRadius;
      }

      if (this._lastBlurRadius !== this._options.blurRadius || dimensionsChanged) {
        this._blurImage(inputTarget);
        this._lastBlurRadius = this._options.blurRadius;
      }

      this._applyMask(inputTarget, outputTarget);
    }

    /**
     * Creates a blurred copy of the image
     * @param  {CanvasRenderTarget} inputTarget
     * @return {Canvas}
     * @private
     */

  }, {
    key: '_blurImage',
    value: function _blurImage(inputTarget) {
      var inputCanvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();

      var inputDimensions = new Vector2(inputCanvas.width, inputCanvas.height);
      var blurryImageData = inputContext.getImageData(0, 0, inputCanvas.width, inputCanvas.height);
      __WEBPACK_IMPORTED_MODULE_5__shared_vendor_stack_blur___default.a.stackBlurCanvasRGBA(blurryImageData, 0, 0, inputCanvas.width, inputCanvas.height, this._options.blurRadius * inputDimensions.min());

      var blurryContext = this._blurredRenderTarget.getContext();
      blurryContext.putImageData(blurryImageData, 0, 0);
    }

    /**
     * Renders the mask canvas
     * @private
     */

  }, {
    key: '_renderMask',
    value: function _renderMask() {
      var canvas = this._maskRenderTarget.getCanvas();
      var context = this._maskRenderTarget.getContext();

      var canvasDimensions = new Vector2(canvas.width, canvas.height);
      var pixelRatio = this._maskRenderTarget.getPixelRatio();
      var position = this._options.position.clone().multiply(canvasDimensions);

      var _options = this._options,
          radius = _options.radius,
          gradientRadius = _options.gradientRadius;

      radius *= canvas.height;
      gradientRadius *= canvas.height;

      // Build gradient
      var gradient = context.createRadialGradient(position.x, position.y, 0, position.x, position.y, (radius + gradientRadius) * pixelRatio);
      gradient.addColorStop(0, '#FFFFFF');
      gradient.addColorStop(radius / (radius + gradientRadius), '#FFFFFF');
      gradient.addColorStop(1, '#000000');

      // Draw gradient
      context.fillStyle = gradient;
      context.fillRect(0, 0, canvasDimensions.x, canvasDimensions.y);
    }

    /**
     * Applies the blur and mask to the input canvas
     * @param {CanvasRenderTarget} inputTarget
     * @param {CanvasRenderTarget} outputTarget
     * @private
     */

  }, {
    key: '_applyMask',
    value: function _applyMask(inputTarget, outputTarget) {
      var outputContext = outputTarget.getContext();
      var inputCanvas = inputTarget.getCanvas();
      var inputContext = inputTarget.getContext();
      var blurredContext = this._blurredRenderTarget.getContext();
      var maskContext = this._maskRenderTarget.getContext();

      var inputImageData = inputContext.getImageData(0, 0, inputCanvas.width, inputCanvas.height);
      var pixels = inputImageData.data;
      var blurredPixels = blurredContext.getImageData(0, 0, inputCanvas.width, inputCanvas.height).data;
      var maskPixels = maskContext.getImageData(0, 0, inputCanvas.width, inputCanvas.height).data;

      var alpha = void 0;
      for (var i = 0; i < inputCanvas.width * inputCanvas.height * 4; i += 4) {
        alpha = maskPixels[i] / 255;

        pixels[i] = alpha * pixels[i] + (1 - alpha) * blurredPixels[i];
        pixels[i + 1] = alpha * pixels[i + 1] + (1 - alpha) * blurredPixels[i + 1];
        pixels[i + 2] = alpha * pixels[i + 2] + (1 - alpha) * blurredPixels[i + 2];
      }

      outputContext.putImageData(inputImageData, 0, 0);
    }
  }]);

  return RadialFocusFilter;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Engine"].Filter);

RadialFocusFilter.prototype.availableOptions = {
  blurRadius: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 30, uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT },
  radius: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 50, uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT },
  gradientRadius: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 25, uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT },
  position: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(0.5, 0.5), uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT2 },
  delta: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(1, 1), uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT2 },
  texSize: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(100, 100), uniformType: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["UniformType"].FLOAT2 }
};

/* harmony default export */ __webpack_exports__["a"] = (RadialFocusFilter);

/***/ }),
/* 342 */
/***/ (function(module, exports) {

module.exports = "/*\n * Based on evanw's glfx.js tilt shift shader:\n * https://github.com/evanw/glfx.js/blob/master/src/filters/blur/tiltshift.js\n * @license\n */\n\nuniform sampler2D u_image;\nuniform float u_radius;\nuniform float u_blurRadius;\nuniform float u_gradientRadius;\nuniform vec2 u_position;\nuniform vec2 u_delta;\nuniform vec2 u_texSize;\nvarying vec2 v_texCoord;\n\nfloat random(vec2 co)\n{\n    highp float a = 12.9898;\n    highp float b = 78.233;\n    highp float c = 43758.5453;\n    highp float dt = dot(co.xy,vec2(a,b));\n    highp float sn = mod(dt, 3.14);\n    return fract(sin(sn) * c);\n}\n\nvoid main() {\n    vec4 color = vec4(0.0);\n    float total = 0.0;\n\n    float offset = random(gl_FragCoord.xy / u_texSize.xy);\n    float radius = smoothstep(\n      0.0, 1.0,\n      (abs(\n        distance(v_texCoord * u_texSize, u_position)\n      ) - u_radius) / (u_gradientRadius * 2.0)\n    ) * u_blurRadius;\n    for (float t = -30.0; t <= 30.0; t++) {\n        float percent = (t + offset - 0.5) / 30.0;\n        float weight = 1.0 - abs(percent);\n        vec4 _sample = texture2D(u_image, v_texCoord + u_delta * percent * radius / u_texSize);\n\n        _sample.rgb *= _sample.a;\n\n        color += _sample * weight;\n        total += weight;\n    }\n\n    gl_FragColor = color / total;\n    gl_FragColor.rgb /= gl_FragColor.a + 0.00001;\n}\n"

/***/ }),
/* 343 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__shared_sprites_brush_sprite__ = __webpack_require__(147);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__shared_filters_blur_filter__ = __webpack_require__(144);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__shared_filters_mask_filter__ = __webpack_require__(149);






var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */






var Vector2 = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Math"].Vector2;

/**
 * An operation that can draw a selective blur using brushes
 * @class
 * @extends PhotoEditorSDK.Operation
 * @memberof PhotoEditorSDK.Operations
 */

var SelectiveBlurOperation = function (_Operation) {
  _inherits(SelectiveBlurOperation, _Operation);

  /**
   * Creates a new SelectiveBlurOperation
   * @param  {PhotoEditorSDK} sdk
   * @param  {Object} [options]
   */
  function SelectiveBlurOperation() {
    var _ref;

    _classCallCheck(this, SelectiveBlurOperation);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = SelectiveBlurOperation.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(SelectiveBlurOperation)).call.apply(_ref, [this].concat(args)));

    var renderer = _this._sdk.getRenderer();

    _this._lastBlurRadius = null;
    _this._blurredRenderTexture = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].RenderTexture(renderer, 100, 100, 1);
    _this._maskRenderTexture = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].RenderTexture(renderer, 100, 100, 1);

    _this._brushSprite = new __WEBPACK_IMPORTED_MODULE_6__shared_sprites_brush_sprite__["a" /* default */](_this);
    _this._brushSpriteContainer = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].Container();
    var brushSprite = _this._brushSprite.getDisplayObject();
    _this._brushSpriteContainer.addChild(brushSprite);

    _this._outputSprite = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].Sprite();
    _this._outputContainer = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].Container();
    _this._outputContainer.addChild(_this._outputSprite);

    _this._maskFilter = new __WEBPACK_IMPORTED_MODULE_8__shared_filters_mask_filter__["a" /* default */]();
    if (renderer.isOfType(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["RendererType"].WEBGL)) {
      _this._horizontalFilter = new __WEBPACK_IMPORTED_MODULE_7__shared_filters_blur_filter__["a" /* default */]();
      _this._verticalFilter = new __WEBPACK_IMPORTED_MODULE_7__shared_filters_blur_filter__["a" /* default */]();
      _this._sprite.setFilters([_this._horizontalFilter, _this._verticalFilter]);

      _this._horizontalFilter.setDelta(new Vector2(1, 1));
      _this._verticalFilter.setDelta(new Vector2(-1, 1));

      var baseTexture = _this._maskRenderTexture.getBaseTexture();
      baseTexture.setGLUnit(_this._maskFilter.getMaskImage());
      renderer.updateTexture(baseTexture, false);

      baseTexture = _this._blurredRenderTexture.getBaseTexture();
      baseTexture.setGLUnit(_this._maskFilter.getFilterImage());
      renderer.updateTexture(baseTexture, false);
    } else if (renderer.isOfType(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["RendererType"].CANVAS)) {
      _this._blurFilter = new __WEBPACK_IMPORTED_MODULE_7__shared_filters_blur_filter__["a" /* default */]();

      _this._sprite.setFilters([_this._blurFilter]);

      _this._maskFilter.setMaskCanvas(_this._maskRenderTexture.getRenderTarget().getCanvas());
      _this._maskFilter.setFilterCanvas(_this._blurredRenderTexture.getRenderTarget().getCanvas());
    }

    _this._outputSprite.setFilters([_this._maskFilter]);
    return _this;
  }

  /**
   * Applies a flip to this operation
   * @param  {String} direction
   */


  _createClass(SelectiveBlurOperation, [{
    key: 'flip',
    value: function flip(direction) {
      this._brushSprite.applyFlip(direction);
      this.setDirty(true, true);
      this._lastBlurRadius = null;
    }

    /**
     * Applies a rotation to this operation
     * @param  {Number} degrees
     */

  }, {
    key: 'rotate',
    value: function rotate(degrees) {
      this._brushSprite.applyRotation(degrees);
      this.setDirty(true, true);
      this._lastBlurRadius = null;
    }

    /**
     * Applies a transform to this operation
     * @param  {PhotoEditorSDK.Operation} transformOperation
     * @param  {Object} options
     */

  }, {
    key: 'transform',
    value: function transform(transformOperation, options) {
      this._brushSprite.applyTransform(transformOperation, options);
      this.setDirty(true, true);
      this._lastBlurRadius = null;
    }

    /**
     * Renders this operation
     * @param  {PhotoEditorSDK.Engine.Texture} inputTexture
     * @override
     * @private
     */

  }, {
    key: '_render',
    value: function _render(inputTexture) {
      this._renderBlur(inputTexture);
      this._renderMask(inputTexture);

      this._outputSprite.setTexture(inputTexture);
      this._renderTexture.render(this._outputContainer);

      return __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Promise"].resolve();
    }

    /**
     * Renders the mask
     * @param  {PhotoEditorSDK.Engine.Texture} inputTexture
     * @private
     */

  }, {
    key: '_renderMask',
    value: function _renderMask(inputTexture) {
      var inputDimensions = inputTexture.getDimensions();

      var maskDimensions = this._maskRenderTexture.getDimensions();
      if (!maskDimensions.equals(inputDimensions)) {
        this._maskRenderTexture.resizeTo(inputDimensions);
      }

      this._brushSprite.update(this._sdk, inputDimensions);
      this._maskRenderTexture.clear(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Color"].BLACK);
      this._maskRenderTexture.render(this._brushSpriteContainer);

      var renderer = this._sdk.getRenderer();
      if (renderer.isOfType(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["RendererType"].WEBGL)) {
        renderer.updateTexture(this._maskRenderTexture.getBaseTexture(), false);
      }
    }

    /**
     * Blurs the input image
     * @param  {PhotoEditorSDK.Engine.Texture} inputTexture
     * @private
     */

  }, {
    key: '_renderBlur',
    value: function _renderBlur(inputTexture) {
      var inputDimensions = inputTexture.getDimensions();

      var blurredDimensions = this._blurredRenderTexture.getDimensions();
      if (!blurredDimensions.equals(inputDimensions)) {
        this._blurredRenderTexture.resizeTo(inputDimensions);
      }

      var blurRadius = this._options.blurRadius;

      if (this._lastBlurRadius !== blurRadius || !blurredDimensions.equals(inputDimensions)) {
        var renderer = this._sdk.getRenderer();

        var blurOptions = void 0;
        if (renderer.isOfType(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["RendererType"].WEBGL)) {
          var shortestSide = inputDimensions.min();
          blurOptions = {
            blurRadius: blurRadius * shortestSide,
            texSize: inputDimensions
          };

          this._horizontalFilter.set(blurOptions);
          this._verticalFilter.set(blurOptions);
        } else if (renderer.isOfType(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["RendererType"].CANVAS)) {
          blurOptions = { blurRadius: blurRadius };
          this._blurFilter.set(blurOptions);
        }

        this._blurredRenderTexture.render(this._container);
        this._lastBlurRadius = blurRadius;
      }
    }

    /**
     * Returns this operation's brush
     * @return {PhotoEditorSDK.Operations.SpriteOperation.BrushSprite}
     */

  }, {
    key: 'getBrush',
    value: function getBrush() {
      return this._brushSprite;
    }

    /**
     * Creates and adds a new path
     * @param {Number} size
     * @param {Number} hardness = 1
     * @return {PhotoEditorSDK.Operations.SpriteOperation.BrushSprite.Path}
     */

  }, {
    key: 'createPath',
    value: function createPath(size) {
      var hardness = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;

      var brush = new __WEBPACK_IMPORTED_MODULE_6__shared_sprites_brush_sprite__["a" /* default */].Brushes.RadialBrush({ size: size, hardness: hardness, color: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Color"].WHITE });
      var path = this._brushSprite.createPath(brush);
      this._options.paths.push(path);
      this.setDirty(true);
      return path;
    }

    /**
     * Sets the dirtiness for the given renderer
     * @param {Boolean} dirty
     * @param {PhotoEditorSDK.Engine.BaseRenderer} renderer
     * @param {Boolean} dimensionsChanged = false
     */

  }, {
    key: 'setDirtyForRenderer',
    value: function setDirtyForRenderer(dirty, renderer, dimensionsChanged) {
      _get(SelectiveBlurOperation.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(SelectiveBlurOperation.prototype), 'setDirtyForRenderer', this).call(this, dirty, renderer, dimensionsChanged);
      this._brushSprite.setDirtyForRenderer(dirty, renderer, dimensionsChanged);
    }

    /**
     * Disposes this operation
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      _get(SelectiveBlurOperation.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(SelectiveBlurOperation.prototype), 'dispose', this).call(this);

      var renderer = this._sdk.getRenderer();
      if (renderer.isOfType(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["RendererType"].WEBGL)) {
        this._verticalFilter.dispose();
        this._horizontalFilter.dispose();
      } else {
        this._blurFilter.dispose();
      }

      this._brushSprite.dispose();
      this._maskFilter.dispose();
      this._blurredRenderTexture.dispose();
      this._maskRenderTexture.dispose();
    }

    /**
     * Checks if the operation has changes/modifications
     * @return {Boolean}
     */

  }, {
    key: 'hasChanges',
    value: function hasChanges() {
      return true;
    }
  }]);

  return SelectiveBlurOperation;
}(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Operation"]);

/**
 * A unique string that identifies this operation. Can be used to select
 * operations.
 * @type {String}
 * @default
 */


SelectiveBlurOperation.identifier = 'selective-blur';

/**
 * Specifies the available options for this operation
 * @type {Object}
 * @ignore
 */
SelectiveBlurOperation.prototype.availableOptions = {
  blurRadius: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.05 },
  paths: {
    type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].ARRAY,
    default: [],
    setter: function setter(paths) {
      if (this._brushSprite) {
        this._brushSprite.setPaths(paths);
      }
      return paths;
    }
  }
};

__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default.a.Operations.SelectiveBlurOperation = SelectiveBlurOperation;

/* harmony default export */ __webpack_exports__["a"] = (SelectiveBlurOperation);

/***/ }),
/* 344 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__control_point__ = __webpack_require__(345);






var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




/**
 * A path that can be drawn on a {@link PhotoEditorSDK.Operations.SpriteOperation.BrushSprite}. Should only be
 * created using {@link PhotoEditorSDK.Operations.SpriteOperation.BrushSprite#createPath}
 * @class
 * @extends PhotoEditorSDK.EventEmitter
 * @memberof PhotoEditorSDK.Operations.SpriteOperation.BrushSprite
 */

var Path = function (_Configurable) {
  _inherits(Path, _Configurable);

  /**
   * Creates a Path
   * @param  {PhotoEditorSDK.Operations.SpriteOperation.BrushSprite} operation
   * @param  {Object} options
   * @param  {HTMLCanvasElement} canvas
   */
  function Path(operation, options, canvas) {
    _classCallCheck(this, Path);

    var _this = _possibleConstructorReturn(this, (Path.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(Path)).call(this, options));

    _this._operation = operation;

    _this._canvas = canvas || __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].createCanvas();
    _this._context = _this._canvas.getContext('2d');
    return _this;
  }

  /**
   * Returns a serialized version of the given option
   * @param {String} optionName
   * @param {Boolean} toObject = false
   * @return {*}
   */


  _createClass(Path, [{
    key: 'serializeOption',
    value: function serializeOption(optionName) {
      var toObject = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

      if (optionName === 'controlPoints') {
        return this._options.controlPoints.map(function (controlPoint) {
          var position = controlPoint.getPosition();
          return toObject ? position.toObject() : position.clone();
        });
      }

      return _get(Path.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(Path.prototype), 'serializeOption', this).call(this, optionName, toObject);
    }

    /**
     * Checks if the given option has the given value
     * @param  {String} optionName
     * @param  {*} value
     * @return {Boolean}
     * @private
     */

  }, {
    key: '_optionEquals',
    value: function _optionEquals(optionName, value) {
      if (optionName === 'controlPoints') {
        var controlPoints = this._options.controlPoints;
        for (var i = 0, l = controlPoints.length; i < l; i++) {
          if (!controlPoints[i].getPosition().equals(value[i])) {
            return false;
          }
        }
        return true;
      }

      return _get(Path.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(Path.prototype), '_optionEquals', this).call(this, optionName, value);
    }

    /**
     * Draws this path onto its canvas
     * @param {PhotoEditorSDK.Math.Vector2} inputDimensions
     */

  }, {
    key: 'render',
    value: function render(inputDimensions) {
      var _options = this._options,
          controlPoints = _options.controlPoints,
          size = _options.size;

      if (controlPoints.length < 2) {
        return;
      }

      __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].ensureCanvasDimensions(this._canvas, inputDimensions);

      if (!this._brush || this._lastBrushSize !== size || !inputDimensions.equals(this._brushInputDimensions)) {
        this._brushInputDimensions = inputDimensions.clone();
        this._lastBrushSize = size;
      }

      var lastControlPoint = controlPoints[0];
      var controlPoint = lastControlPoint;
      for (var i = 1; i < controlPoints.length; i++) {
        controlPoint = controlPoints[i];
        controlPoint.renderToCanvas(this._options.brush.getBrushImage(inputDimensions), this._canvas, lastControlPoint);
        lastControlPoint = controlPoint;
      }
    }

    /**
     * Creates a brush from the given size, hardness and color
     * @param  {PhotoEditorSDK.Math.Vector2} inputDimensions
     * @return {HTMLCanvasElement}
     * @private
     */

  }, {
    key: '_createBrush',
    value: function _createBrush(inputDimensions) {
      var _options2 = this._options,
          size = _options2.size,
          hardness = _options2.hardness,
          color = _options2.color;

      var canvas = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].createCanvas();
      canvas.width = canvas.height = Math.ceil(size * inputDimensions.min());

      var context = canvas.getContext('2d');

      // Brush always has 100% opacity
      color = color.clone();
      color.a = 1;

      if (canvas.width === 1) {
        context.fillStyle = color.toRGBA();
        context.fillRect(0, 0, 1, 1);
      } else {
        var gradient = context.createRadialGradient(canvas.width / 2, canvas.height / 2, Math.min(canvas.width / 2 - 1, canvas.width / 2 * hardness), canvas.width / 2, canvas.height / 2, canvas.width / 2);

        gradient.addColorStop(0, color.toRGBA());
        var transparentColor = color.clone();
        transparentColor.a = 0;
        gradient.addColorStop(1, transparentColor.toRGBA());

        context.fillStyle = gradient;
        context.fillRect(0, 0, canvas.width, canvas.height);
      }

      return canvas;
    }

    /**
     * Adds a control point at the given position to this path
     * @param {PhotoEditorSDK.Math.Vector2} position
     */

  }, {
    key: 'addControlPoint',
    value: function addControlPoint(position) {
      var controlPoint = new __WEBPACK_IMPORTED_MODULE_6__control_point__["a" /* default */](this, position);
      this._options.controlPoints.push(controlPoint);
      this.emit('update', this);
    }

    /**
     * Returns this path's canvas
     * @return {Canvas}
     */

  }, {
    key: 'getCanvas',
    value: function getCanvas() {
      return this._canvas;
    }

    /**
     * Sets the given canvas
     * @param {HTMLCanvasElement} canvas
     */

  }, {
    key: 'setCanvas',
    value: function setCanvas(canvas) {
      this._canvas = canvas;
      this._context = canvas.getContext('2d');
    }

    /**
     * Sets this path to dirty
     */

  }, {
    key: 'setDirty',
    value: function setDirty() {
      this._context.clearRect(0, 0, this._canvas.width, this._canvas.height);

      this._options.controlPoints.forEach(function (point) {
        point.setDirty();
      });
    }

    /**
     * Calls `iterator` for each control point
     * @param  {Function} iterator
     */

  }, {
    key: 'forEachControlPoint',
    value: function forEachControlPoint(iterator) {
      this._options.controlPoints.forEach(iterator);
    }

    /**
     * Renders this path to the given canvas with the right opacity
     * @param  {Canvas} canvas
     */

  }, {
    key: 'renderToCanvas',
    value: function renderToCanvas(canvas) {
      var context = canvas.getContext('2d');
      context.save();
      context.globalAlpha = this._options.brush.getColor().a;
      context.drawImage(this._canvas, 0, 0);
      context.restore();
    }

    /**
     * Returns the canvas dimension for this path
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'getCanvasDimensions',
    value: function getCanvasDimensions() {
      return this._canvasDimensions;
    }
  }]);

  return Path;
}(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Configurable"]);

Path.prototype.availableOptions = {
  id: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].STRING, default: function _default() {
      return __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].getUUID();
    } },
  brush: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].OBJECT, required: true },
  controlPoints: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].ARRAY, default: [] },
  closed: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].BOOLEAN, default: false }
};

/* harmony default export */ __webpack_exports__["a"] = (Path);

/***/ }),
/* 345 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */


var Vector2 = __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__["Math"].Vector2;

/**
 * A ControlPoint is a part of a {@link PhotoEditorSDK.Operations.SpriteOperation.BrushSprite.Path}, so a Path
 * consists of multiple ControlPoints. Should only be created using {@link PhotoEditorSDK.Operations.SpriteOperation.BrushSprite.Path#addControlPoint}
 * @class
 * @memberof PhotoEditorSDK.Operations.SpriteOperation.BrushSprite
 */

var ControlPoint = function () {
  /**
   * Creates a ControlPoint
   * @param  {PhotoEditorSDK.Operations.SpriteOperation.BrushSprite.Path} path
   * @param  {PhotoEditorSDK.Math.Vector2} position
   */
  function ControlPoint(path, position) {
    _classCallCheck(this, ControlPoint);

    this._path = path;
    this._drawnCanvases = [];
    this._position = position;
  }

  /**
   * Renders this ControlPoint to the given canvas
   * @param  {HTMLCanvasElement} brush
   * @param  {HTMLCanvasElement} canvas
   * @param  {PhotoEditorSDK.Operations.SpriteOperation.BrushSprite.ControlPoint} lastControlPoint
   */


  _createClass(ControlPoint, [{
    key: 'renderToCanvas',
    value: function renderToCanvas(brush, canvas, lastControlPoint) {
      if (this._drawnCanvases.indexOf(canvas) !== -1) {
        // This control point has already been drawn on this canvas. Ignore.
        return;
      }

      var canvasDimensions = new Vector2(canvas.width, canvas.height);

      var context = canvas.getContext('2d');
      var position = this._position.clone().multiply(canvasDimensions); // x2
      var lastPosition = lastControlPoint.getPosition().clone().multiply(canvasDimensions); // x1
      var distance = position.clone().subtract(lastPosition).len();
      var step = brush.width / 10;

      var i = 0;
      while (i <= distance) {
        var t = Math.max(0, Math.min(1, i / distance));
        var x = lastPosition.x + (position.x - lastPosition.x) * t;
        var y = lastPosition.y + (position.y - lastPosition.y) * t;

        context.drawImage(brush, x - brush.width / 2, y - brush.height / 2, brush.width, brush.height);
        i += step;
      }

      this._drawnCanvases.push(canvas);
    }

    /**
     * Sets the position
     * @param {PhotoEditorSDK.Math.Vector2} position
     */

  }, {
    key: 'setPosition',
    value: function setPosition(position) {
      this._position = position;
    }

    /**
     * Returns the position
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'getPosition',
    value: function getPosition() {
      return this._position.clone();
    }

    /**
     * Sets this ControlPoint to dirty
     */

  }, {
    key: 'setDirty',
    value: function setDirty() {
      this._drawnCanvases = [];
    }
  }]);

  return ControlPoint;
}();

/* harmony default export */ __webpack_exports__["a"] = (ControlPoint);

/***/ }),
/* 346 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__brush__ = __webpack_require__(148);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var RadialBrush = function (_Brush) {
  _inherits(RadialBrush, _Brush);

  function RadialBrush() {
    _classCallCheck(this, RadialBrush);

    return _possibleConstructorReturn(this, (RadialBrush.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(RadialBrush)).apply(this, arguments));
  }

  _createClass(RadialBrush, [{
    key: 'getBrushImage',

    /**
     * Returns the prepared brush image (colored and resized)
     * @param  {PhotoEditorSDK.Math.Vector2} inputDimensions
     * @return {HTMLImageElement|HTMLCanvasElement}
     */
    value: function getBrushImage(inputDimensions) {
      if (this._brush && this.optionsEqual(this._lastOptions) && inputDimensions.equals(this._lastInputDimensions)) {
        return this._brush;
      }

      var _options = this._options,
          size = _options.size,
          hardness = _options.hardness,
          color = _options.color;


      var canvas = __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Utils"].createCanvas();
      canvas.width = canvas.height = Math.ceil(size * inputDimensions.min());

      var context = canvas.getContext('2d');

      // Brush always has 100% opacity
      color = color.clone();
      color.a = 1;

      if (canvas.width === 1) {
        context.fillStyle = color.toRGBA();
        context.fillRect(0, 0, 1, 1);
      } else {
        var gradient = context.createRadialGradient(canvas.width / 2, canvas.height / 2, Math.min(canvas.width / 2 - 1, canvas.width / 2 * hardness), canvas.width / 2, canvas.height / 2, canvas.width / 2);

        gradient.addColorStop(0, color.toRGBA());
        var transparentColor = color.clone();
        transparentColor.a = 0;
        gradient.addColorStop(1, transparentColor.toRGBA());

        context.fillStyle = gradient;
        context.fillRect(0, 0, canvas.width, canvas.height);
      }

      this._lastOptions = this.serializeOptions(['size', 'color', 'hardness']);
      this._brush = canvas;
      this._lastInputDimensions = inputDimensions.clone();

      return canvas;
    }
  }]);

  return RadialBrush;
}(__WEBPACK_IMPORTED_MODULE_5__brush__["a" /* default */]);

/* harmony default export */ __webpack_exports__["a"] = (RadialBrush);


RadialBrush.identifier = 'imgly_brush_radial';

RadialBrush.prototype.availableOptions = __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Utils"].extend(__WEBPACK_IMPORTED_MODULE_5__brush__["a" /* default */].prototype.availableOptions, {
  hardness: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 1 }
});

/***/ }),
/* 347 */
/***/ (function(module, exports) {

module.exports = "varying vec2 v_texCoord;\nuniform sampler2D u_image;\nuniform sampler2D u_filterImage;\nuniform sampler2D u_maskImage;\n\nvoid main() {\n  vec4 color0 = texture2D(u_image, v_texCoord);\n  vec4 color1 = texture2D(u_filterImage, v_texCoord);\n  vec4 mask = texture2D(u_maskImage, v_texCoord);\n  gl_FragColor = mix(color0, color1, mask);\n}\n"

/***/ }),
/* 348 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__shared_sprite__ = __webpack_require__(56);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__shared_filters_mask_filter__ = __webpack_require__(149);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__sprites_sticker_sprite__ = __webpack_require__(349);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__sprites_text_sprite__ = __webpack_require__(350);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__shared_sprites_brush_sprite__ = __webpack_require__(147);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__sprites_text_design_sprite__ = __webpack_require__(351);







var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */










var Vector2 = __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Math"].Vector2;

/**
 * An operation that can draw sprites (text and stickers) on the canvas
 * @class
 * @extends PhotoEditorSDK.Operation
 * @memberof PhotoEditorSDK.Operations
 */

var SpriteOperation = function (_Operation) {
  _inherits(SpriteOperation, _Operation);

  /**
   * Creates a new SpriteOperation
   * @param  {PhotoEditorSDK} sdk
   * @param  {Object} [options]
   */
  function SpriteOperation() {
    var _ref;

    _classCallCheck(this, SpriteOperation);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = SpriteOperation.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(SpriteOperation)).call.apply(_ref, [this].concat(args)));

    _this.setSmoothDownscaling(_this._sdk.getOptions().smoothDownscaling);

    _this._onSpriteUpdate = _this._onSpriteUpdate.bind(_this);

    var sprites = _this._options.sprites.slice();
    sprites.forEach(function (sprite) {
      _this.removeSprite(sprite);
      _this.addSprite(sprite);
    });
    return _this;
  }

  /**
   * Returns the sprites that are instances of the given class
   * @param  {Class} Klass
   * @return {PhotoEditorSDK.Sprite[]}
   */


  _createClass(SpriteOperation, [{
    key: 'getSpritesOfType',
    value: function getSpritesOfType(Klass) {
      return this._options.sprites.filter(function (sprite) {
        return sprite instanceof Klass;
      });
    }

    /**
     * Applies a rotation with the given degrees
     * @param  {Number} degrees
     * @private
     */

  }, {
    key: 'rotate',
    value: function rotate(degrees) {
      this._options.sprites.forEach(function (sprite) {
        sprite.applyRotation(degrees);
      });
    }

    /**
     * Applies a flip with the given direction
     * @param  {String} direction
     * @private
     */

  }, {
    key: 'flip',
    value: function flip(direction) {
      this._options.sprites.forEach(function (sprite) {
        sprite.applyFlip(direction);
      });
    }

    /**
     * Gets called when a sprite is flagged as dirty / its options changed
     * @param  {PhotoEditorSDK.Sprite} sprite
     * @param  {Object} options
     * @private
     */

  }, {
    key: '_onSpriteUpdate',
    value: function _onSpriteUpdate(sprite, options) {
      this.emit('update', this);
      this.setDirty(true);
    }

    /**
     * Applies the given rotation change
     * @param  {PhotoEditorSDK.Operations.RotationOperation} operation
     * @param  {Object} options
     * @private
     */

  }, {
    key: '_applyRotation',
    value: function _applyRotation(operation, options) {
      this._options.sprites.forEach(function (sprite) {
        return sprite.applyRotation(operation, options);
      });
    }

    /**
     * Applies the given transform change
     * @param  {PhotoEditorSDK.Operations.TransformOperation.TransformChange} transformChange
     * @private
     */

  }, {
    key: 'transform',
    value: function transform(transformChange) {
      this._options.sprites.forEach(function (sprite) {
        return sprite.applyTransform(transformChange);
      });
    }

    /**
     * Applies the given scale to all sprites
     * @param  {PhotoEditorSDK.Math.Vector2} scale
     */

  }, {
    key: 'scale',
    value: function scale(_scale) {
      this._options.sprites.forEach(function (sprite) {
        return sprite.applyScale(_scale);
      });
    }

    /**
     * Returns a serialized version of the given option
     * @param {String} optionName
     * @param {Boolean} toObject = false
     * @return {*} optionName
     * @private
     * @override
     */

  }, {
    key: 'serializeOption',
    value: function serializeOption(optionName) {
      var toObject = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

      // Since `sprites` is an array of configurables, we need
      // to serialize them as well
      if (optionName === 'sprites') {
        return this._options.sprites.map(function (sprite) {
          return sprite.serializeOptions(undefined, toObject);
        });
      }
      return _get(SpriteOperation.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(SpriteOperation.prototype), 'serializeOption', this).call(this, optionName, toObject);
    }

    /**
     * Creates a new sticker object and returns it
     * @param  {Object} options
     * @return {PhotoEditorSDK.Operations.SpriteOperation.StickerSprite}
     */

  }, {
    key: 'createSticker',
    value: function createSticker(options) {
      return new __WEBPACK_IMPORTED_MODULE_9__sprites_sticker_sprite__["a" /* default */](this, options);
    }

    /**
     * Creates a new sticker object and returns it
     * @param  {Object} options
     * @return {PhotoEditorSDK.Operations.SpriteOperation.TextSprite}
     */

  }, {
    key: 'createText',
    value: function createText(options) {
      return new __WEBPACK_IMPORTED_MODULE_10__sprites_text_sprite__["a" /* default */](this, options);
    }

    /**
     * Creates a brush object and returns it
     * @param  {Object} options
     * @return {PhotoEditorSDK.Operations.SpriteOperation.BrushSprite}
     */

  }, {
    key: 'createBrush',
    value: function createBrush(options) {
      return new __WEBPACK_IMPORTED_MODULE_11__shared_sprites_brush_sprite__["a" /* default */](this, options);
    }
  }, {
    key: 'createTextDesign',
    value: function createTextDesign(options) {
      return new __WEBPACK_IMPORTED_MODULE_12__sprites_text_design_sprite__["a" /* default */](this, options);
    }

    /**
     * Gets called when a sprite has been added
     * @param {PhotoEditorSDK.Sprite} sprite
     */

  }, {
    key: 'addSprite',
    value: function addSprite(sprite) {
      this._options.sprites.push(sprite);

      var smoothDownscaling = this.getSmoothDownscaling();
      sprite.setSmoothDownscaling && sprite.setSmoothDownscaling(smoothDownscaling);

      this._container.addChild(sprite.getDisplayObject());

      // This operation needs to be rerendered
      this.setDirty(true);

      sprite.on('update', this._onSpriteUpdate);
      this.emit('update', this, this._options.sprites);
    }

    /**
     * Removes the given sprite from the list of sprites
     * @param  {PhotoEditorSDK.Sprite} sprite
     * @return {Boolean}
     */

  }, {
    key: 'removeSprite',
    value: function removeSprite(sprite) {
      var sprites = this._options.sprites;
      var index = sprites.indexOf(sprite);
      if (index !== -1) {
        sprite.off('update', this._onSpriteUpdate);
        this._container.removeChild(sprite.getDisplayObject());
        sprites.splice(index, 1);

        // This operation needs to be rerendered
        this.setDirty(true);

        return true;
      }
      return false;
    }

    /**
     * Renders this operation
     * @param {PhotoEditorSDK.Engine.Texture} inputTexture
     * @returns {Promise}
     * @override
     * @private
     */

  }, {
    key: '_render',
    value: function _render(inputTexture) {
      var _this2 = this;

      var container = this._container;
      var sprites = this._options.sprites;

      var inputDimensions = inputTexture.getDimensions().clone().floor();

      // TODO: generalize for more than 1 masked sprite
      var containerFirst = new __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Engine"].Container();
      var containerMasked = new __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Engine"].Container();
      var containerRest = new __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Engine"].Container();

      containerFirst.addChild(this._sprite);

      var current = containerFirst;
      var color = null;
      var textDesignSprite = null;
      sprites.forEach(function (s) {
        if (current === containerMasked) {
          current = containerRest;
        }

        if (s.getInverted && s.getInverted()) {
          current = containerMasked;
          color = s.getColor && s.getColor() || null;
          textDesignSprite = s;
        }

        current.addChild(s.getDisplayObject());
      });

      return __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Promise"].all(sprites.map(function (s) {
        return s.validateSettings();
      })).then(function () {
        sprites.forEach(function (sprite) {
          return sprite.update(_this2._sdk, inputDimensions);
        });
      }).then(function () {
        if (containerMasked.getChildren().length > 0) {
          _this2._renderTexture.render(containerFirst);

          var newContainer = _this2._renderMaskedTextDesignSprite(textDesignSprite);
          _this2._renderTexture.render(newContainer);
          _this2._renderTexture.render(containerRest);
        } else {
          _this2._renderTexture.clear();
          _this2._renderTexture.render(containerFirst);
          _this2._renderTexture.render(containerMasked);
          _this2._renderTexture.render(containerRest);
        }
        // this._renderTexture.render(container)
        container.addChild(_this2._sprite);
        sprites.forEach(function (s) {
          return container.addChild(s.getDisplayObject());
        });
      });
    }
  }, {
    key: '_renderMaskedTextDesignSprite',
    value: function _renderMaskedTextDesignSprite(textDesignSprite) {
      var color = textDesignSprite.getColor();
      var canvas = __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Utils"].createCanvas();
      var frame = this._sdk.getSprite().getTexture().getFrame();
      var width = frame.width;
      var height = frame.height;
      __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Utils"].ensureCanvasDimensions(canvas, new Vector2(width, height));
      var ctx = canvas.getContext('2d');
      ctx.fillStyle = color.toRGBA();
      ctx.fillRect(0, 0, width, height);
      ctx.globalCompositeOperation = 'destination-out';

      // const textDesignCanvas = sprite._canvas
      var sprite = textDesignSprite.getDisplayObject();
      sprite._renderCanvas({
        getCurrentRenderTarget: function getCurrentRenderTarget() {
          return {
            getPixelRatio: function getPixelRatio() {
              return 1;
            }
          };
        },
        getContext: function getContext() {
          return ctx;
        }
      });

      var container = new __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Engine"].Container();
      var newSprite = new __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Engine"].Sprite(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Engine"].Texture.fromCanvas(canvas));

      container.addChild(newSprite);

      return container;
    }

    /**
     * Takes the given Sprite to front
     * @param  {PhotoEditorSDK.Operations.SpriteOperation.Sprite} sprite
     */

  }, {
    key: 'takeSpriteToFront',
    value: function takeSpriteToFront(sprite) {
      var sprites = this._options.sprites;

      var spriteIndex = sprites.indexOf(sprite);
      if (spriteIndex === -1) return;

      __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Utils"].moveArrayItem(sprites, spriteIndex, sprites.length - 1);

      var displayObject = sprite.getDisplayObject();
      this._container.removeChild(displayObject);
      this._container.addChild(displayObject);

      this.setDirty(true);
    }

    /**
     * Returns the sprites at the given position on the canvas
     * @param  {PhotoEditorSDK.Math.Vector2} position
     * @param  {PhotoEditorSDK.Math.Vector2} inputDimensions
     * @return {PhotoEditorSDK.Sprite[]}
     */

  }, {
    key: 'getSpritesAtPosition',
    value: function getSpritesAtPosition(position, inputDimensions) {
      var _this3 = this;

      var intersectingSprites = [];

      this._options.sprites.forEach(function (s) {
        return s.update(_this3._sdk, inputDimensions);
      });

      // Translate canvas position to relative position on sprite by
      // applying the inverse of our outputSprite's world transform matrix
      var outputSprite = this._sdk.getSprite();
      var actualPosition = outputSprite.getWorldTransform().applyInverseToVector(position);

      // Apply anchor

      var _outputSprite$getText = outputSprite.getTexture().getFrame(),
          width = _outputSprite$getText.width,
          height = _outputSprite$getText.height;

      var anchorOffset = outputSprite.getAnchor().clone().multiply(-width, -height);
      actualPosition.subtract(anchorOffset);

      // Note: `actualPosition` is now the pixel position on the output sprite, NOT
      // on the sticker / text / brush

      // Find intersecting sprite
      var sprites = this._options.sprites.slice(0).reverse();
      for (var i = 0, c = sprites.length; i < c; i++) {
        var sprite = sprites[i];
        if (sprite.getHitTestDisplayObject().isAtPosition(actualPosition)) {
          intersectingSprites.push(sprite);
        }
      }

      return intersectingSprites;
    }

    /**
     * Sets the dirtiness for the given renderer
     * @param {Boolean} dirty
     * @param {PhotoEditorSDK.Engine.BaseRenderer} renderer
     * @param {Boolean} dimensionsChanged = false
     */

  }, {
    key: 'setDirtyForRenderer',
    value: function setDirtyForRenderer(dirty, renderer, dimensionsChanged) {
      _get(SpriteOperation.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(SpriteOperation.prototype), 'setDirtyForRenderer', this).call(this, dirty, renderer, dimensionsChanged);
      this._options.sprites.forEach(function (sprite) {
        sprite.setDirtyForRenderer(dirty, renderer, dimensionsChanged);
      });
    }

    /**
     * Disposes this operation
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      _get(SpriteOperation.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(SpriteOperation.prototype), 'dispose', this).call(this);
      this._options.sprites.forEach(function (sprite) {
        sprite.dispose();
      });
    }
  }]);

  return SpriteOperation;
}(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Operation"]);

SpriteOperation.StickerSprite = __WEBPACK_IMPORTED_MODULE_9__sprites_sticker_sprite__["a" /* default */];
SpriteOperation.TextSprite = __WEBPACK_IMPORTED_MODULE_10__sprites_text_sprite__["a" /* default */];
SpriteOperation.BrushSprite = __WEBPACK_IMPORTED_MODULE_11__shared_sprites_brush_sprite__["a" /* default */];
SpriteOperation.TextDesignSprite = __WEBPACK_IMPORTED_MODULE_12__sprites_text_design_sprite__["a" /* default */];

/**
 * A unique string that identifies this operation. Can be used to select
 * operations.
 * @type {String}
 * @default
 */
SpriteOperation.identifier = 'sprite';

/**
 * Specifies the available options for this operation
 * @type {Object}
 * @ignore
 */
SpriteOperation.prototype.availableOptions = {
  sprites: {
    type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].ARRAY,
    default: [],
    setter: function setter(sprites, initial) {
      var _this4 = this;

      sprites = sprites.map(function (sprite, i) {
        if (sprite instanceof __WEBPACK_IMPORTED_MODULE_7__shared_sprite__["a" /* default */]) {
          return sprite;
        }

        var spriteData = _extends({}, sprite);
        delete spriteData.type;

        // Create sprite from the given options
        switch (sprite.type) {
          case 'text':
            return new __WEBPACK_IMPORTED_MODULE_10__sprites_text_sprite__["a" /* default */](_this4, spriteData);
          case 'sticker':
            return new __WEBPACK_IMPORTED_MODULE_9__sprites_sticker_sprite__["a" /* default */](_this4, spriteData);
          case 'brush':
            return new __WEBPACK_IMPORTED_MODULE_11__shared_sprites_brush_sprite__["a" /* default */](_this4, spriteData);
          case 'text-design':
            return new __WEBPACK_IMPORTED_MODULE_12__sprites_text_design_sprite__["a" /* default */](_this4, spriteData);
          default:
            __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Log"].error(_this4.constructor.name, 'Invalid sprite type: ' + sprite.type);
        }
      });

      // Remove all sprites
      if (!initial) {
        if (this._options.sprites) {
          var spritesToRemove = this._options.sprites.slice();
          spritesToRemove.forEach(function (sprite) {
            sprite.dispose();
            _this4.removeSprite(sprite);
          });
        }

        // Add all sprites
        sprites.forEach(function (sprite) {
          _this4.addSprite(sprite);
        });
      }

      return sprites;
    }
  },
  smoothDownscaling: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].BOOLEAN, default: false }
};

__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core___default.a.Operations.SpriteOperation = SpriteOperation;

/* harmony default export */ __webpack_exports__["a"] = (SpriteOperation);

/***/ }),
/* 349 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__shared_sprite__ = __webpack_require__(56);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__shared_filters_adjustments_filter__ = __webpack_require__(143);






var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var Vector2 = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Math"].Vector2,
    ColorMatrix = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Math"].ColorMatrix;

/**
 * A sticker that can be drawn by SpriteOperation. Should only be created via {@link PhotoEditorSDK.Operations.SpriteOperation#createSticker}
 * @class
 * @memberof PhotoEditorSDK.Operations.SpriteOperation
 */

var StickerSprite = function (_Sprite) {
  _inherits(StickerSprite, _Sprite);

  /**
   * Creates a new Sticker
   * @param  {PhotoEditorSDK.Operations.SpriteOperation} operation
   * @param  {Object} [options]
   */
  function StickerSprite() {
    var _ref;

    _classCallCheck(this, StickerSprite);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = StickerSprite.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(StickerSprite)).call.apply(_ref, [this].concat(args)));

    var image = _this._options.image;


    var src = image.src || image.filePath;
    _this._isSVG = src && !!src.match(/\w+\.svg(?=\?|$)/i);
    if (_this._isSVG) {
      _this._canvas = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].createCanvas();
      _this._context = _this._canvas.getContext('2d');
      _this._options.smoothDownscaling = false;
    }

    if (image) {
      _this._onImageUpdate();
    }

    _this._tintFilter = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].Filters.TintFilter();
    _this._adjustmentsFilter = new __WEBPACK_IMPORTED_MODULE_7__shared_filters_adjustments_filter__["a" /* default */]();
    _this._lastRenderedDimensions = Vector2.NULL;
    _this._lastRenderedInputDimensions = Vector2.NULL;

    _this._onOptionsChange = _this._onOptionsChange.bind(_this);
    _this._options.adjustments.on('update', _this._onOptionsChange);
    return _this;
  }

  /**
   * Applies the given scale to this sprite
   * @param  {PhotoEditorSDK.Math.Vector2} scale
   */


  _createClass(StickerSprite, [{
    key: 'applyScale',
    value: function applyScale(scale) {
      this.setDimensions(this.getDimensions().multiply(scale));
    }

    /**
     * Returns a serialized version of this configurable
     * @param {String[]} keys
     * @param {Boolean} toObject = false
     * @return {Object}
     */

  }, {
    key: 'serializeOptions',
    value: function serializeOptions(keys) {
      var toObject = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

      var options = _get(StickerSprite.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(StickerSprite.prototype), 'serializeOptions', this).call(this, keys, toObject);
      if (!keys) options.type = 'sticker';
      return options;
    }

    /**
     * Checks if this sprite should be rendered to a render texture
     * @param  {PhotoEditorSDK} sdk
     * @return {Boolean}
     * @private
     */

  }, {
    key: '_rendersToRenderTexture',
    value: function _rendersToRenderTexture(sdk) {
      var smoothDownscaling = this._options.smoothDownscaling && !this._isSVG && sdk.getRenderer().isOfType(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["RendererType"].WEBGL);
      return smoothDownscaling || this._hasAdjustments() || this._options.tintMode !== 'none';
    }

    /**
     * Returns the texture for the sprite that should be rendered
     * @return {PhotoEditorSDK.Engine.Texture}
     * @private
     * @abstract
     */

  }, {
    key: '_getTexture',
    value: function _getTexture() {
      return this._inputTexture;
    }

    /**
     * Updates this sprite
     * @param  {PhotoEditorSDK} sdk
     * @param  {PhotoEditorSDK.Math.Vector2} inputDimensions
     */

  }, {
    key: 'update',
    value: function update(sdk, inputDimensions) {
      var _options = this._options,
          dimensions = _options.dimensions,
          image = _options.image;

      if (dimensions.equals(Vector2.NULL)) {
        dimensions.set(image.width, image.height);
      }

      this._sprite.setSmoothDownscaling(this._isSVG ? false : this.getSmoothDownscaling());

      var isDirty = !this._lastRenderedInputDimensions.equals(inputDimensions) || !this._lastRenderedDimensions.equals(dimensions) || this._lastRenderedImage !== image;

      if (isDirty && this._isSVG && sdk.getRenderer().isOfType(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["RendererType"].WEBGL)) {
        image.width = dimensions.x;
        image.height = dimensions.y;

        // Workaround for Chromium Bug, still present in Safari
        // https://bugs.chromium.org/p/chromium/issues/detail?id=500180
        this._canvas.width = image.width;
        this._canvas.height = image.height;
        this._context.clearRect(0, 0, image.width, image.height);
        this._context.drawImage(image, 0, 0, image.width, image.height);

        this._inputTexture.getBaseTexture().update();
      }

      if (this._rendersToRenderTexture(sdk)) {
        this._prepareRenderTexture(sdk);
      }

      var filters = [];

      // @todo: Don't update the filters every tick, instead update them when options change.
      //        This will shorten this method and clean up the code
      if (this._rendersToRenderTexture(sdk)) {
        // Stickers with adjustments are rendered to a render texture that
        // can be re-used
        if (this._hasAdjustments()) {
          // Apply adjustments
          filters.push(this._adjustmentsFilter);

          var adjustments = this._options.adjustments;

          var colorMatrix = new ColorMatrix();
          colorMatrix.multiply(ColorMatrix.createBrightnessMatrix(adjustments.getBrightness()));
          colorMatrix.multiply(ColorMatrix.createSaturationMatrix(adjustments.getSaturation()));
          colorMatrix.multiply(ColorMatrix.createContrastMatrix(adjustments.getContrast()));

          this._adjustmentsFilter.set({
            colorMatrix: colorMatrix
          });
        }

        if (this._options.tintMode && this._options.tintMode !== 'none') {
          filters.push(this._tintFilter);
          this._tintFilter.set({
            mode: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].Filters.TintFilter.MODES[this._options.tintMode.toUpperCase()],
            color: this._options.tintColor
          });
        }
        this._renderTextureSprite.setFilters(filters);
      }

      if (this._rendersToRenderTexture(sdk)) {
        this._renderToRenderTexture(sdk);
      } else {
        this._sprite.setTexture(this._inputTexture);
      }
      this._updateSprite(inputDimensions);
      this._applyFlip();

      this._lastRenderedDimensions.copy(dimensions);
      this._lastRenderedInputDimensions.copy(inputDimensions);
      this._lastRenderedImage = image;
    }

    /**
     * If flip is enabled, this flips the sprite
     * @private
     */

  }, {
    key: '_applyFlip',
    value: function _applyFlip() {
      var scale = this._sprite.getScale();
      if (this._options.flipVertically) {
        scale.y *= -1;
      }
      if (this._options.flipHorizontally) {
        scale.x *= -1;
      }
      this._sprite.setScale(scale);
    }

    /**
     * Applies a flip in the given direction
     * @param  {String} direction
     */

  }, {
    key: 'applyFlip',
    value: function applyFlip(direction) {
      _get(StickerSprite.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(StickerSprite.prototype), 'applyFlip', this).call(this, direction);

      var options = {
        rotation: this._options.rotation
      };

      var degrees = options.rotation / Math.PI * 180;
      var newDegrees = degrees * -1;
      options.rotation = newDegrees * Math.PI / 180;

      switch (direction) {
        case 'horizontal':
          options.flipHorizontally = !this._options.flipHorizontally;
          this.set(options);
          break;
        case 'vertical':
          options.flipVertically = !this._options.flipVertically;
          this.set(options);
          break;
      }
    }

    /**
     * Checks if this sticker has any adjustments and a filter is needed
     * @return {Boolean}
     * @private
     */

  }, {
    key: '_hasAdjustments',
    value: function _hasAdjustments() {
      var adjustments = this._options.adjustments;
      return adjustments.getBrightness() !== 0 || adjustments.getSaturation() !== 1 || adjustments.getContrast() !== 1;
    }

    /**
     * Gets called when this sticker's image is updated
     * @private
     */

  }, {
    key: '_onImageUpdate',
    value: function _onImageUpdate() {
      var textureImage = this._options.image;
      var renderer = this._operation.getSDK().getRenderer();
      if (this._isSVG && renderer.isOfType(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["RendererType"].WEBGL)) {
        textureImage = this._canvas;
      }
      this._inputTexture = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].Texture.fromImage(textureImage);
      this._identitySprite.setTexture(this._inputTexture);
      this._sprite.setTexture(this._inputTexture);

      if (this._renderTexture) {
        this._renderTextureSprite.setTexture(this._inputTexture);
        this._renderTexture.resizeTo(this._inputTexture.getDimensions());
      }
      this.setDirty(true);
    }

    /**
     * Sets the value for the given option, validates it
     * @param {String} optionName
     * @param {*} value
     * @param {Boolean} update = true
     * @override
     */

  }, {
    key: 'setOption',
    value: function setOption(optionName, value) {
      var update = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;

      _get(StickerSprite.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(StickerSprite.prototype), 'setOption', this).call(this, optionName, value, update);

      if (optionName === 'image' && this._identitySprite) {
        this._onImageUpdate();
      }
    }

    /**
     * Gets called when options have been changed. Sets this sprite to dirty.
     * @private
     */

  }, {
    key: '_onOptionsChange',
    value: function _onOptionsChange() {
      var dirtiness = this._dirtiness;
      for (var id in dirtiness) {
        dirtiness[id] = true;
      }
    }

    /**
     * Disposes this sprite
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      _get(StickerSprite.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(StickerSprite.prototype), 'dispose', this).call(this);
      this._inputTexture && this._inputTexture.getBaseTexture().dispose();
      this._inputTexture = null;
      this._options.adjustments.off('updated', this._onOptionsChange);
    }
  }]);

  return StickerSprite;
}(__WEBPACK_IMPORTED_MODULE_6__shared_sprite__["a" /* default */]);

StickerSprite.prototype.availableOptions = {
  id: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].STRING, default: function _default() {
      return __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].getUUID();
    } },
  identifier: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].STRING, default: '' },
  image: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].IMAGE, required: true },
  position: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].VECTOR2, default: Vector2.NULL },
  dimensions: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].VECTOR2, default: Vector2.NULL },
  anchor: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(0.0, 0.0) },
  pivot: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(0.5, 0.5) },
  rotation: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0 },
  flipHorizontally: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].BOOLEAN, default: false },
  flipVertically: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].BOOLEAN, default: false },
  smoothDownscaling: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].BOOLEAN, default: false },
  tintColor: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].COLOR, default: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Color"].WHITE },
  tintMode: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].STRING, default: 'none', available: ['none', 'solid', 'colorized'] },
  alpha: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 1 },
  adjustments: {
    type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].CONFIGURABLE,
    structure: {
      brightness: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0 },
      saturation: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 1 },
      contrast: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 1 }
    }
  }
};

StickerSprite.type = 'sticker';

/* harmony default export */ __webpack_exports__["a"] = (StickerSprite);

/***/ }),
/* 350 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__shared_sprite__ = __webpack_require__(56);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__text_text_renderer__ = __webpack_require__(150);






var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var Vector2 = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Math"].Vector2;

/**
 * A text that can be drawn by SpriteOperation. Should only be created via {@link PhotoEditorSDK.Operations.SpriteOperation#createText}
 * @class
 * @memberof PhotoEditorSDK.Operations.SpriteOperation
 */

var TextSprite = function (_Sprite) {
  _inherits(TextSprite, _Sprite);

  /**
   * Creates a new Text
   * @param  {PhotoEditorSDK.Operations.SpriteOperation} operation
   * @param  {Object} [options]
   */
  function TextSprite() {
    var _ref;

    _classCallCheck(this, TextSprite);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = TextSprite.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextSprite)).call.apply(_ref, [this].concat(args)));

    _this._textRenderer = new __WEBPACK_IMPORTED_MODULE_7__text_text_renderer__["a" /* default */](_this, _this._operation);
    _this._textRenderer.rotation = _this.getRotation();
    _this._sprite.setTexture(_this._textRenderer.getFinalTexture());
    _this._hitTestSprite.setTexture(_this._textRenderer.getTexture());
    return _this;
  }

  /**
   * Returns a serialized version of this configurable
   * @param {String[]} keys
   * @param {Boolean} toObject = false
   * @return {Object}
   */


  _createClass(TextSprite, [{
    key: 'serializeOptions',
    value: function serializeOptions(keys) {
      var toObject = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

      var options = _get(TextSprite.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextSprite.prototype), 'serializeOptions', this).call(this, keys, toObject);
      if (!keys) options.type = 'text';
      return options;
    }

    /**
     * Returns a style object for this text
     * @param {PhotoEditorSDK} SDK
     * @param {PhotoEditorSDK.Math.Vector2} inputDimensions
     * @return {Object}
     */
    /* istanbul ignore next */

  }, {
    key: 'getDOMStyle',
    value: function getDOMStyle(sdk, inputDimensions) {
      var actualFontSize = this.getFontSize() * inputDimensions.y;

      return {
        fontWeight: this._options.fontWeight,
        fontSize: actualFontSize + 'px',
        fontStyle: this._options.fontStyle,
        fontFamily: this._options.fontFamily,
        lineHeight: this.getAbsoluteTextHeight(inputDimensions) * this.getLineHeight() + 'px',
        color: this._options.color.toRGBA(),
        backgroundColor: this._options.backgroundColor.toRGBA(),
        textAlign: this._options.alignment
      };
    }

    /**
     * Returns the absolute text height in pixels. The value is calculated
     * using the current fonts metrics, the font size and the given input dimensions.
     * If no font metrics are available, a fallback algorithm is used to determine
     * the absolute text height.
     * @param {PhotoEditorSDK.Math.Vector2} inputDimensions
     * @return {Float} Absolute text height in pixels
     */

  }, {
    key: 'getAbsoluteTextHeight',
    value: function getAbsoluteTextHeight(inputDimensions) {
      var actualFontSize = this.getFontSize() * inputDimensions.y;
      var textMetrics = this.getTextMetrics();

      if (textMetrics) {
        // The text height for the current font size is calculated
        // using the given font metrics.
        var scale = 1 / textMetrics.unitsPerEm * actualFontSize;
        var ascent = textMetrics.ascender * scale;
        var descent = textMetrics.descender * scale;
        return ascent + Math.abs(descent);
      } else {
        return actualFontSize * this.getLineHeight() * 1.1;
      }
    }

    /**
     * Returns the dimensions for this text
     * @param  {PhotoEditorSDK} sdk
     * @param  {PhotoEditorSDK.Math.Vector2} inputDimensions
     * @return {PhotoEditorSDK.Math.Vector2}
     */
    /* istanbul ignore next */

  }, {
    key: 'getDimensions',
    value: function getDimensions(sdk, inputDimensions) {
      return this._textRenderer.getDimensions(sdk, inputDimensions);
    }

    /**
     * Applies a flip in the given direction
     * @param  {String} direction
     */

  }, {
    key: 'applyFlip',
    value: function applyFlip(direction) {
      _get(TextSprite.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextSprite.prototype), 'applyFlip', this).call(this, direction);

      var rotation = this._options.rotation;
      switch (direction) {
        case 'horizontal':
          rotation += (Math.PI - rotation) * 2;
          this.setRotation(rotation);
          break;
        case 'vertical':
          rotation += (Math.PI / 2 - rotation) * 2;
          this.setRotation(rotation);
          break;
      }
    }

    /**
     * Applies a transform with the given options
     * @param  {PhotoEditorSDK.Operations.TransformOperation.TransformChange} transformChange
     */

  }, {
    key: 'applyTransform',
    value: function applyTransform(transformChange) {
      _get(TextSprite.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextSprite.prototype), 'applyTransform', this).call(this, transformChange);
      this.set({
        fontSize: transformChange.scaleSize(this.getFontSize(), 'y'),
        maxWidth: transformChange.scaleSize(this.getMaxWidth(), 'x')
      }, false);
    }

    /**
     * Applies a rotation with the given degrees
     * @param  {Number} degrees
     */

  }, {
    key: 'applyRotation',
    value: function applyRotation(degrees) {
      _get(TextSprite.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextSprite.prototype), 'applyRotation', this).call(this, degrees);

      var actualDegrees = (degrees + 360) % 360;
      var inputDimensions = this._operation.getInputDimensions();
      if (actualDegrees === 90 || actualDegrees === 270) {
        this.setMaxWidth(this.getMaxWidth() / inputDimensions.x * inputDimensions.y);
        this.setFontSize(this.getFontSize() / inputDimensions.y * inputDimensions.x);
      }
    }
  }, {
    key: 'setOption',
    value: function setOption(key, value) {
      if (key === 'rotation') {
        this._options.rotation = value;
        if (this._textRenderer) {
          this._textRenderer.rotation = value;
        }
        this._rotation = value;
        this.emit('update');
        return;
      }

      _get(TextSprite.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextSprite.prototype), 'setOption', this).call(this, key, value);
    }
  }, {
    key: 'getOption',
    value: function getOption(key) {
      if (key === 'rotation') {
        return this._rotation;
      }
      return _get(TextSprite.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextSprite.prototype), 'getOption', this).call(this, key);
    }
  }, {
    key: 'getHitTestDisplayObject',
    value: function getHitTestDisplayObject() {
      return this._hitTestSprite;
    }

    /**
     * Updates this sprite
     * @param  {PhotoEditorSDK} sdk
     * @param  {PhotoEditorSDK.Math.Vector2} inputDimensions
     */

  }, {
    key: 'update',
    value: function update(sdk, inputDimensions) {
      this._sprite.setVisible(this._options.visible);
      if (!this._options.visible) return;

      // Re-render text
      this._textRenderer.update(sdk, inputDimensions);

      var textTexture = this._textRenderer.getFinalTexture();
      var baseTexture = textTexture.getBaseTexture();
      baseTexture.update();

      // Upload texture
      var renderer = sdk.getRenderer();

      /* istanbul ignore next */
      if (renderer.isOfType(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["RendererType"].WEBGL)) {
        renderer.updateTexture(textTexture.getBaseTexture());
      }
      _get(TextSprite.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextSprite.prototype), 'update', this).call(this, sdk, inputDimensions);

      this._sprite.setRotation(0);

      this._textRenderer.getTexture().getBaseTexture().update();
      this._hitTestSprite.setRotation(this._rotation);
      this._hitTestSprite.updateTransform();
    }

    /**
     * Returns the texture for the sprite that should be rendered
     * @return {PhotoEditorSDK.Engine.Texture}
     * @private
     * @abstract
     */

  }, {
    key: '_getTexture',
    value: function _getTexture() {
      return this._textRenderer.getFinalTexture();
    }

    /**
     * Cleans up this Sprite
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      _get(TextSprite.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextSprite.prototype), 'dispose', this).call(this);
      this._textRenderer.dispose();
    }
  }]);

  return TextSprite;
}(__WEBPACK_IMPORTED_MODULE_6__shared_sprite__["a" /* default */]);

TextSprite.prototype.availableOptions = {
  id: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].STRING, default: function _default() {
      return __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].getUUID();
    } },
  fontSize: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.1 },
  characterSpacing: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0 },
  lineHeight: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 1.1 },
  fontIdentifier: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].STRING },
  fontFamily: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].STRING, default: 'Times New Roman' },
  fontWeight: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].ALL, default: 'normal' },
  fontStyle: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].STRING, default: 'normal' },
  textMetrics: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].OBJECT, default: null },
  outlineWidth: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0 },
  outlineColor: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].COLOR, default: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Color"].BLACK },
  alignment: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].STRING, default: 'left', available: ['left', 'center', 'right'] },
  verticalAlignment: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].STRING, default: 'top', available: ['top', 'center', 'bottom'] },
  color: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].COLOR, default: new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Color"](1, 0, 0, 1) },
  backgroundColor: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].COLOR, default: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Color"].TRANSPARENT },
  position: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(0.5, 0.5) },
  anchor: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(0, 0) },
  pivot: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(0.5, 0.5) },
  rotation: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0 },
  text: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].STRING, required: true },
  maxWidth: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.5 },
  maxHeight: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0 },
  visible: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].BOOLEAN, default: true }
};

TextSprite.type = 'text';

/* harmony default export */ __webpack_exports__["a"] = (TextSprite);

/***/ }),
/* 351 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__shared_sprite__ = __webpack_require__(56);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__text_design_models_randomizer__ = __webpack_require__(16);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__text_design_layout_text_design_blocks__ = __webpack_require__(57);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__text_design_layout_text_design_blocks_condensed__ = __webpack_require__(360);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__text_design_layout_text_design_blocks_light__ = __webpack_require__(361);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__text_design_layout_text_design_celebrate__ = __webpack_require__(152);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__text_design_layout_text_design_celebrate_simple__ = __webpack_require__(362);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__text_design_layout_text_design_equal_width__ = __webpack_require__(154);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__text_design_layout_text_design_equal_width_fat__ = __webpack_require__(364);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__text_design_layout_text_design_masked__ = __webpack_require__(44);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__text_design_layout_text_design_masked_badge__ = __webpack_require__(366);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__text_design_layout_text_design_masked_speech_bubble__ = __webpack_require__(107);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__text_design_layout_text_design_masked_speech_bubble_comic__ = __webpack_require__(367);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__text_design_layout_text_design_multiline__ = __webpack_require__(368);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__text_design_layout_text_design_watercolor__ = __webpack_require__(369);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__text_design_layout_text_design_sunshine__ = __webpack_require__(156);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__text_design_layout_text_design_particles__ = __webpack_require__(370);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__text_design_layout_text_design_rotated__ = __webpack_require__(375);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__text_design_text_design_asset_manager__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__text_design_text_design_renderer__ = __webpack_require__(377);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__text_design_models_size_value__ = __webpack_require__(23);






var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */
























var Vector2 = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Math"].Vector2;

/**
 * A sprite that renders a text design layout.
 * @class
 * @memberof PhotoEditorSDK.Operations.SpriteOperation
 */

var TextDesignSprite = function (_Sprite) {
  _inherits(TextDesignSprite, _Sprite);

  function TextDesignSprite(operation, options) {
    _classCallCheck(this, TextDesignSprite);

    var _this = _possibleConstructorReturn(this, (TextDesignSprite.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignSprite)).call(this, operation, options));

    _this._renderer = new __WEBPACK_IMPORTED_MODULE_25__text_design_text_design_renderer__["a" /* TextDesignRenderer */]();
    _this._canvas = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].createCanvas();
    _this._context = _this._canvas.getContext('2d');
    _this._texture = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].Texture.fromCanvas(_this._canvas);
    _this._sprite.setTexture(_this._texture);
    _this._aspect = 1;

    if (_this.getSeed() < 0) {
      _this.setSeed(__WEBPACK_IMPORTED_MODULE_7__text_design_models_randomizer__["a" /* Randomizer */].TimeSeed());
    }
    return _this;
  }

  _createClass(TextDesignSprite, [{
    key: 'seed',
    value: function seed(value) {
      this.setSeed(value || __WEBPACK_IMPORTED_MODULE_7__text_design_models_randomizer__["a" /* Randomizer */].TimeSeed());
    }
  }, {
    key: '_updateLayout',
    value: function _updateLayout() {
      var layout = this.getLayout();

      if (!layout) {
        return null;
      }

      this._renderer.createLayout(layout, this.getText(), this.getSeed());

      this._aspect = this._renderer.calculateAspect();

      this._isLayoutDirty = false;

      return true;
    }

    /**
     * Applies a transform with the given options
     * @param  {PhotoEditorSDK.Operations.TransformOperation.TransformChange} transformChange
     */

  }, {
    key: 'applyTransform',
    value: function applyTransform(transformChange) {
      var newOptions = {};
      newOptions.rotation = transformChange.applyToRotation(this.getRotation());
      newOptions.position = transformChange.applyToRelativePoint(this.getPosition());
      if (this._options.dimensions) {
        newOptions.width = transformChange.applyToRelativeSize(this.getWidth());
      }
      this.set(newOptions, false);
    }
  }, {
    key: 'update',
    value: function update(sdk, inputDimensions) {
      if (this._isLayoutDirty && !this._updateLayout()) {
        return;
      }

      // Transform relative width to (unzoomed) width in pixels
      var width = this.getWidth() * inputDimensions.min() / sdk.getTextureScale();

      var height = width / this._aspect;

      __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].ensureCanvasDimensions(this._canvas, new Vector2(width, height));

      this._context.clearRect(0, 0, this._canvas.width, this._canvas.height);

      this._renderer.draw(this._context, new __WEBPACK_IMPORTED_MODULE_26__text_design_models_size_value__["a" /* SizeValue */](width, height), this.getColor(), this.getInverted());

      this.setDimensions(new Vector2(width, height));

      this._texture.getBaseTexture().update();

      // Upload texture
      var renderer = sdk.getRenderer();

      /* istanbul ignore next */
      if (renderer.isOfType(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["RendererType"].WEBGL)) {
        renderer.updateTexture(this._texture.getBaseTexture());
      }

      _get(TextDesignSprite.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignSprite.prototype), 'update', this).call(this, sdk, inputDimensions);
    }

    /**
     * Checks if the given option has the given value
     * @param  {String} optionName
     * @param  {*} value
     * @return {Boolean}
     * @private
     */

  }, {
    key: '_optionEquals',
    value: function _optionEquals(optionName, value) {
      if (optionName === 'layout') {
        var layout = this._options.layout;

        if (!layout && value || !value && layout) {
          return false;
        }

        if (!value.constructor || !layout.constructor) {
          return false;
        }

        if (layout.constructor.identifier !== value.constructor.identifier) {
          return false;
        }

        return true;
      }

      return _get(TextDesignSprite.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignSprite.prototype), '_optionEquals', this).call(this, optionName, value);
    }

    /**
     * Returns a serialized version of this configurable
     * @param {String[]} keys
     * @param {Boolean} toObject = false
     * @return {Object}
     */

  }, {
    key: 'serializeOptions',
    value: function serializeOptions(keys) {
      var toObject = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;

      var options = _get(TextDesignSprite.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignSprite.prototype), 'serializeOptions', this).call(this, keys, toObject);
      if (!keys) options.type = 'text-design';
      return options;
    }
  }]);

  return TextDesignSprite;
}(__WEBPACK_IMPORTED_MODULE_6__shared_sprite__["a" /* default */]);

TextDesignSprite.Layouts = {
  TextDesignBlocks: __WEBPACK_IMPORTED_MODULE_8__text_design_layout_text_design_blocks__["a" /* TextDesignBlocks */],
  TextDesignBlocksCondensed: __WEBPACK_IMPORTED_MODULE_9__text_design_layout_text_design_blocks_condensed__["a" /* TextDesignBlocksCondensed */],
  TextDesignBlocksLight: __WEBPACK_IMPORTED_MODULE_10__text_design_layout_text_design_blocks_light__["a" /* TextDesignBlocksLight */],
  TextDesignCelebrate: __WEBPACK_IMPORTED_MODULE_11__text_design_layout_text_design_celebrate__["a" /* TextDesignCelebrate */],
  TextDesignCelebrateSimple: __WEBPACK_IMPORTED_MODULE_12__text_design_layout_text_design_celebrate_simple__["a" /* TextDesignCelebrateSimple */],
  TextDesignEqualWidth: __WEBPACK_IMPORTED_MODULE_13__text_design_layout_text_design_equal_width__["a" /* TextDesignEqualWidth */],
  TextDesignEqualWidthFat: __WEBPACK_IMPORTED_MODULE_14__text_design_layout_text_design_equal_width_fat__["a" /* TextDesignEqualWidthFat */],
  TextDesignMasked: __WEBPACK_IMPORTED_MODULE_15__text_design_layout_text_design_masked__["a" /* TextDesignMasked */],
  TextDesignMaskedBadge: __WEBPACK_IMPORTED_MODULE_16__text_design_layout_text_design_masked_badge__["a" /* TextDesignMaskedBadge */],
  TextDesignMaskedSpeechBubble: __WEBPACK_IMPORTED_MODULE_17__text_design_layout_text_design_masked_speech_bubble__["a" /* TextDesignMaskedSpeechBubble */],
  TextDesignMaskedSpeechBubbleComic: __WEBPACK_IMPORTED_MODULE_18__text_design_layout_text_design_masked_speech_bubble_comic__["a" /* TextDesignMaskedSpeechBubbleComic */],
  TextDesignMultiline: __WEBPACK_IMPORTED_MODULE_19__text_design_layout_text_design_multiline__["a" /* TextDesignMultiline */],
  TextDesignWatercolor: __WEBPACK_IMPORTED_MODULE_20__text_design_layout_text_design_watercolor__["a" /* TextDesignWatercolor */],
  TextDesignSunshine: __WEBPACK_IMPORTED_MODULE_21__text_design_layout_text_design_sunshine__["a" /* TextDesignSunshine */],
  TextDesignParticles: __WEBPACK_IMPORTED_MODULE_22__text_design_layout_text_design_particles__["a" /* TextDesignParticles */],
  TextDesignRotated: __WEBPACK_IMPORTED_MODULE_23__text_design_layout_text_design_rotated__["a" /* TextDesignRotated */]
};

TextDesignSprite.AssetManager = __WEBPACK_IMPORTED_MODULE_24__text_design_text_design_asset_manager__["a" /* AssetManager */];

TextDesignSprite.prototype.availableOptions = {
  id: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].STRING, default: function _default() {
      return __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].getUUID();
    } },
  position: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(0.5, 0.5) },
  dimensions: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].VECTOR2, default: Vector2.NULL },
  anchor: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(0.0, 0.0) },
  pivot: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(0.5, 0.5) },
  rotation: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0 },
  flipHorizontally: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].BOOLEAN, default: false },
  flipVertically: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].BOOLEAN, default: false },

  layout: {
    type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].OBJECT,
    default: null,
    setter: function setter(layout) {
      this._isLayoutDirty = true;

      return layout;
    }
  },
  text: {
    type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].STRING,
    default: '',
    setter: function setter(text) {
      this._isLayoutDirty = true;

      return text;
    }
  },
  color: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].COLOR, default: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Color"].BLACK },
  width: {
    type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER,
    default: 0.8,
    setter: function setter(width) {
      // this._isLayoutDirty = true

      return width;
    }
  },
  inverted: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].BOOLEAN, default: false },
  seed: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: -1 }
};

/* harmony default export */ __webpack_exports__["a"] = (TextDesignSprite);

/***/ }),
/* 352 */
/***/ (function(module, exports, __webpack_require__) {

module.exports = { "default": __webpack_require__(353), __esModule: true };

/***/ }),
/* 353 */
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(354);
module.exports = 0x1fffffffffffff;


/***/ }),
/* 354 */
/***/ (function(module, exports, __webpack_require__) {

// 20.1.2.6 Number.MAX_SAFE_INTEGER
var $export = __webpack_require__(13);

$export($export.S, 'Number', { MAX_SAFE_INTEGER: 0x1fffffffffffff });


/***/ }),
/* 355 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignLayoutData; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__rows_default_text_design_row__ = __webpack_require__(59);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__size_value__ = __webpack_require__(23);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */





var Rectangle = __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Math"].Rectangle;


var TextDesignLayoutData = function (_Configurable) {
  _inherits(TextDesignLayoutData, _Configurable);

  function TextDesignLayoutData() {
    _classCallCheck(this, TextDesignLayoutData);

    return _possibleConstructorReturn(this, (TextDesignLayoutData.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignLayoutData)).apply(this, arguments));
  }

  _createClass(TextDesignLayoutData, [{
    key: 'getSize',
    value: function getSize() {
      var rows = this.getRows();
      var width = this.getWidth();
      var lineCount = rows.length - 1;
      var height = rows.reduce(function (acc, row) {
        return acc + row.getSize().height;
      }, 0);

      height += (lineCount + 1) * this.getRelativeLineSpacing() * width;

      var insets = this.getRelativeInsets().clone().scale(width);
      height += insets.top + insets.bottom;

      return new __WEBPACK_IMPORTED_MODULE_7__size_value__["a" /* SizeValue */](width, height);
    }
  }]);

  return TextDesignLayoutData;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Configurable"]);

TextDesignLayoutData.prototype.availableOptions = {
  text: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].STRING, default: '' },
  lines: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].ARRAY, default: [] },
  relativeInsets: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].OBJECT, default: new __WEBPACK_IMPORTED_MODULE_5__rectangle_insets__["a" /* RectangleInsets */]() },
  relativeLineSpacing: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 0 },
  rows: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].OBJECT, default: [] },
  background: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].OBJECT, default: null },
  width: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 0 }
};

/***/ }),
/* 356 */
/***/ (function(module, exports, __webpack_require__) {

module.exports = __webpack_require__(357);


/***/ }),
/* 357 */
/***/ (function(module, exports, __webpack_require__) {

/**
 * Copyright (c) 2014-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

// This method of obtaining a reference to the global object needs to be
// kept identical to the way it is obtained in runtime.js
var g = (function() { return this })() || Function("return this")();

// Use `getOwnPropertyNames` because not all browsers support calling
// `hasOwnProperty` on the global `self` object in a worker. See #183.
var hadRuntime = g.regeneratorRuntime &&
  Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0;

// Save the old regeneratorRuntime in case it needs to be restored later.
var oldRuntime = hadRuntime && g.regeneratorRuntime;

// Force reevalutation of runtime.js.
g.regeneratorRuntime = undefined;

module.exports = __webpack_require__(358);

if (hadRuntime) {
  // Restore the original runtime.
  g.regeneratorRuntime = oldRuntime;
} else {
  // Remove the global property added by runtime.js.
  try {
    delete g.regeneratorRuntime;
  } catch(e) {
    g.regeneratorRuntime = undefined;
  }
}


/***/ }),
/* 358 */
/***/ (function(module, exports) {

/**
 * Copyright (c) 2014-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

!(function(global) {
  "use strict";

  var Op = Object.prototype;
  var hasOwn = Op.hasOwnProperty;
  var undefined; // More compressible than void 0.
  var $Symbol = typeof Symbol === "function" ? Symbol : {};
  var iteratorSymbol = $Symbol.iterator || "@@iterator";
  var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";

  var inModule = typeof module === "object";
  var runtime = global.regeneratorRuntime;
  if (runtime) {
    if (inModule) {
      // If regeneratorRuntime is defined globally and we're in a module,
      // make the exports object identical to regeneratorRuntime.
      module.exports = runtime;
    }
    // Don't bother evaluating the rest of this file if the runtime was
    // already defined globally.
    return;
  }

  // Define the runtime globally (as expected by generated code) as either
  // module.exports (if we're in a module) or a new, empty object.
  runtime = global.regeneratorRuntime = inModule ? module.exports : {};

  function wrap(innerFn, outerFn, self, tryLocsList) {
    // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
    var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
    var generator = Object.create(protoGenerator.prototype);
    var context = new Context(tryLocsList || []);

    // The ._invoke method unifies the implementations of the .next,
    // .throw, and .return methods.
    generator._invoke = makeInvokeMethod(innerFn, self, context);

    return generator;
  }
  runtime.wrap = wrap;

  // Try/catch helper to minimize deoptimizations. Returns a completion
  // record like context.tryEntries[i].completion. This interface could
  // have been (and was previously) designed to take a closure to be
  // invoked without arguments, but in all the cases we care about we
  // already have an existing method we want to call, so there's no need
  // to create a new function object. We can even get away with assuming
  // the method takes exactly one argument, since that happens to be true
  // in every case, so we don't have to touch the arguments object. The
  // only additional allocation required is the completion record, which
  // has a stable shape and so hopefully should be cheap to allocate.
  function tryCatch(fn, obj, arg) {
    try {
      return { type: "normal", arg: fn.call(obj, arg) };
    } catch (err) {
      return { type: "throw", arg: err };
    }
  }

  var GenStateSuspendedStart = "suspendedStart";
  var GenStateSuspendedYield = "suspendedYield";
  var GenStateExecuting = "executing";
  var GenStateCompleted = "completed";

  // Returning this object from the innerFn has the same effect as
  // breaking out of the dispatch switch statement.
  var ContinueSentinel = {};

  // Dummy constructor functions that we use as the .constructor and
  // .constructor.prototype properties for functions that return Generator
  // objects. For full spec compliance, you may wish to configure your
  // minifier not to mangle the names of these two functions.
  function Generator() {}
  function GeneratorFunction() {}
  function GeneratorFunctionPrototype() {}

  // This is a polyfill for %IteratorPrototype% for environments that
  // don't natively support it.
  var IteratorPrototype = {};
  IteratorPrototype[iteratorSymbol] = function () {
    return this;
  };

  var getProto = Object.getPrototypeOf;
  var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  if (NativeIteratorPrototype &&
      NativeIteratorPrototype !== Op &&
      hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
    // This environment has a native %IteratorPrototype%; use it instead
    // of the polyfill.
    IteratorPrototype = NativeIteratorPrototype;
  }

  var Gp = GeneratorFunctionPrototype.prototype =
    Generator.prototype = Object.create(IteratorPrototype);
  GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
  GeneratorFunctionPrototype.constructor = GeneratorFunction;
  GeneratorFunctionPrototype[toStringTagSymbol] =
    GeneratorFunction.displayName = "GeneratorFunction";

  // Helper for defining the .next, .throw, and .return methods of the
  // Iterator interface in terms of a single ._invoke method.
  function defineIteratorMethods(prototype) {
    ["next", "throw", "return"].forEach(function(method) {
      prototype[method] = function(arg) {
        return this._invoke(method, arg);
      };
    });
  }

  runtime.isGeneratorFunction = function(genFun) {
    var ctor = typeof genFun === "function" && genFun.constructor;
    return ctor
      ? ctor === GeneratorFunction ||
        // For the native GeneratorFunction constructor, the best we can
        // do is to check its .name property.
        (ctor.displayName || ctor.name) === "GeneratorFunction"
      : false;
  };

  runtime.mark = function(genFun) {
    if (Object.setPrototypeOf) {
      Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
    } else {
      genFun.__proto__ = GeneratorFunctionPrototype;
      if (!(toStringTagSymbol in genFun)) {
        genFun[toStringTagSymbol] = "GeneratorFunction";
      }
    }
    genFun.prototype = Object.create(Gp);
    return genFun;
  };

  // Within the body of any async function, `await x` is transformed to
  // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  // `hasOwn.call(value, "__await")` to determine if the yielded value is
  // meant to be awaited.
  runtime.awrap = function(arg) {
    return { __await: arg };
  };

  function AsyncIterator(generator) {
    function invoke(method, arg, resolve, reject) {
      var record = tryCatch(generator[method], generator, arg);
      if (record.type === "throw") {
        reject(record.arg);
      } else {
        var result = record.arg;
        var value = result.value;
        if (value &&
            typeof value === "object" &&
            hasOwn.call(value, "__await")) {
          return Promise.resolve(value.__await).then(function(value) {
            invoke("next", value, resolve, reject);
          }, function(err) {
            invoke("throw", err, resolve, reject);
          });
        }

        return Promise.resolve(value).then(function(unwrapped) {
          // When a yielded Promise is resolved, its final value becomes
          // the .value of the Promise<{value,done}> result for the
          // current iteration. If the Promise is rejected, however, the
          // result for this iteration will be rejected with the same
          // reason. Note that rejections of yielded Promises are not
          // thrown back into the generator function, as is the case
          // when an awaited Promise is rejected. This difference in
          // behavior between yield and await is important, because it
          // allows the consumer to decide what to do with the yielded
          // rejection (swallow it and continue, manually .throw it back
          // into the generator, abandon iteration, whatever). With
          // await, by contrast, there is no opportunity to examine the
          // rejection reason outside the generator function, so the
          // only option is to throw it from the await expression, and
          // let the generator function handle the exception.
          result.value = unwrapped;
          resolve(result);
        }, reject);
      }
    }

    var previousPromise;

    function enqueue(method, arg) {
      function callInvokeWithMethodAndArg() {
        return new Promise(function(resolve, reject) {
          invoke(method, arg, resolve, reject);
        });
      }

      return previousPromise =
        // If enqueue has been called before, then we want to wait until
        // all previous Promises have been resolved before calling invoke,
        // so that results are always delivered in the correct order. If
        // enqueue has not been called before, then it is important to
        // call invoke immediately, without waiting on a callback to fire,
        // so that the async generator function has the opportunity to do
        // any necessary setup in a predictable way. This predictability
        // is why the Promise constructor synchronously invokes its
        // executor callback, and why async functions synchronously
        // execute code before the first await. Since we implement simple
        // async functions in terms of async generators, it is especially
        // important to get this right, even though it requires care.
        previousPromise ? previousPromise.then(
          callInvokeWithMethodAndArg,
          // Avoid propagating failures to Promises returned by later
          // invocations of the iterator.
          callInvokeWithMethodAndArg
        ) : callInvokeWithMethodAndArg();
    }

    // Define the unified helper method that is used to implement .next,
    // .throw, and .return (see defineIteratorMethods).
    this._invoke = enqueue;
  }

  defineIteratorMethods(AsyncIterator.prototype);
  AsyncIterator.prototype[asyncIteratorSymbol] = function () {
    return this;
  };
  runtime.AsyncIterator = AsyncIterator;

  // Note that simple async functions are implemented on top of
  // AsyncIterator objects; they just return a Promise for the value of
  // the final result produced by the iterator.
  runtime.async = function(innerFn, outerFn, self, tryLocsList) {
    var iter = new AsyncIterator(
      wrap(innerFn, outerFn, self, tryLocsList)
    );

    return runtime.isGeneratorFunction(outerFn)
      ? iter // If outerFn is a generator, return the full iterator.
      : iter.next().then(function(result) {
          return result.done ? result.value : iter.next();
        });
  };

  function makeInvokeMethod(innerFn, self, context) {
    var state = GenStateSuspendedStart;

    return function invoke(method, arg) {
      if (state === GenStateExecuting) {
        throw new Error("Generator is already running");
      }

      if (state === GenStateCompleted) {
        if (method === "throw") {
          throw arg;
        }

        // Be forgiving, per 25.3.3.3.3 of the spec:
        // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
        return doneResult();
      }

      context.method = method;
      context.arg = arg;

      while (true) {
        var delegate = context.delegate;
        if (delegate) {
          var delegateResult = maybeInvokeDelegate(delegate, context);
          if (delegateResult) {
            if (delegateResult === ContinueSentinel) continue;
            return delegateResult;
          }
        }

        if (context.method === "next") {
          // Setting context._sent for legacy support of Babel's
          // function.sent implementation.
          context.sent = context._sent = context.arg;

        } else if (context.method === "throw") {
          if (state === GenStateSuspendedStart) {
            state = GenStateCompleted;
            throw context.arg;
          }

          context.dispatchException(context.arg);

        } else if (context.method === "return") {
          context.abrupt("return", context.arg);
        }

        state = GenStateExecuting;

        var record = tryCatch(innerFn, self, context);
        if (record.type === "normal") {
          // If an exception is thrown from innerFn, we leave state ===
          // GenStateExecuting and loop back for another invocation.
          state = context.done
            ? GenStateCompleted
            : GenStateSuspendedYield;

          if (record.arg === ContinueSentinel) {
            continue;
          }

          return {
            value: record.arg,
            done: context.done
          };

        } else if (record.type === "throw") {
          state = GenStateCompleted;
          // Dispatch the exception by looping back around to the
          // context.dispatchException(context.arg) call above.
          context.method = "throw";
          context.arg = record.arg;
        }
      }
    };
  }

  // Call delegate.iterator[context.method](context.arg) and handle the
  // result, either by returning a { value, done } result from the
  // delegate iterator, or by modifying context.method and context.arg,
  // setting context.delegate to null, and returning the ContinueSentinel.
  function maybeInvokeDelegate(delegate, context) {
    var method = delegate.iterator[context.method];
    if (method === undefined) {
      // A .throw or .return when the delegate iterator has no .throw
      // method always terminates the yield* loop.
      context.delegate = null;

      if (context.method === "throw") {
        if (delegate.iterator.return) {
          // If the delegate iterator has a return method, give it a
          // chance to clean up.
          context.method = "return";
          context.arg = undefined;
          maybeInvokeDelegate(delegate, context);

          if (context.method === "throw") {
            // If maybeInvokeDelegate(context) changed context.method from
            // "return" to "throw", let that override the TypeError below.
            return ContinueSentinel;
          }
        }

        context.method = "throw";
        context.arg = new TypeError(
          "The iterator does not provide a 'throw' method");
      }

      return ContinueSentinel;
    }

    var record = tryCatch(method, delegate.iterator, context.arg);

    if (record.type === "throw") {
      context.method = "throw";
      context.arg = record.arg;
      context.delegate = null;
      return ContinueSentinel;
    }

    var info = record.arg;

    if (! info) {
      context.method = "throw";
      context.arg = new TypeError("iterator result is not an object");
      context.delegate = null;
      return ContinueSentinel;
    }

    if (info.done) {
      // Assign the result of the finished delegate to the temporary
      // variable specified by delegate.resultName (see delegateYield).
      context[delegate.resultName] = info.value;

      // Resume execution at the desired location (see delegateYield).
      context.next = delegate.nextLoc;

      // If context.method was "throw" but the delegate handled the
      // exception, let the outer generator proceed normally. If
      // context.method was "next", forget context.arg since it has been
      // "consumed" by the delegate iterator. If context.method was
      // "return", allow the original .return call to continue in the
      // outer generator.
      if (context.method !== "return") {
        context.method = "next";
        context.arg = undefined;
      }

    } else {
      // Re-yield the result returned by the delegate method.
      return info;
    }

    // The delegate iterator is finished, so forget it and continue with
    // the outer generator.
    context.delegate = null;
    return ContinueSentinel;
  }

  // Define Generator.prototype.{next,throw,return} in terms of the
  // unified ._invoke helper method.
  defineIteratorMethods(Gp);

  Gp[toStringTagSymbol] = "Generator";

  // A Generator should always return itself as the iterator object when the
  // @@iterator function is called on it. Some browsers' implementations of the
  // iterator prototype chain incorrectly implement this, causing the Generator
  // object to not be returned from this call. This ensures that doesn't happen.
  // See https://github.com/facebook/regenerator/issues/274 for more details.
  Gp[iteratorSymbol] = function() {
    return this;
  };

  Gp.toString = function() {
    return "[object Generator]";
  };

  function pushTryEntry(locs) {
    var entry = { tryLoc: locs[0] };

    if (1 in locs) {
      entry.catchLoc = locs[1];
    }

    if (2 in locs) {
      entry.finallyLoc = locs[2];
      entry.afterLoc = locs[3];
    }

    this.tryEntries.push(entry);
  }

  function resetTryEntry(entry) {
    var record = entry.completion || {};
    record.type = "normal";
    delete record.arg;
    entry.completion = record;
  }

  function Context(tryLocsList) {
    // The root entry object (effectively a try statement without a catch
    // or a finally block) gives us a place to store values thrown from
    // locations where there is no enclosing try statement.
    this.tryEntries = [{ tryLoc: "root" }];
    tryLocsList.forEach(pushTryEntry, this);
    this.reset(true);
  }

  runtime.keys = function(object) {
    var keys = [];
    for (var key in object) {
      keys.push(key);
    }
    keys.reverse();

    // Rather than returning an object with a next method, we keep
    // things simple and return the next function itself.
    return function next() {
      while (keys.length) {
        var key = keys.pop();
        if (key in object) {
          next.value = key;
          next.done = false;
          return next;
        }
      }

      // To avoid creating an additional object, we just hang the .value
      // and .done properties off the next function object itself. This
      // also ensures that the minifier will not anonymize the function.
      next.done = true;
      return next;
    };
  };

  function values(iterable) {
    if (iterable) {
      var iteratorMethod = iterable[iteratorSymbol];
      if (iteratorMethod) {
        return iteratorMethod.call(iterable);
      }

      if (typeof iterable.next === "function") {
        return iterable;
      }

      if (!isNaN(iterable.length)) {
        var i = -1, next = function next() {
          while (++i < iterable.length) {
            if (hasOwn.call(iterable, i)) {
              next.value = iterable[i];
              next.done = false;
              return next;
            }
          }

          next.value = undefined;
          next.done = true;

          return next;
        };

        return next.next = next;
      }
    }

    // Return an iterator with no values.
    return { next: doneResult };
  }
  runtime.values = values;

  function doneResult() {
    return { value: undefined, done: true };
  }

  Context.prototype = {
    constructor: Context,

    reset: function(skipTempReset) {
      this.prev = 0;
      this.next = 0;
      // Resetting context._sent for legacy support of Babel's
      // function.sent implementation.
      this.sent = this._sent = undefined;
      this.done = false;
      this.delegate = null;

      this.method = "next";
      this.arg = undefined;

      this.tryEntries.forEach(resetTryEntry);

      if (!skipTempReset) {
        for (var name in this) {
          // Not sure about the optimal order of these conditions:
          if (name.charAt(0) === "t" &&
              hasOwn.call(this, name) &&
              !isNaN(+name.slice(1))) {
            this[name] = undefined;
          }
        }
      }
    },

    stop: function() {
      this.done = true;

      var rootEntry = this.tryEntries[0];
      var rootRecord = rootEntry.completion;
      if (rootRecord.type === "throw") {
        throw rootRecord.arg;
      }

      return this.rval;
    },

    dispatchException: function(exception) {
      if (this.done) {
        throw exception;
      }

      var context = this;
      function handle(loc, caught) {
        record.type = "throw";
        record.arg = exception;
        context.next = loc;

        if (caught) {
          // If the dispatched exception was caught by a catch block,
          // then let that catch block handle the exception normally.
          context.method = "next";
          context.arg = undefined;
        }

        return !! caught;
      }

      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
        var entry = this.tryEntries[i];
        var record = entry.completion;

        if (entry.tryLoc === "root") {
          // Exception thrown outside of any try block that could handle
          // it, so set the completion value of the entire function to
          // throw the exception.
          return handle("end");
        }

        if (entry.tryLoc <= this.prev) {
          var hasCatch = hasOwn.call(entry, "catchLoc");
          var hasFinally = hasOwn.call(entry, "finallyLoc");

          if (hasCatch && hasFinally) {
            if (this.prev < entry.catchLoc) {
              return handle(entry.catchLoc, true);
            } else if (this.prev < entry.finallyLoc) {
              return handle(entry.finallyLoc);
            }

          } else if (hasCatch) {
            if (this.prev < entry.catchLoc) {
              return handle(entry.catchLoc, true);
            }

          } else if (hasFinally) {
            if (this.prev < entry.finallyLoc) {
              return handle(entry.finallyLoc);
            }

          } else {
            throw new Error("try statement without catch or finally");
          }
        }
      }
    },

    abrupt: function(type, arg) {
      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
        var entry = this.tryEntries[i];
        if (entry.tryLoc <= this.prev &&
            hasOwn.call(entry, "finallyLoc") &&
            this.prev < entry.finallyLoc) {
          var finallyEntry = entry;
          break;
        }
      }

      if (finallyEntry &&
          (type === "break" ||
           type === "continue") &&
          finallyEntry.tryLoc <= arg &&
          arg <= finallyEntry.finallyLoc) {
        // Ignore the finally entry if control is not jumping to a
        // location outside the try/catch block.
        finallyEntry = null;
      }

      var record = finallyEntry ? finallyEntry.completion : {};
      record.type = type;
      record.arg = arg;

      if (finallyEntry) {
        this.method = "next";
        this.next = finallyEntry.finallyLoc;
        return ContinueSentinel;
      }

      return this.complete(record);
    },

    complete: function(record, afterLoc) {
      if (record.type === "throw") {
        throw record.arg;
      }

      if (record.type === "break" ||
          record.type === "continue") {
        this.next = record.arg;
      } else if (record.type === "return") {
        this.rval = this.arg = record.arg;
        this.method = "return";
        this.next = "end";
      } else if (record.type === "normal" && afterLoc) {
        this.next = afterLoc;
      }

      return ContinueSentinel;
    },

    finish: function(finallyLoc) {
      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
        var entry = this.tryEntries[i];
        if (entry.finallyLoc === finallyLoc) {
          this.complete(entry.completion, entry.afterLoc);
          resetTryEntry(entry);
          return ContinueSentinel;
        }
      }
    },

    "catch": function(tryLoc) {
      for (var i = this.tryEntries.length - 1; i >= 0; --i) {
        var entry = this.tryEntries[i];
        if (entry.tryLoc === tryLoc) {
          var record = entry.completion;
          if (record.type === "throw") {
            var thrown = record.arg;
            resetTryEntry(entry);
          }
          return thrown;
        }
      }

      // The context.catch method must only be called with a location
      // argument that corresponds to a known catch block.
      throw new Error("illegal catch attempt");
    },

    delegateYield: function(iterable, resultName, nextLoc) {
      this.delegate = {
        iterator: values(iterable),
        resultName: resultName,
        nextLoc: nextLoc
      };

      if (this.method === "next") {
        // Deliberately forget the last sent value so that we don't
        // accidentally pass it on to the delegate.
        this.arg = undefined;
      }

      return ContinueSentinel;
    }
  };
})(
  // In sloppy mode, unbound `this` refers to the global object, fallback to
  // Function constructor if we're in global strict mode. That is sadly a form
  // of indirect eval which violates Content Security Policy.
  (function() { return this })() || Function("return this")()
);


/***/ }),
/* 359 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignRowTriple; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__default_text_design_row__ = __webpack_require__(59);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__text_text_design_font__ = __webpack_require__(60);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__text_design_element__ = __webpack_require__(43);






var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */





var Rectangle = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Math"].Rectangle;


var TextDesignRowTriple = function (_TextDesignRow) {
  _inherits(TextDesignRowTriple, _TextDesignRow);

  function TextDesignRowTriple() {
    _classCallCheck(this, TextDesignRowTriple);

    return _possibleConstructorReturn(this, (TextDesignRowTriple.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignRowTriple)).apply(this, arguments));
  }

  _createClass(TextDesignRowTriple, [{
    key: '_calculateLayoutElements',
    value: function _calculateLayoutElements() {
      if (this.getWords().size() <= 0) {
        return [];
      }

      var _serializeOptions = this.serializeOptions(),
          orientation = _serializeOptions.orientation,
          width = _serializeOptions.width,
          size = _serializeOptions.size,
          relativeRowOffset = _serializeOptions.relativeRowOffset,
          attributes = _serializeOptions.attributes;

      var fontIdentifier = attributes.fontIdentifier;

      var wordGroups = this.getWords().joined(3);

      var lines = orientation === TextDesignRowTriple.Orientations.Left ? [wordGroups[0], wordGroups[1], wordGroups[2]] : [wordGroups[1], wordGroups[2], wordGroups[0]];

      // Dummy fonts for calculating relationships between elements dimensions
      var dummyFonts = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].Array.range(0, 2).map(function (i) {
        return new __WEBPACK_IMPORTED_MODULE_7__text_text_design_font__["a" /* TextDesignFont */]({
          text: lines[i],
          fontIdentifier: fontIdentifier,
          fontSize: 60
        });
      });

      var dummySizes = dummyFonts.map(function (font) {
        return font.getSizeValue();
      });

      // Find out which one has the largest width
      var largestWidthIndex = dummySizes[0].width > dummySizes[1].width ? 0 : 1;
      var smallestWidthIndex = (largestWidthIndex + 1) % 2;

      // Resize the smallest width piece to match the largest one
      dummyFonts[smallestWidthIndex].fitWidth(dummySizes[largestWidthIndex].width);
      dummySizes[smallestWidthIndex] = dummyFonts[smallestWidthIndex].getSizeValue();

      // Get the final height of the "dummy" row
      var dummyHeight = (dummySizes[smallestWidthIndex].height + dummySizes[largestWidthIndex].height) / (1 - relativeRowOffset);

      // Dummy font for the single row calculations
      var dummySingleRowFont = new __WEBPACK_IMPORTED_MODULE_7__text_text_design_font__["a" /* TextDesignFont */]({ text: lines[2], fontIdentifier: fontIdentifier });

      // Fit the single row to the double row's height and get the width
      dummySingleRowFont.fitHeight(dummyHeight);
      var dummySingleRowWidth = dummySingleRowFont.getSizeValue().width;
      var dummyDoubleRowWidth = dummySizes[largestWidthIndex].width;

      // Calculate the actual width of single and double rows, based on the given row width
      var scale = width / (dummySingleRowWidth + dummyDoubleRowWidth);
      var singleRowWidth = scale * dummySingleRowWidth;
      var doubleRowWidth = scale * dummyDoubleRowWidth;

      // Calculate the heights
      var rowHeight = scale * dummyHeight;
      var offset = relativeRowOffset * rowHeight;

      size.set(width, rowHeight);

      // Final fonts
      var fonts = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].Array.range(0, 3).map(function (i) {
        return new __WEBPACK_IMPORTED_MODULE_7__text_text_design_font__["a" /* TextDesignFont */]({ text: lines[i], fontIdentifier: fontIdentifier });
      });

      fonts[0].fitWidth(doubleRowWidth);
      fonts[1].fitWidth(doubleRowWidth);
      fonts[2].fitWidth(singleRowWidth);

      // Calculate the frames
      var doubleRowX = orientation === TextDesignRowTriple.Orientations.Left ? 0 : singleRowWidth;
      var singleRowX = orientation === TextDesignRowTriple.Orientations.Left ? doubleRowWidth : 0;

      var xOffsets = [doubleRowX, doubleRowX, singleRowX];
      var yOffsets = [0, fonts[0].getSizeValue().height + offset, 0];

      var frames = fonts.map(function (font, i) {
        return new Rectangle(xOffsets[i], yOffsets[i], font.getSizeValue().width, font.getSizeValue().height);
      });

      return fonts.map(function (font, i) {
        return new __WEBPACK_IMPORTED_MODULE_8__text_design_element__["a" /* TextDesignElement */]({
          text: lines[i],
          font: fonts[i],
          frame: frames[i]
        });
      });
    }
  }]);

  return TextDesignRowTriple;
}(__WEBPACK_IMPORTED_MODULE_6__default_text_design_row__["a" /* TextDesignRow */]);

TextDesignRowTriple.Orientations = {
  Right: 'RIGHT',
  Left: 'LEFT'
};
TextDesignRowTriple.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_6__default_text_design_row__["a" /* TextDesignRow */].prototype.availableOptions, {
  orientation: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].STRING, default: TextDesignRowTriple.Orientations.Left, available: [TextDesignRowTriple.Orientations.Right, TextDesignRowTriple.Orientations.Left] },
  relativeRowOffset: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.05 }
});

/***/ }),
/* 360 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignBlocksCondensed; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__text_design_blocks__ = __webpack_require__(57);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__models_rows_default_text_design_row_single__ = __webpack_require__(19);







var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */





var TextDesignBlocksCondensed = function (_TextDesignBlocks) {
  _inherits(TextDesignBlocksCondensed, _TextDesignBlocks);

  function TextDesignBlocksCondensed() {
    var _ref;

    _classCallCheck(this, TextDesignBlocksCondensed);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = TextDesignBlocksCondensed.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignBlocksCondensed)).call.apply(_ref, [this].concat(args)));

    _this._exclusiveFont = null;
    return _this;
  }

  _createClass(TextDesignBlocksCondensed, [{
    key: 'generateLayoutData',
    value: function generateLayoutData(text, width) {
      this._exclusiveFont = this._fontRandomizer.pickNext(this.getFontIdentifiers());
      return _get(TextDesignBlocksCondensed.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignBlocksCondensed.prototype), 'generateLayoutData', this).call(this, text, width);
    }
  }, {
    key: '_fontForRow',
    value: function _fontForRow(index, words) {
      return this._exclusiveFont || _get(TextDesignBlocksCondensed.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignBlocksCondensed.prototype), '_fontForRow', this).call(this, index, words);
    }
  }, {
    key: '_layoutRow',
    value: function _layoutRow(words, width, attributes, isMasked) {
      return new __WEBPACK_IMPORTED_MODULE_8__models_rows_default_text_design_row_single__["a" /* TextDesignRowSingle */]({ words: words, width: width, attributes: attributes });
    }
  }]);

  return TextDesignBlocksCondensed;
}(__WEBPACK_IMPORTED_MODULE_7__text_design_blocks__["a" /* TextDesignBlocks */]);

TextDesignBlocksCondensed.defaultFontIdentifiers = ['imgly_font_ostrich_sans_heavy', 'imgly_font_ostrich_sans_bold', 'imgly_font_ostrich_sans_black'];
TextDesignBlocksCondensed.identifier = 'imgly_text_design_blocks_condensed';
TextDesignBlocksCondensed.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_7__text_design_blocks__["a" /* TextDesignBlocks */].prototype.availableOptions, {
  fontIdentifiers: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].ARRAY, default: TextDesignBlocksCondensed.defaultFontIdentifiers }
});

/***/ }),
/* 361 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignBlocksLight; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__text_design_blocks__ = __webpack_require__(57);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__models_rows_default_text_design_row_single__ = __webpack_require__(19);






var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */





var TextDesignBlocksLight = function (_TextDesignBlocks) {
  _inherits(TextDesignBlocksLight, _TextDesignBlocks);

  function TextDesignBlocksLight() {
    _classCallCheck(this, TextDesignBlocksLight);

    return _possibleConstructorReturn(this, (TextDesignBlocksLight.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignBlocksLight)).apply(this, arguments));
  }

  _createClass(TextDesignBlocksLight, [{
    key: '_layoutRow',
    value: function _layoutRow(words, width, attributes, isMasked) {
      return new __WEBPACK_IMPORTED_MODULE_7__models_rows_default_text_design_row_single__["a" /* TextDesignRowSingle */]({ words: words, width: width, attributes: attributes });
    }
  }]);

  return TextDesignBlocksLight;
}(__WEBPACK_IMPORTED_MODULE_6__text_design_blocks__["a" /* TextDesignBlocks */]);

TextDesignBlocksLight.defaultFontIdentifiers = ['imgly_font_summer_font_light'];
TextDesignBlocksLight.identifier = 'imgly_text_design_blocks_light';
TextDesignBlocksLight.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_6__text_design_blocks__["a" /* TextDesignBlocks */].prototype.availableOptions, {
  fontIdentifiers: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].ARRAY, default: TextDesignBlocksLight.defaultFontIdentifiers }
});

/***/ }),
/* 362 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignCelebrateSimple; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_array_from__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_array_from___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_array_from__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__text_design_blocks__ = __webpack_require__(57);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__models_rows_default_text_design_row_single__ = __webpack_require__(19);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__models_text_design_banderole__ = __webpack_require__(103);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__text_words__ = __webpack_require__(33);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__models_rows_image_text_design_row_image__ = __webpack_require__(105);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__text_design_celebrate__ = __webpack_require__(152);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__models_rows_image_text_design_row_single_image__ = __webpack_require__(153);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__text_design_asset_manager__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__models_randomizer__ = __webpack_require__(16);








var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_array_from___default()(arr); } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */












var TextDesignCelebrateSimple = function (_TextDesignCelebrate) {
  _inherits(TextDesignCelebrateSimple, _TextDesignCelebrate);

  function TextDesignCelebrateSimple() {
    var _ref;

    _classCallCheck(this, TextDesignCelebrateSimple);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = TextDesignCelebrateSimple.__proto__ || __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignCelebrateSimple)).call.apply(_ref, [this].concat(args)));

    _this.getImagePaths = function () {
      var banderoles = _this.getBanderoles();
      return [].concat(_toConsumableArray(banderoles && banderoles.map(function (b) {
        return b.getImagePath();
      }) || []), _toConsumableArray(_this._celebrateTypes));
    };

    _this.onImagesLoaded = function () {
      var banderoles = _this.getBanderoles();
      banderoles && banderoles.forEach(function (b) {
        var image = __WEBPACK_IMPORTED_MODULE_15__text_design_asset_manager__["a" /* AssetManager */].getImage(b.getImagePath());
        if (!image) {
          __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["Log"].warn('TextDesignBlocks#onImagesLoaded: Image not found \'' + b.getImagePath() + '\'');
          return;
        }

        b.setImage(image);
      });
    };

    _this._celebrateTypes = [__WEBPACK_IMPORTED_MODULE_14__models_rows_image_text_design_row_single_image__["a" /* TextDesignRowSingleImage */].RowImages.celebrate1, __WEBPACK_IMPORTED_MODULE_14__models_rows_image_text_design_row_single_image__["a" /* TextDesignRowSingleImage */].RowImages.celebrate2, __WEBPACK_IMPORTED_MODULE_14__models_rows_image_text_design_row_single_image__["a" /* TextDesignRowSingleImage */].RowImages.celebrate3];

    _this._exclusiveFont = null;

    _this._typeRandomizer = new __WEBPACK_IMPORTED_MODULE_16__models_randomizer__["a" /* Randomizer */](0);
    _this._useMaskedRandomizer = new __WEBPACK_IMPORTED_MODULE_16__models_randomizer__["a" /* Randomizer */](0);

    _this._seedPool.push(_this._typeRandomizer);
    _this._seedPool.push(_this._useMaskedRandomizer);
    return _this;
  }

  _createClass(TextDesignCelebrateSimple, [{
    key: '_fontForRow',
    value: function _fontForRow(index, words) {
      var fonts = this.getFontIdentifiers();
      return fonts[index % (fonts.length - 1)];
    }
  }, {
    key: '_layoutRows',
    value: function _layoutRows(lines, width) {
      var imagePath = this._typeRandomizer.pickNext(this._celebrateTypes);
      var image = __WEBPACK_IMPORTED_MODULE_15__text_design_asset_manager__["a" /* AssetManager */].getImage(imagePath);

      if (!image) {
        __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["Log"].warn('TextDesignCelebrateSimple#_layoutRows: Image not fount \'' + imagePath + '\'');
      }

      var firstRow = new __WEBPACK_IMPORTED_MODULE_14__models_rows_image_text_design_row_single_image__["a" /* TextDesignRowSingleImage */]({
        width: width,
        height: width * 0.5,
        drawingModeAspectFit: true,
        image: image
      }).layout();

      var rows = _get(TextDesignCelebrateSimple.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignCelebrateSimple.prototype), '_layoutRows', this).call(this, lines, width);

      return [firstRow].concat(_toConsumableArray(rows));
    }
  }, {
    key: '_randomLayoutRow',
    value: function _randomLayoutRow(words, index, width, attributes) {
      var numberOfCharacters = words.countNumberOfCharacters();

      var maximumNumberOfCharacters = 13;
      var minimumNumberOfCharacters = 4;

      if (numberOfCharacters < minimumNumberOfCharacters) {
        attributes.setFontIdentifier('imgly_font_rasa_regular');
      }

      var isMasked = this._useMaskedRandomizer.nextBool(2, 1);

      if (numberOfCharacters < maximumNumberOfCharacters && isMasked && !this.getHasMaskedText()) {
        return this._layoutRow(words, width, attributes, true);
      }

      return _get(TextDesignCelebrateSimple.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignCelebrateSimple.prototype), '_randomLayoutRow', this).call(this, words, index, width, attributes);
    }
  }]);

  return TextDesignCelebrateSimple;
}(__WEBPACK_IMPORTED_MODULE_13__text_design_celebrate__["a" /* TextDesignCelebrate */]);

TextDesignCelebrateSimple.identifier = 'imgly_text_design_celebrate_simple';
TextDesignCelebrateSimple.defaultFontIdentifiers = ['imgly_font_amberlight', 'imgly_font_rasa_regular', 'imgly_font_rasa_500'];
TextDesignCelebrateSimple.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_13__text_design_celebrate__["a" /* TextDesignCelebrate */].prototype.availableOptions, {
  fontIdentifiers: { type: __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["OptionType"].ARRAY, default: TextDesignCelebrateSimple.defaultFontIdentifiers }
});

/***/ }),
/* 363 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignEqualWidthBackground; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__text_design_background__ = __webpack_require__(155);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__text_design_asset_manager__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_canvas__ = __webpack_require__(34);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */






var Rectangle = __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Math"].Rectangle;


var TextDesignEqualWidthBackground = function (_TextDesignBackground) {
  _inherits(TextDesignEqualWidthBackground, _TextDesignBackground);

  function TextDesignEqualWidthBackground() {
    _classCallCheck(this, TextDesignEqualWidthBackground);

    return _possibleConstructorReturn(this, (TextDesignEqualWidthBackground.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignEqualWidthBackground)).apply(this, arguments));
  }

  _createClass(TextDesignEqualWidthBackground, [{
    key: 'getImagePaths',
    value: function getImagePaths() {
      var _options = this._options,
          topImagePath = _options.topImagePath,
          bottomImagePath = _options.bottomImagePath,
          leftImagePath = _options.leftImagePath,
          rightImagePath = _options.rightImagePath;


      return [topImagePath, bottomImagePath, leftImagePath, rightImagePath].filter(function (path) {
        return path !== '';
      });
    }
  }, {
    key: 'render',
    value: function render(context, size, relativeInsets, color, randomizer) {
      var absoluteInsets = relativeInsets.clone().scale(size.width);
      var frame = size.rectangle(0, 0);

      var topImage = __WEBPACK_IMPORTED_MODULE_6__text_design_asset_manager__["a" /* AssetManager */].getImage(this.getTopImagePath());
      var leftImage = __WEBPACK_IMPORTED_MODULE_6__text_design_asset_manager__["a" /* AssetManager */].getImage(this.getLeftImagePath());
      var rightImage = __WEBPACK_IMPORTED_MODULE_6__text_design_asset_manager__["a" /* AssetManager */].getImage(this.getRightImagePath());
      var bottomImage = __WEBPACK_IMPORTED_MODULE_6__text_design_asset_manager__["a" /* AssetManager */].getImage(this.getBottomImagePath());

      if (topImage) {
        var aspect = topImage.width / topImage.height;

        var destHeight = absoluteInsets.top * this.getTopImageFillRate();
        var destWidth = destHeight * aspect;

        var xCenter = frame.width / 2;
        var xOrigin = xCenter - destWidth / 2;

        var topFrame = new Rectangle(xOrigin, 0, destWidth, destHeight);

        Object(__WEBPACK_IMPORTED_MODULE_7__utils_canvas__["a" /* drawImageFrame */])(context, topImage, topFrame, color);
      }

      if (bottomImage) {
        var _aspect = bottomImage.width / bottomImage.height;

        var _destHeight = absoluteInsets.bottom * this.getBottomImageFillRate();
        var _destWidth = _destHeight * _aspect;

        var _xCenter = frame.width / 2;
        var _xOrigin = _xCenter - _destWidth / 2;

        var bottomFrame = new Rectangle(_xOrigin, frame.height - _destHeight, _destWidth, _destHeight);
        Object(__WEBPACK_IMPORTED_MODULE_7__utils_canvas__["a" /* drawImageFrame */])(context, bottomImage, bottomFrame, color);
      }

      if (leftImage) {
        var _aspect2 = leftImage.width / leftImage.height;

        var _destWidth2 = absoluteInsets.left * this.getLeftImageFillRate();
        var _destHeight2 = _destWidth2 / _aspect2;

        var yCenter = frame.height / 2;
        var yOrigin = yCenter - _destHeight2 / 2;

        var leftFrame = new Rectangle(0, yOrigin, _destWidth2, _destHeight2);
        Object(__WEBPACK_IMPORTED_MODULE_7__utils_canvas__["a" /* drawImageFrame */])(context, leftImage, leftFrame, color);
      }

      if (rightImage) {
        var _aspect3 = rightImage.width / rightImage.height;

        var _destWidth3 = absoluteInsets.right * this.getRightImageFillRate();
        var _destHeight3 = _destWidth3 / _aspect3;

        var _yCenter = frame.height / 2;
        var _yOrigin = _yCenter - _destHeight3 / 2;

        var rightFrame = new Rectangle(frame.width - _destWidth3, _yOrigin, _destWidth3, _destHeight3);
        Object(__WEBPACK_IMPORTED_MODULE_7__utils_canvas__["a" /* drawImageFrame */])(context, rightImage, rightFrame, color);
      }
    }
  }]);

  return TextDesignEqualWidthBackground;
}(__WEBPACK_IMPORTED_MODULE_5__text_design_background__["a" /* TextDesignBackground */]);

TextDesignEqualWidthBackground.prototype.availableOptions = {
  topImagePath: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].STRING, default: '' },
  leftImagePath: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].STRING, default: '' },
  bottomImagePath: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].STRING, default: '' },
  rightImagePath: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].STRING, default: '' },
  topImageFillRate: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 1 },
  leftImageFillRate: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 1 },
  bottomImageFillRate: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 1 },
  rightImageFillRate: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 1 }
};

TextDesignEqualWidthBackground.Backgrounds = [new TextDesignEqualWidthBackground({
  topImagePath: 'text-design/images/imgly_xib_image_text_design_equal_width_background1_1.png',
  leftImagePath: 'text-design/images/imgly_xib_image_text_design_equal_width_background1_2.png',
  rightImagePath: 'text-design/images/imgly_xib_image_text_design_equal_width_background1_2.png',
  bottomImagePath: 'text-design/images/imgly_xib_image_text_design_equal_width_background1_3.png',
  topImageFillRate: 0.8,
  leftImageFillRate: 0.6,
  rightImageFillRate: 0.6,
  bottomImageFillRate: 0.8
}), new TextDesignEqualWidthBackground({
  leftImagePath: 'text-design/images/imgly_xib_image_text_design_equal_width_background2_1.png',
  rightImagePath: 'text-design/images/imgly_xib_image_text_design_equal_width_background2_1.png',
  bottomImagePath: 'text-design/images/imgly_xib_image_text_design_equal_width_background2_2.png',
  leftImageFillRate: 0.6,
  rightImageFillRate: 0.6,
  bottomImageFillRate: 0.6
}), new TextDesignEqualWidthBackground({
  topImagePath: 'text-design/images/imgly_xib_image_text_design_equal_width_background3_1.png',
  bottomImagePath: 'text-design/images/imgly_xib_image_text_design_equal_width_background3_2.png',
  topImageFillRate: 0.6,
  bottomImageFillRate: 0.6
}), new TextDesignEqualWidthBackground({
  topImagePath: 'text-design/images/imgly_xib_image_text_design_equal_width_background4_1.png',
  leftImagePath: 'text-design/images/imgly_xib_image_text_design_equal_width_background4_3.png',
  rightImagePath: 'text-design/images/imgly_xib_image_text_design_equal_width_background4_3.png',
  bottomImagePath: 'text-design/images/imgly_xib_image_text_design_equal_width_background4_2.png',
  topImageFillRate: 0.1,
  leftImageFillRate: 0.6,
  rightImageFillRate: 0.6,
  bottomImageFillRate: 0.6
})];

/***/ }),
/* 364 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignEqualWidthFat; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__text_design_equal_width__ = __webpack_require__(154);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__models_rectangle_insets__ = __webpack_require__(17);






var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */





var TextDesignEqualWidthFat = function (_TextDesignEqualWidth) {
  _inherits(TextDesignEqualWidthFat, _TextDesignEqualWidth);

  function TextDesignEqualWidthFat() {
    var _ref;

    _classCallCheck(this, TextDesignEqualWidthFat);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = TextDesignEqualWidthFat.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignEqualWidthFat)).call.apply(_ref, [this].concat(args)));

    _this._relativeInsets = new __WEBPACK_IMPORTED_MODULE_7__models_rectangle_insets__["a" /* RectangleInsets */]();
    return _this;
  }

  _createClass(TextDesignEqualWidthFat, [{
    key: '_getBackground',
    value: function _getBackground() {
      return null;
    }
  }]);

  return TextDesignEqualWidthFat;
}(__WEBPACK_IMPORTED_MODULE_6__text_design_equal_width__["a" /* TextDesignEqualWidth */]);

TextDesignEqualWidthFat.defaultFontIdentifiers = ['imgly_font_ultra'];
TextDesignEqualWidthFat.identifier = 'imgly_text_design_equal_width_fat';
TextDesignEqualWidthFat.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_6__text_design_equal_width__["a" /* TextDesignEqualWidth */].prototype.availableOptions, {
  fontIdentifiers: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].ARRAY, default: TextDesignEqualWidthFat.defaultFontIdentifiers }
});

/***/ }),
/* 365 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignFontMultiline; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__text_design_asset_manager__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__text_text_splitter__ = __webpack_require__(151);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__models_size_value__ = __webpack_require__(23);







var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */





var Vector2 = __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Math"].Vector2;


var TextDesignFontMultiline = function (_Configurable) {
  _inherits(TextDesignFontMultiline, _Configurable);

  function TextDesignFontMultiline(options) {
    _classCallCheck(this, TextDesignFontMultiline);

    var _this = _possibleConstructorReturn(this, (TextDesignFontMultiline.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignFontMultiline)).call(this, options));

    _this._textOptions = {};
    _this._createCanvas();
    return _this;
  }

  /**
   * Creates the canvas and initializes the text splitter
   * @private
   */


  _createClass(TextDesignFontMultiline, [{
    key: '_createCanvas',
    value: function _createCanvas() {
      this._canvas = __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Utils"].createCanvas();
      this._context = this._canvas.getContext('2d');
      this._textSplitter = new __WEBPACK_IMPORTED_MODULE_8__text_text_splitter__["a" /* default */](this._context);

      this._finalCanvas = __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Utils"].createCanvas();
      this._finalContext = this._finalCanvas.getContext('2d');

      this.updateFontVariation();
    }
  }, {
    key: 'setOption',
    value: function setOption(optionName, value) {
      var update = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
      var initial = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;

      _get(TextDesignFontMultiline.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignFontMultiline.prototype), 'setOption', this).call(this, optionName, value, update, initial);

      if (optionName === 'fontIdentifier' && !initial) {
        this.updateFontVariation();
      }
    }

    /**
     * Updates the font variation for the current font identifier.
     *
     */

  }, {
    key: 'updateFontVariation',
    value: function updateFontVariation() {
      var fontVariation = __WEBPACK_IMPORTED_MODULE_7__text_design_asset_manager__["a" /* AssetManager */].getVariation(this.getFontIdentifier());
      if (!fontVariation) {
        __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Log"].warn('TextDesignFont: Unable to find font \'' + this._fontIdentifier + '\'');
      }

      this.setFontVariation(fontVariation);
      return fontVariation;
    }

    /**
     * Applies the text options on the given context
     * @param  {Object} textOptions
     * @param  {CanvasRenderingContext2D} context
     * @private
     */
    // _applyTextOptions (textOptions, context) {
    // context.font = this._text.getFontStyle() + ' ' + this._text.getFontWeight() + ' ' +
    //   textOptions.fontSize + 'px ' + '"' +
    //   this._text.getFontFamily() + '"'

    //   context.textBaseline = 'top'
    //   context.textAlign = this._text.getAlignment()
    //   context.fillStyle = this._text.getColor().toRGBA()

    //   context.strokeStyle = this._text.getOutlineColor().toRGBA()
    //   const outlineWidth = this._text.getOutlineWidth()
    //   if (outlineWidth > 0) {
    //     context.lineWidth = outlineWidth
    //   }
    // }

  }, {
    key: '_applyTextOptions',
    value: function _applyTextOptions() {
      var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var ctx = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this._context;

      var _options$options = _extends({}, this._options, options),
          fontSize = _options$options.fontSize,
          fontVariation = _options$options.fontVariation,
          lineHeight = _options$options.lineHeight,
          textColor = _options$options.textColor,
          alignment = _options$options.alignment;

      var _fontVariation$serial = fontVariation.serializeOptions(),
          fontStyle = _fontVariation$serial.fontStyle,
          fontWeight = _fontVariation$serial.fontWeight,
          fontFamily = _fontVariation$serial.fontFamily;

      ctx.font = fontStyle + ' ' + fontWeight + ' ' + fontSize + 'px ' + '"' + fontFamily + '"';

      ctx.fillStyle = textColor;
      ctx.textBaseline = 'top'; // textBaseline
      ctx.textAlign = alignment || 'left';
    }

    /**
     * Iterate over all lines and split them into multiple lines, depending
     * on the width they need
     * @param {Number} maxWidth
     * @return {Array.<string>}
     * @private
     */

  }, {
    key: '_buildOutputLines',
    value: function _buildOutputLines(maxWidth) {
      this._textSplitter.setText(this.getText());
      this._textSplitter.setMaxWidth(maxWidth);
      return this._textSplitter.getLines();
    }

    /**
     * Draws the given line onto context at the given Y position
     * @param  {String} text
     * @param  {Number} y
     * @private
     */

  }, {
    key: '_renderTextLine',
    value: function _renderTextLine(text, y) {
      var textAlignment = this.getAlignment();
      var drawPosition = new Vector2(0, y); // Left alignment

      switch (textAlignment) {
        case 'center':
          drawPosition.x = this._canvas.width / 2;
          break;
        case 'right':
          drawPosition.x = this._canvas.width;
          break;
      }

      this._context.fillText(text, drawPosition.x, drawPosition.y);
    }

    /**
     * Renders this sprite
     * @param  {PhotoEditorSDK} sdk
     * @param  {PhotoEditorSDK.Math.Vector2} inputDimensions
     */

  }, {
    key: 'update',
    value: function update() {
      var textOptions = this.calculateFontStyles();
      if (textOptions) {
        var _calculateText2 = this._calculateText(textOptions),
            dimensions = _calculateText2.dimensions,
            lines = _calculateText2.lines;

        this._dimensions = dimensions;
        this._renderText(dimensions, lines, textOptions);
      }
    }
  }, {
    key: 'draw',
    value: function draw(ctx) {
      var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
      var y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;

      this.update();

      ctx.drawImage(this._canvas, x, y, this._dimensions.x, this._dimensions.y);
    }

    // /**
    //  * Renders the rotated text on the final texture
    //  * @private
    //  */
    // _updateFinalTexture () {
    //   const { width, height } = this._canvas
    //   const rotation = this.rotation
    //   const cos = Math.cos(rotation)
    //   const sin = Math.sin(rotation)

    //   const finalDimensions = new Vector2(
    //     Math.abs(width * cos) + Math.abs(height * sin),
    //     Math.abs(width * sin) + Math.abs(height * cos)
    //   )

    //   this._finalCanvas.width = finalDimensions.x
    //   this._finalCanvas.height = finalDimensions.y

    //   this._finalContext.save()
    //   this._finalContext.translate(this._finalCanvas.width / 2, this._finalCanvas.height / 2)
    //   this._finalContext.rotate(rotation)
    //   this._finalContext.drawImage(this._canvas, -width / 2, -height / 2)
    //   this._finalContext.restore()
    // }

    /**
     * Renders the text
     * @param  {PhotoEditorSDK} sdk
     * @param  {Vector2} dimensions
     * @param  {Array.<String>} lines
     * @param  {Object} textOptions
     * @param  {PhotoEditorSDK.Math.Vector2} inputDimensions
     * @private
     */

  }, {
    key: '_renderText',
    value: function _renderText(dimensions, lines, textOptions) {
      // Resize the canvas

      this._canvas.width = dimensions.x;
      this._canvas.height = dimensions.y;

      // if (this._text.getMaxHeight()) {

      //   this._canvas.height = Math.min(
      //     this._text.getMaxHeight(),
      //     this._canvas.height
      //   )
      // }

      // Update the context
      this._context = this._canvas.getContext('2d');

      // Apply text options
      this._applyTextOptions(textOptions, this._context);

      // Draw lines
      for (var lineNum = 0; lineNum < lines.length; lineNum++) {
        var line = lines[lineNum];
        this._renderTextLine(line, textOptions.topPadding + textOptions.lineHeight * lineNum);
      }
    }
  }, {
    key: 'getFontFamily',
    value: function getFontFamily() {
      var variation = this.getFontVariation();
      return variation.getFontFamily();
    }

    /**
     * Calculates the actual font size and line height
     * @param  {PhotoEditorSDK} sdk
     * @param  {PhotoEditorSDK.Math.Vector2} inputDimensions
     */

  }, {
    key: 'calculateFontStyles',
    value: function calculateFontStyles() {
      var fontFamily = this.getFontFamily();
      var fontSize = this.getFontSize();
      var textHeight = this.getAbsoluteTextHeight();
      var lineHeight = textHeight * this.getLineHeight();
      var topPadding = textHeight * (this.getLineHeight() - 1.0) / 2.0;

      var textOptions = { fontFamily: fontFamily, fontSize: fontSize, textHeight: textHeight, lineHeight: lineHeight, topPadding: topPadding };
      this._textOptions = _extends({}, textOptions);
      // if (this._textOptions.fontFamily !== fontFamily ||
      //     this._textOptions.fontSize !== fontSize ||
      //     this._textOptions.lineHeight !== lineHeight) {
      //   this._textOptions = textOptions
      // }

      return textOptions;
    }
  }, {
    key: 'getTextMetrics',
    value: function getTextMetrics() {
      var variation = this.getFontVariation();
      return variation.getTextMetrics();
    }
  }, {
    key: 'getAbsoluteTextHeight',
    value: function getAbsoluteTextHeight() {
      var actualFontSize = this.getFontSize();
      var textMetrics = this.getTextMetrics();

      if (textMetrics) {
        // The text height for the current font size is calculated
        // using the given font metrics.
        var scale = 1 / textMetrics.unitsPerEm * actualFontSize;
        var ascent = textMetrics.ascender * scale;
        var descent = textMetrics.descender * scale;
        return ascent + Math.abs(descent);
      } else {
        return actualFontSize * this.getLineHeight() * 1.1;
      }
    }

    /**
     * Calculates the dimensions and new lines according to max width
     * @param  {PhotoEditorSDK} sdk
     * @param  {Object} textOptions
     * @param  {PhotoEditorSDK.Math.Vector2} inputDimensions
     * @return {Object}
     * @private
     */

  }, {
    key: '_calculateText',
    value: function _calculateText(textOptions) {
      // Calculate max width
      // let maxWidth = this.getMaxWidth()

      // Apply text options
      this._applyTextOptions(textOptions, this._context);

      // Calculate bounding box
      var dimensions = new Vector2();
      var lines = this.getText().split('\n');
      var maxWidth = void 0;
      if (typeof maxWidth !== 'undefined') {
        // Calculate the bounding box
        dimensions.x = maxWidth;
        lines = this._buildOutputLines(maxWidth);
      } else {
        for (var lineNum = 0; lineNum < lines.length; lineNum++) {
          var line = lines[lineNum];
          dimensions.x = Math.max(dimensions.x, this._context.measureText(line).width);
        }
      }

      // Calculate boundingbox height
      var lineHeight = textOptions.lineHeight;

      dimensions.y = lines.length * lineHeight;

      return { dimensions: dimensions, lines: lines };
    }

    /**
     * Returns the dimensions for this text
     * @param  {PhotoEditorSDK} sdk
     * @param  {PhotoEditorSDK.Math.Vector2} inputDimensions
     * @return {Vector2}
     */

  }, {
    key: 'getDimensions',
    value: function getDimensions() {
      var textOptions = this.calculateFontStyles();

      var _calculateText3 = this._calculateText(textOptions),
          dimensions = _calculateText3.dimensions;

      return dimensions;
    }
  }, {
    key: 'fitMaxHeight',
    value: function fitMaxHeight() {
      this.update();
      var dimensions = this.getDimensions();
      var lines = this.getText().split('\n');
      var scale = this.getMaxHeight() / dimensions.y;
    }
  }, {
    key: 'fitMaxWidth',
    value: function fitMaxWidth() {
      var width = this.getDimensions().x;
      var scale = this.getMaxWidth() / width;

      this.setFontSize(this.getFontSize() * scale);
      this._textOptions.fontSize = this.getFontSize();
    }
  }, {
    key: 'fitInFrame',
    value: function fitInFrame(frame) {
      this.setMaxWidth(frame.width);
      this.setMaxHeight(frame.height);

      this.fitMaxWidth();
      this.fitMaxHeight();
    }
  }, {
    key: 'getSize',
    value: function getSize() {
      var dimensions = this.getDimensions();
      return new __WEBPACK_IMPORTED_MODULE_9__models_size_value__["a" /* SizeValue */](dimensions.x, dimensions.y);
    }
  }]);

  return TextDesignFontMultiline;
}(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Configurable"]);

TextDesignFontMultiline.prototype.availableOptions = {
  text: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].STRING, default: '' },
  fontIdentifier: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].STRING, default: 'imgly_font_open_sans_bold' },
  fontVariation: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].OBJECT, default: null },
  lineHeight: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].NUMBER, default: 1 },
  fontSize: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].NUMBER, default: 22 },
  textColor: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].STRING, default: 'black' },
  strokeStyle: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].STRING, default: 'black' },
  outlineWidth: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].NUMBER, default: 0 },
  textBaseline: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].STRING, default: 'alphabetic' },
  excludeAccents: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].BOOLEAN, default: true },
  maxWidth: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].NUMBER, default: 100 },
  maxHeight: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].NUMBER, default: 0 },
  alignment: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].STRING, default: 'left', available: ['left', 'center', 'right'] }
};

/***/ }),
/* 366 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignMaskedBadge; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__models_masked_row_type__ = __webpack_require__(61);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__text_design_masked__ = __webpack_require__(44);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__models_randomizer__ = __webpack_require__(16);







var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */






var TextDesignMaskedBadge = function (_TextDesignMasked) {
  _inherits(TextDesignMaskedBadge, _TextDesignMasked);

  function TextDesignMaskedBadge() {
    var _ref;

    _classCallCheck(this, TextDesignMaskedBadge);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = TextDesignMaskedBadge.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignMaskedBadge)).call.apply(_ref, [this].concat(args)));

    _this._possibleRowTypes = [__WEBPACK_IMPORTED_MODULE_7__models_masked_row_type__["a" /* RowType */].Badge1, __WEBPACK_IMPORTED_MODULE_7__models_masked_row_type__["a" /* RowType */].Badge2, __WEBPACK_IMPORTED_MODULE_7__models_masked_row_type__["a" /* RowType */].Badge3, __WEBPACK_IMPORTED_MODULE_7__models_masked_row_type__["a" /* RowType */].Badge4];

    _this._rowTypesRandomizer = new __WEBPACK_IMPORTED_MODULE_9__models_randomizer__["a" /* Randomizer */](0);
    _this._isMaskedRandomizer = new __WEBPACK_IMPORTED_MODULE_9__models_randomizer__["a" /* Randomizer */](0);

    _this._seedPool.push(_this._rowTypesRandomizer);
    _this._seedPool.push(_this._isMaskedRandomizer);
    return _this;
  }

  _createClass(TextDesignMaskedBadge, [{
    key: 'getImagePaths',
    value: function getImagePaths() {
      return this._possibleRowTypes.map(function (rowType) {
        return rowType.getImagePath();
      });
    }
  }, {
    key: '_randomLayoutRow',
    value: function _randomLayoutRow(words, index, width, attributes) {
      this._rowType = this._rowTypesRandomizer.pickNext(this._possibleRowTypes);

      attributes.setLineSpacing(0.9);

      var row = _get(TextDesignMaskedBadge.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignMaskedBadge.prototype), '_randomLayoutRow', this).call(this, words, index, width, attributes);

      row.set({ textScaleFactor: 0.9 });

      return row;
    }
  }]);

  return TextDesignMaskedBadge;
}(__WEBPACK_IMPORTED_MODULE_8__text_design_masked__["a" /* TextDesignMasked */]);

TextDesignMaskedBadge.defaultFontIdentifiers = ['imgly_font_campton_bold'];
TextDesignMaskedBadge.identifier = 'imgly_text_design_masked_badge';
TextDesignMaskedBadge.ValidAlignments = [__WEBPACK_IMPORTED_MODULE_8__text_design_masked__["a" /* TextDesignMasked */].Alignment.Center];
TextDesignMaskedBadge.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_8__text_design_masked__["a" /* TextDesignMasked */].prototype.availableOptions, {
  fontIdentifiers: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].ARRAY, default: TextDesignMaskedBadge.defaultFontIdentifiers }
});

/***/ }),
/* 367 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignMaskedSpeechBubbleComic; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__models_masked_row_type__ = __webpack_require__(61);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__text_design_masked__ = __webpack_require__(44);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__text_design_masked_speech_bubble__ = __webpack_require__(107);






var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */






// TODO: Config fonts

var TextDesignMaskedSpeechBubbleComic = function (_TextDesignMaskedSpee) {
  _inherits(TextDesignMaskedSpeechBubbleComic, _TextDesignMaskedSpee);

  function TextDesignMaskedSpeechBubbleComic() {
    var _ref;

    _classCallCheck(this, TextDesignMaskedSpeechBubbleComic);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = TextDesignMaskedSpeechBubbleComic.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignMaskedSpeechBubbleComic)).call.apply(_ref, [this].concat(args)));

    _this._possibleRowTypes = [__WEBPACK_IMPORTED_MODULE_6__models_masked_row_type__["a" /* RowType */].SpeechBubble2, __WEBPACK_IMPORTED_MODULE_6__models_masked_row_type__["a" /* RowType */].SpeechBubble4, __WEBPACK_IMPORTED_MODULE_6__models_masked_row_type__["a" /* RowType */].SpeechBubble2, __WEBPACK_IMPORTED_MODULE_6__models_masked_row_type__["a" /* RowType */].SpeechBubble4, __WEBPACK_IMPORTED_MODULE_6__models_masked_row_type__["a" /* RowType */].SpeechBubble5];

    _this._possibleRowTypesForMin15 = _this._possibleRowTypes.slice(0, 2);
    _this._possibleRowTypesForMax14 = _this._possibleRowTypes.slice(2);
    return _this;
  }

  _createClass(TextDesignMaskedSpeechBubbleComic, [{
    key: '_rowTypes',
    value: function _rowTypes(words) {
      return words.countNumberOfCharacters() < 15 ? this._possibleRowTypesForMax14 : this._possibleRowTypesForMin15;
    }
  }]);

  return TextDesignMaskedSpeechBubbleComic;
}(__WEBPACK_IMPORTED_MODULE_8__text_design_masked_speech_bubble__["a" /* TextDesignMaskedSpeechBubble */]);

TextDesignMaskedSpeechBubbleComic.defaultFontIdentifiers = ['imgly_font_gagalin_regular'];
TextDesignMaskedSpeechBubbleComic.identifier = 'imgly_text_design_masked_speech_bubble_comic';
TextDesignMaskedSpeechBubbleComic.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_8__text_design_masked_speech_bubble__["a" /* TextDesignMaskedSpeechBubble */].prototype.availableOptions, {
  fontIdentifiers: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].ARRAY, default: TextDesignMaskedSpeechBubbleComic.defaultFontIdentifiers }
});

/***/ }),
/* 368 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignMultiline; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__text_design_masked__ = __webpack_require__(44);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__models_rows_masked_text_design_row_multiline__ = __webpack_require__(106);







var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */





var TextDesignMultiline = function (_TextDesignMasked) {
  _inherits(TextDesignMultiline, _TextDesignMasked);

  function TextDesignMultiline() {
    _classCallCheck(this, TextDesignMultiline);

    return _possibleConstructorReturn(this, (TextDesignMultiline.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignMultiline)).apply(this, arguments));
  }

  _createClass(TextDesignMultiline, [{
    key: '_modifiedText',
    value: function _modifiedText(text) {
      return _get(TextDesignMultiline.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignMultiline.prototype), '_modifiedText', this).call(this, text).toUpperCase();
    }
  }, {
    key: '_randomLayoutRow',
    value: function _randomLayoutRow(words, index, width, attributes) {
      var alignment = this._alignmentRandomizer.pickNext(__WEBPACK_IMPORTED_MODULE_7__text_design_masked__["a" /* TextDesignMasked */].ValidAlignments);

      attributes.setAlignment(alignment);

      return new __WEBPACK_IMPORTED_MODULE_8__models_rows_masked_text_design_row_multiline__["a" /* TextDesignRowMultiline */]({
        words: words,
        width: width,
        attributes: attributes,
        image: null,
        backgroundColor: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Color"].WHITE,
        centerOffset: 0,
        sizeToFitContent: true,
        isMasked: false,
        autoAdjustTextColor: false
      });
    }
  }]);

  return TextDesignMultiline;
}(__WEBPACK_IMPORTED_MODULE_7__text_design_masked__["a" /* TextDesignMasked */]);

TextDesignMultiline.defaultFontIdentifiers = ['imgly_font_abril_fatface_regular'];
TextDesignMultiline.identifier = 'imgly_text_design_multiline';
TextDesignMultiline.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_7__text_design_masked__["a" /* TextDesignMasked */].prototype.availableOptions, {
  fontIdentifiers: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].ARRAY, default: TextDesignMultiline.defaultFontIdentifiers }
});

/***/ }),
/* 369 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignWatercolor; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__models_masked_row_type__ = __webpack_require__(61);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__text_design_masked__ = __webpack_require__(44);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__text_design_masked_speech_bubble__ = __webpack_require__(107);





var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */






// TODO: Config fonts

var TextDesignWatercolor = function (_TextDesignMaskedSpee) {
  _inherits(TextDesignWatercolor, _TextDesignMaskedSpee);

  function TextDesignWatercolor() {
    var _ref;

    _classCallCheck(this, TextDesignWatercolor);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = TextDesignWatercolor.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignWatercolor)).call.apply(_ref, [this].concat(args)));

    _this._possibleRowTypes = [__WEBPACK_IMPORTED_MODULE_5__models_masked_row_type__["a" /* RowType */].Watercolor1, __WEBPACK_IMPORTED_MODULE_5__models_masked_row_type__["a" /* RowType */].Watercolor2, __WEBPACK_IMPORTED_MODULE_5__models_masked_row_type__["a" /* RowType */].Watercolor3];
    return _this;
  }

  return TextDesignWatercolor;
}(__WEBPACK_IMPORTED_MODULE_7__text_design_masked_speech_bubble__["a" /* TextDesignMaskedSpeechBubble */]);

TextDesignWatercolor.defaultFontIdentifiers = ['imgly_font_hello_sunshine_marker', 'imgly_font_hello_sunshine', 'imgly_font_hello_sunshine_italic'];
TextDesignWatercolor.identifier = 'imgly_text_design_watercolor';
TextDesignWatercolor.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_7__text_design_masked_speech_bubble__["a" /* TextDesignMaskedSpeechBubble */].prototype.availableOptions, {
  fontIdentifiers: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].ARRAY, default: TextDesignWatercolor.defaultFontIdentifiers },
  alignment: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].STRING, default: __WEBPACK_IMPORTED_MODULE_6__text_design_masked__["a" /* TextDesignMasked */].Alignment.Center, available: __WEBPACK_IMPORTED_MODULE_6__text_design_masked__["a" /* TextDesignMasked */].ValidAlignments }
});

/***/ }),
/* 370 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignParticles; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_array_from__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_array_from___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_array_from__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__text_design_asset_manager__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__models_rectangle_insets__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__text_design_sunshine__ = __webpack_require__(156);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__models_background_text_design_particles_background_brush__ = __webpack_require__(371);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__models_background_text_design_particles_background_circle__ = __webpack_require__(373);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__models_background_text_design_particles_background_triangle__ = __webpack_require__(374);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__models_randomizer__ = __webpack_require__(16);







var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_array_from___default()(arr); } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */









var TextDesignParticles = function (_TextDesignSunshine) {
  _inherits(TextDesignParticles, _TextDesignSunshine);

  function TextDesignParticles() {
    var _ref;

    _classCallCheck(this, TextDesignParticles);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = TextDesignParticles.__proto__ || __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignParticles)).call.apply(_ref, [this].concat(args)));

    _this._relativeInsets = new __WEBPACK_IMPORTED_MODULE_8__models_rectangle_insets__["a" /* RectangleInsets */](0.3, 0.3, 0.3, 0.3);

    _this._backgroundRandomizer = new __WEBPACK_IMPORTED_MODULE_13__models_randomizer__["a" /* Randomizer */](0);
    _this._decoTypeRandomizer = new __WEBPACK_IMPORTED_MODULE_13__models_randomizer__["a" /* Randomizer */](0);

    _this._seedPool.push(_this._backgroundRandomizer);
    _this._seedPool.push(_this._decoTypeRandomizer);
    return _this;
  }

  _createClass(TextDesignParticles, [{
    key: 'getImagePaths',
    value: function getImagePaths() {
      return [].concat(_toConsumableArray(__WEBPACK_IMPORTED_MODULE_9__text_design_sunshine__["a" /* TextDesignSunshine */].RowImages), _toConsumableArray(__WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Utils"].Array.flatten(TextDesignParticles.Backgrounds.map(function (b) {
        return b.getImagePaths();
      }))), _toConsumableArray(TextDesignParticles.DecoratorImages));
    }
  }, {
    key: '_getBackground',
    value: function _getBackground() {
      return this._backgroundRandomizer.pickNext(TextDesignParticles.Backgrounds);
    }
  }, {
    key: '_randomDecoratorImages',
    value: function _randomDecoratorImages() {
      switch (this._decoTypeRandomizer.nextInRange(0, 2)) {
        case 0:
          return TextDesignParticles.DecoratorImages.slice(0, 2).map(function (path) {
            return __WEBPACK_IMPORTED_MODULE_7__text_design_asset_manager__["a" /* AssetManager */].getImage(path);
          });

        case 1:
        case 2:
          return TextDesignParticles.DecoratorImages.slice(2).map(function (path) {
            return __WEBPACK_IMPORTED_MODULE_7__text_design_asset_manager__["a" /* AssetManager */].getImage(path);
          });

        default:
          __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["Log"].warn('TextDesignParticles#_randomDecoratorImages: Number generated not in valid range.');
          return TextDesignParticles.DecoratorImages.slice(2).map(function (path) {
            return __WEBPACK_IMPORTED_MODULE_7__text_design_asset_manager__["a" /* AssetManager */].getImage(path);
          });
      }
    }
  }]);

  return TextDesignParticles;
}(__WEBPACK_IMPORTED_MODULE_9__text_design_sunshine__["a" /* TextDesignSunshine */]);

TextDesignParticles.defaultFontIdentifiers = ['imgly_font_hello_sunshine_marker', 'imgly_font_hello_sunshine', 'imgly_font_hello_sunshine_italic', 'imgly_font_montserrat_light'];
TextDesignParticles.identifier = 'imgly_text_design_particles';
TextDesignParticles.Backgrounds = [new __WEBPACK_IMPORTED_MODULE_10__models_background_text_design_particles_background_brush__["a" /* TextDesignParticlesBackgroundBrush */](), new __WEBPACK_IMPORTED_MODULE_11__models_background_text_design_particles_background_circle__["a" /* TextDesignParticlesBackgroundCircle */](), new __WEBPACK_IMPORTED_MODULE_12__models_background_text_design_particles_background_triangle__["a" /* TextDesignParticlesBackgroundTriangle */]()];
TextDesignParticles.DecoratorImages = ['text-design/images/imgly_text_design_particle_holder_01.png', 'text-design/images/imgly_text_design_particle_holder_02.png', 'text-design/images/imgly_text_design_particle_holder_03.png', 'text-design/images/imgly_text_design_particle_holder_04.png'];
TextDesignParticles.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_9__text_design_sunshine__["a" /* TextDesignSunshine */].prototype.availableOptions, {
  fontIdentifiers: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].ARRAY, default: TextDesignParticles.defaultFontIdentifiers },
  decorationsVisible: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].BOOLEAN, default: false },
  decorativeRowsInTheMiddleOnly: { type: __WEBPACK_IMPORTED_MODULE_6_photoeditorsdk_core__["OptionType"].BOOLEAN, default: true }
});

/***/ }),
/* 371 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignParticlesBackgroundBrush; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__text_design_particles_background__ = __webpack_require__(108);






var _extends = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from___default()(arr); } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var TextDesignParticlesBackgroundBrush = function (_TextDesignParticlesB) {
  _inherits(TextDesignParticlesBackgroundBrush, _TextDesignParticlesB);

  function TextDesignParticlesBackgroundBrush() {
    _classCallCheck(this, TextDesignParticlesBackgroundBrush);

    return _possibleConstructorReturn(this, (TextDesignParticlesBackgroundBrush.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignParticlesBackgroundBrush)).apply(this, arguments));
  }

  return TextDesignParticlesBackgroundBrush;
}(__WEBPACK_IMPORTED_MODULE_6__text_design_particles_background__["a" /* TextDesignParticlesBackground */]);

TextDesignParticlesBackgroundBrush.Images = ['text-design/images/imgly_text_design_particle_brush_01.png', 'text-design/images/imgly_text_design_particle_brush_02.png', 'text-design/images/imgly_text_design_particle_brush_03.png', 'text-design/images/imgly_text_design_particle_brush_04.png', 'text-design/images/imgly_text_design_particle_brush_05.png', 'text-design/images/imgly_text_design_particle_brush_06.png', 'text-design/images/imgly_text_design_particle_brush_07.png', 'text-design/images/imgly_text_design_particle_brush_08.png', 'text-design/images/imgly_text_design_particle_brush_09.png', 'text-design/images/imgly_text_design_particle_brush_10.png'];
TextDesignParticlesBackgroundBrush.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_6__text_design_particles_background__["a" /* TextDesignParticlesBackground */].prototype.availableOptions, {
  imagePaths: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].ARRAY, default: [].concat(_toConsumableArray(TextDesignParticlesBackgroundBrush.Images)) },
  relativeParticleSize: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.12 }
});

/***/ }),
/* 372 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignParticle; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



var Rectangle = __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Math"].Rectangle;


var TextDesignParticle = function (_Configurable) {
  _inherits(TextDesignParticle, _Configurable);

  function TextDesignParticle() {
    _classCallCheck(this, TextDesignParticle);

    return _possibleConstructorReturn(this, (TextDesignParticle.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignParticle)).apply(this, arguments));
  }

  _createClass(TextDesignParticle, [{
    key: 'getContentFrame',
    value: function getContentFrame() {
      var frame = this.getFrame().clone();
      var inset = frame.width * 0.1;

      return frame.insetBy(inset, inset);
    }
  }, {
    key: 'intersects',
    value: function intersects(particle) {
      return this.getFrame().intersects(particle.getFrame());
    }
  }]);

  return TextDesignParticle;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Configurable"]);

TextDesignParticle.prototype.availableOptions = {
  frame: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].OBJECT, default: new Rectangle() }
};

/***/ }),
/* 373 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignParticlesBackgroundCircle; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__text_design_particles_background__ = __webpack_require__(108);






var _extends = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from___default()(arr); } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var TextDesignParticlesBackgroundCircle = function (_TextDesignParticlesB) {
  _inherits(TextDesignParticlesBackgroundCircle, _TextDesignParticlesB);

  function TextDesignParticlesBackgroundCircle() {
    _classCallCheck(this, TextDesignParticlesBackgroundCircle);

    return _possibleConstructorReturn(this, (TextDesignParticlesBackgroundCircle.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignParticlesBackgroundCircle)).apply(this, arguments));
  }

  return TextDesignParticlesBackgroundCircle;
}(__WEBPACK_IMPORTED_MODULE_6__text_design_particles_background__["a" /* TextDesignParticlesBackground */]);

TextDesignParticlesBackgroundCircle.Images = ['text-design/images/imgly_text_design_particle_circle_01.png', 'text-design/images/imgly_text_design_particle_circle_02.png', 'text-design/images/imgly_text_design_particle_circle_03.png', 'text-design/images/imgly_text_design_particle_circle_04.png', 'text-design/images/imgly_text_design_particle_circle_05.png', 'text-design/images/imgly_text_design_particle_circle_06.png', 'text-design/images/imgly_text_design_particle_circle_07.png', 'text-design/images/imgly_text_design_particle_circle_08.png', 'text-design/images/imgly_text_design_particle_circle_09.png', 'text-design/images/imgly_text_design_particle_circle_10.png'];
TextDesignParticlesBackgroundCircle.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_6__text_design_particles_background__["a" /* TextDesignParticlesBackground */].prototype.availableOptions, {
  imagePaths: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].ARRAY, default: [].concat(_toConsumableArray(TextDesignParticlesBackgroundCircle.Images)) },
  relativeParticleSize: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.12 }
});

/***/ }),
/* 374 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignParticlesBackgroundTriangle; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__text_design_particles_background__ = __webpack_require__(108);






var _extends = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_array_from___default()(arr); } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */




var TextDesignParticlesBackgroundTriangle = function (_TextDesignParticlesB) {
  _inherits(TextDesignParticlesBackgroundTriangle, _TextDesignParticlesB);

  function TextDesignParticlesBackgroundTriangle() {
    _classCallCheck(this, TextDesignParticlesBackgroundTriangle);

    return _possibleConstructorReturn(this, (TextDesignParticlesBackgroundTriangle.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignParticlesBackgroundTriangle)).apply(this, arguments));
  }

  return TextDesignParticlesBackgroundTriangle;
}(__WEBPACK_IMPORTED_MODULE_6__text_design_particles_background__["a" /* TextDesignParticlesBackground */]);

TextDesignParticlesBackgroundTriangle.Images = ['text-design/images/imgly_text_design_particle_triangle_01.png', 'text-design/images/imgly_text_design_particle_triangle_02.png', 'text-design/images/imgly_text_design_particle_triangle_03.png', 'text-design/images/imgly_text_design_particle_triangle_04.png', 'text-design/images/imgly_text_design_particle_triangle_05.png', 'text-design/images/imgly_text_design_particle_triangle_06.png', 'text-design/images/imgly_text_design_particle_triangle_07.png', 'text-design/images/imgly_text_design_particle_triangle_08.png', 'text-design/images/imgly_text_design_particle_triangle_09.png', 'text-design/images/imgly_text_design_particle_triangle_10.png'];
TextDesignParticlesBackgroundTriangle.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_6__text_design_particles_background__["a" /* TextDesignParticlesBackground */].prototype.availableOptions, {
  imagePaths: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].ARRAY, default: [].concat(_toConsumableArray(TextDesignParticlesBackgroundTriangle.Images)) }
});

/***/ }),
/* 375 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignRotated; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_array_from__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_array_from___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_array_from__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__text_design__ = __webpack_require__(58);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__models_rectangle_insets__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__models_rows_shearing_text_design_row_form__ = __webpack_require__(376);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__models_randomizer__ = __webpack_require__(16);








var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_array_from___default()(arr); } }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_5_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */






var TextDesignRotated = function (_TextDesign) {
  _inherits(TextDesignRotated, _TextDesign);

  function TextDesignRotated() {
    var _ref;

    _classCallCheck(this, TextDesignRotated);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = TextDesignRotated.__proto__ || __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignRotated)).call.apply(_ref, [this].concat(args)));

    _this._relativeInsets = new __WEBPACK_IMPORTED_MODULE_9__models_rectangle_insets__["a" /* RectangleInsets */](0.1, 0, 0, 0);

    _this._rowTypeRandomizer = new __WEBPACK_IMPORTED_MODULE_11__models_randomizer__["a" /* Randomizer */](0);

    _this._seedPool.push(_this._rowTypeRandomizer);
    return _this;
  }

  _createClass(TextDesignRotated, [{
    key: '_modifiedText',
    value: function _modifiedText(text) {
      return _get(TextDesignRotated.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignRotated.prototype), '_modifiedText', this).call(this, text).toUpperCase();
    }
  }, {
    key: '_randomLayoutRow',
    value: function _randomLayoutRow(words, index, width, attributes) {
      var row = _get(TextDesignRotated.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignRotated.prototype), '_randomLayoutRow', this).call(this, words, index, width, attributes);
      row.setShearingAngle(this.getShearingAngle());
      return row;
    }
  }, {
    key: '_layoutRows',
    value: function _layoutRows(lines, width) {
      var elements = _get(TextDesignRotated.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_6_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignRotated.prototype), '_layoutRows', this).call(this, lines, width);
      var types = __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["Utils"].values(__WEBPACK_IMPORTED_MODULE_10__models_rows_shearing_text_design_row_form__["a" /* TextDesignRowForm */].FormType);

      var formHeight = 30;

      var firstRow = new __WEBPACK_IMPORTED_MODULE_10__models_rows_shearing_text_design_row_form__["a" /* TextDesignRowForm */]({
        width: width,
        height: formHeight,
        type: this._rowTypeRandomizer.pickNext(types),
        shearingAngle: this.getShearingAngle()
      }).layout();

      var lastRow = new __WEBPACK_IMPORTED_MODULE_10__models_rows_shearing_text_design_row_form__["a" /* TextDesignRowForm */]({
        width: width,
        height: formHeight,
        type: this._rowTypeRandomizer.pickNext(types),
        shearingAngle: this.getShearingAngle()
      }).layout();

      return [firstRow].concat(_toConsumableArray(elements), [lastRow]);
    }
  }]);

  return TextDesignRotated;
}(__WEBPACK_IMPORTED_MODULE_8__text_design__["a" /* TextDesign */]);

TextDesignRotated.defaultFontIdentifiers = ['imgly_font_campton_bold'];
TextDesignRotated.identifier = 'imgly_text_design_rotated';
TextDesignRotated.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_8__text_design__["a" /* TextDesign */].prototype.availableOptions, {
  fontIdentifiers: { type: __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["OptionType"].ARRAY, default: TextDesignRotated.defaultFontIdentifiers },
  relativeLineSpacing: { type: __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["OptionType"].NUMBER, default: 0.025 / 3 },
  shearingAngle: { type: __WEBPACK_IMPORTED_MODULE_7_photoeditorsdk_core__["OptionType"].NUMBER, default: -0.1 }
});

/***/ }),
/* 376 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignRowForm; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__text_design_element__ = __webpack_require__(43);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__default_text_design_row__ = __webpack_require__(59);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__size_value__ = __webpack_require__(23);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils_canvas__ = __webpack_require__(34);






var _extends = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default.a || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */







var Rectangle = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Math"].Rectangle;


var TextDesignRowForm = function (_TextDesignRow) {
  _inherits(TextDesignRowForm, _TextDesignRow);

  function TextDesignRowForm() {
    var _ref;

    _classCallCheck(this, TextDesignRowForm);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = TextDesignRowForm.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(TextDesignRowForm)).call.apply(_ref, [this].concat(args)));

    _this.setSize(new __WEBPACK_IMPORTED_MODULE_8__size_value__["a" /* SizeValue */](_this.getWidth(), _this.getHeight()));
    return _this;
  }

  _createClass(TextDesignRowForm, [{
    key: '_calculateLayoutElements',
    value: function _calculateLayoutElements() {
      return [new __WEBPACK_IMPORTED_MODULE_6__text_design_element__["a" /* TextDesignElement */]({ frame: this._getTextFrame() })];
    }
  }, {
    key: 'render',
    value: function render(context) {
      var frame = this._getFrame();
      var type = this.getType();
      var attributes = this.getAttributes();
      var color = attributes.getTextColor();

      var rectHeight = frame.height / 3;
      var firstRect = new Rectangle(frame.x, frame.y, frame.width, rectHeight);
      var secondRect = new Rectangle(frame.x, frame.y + rectHeight * 2, frame.width, rectHeight);

      switch (type) {
        case TextDesignRowForm.FormType.Rect:
          Object(__WEBPACK_IMPORTED_MODULE_9__utils_canvas__["c" /* fillRect */])(context, frame, color);
          break;

        case TextDesignRowForm.FormType.DoubleRect:
          Object(__WEBPACK_IMPORTED_MODULE_9__utils_canvas__["c" /* fillRect */])(context, firstRect, color);
          Object(__WEBPACK_IMPORTED_MODULE_9__utils_canvas__["c" /* fillRect */])(context, secondRect, color);
          break;

        case TextDesignRowForm.FormType.DoubleRectFirstPunctuated:
          Object(__WEBPACK_IMPORTED_MODULE_9__utils_canvas__["d" /* fillRectPunctuated */])(context, firstRect, color);
          Object(__WEBPACK_IMPORTED_MODULE_9__utils_canvas__["c" /* fillRect */])(context, secondRect, color);
          break;

        case TextDesignRowForm.FormType.DoubleRectSecondPunctuated:
          Object(__WEBPACK_IMPORTED_MODULE_9__utils_canvas__["c" /* fillRect */])(context, firstRect, color);
          Object(__WEBPACK_IMPORTED_MODULE_9__utils_canvas__["d" /* fillRectPunctuated */])(context, secondRect, color);
          break;

        default:
          break;
      }
    }
  }]);

  return TextDesignRowForm;
}(__WEBPACK_IMPORTED_MODULE_7__default_text_design_row__["a" /* TextDesignRow */]);

TextDesignRowForm.FormType = {
  Rect: 'RECT',
  DoubleRect: 'DOUBLE_RECT',
  DoubleRectFirstPunctuated: 'DOUBLE_RECT_FIRST_PUNCTUATED',
  DoubleRectSecondPunctuated: 'DOUBLE_RECT_SECOND_PUNCTUATED'
};
TextDesignRowForm.prototype.availableOptions = _extends({}, __WEBPACK_IMPORTED_MODULE_7__default_text_design_row__["a" /* TextDesignRow */].prototype.availableOptions, {
  height: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].NUMBER, default: 100 },
  type: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].STRING, default: TextDesignRowForm.FormType.Rect, available: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].values(TextDesignRowForm.FormType) }
});

/***/ }),
/* 377 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextDesignRenderer; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__models_size_value__ = __webpack_require__(23);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__models_rows_masked_text_design_row_masked__ = __webpack_require__(104);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils_canvas__ = __webpack_require__(34);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__models_randomizer__ = __webpack_require__(16);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__models_rows_masked_text_design_row_multiline__ = __webpack_require__(106);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */








var Rectangle = __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__["Math"].Rectangle;


var REFERENCE_WIDTH = 1000;

var TextDesignRenderer = function () {
  function TextDesignRenderer() {
    _classCallCheck(this, TextDesignRenderer);

    this._layoutData = null;
    this._layout = null;
    this._text = '';
    this._seed = 0;
    this._debugMode = false;
    this.randomizer = new __WEBPACK_IMPORTED_MODULE_5__models_randomizer__["a" /* Randomizer */]();
  }

  _createClass(TextDesignRenderer, [{
    key: 'createLayout',
    value: function createLayout(layout, text, seed) {
      this._layout = layout;
      this._text = text;

      this._seed = seed;
      layout.seed(seed);

      this._layoutData = layout.generateLayoutData(text, REFERENCE_WIDTH);
    }
  }, {
    key: 'calculateAspect',
    value: function calculateAspect() {
      if (!this._layoutData) {
        __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__["Log"].warn('TextDesignRenderer#calculateAspect: No layout data');
        return 1;
      }

      return this._layoutData.getSize().aspect();
    }
  }, {
    key: 'draw',
    value: function draw(context, destinationSize, color, isInverted) {
      var _this = this;

      // The layout is calculated width `renderSize` width
      var renderSize = new __WEBPACK_IMPORTED_MODULE_2__models_size_value__["a" /* SizeValue */](REFERENCE_WIDTH, REFERENCE_WIDTH / destinationSize.aspect());

      // Used to scale from renderSize to destinationSize
      var scale = destinationSize.width / REFERENCE_WIDTH;

      // Get insets and line spacing in renderSize scale
      var insets = this._layoutData.getRelativeInsets().clone().scale(renderSize.width);
      var lineSpacing = this._layoutData.getRelativeLineSpacing() * renderSize.width;

      // Start from the top inset limit
      var yOrigin = insets.top;

      context.save();

      this.randomizer.seed(this._seed);

      var background = this._layoutData.getBackground();
      if (background) {
        background.render(context, destinationSize, this._layoutData.getRelativeInsets(), isInverted ? __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__["Color"].WHITE : color, this.randomizer);
      }

      // Scale to destinationSize
      context.scale(scale, scale);

      // Go trough each layout row
      this._layoutData.getRows().forEach(function (row) {
        context.save();

        var attributes = row.getAttributes();

        // Apply row transform (skew + positioning)
        context.transform(1, row.getShearingAngle(), 0, 1, insets.left, yOrigin);

        attributes.setTextColor(isInverted ? __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__["Color"].WHITE : color.clone());
        attributes.setTintColor(isInverted ? __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__["Color"].WHITE : color.clone());

        if (row instanceof __WEBPACK_IMPORTED_MODULE_3__models_rows_masked_text_design_row_masked__["a" /* TextDesignRowMasked */] || row instanceof __WEBPACK_IMPORTED_MODULE_6__models_rows_masked_text_design_row_multiline__["a" /* TextDesignRowMultiline */]) {
          row.setBackgroundColor(isInverted ? __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__["Color"].WHITE : color.clone());
          row.setIsUsedInInvertedLayout(isInverted);
        }

        if (_this._debugMode) {
          row._debugMode = true;
        }

        // Render the row
        row.willRender(context);
        row.render(context);
        row.didRender(context);

        if (_this._debugMode) {
          var frame = row._getFrame();
          var textFrame = row._getTextFrame();

          Object(__WEBPACK_IMPORTED_MODULE_4__utils_canvas__["e" /* strokeRect */])(context, frame, __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__["Color"].GREEN);
          Object(__WEBPACK_IMPORTED_MODULE_4__utils_canvas__["e" /* strokeRect */])(context, textFrame, __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__["Color"].BLUE);

          row._getLayoutElements().forEach(function (element) {
            var frame = element.getFrame();
            var textFrame = row._getTextFrameForElement(element);

            Object(__WEBPACK_IMPORTED_MODULE_4__utils_canvas__["e" /* strokeRect */])(context, frame, new __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__["Color"](1, 1, 0));
            Object(__WEBPACK_IMPORTED_MODULE_4__utils_canvas__["e" /* strokeRect */])(context, textFrame, new __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__["Color"](0, 1, 1));
          });
        }

        // Set yOrigin for the next row
        yOrigin += row.getSize().height + lineSpacing;

        context.restore();
      });

      if (this._debugMode) {
        Object(__WEBPACK_IMPORTED_MODULE_4__utils_canvas__["e" /* strokeRect */])(context, new Rectangle(0, 0, renderSize.width, renderSize.height), __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__["Color"].RED);
      }

      context.restore();

      // if (isInverted) {
      //   fillRect(context, destinationSize.rectangle(), color, 'source-out')
      // }
    }
  }]);

  return TextDesignRenderer;
}();

/***/ }),
/* 378 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__transform_change__ = __webpack_require__(379);





var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */



var Vector2 = __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Math"].Vector2;

/**
 * An operation that can transform out a part of the image
 * @class
 * @extends PhotoEditorSDK.Operation
 * @memberof PhotoEditorSDK.Operations
 */

var TransformOperation = function (_Operation) {
  _inherits(TransformOperation, _Operation);

  function TransformOperation() {
    _classCallCheck(this, TransformOperation);

    return _possibleConstructorReturn(this, (TransformOperation.__proto__ || __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_get_prototype_of___default()(TransformOperation)).apply(this, arguments));
  }

  _createClass(TransformOperation, [{
    key: '_render',

    // -------------------------------------------------------------------------- RENDERING

    /**
     * Transforms the image
     * @param {PhotoEditorSDK.Engine.RenderTexture} inputTexture
     * @returns {Promise}
     * @override
     * @private
     */
    value: function _render(inputTexture) {
      this._sprite.setRotation(0);

      var inputDimensions = inputTexture.getDimensions();
      var _options = this._options,
          start = _options.start,
          end = _options.end,
          rotation = _options.rotation,
          textureScale = _options.textureScale;


      var middle = start.clone().add(end.clone().subtract(start).divide(2));

      var scale = this.calculateScale();
      var finalScale = scale * textureScale;
      var outputDimensions = this.getNewDimensions(inputDimensions);
      this._sprite.setAnchor(middle);
      this._sprite.setRotation(rotation);
      this._sprite.setScale(finalScale, finalScale);
      this._sprite.setPosition(outputDimensions.clone().multiply(0.5).ceil());

      // Render the container to this Operation's RenderTexture
      this._renderTexture.render(this._container);

      return __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Promise"].resolve();
    }
  }, {
    key: 'calculateScale',
    value: function calculateScale() {
      var rotation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._options.rotation;

      var inputDimensions = this.getInputDimensions(false);

      var rotatedDimensions = new Vector2(Math.abs(inputDimensions.x * Math.cos(rotation)) + Math.abs(inputDimensions.y * Math.sin(rotation)), Math.abs(inputDimensions.x * Math.sin(rotation)) + Math.abs(inputDimensions.y * Math.cos(rotation)));

      var distanceToCorner = inputDimensions.clone().multiply(0.5);
      distanceToCorner.subtract(rotatedDimensions.clone().divide(2));
      distanceToCorner.abs();

      var scale = 1;
      if (distanceToCorner.y > distanceToCorner.x) {
        scale = distanceToCorner.y * 2 / inputDimensions.y + 1;
      } else {
        scale = distanceToCorner.x * 2 / inputDimensions.x + 1;
      }
      return scale;
    }

    /**
     * Returns the dimensions the given dimensions will have after this operation
     * has been applied
     * @param {PhotoEditorSDK.Math.Vector2} inputDimensions
     * @return {PhotoEditorSDK.Math.Vector2}
     * @override
     */

  }, {
    key: 'getNewDimensions',
    value: function getNewDimensions(inputDimensions) {
      var _options2 = this._options,
          start = _options2.start,
          end = _options2.end,
          textureScale = _options2.textureScale;

      var scale = this.calculateScale();
      return inputDimensions.clone().multiply(textureScale * scale).multiply(end.clone().subtract(start)).round();
    }

    /**
     * Flips this operation into the given direction
     * @param  {String} direction
     */

  }, {
    key: 'flip',
    value: function flip(direction) {
      var _options3 = this._options,
          start = _options3.start,
          end = _options3.end;

      var tmpStart = start.clone();

      if (direction === 'horizontal') {
        start.set(1.0 - end.x, start.y);
        end.set(1.0 - tmpStart.x, end.y);
      } else if (direction === 'vertical') {
        start.set(start.x, 1.0 - end.y);
        end.set(end.x, 1.0 - tmpStart.y);
      }
    }

    /**
     * Rotates this operation with the given degrees
     * @param {Number} degrees
     */

  }, {
    key: 'rotate',
    value: function rotate(degrees) {
      var _options4 = this._options,
          start = _options4.start,
          end = _options4.end;

      var degreesDifference = (degrees + 360) % 360;

      var steps = Math.floor(degreesDifference / 90);
      for (var i = 0; i < steps; i++) {
        var tempStart = start.clone();
        start.set(1.0 - end.y, tempStart.x);
        end.set(1.0 - tempStart.y, end.x);
      }
    }
  }]);

  return TransformOperation;
}(__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["Operation"]);

/**
 * A unique string that identifies this operation. Can be used to select
 * operations.
 * @type {String}
 * @default
 */


TransformOperation.identifier = 'transform';

/**
 * Specifies the available options for this operation
 * @type {Object}
 * @ignore
 */
TransformOperation.prototype.availableOptions = {
  start: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(0, 0) },
  end: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].VECTOR2, default: new Vector2(1, 1) },
  textureScale: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 1 },
  rotation: { type: __WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core__["OptionType"].NUMBER, default: 0 }
};

TransformOperation.TransformChange = __WEBPACK_IMPORTED_MODULE_5__transform_change__["a" /* default */];
__WEBPACK_IMPORTED_MODULE_4_photoeditorsdk_core___default.a.Operations.TransformOperation = TransformOperation;

/* harmony default export */ __webpack_exports__["a"] = (TransformOperation);

/***/ }),
/* 379 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__);


var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */


var Vector2 = __WEBPACK_IMPORTED_MODULE_1_photoeditorsdk_core__["Math"].Vector2;

var TransformChange = function () {
  function TransformChange(operation, options) {
    _classCallCheck(this, TransformChange);

    this._operation = operation;
    this._options = options;

    this._inputDimensions = this._operation.getInputDimensions(false);
    this._rotationDelta = options.rotation - this._operation.getRotation();
    this._deltaCos = Math.cos(this._rotationDelta);
    this._deltaSin = Math.sin(this._rotationDelta);

    this._oldAbsoluteSize = this._operation.getEnd().clone().subtract(this._operation.getStart()).multiply(this._inputDimensions);
    this._newAbsoluteSize = options.end.clone().subtract(options.start).multiply(this._inputDimensions);
    this._absoluteStartDiff = this._operation.getStart().clone().subtract(options.start).multiply(this._inputDimensions);
    this._scaleRatio = this._operation.calculateScale(options.rotation) / this._operation.calculateScale();
    this._absoluteStart = this._operation.getStart().clone().multiply(this._inputDimensions);
    this._sizeFactor = this._newAbsoluteSize.clone().divide(this._oldAbsoluteSize);
    this._textureScaleFactor = this._options.textureScale / this._operation.getTextureScale();
  }

  /**
   * Applies this transform change to the given relative point
   * @param  {PhotoEditorSDK.Math.Vector2} point
   * @return {PhotoEditorSDK.Math.Vector2}
   */


  _createClass(TransformChange, [{
    key: 'applyToRelativePoint',
    value: function applyToRelativePoint(point) {
      var oldStart = this._operation.getStart();
      var oldEnd = this._operation.getEnd();

      var cropCenter = oldStart.clone().add(oldEnd.clone().subtract(oldStart).divide(2));

      // Find point's pixel position relative to image center:
      //  - a: Find point's pixel position relative to crop center
      var pixelCropCenter = cropCenter.multiply(this._inputDimensions);

      var pointPixelDistanceToCropCenter = point.clone().multiply(this._oldAbsoluteSize).subtract(this._oldAbsoluteSize.clone().divide(2));

      //  - b: Find crop center's pixel position relative to image center
      //    (Point's pixel position relative to image center = a + b)
      var pointPixelPositionOnImage = pixelCropCenter.clone().add(pointPixelDistanceToCropCenter);
      var pointPixelDistanceToImageCenter = pointPixelPositionOnImage.clone().subtract(this._inputDimensions.clone().divide(2));

      // Rotate (_rotationDelta) and scale (_scaleRatio) distance to image center
      var rotatedPointPixelDistanceToImageCenter = new Vector2(pointPixelDistanceToImageCenter.x * this._deltaCos - pointPixelDistanceToImageCenter.y * this._deltaSin, pointPixelDistanceToImageCenter.x * this._deltaSin + pointPixelDistanceToImageCenter.y * this._deltaCos);

      var rotatedPointPixelPositionOnImage = this._inputDimensions.clone().divide(2).add(rotatedPointPixelDistanceToImageCenter);

      // Apply new crop
      var newAbsoluteStart = this._options.start.clone().multiply(this._inputDimensions);
      return rotatedPointPixelPositionOnImage.clone().subtract(newAbsoluteStart).divide(this._newAbsoluteSize);
    }

    /**
     * Applies this transform change to the given relative size
     * @param  {Number} number
     * @return {Number}
     */

  }, {
    key: 'applyToRelativeSize',
    value: function applyToRelativeSize(size) {
      return size * this._oldAbsoluteSize.min() / this._newAbsoluteSize.min();
    }

    /**
     * Applies this transform change to the given dimensions
     * @param  {PhotoEditorSDK.Math.Vector2} dimensions
     * @return {PhotoEditorSDK.Math.Vector2}
     */

  }, {
    key: 'applyToDimensions',
    value: function applyToDimensions(dimensions) {
      dimensions = dimensions.clone().multiply(this._scaleRatio);
      if (this._options.textureScale) {
        dimensions.multiply(this._textureScaleFactor);
      }
      return dimensions;
    }

    /**
     * Returns the new relative size value for the given relative size value
     * @param  {Number} size
     * @param  {String} side
     * @return {Number}
     */

  }, {
    key: 'scaleSize',
    value: function scaleSize(size) {
      var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'y';

      return size / this._sizeFactor[side];
    }

    /**
     * Applies the transform rotation to the given rotation
     * @param  {Number} rotation
     * @return {Number}
     */

  }, {
    key: 'applyToRotation',
    value: function applyToRotation(rotation) {
      return (rotation + this._rotationDelta) % (Math.PI * 2);
    }
  }]);

  return TransformChange;
}();

/* harmony default export */ __webpack_exports__["a"] = (TransformChange);

/***/ }),
/* 380 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__ = __webpack_require__(5);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__ = __webpack_require__(1);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__);






var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_define_property___default()(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_get_own_property_descriptor___default()(object, property); if (desc === undefined) { var parent = __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = __WEBPACK_IMPORTED_MODULE_3_babel_runtime_core_js_object_create___default()(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default.a ? __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_object_set_prototype_of___default()(subClass, superClass) : subClass.__proto__ = superClass; }

/* @module */
/*
 * This file is part of PhotoEditorSDK.
 *
 * Copyright (C) 2016-2017 9elements GmbH <contact@9elements.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, without
 * modification, are permitted provided that the following license agreement
 * is approved and a legal/financial contract was signed by the user.
 * The license agreement can be found under following link:
 *
 * https://www.photoeditorsdk.com/LICENSE.txt
 */


var Vector2 = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Math"].Vector2;

/**
 * An operation that can draw a watermark on top of the image
 * @class
 * @extends PhotoEditorSDK.Operation
 * @memberof PhotoEditorSDK.Operations
 */

var WatermarkOperation = function (_Operation) {
  _inherits(WatermarkOperation, _Operation);

  /**
   * Creates a new WatermarkOperation
   * @param  {PhotoEditorSDK} sdk
   * @param  {Object} [options]
   */
  function WatermarkOperation() {
    var _ref;

    _classCallCheck(this, WatermarkOperation);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    var _this = _possibleConstructorReturn(this, (_ref = WatermarkOperation.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(WatermarkOperation)).call.apply(_ref, [this].concat(args)));

    _this._watermarkSprite = new __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].Sprite();
    _this._watermarkSprite.setAnchor(0.5, 0.5);
    _this._container.addChild(_this._watermarkSprite);
    return _this;
  }

  /**
   * Renders the watermark
   * @param  {PhotoEditorSDK.Engine.Texture} inputTexture
   * @private
   * @override
   */


  _createClass(WatermarkOperation, [{
    key: '_render',
    value: function _render(inputTexture) {
      if (!this._watermarkTexture) {
        this._watermarkTexture = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Engine"].Texture.fromImage(this._options.image);
        this._watermarkSprite.setTexture(this._watermarkTexture);
      }

      var textureDimensions = inputTexture.getDimensions();

      var _options$image = this._options.image,
          width = _options$image.width,
          height = _options$image.height;

      var dimensions = __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Utils"].resizeVectorToFit(new Vector2(width, height), textureDimensions);
      this._watermarkSprite.setPosition(textureDimensions.clone().divide(2));
      this._watermarkSprite.setWidth(dimensions.x);
      this._watermarkSprite.setHeight(dimensions.y);

      this._renderTexture.render(this._container);

      return __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Promise"].resolve();
    }

    /**
     * Disposes this operation
     */

  }, {
    key: 'dispose',
    value: function dispose() {
      _get(WatermarkOperation.prototype.__proto__ || __WEBPACK_IMPORTED_MODULE_4_babel_runtime_core_js_object_get_prototype_of___default()(WatermarkOperation.prototype), 'dispose', this).call(this);
      this._watermarkSprite.dispose();
    }
  }]);

  return WatermarkOperation;
}(__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["Operation"]);

/**
 * A unique string that identifies this operation. Can be used to select
 * operations.
 * @type {String}
 * @default
 */


WatermarkOperation.identifier = 'watermark';

/**
 * Specifies the available options for this operation
 * @type {Object}
 * @ignore
 */
WatermarkOperation.prototype.availableOptions = {
  image: { type: __WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core__["OptionType"].OBJECT, required: true }
};

__WEBPACK_IMPORTED_MODULE_5_photoeditorsdk_core___default.a.Operations.WatermarkOperation = WatermarkOperation;

/* harmony default export */ __webpack_exports__["a"] = (WatermarkOperation);

/***/ })
/******/ ]);
});

Zerion Mini Shell 1.0