| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/HostingSpaces/admin/chatme24.com/wwwroot/_server/js/image_editor/ |
Upload File : |
/******/ (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, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // 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 = "https://cdn.scaleflex.it/plugins/filerobot-image-editor/3.12.17/";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 70);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
if (true) {
module.exports = __webpack_require__(27);
} else {}
/***/ }),
/* 1 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {/* unused harmony export ServerStyleSheet */
/* unused harmony export StyleSheetConsumer */
/* unused harmony export StyleSheetContext */
/* unused harmony export StyleSheetManager */
/* unused harmony export ThemeConsumer */
/* unused harmony export ThemeContext */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ThemeProvider; });
/* unused harmony export __PRIVATE__ */
/* unused harmony export createGlobalStyle */
/* unused harmony export css */
/* unused harmony export isStyledComponent */
/* unused harmony export keyframes */
/* unused harmony export useTheme */
/* unused harmony export version */
/* unused harmony export withTheme */
/* harmony import */ var react_is__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7);
/* harmony import */ var react_is__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_is__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var shallowequal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(14);
/* harmony import */ var shallowequal__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(shallowequal__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _emotion_stylis__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(15);
/* harmony import */ var _emotion_unitless__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(16);
/* harmony import */ var _emotion_is_prop_valid__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(11);
/* harmony import */ var hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(10);
/* harmony import */ var hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_6__);
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _extends() {
_extends = Object.assign || 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;
};
return _extends.apply(this, arguments);
}
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
} //
var interleave = function interleave(strings, interpolations) {
var result = [strings[0]];
for (var i = 0, len = interpolations.length; i < len; i += 1) {
result.push(interpolations[i], strings[i + 1]);
}
return result;
}; //
var isPlainObject = function isPlainObject(x) {
return x !== null && _typeof(x) === 'object' && (x.toString ? x.toString() : Object.prototype.toString.call(x)) === '[object Object]' && !Object(react_is__WEBPACK_IMPORTED_MODULE_0__["typeOf"])(x);
}; //
var EMPTY_ARRAY = Object.freeze([]);
var EMPTY_OBJECT = Object.freeze({}); //
function isFunction(test) {
return typeof test === 'function';
} //
function getComponentName(target) {
return ( false) || // $FlowFixMe
target.displayName || // $FlowFixMe
target.name || 'Component';
} //
function isStatelessFunction(test) {
return typeof test === 'function' && !(test.prototype && test.prototype.isReactComponent);
} //
function isStyledComponent(target) {
return target && typeof target.styledComponentId === 'string';
} //
var SC_ATTR = typeof process !== 'undefined' && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || 'data-styled';
var SC_ATTR_ACTIVE = 'active';
var SC_ATTR_VERSION = 'data-styled-version';
var SC_VERSION = "5.1.1";
var SPLITTER = '/*!sc*/\n';
var IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;
var DISABLE_SPEEDY = typeof SC_DISABLE_SPEEDY === 'boolean' && SC_DISABLE_SPEEDY || typeof process !== 'undefined' && (process.env.REACT_APP_SC_DISABLE_SPEEDY || process.env.SC_DISABLE_SPEEDY) || "production" !== 'production'; // Shared empty execution context when generating static styles
var STATIC_EXECUTION_CONTEXT = {}; //
/* eslint-disable camelcase, no-undef */
var getNonce = function getNonce() {
return true ? __webpack_require__.nc : undefined;
};
var errorMap = {
"1": "Cannot create styled-component for component: %s.\n\n",
"2": "Can't collect styles once you've consumed a `ServerStyleSheet`'s styles! `ServerStyleSheet` is a one off instance for each server-side render cycle.\n\n- Are you trying to reuse it across renders?\n- Are you accidentally calling collectStyles twice?\n\n",
"3": "Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.\n\n",
"4": "The `StyleSheetManager` expects a valid target or sheet prop!\n\n- Does this error occur on the client and is your target falsy?\n- Does this error occur on the server and is the sheet falsy?\n\n",
"5": "The clone method cannot be used on the client!\n\n- Are you running in a client-like environment on the server?\n- Are you trying to run SSR on the client?\n\n",
"6": "Trying to insert a new style tag, but the given Node is unmounted!\n\n- Are you using a custom target that isn't mounted?\n- Does your document not have a valid head element?\n- Have you accidentally removed a style tag manually?\n\n",
"7": "ThemeProvider: Please return an object from your \"theme\" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n",
"8": "ThemeProvider: Please make your \"theme\" prop an object.\n\n",
"9": "Missing document `<head>`\n\n",
"10": "Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021\n\n",
"11": "_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.\n\n",
"12": "It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n",
"13": "%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.\n\n",
"14": "ThemeProvider: \"theme\" prop is required.\n\n",
"15": "A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to `<StyleSheetManager stylisPlugins={[]}>`, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n",
"16": "Reached the limit of how many styled components may be created at group %s.\nYou may only create up to 1,073,741,824 components. If you're creating components dynamically,\nas for instance in your render method then you may be running into this limitation.\n\n",
"17": "CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n"
}; //
var ERRORS = false ? undefined : {};
/**
* super basic version of sprintf
*/
function format() {
var a = arguments.length <= 0 ? undefined : arguments[0];
var b = [];
for (var c = 1, len = arguments.length; c < len; c += 1) {
b.push(c < 0 || arguments.length <= c ? undefined : arguments[c]);
}
b.forEach(function (d) {
a = a.replace(/%[a-z]/, d);
});
return a;
}
/**
* Create an error file out of errors.md for development and a simple web link to the full errors
* in production mode.
*/
function throwStyledComponentsError(code) {
for (var _len = arguments.length, interpolations = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
interpolations[_key - 1] = arguments[_key];
}
if (true) {
throw new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/master/packages/styled-components/src/utils/errors.md#" + code + " for more information." + (interpolations.length > 0 ? " Additional arguments: " + interpolations.join(', ') : ''));
} else {}
} //
var ELEMENT_TYPE = 1;
/* Node.ELEMENT_TYPE */
/** Find last style element if any inside target */
var findLastStyleTag = function findLastStyleTag(target) {
var childNodes = target.childNodes;
for (var i = childNodes.length; i >= 0; i--) {
var child = childNodes[i];
if (child && child.nodeType === ELEMENT_TYPE && child.hasAttribute(SC_ATTR)) {
return child;
}
}
return undefined;
};
/** Create a style element inside `target` or <head> after the last */
var makeStyleTag = function makeStyleTag(target) {
var head = document.head;
var parent = target || head;
var style = document.createElement('style');
var prevStyle = findLastStyleTag(parent);
var nextSibling = prevStyle !== undefined ? prevStyle.nextSibling : null;
style.setAttribute(SC_ATTR, SC_ATTR_ACTIVE);
style.setAttribute(SC_ATTR_VERSION, SC_VERSION);
var nonce = getNonce();
if (nonce) style.setAttribute('nonce', nonce);
parent.insertBefore(style, nextSibling);
return style;
};
/** Get the CSSStyleSheet instance for a given style element */
var getSheet = function getSheet(tag) {
if (tag.sheet) {
return tag.sheet;
} // Avoid Firefox quirk where the style element might not have a sheet property
var _document = document,
styleSheets = _document.styleSheets;
for (var i = 0, l = styleSheets.length; i < l; i++) {
var sheet = styleSheets[i];
if (sheet.ownerNode === tag) {
return sheet;
}
}
throwStyledComponentsError(17);
return undefined;
}; //
/** Create a CSSStyleSheet-like tag depending on the environment */
var makeTag = function makeTag(_ref) {
var isServer = _ref.isServer,
useCSSOMInjection = _ref.useCSSOMInjection,
target = _ref.target;
if (isServer) {
return new VirtualTag(target);
} else if (useCSSOMInjection) {
return new CSSOMTag(target);
} else {
return new TextTag(target);
}
};
var CSSOMTag = /*#__PURE__*/function () {
function CSSOMTag(target) {
var element = this.element = makeStyleTag(target); // Avoid Edge bug where empty style elements don't create sheets
element.appendChild(document.createTextNode(''));
this.sheet = getSheet(element);
this.length = 0;
}
var _proto = CSSOMTag.prototype;
_proto.insertRule = function insertRule(index, rule) {
try {
this.sheet.insertRule(rule, index);
this.length++;
return true;
} catch (_error) {
return false;
}
};
_proto.deleteRule = function deleteRule(index) {
this.sheet.deleteRule(index);
this.length--;
};
_proto.getRule = function getRule(index) {
var rule = this.sheet.cssRules[index]; // Avoid IE11 quirk where cssText is inaccessible on some invalid rules
if (rule !== undefined && typeof rule.cssText === 'string') {
return rule.cssText;
} else {
return '';
}
};
return CSSOMTag;
}();
/** A Tag that emulates the CSSStyleSheet API but uses text nodes */
var TextTag = /*#__PURE__*/function () {
function TextTag(target) {
var element = this.element = makeStyleTag(target);
this.nodes = element.childNodes;
this.length = 0;
}
var _proto2 = TextTag.prototype;
_proto2.insertRule = function insertRule(index, rule) {
if (index <= this.length && index >= 0) {
var node = document.createTextNode(rule);
var refNode = this.nodes[index];
this.element.insertBefore(node, refNode || null);
this.length++;
return true;
} else {
return false;
}
};
_proto2.deleteRule = function deleteRule(index) {
this.element.removeChild(this.nodes[index]);
this.length--;
};
_proto2.getRule = function getRule(index) {
if (index < this.length) {
return this.nodes[index].textContent;
} else {
return '';
}
};
return TextTag;
}();
/** A completely virtual (server-side) Tag that doesn't manipulate the DOM */
var VirtualTag = /*#__PURE__*/function () {
function VirtualTag(_target) {
this.rules = [];
this.length = 0;
}
var _proto3 = VirtualTag.prototype;
_proto3.insertRule = function insertRule(index, rule) {
if (index <= this.length) {
this.rules.splice(index, 0, rule);
this.length++;
return true;
} else {
return false;
}
};
_proto3.deleteRule = function deleteRule(index) {
this.rules.splice(index, 1);
this.length--;
};
_proto3.getRule = function getRule(index) {
if (index < this.length) {
return this.rules[index];
} else {
return '';
}
};
return VirtualTag;
}(); //
/** Create a GroupedTag with an underlying Tag implementation */
var makeGroupedTag = function makeGroupedTag(tag) {
return new DefaultGroupedTag(tag);
};
var BASE_SIZE = 1 << 9;
var DefaultGroupedTag = /*#__PURE__*/function () {
function DefaultGroupedTag(tag) {
this.groupSizes = new Uint32Array(BASE_SIZE);
this.length = BASE_SIZE;
this.tag = tag;
}
var _proto = DefaultGroupedTag.prototype;
_proto.indexOfGroup = function indexOfGroup(group) {
var index = 0;
for (var i = 0; i < group; i++) {
index += this.groupSizes[i];
}
return index;
};
_proto.insertRules = function insertRules(group, rules) {
if (group >= this.groupSizes.length) {
var oldBuffer = this.groupSizes;
var oldSize = oldBuffer.length;
var newSize = oldSize;
while (group >= newSize) {
newSize <<= 1;
if (newSize < 0) {
throwStyledComponentsError(16, "" + group);
}
}
this.groupSizes = new Uint32Array(newSize);
this.groupSizes.set(oldBuffer);
this.length = newSize;
for (var i = oldSize; i < newSize; i++) {
this.groupSizes[i] = 0;
}
}
var ruleIndex = this.indexOfGroup(group + 1);
for (var _i = 0, l = rules.length; _i < l; _i++) {
if (this.tag.insertRule(ruleIndex, rules[_i])) {
this.groupSizes[group]++;
ruleIndex++;
}
}
};
_proto.clearGroup = function clearGroup(group) {
if (group < this.length) {
var length = this.groupSizes[group];
var startIndex = this.indexOfGroup(group);
var endIndex = startIndex + length;
this.groupSizes[group] = 0;
for (var i = startIndex; i < endIndex; i++) {
this.tag.deleteRule(startIndex);
}
}
};
_proto.getGroup = function getGroup(group) {
var css = '';
if (group >= this.length || this.groupSizes[group] === 0) {
return css;
}
var length = this.groupSizes[group];
var startIndex = this.indexOfGroup(group);
var endIndex = startIndex + length;
for (var i = startIndex; i < endIndex; i++) {
css += "" + this.tag.getRule(i) + SPLITTER;
}
return css;
};
return DefaultGroupedTag;
}(); //
var MAX_SMI = 1 << 31 - 1;
var groupIDRegister = new Map();
var reverseRegister = new Map();
var nextFreeGroup = 1;
var getGroupForId = function getGroupForId(id) {
if (groupIDRegister.has(id)) {
return groupIDRegister.get(id);
}
var group = nextFreeGroup++;
if (false) {}
groupIDRegister.set(id, group);
reverseRegister.set(group, id);
return group;
};
var getIdForGroup = function getIdForGroup(group) {
return reverseRegister.get(group);
};
var setGroupForId = function setGroupForId(id, group) {
if (group >= nextFreeGroup) {
nextFreeGroup = group + 1;
}
groupIDRegister.set(id, group);
reverseRegister.set(group, id);
}; //
var SELECTOR = "style[" + SC_ATTR + "][" + SC_ATTR_VERSION + "=\"" + SC_VERSION + "\"]";
var MARKER_RE = new RegExp("^" + SC_ATTR + "\\.g(\\d+)\\[id=\"([\\w\\d-]+)\"\\].*?\"([^\"]*)");
var outputSheet = function outputSheet(sheet) {
var tag = sheet.getTag();
var length = tag.length;
var css = '';
for (var group = 0; group < length; group++) {
var id = getIdForGroup(group);
if (id === undefined) continue;
var names = sheet.names.get(id);
var rules = tag.getGroup(group);
if (names === undefined || rules.length === 0) continue;
var selector = SC_ATTR + ".g" + group + "[id=\"" + id + "\"]";
var content = '';
if (names !== undefined) {
names.forEach(function (name) {
if (name.length > 0) {
content += name + ",";
}
});
} // NOTE: It's easier to collect rules and have the marker
// after the actual rules to simplify the rehydration
css += "" + rules + selector + "{content:\"" + content + "\"}" + SPLITTER;
}
return css;
};
var rehydrateNamesFromContent = function rehydrateNamesFromContent(sheet, id, content) {
var names = content.split(',');
var name;
for (var i = 0, l = names.length; i < l; i++) {
// eslint-disable-next-line
if (name = names[i]) {
sheet.registerName(id, name);
}
}
};
var rehydrateSheetFromTag = function rehydrateSheetFromTag(sheet, style) {
var parts = style.innerHTML.split(SPLITTER);
var rules = [];
for (var i = 0, l = parts.length; i < l; i++) {
var part = parts[i].trim();
if (!part) continue;
var marker = part.match(MARKER_RE);
if (marker) {
var group = parseInt(marker[1], 10) | 0;
var id = marker[2];
if (group !== 0) {
// Rehydrate componentId to group index mapping
setGroupForId(id, group); // Rehydrate names and rules
// looks like: data-styled.g11[id="idA"]{content:"nameA,"}
rehydrateNamesFromContent(sheet, id, marker[3]);
sheet.getTag().insertRules(group, rules);
}
rules.length = 0;
} else {
rules.push(part);
}
}
};
var rehydrateSheet = function rehydrateSheet(sheet) {
var nodes = document.querySelectorAll(SELECTOR);
for (var i = 0, l = nodes.length; i < l; i++) {
var node = nodes[i];
if (node && node.getAttribute(SC_ATTR) !== SC_ATTR_ACTIVE) {
rehydrateSheetFromTag(sheet, node);
if (node.parentNode) {
node.parentNode.removeChild(node);
}
}
}
};
var SHOULD_REHYDRATE = IS_BROWSER;
var defaultOptions = {
isServer: !IS_BROWSER,
useCSSOMInjection: !DISABLE_SPEEDY
};
/** Contains the main stylesheet logic for stringification and caching */
var StyleSheet = /*#__PURE__*/function () {
/** Register a group ID to give it an index */
StyleSheet.registerId = function registerId(id) {
return getGroupForId(id);
};
function StyleSheet(options, globalStyles, names) {
if (options === void 0) {
options = defaultOptions;
}
if (globalStyles === void 0) {
globalStyles = {};
}
this.options = _extends({}, defaultOptions, {}, options);
this.gs = globalStyles;
this.names = new Map(names); // We rehydrate only once and use the sheet that is created first
if (!this.options.isServer && IS_BROWSER && SHOULD_REHYDRATE) {
SHOULD_REHYDRATE = false;
rehydrateSheet(this);
}
}
var _proto = StyleSheet.prototype;
_proto.reconstructWithOptions = function reconstructWithOptions(options) {
return new StyleSheet(_extends({}, this.options, {}, options), this.gs, this.names);
};
_proto.allocateGSInstance = function allocateGSInstance(id) {
return this.gs[id] = (this.gs[id] || 0) + 1;
}
/** Lazily initialises a GroupedTag for when it's actually needed */
;
_proto.getTag = function getTag() {
return this.tag || (this.tag = makeGroupedTag(makeTag(this.options)));
}
/** Check whether a name is known for caching */
;
_proto.hasNameForId = function hasNameForId(id, name) {
return this.names.has(id) && this.names.get(id).has(name);
}
/** Mark a group's name as known for caching */
;
_proto.registerName = function registerName(id, name) {
getGroupForId(id);
if (!this.names.has(id)) {
var groupNames = new Set();
groupNames.add(name);
this.names.set(id, groupNames);
} else {
this.names.get(id).add(name);
}
}
/** Insert new rules which also marks the name as known */
;
_proto.insertRules = function insertRules(id, name, rules) {
this.registerName(id, name);
this.getTag().insertRules(getGroupForId(id), rules);
}
/** Clears all cached names for a given group ID */
;
_proto.clearNames = function clearNames(id) {
if (this.names.has(id)) {
this.names.get(id).clear();
}
}
/** Clears all rules for a given group ID */
;
_proto.clearRules = function clearRules(id) {
this.getTag().clearGroup(getGroupForId(id));
this.clearNames(id);
}
/** Clears the entire tag which deletes all rules but not its names */
;
_proto.clearTag = function clearTag() {
// NOTE: This does not clear the names, since it's only used during SSR
// so that we can continuously output only new rules
this.tag = undefined;
}
/** Outputs the current sheet as a CSS string with markers for SSR */
;
_proto.toString = function toString() {
return outputSheet(this);
};
return StyleSheet;
}(); //
/* eslint-disable */
var SEED = 5381; // When we have separate strings it's useful to run a progressive
// version of djb2 where we pretend that we're still looping over
// the same string
var phash = function phash(h, x) {
var i = x.length;
while (i) {
h = h * 33 ^ x.charCodeAt(--i);
}
return h;
}; // This is a djb2 hashing function
var hash = function hash(x) {
return phash(SEED, x);
};
/**
* MIT License
*
* Copyright (c) 2016 Sultan Tarimo
*
* 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.
*/
/* eslint-disable */
function insertRulePlugin(insertRule) {
var delimiter = '/*|*/';
var needle = delimiter + "}";
function toSheet(block) {
if (block) {
try {
insertRule(block + "}");
} catch (e) {}
}
}
return function ruleSheet(context, content, selectors, parents, line, column, length, ns, depth, at) {
switch (context) {
// property
case 1:
// @import
if (depth === 0 && content.charCodeAt(0) === 64) return insertRule(content + ";"), '';
break;
// selector
case 2:
if (ns === 0) return content + delimiter;
break;
// at-rule
case 3:
switch (ns) {
// @font-face, @page
case 102:
case 112:
return insertRule(selectors[0] + content), '';
default:
return content + (at === 0 ? delimiter : '');
}
case -2:
content.split(needle).forEach(toSheet);
}
};
}
var COMMENT_REGEX = /^\s*\/\/.*$/gm;
function createStylisInstance(_temp) {
var _ref = _temp === void 0 ? EMPTY_OBJECT : _temp,
_ref$options = _ref.options,
options = _ref$options === void 0 ? EMPTY_OBJECT : _ref$options,
_ref$plugins = _ref.plugins,
plugins = _ref$plugins === void 0 ? EMPTY_ARRAY : _ref$plugins;
var stylis = new _emotion_stylis__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"](options); // Wrap `insertRulePlugin to build a list of rules,
// and then make our own plugin to return the rules. This
// makes it easier to hook into the existing SSR architecture
var parsingRules = []; // eslint-disable-next-line consistent-return
var returnRulesPlugin = function returnRulesPlugin(context) {
if (context === -2) {
var parsedRules = parsingRules;
parsingRules = [];
return parsedRules;
}
};
var parseRulesPlugin = insertRulePlugin(function (rule) {
parsingRules.push(rule);
});
var _componentId;
var _selector;
var _selectorRegexp;
var selfReferenceReplacer = function selfReferenceReplacer(match, offset, string) {
if ( // the first self-ref is always untouched
offset > 0 && // there should be at least two self-refs to do a replacement (.b > .b)
string.slice(0, offset).indexOf(_selector) !== -1 && // no consecutive self refs (.b.b); that is a precedence boost and treated differently
string.slice(offset - _selector.length, offset) !== _selector) {
return "." + _componentId;
}
return match;
};
/**
* When writing a style like
*
* & + & {
* color: red;
* }
*
* The second ampersand should be a reference to the static component class. stylis
* has no knowledge of static class so we have to intelligently replace the base selector.
*
* https://github.com/thysultan/stylis.js#plugins <- more info about the context phase values
* "2" means this plugin is taking effect at the very end after all other processing is complete
*/
var selfReferenceReplacementPlugin = function selfReferenceReplacementPlugin(context, _, selectors) {
if (context === 2 && selectors.length && selectors[0].lastIndexOf(_selector) > 0) {
// eslint-disable-next-line no-param-reassign
selectors[0] = selectors[0].replace(_selectorRegexp, selfReferenceReplacer);
}
};
stylis.use([].concat(plugins, [selfReferenceReplacementPlugin, parseRulesPlugin, returnRulesPlugin]));
function stringifyRules(css, selector, prefix, componentId) {
if (componentId === void 0) {
componentId = '&';
}
var flatCSS = css.replace(COMMENT_REGEX, '');
var cssStr = selector && prefix ? prefix + " " + selector + " { " + flatCSS + " }" : flatCSS; // stylis has no concept of state to be passed to plugins
// but since JS is single=threaded, we can rely on that to ensure
// these properties stay in sync with the current stylis run
_componentId = componentId;
_selector = selector;
_selectorRegexp = new RegExp("\\" + _selector + "\\b", 'g');
return stylis(prefix || !selector ? '' : selector, cssStr);
}
stringifyRules.hash = plugins.length ? plugins.reduce(function (acc, plugin) {
if (!plugin.name) {
throwStyledComponentsError(15);
}
return phash(acc, plugin.name);
}, SEED).toString() : '';
return stringifyRules;
} //
var StyleSheetContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createContext();
var StyleSheetConsumer = StyleSheetContext.Consumer;
var StylisContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createContext();
var StylisConsumer = StylisContext.Consumer;
var masterSheet = new StyleSheet();
var masterStylis = createStylisInstance();
function useStyleSheet() {
return Object(react__WEBPACK_IMPORTED_MODULE_1__["useContext"])(StyleSheetContext) || masterSheet;
}
function useStylis() {
return Object(react__WEBPACK_IMPORTED_MODULE_1__["useContext"])(StylisContext) || masterStylis;
}
function StyleSheetManager(props) {
var _useState = Object(react__WEBPACK_IMPORTED_MODULE_1__["useState"])(props.stylisPlugins),
plugins = _useState[0],
setPlugins = _useState[1];
var contextStyleSheet = useStyleSheet();
var styleSheet = Object(react__WEBPACK_IMPORTED_MODULE_1__["useMemo"])(function () {
var sheet = contextStyleSheet;
if (props.sheet) {
// eslint-disable-next-line prefer-destructuring
sheet = props.sheet;
} else if (props.target) {
sheet = sheet.reconstructWithOptions({
target: props.target
});
}
if (props.disableCSSOMInjection) {
sheet = sheet.reconstructWithOptions({
useCSSOMInjection: false
});
}
return sheet;
}, [props.disableCSSOMInjection, props.sheet, props.target]);
var stylis = Object(react__WEBPACK_IMPORTED_MODULE_1__["useMemo"])(function () {
return createStylisInstance({
options: {
prefix: !props.disableVendorPrefixes
},
plugins: plugins
});
}, [props.disableVendorPrefixes, plugins]);
Object(react__WEBPACK_IMPORTED_MODULE_1__["useEffect"])(function () {
if (!shallowequal__WEBPACK_IMPORTED_MODULE_2___default()(plugins, props.stylisPlugins)) setPlugins(props.stylisPlugins);
}, [props.stylisPlugins]);
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(StyleSheetContext.Provider, {
value: styleSheet
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(StylisContext.Provider, {
value: stylis
}, false ? undefined : props.children));
} //
var Keyframes = /*#__PURE__*/function () {
function Keyframes(name, stringifyArgs) {
var _this = this;
this.inject = function (styleSheet) {
if (!styleSheet.hasNameForId(_this.id, _this.name)) {
styleSheet.insertRules(_this.id, _this.name, masterStylis.apply(void 0, _this.stringifyArgs));
}
};
this.toString = function () {
return throwStyledComponentsError(12, String(_this.name));
};
this.name = name;
this.id = "sc-keyframes-" + name;
this.stringifyArgs = stringifyArgs;
}
var _proto = Keyframes.prototype;
_proto.getName = function getName() {
return this.name;
};
return Keyframes;
}(); //
/**
* inlined version of
* https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/hyphenateStyleName.js
*/
var uppercasePattern = /([A-Z])/g;
var msPattern = /^ms-/;
/**
* Hyphenates a camelcased CSS property name, for example:
*
* > hyphenateStyleName('backgroundColor')
* < "background-color"
* > hyphenateStyleName('MozTransition')
* < "-moz-transition"
* > hyphenateStyleName('msTransition')
* < "-ms-transition"
*
* As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
* is converted to `-ms-`.
*
* @param {string} string
* @return {string}
*/
function hyphenateStyleName(string) {
return string.replace(uppercasePattern, '-$1').toLowerCase().replace(msPattern, '-ms-');
} //
function addUnitIfNeeded(name, value) {
// https://github.com/amilajack/eslint-plugin-flowtype-errors/issues/133
// $FlowFixMe
if (value == null || typeof value === 'boolean' || value === '') {
return '';
}
if (typeof value === 'number' && value !== 0 && !(name in _emotion_unitless__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])) {
return value + "px"; // Presumes implicit 'px' suffix for unitless numbers
}
return String(value).trim();
} //
/**
* It's falsish not falsy because 0 is allowed.
*/
var isFalsish = function isFalsish(chunk) {
return chunk === undefined || chunk === null || chunk === false || chunk === '';
};
var objToCssArray = function objToCssArray(obj, prevKey) {
var rules = [];
var keys = Object.keys(obj);
keys.forEach(function (key) {
if (!isFalsish(obj[key])) {
if (isPlainObject(obj[key])) {
rules.push.apply(rules, objToCssArray(obj[key], key));
return rules;
} else if (isFunction(obj[key])) {
rules.push(hyphenateStyleName(key) + ":", obj[key], ';');
return rules;
}
rules.push(hyphenateStyleName(key) + ": " + addUnitIfNeeded(key, obj[key]) + ";");
}
return rules;
});
return prevKey ? [prevKey + " {"].concat(rules, ['}']) : rules;
};
function flatten(chunk, executionContext, styleSheet) {
if (Array.isArray(chunk)) {
var ruleSet = [];
for (var i = 0, len = chunk.length, result; i < len; i += 1) {
result = flatten(chunk[i], executionContext, styleSheet);
if (result === '') continue;else if (Array.isArray(result)) ruleSet.push.apply(ruleSet, result);else ruleSet.push(result);
}
return ruleSet;
}
if (isFalsish(chunk)) {
return '';
}
/* Handle other components */
if (isStyledComponent(chunk)) {
return "." + chunk.styledComponentId;
}
/* Either execute or defer the function */
if (isFunction(chunk)) {
if (isStatelessFunction(chunk) && executionContext) {
var _result = chunk(executionContext);
if (false) {}
return flatten(_result, executionContext, styleSheet);
} else return chunk;
}
if (chunk instanceof Keyframes) {
if (styleSheet) {
chunk.inject(styleSheet);
return chunk.getName();
} else return chunk;
}
/* Handle objects */
return isPlainObject(chunk) ? objToCssArray(chunk) : chunk.toString();
} //
function css(styles) {
for (var _len = arguments.length, interpolations = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
interpolations[_key - 1] = arguments[_key];
}
if (isFunction(styles) || isPlainObject(styles)) {
// $FlowFixMe
return flatten(interleave(EMPTY_ARRAY, [styles].concat(interpolations)));
}
if (interpolations.length === 0 && styles.length === 1 && typeof styles[0] === "string") {
// $FlowFixMe
return styles;
} // $FlowFixMe
return flatten(interleave(styles, interpolations));
}
function constructWithOptions(componentConstructor, tag, options) {
if (options === void 0) {
options = EMPTY_OBJECT;
}
if (!Object(react_is__WEBPACK_IMPORTED_MODULE_0__["isValidElementType"])(tag)) {
return throwStyledComponentsError(1, String(tag));
}
/* This is callable directly as a template function */
// $FlowFixMe: Not typed to avoid destructuring arguments
var templateFunction = function templateFunction() {
return componentConstructor(tag, options, css.apply(void 0, arguments));
};
/* If config methods are called, wrap up a new template function and merge options */
templateFunction.withConfig = function (config) {
return constructWithOptions(componentConstructor, tag, _extends({}, options, {}, config));
};
/* Modify/inject new props at runtime */
templateFunction.attrs = function (attrs) {
return constructWithOptions(componentConstructor, tag, _extends({}, options, {
attrs: Array.prototype.concat(options.attrs, attrs).filter(Boolean)
}));
};
return templateFunction;
}
/* eslint-disable */
/**
mixin-deep; https://github.com/jonschlinkert/mixin-deep
Inlined such that it will be consistently transpiled to an IE-compatible syntax.
The MIT License (MIT)
Copyright (c) 2014-present, Jon Schlinkert.
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 isObject = function isObject(val) {
return typeof val === 'function' || _typeof(val) === 'object' && val !== null && !Array.isArray(val);
};
var isValidKey = function isValidKey(key) {
return key !== '__proto__' && key !== 'constructor' && key !== 'prototype';
};
function mixin(target, val, key) {
var obj = target[key];
if (isObject(val) && isObject(obj)) {
mixinDeep(obj, val);
} else {
target[key] = val;
}
}
function mixinDeep(target) {
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
rest[_key - 1] = arguments[_key];
}
for (var _i = 0, _rest = rest; _i < _rest.length; _i++) {
var obj = _rest[_i];
if (isObject(obj)) {
for (var key in obj) {
if (isValidKey(key)) {
mixin(target, obj[key], key);
}
}
}
}
return target;
} //
/* eslint-disable no-bitwise */
var AD_REPLACER_R = /(a)(d)/gi;
/* This is the "capacity" of our alphabet i.e. 2x26 for all letters plus their capitalised
* counterparts */
var charsLength = 52;
/* start at 75 for 'a' until 'z' (25) and then start at 65 for capitalised letters */
var getAlphabeticChar = function getAlphabeticChar(code) {
return String.fromCharCode(code + (code > 25 ? 39 : 97));
};
/* input a number, usually a hash and convert it to base-52 */
function generateAlphabeticName(code) {
var name = '';
var x;
/* get a char and divide by alphabet-length */
for (x = Math.abs(code); x > charsLength; x = x / charsLength | 0) {
name = getAlphabeticChar(x % charsLength) + name;
}
return (getAlphabeticChar(x % charsLength) + name).replace(AD_REPLACER_R, '$1-$2');
} //
function isStaticRules(rules) {
for (var i = 0; i < rules.length; i += 1) {
var rule = rules[i];
if (isFunction(rule) && !isStyledComponent(rule)) {
// functions are allowed to be static if they're just being
// used to get the classname of a nested styled component
return false;
}
}
return true;
} //
/*
ComponentStyle is all the CSS-specific stuff, not
the React-specific stuff.
*/
var ComponentStyle = /*#__PURE__*/function () {
function ComponentStyle(rules, componentId) {
this.rules = rules;
this.staticRulesId = '';
this.isStatic = true && isStaticRules(rules);
this.componentId = componentId;
this.baseHash = hash(componentId); // NOTE: This registers the componentId, which ensures a consistent order
// for this component's styles compared to others
StyleSheet.registerId(componentId);
}
/*
* Flattens a rule set into valid CSS
* Hashes it, wraps the whole chunk in a .hash1234 {}
* Returns the hash to be injected on render()
* */
var _proto = ComponentStyle.prototype;
_proto.generateAndInjectStyles = function generateAndInjectStyles(executionContext, styleSheet, stylis) {
var componentId = this.componentId; // force dynamic classnames if user-supplied stylis plugins are in use
if (this.isStatic && !stylis.hash) {
if (this.staticRulesId && styleSheet.hasNameForId(componentId, this.staticRulesId)) {
return this.staticRulesId;
}
var cssStatic = flatten(this.rules, executionContext, styleSheet).join('');
var name = generateAlphabeticName(phash(this.baseHash, cssStatic.length) >>> 0);
if (!styleSheet.hasNameForId(componentId, name)) {
var cssStaticFormatted = stylis(cssStatic, "." + name, undefined, componentId);
styleSheet.insertRules(componentId, name, cssStaticFormatted);
}
this.staticRulesId = name;
return name;
} else {
var length = this.rules.length;
var dynamicHash = phash(this.baseHash, stylis.hash);
var css = '';
for (var i = 0; i < length; i++) {
var partRule = this.rules[i];
if (typeof partRule === 'string') {
css += partRule;
if (false) {}
} else {
var partChunk = flatten(partRule, executionContext, styleSheet);
var partString = Array.isArray(partChunk) ? partChunk.join('') : partChunk;
dynamicHash = phash(dynamicHash, partString + i);
css += partString;
}
}
var _name = generateAlphabeticName(dynamicHash >>> 0);
if (!styleSheet.hasNameForId(componentId, _name)) {
var cssFormatted = stylis(css, "." + _name, undefined, componentId);
styleSheet.insertRules(componentId, _name, cssFormatted);
}
return _name;
}
};
return ComponentStyle;
}(); //
var LIMIT = 200;
var createWarnTooManyClasses = function createWarnTooManyClasses(displayName, componentId) {
var generatedClasses = {};
var warningSeen = false;
return function (className) {
if (!warningSeen) {
generatedClasses[className] = true;
if (Object.keys(generatedClasses).length >= LIMIT) {
// Unable to find latestRule in test environment.
/* eslint-disable no-console, prefer-template */
var parsedIdString = componentId ? " with the id of \"" + componentId + "\"" : '';
console.warn("Over " + LIMIT + " classes were generated for component " + displayName + parsedIdString + ".\n" + 'Consider using the attrs method, together with a style object for frequently changed styles.\n' + 'Example:\n' + ' const Component = styled.div.attrs(props => ({\n' + ' style: {\n' + ' background: props.background,\n' + ' },\n' + ' }))`width: 100%;`\n\n' + ' <Component />');
warningSeen = true;
generatedClasses = {};
}
}
};
}; //
var invalidHookCallRe = /invalid hook call/i;
var seen = new Set();
var checkDynamicCreation = function checkDynamicCreation(displayName, componentId) {
if (false) { var message, parsedIdString; }
}; //
var determineTheme = function determineTheme(props, providedTheme, defaultProps) {
if (defaultProps === void 0) {
defaultProps = EMPTY_OBJECT;
}
return props.theme !== defaultProps.theme && props.theme || providedTheme || defaultProps.theme;
}; //
// Source: https://www.w3.org/TR/cssom-1/#serialize-an-identifier
// Control characters and non-letter first symbols are not supported
var escapeRegex = /[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g;
var dashesAtEnds = /(^-|-$)/g;
/**
* TODO: Explore using CSS.escape when it becomes more available
* in evergreen browsers.
*/
function escape(str) {
return str // Replace all possible CSS selectors
.replace(escapeRegex, '-') // Remove extraneous hyphens at the start and end
.replace(dashesAtEnds, '');
} //
function isTag(target) {
return typeof target === 'string' && ( false ? undefined : true);
} //
function generateDisplayName(target) {
// $FlowFixMe
return isTag(target) ? "styled." + target : "Styled(" + getComponentName(target) + ")";
} //
var generateComponentId = function generateComponentId(str) {
return generateAlphabeticName(hash(str) >>> 0);
};
/**
* Convenience function for joining strings to form className chains
*/
function joinStrings(a, b) {
return a && b ? a + " " + b : a || b;
}
var ThemeContext = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createContext();
var ThemeConsumer = ThemeContext.Consumer;
function mergeTheme(theme, outerTheme) {
if (!theme) {
return throwStyledComponentsError(14);
}
if (isFunction(theme)) {
var mergedTheme = theme(outerTheme);
if (false) {}
return mergedTheme;
}
if (Array.isArray(theme) || _typeof(theme) !== 'object') {
return throwStyledComponentsError(8);
}
return outerTheme ? _extends({}, outerTheme, {}, theme) : theme;
}
/**
* Provide a theme to an entire react component tree via context
*/
function ThemeProvider(props) {
var outerTheme = Object(react__WEBPACK_IMPORTED_MODULE_1__["useContext"])(ThemeContext);
var themeContext = Object(react__WEBPACK_IMPORTED_MODULE_1__["useMemo"])(function () {
return mergeTheme(props.theme, outerTheme);
}, [props.theme, outerTheme]);
if (!props.children) {
return null;
}
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(ThemeContext.Provider, {
value: themeContext
}, props.children);
}
/* global $Call */
var identifiers = {};
/* We depend on components having unique IDs */
function generateId(displayName, parentComponentId) {
var name = typeof displayName !== 'string' ? 'sc' : escape(displayName); // Ensure that no displayName can lead to duplicate componentIds
identifiers[name] = (identifiers[name] || 0) + 1;
var componentId = name + "-" + generateComponentId(name + identifiers[name]);
return parentComponentId ? parentComponentId + "-" + componentId : componentId;
}
function useResolvedAttrs(theme, props, attrs) {
if (theme === void 0) {
theme = EMPTY_OBJECT;
} // NOTE: can't memoize this
// returns [context, resolvedAttrs]
// where resolvedAttrs is only the things injected by the attrs themselves
var context = _extends({}, props, {
theme: theme
});
var resolvedAttrs = {};
attrs.forEach(function (attrDef) {
var resolvedAttrDef = attrDef;
var key;
if (isFunction(resolvedAttrDef)) {
resolvedAttrDef = resolvedAttrDef(context);
}
/* eslint-disable guard-for-in */
for (key in resolvedAttrDef) {
context[key] = resolvedAttrs[key] = key === 'className' ? joinStrings(resolvedAttrs[key], resolvedAttrDef[key]) : resolvedAttrDef[key];
}
/* eslint-enable guard-for-in */
});
return [context, resolvedAttrs];
}
function useInjectedStyle(componentStyle, hasAttrs, resolvedAttrs, warnTooManyClasses) {
var styleSheet = useStyleSheet();
var stylis = useStylis(); // statically styled-components don't need to build an execution context object,
// and shouldn't be increasing the number of class names
var isStatic = componentStyle.isStatic && !hasAttrs;
var className = isStatic ? componentStyle.generateAndInjectStyles(EMPTY_OBJECT, styleSheet, stylis) : componentStyle.generateAndInjectStyles(resolvedAttrs, styleSheet, stylis);
Object(react__WEBPACK_IMPORTED_MODULE_1__["useDebugValue"])(className);
if (false) {}
return className;
}
function useStyledComponentImpl(forwardedComponent, props, forwardedRef) {
var componentAttrs = forwardedComponent.attrs,
componentStyle = forwardedComponent.componentStyle,
defaultProps = forwardedComponent.defaultProps,
foldedComponentIds = forwardedComponent.foldedComponentIds,
shouldForwardProp = forwardedComponent.shouldForwardProp,
styledComponentId = forwardedComponent.styledComponentId,
target = forwardedComponent.target;
Object(react__WEBPACK_IMPORTED_MODULE_1__["useDebugValue"])(styledComponentId); // NOTE: the non-hooks version only subscribes to this when !componentStyle.isStatic,
// but that'd be against the rules-of-hooks. We could be naughty and do it anyway as it
// should be an immutable value, but behave for now.
var theme = determineTheme(props, Object(react__WEBPACK_IMPORTED_MODULE_1__["useContext"])(ThemeContext), defaultProps);
var _useResolvedAttrs = useResolvedAttrs(theme || EMPTY_OBJECT, props, componentAttrs),
context = _useResolvedAttrs[0],
attrs = _useResolvedAttrs[1];
var generatedClassName = useInjectedStyle(componentStyle, componentAttrs.length > 0, context, false ? undefined : undefined);
var refToForward = forwardedRef;
var elementToBeCreated = attrs.$as || props.$as || attrs.as || props.as || target;
var isTargetTag = isTag(elementToBeCreated);
var computedProps = attrs !== props ? _extends({}, props, {}, attrs) : props;
var propFilterFn = shouldForwardProp || isTargetTag && _emotion_is_prop_valid__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"];
var propsForElement = {}; // eslint-disable-next-line guard-for-in
for (var key in computedProps) {
if (key[0] === '$' || key === 'as') continue;else if (key === 'forwardedAs') {
propsForElement.as = computedProps[key];
} else if (!propFilterFn || propFilterFn(key, _emotion_is_prop_valid__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])) {
// Don't pass through non HTML tags through to HTML elements
propsForElement[key] = computedProps[key];
}
}
if (props.style && attrs.style !== props.style) {
propsForElement.style = _extends({}, props.style, {}, attrs.style);
}
propsForElement.className = Array.prototype.concat(foldedComponentIds, styledComponentId, generatedClassName !== styledComponentId ? generatedClassName : null, props.className, attrs.className).filter(Boolean).join(' ');
propsForElement.ref = refToForward;
return /*#__PURE__*/Object(react__WEBPACK_IMPORTED_MODULE_1__["createElement"])(elementToBeCreated, propsForElement);
}
function createStyledComponent(target, options, rules) {
var isTargetStyledComp = isStyledComponent(target);
var isCompositeComponent = !isTag(target);
var _options$displayName = options.displayName,
displayName = _options$displayName === void 0 ? generateDisplayName(target) : _options$displayName,
_options$componentId = options.componentId,
componentId = _options$componentId === void 0 ? generateId(options.displayName, options.parentComponentId) : _options$componentId,
_options$attrs = options.attrs,
attrs = _options$attrs === void 0 ? EMPTY_ARRAY : _options$attrs;
var styledComponentId = options.displayName && options.componentId ? escape(options.displayName) + "-" + options.componentId : options.componentId || componentId; // fold the underlying StyledComponent attrs up (implicit extend)
var finalAttrs = // $FlowFixMe
isTargetStyledComp && target.attrs ? Array.prototype.concat(target.attrs, attrs).filter(Boolean) : attrs; // eslint-disable-next-line prefer-destructuring
var shouldForwardProp = options.shouldForwardProp; // $FlowFixMe
if (isTargetStyledComp && target.shouldForwardProp) {
if (shouldForwardProp) {
// compose nested shouldForwardProp calls
shouldForwardProp = function shouldForwardProp(prop, filterFn) {
return (// $FlowFixMe
target.shouldForwardProp(prop, filterFn) && options.shouldForwardProp(prop, filterFn)
);
};
} else {
// eslint-disable-next-line prefer-destructuring
shouldForwardProp = target.shouldForwardProp;
}
}
var componentStyle = new ComponentStyle(isTargetStyledComp ? // fold the underlying StyledComponent rules up (implicit extend)
// $FlowFixMe
target.componentStyle.rules.concat(rules) : rules, styledComponentId);
/**
* forwardRef creates a new interim component, which we'll take advantage of
* instead of extending ParentComponent to create _another_ interim class
*/
var WrappedStyledComponent; // eslint-disable-next-line react-hooks/rules-of-hooks
var forwardRef = function forwardRef(props, ref) {
return useStyledComponentImpl(WrappedStyledComponent, props, ref);
};
forwardRef.displayName = displayName; // $FlowFixMe this is a forced cast to merge it StyledComponentWrapperProperties
WrappedStyledComponent = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.forwardRef(forwardRef);
WrappedStyledComponent.attrs = finalAttrs;
WrappedStyledComponent.componentStyle = componentStyle;
WrappedStyledComponent.displayName = displayName;
WrappedStyledComponent.shouldForwardProp = shouldForwardProp; // this static is used to preserve the cascade of static classes for component selector
// purposes; this is especially important with usage of the css prop
WrappedStyledComponent.foldedComponentIds = isTargetStyledComp ? // $FlowFixMe
Array.prototype.concat(target.foldedComponentIds, target.styledComponentId) : EMPTY_ARRAY;
WrappedStyledComponent.styledComponentId = styledComponentId; // fold the underlying StyledComponent target up since we folded the styles
WrappedStyledComponent.target = isTargetStyledComp ? // $FlowFixMe
target.target : target; // $FlowFixMe
WrappedStyledComponent.withComponent = function withComponent(tag) {
var previousComponentId = options.componentId,
optionsToCopy = _objectWithoutPropertiesLoose(options, ["componentId"]);
var newComponentId = previousComponentId && previousComponentId + "-" + (isTag(tag) ? tag : escape(getComponentName(tag)));
var newOptions = _extends({}, optionsToCopy, {
attrs: finalAttrs,
componentId: newComponentId
});
return createStyledComponent(tag, newOptions, rules);
}; // $FlowFixMe
Object.defineProperty(WrappedStyledComponent, 'defaultProps', {
get: function get() {
return this._foldedDefaultProps;
},
set: function set(obj) {
// $FlowFixMe
this._foldedDefaultProps = isTargetStyledComp ? mixinDeep({}, target.defaultProps, obj) : obj;
}
});
if (false) {} // $FlowFixMe
WrappedStyledComponent.toString = function () {
return "." + WrappedStyledComponent.styledComponentId;
};
if (isCompositeComponent) {
hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_6___default()(WrappedStyledComponent, target, {
// all SC-specific things should not be hoisted
attrs: true,
componentStyle: true,
displayName: true,
foldedComponentIds: true,
shouldForwardProp: true,
self: true,
styledComponentId: true,
target: true,
withComponent: true
});
}
return WrappedStyledComponent;
} //
// Thanks to ReactDOMFactories for this handy list!
var domElements = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr', // SVG
'circle', 'clipPath', 'defs', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'marker', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan']; //
var styled = function styled(tag) {
return constructWithOptions(createStyledComponent, tag);
}; // Shorthands for all valid HTML Elements
domElements.forEach(function (domElement) {
styled[domElement] = styled(domElement);
}); //
var GlobalStyle = /*#__PURE__*/function () {
function GlobalStyle(rules, componentId) {
this.rules = rules;
this.componentId = componentId;
this.isStatic = isStaticRules(rules);
}
var _proto = GlobalStyle.prototype;
_proto.createStyles = function createStyles(instance, executionContext, styleSheet, stylis) {
var flatCSS = flatten(this.rules, executionContext, styleSheet);
var css = stylis(flatCSS.join(''), '');
var id = this.componentId + instance; // NOTE: We use the id as a name as well, since these rules never change
styleSheet.insertRules(id, id, css);
};
_proto.removeStyles = function removeStyles(instance, styleSheet) {
styleSheet.clearRules(this.componentId + instance);
};
_proto.renderStyles = function renderStyles(instance, executionContext, styleSheet, stylis) {
StyleSheet.registerId(this.componentId + instance); // NOTE: Remove old styles, then inject the new ones
this.removeStyles(instance, styleSheet);
this.createStyles(instance, executionContext, styleSheet, stylis);
};
return GlobalStyle;
}();
function createGlobalStyle(strings) {
for (var _len = arguments.length, interpolations = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
interpolations[_key - 1] = arguments[_key];
}
var rules = css.apply(void 0, [strings].concat(interpolations));
var styledComponentId = "sc-global-" + generateComponentId(JSON.stringify(rules));
var globalStyle = new GlobalStyle(rules, styledComponentId);
if (false) {}
function GlobalStyleComponent(props) {
var styleSheet = useStyleSheet();
var stylis = useStylis();
var theme = Object(react__WEBPACK_IMPORTED_MODULE_1__["useContext"])(ThemeContext);
var instanceRef = Object(react__WEBPACK_IMPORTED_MODULE_1__["useRef"])(null);
if (instanceRef.current === null) {
instanceRef.current = styleSheet.allocateGSInstance(styledComponentId);
}
var instance = instanceRef.current;
if (false) {}
if (false) {}
if (globalStyle.isStatic) {
globalStyle.renderStyles(instance, STATIC_EXECUTION_CONTEXT, styleSheet, stylis);
} else {
var context = _extends({}, props, {
theme: determineTheme(props, theme, GlobalStyleComponent.defaultProps)
});
globalStyle.renderStyles(instance, context, styleSheet, stylis);
}
Object(react__WEBPACK_IMPORTED_MODULE_1__["useEffect"])(function () {
return function () {
return globalStyle.removeStyles(instance, styleSheet);
};
}, EMPTY_ARRAY);
return null;
} // $FlowFixMe
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.memo(GlobalStyleComponent);
} //
function keyframes(strings) {
/* Warning if you've used keyframes on React Native */
if (false) {}
for (var _len = arguments.length, interpolations = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
interpolations[_key - 1] = arguments[_key];
}
var rules = css.apply(void 0, [strings].concat(interpolations)).join('');
var name = generateComponentId(rules);
return new Keyframes(name, [rules, name, '@keyframes']);
}
var ServerStyleSheet = /*#__PURE__*/function () {
function ServerStyleSheet() {
var _this = this;
this._emitSheetCSS = function () {
var css = _this.instance.toString();
var nonce = getNonce();
var attrs = [nonce && "nonce=\"" + nonce + "\"", SC_ATTR + "=\"true\"", SC_ATTR_VERSION + "=\"" + SC_VERSION + "\""];
var htmlAttr = attrs.filter(Boolean).join(' ');
return "<style " + htmlAttr + ">" + css + "</style>";
};
this.getStyleTags = function () {
if (_this.sealed) {
return throwStyledComponentsError(2);
}
return _this._emitSheetCSS();
};
this.getStyleElement = function () {
var _props;
if (_this.sealed) {
return throwStyledComponentsError(2);
}
var props = (_props = {}, _props[SC_ATTR] = '', _props[SC_ATTR_VERSION] = SC_VERSION, _props.dangerouslySetInnerHTML = {
__html: _this.instance.toString()
}, _props);
var nonce = getNonce();
if (nonce) {
props.nonce = nonce;
} // v4 returned an array for this fn, so we'll do the same for v5 for backward compat
return [/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement("style", _extends({}, props, {
key: "sc-0-0"
}))];
};
this.seal = function () {
_this.sealed = true;
};
this.instance = new StyleSheet({
isServer: true
});
this.sealed = false;
}
var _proto = ServerStyleSheet.prototype;
_proto.collectStyles = function collectStyles(children) {
if (this.sealed) {
return throwStyledComponentsError(2);
}
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(StyleSheetManager, {
sheet: this.instance
}, children);
}; // eslint-disable-next-line consistent-return
_proto.interleaveWithNodeStream = function interleaveWithNodeStream(input) {
{
return throwStyledComponentsError(3);
}
};
return ServerStyleSheet;
}(); // export default <Config: { theme?: any }, Instance>(
// Component: AbstractComponent<Config, Instance>
// ): AbstractComponent<$Diff<Config, { theme?: any }> & { theme?: any }, Instance>
//
// but the old build system tooling doesn't support the syntax
var withTheme = function withTheme(Component) {
// $FlowFixMe This should be React.forwardRef<Config, Instance>
var WithTheme = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.forwardRef(function (props, ref) {
var theme = Object(react__WEBPACK_IMPORTED_MODULE_1__["useContext"])(ThemeContext); // $FlowFixMe defaultProps isn't declared so it can be inferrable
var defaultProps = Component.defaultProps;
var themeProp = determineTheme(props, theme, defaultProps);
if (false) {}
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default.a.createElement(Component, _extends({}, props, {
theme: themeProp,
ref: ref
}));
});
hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_6___default()(WithTheme, Component);
WithTheme.displayName = "WithTheme(" + getComponentName(Component) + ")";
return WithTheme;
}; //
var useTheme = function useTheme() {
return Object(react__WEBPACK_IMPORTED_MODULE_1__["useContext"])(ThemeContext);
}; //
var __PRIVATE__ = {
StyleSheet: StyleSheet,
masterSheet: masterSheet
}; //
/* Define bundle version for export */
var version = "5.1.1";
/* Warning if you've imported this file on React Native */
if (false) {}
/* Warning if there are several instances of styled-components */
if (false) {}
/* harmony default export */ __webpack_exports__["b"] = (styled);
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(12)))
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
if (true) {
module.exports = __webpack_require__(23);
} else {}
/***/ }),
/* 3 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Util; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return $; });
/* unused harmony export __extends */
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
// DOM simplifier (no jQuery dependency)
// NodeJS compatible
var $ = function $(sel, root) {
if (root == null) {
root = document;
}
if (_typeof(sel) === "object") {
return sel;
}
return root.querySelector(sel);
};
var __extends = function __extends(child, parent) {
for (var key in parent) {
if ({}.hasOwnProperty.call(parent, key)) child[key] = parent[key];
}
function ctor() {
this.constructor = child;
}
ctor.prototype = parent.prototype;
child.prototype = new ctor();
child.__super__ = parent.prototype;
return child;
};
var Util = /*#__PURE__*/function () {
function Util() {
_classCallCheck(this, Util);
}
_createClass(Util, null, [{
key: "initClass",
value: function initClass() {
// Unique value utility
this.uniqid = function () {
var id = 0;
return {
get: function get() {
return id++;
}
};
}();
} // Helper function that extends one object with all the properies of other objects
}, {
key: "extend",
value: function extend(obj) {
var dest = obj;
for (var _len = arguments.length, src = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
src[_key - 1] = arguments[_key];
}
for (var _i = 0, _Array$from = Array.from(src); _i < _Array$from.length; _i++) {
var copy = _Array$from[_i];
for (var _i2 = 0, _Object$keys = Object.keys(copy || {}); _i2 < _Object$keys.length; _i2++) {
var prop = _Object$keys[_i2];
dest[prop] = copy[prop];
}
}
return dest;
} // In order to stay true to the latest spec, RGB values must be clamped between
// 0 and 255. If we don't do this, weird things happen.
}, {
key: "clampRGB",
value: function clampRGB(val) {
if (val < 0) {
return 0;
}
if (val > 255) {
return 255;
}
return val;
}
}, {
key: "copyAttributes",
value: function copyAttributes(from, to, opts) {
if (opts == null) {
opts = {};
}
return function () {
var result = [];
for (var _i3 = 0, _Array$from2 = Array.from(from.attributes); _i3 < _Array$from2.length; _i3++) {
var attr = _Array$from2[_i3];
if (opts.except != null && Array.from(opts.except).includes(attr.nodeName)) {
continue;
}
result.push(to.setAttribute(attr.nodeName, attr.nodeValue));
}
return result;
}();
} // Support for browsers that don't know Uint8Array (such as IE9)
}, {
key: "dataArray",
value: function dataArray(length) {
if (length == null) {
length = 0;
}
if (Caman.NodeJS || window.Uint8Array != null) {
return new Uint8Array(length);
}
return new Array(length);
}
}]);
return Util;
}();
Util.initClass();
/***/ }),
/* 4 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Log; });
function Logger() {
var name, _i, _len, _ref;
_ref = ['log', 'info', 'warn', 'error'];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
name = _ref[_i];
this[name] = function (name) {
return function () {
var args, e;
args = 1 <= arguments.length ? [].slice.call(arguments, 0) : [];
if (!Caman.DEBUG) {
return;
}
try {
return console[name].apply(console, args);
} catch (_error) {
e = _error;
return console[name](args);
}
};
}(name);
}
this.debug = this.log;
}
var Log = new Logger();
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
(function (global, factory) {
( false ? undefined : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? factory(exports) : true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : (undefined);
})(this, function (exports) {
'use strict';
/* eslint-disable no-undefined,no-param-reassign,no-shadow */
/**
* Throttle execution of a function. Especially useful for rate limiting
* execution of handlers on events like resize and scroll.
*
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
* @param {boolean} [noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds while the
* throttled-function is being called. If noTrailing is false or unspecified, callback will be executed one final time
* after the last throttled-function call. (After the throttled-function has not been called for `delay` milliseconds,
* the internal counter is reset).
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
* to `callback` when the throttled-function is executed.
* @param {boolean} [debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is false (at end),
* schedule `callback` to execute after `delay` ms.
*
* @returns {Function} A new, throttled, function.
*/
function throttle(delay, noTrailing, callback, debounceMode) {
/*
* After wrapper has stopped being called, this timeout ensures that
* `callback` is executed at the proper times in `throttle` and `end`
* debounce modes.
*/
var timeoutID;
var cancelled = false; // Keep track of the last time `callback` was executed.
var lastExec = 0; // Function to clear existing timeout
function clearExistingTimeout() {
if (timeoutID) {
clearTimeout(timeoutID);
}
} // Function to cancel next exec
function cancel() {
clearExistingTimeout();
cancelled = true;
} // `noTrailing` defaults to falsy.
if (typeof noTrailing !== 'boolean') {
debounceMode = callback;
callback = noTrailing;
noTrailing = undefined;
}
/*
* The `wrapper` function encapsulates all of the throttling / debouncing
* functionality and when executed will limit the rate at which `callback`
* is executed.
*/
function wrapper() {
for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {
arguments_[_key] = arguments[_key];
}
var self = this;
var elapsed = Date.now() - lastExec;
if (cancelled) {
return;
} // Execute `callback` and update the `lastExec` timestamp.
function exec() {
lastExec = Date.now();
callback.apply(self, arguments_);
}
/*
* If `debounceMode` is true (at begin) this is used to clear the flag
* to allow future `callback` executions.
*/
function clear() {
timeoutID = undefined;
}
if (debounceMode && !timeoutID) {
/*
* Since `wrapper` is being called for the first time and
* `debounceMode` is true (at begin), execute `callback`.
*/
exec();
}
clearExistingTimeout();
if (debounceMode === undefined && elapsed > delay) {
/*
* In throttle mode, if `delay` time has been exceeded, execute
* `callback`.
*/
exec();
} else if (noTrailing !== true) {
/*
* In trailing throttle mode, since `delay` time has not been
* exceeded, schedule `callback` to execute `delay` ms after most
* recent execution.
*
* If `debounceMode` is true (at begin), schedule `clear` to execute
* after `delay` ms.
*
* If `debounceMode` is false (at end), schedule `callback` to
* execute after `delay` ms.
*/
timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
}
}
wrapper.cancel = cancel; // Return the wrapper function.
return wrapper;
}
/* eslint-disable no-undefined */
/**
* Debounce execution of a function. Debouncing, unlike throttling,
* guarantees that a function is only executed a single time, either at the
* very beginning of a series of calls, or at the very end.
*
* @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
* @param {boolean} [atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds
* after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.
* (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).
* @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
* to `callback` when the debounced-function is executed.
*
* @returns {Function} A new, debounced function.
*/
function debounce(delay, atBegin, callback) {
return callback === undefined ? throttle(delay, atBegin, false) : throttle(delay, callback, atBegin !== false);
}
exports.debounce = debounce;
exports.throttle = throttle;
Object.defineProperty(exports, '__esModule', {
value: true
});
});
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function checkDCE() {
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined' || typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== 'function') {
return;
}
if (false) {}
try {
// Verify that the code above has been dead code eliminated (DCE'd).
__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);
} catch (err) {
// DevTools shouldn't crash React, no matter what.
// We should still report in case we break this code.
console.error(err);
}
}
if (true) {
// DCE check should happen before ReactDOM bundle executes so that
// DevTools can report bad minification during injection.
checkDCE();
module.exports = __webpack_require__(22);
} else {}
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
if (true) {
module.exports = __webpack_require__(26);
} else {}
/***/ }),
/* 8 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var Store = /*#__PURE__*/function () {
function Store() {
_classCallCheck(this, Store);
}
_createClass(Store, null, [{
key: "initClass",
value: function initClass() {
this.items = {};
}
}, {
key: "has",
value: function has(search) {
return this.items[search] != null;
}
}, {
key: "get",
value: function get(search) {
return this.items[search];
}
}, {
key: "put",
value: function put(name, obj) {
return this.items[name] = obj;
}
}, {
key: "execute",
value: function execute(search, callback) {
var _this = this;
setTimeout(function () {
return callback.call(_this.get(search), _this.get(search));
}, 0);
return this.get(search);
}
}, {
key: "flush",
value: function flush(name) {
if (name == null) {
name = false;
}
if (name) {
return delete this.items[name];
} else {
return this.items = {};
}
}
}]);
return Store;
}();
Store.initClass();
/* harmony default export */ __webpack_exports__["a"] = (Store);
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
/* eslint-disable no-unused-vars */
function _extends() { _extends = Object.assign || 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; }; return _extends.apply(this, arguments); }
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
function toObject(val) {
if (val === null || val === undefined) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
function shouldUseNative() {
try {
if (!Object.assign) {
return false;
} // Detect buggy property enumeration order in older V8 versions.
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
test1[5] = 'de';
if (Object.getOwnPropertyNames(test1)[0] === '5') {
return false;
} // https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test2 = {};
for (var i = 0; i < 10; i++) {
test2['_' + String.fromCharCode(i)] = i;
}
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
return test2[n];
});
if (order2.join('') !== '0123456789') {
return false;
} // https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test3 = {};
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
test3[letter] = letter;
});
if (Object.keys(_extends({}, test3)).join('') !== 'abcdefghijklmnopqrst') {
return false;
}
return true;
} catch (err) {
// We don't expect any of the above to throw, but better to be safe.
return false;
}
}
module.exports = shouldUseNative() ? Object.assign : function (target, source) {
var from;
var to = toObject(target);
var symbols;
for (var s = 1; s < arguments.length; s++) {
from = Object(arguments[s]);
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
if (getOwnPropertySymbols) {
symbols = getOwnPropertySymbols(from);
for (var i = 0; i < symbols.length; i++) {
if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
}
}
}
}
return to;
};
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var reactIs = __webpack_require__(7);
/**
* Copyright 2015, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
var REACT_STATICS = {
childContextTypes: true,
contextType: true,
contextTypes: true,
defaultProps: true,
displayName: true,
getDefaultProps: true,
getDerivedStateFromError: true,
getDerivedStateFromProps: true,
mixins: true,
propTypes: true,
type: true
};
var KNOWN_STATICS = {
name: true,
length: true,
prototype: true,
caller: true,
callee: true,
arguments: true,
arity: true
};
var FORWARD_REF_STATICS = {
'$$typeof': true,
render: true,
defaultProps: true,
displayName: true,
propTypes: true
};
var MEMO_STATICS = {
'$$typeof': true,
compare: true,
defaultProps: true,
displayName: true,
propTypes: true,
type: true
};
var TYPE_STATICS = {};
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
function getStatics(component) {
// React v16.11 and below
if (reactIs.isMemo(component)) {
return MEMO_STATICS;
} // React v16.12 and above
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
}
var defineProperty = Object.defineProperty;
var getOwnPropertyNames = Object.getOwnPropertyNames;
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
var getPrototypeOf = Object.getPrototypeOf;
var objectPrototype = Object.prototype;
function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
if (typeof sourceComponent !== 'string') {
// don't hoist over string (html) components
if (objectPrototype) {
var inheritedComponent = getPrototypeOf(sourceComponent);
if (inheritedComponent && inheritedComponent !== objectPrototype) {
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
}
}
var keys = getOwnPropertyNames(sourceComponent);
if (getOwnPropertySymbols) {
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
}
var targetStatics = getStatics(targetComponent);
var sourceStatics = getStatics(sourceComponent);
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
try {
// Avoid failures from read-only properties
defineProperty(targetComponent, key, descriptor);
} catch (e) {}
}
}
}
return targetComponent;
}
module.exports = hoistNonReactStatics;
/***/ }),
/* 11 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// CONCATENATED MODULE: ./node_modules/@emotion/memoize/dist/memoize.browser.esm.js
function memoize(fn) {
var cache = {};
return function (arg) {
if (cache[arg] === undefined) cache[arg] = fn(arg);
return cache[arg];
};
}
/* harmony default export */ var memoize_browser_esm = (memoize);
// CONCATENATED MODULE: ./node_modules/@emotion/is-prop-valid/dist/is-prop-valid.browser.esm.js
var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|inert|itemProp|itemScope|itemType|itemID|itemRef|on|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
var index = memoize_browser_esm(function (prop) {
return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
/* o */
&& prop.charCodeAt(1) === 110
/* n */
&& prop.charCodeAt(2) < 91;
}
/* Z+1 */
);
/* harmony default export */ var is_prop_valid_browser_esm = __webpack_exports__["a"] = (index);
/***/ }),
/* 12 */
/***/ (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;
};
/***/ }),
/* 13 */
/***/ (function(module, exports) {
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var g; // This works in non-strict mode
g = function () {
return this;
}();
try {
// This works if eval is allowed (see CSP)
g = g || new Function("return this")();
} catch (e) {
// This works if the window reference is available
if ((typeof window === "undefined" ? "undefined" : _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;
/***/ }),
/* 14 */
/***/ (function(module, exports) {
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
//
module.exports = function shallowEqual(objA, objB, compare, compareContext) {
var ret = compare ? compare.call(compareContext, objA, objB) : void 0;
if (ret !== void 0) {
return !!ret;
}
if (objA === objB) {
return true;
}
if (_typeof(objA) !== "object" || !objA || _typeof(objB) !== "object" || !objB) {
return false;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); // Test for A's keys different from B.
for (var idx = 0; idx < keysA.length; idx++) {
var key = keysA[idx];
if (!bHasOwnProperty(key)) {
return false;
}
var valueA = objA[key];
var valueB = objB[key];
ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;
if (ret === false || ret === void 0 && valueA !== valueB) {
return false;
}
}
return true;
};
/***/ }),
/* 15 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function stylis_min(W) {
function M(d, c, e, h, a) {
for (var m = 0, b = 0, v = 0, n = 0, q, g, x = 0, K = 0, k, u = k = q = 0, l = 0, r = 0, I = 0, t = 0, B = e.length, J = B - 1, y, f = '', p = '', F = '', G = '', C; l < B;) {
g = e.charCodeAt(l);
l === J && 0 !== b + n + v + m && (0 !== b && (g = 47 === b ? 10 : 47), n = v = m = 0, B++, J++);
if (0 === b + n + v + m) {
if (l === J && (0 < r && (f = f.replace(N, '')), 0 < f.trim().length)) {
switch (g) {
case 32:
case 9:
case 59:
case 13:
case 10:
break;
default:
f += e.charAt(l);
}
g = 59;
}
switch (g) {
case 123:
f = f.trim();
q = f.charCodeAt(0);
k = 1;
for (t = ++l; l < B;) {
switch (g = e.charCodeAt(l)) {
case 123:
k++;
break;
case 125:
k--;
break;
case 47:
switch (g = e.charCodeAt(l + 1)) {
case 42:
case 47:
a: {
for (u = l + 1; u < J; ++u) {
switch (e.charCodeAt(u)) {
case 47:
if (42 === g && 42 === e.charCodeAt(u - 1) && l + 2 !== u) {
l = u + 1;
break a;
}
break;
case 10:
if (47 === g) {
l = u + 1;
break a;
}
}
}
l = u;
}
}
break;
case 91:
g++;
case 40:
g++;
case 34:
case 39:
for (; l++ < J && e.charCodeAt(l) !== g;) {}
}
if (0 === k) break;
l++;
}
k = e.substring(t, l);
0 === q && (q = (f = f.replace(ca, '').trim()).charCodeAt(0));
switch (q) {
case 64:
0 < r && (f = f.replace(N, ''));
g = f.charCodeAt(1);
switch (g) {
case 100:
case 109:
case 115:
case 45:
r = c;
break;
default:
r = O;
}
k = M(c, r, k, g, a + 1);
t = k.length;
0 < A && (r = X(O, f, I), C = H(3, k, r, c, D, z, t, g, a, h), f = r.join(''), void 0 !== C && 0 === (t = (k = C.trim()).length) && (g = 0, k = ''));
if (0 < t) switch (g) {
case 115:
f = f.replace(da, ea);
case 100:
case 109:
case 45:
k = f + '{' + k + '}';
break;
case 107:
f = f.replace(fa, '$1 $2');
k = f + '{' + k + '}';
k = 1 === w || 2 === w && L('@' + k, 3) ? '@-webkit-' + k + '@' + k : '@' + k;
break;
default:
k = f + k, 112 === h && (k = (p += k, ''));
} else k = '';
break;
default:
k = M(c, X(c, f, I), k, h, a + 1);
}
F += k;
k = I = r = u = q = 0;
f = '';
g = e.charCodeAt(++l);
break;
case 125:
case 59:
f = (0 < r ? f.replace(N, '') : f).trim();
if (1 < (t = f.length)) switch (0 === u && (q = f.charCodeAt(0), 45 === q || 96 < q && 123 > q) && (t = (f = f.replace(' ', ':')).length), 0 < A && void 0 !== (C = H(1, f, c, d, D, z, p.length, h, a, h)) && 0 === (t = (f = C.trim()).length) && (f = '\x00\x00'), q = f.charCodeAt(0), g = f.charCodeAt(1), q) {
case 0:
break;
case 64:
if (105 === g || 99 === g) {
G += f + e.charAt(l);
break;
}
default:
58 !== f.charCodeAt(t - 1) && (p += P(f, q, g, f.charCodeAt(2)));
}
I = r = u = q = 0;
f = '';
g = e.charCodeAt(++l);
}
}
switch (g) {
case 13:
case 10:
47 === b ? b = 0 : 0 === 1 + q && 107 !== h && 0 < f.length && (r = 1, f += '\x00');
0 < A * Y && H(0, f, c, d, D, z, p.length, h, a, h);
z = 1;
D++;
break;
case 59:
case 125:
if (0 === b + n + v + m) {
z++;
break;
}
default:
z++;
y = e.charAt(l);
switch (g) {
case 9:
case 32:
if (0 === n + m + b) switch (x) {
case 44:
case 58:
case 9:
case 32:
y = '';
break;
default:
32 !== g && (y = ' ');
}
break;
case 0:
y = '\\0';
break;
case 12:
y = '\\f';
break;
case 11:
y = '\\v';
break;
case 38:
0 === n + b + m && (r = I = 1, y = '\f' + y);
break;
case 108:
if (0 === n + b + m + E && 0 < u) switch (l - u) {
case 2:
112 === x && 58 === e.charCodeAt(l - 3) && (E = x);
case 8:
111 === K && (E = K);
}
break;
case 58:
0 === n + b + m && (u = l);
break;
case 44:
0 === b + v + n + m && (r = 1, y += '\r');
break;
case 34:
case 39:
0 === b && (n = n === g ? 0 : 0 === n ? g : n);
break;
case 91:
0 === n + b + v && m++;
break;
case 93:
0 === n + b + v && m--;
break;
case 41:
0 === n + b + m && v--;
break;
case 40:
if (0 === n + b + m) {
if (0 === q) switch (2 * x + 3 * K) {
case 533:
break;
default:
q = 1;
}
v++;
}
break;
case 64:
0 === b + v + n + m + u + k && (k = 1);
break;
case 42:
case 47:
if (!(0 < n + m + v)) switch (b) {
case 0:
switch (2 * g + 3 * e.charCodeAt(l + 1)) {
case 235:
b = 47;
break;
case 220:
t = l, b = 42;
}
break;
case 42:
47 === g && 42 === x && t + 2 !== l && (33 === e.charCodeAt(t + 2) && (p += e.substring(t, l + 1)), y = '', b = 0);
}
}
0 === b && (f += y);
}
K = x;
x = g;
l++;
}
t = p.length;
if (0 < t) {
r = c;
if (0 < A && (C = H(2, p, r, d, D, z, t, h, a, h), void 0 !== C && 0 === (p = C).length)) return G + p + F;
p = r.join(',') + '{' + p + '}';
if (0 !== w * E) {
2 !== w || L(p, 2) || (E = 0);
switch (E) {
case 111:
p = p.replace(ha, ':-moz-$1') + p;
break;
case 112:
p = p.replace(Q, '::-webkit-input-$1') + p.replace(Q, '::-moz-$1') + p.replace(Q, ':-ms-input-$1') + p;
}
E = 0;
}
}
return G + p + F;
}
function X(d, c, e) {
var h = c.trim().split(ia);
c = h;
var a = h.length,
m = d.length;
switch (m) {
case 0:
case 1:
var b = 0;
for (d = 0 === m ? '' : d[0] + ' '; b < a; ++b) {
c[b] = Z(d, c[b], e).trim();
}
break;
default:
var v = b = 0;
for (c = []; b < a; ++b) {
for (var n = 0; n < m; ++n) {
c[v++] = Z(d[n] + ' ', h[b], e).trim();
}
}
}
return c;
}
function Z(d, c, e) {
var h = c.charCodeAt(0);
33 > h && (h = (c = c.trim()).charCodeAt(0));
switch (h) {
case 38:
return c.replace(F, '$1' + d.trim());
case 58:
return d.trim() + c.replace(F, '$1' + d.trim());
default:
if (0 < 1 * e && 0 < c.indexOf('\f')) return c.replace(F, (58 === d.charCodeAt(0) ? '' : '$1') + d.trim());
}
return d + c;
}
function P(d, c, e, h) {
var a = d + ';',
m = 2 * c + 3 * e + 4 * h;
if (944 === m) {
d = a.indexOf(':', 9) + 1;
var b = a.substring(d, a.length - 1).trim();
b = a.substring(0, d).trim() + b + ';';
return 1 === w || 2 === w && L(b, 1) ? '-webkit-' + b + b : b;
}
if (0 === w || 2 === w && !L(a, 1)) return a;
switch (m) {
case 1015:
return 97 === a.charCodeAt(10) ? '-webkit-' + a + a : a;
case 951:
return 116 === a.charCodeAt(3) ? '-webkit-' + a + a : a;
case 963:
return 110 === a.charCodeAt(5) ? '-webkit-' + a + a : a;
case 1009:
if (100 !== a.charCodeAt(4)) break;
case 969:
case 942:
return '-webkit-' + a + a;
case 978:
return '-webkit-' + a + '-moz-' + a + a;
case 1019:
case 983:
return '-webkit-' + a + '-moz-' + a + '-ms-' + a + a;
case 883:
if (45 === a.charCodeAt(8)) return '-webkit-' + a + a;
if (0 < a.indexOf('image-set(', 11)) return a.replace(ja, '$1-webkit-$2') + a;
break;
case 932:
if (45 === a.charCodeAt(4)) switch (a.charCodeAt(5)) {
case 103:
return '-webkit-box-' + a.replace('-grow', '') + '-webkit-' + a + '-ms-' + a.replace('grow', 'positive') + a;
case 115:
return '-webkit-' + a + '-ms-' + a.replace('shrink', 'negative') + a;
case 98:
return '-webkit-' + a + '-ms-' + a.replace('basis', 'preferred-size') + a;
}
return '-webkit-' + a + '-ms-' + a + a;
case 964:
return '-webkit-' + a + '-ms-flex-' + a + a;
case 1023:
if (99 !== a.charCodeAt(8)) break;
b = a.substring(a.indexOf(':', 15)).replace('flex-', '').replace('space-between', 'justify');
return '-webkit-box-pack' + b + '-webkit-' + a + '-ms-flex-pack' + b + a;
case 1005:
return ka.test(a) ? a.replace(aa, ':-webkit-') + a.replace(aa, ':-moz-') + a : a;
case 1e3:
b = a.substring(13).trim();
c = b.indexOf('-') + 1;
switch (b.charCodeAt(0) + b.charCodeAt(c)) {
case 226:
b = a.replace(G, 'tb');
break;
case 232:
b = a.replace(G, 'tb-rl');
break;
case 220:
b = a.replace(G, 'lr');
break;
default:
return a;
}
return '-webkit-' + a + '-ms-' + b + a;
case 1017:
if (-1 === a.indexOf('sticky', 9)) break;
case 975:
c = (a = d).length - 10;
b = (33 === a.charCodeAt(c) ? a.substring(0, c) : a).substring(d.indexOf(':', 7) + 1).trim();
switch (m = b.charCodeAt(0) + (b.charCodeAt(7) | 0)) {
case 203:
if (111 > b.charCodeAt(8)) break;
case 115:
a = a.replace(b, '-webkit-' + b) + ';' + a;
break;
case 207:
case 102:
a = a.replace(b, '-webkit-' + (102 < m ? 'inline-' : '') + 'box') + ';' + a.replace(b, '-webkit-' + b) + ';' + a.replace(b, '-ms-' + b + 'box') + ';' + a;
}
return a + ';';
case 938:
if (45 === a.charCodeAt(5)) switch (a.charCodeAt(6)) {
case 105:
return b = a.replace('-items', ''), '-webkit-' + a + '-webkit-box-' + b + '-ms-flex-' + b + a;
case 115:
return '-webkit-' + a + '-ms-flex-item-' + a.replace(ba, '') + a;
default:
return '-webkit-' + a + '-ms-flex-line-pack' + a.replace('align-content', '').replace(ba, '') + a;
}
break;
case 973:
case 989:
if (45 !== a.charCodeAt(3) || 122 === a.charCodeAt(4)) break;
case 931:
case 953:
if (!0 === la.test(d)) return 115 === (b = d.substring(d.indexOf(':') + 1)).charCodeAt(0) ? P(d.replace('stretch', 'fill-available'), c, e, h).replace(':fill-available', ':stretch') : a.replace(b, '-webkit-' + b) + a.replace(b, '-moz-' + b.replace('fill-', '')) + a;
break;
case 962:
if (a = '-webkit-' + a + (102 === a.charCodeAt(5) ? '-ms-' + a : '') + a, 211 === e + h && 105 === a.charCodeAt(13) && 0 < a.indexOf('transform', 10)) return a.substring(0, a.indexOf(';', 27) + 1).replace(ma, '$1-webkit-$2') + a;
}
return a;
}
function L(d, c) {
var e = d.indexOf(1 === c ? ':' : '{'),
h = d.substring(0, 3 !== c ? e : 10);
e = d.substring(e + 1, d.length - 1);
return R(2 !== c ? h : h.replace(na, '$1'), e, c);
}
function ea(d, c) {
var e = P(c, c.charCodeAt(0), c.charCodeAt(1), c.charCodeAt(2));
return e !== c + ';' ? e.replace(oa, ' or ($1)').substring(4) : '(' + c + ')';
}
function H(d, c, e, h, a, m, b, v, n, q) {
for (var g = 0, x = c, w; g < A; ++g) {
switch (w = S[g].call(B, d, x, e, h, a, m, b, v, n, q)) {
case void 0:
case !1:
case !0:
case null:
break;
default:
x = w;
}
}
if (x !== c) return x;
}
function T(d) {
switch (d) {
case void 0:
case null:
A = S.length = 0;
break;
default:
if ('function' === typeof d) S[A++] = d;else if ('object' === _typeof(d)) for (var c = 0, e = d.length; c < e; ++c) {
T(d[c]);
} else Y = !!d | 0;
}
return T;
}
function U(d) {
d = d.prefix;
void 0 !== d && (R = null, d ? 'function' !== typeof d ? w = 1 : (w = 2, R = d) : w = 0);
return U;
}
function B(d, c) {
var e = d;
33 > e.charCodeAt(0) && (e = e.trim());
V = e;
e = [V];
if (0 < A) {
var h = H(-1, c, e, e, D, z, 0, 0, 0, 0);
void 0 !== h && 'string' === typeof h && (c = h);
}
var a = M(O, e, c, 0, 0);
0 < A && (h = H(-2, a, e, e, D, z, a.length, 0, 0, 0), void 0 !== h && (a = h));
V = '';
E = 0;
z = D = 1;
return a;
}
var ca = /^\0+/g,
N = /[\0\r\f]/g,
aa = /: */g,
ka = /zoo|gra/,
ma = /([,: ])(transform)/g,
ia = /,\r+?/g,
F = /([\t\r\n ])*\f?&/g,
fa = /@(k\w+)\s*(\S*)\s*/,
Q = /::(place)/g,
ha = /:(read-only)/g,
G = /[svh]\w+-[tblr]{2}/,
da = /\(\s*(.*)\s*\)/g,
oa = /([\s\S]*?);/g,
ba = /-self|flex-/g,
na = /[^]*?(:[rp][el]a[\w-]+)[^]*/,
la = /stretch|:\s*\w+\-(?:conte|avail)/,
ja = /([^-])(image-set\()/,
z = 1,
D = 1,
E = 0,
w = 1,
O = [],
S = [],
A = 0,
R = null,
Y = 0,
V = '';
B.use = T;
B.set = U;
void 0 !== W && U(W);
return B;
}
/* harmony default export */ __webpack_exports__["a"] = (stylis_min);
/***/ }),
/* 16 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var unitlessKeys = {
animationIterationCount: 1,
borderImageOutset: 1,
borderImageSlice: 1,
borderImageWidth: 1,
boxFlex: 1,
boxFlexGroup: 1,
boxOrdinalGroup: 1,
columnCount: 1,
columns: 1,
flex: 1,
flexGrow: 1,
flexPositive: 1,
flexShrink: 1,
flexNegative: 1,
flexOrder: 1,
gridRow: 1,
gridRowEnd: 1,
gridRowSpan: 1,
gridRowStart: 1,
gridColumn: 1,
gridColumnEnd: 1,
gridColumnSpan: 1,
gridColumnStart: 1,
msGridRow: 1,
msGridRowSpan: 1,
msGridColumn: 1,
msGridColumnSpan: 1,
fontWeight: 1,
lineHeight: 1,
opacity: 1,
order: 1,
orphans: 1,
tabSize: 1,
widows: 1,
zIndex: 1,
zoom: 1,
WebkitLineClamp: 1,
// SVG-related properties
fillOpacity: 1,
floodOpacity: 1,
stopOpacity: 1,
strokeDasharray: 1,
strokeDashoffset: 1,
strokeMiterlimit: 1,
strokeOpacity: 1,
strokeWidth: 1
};
/* harmony default export */ __webpack_exports__["a"] = (unitlessKeys);
/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process, global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
/*
* [js-sha1]{@link https://github.com/emn178/js-sha1}
*
* @version 0.6.0
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2014-2017
* @license MIT
*/
/*jslint bitwise: true */
(function () {
'use strict';
var root = (typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' ? window : {};
var NODE_JS = !root.JS_SHA1_NO_NODE_JS && (typeof process === "undefined" ? "undefined" : _typeof(process)) === 'object' && process.versions && process.versions.node;
if (NODE_JS) {
root = global;
}
var COMMON_JS = !root.JS_SHA1_NO_COMMON_JS && ( false ? undefined : _typeof(module)) === 'object' && module.exports;
var AMD = true && __webpack_require__(29);
var HEX_CHARS = '0123456789abcdef'.split('');
var EXTRA = [-2147483648, 8388608, 32768, 128];
var SHIFT = [24, 16, 8, 0];
var OUTPUT_TYPES = ['hex', 'array', 'digest', 'arrayBuffer'];
var blocks = [];
var createOutputMethod = function createOutputMethod(outputType) {
return function (message) {
return new Sha1(true).update(message)[outputType]();
};
};
var createMethod = function createMethod() {
var method = createOutputMethod('hex');
if (NODE_JS) {
method = nodeWrap(method);
}
method.create = function () {
return new Sha1();
};
method.update = function (message) {
return method.create().update(message);
};
for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
var type = OUTPUT_TYPES[i];
method[type] = createOutputMethod(type);
}
return method;
};
var nodeWrap = function nodeWrap(method) {
var crypto = eval("require('crypto')");
var Buffer = eval("require('buffer').Buffer");
var nodeMethod = function nodeMethod(message) {
if (typeof message === 'string') {
return crypto.createHash('sha1').update(message, 'utf8').digest('hex');
} else if (message.constructor === ArrayBuffer) {
message = new Uint8Array(message);
} else if (message.length === undefined) {
return method(message);
}
return crypto.createHash('sha1').update(new Buffer(message)).digest('hex');
};
return nodeMethod;
};
function Sha1(sharedMemory) {
if (sharedMemory) {
blocks[0] = blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
this.blocks = blocks;
} else {
this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
}
this.h0 = 0x67452301;
this.h1 = 0xEFCDAB89;
this.h2 = 0x98BADCFE;
this.h3 = 0x10325476;
this.h4 = 0xC3D2E1F0;
this.block = this.start = this.bytes = this.hBytes = 0;
this.finalized = this.hashed = false;
this.first = true;
}
Sha1.prototype.update = function (message) {
if (this.finalized) {
return;
}
var notString = typeof message !== 'string';
if (notString && message.constructor === root.ArrayBuffer) {
message = new Uint8Array(message);
}
var code,
index = 0,
i,
length = message.length || 0,
blocks = this.blocks;
while (index < length) {
if (this.hashed) {
this.hashed = false;
blocks[0] = this.block;
blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
}
if (notString) {
for (i = this.start; index < length && i < 64; ++index) {
blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];
}
} else {
for (i = this.start; index < length && i < 64; ++index) {
code = message.charCodeAt(index);
if (code < 0x80) {
blocks[i >> 2] |= code << SHIFT[i++ & 3];
} else if (code < 0x800) {
blocks[i >> 2] |= (0xc0 | code >> 6) << SHIFT[i++ & 3];
blocks[i >> 2] |= (0x80 | code & 0x3f) << SHIFT[i++ & 3];
} else if (code < 0xd800 || code >= 0xe000) {
blocks[i >> 2] |= (0xe0 | code >> 12) << SHIFT[i++ & 3];
blocks[i >> 2] |= (0x80 | code >> 6 & 0x3f) << SHIFT[i++ & 3];
blocks[i >> 2] |= (0x80 | code & 0x3f) << SHIFT[i++ & 3];
} else {
code = 0x10000 + ((code & 0x3ff) << 10 | message.charCodeAt(++index) & 0x3ff);
blocks[i >> 2] |= (0xf0 | code >> 18) << SHIFT[i++ & 3];
blocks[i >> 2] |= (0x80 | code >> 12 & 0x3f) << SHIFT[i++ & 3];
blocks[i >> 2] |= (0x80 | code >> 6 & 0x3f) << SHIFT[i++ & 3];
blocks[i >> 2] |= (0x80 | code & 0x3f) << SHIFT[i++ & 3];
}
}
}
this.lastByteIndex = i;
this.bytes += i - this.start;
if (i >= 64) {
this.block = blocks[16];
this.start = i - 64;
this.hash();
this.hashed = true;
} else {
this.start = i;
}
}
if (this.bytes > 4294967295) {
this.hBytes += this.bytes / 4294967296 << 0;
this.bytes = this.bytes % 4294967296;
}
return this;
};
Sha1.prototype.finalize = function () {
if (this.finalized) {
return;
}
this.finalized = true;
var blocks = this.blocks,
i = this.lastByteIndex;
blocks[16] = this.block;
blocks[i >> 2] |= EXTRA[i & 3];
this.block = blocks[16];
if (i >= 56) {
if (!this.hashed) {
this.hash();
}
blocks[0] = this.block;
blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
}
blocks[14] = this.hBytes << 3 | this.bytes >>> 29;
blocks[15] = this.bytes << 3;
this.hash();
};
Sha1.prototype.hash = function () {
var a = this.h0,
b = this.h1,
c = this.h2,
d = this.h3,
e = this.h4;
var f,
j,
t,
blocks = this.blocks;
for (j = 16; j < 80; ++j) {
t = blocks[j - 3] ^ blocks[j - 8] ^ blocks[j - 14] ^ blocks[j - 16];
blocks[j] = t << 1 | t >>> 31;
}
for (j = 0; j < 20; j += 5) {
f = b & c | ~b & d;
t = a << 5 | a >>> 27;
e = t + f + e + 1518500249 + blocks[j] << 0;
b = b << 30 | b >>> 2;
f = a & b | ~a & c;
t = e << 5 | e >>> 27;
d = t + f + d + 1518500249 + blocks[j + 1] << 0;
a = a << 30 | a >>> 2;
f = e & a | ~e & b;
t = d << 5 | d >>> 27;
c = t + f + c + 1518500249 + blocks[j + 2] << 0;
e = e << 30 | e >>> 2;
f = d & e | ~d & a;
t = c << 5 | c >>> 27;
b = t + f + b + 1518500249 + blocks[j + 3] << 0;
d = d << 30 | d >>> 2;
f = c & d | ~c & e;
t = b << 5 | b >>> 27;
a = t + f + a + 1518500249 + blocks[j + 4] << 0;
c = c << 30 | c >>> 2;
}
for (; j < 40; j += 5) {
f = b ^ c ^ d;
t = a << 5 | a >>> 27;
e = t + f + e + 1859775393 + blocks[j] << 0;
b = b << 30 | b >>> 2;
f = a ^ b ^ c;
t = e << 5 | e >>> 27;
d = t + f + d + 1859775393 + blocks[j + 1] << 0;
a = a << 30 | a >>> 2;
f = e ^ a ^ b;
t = d << 5 | d >>> 27;
c = t + f + c + 1859775393 + blocks[j + 2] << 0;
e = e << 30 | e >>> 2;
f = d ^ e ^ a;
t = c << 5 | c >>> 27;
b = t + f + b + 1859775393 + blocks[j + 3] << 0;
d = d << 30 | d >>> 2;
f = c ^ d ^ e;
t = b << 5 | b >>> 27;
a = t + f + a + 1859775393 + blocks[j + 4] << 0;
c = c << 30 | c >>> 2;
}
for (; j < 60; j += 5) {
f = b & c | b & d | c & d;
t = a << 5 | a >>> 27;
e = t + f + e - 1894007588 + blocks[j] << 0;
b = b << 30 | b >>> 2;
f = a & b | a & c | b & c;
t = e << 5 | e >>> 27;
d = t + f + d - 1894007588 + blocks[j + 1] << 0;
a = a << 30 | a >>> 2;
f = e & a | e & b | a & b;
t = d << 5 | d >>> 27;
c = t + f + c - 1894007588 + blocks[j + 2] << 0;
e = e << 30 | e >>> 2;
f = d & e | d & a | e & a;
t = c << 5 | c >>> 27;
b = t + f + b - 1894007588 + blocks[j + 3] << 0;
d = d << 30 | d >>> 2;
f = c & d | c & e | d & e;
t = b << 5 | b >>> 27;
a = t + f + a - 1894007588 + blocks[j + 4] << 0;
c = c << 30 | c >>> 2;
}
for (; j < 80; j += 5) {
f = b ^ c ^ d;
t = a << 5 | a >>> 27;
e = t + f + e - 899497514 + blocks[j] << 0;
b = b << 30 | b >>> 2;
f = a ^ b ^ c;
t = e << 5 | e >>> 27;
d = t + f + d - 899497514 + blocks[j + 1] << 0;
a = a << 30 | a >>> 2;
f = e ^ a ^ b;
t = d << 5 | d >>> 27;
c = t + f + c - 899497514 + blocks[j + 2] << 0;
e = e << 30 | e >>> 2;
f = d ^ e ^ a;
t = c << 5 | c >>> 27;
b = t + f + b - 899497514 + blocks[j + 3] << 0;
d = d << 30 | d >>> 2;
f = c ^ d ^ e;
t = b << 5 | b >>> 27;
a = t + f + a - 899497514 + blocks[j + 4] << 0;
c = c << 30 | c >>> 2;
}
this.h0 = this.h0 + a << 0;
this.h1 = this.h1 + b << 0;
this.h2 = this.h2 + c << 0;
this.h3 = this.h3 + d << 0;
this.h4 = this.h4 + e << 0;
};
Sha1.prototype.hex = function () {
this.finalize();
var h0 = this.h0,
h1 = this.h1,
h2 = this.h2,
h3 = this.h3,
h4 = this.h4;
return HEX_CHARS[h0 >> 28 & 0x0F] + HEX_CHARS[h0 >> 24 & 0x0F] + HEX_CHARS[h0 >> 20 & 0x0F] + HEX_CHARS[h0 >> 16 & 0x0F] + HEX_CHARS[h0 >> 12 & 0x0F] + HEX_CHARS[h0 >> 8 & 0x0F] + HEX_CHARS[h0 >> 4 & 0x0F] + HEX_CHARS[h0 & 0x0F] + HEX_CHARS[h1 >> 28 & 0x0F] + HEX_CHARS[h1 >> 24 & 0x0F] + HEX_CHARS[h1 >> 20 & 0x0F] + HEX_CHARS[h1 >> 16 & 0x0F] + HEX_CHARS[h1 >> 12 & 0x0F] + HEX_CHARS[h1 >> 8 & 0x0F] + HEX_CHARS[h1 >> 4 & 0x0F] + HEX_CHARS[h1 & 0x0F] + HEX_CHARS[h2 >> 28 & 0x0F] + HEX_CHARS[h2 >> 24 & 0x0F] + HEX_CHARS[h2 >> 20 & 0x0F] + HEX_CHARS[h2 >> 16 & 0x0F] + HEX_CHARS[h2 >> 12 & 0x0F] + HEX_CHARS[h2 >> 8 & 0x0F] + HEX_CHARS[h2 >> 4 & 0x0F] + HEX_CHARS[h2 & 0x0F] + HEX_CHARS[h3 >> 28 & 0x0F] + HEX_CHARS[h3 >> 24 & 0x0F] + HEX_CHARS[h3 >> 20 & 0x0F] + HEX_CHARS[h3 >> 16 & 0x0F] + HEX_CHARS[h3 >> 12 & 0x0F] + HEX_CHARS[h3 >> 8 & 0x0F] + HEX_CHARS[h3 >> 4 & 0x0F] + HEX_CHARS[h3 & 0x0F] + HEX_CHARS[h4 >> 28 & 0x0F] + HEX_CHARS[h4 >> 24 & 0x0F] + HEX_CHARS[h4 >> 20 & 0x0F] + HEX_CHARS[h4 >> 16 & 0x0F] + HEX_CHARS[h4 >> 12 & 0x0F] + HEX_CHARS[h4 >> 8 & 0x0F] + HEX_CHARS[h4 >> 4 & 0x0F] + HEX_CHARS[h4 & 0x0F];
};
Sha1.prototype.toString = Sha1.prototype.hex;
Sha1.prototype.digest = function () {
this.finalize();
var h0 = this.h0,
h1 = this.h1,
h2 = this.h2,
h3 = this.h3,
h4 = this.h4;
return [h0 >> 24 & 0xFF, h0 >> 16 & 0xFF, h0 >> 8 & 0xFF, h0 & 0xFF, h1 >> 24 & 0xFF, h1 >> 16 & 0xFF, h1 >> 8 & 0xFF, h1 & 0xFF, h2 >> 24 & 0xFF, h2 >> 16 & 0xFF, h2 >> 8 & 0xFF, h2 & 0xFF, h3 >> 24 & 0xFF, h3 >> 16 & 0xFF, h3 >> 8 & 0xFF, h3 & 0xFF, h4 >> 24 & 0xFF, h4 >> 16 & 0xFF, h4 >> 8 & 0xFF, h4 & 0xFF];
};
Sha1.prototype.array = Sha1.prototype.digest;
Sha1.prototype.arrayBuffer = function () {
this.finalize();
var buffer = new ArrayBuffer(20);
var dataView = new DataView(buffer);
dataView.setUint32(0, this.h0);
dataView.setUint32(4, this.h1);
dataView.setUint32(8, this.h2);
dataView.setUint32(12, this.h3);
dataView.setUint32(16, this.h4);
return buffer;
};
var exports = createMethod();
if (COMMON_JS) {
module.exports = exports;
} else {
root.sha1 = exports;
if (AMD) {
!(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
return exports;
}).call(exports, __webpack_require__, exports, module),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
}
})();
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(12), __webpack_require__(13), __webpack_require__(28)(module)))
/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof2(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
/*!
* Cropper.js v1.5.12
* https://fengyuanchen.github.io/cropperjs
*
* Copyright 2015-present Chen Fengyuan
* Released under the MIT license
*
* Date: 2021-06-12T08:00:17.411Z
*/
(function (global, factory) {
( false ? undefined : _typeof2(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : true ? !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
__WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : (undefined);
})(this, function () {
'use strict';
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) {
symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
}
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a 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;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(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) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _toConsumableArray(arr) {
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
}
function _arrayWithoutHoles(arr) {
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
}
function _iterableToArray(iter) {
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) {
arr2[i] = arr[i];
}
return arr2;
}
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
var IS_BROWSER = typeof window !== 'undefined' && typeof window.document !== 'undefined';
var WINDOW = IS_BROWSER ? window : {};
var IS_TOUCH_DEVICE = IS_BROWSER && WINDOW.document.documentElement ? 'ontouchstart' in WINDOW.document.documentElement : false;
var HAS_POINTER_EVENT = IS_BROWSER ? 'PointerEvent' in WINDOW : false;
var NAMESPACE = 'cropper'; // Actions
var ACTION_ALL = 'all';
var ACTION_CROP = 'crop';
var ACTION_MOVE = 'move';
var ACTION_ZOOM = 'zoom';
var ACTION_EAST = 'e';
var ACTION_WEST = 'w';
var ACTION_SOUTH = 's';
var ACTION_NORTH = 'n';
var ACTION_NORTH_EAST = 'ne';
var ACTION_NORTH_WEST = 'nw';
var ACTION_SOUTH_EAST = 'se';
var ACTION_SOUTH_WEST = 'sw'; // Classes
var CLASS_CROP = "".concat(NAMESPACE, "-crop");
var CLASS_DISABLED = "".concat(NAMESPACE, "-disabled");
var CLASS_HIDDEN = "".concat(NAMESPACE, "-hidden");
var CLASS_HIDE = "".concat(NAMESPACE, "-hide");
var CLASS_INVISIBLE = "".concat(NAMESPACE, "-invisible");
var CLASS_MODAL = "".concat(NAMESPACE, "-modal");
var CLASS_MOVE = "".concat(NAMESPACE, "-move"); // Data keys
var DATA_ACTION = "".concat(NAMESPACE, "Action");
var DATA_PREVIEW = "".concat(NAMESPACE, "Preview"); // Drag modes
var DRAG_MODE_CROP = 'crop';
var DRAG_MODE_MOVE = 'move';
var DRAG_MODE_NONE = 'none'; // Events
var EVENT_CROP = 'crop';
var EVENT_CROP_END = 'cropend';
var EVENT_CROP_MOVE = 'cropmove';
var EVENT_CROP_START = 'cropstart';
var EVENT_DBLCLICK = 'dblclick';
var EVENT_TOUCH_START = IS_TOUCH_DEVICE ? 'touchstart' : 'mousedown';
var EVENT_TOUCH_MOVE = IS_TOUCH_DEVICE ? 'touchmove' : 'mousemove';
var EVENT_TOUCH_END = IS_TOUCH_DEVICE ? 'touchend touchcancel' : 'mouseup';
var EVENT_POINTER_DOWN = HAS_POINTER_EVENT ? 'pointerdown' : EVENT_TOUCH_START;
var EVENT_POINTER_MOVE = HAS_POINTER_EVENT ? 'pointermove' : EVENT_TOUCH_MOVE;
var EVENT_POINTER_UP = HAS_POINTER_EVENT ? 'pointerup pointercancel' : EVENT_TOUCH_END;
var EVENT_READY = 'ready';
var EVENT_RESIZE = 'resize';
var EVENT_WHEEL = 'wheel';
var EVENT_ZOOM = 'zoom'; // Mime types
var MIME_TYPE_JPEG = 'image/jpeg'; // RegExps
var REGEXP_ACTIONS = /^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/;
var REGEXP_DATA_URL = /^data:/;
var REGEXP_DATA_URL_JPEG = /^data:image\/jpeg;base64,/;
var REGEXP_TAG_NAME = /^img|canvas$/i; // Misc
// Inspired by the default width and height of a canvas element.
var MIN_CONTAINER_WIDTH = 200;
var MIN_CONTAINER_HEIGHT = 100;
var DEFAULTS = {
// Define the view mode of the cropper
viewMode: 0,
// 0, 1, 2, 3
// Define the dragging mode of the cropper
dragMode: DRAG_MODE_CROP,
// 'crop', 'move' or 'none'
// Define the initial aspect ratio of the crop box
initialAspectRatio: NaN,
// Define the aspect ratio of the crop box
aspectRatio: NaN,
// An object with the previous cropping result data
data: null,
// A selector for adding extra containers to preview
preview: '',
// Re-render the cropper when resize the window
responsive: true,
// Restore the cropped area after resize the window
restore: true,
// Check if the current image is a cross-origin image
checkCrossOrigin: true,
// Check the current image's Exif Orientation information
checkOrientation: true,
// Show the black modal
modal: true,
// Show the dashed lines for guiding
guides: true,
// Show the center indicator for guiding
center: true,
// Show the white modal to highlight the crop box
highlight: true,
// Show the grid background
background: true,
// Enable to crop the image automatically when initialize
autoCrop: true,
// Define the percentage of automatic cropping area when initializes
autoCropArea: 0.8,
// Enable to move the image
movable: true,
// Enable to rotate the image
rotatable: true,
// Enable to scale the image
scalable: true,
// Enable to zoom the image
zoomable: true,
// Enable to zoom the image by dragging touch
zoomOnTouch: true,
// Enable to zoom the image by wheeling mouse
zoomOnWheel: true,
// Define zoom ratio when zoom the image by wheeling mouse
wheelZoomRatio: 0.1,
// Enable to move the crop box
cropBoxMovable: true,
// Enable to resize the crop box
cropBoxResizable: true,
// Toggle drag mode between "crop" and "move" when click twice on the cropper
toggleDragModeOnDblclick: true,
// Size limitation
minCanvasWidth: 0,
minCanvasHeight: 0,
minCropBoxWidth: 0,
minCropBoxHeight: 0,
minContainerWidth: MIN_CONTAINER_WIDTH,
minContainerHeight: MIN_CONTAINER_HEIGHT,
// Shortcuts of events
ready: null,
cropstart: null,
cropmove: null,
cropend: null,
crop: null,
zoom: null
};
var TEMPLATE = '<div class="cropper-container" touch-action="none">' + '<div class="cropper-wrap-box">' + '<div class="cropper-canvas"></div>' + '</div>' + '<div class="cropper-drag-box"></div>' + '<div class="cropper-crop-box">' + '<span class="cropper-view-box"></span>' + '<span class="cropper-dashed dashed-h"></span>' + '<span class="cropper-dashed dashed-v"></span>' + '<span class="cropper-center"></span>' + '<span class="cropper-face"></span>' + '<span class="cropper-line line-e" data-cropper-action="e"></span>' + '<span class="cropper-line line-n" data-cropper-action="n"></span>' + '<span class="cropper-line line-w" data-cropper-action="w"></span>' + '<span class="cropper-line line-s" data-cropper-action="s"></span>' + '<span class="cropper-point point-e" data-cropper-action="e"></span>' + '<span class="cropper-point point-n" data-cropper-action="n"></span>' + '<span class="cropper-point point-w" data-cropper-action="w"></span>' + '<span class="cropper-point point-s" data-cropper-action="s"></span>' + '<span class="cropper-point point-ne" data-cropper-action="ne"></span>' + '<span class="cropper-point point-nw" data-cropper-action="nw"></span>' + '<span class="cropper-point point-sw" data-cropper-action="sw"></span>' + '<span class="cropper-point point-se" data-cropper-action="se"></span>' + '</div>' + '</div>';
/**
* Check if the given value is not a number.
*/
var isNaN = Number.isNaN || WINDOW.isNaN;
/**
* Check if the given value is a number.
* @param {*} value - The value to check.
* @returns {boolean} Returns `true` if the given value is a number, else `false`.
*/
function isNumber(value) {
return typeof value === 'number' && !isNaN(value);
}
/**
* Check if the given value is a positive number.
* @param {*} value - The value to check.
* @returns {boolean} Returns `true` if the given value is a positive number, else `false`.
*/
var isPositiveNumber = function isPositiveNumber(value) {
return value > 0 && value < Infinity;
};
/**
* Check if the given value is undefined.
* @param {*} value - The value to check.
* @returns {boolean} Returns `true` if the given value is undefined, else `false`.
*/
function isUndefined(value) {
return typeof value === 'undefined';
}
/**
* Check if the given value is an object.
* @param {*} value - The value to check.
* @returns {boolean} Returns `true` if the given value is an object, else `false`.
*/
function isObject(value) {
return _typeof(value) === 'object' && value !== null;
}
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**
* Check if the given value is a plain object.
* @param {*} value - The value to check.
* @returns {boolean} Returns `true` if the given value is a plain object, else `false`.
*/
function isPlainObject(value) {
if (!isObject(value)) {
return false;
}
try {
var _constructor = value.constructor;
var prototype = _constructor.prototype;
return _constructor && prototype && hasOwnProperty.call(prototype, 'isPrototypeOf');
} catch (error) {
return false;
}
}
/**
* Check if the given value is a function.
* @param {*} value - The value to check.
* @returns {boolean} Returns `true` if the given value is a function, else `false`.
*/
function isFunction(value) {
return typeof value === 'function';
}
var slice = Array.prototype.slice;
/**
* Convert array-like or iterable object to an array.
* @param {*} value - The value to convert.
* @returns {Array} Returns a new array.
*/
function toArray(value) {
return Array.from ? Array.from(value) : slice.call(value);
}
/**
* Iterate the given data.
* @param {*} data - The data to iterate.
* @param {Function} callback - The process function for each element.
* @returns {*} The original data.
*/
function forEach(data, callback) {
if (data && isFunction(callback)) {
if (Array.isArray(data) || isNumber(data.length)
/* array-like */
) {
toArray(data).forEach(function (value, key) {
callback.call(data, value, key, data);
});
} else if (isObject(data)) {
Object.keys(data).forEach(function (key) {
callback.call(data, data[key], key, data);
});
}
}
return data;
}
/**
* Extend the given object.
* @param {*} target - The target object to extend.
* @param {*} args - The rest objects for merging to the target object.
* @returns {Object} The extended object.
*/
var assign = Object.assign || function assign(target) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
if (isObject(target) && args.length > 0) {
args.forEach(function (arg) {
if (isObject(arg)) {
Object.keys(arg).forEach(function (key) {
target[key] = arg[key];
});
}
});
}
return target;
};
var REGEXP_DECIMALS = /\.\d*(?:0|9){12}\d*$/;
/**
* Normalize decimal number.
* Check out {@link https://0.30000000000000004.com/}
* @param {number} value - The value to normalize.
* @param {number} [times=100000000000] - The times for normalizing.
* @returns {number} Returns the normalized number.
*/
function normalizeDecimalNumber(value) {
var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100000000000;
return REGEXP_DECIMALS.test(value) ? Math.round(value * times) / times : value;
}
var REGEXP_SUFFIX = /^width|height|left|top|marginLeft|marginTop$/;
/**
* Apply styles to the given element.
* @param {Element} element - The target element.
* @param {Object} styles - The styles for applying.
*/
function setStyle(element, styles) {
var style = element.style;
forEach(styles, function (value, property) {
if (REGEXP_SUFFIX.test(property) && isNumber(value)) {
value = "".concat(value, "px");
}
style[property] = value;
});
}
/**
* Check if the given element has a special class.
* @param {Element} element - The element to check.
* @param {string} value - The class to search.
* @returns {boolean} Returns `true` if the special class was found.
*/
function hasClass(element, value) {
return element.classList ? element.classList.contains(value) : element.className.indexOf(value) > -1;
}
/**
* Add classes to the given element.
* @param {Element} element - The target element.
* @param {string} value - The classes to be added.
*/
function addClass(element, value) {
if (!value) {
return;
}
if (isNumber(element.length)) {
forEach(element, function (elem) {
addClass(elem, value);
});
return;
}
if (element.classList) {
element.classList.add(value);
return;
}
var className = element.className.trim();
if (!className) {
element.className = value;
} else if (className.indexOf(value) < 0) {
element.className = "".concat(className, " ").concat(value);
}
}
/**
* Remove classes from the given element.
* @param {Element} element - The target element.
* @param {string} value - The classes to be removed.
*/
function removeClass(element, value) {
if (!value) {
return;
}
if (isNumber(element.length)) {
forEach(element, function (elem) {
removeClass(elem, value);
});
return;
}
if (element.classList) {
element.classList.remove(value);
return;
}
if (element.className.indexOf(value) >= 0) {
element.className = element.className.replace(value, '');
}
}
/**
* Add or remove classes from the given element.
* @param {Element} element - The target element.
* @param {string} value - The classes to be toggled.
* @param {boolean} added - Add only.
*/
function toggleClass(element, value, added) {
if (!value) {
return;
}
if (isNumber(element.length)) {
forEach(element, function (elem) {
toggleClass(elem, value, added);
});
return;
} // IE10-11 doesn't support the second parameter of `classList.toggle`
if (added) {
addClass(element, value);
} else {
removeClass(element, value);
}
}
var REGEXP_CAMEL_CASE = /([a-z\d])([A-Z])/g;
/**
* Transform the given string from camelCase to kebab-case
* @param {string} value - The value to transform.
* @returns {string} The transformed value.
*/
function toParamCase(value) {
return value.replace(REGEXP_CAMEL_CASE, '$1-$2').toLowerCase();
}
/**
* Get data from the given element.
* @param {Element} element - The target element.
* @param {string} name - The data key to get.
* @returns {string} The data value.
*/
function getData(element, name) {
if (isObject(element[name])) {
return element[name];
}
if (element.dataset) {
return element.dataset[name];
}
return element.getAttribute("data-".concat(toParamCase(name)));
}
/**
* Set data to the given element.
* @param {Element} element - The target element.
* @param {string} name - The data key to set.
* @param {string} data - The data value.
*/
function setData(element, name, data) {
if (isObject(data)) {
element[name] = data;
} else if (element.dataset) {
element.dataset[name] = data;
} else {
element.setAttribute("data-".concat(toParamCase(name)), data);
}
}
/**
* Remove data from the given element.
* @param {Element} element - The target element.
* @param {string} name - The data key to remove.
*/
function removeData(element, name) {
if (isObject(element[name])) {
try {
delete element[name];
} catch (error) {
element[name] = undefined;
}
} else if (element.dataset) {
// #128 Safari not allows to delete dataset property
try {
delete element.dataset[name];
} catch (error) {
element.dataset[name] = undefined;
}
} else {
element.removeAttribute("data-".concat(toParamCase(name)));
}
}
var REGEXP_SPACES = /\s\s*/;
var onceSupported = function () {
var supported = false;
if (IS_BROWSER) {
var once = false;
var listener = function listener() {};
var options = Object.defineProperty({}, 'once', {
get: function get() {
supported = true;
return once;
},
/**
* This setter can fix a `TypeError` in strict mode
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Getter_only}
* @param {boolean} value - The value to set
*/
set: function set(value) {
once = value;
}
});
WINDOW.addEventListener('test', listener, options);
WINDOW.removeEventListener('test', listener, options);
}
return supported;
}();
/**
* Remove event listener from the target element.
* @param {Element} element - The event target.
* @param {string} type - The event type(s).
* @param {Function} listener - The event listener.
* @param {Object} options - The event options.
*/
function removeListener(element, type, listener) {
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
var handler = listener;
type.trim().split(REGEXP_SPACES).forEach(function (event) {
if (!onceSupported) {
var listeners = element.listeners;
if (listeners && listeners[event] && listeners[event][listener]) {
handler = listeners[event][listener];
delete listeners[event][listener];
if (Object.keys(listeners[event]).length === 0) {
delete listeners[event];
}
if (Object.keys(listeners).length === 0) {
delete element.listeners;
}
}
}
element.removeEventListener(event, handler, options);
});
}
/**
* Add event listener to the target element.
* @param {Element} element - The event target.
* @param {string} type - The event type(s).
* @param {Function} listener - The event listener.
* @param {Object} options - The event options.
*/
function addListener(element, type, listener) {
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
var _handler = listener;
type.trim().split(REGEXP_SPACES).forEach(function (event) {
if (options.once && !onceSupported) {
var _element$listeners = element.listeners,
listeners = _element$listeners === void 0 ? {} : _element$listeners;
_handler = function handler() {
delete listeners[event][listener];
element.removeEventListener(event, _handler, options);
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
listener.apply(element, args);
};
if (!listeners[event]) {
listeners[event] = {};
}
if (listeners[event][listener]) {
element.removeEventListener(event, listeners[event][listener], options);
}
listeners[event][listener] = _handler;
element.listeners = listeners;
}
element.addEventListener(event, _handler, options);
});
}
/**
* Dispatch event on the target element.
* @param {Element} element - The event target.
* @param {string} type - The event type(s).
* @param {Object} data - The additional event data.
* @returns {boolean} Indicate if the event is default prevented or not.
*/
function dispatchEvent(element, type, data) {
var event; // Event and CustomEvent on IE9-11 are global objects, not constructors
if (isFunction(Event) && isFunction(CustomEvent)) {
event = new CustomEvent(type, {
detail: data,
bubbles: true,
cancelable: true
});
} else {
event = document.createEvent('CustomEvent');
event.initCustomEvent(type, true, true, data);
}
return element.dispatchEvent(event);
}
/**
* Get the offset base on the document.
* @param {Element} element - The target element.
* @returns {Object} The offset data.
*/
function getOffset(element) {
var box = element.getBoundingClientRect();
return {
left: box.left + (window.pageXOffset - document.documentElement.clientLeft),
top: box.top + (window.pageYOffset - document.documentElement.clientTop)
};
}
var location = WINDOW.location;
var REGEXP_ORIGINS = /^(\w+:)\/\/([^:/?#]*):?(\d*)/i;
/**
* Check if the given URL is a cross origin URL.
* @param {string} url - The target URL.
* @returns {boolean} Returns `true` if the given URL is a cross origin URL, else `false`.
*/
function isCrossOriginURL(url) {
var parts = url.match(REGEXP_ORIGINS);
return parts !== null && (parts[1] !== location.protocol || parts[2] !== location.hostname || parts[3] !== location.port);
}
/**
* Add timestamp to the given URL.
* @param {string} url - The target URL.
* @returns {string} The result URL.
*/
function addTimestamp(url) {
var timestamp = "timestamp=".concat(new Date().getTime());
return url + (url.indexOf('?') === -1 ? '?' : '&') + timestamp;
}
/**
* Get transforms base on the given object.
* @param {Object} obj - The target object.
* @returns {string} A string contains transform values.
*/
function getTransforms(_ref) {
var rotate = _ref.rotate,
scaleX = _ref.scaleX,
scaleY = _ref.scaleY,
translateX = _ref.translateX,
translateY = _ref.translateY;
var values = [];
if (isNumber(translateX) && translateX !== 0) {
values.push("translateX(".concat(translateX, "px)"));
}
if (isNumber(translateY) && translateY !== 0) {
values.push("translateY(".concat(translateY, "px)"));
} // Rotate should come first before scale to match orientation transform
if (isNumber(rotate) && rotate !== 0) {
values.push("rotate(".concat(rotate, "deg)"));
}
if (isNumber(scaleX) && scaleX !== 1) {
values.push("scaleX(".concat(scaleX, ")"));
}
if (isNumber(scaleY) && scaleY !== 1) {
values.push("scaleY(".concat(scaleY, ")"));
}
var transform = values.length ? values.join(' ') : 'none';
return {
WebkitTransform: transform,
msTransform: transform,
transform: transform
};
}
/**
* Get the max ratio of a group of pointers.
* @param {string} pointers - The target pointers.
* @returns {number} The result ratio.
*/
function getMaxZoomRatio(pointers) {
var pointers2 = _objectSpread2({}, pointers);
var maxRatio = 0;
forEach(pointers, function (pointer, pointerId) {
delete pointers2[pointerId];
forEach(pointers2, function (pointer2) {
var x1 = Math.abs(pointer.startX - pointer2.startX);
var y1 = Math.abs(pointer.startY - pointer2.startY);
var x2 = Math.abs(pointer.endX - pointer2.endX);
var y2 = Math.abs(pointer.endY - pointer2.endY);
var z1 = Math.sqrt(x1 * x1 + y1 * y1);
var z2 = Math.sqrt(x2 * x2 + y2 * y2);
var ratio = (z2 - z1) / z1;
if (Math.abs(ratio) > Math.abs(maxRatio)) {
maxRatio = ratio;
}
});
});
return maxRatio;
}
/**
* Get a pointer from an event object.
* @param {Object} event - The target event object.
* @param {boolean} endOnly - Indicates if only returns the end point coordinate or not.
* @returns {Object} The result pointer contains start and/or end point coordinates.
*/
function getPointer(_ref2, endOnly) {
var pageX = _ref2.pageX,
pageY = _ref2.pageY;
var end = {
endX: pageX,
endY: pageY
};
return endOnly ? end : _objectSpread2({
startX: pageX,
startY: pageY
}, end);
}
/**
* Get the center point coordinate of a group of pointers.
* @param {Object} pointers - The target pointers.
* @returns {Object} The center point coordinate.
*/
function getPointersCenter(pointers) {
var pageX = 0;
var pageY = 0;
var count = 0;
forEach(pointers, function (_ref3) {
var startX = _ref3.startX,
startY = _ref3.startY;
pageX += startX;
pageY += startY;
count += 1;
});
pageX /= count;
pageY /= count;
return {
pageX: pageX,
pageY: pageY
};
}
/**
* Get the max sizes in a rectangle under the given aspect ratio.
* @param {Object} data - The original sizes.
* @param {string} [type='contain'] - The adjust type.
* @returns {Object} The result sizes.
*/
function getAdjustedSizes(_ref4) // or 'cover'
{
var aspectRatio = _ref4.aspectRatio,
height = _ref4.height,
width = _ref4.width;
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'contain';
var isValidWidth = isPositiveNumber(width);
var isValidHeight = isPositiveNumber(height);
if (isValidWidth && isValidHeight) {
var adjustedWidth = height * aspectRatio;
if (type === 'contain' && adjustedWidth > width || type === 'cover' && adjustedWidth < width) {
height = width / aspectRatio;
} else {
width = height * aspectRatio;
}
} else if (isValidWidth) {
height = width / aspectRatio;
} else if (isValidHeight) {
width = height * aspectRatio;
}
return {
width: width,
height: height
};
}
/**
* Get the new sizes of a rectangle after rotated.
* @param {Object} data - The original sizes.
* @returns {Object} The result sizes.
*/
function getRotatedSizes(_ref5) {
var width = _ref5.width,
height = _ref5.height,
degree = _ref5.degree;
degree = Math.abs(degree) % 180;
if (degree === 90) {
return {
width: height,
height: width
};
}
var arc = degree % 90 * Math.PI / 180;
var sinArc = Math.sin(arc);
var cosArc = Math.cos(arc);
var newWidth = width * cosArc + height * sinArc;
var newHeight = width * sinArc + height * cosArc;
return degree > 90 ? {
width: newHeight,
height: newWidth
} : {
width: newWidth,
height: newHeight
};
}
/**
* Get a canvas which drew the given image.
* @param {HTMLImageElement} image - The image for drawing.
* @param {Object} imageData - The image data.
* @param {Object} canvasData - The canvas data.
* @param {Object} options - The options.
* @returns {HTMLCanvasElement} The result canvas.
*/
function getSourceCanvas(image, _ref6, _ref7, _ref8) {
var imageAspectRatio = _ref6.aspectRatio,
imageNaturalWidth = _ref6.naturalWidth,
imageNaturalHeight = _ref6.naturalHeight,
_ref6$rotate = _ref6.rotate,
rotate = _ref6$rotate === void 0 ? 0 : _ref6$rotate,
_ref6$scaleX = _ref6.scaleX,
scaleX = _ref6$scaleX === void 0 ? 1 : _ref6$scaleX,
_ref6$scaleY = _ref6.scaleY,
scaleY = _ref6$scaleY === void 0 ? 1 : _ref6$scaleY;
var aspectRatio = _ref7.aspectRatio,
naturalWidth = _ref7.naturalWidth,
naturalHeight = _ref7.naturalHeight;
var _ref8$fillColor = _ref8.fillColor,
fillColor = _ref8$fillColor === void 0 ? 'transparent' : _ref8$fillColor,
_ref8$imageSmoothingE = _ref8.imageSmoothingEnabled,
imageSmoothingEnabled = _ref8$imageSmoothingE === void 0 ? true : _ref8$imageSmoothingE,
_ref8$imageSmoothingQ = _ref8.imageSmoothingQuality,
imageSmoothingQuality = _ref8$imageSmoothingQ === void 0 ? 'low' : _ref8$imageSmoothingQ,
_ref8$maxWidth = _ref8.maxWidth,
maxWidth = _ref8$maxWidth === void 0 ? Infinity : _ref8$maxWidth,
_ref8$maxHeight = _ref8.maxHeight,
maxHeight = _ref8$maxHeight === void 0 ? Infinity : _ref8$maxHeight,
_ref8$minWidth = _ref8.minWidth,
minWidth = _ref8$minWidth === void 0 ? 0 : _ref8$minWidth,
_ref8$minHeight = _ref8.minHeight,
minHeight = _ref8$minHeight === void 0 ? 0 : _ref8$minHeight;
var canvas = document.createElement('canvas');
var context = canvas.getContext('2d');
var maxSizes = getAdjustedSizes({
aspectRatio: aspectRatio,
width: maxWidth,
height: maxHeight
});
var minSizes = getAdjustedSizes({
aspectRatio: aspectRatio,
width: minWidth,
height: minHeight
}, 'cover');
var width = Math.min(maxSizes.width, Math.max(minSizes.width, naturalWidth));
var height = Math.min(maxSizes.height, Math.max(minSizes.height, naturalHeight)); // Note: should always use image's natural sizes for drawing as
// imageData.naturalWidth === canvasData.naturalHeight when rotate % 180 === 90
var destMaxSizes = getAdjustedSizes({
aspectRatio: imageAspectRatio,
width: maxWidth,
height: maxHeight
});
var destMinSizes = getAdjustedSizes({
aspectRatio: imageAspectRatio,
width: minWidth,
height: minHeight
}, 'cover');
var destWidth = Math.min(destMaxSizes.width, Math.max(destMinSizes.width, imageNaturalWidth));
var destHeight = Math.min(destMaxSizes.height, Math.max(destMinSizes.height, imageNaturalHeight));
var params = [-destWidth / 2, -destHeight / 2, destWidth, destHeight];
canvas.width = normalizeDecimalNumber(width);
canvas.height = normalizeDecimalNumber(height);
context.fillStyle = fillColor;
context.fillRect(0, 0, width, height);
context.save();
context.translate(width / 2, height / 2);
context.rotate(rotate * Math.PI / 180);
context.scale(scaleX, scaleY);
context.imageSmoothingEnabled = imageSmoothingEnabled;
context.imageSmoothingQuality = imageSmoothingQuality;
context.drawImage.apply(context, [image].concat(_toConsumableArray(params.map(function (param) {
return Math.floor(normalizeDecimalNumber(param));
}))));
context.restore();
return canvas;
}
var fromCharCode = String.fromCharCode;
/**
* Get string from char code in data view.
* @param {DataView} dataView - The data view for read.
* @param {number} start - The start index.
* @param {number} length - The read length.
* @returns {string} The read result.
*/
function getStringFromCharCode(dataView, start, length) {
var str = '';
length += start;
for (var i = start; i < length; i += 1) {
str += fromCharCode(dataView.getUint8(i));
}
return str;
}
var REGEXP_DATA_URL_HEAD = /^data:.*,/;
/**
* Transform Data URL to array buffer.
* @param {string} dataURL - The Data URL to transform.
* @returns {ArrayBuffer} The result array buffer.
*/
function dataURLToArrayBuffer(dataURL) {
var base64 = dataURL.replace(REGEXP_DATA_URL_HEAD, '');
var binary = atob(base64);
var arrayBuffer = new ArrayBuffer(binary.length);
var uint8 = new Uint8Array(arrayBuffer);
forEach(uint8, function (value, i) {
uint8[i] = binary.charCodeAt(i);
});
return arrayBuffer;
}
/**
* Transform array buffer to Data URL.
* @param {ArrayBuffer} arrayBuffer - The array buffer to transform.
* @param {string} mimeType - The mime type of the Data URL.
* @returns {string} The result Data URL.
*/
function arrayBufferToDataURL(arrayBuffer, mimeType) {
var chunks = []; // Chunk Typed Array for better performance (#435)
var chunkSize = 8192;
var uint8 = new Uint8Array(arrayBuffer);
while (uint8.length > 0) {
// XXX: Babel's `toConsumableArray` helper will throw error in IE or Safari 9
// eslint-disable-next-line prefer-spread
chunks.push(fromCharCode.apply(null, toArray(uint8.subarray(0, chunkSize))));
uint8 = uint8.subarray(chunkSize);
}
return "data:".concat(mimeType, ";base64,").concat(btoa(chunks.join('')));
}
/**
* Get orientation value from given array buffer.
* @param {ArrayBuffer} arrayBuffer - The array buffer to read.
* @returns {number} The read orientation value.
*/
function resetAndGetOrientation(arrayBuffer) {
var dataView = new DataView(arrayBuffer);
var orientation; // Ignores range error when the image does not have correct Exif information
try {
var littleEndian;
var app1Start;
var ifdStart; // Only handle JPEG image (start by 0xFFD8)
if (dataView.getUint8(0) === 0xFF && dataView.getUint8(1) === 0xD8) {
var length = dataView.byteLength;
var offset = 2;
while (offset + 1 < length) {
if (dataView.getUint8(offset) === 0xFF && dataView.getUint8(offset + 1) === 0xE1) {
app1Start = offset;
break;
}
offset += 1;
}
}
if (app1Start) {
var exifIDCode = app1Start + 4;
var tiffOffset = app1Start + 10;
if (getStringFromCharCode(dataView, exifIDCode, 4) === 'Exif') {
var endianness = dataView.getUint16(tiffOffset);
littleEndian = endianness === 0x4949;
if (littleEndian || endianness === 0x4D4D
/* bigEndian */
) {
if (dataView.getUint16(tiffOffset + 2, littleEndian) === 0x002A) {
var firstIFDOffset = dataView.getUint32(tiffOffset + 4, littleEndian);
if (firstIFDOffset >= 0x00000008) {
ifdStart = tiffOffset + firstIFDOffset;
}
}
}
}
}
if (ifdStart) {
var _length = dataView.getUint16(ifdStart, littleEndian);
var _offset;
var i;
for (i = 0; i < _length; i += 1) {
_offset = ifdStart + i * 12 + 2;
if (dataView.getUint16(_offset, littleEndian) === 0x0112
/* Orientation */
) {
// 8 is the offset of the current tag's value
_offset += 8; // Get the original orientation value
orientation = dataView.getUint16(_offset, littleEndian); // Override the orientation with its default value
dataView.setUint16(_offset, 1, littleEndian);
break;
}
}
}
} catch (error) {
orientation = 1;
}
return orientation;
}
/**
* Parse Exif Orientation value.
* @param {number} orientation - The orientation to parse.
* @returns {Object} The parsed result.
*/
function parseOrientation(orientation) {
var rotate = 0;
var scaleX = 1;
var scaleY = 1;
switch (orientation) {
// Flip horizontal
case 2:
scaleX = -1;
break;
// Rotate left 180°
case 3:
rotate = -180;
break;
// Flip vertical
case 4:
scaleY = -1;
break;
// Flip vertical and rotate right 90°
case 5:
rotate = 90;
scaleY = -1;
break;
// Rotate right 90°
case 6:
rotate = 90;
break;
// Flip horizontal and rotate right 90°
case 7:
rotate = 90;
scaleX = -1;
break;
// Rotate left 90°
case 8:
rotate = -90;
break;
}
return {
rotate: rotate,
scaleX: scaleX,
scaleY: scaleY
};
}
var render = {
render: function render() {
this.initContainer();
this.initCanvas();
this.initCropBox();
this.renderCanvas();
if (this.cropped) {
this.renderCropBox();
}
},
initContainer: function initContainer() {
var element = this.element,
options = this.options,
container = this.container,
cropper = this.cropper;
var minWidth = Number(options.minContainerWidth);
var minHeight = Number(options.minContainerHeight);
addClass(cropper, CLASS_HIDDEN);
removeClass(element, CLASS_HIDDEN);
var dP = 20;
var containerData = {
width: Math.max((container.offsetWidth - dP - 1), minWidth >= 0 ? minWidth : MIN_CONTAINER_WIDTH),
height: Math.max((container.offsetHeight - dP), minHeight >= 0 ? minHeight : MIN_CONTAINER_HEIGHT)
};
this.containerData = containerData;
setStyle(cropper, {
width: containerData.width,
height: containerData.height
});
addClass(element, CLASS_HIDDEN);
removeClass(cropper, CLASS_HIDDEN);
},
// Canvas (image wrapper)
initCanvas: function initCanvas() {
var containerData = this.containerData,
imageData = this.imageData;
var viewMode = this.options.viewMode;
var rotated = Math.abs(imageData.rotate) % 180 === 90;
var naturalWidth = rotated ? imageData.naturalHeight : imageData.naturalWidth;
var naturalHeight = rotated ? imageData.naturalWidth : imageData.naturalHeight;
var aspectRatio = naturalWidth / naturalHeight;
var canvasWidth = containerData.width;
var canvasHeight = containerData.height;
if (containerData.height * aspectRatio > containerData.width) {
if (viewMode === 3) {
canvasWidth = containerData.height * aspectRatio;
} else {
canvasHeight = containerData.width / aspectRatio;
}
} else if (viewMode === 3) {
canvasHeight = containerData.width / aspectRatio;
} else {
canvasWidth = containerData.height * aspectRatio;
}
var canvasData = {
aspectRatio: aspectRatio,
naturalWidth: naturalWidth,
naturalHeight: naturalHeight,
width: canvasWidth,
height: canvasHeight
};
this.canvasData = canvasData;
this.limited = viewMode === 1 || viewMode === 2;
this.limitCanvas(true, true);
canvasData.width = Math.min(Math.max(canvasData.width, canvasData.minWidth), canvasData.maxWidth);
canvasData.height = Math.min(Math.max(canvasData.height, canvasData.minHeight), canvasData.maxHeight);
canvasData.left = (containerData.width - canvasData.width) / 2;
canvasData.top = (containerData.height - canvasData.height) / 2;
canvasData.oldLeft = canvasData.left;
canvasData.oldTop = canvasData.top;
this.initialCanvasData = assign({}, canvasData);
},
limitCanvas: function limitCanvas(sizeLimited, positionLimited) {
var options = this.options,
containerData = this.containerData,
canvasData = this.canvasData,
cropBoxData = this.cropBoxData;
var viewMode = options.viewMode;
var aspectRatio = canvasData.aspectRatio;
var cropped = this.cropped && cropBoxData;
if (sizeLimited) {
var minCanvasWidth = Number(options.minCanvasWidth) || 0;
var minCanvasHeight = Number(options.minCanvasHeight) || 0;
if (viewMode > 1) {
minCanvasWidth = Math.max(minCanvasWidth, containerData.width);
minCanvasHeight = Math.max(minCanvasHeight, containerData.height);
if (viewMode === 3) {
if (minCanvasHeight * aspectRatio > minCanvasWidth) {
minCanvasWidth = minCanvasHeight * aspectRatio;
} else {
minCanvasHeight = minCanvasWidth / aspectRatio;
}
}
} else if (viewMode > 0) {
if (minCanvasWidth) {
minCanvasWidth = Math.max(minCanvasWidth, cropped ? cropBoxData.width : 0);
} else if (minCanvasHeight) {
minCanvasHeight = Math.max(minCanvasHeight, cropped ? cropBoxData.height : 0);
} else if (cropped) {
minCanvasWidth = cropBoxData.width;
minCanvasHeight = cropBoxData.height;
if (minCanvasHeight * aspectRatio > minCanvasWidth) {
minCanvasWidth = minCanvasHeight * aspectRatio;
} else {
minCanvasHeight = minCanvasWidth / aspectRatio;
}
}
}
var _getAdjustedSizes = getAdjustedSizes({
aspectRatio: aspectRatio,
width: minCanvasWidth,
height: minCanvasHeight
});
minCanvasWidth = _getAdjustedSizes.width;
minCanvasHeight = _getAdjustedSizes.height;
canvasData.minWidth = minCanvasWidth;
canvasData.minHeight = minCanvasHeight;
canvasData.maxWidth = Infinity;
canvasData.maxHeight = Infinity;
}
if (positionLimited) {
if (viewMode > (cropped ? 0 : 1)) {
var newCanvasLeft = containerData.width - canvasData.width;
var newCanvasTop = containerData.height - canvasData.height;
canvasData.minLeft = Math.min(0, newCanvasLeft);
canvasData.minTop = Math.min(0, newCanvasTop);
canvasData.maxLeft = Math.max(0, newCanvasLeft);
canvasData.maxTop = Math.max(0, newCanvasTop);
if (cropped && this.limited) {
canvasData.minLeft = Math.min(cropBoxData.left, cropBoxData.left + (cropBoxData.width - canvasData.width));
canvasData.minTop = Math.min(cropBoxData.top, cropBoxData.top + (cropBoxData.height - canvasData.height));
canvasData.maxLeft = cropBoxData.left;
canvasData.maxTop = cropBoxData.top;
if (viewMode === 2) {
if (canvasData.width >= containerData.width) {
canvasData.minLeft = Math.min(0, newCanvasLeft);
canvasData.maxLeft = Math.max(0, newCanvasLeft);
}
if (canvasData.height >= containerData.height) {
canvasData.minTop = Math.min(0, newCanvasTop);
canvasData.maxTop = Math.max(0, newCanvasTop);
}
}
}
} else {
canvasData.minLeft = -canvasData.width;
canvasData.minTop = -canvasData.height;
canvasData.maxLeft = containerData.width;
canvasData.maxTop = containerData.height;
}
}
},
renderCanvas: function renderCanvas(changed, transformed) {
var canvasData = this.canvasData,
imageData = this.imageData;
if (transformed) {
var _getRotatedSizes = getRotatedSizes({
width: imageData.naturalWidth * Math.abs(imageData.scaleX || 1),
height: imageData.naturalHeight * Math.abs(imageData.scaleY || 1),
degree: imageData.rotate || 0
}),
naturalWidth = _getRotatedSizes.width,
naturalHeight = _getRotatedSizes.height;
var width = canvasData.width * (naturalWidth / canvasData.naturalWidth);
var height = canvasData.height * (naturalHeight / canvasData.naturalHeight);
canvasData.left -= (width - canvasData.width) / 2;
canvasData.top -= (height - canvasData.height) / 2;
canvasData.width = width;
canvasData.height = height;
canvasData.aspectRatio = naturalWidth / naturalHeight;
canvasData.naturalWidth = naturalWidth;
canvasData.naturalHeight = naturalHeight;
this.limitCanvas(true, false);
}
if (canvasData.width > canvasData.maxWidth || canvasData.width < canvasData.minWidth) {
canvasData.left = canvasData.oldLeft;
}
if (canvasData.height > canvasData.maxHeight || canvasData.height < canvasData.minHeight) {
canvasData.top = canvasData.oldTop;
}
canvasData.width = Math.min(Math.max(canvasData.width, canvasData.minWidth), canvasData.maxWidth);
canvasData.height = Math.min(Math.max(canvasData.height, canvasData.minHeight), canvasData.maxHeight);
this.limitCanvas(false, true);
canvasData.left = Math.min(Math.max(canvasData.left, canvasData.minLeft), canvasData.maxLeft);
canvasData.top = Math.min(Math.max(canvasData.top, canvasData.minTop), canvasData.maxTop);
canvasData.oldLeft = canvasData.left;
canvasData.oldTop = canvasData.top;
setStyle(this.canvas, assign({
width: canvasData.width,
height: canvasData.height
}, getTransforms({
translateX: canvasData.left,
translateY: canvasData.top
})));
this.renderImage(changed);
if (this.cropped && this.limited) {
this.limitCropBox(true, true);
}
},
renderImage: function renderImage(changed) {
var canvasData = this.canvasData,
imageData = this.imageData;
var width = imageData.naturalWidth * (canvasData.width / canvasData.naturalWidth);
var height = imageData.naturalHeight * (canvasData.height / canvasData.naturalHeight);
assign(imageData, {
width: width,
height: height,
left: (canvasData.width - width) / 2,
top: (canvasData.height - height) / 2
});
setStyle(this.image, assign({
width: imageData.width,
height: imageData.height
}, getTransforms(assign({
translateX: imageData.left,
translateY: imageData.top
}, imageData))));
if (changed) {
this.output();
}
},
initCropBox: function initCropBox() {
var options = this.options,
canvasData = this.canvasData;
var aspectRatio = options.aspectRatio || options.initialAspectRatio;
var autoCropArea = Number(options.autoCropArea) || 0.8;
var cropBoxData = {
width: canvasData.width,
height: canvasData.height
};
if (aspectRatio) {
if (canvasData.height * aspectRatio > canvasData.width) {
cropBoxData.height = cropBoxData.width / aspectRatio;
} else {
cropBoxData.width = cropBoxData.height * aspectRatio;
}
}
this.cropBoxData = cropBoxData;
this.limitCropBox(true, true); // Initialize auto crop area
cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth);
cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight); // The width/height of auto crop area must large than "minWidth/Height"
cropBoxData.width = Math.max(cropBoxData.minWidth, cropBoxData.width * autoCropArea);
cropBoxData.height = Math.max(cropBoxData.minHeight, cropBoxData.height * autoCropArea);
cropBoxData.left = canvasData.left + (canvasData.width - cropBoxData.width) / 2;
cropBoxData.top = canvasData.top + (canvasData.height - cropBoxData.height) / 2;
cropBoxData.oldLeft = cropBoxData.left;
cropBoxData.oldTop = cropBoxData.top;
this.initialCropBoxData = assign({}, cropBoxData);
},
limitCropBox: function limitCropBox(sizeLimited, positionLimited) {
var options = this.options,
containerData = this.containerData,
canvasData = this.canvasData,
cropBoxData = this.cropBoxData,
limited = this.limited;
var aspectRatio = options.aspectRatio;
if (sizeLimited) {
var minCropBoxWidth = Number(options.minCropBoxWidth) || 0;
var minCropBoxHeight = Number(options.minCropBoxHeight) || 0;
var maxCropBoxWidth = limited ? Math.min(containerData.width, canvasData.width, canvasData.width + canvasData.left, containerData.width - canvasData.left) : containerData.width;
var maxCropBoxHeight = limited ? Math.min(containerData.height, canvasData.height, canvasData.height + canvasData.top, containerData.height - canvasData.top) : containerData.height; // The min/maxCropBoxWidth/Height must be less than container's width/height
minCropBoxWidth = Math.min(minCropBoxWidth, containerData.width);
minCropBoxHeight = Math.min(minCropBoxHeight, containerData.height);
if (aspectRatio) {
if (minCropBoxWidth && minCropBoxHeight) {
if (minCropBoxHeight * aspectRatio > minCropBoxWidth) {
minCropBoxHeight = minCropBoxWidth / aspectRatio;
} else {
minCropBoxWidth = minCropBoxHeight * aspectRatio;
}
} else if (minCropBoxWidth) {
minCropBoxHeight = minCropBoxWidth / aspectRatio;
} else if (minCropBoxHeight) {
minCropBoxWidth = minCropBoxHeight * aspectRatio;
}
if (maxCropBoxHeight * aspectRatio > maxCropBoxWidth) {
maxCropBoxHeight = maxCropBoxWidth / aspectRatio;
} else {
maxCropBoxWidth = maxCropBoxHeight * aspectRatio;
}
} // The minWidth/Height must be less than maxWidth/Height
cropBoxData.minWidth = Math.min(minCropBoxWidth, maxCropBoxWidth);
cropBoxData.minHeight = Math.min(minCropBoxHeight, maxCropBoxHeight);
cropBoxData.maxWidth = maxCropBoxWidth;
cropBoxData.maxHeight = maxCropBoxHeight;
}
if (positionLimited) {
if (limited) {
cropBoxData.minLeft = Math.max(0, canvasData.left);
cropBoxData.minTop = Math.max(0, canvasData.top);
cropBoxData.maxLeft = Math.min(containerData.width, canvasData.left + canvasData.width) - cropBoxData.width;
cropBoxData.maxTop = Math.min(containerData.height, canvasData.top + canvasData.height) - cropBoxData.height;
} else {
cropBoxData.minLeft = 0;
cropBoxData.minTop = 0;
cropBoxData.maxLeft = containerData.width - cropBoxData.width;
cropBoxData.maxTop = containerData.height - cropBoxData.height;
}
}
},
renderCropBox: function renderCropBox() {
var options = this.options,
containerData = this.containerData,
cropBoxData = this.cropBoxData;
if (cropBoxData.width > cropBoxData.maxWidth || cropBoxData.width < cropBoxData.minWidth) {
cropBoxData.left = cropBoxData.oldLeft;
}
if (cropBoxData.height > cropBoxData.maxHeight || cropBoxData.height < cropBoxData.minHeight) {
cropBoxData.top = cropBoxData.oldTop;
}
cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth);
cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight);
this.limitCropBox(false, true);
cropBoxData.left = Math.min(Math.max(cropBoxData.left, cropBoxData.minLeft), cropBoxData.maxLeft);
cropBoxData.top = Math.min(Math.max(cropBoxData.top, cropBoxData.minTop), cropBoxData.maxTop);
cropBoxData.oldLeft = cropBoxData.left;
cropBoxData.oldTop = cropBoxData.top;
if (options.movable && options.cropBoxMovable) {
// Turn to move the canvas when the crop box is equal to the container
setData(this.face, DATA_ACTION, cropBoxData.width >= containerData.width && cropBoxData.height >= containerData.height ? ACTION_MOVE : ACTION_ALL);
}
setStyle(this.cropBox, assign({
width: cropBoxData.width,
height: cropBoxData.height
}, getTransforms({
translateX: cropBoxData.left,
translateY: cropBoxData.top
})));
if (this.cropped && this.limited) {
this.limitCanvas(true, true);
}
if (!this.disabled) {
this.output();
}
},
output: function output() {
this.preview();
dispatchEvent(this.element, EVENT_CROP, this.getData());
}
};
var preview = {
initPreview: function initPreview() {
var element = this.element,
crossOrigin = this.crossOrigin;
var preview = this.options.preview;
var url = crossOrigin ? this.crossOriginUrl : this.url;
var alt = element.alt || 'The image to preview';
var image = document.createElement('img');
if (crossOrigin) {
image.crossOrigin = crossOrigin;
}
image.src = url;
image.alt = alt;
this.viewBox.appendChild(image);
this.viewBoxImage = image;
if (!preview) {
return;
}
var previews = preview;
if (typeof preview === 'string') {
previews = element.ownerDocument.querySelectorAll(preview);
} else if (preview.querySelector) {
previews = [preview];
}
this.previews = previews;
forEach(previews, function (el) {
var img = document.createElement('img'); // Save the original size for recover
setData(el, DATA_PREVIEW, {
width: el.offsetWidth,
height: el.offsetHeight,
html: el.innerHTML
});
if (crossOrigin) {
img.crossOrigin = crossOrigin;
}
img.src = url;
img.alt = alt;
/**
* Override img element styles
* Add `display:block` to avoid margin top issue
* Add `height:auto` to override `height` attribute on IE8
* (Occur only when margin-top <= -height)
*/
img.style.cssText = 'display:block;' + 'width:100%;' + 'height:auto;' + 'min-width:0!important;' + 'min-height:0!important;' + 'max-width:none!important;' + 'max-height:none!important;' + 'image-orientation:0deg!important;"';
el.innerHTML = '';
el.appendChild(img);
});
},
resetPreview: function resetPreview() {
forEach(this.previews, function (element) {
var data = getData(element, DATA_PREVIEW);
setStyle(element, {
width: data.width,
height: data.height
});
element.innerHTML = data.html;
removeData(element, DATA_PREVIEW);
});
},
preview: function preview() {
var imageData = this.imageData,
canvasData = this.canvasData,
cropBoxData = this.cropBoxData;
var cropBoxWidth = cropBoxData.width,
cropBoxHeight = cropBoxData.height;
var width = imageData.width,
height = imageData.height;
var left = cropBoxData.left - canvasData.left - imageData.left;
var top = cropBoxData.top - canvasData.top - imageData.top;
if (!this.cropped || this.disabled) {
return;
}
setStyle(this.viewBoxImage, assign({
width: width,
height: height
}, getTransforms(assign({
translateX: -left,
translateY: -top
}, imageData))));
forEach(this.previews, function (element) {
var data = getData(element, DATA_PREVIEW);
var originalWidth = data.width;
var originalHeight = data.height;
var newWidth = originalWidth;
var newHeight = originalHeight;
var ratio = 1;
if (cropBoxWidth) {
ratio = originalWidth / cropBoxWidth;
newHeight = cropBoxHeight * ratio;
}
if (cropBoxHeight && newHeight > originalHeight) {
ratio = originalHeight / cropBoxHeight;
newWidth = cropBoxWidth * ratio;
newHeight = originalHeight;
}
setStyle(element, {
width: newWidth,
height: newHeight
});
setStyle(element.getElementsByTagName('img')[0], assign({
width: width * ratio,
height: height * ratio
}, getTransforms(assign({
translateX: -left * ratio,
translateY: -top * ratio
}, imageData))));
});
}
};
var events = {
bind: function bind() {
var element = this.element,
options = this.options,
cropper = this.cropper;
if (isFunction(options.cropstart)) {
addListener(element, EVENT_CROP_START, options.cropstart);
}
if (isFunction(options.cropmove)) {
addListener(element, EVENT_CROP_MOVE, options.cropmove);
}
if (isFunction(options.cropend)) {
addListener(element, EVENT_CROP_END, options.cropend);
}
if (isFunction(options.crop)) {
addListener(element, EVENT_CROP, options.crop);
}
if (isFunction(options.zoom)) {
addListener(element, EVENT_ZOOM, options.zoom);
}
addListener(cropper, EVENT_POINTER_DOWN, this.onCropStart = this.cropStart.bind(this));
if (options.zoomable && options.zoomOnWheel) {
addListener(cropper, EVENT_WHEEL, this.onWheel = this.wheel.bind(this), {
passive: false,
capture: true
});
}
if (options.toggleDragModeOnDblclick) {
addListener(cropper, EVENT_DBLCLICK, this.onDblclick = this.dblclick.bind(this));
}
addListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove = this.cropMove.bind(this));
addListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd = this.cropEnd.bind(this));
if (options.responsive) {
addListener(window, EVENT_RESIZE, this.onResize = this.resize.bind(this));
}
},
unbind: function unbind() {
var element = this.element,
options = this.options,
cropper = this.cropper;
if (isFunction(options.cropstart)) {
removeListener(element, EVENT_CROP_START, options.cropstart);
}
if (isFunction(options.cropmove)) {
removeListener(element, EVENT_CROP_MOVE, options.cropmove);
}
if (isFunction(options.cropend)) {
removeListener(element, EVENT_CROP_END, options.cropend);
}
if (isFunction(options.crop)) {
removeListener(element, EVENT_CROP, options.crop);
}
if (isFunction(options.zoom)) {
removeListener(element, EVENT_ZOOM, options.zoom);
}
removeListener(cropper, EVENT_POINTER_DOWN, this.onCropStart);
if (options.zoomable && options.zoomOnWheel) {
removeListener(cropper, EVENT_WHEEL, this.onWheel, {
passive: false,
capture: true
});
}
if (options.toggleDragModeOnDblclick) {
removeListener(cropper, EVENT_DBLCLICK, this.onDblclick);
}
removeListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove);
removeListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd);
if (options.responsive) {
removeListener(window, EVENT_RESIZE, this.onResize);
}
}
};
var handlers = {
resize: function resize() {
if (this.disabled) {
return;
}
var options = this.options,
container = this.container,
containerData = this.containerData;
var ratioX = container.offsetWidth / containerData.width;
var ratioY = container.offsetHeight / containerData.height;
var ratio = Math.abs(ratioX - 1) > Math.abs(ratioY - 1) ? ratioX : ratioY; // Resize when width changed or height changed
if (ratio !== 1) {
var canvasData;
var cropBoxData;
if (options.restore) {
canvasData = this.getCanvasData();
cropBoxData = this.getCropBoxData();
}
this.render();
if (options.restore) {
this.setCanvasData(forEach(canvasData, function (n, i) {
canvasData[i] = n * ratio;
}));
this.setCropBoxData(forEach(cropBoxData, function (n, i) {
cropBoxData[i] = n * ratio;
}));
}
}
},
dblclick: function dblclick() {
if (this.disabled || this.options.dragMode === DRAG_MODE_NONE) {
return;
}
this.setDragMode(hasClass(this.dragBox, CLASS_CROP) ? DRAG_MODE_MOVE : DRAG_MODE_CROP);
},
wheel: function wheel(event) {
var _this = this;
var ratio = Number(this.options.wheelZoomRatio) || 0.1;
var delta = 1;
if (this.disabled) {
return;
}
event.preventDefault(); // Limit wheel speed to prevent zoom too fast (#21)
if (this.wheeling) {
return;
}
this.wheeling = true;
setTimeout(function () {
_this.wheeling = false;
}, 50);
if (event.deltaY) {
delta = event.deltaY > 0 ? 1 : -1;
} else if (event.wheelDelta) {
delta = -event.wheelDelta / 120;
} else if (event.detail) {
delta = event.detail > 0 ? 1 : -1;
}
this.zoom(-delta * ratio, event);
},
cropStart: function cropStart(event) {
var buttons = event.buttons,
button = event.button;
if (this.disabled // Handle mouse event and pointer event and ignore touch event
|| (event.type === 'mousedown' || event.type === 'pointerdown' && event.pointerType === 'mouse') && ( // No primary button (Usually the left button)
isNumber(buttons) && buttons !== 1 || isNumber(button) && button !== 0 // Open context menu
|| event.ctrlKey)) {
return;
}
var options = this.options,
pointers = this.pointers;
var action;
if (event.changedTouches) {
// Handle touch event
forEach(event.changedTouches, function (touch) {
pointers[touch.identifier] = getPointer(touch);
});
} else {
// Handle mouse event and pointer event
pointers[event.pointerId || 0] = getPointer(event);
}
if (Object.keys(pointers).length > 1 && options.zoomable && options.zoomOnTouch) {
action = ACTION_ZOOM;
} else {
action = getData(event.target, DATA_ACTION);
}
if (!REGEXP_ACTIONS.test(action)) {
return;
}
if (dispatchEvent(this.element, EVENT_CROP_START, {
originalEvent: event,
action: action
}) === false) {
return;
} // This line is required for preventing page zooming in iOS browsers
event.preventDefault();
this.action = action;
this.cropping = false;
if (action === ACTION_CROP) {
this.cropping = true;
addClass(this.dragBox, CLASS_MODAL);
}
},
cropMove: function cropMove(event) {
var action = this.action;
if (this.disabled || !action) {
return;
}
var pointers = this.pointers;
event.preventDefault();
if (dispatchEvent(this.element, EVENT_CROP_MOVE, {
originalEvent: event,
action: action
}) === false) {
return;
}
if (event.changedTouches) {
forEach(event.changedTouches, function (touch) {
// The first parameter should not be undefined (#432)
assign(pointers[touch.identifier] || {}, getPointer(touch, true));
});
} else {
assign(pointers[event.pointerId || 0] || {}, getPointer(event, true));
}
this.change(event);
},
cropEnd: function cropEnd(event) {
if (this.disabled) {
return;
}
var action = this.action,
pointers = this.pointers;
if (event.changedTouches) {
forEach(event.changedTouches, function (touch) {
delete pointers[touch.identifier];
});
} else {
delete pointers[event.pointerId || 0];
}
if (!action) {
return;
}
event.preventDefault();
if (!Object.keys(pointers).length) {
this.action = '';
}
if (this.cropping) {
this.cropping = false;
toggleClass(this.dragBox, CLASS_MODAL, this.cropped && this.options.modal);
}
dispatchEvent(this.element, EVENT_CROP_END, {
originalEvent: event,
action: action
});
}
};
var change = {
change: function change(event) {
var options = this.options,
canvasData = this.canvasData,
containerData = this.containerData,
cropBoxData = this.cropBoxData,
pointers = this.pointers;
var action = this.action;
var aspectRatio = options.aspectRatio;
var left = cropBoxData.left,
top = cropBoxData.top,
width = cropBoxData.width,
height = cropBoxData.height;
var right = left + width;
var bottom = top + height;
var minLeft = 0;
var minTop = 0;
var maxWidth = containerData.width;
var maxHeight = containerData.height;
var renderable = true;
var offset; // Locking aspect ratio in "free mode" by holding shift key
if (!aspectRatio && event.shiftKey) {
aspectRatio = width && height ? width / height : 1;
}
if (this.limited) {
minLeft = cropBoxData.minLeft;
minTop = cropBoxData.minTop;
maxWidth = minLeft + Math.min(containerData.width, canvasData.width, canvasData.left + canvasData.width);
maxHeight = minTop + Math.min(containerData.height, canvasData.height, canvasData.top + canvasData.height);
}
var pointer = pointers[Object.keys(pointers)[0]];
var range = {
x: pointer.endX - pointer.startX,
y: pointer.endY - pointer.startY
};
var check = function check(side) {
switch (side) {
case ACTION_EAST:
if (right + range.x > maxWidth) {
range.x = maxWidth - right;
}
break;
case ACTION_WEST:
if (left + range.x < minLeft) {
range.x = minLeft - left;
}
break;
case ACTION_NORTH:
if (top + range.y < minTop) {
range.y = minTop - top;
}
break;
case ACTION_SOUTH:
if (bottom + range.y > maxHeight) {
range.y = maxHeight - bottom;
}
break;
}
};
switch (action) {
// Move crop box
case ACTION_ALL:
left += range.x;
top += range.y;
break;
// Resize crop box
case ACTION_EAST:
if (range.x >= 0 && (right >= maxWidth || aspectRatio && (top <= minTop || bottom >= maxHeight))) {
renderable = false;
break;
}
check(ACTION_EAST);
width += range.x;
if (width < 0) {
action = ACTION_WEST;
width = -width;
left -= width;
}
if (aspectRatio) {
height = width / aspectRatio;
top += (cropBoxData.height - height) / 2;
}
break;
case ACTION_NORTH:
if (range.y <= 0 && (top <= minTop || aspectRatio && (left <= minLeft || right >= maxWidth))) {
renderable = false;
break;
}
check(ACTION_NORTH);
height -= range.y;
top += range.y;
if (height < 0) {
action = ACTION_SOUTH;
height = -height;
top -= height;
}
if (aspectRatio) {
width = height * aspectRatio;
left += (cropBoxData.width - width) / 2;
}
break;
case ACTION_WEST:
if (range.x <= 0 && (left <= minLeft || aspectRatio && (top <= minTop || bottom >= maxHeight))) {
renderable = false;
break;
}
check(ACTION_WEST);
width -= range.x;
left += range.x;
if (width < 0) {
action = ACTION_EAST;
width = -width;
left -= width;
}
if (aspectRatio) {
height = width / aspectRatio;
top += (cropBoxData.height - height) / 2;
}
break;
case ACTION_SOUTH:
if (range.y >= 0 && (bottom >= maxHeight || aspectRatio && (left <= minLeft || right >= maxWidth))) {
renderable = false;
break;
}
check(ACTION_SOUTH);
height += range.y;
if (height < 0) {
action = ACTION_NORTH;
height = -height;
top -= height;
}
if (aspectRatio) {
width = height * aspectRatio;
left += (cropBoxData.width - width) / 2;
}
break;
case ACTION_NORTH_EAST:
if (aspectRatio) {
if (range.y <= 0 && (top <= minTop || right >= maxWidth)) {
renderable = false;
break;
}
check(ACTION_NORTH);
height -= range.y;
top += range.y;
width = height * aspectRatio;
} else {
check(ACTION_NORTH);
check(ACTION_EAST);
if (range.x >= 0) {
if (right < maxWidth) {
width += range.x;
} else if (range.y <= 0 && top <= minTop) {
renderable = false;
}
} else {
width += range.x;
}
if (range.y <= 0) {
if (top > minTop) {
height -= range.y;
top += range.y;
}
} else {
height -= range.y;
top += range.y;
}
}
if (width < 0 && height < 0) {
action = ACTION_SOUTH_WEST;
height = -height;
width = -width;
top -= height;
left -= width;
} else if (width < 0) {
action = ACTION_NORTH_WEST;
width = -width;
left -= width;
} else if (height < 0) {
action = ACTION_SOUTH_EAST;
height = -height;
top -= height;
}
break;
case ACTION_NORTH_WEST:
if (aspectRatio) {
if (range.y <= 0 && (top <= minTop || left <= minLeft)) {
renderable = false;
break;
}
check(ACTION_NORTH);
height -= range.y;
top += range.y;
width = height * aspectRatio;
left += cropBoxData.width - width;
} else {
check(ACTION_NORTH);
check(ACTION_WEST);
if (range.x <= 0) {
if (left > minLeft) {
width -= range.x;
left += range.x;
} else if (range.y <= 0 && top <= minTop) {
renderable = false;
}
} else {
width -= range.x;
left += range.x;
}
if (range.y <= 0) {
if (top > minTop) {
height -= range.y;
top += range.y;
}
} else {
height -= range.y;
top += range.y;
}
}
if (width < 0 && height < 0) {
action = ACTION_SOUTH_EAST;
height = -height;
width = -width;
top -= height;
left -= width;
} else if (width < 0) {
action = ACTION_NORTH_EAST;
width = -width;
left -= width;
} else if (height < 0) {
action = ACTION_SOUTH_WEST;
height = -height;
top -= height;
}
break;
case ACTION_SOUTH_WEST:
if (aspectRatio) {
if (range.x <= 0 && (left <= minLeft || bottom >= maxHeight)) {
renderable = false;
break;
}
check(ACTION_WEST);
width -= range.x;
left += range.x;
height = width / aspectRatio;
} else {
check(ACTION_SOUTH);
check(ACTION_WEST);
if (range.x <= 0) {
if (left > minLeft) {
width -= range.x;
left += range.x;
} else if (range.y >= 0 && bottom >= maxHeight) {
renderable = false;
}
} else {
width -= range.x;
left += range.x;
}
if (range.y >= 0) {
if (bottom < maxHeight) {
height += range.y;
}
} else {
height += range.y;
}
}
if (width < 0 && height < 0) {
action = ACTION_NORTH_EAST;
height = -height;
width = -width;
top -= height;
left -= width;
} else if (width < 0) {
action = ACTION_SOUTH_EAST;
width = -width;
left -= width;
} else if (height < 0) {
action = ACTION_NORTH_WEST;
height = -height;
top -= height;
}
break;
case ACTION_SOUTH_EAST:
if (aspectRatio) {
if (range.x >= 0 && (right >= maxWidth || bottom >= maxHeight)) {
renderable = false;
break;
}
check(ACTION_EAST);
width += range.x;
height = width / aspectRatio;
} else {
check(ACTION_SOUTH);
check(ACTION_EAST);
if (range.x >= 0) {
if (right < maxWidth) {
width += range.x;
} else if (range.y >= 0 && bottom >= maxHeight) {
renderable = false;
}
} else {
width += range.x;
}
if (range.y >= 0) {
if (bottom < maxHeight) {
height += range.y;
}
} else {
height += range.y;
}
}
if (width < 0 && height < 0) {
action = ACTION_NORTH_WEST;
height = -height;
width = -width;
top -= height;
left -= width;
} else if (width < 0) {
action = ACTION_SOUTH_WEST;
width = -width;
left -= width;
} else if (height < 0) {
action = ACTION_NORTH_EAST;
height = -height;
top -= height;
}
break;
// Move canvas
case ACTION_MOVE:
this.move(range.x, range.y);
renderable = false;
break;
// Zoom canvas
case ACTION_ZOOM:
this.zoom(getMaxZoomRatio(pointers), event);
renderable = false;
break;
// Create crop box
case ACTION_CROP:
if (!range.x || !range.y) {
renderable = false;
break;
}
offset = getOffset(this.cropper);
left = pointer.startX - offset.left;
top = pointer.startY - offset.top;
width = cropBoxData.minWidth;
height = cropBoxData.minHeight;
if (range.x > 0) {
action = range.y > 0 ? ACTION_SOUTH_EAST : ACTION_NORTH_EAST;
} else if (range.x < 0) {
left -= width;
action = range.y > 0 ? ACTION_SOUTH_WEST : ACTION_NORTH_WEST;
}
if (range.y < 0) {
top -= height;
} // Show the crop box if is hidden
if (!this.cropped) {
removeClass(this.cropBox, CLASS_HIDDEN);
this.cropped = true;
if (this.limited) {
this.limitCropBox(true, true);
}
}
break;
}
if (renderable) {
cropBoxData.width = width;
cropBoxData.height = height;
cropBoxData.left = left;
cropBoxData.top = top;
this.action = action;
this.renderCropBox();
} // Override
forEach(pointers, function (p) {
p.startX = p.endX;
p.startY = p.endY;
});
}
};
var methods = {
// Show the crop box manually
crop: function crop() {
if (this.ready && !this.cropped && !this.disabled) {
this.cropped = true;
this.limitCropBox(true, true);
if (this.options.modal) {
addClass(this.dragBox, CLASS_MODAL);
}
removeClass(this.cropBox, CLASS_HIDDEN);
this.setCropBoxData(this.initialCropBoxData);
}
return this;
},
// Reset the image and crop box to their initial states
reset: function reset() {
if (this.ready && !this.disabled) {
this.imageData = assign({}, this.initialImageData);
this.canvasData = assign({}, this.initialCanvasData);
this.cropBoxData = assign({}, this.initialCropBoxData);
this.renderCanvas();
if (this.cropped) {
this.renderCropBox();
}
}
return this;
},
// Clear the crop box
clear: function clear() {
if (this.cropped && !this.disabled) {
assign(this.cropBoxData, {
left: 0,
top: 0,
width: 0,
height: 0
});
this.cropped = false;
this.renderCropBox();
this.limitCanvas(true, true); // Render canvas after crop box rendered
this.renderCanvas();
removeClass(this.dragBox, CLASS_MODAL);
addClass(this.cropBox, CLASS_HIDDEN);
}
return this;
},
/**
* Replace the image's src and rebuild the cropper
* @param {string} url - The new URL.
* @param {boolean} [hasSameSize] - Indicate if the new image has the same size as the old one.
* @returns {Cropper} this
*/
replace: function replace(url) {
var hasSameSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (!this.disabled && url) {
if (this.isImg) {
this.element.src = url;
}
if (hasSameSize) {
this.url = url;
this.image.src = url;
if (this.ready) {
this.viewBoxImage.src = url;
forEach(this.previews, function (element) {
element.getElementsByTagName('img')[0].src = url;
});
}
} else {
if (this.isImg) {
this.replaced = true;
}
this.options.data = null;
this.uncreate();
this.load(url);
}
}
return this;
},
// Enable (unfreeze) the cropper
enable: function enable() {
if (this.ready && this.disabled) {
this.disabled = false;
removeClass(this.cropper, CLASS_DISABLED);
}
return this;
},
// Disable (freeze) the cropper
disable: function disable() {
if (this.ready && !this.disabled) {
this.disabled = true;
addClass(this.cropper, CLASS_DISABLED);
}
return this;
},
/**
* Destroy the cropper and remove the instance from the image
* @returns {Cropper} this
*/
destroy: function destroy() {
var element = this.element;
if (!element[NAMESPACE]) {
return this;
}
element[NAMESPACE] = undefined;
if (this.isImg && this.replaced) {
element.src = this.originalUrl;
}
this.uncreate();
return this;
},
/**
* Move the canvas with relative offsets
* @param {number} offsetX - The relative offset distance on the x-axis.
* @param {number} [offsetY=offsetX] - The relative offset distance on the y-axis.
* @returns {Cropper} this
*/
move: function move(offsetX) {
var offsetY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : offsetX;
var _this$canvasData = this.canvasData,
left = _this$canvasData.left,
top = _this$canvasData.top;
return this.moveTo(isUndefined(offsetX) ? offsetX : left + Number(offsetX), isUndefined(offsetY) ? offsetY : top + Number(offsetY));
},
/**
* Move the canvas to an absolute point
* @param {number} x - The x-axis coordinate.
* @param {number} [y=x] - The y-axis coordinate.
* @returns {Cropper} this
*/
moveTo: function moveTo(x) {
var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x;
var canvasData = this.canvasData;
var changed = false;
x = Number(x);
y = Number(y);
if (this.ready && !this.disabled && this.options.movable) {
if (isNumber(x)) {
canvasData.left = x;
changed = true;
}
if (isNumber(y)) {
canvasData.top = y;
changed = true;
}
if (changed) {
this.renderCanvas(true);
}
}
return this;
},
/**
* Zoom the canvas with a relative ratio
* @param {number} ratio - The target ratio.
* @param {Event} _originalEvent - The original event if any.
* @returns {Cropper} this
*/
zoom: function zoom(ratio, _originalEvent) {
var canvasData = this.canvasData;
ratio = Number(ratio);
if (ratio < 0) {
ratio = 1 / (1 - ratio);
} else {
ratio = 1 + ratio;
}
return this.zoomTo(canvasData.width * ratio / canvasData.naturalWidth, null, _originalEvent);
},
/**
* Zoom the canvas to an absolute ratio
* @param {number} ratio - The target ratio.
* @param {Object} pivot - The zoom pivot point coordinate.
* @param {Event} _originalEvent - The original event if any.
* @returns {Cropper} this
*/
zoomTo: function zoomTo(ratio, pivot, _originalEvent) {
var options = this.options,
canvasData = this.canvasData;
var width = canvasData.width,
height = canvasData.height,
naturalWidth = canvasData.naturalWidth,
naturalHeight = canvasData.naturalHeight;
ratio = Number(ratio);
if (ratio >= 0 && this.ready && !this.disabled && options.zoomable) {
var newWidth = naturalWidth * ratio;
var newHeight = naturalHeight * ratio;
if (dispatchEvent(this.element, EVENT_ZOOM, {
ratio: ratio,
oldRatio: width / naturalWidth,
originalEvent: _originalEvent
}) === false) {
return this;
}
if (_originalEvent) {
var pointers = this.pointers;
var offset = getOffset(this.cropper);
var center = pointers && Object.keys(pointers).length ? getPointersCenter(pointers) : {
pageX: _originalEvent.pageX,
pageY: _originalEvent.pageY
}; // Zoom from the triggering point of the event
canvasData.left -= (newWidth - width) * ((center.pageX - offset.left - canvasData.left) / width);
canvasData.top -= (newHeight - height) * ((center.pageY - offset.top - canvasData.top) / height);
} else if (isPlainObject(pivot) && isNumber(pivot.x) && isNumber(pivot.y)) {
canvasData.left -= (newWidth - width) * ((pivot.x - canvasData.left) / width);
canvasData.top -= (newHeight - height) * ((pivot.y - canvasData.top) / height);
} else {
// Zoom from the center of the canvas
canvasData.left -= (newWidth - width) / 2;
canvasData.top -= (newHeight - height) / 2;
}
canvasData.width = newWidth;
canvasData.height = newHeight;
this.renderCanvas(true);
}
return this;
},
/**
* Rotate the canvas with a relative degree
* @param {number} degree - The rotate degree.
* @returns {Cropper} this
*/
rotate: function rotate(degree) {
return this.rotateTo((this.imageData.rotate || 0) + Number(degree));
},
/**
* Rotate the canvas to an absolute degree
* @param {number} degree - The rotate degree.
* @returns {Cropper} this
*/
rotateTo: function rotateTo(degree) {
degree = Number(degree);
if (isNumber(degree) && this.ready && !this.disabled && this.options.rotatable) {
this.imageData.rotate = degree % 360;
this.renderCanvas(true, true);
}
return this;
},
/**
* Scale the image on the x-axis.
* @param {number} scaleX - The scale ratio on the x-axis.
* @returns {Cropper} this
*/
scaleX: function scaleX(_scaleX) {
var scaleY = this.imageData.scaleY;
return this.scale(_scaleX, isNumber(scaleY) ? scaleY : 1);
},
/**
* Scale the image on the y-axis.
* @param {number} scaleY - The scale ratio on the y-axis.
* @returns {Cropper} this
*/
scaleY: function scaleY(_scaleY) {
var scaleX = this.imageData.scaleX;
return this.scale(isNumber(scaleX) ? scaleX : 1, _scaleY);
},
/**
* Scale the image
* @param {number} scaleX - The scale ratio on the x-axis.
* @param {number} [scaleY=scaleX] - The scale ratio on the y-axis.
* @returns {Cropper} this
*/
scale: function scale(scaleX) {
var scaleY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : scaleX;
var imageData = this.imageData;
var transformed = false;
scaleX = Number(scaleX);
scaleY = Number(scaleY);
if (this.ready && !this.disabled && this.options.scalable) {
if (isNumber(scaleX)) {
imageData.scaleX = scaleX;
transformed = true;
}
if (isNumber(scaleY)) {
imageData.scaleY = scaleY;
transformed = true;
}
if (transformed) {
this.renderCanvas(true, true);
}
}
return this;
},
/**
* Get the cropped area position and size data (base on the original image)
* @param {boolean} [rounded=false] - Indicate if round the data values or not.
* @returns {Object} The result cropped data.
*/
getData: function getData() {
var rounded = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
var options = this.options,
imageData = this.imageData,
canvasData = this.canvasData,
cropBoxData = this.cropBoxData;
var data;
if (this.ready && this.cropped) {
data = {
x: cropBoxData.left - canvasData.left,
y: cropBoxData.top - canvasData.top,
width: cropBoxData.width,
height: cropBoxData.height
};
var ratio = imageData.width / imageData.naturalWidth;
forEach(data, function (n, i) {
data[i] = n / ratio;
});
if (rounded) {
// In case rounding off leads to extra 1px in right or bottom border
// we should round the top-left corner and the dimension (#343).
var bottom = Math.round(data.y + data.height);
var right = Math.round(data.x + data.width);
data.x = Math.round(data.x);
data.y = Math.round(data.y);
data.width = right - data.x;
data.height = bottom - data.y;
}
} else {
data = {
x: 0,
y: 0,
width: 0,
height: 0
};
}
if (options.rotatable) {
data.rotate = imageData.rotate || 0;
}
if (options.scalable) {
data.scaleX = imageData.scaleX || 1;
data.scaleY = imageData.scaleY || 1;
}
return data;
},
/**
* Set the cropped area position and size with new data
* @param {Object} data - The new data.
* @returns {Cropper} this
*/
setData: function setData(data) {
var options = this.options,
imageData = this.imageData,
canvasData = this.canvasData;
var cropBoxData = {};
if (this.ready && !this.disabled && isPlainObject(data)) {
var transformed = false;
if (options.rotatable) {
if (isNumber(data.rotate) && data.rotate !== imageData.rotate) {
imageData.rotate = data.rotate;
transformed = true;
}
}
if (options.scalable) {
if (isNumber(data.scaleX) && data.scaleX !== imageData.scaleX) {
imageData.scaleX = data.scaleX;
transformed = true;
}
if (isNumber(data.scaleY) && data.scaleY !== imageData.scaleY) {
imageData.scaleY = data.scaleY;
transformed = true;
}
}
if (transformed) {
this.renderCanvas(true, true);
}
var ratio = imageData.width / imageData.naturalWidth;
if (isNumber(data.x)) {
cropBoxData.left = data.x * ratio + canvasData.left;
}
if (isNumber(data.y)) {
cropBoxData.top = data.y * ratio + canvasData.top;
}
if (isNumber(data.width)) {
cropBoxData.width = data.width * ratio;
}
if (isNumber(data.height)) {
cropBoxData.height = data.height * ratio;
}
this.setCropBoxData(cropBoxData);
}
return this;
},
/**
* Get the container size data.
* @returns {Object} The result container data.
*/
getContainerData: function getContainerData() {
return this.ready ? assign({}, this.containerData) : {};
},
/**
* Get the image position and size data.
* @returns {Object} The result image data.
*/
getImageData: function getImageData() {
return this.sized ? assign({}, this.imageData) : {};
},
/**
* Get the canvas position and size data.
* @returns {Object} The result canvas data.
*/
getCanvasData: function getCanvasData() {
var canvasData = this.canvasData;
var data = {};
if (this.ready) {
forEach(['left', 'top', 'width', 'height', 'naturalWidth', 'naturalHeight'], function (n) {
data[n] = canvasData[n];
});
}
return data;
},
/**
* Set the canvas position and size with new data.
* @param {Object} data - The new canvas data.
* @returns {Cropper} this
*/
setCanvasData: function setCanvasData(data) {
var canvasData = this.canvasData;
var aspectRatio = canvasData.aspectRatio;
if (this.ready && !this.disabled && isPlainObject(data)) {
if (isNumber(data.left)) {
canvasData.left = data.left;
}
if (isNumber(data.top)) {
canvasData.top = data.top;
}
if (isNumber(data.width)) {
canvasData.width = data.width;
canvasData.height = data.width / aspectRatio;
} else if (isNumber(data.height)) {
canvasData.height = data.height;
canvasData.width = data.height * aspectRatio;
}
this.renderCanvas(true);
}
return this;
},
/**
* Get the crop box position and size data.
* @returns {Object} The result crop box data.
*/
getCropBoxData: function getCropBoxData() {
var cropBoxData = this.cropBoxData;
var data;
if (this.ready && this.cropped) {
data = {
left: cropBoxData.left,
top: cropBoxData.top,
width: cropBoxData.width,
height: cropBoxData.height
};
}
return data || {};
},
/**
* Set the crop box position and size with new data.
* @param {Object} data - The new crop box data.
* @returns {Cropper} this
*/
setCropBoxData: function setCropBoxData(data) {
var cropBoxData = this.cropBoxData;
var aspectRatio = this.options.aspectRatio;
var widthChanged;
var heightChanged;
if (this.ready && this.cropped && !this.disabled && isPlainObject(data)) {
if (isNumber(data.left)) {
cropBoxData.left = data.left;
}
if (isNumber(data.top)) {
cropBoxData.top = data.top;
}
if (isNumber(data.width) && data.width !== cropBoxData.width) {
widthChanged = true;
cropBoxData.width = data.width;
}
if (isNumber(data.height) && data.height !== cropBoxData.height) {
heightChanged = true;
cropBoxData.height = data.height;
}
if (aspectRatio) {
if (widthChanged) {
cropBoxData.height = cropBoxData.width / aspectRatio;
} else if (heightChanged) {
cropBoxData.width = cropBoxData.height * aspectRatio;
}
}
this.renderCropBox();
}
return this;
},
/**
* Get a canvas drawn the cropped image.
* @param {Object} [options={}] - The config options.
* @returns {HTMLCanvasElement} - The result canvas.
*/
getCroppedCanvas: function getCroppedCanvas() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
if (!this.ready || !window.HTMLCanvasElement) {
return null;
}
var canvasData = this.canvasData;
var source = getSourceCanvas(this.image, this.imageData, canvasData, options); // Returns the source canvas if it is not cropped.
if (!this.cropped) {
return source;
}
var _this$getData = this.getData(),
initialX = _this$getData.x,
initialY = _this$getData.y,
initialWidth = _this$getData.width,
initialHeight = _this$getData.height;
var ratio = source.width / Math.floor(canvasData.naturalWidth);
if (ratio !== 1) {
initialX *= ratio;
initialY *= ratio;
initialWidth *= ratio;
initialHeight *= ratio;
}
var aspectRatio = initialWidth / initialHeight;
var maxSizes = getAdjustedSizes({
aspectRatio: aspectRatio,
width: options.maxWidth || Infinity,
height: options.maxHeight || Infinity
});
var minSizes = getAdjustedSizes({
aspectRatio: aspectRatio,
width: options.minWidth || 0,
height: options.minHeight || 0
}, 'cover');
var _getAdjustedSizes = getAdjustedSizes({
aspectRatio: aspectRatio,
width: options.width || (ratio !== 1 ? source.width : initialWidth),
height: options.height || (ratio !== 1 ? source.height : initialHeight)
}),
width = _getAdjustedSizes.width,
height = _getAdjustedSizes.height;
width = Math.min(maxSizes.width, Math.max(minSizes.width, width));
height = Math.min(maxSizes.height, Math.max(minSizes.height, height));
var canvas = document.createElement('canvas');
var context = canvas.getContext('2d');
canvas.width = normalizeDecimalNumber(width);
canvas.height = normalizeDecimalNumber(height);
context.fillStyle = options.fillColor || 'transparent';
context.fillRect(0, 0, width, height);
var _options$imageSmoothi = options.imageSmoothingEnabled,
imageSmoothingEnabled = _options$imageSmoothi === void 0 ? true : _options$imageSmoothi,
imageSmoothingQuality = options.imageSmoothingQuality;
context.imageSmoothingEnabled = imageSmoothingEnabled;
if (imageSmoothingQuality) {
context.imageSmoothingQuality = imageSmoothingQuality;
} // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D.drawImage
var sourceWidth = source.width;
var sourceHeight = source.height; // Source canvas parameters
var srcX = initialX;
var srcY = initialY;
var srcWidth;
var srcHeight; // Destination canvas parameters
var dstX;
var dstY;
var dstWidth;
var dstHeight;
if (srcX <= -initialWidth || srcX > sourceWidth) {
srcX = 0;
srcWidth = 0;
dstX = 0;
dstWidth = 0;
} else if (srcX <= 0) {
dstX = -srcX;
srcX = 0;
srcWidth = Math.min(sourceWidth, initialWidth + srcX);
dstWidth = srcWidth;
} else if (srcX <= sourceWidth) {
dstX = 0;
srcWidth = Math.min(initialWidth, sourceWidth - srcX);
dstWidth = srcWidth;
}
if (srcWidth <= 0 || srcY <= -initialHeight || srcY > sourceHeight) {
srcY = 0;
srcHeight = 0;
dstY = 0;
dstHeight = 0;
} else if (srcY <= 0) {
dstY = -srcY;
srcY = 0;
srcHeight = Math.min(sourceHeight, initialHeight + srcY);
dstHeight = srcHeight;
} else if (srcY <= sourceHeight) {
dstY = 0;
srcHeight = Math.min(initialHeight, sourceHeight - srcY);
dstHeight = srcHeight;
}
var params = [srcX, srcY, srcWidth, srcHeight]; // Avoid "IndexSizeError"
if (dstWidth > 0 && dstHeight > 0) {
var scale = width / initialWidth;
params.push(dstX * scale, dstY * scale, dstWidth * scale, dstHeight * scale);
} // All the numerical parameters should be integer for `drawImage`
// https://github.com/fengyuanchen/cropper/issues/476
context.drawImage.apply(context, [source].concat(_toConsumableArray(params.map(function (param) {
return Math.floor(normalizeDecimalNumber(param));
}))));
return canvas;
},
/**
* Change the aspect ratio of the crop box.
* @param {number} aspectRatio - The new aspect ratio.
* @returns {Cropper} this
*/
setAspectRatio: function setAspectRatio(aspectRatio) {
var options = this.options;
if (!this.disabled && !isUndefined(aspectRatio)) {
// 0 -> NaN
options.aspectRatio = Math.max(0, aspectRatio) || NaN;
if (this.ready) {
this.initCropBox();
if (this.cropped) {
this.renderCropBox();
}
}
}
return this;
},
/**
* Change the drag mode.
* @param {string} mode - The new drag mode.
* @returns {Cropper} this
*/
setDragMode: function setDragMode(mode) {
var options = this.options,
dragBox = this.dragBox,
face = this.face;
if (this.ready && !this.disabled) {
var croppable = mode === DRAG_MODE_CROP;
var movable = options.movable && mode === DRAG_MODE_MOVE;
mode = croppable || movable ? mode : DRAG_MODE_NONE;
options.dragMode = mode;
setData(dragBox, DATA_ACTION, mode);
toggleClass(dragBox, CLASS_CROP, croppable);
toggleClass(dragBox, CLASS_MOVE, movable);
if (!options.cropBoxMovable) {
// Sync drag mode to crop box when it is not movable
setData(face, DATA_ACTION, mode);
toggleClass(face, CLASS_CROP, croppable);
toggleClass(face, CLASS_MOVE, movable);
}
}
return this;
}
};
var AnotherCropper = WINDOW.Cropper;
var Cropper = /*#__PURE__*/function () {
/**
* Create a new Cropper.
* @param {Element} element - The target element for cropping.
* @param {Object} [options={}] - The configuration options.
*/
function Cropper(element) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, Cropper);
if (!element || !REGEXP_TAG_NAME.test(element.tagName)) {
throw new Error('The first argument is required and must be an <img> or <canvas> element.');
}
this.element = element;
this.options = assign({}, DEFAULTS, isPlainObject(options) && options);
this.cropped = false;
this.disabled = false;
this.pointers = {};
this.ready = false;
this.reloading = false;
this.replaced = false;
this.sized = false;
this.sizing = false;
this.init();
}
_createClass(Cropper, [{
key: "init",
value: function init() {
var element = this.element;
var tagName = element.tagName.toLowerCase();
var url;
if (element[NAMESPACE]) {
return;
}
element[NAMESPACE] = this;
if (tagName === 'img') {
this.isImg = true; // e.g.: "img/picture.jpg"
url = element.getAttribute('src') || '';
this.originalUrl = url; // Stop when it's a blank image
if (!url) {
return;
} // e.g.: "https://example.com/img/picture.jpg"
url = element.src;
} else if (tagName === 'canvas' && window.HTMLCanvasElement) {
url = element.toDataURL();
}
this.load(url);
}
}, {
key: "load",
value: function load(url) {
var _this = this;
if (!url) {
return;
}
this.url = url;
this.imageData = {};
var element = this.element,
options = this.options;
if (!options.rotatable && !options.scalable) {
options.checkOrientation = false;
} // Only IE10+ supports Typed Arrays
if (!options.checkOrientation || !window.ArrayBuffer) {
this.clone();
return;
} // Detect the mime type of the image directly if it is a Data URL
if (REGEXP_DATA_URL.test(url)) {
// Read ArrayBuffer from Data URL of JPEG images directly for better performance
if (REGEXP_DATA_URL_JPEG.test(url)) {
this.read(dataURLToArrayBuffer(url));
} else {
// Only a JPEG image may contains Exif Orientation information,
// the rest types of Data URLs are not necessary to check orientation at all.
this.clone();
}
return;
} // 1. Detect the mime type of the image by a XMLHttpRequest.
// 2. Load the image as ArrayBuffer for reading orientation if its a JPEG image.
var xhr = new XMLHttpRequest();
var clone = this.clone.bind(this);
this.reloading = true;
this.xhr = xhr; // 1. Cross origin requests are only supported for protocol schemes:
// http, https, data, chrome, chrome-extension.
// 2. Access to XMLHttpRequest from a Data URL will be blocked by CORS policy
// in some browsers as IE11 and Safari.
xhr.onabort = clone;
xhr.onerror = clone;
xhr.ontimeout = clone;
xhr.onprogress = function () {
// Abort the request directly if it not a JPEG image for better performance
if (xhr.getResponseHeader('content-type') !== MIME_TYPE_JPEG) {
xhr.abort();
}
};
xhr.onload = function () {
_this.read(xhr.response);
};
xhr.onloadend = function () {
_this.reloading = false;
_this.xhr = null;
}; // Bust cache when there is a "crossOrigin" property to avoid browser cache error
if (options.checkCrossOrigin && isCrossOriginURL(url) && element.crossOrigin) {
url = addTimestamp(url);
} // The third parameter is required for avoiding side-effect (#682)
xhr.open('GET', url, true);
xhr.responseType = 'arraybuffer';
xhr.withCredentials = element.crossOrigin === 'use-credentials';
xhr.send();
}
}, {
key: "read",
value: function read(arrayBuffer) {
var options = this.options,
imageData = this.imageData; // Reset the orientation value to its default value 1
// as some iOS browsers will render image with its orientation
var orientation = resetAndGetOrientation(arrayBuffer);
var rotate = 0;
var scaleX = 1;
var scaleY = 1;
if (orientation > 1) {
// Generate a new URL which has the default orientation value
this.url = arrayBufferToDataURL(arrayBuffer, MIME_TYPE_JPEG);
var _parseOrientation = parseOrientation(orientation);
rotate = _parseOrientation.rotate;
scaleX = _parseOrientation.scaleX;
scaleY = _parseOrientation.scaleY;
}
if (options.rotatable) {
imageData.rotate = rotate;
}
if (options.scalable) {
imageData.scaleX = scaleX;
imageData.scaleY = scaleY;
}
this.clone();
}
}, {
key: "clone",
value: function clone() {
var element = this.element,
url = this.url;
var crossOrigin = element.crossOrigin;
var crossOriginUrl = url;
if (this.options.checkCrossOrigin && isCrossOriginURL(url)) {
if (!crossOrigin) {
crossOrigin = 'anonymous';
} // Bust cache when there is not a "crossOrigin" property (#519)
crossOriginUrl = addTimestamp(url);
}
this.crossOrigin = crossOrigin;
this.crossOriginUrl = crossOriginUrl;
var image = document.createElement('img');
if (crossOrigin) {
image.crossOrigin = crossOrigin;
}
image.src = crossOriginUrl || url;
image.alt = element.alt || 'The image to crop';
this.image = image;
image.onload = this.start.bind(this);
image.onerror = this.stop.bind(this);
addClass(image, CLASS_HIDE);
element.parentNode.insertBefore(image, element.nextSibling);
}
}, {
key: "start",
value: function start() {
var _this2 = this;
var image = this.image;
image.onload = null;
image.onerror = null;
this.sizing = true; // Match all browsers that use WebKit as the layout engine in iOS devices,
// such as Safari for iOS, Chrome for iOS, and in-app browsers.
var isIOSWebKit = WINDOW.navigator && /(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(WINDOW.navigator.userAgent);
var done = function done(naturalWidth, naturalHeight) {
assign(_this2.imageData, {
naturalWidth: naturalWidth,
naturalHeight: naturalHeight,
aspectRatio: naturalWidth / naturalHeight
});
_this2.initialImageData = assign({}, _this2.imageData);
_this2.sizing = false;
_this2.sized = true;
_this2.build();
}; // Most modern browsers (excepts iOS WebKit)
if (image.naturalWidth && !isIOSWebKit) {
done(image.naturalWidth, image.naturalHeight);
return;
}
var sizingImage = document.createElement('img');
var body = document.body || document.documentElement;
this.sizingImage = sizingImage;
sizingImage.onload = function () {
done(sizingImage.width, sizingImage.height);
if (!isIOSWebKit) {
body.removeChild(sizingImage);
}
};
sizingImage.src = image.src; // iOS WebKit will convert the image automatically
// with its orientation once append it into DOM (#279)
if (!isIOSWebKit) {
sizingImage.style.cssText = 'left:0;' + 'max-height:none!important;' + 'max-width:none!important;' + 'min-height:0!important;' + 'min-width:0!important;' + 'opacity:0;' + 'position:absolute;' + 'top:0;' + 'z-index:-1;';
body.appendChild(sizingImage);
}
}
}, {
key: "stop",
value: function stop() {
var image = this.image;
image.onload = null;
image.onerror = null;
image.parentNode.removeChild(image);
this.image = null;
}
}, {
key: "build",
value: function build() {
if (!this.sized || this.ready) {
return;
}
var element = this.element,
options = this.options,
image = this.image; // Create cropper elements
var container = element.parentNode;
var template = document.createElement('div');
template.innerHTML = TEMPLATE;
var cropper = template.querySelector(".".concat(NAMESPACE, "-container"));
var canvas = cropper.querySelector(".".concat(NAMESPACE, "-canvas"));
var dragBox = cropper.querySelector(".".concat(NAMESPACE, "-drag-box"));
var cropBox = cropper.querySelector(".".concat(NAMESPACE, "-crop-box"));
var face = cropBox.querySelector(".".concat(NAMESPACE, "-face"));
this.container = container;
this.cropper = cropper;
this.canvas = canvas;
this.dragBox = dragBox;
this.cropBox = cropBox;
this.viewBox = cropper.querySelector(".".concat(NAMESPACE, "-view-box"));
this.face = face;
canvas.appendChild(image); // Hide the original image
addClass(element, CLASS_HIDDEN); // Inserts the cropper after to the current image
container.insertBefore(cropper, element.nextSibling); // Show the image if is hidden
if (!this.isImg) {
removeClass(image, CLASS_HIDE);
}
this.initPreview();
this.bind();
options.initialAspectRatio = Math.max(0, options.initialAspectRatio) || NaN;
options.aspectRatio = Math.max(0, options.aspectRatio) || NaN;
options.viewMode = Math.max(0, Math.min(3, Math.round(options.viewMode))) || 0;
addClass(cropBox, CLASS_HIDDEN);
if (!options.guides) {
addClass(cropBox.getElementsByClassName("".concat(NAMESPACE, "-dashed")), CLASS_HIDDEN);
}
if (!options.center) {
addClass(cropBox.getElementsByClassName("".concat(NAMESPACE, "-center")), CLASS_HIDDEN);
}
if (options.background) {
addClass(cropper, "".concat(NAMESPACE, "-bg"));
}
if (!options.highlight) {
addClass(face, CLASS_INVISIBLE);
}
if (options.cropBoxMovable) {
addClass(face, CLASS_MOVE);
setData(face, DATA_ACTION, ACTION_ALL);
}
if (!options.cropBoxResizable) {
addClass(cropBox.getElementsByClassName("".concat(NAMESPACE, "-line")), CLASS_HIDDEN);
addClass(cropBox.getElementsByClassName("".concat(NAMESPACE, "-point")), CLASS_HIDDEN);
}
this.render();
this.ready = true;
this.setDragMode(options.dragMode);
if (options.autoCrop) {
this.crop();
}
this.setData(options.data);
if (isFunction(options.ready)) {
addListener(element, EVENT_READY, options.ready, {
once: true
});
}
dispatchEvent(element, EVENT_READY);
}
}, {
key: "unbuild",
value: function unbuild() {
if (!this.ready) {
return;
}
this.ready = false;
this.unbind();
this.resetPreview();
this.cropper.parentNode.removeChild(this.cropper);
removeClass(this.element, CLASS_HIDDEN);
}
}, {
key: "uncreate",
value: function uncreate() {
if (this.ready) {
this.unbuild();
this.ready = false;
this.cropped = false;
} else if (this.sizing) {
this.sizingImage.onload = null;
this.sizing = false;
this.sized = false;
} else if (this.reloading) {
this.xhr.onabort = null;
this.xhr.abort();
} else if (this.image) {
this.stop();
}
}
/**
* Get the no conflict cropper class.
* @returns {Cropper} The cropper class.
*/
}], [{
key: "noConflict",
value: function noConflict() {
window.Cropper = AnotherCropper;
return Cropper;
}
/**
* Change the default options.
* @param {Object} options - The new default options.
*/
}, {
key: "setDefaults",
value: function setDefaults(options) {
assign(DEFAULTS, isPlainObject(options) && options);
}
}]);
return Cropper;
}();
assign(Cropper.prototype, render, preview, events, handlers, change, methods);
return Cropper;
});
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var fileType = __webpack_require__(33);
var imageExts = new Set(['jpg', 'png', 'gif', 'webp', 'flif', 'cr2', 'tif', 'bmp', 'jxr', 'psd', 'ico', 'bpg', 'jp2', 'jpm', 'jpx', 'heic', 'cur', 'dcm']);
var imageType = function imageType(input) {
var ret = fileType(input);
return imageExts.has(ret && ret.ext) ? ret : null;
};
module.exports = imageType; // TODO: Remove this for the next major release
module.exports.default = imageType;
Object.defineProperty(imageType, 'minimumBytes', {
value: fileType.minimumBytes
});
/***/ }),
/* 20 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/*
* decaffeinate suggestions:
* DS101: Remove unnecessary use of Array.from
* DS102: Remove unnecessary code created because of implicit returns
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
var moduleKeywords = ['extended', 'included'];
var Module = /*#__PURE__*/function () {
function Module() {
_classCallCheck(this, Module);
}
_createClass(Module, null, [{
key: "extends",
value: // Extend the base object itself like a static method
function _extends(obj) {
for (var key in obj) {
var value = obj[key];
if (!Array.from(moduleKeywords).includes(key)) {
this[key] = value;
}
}
if (obj.extended != null) {
obj.extended.apply(this);
}
return this;
} // Include methods on the object prototype
}, {
key: "includes",
value: function includes(obj) {
for (var key in obj) {
// Assign properties to the prototype
var value = obj[key];
if (!Array.from(moduleKeywords).includes(key)) {
this.prototype[key] = value;
}
}
if (obj.included != null) {
obj.included.apply(this);
}
return this;
} // Add methods on this prototype that point to another method
// on another object's prototype.
}, {
key: "delegate",
value: function delegate() {
var _this = this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var target = args.pop();
return Array.from(args).map(function (source) {
return _this.prototype[source] = target.prototype[source];
});
} // Create an alias for a function
}, {
key: "aliasFunction",
value: function aliasFunction(to, from) {
var _this2 = this;
return this.prototype[to] = function () {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
return _this2.prototype[from].apply(_this2, args);
};
} // Create an alias for a property
}, {
key: "aliasProperty",
value: function aliasProperty(to, from) {
return Object.defineProperty(this.prototype, to, {
get: function get() {
return this[from];
},
set: function set(val) {
return this[from] = val;
}
});
} // Execute a function in the context of the object, and pass
// a reference to the object's prototype.
}, {
key: "included",
value: function included(func) {
return func.call(this, this.prototype);
}
}]);
return Module;
}();
/* harmony default export */ __webpack_exports__["a"] = (Module);
/***/ }),
/* 21 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);
/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* DS202: Simplify dynamic range loops
* DS205: Consider reworking code to avoid use of IIFEs
* DS206: Consider reworking classes to avoid initClass
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
// Handles all of the various rendering methods in Caman. Most of the image modification happens
// here. A new Renderer object is created for every render operation.
var Renderer = /*#__PURE__*/function () {
function Renderer(c) {
_classCallCheck(this, Renderer);
this.processNext = this.processNext.bind(this);
this.c = c;
this.renderQueue = [];
this.modPixelData = null;
}
_createClass(Renderer, [{
key: "add",
value: function add(job) {
if (job == null) {
return;
}
return this.renderQueue.push(job);
} // Grabs the next operation from the render queue and passes it to Renderer
// for execution
}, {
key: "processNext",
value: function processNext() {
// If the queue is empty, fire the finished callback
if (this.renderQueue.length === 0) {
Caman.Event.trigger(this, "renderFinished");
if (this.finishedFn != null) {
this.finishedFn.call(this.c);
}
return this;
}
this.currentJob = this.renderQueue.shift();
switch (this.currentJob.type) {
case Caman.Filter.Type.LayerDequeue:
var layer = this.c.canvasQueue.shift();
this.c.executeLayer(layer);
return this.processNext();
case Caman.Filter.Type.LayerFinished:
this.c.applyCurrentLayer();
this.c.popContext();
return this.processNext();
case Caman.Filter.Type.LoadOverlay:
return this.loadOverlay(this.currentJob.layer, this.currentJob.src);
case Caman.Filter.Type.LoadLayerMask:
return this.loadLayerMask(this.currentJob.layer, this.currentJob.src);
case Caman.Filter.Type.Plugin:
return this.executePlugin();
default:
return this.executeFilter();
}
}
}, {
key: "execute",
value: function execute(callback) {
this.finishedFn = callback;
this.modPixelData = _util__WEBPACK_IMPORTED_MODULE_0__[/* Util */ "b"].dataArray(this.c.pixelData.length);
return this.processNext();
}
}, {
key: "eachBlock",
value: function eachBlock(fn) {
var _this = this;
// Prepare all the required render data
this.blocksDone = 0;
var n = this.c.pixelData.length;
var blockPixelLength = Math.floor(n / 4 / Renderer.Blocks);
var blockN = blockPixelLength * 4;
var lastBlockN = blockN + n / 4 % Renderer.Blocks * 4;
return function () {
var result = [];
for (var i = 0, end1 = Renderer.Blocks, asc = 0 <= end1; asc ? i < end1 : i > end1; asc ? i++ : i--) {
var start = i * blockN;
var end = start + (i === Renderer.Blocks - 1 ? lastBlockN : blockN);
if (Caman.NodeJS) {
var f = Fiber(function () {
return fn.call(_this, i, start, end);
});
var bnum = f.run();
result.push(_this.blockFinished(bnum));
} else {
result.push(setTimeout(function (i, start, end) {
return function () {
return fn.call(_this, i, start, end);
};
}(i, start, end), 0));
}
}
return result;
}();
} // The core of the image rendering, this function executes the provided filter.
//
// NOTE: this does not write the updated pixel data to the canvas. That happens when all filters
// are finished rendering in order to be as fast as possible.
}, {
key: "executeFilter",
value: function executeFilter() {
Caman.Event.trigger(this.c, "processStart", this.currentJob);
if (this.currentJob.type === Caman.Filter.Type.Single) {
return this.eachBlock(this.renderBlock);
} else {
return this.eachBlock(this.renderKernel);
}
} // Executes a standalone plugin
}, {
key: "executePlugin",
value: function executePlugin() {
_logger__WEBPACK_IMPORTED_MODULE_1__[/* Log */ "a"].debug("Executing plugin ".concat(this.currentJob.plugin));
Caman.Plugin.execute(this.c, this.currentJob.plugin, this.currentJob.args);
_logger__WEBPACK_IMPORTED_MODULE_1__[/* Log */ "a"].debug("Plugin ".concat(this.currentJob.plugin, " finished!"));
return this.processNext();
} // Renders a single block of the canvas with the current filter function
}, {
key: "renderBlock",
value: function renderBlock(bnum, start, end) {
_logger__WEBPACK_IMPORTED_MODULE_1__[/* Log */ "a"].debug("Block #".concat(bnum, " - Filter: ").concat(this.currentJob.name, ", Start: ").concat(start, ", End: ").concat(end));
Caman.Event.trigger(this.c, "blockStarted", {
blockNum: bnum,
totalBlocks: Renderer.Blocks,
startPixel: start,
endPixel: end
});
var pixel = new Caman.Pixel();
pixel.setContext(this.c);
for (var i = start, end1 = end; i < end1; i += 4) {
pixel.loc = i;
pixel.r = this.c.pixelData[i];
pixel.g = this.c.pixelData[i + 1];
pixel.b = this.c.pixelData[i + 2];
pixel.a = this.c.pixelData[i + 3];
this.currentJob.processFn(pixel);
this.c.pixelData[i] = _util__WEBPACK_IMPORTED_MODULE_0__[/* Util */ "b"].clampRGB(pixel.r);
this.c.pixelData[i + 1] = _util__WEBPACK_IMPORTED_MODULE_0__[/* Util */ "b"].clampRGB(pixel.g);
this.c.pixelData[i + 2] = _util__WEBPACK_IMPORTED_MODULE_0__[/* Util */ "b"].clampRGB(pixel.b);
this.c.pixelData[i + 3] = _util__WEBPACK_IMPORTED_MODULE_0__[/* Util */ "b"].clampRGB(pixel.a);
}
return this.blockFinished(bnum);
} // Applies an image kernel to the canvas
}, {
key: "renderKernel",
value: function renderKernel(bnum, start, end) {
var name = this.currentJob.name;
var bias = this.currentJob.bias;
var divisor = this.currentJob.divisor;
var n = this.c.pixelData.length;
var adjust = this.currentJob.adjust;
var adjustSize = Math.sqrt(adjust.length);
var kernel = [];
_logger__WEBPACK_IMPORTED_MODULE_1__[/* Log */ "a"].debug("Rendering kernel - Filter: ".concat(this.currentJob.name));
start = Math.max(start, this.c.dimensions.width * 4 * ((adjustSize - 1) / 2));
end = Math.min(end, n - this.c.dimensions.width * 4 * ((adjustSize - 1) / 2));
var builder = (adjustSize - 1) / 2;
var pixel = new Caman.Pixel();
pixel.setContext(this.c);
for (var i = start, end1 = end; i < end1; i += 4) {
pixel.loc = i;
var builderIndex = 0;
for (var j = -builder, end2 = builder, asc = -builder <= end2; asc ? j <= end2 : j >= end2; asc ? j++ : j--) {
for (var k = builder, end3 = -builder, asc1 = builder <= end3; asc1 ? k <= end3 : k >= end3; asc1 ? k++ : k--) {
var p = pixel.getPixelRelative(j, k);
kernel[builderIndex * 3] = p.r;
kernel[builderIndex * 3 + 1] = p.g;
kernel[builderIndex * 3 + 2] = p.b;
builderIndex++;
}
}
var res = this.processKernel(adjust, kernel, divisor, bias);
this.modPixelData[i] = _util__WEBPACK_IMPORTED_MODULE_0__[/* Util */ "b"].clampRGB(res.r);
this.modPixelData[i + 1] = _util__WEBPACK_IMPORTED_MODULE_0__[/* Util */ "b"].clampRGB(res.g);
this.modPixelData[i + 2] = _util__WEBPACK_IMPORTED_MODULE_0__[/* Util */ "b"].clampRGB(res.b);
this.modPixelData[i + 3] = this.c.pixelData[i + 3];
}
return this.blockFinished(bnum);
} // Called when a single block is finished rendering. Once all blocks are done, we signal that this
// filter is finished rendering and continue to the next step.
}, {
key: "blockFinished",
value: function blockFinished(bnum) {
if (bnum >= 0) {
_logger__WEBPACK_IMPORTED_MODULE_1__[/* Log */ "a"].debug("Block #".concat(bnum, " finished! Filter: ").concat(this.currentJob.name));
}
this.blocksDone++;
Caman.Event.trigger(this.c, "blockFinished", {
blockNum: bnum,
blocksFinished: this.blocksDone,
totalBlocks: Renderer.Blocks
});
if (this.blocksDone === Renderer.Blocks) {
if (this.currentJob.type === Caman.Filter.Type.Kernel) {
for (var i = 0, end = this.c.pixelData.length, asc = 0 <= end; asc ? i < end : i > end; asc ? i++ : i--) {
this.c.pixelData[i] = this.modPixelData[i];
}
}
if (bnum >= 0) {
_logger__WEBPACK_IMPORTED_MODULE_1__[/* Log */ "a"].debug("Filter ".concat(this.currentJob.name, " finished!"));
}
Caman.Event.trigger(this.c, "processComplete", this.currentJob);
return this.processNext();
}
} // The "filter function" for kernel adjustments.
}, {
key: "processKernel",
value: function processKernel(adjust, kernel, divisor, bias) {
var val = {
r: 0,
g: 0,
b: 0
};
for (var i = 0, end = adjust.length, asc = 0 <= end; asc ? i < end : i > end; asc ? i++ : i--) {
val.r += adjust[i] * kernel[i * 3];
val.g += adjust[i] * kernel[i * 3 + 1];
val.b += adjust[i] * kernel[i * 3 + 2];
}
val.r = val.r / divisor + bias;
val.g = val.g / divisor + bias;
val.b = val.b / divisor + bias;
return val;
} // Loads an image onto the current canvas
}, {
key: "loadOverlay",
value: function loadOverlay(layer, src) {
var _this2 = this;
var img = new Image();
img.onload = function () {
layer.context.drawImage(img, 0, 0, _this2.c.dimensions.width, _this2.c.dimensions.height);
layer.imageData = layer.context.getImageData(0, 0, _this2.c.dimensions.width, _this2.c.dimensions.height);
layer.pixelData = layer.imageData.data;
_this2.c.pixelData = layer.pixelData;
return _this2.processNext();
};
var proxyUrl = Caman.IO.remoteCheck(src);
return img.src = proxyUrl != null ? proxyUrl : src;
} // Loads an image and save as mask data
}, {
key: "loadLayerMask",
value: function loadLayerMask(layer, src) {
var _this3 = this;
var img = new Image();
img.onload = function () {
var canvas = document.createElement('canvas');
canvas.width = _this3.c.dimensions.width;
canvas.height = _this3.c.dimensions.height;
var context = canvas.getContext('2d');
context.drawImage(img, 0, 0, _this3.c.dimensions.width, _this3.c.dimensions.height);
var maskData = context.getImageData(0, 0, _this3.c.dimensions.width, _this3.c.dimensions.height);
layer.maskData = maskData.data;
return _this3.processNext();
};
var proxyUrl = Caman.IO.remoteCheck(src);
return img.src = proxyUrl != null ? proxyUrl : src;
}
}], [{
key: "initClass",
value: function initClass() {
// The number of blocks to split the image into during the render process to simulate
// concurrency. This also helps the browser manage the (possibly) long running render jobs.
this.Blocks = 4;
}
}]);
return Renderer;
}();
Renderer.initClass();
/* harmony default export */ __webpack_exports__["a"] = (Renderer);
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/** @license React v17.0.2
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/*
Modernizr 3.0.0pre (Custom Build) | MIT
*/
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var aa = __webpack_require__(2),
m = __webpack_require__(9),
r = __webpack_require__(24);
function y(a) {
for (var b = "https://reactjs.org/docs/error-decoder.html?invariant=" + a, c = 1; c < arguments.length; c++) {
b += "&args[]=" + encodeURIComponent(arguments[c]);
}
return "Minified React error #" + a + "; visit " + b + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";
}
if (!aa) throw Error(y(227));
var ba = new Set(),
ca = {};
function da(a, b) {
ea(a, b);
ea(a + "Capture", b);
}
function ea(a, b) {
ca[a] = b;
for (a = 0; a < b.length; a++) {
ba.add(b[a]);
}
}
var fa = !("undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement),
ha = /^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,
ia = Object.prototype.hasOwnProperty,
ja = {},
ka = {};
function la(a) {
if (ia.call(ka, a)) return !0;
if (ia.call(ja, a)) return !1;
if (ha.test(a)) return ka[a] = !0;
ja[a] = !0;
return !1;
}
function ma(a, b, c, d) {
if (null !== c && 0 === c.type) return !1;
switch (_typeof(b)) {
case "function":
case "symbol":
return !0;
case "boolean":
if (d) return !1;
if (null !== c) return !c.acceptsBooleans;
a = a.toLowerCase().slice(0, 5);
return "data-" !== a && "aria-" !== a;
default:
return !1;
}
}
function na(a, b, c, d) {
if (null === b || "undefined" === typeof b || ma(a, b, c, d)) return !0;
if (d) return !1;
if (null !== c) switch (c.type) {
case 3:
return !b;
case 4:
return !1 === b;
case 5:
return isNaN(b);
case 6:
return isNaN(b) || 1 > b;
}
return !1;
}
function B(a, b, c, d, e, f, g) {
this.acceptsBooleans = 2 === b || 3 === b || 4 === b;
this.attributeName = d;
this.attributeNamespace = e;
this.mustUseProperty = c;
this.propertyName = a;
this.type = b;
this.sanitizeURL = f;
this.removeEmptyString = g;
}
var D = {};
"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function (a) {
D[a] = new B(a, 0, !1, a, null, !1, !1);
});
[["acceptCharset", "accept-charset"], ["className", "class"], ["htmlFor", "for"], ["httpEquiv", "http-equiv"]].forEach(function (a) {
var b = a[0];
D[b] = new B(b, 1, !1, a[1], null, !1, !1);
});
["contentEditable", "draggable", "spellCheck", "value"].forEach(function (a) {
D[a] = new B(a, 2, !1, a.toLowerCase(), null, !1, !1);
});
["autoReverse", "externalResourcesRequired", "focusable", "preserveAlpha"].forEach(function (a) {
D[a] = new B(a, 2, !1, a, null, !1, !1);
});
"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function (a) {
D[a] = new B(a, 3, !1, a.toLowerCase(), null, !1, !1);
});
["checked", "multiple", "muted", "selected"].forEach(function (a) {
D[a] = new B(a, 3, !0, a, null, !1, !1);
});
["capture", "download"].forEach(function (a) {
D[a] = new B(a, 4, !1, a, null, !1, !1);
});
["cols", "rows", "size", "span"].forEach(function (a) {
D[a] = new B(a, 6, !1, a, null, !1, !1);
});
["rowSpan", "start"].forEach(function (a) {
D[a] = new B(a, 5, !1, a.toLowerCase(), null, !1, !1);
});
var oa = /[\-:]([a-z])/g;
function pa(a) {
return a[1].toUpperCase();
}
"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function (a) {
var b = a.replace(oa, pa);
D[b] = new B(b, 1, !1, a, null, !1, !1);
});
"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function (a) {
var b = a.replace(oa, pa);
D[b] = new B(b, 1, !1, a, "http://www.w3.org/1999/xlink", !1, !1);
});
["xml:base", "xml:lang", "xml:space"].forEach(function (a) {
var b = a.replace(oa, pa);
D[b] = new B(b, 1, !1, a, "http://www.w3.org/XML/1998/namespace", !1, !1);
});
["tabIndex", "crossOrigin"].forEach(function (a) {
D[a] = new B(a, 1, !1, a.toLowerCase(), null, !1, !1);
});
D.xlinkHref = new B("xlinkHref", 1, !1, "xlink:href", "http://www.w3.org/1999/xlink", !0, !1);
["src", "href", "action", "formAction"].forEach(function (a) {
D[a] = new B(a, 1, !1, a.toLowerCase(), null, !0, !0);
});
function qa(a, b, c, d) {
var e = D.hasOwnProperty(b) ? D[b] : null;
var f = null !== e ? 0 === e.type : d ? !1 : !(2 < b.length) || "o" !== b[0] && "O" !== b[0] || "n" !== b[1] && "N" !== b[1] ? !1 : !0;
f || (na(b, c, e, d) && (c = null), d || null === e ? la(b) && (null === c ? a.removeAttribute(b) : a.setAttribute(b, "" + c)) : e.mustUseProperty ? a[e.propertyName] = null === c ? 3 === e.type ? !1 : "" : c : (b = e.attributeName, d = e.attributeNamespace, null === c ? a.removeAttribute(b) : (e = e.type, c = 3 === e || 4 === e && !0 === c ? "" : "" + c, d ? a.setAttributeNS(d, b, c) : a.setAttribute(b, c))));
}
var ra = aa.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
sa = 60103,
ta = 60106,
ua = 60107,
wa = 60108,
xa = 60114,
ya = 60109,
za = 60110,
Aa = 60112,
Ba = 60113,
Ca = 60120,
Da = 60115,
Ea = 60116,
Fa = 60121,
Ga = 60128,
Ha = 60129,
Ia = 60130,
Ja = 60131;
if ("function" === typeof Symbol && Symbol.for) {
var E = Symbol.for;
sa = E("react.element");
ta = E("react.portal");
ua = E("react.fragment");
wa = E("react.strict_mode");
xa = E("react.profiler");
ya = E("react.provider");
za = E("react.context");
Aa = E("react.forward_ref");
Ba = E("react.suspense");
Ca = E("react.suspense_list");
Da = E("react.memo");
Ea = E("react.lazy");
Fa = E("react.block");
E("react.scope");
Ga = E("react.opaque.id");
Ha = E("react.debug_trace_mode");
Ia = E("react.offscreen");
Ja = E("react.legacy_hidden");
}
var Ka = "function" === typeof Symbol && Symbol.iterator;
function La(a) {
if (null === a || "object" !== _typeof(a)) return null;
a = Ka && a[Ka] || a["@@iterator"];
return "function" === typeof a ? a : null;
}
var Ma;
function Na(a) {
if (void 0 === Ma) try {
throw Error();
} catch (c) {
var b = c.stack.trim().match(/\n( *(at )?)/);
Ma = b && b[1] || "";
}
return "\n" + Ma + a;
}
var Oa = !1;
function Pa(a, b) {
if (!a || Oa) return "";
Oa = !0;
var c = Error.prepareStackTrace;
Error.prepareStackTrace = void 0;
try {
if (b) {
if (b = function b() {
throw Error();
}, Object.defineProperty(b.prototype, "props", {
set: function set() {
throw Error();
}
}), "object" === (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && Reflect.construct) {
try {
Reflect.construct(b, []);
} catch (k) {
var d = k;
}
Reflect.construct(a, [], b);
} else {
try {
b.call();
} catch (k) {
d = k;
}
a.call(b.prototype);
}
} else {
try {
throw Error();
} catch (k) {
d = k;
}
a();
}
} catch (k) {
if (k && d && "string" === typeof k.stack) {
for (var e = k.stack.split("\n"), f = d.stack.split("\n"), g = e.length - 1, h = f.length - 1; 1 <= g && 0 <= h && e[g] !== f[h];) {
h--;
}
for (; 1 <= g && 0 <= h; g--, h--) {
if (e[g] !== f[h]) {
if (1 !== g || 1 !== h) {
do {
if (g--, h--, 0 > h || e[g] !== f[h]) return "\n" + e[g].replace(" at new ", " at ");
} while (1 <= g && 0 <= h);
}
break;
}
}
}
} finally {
Oa = !1, Error.prepareStackTrace = c;
}
return (a = a ? a.displayName || a.name : "") ? Na(a) : "";
}
function Qa(a) {
switch (a.tag) {
case 5:
return Na(a.type);
case 16:
return Na("Lazy");
case 13:
return Na("Suspense");
case 19:
return Na("SuspenseList");
case 0:
case 2:
case 15:
return a = Pa(a.type, !1), a;
case 11:
return a = Pa(a.type.render, !1), a;
case 22:
return a = Pa(a.type._render, !1), a;
case 1:
return a = Pa(a.type, !0), a;
default:
return "";
}
}
function Ra(a) {
if (null == a) return null;
if ("function" === typeof a) return a.displayName || a.name || null;
if ("string" === typeof a) return a;
switch (a) {
case ua:
return "Fragment";
case ta:
return "Portal";
case xa:
return "Profiler";
case wa:
return "StrictMode";
case Ba:
return "Suspense";
case Ca:
return "SuspenseList";
}
if ("object" === _typeof(a)) switch (a.$$typeof) {
case za:
return (a.displayName || "Context") + ".Consumer";
case ya:
return (a._context.displayName || "Context") + ".Provider";
case Aa:
var b = a.render;
b = b.displayName || b.name || "";
return a.displayName || ("" !== b ? "ForwardRef(" + b + ")" : "ForwardRef");
case Da:
return Ra(a.type);
case Fa:
return Ra(a._render);
case Ea:
b = a._payload;
a = a._init;
try {
return Ra(a(b));
} catch (c) {}
}
return null;
}
function Sa(a) {
switch (_typeof(a)) {
case "boolean":
case "number":
case "object":
case "string":
case "undefined":
return a;
default:
return "";
}
}
function Ta(a) {
var b = a.type;
return (a = a.nodeName) && "input" === a.toLowerCase() && ("checkbox" === b || "radio" === b);
}
function Ua(a) {
var b = Ta(a) ? "checked" : "value",
c = Object.getOwnPropertyDescriptor(a.constructor.prototype, b),
d = "" + a[b];
if (!a.hasOwnProperty(b) && "undefined" !== typeof c && "function" === typeof c.get && "function" === typeof c.set) {
var e = c.get,
f = c.set;
Object.defineProperty(a, b, {
configurable: !0,
get: function get() {
return e.call(this);
},
set: function set(a) {
d = "" + a;
f.call(this, a);
}
});
Object.defineProperty(a, b, {
enumerable: c.enumerable
});
return {
getValue: function getValue() {
return d;
},
setValue: function setValue(a) {
d = "" + a;
},
stopTracking: function stopTracking() {
a._valueTracker = null;
delete a[b];
}
};
}
}
function Va(a) {
a._valueTracker || (a._valueTracker = Ua(a));
}
function Wa(a) {
if (!a) return !1;
var b = a._valueTracker;
if (!b) return !0;
var c = b.getValue();
var d = "";
a && (d = Ta(a) ? a.checked ? "true" : "false" : a.value);
a = d;
return a !== c ? (b.setValue(a), !0) : !1;
}
function Xa(a) {
a = a || ("undefined" !== typeof document ? document : void 0);
if ("undefined" === typeof a) return null;
try {
return a.activeElement || a.body;
} catch (b) {
return a.body;
}
}
function Ya(a, b) {
var c = b.checked;
return m({}, b, {
defaultChecked: void 0,
defaultValue: void 0,
value: void 0,
checked: null != c ? c : a._wrapperState.initialChecked
});
}
function Za(a, b) {
var c = null == b.defaultValue ? "" : b.defaultValue,
d = null != b.checked ? b.checked : b.defaultChecked;
c = Sa(null != b.value ? b.value : c);
a._wrapperState = {
initialChecked: d,
initialValue: c,
controlled: "checkbox" === b.type || "radio" === b.type ? null != b.checked : null != b.value
};
}
function $a(a, b) {
b = b.checked;
null != b && qa(a, "checked", b, !1);
}
function ab(a, b) {
$a(a, b);
var c = Sa(b.value),
d = b.type;
if (null != c) {
if ("number" === d) {
if (0 === c && "" === a.value || a.value != c) a.value = "" + c;
} else a.value !== "" + c && (a.value = "" + c);
} else if ("submit" === d || "reset" === d) {
a.removeAttribute("value");
return;
}
b.hasOwnProperty("value") ? bb(a, b.type, c) : b.hasOwnProperty("defaultValue") && bb(a, b.type, Sa(b.defaultValue));
null == b.checked && null != b.defaultChecked && (a.defaultChecked = !!b.defaultChecked);
}
function cb(a, b, c) {
if (b.hasOwnProperty("value") || b.hasOwnProperty("defaultValue")) {
var d = b.type;
if (!("submit" !== d && "reset" !== d || void 0 !== b.value && null !== b.value)) return;
b = "" + a._wrapperState.initialValue;
c || b === a.value || (a.value = b);
a.defaultValue = b;
}
c = a.name;
"" !== c && (a.name = "");
a.defaultChecked = !!a._wrapperState.initialChecked;
"" !== c && (a.name = c);
}
function bb(a, b, c) {
if ("number" !== b || Xa(a.ownerDocument) !== a) null == c ? a.defaultValue = "" + a._wrapperState.initialValue : a.defaultValue !== "" + c && (a.defaultValue = "" + c);
}
function db(a) {
var b = "";
aa.Children.forEach(a, function (a) {
null != a && (b += a);
});
return b;
}
function eb(a, b) {
a = m({
children: void 0
}, b);
if (b = db(b.children)) a.children = b;
return a;
}
function fb(a, b, c, d) {
a = a.options;
if (b) {
b = {};
for (var e = 0; e < c.length; e++) {
b["$" + c[e]] = !0;
}
for (c = 0; c < a.length; c++) {
e = b.hasOwnProperty("$" + a[c].value), a[c].selected !== e && (a[c].selected = e), e && d && (a[c].defaultSelected = !0);
}
} else {
c = "" + Sa(c);
b = null;
for (e = 0; e < a.length; e++) {
if (a[e].value === c) {
a[e].selected = !0;
d && (a[e].defaultSelected = !0);
return;
}
null !== b || a[e].disabled || (b = a[e]);
}
null !== b && (b.selected = !0);
}
}
function gb(a, b) {
if (null != b.dangerouslySetInnerHTML) throw Error(y(91));
return m({}, b, {
value: void 0,
defaultValue: void 0,
children: "" + a._wrapperState.initialValue
});
}
function hb(a, b) {
var c = b.value;
if (null == c) {
c = b.children;
b = b.defaultValue;
if (null != c) {
if (null != b) throw Error(y(92));
if (Array.isArray(c)) {
if (!(1 >= c.length)) throw Error(y(93));
c = c[0];
}
b = c;
}
null == b && (b = "");
c = b;
}
a._wrapperState = {
initialValue: Sa(c)
};
}
function ib(a, b) {
var c = Sa(b.value),
d = Sa(b.defaultValue);
null != c && (c = "" + c, c !== a.value && (a.value = c), null == b.defaultValue && a.defaultValue !== c && (a.defaultValue = c));
null != d && (a.defaultValue = "" + d);
}
function jb(a) {
var b = a.textContent;
b === a._wrapperState.initialValue && "" !== b && null !== b && (a.value = b);
}
var kb = {
html: "http://www.w3.org/1999/xhtml",
mathml: "http://www.w3.org/1998/Math/MathML",
svg: "http://www.w3.org/2000/svg"
};
function lb(a) {
switch (a) {
case "svg":
return "http://www.w3.org/2000/svg";
case "math":
return "http://www.w3.org/1998/Math/MathML";
default:
return "http://www.w3.org/1999/xhtml";
}
}
function mb(a, b) {
return null == a || "http://www.w3.org/1999/xhtml" === a ? lb(b) : "http://www.w3.org/2000/svg" === a && "foreignObject" === b ? "http://www.w3.org/1999/xhtml" : a;
}
var nb,
ob = function (a) {
return "undefined" !== typeof MSApp && MSApp.execUnsafeLocalFunction ? function (b, c, d, e) {
MSApp.execUnsafeLocalFunction(function () {
return a(b, c, d, e);
});
} : a;
}(function (a, b) {
if (a.namespaceURI !== kb.svg || "innerHTML" in a) a.innerHTML = b;else {
nb = nb || document.createElement("div");
nb.innerHTML = "<svg>" + b.valueOf().toString() + "</svg>";
for (b = nb.firstChild; a.firstChild;) {
a.removeChild(a.firstChild);
}
for (; b.firstChild;) {
a.appendChild(b.firstChild);
}
}
});
function pb(a, b) {
if (b) {
var c = a.firstChild;
if (c && c === a.lastChild && 3 === c.nodeType) {
c.nodeValue = b;
return;
}
}
a.textContent = b;
}
var qb = {
animationIterationCount: !0,
borderImageOutset: !0,
borderImageSlice: !0,
borderImageWidth: !0,
boxFlex: !0,
boxFlexGroup: !0,
boxOrdinalGroup: !0,
columnCount: !0,
columns: !0,
flex: !0,
flexGrow: !0,
flexPositive: !0,
flexShrink: !0,
flexNegative: !0,
flexOrder: !0,
gridArea: !0,
gridRow: !0,
gridRowEnd: !0,
gridRowSpan: !0,
gridRowStart: !0,
gridColumn: !0,
gridColumnEnd: !0,
gridColumnSpan: !0,
gridColumnStart: !0,
fontWeight: !0,
lineClamp: !0,
lineHeight: !0,
opacity: !0,
order: !0,
orphans: !0,
tabSize: !0,
widows: !0,
zIndex: !0,
zoom: !0,
fillOpacity: !0,
floodOpacity: !0,
stopOpacity: !0,
strokeDasharray: !0,
strokeDashoffset: !0,
strokeMiterlimit: !0,
strokeOpacity: !0,
strokeWidth: !0
},
rb = ["Webkit", "ms", "Moz", "O"];
Object.keys(qb).forEach(function (a) {
rb.forEach(function (b) {
b = b + a.charAt(0).toUpperCase() + a.substring(1);
qb[b] = qb[a];
});
});
function sb(a, b, c) {
return null == b || "boolean" === typeof b || "" === b ? "" : c || "number" !== typeof b || 0 === b || qb.hasOwnProperty(a) && qb[a] ? ("" + b).trim() : b + "px";
}
function tb(a, b) {
a = a.style;
for (var c in b) {
if (b.hasOwnProperty(c)) {
var d = 0 === c.indexOf("--"),
e = sb(c, b[c], d);
"float" === c && (c = "cssFloat");
d ? a.setProperty(c, e) : a[c] = e;
}
}
}
var ub = m({
menuitem: !0
}, {
area: !0,
base: !0,
br: !0,
col: !0,
embed: !0,
hr: !0,
img: !0,
input: !0,
keygen: !0,
link: !0,
meta: !0,
param: !0,
source: !0,
track: !0,
wbr: !0
});
function vb(a, b) {
if (b) {
if (ub[a] && (null != b.children || null != b.dangerouslySetInnerHTML)) throw Error(y(137, a));
if (null != b.dangerouslySetInnerHTML) {
if (null != b.children) throw Error(y(60));
if (!("object" === _typeof(b.dangerouslySetInnerHTML) && "__html" in b.dangerouslySetInnerHTML)) throw Error(y(61));
}
if (null != b.style && "object" !== _typeof(b.style)) throw Error(y(62));
}
}
function wb(a, b) {
if (-1 === a.indexOf("-")) return "string" === typeof b.is;
switch (a) {
case "annotation-xml":
case "color-profile":
case "font-face":
case "font-face-src":
case "font-face-uri":
case "font-face-format":
case "font-face-name":
case "missing-glyph":
return !1;
default:
return !0;
}
}
function xb(a) {
a = a.target || a.srcElement || window;
a.correspondingUseElement && (a = a.correspondingUseElement);
return 3 === a.nodeType ? a.parentNode : a;
}
var yb = null,
zb = null,
Ab = null;
function Bb(a) {
if (a = Cb(a)) {
if ("function" !== typeof yb) throw Error(y(280));
var b = a.stateNode;
b && (b = Db(b), yb(a.stateNode, a.type, b));
}
}
function Eb(a) {
zb ? Ab ? Ab.push(a) : Ab = [a] : zb = a;
}
function Fb() {
if (zb) {
var a = zb,
b = Ab;
Ab = zb = null;
Bb(a);
if (b) for (a = 0; a < b.length; a++) {
Bb(b[a]);
}
}
}
function Gb(a, b) {
return a(b);
}
function Hb(a, b, c, d, e) {
return a(b, c, d, e);
}
function Ib() {}
var Jb = Gb,
Kb = !1,
Lb = !1;
function Mb() {
if (null !== zb || null !== Ab) Ib(), Fb();
}
function Nb(a, b, c) {
if (Lb) return a(b, c);
Lb = !0;
try {
return Jb(a, b, c);
} finally {
Lb = !1, Mb();
}
}
function Ob(a, b) {
var c = a.stateNode;
if (null === c) return null;
var d = Db(c);
if (null === d) return null;
c = d[b];
a: switch (b) {
case "onClick":
case "onClickCapture":
case "onDoubleClick":
case "onDoubleClickCapture":
case "onMouseDown":
case "onMouseDownCapture":
case "onMouseMove":
case "onMouseMoveCapture":
case "onMouseUp":
case "onMouseUpCapture":
case "onMouseEnter":
(d = !d.disabled) || (a = a.type, d = !("button" === a || "input" === a || "select" === a || "textarea" === a));
a = !d;
break a;
default:
a = !1;
}
if (a) return null;
if (c && "function" !== typeof c) throw Error(y(231, b, _typeof(c)));
return c;
}
var Pb = !1;
if (fa) try {
var Qb = {};
Object.defineProperty(Qb, "passive", {
get: function get() {
Pb = !0;
}
});
window.addEventListener("test", Qb, Qb);
window.removeEventListener("test", Qb, Qb);
} catch (a) {
Pb = !1;
}
function Rb(a, b, c, d, e, f, g, h, k) {
var l = Array.prototype.slice.call(arguments, 3);
try {
b.apply(c, l);
} catch (n) {
this.onError(n);
}
}
var Sb = !1,
Tb = null,
Ub = !1,
Vb = null,
Wb = {
onError: function onError(a) {
Sb = !0;
Tb = a;
}
};
function Xb(a, b, c, d, e, f, g, h, k) {
Sb = !1;
Tb = null;
Rb.apply(Wb, arguments);
}
function Yb(a, b, c, d, e, f, g, h, k) {
Xb.apply(this, arguments);
if (Sb) {
if (Sb) {
var l = Tb;
Sb = !1;
Tb = null;
} else throw Error(y(198));
Ub || (Ub = !0, Vb = l);
}
}
function Zb(a) {
var b = a,
c = a;
if (a.alternate) for (; b.return;) {
b = b.return;
} else {
a = b;
do {
b = a, 0 !== (b.flags & 1026) && (c = b.return), a = b.return;
} while (a);
}
return 3 === b.tag ? c : null;
}
function $b(a) {
if (13 === a.tag) {
var b = a.memoizedState;
null === b && (a = a.alternate, null !== a && (b = a.memoizedState));
if (null !== b) return b.dehydrated;
}
return null;
}
function ac(a) {
if (Zb(a) !== a) throw Error(y(188));
}
function bc(a) {
var b = a.alternate;
if (!b) {
b = Zb(a);
if (null === b) throw Error(y(188));
return b !== a ? null : a;
}
for (var c = a, d = b;;) {
var e = c.return;
if (null === e) break;
var f = e.alternate;
if (null === f) {
d = e.return;
if (null !== d) {
c = d;
continue;
}
break;
}
if (e.child === f.child) {
for (f = e.child; f;) {
if (f === c) return ac(e), a;
if (f === d) return ac(e), b;
f = f.sibling;
}
throw Error(y(188));
}
if (c.return !== d.return) c = e, d = f;else {
for (var g = !1, h = e.child; h;) {
if (h === c) {
g = !0;
c = e;
d = f;
break;
}
if (h === d) {
g = !0;
d = e;
c = f;
break;
}
h = h.sibling;
}
if (!g) {
for (h = f.child; h;) {
if (h === c) {
g = !0;
c = f;
d = e;
break;
}
if (h === d) {
g = !0;
d = f;
c = e;
break;
}
h = h.sibling;
}
if (!g) throw Error(y(189));
}
}
if (c.alternate !== d) throw Error(y(190));
}
if (3 !== c.tag) throw Error(y(188));
return c.stateNode.current === c ? a : b;
}
function cc(a) {
a = bc(a);
if (!a) return null;
for (var b = a;;) {
if (5 === b.tag || 6 === b.tag) return b;
if (b.child) b.child.return = b, b = b.child;else {
if (b === a) break;
for (; !b.sibling;) {
if (!b.return || b.return === a) return null;
b = b.return;
}
b.sibling.return = b.return;
b = b.sibling;
}
}
return null;
}
function dc(a, b) {
for (var c = a.alternate; null !== b;) {
if (b === a || b === c) return !0;
b = b.return;
}
return !1;
}
var ec,
fc,
gc,
hc,
ic = !1,
jc = [],
kc = null,
lc = null,
mc = null,
nc = new Map(),
oc = new Map(),
pc = [],
qc = "mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");
function rc(a, b, c, d, e) {
return {
blockedOn: a,
domEventName: b,
eventSystemFlags: c | 16,
nativeEvent: e,
targetContainers: [d]
};
}
function sc(a, b) {
switch (a) {
case "focusin":
case "focusout":
kc = null;
break;
case "dragenter":
case "dragleave":
lc = null;
break;
case "mouseover":
case "mouseout":
mc = null;
break;
case "pointerover":
case "pointerout":
nc.delete(b.pointerId);
break;
case "gotpointercapture":
case "lostpointercapture":
oc.delete(b.pointerId);
}
}
function tc(a, b, c, d, e, f) {
if (null === a || a.nativeEvent !== f) return a = rc(b, c, d, e, f), null !== b && (b = Cb(b), null !== b && fc(b)), a;
a.eventSystemFlags |= d;
b = a.targetContainers;
null !== e && -1 === b.indexOf(e) && b.push(e);
return a;
}
function uc(a, b, c, d, e) {
switch (b) {
case "focusin":
return kc = tc(kc, a, b, c, d, e), !0;
case "dragenter":
return lc = tc(lc, a, b, c, d, e), !0;
case "mouseover":
return mc = tc(mc, a, b, c, d, e), !0;
case "pointerover":
var f = e.pointerId;
nc.set(f, tc(nc.get(f) || null, a, b, c, d, e));
return !0;
case "gotpointercapture":
return f = e.pointerId, oc.set(f, tc(oc.get(f) || null, a, b, c, d, e)), !0;
}
return !1;
}
function vc(a) {
var b = wc(a.target);
if (null !== b) {
var c = Zb(b);
if (null !== c) if (b = c.tag, 13 === b) {
if (b = $b(c), null !== b) {
a.blockedOn = b;
hc(a.lanePriority, function () {
r.unstable_runWithPriority(a.priority, function () {
gc(c);
});
});
return;
}
} else if (3 === b && c.stateNode.hydrate) {
a.blockedOn = 3 === c.tag ? c.stateNode.containerInfo : null;
return;
}
}
a.blockedOn = null;
}
function xc(a) {
if (null !== a.blockedOn) return !1;
for (var b = a.targetContainers; 0 < b.length;) {
var c = yc(a.domEventName, a.eventSystemFlags, b[0], a.nativeEvent);
if (null !== c) return b = Cb(c), null !== b && fc(b), a.blockedOn = c, !1;
b.shift();
}
return !0;
}
function zc(a, b, c) {
xc(a) && c.delete(b);
}
function Ac() {
for (ic = !1; 0 < jc.length;) {
var a = jc[0];
if (null !== a.blockedOn) {
a = Cb(a.blockedOn);
null !== a && ec(a);
break;
}
for (var b = a.targetContainers; 0 < b.length;) {
var c = yc(a.domEventName, a.eventSystemFlags, b[0], a.nativeEvent);
if (null !== c) {
a.blockedOn = c;
break;
}
b.shift();
}
null === a.blockedOn && jc.shift();
}
null !== kc && xc(kc) && (kc = null);
null !== lc && xc(lc) && (lc = null);
null !== mc && xc(mc) && (mc = null);
nc.forEach(zc);
oc.forEach(zc);
}
function Bc(a, b) {
a.blockedOn === b && (a.blockedOn = null, ic || (ic = !0, r.unstable_scheduleCallback(r.unstable_NormalPriority, Ac)));
}
function Cc(a) {
function b(b) {
return Bc(b, a);
}
if (0 < jc.length) {
Bc(jc[0], a);
for (var c = 1; c < jc.length; c++) {
var d = jc[c];
d.blockedOn === a && (d.blockedOn = null);
}
}
null !== kc && Bc(kc, a);
null !== lc && Bc(lc, a);
null !== mc && Bc(mc, a);
nc.forEach(b);
oc.forEach(b);
for (c = 0; c < pc.length; c++) {
d = pc[c], d.blockedOn === a && (d.blockedOn = null);
}
for (; 0 < pc.length && (c = pc[0], null === c.blockedOn);) {
vc(c), null === c.blockedOn && pc.shift();
}
}
function Dc(a, b) {
var c = {};
c[a.toLowerCase()] = b.toLowerCase();
c["Webkit" + a] = "webkit" + b;
c["Moz" + a] = "moz" + b;
return c;
}
var Ec = {
animationend: Dc("Animation", "AnimationEnd"),
animationiteration: Dc("Animation", "AnimationIteration"),
animationstart: Dc("Animation", "AnimationStart"),
transitionend: Dc("Transition", "TransitionEnd")
},
Fc = {},
Gc = {};
fa && (Gc = document.createElement("div").style, "AnimationEvent" in window || (delete Ec.animationend.animation, delete Ec.animationiteration.animation, delete Ec.animationstart.animation), "TransitionEvent" in window || delete Ec.transitionend.transition);
function Hc(a) {
if (Fc[a]) return Fc[a];
if (!Ec[a]) return a;
var b = Ec[a],
c;
for (c in b) {
if (b.hasOwnProperty(c) && c in Gc) return Fc[a] = b[c];
}
return a;
}
var Ic = Hc("animationend"),
Jc = Hc("animationiteration"),
Kc = Hc("animationstart"),
Lc = Hc("transitionend"),
Mc = new Map(),
Nc = new Map(),
Oc = ["abort", "abort", Ic, "animationEnd", Jc, "animationIteration", Kc, "animationStart", "canplay", "canPlay", "canplaythrough", "canPlayThrough", "durationchange", "durationChange", "emptied", "emptied", "encrypted", "encrypted", "ended", "ended", "error", "error", "gotpointercapture", "gotPointerCapture", "load", "load", "loadeddata", "loadedData", "loadedmetadata", "loadedMetadata", "loadstart", "loadStart", "lostpointercapture", "lostPointerCapture", "playing", "playing", "progress", "progress", "seeking", "seeking", "stalled", "stalled", "suspend", "suspend", "timeupdate", "timeUpdate", Lc, "transitionEnd", "waiting", "waiting"];
function Pc(a, b) {
for (var c = 0; c < a.length; c += 2) {
var d = a[c],
e = a[c + 1];
e = "on" + (e[0].toUpperCase() + e.slice(1));
Nc.set(d, b);
Mc.set(d, e);
da(e, [d]);
}
}
var Qc = r.unstable_now;
Qc();
var F = 8;
function Rc(a) {
if (0 !== (1 & a)) return F = 15, 1;
if (0 !== (2 & a)) return F = 14, 2;
if (0 !== (4 & a)) return F = 13, 4;
var b = 24 & a;
if (0 !== b) return F = 12, b;
if (0 !== (a & 32)) return F = 11, 32;
b = 192 & a;
if (0 !== b) return F = 10, b;
if (0 !== (a & 256)) return F = 9, 256;
b = 3584 & a;
if (0 !== b) return F = 8, b;
if (0 !== (a & 4096)) return F = 7, 4096;
b = 4186112 & a;
if (0 !== b) return F = 6, b;
b = 62914560 & a;
if (0 !== b) return F = 5, b;
if (a & 67108864) return F = 4, 67108864;
if (0 !== (a & 134217728)) return F = 3, 134217728;
b = 805306368 & a;
if (0 !== b) return F = 2, b;
if (0 !== (1073741824 & a)) return F = 1, 1073741824;
F = 8;
return a;
}
function Sc(a) {
switch (a) {
case 99:
return 15;
case 98:
return 10;
case 97:
case 96:
return 8;
case 95:
return 2;
default:
return 0;
}
}
function Tc(a) {
switch (a) {
case 15:
case 14:
return 99;
case 13:
case 12:
case 11:
case 10:
return 98;
case 9:
case 8:
case 7:
case 6:
case 4:
case 5:
return 97;
case 3:
case 2:
case 1:
return 95;
case 0:
return 90;
default:
throw Error(y(358, a));
}
}
function Uc(a, b) {
var c = a.pendingLanes;
if (0 === c) return F = 0;
var d = 0,
e = 0,
f = a.expiredLanes,
g = a.suspendedLanes,
h = a.pingedLanes;
if (0 !== f) d = f, e = F = 15;else if (f = c & 134217727, 0 !== f) {
var k = f & ~g;
0 !== k ? (d = Rc(k), e = F) : (h &= f, 0 !== h && (d = Rc(h), e = F));
} else f = c & ~g, 0 !== f ? (d = Rc(f), e = F) : 0 !== h && (d = Rc(h), e = F);
if (0 === d) return 0;
d = 31 - Vc(d);
d = c & ((0 > d ? 0 : 1 << d) << 1) - 1;
if (0 !== b && b !== d && 0 === (b & g)) {
Rc(b);
if (e <= F) return b;
F = e;
}
b = a.entangledLanes;
if (0 !== b) for (a = a.entanglements, b &= d; 0 < b;) {
c = 31 - Vc(b), e = 1 << c, d |= a[c], b &= ~e;
}
return d;
}
function Wc(a) {
a = a.pendingLanes & -1073741825;
return 0 !== a ? a : a & 1073741824 ? 1073741824 : 0;
}
function Xc(a, b) {
switch (a) {
case 15:
return 1;
case 14:
return 2;
case 12:
return a = Yc(24 & ~b), 0 === a ? Xc(10, b) : a;
case 10:
return a = Yc(192 & ~b), 0 === a ? Xc(8, b) : a;
case 8:
return a = Yc(3584 & ~b), 0 === a && (a = Yc(4186112 & ~b), 0 === a && (a = 512)), a;
case 2:
return b = Yc(805306368 & ~b), 0 === b && (b = 268435456), b;
}
throw Error(y(358, a));
}
function Yc(a) {
return a & -a;
}
function Zc(a) {
for (var b = [], c = 0; 31 > c; c++) {
b.push(a);
}
return b;
}
function $c(a, b, c) {
a.pendingLanes |= b;
var d = b - 1;
a.suspendedLanes &= d;
a.pingedLanes &= d;
a = a.eventTimes;
b = 31 - Vc(b);
a[b] = c;
}
var Vc = Math.clz32 ? Math.clz32 : ad,
bd = Math.log,
cd = Math.LN2;
function ad(a) {
return 0 === a ? 32 : 31 - (bd(a) / cd | 0) | 0;
}
var dd = r.unstable_UserBlockingPriority,
ed = r.unstable_runWithPriority,
fd = !0;
function gd(a, b, c, d) {
Kb || Ib();
var e = hd,
f = Kb;
Kb = !0;
try {
Hb(e, a, b, c, d);
} finally {
(Kb = f) || Mb();
}
}
function id(a, b, c, d) {
ed(dd, hd.bind(null, a, b, c, d));
}
function hd(a, b, c, d) {
if (fd) {
var e;
if ((e = 0 === (b & 4)) && 0 < jc.length && -1 < qc.indexOf(a)) a = rc(null, a, b, c, d), jc.push(a);else {
var f = yc(a, b, c, d);
if (null === f) e && sc(a, d);else {
if (e) {
if (-1 < qc.indexOf(a)) {
a = rc(f, a, b, c, d);
jc.push(a);
return;
}
if (uc(f, a, b, c, d)) return;
sc(a, d);
}
jd(a, b, d, null, c);
}
}
}
}
function yc(a, b, c, d) {
var e = xb(d);
e = wc(e);
if (null !== e) {
var f = Zb(e);
if (null === f) e = null;else {
var g = f.tag;
if (13 === g) {
e = $b(f);
if (null !== e) return e;
e = null;
} else if (3 === g) {
if (f.stateNode.hydrate) return 3 === f.tag ? f.stateNode.containerInfo : null;
e = null;
} else f !== e && (e = null);
}
}
jd(a, b, d, e, c);
return null;
}
var kd = null,
ld = null,
md = null;
function nd() {
if (md) return md;
var a,
b = ld,
c = b.length,
d,
e = "value" in kd ? kd.value : kd.textContent,
f = e.length;
for (a = 0; a < c && b[a] === e[a]; a++) {
;
}
var g = c - a;
for (d = 1; d <= g && b[c - d] === e[f - d]; d++) {
;
}
return md = e.slice(a, 1 < d ? 1 - d : void 0);
}
function od(a) {
var b = a.keyCode;
"charCode" in a ? (a = a.charCode, 0 === a && 13 === b && (a = 13)) : a = b;
10 === a && (a = 13);
return 32 <= a || 13 === a ? a : 0;
}
function pd() {
return !0;
}
function qd() {
return !1;
}
function rd(a) {
function b(b, d, e, f, g) {
this._reactName = b;
this._targetInst = e;
this.type = d;
this.nativeEvent = f;
this.target = g;
this.currentTarget = null;
for (var c in a) {
a.hasOwnProperty(c) && (b = a[c], this[c] = b ? b(f) : f[c]);
}
this.isDefaultPrevented = (null != f.defaultPrevented ? f.defaultPrevented : !1 === f.returnValue) ? pd : qd;
this.isPropagationStopped = qd;
return this;
}
m(b.prototype, {
preventDefault: function preventDefault() {
this.defaultPrevented = !0;
var a = this.nativeEvent;
a && (a.preventDefault ? a.preventDefault() : "unknown" !== typeof a.returnValue && (a.returnValue = !1), this.isDefaultPrevented = pd);
},
stopPropagation: function stopPropagation() {
var a = this.nativeEvent;
a && (a.stopPropagation ? a.stopPropagation() : "unknown" !== typeof a.cancelBubble && (a.cancelBubble = !0), this.isPropagationStopped = pd);
},
persist: function persist() {},
isPersistent: pd
});
return b;
}
var sd = {
eventPhase: 0,
bubbles: 0,
cancelable: 0,
timeStamp: function timeStamp(a) {
return a.timeStamp || Date.now();
},
defaultPrevented: 0,
isTrusted: 0
},
td = rd(sd),
ud = m({}, sd, {
view: 0,
detail: 0
}),
vd = rd(ud),
wd,
xd,
yd,
Ad = m({}, ud, {
screenX: 0,
screenY: 0,
clientX: 0,
clientY: 0,
pageX: 0,
pageY: 0,
ctrlKey: 0,
shiftKey: 0,
altKey: 0,
metaKey: 0,
getModifierState: zd,
button: 0,
buttons: 0,
relatedTarget: function relatedTarget(a) {
return void 0 === a.relatedTarget ? a.fromElement === a.srcElement ? a.toElement : a.fromElement : a.relatedTarget;
},
movementX: function movementX(a) {
if ("movementX" in a) return a.movementX;
a !== yd && (yd && "mousemove" === a.type ? (wd = a.screenX - yd.screenX, xd = a.screenY - yd.screenY) : xd = wd = 0, yd = a);
return wd;
},
movementY: function movementY(a) {
return "movementY" in a ? a.movementY : xd;
}
}),
Bd = rd(Ad),
Cd = m({}, Ad, {
dataTransfer: 0
}),
Dd = rd(Cd),
Ed = m({}, ud, {
relatedTarget: 0
}),
Fd = rd(Ed),
Gd = m({}, sd, {
animationName: 0,
elapsedTime: 0,
pseudoElement: 0
}),
Hd = rd(Gd),
Id = m({}, sd, {
clipboardData: function clipboardData(a) {
return "clipboardData" in a ? a.clipboardData : window.clipboardData;
}
}),
Jd = rd(Id),
Kd = m({}, sd, {
data: 0
}),
Ld = rd(Kd),
Md = {
Esc: "Escape",
Spacebar: " ",
Left: "ArrowLeft",
Up: "ArrowUp",
Right: "ArrowRight",
Down: "ArrowDown",
Del: "Delete",
Win: "OS",
Menu: "ContextMenu",
Apps: "ContextMenu",
Scroll: "ScrollLock",
MozPrintableKey: "Unidentified"
},
Nd = {
8: "Backspace",
9: "Tab",
12: "Clear",
13: "Enter",
16: "Shift",
17: "Control",
18: "Alt",
19: "Pause",
20: "CapsLock",
27: "Escape",
32: " ",
33: "PageUp",
34: "PageDown",
35: "End",
36: "Home",
37: "ArrowLeft",
38: "ArrowUp",
39: "ArrowRight",
40: "ArrowDown",
45: "Insert",
46: "Delete",
112: "F1",
113: "F2",
114: "F3",
115: "F4",
116: "F5",
117: "F6",
118: "F7",
119: "F8",
120: "F9",
121: "F10",
122: "F11",
123: "F12",
144: "NumLock",
145: "ScrollLock",
224: "Meta"
},
Od = {
Alt: "altKey",
Control: "ctrlKey",
Meta: "metaKey",
Shift: "shiftKey"
};
function Pd(a) {
var b = this.nativeEvent;
return b.getModifierState ? b.getModifierState(a) : (a = Od[a]) ? !!b[a] : !1;
}
function zd() {
return Pd;
}
var Qd = m({}, ud, {
key: function key(a) {
if (a.key) {
var b = Md[a.key] || a.key;
if ("Unidentified" !== b) return b;
}
return "keypress" === a.type ? (a = od(a), 13 === a ? "Enter" : String.fromCharCode(a)) : "keydown" === a.type || "keyup" === a.type ? Nd[a.keyCode] || "Unidentified" : "";
},
code: 0,
location: 0,
ctrlKey: 0,
shiftKey: 0,
altKey: 0,
metaKey: 0,
repeat: 0,
locale: 0,
getModifierState: zd,
charCode: function charCode(a) {
return "keypress" === a.type ? od(a) : 0;
},
keyCode: function keyCode(a) {
return "keydown" === a.type || "keyup" === a.type ? a.keyCode : 0;
},
which: function which(a) {
return "keypress" === a.type ? od(a) : "keydown" === a.type || "keyup" === a.type ? a.keyCode : 0;
}
}),
Rd = rd(Qd),
Sd = m({}, Ad, {
pointerId: 0,
width: 0,
height: 0,
pressure: 0,
tangentialPressure: 0,
tiltX: 0,
tiltY: 0,
twist: 0,
pointerType: 0,
isPrimary: 0
}),
Td = rd(Sd),
Ud = m({}, ud, {
touches: 0,
targetTouches: 0,
changedTouches: 0,
altKey: 0,
metaKey: 0,
ctrlKey: 0,
shiftKey: 0,
getModifierState: zd
}),
Vd = rd(Ud),
Wd = m({}, sd, {
propertyName: 0,
elapsedTime: 0,
pseudoElement: 0
}),
Xd = rd(Wd),
Yd = m({}, Ad, {
deltaX: function deltaX(a) {
return "deltaX" in a ? a.deltaX : "wheelDeltaX" in a ? -a.wheelDeltaX : 0;
},
deltaY: function deltaY(a) {
return "deltaY" in a ? a.deltaY : "wheelDeltaY" in a ? -a.wheelDeltaY : "wheelDelta" in a ? -a.wheelDelta : 0;
},
deltaZ: 0,
deltaMode: 0
}),
Zd = rd(Yd),
$d = [9, 13, 27, 32],
ae = fa && "CompositionEvent" in window,
be = null;
fa && "documentMode" in document && (be = document.documentMode);
var ce = fa && "TextEvent" in window && !be,
de = fa && (!ae || be && 8 < be && 11 >= be),
ee = String.fromCharCode(32),
fe = !1;
function ge(a, b) {
switch (a) {
case "keyup":
return -1 !== $d.indexOf(b.keyCode);
case "keydown":
return 229 !== b.keyCode;
case "keypress":
case "mousedown":
case "focusout":
return !0;
default:
return !1;
}
}
function he(a) {
a = a.detail;
return "object" === _typeof(a) && "data" in a ? a.data : null;
}
var ie = !1;
function je(a, b) {
switch (a) {
case "compositionend":
return he(b);
case "keypress":
if (32 !== b.which) return null;
fe = !0;
return ee;
case "textInput":
return a = b.data, a === ee && fe ? null : a;
default:
return null;
}
}
function ke(a, b) {
if (ie) return "compositionend" === a || !ae && ge(a, b) ? (a = nd(), md = ld = kd = null, ie = !1, a) : null;
switch (a) {
case "paste":
return null;
case "keypress":
if (!(b.ctrlKey || b.altKey || b.metaKey) || b.ctrlKey && b.altKey) {
if (b.char && 1 < b.char.length) return b.char;
if (b.which) return String.fromCharCode(b.which);
}
return null;
case "compositionend":
return de && "ko" !== b.locale ? null : b.data;
default:
return null;
}
}
var le = {
color: !0,
date: !0,
datetime: !0,
"datetime-local": !0,
email: !0,
month: !0,
number: !0,
password: !0,
range: !0,
search: !0,
tel: !0,
text: !0,
time: !0,
url: !0,
week: !0
};
function me(a) {
var b = a && a.nodeName && a.nodeName.toLowerCase();
return "input" === b ? !!le[a.type] : "textarea" === b ? !0 : !1;
}
function ne(a, b, c, d) {
Eb(d);
b = oe(b, "onChange");
0 < b.length && (c = new td("onChange", "change", null, c, d), a.push({
event: c,
listeners: b
}));
}
var pe = null,
qe = null;
function re(a) {
se(a, 0);
}
function te(a) {
var b = ue(a);
if (Wa(b)) return a;
}
function ve(a, b) {
if ("change" === a) return b;
}
var we = !1;
if (fa) {
var xe;
if (fa) {
var ye = ("oninput" in document);
if (!ye) {
var ze = document.createElement("div");
ze.setAttribute("oninput", "return;");
ye = "function" === typeof ze.oninput;
}
xe = ye;
} else xe = !1;
we = xe && (!document.documentMode || 9 < document.documentMode);
}
function Ae() {
pe && (pe.detachEvent("onpropertychange", Be), qe = pe = null);
}
function Be(a) {
if ("value" === a.propertyName && te(qe)) {
var b = [];
ne(b, qe, a, xb(a));
a = re;
if (Kb) a(b);else {
Kb = !0;
try {
Gb(a, b);
} finally {
Kb = !1, Mb();
}
}
}
}
function Ce(a, b, c) {
"focusin" === a ? (Ae(), pe = b, qe = c, pe.attachEvent("onpropertychange", Be)) : "focusout" === a && Ae();
}
function De(a) {
if ("selectionchange" === a || "keyup" === a || "keydown" === a) return te(qe);
}
function Ee(a, b) {
if ("click" === a) return te(b);
}
function Fe(a, b) {
if ("input" === a || "change" === a) return te(b);
}
function Ge(a, b) {
return a === b && (0 !== a || 1 / a === 1 / b) || a !== a && b !== b;
}
var He = "function" === typeof Object.is ? Object.is : Ge,
Ie = Object.prototype.hasOwnProperty;
function Je(a, b) {
if (He(a, b)) return !0;
if ("object" !== _typeof(a) || null === a || "object" !== _typeof(b) || null === b) return !1;
var c = Object.keys(a),
d = Object.keys(b);
if (c.length !== d.length) return !1;
for (d = 0; d < c.length; d++) {
if (!Ie.call(b, c[d]) || !He(a[c[d]], b[c[d]])) return !1;
}
return !0;
}
function Ke(a) {
for (; a && a.firstChild;) {
a = a.firstChild;
}
return a;
}
function Le(a, b) {
var c = Ke(a);
a = 0;
for (var d; c;) {
if (3 === c.nodeType) {
d = a + c.textContent.length;
if (a <= b && d >= b) return {
node: c,
offset: b - a
};
a = d;
}
a: {
for (; c;) {
if (c.nextSibling) {
c = c.nextSibling;
break a;
}
c = c.parentNode;
}
c = void 0;
}
c = Ke(c);
}
}
function Me(a, b) {
return a && b ? a === b ? !0 : a && 3 === a.nodeType ? !1 : b && 3 === b.nodeType ? Me(a, b.parentNode) : "contains" in a ? a.contains(b) : a.compareDocumentPosition ? !!(a.compareDocumentPosition(b) & 16) : !1 : !1;
}
function Ne() {
for (var a = window, b = Xa(); b instanceof a.HTMLIFrameElement;) {
try {
var c = "string" === typeof b.contentWindow.location.href;
} catch (d) {
c = !1;
}
if (c) a = b.contentWindow;else break;
b = Xa(a.document);
}
return b;
}
function Oe(a) {
var b = a && a.nodeName && a.nodeName.toLowerCase();
return b && ("input" === b && ("text" === a.type || "search" === a.type || "tel" === a.type || "url" === a.type || "password" === a.type) || "textarea" === b || "true" === a.contentEditable);
}
var Pe = fa && "documentMode" in document && 11 >= document.documentMode,
Qe = null,
Re = null,
Se = null,
Te = !1;
function Ue(a, b, c) {
var d = c.window === c ? c.document : 9 === c.nodeType ? c : c.ownerDocument;
Te || null == Qe || Qe !== Xa(d) || (d = Qe, "selectionStart" in d && Oe(d) ? d = {
start: d.selectionStart,
end: d.selectionEnd
} : (d = (d.ownerDocument && d.ownerDocument.defaultView || window).getSelection(), d = {
anchorNode: d.anchorNode,
anchorOffset: d.anchorOffset,
focusNode: d.focusNode,
focusOffset: d.focusOffset
}), Se && Je(Se, d) || (Se = d, d = oe(Re, "onSelect"), 0 < d.length && (b = new td("onSelect", "select", null, b, c), a.push({
event: b,
listeners: d
}), b.target = Qe)));
}
Pc("cancel cancel click click close close contextmenu contextMenu copy copy cut cut auxclick auxClick dblclick doubleClick dragend dragEnd dragstart dragStart drop drop focusin focus focusout blur input input invalid invalid keydown keyDown keypress keyPress keyup keyUp mousedown mouseDown mouseup mouseUp paste paste pause pause play play pointercancel pointerCancel pointerdown pointerDown pointerup pointerUp ratechange rateChange reset reset seeked seeked submit submit touchcancel touchCancel touchend touchEnd touchstart touchStart volumechange volumeChange".split(" "), 0);
Pc("drag drag dragenter dragEnter dragexit dragExit dragleave dragLeave dragover dragOver mousemove mouseMove mouseout mouseOut mouseover mouseOver pointermove pointerMove pointerout pointerOut pointerover pointerOver scroll scroll toggle toggle touchmove touchMove wheel wheel".split(" "), 1);
Pc(Oc, 2);
for (var Ve = "change selectionchange textInput compositionstart compositionend compositionupdate".split(" "), We = 0; We < Ve.length; We++) {
Nc.set(Ve[We], 0);
}
ea("onMouseEnter", ["mouseout", "mouseover"]);
ea("onMouseLeave", ["mouseout", "mouseover"]);
ea("onPointerEnter", ["pointerout", "pointerover"]);
ea("onPointerLeave", ["pointerout", "pointerover"]);
da("onChange", "change click focusin focusout input keydown keyup selectionchange".split(" "));
da("onSelect", "focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));
da("onBeforeInput", ["compositionend", "keypress", "textInput", "paste"]);
da("onCompositionEnd", "compositionend focusout keydown keypress keyup mousedown".split(" "));
da("onCompositionStart", "compositionstart focusout keydown keypress keyup mousedown".split(" "));
da("onCompositionUpdate", "compositionupdate focusout keydown keypress keyup mousedown".split(" "));
var Xe = "abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),
Ye = new Set("cancel close invalid load scroll toggle".split(" ").concat(Xe));
function Ze(a, b, c) {
var d = a.type || "unknown-event";
a.currentTarget = c;
Yb(d, b, void 0, a);
a.currentTarget = null;
}
function se(a, b) {
b = 0 !== (b & 4);
for (var c = 0; c < a.length; c++) {
var d = a[c],
e = d.event;
d = d.listeners;
a: {
var f = void 0;
if (b) for (var g = d.length - 1; 0 <= g; g--) {
var h = d[g],
k = h.instance,
l = h.currentTarget;
h = h.listener;
if (k !== f && e.isPropagationStopped()) break a;
Ze(e, h, l);
f = k;
} else for (g = 0; g < d.length; g++) {
h = d[g];
k = h.instance;
l = h.currentTarget;
h = h.listener;
if (k !== f && e.isPropagationStopped()) break a;
Ze(e, h, l);
f = k;
}
}
}
if (Ub) throw a = Vb, Ub = !1, Vb = null, a;
}
function G(a, b) {
var c = $e(b),
d = a + "__bubble";
c.has(d) || (af(b, a, 2, !1), c.add(d));
}
var bf = "_reactListening" + Math.random().toString(36).slice(2);
function cf(a) {
a[bf] || (a[bf] = !0, ba.forEach(function (b) {
Ye.has(b) || df(b, !1, a, null);
df(b, !0, a, null);
}));
}
function df(a, b, c, d) {
var e = 4 < arguments.length && void 0 !== arguments[4] ? arguments[4] : 0,
f = c;
"selectionchange" === a && 9 !== c.nodeType && (f = c.ownerDocument);
if (null !== d && !b && Ye.has(a)) {
if ("scroll" !== a) return;
e |= 2;
f = d;
}
var g = $e(f),
h = a + "__" + (b ? "capture" : "bubble");
g.has(h) || (b && (e |= 4), af(f, a, e, b), g.add(h));
}
function af(a, b, c, d) {
var e = Nc.get(b);
switch (void 0 === e ? 2 : e) {
case 0:
e = gd;
break;
case 1:
e = id;
break;
default:
e = hd;
}
c = e.bind(null, b, c, a);
e = void 0;
!Pb || "touchstart" !== b && "touchmove" !== b && "wheel" !== b || (e = !0);
d ? void 0 !== e ? a.addEventListener(b, c, {
capture: !0,
passive: e
}) : a.addEventListener(b, c, !0) : void 0 !== e ? a.addEventListener(b, c, {
passive: e
}) : a.addEventListener(b, c, !1);
}
function jd(a, b, c, d, e) {
var f = d;
if (0 === (b & 1) && 0 === (b & 2) && null !== d) a: for (;;) {
if (null === d) return;
var g = d.tag;
if (3 === g || 4 === g) {
var h = d.stateNode.containerInfo;
if (h === e || 8 === h.nodeType && h.parentNode === e) break;
if (4 === g) for (g = d.return; null !== g;) {
var k = g.tag;
if (3 === k || 4 === k) if (k = g.stateNode.containerInfo, k === e || 8 === k.nodeType && k.parentNode === e) return;
g = g.return;
}
for (; null !== h;) {
g = wc(h);
if (null === g) return;
k = g.tag;
if (5 === k || 6 === k) {
d = f = g;
continue a;
}
h = h.parentNode;
}
}
d = d.return;
}
Nb(function () {
var d = f,
e = xb(c),
g = [];
a: {
var h = Mc.get(a);
if (void 0 !== h) {
var k = td,
x = a;
switch (a) {
case "keypress":
if (0 === od(c)) break a;
case "keydown":
case "keyup":
k = Rd;
break;
case "focusin":
x = "focus";
k = Fd;
break;
case "focusout":
x = "blur";
k = Fd;
break;
case "beforeblur":
case "afterblur":
k = Fd;
break;
case "click":
if (2 === c.button) break a;
case "auxclick":
case "dblclick":
case "mousedown":
case "mousemove":
case "mouseup":
case "mouseout":
case "mouseover":
case "contextmenu":
k = Bd;
break;
case "drag":
case "dragend":
case "dragenter":
case "dragexit":
case "dragleave":
case "dragover":
case "dragstart":
case "drop":
k = Dd;
break;
case "touchcancel":
case "touchend":
case "touchmove":
case "touchstart":
k = Vd;
break;
case Ic:
case Jc:
case Kc:
k = Hd;
break;
case Lc:
k = Xd;
break;
case "scroll":
k = vd;
break;
case "wheel":
k = Zd;
break;
case "copy":
case "cut":
case "paste":
k = Jd;
break;
case "gotpointercapture":
case "lostpointercapture":
case "pointercancel":
case "pointerdown":
case "pointermove":
case "pointerout":
case "pointerover":
case "pointerup":
k = Td;
}
var w = 0 !== (b & 4),
z = !w && "scroll" === a,
u = w ? null !== h ? h + "Capture" : null : h;
w = [];
for (var t = d, q; null !== t;) {
q = t;
var v = q.stateNode;
5 === q.tag && null !== v && (q = v, null !== u && (v = Ob(t, u), null != v && w.push(ef(t, v, q))));
if (z) break;
t = t.return;
}
0 < w.length && (h = new k(h, x, null, c, e), g.push({
event: h,
listeners: w
}));
}
}
if (0 === (b & 7)) {
a: {
h = "mouseover" === a || "pointerover" === a;
k = "mouseout" === a || "pointerout" === a;
if (h && 0 === (b & 16) && (x = c.relatedTarget || c.fromElement) && (wc(x) || x[ff])) break a;
if (k || h) {
h = e.window === e ? e : (h = e.ownerDocument) ? h.defaultView || h.parentWindow : window;
if (k) {
if (x = c.relatedTarget || c.toElement, k = d, x = x ? wc(x) : null, null !== x && (z = Zb(x), x !== z || 5 !== x.tag && 6 !== x.tag)) x = null;
} else k = null, x = d;
if (k !== x) {
w = Bd;
v = "onMouseLeave";
u = "onMouseEnter";
t = "mouse";
if ("pointerout" === a || "pointerover" === a) w = Td, v = "onPointerLeave", u = "onPointerEnter", t = "pointer";
z = null == k ? h : ue(k);
q = null == x ? h : ue(x);
h = new w(v, t + "leave", k, c, e);
h.target = z;
h.relatedTarget = q;
v = null;
wc(e) === d && (w = new w(u, t + "enter", x, c, e), w.target = q, w.relatedTarget = z, v = w);
z = v;
if (k && x) b: {
w = k;
u = x;
t = 0;
for (q = w; q; q = gf(q)) {
t++;
}
q = 0;
for (v = u; v; v = gf(v)) {
q++;
}
for (; 0 < t - q;) {
w = gf(w), t--;
}
for (; 0 < q - t;) {
u = gf(u), q--;
}
for (; t--;) {
if (w === u || null !== u && w === u.alternate) break b;
w = gf(w);
u = gf(u);
}
w = null;
} else w = null;
null !== k && hf(g, h, k, w, !1);
null !== x && null !== z && hf(g, z, x, w, !0);
}
}
}
a: {
h = d ? ue(d) : window;
k = h.nodeName && h.nodeName.toLowerCase();
if ("select" === k || "input" === k && "file" === h.type) var J = ve;else if (me(h)) {
if (we) J = Fe;else {
J = De;
var K = Ce;
}
} else (k = h.nodeName) && "input" === k.toLowerCase() && ("checkbox" === h.type || "radio" === h.type) && (J = Ee);
if (J && (J = J(a, d))) {
ne(g, J, c, e);
break a;
}
K && K(a, h, d);
"focusout" === a && (K = h._wrapperState) && K.controlled && "number" === h.type && bb(h, "number", h.value);
}
K = d ? ue(d) : window;
switch (a) {
case "focusin":
if (me(K) || "true" === K.contentEditable) Qe = K, Re = d, Se = null;
break;
case "focusout":
Se = Re = Qe = null;
break;
case "mousedown":
Te = !0;
break;
case "contextmenu":
case "mouseup":
case "dragend":
Te = !1;
Ue(g, c, e);
break;
case "selectionchange":
if (Pe) break;
case "keydown":
case "keyup":
Ue(g, c, e);
}
var Q;
if (ae) b: {
switch (a) {
case "compositionstart":
var L = "onCompositionStart";
break b;
case "compositionend":
L = "onCompositionEnd";
break b;
case "compositionupdate":
L = "onCompositionUpdate";
break b;
}
L = void 0;
} else ie ? ge(a, c) && (L = "onCompositionEnd") : "keydown" === a && 229 === c.keyCode && (L = "onCompositionStart");
L && (de && "ko" !== c.locale && (ie || "onCompositionStart" !== L ? "onCompositionEnd" === L && ie && (Q = nd()) : (kd = e, ld = "value" in kd ? kd.value : kd.textContent, ie = !0)), K = oe(d, L), 0 < K.length && (L = new Ld(L, a, null, c, e), g.push({
event: L,
listeners: K
}), Q ? L.data = Q : (Q = he(c), null !== Q && (L.data = Q))));
if (Q = ce ? je(a, c) : ke(a, c)) d = oe(d, "onBeforeInput"), 0 < d.length && (e = new Ld("onBeforeInput", "beforeinput", null, c, e), g.push({
event: e,
listeners: d
}), e.data = Q);
}
se(g, b);
});
}
function ef(a, b, c) {
return {
instance: a,
listener: b,
currentTarget: c
};
}
function oe(a, b) {
for (var c = b + "Capture", d = []; null !== a;) {
var e = a,
f = e.stateNode;
5 === e.tag && null !== f && (e = f, f = Ob(a, c), null != f && d.unshift(ef(a, f, e)), f = Ob(a, b), null != f && d.push(ef(a, f, e)));
a = a.return;
}
return d;
}
function gf(a) {
if (null === a) return null;
do {
a = a.return;
} while (a && 5 !== a.tag);
return a ? a : null;
}
function hf(a, b, c, d, e) {
for (var f = b._reactName, g = []; null !== c && c !== d;) {
var h = c,
k = h.alternate,
l = h.stateNode;
if (null !== k && k === d) break;
5 === h.tag && null !== l && (h = l, e ? (k = Ob(c, f), null != k && g.unshift(ef(c, k, h))) : e || (k = Ob(c, f), null != k && g.push(ef(c, k, h))));
c = c.return;
}
0 !== g.length && a.push({
event: b,
listeners: g
});
}
function jf() {}
var kf = null,
lf = null;
function mf(a, b) {
switch (a) {
case "button":
case "input":
case "select":
case "textarea":
return !!b.autoFocus;
}
return !1;
}
function nf(a, b) {
return "textarea" === a || "option" === a || "noscript" === a || "string" === typeof b.children || "number" === typeof b.children || "object" === _typeof(b.dangerouslySetInnerHTML) && null !== b.dangerouslySetInnerHTML && null != b.dangerouslySetInnerHTML.__html;
}
var of = "function" === typeof setTimeout ? setTimeout : void 0,
pf = "function" === typeof clearTimeout ? clearTimeout : void 0;
function qf(a) {
1 === a.nodeType ? a.textContent = "" : 9 === a.nodeType && (a = a.body, null != a && (a.textContent = ""));
}
function rf(a) {
for (; null != a; a = a.nextSibling) {
var b = a.nodeType;
if (1 === b || 3 === b) break;
}
return a;
}
function sf(a) {
a = a.previousSibling;
for (var b = 0; a;) {
if (8 === a.nodeType) {
var c = a.data;
if ("$" === c || "$!" === c || "$?" === c) {
if (0 === b) return a;
b--;
} else "/$" === c && b++;
}
a = a.previousSibling;
}
return null;
}
var tf = 0;
function uf(a) {
return {
$$typeof: Ga,
toString: a,
valueOf: a
};
}
var vf = Math.random().toString(36).slice(2),
wf = "__reactFiber$" + vf,
xf = "__reactProps$" + vf,
ff = "__reactContainer$" + vf,
yf = "__reactEvents$" + vf;
function wc(a) {
var b = a[wf];
if (b) return b;
for (var c = a.parentNode; c;) {
if (b = c[ff] || c[wf]) {
c = b.alternate;
if (null !== b.child || null !== c && null !== c.child) for (a = sf(a); null !== a;) {
if (c = a[wf]) return c;
a = sf(a);
}
return b;
}
a = c;
c = a.parentNode;
}
return null;
}
function Cb(a) {
a = a[wf] || a[ff];
return !a || 5 !== a.tag && 6 !== a.tag && 13 !== a.tag && 3 !== a.tag ? null : a;
}
function ue(a) {
if (5 === a.tag || 6 === a.tag) return a.stateNode;
throw Error(y(33));
}
function Db(a) {
return a[xf] || null;
}
function $e(a) {
var b = a[yf];
void 0 === b && (b = a[yf] = new Set());
return b;
}
var zf = [],
Af = -1;
function Bf(a) {
return {
current: a
};
}
function H(a) {
0 > Af || (a.current = zf[Af], zf[Af] = null, Af--);
}
function I(a, b) {
Af++;
zf[Af] = a.current;
a.current = b;
}
var Cf = {},
M = Bf(Cf),
N = Bf(!1),
Df = Cf;
function Ef(a, b) {
var c = a.type.contextTypes;
if (!c) return Cf;
var d = a.stateNode;
if (d && d.__reactInternalMemoizedUnmaskedChildContext === b) return d.__reactInternalMemoizedMaskedChildContext;
var e = {},
f;
for (f in c) {
e[f] = b[f];
}
d && (a = a.stateNode, a.__reactInternalMemoizedUnmaskedChildContext = b, a.__reactInternalMemoizedMaskedChildContext = e);
return e;
}
function Ff(a) {
a = a.childContextTypes;
return null !== a && void 0 !== a;
}
function Gf() {
H(N);
H(M);
}
function Hf(a, b, c) {
if (M.current !== Cf) throw Error(y(168));
I(M, b);
I(N, c);
}
function If(a, b, c) {
var d = a.stateNode;
a = b.childContextTypes;
if ("function" !== typeof d.getChildContext) return c;
d = d.getChildContext();
for (var e in d) {
if (!(e in a)) throw Error(y(108, Ra(b) || "Unknown", e));
}
return m({}, c, d);
}
function Jf(a) {
a = (a = a.stateNode) && a.__reactInternalMemoizedMergedChildContext || Cf;
Df = M.current;
I(M, a);
I(N, N.current);
return !0;
}
function Kf(a, b, c) {
var d = a.stateNode;
if (!d) throw Error(y(169));
c ? (a = If(a, b, Df), d.__reactInternalMemoizedMergedChildContext = a, H(N), H(M), I(M, a)) : H(N);
I(N, c);
}
var Lf = null,
Mf = null,
Nf = r.unstable_runWithPriority,
Of = r.unstable_scheduleCallback,
Pf = r.unstable_cancelCallback,
Qf = r.unstable_shouldYield,
Rf = r.unstable_requestPaint,
Sf = r.unstable_now,
Tf = r.unstable_getCurrentPriorityLevel,
Uf = r.unstable_ImmediatePriority,
Vf = r.unstable_UserBlockingPriority,
Wf = r.unstable_NormalPriority,
Xf = r.unstable_LowPriority,
Yf = r.unstable_IdlePriority,
Zf = {},
$f = void 0 !== Rf ? Rf : function () {},
ag = null,
bg = null,
cg = !1,
dg = Sf(),
O = 1E4 > dg ? Sf : function () {
return Sf() - dg;
};
function eg() {
switch (Tf()) {
case Uf:
return 99;
case Vf:
return 98;
case Wf:
return 97;
case Xf:
return 96;
case Yf:
return 95;
default:
throw Error(y(332));
}
}
function fg(a) {
switch (a) {
case 99:
return Uf;
case 98:
return Vf;
case 97:
return Wf;
case 96:
return Xf;
case 95:
return Yf;
default:
throw Error(y(332));
}
}
function gg(a, b) {
a = fg(a);
return Nf(a, b);
}
function hg(a, b, c) {
a = fg(a);
return Of(a, b, c);
}
function ig() {
if (null !== bg) {
var a = bg;
bg = null;
Pf(a);
}
jg();
}
function jg() {
if (!cg && null !== ag) {
cg = !0;
var a = 0;
try {
var b = ag;
gg(99, function () {
for (; a < b.length; a++) {
var c = b[a];
do {
c = c(!0);
} while (null !== c);
}
});
ag = null;
} catch (c) {
throw null !== ag && (ag = ag.slice(a + 1)), Of(Uf, ig), c;
} finally {
cg = !1;
}
}
}
var kg = ra.ReactCurrentBatchConfig;
function lg(a, b) {
if (a && a.defaultProps) {
b = m({}, b);
a = a.defaultProps;
for (var c in a) {
void 0 === b[c] && (b[c] = a[c]);
}
return b;
}
return b;
}
var mg = Bf(null),
ng = null,
og = null,
pg = null;
function qg() {
pg = og = ng = null;
}
function rg(a) {
var b = mg.current;
H(mg);
a.type._context._currentValue = b;
}
function sg(a, b) {
for (; null !== a;) {
var c = a.alternate;
if ((a.childLanes & b) === b) {
if (null === c || (c.childLanes & b) === b) break;else c.childLanes |= b;
} else a.childLanes |= b, null !== c && (c.childLanes |= b);
a = a.return;
}
}
function tg(a, b) {
ng = a;
pg = og = null;
a = a.dependencies;
null !== a && null !== a.firstContext && (0 !== (a.lanes & b) && (ug = !0), a.firstContext = null);
}
function vg(a, b) {
if (pg !== a && !1 !== b && 0 !== b) {
if ("number" !== typeof b || 1073741823 === b) pg = a, b = 1073741823;
b = {
context: a,
observedBits: b,
next: null
};
if (null === og) {
if (null === ng) throw Error(y(308));
og = b;
ng.dependencies = {
lanes: 0,
firstContext: b,
responders: null
};
} else og = og.next = b;
}
return a._currentValue;
}
var wg = !1;
function xg(a) {
a.updateQueue = {
baseState: a.memoizedState,
firstBaseUpdate: null,
lastBaseUpdate: null,
shared: {
pending: null
},
effects: null
};
}
function yg(a, b) {
a = a.updateQueue;
b.updateQueue === a && (b.updateQueue = {
baseState: a.baseState,
firstBaseUpdate: a.firstBaseUpdate,
lastBaseUpdate: a.lastBaseUpdate,
shared: a.shared,
effects: a.effects
});
}
function zg(a, b) {
return {
eventTime: a,
lane: b,
tag: 0,
payload: null,
callback: null,
next: null
};
}
function Ag(a, b) {
a = a.updateQueue;
if (null !== a) {
a = a.shared;
var c = a.pending;
null === c ? b.next = b : (b.next = c.next, c.next = b);
a.pending = b;
}
}
function Bg(a, b) {
var c = a.updateQueue,
d = a.alternate;
if (null !== d && (d = d.updateQueue, c === d)) {
var e = null,
f = null;
c = c.firstBaseUpdate;
if (null !== c) {
do {
var g = {
eventTime: c.eventTime,
lane: c.lane,
tag: c.tag,
payload: c.payload,
callback: c.callback,
next: null
};
null === f ? e = f = g : f = f.next = g;
c = c.next;
} while (null !== c);
null === f ? e = f = b : f = f.next = b;
} else e = f = b;
c = {
baseState: d.baseState,
firstBaseUpdate: e,
lastBaseUpdate: f,
shared: d.shared,
effects: d.effects
};
a.updateQueue = c;
return;
}
a = c.lastBaseUpdate;
null === a ? c.firstBaseUpdate = b : a.next = b;
c.lastBaseUpdate = b;
}
function Cg(a, b, c, d) {
var e = a.updateQueue;
wg = !1;
var f = e.firstBaseUpdate,
g = e.lastBaseUpdate,
h = e.shared.pending;
if (null !== h) {
e.shared.pending = null;
var k = h,
l = k.next;
k.next = null;
null === g ? f = l : g.next = l;
g = k;
var n = a.alternate;
if (null !== n) {
n = n.updateQueue;
var A = n.lastBaseUpdate;
A !== g && (null === A ? n.firstBaseUpdate = l : A.next = l, n.lastBaseUpdate = k);
}
}
if (null !== f) {
A = e.baseState;
g = 0;
n = l = k = null;
do {
h = f.lane;
var p = f.eventTime;
if ((d & h) === h) {
null !== n && (n = n.next = {
eventTime: p,
lane: 0,
tag: f.tag,
payload: f.payload,
callback: f.callback,
next: null
});
a: {
var C = a,
x = f;
h = b;
p = c;
switch (x.tag) {
case 1:
C = x.payload;
if ("function" === typeof C) {
A = C.call(p, A, h);
break a;
}
A = C;
break a;
case 3:
C.flags = C.flags & -4097 | 64;
case 0:
C = x.payload;
h = "function" === typeof C ? C.call(p, A, h) : C;
if (null === h || void 0 === h) break a;
A = m({}, A, h);
break a;
case 2:
wg = !0;
}
}
null !== f.callback && (a.flags |= 32, h = e.effects, null === h ? e.effects = [f] : h.push(f));
} else p = {
eventTime: p,
lane: h,
tag: f.tag,
payload: f.payload,
callback: f.callback,
next: null
}, null === n ? (l = n = p, k = A) : n = n.next = p, g |= h;
f = f.next;
if (null === f) if (h = e.shared.pending, null === h) break;else f = h.next, h.next = null, e.lastBaseUpdate = h, e.shared.pending = null;
} while (1);
null === n && (k = A);
e.baseState = k;
e.firstBaseUpdate = l;
e.lastBaseUpdate = n;
Dg |= g;
a.lanes = g;
a.memoizedState = A;
}
}
function Eg(a, b, c) {
a = b.effects;
b.effects = null;
if (null !== a) for (b = 0; b < a.length; b++) {
var d = a[b],
e = d.callback;
if (null !== e) {
d.callback = null;
d = c;
if ("function" !== typeof e) throw Error(y(191, e));
e.call(d);
}
}
}
var Fg = new aa.Component().refs;
function Gg(a, b, c, d) {
b = a.memoizedState;
c = c(d, b);
c = null === c || void 0 === c ? b : m({}, b, c);
a.memoizedState = c;
0 === a.lanes && (a.updateQueue.baseState = c);
}
var Kg = {
isMounted: function isMounted(a) {
return (a = a._reactInternals) ? Zb(a) === a : !1;
},
enqueueSetState: function enqueueSetState(a, b, c) {
a = a._reactInternals;
var d = Hg(),
e = Ig(a),
f = zg(d, e);
f.payload = b;
void 0 !== c && null !== c && (f.callback = c);
Ag(a, f);
Jg(a, e, d);
},
enqueueReplaceState: function enqueueReplaceState(a, b, c) {
a = a._reactInternals;
var d = Hg(),
e = Ig(a),
f = zg(d, e);
f.tag = 1;
f.payload = b;
void 0 !== c && null !== c && (f.callback = c);
Ag(a, f);
Jg(a, e, d);
},
enqueueForceUpdate: function enqueueForceUpdate(a, b) {
a = a._reactInternals;
var c = Hg(),
d = Ig(a),
e = zg(c, d);
e.tag = 2;
void 0 !== b && null !== b && (e.callback = b);
Ag(a, e);
Jg(a, d, c);
}
};
function Lg(a, b, c, d, e, f, g) {
a = a.stateNode;
return "function" === typeof a.shouldComponentUpdate ? a.shouldComponentUpdate(d, f, g) : b.prototype && b.prototype.isPureReactComponent ? !Je(c, d) || !Je(e, f) : !0;
}
function Mg(a, b, c) {
var d = !1,
e = Cf;
var f = b.contextType;
"object" === _typeof(f) && null !== f ? f = vg(f) : (e = Ff(b) ? Df : M.current, d = b.contextTypes, f = (d = null !== d && void 0 !== d) ? Ef(a, e) : Cf);
b = new b(c, f);
a.memoizedState = null !== b.state && void 0 !== b.state ? b.state : null;
b.updater = Kg;
a.stateNode = b;
b._reactInternals = a;
d && (a = a.stateNode, a.__reactInternalMemoizedUnmaskedChildContext = e, a.__reactInternalMemoizedMaskedChildContext = f);
return b;
}
function Ng(a, b, c, d) {
a = b.state;
"function" === typeof b.componentWillReceiveProps && b.componentWillReceiveProps(c, d);
"function" === typeof b.UNSAFE_componentWillReceiveProps && b.UNSAFE_componentWillReceiveProps(c, d);
b.state !== a && Kg.enqueueReplaceState(b, b.state, null);
}
function Og(a, b, c, d) {
var e = a.stateNode;
e.props = c;
e.state = a.memoizedState;
e.refs = Fg;
xg(a);
var f = b.contextType;
"object" === _typeof(f) && null !== f ? e.context = vg(f) : (f = Ff(b) ? Df : M.current, e.context = Ef(a, f));
Cg(a, c, e, d);
e.state = a.memoizedState;
f = b.getDerivedStateFromProps;
"function" === typeof f && (Gg(a, b, f, c), e.state = a.memoizedState);
"function" === typeof b.getDerivedStateFromProps || "function" === typeof e.getSnapshotBeforeUpdate || "function" !== typeof e.UNSAFE_componentWillMount && "function" !== typeof e.componentWillMount || (b = e.state, "function" === typeof e.componentWillMount && e.componentWillMount(), "function" === typeof e.UNSAFE_componentWillMount && e.UNSAFE_componentWillMount(), b !== e.state && Kg.enqueueReplaceState(e, e.state, null), Cg(a, c, e, d), e.state = a.memoizedState);
"function" === typeof e.componentDidMount && (a.flags |= 4);
}
var Pg = Array.isArray;
function Qg(a, b, c) {
a = c.ref;
if (null !== a && "function" !== typeof a && "object" !== _typeof(a)) {
if (c._owner) {
c = c._owner;
if (c) {
if (1 !== c.tag) throw Error(y(309));
var d = c.stateNode;
}
if (!d) throw Error(y(147, a));
var e = "" + a;
if (null !== b && null !== b.ref && "function" === typeof b.ref && b.ref._stringRef === e) return b.ref;
b = function b(a) {
var b = d.refs;
b === Fg && (b = d.refs = {});
null === a ? delete b[e] : b[e] = a;
};
b._stringRef = e;
return b;
}
if ("string" !== typeof a) throw Error(y(284));
if (!c._owner) throw Error(y(290, a));
}
return a;
}
function Rg(a, b) {
if ("textarea" !== a.type) throw Error(y(31, "[object Object]" === Object.prototype.toString.call(b) ? "object with keys {" + Object.keys(b).join(", ") + "}" : b));
}
function Sg(a) {
function b(b, c) {
if (a) {
var d = b.lastEffect;
null !== d ? (d.nextEffect = c, b.lastEffect = c) : b.firstEffect = b.lastEffect = c;
c.nextEffect = null;
c.flags = 8;
}
}
function c(c, d) {
if (!a) return null;
for (; null !== d;) {
b(c, d), d = d.sibling;
}
return null;
}
function d(a, b) {
for (a = new Map(); null !== b;) {
null !== b.key ? a.set(b.key, b) : a.set(b.index, b), b = b.sibling;
}
return a;
}
function e(a, b) {
a = Tg(a, b);
a.index = 0;
a.sibling = null;
return a;
}
function f(b, c, d) {
b.index = d;
if (!a) return c;
d = b.alternate;
if (null !== d) return d = d.index, d < c ? (b.flags = 2, c) : d;
b.flags = 2;
return c;
}
function g(b) {
a && null === b.alternate && (b.flags = 2);
return b;
}
function h(a, b, c, d) {
if (null === b || 6 !== b.tag) return b = Ug(c, a.mode, d), b.return = a, b;
b = e(b, c);
b.return = a;
return b;
}
function k(a, b, c, d) {
if (null !== b && b.elementType === c.type) return d = e(b, c.props), d.ref = Qg(a, b, c), d.return = a, d;
d = Vg(c.type, c.key, c.props, null, a.mode, d);
d.ref = Qg(a, b, c);
d.return = a;
return d;
}
function l(a, b, c, d) {
if (null === b || 4 !== b.tag || b.stateNode.containerInfo !== c.containerInfo || b.stateNode.implementation !== c.implementation) return b = Wg(c, a.mode, d), b.return = a, b;
b = e(b, c.children || []);
b.return = a;
return b;
}
function n(a, b, c, d, f) {
if (null === b || 7 !== b.tag) return b = Xg(c, a.mode, d, f), b.return = a, b;
b = e(b, c);
b.return = a;
return b;
}
function A(a, b, c) {
if ("string" === typeof b || "number" === typeof b) return b = Ug("" + b, a.mode, c), b.return = a, b;
if ("object" === _typeof(b) && null !== b) {
switch (b.$$typeof) {
case sa:
return c = Vg(b.type, b.key, b.props, null, a.mode, c), c.ref = Qg(a, null, b), c.return = a, c;
case ta:
return b = Wg(b, a.mode, c), b.return = a, b;
}
if (Pg(b) || La(b)) return b = Xg(b, a.mode, c, null), b.return = a, b;
Rg(a, b);
}
return null;
}
function p(a, b, c, d) {
var e = null !== b ? b.key : null;
if ("string" === typeof c || "number" === typeof c) return null !== e ? null : h(a, b, "" + c, d);
if ("object" === _typeof(c) && null !== c) {
switch (c.$$typeof) {
case sa:
return c.key === e ? c.type === ua ? n(a, b, c.props.children, d, e) : k(a, b, c, d) : null;
case ta:
return c.key === e ? l(a, b, c, d) : null;
}
if (Pg(c) || La(c)) return null !== e ? null : n(a, b, c, d, null);
Rg(a, c);
}
return null;
}
function C(a, b, c, d, e) {
if ("string" === typeof d || "number" === typeof d) return a = a.get(c) || null, h(b, a, "" + d, e);
if ("object" === _typeof(d) && null !== d) {
switch (d.$$typeof) {
case sa:
return a = a.get(null === d.key ? c : d.key) || null, d.type === ua ? n(b, a, d.props.children, e, d.key) : k(b, a, d, e);
case ta:
return a = a.get(null === d.key ? c : d.key) || null, l(b, a, d, e);
}
if (Pg(d) || La(d)) return a = a.get(c) || null, n(b, a, d, e, null);
Rg(b, d);
}
return null;
}
function x(e, g, h, k) {
for (var l = null, t = null, u = g, z = g = 0, q = null; null !== u && z < h.length; z++) {
u.index > z ? (q = u, u = null) : q = u.sibling;
var n = p(e, u, h[z], k);
if (null === n) {
null === u && (u = q);
break;
}
a && u && null === n.alternate && b(e, u);
g = f(n, g, z);
null === t ? l = n : t.sibling = n;
t = n;
u = q;
}
if (z === h.length) return c(e, u), l;
if (null === u) {
for (; z < h.length; z++) {
u = A(e, h[z], k), null !== u && (g = f(u, g, z), null === t ? l = u : t.sibling = u, t = u);
}
return l;
}
for (u = d(e, u); z < h.length; z++) {
q = C(u, e, z, h[z], k), null !== q && (a && null !== q.alternate && u.delete(null === q.key ? z : q.key), g = f(q, g, z), null === t ? l = q : t.sibling = q, t = q);
}
a && u.forEach(function (a) {
return b(e, a);
});
return l;
}
function w(e, g, h, k) {
var l = La(h);
if ("function" !== typeof l) throw Error(y(150));
h = l.call(h);
if (null == h) throw Error(y(151));
for (var t = l = null, u = g, z = g = 0, q = null, n = h.next(); null !== u && !n.done; z++, n = h.next()) {
u.index > z ? (q = u, u = null) : q = u.sibling;
var w = p(e, u, n.value, k);
if (null === w) {
null === u && (u = q);
break;
}
a && u && null === w.alternate && b(e, u);
g = f(w, g, z);
null === t ? l = w : t.sibling = w;
t = w;
u = q;
}
if (n.done) return c(e, u), l;
if (null === u) {
for (; !n.done; z++, n = h.next()) {
n = A(e, n.value, k), null !== n && (g = f(n, g, z), null === t ? l = n : t.sibling = n, t = n);
}
return l;
}
for (u = d(e, u); !n.done; z++, n = h.next()) {
n = C(u, e, z, n.value, k), null !== n && (a && null !== n.alternate && u.delete(null === n.key ? z : n.key), g = f(n, g, z), null === t ? l = n : t.sibling = n, t = n);
}
a && u.forEach(function (a) {
return b(e, a);
});
return l;
}
return function (a, d, f, h) {
var k = "object" === _typeof(f) && null !== f && f.type === ua && null === f.key;
k && (f = f.props.children);
var l = "object" === _typeof(f) && null !== f;
if (l) switch (f.$$typeof) {
case sa:
a: {
l = f.key;
for (k = d; null !== k;) {
if (k.key === l) {
switch (k.tag) {
case 7:
if (f.type === ua) {
c(a, k.sibling);
d = e(k, f.props.children);
d.return = a;
a = d;
break a;
}
break;
default:
if (k.elementType === f.type) {
c(a, k.sibling);
d = e(k, f.props);
d.ref = Qg(a, k, f);
d.return = a;
a = d;
break a;
}
}
c(a, k);
break;
} else b(a, k);
k = k.sibling;
}
f.type === ua ? (d = Xg(f.props.children, a.mode, h, f.key), d.return = a, a = d) : (h = Vg(f.type, f.key, f.props, null, a.mode, h), h.ref = Qg(a, d, f), h.return = a, a = h);
}
return g(a);
case ta:
a: {
for (k = f.key; null !== d;) {
if (d.key === k) {
if (4 === d.tag && d.stateNode.containerInfo === f.containerInfo && d.stateNode.implementation === f.implementation) {
c(a, d.sibling);
d = e(d, f.children || []);
d.return = a;
a = d;
break a;
} else {
c(a, d);
break;
}
} else b(a, d);
d = d.sibling;
}
d = Wg(f, a.mode, h);
d.return = a;
a = d;
}
return g(a);
}
if ("string" === typeof f || "number" === typeof f) return f = "" + f, null !== d && 6 === d.tag ? (c(a, d.sibling), d = e(d, f), d.return = a, a = d) : (c(a, d), d = Ug(f, a.mode, h), d.return = a, a = d), g(a);
if (Pg(f)) return x(a, d, f, h);
if (La(f)) return w(a, d, f, h);
l && Rg(a, f);
if ("undefined" === typeof f && !k) switch (a.tag) {
case 1:
case 22:
case 0:
case 11:
case 15:
throw Error(y(152, Ra(a.type) || "Component"));
}
return c(a, d);
};
}
var Yg = Sg(!0),
Zg = Sg(!1),
$g = {},
ah = Bf($g),
bh = Bf($g),
ch = Bf($g);
function dh(a) {
if (a === $g) throw Error(y(174));
return a;
}
function eh(a, b) {
I(ch, b);
I(bh, a);
I(ah, $g);
a = b.nodeType;
switch (a) {
case 9:
case 11:
b = (b = b.documentElement) ? b.namespaceURI : mb(null, "");
break;
default:
a = 8 === a ? b.parentNode : b, b = a.namespaceURI || null, a = a.tagName, b = mb(b, a);
}
H(ah);
I(ah, b);
}
function fh() {
H(ah);
H(bh);
H(ch);
}
function gh(a) {
dh(ch.current);
var b = dh(ah.current);
var c = mb(b, a.type);
b !== c && (I(bh, a), I(ah, c));
}
function hh(a) {
bh.current === a && (H(ah), H(bh));
}
var P = Bf(0);
function ih(a) {
for (var b = a; null !== b;) {
if (13 === b.tag) {
var c = b.memoizedState;
if (null !== c && (c = c.dehydrated, null === c || "$?" === c.data || "$!" === c.data)) return b;
} else if (19 === b.tag && void 0 !== b.memoizedProps.revealOrder) {
if (0 !== (b.flags & 64)) return b;
} else if (null !== b.child) {
b.child.return = b;
b = b.child;
continue;
}
if (b === a) break;
for (; null === b.sibling;) {
if (null === b.return || b.return === a) return null;
b = b.return;
}
b.sibling.return = b.return;
b = b.sibling;
}
return null;
}
var jh = null,
kh = null,
lh = !1;
function mh(a, b) {
var c = nh(5, null, null, 0);
c.elementType = "DELETED";
c.type = "DELETED";
c.stateNode = b;
c.return = a;
c.flags = 8;
null !== a.lastEffect ? (a.lastEffect.nextEffect = c, a.lastEffect = c) : a.firstEffect = a.lastEffect = c;
}
function oh(a, b) {
switch (a.tag) {
case 5:
var c = a.type;
b = 1 !== b.nodeType || c.toLowerCase() !== b.nodeName.toLowerCase() ? null : b;
return null !== b ? (a.stateNode = b, !0) : !1;
case 6:
return b = "" === a.pendingProps || 3 !== b.nodeType ? null : b, null !== b ? (a.stateNode = b, !0) : !1;
case 13:
return !1;
default:
return !1;
}
}
function ph(a) {
if (lh) {
var b = kh;
if (b) {
var c = b;
if (!oh(a, b)) {
b = rf(c.nextSibling);
if (!b || !oh(a, b)) {
a.flags = a.flags & -1025 | 2;
lh = !1;
jh = a;
return;
}
mh(jh, c);
}
jh = a;
kh = rf(b.firstChild);
} else a.flags = a.flags & -1025 | 2, lh = !1, jh = a;
}
}
function qh(a) {
for (a = a.return; null !== a && 5 !== a.tag && 3 !== a.tag && 13 !== a.tag;) {
a = a.return;
}
jh = a;
}
function rh(a) {
if (a !== jh) return !1;
if (!lh) return qh(a), lh = !0, !1;
var b = a.type;
if (5 !== a.tag || "head" !== b && "body" !== b && !nf(b, a.memoizedProps)) for (b = kh; b;) {
mh(a, b), b = rf(b.nextSibling);
}
qh(a);
if (13 === a.tag) {
a = a.memoizedState;
a = null !== a ? a.dehydrated : null;
if (!a) throw Error(y(317));
a: {
a = a.nextSibling;
for (b = 0; a;) {
if (8 === a.nodeType) {
var c = a.data;
if ("/$" === c) {
if (0 === b) {
kh = rf(a.nextSibling);
break a;
}
b--;
} else "$" !== c && "$!" !== c && "$?" !== c || b++;
}
a = a.nextSibling;
}
kh = null;
}
} else kh = jh ? rf(a.stateNode.nextSibling) : null;
return !0;
}
function sh() {
kh = jh = null;
lh = !1;
}
var th = [];
function uh() {
for (var a = 0; a < th.length; a++) {
th[a]._workInProgressVersionPrimary = null;
}
th.length = 0;
}
var vh = ra.ReactCurrentDispatcher,
wh = ra.ReactCurrentBatchConfig,
xh = 0,
R = null,
S = null,
T = null,
yh = !1,
zh = !1;
function Ah() {
throw Error(y(321));
}
function Bh(a, b) {
if (null === b) return !1;
for (var c = 0; c < b.length && c < a.length; c++) {
if (!He(a[c], b[c])) return !1;
}
return !0;
}
function Ch(a, b, c, d, e, f) {
xh = f;
R = b;
b.memoizedState = null;
b.updateQueue = null;
b.lanes = 0;
vh.current = null === a || null === a.memoizedState ? Dh : Eh;
a = c(d, e);
if (zh) {
f = 0;
do {
zh = !1;
if (!(25 > f)) throw Error(y(301));
f += 1;
T = S = null;
b.updateQueue = null;
vh.current = Fh;
a = c(d, e);
} while (zh);
}
vh.current = Gh;
b = null !== S && null !== S.next;
xh = 0;
T = S = R = null;
yh = !1;
if (b) throw Error(y(300));
return a;
}
function Hh() {
var a = {
memoizedState: null,
baseState: null,
baseQueue: null,
queue: null,
next: null
};
null === T ? R.memoizedState = T = a : T = T.next = a;
return T;
}
function Ih() {
if (null === S) {
var a = R.alternate;
a = null !== a ? a.memoizedState : null;
} else a = S.next;
var b = null === T ? R.memoizedState : T.next;
if (null !== b) T = b, S = a;else {
if (null === a) throw Error(y(310));
S = a;
a = {
memoizedState: S.memoizedState,
baseState: S.baseState,
baseQueue: S.baseQueue,
queue: S.queue,
next: null
};
null === T ? R.memoizedState = T = a : T = T.next = a;
}
return T;
}
function Jh(a, b) {
return "function" === typeof b ? b(a) : b;
}
function Kh(a) {
var b = Ih(),
c = b.queue;
if (null === c) throw Error(y(311));
c.lastRenderedReducer = a;
var d = S,
e = d.baseQueue,
f = c.pending;
if (null !== f) {
if (null !== e) {
var g = e.next;
e.next = f.next;
f.next = g;
}
d.baseQueue = e = f;
c.pending = null;
}
if (null !== e) {
e = e.next;
d = d.baseState;
var h = g = f = null,
k = e;
do {
var l = k.lane;
if ((xh & l) === l) null !== h && (h = h.next = {
lane: 0,
action: k.action,
eagerReducer: k.eagerReducer,
eagerState: k.eagerState,
next: null
}), d = k.eagerReducer === a ? k.eagerState : a(d, k.action);else {
var n = {
lane: l,
action: k.action,
eagerReducer: k.eagerReducer,
eagerState: k.eagerState,
next: null
};
null === h ? (g = h = n, f = d) : h = h.next = n;
R.lanes |= l;
Dg |= l;
}
k = k.next;
} while (null !== k && k !== e);
null === h ? f = d : h.next = g;
He(d, b.memoizedState) || (ug = !0);
b.memoizedState = d;
b.baseState = f;
b.baseQueue = h;
c.lastRenderedState = d;
}
return [b.memoizedState, c.dispatch];
}
function Lh(a) {
var b = Ih(),
c = b.queue;
if (null === c) throw Error(y(311));
c.lastRenderedReducer = a;
var d = c.dispatch,
e = c.pending,
f = b.memoizedState;
if (null !== e) {
c.pending = null;
var g = e = e.next;
do {
f = a(f, g.action), g = g.next;
} while (g !== e);
He(f, b.memoizedState) || (ug = !0);
b.memoizedState = f;
null === b.baseQueue && (b.baseState = f);
c.lastRenderedState = f;
}
return [f, d];
}
function Mh(a, b, c) {
var d = b._getVersion;
d = d(b._source);
var e = b._workInProgressVersionPrimary;
if (null !== e) a = e === d;else if (a = a.mutableReadLanes, a = (xh & a) === a) b._workInProgressVersionPrimary = d, th.push(b);
if (a) return c(b._source);
th.push(b);
throw Error(y(350));
}
function Nh(a, b, c, d) {
var e = U;
if (null === e) throw Error(y(349));
var f = b._getVersion,
g = f(b._source),
h = vh.current,
k = h.useState(function () {
return Mh(e, b, c);
}),
l = k[1],
n = k[0];
k = T;
var A = a.memoizedState,
p = A.refs,
C = p.getSnapshot,
x = A.source;
A = A.subscribe;
var w = R;
a.memoizedState = {
refs: p,
source: b,
subscribe: d
};
h.useEffect(function () {
p.getSnapshot = c;
p.setSnapshot = l;
var a = f(b._source);
if (!He(g, a)) {
a = c(b._source);
He(n, a) || (l(a), a = Ig(w), e.mutableReadLanes |= a & e.pendingLanes);
a = e.mutableReadLanes;
e.entangledLanes |= a;
for (var d = e.entanglements, h = a; 0 < h;) {
var k = 31 - Vc(h),
v = 1 << k;
d[k] |= a;
h &= ~v;
}
}
}, [c, b, d]);
h.useEffect(function () {
return d(b._source, function () {
var a = p.getSnapshot,
c = p.setSnapshot;
try {
c(a(b._source));
var d = Ig(w);
e.mutableReadLanes |= d & e.pendingLanes;
} catch (q) {
c(function () {
throw q;
});
}
});
}, [b, d]);
He(C, c) && He(x, b) && He(A, d) || (a = {
pending: null,
dispatch: null,
lastRenderedReducer: Jh,
lastRenderedState: n
}, a.dispatch = l = Oh.bind(null, R, a), k.queue = a, k.baseQueue = null, n = Mh(e, b, c), k.memoizedState = k.baseState = n);
return n;
}
function Ph(a, b, c) {
var d = Ih();
return Nh(d, a, b, c);
}
function Qh(a) {
var b = Hh();
"function" === typeof a && (a = a());
b.memoizedState = b.baseState = a;
a = b.queue = {
pending: null,
dispatch: null,
lastRenderedReducer: Jh,
lastRenderedState: a
};
a = a.dispatch = Oh.bind(null, R, a);
return [b.memoizedState, a];
}
function Rh(a, b, c, d) {
a = {
tag: a,
create: b,
destroy: c,
deps: d,
next: null
};
b = R.updateQueue;
null === b ? (b = {
lastEffect: null
}, R.updateQueue = b, b.lastEffect = a.next = a) : (c = b.lastEffect, null === c ? b.lastEffect = a.next = a : (d = c.next, c.next = a, a.next = d, b.lastEffect = a));
return a;
}
function Sh(a) {
var b = Hh();
a = {
current: a
};
return b.memoizedState = a;
}
function Th() {
return Ih().memoizedState;
}
function Uh(a, b, c, d) {
var e = Hh();
R.flags |= a;
e.memoizedState = Rh(1 | b, c, void 0, void 0 === d ? null : d);
}
function Vh(a, b, c, d) {
var e = Ih();
d = void 0 === d ? null : d;
var f = void 0;
if (null !== S) {
var g = S.memoizedState;
f = g.destroy;
if (null !== d && Bh(d, g.deps)) {
Rh(b, c, f, d);
return;
}
}
R.flags |= a;
e.memoizedState = Rh(1 | b, c, f, d);
}
function Wh(a, b) {
return Uh(516, 4, a, b);
}
function Xh(a, b) {
return Vh(516, 4, a, b);
}
function Yh(a, b) {
return Vh(4, 2, a, b);
}
function Zh(a, b) {
if ("function" === typeof b) return a = a(), b(a), function () {
b(null);
};
if (null !== b && void 0 !== b) return a = a(), b.current = a, function () {
b.current = null;
};
}
function $h(a, b, c) {
c = null !== c && void 0 !== c ? c.concat([a]) : null;
return Vh(4, 2, Zh.bind(null, b, a), c);
}
function ai() {}
function bi(a, b) {
var c = Ih();
b = void 0 === b ? null : b;
var d = c.memoizedState;
if (null !== d && null !== b && Bh(b, d[1])) return d[0];
c.memoizedState = [a, b];
return a;
}
function ci(a, b) {
var c = Ih();
b = void 0 === b ? null : b;
var d = c.memoizedState;
if (null !== d && null !== b && Bh(b, d[1])) return d[0];
a = a();
c.memoizedState = [a, b];
return a;
}
function di(a, b) {
var c = eg();
gg(98 > c ? 98 : c, function () {
a(!0);
});
gg(97 < c ? 97 : c, function () {
var c = wh.transition;
wh.transition = 1;
try {
a(!1), b();
} finally {
wh.transition = c;
}
});
}
function Oh(a, b, c) {
var d = Hg(),
e = Ig(a),
f = {
lane: e,
action: c,
eagerReducer: null,
eagerState: null,
next: null
},
g = b.pending;
null === g ? f.next = f : (f.next = g.next, g.next = f);
b.pending = f;
g = a.alternate;
if (a === R || null !== g && g === R) zh = yh = !0;else {
if (0 === a.lanes && (null === g || 0 === g.lanes) && (g = b.lastRenderedReducer, null !== g)) try {
var h = b.lastRenderedState,
k = g(h, c);
f.eagerReducer = g;
f.eagerState = k;
if (He(k, h)) return;
} catch (l) {} finally {}
Jg(a, e, d);
}
}
var Gh = {
readContext: vg,
useCallback: Ah,
useContext: Ah,
useEffect: Ah,
useImperativeHandle: Ah,
useLayoutEffect: Ah,
useMemo: Ah,
useReducer: Ah,
useRef: Ah,
useState: Ah,
useDebugValue: Ah,
useDeferredValue: Ah,
useTransition: Ah,
useMutableSource: Ah,
useOpaqueIdentifier: Ah,
unstable_isNewReconciler: !1
},
Dh = {
readContext: vg,
useCallback: function useCallback(a, b) {
Hh().memoizedState = [a, void 0 === b ? null : b];
return a;
},
useContext: vg,
useEffect: Wh,
useImperativeHandle: function useImperativeHandle(a, b, c) {
c = null !== c && void 0 !== c ? c.concat([a]) : null;
return Uh(4, 2, Zh.bind(null, b, a), c);
},
useLayoutEffect: function useLayoutEffect(a, b) {
return Uh(4, 2, a, b);
},
useMemo: function useMemo(a, b) {
var c = Hh();
b = void 0 === b ? null : b;
a = a();
c.memoizedState = [a, b];
return a;
},
useReducer: function useReducer(a, b, c) {
var d = Hh();
b = void 0 !== c ? c(b) : b;
d.memoizedState = d.baseState = b;
a = d.queue = {
pending: null,
dispatch: null,
lastRenderedReducer: a,
lastRenderedState: b
};
a = a.dispatch = Oh.bind(null, R, a);
return [d.memoizedState, a];
},
useRef: Sh,
useState: Qh,
useDebugValue: ai,
useDeferredValue: function useDeferredValue(a) {
var b = Qh(a),
c = b[0],
d = b[1];
Wh(function () {
var b = wh.transition;
wh.transition = 1;
try {
d(a);
} finally {
wh.transition = b;
}
}, [a]);
return c;
},
useTransition: function useTransition() {
var a = Qh(!1),
b = a[0];
a = di.bind(null, a[1]);
Sh(a);
return [a, b];
},
useMutableSource: function useMutableSource(a, b, c) {
var d = Hh();
d.memoizedState = {
refs: {
getSnapshot: b,
setSnapshot: null
},
source: a,
subscribe: c
};
return Nh(d, a, b, c);
},
useOpaqueIdentifier: function useOpaqueIdentifier() {
if (lh) {
var a = !1,
b = uf(function () {
a || (a = !0, c("r:" + (tf++).toString(36)));
throw Error(y(355));
}),
c = Qh(b)[1];
0 === (R.mode & 2) && (R.flags |= 516, Rh(5, function () {
c("r:" + (tf++).toString(36));
}, void 0, null));
return b;
}
b = "r:" + (tf++).toString(36);
Qh(b);
return b;
},
unstable_isNewReconciler: !1
},
Eh = {
readContext: vg,
useCallback: bi,
useContext: vg,
useEffect: Xh,
useImperativeHandle: $h,
useLayoutEffect: Yh,
useMemo: ci,
useReducer: Kh,
useRef: Th,
useState: function useState() {
return Kh(Jh);
},
useDebugValue: ai,
useDeferredValue: function useDeferredValue(a) {
var b = Kh(Jh),
c = b[0],
d = b[1];
Xh(function () {
var b = wh.transition;
wh.transition = 1;
try {
d(a);
} finally {
wh.transition = b;
}
}, [a]);
return c;
},
useTransition: function useTransition() {
var a = Kh(Jh)[0];
return [Th().current, a];
},
useMutableSource: Ph,
useOpaqueIdentifier: function useOpaqueIdentifier() {
return Kh(Jh)[0];
},
unstable_isNewReconciler: !1
},
Fh = {
readContext: vg,
useCallback: bi,
useContext: vg,
useEffect: Xh,
useImperativeHandle: $h,
useLayoutEffect: Yh,
useMemo: ci,
useReducer: Lh,
useRef: Th,
useState: function useState() {
return Lh(Jh);
},
useDebugValue: ai,
useDeferredValue: function useDeferredValue(a) {
var b = Lh(Jh),
c = b[0],
d = b[1];
Xh(function () {
var b = wh.transition;
wh.transition = 1;
try {
d(a);
} finally {
wh.transition = b;
}
}, [a]);
return c;
},
useTransition: function useTransition() {
var a = Lh(Jh)[0];
return [Th().current, a];
},
useMutableSource: Ph,
useOpaqueIdentifier: function useOpaqueIdentifier() {
return Lh(Jh)[0];
},
unstable_isNewReconciler: !1
},
ei = ra.ReactCurrentOwner,
ug = !1;
function fi(a, b, c, d) {
b.child = null === a ? Zg(b, null, c, d) : Yg(b, a.child, c, d);
}
function gi(a, b, c, d, e) {
c = c.render;
var f = b.ref;
tg(b, e);
d = Ch(a, b, c, d, f, e);
if (null !== a && !ug) return b.updateQueue = a.updateQueue, b.flags &= -517, a.lanes &= ~e, hi(a, b, e);
b.flags |= 1;
fi(a, b, d, e);
return b.child;
}
function ii(a, b, c, d, e, f) {
if (null === a) {
var g = c.type;
if ("function" === typeof g && !ji(g) && void 0 === g.defaultProps && null === c.compare && void 0 === c.defaultProps) return b.tag = 15, b.type = g, ki(a, b, g, d, e, f);
a = Vg(c.type, null, d, b, b.mode, f);
a.ref = b.ref;
a.return = b;
return b.child = a;
}
g = a.child;
if (0 === (e & f) && (e = g.memoizedProps, c = c.compare, c = null !== c ? c : Je, c(e, d) && a.ref === b.ref)) return hi(a, b, f);
b.flags |= 1;
a = Tg(g, d);
a.ref = b.ref;
a.return = b;
return b.child = a;
}
function ki(a, b, c, d, e, f) {
if (null !== a && Je(a.memoizedProps, d) && a.ref === b.ref) if (ug = !1, 0 !== (f & e)) 0 !== (a.flags & 16384) && (ug = !0);else return b.lanes = a.lanes, hi(a, b, f);
return li(a, b, c, d, f);
}
function mi(a, b, c) {
var d = b.pendingProps,
e = d.children,
f = null !== a ? a.memoizedState : null;
if ("hidden" === d.mode || "unstable-defer-without-hiding" === d.mode) {
if (0 === (b.mode & 4)) b.memoizedState = {
baseLanes: 0
}, ni(b, c);else if (0 !== (c & 1073741824)) b.memoizedState = {
baseLanes: 0
}, ni(b, null !== f ? f.baseLanes : c);else return a = null !== f ? f.baseLanes | c : c, b.lanes = b.childLanes = 1073741824, b.memoizedState = {
baseLanes: a
}, ni(b, a), null;
} else null !== f ? (d = f.baseLanes | c, b.memoizedState = null) : d = c, ni(b, d);
fi(a, b, e, c);
return b.child;
}
function oi(a, b) {
var c = b.ref;
if (null === a && null !== c || null !== a && a.ref !== c) b.flags |= 128;
}
function li(a, b, c, d, e) {
var f = Ff(c) ? Df : M.current;
f = Ef(b, f);
tg(b, e);
c = Ch(a, b, c, d, f, e);
if (null !== a && !ug) return b.updateQueue = a.updateQueue, b.flags &= -517, a.lanes &= ~e, hi(a, b, e);
b.flags |= 1;
fi(a, b, c, e);
return b.child;
}
function pi(a, b, c, d, e) {
if (Ff(c)) {
var f = !0;
Jf(b);
} else f = !1;
tg(b, e);
if (null === b.stateNode) null !== a && (a.alternate = null, b.alternate = null, b.flags |= 2), Mg(b, c, d), Og(b, c, d, e), d = !0;else if (null === a) {
var g = b.stateNode,
h = b.memoizedProps;
g.props = h;
var k = g.context,
l = c.contextType;
"object" === _typeof(l) && null !== l ? l = vg(l) : (l = Ff(c) ? Df : M.current, l = Ef(b, l));
var n = c.getDerivedStateFromProps,
A = "function" === typeof n || "function" === typeof g.getSnapshotBeforeUpdate;
A || "function" !== typeof g.UNSAFE_componentWillReceiveProps && "function" !== typeof g.componentWillReceiveProps || (h !== d || k !== l) && Ng(b, g, d, l);
wg = !1;
var p = b.memoizedState;
g.state = p;
Cg(b, d, g, e);
k = b.memoizedState;
h !== d || p !== k || N.current || wg ? ("function" === typeof n && (Gg(b, c, n, d), k = b.memoizedState), (h = wg || Lg(b, c, h, d, p, k, l)) ? (A || "function" !== typeof g.UNSAFE_componentWillMount && "function" !== typeof g.componentWillMount || ("function" === typeof g.componentWillMount && g.componentWillMount(), "function" === typeof g.UNSAFE_componentWillMount && g.UNSAFE_componentWillMount()), "function" === typeof g.componentDidMount && (b.flags |= 4)) : ("function" === typeof g.componentDidMount && (b.flags |= 4), b.memoizedProps = d, b.memoizedState = k), g.props = d, g.state = k, g.context = l, d = h) : ("function" === typeof g.componentDidMount && (b.flags |= 4), d = !1);
} else {
g = b.stateNode;
yg(a, b);
h = b.memoizedProps;
l = b.type === b.elementType ? h : lg(b.type, h);
g.props = l;
A = b.pendingProps;
p = g.context;
k = c.contextType;
"object" === _typeof(k) && null !== k ? k = vg(k) : (k = Ff(c) ? Df : M.current, k = Ef(b, k));
var C = c.getDerivedStateFromProps;
(n = "function" === typeof C || "function" === typeof g.getSnapshotBeforeUpdate) || "function" !== typeof g.UNSAFE_componentWillReceiveProps && "function" !== typeof g.componentWillReceiveProps || (h !== A || p !== k) && Ng(b, g, d, k);
wg = !1;
p = b.memoizedState;
g.state = p;
Cg(b, d, g, e);
var x = b.memoizedState;
h !== A || p !== x || N.current || wg ? ("function" === typeof C && (Gg(b, c, C, d), x = b.memoizedState), (l = wg || Lg(b, c, l, d, p, x, k)) ? (n || "function" !== typeof g.UNSAFE_componentWillUpdate && "function" !== typeof g.componentWillUpdate || ("function" === typeof g.componentWillUpdate && g.componentWillUpdate(d, x, k), "function" === typeof g.UNSAFE_componentWillUpdate && g.UNSAFE_componentWillUpdate(d, x, k)), "function" === typeof g.componentDidUpdate && (b.flags |= 4), "function" === typeof g.getSnapshotBeforeUpdate && (b.flags |= 256)) : ("function" !== typeof g.componentDidUpdate || h === a.memoizedProps && p === a.memoizedState || (b.flags |= 4), "function" !== typeof g.getSnapshotBeforeUpdate || h === a.memoizedProps && p === a.memoizedState || (b.flags |= 256), b.memoizedProps = d, b.memoizedState = x), g.props = d, g.state = x, g.context = k, d = l) : ("function" !== typeof g.componentDidUpdate || h === a.memoizedProps && p === a.memoizedState || (b.flags |= 4), "function" !== typeof g.getSnapshotBeforeUpdate || h === a.memoizedProps && p === a.memoizedState || (b.flags |= 256), d = !1);
}
return qi(a, b, c, d, f, e);
}
function qi(a, b, c, d, e, f) {
oi(a, b);
var g = 0 !== (b.flags & 64);
if (!d && !g) return e && Kf(b, c, !1), hi(a, b, f);
d = b.stateNode;
ei.current = b;
var h = g && "function" !== typeof c.getDerivedStateFromError ? null : d.render();
b.flags |= 1;
null !== a && g ? (b.child = Yg(b, a.child, null, f), b.child = Yg(b, null, h, f)) : fi(a, b, h, f);
b.memoizedState = d.state;
e && Kf(b, c, !0);
return b.child;
}
function ri(a) {
var b = a.stateNode;
b.pendingContext ? Hf(a, b.pendingContext, b.pendingContext !== b.context) : b.context && Hf(a, b.context, !1);
eh(a, b.containerInfo);
}
var si = {
dehydrated: null,
retryLane: 0
};
function ti(a, b, c) {
var d = b.pendingProps,
e = P.current,
f = !1,
g;
(g = 0 !== (b.flags & 64)) || (g = null !== a && null === a.memoizedState ? !1 : 0 !== (e & 2));
g ? (f = !0, b.flags &= -65) : null !== a && null === a.memoizedState || void 0 === d.fallback || !0 === d.unstable_avoidThisFallback || (e |= 1);
I(P, e & 1);
if (null === a) {
void 0 !== d.fallback && ph(b);
a = d.children;
e = d.fallback;
if (f) return a = ui(b, a, e, c), b.child.memoizedState = {
baseLanes: c
}, b.memoizedState = si, a;
if ("number" === typeof d.unstable_expectedLoadTime) return a = ui(b, a, e, c), b.child.memoizedState = {
baseLanes: c
}, b.memoizedState = si, b.lanes = 33554432, a;
c = vi({
mode: "visible",
children: a
}, b.mode, c, null);
c.return = b;
return b.child = c;
}
if (null !== a.memoizedState) {
if (f) return d = wi(a, b, d.children, d.fallback, c), f = b.child, e = a.child.memoizedState, f.memoizedState = null === e ? {
baseLanes: c
} : {
baseLanes: e.baseLanes | c
}, f.childLanes = a.childLanes & ~c, b.memoizedState = si, d;
c = xi(a, b, d.children, c);
b.memoizedState = null;
return c;
}
if (f) return d = wi(a, b, d.children, d.fallback, c), f = b.child, e = a.child.memoizedState, f.memoizedState = null === e ? {
baseLanes: c
} : {
baseLanes: e.baseLanes | c
}, f.childLanes = a.childLanes & ~c, b.memoizedState = si, d;
c = xi(a, b, d.children, c);
b.memoizedState = null;
return c;
}
function ui(a, b, c, d) {
var e = a.mode,
f = a.child;
b = {
mode: "hidden",
children: b
};
0 === (e & 2) && null !== f ? (f.childLanes = 0, f.pendingProps = b) : f = vi(b, e, 0, null);
c = Xg(c, e, d, null);
f.return = a;
c.return = a;
f.sibling = c;
a.child = f;
return c;
}
function xi(a, b, c, d) {
var e = a.child;
a = e.sibling;
c = Tg(e, {
mode: "visible",
children: c
});
0 === (b.mode & 2) && (c.lanes = d);
c.return = b;
c.sibling = null;
null !== a && (a.nextEffect = null, a.flags = 8, b.firstEffect = b.lastEffect = a);
return b.child = c;
}
function wi(a, b, c, d, e) {
var f = b.mode,
g = a.child;
a = g.sibling;
var h = {
mode: "hidden",
children: c
};
0 === (f & 2) && b.child !== g ? (c = b.child, c.childLanes = 0, c.pendingProps = h, g = c.lastEffect, null !== g ? (b.firstEffect = c.firstEffect, b.lastEffect = g, g.nextEffect = null) : b.firstEffect = b.lastEffect = null) : c = Tg(g, h);
null !== a ? d = Tg(a, d) : (d = Xg(d, f, e, null), d.flags |= 2);
d.return = b;
c.return = b;
c.sibling = d;
b.child = c;
return d;
}
function yi(a, b) {
a.lanes |= b;
var c = a.alternate;
null !== c && (c.lanes |= b);
sg(a.return, b);
}
function zi(a, b, c, d, e, f) {
var g = a.memoizedState;
null === g ? a.memoizedState = {
isBackwards: b,
rendering: null,
renderingStartTime: 0,
last: d,
tail: c,
tailMode: e,
lastEffect: f
} : (g.isBackwards = b, g.rendering = null, g.renderingStartTime = 0, g.last = d, g.tail = c, g.tailMode = e, g.lastEffect = f);
}
function Ai(a, b, c) {
var d = b.pendingProps,
e = d.revealOrder,
f = d.tail;
fi(a, b, d.children, c);
d = P.current;
if (0 !== (d & 2)) d = d & 1 | 2, b.flags |= 64;else {
if (null !== a && 0 !== (a.flags & 64)) a: for (a = b.child; null !== a;) {
if (13 === a.tag) null !== a.memoizedState && yi(a, c);else if (19 === a.tag) yi(a, c);else if (null !== a.child) {
a.child.return = a;
a = a.child;
continue;
}
if (a === b) break a;
for (; null === a.sibling;) {
if (null === a.return || a.return === b) break a;
a = a.return;
}
a.sibling.return = a.return;
a = a.sibling;
}
d &= 1;
}
I(P, d);
if (0 === (b.mode & 2)) b.memoizedState = null;else switch (e) {
case "forwards":
c = b.child;
for (e = null; null !== c;) {
a = c.alternate, null !== a && null === ih(a) && (e = c), c = c.sibling;
}
c = e;
null === c ? (e = b.child, b.child = null) : (e = c.sibling, c.sibling = null);
zi(b, !1, e, c, f, b.lastEffect);
break;
case "backwards":
c = null;
e = b.child;
for (b.child = null; null !== e;) {
a = e.alternate;
if (null !== a && null === ih(a)) {
b.child = e;
break;
}
a = e.sibling;
e.sibling = c;
c = e;
e = a;
}
zi(b, !0, c, null, f, b.lastEffect);
break;
case "together":
zi(b, !1, null, null, void 0, b.lastEffect);
break;
default:
b.memoizedState = null;
}
return b.child;
}
function hi(a, b, c) {
null !== a && (b.dependencies = a.dependencies);
Dg |= b.lanes;
if (0 !== (c & b.childLanes)) {
if (null !== a && b.child !== a.child) throw Error(y(153));
if (null !== b.child) {
a = b.child;
c = Tg(a, a.pendingProps);
b.child = c;
for (c.return = b; null !== a.sibling;) {
a = a.sibling, c = c.sibling = Tg(a, a.pendingProps), c.return = b;
}
c.sibling = null;
}
return b.child;
}
return null;
}
var Bi, Ci, Di, Ei;
Bi = function Bi(a, b) {
for (var c = b.child; null !== c;) {
if (5 === c.tag || 6 === c.tag) a.appendChild(c.stateNode);else if (4 !== c.tag && null !== c.child) {
c.child.return = c;
c = c.child;
continue;
}
if (c === b) break;
for (; null === c.sibling;) {
if (null === c.return || c.return === b) return;
c = c.return;
}
c.sibling.return = c.return;
c = c.sibling;
}
};
Ci = function Ci() {};
Di = function Di(a, b, c, d) {
var e = a.memoizedProps;
if (e !== d) {
a = b.stateNode;
dh(ah.current);
var f = null;
switch (c) {
case "input":
e = Ya(a, e);
d = Ya(a, d);
f = [];
break;
case "option":
e = eb(a, e);
d = eb(a, d);
f = [];
break;
case "select":
e = m({}, e, {
value: void 0
});
d = m({}, d, {
value: void 0
});
f = [];
break;
case "textarea":
e = gb(a, e);
d = gb(a, d);
f = [];
break;
default:
"function" !== typeof e.onClick && "function" === typeof d.onClick && (a.onclick = jf);
}
vb(c, d);
var g;
c = null;
for (l in e) {
if (!d.hasOwnProperty(l) && e.hasOwnProperty(l) && null != e[l]) if ("style" === l) {
var h = e[l];
for (g in h) {
h.hasOwnProperty(g) && (c || (c = {}), c[g] = "");
}
} else "dangerouslySetInnerHTML" !== l && "children" !== l && "suppressContentEditableWarning" !== l && "suppressHydrationWarning" !== l && "autoFocus" !== l && (ca.hasOwnProperty(l) ? f || (f = []) : (f = f || []).push(l, null));
}
for (l in d) {
var k = d[l];
h = null != e ? e[l] : void 0;
if (d.hasOwnProperty(l) && k !== h && (null != k || null != h)) if ("style" === l) {
if (h) {
for (g in h) {
!h.hasOwnProperty(g) || k && k.hasOwnProperty(g) || (c || (c = {}), c[g] = "");
}
for (g in k) {
k.hasOwnProperty(g) && h[g] !== k[g] && (c || (c = {}), c[g] = k[g]);
}
} else c || (f || (f = []), f.push(l, c)), c = k;
} else "dangerouslySetInnerHTML" === l ? (k = k ? k.__html : void 0, h = h ? h.__html : void 0, null != k && h !== k && (f = f || []).push(l, k)) : "children" === l ? "string" !== typeof k && "number" !== typeof k || (f = f || []).push(l, "" + k) : "suppressContentEditableWarning" !== l && "suppressHydrationWarning" !== l && (ca.hasOwnProperty(l) ? (null != k && "onScroll" === l && G("scroll", a), f || h === k || (f = [])) : "object" === _typeof(k) && null !== k && k.$$typeof === Ga ? k.toString() : (f = f || []).push(l, k));
}
c && (f = f || []).push("style", c);
var l = f;
if (b.updateQueue = l) b.flags |= 4;
}
};
Ei = function Ei(a, b, c, d) {
c !== d && (b.flags |= 4);
};
function Fi(a, b) {
if (!lh) switch (a.tailMode) {
case "hidden":
b = a.tail;
for (var c = null; null !== b;) {
null !== b.alternate && (c = b), b = b.sibling;
}
null === c ? a.tail = null : c.sibling = null;
break;
case "collapsed":
c = a.tail;
for (var d = null; null !== c;) {
null !== c.alternate && (d = c), c = c.sibling;
}
null === d ? b || null === a.tail ? a.tail = null : a.tail.sibling = null : d.sibling = null;
}
}
function Gi(a, b, c) {
var d = b.pendingProps;
switch (b.tag) {
case 2:
case 16:
case 15:
case 0:
case 11:
case 7:
case 8:
case 12:
case 9:
case 14:
return null;
case 1:
return Ff(b.type) && Gf(), null;
case 3:
fh();
H(N);
H(M);
uh();
d = b.stateNode;
d.pendingContext && (d.context = d.pendingContext, d.pendingContext = null);
if (null === a || null === a.child) rh(b) ? b.flags |= 4 : d.hydrate || (b.flags |= 256);
Ci(b);
return null;
case 5:
hh(b);
var e = dh(ch.current);
c = b.type;
if (null !== a && null != b.stateNode) Di(a, b, c, d, e), a.ref !== b.ref && (b.flags |= 128);else {
if (!d) {
if (null === b.stateNode) throw Error(y(166));
return null;
}
a = dh(ah.current);
if (rh(b)) {
d = b.stateNode;
c = b.type;
var f = b.memoizedProps;
d[wf] = b;
d[xf] = f;
switch (c) {
case "dialog":
G("cancel", d);
G("close", d);
break;
case "iframe":
case "object":
case "embed":
G("load", d);
break;
case "video":
case "audio":
for (a = 0; a < Xe.length; a++) {
G(Xe[a], d);
}
break;
case "source":
G("error", d);
break;
case "img":
case "image":
case "link":
G("error", d);
G("load", d);
break;
case "details":
G("toggle", d);
break;
case "input":
Za(d, f);
G("invalid", d);
break;
case "select":
d._wrapperState = {
wasMultiple: !!f.multiple
};
G("invalid", d);
break;
case "textarea":
hb(d, f), G("invalid", d);
}
vb(c, f);
a = null;
for (var g in f) {
f.hasOwnProperty(g) && (e = f[g], "children" === g ? "string" === typeof e ? d.textContent !== e && (a = ["children", e]) : "number" === typeof e && d.textContent !== "" + e && (a = ["children", "" + e]) : ca.hasOwnProperty(g) && null != e && "onScroll" === g && G("scroll", d));
}
switch (c) {
case "input":
Va(d);
cb(d, f, !0);
break;
case "textarea":
Va(d);
jb(d);
break;
case "select":
case "option":
break;
default:
"function" === typeof f.onClick && (d.onclick = jf);
}
d = a;
b.updateQueue = d;
null !== d && (b.flags |= 4);
} else {
g = 9 === e.nodeType ? e : e.ownerDocument;
a === kb.html && (a = lb(c));
a === kb.html ? "script" === c ? (a = g.createElement("div"), a.innerHTML = "<script>\x3c/script>", a = a.removeChild(a.firstChild)) : "string" === typeof d.is ? a = g.createElement(c, {
is: d.is
}) : (a = g.createElement(c), "select" === c && (g = a, d.multiple ? g.multiple = !0 : d.size && (g.size = d.size))) : a = g.createElementNS(a, c);
a[wf] = b;
a[xf] = d;
Bi(a, b, !1, !1);
b.stateNode = a;
g = wb(c, d);
switch (c) {
case "dialog":
G("cancel", a);
G("close", a);
e = d;
break;
case "iframe":
case "object":
case "embed":
G("load", a);
e = d;
break;
case "video":
case "audio":
for (e = 0; e < Xe.length; e++) {
G(Xe[e], a);
}
e = d;
break;
case "source":
G("error", a);
e = d;
break;
case "img":
case "image":
case "link":
G("error", a);
G("load", a);
e = d;
break;
case "details":
G("toggle", a);
e = d;
break;
case "input":
Za(a, d);
e = Ya(a, d);
G("invalid", a);
break;
case "option":
e = eb(a, d);
break;
case "select":
a._wrapperState = {
wasMultiple: !!d.multiple
};
e = m({}, d, {
value: void 0
});
G("invalid", a);
break;
case "textarea":
hb(a, d);
e = gb(a, d);
G("invalid", a);
break;
default:
e = d;
}
vb(c, e);
var h = e;
for (f in h) {
if (h.hasOwnProperty(f)) {
var k = h[f];
"style" === f ? tb(a, k) : "dangerouslySetInnerHTML" === f ? (k = k ? k.__html : void 0, null != k && ob(a, k)) : "children" === f ? "string" === typeof k ? ("textarea" !== c || "" !== k) && pb(a, k) : "number" === typeof k && pb(a, "" + k) : "suppressContentEditableWarning" !== f && "suppressHydrationWarning" !== f && "autoFocus" !== f && (ca.hasOwnProperty(f) ? null != k && "onScroll" === f && G("scroll", a) : null != k && qa(a, f, k, g));
}
}
switch (c) {
case "input":
Va(a);
cb(a, d, !1);
break;
case "textarea":
Va(a);
jb(a);
break;
case "option":
null != d.value && a.setAttribute("value", "" + Sa(d.value));
break;
case "select":
a.multiple = !!d.multiple;
f = d.value;
null != f ? fb(a, !!d.multiple, f, !1) : null != d.defaultValue && fb(a, !!d.multiple, d.defaultValue, !0);
break;
default:
"function" === typeof e.onClick && (a.onclick = jf);
}
mf(c, d) && (b.flags |= 4);
}
null !== b.ref && (b.flags |= 128);
}
return null;
case 6:
if (a && null != b.stateNode) Ei(a, b, a.memoizedProps, d);else {
if ("string" !== typeof d && null === b.stateNode) throw Error(y(166));
c = dh(ch.current);
dh(ah.current);
rh(b) ? (d = b.stateNode, c = b.memoizedProps, d[wf] = b, d.nodeValue !== c && (b.flags |= 4)) : (d = (9 === c.nodeType ? c : c.ownerDocument).createTextNode(d), d[wf] = b, b.stateNode = d);
}
return null;
case 13:
H(P);
d = b.memoizedState;
if (0 !== (b.flags & 64)) return b.lanes = c, b;
d = null !== d;
c = !1;
null === a ? void 0 !== b.memoizedProps.fallback && rh(b) : c = null !== a.memoizedState;
if (d && !c && 0 !== (b.mode & 2)) if (null === a && !0 !== b.memoizedProps.unstable_avoidThisFallback || 0 !== (P.current & 1)) 0 === V && (V = 3);else {
if (0 === V || 3 === V) V = 4;
null === U || 0 === (Dg & 134217727) && 0 === (Hi & 134217727) || Ii(U, W);
}
if (d || c) b.flags |= 4;
return null;
case 4:
return fh(), Ci(b), null === a && cf(b.stateNode.containerInfo), null;
case 10:
return rg(b), null;
case 17:
return Ff(b.type) && Gf(), null;
case 19:
H(P);
d = b.memoizedState;
if (null === d) return null;
f = 0 !== (b.flags & 64);
g = d.rendering;
if (null === g) {
if (f) Fi(d, !1);else {
if (0 !== V || null !== a && 0 !== (a.flags & 64)) for (a = b.child; null !== a;) {
g = ih(a);
if (null !== g) {
b.flags |= 64;
Fi(d, !1);
f = g.updateQueue;
null !== f && (b.updateQueue = f, b.flags |= 4);
null === d.lastEffect && (b.firstEffect = null);
b.lastEffect = d.lastEffect;
d = c;
for (c = b.child; null !== c;) {
f = c, a = d, f.flags &= 2, f.nextEffect = null, f.firstEffect = null, f.lastEffect = null, g = f.alternate, null === g ? (f.childLanes = 0, f.lanes = a, f.child = null, f.memoizedProps = null, f.memoizedState = null, f.updateQueue = null, f.dependencies = null, f.stateNode = null) : (f.childLanes = g.childLanes, f.lanes = g.lanes, f.child = g.child, f.memoizedProps = g.memoizedProps, f.memoizedState = g.memoizedState, f.updateQueue = g.updateQueue, f.type = g.type, a = g.dependencies, f.dependencies = null === a ? null : {
lanes: a.lanes,
firstContext: a.firstContext
}), c = c.sibling;
}
I(P, P.current & 1 | 2);
return b.child;
}
a = a.sibling;
}
null !== d.tail && O() > Ji && (b.flags |= 64, f = !0, Fi(d, !1), b.lanes = 33554432);
}
} else {
if (!f) if (a = ih(g), null !== a) {
if (b.flags |= 64, f = !0, c = a.updateQueue, null !== c && (b.updateQueue = c, b.flags |= 4), Fi(d, !0), null === d.tail && "hidden" === d.tailMode && !g.alternate && !lh) return b = b.lastEffect = d.lastEffect, null !== b && (b.nextEffect = null), null;
} else 2 * O() - d.renderingStartTime > Ji && 1073741824 !== c && (b.flags |= 64, f = !0, Fi(d, !1), b.lanes = 33554432);
d.isBackwards ? (g.sibling = b.child, b.child = g) : (c = d.last, null !== c ? c.sibling = g : b.child = g, d.last = g);
}
return null !== d.tail ? (c = d.tail, d.rendering = c, d.tail = c.sibling, d.lastEffect = b.lastEffect, d.renderingStartTime = O(), c.sibling = null, b = P.current, I(P, f ? b & 1 | 2 : b & 1), c) : null;
case 23:
case 24:
return Ki(), null !== a && null !== a.memoizedState !== (null !== b.memoizedState) && "unstable-defer-without-hiding" !== d.mode && (b.flags |= 4), null;
}
throw Error(y(156, b.tag));
}
function Li(a) {
switch (a.tag) {
case 1:
Ff(a.type) && Gf();
var b = a.flags;
return b & 4096 ? (a.flags = b & -4097 | 64, a) : null;
case 3:
fh();
H(N);
H(M);
uh();
b = a.flags;
if (0 !== (b & 64)) throw Error(y(285));
a.flags = b & -4097 | 64;
return a;
case 5:
return hh(a), null;
case 13:
return H(P), b = a.flags, b & 4096 ? (a.flags = b & -4097 | 64, a) : null;
case 19:
return H(P), null;
case 4:
return fh(), null;
case 10:
return rg(a), null;
case 23:
case 24:
return Ki(), null;
default:
return null;
}
}
function Mi(a, b) {
try {
var c = "",
d = b;
do {
c += Qa(d), d = d.return;
} while (d);
var e = c;
} catch (f) {
e = "\nError generating stack: " + f.message + "\n" + f.stack;
}
return {
value: a,
source: b,
stack: e
};
}
function Ni(a, b) {
try {
console.error(b.value);
} catch (c) {
setTimeout(function () {
throw c;
});
}
}
var Oi = "function" === typeof WeakMap ? WeakMap : Map;
function Pi(a, b, c) {
c = zg(-1, c);
c.tag = 3;
c.payload = {
element: null
};
var d = b.value;
c.callback = function () {
Qi || (Qi = !0, Ri = d);
Ni(a, b);
};
return c;
}
function Si(a, b, c) {
c = zg(-1, c);
c.tag = 3;
var d = a.type.getDerivedStateFromError;
if ("function" === typeof d) {
var e = b.value;
c.payload = function () {
Ni(a, b);
return d(e);
};
}
var f = a.stateNode;
null !== f && "function" === typeof f.componentDidCatch && (c.callback = function () {
"function" !== typeof d && (null === Ti ? Ti = new Set([this]) : Ti.add(this), Ni(a, b));
var c = b.stack;
this.componentDidCatch(b.value, {
componentStack: null !== c ? c : ""
});
});
return c;
}
var Ui = "function" === typeof WeakSet ? WeakSet : Set;
function Vi(a) {
var b = a.ref;
if (null !== b) if ("function" === typeof b) try {
b(null);
} catch (c) {
Wi(a, c);
} else b.current = null;
}
function Xi(a, b) {
switch (b.tag) {
case 0:
case 11:
case 15:
case 22:
return;
case 1:
if (b.flags & 256 && null !== a) {
var c = a.memoizedProps,
d = a.memoizedState;
a = b.stateNode;
b = a.getSnapshotBeforeUpdate(b.elementType === b.type ? c : lg(b.type, c), d);
a.__reactInternalSnapshotBeforeUpdate = b;
}
return;
case 3:
b.flags & 256 && qf(b.stateNode.containerInfo);
return;
case 5:
case 6:
case 4:
case 17:
return;
}
throw Error(y(163));
}
function Yi(a, b, c) {
switch (c.tag) {
case 0:
case 11:
case 15:
case 22:
b = c.updateQueue;
b = null !== b ? b.lastEffect : null;
if (null !== b) {
a = b = b.next;
do {
if (3 === (a.tag & 3)) {
var d = a.create;
a.destroy = d();
}
a = a.next;
} while (a !== b);
}
b = c.updateQueue;
b = null !== b ? b.lastEffect : null;
if (null !== b) {
a = b = b.next;
do {
var e = a;
d = e.next;
e = e.tag;
0 !== (e & 4) && 0 !== (e & 1) && (Zi(c, a), $i(c, a));
a = d;
} while (a !== b);
}
return;
case 1:
a = c.stateNode;
c.flags & 4 && (null === b ? a.componentDidMount() : (d = c.elementType === c.type ? b.memoizedProps : lg(c.type, b.memoizedProps), a.componentDidUpdate(d, b.memoizedState, a.__reactInternalSnapshotBeforeUpdate)));
b = c.updateQueue;
null !== b && Eg(c, b, a);
return;
case 3:
b = c.updateQueue;
if (null !== b) {
a = null;
if (null !== c.child) switch (c.child.tag) {
case 5:
a = c.child.stateNode;
break;
case 1:
a = c.child.stateNode;
}
Eg(c, b, a);
}
return;
case 5:
a = c.stateNode;
null === b && c.flags & 4 && mf(c.type, c.memoizedProps) && a.focus();
return;
case 6:
return;
case 4:
return;
case 12:
return;
case 13:
null === c.memoizedState && (c = c.alternate, null !== c && (c = c.memoizedState, null !== c && (c = c.dehydrated, null !== c && Cc(c))));
return;
case 19:
case 17:
case 20:
case 21:
case 23:
case 24:
return;
}
throw Error(y(163));
}
function aj(a, b) {
for (var c = a;;) {
if (5 === c.tag) {
var d = c.stateNode;
if (b) d = d.style, "function" === typeof d.setProperty ? d.setProperty("display", "none", "important") : d.display = "none";else {
d = c.stateNode;
var e = c.memoizedProps.style;
e = void 0 !== e && null !== e && e.hasOwnProperty("display") ? e.display : null;
d.style.display = sb("display", e);
}
} else if (6 === c.tag) c.stateNode.nodeValue = b ? "" : c.memoizedProps;else if ((23 !== c.tag && 24 !== c.tag || null === c.memoizedState || c === a) && null !== c.child) {
c.child.return = c;
c = c.child;
continue;
}
if (c === a) break;
for (; null === c.sibling;) {
if (null === c.return || c.return === a) return;
c = c.return;
}
c.sibling.return = c.return;
c = c.sibling;
}
}
function bj(a, b) {
if (Mf && "function" === typeof Mf.onCommitFiberUnmount) try {
Mf.onCommitFiberUnmount(Lf, b);
} catch (f) {}
switch (b.tag) {
case 0:
case 11:
case 14:
case 15:
case 22:
a = b.updateQueue;
if (null !== a && (a = a.lastEffect, null !== a)) {
var c = a = a.next;
do {
var d = c,
e = d.destroy;
d = d.tag;
if (void 0 !== e) if (0 !== (d & 4)) Zi(b, c);else {
d = b;
try {
e();
} catch (f) {
Wi(d, f);
}
}
c = c.next;
} while (c !== a);
}
break;
case 1:
Vi(b);
a = b.stateNode;
if ("function" === typeof a.componentWillUnmount) try {
a.props = b.memoizedProps, a.state = b.memoizedState, a.componentWillUnmount();
} catch (f) {
Wi(b, f);
}
break;
case 5:
Vi(b);
break;
case 4:
cj(a, b);
}
}
function dj(a) {
a.alternate = null;
a.child = null;
a.dependencies = null;
a.firstEffect = null;
a.lastEffect = null;
a.memoizedProps = null;
a.memoizedState = null;
a.pendingProps = null;
a.return = null;
a.updateQueue = null;
}
function ej(a) {
return 5 === a.tag || 3 === a.tag || 4 === a.tag;
}
function fj(a) {
a: {
for (var b = a.return; null !== b;) {
if (ej(b)) break a;
b = b.return;
}
throw Error(y(160));
}
var c = b;
b = c.stateNode;
switch (c.tag) {
case 5:
var d = !1;
break;
case 3:
b = b.containerInfo;
d = !0;
break;
case 4:
b = b.containerInfo;
d = !0;
break;
default:
throw Error(y(161));
}
c.flags & 16 && (pb(b, ""), c.flags &= -17);
a: b: for (c = a;;) {
for (; null === c.sibling;) {
if (null === c.return || ej(c.return)) {
c = null;
break a;
}
c = c.return;
}
c.sibling.return = c.return;
for (c = c.sibling; 5 !== c.tag && 6 !== c.tag && 18 !== c.tag;) {
if (c.flags & 2) continue b;
if (null === c.child || 4 === c.tag) continue b;else c.child.return = c, c = c.child;
}
if (!(c.flags & 2)) {
c = c.stateNode;
break a;
}
}
d ? gj(a, c, b) : hj(a, c, b);
}
function gj(a, b, c) {
var d = a.tag,
e = 5 === d || 6 === d;
if (e) a = e ? a.stateNode : a.stateNode.instance, b ? 8 === c.nodeType ? c.parentNode.insertBefore(a, b) : c.insertBefore(a, b) : (8 === c.nodeType ? (b = c.parentNode, b.insertBefore(a, c)) : (b = c, b.appendChild(a)), c = c._reactRootContainer, null !== c && void 0 !== c || null !== b.onclick || (b.onclick = jf));else if (4 !== d && (a = a.child, null !== a)) for (gj(a, b, c), a = a.sibling; null !== a;) {
gj(a, b, c), a = a.sibling;
}
}
function hj(a, b, c) {
var d = a.tag,
e = 5 === d || 6 === d;
if (e) a = e ? a.stateNode : a.stateNode.instance, b ? c.insertBefore(a, b) : c.appendChild(a);else if (4 !== d && (a = a.child, null !== a)) for (hj(a, b, c), a = a.sibling; null !== a;) {
hj(a, b, c), a = a.sibling;
}
}
function cj(a, b) {
for (var c = b, d = !1, e, f;;) {
if (!d) {
d = c.return;
a: for (;;) {
if (null === d) throw Error(y(160));
e = d.stateNode;
switch (d.tag) {
case 5:
f = !1;
break a;
case 3:
e = e.containerInfo;
f = !0;
break a;
case 4:
e = e.containerInfo;
f = !0;
break a;
}
d = d.return;
}
d = !0;
}
if (5 === c.tag || 6 === c.tag) {
a: for (var g = a, h = c, k = h;;) {
if (bj(g, k), null !== k.child && 4 !== k.tag) k.child.return = k, k = k.child;else {
if (k === h) break a;
for (; null === k.sibling;) {
if (null === k.return || k.return === h) break a;
k = k.return;
}
k.sibling.return = k.return;
k = k.sibling;
}
}
f ? (g = e, h = c.stateNode, 8 === g.nodeType ? g.parentNode.removeChild(h) : g.removeChild(h)) : e.removeChild(c.stateNode);
} else if (4 === c.tag) {
if (null !== c.child) {
e = c.stateNode.containerInfo;
f = !0;
c.child.return = c;
c = c.child;
continue;
}
} else if (bj(a, c), null !== c.child) {
c.child.return = c;
c = c.child;
continue;
}
if (c === b) break;
for (; null === c.sibling;) {
if (null === c.return || c.return === b) return;
c = c.return;
4 === c.tag && (d = !1);
}
c.sibling.return = c.return;
c = c.sibling;
}
}
function ij(a, b) {
switch (b.tag) {
case 0:
case 11:
case 14:
case 15:
case 22:
var c = b.updateQueue;
c = null !== c ? c.lastEffect : null;
if (null !== c) {
var d = c = c.next;
do {
3 === (d.tag & 3) && (a = d.destroy, d.destroy = void 0, void 0 !== a && a()), d = d.next;
} while (d !== c);
}
return;
case 1:
return;
case 5:
c = b.stateNode;
if (null != c) {
d = b.memoizedProps;
var e = null !== a ? a.memoizedProps : d;
a = b.type;
var f = b.updateQueue;
b.updateQueue = null;
if (null !== f) {
c[xf] = d;
"input" === a && "radio" === d.type && null != d.name && $a(c, d);
wb(a, e);
b = wb(a, d);
for (e = 0; e < f.length; e += 2) {
var g = f[e],
h = f[e + 1];
"style" === g ? tb(c, h) : "dangerouslySetInnerHTML" === g ? ob(c, h) : "children" === g ? pb(c, h) : qa(c, g, h, b);
}
switch (a) {
case "input":
ab(c, d);
break;
case "textarea":
ib(c, d);
break;
case "select":
a = c._wrapperState.wasMultiple, c._wrapperState.wasMultiple = !!d.multiple, f = d.value, null != f ? fb(c, !!d.multiple, f, !1) : a !== !!d.multiple && (null != d.defaultValue ? fb(c, !!d.multiple, d.defaultValue, !0) : fb(c, !!d.multiple, d.multiple ? [] : "", !1));
}
}
}
return;
case 6:
if (null === b.stateNode) throw Error(y(162));
b.stateNode.nodeValue = b.memoizedProps;
return;
case 3:
c = b.stateNode;
c.hydrate && (c.hydrate = !1, Cc(c.containerInfo));
return;
case 12:
return;
case 13:
null !== b.memoizedState && (jj = O(), aj(b.child, !0));
kj(b);
return;
case 19:
kj(b);
return;
case 17:
return;
case 23:
case 24:
aj(b, null !== b.memoizedState);
return;
}
throw Error(y(163));
}
function kj(a) {
var b = a.updateQueue;
if (null !== b) {
a.updateQueue = null;
var c = a.stateNode;
null === c && (c = a.stateNode = new Ui());
b.forEach(function (b) {
var d = lj.bind(null, a, b);
c.has(b) || (c.add(b), b.then(d, d));
});
}
}
function mj(a, b) {
return null !== a && (a = a.memoizedState, null === a || null !== a.dehydrated) ? (b = b.memoizedState, null !== b && null === b.dehydrated) : !1;
}
var nj = Math.ceil,
oj = ra.ReactCurrentDispatcher,
pj = ra.ReactCurrentOwner,
X = 0,
U = null,
Y = null,
W = 0,
qj = 0,
rj = Bf(0),
V = 0,
sj = null,
tj = 0,
Dg = 0,
Hi = 0,
uj = 0,
vj = null,
jj = 0,
Ji = Infinity;
function wj() {
Ji = O() + 500;
}
var Z = null,
Qi = !1,
Ri = null,
Ti = null,
xj = !1,
yj = null,
zj = 90,
Aj = [],
Bj = [],
Cj = null,
Dj = 0,
Ej = null,
Fj = -1,
Gj = 0,
Hj = 0,
Ij = null,
Jj = !1;
function Hg() {
return 0 !== (X & 48) ? O() : -1 !== Fj ? Fj : Fj = O();
}
function Ig(a) {
a = a.mode;
if (0 === (a & 2)) return 1;
if (0 === (a & 4)) return 99 === eg() ? 1 : 2;
0 === Gj && (Gj = tj);
if (0 !== kg.transition) {
0 !== Hj && (Hj = null !== vj ? vj.pendingLanes : 0);
a = Gj;
var b = 4186112 & ~Hj;
b &= -b;
0 === b && (a = 4186112 & ~a, b = a & -a, 0 === b && (b = 8192));
return b;
}
a = eg();
0 !== (X & 4) && 98 === a ? a = Xc(12, Gj) : (a = Sc(a), a = Xc(a, Gj));
return a;
}
function Jg(a, b, c) {
if (50 < Dj) throw Dj = 0, Ej = null, Error(y(185));
a = Kj(a, b);
if (null === a) return null;
$c(a, b, c);
a === U && (Hi |= b, 4 === V && Ii(a, W));
var d = eg();
1 === b ? 0 !== (X & 8) && 0 === (X & 48) ? Lj(a) : (Mj(a, c), 0 === X && (wj(), ig())) : (0 === (X & 4) || 98 !== d && 99 !== d || (null === Cj ? Cj = new Set([a]) : Cj.add(a)), Mj(a, c));
vj = a;
}
function Kj(a, b) {
a.lanes |= b;
var c = a.alternate;
null !== c && (c.lanes |= b);
c = a;
for (a = a.return; null !== a;) {
a.childLanes |= b, c = a.alternate, null !== c && (c.childLanes |= b), c = a, a = a.return;
}
return 3 === c.tag ? c.stateNode : null;
}
function Mj(a, b) {
for (var c = a.callbackNode, d = a.suspendedLanes, e = a.pingedLanes, f = a.expirationTimes, g = a.pendingLanes; 0 < g;) {
var h = 31 - Vc(g),
k = 1 << h,
l = f[h];
if (-1 === l) {
if (0 === (k & d) || 0 !== (k & e)) {
l = b;
Rc(k);
var n = F;
f[h] = 10 <= n ? l + 250 : 6 <= n ? l + 5E3 : -1;
}
} else l <= b && (a.expiredLanes |= k);
g &= ~k;
}
d = Uc(a, a === U ? W : 0);
b = F;
if (0 === d) null !== c && (c !== Zf && Pf(c), a.callbackNode = null, a.callbackPriority = 0);else {
if (null !== c) {
if (a.callbackPriority === b) return;
c !== Zf && Pf(c);
}
15 === b ? (c = Lj.bind(null, a), null === ag ? (ag = [c], bg = Of(Uf, jg)) : ag.push(c), c = Zf) : 14 === b ? c = hg(99, Lj.bind(null, a)) : (c = Tc(b), c = hg(c, Nj.bind(null, a)));
a.callbackPriority = b;
a.callbackNode = c;
}
}
function Nj(a) {
Fj = -1;
Hj = Gj = 0;
if (0 !== (X & 48)) throw Error(y(327));
var b = a.callbackNode;
if (Oj() && a.callbackNode !== b) return null;
var c = Uc(a, a === U ? W : 0);
if (0 === c) return null;
var d = c;
var e = X;
X |= 16;
var f = Pj();
if (U !== a || W !== d) wj(), Qj(a, d);
do {
try {
Rj();
break;
} catch (h) {
Sj(a, h);
}
} while (1);
qg();
oj.current = f;
X = e;
null !== Y ? d = 0 : (U = null, W = 0, d = V);
if (0 !== (tj & Hi)) Qj(a, 0);else if (0 !== d) {
2 === d && (X |= 64, a.hydrate && (a.hydrate = !1, qf(a.containerInfo)), c = Wc(a), 0 !== c && (d = Tj(a, c)));
if (1 === d) throw b = sj, Qj(a, 0), Ii(a, c), Mj(a, O()), b;
a.finishedWork = a.current.alternate;
a.finishedLanes = c;
switch (d) {
case 0:
case 1:
throw Error(y(345));
case 2:
Uj(a);
break;
case 3:
Ii(a, c);
if ((c & 62914560) === c && (d = jj + 500 - O(), 10 < d)) {
if (0 !== Uc(a, 0)) break;
e = a.suspendedLanes;
if ((e & c) !== c) {
Hg();
a.pingedLanes |= a.suspendedLanes & e;
break;
}
a.timeoutHandle = of(Uj.bind(null, a), d);
break;
}
Uj(a);
break;
case 4:
Ii(a, c);
if ((c & 4186112) === c) break;
d = a.eventTimes;
for (e = -1; 0 < c;) {
var g = 31 - Vc(c);
f = 1 << g;
g = d[g];
g > e && (e = g);
c &= ~f;
}
c = e;
c = O() - c;
c = (120 > c ? 120 : 480 > c ? 480 : 1080 > c ? 1080 : 1920 > c ? 1920 : 3E3 > c ? 3E3 : 4320 > c ? 4320 : 1960 * nj(c / 1960)) - c;
if (10 < c) {
a.timeoutHandle = of(Uj.bind(null, a), c);
break;
}
Uj(a);
break;
case 5:
Uj(a);
break;
default:
throw Error(y(329));
}
}
Mj(a, O());
return a.callbackNode === b ? Nj.bind(null, a) : null;
}
function Ii(a, b) {
b &= ~uj;
b &= ~Hi;
a.suspendedLanes |= b;
a.pingedLanes &= ~b;
for (a = a.expirationTimes; 0 < b;) {
var c = 31 - Vc(b),
d = 1 << c;
a[c] = -1;
b &= ~d;
}
}
function Lj(a) {
if (0 !== (X & 48)) throw Error(y(327));
Oj();
if (a === U && 0 !== (a.expiredLanes & W)) {
var b = W;
var c = Tj(a, b);
0 !== (tj & Hi) && (b = Uc(a, b), c = Tj(a, b));
} else b = Uc(a, 0), c = Tj(a, b);
0 !== a.tag && 2 === c && (X |= 64, a.hydrate && (a.hydrate = !1, qf(a.containerInfo)), b = Wc(a), 0 !== b && (c = Tj(a, b)));
if (1 === c) throw c = sj, Qj(a, 0), Ii(a, b), Mj(a, O()), c;
a.finishedWork = a.current.alternate;
a.finishedLanes = b;
Uj(a);
Mj(a, O());
return null;
}
function Vj() {
if (null !== Cj) {
var a = Cj;
Cj = null;
a.forEach(function (a) {
a.expiredLanes |= 24 & a.pendingLanes;
Mj(a, O());
});
}
ig();
}
function Wj(a, b) {
var c = X;
X |= 1;
try {
return a(b);
} finally {
X = c, 0 === X && (wj(), ig());
}
}
function Xj(a, b) {
var c = X;
X &= -2;
X |= 8;
try {
return a(b);
} finally {
X = c, 0 === X && (wj(), ig());
}
}
function ni(a, b) {
I(rj, qj);
qj |= b;
tj |= b;
}
function Ki() {
qj = rj.current;
H(rj);
}
function Qj(a, b) {
a.finishedWork = null;
a.finishedLanes = 0;
var c = a.timeoutHandle;
-1 !== c && (a.timeoutHandle = -1, pf(c));
if (null !== Y) for (c = Y.return; null !== c;) {
var d = c;
switch (d.tag) {
case 1:
d = d.type.childContextTypes;
null !== d && void 0 !== d && Gf();
break;
case 3:
fh();
H(N);
H(M);
uh();
break;
case 5:
hh(d);
break;
case 4:
fh();
break;
case 13:
H(P);
break;
case 19:
H(P);
break;
case 10:
rg(d);
break;
case 23:
case 24:
Ki();
}
c = c.return;
}
U = a;
Y = Tg(a.current, null);
W = qj = tj = b;
V = 0;
sj = null;
uj = Hi = Dg = 0;
}
function Sj(a, b) {
do {
var c = Y;
try {
qg();
vh.current = Gh;
if (yh) {
for (var d = R.memoizedState; null !== d;) {
var e = d.queue;
null !== e && (e.pending = null);
d = d.next;
}
yh = !1;
}
xh = 0;
T = S = R = null;
zh = !1;
pj.current = null;
if (null === c || null === c.return) {
V = 1;
sj = b;
Y = null;
break;
}
a: {
var f = a,
g = c.return,
h = c,
k = b;
b = W;
h.flags |= 2048;
h.firstEffect = h.lastEffect = null;
if (null !== k && "object" === _typeof(k) && "function" === typeof k.then) {
var l = k;
if (0 === (h.mode & 2)) {
var n = h.alternate;
n ? (h.updateQueue = n.updateQueue, h.memoizedState = n.memoizedState, h.lanes = n.lanes) : (h.updateQueue = null, h.memoizedState = null);
}
var A = 0 !== (P.current & 1),
p = g;
do {
var C;
if (C = 13 === p.tag) {
var x = p.memoizedState;
if (null !== x) C = null !== x.dehydrated ? !0 : !1;else {
var w = p.memoizedProps;
C = void 0 === w.fallback ? !1 : !0 !== w.unstable_avoidThisFallback ? !0 : A ? !1 : !0;
}
}
if (C) {
var z = p.updateQueue;
if (null === z) {
var u = new Set();
u.add(l);
p.updateQueue = u;
} else z.add(l);
if (0 === (p.mode & 2)) {
p.flags |= 64;
h.flags |= 16384;
h.flags &= -2981;
if (1 === h.tag) if (null === h.alternate) h.tag = 17;else {
var t = zg(-1, 1);
t.tag = 2;
Ag(h, t);
}
h.lanes |= 1;
break a;
}
k = void 0;
h = b;
var q = f.pingCache;
null === q ? (q = f.pingCache = new Oi(), k = new Set(), q.set(l, k)) : (k = q.get(l), void 0 === k && (k = new Set(), q.set(l, k)));
if (!k.has(h)) {
k.add(h);
var v = Yj.bind(null, f, l, h);
l.then(v, v);
}
p.flags |= 4096;
p.lanes = b;
break a;
}
p = p.return;
} while (null !== p);
k = Error((Ra(h.type) || "A React component") + " suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.");
}
5 !== V && (V = 2);
k = Mi(k, h);
p = g;
do {
switch (p.tag) {
case 3:
f = k;
p.flags |= 4096;
b &= -b;
p.lanes |= b;
var J = Pi(p, f, b);
Bg(p, J);
break a;
case 1:
f = k;
var K = p.type,
Q = p.stateNode;
if (0 === (p.flags & 64) && ("function" === typeof K.getDerivedStateFromError || null !== Q && "function" === typeof Q.componentDidCatch && (null === Ti || !Ti.has(Q)))) {
p.flags |= 4096;
b &= -b;
p.lanes |= b;
var L = Si(p, f, b);
Bg(p, L);
break a;
}
}
p = p.return;
} while (null !== p);
}
Zj(c);
} catch (va) {
b = va;
Y === c && null !== c && (Y = c = c.return);
continue;
}
break;
} while (1);
}
function Pj() {
var a = oj.current;
oj.current = Gh;
return null === a ? Gh : a;
}
function Tj(a, b) {
var c = X;
X |= 16;
var d = Pj();
U === a && W === b || Qj(a, b);
do {
try {
ak();
break;
} catch (e) {
Sj(a, e);
}
} while (1);
qg();
X = c;
oj.current = d;
if (null !== Y) throw Error(y(261));
U = null;
W = 0;
return V;
}
function ak() {
for (; null !== Y;) {
bk(Y);
}
}
function Rj() {
for (; null !== Y && !Qf();) {
bk(Y);
}
}
function bk(a) {
var b = ck(a.alternate, a, qj);
a.memoizedProps = a.pendingProps;
null === b ? Zj(a) : Y = b;
pj.current = null;
}
function Zj(a) {
var b = a;
do {
var c = b.alternate;
a = b.return;
if (0 === (b.flags & 2048)) {
c = Gi(c, b, qj);
if (null !== c) {
Y = c;
return;
}
c = b;
if (24 !== c.tag && 23 !== c.tag || null === c.memoizedState || 0 !== (qj & 1073741824) || 0 === (c.mode & 4)) {
for (var d = 0, e = c.child; null !== e;) {
d |= e.lanes | e.childLanes, e = e.sibling;
}
c.childLanes = d;
}
null !== a && 0 === (a.flags & 2048) && (null === a.firstEffect && (a.firstEffect = b.firstEffect), null !== b.lastEffect && (null !== a.lastEffect && (a.lastEffect.nextEffect = b.firstEffect), a.lastEffect = b.lastEffect), 1 < b.flags && (null !== a.lastEffect ? a.lastEffect.nextEffect = b : a.firstEffect = b, a.lastEffect = b));
} else {
c = Li(b);
if (null !== c) {
c.flags &= 2047;
Y = c;
return;
}
null !== a && (a.firstEffect = a.lastEffect = null, a.flags |= 2048);
}
b = b.sibling;
if (null !== b) {
Y = b;
return;
}
Y = b = a;
} while (null !== b);
0 === V && (V = 5);
}
function Uj(a) {
var b = eg();
gg(99, dk.bind(null, a, b));
return null;
}
function dk(a, b) {
do {
Oj();
} while (null !== yj);
if (0 !== (X & 48)) throw Error(y(327));
var c = a.finishedWork;
if (null === c) return null;
a.finishedWork = null;
a.finishedLanes = 0;
if (c === a.current) throw Error(y(177));
a.callbackNode = null;
var d = c.lanes | c.childLanes,
e = d,
f = a.pendingLanes & ~e;
a.pendingLanes = e;
a.suspendedLanes = 0;
a.pingedLanes = 0;
a.expiredLanes &= e;
a.mutableReadLanes &= e;
a.entangledLanes &= e;
e = a.entanglements;
for (var g = a.eventTimes, h = a.expirationTimes; 0 < f;) {
var k = 31 - Vc(f),
l = 1 << k;
e[k] = 0;
g[k] = -1;
h[k] = -1;
f &= ~l;
}
null !== Cj && 0 === (d & 24) && Cj.has(a) && Cj.delete(a);
a === U && (Y = U = null, W = 0);
1 < c.flags ? null !== c.lastEffect ? (c.lastEffect.nextEffect = c, d = c.firstEffect) : d = c : d = c.firstEffect;
if (null !== d) {
e = X;
X |= 32;
pj.current = null;
kf = fd;
g = Ne();
if (Oe(g)) {
if ("selectionStart" in g) h = {
start: g.selectionStart,
end: g.selectionEnd
};else a: if (h = (h = g.ownerDocument) && h.defaultView || window, (l = h.getSelection && h.getSelection()) && 0 !== l.rangeCount) {
h = l.anchorNode;
f = l.anchorOffset;
k = l.focusNode;
l = l.focusOffset;
try {
h.nodeType, k.nodeType;
} catch (va) {
h = null;
break a;
}
var n = 0,
A = -1,
p = -1,
C = 0,
x = 0,
w = g,
z = null;
b: for (;;) {
for (var u;;) {
w !== h || 0 !== f && 3 !== w.nodeType || (A = n + f);
w !== k || 0 !== l && 3 !== w.nodeType || (p = n + l);
3 === w.nodeType && (n += w.nodeValue.length);
if (null === (u = w.firstChild)) break;
z = w;
w = u;
}
for (;;) {
if (w === g) break b;
z === h && ++C === f && (A = n);
z === k && ++x === l && (p = n);
if (null !== (u = w.nextSibling)) break;
w = z;
z = w.parentNode;
}
w = u;
}
h = -1 === A || -1 === p ? null : {
start: A,
end: p
};
} else h = null;
h = h || {
start: 0,
end: 0
};
} else h = null;
lf = {
focusedElem: g,
selectionRange: h
};
fd = !1;
Ij = null;
Jj = !1;
Z = d;
do {
try {
ek();
} catch (va) {
if (null === Z) throw Error(y(330));
Wi(Z, va);
Z = Z.nextEffect;
}
} while (null !== Z);
Ij = null;
Z = d;
do {
try {
for (g = a; null !== Z;) {
var t = Z.flags;
t & 16 && pb(Z.stateNode, "");
if (t & 128) {
var q = Z.alternate;
if (null !== q) {
var v = q.ref;
null !== v && ("function" === typeof v ? v(null) : v.current = null);
}
}
switch (t & 1038) {
case 2:
fj(Z);
Z.flags &= -3;
break;
case 6:
fj(Z);
Z.flags &= -3;
ij(Z.alternate, Z);
break;
case 1024:
Z.flags &= -1025;
break;
case 1028:
Z.flags &= -1025;
ij(Z.alternate, Z);
break;
case 4:
ij(Z.alternate, Z);
break;
case 8:
h = Z;
cj(g, h);
var J = h.alternate;
dj(h);
null !== J && dj(J);
}
Z = Z.nextEffect;
}
} catch (va) {
if (null === Z) throw Error(y(330));
Wi(Z, va);
Z = Z.nextEffect;
}
} while (null !== Z);
v = lf;
q = Ne();
t = v.focusedElem;
g = v.selectionRange;
if (q !== t && t && t.ownerDocument && Me(t.ownerDocument.documentElement, t)) {
null !== g && Oe(t) && (q = g.start, v = g.end, void 0 === v && (v = q), "selectionStart" in t ? (t.selectionStart = q, t.selectionEnd = Math.min(v, t.value.length)) : (v = (q = t.ownerDocument || document) && q.defaultView || window, v.getSelection && (v = v.getSelection(), h = t.textContent.length, J = Math.min(g.start, h), g = void 0 === g.end ? J : Math.min(g.end, h), !v.extend && J > g && (h = g, g = J, J = h), h = Le(t, J), f = Le(t, g), h && f && (1 !== v.rangeCount || v.anchorNode !== h.node || v.anchorOffset !== h.offset || v.focusNode !== f.node || v.focusOffset !== f.offset) && (q = q.createRange(), q.setStart(h.node, h.offset), v.removeAllRanges(), J > g ? (v.addRange(q), v.extend(f.node, f.offset)) : (q.setEnd(f.node, f.offset), v.addRange(q))))));
q = [];
for (v = t; v = v.parentNode;) {
1 === v.nodeType && q.push({
element: v,
left: v.scrollLeft,
top: v.scrollTop
});
}
"function" === typeof t.focus && t.focus();
for (t = 0; t < q.length; t++) {
v = q[t], v.element.scrollLeft = v.left, v.element.scrollTop = v.top;
}
}
fd = !!kf;
lf = kf = null;
a.current = c;
Z = d;
do {
try {
for (t = a; null !== Z;) {
var K = Z.flags;
K & 36 && Yi(t, Z.alternate, Z);
if (K & 128) {
q = void 0;
var Q = Z.ref;
if (null !== Q) {
var L = Z.stateNode;
switch (Z.tag) {
case 5:
q = L;
break;
default:
q = L;
}
"function" === typeof Q ? Q(q) : Q.current = q;
}
}
Z = Z.nextEffect;
}
} catch (va) {
if (null === Z) throw Error(y(330));
Wi(Z, va);
Z = Z.nextEffect;
}
} while (null !== Z);
Z = null;
$f();
X = e;
} else a.current = c;
if (xj) xj = !1, yj = a, zj = b;else for (Z = d; null !== Z;) {
b = Z.nextEffect, Z.nextEffect = null, Z.flags & 8 && (K = Z, K.sibling = null, K.stateNode = null), Z = b;
}
d = a.pendingLanes;
0 === d && (Ti = null);
1 === d ? a === Ej ? Dj++ : (Dj = 0, Ej = a) : Dj = 0;
c = c.stateNode;
if (Mf && "function" === typeof Mf.onCommitFiberRoot) try {
Mf.onCommitFiberRoot(Lf, c, void 0, 64 === (c.current.flags & 64));
} catch (va) {}
Mj(a, O());
if (Qi) throw Qi = !1, a = Ri, Ri = null, a;
if (0 !== (X & 8)) return null;
ig();
return null;
}
function ek() {
for (; null !== Z;) {
var a = Z.alternate;
Jj || null === Ij || (0 !== (Z.flags & 8) ? dc(Z, Ij) && (Jj = !0) : 13 === Z.tag && mj(a, Z) && dc(Z, Ij) && (Jj = !0));
var b = Z.flags;
0 !== (b & 256) && Xi(a, Z);
0 === (b & 512) || xj || (xj = !0, hg(97, function () {
Oj();
return null;
}));
Z = Z.nextEffect;
}
}
function Oj() {
if (90 !== zj) {
var a = 97 < zj ? 97 : zj;
zj = 90;
return gg(a, fk);
}
return !1;
}
function $i(a, b) {
Aj.push(b, a);
xj || (xj = !0, hg(97, function () {
Oj();
return null;
}));
}
function Zi(a, b) {
Bj.push(b, a);
xj || (xj = !0, hg(97, function () {
Oj();
return null;
}));
}
function fk() {
if (null === yj) return !1;
var a = yj;
yj = null;
if (0 !== (X & 48)) throw Error(y(331));
var b = X;
X |= 32;
var c = Bj;
Bj = [];
for (var d = 0; d < c.length; d += 2) {
var e = c[d],
f = c[d + 1],
g = e.destroy;
e.destroy = void 0;
if ("function" === typeof g) try {
g();
} catch (k) {
if (null === f) throw Error(y(330));
Wi(f, k);
}
}
c = Aj;
Aj = [];
for (d = 0; d < c.length; d += 2) {
e = c[d];
f = c[d + 1];
try {
var h = e.create;
e.destroy = h();
} catch (k) {
if (null === f) throw Error(y(330));
Wi(f, k);
}
}
for (h = a.current.firstEffect; null !== h;) {
a = h.nextEffect, h.nextEffect = null, h.flags & 8 && (h.sibling = null, h.stateNode = null), h = a;
}
X = b;
ig();
return !0;
}
function gk(a, b, c) {
b = Mi(c, b);
b = Pi(a, b, 1);
Ag(a, b);
b = Hg();
a = Kj(a, 1);
null !== a && ($c(a, 1, b), Mj(a, b));
}
function Wi(a, b) {
if (3 === a.tag) gk(a, a, b);else for (var c = a.return; null !== c;) {
if (3 === c.tag) {
gk(c, a, b);
break;
} else if (1 === c.tag) {
var d = c.stateNode;
if ("function" === typeof c.type.getDerivedStateFromError || "function" === typeof d.componentDidCatch && (null === Ti || !Ti.has(d))) {
a = Mi(b, a);
var e = Si(c, a, 1);
Ag(c, e);
e = Hg();
c = Kj(c, 1);
if (null !== c) $c(c, 1, e), Mj(c, e);else if ("function" === typeof d.componentDidCatch && (null === Ti || !Ti.has(d))) try {
d.componentDidCatch(b, a);
} catch (f) {}
break;
}
}
c = c.return;
}
}
function Yj(a, b, c) {
var d = a.pingCache;
null !== d && d.delete(b);
b = Hg();
a.pingedLanes |= a.suspendedLanes & c;
U === a && (W & c) === c && (4 === V || 3 === V && (W & 62914560) === W && 500 > O() - jj ? Qj(a, 0) : uj |= c);
Mj(a, b);
}
function lj(a, b) {
var c = a.stateNode;
null !== c && c.delete(b);
b = 0;
0 === b && (b = a.mode, 0 === (b & 2) ? b = 1 : 0 === (b & 4) ? b = 99 === eg() ? 1 : 2 : (0 === Gj && (Gj = tj), b = Yc(62914560 & ~Gj), 0 === b && (b = 4194304)));
c = Hg();
a = Kj(a, b);
null !== a && ($c(a, b, c), Mj(a, c));
}
var ck;
ck = function ck(a, b, c) {
var d = b.lanes;
if (null !== a) {
if (a.memoizedProps !== b.pendingProps || N.current) ug = !0;else if (0 !== (c & d)) ug = 0 !== (a.flags & 16384) ? !0 : !1;else {
ug = !1;
switch (b.tag) {
case 3:
ri(b);
sh();
break;
case 5:
gh(b);
break;
case 1:
Ff(b.type) && Jf(b);
break;
case 4:
eh(b, b.stateNode.containerInfo);
break;
case 10:
d = b.memoizedProps.value;
var e = b.type._context;
I(mg, e._currentValue);
e._currentValue = d;
break;
case 13:
if (null !== b.memoizedState) {
if (0 !== (c & b.child.childLanes)) return ti(a, b, c);
I(P, P.current & 1);
b = hi(a, b, c);
return null !== b ? b.sibling : null;
}
I(P, P.current & 1);
break;
case 19:
d = 0 !== (c & b.childLanes);
if (0 !== (a.flags & 64)) {
if (d) return Ai(a, b, c);
b.flags |= 64;
}
e = b.memoizedState;
null !== e && (e.rendering = null, e.tail = null, e.lastEffect = null);
I(P, P.current);
if (d) break;else return null;
case 23:
case 24:
return b.lanes = 0, mi(a, b, c);
}
return hi(a, b, c);
}
} else ug = !1;
b.lanes = 0;
switch (b.tag) {
case 2:
d = b.type;
null !== a && (a.alternate = null, b.alternate = null, b.flags |= 2);
a = b.pendingProps;
e = Ef(b, M.current);
tg(b, c);
e = Ch(null, b, d, a, e, c);
b.flags |= 1;
if ("object" === _typeof(e) && null !== e && "function" === typeof e.render && void 0 === e.$$typeof) {
b.tag = 1;
b.memoizedState = null;
b.updateQueue = null;
if (Ff(d)) {
var f = !0;
Jf(b);
} else f = !1;
b.memoizedState = null !== e.state && void 0 !== e.state ? e.state : null;
xg(b);
var g = d.getDerivedStateFromProps;
"function" === typeof g && Gg(b, d, g, a);
e.updater = Kg;
b.stateNode = e;
e._reactInternals = b;
Og(b, d, a, c);
b = qi(null, b, d, !0, f, c);
} else b.tag = 0, fi(null, b, e, c), b = b.child;
return b;
case 16:
e = b.elementType;
a: {
null !== a && (a.alternate = null, b.alternate = null, b.flags |= 2);
a = b.pendingProps;
f = e._init;
e = f(e._payload);
b.type = e;
f = b.tag = hk(e);
a = lg(e, a);
switch (f) {
case 0:
b = li(null, b, e, a, c);
break a;
case 1:
b = pi(null, b, e, a, c);
break a;
case 11:
b = gi(null, b, e, a, c);
break a;
case 14:
b = ii(null, b, e, lg(e.type, a), d, c);
break a;
}
throw Error(y(306, e, ""));
}
return b;
case 0:
return d = b.type, e = b.pendingProps, e = b.elementType === d ? e : lg(d, e), li(a, b, d, e, c);
case 1:
return d = b.type, e = b.pendingProps, e = b.elementType === d ? e : lg(d, e), pi(a, b, d, e, c);
case 3:
ri(b);
d = b.updateQueue;
if (null === a || null === d) throw Error(y(282));
d = b.pendingProps;
e = b.memoizedState;
e = null !== e ? e.element : null;
yg(a, b);
Cg(b, d, null, c);
d = b.memoizedState.element;
if (d === e) sh(), b = hi(a, b, c);else {
e = b.stateNode;
if (f = e.hydrate) kh = rf(b.stateNode.containerInfo.firstChild), jh = b, f = lh = !0;
if (f) {
a = e.mutableSourceEagerHydrationData;
if (null != a) for (e = 0; e < a.length; e += 2) {
f = a[e], f._workInProgressVersionPrimary = a[e + 1], th.push(f);
}
c = Zg(b, null, d, c);
for (b.child = c; c;) {
c.flags = c.flags & -3 | 1024, c = c.sibling;
}
} else fi(a, b, d, c), sh();
b = b.child;
}
return b;
case 5:
return gh(b), null === a && ph(b), d = b.type, e = b.pendingProps, f = null !== a ? a.memoizedProps : null, g = e.children, nf(d, e) ? g = null : null !== f && nf(d, f) && (b.flags |= 16), oi(a, b), fi(a, b, g, c), b.child;
case 6:
return null === a && ph(b), null;
case 13:
return ti(a, b, c);
case 4:
return eh(b, b.stateNode.containerInfo), d = b.pendingProps, null === a ? b.child = Yg(b, null, d, c) : fi(a, b, d, c), b.child;
case 11:
return d = b.type, e = b.pendingProps, e = b.elementType === d ? e : lg(d, e), gi(a, b, d, e, c);
case 7:
return fi(a, b, b.pendingProps, c), b.child;
case 8:
return fi(a, b, b.pendingProps.children, c), b.child;
case 12:
return fi(a, b, b.pendingProps.children, c), b.child;
case 10:
a: {
d = b.type._context;
e = b.pendingProps;
g = b.memoizedProps;
f = e.value;
var h = b.type._context;
I(mg, h._currentValue);
h._currentValue = f;
if (null !== g) if (h = g.value, f = He(h, f) ? 0 : ("function" === typeof d._calculateChangedBits ? d._calculateChangedBits(h, f) : 1073741823) | 0, 0 === f) {
if (g.children === e.children && !N.current) {
b = hi(a, b, c);
break a;
}
} else for (h = b.child, null !== h && (h.return = b); null !== h;) {
var k = h.dependencies;
if (null !== k) {
g = h.child;
for (var l = k.firstContext; null !== l;) {
if (l.context === d && 0 !== (l.observedBits & f)) {
1 === h.tag && (l = zg(-1, c & -c), l.tag = 2, Ag(h, l));
h.lanes |= c;
l = h.alternate;
null !== l && (l.lanes |= c);
sg(h.return, c);
k.lanes |= c;
break;
}
l = l.next;
}
} else g = 10 === h.tag ? h.type === b.type ? null : h.child : h.child;
if (null !== g) g.return = h;else for (g = h; null !== g;) {
if (g === b) {
g = null;
break;
}
h = g.sibling;
if (null !== h) {
h.return = g.return;
g = h;
break;
}
g = g.return;
}
h = g;
}
fi(a, b, e.children, c);
b = b.child;
}
return b;
case 9:
return e = b.type, f = b.pendingProps, d = f.children, tg(b, c), e = vg(e, f.unstable_observedBits), d = d(e), b.flags |= 1, fi(a, b, d, c), b.child;
case 14:
return e = b.type, f = lg(e, b.pendingProps), f = lg(e.type, f), ii(a, b, e, f, d, c);
case 15:
return ki(a, b, b.type, b.pendingProps, d, c);
case 17:
return d = b.type, e = b.pendingProps, e = b.elementType === d ? e : lg(d, e), null !== a && (a.alternate = null, b.alternate = null, b.flags |= 2), b.tag = 1, Ff(d) ? (a = !0, Jf(b)) : a = !1, tg(b, c), Mg(b, d, e), Og(b, d, e, c), qi(null, b, d, !0, a, c);
case 19:
return Ai(a, b, c);
case 23:
return mi(a, b, c);
case 24:
return mi(a, b, c);
}
throw Error(y(156, b.tag));
};
function ik(a, b, c, d) {
this.tag = a;
this.key = c;
this.sibling = this.child = this.return = this.stateNode = this.type = this.elementType = null;
this.index = 0;
this.ref = null;
this.pendingProps = b;
this.dependencies = this.memoizedState = this.updateQueue = this.memoizedProps = null;
this.mode = d;
this.flags = 0;
this.lastEffect = this.firstEffect = this.nextEffect = null;
this.childLanes = this.lanes = 0;
this.alternate = null;
}
function nh(a, b, c, d) {
return new ik(a, b, c, d);
}
function ji(a) {
a = a.prototype;
return !(!a || !a.isReactComponent);
}
function hk(a) {
if ("function" === typeof a) return ji(a) ? 1 : 0;
if (void 0 !== a && null !== a) {
a = a.$$typeof;
if (a === Aa) return 11;
if (a === Da) return 14;
}
return 2;
}
function Tg(a, b) {
var c = a.alternate;
null === c ? (c = nh(a.tag, b, a.key, a.mode), c.elementType = a.elementType, c.type = a.type, c.stateNode = a.stateNode, c.alternate = a, a.alternate = c) : (c.pendingProps = b, c.type = a.type, c.flags = 0, c.nextEffect = null, c.firstEffect = null, c.lastEffect = null);
c.childLanes = a.childLanes;
c.lanes = a.lanes;
c.child = a.child;
c.memoizedProps = a.memoizedProps;
c.memoizedState = a.memoizedState;
c.updateQueue = a.updateQueue;
b = a.dependencies;
c.dependencies = null === b ? null : {
lanes: b.lanes,
firstContext: b.firstContext
};
c.sibling = a.sibling;
c.index = a.index;
c.ref = a.ref;
return c;
}
function Vg(a, b, c, d, e, f) {
var g = 2;
d = a;
if ("function" === typeof a) ji(a) && (g = 1);else if ("string" === typeof a) g = 5;else a: switch (a) {
case ua:
return Xg(c.children, e, f, b);
case Ha:
g = 8;
e |= 16;
break;
case wa:
g = 8;
e |= 1;
break;
case xa:
return a = nh(12, c, b, e | 8), a.elementType = xa, a.type = xa, a.lanes = f, a;
case Ba:
return a = nh(13, c, b, e), a.type = Ba, a.elementType = Ba, a.lanes = f, a;
case Ca:
return a = nh(19, c, b, e), a.elementType = Ca, a.lanes = f, a;
case Ia:
return vi(c, e, f, b);
case Ja:
return a = nh(24, c, b, e), a.elementType = Ja, a.lanes = f, a;
default:
if ("object" === _typeof(a) && null !== a) switch (a.$$typeof) {
case ya:
g = 10;
break a;
case za:
g = 9;
break a;
case Aa:
g = 11;
break a;
case Da:
g = 14;
break a;
case Ea:
g = 16;
d = null;
break a;
case Fa:
g = 22;
break a;
}
throw Error(y(130, null == a ? a : _typeof(a), ""));
}
b = nh(g, c, b, e);
b.elementType = a;
b.type = d;
b.lanes = f;
return b;
}
function Xg(a, b, c, d) {
a = nh(7, a, d, b);
a.lanes = c;
return a;
}
function vi(a, b, c, d) {
a = nh(23, a, d, b);
a.elementType = Ia;
a.lanes = c;
return a;
}
function Ug(a, b, c) {
a = nh(6, a, null, b);
a.lanes = c;
return a;
}
function Wg(a, b, c) {
b = nh(4, null !== a.children ? a.children : [], a.key, b);
b.lanes = c;
b.stateNode = {
containerInfo: a.containerInfo,
pendingChildren: null,
implementation: a.implementation
};
return b;
}
function jk(a, b, c) {
this.tag = b;
this.containerInfo = a;
this.finishedWork = this.pingCache = this.current = this.pendingChildren = null;
this.timeoutHandle = -1;
this.pendingContext = this.context = null;
this.hydrate = c;
this.callbackNode = null;
this.callbackPriority = 0;
this.eventTimes = Zc(0);
this.expirationTimes = Zc(-1);
this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.expiredLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0;
this.entanglements = Zc(0);
this.mutableSourceEagerHydrationData = null;
}
function kk(a, b, c) {
var d = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null;
return {
$$typeof: ta,
key: null == d ? null : "" + d,
children: a,
containerInfo: b,
implementation: c
};
}
function lk(a, b, c, d) {
var e = b.current,
f = Hg(),
g = Ig(e);
a: if (c) {
c = c._reactInternals;
b: {
if (Zb(c) !== c || 1 !== c.tag) throw Error(y(170));
var h = c;
do {
switch (h.tag) {
case 3:
h = h.stateNode.context;
break b;
case 1:
if (Ff(h.type)) {
h = h.stateNode.__reactInternalMemoizedMergedChildContext;
break b;
}
}
h = h.return;
} while (null !== h);
throw Error(y(171));
}
if (1 === c.tag) {
var k = c.type;
if (Ff(k)) {
c = If(c, k, h);
break a;
}
}
c = h;
} else c = Cf;
null === b.context ? b.context = c : b.pendingContext = c;
b = zg(f, g);
b.payload = {
element: a
};
d = void 0 === d ? null : d;
null !== d && (b.callback = d);
Ag(e, b);
Jg(e, g, f);
return g;
}
function mk(a) {
a = a.current;
if (!a.child) return null;
switch (a.child.tag) {
case 5:
return a.child.stateNode;
default:
return a.child.stateNode;
}
}
function nk(a, b) {
a = a.memoizedState;
if (null !== a && null !== a.dehydrated) {
var c = a.retryLane;
a.retryLane = 0 !== c && c < b ? c : b;
}
}
function ok(a, b) {
nk(a, b);
(a = a.alternate) && nk(a, b);
}
function pk() {
return null;
}
function qk(a, b, c) {
var d = null != c && null != c.hydrationOptions && c.hydrationOptions.mutableSources || null;
c = new jk(a, b, null != c && !0 === c.hydrate);
b = nh(3, null, null, 2 === b ? 7 : 1 === b ? 3 : 0);
c.current = b;
b.stateNode = c;
xg(b);
a[ff] = c.current;
cf(8 === a.nodeType ? a.parentNode : a);
if (d) for (a = 0; a < d.length; a++) {
b = d[a];
var e = b._getVersion;
e = e(b._source);
null == c.mutableSourceEagerHydrationData ? c.mutableSourceEagerHydrationData = [b, e] : c.mutableSourceEagerHydrationData.push(b, e);
}
this._internalRoot = c;
}
qk.prototype.render = function (a) {
lk(a, this._internalRoot, null, null);
};
qk.prototype.unmount = function () {
var a = this._internalRoot,
b = a.containerInfo;
lk(null, a, null, function () {
b[ff] = null;
});
};
function rk(a) {
return !(!a || 1 !== a.nodeType && 9 !== a.nodeType && 11 !== a.nodeType && (8 !== a.nodeType || " react-mount-point-unstable " !== a.nodeValue));
}
function sk(a, b) {
b || (b = a ? 9 === a.nodeType ? a.documentElement : a.firstChild : null, b = !(!b || 1 !== b.nodeType || !b.hasAttribute("data-reactroot")));
if (!b) for (var c; c = a.lastChild;) {
a.removeChild(c);
}
return new qk(a, 0, b ? {
hydrate: !0
} : void 0);
}
function tk(a, b, c, d, e) {
var f = c._reactRootContainer;
if (f) {
var g = f._internalRoot;
if ("function" === typeof e) {
var h = e;
e = function e() {
var a = mk(g);
h.call(a);
};
}
lk(b, g, a, e);
} else {
f = c._reactRootContainer = sk(c, d);
g = f._internalRoot;
if ("function" === typeof e) {
var k = e;
e = function e() {
var a = mk(g);
k.call(a);
};
}
Xj(function () {
lk(b, g, a, e);
});
}
return mk(g);
}
ec = function ec(a) {
if (13 === a.tag) {
var b = Hg();
Jg(a, 4, b);
ok(a, 4);
}
};
fc = function fc(a) {
if (13 === a.tag) {
var b = Hg();
Jg(a, 67108864, b);
ok(a, 67108864);
}
};
gc = function gc(a) {
if (13 === a.tag) {
var b = Hg(),
c = Ig(a);
Jg(a, c, b);
ok(a, c);
}
};
hc = function hc(a, b) {
return b();
};
yb = function yb(a, b, c) {
switch (b) {
case "input":
ab(a, c);
b = c.name;
if ("radio" === c.type && null != b) {
for (c = a; c.parentNode;) {
c = c.parentNode;
}
c = c.querySelectorAll("input[name=" + JSON.stringify("" + b) + '][type="radio"]');
for (b = 0; b < c.length; b++) {
var d = c[b];
if (d !== a && d.form === a.form) {
var e = Db(d);
if (!e) throw Error(y(90));
Wa(d);
ab(d, e);
}
}
}
break;
case "textarea":
ib(a, c);
break;
case "select":
b = c.value, null != b && fb(a, !!c.multiple, b, !1);
}
};
Gb = Wj;
Hb = function Hb(a, b, c, d, e) {
var f = X;
X |= 4;
try {
return gg(98, a.bind(null, b, c, d, e));
} finally {
X = f, 0 === X && (wj(), ig());
}
};
Ib = function Ib() {
0 === (X & 49) && (Vj(), Oj());
};
Jb = function Jb(a, b) {
var c = X;
X |= 2;
try {
return a(b);
} finally {
X = c, 0 === X && (wj(), ig());
}
};
function uk(a, b) {
var c = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null;
if (!rk(b)) throw Error(y(200));
return kk(a, b, null, c);
}
var vk = {
Events: [Cb, ue, Db, Eb, Fb, Oj, {
current: !1
}]
},
wk = {
findFiberByHostInstance: wc,
bundleType: 0,
version: "17.0.2",
rendererPackageName: "react-dom"
};
var xk = {
bundleType: wk.bundleType,
version: wk.version,
rendererPackageName: wk.rendererPackageName,
rendererConfig: wk.rendererConfig,
overrideHookState: null,
overrideHookStateDeletePath: null,
overrideHookStateRenamePath: null,
overrideProps: null,
overridePropsDeletePath: null,
overridePropsRenamePath: null,
setSuspenseHandler: null,
scheduleUpdate: null,
currentDispatcherRef: ra.ReactCurrentDispatcher,
findHostInstanceByFiber: function findHostInstanceByFiber(a) {
a = cc(a);
return null === a ? null : a.stateNode;
},
findFiberByHostInstance: wk.findFiberByHostInstance || pk,
findHostInstancesForRefresh: null,
scheduleRefresh: null,
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var yk = __REACT_DEVTOOLS_GLOBAL_HOOK__;
if (!yk.isDisabled && yk.supportsFiber) try {
Lf = yk.inject(xk), Mf = yk;
} catch (a) {}
}
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = vk;
exports.createPortal = uk;
exports.findDOMNode = function (a) {
if (null == a) return null;
if (1 === a.nodeType) return a;
var b = a._reactInternals;
if (void 0 === b) {
if ("function" === typeof a.render) throw Error(y(188));
throw Error(y(268, Object.keys(a)));
}
a = cc(b);
a = null === a ? null : a.stateNode;
return a;
};
exports.flushSync = function (a, b) {
var c = X;
if (0 !== (c & 48)) return a(b);
X |= 1;
try {
if (a) return gg(99, a.bind(null, b));
} finally {
X = c, ig();
}
};
exports.hydrate = function (a, b, c) {
if (!rk(b)) throw Error(y(200));
return tk(null, a, b, !0, c);
};
exports.render = function (a, b, c) {
if (!rk(b)) throw Error(y(200));
return tk(null, a, b, !1, c);
};
exports.unmountComponentAtNode = function (a) {
if (!rk(a)) throw Error(y(40));
return a._reactRootContainer ? (Xj(function () {
tk(null, null, a, !1, function () {
a._reactRootContainer = null;
a[ff] = null;
});
}), !0) : !1;
};
exports.unstable_batchedUpdates = Wj;
exports.unstable_createPortal = function (a, b) {
return uk(a, b, 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null);
};
exports.unstable_renderSubtreeIntoContainer = function (a, b, c, d) {
if (!rk(c)) throw Error(y(200));
if (null == a || void 0 === a._reactInternals) throw Error(y(38));
return tk(a, b, c, !1, d);
};
exports.version = "17.0.2";
/***/ }),
/* 23 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/** @license React v17.0.2
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var l = __webpack_require__(9),
n = 60103,
p = 60106;
exports.Fragment = 60107;
exports.StrictMode = 60108;
exports.Profiler = 60114;
var q = 60109,
r = 60110,
t = 60112;
exports.Suspense = 60113;
var u = 60115,
v = 60116;
if ("function" === typeof Symbol && Symbol.for) {
var w = Symbol.for;
n = w("react.element");
p = w("react.portal");
exports.Fragment = w("react.fragment");
exports.StrictMode = w("react.strict_mode");
exports.Profiler = w("react.profiler");
q = w("react.provider");
r = w("react.context");
t = w("react.forward_ref");
exports.Suspense = w("react.suspense");
u = w("react.memo");
v = w("react.lazy");
}
var x = "function" === typeof Symbol && Symbol.iterator;
function y(a) {
if (null === a || "object" !== _typeof(a)) return null;
a = x && a[x] || a["@@iterator"];
return "function" === typeof a ? a : null;
}
function z(a) {
for (var b = "https://reactjs.org/docs/error-decoder.html?invariant=" + a, c = 1; c < arguments.length; c++) {
b += "&args[]=" + encodeURIComponent(arguments[c]);
}
return "Minified React error #" + a + "; visit " + b + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings.";
}
var A = {
isMounted: function isMounted() {
return !1;
},
enqueueForceUpdate: function enqueueForceUpdate() {},
enqueueReplaceState: function enqueueReplaceState() {},
enqueueSetState: function enqueueSetState() {}
},
B = {};
function C(a, b, c) {
this.props = a;
this.context = b;
this.refs = B;
this.updater = c || A;
}
C.prototype.isReactComponent = {};
C.prototype.setState = function (a, b) {
if ("object" !== _typeof(a) && "function" !== typeof a && null != a) throw Error(z(85));
this.updater.enqueueSetState(this, a, b, "setState");
};
C.prototype.forceUpdate = function (a) {
this.updater.enqueueForceUpdate(this, a, "forceUpdate");
};
function D() {}
D.prototype = C.prototype;
function E(a, b, c) {
this.props = a;
this.context = b;
this.refs = B;
this.updater = c || A;
}
var F = E.prototype = new D();
F.constructor = E;
l(F, C.prototype);
F.isPureReactComponent = !0;
var G = {
current: null
},
H = Object.prototype.hasOwnProperty,
I = {
key: !0,
ref: !0,
__self: !0,
__source: !0
};
function J(a, b, c) {
var e,
d = {},
k = null,
h = null;
if (null != b) for (e in void 0 !== b.ref && (h = b.ref), void 0 !== b.key && (k = "" + b.key), b) {
H.call(b, e) && !I.hasOwnProperty(e) && (d[e] = b[e]);
}
var g = arguments.length - 2;
if (1 === g) d.children = c;else if (1 < g) {
for (var f = Array(g), m = 0; m < g; m++) {
f[m] = arguments[m + 2];
}
d.children = f;
}
if (a && a.defaultProps) for (e in g = a.defaultProps, g) {
void 0 === d[e] && (d[e] = g[e]);
}
return {
$$typeof: n,
type: a,
key: k,
ref: h,
props: d,
_owner: G.current
};
}
function K(a, b) {
return {
$$typeof: n,
type: a.type,
key: b,
ref: a.ref,
props: a.props,
_owner: a._owner
};
}
function L(a) {
return "object" === _typeof(a) && null !== a && a.$$typeof === n;
}
function escape(a) {
var b = {
"=": "=0",
":": "=2"
};
return "$" + a.replace(/[=:]/g, function (a) {
return b[a];
});
}
var M = /\/+/g;
function N(a, b) {
return "object" === _typeof(a) && null !== a && null != a.key ? escape("" + a.key) : b.toString(36);
}
function O(a, b, c, e, d) {
var k = _typeof(a);
if ("undefined" === k || "boolean" === k) a = null;
var h = !1;
if (null === a) h = !0;else switch (k) {
case "string":
case "number":
h = !0;
break;
case "object":
switch (a.$$typeof) {
case n:
case p:
h = !0;
}
}
if (h) return h = a, d = d(h), a = "" === e ? "." + N(h, 0) : e, Array.isArray(d) ? (c = "", null != a && (c = a.replace(M, "$&/") + "/"), O(d, b, c, "", function (a) {
return a;
})) : null != d && (L(d) && (d = K(d, c + (!d.key || h && h.key === d.key ? "" : ("" + d.key).replace(M, "$&/") + "/") + a)), b.push(d)), 1;
h = 0;
e = "" === e ? "." : e + ":";
if (Array.isArray(a)) for (var g = 0; g < a.length; g++) {
k = a[g];
var f = e + N(k, g);
h += O(k, b, c, f, d);
} else if (f = y(a), "function" === typeof f) for (a = f.call(a), g = 0; !(k = a.next()).done;) {
k = k.value, f = e + N(k, g++), h += O(k, b, c, f, d);
} else if ("object" === k) throw b = "" + a, Error(z(31, "[object Object]" === b ? "object with keys {" + Object.keys(a).join(", ") + "}" : b));
return h;
}
function P(a, b, c) {
if (null == a) return a;
var e = [],
d = 0;
O(a, e, "", "", function (a) {
return b.call(c, a, d++);
});
return e;
}
function Q(a) {
if (-1 === a._status) {
var b = a._result;
b = b();
a._status = 0;
a._result = b;
b.then(function (b) {
0 === a._status && (b = b.default, a._status = 1, a._result = b);
}, function (b) {
0 === a._status && (a._status = 2, a._result = b);
});
}
if (1 === a._status) return a._result;
throw a._result;
}
var R = {
current: null
};
function S() {
var a = R.current;
if (null === a) throw Error(z(321));
return a;
}
var T = {
ReactCurrentDispatcher: R,
ReactCurrentBatchConfig: {
transition: 0
},
ReactCurrentOwner: G,
IsSomeRendererActing: {
current: !1
},
assign: l
};
exports.Children = {
map: P,
forEach: function forEach(a, b, c) {
P(a, function () {
b.apply(this, arguments);
}, c);
},
count: function count(a) {
var b = 0;
P(a, function () {
b++;
});
return b;
},
toArray: function toArray(a) {
return P(a, function (a) {
return a;
}) || [];
},
only: function only(a) {
if (!L(a)) throw Error(z(143));
return a;
}
};
exports.Component = C;
exports.PureComponent = E;
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = T;
exports.cloneElement = function (a, b, c) {
if (null === a || void 0 === a) throw Error(z(267, a));
var e = l({}, a.props),
d = a.key,
k = a.ref,
h = a._owner;
if (null != b) {
void 0 !== b.ref && (k = b.ref, h = G.current);
void 0 !== b.key && (d = "" + b.key);
if (a.type && a.type.defaultProps) var g = a.type.defaultProps;
for (f in b) {
H.call(b, f) && !I.hasOwnProperty(f) && (e[f] = void 0 === b[f] && void 0 !== g ? g[f] : b[f]);
}
}
var f = arguments.length - 2;
if (1 === f) e.children = c;else if (1 < f) {
g = Array(f);
for (var m = 0; m < f; m++) {
g[m] = arguments[m + 2];
}
e.children = g;
}
return {
$$typeof: n,
type: a.type,
key: d,
ref: k,
props: e,
_owner: h
};
};
exports.createContext = function (a, b) {
void 0 === b && (b = null);
a = {
$$typeof: r,
_calculateChangedBits: b,
_currentValue: a,
_currentValue2: a,
_threadCount: 0,
Provider: null,
Consumer: null
};
a.Provider = {
$$typeof: q,
_context: a
};
return a.Consumer = a;
};
exports.createElement = J;
exports.createFactory = function (a) {
var b = J.bind(null, a);
b.type = a;
return b;
};
exports.createRef = function () {
return {
current: null
};
};
exports.forwardRef = function (a) {
return {
$$typeof: t,
render: a
};
};
exports.isValidElement = L;
exports.lazy = function (a) {
return {
$$typeof: v,
_payload: {
_status: -1,
_result: a
},
_init: Q
};
};
exports.memo = function (a, b) {
return {
$$typeof: u,
type: a,
compare: void 0 === b ? null : b
};
};
exports.useCallback = function (a, b) {
return S().useCallback(a, b);
};
exports.useContext = function (a, b) {
return S().useContext(a, b);
};
exports.useDebugValue = function () {};
exports.useEffect = function (a, b) {
return S().useEffect(a, b);
};
exports.useImperativeHandle = function (a, b, c) {
return S().useImperativeHandle(a, b, c);
};
exports.useLayoutEffect = function (a, b) {
return S().useLayoutEffect(a, b);
};
exports.useMemo = function (a, b) {
return S().useMemo(a, b);
};
exports.useReducer = function (a, b, c) {
return S().useReducer(a, b, c);
};
exports.useRef = function (a) {
return S().useRef(a);
};
exports.useState = function (a) {
return S().useState(a);
};
exports.version = "17.0.2";
/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
if (true) {
module.exports = __webpack_require__(25);
} else {}
/***/ }),
/* 25 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/** @license React v0.20.2
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var _f, g, h, k;
if ("object" === (typeof performance === "undefined" ? "undefined" : _typeof(performance)) && "function" === typeof performance.now) {
var l = performance;
exports.unstable_now = function () {
return l.now();
};
} else {
var p = Date,
q = p.now();
exports.unstable_now = function () {
return p.now() - q;
};
}
if ("undefined" === typeof window || "function" !== typeof MessageChannel) {
var t = null,
u = null,
w = function w() {
if (null !== t) try {
var a = exports.unstable_now();
t(!0, a);
t = null;
} catch (b) {
throw setTimeout(w, 0), b;
}
};
_f = function f(a) {
null !== t ? setTimeout(_f, 0, a) : (t = a, setTimeout(w, 0));
};
g = function g(a, b) {
u = setTimeout(a, b);
};
h = function h() {
clearTimeout(u);
};
exports.unstable_shouldYield = function () {
return !1;
};
k = exports.unstable_forceFrameRate = function () {};
} else {
var x = window.setTimeout,
y = window.clearTimeout;
if ("undefined" !== typeof console) {
var z = window.cancelAnimationFrame;
"function" !== typeof window.requestAnimationFrame && console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills");
"function" !== typeof z && console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills");
}
var A = !1,
B = null,
C = -1,
D = 5,
E = 0;
exports.unstable_shouldYield = function () {
return exports.unstable_now() >= E;
};
k = function k() {};
exports.unstable_forceFrameRate = function (a) {
0 > a || 125 < a ? console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported") : D = 0 < a ? Math.floor(1E3 / a) : 5;
};
var F = new MessageChannel(),
G = F.port2;
F.port1.onmessage = function () {
if (null !== B) {
var a = exports.unstable_now();
E = a + D;
try {
B(!0, a) ? G.postMessage(null) : (A = !1, B = null);
} catch (b) {
throw G.postMessage(null), b;
}
} else A = !1;
};
_f = function _f(a) {
B = a;
A || (A = !0, G.postMessage(null));
};
g = function g(a, b) {
C = x(function () {
a(exports.unstable_now());
}, b);
};
h = function h() {
y(C);
C = -1;
};
}
function H(a, b) {
var c = a.length;
a.push(b);
a: for (;;) {
var d = c - 1 >>> 1,
e = a[d];
if (void 0 !== e && 0 < I(e, b)) a[d] = b, a[c] = e, c = d;else break a;
}
}
function J(a) {
a = a[0];
return void 0 === a ? null : a;
}
function K(a) {
var b = a[0];
if (void 0 !== b) {
var c = a.pop();
if (c !== b) {
a[0] = c;
a: for (var d = 0, e = a.length; d < e;) {
var m = 2 * (d + 1) - 1,
n = a[m],
v = m + 1,
r = a[v];
if (void 0 !== n && 0 > I(n, c)) void 0 !== r && 0 > I(r, n) ? (a[d] = r, a[v] = c, d = v) : (a[d] = n, a[m] = c, d = m);else if (void 0 !== r && 0 > I(r, c)) a[d] = r, a[v] = c, d = v;else break a;
}
}
return b;
}
return null;
}
function I(a, b) {
var c = a.sortIndex - b.sortIndex;
return 0 !== c ? c : a.id - b.id;
}
var L = [],
M = [],
N = 1,
O = null,
P = 3,
Q = !1,
R = !1,
S = !1;
function T(a) {
for (var b = J(M); null !== b;) {
if (null === b.callback) K(M);else if (b.startTime <= a) K(M), b.sortIndex = b.expirationTime, H(L, b);else break;
b = J(M);
}
}
function U(a) {
S = !1;
T(a);
if (!R) if (null !== J(L)) R = !0, _f(V);else {
var b = J(M);
null !== b && g(U, b.startTime - a);
}
}
function V(a, b) {
R = !1;
S && (S = !1, h());
Q = !0;
var c = P;
try {
T(b);
for (O = J(L); null !== O && (!(O.expirationTime > b) || a && !exports.unstable_shouldYield());) {
var d = O.callback;
if ("function" === typeof d) {
O.callback = null;
P = O.priorityLevel;
var e = d(O.expirationTime <= b);
b = exports.unstable_now();
"function" === typeof e ? O.callback = e : O === J(L) && K(L);
T(b);
} else K(L);
O = J(L);
}
if (null !== O) var m = !0;else {
var n = J(M);
null !== n && g(U, n.startTime - b);
m = !1;
}
return m;
} finally {
O = null, P = c, Q = !1;
}
}
var W = k;
exports.unstable_IdlePriority = 5;
exports.unstable_ImmediatePriority = 1;
exports.unstable_LowPriority = 4;
exports.unstable_NormalPriority = 3;
exports.unstable_Profiling = null;
exports.unstable_UserBlockingPriority = 2;
exports.unstable_cancelCallback = function (a) {
a.callback = null;
};
exports.unstable_continueExecution = function () {
R || Q || (R = !0, _f(V));
};
exports.unstable_getCurrentPriorityLevel = function () {
return P;
};
exports.unstable_getFirstCallbackNode = function () {
return J(L);
};
exports.unstable_next = function (a) {
switch (P) {
case 1:
case 2:
case 3:
var b = 3;
break;
default:
b = P;
}
var c = P;
P = b;
try {
return a();
} finally {
P = c;
}
};
exports.unstable_pauseExecution = function () {};
exports.unstable_requestPaint = W;
exports.unstable_runWithPriority = function (a, b) {
switch (a) {
case 1:
case 2:
case 3:
case 4:
case 5:
break;
default:
a = 3;
}
var c = P;
P = a;
try {
return b();
} finally {
P = c;
}
};
exports.unstable_scheduleCallback = function (a, b, c) {
var d = exports.unstable_now();
"object" === _typeof(c) && null !== c ? (c = c.delay, c = "number" === typeof c && 0 < c ? d + c : d) : c = d;
switch (a) {
case 1:
var e = -1;
break;
case 2:
e = 250;
break;
case 5:
e = 1073741823;
break;
case 4:
e = 1E4;
break;
default:
e = 5E3;
}
e = c + e;
a = {
id: N++,
callback: b,
priorityLevel: a,
startTime: c,
expirationTime: e,
sortIndex: -1
};
c > d ? (a.sortIndex = c, H(M, a), null === J(L) && a === J(M) && (S ? h() : S = !0, g(U, c - d))) : (a.sortIndex = e, H(L, a), R || Q || (R = !0, _f(V)));
return a;
};
exports.unstable_wrapCallback = function (a) {
var b = P;
return function () {
var c = P;
P = b;
try {
return a.apply(this, arguments);
} finally {
P = c;
}
};
};
/***/ }),
/* 26 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var b = "function" === typeof Symbol && Symbol.for,
c = b ? Symbol.for("react.element") : 60103,
d = b ? Symbol.for("react.portal") : 60106,
e = b ? Symbol.for("react.fragment") : 60107,
f = b ? Symbol.for("react.strict_mode") : 60108,
g = b ? Symbol.for("react.profiler") : 60114,
h = b ? Symbol.for("react.provider") : 60109,
k = b ? Symbol.for("react.context") : 60110,
l = b ? Symbol.for("react.async_mode") : 60111,
m = b ? Symbol.for("react.concurrent_mode") : 60111,
n = b ? Symbol.for("react.forward_ref") : 60112,
p = b ? Symbol.for("react.suspense") : 60113,
q = b ? Symbol.for("react.suspense_list") : 60120,
r = b ? Symbol.for("react.memo") : 60115,
t = b ? Symbol.for("react.lazy") : 60116,
v = b ? Symbol.for("react.block") : 60121,
w = b ? Symbol.for("react.fundamental") : 60117,
x = b ? Symbol.for("react.responder") : 60118,
y = b ? Symbol.for("react.scope") : 60119;
function z(a) {
if ("object" === _typeof(a) && null !== a) {
var u = a.$$typeof;
switch (u) {
case c:
switch (a = a.type, a) {
case l:
case m:
case e:
case g:
case f:
case p:
return a;
default:
switch (a = a && a.$$typeof, a) {
case k:
case n:
case t:
case r:
case h:
return a;
default:
return u;
}
}
case d:
return u;
}
}
}
function A(a) {
return z(a) === m;
}
exports.AsyncMode = l;
exports.ConcurrentMode = m;
exports.ContextConsumer = k;
exports.ContextProvider = h;
exports.Element = c;
exports.ForwardRef = n;
exports.Fragment = e;
exports.Lazy = t;
exports.Memo = r;
exports.Portal = d;
exports.Profiler = g;
exports.StrictMode = f;
exports.Suspense = p;
exports.isAsyncMode = function (a) {
return A(a) || z(a) === l;
};
exports.isConcurrentMode = A;
exports.isContextConsumer = function (a) {
return z(a) === k;
};
exports.isContextProvider = function (a) {
return z(a) === h;
};
exports.isElement = function (a) {
return "object" === _typeof(a) && null !== a && a.$$typeof === c;
};
exports.isForwardRef = function (a) {
return z(a) === n;
};
exports.isFragment = function (a) {
return z(a) === e;
};
exports.isLazy = function (a) {
return z(a) === t;
};
exports.isMemo = function (a) {
return z(a) === r;
};
exports.isPortal = function (a) {
return z(a) === d;
};
exports.isProfiler = function (a) {
return z(a) === g;
};
exports.isStrictMode = function (a) {
return z(a) === f;
};
exports.isSuspense = function (a) {
return z(a) === p;
};
exports.isValidElementType = function (a) {
return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === _typeof(a) && null !== a && (a.$$typeof === t || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
};
exports.typeOf = z;
/***/ }),
/* 27 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/** @license React v17.0.2
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
__webpack_require__(9);
var f = __webpack_require__(2),
g = 60103;
exports.Fragment = 60107;
if ("function" === typeof Symbol && Symbol.for) {
var h = Symbol.for;
g = h("react.element");
exports.Fragment = h("react.fragment");
}
var m = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,
n = Object.prototype.hasOwnProperty,
p = {
key: !0,
ref: !0,
__self: !0,
__source: !0
};
function q(c, a, k) {
var b,
d = {},
e = null,
l = null;
void 0 !== k && (e = "" + k);
void 0 !== a.key && (e = "" + a.key);
void 0 !== a.ref && (l = a.ref);
for (b in a) {
n.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
}
if (c && c.defaultProps) for (b in a = c.defaultProps, a) {
void 0 === d[b] && (d[b] = a[b]);
}
return {
$$typeof: g,
type: c,
key: e,
ref: l,
props: d,
_owner: m.current
};
}
exports.jsx = q;
exports.jsxs = q;
/***/ }),
/* 28 */
/***/ (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 get() {
return module.l;
}
});
Object.defineProperty(module, "id", {
enumerable: true,
get: function get() {
return module.i;
}
});
module.webpackPolyfill = 1;
}
return module;
};
/***/ }),
/* 29 */
/***/ (function(module, exports) {
/* WEBPACK VAR INJECTION */(function(__webpack_amd_options__) {/* globals __webpack_amd_options__ */
module.exports = __webpack_amd_options__;
/* WEBPACK VAR INJECTION */}.call(this, {}))
/***/ }),
/* 30 */
/***/ (function(module, exports, __webpack_require__) {
var rng = __webpack_require__(31);
var bytesToUuid = __webpack_require__(32);
function v4(options, buf, offset) {
var i = buf && offset || 0;
if (typeof options == 'string') {
buf = options === 'binary' ? new Array(16) : null;
options = null;
}
options = options || {};
var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
rnds[6] = rnds[6] & 0x0f | 0x40;
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
if (buf) {
for (var ii = 0; ii < 16; ++ii) {
buf[i + ii] = rnds[ii];
}
}
return buf || bytesToUuid(rnds);
}
module.exports = v4;
/***/ }),
/* 31 */
/***/ (function(module, exports) {
// Unique ID creation requires a high quality random # generator. In the
// browser this is a little complicated due to unknown quality of Math.random()
// and inconsistent support for the `crypto` API. We do the best we can via
// feature-detection
// getRandomValues needs to be invoked in a context where "this" is a Crypto
// implementation. Also, find the complete implementation of crypto on IE11.
var getRandomValues = typeof crypto != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto);
if (getRandomValues) {
// WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
module.exports = function whatwgRNG() {
getRandomValues(rnds8);
return rnds8;
};
} else {
// Math.random()-based (RNG)
//
// If all else fails, use Math.random(). It's fast, but is of unspecified
// quality.
var rnds = new Array(16);
module.exports = function mathRNG() {
for (var i = 0, r; i < 16; i++) {
if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
}
return rnds;
};
}
/***/ }),
/* 32 */
/***/ (function(module, exports) {
/**
* Convert array of 16 byte values to UUID string format of the form:
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
*/
var byteToHex = [];
for (var i = 0; i < 256; ++i) {
byteToHex[i] = (i + 0x100).toString(16).substr(1);
}
function bytesToUuid(buf, offset) {
var i = offset || 0;
var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join('');
}
module.exports = bytesToUuid;
/***/ }),
/* 33 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(Buffer) {
function _extends() { _extends = Object.assign || 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; }; return _extends.apply(this, arguments); }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
var toBytes = function toBytes(s) {
return _toConsumableArray(s).map(function (c) {
return c.charCodeAt(0);
});
};
var xpiZipFilename = toBytes('META-INF/mozilla.rsa');
var oxmlContentTypes = toBytes('[Content_Types].xml');
var oxmlRels = toBytes('_rels/.rels');
function readUInt64LE(buf) {
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var n = buf[offset];
var mul = 1;
var i = 0;
while (++i < 8) {
mul *= 0x100;
n += buf[offset + i] * mul;
}
return n;
}
var fileType = function fileType(input) {
if (!(input instanceof Uint8Array || input instanceof ArrayBuffer || Buffer.isBuffer(input))) {
throw new TypeError("Expected the `input` argument to be of type `Uint8Array` or `Buffer` or `ArrayBuffer`, got `".concat(_typeof(input), "`"));
}
var buf = input instanceof Uint8Array ? input : new Uint8Array(input);
if (!(buf && buf.length > 1)) {
return null;
}
var check = function check(header, options) {
options = _extends({
offset: 0
}, options);
for (var i = 0; i < header.length; i++) {
// If a bitmask is set
if (options.mask) {
// If header doesn't equal `buf` with bits masked off
if (header[i] !== (options.mask[i] & buf[i + options.offset])) {
return false;
}
} else if (header[i] !== buf[i + options.offset]) {
return false;
}
}
return true;
};
var checkString = function checkString(header, options) {
return check(toBytes(header), options);
};
if (check([0xFF, 0xD8, 0xFF])) {
return {
ext: 'jpg',
mime: 'image/jpeg'
};
}
if (check([0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A])) {
return {
ext: 'png',
mime: 'image/png'
};
}
if (check([0x47, 0x49, 0x46])) {
return {
ext: 'gif',
mime: 'image/gif'
};
}
if (check([0x57, 0x45, 0x42, 0x50], {
offset: 8
})) {
return {
ext: 'webp',
mime: 'image/webp'
};
}
if (check([0x46, 0x4C, 0x49, 0x46])) {
return {
ext: 'flif',
mime: 'image/flif'
};
} // Needs to be before `tif` check
if ((check([0x49, 0x49, 0x2A, 0x0]) || check([0x4D, 0x4D, 0x0, 0x2A])) && check([0x43, 0x52], {
offset: 8
})) {
return {
ext: 'cr2',
mime: 'image/x-canon-cr2'
};
}
if (check([0x49, 0x49, 0x2A, 0x0]) || check([0x4D, 0x4D, 0x0, 0x2A])) {
return {
ext: 'tif',
mime: 'image/tiff'
};
}
if (check([0x42, 0x4D])) {
return {
ext: 'bmp',
mime: 'image/bmp'
};
}
if (check([0x49, 0x49, 0xBC])) {
return {
ext: 'jxr',
mime: 'image/vnd.ms-photo'
};
}
if (check([0x38, 0x42, 0x50, 0x53])) {
return {
ext: 'psd',
mime: 'image/vnd.adobe.photoshop'
};
} // Zip-based file formats
// Need to be before the `zip` check
if (check([0x50, 0x4B, 0x3, 0x4])) {
if (check([0x6D, 0x69, 0x6D, 0x65, 0x74, 0x79, 0x70, 0x65, 0x61, 0x70, 0x70, 0x6C, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x2F, 0x65, 0x70, 0x75, 0x62, 0x2B, 0x7A, 0x69, 0x70], {
offset: 30
})) {
return {
ext: 'epub',
mime: 'application/epub+zip'
};
} // Assumes signed `.xpi` from addons.mozilla.org
if (check(xpiZipFilename, {
offset: 30
})) {
return {
ext: 'xpi',
mime: 'application/x-xpinstall'
};
}
if (checkString('mimetypeapplication/vnd.oasis.opendocument.text', {
offset: 30
})) {
return {
ext: 'odt',
mime: 'application/vnd.oasis.opendocument.text'
};
}
if (checkString('mimetypeapplication/vnd.oasis.opendocument.spreadsheet', {
offset: 30
})) {
return {
ext: 'ods',
mime: 'application/vnd.oasis.opendocument.spreadsheet'
};
}
if (checkString('mimetypeapplication/vnd.oasis.opendocument.presentation', {
offset: 30
})) {
return {
ext: 'odp',
mime: 'application/vnd.oasis.opendocument.presentation'
};
} // The docx, xlsx and pptx file types extend the Office Open XML file format:
// https://en.wikipedia.org/wiki/Office_Open_XML_file_formats
// We look for:
// - one entry named '[Content_Types].xml' or '_rels/.rels',
// - one entry indicating specific type of file.
// MS Office, OpenOffice and LibreOffice may put the parts in different order, so the check should not rely on it.
var findNextZipHeaderIndex = function findNextZipHeaderIndex(arr) {
var startAt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
return arr.findIndex(function (el, i, arr) {
return i >= startAt && arr[i] === 0x50 && arr[i + 1] === 0x4B && arr[i + 2] === 0x3 && arr[i + 3] === 0x4;
});
};
var zipHeaderIndex = 0; // The first zip header was already found at index 0
var oxmlFound = false;
var type = null;
do {
var offset = zipHeaderIndex + 30;
if (!oxmlFound) {
oxmlFound = check(oxmlContentTypes, {
offset: offset
}) || check(oxmlRels, {
offset: offset
});
}
if (!type) {
if (checkString('word/', {
offset: offset
})) {
type = {
ext: 'docx',
mime: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
};
} else if (checkString('ppt/', {
offset: offset
})) {
type = {
ext: 'pptx',
mime: 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
};
} else if (checkString('xl/', {
offset: offset
})) {
type = {
ext: 'xlsx',
mime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
};
}
}
if (oxmlFound && type) {
return type;
}
zipHeaderIndex = findNextZipHeaderIndex(buf, offset);
} while (zipHeaderIndex >= 0); // No more zip parts available in the buffer, but maybe we are almost certain about the type?
if (type) {
return type;
}
}
if (check([0x50, 0x4B]) && (buf[2] === 0x3 || buf[2] === 0x5 || buf[2] === 0x7) && (buf[3] === 0x4 || buf[3] === 0x6 || buf[3] === 0x8)) {
return {
ext: 'zip',
mime: 'application/zip'
};
}
if (check([0x75, 0x73, 0x74, 0x61, 0x72], {
offset: 257
})) {
return {
ext: 'tar',
mime: 'application/x-tar'
};
}
if (check([0x52, 0x61, 0x72, 0x21, 0x1A, 0x7]) && (buf[6] === 0x0 || buf[6] === 0x1)) {
return {
ext: 'rar',
mime: 'application/x-rar-compressed'
};
}
if (check([0x1F, 0x8B, 0x8])) {
return {
ext: 'gz',
mime: 'application/gzip'
};
}
if (check([0x42, 0x5A, 0x68])) {
return {
ext: 'bz2',
mime: 'application/x-bzip2'
};
}
if (check([0x37, 0x7A, 0xBC, 0xAF, 0x27, 0x1C])) {
return {
ext: '7z',
mime: 'application/x-7z-compressed'
};
}
if (check([0x78, 0x01])) {
return {
ext: 'dmg',
mime: 'application/x-apple-diskimage'
};
}
if (check([0x33, 0x67, 0x70, 0x35]) || // 3gp5
check([0x0, 0x0, 0x0]) && check([0x66, 0x74, 0x79, 0x70], {
offset: 4
}) && (check([0x6D, 0x70, 0x34, 0x31], {
offset: 8
}) || // MP41
check([0x6D, 0x70, 0x34, 0x32], {
offset: 8
}) || // MP42
check([0x69, 0x73, 0x6F, 0x6D], {
offset: 8
}) || // ISOM
check([0x69, 0x73, 0x6F, 0x32], {
offset: 8
}) || // ISO2
check([0x6D, 0x6D, 0x70, 0x34], {
offset: 8
}) || // MMP4
check([0x4D, 0x34, 0x56], {
offset: 8
}) || // M4V
check([0x64, 0x61, 0x73, 0x68], {
offset: 8
}) // DASH
)) {
return {
ext: 'mp4',
mime: 'video/mp4'
};
}
if (check([0x4D, 0x54, 0x68, 0x64])) {
return {
ext: 'mid',
mime: 'audio/midi'
};
} // https://github.com/threatstack/libmagic/blob/master/magic/Magdir/matroska
if (check([0x1A, 0x45, 0xDF, 0xA3])) {
var sliced = buf.subarray(4, 4 + 4096);
var idPos = sliced.findIndex(function (el, i, arr) {
return arr[i] === 0x42 && arr[i + 1] === 0x82;
});
if (idPos !== -1) {
var docTypePos = idPos + 3;
var findDocType = function findDocType(type) {
return _toConsumableArray(type).every(function (c, i) {
return sliced[docTypePos + i] === c.charCodeAt(0);
});
};
if (findDocType('matroska')) {
return {
ext: 'mkv',
mime: 'video/x-matroska'
};
}
if (findDocType('webm')) {
return {
ext: 'webm',
mime: 'video/webm'
};
}
}
}
if (check([0x0, 0x0, 0x0, 0x14, 0x66, 0x74, 0x79, 0x70, 0x71, 0x74, 0x20, 0x20]) || check([0x66, 0x72, 0x65, 0x65], {
offset: 4
}) || // Type: `free`
check([0x66, 0x74, 0x79, 0x70, 0x71, 0x74, 0x20, 0x20], {
offset: 4
}) || check([0x6D, 0x64, 0x61, 0x74], {
offset: 4
}) || // MJPEG
check([0x6D, 0x6F, 0x6F, 0x76], {
offset: 4
}) || // Type: `moov`
check([0x77, 0x69, 0x64, 0x65], {
offset: 4
})) {
return {
ext: 'mov',
mime: 'video/quicktime'
};
} // RIFF file format which might be AVI, WAV, QCP, etc
if (check([0x52, 0x49, 0x46, 0x46])) {
if (check([0x41, 0x56, 0x49], {
offset: 8
})) {
return {
ext: 'avi',
mime: 'video/vnd.avi'
};
}
if (check([0x57, 0x41, 0x56, 0x45], {
offset: 8
})) {
return {
ext: 'wav',
mime: 'audio/vnd.wave'
};
} // QLCM, QCP file
if (check([0x51, 0x4C, 0x43, 0x4D], {
offset: 8
})) {
return {
ext: 'qcp',
mime: 'audio/qcelp'
};
}
} // ASF_Header_Object first 80 bytes
if (check([0x30, 0x26, 0xB2, 0x75, 0x8E, 0x66, 0xCF, 0x11, 0xA6, 0xD9])) {
// Search for header should be in first 1KB of file.
var _offset = 30;
do {
var objectSize = readUInt64LE(buf, _offset + 16);
if (check([0x91, 0x07, 0xDC, 0xB7, 0xB7, 0xA9, 0xCF, 0x11, 0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65], {
offset: _offset
})) {
// Sync on Stream-Properties-Object (B7DC0791-A9B7-11CF-8EE6-00C00C205365)
if (check([0x40, 0x9E, 0x69, 0xF8, 0x4D, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B], {
offset: _offset + 24
})) {
// Found audio:
return {
ext: 'wma',
mime: 'audio/x-ms-wma'
};
}
if (check([0xC0, 0xEF, 0x19, 0xBC, 0x4D, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B], {
offset: _offset + 24
})) {
// Found video:
return {
ext: 'wmv',
mime: 'video/x-ms-asf'
};
}
break;
}
_offset += objectSize;
} while (_offset + 24 <= buf.length); // Default to ASF generic extension
return {
ext: 'asf',
mime: 'application/vnd.ms-asf'
};
}
if (check([0x0, 0x0, 0x1, 0xBA]) || check([0x0, 0x0, 0x1, 0xB3])) {
return {
ext: 'mpg',
mime: 'video/mpeg'
};
}
if (check([0x66, 0x74, 0x79, 0x70, 0x33, 0x67], {
offset: 4
})) {
return {
ext: '3gp',
mime: 'video/3gpp'
};
} // Check for MPEG header at different starting offsets
for (var start = 0; start < 2 && start < buf.length - 16; start++) {
if (check([0x49, 0x44, 0x33], {
offset: start
}) || // ID3 header
check([0xFF, 0xE2], {
offset: start,
mask: [0xFF, 0xE2]
}) // MPEG 1 or 2 Layer 3 header
) {
return {
ext: 'mp3',
mime: 'audio/mpeg'
};
}
if (check([0xFF, 0xE4], {
offset: start,
mask: [0xFF, 0xE4]
}) // MPEG 1 or 2 Layer 2 header
) {
return {
ext: 'mp2',
mime: 'audio/mpeg'
};
}
if (check([0xFF, 0xF8], {
offset: start,
mask: [0xFF, 0xFC]
}) // MPEG 2 layer 0 using ADTS
) {
return {
ext: 'mp2',
mime: 'audio/mpeg'
};
}
if (check([0xFF, 0xF0], {
offset: start,
mask: [0xFF, 0xFC]
}) // MPEG 4 layer 0 using ADTS
) {
return {
ext: 'mp4',
mime: 'audio/mpeg'
};
}
}
if (check([0x66, 0x74, 0x79, 0x70, 0x4D, 0x34, 0x41], {
offset: 4
})) {
return {
// MPEG-4 layer 3 (audio)
ext: 'm4a',
mime: 'audio/mp4' // RFC 4337
};
} // Needs to be before `ogg` check
if (check([0x4F, 0x70, 0x75, 0x73, 0x48, 0x65, 0x61, 0x64], {
offset: 28
})) {
return {
ext: 'opus',
mime: 'audio/opus'
};
} // If 'OggS' in first bytes, then OGG container
if (check([0x4F, 0x67, 0x67, 0x53])) {
// This is a OGG container
// If ' theora' in header.
if (check([0x80, 0x74, 0x68, 0x65, 0x6F, 0x72, 0x61], {
offset: 28
})) {
return {
ext: 'ogv',
mime: 'video/ogg'
};
} // If '\x01video' in header.
if (check([0x01, 0x76, 0x69, 0x64, 0x65, 0x6F, 0x00], {
offset: 28
})) {
return {
ext: 'ogm',
mime: 'video/ogg'
};
} // If ' FLAC' in header https://xiph.org/flac/faq.html
if (check([0x7F, 0x46, 0x4C, 0x41, 0x43], {
offset: 28
})) {
return {
ext: 'oga',
mime: 'audio/ogg'
};
} // 'Speex ' in header https://en.wikipedia.org/wiki/Speex
if (check([0x53, 0x70, 0x65, 0x65, 0x78, 0x20, 0x20], {
offset: 28
})) {
return {
ext: 'spx',
mime: 'audio/ogg'
};
} // If '\x01vorbis' in header
if (check([0x01, 0x76, 0x6F, 0x72, 0x62, 0x69, 0x73], {
offset: 28
})) {
return {
ext: 'ogg',
mime: 'audio/ogg'
};
} // Default OGG container https://www.iana.org/assignments/media-types/application/ogg
return {
ext: 'ogx',
mime: 'application/ogg'
};
}
if (check([0x66, 0x4C, 0x61, 0x43])) {
return {
ext: 'flac',
mime: 'audio/x-flac'
};
}
if (check([0x4D, 0x41, 0x43, 0x20])) {
// 'MAC '
return {
ext: 'ape',
mime: 'audio/ape'
};
}
if (check([0x77, 0x76, 0x70, 0x6B])) {
// 'wvpk'
return {
ext: 'wv',
mime: 'audio/wavpack'
};
}
if (check([0x23, 0x21, 0x41, 0x4D, 0x52, 0x0A])) {
return {
ext: 'amr',
mime: 'audio/amr'
};
}
if (check([0x25, 0x50, 0x44, 0x46])) {
return {
ext: 'pdf',
mime: 'application/pdf'
};
}
if (check([0x4D, 0x5A])) {
return {
ext: 'exe',
mime: 'application/x-msdownload'
};
}
if ((buf[0] === 0x43 || buf[0] === 0x46) && check([0x57, 0x53], {
offset: 1
})) {
return {
ext: 'swf',
mime: 'application/x-shockwave-flash'
};
}
if (check([0x7B, 0x5C, 0x72, 0x74, 0x66])) {
return {
ext: 'rtf',
mime: 'application/rtf'
};
}
if (check([0x00, 0x61, 0x73, 0x6D])) {
return {
ext: 'wasm',
mime: 'application/wasm'
};
}
if (check([0x77, 0x4F, 0x46, 0x46]) && (check([0x00, 0x01, 0x00, 0x00], {
offset: 4
}) || check([0x4F, 0x54, 0x54, 0x4F], {
offset: 4
}))) {
return {
ext: 'woff',
mime: 'font/woff'
};
}
if (check([0x77, 0x4F, 0x46, 0x32]) && (check([0x00, 0x01, 0x00, 0x00], {
offset: 4
}) || check([0x4F, 0x54, 0x54, 0x4F], {
offset: 4
}))) {
return {
ext: 'woff2',
mime: 'font/woff2'
};
}
if (check([0x4C, 0x50], {
offset: 34
}) && (check([0x00, 0x00, 0x01], {
offset: 8
}) || check([0x01, 0x00, 0x02], {
offset: 8
}) || check([0x02, 0x00, 0x02], {
offset: 8
}))) {
return {
ext: 'eot',
mime: 'application/vnd.ms-fontobject'
};
}
if (check([0x00, 0x01, 0x00, 0x00, 0x00])) {
return {
ext: 'ttf',
mime: 'font/ttf'
};
}
if (check([0x4F, 0x54, 0x54, 0x4F, 0x00])) {
return {
ext: 'otf',
mime: 'font/otf'
};
}
if (check([0x00, 0x00, 0x01, 0x00])) {
return {
ext: 'ico',
mime: 'image/x-icon'
};
}
if (check([0x00, 0x00, 0x02, 0x00])) {
return {
ext: 'cur',
mime: 'image/x-icon'
};
}
if (check([0x46, 0x4C, 0x56, 0x01])) {
return {
ext: 'flv',
mime: 'video/x-flv'
};
}
if (check([0x25, 0x21])) {
return {
ext: 'ps',
mime: 'application/postscript'
};
}
if (check([0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00])) {
return {
ext: 'xz',
mime: 'application/x-xz'
};
}
if (check([0x53, 0x51, 0x4C, 0x69])) {
return {
ext: 'sqlite',
mime: 'application/x-sqlite3'
};
}
if (check([0x4E, 0x45, 0x53, 0x1A])) {
return {
ext: 'nes',
mime: 'application/x-nintendo-nes-rom'
};
}
if (check([0x43, 0x72, 0x32, 0x34])) {
return {
ext: 'crx',
mime: 'application/x-google-chrome-extension'
};
}
if (check([0x4D, 0x53, 0x43, 0x46]) || check([0x49, 0x53, 0x63, 0x28])) {
return {
ext: 'cab',
mime: 'application/vnd.ms-cab-compressed'
};
} // Needs to be before `ar` check
if (check([0x21, 0x3C, 0x61, 0x72, 0x63, 0x68, 0x3E, 0x0A, 0x64, 0x65, 0x62, 0x69, 0x61, 0x6E, 0x2D, 0x62, 0x69, 0x6E, 0x61, 0x72, 0x79])) {
return {
ext: 'deb',
mime: 'application/x-deb'
};
}
if (check([0x21, 0x3C, 0x61, 0x72, 0x63, 0x68, 0x3E])) {
return {
ext: 'ar',
mime: 'application/x-unix-archive'
};
}
if (check([0xED, 0xAB, 0xEE, 0xDB])) {
return {
ext: 'rpm',
mime: 'application/x-rpm'
};
}
if (check([0x1F, 0xA0]) || check([0x1F, 0x9D])) {
return {
ext: 'Z',
mime: 'application/x-compress'
};
}
if (check([0x4C, 0x5A, 0x49, 0x50])) {
return {
ext: 'lz',
mime: 'application/x-lzip'
};
}
if (check([0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1])) {
return {
ext: 'msi',
mime: 'application/x-msi'
};
}
if (check([0x06, 0x0E, 0x2B, 0x34, 0x02, 0x05, 0x01, 0x01, 0x0D, 0x01, 0x02, 0x01, 0x01, 0x02])) {
return {
ext: 'mxf',
mime: 'application/mxf'
};
}
if (check([0x47], {
offset: 4
}) && (check([0x47], {
offset: 192
}) || check([0x47], {
offset: 196
}))) {
return {
ext: 'mts',
mime: 'video/mp2t'
};
}
if (check([0x42, 0x4C, 0x45, 0x4E, 0x44, 0x45, 0x52])) {
return {
ext: 'blend',
mime: 'application/x-blender'
};
}
if (check([0x42, 0x50, 0x47, 0xFB])) {
return {
ext: 'bpg',
mime: 'image/bpg'
};
}
if (check([0x00, 0x00, 0x00, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A])) {
// JPEG-2000 family
if (check([0x6A, 0x70, 0x32, 0x20], {
offset: 20
})) {
return {
ext: 'jp2',
mime: 'image/jp2'
};
}
if (check([0x6A, 0x70, 0x78, 0x20], {
offset: 20
})) {
return {
ext: 'jpx',
mime: 'image/jpx'
};
}
if (check([0x6A, 0x70, 0x6D, 0x20], {
offset: 20
})) {
return {
ext: 'jpm',
mime: 'image/jpm'
};
}
if (check([0x6D, 0x6A, 0x70, 0x32], {
offset: 20
})) {
return {
ext: 'mj2',
mime: 'image/mj2'
};
}
}
if (check([0x46, 0x4F, 0x52, 0x4D])) {
return {
ext: 'aif',
mime: 'audio/aiff'
};
}
if (checkString('<?xml ')) {
return {
ext: 'xml',
mime: 'application/xml'
};
}
if (check([0x42, 0x4F, 0x4F, 0x4B, 0x4D, 0x4F, 0x42, 0x49], {
offset: 60
})) {
return {
ext: 'mobi',
mime: 'application/x-mobipocket-ebook'
};
} // File Type Box (https://en.wikipedia.org/wiki/ISO_base_media_file_format)
if (check([0x66, 0x74, 0x79, 0x70], {
offset: 4
})) {
if (check([0x6D, 0x69, 0x66, 0x31], {
offset: 8
})) {
return {
ext: 'heic',
mime: 'image/heif'
};
}
if (check([0x6D, 0x73, 0x66, 0x31], {
offset: 8
})) {
return {
ext: 'heic',
mime: 'image/heif-sequence'
};
}
if (check([0x68, 0x65, 0x69, 0x63], {
offset: 8
}) || check([0x68, 0x65, 0x69, 0x78], {
offset: 8
})) {
return {
ext: 'heic',
mime: 'image/heic'
};
}
if (check([0x68, 0x65, 0x76, 0x63], {
offset: 8
}) || check([0x68, 0x65, 0x76, 0x78], {
offset: 8
})) {
return {
ext: 'heic',
mime: 'image/heic-sequence'
};
}
}
if (check([0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A])) {
return {
ext: 'ktx',
mime: 'image/ktx'
};
}
if (check([0x44, 0x49, 0x43, 0x4D], {
offset: 128
})) {
return {
ext: 'dcm',
mime: 'application/dicom'
};
} // Musepack, SV7
if (check([0x4D, 0x50, 0x2B])) {
return {
ext: 'mpc',
mime: 'audio/x-musepack'
};
} // Musepack, SV8
if (check([0x4D, 0x50, 0x43, 0x4B])) {
return {
ext: 'mpc',
mime: 'audio/x-musepack'
};
}
if (check([0x42, 0x45, 0x47, 0x49, 0x4E, 0x3A])) {
return {
ext: 'ics',
mime: 'text/calendar'
};
}
if (check([0x67, 0x6C, 0x54, 0x46, 0x02, 0x00, 0x00, 0x00])) {
return {
ext: 'glb',
mime: 'model/gltf-binary'
};
}
if (check([0xD4, 0xC3, 0xB2, 0xA1]) || check([0xA1, 0xB2, 0xC3, 0xD4])) {
return {
ext: 'pcap',
mime: 'application/vnd.tcpdump.pcap'
};
}
return null;
};
module.exports = fileType; // TODO: Remove this for the next major release
module.exports.default = fileType;
Object.defineProperty(fileType, 'minimumBytes', {
value: 4100
});
module.exports.stream = function (readableStream) {
return new Promise(function (resolve, reject) {
// Using `eval` to work around issues when bundling with Webpack
var stream = eval('require')('stream'); // eslint-disable-line no-eval
readableStream.once('readable', function () {
var pass = new stream.PassThrough();
var chunk = readableStream.read(module.exports.minimumBytes) || readableStream.read();
try {
pass.fileType = fileType(chunk);
} catch (error) {
reject(error);
}
readableStream.unshift(chunk);
if (stream.pipeline) {
resolve(stream.pipeline(readableStream, pass, function () {}));
} else {
resolve(readableStream.pipe(pass));
}
});
});
};
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(34).Buffer))
/***/ }),
/* 34 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/
/* eslint-disable no-proto */
var base64 = __webpack_require__(35);
var ieee754 = __webpack_require__(36);
var isArray = __webpack_require__(37);
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 foo() {
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(this, __webpack_require__(13)))
/***/ }),
/* 35 */
/***/ (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;
} // Support decoding URL-safe base64 strings, as Node.js does.
// See: https://en.wikipedia.org/wiki/Base64#URL_applications
revLookup['-'.charCodeAt(0)] = 62;
revLookup['_'.charCodeAt(0)] = 63;
function getLens(b64) {
var len = b64.length;
if (len % 4 > 0) {
throw new Error('Invalid string. Length must be a multiple of 4');
} // Trim off extra bytes after placeholder bytes are found
// See: https://github.com/beatgammit/base64-js/issues/42
var validLen = b64.indexOf('=');
if (validLen === -1) validLen = len;
var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4;
return [validLen, placeHoldersLen];
} // base64 is 4/3 + up to two characters of the original data
function byteLength(b64) {
var lens = getLens(b64);
var validLen = lens[0];
var placeHoldersLen = lens[1];
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
}
function _byteLength(b64, validLen, placeHoldersLen) {
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
}
function toByteArray(b64) {
var tmp;
var lens = getLens(b64);
var validLen = lens[0];
var placeHoldersLen = lens[1];
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));
var curByte = 0; // if there are placeholders, only get up to the last complete 4 chars
var len = placeHoldersLen > 0 ? validLen - 4 : validLen;
var i;
for (i = 0; i < len; i += 4) {
tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
arr[curByte++] = tmp >> 16 & 0xFF;
arr[curByte++] = tmp >> 8 & 0xFF;
arr[curByte++] = tmp & 0xFF;
}
if (placeHoldersLen === 2) {
tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
arr[curByte++] = tmp & 0xFF;
}
if (placeHoldersLen === 1) {
tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
arr[curByte++] = tmp >> 8 & 0xFF;
arr[curByte++] = 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 & 0xFF0000) + (uint8[i + 1] << 8 & 0xFF00) + (uint8[i + 2] & 0xFF);
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 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];
parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 0x3F] + '==');
} else if (extraBytes === 2) {
tmp = (uint8[len - 2] << 8) + uint8[len - 1];
parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 0x3F] + lookup[tmp << 2 & 0x3F] + '=');
}
return parts.join('');
}
/***/ }),
/* 36 */
/***/ (function(module, exports) {
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
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;
};
/***/ }),
/* 37 */
/***/ (function(module, exports) {
var toString = {}.toString;
module.exports = Array.isArray || function (arr) {
return toString.call(arr) == '[object Array]';
};
/***/ }),
/* 38 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _module__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20);
/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3);
/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4);
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8);
/* harmony import */ var _renderer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(21);
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
/*
* decaffeinate suggestions:
* DS001: Remove Babel/TypeScript constructor workaround
* DS101: Remove unnecessary use of Array.from
* DS102: Remove unnecessary code created because of implicit returns
* DS202: Simplify dynamic range loops
* DS203: Remove `|| {}` from converted for-own loops
* DS205: Consider reworking code to avoid use of IIFEs
* DS206: Consider reworking classes to avoid initClass
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
// Here it begins. Caman is defined.
// There are many different initialization for Caman, which are described on the
// [Guides](http://camanjs.com/guides).
//
// Initialization is tricky because we need to make sure everything we need is actually fully
// loaded in the DOM before proceeding. When initialized on an image, we need to make sure that the
// image is done loading before converting it to a canvas element and writing the pixel data. If we
// do this prematurely, the browser will throw a DOM Error, and chaos will ensue. In the event that
// we initialize Caman on a canvas element while specifying an image URL, we need to create a new
// image element, load the image, then continue with initialization.
//
// The main goal for Caman was simplicity, so all of this is handled transparently to the end-user.
var Caman = /*#__PURE__*/function (_Module) {
_inherits(Caman, _Module);
var _super = _createSuper(Caman);
// The Caman function. While technically a constructor, it was made to be called without
// the `new` keyword. Caman will figure it out.
//
// @param [DOMObject, String] initializer The DOM selector or DOM object to initialize.
// @overload Caman(initializer)
// Initialize Caman without a callback.
//
// @overload Caman(initializer, callback)
// Initialize Caman with a callback.
// @param [Function] callback Function to call once initialization completes.
//
// @overload Caman(initializer, url)
// Initialize Caman with a URL to an image and no callback.
// @param [String] url URl to an image to draw to the canvas.
//
// @overload Caman(initializer, url, callback)
// Initialize Caman with a canvas, URL to an image, and a callback.
// @param [String] url URl to an image to draw to the canvas.
// @param [Function] callback Function to call once initialization completes.
//
// @overload Caman(file)
// **NodeJS**: Initialize Caman with a path to an image file and no callback.
// @param [String, File] file File object or path to image to read.
//
// @overload Caman(file, callback)
// **NodeJS**: Initialize Caman with a file and a callback.
// @param [String, File] file File object or path to image to read.
// @param [Function] callback Function to call once initialization completes.
//
// @return [Caman] Initialized Caman instance.
function Caman() {
var _this;
_classCallCheck(this, Caman);
{
// Hack: trick Babel/TypeScript into allowing this before super.
if (false) {}
var thisFn = function () {
return _assertThisInitialized(_this);
}.toString();
var thisName = thisFn.match(/return (?:_assertThisInitialized\()*(\w+)\)*;?/)[1];
eval("".concat(thisName, " = this;"));
}
if (arguments.length === 0) {
throw "Invalid arguments";
}
if (_assertThisInitialized(_this) instanceof Caman) {
// We have to do this to avoid polluting the global scope
// because of how Coffeescript binds functions specified
// with => and the fact that Caman can be invoked as both
// a function and as a 'new' object.
var id;
_this.finishInit = _this.finishInit.bind(_assertThisInitialized(_this));
_this.imageLoaded = _this.imageLoaded.bind(_assertThisInitialized(_this));
var args = Array.prototype.slice.call(arguments, 0);
id = parseInt(Caman.getAttrId(args[0]), 10);
var callback = typeof args[1] === "function" ? args[1] : typeof args[2] === "function" ? args[2] : function () {};
if (!isNaN(id) && _store__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].has(id)) {
return _possibleConstructorReturn(_this, _store__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].execute(id, callback));
} // Every instance gets a unique ID. Makes it much simpler to check if two variables are the
// same instance.
_this.id = _util__WEBPACK_IMPORTED_MODULE_1__[/* Util */ "b"].uniqid.get();
_this.initializedPixelData = _this.originalPixelData = null;
_this.cropCoordinates = {
x: 0,
y: 0
};
_this.cropped = false;
_this.resized = false;
_this.pixelStack = []; // Stores the pixel layers
_this.layerStack = []; // Stores all of the layers waiting to be rendered
_this.canvasQueue = []; // Stores all of the canvases to be processed
_this.currentLayer = null;
_this.scaled = false; //this.analyze = new Analyze(this);
_this.renderer = new _renderer__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"](_assertThisInitialized(_this));
_this.domIsLoaded(function () {
_this.parseArguments(args);
return _this.setup();
});
return _possibleConstructorReturn(_this, _assertThisInitialized(_this));
} else {
return _possibleConstructorReturn(_this, new Caman(arguments));
}
return _possibleConstructorReturn(_this);
} // Checks to ensure the DOM is loaded. Ensures the callback is always fired, even
// if the DOM is already loaded before it's invoked. The callback is also always
// called asynchronously.
//
// @param [Function] cb The callback function to fire when the DOM is ready.
_createClass(Caman, [{
key: "domIsLoaded",
value: function domIsLoaded(cb) {
var _this2 = this;
if (document.readyState === "complete") {
_logger__WEBPACK_IMPORTED_MODULE_2__[/* Log */ "a"].debug("DOM initialized");
return setTimeout(function () {
return cb.call(_this2);
}, 0);
} else {
var listener = function listener() {
if (document.readyState === "complete") {
_logger__WEBPACK_IMPORTED_MODULE_2__[/* Log */ "a"].debug("DOM initialized");
return cb.call(_this2);
}
};
return document.addEventListener("readystatechange", listener, false);
}
} // Parses the arguments given to the Caman function, and sets the appropriate
// properties on this instance.
//
// @params [Array] args Array of arguments passed to Caman.
}, {
key: "parseArguments",
value: function parseArguments(args) {
var _this3 = this;
if (args.length === 0) {
throw "Invalid arguments given";
} // Defaults
this.initObj = null;
this.initType = null;
this.imageUrl = null;
this.callback = function () {}; // First argument is always our canvas/image
this.setInitObject(args[0]);
if (args.length === 1) {
return;
}
switch (_typeof(args[1])) {
case "string":
this.imageUrl = args[1];
break;
case "function":
this.callback = args[1];
break;
}
if (args.length === 2) {
return;
}
this.callback = args[2];
if (args.length === 4) {
return function () {
var result = [];
for (var _i2 = 0, _Object$keys = Object.keys(args[4] || {}); _i2 < _Object$keys.length; _i2++) {
var key = _Object$keys[_i2];
var val = args[4][key];
result.push(_this3.options[key] = val);
}
return result;
}();
}
} // Sets the initialization object for this instance.
//
// @param [Object, String] obj The initialization argument.
}, {
key: "setInitObject",
value: function setInitObject(obj) {
if (_typeof(obj) === "object") {
this.initObj = obj;
} else {
this.initObj = Object(_util__WEBPACK_IMPORTED_MODULE_1__[/* $ */ "a"])(obj);
}
if (this.initObj == null) {
throw "Could not find image or canvas for initialization.";
}
return this.initType = this.initObj.nodeName.toLowerCase();
} // Begins the setup process, which differs depending on whether we're in NodeJS,
// or if an image or canvas object was provided.
}, {
key: "setup",
value: function setup() {
switch (this.initType) {
case "node":
return this.initNode();
case "img":
return this.initImage();
case "canvas":
return this.initCanvas();
}
} // Initialization function for the browser and image objects.
}, {
key: "initImage",
value: function initImage() {
this.image = this.initObj;
this.canvas = document.createElement('canvas');
this.context = this.canvas.getContext('2d');
_util__WEBPACK_IMPORTED_MODULE_1__[/* Util */ "b"].copyAttributes(this.image, this.canvas, {
except: ['src']
}); // Swap out the image with the canvas element if the image exists
// in the DOM.
if (this.image.parentNode != null) {
this.image.parentNode.replaceChild(this.canvas, this.image);
}
this.imageAdjustments();
return this.waitForImageLoaded();
} // Initialization function for the browser and canvas objects.
}, {
key: "initCanvas",
value: function initCanvas() {
this.canvas = this.initObj;
this.context = this.canvas.getContext('2d');
if (this.imageUrl != null) {
this.image = document.createElement('img');
this.image.src = this.imageUrl;
this.imageAdjustments();
return this.waitForImageLoaded();
} else {
return this.finishInit();
}
} // Automatically check for a HiDPI capable screen and swap out the image if possible.
// Also checks the image URL to see if it's a cross-domain request, and attempt to
// proxy the image. If a cross-origin type is configured, the proxy will be ignored.
}, {
key: "imageAdjustments",
value: function imageAdjustments() {
if (this.needsHiDPISwap()) {
_logger__WEBPACK_IMPORTED_MODULE_2__[/* Log */ "a"].debug(this.image.src, "->", this.hiDPIReplacement());
this.swapped = true;
this.image.src = this.hiDPIReplacement();
}
if (Caman.IO.isRemote(this.image)) {
this.image.src = Caman.IO.proxyUrl(this.image.src);
return _logger__WEBPACK_IMPORTED_MODULE_2__[/* Log */ "a"].debug("Remote image detected, using URL = ".concat(this.image.src));
}
} // Utility function that fires {Caman#imageLoaded} once the image is finished loading.
}, {
key: "waitForImageLoaded",
value: function waitForImageLoaded() {
if (this.isImageLoaded()) {
return this.imageLoaded();
} else {
return this.image.onload = this.imageLoaded;
}
} // Checks if the given image is finished loading.
// @return [Boolean] Is the image loaded?
}, {
key: "isImageLoaded",
value: function isImageLoaded() {
if (!this.image.complete) {
return false;
} // Internet Explorer is weird.
if (this.image.naturalWidth != null && this.image.naturalWidth === 0) {
return false;
}
return true;
} // Internet Explorer has issues figuring out image dimensions when they aren't
// explicitly defined, apparently. We check the normal width/height properties first,
// but fall back to natural sizes if they are 0.
// @return [Number] Width of the initialization image.
}, {
key: "imageWidth",
value: function imageWidth() {
return this.image.width || this.image.naturalWidth;
} // @see Caman#imageWidth
// @return [Number] Height of the initialization image.
}, {
key: "imageHeight",
value: function imageHeight() {
return this.image.height || this.image.naturalHeight;
} // Function that is called once the initialization image is finished loading.
// We make sure that the canvas dimensions are properly set here.
}, {
key: "imageLoaded",
value: function imageLoaded() {
_logger__WEBPACK_IMPORTED_MODULE_2__[/* Log */ "a"].debug("Image loaded. Width = ".concat(this.imageWidth(), ", Height = ").concat(this.imageHeight()));
if (this.swapped) {
this.canvas.width = this.imageWidth() / this.hiDPIRatio();
this.canvas.height = this.imageHeight() / this.hiDPIRatio();
} else {
this.canvas.width = this.imageWidth();
this.canvas.height = this.imageHeight();
}
return this.finishInit();
} // Final step of initialization. We finish setting up our canvas element, and we
// draw the image to the canvas (if applicable).
}, {
key: "finishInit",
value: function finishInit() {
if (this.context == null) {
this.context = this.canvas.getContext('2d');
}
this.originalWidth = this.preScaledWidth = this.width = this.canvas.width;
this.originalHeight = this.preScaledHeight = this.height = this.canvas.height;
this.hiDPIAdjustments();
if (!this.hasId()) {
this.assignId();
}
if (this.image != null) {
this.context.drawImage(this.image, 0, 0, this.imageWidth(), this.imageHeight(), 0, 0, this.preScaledWidth, this.preScaledHeight);
}
this.imageData = this.context.getImageData(0, 0, this.canvas.width, this.canvas.height);
this.pixelData = this.imageData.data;
if (Caman.allowRevert) {
this.initializedPixelData = _util__WEBPACK_IMPORTED_MODULE_1__[/* Util */ "b"].dataArray(this.pixelData.length);
this.originalPixelData = _util__WEBPACK_IMPORTED_MODULE_1__[/* Util */ "b"].dataArray(this.pixelData.length);
for (var i = 0; i < this.pixelData.length; i++) {
var pixel = this.pixelData[i];
this.initializedPixelData[i] = pixel;
this.originalPixelData[i] = pixel;
}
}
this.dimensions = {
width: this.canvas.width,
height: this.canvas.height
};
_store__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].put(this.id, this);
this.callback.call(this, this); // Reset the callback so re-initialization doesn't
// trigger it again.
return this.callback = function () {};
} // If you have a separate context reference to this canvas outside of CamanJS
// and you make a change to the canvas outside of CamanJS, you will have to call
// this function to update our context reference to include those changes.
}, {
key: "reloadCanvasData",
value: function reloadCanvasData() {
this.imageData = this.context.getImageData(0, 0, this.canvas.width, this.canvas.height);
return this.pixelData = this.imageData.data;
} // Reset the canvas pixels to the original state at initialization.
}, {
key: "resetOriginalPixelData",
value: function resetOriginalPixelData() {
var _this4 = this;
if (!Caman.allowRevert) {
throw "Revert disabled";
}
this.originalPixelData = _util__WEBPACK_IMPORTED_MODULE_1__[/* Util */ "b"].dataArray(this.pixelData.length);
return Array.from(this.pixelData).map(function (pixel, i) {
return _this4.originalPixelData[i] = pixel;
});
} // Does this instance have an ID assigned?
// @return [Boolean] Existance of an ID.
}, {
key: "hasId",
value: function hasId() {
return Caman.getAttrId(this.canvas) != null;
} // Assign a unique ID to this instance.
}, {
key: "assignId",
value: function assignId() {
if (this.canvas.getAttribute('data-caman-id')) {
return;
}
return this.canvas.setAttribute('data-caman-id', this.id);
} // Is HiDPI support disabled via the HTML data attribute?
// @return [Boolean]
}, {
key: "hiDPIDisabled",
value: function hiDPIDisabled() {
return this.canvas.getAttribute('data-caman-hidpi-disabled') !== null;
} // Perform HiDPI adjustments to the canvas. This consists of changing the
// scaling and the dimensions to match that of the display.
}, {
key: "hiDPIAdjustments",
value: function hiDPIAdjustments() {
if (!this.needsHiDPISwap()) {
return;
}
var ratio = this.hiDPIRatio();
if (ratio !== 1) {
_logger__WEBPACK_IMPORTED_MODULE_2__[/* Log */ "a"].debug("HiDPI ratio = ".concat(ratio));
this.scaled = true;
this.preScaledWidth = this.canvas.width;
this.preScaledHeight = this.canvas.height;
this.canvas.width = this.preScaledWidth * ratio;
this.canvas.height = this.preScaledHeight * ratio;
this.canvas.style.width = "".concat(this.preScaledWidth, "px");
this.canvas.style.height = "".concat(this.preScaledHeight, "px");
this.context.scale(ratio, ratio);
this.width = this.originalWidth = this.canvas.width;
return this.height = this.originalHeight = this.canvas.height;
}
} // Calculate the HiDPI ratio of this display based on the backing store
// and the pixel ratio.
// @return [Number] The HiDPI pixel ratio.
}, {
key: "hiDPIRatio",
value: function hiDPIRatio() {
var devicePixelRatio = window.devicePixelRatio || 1;
var backingStoreRatio = this.context.webkitBackingStorePixelRatio || this.context.mozBackingStorePixelRatio || this.context.msBackingStorePixelRatio || this.context.oBackingStorePixelRatio || this.context.backingStorePixelRatio || 1;
return devicePixelRatio / backingStoreRatio;
} // Is this display HiDPI capable?
// @return [Boolean]
}, {
key: "hiDPICapable",
value: function hiDPICapable() {
return window.devicePixelRatio != null && window.devicePixelRatio !== 1;
} // Do we need to perform an image swap with a HiDPI image?
// @return [Boolean]
}, {
key: "needsHiDPISwap",
value: function needsHiDPISwap() {
if (this.hiDPIDisabled() || !this.hiDPICapable()) {
return false;
}
return this.hiDPIReplacement() !== null;
} // Gets the HiDPI replacement for the initialization image.
// @return [String] URL to the HiDPI version.
}, {
key: "hiDPIReplacement",
value: function hiDPIReplacement() {
if (this.image == null) {
return null;
}
return this.image.getAttribute('data-caman-hidpi');
} // Replaces the current canvas with a new one, and properly updates all of the
// applicable references for this instance.
//
// @param [DOMObject] newCanvas The canvas to swap into this instance.
}, {
key: "replaceCanvas",
value: function replaceCanvas(newCanvas) {
var oldCanvas = this.canvas;
var context = oldCanvas.getContext('2d');
this.width = newCanvas.width;
this.height = newCanvas.height;
context.clearRect(0, 0, oldCanvas.width, oldCanvas.height);
oldCanvas.width = newCanvas.width;
oldCanvas.height = newCanvas.height;
context.drawImage(newCanvas, 0, 0);
this.reloadCanvasData();
return this.dimensions = {
width: newCanvas.width,
height: newCanvas.height
};
} // Begins the rendering process. This will execute all of the filter functions
// called either since initialization or the previous render.
//
// @param [Function] callback Function to call when rendering is finished.
}, {
key: "render",
value: function render(callback) {
var _this5 = this;
if (callback == null) {
callback = function callback() {};
}
Caman.Event.trigger(this, "renderStart");
return this.renderer.execute(function () {
_this5.context.putImageData(_this5.imageData, 0, 0);
return callback.call(_this5);
});
} // Reverts the canvas back to it's original state while
// maintaining any cropped or resized dimensions.
//
// @param [Boolean] updateContext Should we apply the reverted pixel data to the
// canvas context thus triggering a re-render by the browser?
}, {
key: "revert",
value: function revert(updateContext) {
if (updateContext == null) {
updateContext = true;
}
if (!Caman.allowRevert) {
throw "Revert disabled";
}
var iterable = this.originalVisiblePixels();
for (var i = 0; i < iterable.length; i++) {
var pixel = iterable[i];
this.pixelData[i] = pixel;
}
if (updateContext) {
return this.context.putImageData(this.imageData, 0, 0);
}
} // Completely resets the canvas back to it's original state.
// Any size adjustments will also be reset.
}, {
key: "reset",
value: function reset() {
var canvas = document.createElement('canvas');
_util__WEBPACK_IMPORTED_MODULE_1__[/* Util */ "b"].copyAttributes(this.canvas, canvas);
canvas.width = this.originalWidth;
canvas.height = this.originalHeight;
var ctx = canvas.getContext('2d');
var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
var pixelData = imageData.data;
for (var i = 0; i < this.initializedPixelData.length; i++) {
var pixel = this.initializedPixelData[i];
pixelData[i] = pixel;
}
ctx.putImageData(imageData, 0, 0);
this.cropCoordinates = {
x: 0,
y: 0
};
this.resized = false;
this.angle = 0;
this.rotated = false;
return this.replaceCanvas(canvas);
} // Returns the original pixel data while maintaining any
// cropping or resizing that may have occured.
// **Warning**: this is currently in beta status.
//
// @return [Array] Original pixel values still visible after cropping or resizing.
}, {
key: "originalVisiblePixels",
value: function originalVisiblePixels() {
var i, pixelData, width;
var end;
if (!Caman.allowRevert) {
throw "Revert disabled";
}
var pixels = [];
var startX = this.cropCoordinates.x;
var endX = startX + this.width;
var startY = this.cropCoordinates.y;
var endY = startY + this.height;
if (this.resized) {
var _canvas = document.createElement('canvas');
_canvas.width = this.originalWidth;
_canvas.height = this.originalHeight;
var _ctx = _canvas.getContext('2d');
var _imageData = _ctx.getImageData(0, 0, _canvas.width, _canvas.height);
pixelData = _imageData.data;
for (i = 0; i < this.originalPixelData.length; i++) {
var pixel = this.originalPixelData[i];
pixelData[i] = pixel;
}
_ctx.putImageData(_imageData, 0, 0);
var scaledCanvas = document.createElement('canvas');
scaledCanvas.width = this.width;
scaledCanvas.height = this.height;
_ctx = scaledCanvas.getContext('2d');
_ctx.drawImage(_canvas, 0, 0, this.originalWidth, this.originalHeight, 0, 0, this.width, this.height);
pixelData = _ctx.getImageData(0, 0, this.width, this.height).data;
width = this.width;
} else if (this.rotated) {
var canvas = document.createElement('canvas'); //Canvas for initial state
canvas.width = this.originalWidth; //give it the original width
canvas.height = this.originalHeight; //and original height
var ctx = canvas.getContext('2d');
var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
pixelData = imageData.data; //get the pixelData (length equal to those of initial canvas
var _ref = this.originalPixelData; //use it as a reference array
var _i3, _i, _len, _pixel;
for (_i3 = _i = 0, _len = _ref.length; _i < _len; _i3 = ++_i) {
_pixel = _ref[_i3];
pixelData[_i3] = _pixel; //give pixelData the initial pixels
}
ctx.putImageData(imageData, 0, 0); //put it back on our canvas
var rotatedCanvas = document.createElement('canvas'); //canvas to rotate from initial
var rotatedCtx = rotatedCanvas.getContext('2d');
rotatedCanvas.width = this.canvas.width; //Our canvas was already rotated so it has been replaced. Caman's canvas attribute is allready rotated, So use that width
rotatedCanvas.height = this.canvas.height; //the same
var x = rotatedCanvas.width / 2; //for translating
var y = rotatedCanvas.height / 2; //same
rotatedCtx.save();
rotatedCtx.translate(x, y);
rotatedCtx.rotate(this.angle * Math.PI / 180); //rotation based on the total angle
rotatedCtx.drawImage(canvas, -canvas.width / 2, -canvas.height / 2, canvas.width, canvas.height); //put the image back on canvas
rotatedCtx.restore(); //restore it
pixelData = rotatedCtx.getImageData(0, 0, rotatedCanvas.width, rotatedCanvas.height).data; //get the pixelData back
width = rotatedCanvas.width; //used for returning the pixels in revert function
} else {
pixelData = this.originalPixelData;
width = this.originalWidth;
}
for (i = 0, end = pixelData.length; i < end; i += 4) {
var coord = Caman.Pixel.locationToCoordinates(i, width);
if (startX <= coord.x && coord.x < endX && startY <= coord.y && coord.y < endY) {
pixels.push(pixelData[i], pixelData[i + 1], pixelData[i + 2], pixelData[i + 3]);
}
}
return pixels;
} // Pushes the filter callback that modifies the RGBA object into the
// render queue.
//
// @param [String] name Name of the filter function.
// @param [Function] processFn The Filter function.
// @return [Caman]
}, {
key: "process",
value: function process(name, processFn) {
this.renderer.add({
type: Caman.Filter.Type.Single,
name: name,
processFn: processFn
});
return this;
} // Pushes the kernel into the render queue.
//
// @param [String] name The name of the kernel.
// @param [Array] adjust The convolution kernel represented as a 1D array.
// @param [Number] divisor The divisor for the convolution.
// @param [Number] bias The bias for the convolution.
// @return [Caman]
}, {
key: "processKernel",
value: function processKernel(name, adjust) {
var divisor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
var bias = arguments.length > 3 ? arguments[3] : undefined;
if (bias == null) {
bias = 0;
}
if (divisor == null) {
divisor = 0;
for (var i = 0, end = adjust.length, asc = 0 <= end; asc ? i < end : i > end; asc ? i++ : i--) {
divisor += adjust[i];
}
}
this.renderer.add({
type: Caman.Filter.Type.Kernel,
name: name,
adjust: adjust,
divisor: divisor,
bias: bias
});
return this;
} // Adds a standalone plugin into the render queue.
//
// @param [String] plugin Name of the plugin.
// @param [Array] args Array of arguments to pass to the plugin.
// @return [Caman]
}, {
key: "processPlugin",
value: function processPlugin(plugin, args) {
this.renderer.add({
type: Caman.Filter.Type.Plugin,
plugin: plugin,
args: args
});
return this;
} // Pushes a new layer operation into the render queue and calls the layer
// callback.
//
// @param [Function] callback Function that is executed within the context of the layer.
// All filter and adjustment functions for the layer will be executed inside of this function.
// @return [Caman]
}, {
key: "newLayer",
value: function newLayer(callback) {
var layer = new Caman.Layer(this);
this.canvasQueue.push(layer);
this.renderer.add({
type: Caman.Filter.Type.LayerDequeue
});
callback.call(layer);
this.renderer.add({
type: Caman.Filter.Type.LayerFinished
});
return this;
} // Pushes the layer context and moves to the next operation.
// @param [Layer] layer The layer to execute.
}, {
key: "executeLayer",
value: function executeLayer(layer) {
return this.pushContext(layer);
} // Set all of the relevant data to the new layer.
// @param [Layer] layer The layer whose context we want to switch to.
}, {
key: "pushContext",
value: function pushContext(layer) {
this.layerStack.push(this.currentLayer);
this.pixelStack.push(this.pixelData);
this.currentLayer = layer;
return this.pixelData = layer.pixelData;
} // Restore the previous layer context.
}, {
key: "popContext",
value: function popContext() {
this.pixelData = this.pixelStack.pop();
return this.currentLayer = this.layerStack.pop();
} // Applies the current layer to its parent layer.
}, {
key: "applyCurrentLayer",
value: function applyCurrentLayer() {
return this.currentLayer.applyToParent();
}
}, {
key: "save",
value: function save() {
return this.browserSave.apply(this, arguments);
}
}, {
key: "browserSave",
value: function browserSave(type) {
if (type == null) {
type = "png";
}
type = type.toLowerCase(); // Force download (its a bit hackish)
var image = this.toBase64(type).replace("image/".concat(type), "image/octet-stream");
return document.location.href = image;
}
}, {
key: "toImage",
value: // Takes the current canvas data, converts it to Base64, then sets it as the source
// of a new Image object and returns it.
function toImage(type) {
var img = new Image();
img.src = this.toBase64(type);
img.width = this.dimensions.width;
img.height = this.dimensions.height;
if (window.devicePixelRatio) {
img.width /= window.devicePixelRatio;
img.height /= window.devicePixelRatio;
}
return img;
}
}, {
key: "toBase64",
value: // Base64 encodes the current canvas
function toBase64(type) {
if (type == null) {
type = "png";
}
type = type.toLowerCase();
return this.canvas.toDataURL("image/".concat(type));
}
}], [{
key: "initClass",
value: function initClass() {
// The current version.
this.version = {
release: "4.1.2",
date: "7/27/2013"
}; // @property [Boolean] Debug mode enables console logging.
this.DEBUG = false; // @property [Boolean] Allow reverting the canvas?
// If your JS process is running out of memory, disabling
// this could help drastically.
this.allowRevert = true; // @property [String] Default cross-origin policy.
this.crossOrigin = "anonymous"; // @property [String] Set the URL of the image proxy script.
this.remoteProxy = ""; // @proparty [String] The GET param used with the proxy script.
this.proxyParam = "camanProxyUrl"; // @property [Boolean] Should we check the DOM for images with Caman instructions?
this.autoload = true; // @property [Integer] to know how many angles was the image rotated so I can get the correct imageData when rotate the new canvas
this.angle = 0; // @property [Boolean] if canvas was rotated
this.rotated = false;
} // Custom toString()
// @return [String] Version and release information.
}, {
key: "toString",
value: function toString() {
return "Version ".concat(Caman.version.release, ", Released ").concat(Caman.version.date);
} // Get the ID assigned to this canvas by Caman.
// @param [DOMObject] canvas The canvas to inspect.
// @return [String] The Caman ID associated with this canvas.
}, {
key: "getAttrId",
value: function getAttrId(canvas) {
if (typeof canvas === "string") {
canvas = Object(_util__WEBPACK_IMPORTED_MODULE_1__[/* $ */ "a"])(canvas);
}
if (canvas == null || canvas.getAttribute == null) {
return null;
}
return canvas.getAttribute('data-caman-id');
}
}]);
return Caman;
}(_module__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]);
Caman.initClass();
window.Caman = Caman;
/* unused harmony default export */ var _unused_webpack_default_export = (Caman);
/***/ }),
/* 39 */
/***/ (function(module, exports) {
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* DS202: Simplify dynamic range loops
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
// Various math-heavy helpers that are used throughout CamanJS.
var Calculate = /*#__PURE__*/function () {
function Calculate() {
_classCallCheck(this, Calculate);
}
_createClass(Calculate, null, [{
key: "distance",
value: // Calculates the distance between two points.
// @param [Number] x1 1st point x-coordinate.
// @param [Number] y1 1st point y-coordinate.
// @param [Number] x2 2nd point x-coordinate.
// @param [Number] y2 2nd point y-coordinate.
// @return [Number] The distance between the two points.
function distance(x1, y1, x2, y2) {
return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
} // Generates a pseudorandom number that lies within the max - mix range. The number can be either
// an integer or a float depending on what the user specifies.
// @param [Number] min The lower bound (inclusive).
// @param [Number] max The upper bound (inclusive).
// @param [Boolean] getFloat Return a Float or a rounded Integer?
// @return [Number] The pseudorandom number, either as a float or integer.
}, {
key: "randomRange",
value: function randomRange(min, max, getFloat) {
if (getFloat == null) {
getFloat = false;
}
var rand = min + Math.random() * (max - min);
if (getFloat) {
return rand.toFixed(getFloat);
} else {
return Math.round(rand);
}
} // Calculates the luminance of a single pixel using a special weighted sum.
// @param [Object] rgba RGBA object describing a single pixel.
// @return [Number] The luminance value of the pixel.
}, {
key: "luminance",
value: function luminance(rgba) {
return 0.299 * rgba.r + 0.587 * rgba.g + 0.114 * rgba.b;
} // Generates a bezier curve given a start and end point, with control points in between.
// Can also optionally bound the y values between a low and high bound.
//
// This is different than most bezier curve functions because it attempts to construct it in such
// a way that we can use it more like a simple input -> output system, or a one-to-one function.
// In other words we can provide an input color value, and immediately receive an output modified
// color value.
//
// Note that, by design, this does not force X values to be in the range [0..255]. This is to
// generalize the function a bit more. If you give it a starting X value that isn't 0, and/or a
// ending X value that isn't 255, you may run into problems with your filter!
//
// @param [Array] 2-item arrays describing the x, y coordinates of the control points. Minimum two.
// @param [Number] lowBound (optional) Minimum possible value for any y-value in the curve.
// @param [Number] highBound (optional) Maximum posisble value for any y-value in the curve.
// @return [Array] Array whose index represents every x-value between start and end, and value
// represents the corresponding y-value.
}, {
key: "bezier",
value: function bezier(start, ctrl1, ctrl2, end, lowBound, highBound) {
//(controlPoints, lowBound, highBound) ->
// 4.0 shim - change declaration to (controlPoints, lowBound, highBound) at 5.0
var controlPoints;
if (lowBound == null) {
lowBound = 0;
}
if (highBound == null) {
highBound = 255;
}
if (start[0] instanceof Array) {
controlPoints = start;
lowBound = ctrl1;
highBound = ctrl2;
} else {
controlPoints = [start, ctrl1, ctrl2, end];
}
if (controlPoints.length < 2) {
throw "Invalid number of arguments to bezier";
}
var bezier = {};
var lerp = function lerp(a, b, t) {
return a * (1 - t) + b * t;
};
var clamp = function clamp(a, min, max) {
return Math.min(Math.max(a, min), max);
};
for (var i = 0; i < 1000; i++) {
var t = i / 1000;
var prev = controlPoints;
while (prev.length > 1) {
var next = [];
for (var j = 0, end1 = prev.length - 2, asc = 0 <= end1; asc ? j <= end1 : j >= end1; asc ? j++ : j--) {
next.push([lerp(prev[j][0], prev[j + 1][0], t), lerp(prev[j][1], prev[j + 1][1], t)]);
}
prev = next;
}
bezier[Math.round(prev[0][0])] = Math.round(clamp(prev[0][1], lowBound, highBound));
}
var endX = controlPoints[controlPoints.length - 1][0];
bezier = Caman.Calculate.missingValues(bezier, endX); // Edge case
if (bezier[endX] == null) {
bezier[endX] = bezier[endX - 1];
}
return bezier;
} // Generates a hermite curve given a start and end point, with control points in between.
// Can also optionally bound the y values between a low and high bound.
//
// This is different than most hermite curve functions because it attempts to construct it in such
// a way that we can use it more like a simple input -> output system, or a one-to-one function.
// In other words we can provide an input color value, and immediately receive an output modified
// color value.
//
// Note that, by design, this does not force X values to be in the range [0..255]. This is to
// generalize the function a bit more. If you give it a starting X value that isn't 0, and/or a
// ending X value that isn't 255, you may run into problems with your filter!
//
// @param [Array] 2-item arrays describing the x, y coordinates of the control points. Minimum two.
// @param [Number] lowBound (optional) Minimum possible value for any y-value in the curve.
// @param [Number] highBound (optional) Maximum possible value for any y-value in the curve.
// @return [Array] Array whose index represents every x-value between start and end, and value
// represents the corresponding y-value.
}, {
key: "hermite",
value: function hermite(controlPoints, lowBound, highBound) {
if (controlPoints.length < 2) {
throw "Invalid number of arguments to hermite";
}
var ret = {};
var lerp = function lerp(a, b, t) {
return a * (1 - t) + b * t;
};
var add = function add(a, b, c, d) {
return [a[0] + b[0] + c[0] + d[0], a[1] + b[1] + c[1] + d[1]];
};
var mul = function mul(a, b) {
return [a[0] * b[0], a[1] * b[1]];
};
var sub = function sub(a, b) {
return [a[0] - b[0], a[1] - b[1]];
};
var clamp = function clamp(a, min, max) {
return Math.min(Math.max(a, min), max);
};
var count = 0;
for (var i = 0, end = controlPoints.length - 2, asc = 0 <= end; asc ? i <= end : i >= end; asc ? i++ : i--) {
var p0 = controlPoints[i];
var p1 = controlPoints[i + 1];
var pointsPerSegment = p1[0] - p0[0];
var pointsPerStep = 1 / pointsPerSegment; // the last point of the last segment should reach p1
if (i === controlPoints.length - 2) {
pointsPerStep = 1 / (pointsPerSegment - 1);
}
var p = i > 0 ? controlPoints[i - 1] : p0;
var m0 = mul(sub(p1, p), [0.5, 0.5]);
p = i < controlPoints.length - 2 ? controlPoints[i + 2] : p1;
var m1 = mul(sub(p, p0), [0.5, 0.5]);
for (var j = 0, end1 = pointsPerSegment, asc1 = 0 <= end1; asc1 ? j <= end1 : j >= end1; asc1 ? j++ : j--) {
var t = j * pointsPerStep;
var fac0 = 2.0 * t * t * t - 3.0 * t * t + 1.0;
var fac1 = t * t * t - 2.0 * t * t + t;
var fac2 = -2.0 * t * t * t + 3.0 * t * t;
var fac3 = t * t * t - t * t;
var pos = add(mul(p0, [fac0, fac0]), mul(m0, [fac1, fac1]), mul(p1, [fac2, fac2]), mul(m1, [fac3, fac3]));
ret[Math.round(pos[0])] = Math.round(clamp(pos[1], lowBound, highBound));
count += 1;
}
} // add missing values
var endX = controlPoints[controlPoints.length - 1][0];
ret = Caman.Calculate.missingValues(ret, endX);
return ret;
} // Calculates possible missing values from a given value array. Note that this returns a copy
// and does not mutate the original. In case no values are missing the original array is
// returned as that is convenient.
//
// @param [Array] 2-item arrays describing the x, y coordinates of the control points.
// @param [Number] end x value of the array (maximum)
// @return [Array] Array whose index represents every x-value between start and end, and value
// represents the corresponding y-value.
}, {
key: "missingValues",
value: function missingValues(values, endX) {
// Do a search for missing values in the bezier array and use linear
// interpolation to approximate their values
var i, j, leftCoord, ret, rightCoord, _i, _j;
if (Object.keys(values).length < endX + 1) {
ret = {};
for (i = _i = 0; 0 <= endX ? _i <= endX : _i >= endX; i = 0 <= endX ? ++_i : --_i) {
if (values[i] != null) {
ret[i] = values[i];
} else {
leftCoord = [i - 1, ret[i - 1]];
for (j = _j = i; i <= endX ? _j <= endX : _j >= endX; j = i <= endX ? ++_j : --_j) {
if (values[j] != null) {
rightCoord = [j, values[j]];
break;
}
}
if (!rightCoord) {
rightCoord = [0, 0];
}
ret[i] = leftCoord[1] + (rightCoord[1] - leftCoord[1]) / (rightCoord[0] - leftCoord[0]) * (i - leftCoord[0]);
}
}
return ret;
}
return values;
}
}]);
return Calculate;
}();
Caman.Calculate = Calculate;
/***/ }),
/* 40 */
/***/ (function(module, exports) {
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* DS205: Consider reworking code to avoid use of IIFEs
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
// Tons of color conversion utility functions.
var Convert = /*#__PURE__*/function () {
function Convert() {
_classCallCheck(this, Convert);
}
_createClass(Convert, null, [{
key: "hexToRGB",
value: // Converts the hex representation of a color to RGB values.
// Hex value can optionally start with the hash (#).
//
// @param [String] hex The colors hex value
// @return [Array] The RGB representation
function hexToRGB(hex) {
if (hex.charAt(0) === "#") {
hex = hex.substr(1);
}
var r = parseInt(hex.substr(0, 2), 16);
var g = parseInt(hex.substr(2, 2), 16);
var b = parseInt(hex.substr(4, 2), 16);
return {
r: r,
g: g,
b: b
};
} // Converts an RGB color to HSL.
// Assumes r, g, and b are in the set [0, 255] and
// returns h, s, and l in the set [0, 1].
//
// @overload rgbToHSL(r, g, b)
// @param [Number] r Red channel
// @param [Number] g Green channel
// @param [Number] b Blue channel
//
// @overload rgbToHSL(rgb)
// @param [Object] rgb The RGB object.
// @option rgb [Number] r The red channel.
// @option rgb [Number] g The green channel.
// @option rgb [Number] b The blue channel.
//
// @return [Array] The HSL representation
}, {
key: "rgbToHSL",
value: function rgbToHSL(r, g, b) {
var h, s;
if (_typeof(r) === "object") {
var _r = r;
g = _r.g;
var _r2 = r;
b = _r2.b;
var _r3 = r;
r = _r3.r;
}
r /= 255;
g /= 255;
b /= 255;
var max = Math.max(r, g, b);
var min = Math.min(r, g, b);
var l = (max + min) / 2;
if (max === min) {
h = s = 0;
} else {
var d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
h = function () {
switch (max) {
case r:
return (g - b) / d + (g < b ? 6 : 0);
case g:
return (b - r) / d + 2;
case b:
return (r - g) / d + 4;
}
}();
h /= 6;
}
return {
h: h,
s: s,
l: l
};
} // Converts an HSL color value to RGB. Conversion formula
// adapted from http://en.wikipedia.org/wiki/HSL_color_space.
// Assumes h, s, and l are contained in the set [0, 1] and
// returns r, g, and b in the set [0, 255].
//
// @overload hslToRGB(h, s, l)
// @param [Number] h The hue
// @param [Number] s The saturation
// @param [Number] l The lightness
//
// @overload hslToRGB(hsl)
// @param [Object] hsl The HSL object.
// @option hsl [Number] h The hue.
// @option hsl [Number] s The saturation.
// @option hsl [Number] l The lightness.
//
// @return [Array] The RGB representation
}, {
key: "hslToRGB",
value: function hslToRGB(h, s, l) {
var b, g, r;
if (_typeof(h) === "object") {
var _h = h;
s = _h.s;
var _h2 = h;
l = _h2.l;
var _h3 = h;
h = _h3.h;
}
if (s === 0) {
r = g = b = l;
} else {
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
var p = 2 * l - q;
r = this.hueToRGB(p, q, h + 1 / 3);
g = this.hueToRGB(p, q, h);
b = this.hueToRGB(p, q, h - 1 / 3);
}
return {
r: r * 255,
g: g * 255,
b: b * 255
};
} // Converts from the hue color space back to RGB.
//
// @param [Number] p
// @param [Number] q
// @param [Number] t
// @return [Number] RGB value
}, {
key: "hueToRGB",
value: function hueToRGB(p, q, t) {
if (t < 0) {
t += 1;
}
if (t > 1) {
t -= 1;
}
if (t < 1 / 6) {
return p + (q - p) * 6 * t;
}
if (t < 1 / 2) {
return q;
}
if (t < 2 / 3) {
return p + (q - p) * (2 / 3 - t) * 6;
}
return p;
} // Converts an RGB color value to HSV. Conversion formula
// adapted from {http://en.wikipedia.org/wiki/HSV_color_space}.
// Assumes r, g, and b are contained in the set [0, 255] and
// returns h, s, and v in the set [0, 1].
//
// @param [Number] r The red color value
// @param [Number] g The green color value
// @param [Number] b The blue color value
// @return [Array] The HSV representation
}, {
key: "rgbToHSV",
value: function rgbToHSV(r, g, b) {
var h;
r /= 255;
g /= 255;
b /= 255;
var max = Math.max(r, g, b);
var min = Math.min(r, g, b);
var v = max;
var d = max - min;
var s = max === 0 ? 0 : d / max;
if (max === min) {
h = 0;
} else {
h = function () {
switch (max) {
case r:
return (g - b) / d + (g < b ? 6 : 0);
case g:
return (b - r) / d + 2;
case b:
return (r - g) / d + 4;
}
}();
h /= 6;
}
return {
h: h,
s: s,
v: v
};
} // Converts an HSV color value to RGB. Conversion formula
// adapted from http://en.wikipedia.org/wiki/HSV_color_space.
// Assumes h, s, and v are contained in the set [0, 1] and
// returns r, g, and b in the set [0, 255].
//
// @param [Number] h The hue
// @param [Number] s The saturation
// @param [Number] v The value
// @return [Array] The RGB representation
}, {
key: "hsvToRGB",
value: function hsvToRGB(h, s, v) {
var b, g, r;
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 {
r: Math.floor(r * 255),
g: Math.floor(g * 255),
b: Math.floor(b * 255)
};
} // Converts a RGB color value to the XYZ color space. Formulas
// are based on http://en.wikipedia.org/wiki/SRGB assuming that
// RGB values are sRGB.
//
// Assumes r, g, and b are contained in the set [0, 255] and
// returns x, y, and z.
//
// @param [Number] r The red color value
// @param [Number] g The green color value
// @param [Number] b The blue color value
// @return [Array] The XYZ representation
}, {
key: "rgbToXYZ",
value: function rgbToXYZ(r, g, b) {
r /= 255;
g /= 255;
b /= 255;
if (r > 0.04045) {
r = Math.pow((r + 0.055) / 1.055, 2.4);
} else {
r /= 12.92;
}
if (g > 0.04045) {
g = Math.pow((g + 0.055) / 1.055, 2.4);
} else {
g /= 12.92;
}
if (b > 0.04045) {
b = Math.pow((b + 0.055) / 1.055, 2.4);
} else {
b /= 12.92;
}
var x = r * 0.4124 + g * 0.3576 + b * 0.1805;
var y = r * 0.2126 + g * 0.7152 + b * 0.0722;
var z = r * 0.0193 + g * 0.1192 + b * 0.9505;
return {
x: x * 100,
y: y * 100,
z: z * 100
};
} // Converts a XYZ color value to the sRGB color space. Formulas
// are based on http://en.wikipedia.org/wiki/SRGB and the resulting
// RGB value will be in the sRGB color space.
// Assumes x, y and z values are whatever they are and returns
// r, g and b in the set [0, 255].
//
// @param [Number] x The X value
// @param [Number] y The Y value
// @param [Number] z The Z value
// @return [Array] The RGB representation
}, {
key: "xyzToRGB",
value: function xyzToRGB(x, y, z) {
x /= 100;
y /= 100;
z /= 100;
var r = 3.2406 * x + -1.5372 * y + -0.4986 * z;
var g = -0.9689 * x + 1.8758 * y + 0.0415 * z;
var b = 0.0557 * x + -0.2040 * y + 1.0570 * z;
if (r > 0.0031308) {
r = 1.055 * Math.pow(r, 0.4166666667) - 0.055;
} else {
r *= 12.92;
}
if (g > 0.0031308) {
g = 1.055 * Math.pow(g, 0.4166666667) - 0.055;
} else {
g *= 12.92;
}
if (b > 0.0031308) {
b = 1.055 * Math.pow(b, 0.4166666667) - 0.055;
} else {
b *= 12.92;
}
return {
r: r * 255,
g: g * 255,
b: b * 255
};
} // Converts a XYZ color value to the CIELAB color space. Formulas
// are based on http://en.wikipedia.org/wiki/Lab_color_space
// The reference white point used in the conversion is D65.
// Assumes x, y and z values are whatever they are and returns
// L*, a* and b* values
//
// @overload xyzToLab(x, y, z)
// @param [Number] x The X value
// @param [Number] y The Y value
// @param [Number] z The Z value
//
// @overload xyzToLab(xyz)
// @param [Object] xyz The XYZ object.
// @option xyz [Number] x The X value.
// @option xyz [Number] y The Y value.
// @option xyz [Number] z The z value.
//
// @return [Array] The Lab representation
}, {
key: "xyzToLab",
value: function xyzToLab(x, y, z) {
if (_typeof(x) === "object") {
var _x = x;
y = _x.y;
var _x2 = x;
z = _x2.z;
var _x3 = x;
x = _x3.x;
}
var whiteX = 95.047;
var whiteY = 100.0;
var whiteZ = 108.883;
x /= whiteX;
y /= whiteY;
z /= whiteZ;
if (x > 0.008856451679) {
x = Math.pow(x, 0.3333333333);
} else {
x = 7.787037037 * x + 0.1379310345;
}
if (y > 0.008856451679) {
y = Math.pow(y, 0.3333333333);
} else {
y = 7.787037037 * y + 0.1379310345;
}
if (z > 0.008856451679) {
z = Math.pow(z, 0.3333333333);
} else {
z = 7.787037037 * z + 0.1379310345;
}
var l = 116 * y - 16;
var a = 500 * (x - y);
var b = 200 * (y - z);
return {
l: l,
a: a,
b: b
};
} // Converts a L*, a*, b* color values from the CIELAB color space
// to the XYZ color space. Formulas are based on
// http://en.wikipedia.org/wiki/Lab_color_space
//
// The reference white point used in the conversion is D65.
// Assumes L*, a* and b* values are whatever they are and returns
// x, y and z values.
//
// @overload labToXYZ(l, a, b)
// @param [Number] l The L* value
// @param [Number] a The a* value
// @param [Number] b The b* value
//
// @overload labToXYZ(lab)
// @param [Object] lab The LAB values
// @option lab [Number] l The L* value.
// @option lab [Number] a The a* value.
// @option lab [Number] b The b* value.
//
// @return [Array] The XYZ representation
}, {
key: "labToXYZ",
value: function labToXYZ(l, a, b) {
if (_typeof(l) === "object") {
var _l = l;
a = _l.a;
var _l2 = l;
b = _l2.b;
var _l3 = l;
l = _l3.l;
}
var y = (l + 16) / 116;
var x = y + a / 500;
var z = y - b / 200;
if (x > 0.2068965517) {
x = x * x * x;
} else {
x = 0.1284185493 * (x - 0.1379310345);
}
if (y > 0.2068965517) {
y = y * y * y;
} else {
y = 0.1284185493 * (y - 0.1379310345);
}
if (z > 0.2068965517) {
z = z * z * z;
} else {
z = 0.1284185493 * (z - 0.1379310345);
} // D65 reference white point
return {
x: x * 95.047,
y: y * 100.0,
z: z * 108.883
};
} // Converts L*, a*, b* back to RGB values.
//
// @see Convert.rgbToXYZ
// @see Convert.xyzToLab
}, {
key: "rgbToLab",
value: function rgbToLab(r, g, b) {
if (_typeof(r) === "object") {
var _r4 = r;
g = _r4.g;
var _r5 = r;
b = _r5.b;
var _r6 = r;
r = _r6.r;
}
var xyz = this.rgbToXYZ(r, g, b);
return this.xyzToLab(xyz);
}
}, {
key: "labToRGB",
value: function labToRGB(l, a, b) {}
}]);
return Convert;
}();
Caman.Convert = Convert;
/***/ }),
/* 41 */
/***/ (function(module, exports) {
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/*
* decaffeinate suggestions:
* DS101: Remove unnecessary use of Array.from
* DS102: Remove unnecessary code created because of implicit returns
* DS205: Consider reworking code to avoid use of IIFEs
* DS206: Consider reworking classes to avoid initClass
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
// Event system that can be used to register callbacks that get fired
// during certain times in the render process.
var Event = /*#__PURE__*/function () {
function Event() {
_classCallCheck(this, Event);
}
_createClass(Event, null, [{
key: "initClass",
value: function initClass() {
this.events = {}; // All of the supported event types
this.types = ["processStart", "processComplete", "renderStart", "renderFinished", "blockStarted", "blockFinished"];
} // Trigger an event.
// @param [Caman] target Instance of Caman emitting the event.
// @param [String] type The event type.
// @param [Object] data Extra data to send with the event.
}, {
key: "trigger",
value: function trigger(target, type) {
var _this = this;
var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
if (this.events[type] && this.events[type].length) {
return function () {
var result = [];
for (var _i = 0, _Array$from = Array.from(_this.events[type]); _i < _Array$from.length; _i++) {
var event = _Array$from[_i];
if (event.target === null || target.id === event.target.id) {
result.push(event.fn.call(target, data));
} else {
result.push(undefined);
}
}
return result;
}();
}
} // Listen for an event. Optionally bind the listen to a single instance
// or all instances.
//
// @overload listen(target, type, fn)
// Listen for events emitted from a particular Caman instance.
// @param [Caman] target The instance to listen to.
// @param [String] type The type of event to listen for.
// @param [Function] fn The function to call when the event occurs.
//
// @overload listen(type, fn)
// Listen for an event from all Caman instances.
// @param [String] type The type of event to listen for.
// @param [Function] fn The function to call when the event occurs.
}, {
key: "listen",
value: function listen(target, type, fn) {
// Adjust arguments if target is omitted
if (typeof target === "string") {
var _type = target;
var _fn = type;
target = null;
type = _type;
fn = _fn;
} // Validation
if (!Array.from(this.types).includes(type)) {
return false;
}
if (!this.events[type]) {
this.events[type] = [];
}
this.events[type].push({
target: target,
fn: fn
});
return true;
}
}]);
return Event;
}();
Event.initClass();
Caman.Event = Event;
/***/ }),
/* 42 */
/***/ (function(module, exports) {
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/*
* decaffeinate suggestions:
* DS206: Consider reworking classes to avoid initClass
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
// Responsible for registering and storing all of the filters.
var Filter = /*#__PURE__*/function () {
function Filter() {
_classCallCheck(this, Filter);
}
_createClass(Filter, null, [{
key: "initClass",
value: function initClass() {
// All of the different render operatives
this.Type = {
Single: 1,
Kernel: 2,
LayerDequeue: 3,
LayerFinished: 4,
LoadOverlay: 5,
LoadLayerMask: 7,
Plugin: 6
};
} // Registers a filter function.
// @param [String] name The name of the filter.
// @param [Function] filterFunc The filter function.
}, {
key: "register",
value: function register(name, filterFunc) {
return window.Caman.prototype[name] = filterFunc;
}
}]);
return Filter;
}();
Filter.initClass();
Caman.Filter = Filter;
/***/ }),
/* 43 */
/***/ (function(module, exports) {
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
// Represents a single Pixel in an image.
var Pixel = /*#__PURE__*/function () {
function Pixel(r, g, b, a) {
var c = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
_classCallCheck(this, Pixel);
if (r == null) {
r = 0;
}
this.r = r;
if (g == null) {
g = 0;
}
this.g = g;
if (b == null) {
b = 0;
}
this.b = b;
if (a == null) {
a = 255;
}
this.a = a;
this.c = c;
this.loc = 0;
}
_createClass(Pixel, [{
key: "setContext",
value: function setContext(c) {
return this.c = c;
} // Retrieves the X, Y location of the current pixel. The origin is at the bottom left corner of
// the image, like a normal coordinate system.
}, {
key: "locationXY",
value: function locationXY() {
if (this.c == null) {
throw "Requires a CamanJS context";
}
var y = this.c.dimensions.height - Math.floor(this.loc / (this.c.dimensions.width * 4));
var x = this.loc % (this.c.dimensions.width * 4) / 4;
return {
x: x,
y: y
};
}
}, {
key: "pixelAtLocation",
value: function pixelAtLocation(loc) {
if (this.c == null) {
throw "Requires a CamanJS context";
}
return new Pixel(this.c.pixelData[loc], this.c.pixelData[loc + 1], this.c.pixelData[loc + 2], this.c.pixelData[loc + 3], this.c);
} // Returns an RGBA object for a pixel whose location is specified in relation to the current
// pixel.
}, {
key: "getPixelRelative",
value: function getPixelRelative(horiz, vert) {
if (this.c == null) {
throw "Requires a CamanJS context";
} // We invert the vert_offset in order to make the coordinate system non-inverted. In laymans
// terms: -1 means down and +1 means up.
var newLoc = this.loc + this.c.dimensions.width * 4 * (vert * -1) + 4 * horiz;
if (newLoc > this.c.pixelData.length || newLoc < 0) {
return new Pixel(0, 0, 0, 255, this.c);
}
return this.pixelAtLocation(newLoc);
} // The counterpart to getPixelRelative, this updates the value of a pixel whose location is
// specified in relation to the current pixel.
}, {
key: "putPixelRelative",
value: function putPixelRelative(horiz, vert, rgba) {
if (this.c == null) {
throw "Requires a CamanJS context";
}
var nowLoc = this.loc + this.c.dimensions.width * 4 * (vert * -1) + 4 * horiz;
if (newLoc > this.c.pixelData.length || newLoc < 0) {
return;
}
this.c.pixelData[newLoc] = rgba.r;
this.c.pixelData[newLoc + 1] = rgba.g;
this.c.pixelData[newLoc + 2] = rgba.b;
this.c.pixelData[newLoc + 3] = rgba.a;
return true;
} // Gets an RGBA object for an arbitrary pixel in the canvas specified by absolute X, Y coordinates
}, {
key: "getPixel",
value: function getPixel(x, y) {
if (this.c == null) {
throw "Requires a CamanJS context";
}
var loc = this.coordinatesToLocation(x, y, this.width);
return this.pixelAtLocation(loc);
} // Updates the pixel at the given X, Y coordinate
}, {
key: "putPixel",
value: function putPixel(x, y, rgba) {
if (this.c == null) {
throw "Requires a CamanJS context";
}
var loc = this.coordinatesToLocation(x, y, this.width);
this.c.pixelData[loc] = rgba.r;
this.c.pixelData[loc + 1] = rgba.g;
this.c.pixelData[loc + 2] = rgba.b;
return this.c.pixelData[loc + 3] = rgba.a;
}
}, {
key: "toString",
value: function toString() {
return this.toKey();
}
}, {
key: "toHex",
value: function toHex(includeAlpha) {
if (includeAlpha == null) {
includeAlpha = false;
}
var hex = '#' + this.r.toString(16) + this.g.toString(16) + this.b.toString(16);
if (includeAlpha) {
return hex + this.a.toString(16);
} else {
return hex;
}
}
}], [{
key: "coordinatesToLocation",
value: function coordinatesToLocation(x, y, width) {
return (y * width + x) * 4;
}
}, {
key: "locationToCoordinates",
value: function locationToCoordinates(loc, width) {
var y = Math.floor(loc / (width * 4));
var x = loc % (width * 4) / 4;
return {
x: x,
y: y
};
}
}]);
return Pixel;
}();
Caman.Pixel = Pixel;
/***/ }),
/* 44 */
/***/ (function(module, exports) {
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var Plugin = /*#__PURE__*/function () {
function Plugin() {
_classCallCheck(this, Plugin);
}
_createClass(Plugin, null, [{
key: "initClass",
value: function initClass() {
this.plugins = {};
}
}, {
key: "register",
value: function register(name, plugin) {
return this.plugins[name] = plugin;
}
}, {
key: "execute",
value: function execute(context, name, args) {
return this.plugins[name].apply(context, args);
}
}]);
return Plugin;
}();
Plugin.initClass();
Caman.Plugin = Plugin;
/***/ }),
/* 45 */
/***/ (function(module, exports) {
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
Caman.Filter.register("fillColor", function () {
var color;
if (arguments.length === 1) {
color = Caman.Convert.hexToRGB(arguments[0]);
} else {
color = {
r: arguments[0],
g: arguments[1],
b: arguments[2]
};
}
return this.process("fillColor", function (rgba) {
rgba.r = color.r;
rgba.g = color.g;
rgba.b = color.b;
rgba.a = 255;
return rgba;
});
});
Caman.Filter.register("brightness", function (adjust) {
adjust = Math.floor(255 * (adjust / 100));
return this.process("brightness", function (rgba) {
rgba.r += adjust;
rgba.g += adjust;
rgba.b += adjust;
return rgba;
});
});
Caman.Filter.register("saturation", function (adjust) {
adjust *= -0.01;
return this.process("saturation", function (rgba) {
var max;
max = Math.max(rgba.r, rgba.g, rgba.b);
if (rgba.r !== max) {
rgba.r += (max - rgba.r) * adjust;
}
if (rgba.g !== max) {
rgba.g += (max - rgba.g) * adjust;
}
if (rgba.b !== max) {
rgba.b += (max - rgba.b) * adjust;
}
return rgba;
});
});
Caman.Filter.register("vibrance", function (adjust) {
adjust *= -1;
return this.process("vibrance", function (rgba) {
var amt, avg, max;
max = Math.max(rgba.r, rgba.g, rgba.b);
avg = (rgba.r + rgba.g + rgba.b) / 3;
amt = Math.abs(max - avg) * 2 / 255 * adjust / 100;
if (rgba.r !== max) {
rgba.r += (max - rgba.r) * amt;
}
if (rgba.g !== max) {
rgba.g += (max - rgba.g) * amt;
}
if (rgba.b !== max) {
rgba.b += (max - rgba.b) * amt;
}
return rgba;
});
});
Caman.Filter.register("greyscale", function (adjust) {
return this.process("greyscale", function (rgba) {
var avg;
avg = Caman.Calculate.luminance(rgba);
rgba.r = avg;
rgba.g = avg;
rgba.b = avg;
return rgba;
});
});
Caman.Filter.register("contrast", function (adjust) {
adjust = Math.pow((adjust + 100) / 100, 2);
return this.process("contrast", function (rgba) {
rgba.r /= 255;
rgba.r -= 0.5;
rgba.r *= adjust;
rgba.r += 0.5;
rgba.r *= 255;
rgba.g /= 255;
rgba.g -= 0.5;
rgba.g *= adjust;
rgba.g += 0.5;
rgba.g *= 255;
rgba.b /= 255;
rgba.b -= 0.5;
rgba.b *= adjust;
rgba.b += 0.5;
rgba.b *= 255;
return rgba;
});
});
Caman.Filter.register("hue", function (adjust) {
return this.process("hue", function (rgba) {
var b, g, h, hsv, r, _ref;
hsv = Caman.Convert.rgbToHSV(rgba.r, rgba.g, rgba.b);
h = hsv.h * 100;
h += Math.abs(adjust);
h = h % 100;
h /= 100;
hsv.h = h;
_ref = Caman.Convert.hsvToRGB(hsv.h, hsv.s, hsv.v), r = _ref.r, g = _ref.g, b = _ref.b;
rgba.r = r;
rgba.g = g;
rgba.b = b;
return rgba;
});
});
Caman.Filter.register("colorize", function () {
var level, rgb;
if (arguments.length === 2) {
rgb = Caman.Convert.hexToRGB(arguments[0]);
level = arguments[1];
} else if (arguments.length === 4) {
rgb = {
r: arguments[0],
g: arguments[1],
b: arguments[2]
};
level = arguments[3];
}
return this.process("colorize", function (rgba) {
rgba.r -= (rgba.r - rgb.r) * (level / 100);
rgba.g -= (rgba.g - rgb.g) * (level / 100);
rgba.b -= (rgba.b - rgb.b) * (level / 100);
return rgba;
});
});
Caman.Filter.register("invert", function () {
return this.process("invert", function (rgba) {
rgba.r = 255 - rgba.r;
rgba.g = 255 - rgba.g;
rgba.b = 255 - rgba.b;
return rgba;
});
});
Caman.Filter.register("sepia", function (adjust) {
if (adjust == null) {
adjust = 100;
}
adjust /= 100;
return this.process("sepia", function (rgba) {
rgba.r = Math.min(255, rgba.r * (1 - 0.607 * adjust) + rgba.g * (0.769 * adjust) + rgba.b * (0.189 * adjust));
rgba.g = Math.min(255, rgba.r * (0.349 * adjust) + rgba.g * (1 - 0.314 * adjust) + rgba.b * (0.168 * adjust));
rgba.b = Math.min(255, rgba.r * (0.272 * adjust) + rgba.g * (0.534 * adjust) + rgba.b * (1 - 0.869 * adjust));
return rgba;
});
});
Caman.Filter.register("gamma", function (adjust) {
return this.process("gamma", function (rgba) {
rgba.r = Math.pow(rgba.r / 255, adjust) * 255;
rgba.g = Math.pow(rgba.g / 255, adjust) * 255;
rgba.b = Math.pow(rgba.b / 255, adjust) * 255;
return rgba;
});
});
Caman.Filter.register("noise", function (adjust) {
adjust = Math.abs(adjust) * 2.55;
return this.process("noise", function (rgba) {
var rand;
rand = Caman.Calculate.randomRange(adjust * -1, adjust);
rgba.r += rand;
rgba.g += rand;
rgba.b += rand;
return rgba;
});
});
Caman.Filter.register("clip", function (adjust) {
adjust = Math.abs(adjust) * 2.55;
return this.process("clip", function (rgba) {
if (rgba.r > 255 - adjust) {
rgba.r = 255;
} else if (rgba.r < adjust) {
rgba.r = 0;
}
if (rgba.g > 255 - adjust) {
rgba.g = 255;
} else if (rgba.g < adjust) {
rgba.g = 0;
}
if (rgba.b > 255 - adjust) {
rgba.b = 255;
} else if (rgba.b < adjust) {
rgba.b = 0;
}
return rgba;
});
});
Caman.Filter.register("channels", function (options) {
var chan, value;
if (_typeof(options) !== "object") {
return this;
}
for (chan in options) {
if (!{}.hasOwnProperty.call(options, chan)) continue;
value = options[chan];
if (value === 0) {
delete options[chan];
continue;
}
options[chan] /= 100;
}
if (options.length === 0) {
return this;
}
return this.process("channels", function (rgba) {
if (options.red != null) {
if (options.red > 0) {
rgba.r += (255 - rgba.r) * options.red;
} else {
rgba.r -= rgba.r * Math.abs(options.red);
}
}
if (options.green != null) {
if (options.green > 0) {
rgba.g += (255 - rgba.g) * options.green;
} else {
rgba.g -= rgba.g * Math.abs(options.green);
}
}
if (options.blue != null) {
if (options.blue > 0) {
rgba.b += (255 - rgba.b) * options.blue;
} else {
rgba.b -= rgba.b * Math.abs(options.blue);
}
}
return rgba;
});
});
Caman.Filter.register("curves", function () {
var algo, bezier, chans, cps, end, i, last, start, _i, _j, _ref, _ref1;
chans = arguments[0], cps = 2 <= arguments.length ? [].slice.call(arguments, 1) : [];
last = cps[cps.length - 1];
if (typeof last === "function") {
algo = last;
cps.pop();
} else if (typeof last === "string") {
algo = Caman.Calculate[last];
cps.pop();
} else {
algo = Caman.Calculate.bezier;
}
if (typeof chans === "string") {
chans = chans.split("");
}
if (chans[0] === "v") {
chans = ['r', 'g', 'b'];
}
if (cps.length < 2) {
throw "Invalid number of arguments to curves filter";
}
bezier = algo(cps, 0, 255);
start = cps[0];
if (start[0] > 0) {
for (i = _i = 0, _ref = start[0]; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
bezier[i] = start[1];
}
}
end = cps[cps.length - 1];
if (end[0] < 255) {
for (i = _j = _ref1 = end[0]; _ref1 <= 255 ? _j <= 255 : _j >= 255; i = _ref1 <= 255 ? ++_j : --_j) {
bezier[i] = end[1];
}
}
return this.process("curves", function (rgba) {
var _k, _ref2;
for (i = _k = 0, _ref2 = chans.length; 0 <= _ref2 ? _k < _ref2 : _k > _ref2; i = 0 <= _ref2 ? ++_k : --_k) {
rgba[chans[i]] = bezier[rgba[chans[i]]];
}
return rgba;
});
});
Caman.Filter.register("exposure", function (adjust) {
var ctrl1, ctrl2, p;
p = Math.abs(adjust) / 100;
ctrl1 = [0, 255 * p];
ctrl2 = [255 - 255 * p, 255];
if (adjust < 0) {
ctrl1 = ctrl1.reverse();
ctrl2 = ctrl2.reverse();
}
return this.curves('rgb', [0, 0], ctrl1, ctrl2, [255, 255]);
});
/***/ }),
/* 46 */
/***/ (function(module, exports) {
Caman.Filter.register("boxBlur", function () {
return this.processKernel("Box Blur", [1, 1, 1, 1, 1, 1, 1, 1, 1]);
});
Caman.Filter.register("heavyRadialBlur", function () {
return this.processKernel("Heavy Radial Blur", [0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0]);
});
Caman.Filter.register("gaussianBlur", function () {
return this.processKernel("Gaussian Blur", [1, 4, 6, 4, 1, 4, 16, 24, 16, 4, 6, 24, 36, 24, 6, 4, 16, 24, 16, 4, 1, 4, 6, 4, 1]);
});
Caman.Filter.register("motionBlur", function (degrees) {
var kernel;
if (degrees === 0 || degrees === 180) {
kernel = [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0];
} else if (degrees > 0 && degrees < 90 || degrees > 180 && degrees < 270) {
kernel = [0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0];
} else if (degrees === 90 || degrees === 270) {
kernel = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
} else {
kernel = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1];
}
return this.processKernel("Motion Blur", kernel);
});
Caman.Filter.register("sharpen", function (amt) {
if (amt == null) {
amt = 100;
}
amt /= 100;
return this.processKernel("Sharpen", [0, -amt, 0, -amt, 4 * amt + 1, -amt, 0, -amt, 0]);
});
/***/ }),
/* 47 */
/***/ (function(module, exports) {
Caman.Filter.register("vignette", function (size, strength) {
var bezier, center, end, start;
if (strength == null) {
strength = 60;
}
if (typeof size === "string" && size.substr(-1) === "%") {
if (this.dimensions.height > this.dimensions.width) {
size = this.dimensions.width * (parseInt(size.substr(0, size.length - 1), 10) / 100);
} else {
size = this.dimensions.height * (parseInt(size.substr(0, size.length - 1), 10) / 100);
}
}
strength /= 100;
center = [this.dimensions.width / 2, this.dimensions.height / 2];
start = Math.sqrt(Math.pow(center[0], 2) + Math.pow(center[1], 2));
end = start - size;
bezier = Caman.Calculate.bezier([0, 1], [30, 30], [70, 60], [100, 80]);
return this.process("vignette", function (rgba) {
var dist, div, loc;
loc = rgba.locationXY();
dist = Caman.Calculate.distance(loc.x, loc.y, center[0], center[1]);
if (dist > end) {
div = Math.max(1, bezier[Math.round((dist - end) / size * 100)] / 10 * strength);
rgba.r = Math.pow(rgba.r / 255, div) * 255;
rgba.g = Math.pow(rgba.g / 255, div) * 255;
rgba.b = Math.pow(rgba.b / 255, div) * 255;
}
return rgba;
});
});
/***/ }),
/* 48 */
/***/ (function(module, exports) {
Caman.Filter.register("posterize", function (adjust) {
var numOfAreas, numOfValues;
numOfAreas = 256 / adjust;
numOfValues = 255 / (adjust - 1);
return this.process("posterize", function (rgba) {
rgba.r = Math.floor(Math.floor(rgba.r / numOfAreas) * numOfValues);
rgba.g = Math.floor(Math.floor(rgba.g / numOfAreas) * numOfValues);
rgba.b = Math.floor(Math.floor(rgba.b / numOfAreas) * numOfValues);
return rgba;
});
});
/***/ }),
/* 49 */
/***/ (function(module, exports) {
Caman.Filter.register("edgeEnhance", function () {
return this.processKernel("Edge Enhance", [0, 0, 0, -1, 1, 0, 0, 0, 0]);
});
Caman.Filter.register("edgeDetect", function () {
return this.processKernel("Edge Detect", [-1, -1, -1, -1, 8, -1, -1, -1, -1]);
});
Caman.Filter.register("emboss", function () {
return this.processKernel("Emboss", [-2, -1, 0, -1, 1, 1, 0, 1, 2]);
});
/***/ }),
/* 50 */
/***/ (function(module, exports) {
Caman.Filter.register("grungy", function () {
this.gamma(1.5);
this.clip(25);
this.saturation(-60);
this.contrast(5);
this.noise(5);
return this.vignette("50%", 30);
});
/***/ }),
/* 51 */
/***/ (function(module, exports) {
Caman.Filter.register("hazyDays", function () {
this.gamma(1.2);
this.newLayer(function () {
this.setBlendingMode("overlay");
this.opacity(60);
this.copyParent();
this.filter.channels({
red: 5
});
return this.filter.stackBlur(15);
});
this.newLayer(function () {
this.setBlendingMode("addition");
this.opacity(40);
return this.fillColor("#6899ba");
});
this.newLayer(function () {
this.setBlendingMode("multiply");
this.opacity(35);
this.copyParent();
this.filter.brightness(40);
this.filter.vibrance(40);
this.filter.exposure(30);
this.filter.contrast(15);
this.filter.curves('r', [0, 40], [128, 128], [128, 128], [255, 215]);
this.filter.curves('g', [0, 40], [128, 128], [128, 128], [255, 215]);
this.filter.curves('b', [0, 40], [128, 128], [128, 128], [255, 215]);
return this.filter.stackBlur(5);
});
this.curves('r', [20, 0], [128, 158], [128, 128], [235, 255]);
this.curves('g', [20, 0], [128, 128], [128, 128], [235, 255]);
this.curves('b', [20, 0], [128, 108], [128, 128], [235, 255]);
return this.vignette("45%", 20);
});
/***/ }),
/* 52 */
/***/ (function(module, exports) {
Caman.Filter.register("lomo", function (vignette) {
if (vignette == null) {
vignette = true;
}
this.brightness(15);
this.exposure(15);
this.curves('rgb', [0, 0], [200, 0], [155, 255], [255, 255]);
this.saturation(-20);
this.gamma(1.8);
if (vignette) {
this.vignette("50%", 60);
}
return this.brightness(5);
});
/***/ }),
/* 53 */
/***/ (function(module, exports) {
Caman.Filter.register("sinCity", function () {
this.contrast(100);
this.brightness(15);
this.exposure(10);
this.posterize(80);
this.clip(30);
return this.greyscale();
});
/***/ }),
/* 54 */
/***/ (function(module, exports) {
Caman.Filter.register("crossProcess", function () {
this.exposure(5);
this.colorize("#e87b22", 4);
this.sepia(20);
this.channels({
blue: 8,
red: 3
});
this.curves('b', [0, 0], [100, 150], [180, 180], [255, 255]);
this.contrast(15);
this.vibrance(75);
return this.gamma(1.6);
});
/***/ }),
/* 55 */
/***/ (function(module, exports) {
Caman.Filter.register("glowingSun", function (vignette) {
if (vignette == null) {
vignette = true;
}
this.brightness(10);
this.newLayer(function () {
this.setBlendingMode("multiply");
this.opacity(80);
this.copyParent();
this.filter.gamma(0.8);
this.filter.contrast(50);
return this.filter.exposure(10);
});
this.newLayer(function () {
this.setBlendingMode("softLight");
this.opacity(80);
return this.fillColor("#f49600");
});
this.exposure(20);
this.gamma(0.8);
if (vignette) {
return this.vignette("45%", 20);
}
});
/***/ }),
/* 56 */
/***/ (function(module, exports) {
Caman.Filter.register("jarques", function () {
this.saturation(-35);
this.curves('b', [20, 0], [90, 120], [186, 144], [255, 230]);
this.curves('r', [0, 0], [144, 90], [138, 120], [255, 255]);
this.curves('g', [10, 0], [115, 105], [148, 100], [255, 248]);
this.curves('rgb', [0, 0], [120, 100], [128, 140], [255, 255]);
return this.sharpen(20);
});
/***/ }),
/* 57 */
/***/ (function(module, exports) {
Caman.Filter.register("love", function () {
this.brightness(5);
this.exposure(8);
this.contrast(4);
this.colorize('#c42007', 30);
this.vibrance(50);
return this.gamma(1.3);
});
/***/ }),
/* 58 */
/***/ (function(module, exports) {
Caman.Filter.register("oldBoot", function () {
this.saturation(-20);
this.vibrance(-50);
this.gamma(1.1);
this.sepia(30);
this.channels({
red: -10,
blue: 5
});
this.curves('rgb', [0, 0], [80, 50], [128, 230], [255, 255]);
return this.vignette("60%", 30);
});
/***/ }),
/* 59 */
/***/ (function(module, exports) {
Caman.Filter.register("orangePeel", function () {
this.curves('rgb', [0, 0], [100, 50], [140, 200], [255, 255]);
this.vibrance(-30);
this.saturation(-30);
this.colorize('#ff9000', 30);
this.contrast(-5);
return this.gamma(1.4);
});
/***/ }),
/* 60 */
/***/ (function(module, exports) {
Caman.Filter.register("pinhole", function () {
this.greyscale();
this.sepia(10);
this.exposure(10);
this.contrast(15);
return this.vignette("60%", 35);
});
/***/ }),
/* 61 */
/***/ (function(module, exports) {
Caman.Filter.register("sunrise", function () {
this.exposure(3.5);
this.saturation(-5);
this.vibrance(50);
this.sepia(60);
this.colorize("#e87b22", 10);
this.channels({
red: 8,
blue: 8
});
this.contrast(5);
this.gamma(1.2);
return this.vignette("55%", 25);
});
/***/ }),
/* 62 */
/***/ (function(module, exports) {
Caman.Filter.register("vintage", function (vignette) {
if (vignette == null) {
vignette = true;
}
this.greyscale();
this.contrast(5);
this.noise(3);
this.sepia(100);
this.channels({
red: 8,
blue: 2,
green: 4
});
this.gamma(0.87);
if (vignette) {
return this.vignette("40%", 30);
}
});
/***/ }),
/* 63 */
/***/ (function(module, exports) {
/*
StackBlur - a fast almost Gaussian Blur For Canvas v0.31 modified for CamanJS
Version: 0.31
Author: Mario Klingemann
Contact: mario@quasimondo.com
Website: http://www.quasimondo.com/StackBlurForCanvas
Twitter: @quasimondo
Modified By: Ryan LeFevre (@meltingice)
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.
*/
var BlurStack, mul_table, shg_table;
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];
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];
BlurStack = function BlurStack() {
this.r = 0;
this.g = 0;
this.b = 0;
this.a = 0;
return this.next = null;
};
Caman.Plugin.register("stackBlur", function (radius) {
var b_in_sum, b_out_sum, b_sum, div, g_in_sum, g_out_sum, g_sum, height, heightMinus1, i, mul_sum, p, pb, pg, pixels, pr, r_in_sum, r_out_sum, r_sum, radiusPlus1, rbs, shg_sum, stack, stackEnd, stackIn, stackOut, stackStart, sumFactor, w4, width, widthMinus1, x, y, yi, yp, yw, _i, _j, _k, _l, _m, _n, _o, _p, _q;
if (isNaN(radius) || radius < 1) {
return;
}
radius |= 0;
pixels = this.pixelData;
width = this.dimensions.width;
height = this.dimensions.height;
div = radius + radius + 1;
w4 = width << 2;
widthMinus1 = width - 1;
heightMinus1 = height - 1;
radiusPlus1 = radius + 1;
sumFactor = radiusPlus1 * (radiusPlus1 + 1) / 2;
stackStart = new BlurStack();
stack = stackStart;
for (i = _i = 1; 1 <= div ? _i < div : _i > div; i = 1 <= div ? ++_i : --_i) {
stack = stack.next = new BlurStack();
if (i === radiusPlus1) {
stackEnd = stack;
}
}
stack.next = stackStart;
stackIn = null;
stackOut = null;
yw = yi = 0;
mul_sum = mul_table[radius];
shg_sum = shg_table[radius];
for (y = _j = 0; 0 <= height ? _j < height : _j > height; y = 0 <= height ? ++_j : --_j) {
r_in_sum = g_in_sum = b_in_sum = r_sum = g_sum = b_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]);
r_sum += sumFactor * pr;
g_sum += sumFactor * pg;
b_sum += sumFactor * pb;
stack = stackStart;
for (i = _k = 0; 0 <= radiusPlus1 ? _k < radiusPlus1 : _k > radiusPlus1; i = 0 <= radiusPlus1 ? ++_k : --_k) {
stack.r = pr;
stack.g = pg;
stack.b = pb;
stack = stack.next;
}
for (i = _l = 1; 1 <= radiusPlus1 ? _l < radiusPlus1 : _l > radiusPlus1; i = 1 <= radiusPlus1 ? ++_l : --_l) {
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;
r_in_sum += pr;
g_in_sum += pg;
b_in_sum += pb;
stack = stack.next;
}
stackIn = stackStart;
stackOut = stackEnd;
for (x = _m = 0; 0 <= width ? _m < width : _m > width; x = 0 <= width ? ++_m : --_m) {
pixels[yi] = r_sum * mul_sum >> shg_sum;
pixels[yi + 1] = g_sum * mul_sum >> shg_sum;
pixels[yi + 2] = b_sum * mul_sum >> shg_sum;
r_sum -= r_out_sum;
g_sum -= g_out_sum;
b_sum -= b_out_sum;
r_out_sum -= stackIn.r;
g_out_sum -= stackIn.g;
b_out_sum -= stackIn.b;
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];
r_sum += r_in_sum;
g_sum += g_in_sum;
b_sum += b_in_sum;
stackIn = stackIn.next;
r_out_sum += pr = stackOut.r;
g_out_sum += pg = stackOut.g;
b_out_sum += pb = stackOut.b;
r_in_sum -= pr;
g_in_sum -= pg;
b_in_sum -= pb;
stackOut = stackOut.next;
yi += 4;
}
yw += width;
}
for (x = _n = 0; 0 <= width ? _n < width : _n > width; x = 0 <= width ? ++_n : --_n) {
g_in_sum = b_in_sum = r_in_sum = g_sum = b_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]);
r_sum += sumFactor * pr;
g_sum += sumFactor * pg;
b_sum += sumFactor * pb;
stack = stackStart;
for (i = _o = 0; 0 <= radiusPlus1 ? _o < radiusPlus1 : _o > radiusPlus1; i = 0 <= radiusPlus1 ? ++_o : --_o) {
stack.r = pr;
stack.g = pg;
stack.b = pb;
stack = stack.next;
}
yp = width;
for (i = _p = 1; 1 <= radius ? _p <= radius : _p >= radius; i = 1 <= radius ? ++_p : --_p) {
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;
r_in_sum += pr;
g_in_sum += pg;
b_in_sum += pb;
stack = stack.next;
if (i < heightMinus1) {
yp += width;
}
}
yi = x;
stackIn = stackStart;
stackOut = stackEnd;
for (y = _q = 0; 0 <= height ? _q < height : _q > height; y = 0 <= height ? ++_q : --_q) {
p = yi << 2;
pixels[p] = r_sum * mul_sum >> shg_sum;
pixels[p + 1] = g_sum * mul_sum >> shg_sum;
pixels[p + 2] = b_sum * mul_sum >> shg_sum;
r_sum -= r_out_sum;
g_sum -= g_out_sum;
b_sum -= b_out_sum;
r_out_sum -= stackIn.r;
g_out_sum -= stackIn.g;
b_out_sum -= stackIn.b;
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];
stackIn = stackIn.next;
r_out_sum += pr = stackOut.r;
g_out_sum += pg = stackOut.g;
b_out_sum += pb = stackOut.b;
r_in_sum -= pr;
g_in_sum -= pg;
b_in_sum -= pb;
stackOut = stackOut.next;
yi += width;
}
}
return this;
});
Caman.Filter.register("stackBlur", function (radius) {
return this.processPlugin("stackBlur", [radius]);
});
/***/ }),
/* 64 */
/***/ (function(module, exports) {
Caman.Plugin.register('flip', function (axis) {
var canvas, ctx, width, height;
width = this.canvas.width;
height = this.canvas.height; // Not suppoorting NodeJS
canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
canvas.id = this.canvas.id;
ctx = canvas.getContext('2d');
if (axis === 'x') {
ctx.translate(width, 0);
ctx.scale(-1, 1);
} else if (axis === 'y') {
ctx.translate(0, height);
ctx.scale(1, -1);
}
ctx.drawImage(this.canvas, 0, 0);
this.replaceCanvas(canvas);
return this;
});
Caman.Filter.register('flip', function () {
return this.processPlugin('flip', arguments);
});
/***/ }),
/* 65 */
/***/ (function(module, exports, __webpack_require__) {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(66);
if(typeof content === 'string') content = [[module.i, content, '']];
// Prepare cssTransformation
var transform;
var options = {"hmr":true}
options.transform = transform
// add the styles to the DOM
var update = __webpack_require__(68)(content, options);
if(content.locals) module.exports = content.locals;
// Hot Module Replacement
if(false) {}
/***/ }),
/* 66 */
/***/ (function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(67)(undefined);
// imports
// module
exports.push([module.i, "@font-face {\n font-family: 'filerobot-image-editor-font';\n src: url('"+urlImageEditor+"fonts/filerobot-image-editor-font.eot?ua0hzun3');\n src: url('"+urlImageEditor+"fonts/filerobot-image-editor-font.eot?ua0hzun3#iefix') format('embedded-opentype'),\n url('"+urlImageEditor+"fonts/filerobot-image-editor-font.ttf?ua0hzun3') format('truetype'),\n url('"+urlImageEditor+"fonts/filerobot-image-editor-font.woff?ua0hzun3') format('woff'),\n url('"+urlImageEditor+"fonts/filerobot-image-editor-font.svg?ua0hzun3#filerobot-image-editor-font') format('svg');\n font-weight: normal;\n font-style: normal;\n}\n\n[class^=\"sf-i-\"], [class*=\" sf-i-\"] {\n /* use !important to prevent issues with browser extensions that change fonts */\n font-family: 'filerobot-image-editor-font' !important;\n speak: none;\n font-style: normal;\n font-weight: normal;\n font-variant: normal;\n text-transform: none;\n line-height: 1;\n\n /* Better Font Rendering =========== */\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.sf-i-shape:before {\n content: \"\\E91B\";\n}\n.sf-i-image:before {\n content: \"\\E91A\";\n}\n.sf-i-focus-point:before {\n content: \"\\E919\";\n}\n.sf-i-watermark:before {\n content: \"\\E918\";\n}\n.sf-i-attention:before {\n content: \"\\E917\";\n}\n.sf-i-reset:before {\n content: \"\\E912\";\n}\n.sf-i-rotate-right:before {\n content: \"\\E913\";\n}\n.sf-i-flip-vertically:before {\n content: \"\\E914\";\n}\n.sf-i-rotate-left:before {\n content: \"\\E915\";\n}\n.sf-i-flip-horizontally:before {\n content: \"\\E916\";\n}\n.sf-i-arrows-back:before {\n content: \"\\E905\";\n}\n.sf-i-arrows-forward:before {\n content: \"\\E906\";\n}\n.sf-i-filter:before {\n content: \"\\E904\";\n}\n.sf-i-minus:before {\n content: \"\\E910\";\n}\n.sf-i-plus:before {\n content: \"\\E911\";\n}\n.sf-i-effects:before {\n content: \"\\E900\";\n}\n.sf-i-crop:before {\n content: \"\\E901\";\n}\n.sf-i-rotation-left:before {\n content: \"\\E902\";\n}\n.sf-i-mirror-vertical:before {\n content: \"\\E903\";\n}\n.sf-i-resize:before {\n content: \"\\E907\";\n}\n.sf-i-rotation-right:before {\n content: \"\\E908\";\n}\n.sf-i-mirrot-horizontal:before {\n content: \"\\E909\";\n}\n.sf-i-adjust:before {\n content: \"\\E90A\";\n}\n.sf-i-orientation:before {\n content: \"\\E90B\";\n}\n.sf-i-cross:before {\n content: \"\\E90C\";\n}\n.sf-i-point-orientation:before {\n content: \"\\E90D\";\n}\n.sf-i-link:before {\n content: \"\\E90E\";\n}\n.sf-i-without-link:before {\n content: \"\\E90F\";\n}\n", ""]);
// exports
/***/ }),
/* 67 */
/***/ (function(module, exports) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
// css base code, injected by the css-loader
module.exports = function (useSourceMap) {
var list = []; // return the list of modules as css string
list.toString = function toString() {
return this.map(function (item) {
var content = cssWithMappingToString(item, useSourceMap);
if (item[2]) {
return "@media " + item[2] + "{" + content + "}";
} else {
return content;
}
}).join("");
}; // import a list of modules into the list
list.i = function (modules, mediaQuery) {
if (typeof modules === "string") modules = [[null, modules, ""]];
var alreadyImportedModules = {};
for (var i = 0; i < this.length; i++) {
var id = this[i][0];
if (typeof id === "number") alreadyImportedModules[id] = true;
}
for (i = 0; i < modules.length; i++) {
var item = modules[i]; // skip already imported module
// this implementation is not 100% perfect for weird media query combinations
// when a module is imported multiple times with different media queries.
// I hope this will never occur (Hey this way we have smaller bundles)
if (typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
if (mediaQuery && !item[2]) {
item[2] = mediaQuery;
} else if (mediaQuery) {
item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
}
list.push(item);
}
}
};
return list;
};
function cssWithMappingToString(item, useSourceMap) {
var content = item[1] || '';
var cssMapping = item[3];
if (!cssMapping) {
return content;
}
if (useSourceMap && typeof btoa === 'function') {
var sourceMapping = toComment(cssMapping);
var sourceURLs = cssMapping.sources.map(function (source) {
return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */';
});
return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
}
return [content].join('\n');
} // Adapted from convert-source-map (MIT)
function toComment(sourceMap) {
// eslint-disable-next-line no-undef
var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
return '/*# ' + data + ' */';
}
/***/ }),
/* 68 */
/***/ (function(module, exports, __webpack_require__) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var stylesInDom = {};
var memoize = function (fn) {
var memo;
return function () {
if (typeof memo === "undefined") memo = fn.apply(this, arguments);
return memo;
};
};
var isOldIE = memoize(function () {
// Test for IE <= 9 as proposed by Browserhacks
// @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
// Tests for existence of standard globals is to allow style-loader
// to operate correctly into non-standard environments
// @see https://github.com/webpack-contrib/style-loader/issues/177
return window && document && document.all && !window.atob;
});
var getElement = (function (fn) {
var memo = {};
return function(selector) {
if (typeof memo[selector] === "undefined") {
var styleTarget = fn.call(this, selector);
// Special case to return head of iframe instead of iframe itself
if (styleTarget instanceof window.HTMLIFrameElement) {
try {
// This will throw an exception if access to iframe is blocked
// due to cross-origin restrictions
styleTarget = styleTarget.contentDocument.head;
} catch(e) {
styleTarget = null;
}
}
memo[selector] = styleTarget;
}
return memo[selector]
};
})(function (target) {
return document.querySelector(target)
});
var singleton = null;
var singletonCounter = 0;
var stylesInsertedAtTop = [];
var fixUrls = __webpack_require__(69);
module.exports = function(list, options) {
if (typeof DEBUG !== "undefined" && DEBUG) {
if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
}
options = options || {};
options.attrs = typeof options.attrs === "object" ? options.attrs : {};
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
// tags it will allow on a page
if (!options.singleton) options.singleton = isOldIE();
// By default, add <style> tags to the <head> element
if (!options.insertInto) options.insertInto = "head";
// By default, add <style> tags to the bottom of the target
if (!options.insertAt) options.insertAt = "bottom";
var styles = listToStyles(list, options);
addStylesToDom(styles, options);
return function update (newList) {
var mayRemove = [];
for (var i = 0; i < styles.length; i++) {
var item = styles[i];
var domStyle = stylesInDom[item.id];
domStyle.refs--;
mayRemove.push(domStyle);
}
if(newList) {
var newStyles = listToStyles(newList, options);
addStylesToDom(newStyles, options);
}
for (var i = 0; i < mayRemove.length; i++) {
var domStyle = mayRemove[i];
if(domStyle.refs === 0) {
for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();
delete stylesInDom[domStyle.id];
}
}
};
};
function addStylesToDom (styles, options) {
for (var i = 0; i < styles.length; i++) {
var item = styles[i];
var domStyle = stylesInDom[item.id];
if(domStyle) {
domStyle.refs++;
for(var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j](item.parts[j]);
}
for(; j < item.parts.length; j++) {
domStyle.parts.push(addStyle(item.parts[j], options));
}
} else {
var parts = [];
for(var j = 0; j < item.parts.length; j++) {
parts.push(addStyle(item.parts[j], options));
}
stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
}
}
}
function listToStyles (list, options) {
var styles = [];
var newStyles = {};
for (var i = 0; i < list.length; i++) {
var item = list[i];
var id = options.base ? item[0] + options.base : item[0];
var css = item[1];
var media = item[2];
var sourceMap = item[3];
var part = {css: css, media: media, sourceMap: sourceMap};
if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]});
else newStyles[id].parts.push(part);
}
return styles;
}
function insertStyleElement (options, style) {
var target = getElement(options.insertInto)
if (!target) {
throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
}
var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1];
if (options.insertAt === "top") {
if (!lastStyleElementInsertedAtTop) {
target.insertBefore(style, target.firstChild);
} else if (lastStyleElementInsertedAtTop.nextSibling) {
target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling);
} else {
target.appendChild(style);
}
stylesInsertedAtTop.push(style);
} else if (options.insertAt === "bottom") {
target.appendChild(style);
} else if (typeof options.insertAt === "object" && options.insertAt.before) {
var nextSibling = getElement(options.insertInto + " " + options.insertAt.before);
target.insertBefore(style, nextSibling);
} else {
throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");
}
}
function removeStyleElement (style) {
if (style.parentNode === null) return false;
style.parentNode.removeChild(style);
var idx = stylesInsertedAtTop.indexOf(style);
if(idx >= 0) {
stylesInsertedAtTop.splice(idx, 1);
}
}
function createStyleElement (options) {
var style = document.createElement("style");
options.attrs.type = "text/css";
addAttrs(style, options.attrs);
insertStyleElement(options, style);
return style;
}
function createLinkElement (options) {
var link = document.createElement("link");
options.attrs.type = "text/css";
options.attrs.rel = "stylesheet";
addAttrs(link, options.attrs);
insertStyleElement(options, link);
return link;
}
function addAttrs (el, attrs) {
Object.keys(attrs).forEach(function (key) {
el.setAttribute(key, attrs[key]);
});
}
function addStyle (obj, options) {
var style, update, remove, result;
// If a transform function was defined, run it on the css
if (options.transform && obj.css) {
result = options.transform(obj.css);
if (result) {
// If transform returns a value, use that instead of the original css.
// This allows running runtime transformations on the css.
obj.css = result;
} else {
// If the transform function returns a falsy value, don't add this css.
// This allows conditional loading of css
return function() {
// noop
};
}
}
if (options.singleton) {
var styleIndex = singletonCounter++;
style = singleton || (singleton = createStyleElement(options));
update = applyToSingletonTag.bind(null, style, styleIndex, false);
remove = applyToSingletonTag.bind(null, style, styleIndex, true);
} else if (
obj.sourceMap &&
typeof URL === "function" &&
typeof URL.createObjectURL === "function" &&
typeof URL.revokeObjectURL === "function" &&
typeof Blob === "function" &&
typeof btoa === "function"
) {
style = createLinkElement(options);
update = updateLink.bind(null, style, options);
remove = function () {
removeStyleElement(style);
if(style.href) URL.revokeObjectURL(style.href);
};
} else {
style = createStyleElement(options);
update = applyToTag.bind(null, style);
remove = function () {
removeStyleElement(style);
};
}
update(obj);
return function updateStyle (newObj) {
if (newObj) {
if (
newObj.css === obj.css &&
newObj.media === obj.media &&
newObj.sourceMap === obj.sourceMap
) {
return;
}
update(obj = newObj);
} else {
remove();
}
};
}
var replaceText = (function () {
var textStore = [];
return function (index, replacement) {
textStore[index] = replacement;
return textStore.filter(Boolean).join('\n');
};
})();
function applyToSingletonTag (style, index, remove, obj) {
var css = remove ? "" : obj.css;
if (style.styleSheet) {
style.styleSheet.cssText = replaceText(index, css);
} else {
var cssNode = document.createTextNode(css);
var childNodes = style.childNodes;
if (childNodes[index]) style.removeChild(childNodes[index]);
if (childNodes.length) {
style.insertBefore(cssNode, childNodes[index]);
} else {
style.appendChild(cssNode);
}
}
}
function applyToTag (style, obj) {
var css = obj.css;
var media = obj.media;
if(media) {
style.setAttribute("media", media)
}
if(style.styleSheet) {
style.styleSheet.cssText = css;
} else {
while(style.firstChild) {
style.removeChild(style.firstChild);
}
style.appendChild(document.createTextNode(css));
}
}
function updateLink (link, options, obj) {
var css = obj.css;
var sourceMap = obj.sourceMap;
/*
If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
and there is no publicPath defined then lets turn convertToAbsoluteUrls
on by default. Otherwise default to the convertToAbsoluteUrls option
directly
*/
var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
if (options.convertToAbsoluteUrls || autoFixUrls) {
css = fixUrls(css);
}
if (sourceMap) {
// http://stackoverflow.com/a/26603875
css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
}
var blob = new Blob([css], { type: "text/css" });
var oldSrc = link.href;
link.href = URL.createObjectURL(blob);
if(oldSrc) URL.revokeObjectURL(oldSrc);
}
/***/ }),
/* 69 */
/***/ (function(module, exports) {
/**
* When source maps are enabled, `style-loader` uses a link element with a data-uri to
* embed the css on the page. This breaks all relative urls because now they are relative to a
* bundle instead of the current page.
*
* One solution is to only use full urls, but that may be impossible.
*
* Instead, this function "fixes" the relative urls to be absolute according to the current page location.
*
* A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
*
*/
module.exports = function (css) {
// get current location
var location = typeof window !== "undefined" && window.location;
if (!location) {
throw new Error("fixUrls requires window.location");
} // blank or null?
if (!css || typeof css !== "string") {
return css;
}
var baseUrl = location.protocol + "//" + location.host;
var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/"); // convert each url(...)
/*
This regular expression is just a way to recursively match brackets within
a string.
/url\s*\( = Match on the word "url" with any whitespace after it and then a parens
( = Start a capturing group
(?: = Start a non-capturing group
[^)(] = Match anything that isn't a parentheses
| = OR
\( = Match a start parentheses
(?: = Start another non-capturing groups
[^)(]+ = Match anything that isn't a parentheses
| = OR
\( = Match a start parentheses
[^)(]* = Match anything that isn't a parentheses
\) = Match a end parentheses
) = End Group
*\) = Match anything and then a close parens
) = Close non-capturing group
* = Match anything
) = Close capturing group
\) = Match a close parens
/gi = Get all matches, not the first. Be case insensitive.
*/
var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function (fullMatch, origUrl) {
// strip quotes (if they exist)
var unquotedOrigUrl = origUrl.trim().replace(/^"(.*)"$/, function (o, $1) {
return $1;
}).replace(/^'(.*)'$/, function (o, $1) {
return $1;
}); // already a full url? no change
if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/)/i.test(unquotedOrigUrl)) {
return fullMatch;
} // convert the url to a full url
var newUrl;
if (unquotedOrigUrl.indexOf("//") === 0) {
//TODO: should we add protocol?
newUrl = unquotedOrigUrl;
} else if (unquotedOrigUrl.indexOf("/") === 0) {
// path should be relative to the base url
newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
} else {
// path should be relative to current directory
newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
} // send back the fixed url(...)
return "url(" + JSON.stringify(newUrl) + ")";
}); // send back the fixed css
return fixedCss;
};
/***/ }),
/* 70 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXTERNAL MODULE: ./node_modules/react-dom/index.js
var react_dom = __webpack_require__(6);
// EXTERNAL MODULE: ./node_modules/react/index.js
var react = __webpack_require__(2);
// EXTERNAL MODULE: ./node_modules/styled-components/dist/styled-components.browser.esm.js
var styled_components_browser_esm = __webpack_require__(1);
// CONCATENATED MODULE: ./src/styledComponents/styleUtils.js
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var commonTheme = {
textFontSize: '14px',
colors: {
success: '#5cb85c',
warning: '#f0ad4e',
error: '#d9534f',
muted: '#636c72',
base: 'light',
light: {
base: '#F9FAFB',
dark: '#F4F6F8',
darker: '#DFE4E8'
},
dark: {
base: '#1e262c',
light: '#454F5B',
lighter: '#637381'
},
primary: {
base: '#181830',
light: '#263138',
lighter: '#34444c',
dark: '#101021',
darker: '#090912',
text: '#F9FAFB'
},
secondary: {
base: '#00707c',
light: '#007E8A',
lighter: '#008D99',
dark: '#00616D',
darker: '#005662',
text: '#F9FAFB'
},
text: {
base: '#F9FAFB',
dark: '#F4F6F8',
mute: '#aaa',
light: '#fff'
},
background: {
base: '#000'/* Mod ??? modal-overlay - old #f1f1f1 */
},
border: {
base: '#ccc'
},
link: {
base: '#00707c',
over: '#00616D'
},
brand: {
success: '#5cb85c',
warning: '#f0ad4e',
error: '#d9534f',
muted: '#636c72'
}
},
modal: {
borderRadius: '4px',
fluid: {
xs: '35%',
sm: '45%',
md: '60%',
lg: '80%',
xl: '90%'
},
fixed: {
xs: '200px',
sm: '300px',
md: '450px',
lg: '650px',
xl: '800px'
}
},
button: {
tt: 'none'
}
};
var variables = _objectSpread(_objectSpread({}, commonTheme), {}, {
radii: [0, '0.2rem', '0.25rem', '.3rem'],
// backgrounds
mainBackgroundColor: '#1e262c',
mainBackgroundColorHover: '#263138',
mainBackgroundColorActive: '#34444c',
secondBackgroundColor: '#263138',
// text
textColor: '#e7f1f4',
textColorHover: '#fff',
textMuted: '#70777f',
// border
borderColor: '#70777f',
borderDarkColor: '#161e23',
fieldWidth: '120px',
borderInputColor: '#3b4d54',
borderInputColorHover: '#52686d',
borderInputColorActive: '#52686d',
inputBackgroundColor: '#34444c',
inputBoxShadowColor: '#03a9bb',
inputPlaceholderColor: '#888d94',
// main color
mainThemeColor: '#00707c',
mainThemeColorHover: '#00616D',
mainThemeColorOpacity: 'rgba(0, 112, 124, 0.5)',
btnSaveColor: '#009345',
btnSaveColorHover: '#00b549',
btnThemeColor: '#34444c',
btnPaddingSm: '2px 14px',
btnFontSizeSm: '12px',
btnBorderRadius: '2px',
modalOverlayColor: '#484848',
btnMainColor: function btnMainColor(props) {
return "\n color: #fff;\n background-color: #00707c;\n border-color: #00707c;\n\n &:hover {\n color: #fff;\n background-color: #00616D;\n border-color: #00616D;\n }\n\n &:focus {\n -webkit-box-shadow: 0 0 0 2px rgba(0, 112, 124, 0.5);\n box-shadow: 0 0 0 2px rgba(0, 112, 124, 0.5);\n }\n\n :active {\n color: #fff;\n background-color: #00616D;\n background-image: none;\n border-color: #00616D;\n }\n\n ".concat(props.disabled ? "\n background-color: rgba(0, 112, 124, 0.5);\n border-color: rgba(0, 112, 124, 0.5);\n " : '', "\n\n ").concat(props.active ? "\n color: #fff;\n background-color: #00616D;\n background-image: none;\n border-color: #00616D;\n " : '', "\n ");
},
button: _objectSpread(_objectSpread({}, commonTheme.button), {}, {
sm: {
p: '4px 20px',
fz: '15px',
lh: '1.5',
br: '2px'
},
md: {
p: '6px 12px',
fz: '14px',
lh: '1.5',
br: '2px'
},
lg: {
p: '8px 14px',
fz: '16px',
lh: '1.5',
br: '3px'
}
}),
modal: _objectSpread(_objectSpread({}, commonTheme.modal), {}, {
backgroundColor: '#1e262c',
color: '#e7f1f4',
colorMuted: '#70777f',
colorMutedHover: '#e7f1f4'
})
});
function getModalWidth(props) {
var exact = props.exact,
xl = props.xl,
lg = props.lg,
md = props.md,
sm = props.sm,
xs = props.xs,
fluid = props.fluid;
var size = exact ? 'exact' : xl ? 'xl' : lg ? 'lg' : md ? 'md' : sm ? 'sm' : xs ? 'xs' : 'md';
if (size === 'exact') return exact;
return variables.modal[fluid ? 'fluid' : 'fixed'][size];
}
function getFieldColorStyles(props) {
if (props.dark) return "";else return "\n color: ".concat(getColor(props, 'text'), ";\n background-color: ").concat(getColor(props, 'background'), ";\n border: 1px solid ").concat(getColor(props, 'border'), ";\n\n &::-webkit-input-placeholder {\n color: ").concat(getColor(props, 'text', 'muted'), ";\n }\n &::-moz-placeholder {\n color: ").concat(getColor(props, 'text', 'muted'), ";\n }\n &:-ms-input-placeholder {\n color: ").concat(getColor(props, 'text', 'muted'), ";\n }\n &::-ms-input-placeholder {\n color: ").concat(getColor(props, 'text', 'muted'), ";\n }\n &::placeholder {\n color: ").concat(getColor(props, 'text', 'muted'), ";\n }\n\n &:focus {\n color: ").concat(getColor(props, 'text'), ";\n background-color: ").concat(getColor(props, 'background'), ";\n border-color: ").concat(getColor(props, 'link'), ";\n outline: 0;\n }\n &:focus::-ms-value {\n color: ").concat(getColor(props, 'text'), ";\n background-color: ").concat(getColor(props, 'background'), ";\n border-color: ").concat(getColor(props, 'link'), ";\n outline: 0;\n }\n ");
}
function getIconStyles(props) {
return "\n font-family: 'filerobot-image-editor-font' !important;\n color: ".concat(props.muted ? props.theme.colors.textMute : props.theme.colors.text, ";\n speak: none;\n font-style: normal;\n font-weight: normal;\n font-variant: normal;\n text-transform: none;\n line-height: 1;\n\n /* Better Font Rendering =========== */\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n\n &:hover {\n color: ").concat(props.muted ? props.theme.colors.textMute : props.theme.colors.text, ";\n }\n ");
}
function shadeBlendConvert(p, from, to) {
if (typeof p != "number" || p < -1 || p > 1 || typeof from != "string" || from[0] != 'r' && from[0] != '#' || typeof to != "string" && typeof to != "undefined") return null; //ErrorCheck
if (!window.sbcRip) window.sbcRip = function (d) {
var l = d.length,
RGB = new Object();
if (l > 9) {
d = d.split(",");
if (d.length < 3 || d.length > 4) return null; //ErrorCheck
RGB[0] = i(d[0].slice(4)), RGB[1] = i(d[1]), RGB[2] = i(d[2]), RGB[3] = d[3] ? parseFloat(d[3]) : -1;
} else {
if (l == 8 || l == 6 || l < 4) return null; //ErrorCheck
if (l < 6) d = "#" + d[1] + d[1] + d[2] + d[2] + d[3] + d[3] + (l > 4 ? d[4] + "" + d[4] : ""); //3 digit
d = i(d.slice(1), 16), RGB[0] = d >> 16 & 255, RGB[1] = d >> 8 & 255, RGB[2] = d & 255, RGB[3] = l == 9 || l == 5 ? r((d >> 24 & 255) / 255 * 10000) / 10000 : -1;
}
return RGB;
};
var i = parseInt,
r = Math.round,
h = from.length > 9,
h = typeof to == "string" ? to.length > 9 ? true : to == "c" ? !h : false : h,
b = p < 0,
p = b ? p * -1 : p,
to = to && to != "c" ? to : b ? "#000000" : "#FFFFFF",
f = window.sbcRip(from),
t = window.sbcRip(to);
if (!f || !t) return null; //ErrorCheck
if (h) return "rgb(" + r((t[0] - f[0]) * p + f[0]) + "," + r((t[1] - f[1]) * p + f[1]) + "," + r((t[2] - f[2]) * p + f[2]) + (f[3] < 0 && t[3] < 0 ? ")" : "," + (f[3] > -1 && t[3] > -1 ? r(((t[3] - f[3]) * p + f[3]) * 10000) / 10000 : t[3] < 0 ? f[3] : t[3]) + ")");else return "#" + (0x100000000 + (f[3] > -1 && t[3] > -1 ? r(((t[3] - f[3]) * p + f[3]) * 255) : t[3] > -1 ? r(t[3] * 255) : f[3] > -1 ? r(f[3] * 255) : 255) * 0x1000000 + r((t[0] - f[0]) * p + f[0]) * 0x10000 + r((t[1] - f[1]) * p + f[1]) * 0x100 + r((t[2] - f[2]) * p + f[2])).toString(16).slice(f[3] > -1 || t[3] > -1 ? 1 : 3);
}
function isHex(color) {
return /^#?([a-f\d])([a-f\d])([a-f\d])$/i.test(color) || /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.test(color);
}
function hexToRgb(hex) {
// Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF")
var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
hex = hex.replace(shorthandRegex, function (m, r, g, b) {
return r + r + g + g + b + b;
});
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
return result ? {
r: parseInt(result[1], 16),
g: parseInt(result[2], 16),
b: parseInt(result[3], 16)
} : null;
}
var getHoverColor = function getHoverColor(color) {
if (!color) return null;
var nextColor = shadeBlendConvert(-0.1, color) || '';
return nextColor.toLowerCase() === color.toLowerCase() ? shadeBlendConvert(0.25, color) : nextColor;
};
var getWithOpacity = function getWithOpacity(color, opacity) {
if (!color) return null;
var isHexColor = isHex(color);
var hexColor = isHexColor ? color : shadeBlendConvert(0, color, 'c');
if (!hexColor) return null;
var rgbColor = hexToRgb(hexColor);
if (!rgbColor) return color;
return "rgba(".concat(rgbColor.r, ", ").concat(rgbColor.g, ", ").concat(rgbColor.b, ", ").concat(opacity, ")");
};
var getElementStylesBySize = function getElementStylesBySize(props, type, field) {
var sm = props.sm,
lg = props.lg;
var size = sm ? 'sm' : lg ? 'lg' : 'md';
return variables[type] && variables[type][size] && variables[type][size][field];
};
var getColor = function getColor(props, type) {
var field = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'base';
var isThemeOverlay = arguments.length > 3 ? arguments[3] : undefined;
var isSupreme = arguments.length > 4 ? arguments[4] : undefined;
var themeOverlay = isThemeOverlay ? variables.colors.base : null;
return variables.colors[type][themeOverlay ? themeOverlay + (isSupreme ? 'er' : '') : field];
};
function getIconByName(name) {
var char = '';
switch (name) {
case 'watermark':
char = '\\e918';
break;
case 'reset':
char = '\\e912';
break;
case 'flip-v':
char = '\\e916';
break;
case 'flip-h':
char = '\\e914';
break;
case 'cross':
char = '\\e90c';
break;
case 'effects':
char = '\\e900';
break;
case 'filters':
char = '\\e904';
break;
case 'adjust':
char = '\\e90a';
break;
case 'crop':
char = '\\e901';
break;
case 'resize':
char = '\\e907';
break;
case 'rotate':
char = '\\e90b';
break;
case 'previous':
char = '\\e905';
break;
case 'next':
char = '\\e906';
break;
case 'ratio':
char = '\\e90e';
break;
case 'no-ratio':
char = '\\e90f';
break;
case 'left-rotate':
char = '\\e902';
break;
case 'right-rotate':
char = '\\e908';
break;
case 'focus_point':
char = '\\e919';
break;
case 'shapes':
char = '\\e91b';
break;
case 'image':
char = '\\e91a';
break;
case 'text':
char = 'T';
break;
case 'full-screen':
char = '\\e91c';
break;
default:
return;
}
return "\n &:before {\n content: '".concat(char, "'\n }\n ");
}
// CONCATENATED MODULE: ./src/styledComponents/Toolbar.ui.js
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var Toolbar = styled_components_browser_esm["b" /* default */].div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n height: 100px;\n width: 100%;\n overflow-x: ", ";\n overflow-y: ", ";\n white-space: nowrap;\n text-align: center;\n}\n \n #filerobot-image-editor-root & ::-webkit-scrollbar {\n height: 10px !important;\n }\n \n #filerobot-image-editor-root & ::-webkit-scrollbar-thumb {\n background: ", ";\n border-radius: 5px;\n }\n \n @media (max-width: 768px) {\n#filerobot-image-editor-root & {\n width: 100%;\n height: initial;\n padding: 0 10px\n}\n }\n"])), function (p) {
return p.overlayYHidden ? 'auto' : 'none';
}, function (p) {
return p.overlayYHidden ? 'hidden' : 'visible';
}, function (props) {
return props.theme.colors.border || '#3b4d54';
});
var ToolWrapper = styled_components_browser_esm["b" /* default */].div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n padding: 20px 10px;\n cursor: pointer;\n display: inline-block;\n min-width: 80px;\n min-height: 100px;\n text-align: center;\n font-size: 12px;\n color: ", ";\n text-transform: ", ";\n background: ", ";\n}\n \n #filerobot-image-editor-root &:hover {\n color: ", ";\n background: ", ";\n }\n"])), function (props) {
return props.theme.colors.text;
}, function (props) {
return props.noCapitalStrs ? 'none' : props.tt || 'capitalize';
}, function (props) {
return props.active ? props.theme.colors.secondaryBg : 'inherit';
}, function (props) {
return props.theme.colors.textHover;
}, function (props) {
return props.theme.colors.secondaryBg;
});
var ToolIcon = styled_components_browser_esm["b" /* default */].div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n height: 40px;\n font-size: 40px;\n \n ", ";\n ", ";\n}\n"])), function (props) {
return getIconStyles(props);
}, function (props) {
return getIconByName(props.name);
});
var ToolLabel = styled_components_browser_esm["b" /* default */].div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n height: 20px;\n line-height: 20px;\n}\n"])));
var EffectsWrapper = styled_components_browser_esm["b" /* default */].div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n overflow-x: auto;\n overflow-y: hidden;\n white-space: nowrap;\n}\n \n #filerobot-image-editor-root & ::-webkit-scrollbar {\n height: 10px !important;\n }\n \n #filerobot-image-editor-root & ::-webkit-scrollbar-thumb {\n background: ", ";\n border-radius: 5px;\n }\n"])), function (props) {
return props.theme.colors.border || '#3b4d54';
});
var EffectWrapper = styled_components_browser_esm["b" /* default */].div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: inline-block;\n vertical-align: top;\n padding: 10px;\n text-align: center;\n min-width: 90px;\n height: 90px;\n transition:background .5s;\n cursor: pointer;\n color: ", ";\n font-size: 12px;\n background: ", ";\n}\n \n #filerobot-image-editor-root &:hover {\n background: ", ";\n }\n"])), function (props) {
return props.theme.colors.text;
}, function (p) {
return p.active ? p.theme.colors.secondaryBgHover : 'transparent';
}, function (p) {
return p.theme.colors.secondaryBgHover;
});
var EffectIcon = styled_components_browser_esm["b" /* default */].div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n background: url('", "') 50% 50% / cover no-repeat;\n width: 55px;\n height: 55px;\n border-radius: 2px;\n overflow: hidden;\n display: inline-block;\n}\n"])), function (props) {
return props.src;
});
var EffectLabel = styled_components_browser_esm["b" /* default */].div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n text-transform: ", ";\n height: 20px;\n margin-top: -5px;\n line-height: 20px;\n}\n"])), function (p) {
return p.noCapitalStrs ? 'none' : 'capitalize';
});
// CONCATENATED MODULE: ./src/styledComponents/ImageEditor.ui.js
var ImageEditor_ui_templateObject, ImageEditor_ui_templateObject2;
function ImageEditor_ui_taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var Container = Object(styled_components_browser_esm["b" /* default */])('div')(ImageEditor_ui_templateObject || (ImageEditor_ui_templateObject = ImageEditor_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n height: 100%;\n width: 100%;\n overflow-y: auto;\n}\n \n #filerobot-image-editor-root & ::-webkit-scrollbar {\n height: 10px !important;\n width: 10px !important;\n }\n \n #filerobot-image-editor-root & ::-webkit-scrollbar-thumb {\n background: ", ";\n border-radius: 5px;\n }\n \n #filerobot-image-editor-root & *, #filerobot-image-editor-root & *:after, #filerobot-image-editor-root & *:before, #filerobot-image-editor-root & *::after, #filerobot-image-editor-root & *::before {\n box-sizing: border-box;\n }\n \n #filerobot-image-editor-root & *:after, #filerobot-image-editor-root & *:before, #filerobot-image-editor-root & *::after, #filerobot-image-editor-root & *::before {\n padding: 0;\n margin: 0;\n outline: 0;\n box-sizing: border-box;\n }\n \n /* cyrillic-ext */\n \n @font-face {\n font-family: 'Roboto Mono';\n font-style: normal;\n font-weight: 400;\n src: local('Roboto Mono'), local('RobotoMono-Regular'), url(https://fonts.gstatic.com/s/robotomono/v5/hMqPNLsu_dywMa4C_DEpY_ZraR2Tg8w2lzm7kLNL0-w.woff2) format('woff2');\n unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F;\n }\n \n /* cyrillic */\n \n @font-face {\n font-family: 'Roboto Mono';\n font-style: normal;\n font-weight: 400;\n src: local('Roboto Mono'), local('RobotoMono-Regular'), url(https://fonts.gstatic.com/s/robotomono/v5/hMqPNLsu_dywMa4C_DEpY14sYYdJg5dU2qzJEVSuta0.woff2) format('woff2');\n unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;\n }\n \n /* greek-ext */\n \n @font-face {\n font-family: 'Roboto Mono';\n font-style: normal;\n font-weight: 400;\n src: local('Roboto Mono'), local('RobotoMono-Regular'), url(https://fonts.gstatic.com/s/robotomono/v5/hMqPNLsu_dywMa4C_DEpY1BW26QxpSj-_ZKm_xT4hWw.woff2) format('woff2');\n unicode-range: U+1F00-1FFF;\n }\n \n /* greek */\n \n @font-face {\n font-family: 'Roboto Mono';\n font-style: normal;\n font-weight: 400;\n src: local('Roboto Mono'), local('RobotoMono-Regular'), url(https://fonts.gstatic.com/s/robotomono/v5/hMqPNLsu_dywMa4C_DEpYwt_Rm691LTebKfY2ZkKSmI.woff2) format('woff2');\n unicode-range: U+0370-03FF;\n }\n \n /* vietnamese */\n \n @font-face {\n font-family: 'Roboto Mono';\n font-style: normal;\n font-weight: 400;\n src: local('Roboto Mono'), local('RobotoMono-Regular'), url(https://fonts.gstatic.com/s/robotomono/v5/hMqPNLsu_dywMa4C_DEpY9DiNsR5a-9Oe_Ivpu8XWlY.woff2) format('woff2');\n unicode-range: U+0102-0103, U+1EA0-1EF9, U+20AB;\n }\n \n /* latin-ext */\n \n @font-face {\n font-family: 'Roboto Mono';\n font-style: normal;\n font-weight: 400;\n src: local('Roboto Mono'), local('RobotoMono-Regular'), url(https://fonts.gstatic.com/s/robotomono/v5/hMqPNLsu_dywMa4C_DEpY6E8kM4xWR1_1bYURRojRGc.woff2) format('woff2');\n unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;\n }\n \n /* latin */\n \n @font-face {\n font-family: 'Roboto Mono';\n font-style: normal;\n font-weight: 400;\n src: local('Roboto Mono'), local('RobotoMono-Regular'), url(https://fonts.gstatic.com/s/robotomono/v5/hMqPNLsu_dywMa4C_DEpY4gp9Q8gbYrhqGlRav_IXfk.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215;\n }\n"])), function (props) {
return props.theme.colors.border || '#3b4d54';
});
/* Mod ??? crop text point - line */
var Wrapper = styled_components_browser_esm["b" /* default */].div(ImageEditor_ui_templateObject2 || (ImageEditor_ui_templateObject2 = ImageEditor_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n position: relative;\n background: ", ";\n z-index: 1050;\n width: 100%;\n height: 100%;\n min-height: 520px;\n overflow: ", ";\n font-size: 12px;\n display: flex;\n flex-direction: column;\n}\n \n #filerobot-image-editor-root & .filerobot-original-canvas {\n visibility: hidden;\n position: absolute;\n left: -99999px;\n display: none;\n }\n \n #filerobot-image-editor-root & .cropper-container {\n direction: ltr;\n font-size: 0;\n line-height: 0;\n position: relative;\n -ms-touch-action: none;\n touch-action: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n }\n \n #filerobot-image-editor-root & .cropper-container img {/*Avoid margin top issue (Occur only when margin-top <= -height)*/\n display: block;\n height: 100%;\n image-orientation: 0deg;\n max-height: none !important;\n max-width: none !important;\n min-height: 0 !important;\n min-width: 0 !important;\n width: 100%;\n }\n \n #filerobot-image-editor-root & .cropper-wrap-box,\n #filerobot-image-editor-root & .cropper-canvas,\n #filerobot-image-editor-root & .cropper-drag-box,\n #filerobot-image-editor-root & .cropper-crop-box,\n #filerobot-image-editor-root & .cropper-modal {\n bottom: 0;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n }\n \n #filerobot-image-editor-root & .cropper-wrap-box,\n #filerobot-image-editor-root & .cropper-canvas {\n overflow: hidden;\n }\n \n #filerobot-image-editor-root & .cropper-drag-box {\n background-color: #fff;\n opacity: 0;\n }\n \n #filerobot-image-editor-root & .cropper-modal {\n background-color: #000;\n opacity: .5;\n }\n \n #filerobot-image-editor-root & .cropper-view-box {\n display: block;\n height: 100%;\n outline-color: rgba(255, 255, 255, 0.75);\n outline: 1px solid #fff;\n overflow: hidden;\n width: 100%;\n ", ";\n }\n \n #filerobot-image-editor-root & .cropper-dashed {\n border: 0 dashed #eee;\n display: block;\n opacity: .5;\n position: absolute;\n }\n \n #filerobot-image-editor-root & .cropper-dashed.dashed-h {\n border-bottom-width: 1px;\n border-top-width: 1px;\n height: 33.33333%;\n left: 0;\n top: 33.33333%;\n width: 100%;\n }\n \n #filerobot-image-editor-root & .cropper-dashed.dashed-v {\n border-left-width: 1px;\n border-right-width: 1px;\n height: 100%;\n left: 33.33333%;\n top: 0;\n width: 33.33333%;\n }\n \n #filerobot-image-editor-root & .cropper-center {\n display: block;\n height: 0;\n left: 50%;\n opacity: .75;\n position: absolute;\n top: 50%;\n width: 0;\n }\n \n #filerobot-image-editor-root & .cropper-center:before,\n #filerobot-image-editor-root & .cropper-center:after {\n background-color: #fff;\n content: ' ';\n display: block;\n position: absolute;\n }\n \n #filerobot-image-editor-root & .cropper-center:before {\n height: 1px;\n left: -10px;\n top: 0;\n width: 20px;\n }\n \n #filerobot-image-editor-root & .cropper-center:after {\n height: 20px;\n left: 0;\n top: -10px;\n width: 1px;\n }\n \n #filerobot-image-editor-root & .cropper-face,\n #filerobot-image-editor-root & .cropper-line,\n #filerobot-image-editor-root & .cropper-point {\n display: block;\n height: 100%;\n opacity: .1;\n position: absolute;\n width: 100%;\n }\n \n #filerobot-image-editor-root & .cropper-face {\n background-color: #fff;\n left: 0;\n top: 0;\n ", ";\n }\n \n #filerobot-image-editor-root & .cropper-line {\n background-color: #fff;\n }\n \n #filerobot-image-editor-root & .cropper-crop-box-text .cropper-line {\n cursor:default!important;\n opacity:.7!important;\n }\n \n #filerobot-image-editor-root & .cropper-line.line-e {\n cursor: ew-resize;\n right: -3px;\n top: 0;\n width: 5px;\n }\n \n #filerobot-image-editor-root & .cropper-crop-box-text .cropper-line.line-e {\n right: -3px;\n top: 0;\n width: 3px;\n height: calc(100% + 1px);\n }\n \n #filerobot-image-editor-root & .cropper-line.line-n {\n cursor: ns-resize;\n height: 5px;\n left: 0;\n top: -3px;\n }\n \n #filerobot-image-editor-root & .cropper-crop-box-text .cropper-line.line-n {\n cursor: default;\n height: 3px;\n left: 2px;\n top: 0px;\n width: calc(100% - 2px);\n }\n \n #filerobot-image-editor-root & .cropper-line.line-w {\n cursor: ew-resize;\n left: -3px;\n top: 0;\n width: 5px;\n }\n \n #filerobot-image-editor-root & .cropper-crop-box-text .cropper-line.line-w {\n cursor: default;\n left: -1px;\n top: 0;\n width: 3px;\n height: calc(100% + 1px);\n }\n \n #filerobot-image-editor-root & .cropper-line.line-s {\n bottom: -3px;\n cursor: ns-resize;\n height: 5px;\n left: 0;\n }\n \n #filerobot-image-editor-root & .cropper-crop-box-text .cropper-line.line-s {\n bottom: -1px;\n cursor: default;\n height: 3px;\n left: 2px;\n width: calc(100% - 2px);\n }\n \n #filerobot-image-editor-root & .cropper-point {\n background-color: #fff;\n height: 20px;\n opacity: .90;\n width: 20px;\n border-radius: 50%;\n }\n \n #filerobot-image-editor-root & .cropper-crop-box-text .cropper-point {\n display:none!important;\n }\n \n #filerobot-image-editor-root & .cropper-point:before {\n content: '';\n display: table;\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background: black;\n opacity: 0.8;\n z-index: 11;\n position: absolute;\n top: calc(50% - 4px);\n left: calc(50% - 4px);\n }\n \n #filerobot-image-editor-root & .cropper-point.point-e {\n cursor: ew-resize;\n margin-top: -10px;\n right: -10px;\n top: 50%;\n }\n \n #filerobot-image-editor-root & .cropper-point.point-n {\n cursor: ns-resize;\n left: 50%;\n margin-left: -10px;\n top: -10px;\n }\n \n #filerobot-image-editor-root & .cropper-point.point-w {\n cursor: ew-resize;\n left: -10px;\n margin-top: -10px;\n top: 50%;\n }\n \n #filerobot-image-editor-root & .cropper-point.point-s {\n bottom: -10px;\n cursor: s-resize;\n left: 50%;\n margin-left: -10px;\n }\n \n #filerobot-image-editor-root & .cropper-point.point-ne {\n cursor: nesw-resize;\n right: -10px;\n top: -10px;\n }\n \n #filerobot-image-editor-root & .cropper-point.point-nw {\n cursor: nwse-resize;\n left: -10px;\n top: -10px;\n }\n \n #filerobot-image-editor-root & .cropper-point.point-sw {\n bottom: -10px;\n cursor: nesw-resize;\n left: -10px;\n }\n \n #filerobot-image-editor-root & .cropper-point.point-se {\n bottom: -10px;\n cursor: nwse-resize;\n height: 20px;\n right: -10px;\n width: 20px;\n }\n \n #filerobot-image-editor-root & .cropper-point.point-se:before {\n content: '';\n display: table;\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background: black;\n opacity: 0.8;\n z-index: 11;\n position: absolute;\n top: calc(50% - 4px);\n left: calc(50% - 4px);\n }\n \n #filerobot-image-editor-root & .cropper-invisible {\n opacity: 0;\n }\n \n #filerobot-image-editor-root & .cropper-bg {\n background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC');\n }\n \n #filerobot-image-editor-root & .cropper-hide {\n display: block;\n height: 0;\n position: absolute;\n width: 0;\n }\n \n #filerobot-image-editor-root & .cropper-hidden {\n display: none !important;\n }\n \n #filerobot-image-editor-root & .cropper-move {\n cursor: move;\n }\n \n #filerobot-image-editor-root & .cropper-crop {\n cursor: crosshair;\n }\n \n #filerobot-image-editor-root & .cropper-disabled .cropper-drag-box,\n #filerobot-image-editor-root & .cropper-disabled .cropper-face,\n #filerobot-image-editor-root & .cropper-disabled .cropper-line,\n #filerobot-image-editor-root & .cropper-disabled .cropper-point {\n cursor: not-allowed;\n }\n \n @media (max-width: 768px) {\n#filerobot-image-editor-root & {\n display: flex;\n flex-direction: column;\n justify-content: space-between\n}\n }\n\n"])), function (props) {
return props.theme.colors.primaryBg;
}, function (p) {
return p.isLoading ? 'hidden' : 'auto';
}, function (_ref) {
var roundCrop = _ref.roundCrop;
return roundCrop && 'border-radius: 50%';
}, function (_ref2) {
var roundCrop = _ref2.roundCrop;
return roundCrop && "\n border-radius: 50%;\n box-shadow: 0 0 80px 15px #000;\n border: 2px solid #000;";
});
// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
var jsx_runtime = __webpack_require__(0);
// CONCATENATED MODULE: ./src/styledComponents/Footer.ui.js
var _excluded = ["id", "handleChange", "text", "checked", "style"];
var Footer_ui_templateObject, Footer_ui_templateObject2, Footer_ui_templateObject3, Footer_ui_templateObject4, Footer_ui_templateObject5, Footer_ui_templateObject6, Footer_ui_templateObject7, Footer_ui_templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function Footer_ui_taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var Footer = styled_components_browser_esm["b" /* default */].div(Footer_ui_templateObject || (Footer_ui_templateObject = Footer_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n background: ", ";\n border-top: 1px solid ", ";\n height: 35px;\n position: relative;\n z-index: 1;\n}\n"])), function (props) {
return props.theme.colors.secondaryBg;
}, function (props) {
return props.theme.colors.border;
});
var PreviousBtn = styled_components_browser_esm["b" /* default */].div(Footer_ui_templateObject2 || (Footer_ui_templateObject2 = Footer_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n ", ";\n ", ";\n \n ", ";\n}\n"])), function (props) {
return getIconStyles(props);
}, getIconByName('previous'), function (props) {
return getActionIconStyle(props);
});
var NextBtn = styled_components_browser_esm["b" /* default */].div(Footer_ui_templateObject3 || (Footer_ui_templateObject3 = Footer_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n ", ";\n ", ";\n \n ", ";\n}\n"])), function (props) {
return getIconStyles(props);
}, getIconByName('next'), function (props) {
return getActionIconStyle(props);
});
var ResetBtn = styled_components_browser_esm["b" /* default */].div(Footer_ui_templateObject4 || (Footer_ui_templateObject4 = Footer_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n ", ";\n ", ";\n \n ", ";\n}\n"])), function (props) {
return getIconStyles(props);
}, getIconByName('reset'), function (props) {
return getActionIconStyle(props);
});
var FullscreenBtn = styled_components_browser_esm["b" /* default */].div(Footer_ui_templateObject5 || (Footer_ui_templateObject5 = Footer_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n ", ";\n ", ";\n \n ", ";\n}\n"])), function (props) {
return getIconStyles(props);
}, getIconByName('full-screen'), function (props) {
return getActionIconStyle(props);
});
var SwitcherWrapper = styled_components_browser_esm["b" /* default */].div(Footer_ui_templateObject6 || (Footer_ui_templateObject6 = Footer_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n position: relative; \n display: inline-block;\n vertical-align: middle;\n width: 60px;\n margin-bottom: 2px;\n -webkit-user-select: none; \n -moz-user-select: none; \n -ms-user-select: none;\n}\n"])));
var SwitcherInput = styled_components_browser_esm["b" /* default */].input(Footer_ui_templateObject7 || (Footer_ui_templateObject7 = Footer_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: none !important;\n}\n \n #filerobot-image-editor-root & :checked + .onoffswitch-label .onoffswitch-inner {\n margin-left: 0;\n}\n"])));
var SwitcherLabel = styled_components_browser_esm["b" /* default */].label(Footer_ui_templateObject8 || (Footer_ui_templateObject8 = Footer_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: block; \n overflow: hidden; \n cursor: pointer;\n border: 1px solid ", "; \n border-radius: 4px;\n margin: 0;\n}\n"])), function (p) {
return p.theme.colors.border;
});
var SwitcherInner = styled_components_browser_esm["b" /* default */].span(_templateObject9 || (_templateObject9 = Footer_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: block; \n width: 200%; \n margin-left: ", ";\n transition: margin 0.3s ease-in 0s;\n}\n \n #filerobot-image-editor-root &:before, #filerobot-image-editor-root &:after {\n display: block; float: left; width: 50%; height: 19px; padding: 0; line-height: 19px;\n font-size: 10px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold;\n box-sizing: border-box;\n }\n \n #filerobot-image-editor-root &:before {\n content: \"ON\";\n padding-left: 10px !important;\n background-color: ", "; \n color: #fff;\n }\n \n #filerobot-image-editor-root &:after {\n content: \"OFF\";\n padding-right: 10px !important;\n background-color: ", "; \n color: #aaa;\n text-align: right;\n }\n"])), function (props) {
return props.checked ? '0' : '-100%';
}, function (p) {
var _p$theme$colors$butto;
return ((_p$theme$colors$butto = p.theme.colors.button) === null || _p$theme$colors$butto === void 0 ? void 0 : _p$theme$colors$butto.primary) || '#01717d';
}, function (p) {
return p.theme.colors.primaryBg;
});
var SwitcherSwitch = styled_components_browser_esm["b" /* default */].span(_templateObject10 || (_templateObject10 = Footer_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: block; \n width: 10px;\n height: 10px;\n margin: 5.5px;\n background: ", ";\n position: absolute; top: 0; bottom: 0;\n right: ", ";\n border: 1px solid ", "; \n border-radius: 12px;\n transition: all 0.3s ease-in 0s;\n}\n"])), function (p) {
return p.theme.colors.accent;
}, function (props) {
return props.checked ? '0' : '37px';
}, function (p) {
return p.theme.colors.accent;
});
var SwitcherBlock = Object(styled_components_browser_esm["b" /* default */])('div').attrs(function () {
return {
className: 'cloudimage-url-generator-switch'
};
})(_templateObject11 || (_templateObject11 = Footer_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: inline-block;\n vertical-align: middle;\n line-height: 30px;\n margin-right: 10px;\n float: right;\n}\n"])));
var SwitcherText = Object(styled_components_browser_esm["b" /* default */])('div')(_templateObject12 || (_templateObject12 = Footer_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n margin-left: 8px;\n display: inline-block;\n vertical-align: middle;\n color: ", ";\n margin-bottom: 3px;\n cursor: pointer;\n}\n"])), function (p) {
return p.theme.colors.text;
});
var Footer_ui_Switcher = function Switcher(_ref) {
var id = _ref.id,
handleChange = _ref.handleChange,
text = _ref.text,
checked = _ref.checked,
style = _ref.style,
otherProps = _objectWithoutProperties(_ref, _excluded);
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(SwitcherBlock, {
style: style,
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])(SwitcherWrapper, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(SwitcherInput, {
type: "checkbox",
name: id,
id: id,
onChange: function onChange() {
handleChange(!checked);
},
checked: checked
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(SwitcherLabel, {
htmlFor: id,
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(SwitcherInner, {
checked: checked
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(SwitcherSwitch, {
checked: checked
})]
})]
}), text && /*#__PURE__*/Object(jsx_runtime["jsx"])(SwitcherText, {
onClick: function onClick() {
handleChange(!checked);
},
children: text
})]
});
};
function getActionIconStyle(props) {
return "\n display: inline-block;\n height: 34px;\n width: 34px;\n cursor: ".concat(props.muted ? 'not-allowed' : 'pointer', ";\n text-align: center;\n line-height: 34px;\n border-right: 1px solid ").concat(props.theme.colors.border, ";\n \n &:hover {\n background: ").concat(props.muted ? 'inherit' : props.theme.colors.secondaryBgHover, ";\n }\n ");
}
// CONCATENATED MODULE: ./src/styledComponents/Preview.ui.js
var Preview_ui_excluded = ["width", "height"],
_excluded2 = ["image"],
_excluded3 = ["x", "y", "visible"],
_excluded4 = ["visible"];
var Preview_ui_templateObject, Preview_ui_templateObject2, Preview_ui_templateObject3, Preview_ui_templateObject4, Preview_ui_templateObject5;
function Preview_ui_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function Preview_ui_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { Preview_ui_ownKeys(Object(source), true).forEach(function (key) { Preview_ui_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { Preview_ui_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function Preview_ui_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function Preview_ui_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = Preview_ui_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function Preview_ui_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function Preview_ui_taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var PreviewWrapper = styled_components_browser_esm["b" /* default */].div(Preview_ui_templateObject || (Preview_ui_templateObject = Preview_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n height: calc(100% - 187px);\n text-align: center;\n line-height: calc(100% - 187px);\n padding: 10px;\n position: relative;\n flex-grow: 1;\n overflow: auto;\n}\n\n #filerobot-image-editor-root &:before {\n content: '';\n display: inline-block;\n height: 100%;\n vertical-align: middle;\n }\n"])));
var PreResizeBox = Object(styled_components_browser_esm["b" /* default */])('div')(Preview_ui_templateObject2 || (Preview_ui_templateObject2 = Preview_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: inline-block;\n vertical-align: middle;\n width: 100%;\n}\n"])));
var PreviewImgBox = styled_components_browser_esm["b" /* default */].div(Preview_ui_templateObject3 || (Preview_ui_templateObject3 = Preview_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: inline-block;\n max-height: 100%;\n padding: 10px;\n max-width: 100%;\n height: 100%;\n vertical-align: middle;\n overflow: hidden;\n\n ", ";\n\n ", ";\n}\n\n /* Limit image width to avoid overflow the container */\n\n #filerobot-image-editor-root & img {\n max-width: 100% !important; /* This rule is very important, please do not ignore this! */\n }\n\n #filerobot-image-editor-root & .filerobot-edit-canvas {\n display: ", ";\n max-height: 100%;\n max-width: 100%;\n vertical-align: middle;\n }\n"])), function (props) {
return !props.hideCanvas ? "\n &:before {\n content: '';\n display: inline-block;\n height: 100%;\n vertical-align: middle;\n }" : "\n canvas {\n position: relative;\n left: -9999px;\n }\n ";
}, function (p) {
return p.isShowWatermark && "\ncanvas:after {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: red;\n opacity: 0.5;\n }";
}, function (props) {
return props.hide ? 'none' : 'inline-block';
});
var PreviewCanvas = Object(styled_components_browser_esm["b" /* default */])('canvas')(Preview_ui_templateObject4 || (Preview_ui_templateObject4 = Preview_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n width: ", "px;\n height: ", "px;\n display: inline-block;\n max-height: 100%;\n max-width: 100%;\n vertical-align: middle;\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n margin: auto;\n outline: 0;\n}\n"])), function (p) {
return p.width || 0;
}, function (p) {
return p.height || 0;
});
var FocusPointWrap = Object(styled_components_browser_esm["b" /* default */])( /*#__PURE__*/Object(react["forwardRef"])(function (_ref, ref) {
var width = _ref.width,
height = _ref.height,
rest = Preview_ui_objectWithoutProperties(_ref, Preview_ui_excluded);
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", Preview_ui_objectSpread(Preview_ui_objectSpread({
className: "focus-point"
}, rest), {}, {
ref: ref
}));
}))(function (_ref2) {
var width = _ref2.width,
height = _ref2.height;
return {
width: width,
height: height,
position: 'absolute',
margin: 'auto',
top: 0,
bottom: 0,
left: 0,
right: 0,
display: 'inline-block',
maxHeight: '100%',
maxWidth: '100%',
verticalAlign: 'middle'
};
});
var FocusPointContainer = Object(styled_components_browser_esm["b" /* default */])(function (_ref3) {
var image = _ref3.image,
rest = Preview_ui_objectWithoutProperties(_ref3, _excluded2);
return /*#__PURE__*/Object(jsx_runtime["jsx"])("div", Preview_ui_objectSpread({}, rest));
})(function (_ref4) {
var image = _ref4.image;
return Preview_ui_objectSpread({
position: 'relative',
height: '100%',
width: '100%',
cursor: 'crosshair'
}, image ? {
backgroundImage: "url(".concat(image, ")"),
backgroundSize: 'contain'
} : {});
});
var FocusPoint = Object(styled_components_browser_esm["b" /* default */])(function (_ref5) {
var x = _ref5.x,
y = _ref5.y,
visible = _ref5.visible,
rest = Preview_ui_objectWithoutProperties(_ref5, _excluded3);
return /*#__PURE__*/Object(jsx_runtime["jsx"])("span", Preview_ui_objectSpread({}, rest));
})(function (_ref6) {
var _ref6$x = _ref6.x,
x = _ref6$x === void 0 ? 0 : _ref6$x,
_ref6$y = _ref6.y,
y = _ref6$y === void 0 ? 0 : _ref6$y,
_ref6$visible = _ref6.visible,
visible = _ref6$visible === void 0 ? true : _ref6$visible;
return {
position: 'absolute',
top: y,
left: x,
visibility: visible ? 'visible' : 'hidden',
display: 'inline-block',
width: 30,
height: 30,
transform: 'translate(-50%, -50%)',
fontFamily: 'filerobot-image-editor-font !important',
color: '#fff',
fontSize: 30,
'::before': {
content: "'\\e919'",
position: 'absolute',
top: '50%',
left: 0,
textShadow: '0px 0px 3px #000000'
}
};
});
var FocusPointImg = Object(styled_components_browser_esm["b" /* default */])(function (_ref7) {
var visible = _ref7.visible,
rest = Preview_ui_objectWithoutProperties(_ref7, _excluded4);
return /*#__PURE__*/Object(jsx_runtime["jsx"])("img", Preview_ui_objectSpread({}, rest));
})(function (_ref8) {
var visible = _ref8.visible;
return {
visibility: visible ? 'visible' : 'hidden',
maxWidth: '100%',
maxHeight: '100%'
};
}); //watermarkURL
//isShowWatermark
var Canvas = styled_components_browser_esm["b" /* default */].canvas.attrs(function () {
return {};
})(Preview_ui_templateObject5 || (Preview_ui_templateObject5 = Preview_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: ", ";\n max-height: 100%;\n max-width: 100%;\n vertical-align: middle;\n}\n"])), function (props) {
return props.hide ? 'none' : 'inline-block';
});
// CONCATENATED MODULE: ./src/styledComponents/Button.js
var Button_templateObject;
function Button_taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var Button = styled_components_browser_esm["b" /* default */].button(Button_templateObject || (Button_templateObject = Button_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n text-transform: ", ";\n display: ", ";\n padding: ", ";\n font-size: ", ";\n line-height: ", ";\n min-width: ", ";\n height: 45px;\n font-weight: 400;\n text-align: center;\n white-space: nowrap;\n vertical-align: middle;\n touch-action: manipulation;\n cursor: pointer;\n user-select: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n -webkit-transition: all 0.2s ease-in-out;\n -o-transition: all 0.2s ease-in-out;\n transition: all 0.2s ease-in-out;\n background: none;\n border-radius: ", ";\n border: 0;\n \n ", ";\n \n ", ";\n}\n \n #filerobot-image-editor-root &:focus, #filerobot-image-editor-root &:hover {\n text-decoration: none;\n }\n \n #filerobot-image-editor-root &:focus {\n outline: 0;\n -webkit-box-shadow: 0 0 0 2px rgba(2, 117, 216, 0.25);\n box-shadow: 0 0 0 2px rgba(2, 117, 216, 0.25);\n }\n"])), function (props) {
return props.tt || variables.button && variables.button.tt || 'none';
}, function (props) {
return props.hide ? 'none' : 'inline-block';
}, function (props) {
return Button_getElementStylesBySize(props, 'button', 'p');
}, function (props) {
return Button_getElementStylesBySize(props, 'button', 'fz');
}, function (props) {
return Button_getElementStylesBySize(props, 'button', 'lh');
}, function (props) {
return props.fullSize ? '100%' : '62px';
}, function (props) {
return props.borderRadius || Button_getElementStylesBySize(props, 'button', 'br');
}, function (props) {
return isDisabled(props);
}, function (props) {
return getButtonStyles(props);
});
function Button_getElementStylesBySize(props, type, field) {
var sm = props.sm,
lg = props.lg;
var size = sm ? 'sm' : lg ? 'lg' : 'md';
return variables[type] && variables[type][size] && variables[type][size][field];
}
function isDisabled(props) {
if (!props.disabled) return '';
return "\n cursor: not-allowed;\n opacity: .65;\n ";
}
function getButtonStyles(props) {
var _props$theme$colors$b, _props$theme$colors$b2, _props$theme$colors$b3, _props$theme$colors$b4, _props$theme$colors$b5, _props$theme$colors$b6;
if (props.success) return "\n color: #fff;\n background-color: #28a745;\n border-color: ##28a745;\n \n &:hover {\n color: #fff;\n background-color: #218838;\n border-color: #1e7e34;\n }\n \n &:focus {\n -webkit-box-shadow: 0 0 0 2px rgba(92, 184, 92, 0.5);\n box-shadow: 0 0 0 2px rgba(92, 184, 92, 0.5);\n }\n \n :active {\n color: #fff;\n background-color: #1e7e34;\n background-image: none;\n border-color: #1c7430;\n }\n \n ".concat(props.disabled ? "\n background-color: #009345;\n border-color: #009345;\n \n &:hover {\n background-color: #009345;\n border-color: #009345;\n }\n " : '', "\n \n ").concat(props.active ? "\n color: #fff;\n background-color: #1e7e34;\n background-image: none;\n border-color: #1c7430;\n " : '', "\n ");else if (props.primary) return "\n color: #fff;\n background-color: #0275d8;\n border-color: #0275d8;\n \n &:hover {\n color: #fff;\n background-color: #025aa5;\n border-color: #01549b;\n }\n \n &:focus {\n -webkit-box-shadow: 0 0 0 2px rgba(2, 117, 216, 0.5);\n box-shadow: 0 0 0 2px rgba(2, 117, 216, 0.5);\n }\n \n :active {\n color: #fff;\n background-color: #025aa5;\n background-image: none;\n border-color: #01549b;\n }\n \n ".concat(props.disabled ? "\n background-color: #0275d8;\n border-color: #0275d8;\n \n &:hover {\n background-color: #0275d8;\n border-color: #0275d8;\n }\n " : '', "\n \n ").concat(props.active ? "\n color: #fff;\n background-color: #025aa5;\n background-image: none;\n border-color: #01549b;\n " : '', "\n ");else if (props.info) return "\n color: #fff;\n background-color: #5bc0de;\n border-color: #5bc0de;\n \n &:hover {\n color: #fff;\n background-color: #31b0d5;\n border-color: #2aabd2;\n }\n \n &:focus {\n -webkit-box-shadow: 0 0 0 2px rgba(91, 192, 222, 0.5);\n box-shadow: 0 0 0 2px rgba(91, 192, 222, 0.5);\n }\n \n :active {\n color: #fff;\n background-color: #31b0d5;\n background-image: none;\n border-color: #2aabd2;\n }\n \n ".concat(props.disabled ? "\n background-color: #5bc0de;\n border-color: #5bc0de;\n \n &:hover {\n background-color: #5bc0de;\n border-color: #5bc0de;\n }\n " : '', "\n \n ").concat(props.active ? "\n color: #fff;\n background-color: #31b0d5;\n background-image: none;\n border-color: #2aabd2;\n " : '', "\n ");else if (props.warning) return "\n color: #fff;\n background-color: #f0ad4e;\n border-color: #f0ad4e;\n \n &:hover {\n color: #fff;\n background-color: #ec971f;\n border-color: #eb9316;\n }\n \n &:focus {\n -webkit-box-shadow: 0 0 0 2px rgba(240, 173, 78, 0.5);\n box-shadow: 0 0 0 2px rgba(240, 173, 78, 0.5);\n }\n \n :active {\n color: #fff;\n background-color: #ec971f;\n background-image: none;\n border-color: #eb9316;\n }\n \n ".concat(props.disabled ? "\n background-color: #f0ad4e;\n border-color: #f0ad4e;\n \n &:hover {\n background-color: #f0ad4e;\n border-color: #f0ad4e;\n }\n " : '', "\n \n ").concat(props.active ? "\n color: #fff;\n background-color: #ec971f;\n background-image: none;\n border-color: #eb9316;\n " : '', "\n ");else if (props.danger) return "\n color: #fff;\n background-color: #d9534f;\n border-color: #d9534f;\n \n &:hover {\n color: #fff;\n background-color: #c9302c;\n border-color: #c12e2a;\n }\n \n &:focus {\n -webkit-box-shadow: 0 0 0 2px rgba(217, 83, 79, 0.5);\n box-shadow: 0 0 0 2px rgba(217, 83, 79, 0.5);\n }\n \n :active {\n color: #fff;\n background-color: #c9302c;\n background-image: none;\n border-color: #c12e2a;\n }\n \n ".concat(props.disabled ? "\n background-color: #d9534f;\n border-color: #d9534f;\n \n &:hover {\n background-color: #d9534f;\n border-color: #d9534f;\n }\n " : '', "\n \n ").concat(props.active ? "\n color: #fff;\n background-color: #c9302c;\n background-image: none;\n border-color: #c12e2a;\n " : '', "\n ");else if (props.link) return "\n font-weight: normal;\n color: ".concat(getLinkColor(props), "; \n border-radius: 0;\n background-color: transparent;\n outline: none;\n box-shadow: none;\n \n &:hover {\n border-color: transparent;\n color: ").concat(getLinkColor(props, 'over'), ";\n background-color: transparent;\n outline: none;\n box-shadow: none;\n }\n \n &:focus {\n border-color: transparent;\n outline: none;\n box-shadow: none;\n }\n \n :active {\n background-color: transparent;\n outline: none;\n box-shadow: none;\n }\n \n ").concat(props.disabled ? "\n color: ".concat(getLinkColor(props, 'over'), ";\n background-color: transparent;\n \n &:hover {\n color: ").concat(getLinkColor(props, 'over'), ";\n background-color: transparent;\n }\n ") : '', "\n \n ").concat(props.active ? "\n background-color: transparent;\n color: ".concat(getLinkColor(props, 'over'), ";\n ") : '', "\n \n :disabled:focus, :disabled:hover {\n text-decoration: none;\n outline: none;\n box-shadow: none;\n }\n ");else if (props.themeColor) return "\n color: ".concat(Button_getColor(props, 'secondary', 'text'), ";\n background-color: ").concat(((_props$theme$colors$b = props.theme.colors.button) === null || _props$theme$colors$b === void 0 ? void 0 : _props$theme$colors$b.primary) || Button_getColor(props, 'secondary'), ";\n border-color: ").concat(((_props$theme$colors$b2 = props.theme.colors.button) === null || _props$theme$colors$b2 === void 0 ? void 0 : _props$theme$colors$b2.border) || Button_getColor(props, 'secondary', null, true, true), ";\n \n &:hover {\n color: ").concat(Button_getColor(props, 'secondary', 'text'), ";\n background-color: ").concat(((_props$theme$colors$b3 = props.theme.colors.button) === null || _props$theme$colors$b3 === void 0 ? void 0 : _props$theme$colors$b3.hover) || Button_getColor(props, 'secondary', null, true), ";\n border-color: ").concat(((_props$theme$colors$b4 = props.theme.colors.button) === null || _props$theme$colors$b4 === void 0 ? void 0 : _props$theme$colors$b4.borderHover) || Button_getColor(props, 'secondary', null, true, true), ";\n }\n \n &:focus {\n -webkit-box-shadow: 0 0 0 2px ").concat(getWithOpacity(Button_getColor(props, 'secondary'), 0.5), ";\n box-shadow: 0 0 0 2px ").concat(getWithOpacity(Button_getColor(props, 'secondary'), 0.5), ";\n }\n \n :active {\n color: ").concat(Button_getColor(props, 'secondary', 'text'), ";\n background-color: ").concat(((_props$theme$colors$b5 = props.theme.colors.button) === null || _props$theme$colors$b5 === void 0 ? void 0 : _props$theme$colors$b5.active) || Button_getColor(props, 'secondary', null, true), ";\n background-image: none;\n border-color: ").concat(((_props$theme$colors$b6 = props.theme.colors.button) === null || _props$theme$colors$b6 === void 0 ? void 0 : _props$theme$colors$b6.borderActive) || Button_getColor(props, 'secondary', null, true, true), ";\n }\n \n ").concat(props.disabled ? "\n background-color: ".concat(getWithOpacity(Button_getColor(props, 'secondary'), 0.5), ";\n border-color: ").concat(getWithOpacity(Button_getColor(props, 'secondary'), 0.5), ";\n \n &:hover {\n background-color: ").concat(getWithOpacity(Button_getColor(props, 'secondary'), 0.5), ";\n border-color: ").concat(getWithOpacity(Button_getColor(props, 'secondary'), 0.5), ";\n }\n ") : '', "\n \n ").concat(props.active ? "\n color: ".concat(Button_getColor(props, 'secondary', 'text'), ";\n background-color: ").concat(Button_getColor(props, 'secondary', null, true), ";\n background-image: none;\n border-color: ").concat(Button_getColor(props, 'secondary', null, true, true), ";\n ") : '', "\n ");else return "\n background: #fff;\n color: #1e262c;\n border-color: #B0B0B0;\n \n &:hover {\n color: #1e262c;\n background-color: #E1E2E3;\n border-color: #B0B0B0;\n }\n \n &:focus {\n -webkit-box-shadow: 0 0 0 2px rgba(204, 204, 204, 0.5);\n box-shadow: 0 0 0 2px rgba(204, 204, 204, 0.5);\n }\n \n :active {\n color: #1e262c;\n background-color: #E1E2E3;\n border-color: #B0B0B0;\n }\n \n ".concat(props.disabled ? "\n background-color: #fff;\n border-color: #1e262c;\n opacity: 0.6;\n \n &:hover {\n background-color: #fff;\n border-color: #1e262c;\n opacity: 0.6;\n }\n " : '', "\n \n ").concat(props.active ? "\n color: #1e262c;\n background-color: #E1E2E3;\n border-color: #B0B0B0;\n " : '', "\n ");
}
function Button_getColor(props, type) {
var field = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'base';
var isThemeOverlay = arguments.length > 3 ? arguments[3] : undefined;
var isSupreme = arguments.length > 4 ? arguments[4] : undefined;
var themeOverlay = isThemeOverlay ? variables.colors.base : null;
return variables.colors[type][themeOverlay ? themeOverlay + (isSupreme ? 'er' : '') : field];
}
function getLinkColor(props) {
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'base';
var forcedColor = props.light ? 'light' : props.dark ? 'dark' : null;
var isOver = type !== 'base';
var themeType = variables.colors.base;
if (forcedColor) return variables.colors[forcedColor][isOver ? themeType : 'base'];else return variables.colors.link[type];
}
// CONCATENATED MODULE: ./src/styledComponents/Header.ui.js
var Header_ui_templateObject, Header_ui_templateObject2, Header_ui_templateObject3, Header_ui_templateObject4, Header_ui_templateObject5, Header_ui_templateObject6, Header_ui_templateObject7, Header_ui_templateObject8;
function Header_ui_taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var HeaderWrapper = styled_components_browser_esm["b" /* default */].div(Header_ui_templateObject || (Header_ui_templateObject = Header_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n background: ", ";\n}\n"])), function (props) {
return props.theme.colors.secondaryBg;
});
var HeaderTop = styled_components_browser_esm["b" /* default */].div(Header_ui_templateObject2 || (Header_ui_templateObject2 = Header_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n border-bottom: 1px solid ", ";\n background: ", ";\n height: 60px;\n line-height: 60px;\n position: relative;\n}\n"])), function (props) {
return props.theme.colors.primaryBg;
}, function (props) {
return props.theme.colors.primaryBg;
});
var Title = styled_components_browser_esm["b" /* default */].div(Header_ui_templateObject3 || (Header_ui_templateObject3 = Header_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n text-align: center;\n text-transform: ", ";\n color: ", ";\n}\n"])), function (props) {
return props.noCapitalStrs ? 'none' : 'capitalize';
}, function (props) {
return props.theme.colors.text;
});
var ButtonsWrapper = styled_components_browser_esm["b" /* default */].div(Header_ui_templateObject4 || (Header_ui_templateObject4 = Header_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n position: absolute;\n top: 7px;\n left: 12px;\n display: flex;\n align-items: center;\n}\n"])));
var BackButtonWrapper = styled_components_browser_esm["b" /* default */].div(Header_ui_templateObject5 || (Header_ui_templateObject5 = Header_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n height: 32px;\n display: flex;\n align-items: center;\n}\n\n #filerobot-image-editor-root & svg {\n cursor: pointer;\n padding: 9px 12px 9px 0;\n width: 38px;\n height: 32px;\n }\n\n #filerobot-image-editor-root & svg path {\n fill: ", ";\n }\n\n #filerobot-image-editor-root & svg:hover {\n filter: brightness(0.7);\n }\n"])), function (props) {
return props.theme.colors.text;
});
var BackBtnSeparator = styled_components_browser_esm["b" /* default */].div(Header_ui_templateObject6 || (Header_ui_templateObject6 = Header_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n height: 100%;\n width: 1px;\n display: inline-block;\n margin-right: 12px;\n background: ", ";\n}\n"])), function (props) {
return props.theme.colors.border;
});
var CancelBtn = Object(styled_components_browser_esm["b" /* default */])(Button)(Header_ui_templateObject7 || (Header_ui_templateObject7 = Header_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n background: ", ";\n border-color: ", ";\n color: ", ";\n text-transform: ", ";\n min-width: 62px;\n height: 32px;\n margin-right: 8px;\n border: 0;\n}\n\n #filerobot-image-editor-root &:hover {\n background: ", ";\n border-color: ", ";\n color: ", "; \n }\n"])), function (props) {
return props.theme.colors.primaryBg;
}, function (props) {
return props.theme.colors.primaryBg;
}, function (props) {
return props.theme.colors.text;
}, function (props) {
return props.noCapitalStrs ? 'none' : 'capitalize';
}, function (props) {
return getHoverColor(props.theme.colors.primaryBg);
}, function (props) {
return props.theme.colors.primaryBg;
}, function (props) {
return props.theme.colors.text;
});
var ToolbarWrapper = styled_components_browser_esm["b" /* default */].div(Header_ui_templateObject8 || (Header_ui_templateObject8 = Header_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100px;\n background: ", ";\n}\n \n @media (max-width: 768px) {\n#filerobot-image-editor-root & {\n flex-direction: column;\n height: initial\n}\n }\n"])), function (props) {
return props.theme.colors.secondaryBg;
});
// CONCATENATED MODULE: ./src/styledComponents/Crop.ui.js
var Crop_ui_templateObject, Crop_ui_templateObject2, Crop_ui_templateObject3, Crop_ui_templateObject4, Crop_ui_templateObject5, Crop_ui_templateObject6, Crop_ui_templateObject7, Crop_ui_templateObject8, Crop_ui_templateObject9, Crop_ui_templateObject10, Crop_ui_templateObject11, Crop_ui_templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16;
function Crop_ui_taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var CropWrapper = styled_components_browser_esm["b" /* default */].div(Crop_ui_templateObject || (Crop_ui_templateObject = Crop_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n color: ", ";\n display: flex;\n}\n \n @media (min-widthL 768px) {\n#filerobot-image-editor-root & {\n overflow-x: auto;\n overflow-y: hidden;\n white-space: nowrap\n}\n }\n \n @media (max-width: 768px) {\n#filerobot-image-editor-root & {\n flex-direction: column\n}\n }\n"])), function (props) {
return props.theme.colors.text;
});
var PresetsWrapper = Object(styled_components_browser_esm["b" /* default */])('div')(Crop_ui_templateObject2 || (Crop_ui_templateObject2 = Crop_ui_taggedTemplateLiteral(["\n@media (max-width: 768px) {\n#filerobot-image-editor-root & {\n width: 100%;\n overflow-x: scroll\n}\n }\n"])));
var CustomLabel = styled_components_browser_esm["b" /* default */].div(Crop_ui_templateObject3 || (Crop_ui_templateObject3 = Crop_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: block;\n color: ", ";\n height: 30px;\n line-height: 30px;\n}\n"])), function (props) {
return props.theme.colors.text;
});
var FieldSet = styled_components_browser_esm["b" /* default */].div(Crop_ui_templateObject4 || (Crop_ui_templateObject4 = Crop_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: inline-block;\n width: 100px;\n padding-top: 10px;\n text-align: center;\n}\n"])));
var FieldLabel = styled_components_browser_esm["b" /* default */].label(Crop_ui_templateObject5 || (Crop_ui_templateObject5 = Crop_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: block;\n margin-bottom: 5px;\n line-height: 15px;\n}\n"])));
var FieldInput = styled_components_browser_esm["b" /* default */].input.attrs(function (props) {
return {
type: props.type ? props.type : 'text'
};
})(Crop_ui_templateObject6 || (Crop_ui_templateObject6 = Crop_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: inline-block;\n width: ", ";\n ", ";\n height: 30px;\n padding: 6px 12px;\n font-size: 12px;\n line-height: 30px;\n color: ", ";\n background: ", ";\n border-radius: 2px;\n transition: border-color 0.15s ease-in-out;\n vertical-align: middle;\n font-family: Roboto, sans-serif;\n border: 1px solid ", ";\n \n ", ";\n}\n \n #filerobot-image-editor-root &:hover {\n outline: none;\n }\n \n #filerobot-image-editor-root &:focus {\n outline: none;\n }\n"])), function (props) {
return props.fullSize ? '100%' : props.theme.fieldWidth;
}, function (props) {
return !props.fullSize && 'max-width: 400px;';
}, function (p) {
return p.theme.colors.text;
}, function (props) {
return props.theme.colors.primaryBg;
}, function (props) {
return props.theme.colors.border;
}, function (p) {
return p.type === 'number' && "::-webkit-inner-spin-button {\n -webkit-appearance: none;\n }";
});
var FileInput = Object(styled_components_browser_esm["b" /* default */])('input').attrs(function (props) {
return {
type: props.type ? props.type : 'file'
};
})(Crop_ui_templateObject7 || (Crop_ui_templateObject7 = Crop_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: inline-block;\n width: ", ";\n height: 30px;\n padding: 6px 12px;\n font-size: 12px;\n line-height: 1;\n color: ", ";\n background: ", ";\n border-radius: 2px;\n transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;\n vertical-align: middle;\n border: 0px solid transparent;\n font-family: Roboto, sans-serif;\n border: 1px solid ", ";\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n \n #filerobot-image-editor-root &:hover {\n outline: none;\n }\n \n #filerobot-image-editor-root &:focus {\n outline: none;\n }\n"])), function (props) {
return props.fullSize ? '100%' : props.theme.fieldWidth;
}, function (p) {
return p.theme.colors.text;
}, function (props) {
return props.theme.colors.primaryBg;
}, function (props) {
return props.theme.colors.border;
});
var BlockRatioWrapper = styled_components_browser_esm["b" /* default */].div(Crop_ui_templateObject8 || (Crop_ui_templateObject8 = Crop_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: inline-block;\n padding: 0 5px;\n}\n"])));
var BlockRatioBtn = Object(styled_components_browser_esm["b" /* default */])(Button)(Crop_ui_templateObject9 || (Crop_ui_templateObject9 = Crop_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n padding: 0;\n}\n \n #filerobot-image-editor-root & > span {\n color: ", " !important;\n }\n"])), function (props) {
return props.active ? props.theme.colors.text : props.theme.colors.textMute;
});
var BlockRatioIcon = styled_components_browser_esm["b" /* default */].span(Crop_ui_templateObject10 || (Crop_ui_templateObject10 = Crop_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n cursor: pointer;\n position: relative;\n font-weight: bold;\n font-size: ", ";\n\n ", ";\n ", ";\n \n color: ", ";\n}\n"])), function (props) {
return props.fz || '28px';
}, function (props) {
return getIconStyles(props);
}, function (props) {
return getIconByName(props.active ? 'ratio' : 'no-ratio');
}, function (props) {
return props.theme.textMuted;
});
var CropBox = styled_components_browser_esm["b" /* default */].div(Crop_ui_templateObject11 || (Crop_ui_templateObject11 = Crop_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: inline-block;\n vertical-align: top;\n text-align: center;\n padding: 0 20px;\n cursor: pointer;\n background: ", ";\n}\n"])), function (props) {
return props.active ? props.theme.colors.secondaryBgHover : 'transparent';
});
var CropBoxInner = styled_components_browser_esm["b" /* default */].div(Crop_ui_templateObject12 || (Crop_ui_templateObject12 = Crop_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n padding: 15px 0;\n height: 90px;\n line-height: 100px;\n}\n"])));
var CropShape = styled_components_browser_esm["b" /* default */].div(_templateObject13 || (_templateObject13 = Crop_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n height: ", "px;\n border: 1px solid ", ";\n width: ", "px;\n margin: 0 auto;\n display: inline-block;\n vertical-align: middle;\n ", ";\n}\n"])), function (props) {
return getHeightOfShape(props.ratio);
}, function (props) {
return props.theme.textColor;
}, function (props) {
return getWidthOfShape(props.ratio);
}, function (_ref) {
var radius = _ref.radius;
return radius && "border-radius: ".concat(radius, "%;");
});
var CropShapeWrapper = Object(styled_components_browser_esm["b" /* default */])('div')(_templateObject14 || (_templateObject14 = Crop_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n height: 50px;\n line-height: 50px;\n}\n"])));
var ShapeAligner = Object(styled_components_browser_esm["b" /* default */])('div')(_templateObject15 || (_templateObject15 = Crop_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: inline-block;\n vertical-align: middle;\n height: 50px;\n}\n"])));
var CropLabel = styled_components_browser_esm["b" /* default */].div(_templateObject16 || (_templateObject16 = Crop_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n height: 20px;\n line-height: 20px;\n}\n"])));
var getWidthOfShape = function getWidthOfShape(ratio) {
var width = 50 * ratio;
if (width > 200) {
width = 200;
}
return width;
};
var getHeightOfShape = function getHeightOfShape(ratio) {
var height = 50;
var width = 50 * ratio;
if (width > 200) {
height = 200 / ratio;
}
return height;
};
// CONCATENATED MODULE: ./src/styledComponents/Resize.ui.js
var Resize_ui_templateObject, Resize_ui_templateObject2, Resize_ui_templateObject3, Resize_ui_templateObject4, Resize_ui_templateObject5, Resize_ui_templateObject6, Resize_ui_templateObject7;
function Resize_ui_taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var ResizeWrapper = styled_components_browser_esm["b" /* default */].div(Resize_ui_templateObject || (Resize_ui_templateObject = Resize_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n color: ", ";\n text-align: center;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n \n @media (max-width: 768px) {\n#filerobot-image-editor-root & {\n flex-direction: column\n}\n }\n"])), function (props) {
return props.theme.colors.text;
});
var ResizeBox = styled_components_browser_esm["b" /* default */].div(Resize_ui_templateObject2 || (Resize_ui_templateObject2 = Resize_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: flex;\n width: 100%;\n justify-content: center;\n align-items: flex-end;\n padding: 8px 0 20px;\n margin: 0 auto;\n}\n\n @media (min-width: 768px) {\n#filerobot-image-editor-root & {\n width: 500px;\n margin: 0\n}\n }\n"])));
var PreResizeActions = Object(styled_components_browser_esm["b" /* default */])('div')(Resize_ui_templateObject3 || (Resize_ui_templateObject3 = Resize_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & button {\n min-width: 240px;\n }\n\n @media(max-width: 768px) {\n#filerobot-image-editor-root & button {\n min-width: 174px\n }\n }\n"])));
var PreResizeWarning = Object(styled_components_browser_esm["b" /* default */])('p')(Resize_ui_templateObject4 || (Resize_ui_templateObject4 = Resize_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n color: ", ";\n font-size: 14px;\n max-width: 600px;\n line-height: 1.4;\n margin: 0 auto;\n background: ", ";\n border-radius: 4px;\n padding: 15px 15px 15px 55px;\n position: relative;\n font-weight: normal;\n text-align: left;\n}\n \n #filerobot-image-editor-root &:before {\n content: '\\e917';\n font-family: filerobot-image-editor-font;\n position: absolute;\n font-size: 20px;\n line-height: 20px;\n left: 20px;\n top: 50%;\n margin-top: -10px;\n }\n"], ["\n#filerobot-image-editor-root & {\n color: ", ";\n font-size: 14px;\n max-width: 600px;\n line-height: 1.4;\n margin: 0 auto;\n background: ", ";\n border-radius: 4px;\n padding: 15px 15px 15px 55px;\n position: relative;\n font-weight: normal;\n text-align: left;\n}\n \n #filerobot-image-editor-root &:before {\n content: '\\\\e917';\n font-family: filerobot-image-editor-font;\n position: absolute;\n font-size: 20px;\n line-height: 20px;\n left: 20px;\n top: 50%;\n margin-top: -10px;\n }\n"])), function (p) {
return p.theme.colors.textWarn;
}, function (p) {
return p.theme.colors.secondaryBg;
});
var PreResizeInner = Object(styled_components_browser_esm["b" /* default */])('div')(Resize_ui_templateObject5 || (Resize_ui_templateObject5 = Resize_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n max-width: 600px;\n margin: 15px auto;\n background: ", ";\n border-radius: 4px;\n padding: 2px;\n}\n \n #filerobot-image-editor-root & h4 {\n line-height: 1.4;\n margin: 0;\n font-size: 16px;\n color: ", ";\n }\n"])), function (p) {
return p.theme.colors.secondaryBg;
}, function (p) {
return p.theme.colors.text;
});
var SuggestionsBox = Object(styled_components_browser_esm["b" /* default */])('div')(Resize_ui_templateObject6 || (Resize_ui_templateObject6 = Resize_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: inline-block;\n}\n"])));
var SuggestionOption = Object(styled_components_browser_esm["b" /* default */])('div')(Resize_ui_templateObject7 || (Resize_ui_templateObject7 = Resize_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: inline-block;\n background: ", ";\n padding: 15px;\n margin: 5px;\n border-radius: 4px;\n cursor: pointer;\n}\n \n #filerobot-image-editor-root &:hover {\n background-color: ", ";\n }\n"])), function (p) {
return p.theme.colors.primaryBg;
}, function (p) {
return p.theme.colors.primaryBgHover;
});
// CONCATENATED MODULE: ./src/styledComponents/Orientation.ui.js
var Orientation_ui_templateObject, Orientation_ui_templateObject2, Orientation_ui_templateObject3, Orientation_ui_templateObject4, Orientation_ui_templateObject5, Orientation_ui_templateObject6;
function Orientation_ui_taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var OrientationWrapper = styled_components_browser_esm["b" /* default */].div(Orientation_ui_templateObject || (Orientation_ui_templateObject = Orientation_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n color: ", ";\n text-align: center;\n}\n \n #filerobot-image-editor-root & svg {\n margin-top: -7px;\n width: 750px;\n }\n \n #filerobot-image-editor-root & svg text {\n font-size: 2px;\n }\n \n #filerobot-image-editor-root & .image-editor-range-wrapper {\n width: 280px;\n padding: 0;\n margin: 12px auto 0;\n }\n \n #filerobot-image-editor-root & .image-editor-range-wrapper input#range {\n background: none;\n width: 280px;\n }\n \n #filerobot-image-editor-root & .image-editor-range-wrapper input#range::-webkit-slider-thumb {\n -webkit-appearance: none;\n width: 9px;\n height: 18px;\n border-radius: 50%;\n background: ", ";\n }\n \n #filerobot-image-editor-root & .image-editor-range-wrapper input#range::-moz-range-thumb {\n border: none;\n width: 9px;\n height: 18px;\n border-radius: 50%;\n background: ", ";\n cursor: pointer;\n }\n \n #filerobot-image-editor-root & .image-editor-range-wrapper label {\n display: none;\n }\n \n #filerobot-image-editor-root & .image-editor-range-wrapper :after {\n display: none;\n }\n \n @media (max-width: 768px) {\n #filerobot-image-editor-root & svg {\n width: 100%;\n }\n }\n"])), function (props) {
return props.theme.colors.text;
}, function (p) {
return p.theme.colors.text;
}, function (p) {
return p.theme.colors.text;
});
var RotateWrapper = styled_components_browser_esm["b" /* default */].div(Orientation_ui_templateObject2 || (Orientation_ui_templateObject2 = Orientation_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: inline-block;\n width: 100%;\n}\n"])));
var RotateButton = styled_components_browser_esm["b" /* default */].div(Orientation_ui_templateObject3 || (Orientation_ui_templateObject3 = Orientation_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n margin-top: 10px;\n width: 100%;\n}\n \n #filerobot-image-editor-root & button {\n text-transform: none;\n font-size: 12px;\n min-width: 142px;\n margin-right: 5px;\n }\n \n #filerobot-image-editor-root & button:focus, #filerobot-image-editor-root & button:active {\n outline: none !important;\n box-shadow: none !important;\n }\n"])));
var ButtonGroup = Object(styled_components_browser_esm["b" /* default */])('div')(Orientation_ui_templateObject4 || (Orientation_ui_templateObject4 = Orientation_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: flex;\n width: 100%;\n flex-wrap: wrap;\n justify-content: center;\n}\n"])));
var RotateIcon = styled_components_browser_esm["b" /* default */].span(Orientation_ui_templateObject5 || (Orientation_ui_templateObject5 = Orientation_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n ", ";\n ", ";\n height: 16px;\n font-size: 16px;\n margin-top: -4px;\n display: inline-block;\n vertical-align: middle;\n color: ", ";\n margin-right: 5px;\n}\n"])), function (props) {
return getIconStyles(props);
}, function (props) {
return getIconByName(props.name);
}, function (props) {
return props.theme.colors.text;
});
var DarkBtn = Object(styled_components_browser_esm["b" /* default */])(CancelBtn)(Orientation_ui_templateObject6 || (Orientation_ui_templateObject6 = Orientation_ui_taggedTemplateLiteral(["\n@media (max-width: 768px) {\n#filerobot-image-editor-root & {\n width: 50%;\n margin-right: 0 !important\n}\n }\n"])));
// CONCATENATED MODULE: ./src/styledComponents/Adjust.ui.js
var Adjust_ui_templateObject;
function Adjust_ui_taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var AdjustWrapper = styled_components_browser_esm["b" /* default */].div(Adjust_ui_templateObject || (Adjust_ui_templateObject = Adjust_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n color: ", ";\n text-align: center;\n display: flex;\n justify-content: center;\n width: fit-content;\n margin: 0 auto;\n}\n\n #filerobot-image-editor-root & div {\n margin-left: 10px;\n }\n\n @media (max-width: 768px) {\n#filerobot-image-editor-root & {\n flex-wrap: wrap\n}\n \n #filerobot-image-editor-root & .image-editor-range-wrapper {\n width: 50%;\n }\n \n #filerobot-image-editor-root & .image-editor-range-wrapper input {\n width: 100% !important;\n }\n }\n"])), function (props) {
return props.theme.colors.text;
});
// CONCATENATED MODULE: ./src/styledComponents/Common.ui.js
var Common_ui_templateObject, Common_ui_templateObject2;
function Common_ui_taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var NoClickOverlay = styled_components_browser_esm["b" /* default */].div(Common_ui_templateObject || (Common_ui_templateObject = Common_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n position: absolute;\n z-index: 999;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n cursor: wait;\n}\n"])));
var NoClickToolbar = Object(styled_components_browser_esm["b" /* default */])('div')(Common_ui_templateObject2 || (Common_ui_templateObject2 = Common_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n position: absolute;\n z-index: 999;\n top: 36px;\n left: 0;\n right: 0;\n height: 104px;\n cursor: not-allowed;\n}\n"])));
// CONCATENATED MODULE: ./src/styledComponents/CloseBtn.js
var CloseBtn_templateObject;
function CloseBtn_taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var CloseBtn = styled_components_browser_esm["b" /* default */].span.attrs(function () {
return {
role: 'button'
};
})(CloseBtn_templateObject || (CloseBtn_templateObject = CloseBtn_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n cursor: pointer;\n position: absolute;\n font-weight: normal;\n top: ", ";\n right: ", ";\n left: ", ";\n bottom: ", ";\n font-size: ", ";\n z-index: 10;\n speak: none;\n color: ", ";\n font-family: 'filerobot-image-editor-font' !important;\n font-style: normal;\n font-variant: normal;\n text-transform: none;\n\n /* Better Font Rendering =========== */\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n \n #filerobot-image-editor-root &:hover {\n filter: brightness(0.7);\n }\n \n #filerobot-image-editor-root &:before {\n content: '\\e90c';\n }\n"], ["\n#filerobot-image-editor-root & {\n cursor: pointer;\n position: absolute;\n font-weight: normal;\n top: ", ";\n right: ", ";\n left: ", ";\n bottom: ", ";\n font-size: ", ";\n z-index: 10;\n speak: none;\n color: ", ";\n font-family: 'filerobot-image-editor-font' !important;\n font-style: normal;\n font-variant: normal;\n text-transform: none;\n\n /* Better Font Rendering =========== */\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n \n #filerobot-image-editor-root &:hover {\n filter: brightness(0.7);\n }\n \n #filerobot-image-editor-root &:before {\n content: '\\\\e90c';\n }\n"])), function (props) {
return props.t || 0;
}, function (props) {
return props.r || '12px';
}, function (props) {
return props.l;
}, function (props) {
return props.b || 'auto';
}, function (props) {
return props.fz || '22px';
}, function (props) {
return props.theme.colors.text;
});
// CONCATENATED MODULE: ./src/styledComponents/Spinner.js
var Spinner_templateObject, Spinner_templateObject2;
function Spinner_taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
/* Spinner loader */
var SpinnerOverlay = styled_components_browser_esm["b" /* default */].div(Spinner_templateObject || (Spinner_templateObject = Spinner_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow: hidden;\n position: ", ";\n background: ", " !important;\n opacity: ", " !important;\n z-index: 1042;\n}\n"])), function (props) {
return props.fullScreen ? 'fixed' : 'absolute';
}, function (props) {
return props.overlay ? 'rgba(10,10,10,0.26)' : 'transparent';
}, function (props) {
return props.overlay ? '0.25' : '0';
});
var IconWrapper = Object(styled_components_browser_esm["b" /* default */])('div')(Spinner_templateObject2 || (Spinner_templateObject2 = Spinner_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n animation: spinnerFadeInAnimation 300ms linear both;\n @keyframes spinnerFadeInAnimation {\n from {opacity: 0;}\n to {opacity: 1;}\n }\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n width: 200px;\n height: 200px;\n margin: auto;\n padding: 40px;\n border-radius: 50%;\n background: ", ";\n}\n \n #filerobot-image-editor-root & .svg-spin-icon {\n fill: ", ";\n }\n \n #filerobot-image-editor-root & p {\n color: ", ";\n }\n"])), function (p) {
return p.theme.colors.secondaryBgOpacity;
}, function (p) {
return p.theme.colors.text;
}, function (p) {
return p.theme.colors.text;
});
var Spinner_Spinner = function Spinner(props) {
if (!props.show) return null;
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(react["Fragment"], {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(SpinnerOverlay, {
fullScreen: props.fullScreen,
overlay: props.overlay
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(IconWrapper, {
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])("svg", {
id: "Layer_1",
x: "0px",
y: "0px",
viewBox: "0 0 150 150",
style: {
enableBackground: 'new 0 0 150 150'
},
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("path", {
className: "svg-spin-icon",
d: "M74.9,14.8c-12.2,0-24.3,0-36.5,0c-2.4,0-3.9-1-4.8-3.1c-1.3-3-1.2-6,0.6-8.9c0.8-1.3,2-2,3.5-2 c1.1,0,2.3,0,3.4,0c23.3,0,46.7,0,70-0.1c3.9,0,5.3,1.9,6,4.7c0.5,2.1,0.4,4.2-0.5,6.3c-0.9,2.2-2.5,3.1-4.8,3c-2.9,0-5.7,0-8.6,0 C93.9,14.8,84.4,14.8,74.9,14.8z"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("path", {
className: "svg-spin-icon",
d: "M75.1,118.1c12,0,24,0,35.9,0c4,0,5.9,1.7,6.3,5.7c0.1,1.4,0,2.9-0.3,4.2c-0.7,2.9-2.4,4.1-5.3,4.1 c-24.1,0-48.3,0-72.4,0c-3.7,0-5.4-1.2-6.3-5.3c-0.4-2-0.1-3.9,0.7-5.7c0.9-2,2.4-3.1,4.7-3C50.6,118.1,62.9,118.1,75.1,118.1z"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("path", {
className: "svg-spin-icon",
d: "M75.3,76.3c0.2,0.4,3.1,9.3,7.2,14.1c3.9,4.7,8.9,8.5,13,12.5c3.2,3.2,5.4,7,6.8,11.2c0.5,1.6,0.3,1.9-1.4,1.9 c-17.3,0-34.5,0-51.8,0c-1.7,0-1.9-0.2-1.3-1.8c1.8-5.5,5.2-10,9.4-13.9c3.5-3.3,7.7-6.1,10.6-9.9c3.5-4.7,6.8-13.3,7.1-14.1 C75.1,76.3,75.2,76.3,75.3,76.3z"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("path", {
className: "svg-spin-icon",
d: "M45.5,23.6c0,3.8-0.1,7.6,1.2,11.3c1,2.9,2.8,5.2,4.9,7.3c5,5.3,10.2,10.5,15.2,15.8c1.1,1.2,2,2.6,3.1,3.9 c2,2.5,2.2,7.6-0.2,10.5c-1.8,2.2-3.6,4.3-5.5,6.4C59.5,84,54.7,89.1,50,94.2c-3.1,3.4-4.4,7.5-4.5,12c0,2.8-0.1,5.6,0,8.4 c0,1-0.3,1.4-1.4,1.4c-1.7,0-2.3,0-3.7,0c-0.9,0-1.3-0.4-1.3-1.3c0-5-0.3-10,0.8-14.9c0.8-3.5,2.5-6.6,4.8-9.3 c3.6-4.2,7.5-8.2,11.3-12.3c1.7-1.8,3.3-3.7,4.9-5.5c0.9-1,1.9-2,2.7-3c1.8-2.3,1.6-4.3-0.4-6.4c-5.2-5.4-10.4-11-15.8-16.3 c-5.7-5.7-8.4-12.4-8.3-20.4c0-2.9,0-5.7,0-8.6c0-1.1,0.4-1.6,1.5-1.5c1.3,0,2.6,0,3.8,0c0.8,0,1.1,0.3,1.1,1.2 C45.5,19.8,45.5,21.7,45.5,23.6z"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("path", {
className: "svg-spin-icon",
d: "M109.9,35.9c-0.6,2.7-2.1,5.3-3.9,7.5c-3.5,4.2-7.5,8.1-11.2,12.1c-3,3.2-5.9,6.5-8.8,9.7 c-0.9,1-0.9,2.1-0.2,3.1c1.2,1.7,2.5,3.3,3.8,4.8c1.5,1.8,3,3.6,4.6,5.3c3.4,3.6,6.8,7.1,10.1,10.7c4.7,5.1,6.8,11.2,6.9,18.1 c0,2.4,0,5,0,7.5c0,1.3-0.3,1.5-1.6,1.5c-1.3,0-2.1,0-3.3,0c-1.1,0-1.5-0.4-1.5-1.5c0-3.4-0.2-6.7-0.3-10.1 c-0.1-4.1-1.9-7.5-4.5-10.5c-3.3-3.8-6.8-7.4-10.2-11.1c-3.3-3.5-6.9-6.6-9.3-10.8c-0.8-1.5-1.4-3.2-1.7-4.9c-0.4-2.1,0.7-4,1.9-5.5 c3.1-3.8,6.5-7.4,9.8-11.1c2.9-3.2,6-6.2,9-9.3c3.5-3.6,5.1-8,5.2-13c0-3.4,0.1-6.7,0.1-10.1c0-1.1,0.3-1.5,1.3-1.4 c1.2,0,2.4,0,3.6,0c1.2,0,1.6,0.5,1.6,1.6c-0.1,1.6,0,3.1,0,4.7C111.4,23,110.9,31.7,109.9,35.9z"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("path", {
className: "svg-spin-icon",
d: "M74.8,67.9c-0.2-1.3-1.1-5.7-1.5-7C71.4,54,59.7,44.3,54.3,39c-0.7-0.7-1.3-1.5-1.8-2.5 c7.1,3.4,14.4,6.1,22.6,6.1c8.2,0,15.5-2.6,22.4-6.2c0.1,0.1,0.2,0.2,0.3,0.3c-0.5,0.6-0.9,1.2-1.4,1.8c-4.5,4.5-18.7,15.5-20,22.4 c-0.2,0.8-1,6.2-1.2,7C75.1,67.9,75,67.9,74.8,67.9z"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("g", {})]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("p", {
style: {
textAlign: 'center'
},
children: props.label
})]
})]
});
};
// CONCATENATED MODULE: ./src/styledComponents/Watermark.ui.js
var Watermark_ui_templateObject, Watermark_ui_templateObject2, Watermark_ui_templateObject3, Watermark_ui_templateObject4, Watermark_ui_templateObject5, Watermark_ui_templateObject6, Watermark_ui_templateObject7, Watermark_ui_templateObject8, Watermark_ui_templateObject9, Watermark_ui_templateObject10, Watermark_ui_templateObject11;
function Watermark_ui_taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var WatermarkWrapper = styled_components_browser_esm["b" /* default */].div(Watermark_ui_templateObject || (Watermark_ui_templateObject = Watermark_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n position: relative;\n color: ", ";\n text-align: left;\n white-space: normal;\n width: fit-content;\n margin: 0 auto;\n}\n \n #filerobot-image-editor-root & .image-editor-range {\n display: inline-block;\n padding: 5px;\n vertical-align: middle;\n }\n \n #filerobot-image-editor-root & .image-editor-range :after {\n display: none;\n }\n \n #filerobot-image-editor-root & .image-editor-range label {\n display: none;\n }\n \n @media (max-width: 768px) {\n#filerobot-image-editor-root & {\n display: flex;\n flex-direction: column;\n align-items: center\n}\n \n #filerobot-image-editor-root & .image-editor-range {\n width: 100%;\n }\n \n #filerobot-image-editor-root & .image-editor-range input {\n width: 100% !important;\n }\n }\n"])), function (props) {
return props.theme.colors.text;
});
var WrapperForURL = Object(styled_components_browser_esm["b" /* default */])('div')(Watermark_ui_templateObject2 || (Watermark_ui_templateObject2 = Watermark_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n padding: 10px;\n}\n \n #filerobot-image-editor-root & label {\n min-width: 120px;\n display: inline-block;\n vertical-align: middle;\n margin: 0;\n }\n \n #filerobot-image-editor-root & input {\n width: 100%;\n }\n"])));
var WrapperForControls = Object(styled_components_browser_esm["b" /* default */])('div')(Watermark_ui_templateObject3 || (Watermark_ui_templateObject3 = Watermark_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n ", ";\n}\n"])), function (p) {
if (p.switcherPosition === 'right') {
return ".cloudimage-url-generator-switch {\n margin-left: 100px;\n margin-top: -6px;\n \n label {\n min-width: auto;\n }\n \n @media (max-width: 768px) {\n margin-left: 4px;\n }\n }";
} else {
return 'padding: 10px;';
}
});
var WrapperForOpacity = Object(styled_components_browser_esm["b" /* default */])('div')(Watermark_ui_templateObject4 || (Watermark_ui_templateObject4 = Watermark_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: inline;\n vertical-align: middle;\n padding: 10px;\n}\n\n #filerobot-image-editor-root & label {\n min-width: 120px;\n display: inline-block;\n vertical-align: middle;\n }\n"])));
var WatermarkInputs = Object(styled_components_browser_esm["b" /* default */])('div')(Watermark_ui_templateObject5 || (Watermark_ui_templateObject5 = Watermark_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n width: calc(100% - 200px);\n display: inline-block;\n vertical-align: top;\n padding: 0 40px;\n}\n \n @media (max-width: 768px) {\n#filerobot-image-editor-root & {\n width: 100%;\n padding: 0\n}\n }\n"])));
var WatermarkPositionWrapper = Object(styled_components_browser_esm["b" /* default */])('div')(Watermark_ui_templateObject6 || (Watermark_ui_templateObject6 = Watermark_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n width: 100px;\n padding: 5px;\n display: inline-block;\n font-size: 0;\n}\n \n #filerobot-image-editor-root & div:nth-child(1) {\n border-radius: 4px 0 0 0;\n }\n \n #filerobot-image-editor-root & div:nth-child(3) {\n border-radius: 0 4px 0 0;\n }\n \n #filerobot-image-editor-root & div:nth-child(7) {\n border-radius: 0 0 0 4px;\n }\n \n #filerobot-image-editor-root & div:nth-child(9) {\n border-radius: 0 0 4px 0;\n }\n"])));
var WatermarkInputTypes = Object(styled_components_browser_esm["b" /* default */])('div')(Watermark_ui_templateObject7 || (Watermark_ui_templateObject7 = Watermark_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n width: 100px;\n padding: 10px;\n display: inline-block;\n vertical-align: top;\n}\n \n /* The container */\n \n #filerobot-image-editor-root & label {\n display: block;\n position: relative;\n line-height: 12px;\n padding-left: 15px;\n margin-bottom: 12px;\n cursor: pointer;\n user-select: none;\n }\n \n /* Hide the browser's default radio button */\n \n #filerobot-image-editor-root & label input {\n position: absolute;\n opacity: 0;\n cursor: pointer;\n }\n \n /* Create a custom radio button */\n \n #filerobot-image-editor-root & span {\n position: absolute;\n top: 0;\n left: 0;\n height: 10px;\n width: 10px;\n background-color: ", ";\n border-radius: 50%;\n }\n \n /* On mouse-over, add a grey background color */\n \n #filerobot-image-editor-root & label:hover input ~ span {\n /* background-color: #ccc; */\n }\n \n /* When the radio button is checked, add a blue background */\n \n #filerobot-image-editor-root & label input:checked ~ span {\n background-color: ", ";\n }\n \n #filerobot-image-editor-root & label input:checked ~ span:after {\n background-color: ", ";\n }\n \n /* Create the indicator (the dot/circle - hidden when not checked) */\n \n #filerobot-image-editor-root & span:after {\n content: \"\";\n position: absolute;\n display: none;\n }\n \n /* Show the indicator (dot/circle) when checked */\n \n #filerobot-image-editor-root & label input:checked ~ span:after {\n display: block;\n }\n \n /* Style the indicator (dot/circle) */\n \n #filerobot-image-editor-root & label span:after {\n top: 3px;\n left: 2px;\n width: 6px;\n height: 5px;\n border-radius: 50%;\n background: ", ";\n }\n \n @media (max-width: 768px) {\n#filerobot-image-editor-root & {\n width: 100%\n}\n \n #filerobot-image-editor-root & label {\n display: inline-block;\n margin-right: 10px;\n }\n }\n"])), function (p) {
return p.theme.colors.text;
}, function (p) {
return p.theme.colors.text;
}, function (p) {
return p.theme.colors.accent;
}, function (p) {
return p.theme.colors.text;
});
var PositionSquare = Object(styled_components_browser_esm["b" /* default */])('div')(Watermark_ui_templateObject8 || (Watermark_ui_templateObject8 = Watermark_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n width: 30px;\n height: 30px;\n display: inline-block;\n vertical-align: top;\n border: 1px solid ", ";\n background: ", ";\n cursor: ", ";\n \n ", ";\n}\n"])), function (p) {
return p.theme.colors.secondaryBgHover;
}, function (p) {
var _p$theme$colors$butto;
return p.clickable ? p.active ? ((_p$theme$colors$butto = p.theme.colors.button) === null || _p$theme$colors$butto === void 0 ? void 0 : _p$theme$colors$butto.primary) || p.theme.colors.primaryBg : p.theme.colors.accent : p.theme.colors.disabledBg;
}, function (p) {
return p.clickable ? 'pointer' : 'not-allowed';
}, function (p) {
if (p.clickable !== 0 && !p.active) {
return "\n &:hover {\n background: ".concat(p.theme.colors.primaryBg, ";\n }\n ");
}
});
var SelectWatermarkLabel = Object(styled_components_browser_esm["b" /* default */])('div')(Watermark_ui_templateObject9 || (Watermark_ui_templateObject9 = Watermark_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: inline-block;\n vertical-align: middle;\n margin-left: 20px;\n cursor: pointer;\n}\n"])));
var Watermarks = Object(styled_components_browser_esm["b" /* default */])('div')(Watermark_ui_templateObject10 || (Watermark_ui_templateObject10 = Watermark_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n line-height: 100px;\n background: ", ";\n}\n"])), function (p) {
return p.theme.colors.secondaryBg;
});
var WatermarkIcon = Object(styled_components_browser_esm["b" /* default */])('div')(Watermark_ui_templateObject11 || (Watermark_ui_templateObject11 = Watermark_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n width: 200px;\n height: 70px;\n display: inline-block;\n vertical-align: middle;\n background: ", " url(", ") 50% 50% / contain no-repeat; \n margin: 10px;\n padding: 20px;\n border-radius: 4px;\n cursor: pointer;\n}\n \n #filerobot-image-editor-root &:hover {\n background-color: ", ";\n }\n"])), function (p) {
return p.theme.colors.primaryBgHover;
}, function (p) {
return p.src;
}, function (p) {
return p.theme.colors.secondaryBgHover;
});
// CONCATENATED MODULE: ./src/styledComponents/SaveActions.ui.js
var SaveActions_ui_templateObject, SaveActions_ui_templateObject2, SaveActions_ui_templateObject3, SaveActions_ui_templateObject4, SaveActions_ui_templateObject5;
function SaveActions_ui_taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var SaveActions_ui_SaveActions = styled_components_browser_esm["b" /* default */].div(SaveActions_ui_templateObject || (SaveActions_ui_templateObject = SaveActions_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: inline-block;\n margin-left: 1px;\n}\n"])));
var SaveActionsSlideButton = Object(styled_components_browser_esm["b" /* default */])(Button)(SaveActions_ui_templateObject2 || (SaveActions_ui_templateObject2 = SaveActions_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n height: 32px;\n width: 32px;\n min-width: 32px;\n border-radius: 0px 2px 2px 0px;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n #filerobot-image-editor-root & i {\n border: solid #fff;\n border-width: 0 2px 2px 0;\n display: inline-block;\n padding: 2px;\n transform: rotate(45deg);\n }\n"])));
var SaveActionsMenu = styled_components_browser_esm["b" /* default */].div(SaveActions_ui_templateObject3 || (SaveActions_ui_templateObject3 = SaveActions_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n position: absolute;\n top: 31px;\n left: 0;\n min-width: 146px;\n z-index: 1111;\n box-shadow: 0 2px 4px rgba(77, 78, 78, 0.25);\n border-radius: 0 0 2px 2px;\n background: ", ";\n color: ", ";\n}\n"])), function (props) {
var _props$theme$colors, _props$theme$colors$b, _props$theme$colors2;
return ((_props$theme$colors = props.theme.colors) === null || _props$theme$colors === void 0 ? void 0 : (_props$theme$colors$b = _props$theme$colors.button) === null || _props$theme$colors$b === void 0 ? void 0 : _props$theme$colors$b.secondary) || ((_props$theme$colors2 = props.theme.colors) === null || _props$theme$colors2 === void 0 ? void 0 : _props$theme$colors2.accent) || '#ccc';
}, function (props) {
return props.theme.colors.text || '#fff';
});
var SaveActionsItem = styled_components_browser_esm["b" /* default */].div(SaveActions_ui_templateObject4 || (SaveActions_ui_templateObject4 = SaveActions_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n cursor: pointer;\n font-size: 12px;\n line-height: 14px;\n padding: 9px 12px;\n text-align: center;\n}\n\n #filerobot-image-editor-root &:hover {\n backdrop-filter: brightness(0.95);\n }\n"])));
var SaveActionsBackdrop = styled_components_browser_esm["b" /* default */].div(SaveActions_ui_templateObject5 || (SaveActions_ui_templateObject5 = SaveActions_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 1110;\n}\n"])));
// CONCATENATED MODULE: ./src/styledComponents/index.js
// CONCATENATED MODULE: ./src/config.js
var CONTAINER_SELECTOR = 'filerobot-image-editor-root'; // The library modal ID.
var MODAL_ID = 'filerobot-image-editor-modal'; // ID for preview canvas (canvas contains watermark, shapes...etc).
var PREVIEW_CANVAS_ID = 'filerobot-shapes-edit-box';
var CANVAS_ID = 'filerobot-image-edit-box';
var ORIGINAL_CANVAS_ID = 'filerobot-image-edit-box-original'; // 'effects', 'filters', 'adjust', 'crop', 'resize', 'rotate'
var TOOLS = ['adjust', 'effects', 'filters', 'rotate', 'crop', 'resize', 'watermark', 'shapes', 'image', 'text']; // 'clarity', 'edge_enhance', 'emboss', 'grungy', 'hazy', 'lomo', 'noise', 'old_paper', 'posterize', 'radial_blur',
// 'sin_city', 'tilt_shift'
var EFFECTS = ['edge_enhance', 'emboss', 'grungy', 'hazy', 'lomo', 'radial_blur', 'sin_city', 'tilt_shift']; // 'colorize', 'contrast', 'cross_process', 'glow_sun', 'hdr_effect', 'jarques', 'love', 'old_boot',
// 'orange_peel', 'pin_hole', 'pleasant', 'sepia', 'sun_rise', 'vintage'
var FILTERS = ['cross_process', 'glow_sun', 'jarques', 'love', 'old_boot', 'orange_peel', 'pin_hole', 'sepia', 'sun_rise', 'vintage'];
var CLOUDIMAGE_OPERATIONS = ['crop', 'resize', 'rotate', 'watermark', 'focus_point'];
var WATERMARK_POSITIONS = ["left-top", "center-top", "right-top", "left-center", "center", "right-center", "left-bottom", "center-bottom", "right-bottom"]; // possible positions ["corners", "star", "center", "top-row", "center-row", "bottom-row"]
var WATERMARK_POSITIONS_PRESET = {
"corners": [1, 0, 1, 0, 0, 0, 1, 0, 1],
"star": [0, 1, 0, 1, 1, 1, 0, 1, 0],
"center": [0, 0, 0, 0, 1, 0, 0, 0, 0],
"top-row": [1, 1, 1, 0, 0, 0, 0, 0, 0],
"center-row": [0, 0, 0, 1, 1, 1, 0, 0, 0],
"bottom-row": [0, 0, 0, 0, 0, 0, 1, 1, 1]
};
var DEFAULT_WATERMARK = {
opacity: 0.7,
position: 'center',
url: '',
applyByDefault: false
};
var WATERMARK_UNIQUE_KEY = 'watermark-layer';
var config_cropPresets = [{
name: 'original',
value: 0
}, {
name: 'square',
value: 1
}, /* Mod ??? *//*{
name: 'banner',
value: 7.8
}, {
name: 'round',
value: 1,
radius: 50
},*/ {
name: '5 : 4',
value: 1.25
}, {
name: '4 : 3',
value: 1.33333
}, /* Mod ??? *//*{
name: '6 : 4',
value: 1.5
}, {
name: '16 : 9',
value: 1.7777
}*/];
var config_resizePresets = [{
name: 'big square',
width: 600,
height: 600,
ratio: 1
}, {
name: 'middle square',
width: 400,
height: 400,
ratio: 1
}, {
name: 'small square',
width: 200,
height: 200,
ratio: 1
}, {
name: 'small size',
width: 1200,
height: 960,
ratio: 1.25
}, {
name: 'better quality',
width: 1920,
height: 1536,
ratio: 1.25
}, {
name: 'small size',
width: 1200,
height: 900,
ratio: 1.33333
}, {
name: 'better quality',
width: 1920,
height: 1440,
ratio: 1.33333
}, {
name: 'small size',
width: 1200,
height: 800,
ratio: 1.5
}, {
name: 'better quality',
width: 1920,
height: 1280,
ratio: 1.5
}, {
name: 'small size',
width: 1200,
height: 675,
ratio: 1.7777
}, {
name: 'better quality',
width: 1920,
height: 1080,
ratio: 1.7777
}, {
name: 'small banner',
width: 468,
height: 60,
ratio: 7.8
}, {
name: 'big banner',
width: 936,
height: 120,
ratio: 7.8
}];
var STANDARD_FONTS = [{
label: 'Arial',
value: 'Arial'
}, {
label: 'Tahoma',
value: 'Tahoma'
}, {
label: 'Times New Roman',
value: 'Times New Roman'
}, {
label: 'Courier',
value: 'Courier'
}, {
label: 'Courier New',
value: 'Courier New'
}, {
label: 'Verdana',
value: 'Verdana'
}, {
label: 'Georgia',
value: 'Georgia'
}, {
label: 'Palatino',
value: 'Palatino'
}, {
label: 'Garamond',
value: 'Garamond'
}, {
label: 'Bookman',
value: 'Bookman'
}, {
label: 'Comic Sans MS',
value: 'Comic Sans MS'
}, {
label: 'Candara',
value: 'Candara'
}, {
label: 'Impact',
value: 'Impact'
}];
var WATERMARK_CLOUDIMAGE_FONTS = [{
label: 'Arial',
value: 'Arial'
}, {
label: 'Arial Bold',
value: 'Arial-Bold'
}, {
label: 'Arial Black',
value: 'Arial-Black'
}, {
label: 'AvantGarde Book',
value: 'AvantGarde-Book'
}, {
label: 'Bitstream Charter',
value: 'Bitstream-Charter'
}, {
label: 'Bitstream Charter Bold',
value: 'Bitstream-Charter-Bold'
}, {
label: 'Bookman Demi',
value: 'Bookman-Demi'
}, {
label: 'Comic Sans MS',
value: 'Comic-Sans-MS'
}, {
label: 'Courier',
value: 'Courier'
}, {
label: 'Courier Bold',
value: 'Courier-Bold'
}, {
label: 'Courier New',
value: 'Courier-New '
}, {
label: 'Courier New Bold',
value: 'Courier-New-bold'
}, {
label: 'DejaVu Sans',
value: 'DejaVu-Sans'
}, {
label: 'DejaVu Sans Bold',
value: 'DejaVu-Sans-bold'
}, {
label: 'Dingbats',
value: 'Dingbats'
}, {
label: 'fixed',
value: 'fixed'
}, {
label: 'FreeMono',
value: 'FreeMono'
}, {
label: 'FreeMono Bold',
value: 'FreeMono-Bold'
}, {
label: 'FreeSans',
value: 'FreeSans-Bold'
}, {
label: 'Halvetica',
value: 'Halvetica'
}, {
label: 'Georgia',
value: 'Georgia'
}, {
label: 'Impact',
value: 'Impact'
}, {
label: 'Noto mono',
value: 'Noto-Mono'
}];
var SHAPES_VARIANTS = {
RECT: 'rect',
SQUARE: 'square',
CIRCLE: 'circle',
IMAGE: 'image',
TEXT: 'text'
};
var DEFAULT_IMG_URL = 'https://image.flaticon.com/icons/svg/916/916762.svg';
var UPLOADER = {
hideCloudimageSwitcher: true,
processWithCloudimage: false,
uploadWithCloudimageLink: false,
elementId: null,
isLowQualityPreview: true,
reduceBeforeEdit: {
mode: 'manual',
widthLimit: 2000,
heightLimit: 2000
},
cropBeforeEdit: null,
cropPresets: config_cropPresets,
resizePresets: config_resizePresets
};
var ON_CLOSE_STATUSES = {
CLOSE_BTN_CLICKED: 'close-button-clicked',
TOOLBAR_CANCEL_BTN_CLICKED: 'toolbar-cancel-button-clicked',
ESC_KEY_PRESSED: 'esc-key-pressed',
MODAL_OVERLAY_CLICKED: 'modal-overlay-clicked',
IMAGE_EDITS_COMPLETED: 'image-edits-completed',
IMAGE_DOWNLOADED: 'image-downloaded',
IMAGE_UPLOADED_FILEROBOT: 'image-uploaded-filerobot',
IMAGE_UPLOADED_CLOUDIMAGE: 'image-uploaded-cloudimage',
IMAGE_UPLOADING_FAIL_FILEROBOT: 'image-uploading-fail-filerobot'
};
// CONCATENATED MODULE: ./src/utils/full-screen-handle.js
var full_screen_handle_toggleModalFullscreen = function toggleModalFullscreen(configElementId) {
var exit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
// It should be .getElementById but it is not as user might have multiple blocks with same ID (which is not right)
// but we do that for making sure right implementation most of the time
// so that we would have the last added block with that ID to be fullscreened as most probably it would be the plugin.
var foundElements = document.querySelectorAll("#".concat(configElementId || MODAL_ID));
var element = foundElements[foundElements.length - 1];
if (!element) {
return;
}
document.fullscreenElement = document.fullscreenElement || document.mozFullscreenElement || document.msFullscreenElement || document.webkitFullscreenDocument;
document.exitFullscreen = document.exitFullscreen || document.mozExitFullscreen || document.msExitFullscreen || document.webkitExitFullscreen;
element.requestFullscreen = element.requestFullscreen || element.mozRequestFullscreen || element.msRequestFullscreen || element.webkitRequestFullscreen;
if (!document.fullscreenElement && !exit) {
element.requestFullscreen().catch(function (err) {
alert("Error attempting to enable full-screen mode: ".concat(err.message, " (").concat(err.name, ")"));
});
} else if (document.exitFullscreen && document.fullscreenElement) {
document.exitFullscreen();
}
};
// CONCATENATED MODULE: ./src/components/Footer/Footer.js
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function Footer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function Footer_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { Footer_ownKeys(Object(source), true).forEach(function (key) { Footer_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { Footer_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function Footer_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Footer_default = /*#__PURE__*/function (_Component) {
_inherits(_default, _Component);
var _super = _createSuper(_default);
function _default() {
var _this;
_classCallCheck(this, _default);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
Footer_defineProperty(_assertThisInitialized(_this), "onApplyWatermarkChange", function () {
_this.props.updateState({
watermark: Footer_objectSpread(Footer_objectSpread({}, _this.props.watermark), {}, {
applyByDefault: !_this.props.watermark.applyByDefault
})
});
});
return _this;
}
_createClass(_default, [{
key: "render",
value: function render() {
var _this$props = this.props,
initialZoom = _this$props.initialZoom,
operations = _this$props.operations,
operationsZoomed = _this$props.operationsZoomed,
_this$props$currentOp = _this$props.currentOperation,
currentOperation = _this$props$currentOp === void 0 ? null : _this$props$currentOp,
redoOperation = _this$props.redoOperation,
resetOperations = _this$props.resetOperations,
activeBody = _this$props.activeBody,
t = _this$props.t,
logoImage = _this$props.logoImage,
watermark = _this$props.watermark,
config = _this$props.config;
var elementId = config.elementId;
var operationList = initialZoom === 1 ? operations : operationsZoomed;
var currentOperationIndex = operationList.findIndex(function (operation) {
return operation === currentOperation;
});
var isCurrentOperationLast = currentOperation && operationList[operationList.length - 1] === currentOperation;
var isPrevForbidden = operationList.length < 1 || currentOperationIndex === -1;
var isNextForbidden = (operationList.length < 2 || operationList.length > 1 && isCurrentOperationLast) && (currentOperationIndex !== -1 || operationList.length !== 1);
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(Footer, {
children: [false && /*#__PURE__*/Object(jsx_runtime["jsx"])(ResetBtn, {/* Mod false && ??? */
muted: activeBody !== 'preview',
onClick: function onClick() {
activeBody === 'preview' && resetOperations();
},
title: t['footer.reset']
}), false && /*#__PURE__*/Object(jsx_runtime["jsx"])(PreviousBtn, {/* Mod false && ??? */
onClick: function onClick() {
!isPrevForbidden && redoOperation({
operationIndex: currentOperationIndex - 1,
operationObject: Footer_objectSpread(Footer_objectSpread({}, operationList[currentOperationIndex]), {}, {
index: currentOperationIndex
})
});
},
muted: isPrevForbidden,
title: t['footer.undo']
}), false && /*#__PURE__*/Object(jsx_runtime["jsx"])(NextBtn, {/* Mod false && ??? */
onClick: function onClick() {
!isNextForbidden && redoOperation({
operationIndex: currentOperationIndex + 1,
operationObject: Footer_objectSpread(Footer_objectSpread({}, operationList[currentOperationIndex]), {}, {
index: currentOperationIndex
})
});
},
muted: isNextForbidden,
title: t['footer.redo']
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FullscreenBtn, {
onClick: function onClick() {
return full_screen_handle_toggleModalFullscreen(elementId);
},
title: t["header.toggle_fullscreen"]
}), logoImage && watermark && /*#__PURE__*/Object(jsx_runtime["jsx"])(Footer_ui_Switcher, {
id: "switch-watermark-footer",
checked: watermark && watermark.applyByDefault,
handleChange: this.onApplyWatermarkChange,
text: t['common.apply_watermark']
})]
});
}
}]);
return _default;
}(react["Component"]);
// CONCATENATED MODULE: ./src/utils/adjust-api.js
/* API change from file.url_permalink to file.url.permalink
* */
var getPermalink = function getPermalink(file) {
if (file.url && file.url.permalink) return file.url.permalink;else if (file.url_permalink) return file.url_permalink;else return '';
};
var getPubliclink = function getPubliclink(file) {
if (file.url && file.url.public) return file.url.public;else if (file.url_public) return file.url_public;else return '';
};
// CONCATENATED MODULE: ./src/utils/b64-to-blob.js
/**
* Convert a base64 string in a Blob according to the data and contentType.
*
* @param b64Data {String} Pure base64 string without contentType
* @param contentType {String} the content type of the file i.e (image/jpeg - image/png - text/plain)
* @param sliceSize {Int} SliceSize to process the byteCharacters
* @see http://stackoverflow.com/questions/16245767/creating-a-blob-from-a-base64-string-in-javascript
* @return Blob
*/
var b64toBlob = function b64toBlob(b64Data, contentType, sliceSize) {
contentType = contentType || '';
sliceSize = sliceSize || 512;
var byteCharacters = atob(b64Data);
var byteArrays = [];
for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) {
var slice = byteCharacters.slice(offset, offset + sliceSize);
var byteNumbers = new Array(slice.length);
for (var i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
byteArrays.push(byteArray);
}
return new Blob(byteArrays, {
type: contentType
});
};
// CONCATENATED MODULE: ./src/utils/deep-copy.js
var deepCopy = function deepCopy(object) {
return JSON.parse(JSON.stringify(object));
};
// CONCATENATED MODULE: ./src/utils/get-base-api.js
var get_base_api_getBaseAPI = function getBaseAPI(baseAPI, container, platform) {
return baseAPI ? baseAPI + '/' : getBaseUrl(container, platform);
};
// CONCATENATED MODULE: ./src/utils/get-base-url.js
var getBaseUrl = function getBaseUrl(container) {
var platform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'filerobot';
return platform === 'filerobot' ? "https://api.filerobot.com/".concat(container, "/v3/") : "https://".concat(container, ".api.airstore.io/v1/");
};
// CONCATENATED MODULE: ./src/utils/get-canvas-node.js
var get_canvas_node_getCanvasNode = function getCanvasNode(editorWrapperId, id) {
var originalCanvas = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
return window.document.querySelector("#".concat(editorWrapperId, "_").concat(id || (originalCanvas ? ORIGINAL_CANVAS_ID : CANVAS_ID)));
};
// CONCATENATED MODULE: ./src/utils/get-effect-handler-name.js
var getEffectHandlerName = function getEffectHandlerName(name) {
switch (name) {
//filters
case 'colorize':
return 'colorize';
case 'contrast':
return 'contrast';
case 'cross_process':
return 'crossProcess';
case 'glow_sun':
return 'glowingSun';
case 'hdr_effect':
return 'hdr';
case 'jarques':
return 'jarques';
case 'love':
return 'love';
case 'old_boot':
return 'oldBoot';
case 'orange_peel':
return 'orangePeel';
case 'pin_hole':
return 'pinhole';
case 'pleasant':
return 'pleasant';
case 'sepia':
return 'sepia';
case 'sun_rise':
return 'sunrise';
case 'vintage':
return 'vintage';
//effets
case 'clarity':
return '';
case 'edge_enhance':
return 'edgeEnhance';
case 'emboss':
return 'emboss';
case 'grungy':
return 'grungy';
case 'hazy':
return 'hazyDays';
case 'lomo':
return 'lomo';
case 'noise':
return 'noise';
case 'old_paper':
return 'oldPaper';
//?
case 'posterize':
return 'posterize';
case 'radial_blur':
return 'radialBlur';
case 'sin_city':
return 'sinCity';
case 'tilt_shift':
return 'tiltShift';
default:
return null;
}
};
// CONCATENATED MODULE: ./src/utils/get-icon.js
var getIcon = function getIcon(name) {
switch (name) {
//filters
case 'colorize':
return urlImageEditor+'images/filters/colorize.jpg';
case 'contrast':
return urlImageEditor+'images/filters/contrast.png';
case 'cross_process':
return urlImageEditor+'images/filters/cross_process.png';
case 'glow_sun':
return urlImageEditor+'images/filters/glow_sun.png';
case 'hdr_effect':
return urlImageEditor+'images/filters/hdr_effect.png';
case 'jarques':
return urlImageEditor+'images/filters/jarques.png';
case 'love':
return urlImageEditor+'images/filters/love.png';
case 'old_boot':
return urlImageEditor+'images/filters/old_boot.png';
case 'orange_peel':
return urlImageEditor+'images/filters/orange_peel.png';
case 'pin_hole':
return urlImageEditor+'images/filters/pin_hole.png';
case 'pleasant':
return urlImageEditor+'images/filters/pleasant.png';
case 'sepia':
return urlImageEditor+'images/filters/sepia.png';
case 'sun_rise':
return urlImageEditor+'images/filters/sun_rise.png';
case 'vintage':
return urlImageEditor+'images/filters/vintage.png';
case 'clarity':
return urlImageEditor+'images/effects/clarity.png';
case 'edge_enhance':
return urlImageEditor+'images/effects/edge_enhance.png';
case 'emboss':
return urlImageEditor+'images/effects/emboss.png';
case 'grungy':
return urlImageEditor+'images/effects/grungy.png';
case 'hazy':
return urlImageEditor+'images/effects/hazy.png';
case 'lomo':
return urlImageEditor+'images/effects/lomo.png';
case 'noise':
return urlImageEditor+'images/effects/noise.png';
case 'old_paper':
return urlImageEditor+'images/effects/old_paper.png';
case 'posterize':
return urlImageEditor+'images/effects/posterize.png';
case 'radial_blur':
return urlImageEditor+'images/effects/radial_blur.png';
case 'sin_city':
return urlImageEditor+'images/effects/sin_city.png';
case 'tilt_shift':
return urlImageEditor+'images/effects/tilt_shift.png';
default:
return '';
}
};
// CONCATENATED MODULE: ./src/utils/get-label.js
var get_label_getLabel = function getLabel() {
var label = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return label.replace(/_/g, ' ');
};
// CONCATENATED MODULE: ./src/utils/get-secret-header-name.js
var getSecretHeaderName = function getSecretHeaderName() {
var platform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'filerobot';
return platform === 'filerobot' ? "X-Filerobot-Key" : "X-Airstore-Secret-Key";
};
// CONCATENATED MODULE: ./src/utils/get-watermark-position.js
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
var getWatermarkSquaredPosition = function getWatermarkSquaredPosition() {
var position = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'center';
var canvas = arguments.length > 1 ? arguments[1] : undefined;
var width = arguments.length > 2 ? arguments[2] : undefined;
var height = arguments.length > 3 ? arguments[3] : undefined;
var canvasRect = canvas.getBoundingClientRect();
var scaleRatio = 30 / 100; // 30%
var scaledHeight = canvasRect.height * scaleRatio;
var scaledWidth = canvasRect.width * scaleRatio;
if (scaledWidth < width || scaledHeight < height) {
var aspectRatio = width / height;
if (height > width) {
height = scaledHeight;
width = height * aspectRatio;
} else {
width = scaledWidth;
height = width / aspectRatio;
}
}
var centerPositionX = canvasRect.width / 2 - width / 2;
var centerPositionY = canvasRect.height / 2 - height / 2;
if (position === 'center') {
return [centerPositionX, centerPositionY, width, height];
}
position = position.split('-');
var paddingSpace = 1.5 / 100; // 1.5%
var widthSpace = canvasRect.width * paddingSpace;
var heightSpace = canvasRect.height * paddingSpace;
var rightPosition = canvasRect.width - width - widthSpace;
var bottomPosition = canvasRect.height - height - heightSpace;
return [].concat(_toConsumableArray(position.map(function (p, i) {
if (p === 'center') {
return i === 0 ? centerPositionX : centerPositionY;
}
if (p === 'right') {
return rightPosition;
}
if (p === 'bottom') {
return bottomPosition;
}
if (p === 'left') {
return widthSpace;
}
if (p === 'top') {
return heightSpace;
}
})), [width, height]);
};
// EXTERNAL MODULE: ./node_modules/js-sha1/src/sha1.js
var sha1 = __webpack_require__(17);
var sha1_default = /*#__PURE__*/__webpack_require__.n(sha1);
// CONCATENATED MODULE: ./src/utils/get-image-sealing-params.js
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || get_image_sealing_params_unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function get_image_sealing_params_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return get_image_sealing_params_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return get_image_sealing_params_arrayLikeToArray(o, minLen); }
function get_image_sealing_params_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
var getImageSealingParams = function getImageSealingParams(paramsStr, imageSealingConfig, originalUrl) {
var _ref = imageSealingConfig || {},
salt = _ref.salt,
charCount = _ref.char_count,
includeParams = _ref.include_params;
var isIncludeParamsDefined = Array.isArray(includeParams);
if (isIncludeParamsDefined && includeParams.length === 0) {
return paramsStr;
}
var sealingParamsStr = '';
var restParamsStr = '';
if (isIncludeParamsDefined) {
// in config defined include_params with array
var sealingParams = [];
var restParams = [];
paramsStr.split('&').forEach(function (item) {
var _item$split = item.split('='),
_item$split2 = _slicedToArray(_item$split, 1),
paramName = _item$split2[0];
if (includeParams.indexOf(paramName) > -1) {
sealingParams.push(item);
} else {
restParams.push(item);
}
});
if (restParams.length > 0) {
restParamsStr = restParams.join('&');
} // We need to add sealing always, even if sealingParams is empty.
// In case with empty params sealing will be like: ci_seal=10613a92e5
sealingParamsStr = getSealingParams(sealingParams.join('&'), originalUrl, salt, charCount);
} else {
// all params
sealingParamsStr = getSealingParams(paramsStr, originalUrl, salt, charCount);
}
return [sealingParamsStr, restParamsStr].filter(function (p) {
return p;
}).join('&');
};
function encodeBase64(str) {
return btoa(str).replace(/=*$/g, '');
}
function getSha1(str, length) {
return sha1_default()(str).slice(0, length);
}
function getSealingParams(paramsStr, originalUrl, salt, charCount) {
var base64String = encodeBase64(paramsStr);
var calcHash = getSha1(originalUrl + base64String + salt, charCount);
return [calcHash ? "ci_seal=".concat(calcHash) : '', base64String ? "ci_eqs=".concat(base64String) : ''].filter(function (i) {
return i;
}).join('&');
}
// CONCATENATED MODULE: ./src/utils/get-inner-box-size.js
var getInnerBoxSize = function getInnerBoxSize(parentElem, originalImg) {
var parentElemRect = parentElem.getBoundingClientRect();
var _ref = window.getComputedStyle(parentElem) || {},
_ref$paddingLeft = _ref.paddingLeft,
paddingLeft = _ref$paddingLeft === void 0 ? 0 : _ref$paddingLeft,
_ref$paddingRight = _ref.paddingRight,
paddingRight = _ref$paddingRight === void 0 ? 0 : _ref$paddingRight,
_ref$paddingTop = _ref.paddingTop,
paddingTop = _ref$paddingTop === void 0 ? 0 : _ref$paddingTop,
_ref$paddingBottom = _ref.paddingBottom,
paddingBottom = _ref$paddingBottom === void 0 ? 0 : _ref$paddingBottom;
var pWidth = parentElemRect.width - (parseInt(paddingLeft, 10) || 0) - (parseInt(paddingRight, 10) || 0);
var pHeight = parentElemRect.height - (parseInt(paddingTop, 10) || 0) - (parseInt(paddingBottom, 10) || 0);
var width = 0;
var height = 0;
if (pWidth >= originalImg.width && pHeight >= originalImg.height) {
width = originalImg.width;
height = originalImg.height;
} else if (pWidth > originalImg.width && pHeight < originalImg.height) {
height = pHeight;
width = pHeight * originalImg.ratio;
} else if (pWidth < originalImg.width && pHeight > originalImg.height) {
width = pWidth;
height = pWidth / originalImg.ratio;
} else {
var w1 = pWidth;
var h1 = pWidth / originalImg.ratio;
var w2 = pHeight * originalImg.ratio;
var h2 = pHeight;
if (originalImg.width <= w1 && originalImg.height <= h1) {
width = w1;
height = h1;
} else {
width = w2;
height = h2;
}
}
return {
width: width,
height: height
};
};
// CONCATENATED MODULE: ./src/utils/round-decimal-point.js
var roundDecimalPoint = function roundDecimalPoint(number) {
var numbersAfterDecimalToHave = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
return parseFloat(number).toFixed(numbersAfterDecimalToHave);
};
// CONCATENATED MODULE: ./src/utils/index.js
// EXTERNAL MODULE: ./node_modules/cropperjs/dist/cropper.js
var cropper = __webpack_require__(18);
var cropper_default = /*#__PURE__*/__webpack_require__.n(cropper);
// EXTERNAL MODULE: ./node_modules/uuid/v4.js
var v4 = __webpack_require__(30);
// CONCATENATED MODULE: ./src/utils/canvas-round.js
CanvasRenderingContext2D.prototype.roundRect = function (x, y, width, height) {
var radius = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : undefined;
if (!radius) {
radius = width >= height ? width / 2 : height / 2;
} else {
if (width < 2 * radius) radius = width / 2;
if (height < 2 * radius) radius = height / 2;
}
this.beginPath();
this.moveTo(x + radius, y);
this.arcTo(x + width, y, x + width, y + height, radius);
this.arcTo(x + width, y + height, x, y + height, radius);
this.arcTo(x, y + height, x, y, radius);
this.arcTo(x, y, x + width, y, radius);
this.closePath();
return this;
};
CanvasRenderingContext2D.prototype.round = function () {
var _this$canvas = this.canvas,
width = _this$canvas.width,
height = _this$canvas.height;
this.imageSmoothingEnabled = true;
this.globalCompositeOperation = 'destination-in';
this.strokeStyle = 'transparent';
this.lineWidth = 1;
this.beginPath(); // roundRect is a manually written protoype method from canvas-round-rect file in utils.
this.roundRect(0, 0, width, height, Math.max(width, height));
this.fill();
this.globalCompositeOperation = 'source-over';
return this;
};
/* harmony default export */ var canvas_round = (CanvasRenderingContext2D);
// CONCATENATED MODULE: ./src/utils/map-number-range.js
/* harmony default export */ var map_number_range = (Number.prototype.mapNumber = function (in_min, in_max, out_min, out_max) {
return (this - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
});
// CONCATENATED MODULE: ./src/components/Preview/ImageManipulator.js
function ImageManipulator_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ImageManipulator_typeof = function _typeof(obj) { return typeof obj; }; } else { ImageManipulator_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ImageManipulator_typeof(obj); }
var ImageManipulator_excluded = ["dir"],
ImageManipulator_excluded2 = ["x", "y", "opacity"];
function ImageManipulator_toConsumableArray(arr) { return ImageManipulator_arrayWithoutHoles(arr) || ImageManipulator_iterableToArray(arr) || ImageManipulator_unsupportedIterableToArray(arr) || ImageManipulator_nonIterableSpread(); }
function ImageManipulator_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function ImageManipulator_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return ImageManipulator_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return ImageManipulator_arrayLikeToArray(o, minLen); }
function ImageManipulator_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function ImageManipulator_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return ImageManipulator_arrayLikeToArray(arr); }
function ImageManipulator_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function ImageManipulator_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function ImageManipulator_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ImageManipulator_ownKeys(Object(source), true).forEach(function (key) { ImageManipulator_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ImageManipulator_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function ImageManipulator_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = ImageManipulator_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function ImageManipulator_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function ImageManipulator_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function ImageManipulator_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function ImageManipulator_createClass(Constructor, protoProps, staticProps) { if (protoProps) ImageManipulator_defineProperties(Constructor.prototype, protoProps); if (staticProps) ImageManipulator_defineProperties(Constructor, staticProps); return Constructor; }
function ImageManipulator_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) ImageManipulator_setPrototypeOf(subClass, superClass); }
function ImageManipulator_setPrototypeOf(o, p) { ImageManipulator_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ImageManipulator_setPrototypeOf(o, p); }
function ImageManipulator_createSuper(Derived) { var hasNativeReflectConstruct = ImageManipulator_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = ImageManipulator_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = ImageManipulator_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return ImageManipulator_possibleConstructorReturn(this, result); }; }
function ImageManipulator_possibleConstructorReturn(self, call) { if (call && (ImageManipulator_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return ImageManipulator_assertThisInitialized(self); }
function ImageManipulator_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function ImageManipulator_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function ImageManipulator_getPrototypeOf(o) { ImageManipulator_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return ImageManipulator_getPrototypeOf(o); }
function ImageManipulator_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var INITIAL_PARAMS = {
effect: null,
filter: null,
crop: null,
resize: null,
rotate: null,
correctionDegree: 0,
flipX: false,
flipY: false,
adjust: {
brightness: 0,
contrast: 0,
saturation: 0,
exposure: 0
},
canvasDimensions: {
width: 300,
height: 200,
ratio: 1.5
}
};
var ImageManipulator_ImageManipulator = /*#__PURE__*/function (_Component) {
ImageManipulator_inherits(ImageManipulator, _Component);
var _super = ImageManipulator_createSuper(ImageManipulator);
function ImageManipulator() {
var _this;
ImageManipulator_classCallCheck(this, ImageManipulator);
_this = _super.call(this);
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "initializeCanvases", function (elem) {
var that = ImageManipulator_assertThisInitialized(_this);
var _this$props = _this.props,
_this$props$config = _this$props.config;
_this$props$config = _this$props$config === void 0 ? {} : _this$props$config;
var isLowQualityPreview = _this$props$config.isLowQualityPreview,
updateState = _this$props.updateState;
var initialZoom = 1;
if (isLowQualityPreview && elem.height > 1050) {
var canvasOriginal = _this.originalCanvas.current;
var ctxOriginal = canvasOriginal.getContext('2d');
canvasOriginal.width = elem.width;
canvasOriginal.height = elem.height;
ctxOriginal.drawImage(elem, 0, 0, elem.width, elem.height);
initialZoom = elem.height / 800;
var zoomedWidth = elem.width / initialZoom;
var zoomedHeight = elem.height / initialZoom;
updateState({
initialZoom: initialZoom,
canvasOriginal: that.cloneCanvas(canvasOriginal)
});
setTimeout(function () {
new window.Caman(_this.editedCanvas.current, function () {
this.resize({
width: zoomedWidth,
height: zoomedHeight
});
this.render(function () {
that.tempCanvasElement = that.editedCanvas.current;
that.setState({
canvasKey: parseInt(that.state.canvasKey) + 1
}, function () {
var canvasZoomed = that.applyTransformationsToNewCanvas();
that.CamanInstanceZoomed = new window.Caman(canvasZoomed, function () {
that.CamanInstanceOriginal = new window.Caman(that.originalCanvas.current, function () {});
updateState({
isShowSpinner: false,
canvasZoomed: that.cloneCanvas(canvasZoomed)
});
});
});
});
});
});
} else {
setTimeout(function () {
that.CamanInstance = new window.Caman(that.editedCanvas.current, function () {
updateState({
isShowSpinner: false,
canvasOriginal: that.cloneCanvas(that.editedCanvas.current)
});
});
});
}
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "mergeCanvases", function (canvas) {
var shapeOperations = _this.props.shapeOperations;
var tempCtx = canvas.getContext('2d');
var finalPreviewCanvas = shapeOperations.prepareFinalCanvas(canvas);
tempCtx.drawImage(finalPreviewCanvas, 0, 0);
return canvas.toDataURL();
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "cloneCanvas", function (oldCanvas) {
//create a new canvas
var newCanvas = document.createElement('canvas');
var context = newCanvas.getContext('2d'); //set dimensions
newCanvas.width = oldCanvas.width;
newCanvas.height = oldCanvas.height; // set old id
newCanvas.id = oldCanvas.id;
newCanvas.className = oldCanvas.className; //apply the old canvas to the new one
context.drawImage(oldCanvas, 0, 0); //return the new canvas
return newCanvas;
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "applyTransformationsToNewCanvas", function () {
var rounded = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
var oldCanvas = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _this.tempCanvasElement;
var nextCanvas = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _this.editedCanvas.current;
// If the old canvas is the same as new don't do anything and return any of them as they're same!
if (oldCanvas === nextCanvas) {
return nextCanvas;
}
var width = oldCanvas.width,
height = oldCanvas.height;
var nextContext = nextCanvas.getContext('2d'); //reset dimensions
nextCanvas.width = width;
nextCanvas.height = height; //apply the old canvas to the new one
nextContext.drawImage(oldCanvas, 0, 0); // Make the new canvas rounded if the crop is rounded style.
// round is a manually written prototype method from canvas-round file in utils.
if (rounded) {
nextContext.round();
} //return the new canvas
return nextCanvas;
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "replaceCanvas", function (oldCanvas) {
var nextCanvas = _this.editedCanvas.current;
var oldContext = nextCanvas.getContext('2d');
oldContext.clearRect(0, 0, nextCanvas.width, nextCanvas.height);
nextCanvas.width = oldCanvas.width;
nextCanvas.height = oldCanvas.height;
oldContext.drawImage(oldCanvas, 0, 0);
return nextCanvas;
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "saveImage", function () {
var isSaveAs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
var _this$props2 = _this.props,
onComplete = _this$props2.onComplete,
onClose = _this$props2.onClose,
updateState = _this$props2.updateState,
closeOnLoad = _this$props2.closeOnLoad,
config = _this$props2.config,
processWithCloudService = _this$props2.processWithCloudService,
uploadCloudimageImage = _this$props2.uploadCloudimageImage,
operations = _this$props2.operations,
initialZoom = _this$props2.initialZoom,
operationsOriginal = _this$props2.operationsOriginal;
var imageMime = _this.getFinalImageMime();
var imageNameFromUrl = _this.getFinalImageName();
var _config$filerobot = config.filerobot,
filerobot = _config$filerobot === void 0 ? {} : _config$filerobot,
_config$platform = config.platform,
platform = _config$platform === void 0 ? 'filerobot' : _config$platform,
elementId = config.elementId,
_config$cloudimage = config.cloudimage,
cloudimage = _config$cloudimage === void 0 ? {} : _config$cloudimage;
var _ref = filerobot.uploadParams || {},
dir = _ref.dir,
uploadParams = ImageManipulator_objectWithoutProperties(_ref, ImageManipulator_excluded);
var canvas = initialZoom !== 1 ? _this.originalCanvas.current : _this.editedCanvas.current;
var baseAPI = get_base_api_getBaseAPI(filerobot.baseAPI, filerobot.container, platform);
var self = ImageManipulator_assertThisInitialized(_this);
if (!processWithCloudService) {
// properties & meta for adding more properties & meta in the same uploading process.
var triggerUpload = function triggerUpload() {
var overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var imageName = uploadParams.imageName,
imageMeta = uploadParams.imageMeta,
imageProperties = uploadParams.imageProperties,
_uploadParams$keepPro = uploadParams.keepPropsAndMeta,
keepPropsAndMeta = _uploadParams$keepPro === void 0 ? false : _uploadParams$keepPro;
_this.mergeCanvases(canvas);
var base64 = canvas.toDataURL(imageMime);
var block = base64.split(";");
var realData = block[1].split(",")[1];
var blob = b64toBlob(realData, imageMime, null);
if (isSaveAs) {
updateState({
isShowSpinner: true
});
}
var name = overrides.imageName || imageName || imageNameFromUrl;
var dirPath = overrides.dir || dir || 'image-editor';
var properties = {};
var meta = {};
var formData = new FormData();
formData.append('file', blob, name);
if (overrides.keepPropsAndMeta || overrides.keepPropsAndMeta !== false && keepPropsAndMeta) {
properties = ImageManipulator_objectSpread({}, imageProperties);
meta = ImageManipulator_objectSpread({}, imageMeta);
}
if (overrides.imageProperties && Object.keys(overrides.imageProperties).length > 0) {
properties = ImageManipulator_objectSpread(ImageManipulator_objectSpread({}, properties), overrides.imageProperties);
}
if (overrides.meta && Object.keys(overrides.meta).length > 0) {
meta = ImageManipulator_objectSpread(ImageManipulator_objectSpread({}, meta), overrides.imageMeta);
}
if (Object.keys(properties).length > 0) {
formData.append('properties[file]', JSON.stringify(properties));
}
if (Object.keys(meta).length > 0) {
formData.append('meta[file]', JSON.stringify(meta));
}
var request = new XMLHttpRequest();
request.addEventListener("load", self.onFileLoad);
request.open("POST", [baseAPI, "upload?dir=".concat(dirPath)].join(''));
request.setRequestHeader(getSecretHeaderName(platform), filerobot.uploadKey);
request.send(formData);
};
if (isSaveAs && filerobot.onSaveAs) {
var exitFullscreenModal = function exitFullscreenModal() {
return full_screen_handle_toggleModalFullscreen(elementId, true);
};
filerobot.onSaveAs(triggerUpload, exitFullscreenModal);
} else {
triggerUpload();
}
} else {
var src = cloudimage.dontCleanQuery ? _this.props.src : _this.props.src.split('?')[0];
var resultOperations = initialZoom !== 1 ? operationsOriginal : operations;
var allowedOperations = resultOperations.filter(function (_ref2) {
var operation = _ref2.operation;
return CLOUDIMAGE_OPERATIONS.includes(operation);
});
var url = _this.generateCloudimageURL(allowedOperations, src.replace(/https?:\/\/scaleflex.ultrafast.io\//, ''));
if (uploadCloudimageImage) {
var request = new XMLHttpRequest();
request.addEventListener("load", _this.onFileLoad);
request.open("POST", [baseAPI, "upload?dir=".concat(dir)].join(''));
request.setRequestHeader(getSecretHeaderName(platform), filerobot.uploadKey);
request.setRequestHeader('Content-Type', 'application/json');
request.send(JSON.stringify({
files_urls: [url]
}));
} else {
updateState({
isShowSpinner: false,
isHideCanvas: false
});
onComplete(url, {
url_permalink: url,
url_public: url,
url: {
public: url,
permalink: url
}
});
closeOnLoad && onClose(ON_CLOSE_STATUSES.IMAGE_UPLOADED_CLOUDIMAGE);
}
}
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "getResultCanvas", function () {
var canvas = _this.props.initialZoom !== 1 ? _this.originalCanvas.current : _this.editedCanvas.current;
_this.mergeCanvases(canvas);
return canvas;
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "getFinalImageMime", function () {
var _this$props3 = _this.props,
roundCrop = _this$props3.roundCrop,
imageMime = _this$props3.imageMime;
return roundCrop ? 'image/png' : imageMime;
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "getFinalImageName", function () {
var roundCrop = _this.props.roundCrop;
var imageName = _this.state.imageName;
if (roundCrop) {
imageName = imageName.replace(imageName.substr(imageName.lastIndexOf('.') + 1), 'png');
}
return imageName;
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "downloadImage", function (callback) {
var canvas = _this.getResultCanvas();
var imageName = _this.getFinalImageName();
var imageMime = _this.getFinalImageMime();
var lnk = document.createElement('a');
var e;
lnk.download = imageName;
lnk.href = canvas.toDataURL(imageMime, 0.8);
if (document.createEvent) {
e = document.createEvent("MouseEvents");
e.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
lnk.dispatchEvent(e);
} else if (lnk.fireEvent) {
lnk.fireEvent("onclick");
}
if (callback) callback();
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "onFileLoad", function (data) {
var _this$props4 = _this.props,
onComplete = _this$props4.onComplete,
onClose = _this$props4.onClose,
onError = _this$props4.onError,
updateState = _this$props4.updateState,
closeOnLoad = _this$props4.closeOnLoad;
var _data$srcElement = data.srcElement,
srcElement = _data$srcElement === void 0 ? {} : _data$srcElement;
var _srcElement$response = srcElement.response,
response = _srcElement$response === void 0 ? '{}' : _srcElement$response;
var responseData = JSON.parse(response) || {};
if (responseData.status === 'success') {
var _responseData$file = responseData.file,
file = _responseData$file === void 0 ? {} : _responseData$file;
var publicURL = getPubliclink(file);
if (!publicURL) return;
updateState({
isShowSpinner: false,
isHideCanvas: false
});
onComplete(publicURL, file);
closeOnLoad && onClose(ON_CLOSE_STATUSES.IMAGE_UPLOADED_FILEROBOT);
} else {
updateState({
isShowSpinner: false,
isHideCanvas: false
});
onError(responseData);
closeOnLoad && onClose(ON_CLOSE_STATUSES.IMAGE_UPLOADING_FAIL_FILEROBOT);
}
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "generateCloudimageURL", function (operations, original) {
var _this$props5 = _this.props,
config = _this$props5.config,
watermark = _this$props5.watermark,
logoImage = _this$props5.logoImage,
processWithCloudimage = _this$props5.processWithCloudimage,
processWithFilerobot = _this$props5.processWithFilerobot,
imageSealing = _this$props5.imageSealing;
var _config$cloudimage2 = config.cloudimage,
cloudimage = _config$cloudimage2 === void 0 ? {} : _config$cloudimage2,
_config$filerobot2 = config.filerobot,
filerobot = _config$filerobot2 === void 0 ? {} : _config$filerobot2;
var cloudUrl = processWithCloudimage && cloudimage.token + '.cloudimg.io/' + (cloudimage.version ? "".concat(cloudimage.version, "/") : 'v7/');
var filerobotURL = processWithFilerobot && filerobot.token + '.filerobot.com/' + (filerobot.version ? "".concat(filerobot.version, "/") : '');
var doNotPrefixURL = filerobotURL ? filerobot.doNotPrefixURL : cloudimage.doNotPrefixURL;
var url = filerobotURL || cloudUrl || '';
url = (url ? 'https://' : '') + url;
var baseURL = doNotPrefixURL ? '' : url;
var cropOperation = _this.isOperationExist(operations, 'crop');
var resizeOperation = _this.isOperationExist(operations, 'resize');
var orientationOperation = _this.isOperationExist(operations, 'rotate');
var focusPointOperation = _this.isOperationExist(operations, 'focus_point');
var watermarkOperation = watermark && (logoImage || watermark.text) && watermark.applyByDefault;
var cropQuery = '';
var resizeQuery = '';
var orientationQuery = '';
var watermarkQuery = '';
var focusPointQuery = '';
if (cropOperation) {
cropQuery = _this.getCropArguments(cropOperation.props);
}
if (resizeOperation) {
resizeQuery = (cropQuery ? '&' : '') + _this.getResizeArguments(resizeOperation.props);
}
if (orientationOperation) {
orientationQuery = (cropQuery || resizeQuery ? '&' : '') + _this.getOrientationArguments(orientationOperation.props);
}
if (watermarkOperation) {
watermarkQuery = (cropQuery || resizeQuery || orientationQuery ? '&' : '') + _this.getWatermarkArguments();
}
if (focusPointOperation) {
focusPointQuery = (cropQuery || resizeQuery || orientationQuery || watermarkQuery ? '&' : '') + _this.getFocusPointArguments(focusPointOperation.props);
}
if (!cloudimage.dontCleanQuery) {
original = original.split('?')[0]; // remove quesry string from original url
}
original = original.replace(baseURL, ''); // remove duplication in case when original url already include cdn prefix
var paramsStr = cropQuery + resizeQuery + orientationQuery + watermarkQuery + focusPointQuery;
if (imageSealing.enabled) {
paramsStr = getImageSealingParams(paramsStr, imageSealing, original.replace(url, '') // always remove cdn url, to support already cdnized links and doNotPrefixURL param
);
}
var originalImgCdnized = baseURL + original;
var queryPrefixOperator = originalImgCdnized.indexOf('?') === -1 ? '?' : '&';
return "".concat(originalImgCdnized).concat(paramsStr ? "".concat(queryPrefixOperator).concat(paramsStr.replace(/&$/, '')) : '');
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "initFiltersOrEffects", function () {});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "applyFilterOrEffect", function (type) {
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
var _this$props6 = _this.props,
updateState = _this$props6.updateState,
initialZoom = _this$props6.initialZoom;
if (!_this.props[type]) return;
updateState({
isHideCanvas: true,
isShowSpinner: true
}, function () {
if (initialZoom !== 1) {
_this.CamanInstanceOriginal.revert(false);
_this.CamanInstanceOriginal[getEffectHandlerName(_this.props[type])]();
_this.CamanInstanceOriginal.render(function () {
updateState(ImageManipulator_defineProperty({}, type, null), function () {
_this.makeCanvasSnapshot({
operation: type
}, callback);
});
});
} else {
updateState(ImageManipulator_defineProperty({}, type, null), function () {
_this.makeCanvasSnapshot({
operation: type
}, callback);
});
}
});
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "applyAdjust", function () {
var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
var _this$props7 = _this.props,
updateState = _this$props7.updateState,
initialZoom = _this$props7.initialZoom,
adjust = _this$props7.adjust;
var brightness = adjust.brightness,
contrast = adjust.contrast,
saturation = adjust.saturation,
exposure = adjust.exposure;
var resetProps = {
brightness: 0,
contrast: 0,
saturation: 0,
exposure: 0
};
updateState({
isHideCanvas: true,
isShowSpinner: true
}, function () {
if (initialZoom !== 1) {
_this.CamanInstanceOriginal.revert(false);
if (brightness.toString() !== '0') _this.CamanInstanceOriginal.brightness(parseInt(brightness || '0'));
if (contrast.toString() !== '0') _this.CamanInstanceOriginal.contrast(parseInt(contrast || '0'));
if (saturation.toString() !== '0') _this.CamanInstanceOriginal.saturation(parseInt(saturation || '0'));
if (exposure.toString() !== '0') _this.CamanInstanceOriginal.exposure(parseInt(exposure || '0'));
_this.CamanInstanceOriginal.render(function () {
updateState({
adjust: ImageManipulator_objectSpread({}, resetProps)
}, function () {
_this.makeCanvasSnapshot({
operation: 'adjust'
}, callback);
});
});
} else {
updateState({
adjust: ImageManipulator_objectSpread({}, resetProps)
}, function () {
_this.makeCanvasSnapshot({
operation: 'adjust'
}, callback);
});
}
});
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "initOrientation", function () {
var _this$props8 = _this.props,
config = _this$props8.config,
redoOperation = _this$props8.redoOperation,
operations = _this$props8.operations,
operationsZoomed = _this$props8.operationsZoomed,
initialZoom = _this$props8.initialZoom;
var processWithCloudService = config.processWithCloudService;
var currentOperations = initialZoom !== 1 ? operationsZoomed : operations;
if (processWithCloudService && currentOperations.length >= 1) {
var prevCropIndex = currentOperations.findIndex(function (_ref3) {
var operation = _ref3.operation;
return operation === 'rotate';
});
if (prevCropIndex > -1) {
redoOperation({
operationIndex: prevCropIndex - 1,
callback: function callback() {},
resetActiveTab: false
});
}
}
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "onRotate", function () {
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var correctionDegree = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var flipX = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var flipY = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var _this$props9 = _this.props,
initialZoom = _this$props9.initialZoom,
rotate = _this$props9.rotate,
updateState = _this$props9.updateState;
var nextRotateValue = rotate + value;
updateState({
isHideCanvas: true,
isShowSpinner: true,
rotate: nextRotateValue,
correctionDegree: correctionDegree,
flipX: flipX,
flipY: flipY
}, function () {
var oldCanvas = _this.editedCanvas.current;
if (initialZoom !== 1) {
_this.CamanInstanceZoomed.reset();
if (flipX) _this.CamanInstanceZoomed.flip('x');
if (flipY) _this.CamanInstanceZoomed.flip('y');
if (nextRotateValue || correctionDegree) _this.CamanInstanceZoomed.rotate((nextRotateValue || 0) + (correctionDegree || 0));
_this.CamanInstanceZoomed.render(function () {
_this.editedCanvas.current.className = oldCanvas.className;
updateState({
isHideCanvas: false,
isShowSpinner: false
});
});
} else {
_this.CamanInstance.reset();
if (flipX) _this.CamanInstance.flip('x');
if (flipY) _this.CamanInstance.flip('y');
if (nextRotateValue || correctionDegree) _this.CamanInstance.rotate((nextRotateValue || 0) + (correctionDegree || 0));
_this.CamanInstance.render(function () {
_this.editedCanvas.current.className = oldCanvas.className;
updateState({
isHideCanvas: false,
isShowSpinner: false
});
});
}
});
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "applyOrientation", function () {
var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
var _this$props10 = _this.props,
updateState = _this$props10.updateState,
initialZoom = _this$props10.initialZoom,
rotate = _this$props10.rotate,
correctionDegree = _this$props10.correctionDegree,
flipX = _this$props10.flipX,
flipY = _this$props10.flipY;
updateState({
isHideCanvas: true,
isShowSpinner: true
}, function () {
var oldCanvas = _this.originalCanvas.current;
var nextRotate = (rotate || 0) + (correctionDegree || 0);
if (initialZoom !== 1) {
_this.CamanInstanceOriginal.reset();
if (flipX) _this.CamanInstanceOriginal.flip('x');
if (flipY) _this.CamanInstanceOriginal.flip('y');
if (rotate || correctionDegree) _this.CamanInstanceOriginal.rotate(nextRotate);
_this.CamanInstanceOriginal.render(function () {
_this.originalCanvas.current.className = oldCanvas.className;
updateState({
rotate: 0,
flipX: false,
flipY: false,
correctionDegree: 0
}, function () {
_this.makeCanvasSnapshot({
operation: 'rotate',
props: {
rotate: nextRotate
}
}, callback);
});
});
} else {
_this.originalCanvas.current.className = oldCanvas.className;
updateState({
rotate: 0,
flipX: false,
flipY: false,
correctionDegree: 0
}, function () {
_this.makeCanvasSnapshot({
operation: 'rotate',
props: {
rotate: nextRotate
}
}, callback);
});
}
});
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "getOrientationArguments", function () {
var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
rotate = _ref4.rotate;
switch (rotate) {
case 90:
return "r=270";
case -90:
return "r=90";
default:
return "r=".concat(rotate);
}
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "initCrop", function () {
var _this$props11 = _this.props,
config = _this$props11.config,
redoOperation = _this$props11.redoOperation,
operations = _this$props11.operations,
operationsZoomed = _this$props11.operationsZoomed,
initialZoom = _this$props11.initialZoom;
var processWithCloudService = config.processWithCloudService;
var currentOperations = initialZoom !== 1 ? operationsZoomed : operations;
if (processWithCloudService && currentOperations.length >= 1) {
var prevCropIndex = currentOperations.findIndex(function (_ref5) {
var operation = _ref5.operation;
return operation === 'crop';
});
if (prevCropIndex > -1) {
redoOperation({
operationIndex: prevCropIndex - 1,
callback: _this.onInitCrop,
resetActiveTab: false
});
}
} else {
_this.onInitCrop();
}
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "onInitCrop", function () {
var _this$props12 = _this.props,
updateState = _this$props12.updateState,
_this$props12$config = _this$props12.config,
_this$props12$config$ = _this$props12$config.beginCropArea,
beginCropArea = _this$props12$config$ === void 0 ? 1 : _this$props12$config$,
minCropAreaWidth = _this$props12$config.minCropAreaWidth,
minCropAreaHeight = _this$props12$config.minCropAreaHeight;
updateState({
isHideCanvas: true,
isShowSpinner: true
}, function () {
var canvas = _this.editedCanvas.current;
var rect = canvas.getBoundingClientRect();
var zoom = canvas.width / rect.width;
_this.cropper = new cropper_default.a(canvas, {
viewMode: 1,
modal: false,
background: false,
rotatable: false,
scalable: false,
zoomable: false,
movable: false,
autoCropArea: beginCropArea,
minCropBoxWidth: minCropAreaWidth,
minCropBoxHeight: minCropAreaHeight,
crop: function crop(event) {
_this.props.updateState({
cropDetails: event.detail
});
}
});
window.scaleflexPlugins = window.scaleflexPlugins || {};
window.scaleflexPlugins.zoom = zoom;
window.scaleflexPlugins.cropperjs = _this.cropper;
updateState({
isHideCanvas: false,
isShowSpinner: false
});
});
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "applyCrop", function () {
var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
var _this$props13 = _this.props,
initialZoom = _this$props13.initialZoom,
updateState = _this$props13.updateState,
cropDetails = _this$props13.cropDetails,
roundCrop = _this$props13.roundCrop; // Rounding for matching the same rounded value at the crop inputs.
Object.keys(cropDetails).forEach(function (key) {
cropDetails[key] = Math.round(cropDetails[key]);
});
var width = cropDetails.width,
height = cropDetails.height,
x = cropDetails.x,
y = cropDetails.y;
updateState({
isShowSpinner: true
}, function () {
var resultSize;
_this.destroyCrop();
if (initialZoom !== 1) {
var _this$CamanInstanceOr;
resultSize = [width, height, x, y].map(function (prop) {
return prop * initialZoom;
});
_this.CamanInstanceZoomed.crop(width, height, x, y);
(_this$CamanInstanceOr = _this.CamanInstanceOriginal).crop.apply(_this$CamanInstanceOr, ImageManipulator_toConsumableArray(resultSize));
} else {
var _this$CamanInstance;
resultSize = [width, height, x, y];
(_this$CamanInstance = _this.CamanInstance).crop.apply(_this$CamanInstance, ImageManipulator_toConsumableArray(resultSize));
}
_this.makeCanvasSnapshot({
operation: 'crop',
props: {
width: resultSize[0],
height: resultSize[1],
x: resultSize[2],
y: resultSize[3],
roundCrop: roundCrop
}
}, callback);
});
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "makeCanvasSnapshot", function (operation) {
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
var previewCanvas = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var _this$props14 = _this.props,
updateState = _this$props14.updateState,
initialZoom = _this$props14.initialZoom,
operationsZoomed = _this$props14.operationsZoomed,
currentOperation = _this$props14.currentOperation,
operationsOriginal = _this$props14.operationsOriginal,
operations = _this$props14.operations,
roundCrop = _this$props14.roundCrop;
var isZoomed = initialZoom !== 1;
if (previewCanvas) {
var lastOperationIndex = (isZoomed ? operationsZoomed : operations).indexOf(currentOperation) + 1;
var zoomedCanvas = _this.cloneCanvas(_this.editedCanvas.current);
var nextOperation = ImageManipulator_objectSpread(ImageManipulator_objectSpread({}, operation), {}, {
previewCanvas: true,
canvas: zoomedCanvas
});
var stateObj = {
isHideCanvas: false,
isShowSpinner: false,
currentOperation: nextOperation
};
if (isZoomed) {
stateObj.operationsZoomed = [].concat(ImageManipulator_toConsumableArray(operationsZoomed.slice(0, lastOperationIndex)), [nextOperation]);
stateObj.operationsOriginal = [].concat(ImageManipulator_toConsumableArray(operationsOriginal.slice(0, lastOperationIndex)), [ImageManipulator_objectSpread(ImageManipulator_objectSpread({}, nextOperation), {}, {
canvas: _this.cloneCanvas(_this.originalCanvas.current)
})]);
stateObj.isHideCanvasOriginal = false;
stateObj.isShowSpinnerOriginal = false;
} else {
stateObj.operations = [].concat(ImageManipulator_toConsumableArray(operations.slice(0, lastOperationIndex)), [nextOperation]);
}
updateState(stateObj, callback);
return;
}
if (isZoomed) {
var _lastOperationIndex = operationsZoomed.indexOf(currentOperation) + 1;
_this.CamanInstanceOriginal.render(function () {
_this.tempCanvasOriginalElement = _this.originalCanvas.current;
_this.setState({
canvasKey: parseInt(_this.state.canvasOriginalKey) + 1
}, function () {
var canvasOriginal = _this.applyTransformationsToNewCanvas(roundCrop, _this.tempCanvasOriginalElement, _this.originalCanvas.current);
var nextOperation = ImageManipulator_objectSpread(ImageManipulator_objectSpread({}, operation), {}, {
canvas: _this.cloneCanvas(_this.originalCanvas.current)
});
_this.CamanInstanceOriginal = new window.Caman(canvasOriginal, function () {
updateState({
isHideCanvasOriginal: false,
isShowSpinnerOriginal: false,
operationsOriginal: [].concat(ImageManipulator_toConsumableArray(operationsOriginal.slice(0, _lastOperationIndex)), [nextOperation])
}, callback);
});
});
});
_this.CamanInstanceZoomed.render(function () {
_this.tempCanvasElement = _this.editedCanvas.current;
_this.setState({
canvasKey: parseInt(_this.state.canvasKey) + 1
}, function () {
var canvasZoomed = _this.applyTransformationsToNewCanvas(roundCrop);
var nextOperation = ImageManipulator_objectSpread(ImageManipulator_objectSpread({}, operation), {}, {
canvas: _this.cloneCanvas(_this.editedCanvas.current)
});
_this.CamanInstanceZoomed = new window.Caman(canvasZoomed, function () {
updateState({
isHideCanvas: false,
isShowSpinner: false,
operationsZoomed: [].concat(ImageManipulator_toConsumableArray(operationsZoomed.slice(0, _lastOperationIndex)), [nextOperation]),
currentOperation: nextOperation
});
});
});
});
} else {
var _lastOperationIndex2 = operations.indexOf(currentOperation) + 1;
_this.CamanInstance.render(function () {
_this.tempCanvasElement = _this.editedCanvas.current;
_this.setState({
canvasKey: parseInt(_this.state.canvasKey) + 1
}, function () {
var canvas = _this.applyTransformationsToNewCanvas(roundCrop);
var nextOperation = ImageManipulator_objectSpread(ImageManipulator_objectSpread({}, operation), {}, {
canvas: _this.cloneCanvas(_this.editedCanvas.current)
});
_this.CamanInstance = new window.Caman(canvas, function () {
updateState({
isHideCanvas: false,
isShowSpinner: false,
operations: [].concat(ImageManipulator_toConsumableArray(operations.slice(0, _lastOperationIndex2)), [nextOperation]),
currentOperation: nextOperation
}, callback);
});
});
});
}
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "destroyCrop", function () {
_this.cropper.destroy();
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "getCropArguments", function () {
var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
width = _ref6.width,
height = _ref6.height,
x = _ref6.x,
y = _ref6.y,
roundCrop = _ref6.roundCrop;
return "tl_px=".concat(Math.round(x), ",").concat(Math.round(y), "&br_px=").concat(Math.round(x + width), ",").concat(Math.round(y + height)).concat(roundCrop ? "&radius=".concat(Math.round(Math.max(width, height)), "&force_format=png") : '');
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "initResize", function () {
var _this$props15 = _this.props,
initialZoom = _this$props15.initialZoom,
updateState = _this$props15.updateState;
var canvas = initialZoom !== 1 ? _this.originalCanvas.current : _this.editedCanvas.current;
var nextCanvasDimensions = {
width: canvas.width,
height: canvas.height,
ratio: canvas.width / canvas.height
};
updateState({
canvasDimensions: nextCanvasDimensions
});
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "applyResize", function () {
var _this$props16 = _this.props,
initialZoom = _this$props16.initialZoom,
canvasDimensions = _this$props16.canvasDimensions,
updateState = _this$props16.updateState,
handleSave = _this$props16.handleSave,
operations = _this$props16.operations,
operationsOriginal = _this$props16.operationsOriginal;
updateState({
isHideCanvas: true,
isShowSpinner: true,
operationsOriginal: [].concat(ImageManipulator_toConsumableArray(operationsOriginal), [{
operation: 'resize',
props: canvasDimensions
}]),
operations: [].concat(ImageManipulator_toConsumableArray(operations), [{
operation: 'resize',
props: canvasDimensions
}])
}, function () {
if (initialZoom !== 1) {
_this.CamanInstanceOriginal.resize(canvasDimensions);
_this.CamanInstanceOriginal.render(function () {
handleSave();
});
} else {
_this.CamanInstance.resize(canvasDimensions);
_this.CamanInstance.render(function () {
handleSave();
});
}
});
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "getResizeArguments", function () {
var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
width = _ref7.width,
height = _ref7.height;
return "w=".concat(width, "&h=").concat(height);
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "initAdjust", function () {});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "onAdjust", function (handler, value) {
var _objectSpread2;
var _this$props17 = _this.props,
updateState = _this$props17.updateState,
adjust = _this$props17.adjust;
updateState({
adjust: ImageManipulator_objectSpread(ImageManipulator_objectSpread({}, adjust), {}, (_objectSpread2 = {}, ImageManipulator_defineProperty(_objectSpread2, handler, value), ImageManipulator_defineProperty(_objectSpread2, "isHideCanvas", true), ImageManipulator_defineProperty(_objectSpread2, "isShowSpinner", true), _objectSpread2))
}, function () {
_this.applyCorrections(function () {
updateState({
isHideCanvas: false,
isShowSpinner: false
});
});
});
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "initFocusPoint", function () {
var _this$props18 = _this.props,
updateState = _this$props18.updateState,
original = _this$props18.original,
focusPoint = _this$props18.focusPoint;
var nextFocusPoint = ImageManipulator_objectSpread({}, focusPoint);
if (nextFocusPoint.x === null) {
nextFocusPoint.x = original.width / 2;
}
if (nextFocusPoint.y === null) {
nextFocusPoint.y = original.height / 2;
}
_this.tempFocusPoint = ImageManipulator_objectSpread({}, focusPoint);
updateState({
focusPoint: nextFocusPoint,
isHideCanvas: true,
isShowSpinner: true
});
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "applyFocusPoint", function () {
var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
var _this$props19 = _this.props,
updateState = _this$props19.updateState,
operations = _this$props19.operations,
operationsOriginal = _this$props19.operationsOriginal,
focusPoint = _this$props19.focusPoint;
_this.tempFocusPoint = focusPoint;
updateState({
operationsOriginal: [].concat(ImageManipulator_toConsumableArray(operationsOriginal), [{
operation: 'focus_point',
props: focusPoint
}]),
operations: [].concat(ImageManipulator_toConsumableArray(operations), [{
operation: 'focus_point',
props: focusPoint
}])
});
callback();
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "applyShapes", function () {
var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
var shapeOperations = _this.props.shapeOperations;
shapeOperations.updateShapes({
applied: true
}, {
selectedShape: {}
}, function () {
_this.makeCanvasSnapshot({
operation: 'shape',
props: {
shapes: _this.props.shapes
}
}, callback, true);
});
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "getFocusPointArguments", function (focusPoint) {
return "gravity=".concat(focusPoint.x, ",").concat(focusPoint.y);
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "destroyFocusPoint", function () {
_this.props.updateState({
focusPoint: _this.tempFocusPoint,
isHideCanvas: false,
isShowSpinner: false
});
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "pushOperation", function (operations, operation, currentOperation) {
var operationIndex = operations.findIndex(function (operation) {
return operation === currentOperation;
});
var operationsLength = operations.length;
if (operationsLength && operationIndex !== operations[operationsLength]) operations.splice(operationIndex + 1, operationsLength);
operations.push(operation);
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "applyOperations", function (operationIndex, callback) {
var operationObject = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var _this$props20 = _this.props,
initialZoom = _this$props20.initialZoom,
operations = _this$props20.operations,
operationsZoomed = _this$props20.operationsZoomed,
operationsOriginal = _this$props20.operationsOriginal,
canvasZoomed = _this$props20.canvasZoomed,
canvasOriginal = _this$props20.canvasOriginal,
updateState = _this$props20.updateState;
var isZoomed = initialZoom !== 1;
var operation = isZoomed ? operationsZoomed[operationIndex] : operations[operationIndex];
var hasMoreOperations = operationIndex !== -1; // If the operation is previewCanvas one and have the shapes then apply undo or redo
if (operationObject && operationObject.previewCanvas && operationObject.index - 1 === operationIndex || operation && operation.previewCanvas && operationObject.index + 1 === operationIndex) {
var _operation$props;
var shapeOperations = _this.props.shapeOperations; // If the current operation is shape operation replace with its shapes
// if not and still there other shape operation in the array replace with last one's shapes
// else replace with empty array for shapes.
var shapesReplacedWith = operation === null || operation === void 0 ? void 0 : (_operation$props = operation.props) === null || _operation$props === void 0 ? void 0 : _operation$props.shapes;
if (!shapesReplacedWith) {
var allShapeOperations = (isZoomed ? operationsZoomed : operations).filter(function (op, index) {
return op.operation === 'shape' && index < operationObject.index;
});
shapesReplacedWith = allShapeOperations.length > 0 ? allShapeOperations[allShapeOperations.length - 1].props.shapes : [];
}
shapeOperations.replaceAllShapes(shapesReplacedWith);
var nextOperation;
if (isZoomed) {
nextOperation = hasMoreOperations ? operationsZoomed[operationIndex] : {
canvas: _this.cloneCanvas(canvasZoomed)
};
} else {
nextOperation = hasMoreOperations ? operations[operationIndex] : {
canvas: _this.cloneCanvas(canvasOriginal)
};
}
updateState(ImageManipulator_objectSpread(ImageManipulator_objectSpread({}, INITIAL_PARAMS), {}, {
currentOperation: nextOperation
}), function () {
if (callback) callback();
});
return;
} // If no more operations found, then make the shapes array with empty array to reset all shapes.
if (!hasMoreOperations) {
_this.props.shapeOperations.replaceAllShapes([]);
}
if (isZoomed) {
var _nextOperation = hasMoreOperations ? operationsZoomed[operationIndex] : {
canvas: _this.cloneCanvas(canvasZoomed)
};
_this.setState({
canvasKey: parseInt(_this.state.canvasKey) + 1
}, function () {
var canvasZoomedNext = _this.applyTransformationsToNewCanvas(false, _nextOperation.canvas);
_this.CamanInstanceZoomed = new window.Caman(canvasZoomedNext, function () {
updateState(ImageManipulator_objectSpread(ImageManipulator_objectSpread({}, INITIAL_PARAMS), {}, {
currentOperation: _nextOperation
}), function () {
if (callback) callback();
});
});
});
var nextOperationOriginal = hasMoreOperations ? operationsOriginal[operationIndex] : {
canvas: _this.cloneCanvas(canvasOriginal)
};
_this.setState({
canvasKey: parseInt(_this.state.canvasOriginalKey) + 1
}, function () {
var canvasNext = _this.applyTransformationsToNewCanvas(false, nextOperationOriginal.canvas, _this.originalCanvas.current);
_this.CamanInstanceOriginal = new window.Caman(canvasNext, function () {});
});
} else {
var nextOperationSimple = hasMoreOperations ? operations[operationIndex] : {
canvas: _this.cloneCanvas(canvasOriginal)
};
_this.setState({
canvasKey: parseInt(_this.state.canvasOriginalKey) + 1
}, function () {
var canvas = _this.applyTransformationsToNewCanvas(false, nextOperationSimple.canvas, _this.originalCanvas.current);
_this.CamanInstance = new window.Caman(canvas, function () {
updateState(ImageManipulator_objectSpread(ImageManipulator_objectSpread({}, INITIAL_PARAMS), {}, {
currentOperation: nextOperationSimple
}), function () {
if (callback) callback();
});
});
});
}
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "isOperationExist", function (operations, type) {
return operations.find(function (_ref8) {
var operation = _ref8.operation;
return operation === type;
});
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "getOperationQuery", function (isCrop, isResize) {
if (isCrop) return 'crop_px';else if (isResize) return 'width';else return 'cdn';
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "destroyAll", function () {});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "resetAll", function (callback) {
var activeTab = _this.props.activeTab;
if (activeTab) {
_this.cancelLastOperation(activeTab, function () {
_this.applyOperations(-1, callback);
});
} else {
_this.applyOperations(-1, callback);
}
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "applyCorrections", function () {
var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
var _this$props21 = _this.props,
initialZoom = _this$props21.initialZoom,
effect = _this$props21.effect,
filter = _this$props21.filter,
adjust = _this$props21.adjust;
var brightness = adjust.brightness,
contrast = adjust.contrast,
saturation = adjust.saturation,
exposure = adjust.exposure;
if (initialZoom !== 1) {
_this.CamanInstanceZoomed.revert(false);
if (effect) _this.CamanInstanceZoomed[getEffectHandlerName(effect)]();
if (filter) _this.CamanInstanceZoomed[getEffectHandlerName(filter)]();
if (brightness.toString() !== '0') _this.CamanInstanceZoomed.brightness(parseInt(brightness || '0'));
if (contrast.toString() !== '0') _this.CamanInstanceZoomed.contrast(parseInt(contrast || '0'));
if (saturation.toString() !== '0') _this.CamanInstanceZoomed.saturation(parseInt(saturation || '0'));
if (exposure.toString() !== '0') _this.CamanInstanceZoomed.exposure(parseInt(exposure || '0'));
_this.CamanInstanceZoomed.render(callback);
} else {
_this.CamanInstance.revert(false);
if (effect) _this.CamanInstance[getEffectHandlerName(effect)]();
if (filter) _this.CamanInstance[getEffectHandlerName(filter)]();
if (brightness.toString() !== '0') _this.CamanInstance.brightness(parseInt(brightness || '0'));
if (contrast.toString() !== '0') _this.CamanInstance.contrast(parseInt(contrast || '0'));
if (saturation.toString() !== '0') _this.CamanInstance.saturation(parseInt(saturation || '0'));
if (exposure.toString() !== '0') _this.CamanInstance.exposure(parseInt(exposure || '0'));
_this.CamanInstance.render(callback);
}
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "cancelAddedShapes", function () {
var shapeOperations = _this.props.shapeOperations;
shapeOperations.deleteShapes({
all: true
}, {
selectedShape: {}
});
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "cancelLastOperation", function (activeTab) {
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
var initialZoom = _this.props.initialZoom;
if (activeTab === 'crop') {
_this.destroyCrop();
}
if (activeTab === 'watermark') {
_this.cancelWatermark();
}
if (['shapes', 'image', 'text'].includes(activeTab)) {
_this.cancelAddedShapes();
}
if (initialZoom !== 1) {
_this.CamanInstanceZoomed.reset();
_this.CamanInstanceOriginal.reset();
_this.CamanInstanceOriginal.render();
_this.CamanInstanceZoomed.render(function () {
if (callback) callback();
});
} else {
_this.CamanInstance.reset();
_this.CamanInstance.render(function () {
if (callback) callback();
});
}
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "initWatermark", function () {
var _this$props22 = _this.props,
watermark = _this$props22.watermark,
updateState = _this$props22.updateState;
if (!watermark.applyByDefault) {
updateState({
watermark: ImageManipulator_objectSpread(ImageManipulator_objectSpread({}, watermark), {}, {
applyByDefault: true
})
});
}
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "applyWatermark", function () {
var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};
var _this$props23 = _this.props,
updateState = _this$props23.updateState,
shapeOperations = _this$props23.shapeOperations;
var watermarkLayer = (shapeOperations.getShape({
key: WATERMARK_UNIQUE_KEY
}) || {}).index;
_this.setState({
tempWatermark: null
});
updateState({
selectedShape: {}
});
_this.makeCanvasSnapshot({
operation: 'shape',
props: {
shapes: [watermarkLayer]
}
}, callback, true);
callback();
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "cancelWatermark", function () {
var tempWatermark = _this.state.tempWatermark;
var _this$props24 = _this.props,
updateState = _this$props24.updateState,
shapeOperations = _this$props24.shapeOperations;
var watermarkLayer = shapeOperations.getShape({
key: WATERMARK_UNIQUE_KEY
}) || {};
var logoImage = null;
if (tempWatermark && tempWatermark.url && tempWatermark.applyByDefault) {
updateState({
isShowSpinner: true
});
logoImage = new Image();
logoImage.setAttribute('crossOrigin', 'Anonymous');
logoImage.src = tempWatermark.url + '?' + new Date().getTime();
logoImage.onload = function () {
shapeOperations.updateShape({
img: logoImage
}, watermarkLayer.index, {
watermark: tempWatermark,
logoImage: logoImage,
isShowSpinner: false,
selectedShape: {}
});
};
} else {
shapeOperations.deleteShape({
index: watermarkLayer.index
}, {
watermark: tempWatermark,
logoImage: logoImage,
selectedShape: {}
});
}
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "getWatermarkArguments", function () {
var _this$props25 = _this.props,
processWithCloudimage = _this$props25.config.processWithCloudimage,
shapeOperations = _this$props25.shapeOperations;
var watermarkObj = shapeOperations.getShape({
key: WATERMARK_UNIQUE_KEY
});
if (!watermarkObj) {
return '';
}
var x = watermarkObj.x,
y = watermarkObj.y,
opacity = watermarkObj.opacity,
watermark = ImageManipulator_objectWithoutProperties(watermarkObj, ImageManipulator_excluded2);
var _this$editedCanvas$cu = _this.editedCanvas.current,
canvasWidth = _this$editedCanvas$cu.width,
canvasHeight = _this$editedCanvas$cu.height;
var xPos = roundDecimalPoint(x / canvasWidth * 100);
var yPos = roundDecimalPoint(y / canvasHeight * 100);
var biggestScaleRatio = Math.max(watermark.width / canvasWidth, watermark.height / canvasHeight);
var watermarkScale = roundDecimalPoint(biggestScaleRatio * 100);
var gravityQuery = "wat_gravity=absolute&wat_pos=".concat(xPos, ",").concat(yPos);
var queryUrl = "wat=1&wat_opacity=".concat(opacity, "&wat_scale=").concat(watermarkScale, "p&").concat(gravityQuery);
queryUrl += processWithCloudimage && watermark.text ? "&wat_text=".concat(watermark.text, "&wat_font=").concat(watermark.textFont, "&wat_fontsize=").concat(watermark.textSize, "&wat_colour=").concat(watermark.color.replace('#', '')) : "&wat_url=".concat(watermark.img.src.split('?')[0]);
return queryUrl;
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "applyChanges", function (activeTab, callback) {
switch (activeTab) {
case 'adjust':
_this.applyAdjust(callback);
break;
case 'effects':
_this.applyFilterOrEffect('effect', callback);
break;
case 'filters':
_this.applyFilterOrEffect('filter', callback);
break;
case 'crop':
_this.applyCrop(callback);
break;
case 'resize':
_this.applyResize();
break;
case 'rotate':
_this.applyOrientation(callback);
break;
case 'watermark':
_this.applyWatermark(callback);
break;
case 'focus_point':
_this.applyFocusPoint(callback);
break;
case 'shapes':
case 'image':
case 'text':
_this.applyShapes(callback);
break;
default:
break;
}
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "changeTab", function (name) {
switch (name) {
case 'effects':
case 'filters':
_this.initFiltersOrEffects();
break;
case 'adjust':
_this.initAdjust();
break;
case 'crop':
_this.initCrop();
break;
case 'resize':
_this.initResize();
break;
case 'rotate':
_this.initOrientation();
break;
case 'watermark':
_this.initWatermark();
break;
case 'focus_point':
_this.initFocusPoint();
break;
default:
_this.destroyAll();
}
});
ImageManipulator_defineProperty(ImageManipulator_assertThisInitialized(_this), "destroyMode", function (name) {
switch (name) {
case 'effects':
break;
case 'filters':
break;
case 'adjust':
break;
case 'crop':
_this.destroyCrop();
break;
case 'resize':
break;
case 'rotate':
break;
case 'focus_point':
_this.destroyFocusPoint();
break;
default:
break;
}
});
_this.state = {
canvas: null,
self: ImageManipulator_assertThisInitialized(_this),
canvasKey: '0-edited',
// the string here for avoiding first render warning only after that would be cleared
canvasOriginalKey: '0-original' // the string here for avoiding first render warning only after that would be cleared
};
_this.CamanInstance = null;
_this.CamanInstanceOriginal = null;
_this.CamanInstanceZoomed = null;
_this.tempCanvasElement = null;
_this.originalCanvas = /*#__PURE__*/Object(react["createRef"])();
_this.editedCanvas = /*#__PURE__*/Object(react["createRef"])();
return _this;
}
ImageManipulator_createClass(ImageManipulator, [{
key: "componentDidMount",
value: function componentDidMount() {
var _this2 = this;
var that = this;
var _this$props26 = this.props,
updateState = _this$props26.updateState,
img = _this$props26.img,
isPreResize = _this$props26.isPreResize,
preCanvasDimensions = _this$props26.preCanvasDimensions;
updateState({
isShowSpinner: true,
applyChanges: this.applyChanges,
applyOperations: this.applyOperations,
resetAll: this.resetAll,
onRotate: this.onRotate,
onAdjust: this.onAdjust,
downloadImage: this.downloadImage,
getResultCanvas: this.getResultCanvas,
saveImage: this.saveImage,
applyCorrections: this.applyCorrections,
restoreAll: this.restoreAll,
cancelLastOperation: this.cancelLastOperation
}, function () {
var canvas = _this2.editedCanvas.current;
var ctx = canvas.getContext('2d');
canvas.width = img.width;
canvas.height = img.height;
ctx.drawImage(img, 0, 0, img.width, img.height);
var original = {
height: img.height,
width: img.width,
ratio: img.width / img.height
};
updateState({
original: original,
canvasDimensions: original
});
if (isPreResize && preCanvasDimensions) {
new window.Caman(canvas, function () {
this.resize({
width: preCanvasDimensions.width,
height: preCanvasDimensions.height
});
this.render(function () {
that.tempCanvasElement = that.editedCanvas.current;
that.setState({
canvasKey: parseInt(that.state.canvasKey) + 1
}, function () {
var resizedCanvas = that.applyTransformationsToNewCanvas();
var original = {
height: resizedCanvas.height,
width: resizedCanvas.width,
ratio: resizedCanvas.width / resizedCanvas.height
};
updateState({
original: original,
canvasDimensions: ImageManipulator_objectSpread({}, original),
canvasOriginal: that.cloneCanvas(resizedCanvas)
}, function () {
that.initializeCanvases(resizedCanvas);
});
});
});
});
} else {
_this2.initializeCanvases(img);
}
});
}
}, {
key: "render",
value: function render() {
var editorWrapperId = this.props.config.elementId;
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(jsx_runtime["Fragment"], {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(Canvas, {
ref: this.originalCanvas,
id: "".concat(editorWrapperId, "_").concat(ORIGINAL_CANVAS_ID),
className: "filerobot-original-canvas"
}, this.state.canvasOriginalKey), /*#__PURE__*/Object(jsx_runtime["jsx"])(Canvas, {
ref: this.editedCanvas,
id: "".concat(editorWrapperId, "_").concat(CANVAS_ID),
className: "filerobot-edit-canvas"
}, this.state.canvasKey)]
});
}
}], [{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(nextProps, prevState) {
var additionalState = {};
if (nextProps.activeTab !== prevState.activeTab) {
if (prevState.activeTab) prevState.self.destroyMode(prevState.activeTab);
if (nextProps.activeTab === 'watermark') {
additionalState.tempWatermark = nextProps.watermark && deepCopy(nextProps.watermark);
}
prevState.self.changeTab(nextProps.activeTab);
}
return ImageManipulator_objectSpread(ImageManipulator_objectSpread({}, additionalState), nextProps);
}
}]);
return ImageManipulator;
}(react["Component"]);
// EXTERNAL MODULE: ./node_modules/throttle-debounce/index.umd.js
var index_umd = __webpack_require__(5);
// CONCATENATED MODULE: ./src/components/Preview/FocusPointPreview.js
function FocusPointPreview_slicedToArray(arr, i) { return FocusPointPreview_arrayWithHoles(arr) || FocusPointPreview_iterableToArrayLimit(arr, i) || FocusPointPreview_unsupportedIterableToArray(arr, i) || FocusPointPreview_nonIterableRest(); }
function FocusPointPreview_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function FocusPointPreview_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return FocusPointPreview_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return FocusPointPreview_arrayLikeToArray(o, minLen); }
function FocusPointPreview_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function FocusPointPreview_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function FocusPointPreview_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function FocusPointPreview(_ref) {
var original = _ref.original,
focusPoint = _ref.focusPoint,
updateState = _ref.updateState,
src = _ref.src;
var _useState = Object(react["useState"])(false),
_useState2 = FocusPointPreview_slicedToArray(_useState, 2),
isLoaded = _useState2[0],
setIsLoaded = _useState2[1];
var ref = Object(react["useRef"])(null);
var refRect = ref.current ? ref.current.getBoundingClientRect() : {};
var getInnerBoxSizeCallback = Object(react["useCallback"])(function () {
var _getInnerBoxSize = getInnerBoxSize((document.getElementById('preview-img-box') || {}).parentElement, original),
_getInnerBoxSize$widt = _getInnerBoxSize.width,
width = _getInnerBoxSize$widt === void 0 ? 0 : _getInnerBoxSize$widt,
_getInnerBoxSize$heig = _getInnerBoxSize.height,
height = _getInnerBoxSize$heig === void 0 ? 0 : _getInnerBoxSize$heig;
return {
width: width,
height: height
};
}, [original]);
var _useState3 = Object(react["useState"])(getInnerBoxSizeCallback()),
_useState4 = FocusPointPreview_slicedToArray(_useState3, 2),
innerBoxSize = _useState4[0],
setInnerBoxSize = _useState4[1];
var debounceUpdateInnerBoxSize = Object(react["useMemo"])(function () {
return Object(index_umd["debounce"])(100, function () {
setInnerBoxSize(getInnerBoxSizeCallback());
});
}, [getInnerBoxSizeCallback]);
function handleMouseDown(e) {
var dragX = e.clientX - refRect.x;
var dragY = e.clientY - refRect.y;
var xVal = Math.round(dragX * original.width / innerBoxSize.width);
var yVal = Math.round(dragY * original.height / innerBoxSize.height);
var x = Math.min(Math.max(xVal, 0), original.width);
var y = Math.min(Math.max(yVal, 0), original.height);
updateState({
focusPoint: {
x: x,
y: y
}
});
}
function handleImageLoaded() {
updateState({
isShowSpinner: false
});
setIsLoaded(true);
}
function handleImageError() {
updateState({
isShowSpinner: false
});
}
Object(react["useEffect"])(function () {
var active = true;
var handleResize = function handleResize() {
if (active) {
debounceUpdateInnerBoxSize();
}
};
window.addEventListener('resize', handleResize);
return function () {
active = false;
window.removeEventListener('resize', handleResize);
};
}, [debounceUpdateInnerBoxSize]);
return /*#__PURE__*/Object(jsx_runtime["jsx"])(FocusPointWrap, {
ref: ref,
width: innerBoxSize.width,
height: innerBoxSize.height,
children: /*#__PURE__*/Object(jsx_runtime["jsxs"])(FocusPointContainer, {
onMouseDown: handleMouseDown,
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FocusPointImg, {
visible: isLoaded,
src: src,
onLoad: handleImageLoaded,
onError: handleImageError
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FocusPoint, {
visible: isLoaded,
x: focusPoint.x * innerBoxSize.width / original.width,
y: focusPoint.y * innerBoxSize.height / original.height
})]
})
});
}
/* harmony default export */ var Preview_FocusPointPreview = (FocusPointPreview);
// CONCATENATED MODULE: ./src/components/CustomizedCanvas.js
function CustomizedCanvas_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { CustomizedCanvas_typeof = function _typeof(obj) { return typeof obj; }; } else { CustomizedCanvas_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return CustomizedCanvas_typeof(obj); }
var CustomizedCanvas_excluded = ["x", "y", "width", "height", "stroke"],
CustomizedCanvas_excluded2 = ["x", "y", "radius", "width", "height", "stroke"],
CustomizedCanvas_excluded3 = ["img", "x", "y", "width", "height", "stroke"],
CustomizedCanvas_excluded4 = ["text", "textSize", "textFont", "x", "y", "stroke"],
_excluded5 = ["x", "y", "width", "height", "stroke", "color", "opacity", "variant", "tab"],
_excluded6 = ["x", "y", "radius", "stroke", "color", "opacity", "tab"],
_excluded7 = ["img", "x", "y", "opacity", "tab", "stroke", "otherStates"],
_excluded8 = ["text", "textSize", "color", "textFont", "x", "y", "stroke", "opacity", "tab", "otherStates"];
function CustomizedCanvas_slicedToArray(arr, i) { return CustomizedCanvas_arrayWithHoles(arr) || CustomizedCanvas_iterableToArrayLimit(arr, i) || CustomizedCanvas_unsupportedIterableToArray(arr, i) || CustomizedCanvas_nonIterableRest(); }
function CustomizedCanvas_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function CustomizedCanvas_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function CustomizedCanvas_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function CustomizedCanvas_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = CustomizedCanvas_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function CustomizedCanvas_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function CustomizedCanvas_toConsumableArray(arr) { return CustomizedCanvas_arrayWithoutHoles(arr) || CustomizedCanvas_iterableToArray(arr) || CustomizedCanvas_unsupportedIterableToArray(arr) || CustomizedCanvas_nonIterableSpread(); }
function CustomizedCanvas_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function CustomizedCanvas_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return CustomizedCanvas_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return CustomizedCanvas_arrayLikeToArray(o, minLen); }
function CustomizedCanvas_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function CustomizedCanvas_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return CustomizedCanvas_arrayLikeToArray(arr); }
function CustomizedCanvas_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function CustomizedCanvas_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function CustomizedCanvas_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { CustomizedCanvas_ownKeys(Object(source), true).forEach(function (key) { CustomizedCanvas_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { CustomizedCanvas_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function CustomizedCanvas_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function CustomizedCanvas_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function CustomizedCanvas_createClass(Constructor, protoProps, staticProps) { if (protoProps) CustomizedCanvas_defineProperties(Constructor.prototype, protoProps); if (staticProps) CustomizedCanvas_defineProperties(Constructor, staticProps); return Constructor; }
function CustomizedCanvas_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) CustomizedCanvas_setPrototypeOf(subClass, superClass); }
function CustomizedCanvas_setPrototypeOf(o, p) { CustomizedCanvas_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return CustomizedCanvas_setPrototypeOf(o, p); }
function CustomizedCanvas_createSuper(Derived) { var hasNativeReflectConstruct = CustomizedCanvas_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = CustomizedCanvas_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = CustomizedCanvas_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return CustomizedCanvas_possibleConstructorReturn(this, result); }; }
function CustomizedCanvas_possibleConstructorReturn(self, call) { if (call && (CustomizedCanvas_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return CustomizedCanvas_assertThisInitialized(self); }
function CustomizedCanvas_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function CustomizedCanvas_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function CustomizedCanvas_getPrototypeOf(o) { CustomizedCanvas_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return CustomizedCanvas_getPrototypeOf(o); }
function CustomizedCanvas_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var CustomizedCanvas_CustomizedCanvas = /*#__PURE__*/function (_Component) {
CustomizedCanvas_inherits(CustomizedCanvas, _Component);
var _super = CustomizedCanvas_createSuper(CustomizedCanvas);
function CustomizedCanvas(props) {
var _this;
CustomizedCanvas_classCallCheck(this, CustomizedCanvas);
_this = _super.call(this, props);
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "_canvas", void 0);
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "_context", void 0);
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "_initArgs", {
hidden: false
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "_allowedTabs", ['shapes', 'image', 'text', 'watermark']);
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "prepareFinalCanvas", function (originalCanvasDimensions) {
var width = originalCanvasDimensions.width,
height = originalCanvasDimensions.height;
var shapes = _this.props.shapes;
var newCanvas = document.createElement('canvas');
newCanvas.width = width;
newCanvas.height = height;
_this._canvas.parentNode.insertBefore(newCanvas, _this._canvas);
var oldCanvas = _this._canvas;
_this._canvas = newCanvas;
_this._context = newCanvas.getContext('2d');
shapes.map(function (shape) {
// Mapping both (X & WIDTH), (Y & HEIGHT) of shape from old to new canvas with final dimnesions.
shape.x = shape.x.mapNumber(0, oldCanvas.width, 0, width);
shape.y = shape.y.mapNumber(0, oldCanvas.height, 0, height);
if (shape.variant !== SHAPES_VARIANTS.TEXT) {
shape.width = shape.width.mapNumber(0, oldCanvas.width, 0, width);
shape.height = shape.height.mapNumber(0, oldCanvas.height, 0, height);
} else {
shape.textSize = parseInt(shape.textSize).mapNumber(0, oldCanvas.width, 0, width);
}
_this.drawShapeThroughVariant(shape);
});
return _this._canvas;
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "updateState", function (data) {
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
var updateState = _this.props.updateState;
updateState(data, callback);
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "pushShapeToShapes", function (newShape, otherStates) {
var shapes = _this.props.shapes;
var shapeIndex = shapes.length;
_this.updateState(CustomizedCanvas_objectSpread({
shapes: [].concat(CustomizedCanvas_toConsumableArray(shapes), [CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread({}, newShape), {}, {
index: shapeIndex
})])
}, otherStates));
return shapeIndex;
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "targettedShape", function () {
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
return index || index === 0 ? _this.props.shapes[index] : _this.props.selectedShape;
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "onSelect", function (event) {
var _this$props = _this.props,
shapes = _this$props.shapes,
activeTab = _this$props.activeTab;
if (!_this._allowedTabs.includes(activeTab)) {
return;
}
var offsetX = event.offsetX,
offsetY = event.offsetY;
var foundShape = false;
shapes.forEach(function (shape) {
if (!shape.hidden && offsetX >= shape.x && offsetX <= shape.x + shape.width && offsetY >= shape.y && offsetY <= shape.y + shape.height && shape.tab === activeTab) {
foundShape = true;
_this.updateState({
selectedShape: CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread({}, shape), {}, {
resizingBox: true,
startEdgeOffset: {
x: offsetX - shape.x,
y: offsetY - shape.y
}
})
});
_this.activateResizingActions();
_this._canvas.addEventListener('keyup', _this.activateShapeDeleting);
_this._canvas.addEventListener('mousemove', _this.startDragging);
_this._canvas.addEventListener('touchmove', _this.startDragging);
document.addEventListener('mouseup', _this.endDragging);
document.addEventListener('touchend', _this.endDragging);
}
}); // Remove the old event listeners incase clicked on no shapes after clicking on one before.
if (!foundShape) {
_this.updateState({
selectedShape: {}
});
_this.disableResizingActions();
_this._canvas.removeEventListener('keyup', _this.activateShapeDeleting);
_this._canvas.removeEventListener('mousemove', _this.startDragging);
_this._canvas.removeEventListener('touchmove', _this.startDragging);
document.removeEventListener('mouseup', _this.endDragging);
document.removeEventListener('touchend', _this.endDragging);
}
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "activateShapeDeleting", function (_ref) {
var key = _ref.key;
var selectedShape = _this.props.selectedShape;
if ((key === 'Delete' || key === 'Backspace') && selectedShape) {
_this.deleteShapeByKeyOrIndex({
index: selectedShape.index
});
_this.updateState({
selectedShape: {}
});
_this.disableResizingActions();
_this._canvas.removeEventListener('keyup', _this.activateShapeDeleting);
}
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "activateResizingActions", function () {
var selectedShape = _this.props.selectedShape;
if (selectedShape.lockScaleToPercentage) {
return;
}
Array.from(document.getElementsByClassName('shape-resizing-control')).forEach(function (control) {
control.addEventListener('mousedown', _this.trackShapeResize);
});
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "trackShapeResize", function (_ref2) {
var target = _ref2.target;
_this.setState({
resizeControlTarget: target
});
document.addEventListener('mousemove', _this.handleShapeResizing);
document.addEventListener('touchmove', _this.handleShapeResizing);
document.addEventListener('mouseup', _this.disableResizingActions);
document.addEventListener('touchend', _this.disableResizingActions);
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "handleShapeResizing", function (_ref3) {
var movementX = _ref3.movementX,
movementY = _ref3.movementY,
shiftKey = _ref3.shiftKey;
var resizeControlTarget = _this.state.resizeControlTarget;
var _this$props2 = _this.props,
selectedShape = _this$props2.selectedShape,
processWithCloudimage = _this$props2.processWithCloudimage;
var index = selectedShape.index,
width = selectedShape.width,
height = selectedShape.height,
x = selectedShape.x,
y = selectedShape.y,
variant = selectedShape.variant,
originalWidth = selectedShape.originalWidth,
originalHeight = selectedShape.originalHeight;
if (!resizeControlTarget || variant === SHAPES_VARIANTS.TEXT) {
return;
}
var oldHeight = height;
var direction = resizeControlTarget.dataset.direction;
if (processWithCloudimage) {
var notAllowedWithCloudImage = ['e', 'w', 'n', 's'];
if (notAllowedWithCloudImage.includes(direction)) {
return;
}
shiftKey = true;
}
var keepShapeRatio = function keepShapeRatio(sameAxesIncSign) {
var ratio = width / height;
if (Math.abs(movementX) >= Math.abs(movementY)) {
var tempHeight = Math.abs(height - (width + movementX) / ratio);
movementY = (!sameAxesIncSign ? -1 : 1) * Math.sign(movementX) * tempHeight;
} else {
var tempWidth = Math.abs(width - (height + movementY) * ratio);
movementX = (!sameAxesIncSign ? -1 : 1) * Math.sign(movementY) * tempWidth;
}
};
var eastHandle = function eastHandle() {
width += movementX;
};
var southHandle = function southHandle() {
height += movementY;
};
var westHandle = function westHandle() {
width -= movementX;
x += movementX;
};
var northHandle = function northHandle() {
height -= movementY;
y += movementY;
};
switch (direction) {
case 'e':
eastHandle();
break;
case 'w':
westHandle();
break;
case 'n':
northHandle();
break;
case 's':
southHandle();
break;
case 'ne':
if (shiftKey) {
keepShapeRatio(false);
}
eastHandle();
if (width >= _this._canvas.width && shiftKey) {
break;
}
northHandle();
break;
case 'nw':
if (shiftKey) {
keepShapeRatio(true);
}
westHandle();
if (width >= _this._canvas.width && shiftKey) {
break;
}
northHandle();
break;
case 'se':
if (shiftKey) {
keepShapeRatio(true);
}
eastHandle();
if (width >= _this._canvas.width && shiftKey) {
break;
}
southHandle();
break;
case 'sw':
if (shiftKey) {
keepShapeRatio(false);
}
westHandle();
if (width >= _this._canvas.width && shiftKey) {
break;
}
southHandle();
break;
default:
return;
}
if (variant === SHAPES_VARIANTS.SQUARE || variant === SHAPES_VARIANTS.CIRCLE) {
if (height !== oldHeight) {
width = height;
} else {
height = width;
}
} // In cloudimage process f max width or height don't increase any of them.
if (processWithCloudimage && (width >= originalWidth || height >= originalHeight)) {
return;
}
var minWidthAndHeight = 15;
if (height <= minWidthAndHeight || width <= minWidthAndHeight) {
return;
} // Limiting the dragging to be inside the canvas only.
if (x < 0) {
x = 0;
}
if (y < 0) {
y = 0;
}
if (x + width > _this._canvas.width) {
x = _this._canvas.width - width;
}
if (y + height > _this._canvas.height) {
y = _this._canvas.height - height;
}
if (width > _this._canvas.width) {
width = _this._canvas.width;
}
if (height > _this._canvas.height) {
height = _this._canvas.height;
}
var updatedShape = {
width: width,
height: height,
x: x,
y: y
};
_this.updateShape(updatedShape, index, {
selectedShape: CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread({}, selectedShape), updatedShape)
});
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "disableResizingActions", function (e) {
document.removeEventListener('mousemove', _this.handleShapeResizing);
document.removeEventListener('mouseup', _this.disableResizingActions);
_this.updateState({
selectedShape: {}
});
_this.setState({
resizeControlTarget: null
});
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "removeResizingBox", function (_ref4) {
var offsetX = _ref4.offsetX,
offsetY = _ref4.offsetY;
var selectedShape = _this.props.selectedShape;
if (offsetX < selectedShape.x || offsetX > selectedShape.x + selectedShape.width || offsetY < selectedShape.y || offsetY > selectedShape.y + selectedShape.height) {
_this.updateState({
selectedShape: CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread({}, selectedShape), {}, {
resizingBox: false
})
});
_this._canvas.removeEventListener('click', _this.removeResizingBox);
}
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "startDragging", function (event) {
if (event.targetTouches && event.targetTouches[0]) {
event.preventDefault();
var _event$targetTouches$ = event.targetTouches[0],
clientX = _event$targetTouches$.clientX,
clientY = _event$targetTouches$.clientY;
var _this$_canvas$getBoun = _this._canvas.getBoundingClientRect(),
x = _this$_canvas$getBoun.x,
y = _this$_canvas$getBoun.y;
event.offsetX = clientX - x;
event.offsetY = clientY - y;
}
var selectedShape = _this.props.selectedShape;
var _selectedShape$startE = selectedShape.startEdgeOffset,
startEdgeOffset = _selectedShape$startE === void 0 ? {} : _selectedShape$startE,
width = selectedShape.width,
height = selectedShape.height,
index = selectedShape.index; // event.offsetX - startEdgeOffset.x for the shape's X from its starting point not the exact mouse position.
var newX = event.offsetX - startEdgeOffset.x;
var newY = event.offsetY - startEdgeOffset.y; // Limiting the dragging to be inside the canvas only.
if (newX < 0) {
newX = 0;
}
if (newY < 0) {
newY = 0;
}
if (newX + width > _this._canvas.width) {
newX = _this._canvas.width - width;
}
if (newY + height > _this._canvas.height) {
newY = _this._canvas.height - height;
}
var newSelectedShape = CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread({}, selectedShape), {}, {
x: newX,
y: newY
});
_this.updateShape(newSelectedShape, index, {
selectedShape: newSelectedShape
});
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "endDragging", function () {
_this._canvas.removeEventListener('mousemove', _this.startDragging);
_this._canvas.removeEventListener('mouseup', _this.endDragging);
_this._canvas.removeEventListener('mouseleave', _this.endDragging);
_this._canvas.addEventListener('click', _this.removeResizingBox);
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "getCanvasCenter", function () {
var reduceWidthBy = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var reduceHeightBy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var centeredX = _this._canvas.width / 2 - reduceWidthBy;
var centeredY = _this._canvas.height / 2 - reduceHeightBy;
return [centeredX, centeredY];
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "draw", function (drawFn, _ref5) {
var _ref5$opacity = _ref5.opacity,
opacity = _ref5$opacity === void 0 ? 1.0 : _ref5$opacity,
hidden = _ref5.hidden,
color = _ref5.color,
_ref5$stroke = _ref5.stroke,
stroke = _ref5$stroke === void 0 ? {} : _ref5$stroke;
if (hidden) {
return;
}
_this._context.globalAlpha = +opacity;
_this._context.fillStyle = color;
_this._context.strokeStyle = stroke.color || 'transparent';
_this._context.lineWidth = stroke.width || 1;
drawFn(); // Make the new canvas rounded if the crop is rounded style.
// round is a manually written protoype method from canvas-round file in utils.
if (_this.props.round) {
_this._context.round();
}
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "redrawShape", function () {
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
var shapes = _this.props.shapes;
_this.clearShape(0, 0, _this._canvas.width, _this._canvas.height);
var shapesCount = shapes.length; // If the shape isn't the top shape (last in array) then re-order all the shapes and make the current as last one.
// Then re-draw with the new order otherwise re-draw with the old order which has the current shape as last/top one.
if (index && index !== shapesCount - 1) {
var currentShape = CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread({}, shapes.splice(index, 1)[0]), {}, {
index: shapesCount
});
shapes.splice(shapesCount, 0, currentShape);
shapes = shapes.map(function (shape, currentIndex) {
shape.index = currentIndex;
_this.drawShapeThroughVariant(shape);
return shape;
});
_this.updateState({
shapes: shapes,
selectedShape: currentShape
});
} else {
shapes.forEach(function (shape) {
return _this.drawShapeThroughVariant(shape);
});
}
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "drawShapeThroughVariant", function (shape) {
switch (shape.variant) {
case SHAPES_VARIANTS.IMAGE:
_this.drawImage(shape);
break;
case SHAPES_VARIANTS.RECT:
case SHAPES_VARIANTS.SQUARE:
_this.drawRect(shape);
break;
case SHAPES_VARIANTS.CIRCLE:
_this.drawCircle(shape);
break;
case SHAPES_VARIANTS.TEXT:
_this.drawText(shape);
default:
return;
}
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "drawRect", function (_ref6) {
var x = _ref6.x,
y = _ref6.y,
width = _ref6.width,
height = _ref6.height,
stroke = _ref6.stroke,
others = CustomizedCanvas_objectWithoutProperties(_ref6, CustomizedCanvas_excluded);
_this.draw(function () {
_this._context.fillRect(x, y, width, height);
if (stroke) {
_this._context.strokeRect(x, y, width, height);
}
}, CustomizedCanvas_objectSpread({
stroke: stroke
}, others));
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "drawCircle", function (_ref7) {
var x = _ref7.x,
y = _ref7.y,
radius = _ref7.radius,
width = _ref7.width,
height = _ref7.height,
stroke = _ref7.stroke,
others = CustomizedCanvas_objectWithoutProperties(_ref7, CustomizedCanvas_excluded2);
_this.draw(function () {
_this._context.roundRect(x, y, width, height);
_this._context.fill();
if (stroke) {
_this._context.stroke();
}
}, CustomizedCanvas_objectSpread({
stroke: stroke
}, others));
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "drawImage", function (_ref8) {
var img = _ref8.img,
x = _ref8.x,
y = _ref8.y,
width = _ref8.width,
height = _ref8.height,
stroke = _ref8.stroke,
others = CustomizedCanvas_objectWithoutProperties(_ref8, CustomizedCanvas_excluded3);
_this.draw(function () {
_this._context.drawImage(img, x, y, width, height);
if (stroke) {
_this._context.strokeRect(x, y, width, height);
}
}, CustomizedCanvas_objectSpread({
stroke: stroke
}, others));
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "setTextStyle", function (_ref9) {
var textSize = _ref9.textSize,
textFont = _ref9.textFont;
_this._context.textAlign = "start";
_this._context.textBaseline = "top";
_this._context.font = "".concat(textSize, "px ").concat(textFont);
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "getTextWidthAndHeight", function (_ref10) {
var text = _ref10.text,
textSize = _ref10.textSize,
textFont = _ref10.textFont;
_this.setTextStyle({
textSize: textSize,
textFont: textFont
});
var metrics = _this._context.measureText(text);
var width = metrics.width;
var height = width === 0 ? 0 : metrics.actualBoundingBoxDescent - metrics.actualBoundingBoxAscent;
return [width, height];
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "drawText", function (_ref11) {
var text = _ref11.text,
textSize = _ref11.textSize,
textFont = _ref11.textFont,
x = _ref11.x,
y = _ref11.y,
stroke = _ref11.stroke,
others = CustomizedCanvas_objectWithoutProperties(_ref11, CustomizedCanvas_excluded4);
_this.draw(function () {
_this.setTextStyle({
textSize: textSize,
textFont: textFont
});
_this._context.fillText(text, x, y, _this._canvas.width);
if (stroke) {
_this._context.strokeText(text, x, y);
}
}, CustomizedCanvas_objectSpread({
stroke: stroke
}, others));
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "addRect", function () {
var _ref12 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
x = _ref12.x,
y = _ref12.y,
_ref12$width = _ref12.width,
width = _ref12$width === void 0 ? 100 : _ref12$width,
_ref12$height = _ref12.height,
height = _ref12$height === void 0 ? 75 : _ref12$height,
_ref12$stroke = _ref12.stroke,
stroke = _ref12$stroke === void 0 ? {} : _ref12$stroke,
_ref12$color = _ref12.color,
color = _ref12$color === void 0 ? '#000000' : _ref12$color,
_ref12$opacity = _ref12.opacity,
opacity = _ref12$opacity === void 0 ? 1.0 : _ref12$opacity,
_ref12$variant = _ref12.variant,
variant = _ref12$variant === void 0 ? SHAPES_VARIANTS.RECT : _ref12$variant,
_ref12$tab = _ref12.tab,
tab = _ref12$tab === void 0 ? 'shapes' : _ref12$tab,
others = CustomizedCanvas_objectWithoutProperties(_ref12, _excluded5);
var _this$getCanvasCenter = _this.getCanvasCenter(width / 2, height / 2),
_this$getCanvasCenter2 = CustomizedCanvas_slicedToArray(_this$getCanvasCenter, 2),
centerX = _this$getCanvasCenter2[0],
centerY = _this$getCanvasCenter2[1];
var drawingArgs = {
x: x || centerX,
y: y || centerY,
width: width,
height: height,
stroke: stroke,
opacity: opacity,
color: color
};
var allArgs = CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread({}, _this._initArgs), others), drawingArgs), {}, {
variant: variant,
tab: tab
});
if (others.key && _this.replaceShapeIfExisted(others.key, allArgs)) {
return;
}
_this.drawRect(drawingArgs);
var index = _this.pushShapeToShapes(allArgs);
_this.updateState({
selectedShape: CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread({}, allArgs), {}, {
index: index,
resizingBox: true
})
}, _this.activateResizingActions);
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "addSquare", function (rectArgs) {
if (!rectArgs.width) rectArgs.width = rectArgs.height = 75;
rectArgs.variant = SHAPES_VARIANTS.SQUARE;
_this.addRect(rectArgs);
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "addCircle", function () {
var _ref13 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
x = _ref13.x,
y = _ref13.y,
_ref13$radius = _ref13.radius,
radius = _ref13$radius === void 0 ? 50 : _ref13$radius,
_ref13$stroke = _ref13.stroke,
stroke = _ref13$stroke === void 0 ? {} : _ref13$stroke,
_ref13$color = _ref13.color,
color = _ref13$color === void 0 ? '#000000' : _ref13$color,
_ref13$opacity = _ref13.opacity,
opacity = _ref13$opacity === void 0 ? 1.0 : _ref13$opacity,
_ref13$tab = _ref13.tab,
tab = _ref13$tab === void 0 ? 'shapes' : _ref13$tab,
others = CustomizedCanvas_objectWithoutProperties(_ref13, _excluded6);
var _this$getCanvasCenter3 = _this.getCanvasCenter(radius, radius),
_this$getCanvasCenter4 = CustomizedCanvas_slicedToArray(_this$getCanvasCenter3, 2),
centerX = _this$getCanvasCenter4[0],
centerY = _this$getCanvasCenter4[1];
var widthAndHeight = radius * 2;
var drawingArgs = {
x: x || centerX,
y: y || centerY,
radius: radius,
color: color,
opacity: opacity,
stroke: stroke,
width: widthAndHeight,
height: widthAndHeight
};
var allArgs = CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread({}, _this._initArgs), others), drawingArgs), {}, {
tab: tab,
variant: SHAPES_VARIANTS.CIRCLE
});
if (others.key && _this.replaceShapeIfExisted(others.key, allArgs)) {
return;
}
_this.drawCircle(drawingArgs);
var index = _this.pushShapeToShapes(allArgs);
_this.updateState({
selectedShape: CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread({}, allArgs), {}, {
index: index,
resizingBox: true
})
}, _this.activateResizingActions);
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "addImage", function () {
var _ref14 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
img = _ref14.img,
_ref14$x = _ref14.x,
x = _ref14$x === void 0 ? undefined : _ref14$x,
_ref14$y = _ref14.y,
y = _ref14$y === void 0 ? undefined : _ref14$y,
_ref14$opacity = _ref14.opacity,
opacity = _ref14$opacity === void 0 ? 1.0 : _ref14$opacity,
_ref14$tab = _ref14.tab,
tab = _ref14$tab === void 0 ? 'image' : _ref14$tab,
_ref14$stroke = _ref14.stroke,
stroke = _ref14$stroke === void 0 ? {} : _ref14$stroke,
otherStates = _ref14.otherStates,
others = CustomizedCanvas_objectWithoutProperties(_ref14, _excluded7);
if (img) {
var addIt = function addIt() {
var _this$getSuitableImgD = _this.getSuitableImgDiemensions(img, others.lockScaleToPercentage),
_this$getSuitableImgD2 = CustomizedCanvas_slicedToArray(_this$getSuitableImgD, 2),
originalWidth = _this$getSuitableImgD2[0],
originalHeight = _this$getSuitableImgD2[1];
var _this$getCanvasCenter5 = _this.getCanvasCenter((others.width || originalWidth) / 2, (others.height || originalHeight) / 2),
_this$getCanvasCenter6 = CustomizedCanvas_slicedToArray(_this$getCanvasCenter5, 2),
centerX = _this$getCanvasCenter6[0],
centerY = _this$getCanvasCenter6[1];
var drawingArgs = {
img: img,
opacity: opacity,
originalWidth: originalWidth,
originalHeight: originalHeight,
width: others.width || originalWidth,
height: others.height || originalHeight,
x: x || centerX,
y: y || centerY,
stroke: stroke
};
var allArgs = CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread({}, _this._initArgs), others), drawingArgs), {}, {
variant: SHAPES_VARIANTS.IMAGE,
tab: tab
});
if (others.key && _this.replaceShapeIfExisted(others.key, allArgs, otherStates)) {
return;
}
_this.drawImage(drawingArgs);
var index = _this.pushShapeToShapes(allArgs);
_this.updateState(CustomizedCanvas_objectSpread({
selectedShape: CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread({}, allArgs), {}, {
index: index,
resizingBox: true
})
}, otherStates), _this.activateResizingActions);
};
if (typeof img === 'string') {
img = _this.makeImgElement(img, addIt);
} else {
addIt();
}
}
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "addText", function () {
var _ref15 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
_ref15$text = _ref15.text,
text = _ref15$text === void 0 ? 'Text' : _ref15$text,
_ref15$textSize = _ref15.textSize,
textSize = _ref15$textSize === void 0 ? 62 : _ref15$textSize,
_ref15$color = _ref15.color,
color = _ref15$color === void 0 ? "#000000" : _ref15$color,
_ref15$textFont = _ref15.textFont,
textFont = _ref15$textFont === void 0 ? 'Arial' : _ref15$textFont,
_ref15$x = _ref15.x,
x = _ref15$x === void 0 ? undefined : _ref15$x,
_ref15$y = _ref15.y,
y = _ref15$y === void 0 ? undefined : _ref15$y,
_ref15$stroke = _ref15.stroke,
stroke = _ref15$stroke === void 0 ? {} : _ref15$stroke,
_ref15$opacity = _ref15.opacity,
opacity = _ref15$opacity === void 0 ? 1.0 : _ref15$opacity,
_ref15$tab = _ref15.tab,
tab = _ref15$tab === void 0 ? 'text' : _ref15$tab,
otherStates = _ref15.otherStates,
others = CustomizedCanvas_objectWithoutProperties(_ref15, _excluded8);
var _this$getTextWidthAnd = _this.getTextWidthAndHeight({
text: text,
textSize: textSize,
textFont: textFont
}),
_this$getTextWidthAnd2 = CustomizedCanvas_slicedToArray(_this$getTextWidthAnd, 2),
width = _this$getTextWidthAnd2[0],
height = _this$getTextWidthAnd2[1]; // Set text style here for measuring the text's width & hegiht before drawing.
var _this$getCanvasCenter7 = _this.getCanvasCenter(width / 2, height / 2),
_this$getCanvasCenter8 = CustomizedCanvas_slicedToArray(_this$getCanvasCenter7, 2),
centerX = _this$getCanvasCenter8[0],
centerY = _this$getCanvasCenter8[1];
if (text) {
var drawingArgs = {
text: text,
textSize: textSize,
textFont: textFont,
x: x || centerX,
y: y || centerY,
opacity: opacity,
stroke: stroke,
color: color
};
var allArgs = CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread({}, _this._initArgs), others), drawingArgs), {}, {
width: width,
height: height,
variant: SHAPES_VARIANTS.TEXT,
tab: tab
});
if (others.key && _this.replaceShapeIfExisted(others.key, allArgs, otherStates)) {
return;
}
_this.drawText(drawingArgs);
var index = _this.pushShapeToShapes(allArgs);
_this.updateState(CustomizedCanvas_objectSpread({
selectedShape: CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread({}, allArgs), {}, {
index: index,
resizingBox: true
})
}, otherStates), _this.activateResizingActions);
}
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "addAnyShape", function (shapeArgs, otherStates) {
if (shapeArgs.index || shapeArgs.index === 0) {
var shapes = _this.props.shapes;
var shape = shapes[shapeArgs.index];
if (!shapeArgs.variant || shape.variant === shapeArgs.variant) {
_this.updateShape(shapeArgs, shapeArgs.index, otherStates);
return;
}
}
var args = CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread({}, shapeArgs), {}, {
otherStates: otherStates
});
switch (shapeArgs.variant) {
case SHAPES_VARIANTS.IMAGE:
_this.addImage(args);
break;
case SHAPES_VARIANTS.RECT:
_this.addRect(args);
break;
case SHAPES_VARIANTS.SQUARE:
_this.addSquare(args);
break;
case SHAPES_VARIANTS.CIRCLE:
_this.addCircle(args);
break;
case SHAPES_VARIANTS.TEXT:
_this.addText(args);
default:
return;
}
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "getSuitableImgDiemensions", function (img) {
var lockScaleToPercentage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var width = img.width;
var height = img.height; // Scaling down the image if it's bigger than the canvas
if (height > _this._canvas.height) {
var ratio = height / _this._canvas.height;
height /= ratio;
width /= ratio;
}
if (width > _this._canvas.width) {
var _ratio = width / _this._canvas.width;
height /= _ratio;
width /= _ratio;
}
if (lockScaleToPercentage) {
var scaleValue = lockScaleToPercentage / 100;
width *= scaleValue;
height *= scaleValue;
}
width = _this.fromLatestCanvasSizeValue(width, 'width');
height = _this.fromLatestCanvasSizeValue(height, 'height');
return [width, height];
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "getShapeByKeyOrIndex", function (_ref16) {
var shapeKey = _ref16.key,
shapeIndex = _ref16.index;
if (!shapeKey && !shapeIndex && shapeKey !== 0 && shapeIndex !== 0) {
return false;
}
var shapes = _this.props.shapes;
return shapeIndex ? shapes[shapeIndex] : shapes.filter(function (_ref17) {
var key = _ref17.key;
return key === shapeKey;
})[0];
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "replaceShapeIfExisted", function (key, args) {
var otherStates = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
var shape = _this.getShapeByKeyOrIndex({
key: key
});
if (shape) {
args = CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread({}, args), {}, {
x: shape.x,
y: shape.y,
width: shape.width,
height: shape.height
});
_this.updateShape(args, shape.index, otherStates);
return true;
}
return false;
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "setShapeVisibilityByKeyOrIndex", function (_ref18) {
var key = _ref18.key,
index = _ref18.index;
var isHidden = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
var shape = _this.getShapeByKeyOrIndex({
key: key,
index: index
});
if (shape && shape.hidden !== isHidden) {
_this.updateShape({
hidden: isHidden || !shape.hidden
}, shape.index);
}
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "getShapesIndexByAnyProp", function (propertyName, propertyValue) {
var shapes = _this.props.shapes;
if (shapes && shapes.length === 0) {
return [];
}
var shapesIndicies = [];
shapes.filter(function (_ref19, index) {
var filterProp = _ref19[propertyName];
if (filterProp === propertyValue || typeof filterProp === 'undefined' && Boolean(filterProp) === propertyValue) {
shapesIndicies.push(index);
return true;
}
return false;
});
return shapesIndicies;
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "updateShapes", function (updatedData, otherStates) {
var callback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};
var shapes = _this.props.shapes;
shapes = shapes.map(function (s) {
return CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread({}, s), updatedData);
});
_this.updateState(CustomizedCanvas_objectSpread({
shapes: shapes
}, otherStates), callback);
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "replaceAllShapes", function (newShapes) {
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
_this.updateState({
shapes: newShapes
}, function () {
_this.redrawShape();
callback();
});
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "updateShape", function (updatedData, index) {
var otherStatesToBeUpdated = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
var _this$props3 = _this.props,
shapes = _this$props3.shapes,
selectedShape = _this$props3.selectedShape;
if (!updatedData || !index && index !== 0 && (!selectedShape || !selectedShape.index && selectedShape.index !== 0)) {
return;
}
if (typeof updatedData.img === 'string') {
_this.updateState({
selectedShape: CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread({}, selectedShape), {}, {
lockScaleToPercentage: updatedData.lockScaleToPercentage,
img: updatedData.img
})
});
_this.makeImgElement(updatedData.img, _this.updateShape, updatedData, index, otherStatesToBeUpdated);
return;
}
var updates = {}; // if no index provided and selected shape would be updated then add the obj and update the stats' selectes shape.
if (!index && index !== 0) {
updates.selectedShape = CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread({}, selectedShape), updatedData);
}
index = index || index === 0 ? index : selectedShape.index;
if (shapes[index]) {
var latestShapes = shapes;
if (updatedData.textSize && updatedData.textSize !== shapes[index].textSize || updatedData.text && updatedData.text !== shapes[index].text) {
var targetShape = shapes[index];
var _this$getTextWidthAnd3 = _this.getTextWidthAndHeight(CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread({}, targetShape), updatedData)),
_this$getTextWidthAnd4 = CustomizedCanvas_slicedToArray(_this$getTextWidthAnd3, 2),
width = _this$getTextWidthAnd4[0],
height = _this$getTextWidthAnd4[1];
if (!updates.selectedShape) {
updatedData.width = width;
updatedData.height = height;
updatedData.text = updatedData.text || targetShape.text;
} else {
updatedData.width = updates.selectedShape.width = width;
updatedData.height = updates.selectedShape.height = height;
updatedData.text = updates.selectedShape.text = updatedData.text || targetShape.text;
}
} else {
var newData = CustomizedCanvas_objectSpread({}, updatedData);
if (typeof updatedData.x !== 'undefined' && typeof updatedData.y !== 'undefined') {
newData.x = updatedData.x;
newData.y = updatedData.y;
}
if (updatedData.stroke) {
newData.stroke = updatedData.stroke;
}
if (updatedData.width && updatedData.height) {
newData.width = updatedData.width;
newData.height = updatedData.height;
}
if (updatedData.lockScaleToPercentage) {
updatedData.lockScaleToPercentage = updatedData.lockScaleToPercentage;
}
updates.selectedShape = CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread({}, selectedShape), newData);
}
latestShapes[index] = CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread({}, latestShapes[index]), updatedData);
_this.updateState(CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread({
shapes: latestShapes
}, updates), otherStatesToBeUpdated), function () {
_this.redrawShape(index);
});
}
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "clearShape", function (x, y, width, height) {
var stroke = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
var strokeWidth = stroke.width;
var strokeWidthConst = strokeWidth || 1;
var clearFromX = x - strokeWidthConst;
var clearFromY = y - strokeWidthConst;
var clearWidth = width + strokeWidthConst;
var clearHeight = height + strokeWidthConst;
_this._context.clearRect(clearFromX, clearFromY, clearWidth, clearHeight);
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "eraseAndRemoveShapeFromArray", function (index, shapes) {
if (Object.keys(_this.targettedShape(index)).length === 0) {
return;
}
_this.clearShape(0, 0, _this._canvas.width, _this._canvas.height);
var newShapes = shapes.filter(function (shape) {
if (shape.index === index) {
return false;
}
if (shape.index > index) {
shape.index -= 1;
}
;
_this.drawShapeThroughVariant(shape);
return shape;
});
return newShapes;
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "deleteShapeByKeyOrIndex", function (_ref20) {
var index = _ref20.index,
key = _ref20.key;
var otherStates = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var selectedShape = _this.props.selectedShape;
if (!index && index !== 0 && !key) {
if (!selectedShape) {
return;
}
index = selectedShape.index;
}
var shapes = _this.props.shapes;
var shapeIndex = index || index === 0 ? index : (_this.getShapeByKeyOrIndex({
key: key
}) || {}).index;
if (shapeIndex || shapeIndex === 0) {
if (shapeIndex === selectedShape.index) {
otherStates.selectedShape = {};
}
_this.updateState(CustomizedCanvas_objectSpread({
shapes: _this.eraseAndRemoveShapeFromArray(shapeIndex, shapes)
}, otherStates));
}
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "deleteShapes", function () {
var indicies = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var otherStates = arguments.length > 1 ? arguments[1] : undefined;
var shapes = _this.props.shapes;
indicies.forEach(function (i) {
shapes = _this.eraseAndRemoveShapeFromArray(i, shapes);
});
_this.updateState(CustomizedCanvas_objectSpread({
shapes: shapes
}, otherStates));
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "deleteAllShapesOrByTypeOrIndicies", function (_ref21) {
var type = _ref21.type,
_ref21$all = _ref21.all,
all = _ref21$all === void 0 ? false : _ref21$all,
_ref21$applied = _ref21.applied,
applied = _ref21$applied === void 0 ? false : _ref21$applied,
_ref21$secured = _ref21.secured,
secured = _ref21$secured === void 0 ? [] : _ref21$secured;
if (!type && !all) {
return;
}
if (all) {
var watermarkIndex = (_this.getShapeByKeyOrIndex({
key: WATERMARK_UNIQUE_KEY
}) || {}).index;
var securedIndicies = CustomizedCanvas_toConsumableArray(secured);
if ((watermarkIndex || watermarkIndex === 0) && !securedIndicies.includes(watermarkIndex)) {
securedIndicies.push(watermarkIndex);
}
var shapes = [];
_this.clearShape(0, 0, _this._canvas.width, _this._canvas.height);
if (!applied) {
shapes = _this.props.shapes.filter(function (s) {
if (s.applied || securedIndicies.includes(s.index)) {
_this.drawShapeThroughVariant(s);
return s;
}
return false;
});
}
_this.updateState({
shapes: shapes,
selectedShape: {}
});
return;
}
var shapesIndicies = _this.getShapesIndexByAnyProp('type', type);
if (shapesIndicies.length > 0) {
_this.deleteShapes(shapesIndicies);
}
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "makeImgElement", function (src, fn, dataObject) {
for (var _len = arguments.length, args = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
args[_key - 3] = arguments[_key];
}
if (!src) {
return '';
}
_this.updateState({
isShowSpinner: true
});
var img = new Image();
img.crossOrigin = 'Anonymous';
img.src = src.startsWith('data:image') ? src : "".concat(src, "?v=").concat(Math.random());
img.onload = function () {
if (dataObject) {
var width, height;
if (dataObject.position) {
var x, y;
var _getWatermarkSquaredP = getWatermarkSquaredPosition(dataObject.position, _this._canvas, img.width, img.height);
var _getWatermarkSquaredP2 = CustomizedCanvas_slicedToArray(_getWatermarkSquaredP, 4);
x = _getWatermarkSquaredP2[0];
y = _getWatermarkSquaredP2[1];
width = _getWatermarkSquaredP2[2];
height = _getWatermarkSquaredP2[3];
dataObject.x = x;
dataObject.y = y;
}
var _this$getSuitableImgD3 = _this.getSuitableImgDiemensions(img, dataObject.lockScaleToPercentage),
_this$getSuitableImgD4 = CustomizedCanvas_slicedToArray(_this$getSuitableImgD3, 2),
originalWidth = _this$getSuitableImgD4[0],
originalHeight = _this$getSuitableImgD4[1];
dataObject.width = width || originalWidth;
dataObject.originalWidth = originalWidth;
dataObject.height = height || originalHeight;
dataObject.originalHeight = originalHeight;
fn.apply(void 0, [dataObject].concat(args));
} else {
fn.apply(void 0, args);
}
_this.updateState({
isShowSpinner: false
});
};
img.onerror = function () {
_this.updateState({
isShowSpinner: false
});
console.error('Error loading the image...');
};
if (dataObject) {
dataObject.img = img;
}
return img;
});
CustomizedCanvas_defineProperty(CustomizedCanvas_assertThisInitialized(_this), "fromLatestCanvasSizeValue", function (number, property) {
if (_this._canvas && _this.state.latestCanvasSize) {
// property = width or height
return number.mapNumber(0, _this.state.latestCanvasSize[property], 0, _this._canvas[property]);
}
return number;
});
_this.canvasRef = /*#__PURE__*/Object(react["createRef"])();
_this.shapeResizingBoxRef = /*#__PURE__*/Object(react["createRef"])();
_this.state = {
resizeControlTarget: null,
latestCanvasSize: null
};
return _this;
}
CustomizedCanvas_createClass(CustomizedCanvas, [{
key: "componentDidMount",
value: function componentDidMount() {
var _this2 = this;
if (this.canvasRef && this.canvasRef.current && !this._canvas) {
var _this$props$theme, _this$props$theme$col;
this._canvas = this.canvasRef.current;
this._canvas.addEventListener('mousedown', this.onSelect);
this._context = this._canvas.getContext('2d');
var border = "1px solid ".concat(((_this$props$theme = this.props.theme) === null || _this$props$theme === void 0 ? void 0 : (_this$props$theme$col = _this$props$theme.colors) === null || _this$props$theme$col === void 0 ? void 0 : _this$props$theme$col.text) || (this.props.colorScheme === 'light' ? '#000' : '#fff'));
var availableShapes = [{
label: 'Rectangle',
variant: SHAPES_VARIANTS.RECT,
iconStyles: {
height: 50,
width: 100,
border: border
},
drawFn: this.addRect
}, {
label: 'Square',
variant: SHAPES_VARIANTS.SQUARE,
iconStyles: {
border: border
},
drawFn: function drawFn(props) {
return _this2.addSquare(CustomizedCanvas_objectSpread({
width: 75,
height: 75
}, props));
} // iconUrl: undefined,
}, {
label: 'Circle',
variant: SHAPES_VARIANTS.CIRCLE,
iconStyles: {
border: border,
borderRadius: '50%'
},
drawFn: this.addCircle // iconUrl: undefined,
}];
this.props.updateState({
shapeOperations: {
addImage: this.addImage,
addRect: this.addRect,
addCircle: this.addCircle,
addText: this.addText,
addOrUpdate: this.addAnyShape,
updateShape: this.updateShape,
updateShapes: this.updateShapes,
replaceAllShapes: this.replaceAllShapes,
deleteShape: this.deleteShapeByKeyOrIndex,
deleteShapes: this.deleteAllShapesOrByTypeOrIndicies,
setShapeVisibility: this.setShapeVisibilityByKeyOrIndex,
getShape: this.getShapeByKeyOrIndex,
getShapesIndicies: this.getShapesIndexByAnyProp,
prepareFinalCanvas: this.prepareFinalCanvas
},
availableShapes: availableShapes
});
}
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
this._canvas.removeEventListener('mousedown', this.onSelect);
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
if (prevProps.width !== this.props.width || prevProps.height !== this.props.height) {
this.redrawShape();
}
}
}, {
key: "render",
value: function render() {
var _this$props4 = this.props,
parentCanvasHeight = _this$props4.height,
parentCanvasWidth = _this$props4.width,
_this$props4$selected = _this$props4.selectedShape,
_this$props4$selected2 = _this$props4$selected.width,
width = _this$props4$selected2 === void 0 ? 0 : _this$props4$selected2,
_this$props4$selected3 = _this$props4$selected.height,
height = _this$props4$selected3 === void 0 ? 0 : _this$props4$selected3,
_this$props4$selected4 = _this$props4$selected.x,
x = _this$props4$selected4 === void 0 ? 0 : _this$props4$selected4,
_this$props4$selected5 = _this$props4$selected.y,
y = _this$props4$selected5 === void 0 ? 0 : _this$props4$selected5,
_this$props4$selected6 = _this$props4$selected.resizingBox,
resizingBox = _this$props4$selected6 === void 0 ? false : _this$props4$selected6,
_this$props4$selected7 = _this$props4$selected.lockScaleToPercentage,
lockScaleToPercentage = _this$props4$selected7 === void 0 ? 0 : _this$props4$selected7,
processWithCloudimage = _this$props4.processWithCloudimage,
wrapperId = _this$props4.wrapperId;
var resizingBoxLines = ['e', 'n', 'w', 's'];
var resizingBoxPoints = ['ne', 'nw', 'sw', 'se'];
if (!processWithCloudimage) {
resizingBoxPoints.splice(0, 0, 'e', 'n', 'w', 's');
}
var left = (this._canvas ? this._canvas.offsetLeft : 0) + x;
var top = (this._canvas ? this._canvas.offsetTop : 0) + y;
var mutualStyles = {
pointerEvents: 'all'
};
/* Mod ??? crop text point - line */
var className="cropper-crop-box";
if (_this$props4.activeTab!=undefined && _this$props4.activeTab == "text") {
className="cropper-crop-box cropper-crop-box-text";
}
/* Mod ??? crop text point - line */
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(jsx_runtime["Fragment"], {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(PreviewCanvas, {
ref: this.canvasRef,
id: "".concat(wrapperId, "_").concat(PREVIEW_CANVAS_ID),
width: parentCanvasWidth,
height: parentCanvasHeight,
tabIndex: 1
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
ref: this.shapeResizingBoxRef,
className: className,/* Mod ??? crop text point - line */
style: {
display: resizingBox && !lockScaleToPercentage ? 'block' : 'none',
width: width,
height: height,
left: left,
top: top,
pointerEvents: 'none'
},
children: [resizingBoxLines.map(function (l) {
return /*#__PURE__*/Object(jsx_runtime["jsx"])("span", {
className: "cropper-line line-".concat(l, " shape-resizing-control"),
"data-direction": l,
style: mutualStyles
}, l);
}), resizingBoxPoints.map(function (p) {
return /*#__PURE__*/Object(jsx_runtime["jsx"])("span", {
className: "cropper-point point-".concat(p, " shape-resizing-control"),
"data-direction": p,
style: mutualStyles
}, p);
})]
})]
});
}
}], [{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(props, state) {
return CustomizedCanvas_objectSpread(CustomizedCanvas_objectSpread({}, state), {}, {
latestCanvasSize: props.latestCanvasSize || {
width: 0,
height: 0
}
});
}
}]);
return CustomizedCanvas;
}(react["Component"]);
// CONCATENATED MODULE: ./src/components/Preview/Preview.js
function Preview_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Preview_typeof = function _typeof(obj) { return typeof obj; }; } else { Preview_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Preview_typeof(obj); }
function Preview_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function Preview_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { Preview_ownKeys(Object(source), true).forEach(function (key) { Preview_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { Preview_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function Preview_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function Preview_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function Preview_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function Preview_createClass(Constructor, protoProps, staticProps) { if (protoProps) Preview_defineProperties(Constructor.prototype, protoProps); if (staticProps) Preview_defineProperties(Constructor, staticProps); return Constructor; }
function Preview_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Preview_setPrototypeOf(subClass, superClass); }
function Preview_setPrototypeOf(o, p) { Preview_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Preview_setPrototypeOf(o, p); }
function Preview_createSuper(Derived) { var hasNativeReflectConstruct = Preview_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Preview_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Preview_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Preview_possibleConstructorReturn(this, result); }; }
function Preview_possibleConstructorReturn(self, call) { if (call && (Preview_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Preview_assertThisInitialized(self); }
function Preview_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function Preview_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function Preview_getPrototypeOf(o) { Preview_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Preview_getPrototypeOf(o); }
var Preview_default = /*#__PURE__*/function (_Component) {
Preview_inherits(_default, _Component);
var _super = Preview_createSuper(_default);
function _default() {
Preview_classCallCheck(this, _default);
return _super.apply(this, arguments);
}
Preview_createClass(_default, [{
key: "render",
value: function render() {
var _this$props = this.props,
activeTab = _this$props.activeTab,
isHideCanvas = _this$props.isHideCanvas,
_this$props$watermark = _this$props.watermark,
watermark = _this$props$watermark === void 0 ? {} : _this$props$watermark,
focusPoint = _this$props.focusPoint,
original = _this$props.original,
updateState = _this$props.updateState,
src = _this$props.src,
shapes = _this$props.shapes,
selectedShape = _this$props.selectedShape,
_this$props$config = _this$props.config,
colorScheme = _this$props$config.colorScheme,
editorWrapperId = _this$props$config.elementId,
processWithCloudimage = _this$props$config.processWithCloudimage,
theme = _this$props$config.theme,
roundCrop = _this$props.roundCrop,
latestCanvasSize = _this$props.latestCanvasSize;
var applyByDefault = watermark.applyByDefault;
var canvas = get_canvas_node_getCanvasNode(editorWrapperId);
var canvasRect = canvas && canvas.getBoundingClientRect() || {};
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(PreviewImgBox, {
id: "preview-img-box",
hideCanvas: activeTab === 'crop' || isHideCanvas,
isShowWatermark: applyByDefault,
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(ImageManipulator_ImageManipulator, Preview_objectSpread({}, this.props)), activeTab !== 'focus_point' && /*#__PURE__*/Object(jsx_runtime["jsx"])(CustomizedCanvas_CustomizedCanvas, {
width: canvasRect.width,
height: canvasRect.height,
shapes: shapes,
updateState: updateState,
selectedShape: selectedShape,
activeTab: activeTab,
round: roundCrop,
latestCanvasSize: latestCanvasSize,
colorScheme: colorScheme,
theme: theme,
wrapperId: editorWrapperId,
processWithCloudimage: processWithCloudimage
}), activeTab === 'focus_point' && /*#__PURE__*/Object(jsx_runtime["jsx"])(Preview_FocusPointPreview, {
src: src,
updateState: updateState,
focusPoint: focusPoint,
original: original
})]
});
}
}]);
return _default;
}(react["Component"]);
// CONCATENATED MODULE: ./src/components/PreResize/PreResize.js
function PreResize_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { PreResize_typeof = function _typeof(obj) { return typeof obj; }; } else { PreResize_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return PreResize_typeof(obj); }
function PreResize_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function PreResize_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { PreResize_ownKeys(Object(source), true).forEach(function (key) { PreResize_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { PreResize_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function PreResize_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function PreResize_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function PreResize_createClass(Constructor, protoProps, staticProps) { if (protoProps) PreResize_defineProperties(Constructor.prototype, protoProps); if (staticProps) PreResize_defineProperties(Constructor, staticProps); return Constructor; }
function PreResize_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) PreResize_setPrototypeOf(subClass, superClass); }
function PreResize_setPrototypeOf(o, p) { PreResize_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return PreResize_setPrototypeOf(o, p); }
function PreResize_createSuper(Derived) { var hasNativeReflectConstruct = PreResize_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = PreResize_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = PreResize_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return PreResize_possibleConstructorReturn(this, result); }; }
function PreResize_possibleConstructorReturn(self, call) { if (call && (PreResize_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return PreResize_assertThisInitialized(self); }
function PreResize_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function PreResize_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function PreResize_getPrototypeOf(o) { PreResize_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return PreResize_getPrototypeOf(o); }
function PreResize_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var PreResize_default = /*#__PURE__*/function (_Component) {
PreResize_inherits(_default, _Component);
var _super = PreResize_createSuper(_default);
function _default() {
var _this;
PreResize_classCallCheck(this, _default);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
PreResize_defineProperty(PreResize_assertThisInitialized(_this), "state", {
isBlockRatio: false
});
PreResize_defineProperty(PreResize_assertThisInitialized(_this), "changeWidth", function (event) {
var isBlockRatio = _this.state.isBlockRatio;
var canvasDimensions = _this.props.canvasDimensions;
var width = event.target.value;
var height = canvasDimensions.height;
if (!isBlockRatio) height = width && width / canvasDimensions.ratio || 1;
_this.props.updateState({
canvasDimensions: PreResize_objectSpread(PreResize_objectSpread({}, canvasDimensions), {}, {
width: width,
height: height
})
});
});
PreResize_defineProperty(PreResize_assertThisInitialized(_this), "changeHeight", function (event) {
var isBlockRatio = _this.state.isBlockRatio;
var canvasDimensions = _this.props.canvasDimensions;
var height = event.target.value;
var width = canvasDimensions.width;
if (!isBlockRatio) width = height && height * canvasDimensions.ratio || 1;
_this.props.updateState({
canvasDimensions: PreResize_objectSpread(PreResize_objectSpread({}, canvasDimensions), {}, {
width: width,
height: height
})
});
});
PreResize_defineProperty(PreResize_assertThisInitialized(_this), "toggleRatio", function () {
_this.setState({
isBlockRatio: !_this.state.isBlockRatio
});
});
return _this;
}
PreResize_createClass(_default, [{
key: "componentDidMount",
value: function componentDidMount() {
var _this$props = this.props,
operations = _this$props.operations,
processWithCloudService = _this$props.processWithCloudService,
updateState = _this$props.updateState,
forceApplyOperations = _this$props.forceApplyOperations;
var operationIndex = operations.findIndex(function (_ref) {
var stack = _ref.stack;
return stack[0].name === 'resize';
});
if (operationIndex > -1 && processWithCloudService) {
operations.splice(operationIndex, 1);
updateState({
operations: operations
});
forceApplyOperations(operations, 'resize');
}
}
}, {
key: "render",
value: function render() {
var _this2 = this;
var isBlockRatio = this.state.isBlockRatio;
var _this$props2 = this.props,
canvasDimensions = _this$props2.canvasDimensions,
processWithCloudService = _this$props2.processWithCloudService,
onPreResize = _this$props2.onPreResize,
t = _this$props2.t;
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(PreResizeBox, {
id: "preview-img-box",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(PreResizeWarning, {
children: t['warning.too_big_resolution']
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(PreResizeInner, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("h4", {
children: t['pre_resize.title']
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(ResizeWrapper, {
children: /*#__PURE__*/Object(jsx_runtime["jsxs"])(ResizeBox, {
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])(FieldSet, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FieldLabel, {
children: t['common.width']
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
fullSize: true,
value: parseInt(canvasDimensions.width, 10) || '',
onChange: this.changeWidth
})]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(BlockRatioWrapper, {
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(BlockRatioBtn, {
active: !isBlockRatio,
style: processWithCloudService ? {
cursor: 'not-allowed'
} : {},
link: true,
onClick: function onClick() {
!processWithCloudService && _this2.toggleRatio();
},
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(BlockRatioIcon, {
active: !isBlockRatio,
style: processWithCloudService ? {
cursor: 'not-allowed'
} : {}
})
})
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(FieldSet, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FieldLabel, {
children: t['common.height']
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
fullSize: true,
value: parseInt(canvasDimensions.height, 10) || '',
onChange: this.changeHeight
})]
})]
})
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(PreResizeActions, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("p", {
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(Button, {
themeColor: true,
themeBtn: true,
onClick: function onClick() {
onPreResize('keep');
},
children: t['pre_resize.keep_original_resolution']
})
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("p", {
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(Button, {
themeColor: true,
success: true,
onClick: function onClick() {
onPreResize('resize');
},
children: t['pre_resize.resize_n_continue']
})
})]
})]
})]
});
}
}]);
return _default;
}(react["Component"]);
// CONCATENATED MODULE: ./src/components/Toolbar/Tool.js
function Tool_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Tool_typeof = function _typeof(obj) { return typeof obj; }; } else { Tool_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Tool_typeof(obj); }
function Tool_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function Tool_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function Tool_createClass(Constructor, protoProps, staticProps) { if (protoProps) Tool_defineProperties(Constructor.prototype, protoProps); if (staticProps) Tool_defineProperties(Constructor, staticProps); return Constructor; }
function Tool_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Tool_setPrototypeOf(subClass, superClass); }
function Tool_setPrototypeOf(o, p) { Tool_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Tool_setPrototypeOf(o, p); }
function Tool_createSuper(Derived) { var hasNativeReflectConstruct = Tool_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Tool_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Tool_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Tool_possibleConstructorReturn(this, result); }; }
function Tool_possibleConstructorReturn(self, call) { if (call && (Tool_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Tool_assertThisInitialized(self); }
function Tool_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function Tool_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function Tool_getPrototypeOf(o) { Tool_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Tool_getPrototypeOf(o); }
var Tool_default = /*#__PURE__*/function (_Component) {
Tool_inherits(_default, _Component);
var _super = Tool_createSuper(_default);
function _default() {
Tool_classCallCheck(this, _default);
return _super.apply(this, arguments);
}
Tool_createClass(_default, [{
key: "render",
value: function render() {
var _this$props = this.props,
name = _this$props.name,
activeTab = _this$props.activeTab,
updateState = _this$props.updateState,
t = _this$props.t;
var filteredName = name === 'rotate' ? 'orientation' : name;
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(ToolWrapper, {
active: activeTab === name,
onClick: function onClick() {
return updateState({
activeTab: name
});
},
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(ToolIcon, {
name: name
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(ToolLabel, {
children: t["toolbar.".concat(filteredName)]
})]
});
}
}]);
return _default;
}(react["Component"]);
// CONCATENATED MODULE: ./src/components/Toolbar/Effect.js
function Effect_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Effect_typeof = function _typeof(obj) { return typeof obj; }; } else { Effect_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Effect_typeof(obj); }
function Effect_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function Effect_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function Effect_createClass(Constructor, protoProps, staticProps) { if (protoProps) Effect_defineProperties(Constructor.prototype, protoProps); if (staticProps) Effect_defineProperties(Constructor, staticProps); return Constructor; }
function Effect_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Effect_setPrototypeOf(subClass, superClass); }
function Effect_setPrototypeOf(o, p) { Effect_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Effect_setPrototypeOf(o, p); }
function Effect_createSuper(Derived) { var hasNativeReflectConstruct = Effect_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Effect_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Effect_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Effect_possibleConstructorReturn(this, result); }; }
function Effect_possibleConstructorReturn(self, call) { if (call && (Effect_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Effect_assertThisInitialized(self); }
function Effect_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function Effect_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function Effect_getPrototypeOf(o) { Effect_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Effect_getPrototypeOf(o); }
var Effect_default = /*#__PURE__*/function (_Component) {
Effect_inherits(_default, _Component);
var _super = Effect_createSuper(_default);
function _default() {
Effect_classCallCheck(this, _default);
return _super.apply(this, arguments);
}
Effect_createClass(_default, [{
key: "render",
value: function render() {
var _this$props = this.props,
active = _this$props.active,
name = _this$props.name,
onApplyEffects = _this$props.onApplyEffects,
noCapitalStrs = _this$props.noCapitalStrs;
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(EffectWrapper, {
active: active === name,
onClick: onApplyEffects.bind(null, name),
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(EffectIcon, {
src: getIcon(name)
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(EffectLabel, {
noCapitalStrs: noCapitalStrs,
children: get_label_getLabel(name)
})]
});
}
}]);
return _default;
}(react["Component"]);
// CONCATENATED MODULE: ./src/components/Toolbar/Effects.js
function Effects_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Effects_typeof = function _typeof(obj) { return typeof obj; }; } else { Effects_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Effects_typeof(obj); }
function Effects_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function Effects_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function Effects_createClass(Constructor, protoProps, staticProps) { if (protoProps) Effects_defineProperties(Constructor.prototype, protoProps); if (staticProps) Effects_defineProperties(Constructor, staticProps); return Constructor; }
function Effects_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Effects_setPrototypeOf(subClass, superClass); }
function Effects_setPrototypeOf(o, p) { Effects_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Effects_setPrototypeOf(o, p); }
function Effects_createSuper(Derived) { var hasNativeReflectConstruct = Effects_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Effects_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Effects_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Effects_possibleConstructorReturn(this, result); }; }
function Effects_possibleConstructorReturn(self, call) { if (call && (Effects_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Effects_assertThisInitialized(self); }
function Effects_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function Effects_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function Effects_getPrototypeOf(o) { Effects_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Effects_getPrototypeOf(o); }
var Effects_default = /*#__PURE__*/function (_Component) {
Effects_inherits(_default, _Component);
var _super = Effects_createSuper(_default);
function _default() {
Effects_classCallCheck(this, _default);
return _super.apply(this, arguments);
}
Effects_createClass(_default, [{
key: "render",
value: function render() {
var _this$props = this.props,
onApplyEffects = _this$props.onApplyEffects,
effect = _this$props.effect,
noCapitalStrs = _this$props.noCapitalStrs;
return /*#__PURE__*/Object(jsx_runtime["jsx"])(EffectsWrapper, {
children: EFFECTS.map(function (name) {
return /*#__PURE__*/Object(jsx_runtime["jsx"])(Effect_default, {
active: effect,
name: name,
onApplyEffects: onApplyEffects,
noCapitalStrs: noCapitalStrs
}, name);
})
});
}
}]);
return _default;
}(react["Component"]);
// CONCATENATED MODULE: ./src/components/Toolbar/Filter.js
function Filter_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Filter_typeof = function _typeof(obj) { return typeof obj; }; } else { Filter_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Filter_typeof(obj); }
function Filter_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function Filter_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function Filter_createClass(Constructor, protoProps, staticProps) { if (protoProps) Filter_defineProperties(Constructor.prototype, protoProps); if (staticProps) Filter_defineProperties(Constructor, staticProps); return Constructor; }
function Filter_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Filter_setPrototypeOf(subClass, superClass); }
function Filter_setPrototypeOf(o, p) { Filter_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Filter_setPrototypeOf(o, p); }
function Filter_createSuper(Derived) { var hasNativeReflectConstruct = Filter_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Filter_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Filter_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Filter_possibleConstructorReturn(this, result); }; }
function Filter_possibleConstructorReturn(self, call) { if (call && (Filter_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Filter_assertThisInitialized(self); }
function Filter_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function Filter_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function Filter_getPrototypeOf(o) { Filter_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Filter_getPrototypeOf(o); }
var Filter_default = /*#__PURE__*/function (_Component) {
Filter_inherits(_default, _Component);
var _super = Filter_createSuper(_default);
function _default() {
Filter_classCallCheck(this, _default);
return _super.apply(this, arguments);
}
Filter_createClass(_default, [{
key: "render",
value: function render() {
var _this$props = this.props,
active = _this$props.active,
name = _this$props.name,
onApplyFilters = _this$props.onApplyFilters;
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(EffectWrapper, {
active: active === name,
onClick: onApplyFilters.bind(null, name),
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(EffectIcon, {
src: getIcon(name)
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(EffectLabel, {
children: get_label_getLabel(name)
})]
});
}
}]);
return _default;
}(react["Component"]);
// CONCATENATED MODULE: ./src/components/Toolbar/Filters.js
function Filters_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Filters_typeof = function _typeof(obj) { return typeof obj; }; } else { Filters_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Filters_typeof(obj); }
function Filters_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function Filters_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function Filters_createClass(Constructor, protoProps, staticProps) { if (protoProps) Filters_defineProperties(Constructor.prototype, protoProps); if (staticProps) Filters_defineProperties(Constructor, staticProps); return Constructor; }
function Filters_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Filters_setPrototypeOf(subClass, superClass); }
function Filters_setPrototypeOf(o, p) { Filters_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Filters_setPrototypeOf(o, p); }
function Filters_createSuper(Derived) { var hasNativeReflectConstruct = Filters_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Filters_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Filters_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Filters_possibleConstructorReturn(this, result); }; }
function Filters_possibleConstructorReturn(self, call) { if (call && (Filters_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Filters_assertThisInitialized(self); }
function Filters_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function Filters_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function Filters_getPrototypeOf(o) { Filters_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Filters_getPrototypeOf(o); }
var Filters_default = /*#__PURE__*/function (_Component) {
Filters_inherits(_default, _Component);
var _super = Filters_createSuper(_default);
function _default() {
Filters_classCallCheck(this, _default);
return _super.apply(this, arguments);
}
Filters_createClass(_default, [{
key: "render",
value: function render() {
var _this$props = this.props,
onApplyFilters = _this$props.onApplyFilters,
filter = _this$props.filter;
return /*#__PURE__*/Object(jsx_runtime["jsx"])(EffectsWrapper, {
children: FILTERS.map(function (name) {
return /*#__PURE__*/Object(jsx_runtime["jsx"])(Filter_default, {
active: filter,
name: name,
onApplyFilters: onApplyFilters
}, name);
})
});
}
}]);
return _default;
}(react["Component"]);
// CONCATENATED MODULE: ./src/components/Toolbar/Crop.js
function Crop_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Crop_typeof = function _typeof(obj) { return typeof obj; }; } else { Crop_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Crop_typeof(obj); }
function Crop_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function Crop_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function Crop_createClass(Constructor, protoProps, staticProps) { if (protoProps) Crop_defineProperties(Constructor.prototype, protoProps); if (staticProps) Crop_defineProperties(Constructor, staticProps); return Constructor; }
function Crop_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Crop_setPrototypeOf(subClass, superClass); }
function Crop_setPrototypeOf(o, p) { Crop_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Crop_setPrototypeOf(o, p); }
function Crop_createSuper(Derived) { var hasNativeReflectConstruct = Crop_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Crop_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Crop_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Crop_possibleConstructorReturn(this, result); }; }
function Crop_possibleConstructorReturn(self, call) { if (call && (Crop_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Crop_assertThisInitialized(self); }
function Crop_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function Crop_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function Crop_getPrototypeOf(o) { Crop_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Crop_getPrototypeOf(o); }
function Crop_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Crop_default = /*#__PURE__*/function (_Component) {
Crop_inherits(_default, _Component);
var _super = Crop_createSuper(_default);
function _default() {
var _this;
Crop_classCallCheck(this, _default);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
Crop_defineProperty(Crop_assertThisInitialized(_this), "state", {
aspectRatio: NaN,
activeRatio: 'custom'
});
Crop_defineProperty(Crop_assertThisInitialized(_this), "changeWidth", function (event) {
var initialZoom = _this.props.initialZoom;
window.scaleflexPlugins.cropperjs.setCropBoxData({
width: +event.target.value / initialZoom / window.scaleflexPlugins.zoom
});
});
Crop_defineProperty(Crop_assertThisInitialized(_this), "changeHeight", function (event) {
var initialZoom = _this.props.initialZoom;
window.scaleflexPlugins.cropperjs.setCropBoxData({
height: +event.target.value / initialZoom / window.scaleflexPlugins.zoom
});
});
Crop_defineProperty(Crop_assertThisInitialized(_this), "toggleRatio", function (event) {
event.preventDefault();
event.stopPropagation();
var cropDetails = _this.props.cropDetails;
var width = cropDetails.width,
height = cropDetails.height;
var aspectRatio = _this.state.aspectRatio;
aspectRatio = aspectRatio ? NaN : width / height;
window.scaleflexPlugins.cropperjs.setAspectRatio(aspectRatio);
window.scaleflexPlugins.cropperjs.setCropBoxData({
width: width / window.scaleflexPlugins.zoom,
height: height / window.scaleflexPlugins.zoom
});
_this.setState({
aspectRatio: aspectRatio
});
});
Crop_defineProperty(Crop_assertThisInitialized(_this), "changeRatio", function (box) {
var aspectRatio = _this.state.aspectRatio;
var _this$props = _this.props,
_this$props$original = _this$props.original,
_this$props$original$ = _this$props$original.width,
width = _this$props$original$ === void 0 ? 1 : _this$props$original$,
_this$props$original$2 = _this$props$original.height,
height = _this$props$original$2 === void 0 ? 1 : _this$props$original$2,
updateState = _this$props.updateState;
var value;
if (box.name === 'custom' && !aspectRatio) {
_this.setState({
activeRatio: box.name
});
return;
}
updateState({
roundCrop: box.name === 'round' || box.radius === 50
});
value = box.name === 'original' ? width / height : box.value;
window.scaleflexPlugins.cropperjs.setAspectRatio(value);
_this.setState({
activeRatio: box.name,
aspectRatio: value
});
});
return _this;
}
Crop_createClass(_default, [{
key: "componentDidMount",
value: function componentDidMount() {}
}, {
key: "render",
value: function render() {
var _this2 = this;
var _this$state = this.state,
aspectRatio = _this$state.aspectRatio,
activeRatio = _this$state.activeRatio;
var _this$props2 = this.props,
cropDetails = _this$props2.cropDetails,
original = _this$props2.original,
initialZoom = _this$props2.initialZoom,
t = _this$props2.t,
config = _this$props2.config;
var _config$cropPresets = config.cropPresets,
cropPresets = _config$cropPresets === void 0 ? [] : _config$cropPresets;
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(CropWrapper, {
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])(CropBox, {
active: activeRatio === 'custom',
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])(FieldSet, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FieldLabel, {
children: t['common.width']
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
dark: activeRatio === 'custom',
fullSize: true,
value: Math.round(cropDetails.width * initialZoom),
onChange: this.changeWidth
})]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(BlockRatioWrapper, {
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(BlockRatioBtn, {
active: aspectRatio,
link: true,
onClick: this.toggleRatio,
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(BlockRatioIcon, {
active: aspectRatio
})
})
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(FieldSet, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FieldLabel, {
children: t['common.height']
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
dark: activeRatio === 'custom',
fullSize: true,
value: Math.round(cropDetails.height * initialZoom),
onChange: this.changeHeight
})]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(CustomLabel, {
children: t['common.custom']
})]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(PresetsWrapper, {
children: cropPresets.map(function (box) {
return /*#__PURE__*/Object(jsx_runtime["jsx"])(CropBox, {
active: activeRatio === box.name,
onClick: function onClick() {
_this2.changeRatio(box);
},
children: /*#__PURE__*/Object(jsx_runtime["jsxs"])(CropBoxInner, {
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])(CropShapeWrapper, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(ShapeAligner, {}), /*#__PURE__*/Object(jsx_runtime["jsx"])(CropShape, {
ratio: box.value || original.width / original.height,
radius: box.radius
})]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(CropLabel, {
children: t["common.".concat(box.name)] || box.name
})]
})
}, box.name);
})
})]
});
}
}]);
return _default;
}(react["Component"]);
// CONCATENATED MODULE: ./src/components/Toolbar/Resize.js
function Resize_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Resize_typeof = function _typeof(obj) { return typeof obj; }; } else { Resize_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Resize_typeof(obj); }
function Resize_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function Resize_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { Resize_ownKeys(Object(source), true).forEach(function (key) { Resize_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { Resize_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function Resize_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function Resize_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function Resize_createClass(Constructor, protoProps, staticProps) { if (protoProps) Resize_defineProperties(Constructor.prototype, protoProps); if (staticProps) Resize_defineProperties(Constructor, staticProps); return Constructor; }
function Resize_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Resize_setPrototypeOf(subClass, superClass); }
function Resize_setPrototypeOf(o, p) { Resize_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Resize_setPrototypeOf(o, p); }
function Resize_createSuper(Derived) { var hasNativeReflectConstruct = Resize_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Resize_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Resize_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Resize_possibleConstructorReturn(this, result); }; }
function Resize_possibleConstructorReturn(self, call) { if (call && (Resize_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Resize_assertThisInitialized(self); }
function Resize_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function Resize_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function Resize_getPrototypeOf(o) { Resize_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Resize_getPrototypeOf(o); }
function Resize_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Resize_default = /*#__PURE__*/function (_Component) {
Resize_inherits(_default, _Component);
var _super = Resize_createSuper(_default);
function _default() {
var _this;
Resize_classCallCheck(this, _default);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
Resize_defineProperty(Resize_assertThisInitialized(_this), "state", {
isBlockRatio: false
});
Resize_defineProperty(Resize_assertThisInitialized(_this), "changeWidth", function (event) {
var isBlockRatio = _this.state.isBlockRatio;
var canvasDimensions = _this.props.canvasDimensions;
var width = event.target.value;
var height = canvasDimensions.height;
if (!isBlockRatio) height = width && width / canvasDimensions.ratio || 1;
_this.props.updateState({
canvasDimensions: Resize_objectSpread(Resize_objectSpread({}, canvasDimensions), {}, {
width: width,
height: height
})
});
});
Resize_defineProperty(Resize_assertThisInitialized(_this), "changeHeight", function (event) {
var isBlockRatio = _this.state.isBlockRatio;
var canvasDimensions = _this.props.canvasDimensions;
var height = event.target.value;
var width = canvasDimensions.width;
if (!isBlockRatio) width = height && height * canvasDimensions.ratio || 1;
_this.props.updateState({
canvasDimensions: Resize_objectSpread(Resize_objectSpread({}, canvasDimensions), {}, {
width: width,
height: height
})
});
});
Resize_defineProperty(Resize_assertThisInitialized(_this), "applyPreset", function (_ref) {
var width = _ref.width,
height = _ref.height;
_this.props.updateState({
canvasDimensions: {
ratio: width / height,
width: width,
height: height
}
});
});
Resize_defineProperty(Resize_assertThisInitialized(_this), "toggleRatio", function () {
_this.setState({
isBlockRatio: !_this.state.isBlockRatio
});
});
return _this;
}
Resize_createClass(_default, [{
key: "render",
value: function render() {
var _this2 = this;
var isBlockRatio = this.state.isBlockRatio;
var _this$props = this.props,
canvasDimensions = _this$props.canvasDimensions,
processWithCloudService = _this$props.processWithCloudService,
t = _this$props.t,
config = _this$props.config;
var _config$resizePresets = config.resizePresets,
resizePresets = _config$resizePresets === void 0 ? [] : _config$resizePresets;
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(ResizeWrapper, {
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])(ResizeBox, {
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])(FieldSet, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FieldLabel, {
children: t['common.width']
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
fullSize: true,
value: Math.round(canvasDimensions.width) || '',
onChange: this.changeWidth
})]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(BlockRatioWrapper, {
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(BlockRatioBtn, {
active: !isBlockRatio,
style: processWithCloudService ? {
cursor: 'not-allowed'
} : {},
link: true,
onClick: function onClick() {
!processWithCloudService && _this2.toggleRatio();
},
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(BlockRatioIcon, {
active: !isBlockRatio,
style: processWithCloudService ? {
cursor: 'not-allowed'
} : {}
})
})
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(FieldSet, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FieldLabel, {
children: t['common.height']
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
fullSize: true,
value: Math.round(canvasDimensions.height) || '',
onChange: this.changeHeight
})]
})]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(SuggestionsBox, {
children: resizePresets.filter(function (preset) {
return Math.abs(canvasDimensions.width / canvasDimensions.height - preset.ratio) < 0.05;
}).map(function (preset) {
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(SuggestionOption, {
onClick: function onClick() {
_this2.applyPreset(preset);
},
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
children: [preset.width, " x ", preset.height]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
children: preset.name
})]
}, preset.name);
})
})]
});
}
}]);
return _default;
}(react["Component"]);
// CONCATENATED MODULE: ./src/components/Range.js
function Range_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Range_typeof = function _typeof(obj) { return typeof obj; }; } else { Range_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Range_typeof(obj); }
var Range_templateObject;
function Range_taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
function Range_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function Range_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function Range_createClass(Constructor, protoProps, staticProps) { if (protoProps) Range_defineProperties(Constructor.prototype, protoProps); if (staticProps) Range_defineProperties(Constructor, staticProps); return Constructor; }
function Range_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Range_setPrototypeOf(subClass, superClass); }
function Range_setPrototypeOf(o, p) { Range_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Range_setPrototypeOf(o, p); }
function Range_createSuper(Derived) { var hasNativeReflectConstruct = Range_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Range_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Range_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Range_possibleConstructorReturn(this, result); }; }
function Range_possibleConstructorReturn(self, call) { if (call && (Range_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Range_assertThisInitialized(self); }
function Range_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function Range_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function Range_getPrototypeOf(o) { Range_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Range_getPrototypeOf(o); }
function Range_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Range_Range = /*#__PURE__*/function (_Component) {
Range_inherits(Range, _Component);
var _super = Range_createSuper(Range);
function Range(props) {
var _this;
Range_classCallCheck(this, Range);
_this = _super.call(this, props);
Range_defineProperty(Range_assertThisInitialized(_this), "updateWithDebounce", Object(index_umd["debounce"])(100, function (value) {
_this.props.updateRange(value);
}));
Range_defineProperty(Range_assertThisInitialized(_this), "updateRange", function (event) {
var nextValue = event.target.value;
_this.setState({
range: nextValue
}, function () {
_this.updateWithDebounce(nextValue);
});
});
_this.state = {
range: props.range
};
return _this;
}
Range_createClass(Range, [{
key: "componentDidUpdate",
value: function componentDidUpdate(_ref) {
var prevRange = _ref.range;
var range = this.props.range;
if (prevRange !== range && range !== this.state.range) {
this.setState({
range: range
});
}
}
}, {
key: "render",
value: function render() {
var range = this.state.range;
var _this$props = this.props;
var label = _this$props.label,
_this$props$min = _this$props.min,
min = _this$props$min === void 0 ? -100 : _this$props$min,
_this$props$max = _this$props.max,
max = _this$props$max === void 0 ? 100 : _this$props$max,
_this$props$step = _this$props.step,
step = _this$props$step === void 0 ? 1 : _this$props$step,
labelBefore = _this$props.labelBefore;
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(Range_Wrapper, {
className: "image-editor-range-wrapper",
labelBefore: labelBefore,
label: label,
children: [label && labelBefore && /*#__PURE__*/Object(jsx_runtime["jsx"])("label", {
children: label
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("input", {
id: "range",
type: "range",
value: range,
min: min,
max: max,
step: step,
onChange: this.updateRange
}), label && !labelBefore && /*#__PURE__*/Object(jsx_runtime["jsx"])("label", {
children: label
})]
});
}
}]);
return Range;
}(react["Component"]);
/* harmony default export */ var components_Range = (Range_Range);
var Range_Wrapper = Object(styled_components_browser_esm["b" /* default */])('div').attrs(function () {
return {
className: 'image-editor-range'
};
})(Range_templateObject || (Range_templateObject = Range_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n position: relative;\n padding: 25px 5px 20px 5px;\n}\n \n #filerobot-image-editor-root & label {\n display: inline-block;\n width: 100%;\n text-align: center;\n padding-top: ", ";\n color: ", ";\n }\n \n #filerobot-image-editor-root & :after {\n content: ", ";\n display: inline-block;\n position: absolute;\n background: ", ";\n height: 5px;\n width: 2px;\n top: 45px;\n left: calc(50% - 1px);\n }\n \n /* CHROME */\n \n #filerobot-image-editor-root & #range {\n -webkit-appearance: none;\n display: block;\n outline: none;\n background: ", ";\n height: 6px;\n width: 180px;\n border-radius: 5px;\n margin-bottom: 5px;\n }\n \n #filerobot-image-editor-root & #range::-webkit-slider-thumb {\n -webkit-appearance: none;\n width: 18px;\n height: 18px;\n border-radius: 50%;\n background: ", ";\n }\n \n /* FIREFOX */\n \n #filerobot-image-editor-root & #range::-moz-range-thumb {\n border: none;\n height: 14px;\n width: 14px;\n border-radius: 50%;\n background: ", ";\n cursor: pointer;\n }\n \n #filerobot-image-editor-root & #range::-moz-range-track {\n width: 100%;\n height: 3px;\n cursor: pointer;\n background: ", ";\n border-radius: 5px;\n }\n"])), function (p) {
return p.labelBefore ? 0 : '20px';
}, function (p) {
return p.theme.colors.text || '#ffffff';
}, function (p) {
return p.label ? '' : 'unset';
}, function (p) {
return p.theme.colors.text;
}, function (p) {
return p.theme.colors.accent || p.theme.colors.primaryBg;
}, function (p) {
return p.theme.colors.text;
}, function (p) {
return p.theme.colors.text;
}, function (p) {
return p.theme.colors.text;
});
// CONCATENATED MODULE: ./src/components/Toolbar/Orientation.js
function Orientation_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Orientation_typeof = function _typeof(obj) { return typeof obj; }; } else { Orientation_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Orientation_typeof(obj); }
function Orientation_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function Orientation_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function Orientation_createClass(Constructor, protoProps, staticProps) { if (protoProps) Orientation_defineProperties(Constructor.prototype, protoProps); if (staticProps) Orientation_defineProperties(Constructor, staticProps); return Constructor; }
function Orientation_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Orientation_setPrototypeOf(subClass, superClass); }
function Orientation_setPrototypeOf(o, p) { Orientation_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Orientation_setPrototypeOf(o, p); }
function Orientation_createSuper(Derived) { var hasNativeReflectConstruct = Orientation_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Orientation_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Orientation_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Orientation_possibleConstructorReturn(this, result); }; }
function Orientation_possibleConstructorReturn(self, call) { if (call && (Orientation_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Orientation_assertThisInitialized(self); }
function Orientation_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function Orientation_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function Orientation_getPrototypeOf(o) { Orientation_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Orientation_getPrototypeOf(o); }
function Orientation_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Orientation_default = /*#__PURE__*/function (_Component) {
Orientation_inherits(_default, _Component);
var _super = Orientation_createSuper(_default);
function _default() {
var _this;
Orientation_classCallCheck(this, _default);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
Orientation_defineProperty(Orientation_assertThisInitialized(_this), "leftRotate", function () {
var _this$props = _this.props,
onRotate = _this$props.onRotate,
correctionDegree = _this$props.correctionDegree,
flipX = _this$props.flipX,
flipY = _this$props.flipY;
onRotate(-90, parseInt(correctionDegree), flipX, flipY);
});
Orientation_defineProperty(Orientation_assertThisInitialized(_this), "rightRotate", function () {
var _this$props2 = _this.props,
onRotate = _this$props2.onRotate,
correctionDegree = _this$props2.correctionDegree,
flipX = _this$props2.flipX,
flipY = _this$props2.flipY;
onRotate(90, parseInt(correctionDegree), flipX, flipY);
});
Orientation_defineProperty(Orientation_assertThisInitialized(_this), "updateCorrectionDegree", function (value) {
var _this$props3 = _this.props,
flipX = _this$props3.flipX,
flipY = _this$props3.flipY;
_this.setState({
correctionDegree: value
});
_this.props.onRotate(0, parseFloat(value), flipX, flipY);
});
Orientation_defineProperty(Orientation_assertThisInitialized(_this), "onFlip", function (val) {
var _this$props4 = _this.props,
flipX = _this$props4.flipX,
flipY = _this$props4.flipY,
correctionDegree = _this$props4.correctionDegree;
var nextFlipXValue = val === 'x' ? !flipX : flipX;
var nextFlipYValue = val === 'y' ? !flipY : flipY;
_this.props.onRotate(0, correctionDegree, nextFlipXValue, nextFlipYValue);
});
return _this;
}
Orientation_createClass(_default, [{
key: "render",
value: function render() {
var _this2 = this;
var _this$props5 = this.props,
correctionDegree = _this$props5.correctionDegree,
t = _this$props5.t,
_this$props5$config = _this$props5.config,
config = _this$props5$config === void 0 ? {} : _this$props5$config;
var processWithCloudService = config.processWithCloudService;
return /*#__PURE__*/Object(jsx_runtime["jsx"])(OrientationWrapper, {
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(RotateWrapper, {
children: /*#__PURE__*/Object(jsx_runtime["jsxs"])(RotateButton, {
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])(ButtonGroup, {
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])(DarkBtn, {
onClick: this.leftRotate,
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(RotateIcon, {
name: "left-rotate"
}), " ", /*#__PURE__*/Object(jsx_runtime["jsx"])("span", {
children: t['orientation.rotate_l']
})]
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(DarkBtn, {
onClick: this.rightRotate,
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(RotateIcon, {
name: "right-rotate"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("span", {
children: t['orientation.rotate_r']
})]
}), !processWithCloudService && /*#__PURE__*/Object(jsx_runtime["jsxs"])(jsx_runtime["Fragment"], {
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])(DarkBtn, {
onClick: function onClick() {
_this2.onFlip('x');
},
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(RotateIcon, {
name: "flip-h"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("span", {
children: t['orientation.flip_h']
})]
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(DarkBtn, {
onClick: function onClick() {
_this2.onFlip('y');
},
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(RotateIcon, {
name: "flip-v"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("span", {
children: t['orientation.flip_v']
})]
})]
})]
}), !processWithCloudService && /*#__PURE__*/Object(jsx_runtime["jsxs"])("div", {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(components_Range, {
min: -30,
max: 30,
step: 0.5,
range: correctionDegree,
updateRange: this.updateCorrectionDegree
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])("svg", {
viewBox: "-90 -5 180 10",
xmlns: "http://www.w3.org/2000/svg",
"aria-hidden": "true",
focusable: "false",
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "-37.15555555555556",
cy: "0",
r: "0.2",
opacity: "0.8"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "-35.2",
cy: "0",
r: "0.2",
opacity: "0.6"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "-33.24444444444445",
cy: "0",
r: "0.2",
opacity: "0.4"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "-31.28888888888889",
cy: "0",
r: "0.2",
opacity: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "-29.333333333333336",
cy: "0",
r: "0.5"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("text", {
fill: "currentColor",
x: "-31.583333333333336",
y: "3.5",
children: "-30\xB0"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "-27.37777777777778",
cy: "0",
r: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "-25.422222222222224",
cy: "0",
r: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "-23.46666666666667",
cy: "0",
r: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "-21.51111111111112",
cy: "0",
r: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "-19.555555555555557",
cy: "0",
r: "0.5"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("text", {
fill: "currentColor",
x: "-21.805555555555557",
y: "3.5",
children: "-20\xB0"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "-17.60000000000001",
cy: "0",
r: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "-15.644444444444446",
cy: "0",
r: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "-13.688888888888897",
cy: "0",
r: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "-11.733333333333334",
cy: "0",
r: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "-9.777777777777786",
cy: "0",
r: "0.5"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("text", {
fill: "currentColor",
x: "-12.027777777777786",
y: "3.5",
children: "-10\xB0"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "-7.822222222222223",
cy: "0",
r: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "-5.866666666666674",
cy: "0",
r: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "-3.9111111111111114",
cy: "0",
r: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "-1.9555555555555628",
cy: "0",
r: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "0",
cy: "0",
r: "0.5"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("text", {
fill: "currentColor",
x: "-0.75",
y: "3.5",
children: "0\xB0"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "1.9555555555555486",
cy: "0",
r: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "3.9111111111111114",
cy: "0",
r: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "5.86666666666666",
cy: "0",
r: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "7.822222222222223",
cy: "0",
r: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "9.777777777777771",
cy: "0",
r: "0.5"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("text", {
fill: "currentColor",
x: "8.277777777777771",
y: "3.5",
children: "10\xB0"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "11.733333333333334",
cy: "0",
r: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "13.688888888888883",
cy: "0",
r: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "15.644444444444446",
cy: "0",
r: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "17.599999999999994",
cy: "0",
r: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "19.555555555555557",
cy: "0",
r: "0.5"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("text", {
fill: "currentColor",
x: "18.055555555555557",
y: "3.5",
children: "20\xB0"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "21.511111111111106",
cy: "0",
r: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "23.46666666666667",
cy: "0",
r: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "25.422222222222217",
cy: "0",
r: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "27.37777777777778",
cy: "0",
r: "0.2"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "29.33333333333333",
cy: "0",
r: "0.5"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("text", {
fill: "currentColor",
x: "27.83333333333333",
y: "3.5",
children: "30\xB0"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "31.28888888888889",
cy: "0",
r: "0.2",
opacity: "0.8"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "33.24444444444444",
cy: "0",
r: "0.2",
opacity: "0.6"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "35.2",
cy: "0",
r: "0.2",
opacity: "0.4"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("circle", {
fill: "currentColor",
cx: "37.15555555555555",
cy: "0",
r: "0.2",
opacity: "0.2"
})]
})]
})]
})
})
});
}
}]);
return _default;
}(react["Component"]);
// CONCATENATED MODULE: ./src/components/Toolbar/Adjust.js
function Adjust_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Adjust_typeof = function _typeof(obj) { return typeof obj; }; } else { Adjust_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Adjust_typeof(obj); }
function Adjust_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function Adjust_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function Adjust_createClass(Constructor, protoProps, staticProps) { if (protoProps) Adjust_defineProperties(Constructor.prototype, protoProps); if (staticProps) Adjust_defineProperties(Constructor, staticProps); return Constructor; }
function Adjust_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Adjust_setPrototypeOf(subClass, superClass); }
function Adjust_setPrototypeOf(o, p) { Adjust_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Adjust_setPrototypeOf(o, p); }
function Adjust_createSuper(Derived) { var hasNativeReflectConstruct = Adjust_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Adjust_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Adjust_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Adjust_possibleConstructorReturn(this, result); }; }
function Adjust_possibleConstructorReturn(self, call) { if (call && (Adjust_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Adjust_assertThisInitialized(self); }
function Adjust_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function Adjust_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function Adjust_getPrototypeOf(o) { Adjust_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Adjust_getPrototypeOf(o); }
function Adjust_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Adjust_default = /*#__PURE__*/function (_Component) {
Adjust_inherits(_default, _Component);
var _super = Adjust_createSuper(_default);
function _default() {
var _this;
Adjust_classCallCheck(this, _default);
_this = _super.call(this);
Adjust_defineProperty(Adjust_assertThisInitialized(_this), "updateBrightness", function (value) {
_this.onAdjust('brightness', value);
});
Adjust_defineProperty(Adjust_assertThisInitialized(_this), "updateContrast", function (value) {
_this.onAdjust('contrast', value);
});
Adjust_defineProperty(Adjust_assertThisInitialized(_this), "updateExposure", function (value) {
_this.onAdjust('exposure', value);
});
Adjust_defineProperty(Adjust_assertThisInitialized(_this), "updateSaturation", function (value) {
_this.onAdjust('saturation', value);
});
Adjust_defineProperty(Adjust_assertThisInitialized(_this), "onAdjust", function (type, value) {
_this.setState(Adjust_defineProperty({}, type, value));
_this.props.onAdjust(type, value);
});
_this.state = {
brightness: 0,
contrast: 0,
exposure: 0,
saturation: 0
};
return _this;
}
Adjust_createClass(_default, [{
key: "render",
value: function render() {
var t = this.props.t;
var _this$state = this.state,
brightness = _this$state.brightness,
contrast = _this$state.contrast,
exposure = _this$state.exposure,
saturation = _this$state.saturation;
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(AdjustWrapper, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(components_Range, {
label: t['adjust.brightness'],
range: brightness,
updateRange: this.updateBrightness,
min: -40,
max: 40
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(components_Range, {
label: t['adjust.contrast'],
range: contrast,
updateRange: this.updateContrast,
min: -40,
max: 40
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(components_Range, {
label: t['adjust.exposure'],
range: exposure,
updateRange: this.updateExposure,
min: -40,
max: 40
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(components_Range, {
label: t['adjust.saturation'],
range: saturation,
updateRange: this.updateSaturation
//min: -40,
//max: 40
})]
});
}
}]);
return _default;
}(react["Component"]);
// CONCATENATED MODULE: ./src/components/Shared/Select.js
function Select_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Select_typeof = function _typeof(obj) { return typeof obj; }; } else { Select_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Select_typeof(obj); }
var Select_templateObject, Select_templateObject2, Select_templateObject3, Select_templateObject4, Select_templateObject5, Select_templateObject6;
function Select_taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
function Select_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function Select_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function Select_createClass(Constructor, protoProps, staticProps) { if (protoProps) Select_defineProperties(Constructor.prototype, protoProps); if (staticProps) Select_defineProperties(Constructor, staticProps); return Constructor; }
function Select_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Select_setPrototypeOf(subClass, superClass); }
function Select_setPrototypeOf(o, p) { Select_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Select_setPrototypeOf(o, p); }
function Select_createSuper(Derived) { var hasNativeReflectConstruct = Select_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Select_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Select_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Select_possibleConstructorReturn(this, result); }; }
function Select_possibleConstructorReturn(self, call) { if (call && (Select_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Select_assertThisInitialized(self); }
function Select_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function Select_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function Select_getPrototypeOf(o) { Select_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Select_getPrototypeOf(o); }
function Select_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Select_Select = /*#__PURE__*/function (_Component) {
Select_inherits(Select, _Component);
var _super = Select_createSuper(Select);
function Select() {
var _this;
Select_classCallCheck(this, Select);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
Select_defineProperty(Select_assertThisInitialized(_this), "state", {
isOpened: false
});
Select_defineProperty(Select_assertThisInitialized(_this), "getValue", function (value) {
var _this$props = _this.props,
list = _this$props.list,
_this$props$placehold = _this$props.placeholder,
placeholder = _this$props$placehold === void 0 ? 'select' : _this$props$placehold,
_this$props$valueProp = _this$props.valueProp,
valueProp = _this$props$valueProp === void 0 ? "id" : _this$props$valueProp,
_this$props$labelProp = _this$props.labelProp,
labelProp = _this$props$labelProp === void 0 ? "label" : _this$props$labelProp,
renderLabel = _this$props.renderLabel,
processValue = _this$props.processValue;
var label;
var item = list.find(function (item) {
return item[valueProp] === value;
});
label = processValue ? processValue(item, value, list, valueProp, labelProp) : item && (item[labelProp] && renderLabel ? renderLabel(item[labelProp]) : item[labelProp]);
return label ? label : "".concat(placeholder);
});
Select_defineProperty(Select_assertThisInitialized(_this), "toggleMenu", function () {
var nexVal = !_this.state.isOpened;
if (nexVal) {
_this.onOutsideClick = function (e) {
if (e.keyCode === 27) _this.toggleMenu();
};
document.addEventListener('keyup', _this.onOutsideClick);
document.addEventListener('mouseup', _this.handleOutsideMouseClick);
document.addEventListener('touchstart', _this.handleOutsideMouseClick);
} else {
document.removeEventListener('keyup', _this.onOutsideClick);
document.removeEventListener('mouseup', _this.handleOutsideMouseClick);
document.removeEventListener('touchstart', _this.handleOutsideMouseClick);
}
_this.setState({
isOpened: nexVal
});
});
Select_defineProperty(Select_assertThisInitialized(_this), "handleOutsideMouseClick", function (event) {
var target = event.target;
if (!_this.dropdown) return;else if (_this.selectedItem && _this.selectedItem.contains(target)) return;
if (_this.dropdown.contains(target)) {
event.stopPropagation();
return;
}
_this.setState({
isOpened: false
});
});
Select_defineProperty(Select_assertThisInitialized(_this), "onItemClick", function (event, id) {
var _this$props2 = _this.props,
onChange = _this$props2.onChange,
onBlur = _this$props2.onBlur;
onChange(id, event);
if (onBlur) onBlur(id);
_this.setState({
isOpened: false
});
});
Select_defineProperty(Select_assertThisInitialized(_this), "filterList", function (list) {
var _this$props3 = _this.props,
exclude = _this$props3.exclude,
_this$props3$valuePro = _this$props3.valueProp,
valueProp = _this$props3$valuePro === void 0 ? 'id' : _this$props3$valuePro;
if (exclude && exclude.length) return list.filter(function (item) {
return !exclude.includes(item[valueProp]);
});
return list;
});
return _this;
}
Select_createClass(Select, [{
key: "componentWillUnmount",
value: function componentWillUnmount() {
document.removeEventListener('keyup', this.onOutsideClick);
document.removeEventListener('mouseup', this.onOutsideClick);
document.removeEventListener('touchstart', this.onOutsideClick);
document.removeEventListener('mouseup', this.handleOutsideMouseClick);
document.removeEventListener('touchstart', this.handleOutsideMouseClick);
}
}, {
key: "render",
value: function render() {
var _this2 = this;
var isOpened = this.state.isOpened;
var _this$props4 = this.props,
value = _this$props4.value,
list = _this$props4.list,
_this$props4$valuePro = _this$props4.valueProp,
valueProp = _this$props4$valuePro === void 0 ? 'id' : _this$props4$valuePro,
_this$props4$labelPro = _this$props4.labelProp,
labelProp = _this$props4$labelPro === void 0 ? 'label' : _this$props4$labelPro,
renderLabel = _this$props4.renderLabel,
_this$props4$width = _this$props4.width,
width = _this$props4$width === void 0 ? '' : _this$props4$width,
_this$props4$styles = _this$props4.styles,
styles = _this$props4$styles === void 0 ? {} : _this$props4$styles,
display = _this$props4.display,
style = _this$props4.style,
_this$props4$labelDes = _this$props4.labelDescription,
labelDescription = _this$props4$labelDes === void 0 ? '' : _this$props4$labelDes,
size = _this$props4.size,
_this$props4$small = _this$props4.small,
small = _this$props4$small === void 0 ? false : _this$props4$small,
_this$props4$notRelat = _this$props4.notRelativePosition,
notRelativePosition = _this$props4$notRelat === void 0 ? false : _this$props4$notRelat;
var getLabel = function getLabel(item) {
return item[labelProp] && renderLabel ? renderLabel(item[labelProp]) : item[labelProp];
};
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(SelectWrapper, {
width: width,
display: display,
styles: styles,
style: style,
notRelativePosition: notRelativePosition,
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])(SelectedItem, {
as: "div",
small: small,
size: size,
styles: styles,
focused: isOpened,
notSelected: !value,
onClick: this.toggleMenu,
ref: function ref(node) {
_this2.selectedItem = node;
},
relativePosition: notRelativePosition,
children: [this.getValue(value), " ", labelDescription ? "(".concat(labelDescription, ")") : '']
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(SelectDropdown, {
size: size,
show: isOpened && this.filterList(list).length,
ref: function ref(node) {
_this2.dropdown = node;
},
limitedWidth: notRelativePosition,
children: this.filterList(list).map(function (item) {
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(SelectDropdownItem, {
size: size,
onClick: function onClick(event) {
_this2.onItemClick(event, item[valueProp]);
},
children: [item.color && /*#__PURE__*/Object(jsx_runtime["jsx"])(ItemIcon, {
color: item.color
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(ItemName, {
children: getLabel(item)
})]
}, item[valueProp]);
})
})]
});
}
}]);
return Select;
}(react["Component"]);
var SelectWrapper = styled_components_browser_esm["b" /* default */].div(Select_templateObject || (Select_templateObject = Select_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n ", ";\n display: ", ";\n width: ", ";\n text-align: ", ";\n max-width: 400px;\n}\n"])), function (p) {
return !p.notRelativePosition && "position: relative;";
}, function (p) {
return p.display ? p.display : p.width ? 'inline-block' : 'block';
}, function (p) {
return p.width || 'auto';
}, function (p) {
return p.styles.textAlign ? p.styles.textAlign : 'left';
});
var SelectedItem = Object(styled_components_browser_esm["b" /* default */])(FileInput).attrs()(Select_templateObject2 || (Select_templateObject2 = Select_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n width: 100%;\n padding: 9px 12px;\n cursor: pointer;\n}\n #filerobot-image-editor-root ", "\n \n &:hover {\n opacity: ", ";\n }\n #filerobot-image-editor-root & :after {\n content: '';\n position: absolute;\n top: 50%;\n margin-top: -2.5px;\n right: 5px;\n width: 0; \n height: 0; \n border-left: 5px solid transparent;\n border-right: 5px solid transparent;\n \n border-top: 5px solid #fff;\n }\n"])), function (p) {
return p.relativePosition && "position: relative;";
}, function (p) {
return p.styles.opacity && 1;
});
var SelectDropdown = styled_components_browser_esm["b" /* default */].ul(Select_templateObject3 || (Select_templateObject3 = Select_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: ", ";\n list-style-type: none;\n margin: 2px 0 0 0;\n padding: 0;\n position: absolute;\n width: ", ";\n border: none;\n color: ", ";\n background: ", ";\n box-shadow: inset 0 1px 1px rgba(0,0,0,0.5), 0 1px 0 rgba(82,104,109,.6);\n border-radius: .25rem;\n overflow: hidden;\n overflow-y: auto;\n max-height: ", ";\n z-index: 101000000000000;\n}\n\n @media (max-width: 600px) {\n#filerobot-image-editor-root & {\n position: relative;\n max-height: ", "\n}\n }\n"])), function (p) {
return p.show ? "block" : "none";
}, function (p) {
return p.limitedWidth ? '111px' : '100%';
}, function (p) {
return p.theme.colors.text;
}, function (p) {
return p.theme.colors.primaryBg || '#fff';
}, function (p) {
return p.size === 'sm' ? '250px' : '200px';
}, function (p) {
return p.show ? '120px' : '0';
});
var SelectDropdownItem = styled_components_browser_esm["b" /* default */].li(Select_templateObject4 || (Select_templateObject4 = Select_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n cursor: pointer;\n ", ";\n}\n \n #filerobot-image-editor-root &:hover {\n background: ", ";\n }\n"])), function (p) {
return getItemStyles(p.size);
}, function (p) {
return p.theme.colors.primaryBg;
});
var getItemStyles = function getItemStyles(size) {
switch (size) {
case 'sm':
return 'padding: .2rem .6rem; font-size: 12px;';
case 'md':
return 'padding: .3rem .7rem; font-size: 12px;';
default:
return 'padding: .375rem .75rem; font-size: 14px;';
}
};
var ItemName = styled_components_browser_esm["b" /* default */].span(Select_templateObject5 || (Select_templateObject5 = Select_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: inline-block;\n vertical-align: middle;\n white-space: break-spaces;\n}\n"])));
var ItemIcon = styled_components_browser_esm["b" /* default */].span(Select_templateObject6 || (Select_templateObject6 = Select_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n background: ", ";\n width: 14px;\n height: 14px;\n display: inline-block;\n vertical-align: middle;\n margin-right: 3px;\n background-size: cover;\n}\n"])), function (p) {
return p.color ? p.color : 'transparent';
});
/* harmony default export */ var Shared_Select = (Select_Select);
// CONCATENATED MODULE: ./src/components/Toolbar/Watermark.js
function Watermark_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Watermark_typeof = function _typeof(obj) { return typeof obj; }; } else { Watermark_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Watermark_typeof(obj); }
function Watermark_slicedToArray(arr, i) { return Watermark_arrayWithHoles(arr) || Watermark_iterableToArrayLimit(arr, i) || Watermark_unsupportedIterableToArray(arr, i) || Watermark_nonIterableRest(); }
function Watermark_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function Watermark_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return Watermark_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Watermark_arrayLikeToArray(o, minLen); }
function Watermark_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function Watermark_iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function Watermark_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function Watermark_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function Watermark_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { Watermark_ownKeys(Object(source), true).forEach(function (key) { Watermark_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { Watermark_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function Watermark_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function Watermark_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function Watermark_createClass(Constructor, protoProps, staticProps) { if (protoProps) Watermark_defineProperties(Constructor.prototype, protoProps); if (staticProps) Watermark_defineProperties(Constructor, staticProps); return Constructor; }
function Watermark_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Watermark_setPrototypeOf(subClass, superClass); }
function Watermark_setPrototypeOf(o, p) { Watermark_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Watermark_setPrototypeOf(o, p); }
function Watermark_createSuper(Derived) { var hasNativeReflectConstruct = Watermark_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Watermark_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Watermark_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Watermark_possibleConstructorReturn(this, result); }; }
function Watermark_possibleConstructorReturn(self, call) { if (call && (Watermark_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Watermark_assertThisInitialized(self); }
function Watermark_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function Watermark_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function Watermark_getPrototypeOf(o) { Watermark_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Watermark_getPrototypeOf(o); }
function Watermark_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Watermark_default = /*#__PURE__*/function (_Component) {
Watermark_inherits(_default, _Component);
var _super = Watermark_createSuper(_default);
function _default(props) {
var _urls, _urls$;
var _this;
Watermark_classCallCheck(this, _default);
_this = _super.call(this, props);
Watermark_defineProperty(Watermark_assertThisInitialized(_this), "changeOpacity", function (opacity) {
_this.updateWatermarkProperty({
opacity: opacity
});
});
Watermark_defineProperty(Watermark_assertThisInitialized(_this), "updateWatermarkProperty", function (data, shapeData, watermarkObjectData) {
var _this$props = _this.props,
shapeOperations = _this$props.shapeOperations,
_this$props$watermark = _this$props.watermark.lockScaleToPercentage,
lockScaleToPercentage = _this$props$watermark === void 0 ? 0 : _this$props$watermark;
if (!shapeData) {
shapeData = data;
}
if (!watermarkObjectData) {
watermarkObjectData = data;
}
var watermark = _this.getWatermarkLayer() || {};
_this.setState(data, function () {
shapeOperations.addOrUpdate(Watermark_objectSpread(Watermark_objectSpread({}, shapeData), {}, {
lockScaleToPercentage: lockScaleToPercentage,
key: WATERMARK_UNIQUE_KEY,
index: watermark.index,
tab: 'watermark'
}), {
watermark: Watermark_objectSpread(Watermark_objectSpread({}, _this.props.watermark), watermarkObjectData)
});
});
});
Watermark_defineProperty(Watermark_assertThisInitialized(_this), "getWatermarkLayer", function () {
var shapeOperations = _this.props.shapeOperations;
return shapeOperations.getShape({
key: WATERMARK_UNIQUE_KEY
});
});
Watermark_defineProperty(Watermark_assertThisInitialized(_this), "changeURL", function (event) {
var shapeData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var nextValue = event.target.value;
if (_this.props.watermark.text) {
_this.initWatermarkImage(nextValue);
return;
}
var position = _this.state.position;
_this.updateWatermarkProperty({
url: nextValue,
position: position
}, Watermark_objectSpread({
img: nextValue,
position: position
}, shapeData), {
url: '',
text: false
});
});
Watermark_defineProperty(Watermark_assertThisInitialized(_this), "changeTextProperty", function (event) {
var updatedProperty = Watermark_defineProperty({}, event.target.name, event.target.value);
if (_this.props.watermark.text) {
_this.updateWatermarkProperty(updatedProperty);
return;
}
var _this$state = _this.state,
text = _this$state.text,
color = _this$state.color,
textSize = _this$state.textSize,
textFont = _this$state.textFont,
opacity = _this$state.opacity;
var newWatermarkData = Watermark_objectSpread({
text: text,
color: color,
textSize: textSize,
textFont: textFont,
opacity: opacity,
variant: SHAPES_VARIANTS.TEXT,
tab: 'watermark'
}, updatedProperty);
_this.updateWatermarkProperty(Watermark_objectSpread({}, updatedProperty), Watermark_objectSpread(Watermark_objectSpread({}, newWatermarkData), {}, {
resizingBox: true
}), {
text: Watermark_objectSpread(Watermark_objectSpread({}, _this.props.watermark.text), newWatermarkData)
});
});
Watermark_defineProperty(Watermark_assertThisInitialized(_this), "readFile", function (event) {
var config = _this.props.config; // Disable uploading file processing if it's through cloudimage
if (config.processWithCloudimage) return null;
var input = event.target;
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
_this.changeURL({
target: {
value: e.target.result
}
}, {
variant: SHAPES_VARIANTS.IMAGE
});
};
reader.readAsDataURL(input.files[0]);
}
});
Watermark_defineProperty(Watermark_assertThisInitialized(_this), "getWatermarkDimensionsByPosString", function (positionString, width, height) {
return getWatermarkSquaredPosition(positionString, get_canvas_node_getCanvasNode(_this.props.config.elementId), width, height);
});
Watermark_defineProperty(Watermark_assertThisInitialized(_this), "onPositionChange", function (value) {
var _ref = _this.getWatermarkLayer() || {},
width = _ref.width,
height = _ref.height;
if (!width && !height) {
return;
}
var _this$getWatermarkDim = _this.getWatermarkDimensionsByPosString(value, width, height),
_this$getWatermarkDim2 = Watermark_slicedToArray(_this$getWatermarkDim, 4),
x = _this$getWatermarkDim2[0],
y = _this$getWatermarkDim2[1],
scaledWidth = _this$getWatermarkDim2[2],
scaledHeight = _this$getWatermarkDim2[3];
_this.updateWatermarkProperty({
position: value,
width: scaledWidth,
height: scaledHeight
}, {
x: x,
y: y,
width: scaledWidth,
height: scaledHeight
}, {
position: value,
x: x,
y: y,
width: scaledWidth,
height: scaledHeight
});
});
Watermark_defineProperty(Watermark_assertThisInitialized(_this), "initWatermarkImage", Object(index_umd["debounce"])(500, function (url) {
var updateState = _this.props.updateState;
var logoImage = null;
updateState({
isShowSpinner: true
});
var watermarkImageState = function watermarkImageState(newImage) {
return {
logoImage: newImage,
isShowSpinner: false,
watermark: Watermark_objectSpread(Watermark_objectSpread({}, _this.props.watermark), {}, {
url: newImage.src
})
};
};
if (url) {
var _this$props2 = _this.props,
shapeOperations = _this$props2.shapeOperations,
_this$props2$watermar = _this$props2.watermark,
_this$props2$watermar2 = _this$props2$watermar.lockScaleToPercentage,
lockScaleToPercentage = _this$props2$watermar2 === void 0 ? 0 : _this$props2$watermar2,
position = _this$props2$watermar.position;
var opacity = _this.state.opacity;
logoImage = new Image();
logoImage.setAttribute('crossOrigin', 'Anonymous');
logoImage.onload = function () {
var imageFilter = _this.props.watermark.imageFilter;
var watermarkImageStateObj;
if (imageFilter && typeof imageFilter === 'function') {
logoImage.onload = null;
watermarkImageStateObj = watermarkImageState(imageFilter(logoImage));
} else {
watermarkImageStateObj = watermarkImageState(logoImage);
}
var index = (_this.getWatermarkLayer() || {}).index;
var _this$getWatermarkDim3 = _this.getWatermarkDimensionsByPosString(position, logoImage.width, logoImage.height),
_this$getWatermarkDim4 = Watermark_slicedToArray(_this$getWatermarkDim3, 4),
x = _this$getWatermarkDim4[0],
y = _this$getWatermarkDim4[1],
width = _this$getWatermarkDim4[2],
height = _this$getWatermarkDim4[3];
shapeOperations.addOrUpdate({
img: logoImage,
opacity: opacity,
index: index,
x: x,
y: y,
width: width,
height: height,
variant: SHAPES_VARIANTS.IMAGE,
key: WATERMARK_UNIQUE_KEY,
tab: 'watermark',
lockScaleToPercentage: lockScaleToPercentage
}, watermarkImageStateObj);
};
logoImage.onerror = function () {
updateState({
isShowSpinner: false
});
};
if (url.match(/^https?:\/\/./)) {
// if the url is a HTTP URL add a cache breaker
logoImage.src = url + '?' + new Date().getTime();
} else {
logoImage.src = url;
}
} else {
updateState({
isShowSpinner: false
});
}
}));
Watermark_defineProperty(Watermark_assertThisInitialized(_this), "showWatermarkList", function () {
_this.setState({
showWaterMarkList: true
});
});
Watermark_defineProperty(Watermark_assertThisInitialized(_this), "hideWatermarkList", function () {
_this.setState({
showWaterMarkList: false
});
});
Watermark_defineProperty(Watermark_assertThisInitialized(_this), "onChangeWatermark", function (url) {
_this.changeURL({
target: {
value: url
}
});
_this.hideWatermarkList();
});
Watermark_defineProperty(Watermark_assertThisInitialized(_this), "handleInputTypeChange", function (_ref2) {
var target = _ref2.target;
var _this$props3 = _this.props,
updateState = _this$props3.updateState,
config = _this$props3.config;
updateState({
isShowSpinner: true
});
_this.setState({
selectedInputType: target.value
});
if (target.value === 'text') {
_this.changeTextProperty({
target: {
name: 'text',
value: (config.watermark || {}).defaultText || 'Your text'
}
});
updateState({
isShowSpinner: false
});
} else {
updateState({
watermark: Watermark_objectSpread(Watermark_objectSpread({}, _this.props.watermark), {}, {
text: null
})
});
_this.initWatermarkImage(_this.props.watermark.url || '');
}
});
var _props$watermark = props.watermark,
_opacity = _props$watermark.opacity,
_position = _props$watermark.position,
_url = _props$watermark.url,
applyByDefault = _props$watermark.applyByDefault,
activePositions = _props$watermark.activePositions,
handleOpacity = _props$watermark.handleOpacity;
var _props$watermark2 = props.watermark,
urls = _props$watermark2.urls,
fonts = _props$watermark2.fonts;
var setActivePositions = [];
var activePosition = _position || 'right-top'; // check if a preset was selected
if (typeof activePositions === 'string' && WATERMARK_POSITIONS_PRESET.hasOwnProperty(activePositions)) {
setActivePositions = WATERMARK_POSITIONS_PRESET[activePositions];
} // check if activePositons is an array
else if (Array.isArray(activePositions)) {
var fullPos = Array(9).fill(0); // merge with an default of 9 to prevent errors when the length is lower 9
activePositions.map(function (val, i) {
return fullPos[i] = val;
});
setActivePositions = fullPos; // return the default that all positions are active
} else {
setActivePositions = Array(9).fill(1);
} // check if position is active else set the first upcomming active as the new active position
if (setActivePositions[WATERMARK_POSITIONS.indexOf(activePosition)] !== 1) {
activePosition = WATERMARK_POSITIONS[setActivePositions.indexOf(1)];
}
if (urls) {
urls = urls.map(function () {
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
if (typeof url === 'string') {
var splittedURL = url.split('/');
return {
url: url,
label: splittedURL[splittedURL.length - 1]
};
} else {
return url;
}
});
}
_this.initWatermarkImage(_url || ((_urls = urls) === null || _urls === void 0 ? void 0 : (_urls$ = _urls[0]) === null || _urls$ === void 0 ? void 0 : _urls$.url));
_this.state = {
isBlockRatio: false,
opacity: _opacity || 0.7,
handleOpacity: typeof handleOpacity === 'boolean' ? handleOpacity : true,
position: activePosition,
url: _url || (urls && urls.length > 1 ? urls[0] && urls[0].url : ''),
urls: urls || [],
activePositions: setActivePositions,
isWatermarkList: urls && urls.length > 1,
applyByDefault: applyByDefault || false,
showWaterMarkList: false,
selectedInputType: urls && urls.length > 1 ? 'gallery' : 'text',
text: '',
color: '#000000',
textSize: 62,
textFont: 'Arial',
fonts: fonts || _this.props.config.theme.fonts
};
return _this;
}
Watermark_createClass(_default, [{
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
var nextProps = this.props; // check if position has ben modified and update
if (nextProps.watermark.position !== this.state.position) {
this.onPositionChange(this.state.position);
}
if (nextProps.watermark.applyByDefault !== prevProps.watermark.applyByDefault) {
if (this.getWatermarkLayer()) {
this.updateWatermarkProperty({
applyByDefault: false
}, {
hidden: true,
resizingBox: false
}, {
applyByDefault: false
});
} else {
this.setState({
applyByDefault: nextProps.watermark.applyByDefault
});
}
if (nextProps.watermark.applyByDefault) {
if (!this.getWatermarkLayer()) {
this.initWatermarkImage(nextProps.watermark.url);
} else {
this.updateWatermarkProperty({
applyByDefault: true
}, {
hidden: false,
resizingBox: true
}, {
applyByDefault: true
});
}
}
}
}
}, {
key: "render",
value: function render() {
var _this2 = this;
var _this$state2 = this.state,
isWatermarkList = _this$state2.isWatermarkList,
url = _this$state2.url,
urls = _this$state2.urls,
opacity = _this$state2.opacity,
handleOpacity = _this$state2.handleOpacity,
position = _this$state2.position,
activePositions = _this$state2.activePositions,
applyByDefault = _this$state2.applyByDefault,
showWaterMarkList = _this$state2.showWaterMarkList,
selectedInputType = _this$state2.selectedInputType,
text = _this$state2.text,
color = _this$state2.color,
textFont = _this$state2.textFont,
textSize = _this$state2.textSize,
fonts = _this$state2.fonts;
var config = this.props.config;
var fileUploadInput = selectedInputType === 'upload';
var galleryInput = selectedInputType === 'gallery';
var urlInput = selectedInputType === 'url';
var textInput = selectedInputType === 'text';
var t = this.props.t;
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(WatermarkWrapper, {
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])(WatermarkInputTypes, {
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])("label", {
children: [t['common.gallery'], /*#__PURE__*/Object(jsx_runtime["jsx"])("input", {
type: "radio",
value: "gallery",
checked: selectedInputType === 'gallery',
onChange: this.handleInputTypeChange
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("span", {})]
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])("label", {
style: {
cursor: config.processWithCloudimage ? 'not-allowed' : undefined
},
children: [t['common.upload'], /*#__PURE__*/Object(jsx_runtime["jsx"])("input", {
type: "radio",
value: "upload",
checked: selectedInputType === 'upload',
disabled: config.processWithCloudimage,
onChange: !config.processWithCloudimage ? this.handleInputTypeChange : undefined
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("span", {})]
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])("label", {
children: [t['common.url'], /*#__PURE__*/Object(jsx_runtime["jsx"])("input", {
type: "radio",
value: "url",
checked: selectedInputType === 'url',
onChange: this.handleInputTypeChange
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("span", {})]
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])("label", {
children: [t['common.text'], /*#__PURE__*/Object(jsx_runtime["jsx"])("input", {
type: "radio",
value: "text",
checked: selectedInputType === 'text',
onChange: this.handleInputTypeChange
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("span", {})]
})]
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(WatermarkInputs, {
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])(WrapperForURL, {
children: [galleryInput && /*#__PURE__*/Object(jsx_runtime["jsxs"])(jsx_runtime["Fragment"], {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("label", {
htmlFor: "url",
children: "Watermark Gallery"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Shared_Select, {
width: "100%",
list: urls,
valueProp: "url",
id: "gallery",
value: url,
style: {
width: 'calc(100% - 120px)'
},
onChange: function onChange(url) {
_this2.changeURL({
target: {
value: url
}
});
}
})]
}), urlInput && /*#__PURE__*/Object(jsx_runtime["jsxs"])(jsx_runtime["Fragment"], {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("label", {
htmlFor: "url",
children: "Watermark URL"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
id: "url",
value: url,
style: {
width: 'calc(100% - 120px)'
},
onChange: this.changeURL
})]
}), fileUploadInput && /*#__PURE__*/Object(jsx_runtime["jsxs"])(jsx_runtime["Fragment"], {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("label", {
htmlFor: "image-upload",
children: "Watermark Image"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FileInput, {
id: "image-upload",
style: {
width: 'calc(100% - 120px)'
},
onChange: this.readFile
})]
}), textInput && /*#__PURE__*/Object(jsx_runtime["jsxs"])(jsx_runtime["Fragment"], {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("label", {
htmlFor: "text",
children: "Watermark Text"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
id: "text",
value: text,
style: {
width: 'calc(65% - 135px)',
minWidth: 120
},
name: "text",
onChange: this.changeTextProperty
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Shared_Select, {
list: config.processWithCloudimage ? WATERMARK_CLOUDIMAGE_FONTS : fonts,
valueProp: "value",
id: "textFont",
value: textFont,
style: {
width: 111,
display: 'inline-block',
marginLeft: 8
},
onChange: function onChange(value) {
return _this2.changeTextProperty({
target: {
name: 'textFont',
value: value
}
});
}
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
value: textSize,
type: "number",
name: "textSize",
style: {
width: 60,
marginLeft: 8
},
onChange: this.changeTextProperty
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
value: color,
type: "color",
style: {
width: 30,
marginLeft: 8,
padding: 0,
background: 'transparent',
boxShadow: 'none'
},
name: "color",
onChange: this.changeTextProperty
})]
})]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(WrapperForControls, {
switcherPosition: handleOpacity ? 'right' : 'left',
children: handleOpacity && /*#__PURE__*/Object(jsx_runtime["jsxs"])(WrapperForOpacity, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("label", {
htmlFor: "opacity",
style: {
minWidth: 80
},
children: "Opacity"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(components_Range, {
label: t['common.opacity'],
min: 0,
max: 1,
step: 0.05,
range: opacity,
updateRange: this.changeOpacity
})]
})
})]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(WatermarkPositionWrapper, {
children: WATERMARK_POSITIONS.map(function (value, index) {
return /*#__PURE__*/Object(jsx_runtime["jsx"])(PositionSquare, {
value: value,
active: value === position,
clickable: activePositions[index],
onClick: function onClick() {
if (activePositions[index]) {
_this2.onPositionChange(value);
}
}
}, value);
})
}), isWatermarkList && showWaterMarkList && /*#__PURE__*/Object(jsx_runtime["jsx"])(Watermarks, {
children: urls.map(function (url) {
return /*#__PURE__*/Object(jsx_runtime["jsx"])(WatermarkIcon, {
src: url,
onClick: function onClick() {
_this2.onChangeWatermark(url);
}
}, url);
})
})]
});
}
}]);
return _default;
}(react["Component"]);
// CONCATENATED MODULE: ./src/components/Toolbar/FocusPoint.js
function FocusPoint_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { FocusPoint_typeof = function _typeof(obj) { return typeof obj; }; } else { FocusPoint_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return FocusPoint_typeof(obj); }
function FocusPoint_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function FocusPoint_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { FocusPoint_ownKeys(Object(source), true).forEach(function (key) { FocusPoint_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { FocusPoint_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function FocusPoint_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function FocusPoint_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function FocusPoint_createClass(Constructor, protoProps, staticProps) { if (protoProps) FocusPoint_defineProperties(Constructor.prototype, protoProps); if (staticProps) FocusPoint_defineProperties(Constructor, staticProps); return Constructor; }
function FocusPoint_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) FocusPoint_setPrototypeOf(subClass, superClass); }
function FocusPoint_setPrototypeOf(o, p) { FocusPoint_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return FocusPoint_setPrototypeOf(o, p); }
function FocusPoint_createSuper(Derived) { var hasNativeReflectConstruct = FocusPoint_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = FocusPoint_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = FocusPoint_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return FocusPoint_possibleConstructorReturn(this, result); }; }
function FocusPoint_possibleConstructorReturn(self, call) { if (call && (FocusPoint_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return FocusPoint_assertThisInitialized(self); }
function FocusPoint_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function FocusPoint_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function FocusPoint_getPrototypeOf(o) { FocusPoint_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return FocusPoint_getPrototypeOf(o); }
function FocusPoint_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var FocusPoint_default = /*#__PURE__*/function (_Component) {
FocusPoint_inherits(_default, _Component);
var _super = FocusPoint_createSuper(_default);
function _default() {
var _this;
FocusPoint_classCallCheck(this, _default);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
FocusPoint_defineProperty(FocusPoint_assertThisInitialized(_this), "changeWidth", function (_ref) {
var value = _ref.target.value;
var _this$props = _this.props,
updateState = _this$props.updateState,
focusPoint = _this$props.focusPoint,
canvasDimensions = _this$props.canvasDimensions;
var newFocusPoint = FocusPoint_objectSpread(FocusPoint_objectSpread({}, focusPoint), {}, {
x: Math.min(isNaN(value) ? 0 : +value, canvasDimensions.width)
});
updateState({
focusPoint: newFocusPoint
});
});
FocusPoint_defineProperty(FocusPoint_assertThisInitialized(_this), "changeHeight", function (_ref2) {
var value = _ref2.target.value;
var _this$props2 = _this.props,
updateState = _this$props2.updateState,
focusPoint = _this$props2.focusPoint,
canvasDimensions = _this$props2.canvasDimensions;
var newFocusPoint = FocusPoint_objectSpread(FocusPoint_objectSpread({}, focusPoint), {}, {
y: Math.min(isNaN(value) ? 0 : +value, canvasDimensions.height)
});
updateState({
focusPoint: newFocusPoint
});
});
return _this;
}
FocusPoint_createClass(_default, [{
key: "componentDidMount",
value: function componentDidMount() {}
}, {
key: "render",
value: function render() {
var _this$props3 = this.props,
focusPoint = _this$props3.focusPoint,
t = _this$props3.t;
return /*#__PURE__*/Object(jsx_runtime["jsx"])(ResizeWrapper, {
children: /*#__PURE__*/Object(jsx_runtime["jsxs"])(ResizeBox, {
active: true,
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])(FieldSet, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FieldLabel, {
children: t['common.x']
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
dark: true,
fullSize: true,
value: Math.round(focusPoint.x),
onChange: this.changeWidth
})]
}), "\xA0\xA0", /*#__PURE__*/Object(jsx_runtime["jsxs"])(FieldSet, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FieldLabel, {
children: t['common.y']
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
dark: true,
fullSize: true,
value: Math.round(focusPoint.y),
onChange: this.changeHeight
})]
})]
})
});
}
}]);
return _default;
}(react["Component"]);
// CONCATENATED MODULE: ./src/styledComponents/Shapes.ui.js
var Shapes_ui_templateObject, Shapes_ui_templateObject2, Shapes_ui_templateObject3, Shapes_ui_templateObject4, Shapes_ui_templateObject5, Shapes_ui_templateObject6, Shapes_ui_templateObject7;
function Shapes_ui_taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var AddWrapper = styled_components_browser_esm["b" /* default */].div(Shapes_ui_templateObject || (Shapes_ui_templateObject = Shapes_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: flex;\n width: 100%;\n height: 100%;\n}\n"])));
var ItemsWrapper = styled_components_browser_esm["b" /* default */].div(Shapes_ui_templateObject2 || (Shapes_ui_templateObject2 = Shapes_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n color: ", ";\n display: flex;\n justify-content: flex-start;\n align-items: center;\n text-align: center; \n width: fit-content;\n min-width: 111px;\n max-width: 100%;\n height: 100%;\n margin-left: auto;\n margin-right: auto;\n}\n \n #filerobot-image-editor-root & ::-webkit-scrollbar {\n height: 10px !important;\n }\n \n #filerobot-image-editor-root & ::-webkit-scrollbar-thumb {\n background: ", ";\n border-radius: 5px;\n }\n \n @media (min-width: 768px) {\n#filerobot-image-editor-root & {\n overflow-x: auto;\n overflow-y: hidden;\n white-space: nowrap\n}\n }\n"])), function (props) {
return props.theme.colors.text;
}, function (props) {
return props.theme.colors.border || '#3b4d54';
});
var SettingsWrapper = styled_components_browser_esm["b" /* default */].div(Shapes_ui_templateObject3 || (Shapes_ui_templateObject3 = Shapes_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n height: 100%;\n padding: 0 15px;\n display: flex;\n align-items: center;\n justify-content: center;\n width: fit-content;\n margin: 0 auto;\n}\n"])));
var ItemGroup = styled_components_browser_esm["b" /* default */].div(Shapes_ui_templateObject4 || (Shapes_ui_templateObject4 = Shapes_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n padding: 8px 25px;\n}\n\n #filerobot-image-editor-root & * {\n cursor: pointer;\n }\n"])));
var Shapes_ui_ItemIcon = styled_components_browser_esm["b" /* default */].div(Shapes_ui_templateObject5 || (Shapes_ui_templateObject5 = Shapes_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n width: 50px;\n height: 50px;\n max-width: 50px;\n max-height: 50px;\n padding-bottom: 3px;\n cursor: pointer;\n margin-left: auto;\n margin-right: auto;\n\n ", ";\n}\n\n #filerobot-image-editor-root & img {\n max-width: 100%;\n }\n"])), function (p) {
return p.isIconNotProvided && "\n background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pg0KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE3LjEuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPg0KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCINCgkgdmlld0JveD0iMCAwIDQ5NSA0OTUiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ5NSA0OTU7IiB4bWw6c3BhY2U9InByZXNlcnZlIiBmaWxsPSJ3aGl0ZSI+DQo8Zz4NCgk8cGF0aCBkPSJNNDk1LDEwMy41MTNWOTUuNWMwLTIxLjc4LTE3LjcyLTM5LjUtMzkuNS0zOS41aC00MTZDMTcuNzIsNTYsMCw3My43MiwwLDk1LjV2MzAzLjk5N2MwLDAuMDAzLDAsMC4wMDUsMCwwLjAwOA0KCQlDMC4wMDMsNDIxLjI4MywxNy43MjIsNDM5LDM5LjUsNDM5aDQxNmMyMS43OCwwLDM5LjUtMTcuNzIsMzkuNS0zOS41VjEwMy41MjFDNDk1LDEwMy41MTgsNDk1LDEwMy41MTYsNDk1LDEwMy41MTN6IE0zOS41LDcxaDQxNg0KCQljMTMuNTA5LDAsMjQuNSwxMC45OSwyNC41LDI0LjV2NC44ODNjLTM1LjEyMSwzNC45NjMtOTIuODUsOTIuNDY0LTE0MC43MjEsMTQwLjI4OWwtNzUuMTYyLTc1LjE2Mg0KCQljLTkuMTYyLTkuMTYyLTI0LjA3MS05LjE2Mi0zMy4yMzMsMEwxNSwzODEuMzkzVjk1LjVDMTUsODEuOTksMjUuOTkxLDcxLDM5LjUsNzF6IE00NTUuNSw0MjRoLTQxNg0KCQljLTEyLjUxOSwwLTIyLjg2OC05LjQzOS0yNC4zMTktMjEuNTc0TDI0MS40OSwxNzYuMTE3YzMuMzE0LTMuMzE0LDguNzA2LTMuMzE0LDEyLjAyMSwwbDc1LjE1OCw3NS4xNTgNCgkJQzI4OS4yNiwyOTAuNjcsMjU4LjgxMywzMjEuMjQ5LDI1Ny41LDMyM2MtMi40ODUsMy4zMTMtMS44MTQsOC4wMTUsMS41LDEwLjVjMS4zNDksMS4wMTIsMi45MjgsMS41LDQuNDk0LDEuNQ0KCQljMi4xODcsMCw0LjM0OS0wLjk1Myw1LjgyMi0yLjc2NEMyNzUuMDc1LDMyNS43Nyw0MTIuOTYyLDE4OC4zMDgsNDgwLDEyMS41NTFWMzk5LjVDNDgwLDQxMy4wMSw0NjkuMDA5LDQyNCw0NTUuNSw0MjR6Ii8+DQoJPHBhdGggZD0iTTEwMy41LDE5OWMyMS43OCwwLDM5LjUtMTcuNzIsMzkuNS0zOS41UzEyNS4yOCwxMjAsMTAzLjUsMTIwUzY0LDEzNy43Miw2NCwxNTkuNVM4MS43MiwxOTksMTAzLjUsMTk5eiBNMTAzLjUsMTM1DQoJCWMxMy41MDksMCwyNC41LDEwLjk5LDI0LjUsMjQuNVMxMTcuMDA5LDE4NCwxMDMuNSwxODRTNzksMTczLjAxLDc5LDE1OS41Uzg5Ljk5MSwxMzUsMTAzLjUsMTM1eiIvPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPC9zdmc+DQo=');\n background-size: cover;\n background-repeat: no-repeat;\n ";
});
var FieldGroup = styled_components_browser_esm["b" /* default */].div(Shapes_ui_templateObject6 || (Shapes_ui_templateObject6 = Shapes_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n display: flex;\n flex-direction: column;\n jutifyContent: center;\n alignItems: center;\n margin: 20px;\n}\n\n #filerobot-image-editor-root & input {\n margin-left: auto;\n margin-right: auto;\n }\n"])));
var FieldCustomLabel = styled_components_browser_esm["b" /* default */].label(Shapes_ui_templateObject7 || (Shapes_ui_templateObject7 = Shapes_ui_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n color: ", ";\n display: inline-block;\n margin-bottom: 0;\n}\n"])), function (props) {
return props.theme.colors.text || '#ffffff';
});
// CONCATENATED MODULE: ./src/components/Toolbar/Shapes.js
function Shapes_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Shapes_typeof = function _typeof(obj) { return typeof obj; }; } else { Shapes_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Shapes_typeof(obj); }
function Shapes_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function Shapes_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { Shapes_ownKeys(Object(source), true).forEach(function (key) { Shapes_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { Shapes_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function Shapes_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function Shapes_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function Shapes_createClass(Constructor, protoProps, staticProps) { if (protoProps) Shapes_defineProperties(Constructor.prototype, protoProps); if (staticProps) Shapes_defineProperties(Constructor, staticProps); return Constructor; }
function Shapes_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Shapes_setPrototypeOf(subClass, superClass); }
function Shapes_setPrototypeOf(o, p) { Shapes_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Shapes_setPrototypeOf(o, p); }
function Shapes_createSuper(Derived) { var hasNativeReflectConstruct = Shapes_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Shapes_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Shapes_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Shapes_possibleConstructorReturn(this, result); }; }
function Shapes_possibleConstructorReturn(self, call) { if (call && (Shapes_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Shapes_assertThisInitialized(self); }
function Shapes_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function Shapes_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function Shapes_getPrototypeOf(o) { Shapes_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Shapes_getPrototypeOf(o); }
function Shapes_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Shapes_Add = /*#__PURE__*/function (_Component) {
Shapes_inherits(Add, _Component);
var _super = Shapes_createSuper(Add);
function Add() {
var _this;
Shapes_classCallCheck(this, Add);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
Shapes_defineProperty(Shapes_assertThisInitialized(_this), "renderSettings", function (selectedShape) {
var _this$props = _this.props,
shapeOperations = _this$props.shapeOperations,
t = _this$props.t;
var variant = selectedShape.variant,
opacity = selectedShape.opacity,
color = selectedShape.color,
_selectedShape$stroke = selectedShape.stroke,
stroke = _selectedShape$stroke === void 0 ? {} : _selectedShape$stroke;
var updateOpacity = function updateOpacity(newVal) {
return shapeOperations.updateShape({
opacity: newVal
});
};
var updateStroke = function updateStroke(property, value) {
return shapeOperations.updateShape({
stroke: Shapes_objectSpread(Shapes_objectSpread({}, stroke), {}, Shapes_defineProperty({}, property, value))
});
};
var updatePropertyFromEvent = function updatePropertyFromEvent(e) {
return shapeOperations.updateShape(Shapes_defineProperty({}, e.target.name, e.target.value));
};
var defaultSettings = /*#__PURE__*/Object(jsx_runtime["jsxs"])(react["Fragment"], {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(components_Range, {
label: t['common.opacity'],
min: 0,
max: 1,
step: 0.05,
range: opacity,
updateRange: updateOpacity,
labelBefore: true
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(FieldGroup, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FieldCustomLabel, {
children: "Stroke Color"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
value: stroke.color || '#000000',
type: "color",
style: {
width: 30,
padding: 0,
background: 'transparent',
boxShadow: 'none'
},
onChange: function onChange(_ref) {
var value = _ref.target.value;
return updateStroke('color', value);
}
})]
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(FieldGroup, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FieldCustomLabel, {
children: "Stroke width"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
value: stroke.width || 0,
type: "number",
style: {
width: 60
},
onChange: function onChange(_ref2) {
var value = _ref2.target.value;
return updateStroke('width', value);
},
min: 0
})]
})]
}, "default-settings");
var commonSettings = /*#__PURE__*/Object(jsx_runtime["jsxs"])(FieldGroup, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FieldCustomLabel, {
children: "Fill Color"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
value: color || '#000',
type: "color",
style: {
width: 30,
padding: 0,
background: 'transparent',
boxShadow: 'none'
},
name: "color",
onChange: updatePropertyFromEvent
}, "shape-color")]
}, "common-settings-fields");
var shownSettings = [defaultSettings];
switch (variant) {
case SHAPES_VARIANTS.RECT:
case SHAPES_VARIANTS.SQUARE:
case SHAPES_VARIANTS.CIRCLE:
shownSettings.push(commonSettings);
break;
case SHAPES_VARIANTS.TEXT:
var textFontField = /*#__PURE__*/Object(jsx_runtime["jsxs"])(react["Fragment"], {
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])(FieldGroup, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FieldCustomLabel, {
children: "Text"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
id: "text",
value: selectedShape.text || 'Text',
name: "text",
style: {
minWidth: 111
},
onChange: updatePropertyFromEvent
})]
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(FieldGroup, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FieldCustomLabel, {
children: "Font family"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Shared_Select, {
list: STANDARD_FONTS,
valueProp: "value",
id: "textFont",
value: selectedShape.textFont || 'Arial',
style: {
width: 111
},
onChange: function onChange(value) {
return updatePropertyFromEvent({
target: {
name: 'textFont',
value: value
}
});
},
color: "text-font",
notRelativePosition: true
})]
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(FieldGroup, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FieldCustomLabel, {
children: "Font size"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
value: selectedShape.textSize,
type: "number",
style: {
width: 60
},
name: "textSize",
onChange: updatePropertyFromEvent,
min: 0
})]
})]
}, "text-group-fields");
shownSettings.unshift(textFontField, commonSettings);
break;
case SHAPES_VARIANTS.IMAGE:
var urlField = /*#__PURE__*/Object(jsx_runtime["jsxs"])(FieldGroup, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FieldCustomLabel, {
children: "URL"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
id: "img",
value: Shapes_typeof(selectedShape.img) === 'object' ? selectedShape.img.src : selectedShape.img || '',
name: "img",
style: {
minWidth: 111
},
onChange: updatePropertyFromEvent
})]
}, "url-field");
shownSettings.unshift(urlField);
break;
default:
break;
}
return shownSettings;
});
return _this;
}
Shapes_createClass(Add, [{
key: "render",
value: function render() {
var _this$props2 = this.props,
availableShapes = _this$props2.availableShapes,
_this$props2$selected = _this$props2.selectedShape,
selectedShape = _this$props2$selected === void 0 ? {} : _this$props2$selected;
var isShapeSelected = Object.keys(selectedShape).length;
return /*#__PURE__*/Object(jsx_runtime["jsx"])(AddWrapper, {
children: isShapeSelected === 0 ? /*#__PURE__*/Object(jsx_runtime["jsx"])(ItemsWrapper, {
children: availableShapes.map(function (_ref3) {
var label = _ref3.label,
content = _ref3.content,
iconStyles = _ref3.iconStyles,
drawFn = _ref3.drawFn,
iconUrl = _ref3.iconUrl;
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(ItemGroup, {
onClick: function onClick() {
return drawFn();
},
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(Shapes_ui_ItemIcon, {
style: iconStyles,
isIconNotProvided: !Boolean(content || iconUrl || iconStyles),
children: content || iconUrl && /*#__PURE__*/Object(jsx_runtime["jsx"])("img", {
src: iconUrl,
alt: "".concat(label, " icon")
})
}), /*#__PURE__*/Object(jsx_runtime["jsx"])("label", {
children: label
})]
}, label);
})
}) : /*#__PURE__*/Object(jsx_runtime["jsx"])(SettingsWrapper, {
children: this.renderSettings(selectedShape)
})
});
}
}]);
return Add;
}(react["Component"]);
// CONCATENATED MODULE: ./src/components/Toolbar/Image.js
function Image_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Image_typeof = function _typeof(obj) { return typeof obj; }; } else { Image_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Image_typeof(obj); }
function Image_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function Image_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { Image_ownKeys(Object(source), true).forEach(function (key) { Image_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { Image_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function Image_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function Image_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function Image_createClass(Constructor, protoProps, staticProps) { if (protoProps) Image_defineProperties(Constructor.prototype, protoProps); if (staticProps) Image_defineProperties(Constructor, staticProps); return Constructor; }
function Image_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Image_setPrototypeOf(subClass, superClass); }
function Image_setPrototypeOf(o, p) { Image_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Image_setPrototypeOf(o, p); }
function Image_createSuper(Derived) { var hasNativeReflectConstruct = Image_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Image_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Image_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Image_possibleConstructorReturn(this, result); }; }
function Image_possibleConstructorReturn(self, call) { if (call && (Image_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Image_assertThisInitialized(self); }
function Image_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function Image_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function Image_getPrototypeOf(o) { Image_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Image_getPrototypeOf(o); }
function Image_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Image_Image = /*#__PURE__*/function (_Component) {
Image_inherits(Image, _Component);
var _super = Image_createSuper(Image);
function Image() {
var _this;
Image_classCallCheck(this, Image);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
Image_defineProperty(Image_assertThisInitialized(_this), "updateOpacity", function (newVal) {
return _this.props.shapeOperations.updateShape({
opacity: newVal
});
});
Image_defineProperty(Image_assertThisInitialized(_this), "updateStroke", function (property, value) {
var _this$props = _this.props,
shapeOperations = _this$props.shapeOperations,
_this$props$selectedS = _this$props.selectedShape.stroke,
stroke = _this$props$selectedS === void 0 ? {} : _this$props$selectedS;
shapeOperations.updateShape({
stroke: Image_objectSpread(Image_objectSpread({}, stroke), {}, Image_defineProperty({}, property, value))
});
});
Image_defineProperty(Image_assertThisInitialized(_this), "updatePropertyFromEvent", function (e) {
return _this.props.shapeOperations.updateShape(Image_defineProperty({}, e.target.name, e.target.value));
});
return _this;
}
Image_createClass(Image, [{
key: "componentDidMount",
value: function componentDidMount() {
var shapeOperations = this.props.shapeOperations;
shapeOperations.addImage({
img: DEFAULT_IMG_URL
});
}
}, {
key: "render",
value: function render() {
var _this2 = this;
var _this$props2 = this.props,
t = _this$props2.t,
_this$props2$selected = _this$props2.selectedShape,
selectedShape = _this$props2$selected === void 0 ? {} : _this$props2$selected;
var _selectedShape$opacit = selectedShape.opacity,
opacity = _selectedShape$opacit === void 0 ? 1 : _selectedShape$opacit,
img = selectedShape.img,
_selectedShape$stroke = selectedShape.stroke,
stroke = _selectedShape$stroke === void 0 ? {} : _selectedShape$stroke;
return /*#__PURE__*/Object(jsx_runtime["jsx"])(AddWrapper, {
children: /*#__PURE__*/Object(jsx_runtime["jsxs"])(SettingsWrapper, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(components_Range, {
label: t['common.opacity'],
min: 0,
max: 1,
step: 0.05,
range: opacity,
updateRange: this.updateOpacity,
labelBefore: true
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(FieldGroup, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FieldCustomLabel, {
children: "Stroke Color"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
value: stroke.color || '#000000',
type: "color",
style: {
width: 30,
padding: 0,
background: 'transparent',
boxShadow: 'none'
},
onChange: function onChange(_ref) {
var value = _ref.target.value;
return _this2.updateStroke('color', value);
}
})]
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(FieldGroup, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FieldCustomLabel, {
children: "Stroke width"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
value: stroke.width || 0,
type: "number",
style: {
width: 60
},
onChange: function onChange(_ref2) {
var value = _ref2.target.value;
return _this2.updateStroke('width', value);
},
min: 0
})]
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(FieldGroup, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FieldCustomLabel, {
children: "URL"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
id: "img",
value: Image_typeof(img) === 'object' ? img.src : img || '',
name: "img",
style: {
minWidth: 111
},
onChange: this.updatePropertyFromEvent
})]
}, "url-field")]
})
});
}
}]);
return Image;
}(react["Component"]);
// CONCATENATED MODULE: ./src/components/Toolbar/Text.js
function Text_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Text_typeof = function _typeof(obj) { return typeof obj; }; } else { Text_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Text_typeof(obj); }
function Text_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function Text_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { Text_ownKeys(Object(source), true).forEach(function (key) { Text_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { Text_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function Text_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function Text_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function Text_createClass(Constructor, protoProps, staticProps) { if (protoProps) Text_defineProperties(Constructor.prototype, protoProps); if (staticProps) Text_defineProperties(Constructor, staticProps); return Constructor; }
function Text_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Text_setPrototypeOf(subClass, superClass); }
function Text_setPrototypeOf(o, p) { Text_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Text_setPrototypeOf(o, p); }
function Text_createSuper(Derived) { var hasNativeReflectConstruct = Text_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Text_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Text_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Text_possibleConstructorReturn(this, result); }; }
function Text_possibleConstructorReturn(self, call) { if (call && (Text_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Text_assertThisInitialized(self); }
function Text_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function Text_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function Text_getPrototypeOf(o) { Text_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Text_getPrototypeOf(o); }
function Text_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var Text_Text = /*#__PURE__*/function (_Component) {
Text_inherits(Text, _Component);
var _super = Text_createSuper(Text);
function Text() {
var _this;
Text_classCallCheck(this, Text);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
Text_defineProperty(Text_assertThisInitialized(_this), "updateOpacity", function (newVal) {
return _this.props.shapeOperations.updateShape({
opacity: newVal
});
});
Text_defineProperty(Text_assertThisInitialized(_this), "updateStroke", function (property, value) {
var _this$props = _this.props,
shapeOperations = _this$props.shapeOperations,
_this$props$selectedS = _this$props.selectedShape.stroke,
stroke = _this$props$selectedS === void 0 ? {} : _this$props$selectedS;
shapeOperations.updateShape({
stroke: Text_objectSpread(Text_objectSpread({}, stroke), {}, Text_defineProperty({}, property, value))
});
});
Text_defineProperty(Text_assertThisInitialized(_this), "updatePropertyFromEvent", function (e) {
return _this.props.shapeOperations.updateShape(Text_defineProperty({}, e.target.name, e.target.value));
});
return _this;
}
Text_createClass(Text, [{
key: "componentDidMount",
value: function componentDidMount() {
var shapeOperations = this.props.shapeOperations;
shapeOperations.addText();
}
}, {
key: "render",
value: function render() {
var _this2 = this;
var _this$props2 = this.props,
t = _this$props2.t,
_this$props2$selected = _this$props2.selectedShape,
selectedShape = _this$props2$selected === void 0 ? {} : _this$props2$selected,
theme = _this$props2.config.theme;
var _selectedShape$text = selectedShape.text,
text = _selectedShape$text === void 0 ? '' : _selectedShape$text,
_selectedShape$textFo = selectedShape.textFont,
textFont = _selectedShape$textFo === void 0 ? 'Arial' : _selectedShape$textFo,
_selectedShape$textSi = selectedShape.textSize,
textSize = _selectedShape$textSi === void 0 ? 62 : _selectedShape$textSi,
_selectedShape$stroke = selectedShape.stroke,
stroke = _selectedShape$stroke === void 0 ? {} : _selectedShape$stroke,
_selectedShape$color = selectedShape.color,
color = _selectedShape$color === void 0 ? '#000000' : _selectedShape$color,
_selectedShape$opacit = selectedShape.opacity,
opacity = _selectedShape$opacit === void 0 ? 1 : _selectedShape$opacit;
return /*#__PURE__*/Object(jsx_runtime["jsx"])(AddWrapper, {
children: /*#__PURE__*/Object(jsx_runtime["jsxs"])(SettingsWrapper, {
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])(FieldGroup, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FieldCustomLabel, {
children: "Text"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
id: "text",
value: text,
name: "text",
style: {
minWidth: 111
},
onChange: this.updatePropertyFromEvent
})]
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(FieldGroup, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FieldCustomLabel, {
children: "Font family"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Shared_Select, {
list: theme.fonts,
valueProp: "value",
id: "textFont",
value: textFont,
style: {
width: 111
},
onChange: function onChange(value) {
return _this2.updatePropertyFromEvent({
target: {
name: 'textFont',
value: value
}
});
},
color: "text-font",
notRelativePosition: true
})]
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(FieldGroup, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FieldCustomLabel, {
children: "Font size"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
value: textSize,
type: "number",
style: {
width: 60
},
name: "textSize",
onChange: this.updatePropertyFromEvent,
min: 0
})]
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(FieldGroup, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FieldCustomLabel, {
children: "Fill Color"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
value: color,
type: "color",
style: {
width: 30,
padding: 0,
background: 'transparent',
boxShadow: 'none'
},
name: "color",
onChange: this.updatePropertyFromEvent
})]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(components_Range, {
label: t['common.opacity'],
min: 0,
max: 1,
step: 0.05,
range: opacity,
updateRange: this.updateOpacity,
labelBefore: true
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(FieldGroup, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FieldCustomLabel, {
children: "Stroke Color"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
value: stroke.color || '#000000',
type: "color",
style: {
width: 30,
padding: 0,
background: 'transparent',
boxShadow: 'none'
},
onChange: function onChange(_ref) {
var value = _ref.target.value;
return _this2.updateStroke('color', value);
}
})]
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(FieldGroup, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(FieldCustomLabel, {
children: "Stroke width"
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(FieldInput, {
value: stroke.width || 0,
type: "number",
style: {
width: 60
},
onChange: function onChange(_ref2) {
var value = _ref2.target.value;
return _this2.updateStroke('width', value);
},
min: 0
})]
})]
})
});
}
}]);
return Text;
}(react["Component"]);
// CONCATENATED MODULE: ./src/components/Toolbar/Toolbar.js
function Toolbar_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Toolbar_typeof = function _typeof(obj) { return typeof obj; }; } else { Toolbar_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Toolbar_typeof(obj); }
function Toolbar_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function Toolbar_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { Toolbar_ownKeys(Object(source), true).forEach(function (key) { Toolbar_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { Toolbar_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function Toolbar_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function Toolbar_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function Toolbar_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function Toolbar_createClass(Constructor, protoProps, staticProps) { if (protoProps) Toolbar_defineProperties(Constructor.prototype, protoProps); if (staticProps) Toolbar_defineProperties(Constructor, staticProps); return Constructor; }
function Toolbar_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Toolbar_setPrototypeOf(subClass, superClass); }
function Toolbar_setPrototypeOf(o, p) { Toolbar_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Toolbar_setPrototypeOf(o, p); }
function Toolbar_createSuper(Derived) { var hasNativeReflectConstruct = Toolbar_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Toolbar_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Toolbar_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Toolbar_possibleConstructorReturn(this, result); }; }
function Toolbar_possibleConstructorReturn(self, call) { if (call && (Toolbar_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Toolbar_assertThisInitialized(self); }
function Toolbar_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function Toolbar_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function Toolbar_getPrototypeOf(o) { Toolbar_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Toolbar_getPrototypeOf(o); }
var Toolbar_default = /*#__PURE__*/function (_Component) {
Toolbar_inherits(_default, _Component);
var _super = Toolbar_createSuper(_default);
function _default() {
Toolbar_classCallCheck(this, _default);
return _super.apply(this, arguments);
}
Toolbar_createClass(_default, [{
key: "render",
value: function render() {
var _this = this;
var _this$props = this.props,
activeTab = _this$props.activeTab,
isShowSpinner = _this$props.isShowSpinner,
activeBody = _this$props.activeBody,
config = _this$props.config;
var tools = config.tools;
/* Mod ??? custom action */
if (_this$props.config!=undefined
&& _this$props.config.activeTabDefault != undefined
&& _this$props.config.activeTabDefault) {
activeTab = _this$props.config.activeTabDefault;
}
/* Mod ??? custom action */
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(Toolbar, {
overlayYHidden: activeTab !== 'watermark',
children: [!activeTab && tools.map(function (name) {
return /*#__PURE__*/Object(jsx_runtime["jsx"])(Tool_default, Toolbar_objectSpread({
name: name
}, _this.props), name);
}), activeTab === 'adjust' && /*#__PURE__*/Object(jsx_runtime["jsx"])(Adjust_default, Toolbar_objectSpread({}, this.props)), activeTab === 'effects' && /*#__PURE__*/Object(jsx_runtime["jsx"])(Effects_default, Toolbar_objectSpread({}, this.props)), activeTab === 'filters' && /*#__PURE__*/Object(jsx_runtime["jsx"])(Filters_default, Toolbar_objectSpread({}, this.props)), activeTab === 'rotate' && /*#__PURE__*/Object(jsx_runtime["jsx"])(Orientation_default, Toolbar_objectSpread({}, this.props)), activeTab === 'crop' && /*#__PURE__*/Object(jsx_runtime["jsx"])(Crop_default, Toolbar_objectSpread({}, this.props)), activeTab === 'resize' && /*#__PURE__*/Object(jsx_runtime["jsx"])(Resize_default, Toolbar_objectSpread({}, this.props)), activeTab === 'watermark' && /*#__PURE__*/Object(jsx_runtime["jsx"])(Watermark_default, Toolbar_objectSpread({}, this.props)), activeTab === 'focus_point' && /*#__PURE__*/Object(jsx_runtime["jsx"])(FocusPoint_default, Toolbar_objectSpread({}, this.props)), activeTab === 'shapes' && /*#__PURE__*/Object(jsx_runtime["jsx"])(Shapes_Add, Toolbar_objectSpread({}, this.props)), activeTab === 'image' && /*#__PURE__*/Object(jsx_runtime["jsx"])(Image_Image, Toolbar_objectSpread({}, this.props)), activeTab === 'text' && /*#__PURE__*/Object(jsx_runtime["jsx"])(Text_Text, Toolbar_objectSpread({}, this.props)), isShowSpinner && /*#__PURE__*/Object(jsx_runtime["jsx"])(NoClickOverlay, {}), activeBody !== 'preview' && /*#__PURE__*/Object(jsx_runtime["jsx"])(NoClickToolbar, {})]
});
}
}]);
return _default;
}(react["Component"]);
// CONCATENATED MODULE: ./src/components/Header/SaveActions.js
function SaveActions_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { SaveActions_typeof = function _typeof(obj) { return typeof obj; }; } else { SaveActions_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return SaveActions_typeof(obj); }
function SaveActions_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function SaveActions_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function SaveActions_createClass(Constructor, protoProps, staticProps) { if (protoProps) SaveActions_defineProperties(Constructor.prototype, protoProps); if (staticProps) SaveActions_defineProperties(Constructor, staticProps); return Constructor; }
function SaveActions_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) SaveActions_setPrototypeOf(subClass, superClass); }
function SaveActions_setPrototypeOf(o, p) { SaveActions_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return SaveActions_setPrototypeOf(o, p); }
function SaveActions_createSuper(Derived) { var hasNativeReflectConstruct = SaveActions_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = SaveActions_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = SaveActions_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return SaveActions_possibleConstructorReturn(this, result); }; }
function SaveActions_possibleConstructorReturn(self, call) { if (call && (SaveActions_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return SaveActions_assertThisInitialized(self); }
function SaveActions_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function SaveActions_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function SaveActions_getPrototypeOf(o) { SaveActions_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return SaveActions_getPrototypeOf(o); }
function SaveActions_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var SaveActions_SaveActions = /*#__PURE__*/function (_Component) {
SaveActions_inherits(SaveActions, _Component);
var _super = SaveActions_createSuper(SaveActions);
function SaveActions(props) {
var _this;
SaveActions_classCallCheck(this, SaveActions);
_this = _super.call(this, props);
SaveActions_defineProperty(SaveActions_assertThisInitialized(_this), "toggleActionsMenu", function (visible) {
_this.setState({
show: visible !== null && visible !== void 0 ? visible : !_this.state.show
});
});
SaveActions_defineProperty(SaveActions_assertThisInitialized(_this), "hideActionsMenu", function () {
return _this.toggleActionsMenu(false);
});
SaveActions_defineProperty(SaveActions_assertThisInitialized(_this), "handleSaving", function () {
_this.props.handleSaveAs();
_this.hideActionsMenu();
});
_this.state = {
show: false
};
return _this;
}
SaveActions_createClass(SaveActions, [{
key: "render",
value: function render() {
var t = this.props.t;
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(SaveActions_ui_SaveActions, {
children: [this.state.show && /*#__PURE__*/Object(jsx_runtime["jsx"])(SaveActionsBackdrop, {
onClick: this.hideActionsMenu
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(SaveActionsSlideButton, {
themeColor: true,
onClick: this.toggleActionsMenu,
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("i", {})
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(SaveActionsMenu, {
children: this.state.show && /*#__PURE__*/Object(jsx_runtime["jsx"])(SaveActionsItem, {
onClick: this.handleSaving,
children: t['toolbar.saveAsNewImage']
})
})]
});
}
}]);
return SaveActions;
}(react["Component"]);
// CONCATENATED MODULE: ./src/components/Header/Header.js
function Header_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Header_typeof = function _typeof(obj) { return typeof obj; }; } else { Header_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Header_typeof(obj); }
function Header_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function Header_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { Header_ownKeys(Object(source), true).forEach(function (key) { Header_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { Header_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function Header_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function Header_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function Header_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function Header_createClass(Constructor, protoProps, staticProps) { if (protoProps) Header_defineProperties(Constructor.prototype, protoProps); if (staticProps) Header_defineProperties(Constructor, staticProps); return Constructor; }
function Header_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Header_setPrototypeOf(subClass, superClass); }
function Header_setPrototypeOf(o, p) { Header_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Header_setPrototypeOf(o, p); }
function Header_createSuper(Derived) { var hasNativeReflectConstruct = Header_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Header_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Header_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Header_possibleConstructorReturn(this, result); }; }
function Header_possibleConstructorReturn(self, call) { if (call && (Header_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Header_assertThisInitialized(self); }
function Header_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function Header_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function Header_getPrototypeOf(o) { Header_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Header_getPrototypeOf(o); }
var Header_default = /*#__PURE__*/function (_Component) {
Header_inherits(_default, _Component);
var _super = Header_createSuper(_default);
function _default() {
Header_classCallCheck(this, _default);
return _super.apply(this, arguments);
}
Header_createClass(_default, [{
key: "render",
value: function render() {
var _this$props = this.props,
activeTab = _this$props.activeTab,
onRevert = _this$props.onRevert,
apply = _this$props.apply,
onClose = _this$props.onClose,
processWithCloudService = _this$props.processWithCloudService,
processWithFilerobot = _this$props.processWithFilerobot,
handleSave = _this$props.handleSave,
t = _this$props.t,
config = _this$props.config;
var tools = config.tools,
replaceCloseWithBackButton = config.replaceCloseWithBackButton,
noCapitalStrs = config.noCapitalStrs,
filerobot = config.filerobot,
finishButtonLabel = config.finishButtonLabel;
var isOneTool = tools.length === 1;
var filteredName = activeTab === 'rotate' ? 'orientation' : activeTab;
var onFinishButtonLabel = finishButtonLabel || (!processWithCloudService && !processWithFilerobot ? t['toolbar.download'] : t['toolbar.save']);
var applyAndSave = function applyAndSave() {
apply(handleSave);
};
var cancelBtnClosingFn = function cancelBtnClosingFn() {
return onClose(ON_CLOSE_STATUSES.TOOLBAR_CANCEL_BTN_CLICKED);
};
var isLastStep = !activeTab || activeTab === 'resize';
var saveAsFn = function saveAsFn() {
handleSave(true);
};
var applySaveAsHandle = isOneTool ? function () {
apply(saveAsFn);
} : saveAsFn;
var showSaveAs = isLastStep && processWithFilerobot && !processWithCloudService && filerobot.onSaveAs;
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(HeaderWrapper, {
children: [/*#__PURE__*/Object(jsx_runtime["jsxs"])(HeaderTop, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(Title, {
noCapitalStrs: noCapitalStrs,
children: t["toolbar.".concat(filteredName)] || t["header.image_editor_title"]
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(ButtonsWrapper, {
children: [replaceCloseWithBackButton && /*#__PURE__*/Object(jsx_runtime["jsxs"])(BackButtonWrapper, {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])("svg", {
width: "14",
height: "13",
viewBox: "0 0 14 13",
fill: "none",
xmlns: "http://www.w3.org/2000/svg",
onClick: onClose,
children: /*#__PURE__*/Object(jsx_runtime["jsx"])("path", {
d: "M0.145833 5.26248C0.0583333 5.34998 0 5.46664 0 5.55414C0 5.64164 0.0583333 5.78748 0.145833 5.84581L6.3 10.95C6.3875 11.0375 6.59167 11.0375 6.7375 11.0083C6.88334 10.9791 6.97084 10.8041 6.97084 10.6583V8.00414C9.47917 8.00414 11.1708 8.20831 13.2708 11.8541C13.3292 12 13.475 12.0583 13.6208 12.0583C13.6792 12.0583 13.6792 12.0583 13.7083 12.0583C13.9125 12 14 11.8541 14 11.6791V11.3875C14 10.0458 14 8.03331 13.0958 6.34164C12.0458 4.35831 9.975 3.30831 7 3.22081V0.508312C7 0.362478 6.9125 0.216645 6.76667 0.158312C6.62084 0.0999783 6.47501 0.0999783 6.38751 0.216645L0.145833 5.26248Z",
fill: "5D6D7E"
})
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(BackBtnSeparator, {})]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Button, {
themeColor: true,
sm: true,
themeBtn: activeTab,
onClick: isOneTool ? applyAndSave : !activeTab ? function () {
handleSave();
} : function () {
apply();
},
borderRadius: showSaveAs ? '2px 0px 0px 2px' : '4px',
children: isLastStep ? onFinishButtonLabel : t['toolbar.apply']
}), showSaveAs && /*#__PURE__*/Object(jsx_runtime["jsx"])(SaveActions_SaveActions, {
t: t,
handleSaveAs: applySaveAsHandle
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(CancelBtn, {
hide: !activeTab,
onClick: isOneTool ? cancelBtnClosingFn : onRevert,
noCapitalStrs: noCapitalStrs,
sm: true,
default: true,
fullSize: true,
children: t["toolbar.cancel"]
})]
}), !replaceCloseWithBackButton && /*#__PURE__*/Object(jsx_runtime["jsx"])(CloseBtn, {
onClick: onClose,
title: t["header.close_modal"]
})]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(ToolbarWrapper, {
overlayYHidden: activeTab !== 'watermark',
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(Toolbar_default, Header_objectSpread({}, this.props))
})]
});
}
}]);
return _default;
}(react["Component"]);
// CONCATENATED MODULE: ./src/components/index.js
// EXTERNAL MODULE: ./node_modules/image-type/index.js
var image_type = __webpack_require__(19);
var image_type_default = /*#__PURE__*/__webpack_require__.n(image_type);
// EXTERNAL MODULE: ./src/lib/caman/core/index.js
var core = __webpack_require__(38);
// EXTERNAL MODULE: ./src/lib/caman/core/calculate.js
var calculate = __webpack_require__(39);
// EXTERNAL MODULE: ./src/lib/caman/core/convert.js
var convert = __webpack_require__(40);
// EXTERNAL MODULE: ./src/lib/caman/core/event.js
var core_event = __webpack_require__(41);
// EXTERNAL MODULE: ./src/lib/caman/core/filter.js
var core_filter = __webpack_require__(42);
// EXTERNAL MODULE: ./src/lib/caman/core/logger.js
var logger = __webpack_require__(4);
// CONCATENATED MODULE: ./src/lib/caman/core/io.js
function io_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function io_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function io_createClass(Constructor, protoProps, staticProps) { if (protoProps) io_defineProperties(Constructor.prototype, protoProps); if (staticProps) io_defineProperties(Constructor, staticProps); return Constructor; }
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* DS104: Avoid inline assignments
* DS204: Change includes calls to have a more natural evaluation order
* DS206: Consider reworking classes to avoid initClass
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
// Various I/O based operations
var io_IO = /*#__PURE__*/function () {
function IO() {
io_classCallCheck(this, IO);
}
io_createClass(IO, null, [{
key: "initClass",
value: function initClass() {
// Used for parsing image URLs for domain names.
this.domainRegex = /(?:(?:http|https):\/\/)((?:\w+)\.(?:(?:\w|\.)+))/;
} // Is the given URL remote?
// If a cross-origin setting is set, we assume you have CORS
// properly configured.
//
// @param [DOMObject] img The image to check.
// @return [Boolean]
}, {
key: "isRemote",
value: function isRemote(img) {
if (img == null) {
return false;
}
if (this.corsEnabled(img)) {
return false;
}
return this.isURLRemote(img.src);
} // Given an image, we check to see if a CORS policy has been defined.
// @param [DOMObject] img The image to check.
// @return [Boolean]
}, {
key: "corsEnabled",
value: function corsEnabled(img) {
var needle;
return img.crossOrigin != null && (needle = img.crossOrigin.toLowerCase(), ['anonymous', 'use-credentials'].includes(needle));
} // Does the given URL exist on a different domain than the current one?
// This is done by comparing the URL to `document.domain`.
// @param [String] url The URL to check.
// @return [Boolean]
}, {
key: "isURLRemote",
value: function isURLRemote(url) {
var matches = url.match(this.domainRegex);
if (matches) {
return matches[1] !== document.domain;
} else {
return false;
}
} // Checks to see if the URL is remote, and if there is a proxy defined, it
// @param [String] src The URL to check.
// @return [String] The proxy URL if the image is remote. Nothing otherwise.
}, {
key: "remoteCheck",
value: function remoteCheck(src) {
if (this.isURLRemote(src)) {
if (!Caman.remoteProxy.length) {
logger["a" /* Log */].info("Attempting to load a remote image without a configured proxy. URL: ".concat(src));
return;
} else {
if (Caman.isURLRemote(Caman.remoteProxy)) {
logger["a" /* Log */].info("Cannot use a remote proxy for loading images.");
return;
}
return this.proxyUrl(src);
}
}
} // Given a URL, get the proxy URL for it.
// @param [String] src The URL to proxy.
// @return [String] The proxy URL.
}, {
key: "proxyUrl",
value: function proxyUrl(src) {
return "".concat(Caman.remoteProxy, "?").concat(Caman.proxyParam, "=").concat(encodeURIComponent(src));
} // Shortcut for using one of the bundled proxies.
// @param [String] lang String identifier for the proxy script language.
// @return [String] A proxy URL.
}, {
key: "useProxy",
value: function useProxy(lang) {
var langToExt = {
ruby: 'rb',
python: 'py',
perl: 'pl',
javascript: 'js'
};
lang = lang.toLowerCase();
if (langToExt[lang] != null) {
lang = langToExt[lang];
}
return "proxies/caman_proxy.".concat(lang);
}
}]);
return IO;
}();
io_IO.initClass();
Caman.IO = io_IO;
// EXTERNAL MODULE: ./src/lib/caman/core/util.js
var util = __webpack_require__(3);
// CONCATENATED MODULE: ./src/lib/caman/core/blander.js
function blander_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function blander_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function blander_createClass(Constructor, protoProps, staticProps) { if (protoProps) blander_defineProperties(Constructor.prototype, protoProps); if (staticProps) blander_defineProperties(Constructor, staticProps); return Constructor; }
var Blender = /*#__PURE__*/function () {
function Blender() {
blander_classCallCheck(this, Blender);
}
blander_createClass(Blender, null, [{
key: "initClass",
value: function initClass() {
this.blenders = {};
} // Registers a blender. Can be used to add your own blenders outside of
// the core library, if needed.
// @param [String] name Name of the blender.
// @param [Function] func The blender function.
}, {
key: "register",
value: function register(name, func) {
return this.blenders[name] = func;
} // Executes a blender to combine a layer with its parent.
// @param [String] name Name of the blending function to invoke.
// @param [Object] rgbaLayer RGBA object of the current pixel from the layer.
// @param [Object] rgbaParent RGBA object of the corresponding pixel in the parent layer.
// @return [Object] RGBA object representing the blended pixel.
}, {
key: "execute",
value: function execute(name, rgbaLayer, rgbaParent) {
return this.blenders[name](rgbaLayer, rgbaParent);
}
}]);
return Blender;
}();
Blender.initClass();
/* harmony default export */ var blander = (Blender);
// CONCATENATED MODULE: ./src/lib/caman/core/layer.js
function layer_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { layer_typeof = function _typeof(obj) { return typeof obj; }; } else { layer_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return layer_typeof(obj); }
function layer_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function layer_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function layer_createClass(Constructor, protoProps, staticProps) { if (protoProps) layer_defineProperties(Constructor.prototype, protoProps); if (staticProps) layer_defineProperties(Constructor, staticProps); return Constructor; }
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* DS205: Consider reworking code to avoid use of IIFEs
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
// The entire layering system for Caman resides in this file. Layers get their own canvasLayer
// objectwhich is created when newLayer() is called. For extensive information regarding the
// specifics of howthe layering system works, there is an in-depth blog post on this very topic.
// Instead of copying the entirety of that post, I'll simply point you towards the
// [blog link](http://blog.meltingice.net/programming/implementing-layers-camanjs).
//
// However, the gist of the layering system is that, for each layer, it creates a new canvas
// element and then either copies the parent layer's data or applies a solid color to the new
// layer. After some (optional) effects are applied, the layer is blended back into the parent
// canvas layer using one of many different blending algorithms.
//
// You can also load an image (local or remote, with a proxy) into a canvas layer, which is useful
// if you want to add textures to an image.
var layer_Layer = /*#__PURE__*/function () {
function Layer(c) {
layer_classCallCheck(this, Layer);
// Compatibility
this.c = c;
this.filter = this.c;
this.options = {
blendingMode: 'normal',
opacity: 1.0
}; // Each layer gets its own unique ID
this.layerID = util["b" /* Util */].uniqid.get(); // Create the canvas for this layer
this.canvas = document.createElement('canvas');
this.canvas.width = this.c.dimensions.width;
this.canvas.height = this.c.dimensions.height;
this.context = this.canvas.getContext('2d');
this.context.createImageData(this.canvas.width, this.canvas.height);
this.imageData = this.context.getImageData(0, 0, this.canvas.width, this.canvas.height);
this.pixelData = this.imageData.data;
} // If you want to create nested layers
layer_createClass(Layer, [{
key: "newLayer",
value: function newLayer(cb) {
return this.c.newLayer.call(this.c, cb);
} // Sets the blending mode of this layer. The mode is the name of a blender function.
}, {
key: "setBlendingMode",
value: function setBlendingMode(mode) {
this.options.blendingMode = mode;
return this;
} // Sets the opacity of this layer. This affects how much of this layer is applied to the parent
// layer at render time.
}, {
key: "opacity",
value: function opacity(_opacity) {
this.options.opacity = _opacity / 100;
return this;
} // Copies the contents of the parent layer to this layer
}, {
key: "copyParent",
value: function copyParent() {
var parentData = this.c.pixelData;
for (var i = 0, end = this.c.pixelData.length; i < end; i += 4) {
this.pixelData[i] = parentData[i];
this.pixelData[i + 1] = parentData[i + 1];
this.pixelData[i + 2] = parentData[i + 2];
this.pixelData[i + 3] = parentData[i + 3];
}
return this;
} // Fills this layer with a single color
}, {
key: "fillColor",
value: function fillColor() {
return this.c.fillColor.apply(this.c, arguments);
} // Loads and overlays an image onto this layer
}, {
key: "overlayImage",
value: function overlayImage(image) {
if (layer_typeof(image) === "object") {
image = image.src;
} else if (typeof image === "string" && image[0] === "#") {
image = Object(util["a" /* $ */])(image).src;
}
if (!image) {
return this;
}
this.c.renderer.renderQueue.push({
type: Caman.Filter.Type.LoadOverlay,
src: image,
layer: this
});
return this;
} // Loads a layer mask, to affect the opacity of individual pixels during blending
}, {
key: "layerMask",
value: function layerMask(image) {
if (layer_typeof(image) === "object") {
image = image.src;
} else if (typeof image === "string" && image[0] === "#") {
image = Object(util["a" /* $ */])(image).src;
}
if (!image) {
return this;
}
this.c.renderer.renderQueue.push({
type: Caman.Filter.Type.LoadLayerMask,
src: image,
layer: this
});
return this;
} // Takes the contents of this layer and applies them to the parent layer at render time. This
// should never be called explicitly by the user.
}, {
key: "applyToParent",
value: function applyToParent() {
var _this = this;
var parentData = this.c.pixelStack[this.c.pixelStack.length - 1];
var layerData = this.c.pixelData;
var opacity = this.options.opacity;
return function () {
var result1 = [];
for (var i = 0, end = layerData.length; i < end; i += 4) {
var rgbaParent = {
r: parentData[i],
g: parentData[i + 1],
b: parentData[i + 2],
a: parentData[i + 3]
};
var rgbaLayer = {
r: layerData[i],
g: layerData[i + 1],
b: layerData[i + 2],
a: layerData[i + 3]
};
if (_this.maskData) {
opacity = _this.maskData[i] / 255; // only the red channel is used
}
var result = blander.execute(_this.options.blendingMode, rgbaLayer, rgbaParent);
result.r = util["b" /* Util */].clampRGB(result.r);
result.g = util["b" /* Util */].clampRGB(result.g);
result.b = util["b" /* Util */].clampRGB(result.b);
if (result.a == null) {
result.a = rgbaLayer.a;
}
parentData[i] = rgbaParent.r - (rgbaParent.r - result.r) * (opacity * (result.a / 255));
parentData[i + 1] = rgbaParent.g - (rgbaParent.g - result.g) * (opacity * (result.a / 255));
result1.push(parentData[i + 2] = rgbaParent.b - (rgbaParent.b - result.b) * (opacity * (result.a / 255)));
}
return result1;
}();
}
}]);
return Layer;
}();
Caman.Layer = layer_Layer;
// EXTERNAL MODULE: ./src/lib/caman/core/pixel.js
var pixel = __webpack_require__(43);
// EXTERNAL MODULE: ./src/lib/caman/core/plugin.js
var core_plugin = __webpack_require__(44);
// CONCATENATED MODULE: ./src/lib/caman/lib/blenders.js
blander.register("normal", function (rgbaLayer, rgbaParent) {
return {
r: rgbaLayer.r,
g: rgbaLayer.g,
b: rgbaLayer.b
};
});
blander.register("multiply", function (rgbaLayer, rgbaParent) {
return {
r: rgbaLayer.r * rgbaParent.r / 255,
g: rgbaLayer.g * rgbaParent.g / 255,
b: rgbaLayer.b * rgbaParent.b / 255
};
});
blander.register("screen", function (rgbaLayer, rgbaParent) {
return {
r: 255 - (255 - rgbaLayer.r) * (255 - rgbaParent.r) / 255,
g: 255 - (255 - rgbaLayer.g) * (255 - rgbaParent.g) / 255,
b: 255 - (255 - rgbaLayer.b) * (255 - rgbaParent.b) / 255
};
});
blander.register("overlay", function (rgbaLayer, rgbaParent) {
var result;
result = {};
result.r = rgbaParent.r > 128 ? 255 - 2 * (255 - rgbaLayer.r) * (255 - rgbaParent.r) / 255 : rgbaParent.r * rgbaLayer.r * 2 / 255;
result.g = rgbaParent.g > 128 ? 255 - 2 * (255 - rgbaLayer.g) * (255 - rgbaParent.g) / 255 : rgbaParent.g * rgbaLayer.g * 2 / 255;
result.b = rgbaParent.b > 128 ? 255 - 2 * (255 - rgbaLayer.b) * (255 - rgbaParent.b) / 255 : rgbaParent.b * rgbaLayer.b * 2 / 255;
return result;
});
blander.register("difference", function (rgbaLayer, rgbaParent) {
return {
r: rgbaLayer.r - rgbaParent.r,
g: rgbaLayer.g - rgbaParent.g,
b: rgbaLayer.b - rgbaParent.b
};
});
blander.register("addition", function (rgbaLayer, rgbaParent) {
return {
r: rgbaParent.r + rgbaLayer.r,
g: rgbaParent.g + rgbaLayer.g,
b: rgbaParent.b + rgbaLayer.b
};
});
blander.register("exclusion", function (rgbaLayer, rgbaParent) {
return {
r: 128 - 2 * (rgbaParent.r - 128) * (rgbaLayer.r - 128) / 255,
g: 128 - 2 * (rgbaParent.g - 128) * (rgbaLayer.g - 128) / 255,
b: 128 - 2 * (rgbaParent.b - 128) * (rgbaLayer.b - 128) / 255
};
});
blander.register("softLight", function (rgbaLayer, rgbaParent) {
var result;
result = {};
result.r = rgbaParent.r > 128 ? 255 - (255 - rgbaParent.r) * (255 - (rgbaLayer.r - 128)) / 255 : rgbaParent.r * (rgbaLayer.r + 128) / 255;
result.g = rgbaParent.g > 128 ? 255 - (255 - rgbaParent.g) * (255 - (rgbaLayer.g - 128)) / 255 : rgbaParent.g * (rgbaLayer.g + 128) / 255;
result.b = rgbaParent.b > 128 ? 255 - (255 - rgbaParent.b) * (255 - (rgbaLayer.b - 128)) / 255 : rgbaParent.b * (rgbaLayer.b + 128) / 255;
return result;
});
blander.register("lighten", function (rgbaLayer, rgbaParent) {
return {
r: rgbaParent.r > rgbaLayer.r ? rgbaParent.r : rgbaLayer.r,
g: rgbaParent.g > rgbaLayer.g ? rgbaParent.g : rgbaLayer.g,
b: rgbaParent.b > rgbaLayer.b ? rgbaParent.b : rgbaLayer.b
};
});
blander.register("darken", function (rgbaLayer, rgbaParent) {
return {
r: rgbaParent.r > rgbaLayer.r ? rgbaLayer.r : rgbaParent.r,
g: rgbaParent.g > rgbaLayer.g ? rgbaLayer.g : rgbaParent.g,
b: rgbaParent.b > rgbaLayer.b ? rgbaLayer.b : rgbaParent.b
};
});
// EXTERNAL MODULE: ./src/lib/caman/lib/filters.js
var filters = __webpack_require__(45);
// CONCATENATED MODULE: ./src/lib/caman/lib/size.js
Caman.Plugin.register("crop", function (width, height, x, y) {
var canvas, ctx;
if (x == null) {
x = 0;
}
if (y == null) {
y = 0;
}
canvas = document.createElement('canvas');
util["b" /* Util */].copyAttributes(this.canvas, canvas);
canvas.width = width;
canvas.height = height;
ctx = canvas.getContext('2d');
ctx.drawImage(this.canvas, x, y, width, height, 0, 0, width, height);
this.cropCoordinates = {
x: x,
y: y
};
this.cropped = true;
return this.replaceCanvas(canvas);
});
Caman.Plugin.register("resize", function (newDims) {
var canvas, ctx;
if (newDims == null) {
newDims = null;
}
if (newDims === null || newDims.width == null && newDims.height == null) {
logger["a" /* Log */].error("Invalid or missing dimensions given for resize");
return;
}
if (newDims.width == null) {
newDims.width = this.canvas.width * newDims.height / this.canvas.height;
} else if (newDims.height == null) {
newDims.height = this.canvas.height * newDims.width / this.canvas.width;
}
canvas = document.createElement('canvas');
util["b" /* Util */].copyAttributes(this.canvas, canvas);
canvas.width = newDims.width;
canvas.height = newDims.height;
ctx = canvas.getContext('2d');
ctx.drawImage(this.canvas, 0, 0, this.canvas.width, this.canvas.height, 0, 0, newDims.width, newDims.height);
this.resized = true;
return this.replaceCanvas(canvas);
});
Caman.Filter.register("crop", function () {
return this.processPlugin("crop", Array.prototype.slice.call(arguments, 0));
});
Caman.Filter.register("resize", function () {
return this.processPlugin("resize", Array.prototype.slice.call(arguments, 0));
});
// EXTERNAL MODULE: ./src/lib/caman/plugins/common/blur.js
var common_blur = __webpack_require__(46);
// EXTERNAL MODULE: ./src/lib/caman/plugins/common/vignette.js
var vignette = __webpack_require__(47);
// EXTERNAL MODULE: ./src/lib/caman/plugins/common/posterize.js
var posterize = __webpack_require__(48);
// EXTERNAL MODULE: ./src/lib/caman/plugins/effects/edges.js
var edges = __webpack_require__(49);
// EXTERNAL MODULE: ./src/lib/caman/plugins/effects/grungy.js
var grungy = __webpack_require__(50);
// EXTERNAL MODULE: ./src/lib/caman/plugins/effects/hazyDays.js
var hazyDays = __webpack_require__(51);
// EXTERNAL MODULE: ./src/lib/caman/plugins/effects/lomo.js
var lomo = __webpack_require__(52);
// CONCATENATED MODULE: ./src/lib/caman/plugins/effects/compoundBlur.js
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* DS202: Simplify dynamic range loops
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
/*
CompoundBlur - Blurring with varying radii for Canvas
Version: 0.1
Author: Mario Klingemann
Contact: mario@quasimondo.com
Website: http://www.quasimondo.com/StackBlurForCanvas
Twitter: @quasimondo
Modified By: Ryan LeFevre (@meltingice)
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
Copyright (c) 2011 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.
*/
// Wrapping this in a closure since there's a bunch of extra functions this plugin requires
// and we don't want them clogging up the global scope.
(function () {
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];
var getLinearGradientMap = function getLinearGradientMap(width, height, centerX, centerY, angle, length, mirrored) {
var cnv = document.createElement('canvas');
cnv.width = width;
cnv.height = height;
var x1 = centerX + Math.cos(angle) * length * 0.5;
var y1 = centerY + Math.sin(angle) * length * 0.5;
var x2 = centerX - Math.cos(angle) * length * 0.5;
var y2 = centerY - Math.sin(angle) * length * 0.5;
var context = cnv.getContext("2d");
var gradient = context.createLinearGradient(x1, y1, x2, y2);
if (!mirrored) {
gradient.addColorStop(0, "white");
gradient.addColorStop(1, "black");
} else {
gradient.addColorStop(0, "white");
gradient.addColorStop(0.5, "black");
gradient.addColorStop(1, "white");
}
context.fillStyle = gradient;
context.fillRect(0, 0, width, height);
return context.getImageData(0, 0, width, height);
};
var getRadialGradientMap = function getRadialGradientMap(width, height, centerX, centerY, radius1, radius2) {
var cnv = document.createElement('canvas');
cnv.width = width;
cnv.height = height;
var context = cnv.getContext("2d");
var gradient = context.createRadialGradient(centerX, centerY, radius1, centerX, centerY, radius2);
gradient.addColorStop(1, "white");
gradient.addColorStop(0, "black");
context.fillStyle = gradient;
context.fillRect(0, 0, width, height);
return context.getImageData(0, 0, width, height);
};
var BlurStack = function BlurStack() {
this.r = 0;
this.g = 0;
this.b = 0;
this.a = 0;
return this.next = null;
};
Caman.Plugin.register("compoundBlur", function (radiusData, radius, increaseFactor, blurLevels) {
var i;
var asc, end;
var width = this.dimensions.width;
var height = this.dimensions.height;
var imagePixels = this.pixelData;
var radiusPixels = radiusData.data;
var wh = width * height;
var wh4 = wh << 2;
var pixels = [];
for (i = 0, end = wh4, asc = 0 <= end; asc ? i < end : i > end; asc ? i++ : i--) {
pixels[i] = imagePixels[i];
}
var currentIndex = 0;
var steps = blurLevels;
blurLevels -= 1;
while (steps-- >= 0) {
var asc1, end1;
var b_in_sum, b_out_sum, b_sum, g_in_sum, g_out_sum, g_sum, p, pb, pg, pr, r_in_sum, r_out_sum, r_sum, rbs, x, y, yi;
var asc2, end2;
var asc6, end6;
var iradius = radius + 0.5 | 0;
if (iradius === 0) {
continue;
}
if (iradius > 256) {
iradius = 256;
}
var div = iradius + iradius + 1;
var w4 = width << 2;
var widthMinus1 = width - 1;
var heightMinus1 = height - 1;
var radiusPlus1 = iradius + 1;
var sumFactor = radiusPlus1 * (radiusPlus1 + 1) / 2;
var stackStart = new BlurStack();
var stackEnd = undefined;
var stack = stackStart;
for (i = 1, end1 = div, asc1 = 1 <= end1; asc1 ? i < end1 : i > end1; asc1 ? i++ : i--) {
stack = stack.next = new BlurStack();
if (i === radiusPlus1) {
stackEnd = stack;
}
}
stack.next = stackStart;
var stackIn = null;
var stackOut = null;
var yw = yi = 0;
var mul_sum = mul_table[iradius];
var shg_sum = shg_table[iradius];
for (y = 0, end2 = height, asc2 = 0 <= end2; asc2 ? y < end2 : y > end2; asc2 ? y++ : y--) {
var asc3, end3;
var asc4, end4;
var asc5, end5;
r_in_sum = g_in_sum = b_in_sum = r_sum = g_sum = b_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]);
r_sum += sumFactor * pr;
g_sum += sumFactor * pg;
b_sum += sumFactor * pb;
stack = stackStart;
for (i = 0, end3 = radiusPlus1, asc3 = 0 <= end3; asc3 ? i < end3 : i > end3; asc3 ? i++ : i--) {
stack.r = pr;
stack.g = pg;
stack.b = pb;
stack = stack.next;
}
for (i = 1, end4 = radiusPlus1, asc4 = 1 <= end4; asc4 ? i < end4 : i > end4; asc4 ? i++ : 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;
r_in_sum += pr;
g_in_sum += pg;
b_in_sum += pb;
stack = stack.next;
}
stackIn = stackStart;
stackOut = stackEnd;
for (x = 0, end5 = width, asc5 = 0 <= end5; asc5 ? x < end5 : x > end5; asc5 ? x++ : x--) {
pixels[yi] = r_sum * mul_sum >> shg_sum;
pixels[yi + 1] = g_sum * mul_sum >> shg_sum;
pixels[yi + 2] = b_sum * mul_sum >> shg_sum;
r_sum -= r_out_sum;
g_sum -= g_out_sum;
b_sum -= b_out_sum;
r_out_sum -= stackIn.r;
g_out_sum -= stackIn.g;
b_out_sum -= stackIn.b;
p = yw + ((p = x + radiusPlus1) < 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];
r_sum += r_in_sum;
g_sum += g_in_sum;
b_sum += b_in_sum;
stackIn = stackIn.next;
r_out_sum += pr = stackOut.r;
g_out_sum += pg = stackOut.g;
b_out_sum += pb = stackOut.b;
r_in_sum -= pr;
g_in_sum -= pg;
b_in_sum -= pb;
stackOut = stackOut.next;
yi += 4;
}
yw += width;
}
for (x = 0, end6 = width, asc6 = 0 <= end6; asc6 ? x < end6 : x > end6; asc6 ? x++ : x--) {
var asc7, end7;
var asc8, end8;
var asc9, end9;
g_in_sum = b_in_sum = r_in_sum = g_sum = b_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]);
r_sum += sumFactor * pr;
g_sum += sumFactor * pg;
b_sum += sumFactor * pb;
stack = stackStart;
for (i = 0, end7 = radiusPlus1, asc7 = 0 <= end7; asc7 ? i < end7 : i > end7; asc7 ? i++ : i--) {
stack.r = pr;
stack.g = pg;
stack.b = pb;
stack = stack.next;
}
var yp = width;
for (i = 1, end8 = radiusPlus1, asc8 = 1 <= end8; asc8 ? i < end8 : i > end8; asc8 ? i++ : 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;
r_in_sum += pr;
g_in_sum += pg;
b_in_sum += pb;
stack = stack.next;
if (i < heightMinus1) {
yp += width;
}
}
yi = x;
stackIn = stackStart;
stackOut = stackEnd;
for (y = 0, end9 = height, asc9 = 0 <= end9; asc9 ? y < end9 : y > end9; asc9 ? y++ : y--) {
p = yi << 2;
pixels[p] = r_sum * mul_sum >> shg_sum;
pixels[p + 1] = g_sum * mul_sum >> shg_sum;
pixels[p + 2] = b_sum * mul_sum >> shg_sum;
r_sum -= r_out_sum;
g_sum -= g_out_sum;
b_sum -= b_out_sum;
r_out_sum -= stackIn.r;
g_out_sum -= stackIn.g;
b_out_sum -= stackIn.b;
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];
stackIn = stackIn.next;
r_out_sum += pr = stackOut.r;
g_out_sum += pg = stackOut.g;
b_out_sum += pb = stackOut.b;
r_in_sum -= pr;
g_in_sum -= pg;
b_in_sum -= pb;
stackOut = stackOut.next;
yi += width;
}
}
radius *= increaseFactor;
i = wh;
while (--i > -1) {
var idx = i << 2;
var lookupValue = (radiusPixels[idx + 2] & 0xff) / 255.0 * blurLevels;
var index = lookupValue | 0;
if (index === currentIndex) {
var blend = 256.0 * (lookupValue - (lookupValue | 0));
var iblend = 256 - blend;
imagePixels[idx] = imagePixels[idx] * iblend + pixels[idx] * blend >> 8;
imagePixels[idx + 1] = imagePixels[idx + 1] * iblend + pixels[idx + 1] * blend >> 8;
imagePixels[idx + 2] = imagePixels[idx + 2] * iblend + pixels[idx + 2] * blend >> 8;
} else if (index === currentIndex + 1) {
imagePixels[idx] = pixels[idx];
imagePixels[idx + 1] = pixels[idx + 1];
imagePixels[idx + 2] = pixels[idx + 2];
}
}
currentIndex++;
}
return this;
});
Caman.Filter.register("tiltShift", function (opts) {
var defaults = {
center: {
x: this.dimensions.width / 2,
y: this.dimensions.height / 2
},
angle: 45,
focusWidth: 200,
startRadius: 3,
radiusFactor: 1.5,
steps: 3
};
opts = util["b" /* Util */].extend(defaults, opts);
opts.angle *= Math.PI / 180;
var gradient = getLinearGradientMap(this.dimensions.width, this.dimensions.height, opts.center.x, opts.center.y, opts.angle, opts.focusWidth, true);
return this.processPlugin("compoundBlur", [gradient, opts.startRadius, opts.radiusFactor, opts.steps]);
});
return Caman.Filter.register("radialBlur", function (opts) {
var defaults = {
size: 50,
center: {
x: this.dimensions.width / 2,
y: this.dimensions.height / 2
},
startRadius: 3,
radiusFactor: 1.5,
steps: 3,
radius: null
};
opts = util["b" /* Util */].extend(defaults, opts);
if (!opts.radius) {
opts.radius = this.dimensions.width < this.dimensions.height ? this.dimensions.height : this.dimensions.width;
}
var radius1 = opts.radius / 2 - opts.size;
var radius2 = opts.radius / 2;
var gradient = getRadialGradientMap(this.dimensions.width, this.dimensions.height, opts.center.x, opts.center.y, radius1, radius2);
return this.processPlugin("compoundBlur", [gradient, opts.startRadius, opts.radiusFactor, opts.steps]);
});
})();
// EXTERNAL MODULE: ./src/lib/caman/plugins/effects/sinCity.js
var sinCity = __webpack_require__(53);
// EXTERNAL MODULE: ./src/lib/caman/plugins/filters/crossProcess.js
var crossProcess = __webpack_require__(54);
// EXTERNAL MODULE: ./src/lib/caman/plugins/filters/glowingSun.js
var glowingSun = __webpack_require__(55);
// EXTERNAL MODULE: ./src/lib/caman/plugins/filters/jarques.js
var jarques = __webpack_require__(56);
// EXTERNAL MODULE: ./src/lib/caman/plugins/filters/love.js
var love = __webpack_require__(57);
// EXTERNAL MODULE: ./src/lib/caman/plugins/filters/oldBoot.js
var oldBoot = __webpack_require__(58);
// EXTERNAL MODULE: ./src/lib/caman/plugins/filters/orangePeel.js
var orangePeel = __webpack_require__(59);
// EXTERNAL MODULE: ./src/lib/caman/plugins/filters/pinhole.js
var pinhole = __webpack_require__(60);
// EXTERNAL MODULE: ./src/lib/caman/plugins/filters/sunrise.js
var sunrise = __webpack_require__(61);
// EXTERNAL MODULE: ./src/lib/caman/plugins/filters/vintage.js
var vintage = __webpack_require__(62);
// CONCATENATED MODULE: ./src/lib/caman/plugins/rotate.js
Caman.Plugin.register("rotate", function (degrees) {
var angle, canvas, ctx, height, to_radians, width, x, y;
angle = degrees % 360;
if (angle === 0) {
return this.dimensions = {
width: this.canvas.width,
height: this.canvas.height
};
}
to_radians = Math.PI / 180;
canvas = document.createElement('canvas');
util["b" /* Util */].copyAttributes(this.canvas, canvas);
if (angle === 90 || angle === -270 || angle === 270 || angle === -90) {
width = this.canvas.height;
height = this.canvas.width;
x = width / 2;
y = height / 2;
} else if (angle === 180) {
width = this.canvas.width;
height = this.canvas.height;
x = width / 2;
y = height / 2;
} else {
var sinAngle = Math.sin(toDegrees(Math.abs(angle)));
var cosAngle = Math.cos(toDegrees(Math.abs(angle)));
width = Math.abs(Math.abs(this.canvas.height * sinAngle) - Math.abs(this.canvas.width * cosAngle));
height = Math.abs(Math.abs(this.canvas.height * cosAngle) - Math.abs(this.canvas.width * sinAngle));
x = width / 2;
y = height / 2;
}
canvas.width = width;
canvas.height = height;
ctx = canvas.getContext('2d');
ctx.save();
ctx.translate(x, y);
ctx.rotate(angle * to_radians);
ctx.drawImage(this.canvas, -this.canvas.width / 2, -this.canvas.height / 2, this.canvas.width, this.canvas.height);
ctx.restore();
this.angle += degrees;
this.rotated = true;
return this.replaceCanvas(canvas);
});
Caman.Filter.register("rotate", function () {
return this.processPlugin("rotate", Array.prototype.slice.call(arguments, 0));
});
function toDegrees(angle) {
return angle * (Math.PI / 180);
}
// EXTERNAL MODULE: ./src/lib/caman/plugins/stackBlur.js
var stackBlur = __webpack_require__(63);
// EXTERNAL MODULE: ./src/lib/caman/plugins/flip.js
var flip = __webpack_require__(64);
// CONCATENATED MODULE: ./src/lib/caman/index.js
//import './core/analyze';
//import './core/autoload';
// Common
// Effects
// Filters
//import './plugins/_other/clarity';
//import './plugins/_other/herMajesty';
//import './plugins/_other/nostalgia';
//import './plugins/_other/hemingway';
//import './plugins/_other/concentrate';
//import './plugins/threshold';
// CONCATENATED MODULE: ./src/ImageEditor.js
function ImageEditor_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ImageEditor_typeof = function _typeof(obj) { return typeof obj; }; } else { ImageEditor_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ImageEditor_typeof(obj); }
function ImageEditor_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function ImageEditor_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ImageEditor_ownKeys(Object(source), true).forEach(function (key) { ImageEditor_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ImageEditor_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function ImageEditor_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function ImageEditor_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function ImageEditor_createClass(Constructor, protoProps, staticProps) { if (protoProps) ImageEditor_defineProperties(Constructor.prototype, protoProps); if (staticProps) ImageEditor_defineProperties(Constructor, staticProps); return Constructor; }
function ImageEditor_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) ImageEditor_setPrototypeOf(subClass, superClass); }
function ImageEditor_setPrototypeOf(o, p) { ImageEditor_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ImageEditor_setPrototypeOf(o, p); }
function ImageEditor_createSuper(Derived) { var hasNativeReflectConstruct = ImageEditor_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = ImageEditor_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = ImageEditor_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return ImageEditor_possibleConstructorReturn(this, result); }; }
function ImageEditor_possibleConstructorReturn(self, call) { if (call && (ImageEditor_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return ImageEditor_assertThisInitialized(self); }
function ImageEditor_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function ImageEditor_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function ImageEditor_getPrototypeOf(o) { ImageEditor_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return ImageEditor_getPrototypeOf(o); }
function ImageEditor_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var ImageEditor_INITIAL_PARAMS = {
effect: null,
filter: null,
crop: null,
resize: null,
rotate: null,
correctionDegree: 0,
flipX: false,
flipY: false,
adjust: {
brightness: 0,
contrast: 0,
saturation: 0,
exposure: 0
},
canvasDimensions: {
width: 300,
height: 200,
ratio: 1.5
}
};
/* Mod ??? - check operations before closing */
var _propsImageEditor;
/* Mod ??? - check operations before closing */
var ImageEditor_default = /*#__PURE__*/function (_Component) {
ImageEditor_inherits(_default, _Component);
var _super = ImageEditor_createSuper(_default);
function _default(_props) {
var _this;
ImageEditor_classCallCheck(this, _default);
_this = _super.call(this);
ImageEditor_defineProperty(ImageEditor_assertThisInitialized(_this), "_isMounted", false);
ImageEditor_defineProperty(ImageEditor_assertThisInitialized(_this), "loadImage", function () {
var src = _this.props.src;
var _this$state = _this.state,
_this$state$reduceBef = _this$state.reduceBeforeEdit;
/* Mod ??? - check operations before closing */
_propsImageEditor = _this;
/* Mod ??? - check operations before closing */
_this$state$reduceBef = _this$state$reduceBef === void 0 ? {} : _this$state$reduceBef;
var mode = _this$state$reduceBef.mode,
widthLimit = _this$state$reduceBef.widthLimit,
heightLimit = _this$state$reduceBef.heightLimit,
watermark = _this$state.watermark;
if (src instanceof Blob) {
src = URL.createObjectURL(src);
}
var splittedSrc = src.split('/');
var imageName = splittedSrc[splittedSrc.length - 1];
var img = new Image();
var logoImage = null;
if (watermark && watermark.url) {
logoImage = new Image();
logoImage.setAttribute('crossOrigin', 'Anonymous');
logoImage.src = watermark.url + (watermark.url.indexOf('?') > -1 ? '&' : '?') + new Date().getTime();
}
img.setAttribute('crossOrigin', 'Anonymous');
img.src = src;
if (!src.startsWith('data:image/') && !src.startsWith('blob:')) {
// Image is not a blob, insert query param to avoid caching
img.src = img.src + (img.src.indexOf('?') > -1 ? '&version=' : '?version=') + new Date().getTime();
}
img.onload = function () {
var canvasDimensions = {
width: img.width,
height: img.height,
ratio: img.width / img.height
};
var propsOnApply = {
activeBody: 'preResize',
isShowSpinner: false,
img: img,
logoImage: logoImage,
imageName: imageName.indexOf('?') > -1 ? imageName.slice(0, imageName.indexOf('?')) : imageName
};
if (mode === 'manual' && (widthLimit < img.width || heightLimit < img.height)) {
_this.setState(ImageEditor_objectSpread({
canvasDimensions: canvasDimensions
}, propsOnApply));
} else if (mode === 'auto' && (widthLimit < img.width || heightLimit < img.height)) {
if (img.width >= img.height) {
var ratio = img.width / img.height;
var dimensions = {
ratio: ratio,
width: widthLimit,
height: widthLimit / ratio
};
_this.setState(ImageEditor_objectSpread(ImageEditor_objectSpread({
preCanvasDimensions: ImageEditor_objectSpread({}, dimensions),
canvasDimensions: ImageEditor_objectSpread({}, dimensions)
}, propsOnApply), {}, {
activeBody: 'preview',
isPreResize: true
}));
} else {
var _ratio = img.height / img.width;
var _dimensions = {
ratio: _ratio,
width: heightLimit / _ratio,
height: heightLimit
};
_this.setState(ImageEditor_objectSpread(ImageEditor_objectSpread({
preCanvasDimensions: ImageEditor_objectSpread({}, _dimensions),
canvasDimensions: ImageEditor_objectSpread({}, _dimensions)
}, propsOnApply), {}, {
activeBody: 'preview',
isPreResize: true
}));
}
} else {
var config = _this.props.config;
var tools = config.tools;
var isOneTool = tools.length === 1;
var activeTab;
if (isOneTool) {
activeTab = tools[0];
}
/* Mod ??? custom action */
if (config.activeTabDefault!=undefined
&& config.activeTabDefault){
activeTab = config.activeTabDefault;
delete config.activeTabDefault
}
/* Mod ??? custom action */
_this.setState(ImageEditor_objectSpread(ImageEditor_objectSpread({}, propsOnApply), {}, {
activeBody: 'preview',
isPreResize: false
}), function () {
_this.setState({
activeTab: activeTab
});
});
}
};
});
ImageEditor_defineProperty(ImageEditor_assertThisInitialized(_this), "determineImageType", function () {
var src = _this.props.src;
if (src instanceof Blob) {
_this.setState({
imageMime: src.type
});
return;
}
var xhr = new XMLHttpRequest();
xhr.open('GET', src);
xhr.responseType = 'arraybuffer';
xhr.onload = function (_ref) {
var _imageType;
var target = _ref.target;
/* Mod ??? */
var _imageTypeSet = ((_imageType = image_type_default()(new Uint8Array(target.response))) === null || _imageType === void 0 ? void 0 : _imageType.mime);
if (typeof _imageTypeSet == 'undefined') {
_this.props.onError('error_load_src');
_this.props.onClose(ON_CLOSE_STATUSES.CLOSE_BTN_CLICKED);
return;
}
// TODO: GOOD HACK FOR A TEMP SOLUTION IMAGES & SVG BUT NEED ANOTHER WAY TO MAKE SURE THAT WE COVER MOST OF POSSIBLE IMGS
_this.setState({
imageMime: _imageTypeSet || 'image/svg+xml'
});
/* Mod ??? */
};
xhr.send();
});
ImageEditor_defineProperty(ImageEditor_assertThisInitialized(_this), "updateState", function (props) {
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
if (_this._isMounted) {
var editorWrapperId = _this.props.config.elementId;
var canvas = get_canvas_node_getCanvasNode(editorWrapperId);
if (canvas) {
props.latestCanvasSize = {
width: canvas.width,
height: canvas.height
};
}
_this.setState(props, callback);
}
});
ImageEditor_defineProperty(ImageEditor_assertThisInitialized(_this), "onRevert", function () {
var _this$state2 = _this.state,
cancelLastOperation = _this$state2.cancelLastOperation,
activeTab = _this$state2.activeTab;
_this.setState({
activeTab: null,
isHideCanvas: true,
isShowSpinner: true
});
cancelLastOperation(activeTab, function () {
_this.setState(ImageEditor_objectSpread({
isHideCanvas: false,
isShowSpinner: false
}, ImageEditor_INITIAL_PARAMS));
});
});
ImageEditor_defineProperty(ImageEditor_assertThisInitialized(_this), "onAdjust", function (handler, value) {
var onAdjust = _this.state.onAdjust;
onAdjust(handler, value);
});
ImageEditor_defineProperty(ImageEditor_assertThisInitialized(_this), "onRotate", function (value, correctionDegree, flipX, flipY) {
var onRotate = _this.state.onRotate;
onRotate(value, correctionDegree, flipX, flipY);
});
ImageEditor_defineProperty(ImageEditor_assertThisInitialized(_this), "onFlip", function (axis) {
var flip = _this.state.flip;
flip(axis);
});
ImageEditor_defineProperty(ImageEditor_assertThisInitialized(_this), "onSave", function () {
var isSaveAs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
var saveImage = _this.state.saveImage;
if (!isSaveAs) {
_this.setState({
isShowSpinner: true
});
}
saveImage(isSaveAs);
});
ImageEditor_defineProperty(ImageEditor_assertThisInitialized(_this), "onDownloadImage", function () {
var onBeforeComplete = _this.props.onBeforeComplete;
var _this$state3 = _this.state,
downloadImage = _this$state3.downloadImage,
getResultCanvas = _this$state3.getResultCanvas,
imageMime = _this$state3.imageMime,
imageName = _this$state3.imageName;
var canvas = getResultCanvas();
var returnedImgObject = {
imageMime: imageMime,
imageName: imageName,
canvas: canvas
};
var isDownload = onBeforeComplete ? onBeforeComplete(ImageEditor_objectSpread({
status: 'before-complete'
}, returnedImgObject)) : true;
if (isDownload) {
downloadImage(function () {
_this.props.onComplete(ImageEditor_objectSpread({
status: 'success'
}, returnedImgObject));
_this.props.onClose(ON_CLOSE_STATUSES.IMAGE_DOWNLOADED);
});
} else {
/* Mod ??? */
var _operations,
initialZoom = _this$state3.initialZoom,
operationsZoomed = _this$state3.operationsZoomed;
if (initialZoom === 1) {
_operations={length: _this$state3.operations.length, operations: _this$state3.operations};
//_operations={length: _this$state3.operationsOriginal.length, operations: _this$state3.operationsOriginal};
} else {
_operations={length: _this$state3.operationsZoomed.length, operations: _this$state3.operationsZoomed};
}
_this.props.onComplete(ImageEditor_objectSpread({
operations: _operations,
/* Mod ??? */
status: 'success'
}, returnedImgObject));
_this.props.onClose(ON_CLOSE_STATUSES.IMAGE_EDITS_COMPLETED);
}
});
ImageEditor_defineProperty(ImageEditor_assertThisInitialized(_this), "onApplyEffects", function (name) {
var _this$state4 = _this.state,
applyCorrections = _this$state4.applyCorrections,
effect = _this$state4.effect;
var nextEffect = effect === name ? null : name;
_this.setState({
isShowSpinner: true,
effect: nextEffect
}, function () {
applyCorrections(function () {
_this.setState({
isShowSpinner: false
});
});
});
});
ImageEditor_defineProperty(ImageEditor_assertThisInitialized(_this), "onApplyFilters", function (name) {
var _this$state5 = _this.state,
applyCorrections = _this$state5.applyCorrections,
filter = _this$state5.filter;
var nextFilter = filter === name ? null : name;
_this.setState({
isShowSpinner: true,
filter: nextFilter
}, function () {
applyCorrections(function () {
_this.setState({
isShowSpinner: false
});
});
});
});
ImageEditor_defineProperty(ImageEditor_assertThisInitialized(_this), "handleSave", function () {
var isSaveAs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
var _this$state6 = _this.state,
processWithFilerobot = _this$state6.processWithFilerobot,
processWithCloudService = _this$state6.processWithCloudService;
if (!processWithFilerobot && !processWithCloudService) {
_this.onDownloadImage();
} else {
_this.onSave(isSaveAs);
}
});
ImageEditor_defineProperty(ImageEditor_assertThisInitialized(_this), "apply", function (callback) {
var _this$state7 = _this.state,
activeTab = _this$state7.activeTab,
applyChanges = _this$state7.applyChanges;
applyChanges(activeTab, callback);
_this.setState({
activeTab: null
});
});
ImageEditor_defineProperty(ImageEditor_assertThisInitialized(_this), "redoOperation", function (_ref2) {
var operationIndex = _ref2.operationIndex,
_ref2$callback = _ref2.callback,
callback = _ref2$callback === void 0 ? function () {} : _ref2$callback,
_ref2$resetActiveTab = _ref2.resetActiveTab,
resetActiveTab = _ref2$resetActiveTab === void 0 ? true : _ref2$resetActiveTab,
_ref2$operationObject = _ref2.operationObject,
operationObject = _ref2$operationObject === void 0 ? {} : _ref2$operationObject;
var applyOperations = _this.state.applyOperations;
if (resetActiveTab) {
_this.setState({
activeTab: null,
isHideCanvas: true,
isShowSpinner: true
});
} else {
_this.setState({
isHideCanvas: true,
isShowSpinner: true
});
}
applyOperations(operationIndex, function () {
_this.setState({
isHideCanvas: false,
isShowSpinner: false
}, callback);
}, operationObject);
});
ImageEditor_defineProperty(ImageEditor_assertThisInitialized(_this), "resetOperations", function () {
var resetAll = _this.state.resetAll;
_this.setState({
activeTab: null,
isHideCanvas: true,
isShowSpinner: true
});
resetAll(function () {
_this.setState(ImageEditor_objectSpread({
isHideCanvas: false,
isShowSpinner: false
}, ImageEditor_INITIAL_PARAMS));
});
});
ImageEditor_defineProperty(ImageEditor_assertThisInitialized(_this), "onPreResize", function (value) {
var config = _this.props.config;
var tools = config.tools;
var isOneTool = tools.length === 1;
var activeTab;
if (isOneTool) {
activeTab = tools[0];
}
switch (value) {
case 'keep':
_this.setState({
canvasDimensions: {},
isPreResize: false,
activeBody: 'preview'
}, function () {
_this.setState({
activeTab: activeTab
});
});
break;
case 'resize':
var canvasDimensions = _this.state.canvasDimensions;
_this.setState({
preCanvasDimensions: canvasDimensions,
isPreResize: true,
activeBody: 'preview'
}, function () {
_this.setState({
activeTab: activeTab
});
});
break;
}
});
var _props$config = _props.config,
processWithCloudimage = _props$config.processWithCloudimage,
_processWithFilerobot = _props$config.processWithFilerobot,
_processWithCloudService = _props$config.processWithCloudService,
uploadWithCloudimageLink = _props$config.uploadWithCloudimageLink,
reduceBeforeEdit = _props$config.reduceBeforeEdit,
cropBeforeEdit = _props$config.cropBeforeEdit,
_watermark = _props$config.watermark,
imageSealing = _props$config.imageSealing;
_this.state = ImageEditor_objectSpread(ImageEditor_objectSpread({
isShowSpinner: true,
isHideCanvas: false,
activeTab: null,
activeBody: null,
currentOperation: null,
original: {
width: 300,
height: 200
},
cropDetails: {
width: 300,
height: 200
},
canvasDimensions: {
width: 300,
height: 200,
ratio: 1.5
},
processWithFilerobot: _processWithFilerobot,
processWithCloudimage: processWithCloudimage,
processWithCloudService: _processWithCloudService,
uploadCloudimageImage: uploadWithCloudimageLink,
reduceBeforeEdit: reduceBeforeEdit,
cropBeforeEdit: cropBeforeEdit,
roundCrop: false,
imageSealing: ImageEditor_objectSpread({
enabled: false,
salt: '',
char_count: 10,
include_params: null
/* include all by default */
}, imageSealing),
operationsOriginal: [],
operationsZoomed: [],
operations: [],
canvasZoomed: null,
canvasOriginal: null,
isPreResize: false,
initialZoom: 1
}, ImageEditor_INITIAL_PARAMS), {}, {
watermark: _watermark || DEFAULT_WATERMARK,
focusPoint: {
x: null,
y: null
},
shapes: [],
selectedShape: {},
availableShapes: []
});
return _this;
}
ImageEditor_createClass(_default, [{
key: "componentDidMount",
value: function componentDidMount() {
this._isMounted = true;
this.loadImage();
this.determineImageType();
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
this._isMounted = false;
}
}, {
key: "render",
value: function render() {
var _this$state8 = this.state,
isShowSpinner = _this$state8.isShowSpinner,
activeTab = _this$state8.activeTab,
operations = _this$state8.operations,
operationsOriginal = _this$state8.operationsOriginal,
operationsZoomed = _this$state8.operationsZoomed,
currentOperation = _this$state8.currentOperation,
isHideCanvas = _this$state8.isHideCanvas,
cropDetails = _this$state8.cropDetails,
original = _this$state8.original,
canvasDimensions = _this$state8.canvasDimensions,
processWithCloudimage = _this$state8.processWithCloudimage,
processWithFilerobot = _this$state8.processWithFilerobot,
processWithCloudService = _this$state8.processWithCloudService,
uploadCloudimageImage = _this$state8.uploadCloudimageImage,
imageMime = _this$state8.imageMime,
lastOperation = _this$state8.lastOperation,
operationList = _this$state8.operationList,
initialZoom = _this$state8.initialZoom,
canvasZoomed = _this$state8.canvasZoomed,
canvasOriginal = _this$state8.canvasOriginal,
reduceBeforeEdit = _this$state8.reduceBeforeEdit,
cropBeforeEdit = _this$state8.cropBeforeEdit,
img = _this$state8.img,
imageName = _this$state8.imageName,
activeBody = _this$state8.activeBody,
isPreResize = _this$state8.isPreResize,
preCanvasDimensions = _this$state8.preCanvasDimensions,
logoImage = _this$state8.logoImage,
imageSealing = _this$state8.imageSealing,
effect = _this$state8.effect,
filter = _this$state8.filter,
crop = _this$state8.crop,
roundCrop = _this$state8.roundCrop,
resize = _this$state8.resize,
rotate = _this$state8.rotate,
correctionDegree = _this$state8.correctionDegree,
flipX = _this$state8.flipX,
flipY = _this$state8.flipY,
adjust = _this$state8.adjust,
watermark = _this$state8.watermark,
focusPoint = _this$state8.focusPoint,
shapes = _this$state8.shapes,
shapeOperations = _this$state8.shapeOperations,
selectedShape = _this$state8.selectedShape,
availableShapes = _this$state8.availableShapes,
latestCanvasSize = _this$state8.latestCanvasSize;
var _this$props = this.props,
src = _this$props.src,
config = _this$props.config,
onClose = _this$props.onClose,
onComplete = _this$props.onComplete,
onError = _this$props.onError,
_this$props$closeOnLo = _this$props.closeOnLoad,
closeOnLoad = _this$props$closeOnLo === void 0 ? true : _this$props$closeOnLo,
_this$props$t = _this$props.t,
t = _this$props$t === void 0 ? {} : _this$props$t,
theme = _this$props.theme;
var imageParams = {
effect: effect,
filter: filter,
crop: crop,
resize: resize,
rotate: rotate,
flipX: flipX,
flipY: flipY,
adjust: adjust,
correctionDegree: correctionDegree
};
var headerProps = ImageEditor_objectSpread(ImageEditor_objectSpread({
t: t,
theme: theme,
cropDetails: cropDetails,
original: original,
activeTab: activeTab,
src: src,
onClose: onClose,
config: config,
canvasDimensions: canvasDimensions,
processWithCloudimage: processWithCloudimage,
processWithFilerobot: processWithFilerobot,
processWithCloudService: processWithCloudService,
operations: operations,
operationsOriginal: operationsOriginal,
operationsZoomed: operationsZoomed,
initialZoom: initialZoom,
isShowSpinner: isShowSpinner,
img: img,
logoImage: logoImage,
imageName: imageName,
activeBody: activeBody,
preCanvasDimensions: preCanvasDimensions,
updateState: this.updateState,
onRevert: this.onRevert,
apply: this.apply,
onSave: this.onSave,
onFlip: this.onFlip,
onApplyEffects: this.onApplyEffects,
onApplyFilters: this.onApplyFilters,
onRotate: this.onRotate,
onAdjust: this.onAdjust,
onDownloadImage: this.onDownloadImage,
handleSave: this.handleSave
}, imageParams), {}, {
watermark: watermark,
focusPoint: focusPoint,
shapes: shapes,
shapeOperations: shapeOperations,
selectedShape: selectedShape,
availableShapes: availableShapes
});
var previewProps = ImageEditor_objectSpread(ImageEditor_objectSpread({
t: t,
theme: theme,
cropDetails: cropDetails,
original: original,
activeTab: activeTab,
isShowSpinner: isShowSpinner,
operations: operations,
operationsOriginal: operationsOriginal,
operationsZoomed: operationsZoomed,
initialZoom: initialZoom,
currentOperation: currentOperation,
isHideCanvas: isHideCanvas,
src: src,
imageMime: imageMime,
onClose: onClose,
onComplete: onComplete,
onError: onError,
canvasDimensions: canvasDimensions,
closeOnLoad: closeOnLoad,
config: config,
processWithCloudimage: processWithCloudimage,
processWithFilerobot: processWithFilerobot,
processWithCloudService: processWithCloudService,
imageSealing: imageSealing,
uploadCloudimageImage: uploadCloudimageImage,
lastOperation: lastOperation,
operationList: operationList,
canvasZoomed: canvasZoomed,
canvasOriginal: canvasOriginal,
reduceBeforeEdit: reduceBeforeEdit,
cropBeforeEdit: cropBeforeEdit,
img: img,
logoImage: logoImage,
imageName: imageName,
isPreResize: isPreResize,
preCanvasDimensions: preCanvasDimensions,
updateState: this.updateState,
handleSave: this.handleSave,
onPreResize: this.onPreResize,
redoOperation: this.redoOperation,
roundCrop: roundCrop
}, imageParams), {}, {
watermark: watermark,
focusPoint: focusPoint,
shapes: shapes,
shapeOperations: shapeOperations,
selectedShape: selectedShape,
latestCanvasSize: latestCanvasSize
});
var footerProps = {
logoImage: logoImage,
t: t,
theme: theme,
activeBody: activeBody,
operations: operations,
operationsOriginal: operationsOriginal,
operationsZoomed: operationsZoomed,
initialZoom: initialZoom,
currentOperation: currentOperation,
processWithCloudimage: processWithCloudimage,
processWithCloudService: processWithCloudService,
updateState: this.updateState,
redoOperation: this.redoOperation,
resetOperations: this.resetOperations,
config: config,
watermark: watermark
};
return /*#__PURE__*/Object(jsx_runtime["jsxs"])(Wrapper, {
roundCrop: roundCrop,
isLoading: isShowSpinner,
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(Header_default, ImageEditor_objectSpread({}, headerProps)), /*#__PURE__*/Object(jsx_runtime["jsxs"])(PreviewWrapper, {
children: [activeBody === 'preview' && /*#__PURE__*/Object(jsx_runtime["jsx"])(Preview_default, ImageEditor_objectSpread({}, previewProps)), activeBody === 'preResize' && /*#__PURE__*/Object(jsx_runtime["jsx"])(PreResize_default, ImageEditor_objectSpread({}, previewProps)), /*#__PURE__*/Object(jsx_runtime["jsx"])(Spinner_Spinner, {
overlay: true,
show: isShowSpinner,
label: t['spinner.label']
})]
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(Footer_default, ImageEditor_objectSpread({}, footerProps))]
});
}
}]);
return _default;
}(react["Component"]);
// CONCATENATED MODULE: ./src/components/CloseBtn.js
var components_CloseBtn_templateObject;
function components_CloseBtn_taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
var CloseBtn_CloseBtn = styled_components_browser_esm["b" /* default */].span.attrs(function () {
return {
role: 'button'
};
})(components_CloseBtn_templateObject || (components_CloseBtn_templateObject = components_CloseBtn_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n cursor: pointer;\n position: absolute;\n font-weight: normal;\n top: ", ";\n right: ", ";\n left: ", ";\n bottom: ", ";\n font-size: ", ";\n z-index: 10;\n font-family: 'filerobot-image-editor-font' !important;\n color: ", ";\n speak: none;\n font-style: normal;\n font-variant: normal;\n text-transform: none;\n line-height: 1;\n\n /* Better Font Rendering =========== */\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n \n #filerobot-image-editor-root &:hover {\n color: ", ";\n }\n \n #filerobot-image-editor-root &:before {\n content: '\\e90c'\n }\n"], ["\n#filerobot-image-editor-root & {\n cursor: pointer;\n position: absolute;\n font-weight: normal;\n top: ", ";\n right: ", ";\n left: ", ";\n bottom: ", ";\n font-size: ", ";\n z-index: 10;\n font-family: 'filerobot-image-editor-font' !important;\n color: ", ";\n speak: none;\n font-style: normal;\n font-variant: normal;\n text-transform: none;\n line-height: 1;\n\n /* Better Font Rendering =========== */\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n \n #filerobot-image-editor-root &:hover {\n color: ", ";\n }\n \n #filerobot-image-editor-root &:before {\n content: '\\\\e90c'\n }\n"])), function (props) {
return props.t || '10px';
}, function (props) {
return props.r || '10px';
}, function (props) {
return props.l || 'auto';
}, function (props) {
return props.b || 'auto';
}, function (props) {
return props.fz || '18px';
}, function () {
return variables.modal.colorMuted;
}, function (props) {
return variables.modal.colorMutedHover;
});
// CONCATENATED MODULE: ./src/components/Modal.js
function Modal_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { Modal_typeof = function _typeof(obj) { return typeof obj; }; } else { Modal_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return Modal_typeof(obj); }
var Modal_excluded = ["onClose", "isHideCloseBtn", "configModalId"];
var Modal_templateObject, Modal_templateObject2, Modal_templateObject3;
function Modal_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function Modal_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { Modal_ownKeys(Object(source), true).forEach(function (key) { Modal_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { Modal_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function Modal_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = Modal_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function Modal_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function Modal_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function Modal_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function Modal_createClass(Constructor, protoProps, staticProps) { if (protoProps) Modal_defineProperties(Constructor.prototype, protoProps); if (staticProps) Modal_defineProperties(Constructor, staticProps); return Constructor; }
function Modal_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) Modal_setPrototypeOf(subClass, superClass); }
function Modal_setPrototypeOf(o, p) { Modal_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return Modal_setPrototypeOf(o, p); }
function Modal_createSuper(Derived) { var hasNativeReflectConstruct = Modal_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Modal_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Modal_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Modal_possibleConstructorReturn(this, result); }; }
function Modal_possibleConstructorReturn(self, call) { if (call && (Modal_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return Modal_assertThisInitialized(self); }
function Modal_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function Modal_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function Modal_getPrototypeOf(o) { Modal_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return Modal_getPrototypeOf(o); }
function Modal_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function Modal_taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
/* Mod ??? opacity: 0.7 background modal - OLD opacity: .4; */
var ModalOverlay = styled_components_browser_esm["b" /* default */].div(Modal_templateObject || (Modal_templateObject = Modal_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow: hidden;\n position: fixed;\n background: ", ";\n opacity: .7;\n}\n"])), function (props) {
return variables.colors.background.base || '#000';
});
var ModalContent = styled_components_browser_esm["b" /* default */].div(Modal_templateObject2 || (Modal_templateObject2 = Modal_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n position: relative;\n display: -webkit-box;\n display: -webkit-flex;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -webkit-flex-direction: column;\n -ms-flex-direction: column;\n flex-direction: column;\n -webkit-background-clip: padding-box;\n background-clip: padding-box;\n border: ", " solid ", ";\n border-radius: ", ";\n overflow: hidden;\n outline: 0;\n height: ", ";\n background: ", ";\n color: ", ";\n}\n"])), function (props) {
return props.noBorder ? 0 : '1px';
}, function (props) {
return props.noBorder ? 'transparent' : variables.colors.border.base || '#B0B0B0';
}, function (props) {
return props.noBorder ? 0 : variables.radii[3];
}, function (props) {
return props.h || props.height || 'auto';
}, function (props) {
return variables.colors.background.base || '#fff';
}, function (props) {
return variables.colors.text || '#3d3d3d';
});
/* Mod ??? add style - box-shadow: 0 0 20px rgb(0 0 0 / 30%);*/
/*font-family: 'Roboto',*/
var ModalFullScreen = styled_components_browser_esm["b" /* default */].div(Modal_templateObject3 || (Modal_templateObject3 = Modal_taggedTemplateLiteral(["\n#filerobot-image-editor-root & {\n azimuth: center;\n border-collapse: separate;\n border-spacing: 0;\n caption-side: top;\n cursor: auto;\n direction: ltr;\n elevation: level;\n empty-cells: show;\n font-size: medium;\n font-style: medium;\n font-variant: medium;\n font-weight: medium;\n letter-spacing: normal;\n line-height: medium;\n list-style-image: none;\n list-style-position: outside;\n list-style-type: disc;\n list-style: disc outside none;\n orphans: 2;\n pitch-range: 50;\n pitch: medium;\n quotes: '\"' '\"';\n richness: 50;\n speak-header: once;\n speak-numeral: continuous;\n speak-punctuation: none;\n speak: normal;\n speech-rate: medium;\n stress: 50;\n text-align: left;\n text-indent: 0;\n text-transform: none;\n visibility: visible;\n voice-family: none;\n volume: medium;\n white-space: normal;\n widows: 2;\n word-spacing: 0;\n position: fixed;\n padding: ", ";\n top: 5%;\n left: 15%;\n right: 15%;\n bottom: 5%;\n color: ", ";\n overflow: hidden;\n z-index: ", ";\n display: block;\n animation: scaleflexFadeInAnimation 350ms ease-in-out both;\n font-family: 'Arial', sans-serif;\n box-shadow: 0 0 20px rgb(0 0 0 / 30%);\n filter: drop-shadow(0px 2px 4px rgba(77, 78, 78, 0.25));\n \n ", ";\n}\n \n @keyframes scaleflexFadeInAnimation {\n from {opacity: 0;}\n to {opacity: 1;}\n }\n \n @media (max-width: 1000px) {\n#filerobot-image-editor-root & {\n top: 20px;\n left: 20px;\n bottom: 20px;\n right: 20px\n}\n }\n"])), function (props) {
return props.p || props.padding || '0';
}, function (props) {
return variables.colors.text || '#3d3d3d';
}, function (props) {
return props.zIndex || '';
}, function (props) {
return props.isTooSmall ? getSmallModalStyle() : '';
});
function getSmallModalStyle() {
return "\n top: 20% !important;\n left: 15px !important;\n right: 15px !important;\n bottom: auto !important;\n color: black !important;\n text-align: center !important;\n font-size: 18px;\n \n > div {\n padding: 40px !important;\n }\n \n * {\n color: black !important;\n }\n ";
}
var Modal_Modal = /*#__PURE__*/function (_Component) {
Modal_inherits(Modal, _Component);
var _super = Modal_createSuper(Modal);
function Modal(props) {
var _this;
Modal_classCallCheck(this, Modal);
_this = _super.call(this, props);
Modal_defineProperty(Modal_assertThisInitialized(_this), "handleOutsideMouseClick", function (event) {
var _this$props$onClose = _this.props.onClose,
onClose = _this$props$onClose === void 0 ? function () {} : _this$props$onClose;
if (event.keyCode === 27) {
event.stopPropagation();
onClose(ON_CLOSE_STATUSES.ESC_KEY_PRESSED);
}
});
_this.root = document.createElement('div');
_this.root.classList.add(CONTAINER_SELECTOR);
_this.root.id = CONTAINER_SELECTOR;
document.body.appendChild(_this.root);
var _this$props$closeOnOu = _this.props.closeOnOutsideClick,
closeOnOutsideClick = _this$props$closeOnOu === void 0 ? true : _this$props$closeOnOu;
if (closeOnOutsideClick) {
document.addEventListener('keydown', _this.handleOutsideMouseClick);
}
return _this;
}
Modal_createClass(Modal, [{
key: "componentWillUnmount",
value: function componentWillUnmount() {
var _this$props$closeOnOu2 = this.props.closeOnOutsideClick,
closeOnOutsideClick = _this$props$closeOnOu2 === void 0 ? true : _this$props$closeOnOu2;
document.body.removeChild(this.root);
if (closeOnOutsideClick) {
document.removeEventListener('keydown', this.handleOutsideMouseClick);
}
} //todo add keycode to config
}, {
key: "render",
value: function render() {
var _this = this,
_this$props = this.props,
_this$props$onClose2 = _this$props.onClose,
onClose = _this$props$onClose2 === void 0 ? function () {} : _this$props$onClose2,
isHideCloseBtn = _this$props.isHideCloseBtn,
configModalId = _this$props.configModalId,
otherProps = Modal_objectWithoutProperties(_this$props, Modal_excluded);
return /*#__PURE__*/Object(react_dom["createPortal"])( /*#__PURE__*/Object(jsx_runtime["jsxs"])(react["Fragment"], {
children: [/*#__PURE__*/Object(jsx_runtime["jsx"])(ModalOverlay, {
className: "modal-overlay",
onClick: function onClick() {
return onClose(ON_CLOSE_STATUSES.MODAL_OVERLAY_CLICKED);
}
}), /*#__PURE__*/Object(jsx_runtime["jsxs"])(ModalFullScreen, Modal_objectSpread(Modal_objectSpread({
id: configModalId || MODAL_ID
}, this.props), {}, {
children: [!isHideCloseBtn && /*#__PURE__*/Object(jsx_runtime["jsx"])(CloseBtn_CloseBtn, {
onClick: onClose
}), /*#__PURE__*/Object(jsx_runtime["jsx"])(ModalContent, Modal_objectSpread(Modal_objectSpread({
h: "100%"
}, otherProps), {}, {
children: this.props.children
}))]
}))]
}), this.root);
}
}]);
return Modal;
}(react["Component"]);
// EXTERNAL MODULE: ./src/assets/fonts/filerobot-font.css
var filerobot_font = __webpack_require__(65);
// CONCATENATED MODULE: ./src/assets/i18n/en.js
/* harmony default export */ var en = ({
'header.image_editor_title': 'Filerobot Image Editor',
'header.toggle_fullscreen': 'Toggle fullscreen',
'header.close': 'Close',
'header.close_modal': 'Close window',
'toolbar.download': 'Download',
'toolbar.save': 'Save',
'toolbar.apply': 'Apply',
'toolbar.saveAsNewImage': 'Save As New Image',
'toolbar.cancel': 'Cancel',
'toolbar.go_back': 'Go Back',
'toolbar.adjust': 'Adjust',
'toolbar.effects': 'Effects',
'toolbar.filters': 'Filters',
'toolbar.orientation': 'Orientation',
'toolbar.crop': 'Crop',
'toolbar.resize': 'Resize',
'toolbar.watermark': 'Watermark',
'toolbar.focus_point': 'Focus point',
'toolbar.shapes': 'Shapes',
'toolbar.image': 'Image',
'toolbar.text': 'Text',
'adjust.brightness': 'Brightness',
'adjust.contrast': 'Contrast',
'adjust.exposure': 'Exposure',
'adjust.saturation': 'Saturation',
'orientation.rotate_l': 'Rotate Left',
'orientation.rotate_r': 'Rotate Right',
'orientation.flip_h': 'Flip Horizontally',
'orientation.flip_v': 'Flip Vertically',
'pre_resize.title': 'Would you like to reduce resolution before editing the image?',
'pre_resize.keep_original_resolution': 'Keep original resolution',
'pre_resize.resize_n_continue': 'Resize & Continue',
'footer.reset': 'Reset',
'footer.undo': 'Undo',
'footer.redo': 'Redo',
'spinner.label': 'Processing...',
'warning.too_big_resolution': 'The resolution of the image is too big for the web. It can cause problems with Image Editor performance.',
'common.x': 'x',
'common.y': 'y',
'common.width': 'width',
'common.height': 'height',
'common.custom': 'custom',
'common.original': 'original',
'common.square': 'square',
'common.opacity': 'Opacity',
'common.apply_watermark': 'Apply watermark',
'common.url': 'URL',
'common.upload': 'Upload',
'common.gallery': 'Gallery',
'common.text': 'Text'
});
// CONCATENATED MODULE: ./src/assets/i18n/index.js
/* harmony default export */ var i18n = ({
en: en
});
// CONCATENATED MODULE: ./src/assets/theme/dark.js
/* harmony default export */ var dark = ({
colors: {
primaryBg: '#1e262c',
primaryBgHover: '#637381',
secondaryBg: '#263138',
secondaryBgHover: '#34444c',
text: '#F9FAFB',
textHover: '#fff',
textMute: '#aaa',
textWarn: '#f7931e',
secondaryBgOpacity: 'rgba(0, 0, 0, 0.75)',
accent: '#1e262c',
button: {
// primary: '#00707c', org
primary: '#58ca7e',
// secondary: '#00707c',
border: '#008D99',
hover: '#3db85f',
active: '#3db85f'
// hover: '#5064ea', org
// active: '#3c4ec7' org
},
border: '#161e23',
borderLight: '#70777f',
disabledBg: 'rgba(255, 0, 0, 0.1)'
}
});
// CONCATENATED MODULE: ./src/assets/theme/light.js
/* harmony default export */ var light = ({
colors: {
primaryBg: '#ffffff',
primaryBgHover: '#f2f2f2',
secondaryBg: '#F8FAFB',
secondaryBgHover: '#DFE7ED',
secondaryBgOpacity: 'rgba(255,255,255, 0.75)',
text: '#5D6D7E',
textHover: '#1a2329',
textMute: '#aaa',
textWarn: '#f7931e',
accent: '#D5D8DC',
button: {
primary: '#6879EB',
secondary: '#ffffff',
border: 'transparent',
hover: '#5064ea',
active: '#3c4ec7'
},
border: '#DFE7ED',
borderLight: '#e1e1e1',
disabledBg: 'rgba(255, 0, 0, 0.1)'
}
});
// CONCATENATED MODULE: ./src/utils/is-server-side.js
var isServerSide = typeof window === 'undefined' || typeof CanvasRenderingContext2D === 'undefined';
// CONCATENATED MODULE: ./src/ImageEditorWrapper.js
function ImageEditorWrapper_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ImageEditorWrapper_typeof = function _typeof(obj) { return typeof obj; }; } else { ImageEditorWrapper_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ImageEditorWrapper_typeof(obj); }
function ImageEditorWrapper_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
function ImageEditorWrapper_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ImageEditorWrapper_ownKeys(Object(source), true).forEach(function (key) { ImageEditorWrapper_defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ImageEditorWrapper_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function ImageEditorWrapper_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function ImageEditorWrapper_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; Object.defineProperty(target, descriptor.key, descriptor); } }
function ImageEditorWrapper_createClass(Constructor, protoProps, staticProps) { if (protoProps) ImageEditorWrapper_defineProperties(Constructor.prototype, protoProps); if (staticProps) ImageEditorWrapper_defineProperties(Constructor, staticProps); return Constructor; }
function ImageEditorWrapper_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) ImageEditorWrapper_setPrototypeOf(subClass, superClass); }
function ImageEditorWrapper_setPrototypeOf(o, p) { ImageEditorWrapper_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ImageEditorWrapper_setPrototypeOf(o, p); }
function ImageEditorWrapper_createSuper(Derived) { var hasNativeReflectConstruct = ImageEditorWrapper_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = ImageEditorWrapper_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = ImageEditorWrapper_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return ImageEditorWrapper_possibleConstructorReturn(this, result); }; }
function ImageEditorWrapper_possibleConstructorReturn(self, call) { if (call && (ImageEditorWrapper_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return ImageEditorWrapper_assertThisInitialized(self); }
function ImageEditorWrapper_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function ImageEditorWrapper_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function ImageEditorWrapper_getPrototypeOf(o) { ImageEditorWrapper_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return ImageEditorWrapper_getPrototypeOf(o); }
function ImageEditorWrapper_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var ImageEditorWrapper_ImageEditorWrapper = /*#__PURE__*/function (_Component) {
ImageEditorWrapper_inherits(ImageEditorWrapper, _Component);
var _super = ImageEditorWrapper_createSuper(ImageEditorWrapper);
function ImageEditorWrapper(_ref) {
var _this;
var _ref$show = _ref.show,
show = _ref$show === void 0 ? false : _ref$show,
_ref$src = _ref.src,
_src = _ref$src === void 0 ? '' : _ref$src,
_ref$config = _ref.config,
_config = _ref$config === void 0 ? {} : _ref$config;
ImageEditorWrapper_classCallCheck(this, ImageEditorWrapper);
_this = _super.call(this);
ImageEditorWrapper_defineProperty(ImageEditorWrapper_assertThisInitialized(_this), "_isMounted", false);
ImageEditorWrapper_defineProperty(ImageEditorWrapper_assertThisInitialized(_this), "processConfig", function (config) {
var processWithCloudService = config.processWithCloudimage;
var tools = config.tools || (processWithCloudService ? CLOUDIMAGE_OPERATIONS : TOOLS);
return ImageEditorWrapper_objectSpread(ImageEditorWrapper_objectSpread(ImageEditorWrapper_objectSpread({}, UPLOADER), {}, {
processWithCloudService: processWithCloudService,
processWithFilerobot: !!config.filerobot,
processWithCloudimage: !!config.cloudimage
}, config), {}, {
tools: processWithCloudService ? tools.filter(function (tool) {
return CLOUDIMAGE_OPERATIONS.indexOf(tool) > -1;
}) : tools
});
});
ImageEditorWrapper_defineProperty(ImageEditorWrapper_assertThisInitialized(_this), "open", function (src, typeDefaultEffect) {
var onOpen = _this.props.onOpen;
if (_this._isMounted) {
_this.setState({
isVisible: true,
src: src,
activeTabDefault: typeDefaultEffect||''/* Mod ??? custom action */
}, function () {
if (onOpen) onOpen();
});
}
});
ImageEditorWrapper_defineProperty(ImageEditorWrapper_assertThisInitialized(_this), "close", function () {
var closingStatus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ON_CLOSE_STATUSES.CLOSE_BTN_CLICKED;
var onClose = _this.props.onClose;
var status = ImageEditorWrapper_typeof(closingStatus) === 'object' ? ON_CLOSE_STATUSES.CLOSE_BTN_CLICKED : closingStatus;
if (_this._isMounted) {
/* Mod ??? - check operations before closing */
var _fnClose = function(){
_this.setState({
isVisible: false
}, function () {
if (onClose) onClose({
status: status
});
});
}
if (status != 'image-edits-completed' && typeof _propsImageEditor == 'object' && _propsImageEditor.state) {
var _state=_propsImageEditor.state;
var _operations=_state.initialZoom === 1?_state.operations.length:_state.operationsZoomed.length;
if (_operations) {
confirmCustom(l('all_changes_will_be_lost'), _fnClose, l('сlose_the_editor'))
} else {
_fnClose()
}
} else {
_fnClose()
}
/* Mod ??? - check operations before closing */
}
});
_config.translations = _config.translations || {};
_config.language = _config.translations[_config.language] || i18n[_config.language] ? _config.language : 'en';
_config.theme = _config.theme || {};
_config.theme.colors = _config.theme.colors || {};
_config.theme.fonts = _config.theme.fonts || STANDARD_FONTS;
_config.colorScheme = _config.colorScheme || 'dark';
_config.platform = _config.platform || 'filerobot';
var isCustomColorScheme = ImageEditorWrapper_typeof(_config.colorScheme) === 'object';
_this.state = {
isVisible: show,
src: _src,
config: _this.processConfig(_config),
t: ImageEditorWrapper_objectSpread(ImageEditorWrapper_objectSpread({}, i18n[_config.language]), _config.translations[_config.language]),
colorScheme: isCustomColorScheme ? 'custom' : _config.colorScheme || 'dark',
theme: {
colors: ImageEditorWrapper_objectSpread(ImageEditorWrapper_objectSpread({}, (isCustomColorScheme ? {
colors: _config.colorScheme
} : _config.colorScheme === 'light' ? light : dark).colors), _config.theme.colors),
fonts: _config.theme.fonts
}
};
return _this;
}
ImageEditorWrapper_createClass(ImageEditorWrapper, [{
key: "componentDidMount",
value: function componentDidMount() {
this._isMounted = true;
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
this._isMounted = false;
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
if (this.props.show !== prevProps.show) {
if (this.props.show) {
this.open(this.props.src);
} else {
this.close();
}
}
}
}, {
key: "render",
value: function render() {
var _this$state = this.state,
isVisible = _this$state.isVisible,
src = _this$state.src,
config = _this$state.config,
t = _this$state.t,
theme = _this$state.theme;
var _this$props = this.props,
_this$props$onComplet = _this$props.onComplete,
onComplete = _this$props$onComplet === void 0 ? function () {} : _this$props$onComplet,
onBeforeComplete = _this$props.onBeforeComplete,
_this$props$onError = _this$props.onError,
onError = _this$props$onError === void 0 ? function () {} : _this$props$onError,
closeOnLoad = _this$props.closeOnLoad;
var _config$showInModal = config.showInModal,
showInModal = _config$showInModal === void 0 ? true : _config$showInModal;
if (!src || !isVisible || isServerSide) return null;
if (src instanceof Blob && config.processWithCloudimage) return null;
if(_this$state.activeTabDefault){
config.activeTabDefault = _this$state.activeTabDefault;
}
var Inner = /*#__PURE__*/Object(jsx_runtime["jsx"])(Container, {
children: /*#__PURE__*/Object(jsx_runtime["jsx"])(ImageEditor_default, {
src: src,
config: config,
onComplete: onComplete,
onError: onError,
onBeforeComplete: onBeforeComplete,
onClose: this.close,
closeOnLoad: closeOnLoad,
t: t
})
});
return /*#__PURE__*/Object(jsx_runtime["jsx"])(styled_components_browser_esm["a" /* ThemeProvider */], {
theme: ImageEditorWrapper_objectSpread({}, theme),
children: showInModal ? /*#__PURE__*/Object(jsx_runtime["jsx"])(Modal_Modal, {
noBorder: true,
fullScreen: 'lg',
isHideCloseBtn: true,
style: {
borderRadius: 5
},
onClose: this.close,
configModalId: config.elementId,
children: Inner
}) : /*#__PURE__*/Object(jsx_runtime["jsx"])("div", {
className: CONTAINER_SELECTOR,
id: CONTAINER_SELECTOR,
style: {
width: '100%',
height: '100%'
},
children: Inner
})
});
}
}]);
return ImageEditorWrapper;
}(react["Component"]);
/* harmony default export */ var src_ImageEditorWrapper = (ImageEditorWrapper_ImageEditorWrapper);
// CONCATENATED MODULE: ./src/index.js
// CONCATENATED MODULE: ./src/connectors/js/index.js
function js_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var js_FilerobotImageEditor = function FilerobotImageEditor() {
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var callbacks = arguments.length > 1 ? arguments[1] : undefined;
var show = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
js_classCallCheck(this, FilerobotImageEditor);
var containerId;
if (config.elementId) {
containerId = config.elementId;
} else if (config.processWithCloudimage || !!config.cloudimage) {
containerId = 'filerobot-image-editor-cloudimage';
} else if (config.processWithFilerobot || !!config.filerobot) {
containerId = 'filerobot-image-editor-uploader';
} else {
containerId = 'filerobot-image-editor';
}
var container = document.getElementById(containerId);
var onComplete = function onComplete(src) {
console.log(src);
};
if (callbacks && typeof callbacks === 'function') {
// to support old syntax
onComplete = callbacks;
} else {
callbacks = callbacks || {};
onComplete = callbacks.onComplete || onComplete;
}
if (!container) {
container = document.createElement('div');
container.id = containerId;
document.body.appendChild(container);
}
config.elementId = containerId;
var renderApp = function renderApp(Component) {
return Object(react_dom["render"])( /*#__PURE__*/Object(jsx_runtime["jsx"])(Component, {
show: show,
config: config,
onComplete: onComplete,
onBeforeComplete: callbacks.onBeforeComplete,
onOpen: callbacks.onOpen,
onClose: callbacks.onClose,
onError: callbacks.onError
}), container);
};
this.component = renderApp(src_ImageEditorWrapper);
this.open = this.component.open;
this.close = this.component.close;
this.unmount = function () {
return Object(react_dom["unmountComponentAtNode"])(container);
};
};
window.FilerobotImageEditor = js_FilerobotImageEditor;
/***/ })
/******/ ]);